salvage 2026-11-06: uncommitted work from scratch/darkwing-scratch/r165/wt3 (disk cleanup #824)

This commit is contained in:
mos committed 2026-11-06 10:04:18 -06:00
1 parent 4f45cadc09
commit 5961afcb44
17 files changed
+364 -18

No files matched your search

+51
View File
@@ -899,6 +899,57 @@ mappings refuse. Every held role must map too. A migrated file prints unchanged.
Jason installs the output himself in Mos's window with the PM run idle, and
the re-pin follows in the same window (decision 145).
## Role instances
Row 165 (#1662, Q171, REQ-ROLE-3).
```
mosaic business instances BUSINESS [--json]
mosaic business instance add BUSINESS INSTANCE --definition DEF [--vars FILE] [--launch] --revision REV
mosaic business instance set BUSINESS INSTANCE [--definition DEF] [--vars FILE] [--launch | --no-launch] --revision REV
```
`scripts/mosaic` sends `business instances` and `business instance` here and
every other `business` command to `packages/business`. `instances` prints the
file's revision, each instance with its definition and its marks (`launcher`,
`launched`, `protected`), the definitions `add` and `set` accept, and the
definitions that declare credentials. `add` and `set` send the bus's
human-only `instances.set` verb. `set` needs at least one of `--definition`,
`--vars` and a launch flag. `--vars FILE` is a JSON object that replaces the
instance's vars whole. `--launch` and `--no-launch` add the instance to
`launch.instances` or remove it.
The business package's instance writer runs the checks `mosaic business
validate` runs before it writes, and logs the change in `changes.jsonl` with
the human as actor. It refuses, and the file keeps its bytes:
| Code | When |
|---|---|
| `organization-credentials-out-of-scope` | the definition declares credentials, or a definition change on an instance that holds them |
| `organization-instance-exists` | `add` names an instance the file has |
| `organization-unknown-instance` | `set` names an instance the file lacks |
| `organization-definition-refused` | an assistant definition or instance; those change through `mosaic limits set` |
| `organization-launch-not-configured` | a launch flag when the file has no launch block |
| `organization-no-change` | the file already says that |
| `organization-project-mismatch`, `organization-unresolvable-instance` | the change would fail `mosaic business validate` against a project file |
| `revision-conflict` | the file changed since `--revision` |
The bus sends a refusal's code alone, so the command adds the reason. A
refusal exits 2; an agent session or a non-human transport exits 3; a usage
error exits 4 before any bus call.
The commands bind no credentials. A definition that declares them needs
`credentials` and a `tracker` bot in the instance, and those, with `holder`,
stay hand edits of the business file. A vars or launch change on an instance
that holds credentials succeeds and leaves them as they are. There is no
delete.
An add or a definition change prints `restart needed`: the running bus keeps
the roles it loaded at start; this command does not restart it. The output
names no one; the restart itself needs Mos's go or Jason's hand. A vars or launch change
prints `no restart`, because the launcher reads it at its next launch check.
The Console Settings page has the same read and write (`packages/webui`).
## Token usage
`mosaic usage [--business ID] [--json]` reads the bus's accounting, without
+4
View File
@@ -17,6 +17,7 @@ import { projectBusCommand, projectCommand, PROJECT_BUS_USAGE, PROJECT_USAGE } f
import { resolveThread, threadCommand, threadMembers, threadsCommand, THREAD_TALK_USAGE, THREAD_USAGE, THREADS_USAGE } from "./thread.mjs";
import { limitsCommand, LIMITS_USAGE } from "./limits.mjs";
import { pluginsCommand, PLUGINS_USAGE } from "./plugins.mjs";
import { instancesCommand, INSTANCES_USAGE } from "./instances.mjs";
import { createChannelCaller } from "../../plugins/src/channel.mjs";
import { PluginError } from "../../plugins/src/kinds.mjs";
import { CliError } from "./errors.mjs";
@@ -37,6 +38,7 @@ export const USAGE = `usage:
${USAGE_USAGE}
${LIMITS_USAGE}
${PLUGINS_USAGE}
${INSTANCES_USAGE}
${PROJECT_USAGE}
${PROJECT_BUS_USAGE}
${THREADS_USAGE}
@@ -568,6 +570,8 @@ export async function main(argv, io = { env: process.env, stdin: process.stdin,
if (verb === "limits") return limitsCommand(rest,io,p=>callFor(p,io,deps));
if (verb === "usage") return usageCommand(rest, io, p => callFor(p, io, deps));
if (verb === "plugins") return pluginsCommand(rest, io, (p) => callFor(p, io, deps));
// Row 165 (#1662): scripts/mosaic sends only `business instances` and `business instance` here.
if (verb === "business") return instancesCommand(rest, io, (p) => callFor(p, io, deps));
if (verb === "talk") return talk(rest, io, deps);
if (verb === "follow") return talk(rest, io, deps, true);
if (verb === "name" || verb === "names") return names(verb, rest, io, deps);