mixdog 0.9.62 → 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
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
shouldSuppressFullyFailedToolItem,
|
|
25
25
|
toolItemResultText,
|
|
26
26
|
} from '../transcript-tool-failures.mjs';
|
|
27
|
+
import { backgroundArgsForRows, estimateTranscriptItemRows } from './transcript-row-estimate.mjs';
|
|
27
28
|
|
|
28
29
|
function positiveIntEnv(name, fallback) {
|
|
29
30
|
const value = Number(process.env[name]);
|
|
@@ -59,7 +60,7 @@ export const TRANSCRIPT_WINDOW_MAX_ITEMS = positiveIntEnv('MIXDOG_TUI_TRANSCRIPT
|
|
|
59
60
|
// during streaming (bench: 80→20 mounted rows ≈ 4.07ms/render, 109 CPU-ms/s).
|
|
60
61
|
// Env-tunable for A/B / revert.
|
|
61
62
|
export const TRANSCRIPT_WINDOW_TAIL_OVERSCAN_ROWS = positiveIntEnv('MIXDOG_TUI_TRANSCRIPT_TAIL_OVERSCAN_ROWS', 4);
|
|
62
|
-
|
|
63
|
+
const TRANSCRIPT_WINDOW_TAIL_MAX_ITEMS = positiveIntEnv('MIXDOG_TUI_TRANSCRIPT_WINDOW_TAIL_ITEMS', 20);
|
|
63
64
|
export const SELECTION_PAINT_INTERVAL_MS = positiveIntEnv('MIXDOG_TUI_SELECTION_PAINT_MS', 24);
|
|
64
65
|
// Frame-coalesce edge-drag auto-scroll + wheel scroll: both paths accumulate
|
|
65
66
|
// deltas into one pending total and flush via a single scrollTranscriptRows
|
|
@@ -106,351 +107,8 @@ export function comparePoints(a, b) {
|
|
|
106
107
|
return 0;
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
// Count how many terminal rows ONE logical line (no '\n') occupies once ink
|
|
110
|
-
// word-wraps it. Mirror the greedy word-wrap so the row estimate is never lower
|
|
111
|
-
// than what ink actually renders.
|
|
112
|
-
function wrappedLineRows(line, width) {
|
|
113
|
-
const text = String(line);
|
|
114
|
-
const full = displayWidth(text);
|
|
115
|
-
if (full === 0) return 1;
|
|
116
|
-
if (full <= width) return 1;
|
|
117
|
-
let rows = 1;
|
|
118
|
-
let col = 0;
|
|
119
|
-
for (const token of text.split(/(\s+)/)) {
|
|
120
|
-
if (!token) continue;
|
|
121
|
-
const tw = displayWidth(token);
|
|
122
|
-
if (tw === 0) continue;
|
|
123
|
-
if (tw > width) {
|
|
124
|
-
// Over-long unbreakable token: ink hard-splits it across rows.
|
|
125
|
-
if (col > 0) { rows++; col = 0; }
|
|
126
|
-
rows += Math.ceil(tw / width) - 1;
|
|
127
|
-
col = tw % width || width;
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
if (col + tw > width) { rows++; col = tw; }
|
|
131
|
-
else { col += tw; }
|
|
132
|
-
}
|
|
133
|
-
return Math.max(1, rows);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function estimateWrappedRows(text, columns, reserve = 4) {
|
|
137
|
-
const width = Math.max(8, Number(columns || 80) - reserve);
|
|
138
|
-
const lines = String(text ?? '').split('\n');
|
|
139
|
-
return Math.max(1, lines.reduce((sum, line) => sum + wrappedLineRows(line, width), 0));
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const SKILL_SURFACE_NAMES = new Set([
|
|
143
|
-
'skill', 'skill_execute', 'skill_view', 'skills_list', 'use_skill',
|
|
144
|
-
]);
|
|
145
|
-
|
|
146
|
-
function isAgentResponseResultText(text) {
|
|
147
|
-
const value = String(text || '').trim();
|
|
148
|
-
if (!value) return false;
|
|
149
|
-
if (/^status:\s*(?:running|pending|queued|completed|failed|cancelled|canceled)(?:\s*·\s*task_id:\s*\S+)?$/i.test(value)) return false;
|
|
150
|
-
if (/^(?:background task\b|agent task:|task_id:)/i.test(value) && !/\n\s*\n[\s\S]*\S/.test(value)) return false;
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const BACKGROUND_TASK_TOOL_NAMES = new Set(['explore', 'search', 'shell', 'bash', 'bash_session', 'shell_command', 'task']);
|
|
155
|
-
|
|
156
|
-
function isBackgroundTaskToolName(normalizedName) {
|
|
157
|
-
return BACKGROUND_TASK_TOOL_NAMES.has(String(normalizedName || '').toLowerCase());
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function parseBackgroundTaskResultForRows(value) {
|
|
161
|
-
const text = String(value || '').trim();
|
|
162
|
-
if (!text) return null;
|
|
163
|
-
const allLines = text.split('\n');
|
|
164
|
-
const start = allLines.findIndex((line) => line.trim() === 'background task');
|
|
165
|
-
if (start < 0) return null;
|
|
166
|
-
const rest = allLines.slice(start + 1);
|
|
167
|
-
const blank = rest.findIndex((line) => !line.trim());
|
|
168
|
-
const headLines = blank >= 0 ? rest.slice(0, blank) : rest;
|
|
169
|
-
const body = blank >= 0 ? rest.slice(blank + 1).join('\n').trim() : '';
|
|
170
|
-
const fields = {};
|
|
171
|
-
for (const line of headLines) {
|
|
172
|
-
const match = /^([a-zA-Z][\w-]*):\s*(.*)$/.exec(line.trim());
|
|
173
|
-
if (match) fields[match[1].toLowerCase()] = match[2].trim();
|
|
174
|
-
}
|
|
175
|
-
const status = String(fields.status || '').toLowerCase();
|
|
176
|
-
const error = String(fields.error || '').trim();
|
|
177
|
-
const errorOnlyBody = isBackgroundErrorOnlyBody(body, error);
|
|
178
|
-
return {
|
|
179
|
-
status,
|
|
180
|
-
body,
|
|
181
|
-
error,
|
|
182
|
-
errorOnlyBody,
|
|
183
|
-
hasResponse: Boolean(body) && !errorOnlyBody && !/^(running|pending|queued)$/i.test(status),
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function isBackgroundTaskResponseArgsForRows(normalizedName, args = {}) {
|
|
188
|
-
if (!isBackgroundTaskToolName(normalizedName)) return false;
|
|
189
|
-
const type = String(args?.type || args?.action || '').toLowerCase();
|
|
190
|
-
const status = String(args?.status || '').toLowerCase();
|
|
191
|
-
return type === 'result' || type === 'completion' || (/^(completed|cancelled|canceled)$/i.test(status) && Boolean(args?.task_id));
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// ToolExecution derives its background-task classification from
|
|
195
|
-
// formatToolSurface(name, args).args — parseToolArgs(args). The row estimate /
|
|
196
|
-
// variant key must read the SAME parsed shape. parseToolArgs already guards
|
|
197
|
-
// malformed input (returns {} / { value } without throwing).
|
|
198
|
-
// Hot path: the rows helpers re-read args many times per item per index pass,
|
|
199
|
-
// and parseToolArgs JSON.parses the same raw string each call (6.6% of frame
|
|
200
|
-
// CPU in the 11k-item load bench). Raw-string-keyed memo; entries are treated
|
|
201
|
-
// as READ-ONLY by every caller in this module.
|
|
202
|
-
const parsedArgsByRaw = new Map(); // raw args string → parsed object
|
|
203
|
-
const PARSED_ARGS_CACHE_MAX = 1024;
|
|
204
|
-
function backgroundArgsForRows(rawArgs) {
|
|
205
|
-
if (typeof rawArgs === 'string' && rawArgs) {
|
|
206
|
-
let parsed = parsedArgsByRaw.get(rawArgs);
|
|
207
|
-
if (parsed === undefined) {
|
|
208
|
-
const raw = parseToolArgs(rawArgs);
|
|
209
|
-
parsed = raw && typeof raw === 'object' ? raw : {};
|
|
210
|
-
if (parsedArgsByRaw.size >= PARSED_ARGS_CACHE_MAX) {
|
|
211
|
-
parsedArgsByRaw.delete(parsedArgsByRaw.keys().next().value);
|
|
212
|
-
}
|
|
213
|
-
parsedArgsByRaw.set(rawArgs, parsed);
|
|
214
|
-
}
|
|
215
|
-
return parsed;
|
|
216
|
-
}
|
|
217
|
-
const parsed = parseToolArgs(rawArgs);
|
|
218
|
-
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function toolItemPendingForRows(item) {
|
|
222
|
-
const count = Math.max(1, Number(item?.count || 1));
|
|
223
|
-
const done = Math.max(0, Math.min(count, Number(item?.completedCount || (item?.result == null ? 0 : count))));
|
|
224
|
-
return done < count;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
const LEADING_STATUS_MARKER_LINE_RE = /^\[status:\s*[^\]]*\]\s*$/i;
|
|
228
|
-
|
|
229
|
-
function stripLeadingStatusMarkerFromTextForRows(text) {
|
|
230
|
-
const lines = String(text || '').split('\n');
|
|
231
|
-
if (lines.length > 0 && LEADING_STATUS_MARKER_LINE_RE.test(String(lines[0] ?? '').trim())) lines.shift();
|
|
232
|
-
return lines.join('\n');
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function toolDisplayedResultTextForRows(item) {
|
|
236
|
-
const rt = item?.result == null ? '' : String(item.result).replace(/\s+$/, '');
|
|
237
|
-
const bgArgs = backgroundArgsForRows(item?.args);
|
|
238
|
-
const backgroundError = String(bgArgs.error || '');
|
|
239
|
-
const errorOnlyResult = Boolean(rt) && isBackgroundErrorOnlyBody(rt, backgroundError);
|
|
240
|
-
const normalizedName = String(normalizeToolName(item?.name) || '').toLowerCase();
|
|
241
|
-
if (!toolItemPendingForRows(item) && isBackgroundTaskToolName(normalizedName)) {
|
|
242
|
-
const meta = parseBackgroundTaskResultForRows(rt);
|
|
243
|
-
if (meta?.hasResponse && String(meta.body || '').trim()) {
|
|
244
|
-
return stripLeadingStatusMarkerFromTextForRows(String(meta.body));
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return stripLeadingStatusMarkerFromTextForRows(errorOnlyResult ? '' : (rt || ''));
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function toolHasDisplayResultForRows(item) {
|
|
251
|
-
const rt = item.result == null ? '' : String(item.result).replace(/\s+$/, '');
|
|
252
|
-
const trimmed = String(rt || '').trim();
|
|
253
|
-
if (!trimmed) return false;
|
|
254
|
-
const bgArgs = backgroundArgsForRows(item.args);
|
|
255
|
-
if (isBackgroundErrorOnlyBody(trimmed, bgArgs.error || '')) return false;
|
|
256
|
-
const normalizedName = String(normalizeToolName(item.name) || '').toLowerCase();
|
|
257
|
-
if (isBackgroundTaskToolName(normalizedName)) {
|
|
258
|
-
const meta = parseBackgroundTaskResultForRows(trimmed);
|
|
259
|
-
if (meta) return Boolean(meta.hasResponse && String(meta.body || '').trim());
|
|
260
|
-
}
|
|
261
|
-
return true;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
function toolExpandedRawTextForRows(item, rawRt) {
|
|
265
|
-
if (item?.aggregate) return rawRt;
|
|
266
|
-
if (item?.agentResponseAggregate) return rawRt;
|
|
267
|
-
const hasDisplayResult = toolHasDisplayResultForRows(item);
|
|
268
|
-
if (hasDisplayResult) return toolDisplayedResultTextForRows(item);
|
|
269
|
-
return stripLeadingStatusMarkerFromTextForRows(rawRt || '');
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
function toolHeaderFailureOnlyForRows(item, normalizedName, hasDisplayResult) {
|
|
273
|
-
if (hasDisplayResult) return false;
|
|
274
|
-
const bgArgs = backgroundArgsForRows(item.args);
|
|
275
|
-
const error = String(bgArgs.error || '').trim();
|
|
276
|
-
if (!error) return false;
|
|
277
|
-
if (normalizedName === 'agent') {
|
|
278
|
-
const pending = toolItemPendingForRows(item);
|
|
279
|
-
const isError = Boolean(item.isError);
|
|
280
|
-
const agentHeaderFailure = !pending && isError && error && !hasDisplayResult;
|
|
281
|
-
if (!agentHeaderFailure) return false;
|
|
282
|
-
const displayedResultText = toolDisplayedResultTextForRows(item);
|
|
283
|
-
const rt = item.result == null ? '' : String(item.result).replace(/\s+$/, '');
|
|
284
|
-
const isAgentResult = !pending && hasDisplayResult;
|
|
285
|
-
const isAgentResponse = isAgentResult && isAgentResponseResultText(rt);
|
|
286
|
-
const briefRaw = summarizeAgentSurfaceBrief(item.name, bgArgs, displayedResultText, {
|
|
287
|
-
isError,
|
|
288
|
-
isResponse: isAgentResponse,
|
|
289
|
-
});
|
|
290
|
-
const agentSurfaceBriefNonempty = Boolean(String(briefRaw || '').trim());
|
|
291
|
-
return !agentSurfaceBriefNonempty;
|
|
292
|
-
}
|
|
293
|
-
if (!isBackgroundTaskToolName(normalizedName) || !bgArgs.task_id) return false;
|
|
294
|
-
if (isBackgroundTaskResponseArgsForRows(normalizedName, bgArgs)) return false;
|
|
295
|
-
const status = String(bgArgs.status || '').toLowerCase();
|
|
296
|
-
return /^(failed|error|timeout|cancelled|canceled|killed)$/i.test(status);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function toolArgPathForRows(item) {
|
|
300
|
-
const a = backgroundArgsForRows(item?.args);
|
|
301
|
-
return a?.path ?? a?.file_path ?? a?.file ?? '';
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// Mirror ToolExecution's collapsed agent-card rule: an agent surface collapses
|
|
305
|
-
// to a SINGLE header row unless the detail row carries failure info (the call
|
|
306
|
-
// errored, or the brief/status reads as a failure/cancel). Pending agent cards
|
|
307
|
-
// never carry failure info yet, so they collapse to one row. A header-failure-
|
|
308
|
-
// only card is handled earlier by toolHeaderFailureOnlyForRows (also one row).
|
|
309
|
-
function agentCardKeepsCollapsedDetailForRows(item, normalizedName) {
|
|
310
|
-
if (normalizedName !== 'agent') return false;
|
|
311
|
-
if (toolItemPendingForRows(item)) return false;
|
|
312
|
-
const bgArgs = backgroundArgsForRows(item.args);
|
|
313
|
-
const isError = Boolean(item.isError);
|
|
314
|
-
const hasDisplayResult = toolHasDisplayResultForRows(item);
|
|
315
|
-
const displayedResultText = toolDisplayedResultTextForRows(item);
|
|
316
|
-
const rt = item.result == null ? '' : String(item.result).replace(/\s+$/, '');
|
|
317
|
-
const isAgentResponse = hasDisplayResult && isAgentResponseResultText(rt);
|
|
318
|
-
const briefRaw = summarizeAgentSurfaceBrief(item.name, bgArgs, displayedResultText, {
|
|
319
|
-
isError,
|
|
320
|
-
isResponse: isAgentResponse,
|
|
321
|
-
});
|
|
322
|
-
const brief = String(briefRaw || '').trim();
|
|
323
|
-
const status = String(bgArgs.status || '').toLowerCase();
|
|
324
|
-
const failureText = /\b(cancelled|canceled|failed)\b/i.test(brief)
|
|
325
|
-
|| /^(failed|error|timeout|cancelled|canceled|killed)$/i.test(status);
|
|
326
|
-
const agentHeaderFailure = isError && String(bgArgs.error || '').trim() && !hasDisplayResult;
|
|
327
|
-
if (agentHeaderFailure && !brief) return false;
|
|
328
|
-
return isError || failureText;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
function isShellSurfaceForRows(normalizedName, label = '') {
|
|
332
|
-
const n = String(normalizedName || '').toLowerCase();
|
|
333
|
-
const l = String(label || '').toLowerCase();
|
|
334
|
-
return n === 'shell' || n === 'bash' || n === 'bash_session'
|
|
335
|
-
|| n === 'shell_command' || n === 'job_wait' || l === 'run';
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function isShellSurfaceForToolItem(item, normalizedName) {
|
|
339
|
-
const label = formatToolSurface(item?.name, item?.args)?.label || '';
|
|
340
|
-
return isShellSurfaceForRows(normalizedName, label);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
// EXPANDED tool bodies are post-processed by formatExpandedResult; the row
|
|
344
|
-
// estimate MUST run the SAME pipeline. Pass pathArg/isShell so the count matches.
|
|
345
|
-
function estimateToolRenderedResultRows(value, { pathArg = '', isShell = false, columns = 80 } = {}) {
|
|
346
|
-
const text = String(value ?? '').replace(/\s+$/, '');
|
|
347
|
-
if (!text) return 1;
|
|
348
|
-
try {
|
|
349
|
-
const logical = formatExpandedResult(text, { pathArg, isShell });
|
|
350
|
-
const rows = wrapExpandedResultLines(logical, columns, { isShell }).length;
|
|
351
|
-
return Math.max(1, rows);
|
|
352
|
-
} catch {
|
|
353
|
-
return Math.max(1, text.split('\n').length);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
function estimateTranscriptItemRows(item, columns, toolOutputExpanded, attachedTool = false) {
|
|
358
|
-
if (!item) return 1;
|
|
359
|
-
switch (item.kind) {
|
|
360
|
-
case 'user':
|
|
361
|
-
return 1 + estimateWrappedRows(item.text, columns, 4);
|
|
362
|
-
case 'assistant':
|
|
363
|
-
// marginTop={1} (AssistantMessage <Box>) + rendered body height.
|
|
364
|
-
return 1 + (item.streaming
|
|
365
|
-
? measureStreamingMarkdownRenderedRows(item.text, columns, item.id)
|
|
366
|
-
: measureMarkdownRenderedRows(item.text, columns));
|
|
367
|
-
case 'tool': {
|
|
368
|
-
// Consecutive tool cards render attached (marginTop 0) — see
|
|
369
|
-
// TranscriptItem's attached={prevKind === 'tool'}.
|
|
370
|
-
const TOOL_MARGIN_TOP = attachedTool ? 0 : 1;
|
|
371
|
-
if (shouldSuppressFullyFailedToolItem(item)) return 0;
|
|
372
|
-
if (isHookApprovalDenialToolItem(item)) {
|
|
373
|
-
const detail = formatHookDenialDetail(toolItemResultText(item));
|
|
374
|
-
return TOOL_MARGIN_TOP + 1 + (detail ? 1 : 0);
|
|
375
|
-
}
|
|
376
|
-
const normalizedName = String(normalizeToolName(item.name) || '').toLowerCase();
|
|
377
|
-
const count = Math.max(1, Number(item.count || 1));
|
|
378
|
-
const done = Math.max(0, Math.min(count, Number(item.completedCount || (item.result == null ? 0 : count))));
|
|
379
|
-
const pending = done < count;
|
|
380
|
-
const isSkillSurface = !item.aggregate && SKILL_SURFACE_NAMES.has(normalizedName);
|
|
381
|
-
const isAgentSurface = normalizedName === 'agent';
|
|
382
|
-
const rt = item.result == null ? null : String(item.result).replace(/\s+$/, '');
|
|
383
|
-
const rawRt = item.rawResult == null ? null : String(item.rawResult).replace(/\s+$/, '');
|
|
384
|
-
const hasResult = item.result != null && Boolean(String(rt || '').trim());
|
|
385
|
-
const hasRawResult = item.rawResult != null && Boolean(String(rawRt || '').trim());
|
|
386
|
-
const expanded = toolOutputExpanded || item.expanded;
|
|
387
|
-
if (!expanded || pending) {
|
|
388
|
-
if (isSkillSurface) return TOOL_MARGIN_TOP + 1;
|
|
389
|
-
const hasDisplayResult = toolHasDisplayResultForRows(item);
|
|
390
|
-
if (toolHeaderFailureOnlyForRows(item, normalizedName, hasDisplayResult)) {
|
|
391
|
-
return TOOL_MARGIN_TOP + 1;
|
|
392
|
-
}
|
|
393
|
-
if (isAgentSurface) {
|
|
394
|
-
return agentCardKeepsCollapsedDetailForRows(item, normalizedName)
|
|
395
|
-
? TOOL_MARGIN_TOP + 1 + 1
|
|
396
|
-
: TOOL_MARGIN_TOP + 1;
|
|
397
|
-
}
|
|
398
|
-
return TOOL_MARGIN_TOP + 1 + 1;
|
|
399
|
-
}
|
|
400
|
-
if (hasRawResult) {
|
|
401
|
-
const estimateText = toolExpandedRawTextForRows(item, rawRt);
|
|
402
|
-
const rawOpts = item.aggregate
|
|
403
|
-
? {}
|
|
404
|
-
: { pathArg: toolArgPathForRows(item), isShell: isShellSurfaceForToolItem(item, normalizedName) };
|
|
405
|
-
return TOOL_MARGIN_TOP + 1 + estimateToolRenderedResultRows(estimateText, { ...rawOpts, columns });
|
|
406
|
-
}
|
|
407
|
-
if (isAgentSurface && !hasResult) {
|
|
408
|
-
return agentCardKeepsCollapsedDetailForRows(item, normalizedName)
|
|
409
|
-
? TOOL_MARGIN_TOP + 1 + 1
|
|
410
|
-
: TOOL_MARGIN_TOP + 1;
|
|
411
|
-
}
|
|
412
|
-
if (isSkillSurface && !hasResult) return TOOL_MARGIN_TOP + 1;
|
|
413
|
-
if (item.aggregate) {
|
|
414
|
-
if (hasRawResult) {
|
|
415
|
-
const resultRows = estimateToolRenderedResultRows(rawRt, { columns });
|
|
416
|
-
return TOOL_MARGIN_TOP + 1 + resultRows;
|
|
417
|
-
}
|
|
418
|
-
return TOOL_MARGIN_TOP + 1 + 1;
|
|
419
|
-
} else {
|
|
420
|
-
const backgroundMeta = hasResult && isBackgroundTaskToolName(normalizedName)
|
|
421
|
-
? parseBackgroundTaskResultForRows(rt)
|
|
422
|
-
: null;
|
|
423
|
-
const isBackgroundResult = hasResult && isBackgroundTaskToolName(normalizedName);
|
|
424
|
-
const isBackgroundResponse = isBackgroundResult
|
|
425
|
-
&& (backgroundMeta?.hasResponse || isBackgroundTaskResponseArgsForRows(normalizedName, backgroundArgsForRows(item.args)));
|
|
426
|
-
const isBackgroundMetadataResult = isBackgroundResult && !isBackgroundResponse && Boolean(backgroundMeta);
|
|
427
|
-
if (isBackgroundMetadataResult) {
|
|
428
|
-
const hasDisplayResult = toolHasDisplayResultForRows(item);
|
|
429
|
-
if (toolHeaderFailureOnlyForRows(item, normalizedName, hasDisplayResult)) {
|
|
430
|
-
return TOOL_MARGIN_TOP + 1;
|
|
431
|
-
}
|
|
432
|
-
return isSkillSurface ? TOOL_MARGIN_TOP + 1 : TOOL_MARGIN_TOP + 1 + 1;
|
|
433
|
-
}
|
|
434
|
-
const resultText = backgroundMeta?.hasResponse ? backgroundMeta.body : rt;
|
|
435
|
-
const resultRows = estimateToolRenderedResultRows(resultText, {
|
|
436
|
-
pathArg: toolArgPathForRows(item),
|
|
437
|
-
isShell: isShellSurfaceForToolItem(item, normalizedName),
|
|
438
|
-
columns,
|
|
439
|
-
});
|
|
440
|
-
return TOOL_MARGIN_TOP + 1 + resultRows;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
case 'notice':
|
|
444
|
-
return 1 + estimateWrappedRows(item.text, columns, 6);
|
|
445
|
-
case 'turndone':
|
|
446
|
-
case 'statusdone':
|
|
447
|
-
return 2;
|
|
448
|
-
default:
|
|
449
|
-
return 1;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
110
|
|
|
453
|
-
|
|
111
|
+
function lowerBound(values, target) {
|
|
454
112
|
let lo = 0;
|
|
455
113
|
let hi = values.length;
|
|
456
114
|
while (lo < hi) {
|
|
@@ -505,7 +163,7 @@ function fnv1a32(str) {
|
|
|
505
163
|
// Two INDEPENDENT 32-bit rolling-hash steps folded into a 64-bit signature.
|
|
506
164
|
// fnvStepA is plain FNV-1a; fnvStepB uses a distinct seed/prime + xorshift
|
|
507
165
|
// finalizer so the two chains are decorrelated (see the App.jsx history note).
|
|
508
|
-
|
|
166
|
+
function fnvStepA(hash, str) {
|
|
509
167
|
let h = hash >>> 0;
|
|
510
168
|
for (let i = 0; i < str.length; i++) {
|
|
511
169
|
h ^= str.charCodeAt(i);
|
|
@@ -514,7 +172,7 @@ export function fnvStepA(hash, str) {
|
|
|
514
172
|
return h >>> 0;
|
|
515
173
|
}
|
|
516
174
|
|
|
517
|
-
|
|
175
|
+
function fnvStepB(hash, str) {
|
|
518
176
|
let h = hash >>> 0;
|
|
519
177
|
for (let i = 0; i < str.length; i++) {
|
|
520
178
|
h = Math.imul(h ^ str.charCodeAt(i), 0x85ebca77) >>> 0;
|
|
@@ -44,7 +44,7 @@ const IS_WINDOWS_TERMINAL = Boolean(process.env.WT_SESSION);
|
|
|
44
44
|
// Windows): try/catch only sees a synchronous throw. Keep this tiny helper
|
|
45
45
|
// exported so the mode-restore failure path can be exercised without mounting
|
|
46
46
|
// the full Ink app.
|
|
47
|
-
|
|
47
|
+
function writeMouseTrackingRestore(stdout, onError) {
|
|
48
48
|
try {
|
|
49
49
|
stdout.write(MOUSE_TRACKING_ON + ALT_SCROLL_OFF, (error) => {
|
|
50
50
|
if (error) onError(error);
|
|
@@ -108,7 +108,7 @@ export function usePromptHandlers({
|
|
|
108
108
|
});
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
// Ctrl+V / Meta+V:
|
|
111
|
+
// Ctrl+V / Meta+V: clipboard.read() model. Prefer OS-clipboard TEXT
|
|
112
112
|
// (routed through the SAME fold pipeline as bracketed paste); when the
|
|
113
113
|
// clipboard holds no text, fall back to the image-attachment path. The async
|
|
114
114
|
// read result is applied by handleExternalPaste under its pasteGeneration
|
|
@@ -64,7 +64,7 @@ const AGENT_DISPLAY_NAMES = new Map([
|
|
|
64
64
|
['debugger', 'Debugger'],
|
|
65
65
|
]);
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
function titleizeAgentName(value) {
|
|
68
68
|
const text = String(value || '').trim();
|
|
69
69
|
if (!text) return '';
|
|
70
70
|
const key = text.toLowerCase().replace(/[\s_]+/g, '-');
|
|
@@ -77,7 +77,7 @@ export function titleizeAgentName(value) {
|
|
|
77
77
|
.join(' ');
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
function agentModelLabel(args) {
|
|
81
81
|
const a = args && typeof args === 'object' ? args : {};
|
|
82
82
|
const provider = String(a.provider || a.providerId || a.provider_id || '').trim();
|
|
83
83
|
const model = String(a.model || '').trim();
|
|
@@ -85,14 +85,14 @@ export function agentModelLabel(args) {
|
|
|
85
85
|
return displayModelName(model, provider, displayHint);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
function agentTagLabel(args) {
|
|
89
89
|
// The real spawn tag (engine fills parsedArgs.tag from the envelope target).
|
|
90
90
|
// Never fall back to task_id — only the human-meaningful spawn tag belongs in
|
|
91
91
|
// the header parentheses.
|
|
92
92
|
return String(args?.tag || '').trim();
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
function withModelAndTag(label, args) {
|
|
96
96
|
const model = agentModelLabel(args);
|
|
97
97
|
const tag = agentTagLabel(args);
|
|
98
98
|
const inner = [model, tag].filter(Boolean).join(', ');
|
|
@@ -101,7 +101,7 @@ export function withModelAndTag(label, args) {
|
|
|
101
101
|
|
|
102
102
|
// Append an agent name to a base action word without leaving a trailing space
|
|
103
103
|
// when the agent is unknown (no generic "Agent" fallback).
|
|
104
|
-
|
|
104
|
+
function joinActionAgent(action, agent) {
|
|
105
105
|
return agent ? `${action} ${agent}` : action;
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -180,7 +180,7 @@ export function hasAgentResponseResult(value) {
|
|
|
180
180
|
return false;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
function parseBackgroundTaskResult(value) {
|
|
184
184
|
const text = String(value || '').trim();
|
|
185
185
|
if (!text) return null;
|
|
186
186
|
const allLines = text.split('\n');
|
|
@@ -211,7 +211,7 @@ export function parseBackgroundTaskResult(value) {
|
|
|
211
211
|
};
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
|
|
214
|
+
function backgroundTaskMetaFromArgs(args = {}) {
|
|
215
215
|
const taskId = String(args.task_id || args.taskId || '').trim();
|
|
216
216
|
if (!taskId) return null;
|
|
217
217
|
return {
|
|
@@ -275,7 +275,7 @@ export function shouldPrefixSyncElapsed(normalizedName, label) {
|
|
|
275
275
|
return n === 'explore' || l === 'explore' || n === 'search' || l === 'search' || l === 'web search';
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
-
|
|
278
|
+
function backgroundTaskDisplayName(normalizedName, meta = {}) {
|
|
279
279
|
const surface = String(meta.surface || normalizedName || '').toLowerCase();
|
|
280
280
|
if (surface === 'explore') return 'Explore';
|
|
281
281
|
if (surface === 'search') return 'Search';
|
|
@@ -322,7 +322,7 @@ export function isBackgroundTaskResponseArgs(normalizedName, args = {}) {
|
|
|
322
322
|
return type === 'result' || type === 'completion' || (/^(completed|cancelled|canceled)$/i.test(status) && Boolean(args?.task_id));
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
|
|
325
|
+
function isOutputDetailTool(normalizedName, label) {
|
|
326
326
|
const n = String(normalizedName || '').toLowerCase();
|
|
327
327
|
const l = String(label || '').toLowerCase();
|
|
328
328
|
return new Set([
|
|
@@ -42,7 +42,7 @@ export function safeInlineText(value) {
|
|
|
42
42
|
.trim();
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
function normalizeCount(value) {
|
|
46
46
|
const n = Number(value || 0);
|
|
47
47
|
return Number.isFinite(n) ? Math.max(0, Math.floor(n)) : 0;
|
|
48
48
|
}
|
|
@@ -59,7 +59,7 @@ export function normalizeCountMap(value = {}) {
|
|
|
59
59
|
return out;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
function deltaColor(token) {
|
|
63
63
|
return String(token || '').startsWith('+') ? theme.success : theme.error;
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -37,7 +37,7 @@ const DEFAULT_MARKDOWN_WIDTH = 80;
|
|
|
37
37
|
// Hard ceilings so a pathological tool result can never lock the render loop.
|
|
38
38
|
// CC uses ~MAX_LINES*width*4 for the collapsed fold; for the EXPANDED body we
|
|
39
39
|
// cap total characters processed and total lines kept, with an explicit marker.
|
|
40
|
-
|
|
40
|
+
const MAX_EXPANDED_CHARS = 256 * 1024; // 256 KB of text gets per-line processing
|
|
41
41
|
const MAX_EXPANDED_LINES = 4000; // logical-line safety ceiling; physical mount cap is separate
|
|
42
42
|
const MAX_JSON_FORMAT_LENGTH = 10_000; // mirror CC's tryJsonFormatContent cap
|
|
43
43
|
const MAX_HIGHLIGHT_LINE_CHARS = 2000; // skip token-scan on absurdly long lines
|
|
@@ -58,7 +58,7 @@ const MIN_EXPANDED_BODY_COLS = 24;
|
|
|
58
58
|
// unchanged — only pathological wide/unwrapped blobs are trimmed. Env-tunable
|
|
59
59
|
// via MIXDOG_TUI_TOOL_OUTPUT_MAX_RENDER_LINES (0 disables); legacy
|
|
60
60
|
// MIXDOG_TUI_EXPANDED_MAX_ROWS is still honored when the primary var is unset.
|
|
61
|
-
|
|
61
|
+
function resolveToolOutputMaxRenderLines() {
|
|
62
62
|
const raw = process.env.MIXDOG_TUI_TOOL_OUTPUT_MAX_RENDER_LINES;
|
|
63
63
|
if (raw !== undefined && String(raw).trim() !== '') {
|
|
64
64
|
const v = Number(raw);
|
|
@@ -188,7 +188,7 @@ function normalizeToolOutputControls(text) {
|
|
|
188
188
|
|
|
189
189
|
|
|
190
190
|
/** Infer a highlighter family from a read/grep path arg's extension. */
|
|
191
|
-
|
|
191
|
+
function inferLangFamily(pathArg) {
|
|
192
192
|
const p = String(pathArg || '').trim().toLowerCase();
|
|
193
193
|
if (!p) return null;
|
|
194
194
|
const m = /\.([a-z0-9]+)$/.exec(p);
|
|
@@ -197,7 +197,7 @@ export function inferLangFamily(pathArg) {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
/** Strip ONLY underline SGR (4 / 24) — other styles/colors are preserved. */
|
|
200
|
-
|
|
200
|
+
function stripUnderlineAnsi(text) {
|
|
201
201
|
return String(text ?? '').replace(
|
|
202
202
|
// eslint-disable-next-line no-control-regex
|
|
203
203
|
/\x1b\[([0-9;]*)m/g,
|
|
@@ -211,7 +211,7 @@ export function stripUnderlineAnsi(text) {
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
/** Wrap bare URLs in OSC 8 hyperlinks (terminals that ignore it show the URL). */
|
|
214
|
-
|
|
214
|
+
function linkifyUrls(text) {
|
|
215
215
|
const src = String(text ?? '');
|
|
216
216
|
if (!/https?:\/\//.test(src)) return src;
|
|
217
217
|
const chunks = [];
|
|
@@ -247,7 +247,7 @@ function tryFormatJsonLine(line) {
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
/** Auto pretty-print whole-result JSON (size-capped, per-line). */
|
|
250
|
-
|
|
250
|
+
function tryFormatJson(text) {
|
|
251
251
|
const src = String(text ?? '');
|
|
252
252
|
if (src.length > MAX_JSON_FORMAT_LENGTH) return src;
|
|
253
253
|
return src.split('\n').map(tryFormatJsonLine).join('\n');
|
|
@@ -452,7 +452,7 @@ function highlightBody(body, { c, family, diffMode }) {
|
|
|
452
452
|
}
|
|
453
453
|
|
|
454
454
|
/** Body text width for expanded tool results (terminal cols minus the ⎿ rail). */
|
|
455
|
-
|
|
455
|
+
function expandedResultBodyWidth(columns = 80) {
|
|
456
456
|
const cols = Math.max(1, Number(columns) || 80);
|
|
457
457
|
const budget = cols - stringWidth(RESULT_GUTTER);
|
|
458
458
|
return Math.max(MIN_EXPANDED_BODY_COLS, budget);
|
|
@@ -42,7 +42,7 @@ const graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme
|
|
|
42
42
|
* draws it 1 cell, so widening it reserved a phantom cell that shifted the
|
|
43
43
|
* right-aligned workflow label one column left when the usage segment appeared.
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
function isProblemCodePoint(cp) {
|
|
46
46
|
return (cp >= 0x2460 && cp <= 0x24ff) || (cp >= 0x2194 && cp <= 0x21ff && cp !== 0x21bb);
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -57,7 +57,7 @@ const PROBLEM_RE = /[\u2194-\u21ff\u2460-\u24ff]/;
|
|
|
57
57
|
* default is ON on Windows (WT_SESSION does not reliably propagate to child
|
|
58
58
|
* processes, so gate on the OS itself) or when WT_SESSION is present.
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
function resolveAmbiguousWidePolicy(env = process.env, platform = process.platform) {
|
|
61
61
|
const override = env?.MIXDOG_TUI_AMBIGUOUS_WIDE;
|
|
62
62
|
if (override === '1') return true;
|
|
63
63
|
if (override === '0') return false;
|
|
@@ -65,7 +65,7 @@ export function resolveAmbiguousWidePolicy(env = process.env, platform = process
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/** Resolved once at module load (matches the "computed once" requirement). */
|
|
68
|
-
|
|
68
|
+
const AMBIGUOUS_WIDE = resolveAmbiguousWidePolicy();
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* Pure width with an explicit policy flag (used by tests and by `displayWidth`).
|
|
@@ -74,7 +74,7 @@ export const AMBIGUOUS_WIDE = resolveAmbiguousWidePolicy();
|
|
|
74
74
|
* ANSI escape bytes are all ASCII and never fall in the problem ranges, so the
|
|
75
75
|
* raw code-point scan adds nothing for them.
|
|
76
76
|
*/
|
|
77
|
-
|
|
77
|
+
function displayWidthWith(str, wide) {
|
|
78
78
|
const s = String(str ?? '');
|
|
79
79
|
const base = stringWidth(s);
|
|
80
80
|
if (!wide) return base;
|