@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
|
@@ -6,10 +6,39 @@
|
|
|
6
6
|
* - normal:标题行 + 模型 / 信任 / 已加载资源清单 / 警告数
|
|
7
7
|
* - header:只有标题行(版本与按键提示)
|
|
8
8
|
* - silent:不输出
|
|
9
|
+
*
|
|
10
|
+
* 交互模式(终端界面视觉设计 v1 §3.1)用结构化的 `startupInfo()` 自己排版(框 / 无框两态);
|
|
11
|
+
* `buildStartupScreen` 的纯文本行保留给 line 模式与测试。
|
|
9
12
|
*/
|
|
13
|
+
import type { PermissionMode } from "../permissions/types.js";
|
|
10
14
|
import type { Runtime } from "./runtime.js";
|
|
11
15
|
export type StartupScreenLevel = "normal" | "header" | "silent";
|
|
12
16
|
export declare function startupScreenLevel(runtime: Pick<Runtime, "config">): StartupScreenLevel;
|
|
13
17
|
export declare function headerLine(): string;
|
|
14
18
|
export type StartupScreenRuntime = Pick<Runtime, "config" | "trust" | "resources" | "model" | "thinkingLevel" | "hooks" | "host" | "paths" | "warnings">;
|
|
15
19
|
export declare function buildStartupScreen(runtime: StartupScreenRuntime, level?: StartupScreenLevel): string[];
|
|
20
|
+
/** 交互模式启动头的结构化字段(§3.1)。 */
|
|
21
|
+
export interface StartupInfo {
|
|
22
|
+
version: string;
|
|
23
|
+
/** `provider/id[@渠道]`。 */
|
|
24
|
+
model: string;
|
|
25
|
+
thinking: string;
|
|
26
|
+
/** 会话目录(家目录缩写为 `~`)。 */
|
|
27
|
+
cwd: string;
|
|
28
|
+
trusted: boolean;
|
|
29
|
+
/** 信任来源的短名(trust.json / 命令行 / 本次确认 / profile / 缺省)。 */
|
|
30
|
+
trustSource: string;
|
|
31
|
+
permissionMode: PermissionMode;
|
|
32
|
+
preset: string;
|
|
33
|
+
codemode: "off" | "on" | "only";
|
|
34
|
+
/** 上下文文件的文件名(外层在前)。 */
|
|
35
|
+
contextFiles: string[];
|
|
36
|
+
skills: number;
|
|
37
|
+
prompts: number;
|
|
38
|
+
hooks: number;
|
|
39
|
+
host?: string;
|
|
40
|
+
warnings: number;
|
|
41
|
+
}
|
|
42
|
+
/** 家目录前缀缩写为 `~`(`/` 与 `\` 两种分隔都认,余下部分原样保留)。 */
|
|
43
|
+
export declare function tildePath(path: string, home: string | undefined): string;
|
|
44
|
+
export declare function startupInfo(runtime: StartupScreenRuntime & Pick<Runtime, "session">, home?: string): StartupInfo;
|
|
@@ -6,7 +6,14 @@
|
|
|
6
6
|
* - normal:标题行 + 模型 / 信任 / 已加载资源清单 / 警告数
|
|
7
7
|
* - header:只有标题行(版本与按键提示)
|
|
8
8
|
* - silent:不输出
|
|
9
|
+
*
|
|
10
|
+
* 交互模式(终端界面视觉设计 v1 §3.1)用结构化的 `startupInfo()` 自己排版(框 / 无框两态);
|
|
11
|
+
* `buildStartupScreen` 的纯文本行保留给 line 模式与测试。
|
|
9
12
|
*/
|
|
13
|
+
import { isBuiltinSkill } from "../skills/builtin.js";
|
|
14
|
+
import { basename } from "node:path";
|
|
15
|
+
import { formatModelRef } from "../ai/providers/channels.js";
|
|
16
|
+
import { effectiveCodemodeMode } from "../tools/presets.js";
|
|
10
17
|
import { AMA_VERSION } from "../version.js";
|
|
11
18
|
export function startupScreenLevel(runtime) {
|
|
12
19
|
return runtime.config.ui?.quietStartup ?? "normal";
|
|
@@ -39,8 +46,9 @@ export function buildStartupScreen(runtime, level = startupScreenLevel(runtime))
|
|
|
39
46
|
if (resources.contextFiles.length > 0) {
|
|
40
47
|
lines.push(`上下文:${resources.contextFiles.map((f) => f.path).join(", ")}`);
|
|
41
48
|
}
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
const skills = resources.skills.filter((s) => !isBuiltinSkill(s));
|
|
50
|
+
if (skills.length > 0) {
|
|
51
|
+
lines.push(`Skill:${skills.map((s) => s.name).join(", ")}`);
|
|
44
52
|
}
|
|
45
53
|
if (resources.prompts.length > 0) {
|
|
46
54
|
lines.push(`提示模板:${resources.prompts.map((p) => `/${p.name}`).join(" ")}`);
|
|
@@ -54,3 +62,44 @@ export function buildStartupScreen(runtime, level = startupScreenLevel(runtime))
|
|
|
54
62
|
lines.push(`警告:${runtime.warnings.length} 条(ama doctor 查看)`);
|
|
55
63
|
return lines;
|
|
56
64
|
}
|
|
65
|
+
const TRUST_SOURCE = {
|
|
66
|
+
flag: "命令行",
|
|
67
|
+
"trust-file": "trust.json",
|
|
68
|
+
prompt: "本次确认",
|
|
69
|
+
profile: "profile",
|
|
70
|
+
default: "缺省",
|
|
71
|
+
};
|
|
72
|
+
/** 家目录前缀缩写为 `~`(`/` 与 `\` 两种分隔都认,余下部分原样保留)。 */
|
|
73
|
+
export function tildePath(path, home) {
|
|
74
|
+
if (home === undefined || home === "")
|
|
75
|
+
return path;
|
|
76
|
+
const trimmed = /[\\/]$/.test(home) ? home.slice(0, -1) : home;
|
|
77
|
+
if (path === trimmed)
|
|
78
|
+
return "~";
|
|
79
|
+
const next = path[trimmed.length];
|
|
80
|
+
return path.startsWith(trimmed) && (next === "/" || next === "\\")
|
|
81
|
+
? `~${path.slice(trimmed.length)}`
|
|
82
|
+
: path;
|
|
83
|
+
}
|
|
84
|
+
export function startupInfo(runtime, home) {
|
|
85
|
+
const { resources } = runtime;
|
|
86
|
+
const info = {
|
|
87
|
+
version: AMA_VERSION,
|
|
88
|
+
model: formatModelRef(runtime.model),
|
|
89
|
+
thinking: runtime.thinkingLevel,
|
|
90
|
+
cwd: tildePath(runtime.paths.cwd, home),
|
|
91
|
+
trusted: runtime.trust.trusted,
|
|
92
|
+
trustSource: TRUST_SOURCE[runtime.trust.source],
|
|
93
|
+
permissionMode: runtime.session.state.permissionMode,
|
|
94
|
+
preset: runtime.config.tools?.preset ?? "default",
|
|
95
|
+
codemode: effectiveCodemodeMode(runtime.config),
|
|
96
|
+
contextFiles: resources.contextFiles.map((f) => basename(f.path)),
|
|
97
|
+
skills: resources.skills.filter((s) => !isBuiltinSkill(s)).length,
|
|
98
|
+
prompts: resources.prompts.length,
|
|
99
|
+
hooks: runtime.hooks.list().length,
|
|
100
|
+
warnings: runtime.warnings.length,
|
|
101
|
+
};
|
|
102
|
+
if (runtime.host !== undefined)
|
|
103
|
+
info.host = runtime.host.adapter.id;
|
|
104
|
+
return info;
|
|
105
|
+
}
|
|
@@ -26,7 +26,7 @@ export interface ModelChoice {
|
|
|
26
26
|
provider: ProviderData;
|
|
27
27
|
}
|
|
28
28
|
/** 第 11 步:解析模型与 key。 */
|
|
29
|
-
export declare function resolveModel(args: ParsedArgs, registry: ProviderRegistryApi, manager: SessionManagerApi, defaultModel: string | undefined, deps: RuntimeDeps, interactive: boolean): Promise<ModelChoice>;
|
|
29
|
+
export declare function resolveModel(args: ParsedArgs, registry: ProviderRegistryApi, manager: SessionManagerApi, defaultModel: string | undefined, deps: RuntimeDeps, interactive: boolean, env?: Readonly<Record<string, string | undefined>>): Promise<ModelChoice>;
|
|
30
30
|
export declare function thinkingOf(args: ParsedArgs, manager: SessionManagerApi, fallback: ModelThinkingLevel | undefined): ModelThinkingLevel;
|
|
31
31
|
/** 第 12 步之后:`--tools` / `--exclude-tools`(宿主工具注册后再校验,宿主工具名也可用)。 */
|
|
32
32
|
export declare function applyToolFilters(args: ParsedArgs, runtimeTools: Runtime["tools"]): void;
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* 启动序列的单步辅助(设计 §11.1):错误映射、模式判定、profile 合并、会话请求、
|
|
3
3
|
* 模型与思考级别解析、工具过滤、指令文件。[B5] 由 cli/bootstrap.ts 编排。
|
|
4
4
|
*/
|
|
5
|
+
import { describeLookupFailure } from "../ai/providers/suggest.js";
|
|
5
6
|
import { formatModelRef } from "../ai/providers/channels.js";
|
|
6
7
|
import { statSync } from "node:fs";
|
|
7
8
|
import { isAbsolute, resolve } from "node:path";
|
|
8
9
|
import { AmaError, StartupError, isAmaError } from "../errors.js";
|
|
9
10
|
import { UsageError } from "./args.js";
|
|
10
|
-
import { pickDefaultModel } from "./default-model.js";
|
|
11
|
+
import { noModelGuidance, pickDefaultModel } from "./default-model.js";
|
|
12
|
+
import { hideFakeProvider } from "./fake-visibility.js";
|
|
11
13
|
import { ExitCode } from "./exit-codes.js";
|
|
12
14
|
/** 把非 StartupError 包成指定退出码;StartupError / UsageError 原样透传。 */
|
|
13
15
|
export async function step(exitCode, label, fn) {
|
|
@@ -43,7 +45,9 @@ export function toStartupError(error, exitCode, label) {
|
|
|
43
45
|
}
|
|
44
46
|
/** 第 4 步。 */
|
|
45
47
|
export function decideMode(args, io) {
|
|
46
|
-
|
|
48
|
+
// [W5-EG] --mode acp 与 rpc 同一装配(宿主看到的 mode 也是 rpc);ACP 服务端由调用方
|
|
49
|
+
// (runCli 或 SDK 自己的 runAcpMode)接在 Runtime 上
|
|
50
|
+
if (args.mode === "rpc" || args.mode === "acp")
|
|
47
51
|
return "rpc";
|
|
48
52
|
if (args.print)
|
|
49
53
|
return "print";
|
|
@@ -64,9 +68,15 @@ export function applyProfile(args, profile) {
|
|
|
64
68
|
merged.trust = true;
|
|
65
69
|
merged.instructions = [...profile.instructions, ...args.instructions];
|
|
66
70
|
merged.skillDirs = [...args.skillDirs, ...profile.skillDirs];
|
|
71
|
+
// [W5-C0] 子 Agent 目录:--agent-dir 在前、profile agentDirs 在后(W5-G 接入发现)
|
|
72
|
+
const agentDirs = [...(args.agentDirs ?? []), ...(profile.agentDirs ?? [])];
|
|
73
|
+
if (agentDirs.length > 0)
|
|
74
|
+
merged.agentDirs = agentDirs;
|
|
67
75
|
return merged;
|
|
68
76
|
}
|
|
69
77
|
export function sessionRequestOf(args) {
|
|
78
|
+
if (args.noSession)
|
|
79
|
+
return { kind: "memory" };
|
|
70
80
|
if (args.continue)
|
|
71
81
|
return { kind: "continue" };
|
|
72
82
|
if (args.resume)
|
|
@@ -80,7 +90,7 @@ export function sessionRequestOf(args) {
|
|
|
80
90
|
export function sourceOf(request, manager) {
|
|
81
91
|
if (request.kind === "fork")
|
|
82
92
|
return "fork";
|
|
83
|
-
if (request.kind === "new")
|
|
93
|
+
if (request.kind === "new" || request.kind === "memory")
|
|
84
94
|
return "startup";
|
|
85
95
|
return manager.entries().length > 0 ? "resume" : "startup";
|
|
86
96
|
}
|
|
@@ -94,7 +104,7 @@ export function lastEntry(manager, predicate) {
|
|
|
94
104
|
return undefined;
|
|
95
105
|
}
|
|
96
106
|
/** 第 11 步:解析模型与 key。 */
|
|
97
|
-
export async function resolveModel(args, registry, manager, defaultModel, deps, interactive) {
|
|
107
|
+
export async function resolveModel(args, registry, manager, defaultModel, deps, interactive, env = {}) {
|
|
98
108
|
if (args.provider !== undefined && args.model === undefined) {
|
|
99
109
|
throw new UsageError(`--provider ${args.provider} 需要同时给出 --model(不回退到该供应商的缺省模型)`);
|
|
100
110
|
}
|
|
@@ -102,13 +112,8 @@ export async function resolveModel(args, registry, manager, defaultModel, deps,
|
|
|
102
112
|
const found = registry.findModel(ref);
|
|
103
113
|
if (found.ok)
|
|
104
114
|
return { model: found.model, provider: found.provider };
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
? "供应商不存在"
|
|
108
|
-
: found.reason === "ambiguous"
|
|
109
|
-
? "模型名有歧义"
|
|
110
|
-
: "模型不存在";
|
|
111
|
-
throw new StartupError("model_not_found", `${label}${what}:${ref}${hint}`, ExitCode.NoModel);
|
|
115
|
+
const code = found.reason === "provider_not_found" ? "provider_not_found" : "model_not_found";
|
|
116
|
+
throw new StartupError(code, `${label}${describeLookupFailure(ref, found)}`, ExitCode.NoModel);
|
|
112
117
|
};
|
|
113
118
|
let choice;
|
|
114
119
|
if (args.model !== undefined) {
|
|
@@ -137,13 +142,16 @@ export async function resolveModel(args, registry, manager, defaultModel, deps,
|
|
|
137
142
|
}
|
|
138
143
|
}
|
|
139
144
|
const pick = async (reason) => {
|
|
140
|
-
|
|
145
|
+
// 选择器不列测试供应商 fake(AMA_SHOW_FAKE=1 或 AMA_FAKE_SCRIPT 时照列)
|
|
146
|
+
const picked = interactive
|
|
147
|
+
? await deps.ui?.pickModel?.(hideFakeProvider(registry, env), reason)
|
|
148
|
+
: undefined;
|
|
141
149
|
if (picked === undefined)
|
|
142
150
|
throw new StartupError("no_api_key", reason, ExitCode.NoModel);
|
|
143
151
|
return lookup(picked, "");
|
|
144
152
|
};
|
|
145
153
|
if (choice === undefined) {
|
|
146
|
-
return pick(
|
|
154
|
+
return pick(noModelGuidance(registry));
|
|
147
155
|
}
|
|
148
156
|
if (choice.provider.requiresApiKey) {
|
|
149
157
|
const key = await registry.resolveApiKey(choice.provider.id);
|
|
@@ -3,16 +3,20 @@
|
|
|
3
3
|
* 每一项标出来自哪一层(default / user / profile / project),并给出将使用的模型与原因
|
|
4
4
|
* (`config.defaultModel` 或零配置选择)。只读;config 里的字面量 apiKey 只显示种类。[B6]
|
|
5
5
|
*
|
|
6
|
+
* 缺省值来自 config/key-docs.ts 的 DISPLAY_DEFAULTS(含 DEFAULT_CONFIG 不写的 cache / codemode 等段),
|
|
7
|
+
* `codemode.mode` 不写时显示跟随预设的结果与原因;`--tools-preset` / `--codemode` 作为 cli 层叠加;
|
|
8
|
+
* 预设写的是旧名(codemode)时显示规范名并提示。
|
|
9
|
+
*
|
|
6
10
|
* [W3-B12] 「供应商」节:config 里出现的供应商与 baseUrl 来自环境变量(`OPENAI_BASE_URL` /
|
|
7
11
|
* `ANTHROPIC_BASE_URL`)的内置供应商,列出协议、生效 baseUrl 与来源、config 里每个模型的协议
|
|
8
12
|
* (模型级 `api` 生效后的值)。
|
|
9
13
|
*/
|
|
10
|
-
import type
|
|
14
|
+
import { type AmaConfig, type CodemodeMode } from "../../config/types.js";
|
|
11
15
|
import type { Api, ProviderRegistryApi } from "../../ai/types.js";
|
|
12
16
|
import type { CliIo, RuntimeDeps } from "../deps.js";
|
|
13
|
-
export declare const CONFIG_USAGE = "\u7528\u6CD5\uFF1Aama config show [--json] [--profile <\u6587\u4EF6>] [--auth-file <\u6587\u4EF6>]\n ama config path \u914D\u7F6E\u76EE\u5F55\u3001\u6570\u636E\u76EE\u5F55\u4E0E\u5404\u6587\u4EF6\u8DEF\u5F84\n ama config edit \u7528 $VISUAL / $EDITOR \u6253\u5F00 config.json\uFF08\u6CA1\u6709\u7F16\u8F91\u5668\u65F6\u6253\u5370\u8DEF\u5F84\uFF09\n";
|
|
17
|
+
export declare const CONFIG_USAGE = "\u7528\u6CD5\uFF1Aama config show [--json] [--profile <\u6587\u4EF6>] [--auth-file <\u6587\u4EF6>]\n [--tools-preset <\u540D>] [--codemode off|on|only]\n ama config path \u914D\u7F6E\u76EE\u5F55\u3001\u6570\u636E\u76EE\u5F55\u4E0E\u5404\u6587\u4EF6\u8DEF\u5F84\n ama config edit \u7528 $VISUAL / $EDITOR \u6253\u5F00 config.json\uFF08\u6CA1\u6709\u7F16\u8F91\u5668\u65F6\u6253\u5370\u8DEF\u5F84\uFF09\n";
|
|
14
18
|
type Layer = {
|
|
15
|
-
name: "default" | "user" | "profile" | "project";
|
|
19
|
+
name: "default" | "user" | "profile" | "project" | "cli";
|
|
16
20
|
label: string;
|
|
17
21
|
value: unknown;
|
|
18
22
|
};
|
|
@@ -49,5 +53,20 @@ export interface ProviderDescription {
|
|
|
49
53
|
export declare function describeProviders(config: AmaConfig, registry: ProviderRegistryApi | undefined): ProviderDescription[];
|
|
50
54
|
/** 每个生效叶子的来源:累加型列表列出所有贡献层,其余取最后设置它的层。 */
|
|
51
55
|
export declare function sourcesOf(effective: AmaConfig, layers: readonly Layer[]): Map<string, string>;
|
|
56
|
+
export interface CodemodeDescription {
|
|
57
|
+
mode: CodemodeMode;
|
|
58
|
+
/** config:显式 codemode.mode;preset:跟随预设。 */
|
|
59
|
+
source: "config" | "preset";
|
|
60
|
+
/** 人读原因。 */
|
|
61
|
+
reason: string;
|
|
62
|
+
strict: boolean;
|
|
63
|
+
/** 生效模式不是 off 但 codemode 工具不可用(requireStrict)时的说明。 */
|
|
64
|
+
unavailable?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* codemode 生效模式与原因(跟随预设时写明预设与网络由谁隔离)。传 `nodeVersion` 是假设性计算(不探测
|
|
68
|
+
* 操作系统沙箱);不传按配置的 `sandbox.enabled` 用运行时能力。
|
|
69
|
+
*/
|
|
70
|
+
export declare function describeCodemode(config: AmaConfig, nodeVersion?: string): CodemodeDescription;
|
|
52
71
|
export declare function runConfig(argv: readonly string[], io: CliIo, deps: Pick<RuntimeDeps, "providers"> | undefined): Promise<number>;
|
|
53
72
|
export {};
|
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
* 每一项标出来自哪一层(default / user / profile / project),并给出将使用的模型与原因
|
|
4
4
|
* (`config.defaultModel` 或零配置选择)。只读;config 里的字面量 apiKey 只显示种类。[B6]
|
|
5
5
|
*
|
|
6
|
+
* 缺省值来自 config/key-docs.ts 的 DISPLAY_DEFAULTS(含 DEFAULT_CONFIG 不写的 cache / codemode 等段),
|
|
7
|
+
* `codemode.mode` 不写时显示跟随预设的结果与原因;`--tools-preset` / `--codemode` 作为 cli 层叠加;
|
|
8
|
+
* 预设写的是旧名(codemode)时显示规范名并提示。
|
|
9
|
+
*
|
|
6
10
|
* [W3-B12] 「供应商」节:config 里出现的供应商与 baseUrl 来自环境变量(`OPENAI_BASE_URL` /
|
|
7
11
|
* `ANTHROPIC_BASE_URL`)的内置供应商,列出协议、生效 baseUrl 与来源、config 里每个模型的协议
|
|
8
12
|
* (模型级 `api` 生效后的值)。
|
|
9
13
|
*/
|
|
10
14
|
import { metadataOf, modelFlags, sourcesLine } from "./model-meta.js";
|
|
11
15
|
import { loadConfigFile } from "../../config/load.js";
|
|
12
|
-
import {
|
|
16
|
+
import { PROFILE_DEFAULTS, cliOverridesToConfig, mergeConfig, mergeProjectAndCli, } from "../../config/merge.js";
|
|
17
|
+
import { DISPLAY_DEFAULTS } from "../../config/key-docs.js";
|
|
13
18
|
import { AUTH_FILE, CONFIG_FILE, HOOKS_FILE, projectFile, resolveConfigDir, resolveDataDir, } from "../../config/paths.js";
|
|
14
19
|
import { spawnSync } from "node:child_process";
|
|
15
20
|
import { existsSync } from "node:fs";
|
|
@@ -17,15 +22,20 @@ import { join } from "node:path";
|
|
|
17
22
|
import { modelsDevCachePath } from "../../ai/providers/models-dev-cache.js";
|
|
18
23
|
import { initConfigDir } from "../../config/init.js";
|
|
19
24
|
import { CONFIG_SCHEMA_FILE } from "../../config/json-schema.js";
|
|
25
|
+
import { CODEMODE_MODES, TOOLS_PRESET_ALIASES, TOOLS_PRESET_INPUTS, canonicalPreset, } from "../../config/types.js";
|
|
26
|
+
import { codemodeAvailability, detectSandboxCapability, sandboxCapabilityFor, } from "../../codemode/capability.js";
|
|
20
27
|
import { baseUrlEnvOf } from "../../ai/providers/registry.js";
|
|
21
28
|
import { classifyKeyValue } from "../../config/auth-file.js";
|
|
22
|
-
import {
|
|
29
|
+
import { CODEMODE_TOOL, resolveCodemodeMode, resolvePreset } from "../../tools/presets.js";
|
|
23
30
|
import { builtinTools } from "../../tools/registry.js";
|
|
24
31
|
import { parseSubArgs, UsageError } from "../args.js";
|
|
25
|
-
import { pickDefaultModel } from "../default-model.js";
|
|
32
|
+
import { noModelGuidance, pickDefaultModel } from "../default-model.js";
|
|
26
33
|
import { ExitCode } from "../exit-codes.js";
|
|
27
34
|
import { buildRegistry, loadUserLevel } from "./context.js";
|
|
35
|
+
import { osSandboxStatus } from "../../sandbox/detect.js";
|
|
36
|
+
import { resolveBashSandbox } from "../../sandbox/bash.js";
|
|
28
37
|
export const CONFIG_USAGE = `用法:ama config show [--json] [--profile <文件>] [--auth-file <文件>]
|
|
38
|
+
[--tools-preset <名>] [--codemode off|on|only]
|
|
29
39
|
ama config path 配置目录、数据目录与各文件路径
|
|
30
40
|
ama config edit 用 $VISUAL / $EDITOR 打开 config.json(没有编辑器时打印路径)
|
|
31
41
|
`;
|
|
@@ -105,13 +115,16 @@ export async function describeModel(config, registry) {
|
|
|
105
115
|
return { ref: undefined, reason: "注册表未装配" };
|
|
106
116
|
const picked = await pickDefaultModel(registry);
|
|
107
117
|
if (picked === undefined)
|
|
108
|
-
return { ref: undefined, reason:
|
|
118
|
+
return { ref: undefined, reason: noModelGuidance(registry) };
|
|
109
119
|
const ref = `${picked.provider.id}/${picked.model.id}`;
|
|
110
120
|
if (picked.via === "local")
|
|
111
|
-
return { ref, reason: `零配置:本地 ${picked.provider.id}
|
|
121
|
+
return { ref, reason: `零配置:本地 ${picked.provider.id} 可达;${picked.rule}` };
|
|
112
122
|
const key = await registry.resolveApiKey(picked.provider.id);
|
|
113
123
|
const origin = key.origin !== undefined ? ` ${key.origin}` : "";
|
|
114
|
-
return {
|
|
124
|
+
return {
|
|
125
|
+
ref,
|
|
126
|
+
reason: `零配置:${picked.provider.id} 有 key(${key.source}${origin});${picked.rule}`,
|
|
127
|
+
};
|
|
115
128
|
}
|
|
116
129
|
/** config 里出现的供应商 + baseUrl 来自环境变量的内置供应商。 */
|
|
117
130
|
export function describeProviders(config, registry) {
|
|
@@ -171,8 +184,8 @@ function providerLines(providers) {
|
|
|
171
184
|
}
|
|
172
185
|
return lines;
|
|
173
186
|
}
|
|
174
|
-
function layersOf(level, project, effective) {
|
|
175
|
-
const layers = [{ name: "default", label: "内置缺省", value:
|
|
187
|
+
function layersOf(level, project, effective, cli) {
|
|
188
|
+
const layers = [{ name: "default", label: "内置缺省", value: DISPLAY_DEFAULTS }];
|
|
176
189
|
const user = loadConfigFile("config", level.userConfigPath)?.value;
|
|
177
190
|
if (user !== undefined)
|
|
178
191
|
layers.push({ name: "user", label: level.userConfigPath, value: user });
|
|
@@ -195,6 +208,8 @@ function layersOf(level, project, effective) {
|
|
|
195
208
|
}
|
|
196
209
|
layers.push({ name: "project", label: ".ama/config.json", value: unflatten(accepted) });
|
|
197
210
|
}
|
|
211
|
+
if (cli !== undefined && Object.keys(cli).length > 0)
|
|
212
|
+
layers.push({ name: "cli", label: "命令行", value: cli });
|
|
198
213
|
return layers;
|
|
199
214
|
}
|
|
200
215
|
function unflatten(flat) {
|
|
@@ -221,8 +236,53 @@ export function sourcesOf(effective, layers) {
|
|
|
221
236
|
}
|
|
222
237
|
return sources;
|
|
223
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* codemode 生效模式与原因(跟随预设时写明预设与网络由谁隔离)。传 `nodeVersion` 是假设性计算(不探测
|
|
241
|
+
* 操作系统沙箱);不传按配置的 `sandbox.enabled` 用运行时能力。
|
|
242
|
+
*/
|
|
243
|
+
export function describeCodemode(config, nodeVersion) {
|
|
244
|
+
const capability = nodeVersion === undefined ? sandboxCapabilityFor(config) : detectSandboxCapability(nodeVersion);
|
|
245
|
+
const resolved = resolveCodemodeMode(config, capability.strict);
|
|
246
|
+
const sandbox = capability.nodeMajor >= 25
|
|
247
|
+
? `Node ${capability.nodeMajor} 网络已隔离`
|
|
248
|
+
: capability.strict
|
|
249
|
+
? `Node ${capability.nodeMajor} 网络由操作系统沙箱 ${capability.os.kind} 隔离`
|
|
250
|
+
: `Node ${capability.nodeMajor} < 25 网络未隔离`;
|
|
251
|
+
const reason = resolved.source === "config"
|
|
252
|
+
? `codemode.mode 显式设置(${sandbox})`
|
|
253
|
+
: `跟随预设 ${resolved.preset}(${sandbox})`;
|
|
254
|
+
const out = {
|
|
255
|
+
mode: resolved.mode,
|
|
256
|
+
source: resolved.source,
|
|
257
|
+
reason,
|
|
258
|
+
strict: capability.strict,
|
|
259
|
+
};
|
|
260
|
+
if (resolved.mode !== "off") {
|
|
261
|
+
const availability = codemodeAvailability(config.codemode?.requireStrict, capability);
|
|
262
|
+
if (!availability.available)
|
|
263
|
+
out.unavailable = availability.warning;
|
|
264
|
+
}
|
|
265
|
+
return out;
|
|
266
|
+
}
|
|
267
|
+
/** 各层里把 tools.preset 写成旧名(别名)的:`user(写的是旧名 codemode)`。 */
|
|
268
|
+
function presetAliasNotes(layers) {
|
|
269
|
+
const notes = [];
|
|
270
|
+
for (const layer of layers) {
|
|
271
|
+
const preset = layer.value?.tools?.preset;
|
|
272
|
+
if (preset !== undefined && Object.hasOwn(TOOLS_PRESET_ALIASES, preset))
|
|
273
|
+
notes.push(`${layer.name}(${layer.label})的 tools.preset 写的是旧名 ${preset},规范名 ${canonicalPreset(preset)}`);
|
|
274
|
+
}
|
|
275
|
+
return notes;
|
|
276
|
+
}
|
|
277
|
+
function choice(name, value, all) {
|
|
278
|
+
if (value === undefined)
|
|
279
|
+
return undefined;
|
|
280
|
+
if (all.includes(value))
|
|
281
|
+
return value;
|
|
282
|
+
throw new UsageError(`--${name} 的取值应为 ${all.join(" | ")}(收到 ${value})`);
|
|
283
|
+
}
|
|
224
284
|
export async function runConfig(argv, io, deps) {
|
|
225
|
-
const { positionals, values, flags } = parseSubArgs(argv, ["profile", "auth-file"], ["json"]);
|
|
285
|
+
const { positionals, values, flags } = parseSubArgs(argv, ["profile", "auth-file", "tools-preset", "codemode"], ["json"]);
|
|
226
286
|
const action = positionals[0] ?? "show";
|
|
227
287
|
if (flags.has("help")) {
|
|
228
288
|
io.stdout(CONFIG_USAGE);
|
|
@@ -234,42 +294,80 @@ export async function runConfig(argv, io, deps) {
|
|
|
234
294
|
return editConfig(io);
|
|
235
295
|
if (action !== "show")
|
|
236
296
|
throw new UsageError(`未知的 config 子命令:${action}`);
|
|
297
|
+
const cli = {};
|
|
298
|
+
const presetFlag = choice("tools-preset", values.get("tools-preset"), TOOLS_PRESET_INPUTS);
|
|
299
|
+
if (presetFlag !== undefined)
|
|
300
|
+
cli.toolsPreset = presetFlag;
|
|
301
|
+
const codemodeFlag = choice("codemode", values.get("codemode"), CODEMODE_MODES);
|
|
302
|
+
if (codemodeFlag !== undefined)
|
|
303
|
+
cli.codemode = codemodeFlag;
|
|
237
304
|
const level = loadUserLevel(io, {
|
|
238
305
|
profile: values.get("profile"),
|
|
239
306
|
authFile: values.get("auth-file"),
|
|
240
307
|
});
|
|
241
308
|
const project = loadConfigFile("config", projectFile(io.cwd, CONFIG_FILE))?.value;
|
|
242
|
-
const merged = mergeProjectAndCli(level.merged, project,
|
|
309
|
+
const merged = mergeProjectAndCli(level.merged, project, cli);
|
|
243
310
|
const config = merged.config;
|
|
244
|
-
const layers = layersOf(level, project, config);
|
|
245
|
-
|
|
311
|
+
const layers = layersOf(level, project, config, cliOverridesToConfig(cli));
|
|
312
|
+
// 展示:生效配置补上 DEFAULT_CONFIG 不写的缺省(cache、codemode.inlineBudget 等),来源 default
|
|
313
|
+
const shown = mergeConfig(DISPLAY_DEFAULTS, config);
|
|
314
|
+
const sources = sourcesOf(shown, layers);
|
|
246
315
|
const registry = deps === undefined ? undefined : await buildRegistry(level, io, deps);
|
|
247
316
|
const model = await describeModel(config, registry);
|
|
248
317
|
const providers = describeProviders(config, registry);
|
|
318
|
+
const codemode = describeCodemode(config);
|
|
319
|
+
const bashSandbox = resolveBashSandbox(config.sandbox, {
|
|
320
|
+
status: osSandboxStatus(config.sandbox?.enabled ?? "auto"),
|
|
321
|
+
});
|
|
249
322
|
const builtin = new Set(builtinTools().map((tool) => tool.name));
|
|
250
|
-
|
|
323
|
+
if (codemode.mode !== "off" && codemode.unavailable === undefined)
|
|
324
|
+
builtin.add(CODEMODE_TOOL);
|
|
325
|
+
const preset = resolvePreset({
|
|
326
|
+
config,
|
|
327
|
+
available: (name) => builtin.has(name),
|
|
328
|
+
strict: codemode.strict,
|
|
329
|
+
});
|
|
330
|
+
const notes = presetAliasNotes(layers);
|
|
251
331
|
const warnings = [...level.warnings, ...merged.warnings];
|
|
332
|
+
const rows = [...flatten(shown)].map(([path, value]) => ({
|
|
333
|
+
path,
|
|
334
|
+
value,
|
|
335
|
+
source: sources.get(path) ?? "default",
|
|
336
|
+
}));
|
|
337
|
+
if (config.codemode?.mode === undefined)
|
|
338
|
+
rows.push({
|
|
339
|
+
path: "codemode.mode",
|
|
340
|
+
value: codemode.mode,
|
|
341
|
+
source: `default(${codemode.reason})`,
|
|
342
|
+
});
|
|
343
|
+
rows.sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
|
|
252
344
|
if (flags.has("json")) {
|
|
253
|
-
const entries =
|
|
345
|
+
const entries = rows.map(({ path, value, source }) => ({
|
|
254
346
|
path,
|
|
255
347
|
value: path.endsWith(".apiKey") ? display(path, value) : value,
|
|
256
|
-
source
|
|
348
|
+
source,
|
|
257
349
|
}));
|
|
258
|
-
io.stdout(`${JSON.stringify({ model, providers, tools: preset.builtin, codemode:
|
|
350
|
+
io.stdout(`${JSON.stringify({ model, providers, tools: preset.builtin, preset: preset.preset, codemode, bashSandbox: { active: bashSandbox.active, detail: bashSandbox.detail }, entries, layers: layers.map((l) => ({ name: l.name, file: l.label })), notes, warnings }, null, 2)}\n`);
|
|
259
351
|
return ExitCode.Ok;
|
|
260
352
|
}
|
|
261
|
-
const lines = ["生效配置(来源:default 内置 ← user ← profile ← project
|
|
353
|
+
const lines = ["生效配置(来源:default 内置 ← user ← profile ← project 只能收紧 ← cli)"];
|
|
262
354
|
for (const layer of layers.slice(1))
|
|
263
355
|
lines.push(` ${layer.name}:${layer.label}`);
|
|
264
356
|
lines.push("");
|
|
265
|
-
const
|
|
266
|
-
const width = Math.min(60, Math.max(...
|
|
267
|
-
for (const [text, source] of
|
|
268
|
-
lines.push(` ${text.padEnd(width)} ${source}`);
|
|
357
|
+
const texts = rows.map((row) => [`${row.path} = ${display(row.path, row.value)}`, row.source]);
|
|
358
|
+
const width = Math.min(60, Math.max(...texts.map(([text]) => (text ?? "").length)));
|
|
359
|
+
for (const [text, source] of texts)
|
|
360
|
+
lines.push(` ${(text ?? "").padEnd(width)} ${source}`);
|
|
269
361
|
lines.push(...providerLines(providers));
|
|
270
362
|
lines.push("");
|
|
271
363
|
lines.push(`模型:${model.ref ?? "(无)"} ${model.reason}`);
|
|
272
364
|
lines.push(`工具:${preset.builtin.join(", ")}(预设 ${preset.preset},codemode ${preset.codemode})`);
|
|
365
|
+
lines.push(`codemode:${codemode.mode} ${codemode.reason}`);
|
|
366
|
+
if (codemode.unavailable !== undefined)
|
|
367
|
+
lines.push(` ${codemode.unavailable}`);
|
|
368
|
+
lines.push(`bash 沙箱:${bashSandbox.detail}`);
|
|
369
|
+
for (const note of notes)
|
|
370
|
+
lines.push(`提示:${note}`);
|
|
273
371
|
for (const warning of [...warnings, ...preset.warnings])
|
|
274
372
|
lines.push(`警告:${warning}`);
|
|
275
373
|
io.stdout(`${lines.join("\n")}\n`);
|
|
@@ -7,6 +7,7 @@ import { loadConfigFile } from "../../config/load.js";
|
|
|
7
7
|
import { mergeBaseLayers } from "../../config/merge.js";
|
|
8
8
|
import { CONFIG_FILE, resolveConfigDir, resolveDataDir, userFile } from "../../config/paths.js";
|
|
9
9
|
import { loadProfile } from "../../config/profile.js";
|
|
10
|
+
import { hideFakeProvider } from "../fake-visibility.js";
|
|
10
11
|
export function loadUserLevel(io, options = {}) {
|
|
11
12
|
const configDir = resolveConfigDir({ env: io.env });
|
|
12
13
|
const dataDir = resolveDataDir({ env: io.env });
|
|
@@ -32,11 +33,13 @@ export function loadUserLevel(io, options = {}) {
|
|
|
32
33
|
return result;
|
|
33
34
|
}
|
|
34
35
|
export async function buildRegistry(level, io, deps) {
|
|
35
|
-
|
|
36
|
+
// 列表类子命令(doctor / models list / providers list / config show)缺省不列 fake
|
|
37
|
+
const registry = await deps.providers.create({
|
|
36
38
|
config: level.merged.config,
|
|
37
39
|
cwd: io.cwd,
|
|
38
40
|
authFile: level.authFile,
|
|
39
41
|
authEnv: level.profile?.authEnv ?? true,
|
|
40
42
|
dataDir: level.dataDir,
|
|
41
43
|
});
|
|
44
|
+
return hideFakeProvider(registry, io.env);
|
|
42
45
|
}
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
* [W3-B12] baseUrl 来自 `OPENAI_BASE_URL` / `ANTHROPIC_BASE_URL` 时在 key 行后标出变量与地址。
|
|
8
8
|
*/
|
|
9
9
|
import { existsSync } from "node:fs";
|
|
10
|
+
import { blobUsage, fileHistoryDir } from "../../checkpoints/blobs.js";
|
|
11
|
+
import { shadowUsage } from "../../checkpoints/shadow-git.js";
|
|
12
|
+
import { formatBytes } from "../../checkpoints/gc.js";
|
|
10
13
|
import { baseUrlEnvOf } from "../../ai/providers/registry.js";
|
|
11
14
|
import { classifyKeyValue, isModeTooOpen, fileMode, readAuthFile } from "../../config/auth-file.js";
|
|
12
15
|
import { findContextFiles } from "../../config/context-files.js";
|
|
@@ -15,10 +18,13 @@ import { mergeProjectAndCli } from "../../config/merge.js";
|
|
|
15
18
|
import { CONFIG_FILE, HOOKS_FILE, projectFile, userFile } from "../../config/paths.js";
|
|
16
19
|
import { findTrustEntry, readTrustFile, trustGatedResources } from "../../config/trust.js";
|
|
17
20
|
import { loadHookConfigs } from "../../hooks/config.js";
|
|
21
|
+
import { osSandboxStatus } from "../../sandbox/detect.js";
|
|
22
|
+
import { resolveBashSandbox } from "../../sandbox/bash.js";
|
|
18
23
|
import { AMA_VERSION } from "../../version.js";
|
|
19
24
|
import { parseSubArgs } from "../args.js";
|
|
20
25
|
import { ExitCode } from "../exit-codes.js";
|
|
21
|
-
import {
|
|
26
|
+
import { describeProxy, inspectProxy } from "../proxy.js";
|
|
27
|
+
import { describeCodemode, describeModel } from "./config.js";
|
|
22
28
|
import { buildRegistry, loadUserLevel } from "./context.js";
|
|
23
29
|
export const DOCTOR_USAGE = `用法:ama doctor [--profile <文件>] [--auth-file <文件>] [--trust | --no-trust]
|
|
24
30
|
`;
|
|
@@ -184,6 +190,23 @@ function terminalSection(report, io) {
|
|
|
184
190
|
const tui = io.stdinIsTTY && io.stdoutIsTTY && env["TERM"] !== "dumb";
|
|
185
191
|
report.item(`缺省界面:${tui ? "终端界面" : "行式(--no-tui 等价)"}`);
|
|
186
192
|
}
|
|
193
|
+
function proxySection(report, io) {
|
|
194
|
+
report.section("代理");
|
|
195
|
+
for (const line of describeProxy(inspectProxy(io.env)))
|
|
196
|
+
report.item(line);
|
|
197
|
+
}
|
|
198
|
+
/** 检查点备份占用(docs/rewind-plan.md §1.4)。 */
|
|
199
|
+
async function fileHistoryLine(report, dataDir) {
|
|
200
|
+
try {
|
|
201
|
+
const usage = await blobUsage(dataDir);
|
|
202
|
+
const shadow = await shadowUsage(dataDir);
|
|
203
|
+
const shadowText = shadow.repos === 0 ? "" : `;影子仓库 ${shadow.repos} 个,${formatBytes(shadow.bytes)}`;
|
|
204
|
+
report.item(`file-history:${usage.blobs} 个备份,${formatBytes(usage.bytes)}${shadowText}(${fileHistoryDir(dataDir)};ama sessions prune 清理)`);
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
report.item(`file-history:读取失败(${error.message})`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
187
210
|
export async function runDoctor(argv, io, deps) {
|
|
188
211
|
const { values, flags } = parseSubArgs(argv, ["profile", "auth-file"], ["trust", "no-trust"]);
|
|
189
212
|
if (flags.has("help")) {
|
|
@@ -207,6 +230,7 @@ export async function runDoctor(argv, io, deps) {
|
|
|
207
230
|
report.section("目录");
|
|
208
231
|
report.item(`配置目录:${level.configDir}`);
|
|
209
232
|
report.item(`数据目录:${level.dataDir}${existsSync(level.dataDir) ? "" : "(尚未创建)"}`);
|
|
233
|
+
await fileHistoryLine(report, level.dataDir);
|
|
210
234
|
report.section("配置层级(缺省 ← 用户级 ← profile ← 项目级(只能收紧)← 命令行)");
|
|
211
235
|
report.item("缺省:内置");
|
|
212
236
|
probeLine(report, "用户级", "config", level.userConfigPath);
|
|
@@ -223,6 +247,13 @@ export async function runDoctor(argv, io, deps) {
|
|
|
223
247
|
for (const warning of merged.warnings)
|
|
224
248
|
report.item(` 收紧:${warning}`);
|
|
225
249
|
report.item(`有效权限模式:${merged.config.permission?.mode ?? "default"}`);
|
|
250
|
+
const codemode = describeCodemode(merged.config);
|
|
251
|
+
report.item(`codemode:${codemode.mode}(${codemode.reason})`);
|
|
252
|
+
if (codemode.unavailable !== undefined)
|
|
253
|
+
report.item(` ${codemode.unavailable}`);
|
|
254
|
+
const os = osSandboxStatus(merged.config.sandbox?.enabled ?? "auto");
|
|
255
|
+
report.item(`操作系统沙箱:${os.kind === "none" ? "无" : os.kind}(${os.detail}${os.kind !== "none" && !os.restrictsWrites ? ";只隔离网络" : ""})`);
|
|
256
|
+
report.item(`bash 沙箱:${resolveBashSandbox(merged.config.sandbox, { status: os }).detail}`);
|
|
226
257
|
}
|
|
227
258
|
catch {
|
|
228
259
|
// probeLine 已报告
|
|
@@ -240,6 +271,7 @@ export async function runDoctor(argv, io, deps) {
|
|
|
240
271
|
await keySection(report, io, level, deps);
|
|
241
272
|
hookSection(report, io, level, trusted);
|
|
242
273
|
report.item(`用户级 hooks.json:${userFile(level, HOOKS_FILE)}`);
|
|
274
|
+
proxySection(report, io);
|
|
243
275
|
terminalSection(report, io);
|
|
244
276
|
io.stdout(report.text());
|
|
245
277
|
return report.problems > 0 ? ExitCode.Config : ExitCode.Ok;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `ama init [--force]`(docs/providers.md「配置目录」):建配置目录与缺省文件,逐个报告状态。
|
|
3
3
|
*/
|
|
4
|
-
import { describeInit, initConfigDir } from "../../config/init.js";
|
|
4
|
+
import { INIT_NEXT_STEPS, describeInit, initConfigDir } from "../../config/init.js";
|
|
5
5
|
import { resolveConfigDir } from "../../config/paths.js";
|
|
6
6
|
import { parseSubArgs, UsageError } from "../args.js";
|
|
7
7
|
import { ExitCode } from "../exit-codes.js";
|
|
@@ -18,5 +18,6 @@ export function runInit(argv, io) {
|
|
|
18
18
|
throw new UsageError(`多余的参数:${positionals.join(" ")}`);
|
|
19
19
|
const result = initConfigDir(resolveConfigDir({ env: io.env }), { force: flags.has("force") });
|
|
20
20
|
io.stdout(describeInit(result));
|
|
21
|
+
io.stdout(`\n${INIT_NEXT_STEPS.join("\n")}\n`);
|
|
21
22
|
return ExitCode.Ok;
|
|
22
23
|
}
|