@armadra/agent 0.5.1 → 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 -304
- 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 +25928 -11144
- 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.js +8 -6
- 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.js +23 -20
- 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 +1 -1
- package/dist/cli/subcommands/providers.js +45 -50
- 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 +11 -0
- package/dist/modes/commands-core.js +93 -62
- 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 +19 -1
- package/dist/modes/interactive/commands.js +84 -40
- 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.js +6 -7
- 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 +19 -22
- package/dist/modes/interactive/key-dispatch.d.ts +12 -0
- package/dist/modes/interactive/key-dispatch.js +24 -9
- package/dist/modes/interactive/line/line-editor.js +2 -1
- package/dist/modes/interactive/line/line-mode.js +18 -7
- 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 +38 -30
- 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 +8 -10
- package/dist/permissions/bypass.js +19 -10
- 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 +5 -0
- package/dist/tui/keybindings.js +17 -5
- 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 +2 -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 +132 -3
- package/package.json +8 -3
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 消息目录:trace(键名规范见 docs/i18n.md)。[W6-C0 建空壳,W6-T1 填 TUI / line 模式文案,W6-T2 追加 HTML]
|
|
3
|
+
*
|
|
4
|
+
* en 是形状源;zh 用 `satisfies Messages<typeof en>`,缺键 / 多键 / 参数不符在 tsc 期报错。
|
|
5
|
+
* 整句一个键、禁止片段拼接;插值写成函数,条件分支写进函数体。
|
|
6
|
+
* 不译:ttft、tok/s、↑ ↓、模型名、工具名、任务 id、触发方式(threshold / overflow / manual)。
|
|
7
|
+
*/
|
|
8
|
+
export declare const en: {
|
|
9
|
+
title: string;
|
|
10
|
+
/** 顶部汇总行。 */
|
|
11
|
+
summary: (turns: number, requests: number, tools: number) => string;
|
|
12
|
+
cache: (percent: string) => string;
|
|
13
|
+
empty: string;
|
|
14
|
+
/** 子轨迹标题(`/trace t2`)。 */
|
|
15
|
+
taskTitle: (taskId: string, agent: string) => string;
|
|
16
|
+
taskNotFound: (taskId: string) => string;
|
|
17
|
+
follow: {
|
|
18
|
+
on: string;
|
|
19
|
+
off: string;
|
|
20
|
+
};
|
|
21
|
+
hints: {
|
|
22
|
+
list: string;
|
|
23
|
+
listNarrow: string;
|
|
24
|
+
detail: string;
|
|
25
|
+
};
|
|
26
|
+
row: {
|
|
27
|
+
turn: (n: number, text: string) => string;
|
|
28
|
+
turnOrigin: (n: number, origin: string, text: string) => string;
|
|
29
|
+
step: (model: string) => string;
|
|
30
|
+
stepAttempt: (model: string, attempt: number) => string;
|
|
31
|
+
fallback: (from: string) => string;
|
|
32
|
+
subagent: (taskId: string, agent: string) => string;
|
|
33
|
+
subagentExternal: (taskId: string, agent: string, runner: string) => string;
|
|
34
|
+
background: string;
|
|
35
|
+
childMissing: string;
|
|
36
|
+
compaction: (trigger: string) => string;
|
|
37
|
+
compactionPlain: string;
|
|
38
|
+
retryWait: (delay: string, attempt: number) => string;
|
|
39
|
+
aux: {
|
|
40
|
+
cache_warm: string;
|
|
41
|
+
permission_classify: string;
|
|
42
|
+
};
|
|
43
|
+
auxGroup: (n: number) => string;
|
|
44
|
+
externalTurn: (turn: number, tools: number, files: number) => string;
|
|
45
|
+
more: (n: number) => string;
|
|
46
|
+
};
|
|
47
|
+
status: {
|
|
48
|
+
ok: string;
|
|
49
|
+
error: string;
|
|
50
|
+
aborted: string;
|
|
51
|
+
denied: string;
|
|
52
|
+
running: string;
|
|
53
|
+
retried: string;
|
|
54
|
+
interrupted: string;
|
|
55
|
+
};
|
|
56
|
+
detail: {
|
|
57
|
+
kind: string;
|
|
58
|
+
status: string;
|
|
59
|
+
start: string;
|
|
60
|
+
duration: string;
|
|
61
|
+
approx: string;
|
|
62
|
+
approxValue: string;
|
|
63
|
+
model: string;
|
|
64
|
+
attempt: string;
|
|
65
|
+
fallbackFrom: string;
|
|
66
|
+
ttft: string;
|
|
67
|
+
tps: string;
|
|
68
|
+
thinking: string;
|
|
69
|
+
stopReason: string;
|
|
70
|
+
error: string;
|
|
71
|
+
usage: string;
|
|
72
|
+
usageValue: (input: string, output: string, cacheRead: string, cacheWrite: string) => string;
|
|
73
|
+
cacheHit: string;
|
|
74
|
+
cost: string;
|
|
75
|
+
approval: string;
|
|
76
|
+
denied: string;
|
|
77
|
+
yes: string;
|
|
78
|
+
task: string;
|
|
79
|
+
runner: string;
|
|
80
|
+
background: string;
|
|
81
|
+
turns: string;
|
|
82
|
+
childFile: string;
|
|
83
|
+
childMissing: string;
|
|
84
|
+
tools: string;
|
|
85
|
+
files: string;
|
|
86
|
+
origin: string;
|
|
87
|
+
input: string;
|
|
88
|
+
output: string;
|
|
89
|
+
args: string;
|
|
90
|
+
result: string;
|
|
91
|
+
reason: string;
|
|
92
|
+
truncated: (length: number) => string;
|
|
93
|
+
};
|
|
94
|
+
/** [W6-T2] HTML 导出的静态文案(按导出时的语言渲染)。 */
|
|
95
|
+
html: {
|
|
96
|
+
docTitle: (sessionId: string) => string;
|
|
97
|
+
search: string;
|
|
98
|
+
noMatch: string;
|
|
99
|
+
jump: string;
|
|
100
|
+
zoomIn: string;
|
|
101
|
+
zoomOut: string;
|
|
102
|
+
zoomFit: string;
|
|
103
|
+
expandAll: string;
|
|
104
|
+
collapseAll: string;
|
|
105
|
+
legendTtft: string;
|
|
106
|
+
legendDecode: string;
|
|
107
|
+
legendTool: string;
|
|
108
|
+
legendAgent: string;
|
|
109
|
+
legendWait: string;
|
|
110
|
+
legendOther: string;
|
|
111
|
+
axisNote: string;
|
|
112
|
+
detailEmpty: string;
|
|
113
|
+
noContent: string;
|
|
114
|
+
previewDropped: string;
|
|
115
|
+
childPreviewOff: string;
|
|
116
|
+
footer: (version: string, generatedAt: string) => string;
|
|
117
|
+
keys: string;
|
|
118
|
+
};
|
|
119
|
+
/** [W6-T2] `ama sessions trace`。 */
|
|
120
|
+
cli: {
|
|
121
|
+
usage: string;
|
|
122
|
+
wrote: (path: string) => string;
|
|
123
|
+
openFailed: (reason: string) => string;
|
|
124
|
+
formatConflict: string;
|
|
125
|
+
badNow: (raw: string) => string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
export declare const zh: {
|
|
129
|
+
title: string;
|
|
130
|
+
summary: (turns: number, requests: number, tools: number) => string;
|
|
131
|
+
cache: (percent: string) => string;
|
|
132
|
+
empty: string;
|
|
133
|
+
taskTitle: (taskId: string, agent: string) => string;
|
|
134
|
+
taskNotFound: (taskId: string) => string;
|
|
135
|
+
follow: {
|
|
136
|
+
on: string;
|
|
137
|
+
off: string;
|
|
138
|
+
};
|
|
139
|
+
hints: {
|
|
140
|
+
list: string;
|
|
141
|
+
listNarrow: string;
|
|
142
|
+
detail: string;
|
|
143
|
+
};
|
|
144
|
+
row: {
|
|
145
|
+
turn: (n: number, text: string) => string;
|
|
146
|
+
turnOrigin: (n: number, origin: string, text: string) => string;
|
|
147
|
+
step: (model: string) => string;
|
|
148
|
+
stepAttempt: (model: string, attempt: number) => string;
|
|
149
|
+
fallback: (from: string) => string;
|
|
150
|
+
subagent: (taskId: string, agent: string) => string;
|
|
151
|
+
subagentExternal: (taskId: string, agent: string, runner: string) => string;
|
|
152
|
+
background: string;
|
|
153
|
+
childMissing: string;
|
|
154
|
+
compaction: (trigger: string) => string;
|
|
155
|
+
compactionPlain: string;
|
|
156
|
+
retryWait: (delay: string, attempt: number) => string;
|
|
157
|
+
aux: {
|
|
158
|
+
cache_warm: string;
|
|
159
|
+
permission_classify: string;
|
|
160
|
+
};
|
|
161
|
+
auxGroup: (n: number) => string;
|
|
162
|
+
externalTurn: (turn: number, tools: number, files: number) => string;
|
|
163
|
+
more: (n: number) => string;
|
|
164
|
+
};
|
|
165
|
+
status: {
|
|
166
|
+
ok: string;
|
|
167
|
+
error: string;
|
|
168
|
+
aborted: string;
|
|
169
|
+
denied: string;
|
|
170
|
+
running: string;
|
|
171
|
+
retried: string;
|
|
172
|
+
interrupted: string;
|
|
173
|
+
};
|
|
174
|
+
detail: {
|
|
175
|
+
kind: string;
|
|
176
|
+
status: string;
|
|
177
|
+
start: string;
|
|
178
|
+
duration: string;
|
|
179
|
+
approx: string;
|
|
180
|
+
approxValue: string;
|
|
181
|
+
model: string;
|
|
182
|
+
attempt: string;
|
|
183
|
+
fallbackFrom: string;
|
|
184
|
+
ttft: string;
|
|
185
|
+
tps: string;
|
|
186
|
+
thinking: string;
|
|
187
|
+
stopReason: string;
|
|
188
|
+
error: string;
|
|
189
|
+
usage: string;
|
|
190
|
+
usageValue: (input: string, output: string, cacheRead: string, cacheWrite: string) => string;
|
|
191
|
+
cacheHit: string;
|
|
192
|
+
cost: string;
|
|
193
|
+
approval: string;
|
|
194
|
+
denied: string;
|
|
195
|
+
yes: string;
|
|
196
|
+
task: string;
|
|
197
|
+
runner: string;
|
|
198
|
+
background: string;
|
|
199
|
+
turns: string;
|
|
200
|
+
childFile: string;
|
|
201
|
+
childMissing: string;
|
|
202
|
+
tools: string;
|
|
203
|
+
files: string;
|
|
204
|
+
origin: string;
|
|
205
|
+
input: string;
|
|
206
|
+
output: string;
|
|
207
|
+
args: string;
|
|
208
|
+
result: string;
|
|
209
|
+
reason: string;
|
|
210
|
+
truncated: (length: number) => string;
|
|
211
|
+
};
|
|
212
|
+
html: {
|
|
213
|
+
docTitle: (sessionId: string) => string;
|
|
214
|
+
search: string;
|
|
215
|
+
noMatch: string;
|
|
216
|
+
jump: string;
|
|
217
|
+
zoomIn: string;
|
|
218
|
+
zoomOut: string;
|
|
219
|
+
zoomFit: string;
|
|
220
|
+
expandAll: string;
|
|
221
|
+
collapseAll: string;
|
|
222
|
+
legendTtft: string;
|
|
223
|
+
legendDecode: string;
|
|
224
|
+
legendTool: string;
|
|
225
|
+
legendAgent: string;
|
|
226
|
+
legendWait: string;
|
|
227
|
+
legendOther: string;
|
|
228
|
+
axisNote: string;
|
|
229
|
+
detailEmpty: string;
|
|
230
|
+
noContent: string;
|
|
231
|
+
previewDropped: string;
|
|
232
|
+
childPreviewOff: string;
|
|
233
|
+
footer: (version: string, generatedAt: string) => string;
|
|
234
|
+
keys: string;
|
|
235
|
+
};
|
|
236
|
+
cli: {
|
|
237
|
+
usage: string;
|
|
238
|
+
wrote: (path: string) => string;
|
|
239
|
+
openFailed: (reason: string) => string;
|
|
240
|
+
formatConflict: string;
|
|
241
|
+
badNow: (raw: string) => string;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 消息目录:trace(键名规范见 docs/i18n.md)。[W6-C0 建空壳,W6-T1 填 TUI / line 模式文案,W6-T2 追加 HTML]
|
|
3
|
+
*
|
|
4
|
+
* en 是形状源;zh 用 `satisfies Messages<typeof en>`,缺键 / 多键 / 参数不符在 tsc 期报错。
|
|
5
|
+
* 整句一个键、禁止片段拼接;插值写成函数,条件分支写进函数体。
|
|
6
|
+
* 不译:ttft、tok/s、↑ ↓、模型名、工具名、任务 id、触发方式(threshold / overflow / manual)。
|
|
7
|
+
*/
|
|
8
|
+
import { plural } from "../format.js";
|
|
9
|
+
export const en = {
|
|
10
|
+
title: "Trace",
|
|
11
|
+
/** 顶部汇总行。 */
|
|
12
|
+
summary: (turns, requests, tools) => `${plural(turns, "turn")} · ${plural(requests, "request")} · ${plural(tools, "tool call")}`,
|
|
13
|
+
cache: (percent) => `cache ${percent}`,
|
|
14
|
+
empty: "No turns yet",
|
|
15
|
+
/** 子轨迹标题(`/trace t2`)。 */
|
|
16
|
+
taskTitle: (taskId, agent) => `Trace · task ${taskId} ${agent}`,
|
|
17
|
+
taskNotFound: (taskId) => `No task ${taskId} in this session (see /tasks)`,
|
|
18
|
+
follow: { on: "following", off: "paused" },
|
|
19
|
+
hints: {
|
|
20
|
+
list: "↑↓ move · → expand · ← collapse · Enter details · f follow · Esc close",
|
|
21
|
+
listNarrow: "↑↓ → ← Enter f Esc",
|
|
22
|
+
detail: "↑↓ scroll · Esc back",
|
|
23
|
+
},
|
|
24
|
+
row: {
|
|
25
|
+
turn: (n, text) => `#${n} ${text}`,
|
|
26
|
+
turnOrigin: (n, origin, text) => `#${n} [${origin}] ${text}`,
|
|
27
|
+
step: (model) => `request ${model}`,
|
|
28
|
+
stepAttempt: (model, attempt) => `request ${model} (attempt ${attempt})`,
|
|
29
|
+
fallback: (from) => `fallback from ${from}`,
|
|
30
|
+
subagent: (taskId, agent) => `task ${taskId} ${agent}`,
|
|
31
|
+
subagentExternal: (taskId, agent, runner) => `task ${taskId} ${agent} (${runner})`,
|
|
32
|
+
background: "background",
|
|
33
|
+
childMissing: "child session missing",
|
|
34
|
+
compaction: (trigger) => `compaction (${trigger})`,
|
|
35
|
+
compactionPlain: "compaction",
|
|
36
|
+
retryWait: (delay, attempt) => `retry wait ${delay} (attempt ${attempt})`,
|
|
37
|
+
aux: { cache_warm: "cache warm-up", permission_classify: "permission classifier" },
|
|
38
|
+
auxGroup: (n) => `auxiliary requests: ${n}`,
|
|
39
|
+
externalTurn: (turn, tools, files) => `turn ${turn} · ${plural(tools, "tool")} · ${plural(files, "file")}`,
|
|
40
|
+
more: (n) => `… ${plural(n, "earlier turn")} (Enter to load)`,
|
|
41
|
+
},
|
|
42
|
+
status: {
|
|
43
|
+
ok: "done",
|
|
44
|
+
error: "failed",
|
|
45
|
+
aborted: "aborted",
|
|
46
|
+
denied: "denied",
|
|
47
|
+
running: "running",
|
|
48
|
+
retried: "retried",
|
|
49
|
+
interrupted: "interrupted",
|
|
50
|
+
},
|
|
51
|
+
detail: {
|
|
52
|
+
kind: "Kind",
|
|
53
|
+
status: "Status",
|
|
54
|
+
start: "Start",
|
|
55
|
+
duration: "Duration",
|
|
56
|
+
approx: "Timing",
|
|
57
|
+
approxValue: "estimated from entry times (no ama.trace)",
|
|
58
|
+
model: "Model",
|
|
59
|
+
attempt: "Attempt",
|
|
60
|
+
fallbackFrom: "Fallback from",
|
|
61
|
+
ttft: "Time to first token",
|
|
62
|
+
tps: "Throughput",
|
|
63
|
+
thinking: "Thinking level",
|
|
64
|
+
stopReason: "Stop reason",
|
|
65
|
+
error: "Error",
|
|
66
|
+
usage: "Tokens",
|
|
67
|
+
usageValue: (input, output, cacheRead, cacheWrite) => `in ${input} · out ${output} · cache read ${cacheRead} · cache write ${cacheWrite}`,
|
|
68
|
+
cacheHit: "Cache hit",
|
|
69
|
+
cost: "Cost",
|
|
70
|
+
approval: "Waiting for approval",
|
|
71
|
+
denied: "Denied before running",
|
|
72
|
+
yes: "yes",
|
|
73
|
+
task: "Task",
|
|
74
|
+
runner: "Runner",
|
|
75
|
+
background: "Background",
|
|
76
|
+
turns: "Turns",
|
|
77
|
+
childFile: "Child session",
|
|
78
|
+
childMissing: "missing or unreadable",
|
|
79
|
+
tools: "Tools",
|
|
80
|
+
files: "Files touched",
|
|
81
|
+
origin: "Origin",
|
|
82
|
+
input: "Input",
|
|
83
|
+
output: "Output",
|
|
84
|
+
args: "Arguments",
|
|
85
|
+
result: "Result",
|
|
86
|
+
reason: "Reason",
|
|
87
|
+
truncated: (length) => `… (truncated, ${length} characters in total)`,
|
|
88
|
+
},
|
|
89
|
+
/** [W6-T2] HTML 导出的静态文案(按导出时的语言渲染)。 */
|
|
90
|
+
html: {
|
|
91
|
+
docTitle: (sessionId) => `Trace · ${sessionId}`,
|
|
92
|
+
search: "Search",
|
|
93
|
+
noMatch: "No match",
|
|
94
|
+
jump: "Jump to turn",
|
|
95
|
+
zoomIn: "Zoom in",
|
|
96
|
+
zoomOut: "Zoom out",
|
|
97
|
+
zoomFit: "Fit",
|
|
98
|
+
expandAll: "Expand all",
|
|
99
|
+
collapseAll: "Collapse all",
|
|
100
|
+
legendTtft: "Time to first token",
|
|
101
|
+
legendDecode: "Decoding",
|
|
102
|
+
legendTool: "Tool",
|
|
103
|
+
legendAgent: "Subagent",
|
|
104
|
+
legendWait: "Retry wait",
|
|
105
|
+
legendOther: "Compaction / auxiliary",
|
|
106
|
+
axisNote: "Idle time between turns is compressed",
|
|
107
|
+
detailEmpty: "Select a row to see its details",
|
|
108
|
+
noContent: "Content omitted (--no-content)",
|
|
109
|
+
previewDropped: "Preview omitted: over the 4 MB preview budget",
|
|
110
|
+
childPreviewOff: "Child session previews are not embedded (use --children)",
|
|
111
|
+
footer: (version, generatedAt) => `Generated by ama ${version} at ${generatedAt}`,
|
|
112
|
+
keys: "↑↓ move · ←→ collapse / expand · / search · Ctrl + wheel zoom",
|
|
113
|
+
},
|
|
114
|
+
/** [W6-T2] `ama sessions trace`。 */
|
|
115
|
+
cli: {
|
|
116
|
+
usage: `Usage: ama sessions trace <id|file> [--html [file]] [--json] [--output <file>] [--open]
|
|
117
|
+
[--branch leaf|all] [--no-content] [--children] [--now <ms>]
|
|
118
|
+
[--session-dir <dir>]
|
|
119
|
+
`,
|
|
120
|
+
wrote: (path) => `Trace written to ${path}\n`,
|
|
121
|
+
openFailed: (reason) => `Could not open a browser: ${reason}\n`,
|
|
122
|
+
formatConflict: "--html and --json are exclusive",
|
|
123
|
+
badNow: (raw) => `--now expects epoch milliseconds (got ${raw})`,
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
export const zh = {
|
|
127
|
+
title: "轨迹",
|
|
128
|
+
summary: (turns, requests, tools) => `${turns} 回合 · ${requests} 请求 · ${tools} 次工具`,
|
|
129
|
+
cache: (percent) => `缓存 ${percent}`,
|
|
130
|
+
empty: "还没有回合",
|
|
131
|
+
taskTitle: (taskId, agent) => `轨迹 · 任务 ${taskId} ${agent}`,
|
|
132
|
+
taskNotFound: (taskId) => `本会话没有任务 ${taskId}(见 /tasks)`,
|
|
133
|
+
follow: { on: "跟随中", off: "已暂停跟随" },
|
|
134
|
+
hints: {
|
|
135
|
+
list: "↑↓ 移动 · → 展开 · ← 折叠 · Enter 详情 · f 跟随 · Esc 关闭",
|
|
136
|
+
listNarrow: "↑↓ → ← Enter f Esc",
|
|
137
|
+
detail: "↑↓ 滚动 · Esc 返回",
|
|
138
|
+
},
|
|
139
|
+
row: {
|
|
140
|
+
turn: (n, text) => `#${n} ${text}`,
|
|
141
|
+
turnOrigin: (n, origin, text) => `#${n} [${origin}] ${text}`,
|
|
142
|
+
step: (model) => `请求 ${model}`,
|
|
143
|
+
stepAttempt: (model, attempt) => `请求 ${model}(第 ${attempt} 次)`,
|
|
144
|
+
fallback: (from) => `回退自 ${from}`,
|
|
145
|
+
subagent: (taskId, agent) => `任务 ${taskId} ${agent}`,
|
|
146
|
+
subagentExternal: (taskId, agent, runner) => `任务 ${taskId} ${agent}(${runner})`,
|
|
147
|
+
background: "后台",
|
|
148
|
+
childMissing: "子会话缺失",
|
|
149
|
+
compaction: (trigger) => `压缩(${trigger})`,
|
|
150
|
+
compactionPlain: "压缩",
|
|
151
|
+
retryWait: (delay, attempt) => `重试等待 ${delay}(第 ${attempt} 次)`,
|
|
152
|
+
aux: { cache_warm: "缓存保温", permission_classify: "权限分类" },
|
|
153
|
+
auxGroup: (n) => `辅助请求 ${n} 次`,
|
|
154
|
+
externalTurn: (turn, tools, files) => `回合 ${turn} · ${tools} 个工具 · ${files} 个文件`,
|
|
155
|
+
more: (n) => `… 更早的 ${n} 个回合(Enter 加载)`,
|
|
156
|
+
},
|
|
157
|
+
status: {
|
|
158
|
+
ok: "完成",
|
|
159
|
+
error: "失败",
|
|
160
|
+
aborted: "已中断",
|
|
161
|
+
denied: "已拒绝",
|
|
162
|
+
running: "进行中",
|
|
163
|
+
retried: "已重试",
|
|
164
|
+
interrupted: "未完成",
|
|
165
|
+
},
|
|
166
|
+
detail: {
|
|
167
|
+
kind: "类型",
|
|
168
|
+
status: "状态",
|
|
169
|
+
start: "开始",
|
|
170
|
+
duration: "耗时",
|
|
171
|
+
approx: "计时",
|
|
172
|
+
approxValue: "按条目时间推算(没有 ama.trace)",
|
|
173
|
+
model: "模型",
|
|
174
|
+
attempt: "尝试",
|
|
175
|
+
fallbackFrom: "回退自",
|
|
176
|
+
ttft: "首 token",
|
|
177
|
+
tps: "吞吐",
|
|
178
|
+
thinking: "思考级别",
|
|
179
|
+
stopReason: "停止原因",
|
|
180
|
+
error: "错误",
|
|
181
|
+
usage: "Token",
|
|
182
|
+
usageValue: (input, output, cacheRead, cacheWrite) => `输入 ${input} · 输出 ${output} · 缓存读 ${cacheRead} · 缓存写 ${cacheWrite}`,
|
|
183
|
+
cacheHit: "缓存命中",
|
|
184
|
+
cost: "费用",
|
|
185
|
+
approval: "等待审批",
|
|
186
|
+
denied: "执行前被拒",
|
|
187
|
+
yes: "是",
|
|
188
|
+
task: "任务",
|
|
189
|
+
runner: "运行方",
|
|
190
|
+
background: "后台",
|
|
191
|
+
turns: "轮数",
|
|
192
|
+
childFile: "子会话",
|
|
193
|
+
childMissing: "缺失或无法读取",
|
|
194
|
+
tools: "工具",
|
|
195
|
+
files: "改动文件",
|
|
196
|
+
origin: "来源",
|
|
197
|
+
input: "输入",
|
|
198
|
+
output: "输出",
|
|
199
|
+
args: "参数",
|
|
200
|
+
result: "结果",
|
|
201
|
+
reason: "原因",
|
|
202
|
+
truncated: (length) => `…(截断,原长 ${length} 字符)`,
|
|
203
|
+
},
|
|
204
|
+
html: {
|
|
205
|
+
docTitle: (sessionId) => `轨迹 · ${sessionId}`,
|
|
206
|
+
search: "搜索",
|
|
207
|
+
noMatch: "无匹配",
|
|
208
|
+
jump: "跳到回合",
|
|
209
|
+
zoomIn: "放大",
|
|
210
|
+
zoomOut: "缩小",
|
|
211
|
+
zoomFit: "适应宽度",
|
|
212
|
+
expandAll: "全部展开",
|
|
213
|
+
collapseAll: "全部折叠",
|
|
214
|
+
legendTtft: "首 token 等待",
|
|
215
|
+
legendDecode: "解码",
|
|
216
|
+
legendTool: "工具",
|
|
217
|
+
legendAgent: "子 Agent",
|
|
218
|
+
legendWait: "重试等待",
|
|
219
|
+
legendOther: "压缩 / 辅助请求",
|
|
220
|
+
axisNote: "回合之间的空闲时间已压缩",
|
|
221
|
+
detailEmpty: "选中一行查看详情",
|
|
222
|
+
noContent: "已省略正文(--no-content)",
|
|
223
|
+
previewDropped: "预览已省略:超出 4 MB 预览预算",
|
|
224
|
+
childPreviewOff: "未内嵌子会话预览(加 --children)",
|
|
225
|
+
footer: (version, generatedAt) => `由 ama ${version} 生成于 ${generatedAt}`,
|
|
226
|
+
keys: "↑↓ 移动 · ←→ 折叠 / 展开 · / 搜索 · Ctrl + 滚轮缩放",
|
|
227
|
+
},
|
|
228
|
+
cli: {
|
|
229
|
+
usage: `用法:ama sessions trace <id|文件> [--html [文件]] [--json] [--output <文件>] [--open]
|
|
230
|
+
[--branch leaf|all] [--no-content] [--children] [--now <毫秒>]
|
|
231
|
+
[--session-dir <目录>]
|
|
232
|
+
`,
|
|
233
|
+
wrote: (path) => `轨迹已写入 ${path}\n`,
|
|
234
|
+
openFailed: (reason) => `无法打开浏览器:${reason}\n`,
|
|
235
|
+
formatConflict: "--html 与 --json 不能同时使用",
|
|
236
|
+
badNow: (raw) => `--now 应为毫秒时间戳(收到 ${raw})`,
|
|
237
|
+
},
|
|
238
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 消息目录的类型(docs/wave6-plan.md §5.1;docs/i18n.md)。[W6-C0]
|
|
3
|
+
*
|
|
4
|
+
* 每个领域文件导出 `en`(形状源)与 `zh`(`satisfies Messages<typeof en>`):缺键、多键、函数参数个数 /
|
|
5
|
+
* 类型不符都在 `tsc --noEmit` 期报错——这就是覆盖率检查,不需要运行期脚本。
|
|
6
|
+
*/
|
|
7
|
+
/** 消息叶子:整句字符串,或返回整句的插值函数(参数类型由 en 决定)。 */
|
|
8
|
+
export type MessageLeaf = string | ((...args: any[]) => string);
|
|
9
|
+
/**
|
|
10
|
+
* 由 en 的形状推出另一种语言必须满足的形状:字符串叶子 → `string`,函数叶子 → 同参数签名返回 `string`,
|
|
11
|
+
* 对象 → 递归。
|
|
12
|
+
*/
|
|
13
|
+
export type Messages<T> = {
|
|
14
|
+
readonly [K in keyof T]: T[K] extends (...args: infer A) => string ? (...args: A) => string : T[K] extends string ? string : Messages<T[K]>;
|
|
15
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,12 @@ export type * from "./permissions/types.js";
|
|
|
26
26
|
export type * from "./host/types.js";
|
|
27
27
|
export type * from "./config/types.js";
|
|
28
28
|
export type * from "./checkpoints/types.js";
|
|
29
|
+
export type * from "./trace/types.js";
|
|
30
|
+
export { TRACE_CUSTOM_TYPE } from "./trace/types.js";
|
|
31
|
+
export { buildTrace, loadSubagentTrace } from "./trace/build.js";
|
|
32
|
+
export type { BuildTraceOptions, LiveOverlay, TraceInput } from "./trace/build.js";
|
|
33
|
+
export type { TracePreview } from "./trace/preview.js";
|
|
34
|
+
export type { Locale } from "./i18n/index.js";
|
|
29
35
|
export type { AmaErrorOptions, ErrorCode, KnownErrorCode } from "./errors.js";
|
|
30
36
|
export type { Runtime, RuntimeMode, ResolvedPaths, TrustState, LoadedResources, } from "./cli/runtime.js";
|
|
31
37
|
export { createAgentSession, createRuntime } from "./sdk.js";
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,8 @@ export { PERMISSION_MODES_STRICT_FIRST } from "./permissions/types.js";
|
|
|
16
16
|
export { ExitCode, describeExitCode } from "./cli/exit-codes.js";
|
|
17
17
|
export { defineTool } from "./tools/types.js";
|
|
18
18
|
export { validateSchema, checkSchemaSubset, formatSchemaErrors } from "./agent/schema.js";
|
|
19
|
+
export { TRACE_CUSTOM_TYPE } from "./trace/types.js";
|
|
20
|
+
export { buildTrace, loadSubagentTrace } from "./trace/build.js"; // [W6-T1]
|
|
19
21
|
// SDK(B6 追加)
|
|
20
22
|
export { createAgentSession, createRuntime } from "./sdk.js";
|
|
21
23
|
export { AgentSessionImpl } from "./agent/session.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 用户在编辑器里改记忆(`/memory edit`、`ama memory edit`)。[W6-M]
|
|
3
|
+
*
|
|
4
|
+
* - 目标是已有条目:编辑全文副本,存回时与模型写入同一套规范化、凭据检查与上限(store.saveRaw);
|
|
5
|
+
* - 目标是作用域名(或省略 = 第一个作用域):编辑新条目模板,按 `name` 生成文件名(重名加 `-2`、`-3`…);
|
|
6
|
+
* - 编辑器非零退出 → cancelled;内容没变 / 新条目没写名字 → unchanged。
|
|
7
|
+
* 编辑器在临时文件上工作(modes/interactive/external-editor.ts),作用域目录里不会留下半截文件。
|
|
8
|
+
*/
|
|
9
|
+
import type { MemoryStore } from "./store.js";
|
|
10
|
+
export type EditOutcome = {
|
|
11
|
+
status: "saved";
|
|
12
|
+
path: string;
|
|
13
|
+
} | {
|
|
14
|
+
status: "unchanged";
|
|
15
|
+
} | {
|
|
16
|
+
status: "cancelled";
|
|
17
|
+
} | {
|
|
18
|
+
status: "not_found";
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
/** 编辑器:给全文与临时文件名,返回改后的全文;没保存返回 undefined。 */
|
|
22
|
+
export type EditText = (text: string, fileName: string) => Promise<string | undefined>;
|
|
23
|
+
export declare function slugify(name: string): string;
|
|
24
|
+
export declare function editMemory(store: MemoryStore, target: string | undefined, edit: EditText): Promise<EditOutcome>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 用户在编辑器里改记忆(`/memory edit`、`ama memory edit`)。[W6-M]
|
|
3
|
+
*
|
|
4
|
+
* - 目标是已有条目:编辑全文副本,存回时与模型写入同一套规范化、凭据检查与上限(store.saveRaw);
|
|
5
|
+
* - 目标是作用域名(或省略 = 第一个作用域):编辑新条目模板,按 `name` 生成文件名(重名加 `-2`、`-3`…);
|
|
6
|
+
* - 编辑器非零退出 → cancelled;内容没变 / 新条目没写名字 → unchanged。
|
|
7
|
+
* 编辑器在临时文件上工作(modes/interactive/external-editor.ts),作用域目录里不会留下半截文件。
|
|
8
|
+
*/
|
|
9
|
+
import { parseEntry } from "./frontmatter.js";
|
|
10
|
+
import { MEMORY_SCOPE_ORDER } from "./paths.js";
|
|
11
|
+
import { findOne } from "./report.js";
|
|
12
|
+
export function slugify(name) {
|
|
13
|
+
const slug = name
|
|
14
|
+
.normalize("NFKD")
|
|
15
|
+
.toLowerCase()
|
|
16
|
+
.replace(/[^a-z0-9\u4e00-\u9fff]+/g, "-")
|
|
17
|
+
.replace(/^-+|-+$/g, "")
|
|
18
|
+
.slice(0, 60);
|
|
19
|
+
return slug === "" ? "note" : slug;
|
|
20
|
+
}
|
|
21
|
+
function template(scope) {
|
|
22
|
+
const type = scope === "user" ? "user" : "project";
|
|
23
|
+
return `---\nname: \ndescription: \ntype: ${type}\n---\n\n`;
|
|
24
|
+
}
|
|
25
|
+
function freeFile(store, scope, base) {
|
|
26
|
+
const taken = new Set(store.entries(scope).map((e) => e.file));
|
|
27
|
+
if (!taken.has(`${base}.md`))
|
|
28
|
+
return `${base}.md`;
|
|
29
|
+
for (let n = 2;; n++)
|
|
30
|
+
if (!taken.has(`${base}-${n}.md`))
|
|
31
|
+
return `${base}-${n}.md`;
|
|
32
|
+
}
|
|
33
|
+
export async function editMemory(store, target, edit) {
|
|
34
|
+
const scopes = store.scopes();
|
|
35
|
+
const asScope = MEMORY_SCOPE_ORDER.find((s) => s === target && scopes.includes(s));
|
|
36
|
+
if (target === undefined || asScope !== undefined) {
|
|
37
|
+
const scope = asScope ?? scopes[0];
|
|
38
|
+
if (scope === undefined)
|
|
39
|
+
return { status: "unchanged" };
|
|
40
|
+
const before = template(scope);
|
|
41
|
+
const after = await edit(before, "memory.md");
|
|
42
|
+
if (after === undefined)
|
|
43
|
+
return { status: "cancelled" };
|
|
44
|
+
const name = (parseEntry(after).meta["name"] ?? "").trim();
|
|
45
|
+
if (after === before || name === "")
|
|
46
|
+
return { status: "unchanged" };
|
|
47
|
+
const file = freeFile(store, scope, slugify(name));
|
|
48
|
+
return { status: "saved", path: (await store.saveRaw(scope, file, after)).path };
|
|
49
|
+
}
|
|
50
|
+
const found = findOne(store, target);
|
|
51
|
+
if (!found.ok)
|
|
52
|
+
return { status: "not_found", message: found.message };
|
|
53
|
+
const before = store.readRaw(found.entry) ?? "";
|
|
54
|
+
const after = await edit(before, found.entry.file.split("/").at(-1) ?? "memory.md");
|
|
55
|
+
if (after === undefined)
|
|
56
|
+
return { status: "cancelled" };
|
|
57
|
+
if (after === before)
|
|
58
|
+
return { status: "unchanged" };
|
|
59
|
+
return {
|
|
60
|
+
status: "saved",
|
|
61
|
+
path: (await store.saveRaw(found.entry.scope, found.entry.file, after)).path,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 记忆条目的 frontmatter(docs/wave6-plan.md §3.2)。[W6-M]
|
|
3
|
+
*
|
|
4
|
+
* ```markdown
|
|
5
|
+
* ---
|
|
6
|
+
* name: 测试数据库重置
|
|
7
|
+
* description: 跑集成测试前要先执行的重置命令
|
|
8
|
+
* type: project # user | feedback | project | reference
|
|
9
|
+
* updated: 2026-10-03
|
|
10
|
+
* ---
|
|
11
|
+
*
|
|
12
|
+
* 正文
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* 只认单行 `key: value`(值可带成对引号);未知键保留原顺序。写入时规范化:`name` 缺省用文件名、
|
|
16
|
+
* `description` 缺省用正文首个非空行、`type` 不在四类里用作用域缺省、`updated` 总是写当天。
|
|
17
|
+
*/
|
|
18
|
+
export declare const MEMORY_TYPES: readonly ["user", "feedback", "project", "reference"];
|
|
19
|
+
export type MemoryType = (typeof MEMORY_TYPES)[number];
|
|
20
|
+
export interface ParsedEntry {
|
|
21
|
+
meta: Record<string, string>;
|
|
22
|
+
body: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function parseEntry(text: string): ParsedEntry;
|
|
25
|
+
/** 正文首个非空行(去掉标题井号),截到 150 字符。 */
|
|
26
|
+
export declare function firstLineOf(body: string): string;
|
|
27
|
+
export declare function serializeEntry(meta: Record<string, string>, body: string): string;
|
|
28
|
+
/** 写入前规范化:补全 name / description / type,`updated` 写 `today`。 */
|
|
29
|
+
export declare function normalizeEntry(text: string, defaults: {
|
|
30
|
+
name: string;
|
|
31
|
+
type: MemoryType;
|
|
32
|
+
today: string;
|
|
33
|
+
}): {
|
|
34
|
+
text: string;
|
|
35
|
+
meta: Record<string, string>;
|
|
36
|
+
body: string;
|
|
37
|
+
};
|