@cello-protocol/cli 0.0.233 → 0.0.234

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/package.json +4 -4
  2. package/dist/arg-parse.d.ts +0 -19
  3. package/dist/arg-parse.d.ts.map +0 -1
  4. package/dist/arg-parse.js +0 -29
  5. package/dist/arg-parse.js.map +0 -1
  6. package/dist/bin/cello.d.ts +0 -15
  7. package/dist/bin/cello.d.ts.map +0 -1
  8. package/dist/bin/cello.js.map +0 -1
  9. package/dist/cli-args.d.ts +0 -62
  10. package/dist/cli-args.d.ts.map +0 -1
  11. package/dist/cli-args.js +0 -119
  12. package/dist/cli-args.js.map +0 -1
  13. package/dist/commands.d.ts +0 -139
  14. package/dist/commands.d.ts.map +0 -1
  15. package/dist/commands.js +0 -1005
  16. package/dist/commands.js.map +0 -1
  17. package/dist/hermes/assets.d.ts +0 -35
  18. package/dist/hermes/assets.d.ts.map +0 -1
  19. package/dist/hermes/assets.js +0 -1396
  20. package/dist/hermes/assets.js.map +0 -1
  21. package/dist/hermes/install-hermes.d.ts +0 -44
  22. package/dist/hermes/install-hermes.d.ts.map +0 -1
  23. package/dist/hermes/install-hermes.js +0 -172
  24. package/dist/hermes/install-hermes.js.map +0 -1
  25. package/dist/json-out.d.ts +0 -41
  26. package/dist/json-out.d.ts.map +0 -1
  27. package/dist/json-out.js +0 -59
  28. package/dist/json-out.js.map +0 -1
  29. package/dist/parity-commands.d.ts +0 -358
  30. package/dist/parity-commands.d.ts.map +0 -1
  31. package/dist/parity-commands.js +0 -720
  32. package/dist/parity-commands.js.map +0 -1
  33. package/dist/registry.d.ts +0 -111
  34. package/dist/registry.d.ts.map +0 -1
  35. package/dist/registry.js +0 -1552
  36. package/dist/registry.js.map +0 -1
  37. package/dist/screener-commands.d.ts +0 -57
  38. package/dist/screener-commands.d.ts.map +0 -1
  39. package/dist/screener-commands.js +0 -229
  40. package/dist/screener-commands.js.map +0 -1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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+uC9C,CAAC;AAEF,wEAAwE;AACxE,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqE9B,CAAC"}
@@ -1,44 +0,0 @@
1
- /**
2
- * HERMES-001 — `cello bridge hermes`: wire the local CELLO daemon into a Hermes
3
- * Agent installation.
4
- *
5
- * What it does (design: trustless-cello 2026-07-09_1915_hermes-agent-integration-plan.md §5):
6
- * 1. Scaffolds the platform-adapter plugin into $HERMES_HOME/plugins/cello/
7
- * (plugin.yaml + __init__.py — a pure-stdlib Python IPC client, no subprocess).
8
- * 2. Drops the cello-bridge-setup skill into $HERMES_HOME/skills/.
9
- * 3. Binds the agent: writes CELLO_AGENT_NAME=<agent> into $HERMES_HOME/.env
10
- * (replace-or-append; every other line preserved byte-for-byte).
11
- * 4. Registers through Hermes' OWN CLI surfaces — `hermes plugins enable cello` and
12
- * `hermes mcp add cello …` — never by hand-editing config.yaml, so Hermes owns
13
- * its config format.
14
- *
15
- * Never edits anything outside $HERMES_HOME. Idempotent: re-running upgrades the
16
- * scaffolded files in place and keeps exactly one CELLO_AGENT_NAME line.
17
- */
18
- export interface ExecResult {
19
- code: number;
20
- stdout: string;
21
- stderr: string;
22
- }
23
- export type ExecFn = (cmd: string, args: string[]) => Promise<ExecResult>;
24
- /** DOD-HERMES-4 — the two per-agent behaviour settings, and their defaults. */
25
- export declare const DELIVERY_MODES: readonly ["channel", "wake"];
26
- export declare const SESSION_SCOPES: readonly ["agent", "peer"];
27
- export declare const DEFAULT_DELIVERY_MODE: (typeof DELIVERY_MODES)[number];
28
- export declare const DEFAULT_SESSION_SCOPE: (typeof SESSION_SCOPES)[number];
29
- export interface InstallHermesOptions {
30
- agentName: string;
31
- /** Defaults to $HERMES_HOME, falling back to ~/.hermes. */
32
- hermesHome?: string;
33
- /** `channel` (default): CELLO behaves as a normal two-way channel. `wake`: notices only. */
34
- deliveryMode?: string;
35
- /** `agent` (default): one conversation per agent. `peer`: one per counterparty. */
36
- sessionScope?: string;
37
- /** Injectable for tests; defaults to a spawn-based runner. */
38
- exec?: ExecFn;
39
- }
40
- export declare function installHermes(opts: InstallHermesOptions): Promise<{
41
- exitCode: number;
42
- output: string;
43
- }>;
44
- //# sourceMappingURL=install-hermes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install-hermes.d.ts","sourceRoot":"","sources":["../../src/hermes/install-hermes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAE1E,+EAA+E;AAC/E,eAAO,MAAM,cAAc,8BAA+B,CAAC;AAC3D,eAAO,MAAM,cAAc,4BAA6B,CAAC;AACzD,eAAO,MAAM,qBAAqB,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAa,CAAC;AAChF,eAAO,MAAM,qBAAqB,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAW,CAAC;AAE9E,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4FAA4F;IAC5F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAoDD,wBAAsB,aAAa,CACjC,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CA8H/C"}
@@ -1,172 +0,0 @@
1
- /**
2
- * HERMES-001 — `cello bridge hermes`: wire the local CELLO daemon into a Hermes
3
- * Agent installation.
4
- *
5
- * What it does (design: trustless-cello 2026-07-09_1915_hermes-agent-integration-plan.md §5):
6
- * 1. Scaffolds the platform-adapter plugin into $HERMES_HOME/plugins/cello/
7
- * (plugin.yaml + __init__.py — a pure-stdlib Python IPC client, no subprocess).
8
- * 2. Drops the cello-bridge-setup skill into $HERMES_HOME/skills/.
9
- * 3. Binds the agent: writes CELLO_AGENT_NAME=<agent> into $HERMES_HOME/.env
10
- * (replace-or-append; every other line preserved byte-for-byte).
11
- * 4. Registers through Hermes' OWN CLI surfaces — `hermes plugins enable cello` and
12
- * `hermes mcp add cello …` — never by hand-editing config.yaml, so Hermes owns
13
- * its config format.
14
- *
15
- * Never edits anything outside $HERMES_HOME. Idempotent: re-running upgrades the
16
- * scaffolded files in place and keeps exactly one CELLO_AGENT_NAME line.
17
- */
18
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
19
- import { homedir } from "node:os";
20
- import { join } from "node:path";
21
- import { spawn } from "node:child_process";
22
- import { HERMES_PLUGIN_YAML, HERMES_PLUGIN_INIT_PY, HERMES_SKILL_MD } from "./assets.js";
23
- /** DOD-HERMES-4 — the two per-agent behaviour settings, and their defaults. */
24
- export const DELIVERY_MODES = ["channel", "wake"];
25
- export const SESSION_SCOPES = ["agent", "peer"];
26
- export const DEFAULT_DELIVERY_MODE = "channel";
27
- export const DEFAULT_SESSION_SCOPE = "agent";
28
- /** The two Hermes CLI registrations the installer performs (also printed as the
29
- * manual fallback when the `hermes` binary cannot be run). */
30
- const HERMES_COMMANDS = [
31
- ["plugins", "enable", "cello"],
32
- ["mcp", "add", "cello", "--command", "npx", "--args", "--yes", "@cello-protocol/connect@latest"],
33
- ];
34
- const defaultExec = (cmd, args) => new Promise((resolve, reject) => {
35
- const child = spawn(cmd, args, { stdio: ["pipe", "pipe", "pipe"] });
36
- // `hermes mcp add` is interactive: on a re-run it first asks "... already exists.
37
- // Overwrite? [y/N]" (default NO), then "Enable all N tools? [Y/n/select]". Feed a
38
- // few "Y" lines so BOTH prompts are answered yes on the fresh AND the re-run path
39
- // (extra lines are harmless — the child stops reading once satisfied). A closed
40
- // stdin would read as EOF → "Cancelled." with exit 0, which is why installHermes
41
- // also VERIFIES the registration against `hermes mcp list` rather than trusting
42
- // the exit code.
43
- child.stdin.write("Y\nY\nY\n");
44
- child.stdin.end();
45
- let stdout = "";
46
- let stderr = "";
47
- child.stdout.on("data", (d) => (stdout += d.toString("utf-8")));
48
- child.stderr.on("data", (d) => (stderr += d.toString("utf-8")));
49
- child.on("error", reject); // e.g. ENOENT — hermes not on PATH
50
- child.on("close", (code) => resolve({ code: code ?? 1, stdout, stderr }));
51
- });
52
- /** Replace-or-append KEY=value in an env file, preserving every other line. */
53
- function upsertEnvLine(envPath, key, value) {
54
- const line = `${key}=${value}`;
55
- let lines = [];
56
- if (existsSync(envPath)) {
57
- lines = readFileSync(envPath, "utf-8").split("\n");
58
- }
59
- let replaced = false;
60
- lines = lines.map((l) => {
61
- if (l.startsWith(`${key}=`)) {
62
- replaced = true;
63
- return line;
64
- }
65
- return l;
66
- });
67
- if (!replaced) {
68
- // Drop a single trailing empty line before appending so we don't grow blank gaps.
69
- if (lines.length > 0 && lines[lines.length - 1] === "")
70
- lines.pop();
71
- lines.push(line);
72
- }
73
- writeFileSync(envPath, lines.join("\n") + (lines[lines.length - 1] === "" ? "" : "\n"));
74
- }
75
- export async function installHermes(opts) {
76
- const agentName = (opts.agentName ?? "").trim();
77
- if (!agentName) {
78
- return {
79
- exitCode: 1,
80
- output: "Missing agent name. Usage: cello bridge hermes --agent <name> [--hermes-home <path>]\n" +
81
- "The agent must be a local CELLO agent (see 'cello status' for the list).",
82
- };
83
- }
84
- // Validate the modes BEFORE touching the filesystem. A typo must not be written into .env and
85
- // discovered later as a gateway that refuses to start — reject it here, where the operator is
86
- // still looking at the command they just typed.
87
- const deliveryMode = (opts.deliveryMode ?? DEFAULT_DELIVERY_MODE).trim().toLowerCase();
88
- const sessionScope = (opts.sessionScope ?? DEFAULT_SESSION_SCOPE).trim().toLowerCase();
89
- for (const [flag, value, allowed] of [
90
- ["--delivery-mode", deliveryMode, DELIVERY_MODES],
91
- ["--session-scope", sessionScope, SESSION_SCOPES],
92
- ]) {
93
- if (!allowed.includes(value)) {
94
- return {
95
- exitCode: 1,
96
- output: `Invalid ${flag} '${value}'. Expected one of: ${allowed.join(", ")}.\n` +
97
- (flag === "--delivery-mode"
98
- ? " channel — CELLO behaves like a normal chat channel (default)\n" +
99
- " wake — content-free notices only; the agent reads and replies via cello_* tools"
100
- : " agent — one conversation per CELLO agent (default)\n" +
101
- " peer — one conversation per counterparty, for a support desk"),
102
- };
103
- }
104
- }
105
- const hermesHome = opts.hermesHome || process.env.HERMES_HOME || join(homedir(), ".hermes");
106
- if (!existsSync(hermesHome)) {
107
- return {
108
- exitCode: 1,
109
- output: `Hermes home not found at ${hermesHome}.\n` +
110
- "Install Hermes Agent first (https://hermes-agent.nousresearch.com), or pass --hermes-home <path> " +
111
- "if it lives elsewhere.",
112
- };
113
- }
114
- const exec = opts.exec ?? defaultExec;
115
- const out = [];
116
- // 1. Plugin package
117
- const pluginDir = join(hermesHome, "plugins", "cello");
118
- mkdirSync(pluginDir, { recursive: true });
119
- writeFileSync(join(pluginDir, "plugin.yaml"), HERMES_PLUGIN_YAML);
120
- writeFileSync(join(pluginDir, "__init__.py"), HERMES_PLUGIN_INIT_PY);
121
- out.push(`Wrote plugin: ${pluginDir}/{plugin.yaml,__init__.py}`);
122
- // 2. Skill
123
- const skillDir = join(hermesHome, "skills", "cello-bridge-setup");
124
- mkdirSync(skillDir, { recursive: true });
125
- writeFileSync(join(skillDir, "SKILL.md"), HERMES_SKILL_MD);
126
- out.push(`Wrote skill: ${skillDir}/SKILL.md`);
127
- // 3. Agent binding + behaviour settings. All three are written on every run, so re-running the
128
- // installer without a flag RESETS that flag to its default rather than silently inheriting
129
- // a value the operator can no longer see in the command they typed.
130
- const envPath = join(hermesHome, ".env");
131
- upsertEnvLine(envPath, "CELLO_AGENT_NAME", agentName);
132
- upsertEnvLine(envPath, "CELLO_DELIVERY_MODE", deliveryMode);
133
- upsertEnvLine(envPath, "CELLO_SESSION_SCOPE", sessionScope);
134
- out.push(`Bound agent: CELLO_AGENT_NAME=${agentName} (${envPath})`);
135
- out.push(`Delivery: CELLO_DELIVERY_MODE=${deliveryMode}`);
136
- out.push(`Scope: CELLO_SESSION_SCOPE=${sessionScope}`);
137
- // 4. Register through Hermes' own CLI. A failure here is loud: the files are in
138
- // place, so we print exactly what remains to be run by hand.
139
- for (const args of HERMES_COMMANDS) {
140
- let result;
141
- try {
142
- result = await exec("hermes", [...args]);
143
- }
144
- catch (err) {
145
- const msg = err instanceof Error ? err.message : String(err);
146
- out.push(`\nCould not run the 'hermes' CLI (${msg}).`, "The CELLO files are installed, but Hermes still needs these two commands run manually:", " hermes plugins enable cello", " hermes mcp add cello --command npx --args --yes @cello-protocol/connect@latest", "Then restart the gateway: hermes gateway restart");
147
- return { exitCode: 1, output: out.join("\n") };
148
- }
149
- if (result.code !== 0) {
150
- out.push(`\n'hermes ${args.join(" ")}' failed (exit ${result.code}):`, (result.stderr || result.stdout).trim(), "Fix the error above and re-run 'cello bridge hermes' (it is idempotent).");
151
- return { exitCode: 1, output: out.join("\n") };
152
- }
153
- out.push(`Ran: hermes ${args.join(" ")}`);
154
- }
155
- // Verify the MCP registration actually landed: `hermes mcp add` can print
156
- // "Cancelled." and still exit 0 (e.g. when its interactive prompt hits EOF),
157
- // so the exit code alone proves nothing.
158
- try {
159
- const list = await exec("hermes", ["mcp", "list"]);
160
- if (!list.stdout.includes("cello")) {
161
- out.push("", "'hermes mcp add' reported success but 'hermes mcp list' does not show a 'cello' server.", "Run this manually and answer Y at the tool prompt:", " hermes mcp add cello --command npx --args --yes @cello-protocol/connect@latest");
162
- return { exitCode: 1, output: out.join("\n") };
163
- }
164
- }
165
- catch {
166
- // hermes CLI vanished between calls — vanishingly unlikely; the add above succeeded.
167
- }
168
- out.push("Verified: 'cello' present in hermes mcp list");
169
- out.push("", "CELLO bridge installed. Next step: restart the gateway so Hermes loads the plugin:", " hermes gateway restart", "Then verify from a Hermes chat by calling the cello_status MCP tool.");
170
- return { exitCode: 0, output: out.join("\n") };
171
- }
172
- //# sourceMappingURL=install-hermes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install-hermes.js","sourceRoot":"","sources":["../../src/hermes/install-hermes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO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This is what makes `cello` a real programmatic interface rather than a human-only UI: any
5
- * bash-capable agent can drive a CELLO node with `cello <cmd> | jq` + `$?`, with no MCP dependency.
6
- *
7
- * The contract, applied identically by every parity command:
8
- * - stdout = the daemon's IPC response as JSON, one object per invocation (compact by default —
9
- * scripts and agents are the first-class consumer; `--pretty` for humans).
10
- * - exit 0 when the response is ok:true; non-zero otherwise.
11
- * - a FAILED response goes to stderr, VERBATIM — every field the daemon sent (reason, guidance,
12
- * and extras like the read-before-write cursor) survives untouched, and stdout stays EMPTY so a
13
- * piping script can never mistake an error body for a result.
14
- *
15
- * The verbatim rule is the DOD-SENDRAW-1 / DOD-LOGOUT-WAIT-1 lesson at the CLI surface: report the
16
- * outcome, never the intent. A command that reports success for a failed IPC call is a lie, and
17
- * absence of ok:true is NOT evidence of success — an unrecognized shape fails loud rather than
18
- * being optimistically passed off as a result.
19
- */
20
- export interface EmittedOutput {
21
- stdout: string;
22
- stderr: string;
23
- exitCode: number;
24
- }
25
- export interface EmitOptions {
26
- /** Human-readable indented JSON. JSON stays the default so scripts come first. */
27
- pretty?: boolean;
28
- }
29
- /**
30
- * Turn a daemon IPC response into the (stdout, stderr, exitCode) triple the contract demands.
31
- * The response is passed through UNMODIFIED in both directions — this function decides the stream
32
- * and the exit code, and is never allowed to rewrite, summarize, or invent the body.
33
- */
34
- export declare function emitIpcResult(result: Record<string, unknown>, opts?: EmitOptions): EmittedOutput;
35
- /**
36
- * A transport/daemon-level failure (socket unreachable, daemon not running, thrown error) — still
37
- * a structured, machine-parseable JSON error on stderr, so a bash agent branches on the same shape
38
- * whether the daemon rejected the call or never received it.
39
- */
40
- export declare function emitTransportError(reason: string, guidance: string, opts?: EmitOptions): EmittedOutput;
41
- //# sourceMappingURL=json-out.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-out.d.ts","sourceRoot":"","sources":["../src/json-out.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAMD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,IAAI,GAAE,WAAgB,GACrB,aAAa,CAkBf;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB,GAAG,aAAa,CAM1G"}
package/dist/json-out.js DELETED
@@ -1,59 +0,0 @@
1
- /**
2
- * DOD-CLI-PARITY-1 §3 — the bash-adapter contract.
3
- *
4
- * This is what makes `cello` a real programmatic interface rather than a human-only UI: any
5
- * bash-capable agent can drive a CELLO node with `cello <cmd> | jq` + `$?`, with no MCP dependency.
6
- *
7
- * The contract, applied identically by every parity command:
8
- * - stdout = the daemon's IPC response as JSON, one object per invocation (compact by default —
9
- * scripts and agents are the first-class consumer; `--pretty` for humans).
10
- * - exit 0 when the response is ok:true; non-zero otherwise.
11
- * - a FAILED response goes to stderr, VERBATIM — every field the daemon sent (reason, guidance,
12
- * and extras like the read-before-write cursor) survives untouched, and stdout stays EMPTY so a
13
- * piping script can never mistake an error body for a result.
14
- *
15
- * The verbatim rule is the DOD-SENDRAW-1 / DOD-LOGOUT-WAIT-1 lesson at the CLI surface: report the
16
- * outcome, never the intent. A command that reports success for a failed IPC call is a lie, and
17
- * absence of ok:true is NOT evidence of success — an unrecognized shape fails loud rather than
18
- * being optimistically passed off as a result.
19
- */
20
- function render(value, pretty) {
21
- return pretty ? JSON.stringify(value, null, 2) : JSON.stringify(value);
22
- }
23
- /**
24
- * Turn a daemon IPC response into the (stdout, stderr, exitCode) triple the contract demands.
25
- * The response is passed through UNMODIFIED in both directions — this function decides the stream
26
- * and the exit code, and is never allowed to rewrite, summarize, or invent the body.
27
- */
28
- export function emitIpcResult(result, opts = {}) {
29
- // The exit code keys on `ok === false`, not on `ok === true`, because the daemon has TWO response
30
- // conventions and only one of them carries `ok`:
31
- // (a) ok-bearing — { ok: true, … } / { ok: false, reason, guidance }
32
- // (b) payload-only — a bare result with NO `ok` at all: cello_list_agents returns { agents: [] },
33
- // cello_await_session returns { type: "timeout" | … }.
34
- // `ok: false` is the daemon's ONE failure convention; a genuine transport/daemon failure THROWS
35
- // and is handled by the caller as a transport error. So a payload without `ok` is a result, and
36
- // routing it to stderr would report working commands as broken — `cello agents` would exit 1 on
37
- // success.
38
- //
39
- // This does NOT weaken the no-fabricated-success rule: we never synthesize an ok:true, never
40
- // rewrite a body, and never swallow an ok:false. We report exactly what the daemon said.
41
- const failed = result.ok === false;
42
- if (failed) {
43
- return { stdout: "", stderr: render(result, opts.pretty), exitCode: 1 };
44
- }
45
- return { stdout: render(result, opts.pretty), stderr: "", exitCode: 0 };
46
- }
47
- /**
48
- * A transport/daemon-level failure (socket unreachable, daemon not running, thrown error) — still
49
- * a structured, machine-parseable JSON error on stderr, so a bash agent branches on the same shape
50
- * whether the daemon rejected the call or never received it.
51
- */
52
- export function emitTransportError(reason, guidance, opts = {}) {
53
- return {
54
- stdout: "",
55
- stderr: render({ ok: false, reason, guidance }, opts.pretty),
56
- exitCode: 1,
57
- };
58
- }
59
- //# sourceMappingURL=json-out.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-out.js","sourceRoot":"","sources":["../src/json-out.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAaH,SAAS,MAAM,CAAC,KAAc,EAAE,MAA2B;IACzD,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;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