@armadra/agent 0.3.0 → 0.5.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 +257 -0
- package/README.md +263 -95
- package/THIRD_PARTY_NOTICES.md +34 -0
- package/dist/acp.d.ts +18 -0
- package/dist/acp.js +19 -0
- package/dist/agent/limits.d.ts +38 -0
- package/dist/agent/limits.js +127 -0
- package/dist/agent/loop-guard.d.ts +38 -0
- package/dist/agent/loop-guard.js +95 -0
- package/dist/agent/loop.d.ts +4 -0
- package/dist/agent/loop.js +7 -0
- package/dist/agent/prompt-rules.d.ts +12 -0
- package/dist/agent/prompt-rules.js +18 -0
- package/dist/agent/reminders.d.ts +59 -0
- package/dist/agent/reminders.js +327 -0
- package/dist/agent/retry.d.ts +1 -1
- package/dist/agent/retry.js +2 -1
- package/dist/agent/session-cache.d.ts +5 -0
- package/dist/agent/session-cache.js +18 -2
- package/dist/agent/session-classifier.d.ts +18 -0
- package/dist/agent/session-classifier.js +105 -0
- package/dist/agent/session-compaction.d.ts +35 -6
- package/dist/agent/session-compaction.js +157 -31
- package/dist/agent/session-core.d.ts +40 -1
- package/dist/agent/session-extensions.d.ts +61 -0
- package/dist/agent/session-extensions.js +129 -0
- package/dist/agent/session-images.d.ts +23 -0
- package/dist/agent/session-images.js +97 -0
- package/dist/agent/session-plan.d.ts +21 -0
- package/dist/agent/session-plan.js +524 -0
- package/dist/agent/session-rewind.d.ts +81 -0
- package/dist/agent/session-rewind.js +354 -0
- package/dist/agent/session-run.d.ts +28 -1
- package/dist/agent/session-run.js +157 -6
- package/dist/agent/session-settings.d.ts +49 -0
- package/dist/agent/session-settings.js +95 -0
- package/dist/agent/session-subagent.d.ts +36 -24
- package/dist/agent/session-subagent.js +259 -129
- package/dist/agent/session-sync.d.ts +10 -3
- package/dist/agent/session-sync.js +37 -8
- package/dist/agent/session-telemetry.d.ts +39 -0
- package/dist/agent/session-telemetry.js +231 -0
- package/dist/agent/session-tools.js +63 -3
- package/dist/agent/session.d.ts +33 -29
- package/dist/agent/session.js +91 -126
- package/dist/agent/subagent-registry.d.ts +91 -0
- package/dist/agent/subagent-registry.js +494 -0
- package/dist/agent/system-prompt.d.ts +6 -3
- package/dist/agent/system-prompt.js +7 -2
- package/dist/agent/tool-runner.d.ts +8 -1
- package/dist/agent/tool-runner.js +72 -6
- package/dist/agent/types-w5.d.ts +192 -0
- package/dist/agent/types-w5.js +10 -0
- package/dist/agent/types.d.ts +55 -4
- package/dist/agent/types.js +2 -0
- package/dist/agent/worktree.d.ts +36 -0
- package/dist/agent/worktree.js +86 -0
- package/dist/agents/builtin.d.ts +14 -0
- package/dist/agents/builtin.js +39 -0
- package/dist/agents/catalog.d.ts +43 -0
- package/dist/agents/catalog.js +82 -0
- package/dist/agents/discover.d.ts +35 -0
- package/dist/agents/discover.js +83 -0
- package/dist/agents/external.d.ts +82 -0
- package/dist/agents/external.js +326 -0
- package/dist/agents/parse.d.ts +18 -0
- package/dist/agents/parse.js +116 -0
- package/dist/agents/result.d.ts +32 -0
- package/dist/agents/result.js +67 -0
- package/dist/agents/task-control.d.ts +17 -0
- package/dist/agents/task-control.js +17 -0
- package/dist/agents/task-record.d.ts +78 -0
- package/dist/agents/task-record.js +141 -0
- package/dist/agents/types.d.ts +46 -0
- package/dist/agents/types.js +8 -0
- package/dist/ai/apis/anthropic-compat.d.ts +36 -0
- package/dist/ai/apis/anthropic-compat.js +92 -0
- package/dist/ai/apis/anthropic-messages.js +3 -2
- package/dist/ai/apis/anthropic-request.d.ts +7 -6
- package/dist/ai/apis/anthropic-request.js +10 -28
- package/dist/ai/apis/cache-params.d.ts +11 -2
- package/dist/ai/apis/cache-params.js +25 -6
- package/dist/ai/apis/google-generative-ai.js +3 -2
- package/dist/ai/apis/openai-compat.d.ts +4 -1
- package/dist/ai/apis/openai-compat.js +8 -1
- package/dist/ai/apis/openai-completions.js +3 -2
- package/dist/ai/apis/openai-responses.js +3 -2
- package/dist/ai/http.d.ts +28 -6
- package/dist/ai/http.js +41 -8
- package/dist/ai/image-limits.d.ts +45 -0
- package/dist/ai/image-limits.js +68 -0
- package/dist/ai/providers/builtin.d.ts +18 -6
- package/dist/ai/providers/builtin.js +135 -6
- package/dist/ai/providers/catalog-data.js +17 -13
- package/dist/ai/providers/catalog.d.ts +60 -7
- package/dist/ai/providers/catalog.js +197 -38
- package/dist/ai/providers/channels.d.ts +33 -3
- package/dist/ai/providers/channels.js +108 -7
- package/dist/ai/providers/enrich.d.ts +6 -3
- package/dist/ai/providers/enrich.js +19 -4
- package/dist/ai/providers/models-dev-cache.d.ts +28 -24
- package/dist/ai/providers/models-dev-cache.js +92 -78
- package/dist/ai/providers/models-dev-data.d.ts +7 -0
- package/dist/ai/providers/models-dev-data.js +32 -0
- package/dist/ai/providers/models-dev-snapshot.d.ts +50 -0
- package/dist/ai/providers/models-dev-snapshot.js +137 -0
- package/dist/ai/providers/models-dev.d.ts +51 -10
- package/dist/ai/providers/models-dev.js +132 -39
- package/dist/ai/providers/registry.d.ts +28 -11
- package/dist/ai/providers/registry.js +112 -65
- package/dist/ai/providers/suggest.d.ts +18 -0
- package/dist/ai/providers/suggest.js +72 -0
- package/dist/ai/sse.d.ts +6 -2
- package/dist/ai/sse.js +22 -2
- package/dist/ai/types.d.ts +37 -4
- package/dist/ai/types.js +5 -0
- package/dist/bundle/ama.cjs +41979 -21147
- package/dist/checkpoints/backend.d.ts +61 -0
- package/dist/checkpoints/backend.js +135 -0
- package/dist/checkpoints/blobs.d.ts +60 -0
- package/dist/checkpoints/blobs.js +203 -0
- package/dist/checkpoints/gc.d.ts +47 -0
- package/dist/checkpoints/gc.js +144 -0
- package/dist/checkpoints/git-head.d.ts +15 -0
- package/dist/checkpoints/git-head.js +89 -0
- package/dist/checkpoints/index.d.ts +17 -0
- package/dist/checkpoints/index.js +17 -0
- package/dist/checkpoints/replay.d.ts +48 -0
- package/dist/checkpoints/replay.js +154 -0
- package/dist/checkpoints/restore.d.ts +86 -0
- package/dist/checkpoints/restore.js +263 -0
- package/dist/checkpoints/settings.d.ts +14 -0
- package/dist/checkpoints/settings.js +23 -0
- package/dist/checkpoints/shadow-git.d.ts +108 -0
- package/dist/checkpoints/shadow-git.js +491 -0
- package/dist/checkpoints/shadow-restore.d.ts +25 -0
- package/dist/checkpoints/shadow-restore.js +128 -0
- package/dist/checkpoints/tracker.d.ts +64 -0
- package/dist/checkpoints/tracker.js +192 -0
- package/dist/checkpoints/types.d.ts +99 -0
- package/dist/checkpoints/types.js +12 -0
- package/dist/cli/args.d.ts +26 -7
- package/dist/cli/args.js +75 -82
- package/dist/cli/bootstrap.js +40 -4
- package/dist/cli/codemode-notice.d.ts +21 -0
- package/dist/cli/codemode-notice.js +56 -0
- package/dist/cli/compose-agents.d.ts +27 -0
- package/dist/cli/compose-agents.js +111 -0
- package/dist/cli/compose-extensions.d.ts +29 -0
- package/dist/cli/compose-extensions.js +44 -0
- package/dist/cli/compose-session.d.ts +8 -0
- package/dist/cli/compose-session.js +76 -2
- package/dist/cli/compose-store.d.ts +1 -1
- package/dist/cli/compose-store.js +3 -1
- package/dist/cli/compose.d.ts +17 -4
- package/dist/cli/compose.js +60 -14
- package/dist/cli/default-model.d.ts +38 -1
- package/dist/cli/default-model.js +96 -9
- package/dist/cli/deps.d.ts +42 -0
- package/dist/cli/exit-codes.d.ts +12 -0
- package/dist/cli/exit-codes.js +15 -0
- package/dist/cli/fake-visibility.d.ts +13 -0
- package/dist/cli/fake-visibility.js +26 -0
- package/dist/cli/from-prompt.d.ts +18 -0
- package/dist/cli/from-prompt.js +49 -0
- package/dist/cli/help-text.d.ts +4 -0
- package/dist/cli/help-text.js +102 -0
- package/dist/cli/main.d.ts +9 -2
- package/dist/cli/main.js +77 -3
- package/dist/cli/proxy.d.ts +51 -0
- package/dist/cli/proxy.js +135 -0
- package/dist/cli/startup-screen.d.ts +29 -0
- package/dist/cli/startup-screen.js +51 -2
- package/dist/cli/startup-steps.d.ts +1 -1
- package/dist/cli/startup-steps.js +21 -13
- package/dist/cli/subcommands/config.d.ts +22 -3
- package/dist/cli/subcommands/config.js +119 -21
- package/dist/cli/subcommands/context.js +4 -1
- package/dist/cli/subcommands/doctor.js +33 -1
- package/dist/cli/subcommands/init.js +2 -1
- package/dist/cli/subcommands/models-discover.d.ts +15 -9
- package/dist/cli/subcommands/models-discover.js +58 -52
- package/dist/cli/subcommands/models.d.ts +2 -0
- package/dist/cli/subcommands/models.js +33 -14
- package/dist/cli/subcommands/probe-runner.d.ts +96 -0
- package/dist/cli/subcommands/probe-runner.js +264 -0
- package/dist/cli/subcommands/providers-probe.d.ts +34 -0
- package/dist/cli/subcommands/providers-probe.js +87 -0
- package/dist/cli/subcommands/providers.d.ts +3 -2
- package/dist/cli/subcommands/providers.js +53 -51
- package/dist/cli/subcommands/sessions-export.d.ts +10 -0
- package/dist/cli/subcommands/sessions-export.js +59 -0
- package/dist/cli/subcommands/sessions-search.d.ts +13 -0
- package/dist/cli/subcommands/sessions-search.js +103 -0
- package/dist/cli/subcommands/sessions.d.ts +6 -3
- package/dist/cli/subcommands/sessions.js +58 -3
- package/dist/cli/subcommands/stats.d.ts +17 -0
- package/dist/cli/subcommands/stats.js +198 -0
- package/dist/cli/system-prompt-arg.d.ts +11 -0
- package/dist/cli/system-prompt-arg.js +34 -0
- package/dist/codemode/capability.d.ts +24 -7
- package/dist/codemode/capability.js +38 -10
- package/dist/codemode/host-side.d.ts +14 -0
- package/dist/codemode/host-side.js +24 -1
- package/dist/codemode/modes.d.ts +4 -11
- package/dist/codemode/modes.js +5 -27
- package/dist/codemode/tool.d.ts +18 -14
- package/dist/codemode/tool.js +76 -31
- package/dist/compaction/breaker.d.ts +25 -9
- package/dist/compaction/breaker.js +47 -17
- package/dist/compaction/estimate.d.ts +11 -3
- package/dist/compaction/estimate.js +64 -22
- package/dist/compaction/image-budget.d.ts +45 -0
- package/dist/compaction/image-budget.js +115 -0
- package/dist/compaction/post-compact.d.ts +38 -0
- package/dist/compaction/post-compact.js +152 -0
- package/dist/compaction/protect.d.ts +27 -0
- package/dist/compaction/protect.js +56 -0
- package/dist/compaction/prune-tier.d.ts +58 -12
- package/dist/compaction/prune-tier.js +120 -54
- package/dist/compaction/summarize-tier.d.ts +23 -4
- package/dist/compaction/summarize-tier.js +100 -29
- package/dist/config/checker.d.ts +28 -0
- package/dist/config/checker.js +97 -0
- package/dist/config/init.d.ts +6 -2
- package/dist/config/init.js +12 -5
- package/dist/config/json-schema.d.ts +1 -0
- package/dist/config/json-schema.js +98 -4
- package/dist/config/key-docs.d.ts +22 -0
- package/dist/config/key-docs.js +174 -0
- package/dist/config/merge.d.ts +12 -9
- package/dist/config/merge.js +102 -13
- package/dist/config/profile.d.ts +2 -0
- package/dist/config/profile.js +2 -0
- package/dist/config/schema-w5.d.ts +18 -0
- package/dist/config/schema-w5.js +109 -0
- package/dist/config/schema.d.ts +5 -9
- package/dist/config/schema.js +91 -118
- package/dist/config/types-w5.d.ts +118 -0
- package/dist/config/types-w5.js +20 -0
- package/dist/config/types.d.ts +84 -7
- package/dist/config/types.js +29 -1
- package/dist/drivers/acp/client.d.ts +57 -0
- package/dist/drivers/acp/client.js +160 -0
- package/dist/drivers/acp/driver.d.ts +31 -0
- package/dist/drivers/acp/driver.js +274 -0
- package/dist/drivers/acp/testing/fake-agent-main.d.ts +5 -0
- package/dist/drivers/acp/testing/fake-agent-main.js +7 -0
- package/dist/drivers/acp/testing/fake-agent.d.ts +27 -0
- package/dist/drivers/acp/testing/fake-agent.js +211 -0
- package/dist/drivers/acp/types.d.ts +285 -0
- package/dist/drivers/acp/types.js +36 -0
- package/dist/drivers/agents.d.ts +58 -0
- package/dist/drivers/agents.js +142 -0
- package/dist/drivers/base.d.ts +35 -0
- package/dist/drivers/base.js +59 -0
- package/dist/drivers/catalog.d.ts +46 -0
- package/dist/drivers/catalog.js +167 -0
- package/dist/drivers/env.d.ts +20 -0
- package/dist/drivers/env.js +46 -0
- package/dist/drivers/host-runners.d.ts +18 -0
- package/dist/drivers/host-runners.js +45 -0
- package/dist/drivers/jsonrpc.d.ts +58 -0
- package/dist/drivers/jsonrpc.js +180 -0
- package/dist/drivers/native/claude-normalize.d.ts +46 -0
- package/dist/drivers/native/claude-normalize.js +106 -0
- package/dist/drivers/native/claude-stream.d.ts +29 -0
- package/dist/drivers/native/claude-stream.js +456 -0
- package/dist/drivers/native/codex-app-server.d.ts +26 -0
- package/dist/drivers/native/codex-app-server.js +407 -0
- package/dist/drivers/native/codex-normalize.d.ts +38 -0
- package/dist/drivers/native/codex-normalize.js +124 -0
- package/dist/drivers/native/oneshot.d.ts +28 -0
- package/dist/drivers/native/oneshot.js +312 -0
- package/dist/drivers/permissions.d.ts +40 -0
- package/dist/drivers/permissions.js +92 -0
- package/dist/drivers/pids.d.ts +32 -0
- package/dist/drivers/pids.js +93 -0
- package/dist/drivers/pool.d.ts +28 -0
- package/dist/drivers/pool.js +96 -0
- package/dist/drivers/probe.d.ts +47 -0
- package/dist/drivers/probe.js +172 -0
- package/dist/drivers/process.d.ts +48 -0
- package/dist/drivers/process.js +100 -0
- package/dist/drivers/runner.d.ts +61 -0
- package/dist/drivers/runner.js +388 -0
- package/dist/drivers/store.d.ts +49 -0
- package/dist/drivers/store.js +91 -0
- package/dist/drivers/turn.d.ts +41 -0
- package/dist/drivers/turn.js +99 -0
- package/dist/drivers/types.d.ts +122 -0
- package/dist/drivers/types.js +11 -0
- package/dist/git/info.d.ts +75 -0
- package/dist/git/info.js +191 -0
- package/dist/hooks/protocol.js +6 -1
- package/dist/hooks/types.d.ts +10 -1
- package/dist/hooks/types.js +2 -0
- package/dist/host/api-impl.d.ts +7 -0
- package/dist/host/api-impl.js +15 -0
- package/dist/host/types.d.ts +24 -2
- package/dist/host/types.js +4 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/dist/modes/acp/acp-events.d.ts +46 -0
- package/dist/modes/acp/acp-events.js +233 -0
- package/dist/modes/acp/acp-mode.d.ts +17 -0
- package/dist/modes/acp/acp-mode.js +47 -0
- package/dist/modes/acp/acp-server.d.ts +79 -0
- package/dist/modes/acp/acp-server.js +315 -0
- package/dist/modes/commands-core.d.ts +7 -1
- package/dist/modes/commands-core.js +61 -5
- package/dist/modes/image-input.d.ts +12 -4
- package/dist/modes/image-input.js +22 -5
- package/dist/modes/interactive/agent-panels.d.ts +14 -0
- package/dist/modes/interactive/agent-panels.js +103 -0
- package/dist/modes/interactive/agent-ui.d.ts +73 -0
- package/dist/modes/interactive/agent-ui.js +234 -0
- package/dist/modes/interactive/approval-dialog.d.ts +40 -7
- package/dist/modes/interactive/approval-dialog.js +192 -35
- package/dist/modes/interactive/approval-merge.d.ts +41 -0
- package/dist/modes/interactive/approval-merge.js +89 -0
- package/dist/modes/interactive/clipboard-paste.d.ts +18 -0
- package/dist/modes/interactive/clipboard-paste.js +28 -0
- package/dist/modes/interactive/commands.d.ts +20 -3
- package/dist/modes/interactive/commands.js +75 -16
- package/dist/modes/interactive/double-esc.d.ts +20 -0
- package/dist/modes/interactive/double-esc.js +34 -0
- package/dist/modes/interactive/event-notices.d.ts +32 -0
- package/dist/modes/interactive/event-notices.js +79 -0
- package/dist/modes/interactive/external-editor.d.ts +16 -0
- package/dist/modes/interactive/external-editor.js +39 -0
- package/dist/modes/interactive/interactive-mode.d.ts +16 -2
- package/dist/modes/interactive/interactive-mode.js +184 -202
- package/dist/modes/interactive/key-dispatch.d.ts +18 -2
- package/dist/modes/interactive/key-dispatch.js +53 -6
- package/dist/modes/interactive/line/line-mode.d.ts +3 -1
- package/dist/modes/interactive/line/line-mode.js +28 -9
- package/dist/modes/interactive/line/line-render.d.ts +6 -1
- package/dist/modes/interactive/line/line-render.js +66 -8
- package/dist/modes/interactive/message-view.d.ts +49 -10
- package/dist/modes/interactive/message-view.js +262 -46
- package/dist/modes/interactive/panels.d.ts +35 -0
- package/dist/modes/interactive/panels.js +157 -0
- package/dist/modes/interactive/pickers.d.ts +23 -2
- package/dist/modes/interactive/pickers.js +48 -15
- package/dist/modes/interactive/plan-command.d.ts +40 -0
- package/dist/modes/interactive/plan-command.js +129 -0
- package/dist/modes/interactive/plan-dialog.d.ts +98 -0
- package/dist/modes/interactive/plan-dialog.js +290 -0
- package/dist/modes/interactive/plan-flow.d.ts +34 -0
- package/dist/modes/interactive/plan-flow.js +98 -0
- package/dist/modes/interactive/rewind-command.d.ts +31 -0
- package/dist/modes/interactive/rewind-command.js +106 -0
- package/dist/modes/interactive/rewind-flow.d.ts +37 -0
- package/dist/modes/interactive/rewind-flow.js +151 -0
- package/dist/modes/interactive/rewind-list.d.ts +36 -0
- package/dist/modes/interactive/rewind-list.js +123 -0
- package/dist/modes/interactive/rewind-panel.d.ts +77 -0
- package/dist/modes/interactive/rewind-panel.js +309 -0
- package/dist/modes/interactive/rewind-text.d.ts +40 -0
- package/dist/modes/interactive/rewind-text.js +139 -0
- package/dist/modes/interactive/run-indicator.d.ts +51 -0
- package/dist/modes/interactive/run-indicator.js +189 -0
- package/dist/modes/interactive/session-events.d.ts +24 -0
- package/dist/modes/interactive/session-events.js +96 -0
- package/dist/modes/interactive/startup-header.d.ts +40 -0
- package/dist/modes/interactive/startup-header.js +169 -0
- package/dist/modes/interactive/status-area.d.ts +73 -0
- package/dist/modes/interactive/status-area.js +190 -0
- package/dist/modes/interactive/status-bar.d.ts +107 -16
- package/dist/modes/interactive/status-bar.js +306 -81
- package/dist/modes/interactive/status-line.d.ts +33 -0
- package/dist/modes/interactive/status-line.js +113 -0
- package/dist/modes/interactive/subagent-view.d.ts +56 -0
- package/dist/modes/interactive/subagent-view.js +154 -0
- package/dist/modes/interactive/tasks-report.d.ts +27 -0
- package/dist/modes/interactive/tasks-report.js +114 -0
- package/dist/modes/interactive/tool-summary.d.ts +46 -0
- package/dist/modes/interactive/tool-summary.js +218 -0
- package/dist/modes/interactive/tool-view.d.ts +58 -15
- package/dist/modes/interactive/tool-view.js +233 -145
- package/dist/modes/print/print-mode.d.ts +40 -4
- package/dist/modes/print/print-mode.js +161 -8
- package/dist/modes/rpc/commands.d.ts +9 -0
- package/dist/modes/rpc/commands.js +49 -0
- package/dist/modes/rpc/rpc-mode.js +7 -1
- package/dist/modes/session-report.d.ts +11 -0
- package/dist/modes/session-report.js +48 -1
- package/dist/permissions/auto-safe.d.ts +65 -0
- package/dist/permissions/auto-safe.js +547 -0
- package/dist/permissions/classifier.d.ts +68 -0
- package/dist/permissions/classifier.js +186 -0
- package/dist/permissions/dangerous.d.ts +5 -0
- package/dist/permissions/dangerous.js +1 -1
- package/dist/permissions/modes.d.ts +30 -0
- package/dist/permissions/modes.js +78 -0
- package/dist/permissions/pipeline.d.ts +72 -6
- package/dist/permissions/pipeline.js +306 -11
- package/dist/permissions/protected.d.ts +19 -0
- package/dist/permissions/protected.js +74 -0
- package/dist/permissions/readonly-bash.d.ts +30 -0
- package/dist/permissions/readonly-bash.js +118 -0
- package/dist/permissions/rules.js +3 -0
- package/dist/permissions/types.d.ts +92 -3
- package/dist/permissions/types.js +3 -0
- package/dist/plan/compose.d.ts +9 -0
- package/dist/plan/compose.js +19 -0
- package/dist/plan/controller.d.ts +71 -0
- package/dist/plan/controller.js +27 -0
- package/dist/plan/done-markers.d.ts +17 -0
- package/dist/plan/done-markers.js +51 -0
- package/dist/plan/extract.d.ts +29 -0
- package/dist/plan/extract.js +160 -0
- package/dist/plan/prompts.d.ts +36 -0
- package/dist/plan/prompts.js +89 -0
- package/dist/plan/store.d.ts +37 -0
- package/dist/plan/store.js +90 -0
- package/dist/rpc.d.ts +58 -2
- package/dist/rpc.js +7 -0
- package/dist/sandbox/bash.d.ts +74 -0
- package/dist/sandbox/bash.js +126 -0
- package/dist/sandbox/detect.d.ts +48 -0
- package/dist/sandbox/detect.js +149 -0
- package/dist/sandbox/index.d.ts +5 -0
- package/dist/sandbox/index.js +5 -0
- package/dist/sandbox/profile.d.ts +33 -0
- package/dist/sandbox/profile.js +76 -0
- package/dist/sandbox/wrap.d.ts +29 -0
- package/dist/sandbox/wrap.js +117 -0
- package/dist/sdk.d.ts +42 -5
- package/dist/sdk.js +34 -4
- package/dist/session/export.d.ts +32 -0
- package/dist/session/export.js +187 -0
- package/dist/session/redact.d.ts +15 -0
- package/dist/session/redact.js +55 -0
- package/dist/session/reuse.d.ts +33 -0
- package/dist/session/reuse.js +86 -0
- package/dist/session/scan.d.ts +34 -0
- package/dist/session/scan.js +140 -0
- package/dist/session/search.d.ts +52 -0
- package/dist/session/search.js +211 -0
- package/dist/session/stats-aggregate.d.ts +63 -0
- package/dist/session/stats-aggregate.js +163 -0
- package/dist/session/stats-index.d.ts +26 -0
- package/dist/session/stats-index.js +91 -0
- package/dist/session/stats-scan.d.ts +54 -0
- package/dist/session/stats-scan.js +236 -0
- package/dist/session/types.d.ts +3 -1
- package/dist/session/types.js +1 -0
- package/dist/skills/builtin.d.ts +31 -0
- package/dist/skills/builtin.js +109 -0
- package/dist/skills/discover.d.ts +2 -1
- package/dist/skills/index-prompt.js +5 -8
- package/dist/tools/background-jobs.d.ts +71 -0
- package/dist/tools/background-jobs.js +198 -0
- package/dist/tools/bash.d.ts +53 -1
- package/dist/tools/bash.js +158 -7
- package/dist/tools/clipboard-image.d.ts +44 -0
- package/dist/tools/clipboard-image.js +148 -0
- package/dist/tools/edit.d.ts +2 -0
- package/dist/tools/edit.js +18 -3
- package/dist/tools/image-file.d.ts +38 -3
- package/dist/tools/image-file.js +81 -10
- package/dist/tools/image-resize.d.ts +58 -0
- package/dist/tools/image-resize.js +97 -0
- package/dist/tools/presets.d.ts +40 -8
- package/dist/tools/presets.js +65 -19
- package/dist/tools/read.d.ts +5 -2
- package/dist/tools/read.js +13 -10
- package/dist/tools/registry.d.ts +7 -1
- package/dist/tools/registry.js +27 -4
- package/dist/tools/task-ctl.d.ts +22 -0
- package/dist/tools/task-ctl.js +116 -0
- package/dist/tools/task.d.ts +22 -10
- package/dist/tools/task.js +66 -26
- package/dist/tools/todo.d.ts +22 -2
- package/dist/tools/todo.js +58 -14
- package/dist/tools/truncate.d.ts +15 -0
- package/dist/tools/truncate.js +25 -0
- package/dist/tools/types.d.ts +113 -0
- package/dist/tools/types.js +5 -0
- package/dist/tools/write.js +3 -0
- package/dist/tui/component.d.ts +8 -2
- package/dist/tui/component.js +3 -1
- package/dist/tui/components/box.d.ts +6 -1
- package/dist/tui/components/box.js +16 -6
- package/dist/tui/components/card.d.ts +23 -0
- package/dist/tui/components/card.js +37 -0
- package/dist/tui/components/editor-history.d.ts +6 -0
- package/dist/tui/components/editor-history.js +45 -0
- package/dist/tui/components/editor-paste.d.ts +1 -1
- package/dist/tui/components/editor-paste.js +4 -4
- package/dist/tui/components/editor.d.ts +11 -5
- package/dist/tui/components/editor.js +52 -58
- package/dist/tui/components/key-value.d.ts +3 -0
- package/dist/tui/components/key-value.js +16 -6
- package/dist/tui/components/loader.d.ts +37 -7
- package/dist/tui/components/loader.js +84 -21
- package/dist/tui/components/markdown.d.ts +5 -1
- package/dist/tui/components/markdown.js +45 -21
- package/dist/tui/components/meter.d.ts +3 -3
- package/dist/tui/components/meter.js +13 -11
- package/dist/tui/components/select-list.d.ts +23 -1
- package/dist/tui/components/select-list.js +76 -13
- package/dist/tui/glyphs.d.ts +72 -0
- package/dist/tui/glyphs.js +118 -0
- package/dist/tui/keybindings.d.ts +5 -0
- package/dist/tui/keybindings.js +5 -0
- package/dist/tui/theme.d.ts +30 -6
- package/dist/tui/theme.js +103 -17
- package/dist/tui.d.ts +4 -2
- package/dist/tui.js +3 -1
- package/docs/acp.md +78 -0
- package/docs/agents.md +250 -0
- package/docs/codemode.md +28 -10
- package/docs/hooks.md +36 -32
- package/docs/permissions.md +212 -0
- package/docs/plan.md +107 -0
- package/docs/providers.md +261 -62
- package/docs/rewind-plan.md +181 -0
- package/docs/rpc.md +127 -40
- package/docs/sandbox.md +215 -0
- package/docs/session-format.md +43 -22
- package/docs/sessions.md +174 -0
- package/docs/tui-design.md +751 -0
- package/docs/tui.md +260 -64
- package/package.json +15 -2
package/dist/config/merge.js
CHANGED
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
* 配置层级合并(设计 §7.2、§10.2)。[B5]
|
|
3
3
|
*
|
|
4
4
|
* 顺序:内置缺省 ← 用户级 ← profile.config ← 项目级(受限字段,只能收紧)← 命令行。
|
|
5
|
-
* - 对象深合并;数组整体替换,例外是「累加型」列表:`permission.allow / deny`、
|
|
5
|
+
* - 对象深合并;数组整体替换,例外是「累加型」列表:`permission.allow / deny / autoSafeCommands`、
|
|
6
6
|
* `tools.disabled`、`skills.dirs` 跨层拼接去重。
|
|
7
|
-
* - 项目级 `.ama/config.json` 只接受:`permission.deny`(追加)、`permission.mode
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* - 项目级 `.ama/config.json` 只接受:`permission.deny`(追加)、`permission.mode`(只能更严,且不能是
|
|
8
|
+
* auto / full-auto)、
|
|
9
|
+
* `compaction`、`tools.disabled`、`tools.preset`(只能更严)、`codemode.mode: "off"`、`ui`、
|
|
10
|
+
* `checkpoints.mode: "off"`、`checkpoints.maxFileBytes`(只能调小)、(W5-C0)`plan.bash`(只能更严)、
|
|
11
|
+
* `reminders`;`compaction.prune / pruneExclude` 与第五波其余段只认用户级;
|
|
12
|
+
* 其它字段与放宽项(含 `permission.builtinDeny / autoModel / autoSafeCommands`)被忽略并记 warning。
|
|
10
13
|
* - 同时产出带来源的权限规则清单(`ruleSpecs`),交给权限管线(B3 的 rules.ts 解析)。
|
|
11
14
|
*/
|
|
12
|
-
import { CONFIG_FILE_VERSION, TOOLS_PRESETS_STRICT_FIRST } from "./types.js";
|
|
15
|
+
import { CONFIG_FILE_VERSION, DEFAULT_CHECKPOINTS_CONFIG, PLAN_BASH_MODES_STRICT_FIRST, TOOLS_PRESETS_STRICT_FIRST, canonicalPreset, } from "./types.js";
|
|
13
16
|
import { isAtLeastAsStrict } from "../permissions/rules.js";
|
|
14
17
|
export const DEFAULT_CONFIG = Object.freeze({
|
|
15
18
|
version: CONFIG_FILE_VERSION,
|
|
@@ -30,7 +33,8 @@ export const DEFAULT_CONFIG = Object.freeze({
|
|
|
30
33
|
});
|
|
31
34
|
/** 嵌入宿主(有 profile)时的缺省覆盖(§12.10)。 */
|
|
32
35
|
export const PROFILE_DEFAULTS = Object.freeze({
|
|
33
|
-
|
|
36
|
+
// [W5-A] 嵌入宿主以「最后一行 = 状态栏」锚定,底部信息行缺省单行
|
|
37
|
+
ui: { quietStartup: "header", statusLine: "compact" },
|
|
34
38
|
});
|
|
35
39
|
/** 层名 → 规则来源(RuleSource)。 */
|
|
36
40
|
const RULE_SOURCE = {
|
|
@@ -43,8 +47,10 @@ const RULE_SOURCE = {
|
|
|
43
47
|
const ACCUMULATING = new Set([
|
|
44
48
|
"permission.allow",
|
|
45
49
|
"permission.deny",
|
|
50
|
+
"permission.autoSafeCommands",
|
|
46
51
|
"tools.disabled",
|
|
47
52
|
"skills.dirs",
|
|
53
|
+
"agents.dirs",
|
|
48
54
|
]);
|
|
49
55
|
function isPlainObject(value) {
|
|
50
56
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -78,17 +84,21 @@ export function mergeConfig(base, over) {
|
|
|
78
84
|
return structuredCloneSafe(base);
|
|
79
85
|
const merged = mergeValue(base, over, "");
|
|
80
86
|
merged.version = CONFIG_FILE_VERSION;
|
|
87
|
+
// 别名(`codemode`)在合并后折成规范名:下游只见规范名。
|
|
88
|
+
if (merged.tools?.preset !== undefined)
|
|
89
|
+
merged.tools.preset = canonicalPreset(merged.tools.preset);
|
|
81
90
|
return merged;
|
|
82
91
|
}
|
|
83
|
-
/** 预设 a 是否比 b 更严或相同(coordinator 最严,codemode
|
|
92
|
+
/** 预设 a 是否比 b 更严或相同(coordinator 最严,codemode-only 最宽;别名按规范名比)。 */
|
|
84
93
|
export function isPresetStricterOrEqual(a, b) {
|
|
85
|
-
return TOOLS_PRESETS_STRICT_FIRST.indexOf(a) <=
|
|
94
|
+
return (TOOLS_PRESETS_STRICT_FIRST.indexOf(canonicalPreset(a)) <=
|
|
95
|
+
TOOLS_PRESETS_STRICT_FIRST.indexOf(canonicalPreset(b)));
|
|
86
96
|
}
|
|
87
97
|
/**
|
|
88
98
|
* 把项目级配置裁剪为受限字段(§7.2);`currentMode` / `currentPreset` 是合并到此为止的
|
|
89
99
|
* 权限模式与工具预设。
|
|
90
100
|
*/
|
|
91
|
-
export function restrictProjectConfig(project, currentMode, label = ".ama/config.json", currentPreset = "default") {
|
|
101
|
+
export function restrictProjectConfig(project, currentMode, label = ".ama/config.json", currentPreset = "default", currentMaxFileBytes = DEFAULT_CHECKPOINTS_CONFIG.maxFileBytes, currentPlanBash = "readonly") {
|
|
92
102
|
const warnings = [];
|
|
93
103
|
const accepted = {};
|
|
94
104
|
for (const [key, value] of Object.entries(project)) {
|
|
@@ -96,9 +106,24 @@ export function restrictProjectConfig(project, currentMode, label = ".ama/config
|
|
|
96
106
|
continue;
|
|
97
107
|
switch (key) {
|
|
98
108
|
case "compaction":
|
|
99
|
-
if (project.compaction !== undefined)
|
|
100
|
-
|
|
109
|
+
if (project.compaction !== undefined) {
|
|
110
|
+
const { prune, pruneExclude, ...rest } = structuredClone(project.compaction);
|
|
111
|
+
if (prune !== undefined || pruneExclude !== undefined)
|
|
112
|
+
warnings.push(`${label}: 项目级不能设 compaction.prune / pruneExclude,已忽略`);
|
|
113
|
+
if (Object.keys(rest).length > 0)
|
|
114
|
+
accepted.compaction = rest;
|
|
115
|
+
}
|
|
116
|
+
break;
|
|
117
|
+
case "reminders":
|
|
118
|
+
if (project.reminders !== undefined)
|
|
119
|
+
accepted.reminders = structuredClone(project.reminders);
|
|
120
|
+
break;
|
|
121
|
+
case "plan": {
|
|
122
|
+
const plan = restrictPlan(project.plan ?? {}, currentPlanBash, label, warnings);
|
|
123
|
+
if (plan !== undefined)
|
|
124
|
+
accepted.plan = plan;
|
|
101
125
|
break;
|
|
126
|
+
}
|
|
102
127
|
case "ui":
|
|
103
128
|
if (project.ui !== undefined)
|
|
104
129
|
accepted.ui = structuredClone(project.ui);
|
|
@@ -133,18 +158,73 @@ export function restrictProjectConfig(project, currentMode, label = ".ama/config
|
|
|
133
158
|
accepted.codemode = { mode: "off" };
|
|
134
159
|
break;
|
|
135
160
|
}
|
|
161
|
+
case "checkpoints": {
|
|
162
|
+
const checkpoints = restrictCheckpoints(project.checkpoints ?? {}, currentMaxFileBytes, label, warnings);
|
|
163
|
+
if (checkpoints !== undefined)
|
|
164
|
+
accepted.checkpoints = checkpoints;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
136
167
|
case "permission": {
|
|
137
168
|
const permission = restrictPermission(project.permission ?? {}, currentMode, label, warnings);
|
|
138
169
|
if (permission !== undefined)
|
|
139
170
|
accepted.permission = permission;
|
|
140
171
|
break;
|
|
141
172
|
}
|
|
173
|
+
case "sandbox": {
|
|
174
|
+
// [S2] 只能收紧:network "deny"。enabled / bash 两个方向都不是单纯更严(打开 bash 沙箱会让 default
|
|
175
|
+
// 模式免审批,关闭会让命令裸跑),writable 是放宽,一律忽略。
|
|
176
|
+
const sandbox = project.sandbox ?? {};
|
|
177
|
+
for (const [sub, v] of Object.entries(sandbox)) {
|
|
178
|
+
if (sub === "network" && v === "deny")
|
|
179
|
+
continue;
|
|
180
|
+
warnings.push(`${label}: 项目级只接受 sandbox.network "deny",忽略 sandbox.${sub}${sub === "network" ? ` ${String(v)}` : ""}`);
|
|
181
|
+
}
|
|
182
|
+
if (sandbox.network === "deny")
|
|
183
|
+
accepted.sandbox = { network: "deny" };
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
142
186
|
default:
|
|
143
187
|
warnings.push(`${label}: 项目级不能设 ${key},已忽略`);
|
|
144
188
|
}
|
|
145
189
|
}
|
|
146
190
|
return { accepted, warnings };
|
|
147
191
|
}
|
|
192
|
+
/** [W5-C0] 项目级 plan:只接受 `bash`,且只能更严(deny < readonly < ask)。 */
|
|
193
|
+
function restrictPlan(plan, current, label, warnings) {
|
|
194
|
+
for (const sub of Object.keys(plan)) {
|
|
195
|
+
if (sub !== "bash")
|
|
196
|
+
warnings.push(`${label}: 项目级只能设 plan.bash,忽略 plan.${sub}`);
|
|
197
|
+
}
|
|
198
|
+
if (plan.bash === undefined)
|
|
199
|
+
return undefined;
|
|
200
|
+
const order = PLAN_BASH_MODES_STRICT_FIRST;
|
|
201
|
+
if (order.indexOf(plan.bash) <= order.indexOf(current))
|
|
202
|
+
return { bash: plan.bash };
|
|
203
|
+
warnings.push(`${label}: 项目级只能收紧 plan.bash,忽略 ${plan.bash}(当前 ${current})`);
|
|
204
|
+
return undefined;
|
|
205
|
+
}
|
|
206
|
+
/** 项目级检查点:只能关闭、只能调小单文件上限(多备份即多占用户磁盘);`keep` 只认用户级。 */
|
|
207
|
+
function restrictCheckpoints(checkpoints, currentMaxFileBytes, label, warnings) {
|
|
208
|
+
const result = {};
|
|
209
|
+
for (const [sub, v] of Object.entries(checkpoints)) {
|
|
210
|
+
if (sub === "mode") {
|
|
211
|
+
if (v === "off")
|
|
212
|
+
result.mode = "off";
|
|
213
|
+
else
|
|
214
|
+
warnings.push(`${label}: 项目级只接受 checkpoints.mode "off",忽略 ${String(v)}`);
|
|
215
|
+
}
|
|
216
|
+
else if (sub === "maxFileBytes" && typeof v === "number") {
|
|
217
|
+
if (v <= currentMaxFileBytes)
|
|
218
|
+
result.maxFileBytes = v;
|
|
219
|
+
else
|
|
220
|
+
warnings.push(`${label}: 项目级只能调小 checkpoints.maxFileBytes,忽略 ${v}(当前 ${currentMaxFileBytes})`);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
warnings.push(`${label}: 项目级不能设 checkpoints.${sub},已忽略`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return Object.keys(result).length > 0 ? result : undefined;
|
|
227
|
+
}
|
|
148
228
|
function restrictPermission(permission, currentMode, label, warnings) {
|
|
149
229
|
const result = {};
|
|
150
230
|
if (permission.allow !== undefined && permission.allow.length > 0) {
|
|
@@ -155,7 +235,16 @@ function restrictPermission(permission, currentMode, label, warnings) {
|
|
|
155
235
|
if (permission.builtinDeny !== undefined) {
|
|
156
236
|
warnings.push(`${label}: 项目级不能改内置 deny 表,忽略 permission.builtinDeny`);
|
|
157
237
|
}
|
|
158
|
-
if (permission.
|
|
238
|
+
if (permission.autoModel !== undefined) {
|
|
239
|
+
warnings.push(`${label}: 项目级不能设 permission.autoModel,已忽略`);
|
|
240
|
+
}
|
|
241
|
+
if (permission.autoSafeCommands !== undefined && permission.autoSafeCommands.length > 0) {
|
|
242
|
+
warnings.push(`${label}: 项目级不能追加 permission.autoSafeCommands(放宽),已忽略`);
|
|
243
|
+
}
|
|
244
|
+
if (permission.mode === "auto" || permission.mode === "full-auto") {
|
|
245
|
+
warnings.push(`${label}: 项目级不能把权限模式设为 ${permission.mode}(放宽,只能在用户级配置、profile 或命令行设),已忽略`);
|
|
246
|
+
}
|
|
247
|
+
else if (permission.mode !== undefined) {
|
|
159
248
|
if (isAtLeastAsStrict(permission.mode, currentMode)) {
|
|
160
249
|
result.mode = permission.mode;
|
|
161
250
|
}
|
|
@@ -227,7 +316,7 @@ export function mergeProjectAndCli(base, project, cli, projectLabel) {
|
|
|
227
316
|
const present = [...base.layers];
|
|
228
317
|
if (project !== undefined) {
|
|
229
318
|
const baseline = config.permission?.mode ?? "default";
|
|
230
|
-
const restricted = restrictProjectConfig(project, baseline, projectLabel, config.tools?.preset ?? "default");
|
|
319
|
+
const restricted = restrictProjectConfig(project, baseline, projectLabel, config.tools?.preset ?? "default", config.checkpoints?.maxFileBytes ?? DEFAULT_CHECKPOINTS_CONFIG.maxFileBytes, config.plan?.bash ?? "readonly");
|
|
231
320
|
warnings.push(...restricted.warnings);
|
|
232
321
|
config = mergeConfig(config, restricted.accepted);
|
|
233
322
|
present.push("project");
|
package/dist/config/profile.d.ts
CHANGED
package/dist/config/profile.js
CHANGED
|
@@ -51,6 +51,8 @@ function profileToOptions(path, profile, warnings) {
|
|
|
51
51
|
trustProject: profile.trustProject === true,
|
|
52
52
|
warnings: [...warnings],
|
|
53
53
|
};
|
|
54
|
+
if (profile.agentDirs !== undefined)
|
|
55
|
+
options.agentDirs = [...profile.agentDirs];
|
|
54
56
|
if (profile.host !== undefined)
|
|
55
57
|
options.host = profile.host;
|
|
56
58
|
if (profile.hooksFile !== undefined)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 第五波配置键的校验(docs/wave5-plan.md §9;schema.ts 已近 600 行,新键放这里)。[W5-C0]
|
|
3
|
+
*
|
|
4
|
+
* 规则与 json-schema.ts 一一对应(json-schema.test.ts 的正反例守住):类型 / 取值错误是 error,
|
|
5
|
+
* 未知字段是 warning。只校验形状;行为由各批次实现。
|
|
6
|
+
*/
|
|
7
|
+
import { Checker, type Obj } from "./checker.js";
|
|
8
|
+
/** 第五波新增的顶层键(schema.ts 的 CONFIG_KEYS 并入)。 */
|
|
9
|
+
export declare const W5_CONFIG_KEYS: readonly ["images", "plan", "agents", "subagents", "models", "fallbackModel", "limits", "reminders", "todo"];
|
|
10
|
+
/** 已有段新增的键。 */
|
|
11
|
+
export declare const W5_UI_KEYS: readonly ["statusLine"];
|
|
12
|
+
export declare const W5_COMPACTION_KEYS: readonly ["prune", "pruneExclude"];
|
|
13
|
+
/** `agents.<id>` 的 id:子 Agent 名(`^[a-z0-9-]`)或外部 Agent(可带 `acp:` 前缀)。 */
|
|
14
|
+
export declare const AGENT_ID_PATTERN: RegExp;
|
|
15
|
+
export declare function checkUiW5(c: Checker, ui: Obj, path: string): void;
|
|
16
|
+
export declare function checkCompactionW5(c: Checker, compaction: Obj, path: string): void;
|
|
17
|
+
/** 第五波顶层段的校验(validateConfig 末尾调用)。 */
|
|
18
|
+
export declare function validateConfigW5(c: Checker, config: Obj): void;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 第五波配置键的校验(docs/wave5-plan.md §9;schema.ts 已近 600 行,新键放这里)。[W5-C0]
|
|
3
|
+
*
|
|
4
|
+
* 规则与 json-schema.ts 一一对应(json-schema.test.ts 的正反例守住):类型 / 取值错误是 error,
|
|
5
|
+
* 未知字段是 warning。只校验形状;行为由各批次实现。
|
|
6
|
+
*/
|
|
7
|
+
import { PERMISSION_MODES_STRICT_FIRST } from "../permissions/types.js";
|
|
8
|
+
import { Checker, THINKING_LEVELS, checkSection, join } from "./checker.js";
|
|
9
|
+
import { AGENTS_RESERVED_KEYS, IMAGE_RESIZE_MODES, PLAN_BASH_MODES_STRICT_FIRST, PLAN_UNATTENDED_MODES, STATUS_LINE_MODES, } from "./types-w5.js";
|
|
10
|
+
/** 第五波新增的顶层键(schema.ts 的 CONFIG_KEYS 并入)。 */
|
|
11
|
+
export const W5_CONFIG_KEYS = [
|
|
12
|
+
"images",
|
|
13
|
+
"plan",
|
|
14
|
+
"agents",
|
|
15
|
+
"subagents",
|
|
16
|
+
"models",
|
|
17
|
+
"fallbackModel",
|
|
18
|
+
"limits",
|
|
19
|
+
"reminders",
|
|
20
|
+
"todo",
|
|
21
|
+
];
|
|
22
|
+
/** 已有段新增的键。 */
|
|
23
|
+
export const W5_UI_KEYS = ["statusLine"];
|
|
24
|
+
export const W5_COMPACTION_KEYS = ["prune", "pruneExclude"];
|
|
25
|
+
/** `agents.<id>` 的 id:子 Agent 名(`^[a-z0-9-]`)或外部 Agent(可带 `acp:` 前缀)。 */
|
|
26
|
+
export const AGENT_ID_PATTERN = /^(acp:)?[a-z0-9][a-z0-9._-]{0,63}$/;
|
|
27
|
+
const AGENT_ENTRY_KEYS = ["maxConcurrent", "maxMode", "model", "env"];
|
|
28
|
+
export function checkUiW5(c, ui, path) {
|
|
29
|
+
c.oneOf(ui, "statusLine", path, STATUS_LINE_MODES);
|
|
30
|
+
}
|
|
31
|
+
export function checkCompactionW5(c, compaction, path) {
|
|
32
|
+
c.stringArray(compaction, "pruneExclude", path);
|
|
33
|
+
const prune = compaction["prune"];
|
|
34
|
+
const p = join(path, "prune");
|
|
35
|
+
if (prune === undefined || !c.object(prune, p))
|
|
36
|
+
return;
|
|
37
|
+
c.keys(prune, p, ["keepResults", "clearAtLeast"]);
|
|
38
|
+
c.number(prune, "keepResults", p, 0);
|
|
39
|
+
const clear = prune["clearAtLeast"];
|
|
40
|
+
if (clear !== undefined && clear !== "auto" && (typeof clear !== "number" || clear < 0))
|
|
41
|
+
c.error(join(p, "clearAtLeast"), '应为 "auto" 或非负数字');
|
|
42
|
+
}
|
|
43
|
+
function checkAgentEntry(c, entry, path) {
|
|
44
|
+
if (!c.object(entry, path))
|
|
45
|
+
return;
|
|
46
|
+
c.keys(entry, path, AGENT_ENTRY_KEYS);
|
|
47
|
+
c.number(entry, "maxConcurrent", path, 1, 64);
|
|
48
|
+
c.oneOf(entry, "maxMode", path, PERMISSION_MODES_STRICT_FIRST);
|
|
49
|
+
c.string(entry, "model", path);
|
|
50
|
+
const env = entry["env"];
|
|
51
|
+
const envPath = join(path, "env");
|
|
52
|
+
if (env !== undefined && c.object(env, envPath)) {
|
|
53
|
+
c.keys(env, envPath, ["passthrough"]);
|
|
54
|
+
c.stringArray(env, "passthrough", envPath);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function checkAgents(c, config) {
|
|
58
|
+
const agents = config["agents"];
|
|
59
|
+
if (agents === undefined || !c.object(agents, "agents"))
|
|
60
|
+
return;
|
|
61
|
+
c.number(agents, "maxConcurrent", "agents", 1, 64);
|
|
62
|
+
c.number(agents, "sessionBudgetUsd", "agents", 0);
|
|
63
|
+
c.stringArray(agents, "dirs", "agents");
|
|
64
|
+
for (const [id, entry] of Object.entries(agents)) {
|
|
65
|
+
if (AGENTS_RESERVED_KEYS.includes(id))
|
|
66
|
+
continue;
|
|
67
|
+
const p = join("agents", id);
|
|
68
|
+
if (!AGENT_ID_PATTERN.test(id))
|
|
69
|
+
c.error(p, "Agent id 只能是小写字母、数字、- . _(可带 acp: 前缀)");
|
|
70
|
+
else
|
|
71
|
+
checkAgentEntry(c, entry, p);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** 第五波顶层段的校验(validateConfig 末尾调用)。 */
|
|
75
|
+
export function validateConfigW5(c, config) {
|
|
76
|
+
checkSection(c, config, "images", ["resize"], (s, p) => c.oneOf(s, "resize", p, IMAGE_RESIZE_MODES));
|
|
77
|
+
checkSection(c, config, "plan", ["bash", "directory", "unattended", "model", "thinkingLevel"], (s, p) => {
|
|
78
|
+
c.oneOf(s, "bash", p, PLAN_BASH_MODES_STRICT_FIRST);
|
|
79
|
+
c.string(s, "directory", p);
|
|
80
|
+
c.oneOf(s, "unattended", p, PLAN_UNATTENDED_MODES);
|
|
81
|
+
c.string(s, "model", p);
|
|
82
|
+
c.oneOf(s, "thinkingLevel", p, THINKING_LEVELS);
|
|
83
|
+
});
|
|
84
|
+
checkAgents(c, config);
|
|
85
|
+
checkSection(c, config, "subagents", ["maxConcurrent", "maxPending", "defaultModel"], (s, p) => {
|
|
86
|
+
c.number(s, "maxConcurrent", p, 1, 64);
|
|
87
|
+
c.number(s, "maxPending", p, 0, 1024);
|
|
88
|
+
c.string(s, "defaultModel", p);
|
|
89
|
+
});
|
|
90
|
+
checkSection(c, config, "models", ["aliases"], (s, p) => {
|
|
91
|
+
const aliases = s["aliases"];
|
|
92
|
+
const ap = join(p, "aliases");
|
|
93
|
+
if (aliases === undefined || !c.object(aliases, ap))
|
|
94
|
+
return;
|
|
95
|
+
c.keys(aliases, ap, ["fast", "strong"]);
|
|
96
|
+
c.string(aliases, "fast", ap);
|
|
97
|
+
c.string(aliases, "strong", ap);
|
|
98
|
+
});
|
|
99
|
+
c.string(config, "fallbackModel", "");
|
|
100
|
+
checkSection(c, config, "limits", ["maxTurns", "maxCostUsd"], (s, p) => {
|
|
101
|
+
c.number(s, "maxTurns", p, 1);
|
|
102
|
+
c.number(s, "maxCostUsd", p, 0);
|
|
103
|
+
});
|
|
104
|
+
checkSection(c, config, "reminders", ["todo", "fileChanges", "contextPressure", "budget"], (s, p) => {
|
|
105
|
+
for (const key of ["todo", "fileChanges", "contextPressure", "budget"])
|
|
106
|
+
c.boolean(s, key, p);
|
|
107
|
+
});
|
|
108
|
+
checkSection(c, config, "todo", ["reminder"], (s, p) => c.number(s, "reminder", p, 0));
|
|
109
|
+
}
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -6,23 +6,19 @@
|
|
|
6
6
|
* (未知字段等)。`path` 是 JSON 指针风格的字段路径(`permission.mode`、`hooks.PreToolUse[0]`)。
|
|
7
7
|
*/
|
|
8
8
|
import type { AmaConfig, AuthFile, ProfileFile, TrustFile } from "./types.js";
|
|
9
|
+
import { type Diagnostic } from "./checker.js";
|
|
9
10
|
import type { HookConfig } from "../hooks/types.js";
|
|
10
|
-
export type { AmaConfig, AuthFile, ProfileFile, TrustFile, TrustEntry, ProviderConfig, PermissionConfig, CompactionConfig, RetryConfig, ToolsConfig, ToolsPreset, CodemodeConfig, CodemodeMode, HooksSettings, UiConfig, SkillsConfig, CacheConfig, ModelConfig, ModelOverride, ChannelConfig, } from "./types.js";
|
|
11
|
+
export type { AmaConfig, AuthFile, ProfileFile, TrustFile, TrustEntry, ProviderConfig, PermissionConfig, CompactionConfig, RetryConfig, ToolsConfig, ToolsPreset, ToolsPresetInput, CodemodeConfig, CodemodeMode, HooksSettings, UiConfig, SkillsConfig, CacheConfig, CheckpointsConfig, ModelConfig, ModelOverride, ChannelConfig, } from "./types.js";
|
|
11
12
|
export { CONFIG_FILE_VERSION } from "./types.js";
|
|
12
13
|
export type { HookConfig } from "../hooks/types.js";
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
/** 字段路径;文件级问题为 ""。 */
|
|
16
|
-
path: string;
|
|
17
|
-
message: string;
|
|
18
|
-
}
|
|
19
|
-
export declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh"];
|
|
14
|
+
export type { Diagnostic } from "./checker.js";
|
|
15
|
+
export { THINKING_LEVELS } from "./checker.js";
|
|
20
16
|
export declare const HOOK_TIMEOUT_MAX_MS = 600000;
|
|
21
17
|
export declare function hasErrors(diagnostics: readonly Diagnostic[]): boolean;
|
|
22
18
|
export declare function validateConfig(value: unknown): Diagnostic[];
|
|
23
19
|
export declare function validateAuthFile(value: unknown): Diagnostic[];
|
|
24
20
|
export declare const PROFILE_PATH_FIELDS: readonly ["host", "hooksFile", "authFile", "sessionDir", "config"];
|
|
25
|
-
export declare const PROFILE_PATH_LIST_FIELDS: readonly ["instructions", "skillDirs", "promptDirs"];
|
|
21
|
+
export declare const PROFILE_PATH_LIST_FIELDS: readonly ["instructions", "skillDirs", "promptDirs", "agentDirs"];
|
|
26
22
|
export declare function validateProfile(value: unknown): Diagnostic[];
|
|
27
23
|
export declare function validateTrustFile(value: unknown): Diagnostic[];
|
|
28
24
|
export declare function validateHookConfig(value: unknown): Diagnostic[];
|