mixdog 0.9.63 → 0.9.64
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/README.md +3 -0
- package/package.json +9 -2
- package/scripts/code-graph-description-contract.mjs +3 -3
- package/scripts/verify-release-assets.mjs +2 -2
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +11 -14
- package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +6 -6
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +2 -2
- package/src/runtime/agent/orchestrator/agent-trace-format.mjs +1 -0
- package/src/runtime/agent/orchestrator/config.mjs +19 -124
- package/src/runtime/agent/orchestrator/context/collect.mjs +6 -6
- package/src/runtime/agent/orchestrator/dispatch-persist.mjs +2 -2
- package/src/runtime/agent/orchestrator/internal-agents.mjs +2 -2
- package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +1 -1
- package/src/runtime/agent/orchestrator/mcp/client.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-betas.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-effort.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-max-tokens.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-messages.mjs +333 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-model-resolve.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +3 -277
- package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/custom-tool-wire.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/gemini-cache.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +6 -6
- package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +196 -0
- package/src/runtime/agent/orchestrator/providers/grok-oauth-tokens.mjs +460 -0
- package/src/runtime/agent/orchestrator/providers/grok-oauth.mjs +14 -593
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-wire.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-xai.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +5 -280
- package/src/runtime/agent/orchestrator/providers/openai-responses-payload.mjs +357 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-headers.mjs +216 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +2 -188
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/provider-catalog-cache.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/registry.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/retry-classifier.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/statusline-route-meta.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/cache/prefetch-cache.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/compact/budget.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/compact/file-reattach.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/compact/summary-schema.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/compact/summary.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/compact/text-utils.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +4 -4
- package/src/runtime/agent/orchestrator/session/loop/deferred-call-through.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +17 -0
- package/src/runtime/agent/orchestrator/session/loop/steering.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/stored-tool-args.mjs +18 -26
- package/src/runtime/agent/orchestrator/session/loop/termination.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/tool-classify.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +1 -0
- package/src/runtime/agent/orchestrator/session/manager/context-meta.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/delivered-completions.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/status-telemetry.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store/live-state.mjs +49 -0
- package/src/runtime/agent/orchestrator/session/store/load-cache.mjs +49 -0
- package/src/runtime/agent/orchestrator/session/store/save-worker.mjs +260 -0
- package/src/runtime/agent/orchestrator/session/store/serialize.mjs +72 -0
- package/src/runtime/agent/orchestrator/session/store/summary-cache.mjs +163 -0
- package/src/runtime/agent/orchestrator/session/store/write-guards.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +4 -1
- package/src/runtime/agent/orchestrator/session/store.mjs +9 -561
- package/src/runtime/agent/orchestrator/session/tool-envelope.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +2 -2
- package/src/runtime/agent/orchestrator/stall-policy.mjs +11 -11
- package/src/runtime/agent/orchestrator/tools/bash-policy-scan.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/bash-session.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/advisory-lock.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/atomic-write.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +2 -154
- package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/cwd-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/fs-reachability.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/fuzzy-match.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/glob-walk.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/path-locks.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/path-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-args.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +2 -3
- package/src/runtime/agent/orchestrator/tools/builtin/read-image-resize.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/builtin/read-open.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-streaming.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/rg-runner.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/search-path-diagnostics.mjs +5 -5
- package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-paths.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-process.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-spawn.mjs +519 -0
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +5 -449
- package/src/runtime/agent/orchestrator/tools/builtin/snapshot-helpers.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +212 -0
- package/src/runtime/agent/orchestrator/tools/builtin.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +1 -7
- package/src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs +9 -36
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +15 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/search-references.mjs +429 -0
- package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +2 -395
- package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/text-mask.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/trusted-roots.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph-prewarm-worker.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph-state.mjs +3 -3
- package/src/runtime/agent/orchestrator/tools/mutation-planner.mjs +5 -5
- package/src/runtime/agent/orchestrator/tools/next-call-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/dispatch.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/matcher.mjs +7 -7
- package/src/runtime/agent/orchestrator/tools/patch/orchestrator.mjs +72 -9
- package/src/runtime/agent/orchestrator/tools/patch/parsing.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/patch/paths.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch-tool-defs.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/patch.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/result-compression.mjs +3 -3
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +2 -444
- package/src/runtime/agent/orchestrator/tools/shell-exec-output.mjs +505 -0
- package/src/runtime/agent/orchestrator/tools/shell-exec-policy.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/shell-snapshot.mjs +1 -1
- package/src/runtime/channels/lib/backend-dispatch.mjs +20 -5
- package/src/runtime/channels/lib/scheduler.mjs +1 -1
- package/src/runtime/channels/lib/telegram-format.mjs +1 -1
- package/src/runtime/channels/lib/voice-runtime-fetcher.mjs +4 -4
- package/src/runtime/channels/tool-defs.mjs +2 -3
- package/src/runtime/memory/index.mjs +1 -5
- package/src/runtime/memory/lib/core-memory-candidates.mjs +357 -0
- package/src/runtime/memory/lib/core-memory-store.mjs +7 -357
- package/src/runtime/memory/lib/cycle-signatures.mjs +1 -1
- package/src/runtime/memory/lib/embedding-model-config.mjs +1 -1
- package/src/runtime/memory/lib/embedding-provider.mjs +1 -5
- package/src/runtime/memory/lib/embedding-worker.mjs +1 -5
- package/src/runtime/memory/lib/ko-morph.mjs +2 -2
- package/src/runtime/memory/lib/memory-config-flags.mjs +2 -5
- package/src/runtime/memory/lib/memory-cycle-requests.mjs +3 -7
- package/src/runtime/memory/lib/memory-cycle1.mjs +4 -8
- package/src/runtime/memory/lib/memory-cycle2-gate.mjs +1 -1
- package/src/runtime/memory/lib/memory-cycle2-mutations.mjs +1 -1
- package/src/runtime/memory/lib/memory-cycle2-shared.mjs +2 -5
- package/src/runtime/memory/lib/memory-cycle3.mjs +1 -5
- package/src/runtime/memory/lib/memory-embed.mjs +2 -6
- package/src/runtime/memory/lib/memory-log.mjs +8 -0
- package/src/runtime/memory/lib/memory-ops-policy.mjs +4 -8
- package/src/runtime/memory/lib/memory-recall-scope-filter.mjs +1 -1
- package/src/runtime/memory/lib/memory-recall-store.mjs +2 -193
- package/src/runtime/memory/lib/memory-score.mjs +1 -1
- package/src/runtime/memory/lib/memory-text-utils.mjs +2 -2
- package/src/runtime/memory/lib/memory.mjs +2 -6
- package/src/runtime/memory/lib/pg/adapter.mjs +2 -6
- package/src/runtime/memory/lib/pg/process.mjs +1 -5
- package/src/runtime/memory/lib/pg/supervisor.mjs +1 -5
- package/src/runtime/memory/lib/recall-format.mjs +2 -2
- package/src/runtime/memory/lib/recall-scoring.mjs +195 -0
- package/src/runtime/memory/lib/runtime-fetcher.mjs +1 -5
- package/src/runtime/memory/lib/trace-store.mjs +2 -6
- package/src/runtime/search/lib/http-fetch.mjs +6 -6
- package/src/runtime/search/lib/web-tools.mjs +2 -2
- package/src/runtime/shared/buffered-appender.mjs +1 -1
- package/src/runtime/shared/child-guardian.mjs +1 -1
- package/src/runtime/shared/child-spawn-gate.mjs +1 -1
- package/src/runtime/shared/config.mjs +4 -4
- package/src/runtime/shared/launcher-control.mjs +9 -10
- package/src/runtime/shared/llm/index.mjs +5 -20
- package/src/runtime/shared/markdown-frontmatter.mjs +1 -1
- package/src/runtime/shared/memory-snapshot.mjs +4 -4
- package/src/runtime/shared/pristine-execution.mjs +1 -1
- package/src/runtime/shared/process-lifecycle.mjs +0 -1
- package/src/runtime/shared/process-shutdown.mjs +1 -1
- package/src/runtime/shared/resource-admission.mjs +2 -2
- package/src/runtime/shared/schedule-session-run.mjs +1 -1
- package/src/runtime/shared/schedules-db.mjs +1 -1
- package/src/runtime/shared/service-discovery.mjs +2 -2
- package/src/runtime/shared/staged-update.mjs +6 -6
- package/src/runtime/shared/tool-execution-contract.mjs +1 -1
- package/src/runtime/shared/tool-primitives.mjs +1 -1
- package/src/runtime/shared/tool-surface.mjs +2 -2
- package/src/runtime/shared/update-checker.mjs +1 -1
- package/src/runtime/shared/user-cwd.mjs +3 -3
- package/src/runtime/shared/user-data-guard.mjs +4 -4
- package/src/runtime/shared/workspace-router.mjs +5 -5
- package/src/session-runtime/config-helpers.mjs +2 -3
- package/src/session-runtime/config-lifecycle.mjs +1 -1
- package/src/session-runtime/hitch-profile.mjs +1 -1
- package/src/session-runtime/lifecycle-api.mjs +6 -4
- package/src/session-runtime/model-recency.mjs +5 -5
- package/src/session-runtime/plugin-mcp.mjs +1 -1
- package/src/session-runtime/provider-request-snapshot.mjs +338 -0
- package/src/session-runtime/session-text.mjs +4 -4
- package/src/session-runtime/tool-catalog-schema.mjs +197 -0
- package/src/session-runtime/tool-catalog.mjs +6 -483
- package/src/session-runtime/tool-defs.mjs +1 -1
- package/src/standalone/agent-task-status.mjs +1 -1
- package/src/standalone/agent-tool/helpers.mjs +2 -2
- package/src/standalone/channel-admin.mjs +4 -4
- package/src/standalone/explore-tool.mjs +3 -3
- package/src/standalone/hook-bus/config.mjs +1 -1
- package/src/standalone/hook-bus/constants.mjs +1 -1
- package/src/standalone/hook-bus/rules.mjs +1 -1
- package/src/standalone/projects.mjs +1 -1
- package/src/standalone/provider-admin.mjs +2 -2
- package/src/tui/app/app-format.mjs +2 -2
- package/src/tui/app/clipboard.mjs +3 -3
- package/src/tui/app/input-parsers.mjs +1 -1
- package/src/tui/app/text-layout.mjs +1 -1
- package/src/tui/app/transcript-row-estimate.mjs +360 -0
- package/src/tui/app/transcript-window.mjs +5 -347
- package/src/tui/app/use-mouse-input.mjs +1 -1
- package/src/tui/app/use-prompt-handlers.mjs +1 -1
- package/src/tui/components/tool-execution/surface-detail.mjs +9 -9
- package/src/tui/components/tool-execution/text-format.mjs +2 -2
- package/src/tui/components/tool-output-format.mjs +7 -7
- package/src/tui/display-width.mjs +4 -4
- package/src/tui/dist/index.mjs +63 -97
- package/src/tui/engine/agent-envelope.mjs +5 -5
- package/src/tui/engine/notification-plan.mjs +1 -1
- package/src/tui/engine/queue-helpers.mjs +3 -3
- package/src/tui/engine/render-timing.mjs +4 -5
- package/src/tui/engine/session-api-ext.mjs +3 -3
- package/src/tui/engine/tool-result-status.mjs +5 -5
- package/src/tui/engine/tool-result-text.mjs +1 -1
- package/src/tui/engine/transcript-spill.mjs +585 -0
- package/src/tui/engine/tui-steering-persist.mjs +1 -1
- package/src/tui/engine.mjs +2 -474
- package/src/tui/lib/voice-setup.mjs +1 -1
- package/src/tui/markdown/format-token.mjs +1 -1
- package/src/tui/markdown/render-ansi.mjs +1 -1
- package/src/tui/markdown/table-layout.mjs +4 -4
- package/src/tui/paste-attachments.mjs +1 -1
- package/src/tui/prompt-history-store.mjs +3 -3
- package/src/tui/statusline-ansi-bridge.mjs +2 -2
- package/src/tui/theme.mjs +1 -1
- package/src/tui/transcript-tool-failures.mjs +2 -2
- package/src/ui/ansi.mjs +0 -9
- package/src/ui/statusline-format.mjs +2 -4
- package/scripts/_bench-cwc.json +0 -20
- package/scripts/_jitter-fuzz.jsx +0 -42
- package/scripts/_jitter-fuzz2.jsx +0 -30
- package/scripts/_jitter-probe.jsx +0 -35
- package/scripts/_jp2.jsx +0 -16
- package/scripts/_smoke_wd.mjs +0 -7
- package/scripts/abort-recovery-test.mjs +0 -175
- package/scripts/agent-dispatch-abort-compose-test.mjs +0 -31
- package/scripts/agent-live-arg-guard-smoke.mjs +0 -20
- package/scripts/agent-live-path-suffix-smoke.mjs +0 -34
- package/scripts/agent-live-toolcall-args-smoke.mjs +0 -45
- package/scripts/agent-loop-policy-test.mjs +0 -37
- package/scripts/agent-model-liveness-test.mjs +0 -763
- package/scripts/agent-parallel-smoke.mjs +0 -435
- package/scripts/agent-route-batch-test.mjs +0 -40
- package/scripts/agent-tag-reuse-smoke.mjs +0 -441
- package/scripts/agent-terminal-reap-test.mjs +0 -252
- package/scripts/agent-trace-io-test.mjs +0 -133
- package/scripts/ansi-color-capability-test.mjs +0 -90
- package/scripts/anthropic-admission-retry-integration-test.mjs +0 -119
- package/scripts/anthropic-maxtokens-test.mjs +0 -119
- package/scripts/anthropic-oauth-refresh-race-test.mjs +0 -397
- package/scripts/anthropic-transport-policy-test.mjs +0 -726
- package/scripts/apply-patch-edit-smoke.mjs +0 -71
- package/scripts/arg-guard-test.mjs +0 -93
- package/scripts/async-notify-settlement-test.mjs +0 -99
- package/scripts/atomic-lock-tryonce-test.mjs +0 -125
- package/scripts/background-task-meta-smoke.mjs +0 -38
- package/scripts/bench-run.mjs +0 -508
- package/scripts/boot-smoke.mjs +0 -137
- package/scripts/build-runtime-windows.ps1 +0 -242
- package/scripts/channel-daemon-smoke.mjs +0 -1103
- package/scripts/code-graph-aggregate-cwd-test.mjs +0 -158
- package/scripts/code-graph-disk-hit-test.mjs +0 -290
- package/scripts/code-graph-dispatch-test.mjs +0 -96
- package/scripts/code-graph-root-federation-test.mjs +0 -273
- package/scripts/compact-active-turn-test.mjs +0 -68
- package/scripts/compact-file-reattach-test.mjs +0 -88
- package/scripts/compact-pressure-test.mjs +0 -788
- package/scripts/compact-prior-context-flatten-test.mjs +0 -252
- package/scripts/compact-recall-digest-test.mjs +0 -57
- package/scripts/compact-smoke.mjs +0 -1017
- package/scripts/compact-trigger-migration-smoke.mjs +0 -261
- package/scripts/compacted-placeholder-scrub-test.mjs +0 -63
- package/scripts/context-mcp-metering-test.mjs +0 -1406
- package/scripts/debounced-skills-async-save-test.mjs +0 -57
- package/scripts/deferred-tool-loading-test.mjs +0 -250
- package/scripts/desktop-session-bridge-test.mjs +0 -1013
- package/scripts/dispatch-persist-recovery-test.mjs +0 -141
- package/scripts/embedding-worker-exit-test.mjs +0 -76
- package/scripts/execution-completion-dedup-test.mjs +0 -205
- package/scripts/execution-pending-resume-kick-test.mjs +0 -151
- package/scripts/execution-resume-esc-integration-test.mjs +0 -176
- package/scripts/explore-bench-tmp.mjs +0 -36
- package/scripts/explore-bench.mjs +0 -248
- package/scripts/explore-prompt-policy-test.mjs +0 -256
- package/scripts/explore-timeout-cancel-test.mjs +0 -345
- package/scripts/find-fuzzy-hidden-test.mjs +0 -267
- package/scripts/forwarder-rebind-tail-test.mjs +0 -67
- package/scripts/freevar-smoke.mjs +0 -98
- package/scripts/gemini-provider-test.mjs +0 -1448
- package/scripts/generate-oc-icons.mjs +0 -11
- package/scripts/grok-oauth-refresh-race-test.mjs +0 -273
- package/scripts/headless-pristine-execution-test.mjs +0 -614
- package/scripts/hook-bus-test.mjs +0 -552
- package/scripts/ingest-pure-conversation-smoke.mjs +0 -175
- package/scripts/internal-comms-bench-test.mjs +0 -226
- package/scripts/internal-comms-bench.mjs +0 -853
- package/scripts/internal-comms-smoke.mjs +0 -277
- package/scripts/internal-tools-normalization-test.mjs +0 -62
- package/scripts/interrupted-turn-history-test.mjs +0 -399
- package/scripts/lead-workflow-smoke.mjs +0 -592
- package/scripts/lifecycle-api-test.mjs +0 -137
- package/scripts/live-share-test.mjs +0 -148
- package/scripts/live-worker-smoke.mjs +0 -333
- package/scripts/log-writer-guard-smoke.mjs +0 -131
- package/scripts/maintenance-default-routes-test.mjs +0 -164
- package/scripts/max-output-recovery-persist-test.mjs +0 -81
- package/scripts/max-output-recovery-test.mjs +0 -368
- package/scripts/mcp-client-normalization-test.mjs +0 -45
- package/scripts/mcp-grace-deferred-test.mjs +0 -225
- package/scripts/memory-core-input-test.mjs +0 -167
- package/scripts/memory-cycle-routing-test.mjs +0 -111
- package/scripts/memory-meta-concurrency-test.mjs +0 -20
- package/scripts/memory-pg-recovery-test.mjs +0 -59
- package/scripts/memory-rule-contract-test.mjs +0 -93
- package/scripts/model-list-sanitize-test.mjs +0 -37
- package/scripts/mouse-tracking-restore-smoke.mjs +0 -107
- package/scripts/native-edit-wire-test.mjs +0 -152
- package/scripts/notify-completion-mirror-test.mjs +0 -73
- package/scripts/openai-oauth-refresh-race-test.mjs +0 -120
- package/scripts/openai-oauth-ws-1006-retry-test.mjs +0 -954
- package/scripts/openai-ws-early-settle-test.mjs +0 -216
- package/scripts/output-style-bench.mjs +0 -292
- package/scripts/output-style-smoke.mjs +0 -145
- package/scripts/parent-abort-link-test.mjs +0 -90
- package/scripts/patch-binary-cache-test.mjs +0 -181
- package/scripts/path-suffix-test.mjs +0 -57
- package/scripts/pending-completion-drop-test.mjs +0 -239
- package/scripts/pending-messages-lock-nonblocking-test.mjs +0 -62
- package/scripts/pretool-ask-runtime-test.mjs +0 -54
- package/scripts/process-lifecycle-test.mjs +0 -461
- package/scripts/prompt-immediate-render-test.mjs +0 -89
- package/scripts/prompt-input-parity-test.mjs +0 -145
- package/scripts/provider-admission-scheduler-test.mjs +0 -681
- package/scripts/provider-contract-test.mjs +0 -632
- package/scripts/provider-stream-stall-test.mjs +0 -276
- package/scripts/provider-toolcall-test.mjs +0 -3063
- package/scripts/reactive-compact-persist-smoke.mjs +0 -203
- package/scripts/recall-bench.mjs +0 -359
- package/scripts/resource-admission-test.mjs +0 -792
- package/scripts/result-classification-test.mjs +0 -75
- package/scripts/rg-runner-test.mjs +0 -240
- package/scripts/routing-corpus-test.mjs +0 -349
- package/scripts/sanitize-tool-pairs-test.mjs +0 -260
- package/scripts/session-bench-cache-break-test.mjs +0 -102
- package/scripts/session-bench.mjs +0 -1708
- package/scripts/session-context-bench.mjs +0 -344
- package/scripts/session-heartbeat-lifecycle-test.mjs +0 -68
- package/scripts/session-ingest-compaction-smoke.mjs +0 -279
- package/scripts/session-ingest-smoke.mjs +0 -177
- package/scripts/session-orphan-sweep-test.mjs +0 -109
- package/scripts/set-effort-config-test.mjs +0 -41
- package/scripts/shell-failure-diagnostics-test.mjs +0 -280
- package/scripts/shell-hardening-test.mjs +0 -209
- package/scripts/shell-jobs-windows-hide-test.mjs +0 -164
- package/scripts/ship-mode-test.mjs +0 -98
- package/scripts/smoke-loop-failure-summary-test.mjs +0 -38
- package/scripts/smoke-loop-failure-summary.mjs +0 -16
- package/scripts/smoke-loop-report.mjs +0 -221
- package/scripts/smoke-loop.mjs +0 -202
- package/scripts/smoke-runtime-negative.ps1 +0 -106
- package/scripts/statusline-quota-hysteresis-test.mjs +0 -62
- package/scripts/steering-drain-buckets-test.mjs +0 -467
- package/scripts/steering-fold-provenance-test.mjs +0 -71
- package/scripts/streaming-tail-window-test.mjs +0 -175
- package/scripts/submit-commandbusy-race-test.mjs +0 -257
- package/scripts/task-bench.mjs +0 -205
- package/scripts/terminal-bench-isolation-guards-test.mjs +0 -102
- package/scripts/termio-input-smoke.mjs +0 -199
- package/scripts/tool-result-hook-test.mjs +0 -48
- package/scripts/tool-smoke.mjs +0 -2453
- package/scripts/tool-tui-presentation-test.mjs +0 -286
- package/scripts/toolcall-args-test.mjs +0 -239
- package/scripts/tui-ambiguous-width-test.mjs +0 -113
- package/scripts/tui-background-failure-smoke.mjs +0 -73
- package/scripts/tui-perf-run.ps1 +0 -26
- package/scripts/tui-render-smoke.mjs +0 -90
- package/scripts/tui-runtime-load-bench-entry.jsx +0 -608
- package/scripts/tui-runtime-load-bench.mjs +0 -50
- package/scripts/tui-store-frame-batch-test.mjs +0 -99
- package/scripts/tui-transcript-jitter-harness-entry.jsx +0 -383
- package/scripts/tui-transcript-perf-test.mjs +0 -934
- package/scripts/usage-metrics-epoch-smoke.mjs +0 -114
- package/scripts/verify-release-assets-test.mjs +0 -281
- package/scripts/web-fetch-routing-test.mjs +0 -158
- package/scripts/webhook-smoke.mjs +0 -201
- package/scripts/windows-hide-spawn-options-test.mjs +0 -19
- package/scripts/worker-notify-rejection-test.mjs +0 -51
- package/scripts/write-backpressure-test.mjs +0 -147
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
loginOAuth as loginGrokOAuth,
|
|
29
29
|
} from '../runtime/agent/orchestrator/providers/grok-oauth.mjs';
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
const API_PROVIDERS = Object.freeze([
|
|
32
32
|
Object.freeze({ id: 'openai', name: 'OpenAI API', env: 'OPENAI_API_KEY', url: 'https://platform.openai.com/api-keys' }),
|
|
33
33
|
Object.freeze({ id: 'anthropic', name: 'Anthropic API', env: 'ANTHROPIC_API_KEY', url: 'https://console.anthropic.com/settings/keys' }),
|
|
34
34
|
Object.freeze({ id: 'gemini', name: 'Gemini API', env: 'GEMINI_API_KEY', url: 'https://aistudio.google.com/apikey' }),
|
|
@@ -37,7 +37,7 @@ export const API_PROVIDERS = Object.freeze([
|
|
|
37
37
|
Object.freeze({ id: 'opencode-go', name: 'OpenCode Go API', env: 'OPENCODE_API_KEY', url: 'https://opencode.ai' }),
|
|
38
38
|
]);
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
const OAUTH_PROVIDERS = Object.freeze([
|
|
41
41
|
Object.freeze({ id: 'openai-oauth', name: 'OpenAI OAuth', desc: 'Mixdog OAuth credentials', has: hasOpenAIOAuthCredentials, describe: describeOpenAIOAuthCredentials, forget: forgetOpenAIOAuthCredentials, begin: beginOpenAIOAuthLogin, login: loginOpenAIOAuth }),
|
|
42
42
|
Object.freeze({ id: 'anthropic-oauth', name: 'Anthropic OAuth', desc: 'Mixdog OAuth credentials', has: hasAnthropicOAuthCredentials, describe: describeAnthropicOAuthCredentials, forget: forgetAnthropicOAuthCredentials, begin: beginAnthropicOAuthLogin, login: loginAnthropicOAuth }),
|
|
43
43
|
Object.freeze({ id: 'grok-oauth', name: 'Grok OAuth', desc: 'Mixdog OAuth credentials (Grok Build)', has: hasGrokOAuthCredentials, describe: describeGrokOAuthCredentials, forget: forgetGrokOAuthCredentials, begin: beginGrokOAuthLogin, login: loginGrokOAuth }),
|
|
@@ -52,7 +52,7 @@ export function modelSwitchNotice() {
|
|
|
52
52
|
return 'Model saved · new sessions';
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
function compactJson(value, max = 180) {
|
|
56
56
|
let text = '';
|
|
57
57
|
try {
|
|
58
58
|
text = typeof value === 'string' ? value : JSON.stringify(value);
|
|
@@ -139,7 +139,7 @@ export function centerLine(value, columns, reserve = 0) {
|
|
|
139
139
|
return `${' '.repeat(pad)}${text}`;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
const WELCOME_PROMPT_HINTS = [
|
|
143
143
|
'Tip: /setting · Tune the runtime before the run.',
|
|
144
144
|
'Tip: /model · Pick the right brain for the job.',
|
|
145
145
|
'Tip: /workflow · Change how work gets routed.',
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Buffer } from 'node:buffer';
|
|
6
6
|
import { spawn } from 'node:child_process';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
function osc52ClipboardSequence(text) {
|
|
9
9
|
const b64 = Buffer.from(String(text ?? ''), 'utf8').toString('base64');
|
|
10
10
|
const raw = `\x1b]52;c;${b64}\x07`;
|
|
11
11
|
if (!process.env.TMUX) return raw;
|
|
@@ -31,7 +31,7 @@ function shouldSkipOsc52() {
|
|
|
31
31
|
return true;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
function writeOsc52Clipboard(text) {
|
|
35
35
|
const value = String(text ?? '');
|
|
36
36
|
if (shouldSkipOsc52()) return false;
|
|
37
37
|
if (Buffer.byteLength(value, 'utf8') > OSC52_MAX_BYTES) return false;
|
|
@@ -43,7 +43,7 @@ export function writeOsc52Clipboard(text) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
function nativeClipboardCommand(text) {
|
|
47
47
|
const value = String(text ?? '');
|
|
48
48
|
if (process.platform === 'win32') {
|
|
49
49
|
// clip.exe starts in tens of ms (vs 1s+ for powershell.exe). It reads its
|
|
@@ -77,7 +77,7 @@ export function queuedBandRows(text, width) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// Character offsets where each visual row starts (hard wrap + explicit newlines).
|
|
80
|
-
|
|
80
|
+
function visualRowStartOffsets(text, width) {
|
|
81
81
|
const value = String(text ?? '');
|
|
82
82
|
const w = Math.max(1, Math.floor(Number(width) || 1));
|
|
83
83
|
const starts = [0];
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
// Row-estimate helpers for transcript items, extracted from transcript-window.mjs.
|
|
2
|
+
import {
|
|
3
|
+
measureMarkdownRenderedRows,
|
|
4
|
+
measureStreamingMarkdownRenderedRows,
|
|
5
|
+
} from '../markdown/measure-rendered-rows.mjs';
|
|
6
|
+
import { streamingLayoutText } from '../markdown/streaming-markdown.mjs';
|
|
7
|
+
import { displayWidth } from '../display-width.mjs';
|
|
8
|
+
import { formatToolSurface, normalizeToolName, parseToolArgs, summarizeAgentSurfaceBrief } from '../../runtime/shared/tool-surface.mjs';
|
|
9
|
+
import { isBackgroundErrorOnlyBody } from '../../runtime/shared/err-text.mjs';
|
|
10
|
+
import { formatExpandedResult, wrapExpandedResultLines } from '../components/tool-output-format.mjs';
|
|
11
|
+
import {
|
|
12
|
+
formatHookDenialDetail,
|
|
13
|
+
isHookApprovalDenialToolItem,
|
|
14
|
+
shouldSuppressFullyFailedToolItem,
|
|
15
|
+
toolItemResultText,
|
|
16
|
+
} from '../transcript-tool-failures.mjs';
|
|
17
|
+
|
|
18
|
+
// Count how many terminal rows ONE logical line (no '\n') occupies once ink
|
|
19
|
+
// word-wraps it. Mirror the greedy word-wrap so the row estimate is never lower
|
|
20
|
+
// than what ink actually renders.
|
|
21
|
+
export function wrappedLineRows(line, width) {
|
|
22
|
+
const text = String(line);
|
|
23
|
+
const full = displayWidth(text);
|
|
24
|
+
if (full === 0) return 1;
|
|
25
|
+
if (full <= width) return 1;
|
|
26
|
+
let rows = 1;
|
|
27
|
+
let col = 0;
|
|
28
|
+
for (const token of text.split(/(\s+)/)) {
|
|
29
|
+
if (!token) continue;
|
|
30
|
+
const tw = displayWidth(token);
|
|
31
|
+
if (tw === 0) continue;
|
|
32
|
+
if (tw > width) {
|
|
33
|
+
// Over-long unbreakable token: ink hard-splits it across rows.
|
|
34
|
+
if (col > 0) { rows++; col = 0; }
|
|
35
|
+
rows += Math.ceil(tw / width) - 1;
|
|
36
|
+
col = tw % width || width;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (col + tw > width) { rows++; col = tw; }
|
|
40
|
+
else { col += tw; }
|
|
41
|
+
}
|
|
42
|
+
return Math.max(1, rows);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function estimateWrappedRows(text, columns, reserve = 4) {
|
|
46
|
+
const width = Math.max(8, Number(columns || 80) - reserve);
|
|
47
|
+
const lines = String(text ?? '').split('\n');
|
|
48
|
+
return Math.max(1, lines.reduce((sum, line) => sum + wrappedLineRows(line, width), 0));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const SKILL_SURFACE_NAMES = new Set([
|
|
52
|
+
'skill', 'skill_execute', 'skill_view', 'skills_list', 'use_skill',
|
|
53
|
+
]);
|
|
54
|
+
|
|
55
|
+
function isAgentResponseResultText(text) {
|
|
56
|
+
const value = String(text || '').trim();
|
|
57
|
+
if (!value) return false;
|
|
58
|
+
if (/^status:\s*(?:running|pending|queued|completed|failed|cancelled|canceled)(?:\s*·\s*task_id:\s*\S+)?$/i.test(value)) return false;
|
|
59
|
+
if (/^(?:background task\b|agent task:|task_id:)/i.test(value) && !/\n\s*\n[\s\S]*\S/.test(value)) return false;
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const BACKGROUND_TASK_TOOL_NAMES = new Set(['explore', 'search', 'shell', 'bash', 'bash_session', 'shell_command', 'task']);
|
|
64
|
+
|
|
65
|
+
function isBackgroundTaskToolName(normalizedName) {
|
|
66
|
+
return BACKGROUND_TASK_TOOL_NAMES.has(String(normalizedName || '').toLowerCase());
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function parseBackgroundTaskResultForRows(value) {
|
|
70
|
+
const text = String(value || '').trim();
|
|
71
|
+
if (!text) return null;
|
|
72
|
+
const allLines = text.split('\n');
|
|
73
|
+
const start = allLines.findIndex((line) => line.trim() === 'background task');
|
|
74
|
+
if (start < 0) return null;
|
|
75
|
+
const rest = allLines.slice(start + 1);
|
|
76
|
+
const blank = rest.findIndex((line) => !line.trim());
|
|
77
|
+
const headLines = blank >= 0 ? rest.slice(0, blank) : rest;
|
|
78
|
+
const body = blank >= 0 ? rest.slice(blank + 1).join('\n').trim() : '';
|
|
79
|
+
const fields = {};
|
|
80
|
+
for (const line of headLines) {
|
|
81
|
+
const match = /^([a-zA-Z][\w-]*):\s*(.*)$/.exec(line.trim());
|
|
82
|
+
if (match) fields[match[1].toLowerCase()] = match[2].trim();
|
|
83
|
+
}
|
|
84
|
+
const status = String(fields.status || '').toLowerCase();
|
|
85
|
+
const error = String(fields.error || '').trim();
|
|
86
|
+
const errorOnlyBody = isBackgroundErrorOnlyBody(body, error);
|
|
87
|
+
return {
|
|
88
|
+
status,
|
|
89
|
+
body,
|
|
90
|
+
error,
|
|
91
|
+
errorOnlyBody,
|
|
92
|
+
hasResponse: Boolean(body) && !errorOnlyBody && !/^(running|pending|queued)$/i.test(status),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function isBackgroundTaskResponseArgsForRows(normalizedName, args = {}) {
|
|
97
|
+
if (!isBackgroundTaskToolName(normalizedName)) return false;
|
|
98
|
+
const type = String(args?.type || args?.action || '').toLowerCase();
|
|
99
|
+
const status = String(args?.status || '').toLowerCase();
|
|
100
|
+
return type === 'result' || type === 'completion' || (/^(completed|cancelled|canceled)$/i.test(status) && Boolean(args?.task_id));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ToolExecution derives its background-task classification from
|
|
104
|
+
// formatToolSurface(name, args).args — parseToolArgs(args). The row estimate /
|
|
105
|
+
// variant key must read the SAME parsed shape. parseToolArgs already guards
|
|
106
|
+
// malformed input (returns {} / { value } without throwing).
|
|
107
|
+
// Hot path: the rows helpers re-read args many times per item per index pass,
|
|
108
|
+
// and parseToolArgs JSON.parses the same raw string each call (6.6% of frame
|
|
109
|
+
// CPU in the 11k-item load bench). Raw-string-keyed memo; entries are treated
|
|
110
|
+
// as READ-ONLY by every caller in this module.
|
|
111
|
+
const parsedArgsByRaw = new Map(); // raw args string → parsed object
|
|
112
|
+
const PARSED_ARGS_CACHE_MAX = 1024;
|
|
113
|
+
export function backgroundArgsForRows(rawArgs) {
|
|
114
|
+
if (typeof rawArgs === 'string' && rawArgs) {
|
|
115
|
+
let parsed = parsedArgsByRaw.get(rawArgs);
|
|
116
|
+
if (parsed === undefined) {
|
|
117
|
+
const raw = parseToolArgs(rawArgs);
|
|
118
|
+
parsed = raw && typeof raw === 'object' ? raw : {};
|
|
119
|
+
if (parsedArgsByRaw.size >= PARSED_ARGS_CACHE_MAX) {
|
|
120
|
+
parsedArgsByRaw.delete(parsedArgsByRaw.keys().next().value);
|
|
121
|
+
}
|
|
122
|
+
parsedArgsByRaw.set(rawArgs, parsed);
|
|
123
|
+
}
|
|
124
|
+
return parsed;
|
|
125
|
+
}
|
|
126
|
+
const parsed = parseToolArgs(rawArgs);
|
|
127
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function toolItemPendingForRows(item) {
|
|
131
|
+
const count = Math.max(1, Number(item?.count || 1));
|
|
132
|
+
const done = Math.max(0, Math.min(count, Number(item?.completedCount || (item?.result == null ? 0 : count))));
|
|
133
|
+
return done < count;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export const LEADING_STATUS_MARKER_LINE_RE = /^\[status:\s*[^\]]*\]\s*$/i;
|
|
137
|
+
|
|
138
|
+
function stripLeadingStatusMarkerFromTextForRows(text) {
|
|
139
|
+
const lines = String(text || '').split('\n');
|
|
140
|
+
if (lines.length > 0 && LEADING_STATUS_MARKER_LINE_RE.test(String(lines[0] ?? '').trim())) lines.shift();
|
|
141
|
+
return lines.join('\n');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function toolDisplayedResultTextForRows(item) {
|
|
145
|
+
const rt = item?.result == null ? '' : String(item.result).replace(/\s+$/, '');
|
|
146
|
+
const bgArgs = backgroundArgsForRows(item?.args);
|
|
147
|
+
const backgroundError = String(bgArgs.error || '');
|
|
148
|
+
const errorOnlyResult = Boolean(rt) && isBackgroundErrorOnlyBody(rt, backgroundError);
|
|
149
|
+
const normalizedName = String(normalizeToolName(item?.name) || '').toLowerCase();
|
|
150
|
+
if (!toolItemPendingForRows(item) && isBackgroundTaskToolName(normalizedName)) {
|
|
151
|
+
const meta = parseBackgroundTaskResultForRows(rt);
|
|
152
|
+
if (meta?.hasResponse && String(meta.body || '').trim()) {
|
|
153
|
+
return stripLeadingStatusMarkerFromTextForRows(String(meta.body));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return stripLeadingStatusMarkerFromTextForRows(errorOnlyResult ? '' : (rt || ''));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function toolHasDisplayResultForRows(item) {
|
|
160
|
+
const rt = item.result == null ? '' : String(item.result).replace(/\s+$/, '');
|
|
161
|
+
const trimmed = String(rt || '').trim();
|
|
162
|
+
if (!trimmed) return false;
|
|
163
|
+
const bgArgs = backgroundArgsForRows(item.args);
|
|
164
|
+
if (isBackgroundErrorOnlyBody(trimmed, bgArgs.error || '')) return false;
|
|
165
|
+
const normalizedName = String(normalizeToolName(item.name) || '').toLowerCase();
|
|
166
|
+
if (isBackgroundTaskToolName(normalizedName)) {
|
|
167
|
+
const meta = parseBackgroundTaskResultForRows(trimmed);
|
|
168
|
+
if (meta) return Boolean(meta.hasResponse && String(meta.body || '').trim());
|
|
169
|
+
}
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function toolExpandedRawTextForRows(item, rawRt) {
|
|
174
|
+
if (item?.aggregate) return rawRt;
|
|
175
|
+
if (item?.agentResponseAggregate) return rawRt;
|
|
176
|
+
const hasDisplayResult = toolHasDisplayResultForRows(item);
|
|
177
|
+
if (hasDisplayResult) return toolDisplayedResultTextForRows(item);
|
|
178
|
+
return stripLeadingStatusMarkerFromTextForRows(rawRt || '');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function toolHeaderFailureOnlyForRows(item, normalizedName, hasDisplayResult) {
|
|
182
|
+
if (hasDisplayResult) return false;
|
|
183
|
+
const bgArgs = backgroundArgsForRows(item.args);
|
|
184
|
+
const error = String(bgArgs.error || '').trim();
|
|
185
|
+
if (!error) return false;
|
|
186
|
+
if (normalizedName === 'agent') {
|
|
187
|
+
const pending = toolItemPendingForRows(item);
|
|
188
|
+
const isError = Boolean(item.isError);
|
|
189
|
+
const agentHeaderFailure = !pending && isError && error && !hasDisplayResult;
|
|
190
|
+
if (!agentHeaderFailure) return false;
|
|
191
|
+
const displayedResultText = toolDisplayedResultTextForRows(item);
|
|
192
|
+
const rt = item.result == null ? '' : String(item.result).replace(/\s+$/, '');
|
|
193
|
+
const isAgentResult = !pending && hasDisplayResult;
|
|
194
|
+
const isAgentResponse = isAgentResult && isAgentResponseResultText(rt);
|
|
195
|
+
const briefRaw = summarizeAgentSurfaceBrief(item.name, bgArgs, displayedResultText, {
|
|
196
|
+
isError,
|
|
197
|
+
isResponse: isAgentResponse,
|
|
198
|
+
});
|
|
199
|
+
const agentSurfaceBriefNonempty = Boolean(String(briefRaw || '').trim());
|
|
200
|
+
return !agentSurfaceBriefNonempty;
|
|
201
|
+
}
|
|
202
|
+
if (!isBackgroundTaskToolName(normalizedName) || !bgArgs.task_id) return false;
|
|
203
|
+
if (isBackgroundTaskResponseArgsForRows(normalizedName, bgArgs)) return false;
|
|
204
|
+
const status = String(bgArgs.status || '').toLowerCase();
|
|
205
|
+
return /^(failed|error|timeout|cancelled|canceled|killed)$/i.test(status);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function toolArgPathForRows(item) {
|
|
209
|
+
const a = backgroundArgsForRows(item?.args);
|
|
210
|
+
return a?.path ?? a?.file_path ?? a?.file ?? '';
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Mirror ToolExecution's collapsed agent-card rule: an agent surface collapses
|
|
214
|
+
// to a SINGLE header row unless the detail row carries failure info (the call
|
|
215
|
+
// errored, or the brief/status reads as a failure/cancel). Pending agent cards
|
|
216
|
+
// never carry failure info yet, so they collapse to one row. A header-failure-
|
|
217
|
+
// only card is handled earlier by toolHeaderFailureOnlyForRows (also one row).
|
|
218
|
+
function agentCardKeepsCollapsedDetailForRows(item, normalizedName) {
|
|
219
|
+
if (normalizedName !== 'agent') return false;
|
|
220
|
+
if (toolItemPendingForRows(item)) return false;
|
|
221
|
+
const bgArgs = backgroundArgsForRows(item.args);
|
|
222
|
+
const isError = Boolean(item.isError);
|
|
223
|
+
const hasDisplayResult = toolHasDisplayResultForRows(item);
|
|
224
|
+
const displayedResultText = toolDisplayedResultTextForRows(item);
|
|
225
|
+
const rt = item.result == null ? '' : String(item.result).replace(/\s+$/, '');
|
|
226
|
+
const isAgentResponse = hasDisplayResult && isAgentResponseResultText(rt);
|
|
227
|
+
const briefRaw = summarizeAgentSurfaceBrief(item.name, bgArgs, displayedResultText, {
|
|
228
|
+
isError,
|
|
229
|
+
isResponse: isAgentResponse,
|
|
230
|
+
});
|
|
231
|
+
const brief = String(briefRaw || '').trim();
|
|
232
|
+
const status = String(bgArgs.status || '').toLowerCase();
|
|
233
|
+
const failureText = /\b(cancelled|canceled|failed)\b/i.test(brief)
|
|
234
|
+
|| /^(failed|error|timeout|cancelled|canceled|killed)$/i.test(status);
|
|
235
|
+
const agentHeaderFailure = isError && String(bgArgs.error || '').trim() && !hasDisplayResult;
|
|
236
|
+
if (agentHeaderFailure && !brief) return false;
|
|
237
|
+
return isError || failureText;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function isShellSurfaceForRows(normalizedName, label = '') {
|
|
241
|
+
const n = String(normalizedName || '').toLowerCase();
|
|
242
|
+
const l = String(label || '').toLowerCase();
|
|
243
|
+
return n === 'shell' || n === 'bash' || n === 'bash_session'
|
|
244
|
+
|| n === 'shell_command' || n === 'job_wait' || l === 'run';
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function isShellSurfaceForToolItem(item, normalizedName) {
|
|
248
|
+
const label = formatToolSurface(item?.name, item?.args)?.label || '';
|
|
249
|
+
return isShellSurfaceForRows(normalizedName, label);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// EXPANDED tool bodies are post-processed by formatExpandedResult; the row
|
|
253
|
+
// estimate MUST run the SAME pipeline. Pass pathArg/isShell so the count matches.
|
|
254
|
+
function estimateToolRenderedResultRows(value, { pathArg = '', isShell = false, columns = 80 } = {}) {
|
|
255
|
+
const text = String(value ?? '').replace(/\s+$/, '');
|
|
256
|
+
if (!text) return 1;
|
|
257
|
+
try {
|
|
258
|
+
const logical = formatExpandedResult(text, { pathArg, isShell });
|
|
259
|
+
const rows = wrapExpandedResultLines(logical, columns, { isShell }).length;
|
|
260
|
+
return Math.max(1, rows);
|
|
261
|
+
} catch {
|
|
262
|
+
return Math.max(1, text.split('\n').length);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function estimateTranscriptItemRows(item, columns, toolOutputExpanded, attachedTool = false) {
|
|
267
|
+
if (!item) return 1;
|
|
268
|
+
switch (item.kind) {
|
|
269
|
+
case 'user':
|
|
270
|
+
return 1 + estimateWrappedRows(item.text, columns, 4);
|
|
271
|
+
case 'assistant':
|
|
272
|
+
// marginTop={1} (AssistantMessage <Box>) + rendered body height.
|
|
273
|
+
return 1 + (item.streaming
|
|
274
|
+
? measureStreamingMarkdownRenderedRows(item.text, columns, item.id)
|
|
275
|
+
: measureMarkdownRenderedRows(item.text, columns));
|
|
276
|
+
case 'tool': {
|
|
277
|
+
// Consecutive tool cards render attached (marginTop 0) — see
|
|
278
|
+
// TranscriptItem's attached={prevKind === 'tool'}.
|
|
279
|
+
const TOOL_MARGIN_TOP = attachedTool ? 0 : 1;
|
|
280
|
+
if (shouldSuppressFullyFailedToolItem(item)) return 0;
|
|
281
|
+
if (isHookApprovalDenialToolItem(item)) {
|
|
282
|
+
const detail = formatHookDenialDetail(toolItemResultText(item));
|
|
283
|
+
return TOOL_MARGIN_TOP + 1 + (detail ? 1 : 0);
|
|
284
|
+
}
|
|
285
|
+
const normalizedName = String(normalizeToolName(item.name) || '').toLowerCase();
|
|
286
|
+
const count = Math.max(1, Number(item.count || 1));
|
|
287
|
+
const done = Math.max(0, Math.min(count, Number(item.completedCount || (item.result == null ? 0 : count))));
|
|
288
|
+
const pending = done < count;
|
|
289
|
+
const isSkillSurface = !item.aggregate && SKILL_SURFACE_NAMES.has(normalizedName);
|
|
290
|
+
const isAgentSurface = normalizedName === 'agent';
|
|
291
|
+
const rt = item.result == null ? null : String(item.result).replace(/\s+$/, '');
|
|
292
|
+
const rawRt = item.rawResult == null ? null : String(item.rawResult).replace(/\s+$/, '');
|
|
293
|
+
const hasResult = item.result != null && Boolean(String(rt || '').trim());
|
|
294
|
+
const hasRawResult = item.rawResult != null && Boolean(String(rawRt || '').trim());
|
|
295
|
+
const expanded = toolOutputExpanded || item.expanded;
|
|
296
|
+
if (!expanded || pending) {
|
|
297
|
+
if (isSkillSurface) return TOOL_MARGIN_TOP + 1;
|
|
298
|
+
const hasDisplayResult = toolHasDisplayResultForRows(item);
|
|
299
|
+
if (toolHeaderFailureOnlyForRows(item, normalizedName, hasDisplayResult)) {
|
|
300
|
+
return TOOL_MARGIN_TOP + 1;
|
|
301
|
+
}
|
|
302
|
+
if (isAgentSurface) {
|
|
303
|
+
return agentCardKeepsCollapsedDetailForRows(item, normalizedName)
|
|
304
|
+
? TOOL_MARGIN_TOP + 1 + 1
|
|
305
|
+
: TOOL_MARGIN_TOP + 1;
|
|
306
|
+
}
|
|
307
|
+
return TOOL_MARGIN_TOP + 1 + 1;
|
|
308
|
+
}
|
|
309
|
+
if (hasRawResult) {
|
|
310
|
+
const estimateText = toolExpandedRawTextForRows(item, rawRt);
|
|
311
|
+
const rawOpts = item.aggregate
|
|
312
|
+
? {}
|
|
313
|
+
: { pathArg: toolArgPathForRows(item), isShell: isShellSurfaceForToolItem(item, normalizedName) };
|
|
314
|
+
return TOOL_MARGIN_TOP + 1 + estimateToolRenderedResultRows(estimateText, { ...rawOpts, columns });
|
|
315
|
+
}
|
|
316
|
+
if (isAgentSurface && !hasResult) {
|
|
317
|
+
return agentCardKeepsCollapsedDetailForRows(item, normalizedName)
|
|
318
|
+
? TOOL_MARGIN_TOP + 1 + 1
|
|
319
|
+
: TOOL_MARGIN_TOP + 1;
|
|
320
|
+
}
|
|
321
|
+
if (isSkillSurface && !hasResult) return TOOL_MARGIN_TOP + 1;
|
|
322
|
+
if (item.aggregate) {
|
|
323
|
+
if (hasRawResult) {
|
|
324
|
+
const resultRows = estimateToolRenderedResultRows(rawRt, { columns });
|
|
325
|
+
return TOOL_MARGIN_TOP + 1 + resultRows;
|
|
326
|
+
}
|
|
327
|
+
return TOOL_MARGIN_TOP + 1 + 1;
|
|
328
|
+
} else {
|
|
329
|
+
const backgroundMeta = hasResult && isBackgroundTaskToolName(normalizedName)
|
|
330
|
+
? parseBackgroundTaskResultForRows(rt)
|
|
331
|
+
: null;
|
|
332
|
+
const isBackgroundResult = hasResult && isBackgroundTaskToolName(normalizedName);
|
|
333
|
+
const isBackgroundResponse = isBackgroundResult
|
|
334
|
+
&& (backgroundMeta?.hasResponse || isBackgroundTaskResponseArgsForRows(normalizedName, backgroundArgsForRows(item.args)));
|
|
335
|
+
const isBackgroundMetadataResult = isBackgroundResult && !isBackgroundResponse && Boolean(backgroundMeta);
|
|
336
|
+
if (isBackgroundMetadataResult) {
|
|
337
|
+
const hasDisplayResult = toolHasDisplayResultForRows(item);
|
|
338
|
+
if (toolHeaderFailureOnlyForRows(item, normalizedName, hasDisplayResult)) {
|
|
339
|
+
return TOOL_MARGIN_TOP + 1;
|
|
340
|
+
}
|
|
341
|
+
return isSkillSurface ? TOOL_MARGIN_TOP + 1 : TOOL_MARGIN_TOP + 1 + 1;
|
|
342
|
+
}
|
|
343
|
+
const resultText = backgroundMeta?.hasResponse ? backgroundMeta.body : rt;
|
|
344
|
+
const resultRows = estimateToolRenderedResultRows(resultText, {
|
|
345
|
+
pathArg: toolArgPathForRows(item),
|
|
346
|
+
isShell: isShellSurfaceForToolItem(item, normalizedName),
|
|
347
|
+
columns,
|
|
348
|
+
});
|
|
349
|
+
return TOOL_MARGIN_TOP + 1 + resultRows;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
case 'notice':
|
|
353
|
+
return 1 + estimateWrappedRows(item.text, columns, 6);
|
|
354
|
+
case 'turndone':
|
|
355
|
+
case 'statusdone':
|
|
356
|
+
return 2;
|
|
357
|
+
default:
|
|
358
|
+
return 1;
|
|
359
|
+
}
|
|
360
|
+
}
|