@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
|
@@ -319,20 +319,67 @@ export async function executeToolWithRuntime(name, args, options) {
|
|
|
319
319
|
approvalGranted = true;
|
|
320
320
|
}
|
|
321
321
|
let profileApprovalRequired = false;
|
|
322
|
-
|
|
322
|
+
// The files a call writes, as its tool names them (writePaths): paths that
|
|
323
|
+
// sit inside an argument the policy cannot read, such as apply_patch's patch
|
|
324
|
+
// text, and the files of write_file and edit_file. Each gets the check
|
|
325
|
+
// write_file's `path` gets plus the policy's rules for written files, and
|
|
326
|
+
// one refusal refuses the whole call before anything is written.
|
|
327
|
+
let writeTargets = [];
|
|
328
|
+
const policy = options.policy;
|
|
329
|
+
const refuseWrites = (targets) => {
|
|
330
|
+
let approvalRequired = false;
|
|
331
|
+
if (!policy)
|
|
332
|
+
return { approvalRequired };
|
|
333
|
+
// Every path this call writes, so the policy can refuse a set that completes a git directory across them as one.
|
|
334
|
+
const writeSet = targets.map(target => target.path);
|
|
335
|
+
for (const target of targets) {
|
|
336
|
+
let decision;
|
|
337
|
+
try {
|
|
338
|
+
decision = policy.evaluateTool({
|
|
339
|
+
name, args: { path: target.path }, capabilities: [ToolCapability.FILE_WRITE], writeTargets: true, writeSet,
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
decision = {
|
|
344
|
+
allowed: false,
|
|
345
|
+
reason: `Permission denied: path cannot be resolved for write admission (${error instanceof Error ? error.message : String(error)})`,
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
if (!decision.allowed) {
|
|
349
|
+
return {
|
|
350
|
+
refusal: `${decision.reason || `Permission denied: ${name}`}. ${name} wrote nothing: ${target.label} is refused, `
|
|
351
|
+
+ 'and every path a call writes must be allowed.',
|
|
352
|
+
approvalRequired,
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
approvalRequired ||= decision.approvalRequired === true;
|
|
356
|
+
}
|
|
357
|
+
return { approvalRequired };
|
|
358
|
+
};
|
|
359
|
+
const admitWriteTargets = () => {
|
|
360
|
+
const { refusal, approvalRequired } = refuseWrites(writeTargets);
|
|
361
|
+
if (refusal !== undefined)
|
|
362
|
+
return { content: refusal, isError: true, effectiveArgs };
|
|
363
|
+
profileApprovalRequired ||= approvalRequired;
|
|
364
|
+
return undefined;
|
|
365
|
+
};
|
|
366
|
+
let policyExecutionCommand;
|
|
367
|
+
if (policy
|
|
323
368
|
&& tool
|
|
324
369
|
&& !hostControlPlaneWrite) {
|
|
325
370
|
try {
|
|
326
371
|
policyExecutionCwd = tool.resolveExecutionCwd?.(effectiveArgs, options.context);
|
|
372
|
+
policyExecutionCommand = tool.resolveExecutionCommand?.(effectiveArgs);
|
|
327
373
|
}
|
|
328
374
|
catch (error) {
|
|
329
375
|
return handleToolFailure(error);
|
|
330
376
|
}
|
|
331
|
-
const decision =
|
|
377
|
+
const decision = policy.evaluateTool({
|
|
332
378
|
name,
|
|
333
379
|
args: effectiveArgs,
|
|
334
380
|
capabilities: callCapabilities(effectiveArgs),
|
|
335
381
|
...(policyExecutionCwd === undefined ? {} : { executionCwd: policyExecutionCwd }),
|
|
382
|
+
...(policyExecutionCommand === undefined ? {} : { executionCommand: policyExecutionCommand }),
|
|
336
383
|
});
|
|
337
384
|
profileApprovalRequired = decision.approvalRequired === true;
|
|
338
385
|
if (!decision.allowed) {
|
|
@@ -342,6 +389,22 @@ export async function executeToolWithRuntime(name, args, options) {
|
|
|
342
389
|
effectiveArgs,
|
|
343
390
|
};
|
|
344
391
|
}
|
|
392
|
+
if (tool.writePaths) {
|
|
393
|
+
try {
|
|
394
|
+
writeTargets = await tool.writePaths(effectiveArgs, options.context);
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
return handleToolFailure(error);
|
|
398
|
+
}
|
|
399
|
+
const refused = admitWriteTargets();
|
|
400
|
+
if (refused)
|
|
401
|
+
return refused;
|
|
402
|
+
// A call that writes files is gated and observed as a file write,
|
|
403
|
+
// whatever its tool declares (a shell adapter that runs apply_patch).
|
|
404
|
+
if (writeTargets.length > 0 && !capabilities.includes(ToolCapability.FILE_WRITE)) {
|
|
405
|
+
capabilities = [...capabilities, ToolCapability.FILE_WRITE];
|
|
406
|
+
}
|
|
407
|
+
}
|
|
345
408
|
}
|
|
346
409
|
const verificationAdmission = () => {
|
|
347
410
|
const adapter = sourceTool === verifyArtifactTool || sourceTool === benchmarkCPUTool;
|
|
@@ -459,7 +522,22 @@ export async function executeToolWithRuntime(name, args, options) {
|
|
|
459
522
|
const dispatchAdmission = verificationAdmission();
|
|
460
523
|
if (dispatchAdmission)
|
|
461
524
|
return dispatchAdmission;
|
|
525
|
+
// The filesystem can change between admission and here: a directory
|
|
526
|
+
// swapped for a symlink that leads out must not receive the write.
|
|
527
|
+
const writeReadmission = admitWriteTargets();
|
|
528
|
+
if (writeReadmission)
|
|
529
|
+
return writeReadmission;
|
|
530
|
+
// And between here and the write: the tool admits the paths it is about
|
|
531
|
+
// to write once more, inside its own path locks.
|
|
532
|
+
const admitWrites = policy && tool && !hostControlPlaneWrite
|
|
533
|
+
? (targets) => {
|
|
534
|
+
const { refusal } = refuseWrites(targets);
|
|
535
|
+
if (refusal !== undefined)
|
|
536
|
+
throw new Error(refusal);
|
|
537
|
+
}
|
|
538
|
+
: undefined;
|
|
462
539
|
const toolContext = options.context ? { ...options.context,
|
|
540
|
+
admitWrites,
|
|
463
541
|
onOutput: sourceTool === runCommandTool || tool?.outputSource === runCommandTool
|
|
464
542
|
? options.context.onOutput : undefined,
|
|
465
543
|
canInspectVerificationSource: sourceTool === runCommandTool || sourceTool === readCommandTool || sourceTool === stopCommandTool || sourceTool === verifyArtifactTool || sourceTool === benchmarkCPUTool
|
|
@@ -515,7 +593,7 @@ export async function executeToolWithRuntime(name, args, options) {
|
|
|
515
593
|
+ `\n\n[output truncated: ${resultContent.length.toLocaleString()} chars / ~${totalLines.toLocaleString()} lines — showing first ${HEAD.toLocaleString()} and last ${TAIL.toLocaleString()} chars]\n\n`
|
|
516
594
|
+ resultContent.slice(-TAIL);
|
|
517
595
|
}
|
|
518
|
-
const changedPaths = extractChangedPaths(
|
|
596
|
+
const changedPaths = extractChangedPaths(capabilities, output, cwd);
|
|
519
597
|
// The plan artifact is host control-plane state outside the workspace.
|
|
520
598
|
// Auto-intents would turn this exact-one-file exception into a second
|
|
521
599
|
// workspace write, violating plan mode's safety boundary.
|