@linxiraos/pi-tui 1.4.4 → 1.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +208 -207
- package/README.md +34 -34
- package/dist/types/app-keybindings.d.ts +20 -0
- package/dist/types/apps/session-picker.d.ts +5 -0
- package/dist/types/charts/chart-plan.d.ts +9 -7
- package/dist/types/chat/assistant-message.d.ts +15 -3
- package/dist/types/chat/bash-execution.d.ts +2 -0
- package/dist/types/chat/display-preferences.d.ts +2 -0
- package/dist/types/chat/extension-types.d.ts +31 -0
- package/dist/types/chat/reply-write.d.ts +48 -0
- package/dist/types/chat/table-chart.d.ts +4 -3
- package/dist/types/chat/tool-execution.d.ts +1 -2
- package/dist/types/chat/transcript-outline.d.ts +7 -0
- package/dist/types/chat/transcript-render-helpers.d.ts +2 -0
- package/dist/types/chrome/context-map.d.ts +15 -0
- package/dist/types/chrome/context-presentation.d.ts +48 -0
- package/dist/types/chrome/context-view-model.d.ts +77 -0
- package/dist/types/chrome/index.d.ts +1 -0
- package/dist/types/chrome/transcript-notice.d.ts +35 -0
- package/dist/types/chrome/transcript-status.d.ts +20 -8
- package/dist/types/components/editor.d.ts +8 -0
- package/dist/types/components/image.d.ts +20 -0
- package/dist/types/components/loader.d.ts +1 -1
- package/dist/types/components/markdown.d.ts +7 -0
- package/dist/types/native/blobs.d.ts +11 -1
- package/dist/types/native/picker.d.ts +4 -4
- package/dist/types/overlays/advisor-config.d.ts +6 -0
- package/dist/types/overlays/agent-hub-projection.d.ts +3 -1
- package/dist/types/overlays/annotation-overlay.d.ts +7 -1
- package/dist/types/overlays/annotation-types.d.ts +28 -0
- package/dist/types/overlays/ask-dialog.d.ts +12 -3
- package/dist/types/overlays/btw-history-panel.d.ts +16 -2
- package/dist/types/overlays/btw-history.d.ts +7 -0
- package/dist/types/overlays/btw-panel.d.ts +2 -0
- package/dist/types/overlays/context-viewer-format.d.ts +42 -0
- package/dist/types/overlays/context-viewer-overview.d.ts +70 -0
- package/dist/types/overlays/context-viewer.d.ts +25 -0
- package/dist/types/overlays/hook-input.d.ts +1 -0
- package/dist/types/overlays/login-dialog.d.ts +5 -1
- package/dist/types/overlays/mcp-add-wizard.d.ts +2 -0
- package/dist/types/overlays/model-browser.d.ts +10 -1
- package/dist/types/overlays/oauth-selector.d.ts +23 -0
- package/dist/types/overlays/pause-screen.d.ts +13 -3
- package/dist/types/overlays/plan-review-overlay.d.ts +2 -0
- package/dist/types/overlays/rewind-selector.d.ts +1 -1
- package/dist/types/overlays/running-subagent-badge.d.ts +7 -1
- package/dist/types/overlays/session-selector.d.ts +22 -2
- package/dist/types/prompt/composer.d.ts +43 -0
- package/dist/types/prompt/interactive-context-helpers.d.ts +10 -3
- package/dist/types/prompt/macos-spelling.d.ts +2 -2
- package/dist/types/render/extension-links.d.ts +65 -0
- package/dist/types/render/hyperlink.d.ts +38 -7
- package/dist/types/render/index.d.ts +1 -0
- package/dist/types/render/output-pane.d.ts +1 -1
- package/dist/types/render/render-utils.d.ts +7 -1
- package/dist/types/setup/scenes/glyph.d.ts +1 -1
- package/dist/types/setup/scenes/model.d.ts +1 -1
- package/dist/types/setup/scenes/outro.d.ts +5 -4
- package/dist/types/setup/scenes/sign-in.d.ts +13 -8
- package/dist/types/setup/scenes/types.d.ts +16 -1
- package/dist/types/setup/startup-splash.d.ts +1 -1
- package/dist/types/setup/wizard-overlay.d.ts +11 -7
- package/dist/types/setup/wizard.d.ts +5 -1
- package/dist/types/status-line/component.d.ts +3 -3
- package/dist/types/status-line/context-usage.d.ts +42 -35
- package/dist/types/status-line/host.d.ts +6 -2
- package/dist/types/terminal-capabilities.d.ts +7 -0
- package/dist/types/theme/symbols.d.ts +1 -1
- package/dist/types/theme/theme.d.ts +0 -23
- package/dist/types/tools/ask.d.ts +4 -0
- package/dist/types/tools/bash-interactive.d.ts +6 -0
- package/dist/types/tools/bash.d.ts +2 -0
- package/dist/types/tools/default-renderer.d.ts +6 -4
- package/dist/types/tools/edit.d.ts +3 -1
- package/dist/types/tools/fetch.d.ts +1 -0
- package/dist/types/tools/github.d.ts +3 -0
- package/dist/types/tools/grouped-file-output.d.ts +2 -0
- package/dist/types/tools/irc.d.ts +6 -0
- package/dist/types/tools/json-tree.d.ts +23 -4
- package/dist/types/tools/lsp.d.ts +2 -0
- package/dist/types/tools/mcp.d.ts +7 -6
- package/dist/types/tools/native-view.d.ts +1 -1
- package/dist/types/tools/read.d.ts +3 -0
- package/dist/types/tools/renderer.d.ts +2 -0
- package/dist/types/tools/streaming-output.d.ts +11 -0
- package/dist/types/tools/task.d.ts +9 -1
- package/dist/types/tools/url-scheme-host.d.ts +17 -0
- package/dist/types/tools/wait.d.ts +16 -2
- package/dist/types/tools/yield.d.ts +1 -1
- package/dist/types/tui.d.ts +9 -2
- package/dist/types/vim.d.ts +39 -0
- package/package.json +10 -14
- package/src/app-keybindings.d.ts +20 -0
- package/src/app-keybindings.ts +20 -0
- package/src/apps/session-picker.ts +7 -0
- package/src/charts/chart-plan.d.ts +9 -7
- package/src/charts/chart-plan.ts +20 -50
- package/src/chat/advisor-message.ts +2 -0
- package/src/chat/assistant-message.d.ts +15 -3
- package/src/chat/assistant-message.ts +137 -19
- package/src/chat/background-tan-message.ts +4 -0
- package/src/chat/bash-execution.d.ts +2 -0
- package/src/chat/bash-execution.ts +13 -1
- package/src/chat/chat-transcript-builder.ts +58 -28
- package/src/chat/compaction-summary-message.ts +2 -1
- package/src/chat/display-preferences.d.ts +2 -0
- package/src/chat/display-preferences.ts +3 -0
- package/src/chat/extension-types.d.ts +31 -0
- package/src/chat/extension-types.ts +34 -0
- package/src/chat/read-tool-group.ts +1 -2
- package/src/chat/reply-write.d.ts +48 -0
- package/src/chat/reply-write.ts +127 -0
- package/src/chat/skill-message.ts +2 -6
- package/src/chat/table-chart.d.ts +4 -3
- package/src/chat/table-chart.ts +10 -4
- package/src/chat/tool-execution.d.ts +1 -2
- package/src/chat/tool-execution.ts +20 -13
- package/src/chat/transcript-outline.d.ts +7 -0
- package/src/chat/transcript-outline.ts +27 -0
- package/src/chat/transcript-render-helpers.d.ts +2 -0
- package/src/chat/transcript-render-helpers.ts +66 -24
- package/src/chrome/context-map.ts +62 -0
- package/src/chrome/context-presentation.ts +26 -0
- package/src/chrome/context-view-model.ts +73 -0
- package/src/chrome/index.ts +1 -0
- package/src/chrome/transcript-container.ts +89 -59
- package/src/chrome/transcript-notice.d.ts +35 -0
- package/src/chrome/transcript-notice.ts +83 -0
- package/src/chrome/transcript-status.d.ts +20 -8
- package/src/chrome/transcript-status.ts +29 -29
- package/src/components/editor.d.ts +8 -0
- package/src/components/editor.ts +465 -14
- package/src/components/image.d.ts +20 -0
- package/src/components/image.ts +83 -18
- package/src/components/loader.d.ts +1 -1
- package/src/components/loader.ts +1 -1
- package/src/components/markdown.d.ts +7 -0
- package/src/components/markdown.ts +225 -13
- package/src/hotkeys-markdown.ts +2 -0
- package/src/native/backend.ts +5 -66
- package/src/native/blobs.d.ts +11 -1
- package/src/native/blobs.ts +5 -3
- package/src/native/picker.d.ts +4 -4
- package/src/native/picker.ts +4 -4
- package/src/overlays/advisor-config.ts +10 -12
- package/src/overlays/agent-hub-projection.d.ts +3 -1
- package/src/overlays/agent-hub-projection.ts +6 -5
- package/src/overlays/agent-hub.ts +51 -42
- package/src/overlays/annotation-overlay.ts +125 -37
- package/src/overlays/annotation-types.ts +24 -0
- package/src/overlays/ask-dialog.ts +125 -35
- package/src/overlays/btw-history-panel.ts +124 -12
- package/src/overlays/btw-history.ts +11 -0
- package/src/overlays/btw-panel.ts +8 -4
- package/src/overlays/context-viewer-format.ts +145 -0
- package/src/overlays/context-viewer-overview.ts +381 -0
- package/src/overlays/context-viewer.ts +728 -0
- package/src/overlays/hook-input.ts +2 -0
- package/src/overlays/hook-selector.ts +2 -2
- package/src/overlays/login-dialog.ts +31 -5
- package/src/overlays/mcp-add-wizard.ts +6 -1
- package/src/overlays/model-browser.ts +37 -0
- package/src/overlays/model-hub.ts +1 -7
- package/src/overlays/model-picker.ts +1 -10
- package/src/overlays/oauth-selector.ts +44 -6
- package/src/overlays/pause-screen.ts +166 -33
- package/src/overlays/plan-review-overlay.ts +13 -2
- package/src/overlays/rewind-selector.ts +29 -12
- package/src/overlays/running-subagent-badge.ts +12 -1
- package/src/overlays/session-selector.ts +313 -42
- package/src/overlays/settings-defs.ts +1 -0
- package/src/overlays/usage-dashboard.ts +20 -14
- package/src/prompt/composer.ts +216 -1
- package/src/prompt/custom-editor.ts +6 -1
- package/src/prompt/emoji-autocomplete.ts +0 -2
- package/src/prompt/interactive-context-helpers.ts +29 -4
- package/src/prompt/macos-spelling.ts +24 -15
- package/src/render/extension-links.d.ts +65 -0
- package/src/render/extension-links.ts +214 -0
- package/src/render/hyperlink.d.ts +38 -7
- package/src/render/hyperlink.ts +102 -23
- package/src/render/index.d.ts +1 -0
- package/src/render/index.ts +1 -0
- package/src/render/output-pane.d.ts +1 -1
- package/src/render/output-pane.ts +60 -17
- package/src/render/render-utils.d.ts +7 -1
- package/src/render/render-utils.ts +11 -2
- package/src/setup/scenes/composer.ts +2 -0
- package/src/setup/scenes/glyph.ts +3 -1
- package/src/setup/scenes/model.ts +192 -29
- package/src/setup/scenes/outro.ts +33 -15
- package/src/setup/scenes/sign-in.ts +194 -392
- package/src/setup/scenes/theme.ts +2 -0
- package/src/setup/scenes/types.ts +18 -1
- package/src/setup/startup-splash.ts +8 -7
- package/src/setup/wizard-overlay.ts +164 -35
- package/src/setup/wizard.ts +11 -2
- package/src/status-line/component.ts +10 -14
- package/src/status-line/context-usage.ts +122 -597
- package/src/status-line/host.ts +6 -2
- package/src/terminal-capabilities.d.ts +7 -0
- package/src/terminal-capabilities.ts +10 -0
- package/src/terminal.ts +24 -2
- package/src/theme/defaults.json +1 -0
- package/src/theme/loader.ts +1 -1
- package/src/theme/symbols.d.ts +1 -1
- package/src/theme/symbols.ts +16 -0
- package/src/theme/theme.d.ts +0 -23
- package/src/theme/theme.ts +2 -75
- package/src/tools/ask.d.ts +4 -0
- package/src/tools/ask.ts +4 -0
- package/src/tools/ast-grep.ts +3 -2
- package/src/tools/bash-interactive.d.ts +49 -0
- package/src/tools/bash-interactive.ts +6 -1
- package/src/tools/bash.d.ts +2 -0
- package/src/tools/bash.ts +7 -23
- package/src/tools/default-renderer.d.ts +6 -4
- package/src/tools/default-renderer.ts +9 -6
- package/src/tools/edit.d.ts +3 -1
- package/src/tools/edit.ts +8 -4
- package/src/tools/eval.ts +14 -4
- package/src/tools/fetch.d.ts +1 -0
- package/src/tools/fetch.ts +1 -0
- package/src/tools/find.ts +3 -10
- package/src/tools/github.d.ts +3 -0
- package/src/tools/github.ts +23 -3
- package/src/tools/glob.ts +4 -3
- package/src/tools/grep.ts +3 -4
- package/src/tools/grouped-file-output.d.ts +2 -0
- package/src/tools/grouped-file-output.ts +8 -2
- package/src/tools/irc.d.ts +6 -0
- package/src/tools/irc.ts +6 -0
- package/src/tools/job-widget.ts +13 -1
- package/src/tools/json-tree.d.ts +23 -4
- package/src/tools/json-tree.ts +132 -42
- package/src/tools/lsp.d.ts +2 -0
- package/src/tools/lsp.ts +36 -15
- package/src/tools/mcp.d.ts +7 -6
- package/src/tools/mcp.ts +41 -15
- package/src/tools/native-view.d.ts +1 -1
- package/src/tools/native-view.ts +3 -3
- package/src/tools/read.d.ts +3 -0
- package/src/tools/read.ts +3 -1
- package/src/tools/renderer.d.ts +2 -0
- package/src/tools/renderer.ts +2 -0
- package/src/tools/streaming-output.d.ts +11 -0
- package/src/tools/streaming-output.ts +41 -0
- package/src/tools/task.d.ts +9 -1
- package/src/tools/task.ts +59 -16
- package/src/tools/url-scheme-host.d.ts +17 -0
- package/src/tools/url-scheme-host.ts +21 -0
- package/src/tools/vibe.ts +14 -3
- package/src/tools/wait.d.ts +16 -2
- package/src/tools/wait.ts +16 -2
- package/src/tools/yield.d.ts +1 -1
- package/src/tools/yield.ts +18 -9
- package/src/tui.d.ts +9 -2
- package/src/tui.ts +102 -34
- package/src/vim.d.ts +39 -0
- package/src/vim.ts +313 -22
- package/dist/types/theme/defaults/index.d.ts +0 -10289
- package/src/theme/defaults/alabaster.json +0 -103
- package/src/theme/defaults/amethyst.json +0 -106
- package/src/theme/defaults/anthracite.json +0 -103
- package/src/theme/defaults/basalt.json +0 -101
- package/src/theme/defaults/birch.json +0 -105
- package/src/theme/defaults/dark-abyss.json +0 -101
- package/src/theme/defaults/dark-arctic.json +0 -114
- package/src/theme/defaults/dark-aurora.json +0 -105
- package/src/theme/defaults/dark-catppuccin.json +0 -117
- package/src/theme/defaults/dark-cavern.json +0 -101
- package/src/theme/defaults/dark-celestial.json +0 -116
- package/src/theme/defaults/dark-copper.json +0 -105
- package/src/theme/defaults/dark-cosmos.json +0 -100
- package/src/theme/defaults/dark-cyberpunk.json +0 -112
- package/src/theme/defaults/dark-dracula.json +0 -108
- package/src/theme/defaults/dark-eclipse.json +0 -101
- package/src/theme/defaults/dark-ember.json +0 -105
- package/src/theme/defaults/dark-equinox.json +0 -100
- package/src/theme/defaults/dark-forest.json +0 -106
- package/src/theme/defaults/dark-github.json +0 -115
- package/src/theme/defaults/dark-gruvbox.json +0 -122
- package/src/theme/defaults/dark-lavender.json +0 -105
- package/src/theme/defaults/dark-lunar.json +0 -99
- package/src/theme/defaults/dark-midnight.json +0 -105
- package/src/theme/defaults/dark-monochrome.json +0 -104
- package/src/theme/defaults/dark-monokai.json +0 -108
- package/src/theme/defaults/dark-nebula.json +0 -100
- package/src/theme/defaults/dark-neon-noir.json +0 -110
- package/src/theme/defaults/dark-nord.json +0 -108
- package/src/theme/defaults/dark-ocean.json +0 -111
- package/src/theme/defaults/dark-one.json +0 -110
- package/src/theme/defaults/dark-poimandres.json +0 -125
- package/src/theme/defaults/dark-rainforest.json +0 -101
- package/src/theme/defaults/dark-reef.json +0 -101
- package/src/theme/defaults/dark-retro.json +0 -102
- package/src/theme/defaults/dark-rose-pine.json +0 -106
- package/src/theme/defaults/dark-sakura.json +0 -105
- package/src/theme/defaults/dark-slate.json +0 -105
- package/src/theme/defaults/dark-solarized.json +0 -107
- package/src/theme/defaults/dark-solstice.json +0 -100
- package/src/theme/defaults/dark-starfall.json +0 -101
- package/src/theme/defaults/dark-sunset.json +0 -109
- package/src/theme/defaults/dark-swamp.json +0 -100
- package/src/theme/defaults/dark-synthwave.json +0 -113
- package/src/theme/defaults/dark-taiga.json +0 -101
- package/src/theme/defaults/dark-terminal.json +0 -105
- package/src/theme/defaults/dark-tokyo-night.json +0 -111
- package/src/theme/defaults/dark-tundra.json +0 -101
- package/src/theme/defaults/dark-twilight.json +0 -101
- package/src/theme/defaults/dark-volcanic.json +0 -101
- package/src/theme/defaults/graphite.json +0 -102
- package/src/theme/defaults/index.d.ts +0 -10289
- package/src/theme/defaults/index.ts +0 -203
- package/src/theme/defaults/light-arctic.json +0 -117
- package/src/theme/defaults/light-aurora-day.json +0 -101
- package/src/theme/defaults/light-canyon.json +0 -101
- package/src/theme/defaults/light-catppuccin.json +0 -116
- package/src/theme/defaults/light-cirrus.json +0 -100
- package/src/theme/defaults/light-coral.json +0 -105
- package/src/theme/defaults/light-cyberpunk.json +0 -106
- package/src/theme/defaults/light-dawn.json +0 -100
- package/src/theme/defaults/light-dunes.json +0 -101
- package/src/theme/defaults/light-eucalyptus.json +0 -105
- package/src/theme/defaults/light-forest.json +0 -110
- package/src/theme/defaults/light-frost.json +0 -105
- package/src/theme/defaults/light-github.json +0 -125
- package/src/theme/defaults/light-glacier.json +0 -101
- package/src/theme/defaults/light-gruvbox.json +0 -118
- package/src/theme/defaults/light-haze.json +0 -100
- package/src/theme/defaults/light-honeycomb.json +0 -105
- package/src/theme/defaults/light-lagoon.json +0 -101
- package/src/theme/defaults/light-lavender.json +0 -105
- package/src/theme/defaults/light-meadow.json +0 -101
- package/src/theme/defaults/light-mint.json +0 -105
- package/src/theme/defaults/light-monochrome.json +0 -111
- package/src/theme/defaults/light-ocean.json +0 -109
- package/src/theme/defaults/light-one.json +0 -109
- package/src/theme/defaults/light-opal.json +0 -101
- package/src/theme/defaults/light-orchard.json +0 -101
- package/src/theme/defaults/light-paper.json +0 -105
- package/src/theme/defaults/light-poimandres.json +0 -125
- package/src/theme/defaults/light-prism.json +0 -100
- package/src/theme/defaults/light-retro.json +0 -108
- package/src/theme/defaults/light-sand.json +0 -105
- package/src/theme/defaults/light-savanna.json +0 -101
- package/src/theme/defaults/light-solarized.json +0 -112
- package/src/theme/defaults/light-soleil.json +0 -100
- package/src/theme/defaults/light-sunset.json +0 -109
- package/src/theme/defaults/light-synthwave.json +0 -108
- package/src/theme/defaults/light-tokyo-night.json +0 -121
- package/src/theme/defaults/light-wetland.json +0 -101
- package/src/theme/defaults/light-zenith.json +0 -99
- package/src/theme/defaults/limestone.json +0 -104
- package/src/theme/defaults/mahogany.json +0 -107
- package/src/theme/defaults/marble.json +0 -103
- package/src/theme/defaults/obsidian.json +0 -101
- package/src/theme/defaults/onyx.json +0 -101
- package/src/theme/defaults/pearl.json +0 -103
- package/src/theme/defaults/porcelain.json +0 -101
- package/src/theme/defaults/quartz.json +0 -106
- package/src/theme/defaults/sandstone.json +0 -105
- package/src/theme/defaults/titanium.json +0 -100
package/src/tools/task.ts
CHANGED
|
@@ -46,12 +46,13 @@ import { formatOutputInline, renderJsonTreeLines, describeJsonTree } from "./jso
|
|
|
46
46
|
import { repairDoubleEncodedJsonString } from "./task-repair-args";
|
|
47
47
|
import { getSubprocessToolRenderer } from "./subprocess";
|
|
48
48
|
import { assembleYieldResult, type YieldSectionShapes } from "./task-yield-assembly";
|
|
49
|
-
import type { TspAgentProps, TspTone } from "@linxiraos/pi-wire";
|
|
50
|
-
import { compact, kv, md, node, span, text } from "../native/describe";
|
|
49
|
+
import type { TspAgentProps, TspProps, TspTone } from "@linxiraos/pi-wire";
|
|
50
|
+
import { compact, kv, md, node, propNode, span, text } from "../native/describe";
|
|
51
51
|
import type { NativeNode } from "../native/node";
|
|
52
52
|
import { OwnerMemo, sameItems } from "../native/memo";
|
|
53
53
|
import { plainText } from "../native/spans";
|
|
54
54
|
import { errorText, noteText, resultText } from "./native-view";
|
|
55
|
+
import { describeJsonValue } from "./json-tree";
|
|
55
56
|
import { taskSummary } from "../overlays/agent-hub-renderer";
|
|
56
57
|
|
|
57
58
|
/** Render context threaded in from `ToolExecutionComponent.#buildRenderContext`. */
|
|
@@ -479,6 +480,12 @@ function renderTaskSection(
|
|
|
479
480
|
return lines;
|
|
480
481
|
}
|
|
481
482
|
|
|
483
|
+
function taskPreviewText(task: unknown, taskFile: unknown): string {
|
|
484
|
+
if (typeof task === "string") return task;
|
|
485
|
+
if (typeof taskFile !== "string") return "";
|
|
486
|
+
return flattenLine(replaceTabs(shortenPath(sanitizeText(taskFile))));
|
|
487
|
+
}
|
|
488
|
+
|
|
482
489
|
/**
|
|
483
490
|
* First line of a streamed `task` brief, trimmed — a row's secondary text.
|
|
484
491
|
* The args stream in token by token, so non-string values fall through to "".
|
|
@@ -519,7 +526,7 @@ function renderTaskCallLines(args: Partial<TaskParams> | undefined, theme: Theme
|
|
|
519
526
|
|
|
520
527
|
const rawName = typeof args.name === "string" ? args.name.trim() : "";
|
|
521
528
|
const idLabel = rawName ? formatTaskId(rawName) : "";
|
|
522
|
-
const brief = taskFirstLine(args.task);
|
|
529
|
+
const brief = taskFirstLine(taskPreviewText(args.task, args.taskFile));
|
|
523
530
|
if (idLabel || brief) {
|
|
524
531
|
let line = `${bullet} ${theme.fg("accent", theme.bold(idLabel || "agent"))}`;
|
|
525
532
|
if (brief) {
|
|
@@ -555,7 +562,7 @@ function renderTaskItemLines(tasks: TaskItem[] | undefined, theme: Theme): strin
|
|
|
555
562
|
const rawName = typeof item?.name === "string" ? item.name.trim() : "";
|
|
556
563
|
const idLabel = rawName ? formatTaskId(rawName) : `#${i + 1}`;
|
|
557
564
|
let line = `${bullet} ${theme.fg("accent", theme.bold(idLabel))}`;
|
|
558
|
-
const brief = taskFirstLine(item?.task);
|
|
565
|
+
const brief = taskFirstLine(taskPreviewText(item?.task, item?.taskFile));
|
|
559
566
|
if (brief) {
|
|
560
567
|
line += `: ${theme.fg("muted", previewLine(brief, 64))}`;
|
|
561
568
|
}
|
|
@@ -1797,7 +1804,7 @@ function describeContext(raw: unknown): NativeNode | undefined {
|
|
|
1797
1804
|
return line ? text([span(line, "muted")], { wrap: "word", lines: 2, role: "zeta.tool.context" }) : undefined;
|
|
1798
1805
|
}
|
|
1799
1806
|
|
|
1800
|
-
/** The full assignment, markdown
|
|
1807
|
+
/** The full assignment, markdown: an agent's first expanded child and its row's hover card. */
|
|
1801
1808
|
function describeAssignment(raw: string | undefined): NativeNode | undefined {
|
|
1802
1809
|
const source = raw ? sanitizeText(repairDoubleEncodedJsonString(raw)).trim() : "";
|
|
1803
1810
|
return source ? md(source, { role: "zeta.task.assignment" }) : undefined;
|
|
@@ -1829,6 +1836,8 @@ interface AgentDescribeState {
|
|
|
1829
1836
|
readonly nowMs: number;
|
|
1830
1837
|
readonly expanded: boolean;
|
|
1831
1838
|
readonly background: boolean;
|
|
1839
|
+
/** The host draws the `json` kind. */
|
|
1840
|
+
readonly json: boolean;
|
|
1832
1841
|
}
|
|
1833
1842
|
|
|
1834
1843
|
/** Settled and in-flight child snapshots a subagent carries, as nested agent nodes. */
|
|
@@ -1858,8 +1867,26 @@ function describeNestedTasks(
|
|
|
1858
1867
|
return out;
|
|
1859
1868
|
}
|
|
1860
1869
|
|
|
1861
|
-
|
|
1862
|
-
|
|
1870
|
+
/** Earliest start seen per running subagent (`nowMs - durationMs`), so a snapshot with a stale or zero `durationMs` can't restart its timer. */
|
|
1871
|
+
const runStartMs = new Map<string, number>();
|
|
1872
|
+
|
|
1873
|
+
function runningAge(progress: { id: string; durationMs: number }, nowMs: number): number {
|
|
1874
|
+
const start = nowMs - Math.max(0, progress.durationMs);
|
|
1875
|
+
const known = runStartMs.get(progress.id);
|
|
1876
|
+
const anchor = known === undefined ? start : Math.min(known, start);
|
|
1877
|
+
runStartMs.set(progress.id, anchor);
|
|
1878
|
+
return Math.max(0, nowMs - anchor);
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
/** An `agent` node; its row's hover card shows the whole `assignment` the row only summarizes. */
|
|
1882
|
+
function agentNode(
|
|
1883
|
+
p: TspAgentProps,
|
|
1884
|
+
assignment: NativeNode | undefined,
|
|
1885
|
+
children: readonly (NativeNode | undefined)[],
|
|
1886
|
+
key: string,
|
|
1887
|
+
): NativeNode {
|
|
1888
|
+
const props: TspProps<"agent"> = assignment ? { ...p, hovercard: propNode(assignment) } : p;
|
|
1889
|
+
return node("agent", props, compact(children), key);
|
|
1863
1890
|
}
|
|
1864
1891
|
|
|
1865
1892
|
function describeProgressAgent(progress: AgentProgress, state: AgentDescribeState, depth: number): NativeNode {
|
|
@@ -1881,6 +1908,7 @@ function describeProgressAgent(progress: AgentProgress, state: AgentDescribeStat
|
|
|
1881
1908
|
const summary = taskSummary(progress.description || progress.assignment || progress.task);
|
|
1882
1909
|
// The agent's own stage line (from its completion probe) rides beside the task while it runs.
|
|
1883
1910
|
const stage = running && progress.stage ? plainText(progress.stage) : "";
|
|
1911
|
+
const assignment = describeAssignment(progress.assignment ?? progress.task);
|
|
1884
1912
|
const retry =
|
|
1885
1913
|
running && progress.retryState
|
|
1886
1914
|
? {
|
|
@@ -1907,7 +1935,7 @@ function describeProgressAgent(progress: AgentProgress, state: AgentDescribeStat
|
|
|
1907
1935
|
...contextStats(progress.contextTokens, progress.contextWindow),
|
|
1908
1936
|
done: running && progress.completionPercent !== undefined ? progress.completionPercent / 100 : undefined,
|
|
1909
1937
|
cost: progress.cost > 0 ? progress.cost : undefined,
|
|
1910
|
-
...(running ? { age: progress
|
|
1938
|
+
...(running ? { age: runningAge(progress, nowMs) } : { took: progress.durationMs }),
|
|
1911
1939
|
},
|
|
1912
1940
|
retry,
|
|
1913
1941
|
badges: agentBadges(state.background, undefined),
|
|
@@ -1915,8 +1943,9 @@ function describeProgressAgent(progress: AgentProgress, state: AgentDescribeStat
|
|
|
1915
1943
|
collapsible: true,
|
|
1916
1944
|
collapsed: !state.expanded,
|
|
1917
1945
|
},
|
|
1946
|
+
assignment,
|
|
1918
1947
|
[
|
|
1919
|
-
|
|
1948
|
+
assignment,
|
|
1920
1949
|
progress.resolvedModelRoute ? noteText(progress.resolvedModelRoute, "dim") : undefined,
|
|
1921
1950
|
!running && progress.retryFailure
|
|
1922
1951
|
? text(
|
|
@@ -1950,6 +1979,7 @@ function describeResultAgent(result: SingleResult, state: AgentDescribeState, de
|
|
|
1950
1979
|
else if (warning && success) badges.push({ text: "warning", tone: "warning" });
|
|
1951
1980
|
if (result.truncated) badges.push({ text: "truncated", tone: "warning" });
|
|
1952
1981
|
const cost = result.usage?.cost.total ?? 0;
|
|
1982
|
+
const assignment = describeAssignment(result.assignment ?? result.task);
|
|
1953
1983
|
return agentNode(
|
|
1954
1984
|
{
|
|
1955
1985
|
name: formatTaskId(result.id),
|
|
@@ -1972,15 +2002,17 @@ function describeResultAgent(result: SingleResult, state: AgentDescribeState, de
|
|
|
1972
2002
|
collapsible: true,
|
|
1973
2003
|
collapsed: !state.expanded,
|
|
1974
2004
|
},
|
|
2005
|
+
assignment,
|
|
1975
2006
|
[
|
|
1976
|
-
|
|
2007
|
+
assignment,
|
|
1977
2008
|
result.resolvedModelRoute ? noteText(result.resolvedModelRoute, "dim") : undefined,
|
|
1978
2009
|
aborted && result.abortReason ? errorLine(result.abortReason) : undefined,
|
|
1979
2010
|
warning ? errorLine(warning, "warning") : undefined,
|
|
1980
2011
|
result.error ? errorLine(result.error) : undefined,
|
|
1981
2012
|
result.retryFailure ? errorLine(`auto-retry gave up: ${result.retryFailure.errorMessage}`) : undefined,
|
|
2013
|
+
// The structured result is the agent's answer: its containers open one level, as in the fallback tree.
|
|
1982
2014
|
structured !== undefined
|
|
1983
|
-
?
|
|
2015
|
+
? describeJsonValue(structured, { native: state.json, open: 1 })
|
|
1984
2016
|
: output
|
|
1985
2017
|
? md(output, { role: "zeta.task.output" })
|
|
1986
2018
|
: undefined,
|
|
@@ -2026,16 +2058,18 @@ function describeTaskCall(args: TaskParams | undefined): NativeToolView {
|
|
|
2026
2058
|
status: "pending",
|
|
2027
2059
|
badges: agentBadges(false, isolated === true),
|
|
2028
2060
|
},
|
|
2061
|
+
describeAssignment(typeof brief === "string" ? brief : undefined),
|
|
2029
2062
|
[],
|
|
2030
2063
|
key,
|
|
2031
2064
|
);
|
|
2032
2065
|
const flatName = typeof args?.name === "string" ? args.name.trim() : "";
|
|
2033
|
-
|
|
2066
|
+
const flatBrief = taskPreviewText(args?.task, args?.taskFile);
|
|
2067
|
+
if (flatName || taskFirstLine(flatBrief)) {
|
|
2034
2068
|
agents.push(
|
|
2035
2069
|
pending(
|
|
2036
2070
|
flatName ? formatTaskId(flatName) : "agent",
|
|
2037
2071
|
args?.agent,
|
|
2038
|
-
|
|
2072
|
+
flatBrief,
|
|
2039
2073
|
args?.isolated,
|
|
2040
2074
|
flatName || "agent",
|
|
2041
2075
|
),
|
|
@@ -2048,7 +2082,7 @@ function describeTaskCall(args: TaskParams | undefined): NativeToolView {
|
|
|
2048
2082
|
pending(
|
|
2049
2083
|
name ? formatTaskId(name) : `#${index + 1}`,
|
|
2050
2084
|
entry?.agent,
|
|
2051
|
-
entry?.task,
|
|
2085
|
+
taskPreviewText(entry?.task, entry?.taskFile),
|
|
2052
2086
|
entry?.isolated,
|
|
2053
2087
|
name || `#${index + 1}`,
|
|
2054
2088
|
),
|
|
@@ -2093,6 +2127,7 @@ function describeTaskResult(
|
|
|
2093
2127
|
nowMs: options.renderContext?.nowMs ?? Date.now(),
|
|
2094
2128
|
expanded: options.expanded,
|
|
2095
2129
|
background,
|
|
2130
|
+
json: options.json === true,
|
|
2096
2131
|
},
|
|
2097
2132
|
0,
|
|
2098
2133
|
);
|
|
@@ -2165,7 +2200,7 @@ export const taskToolRenderer = {
|
|
|
2165
2200
|
options: TaskRenderOptions,
|
|
2166
2201
|
args?: TaskParams,
|
|
2167
2202
|
): NativeToolView | undefined {
|
|
2168
|
-
return taskResultMemo.get(result, [options.renderContext?.nowMs, options.expanded], () =>
|
|
2203
|
+
return taskResultMemo.get(result, [options.renderContext?.nowMs, options.expanded, options.json], () =>
|
|
2169
2204
|
describeTaskResult(result, options, args),
|
|
2170
2205
|
);
|
|
2171
2206
|
},
|
|
@@ -2218,8 +2253,9 @@ export interface TaskItem {
|
|
|
2218
2253
|
sourceSession?: string;
|
|
2219
2254
|
/** Optional model selector override for the historical source session. */
|
|
2220
2255
|
model?: string | string[];
|
|
2221
|
-
/**
|
|
2256
|
+
/** Inline instructions; exactly one of task or taskFile is required. */
|
|
2222
2257
|
task?: string;
|
|
2258
|
+
taskFile?: string;
|
|
2223
2259
|
/** How open-ended the work is; required by the schema and the child's sole `auto` thinking classification input. */
|
|
2224
2260
|
solutionSpace?: string;
|
|
2225
2261
|
/** Per-spawn thinking effort: lowest/middle/highest level the resolved model supports. Overrides the agent's default selector (e.g. `auto`). */
|
|
@@ -2251,6 +2287,8 @@ export interface TaskParams {
|
|
|
2251
2287
|
model?: string | string[];
|
|
2252
2288
|
/** The work (flat form). */
|
|
2253
2289
|
task?: string;
|
|
2290
|
+
/** Absolute path or local:// URL to a UTF-8 file (flat form), mutually exclusive with task. */
|
|
2291
|
+
taskFile?: string;
|
|
2254
2292
|
/** How open-ended the work is (flat form); see {@link TaskItem.solutionSpace}. */
|
|
2255
2293
|
solutionSpace?: string;
|
|
2256
2294
|
/** Per-spawn thinking effort (flat form): lowest/middle/highest level the resolved model supports. */
|
|
@@ -2339,6 +2377,9 @@ export interface AgentProgress {
|
|
|
2339
2377
|
status: "pending" | "running" | "completed" | "failed" | "aborted";
|
|
2340
2378
|
task: string;
|
|
2341
2379
|
assignment?: string;
|
|
2380
|
+
taskFile?: string;
|
|
2381
|
+
/** SHA-256 of the exact task file bytes before decoding and trimming. */
|
|
2382
|
+
taskFileSha256?: string;
|
|
2342
2383
|
description?: string;
|
|
2343
2384
|
lastIntent?: string;
|
|
2344
2385
|
currentTool?: string;
|
|
@@ -2447,6 +2488,8 @@ export interface SingleResult {
|
|
|
2447
2488
|
agentSource: AgentSource;
|
|
2448
2489
|
task: string;
|
|
2449
2490
|
assignment?: string;
|
|
2491
|
+
taskFile?: string;
|
|
2492
|
+
taskFileSha256?: string;
|
|
2450
2493
|
description?: string;
|
|
2451
2494
|
lastIntent?: string;
|
|
2452
2495
|
exitCode: number;
|
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
* selector peeling and transcript renderers consult it instead of hardcoding
|
|
5
5
|
* scheme names.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Mutation class of a writable scheme; drives plan-mode and device-only `write` gates.
|
|
9
|
+
* - `workspace`: mutates user/external state; blocked in plan mode and device-only sessions.
|
|
10
|
+
* - `sandbox`: session scratch space (local://); allowed in plan mode and device-only sessions.
|
|
11
|
+
* - `coordination`: peer messaging (agent://); always allowed. `SchemeWritePolicy.cancels` grants the same per URL.
|
|
12
|
+
* - `device`: tool-device dispatch (xd://); always allowed, the device enforces its own policy.
|
|
13
|
+
* - `reply`: a message to the user (out://); always allowed, and transcripts draw the content as assistant prose.
|
|
14
|
+
*/
|
|
15
|
+
export type SchemeWriteScope = "workspace" | "sandbox" | "coordination" | "device" | "reply";
|
|
7
16
|
/** Renderer-relevant subset of a registered scheme's declared spec. */
|
|
8
17
|
export interface InternalUrlSchemeSpec {
|
|
9
18
|
/** `lines`: a trailing `:<selector>` chain is a read selector; `none`/`opaque`: never peel. */
|
|
@@ -12,16 +21,24 @@ export interface InternalUrlSchemeSpec {
|
|
|
12
21
|
readonly portAuthority?: boolean;
|
|
13
22
|
/** Read cards collapse into the compact read group like plain files instead of expanding. */
|
|
14
23
|
readonly compactTranscript?: boolean;
|
|
24
|
+
/** Write policy; absent on read-only schemes. Transcripts draw `reply`-scoped writes as assistant prose. */
|
|
25
|
+
readonly write?: {
|
|
26
|
+
readonly scope: SchemeWriteScope;
|
|
27
|
+
};
|
|
15
28
|
}
|
|
16
29
|
/** Scheme registry capabilities installed by the internal URL host. */
|
|
17
30
|
export interface InternalUrlSchemeHost {
|
|
18
31
|
/** Declared spec of a registered scheme (case-insensitive); undefined when unregistered. */
|
|
19
32
|
spec(scheme: string): InternalUrlSchemeSpec | undefined;
|
|
33
|
+
/** Declared specs of every registered scheme, keyed by lowercased scheme. */
|
|
34
|
+
specs(): ReadonlyMap<string, InternalUrlSchemeSpec>;
|
|
20
35
|
}
|
|
21
36
|
/** Install the scheme registry. Until one is installed, no URL counts as an internal scheme. */
|
|
22
37
|
export declare function setInternalUrlSchemeHost(host: InternalUrlSchemeHost): void;
|
|
23
38
|
/** Declared spec of `scheme`; undefined when it is unregistered or no host is installed. */
|
|
24
39
|
export declare function internalUrlSchemeSpec(scheme: string): InternalUrlSchemeSpec | undefined;
|
|
40
|
+
/** Declared specs of every registered scheme, keyed by lowercased scheme; empty when no host is installed. */
|
|
41
|
+
export declare function internalUrlSchemeSpecs(): ReadonlyMap<string, InternalUrlSchemeSpec>;
|
|
25
42
|
/** Split a hierarchical `scheme://rest` URL into its lowercased scheme and the text after `://`. */
|
|
26
43
|
export declare function splitUrlScheme(input: string): {
|
|
27
44
|
scheme: string;
|
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
* scheme names.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Mutation class of a writable scheme; drives plan-mode and device-only `write` gates.
|
|
10
|
+
* - `workspace`: mutates user/external state; blocked in plan mode and device-only sessions.
|
|
11
|
+
* - `sandbox`: session scratch space (local://); allowed in plan mode and device-only sessions.
|
|
12
|
+
* - `coordination`: peer messaging (agent://); always allowed. `SchemeWritePolicy.cancels` grants the same per URL.
|
|
13
|
+
* - `device`: tool-device dispatch (xd://); always allowed, the device enforces its own policy.
|
|
14
|
+
* - `reply`: a message to the user (out://); always allowed, and transcripts draw the content as assistant prose.
|
|
15
|
+
*/
|
|
16
|
+
export type SchemeWriteScope = "workspace" | "sandbox" | "coordination" | "device" | "reply";
|
|
17
|
+
|
|
8
18
|
/** Renderer-relevant subset of a registered scheme's declared spec. */
|
|
9
19
|
export interface InternalUrlSchemeSpec {
|
|
10
20
|
/** `lines`: a trailing `:<selector>` chain is a read selector; `none`/`opaque`: never peel. */
|
|
@@ -13,12 +23,16 @@ export interface InternalUrlSchemeSpec {
|
|
|
13
23
|
readonly portAuthority?: boolean;
|
|
14
24
|
/** Read cards collapse into the compact read group like plain files instead of expanding. */
|
|
15
25
|
readonly compactTranscript?: boolean;
|
|
26
|
+
/** Write policy; absent on read-only schemes. Transcripts draw `reply`-scoped writes as assistant prose. */
|
|
27
|
+
readonly write?: { readonly scope: SchemeWriteScope };
|
|
16
28
|
}
|
|
17
29
|
|
|
18
30
|
/** Scheme registry capabilities installed by the internal URL host. */
|
|
19
31
|
export interface InternalUrlSchemeHost {
|
|
20
32
|
/** Declared spec of a registered scheme (case-insensitive); undefined when unregistered. */
|
|
21
33
|
spec(scheme: string): InternalUrlSchemeSpec | undefined;
|
|
34
|
+
/** Declared specs of every registered scheme, keyed by lowercased scheme. */
|
|
35
|
+
specs(): ReadonlyMap<string, InternalUrlSchemeSpec>;
|
|
22
36
|
}
|
|
23
37
|
|
|
24
38
|
let schemeHost: InternalUrlSchemeHost | undefined;
|
|
@@ -33,6 +47,13 @@ export function internalUrlSchemeSpec(scheme: string): InternalUrlSchemeSpec | u
|
|
|
33
47
|
return schemeHost?.spec(scheme);
|
|
34
48
|
}
|
|
35
49
|
|
|
50
|
+
const NO_SPECS: ReadonlyMap<string, InternalUrlSchemeSpec> = new Map();
|
|
51
|
+
|
|
52
|
+
/** Declared specs of every registered scheme, keyed by lowercased scheme; empty when no host is installed. */
|
|
53
|
+
export function internalUrlSchemeSpecs(): ReadonlyMap<string, InternalUrlSchemeSpec> {
|
|
54
|
+
return schemeHost?.specs() ?? NO_SPECS;
|
|
55
|
+
}
|
|
56
|
+
|
|
36
57
|
const URL_SCHEME_RE = /^([a-z][a-z0-9+.-]*):\/\//i;
|
|
37
58
|
|
|
38
59
|
/** Split a hierarchical `scheme://rest` URL into its lowercased scheme and the text after `://`. */
|
package/src/tools/vibe.ts
CHANGED
|
@@ -206,6 +206,7 @@ function tvScreen(
|
|
|
206
206
|
screen: VibeScreenSnapshot,
|
|
207
207
|
options: RenderResultOptions,
|
|
208
208
|
settledStatus?: "completed" | "failed" | "cancelled",
|
|
209
|
+
nowMs = Date.now(),
|
|
209
210
|
): string[] {
|
|
210
211
|
const live = screen.state === "running" || screen.state === "starting";
|
|
211
212
|
const spinnerFrame = live ? options.spinnerFrame : undefined;
|
|
@@ -223,7 +224,7 @@ function tvScreen(
|
|
|
223
224
|
const turnsLabel = `${screen.turns}t${screen.queued > 0 ? `+${screen.queued}q` : ""}`;
|
|
224
225
|
headParts.push(uiTheme.fg("muted", turnsLabel));
|
|
225
226
|
if (screen.turnStartedAt !== undefined) {
|
|
226
|
-
headParts.push(uiTheme.fg("dim", formatDuration(
|
|
227
|
+
headParts.push(uiTheme.fg("dim", formatDuration(nowMs - screen.turnStartedAt)));
|
|
227
228
|
}
|
|
228
229
|
if (screen.model) headParts.push(uiTheme.fg("muted", frameText(screen.model, 40)));
|
|
229
230
|
|
|
@@ -603,6 +604,8 @@ export function createVibeToolRenderer(op: VibeOp) {
|
|
|
603
604
|
}
|
|
604
605
|
const waiting = details.wait?.waiting === true;
|
|
605
606
|
const settledById = new Map(details.wait?.settled.map(entry => [entry.id, entry.status] as const) ?? []);
|
|
607
|
+
const snapshotTime = Date.now();
|
|
608
|
+
const wallOptions = options.isPartial ? options : { ...options, spinnerFrame: undefined };
|
|
606
609
|
return linesComponent(() => {
|
|
607
610
|
const running = screens.filter(screen => screen.state === "running" || screen.state === "starting").length;
|
|
608
611
|
const meta: string[] = [];
|
|
@@ -619,7 +622,7 @@ export function createVibeToolRenderer(op: VibeOp) {
|
|
|
619
622
|
const header = renderStatusLine(
|
|
620
623
|
{
|
|
621
624
|
icon: details.wait?.timedOut ? "warning" : running > 0 ? "info" : "done",
|
|
622
|
-
spinnerFrame: running > 0 ?
|
|
625
|
+
spinnerFrame: running > 0 ? wallOptions.spinnerFrame : undefined,
|
|
623
626
|
title,
|
|
624
627
|
meta,
|
|
625
628
|
},
|
|
@@ -627,7 +630,15 @@ export function createVibeToolRenderer(op: VibeOp) {
|
|
|
627
630
|
);
|
|
628
631
|
const lines = [header];
|
|
629
632
|
for (const screen of screens) {
|
|
630
|
-
lines.push(
|
|
633
|
+
lines.push(
|
|
634
|
+
...tvScreen(
|
|
635
|
+
uiTheme,
|
|
636
|
+
screen,
|
|
637
|
+
wallOptions,
|
|
638
|
+
settledById.get(screen.id),
|
|
639
|
+
options.isPartial ? Date.now() : snapshotTime,
|
|
640
|
+
),
|
|
641
|
+
);
|
|
631
642
|
}
|
|
632
643
|
return lines;
|
|
633
644
|
});
|
package/src/tools/wait.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ import type { NativeToolView, ToolRenderResult } from "./renderer";
|
|
|
10
10
|
/** Whether a wait snapshot contains only running jobs and no cancellations. */
|
|
11
11
|
export declare function isWaitingPollDetails(details: unknown): boolean;
|
|
12
12
|
/** Coordination details retained by wait and background job operations. */
|
|
13
|
-
export type CoordinationOp = "send" | "wait" | "
|
|
14
|
-
/** Background-job row surfaced by `wait`/`cancel
|
|
13
|
+
export type CoordinationOp = "send" | "wait" | "cancel";
|
|
14
|
+
/** Background-job row surfaced by `wait`/`cancel` results and `proc://` listings. */
|
|
15
15
|
export interface JobSnapshot {
|
|
16
16
|
id: string;
|
|
17
17
|
type: "bash" | "task" | "eval";
|
|
@@ -32,6 +32,14 @@ export interface JobSnapshot {
|
|
|
32
32
|
completionPercent?: number;
|
|
33
33
|
/** The task agent's latest stage in its own words; see `AgentProgress.stage`. */
|
|
34
34
|
stage?: string;
|
|
35
|
+
/** Running task only: assistant requests so far; see `AgentProgress.requests`. */
|
|
36
|
+
requests?: number;
|
|
37
|
+
/** Running task only: cumulative cost in USD; see `AgentProgress.cost`. */
|
|
38
|
+
cost?: number;
|
|
39
|
+
/** Running task only: latest per-turn context size; see `AgentProgress.contextTokens`. */
|
|
40
|
+
contextTokens?: number;
|
|
41
|
+
/** Running task only: the model's context window; see `AgentProgress.contextWindow`. */
|
|
42
|
+
contextWindow?: number;
|
|
35
43
|
/** The job's live widget, while one is being drawn; frozen at its last state once the job settles. */
|
|
36
44
|
widget?: JobWidgetView;
|
|
37
45
|
resultText?: string;
|
|
@@ -47,6 +55,12 @@ export interface JobSnapshot {
|
|
|
47
55
|
* on collision, else the job id itself. See {@link AsyncJob.agentId}.
|
|
48
56
|
*/
|
|
49
57
|
agentUrlId?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Whether this job's turn published `<agentUrlId>.md`. False where the job
|
|
60
|
+
* body reported that it wrote none, so `agent://` still holds an earlier
|
|
61
|
+
* turn's output; undefined where the body does not report it.
|
|
62
|
+
*/
|
|
63
|
+
agentOutputPublished?: boolean;
|
|
50
64
|
}
|
|
51
65
|
/** Outcome of cancelling one background job. */
|
|
52
66
|
export type CancelStatus = "cancelled" | "not_found" | "already_completed";
|
package/src/tools/wait.ts
CHANGED
|
@@ -43,9 +43,9 @@ export function isWaitingPollDetails(details: unknown): boolean {
|
|
|
43
43
|
return d.jobs.every(job => job?.status === "running");
|
|
44
44
|
}
|
|
45
45
|
/** Coordination details retained by wait and background job operations. */
|
|
46
|
-
export type CoordinationOp = "send" | "wait" | "
|
|
46
|
+
export type CoordinationOp = "send" | "wait" | "cancel";
|
|
47
47
|
|
|
48
|
-
/** Background-job row surfaced by `wait`/`cancel
|
|
48
|
+
/** Background-job row surfaced by `wait`/`cancel` results and `proc://` listings. */
|
|
49
49
|
export interface JobSnapshot {
|
|
50
50
|
id: string;
|
|
51
51
|
type: "bash" | "task" | "eval";
|
|
@@ -66,6 +66,14 @@ export interface JobSnapshot {
|
|
|
66
66
|
completionPercent?: number;
|
|
67
67
|
/** The task agent's latest stage in its own words; see `AgentProgress.stage`. */
|
|
68
68
|
stage?: string;
|
|
69
|
+
/** Running task only: assistant requests so far; see `AgentProgress.requests`. */
|
|
70
|
+
requests?: number;
|
|
71
|
+
/** Running task only: cumulative cost in USD; see `AgentProgress.cost`. */
|
|
72
|
+
cost?: number;
|
|
73
|
+
/** Running task only: latest per-turn context size; see `AgentProgress.contextTokens`. */
|
|
74
|
+
contextTokens?: number;
|
|
75
|
+
/** Running task only: the model's context window; see `AgentProgress.contextWindow`. */
|
|
76
|
+
contextWindow?: number;
|
|
69
77
|
/** The job's live widget, while one is being drawn; frozen at its last state once the job settles. */
|
|
70
78
|
widget?: JobWidgetView;
|
|
71
79
|
resultText?: string;
|
|
@@ -81,6 +89,12 @@ export interface JobSnapshot {
|
|
|
81
89
|
* on collision, else the job id itself. See {@link AsyncJob.agentId}.
|
|
82
90
|
*/
|
|
83
91
|
agentUrlId?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Whether this job's turn published `<agentUrlId>.md`. False where the job
|
|
94
|
+
* body reported that it wrote none, so `agent://` still holds an earlier
|
|
95
|
+
* turn's output; undefined where the body does not report it.
|
|
96
|
+
*/
|
|
97
|
+
agentOutputPublished?: boolean;
|
|
84
98
|
}
|
|
85
99
|
|
|
86
100
|
/** Outcome of cancelling one background job. */
|
package/src/tools/yield.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const yieldToolRenderer: {
|
|
|
15
15
|
renderCall(args: YieldRenderArgs, options: RenderResultOptions, theme: Theme): Component;
|
|
16
16
|
renderResult(result: ToolRenderResult<YieldItem>, options: RenderResultContextOptions, theme: Theme, args?: YieldRenderArgs): Component;
|
|
17
17
|
describeCall(args: YieldRenderArgs, options: RenderResultOptions): NativeToolView;
|
|
18
|
-
describeResult(result: ToolRenderResult<YieldItem>,
|
|
18
|
+
describeResult(result: ToolRenderResult<YieldItem>, options: RenderResultContextOptions, args?: YieldRenderArgs): NativeToolView;
|
|
19
19
|
mergeCallAndResult: true;
|
|
20
20
|
animatedPendingPreview: true;
|
|
21
21
|
};
|
package/src/tools/yield.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type { Theme } from "../theme/theme";
|
|
|
16
16
|
import type { Component } from "../tui";
|
|
17
17
|
import { wrapTextWithAnsi } from "../utils";
|
|
18
18
|
import {
|
|
19
|
-
|
|
19
|
+
describeJsonValue,
|
|
20
20
|
JSON_TREE_MAX_DEPTH_COLLAPSED,
|
|
21
21
|
JSON_TREE_MAX_DEPTH_EXPANDED,
|
|
22
22
|
JSON_TREE_MAX_LINES_COLLAPSED,
|
|
@@ -98,15 +98,20 @@ function sizeMeta(data: unknown): string | undefined {
|
|
|
98
98
|
return undefined;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
function describeData(data: unknown, streaming: boolean): NativeChild | undefined {
|
|
101
|
+
function describeData(data: unknown, streaming: boolean, json: boolean): NativeChild | undefined {
|
|
102
102
|
if (data === undefined) return undefined;
|
|
103
103
|
if (typeof data === "string") return data.trim() ? md(data, { stream: streaming }) : noteText("(empty)");
|
|
104
104
|
// Open to the depth cap: the data is the card's whole point, and the
|
|
105
105
|
// collapsed card's preview clamp already bounds what shows.
|
|
106
|
-
return
|
|
106
|
+
return describeJsonValue(data, {
|
|
107
|
+
native: json,
|
|
108
|
+
open: JSON_TREE_MAX_DEPTH_EXPANDED - 1,
|
|
109
|
+
hiddenRootKeys: [],
|
|
110
|
+
openDepth: JSON_TREE_MAX_DEPTH_EXPANDED,
|
|
111
|
+
});
|
|
107
112
|
}
|
|
108
113
|
|
|
109
|
-
function describeSubmission(s: Submission, streaming: boolean): NativeToolView {
|
|
114
|
+
function describeSubmission(s: Submission, streaming: boolean, json: boolean): NativeToolView {
|
|
110
115
|
const size = sizeMeta(s.data);
|
|
111
116
|
return {
|
|
112
117
|
tool: {
|
|
@@ -119,7 +124,7 @@ function describeSubmission(s: Submission, streaming: boolean): NativeToolView {
|
|
|
119
124
|
tone: s.settled && s.error !== undefined ? "error" : undefined,
|
|
120
125
|
body: compact([
|
|
121
126
|
s.error !== undefined ? errorText(s.error) : undefined,
|
|
122
|
-
describeData(s.data, streaming),
|
|
127
|
+
describeData(s.data, streaming, json),
|
|
123
128
|
s.note ? noteText(s.note, "dim") : undefined,
|
|
124
129
|
]),
|
|
125
130
|
};
|
|
@@ -207,16 +212,20 @@ export const yieldToolRenderer = {
|
|
|
207
212
|
|
|
208
213
|
describeCall(args: YieldRenderArgs, options: RenderResultOptions): NativeToolView {
|
|
209
214
|
const streaming = options.argsComplete === false;
|
|
210
|
-
|
|
215
|
+
const json = options.json === true;
|
|
216
|
+
return callMemo.get(args, [streaming, json], () =>
|
|
217
|
+
describeSubmission(readSubmission(args, undefined), streaming, json),
|
|
218
|
+
);
|
|
211
219
|
},
|
|
212
220
|
|
|
213
221
|
describeResult(
|
|
214
222
|
result: ToolRenderResult<YieldItem>,
|
|
215
|
-
|
|
223
|
+
options: RenderResultContextOptions,
|
|
216
224
|
args?: YieldRenderArgs,
|
|
217
225
|
): NativeToolView {
|
|
218
|
-
|
|
219
|
-
|
|
226
|
+
const json = options.json === true;
|
|
227
|
+
return resultMemo.get(result.content, [args, result.details, result.isError, json], () =>
|
|
228
|
+
describeSubmission(readSubmission(args, result), false, json),
|
|
220
229
|
);
|
|
221
230
|
},
|
|
222
231
|
|
package/src/tui.d.ts
CHANGED
|
@@ -80,7 +80,9 @@ export interface TUIStartOptions {
|
|
|
80
80
|
* switches to raw input and replays the kernel-buffered keystrokes.
|
|
81
81
|
*
|
|
82
82
|
* A terminal expected to speak TSP needs raw input from the start, so it
|
|
83
|
-
* gets it
|
|
83
|
+
* gets it. Plain typing (printable text, Backspace) still edits the focused
|
|
84
|
+
* component live, as the kernel echo shows it elsewhere; the first other key
|
|
85
|
+
* and every key after it are held instead (TSP events and the cell-size
|
|
84
86
|
* reply still apply) until {@link TUI.releaseHeldInput} replays them.
|
|
85
87
|
*/
|
|
86
88
|
deferInput?: boolean;
|
|
@@ -363,6 +365,8 @@ export declare class TUI extends Container {
|
|
|
363
365
|
* observers (live stream publisher, session recorder) coexist.
|
|
364
366
|
*/
|
|
365
367
|
addPaintListener(listener: PaintListener): () => void;
|
|
368
|
+
/** Observe actual ANSI frame writes, including transient resize paints; returns the unsubscribe. */
|
|
369
|
+
addFrameWriteListener(listener: (data: string) => void): () => void;
|
|
366
370
|
/** Install the product-owned bounded frame provider. */
|
|
367
371
|
setFrameProvider(provider: TerminalFrameProvider | undefined): void;
|
|
368
372
|
get fullRedraws(): number;
|
|
@@ -523,7 +527,10 @@ export declare class TUI extends Container {
|
|
|
523
527
|
* never come.
|
|
524
528
|
*/
|
|
525
529
|
addStartListener(listener: StartListener): () => void;
|
|
526
|
-
|
|
530
|
+
/** Registers a key listener; `prepend` gives a foreground input owner first refusal over global shortcuts. */
|
|
531
|
+
addInputListener(listener: InputListener, options?: {
|
|
532
|
+
prepend?: boolean;
|
|
533
|
+
}): () => void;
|
|
527
534
|
removeInputListener(listener: InputListener): void;
|
|
528
535
|
stop(): void;
|
|
529
536
|
/**
|