@zergai/ztc 0.26.6-dev.202611240947 → 0.27.0-beta.1

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 (268) hide show
  1. package/README.md +629 -167
  2. package/RUST_THIRD_PARTY_LICENSES.txt +5 -5
  3. package/bin/zmux-darwin-arm64 +0 -0
  4. package/bin/zmux-linux-x64 +0 -0
  5. package/bin/ztc-audio-darwin-arm64 +0 -0
  6. package/bin/ztc-capture-darwin-arm64 +0 -0
  7. package/bin/ztc-computer-darwin-arm64 +0 -0
  8. package/bin/ztc-llm-darwin-arm64 +0 -0
  9. package/bin/ztc-tts-darwin-arm64 +0 -0
  10. package/bin/ztc-tui-darwin-arm64 +0 -0
  11. package/bin/ztc-tui-linux-x64 +0 -0
  12. package/bin/zterm-darwin-arm64 +2 -2
  13. package/dist/App.js +6 -1
  14. package/dist/agent/agent.d.ts +21 -15
  15. package/dist/agent/agent.js +389 -163
  16. package/dist/agent/backends/codex_app_server.d.ts +7 -1
  17. package/dist/agent/backends/codex_app_server.js +11 -1
  18. package/dist/agent/backends/gemini.js +22 -8
  19. package/dist/agent/commands/batch.js +8 -0
  20. package/dist/agent/commands/config.js +10 -0
  21. package/dist/agent/commands/environment.js +5 -5
  22. package/dist/agent/commands/goal.d.ts +1 -0
  23. package/dist/agent/commands/goal.js +2 -1
  24. package/dist/agent/commands/index.js +2 -1
  25. package/dist/agent/commands/manifest.js +4 -0
  26. package/dist/agent/commands/optimize.js +5 -2
  27. package/dist/agent/commands/pane_cli.d.ts +29 -0
  28. package/dist/agent/commands/pane_cli.js +303 -0
  29. package/dist/agent/commands/settings.js +13 -3
  30. package/dist/agent/commands/shannon.js +8 -0
  31. package/dist/agent/commands/update.js +15 -3
  32. package/dist/agent/commands/zerg.js +31 -1
  33. package/dist/agent/commands/ztc_pane.js +3 -1
  34. package/dist/agent/factory.d.ts +4 -0
  35. package/dist/agent/factory.js +11 -1
  36. package/dist/agent/loop_policy.d.ts +42 -5
  37. package/dist/agent/loop_policy.js +206 -3
  38. package/dist/agent/runtime/command_jobs.d.ts +5 -0
  39. package/dist/agent/runtime/command_jobs.js +241 -31
  40. package/dist/agent/runtime/command_wait.d.ts +2 -0
  41. package/dist/agent/runtime/command_wait.js +1 -0
  42. package/dist/agent/runtime/done_report.d.ts +18 -0
  43. package/dist/agent/runtime/done_report.js +130 -0
  44. package/dist/agent/runtime/execution_context.js +4 -1
  45. package/dist/agent/runtime/failure_cause.d.ts +2 -0
  46. package/dist/agent/runtime/failure_cause.js +35 -0
  47. package/dist/agent/runtime/policy.d.ts +14 -2
  48. package/dist/agent/runtime/policy.js +104 -12
  49. package/dist/agent/runtime/quiet_job.d.ts +18 -0
  50. package/dist/agent/runtime/quiet_job.js +48 -0
  51. package/dist/agent/runtime/recovery.d.ts +1 -5
  52. package/dist/agent/runtime/recovery.js +2 -44
  53. package/dist/agent/runtime/tool_runtime.d.ts +1 -0
  54. package/dist/agent/runtime/tool_runtime.js +2 -0
  55. package/dist/agent/subagent.js +6 -1
  56. package/dist/agent/tools/deferred.js +1 -0
  57. package/dist/agent/tools/index.d.ts +2 -0
  58. package/dist/agent/tools/index.js +1 -0
  59. package/dist/agent/tools/outcome.d.ts +15 -0
  60. package/dist/agent/tools/outcome.js +107 -0
  61. package/dist/agent/tools/pane.d.ts +2 -1
  62. package/dist/agent/tools/pane.js +21 -3
  63. package/dist/agent/tools/registry.js +2 -0
  64. package/dist/agent/tools/shell.d.ts +1 -0
  65. package/dist/agent/tools/shell.js +128 -17
  66. package/dist/agent/tools/sim_domain_tools.js +4 -2
  67. package/dist/agent/tools/supervision.js +4 -2
  68. package/dist/agent/tools/types.d.ts +3 -0
  69. package/dist/app/command_context.js +5 -9
  70. package/dist/app/conversation_compaction.d.ts +4 -2
  71. package/dist/app/conversation_compaction.js +16 -5
  72. package/dist/app/headless_shell_mode.d.ts +14 -0
  73. package/dist/app/headless_shell_mode.js +7 -0
  74. package/dist/app/hosted_resident.d.ts +356 -0
  75. package/dist/app/hosted_resident.js +677 -0
  76. package/dist/app/restart.js +11 -2
  77. package/dist/app/session_manager.d.ts +5 -0
  78. package/dist/app/session_manager.js +21 -6
  79. package/dist/app/session_messages.js +6 -6
  80. package/dist/app/workspace_layout_controller.js +7 -0
  81. package/dist/batch/worktree.d.ts +10 -0
  82. package/dist/batch/worktree.js +15 -0
  83. package/dist/bench/registry.js +4 -2
  84. package/dist/cli_args.js +1 -1
  85. package/dist/cli_main.js +80 -10
  86. package/dist/cli_ratatui.d.ts +75 -0
  87. package/dist/cli_ratatui.js +485 -84
  88. package/dist/components/InputArea.js +4 -4
  89. package/dist/config/execution.d.ts +10 -0
  90. package/dist/config/execution.js +10 -0
  91. package/dist/config/hosted_runtime.d.ts +4 -1
  92. package/dist/config/hosted_runtime.js +4 -1
  93. package/dist/config/permission_pin.d.ts +34 -2
  94. package/dist/config/permission_pin.js +52 -2
  95. package/dist/config/person_command_policy.d.ts +38 -0
  96. package/dist/config/person_command_policy.js +11 -0
  97. package/dist/config/profiles.d.ts +21 -0
  98. package/dist/config/profiles.js +56 -2
  99. package/dist/config/types.d.ts +4 -1
  100. package/dist/config.js +34 -19
  101. package/dist/desktop/daily/codex_exec_adapter.js +7 -2
  102. package/dist/desktop/daily/desktop_wiring.d.ts +7 -1
  103. package/dist/desktop/daily/desktop_wiring.js +11 -3
  104. package/dist/desktop/daily/recipes.js +20 -4
  105. package/dist/desktop/health.d.ts +24 -0
  106. package/dist/desktop/health.js +151 -0
  107. package/dist/desktop/native_dialogs.d.ts +37 -0
  108. package/dist/desktop/native_dialogs.js +105 -0
  109. package/dist/diagnostics/session_export.d.ts +1 -0
  110. package/dist/diagnostics/session_export.js +28 -0
  111. package/dist/embedded/registry.js +4 -2
  112. package/dist/emulation/tool_adapters.js +9 -4
  113. package/dist/emulation/ztc_addendum.js +3 -0
  114. package/dist/headless.d.ts +11 -4
  115. package/dist/headless.js +99 -34
  116. package/dist/headless_approval.d.ts +6 -0
  117. package/dist/headless_cli.js +1 -1
  118. package/dist/hooks/runner.js +7 -6
  119. package/dist/library.d.ts +4 -0
  120. package/dist/library.js +3 -0
  121. package/dist/mcp/client.js +3 -3
  122. package/dist/modes/registry.js +13 -4
  123. package/dist/onboarding/setup_environment.js +13 -1
  124. package/dist/optimize/adapters/kernelbench.js +88 -10
  125. package/dist/optimize/adapters/types.d.ts +5 -0
  126. package/dist/optimize/executor.js +21 -0
  127. package/dist/panes/cli_install.d.ts +54 -0
  128. package/dist/panes/cli_install.js +157 -0
  129. package/dist/panes/model_catalog.js +3 -0
  130. package/dist/panes/new_pane_choices.d.ts +6 -2
  131. package/dist/panes/new_pane_choices.js +24 -12
  132. package/dist/panes/pane_cli_launch.d.ts +50 -0
  133. package/dist/panes/pane_cli_launch.js +124 -0
  134. package/dist/panes/pane_clis.d.ts +171 -0
  135. package/dist/panes/pane_clis.js +325 -0
  136. package/dist/panes/person_only_panes.d.ts +45 -0
  137. package/dist/panes/person_only_panes.js +117 -0
  138. package/dist/plugin/simulation_living.js +0 -2
  139. package/dist/plugin/simulation_living_engine.d.ts +1 -0
  140. package/dist/plugin/simulation_living_engine.js +1 -0
  141. package/dist/plugin/simulation_living_labels.d.ts +3 -0
  142. package/dist/plugin/simulation_living_labels.js +2 -0
  143. package/dist/router_auth.js +12 -1
  144. package/dist/session.js +26 -1
  145. package/dist/simulation/art/gemini_image.js +11 -5
  146. package/dist/simulation/domains/loader.js +25 -3
  147. package/dist/simulation/living/cold.d.ts +23 -0
  148. package/dist/simulation/living/cold.js +41 -0
  149. package/dist/simulation/living/context.d.ts +591 -1283
  150. package/dist/simulation/living/context.js +378 -244
  151. package/dist/simulation/living/contradictions.d.ts +14 -0
  152. package/dist/simulation/living/contradictions.js +282 -0
  153. package/dist/simulation/living/core/ids.d.ts +53 -0
  154. package/dist/simulation/living/core/ids.js +39 -0
  155. package/dist/simulation/living/core/kind.d.ts +20 -0
  156. package/dist/simulation/living/core/kind.js +15 -0
  157. package/dist/simulation/living/core/laws.d.ts +179 -0
  158. package/dist/simulation/living/core/laws.js +184 -0
  159. package/dist/simulation/living/core/ops.d.ts +257 -0
  160. package/dist/simulation/living/core/ops.js +34 -0
  161. package/dist/simulation/living/definer.d.ts +17 -1
  162. package/dist/simulation/living/definer.js +130 -51
  163. package/dist/simulation/living/definition.d.ts +174 -65
  164. package/dist/simulation/living/definition.js +287 -180
  165. package/dist/simulation/living/director.d.ts +80 -0
  166. package/dist/simulation/living/director.js +363 -0
  167. package/dist/simulation/living/frame.d.ts +108 -21
  168. package/dist/simulation/living/frame.js +111 -66
  169. package/dist/simulation/living/identifiers.d.ts +0 -1
  170. package/dist/simulation/living/identifiers.js +0 -3
  171. package/dist/simulation/living/index.d.ts +18 -9
  172. package/dist/simulation/living/index.js +18 -9
  173. package/dist/simulation/living/inference.d.ts +92 -50
  174. package/dist/simulation/living/inference.js +319 -175
  175. package/dist/simulation/living/knowledge.d.ts +28 -0
  176. package/dist/simulation/living/knowledge.js +73 -0
  177. package/dist/simulation/living/library.json +1177 -0
  178. package/dist/simulation/living/mechanics.d.ts +31 -34
  179. package/dist/simulation/living/mechanics.js +222 -138
  180. package/dist/simulation/living/model-input.d.ts +6 -3
  181. package/dist/simulation/living/model-input.js +18 -26
  182. package/dist/simulation/living/open-world.d.ts +74 -94
  183. package/dist/simulation/living/open-world.js +151 -30
  184. package/dist/simulation/living/phrases.d.ts +3 -0
  185. package/dist/simulation/living/phrases.js +37 -0
  186. package/dist/simulation/living/phrases.json +560 -0
  187. package/dist/simulation/living/projection.d.ts +316 -2
  188. package/dist/simulation/living/projection.js +50 -2
  189. package/dist/simulation/living/prompts/example-spec.json +11 -0
  190. package/dist/simulation/living/prompts/role-text.json +14 -0
  191. package/dist/simulation/living/prompts.d.ts +5 -0
  192. package/dist/simulation/living/prompts.js +275 -0
  193. package/dist/simulation/living/recall.d.ts +2 -2
  194. package/dist/simulation/living/reduce.d.ts +51 -14
  195. package/dist/simulation/living/reduce.js +941 -579
  196. package/dist/simulation/living/replay.d.ts +5 -4
  197. package/dist/simulation/living/replay.js +10 -9
  198. package/dist/simulation/living/runtime.d.ts +135 -25
  199. package/dist/simulation/living/runtime.js +1641 -583
  200. package/dist/simulation/living/scale.d.ts +96 -0
  201. package/dist/simulation/living/scale.js +124 -0
  202. package/dist/simulation/living/script.d.ts +5 -0
  203. package/dist/simulation/living/script.js +115 -0
  204. package/dist/simulation/living/shared-kinds.d.ts +4 -11
  205. package/dist/simulation/living/shared-kinds.js +11 -81
  206. package/dist/simulation/living/space.d.ts +14 -0
  207. package/dist/simulation/living/space.js +132 -0
  208. package/dist/simulation/living/state.d.ts +100 -0
  209. package/dist/simulation/living/state.js +393 -0
  210. package/dist/simulation/living/types.d.ts +829 -512
  211. package/dist/simulation/living/types.js +162 -187
  212. package/dist/simulation/living/world-rules.d.ts +100 -0
  213. package/dist/simulation/living/world-rules.js +267 -0
  214. package/dist/simulation/plugins/loader.js +11 -0
  215. package/dist/skills/loader.js +4 -0
  216. package/dist/tools.d.ts +1 -0
  217. package/dist/tools.js +1 -0
  218. package/dist/ui/ratatui/headless_pane_manager.d.ts +4 -1
  219. package/dist/ui/ratatui/headless_pane_manager.js +13 -9
  220. package/dist/ui/ratatui/pane_relay.js +29 -0
  221. package/dist/ui/ratatui/pane_type.d.ts +10 -0
  222. package/dist/ui/ratatui/pane_type.js +11 -0
  223. package/dist/ui/ratatui/process.d.ts +30 -0
  224. package/dist/ui/ratatui/process.js +133 -19
  225. package/dist/ui/ratatui/protocol.d.ts +124 -2
  226. package/dist/ui/ratatui/protocol.js +35 -0
  227. package/dist/ui/ratatui/relay_policy.js +3 -0
  228. package/dist/ui/ratatui/ztc_launch_trust.d.ts +2 -1
  229. package/dist/ui/ratatui/ztc_launch_trust.js +8 -1
  230. package/dist/ui/terminal_image.d.ts +12 -0
  231. package/dist/ui/terminal_image.js +21 -1
  232. package/dist/utils/codex_project_trust.d.ts +19 -0
  233. package/dist/utils/codex_project_trust.js +37 -0
  234. package/dist/utils/compaction.js +103 -20
  235. package/dist/utils/git_program_files.d.ts +19 -12
  236. package/dist/utils/git_program_files.js +411 -83
  237. package/dist/utils/host_shell.d.ts +10 -1
  238. package/dist/utils/host_shell.js +14 -1
  239. package/dist/utils/mid_turn_compaction.d.ts +2 -0
  240. package/dist/utils/mid_turn_compaction.js +2 -0
  241. package/dist/utils/models.js +6 -1
  242. package/dist/utils/sandbox.d.ts +109 -8
  243. package/dist/utils/sandbox.js +981 -187
  244. package/dist/utils/shell.d.ts +2 -0
  245. package/dist/utils/shell.js +10 -4
  246. package/dist/utils/subprocess_env.d.ts +47 -11
  247. package/dist/utils/subprocess_env.js +107 -15
  248. package/dist/utils/system_ps.d.ts +8 -0
  249. package/dist/utils/system_ps.js +39 -7
  250. package/dist/utils/unattended_compaction.d.ts +9 -0
  251. package/dist/utils/unattended_compaction.js +13 -0
  252. package/dist/utils/ztc_own_state.d.ts +8 -5
  253. package/dist/utils/ztc_own_state.js +17 -11
  254. package/dist/web/mirror_client.js +1 -0
  255. package/dist/web/mirror_stream.d.ts +50 -6
  256. package/dist/web/mirror_stream.js +160 -15
  257. package/dist/workflows/registry.js +3 -1
  258. package/dist/workspace/controller.js +12 -0
  259. package/dist/workspace_collision.d.ts +3 -0
  260. package/dist/workspace_collision.js +14 -1
  261. package/dist/workspace_session_context.js +2 -1
  262. package/dist/zlm-embed.mjs +3823 -1970
  263. package/node_modules/@zerg/model-contracts/README.md +16 -4
  264. package/node_modules/@zerg/model-contracts/index.js +6 -1
  265. package/npm-shrinkwrap.json +1 -1
  266. package/package.json +42 -24
  267. package/packages/model-contracts/README.md +16 -4
  268. package/packages/model-contracts/index.js +6 -1
@@ -349,7 +349,15 @@ export async function buildSettingsCategories(ctx) {
349
349
  settings: Object.entries(resolveExecutionSettings(config.execution)).map(([key, value]) => ({
350
350
  name: `execution_${key}`, label: { shellPanePolicy: 'Shell pane creation', readConcurrency: 'Concurrent reads',
351
351
  maxCallsPerResponse: 'Calls per response', maxEffectsPerResponse: 'Writes and commands per response', recovery: 'Failure recovery', repeatedFailureLimit: 'Repeated failure threshold',
352
- recoveryAttempts: 'Recovery attempts', interruptBackgroundJobs: 'Cancel background jobs on interrupt', maxBackgroundJobs: 'Background command limit' }[key],
352
+ recoveryAttempts: 'Recovery attempts', noProgressNudgeAfter: 'No-progress note after', noProgressStopAfter: 'No-progress stop after',
353
+ commandRepeatLimit: 'Identical command results before refusal',
354
+ commandRepeatLongRunningMs: 'Long-command repeat threshold (ms)',
355
+ runawayEscalations: 'Runaway-response escalations',
356
+ endProtocolNudges: 'Unattended end-protocol nudges',
357
+ endProtocolTotalNudges: 'End-protocol nudges per run',
358
+ longSessionCompactAfter: 'Long-session restatement after',
359
+ unattendedCompactPercent: 'Unattended compaction at (% of window)',
360
+ interruptBackgroundJobs: 'Cancel background jobs on interrupt', maxBackgroundJobs: 'Background command limit' }[key],
353
361
  value: String(value), type: typeof value === 'number' ? 'text' : 'select',
354
362
  options: (key === 'shellPanePolicy' ? ['on_request', 'auto'] : key === 'recovery' ? ['automatic', 'pause'] : typeof value === 'boolean' ? ['false', 'true'] : []).map(option => ({ value: option, label: option })),
355
363
  })),
@@ -1421,9 +1429,11 @@ function applySettingChange(ctx, setting, value, selection) {
1421
1429
  const current = resolveExecutionSettings(ctx.config.get().execution);
1422
1430
  if (!(key in current))
1423
1431
  throw new Error(`Unknown execution setting: ${key}`);
1424
- const parsed = typeof current[key] === 'number' ? Number(value) : typeof current[key] === 'boolean' ? value === 'true' : value;
1432
+ // A share of the window may be typed with its %, as the compaction threshold may.
1433
+ const typed = key === 'unattendedCompactPercent' ? value.trim().replace(/\s*%$/u, '') : value;
1434
+ const parsed = typeof current[key] === 'number' ? Number(typed) : typeof current[key] === 'boolean' ? typed === 'true' : typed;
1425
1435
  const next = { ...current, [key]: parsed };
1426
- if (String(resolveExecutionSettings(next)[key]) !== value)
1436
+ if (String(resolveExecutionSettings(next)[key]) !== typed)
1427
1437
  throw new Error(`Invalid value for ${key}: ${value}`);
1428
1438
  ctx.config.set('execution', next);
1429
1439
  return;
@@ -1,3 +1,4 @@
1
+ import { personProgramRefusal } from '../../config/permission_pin.js';
1
2
  import { getShannonRuntime } from '../../shannon/runtime.js';
2
3
  function parseRunnerArgs(args) {
3
4
  let cwd;
@@ -34,6 +35,13 @@ export const shannonRunnerCommand = {
34
35
  const runtime = getShannonRuntime();
35
36
  const shannonCfg = ctx.config.get().shannon || {};
36
37
  if (subcommand === 'start') {
38
+ // The runner is the program the person names, started outside any sandbox: under its host's pin, where the person's
39
+ // commands run only inside the OS sandbox, it isn't started (config/permission_pin.ts personProgramRefusal).
40
+ const pinned = personProgramRefusal('No Shannon runner was started', 'the runner', 'Run it with !cmd, which runs inside the sandbox.');
41
+ if (pinned) {
42
+ ctx.addMessage({ role: 'system', content: pinned });
43
+ return;
44
+ }
37
45
  const parsed = parseRunnerArgs(rest);
38
46
  const command = parsed.commandTokens[0] || shannonCfg.runnerCommand;
39
47
  const runnerArgs = parsed.commandTokens.length > 0
@@ -21,7 +21,7 @@ function getCurrentInstallPath() {
21
21
  return 'unknown';
22
22
  }
23
23
  }
24
- const DESKTOP_UPDATE_MESSAGE = 'This ZTC desktop app updates itself: it downloads and verifies new releases in the background and installs them when you quit ZTC. Open Updates in the title bar to check now or change this.';
24
+ const DESKTOP_UPDATE_MESSAGE = 'This ZTC desktop app updates itself: it downloads and verifies new releases in the background and installs them when you quit ZTC. Open Updates in the title bar to check now or change this. To hot-swap the ZTC agent runtime in-situ without closing your panes, run /restart.';
25
25
  /**
26
26
  * Run the launcher with a user subprocess's environment: it runs npm and the install scripts npm runs, so they get the
27
27
  * person's environment (their npm settings among it) and none of ZTC's credentials.
@@ -47,8 +47,8 @@ export function createUpdateCommand(deps) {
47
47
  const run = deps.run ?? runProcess;
48
48
  return {
49
49
  name: 'update',
50
- description: 'Check for updates and install the latest version',
51
- usage: '/update [--check]',
50
+ description: 'Check for updates, install the latest version, and hot-restart in-situ',
51
+ usage: '/update [--check] [--no-restart]',
52
52
  handler: async (args, ctx) => {
53
53
  // A ZTC its host pins (ZTC_PERMISSION_PROFILE_PINNED) is updated by its host, not by itself.
54
54
  const pinned = ctx.config.selfUpdateRefusal?.();
@@ -69,11 +69,23 @@ export function createUpdateCommand(deps) {
69
69
  return;
70
70
  }
71
71
  const check = args.includes('--check') || args.includes('check');
72
+ const noRestart = args.includes('--no-restart');
72
73
  ctx.addMessage({ role: 'system', content: check ? 'Checking for updates…' : 'Checking for updates and installing any newer release…' });
73
74
  const result = await run(deps.nodePath, [launcher, 'update', ...(check ? ['--check'] : [])]);
74
75
  const output = [result.stderr, result.stdout].map(text => text.trim()).filter(Boolean).join('\n');
75
76
  if (result.exitCode === 0) {
76
77
  const installed = /^Updated /m.test(output);
78
+ if (installed && !check && !noRestart && ctx.restartZtc) {
79
+ ctx.addMessage({
80
+ role: 'system',
81
+ content: [
82
+ output,
83
+ 'Applying update in-situ — hot-restarting ZTC while preserving your session and live desktop panes…',
84
+ ].filter(Boolean).join('\n'),
85
+ });
86
+ await ctx.restartZtc();
87
+ return;
88
+ }
77
89
  ctx.addMessage({
78
90
  role: 'system',
79
91
  content: [output || 'No update information was returned.', installed ? 'Restart ZTC to use the new version.' : ''].filter(Boolean).join('\n'),
@@ -5,10 +5,11 @@ import { createServer } from 'net';
5
5
  import { homedir } from 'os';
6
6
  import { dirname, join, resolve } from 'path';
7
7
  import { configStore } from '../../config.js';
8
+ import { personProgramRefusal } from '../../config/permission_pin.js';
8
9
  import { commandPolicyFor } from '../../config/permissions.js';
9
10
  import { ToolCapability } from '../runtime/capabilities.js';
10
11
  import { commandsRequireOsSandbox } from '../../utils/sandbox.js';
11
- import { buildModelClientSubprocessEnv, buildUserSubprocessEnv } from '../../utils/subprocess_env.js';
12
+ import { buildModelClientSubprocessEnv, buildUserSubprocessEnv, platformRouterBearersWithheld } from '../../utils/subprocess_env.js';
12
13
  import { getZergSocketClient } from '../../zerg/socket_client.js';
13
14
  import { getActiveManifest } from '../../zerg/manifest_state.js';
14
15
  import { createMiniZdeController, getActiveMiniZdeController, listZergRuns, resumeMiniZdeController, } from '../../zerg/mini_zde_controller.js';
@@ -242,6 +243,15 @@ function readLogTail(logPath, maxLines = 20) {
242
243
  export function launchesLocalZerg(args) {
243
244
  return args[0] === 'launch' || args[0] === 'serve';
244
245
  }
246
+ /**
247
+ * Whether a Zerg service started with ENV routes its model calls through Zerg Router, as zerg/zerg/backend/factory.py
248
+ * decides it: ZERG_LLM_AUTH_MODE=zrouter, or a ZERG_PROXY_URL under any mode but direct (auto, the default, routes there
249
+ * when one is set). There it infers with ZERG_API_TOKEN, which it requires under zrouter and sends to the proxy otherwise.
250
+ */
251
+ function zergServiceRoutesThroughRouter(env) {
252
+ const mode = env.ZERG_LLM_AUTH_MODE?.trim().toLowerCase() || 'auto';
253
+ return mode !== 'direct' && (mode === 'zrouter' || Boolean(env.ZERG_PROXY_URL?.trim()));
254
+ }
245
255
  /**
246
256
  * Whether the permission profile this process runs under holds the agent's commands to the OS sandbox, so relayed
247
257
  * input, which another pane's agent can send and nobody approves, launches no local Zerg. One that can't be read does.
@@ -265,6 +275,26 @@ export async function zergLaunchLocal(args, ctx) {
265
275
  });
266
276
  return;
267
277
  }
278
+ // Poetry runs the zerg/ project's own code outside any sandbox: under its host's pin, where the person's commands run
279
+ // only inside the OS sandbox, it isn't started, whoever asks (config/permission_pin.ts personProgramRefusal).
280
+ const pinned = personProgramRefusal('No local Zerg was launched', 'Poetry and the zerg/ project\'s code', 'Use /zerg connect <url> to a Zerg that is already running.');
281
+ if (pinned) {
282
+ ctx.addMessage({ role: 'system', content: pinned });
283
+ return;
284
+ }
285
+ // Where its host runs ZTC no program ZTC starts that is not a ZTC is given a ZergAI platform or Zerg Router bearer
286
+ // (platformRouterBearersWithheld): a Zerg service that routes through Zerg Router would start without the credential it
287
+ // routes with, and fail at startup or at its first model call (the bearers' follow-up review, BROKE-ZERG-SERVICE-ROUTE).
288
+ if (platformRouterBearersWithheld() && zergServiceRoutesThroughRouter(process.env)) {
289
+ ctx.addMessage({
290
+ role: 'system',
291
+ content: 'No local Zerg was launched: where its host runs ZTC (ZTC_HOSTED, a host\'s thread), no program ZTC starts that is '
292
+ + 'not a ZTC is given a ZergAI platform or Zerg Router bearer, and the Zerg service would route its model calls through Zerg '
293
+ + 'Router (ZERG_LLM_AUTH_MODE, ZERG_PROXY_URL) without the one it routes with (ZERG_API_TOKEN). Use /zerg connect <url> to a '
294
+ + 'Zerg that is already running, or launch one that infers directly (ZERG_LLM_AUTH_MODE=direct).',
295
+ });
296
+ return;
297
+ }
268
298
  // Poetry runs the zerg/ project's own code outside the OS sandbox this profile holds the agent's commands to. The
269
299
  // agent's ztc_command is refused before this (launchesLocalZerg) unless the person approved it; relayed input here.
270
300
  if (launchRefusedForRelayedInput(ctx)) {
@@ -20,6 +20,7 @@ import { sep } from 'node:path';
20
20
  import { buildProviderChoices, routeWord } from '../../app/runtime_choices.js';
21
21
  import { configStore } from '../../config.js';
22
22
  import { permissionsBeyond, savedPermissionSettings } from '../../config/permissions.js';
23
+ import { nestedRunEnv } from '../../config/profiles.js';
23
24
  import { nextPaneTitle } from '../../panes/agent_cli.js';
24
25
  import { PANE_TASK_AS_MESSAGE_ENV } from '../../panes/initial_input.js';
25
26
  import { MOTSI_PANE_ENV, remoteViewMotsi, throughMotsi } from '../../panes/motsi.js';
@@ -217,7 +218,8 @@ export const ztcPaneCommand = {
217
218
  cwd,
218
219
  title,
219
220
  pane_type: 'ztc',
220
- env: { ...childZtcPaneEnv(), ...(motsi ? MOTSI_PANE_ENV : {}), ...taskAsMessage },
221
+ // An agent's is a nested run of this ZTC (config/profiles.ts nestedRunEnv), as its create_ztc_pane pane is.
222
+ env: { ...childZtcPaneEnv(), ...(byPerson ? {} : nestedRunEnv()), ...(motsi ? MOTSI_PANE_ENV : {}), ...taskAsMessage },
221
223
  });
222
224
  if (!sent) {
223
225
  created.catch(() => { });
@@ -31,6 +31,8 @@ export interface AgentFactoryOptions {
31
31
  completionCheck?: boolean;
32
32
  /** Nobody can answer this run; see AgentConfig.noHumanAvailable. */
33
33
  noHumanAvailable?: boolean;
34
+ unattended?: boolean;
35
+ endProtocol?: boolean;
34
36
  /** Whether the host run check may hold a final answer; false while another driver owns continuation. */
35
37
  runCheck?: () => boolean;
36
38
  /** Whether the host stops the session's commands when the turn ends (a headless --prompt run); see AgentConfig. */
@@ -79,6 +81,8 @@ export interface AgentFactoryOptions {
79
81
  midTurnCompactTokenBudget?: number;
80
82
  /** Renderer can hard-stop and rebuild after the plan_mode tool fires. */
81
83
  allowSelfPlanTransition?: boolean;
84
+ /** The agent of a hosted resident (app/hosted_resident.ts): its tool set leaves out the platform's zerg_* tools. */
85
+ hostedResident?: boolean;
82
86
  }
83
87
  export interface ResolvedAgentBackend {
84
88
  provider: string;
@@ -30,6 +30,7 @@ import { buildAgentToolsFromDomain } from './tools/sim_domain_tools.js';
30
30
  import { getMcpTools, noteShadowedMcpTool } from '../mcp/registry.js';
31
31
  import { workflowsEnabled, workflowNaturalLanguageTriggerEnabled } from '../workflows/config.js';
32
32
  import { isToolAllowed, getModeSystemPrompt } from '../app/modes.js';
33
+ import { hostedResidentAgentTools } from '../app/hosted_resident.js';
33
34
  import { compatEndpoint, configStore } from '../config.js';
34
35
  import { getCachedSkillManifest } from '../skills/registry.js';
35
36
  import { composeAgentSystemPrompt } from './system_prompt.js';
@@ -574,6 +575,9 @@ export function createAgentFromConfig(options) {
574
575
  allTools = mergeEmulationToolDefinitions(allTools, emulation.tools, emulationAdapters);
575
576
  }
576
577
  allTools = allTools.filter((tool) => !HIDDEN_TODO_TOOL_NAMES.has(tool.definition.name));
578
+ if (!(options.endProtocol ?? false)) {
579
+ allTools = allTools.filter((tool) => tool.definition.name !== 'declare_outcome');
580
+ }
577
581
  // Phase 5 — role-based tool scoping. The coordinator writes a per-sim
578
582
  // role-permissions.json file in ZTC_SIM_OUTPUT_DIR mapping paneId (as
579
583
  // string) to a list of excluded tool names; we read it here keyed by the
@@ -641,6 +645,9 @@ export function createAgentFromConfig(options) {
641
645
  if (hostToolAllowlist) {
642
646
  filteredTools = filteredTools.filter(tool => hostToolAllowlist.has(tool.definition.name));
643
647
  }
648
+ // A hosted resident's agent goes without the platform's zerg_* tools, whatever source added them.
649
+ if (options.hostedResident)
650
+ filteredTools = hostedResidentAgentTools(filteredTools);
644
651
  // A tool the permission profile forbids is not offered: CapabilityPolicy would refuse every call to it. Plan mode
645
652
  // keeps its own fixed tool list. Nor is one that would start a program of the agent's outside the OS sandbox a
646
653
  // profile holds its commands to, unless the profile asks the person before each command (commandsSandboxOnly);
@@ -808,6 +815,8 @@ export function createAgentFromConfig(options) {
808
815
  maxConsecutiveAutoContinues: options.maxConsecutiveAutoContinues
809
816
  ?? options.config.maxConsecutiveAutoContinues,
810
817
  noHumanAvailable: options.noHumanAvailable,
818
+ unattended: options.unattended,
819
+ endProtocol: options.endProtocol,
811
820
  // The configured cap, else none: ordinary work runs until it completes or is cancelled. A host that passed nothing
812
821
  // (the Ink interface) took the agent's own default of ten rounds, and its turns ended silently every ten (forge3d
813
822
  // orchestrator's feedback, 2026-11-16).
@@ -875,7 +884,8 @@ function modeHasExplicitAllowlist(modeName) {
875
884
  * factory's codex arm and its test exercise the one real predicate.
876
885
  */
877
886
  export function filterProviderHarnessTools(tools) {
878
- return tools.filter(tool => !tool.definition.overlapsProviderHarness && !tool.finalResponse);
887
+ return tools.filter(tool => !tool.definition.overlapsProviderHarness && !tool.finalResponse
888
+ && tool.definition.name !== 'declare_outcome');
879
889
  }
880
890
  export function applyPlanWriteGuard(tools, artifactPath) {
881
891
  const allowedPath = artifactPath ? resolveNoFollowLeaf(artifactPath) : null;
@@ -6,6 +6,8 @@ import type { ManagedCommandObservation } from './runtime/command_jobs.js';
6
6
  */
7
7
  /** How long an identical result counts as the one the model just saw. A later identical call is a re-check. */
8
8
  export declare const REPEAT_GUARD_WINDOW_MS: number;
9
+ export declare function normalizeToolResult(content: string): string;
10
+ export declare function canonicalToolInput(input: unknown): string;
9
11
  export interface RepeatGuard {
10
12
  (name: string, input: unknown, content: string, managedCommand?: ManagedCommandObservation): string;
11
13
  /** Compaction replaced the earlier results with a summary, so calling again is a re-read, not a repeat. */
@@ -32,12 +34,46 @@ export declare const REPEAT_GUARD_MARKER = "\n\n[repeat-guard] ";
32
34
  * Returns the input unchanged when the guard never appended.
33
35
  */
34
36
  export declare function stripRepeatGuard(content: string): string;
35
- /**
36
- * R7 task pin. Appends the pinned task to a system prompt so it survives the
37
- * rolling window / compaction (request.system is never compacted). Returns the
38
- * prompt unchanged when there is no task text.
39
- */
37
+ export interface NoProgressResult {
38
+ name: string;
39
+ input?: unknown;
40
+ content: string;
41
+ isError: boolean;
42
+ effect: 'read' | 'write' | 'external';
43
+ managedCommand?: ManagedCommandObservation;
44
+ }
45
+ export interface NoProgressGuard {
46
+ (results: readonly NoProgressResult[], options: {
47
+ text: boolean;
48
+ }): 'continue' | 'nudge' | 'stalled';
49
+ reset(): void;
50
+ windowSize(): number;
51
+ }
52
+ export declare const NO_PROGRESS_NUDGE: string;
53
+ export declare function noProgressStalledMessage(calls: number): string;
54
+ export declare function createNoProgressGuard(limits: {
55
+ nudgeAfter: number;
56
+ stopAfter: number;
57
+ }): NoProgressGuard;
58
+ export interface CommandRepeatGuard {
59
+ refuse(name: string, input: unknown): string | null;
60
+ observe(name: string, input: unknown, content: string, timedOut?: boolean): string;
61
+ forget(): void;
62
+ }
63
+ export declare function isShellToolName(name: string): boolean;
64
+ export declare function createCommandRepeatGuard(limit: number, longRunningMs?: number): CommandRepeatGuard;
65
+ export declare function clipTask(text: string, max: number): string;
40
66
  export declare function pinnedTaskSystem(systemPrompt: string, task: string | undefined | null): string;
67
+ interface RestatableMessage {
68
+ role: string;
69
+ content: unknown;
70
+ metadata?: {
71
+ synthetic?: boolean;
72
+ hostContext?: boolean;
73
+ compactionSummary?: boolean;
74
+ };
75
+ }
76
+ export declare function restateTaskNote(messages: readonly RestatableMessage[], pinnedTask?: string | null): string | undefined;
41
77
  export declare function needsCompletionCheck(options: {
42
78
  usedTools: boolean;
43
79
  hasPendingToolCall: boolean;
@@ -63,3 +99,4 @@ export declare const ANNOUNCEMENT_ONLY_MAX_CHARS = 600;
63
99
  * sign-off after a sentence that carries an answer is not one either.
64
100
  */
65
101
  export declare function isAnnouncementOnly(text: string): boolean;
102
+ export {};
@@ -1,3 +1,6 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { failureWithoutExecutionSuffix } from './runtime/command_execution_policy.js';
3
+ import { errorLine } from './runtime/failure_cause.js';
1
4
  /**
2
5
  * Shared loop-policy helpers applied by BOTH run loops (Agent.run and
3
6
  * SubAgent.run) so the two cannot drift (Eng review A5). Pure and stateless
@@ -5,6 +8,45 @@
5
8
  */
6
9
  /** How long an identical result counts as the one the model just saw. A later identical call is a re-check. */
7
10
  export const REPEAT_GUARD_WINDOW_MS = 5 * 60_000;
11
+ const COPY_NOTE_PATH = /(full (?:output|result|stdout|stderr|command output): )\S+/g;
12
+ const COPY_NOTE_RECALL = /tool_use_id=[A-Za-z0-9_-]+/g;
13
+ const TRAILING_RUN_ID = /\nrun_id: [\w-]+$/;
14
+ function withoutCopyNotes(text) {
15
+ return text.replace(COPY_NOTE_PATH, '$1<copy>').replace(COPY_NOTE_RECALL, 'tool_use_id=<id>');
16
+ }
17
+ export function normalizeToolResult(content) {
18
+ const stable = failureWithoutExecutionSuffix(stripRepeatGuard(content)).replace(TRAILING_RUN_ID, '');
19
+ let value;
20
+ try {
21
+ value = JSON.parse(stable);
22
+ }
23
+ catch {
24
+ return withoutCopyNotes(stable);
25
+ }
26
+ if (value === null || typeof value !== 'object' || Array.isArray(value))
27
+ return withoutCopyNotes(stable);
28
+ const row = { ...value };
29
+ delete row.run_id;
30
+ delete row.observed_at;
31
+ delete row.elapsed_ms;
32
+ delete row.started_at;
33
+ delete row.log_path;
34
+ if (row.execution_policy !== null && typeof row.execution_policy === 'object' && !Array.isArray(row.execution_policy)) {
35
+ const policy = { ...row.execution_policy };
36
+ delete policy.started_at;
37
+ delete policy.deadline_at;
38
+ row.execution_policy = policy;
39
+ }
40
+ return withoutCopyNotes(JSON.stringify(row));
41
+ }
42
+ export function canonicalToolInput(input) {
43
+ try {
44
+ return JSON.stringify(input) ?? '';
45
+ }
46
+ catch {
47
+ return '';
48
+ }
49
+ }
8
50
  /**
9
51
  * R5 progress-delta guard. Returns a function that, given a tool call's name,
10
52
  * input, and result content, appends a corrective hint when the SAME call
@@ -31,8 +73,9 @@ export function createRepeatGuard() {
31
73
  }
32
74
  const prev = seen.get(sig);
33
75
  const now = Date.now();
34
- seen.set(sig, { content, at: now });
35
- if (prev !== undefined && prev.content === content && now - prev.at < REPEAT_GUARD_WINDOW_MS) {
76
+ const normalized = normalizeToolResult(content);
77
+ seen.set(sig, { content: normalized, at: now });
78
+ if (prev !== undefined && prev.content === normalized && now - prev.at < REPEAT_GUARD_WINDOW_MS) {
36
79
  return `${content}\n\n[repeat-guard] This \`${name}\` call repeated a previous identical call and produced the identical result — it is not making progress. Do not repeat it; change your approach or move on.`;
37
80
  }
38
81
  return content;
@@ -59,16 +102,176 @@ export function stripRepeatGuard(content) {
59
102
  return content;
60
103
  return content.slice(0, idx);
61
104
  }
105
+ export const NO_PROGRESS_NUDGE = '[Host note] This turn is making no progress: its recent tool calls wrote nothing, '
106
+ + 'sent no message, and learned nothing new. Stop repeating the same reads or commands. Act on what you already have: '
107
+ + 'make the change, run the check, or answer. If something blocks you, say what it is.';
108
+ export function noProgressStalledMessage(calls) {
109
+ return `Stopped: ${calls} tool calls made no progress (no write, no message, no new information). `
110
+ + 'The work so far is retained; resume with a narrower next step.';
111
+ }
112
+ export function createNoProgressGuard(limits) {
113
+ const seen = new Set();
114
+ let calls = 0;
115
+ let nudged = false;
116
+ const guard = (results, options) => {
117
+ if (options.text) {
118
+ calls = 0;
119
+ nudged = false;
120
+ return 'continue';
121
+ }
122
+ let progress = false;
123
+ let counted = 0;
124
+ for (const result of results) {
125
+ if (isHealthyManagedCommandRead(result.managedCommand))
126
+ continue;
127
+ if (result.managedCommand?.result.status === 'running')
128
+ continue;
129
+ counted += 1;
130
+ const digest = createHash('sha256').update(normalizeToolResult(result.content)).digest('hex');
131
+ const key = result.effect === 'read' ? digest : `${result.name}\u0000${canonicalToolInput(result.input)}\u0000${digest}`;
132
+ const fresh = !seen.has(key);
133
+ seen.add(key);
134
+ if ((isWrite(result) && !result.isError) || fresh)
135
+ progress = true;
136
+ }
137
+ if (progress) {
138
+ calls = 0;
139
+ nudged = false;
140
+ return 'continue';
141
+ }
142
+ if (counted === 0)
143
+ return 'continue';
144
+ calls += counted;
145
+ if (!nudged && calls >= limits.nudgeAfter) {
146
+ nudged = true;
147
+ return 'nudge';
148
+ }
149
+ if (nudged && calls >= limits.nudgeAfter + limits.stopAfter)
150
+ return 'stalled';
151
+ return 'continue';
152
+ };
153
+ return Object.assign(guard, { reset: () => { seen.clear(); calls = 0; nudged = false; }, windowSize: () => calls });
154
+ }
155
+ const LONG_RUNNING_COMMAND_MS = 60_000;
156
+ const SHELL_TOOL_NAMES = new Set(['run_command', 'exec_command', 'shell_command', 'Bash']);
157
+ export function isShellToolName(name) {
158
+ return SHELL_TOOL_NAMES.has(name);
159
+ }
160
+ function isWrite(result) {
161
+ return result.effect === 'write';
162
+ }
163
+ function failureLine(content) {
164
+ try {
165
+ const parsed = JSON.parse(content);
166
+ const text = [parsed.stderr, parsed.stdout].filter((value) => typeof value === 'string').join('\n');
167
+ if (text.trim())
168
+ return errorLine(text);
169
+ }
170
+ catch {
171
+ }
172
+ return errorLine(content);
173
+ }
174
+ export function createCommandRepeatGuard(limit, longRunningMs = LONG_RUNNING_COMMAND_MS) {
175
+ const seen = new Map();
176
+ const started = new Map();
177
+ const signature = (name, input) => {
178
+ try {
179
+ return `${name}\u0000${JSON.stringify(input)}`;
180
+ }
181
+ catch {
182
+ return null;
183
+ }
184
+ };
185
+ return {
186
+ refuse(name, input) {
187
+ const sig = signature(name, input);
188
+ if (sig === null)
189
+ return null;
190
+ started.set(sig, Date.now());
191
+ const prev = seen.get(sig);
192
+ if (prev === undefined || prev.count < limit || !prev.longRunning)
193
+ return null;
194
+ const line = failureLine(prev.content);
195
+ return `Refused: this command has already produced the identical result ${prev.count} times. It is not making progress. `
196
+ + (line ? `The failing line is: ${line}. ` : '')
197
+ + 'Change the command or the code, or read the running job with read_command instead of starting it again.';
198
+ },
199
+ observe(name, input, content, timedOut = false) {
200
+ const sig = signature(name, input);
201
+ if (sig === null)
202
+ return content;
203
+ const began = started.get(sig);
204
+ started.delete(sig);
205
+ const normalized = normalizeToolResult(content);
206
+ const longRunning = timedOut || (began !== undefined && Date.now() - began >= longRunningMs);
207
+ const prev = seen.get(sig);
208
+ const same = prev !== undefined && prev.content === normalized;
209
+ const count = same ? prev.count + 1 : 1;
210
+ seen.set(sig, { content: normalized, count, longRunning: longRunning || (same && prev.longRunning) });
211
+ if (count < limit)
212
+ return content;
213
+ const line = failureLine(normalized);
214
+ return `${content}\n\n[command-repeat] This command has now produced the identical result ${count} times. `
215
+ + (line ? `The failing line is: ${line}. ` : '')
216
+ + 'It is not making progress. Change the command or the code; do not start it again unchanged.';
217
+ },
218
+ forget() {
219
+ seen.clear();
220
+ started.clear();
221
+ },
222
+ };
223
+ }
62
224
  /**
63
225
  * R7 task pin. Appends the pinned task to a system prompt so it survives the
64
226
  * rolling window / compaction (request.system is never compacted). Returns the
65
227
  * prompt unchanged when there is no task text.
66
228
  */
229
+ const PINNED_TASK_MAX_CHARS = 8_000;
230
+ const RESTATED_TASK_MAX_CHARS = 4_000;
231
+ export function clipTask(text, max) {
232
+ if (text.length <= max)
233
+ return text;
234
+ const marker = (omitted) => `\n\n[... ${omitted} characters omitted ...]\n\n`;
235
+ const keep = Math.max(0, max - marker(text.length).length);
236
+ let head = Math.floor(keep * 0.6);
237
+ let tail = text.length - (keep - head);
238
+ // Cut between surrogate pairs, never inside one.
239
+ if (isLowSurrogate(text.charCodeAt(head)) && isHighSurrogate(text.charCodeAt(head - 1)))
240
+ head -= 1;
241
+ if (isLowSurrogate(text.charCodeAt(tail)) && isHighSurrogate(text.charCodeAt(tail - 1)))
242
+ tail += 1;
243
+ return `${text.slice(0, head)}${marker(tail - head)}${text.slice(tail)}`;
244
+ }
245
+ function isHighSurrogate(code) {
246
+ return code >= 0xd800 && code <= 0xdbff;
247
+ }
248
+ function isLowSurrogate(code) {
249
+ return code >= 0xdc00 && code <= 0xdfff;
250
+ }
67
251
  export function pinnedTaskSystem(systemPrompt, task) {
68
252
  const t = (task ?? '').trim();
69
253
  if (!t)
70
254
  return systemPrompt;
71
- return `${systemPrompt}\n\n# Current task (pinned — do not lose sight of this across a long session)\n${t.slice(0, 2000)}`;
255
+ return `${systemPrompt}\n\n# Current task (pinned — do not lose sight of this across a long session)\n${clipTask(t, PINNED_TASK_MAX_CHARS)}`;
256
+ }
257
+ function messageText(message) {
258
+ if (typeof message.content === 'string')
259
+ return message.content;
260
+ if (!Array.isArray(message.content))
261
+ return '';
262
+ return message.content.map(block => block !== null && typeof block === 'object' && 'text' in block
263
+ ? String(block.text ?? '') : '').join('');
264
+ }
265
+ export function restateTaskNote(messages, pinnedTask) {
266
+ const real = messages.filter(message => message.role === 'user'
267
+ && !message.metadata?.synthetic && !message.metadata?.hostContext && !message.metadata?.compactionSummary);
268
+ const task = clipTask(pinnedTask?.trim() || (real.length > 0 ? messageText(real[0]).trim() : ''), RESTATED_TASK_MAX_CHARS);
269
+ if (!task)
270
+ return undefined;
271
+ const latest = real.length > 0 ? clipTask(messageText(real.at(-1)).trim(), RESTATED_TASK_MAX_CHARS) : '';
272
+ return `[Host note] Your previous response was stopped because it kept repeating itself. The task is:\n${task}\n`
273
+ + (latest && latest !== task ? `The latest instruction is:\n${latest}\n` : '')
274
+ + 'Continue the task without repeating yourself: act with a tool call soon or give a short answer.';
72
275
  }
73
276
  export function needsCompletionCheck(options) {
74
277
  return options.usedTools && !options.hasPendingToolCall;
@@ -50,6 +50,11 @@ export interface CommandProgressResult {
50
50
  reason: 'output' | 'terminal' | 'deadline';
51
51
  result: CommandReadResult;
52
52
  }
53
+ /**
54
+ * Whether JOB is one this process started or took over: what it stops as a run or an interrupted turn ends, and whose
55
+ * state it announces. Another ZTC on the session sees to its own.
56
+ */
57
+ export declare function startedHere(job: Pick<CommandReceipt, 'job_id'>): boolean;
53
58
  export declare function subscribeCommandJobs(sessionId: string, listener: (jobs: CommandReceipt[]) => void): () => void;
54
59
  export declare function listCommandJobs(sessionId: string): CommandReceipt[];
55
60
  export declare function startCommandJob(options: {