@zergai/ztc 0.26.2-dev.202611210149 → 0.26.4-dev.202611231953

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 (275) hide show
  1. package/README.md +590 -28
  2. package/bin/zmux-darwin-arm64 +0 -0
  3. package/bin/zmux-linux-x64 +0 -0
  4. package/bin/ztc-audio-darwin-arm64 +0 -0
  5. package/bin/ztc-capture-darwin-arm64 +0 -0
  6. package/bin/ztc-tui-darwin-arm64 +0 -0
  7. package/bin/ztc-tui-linux-x64 +0 -0
  8. package/bin/zterm-darwin-arm64 +2 -2
  9. package/dist/App.js +18 -1
  10. package/dist/agent/agent.d.ts +25 -1
  11. package/dist/agent/agent.js +26 -1
  12. package/dist/agent/attached_images.d.ts +58 -0
  13. package/dist/agent/attached_images.js +145 -0
  14. package/dist/agent/backends/anthropic.d.ts +14 -0
  15. package/dist/agent/backends/anthropic.js +49 -2
  16. package/dist/agent/backends/codex_app_server.d.ts +3 -1
  17. package/dist/agent/backends/codex_app_server.js +9 -6
  18. package/dist/agent/backends/codex_auth.js +3 -0
  19. package/dist/agent/backends/gemini.js +3 -0
  20. package/dist/agent/backends/host_effort_policy.js +14 -2
  21. package/dist/agent/backends/http_error.d.ts +17 -0
  22. package/dist/agent/backends/http_error.js +50 -1
  23. package/dist/agent/backends/index.js +2 -1
  24. package/dist/agent/backends/model_redirect.d.ts +47 -0
  25. package/dist/agent/backends/model_redirect.js +97 -0
  26. package/dist/agent/backends/openai_compatible.js +5 -0
  27. package/dist/agent/backends/openai_responses.d.ts +9 -1
  28. package/dist/agent/backends/openai_responses.js +21 -12
  29. package/dist/agent/backends/prompt_cache.d.ts +8 -0
  30. package/dist/agent/backends/prompt_cache.js +10 -0
  31. package/dist/agent/backends/provider_ids.d.ts +1 -1
  32. package/dist/agent/backends/provider_ids.js +1 -1
  33. package/dist/agent/backends/types.d.ts +8 -0
  34. package/dist/agent/backends/zerg-api.js +5 -1
  35. package/dist/agent/backends/zrouter_stream.d.ts +75 -9
  36. package/dist/agent/backends/zrouter_stream.js +250 -49
  37. package/dist/agent/commands/config.js +51 -4
  38. package/dist/agent/commands/connect.js +20 -0
  39. package/dist/agent/commands/credential_status.js +5 -3
  40. package/dist/agent/commands/debug.js +3 -0
  41. package/dist/agent/commands/diff.js +9 -5
  42. package/dist/agent/commands/emulation.js +7 -1
  43. package/dist/agent/commands/inbox.js +4 -3
  44. package/dist/agent/commands/mcp.js +3 -0
  45. package/dist/agent/commands/models.js +20 -3
  46. package/dist/agent/commands/permissions.js +16 -2
  47. package/dist/agent/commands/provider_selection.js +13 -6
  48. package/dist/agent/commands/settings.js +15 -4
  49. package/dist/agent/commands/status.js +23 -1
  50. package/dist/agent/commands/types.d.ts +34 -3
  51. package/dist/agent/commands/update.d.ts +2 -1
  52. package/dist/agent/commands/update.js +8 -3
  53. package/dist/agent/commands/zerg.d.ts +6 -0
  54. package/dist/agent/commands/zerg.js +152 -28
  55. package/dist/agent/commands/ztc_pane.js +8 -5
  56. package/dist/agent/factory.js +22 -4
  57. package/dist/agent/request_encoder.js +11 -2
  58. package/dist/agent/runtime/command_jobs.js +16 -1
  59. package/dist/agent/runtime/command_panes.js +4 -1
  60. package/dist/agent/runtime/execution_context.d.ts +8 -1
  61. package/dist/agent/runtime/execution_context.js +8 -2
  62. package/dist/agent/runtime/policy.d.ts +66 -5
  63. package/dist/agent/runtime/policy.js +161 -33
  64. package/dist/agent/runtime/remote_broker_transport.d.ts +7 -0
  65. package/dist/agent/runtime/remote_broker_transport.js +33 -3
  66. package/dist/agent/runtime/remote_resource_errors.d.ts +7 -0
  67. package/dist/agent/runtime/remote_resource_errors.js +10 -0
  68. package/dist/agent/runtime/remote_resources.d.ts +1 -1
  69. package/dist/agent/runtime/remote_resources.js +7 -3
  70. package/dist/agent/runtime/source_verification.js +15 -12
  71. package/dist/agent/runtime/tool_runtime.js +165 -58
  72. package/dist/agent/runtime/verifier_capture.d.ts +1 -1
  73. package/dist/agent/runtime/verifier_capture.js +6 -0
  74. package/dist/agent/runtime/work_base.js +46 -14
  75. package/dist/agent/tools/adaptation.js +29 -12
  76. package/dist/agent/tools/apply_patch.js +62 -5
  77. package/dist/agent/tools/background.js +2 -0
  78. package/dist/agent/tools/benchmark_cpu.js +2 -0
  79. package/dist/agent/tools/bus_message.d.ts +4 -2
  80. package/dist/agent/tools/bus_message.js +21 -3
  81. package/dist/agent/tools/delegate.js +2 -0
  82. package/dist/agent/tools/file.d.ts +12 -1
  83. package/dist/agent/tools/file.js +92 -11
  84. package/dist/agent/tools/lsp.d.ts +12 -0
  85. package/dist/agent/tools/lsp.js +61 -5
  86. package/dist/agent/tools/pane.js +20 -45
  87. package/dist/agent/tools/project_context.js +5 -2
  88. package/dist/agent/tools/routine.js +20 -4
  89. package/dist/agent/tools/screenshot.d.ts +8 -0
  90. package/dist/agent/tools/screenshot.js +39 -25
  91. package/dist/agent/tools/search.js +31 -3
  92. package/dist/agent/tools/shell.js +7 -1
  93. package/dist/agent/tools/supervision.js +6 -0
  94. package/dist/agent/tools/types.d.ts +18 -0
  95. package/dist/agent/tools/zerg.js +15 -19
  96. package/dist/agent/tools/ztc_command.d.ts +15 -4
  97. package/dist/agent/tools/ztc_command.js +48 -34
  98. package/dist/app/agent_runner.js +8 -6
  99. package/dist/app/conversation_compaction.d.ts +6 -3
  100. package/dist/app/conversation_compaction.js +6 -3
  101. package/dist/app/tool_callbacks.js +1 -0
  102. package/dist/audio/sfx.js +6 -0
  103. package/dist/batch/worktree.js +22 -10
  104. package/dist/board/client.js +2 -1
  105. package/dist/cli_main.d.ts +1 -0
  106. package/dist/cli_main.js +141 -45
  107. package/dist/cli_ratatui.d.ts +49 -4
  108. package/dist/cli_ratatui.js +355 -79
  109. package/dist/conductor_branch.js +4 -1
  110. package/dist/config/host_credentials.d.ts +157 -0
  111. package/dist/config/host_credentials.js +589 -0
  112. package/dist/config/model_pin.d.ts +111 -0
  113. package/dist/config/model_pin.js +182 -0
  114. package/dist/config/own_state_files.d.ts +35 -0
  115. package/dist/config/own_state_files.js +161 -0
  116. package/dist/config/permission_pin.d.ts +148 -0
  117. package/dist/config/permission_pin.js +203 -0
  118. package/dist/config/permissions.d.ts +9 -2
  119. package/dist/config/permissions.js +14 -3
  120. package/dist/config/platform_login.d.ts +72 -0
  121. package/dist/config/platform_login.js +111 -0
  122. package/dist/config/profile_limits.d.ts +34 -0
  123. package/dist/config/profile_limits.js +66 -0
  124. package/dist/config/provider_api_key_env.js +3 -2
  125. package/dist/config/provider_models.d.ts +6 -1
  126. package/dist/config/provider_models.js +38 -11
  127. package/dist/config/repo_config.d.ts +22 -0
  128. package/dist/config/repo_config.js +77 -3
  129. package/dist/config/router_runtime_grant.d.ts +53 -0
  130. package/dist/config/router_runtime_grant.js +131 -0
  131. package/dist/config/settings_merge.d.ts +22 -0
  132. package/dist/config/settings_merge.js +75 -0
  133. package/dist/config/types.d.ts +8 -0
  134. package/dist/config.d.ts +334 -4
  135. package/dist/config.js +1024 -41
  136. package/dist/context/project_intelligence.d.ts +11 -2
  137. package/dist/context/project_intelligence.js +38 -15
  138. package/dist/desktop/daily/desktop_wiring.js +8 -6
  139. package/dist/desktop/daily/native_pane_launcher.js +2 -1
  140. package/dist/desktop/daily/native_tool.d.ts +1 -1
  141. package/dist/desktop/daily/native_tool.js +4 -3
  142. package/dist/desktop/daily/process_identity.js +10 -2
  143. package/dist/desktop/daily/source_baseline.js +4 -3
  144. package/dist/diagnostics/native_terminal_benchmark.js +3 -2
  145. package/dist/diagnostics/session_export.js +27 -14
  146. package/dist/embedded/anempa_runtime.js +3 -3
  147. package/dist/embedded/gameboy_runtime.js +5 -4
  148. package/dist/embedded/zergpod_runtime.js +5 -4
  149. package/dist/emulation/catalog.js +6 -1
  150. package/dist/emulation/tool_adapters.js +13 -3
  151. package/dist/environment/store.js +5 -4
  152. package/dist/extension_discovery.d.ts +12 -2
  153. package/dist/extension_discovery.js +52 -7
  154. package/dist/headless.d.ts +8 -0
  155. package/dist/headless.js +52 -13
  156. package/dist/headless_cli.js +16 -1
  157. package/dist/headless_workflow_trigger.js +1 -1
  158. package/dist/hooks/dispatcher.d.ts +8 -0
  159. package/dist/hooks/dispatcher.js +22 -2
  160. package/dist/hooks/lifecycle.d.ts +6 -0
  161. package/dist/hooks/lifecycle.js +1 -0
  162. package/dist/hooks/program_files.d.ts +10 -0
  163. package/dist/hooks/program_files.js +175 -0
  164. package/dist/hooks/runner.d.ts +11 -1
  165. package/dist/hooks/runner.js +112 -11
  166. package/dist/hooks/types.d.ts +2 -0
  167. package/dist/host_credentials_startup.d.ts +6 -0
  168. package/dist/host_credentials_startup.js +17 -0
  169. package/dist/instance_registry.d.ts +6 -2
  170. package/dist/instance_registry.js +9 -15
  171. package/dist/intake/format.d.ts +6 -0
  172. package/dist/intake/format.js +9 -0
  173. package/dist/intake/notifications.js +2 -1
  174. package/dist/lsp/manager.d.ts +1 -1
  175. package/dist/lsp/manager.js +4 -5
  176. package/dist/mcp/client.d.ts +2 -0
  177. package/dist/mcp/client.js +116 -18
  178. package/dist/mcp/registry.d.ts +12 -0
  179. package/dist/mcp/registry.js +15 -1
  180. package/dist/modes/handlers.js +14 -5
  181. package/dist/panes/agent_cli.d.ts +23 -1
  182. package/dist/panes/agent_cli.js +96 -1
  183. package/dist/panes/agent_panes.d.ts +27 -4
  184. package/dist/panes/agent_panes.js +73 -11
  185. package/dist/panes/editor_program.d.ts +8 -0
  186. package/dist/panes/editor_program.js +25 -0
  187. package/dist/panes/motsi.d.ts +11 -1
  188. package/dist/panes/motsi.js +14 -1
  189. package/dist/panes/pane_registry.d.ts +28 -1
  190. package/dist/panes/pane_registry.js +25 -0
  191. package/dist/panes/worker_route.js +5 -3
  192. package/dist/panes/ztc_launch.d.ts +8 -0
  193. package/dist/panes/ztc_launch.js +26 -1
  194. package/dist/profile_baseline.js +2 -0
  195. package/dist/router_auth.d.ts +8 -3
  196. package/dist/router_auth.js +34 -2
  197. package/dist/runtime_info.js +56 -38
  198. package/dist/session.js +12 -2
  199. package/dist/shannon/runtime.js +13 -1
  200. package/dist/simulation/domains/loader.d.ts +2 -1
  201. package/dist/simulation/domains/loader.js +19 -2
  202. package/dist/simulation/living/context.d.ts +8 -8
  203. package/dist/simulation/living/types.d.ts +2 -2
  204. package/dist/simulation/memory/embedding.d.ts +2 -1
  205. package/dist/simulation/memory/embedding.js +25 -6
  206. package/dist/terminal_attach.js +2 -1
  207. package/dist/types.d.ts +21 -0
  208. package/dist/ui/ratatui/headless_pane_manager.d.ts +12 -6
  209. package/dist/ui/ratatui/headless_pane_manager.js +65 -21
  210. package/dist/ui/ratatui/ipc_path.d.ts +41 -2
  211. package/dist/ui/ratatui/ipc_path.js +164 -5
  212. package/dist/ui/ratatui/pane_credential_broker.d.ts +17 -4
  213. package/dist/ui/ratatui/pane_credential_broker.js +23 -5
  214. package/dist/ui/ratatui/pane_relay.d.ts +74 -0
  215. package/dist/ui/ratatui/pane_relay.js +188 -13
  216. package/dist/ui/ratatui/process.d.ts +15 -1
  217. package/dist/ui/ratatui/process.js +129 -163
  218. package/dist/ui/ratatui/protocol.d.ts +11 -1
  219. package/dist/ui/ratatui/protocol.js +6 -0
  220. package/dist/ui/ratatui/ztc_launch_trust.d.ts +87 -0
  221. package/dist/ui/ratatui/ztc_launch_trust.js +249 -0
  222. package/dist/utils/admitted_open.d.ts +40 -0
  223. package/dist/utils/admitted_open.js +111 -0
  224. package/dist/utils/clipboard.js +2 -1
  225. package/dist/utils/computer_native.js +12 -56
  226. package/dist/utils/dictation.js +15 -12
  227. package/dist/utils/dictation_native.js +17 -60
  228. package/dist/utils/git_probe_options.d.ts +28 -0
  229. package/dist/utils/git_probe_options.js +30 -0
  230. package/dist/utils/git_program_files.d.ts +145 -0
  231. package/dist/utils/git_program_files.js +1282 -0
  232. package/dist/utils/git_repository_programs.d.ts +13 -0
  233. package/dist/utils/git_repository_programs.js +38 -0
  234. package/dist/utils/host_shell.js +2 -1
  235. package/dist/utils/idle_compaction.js +8 -1
  236. package/dist/utils/image_fit.d.ts +4 -1
  237. package/dist/utils/image_fit.js +6 -2
  238. package/dist/utils/image_preview.js +3 -2
  239. package/dist/utils/mirror_media.d.ts +22 -4
  240. package/dist/utils/mirror_media.js +87 -86
  241. package/dist/utils/ml_native.js +11 -56
  242. package/dist/utils/native_install.d.ts +55 -0
  243. package/dist/utils/native_install.js +107 -0
  244. package/dist/utils/open_url.js +2 -0
  245. package/dist/utils/process_end.d.ts +16 -0
  246. package/dist/utils/process_end.js +73 -0
  247. package/dist/utils/router_catalog.js +9 -2
  248. package/dist/utils/sandbox.d.ts +64 -1
  249. package/dist/utils/sandbox.js +397 -89
  250. package/dist/utils/shell.js +31 -12
  251. package/dist/utils/subprocess_env.d.ts +218 -2
  252. package/dist/utils/subprocess_env.js +429 -11
  253. package/dist/utils/system_ps.d.ts +5 -0
  254. package/dist/utils/system_ps.js +30 -0
  255. package/dist/utils/tts.js +5 -0
  256. package/dist/utils/tts_native.js +13 -60
  257. package/dist/utils/zlicky_overlay.js +17 -50
  258. package/dist/utils/ztc_own_state.d.ts +58 -0
  259. package/dist/utils/ztc_own_state.js +236 -0
  260. package/dist/web/mirror_authenticator.d.ts +67 -6
  261. package/dist/web/mirror_authenticator.js +131 -22
  262. package/dist/web/mirror_stream.d.ts +54 -10
  263. package/dist/web/mirror_stream.js +379 -92
  264. package/dist/web/observer_query_redaction.js +53 -13
  265. package/dist/web/observer_secret_redaction.d.ts +59 -0
  266. package/dist/web/observer_secret_redaction.js +714 -0
  267. package/dist/web/pane_credentials.d.ts +20 -2
  268. package/dist/web/pane_credentials.js +58 -5
  269. package/dist/worker/executor.js +3 -1
  270. package/dist/workspace_collision.js +19 -15
  271. package/dist/zerg/local_zerg_launches.d.ts +27 -0
  272. package/dist/zerg/local_zerg_launches.js +198 -0
  273. package/dist/zlm-embed.mjs +6257 -2791
  274. package/npm-shrinkwrap.json +1 -1
  275. package/package.json +42 -15
@@ -2,8 +2,7 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
2
  import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
3
3
  import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
4
4
  import { ToolCapability } from '../agent/runtime/capabilities.js';
5
- import { withoutMirrorCredentials } from '../web/pane_credentials.js';
6
- import { withoutHostEffortPolicy } from '../utils/subprocess_env.js';
5
+ import { buildMcpServerEnv } from '../utils/subprocess_env.js';
7
6
  import { hasLaunchFlag } from '../cli_args.js';
8
7
  import { coerceJsonArguments } from './json_arguments.js';
9
8
  export const MAX_MCP_IMAGE_BYTES = 4 * 1024 * 1024;
@@ -12,7 +11,7 @@ const CLIENT_INFO = { name: 'ztc', version: '0.1.0' };
12
11
  // consumers avoid the SDK import); re-export them to preserve this module's
13
12
  // public surface.
14
13
  export { ZTC_MCP_TOOL_CALL_ID_META_KEY, RequiredMcpServerError, getMcpTools, getMcpServerStatuses, noteShadowedMcpTool, getColonyAttachInfo, closeMcpServers, } from './registry.js';
15
- import { connectedTools, connectedClients, serverStatuses, beginMcpInit, resetMcpInit, colonyOptIn, resolveColonyMcpUrl, RequiredMcpServerError, ZTC_MCP_TOOL_CALL_ID_META_KEY, } from './registry.js';
14
+ import { connectedTools, connectedClients, serverStatuses, beginMcpInit, resetMcpInit, colonyOptIn, resolveColonyMcpUrl, RequiredMcpServerError, setMcpStartupNotice, ZTC_MCP_TOOL_CALL_ID_META_KEY, } from './registry.js';
16
15
  function inferTransport(cfg) {
17
16
  if (cfg.transport)
18
17
  return cfg.transport;
@@ -25,18 +24,89 @@ function withTimeout(promise, ms, label) {
25
24
  });
26
25
  return Promise.race([promise, timeout]).finally(() => clearTimeout(timer));
27
26
  }
27
+ /** A variable's name, as an entry's passEnv lists one. */
28
+ const ENV_NAME = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
29
+ /** The names stdio server NAME's passEnv lists; a passEnv that is no list of variable names keeps it from starting. */
30
+ function passEnvOf(name, cfg) {
31
+ const listed = cfg.passEnv;
32
+ if (listed === undefined)
33
+ return [];
34
+ if (!Array.isArray(listed) || !listed.every((item) => typeof item === 'string' && ENV_NAME.test(item))) {
35
+ throw new Error(`MCP server "${name}" was not started: its "passEnv" must be a list of environment variable names, `
36
+ + 'such as ["OPENAI_API_KEY"]');
37
+ }
38
+ return listed;
39
+ }
40
+ /**
41
+ * What is shown of an HTTP MCP server's URL (/mcp, which an agent may run, and its connection errors): its scheme, host
42
+ * and port, never its userinfo, path or query, any of which may carry a credential; "/…" says the URL went on.
43
+ */
44
+ function shownUrl(url) {
45
+ try {
46
+ const parsed = new URL(url);
47
+ const more = parsed.pathname !== '/' || parsed.search !== '' || parsed.hash !== '' || parsed.username !== '' || parsed.password !== '';
48
+ return `${parsed.protocol}//${parsed.host}/${more ? '…' : ''}`;
49
+ }
50
+ catch {
51
+ return '(a URL that is not one)';
52
+ }
53
+ }
54
+ /** A command-line flag whose value is a credential: --token, --api-key, --secret, --password, and the like. */
55
+ const CREDENTIAL_FLAG = /^--?(?:[a-z0-9]+[-_])*(?:token|key|secret|password|passwd|pass|auth|credentials?|bearer)$/i;
56
+ /**
57
+ * What is shown of a stdio MCP server's command line (/mcp): its command and arguments, with the value after a
58
+ * credential flag (CREDENTIAL_FLAG), as its next argument or after "=", withheld.
59
+ */
60
+ function shownCommandLine(command, args) {
61
+ const shown = [command];
62
+ for (let index = 0; index < args.length; index++) {
63
+ const arg = args[index];
64
+ const equals = arg.indexOf('=');
65
+ if (arg.startsWith('-') && equals > 0 && CREDENTIAL_FLAG.test(arg.slice(0, equals))) {
66
+ shown.push(`${arg.slice(0, equals)}=…`);
67
+ }
68
+ else if (CREDENTIAL_FLAG.test(arg) && index + 1 < args.length) {
69
+ shown.push(arg, '…');
70
+ index++;
71
+ }
72
+ else {
73
+ shown.push(arg);
74
+ }
75
+ }
76
+ return shown.join(' ');
77
+ }
78
+ /** NAMES as a list in words: "a", "a and b", "a, b and c". */
79
+ function inWords(names) {
80
+ return names.length <= 1 ? names.join('') : `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`;
81
+ }
28
82
  /**
29
- * Env for an stdio MCP child: the parent env, less this process's mirror credentials (an MCP server is someone
30
- * else's program, and they speak for every pane) and a host's effort policy (which is for ZTC's own turns), plus the
31
- * entry's own overrides.
83
+ * What is said of stdio SERVERS that started without the route credentials NAMES, which their entries' passEnv doesn't
84
+ * name: one line for them all, the variables by name, never their values.
32
85
  */
33
- function buildStdioEnv(extra) {
34
- const env = {};
35
- for (const [k, v] of Object.entries(withoutHostEffortPolicy(withoutMirrorCredentials(process.env)))) {
36
- if (typeof v === 'string')
37
- env[k] = v;
86
+ function withheldNotice(servers, names) {
87
+ const who = servers.length === 1 ? `MCP server "${servers[0]}"` : `MCP servers ${inWords(servers.map(server => `"${server}"`))}`;
88
+ return `${who} started without ${names.join(', ')}: ZTC keeps the credentials it routes models with from the programs `
89
+ + 'it starts. A server that needs one names it in its passEnv in config.json, as in "passEnv": ["<the key it needs>"]; '
90
+ + '"passEnv": [] says it needs none.';
91
+ }
92
+ /**
93
+ * The environment stdio server NAME is started with (buildMcpServerEnv: what a tool child of a headless run gets, what
94
+ * its entry's passEnv names, and its entry's env, an MCP server being someone else's program), and what its startup
95
+ * says about it: the route credentials it was started without and the passEnv that gives one (`unasked`, also said in
96
+ * the one line initMcpServers says of every server), unless its entry has a passEnv of its own, an empty one included,
97
+ * which says what it needs; and what its passEnv names that no MCP server is given. Names only, never values.
98
+ */
99
+ function stdioLaunch(name, cfg, providerKeyEnv) {
100
+ const launch = buildMcpServerEnv({ env: cfg.env, passEnv: passEnvOf(name, cfg) }, providerKeyEnv);
101
+ const notices = [];
102
+ const unasked = cfg.passEnv === undefined ? launch.withheld : [];
103
+ if (unasked.length > 0)
104
+ notices.push(withheldNotice([name], unasked));
105
+ if (launch.refused.length > 0) {
106
+ notices.push(`MCP server "${name}" started without ${launch.refused.join(', ')}, which its passEnv names: ZTC gives no MCP `
107
+ + 'server its own credentials or variables, or another variable holding one of its credentials.');
38
108
  }
39
- return { ...env, ...(extra ?? {}) };
109
+ return { ...launch, notices, unasked };
40
110
  }
41
111
  /** Adapt one MCP tool into a ztc Tool whose execute proxies tools/call. */
42
112
  export function adaptTool(client, serverName, mcpTool) {
@@ -53,6 +123,8 @@ export function adaptTool(client, serverName, mcpTool) {
53
123
  capabilities: mcpTool.annotations?.readOnlyHint === true
54
124
  ? [ToolCapability.FILE_READ, ToolCapability.NETWORK]
55
125
  : [ToolCapability.FILE_WRITE, ToolCapability.SHELL_EXEC, ToolCapability.NETWORK],
126
+ // It calls a server the host configured, which ZTC started as the host had it at startup (see Tool.confinedCommands).
127
+ confinedCommands: true,
56
128
  async execute(args, context) {
57
129
  const params = {
58
130
  name: mcpTool.name,
@@ -226,7 +298,7 @@ function resourceTool(publishers) {
226
298
  },
227
299
  };
228
300
  }
229
- async function connectServer(name, cfg, timeoutMs) {
301
+ async function connectServer(name, cfg, timeoutMs, stdioEnv) {
230
302
  const transportKind = inferTransport(cfg);
231
303
  let transport;
232
304
  if (transportKind === 'http') {
@@ -237,7 +309,9 @@ async function connectServer(name, cfg, timeoutMs) {
237
309
  else {
238
310
  if (!cfg.command)
239
311
  throw new Error(`stdio MCP server "${name}" needs a "command"`);
240
- transport = new StdioClientTransport({ command: cfg.command, args: cfg.args ?? [], env: buildStdioEnv(cfg.env) });
312
+ if (!stdioEnv)
313
+ throw new Error(`stdio MCP server "${name}" has no environment to start with`);
314
+ transport = new StdioClientTransport({ command: cfg.command, args: cfg.args ?? [], env: stdioEnv });
241
315
  }
242
316
  const client = new Client(CLIENT_INFO);
243
317
  try {
@@ -291,8 +365,8 @@ export async function initMcpServers(servers, options = {}) {
291
365
  const statusFor = (name, cfg) => {
292
366
  const transport = inferTransport(cfg);
293
367
  const target = transport === 'http'
294
- ? (cfg.url ?? '(no url)')
295
- : [cfg.command ?? '(no command)', ...(cfg.args ?? [])].join(' ');
368
+ ? (cfg.url ? shownUrl(cfg.url) : '(no url)')
369
+ : shownCommandLine(cfg.command ?? '(no command)', cfg.args ?? []);
296
370
  return {
297
371
  name,
298
372
  transport,
@@ -303,6 +377,8 @@ export async function initMcpServers(servers, options = {}) {
303
377
  };
304
378
  };
305
379
  const timeoutMs = Number(process.env.ZTC_MCP_STARTUP_TIMEOUT_MS) || 15_000;
380
+ /** The servers that started without a route credential their entry's passEnv doesn't name, in config order. */
381
+ const unasked = [];
306
382
  const results = await Promise.all(names.map(async (name) => {
307
383
  const cfg = entries[name];
308
384
  const status = statusFor(name, cfg);
@@ -311,18 +387,40 @@ export async function initMcpServers(servers, options = {}) {
311
387
  return { status, client: null, tools: [] };
312
388
  }
313
389
  try {
314
- const { client, tools } = await connectServer(name, cfg, timeoutMs);
390
+ const launch = status.transport === 'stdio' ? stdioLaunch(name, cfg, options.providerKeyEnv ?? {}) : undefined;
391
+ if (launch && launch.notices.length > 0) {
392
+ status.notices = launch.notices;
393
+ if (launch.unasked.length > 0)
394
+ unasked.push({ name, withheld: launch.unasked });
395
+ // What its passEnv named that no server is given is said of it alone; what it started without, below, in one line.
396
+ // eslint-disable-next-line no-console
397
+ for (const notice of launch.notices.slice(launch.unasked.length > 0 ? 1 : 0))
398
+ console.warn(`[ztc] ${notice}`);
399
+ }
400
+ const { client, tools } = await connectServer(name, cfg, timeoutMs, launch?.env);
315
401
  status.connected = true;
316
402
  return { status, client, tools };
317
403
  }
318
404
  catch (err) {
319
- const message = err instanceof Error ? err.message : String(err);
405
+ // A connection's error may quote the server's URL whole: what is shown of it carries none of its credentials.
406
+ const raw = err instanceof Error ? err.message : String(err);
407
+ const message = cfg.url ? raw.split(cfg.url).join(shownUrl(cfg.url)) : raw;
320
408
  status.error = message;
321
409
  // eslint-disable-next-line no-console
322
410
  console.warn(`[ztc] MCP server "${name}" unavailable: ${message}`);
323
411
  return { status, client: null, tools: [] };
324
412
  }
325
413
  }));
414
+ // Every server that started without a route credential, in one line, once per launch: on stderr for a headless run, and
415
+ // in the terminal app's transcript, where zmux's screen hides stderr (setMcpStartupNotice).
416
+ if (unasked.length > 0) {
417
+ const servers = names.filter(name => unasked.some(entry => entry.name === name));
418
+ const withheld = [...new Set(unasked.flatMap(entry => entry.withheld))].sort();
419
+ const line = withheldNotice(servers, withheld);
420
+ setMcpStartupNotice(line);
421
+ // eslint-disable-next-line no-console
422
+ console.warn(`[ztc] ${line}`);
423
+ }
326
424
  const publishers = [];
327
425
  for (const { status, client, tools } of results) {
328
426
  serverStatuses.push(status);
@@ -17,6 +17,13 @@ interface CloseableClient {
17
17
  export declare const connectedTools: Tool[];
18
18
  export declare const connectedClients: CloseableClient[];
19
19
  export declare const serverStatuses: McpServerStatus[];
20
+ /**
21
+ * The one line startup said of the stdio MCP servers that started without a route credential their entry's passEnv
22
+ * doesn't name, or null: the terminal app shows it in its transcript, since zmux's screen hides what went to stderr.
23
+ */
24
+ export declare function mcpStartupNotice(): string | null;
25
+ /** Record LINE as what startup said of the servers that started without a route credential (mcpStartupNotice). */
26
+ export declare function setMcpStartupNotice(line: string | null): void;
20
27
  export declare class RequiredMcpServerError extends Error {
21
28
  readonly failures: ReadonlyArray<{
22
29
  name: string;
@@ -40,6 +47,11 @@ export interface McpServerStatus {
40
47
  tools: string[];
41
48
  /** Why a server is disabled or failed to connect, when applicable. */
42
49
  error?: string;
50
+ /**
51
+ * What its startup said about how it was started, once: the route credentials it was started without and the passEnv
52
+ * that gives one, and what its passEnv names that no MCP server is given (client.ts). Names only, never values.
53
+ */
54
+ notices?: string[];
43
55
  }
44
56
  /** MCP tools discovered at startup, for the factory to append to the agent's set. */
45
57
  export declare function getMcpTools(): Tool[];
@@ -18,6 +18,19 @@ export const serverStatuses = [];
18
18
  let initialized = false;
19
19
  /** The server set the live connections came from; null when they came from CLI config. */
20
20
  let initializedServerSet = null;
21
+ /** What startup said of the stdio servers that started without a route credential, in one line (client.ts). */
22
+ let startupNotice = null;
23
+ /**
24
+ * The one line startup said of the stdio MCP servers that started without a route credential their entry's passEnv
25
+ * doesn't name, or null: the terminal app shows it in its transcript, since zmux's screen hides what went to stderr.
26
+ */
27
+ export function mcpStartupNotice() {
28
+ return startupNotice;
29
+ }
30
+ /** Record LINE as what startup said of the servers that started without a route credential (mcpStartupNotice). */
31
+ export function setMcpStartupNotice(line) {
32
+ startupNotice = line;
33
+ }
21
34
  export class RequiredMcpServerError extends Error {
22
35
  failures;
23
36
  constructor(failures) {
@@ -35,7 +48,7 @@ export function getMcpTools() {
35
48
  }
36
49
  /** Snapshot of each configured MCP server's connection outcome, for `/mcp`. */
37
50
  export function getMcpServerStatuses() {
38
- return serverStatuses.map((s) => ({ ...s, tools: [...s.tools] }));
51
+ return serverStatuses.map((s) => ({ ...s, tools: [...s.tools], ...(s.notices ? { notices: [...s.notices] } : {}) }));
39
52
  }
40
53
  /**
41
54
  * Drop a tool name from the reported status. The agent factory shadows MCP tools
@@ -64,6 +77,7 @@ export async function closeMcpServers() {
64
77
  connectedClients.length = 0;
65
78
  connectedTools.length = 0;
66
79
  serverStatuses.length = 0;
80
+ startupNotice = null;
67
81
  initialized = false;
68
82
  initializedServerSet = null;
69
83
  }
@@ -294,6 +294,15 @@ export const saveArtifactHandler = async (args, context) => {
294
294
  };
295
295
  // --- Zerg Mode Handlers ---
296
296
  import { configStore } from '../config.js';
297
+ /**
298
+ * MESSAGE, a zerg mode command's answer when there is no ZergAI platform login to send, with why when ZTC holds a login
299
+ * it sends to no platform API (a Zerg Router credential, the host's grant, or a ZTC_AUTH_TOKEN no platform API is named
300
+ * for).
301
+ */
302
+ function withPlatformLoginReason(message) {
303
+ const why = configStore.getPlatformLoginRefusal();
304
+ return why ? `${message}\n\n${why}` : message;
305
+ }
297
306
  /**
298
307
  * Make an API request to the Zerg API.
299
308
  *
@@ -382,7 +391,7 @@ export const zergAssignHandler = async (args, context) => {
382
391
  if (!configStore.isAuthenticated()) {
383
392
  context.addMessage({
384
393
  role: 'system',
385
- content: 'Not authenticated. Use /auth login first.',
394
+ content: withPlatformLoginReason('Not authenticated. Use /auth login first.'),
386
395
  });
387
396
  return;
388
397
  }
@@ -449,7 +458,7 @@ export const zergStatusHandler = async (args, context) => {
449
458
  if (!configStore.isAuthenticated()) {
450
459
  context.addMessage({
451
460
  role: 'system',
452
- content: 'Not authenticated. Use /auth login first.',
461
+ content: withPlatformLoginReason('Not authenticated. Use /auth login first.'),
453
462
  });
454
463
  return;
455
464
  }
@@ -503,7 +512,7 @@ export const zergDelegateHandler = async (args, context) => {
503
512
  if (!configStore.isAuthenticated()) {
504
513
  context.addMessage({
505
514
  role: 'system',
506
- content: 'Not authenticated. Use /auth login first.',
515
+ content: withPlatformLoginReason('Not authenticated. Use /auth login first.'),
507
516
  });
508
517
  return;
509
518
  }
@@ -643,7 +652,7 @@ Examples:
643
652
  if (!configStore.isAuthenticated()) {
644
653
  context.addMessage({
645
654
  role: 'system',
646
- content: 'Not authenticated. Use /auth login first, or /zerg connect <url> to use a local Zerg.',
655
+ content: withPlatformLoginReason('Not authenticated. Use /auth login first, or /zerg connect <url> to use a local Zerg.'),
647
656
  });
648
657
  return;
649
658
  }
@@ -1720,7 +1729,7 @@ export const zergLoadManifestHandler = async (args, context) => {
1720
1729
  if (!configStore.isAuthenticated()) {
1721
1730
  context.addMessage({
1722
1731
  role: 'system',
1723
- content: 'No Zerg connected. Use /zerg connect <url> first.\n\nOr /auth login to select from the pool.',
1732
+ content: withPlatformLoginReason('No Zerg connected. Use /zerg connect <url> first.\n\nOr /auth login to select from the pool.'),
1724
1733
  });
1725
1734
  return;
1726
1735
  }
@@ -10,7 +10,9 @@
10
10
  * In the panes the person opens, ZTC starts both without their permission
11
11
  * prompts (Claude Code's --dangerously-skip-permissions, Codex's
12
12
  * --dangerously-bypass-approvals-and-sandbox) unless their own arguments choose
13
- * how the CLI asks, or `panes.agentPermissions` says ask; an agent's panes ask.
13
+ * how the CLI asks, or `panes.agentPermissions` says ask; an agent's panes ask,
14
+ * and of the CLI's own words an agent may pass only those that can't change
15
+ * how (agentLaunchRefusal).
14
16
  *
15
17
  * What ZTC adds is a session-scoped MCP server, `ztc workspace-mcp`, passed on
16
18
  * the command line (Claude Code `--mcp-config`, Codex `-c mcp_servers.ztc.*`),
@@ -150,6 +152,26 @@ export declare function choosesPermissions(id: AgentCliId, words: readonly strin
150
152
  * by flag or override. Words after `--` are the opening prompt. Only the person starts a CLI so (see openAgentPane).
151
153
  */
152
154
  export declare function bypassWord(id: AgentCliId, words: readonly string[]): string | null;
155
+ /**
156
+ * Why an agent can't pass WORD: a flag not among AGENT_PANE_OPTIONS ('flag'), one of them without a value of its own
157
+ * after it ('value'), or the first word the CLI reads as a command when it names one ('command').
158
+ */
159
+ export interface AgentLaunchRefusal {
160
+ word: string;
161
+ why: 'flag' | 'value' | 'command';
162
+ }
163
+ /**
164
+ * The first of an agent's words for the CLI that it may not pass, or null. Its words are AGENT_PANE_OPTIONS' flags, a
165
+ * long one joined to its value by `=` or each followed by it, and prompt text. The first word that is neither a flag nor
166
+ * a flag's value is one the CLI takes for a command of its own when it is named like one (COMMAND_WORD), so an agent can't
167
+ * pass that: in Codex before `--`, after which every word is its prompt; in Claude Code, which reads it even after `--`,
168
+ * anywhere, the prompt ZTC passes after its own `--` too when no word came before it. Both CLIs read flags after prompt
169
+ * text as flags, so the words after it are checked as before it. A value that is missing, or starts with `-`, leaves the
170
+ * CLI to take whatever follows for it, so it is refused too.
171
+ */
172
+ export declare function agentLaunchRefusal(id: AgentCliId, request: AgentLaunchRequest): AgentLaunchRefusal | null;
173
+ /** What an agent is told when it can't pass the CLI REFUSAL's word (agentLaunchRefusal). */
174
+ export declare function agentLaunchRefusalMessage(id: AgentCliId, refusal: AgentLaunchRefusal): string;
153
175
  /** Where the CLI runs, as far as its bypass flag cares: this process's user, platform and environment by default. */
154
176
  export interface PermissionHost {
155
177
  uid?: number;
@@ -10,7 +10,9 @@
10
10
  * In the panes the person opens, ZTC starts both without their permission
11
11
  * prompts (Claude Code's --dangerously-skip-permissions, Codex's
12
12
  * --dangerously-bypass-approvals-and-sandbox) unless their own arguments choose
13
- * how the CLI asks, or `panes.agentPermissions` says ask; an agent's panes ask.
13
+ * how the CLI asks, or `panes.agentPermissions` says ask; an agent's panes ask,
14
+ * and of the CLI's own words an agent may pass only those that can't change
15
+ * how (agentLaunchRefusal).
14
16
  *
15
17
  * What ZTC adds is a session-scoped MCP server, `ztc workspace-mcp`, passed on
16
18
  * the command line (Claude Code `--mcp-config`, Codex `-c mcp_servers.ztc.*`),
@@ -462,6 +464,99 @@ export function bypassWord(id, words) {
462
464
  }
463
465
  return null;
464
466
  }
467
+ /**
468
+ * The flags an agent may pass the CLI of a pane it opens, besides its prompt: none can change how the CLI asks before it
469
+ * runs commands, so the person's own settings for the CLI decide (`claude --help` 2.1.328, `codex --help` 0.170.0).
470
+ * Claude Code's model and effort, a session to continue, resume, fork or name, and --verbose; Codex's model and
471
+ * --no-alt-screen. Every other flag is the person's to pass: those that choose permissions, a permission mode or who
472
+ * answers prompts, tools (--allowedTools, --tools), settings (--settings, --setting-sources), directories (--add-dir,
473
+ * Codex's -C), MCP servers (--mcp-config), agents, plugins and hooks (--agents, --plugin-dir, --bare), print mode (-p,
474
+ * which skips the workspace trust dialog), and Codex's approval policy (-a), sandbox (-s), overrides (-c, --enable), profile
475
+ * (-p), --full-auto, --yolo, web search with no approval per call (--search) and every --dangerously-*; and any flag
476
+ * a later CLI adds.
477
+ */
478
+ const AGENT_PANE_OPTIONS = Object.freeze({
479
+ claude: [
480
+ { names: ['--model'], value: 'required' },
481
+ { names: ['--effort'], value: 'required' },
482
+ { names: ['--fallback-model'], value: 'required' },
483
+ { names: ['-n', '--name'], value: 'required' },
484
+ { names: ['-c', '--continue'], value: 'none' },
485
+ { names: ['-r', '--resume'], value: 'optional' },
486
+ { names: ['--fork-session'], value: 'none' },
487
+ { names: ['--verbose'], value: 'none' },
488
+ ],
489
+ codex: [
490
+ { names: ['-m', '--model'], value: 'required' },
491
+ { names: ['--no-alt-screen'], value: 'none' },
492
+ ],
493
+ });
494
+ /**
495
+ * A word a CLI could read as one of its own commands: lowercase letters, digits and hyphens, starting with a letter, as
496
+ * every command of either is named (`claude update`, `claude mcp`, `codex apply`, `codex exec`), and any a later one adds.
497
+ */
498
+ const COMMAND_WORD = /^[a-z][a-z0-9-]*$/;
499
+ /**
500
+ * The first of an agent's words for the CLI that it may not pass, or null. Its words are AGENT_PANE_OPTIONS' flags, a
501
+ * long one joined to its value by `=` or each followed by it, and prompt text. The first word that is neither a flag nor
502
+ * a flag's value is one the CLI takes for a command of its own when it is named like one (COMMAND_WORD), so an agent can't
503
+ * pass that: in Codex before `--`, after which every word is its prompt; in Claude Code, which reads it even after `--`,
504
+ * anywhere, the prompt ZTC passes after its own `--` too when no word came before it. Both CLIs read flags after prompt
505
+ * text as flags, so the words after it are checked as before it. A value that is missing, or starts with `-`, leaves the
506
+ * CLI to take whatever follows for it, so it is refused too.
507
+ */
508
+ export function agentLaunchRefusal(id, request) {
509
+ let read = false;
510
+ const operand = (word) => {
511
+ if (read)
512
+ return null;
513
+ read = true;
514
+ return COMMAND_WORD.test(word) ? { word, why: 'command' } : null;
515
+ };
516
+ const words = request.words;
517
+ for (let i = 0; i < words.length; i++) {
518
+ const word = words[i];
519
+ if (word === '--') {
520
+ if (id === 'codex')
521
+ return null;
522
+ return operand(words[i + 1] ?? request.prompt ?? '');
523
+ }
524
+ if (!word.startsWith('-')) {
525
+ const refused = operand(word);
526
+ if (refused)
527
+ return refused;
528
+ continue;
529
+ }
530
+ const equals = word.startsWith('--') ? word.indexOf('=') : -1;
531
+ const option = AGENT_PANE_OPTIONS[id].find(candidate => candidate.names.includes(equals === -1 ? word : word.slice(0, equals)));
532
+ if (!option || (equals !== -1 && option.value === 'none'))
533
+ return { word, why: 'flag' };
534
+ if (equals !== -1 || option.value === 'none')
535
+ continue;
536
+ const next = words[i + 1];
537
+ const given = next !== undefined && !next.startsWith('-');
538
+ if (option.value === 'required' && !given)
539
+ return { word, why: 'value' };
540
+ if (given)
541
+ i++;
542
+ }
543
+ return id === 'claude' ? operand(request.prompt ?? '') : null;
544
+ }
545
+ /** What an agent is told when it can't pass the CLI REFUSAL's word (agentLaunchRefusal). */
546
+ export function agentLaunchRefusalMessage(id, refusal) {
547
+ const label = AGENT_CLIS[id].label;
548
+ // Each CLI's list has more than one flag.
549
+ const names = AGENT_PANE_OPTIONS[id].map(option => option.names.join('/'));
550
+ const allowed = `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`;
551
+ const why = refusal.why === 'flag'
552
+ ? `: of ${label}'s own words an agent may pass only ${allowed}, and its prompt, which leave how it asks to its own settings; `
553
+ + 'only the person can pass any other.'
554
+ : refusal.why === 'value'
555
+ ? ` without a value of its own after it (${refusal.word} <value>), so ${label} would take the next word for one.`
556
+ : ` as the first word ${label} reads, where a word of lowercase letters, digits and hyphens alone may be one of its own `
557
+ + `commands, which run without asking; ${id === 'codex' ? 'put a prompt after --, or ' : ''}write the task in more than one word.`;
558
+ return `An agent can't open ${label} with ${refusal.word}${why} Without it, ${label} asks before it runs commands, as its own settings say.`;
559
+ }
465
560
  /**
466
561
  * Why the CLI would refuse its bypass flag here, or null. Claude Code exits at once when started with
467
562
  * --dangerously-skip-permissions as root, unless IS_SANDBOX=1 or CLAUDE_CODE_BUBBLEWRAP marks a sandbox (2.1.323's
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import type { PaneCommandTransport } from '../ui/ratatui/pane_relay.js';
10
10
  import { type SplitDirection } from '../ui/ratatui/protocol.js';
11
- import { type AgentCliId, type AgentLaunchRequest, type PaneProgram } from './agent_cli.js';
11
+ import { type AgentCliId, type AgentLaunchRequest, type AgentPermissions, type PaneProgram } from './agent_cli.js';
12
12
  /** Request ids of agent pane launches start with this, so the overseer can tell them apart. */
13
13
  export declare const AGENT_PANE_REQUEST_PREFIX = "agent-pane:";
14
14
  /** Which agent CLI a `create_pane` request id launched, if any. */
@@ -47,7 +47,8 @@ export interface OpenAgentPaneOptions {
47
47
  * Who asked for the pane. The person: their own /claude or /codex, ZTC's menus and splits, Ctrl+B c. An agent: the
48
48
  * ztc_command tool running /claude or /codex, or workspace-mcp's open_pane. Only a pane the person opens starts
49
49
  * without permission prompts (panes.agentPermissions); one an agent opens asks as the CLI's own settings say, and
50
- * an agent's own flag that skips every permission check is refused (bypassWord).
50
+ * of the CLI's own words an agent may pass only those that can't change how it asks (agentLaunchRefusal): a flag
51
+ * that skips every permission check is refused saying so (bypassWord), and so is every other.
51
52
  */
52
53
  openedBy: AgentPaneOpener;
53
54
  }
@@ -63,6 +64,15 @@ export interface OpenAgentPaneResult {
63
64
  /** The permission flag ZTC started the CLI with, ahead of the person's own words (permissionDefaultArgs), if any. */
64
65
  permissionArgs?: string[];
65
66
  }
67
+ /**
68
+ * panes.agentPermissions for a Claude Code or Codex pane the person opens, here or as the desktop app's native pane
69
+ * (desktop_wiring.ts): 'ask' when this process's settings say so, or config.json does as it is saved now
70
+ * (agentPermissionsSetting reads each). Every ZTC pane is its own process and reads the profile again only every few
71
+ * seconds, so another pane's 'ask' may not have reached this one yet; neither setting can turn the other's ask into
72
+ * bypass. A config.json that can't be read leaves this process's setting to decide. Where the host pinned the
73
+ * session's permission profile and sandbox (ZTC_PERMISSION_PROFILE_PINNED), no saved setting gives a pane bypass: 'ask'.
74
+ */
75
+ export declare function personPanePermissions(): Promise<AgentPermissions>;
66
76
  /** Open the user's own `claude` or `codex` in a new pane, attached to this workspace. */
67
77
  /**
68
78
  * What a Claude Code or Codex session sets for the commands it runs, present in `env`. A ZTC started from inside one
@@ -139,19 +149,32 @@ export interface AgentPaneAnswerRead {
139
149
  }
140
150
  /** The bus message text that carries ANSWER, which formatAgentPaneMessage types in as Main's answer. */
141
151
  export declare function agentPaneAnswerText(answer: AgentPaneAnswer): string;
152
+ /** The longest sender name, or pane id, typed into an agent pane, in characters; a longer one is cut there and ends "…". */
153
+ export declare const AGENT_PANE_SENDER_MAX_CHARS = 64;
142
154
  /**
143
155
  * What Main's model reads right after a message an agent pane (Claude Code, Codex) sent it, which the transcript leaves
144
156
  * out: who sent it, that Main's answer, the text the model writes in the turn, goes back to that pane when the turn
145
157
  * ends, and, when the model's send_message reaches that pane at all (HELD_SENDS: not a colony cell's, which reaches the
146
- * colony), that a message the model sends the pane during the turn follows the answer.
158
+ * colony), that a message the model sends the pane during the turn follows the answer. The sender is named as what is
159
+ * typed into a pane names it (typedSender), in one line.
147
160
  */
148
161
  export declare function agentPaneNoteForModel(from: PaneMessage['from'], heldSends?: boolean): string;
149
162
  /**
150
163
  * A bus message as it is typed into an agent pane: one line, saying who sent
151
164
  * it and, for a question or request, how to answer; Main's answer at the end
152
- * of a turn (agentPaneAnswerText) says it is one.
165
+ * of a turn (agentPaneAnswerText) says it is one. Who sent it is named by
166
+ * typedSender: a pane's name is its own to choose, and nothing in it ends
167
+ * the line or ZTC's header.
153
168
  */
154
169
  export declare function formatAgentPaneMessage(message: PaneMessage): string;
170
+ /**
171
+ * A bus message as it is typed into a pane that is not a Claude Code or Codex pane, a ZTC pane above all, while no
172
+ * mirror runs to carry it on a bus: "[Message from <name>]: <text>", one line, which the pane submits as its own typing.
173
+ * Who sent it is named by typedSender, and its text is made one line by asOneLine, as formatAgentPaneMessage's is: a
174
+ * line break submits what came before it, so a line of it would reach the pane on its own, as the person's (a slash
175
+ * command among them), and an ESC sequence or Ctrl+C would reach a program that isn't reading a paste as a key.
176
+ */
177
+ export declare function formatTypedPaneMessage(message: PaneMessage): string;
155
178
  /** Delay between typed text and its Enter for programs that read a burst of input as a paste. */
156
179
  export declare const TYPED_ENTER_DELAY_MS = 120;
157
180
  /** Resolves once nothing is being typed into a pane through TRANSPORT (typeLineIntoPane), or after MAX_MS. */