orkestrator 2.39.0-beta → 2.39.1-beta

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.
@@ -95,15 +95,12 @@ function shortcutFocus(target) {
95
95
  return target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement ? "text" : "page";
96
96
  }
97
97
 
98
- // ../protocol/src/design-runtime.ts
99
- function installDesignRuntime(matchesShortcut, shortcuts, claimsShortcut, focusedSurface) {
100
- const MAX_HTML_BYTES = 256 * 1024;
101
- const MAX_ELEMENTS = 5000;
98
+ // ../protocol/src/static-html-sanitizer.ts
99
+ function createStaticHtmlSanitizer() {
102
100
  const forbidden = "script,iframe,frame,object,embed,base,meta,link,portal,applet";
103
101
  const externalUrl = /^\s*(?:https?:)?\/\//i;
104
102
  const cssExternal = /url\(\s*['"]?\s*(?:https?:)?\/\//gi;
105
103
  const cssImport = /@import\s/gi;
106
- let mode = "inspect";
107
104
  const emptyCounts = () => ({
108
105
  scripts: 0,
109
106
  handlers: 0,
@@ -160,6 +157,15 @@ function installDesignRuntime(matchesShortcut, shortcuts, claimsShortcut, focuse
160
157
  }
161
158
  return total;
162
159
  }
160
+ return { emptyCounts, clean, elementCount };
161
+ }
162
+
163
+ // ../protocol/src/design-runtime.ts
164
+ function installDesignRuntime(createSanitizer, matchesShortcut, shortcuts, claimsShortcut, focusedSurface) {
165
+ const MAX_HTML_BYTES = 256 * 1024;
166
+ const MAX_ELEMENTS = 5000;
167
+ const { clean, elementCount, emptyCounts } = createSanitizer();
168
+ let mode = "inspect";
163
169
  function depthOf(root) {
164
170
  if (!root)
165
171
  return 0;
@@ -610,7 +616,7 @@ function designDocument(scriptSource, scriptAttributes, script) {
610
616
  return `<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src ${scriptSource}; style-src 'unsafe-inline'; img-src data:; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'"></head><body><script${scriptAttributes}>${script}</script></body></html>`;
611
617
  }
612
618
  function designRuntimeScript() {
613
- return `(${installDesignRuntime.toString()})(${matchAppShortcut.toString()}, ${JSON.stringify(APP_SHORTCUTS)}, ${appClaimsShortcut.toString()}, ${shortcutFocus.toString()});`;
619
+ return `(${installDesignRuntime.toString()})(${createStaticHtmlSanitizer.toString()}, ${matchAppShortcut.toString()}, ${JSON.stringify(APP_SHORTCUTS)}, ${appClaimsShortcut.toString()}, ${shortcutFocus.toString()});`;
614
620
  }
615
621
  function designBootstrap(nonce) {
616
622
  if (!/^[a-zA-Z0-9-]{16,80}$/.test(nonce))
@@ -94,15 +94,12 @@ function shortcutFocus(target) {
94
94
  return target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement ? "text" : "page";
95
95
  }
96
96
 
97
- // packages/protocol/src/design-runtime.ts
98
- function installDesignRuntime(matchesShortcut, shortcuts, claimsShortcut, focusedSurface) {
99
- const MAX_HTML_BYTES = 256 * 1024;
100
- const MAX_ELEMENTS = 5000;
97
+ // packages/protocol/src/static-html-sanitizer.ts
98
+ function createStaticHtmlSanitizer() {
101
99
  const forbidden = "script,iframe,frame,object,embed,base,meta,link,portal,applet";
102
100
  const externalUrl = /^\s*(?:https?:)?\/\//i;
103
101
  const cssExternal = /url\(\s*['"]?\s*(?:https?:)?\/\//gi;
104
102
  const cssImport = /@import\s/gi;
105
- let mode = "inspect";
106
103
  const emptyCounts = () => ({
107
104
  scripts: 0,
108
105
  handlers: 0,
@@ -159,6 +156,15 @@ function installDesignRuntime(matchesShortcut, shortcuts, claimsShortcut, focuse
159
156
  }
160
157
  return total;
161
158
  }
159
+ return { emptyCounts, clean, elementCount };
160
+ }
161
+
162
+ // packages/protocol/src/design-runtime.ts
163
+ function installDesignRuntime(createSanitizer, matchesShortcut, shortcuts, claimsShortcut, focusedSurface) {
164
+ const MAX_HTML_BYTES = 256 * 1024;
165
+ const MAX_ELEMENTS = 5000;
166
+ const { clean, elementCount, emptyCounts } = createSanitizer();
167
+ let mode = "inspect";
162
168
  function depthOf(root) {
163
169
  if (!root)
164
170
  return 0;
@@ -609,7 +615,7 @@ function designDocument(scriptSource, scriptAttributes, script) {
609
615
  return `<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src ${scriptSource}; style-src 'unsafe-inline'; img-src data:; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'"></head><body><script${scriptAttributes}>${script}</script></body></html>`;
610
616
  }
611
617
  function designRuntimeScript() {
612
- return `(${installDesignRuntime.toString()})(${matchAppShortcut.toString()}, ${JSON.stringify(APP_SHORTCUTS)}, ${appClaimsShortcut.toString()}, ${shortcutFocus.toString()});`;
618
+ return `(${installDesignRuntime.toString()})(${createStaticHtmlSanitizer.toString()}, ${matchAppShortcut.toString()}, ${JSON.stringify(APP_SHORTCUTS)}, ${appClaimsShortcut.toString()}, ${shortcutFocus.toString()});`;
613
619
  }
614
620
  function designBootstrap(nonce) {
615
621
  if (!/^[a-zA-Z0-9-]{16,80}$/.test(nonce))
package/dist/client.js CHANGED
@@ -357,6 +357,12 @@ var init_bridge = __esm(() => {
357
357
  "interaction.present-failed": "Presenting an interaction threw; it is cancelled.",
358
358
  "interaction.resolved-callback-failed": "An interaction resolved callback threw.",
359
359
  "journal.persist-failed": "Saving the dispatch journal failed.",
360
+ "login-state.adopted": "State an earlier bridge kept in this login's own directory was adopted into the shared state directory; `adopted` lists what.",
361
+ "login-state.change-evidence-failed": "Adopting this login's change evidence failed; it stays in place for the next start and the spool opens without it.",
362
+ "login-state.command-changes-failed": "Adopting this login's command-change journals failed; the next start retries.",
363
+ "login-state.dispatch-journal-failed": "Adopting this login's dispatch journal failed; every dispatch is refused until a start adopts it.",
364
+ "login-state.titles-failed": "Adopting this login's session titles failed; the next start retries.",
365
+ "managed-requirements.unreadable": "configRequirements/read failed, so sessions keep the sandbox they asked for on this generation.",
360
366
  "message.publish-failed": "Publishing a message update failed.",
361
367
  "models.cache-persist-failed": "Saving the model cache failed.",
362
368
  "models.debug-read-failed": "`codex debug models` failed; another source is used.",
@@ -882,11 +888,11 @@ var init_native_agent = __esm(() => {
882
888
  events: {
883
889
  "session.bridge-replaced-for-policy": "An idle bridge was stopped so a resume could apply the user's wider execution policy.",
884
890
  "catalogue.outdated-bridge": "A bridge predates the command catalogue, so its commands stay unavailable.",
885
- "compact.instructions-ignored": "A bridge compacted without confirming the instructions sent with /compact: it predates them.",
886
891
  "handoff.summary-read-failed": "Change summaries could not be read for a handoff, so the carrier says they are unmeasured.",
887
892
  "handoff.consume-failed": "A delivered handoff could not be marked consumed.",
888
893
  "job.pr-refresh-rollback-failed": "Rolling back a pull request refresh for a job failed.",
889
894
  "job.resend-queue-failed": "A resend could not be queued for a job.",
895
+ "job.pipeline-resolve-adoption-failed": "A build pipeline's conflict-resolution session could not be opened as the Resolve tab; a new tab is used.",
890
896
  "interaction.requests-dropped": "Interaction requests that could not be mapped were dropped.",
891
897
  "human-prompt.listener-failed": "A human prompt listener threw; the others still run.",
892
898
  "question.attention-record-failed": "Attention for an async question could not be recorded; the transcript stays readable.",
@@ -1249,6 +1255,8 @@ var init_tmux = __esm(() => {
1249
1255
  "interactive.lease-lapsed": "No client renewed an interactive terminal for 45 seconds, so its capture loop stopped.",
1250
1256
  "signal.arm-failed": "The Claude state signal could not be armed.",
1251
1257
  "signal.degraded": "The Claude state signal missed a change or rang too often, so polling stays at one second until it is re-armed.",
1258
+ "terminal-claude.settled": "A container terminal Claude turn no hook will end was settled: the CLI refused the prompt with its sign-in notice, or the last terminal closed mid-turn.",
1259
+ "terminal-claude.settle-failed": "Settling a container terminal Claude turn failed; the next read of the same state retries.",
1252
1260
  "hook-signal.arm-failed": "The tmux hook doorbell could not be armed.",
1253
1261
  "hook-signal.degraded": "The tmux hook doorbell missed a hook, so idle tabs poll every second until it is re-armed.",
1254
1262
  "pr-refresh.schedule-failed": "A pull request refresh after a turn could not be scheduled.",
@@ -1369,6 +1377,9 @@ var init_storage = __esm(() => {
1369
1377
  "kanban.image-cleanup-failed": "An orphaned Kanban image could not be removed after its retries; it is safe to remove later.",
1370
1378
  "kanban.removal-image-cleanup-pending": "A removed project's ticket image files could not all be unlinked; they stay journaled and the removal fails so a retry finishes them.",
1371
1379
  "kanban.delivery-sidecar-cleanup-failed": "A removed project's deleted-ticket delivery sidecars could not all be removed; the removal fails so a retry finishes them.",
1380
+ "kanban.removed-project-sweep-skipped": "Steps of the startup sweep for rows of projects removed before removal deleted their content were refused or failed (`steps` names them, e.g. an unreadable store); their rows stay for the next start.",
1381
+ "removed-project-sweep.removed": "The startup sweep deleted rows that removed projects or deleted pipelines had left behind; the fields are counts by kind.",
1382
+ "removed-project-sweep.refused": "The startup sweep for removed projects' rows did not run because the projects store could not be read completely; nothing was deleted and the next start tries again.",
1372
1383
  "nodes.entries-dropped": "Unreadable node registry entries were ignored.",
1373
1384
  "preview-identity.reminted": "The data directory moved or was copied, so previews get a new backend identity.",
1374
1385
  "preview-settings.invalid": "Invalid preview settings disabled transport and relay.",
@@ -1434,6 +1445,7 @@ var init_build_pipeline = __esm(() => {
1434
1445
  "transcripts.maintenance-failed": "Migrating or sweeping stage transcripts failed; the next start retries.",
1435
1446
  "restore.skipped": "A pipeline could not be restored at startup and was skipped.",
1436
1447
  "criteria.record-failed": "Acceptance criteria results could not be recorded on the ticket.",
1448
+ "network-preference.save-failed": "The network access chosen for a new build could not be remembered for its project; the build still runs.",
1437
1449
  "completion-notes.publish-failed": "A finished pipeline's notes tab could not be added to the layout; the run stays complete.",
1438
1450
  "workspace.waiting": "A pipeline is waiting for its workspace; written once per reason.",
1439
1451
  "rewind.pending": "A pipeline's code rewind has not finished; written once per reason.",
@@ -1929,7 +1941,8 @@ var init_nodes = __esm(() => {
1929
1941
  "handover.recovery-pending": "Command handover recovery is still pending.",
1930
1942
  "ticket-sync.work-record-failed": "A remote build started but its ticket work location could not be saved.",
1931
1943
  "ticket-sync.failed": "A Kanban sync with a node failed; it is retried.",
1932
- "ticket-sync.unknown-project": "A node sent ticket changes for a project that no longer exists here.",
1944
+ "ticket-sync.unknown-project": "A node sent ticket changes for a project this machine does not list, and its project store could not be read to confirm the project was removed; the changes stay queued on the node.",
1945
+ "ticket-sync.removed-project-dropped": "A node's queued ticket changes for a project removed here were dropped and acknowledged; `dropped` counts them, and the node was told to keep its copies as its own.",
1933
1946
  "ticket-sync.forget-failed": "A detached command node's ticket copies could not be released.",
1934
1947
  "usage-sync.failed": "Sharing usage readings with a node failed; the next reading or reconnect retries.",
1935
1948
  "fleet-update.requested": "The update policy asked an older leaf to install the command node's version.",
@@ -1952,6 +1965,10 @@ var init_linear = __esm(() => {
1952
1965
  "comments.load-failed": "An issue's comments could not be loaded; the issue still renders without them.",
1953
1966
  "connection.revoked-by-sync": "A disconnect made on another machine named this machine's Linear key, so it was cleared here.",
1954
1967
  "connection.exported-to-command-node": "An attached command node copied this machine's Linear key at the user's request (the key is not logged).",
1968
+ "merged-label.applied": "A Linear-sourced build's pull request merged and its issue now has the `merged` label (added, created then added, or already there).",
1969
+ "merged-label.failed": "Adding the `merged` label to a merged build's Linear issue failed; the reason is logged and it is retried later.",
1970
+ "merged-label.queue-full": "Legacy queue-capacity warning, no longer emitted: pending merged-label obligations are retained.",
1971
+ "merged-label.record-failed": "A merged pull request's Linear-sourced builds could not be read or queued for the `merged` label.",
1955
1972
  "sync.failed": "A Linear board-link sync with a node failed; it is retried on the next pass.",
1956
1973
  "sync.older-node": "A node does not sync Linear board links yet; it keeps its own links."
1957
1974
  }
@@ -2185,6 +2202,8 @@ var init_web_chat = __esm(() => {
2185
2202
  "compose-draft.persist-failed": "A compose draft could not be saved.",
2186
2203
  "compose-draft.restore-failed": "A saved compose draft could not be restored.",
2187
2204
  "compose-draft.discard-failed": "A saved compose draft could not be discarded.",
2205
+ "compose-draft.retry-recovered": "A compose draft save or discard that had failed succeeded on retry.",
2206
+ "compose-draft.retry-abandoned": "A failed compose draft save or discard stopped retrying (conflict, capacity or attempts).",
2188
2207
  "paste.failed": "Pasting an image into a composer failed unexpectedly.",
2189
2208
  "agent-state.listen-failed": "Subscribing to a tab's agent state events failed.",
2190
2209
  "model-favorites.persist-failed": "The favorite model list could not be saved."
@@ -4433,6 +4452,7 @@ var init_command_capture = __esm(() => {
4433
4452
  // ../protocol/src/node/standalone-service.ts
4434
4453
  var exports_standalone_service = {};
4435
4454
  __export(exports_standalone_service, {
4455
+ FIRST_LOCKED_RELEASE: () => FIRST_LOCKED_RELEASE,
4436
4456
  RELEASE_RUNTIME_PATH: () => RELEASE_RUNTIME_PATH,
4437
4457
  STANDALONE_DIRECTORY: () => STANDALONE_DIRECTORY,
4438
4458
  STANDALONE_MAX_BOOT_ATTEMPTS: () => STANDALONE_MAX_BOOT_ATTEMPTS,
@@ -4620,24 +4640,25 @@ async function installRelease(layout, version, options2) {
4620
4640
  env: { ...process.env, BUN_INSTALL_CACHE_DIR: path17.join(fetching, ".cache") }
4621
4641
  });
4622
4642
  options2.signal?.throwIfAborted();
4623
- const fetched = path17.join(fetching, "node_modules", STANDALONE_PACKAGE);
4643
+ if (readReleaseManifest(fetching)?.version !== version) {
4644
+ throw new Error(`Installing ${STANDALONE_PACKAGE}@${version} produced no usable release`);
4645
+ }
4646
+ const fetched = releasePackageRoot(fetching);
4624
4647
  const runtime = path17.join(fetched, RELEASE_RUNTIME_PATH);
4625
- if (existsSync5(runtime)) {
4626
- await copyFile(path17.join(runtime, "package.json"), path17.join(staging, "package.json"));
4627
- await copyFile(path17.join(runtime, "bun.lock"), path17.join(staging, "bun.lock"));
4628
- await run(options2.bun, installArguments(options2.registry, "--frozen-lockfile", "--cache-dir", path17.join(staging, ".cache"), "--production", "--linker=hoisted", "--ignore-scripts"), {
4629
- cwd: staging,
4630
- timeoutMs,
4631
- signal: options2.signal,
4632
- env: { ...process.env, BUN_INSTALL_CACHE_DIR: path17.join(staging, ".cache") }
4633
- });
4634
- await rm(path17.join(fetched, "node_modules"), { recursive: true, force: true });
4635
- await mkdir(path17.join(staging, "node_modules"), { recursive: true });
4636
- await rename(fetched, path17.join(staging, "node_modules", STANDALONE_PACKAGE));
4637
- } else {
4638
- await writeReleaseManifest(staging, version);
4639
- await run(options2.bun, installArguments(options2.registry, "--production", "--linker=hoisted"), { cwd: staging, timeoutMs, signal: options2.signal });
4648
+ if (!existsSync5(runtime)) {
4649
+ throw new Error(`${STANDALONE_PACKAGE}@${version} was published without its dependency lockfile (${RELEASE_RUNTIME_PATH}), so it cannot be installed with the dependencies it shipped. Install ${FIRST_LOCKED_RELEASE} or later.`);
4640
4650
  }
4651
+ await copyFile(path17.join(runtime, "package.json"), path17.join(staging, "package.json"));
4652
+ await copyFile(path17.join(runtime, "bun.lock"), path17.join(staging, "bun.lock"));
4653
+ await run(options2.bun, installArguments(options2.registry, "--frozen-lockfile", "--cache-dir", path17.join(staging, ".cache"), "--production", "--linker=hoisted", "--ignore-scripts"), {
4654
+ cwd: staging,
4655
+ timeoutMs,
4656
+ signal: options2.signal,
4657
+ env: { ...process.env, BUN_INSTALL_CACHE_DIR: path17.join(staging, ".cache") }
4658
+ });
4659
+ await rm(path17.join(fetched, "node_modules"), { recursive: true, force: true });
4660
+ await mkdir(path17.join(staging, "node_modules"), { recursive: true });
4661
+ await rename(fetched, path17.join(staging, "node_modules", STANDALONE_PACKAGE));
4641
4662
  options2.signal?.throwIfAborted();
4642
4663
  await rm(path17.join(staging, ".cache"), { recursive: true, force: true });
4643
4664
  const manifest = readReleaseManifest(staging);
@@ -4720,7 +4741,7 @@ function isNewerVersion(a, b) {
4720
4741
  async function readText(file) {
4721
4742
  return readFile2(file, "utf8").catch(() => null);
4722
4743
  }
4723
- var STANDALONE_DIRECTORY = "backend", STANDALONE_PACKAGE = "orkestrator", RELEASE_RUNTIME_PATH = "resources/release-runtime", STANDALONE_MAX_BOOT_ATTEMPTS = 2, runFile = (file, args, options2) => runCommand(file, args, {
4744
+ var STANDALONE_DIRECTORY = "backend", STANDALONE_PACKAGE = "orkestrator", RELEASE_RUNTIME_PATH = "resources/release-runtime", FIRST_LOCKED_RELEASE = "2.36.4-beta", STANDALONE_MAX_BOOT_ATTEMPTS = 2, runFile = (file, args, options2) => runCommand(file, args, {
4724
4745
  cwd: options2.cwd,
4725
4746
  signal: options2.signal,
4726
4747
  timeoutMs: options2.timeoutMs,
@@ -13267,7 +13288,7 @@ import path5 from "path";
13267
13288
  // ../../apps/backend/package.json
13268
13289
  var package_default = {
13269
13290
  name: "@orkestrator/backend",
13270
- version: "2.39.0-beta",
13291
+ version: "2.39.1-beta",
13271
13292
  private: true,
13272
13293
  type: "module",
13273
13294
  exports: {
@@ -14998,6 +15019,150 @@ async function observe(check, options2) {
14998
15019
  }
14999
15020
  }
15000
15021
 
15022
+ // src/client/output.ts
15023
+ var OBSERVING_RECORD_TYPE = "observing";
15024
+ function writeObservingRecord(io, mode, action, operationId) {
15025
+ if (mode !== "json" && mode !== "jsonl")
15026
+ return;
15027
+ const record = { type: OBSERVING_RECORD_TYPE, action, operationId };
15028
+ io.stderr(`${JSON.stringify(record)}
15029
+ `);
15030
+ }
15031
+
15032
+ class OutputWriter {
15033
+ io;
15034
+ mode;
15035
+ constructor(io, mode) {
15036
+ this.io = io;
15037
+ this.mode = mode;
15038
+ }
15039
+ record(value) {
15040
+ this.io.stdout(`${JSON.stringify(value)}
15041
+ `);
15042
+ }
15043
+ note(message) {
15044
+ if (this.mode === "human")
15045
+ this.io.stderr(`${message}
15046
+ `);
15047
+ }
15048
+ success(outcome) {
15049
+ if (outcome.failure)
15050
+ return this.failure(outcome.failure, outcome);
15051
+ if (this.mode === "json" || this.mode === "jsonl") {
15052
+ const envelope = {
15053
+ schemaVersion: PUBLIC_API_SCHEMA_VERSION,
15054
+ action: outcome.action,
15055
+ ok: true,
15056
+ ...outcome.connection ? { connection: outcome.connection } : {},
15057
+ result: outcome.result ?? null,
15058
+ ...outcome.node ? { node: outcome.node } : {},
15059
+ ...outcome.receipt ? { receipt: outcome.receipt } : {},
15060
+ ...outcome.warnings && outcome.warnings.length > 0 ? { warnings: outcome.warnings } : {}
15061
+ };
15062
+ this.io.stdout(`${JSON.stringify(envelope)}
15063
+ `);
15064
+ return outcome.exitCodeOverride ?? 0;
15065
+ }
15066
+ if (this.mode === "id") {
15067
+ for (const id of outcome.ids ?? [])
15068
+ this.io.stdout(`${id}
15069
+ `);
15070
+ for (const warning of outcome.warnings ?? [])
15071
+ this.io.stderr(`warning: ${warning}
15072
+ `);
15073
+ return outcome.exitCodeOverride ?? 0;
15074
+ }
15075
+ for (const line of outcome.human ?? defaultHuman(outcome.result))
15076
+ this.io.stdout(`${line}
15077
+ `);
15078
+ for (const warning of outcome.warnings ?? [])
15079
+ this.io.stderr(`warning: ${warning}
15080
+ `);
15081
+ if (outcome.receipt)
15082
+ this.io.stderr(`${receiptHint(outcome.receipt, outcome.node)}
15083
+ `);
15084
+ return outcome.exitCodeOverride ?? 0;
15085
+ }
15086
+ failure(error, context = {}) {
15087
+ const cliError = error instanceof CliError ? error : new CliError("internal-error", error instanceof Error ? boundMessage(error.message) : "Unexpected client failure");
15088
+ const exitCode = exitCodeForError(cliError.code);
15089
+ const receipt = cliError.receipt ?? context.receipt;
15090
+ const node = cliError.node ?? context.node;
15091
+ if (this.mode === "json" || this.mode === "jsonl") {
15092
+ const envelope = {
15093
+ schemaVersion: PUBLIC_API_SCHEMA_VERSION,
15094
+ action: cliError.action ?? context.action ?? "cli",
15095
+ ok: false,
15096
+ ...context.connection ? { connection: context.connection } : {},
15097
+ ...node ? { node } : {},
15098
+ error: {
15099
+ code: cliError.code,
15100
+ message: cliError.message,
15101
+ exitCode,
15102
+ ...cliError.retryable !== undefined ? { retryable: cliError.retryable } : {},
15103
+ ...cliError.details ? { details: cliError.details } : {}
15104
+ },
15105
+ ...receipt ? { receipt } : {}
15106
+ };
15107
+ this.io.stdout(`${JSON.stringify(envelope)}
15108
+ `);
15109
+ return exitCode;
15110
+ }
15111
+ this.io.stderr(`error [${cliError.code}]: ${cliError.message}
15112
+ `);
15113
+ if (typeof cliError.details?.recovery === "string")
15114
+ this.io.stderr(`recover with \`${cliError.details.recovery}\`
15115
+ `);
15116
+ if (receipt)
15117
+ this.io.stderr(`${receiptHint(receipt, node)}
15118
+ `);
15119
+ return exitCode;
15120
+ }
15121
+ interrupted(signal, context) {
15122
+ const code = signal === "SIGINT" ? 130 : 143;
15123
+ const message = `Observation stopped by ${signal}; the operation continues in the backend.`;
15124
+ if (this.mode === "json" || this.mode === "jsonl") {
15125
+ this.io.stdout(`${JSON.stringify({
15126
+ schemaVersion: PUBLIC_API_SCHEMA_VERSION,
15127
+ action: context.action,
15128
+ ...context.node ? { node: context.node } : {},
15129
+ ok: false,
15130
+ ...context.connection ? { connection: context.connection } : {},
15131
+ error: {
15132
+ code: "observation-interrupted",
15133
+ message,
15134
+ exitCode: code,
15135
+ details: { ...context.details, signal }
15136
+ },
15137
+ ...context.receipt ? { receipt: context.receipt } : {}
15138
+ })}
15139
+ `);
15140
+ return code;
15141
+ }
15142
+ this.io.stderr(`${message}
15143
+ `);
15144
+ if (context.receipt)
15145
+ this.io.stderr(`${receiptHint(context.receipt, context.node)}
15146
+ `);
15147
+ return code;
15148
+ }
15149
+ }
15150
+ function receiptHint(receipt, node) {
15151
+ return `operation ${receipt.operationId} (${receipt.action}) is ${receipt.state}; inspect with \`orkestrator run get ${receipt.operationId}${node ? ` --node ${node.nodeId}` : ""}\``;
15152
+ }
15153
+ function boundMessage(message, max = 500) {
15154
+ const single = message.replace(/\s+/g, " ").trim();
15155
+ return single.length <= max ? single : `${single.slice(0, max - 1)}\u2026`;
15156
+ }
15157
+ function defaultHuman(result) {
15158
+ if (result === null || result === undefined)
15159
+ return ["ok"];
15160
+ if (typeof result !== "object")
15161
+ return [String(result)];
15162
+ return JSON.stringify(result, null, 2).split(`
15163
+ `);
15164
+ }
15165
+
15001
15166
  // src/client/commands/common.ts
15002
15167
  var REQUEST_ID_OPTION = {
15003
15168
  name: "request-id",
@@ -15051,10 +15216,9 @@ async function submitForWait(context, action, input, options2, timeoutMs) {
15051
15216
  const deadline = now() + timeoutMs;
15052
15217
  const session = await context.session();
15053
15218
  try {
15054
- return {
15055
- session,
15056
- ...await session.mutate(action, input, stringOption(options2, "request-id"))
15057
- };
15219
+ const outcome = await session.mutate(action, input, stringOption(options2, "request-id"));
15220
+ announceObserving(context, action, outcome.receipt);
15221
+ return { session, ...outcome };
15058
15222
  } catch (error) {
15059
15223
  const requestId = error instanceof CliError ? error.details?.requestId : undefined;
15060
15224
  const namespace = error instanceof CliError ? error.details?.namespace : undefined;
@@ -15098,6 +15262,7 @@ async function submitForWait(context, action, input, options2, timeoutMs) {
15098
15262
  }
15099
15263
  throw failure;
15100
15264
  }
15265
+ announceObserving(context, action, receipt);
15101
15266
  return {
15102
15267
  session,
15103
15268
  receipt,
@@ -15106,6 +15271,10 @@ async function submitForWait(context, action, input, options2, timeoutMs) {
15106
15271
  };
15107
15272
  }
15108
15273
  }
15274
+ function announceObserving(context, action, receipt) {
15275
+ if (receipt)
15276
+ writeObservingRecord(context.io, context.global.output, action, receipt.operationId);
15277
+ }
15109
15278
  async function readOperation(session, operationId, timeoutMs) {
15110
15279
  const { receipt } = await session.readWithReceipt("run.get", { operationId }, timeoutMs);
15111
15280
  if (!receipt)
@@ -15495,8 +15664,9 @@ for (const definition of TICKET_SECTION_DEFINITIONS) {
15495
15664
  for (const alias of definition.aliases)
15496
15665
  KEY_BY_HEADING.set(normalizedHeading(alias), definition.key);
15497
15666
  }
15498
- var ACCEPTANCE_CRITERIA_RULE = "Verify judges each against the committed change alone (its code, tests or docs); rules for how the worker works (what it may read, run or touch) go in constraints.";
15499
- var TICKET_SECTIONS_GUIDANCE = `Ticket sections; each is optional and replaces only itself (empty clears it). acceptanceCriteria: one item per entry. ${ACCEPTANCE_CRITERIA_RULE} checks: standard commands (lint, typecheck, tests) that must pass. delivery.policy: commit-only, push-no-pr or open-pr (the default); a build applies it once Verify passes. constraints: a limit on which files the work may edit never covers updating references to files it deletes, moves or renames, or descriptions it makes untrue; say so. custom: extra titled sections. Standing project rules (report format, standard checks, PR flow, safety) live in AGENTS.md's Orkestrator section; do not repeat them.`;
15667
+ var ACCEPTANCE_CRITERIA_FORM = 'Each is a functional or non-functional requirement seen by a user or other actor: "Given <situation>, when <action>, then <outcome>", not file, function or test names.';
15668
+ var ACCEPTANCE_CRITERIA_RULE = `${ACCEPTANCE_CRITERIA_FORM} Verify judges each against the committed change alone (its code, tests or docs); how the worker works (what it may read, run or touch) goes in constraints.`;
15669
+ var TICKET_SECTIONS_GUIDANCE = `Sections are optional; each replaces only itself (empty clears it). acceptanceCriteria: one per entry. ${ACCEPTANCE_CRITERIA_RULE} checks: commands that must pass (lint, typecheck, tests). delivery.policy: commit-only, push-no-pr or open-pr (default), applied after Verify. constraints: a file-edit limit never covers updating references to files it deletes, moves or renames, or descriptions it makes untrue; say so. custom: extra titled sections. Standing project rules live in AGENTS.md's Orkestrator section; do not repeat them.`;
15500
15670
 
15501
15671
  // ../protocol/src/build-pipeline-address-findings-report.ts
15502
15672
  var PIPELINE_ADDRESS_FINDINGS_RESULT_LIMITS = Object.freeze({
@@ -22665,7 +22835,6 @@ var sessionCommands = [
22665
22835
  }
22666
22836
  const seen = new Set;
22667
22837
  let lastToken = null;
22668
- let conditional = null;
22669
22838
  let emitted = 0;
22670
22839
  const emit = (record) => {
22671
22840
  if (context.global.output === "jsonl")
@@ -22679,11 +22848,10 @@ var sessionCommands = [
22679
22848
  };
22680
22849
  try {
22681
22850
  await observe(async () => {
22682
- conditional ??= (await session.capabilities()).features.transcriptKnownToken === true;
22683
22851
  const answer = await session.read("session.transcript", {
22684
22852
  ...input,
22685
22853
  limit: PUBLIC_API_LIMITS.transcriptMaxMessages,
22686
- ...conditional && lastToken !== null ? { knownToken: lastToken } : {}
22854
+ ...lastToken !== null ? { knownToken: lastToken } : {}
22687
22855
  });
22688
22856
  if (isPublicTranscriptUnchanged(answer))
22689
22857
  return { done: false };
@@ -26803,24 +26971,6 @@ class ClientSession {
26803
26971
  get node() {
26804
26972
  return this.options.node;
26805
26973
  }
26806
- routingChecked = null;
26807
- ensureNodeRouting() {
26808
- this.routingChecked ??= (async () => {
26809
- const response = await this.call("capabilities", {}, undefined, false, undefined, false);
26810
- if (!response.ok)
26811
- throw envelopeError(response);
26812
- if (!isPublicCapabilities(response.result)) {
26813
- throw new CliError("response-invalid", "The backend returned invalid capabilities");
26814
- }
26815
- if (response.result.features.nodeRouting !== true) {
26816
- throw new CliError("backend-incompatible", "The connected backend cannot run actions on other nodes; upgrade it to use --node");
26817
- }
26818
- })().catch((error) => {
26819
- this.routingChecked = null;
26820
- throw error;
26821
- });
26822
- return this.routingChecked;
26823
- }
26824
26974
  capabilities() {
26825
26975
  this.capabilitiesPromise ??= this.loadCapabilities().catch((error) => {
26826
26976
  this.capabilitiesPromise = null;
@@ -26936,10 +27086,8 @@ class ClientSession {
26936
27086
  ...response.warnings ? { warnings: response.warnings } : {}
26937
27087
  };
26938
27088
  }
26939
- async call(action, input, request, mutation, timeoutMs, routed = true) {
26940
- const node = routed && this.options.node && !PUBLIC_LOCAL_ONLY_ACTIONS.includes(action) ? this.options.node : undefined;
26941
- if (node)
26942
- await this.ensureNodeRouting();
27089
+ async call(action, input, request, mutation, timeoutMs) {
27090
+ const node = this.options.node && !PUBLIC_LOCAL_ONLY_ACTIONS.includes(action) ? this.options.node : undefined;
26943
27091
  const body = {
26944
27092
  schemaVersion: PUBLIC_API_SCHEMA_VERSION,
26945
27093
  action,
@@ -27283,7 +27431,7 @@ async function descriptorProcessRefusal(descriptor, readStart = readProcessStart
27283
27431
  return "is not running as your user (its descriptor is stale)";
27284
27432
  if (process.platform === "linux" && readStart === readProcessStartTime) {
27285
27433
  if (!descriptor.processIdentity) {
27286
- return `cannot be confirmed: it publishes no Linux process identity (Orkestrator ${FIRST_LINUX_PROCESS_IDENTITY_RELEASE} and later do). Update and restart that backend, or connect with --url <its URL> --credential-file <its data directory>/gateway-auth.json`;
27434
+ return `cannot be confirmed: it publishes no Linux process identity (Orkestrator ${FIRST_LINUX_PROCESS_IDENTITY_RELEASE} and later do). Update and restart that backend`;
27287
27435
  }
27288
27436
  const identity = await readLinuxProcessIdentity(descriptor.pid);
27289
27437
  if (identity === null)
@@ -32525,141 +32673,6 @@ var SERVE_HELP = [
32525
32673
  ].join(`
32526
32674
  `);
32527
32675
 
32528
- // src/client/output.ts
32529
- class OutputWriter {
32530
- io;
32531
- mode;
32532
- constructor(io, mode) {
32533
- this.io = io;
32534
- this.mode = mode;
32535
- }
32536
- record(value) {
32537
- this.io.stdout(`${JSON.stringify(value)}
32538
- `);
32539
- }
32540
- note(message) {
32541
- if (this.mode === "human")
32542
- this.io.stderr(`${message}
32543
- `);
32544
- }
32545
- success(outcome) {
32546
- if (outcome.failure)
32547
- return this.failure(outcome.failure, outcome);
32548
- if (this.mode === "json" || this.mode === "jsonl") {
32549
- const envelope = {
32550
- schemaVersion: PUBLIC_API_SCHEMA_VERSION,
32551
- action: outcome.action,
32552
- ok: true,
32553
- ...outcome.connection ? { connection: outcome.connection } : {},
32554
- result: outcome.result ?? null,
32555
- ...outcome.node ? { node: outcome.node } : {},
32556
- ...outcome.receipt ? { receipt: outcome.receipt } : {},
32557
- ...outcome.warnings && outcome.warnings.length > 0 ? { warnings: outcome.warnings } : {}
32558
- };
32559
- this.io.stdout(`${JSON.stringify(envelope)}
32560
- `);
32561
- return outcome.exitCodeOverride ?? 0;
32562
- }
32563
- if (this.mode === "id") {
32564
- for (const id of outcome.ids ?? [])
32565
- this.io.stdout(`${id}
32566
- `);
32567
- for (const warning of outcome.warnings ?? [])
32568
- this.io.stderr(`warning: ${warning}
32569
- `);
32570
- return outcome.exitCodeOverride ?? 0;
32571
- }
32572
- for (const line of outcome.human ?? defaultHuman(outcome.result))
32573
- this.io.stdout(`${line}
32574
- `);
32575
- for (const warning of outcome.warnings ?? [])
32576
- this.io.stderr(`warning: ${warning}
32577
- `);
32578
- if (outcome.receipt)
32579
- this.io.stderr(`${receiptHint(outcome.receipt, outcome.node)}
32580
- `);
32581
- return outcome.exitCodeOverride ?? 0;
32582
- }
32583
- failure(error, context = {}) {
32584
- const cliError = error instanceof CliError ? error : new CliError("internal-error", error instanceof Error ? boundMessage(error.message) : "Unexpected client failure");
32585
- const exitCode = exitCodeForError(cliError.code);
32586
- const receipt = cliError.receipt ?? context.receipt;
32587
- const node = cliError.node ?? context.node;
32588
- if (this.mode === "json" || this.mode === "jsonl") {
32589
- const envelope = {
32590
- schemaVersion: PUBLIC_API_SCHEMA_VERSION,
32591
- action: cliError.action ?? context.action ?? "cli",
32592
- ok: false,
32593
- ...context.connection ? { connection: context.connection } : {},
32594
- ...node ? { node } : {},
32595
- error: {
32596
- code: cliError.code,
32597
- message: cliError.message,
32598
- exitCode,
32599
- ...cliError.retryable !== undefined ? { retryable: cliError.retryable } : {},
32600
- ...cliError.details ? { details: cliError.details } : {}
32601
- },
32602
- ...receipt ? { receipt } : {}
32603
- };
32604
- this.io.stdout(`${JSON.stringify(envelope)}
32605
- `);
32606
- return exitCode;
32607
- }
32608
- this.io.stderr(`error [${cliError.code}]: ${cliError.message}
32609
- `);
32610
- if (typeof cliError.details?.recovery === "string")
32611
- this.io.stderr(`recover with \`${cliError.details.recovery}\`
32612
- `);
32613
- if (receipt)
32614
- this.io.stderr(`${receiptHint(receipt, node)}
32615
- `);
32616
- return exitCode;
32617
- }
32618
- interrupted(signal, context) {
32619
- const code = signal === "SIGINT" ? 130 : 143;
32620
- const message = `Observation stopped by ${signal}; the operation continues in the backend.`;
32621
- if (this.mode === "json" || this.mode === "jsonl") {
32622
- this.io.stdout(`${JSON.stringify({
32623
- schemaVersion: PUBLIC_API_SCHEMA_VERSION,
32624
- action: context.action,
32625
- ...context.node ? { node: context.node } : {},
32626
- ok: false,
32627
- ...context.connection ? { connection: context.connection } : {},
32628
- error: {
32629
- code: "observation-interrupted",
32630
- message,
32631
- exitCode: code,
32632
- details: { ...context.details, signal }
32633
- },
32634
- ...context.receipt ? { receipt: context.receipt } : {}
32635
- })}
32636
- `);
32637
- return code;
32638
- }
32639
- this.io.stderr(`${message}
32640
- `);
32641
- if (context.receipt)
32642
- this.io.stderr(`${receiptHint(context.receipt, context.node)}
32643
- `);
32644
- return code;
32645
- }
32646
- }
32647
- function receiptHint(receipt, node) {
32648
- return `operation ${receipt.operationId} (${receipt.action}) is ${receipt.state}; inspect with \`orkestrator run get ${receipt.operationId}${node ? ` --node ${node.nodeId}` : ""}\``;
32649
- }
32650
- function boundMessage(message, max = 500) {
32651
- const single = message.replace(/\s+/g, " ").trim();
32652
- return single.length <= max ? single : `${single.slice(0, max - 1)}\u2026`;
32653
- }
32654
- function defaultHuman(result) {
32655
- if (result === null || result === undefined)
32656
- return ["ok"];
32657
- if (typeof result !== "object")
32658
- return [String(result)];
32659
- return JSON.stringify(result, null, 2).split(`
32660
- `);
32661
- }
32662
-
32663
32676
  // src/client/questions.ts
32664
32677
  import { createInterface } from "readline/promises";
32665
32678
  function terminalQuestions(input, output, onInterrupt) {