@zergai/ztc 0.23.1-dev.202611152321 → 0.24.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 +299 -13
- package/bin/zmux-darwin-arm64 +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/zterm-darwin-arm64 +2 -2
- package/dist/agent/agent.js +57 -14
- package/dist/agent/backends/http_error.d.ts +2 -0
- package/dist/agent/backends/http_error.js +2 -0
- package/dist/agent/backends/router_gate.d.ts +3 -2
- package/dist/agent/backends/router_gate.js +5 -4
- package/dist/agent/backends/router_keys.d.ts +14 -0
- package/dist/agent/backends/router_keys.js +19 -0
- package/dist/agent/backends/router_refusal.d.ts +5 -3
- package/dist/agent/backends/router_refusal.js +28 -6
- package/dist/agent/backends/types.d.ts +1 -1
- package/dist/agent/backends/zrouter_stream.js +10 -6
- package/dist/agent/commands/agent_cli.d.ts +11 -1
- package/dist/agent/commands/agent_cli.js +295 -38
- package/dist/agent/commands/diff.js +4 -1
- package/dist/agent/commands/help.js +4 -1
- package/dist/agent/commands/plan.js +3 -1
- package/dist/agent/commands/session_redaction.d.ts +16 -0
- package/dist/agent/commands/session_redaction.js +77 -0
- package/dist/agent/commands/settings.js +144 -0
- package/dist/agent/commands/types.d.ts +5 -0
- package/dist/agent/commands/usage_spec.d.ts +4 -0
- package/dist/agent/commands/usage_spec.js +10 -4
- package/dist/agent/runtime/policy.d.ts +25 -0
- package/dist/agent/runtime/policy.js +154 -26
- package/dist/agent/runtime/source_verification.js +6 -2
- package/dist/agent/runtime/tool_runtime.js +81 -3
- package/dist/agent/tools/apply_patch.js +678 -131
- package/dist/agent/tools/bus_message.d.ts +26 -1
- package/dist/agent/tools/bus_message.js +126 -10
- package/dist/agent/tools/file.d.ts +16 -1
- package/dist/agent/tools/file.js +43 -5
- package/dist/agent/tools/index.d.ts +1 -1
- package/dist/agent/tools/index.js +1 -1
- package/dist/agent/tools/pane.js +5 -0
- package/dist/agent/tools/search.js +5 -1
- package/dist/agent/tools/supervision.js +16 -2
- package/dist/agent/tools/types.d.ts +22 -0
- package/dist/app/mirror_startup.d.ts +7 -5
- package/dist/app/mirror_startup.js +7 -5
- package/dist/app/navigator_mirrors.d.ts +20 -0
- package/dist/app/navigator_mirrors.js +36 -0
- package/dist/app/workspace_layout_controller.d.ts +11 -2
- package/dist/app/workspace_layout_controller.js +13 -2
- package/dist/batch/worktree.js +9 -1
- package/dist/cli_ratatui.d.ts +264 -12
- package/dist/cli_ratatui.js +1198 -103
- package/dist/config/types.d.ts +29 -0
- package/dist/desktop/daily/source_baseline.js +3 -1
- package/dist/diagnostics/session_export.d.ts +1 -0
- package/dist/diagnostics/session_export.js +229 -26
- package/dist/emulation/tool_adapters.js +42 -5
- package/dist/headless.js +24 -5
- package/dist/instance_registry.d.ts +7 -0
- package/dist/mcp/workspace_server.d.ts +12 -1
- package/dist/mcp/workspace_server.js +75 -8
- package/dist/panes/agent_cli.d.ts +60 -3
- package/dist/panes/agent_cli.js +169 -16
- package/dist/panes/agent_pane_sessions.d.ts +22 -0
- package/dist/panes/agent_pane_sessions.js +111 -0
- package/dist/panes/agent_panes.d.ts +77 -3
- package/dist/panes/agent_panes.js +199 -10
- package/dist/panes/agent_profiles.d.ts +5 -0
- package/dist/panes/agent_profiles.js +7 -0
- package/dist/panes/agent_resume.d.ts +134 -0
- package/dist/panes/agent_resume.js +155 -0
- package/dist/panes/agent_sessions/claude_head.d.ts +32 -0
- package/dist/panes/agent_sessions/claude_head.js +122 -0
- package/dist/panes/agent_sessions/claude_store.d.ts +59 -0
- package/dist/panes/agent_sessions/claude_store.js +223 -0
- package/dist/panes/agent_sessions/codex_head.d.ts +55 -0
- package/dist/panes/agent_sessions/codex_head.js +161 -0
- package/dist/panes/agent_sessions/codex_store.d.ts +43 -0
- package/dist/panes/agent_sessions/codex_store.js +187 -0
- package/dist/panes/agent_sessions/controller.d.ts +74 -0
- package/dist/panes/agent_sessions/controller.js +110 -0
- package/dist/panes/agent_sessions/cut_json.d.ts +14 -0
- package/dist/panes/agent_sessions/cut_json.js +109 -0
- package/dist/panes/agent_sessions/limits.d.ts +48 -0
- package/dist/panes/agent_sessions/limits.js +48 -0
- package/dist/panes/agent_sessions/scan.d.ts +49 -0
- package/dist/panes/agent_sessions/scan.js +86 -0
- package/dist/panes/agent_sessions/store_fs.d.ts +51 -0
- package/dist/panes/agent_sessions/store_fs.js +128 -0
- package/dist/panes/agent_sessions/stores.d.ts +36 -0
- package/dist/panes/agent_sessions/stores.js +89 -0
- package/dist/panes/agent_sessions/title.d.ts +9 -0
- package/dist/panes/agent_sessions/title.js +51 -0
- package/dist/panes/agent_sessions/types.d.ts +48 -0
- package/dist/panes/agent_sessions/types.js +2 -0
- package/dist/panes/reply_arbitrator.d.ts +39 -0
- package/dist/panes/reply_arbitrator.js +185 -0
- package/dist/panes/reply_modes.d.ts +291 -0
- package/dist/panes/reply_modes.js +598 -0
- package/dist/runtime_info.js +11 -2
- package/dist/session.js +4 -2
- package/dist/simulation/living/context.d.ts +8 -8
- package/dist/simulation/living/types.d.ts +5 -5
- package/dist/simulation/toolkit/dynamic_state.d.ts +1 -1
- package/dist/ui/ratatui/ipc_path.d.ts +5 -0
- package/dist/ui/ratatui/ipc_path.js +23 -3
- package/dist/ui/ratatui/pane_credential_broker.d.ts +23 -8
- package/dist/ui/ratatui/pane_credential_broker.js +49 -14
- package/dist/ui/ratatui/pane_relay.d.ts +5 -2
- package/dist/ui/ratatui/pane_relay.js +86 -19
- package/dist/ui/ratatui/process.js +3 -0
- package/dist/ui/ratatui/protocol.d.ts +50 -1
- package/dist/ui/ratatui/protocol.js +56 -0
- package/dist/ui/ratatui/relay_policy.d.ts +39 -0
- package/dist/ui/ratatui/relay_policy.js +94 -0
- package/dist/ui/ratatui/screen_privacy.d.ts +15 -0
- package/dist/ui/ratatui/screen_privacy.js +24 -0
- package/dist/ui/scrollback.js +8 -0
- package/dist/ui/widgets/agent_sessions_panel.d.ts +139 -0
- package/dist/ui/widgets/agent_sessions_panel.js +542 -0
- package/dist/ui/widgets/log_view.d.ts +5 -1
- package/dist/ui/widgets/log_view.js +40 -4
- package/dist/utils/atomic_write.js +9 -11
- package/dist/utils/canonical_path.d.ts +19 -0
- package/dist/utils/canonical_path.js +44 -0
- package/dist/utils/compaction.d.ts +2 -1
- package/dist/utils/compaction.js +3 -1
- package/dist/utils/git_directory_names.d.ts +51 -0
- package/dist/utils/git_directory_names.js +429 -0
- package/dist/utils/temporary_write_root.d.ts +6 -1
- package/dist/utils/temporary_write_root.js +32 -2
- package/dist/utils/tool_result_message.d.ts +4 -1
- package/dist/utils/tool_result_message.js +6 -2
- package/dist/web/bus_hold.d.ts +70 -0
- package/dist/web/bus_hold.js +118 -0
- package/dist/web/mirror_client.d.ts +7 -3
- package/dist/web/mirror_client.js +61 -23
- package/dist/web/mirror_route_gate.d.ts +40 -0
- package/dist/web/mirror_route_gate.js +71 -0
- package/dist/web/mirror_stream.d.ts +147 -22
- package/dist/web/mirror_stream.js +350 -83
- package/dist/web/pane_credentials.d.ts +32 -1
- package/dist/web/pane_credentials.js +62 -2
- package/dist/workspace_collision.js +11 -2
- package/dist/zlm-embed.mjs +940 -273
- package/package.json +39 -7
|
@@ -71,8 +71,39 @@ export declare class PaneCredentialStore {
|
|
|
71
71
|
/**
|
|
72
72
|
* Mint a credential for a pane about to be created. It authenticates as nothing until bound, and is dropped if it
|
|
73
73
|
* isn't bound within PENDING_TTL_MS. With `paneId`, a renderer that assigns ids before it spawns binds it at once.
|
|
74
|
+
* `openedBy` is the pane a pane asked for it from, through the pane relay (the pane its relay connection announced),
|
|
75
|
+
* which openerOf then names for as long as the credential stands for its pane. `joinsBus` says a ZTC that joins this
|
|
76
|
+
* port's mirror bus as it starts will hold it (joinsBus).
|
|
74
77
|
*/
|
|
75
|
-
issue(scope?: PaneCredentialScope, paneId?: number
|
|
78
|
+
issue(scope?: PaneCredentialScope, paneId?: number, openedBy?: number | null, options?: {
|
|
79
|
+
joinsBus?: boolean;
|
|
80
|
+
}): PaneCredential;
|
|
81
|
+
/**
|
|
82
|
+
* The pane that opened pane PANE_ID through the pane relay, as the credential bound to it records (issue's
|
|
83
|
+
* `openedBy`). Null when its credential records none (ZTC itself or the person opened it, a relay connection that
|
|
84
|
+
* named no pane did, or its owner started it again in place), when no credential stands for it (it holds none, it
|
|
85
|
+
* closed, or the renderer relaunched it without one), or when its credentials disagree.
|
|
86
|
+
*/
|
|
87
|
+
openerOf(paneId: number): number | null;
|
|
88
|
+
/**
|
|
89
|
+
* Whether pane PANE_ID runs a ZTC that joins this port's mirror bus as it starts, as a credential bound to it says
|
|
90
|
+
* (issue's `joinsBus`), whichever way the pane was opened. False once the pane closes, once its program has exited
|
|
91
|
+
* (programExited), or when it holds no such credential.
|
|
92
|
+
*/
|
|
93
|
+
joinsBus(paneId: number): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* The renderer says pane PANE_ID's program has exited (its pane list's is_alive): the ZTC that holds a credential bound
|
|
96
|
+
* to the pane that joins this port's mirror bus is gone, so the pane no longer joins (joinsBus) and its ZTC has exited
|
|
97
|
+
* (ztcExited). That lasts as long as the credential stands for the pane: a pane started again in place with a fresh
|
|
98
|
+
* credential, or opened anew, holds one that hasn't exited; one started again without a credential, or closed, holds
|
|
99
|
+
* none. Returns whether this is news: a credential that joins the bus, and hadn't exited, is now marked.
|
|
100
|
+
*/
|
|
101
|
+
programExited(paneId: number): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Whether pane PANE_ID's ZTC, which joined or would have joined this port's mirror bus, has exited (programExited), and
|
|
104
|
+
* no credential of a ZTC that still joins it stands for the pane.
|
|
105
|
+
*/
|
|
106
|
+
ztcExited(paneId: number): boolean;
|
|
76
107
|
/** The pane a presented credential stands for; 'pending' while it waits for its pane; null for anything else. */
|
|
77
108
|
resolve(token: string): PanePrincipal | 'pending' | null;
|
|
78
109
|
/**
|
|
@@ -71,12 +71,16 @@ export class PaneCredentialStore {
|
|
|
71
71
|
/**
|
|
72
72
|
* Mint a credential for a pane about to be created. It authenticates as nothing until bound, and is dropped if it
|
|
73
73
|
* isn't bound within PENDING_TTL_MS. With `paneId`, a renderer that assigns ids before it spawns binds it at once.
|
|
74
|
+
* `openedBy` is the pane a pane asked for it from, through the pane relay (the pane its relay connection announced),
|
|
75
|
+
* which openerOf then names for as long as the credential stands for its pane. `joinsBus` says a ZTC that joins this
|
|
76
|
+
* port's mirror bus as it starts will hold it (joinsBus).
|
|
74
77
|
*/
|
|
75
|
-
issue(scope = 'pane', paneId) {
|
|
78
|
+
issue(scope = 'pane', paneId, openedBy = null, options = {}) {
|
|
76
79
|
this.sweep();
|
|
77
80
|
const token = randomBytes(32).toString('base64url');
|
|
78
81
|
const key = digest(token);
|
|
79
|
-
this.entries.set(key, { scope, paneId: null,
|
|
82
|
+
this.entries.set(key, { scope, paneId: null, openedBy, joinsBus: options.joinsBus === true, exited: false,
|
|
83
|
+
pendingUntilMs: Date.now() + PENDING_TTL_MS, waiters: new Set() });
|
|
80
84
|
const credential = {
|
|
81
85
|
token,
|
|
82
86
|
scope,
|
|
@@ -98,6 +102,62 @@ export class PaneCredentialStore {
|
|
|
98
102
|
credential.bind(paneId);
|
|
99
103
|
return credential;
|
|
100
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* The pane that opened pane PANE_ID through the pane relay, as the credential bound to it records (issue's
|
|
107
|
+
* `openedBy`). Null when its credential records none (ZTC itself or the person opened it, a relay connection that
|
|
108
|
+
* named no pane did, or its owner started it again in place), when no credential stands for it (it holds none, it
|
|
109
|
+
* closed, or the renderer relaunched it without one), or when its credentials disagree.
|
|
110
|
+
*/
|
|
111
|
+
openerOf(paneId) {
|
|
112
|
+
const openers = new Set();
|
|
113
|
+
for (const entry of this.entries.values())
|
|
114
|
+
if (entry.paneId === paneId)
|
|
115
|
+
openers.add(entry.openedBy);
|
|
116
|
+
return openers.size === 1 ? [...openers][0] : null;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Whether pane PANE_ID runs a ZTC that joins this port's mirror bus as it starts, as a credential bound to it says
|
|
120
|
+
* (issue's `joinsBus`), whichever way the pane was opened. False once the pane closes, once its program has exited
|
|
121
|
+
* (programExited), or when it holds no such credential.
|
|
122
|
+
*/
|
|
123
|
+
joinsBus(paneId) {
|
|
124
|
+
for (const entry of this.entries.values())
|
|
125
|
+
if (entry.paneId === paneId && entry.joinsBus && !entry.exited)
|
|
126
|
+
return true;
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The renderer says pane PANE_ID's program has exited (its pane list's is_alive): the ZTC that holds a credential bound
|
|
131
|
+
* to the pane that joins this port's mirror bus is gone, so the pane no longer joins (joinsBus) and its ZTC has exited
|
|
132
|
+
* (ztcExited). That lasts as long as the credential stands for the pane: a pane started again in place with a fresh
|
|
133
|
+
* credential, or opened anew, holds one that hasn't exited; one started again without a credential, or closed, holds
|
|
134
|
+
* none. Returns whether this is news: a credential that joins the bus, and hadn't exited, is now marked.
|
|
135
|
+
*/
|
|
136
|
+
programExited(paneId) {
|
|
137
|
+
let marked = false;
|
|
138
|
+
for (const entry of this.entries.values()) {
|
|
139
|
+
if (entry.paneId !== paneId || !entry.joinsBus || entry.exited)
|
|
140
|
+
continue;
|
|
141
|
+
entry.exited = true;
|
|
142
|
+
marked = true;
|
|
143
|
+
}
|
|
144
|
+
return marked;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Whether pane PANE_ID's ZTC, which joined or would have joined this port's mirror bus, has exited (programExited), and
|
|
148
|
+
* no credential of a ZTC that still joins it stands for the pane.
|
|
149
|
+
*/
|
|
150
|
+
ztcExited(paneId) {
|
|
151
|
+
let exited = false;
|
|
152
|
+
for (const entry of this.entries.values()) {
|
|
153
|
+
if (entry.paneId !== paneId || !entry.joinsBus)
|
|
154
|
+
continue;
|
|
155
|
+
if (!entry.exited)
|
|
156
|
+
return false;
|
|
157
|
+
exited = true;
|
|
158
|
+
}
|
|
159
|
+
return exited;
|
|
160
|
+
}
|
|
101
161
|
/** The pane a presented credential stands for; 'pending' while it waits for its pane; null for anything else. */
|
|
102
162
|
resolve(token) {
|
|
103
163
|
if (!token)
|
|
@@ -37,8 +37,17 @@ function gitEnvironment() {
|
|
|
37
37
|
delete env[key];
|
|
38
38
|
return { ...env, GIT_OPTIONAL_LOCKS: '0', GIT_TERMINAL_PROMPT: '0' };
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Options every git run here takes first, as runtime_info's probes do. Inspection and isolation run git in the work tree
|
|
42
|
+
* the agent writes to, in ZTC's own process and outside any sandbox the agent works under: core.fsmonitor=false keeps a
|
|
43
|
+
* core.fsmonitor command in the repository's config from running on a diff or an apply, and safe.bareRepository=explicit
|
|
44
|
+
* keeps git from taking a bare repository planted in the work tree for the session's repository and running its config.
|
|
45
|
+
* Both are honoured from the command line, which the agent cannot write, and leave normal work trees and linked
|
|
46
|
+
* worktrees working.
|
|
47
|
+
*/
|
|
48
|
+
const GIT_OPTIONS = ['-c', 'core.fsmonitor=false', '-c', 'safe.bareRepository=explicit'];
|
|
40
49
|
async function git(cwd, args, limit = 1024 * 1024, timeout = GIT_TIMEOUT_MS) {
|
|
41
|
-
const result = await execFileAsync('git', ['-C', cwd, ...args], {
|
|
50
|
+
const result = await execFileAsync('git', [...GIT_OPTIONS, '-C', cwd, ...args], {
|
|
42
51
|
env: gitEnvironment(), encoding: 'buffer', timeout, maxBuffer: limit,
|
|
43
52
|
windowsHide: true,
|
|
44
53
|
});
|
|
@@ -594,7 +603,7 @@ async function applyPatch(cwd, patch, staged) {
|
|
|
594
603
|
if (!patch.length)
|
|
595
604
|
return;
|
|
596
605
|
await new Promise((resolvePromise, reject) => {
|
|
597
|
-
const child = spawn('git', ['-C', cwd, 'apply', '--binary', ...(staged ? ['--index'] : []), '-'], {
|
|
606
|
+
const child = spawn('git', [...GIT_OPTIONS, '-C', cwd, 'apply', '--binary', ...(staged ? ['--index'] : []), '-'], {
|
|
598
607
|
env: gitEnvironment(), stdio: ['pipe', 'ignore', 'pipe'], windowsHide: true,
|
|
599
608
|
});
|
|
600
609
|
let stderr = '';
|