@namzu/cli 26.3.0 → 28.0.0
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/CHANGELOG.md +271 -0
- package/README.md +67 -46
- package/dist/bin.js +7 -0
- package/dist/bin.js.map +1 -1
- package/dist/checkpoints/store.d.ts +17 -4
- package/dist/checkpoints/store.d.ts.map +1 -1
- package/dist/checkpoints/store.js +20 -5
- package/dist/checkpoints/store.js.map +1 -1
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +124 -14
- package/dist/cli.js.map +1 -1
- package/dist/commands/acp.d.ts +23 -1
- package/dist/commands/acp.d.ts.map +1 -1
- package/dist/commands/acp.js +41 -2
- package/dist/commands/acp.js.map +1 -1
- package/dist/commands/drain.d.ts +69 -2
- package/dist/commands/drain.d.ts.map +1 -1
- package/dist/commands/drain.js +216 -136
- package/dist/commands/drain.js.map +1 -1
- package/dist/commands/eval.js +1 -1
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/{run-flags.d.ts → exec-flags.d.ts} +36 -28
- package/dist/commands/exec-flags.d.ts.map +1 -0
- package/dist/commands/{run-flags.js → exec-flags.js} +35 -27
- package/dist/commands/exec-flags.js.map +1 -0
- package/dist/commands/exec-json.d.ts +75 -0
- package/dist/commands/exec-json.d.ts.map +1 -0
- package/dist/commands/exec-json.js +473 -0
- package/dist/commands/exec-json.js.map +1 -0
- package/dist/commands/exec.d.ts +42 -0
- package/dist/commands/exec.d.ts.map +1 -0
- package/dist/commands/exec.js +683 -0
- package/dist/commands/exec.js.map +1 -0
- package/dist/commands/host-queries.d.ts +12 -0
- package/dist/commands/host-queries.d.ts.map +1 -0
- package/dist/commands/host-queries.js +149 -0
- package/dist/commands/host-queries.js.map +1 -0
- package/dist/commands/prior-messages.js +1 -1
- package/dist/commands/prior-messages.js.map +1 -1
- package/dist/commands/provider-wait.d.ts +5 -5
- package/dist/commands/provider-wait.d.ts.map +1 -1
- package/dist/commands/provider-wait.js +2 -2
- package/dist/commands/registry.d.ts.map +1 -1
- package/dist/commands/registry.js +2 -0
- package/dist/commands/registry.js.map +1 -1
- package/dist/commands/resident-flags.d.ts +2 -2
- package/dist/commands/resident-flags.d.ts.map +1 -1
- package/dist/commands/resident-flags.js +4 -2
- package/dist/commands/resident-flags.js.map +1 -1
- package/dist/commands/resident-learning.js +1 -1
- package/dist/commands/resident-learning.js.map +1 -1
- package/dist/commands/resident.d.ts.map +1 -1
- package/dist/commands/resident.js +3 -2
- package/dist/commands/resident.js.map +1 -1
- package/dist/commands/serve.js +2 -2
- package/dist/commands/serve.js.map +1 -1
- package/dist/commands/skills.js +1 -1
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/state.js +8 -8
- package/dist/commands/state.js.map +1 -1
- package/dist/commands/stdin.d.ts +5 -5
- package/dist/commands/stdin.js +5 -5
- package/dist/commands/types.d.ts +2 -0
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/config/load.d.ts +1 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +36 -5
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +59 -20
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/config/tool-result-screens.js +1 -1
- package/dist/config/turn-guards.d.ts +23 -0
- package/dist/config/turn-guards.d.ts.map +1 -0
- package/dist/config/turn-guards.js +46 -0
- package/dist/config/turn-guards.js.map +1 -0
- package/dist/context/directories.d.ts +37 -0
- package/dist/context/directories.d.ts.map +1 -0
- package/dist/context/directories.js +69 -0
- package/dist/context/directories.js.map +1 -0
- package/dist/context/environment.d.ts +55 -0
- package/dist/context/environment.d.ts.map +1 -1
- package/dist/context/environment.js +96 -0
- package/dist/context/environment.js.map +1 -1
- package/dist/context/project-tracker.d.ts +3 -3
- package/dist/context/project-tracker.d.ts.map +1 -1
- package/dist/context/project-tracker.js +3 -3
- package/dist/context/project-tracker.js.map +1 -1
- package/dist/context/project.d.ts +2 -2
- package/dist/context/project.js +2 -2
- package/dist/context/sandbox.d.ts +22 -3
- package/dist/context/sandbox.d.ts.map +1 -1
- package/dist/context/sandbox.js +42 -4
- package/dist/context/sandbox.js.map +1 -1
- package/dist/doctor/checks/chain.d.ts +1 -1
- package/dist/doctor/checks/chain.js +7 -7
- package/dist/doctor/checks/chain.js.map +1 -1
- package/dist/doctor/checks/invariants.d.ts +2 -2
- package/dist/doctor/checks/invariants.js +5 -5
- package/dist/doctor/checks/invariants.js.map +1 -1
- package/dist/doctor/checks/logging.js +1 -1
- package/dist/doctor/checks/logging.js.map +1 -1
- package/dist/doctor/checks/sandbox.js +1 -1
- package/dist/doctor/checks/sandbox.js.map +1 -1
- package/dist/doctor/checks/session-export.d.ts +1 -1
- package/dist/doctor/checks/session-export.js +2 -2
- package/dist/doctor/checks/session-export.js.map +1 -1
- package/dist/doctor/checks/telemetry.d.ts +1 -1
- package/dist/doctor/checks/telemetry.js +1 -1
- package/dist/doctor/registry.js +2 -2
- package/dist/doctor/registry.js.map +1 -1
- package/dist/exit-codes.d.ts +2 -2
- package/dist/exit-codes.js +2 -2
- package/dist/integrations/mcp/servers.d.ts +1 -1
- package/dist/integrations/providers/access.d.ts +4 -1
- package/dist/integrations/providers/access.d.ts.map +1 -1
- package/dist/integrations/providers/access.js +6 -3
- package/dist/integrations/providers/access.js.map +1 -1
- package/dist/integrations/providers/chain-capabilities.d.ts +6 -6
- package/dist/integrations/providers/chain-capabilities.js +8 -8
- package/dist/integrations/providers/chain-capabilities.js.map +1 -1
- package/dist/integrations/providers/register.d.ts +1 -1
- package/dist/integrations/providers/register.js +1 -1
- package/dist/integrations/providers/registry.d.ts +1 -1
- package/dist/integrations/providers/zen-catalogue.d.ts +100 -0
- package/dist/integrations/providers/zen-catalogue.d.ts.map +1 -0
- package/dist/integrations/providers/zen-catalogue.js +196 -0
- package/dist/integrations/providers/zen-catalogue.js.map +1 -0
- package/dist/integrations/resident/inspection.d.ts +4 -1
- package/dist/integrations/resident/inspection.d.ts.map +1 -1
- package/dist/integrations/resident/inspection.js +53 -34
- package/dist/integrations/resident/inspection.js.map +1 -1
- package/dist/integrations/resident/learning-storage.d.ts +7 -2
- package/dist/integrations/resident/learning-storage.d.ts.map +1 -1
- package/dist/integrations/resident/learning-storage.js +12 -8
- package/dist/integrations/resident/learning-storage.js.map +1 -1
- package/dist/integrations/resident/runner-launch.d.ts +3 -3
- package/dist/integrations/resident/runner-launch.d.ts.map +1 -1
- package/dist/integrations/resident/runner-store.d.ts +1 -1
- package/dist/integrations/resident/runner-store.d.ts.map +1 -1
- package/dist/integrations/resident/runner-store.js +5 -2
- package/dist/integrations/resident/runner-store.js.map +1 -1
- package/dist/integrations/resident/runner-worker.js +23 -0
- package/dist/integrations/resident/runner-worker.js.map +1 -1
- package/dist/integrations/resident/session-log-reads.d.ts +37 -0
- package/dist/integrations/resident/session-log-reads.d.ts.map +1 -0
- package/dist/integrations/resident/session-log-reads.js +125 -0
- package/dist/integrations/resident/session-log-reads.js.map +1 -0
- package/dist/integrations/resident/session-step.d.ts +4 -2
- package/dist/integrations/resident/session-step.d.ts.map +1 -1
- package/dist/integrations/resident/session-step.js +16 -14
- package/dist/integrations/resident/session-step.js.map +1 -1
- package/dist/integrations/resident/storage.d.ts +23 -1
- package/dist/integrations/resident/storage.d.ts.map +1 -1
- package/dist/integrations/resident/storage.js +60 -17
- package/dist/integrations/resident/storage.js.map +1 -1
- package/dist/integrations/resident/tool-evidence.d.ts +4 -2
- package/dist/integrations/resident/tool-evidence.d.ts.map +1 -1
- package/dist/integrations/resident/tool-evidence.js +36 -30
- package/dist/integrations/resident/tool-evidence.js.map +1 -1
- package/dist/integrations/resident/verification.d.ts +2 -2
- package/dist/integrations/resident/verification.d.ts.map +1 -1
- package/dist/integrations/resident/verification.js +4 -4
- package/dist/integrations/resident/verification.js.map +1 -1
- package/dist/integrations/sessions/checkpoint-view.d.ts +13 -0
- package/dist/integrations/sessions/checkpoint-view.d.ts.map +1 -0
- package/dist/integrations/sessions/checkpoint-view.js +48 -0
- package/dist/integrations/sessions/checkpoint-view.js.map +1 -0
- package/dist/integrations/sessions/context-inventory.js +1 -1
- package/dist/integrations/sessions/context-inventory.js.map +1 -1
- package/dist/integrations/sessions/conversation-search.d.ts +16 -20
- package/dist/integrations/sessions/conversation-search.d.ts.map +1 -1
- package/dist/integrations/sessions/conversation-search.js +305 -731
- package/dist/integrations/sessions/conversation-search.js.map +1 -1
- package/dist/integrations/sessions/evidence-page-validation.d.ts +4 -4
- package/dist/integrations/sessions/evidence-page-validation.d.ts.map +1 -1
- package/dist/integrations/sessions/evidence-page-validation.js +1 -1
- package/dist/integrations/sessions/evidence-page-validation.js.map +1 -1
- package/dist/integrations/sessions/evidence-recall.d.ts +40 -2
- package/dist/integrations/sessions/evidence-recall.d.ts.map +1 -1
- package/dist/integrations/sessions/evidence-recall.js +41 -97
- package/dist/integrations/sessions/evidence-recall.js.map +1 -1
- package/dist/integrations/sessions/store.d.ts +153 -85
- package/dist/integrations/sessions/store.d.ts.map +1 -1
- package/dist/integrations/sessions/store.js +414 -484
- package/dist/integrations/sessions/store.js.map +1 -1
- package/dist/integrations/sessions/task-context.d.ts +15 -2
- package/dist/integrations/sessions/task-context.d.ts.map +1 -1
- package/dist/integrations/sessions/task-context.js +34 -11
- package/dist/integrations/sessions/task-context.js.map +1 -1
- package/dist/integrations/sessions/transcript-export.d.ts +13 -6
- package/dist/integrations/sessions/transcript-export.d.ts.map +1 -1
- package/dist/integrations/sessions/transcript-export.js +148 -263
- package/dist/integrations/sessions/transcript-export.js.map +1 -1
- package/dist/integrations/state/home.d.ts +4 -16
- package/dist/integrations/state/home.d.ts.map +1 -1
- package/dist/integrations/state/home.js +6 -42
- package/dist/integrations/state/home.js.map +1 -1
- package/dist/integrations/state/project.d.ts +6 -7
- package/dist/integrations/state/project.d.ts.map +1 -1
- package/dist/integrations/state/project.js +7 -9
- package/dist/integrations/state/project.js.map +1 -1
- package/dist/integrations/state/report.d.ts +27 -41
- package/dist/integrations/state/report.d.ts.map +1 -1
- package/dist/integrations/state/report.js +172 -464
- package/dist/integrations/state/report.js.map +1 -1
- package/dist/integrations/state/retention.d.ts +18 -0
- package/dist/integrations/state/retention.d.ts.map +1 -0
- package/dist/integrations/state/retention.js +18 -0
- package/dist/integrations/state/retention.js.map +1 -0
- package/dist/integrations/subagents/activity.d.ts +36 -31
- package/dist/integrations/subagents/activity.d.ts.map +1 -1
- package/dist/integrations/subagents/activity.js +27 -23
- package/dist/integrations/subagents/activity.js.map +1 -1
- package/dist/integrations/subagents/batches.d.ts +91 -0
- package/dist/integrations/subagents/batches.d.ts.map +1 -0
- package/dist/integrations/subagents/batches.js +172 -0
- package/dist/integrations/subagents/batches.js.map +1 -0
- package/dist/integrations/subagents/parent.d.ts +26 -11
- package/dist/integrations/subagents/parent.d.ts.map +1 -1
- package/dist/integrations/subagents/parent.js +13 -28
- package/dist/integrations/subagents/parent.js.map +1 -1
- package/dist/integrations/subagents/policy.d.ts +2 -2
- package/dist/integrations/subagents/policy.d.ts.map +1 -1
- package/dist/integrations/subagents/policy.js +2 -2
- package/dist/integrations/subagents/policy.js.map +1 -1
- package/dist/integrations/subagents/replay.d.ts +91 -26
- package/dist/integrations/subagents/replay.d.ts.map +1 -1
- package/dist/integrations/subagents/replay.js +216 -114
- package/dist/integrations/subagents/replay.js.map +1 -1
- package/dist/integrations/subagents/runtime.d.ts +50 -26
- package/dist/integrations/subagents/runtime.d.ts.map +1 -1
- package/dist/integrations/subagents/runtime.js +132 -126
- package/dist/integrations/subagents/runtime.js.map +1 -1
- package/dist/integrations/subagents/saved-agents.d.ts +57 -0
- package/dist/integrations/subagents/saved-agents.d.ts.map +1 -0
- package/dist/integrations/subagents/saved-agents.js +102 -0
- package/dist/integrations/subagents/saved-agents.js.map +1 -0
- package/dist/integrations/subagents/slash.d.ts +55 -0
- package/dist/integrations/subagents/slash.d.ts.map +1 -0
- package/dist/integrations/subagents/slash.js +45 -0
- package/dist/integrations/subagents/slash.js.map +1 -0
- package/dist/integrations/telemetry/session-export.d.ts +6 -6
- package/dist/integrations/telemetry/session-export.d.ts.map +1 -1
- package/dist/integrations/telemetry/session-export.js +2 -2
- package/dist/integrations/web/search.d.ts +1 -1
- package/dist/logging.d.ts +5 -5
- package/dist/logging.js +6 -6
- package/dist/memory/presentation.d.ts +11 -0
- package/dist/memory/presentation.d.ts.map +1 -1
- package/dist/memory/presentation.js +25 -0
- package/dist/memory/presentation.js.map +1 -1
- package/dist/memory/store.d.ts +13 -7
- package/dist/memory/store.d.ts.map +1 -1
- package/dist/memory/store.js +37 -11
- package/dist/memory/store.js.map +1 -1
- package/dist/memory/typed.d.ts +116 -0
- package/dist/memory/typed.d.ts.map +1 -0
- package/dist/memory/typed.js +336 -0
- package/dist/memory/typed.js.map +1 -0
- package/dist/permissions/checks.d.ts +1 -1
- package/dist/permissions/checks.js +1 -1
- package/dist/permissions/headless-trust.d.ts +4 -4
- package/dist/permissions/headless-trust.d.ts.map +1 -1
- package/dist/permissions/headless-trust.js +6 -6
- package/dist/permissions/headless-trust.js.map +1 -1
- package/dist/permissions/mode.d.ts +4 -4
- package/dist/permissions/mode.js +1 -1
- package/dist/permissions/rules.d.ts +1 -1
- package/dist/permissions/rules.js +1 -1
- package/dist/termination.d.ts +75 -0
- package/dist/termination.d.ts.map +1 -0
- package/dist/termination.js +143 -0
- package/dist/termination.js.map +1 -0
- package/dist/tui/AgentExplorer.d.ts +2 -2
- package/dist/tui/AgentExplorer.js +4 -4
- package/dist/tui/AgentExplorer.js.map +1 -1
- package/dist/tui/App.d.ts +9 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +456 -307
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/LiveActivity.d.ts +1 -1
- package/dist/tui/LiveActivity.d.ts.map +1 -1
- package/dist/tui/PermissionOverlay.d.ts +8 -0
- package/dist/tui/PermissionOverlay.d.ts.map +1 -1
- package/dist/tui/PermissionOverlay.js +25 -2
- package/dist/tui/PermissionOverlay.js.map +1 -1
- package/dist/tui/Picker.js +1 -1
- package/dist/tui/agent.d.ts +211 -135
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/agent.js +535 -316
- package/dist/tui/agent.js.map +1 -1
- package/dist/tui/conversation-evidence-view.js +3 -3
- package/dist/tui/conversation-evidence-view.js.map +1 -1
- package/dist/tui/conversation-history.d.ts +4 -21
- package/dist/tui/conversation-history.d.ts.map +1 -1
- package/dist/tui/conversation-history.js +4 -28
- package/dist/tui/conversation-history.js.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +27 -1
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/log-pane.js +1 -1
- package/dist/tui/markdownParser.d.ts +1 -1
- package/dist/tui/markdownParser.js +1 -1
- package/dist/tui/permission-review.d.ts +16 -0
- package/dist/tui/permission-review.d.ts.map +1 -1
- package/dist/tui/permission-review.js +25 -2
- package/dist/tui/permission-review.js.map +1 -1
- package/dist/tui/slashCommands.d.ts +30 -41
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/slashCommands.js +75 -66
- package/dist/tui/slashCommands.js.map +1 -1
- package/dist/tui/status-panel-layout.js +1 -1
- package/dist/tui/status-panel-layout.js.map +1 -1
- package/dist/tui/{run-interruption.d.ts → turn-interruption.d.ts} +4 -4
- package/dist/tui/turn-interruption.d.ts.map +1 -0
- package/dist/tui/{run-interruption.js → turn-interruption.js} +20 -20
- package/dist/tui/turn-interruption.js.map +1 -0
- package/dist/tui/turn-limits-settings.d.ts +39 -0
- package/dist/tui/turn-limits-settings.d.ts.map +1 -0
- package/dist/tui/{run-limits-settings.js → turn-limits-settings.js} +18 -18
- package/dist/tui/turn-limits-settings.js.map +1 -0
- package/dist/tui/types.d.ts +3 -3
- package/dist/tui/types.d.ts.map +1 -1
- package/dist/user-commands/store.d.ts +4 -4
- package/dist/user-commands/store.js +5 -5
- package/dist/user-commands/store.js.map +1 -1
- package/package.json +6 -6
- package/dist/commands/run-flags.d.ts.map +0 -1
- package/dist/commands/run-flags.js.map +0 -1
- package/dist/commands/run-stream.d.ts +0 -65
- package/dist/commands/run-stream.d.ts.map +0 -1
- package/dist/commands/run-stream.js +0 -603
- package/dist/commands/run-stream.js.map +0 -1
- package/dist/commands/run.d.ts +0 -39
- package/dist/commands/run.d.ts.map +0 -1
- package/dist/commands/run.js +0 -533
- package/dist/commands/run.js.map +0 -1
- package/dist/config/run-limits.d.ts +0 -11
- package/dist/config/run-limits.d.ts.map +0 -1
- package/dist/config/run-limits.js +0 -64
- package/dist/config/run-limits.js.map +0 -1
- package/dist/integrations/sessions/compaction-evidence.d.ts +0 -5
- package/dist/integrations/sessions/compaction-evidence.d.ts.map +0 -1
- package/dist/integrations/sessions/compaction-evidence.js +0 -59
- package/dist/integrations/sessions/compaction-evidence.js.map +0 -1
- package/dist/integrations/sessions/database.d.ts +0 -5
- package/dist/integrations/sessions/database.d.ts.map +0 -1
- package/dist/integrations/sessions/database.js +0 -34
- package/dist/integrations/sessions/database.js.map +0 -1
- package/dist/integrations/sessions/paths.d.ts +0 -7
- package/dist/integrations/sessions/paths.d.ts.map +0 -1
- package/dist/integrations/sessions/paths.js +0 -14
- package/dist/integrations/sessions/paths.js.map +0 -1
- package/dist/integrations/sessions/run-discovery.d.ts +0 -24
- package/dist/integrations/sessions/run-discovery.d.ts.map +0 -1
- package/dist/integrations/sessions/run-discovery.js +0 -142
- package/dist/integrations/sessions/run-discovery.js.map +0 -1
- package/dist/integrations/sessions/turn-evidence.d.ts +0 -129
- package/dist/integrations/sessions/turn-evidence.d.ts.map +0 -1
- package/dist/integrations/sessions/turn-evidence.js +0 -517
- package/dist/integrations/sessions/turn-evidence.js.map +0 -1
- package/dist/integrations/subagents/history.d.ts +0 -26
- package/dist/integrations/subagents/history.d.ts.map +0 -1
- package/dist/integrations/subagents/history.js +0 -76
- package/dist/integrations/subagents/history.js.map +0 -1
- package/dist/integrations/subagents/runs.d.ts +0 -72
- package/dist/integrations/subagents/runs.d.ts.map +0 -1
- package/dist/integrations/subagents/runs.js +0 -155
- package/dist/integrations/subagents/runs.js.map +0 -1
- package/dist/tui/run-interruption.d.ts.map +0 -1
- package/dist/tui/run-interruption.js.map +0 -1
- package/dist/tui/run-limits-settings.d.ts +0 -39
- package/dist/tui/run-limits-settings.d.ts.map +0 -1
- package/dist/tui/run-limits-settings.js.map +0 -1
package/dist/config/schema.d.ts
CHANGED
|
@@ -48,17 +48,17 @@ export type HookEvent = ShellHookEvent;
|
|
|
48
48
|
export type HookEntry = ShellHookEntry;
|
|
49
49
|
export type HooksConfig = ShellHooksConfig;
|
|
50
50
|
/** See `NamzuCliConfig.limits`. */
|
|
51
|
-
export interface
|
|
52
|
-
/** Main-loop iterations one
|
|
51
|
+
export interface TurnLimitsConfig {
|
|
52
|
+
/** Main-loop iterations one turn may make. Omitted or 0 means unlimited. */
|
|
53
53
|
readonly maxIterations?: number;
|
|
54
|
-
/** Aggregate prompt and completion tokens for the
|
|
54
|
+
/** Aggregate prompt and completion tokens for the turn and descendants. Omitted or 0 means unlimited. */
|
|
55
55
|
readonly tokenBudget?: number;
|
|
56
|
-
/** Total
|
|
56
|
+
/** Total turn duration in milliseconds. Omitted or 0 means unlimited. */
|
|
57
57
|
readonly timeoutMs?: number;
|
|
58
58
|
/**
|
|
59
|
-
* Milliseconds a headless
|
|
60
|
-
* rate limit, an outage — resuming from its checkpoint after
|
|
61
|
-
* it stops with exit code 75. Default 0: a pause ends
|
|
59
|
+
* Milliseconds a headless `namzu exec` may spend waiting out provider
|
|
60
|
+
* pauses — a rate limit, an outage — resuming from its checkpoint after
|
|
61
|
+
* each, before it stops with exit code 75. Default 0: a pause ends it at once.
|
|
62
62
|
*/
|
|
63
63
|
readonly waitForProviderMs?: number;
|
|
64
64
|
}
|
|
@@ -88,7 +88,7 @@ export interface CompactionCliConfig {
|
|
|
88
88
|
readonly contextWindowTokens?: number;
|
|
89
89
|
/**
|
|
90
90
|
* Use consolidation (one `learning` entry) instead of the default
|
|
91
|
-
* extracted-claim promoter when the
|
|
91
|
+
* extracted-claim promoter when the turn ends. Both write to the project's
|
|
92
92
|
* memory store. This selects the writer; `memory.recall` controls retrieval.
|
|
93
93
|
*/
|
|
94
94
|
readonly consolidate?: boolean;
|
|
@@ -142,7 +142,7 @@ export interface NamzuCliConfig {
|
|
|
142
142
|
* What the operator believes the table above decides, checked at startup.
|
|
143
143
|
*
|
|
144
144
|
* Each entry names a tool, an input, and the expected `"allow" | "ask" |
|
|
145
|
-
* "deny"`. A mismatch is reported by index and the
|
|
145
|
+
* "deny"`. A mismatch is reported by index and the turn continues — the
|
|
146
146
|
* point is to say that a policy does not do what its author said, which
|
|
147
147
|
* a table of globs cannot be read for. Absent means nothing is checked,
|
|
148
148
|
* which is what it meant before this existed.
|
|
@@ -177,12 +177,12 @@ export interface NamzuCliConfig {
|
|
|
177
177
|
/** Executable extension bundles. Absent keeps discovery and imports off. */
|
|
178
178
|
readonly plugins?: PluginConfig;
|
|
179
179
|
/**
|
|
180
|
-
* How far one
|
|
181
|
-
* `
|
|
182
|
-
* them for one
|
|
180
|
+
* How far one turn may go before the kernel stops it. Headless `exec` and
|
|
181
|
+
* `exec --json` read these; `--max-iterations` and `--token-budget` override
|
|
182
|
+
* them for one turn. Absent means unlimited tokens, iterations and turn duration.
|
|
183
183
|
* Explicit token budgets cover descendants.
|
|
184
184
|
*/
|
|
185
|
-
readonly limits?:
|
|
185
|
+
readonly limits?: TurnLimitsConfig;
|
|
186
186
|
/**
|
|
187
187
|
* Isolation for the commands this CLI runs.
|
|
188
188
|
*
|
|
@@ -209,7 +209,7 @@ export interface NamzuCliConfig {
|
|
|
209
209
|
readonly web?: WebConfig;
|
|
210
210
|
/**
|
|
211
211
|
* Shell commands to run at points in the agent's loop: before or after a
|
|
212
|
-
* tool call, when a
|
|
212
|
+
* tool call, when a turn starts or ends. File-only, never from the
|
|
213
213
|
* environment — a hook runs a command with the operator's authority, and
|
|
214
214
|
* a shell profile must not be able to plant one. Exit `2` from a
|
|
215
215
|
* `pre_tool_use` hook blocks the call and tells the model why; any other
|
|
@@ -265,6 +265,20 @@ export interface NamzuCliConfig {
|
|
|
265
265
|
readonly telemetry?: TelemetryConfig;
|
|
266
266
|
/** Interactive-terminal-only behaviour. Absent leaves notifications off. */
|
|
267
267
|
readonly tui?: TuiConfig;
|
|
268
|
+
/**
|
|
269
|
+
* Refresh provider model catalogues in the background on every launch.
|
|
270
|
+
*
|
|
271
|
+
* Today this is the Zen and Zen Go catalogue. Absent or `true` means on: the
|
|
272
|
+
* interactive TUI, `resume`, `exec` and `acp` start one refresh
|
|
273
|
+
* that never delays startup, gives up after 30 seconds, and is cancelled when
|
|
274
|
+
* the command ends. A refresh that lands becomes the catalogue the session
|
|
275
|
+
* lists and routes with and is kept under the application home as the
|
|
276
|
+
* last-good copy; one that fails keeps the last-good copy, or the bundled
|
|
277
|
+
* snapshot, and logs one line. `false` turns it off entirely — no network
|
|
278
|
+
* read, and no last-good copy either: the bundled snapshot alone. Read
|
|
279
|
+
* before a project is trusted, so a project file does not affect it.
|
|
280
|
+
*/
|
|
281
|
+
readonly modelCatalogueRefresh?: boolean;
|
|
268
282
|
}
|
|
269
283
|
export interface TelemetryConfig {
|
|
270
284
|
/**
|
|
@@ -310,14 +324,39 @@ export interface SessionExportConfig {
|
|
|
310
324
|
export type SessionExportRedactorName = 'secrets';
|
|
311
325
|
export interface SandboxConfig {
|
|
312
326
|
/**
|
|
313
|
-
* Run commands inside
|
|
327
|
+
* Run commands inside an OS sandbox.
|
|
328
|
+
*
|
|
329
|
+
* Off by default: commands and file tools run on this machine, under the
|
|
330
|
+
* permission prompts, the way other coding agents run them — a shell
|
|
331
|
+
* command is reviewed before it runs, and a file tool's path outside the
|
|
332
|
+
* working directory and the added directories is an approval request,
|
|
333
|
+
* not a refusal. `true` confines each command to the working directory
|
|
334
|
+
* and the added directories, with the network cut where the platform can
|
|
335
|
+
* cut it; whatever the sandbox cannot reach then needs `/add-dir` or a
|
|
336
|
+
* per-command escape the user approves.
|
|
314
337
|
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
338
|
+
* Unset, it is on when `requireIsolation` names a control or `workspace`
|
|
339
|
+
* is `ephemeral`: both only mean anything inside a sandbox, and dropping
|
|
340
|
+
* a requirement because a switch was left at its default is the silent
|
|
341
|
+
* downgrade this key exists to prevent. The resolved state is announced
|
|
342
|
+
* on startup either way.
|
|
319
343
|
*/
|
|
320
344
|
readonly enabled?: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Whether a sandboxed `bash` call may ask to run one command outside the
|
|
347
|
+
* sandbox (`dangerously_disable_sandbox`). Default `true`: the request is
|
|
348
|
+
* put to the user every time — `auto` and `--yolo` included; `plan` and
|
|
349
|
+
* `strict` refuse it — and written to the session's audit trail. `false`
|
|
350
|
+
* refuses every such request.
|
|
351
|
+
*/
|
|
352
|
+
readonly allowEscape?: boolean;
|
|
353
|
+
/**
|
|
354
|
+
* Whether that escape may be granted with nobody to ask (a headless or
|
|
355
|
+
* `--print` turn, a drained turn). Default `false`: an unattended escape
|
|
356
|
+
* is refused. `true` grants it without a prompt, on the audit record;
|
|
357
|
+
* set it only for a host where leaving the sandbox is already decided.
|
|
358
|
+
*/
|
|
359
|
+
readonly allowUnattendedEscape?: boolean;
|
|
321
360
|
/**
|
|
322
361
|
* Controls this machine must actually enforce, or the CLI refuses to
|
|
323
362
|
* start.
|
|
@@ -339,7 +378,7 @@ export interface SandboxConfig {
|
|
|
339
378
|
*/
|
|
340
379
|
readonly workspace?: 'working-directory' | 'ephemeral';
|
|
341
380
|
/**
|
|
342
|
-
* How long a completed or cancelled
|
|
381
|
+
* How long a completed or cancelled turn waits for sandbox teardown.
|
|
343
382
|
* Defaults to 30 seconds. Set to `0` to preserve the former unbounded wait.
|
|
344
383
|
*/
|
|
345
384
|
readonly teardownTimeoutMs?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","source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,CAAC,SAAS,CAAC,EAAE,mBAAmB,GAAG,WAAW,CAAA;IACtD;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CACnC;AAED,eAAO,MAAM,cAAc,EAAE,cAG3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA6YH,MAAM,CAAC,MAAM,cAAc,GAAmB,MAAM,CAAC,MAAM,CAAC;IAC3D,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,KAAK;CACZ,CAAC,CAAA"}
|
|
@@ -32,7 +32,7 @@ export function toolResultScreenName(entry) {
|
|
|
32
32
|
/**
|
|
33
33
|
* Built on demand rather than held in a table: a screen is cheap and
|
|
34
34
|
* stateless, and a shared instance would be one more thing a caller could
|
|
35
|
-
* mutate out from under a later
|
|
35
|
+
* mutate out from under a later turn.
|
|
36
36
|
*/
|
|
37
37
|
function buildScreen(entry) {
|
|
38
38
|
const name = toolResultScreenName(entry);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SessionLog, TurnId } from '@namzu/sdk';
|
|
2
|
+
import type { NamzuCliConfig } from './schema.js';
|
|
3
|
+
/** The `limits` block of a CLI config: what one turn may spend. */
|
|
4
|
+
type LimitsConfig = NonNullable<NamzuCliConfig['limits']>;
|
|
5
|
+
export type TurnGuardKey = 'tokenBudget' | 'maxIterations' | 'timeoutMs';
|
|
6
|
+
export type TurnGuards = {
|
|
7
|
+
-readonly [K in TurnGuardKey]: number;
|
|
8
|
+
};
|
|
9
|
+
/** CLI policy; independent of the SDK's defaults for embedding hosts. */
|
|
10
|
+
export declare function resolveTurnGuards(...layers: readonly (LimitsConfig | undefined)[]): TurnGuards;
|
|
11
|
+
/**
|
|
12
|
+
* Restore a turn's own limits, including overrides made before a provider
|
|
13
|
+
* pause, from the `turn_started` record that opened it.
|
|
14
|
+
*
|
|
15
|
+
* The session log is the only place a turn's settings are written, so this
|
|
16
|
+
* reads the log rather than a sidecar. The read is strict: a log whose chain
|
|
17
|
+
* does not verify is refused rather than trusted for the limits a resumed
|
|
18
|
+
* turn runs under. `undefined` means the log holds no such turn, which is
|
|
19
|
+
* what an embedded host that never recorded one looks like.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readStoredTurnGuards(log: Pick<SessionLog, 'sessionId' | 'read'>, turnId: TurnId): Promise<TurnGuards | undefined>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=turn-guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-guards.d.ts","sourceRoot":"","sources":["../../src/config/turn-guards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,mEAAmE;AACnE,KAAK,YAAY,GAAG,WAAW,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEzD,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,eAAe,GAAG,WAAW,CAAA;AACxE,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,UAAU,CAAC,IAAI,YAAY,GAAG,MAAM;CAAE,CAAA;AAIlE,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,GAAG,MAAM,EAAE,SAAS,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,GAAG,UAAU,CAkB9F;AAED;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACzC,GAAG,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,MAAM,CAAC,EAC3C,MAAM,EAAE,MAAM,GACZ,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAejC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const GUARD_KEYS = ['tokenBudget', 'maxIterations', 'timeoutMs'];
|
|
2
|
+
/** CLI policy; independent of the SDK's defaults for embedding hosts. */
|
|
3
|
+
export function resolveTurnGuards(...layers) {
|
|
4
|
+
const resolved = { tokenBudget: 0, maxIterations: 0, timeoutMs: 0 };
|
|
5
|
+
for (const layer of layers) {
|
|
6
|
+
for (const key of GUARD_KEYS) {
|
|
7
|
+
const value = layer?.[key];
|
|
8
|
+
if (value === undefined)
|
|
9
|
+
continue;
|
|
10
|
+
if (!Number.isSafeInteger(value) ||
|
|
11
|
+
value < 0 ||
|
|
12
|
+
(key === 'timeoutMs' && value > 2_147_483_647))
|
|
13
|
+
throw new Error(`Invalid ${key}: use a nonnegative safe integer${key === 'timeoutMs' ? ' at most 2147483647' : ''}. 0 means unlimited.`);
|
|
14
|
+
resolved[key] = value;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return resolved;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Restore a turn's own limits, including overrides made before a provider
|
|
21
|
+
* pause, from the `turn_started` record that opened it.
|
|
22
|
+
*
|
|
23
|
+
* The session log is the only place a turn's settings are written, so this
|
|
24
|
+
* reads the log rather than a sidecar. The read is strict: a log whose chain
|
|
25
|
+
* does not verify is refused rather than trusted for the limits a resumed
|
|
26
|
+
* turn runs under. `undefined` means the log holds no such turn, which is
|
|
27
|
+
* what an embedded host that never recorded one looks like.
|
|
28
|
+
*/
|
|
29
|
+
export async function readStoredTurnGuards(log, turnId) {
|
|
30
|
+
for await (const { record } of log.read({ mode: 'strict' })) {
|
|
31
|
+
if (record.type !== 'turn_started' || record.turnId !== turnId)
|
|
32
|
+
continue;
|
|
33
|
+
if (record.sessionId !== log.sessionId)
|
|
34
|
+
throw new Error('Turn record belongs to a different session than the resumed turn');
|
|
35
|
+
const config = { ...record.config };
|
|
36
|
+
if (GUARD_KEYS.some((key) => typeof config[key] !== 'number'))
|
|
37
|
+
throw new Error('Turn record does not contain its original limits');
|
|
38
|
+
return resolveTurnGuards({
|
|
39
|
+
tokenBudget: config.tokenBudget,
|
|
40
|
+
maxIterations: config.maxIterations,
|
|
41
|
+
timeoutMs: config.timeoutMs,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=turn-guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-guards.js","sourceRoot":"","sources":["../../src/config/turn-guards.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,GAAG,CAAC,aAAa,EAAE,eAAe,EAAE,WAAW,CAAU,CAAA;AAEzE,yEAAyE;AACzE,MAAM,UAAU,iBAAiB,CAAC,GAAG,MAA6C;IACjF,MAAM,QAAQ,GAAe,EAAE,WAAW,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAA;IAC/E,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,KAAK,EAAE,CAAC,GAAG,CAAC,CAAA;YAC1B,IAAI,KAAK,KAAK,SAAS;gBAAE,SAAQ;YACjC,IACC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;gBAC5B,KAAK,GAAG,CAAC;gBACT,CAAC,GAAG,KAAK,WAAW,IAAI,KAAK,GAAG,aAAa,CAAC;gBAE9C,MAAM,IAAI,KAAK,CACd,WAAW,GAAG,mCAAmC,GAAG,KAAK,WAAW,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,sBAAsB,CACvH,CAAA;YACF,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACtB,CAAC;IACF,CAAC;IACD,OAAO,QAAQ,CAAA;AAChB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,GAA2C,EAC3C,MAAc;IAEd,IAAI,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;QAC7D,IAAI,MAAM,CAAC,IAAI,KAAK,cAAc,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM;YAAE,SAAQ;QACxE,IAAI,MAAM,CAAC,SAAS,KAAK,GAAG,CAAC,SAAS;YACrC,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAA;QACpF,MAAM,MAAM,GAA4B,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,CAAA;QAC5D,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;QACpE,OAAO,iBAAiB,CAAC;YACxB,WAAW,EAAE,MAAM,CAAC,WAAqB;YACzC,aAAa,EAAE,MAAM,CAAC,aAAuB;YAC7C,SAAS,EAAE,MAAM,CAAC,SAAmB;SACrC,CAAC,CAAA;IACH,CAAC;IACD,OAAO,SAAS,CAAA;AACjB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The session's added directories: the ones `/add-dir` extends and every turn
|
|
3
|
+
* reads fresh — the query, the sandbox binds and the environment prompt.
|
|
4
|
+
*/
|
|
5
|
+
export interface SessionDirectories {
|
|
6
|
+
list(): readonly string[];
|
|
7
|
+
/**
|
|
8
|
+
* Add one for the rest of the session, stored under its canonical path.
|
|
9
|
+
*
|
|
10
|
+
* A directory inside the working directory is not added: the tools
|
|
11
|
+
* already reach it, and a root inside the tree the agent writes to is one
|
|
12
|
+
* a later command could swap for a link.
|
|
13
|
+
*
|
|
14
|
+
* A directory outside the working directory — decided after links are
|
|
15
|
+
* followed — is added only when `approve` answers yes for the canonical
|
|
16
|
+
* path it leads to. Adding one lets every file tool reach
|
|
17
|
+
* it with no further question, which is exactly the question a path there
|
|
18
|
+
* otherwise gets, so the user is asked once here instead. Without an
|
|
19
|
+
* `approve` such a directory is refused: an add that nobody confirmed is
|
|
20
|
+
* not one this session makes on its own.
|
|
21
|
+
*/
|
|
22
|
+
add(path: string, options?: {
|
|
23
|
+
readonly approve?: (absolute: string) => Promise<boolean>;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
readonly added: boolean;
|
|
26
|
+
readonly path: string;
|
|
27
|
+
readonly reason?: string;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The session's directories over a list the caller keeps.
|
|
32
|
+
*
|
|
33
|
+
* The list is shared rather than copied: the session reads it at every turn,
|
|
34
|
+
* and `/add-dir` must be visible to the next one.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createSessionDirectories(cwd: string, directories: string[]): SessionDirectories;
|
|
37
|
+
//# sourceMappingURL=directories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directories.d.ts","sourceRoot":"","sources":["../../src/context/directories.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,IAAI,IAAI,SAAS,MAAM,EAAE,CAAA;IACzB;;;;;;;;;;;;;;OAcG;IACH,GAAG,CACF,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,GACrE,OAAO,CAAC;QACV,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;QACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KACxB,CAAC,CAAA;CACF;AAQD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,kBAAkB,CAqD/F"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { realpath, stat } from 'node:fs/promises';
|
|
2
|
+
import { isAbsolute, relative, resolve } from 'node:path';
|
|
3
|
+
/** True when `candidate` is `root` or below it. */
|
|
4
|
+
function isInside(root, candidate) {
|
|
5
|
+
const rel = relative(root, candidate);
|
|
6
|
+
return rel === '' || (!rel.startsWith('..') && !isAbsolute(rel));
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The session's directories over a list the caller keeps.
|
|
10
|
+
*
|
|
11
|
+
* The list is shared rather than copied: the session reads it at every turn,
|
|
12
|
+
* and `/add-dir` must be visible to the next one.
|
|
13
|
+
*/
|
|
14
|
+
export function createSessionDirectories(cwd, directories) {
|
|
15
|
+
const root = resolve(cwd);
|
|
16
|
+
return {
|
|
17
|
+
list: () => [...directories],
|
|
18
|
+
add: async (path, options) => {
|
|
19
|
+
const absolute = resolve(root, path);
|
|
20
|
+
if (absolute === root)
|
|
21
|
+
return { added: false, path: absolute, reason: 'That is the working directory.' };
|
|
22
|
+
if (directories.includes(absolute))
|
|
23
|
+
return { added: false, path: absolute, reason: 'Already added.' };
|
|
24
|
+
const entry = await stat(absolute).catch(() => null);
|
|
25
|
+
if (!entry?.isDirectory())
|
|
26
|
+
return { added: false, path: absolute, reason: 'Not a directory.' };
|
|
27
|
+
// Decided on canonical paths, because the file tools resolve an
|
|
28
|
+
// added directory through its links (`resolveWithinReal`): a
|
|
29
|
+
// lexical test would call `./link -> /elsewhere` inside, add it
|
|
30
|
+
// unasked, and every tool would then reach /elsewhere. The
|
|
31
|
+
// question names where it really leads.
|
|
32
|
+
const real = await realpath(absolute);
|
|
33
|
+
const realRoot = await realpath(root).catch(() => root);
|
|
34
|
+
if (real === realRoot)
|
|
35
|
+
return { added: false, path: absolute, reason: 'That is the working directory.' };
|
|
36
|
+
// Inside the working directory there is nothing to add: the tools
|
|
37
|
+
// already reach it. Adding it anyway would make a root the agent can
|
|
38
|
+
// rewrite — `rm -r sub && ln -s /elsewhere sub` from one command, a
|
|
39
|
+
// sandboxed one included — and the file tools canonicalize a root at
|
|
40
|
+
// every call, so the added root would then lead elsewhere unasked.
|
|
41
|
+
if (isInside(realRoot, real)) {
|
|
42
|
+
return {
|
|
43
|
+
added: false,
|
|
44
|
+
path: real,
|
|
45
|
+
reason: 'It is inside the working directory, which the tools already reach.',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (directories.includes(real))
|
|
49
|
+
return { added: false, path: real, reason: 'Already added.' };
|
|
50
|
+
if (!options?.approve) {
|
|
51
|
+
return {
|
|
52
|
+
added: false,
|
|
53
|
+
path: absolute,
|
|
54
|
+
reason: 'It is outside the working directory, and adding it needs your approval, which this surface cannot ask for.',
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (!(await options.approve(real))) {
|
|
58
|
+
return { added: false, path: absolute, reason: 'Not approved.' };
|
|
59
|
+
}
|
|
60
|
+
// The canonical path, the one that was approved — never the spelling.
|
|
61
|
+
// The file tools canonicalize a root at every call, so a stored
|
|
62
|
+
// `./link` would follow wherever the link points later, not where it
|
|
63
|
+
// pointed when the question was asked.
|
|
64
|
+
directories.push(real);
|
|
65
|
+
return { added: true, path: real };
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=directories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directories.js","sourceRoot":"","sources":["../../src/context/directories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAiCzD,mDAAmD;AACnD,SAAS,QAAQ,CAAC,IAAY,EAAE,SAAiB;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es when the fact changes, a fresh read costs a cache miss
|
|
32
32
|
* exactly when a cache hit would have been wrong.
|
|
33
33
|
*/
|
|
34
|
+
/**
|
|
35
|
+
* Where the tools run and how the model gets past the edge of it.
|
|
36
|
+
*
|
|
37
|
+
* The model used to learn its boundary from refusal strings — "Path escapes
|
|
38
|
+
* the working directory… Tools may only reach inside X" — and read every one
|
|
39
|
+
* as a wall, including the ones with a door in them. Stated up front, it can
|
|
40
|
+
* say what it can reach, and ask for the right thing when it cannot.
|
|
41
|
+
*/
|
|
42
|
+
export interface ExecutionBoundary {
|
|
43
|
+
/** Present when commands run in the OS sandbox; absent means the host. */
|
|
44
|
+
readonly sandbox?: {
|
|
45
|
+
/** The environment the sandbox resolved to, e.g. `linux-bwrap`. */
|
|
46
|
+
readonly environment: string;
|
|
47
|
+
/** Controls this machine actually applies, e.g. `filesystem`, `network`. */
|
|
48
|
+
readonly enforced: readonly string[];
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* What a sandboxed command's `dangerously_disable_sandbox` gets: put to the
|
|
52
|
+
* user (`ask`), granted unasked by configuration (`unattended`), or refused
|
|
53
|
+
* (`refused` — escapes off, or nobody to ask). Ignored on the host.
|
|
54
|
+
*/
|
|
55
|
+
readonly escape: 'ask' | 'unattended' | 'refused';
|
|
56
|
+
/** Whether a person answers the permission prompts in this session. */
|
|
57
|
+
readonly interactive: boolean;
|
|
58
|
+
}
|
|
59
|
+
/** What the model needs to know about running under WSL. */
|
|
60
|
+
export interface WslFacts {
|
|
61
|
+
/** `WSL_DISTRO_NAME`, when the environment carries it. */
|
|
62
|
+
readonly distro: string | null;
|
|
63
|
+
/** Windows executables can be started from the Linux side. */
|
|
64
|
+
readonly interop: boolean;
|
|
65
|
+
/** Windows drives mounted under `/mnt`, as `/mnt/<letter>`. */
|
|
66
|
+
readonly drives: readonly string[];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* WSL, or `undefined` on any other Linux.
|
|
70
|
+
*
|
|
71
|
+
* The environment is the signal: WSL sets `WSL_DISTRO_NAME` in every
|
|
72
|
+
* process it starts, and `WSL_INTEROP` names the interop socket when interop
|
|
73
|
+
* is on. Interop also counts as on when its binfmt handler is registered
|
|
74
|
+
* (`/proc/sys/fs/binfmt_misc/WSLInterop`), which survives a shell that
|
|
75
|
+
* dropped the variable. Drives are the one-letter directories under `/mnt`
|
|
76
|
+
* — `/mnt/wsl` and `/mnt/wslg` are WSL's own and are not drives.
|
|
77
|
+
*
|
|
78
|
+
* Every probe is injectable so a test can describe a machine it is not
|
|
79
|
+
* running on; the defaults read this one.
|
|
80
|
+
*/
|
|
81
|
+
export declare function detectWsl(env?: NodeJS.ProcessEnv, probe?: {
|
|
82
|
+
readonly exists?: (path: string) => boolean;
|
|
83
|
+
readonly list?: (path: string) => readonly string[];
|
|
84
|
+
}): WslFacts | undefined;
|
|
34
85
|
export interface EnvironmentFacts {
|
|
35
86
|
/** ISO calendar date, `YYYY-MM-DD`, in the machine's own timezone. */
|
|
36
87
|
readonly today: string;
|
|
37
88
|
/** Directories besides the working directory the file tools may reach, absolute. */
|
|
38
89
|
readonly additionalDirectories?: readonly string[];
|
|
90
|
+
/** Where the tools run; absent leaves the boundary unstated, as before. */
|
|
91
|
+
readonly boundary?: ExecutionBoundary;
|
|
92
|
+
/** Present when this is WSL. */
|
|
93
|
+
readonly wsl?: WslFacts;
|
|
39
94
|
/**
|
|
40
95
|
* `branch` when on one, `null` when the working directory is not a
|
|
41
96
|
* repository, `'detached'` when it is one with no branch checked out.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/context/environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/context/environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAWH;;;;;;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;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;CAC9B;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,IAAI,GAAG,MAAM,CAG9C;AAeD,wBAAsB,oBAAoB,CACzC,GAAG,EAAE,MAAM,EACX,GAAG,GAAE,IAAiB,GACpB,OAAO,CAAC,gBAAgB,CAAC,CAmB3B;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAsBxE"}
|
|
@@ -32,10 +32,46 @@
|
|
|
32
32
|
* exactly when a cache hit would have been wrong.
|
|
33
33
|
*/
|
|
34
34
|
import { execFile } from 'node:child_process';
|
|
35
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
35
36
|
import { promisify } from 'node:util';
|
|
36
37
|
const run = promisify(execFile);
|
|
37
38
|
/** Bound on a single git call. A wedged repository must not stall a turn. */
|
|
38
39
|
const GIT_TIMEOUT_MS = 2_000;
|
|
40
|
+
/**
|
|
41
|
+
* WSL, or `undefined` on any other Linux.
|
|
42
|
+
*
|
|
43
|
+
* The environment is the signal: WSL sets `WSL_DISTRO_NAME` in every
|
|
44
|
+
* process it starts, and `WSL_INTEROP` names the interop socket when interop
|
|
45
|
+
* is on. Interop also counts as on when its binfmt handler is registered
|
|
46
|
+
* (`/proc/sys/fs/binfmt_misc/WSLInterop`), which survives a shell that
|
|
47
|
+
* dropped the variable. Drives are the one-letter directories under `/mnt`
|
|
48
|
+
* — `/mnt/wsl` and `/mnt/wslg` are WSL's own and are not drives.
|
|
49
|
+
*
|
|
50
|
+
* Every probe is injectable so a test can describe a machine it is not
|
|
51
|
+
* running on; the defaults read this one.
|
|
52
|
+
*/
|
|
53
|
+
export function detectWsl(env = process.env, probe = {}) {
|
|
54
|
+
const distro = env.WSL_DISTRO_NAME?.trim() || null;
|
|
55
|
+
const socket = env.WSL_INTEROP?.trim() || null;
|
|
56
|
+
if (!distro && !socket)
|
|
57
|
+
return undefined;
|
|
58
|
+
const exists = probe.exists ?? existsSync;
|
|
59
|
+
const list = probe.list ??
|
|
60
|
+
((path) => {
|
|
61
|
+
try {
|
|
62
|
+
return readdirSync(path);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const interop = socket !== null || exists('/proc/sys/fs/binfmt_misc/WSLInterop');
|
|
69
|
+
const drives = list('/mnt')
|
|
70
|
+
.filter((name) => /^[a-z]$/i.test(name))
|
|
71
|
+
.sort()
|
|
72
|
+
.map((name) => `/mnt/${name}`);
|
|
73
|
+
return { distro, interop, drives };
|
|
74
|
+
}
|
|
39
75
|
/**
|
|
40
76
|
* The machine's local calendar date.
|
|
41
77
|
*
|
|
@@ -94,7 +130,67 @@ export function composeEnvironmentPrompt(facts) {
|
|
|
94
130
|
if (facts.additionalDirectories && facts.additionalDirectories.length > 0) {
|
|
95
131
|
lines.push(`Besides the working directory, the file tools may reach these directories, by absolute path: ${facts.additionalDirectories.map((d) => `\`${d}\``).join(', ')}. Relative paths still resolve against the working directory.`);
|
|
96
132
|
}
|
|
133
|
+
if (facts.boundary)
|
|
134
|
+
lines.push(...boundaryLines(facts.boundary));
|
|
135
|
+
if (facts.wsl)
|
|
136
|
+
lines.push(...wslLines(facts.wsl, facts.boundary));
|
|
97
137
|
lines.push('These are facts about right now. Prefer them over any date or branch you would otherwise assume.');
|
|
98
138
|
return `## Environment\n\n${lines.join('\n')}`;
|
|
99
139
|
}
|
|
140
|
+
/** The boundary, and the way past it, in the words the model acts on. */
|
|
141
|
+
function boundaryLines(boundary) {
|
|
142
|
+
if (!boundary.sandbox) {
|
|
143
|
+
const outside = boundary.interactive
|
|
144
|
+
? 'A path anywhere else is not refused outright: the user is asked to approve that call first, every time — in plan mode too, for a read; the strict permission mode refuses it. When you need a directory repeatedly, suggest the user add it with `/add-dir <path>`.'
|
|
145
|
+
: 'A path anywhere else is refused in this session, because it needs a person to approve it and nobody is at the terminal. If you need one, say which directory and why, so the user can add it (`--add-dir <path>`) and run again.';
|
|
146
|
+
return [
|
|
147
|
+
'Tools run on this machine, not in a sandbox: shell commands and file changes go through the permission settings, which may ask the user before they run.',
|
|
148
|
+
`The file tools reach the working directory and any added directories directly. ${outside} A refusal that remains is a decision, not a missing file; say so rather than retrying another spelling.`,
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
const { environment, enforced } = boundary.sandbox;
|
|
152
|
+
const network = enforced.includes('network')
|
|
153
|
+
? ' The network is cut inside it.'
|
|
154
|
+
: ' It does not cut the network on this machine.';
|
|
155
|
+
const escapeRoute = boundary.escape === 'ask'
|
|
156
|
+
? 'When one command genuinely cannot work inside it (it needs the network, a path it does not mount, or a host tool), set `dangerously_disable_sandbox: true` on that one `bash` call: the user is asked to approve it every time, whatever else is approved; the plan and strict permission modes refuse it. Never use it to get around a permission refusal.'
|
|
157
|
+
: boundary.escape === 'unattended'
|
|
158
|
+
? 'When one command genuinely cannot work inside it, `dangerously_disable_sandbox: true` on that `bash` call runs it on the host: this session is configured to allow that without asking, and every use is recorded. Use it only when the sandbox is the obstacle.'
|
|
159
|
+
: 'Commands cannot leave the sandbox in this session. When one needs something the sandbox withholds, say what and why, and let the user decide.';
|
|
160
|
+
// Said per what the platform enforces, never more. A tier that does not
|
|
161
|
+
// confine the file system (`linux-namespace`, `basic`) leaves the whole
|
|
162
|
+
// host visible to a command; one that does still shows it the system
|
|
163
|
+
// directories programs need, read-only, and a private /tmp.
|
|
164
|
+
const files = enforced.includes('filesystem')
|
|
165
|
+
? ' Inside it, commands can read and write the working directory and the added directories; the system directories programs need are readable, /tmp is private to the command, and the rest of this machine (the home directory, other projects, other mounts) cannot be reached from it, so no spelling of such a path will be found.'
|
|
166
|
+
: ' It does not confine the file system here, so commands can still see files outside the working directory.';
|
|
167
|
+
return [
|
|
168
|
+
`Shell commands run in a sandbox (${environment}${enforced.length > 0 ? `, enforcing ${enforced.join(', ')}` : ', enforcing nothing on this platform'}).${files}${network} The file tools reach only the working directory and the added directories.`,
|
|
169
|
+
`To reach another directory, ask the user to add it with \`/add-dir <path>\` (the next turn binds it). ${escapeRoute}`,
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
/** WSL: where the Windows side is, and how to reach it from here. */
|
|
173
|
+
function wslLines(wsl, boundary) {
|
|
174
|
+
// Only a sandbox that confines the file system hides the drives; one that
|
|
175
|
+
// does not leaves them visible to commands, like the host.
|
|
176
|
+
const sandboxed = boundary?.sandbox?.enforced.includes('filesystem') === true;
|
|
177
|
+
const fileTools = boundary?.sandbox !== undefined
|
|
178
|
+
? 'the file tools reach them only once added with `/add-dir`'
|
|
179
|
+
: boundary?.interactive === false
|
|
180
|
+
? 'a file tool reaching them is refused in this session, since nobody is here to approve it'
|
|
181
|
+
: 'a file tool reaching them asks for approval first, like any other outside path';
|
|
182
|
+
const drives = wsl.drives.length > 0
|
|
183
|
+
? `Windows drives are mounted under ${wsl.drives.map((d) => `\`${d}\``).join(', ')} (\`C:\\Users\` is \`/mnt/c/Users\`; \`wslpath -w\` and \`wslpath -u\` convert).`
|
|
184
|
+
: 'No Windows drive is mounted under `/mnt` right now.';
|
|
185
|
+
const reach = sandboxed
|
|
186
|
+
? 'They are outside the sandbox, so a command there needs `/add-dir` or the sandbox escape.'
|
|
187
|
+
: `They are outside the working directory, so ${fileTools}.`;
|
|
188
|
+
const interop = wsl.interop
|
|
189
|
+
? `Windows programs start from the shell through WSL interop, by their \`.exe\` name: \`powershell.exe -NoProfile -Command ...\`, \`cmd.exe /c ...\`, \`explorer.exe .\`. \`cmd.exe\` started from a Linux directory warns that UNC paths are unsupported and falls back to C:\\Windows, so \`cd\` under \`/mnt/c\` first or use \`powershell.exe\`. If a name is not found, the Windows side of \`PATH\` was not appended; \`cmd.exe\` is under \`/mnt/c/Windows/System32\` and \`powershell.exe\` under its \`WindowsPowerShell/v1.0\`.${sandboxed ? ' The sandbox does not mount the Windows drives those programs live on, so running one needs the sandbox escape.' : ''}`
|
|
190
|
+
: 'WSL interop is off here, so Windows `.exe` programs cannot be started from the shell.';
|
|
191
|
+
return [
|
|
192
|
+
`This machine is Windows Subsystem for Linux${wsl.distro ? ` (distro \`${wsl.distro}\`)` : ''}. ${drives} ${reach}`,
|
|
193
|
+
interop,
|
|
194
|
+
];
|
|
195
|
+
}
|
|
100
196
|
//# sourceMappingURL=environment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/context/environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA;AAE/B,6EAA6E;AAC7E,MAAM,cAAc,GAAG,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/context/environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA;AAE/B,6EAA6E;AAC7E,MAAM,cAAc,GAAG,KAAK,CAAA;AAsC5B;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CACxB,MAAyB,OAAO,CAAC,GAAG,EACpC,QAGI,EAAE;IAEN,MAAM,MAAM,GAAG,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,IAAI,CAAA;IAClD,MAAM,M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AM,MAAM,GACX,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QACpB,CAAC,CAAC,oCAAoC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,kFAAkF;QACpK,CAAC,CAAC,qDAAqD,CAAA;IACzD,MAAM,KAAK,GAAG,SAAS;QACtB,CAAC,CAAC,0FAA0F;QAC5F,CAAC,CAAC,8CAA8C,SAAS,GAAG,CAAA;IAC7D,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO;QAC1B,CAAC,CAAC,ygBAAygB,SAAS,CAAC,CAAC,CAAC,iHAAiH,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/oB,CAAC,CAAC,uFAAuF,CAAA;IAC1F,OAAO;QACN,8CAA8C,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,IAAI,KAAK,EAAE;QACnH,OAAO;KACP,CAAA;AACF,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { type SkippedInstructionFile } from './project.js';
|
|
|
3
3
|
/** Total model-visible instruction text held by one session. */
|
|
4
4
|
export declare const MAX_TOTAL_PROJECT_INSTRUCTION_CHARS = 256000;
|
|
5
5
|
/**
|
|
6
|
-
* Session-owned live instruction state. Each
|
|
6
|
+
* Session-owned live instruction state. Each turn gets its own drain cursor;
|
|
7
7
|
* children share discovery without being able to consume the parent's update.
|
|
8
8
|
*/
|
|
9
9
|
export declare class ProjectInstructionTracker {
|
|
@@ -15,8 +15,8 @@ export declare class ProjectInstructionTracker {
|
|
|
15
15
|
rehydrate(messages: readonly Message[]): void;
|
|
16
16
|
/** Refresh known scopes and return the exact policy for a new human turn. */
|
|
17
17
|
prepareSnapshot(messages: readonly Message[]): UserMessage | null;
|
|
18
|
-
/** Each
|
|
19
|
-
|
|
18
|
+
/** Each turn's durable messages are its cursor over the shared discovered state. */
|
|
19
|
+
createTurnContext(): ProjectInstructionContext;
|
|
20
20
|
get instructionFiles(): readonly string[];
|
|
21
21
|
get skippedInstructionFiles(): readonly SkippedInstructionFile[];
|
|
22
22
|
private observe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-tracker.d.ts","sourceRoot":"","sources":["../../src/context/project-tracker.ts"],"names":[],"mappings":"AAEA,OAAO,EAEN,KAAK,OAAO,EACZ,KAAK,yBAAyB,EAE9B,KAAK,WAAW,EAGhB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAIN,KAAK,sBAAsB,EAG3B,MAAM,cAAc,CAAA;AAErB,gEAAgE;AAChE,eAAO,MAAM,mCAAmC,SAAU,CAAA;AA0D1D;;;GAGG;AACH,qBAAa,yBAAyB;IACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAQ;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;gBAE3C,GAAG,EAAE,MAAM;IAMvB,mFAAmF;IACnF,SAAS,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI;IAa7C,6EAA6E;IAC7E,eAAe,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,WAAW,GAAG,IAAI;IAKjE,
|
|
1
|
+
{"version":3,"file":"project-tracker.d.ts","sourceRoot":"","sources":["../../src/context/project-tracker.ts"],"names":[],"mappings":"AAEA,OAAO,EAEN,KAAK,OAAO,EACZ,KAAK,yBAAyB,EAE9B,KAAK,WAAW,EAGhB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAIN,KAAK,sBAAsB,EAG3B,MAAM,cAAc,CAAA;AAErB,gEAAgE;AAChE,eAAO,MAAM,mCAAmC,SAAU,CAAA;AA0D1D;;;GAGG;AACH,qBAAa,yBAAyB;IACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IA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