@armadra/agent 0.5.0 → 0.6.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 +177 -294
- package/CHANGELOG.zh-CN.md +442 -0
- package/README.md +408 -364
- package/README.zh-CN.md +705 -0
- package/dist/agent/session-plan.js +2 -2
- package/dist/agent/session-state.d.ts +3 -0
- package/dist/agent/session-state.js +20 -0
- package/dist/agent/session-subagent.d.ts +15 -1
- package/dist/agent/session-subagent.js +26 -3
- package/dist/agent/session-telemetry.d.ts +16 -2
- package/dist/agent/session-telemetry.js +29 -7
- package/dist/agent/session-tools.js +5 -2
- package/dist/agent/session-trace-writer.d.ts +27 -0
- package/dist/agent/session-trace-writer.js +253 -0
- package/dist/agent/session.d.ts +2 -0
- package/dist/agent/session.js +12 -0
- package/dist/agent/subagent-direct.d.ts +20 -0
- package/dist/agent/subagent-direct.js +76 -0
- package/dist/agent/subagent-registry.d.ts +8 -1
- package/dist/agent/subagent-registry.js +28 -1
- package/dist/agent/system-prompt.d.ts +3 -1
- package/dist/agent/system-prompt.js +3 -0
- package/dist/agent/tool-runner.d.ts +2 -1
- package/dist/agent/tool-runner.js +5 -4
- package/dist/agent/types-w6.d.ts +39 -0
- package/dist/agent/types-w6.js +4 -0
- package/dist/agent/types.d.ts +5 -2
- package/dist/agents/external.js +1 -1
- package/dist/agents/task-record.d.ts +74 -1
- package/dist/agents/task-record.js +100 -0
- package/dist/ai/apis/cache-params.js +2 -1
- package/dist/ai/apis/chatgpt-backend.d.ts +52 -0
- package/dist/ai/apis/chatgpt-backend.js +224 -0
- package/dist/ai/apis/chatgpt-rate-limits.d.ts +26 -0
- package/dist/ai/apis/chatgpt-rate-limits.js +91 -0
- package/dist/ai/apis/openai-responses-request.d.ts +2 -1
- package/dist/ai/apis/openai-responses-request.js +8 -2
- package/dist/ai/apis/openai-responses.d.ts +2 -0
- package/dist/ai/apis/openai-responses.js +51 -16
- package/dist/ai/overflow.d.ts +1 -1
- package/dist/ai/overflow.js +10 -7
- package/dist/ai/providers/auth.d.ts +15 -2
- package/dist/ai/providers/auth.js +69 -2
- package/dist/ai/providers/builtin.js +27 -0
- package/dist/ai/providers/catalog-data.js +1 -0
- package/dist/ai/providers/enrich.js +2 -7
- package/dist/ai/providers/models-dev-cache.js +15 -19
- package/dist/ai/providers/models-dev-snapshot.js +8 -7
- package/dist/ai/providers/models-dev.js +5 -15
- package/dist/ai/providers/suggest.js +2 -16
- package/dist/ai/types.d.ts +27 -1
- package/dist/auth/chatgpt/backend-client.d.ts +26 -0
- package/dist/auth/chatgpt/backend-client.js +74 -0
- package/dist/auth/chatgpt/claims.d.ts +17 -0
- package/dist/auth/chatgpt/claims.js +46 -0
- package/dist/auth/chatgpt/cli.d.ts +33 -0
- package/dist/auth/chatgpt/cli.js +252 -0
- package/dist/auth/chatgpt/doctor.d.ts +17 -0
- package/dist/auth/chatgpt/doctor.js +36 -0
- package/dist/auth/chatgpt/host-id.d.ts +7 -0
- package/dist/auth/chatgpt/host-id.js +26 -0
- package/dist/auth/chatgpt/login.d.ts +30 -0
- package/dist/auth/chatgpt/login.js +130 -0
- package/dist/auth/chatgpt/presets.d.ts +66 -0
- package/dist/auth/chatgpt/presets.js +120 -0
- package/dist/auth/chatgpt/quota-text.d.ts +13 -0
- package/dist/auth/chatgpt/quota-text.js +36 -0
- package/dist/auth/oauth/browser.d.ts +12 -0
- package/dist/auth/oauth/browser.js +27 -0
- package/dist/auth/oauth/callback-server.d.ts +47 -0
- package/dist/auth/oauth/callback-server.js +147 -0
- package/dist/auth/oauth/flows.d.ts +62 -0
- package/dist/auth/oauth/flows.js +113 -0
- package/dist/auth/oauth/jwt.d.ts +24 -0
- package/dist/auth/oauth/jwt.js +81 -0
- package/dist/auth/oauth/live.d.ts +21 -0
- package/dist/auth/oauth/live.js +25 -0
- package/dist/auth/oauth/oidc.d.ts +26 -0
- package/dist/auth/oauth/oidc.js +72 -0
- package/dist/auth/oauth/pkce.d.ts +15 -0
- package/dist/auth/oauth/pkce.js +20 -0
- package/dist/auth/oauth/refresh.d.ts +35 -0
- package/dist/auth/oauth/refresh.js +129 -0
- package/dist/auth/oauth/token-client.d.ts +33 -0
- package/dist/auth/oauth/token-client.js +121 -0
- package/dist/auth/oauth/token-store.d.ts +23 -0
- package/dist/auth/oauth/token-store.js +125 -0
- package/dist/auth/testing/fake-oauth.d.ts +73 -0
- package/dist/auth/testing/fake-oauth.js +271 -0
- package/dist/auth/testing/refresh-child.d.ts +5 -0
- package/dist/auth/testing/refresh-child.js +16 -0
- package/dist/bundle/ama.cjs +28307 -13241
- package/dist/checkpoints/backend.js +6 -5
- package/dist/checkpoints/restore.js +3 -2
- package/dist/checkpoints/settings.js +2 -1
- package/dist/checkpoints/shadow-git.js +7 -6
- package/dist/checkpoints/shadow-restore.js +3 -2
- package/dist/checkpoints/tracker.js +4 -3
- package/dist/cli/args.d.ts +9 -2
- package/dist/cli/args.js +74 -27
- package/dist/cli/bootstrap.js +53 -31
- package/dist/cli/choice-prompt.d.ts +58 -0
- package/dist/cli/choice-prompt.js +142 -0
- package/dist/cli/codemode-notice.js +2 -2
- package/dist/cli/compose-agents.js +2 -1
- package/dist/cli/compose-extensions.js +2 -0
- package/dist/cli/compose-memory.d.ts +53 -0
- package/dist/cli/compose-memory.js +127 -0
- package/dist/cli/compose-providers.d.ts +5 -0
- package/dist/cli/compose-providers.js +32 -2
- package/dist/cli/compose-session.d.ts +5 -0
- package/dist/cli/compose-session.js +27 -13
- package/dist/cli/compose-store.d.ts +2 -0
- package/dist/cli/compose-store.js +9 -5
- package/dist/cli/compose.d.ts +2 -0
- package/dist/cli/compose.js +13 -5
- package/dist/cli/default-model.d.ts +0 -2
- package/dist/cli/default-model.js +5 -8
- package/dist/cli/deps.d.ts +5 -1
- package/dist/cli/exit-codes.d.ts +1 -1
- package/dist/cli/exit-codes.js +7 -16
- package/dist/cli/from-prompt.js +3 -2
- package/dist/cli/help-text.d.ts +2 -1
- package/dist/cli/help-text.js +5 -99
- package/dist/cli/main.d.ts +5 -0
- package/dist/cli/main.js +21 -2
- package/dist/cli/proxy.js +14 -9
- package/dist/cli/runtime.d.ts +5 -0
- package/dist/cli/startup-screen.js +20 -27
- package/dist/cli/startup-steps.js +6 -8
- package/dist/cli/subcommands/auth.d.ts +6 -3
- package/dist/cli/subcommands/auth.js +52 -22
- package/dist/cli/subcommands/config-set.d.ts +21 -0
- package/dist/cli/subcommands/config-set.js +137 -0
- package/dist/cli/subcommands/config.d.ts +2 -1
- package/dist/cli/subcommands/config.js +51 -37
- package/dist/cli/subcommands/doctor.d.ts +2 -1
- package/dist/cli/subcommands/doctor.js +97 -58
- package/dist/cli/subcommands/init.d.ts +1 -1
- package/dist/cli/subcommands/init.js +8 -7
- package/dist/cli/subcommands/memory.d.ts +18 -0
- package/dist/cli/subcommands/memory.js +189 -0
- package/dist/cli/subcommands/model-meta.js +11 -9
- package/dist/cli/subcommands/models-cache-probe.d.ts +1 -1
- package/dist/cli/subcommands/models-cache-probe.js +26 -32
- package/dist/cli/subcommands/models-discover.d.ts +3 -0
- package/dist/cli/subcommands/models-discover.js +44 -21
- package/dist/cli/subcommands/models.d.ts +1 -1
- package/dist/cli/subcommands/models.js +29 -22
- package/dist/cli/subcommands/probe-runner.js +8 -7
- package/dist/cli/subcommands/providers-list.js +32 -21
- package/dist/cli/subcommands/providers-plan.js +24 -25
- package/dist/cli/subcommands/providers-probe.js +5 -6
- package/dist/cli/subcommands/providers.d.ts +2 -2
- package/dist/cli/subcommands/providers.js +48 -59
- package/dist/cli/subcommands/sessions-export.d.ts +1 -1
- package/dist/cli/subcommands/sessions-export.js +10 -9
- package/dist/cli/subcommands/sessions-search.d.ts +1 -1
- package/dist/cli/subcommands/sessions-search.js +11 -10
- package/dist/cli/subcommands/sessions-trace.d.ts +30 -0
- package/dist/cli/subcommands/sessions-trace.js +156 -0
- package/dist/cli/subcommands/sessions.d.ts +4 -3
- package/dist/cli/subcommands/sessions.js +40 -37
- package/dist/cli/subcommands/stats.d.ts +1 -1
- package/dist/cli/subcommands/stats.js +49 -30
- package/dist/cli/system-prompt-arg.js +3 -2
- package/dist/codemode/capability.js +3 -2
- package/dist/compaction/post-compact.d.ts +1 -0
- package/dist/compaction/post-compact.js +15 -1
- package/dist/compaction/prune-tier.d.ts +1 -1
- package/dist/compaction/prune-tier.js +3 -3
- package/dist/compaction/serialize.js +2 -1
- package/dist/config/auth-file.d.ts +12 -2
- package/dist/config/auth-file.js +32 -10
- package/dist/config/checker.js +12 -11
- package/dist/config/context-files.js +3 -2
- package/dist/config/edit.d.ts +106 -0
- package/dist/config/edit.js +350 -0
- package/dist/config/init.d.ts +4 -3
- package/dist/config/init.js +10 -18
- package/dist/config/json-schema.d.ts +2 -1
- package/dist/config/json-schema.js +101 -68
- package/dist/config/key-docs.d.ts +18 -7
- package/dist/config/key-docs.js +43 -128
- package/dist/config/load.js +7 -6
- package/dist/config/merge.d.ts +4 -1
- package/dist/config/merge.js +42 -22
- package/dist/config/paths.js +6 -5
- package/dist/config/profile.d.ts +5 -1
- package/dist/config/profile.js +7 -2
- package/dist/config/schema-w5.js +3 -2
- package/dist/config/schema-w6.d.ts +19 -0
- package/dist/config/schema-w6.js +115 -0
- package/dist/config/schema.js +34 -20
- package/dist/config/settings-registry.d.ts +78 -0
- package/dist/config/settings-registry.js +184 -0
- package/dist/config/types-w6.d.ts +109 -0
- package/dist/config/types-w6.js +19 -0
- package/dist/config/types.d.ts +11 -8
- package/dist/config/types.js +1 -0
- package/dist/drivers/acp/client.js +1 -1
- package/dist/drivers/acp/driver.js +13 -8
- package/dist/drivers/agents.js +4 -3
- package/dist/drivers/base.js +3 -2
- package/dist/drivers/host-runners.js +2 -1
- package/dist/drivers/native/claude-stream.js +12 -11
- package/dist/drivers/native/codex-app-server.js +17 -12
- package/dist/drivers/native/oneshot.js +8 -7
- package/dist/drivers/pool.js +1 -1
- package/dist/drivers/runner.d.ts +3 -1
- package/dist/drivers/runner.js +68 -20
- package/dist/drivers/turn.js +1 -1
- package/dist/hooks/config.js +3 -2
- package/dist/hooks/protocol.js +18 -12
- package/dist/host/api-impl.js +11 -10
- package/dist/host/loader.js +9 -8
- package/dist/host/types.d.ts +3 -0
- package/dist/i18n/catalog.d.ts +2169 -0
- package/dist/i18n/catalog.js +72 -0
- package/dist/i18n/format.d.ts +21 -0
- package/dist/i18n/format.js +58 -0
- package/dist/i18n/index.d.ts +58 -0
- package/dist/i18n/index.js +72 -0
- package/dist/i18n/messages/agents.d.ts +84 -0
- package/dist/i18n/messages/agents.js +85 -0
- package/dist/i18n/messages/approval.d.ts +99 -0
- package/dist/i18n/messages/approval.js +100 -0
- package/dist/i18n/messages/auth.d.ts +187 -0
- package/dist/i18n/messages/auth.js +189 -0
- package/dist/i18n/messages/cli-args.d.ts +46 -0
- package/dist/i18n/messages/cli-args.js +46 -0
- package/dist/i18n/messages/cli-help.d.ts +12 -0
- package/dist/i18n/messages/cli-help.js +244 -0
- package/dist/i18n/messages/cli.d.ts +336 -0
- package/dist/i18n/messages/cli.js +311 -0
- package/dist/i18n/messages/config-keys.d.ts +289 -0
- package/dist/i18n/messages/config-keys.js +292 -0
- package/dist/i18n/messages/config.d.ts +502 -0
- package/dist/i18n/messages/config.js +239 -0
- package/dist/i18n/messages/drivers.d.ts +123 -0
- package/dist/i18n/messages/drivers.js +124 -0
- package/dist/i18n/messages/errors.d.ts +83 -0
- package/dist/i18n/messages/errors.js +171 -0
- package/dist/i18n/messages/interactive-line.d.ts +61 -0
- package/dist/i18n/messages/interactive-line.js +69 -0
- package/dist/i18n/messages/interactive-startup.d.ts +103 -0
- package/dist/i18n/messages/interactive-startup.js +104 -0
- package/dist/i18n/messages/interactive-view.d.ts +140 -0
- package/dist/i18n/messages/interactive-view.js +141 -0
- package/dist/i18n/messages/interactive.d.ts +493 -0
- package/dist/i18n/messages/interactive.js +248 -0
- package/dist/i18n/messages/memory.d.ts +123 -0
- package/dist/i18n/messages/memory.js +128 -0
- package/dist/i18n/messages/panels.d.ts +190 -0
- package/dist/i18n/messages/panels.js +189 -0
- package/dist/i18n/messages/permissions.d.ts +126 -0
- package/dist/i18n/messages/permissions.js +151 -0
- package/dist/i18n/messages/plan.d.ts +123 -0
- package/dist/i18n/messages/plan.js +124 -0
- package/dist/i18n/messages/print.d.ts +86 -0
- package/dist/i18n/messages/print.js +91 -0
- package/dist/i18n/messages/report.d.ts +391 -0
- package/dist/i18n/messages/report.js +490 -0
- package/dist/i18n/messages/rewind.d.ts +198 -0
- package/dist/i18n/messages/rewind.js +217 -0
- package/dist/i18n/messages/session.d.ts +230 -0
- package/dist/i18n/messages/session.js +258 -0
- package/dist/i18n/messages/settings.d.ts +348 -0
- package/dist/i18n/messages/settings.js +336 -0
- package/dist/i18n/messages/subcommands-config.d.ts +111 -0
- package/dist/i18n/messages/subcommands-config.js +127 -0
- package/dist/i18n/messages/subcommands.d.ts +548 -0
- package/dist/i18n/messages/subcommands.js +474 -0
- package/dist/i18n/messages/trace.d.ts +243 -0
- package/dist/i18n/messages/trace.js +238 -0
- package/dist/i18n/types.d.ts +15 -0
- package/dist/i18n/types.js +7 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2 -0
- package/dist/memory/edit.d.ts +24 -0
- package/dist/memory/edit.js +63 -0
- package/dist/memory/frontmatter.d.ts +37 -0
- package/dist/memory/frontmatter.js +79 -0
- package/dist/memory/index.d.ts +28 -0
- package/dist/memory/index.js +126 -0
- package/dist/memory/lock.d.ts +17 -0
- package/dist/memory/lock.js +62 -0
- package/dist/memory/paths.d.ts +57 -0
- package/dist/memory/paths.js +175 -0
- package/dist/memory/report.d.ts +36 -0
- package/dist/memory/report.js +86 -0
- package/dist/memory/runtime.d.ts +42 -0
- package/dist/memory/runtime.js +36 -0
- package/dist/memory/secrets.d.ts +8 -0
- package/dist/memory/secrets.js +27 -0
- package/dist/memory/section.d.ts +28 -0
- package/dist/memory/section.js +59 -0
- package/dist/memory/store.d.ts +70 -0
- package/dist/memory/store.js +284 -0
- package/dist/memory/tool.d.ts +31 -0
- package/dist/memory/tool.js +94 -0
- package/dist/modes/acp/acp-events.js +2 -1
- package/dist/modes/acp/acp-server.js +13 -12
- package/dist/modes/commands-core.d.ts +17 -0
- package/dist/modes/commands-core.js +101 -61
- package/dist/modes/image-input.js +20 -6
- package/dist/modes/interactive/agent-bar.d.ts +95 -0
- package/dist/modes/interactive/agent-bar.js +248 -0
- package/dist/modes/interactive/agent-panels.js +27 -26
- package/dist/modes/interactive/agent-transcript.d.ts +47 -0
- package/dist/modes/interactive/agent-transcript.js +191 -0
- package/dist/modes/interactive/agent-ui.d.ts +36 -1
- package/dist/modes/interactive/agent-ui.js +180 -14
- package/dist/modes/interactive/agent-view.d.ts +72 -0
- package/dist/modes/interactive/agent-view.js +281 -0
- package/dist/modes/interactive/approval-dialog.js +46 -34
- package/dist/modes/interactive/clipboard-paste.d.ts +2 -2
- package/dist/modes/interactive/clipboard-paste.js +9 -4
- package/dist/modes/interactive/commands.d.ts +22 -1
- package/dist/modes/interactive/commands.js +93 -38
- package/dist/modes/interactive/completion.js +2 -1
- package/dist/modes/interactive/config-panel.d.ts +70 -0
- package/dist/modes/interactive/config-panel.js +319 -0
- package/dist/modes/interactive/config-ui.d.ts +96 -0
- package/dist/modes/interactive/config-ui.js +397 -0
- package/dist/modes/interactive/confirm-dialog.d.ts +49 -0
- package/dist/modes/interactive/confirm-dialog.js +120 -0
- package/dist/modes/interactive/event-notices.js +11 -9
- package/dist/modes/interactive/interactive-mode.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode.js +25 -22
- package/dist/modes/interactive/key-dispatch.d.ts +18 -0
- package/dist/modes/interactive/key-dispatch.js +39 -13
- package/dist/modes/interactive/line/line-editor.js +2 -1
- package/dist/modes/interactive/line/line-mode.d.ts +2 -0
- package/dist/modes/interactive/line/line-mode.js +24 -4
- package/dist/modes/interactive/line/line-render.js +25 -24
- package/dist/modes/interactive/memory-panel.d.ts +64 -0
- package/dist/modes/interactive/memory-panel.js +221 -0
- package/dist/modes/interactive/message-view.d.ts +4 -2
- package/dist/modes/interactive/message-view.js +42 -33
- package/dist/modes/interactive/panels.js +39 -31
- package/dist/modes/interactive/pickers.d.ts +2 -1
- package/dist/modes/interactive/pickers.js +10 -6
- package/dist/modes/interactive/plan-command.d.ts +1 -1
- package/dist/modes/interactive/plan-command.js +24 -27
- package/dist/modes/interactive/plan-dialog.js +18 -17
- package/dist/modes/interactive/plan-flow.js +6 -5
- package/dist/modes/interactive/rewind-command.d.ts +1 -1
- package/dist/modes/interactive/rewind-command.js +18 -16
- package/dist/modes/interactive/rewind-flow.d.ts +0 -1
- package/dist/modes/interactive/rewind-flow.js +13 -14
- package/dist/modes/interactive/rewind-list.js +7 -6
- package/dist/modes/interactive/rewind-panel.js +40 -40
- package/dist/modes/interactive/rewind-text.d.ts +5 -3
- package/dist/modes/interactive/rewind-text.js +48 -38
- package/dist/modes/interactive/run-indicator.js +15 -12
- package/dist/modes/interactive/session-events.js +3 -2
- package/dist/modes/interactive/startup-header.js +22 -23
- package/dist/modes/interactive/startup-ui.js +41 -29
- package/dist/modes/interactive/status-area.d.ts +2 -0
- package/dist/modes/interactive/status-area.js +8 -2
- package/dist/modes/interactive/status-bar.js +4 -3
- package/dist/modes/interactive/subagent-view.js +9 -7
- package/dist/modes/interactive/tasks-report.d.ts +6 -0
- package/dist/modes/interactive/tasks-report.js +28 -31
- package/dist/modes/interactive/terminal-setup.d.ts +9 -0
- package/dist/modes/interactive/terminal-setup.js +23 -0
- package/dist/modes/interactive/tool-summary.js +19 -17
- package/dist/modes/interactive/tool-view.js +7 -4
- package/dist/modes/interactive/trace-view.d.ts +89 -0
- package/dist/modes/interactive/trace-view.js +332 -0
- package/dist/modes/print/print-mode.js +14 -15
- package/dist/modes/rpc/commands.js +7 -3
- package/dist/modes/rpc/rpc-mode.js +9 -3
- package/dist/modes/session-report.d.ts +2 -0
- package/dist/modes/session-report.js +101 -105
- package/dist/modes/startup-ui-text.js +11 -6
- package/dist/permissions/bypass.d.ts +30 -0
- package/dist/permissions/bypass.js +45 -0
- package/dist/permissions/memory-class.d.ts +23 -0
- package/dist/permissions/memory-class.js +54 -0
- package/dist/permissions/modes.d.ts +3 -3
- package/dist/permissions/modes.js +21 -16
- package/dist/permissions/pipeline.d.ts +1 -1
- package/dist/permissions/pipeline.js +9 -2
- package/dist/permissions/preview.js +49 -42
- package/dist/permissions/rules.js +5 -2
- package/dist/permissions/types.d.ts +4 -0
- package/dist/plan/store.js +2 -1
- package/dist/rpc.d.ts +39 -1
- package/dist/rpc.js +3 -0
- package/dist/sandbox/bash.js +11 -8
- package/dist/sandbox/detect.js +14 -11
- package/dist/sdk.d.ts +17 -1
- package/dist/sdk.js +29 -7
- package/dist/session/export.js +31 -30
- package/dist/session/manager.d.ts +1 -1
- package/dist/session/manager.js +5 -3
- package/dist/session/reuse.js +5 -4
- package/dist/session/scan.js +3 -2
- package/dist/session/stats-aggregate.d.ts +3 -1
- package/dist/session/stats-aggregate.js +5 -1
- package/dist/session/stats-index.js +2 -1
- package/dist/session/stats-scan.d.ts +4 -1
- package/dist/session/stats-scan.js +6 -2
- package/dist/session/store.d.ts +11 -0
- package/dist/session/store.js +48 -1
- package/dist/session/types.d.ts +2 -0
- package/dist/skills/builtin.js +2 -1
- package/dist/tools/image-file.d.ts +26 -1
- package/dist/tools/image-file.js +55 -13
- package/dist/tools/presets.d.ts +14 -1
- package/dist/tools/presets.js +3 -3
- package/dist/tools/registry.js +1 -1
- package/dist/tools/truncate.d.ts +1 -1
- package/dist/tools/truncate.js +2 -2
- package/dist/tools/types.d.ts +17 -1
- package/dist/trace/build-index.d.ts +91 -0
- package/dist/trace/build-index.js +127 -0
- package/dist/trace/build-nodes.d.ts +24 -0
- package/dist/trace/build-nodes.js +279 -0
- package/dist/trace/build-util.d.ts +43 -0
- package/dist/trace/build-util.js +120 -0
- package/dist/trace/build.d.ts +82 -0
- package/dist/trace/build.js +382 -0
- package/dist/trace/detail.d.ts +35 -0
- package/dist/trace/detail.js +205 -0
- package/dist/trace/flatten.d.ts +69 -0
- package/dist/trace/flatten.js +173 -0
- package/dist/trace/format.d.ts +47 -0
- package/dist/trace/format.js +329 -0
- package/dist/trace/html-template.d.ts +19 -0
- package/dist/trace/html-template.js +150 -0
- package/dist/trace/html.d.ts +104 -0
- package/dist/trace/html.js +292 -0
- package/dist/trace/preview.d.ts +29 -0
- package/dist/trace/preview.js +59 -0
- package/dist/trace/query-session.d.ts +14 -0
- package/dist/trace/query-session.js +38 -0
- package/dist/trace/query.d.ts +55 -0
- package/dist/trace/query.js +188 -0
- package/dist/trace/session.d.ts +40 -0
- package/dist/trace/session.js +168 -0
- package/dist/trace/types.d.ts +243 -0
- package/dist/trace/types.js +13 -0
- package/dist/tui/components/editor-paste.d.ts +2 -0
- package/dist/tui/components/editor-paste.js +6 -3
- package/dist/tui/components/editor.js +2 -2
- package/dist/tui/components/loader.d.ts +3 -0
- package/dist/tui/components/loader.js +14 -0
- package/dist/tui/components/settings-list.d.ts +61 -0
- package/dist/tui/components/settings-list.js +135 -0
- package/dist/tui/keybindings.d.ts +6 -1
- package/dist/tui/keybindings.js +18 -6
- package/dist/tui.d.ts +1 -0
- package/dist/tui.js +2 -0
- package/docs/en/host-api.md +167 -0
- package/docs/en/permissions.md +214 -0
- package/docs/en/providers.md +625 -0
- package/docs/en/rpc.md +361 -0
- package/docs/en/sessions.md +219 -0
- package/docs/en/tui.md +527 -0
- package/docs/host-api.md +18 -17
- package/docs/memory.md +172 -0
- package/docs/permissions.md +3 -2
- package/docs/providers.md +67 -1
- package/docs/rpc.md +31 -3
- package/docs/session-format.md +8 -2
- package/docs/sessions.md +29 -1
- package/docs/tui.md +189 -21
- package/package.json +8 -3
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent 栏(docs/wave6-plan.md §1.1–§1.2、D1、D4)。[W6-A]
|
|
3
|
+
*
|
|
4
|
+
* 装配在提示行之下、状态行之上。每个任务一行,最多 3 行,多出的给一行「另 N 个」:
|
|
5
|
+
*
|
|
6
|
+
* ```
|
|
7
|
+
* ⏺ t1 explore · 运行中 1m05s · 3 轮 · grep 找测试缺口
|
|
8
|
+
* ⏺ t2 codex · 等待审批
|
|
9
|
+
* ⏺ t3 explore · 完成 12s · 2 轮
|
|
10
|
+
* 另 1 个
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* - 显示条件:有排队 / 运行中 / 等审批的任务,或本会话里看着结束、还没查看过的任务(结束后最多 10 分钟);
|
|
14
|
+
* `ui.agentBar: "off"`(嵌入宿主缺省)整个不显示。
|
|
15
|
+
* - 聚焦(`Ctrl+B` / 空输入 `↓` / `/tasks`):列出本会话全部任务,`›` 标当前项,窗口跟着选择滚动,
|
|
16
|
+
* 末行是按键提示。按键处理在 agent-ui.ts。
|
|
17
|
+
* - 状态来自任务注册表(`TaskInfo`、`live().queued`)、子 Agent 折叠视图的跟踪(轮数、最近工具、用时,界面时钟)
|
|
18
|
+
* 与 `permission_request.context.taskId`(等审批)。
|
|
19
|
+
*/
|
|
20
|
+
import type { SubagentRegistry } from "../../agent/subagent-registry.js";
|
|
21
|
+
import type { SubagentStatus } from "../../agent/types.js";
|
|
22
|
+
import type { TaskInfo } from "../../tools/types.js";
|
|
23
|
+
import { type Component, type Theme } from "../../tui.js";
|
|
24
|
+
import type { SubagentTracker } from "./subagent-view.js";
|
|
25
|
+
export declare const BAR_ROWS = 3;
|
|
26
|
+
/** 结束后未查看的任务在栏里保留多久。 */
|
|
27
|
+
export declare const BAR_RETAIN_MS: number;
|
|
28
|
+
export type BarStatus = "queued" | "running" | "approval" | SubagentStatus;
|
|
29
|
+
export interface BarRow {
|
|
30
|
+
taskId: string;
|
|
31
|
+
agent: string;
|
|
32
|
+
runner: string;
|
|
33
|
+
description: string;
|
|
34
|
+
status: BarStatus;
|
|
35
|
+
turns: number;
|
|
36
|
+
tool?: string;
|
|
37
|
+
elapsedMs?: number;
|
|
38
|
+
}
|
|
39
|
+
/** 栏与视图读的任务注册表(当前会话的 `registryOf(sessionId)`;测试给假的)。 */
|
|
40
|
+
export type TaskSource = Pick<SubagentRegistry, "list" | "get" | "live" | "message">;
|
|
41
|
+
export interface AgentBarDeps {
|
|
42
|
+
theme: Theme;
|
|
43
|
+
registry(): TaskSource | undefined;
|
|
44
|
+
tracker: SubagentTracker;
|
|
45
|
+
now(): number;
|
|
46
|
+
/** 正在等审批的任务。 */
|
|
47
|
+
approvals(): ReadonlySet<string>;
|
|
48
|
+
/** `ui.agentBar` 不是 off。 */
|
|
49
|
+
enabled(): boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare function statusLabel(status: BarStatus): string;
|
|
52
|
+
export declare function statusColor(status: BarStatus): "accent" | "dim" | "warning" | "success" | "error";
|
|
53
|
+
/** 一条任务的栏 / 视图标题数据(状态、轮数、最近工具、用时;用时按界面时钟)。 */
|
|
54
|
+
export declare function taskRow(info: TaskInfo, ctx: {
|
|
55
|
+
tracker: SubagentTracker;
|
|
56
|
+
approvals: ReadonlySet<string>;
|
|
57
|
+
queued: boolean;
|
|
58
|
+
now: number;
|
|
59
|
+
}): BarRow;
|
|
60
|
+
/** `explore` / `gemini(acp:gemini)`。 */
|
|
61
|
+
export declare function agentLabel(row: Pick<BarRow, "agent" | "runner">): string;
|
|
62
|
+
/** `运行中 1m05s · 3 轮 · grep`(不带颜色)。 */
|
|
63
|
+
export declare function rowFacts(row: BarRow, withTool?: boolean): string;
|
|
64
|
+
export declare class AgentBar implements Component {
|
|
65
|
+
private readonly deps;
|
|
66
|
+
/** 聚焦时的选择(undefined = 未聚焦)。 */
|
|
67
|
+
private index;
|
|
68
|
+
private top;
|
|
69
|
+
/** 界面看到任务结束的时刻(界面时钟)。 */
|
|
70
|
+
private readonly endedSeen;
|
|
71
|
+
private readonly viewed;
|
|
72
|
+
constructor(deps: AgentBarDeps);
|
|
73
|
+
get focused(): boolean;
|
|
74
|
+
/** 本会话全部任务的行(排序后)。 */
|
|
75
|
+
all(): BarRow[];
|
|
76
|
+
/** 未聚焦时显示的行:活动的 + 本会话看着结束、未查看、10 分钟内的。 */
|
|
77
|
+
visibleRows(): BarRow[];
|
|
78
|
+
get visible(): boolean;
|
|
79
|
+
/** 聚焦;没有任务返回 false。 */
|
|
80
|
+
focus(): boolean;
|
|
81
|
+
blur(): void;
|
|
82
|
+
/** 移动选择;越过第一项返回 false(调用方退出栏)。 */
|
|
83
|
+
move(delta: number): boolean;
|
|
84
|
+
selected(): string | undefined;
|
|
85
|
+
/** 聚焦时选中某任务。 */
|
|
86
|
+
select(taskId: string): void;
|
|
87
|
+
/** 查看过(视图里看到了结束后的状态):不再留在栏里。 */
|
|
88
|
+
markViewed(taskId: string): void;
|
|
89
|
+
/** 换会话:清掉本会话的保留状态。 */
|
|
90
|
+
reset(): void;
|
|
91
|
+
private row;
|
|
92
|
+
render(width: number): string[];
|
|
93
|
+
private line;
|
|
94
|
+
invalidate(): void;
|
|
95
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent 栏(docs/wave6-plan.md §1.1–§1.2、D1、D4)。[W6-A]
|
|
3
|
+
*
|
|
4
|
+
* 装配在提示行之下、状态行之上。每个任务一行,最多 3 行,多出的给一行「另 N 个」:
|
|
5
|
+
*
|
|
6
|
+
* ```
|
|
7
|
+
* ⏺ t1 explore · 运行中 1m05s · 3 轮 · grep 找测试缺口
|
|
8
|
+
* ⏺ t2 codex · 等待审批
|
|
9
|
+
* ⏺ t3 explore · 完成 12s · 2 轮
|
|
10
|
+
* 另 1 个
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* - 显示条件:有排队 / 运行中 / 等审批的任务,或本会话里看着结束、还没查看过的任务(结束后最多 10 分钟);
|
|
14
|
+
* `ui.agentBar: "off"`(嵌入宿主缺省)整个不显示。
|
|
15
|
+
* - 聚焦(`Ctrl+B` / 空输入 `↓` / `/tasks`):列出本会话全部任务,`›` 标当前项,窗口跟着选择滚动,
|
|
16
|
+
* 末行是按键提示。按键处理在 agent-ui.ts。
|
|
17
|
+
* - 状态来自任务注册表(`TaskInfo`、`live().queued`)、子 Agent 折叠视图的跟踪(轮数、最近工具、用时,界面时钟)
|
|
18
|
+
* 与 `permission_request.context.taskId`(等审批)。
|
|
19
|
+
*/
|
|
20
|
+
import { msg } from "../../i18n/index.js";
|
|
21
|
+
import { formatElapsed, truncateToWidth } from "../../tui.js";
|
|
22
|
+
export const BAR_ROWS = 3;
|
|
23
|
+
/** 结束后未查看的任务在栏里保留多久。 */
|
|
24
|
+
export const BAR_RETAIN_MS = 10 * 60_000;
|
|
25
|
+
const ACTIVE = new Set(["queued", "running", "approval"]);
|
|
26
|
+
function taskNumber(taskId) {
|
|
27
|
+
const n = /^t(\d+)$/.exec(taskId);
|
|
28
|
+
return n === null ? Number.MAX_SAFE_INTEGER : Number(n[1]);
|
|
29
|
+
}
|
|
30
|
+
/** 活动的在前,各组内按编号。 */
|
|
31
|
+
function compareRows(a, b) {
|
|
32
|
+
const group = (row) => (ACTIVE.has(row.status) ? 0 : 1);
|
|
33
|
+
return group(a) - group(b) || taskNumber(a.taskId) - taskNumber(b.taskId);
|
|
34
|
+
}
|
|
35
|
+
export function statusLabel(status) {
|
|
36
|
+
return msg().agents.status[status];
|
|
37
|
+
}
|
|
38
|
+
export function statusColor(status) {
|
|
39
|
+
switch (status) {
|
|
40
|
+
case "running":
|
|
41
|
+
return "accent";
|
|
42
|
+
case "queued":
|
|
43
|
+
return "dim";
|
|
44
|
+
case "completed":
|
|
45
|
+
return "success";
|
|
46
|
+
case "failed":
|
|
47
|
+
return "error";
|
|
48
|
+
default:
|
|
49
|
+
return "warning";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** 一条任务的栏 / 视图标题数据(状态、轮数、最近工具、用时;用时按界面时钟)。 */
|
|
53
|
+
export function taskRow(info, ctx) {
|
|
54
|
+
const state = ctx.tracker.get(info.taskId);
|
|
55
|
+
let status;
|
|
56
|
+
if (info.status !== "running")
|
|
57
|
+
status = info.status;
|
|
58
|
+
else if (ctx.approvals.has(info.taskId))
|
|
59
|
+
status = "approval";
|
|
60
|
+
else if (ctx.queued)
|
|
61
|
+
status = "queued";
|
|
62
|
+
else
|
|
63
|
+
status = "running";
|
|
64
|
+
const row = {
|
|
65
|
+
taskId: info.taskId,
|
|
66
|
+
agent: info.agent,
|
|
67
|
+
runner: info.runner,
|
|
68
|
+
description: info.description,
|
|
69
|
+
status,
|
|
70
|
+
turns: Math.max(state?.turns ?? 0, info.turns ?? 0),
|
|
71
|
+
};
|
|
72
|
+
const tool = state?.tools.at(-1);
|
|
73
|
+
if (tool !== undefined && status !== "queued")
|
|
74
|
+
row.tool = tool;
|
|
75
|
+
if (status !== "queued") {
|
|
76
|
+
if (state !== undefined)
|
|
77
|
+
row.elapsedMs = (state.endedAt ?? ctx.now) - state.startedAt;
|
|
78
|
+
else if (info.endedAt !== undefined)
|
|
79
|
+
row.elapsedMs = info.endedAt - info.startedAt;
|
|
80
|
+
}
|
|
81
|
+
return row;
|
|
82
|
+
}
|
|
83
|
+
/** `explore` / `gemini(acp:gemini)`。 */
|
|
84
|
+
export function agentLabel(row) {
|
|
85
|
+
return row.runner !== "ama" && row.runner !== row.agent
|
|
86
|
+
? `${row.agent}(${row.runner})`
|
|
87
|
+
: row.agent;
|
|
88
|
+
}
|
|
89
|
+
/** `运行中 1m05s · 3 轮 · grep`(不带颜色)。 */
|
|
90
|
+
export function rowFacts(row, withTool = true) {
|
|
91
|
+
const facts = [statusLabel(row.status)];
|
|
92
|
+
if (row.elapsedMs !== undefined)
|
|
93
|
+
facts[0] += ` ${formatElapsed(row.elapsedMs)}`;
|
|
94
|
+
if (row.turns > 0)
|
|
95
|
+
facts.push(msg().agents.turns(row.turns));
|
|
96
|
+
if (withTool && row.tool !== undefined && row.status === "running")
|
|
97
|
+
facts.push(row.tool);
|
|
98
|
+
return facts.join(" · ");
|
|
99
|
+
}
|
|
100
|
+
export class AgentBar {
|
|
101
|
+
deps;
|
|
102
|
+
/** 聚焦时的选择(undefined = 未聚焦)。 */
|
|
103
|
+
index;
|
|
104
|
+
top = 0;
|
|
105
|
+
/** 界面看到任务结束的时刻(界面时钟)。 */
|
|
106
|
+
endedSeen = new Map();
|
|
107
|
+
viewed = new Set();
|
|
108
|
+
constructor(deps) {
|
|
109
|
+
this.deps = deps;
|
|
110
|
+
}
|
|
111
|
+
get focused() {
|
|
112
|
+
return this.index !== undefined;
|
|
113
|
+
}
|
|
114
|
+
/** 本会话全部任务的行(排序后)。 */
|
|
115
|
+
all() {
|
|
116
|
+
const registry = this.deps.registry();
|
|
117
|
+
if (registry === undefined)
|
|
118
|
+
return [];
|
|
119
|
+
const approvals = this.deps.approvals();
|
|
120
|
+
const now = this.deps.now();
|
|
121
|
+
const rows = registry.list().map((info) => this.row(info, approvals, now));
|
|
122
|
+
return rows.sort(compareRows);
|
|
123
|
+
}
|
|
124
|
+
/** 未聚焦时显示的行:活动的 + 本会话看着结束、未查看、10 分钟内的。 */
|
|
125
|
+
visibleRows() {
|
|
126
|
+
if (!this.deps.enabled())
|
|
127
|
+
return [];
|
|
128
|
+
const now = this.deps.now();
|
|
129
|
+
return this.all().filter((row) => {
|
|
130
|
+
if (ACTIVE.has(row.status))
|
|
131
|
+
return true;
|
|
132
|
+
if (this.deps.tracker.get(row.taskId) === undefined || this.viewed.has(row.taskId))
|
|
133
|
+
return false;
|
|
134
|
+
const seen = this.endedSeen.get(row.taskId);
|
|
135
|
+
return seen !== undefined && now - seen < BAR_RETAIN_MS;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
get visible() {
|
|
139
|
+
return this.visibleRows().length > 0;
|
|
140
|
+
}
|
|
141
|
+
/** 聚焦;没有任务返回 false。 */
|
|
142
|
+
focus() {
|
|
143
|
+
if (!this.deps.enabled() || this.all().length === 0)
|
|
144
|
+
return false;
|
|
145
|
+
this.index = 0;
|
|
146
|
+
this.top = 0;
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
blur() {
|
|
150
|
+
this.index = undefined;
|
|
151
|
+
this.top = 0;
|
|
152
|
+
}
|
|
153
|
+
/** 移动选择;越过第一项返回 false(调用方退出栏)。 */
|
|
154
|
+
move(delta) {
|
|
155
|
+
if (this.index === undefined)
|
|
156
|
+
return false;
|
|
157
|
+
const count = this.all().length;
|
|
158
|
+
const next = this.index + delta;
|
|
159
|
+
if (next < 0)
|
|
160
|
+
return false;
|
|
161
|
+
this.index = Math.min(next, Math.max(0, count - 1));
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
selected() {
|
|
165
|
+
if (this.index === undefined)
|
|
166
|
+
return undefined;
|
|
167
|
+
const rows = this.all();
|
|
168
|
+
return rows[Math.min(this.index, rows.length - 1)]?.taskId;
|
|
169
|
+
}
|
|
170
|
+
/** 聚焦时选中某任务。 */
|
|
171
|
+
select(taskId) {
|
|
172
|
+
if (this.index === undefined)
|
|
173
|
+
return;
|
|
174
|
+
const at = this.all().findIndex((row) => row.taskId === taskId);
|
|
175
|
+
if (at >= 0)
|
|
176
|
+
this.index = at;
|
|
177
|
+
}
|
|
178
|
+
/** 查看过(视图里看到了结束后的状态):不再留在栏里。 */
|
|
179
|
+
markViewed(taskId) {
|
|
180
|
+
this.viewed.add(taskId);
|
|
181
|
+
}
|
|
182
|
+
/** 换会话:清掉本会话的保留状态。 */
|
|
183
|
+
reset() {
|
|
184
|
+
this.blur();
|
|
185
|
+
this.endedSeen.clear();
|
|
186
|
+
this.viewed.clear();
|
|
187
|
+
}
|
|
188
|
+
row(info, approvals, now) {
|
|
189
|
+
const row = taskRow(info, {
|
|
190
|
+
tracker: this.deps.tracker,
|
|
191
|
+
approvals,
|
|
192
|
+
queued: this.deps.registry()?.live(info.taskId)?.queued === true,
|
|
193
|
+
now,
|
|
194
|
+
});
|
|
195
|
+
if (ACTIVE.has(row.status)) {
|
|
196
|
+
// 又跑起来了(续聊):重新计保留与查看
|
|
197
|
+
this.endedSeen.delete(info.taskId);
|
|
198
|
+
this.viewed.delete(info.taskId);
|
|
199
|
+
}
|
|
200
|
+
else if (!this.endedSeen.has(info.taskId))
|
|
201
|
+
this.endedSeen.set(info.taskId, now);
|
|
202
|
+
return row;
|
|
203
|
+
}
|
|
204
|
+
render(width) {
|
|
205
|
+
const focused = this.index !== undefined;
|
|
206
|
+
const rows = focused ? this.all() : this.visibleRows();
|
|
207
|
+
const t = this.deps.theme;
|
|
208
|
+
const m = msg().agents;
|
|
209
|
+
if (rows.length === 0)
|
|
210
|
+
return focused ? [truncateToWidth(t.fg("dim", m.bar.empty), width)] : [];
|
|
211
|
+
let start = 0;
|
|
212
|
+
if (this.index !== undefined) {
|
|
213
|
+
this.index = Math.min(this.index, rows.length - 1);
|
|
214
|
+
if (this.index < this.top)
|
|
215
|
+
this.top = this.index;
|
|
216
|
+
if (this.index >= this.top + BAR_ROWS)
|
|
217
|
+
this.top = this.index - BAR_ROWS + 1;
|
|
218
|
+
this.top = Math.max(0, Math.min(this.top, rows.length - BAR_ROWS));
|
|
219
|
+
start = this.top;
|
|
220
|
+
}
|
|
221
|
+
const shown = rows.slice(start, start + BAR_ROWS);
|
|
222
|
+
const out = shown.map((row, i) => this.line(row, width, focused, start + i === this.index));
|
|
223
|
+
const hidden = rows.length - shown.length;
|
|
224
|
+
const tail = [];
|
|
225
|
+
if (hidden > 0)
|
|
226
|
+
tail.push(m.bar.more(hidden));
|
|
227
|
+
if (focused)
|
|
228
|
+
tail.push(m.bar.keys(t.glyphs.arrowUp, t.glyphs.arrowDown));
|
|
229
|
+
if (tail.length > 0)
|
|
230
|
+
out.push(truncateToWidth(t.fg("dim", tail.join(" · ")), width, t.glyphs.ellipsis));
|
|
231
|
+
return out;
|
|
232
|
+
}
|
|
233
|
+
line(row, width, focused, selected) {
|
|
234
|
+
const t = this.deps.theme;
|
|
235
|
+
const g = t.glyphs;
|
|
236
|
+
const agent = agentLabel(row);
|
|
237
|
+
const lead = focused ? (selected ? t.fg("accent", g.prompt) : " ") + " " : "";
|
|
238
|
+
const marker = t.fg(statusColor(row.status), g.tool);
|
|
239
|
+
const id = selected ? t.bold(row.taskId) : row.taskId;
|
|
240
|
+
const description = row.description.replace(/\s+/g, " ").trim();
|
|
241
|
+
const text = `${lead}${marker} ${id} ${t.fg("tool", agent)}` +
|
|
242
|
+
t.fg("dim", " · ") +
|
|
243
|
+
t.fg(row.status === "approval" ? "warning" : "muted", rowFacts(row)) +
|
|
244
|
+
(description === "" ? "" : ` ${t.fg("dim", description)}`);
|
|
245
|
+
return truncateToWidth(text, width, g.ellipsis);
|
|
246
|
+
}
|
|
247
|
+
invalidate() { }
|
|
248
|
+
}
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
* 第五波的消息区面板(左竖条卡片,与 `/session` 同一手法):`/plan`、`/agents`、`/tasks` 展开的任务输出。
|
|
3
3
|
* [W5-U] line 模式用 plan-command.ts / tasks-report.ts 的文本版。
|
|
4
4
|
*/
|
|
5
|
+
import { msg } from "../../i18n/index.js";
|
|
5
6
|
import { permissionModeLabel } from "../../permissions/modes.js";
|
|
6
7
|
import { executionMode } from "../../plan/store.js";
|
|
7
8
|
import { Card, wrapTextWithAnsi } from "../../tui.js";
|
|
8
9
|
import { Indent, Stack, keyValue } from "./panels.js";
|
|
9
10
|
import { planStatusText, planTitle } from "./plan-command.js";
|
|
10
|
-
import {
|
|
11
|
+
import { agentFactItems, listAgents, taskFacts } from "./tasks-report.js";
|
|
11
12
|
import { cleanLines } from "./tool-summary.js";
|
|
12
13
|
/** 折行显示的若干行。 */
|
|
13
14
|
class Lines {
|
|
@@ -28,76 +29,76 @@ const STATUS_COLOR = {
|
|
|
28
29
|
};
|
|
29
30
|
/** `/plan`:当前计划、状态、模式、步骤与待办进度。 */
|
|
30
31
|
export function planPanel(controller, session, theme, displayPath = (p) => p) {
|
|
32
|
+
const m = msg().panels.plan;
|
|
33
|
+
const dim = (text) => theme.fg("dim", text);
|
|
31
34
|
const plan = controller.current();
|
|
32
35
|
const mode = session.state.permissionMode;
|
|
33
36
|
const modeText = mode === "plan"
|
|
34
|
-
?
|
|
37
|
+
? m.modePlan(permissionModeLabel(executionMode(undefined, controller.prePlanMode())), dim)
|
|
35
38
|
: permissionModeLabel(mode);
|
|
36
39
|
if (plan === null) {
|
|
37
|
-
const hint = mode === "plan"
|
|
38
|
-
|
|
39
|
-
: "没有计划。/plan <目标> 进入 Plan 模式";
|
|
40
|
-
return new Card(new Lines([theme.fg("muted", hint)]), { theme, title: "计划" });
|
|
40
|
+
const hint = mode === "plan" ? msg().plan.command.noPlanYet : msg().plan.command.noPlan;
|
|
41
|
+
return new Card(new Lines([theme.fg("muted", hint)]), { theme, title: m.title });
|
|
41
42
|
}
|
|
42
43
|
const rows = [
|
|
43
|
-
{ key:
|
|
44
|
-
{ key:
|
|
44
|
+
{ key: m.status, value: theme.fg(STATUS_COLOR[plan.status], planStatusText(plan.status)) },
|
|
45
|
+
{ key: m.mode, value: modeText },
|
|
45
46
|
];
|
|
46
47
|
const todos = controller.todos();
|
|
47
48
|
if (todos.length > 0) {
|
|
48
49
|
const done = todos.filter((t) => t.status === "done").length;
|
|
49
50
|
const current = todos.find((t) => t.status === "in_progress");
|
|
50
51
|
rows.push({
|
|
51
|
-
key:
|
|
52
|
-
value:
|
|
52
|
+
key: m.todos,
|
|
53
|
+
value: m.todosValue(done, todos.length, current?.text, dim),
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
const parts = [theme.bold(planTitle(plan)), keyValue(rows, theme)];
|
|
56
57
|
if (plan.steps.length > 0) {
|
|
57
|
-
parts.push(theme.bold(
|
|
58
|
+
parts.push(theme.bold(m.steps(plan.steps.length)));
|
|
58
59
|
parts.push(new Indent(new Lines(plan.steps.map((s) => `${theme.fg("dim", s.id)} ${s.text}`)), 2));
|
|
59
60
|
}
|
|
60
61
|
if (plan.status === "proposed")
|
|
61
|
-
parts.push(new Lines([
|
|
62
|
-
theme.fg("dim", "/plan approve [模式|fresh] 批准 · /plan reject 放弃 · 直接输入修改意见"),
|
|
63
|
-
]));
|
|
62
|
+
parts.push(new Lines([theme.fg("dim", msg().plan.command.actions)]));
|
|
64
63
|
return new Card(new Stack(parts), {
|
|
65
64
|
theme,
|
|
66
|
-
title:
|
|
65
|
+
title: m.titleVersion(plan.version),
|
|
67
66
|
...(plan.filePath !== undefined ? { subtitle: displayPath(plan.filePath) } : {}),
|
|
68
67
|
});
|
|
69
68
|
}
|
|
70
69
|
/** `/agents`:类型、runner、来源、安装状态与版本、说明。 */
|
|
71
70
|
export function agentsPanel(sessionId, theme) {
|
|
71
|
+
const m = msg().panels.agents;
|
|
72
72
|
const agents = listAgents(sessionId);
|
|
73
73
|
if (agents.length === 0)
|
|
74
|
-
return new Card(new Lines([theme.fg("muted",
|
|
75
|
-
theme,
|
|
76
|
-
title: "子 Agent",
|
|
77
|
-
});
|
|
74
|
+
return new Card(new Lines([theme.fg("muted", m.none)]), { theme, title: m.title });
|
|
78
75
|
const rows = agents.map((agent) => {
|
|
79
|
-
const
|
|
80
|
-
|
|
76
|
+
const status = agentFactItems(agent).map((f) => f.state === "missing"
|
|
77
|
+
? theme.fg("warning", f.text)
|
|
78
|
+
: f.state === "installed"
|
|
79
|
+
? theme.fg("success", f.text)
|
|
80
|
+
: f.text);
|
|
81
81
|
return {
|
|
82
82
|
key: agent.name,
|
|
83
83
|
value: `${status.join(theme.fg("dim", " · "))} ${theme.fg("muted", agent.description.replace(/\s+/g, " "))}`,
|
|
84
84
|
};
|
|
85
85
|
});
|
|
86
|
-
return new Card(keyValue(rows, theme, true), { theme, title:
|
|
86
|
+
return new Card(keyValue(rows, theme, true), { theme, title: m.titleCount(agents.length) });
|
|
87
87
|
}
|
|
88
88
|
/** `/tasks` 选中一个任务:状态行 + 输出全文(运行中为已有输出)。 */
|
|
89
89
|
export function taskOutputPanel(task, output, theme, now, displayPath = (p) => p) {
|
|
90
|
+
const m = msg().panels.tasks;
|
|
90
91
|
const body = output === undefined || output.trim() === "" ? [] : cleanLines(output.trimEnd());
|
|
91
92
|
const lines = [
|
|
92
93
|
...(task.description.trim() !== "" ? [theme.fg("muted", task.description.trim())] : []),
|
|
93
|
-
...(body.length === 0 ? [theme.fg("dim",
|
|
94
|
+
...(body.length === 0 ? [theme.fg("dim", m.noOutput)] : body),
|
|
94
95
|
];
|
|
95
96
|
if (task.outputFile !== undefined)
|
|
96
|
-
lines.push(theme.fg("dim",
|
|
97
|
-
const facts = [task.agent, ...taskFacts(task, now), ...(task.background ? [
|
|
97
|
+
lines.push(theme.fg("dim", m.fullOutput(displayPath(task.outputFile))));
|
|
98
|
+
const facts = [task.agent, ...taskFacts(task, now), ...(task.background ? [m.background] : [])];
|
|
98
99
|
return new Card(new Lines(lines), {
|
|
99
100
|
theme,
|
|
100
|
-
title:
|
|
101
|
+
title: m.title(task.taskId),
|
|
101
102
|
subtitle: facts.join(" · "),
|
|
102
103
|
});
|
|
103
104
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 子 Agent 视图的正文(docs/wave6-plan.md §1.2、D2)。[W6-A]
|
|
3
|
+
*
|
|
4
|
+
* - `AmaTranscript`:ama 子会话的全量消息,复用消息区的 `MessageView` / `ToolTracker` 渲染;先按条目重放
|
|
5
|
+
* (句柄在内存时读 `entries()`,被 LRU 释放或 resume 后只读加载子会话文件),运行中再跟随子会话事件。
|
|
6
|
+
* 视图里直接发的消息(`origin:"direct"`)按普通用户消息显示——在这里就是人发给它的。
|
|
7
|
+
* - `ExternalTranscript`:外部 Agent 的内存环形缓冲(文本、思考、工具起止、回合、notice);重启后缓冲为空,
|
|
8
|
+
* 只给一行「用原 CLI resume」的说明。
|
|
9
|
+
*/
|
|
10
|
+
import type { SessionEvent } from "../../agent/types.js";
|
|
11
|
+
import type { ExternalDisplayEvent } from "../../agents/task-record.js";
|
|
12
|
+
import type { SessionEntry } from "../../session/types.js";
|
|
13
|
+
import { type Component, type Theme } from "../../tui.js";
|
|
14
|
+
import { type MessageViewOptions } from "./message-view.js";
|
|
15
|
+
/** 只读读子会话文件当前分支的条目。 */
|
|
16
|
+
export declare function readBranch(file: string): SessionEntry[];
|
|
17
|
+
export declare class AmaTranscript implements Component {
|
|
18
|
+
private readonly options;
|
|
19
|
+
private readonly view;
|
|
20
|
+
private readonly tools;
|
|
21
|
+
constructor(options: MessageViewOptions & {
|
|
22
|
+
now(): number;
|
|
23
|
+
cwd?: string;
|
|
24
|
+
});
|
|
25
|
+
get isEmpty(): boolean;
|
|
26
|
+
/** 按条目重画(打开视图、重新接上句柄)。 */
|
|
27
|
+
load(entries: readonly SessionEntry[]): void;
|
|
28
|
+
/** 子会话事件;返回 true 表示内容变了。 */
|
|
29
|
+
onEvent(event: SessionEvent): boolean;
|
|
30
|
+
tick(): void;
|
|
31
|
+
render(width: number): string[];
|
|
32
|
+
invalidate(): void;
|
|
33
|
+
}
|
|
34
|
+
export interface ExternalSource {
|
|
35
|
+
events(): readonly ExternalDisplayEvent[];
|
|
36
|
+
running(): boolean;
|
|
37
|
+
runner: string;
|
|
38
|
+
sessionId?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare class ExternalTranscript implements Component {
|
|
41
|
+
private readonly theme;
|
|
42
|
+
private readonly source;
|
|
43
|
+
constructor(theme: Theme, source: ExternalSource);
|
|
44
|
+
get isEmpty(): boolean;
|
|
45
|
+
render(width: number): string[];
|
|
46
|
+
invalidate(): void;
|
|
47
|
+
}
|