@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.
- package/README.md +629 -167
- package/RUST_THIRD_PARTY_LICENSES.txt +5 -5
- package/bin/zmux-darwin-arm64 +0 -0
- package/bin/zmux-linux-x64 +0 -0
- package/bin/ztc-audio-darwin-arm64 +0 -0
- package/bin/ztc-capture-darwin-arm64 +0 -0
- package/bin/ztc-computer-darwin-arm64 +0 -0
- package/bin/ztc-llm-darwin-arm64 +0 -0
- package/bin/ztc-tts-darwin-arm64 +0 -0
- package/bin/ztc-tui-darwin-arm64 +0 -0
- package/bin/ztc-tui-linux-x64 +0 -0
- package/bin/zterm-darwin-arm64 +2 -2
- package/dist/App.js +6 -1
- package/dist/agent/agent.d.ts +21 -15
- package/dist/agent/agent.js +389 -163
- package/dist/agent/backends/codex_app_server.d.ts +7 -1
- package/dist/agent/backends/codex_app_server.js +11 -1
- package/dist/agent/backends/gemini.js +22 -8
- package/dist/agent/commands/batch.js +8 -0
- package/dist/agent/commands/config.js +10 -0
- package/dist/agent/commands/environment.js +5 -5
- package/dist/agent/commands/goal.d.ts +1 -0
- package/dist/agent/commands/goal.js +2 -1
- package/dist/agent/commands/index.js +2 -1
- package/dist/agent/commands/manifest.js +4 -0
- package/dist/agent/commands/optimize.js +5 -2
- package/dist/agent/commands/pane_cli.d.ts +29 -0
- package/dist/agent/commands/pane_cli.js +303 -0
- package/dist/agent/commands/settings.js +13 -3
- package/dist/agent/commands/shannon.js +8 -0
- package/dist/agent/commands/update.js +15 -3
- package/dist/agent/commands/zerg.js +31 -1
- package/dist/agent/commands/ztc_pane.js +3 -1
- package/dist/agent/factory.d.ts +4 -0
- package/dist/agent/factory.js +11 -1
- package/dist/agent/loop_policy.d.ts +42 -5
- package/dist/agent/loop_policy.js +206 -3
- package/dist/agent/runtime/command_jobs.d.ts +5 -0
- package/dist/agent/runtime/command_jobs.js +241 -31
- package/dist/agent/runtime/command_wait.d.ts +2 -0
- package/dist/agent/runtime/command_wait.js +1 -0
- package/dist/agent/runtime/done_report.d.ts +18 -0
- package/dist/agent/runtime/done_report.js +130 -0
- package/dist/agent/runtime/execution_context.js +4 -1
- package/dist/agent/runtime/failure_cause.d.ts +2 -0
- package/dist/agent/runtime/failure_cause.js +35 -0
- package/dist/agent/runtime/policy.d.ts +14 -2
- package/dist/agent/runtime/policy.js +104 -12
- package/dist/agent/runtime/quiet_job.d.ts +18 -0
- package/dist/agent/runtime/quiet_job.js +48 -0
- package/dist/agent/runtime/recovery.d.ts +1 -5
- package/dist/agent/runtime/recovery.js +2 -44
- package/dist/agent/runtime/tool_runtime.d.ts +1 -0
- package/dist/agent/runtime/tool_runtime.js +2 -0
- package/dist/agent/subagent.js +6 -1
- package/dist/agent/tools/deferred.js +1 -0
- package/dist/agent/tools/index.d.ts +2 -0
- package/dist/agent/tools/index.js +1 -0
- package/dist/agent/tools/outcome.d.ts +15 -0
- package/dist/agent/tools/outcome.js +107 -0
- package/dist/agent/tools/pane.d.ts +2 -1
- package/dist/agent/tools/pane.js +21 -3
- package/dist/agent/tools/registry.js +2 -0
- package/dist/agent/tools/shell.d.ts +1 -0
- package/dist/agent/tools/shell.js +128 -17
- package/dist/agent/tools/sim_domain_tools.js +4 -2
- package/dist/agent/tools/supervision.js +4 -2
- package/dist/agent/tools/types.d.ts +3 -0
- package/dist/app/command_context.js +5 -9
- package/dist/app/conversation_compaction.d.ts +4 -2
- package/dist/app/conversation_compaction.js +16 -5
- package/dist/app/headless_shell_mode.d.ts +14 -0
- package/dist/app/headless_shell_mode.js +7 -0
- package/dist/app/hosted_resident.d.ts +356 -0
- package/dist/app/hosted_resident.js +677 -0
- package/dist/app/restart.js +11 -2
- package/dist/app/session_manager.d.ts +5 -0
- package/dist/app/session_manager.js +21 -6
- package/dist/app/session_messages.js +6 -6
- package/dist/app/workspace_layout_controller.js +7 -0
- package/dist/batch/worktree.d.ts +10 -0
- package/dist/batch/worktree.js +15 -0
- package/dist/bench/registry.js +4 -2
- package/dist/cli_args.js +1 -1
- package/dist/cli_main.js +80 -10
- package/dist/cli_ratatui.d.ts +75 -0
- package/dist/cli_ratatui.js +485 -84
- package/dist/components/InputArea.js +4 -4
- package/dist/config/execution.d.ts +10 -0
- package/dist/config/execution.js +10 -0
- package/dist/config/hosted_runtime.d.ts +4 -1
- package/dist/config/hosted_runtime.js +4 -1
- package/dist/config/permission_pin.d.ts +34 -2
- package/dist/config/permission_pin.js +52 -2
- package/dist/config/person_command_policy.d.ts +38 -0
- package/dist/config/person_command_policy.js +11 -0
- package/dist/config/profiles.d.ts +21 -0
- package/dist/config/profiles.js +56 -2
- package/dist/config/types.d.ts +4 -1
- package/dist/config.js +34 -19
- package/dist/desktop/daily/codex_exec_adapter.js +7 -2
- package/dist/desktop/daily/desktop_wiring.d.ts +7 -1
- package/dist/desktop/daily/desktop_wiring.js +11 -3
- package/dist/desktop/daily/recipes.js +20 -4
- package/dist/desktop/health.d.ts +24 -0
- package/dist/desktop/health.js +151 -0
- package/dist/desktop/native_dialogs.d.ts +37 -0
- package/dist/desktop/native_dialogs.js +105 -0
- package/dist/diagnostics/session_export.d.ts +1 -0
- package/dist/diagnostics/session_export.js +28 -0
- package/dist/embedded/registry.js +4 -2
- package/dist/emulation/tool_adapters.js +9 -4
- package/dist/emulation/ztc_addendum.js +3 -0
- package/dist/headless.d.ts +11 -4
- package/dist/headless.js +99 -34
- package/dist/headless_approval.d.ts +6 -0
- package/dist/headless_cli.js +1 -1
- package/dist/hooks/runner.js +7 -6
- package/dist/library.d.ts +4 -0
- package/dist/library.js +3 -0
- package/dist/mcp/client.js +3 -3
- package/dist/modes/registry.js +13 -4
- package/dist/onboarding/setup_environment.js +13 -1
- package/dist/optimize/adapters/kernelbench.js +88 -10
- package/dist/optimize/adapters/types.d.ts +5 -0
- package/dist/optimize/executor.js +21 -0
- package/dist/panes/cli_install.d.ts +54 -0
- package/dist/panes/cli_install.js +157 -0
- package/dist/panes/model_catalog.js +3 -0
- package/dist/panes/new_pane_choices.d.ts +6 -2
- package/dist/panes/new_pane_choices.js +24 -12
- package/dist/panes/pane_cli_launch.d.ts +50 -0
- package/dist/panes/pane_cli_launch.js +124 -0
- package/dist/panes/pane_clis.d.ts +171 -0
- package/dist/panes/pane_clis.js +325 -0
- package/dist/panes/person_only_panes.d.ts +45 -0
- package/dist/panes/person_only_panes.js +117 -0
- package/dist/plugin/simulation_living.js +0 -2
- package/dist/plugin/simulation_living_engine.d.ts +1 -0
- package/dist/plugin/simulation_living_engine.js +1 -0
- package/dist/plugin/simulation_living_labels.d.ts +3 -0
- package/dist/plugin/simulation_living_labels.js +2 -0
- package/dist/router_auth.js +12 -1
- package/dist/session.js +26 -1
- package/dist/simulation/art/gemini_image.js +11 -5
- package/dist/simulation/domains/loader.js +25 -3
- package/dist/simulation/living/cold.d.ts +23 -0
- package/dist/simulation/living/cold.js +41 -0
- package/dist/simulation/living/context.d.ts +591 -1283
- package/dist/simulation/living/context.js +378 -244
- package/dist/simulation/living/contradictions.d.ts +14 -0
- package/dist/simulation/living/contradictions.js +282 -0
- package/dist/simulation/living/core/ids.d.ts +53 -0
- package/dist/simulation/living/core/ids.js +39 -0
- package/dist/simulation/living/core/kind.d.ts +20 -0
- package/dist/simulation/living/core/kind.js +15 -0
- package/dist/simulation/living/core/laws.d.ts +179 -0
- package/dist/simulation/living/core/laws.js +184 -0
- package/dist/simulation/living/core/ops.d.ts +257 -0
- package/dist/simulation/living/core/ops.js +34 -0
- package/dist/simulation/living/definer.d.ts +17 -1
- package/dist/simulation/living/definer.js +130 -51
- package/dist/simulation/living/definition.d.ts +174 -65
- package/dist/simulation/living/definition.js +287 -180
- package/dist/simulation/living/director.d.ts +80 -0
- package/dist/simulation/living/director.js +363 -0
- package/dist/simulation/living/frame.d.ts +108 -21
- package/dist/simulation/living/frame.js +111 -66
- package/dist/simulation/living/identifiers.d.ts +0 -1
- package/dist/simulation/living/identifiers.js +0 -3
- package/dist/simulation/living/index.d.ts +18 -9
- package/dist/simulation/living/index.js +18 -9
- package/dist/simulation/living/inference.d.ts +92 -50
- package/dist/simulation/living/inference.js +319 -175
- package/dist/simulation/living/knowledge.d.ts +28 -0
- package/dist/simulation/living/knowledge.js +73 -0
- package/dist/simulation/living/library.json +1177 -0
- package/dist/simulation/living/mechanics.d.ts +31 -34
- package/dist/simulation/living/mechanics.js +222 -138
- package/dist/simulation/living/model-input.d.ts +6 -3
- package/dist/simulation/living/model-input.js +18 -26
- package/dist/simulation/living/open-world.d.ts +74 -94
- package/dist/simulation/living/open-world.js +151 -30
- package/dist/simulation/living/phrases.d.ts +3 -0
- package/dist/simulation/living/phrases.js +37 -0
- package/dist/simulation/living/phrases.json +560 -0
- package/dist/simulation/living/projection.d.ts +316 -2
- package/dist/simulation/living/projection.js +50 -2
- package/dist/simulation/living/prompts/example-spec.json +11 -0
- package/dist/simulation/living/prompts/role-text.json +14 -0
- package/dist/simulation/living/prompts.d.ts +5 -0
- package/dist/simulation/living/prompts.js +275 -0
- package/dist/simulation/living/recall.d.ts +2 -2
- package/dist/simulation/living/reduce.d.ts +51 -14
- package/dist/simulation/living/reduce.js +941 -579
- package/dist/simulation/living/replay.d.ts +5 -4
- package/dist/simulation/living/replay.js +10 -9
- package/dist/simulation/living/runtime.d.ts +135 -25
- package/dist/simulation/living/runtime.js +1641 -583
- package/dist/simulation/living/scale.d.ts +96 -0
- package/dist/simulation/living/scale.js +124 -0
- package/dist/simulation/living/script.d.ts +5 -0
- package/dist/simulation/living/script.js +115 -0
- package/dist/simulation/living/shared-kinds.d.ts +4 -11
- package/dist/simulation/living/shared-kinds.js +11 -81
- package/dist/simulation/living/space.d.ts +14 -0
- package/dist/simulation/living/space.js +132 -0
- package/dist/simulation/living/state.d.ts +100 -0
- package/dist/simulation/living/state.js +393 -0
- package/dist/simulation/living/types.d.ts +829 -512
- package/dist/simulation/living/types.js +162 -187
- package/dist/simulation/living/world-rules.d.ts +100 -0
- package/dist/simulation/living/world-rules.js +267 -0
- package/dist/simulation/plugins/loader.js +11 -0
- package/dist/skills/loader.js +4 -0
- package/dist/tools.d.ts +1 -0
- package/dist/tools.js +1 -0
- package/dist/ui/ratatui/headless_pane_manager.d.ts +4 -1
- package/dist/ui/ratatui/headless_pane_manager.js +13 -9
- package/dist/ui/ratatui/pane_relay.js +29 -0
- package/dist/ui/ratatui/pane_type.d.ts +10 -0
- package/dist/ui/ratatui/pane_type.js +11 -0
- package/dist/ui/ratatui/process.d.ts +30 -0
- package/dist/ui/ratatui/process.js +133 -19
- package/dist/ui/ratatui/protocol.d.ts +124 -2
- package/dist/ui/ratatui/protocol.js +35 -0
- package/dist/ui/ratatui/relay_policy.js +3 -0
- package/dist/ui/ratatui/ztc_launch_trust.d.ts +2 -1
- package/dist/ui/ratatui/ztc_launch_trust.js +8 -1
- package/dist/ui/terminal_image.d.ts +12 -0
- package/dist/ui/terminal_image.js +21 -1
- package/dist/utils/codex_project_trust.d.ts +19 -0
- package/dist/utils/codex_project_trust.js +37 -0
- package/dist/utils/compaction.js +103 -20
- package/dist/utils/git_program_files.d.ts +19 -12
- package/dist/utils/git_program_files.js +411 -83
- package/dist/utils/host_shell.d.ts +10 -1
- package/dist/utils/host_shell.js +14 -1
- package/dist/utils/mid_turn_compaction.d.ts +2 -0
- package/dist/utils/mid_turn_compaction.js +2 -0
- package/dist/utils/models.js +6 -1
- package/dist/utils/sandbox.d.ts +109 -8
- package/dist/utils/sandbox.js +981 -187
- package/dist/utils/shell.d.ts +2 -0
- package/dist/utils/shell.js +10 -4
- package/dist/utils/subprocess_env.d.ts +47 -11
- package/dist/utils/subprocess_env.js +107 -15
- package/dist/utils/system_ps.d.ts +8 -0
- package/dist/utils/system_ps.js +39 -7
- package/dist/utils/unattended_compaction.d.ts +9 -0
- package/dist/utils/unattended_compaction.js +13 -0
- package/dist/utils/ztc_own_state.d.ts +8 -5
- package/dist/utils/ztc_own_state.js +17 -11
- package/dist/web/mirror_client.js +1 -0
- package/dist/web/mirror_stream.d.ts +50 -6
- package/dist/web/mirror_stream.js +160 -15
- package/dist/workflows/registry.js +3 -1
- package/dist/workspace/controller.js +12 -0
- package/dist/workspace_collision.d.ts +3 -0
- package/dist/workspace_collision.js +14 -1
- package/dist/workspace_session_context.js +2 -1
- package/dist/zlm-embed.mjs +3823 -1970
- package/node_modules/@zerg/model-contracts/README.md +16 -4
- package/node_modules/@zerg/model-contracts/index.js +6 -1
- package/npm-shrinkwrap.json +1 -1
- package/package.json +42 -24
- package/packages/model-contracts/README.md +16 -4
- package/packages/model-contracts/index.js +6 -1
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import type { CommandContext } from '../agent/commands/types.js';
|
|
2
|
+
import type { EvidenceSnapshot } from '../agent/runtime/evidence.js';
|
|
3
|
+
import type { PaneCommandTransport } from '../ui/ratatui/pane_relay.js';
|
|
4
|
+
import type { RustCommand } from '../ui/ratatui/protocol.js';
|
|
5
|
+
import type { MirrorAuthDecision } from '../web/mirror_authenticator.js';
|
|
6
|
+
import type { MirrorMuxCommand } from '../web/mirror_stream.js';
|
|
7
|
+
/**
|
|
8
|
+
* The slash commands a hosted resident runs for its controllers. Each handler only reads this session's state or
|
|
9
|
+
* changes its conversation, and none starts a process, writes outside ZTC's session state, fetches a URL the
|
|
10
|
+
* controller names, prints a token, writes config or an account, restarts ZTC or changes the permission profile:
|
|
11
|
+
* - /clear empties the conversation, its todos and queue (clearMessages, clearTransientState);
|
|
12
|
+
* - /compact summarizes the conversation in place, with the route's own key or locally;
|
|
13
|
+
* - /context prints the context window's use;
|
|
14
|
+
* - /help lists the commands;
|
|
15
|
+
* - /status prints the route, readiness and execution facts, keys masked;
|
|
16
|
+
* - /usage prints retained usage records and Router's own limits for the route's sign-in.
|
|
17
|
+
*/
|
|
18
|
+
export declare const HOSTED_RESIDENT_CONTROLLER_COMMANDS: ReadonlySet<string>;
|
|
19
|
+
/**
|
|
20
|
+
* What a hosted resident says when a prompt finds its model route without a key. It never puts up the missing-key
|
|
21
|
+
* chooser, whose answers save a key (or the name of a variable to read one from) to config.json: its controllers would
|
|
22
|
+
* answer it.
|
|
23
|
+
*/
|
|
24
|
+
export declare const HOSTED_RESIDENT_NO_MODEL_ROUTE: string;
|
|
25
|
+
/** Why a controller's /<cmd> does not run on a hosted resident, or null when it is one of the six above. */
|
|
26
|
+
export declare function hostedResidentCommandRefusal(cmd: string): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* The command context a hosted resident's commands run with: the one the app builds, less what its controllers'
|
|
29
|
+
* commands could otherwise do on the host. It pins no command pane (/job pins commands that run on the host), opens
|
|
30
|
+
* no environment, and its shell (/shell, ! and /cd) is the stub, which runs nothing.
|
|
31
|
+
*/
|
|
32
|
+
export declare function hostedResidentCommandContext(context: CommandContext, stubShell: CommandContext['shell']): CommandContext;
|
|
33
|
+
/**
|
|
34
|
+
* The agent tools a hosted resident's agent goes without: the ZergAI platform's zerg_* tools. zerg_list, zerg_query and
|
|
35
|
+
* zerg_task_status reach the platform API (configStore.getApiBaseUrl) with ZTC's platform login: under the image's
|
|
36
|
+
* default tier that API is http://localhost:8000, where any tool child can listen, and a hosted resident's host gives it
|
|
37
|
+
* no platform login (its route is a Router grant), while the one an earlier entrypoint derived from that grant went
|
|
38
|
+
* there with zerg_list. zerg_watch reads the Mini-ZDE connection /zerg sets up. A ZeP service zerg's agent works in its
|
|
39
|
+
* workspace and lists, queries and drives no platform zergs, so its tool set leaves out every tool named zerg_*, the
|
|
40
|
+
* platform's four and any a plugin or MCP server would add under that name; the agent keeps every other tool.
|
|
41
|
+
*/
|
|
42
|
+
export declare const HOSTED_RESIDENT_WITHHELD_TOOL_PREFIX = "zerg_";
|
|
43
|
+
/** `tools` less the ones a hosted resident's agent goes without (HOSTED_RESIDENT_WITHHELD_TOOL_PREFIX), in order. */
|
|
44
|
+
export declare function hostedResidentAgentTools<T extends {
|
|
45
|
+
definition: {
|
|
46
|
+
name: string;
|
|
47
|
+
};
|
|
48
|
+
}>(tools: readonly T[]): T[];
|
|
49
|
+
/**
|
|
50
|
+
* The slash commands a hosted resident's agent does not run through ztc_command, whatever their arguments: the zerg_*
|
|
51
|
+
* tools' counterparts. /zerg lists, shows, creates, starts, stops and deletes the platform's zergs through the ZergAI
|
|
52
|
+
* platform API (configStore.getApiBaseUrl) with ZTC's platform login (apiRequest), and launches or connects the zerg
|
|
53
|
+
* service the rest of its family drives; /zergs is its list. One more reaches that API: /manifest load, which with no
|
|
54
|
+
* zerg connected lists the platform's pool for one with the same login (zergLoadManifestHandler), so it is refused too
|
|
55
|
+
* (hostedResidentAgentCommandRefusal). So is /debug headlines, whose smoke test switches ZTC to zerg mode and launches a
|
|
56
|
+
* local zerg service with /zerg launch's own code (zergLaunchLocal: `poetry --version`, then `poetry run zerg ...`, each
|
|
57
|
+
* with ZTC's environment). The rest of /manifest reads and writes manifests on the host, the rest of /debug toggles debug
|
|
58
|
+
* output, and like every other command they stay the agent's.
|
|
59
|
+
*/
|
|
60
|
+
export declare const HOSTED_RESIDENT_WITHHELD_AGENT_COMMANDS: ReadonlySet<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Why a hosted resident's agent does not run /`cmd` `args` through ztc_command, or null when it does: refused are /zerg
|
|
63
|
+
* and /zergs (HOSTED_RESIDENT_WITHHELD_AGENT_COMMANDS), /manifest load and /debug headlines, each named in any letter
|
|
64
|
+
* case and with any surrounding space (the app finds a command by its lower-cased name, and refusing more spellings than
|
|
65
|
+
* a handler takes costs nothing). The agent's slash commands are not its controllers', which hostedResidentCommandRefusal
|
|
66
|
+
* holds to six.
|
|
67
|
+
*/
|
|
68
|
+
export declare function hostedResidentAgentCommandRefusal(cmd: string, args: readonly string[]): string | null;
|
|
69
|
+
/** What the resident was launched with: its workspace (its working directory's real path) and its provider and model. */
|
|
70
|
+
export interface HostedResidentLaunch {
|
|
71
|
+
workspace: string;
|
|
72
|
+
provider: string;
|
|
73
|
+
model: string;
|
|
74
|
+
}
|
|
75
|
+
export interface HostedResidentPanes {
|
|
76
|
+
/** A pane's type as the mirror registered it ('ztc', 'process', 'command', ...), or undefined for no such pane. */
|
|
77
|
+
paneType(paneId: number): string | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* A directory's real path as the kernel resolves the path given (a link before the '..' that follows it), or null
|
|
80
|
+
* when it does not resolve to a directory.
|
|
81
|
+
*/
|
|
82
|
+
realDirectory(path: string): string | null;
|
|
83
|
+
/** How many ZTC panes are open besides pane 0, whoever opened them. */
|
|
84
|
+
ztcPaneCount(): number;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the resident opened this pane itself: for a controller's create_ztc_pane, or for its own callers (the
|
|
87
|
+
* busy-input chooser's separate task), never for its agent's tools. Only such a pane takes a controller's typing.
|
|
88
|
+
*/
|
|
89
|
+
openedByResident(paneId: number): boolean;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The most ZTC panes a hosted resident keeps open besides pane 0, whoever opens them. Each is a whole ZTC process that
|
|
93
|
+
* holds the launch's route credentials: about 140 MB resident apiece while idle, beside the resident's own 180 MB
|
|
94
|
+
* (measured on the real binary, 2026-11-20). A ZergCloud zerg's default machine has 1 GB (shared-cpu-2x), shared with
|
|
95
|
+
* the zerg service, so four panes and the resident (about 740 MB) fit and eight would not. Four still leaves room for
|
|
96
|
+
* the reviewer and fixer panes a pr-review-bot manifest opens. The agent's own shell and command panes stop at eight
|
|
97
|
+
* (pane.ts MAX_TERMINAL_PANES), and a hosted resident started --no-mux, as the runtime image starts one, has no panes.
|
|
98
|
+
*/
|
|
99
|
+
export declare const HOSTED_RESIDENT_MAX_ZTC_PANES = 4;
|
|
100
|
+
/** A ZTC pane a hosted resident opens: where it starts, and its own launch flags. */
|
|
101
|
+
export interface HostedResidentZtcPane {
|
|
102
|
+
/**
|
|
103
|
+
* The real directory the check approved, which the spawn is given as it is. The spawn's chdir resolves it again, so a
|
|
104
|
+
* directory swapped for a link in between would still lead elsewhere: the pane checks where it is as it starts
|
|
105
|
+
* (hostedResidentPaneStartRefusal).
|
|
106
|
+
*/
|
|
107
|
+
cwd: string;
|
|
108
|
+
/** --provider and --model: the launch's own, never inferred from what a controller named or left out. */
|
|
109
|
+
args: string[];
|
|
110
|
+
}
|
|
111
|
+
export type HostedResidentMuxDecision = {
|
|
112
|
+
ok: true;
|
|
113
|
+
ztcPane?: HostedResidentZtcPane;
|
|
114
|
+
} | {
|
|
115
|
+
ok: false;
|
|
116
|
+
error: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Whether a hosted resident runs a controller's mux command, and for a ZTC pane where it opens. Default deny: only
|
|
120
|
+
* layout commands, typing into or closing a ZTC pane, and a ZTC pane inside the workspace on the launch's own provider
|
|
121
|
+
* and model (at most HOSTED_RESIDENT_MAX_ZTC_PANES of them) run. A command or shell pane, restarting a pane (it reruns
|
|
122
|
+
* the pane's launch), closing pane 0 or the agent's own shell, Codex or Claude Code pane, and every persistent setting
|
|
123
|
+
* are refused. A ZTC pane opens in the real directory the check approved (see realPaneDirectory), which the spawn must
|
|
124
|
+
* take as given; the pane then checks where the spawn's chdir left it (hostedResidentPaneStartRefusal).
|
|
125
|
+
*/
|
|
126
|
+
export declare function hostedResidentMuxDecision(command: MirrorMuxCommand, launch: HostedResidentLaunch, panes: HostedResidentPanes): HostedResidentMuxDecision;
|
|
127
|
+
/**
|
|
128
|
+
* Why a hosted resident's mirror does not deliver input to a pane (a controller's write_pane, /pane-input, the bus
|
|
129
|
+
* fallback, /broadcast), or null when it does: only to one of its ZTC panes, never to pane 0 this way, and only to one
|
|
130
|
+
* the resident opened itself (`openedByResident`, see HostedResidentPanes), never one its agent opened with its own tools.
|
|
131
|
+
*/
|
|
132
|
+
export declare function hostedResidentPaneInputRefusal(paneId: number, paneType: string | undefined, openedByResident: boolean): string | null;
|
|
133
|
+
/**
|
|
134
|
+
* Whether a hosted resident's mirror delivers input to a pane (hostedResidentPaneInputRefusal). A pane no caller says
|
|
135
|
+
* the resident opened is taken as one it did not.
|
|
136
|
+
*/
|
|
137
|
+
export declare function hostedResidentPaneInputAllowed(paneId: number, paneType: string | undefined, openedByResident?: boolean): boolean;
|
|
138
|
+
/** The create_pane command a pane transport sends. */
|
|
139
|
+
export type HostedResidentCreatePane = Extract<RustCommand, {
|
|
140
|
+
type: 'create_pane';
|
|
141
|
+
}>;
|
|
142
|
+
/** What the resident makes of a ZTC pane its agent's tools asked for: the create_pane it sends instead, or why none. */
|
|
143
|
+
export type HostedResidentAgentZtcPane = {
|
|
144
|
+
ok: true;
|
|
145
|
+
command: HostedResidentCreatePane;
|
|
146
|
+
} | {
|
|
147
|
+
ok: false;
|
|
148
|
+
error: string;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Whether a hosted resident opens the ZTC pane its agent's tools asked for (a create_pane for a 'ztc' pane), held to
|
|
152
|
+
* the decision a controller's create_ztc_pane gets (hostedResidentMuxDecision): the pane's directory as the tool sent it,
|
|
153
|
+
* and every --provider and --model its arguments name, each the launch's own or refused. The tool's other arguments, its
|
|
154
|
+
* environment and its session are not the pane's: the resident starts it on its own launch (the decision's ztcPane), as
|
|
155
|
+
* it starts a controller's, and with no persona of the tool's (ZTC_SIM_PERSONA), which a controller's pane never has.
|
|
156
|
+
*/
|
|
157
|
+
export declare function hostedResidentAgentZtcPaneDecision(command: HostedResidentCreatePane, launch: HostedResidentLaunch, panes: HostedResidentPanes): HostedResidentMuxDecision;
|
|
158
|
+
/** Why a hosted resident opens no pane its agent asks for but a ZTC pane (hostedResidentAgentPaneTransport). */
|
|
159
|
+
export declare const HOSTED_RESIDENT_AGENT_PANES_ZTC_ONLY = "A hosted resident's agent opens only ZTC panes, as the resident's own: no shell, command or process pane, which would run outside its sandbox.";
|
|
160
|
+
/** Why a hosted resident relaunches no pane its agent asks it to (hostedResidentAgentPaneTransport). */
|
|
161
|
+
export declare const HOSTED_RESIDENT_AGENT_PANES_NO_RELAUNCH = "A hosted resident's agent relaunches no pane as another program (replace_pane), which would run outside its sandbox: it opens only ZTC panes, as the resident's own.";
|
|
162
|
+
/** Why a hosted resident's pane relay opens and relaunches no pane one of its ZTC panes asks for (hostedResidentRelayTransport). */
|
|
163
|
+
export declare const HOSTED_RESIDENT_RELAYED_PANES_REFUSED = "A hosted resident opens and relaunches no pane that one of its ZTC panes asks for through its pane relay: such a pane would start past the resident's own decision, and a shell, command or process pane outside its agent's sandbox.";
|
|
164
|
+
/**
|
|
165
|
+
* The pane transport a hosted resident gives its agent's pane tools in mux mode (setPaneToolsTuiProcess): `transport`,
|
|
166
|
+
* except for a create_pane. One for a ZTC pane, as the pane manager types it, named or not (create_ztc_pane,
|
|
167
|
+
* create_terminal_pane's ZTC launch, a supervision or simulation pane: every tool that opens one goes through here), is
|
|
168
|
+
* replaced by what `openZtcPane` makes of it, the pane the resident opens as it opens a controller's
|
|
169
|
+
* (hostedResidentAgentZtcPaneDecision, the resident's launch and pane environment). Any other (a shell, a command pane
|
|
170
|
+
* such as /codex's or /claude's, any process: a ZTC started without --pane or from a shell among them) is refused, since
|
|
171
|
+
* the pane manager runs it outside the agent's sandbox, as the resident's user, with network, until those panes run in
|
|
172
|
+
* that sandbox (ztc-11-2's process panes). A replace_pane, which relaunches a pane as the program it names, is refused
|
|
173
|
+
* the same way, whatever type it names: the agent's tools send none, and the pane manager would run it as it runs a
|
|
174
|
+
* create_pane's (ztc (2)'s F4). Refused, nothing is sent, and the tool hears why as the pane manager says an error, with
|
|
175
|
+
* its request id. Every other command, and every event, passes as it is.
|
|
176
|
+
*/
|
|
177
|
+
export declare function hostedResidentAgentPaneTransport(transport: PaneCommandTransport, openZtcPane: (command: HostedResidentCreatePane) => HostedResidentAgentZtcPane): PaneCommandTransport;
|
|
178
|
+
/**
|
|
179
|
+
* The pane transport a hosted resident's pane relay forwards what its ZTC panes send to, in mux mode: `transport` (the
|
|
180
|
+
* pane manager), except that it opens and relaunches no pane a ZTC pane asks for. A relayed create_pane or replace_pane,
|
|
181
|
+
* whatever its type, launch nonce or arguments, would start a pane past the decision the resident holds its agent's
|
|
182
|
+
* panes to (hostedResidentAgentPaneTransport): a shell, command or process pane outside the agent's sandbox, as the
|
|
183
|
+
* resident's user, with network, or a ZTC pane past its cap and without its pane environment (ztc (2)'s F4). A relayed
|
|
184
|
+
* create_doc_pane or create_feed_pane runs no program, but would open a pane past that decision too, and one the
|
|
185
|
+
* resident's controllers could not close (hostedResidentMuxDecision closes only its ZTC panes); a relayed restart_pane
|
|
186
|
+
* would relaunch a pane as it last ran, which the resident refuses its controllers as well. Refused, nothing is sent,
|
|
187
|
+
* and whoever listens (the relay, which tells its panes) hears why as the pane manager says an error, with the request
|
|
188
|
+
* id (a doc or feed pane's command and a restart name none, so their refusals name none). Every other command, and
|
|
189
|
+
* every event, passes as it is. The resident's relay is built over this only once landing step 3's --m3z-fixes wiring
|
|
190
|
+
* is in: F4, ztc (2)'s resolution of that merge (FOR-ZTC-DRIFT.md, pass 7c part 2b), builds cli_ratatui's
|
|
191
|
+
* PaneRelayServer over it on `this.hostedResident`. Until then (hub/m3-zergcloud alone) a mux hosted resident's relay
|
|
192
|
+
* forwards to the pane manager itself; with --no-mux (the go-live shape, which the entrypoint holds every hosted resident
|
|
193
|
+
* to) it starts no relay at all.
|
|
194
|
+
*/
|
|
195
|
+
export declare function hostedResidentRelayTransport(transport: PaneCommandTransport): PaneCommandTransport;
|
|
196
|
+
/** Whether a hosted resident types a bus message into a Claude Code or Codex pane: only one its own agent sends. */
|
|
197
|
+
export declare function hostedResidentAgentPaneMessageAllowed(fromMemberId: number): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Whether the mirror serves its debug log viewer (GET /debug/logs). Outside a hosted resident it follows the dev bar.
|
|
200
|
+
* A hosted resident's ring buffer holds what its controllers must not read back, so only ZTC_MIRROR_DEV_BAR=1 turns it
|
|
201
|
+
* on there.
|
|
202
|
+
*/
|
|
203
|
+
export declare function servesDebugLogs(options: {
|
|
204
|
+
devSystemBarEnabled: boolean;
|
|
205
|
+
hostedResident: boolean;
|
|
206
|
+
}, env?: NodeJS.ProcessEnv): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Why a hosted resident's mirror refuses a controller this route (403, or 403 to the /voice/stream upgrade), or null
|
|
209
|
+
* when the mirror serves it as it serves any controller:
|
|
210
|
+
* - the voice routes, outright;
|
|
211
|
+
* - /browse-dir, outright: it lists directories anywhere on the host;
|
|
212
|
+
* - the project file routes a view plugin may serve (/file-content, /project-tree, /companion/*), outright: ZeP ships
|
|
213
|
+
* no such plugin, and they read the host's files;
|
|
214
|
+
* - a write to /mirror/layout or /mirror/sfx, which save ZTC's own files (reading the saved layout stays);
|
|
215
|
+
* - the development and colony routes, unless ZTC_MIRROR_DEV_BAR=1 asks for them.
|
|
216
|
+
* A desktop or other mirror keeps them all: only a hosted resident applies this.
|
|
217
|
+
*/
|
|
218
|
+
export declare function hostedResidentRouteRefusal(method: string, pathname: string, env?: NodeJS.ProcessEnv): string | null;
|
|
219
|
+
/**
|
|
220
|
+
* Whether a hosted resident takes a zlicky capture upload: only for a capture its agent's zlicky_look asked the live
|
|
221
|
+
* view for (requestZlickyCapture issued the id and still waits on it), and only one upload for it. Any other upload
|
|
222
|
+
* would be a controller writing its own bytes into TMPDIR. `capture` is the mirror's record of the id: how many
|
|
223
|
+
* requests wait on it, and whether an upload for it is already being received; undefined when it issued none.
|
|
224
|
+
*/
|
|
225
|
+
export declare function hostedResidentTakesCapture(capture: {
|
|
226
|
+
waiting: number;
|
|
227
|
+
receiving: boolean;
|
|
228
|
+
} | undefined): boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Whether a hosted resident answers GET /zlicky/capture/<id> (where on the host a capture's file is kept, and its size)
|
|
231
|
+
* to `caller`, who the request came as (MirrorAuthDecision.source): only to ZTC itself, by its internal token, and to a
|
|
232
|
+
* pane's own credential, never to a controller's browser session (nor a caller an open mirror let in). Its agent gets
|
|
233
|
+
* the capture from requestZlickyCapture, in process.
|
|
234
|
+
*/
|
|
235
|
+
export declare function hostedResidentServesCaptureRead(caller: MirrorAuthDecision['source']): boolean;
|
|
236
|
+
/**
|
|
237
|
+
* What a hosted resident's mirror publishes to its controllers, and keeps for replay, of a tool's result (`result`, as
|
|
238
|
+
* `tool` returned it): the result as it is, except a zlicky_look result (a JSON object), without its png_path: where on
|
|
239
|
+
* the host the capture's file is kept. Its agent keeps the whole result, to read the file. With GET /zlicky/capture/<id>
|
|
240
|
+
* refused to them too (hostedResidentServesCaptureRead), and the agent's evidence ledger held to the same
|
|
241
|
+
* (hostedResidentPublishedEvidence), the mirror itself names no capture's file to a controller.
|
|
242
|
+
*/
|
|
243
|
+
export declare function hostedResidentPublishedToolResult(tool: string | undefined, result: string): string;
|
|
244
|
+
/**
|
|
245
|
+
* What a hosted resident's mirror publishes, and keeps for replay, of its agent's evidence ledger (`snapshot`): each
|
|
246
|
+
* tool observation's excerpt (that tool's result, as the ledger keeps it) held to hostedResidentPublishedToolResult, and
|
|
247
|
+
* the rest as it is. The agent's own ledger is not changed.
|
|
248
|
+
*/
|
|
249
|
+
export declare function hostedResidentPublishedEvidence(snapshot: EvidenceSnapshot): EvidenceSnapshot;
|
|
250
|
+
/**
|
|
251
|
+
* The variable a hosted resident names its workspace in (the real path it resolved) for each ZTC pane it opens: the pane
|
|
252
|
+
* starts only inside it (hostedResidentPaneStartRefusal).
|
|
253
|
+
*/
|
|
254
|
+
export declare const HOSTED_RESIDENT_WORKSPACE_ENV = "ZTC_RESIDENT_WORKSPACE";
|
|
255
|
+
/**
|
|
256
|
+
* What a hosted resident adds to the environment of a ZTC pane it opens: that pane runs no slash commands either, and
|
|
257
|
+
* with explicit discovery loads only the `extensionRoots` its launch named, as the resident resolved them at launch
|
|
258
|
+
* (hostedResidentExtensionRoots, one value for each *_PATHS variable), never a plugin found from its cwd, the
|
|
259
|
+
* repository or HOME, nor a root relative to its cwd, whatever the launcher exported. Otherwise a file the agent may
|
|
260
|
+
* write (a .ztc/plugin.yaml and its module) would run as code once a controller opened a pane, past a profile that
|
|
261
|
+
* grants the agent no shell. It also names the resident's real `workspace`, which the pane checks its own directory
|
|
262
|
+
* against as it starts. No root replaces those three settings.
|
|
263
|
+
*/
|
|
264
|
+
export declare function hostedResidentPaneEnv(workspace: string, extensionRoots?: Readonly<Record<string, string>>): Record<string, string>;
|
|
265
|
+
/** The variables whose roots explicit extension discovery honors, one per loader (extension_discovery.ts's callers). */
|
|
266
|
+
export declare const HOSTED_RESIDENT_EXTENSION_PATH_VARIABLES: readonly string[];
|
|
267
|
+
/**
|
|
268
|
+
* The extension roots a hosted resident's ZTC panes load from, as each pane's environment carries them (with explicit
|
|
269
|
+
* discovery, hostedResidentPaneEnv). For each variable: the roots the launch named, resolved once, at launch, as the
|
|
270
|
+
* resident's own loaders resolved them (a relative root against the launch's own directory, never against a pane's,
|
|
271
|
+
* which a controller chose), each to the real directory it was then. A root passes on only when it is a directory then,
|
|
272
|
+
* and neither as named nor as resolved the workspace, a directory in it, or one that holds it (whose scan can reach the
|
|
273
|
+
* workspace): a pane opened later would load what the agent wrote there since, as code, past a profile that grants the
|
|
274
|
+
* agent no shell. Every variable is set, empty when no root is left, so no pane inherits the launch's own value; and
|
|
275
|
+
* when the launch's discovery setting is not one ZTC reads, every one is empty.
|
|
276
|
+
*/
|
|
277
|
+
export declare function hostedResidentExtensionRoots(env: NodeJS.ProcessEnv, workspace: string, realDirectory: (path: string) => string | null): Record<string, string>;
|
|
278
|
+
/**
|
|
279
|
+
* Why a ZTC that a hosted resident started as one of its panes does not load this extension file, or null when it does:
|
|
280
|
+
* a manifest, include, template directory or module one of its seven loaders (plugins, modes, domains, bench, embedded
|
|
281
|
+
* systems, skills, workflows) found, under a root its launch named (hostedResidentExtensionRoots), a builtin one, or one
|
|
282
|
+
* a plugin added. Each root is outside the workspace, but a link in one (its .ztc, say, or a module a manifest names)
|
|
283
|
+
* may lead into it, where the agent writes, and the loaders follow it: so the pane loads no file whose real path
|
|
284
|
+
* (`realPath`, links followed) is the workspace its environment names or below it, nor one that does not resolve. A ZTC
|
|
285
|
+
* whose environment names no workspace is not such a pane and loads as it always has, resolving nothing; one that names
|
|
286
|
+
* no absolute workspace loads nothing (it does not start either: hostedResidentPaneStartRefusal).
|
|
287
|
+
*/
|
|
288
|
+
export declare function hostedResidentExtensionFileRefusal(env: NodeJS.ProcessEnv, path: string, realPath: (path: string) => string): string | null;
|
|
289
|
+
/**
|
|
290
|
+
* Why a hosted resident's ZTC pane does not run the module at `url` (an import or a require Node resolved, from whatever
|
|
291
|
+
* module: an extension's own, or one that module imports in turn), or null when it does. An extension's module is
|
|
292
|
+
* outside the workspace, but a link beside it (its lib/ or node_modules, say) may lead into the workspace, where the
|
|
293
|
+
* agent writes, and Node follows it: so a file is held to hostedResidentExtensionFileRefusal, by where it really is
|
|
294
|
+
* (`realPath`). Anything but a file (a builtin, a data: URL) runs, and so does every module of a ZTC whose environment
|
|
295
|
+
* names no workspace, resolving nothing.
|
|
296
|
+
*/
|
|
297
|
+
export declare function hostedResidentModuleRefusal(env: NodeJS.ProcessEnv, url: string, realPath: (path: string) => string): string | null;
|
|
298
|
+
/** A module resolve hook, as module.registerHooks takes one: what the next hook resolved `specifier` to, or a throw. */
|
|
299
|
+
export type HostedResidentResolveHook = (specifier: string, context: unknown, nextResolve: (specifier: string, context?: unknown) => {
|
|
300
|
+
url: string;
|
|
301
|
+
}) => {
|
|
302
|
+
url: string;
|
|
303
|
+
};
|
|
304
|
+
/** The hooks holdResidentPaneImports registers. */
|
|
305
|
+
export interface HostedResidentImportHooks {
|
|
306
|
+
resolve: HostedResidentResolveHook;
|
|
307
|
+
}
|
|
308
|
+
/** module.registerHooks, as holdResidentPaneImports uses it. */
|
|
309
|
+
export type HostedResidentRegisterHooks = (hooks: HostedResidentImportHooks) => unknown;
|
|
310
|
+
/**
|
|
311
|
+
* The hook a hosted resident's ZTC pane holds every module to, import or require: Node resolves each before it loads
|
|
312
|
+
* it, so a resolution to a module hostedResidentModuleRefusal refuses (on `env`, read each time) throws why, which
|
|
313
|
+
* runtimeDiag says too (the Logs ring, and stderr where no interactive renderer owns the screen), and the module is
|
|
314
|
+
* never loaded; any other goes on as the next hook resolved it. It holds a require too where
|
|
315
|
+
* a loader of TypeScript (tsx, say) loads CommonJS itself. There is no load hook: on Node 22 a synchronous load hook
|
|
316
|
+
* breaks every module such a loader's asynchronous hooks load (the default load hands back no source), and a resolution
|
|
317
|
+
* already names the file as the kernel resolves it.
|
|
318
|
+
*/
|
|
319
|
+
export declare function hostedResidentImportHooks(env: NodeJS.ProcessEnv, realPath: (path: string) => string): HostedResidentImportHooks;
|
|
320
|
+
/**
|
|
321
|
+
* Hold every module this process loads from now on to hostedResidentImportHooks, when its environment names a hosted
|
|
322
|
+
* resident's workspace (a ZTC pane): registered once per `register` (module.registerHooks, from Node 22.15 and 23.5),
|
|
323
|
+
* resolving as the kernel does. A pane does so as it starts (cli_main), and each of its extension loaders before it loads
|
|
324
|
+
* a file (loadsExtensionFile). Answers why it cannot (a Node without module.registerHooks: such a pane does not start,
|
|
325
|
+
* and loads no extension), or null. A ZTC whose environment names no workspace registers nothing.
|
|
326
|
+
*/
|
|
327
|
+
export declare function holdResidentPaneImports(env?: NodeJS.ProcessEnv, register?: HostedResidentRegisterHooks | null): string | null;
|
|
328
|
+
/**
|
|
329
|
+
* Whether this ZTC loads `path`, a file one of its extension loaders found (each asks just before it reads or imports
|
|
330
|
+
* one): hostedResidentExtensionFileRefusal on this process's environment and the real filesystem, saying why it does
|
|
331
|
+
* not through runtimeDiag (the Logs ring, and stderr where no interactive renderer owns the screen: headless, or a
|
|
332
|
+
* stdout that is not a TTY). It resolves the file as the kernel does (realpathSync.native, as the resident resolved its
|
|
333
|
+
* workspace): fs.realpathSync keeps each component as the path spells it, so on a filesystem that ignores letter case a
|
|
334
|
+
* link naming the workspace in other case would not read as inside it. In a pane it first makes sure the process holds
|
|
335
|
+
* every module it loads to the same (holdResidentPaneImports), so what an approved module imports is held too, and loads
|
|
336
|
+
* nothing on a Node that cannot.
|
|
337
|
+
*/
|
|
338
|
+
export declare function loadsExtensionFile(path: string): boolean;
|
|
339
|
+
/**
|
|
340
|
+
* A hosted resident's ZTC pane's launch arguments, less the launch's own --domain-paths and its value: the pane would
|
|
341
|
+
* resolve them again against its own directory, and its environment carries those roots as the launch resolved them
|
|
342
|
+
* (hostedResidentExtensionRoots). What follows an end of options ('--') is the pane's task, kept as it is.
|
|
343
|
+
*/
|
|
344
|
+
export declare function hostedResidentPaneArgs(args: readonly string[]): string[];
|
|
345
|
+
/**
|
|
346
|
+
* Why a ZTC that a hosted resident started as one of its panes does not start where it is, or null when it does. The
|
|
347
|
+
* resident checks a pane's directory before the spawn (hostedResidentMuxDecision), but the spawn's chdir resolves the
|
|
348
|
+
* path again, so a directory swapped for a link in between would start the pane wherever the link leads. So the pane
|
|
349
|
+
* checks where the kernel left it, first thing as it starts, before it reads config or loads a plugin: the path the
|
|
350
|
+
* kernel names for its working directory (`cwd`, a real path: process.cwd()) and that path resolved again (`realPath`)
|
|
351
|
+
* must both be inside the workspace its environment names. The first is where the pane is. The second re-reads the
|
|
352
|
+
* path, so a link swapped into it since can only add a refusal, never admit a directory outside. With either path
|
|
353
|
+
* outside or not absolute, its directory gone or unreadable, or no absolute workspace named, the pane does not start. A
|
|
354
|
+
* ZTC whose environment names no workspace is not such a pane, and starts as it always has; its directory is not read.
|
|
355
|
+
*/
|
|
356
|
+
export declare function hostedResidentPaneStartRefusal(env: NodeJS.ProcessEnv, cwd: () => string, realPath: (path: string) => string): string | null;
|