mixdog 1.0.10 → 1.0.12
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/NOTICE.md +20 -0
- package/package.json +8 -5
- package/scripts/check-changelog-locales.mjs +203 -0
- package/scripts/computer-task-cost-report.mjs +0 -4
- package/scripts/sync-client-version-floors.mjs +100 -0
- package/src/defaults/skills/docx/SKILL.md +7 -5
- package/src/defaults/skills/docx/references/html.md +9 -8
- package/src/defaults/skills/docx/references/native-authoring.md +28 -18
- package/src/defaults/skills/local-provider/SKILL.md +2 -1
- package/src/defaults/skills/pdf/SKILL.md +9 -6
- package/src/defaults/skills/pdf/references/html.md +17 -12
- package/src/defaults/skills/pptx/SKILL.md +8 -6
- package/src/defaults/skills/pptx/references/composition.md +4 -4
- package/src/defaults/skills/pptx/references/concepts.md +168 -0
- package/src/defaults/skills/pptx/references/direction.md +5 -4
- package/src/defaults/skills/pptx/references/html.md +6 -29
- package/src/defaults/skills/pptx/references/kit-index.md +11 -3
- package/src/defaults/skills/pptx/references/kit.md +27 -5
- package/src/defaults/skills/pptx/references/review.md +6 -5
- package/src/defaults/skills/xlsx/SKILL.md +8 -6
- package/src/defaults/skills/xlsx/references/html.md +8 -4
- package/src/defaults/skills/xlsx/references/model-conventions.md +2 -0
- package/src/defaults/skills/xlsx/references/report-design.md +32 -16
- package/src/help.mjs +1 -1
- package/src/rules/agent/40-cycle1-agent.md +19 -23
- package/src/rules/lead/LEAD.md +5 -5
- package/src/rules/shared/05-tool-calls.md +6 -5
- package/src/rules/shared/60-verification.md +2 -2
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +37 -13
- package/src/runtime/agent/orchestrator/agent-runtime/title-completion.mjs +3 -0
- package/src/runtime/agent/orchestrator/cache-break-trace.mjs +6 -0
- package/src/runtime/agent/orchestrator/context/deferred-tools.mjs +3 -2
- package/src/runtime/agent/orchestrator/mcp/client.mjs +234 -12
- package/src/runtime/agent/orchestrator/providers/account-pool.mjs +13 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-midstream-recovery.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +5 -3
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +77 -7
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-request/initial-status.mjs +22 -5
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +36 -12
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-sse.mjs +10 -1
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +6 -0
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth-login.mjs +16 -12
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth-tokens.mjs +9 -1
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth.mjs +4 -0
- package/src/runtime/agent/orchestrator/providers/antigravity-request.mjs +3 -2
- package/src/runtime/agent/orchestrator/providers/antigravity-response.mjs +30 -22
- package/src/runtime/agent/orchestrator/providers/antigravity-stream.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/auto-effort.mjs +95 -0
- package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +14 -72
- package/src/runtime/agent/orchestrator/providers/cursor-auth.mjs +16 -0
- package/src/runtime/agent/orchestrator/providers/cursor-client-version.mjs +20 -10
- package/src/runtime/agent/orchestrator/providers/cursor-wire-stream-sink.mjs +36 -9
- package/src/runtime/agent/orchestrator/providers/cursor.mjs +22 -22
- package/src/runtime/agent/orchestrator/providers/custom-provider.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/effort-configuration.mjs +93 -25
- package/src/runtime/agent/orchestrator/providers/gemini-request-body.mjs +4 -6
- package/src/runtime/agent/orchestrator/providers/gemini-response.mjs +32 -15
- package/src/runtime/agent/orchestrator/providers/gemini-schema.mjs +7 -0
- package/src/runtime/agent/orchestrator/providers/gemini-sdk-request.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +39 -5
- package/src/runtime/agent/orchestrator/providers/gemini.mjs +11 -2
- package/src/runtime/agent/orchestrator/providers/grok-client-version.mjs +3 -2
- package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +7 -2
- package/src/runtime/agent/orchestrator/providers/grok-oauth-tokens.mjs +10 -1
- package/src/runtime/agent/orchestrator/providers/grok-oauth.mjs +5 -2
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-image-input.mjs +34 -13
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +5 -1
- package/src/runtime/agent/orchestrator/providers/lib/note-error-usage.mjs +7 -0
- package/src/runtime/agent/orchestrator/providers/lib/oauth-page.mjs +94 -0
- package/src/runtime/agent/orchestrator/providers/lib/oauth-token-utils.mjs +57 -0
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +670 -198
- package/src/runtime/agent/orchestrator/providers/mixdog-local.mjs +9 -3
- package/src/runtime/agent/orchestrator/providers/model-cache.mjs +12 -5
- package/src/runtime/agent/orchestrator/providers/npm-cli-version.mjs +20 -15
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-send.mjs +8 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-result.mjs +2 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +28 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream.mjs +21 -2
- package/src/runtime/agent/orchestrator/providers/openai-compat-models.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-response-normalization.mjs +23 -8
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses-events.mjs +26 -6
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses-state.mjs +7 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +11 -8
- package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +16 -2
- package/src/runtime/agent/orchestrator/providers/openai-compat-wire.mjs +14 -8
- package/src/runtime/agent/orchestrator/providers/openai-compat-xai-send.mjs +7 -10
- package/src/runtime/agent/orchestrator/providers/openai-compat-xai.mjs +24 -28
- package/src/runtime/agent/orchestrator/providers/openai-compat.mjs +8 -42
- package/src/runtime/agent/orchestrator/providers/openai-direct-request.mjs +6 -0
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events/terminal-frames.mjs +39 -9
- package/src/runtime/agent/orchestrator/providers/openai-oauth-catalog.mjs +31 -9
- package/src/runtime/agent/orchestrator/providers/openai-oauth-dispatch.mjs +13 -38
- package/src/runtime/agent/orchestrator/providers/openai-oauth-login.mjs +6 -3
- package/src/runtime/agent/orchestrator/providers/openai-oauth-tokens.mjs +40 -9
- package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +7 -39
- package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +30 -101
- package/src/runtime/agent/orchestrator/providers/openai-responses-input.mjs +8 -4
- package/src/runtime/agent/orchestrator/providers/openai-responses-payload.mjs +3 -6
- package/src/runtime/agent/orchestrator/providers/openai-service-tier.mjs +19 -0
- package/src/runtime/agent/orchestrator/providers/openai-startup-prewarm.mjs +5 -195
- package/src/runtime/agent/orchestrator/providers/openai-ws-delta.mjs +9 -18
- package/src/runtime/agent/orchestrator/providers/openai-ws-events.mjs +4 -66
- package/src/runtime/agent/orchestrator/providers/openai-ws-response-state.mjs +11 -5
- package/src/runtime/agent/orchestrator/providers/openai-ws-send/acquire-attempt.mjs +3 -15
- package/src/runtime/agent/orchestrator/providers/openai-ws-send/attempt-request.mjs +6 -56
- package/src/runtime/agent/orchestrator/providers/openai-ws-send/send-context.mjs +1 -19
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-attempts/attempt-context.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-attempts/handshake-failure.mjs +2 -1
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-attempts/policy.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-attempts/stream-failure-stamps.mjs +0 -1
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-attempts/stream-failure.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-attempts.mjs +3 -5
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-outcome.mjs +10 -89
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-span.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-trace.mjs +0 -6
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream/terminal-frames.mjs +34 -11
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +0 -1
- package/src/runtime/agent/orchestrator/providers/openai-ws-watchdogs.mjs +3 -7
- package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +46 -19
- package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +44 -12
- package/src/runtime/agent/orchestrator/providers/registry.mjs +10 -0
- package/src/runtime/agent/orchestrator/providers/retry-classification.mjs +4 -0
- package/src/runtime/agent/orchestrator/providers/retry-classifier.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/retry-executor.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/retry-midstream.mjs +11 -0
- package/src/runtime/agent/orchestrator/runtime-core/builtin-features.mjs +16 -2
- package/src/runtime/agent/orchestrator/runtime-core/model-capabilities.mjs +21 -12
- package/src/runtime/agent/orchestrator/runtime-core/tool-defs.mjs +4 -0
- package/src/runtime/agent/orchestrator/runtime-core/workflow.mjs +17 -9
- package/src/runtime/agent/orchestrator/session/cache/scoped-cache-outcome.mjs +23 -1
- package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +40 -71
- package/src/runtime/agent/orchestrator/session/cache/tool-result-reuse.mjs +27 -0
- package/src/runtime/agent/orchestrator/session/compact/observation-supersession.mjs +45 -2
- package/src/runtime/agent/orchestrator/session/compact/runner.mjs +13 -10
- package/src/runtime/agent/orchestrator/session/compact/text-utils.mjs +54 -12
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +27 -5
- package/src/runtime/agent/orchestrator/session/eager-dispatch/admission.mjs +8 -51
- package/src/runtime/agent/orchestrator/session/eager-dispatch/entry.mjs +5 -0
- package/src/runtime/agent/orchestrator/session/image-strip-recovery.mjs +55 -2
- package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +29 -18
- package/src/runtime/agent/orchestrator/session/loop/request-boundary.mjs +8 -2
- package/src/runtime/agent/orchestrator/session/loop/send-phase.mjs +62 -0
- package/src/runtime/agent/orchestrator/session/loop/step-auto-effort.mjs +89 -0
- package/src/runtime/agent/orchestrator/session/loop/tool-phase.mjs +2 -0
- package/src/runtime/agent/orchestrator/session/loop/usage.mjs +5 -9
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-auto-effort.mjs +99 -0
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-execute.mjs +18 -3
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-loop-options.mjs +3 -1
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-prepare.mjs +0 -2
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-settle.mjs +5 -1
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +6 -3
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +10 -3
- package/src/runtime/agent/orchestrator/session/manager/session-owner-liveness.mjs +10 -28
- package/src/runtime/agent/orchestrator/session/manager/session-prompt-composition.mjs +5 -1
- package/src/runtime/agent/orchestrator/session/manager/status-telemetry.mjs +13 -0
- package/src/runtime/agent/orchestrator/session/manager/usage-metrics.mjs +10 -19
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +21 -5
- package/src/runtime/agent/orchestrator/session/send-with-recovery.mjs +20 -4
- package/src/runtime/agent/orchestrator/session/store/live-state.mjs +7 -6
- package/src/runtime/agent/orchestrator/session/store/serialize.mjs +6 -3
- package/src/runtime/agent/orchestrator/session/task-wait-control.mjs +13 -0
- package/src/runtime/agent/orchestrator/session/tool-batch/execute-call.mjs +16 -20
- package/src/runtime/agent/orchestrator/session/tool-batch/finalize.mjs +85 -2
- package/src/runtime/agent/orchestrator/session/tool-batch/pre-dispatch.mjs +10 -6
- package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +1 -0
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +12 -1
- package/src/runtime/agent/orchestrator/tools/builtin/find-files-tool.mjs +3 -3
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-path-fanout.mjs +2 -1
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-pattern-fanout.mjs +2 -1
- package/src/runtime/agent/orchestrator/tools/builtin/lib/scoped-search-flight.mjs +20 -0
- package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +51 -28
- package/src/runtime/agent/orchestrator/tools/builtin/path-utils.mjs +3 -2
- package/src/runtime/agent/orchestrator/tools/builtin/pdf-test-fixtures.mjs +47 -0
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-media.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-special-files.mjs +34 -30
- package/src/runtime/agent/orchestrator/tools/builtin/search-glob-tool.mjs +10 -5
- package/src/runtime/agent/orchestrator/tools/builtin/search-grep-tool.mjs +18 -7
- package/src/runtime/agent/orchestrator/tools/builtin/shell-lossless-compact.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin.mjs +9 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/aggregate-roots.mjs +3 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch/federation.mjs +3 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch/work.mjs +11 -6
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +13 -1
- package/src/runtime/agent/orchestrator/tools/progress-message.mjs +2 -0
- package/src/runtime/attachments/limits.mjs +20 -0
- package/src/runtime/{agent/orchestrator/tools/builtin/read-office-files.mjs → attachments/office-extract.mjs} +356 -125
- package/src/runtime/attachments/pdf-extract.mjs +2 -2
- package/src/runtime/attachments/store.mjs +232 -72
- package/src/runtime/browser-bridge/client.mjs +3 -3
- package/src/runtime/browser-bridge/tool-defs.mjs +1 -0
- package/src/runtime/effort-judge/compact-tokenizer.mjs +282 -0
- package/src/runtime/effort-judge/judge-client.mjs +285 -0
- package/src/runtime/effort-judge/judge-input.mjs +96 -0
- package/src/runtime/effort-judge/judge-worker.mjs +138 -0
- package/src/runtime/effort-judge/model-install.mjs +74 -0
- package/src/runtime/effort-judge/model-manifest.json +21 -0
- package/src/runtime/github/tool.mjs +214 -14
- package/src/runtime/local-provider/context-settings.mjs +15 -6
- package/src/runtime/local-provider/gguf-header.mjs +13 -5
- package/src/runtime/local-provider/hugging-face.mjs +27 -5
- package/src/runtime/local-provider/input-capabilities.mjs +30 -12
- package/src/runtime/local-provider/install-progress.mjs +7 -0
- package/src/runtime/local-provider/managed-runtime.mjs +2 -1
- package/src/runtime/local-provider/model-maintenance.mjs +15 -6
- package/src/runtime/local-provider/resumable-installations.mjs +40 -1
- package/src/runtime/local-provider/server.mjs +2 -0
- package/src/runtime/media/jobs.mjs +0 -1
- package/src/runtime/media/media-usage.mjs +2 -1
- package/src/runtime/memory/lib/embedding-model-config.mjs +6 -6
- package/src/runtime/memory/lib/embedding-model-files.mjs +44 -0
- package/src/runtime/memory/lib/embedding-tokenizer.mjs +253 -0
- package/src/runtime/memory/lib/embedding-worker.mjs +97 -103
- package/src/runtime/memory/lib/memory-chunk-quality.mjs +40 -218
- package/src/runtime/memory/lib/memory-embed.mjs +0 -9
- package/src/runtime/memory/lib/memory.mjs +34 -23
- package/src/runtime/memory/lib/pg/process.mjs +57 -5
- package/src/runtime/memory/tool-defs.mjs +2 -1
- package/src/runtime/office/README.md +13 -7
- package/src/runtime/office/authoring/docx-html-build.mjs +4 -4
- package/src/runtime/office/authoring/docx-html-measure.mjs +60 -0
- package/src/runtime/office/authoring/pdf-author-action.mjs +6 -1
- package/src/runtime/office/authoring/pptx-brief.mjs +40 -1
- package/src/runtime/office/authoring/pptx-html-build.mjs +1 -1
- package/src/runtime/office/authoring/pptx-html-measure.mjs +1 -1
- package/src/runtime/office/bench/deck-bench.mjs +1 -1
- package/src/runtime/office/com/office-com-host.ps1 +8 -0
- package/src/runtime/office/core/office-actions-render.mjs +2 -0
- package/src/runtime/office/design/design-art-direction.mjs +10 -2
- package/src/runtime/office/design/design-discipline.mjs +4 -5
- package/src/runtime/office/design/design-tokens.mjs +20 -1
- package/src/runtime/office/design/docx/design-docx/front-matter.mjs +7 -4
- package/src/runtime/office/design/docx/design-docx/section.mjs +3 -1
- package/src/runtime/office/design/docx/design-docx/writer.mjs +1 -0
- package/src/runtime/office/design/docx/design-docx-components.mjs +19 -15
- package/src/runtime/office/design/docx/design-docx.mjs +5 -6
- package/src/runtime/office/design/docx/document-typography.mjs +20 -6
- package/src/runtime/office/design/xlsx/design-xlsx.mjs +9 -2
- package/src/runtime/office/pdf/document-preview.mjs +133 -12
- package/src/runtime/office/pdf/pdf-writer.mjs +56 -22
- package/src/runtime/office/portable/portable-snapshot-docx.mjs +46 -3
- package/src/runtime/office/portable/portable-snapshot-shared.mjs +27 -1
- package/src/runtime/office/quality/assurance-rendered.mjs +21 -5
- package/src/runtime/office/quality/assurance-structure-docx.mjs +41 -9
- package/src/runtime/office/quality/design-aesthetics.mjs +4 -2
- package/src/runtime/office/quality/design-deck-diversity.mjs +15 -3
- package/src/runtime/office/quality/design-review.mjs +13 -5
- package/src/runtime/office/quality/document-brief.mjs +8 -2
- package/src/runtime/office/quality/forced-break-pages.mjs +203 -0
- package/src/runtime/office/quality/pptx-deck-rubric.mjs +21 -3
- package/src/runtime/office/quality/quality-pipeline.mjs +14 -17
- package/src/runtime/session-search/session-search-db.mjs +183 -0
- package/src/runtime/session-search/session-search-ingest.mjs +106 -0
- package/src/runtime/shared/automation-attachments.mjs +9 -7
- package/src/runtime/shared/environment-error.mjs +14 -0
- package/src/runtime/shared/error-presentation.mjs +18 -3
- package/src/runtime/shared/inline-file-kind.mjs +28 -2
- package/src/runtime/shared/llm/cost.mjs +4 -2
- package/src/runtime/shared/llm/model-catalog-projection.mjs +1 -1
- package/src/runtime/shared/llm/model-catalog.mjs +19 -3
- package/src/runtime/shared/llm/quota-value-estimate.mjs +33 -18
- package/src/runtime/shared/llm/reasoning-usage.mjs +1 -2
- package/src/runtime/shared/llm/usage-accounting.mjs +22 -9
- package/src/runtime/shared/llm/usage-context.mjs +11 -1
- package/src/runtime/shared/llm/usage-ledger-quota.mjs +29 -10
- package/src/runtime/shared/llm/usage-ledger-repair.mjs +3 -1
- package/src/runtime/shared/llm/usage-ledger-rollup.mjs +47 -4
- package/src/runtime/shared/pristine-execution-contract.json +7 -2
- package/src/runtime/shared/read-image-resize.mjs +56 -0
- package/src/runtime/shared/tool-card-model/agent-surface.mjs +30 -9
- package/src/runtime/shared/tool-card-model/aggregate-card.mjs +7 -3
- package/src/runtime/shared/tool-card-model/background-task.mjs +17 -1
- package/src/runtime/shared/tool-card-model/card-detail.mjs +10 -4
- package/src/runtime/shared/tool-card-model/card-header.mjs +10 -4
- package/src/runtime/shared/tool-card-model/card-status.mjs +22 -5
- package/src/runtime/shared/tool-card-model/displayed-result.mjs +13 -6
- package/src/runtime/shared/tool-card-model/media-result.mjs +53 -0
- package/src/runtime/shared/tool-card-model/terminal-status.mjs +17 -1
- package/src/runtime/shared/tool-card-model.golden-cases.mjs +1 -1
- package/src/runtime/shared/tool-card-model.golden.json +72 -63
- package/src/runtime/shared/tool-card-model.mjs +3 -1
- package/src/runtime/shared/tool-output-limit.mjs +3 -0
- package/src/runtime/shared/tool-primitives.mjs +24 -18
- package/src/runtime/shared/tool-result-summary.mjs +161 -60
- package/src/runtime/shared/tool-status.mjs +20 -7
- package/src/runtime/shared/tool-surface.mjs +105 -28
- package/src/runtime/shared/tool-work-units.mjs +221 -18
- package/src/runtime/shared/turn-review-reply.mjs +63 -0
- package/src/runtime/shared/turn-snapshot.mjs +8 -5
- package/src/runtime/shared/turn-worktree-snapshot.mjs +56 -19
- package/src/runtime/shared/worker-requests.mjs +14 -2
- package/src/runtime/terminal-bridge/client.mjs +311 -0
- package/src/runtime/terminal-bridge/tool-defs.mjs +36 -0
- package/src/runtime/web-search/lib/ssrf-guard.mjs +12 -56
- package/src/runtime/web-search/tool-defs.mjs +2 -0
- package/src/session-runtime/boot/apis.mjs +12 -1
- package/src/session-runtime/boot/providers.mjs +2 -0
- package/src/session-runtime/boot/session.mjs +2 -0
- package/src/session-runtime/boot/shared.mjs +2 -3
- package/src/session-runtime/boot/tools.mjs +2 -0
- package/src/session-runtime/builtin-features.d.mts +1 -0
- package/src/session-runtime/internal-tool-executor/bridge-tools.mjs +15 -3
- package/src/session-runtime/lifecycle/session-switch/session-delete.mjs +3 -0
- package/src/session-runtime/lifecycle/teardown.mjs +5 -0
- package/src/session-runtime/local-provider-settings.mjs +10 -0
- package/src/session-runtime/model-route/route-persist.mjs +17 -2
- package/src/session-runtime/model-route/route-tuning.mjs +18 -5
- package/src/session-runtime/model-route/set-route.mjs +10 -5
- package/src/session-runtime/model-route/web-search-route.mjs +2 -2
- package/src/session-runtime/native-web-search/tool-shape.mjs +8 -8
- package/src/session-runtime/native-web-search.mjs +6 -8
- package/src/session-runtime/provider-models/row-hydration.mjs +36 -2
- package/src/session-runtime/route-state.mjs +9 -0
- package/src/session-runtime/runtime-feature-gates.mjs +2 -0
- package/src/session-runtime/services/agent-tool/helpers.mjs +10 -1
- package/src/session-runtime/services/agent-tool/lead-worker-index/reap-timers.mjs +6 -1
- package/src/session-runtime/services/agent-tool/lead-worker-index.mjs +20 -2
- package/src/session-runtime/services/agent-tool/spawn-flow/spawn-prep.mjs +3 -3
- package/src/session-runtime/services/agent-tool/tag-registry.mjs +12 -1
- package/src/session-runtime/services/agent-tool/worker-index.mjs +17 -1
- package/src/session-runtime/services/agent-tool.mjs +1 -0
- package/src/session-runtime/services/provider-admin.mjs +67 -6
- package/src/session-runtime/services/usage-stats-model.mjs +37 -2
- package/src/session-runtime/settings-api.mjs +1 -0
- package/src/session-runtime/settings-builtin-tools-api.mjs +26 -4
- package/src/session-runtime/setup-tool/executor.mjs +11 -1
- package/src/session-runtime/setup-tool/settings-contract.mjs +2 -2
- package/src/session-runtime/setup-tool/tool-defs.mjs +5 -2
- package/src/session-runtime/usage-stats-api.mjs +28 -3
- package/src/session-runtime/webhook-session-run.mjs +0 -9
- package/src/session-runtime/workflow-agents-api/agent-route.mjs +2 -2
- package/src/standalone/daemon-desktop-runtime.mjs +1 -0
- package/src/standalone/daemon-stored-session-views.mjs +15 -0
- package/src/standalone/daemon.mjs +15 -3
- package/src/standalone/session-protocol.mjs +1 -0
- package/src/standalone/session-service/entries/session-loads.mjs +11 -3
- package/src/standalone/session-service/entries.mjs +1 -0
- package/src/standalone/session-service/session-calls/session-action.mjs +31 -3
- package/src/standalone/session-service/session-calls/session-turns.mjs +2 -1
- package/src/standalone/session-service.mjs +2 -0
- package/src/tui/app/model-picker/model-footer.mjs +2 -2
- package/src/tui/app/model-picker/route-selection/fast-parameters.mjs +21 -2
- package/src/tui/app/model-picker/route-selection.mjs +6 -1
- package/src/tui/app/slash-commands.mjs +1 -1
- package/src/tui/app/slash-dispatch/route-commands.mjs +3 -2
- package/src/tui/app/transcript-row-estimate.mjs +17 -5
- package/src/tui/app/usage-context-panels/context-model.mjs +4 -1
- package/src/tui/app/usage-context-panels.mjs +3 -1
- package/src/tui/app/use-prompt-queue-history/restore-to-prompt.mjs +1 -0
- package/src/tui/components/ContextPanel.jsx +2 -0
- package/src/tui/components/tool-execution/aggregate-card.jsx +4 -2
- package/src/tui/components/tool-execution/text-format.mjs +1 -0
- package/src/tui/dist/index.mjs +648 -226
- package/src/tui/paste-attachments.mjs +2 -1
- package/src/tui/session/session-api/intake/abort.mjs +35 -3
- package/src/tui/session/session-api/integrations.mjs +2 -59
- package/src/tui/session/session-api/media.mjs +1 -1
- package/src/tui/session/session-api/routes.mjs +3 -2
- package/src/tui/session/session-api/settings.mjs +1 -0
- package/src/tui/session/session-flow/queue/take-entries.mjs +28 -12
- package/src/tui/session/session-flow/queue.mjs +1 -0
- package/src/tui/session/session-flow/steering.mjs +17 -3
- package/src/tui/session/session-flow.mjs +1 -0
- package/src/tui/session/turn-tool-cards.mjs +4 -6
- package/src/tui/session/turn.mjs +17 -4
- package/src/vendor/statusline/src/gateway/route-meta.mjs +3 -1
- package/scripts/memory-layer2-check.mjs +0 -186
- package/src/runtime/agent/orchestrator/providers/openai-ws-warmup.mjs +0 -165
package/src/tui/dist/index.mjs
CHANGED
|
@@ -33669,7 +33669,7 @@ var SLASH_COMMANDS = [
|
|
|
33669
33669
|
{ name: "theme", usage: "/theme", params: "[id]", description: "Change the TUI color theme" },
|
|
33670
33670
|
{ name: "agents", usage: "/agents", params: "[refresh]", description: "Show available workflow agents" },
|
|
33671
33671
|
{ name: "effort", usage: "/effort", params: "[level]", description: "Set reasoning effort for the current model" },
|
|
33672
|
-
{ name: "fast", usage: "/fast", params: "[on|off]", description: "
|
|
33672
|
+
{ name: "fast", usage: "/fast", params: "[on|off|ultra]", description: "Set Fast or Ultrafast mode for the current model" },
|
|
33673
33673
|
{ name: "mcp", usage: "/mcp", description: "Manage MCP servers and tools" },
|
|
33674
33674
|
{ name: "skills", usage: "/skills", description: "Choose a skill for the next request" },
|
|
33675
33675
|
{ name: "memory", usage: "/memory", params: "[status|core ...]", description: "List and edit core memories" },
|
|
@@ -37344,11 +37344,10 @@ function bridgeAgentModelSummary(args) {
|
|
|
37344
37344
|
]);
|
|
37345
37345
|
}
|
|
37346
37346
|
function summarizeLineWindow(a) {
|
|
37347
|
-
const hasOffset = a.offset != null;
|
|
37348
37347
|
const offset = a.offset ?? a.start_line ?? a.startLine ?? a.line;
|
|
37349
37348
|
const limit = a.limit ?? a.line_count ?? a.lineCount ?? a.lines;
|
|
37350
37349
|
if (offset == null && limit == null) return "";
|
|
37351
|
-
const start = Number(offset)
|
|
37350
|
+
const start = Number(offset);
|
|
37352
37351
|
const count = Number(limit);
|
|
37353
37352
|
if (Number.isFinite(start) && Number.isFinite(count) && count > 0) {
|
|
37354
37353
|
return `lines ${start}-${Math.max(start, start + count - 1)}`;
|
|
@@ -37400,24 +37399,21 @@ function patchFileCount(args = {}) {
|
|
|
37400
37399
|
function codeGraphLabel(args) {
|
|
37401
37400
|
const mode = String(args.mode || args.action || "").toLowerCase();
|
|
37402
37401
|
if (mode === "prewarm" || mode === "index" || mode === "build" || mode === "refresh") return "Setup";
|
|
37403
|
-
if (mode === "search" || mode === "find_symbol" || mode === "references" || mode === "callers" || mode === "callees")
|
|
37402
|
+
if (mode === "search" || mode === "symbol_search" || mode === "find_symbol" || mode === "references" || mode === "callers" || mode === "callees")
|
|
37404
37403
|
return "Search";
|
|
37405
37404
|
return "Read";
|
|
37406
37405
|
}
|
|
37406
|
+
var CODE_GRAPH_FILE_MODES = /* @__PURE__ */ new Set(["overview", "imports", "dependents", "related", "impact"]);
|
|
37407
|
+
function listOf(value) {
|
|
37408
|
+
const items = Array.isArray(value) ? value : [value];
|
|
37409
|
+
return items.map((item) => String(item ?? "").trim()).filter(Boolean);
|
|
37410
|
+
}
|
|
37407
37411
|
function codeGraphSummary(args, max) {
|
|
37408
|
-
|
|
37409
|
-
|
|
37410
|
-
|
|
37411
|
-
|
|
37412
|
-
|
|
37413
|
-
Array.isArray(args.symbols) ? args.symbols.join(", ") : "",
|
|
37414
|
-
args.file,
|
|
37415
|
-
args.path,
|
|
37416
|
-
args.query
|
|
37417
|
-
),
|
|
37418
|
-
max
|
|
37419
|
-
)
|
|
37420
|
-
]);
|
|
37412
|
+
const mode = String(args.mode || args.action || "");
|
|
37413
|
+
const symbols = listOf(args.symbols ?? args.symbol);
|
|
37414
|
+
const files = listOf(args.files ?? args.file ?? args.path).map(displayToolPath);
|
|
37415
|
+
const targets = CODE_GRAPH_FILE_MODES.has(mode) ? files.concat(symbols) : symbols.concat(files);
|
|
37416
|
+
return compactParts([mode, truncateToolText(targets.join(", ") || firstText(args.query), max)]);
|
|
37421
37417
|
}
|
|
37422
37418
|
function pluralize(count, singular, pluralText = `${singular}s`) {
|
|
37423
37419
|
return count === 1 ? singular : pluralText;
|
|
@@ -37512,16 +37508,20 @@ function isUserControlCancellation(text) {
|
|
|
37512
37508
|
function hasBenignExitOutcome(text) {
|
|
37513
37509
|
return /^\[outcome:\s*(?:no-match|no-change)\]\s*$/im.test(String(text || ""));
|
|
37514
37510
|
}
|
|
37515
|
-
|
|
37516
|
-
|
|
37517
|
-
const
|
|
37518
|
-
if (
|
|
37519
|
-
|
|
37511
|
+
var ENVELOPE_TAG_HEAD_RE = /^<(?:task-notification|task-id|tool-use-id|output-file|status)[\s>]/i;
|
|
37512
|
+
function toolResultEnvelopeStatus(text) {
|
|
37513
|
+
const head = leadingResultBlock(String(text || ""));
|
|
37514
|
+
if (ENVELOPE_TAG_HEAD_RE.test(head.trimStart())) {
|
|
37515
|
+
const tagged = head.match(/<status[^>]*>([\s\S]*?)<\/status>/i)?.[1]?.trim();
|
|
37516
|
+
if (tagged) return normalizeToolTerminalStatus(tagged);
|
|
37517
|
+
}
|
|
37520
37518
|
const bracketed = head.match(/^\[status:\s*([^\]]*)\]/im)?.[1]?.trim();
|
|
37521
37519
|
if (bracketed) return normalizeToolTerminalStatus(bracketed);
|
|
37522
37520
|
const inline = head.match(/^(?:status|state):\s*([^\s·,;]+)/im)?.[1]?.trim();
|
|
37523
|
-
|
|
37524
|
-
|
|
37521
|
+
return normalizeToolTerminalStatus(inline);
|
|
37522
|
+
}
|
|
37523
|
+
function toolResultControlStatus(text) {
|
|
37524
|
+
const body = String(text || "");
|
|
37525
37525
|
if (isUserControlCancellation(body)) return "cancelled";
|
|
37526
37526
|
const trimmed = body.trim();
|
|
37527
37527
|
if (/^(?:cancelled|canceled)$/i.test(trimmed)) return "cancelled";
|
|
@@ -37533,6 +37533,9 @@ function toolResultTerminalStatus(text) {
|
|
|
37533
37533
|
if (/^the user doesn't want to proceed with this tool use\b/i.test(trimmed)) return "cancelled";
|
|
37534
37534
|
return "";
|
|
37535
37535
|
}
|
|
37536
|
+
function toolResultTerminalStatus(text) {
|
|
37537
|
+
return toolResultEnvelopeStatus(text) || toolResultControlStatus(text);
|
|
37538
|
+
}
|
|
37536
37539
|
|
|
37537
37540
|
// src/runtime/shared/tool-card-model/git-result.mjs
|
|
37538
37541
|
function gitResultExitCode(text) {
|
|
@@ -37548,7 +37551,98 @@ function gitTerminalStatus(text) {
|
|
|
37548
37551
|
return "";
|
|
37549
37552
|
}
|
|
37550
37553
|
|
|
37554
|
+
// src/runtime/shared/tool-card-model/media-result.mjs
|
|
37555
|
+
function parseMediaOutcome(text) {
|
|
37556
|
+
const body = String(text || "").trim();
|
|
37557
|
+
if (!body.startsWith("{")) return null;
|
|
37558
|
+
try {
|
|
37559
|
+
const parsed = JSON.parse(body);
|
|
37560
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
37561
|
+
return {
|
|
37562
|
+
ok: parsed.ok !== false,
|
|
37563
|
+
job: String(parsed.job || ""),
|
|
37564
|
+
jobStatus: normalizeToolTerminalStatus(parsed.status),
|
|
37565
|
+
error: typeof parsed.error === "string" ? parsed.error.trim() : "",
|
|
37566
|
+
canceled: parsed.canceled === true
|
|
37567
|
+
};
|
|
37568
|
+
} catch {
|
|
37569
|
+
return null;
|
|
37570
|
+
}
|
|
37571
|
+
}
|
|
37572
|
+
function mediaTerminalStatus(args, text) {
|
|
37573
|
+
const outcome = parseMediaOutcome(text);
|
|
37574
|
+
if (!outcome) return "";
|
|
37575
|
+
if (!outcome.ok) return "failed";
|
|
37576
|
+
const action = String(args?.action || "").toLowerCase();
|
|
37577
|
+
if (action === "cancel") return outcome.canceled || outcome.jobStatus === "cancelled" ? "cancelled" : "completed";
|
|
37578
|
+
return "completed";
|
|
37579
|
+
}
|
|
37580
|
+
var JOB_WORDS = /* @__PURE__ */ new Map([
|
|
37581
|
+
["running", "running"],
|
|
37582
|
+
["completed", "done"],
|
|
37583
|
+
["failed", "failed"],
|
|
37584
|
+
["cancelled", "cancelled"]
|
|
37585
|
+
]);
|
|
37586
|
+
function mediaResultSummary(args, text) {
|
|
37587
|
+
const outcome = parseMediaOutcome(text);
|
|
37588
|
+
if (!outcome) return null;
|
|
37589
|
+
if (!outcome.ok) return outcome.error || "Failed";
|
|
37590
|
+
const action = String(args?.action || "").toLowerCase();
|
|
37591
|
+
if (action === "cancel" && (outcome.canceled || outcome.jobStatus === "cancelled")) return "Cancelled";
|
|
37592
|
+
if ((action === "status" || action === "cancel") && JOB_WORDS.has(outcome.jobStatus)) {
|
|
37593
|
+
return `Job ${JOB_WORDS.get(outcome.jobStatus)}`;
|
|
37594
|
+
}
|
|
37595
|
+
return null;
|
|
37596
|
+
}
|
|
37597
|
+
|
|
37551
37598
|
// src/runtime/shared/tool-result-summary.mjs
|
|
37599
|
+
var keepOriginal = (_key, original) => original;
|
|
37600
|
+
var COUNT_KEYS = new Map(
|
|
37601
|
+
[
|
|
37602
|
+
"lines",
|
|
37603
|
+
"matches",
|
|
37604
|
+
"files",
|
|
37605
|
+
"entries",
|
|
37606
|
+
"candidates",
|
|
37607
|
+
"results",
|
|
37608
|
+
"skills",
|
|
37609
|
+
"memories",
|
|
37610
|
+
"messages",
|
|
37611
|
+
"agents",
|
|
37612
|
+
"tasks",
|
|
37613
|
+
"references",
|
|
37614
|
+
"definitions",
|
|
37615
|
+
"symbols",
|
|
37616
|
+
"callers",
|
|
37617
|
+
"callees"
|
|
37618
|
+
].map((noun) => [noun, `{{count}} ${noun}`])
|
|
37619
|
+
);
|
|
37620
|
+
var STATUS_KEYS = new Map(
|
|
37621
|
+
["Completed", "Failed", "Cancelled", "Finished"].map((status) => [status.toLowerCase(), status])
|
|
37622
|
+
);
|
|
37623
|
+
var TOOL_RESULT_UI_KEYS = Object.freeze([
|
|
37624
|
+
...COUNT_KEYS.values(),
|
|
37625
|
+
...STATUS_KEYS.values(),
|
|
37626
|
+
"Image",
|
|
37627
|
+
"No output",
|
|
37628
|
+
"No results",
|
|
37629
|
+
"No agents or tasks",
|
|
37630
|
+
"Exit {{code}}",
|
|
37631
|
+
"Loaded {{name}}",
|
|
37632
|
+
"Used {{name}}"
|
|
37633
|
+
]);
|
|
37634
|
+
function countLabel(translate, n, singular, plural) {
|
|
37635
|
+
const noun = pluralize(n, singular, plural);
|
|
37636
|
+
const original = `${n} ${noun}`;
|
|
37637
|
+
const key = COUNT_KEYS.get(pluralize(2, singular, plural).toLowerCase());
|
|
37638
|
+
return key ? translate(key, original, { count: n }) : original;
|
|
37639
|
+
}
|
|
37640
|
+
function exitLabel(translate, code) {
|
|
37641
|
+
return translate("Exit {{code}}", `Exit ${code}`, { code });
|
|
37642
|
+
}
|
|
37643
|
+
function noOutput(translate) {
|
|
37644
|
+
return translate("No output", "(No Output)");
|
|
37645
|
+
}
|
|
37552
37646
|
function countNonEmptyLines(text) {
|
|
37553
37647
|
return String(text ?? "").split("\n").filter((line) => line.trim()).length;
|
|
37554
37648
|
}
|
|
@@ -37670,17 +37764,17 @@ function firstAgentResultLine(text) {
|
|
|
37670
37764
|
}
|
|
37671
37765
|
return "";
|
|
37672
37766
|
}
|
|
37673
|
-
function summarizeGenericResult(text) {
|
|
37767
|
+
function summarizeGenericResult(text, translate = keepOriginal) {
|
|
37674
37768
|
const trimmed = String(text ?? "").trim();
|
|
37675
37769
|
if (!trimmed) return null;
|
|
37676
37770
|
if (/^(?:undefined|null)$/i.test(trimmed)) return null;
|
|
37677
37771
|
if (/^[[{]/.test(trimmed)) {
|
|
37678
37772
|
try {
|
|
37679
37773
|
const parsed = JSON.parse(trimmed);
|
|
37680
|
-
if (Array.isArray(parsed)) return
|
|
37774
|
+
if (Array.isArray(parsed)) return countLabel(translate, parsed.length, "item");
|
|
37681
37775
|
if (parsed && typeof parsed === "object") {
|
|
37682
37776
|
if (parsed.cwd) return truncateSingleLine(parsed.cwd, AGENT_SURFACE_BRIEF_MAX);
|
|
37683
|
-
if (typeof parsed.ok === "boolean") return parsed.ok ? "Ok" : "Failed";
|
|
37777
|
+
if (typeof parsed.ok === "boolean") return parsed.ok ? "Ok" : translate("Failed", "Failed");
|
|
37684
37778
|
for (const key of [
|
|
37685
37779
|
"items",
|
|
37686
37780
|
"results",
|
|
@@ -37692,7 +37786,7 @@ function summarizeGenericResult(text) {
|
|
|
37692
37786
|
"tools"
|
|
37693
37787
|
]) {
|
|
37694
37788
|
if (Array.isArray(parsed[key]))
|
|
37695
|
-
return
|
|
37789
|
+
return countLabel(translate, parsed[key].length, (key.slice(0, -1) || "item").toLowerCase());
|
|
37696
37790
|
}
|
|
37697
37791
|
if (firstText(parsed.status, parsed.state)) return null;
|
|
37698
37792
|
const message = firstText(parsed.result, parsed.message);
|
|
@@ -37737,21 +37831,47 @@ function extractErrorCause(resultText) {
|
|
|
37737
37831
|
)
|
|
37738
37832
|
);
|
|
37739
37833
|
const picked = errorish || lines[0] || "";
|
|
37740
|
-
return truncateSingleLine(stripInlineMarkdown(picked), AGENT_SURFACE_BRIEF_MAX);
|
|
37834
|
+
return truncateSingleLine(stripInlineMarkdown(picked).replace(/^error\s*:\s*/i, ""), AGENT_SURFACE_BRIEF_MAX);
|
|
37741
37835
|
}
|
|
37742
|
-
function summarizeLineCount({ text, trimmed }, {
|
|
37836
|
+
function summarizeLineCount({ text, trimmed, translate }, { singular, plural }) {
|
|
37743
37837
|
if (!trimmed || !looksLineOriented(text)) return null;
|
|
37744
|
-
if (looksLikeZeroResultText(text)) return
|
|
37838
|
+
if (looksLikeZeroResultText(text)) return countLabel(translate, 0, singular, plural);
|
|
37745
37839
|
const n = countNonEmptyLines(text);
|
|
37746
37840
|
if (n === 0) return null;
|
|
37747
|
-
return
|
|
37841
|
+
return countLabel(translate, n, singular, plural);
|
|
37748
37842
|
}
|
|
37749
|
-
function
|
|
37750
|
-
|
|
37843
|
+
function summarizeGrepResult(result) {
|
|
37844
|
+
const { text, trimmed, args, translate } = result;
|
|
37845
|
+
if (!trimmed || !looksLineOriented(text)) return null;
|
|
37846
|
+
if (looksLikeZeroResultText(text)) return countLabel(translate, 0, "match", "matches");
|
|
37847
|
+
const a = parseToolArgs(args);
|
|
37848
|
+
const mode = String(a.output_mode ?? a.mode ?? "").toLowerCase();
|
|
37849
|
+
const rows2 = text.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("[") && !line.startsWith("\u2026"));
|
|
37850
|
+
if (mode === "count") {
|
|
37851
|
+
let matches = 0;
|
|
37852
|
+
let files = 0;
|
|
37853
|
+
for (const row of rows2) {
|
|
37854
|
+
const count = /(?:^|:)(\d+)$/.exec(row);
|
|
37855
|
+
if (!count) continue;
|
|
37856
|
+
matches += Number(count[1]);
|
|
37857
|
+
files += 1;
|
|
37858
|
+
}
|
|
37859
|
+
if (files === 0) return null;
|
|
37860
|
+
const files_ = countLabel(translate, files, "file");
|
|
37861
|
+
return `${countLabel(translate, matches, "match", "matches")} in ${files_}`;
|
|
37862
|
+
}
|
|
37863
|
+
if (mode === "files" || mode === "files_with_matches") {
|
|
37864
|
+
return countLabel(translate, rows2.filter((row) => !row.startsWith("#")).length, "file");
|
|
37865
|
+
}
|
|
37866
|
+
const matchRows = rows2.filter((row) => !/^(?:#|--$)/.test(row) && !/^(?:\d+|[^\s:]+?-\d+)-/.test(row));
|
|
37867
|
+
return matchRows.length ? countLabel(translate, matchRows.length, "match", "matches") : null;
|
|
37868
|
+
}
|
|
37869
|
+
function summarizeReadResult({ text, trimmed, translate }) {
|
|
37870
|
+
if (/^\[image:/i.test(trimmed)) return translate("Image", "Image");
|
|
37751
37871
|
if (!trimmed) return null;
|
|
37752
|
-
if (trimmed.startsWith("(no lines in range")) return
|
|
37872
|
+
if (trimmed.startsWith("(no lines in range")) return countLabel(translate, 0, "line");
|
|
37753
37873
|
const n = text.split("\n").length;
|
|
37754
|
-
return
|
|
37874
|
+
return countLabel(translate, n, "line");
|
|
37755
37875
|
}
|
|
37756
37876
|
function summarizePatchResult({ text, args }) {
|
|
37757
37877
|
const updateSummary = summarizeUpdateResult(text, args);
|
|
@@ -37773,47 +37893,56 @@ function summarizePatchResult({ text, args }) {
|
|
|
37773
37893
|
if (a > 0 || r > 0) return `+${a} -${r}`;
|
|
37774
37894
|
return null;
|
|
37775
37895
|
}
|
|
37776
|
-
function summarizeShellResult({ text, trimmed }) {
|
|
37777
|
-
if (!trimmed) return
|
|
37896
|
+
function summarizeShellResult({ text, trimmed, translate }) {
|
|
37897
|
+
if (!trimmed) return noOutput(translate);
|
|
37778
37898
|
const job = /^\[(?:task_id|job):\s*([^\]]+)\]/im.exec(text);
|
|
37779
37899
|
const status = /^\[status:\s*([^\]]+)\]/im.exec(text);
|
|
37780
37900
|
const exit = /^\[exit(?:\s+code)?:\s*([^\]]+)\]/im.exec(text);
|
|
37781
37901
|
if (job || status || exit) {
|
|
37782
|
-
|
|
37902
|
+
let statusText2 = "";
|
|
37903
|
+
if (status) {
|
|
37904
|
+
statusText2 = titleStatus(status[1]);
|
|
37905
|
+
const statusKey = STATUS_KEYS.get(statusText2.toLowerCase());
|
|
37906
|
+
if (statusKey) statusText2 = translate(statusKey, statusText2);
|
|
37907
|
+
}
|
|
37908
|
+
return compactParts([job ? job[1] : "", statusText2, exit ? exitLabel(translate, exit[1]) : ""]);
|
|
37783
37909
|
}
|
|
37784
37910
|
const firstLine = trimmed.split("\n").map((line) => line.trim()).find(Boolean) || trimmed;
|
|
37785
37911
|
return truncateSingleLine(firstLine, AGENT_SURFACE_BRIEF_MAX);
|
|
37786
37912
|
}
|
|
37787
|
-
function summarizeGitResult({ text, trimmed }) {
|
|
37913
|
+
function summarizeGitResult({ text, trimmed, translate }) {
|
|
37788
37914
|
const exit = gitResultExitCode(text);
|
|
37789
|
-
if (exit !== null) return
|
|
37915
|
+
if (exit !== null) return exitLabel(translate, exit);
|
|
37790
37916
|
const error = gitResultError(text);
|
|
37791
37917
|
if (error) return truncateSingleLine(error, AGENT_SURFACE_BRIEF_MAX);
|
|
37792
|
-
if (!trimmed) return
|
|
37918
|
+
if (!trimmed) return noOutput(translate);
|
|
37793
37919
|
if (trimmed.startsWith("{")) {
|
|
37794
37920
|
try {
|
|
37795
37921
|
const stored = JSON.parse(trimmed);
|
|
37796
|
-
if (typeof stored.ok === "boolean") return summarizeGenericResult(text);
|
|
37922
|
+
if (typeof stored.ok === "boolean") return summarizeGenericResult(text, translate);
|
|
37797
37923
|
} catch {
|
|
37798
37924
|
}
|
|
37799
37925
|
}
|
|
37800
37926
|
const firstLine = text.split("\n").find((line) => line.trim() && !/^## .*git(?:\.exe)?(?:\s|$)/i.test(line));
|
|
37801
|
-
return firstLine ? truncateSingleLine(firstLine, AGENT_SURFACE_BRIEF_MAX) :
|
|
37927
|
+
return firstLine ? truncateSingleLine(firstLine, AGENT_SURFACE_BRIEF_MAX) : noOutput(translate);
|
|
37802
37928
|
}
|
|
37803
|
-
function summarizeCodeGraphResult({ text }) {
|
|
37929
|
+
function summarizeCodeGraphResult({ text, translate }) {
|
|
37804
37930
|
const match = /(\d+)\s+(references|definitions|symbols|callers|callees|results|matches)/i.exec(text);
|
|
37805
|
-
if (match)
|
|
37806
|
-
|
|
37931
|
+
if (match) {
|
|
37932
|
+
const noun = String(match[2]).toLowerCase();
|
|
37933
|
+
return translate(COUNT_KEYS.get(noun), `${match[1]} ${noun}`, { count: Number(match[1]) });
|
|
37934
|
+
}
|
|
37935
|
+
if (looksLikeZeroResultText(text)) return translate("No results", "No results");
|
|
37807
37936
|
return null;
|
|
37808
37937
|
}
|
|
37809
|
-
function summarizeFetchResult({ text, trimmed, args, normalized }) {
|
|
37938
|
+
function summarizeFetchResult({ text, trimmed, args, normalized, translate }) {
|
|
37810
37939
|
if (normalized === "fetch") {
|
|
37811
37940
|
const a = parseToolArgs(args);
|
|
37812
37941
|
const isChannelFetch = !firstText(a.url, a.uri) && Boolean(firstText(a.channel, a.channelId, a.chatId, a.messageId) || a.limit != null);
|
|
37813
37942
|
if (isChannelFetch) {
|
|
37814
37943
|
const n = countNonEmptyLines(text);
|
|
37815
|
-
if (trimmed && looksLineOriented(text) && n > 0) return
|
|
37816
|
-
return summarizeGenericResult(text);
|
|
37944
|
+
if (trimmed && looksLineOriented(text) && n > 0) return countLabel(translate, n, "message");
|
|
37945
|
+
return summarizeGenericResult(text, translate);
|
|
37817
37946
|
}
|
|
37818
37947
|
}
|
|
37819
37948
|
const status = /(?:HTTP[\s/]*\d?\.?\d?\s*|status[:\s]+)([1-5]\d{2})\b/i.exec(text) || /\b([1-5]\d{2})\s+(?:OK|Not\s+Found|Forbidden|Moved|Found|Created|No\s+Content|Bad\s+Request|Unauthorized|Internal)/.exec(
|
|
@@ -37825,72 +37954,68 @@ function summarizeFetchResult({ text, trimmed, args, normalized }) {
|
|
|
37825
37954
|
if (status) return `HTTP ${status[1]}`;
|
|
37826
37955
|
return null;
|
|
37827
37956
|
}
|
|
37828
|
-
function summarizeSearchResult({ text, trimmed }) {
|
|
37957
|
+
function summarizeSearchResult({ text, trimmed, translate }) {
|
|
37829
37958
|
const match = /(\d+)\s+results?/i.exec(text);
|
|
37830
|
-
if (match)
|
|
37831
|
-
const n = Number(match[1]);
|
|
37832
|
-
return `${n} ${pluralize(n, "result")}`;
|
|
37833
|
-
}
|
|
37959
|
+
if (match) return countLabel(translate, Number(match[1]), "result");
|
|
37834
37960
|
return trimmed ? firstAgentResultLine(text) || null : null;
|
|
37835
37961
|
}
|
|
37836
|
-
function summarizeMemoryResult({ text, trimmed }) {
|
|
37837
|
-
if (!trimmed || trimmed === "(no results)" || looksLikeZeroResultText(text))
|
|
37962
|
+
function summarizeMemoryResult({ text, trimmed, translate }) {
|
|
37963
|
+
if (!trimmed || trimmed === "(no results)" || looksLikeZeroResultText(text)) {
|
|
37964
|
+
return translate("No results", "No Results");
|
|
37965
|
+
}
|
|
37838
37966
|
let n = 0;
|
|
37839
37967
|
for (const line of text.split("\n")) {
|
|
37840
37968
|
if (/#\d+\s*$/.test(line)) n += 1;
|
|
37841
37969
|
}
|
|
37842
|
-
if (n > 0) return
|
|
37843
|
-
return summarizeGenericResult(text);
|
|
37970
|
+
if (n > 0) return countLabel(translate, n, "Memory", "Memories");
|
|
37971
|
+
return summarizeGenericResult(text, translate);
|
|
37844
37972
|
}
|
|
37845
|
-
function summarizeSkillResult({ text, trimmed, args, normalized }) {
|
|
37973
|
+
function summarizeSkillResult({ text, trimmed, args, normalized, translate }) {
|
|
37846
37974
|
const parsedArgs = parseToolArgs(args);
|
|
37847
37975
|
const target = firstText(parsedArgs.name, parsedArgs.skill, parsedArgs.skill_name);
|
|
37848
37976
|
if (normalized === "skills_list") {
|
|
37849
37977
|
const count = /(\d+)\s+skills?/i.exec(text);
|
|
37850
|
-
if (count) return
|
|
37978
|
+
if (count) return countLabel(translate, Number(count[1]) || 0, "skill");
|
|
37851
37979
|
const lines = countNonEmptyLines(text);
|
|
37852
|
-
return lines > 0 ?
|
|
37980
|
+
return lines > 0 ? countLabel(translate, lines, "skill") : null;
|
|
37853
37981
|
}
|
|
37854
37982
|
if (target) {
|
|
37855
37983
|
const verb = normalized === "skill" || normalized === "skill_view" ? "Loaded" : "Used";
|
|
37856
|
-
|
|
37984
|
+
const name = truncateToolText(target, 80);
|
|
37985
|
+
return translate(`${verb} {{name}}`, `${verb} ${name}`, { name });
|
|
37857
37986
|
}
|
|
37858
37987
|
return trimmed ? firstAgentResultLine(text) || null : null;
|
|
37859
37988
|
}
|
|
37860
|
-
function summarizeAgentCounts(text) {
|
|
37861
|
-
|
|
37989
|
+
function summarizeAgentCounts(text, translate = keepOriginal) {
|
|
37990
|
+
const none = () => translate("No agents or tasks", "No agents or tasks");
|
|
37991
|
+
if (/^\(no agents or tasks\)$/im.test(text)) return none();
|
|
37862
37992
|
const agentsCount = /^agents:\s*(\d+)/im.exec(text);
|
|
37863
37993
|
const tasksCount = /^tasks:\s*(\d+)/im.exec(text);
|
|
37864
37994
|
if (!agentsCount && !tasksCount) return null;
|
|
37865
37995
|
const a = agentsCount ? Number(agentsCount[1]) : 0;
|
|
37866
37996
|
const t = tasksCount ? Number(tasksCount[1]) : 0;
|
|
37867
37997
|
const parts = [];
|
|
37868
|
-
if (agentsCount) parts.push(
|
|
37869
|
-
if (tasksCount && t > 0) parts.push(
|
|
37870
|
-
return compactParts(parts) ||
|
|
37998
|
+
if (agentsCount) parts.push(countLabel(translate, a, "agent"));
|
|
37999
|
+
if (tasksCount && t > 0) parts.push(countLabel(translate, t, "task"));
|
|
38000
|
+
return compactParts(parts) || none();
|
|
37871
38001
|
}
|
|
37872
|
-
function summarizeAgentResult({ text }) {
|
|
37873
|
-
const counts = summarizeAgentCounts(text);
|
|
38002
|
+
function summarizeAgentResult({ text, translate }) {
|
|
38003
|
+
const counts = summarizeAgentCounts(text, translate);
|
|
37874
38004
|
if (counts) return counts;
|
|
37875
38005
|
const answerLine = firstAgentResultLine(text);
|
|
37876
38006
|
if (answerLine) return truncateSingleLine(stripInlineMarkdown(answerLine), AGENT_SURFACE_BRIEF_MAX);
|
|
37877
38007
|
return null;
|
|
37878
38008
|
}
|
|
37879
|
-
var summarizeGeneric = ({ text }) => summarizeGenericResult(text);
|
|
38009
|
+
var summarizeGeneric = ({ text, translate }) => summarizeGenericResult(text, translate);
|
|
37880
38010
|
var TOOL_RESULT_SUMMARIZERS = new Map(
|
|
37881
38011
|
[
|
|
37882
38012
|
[["read", "view_image", "read_mcp_resource"], summarizeReadResult],
|
|
37883
38013
|
[["apply_patch"], summarizePatchResult],
|
|
37884
|
-
[["grep"],
|
|
37885
|
-
[["
|
|
37886
|
-
[
|
|
37887
|
-
|
|
37888
|
-
|
|
37889
|
-
],
|
|
37890
|
-
[
|
|
37891
|
-
["list", "ls"],
|
|
37892
|
-
(result) => summarizeLineCount(result, { zero: "0 entries", singular: "entry", plural: "entries" })
|
|
37893
|
-
],
|
|
38014
|
+
[["grep"], summarizeGrepResult],
|
|
38015
|
+
[["media"], ({ args, text }) => mediaResultSummary(parseToolArgs(args), text)],
|
|
38016
|
+
[["glob"], (result) => summarizeLineCount(result, { singular: "file", plural: "files" })],
|
|
38017
|
+
[["find"], (result) => summarizeLineCount(result, { singular: "candidate", plural: "candidates" })],
|
|
38018
|
+
[["list", "ls"], (result) => summarizeLineCount(result, { singular: "entry", plural: "entries" })],
|
|
37894
38019
|
[["shell", "bash", "bash_session", "shell_command", "job_wait"], summarizeShellResult],
|
|
37895
38020
|
[["git"], summarizeGitResult],
|
|
37896
38021
|
[["code_graph"], summarizeCodeGraphResult],
|
|
@@ -37914,12 +38039,12 @@ var TOOL_RESULT_SUMMARIZERS = new Map(
|
|
|
37914
38039
|
[["agent", "task"], summarizeAgentResult]
|
|
37915
38040
|
].flatMap(([names, summarize]) => names.map((name) => [name, summarize]))
|
|
37916
38041
|
);
|
|
37917
|
-
function summarizeToolResult(name, args, resultText, isError = false) {
|
|
38042
|
+
function summarizeToolResult(name, args, resultText, isError = false, translate = keepOriginal) {
|
|
37918
38043
|
const notification = parseTaskNotification(resultText);
|
|
37919
38044
|
if (notification) {
|
|
37920
38045
|
if (isError) return notification.error || notification.summary;
|
|
37921
38046
|
if (notification.surface === "shell") return notification.summary;
|
|
37922
|
-
return summarizeToolResult(name, args, notification.result, false);
|
|
38047
|
+
return summarizeToolResult(name, args, notification.result, false, translate);
|
|
37923
38048
|
}
|
|
37924
38049
|
if (isError) {
|
|
37925
38050
|
return extractErrorCause(resultText) || null;
|
|
@@ -37930,7 +38055,7 @@ function summarizeToolResult(name, args, resultText, isError = false) {
|
|
|
37930
38055
|
if (isMcpToolName(name)) return trimmed ? firstAgentResultLine(text) || null : null;
|
|
37931
38056
|
const normalized = normalizeToolName(name);
|
|
37932
38057
|
const summarize = TOOL_RESULT_SUMMARIZERS.get(normalized);
|
|
37933
|
-
return summarize ? summarize({ text, trimmed, args, normalized }) : null;
|
|
38058
|
+
return summarize ? summarize({ text, trimmed, args, normalized, translate }) : null;
|
|
37934
38059
|
}
|
|
37935
38060
|
function truncateAgentSurfaceBrief(value, max = AGENT_SURFACE_BRIEF_MAX) {
|
|
37936
38061
|
const text = String(value ?? "").replace(/\s+/g, " ").trim();
|
|
@@ -37942,6 +38067,10 @@ function summarizeAgentSurfaceBrief(name, args, resultText, { isError = false, i
|
|
|
37942
38067
|
const a = parseToolArgs(args);
|
|
37943
38068
|
const action = String(a?.type || a?.action || "").toLowerCase();
|
|
37944
38069
|
const text = String(resultText ?? "").trim();
|
|
38070
|
+
if (isError && text) {
|
|
38071
|
+
const cause = extractErrorCause(text);
|
|
38072
|
+
if (cause) return truncateAgentSurfaceBrief(cause);
|
|
38073
|
+
}
|
|
37945
38074
|
if (isResponse && text) {
|
|
37946
38075
|
const fromResult = summarizeToolResult(name, args, text, isError);
|
|
37947
38076
|
if (fromResult) return truncateAgentSurfaceBrief(stripInlineMarkdown(fromResult));
|
|
@@ -37976,6 +38105,7 @@ var CATEGORY_ORDER = [
|
|
|
37976
38105
|
"Setup",
|
|
37977
38106
|
"Browser",
|
|
37978
38107
|
"Computer",
|
|
38108
|
+
"Terminal",
|
|
37979
38109
|
"Office",
|
|
37980
38110
|
"Media",
|
|
37981
38111
|
"Tidy",
|
|
@@ -38024,12 +38154,15 @@ var TOOL_CATEGORY = /* @__PURE__ */ new Map([
|
|
|
38024
38154
|
["browser", "Browser"],
|
|
38025
38155
|
["browser_devtools", "Browser"],
|
|
38026
38156
|
["computer", "Computer"],
|
|
38157
|
+
["terminal", "Terminal"],
|
|
38027
38158
|
["office", "Office"],
|
|
38028
38159
|
["media", "Media"],
|
|
38029
38160
|
["tidy", "Tidy"],
|
|
38030
38161
|
["list_mcp_resources", "Setup"],
|
|
38031
38162
|
["list_mcp_resource_templates", "Setup"],
|
|
38032
38163
|
["cwd", "Setup"],
|
|
38164
|
+
["setup", "Setup"],
|
|
38165
|
+
["goal", "Setup"],
|
|
38033
38166
|
["request_user_input", "Setup"],
|
|
38034
38167
|
["update_plan", "Setup"],
|
|
38035
38168
|
["skill", "Skill"],
|
|
@@ -38060,6 +38193,7 @@ var CATEGORY_COPY = /* @__PURE__ */ new Map([
|
|
|
38060
38193
|
["Setup", { active: "Setting up", done: "Set up", noun: "item" }],
|
|
38061
38194
|
["Browser", { active: "Browsing", done: "Browsed", noun: "action" }],
|
|
38062
38195
|
["Computer", { active: "Operating", done: "Operated", noun: "action" }],
|
|
38196
|
+
["Terminal", { active: "Reading", done: "Read", noun: "terminal output" }],
|
|
38063
38197
|
["Office", { active: "Editing", done: "Edited", noun: "document action" }],
|
|
38064
38198
|
["Media", { active: "Generating", done: "Generated", noun: "media action" }],
|
|
38065
38199
|
["Tidy", { active: "Tidying", done: "Tidied", noun: "cleanup pass" }],
|
|
@@ -38076,7 +38210,9 @@ function unitDescriptor(category, overrides = {}) {
|
|
|
38076
38210
|
done: overrides.done || copy.done,
|
|
38077
38211
|
noun: overrides.noun || copy.noun || "item",
|
|
38078
38212
|
pluralNoun: overrides.pluralNoun || copy.pluralNoun || `${overrides.noun || copy.noun || "item"}s`,
|
|
38079
|
-
count: Math.max(1, Number(overrides.count || 1))
|
|
38213
|
+
count: Math.max(1, Number(overrides.count || 1)),
|
|
38214
|
+
// An effect unit changes state: a failed call must not claim its done verb.
|
|
38215
|
+
effect: overrides.effect === true
|
|
38080
38216
|
};
|
|
38081
38217
|
}
|
|
38082
38218
|
function queryCount(args, ...keys) {
|
|
@@ -38131,7 +38267,8 @@ function patchMutationUnits(args = {}) {
|
|
|
38131
38267
|
count,
|
|
38132
38268
|
active: copy[kind]?.active || "Editing",
|
|
38133
38269
|
done: copy[kind]?.done || "Edited",
|
|
38134
|
-
noun: "file"
|
|
38270
|
+
noun: "file",
|
|
38271
|
+
effect: true
|
|
38135
38272
|
})
|
|
38136
38273
|
);
|
|
38137
38274
|
}
|
|
@@ -38142,7 +38279,8 @@ function applyPatchUnit(a) {
|
|
|
38142
38279
|
count: units.reduce((total, unit) => total + unit.count, 0),
|
|
38143
38280
|
active: "Changing",
|
|
38144
38281
|
done: "Changed",
|
|
38145
|
-
noun: "file"
|
|
38282
|
+
noun: "file",
|
|
38283
|
+
effect: true
|
|
38146
38284
|
});
|
|
38147
38285
|
}
|
|
38148
38286
|
function listUnit(a) {
|
|
@@ -38156,11 +38294,12 @@ function listUnit(a) {
|
|
|
38156
38294
|
}
|
|
38157
38295
|
function loadToolUnit(a) {
|
|
38158
38296
|
const selected = [...splitToolSearchSelection(a.names), ...splitToolSearchSelection(a.select)];
|
|
38159
|
-
if (selected.length) return unitDescriptor("Load", { count: selected.length, noun: "tool" });
|
|
38297
|
+
if (selected.length) return unitDescriptor("Load", { count: selected.length, noun: "tool", effect: true });
|
|
38160
38298
|
return unitDescriptor("Load", {
|
|
38161
38299
|
count: queryCount(a, "query", "q", "text") || 1,
|
|
38162
38300
|
noun: "query",
|
|
38163
|
-
pluralNoun: "queries"
|
|
38301
|
+
pluralNoun: "queries",
|
|
38302
|
+
effect: true
|
|
38164
38303
|
});
|
|
38165
38304
|
}
|
|
38166
38305
|
function webSearchUnit(a) {
|
|
@@ -38171,14 +38310,162 @@ function webSearchUnit(a) {
|
|
|
38171
38310
|
});
|
|
38172
38311
|
}
|
|
38173
38312
|
function mediaUnit(a) {
|
|
38174
|
-
|
|
38175
|
-
|
|
38313
|
+
const action = String(a.action || "").toLowerCase();
|
|
38314
|
+
if (action === "generate") {
|
|
38315
|
+
const noun = a.kind === "video" ? "video" : "image";
|
|
38316
|
+
return unitDescriptor("Media", { count: 1, active: "Generating", done: "Generated", noun, effect: true });
|
|
38317
|
+
}
|
|
38318
|
+
if (action === "cancel") {
|
|
38319
|
+
return unitDescriptor("Media", {
|
|
38320
|
+
count: 1,
|
|
38321
|
+
active: "Cancelling",
|
|
38322
|
+
done: "Cancelled",
|
|
38323
|
+
noun: "media job",
|
|
38324
|
+
effect: true
|
|
38325
|
+
});
|
|
38326
|
+
}
|
|
38327
|
+
if (action === "list") {
|
|
38328
|
+
return unitDescriptor("Media", { count: 1, active: "Listing", done: "Listed", noun: "media catalog" });
|
|
38176
38329
|
}
|
|
38177
|
-
|
|
38178
|
-
return unitDescriptor("Media", { count: 1, active: "Generating", done: "Generated", noun });
|
|
38330
|
+
return unitDescriptor("Media", { count: 1, active: "Checking", done: "Checked", noun: "media job" });
|
|
38179
38331
|
}
|
|
38180
38332
|
function tidyUnit(a) {
|
|
38181
|
-
|
|
38333
|
+
const action = String(a.action || "").toLowerCase();
|
|
38334
|
+
if (action === "install") {
|
|
38335
|
+
return unitDescriptor("Tidy", {
|
|
38336
|
+
count: 1,
|
|
38337
|
+
active: "Installing",
|
|
38338
|
+
done: "Installed",
|
|
38339
|
+
noun: "cleanup engine",
|
|
38340
|
+
effect: true
|
|
38341
|
+
});
|
|
38342
|
+
}
|
|
38343
|
+
if (action === "fix") {
|
|
38344
|
+
return a.apply === true ? unitDescriptor("Tidy", { count: 1, active: "Tidying", done: "Tidied", noun: "cleanup pass", effect: true }) : unitDescriptor("Tidy", { count: 1, active: "Previewing", done: "Previewed", noun: "cleanup pass" });
|
|
38345
|
+
}
|
|
38346
|
+
if (action === "scan") {
|
|
38347
|
+
return unitDescriptor("Tidy", { count: 1, active: "Scanning", done: "Scanned", noun: "project" });
|
|
38348
|
+
}
|
|
38349
|
+
if (action === "rules" || action === "results") {
|
|
38350
|
+
return unitDescriptor("Tidy", { count: 1, active: "Reading", done: "Read", noun: `cleanup ${action}` });
|
|
38351
|
+
}
|
|
38352
|
+
return unitDescriptor("Tidy", { count: 1, active: "Checking", done: "Checked", noun: "cleanup action" });
|
|
38353
|
+
}
|
|
38354
|
+
var OFFICE_READ_ACTIONS = /* @__PURE__ */ new Set([
|
|
38355
|
+
"snapshot",
|
|
38356
|
+
"get",
|
|
38357
|
+
"query",
|
|
38358
|
+
"describe",
|
|
38359
|
+
"detect",
|
|
38360
|
+
"issues",
|
|
38361
|
+
"qa",
|
|
38362
|
+
"validate",
|
|
38363
|
+
"render",
|
|
38364
|
+
"diff",
|
|
38365
|
+
"transactions"
|
|
38366
|
+
]);
|
|
38367
|
+
var OFFICE_ACTION_VERBS = /* @__PURE__ */ new Map([
|
|
38368
|
+
["author", ["Authoring", "Authored"]],
|
|
38369
|
+
["batch", ["Editing", "Edited"]],
|
|
38370
|
+
["create", ["Creating", "Created"]],
|
|
38371
|
+
["attach", ["Attaching", "Attached"]],
|
|
38372
|
+
["open", ["Opening", "Opened"]],
|
|
38373
|
+
["secure", ["Securing", "Secured"]],
|
|
38374
|
+
["begin", ["Starting", "Started"]],
|
|
38375
|
+
["commit", ["Committing", "Committed"]],
|
|
38376
|
+
["rollback", ["Rolling back", "Rolled back"]],
|
|
38377
|
+
["recover", ["Recovering", "Recovered"]],
|
|
38378
|
+
["save", ["Saving", "Saved"]],
|
|
38379
|
+
["finalize", ["Finalizing", "Finalized"]],
|
|
38380
|
+
["close", ["Closing", "Closed"]]
|
|
38381
|
+
]);
|
|
38382
|
+
function officeUnit(a) {
|
|
38383
|
+
const action = String(a.action || "").toLowerCase();
|
|
38384
|
+
if (OFFICE_READ_ACTIONS.has(action)) {
|
|
38385
|
+
return unitDescriptor("Office", { count: 1, active: "Reading", done: "Read", noun: "document action" });
|
|
38386
|
+
}
|
|
38387
|
+
const [active, done] = OFFICE_ACTION_VERBS.get(action) || ["Editing", "Edited"];
|
|
38388
|
+
return unitDescriptor("Office", { count: 1, active, done, noun: "document action", effect: true });
|
|
38389
|
+
}
|
|
38390
|
+
function terminalUnit(a) {
|
|
38391
|
+
return String(a.action || "").toLowerCase() === "list" ? unitDescriptor("Terminal", { count: 1, active: "Listing", done: "Listed", noun: "terminal tab" }) : unitDescriptor("Terminal", { count: 1, active: "Reading", done: "Read", noun: "terminal output" });
|
|
38392
|
+
}
|
|
38393
|
+
var GITHUB_VERBS = /* @__PURE__ */ new Map([
|
|
38394
|
+
["list", ["Listing", "Listed"]],
|
|
38395
|
+
["view", ["Viewing", "Viewed"]],
|
|
38396
|
+
["comments", ["Reading", "Read"]],
|
|
38397
|
+
["logs", ["Reading", "Read"]],
|
|
38398
|
+
["create", ["Creating", "Created"]],
|
|
38399
|
+
["edit", ["Editing", "Edited"]],
|
|
38400
|
+
["close", ["Closing", "Closed"]],
|
|
38401
|
+
["reopen", ["Reopening", "Reopened"]],
|
|
38402
|
+
["comment", ["Commenting on", "Commented on"]],
|
|
38403
|
+
["merge", ["Merging", "Merged"]],
|
|
38404
|
+
["review", ["Reviewing", "Reviewed"]],
|
|
38405
|
+
["checkout", ["Checking out", "Checked out"]],
|
|
38406
|
+
["clone", ["Cloning", "Cloned"]],
|
|
38407
|
+
["fork", ["Forking", "Forked"]],
|
|
38408
|
+
["run", ["Running", "Ran"]],
|
|
38409
|
+
["rerun", ["Rerunning", "Reran"]],
|
|
38410
|
+
["cancel", ["Cancelling", "Cancelled"]],
|
|
38411
|
+
["read", ["Marking read", "Marked read"]]
|
|
38412
|
+
]);
|
|
38413
|
+
var GITHUB_READ_VERBS = /* @__PURE__ */ new Set(["list", "view", "comments", "logs"]);
|
|
38414
|
+
function githubActionParts(action) {
|
|
38415
|
+
const [noun = "", verb = ""] = String(action || "").toLowerCase().split(".");
|
|
38416
|
+
return { noun, verb };
|
|
38417
|
+
}
|
|
38418
|
+
function githubUnit(a) {
|
|
38419
|
+
const { noun, verb } = githubActionParts(a.action);
|
|
38420
|
+
const [active, done] = GITHUB_VERBS.get(verb) || ["Running", "Ran"];
|
|
38421
|
+
if (!noun || !GITHUB_VERBS.has(verb)) {
|
|
38422
|
+
return unitDescriptor("Git", { count: 1, noun: "GitHub operation" });
|
|
38423
|
+
}
|
|
38424
|
+
const label = noun === "pr" ? "PR" : noun;
|
|
38425
|
+
return unitDescriptor("Git", {
|
|
38426
|
+
count: 1,
|
|
38427
|
+
active,
|
|
38428
|
+
done,
|
|
38429
|
+
noun: label,
|
|
38430
|
+
effect: !GITHUB_READ_VERBS.has(verb)
|
|
38431
|
+
});
|
|
38432
|
+
}
|
|
38433
|
+
function goalUnit(a) {
|
|
38434
|
+
const action = String(a.action || "").toLowerCase();
|
|
38435
|
+
const verbs = {
|
|
38436
|
+
status: ["Checking", "Checked"],
|
|
38437
|
+
create: ["Creating", "Created"],
|
|
38438
|
+
pause: ["Pausing", "Paused"],
|
|
38439
|
+
resume: ["Resuming", "Resumed"],
|
|
38440
|
+
set_tasks: ["Planning", "Planned"],
|
|
38441
|
+
update_tasks: ["Updating", "Updated"],
|
|
38442
|
+
complete: ["Completing", "Completed"],
|
|
38443
|
+
block: ["Blocking", "Blocked"],
|
|
38444
|
+
abandon: ["Abandoning", "Abandoned"]
|
|
38445
|
+
}[action] || ["Updating", "Updated"];
|
|
38446
|
+
return unitDescriptor("Setup", {
|
|
38447
|
+
count: 1,
|
|
38448
|
+
active: verbs[0],
|
|
38449
|
+
done: verbs[1],
|
|
38450
|
+
noun: "goal",
|
|
38451
|
+
effect: action !== "status"
|
|
38452
|
+
});
|
|
38453
|
+
}
|
|
38454
|
+
var SETUP_VERB_PREFIXES = [
|
|
38455
|
+
[/^status$/, ["Checking", "Checked", false]],
|
|
38456
|
+
[/^open$/, ["Opening", "Opened", false]],
|
|
38457
|
+
[/^(?:search|inspect|local_model_details)/, ["Inspecting", "Inspected", false]],
|
|
38458
|
+
[/^(?:install|start)_/, ["Installing", "Installed", true]],
|
|
38459
|
+
[/^(?:add|register|save)_/, ["Adding", "Added", true]],
|
|
38460
|
+
[/^(?:remove|delete|forget)_/, ["Removing", "Removed", true]],
|
|
38461
|
+
[/^cancel_/, ["Cancelling", "Cancelled", true]],
|
|
38462
|
+
[/^(?:reconnect|enable|maintain|update)_/, ["Updating", "Updated", true]]
|
|
38463
|
+
];
|
|
38464
|
+
function setupUnit(a) {
|
|
38465
|
+
const action = String(a.action || "").toLowerCase();
|
|
38466
|
+
const match = SETUP_VERB_PREFIXES.find(([re]) => re.test(action));
|
|
38467
|
+
const [active, done, effect] = match ? match[1] : ["Changing", "Changed", true];
|
|
38468
|
+
return unitDescriptor("Setup", { count: 1, active, done, noun: "setting", effect });
|
|
38182
38469
|
}
|
|
38183
38470
|
function fetchUnit(a) {
|
|
38184
38471
|
const fetchLimit = Number(a.limit ?? a.messages);
|
|
@@ -38192,7 +38479,7 @@ function fetchUnit(a) {
|
|
|
38192
38479
|
}
|
|
38193
38480
|
function memoryReadUnit(a) {
|
|
38194
38481
|
return unitDescriptor("Memory", {
|
|
38195
|
-
count: queryCount(a, "query", "queries", "text", "input") || 1,
|
|
38482
|
+
count: queryCount(a, "query", "queries", "text", "input", "id") || 1,
|
|
38196
38483
|
noun: "memory item",
|
|
38197
38484
|
pluralNoun: "memory items"
|
|
38198
38485
|
});
|
|
@@ -38202,17 +38489,26 @@ function memoryWriteUnit(a) {
|
|
|
38202
38489
|
count: queryCount(a, "entries", "items", "memories", "query", "text", "value") || 1,
|
|
38203
38490
|
active: "Writing",
|
|
38204
38491
|
done: "Wrote",
|
|
38205
|
-
noun: "memory item"
|
|
38492
|
+
noun: "memory item",
|
|
38493
|
+
effect: true
|
|
38206
38494
|
});
|
|
38207
38495
|
}
|
|
38208
38496
|
function memoryToolUnit(a) {
|
|
38209
|
-
const op = String(a.op || "").toLowerCase();
|
|
38210
|
-
|
|
38211
|
-
|
|
38497
|
+
const op = String(a.op || a.action || "").toLowerCase();
|
|
38498
|
+
if (op === "delete") {
|
|
38499
|
+
return unitDescriptor("Memory", {
|
|
38500
|
+
count: queryCount(a, "id", "ids") || 1,
|
|
38501
|
+
active: "Deleting",
|
|
38502
|
+
done: "Deleted",
|
|
38503
|
+
noun: "memory item",
|
|
38504
|
+
effect: true
|
|
38505
|
+
});
|
|
38506
|
+
}
|
|
38507
|
+
if (op === "add" || op === "edit") return memoryWriteUnit(a);
|
|
38212
38508
|
return unitDescriptor("Memory", {
|
|
38213
38509
|
count: queryCount(a, "entries", "items", "memories", "query", "text", "value") || 1,
|
|
38214
|
-
active: "Checking",
|
|
38215
|
-
done: "Checked",
|
|
38510
|
+
active: op === "list" ? "Listing" : "Checking",
|
|
38511
|
+
done: op === "list" ? "Listed" : "Checked",
|
|
38216
38512
|
noun: "memory item"
|
|
38217
38513
|
});
|
|
38218
38514
|
}
|
|
@@ -38232,6 +38528,9 @@ function agentUnit(a) {
|
|
|
38232
38528
|
}
|
|
38233
38529
|
return unitDescriptor("Agent", { count, active: "Finishing", done: "Completed", noun: "agent" });
|
|
38234
38530
|
}
|
|
38531
|
+
if (/^(?:status|read|list)$/.test(type)) {
|
|
38532
|
+
return unitDescriptor("Agent", { count, active: "Checking", done: "Checked", noun: "agent" });
|
|
38533
|
+
}
|
|
38235
38534
|
return unitDescriptor("Agent", { count, noun: "agent" });
|
|
38236
38535
|
}
|
|
38237
38536
|
function taskUnit(a) {
|
|
@@ -38248,7 +38547,8 @@ function taskUnit(a) {
|
|
|
38248
38547
|
function skillUnit(a) {
|
|
38249
38548
|
return unitDescriptor("Skill", {
|
|
38250
38549
|
count: queryCount(a, "name", "skill", "skill_name", "query", "q") || 1,
|
|
38251
|
-
noun: "skill"
|
|
38550
|
+
noun: "skill",
|
|
38551
|
+
effect: true
|
|
38252
38552
|
});
|
|
38253
38553
|
}
|
|
38254
38554
|
function codeGraphUnit(a) {
|
|
@@ -38270,13 +38570,24 @@ function gitStageUnit(a) {
|
|
|
38270
38570
|
count: queryCount(a, "change_ids", "change_id") || 1,
|
|
38271
38571
|
active: "Staging",
|
|
38272
38572
|
done: "Staged",
|
|
38273
|
-
noun: "change"
|
|
38573
|
+
noun: "change",
|
|
38574
|
+
effect: true
|
|
38274
38575
|
});
|
|
38275
38576
|
}
|
|
38276
38577
|
function cwdUnit(a) {
|
|
38277
38578
|
const action = String(a.action || a.type || "").toLowerCase();
|
|
38278
|
-
|
|
38279
|
-
|
|
38579
|
+
if (action === "set" || !action && a.path) {
|
|
38580
|
+
return unitDescriptor("Setup", {
|
|
38581
|
+
active: "Selecting",
|
|
38582
|
+
done: "Selected",
|
|
38583
|
+
noun: "project",
|
|
38584
|
+
effect: true
|
|
38585
|
+
});
|
|
38586
|
+
}
|
|
38587
|
+
if (action === "list") {
|
|
38588
|
+
return unitDescriptor("Setup", { active: "Listing", done: "Listed", noun: "project" });
|
|
38589
|
+
}
|
|
38590
|
+
return unitDescriptor("Setup", { active: "Checking", done: "Checked", noun: "working directory", pluralNoun: "working directories" });
|
|
38280
38591
|
}
|
|
38281
38592
|
var TOOL_UNITS = /* @__PURE__ */ new Map([
|
|
38282
38593
|
[
|
|
@@ -38340,7 +38651,10 @@ var TOOL_UNITS = /* @__PURE__ */ new Map([
|
|
|
38340
38651
|
["browser", browserUnit],
|
|
38341
38652
|
["browser_devtools", browserUnit],
|
|
38342
38653
|
["computer", () => unitDescriptor("Computer", { count: 1, active: "Operating", done: "Operated", noun: "action" })],
|
|
38343
|
-
["
|
|
38654
|
+
["terminal", terminalUnit],
|
|
38655
|
+
["office", officeUnit],
|
|
38656
|
+
["goal", goalUnit],
|
|
38657
|
+
["setup", setupUnit],
|
|
38344
38658
|
["media", mediaUnit],
|
|
38345
38659
|
["tidy", tidyUnit],
|
|
38346
38660
|
["fetch", fetchUnit],
|
|
@@ -38360,7 +38674,7 @@ var TOOL_UNITS = /* @__PURE__ */ new Map([
|
|
|
38360
38674
|
"git",
|
|
38361
38675
|
(a) => a.action === "stage" ? gitStageUnit(a) : unitDescriptor("Git", { count: queryCount(a, "command", "commands") || 1, noun: "Git command" })
|
|
38362
38676
|
],
|
|
38363
|
-
["github",
|
|
38677
|
+
["github", githubUnit],
|
|
38364
38678
|
// Preserve the staging work unit when rendering historical transcripts.
|
|
38365
38679
|
["git_stage", gitStageUnit],
|
|
38366
38680
|
["agent", agentUnit],
|
|
@@ -38448,6 +38762,8 @@ function displayToolName(name, args = {}) {
|
|
|
38448
38762
|
return "Browser";
|
|
38449
38763
|
case "computer":
|
|
38450
38764
|
return "Computer";
|
|
38765
|
+
case "terminal":
|
|
38766
|
+
return "Terminal";
|
|
38451
38767
|
case "office":
|
|
38452
38768
|
return "Office";
|
|
38453
38769
|
case "media":
|
|
@@ -38535,6 +38851,13 @@ function summarizeToolArgs(name, args, { max = DEFAULT_SUMMARY_MAX } = {}) {
|
|
|
38535
38851
|
return truncateCommand(a.description || a.command || a.cmd || "", max);
|
|
38536
38852
|
case "task":
|
|
38537
38853
|
return compactParts([a.action || a.type || "task", a.task_id || ""]);
|
|
38854
|
+
case "git":
|
|
38855
|
+
if (a.action === "stage") return formatCountedUnit(collectionCount(a.change_ids, a.change_id), "change");
|
|
38856
|
+
return genericArgsSummary(a, max);
|
|
38857
|
+
case "github":
|
|
38858
|
+
return summarizeGithub(a, max);
|
|
38859
|
+
case "goal":
|
|
38860
|
+
return compactParts([String(a.action || ""), truncateToolText(a.objective, max)]);
|
|
38538
38861
|
case "list":
|
|
38539
38862
|
case "ls":
|
|
38540
38863
|
if (Array.isArray(a.path) || Array.isArray(a.dir) || Array.isArray(a.cwd)) {
|
|
@@ -38591,7 +38914,10 @@ function summarizeToolArgs(name, args, { max = DEFAULT_SUMMARY_MAX } = {}) {
|
|
|
38591
38914
|
case "browser":
|
|
38592
38915
|
case "browser_devtools": {
|
|
38593
38916
|
const call = bridgeToolCall(args);
|
|
38594
|
-
|
|
38917
|
+
const { input } = call;
|
|
38918
|
+
const action = input.operation ? [call.action, input.operation].filter(Boolean).join(" ") : call.action;
|
|
38919
|
+
const tab2 = input.tab != null && String(input.tab).trim() ? ` (tab ${String(input.tab).trim()})` : "";
|
|
38920
|
+
return `${compactParts([action, pathOrId(input.url, input.ref ?? input.selector, max)])}${tab2}`.trim();
|
|
38595
38921
|
}
|
|
38596
38922
|
case "computer": {
|
|
38597
38923
|
const call = bridgeToolCall(args);
|
|
@@ -38603,6 +38929,8 @@ function summarizeToolArgs(name, args, { max = DEFAULT_SUMMARY_MAX } = {}) {
|
|
|
38603
38929
|
)
|
|
38604
38930
|
]);
|
|
38605
38931
|
}
|
|
38932
|
+
case "terminal":
|
|
38933
|
+
return compactParts([String(a.action || ""), a.tab ? `tab ${a.tab}` : ""]);
|
|
38606
38934
|
case "office":
|
|
38607
38935
|
return compactParts([String(a.action || ""), pathOrId(a.path, a.session, max)]);
|
|
38608
38936
|
case "media":
|
|
@@ -38620,11 +38948,28 @@ function summarizeToolArgs(name, args, { max = DEFAULT_SUMMARY_MAX } = {}) {
|
|
|
38620
38948
|
case "list_mcp_resource_templates":
|
|
38621
38949
|
return a.server ? `server "${truncateToolText(a.server, max)}"` : "all servers";
|
|
38622
38950
|
case "cwd":
|
|
38623
|
-
return truncateToolText(firstText(a.path, a.cwd, a.dir), max);
|
|
38951
|
+
return compactParts([String(a.action || a.type || ""), truncateToolText(firstText(a.path, a.cwd, a.dir), max)]);
|
|
38624
38952
|
case "setup":
|
|
38625
38953
|
return compactParts([
|
|
38626
38954
|
String(a.action || ""),
|
|
38627
|
-
truncateToolText(
|
|
38955
|
+
truncateToolText(
|
|
38956
|
+
firstText(
|
|
38957
|
+
a.domain,
|
|
38958
|
+
a.target,
|
|
38959
|
+
a.name,
|
|
38960
|
+
a.server?.name,
|
|
38961
|
+
a.modelId,
|
|
38962
|
+
a.workflow,
|
|
38963
|
+
a.style,
|
|
38964
|
+
a.profile,
|
|
38965
|
+
a.source,
|
|
38966
|
+
a.query,
|
|
38967
|
+
a.repository,
|
|
38968
|
+
a.jobId,
|
|
38969
|
+
a.agent
|
|
38970
|
+
),
|
|
38971
|
+
max
|
|
38972
|
+
)
|
|
38628
38973
|
]);
|
|
38629
38974
|
case "memory":
|
|
38630
38975
|
case "remember":
|
|
@@ -38636,11 +38981,17 @@ function summarizeToolArgs(name, args, { max = DEFAULT_SUMMARY_MAX } = {}) {
|
|
|
38636
38981
|
truncateToolText(firstText(a.query, a.summary, a.element, a.key, a.name, a.text, a.value), Math.min(max, 80))
|
|
38637
38982
|
]);
|
|
38638
38983
|
case "recall":
|
|
38639
|
-
case "search_memories":
|
|
38984
|
+
case "search_memories": {
|
|
38985
|
+
const ids = (Array.isArray(a.id) ? a.id : [a.id]).filter((id) => id != null && id !== "");
|
|
38986
|
+
const queries = (Array.isArray(a.query) ? a.query : [a.query ?? a.text ?? a.input]).filter(
|
|
38987
|
+
(query) => query != null && String(query).trim()
|
|
38988
|
+
);
|
|
38640
38989
|
return compactParts([
|
|
38641
|
-
|
|
38990
|
+
ids.length ? ids.map((id) => `#${id}`).join(", ") : "",
|
|
38991
|
+
queries.length > 1 ? formatCountedUnit(queries.length, "query", "queries") : quoted(queries[0], max),
|
|
38642
38992
|
a.limit || a.topK ? `top ${a.limit ?? a.topK}` : ""
|
|
38643
38993
|
]);
|
|
38994
|
+
}
|
|
38644
38995
|
case "bridge":
|
|
38645
38996
|
case "agent": {
|
|
38646
38997
|
const agentModel = bridgeAgentModelSummary(a);
|
|
@@ -38660,25 +39011,45 @@ function summarizeToolArgs(name, args, { max = DEFAULT_SUMMARY_MAX } = {}) {
|
|
|
38660
39011
|
firstText(a.name, a.skill, a.skill_name, a.query, a.q, normalized === "skills_list" ? "all skills" : ""),
|
|
38661
39012
|
max
|
|
38662
39013
|
);
|
|
38663
|
-
default:
|
|
38664
|
-
|
|
38665
|
-
|
|
38666
|
-
|
|
38667
|
-
|
|
38668
|
-
|
|
38669
|
-
|
|
38670
|
-
|
|
38671
|
-
|
|
38672
|
-
|
|
38673
|
-
|
|
38674
|
-
|
|
38675
|
-
|
|
39014
|
+
default:
|
|
39015
|
+
return genericArgsSummary(a, max);
|
|
39016
|
+
}
|
|
39017
|
+
}
|
|
39018
|
+
function genericArgsSummary(a, max) {
|
|
39019
|
+
const primary = firstText(a.name, a.skill, a.query, a.title, a.path, a.file, a.target, a.id, a.action);
|
|
39020
|
+
if (primary) return truncateToolText(primary, Math.min(max, 80));
|
|
39021
|
+
const keys = Object.keys(a).slice(0, 2);
|
|
39022
|
+
const pairs = keys.map((key) => {
|
|
39023
|
+
const value = a[key];
|
|
39024
|
+
if (value == null || typeof value === "object") return "";
|
|
39025
|
+
const text = truncateToolText(value, 40);
|
|
39026
|
+
return text ? `${key}=${text}` : "";
|
|
39027
|
+
}).filter(Boolean);
|
|
39028
|
+
return compactParts(pairs);
|
|
39029
|
+
}
|
|
39030
|
+
var GITHUB_PHRASES = /* @__PURE__ */ new Map([
|
|
39031
|
+
["comments", (noun) => `Read ${noun} comments`],
|
|
39032
|
+
["logs", (noun) => `Read ${noun} logs`],
|
|
39033
|
+
["comment", (noun) => `Comment on ${noun}`],
|
|
39034
|
+
["read", (noun) => `Mark ${noun} read`]
|
|
39035
|
+
]);
|
|
39036
|
+
function summarizeGithub(a, max) {
|
|
39037
|
+
const { noun, verb } = githubActionParts(a.action);
|
|
39038
|
+
if (!noun || !verb) return truncateToolText(firstText(a.action, a.repo), max);
|
|
39039
|
+
const object = noun === "pr" ? "PR" : noun;
|
|
39040
|
+
const phrase = GITHUB_PHRASES.get(verb)?.(object) ?? `${titleWord(verb)} ${object}`;
|
|
39041
|
+
const repo = firstText(a.repo);
|
|
39042
|
+
const id = a.number ?? a.id;
|
|
39043
|
+
const hasId = id != null && String(id).trim() !== "";
|
|
39044
|
+
const title = truncateToolText(firstText(a.title, a.workflow, a.tag), Math.min(max, 60));
|
|
39045
|
+
return hasId ? compactParts([`${phrase} ${String(id).trim()}`, repo, title]) : compactParts([repo ? `${phrase} ${repo}` : phrase, title]);
|
|
38676
39046
|
}
|
|
38677
39047
|
function formatToolSurface(name, args, opts = {}) {
|
|
38678
39048
|
const parsed = parseToolArgs(args);
|
|
38679
39049
|
return {
|
|
38680
39050
|
label: displayToolName(name, parsed),
|
|
38681
|
-
|
|
39051
|
+
// The raw args: bridge tools keep their action beside the nested `input`.
|
|
39052
|
+
summary: summarizeToolArgs(name, args, opts),
|
|
38682
39053
|
normalizedName: normalizeToolName(name),
|
|
38683
39054
|
args: parsed
|
|
38684
39055
|
};
|
|
@@ -38710,15 +39081,17 @@ function lifecycleVerb(unit, pending, { stableVerbWidth = false } = {}) {
|
|
|
38710
39081
|
if (!stableVerbWidth) return verb;
|
|
38711
39082
|
return verb.padEnd(Math.max(active.length, done.length), " ");
|
|
38712
39083
|
}
|
|
38713
|
-
function formatToolActionHeader(name, args = {}, { pending = false, count = 1, category = "", stableVerbWidth = false } = {}) {
|
|
39084
|
+
function formatToolActionHeader(name, args = {}, { pending = false, count = 1, category = "", stableVerbWidth = false, failed = false } = {}) {
|
|
38714
39085
|
const loadingTargets = toolLoadingTargets(name, args);
|
|
38715
39086
|
if (loadingTargets.length) {
|
|
39087
|
+
if (failed && !pending) return `Failed while loading ${loadingTargets.join(", ")}`;
|
|
38716
39088
|
return `${pending ? "Loading" : "Loaded"} ${loadingTargets.join(", ")}`;
|
|
38717
39089
|
}
|
|
38718
39090
|
const unit = toolWorkUnit(name, args, category);
|
|
38719
39091
|
const n = Math.max(1, Number(unit.count || count || 1));
|
|
38720
|
-
const
|
|
38721
|
-
return
|
|
39092
|
+
const object = `${n} ${pluralize(n, unit.noun, unit.pluralNoun)}`;
|
|
39093
|
+
if (failed && !pending && unit.effect) return `Failed while ${String(unit.active).toLowerCase()} ${object}`;
|
|
39094
|
+
return `${lifecycleVerb(unit, pending, { stableVerbWidth })} ${object}`;
|
|
38722
39095
|
}
|
|
38723
39096
|
function aggregateCount(value) {
|
|
38724
39097
|
if (value && typeof value === "object") return Math.max(0, Number(value.count || 0));
|
|
@@ -38735,7 +39108,8 @@ function aggregateDescriptor(key, value) {
|
|
|
38735
39108
|
done: value.done || copy2.done,
|
|
38736
39109
|
noun: noun2,
|
|
38737
39110
|
pluralNoun: value.pluralNoun || copy2.pluralNoun || `${noun2}s`,
|
|
38738
|
-
count: aggregateCount(value)
|
|
39111
|
+
count: aggregateCount(value),
|
|
39112
|
+
effect: value.effect === true
|
|
38739
39113
|
};
|
|
38740
39114
|
}
|
|
38741
39115
|
const category = String(key || "");
|
|
@@ -38750,7 +39124,7 @@ function aggregateDescriptor(key, value) {
|
|
|
38750
39124
|
count: aggregateCount(value)
|
|
38751
39125
|
};
|
|
38752
39126
|
}
|
|
38753
|
-
function formatAggregateHeader(categories, { pending = false, order = null, stableVerbWidth = false } = {}) {
|
|
39127
|
+
function formatAggregateHeader(categories, { pending = false, order = null, stableVerbWidth = false, failed = false } = {}) {
|
|
38754
39128
|
const categoryKeys = Object.keys(categories || {});
|
|
38755
39129
|
const preferred = Array.isArray(order) && order.length ? order : categoryKeys;
|
|
38756
39130
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -38765,8 +39139,9 @@ function formatAggregateHeader(categories, { pending = false, order = null, stab
|
|
|
38765
39139
|
for (const cat of Object.keys(categories || {})) add(cat);
|
|
38766
39140
|
return ordered.map((cat) => {
|
|
38767
39141
|
const item = aggregateDescriptor(cat, categories[cat]);
|
|
38768
|
-
const
|
|
38769
|
-
|
|
39142
|
+
const object = `${item.count} ${pluralize(item.count, item.noun, item.pluralNoun)}`;
|
|
39143
|
+
if (failed && !pending && item.effect) return `Failed while ${String(item.active).toLowerCase()} ${object}`;
|
|
39144
|
+
return `${lifecycleVerb(item, pending, { stableVerbWidth })} ${object}`;
|
|
38770
39145
|
}).join(", ");
|
|
38771
39146
|
}
|
|
38772
39147
|
function pathOrId(path2, id, max) {
|
|
@@ -39340,15 +39715,23 @@ function unwrap(value) {
|
|
|
39340
39715
|
const code = String(nested?.code || nested?.type || envelope?.code || "");
|
|
39341
39716
|
return { raw, message, status, code };
|
|
39342
39717
|
}
|
|
39718
|
+
function isRejected429(value) {
|
|
39719
|
+
return /\bAPI 429 request rejected\b/.test(messageOf2(value));
|
|
39720
|
+
}
|
|
39343
39721
|
function describeError(value) {
|
|
39344
39722
|
const { raw, message, status, code } = unwrap(value);
|
|
39723
|
+
const rejected429 = isRejected429(value);
|
|
39345
39724
|
const details = safeErrorDetails(raw);
|
|
39346
39725
|
const clean2 = safeErrorDetails(message).replace(/^(?:Error invoking remote method ['"][^'"]+['"]:\s*)?(?:Error:\s*)?/i, "").trim();
|
|
39347
39726
|
let kind = "unknown";
|
|
39348
39727
|
let summary = "";
|
|
39349
39728
|
let recovery = "";
|
|
39350
39729
|
const transport = transportErrorText(value) || transportErrorText(raw);
|
|
39351
|
-
if (
|
|
39730
|
+
if (value?.reauthRequired === true || /invalid_grant|refresh token (?:expired|revoked|not available)|sign in again|sign-in expired|Reauth Required/i.test(raw)) {
|
|
39731
|
+
kind = "reauth";
|
|
39732
|
+
summary = "Sign-in expired.";
|
|
39733
|
+
recovery = "Sign in again from Providers.";
|
|
39734
|
+
} else if (status === 401 || status === 403 || /\b(?:invalid|expired)\s+(?:api[ _-]?key|access token|credentials?)\b|Provider authentication failed/i.test(clean2)) {
|
|
39352
39735
|
kind = "authentication";
|
|
39353
39736
|
summary = "Provider authentication failed";
|
|
39354
39737
|
recovery = "Check your sign-in or API key, then try again.";
|
|
@@ -39362,7 +39745,7 @@ function describeError(value) {
|
|
|
39362
39745
|
kind = "payload-size";
|
|
39363
39746
|
summary = "The request exceeds the size limit.";
|
|
39364
39747
|
recovery = "Reduce the attachments or request size, then try again.";
|
|
39365
|
-
} else if (status === 429 || /rate[_ -]?limit|quota.*(?:hit|exceed)|too many requests|The provider usage limit was reached/i.test(clean2)) {
|
|
39748
|
+
} else if (!rejected429 && (status === 429 || /rate[_ -]?limit|quota.*(?:hit|exceed)|too many requests|The provider usage limit was reached/i.test(clean2))) {
|
|
39366
39749
|
kind = "rate-limit";
|
|
39367
39750
|
summary = "The provider usage limit was reached.";
|
|
39368
39751
|
recovery = "Wait for the limit to reset or choose another account.";
|
|
@@ -39370,7 +39753,7 @@ function describeError(value) {
|
|
|
39370
39753
|
kind = "connection";
|
|
39371
39754
|
summary = transport.replace(/\.$/, "");
|
|
39372
39755
|
recovery = "Check the connection, then try again.";
|
|
39373
|
-
} else if (status === 400 || status === 422 || code === "invalid_request_error" || clean2 === "The provider rejected this request.") {
|
|
39756
|
+
} else if (rejected429 || status === 400 || status === 422 || code === "invalid_request_error" || clean2 === "The provider rejected this request.") {
|
|
39374
39757
|
kind = "request";
|
|
39375
39758
|
summary = "The provider rejected this request.";
|
|
39376
39759
|
recovery = "Review the request details before trying again.";
|
|
@@ -39388,7 +39771,7 @@ function describeError(value) {
|
|
|
39388
39771
|
details,
|
|
39389
39772
|
// Known structured failures ignore volatile indexes; unknown failures
|
|
39390
39773
|
// retain their diagnostic identity rather than merging unrelated work.
|
|
39391
|
-
fingerprint: kind === "unknown" ? details : `${kind}:${status || ""}`
|
|
39774
|
+
fingerprint: kind === "unknown" ? details : `${kind}:${kind === "reauth" ? "" : status || ""}`
|
|
39392
39775
|
};
|
|
39393
39776
|
}
|
|
39394
39777
|
|
|
@@ -39771,6 +40154,12 @@ function displayTerminalStatus(value) {
|
|
|
39771
40154
|
function resultTerminalStatus(value) {
|
|
39772
40155
|
return toolResultTerminalStatus(value);
|
|
39773
40156
|
}
|
|
40157
|
+
function resultEnvelopeStatus(value) {
|
|
40158
|
+
return toolResultEnvelopeStatus(value);
|
|
40159
|
+
}
|
|
40160
|
+
function resultControlStatus(value) {
|
|
40161
|
+
return toolResultControlStatus(value);
|
|
40162
|
+
}
|
|
39774
40163
|
var LEADING_STATUS_MARKER_LINE_RE = /^\[status:\s*[^\]]*\]\s*$/i;
|
|
39775
40164
|
function stripLeadingStatusMarkerLines(lines) {
|
|
39776
40165
|
const out = Array.isArray(lines) ? lines.slice() : [];
|
|
@@ -39805,6 +40194,7 @@ function mergeTerminalDetail(status, detail = "") {
|
|
|
39805
40194
|
if (label === "Finished" && text) return text;
|
|
39806
40195
|
if (!text) return label;
|
|
39807
40196
|
if (text.toLowerCase().startsWith(label.toLowerCase())) return text;
|
|
40197
|
+
if (label === "Running" && /^queued\b/i.test(text)) return text;
|
|
39808
40198
|
if (BARE_STATUS_WORDS.has(text.toLowerCase())) return label;
|
|
39809
40199
|
return `${label} \xB7 ${text}`;
|
|
39810
40200
|
}
|
|
@@ -39902,7 +40292,11 @@ function aggregateLabel(base) {
|
|
|
39902
40292
|
const loadingVerb = headerPending ? "Loading" : "Loaded";
|
|
39903
40293
|
const headerCategories = (headerPending ? displayCategories : displayDone) || {};
|
|
39904
40294
|
return safeInlineText(
|
|
39905
|
-
loadingTargets.length ? `${loadingVerb} ${loadingTargets.join(", ")}` : formatAggregateHeader(headerCategories, {
|
|
40295
|
+
loadingTargets.length ? `${loadingVerb} ${loadingTargets.join(", ")}` : formatAggregateHeader(headerCategories, {
|
|
40296
|
+
pending: headerPending,
|
|
40297
|
+
order: headerOrder,
|
|
40298
|
+
failed: base.failedCount > 0 && base.failedCount >= base.groupCount
|
|
40299
|
+
})
|
|
39906
40300
|
);
|
|
39907
40301
|
}
|
|
39908
40302
|
function deriveAggregateCardModel(base) {
|
|
@@ -39916,7 +40310,7 @@ function deriveAggregateCardModel(base) {
|
|
|
39916
40310
|
labelText: aggregateLabel(base),
|
|
39917
40311
|
summaryText: "",
|
|
39918
40312
|
headerFailureText: "",
|
|
39919
|
-
detailLine: detailText || (pending ? "Running" : "Finished"),
|
|
40313
|
+
detailLine: detailText || (pending ? "Running" : displayTerminalStatus(terminalStatus) || "Finished"),
|
|
39920
40314
|
detailIsPlaceholder: !detailText,
|
|
39921
40315
|
displayedResultBodyText: rt || "",
|
|
39922
40316
|
firstResultLine: detailText,
|
|
@@ -39986,8 +40380,12 @@ function titleizeAgentName(value) {
|
|
|
39986
40380
|
if (AGENT_DISPLAY_NAMES2.has(key)) return AGENT_DISPLAY_NAMES2.get(key);
|
|
39987
40381
|
return text.replace(/[_-]+/g, " ").split(/\s+/).filter(Boolean).map(titleWord).join(" ");
|
|
39988
40382
|
}
|
|
39989
|
-
function
|
|
39990
|
-
|
|
40383
|
+
function agentNameFromResult(resultText) {
|
|
40384
|
+
const line = /^agent:\s*(\S.*)$/im.exec(leadingResultBlock(resultText));
|
|
40385
|
+
return line ? titleizeAgentName(line[1]) : "";
|
|
40386
|
+
}
|
|
40387
|
+
function agentDisplayName(args, resultText = "") {
|
|
40388
|
+
return titleizeAgentName(args?.agent || args?.subagent_type || args?.name || "") || agentNameFromResult(resultText);
|
|
39991
40389
|
}
|
|
39992
40390
|
function agentModelLabel(args) {
|
|
39993
40391
|
const a = args && typeof args === "object" ? args : {};
|
|
@@ -40008,10 +40406,10 @@ function withModelAndTag(label, args) {
|
|
|
40008
40406
|
function joinActionAgent(action, agent) {
|
|
40009
40407
|
return agent ? `${action} ${agent}` : action;
|
|
40010
40408
|
}
|
|
40011
|
-
function agentResponseTitle(args, count = 1) {
|
|
40409
|
+
function agentResponseTitle(args, count = 1, resultText = "") {
|
|
40012
40410
|
const total = Math.max(1, Number(count) || 1);
|
|
40013
40411
|
if (total > 1) return `Responses ${total} agents`;
|
|
40014
|
-
const name = agentDisplayName(args) || "Agent";
|
|
40412
|
+
const name = agentDisplayName(args, resultText) || "Agent";
|
|
40015
40413
|
return withModelAndTag(joinActionAgent("Response", name), args);
|
|
40016
40414
|
}
|
|
40017
40415
|
var AGENT_ACTION_VERBS = /* @__PURE__ */ new Map([
|
|
@@ -40020,11 +40418,15 @@ var AGENT_ACTION_VERBS = /* @__PURE__ */ new Map([
|
|
|
40020
40418
|
["cancel", "Cancel"],
|
|
40021
40419
|
["close", "Close"],
|
|
40022
40420
|
["cleanup", "Cleanup"],
|
|
40023
|
-
["read", "
|
|
40421
|
+
["read", "Read"],
|
|
40024
40422
|
["status", "Status"]
|
|
40025
40423
|
]);
|
|
40026
|
-
function
|
|
40027
|
-
|
|
40424
|
+
function isAgentResponseResult(args, resultText) {
|
|
40425
|
+
if (String(args?.type || args?.action || "").toLowerCase() === "result") return true;
|
|
40426
|
+
return Boolean(parseTaskNotification(String(resultText || "").trim()));
|
|
40427
|
+
}
|
|
40428
|
+
function agentActionTitle(args, resultText = "") {
|
|
40429
|
+
const name = agentDisplayName(args, resultText);
|
|
40028
40430
|
const action = String(args?.type || args?.action || "spawn").toLowerCase();
|
|
40029
40431
|
if (action === "list") return "Agent status";
|
|
40030
40432
|
const verb = AGENT_ACTION_VERBS.get(action);
|
|
@@ -40035,48 +40437,16 @@ function agentActionSummary(args, summary) {
|
|
|
40035
40437
|
if (!text) return "";
|
|
40036
40438
|
const name = agentDisplayName(args);
|
|
40037
40439
|
if (name && text === name) return "";
|
|
40038
|
-
|
|
40440
|
+
let rest = name && text.startsWith(`${name} \xB7 `) ? text.slice(name.length + 3).trim() : text;
|
|
40441
|
+
const action = String(args?.type || args?.action || "").trim();
|
|
40442
|
+
if (action && rest === action) return "";
|
|
40443
|
+
if (action && rest.startsWith(`${action} \xB7 `)) rest = rest.slice(action.length + 3).trim();
|
|
40039
40444
|
const model = agentModelLabel(args);
|
|
40040
40445
|
if (model && rest === model) return "";
|
|
40041
40446
|
const tag = agentTagLabel(args);
|
|
40042
40447
|
if (tag && rest === tag) return "";
|
|
40043
40448
|
return rest;
|
|
40044
40449
|
}
|
|
40045
|
-
var BRIDGE_ENVELOPE_TAG_RE = /^<\/?(?:final-answer|task-id|tool-use-id|output-file|result|status|summary|usage|total_tokens|tool_uses|duration_ms|worktree|worktreePath|worktreeBranch)[^>]*>$/i;
|
|
40046
|
-
var BRIDGE_ENVELOPE_HEAD_FIELD_RE = /^(?:agent task|background task|agent message queued\b|agent close:|task_id|surface|operation|label|status|type|target|agent|preset|model|effort|fast|limits|started|finished|error|notification|queueDepth):?\s*/i;
|
|
40047
|
-
function isBridgeEnvelope(text) {
|
|
40048
|
-
return /^(?:agent task:|background task\b|agent message queued\b|agent close:)/i.test(text) || /^(?:agents|tasks):\s*\d/i.test(text) || /^\(no agents or tasks\)$/i.test(text) || /^task_id:\s*\S+/im.test(text) && /^(?:surface|operation|status):\s*/im.test(text);
|
|
40049
|
-
}
|
|
40050
|
-
function envelopeHasResponseLine(text) {
|
|
40051
|
-
let sawBlank = false;
|
|
40052
|
-
for (const line of text.split("\n")) {
|
|
40053
|
-
const trimmed = line.trim();
|
|
40054
|
-
if (!trimmed) {
|
|
40055
|
-
sawBlank = true;
|
|
40056
|
-
continue;
|
|
40057
|
-
}
|
|
40058
|
-
if (/^agent result\b/i.test(trimmed)) continue;
|
|
40059
|
-
if (/^(?:undefined|null)$/i.test(trimmed)) continue;
|
|
40060
|
-
if (BRIDGE_ENVELOPE_TAG_RE.test(trimmed)) continue;
|
|
40061
|
-
if (!sawBlank && BRIDGE_ENVELOPE_HEAD_FIELD_RE.test(trimmed)) continue;
|
|
40062
|
-
if (!sawBlank && /^(?:agents|tasks):\s*/i.test(trimmed)) continue;
|
|
40063
|
-
if (/^\(no agents or tasks\)$/i.test(trimmed)) continue;
|
|
40064
|
-
if (!sawBlank && /^-\s+\S+/i.test(trimmed)) continue;
|
|
40065
|
-
return true;
|
|
40066
|
-
}
|
|
40067
|
-
return false;
|
|
40068
|
-
}
|
|
40069
|
-
function hasAgentResponseResult(value) {
|
|
40070
|
-
const text = String(value || "").trim();
|
|
40071
|
-
if (!text) return false;
|
|
40072
|
-
const notification = parseTaskNotification(text);
|
|
40073
|
-
if (notification) return Boolean(notification.result);
|
|
40074
|
-
if (/^(?:undefined|null)$/i.test(text)) return false;
|
|
40075
|
-
if (/^status:\s*(?:running|pending|queued|completed|failed|cancelled|canceled)(?:\s*·\s*task_id:\s*\S+)?$/i.test(text))
|
|
40076
|
-
return false;
|
|
40077
|
-
if (!isBridgeEnvelope(text)) return true;
|
|
40078
|
-
return envelopeHasResponseLine(text);
|
|
40079
|
-
}
|
|
40080
40450
|
function agentTerminalDetail(status, isError, elapsed, error = "") {
|
|
40081
40451
|
const failureDetail = isError && error ? backgroundTaskFailureStatusLabel(status, error, { surface: "agent" }) : "";
|
|
40082
40452
|
if (failureDetail) return failureDetail;
|
|
@@ -40182,6 +40552,17 @@ function backgroundTaskDisplayName(normalizedName, meta = {}) {
|
|
|
40182
40552
|
if (SHELL_TASK_SURFACES.has(surface)) return "Shell";
|
|
40183
40553
|
return titleizeAgentName(surface || normalizedName || "Task");
|
|
40184
40554
|
}
|
|
40555
|
+
var TASK_CONTROL_TITLES = /* @__PURE__ */ new Map([
|
|
40556
|
+
["list", "List tasks"],
|
|
40557
|
+
["read", "Read task"],
|
|
40558
|
+
["status", "Read task"],
|
|
40559
|
+
["wait", "Wait for task"],
|
|
40560
|
+
["cancel", "Cancel task"]
|
|
40561
|
+
]);
|
|
40562
|
+
function taskControlTitle(normalizedName, args = {}) {
|
|
40563
|
+
if (String(normalizedName || "").toLowerCase() !== "task") return "";
|
|
40564
|
+
return TASK_CONTROL_TITLES.get(String(args?.action || args?.type || "").toLowerCase()) || "";
|
|
40565
|
+
}
|
|
40185
40566
|
function backgroundTaskResultTitle(normalizedName, meta = {}) {
|
|
40186
40567
|
const display = backgroundTaskDisplayName(normalizedName, meta);
|
|
40187
40568
|
if (display === "Shell") return "Shell output";
|
|
@@ -40190,6 +40571,7 @@ function backgroundTaskResultTitle(normalizedName, meta = {}) {
|
|
|
40190
40571
|
}
|
|
40191
40572
|
function backgroundTaskActionTitle(normalizedName, meta = {}) {
|
|
40192
40573
|
const display = backgroundTaskDisplayName(normalizedName, meta);
|
|
40574
|
+
if (/^queued$/i.test(meta.status || "")) return `Queued ${display}`;
|
|
40193
40575
|
if (/^(running|pending|queued)$/i.test(meta.status || "")) {
|
|
40194
40576
|
return String(meta.type || "").toLowerCase() === "progress" ? `${display} progress` : `Started ${display}`;
|
|
40195
40577
|
}
|
|
@@ -40205,7 +40587,7 @@ function backgroundTaskFailureDetail(meta = {}, parsedArgs = {}) {
|
|
|
40205
40587
|
}
|
|
40206
40588
|
function backgroundTaskDetail(meta = {}, elapsed = "") {
|
|
40207
40589
|
const parts = [];
|
|
40208
|
-
const status = displayTerminalStatus(meta.status);
|
|
40590
|
+
const status = /^queued$/i.test(meta.status || "") ? "Queued" : displayTerminalStatus(meta.status);
|
|
40209
40591
|
if (status) parts.push(status);
|
|
40210
40592
|
if (meta.taskId) parts.push(`task_id: ${meta.taskId}`);
|
|
40211
40593
|
const firstBodyLine = String(meta.body || "").split("\n").map((line) => line.trim()).find(Boolean) || "";
|
|
@@ -40242,12 +40624,12 @@ function readRowsForDisplay(text) {
|
|
|
40242
40624
|
}
|
|
40243
40625
|
|
|
40244
40626
|
// src/runtime/shared/tool-card-model/displayed-result.mjs
|
|
40245
|
-
function resolveDisplayedResult(base, { normalizedName, parsedArgs }) {
|
|
40627
|
+
function resolveDisplayedResult(base, { normalizedName, parsedArgs }, translate) {
|
|
40246
40628
|
const { name, args, rt, pending, isError } = base;
|
|
40247
40629
|
const isBackgroundTool = isBackgroundTaskTool(normalizedName);
|
|
40248
40630
|
const backgroundMeta = !pending && isBackgroundTool ? resolveBackgroundTaskMeta(parsedArgs, rt || "") : null;
|
|
40249
40631
|
const backgroundError = backgroundMeta?.error || parsedArgs?.error || "";
|
|
40250
|
-
const errorOnlyResult = Boolean(rt) && isBackgroundErrorOnlyBody(rt, backgroundError);
|
|
40632
|
+
const errorOnlyResult = Boolean(rt) && (Boolean(backgroundMeta) && isBackgroundErrorOnlyBody(rt, backgroundError) || isUserControlCancellation(rt));
|
|
40251
40633
|
const backgroundResultText = backgroundMeta?.hasResponse ? backgroundMeta.body : "";
|
|
40252
40634
|
const displayedResultText = backgroundResultText || (errorOnlyResult ? "" : rt || "");
|
|
40253
40635
|
const hasDisplayResult = Boolean(String(displayedResultText || "").trim());
|
|
@@ -40257,6 +40639,7 @@ function resolveDisplayedResult(base, { normalizedName, parsedArgs }) {
|
|
|
40257
40639
|
const lines = displayedResultBodyText ? displayedResultBodyText.split("\n") : [];
|
|
40258
40640
|
const isBackgroundResult = !pending && isBackgroundTool && Boolean(backgroundMeta);
|
|
40259
40641
|
const isBackgroundResponse = isBackgroundResult && (backgroundMeta?.hasResponse || isBackgroundTaskResponseArgs(normalizedName, parsedArgs));
|
|
40642
|
+
const summarize = (localize) => !pending && (hasDisplayBody || normalizedName === "git") ? summarizeToolResult(name, args, displayedResultBodyText, isError, localize) : null;
|
|
40260
40643
|
return {
|
|
40261
40644
|
backgroundMeta,
|
|
40262
40645
|
displayedResultText,
|
|
@@ -40264,7 +40647,8 @@ function resolveDisplayedResult(base, { normalizedName, parsedArgs }) {
|
|
|
40264
40647
|
displayedResultBodyText,
|
|
40265
40648
|
hasDisplayBody,
|
|
40266
40649
|
totalLines: lines.length,
|
|
40267
|
-
resultSummary:
|
|
40650
|
+
resultSummary: summarize(),
|
|
40651
|
+
...translate ? { resultSummaryDisplay: summarize(translate) } : {},
|
|
40268
40652
|
firstResultLine: hasDisplayResult ? String(lines[0] ?? "") : "",
|
|
40269
40653
|
isBackgroundResult,
|
|
40270
40654
|
isBackgroundResponse,
|
|
@@ -40273,6 +40657,7 @@ function resolveDisplayedResult(base, { normalizedName, parsedArgs }) {
|
|
|
40273
40657
|
}
|
|
40274
40658
|
|
|
40275
40659
|
// src/runtime/shared/tool-card-model/card-status.mjs
|
|
40660
|
+
var ENVELOPE_STATUS_TOOLS = /* @__PURE__ */ new Set(["agent", "bridge", "task", "web_search", "search_query", "image_query", "web_search_call"]);
|
|
40276
40661
|
function shellFragments(base, display, isShellSurface) {
|
|
40277
40662
|
if (!isShellSurface) return { shellStatus: "", shellElapsed: "" };
|
|
40278
40663
|
const { pending, failedCount, exitFailedCount, isError, elapsed } = base;
|
|
@@ -40310,8 +40695,14 @@ function deriveCardStatus(base, { normalizedName, parsedArgs, isShellSurface },
|
|
|
40310
40695
|
);
|
|
40311
40696
|
const agentCompletionDetail = !pending && isAgentTool(normalizedName) && !agentHeaderFailure ? agentTerminalDetail(parsedArgs?.status, isError, elapsed, parsedArgs?.error) : "";
|
|
40312
40697
|
const gitStatus = normalizedName === "git" ? gitTerminalStatus(display.displayedResultText) : "";
|
|
40313
|
-
const
|
|
40314
|
-
const
|
|
40698
|
+
const callFailed = !pending && (isError || failedCount > 0);
|
|
40699
|
+
const reported = (value) => {
|
|
40700
|
+
const status = normalizeTerminalStatus(value);
|
|
40701
|
+
return callFailed && status === "completed" ? "" : status;
|
|
40702
|
+
};
|
|
40703
|
+
const failedOrCompleted = callFailed ? "failed" : "completed";
|
|
40704
|
+
const envelopeStatus = ENVELOPE_STATUS_TOOLS.has(normalizedName) ? resultEnvelopeStatus(display.displayedResultText) : "";
|
|
40705
|
+
const terminalStatus = pending ? "running" : shellStatus || gitStatus || (normalizedName === "media" ? mediaTerminalStatus(parsedArgs, display.displayedResultText) : "") || reported(display.backgroundMeta?.status) || reported(parsedArgs?.status) || reported(envelopeStatus) || resultControlStatus(display.displayedResultText) || // A one-line error body is hidden from display, so read the raw result.
|
|
40315
40706
|
(isUserControlCancellation(base.rt) ? "cancelled" : "") || failedOrCompleted;
|
|
40316
40707
|
return {
|
|
40317
40708
|
shellStatus,
|
|
@@ -40322,7 +40713,8 @@ function deriveCardStatus(base, { normalizedName, parsedArgs, isShellSurface },
|
|
|
40322
40713
|
headerFailureText: backgroundMetadataHeaderFailure || agentHeaderFailure || "",
|
|
40323
40714
|
agentCompletionDetail,
|
|
40324
40715
|
agentDetail: !pending && isAgentTool(normalizedName) && !display.hasDisplayResult ? agentCompletionDetail : "",
|
|
40325
|
-
terminalStatus
|
|
40716
|
+
terminalStatus,
|
|
40717
|
+
callFailed
|
|
40326
40718
|
};
|
|
40327
40719
|
}
|
|
40328
40720
|
|
|
@@ -40412,13 +40804,14 @@ function nonShellDetail(base, surface, display, status, imageDetail) {
|
|
|
40412
40804
|
const syncElapsedDetail = !display.isBackgroundResponse && shouldPrefixSyncElapsed(normalizedName, label) ? prefixElapsed(backgroundResponseDetail, elapsed) : backgroundResponseDetail;
|
|
40413
40805
|
return backgroundMetadataDetail || (/^(Cancelled|Failed|Finished)$/i.test(resultSummary || "") && agentCompletionDetail ? agentCompletionDetail : syncElapsedDetail) || agentDetail || imageDetail || genericDetail;
|
|
40414
40806
|
}
|
|
40415
|
-
function agentDetailLine(base, { collapsedDetail, pendingDetailPlaceholder, agentSurfaceBrief, agentHeaderFailure }) {
|
|
40807
|
+
function agentDetailLine(base, { collapsedDetail, pendingDetailPlaceholder, agentSurfaceBrief, agentHeaderFailure, terminalStatus }) {
|
|
40416
40808
|
const { pending, isError, truncate, maxResultChars } = base;
|
|
40417
40809
|
const agentDetailFallback = collapsedDetail || (pending ? pendingDetailPlaceholder || "Running" : "Finished");
|
|
40418
40810
|
const line = agentSurfaceBrief || truncate(String(agentDetailFallback), Math.min(AGENT_SURFACE_BRIEF_MAX, maxResultChars));
|
|
40419
40811
|
const agentFailureText = /\b(Cancelled|Canceled|Failed)\b/i.test(agentSurfaceBrief || collapsedDetail || "");
|
|
40420
40812
|
const keepAgentDetail = (isError || agentFailureText) && !(agentHeaderFailure && !agentSurfaceBrief);
|
|
40421
|
-
|
|
40813
|
+
if (!keepAgentDetail) return "";
|
|
40814
|
+
return isError && agentSurfaceBrief ? mergeTerminalDetail(terminalStatus, line) : line;
|
|
40422
40815
|
}
|
|
40423
40816
|
function deriveCardDetail(base, surface, display, status) {
|
|
40424
40817
|
const { name, pending, isError, elapsed, rt, truncate, maxResultChars } = base;
|
|
@@ -40441,7 +40834,7 @@ function deriveCardDetail(base, surface, display, status) {
|
|
|
40441
40834
|
);
|
|
40442
40835
|
}
|
|
40443
40836
|
const isAgentResult = !display.isBackgroundResult && !pending && isAgentTool(normalizedName) && hasDisplayResult;
|
|
40444
|
-
const isAgentResponse = isAgentResult &&
|
|
40837
|
+
const isAgentResponse = isAgentResult && isAgentResponseResult(parsedArgs, rt);
|
|
40445
40838
|
const isAgentSurfaceCard = isAgentTool(normalizedName);
|
|
40446
40839
|
const agentSurfaceBriefRaw = isAgentSurfaceCard ? summarizeAgentSurfaceBrief(name, parsedArgs, displayedResultText || "", { isError, isResponse: isAgentResponse }) : "";
|
|
40447
40840
|
const agentSurfaceBrief = agentSurfaceBriefRaw ? truncate(agentSurfaceBriefRaw, Math.min(AGENT_SURFACE_BRIEF_MAX, maxResultChars)) : "";
|
|
@@ -40455,7 +40848,8 @@ function deriveCardDetail(base, surface, display, status) {
|
|
|
40455
40848
|
collapsedDetail,
|
|
40456
40849
|
pendingDetailPlaceholder,
|
|
40457
40850
|
agentSurfaceBrief,
|
|
40458
|
-
agentHeaderFailure: status.agentHeaderFailure
|
|
40851
|
+
agentHeaderFailure: status.agentHeaderFailure,
|
|
40852
|
+
terminalStatus: status.terminalStatus
|
|
40459
40853
|
});
|
|
40460
40854
|
}
|
|
40461
40855
|
return {
|
|
@@ -40473,13 +40867,19 @@ function deriveCardDetail(base, surface, display, status) {
|
|
|
40473
40867
|
function headerLabel(base, surface, display, status, detail) {
|
|
40474
40868
|
const { name, args, headerPending, groupCount } = base;
|
|
40475
40869
|
const { normalizedName, parsedArgs, isShellSurface } = surface;
|
|
40476
|
-
|
|
40870
|
+
const taskControl = taskControlTitle(normalizedName, parsedArgs);
|
|
40871
|
+
if (taskControl) return taskControl;
|
|
40872
|
+
if (detail.isAgentResponse) return agentResponseTitle(parsedArgs, groupCount, base.rt);
|
|
40477
40873
|
if (display.isBackgroundResponse) {
|
|
40478
40874
|
return backgroundTaskResultTitle(normalizedName, display.backgroundMeta || parsedArgs);
|
|
40479
40875
|
}
|
|
40480
40876
|
if (display.isBackgroundMetadataResult) return backgroundTaskActionTitle(normalizedName, display.backgroundMeta);
|
|
40481
40877
|
if (isShellSurface) return shellHeader(status.shellStatus, groupCount, parsedArgs?.verifyShell === true);
|
|
40482
|
-
return (isAgentTool(normalizedName) ? agentActionTitle(parsedArgs) : "") || formatToolActionHeader(name, args, {
|
|
40878
|
+
return (isAgentTool(normalizedName) ? agentActionTitle(parsedArgs, display.displayedResultText) : "") || formatToolActionHeader(name, args, {
|
|
40879
|
+
pending: headerPending,
|
|
40880
|
+
count: groupCount,
|
|
40881
|
+
failed: !base.pending && base.failedCount > 0 && base.failedCount >= groupCount
|
|
40882
|
+
});
|
|
40483
40883
|
}
|
|
40484
40884
|
function deriveCardHeader(base, surface, display, status, detail) {
|
|
40485
40885
|
const { pending, hasResult } = base;
|
|
@@ -40513,7 +40913,7 @@ function deriveToolCardModel(input = {}, options = {}) {
|
|
|
40513
40913
|
isShellSurface: isShellTool(normalizedName, label),
|
|
40514
40914
|
isSkillSurface: SKILL_SURFACE_NAMES.has(String(normalizedName || "").toLowerCase())
|
|
40515
40915
|
};
|
|
40516
|
-
const display = resolveDisplayedResult(base, surface);
|
|
40916
|
+
const display = resolveDisplayedResult(base, surface, options.translate);
|
|
40517
40917
|
const status = deriveCardStatus(base, surface, display);
|
|
40518
40918
|
const detail = deriveCardDetail(base, surface, display, status);
|
|
40519
40919
|
const header = deriveCardHeader(base, surface, display, status, detail);
|
|
@@ -40531,6 +40931,7 @@ function deriveToolCardModel(input = {}, options = {}) {
|
|
|
40531
40931
|
firstResultLine: display.firstResultLine,
|
|
40532
40932
|
totalLines: display.totalLines,
|
|
40533
40933
|
resultSummary: display.resultSummary,
|
|
40934
|
+
...options.translate ? { resultSummaryDisplay: display.resultSummaryDisplay } : {},
|
|
40534
40935
|
shellCollapsedSummary: detail.shellCollapsedSummary,
|
|
40535
40936
|
agentSurfaceBrief: detail.agentSurfaceBrief,
|
|
40536
40937
|
toolArgPath: String(detail.toolArgPath || ""),
|
|
@@ -40572,18 +40973,6 @@ function aggregateRawResultForDisplay(text) {
|
|
|
40572
40973
|
return out.join("\n");
|
|
40573
40974
|
}
|
|
40574
40975
|
|
|
40575
|
-
// src/runtime/agent/orchestrator/session/transcript-restore/agent-envelope.mjs
|
|
40576
|
-
function hasAgentResponseResultText(text) {
|
|
40577
|
-
const value = String(text || "").trim();
|
|
40578
|
-
if (!value) return false;
|
|
40579
|
-
const notification = parseTaskNotification(value);
|
|
40580
|
-
if (notification) return Boolean(notification.result);
|
|
40581
|
-
if (/^status:\s*(?:running|pending|queued|completed|failed|cancelled|canceled)(?:\s*·\s*task_id:\s*\S+)?$/i.test(value))
|
|
40582
|
-
return false;
|
|
40583
|
-
if (/^(?:background task\b|agent task:|task_id:)/i.test(value) && !/\n\s*\n[\s\S]*\S/.test(value)) return false;
|
|
40584
|
-
return true;
|
|
40585
|
-
}
|
|
40586
|
-
|
|
40587
40976
|
// src/tui/components/tool-output-format.mjs
|
|
40588
40977
|
import stringWidth4 from "string-width";
|
|
40589
40978
|
import stripAnsi8 from "strip-ansi";
|
|
@@ -41064,12 +41453,16 @@ function toolItemPendingForRows(item) {
|
|
|
41064
41453
|
const done = Math.max(0, Math.min(count, Number(item?.completedCount || (item?.result == null ? 0 : count))));
|
|
41065
41454
|
return done < count;
|
|
41066
41455
|
}
|
|
41456
|
+
function hasBackgroundMetaForRows(normalizedName, bgArgs, rt) {
|
|
41457
|
+
if (!isBackgroundTaskTool(normalizedName)) return false;
|
|
41458
|
+
return Boolean(parseBackgroundTaskResult(rt) || String(bgArgs?.task_id || bgArgs?.taskId || "").trim());
|
|
41459
|
+
}
|
|
41067
41460
|
function toolDisplayedResultTextForRows(item) {
|
|
41068
41461
|
const rt = item?.result == null ? "" : String(item.result).replace(/\s+$/, "");
|
|
41069
41462
|
const bgArgs = backgroundArgsForRows(item?.args);
|
|
41070
41463
|
const backgroundError = String(bgArgs.error || "");
|
|
41071
|
-
const errorOnlyResult = Boolean(rt) && isBackgroundErrorOnlyBody(rt, backgroundError);
|
|
41072
41464
|
const normalizedName = String(normalizeToolName(item?.name) || "").toLowerCase();
|
|
41465
|
+
const errorOnlyResult = Boolean(rt) && hasBackgroundMetaForRows(normalizedName, bgArgs, rt) && isBackgroundErrorOnlyBody(rt, backgroundError);
|
|
41073
41466
|
if (!toolItemPendingForRows(item) && isBackgroundTaskTool(normalizedName)) {
|
|
41074
41467
|
const meta = parseBackgroundTaskResultForRows(rt);
|
|
41075
41468
|
if (meta?.hasResponse && String(meta.body || "").trim()) {
|
|
@@ -41084,8 +41477,10 @@ function toolHasDisplayResultForRows(item) {
|
|
|
41084
41477
|
const trimmed = String(rt || "").trim();
|
|
41085
41478
|
if (!trimmed) return false;
|
|
41086
41479
|
const bgArgs = backgroundArgsForRows(item.args);
|
|
41087
|
-
if (isBackgroundErrorOnlyBody(trimmed, bgArgs.error || "")) return false;
|
|
41088
41480
|
const normalizedName = String(normalizeToolName(item.name) || "").toLowerCase();
|
|
41481
|
+
if (hasBackgroundMetaForRows(normalizedName, bgArgs, trimmed) && isBackgroundErrorOnlyBody(trimmed, bgArgs.error || "")) {
|
|
41482
|
+
return false;
|
|
41483
|
+
}
|
|
41089
41484
|
if (isBackgroundTaskTool(normalizedName)) {
|
|
41090
41485
|
const meta = parseBackgroundTaskResultForRows(trimmed);
|
|
41091
41486
|
if (meta) return Boolean(meta.hasResponse && String(meta.body || "").trim());
|
|
@@ -41127,7 +41522,7 @@ function agentCardKeepsCollapsedDetailForRows(item, normalizedName) {
|
|
|
41127
41522
|
const hasDisplayResult = toolHasDisplayResultForRows(item);
|
|
41128
41523
|
const displayedResultText = toolDisplayedResultTextForRows(item);
|
|
41129
41524
|
const rt = item.result == null ? "" : String(item.result).replace(/\s+$/, "");
|
|
41130
|
-
const isAgentResponse = hasDisplayResult &&
|
|
41525
|
+
const isAgentResponse = hasDisplayResult && isAgentResponseResult(bgArgs, rt);
|
|
41131
41526
|
const briefRaw = summarizeAgentSurfaceBrief(item.name, bgArgs, displayedResultText, {
|
|
41132
41527
|
isError,
|
|
41133
41528
|
isResponse: isAgentResponse
|
|
@@ -43601,6 +43996,7 @@ async function resizeImageBuffer(buffer, ext, { maxTokens = DEFAULT_IMAGE_MAX_TO
|
|
|
43601
43996
|
throw new InvalidImageDataError(error);
|
|
43602
43997
|
}
|
|
43603
43998
|
}
|
|
43999
|
+
var TOOL_IMAGE_TARGET_BASE64_SIZE = 256 * 1024;
|
|
43604
44000
|
|
|
43605
44001
|
// src/tui/paste-text-policy.mjs
|
|
43606
44002
|
var PASTE_TOKEN_MIN_LINES = 10;
|
|
@@ -43687,7 +44083,7 @@ function buildPromptContentWithImages(text, pastedImages = {}) {
|
|
|
43687
44083
|
const imageParts = Object.values(pastedImages || {}).filter((img) => img && img.type === "image" && refs.has(Number(img.id))).flatMap((img) => {
|
|
43688
44084
|
const parts2 = [];
|
|
43689
44085
|
if (img.metadataText) parts2.push({ type: "text", text: img.metadataText });
|
|
43690
|
-
parts2.push({ type: "image", data: img.content, mimeType: img.mediaType || "image/png" });
|
|
44086
|
+
parts2.push({ type: "image", data: img.content, mimeType: img.mediaType || "image/png", pasteId: img.id });
|
|
43691
44087
|
return parts2;
|
|
43692
44088
|
});
|
|
43693
44089
|
if (imageParts.length === 0) return value;
|
|
@@ -44867,7 +45263,9 @@ function contextDetail(m) {
|
|
|
44867
45263
|
}
|
|
44868
45264
|
function buildContextPanelModel(input) {
|
|
44869
45265
|
const metrics = contextMetrics(input);
|
|
44870
|
-
|
|
45266
|
+
const detail = contextDetail(metrics);
|
|
45267
|
+
detail.speed = { outputTokensPerSecond: input.sessionUsage?.outputTokensPerSecond ?? null };
|
|
45268
|
+
return { rows: contextRows(metrics), detail };
|
|
44871
45269
|
}
|
|
44872
45270
|
|
|
44873
45271
|
// src/tui/app/usage-context-panels/usage-panel.mjs
|
|
@@ -44930,12 +45328,13 @@ function createUsageContextPanels({
|
|
|
44930
45328
|
});
|
|
44931
45329
|
const openContextPicker = async () => {
|
|
44932
45330
|
const own = surface.claim();
|
|
44933
|
-
const [toolsStatus, mcpStatus, skillsStatus, pluginsStatus, contextStatus] = await Promise.all([
|
|
45331
|
+
const [toolsStatus, mcpStatus, skillsStatus, pluginsStatus, contextStatus, sessionUsage] = await Promise.all([
|
|
44934
45332
|
Promise.resolve(store.toolsStatus?.()).catch(() => null),
|
|
44935
45333
|
Promise.resolve(store.mcpStatus?.()).catch(() => null),
|
|
44936
45334
|
Promise.resolve(store.skillsStatus?.()).catch(() => null),
|
|
44937
45335
|
Promise.resolve(store.pluginsStatus?.()).catch(() => null),
|
|
44938
|
-
Promise.resolve(store.contextStatus?.({ inspect: true })).catch(() => null)
|
|
45336
|
+
Promise.resolve(store.contextStatus?.({ inspect: true })).catch(() => null),
|
|
45337
|
+
Promise.resolve(store.getSessionUsage?.()).catch(() => null)
|
|
44939
45338
|
]);
|
|
44940
45339
|
const { rows: rows2, detail } = buildContextPanelModel({
|
|
44941
45340
|
toolsStatus,
|
|
@@ -44943,6 +45342,7 @@ function createUsageContextPanels({
|
|
|
44943
45342
|
skillsStatus,
|
|
44944
45343
|
pluginsStatus,
|
|
44945
45344
|
contextStatus,
|
|
45345
|
+
sessionUsage,
|
|
44946
45346
|
state
|
|
44947
45347
|
});
|
|
44948
45348
|
if (!own.owns()) return;
|
|
@@ -47699,7 +48099,7 @@ function projectLitellmRow(row) {
|
|
|
47699
48099
|
if (typeof value === "number" && Number.isFinite(value)) out[field] = value;
|
|
47700
48100
|
}
|
|
47701
48101
|
for (const [field, value] of Object.entries(row)) {
|
|
47702
|
-
if ((/^(?:input_cost_per_token|output_cost_per_token|cache_read_input_token_cost|cache_creation_input_token_cost)(?:_above_\d+k_tokens)?(?:_priority)?$/.test(
|
|
48102
|
+
if ((/^(?:input_cost_per_token|output_cost_per_token|cache_read_input_token_cost|cache_creation_input_token_cost)(?:_above_\d+k_tokens)?(?:_priority|_ultrafast)?$/.test(
|
|
47703
48103
|
field
|
|
47704
48104
|
) || /^output_cost_per_second_\w+$/.test(field)) && typeof value === "number" && Number.isFinite(value))
|
|
47705
48105
|
out[field] = value;
|
|
@@ -50952,10 +51352,12 @@ function ContextUsageView({ detail, columns, panelRows, onInspect, onRefresh })
|
|
|
50952
51352
|
compaction.pressureTokens ? `pressure ${formatTokens(compaction.pressureTokens)}` : "",
|
|
50953
51353
|
compaction.reserveTokens ? `reserve ${formatTokens(compaction.reserveTokens)}` : ""
|
|
50954
51354
|
]);
|
|
51355
|
+
const speed = detail?.speed?.outputTokensPerSecond;
|
|
50955
51356
|
const sourceLine = metricValue([
|
|
50956
51357
|
contextMeasurementLabel(usage.measurementSource),
|
|
50957
51358
|
usage.effective ? `effective ${formatTokens(windowTokens)}` : `window ${formatTokens(windowTokens)}`,
|
|
50958
|
-
usage.rawWindowTokens && usage.rawWindowTokens !== usage.windowTokens ? `raw ${formatTokens(usage.rawWindowTokens)}` : ""
|
|
51359
|
+
usage.rawWindowTokens && usage.rawWindowTokens !== usage.windowTokens ? `raw ${formatTokens(usage.rawWindowTokens)}` : "",
|
|
51360
|
+
speed == null ? "" : `${speed < 10 ? speed.toFixed(1) : Math.round(speed)} tok/s`
|
|
50959
51361
|
]);
|
|
50960
51362
|
const apiLine = metricValue([
|
|
50961
51363
|
`last ctx ${formatTokens(lastApi.contextTokens)}`,
|
|
@@ -52474,7 +52876,8 @@ function renderAggregateToolCard(card) {
|
|
|
52474
52876
|
const headerText = safeInlineText(
|
|
52475
52877
|
formatAggregateHeader((headerPending ? displayCategories : displayDoneCategories) || {}, {
|
|
52476
52878
|
pending: headerPending,
|
|
52477
|
-
order: headerOrder
|
|
52879
|
+
order: headerOrder,
|
|
52880
|
+
failed: failedCount > 0 && failedCount >= groupCount
|
|
52478
52881
|
})
|
|
52479
52882
|
);
|
|
52480
52883
|
const detailText = hasResult ? safeInlineText(rt) : "";
|
|
@@ -52505,7 +52908,7 @@ function renderAggregateToolCard(card) {
|
|
|
52505
52908
|
const clippedHeader = stringWidth15(headerText) > avail ? truncateToWidth(headerText, avail) : headerText;
|
|
52506
52909
|
const isPlaceholderDetail = !(expanded && hasRawResult) && !detailText;
|
|
52507
52910
|
const showRawAggregate = expanded && hasRawResult;
|
|
52508
|
-
const pendingPlaceholder = pending ? "Running" : "Finished";
|
|
52911
|
+
const pendingPlaceholder = pending ? "Running" : displayTerminalStatus(aggregateTerminalStatus) || "Finished";
|
|
52509
52912
|
const detailLines = showRawAggregate ? [] : [detailText || pendingPlaceholder];
|
|
52510
52913
|
const aggregateDetailColor = isPlaceholderDetail ? theme.subtle : theme.text;
|
|
52511
52914
|
return /* @__PURE__ */ jsxs16(Box_default, { flexDirection: "column", marginTop: attached ? 0 : 1, width: rowWidth, overflow: "hidden", children: [
|
|
@@ -56552,10 +56955,10 @@ function modelFooter(selection, model = null) {
|
|
|
56552
56955
|
fastLine = {
|
|
56553
56956
|
glyph: fastOn ? "\u25CF" : "\u25CB",
|
|
56554
56957
|
color: fastOn ? theme.fastMode : theme.inactive,
|
|
56555
|
-
text: `${fastDisplayLabel(fastOn)} \xB7 Tab Toggle`
|
|
56958
|
+
text: `${selection.isUltrafast?.(model) ? "Ultrafast" : fastDisplayLabel(fastOn)} \xB7 Tab Toggle`
|
|
56556
56959
|
};
|
|
56557
56960
|
}
|
|
56558
|
-
const parameterLines = (model?.modelParameterOptions || []).filter((parameter) => parameter.id !== "context").map((parameter) => {
|
|
56961
|
+
const parameterLines = (model?.modelParameterOptions || []).filter((parameter) => parameter.id !== "context" && parameter.id !== "serviceTier").map((parameter) => {
|
|
56559
56962
|
const value = selection.modelParametersFor(model)[parameter.id] || "";
|
|
56560
56963
|
return {
|
|
56561
56964
|
glyph: "\u25C7",
|
|
@@ -56659,9 +57062,23 @@ function createFastParameterSelection({ state, currentRoute, isCurrentRoute, isS
|
|
|
56659
57062
|
selectedFast.set(key, fast);
|
|
56660
57063
|
return fast;
|
|
56661
57064
|
};
|
|
57065
|
+
const ultrafastOffered = (model) => (model?.modelParameterOptions || []).some(
|
|
57066
|
+
(parameter) => parameter.id === "serviceTier" && parameter.options?.some((o) => o.value === "ultrafast")
|
|
57067
|
+
);
|
|
57068
|
+
const isUltrafast = (model) => ultrafastOffered(model) && getSelectedFast(model) && modelParametersFor(model).serviceTier === "ultrafast";
|
|
57069
|
+
const setSpeed = (model, fast, tier) => {
|
|
57070
|
+
selectedFast.set(modelKey(model), fast);
|
|
57071
|
+
selectedModelParameters.set(modelKey(model), { ...modelParametersFor(model), serviceTier: tier });
|
|
57072
|
+
};
|
|
56662
57073
|
const toggleFast = (model) => {
|
|
56663
57074
|
if (!fastAvailableFor(model)) return false;
|
|
56664
|
-
|
|
57075
|
+
if (!ultrafastOffered(model)) {
|
|
57076
|
+
selectedFast.set(modelKey(model), !getSelectedFast(model));
|
|
57077
|
+
return true;
|
|
57078
|
+
}
|
|
57079
|
+
if (!getSelectedFast(model)) setSpeed(model, true, "priority");
|
|
57080
|
+
else if (!isUltrafast(model)) setSpeed(model, true, "ultrafast");
|
|
57081
|
+
else setSpeed(model, false, "priority");
|
|
56665
57082
|
return true;
|
|
56666
57083
|
};
|
|
56667
57084
|
const cycleThinking = (model) => {
|
|
@@ -56678,7 +57095,7 @@ function createFastParameterSelection({ state, currentRoute, isCurrentRoute, isS
|
|
|
56678
57095
|
if (!fastAvailableFor(model)) selectedFast.set(modelKey(model), false);
|
|
56679
57096
|
return true;
|
|
56680
57097
|
};
|
|
56681
|
-
return { modelParametersFor, fastAvailableFor, getSelectedFast, toggleFast, cycleThinking };
|
|
57098
|
+
return { modelParametersFor, fastAvailableFor, getSelectedFast, isUltrafast, toggleFast, cycleThinking };
|
|
56682
57099
|
}
|
|
56683
57100
|
|
|
56684
57101
|
// src/tui/app/model-picker/route-selection.mjs
|
|
@@ -56693,6 +57110,8 @@ function createRouteSelection({ providerModels, state, currentRoute }) {
|
|
|
56693
57110
|
const coercedEffort = effort.coerceEffort(selected);
|
|
56694
57111
|
const fastCapable = fast.fastAvailableFor(selected, coercedEffort);
|
|
56695
57112
|
const contextSelection = context.contextSelectionFor(selected);
|
|
57113
|
+
const { serviceTier, ...otherParameters } = fast.modelParametersFor(selected);
|
|
57114
|
+
const modelParameters = serviceTier && fastCapable && fast.getSelectedFast(selected) ? { ...otherParameters, serviceTier } : otherParameters;
|
|
56696
57115
|
return {
|
|
56697
57116
|
effort: coercedEffort,
|
|
56698
57117
|
routeInput: {
|
|
@@ -56701,7 +57120,7 @@ function createRouteSelection({ providerModels, state, currentRoute }) {
|
|
|
56701
57120
|
...coercedEffort ? { effort: coercedEffort } : {},
|
|
56702
57121
|
...contextSelection ? { contextPercent: contextSelection.percent } : {},
|
|
56703
57122
|
...selected.fastCapable ? { fast: fastCapable && fast.getSelectedFast(selected) } : {},
|
|
56704
|
-
...(selected.modelParameterOptions || []).length ? { modelParameters
|
|
57123
|
+
...(selected.modelParameterOptions || []).length ? { modelParameters } : {}
|
|
56705
57124
|
}
|
|
56706
57125
|
};
|
|
56707
57126
|
};
|
|
@@ -56715,6 +57134,7 @@ function createRouteSelection({ providerModels, state, currentRoute }) {
|
|
|
56715
57134
|
stepContext: context.stepContext,
|
|
56716
57135
|
fastAvailableFor: fast.fastAvailableFor,
|
|
56717
57136
|
getSelectedFast: fast.getSelectedFast,
|
|
57137
|
+
isUltrafast: fast.isUltrafast,
|
|
56718
57138
|
toggleFast: fast.toggleFast,
|
|
56719
57139
|
cycleEffort: effort.cycleEffort,
|
|
56720
57140
|
cycleThinking: fast.cycleThinking,
|
|
@@ -58586,10 +59006,11 @@ var routeCommands = {
|
|
|
58586
59006
|
const value = String(arg || "").trim().toLowerCase();
|
|
58587
59007
|
let setTo = null;
|
|
58588
59008
|
if (!value) setTo = void 0;
|
|
59009
|
+
else if (["ultra", "ultrafast"].includes(value)) setTo = "ultrafast";
|
|
58589
59010
|
else if (["1", "true", "yes", "on", "enable", "enabled"].includes(value)) setTo = true;
|
|
58590
59011
|
else if (["0", "false", "no", "off", "disable", "disabled"].includes(value)) setTo = false;
|
|
58591
59012
|
if (setTo === null) {
|
|
58592
|
-
store.pushNotice("usage: /fast [on|off]", "warn");
|
|
59013
|
+
store.pushNotice("usage: /fast [on|off|ultra]", "warn");
|
|
58593
59014
|
return true;
|
|
58594
59015
|
}
|
|
58595
59016
|
const action = setTo === void 0 ? store.toggleFast?.() : store.setFast?.(setTo);
|
|
@@ -58599,7 +59020,7 @@ var routeCommands = {
|
|
|
58599
59020
|
return;
|
|
58600
59021
|
}
|
|
58601
59022
|
store.pushNotice(
|
|
58602
|
-
`Fast mode ${enabled ? "on" : "off"} for ${state.provider}/${state.model}` + (state.busy ? " (applies from the next turn)" : ""),
|
|
59023
|
+
`${setTo === "ultrafast" ? "Ultrafast" : `Fast mode ${enabled ? "on" : "off"}`} for ${state.provider}/${state.model}` + (state.busy ? " (applies from the next turn)" : ""),
|
|
58603
59024
|
"info"
|
|
58604
59025
|
);
|
|
58605
59026
|
}).catch((e) => store.pushNotice(`Couldn\u2019t update fast mode: ${e?.message || e}`, "error"));
|
|
@@ -59096,6 +59517,7 @@ function runRestoreQueuedToPrompt(options, deps) {
|
|
|
59096
59517
|
} else {
|
|
59097
59518
|
clearPromptHint();
|
|
59098
59519
|
}
|
|
59520
|
+
if (restored2.notice) showPromptHint(restored2.notice, "error");
|
|
59099
59521
|
return true;
|
|
59100
59522
|
};
|
|
59101
59523
|
let restored;
|