@pentoshi/clai 4.14.5 → 4.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -5
- package/dist/agent/compaction-summary.d.ts +6 -1
- package/dist/agent/compaction-summary.js +46 -20
- package/dist/agent/compaction-summary.js.map +1 -1
- package/dist/agent/confirm-port.d.ts +3 -8
- package/dist/agent/confirm-port.js +9 -7
- package/dist/agent/confirm-port.js.map +1 -1
- package/dist/agent/context/compact-with-summary.js +55 -14
- package/dist/agent/context/compact-with-summary.js.map +1 -1
- package/dist/agent/context/compaction-recent-history.js +4 -2
- package/dist/agent/context/compaction-recent-history.js.map +1 -1
- package/dist/agent/context/compaction-user-instructions.d.ts +12 -0
- package/dist/agent/context/compaction-user-instructions.js +264 -0
- package/dist/agent/context/compaction-user-instructions.js.map +1 -0
- package/dist/agent/context/compaction-work-history.d.ts +13 -0
- package/dist/agent/context/compaction-work-history.js +150 -0
- package/dist/agent/context/compaction-work-history.js.map +1 -0
- package/dist/agent/context-manager.js +19 -5
- package/dist/agent/context-manager.js.map +1 -1
- package/dist/agent/plan-implement-compact.js +2 -1
- package/dist/agent/plan-implement-compact.js.map +1 -1
- package/dist/agent/turn/loop/stream-session.js +33 -27
- package/dist/agent/turn/loop/stream-session.js.map +1 -1
- package/dist/agent/turn/tool-execution/authorization.js +1 -1
- package/dist/agent/turn/tool-execution/authorization.js.map +1 -1
- package/dist/app/adapters/current-store-adapter.js +2 -2
- package/dist/app/adapters/current-store-adapter.js.map +1 -1
- package/dist/app/commands/catalog.js +1 -0
- package/dist/app/commands/catalog.js.map +1 -1
- package/dist/app/controllers/session-changes.d.ts +24 -0
- package/dist/app/controllers/session-changes.js +75 -0
- package/dist/app/controllers/session-changes.js.map +1 -0
- package/dist/app/controllers/session-controller.d.ts +4 -0
- package/dist/app/controllers/session-controller.js +13 -0
- package/dist/app/controllers/session-controller.js.map +1 -1
- package/dist/app/ports/confirm-port.d.ts +4 -1
- package/dist/app/ports/persistence-port.d.ts +2 -0
- package/dist/app/ports/transcript-item.d.ts +2 -0
- package/dist/classic/app/ClassicApp.js +42 -33
- package/dist/classic/app/ClassicApp.js.map +1 -1
- package/dist/classic/app/app-wiring.d.ts +8 -1
- package/dist/classic/app/app-wiring.js +23 -4
- package/dist/classic/app/app-wiring.js.map +1 -1
- package/dist/classic/app/paint-pacing.d.ts +3 -1
- package/dist/classic/app/paint-pacing.js +9 -1
- package/dist/classic/app/paint-pacing.js.map +1 -1
- package/dist/classic/app/use-feed.js +8 -3
- package/dist/classic/app/use-feed.js.map +1 -1
- package/dist/classic/app/wiring-composer-pointer.d.ts +3 -0
- package/dist/classic/app/wiring-composer-pointer.js +22 -0
- package/dist/classic/app/wiring-composer-pointer.js.map +1 -0
- package/dist/classic/app/wiring-disclosure.d.ts +3 -0
- package/dist/classic/app/wiring-disclosure.js +31 -0
- package/dist/classic/app/wiring-disclosure.js.map +1 -0
- package/dist/classic/app/wiring-interactions.d.ts +1 -0
- package/dist/classic/app/wiring-interactions.js +16 -16
- package/dist/classic/app/wiring-interactions.js.map +1 -1
- package/dist/classic/app/wiring-jump-to-latest.d.ts +3 -0
- package/dist/classic/app/wiring-jump-to-latest.js +38 -0
- package/dist/classic/app/wiring-jump-to-latest.js.map +1 -0
- package/dist/classic/app/wiring-lifecycle.d.ts +1 -1
- package/dist/classic/app/wiring-lifecycle.js +19 -10
- package/dist/classic/app/wiring-lifecycle.js.map +1 -1
- package/dist/classic/app/wiring-selection.d.ts +1 -0
- package/dist/classic/app/wiring-selection.js +10 -1
- package/dist/classic/app/wiring-selection.js.map +1 -1
- package/dist/classic/app/wiring-types.d.ts +12 -1
- package/dist/classic/blocks/assistant-lines.js +1 -1
- package/dist/classic/blocks/assistant-lines.js.map +1 -1
- package/dist/classic/blocks/batch-lines.d.ts +1 -1
- package/dist/classic/blocks/batch-lines.js +47 -59
- package/dist/classic/blocks/batch-lines.js.map +1 -1
- package/dist/classic/blocks/block-context.d.ts +8 -1
- package/dist/classic/blocks/block-context.js.map +1 -1
- package/dist/classic/blocks/compacted-lines.d.ts +0 -1
- package/dist/classic/blocks/compacted-lines.js +12 -44
- package/dist/classic/blocks/compacted-lines.js.map +1 -1
- package/dist/classic/blocks/diff-lines.d.ts +3 -5
- package/dist/classic/blocks/diff-lines.js +113 -152
- package/dist/classic/blocks/diff-lines.js.map +1 -1
- package/dist/classic/blocks/disclosure-lines.d.ts +16 -0
- package/dist/classic/blocks/disclosure-lines.js +20 -0
- package/dist/classic/blocks/disclosure-lines.js.map +1 -0
- package/dist/classic/blocks/intro-lines.js +2 -0
- package/dist/classic/blocks/intro-lines.js.map +1 -1
- package/dist/classic/blocks/notice-lines.js +4 -16
- package/dist/classic/blocks/notice-lines.js.map +1 -1
- package/dist/classic/blocks/output-lines.d.ts +10 -0
- package/dist/classic/blocks/output-lines.js +35 -0
- package/dist/classic/blocks/output-lines.js.map +1 -0
- package/dist/classic/blocks/thinking-lines.d.ts +0 -1
- package/dist/classic/blocks/thinking-lines.js +15 -32
- package/dist/classic/blocks/thinking-lines.js.map +1 -1
- package/dist/classic/blocks/tool-label.d.ts +2 -0
- package/dist/classic/blocks/tool-label.js +8 -0
- package/dist/classic/blocks/tool-label.js.map +1 -0
- package/dist/classic/blocks/tool-lines.d.ts +3 -5
- package/dist/classic/blocks/tool-lines.js +90 -150
- package/dist/classic/blocks/tool-lines.js.map +1 -1
- package/dist/classic/blocks/turn-summary-lines.js +7 -1
- package/dist/classic/blocks/turn-summary-lines.js.map +1 -1
- package/dist/classic/blocks/user-lines.js +9 -15
- package/dist/classic/blocks/user-lines.js.map +1 -1
- package/dist/classic/bootstrap/start-classic.js +2 -0
- package/dist/classic/bootstrap/start-classic.js.map +1 -1
- package/dist/classic/chrome/Composer.d.ts +4 -2
- package/dist/classic/chrome/Composer.js +12 -6
- package/dist/classic/chrome/Composer.js.map +1 -1
- package/dist/classic/chrome/composer-controller.d.ts +3 -0
- package/dist/classic/chrome/composer-controller.js +15 -22
- package/dist/classic/chrome/composer-controller.js.map +1 -1
- package/dist/classic/chrome/composer-frame.d.ts +1 -1
- package/dist/classic/chrome/composer-frame.js +2 -1
- package/dist/classic/chrome/composer-frame.js.map +1 -1
- package/dist/classic/chrome/composer-mentions.d.ts +2 -0
- package/dist/classic/chrome/composer-mentions.js +16 -0
- package/dist/classic/chrome/composer-mentions.js.map +1 -0
- package/dist/classic/chrome/composer-pointer.d.ts +13 -0
- package/dist/classic/chrome/composer-pointer.js +22 -0
- package/dist/classic/chrome/composer-pointer.js.map +1 -0
- package/dist/classic/chrome/directory-row.d.ts +20 -2
- package/dist/classic/chrome/directory-row.js +45 -1
- package/dist/classic/chrome/directory-row.js.map +1 -1
- package/dist/classic/chrome/editor-view.js +6 -1
- package/dist/classic/chrome/editor-view.js.map +1 -1
- package/dist/classic/chrome/queue-rows.d.ts +1 -0
- package/dist/classic/chrome/queue-rows.js +12 -2
- package/dist/classic/chrome/queue-rows.js.map +1 -1
- package/dist/classic/chrome/status-rows.d.ts +1 -0
- package/dist/classic/chrome/status-rows.js +5 -4
- package/dist/classic/chrome/status-rows.js.map +1 -1
- package/dist/classic/chrome/toast-rows.js +7 -6
- package/dist/classic/chrome/toast-rows.js.map +1 -1
- package/dist/classic/feed/LiveTail.d.ts +4 -3
- package/dist/classic/feed/LiveTail.js +26 -15
- package/dist/classic/feed/LiveTail.js.map +1 -1
- package/dist/classic/feed/feed-blocks.d.ts +2 -0
- package/dist/classic/feed/feed-blocks.js +4 -2
- package/dist/classic/feed/feed-blocks.js.map +1 -1
- package/dist/classic/feed/transcript-disclosure.d.ts +6 -0
- package/dist/classic/feed/transcript-disclosure.js +9 -0
- package/dist/classic/feed/transcript-disclosure.js.map +1 -0
- package/dist/classic/feed/transcript-resources.d.ts +23 -0
- package/dist/classic/feed/transcript-resources.js +140 -0
- package/dist/classic/feed/transcript-resources.js.map +1 -0
- package/dist/classic/feed/transcript-window.js +43 -18
- package/dist/classic/feed/transcript-window.js.map +1 -1
- package/dist/classic/input/input-router.d.ts +2 -0
- package/dist/classic/input/input-router.js +6 -0
- package/dist/classic/input/input-router.js.map +1 -1
- package/dist/classic/input/raw-decoder.js +3 -2
- package/dist/classic/input/raw-decoder.js.map +1 -1
- package/dist/classic/panels/confirm-panel.js +17 -10
- package/dist/classic/panels/confirm-panel.js.map +1 -1
- package/dist/classic/panels/pager-panel.d.ts +6 -2
- package/dist/classic/panels/pager-panel.js +11 -4
- package/dist/classic/panels/pager-panel.js.map +1 -1
- package/dist/classic/panels/panel-controller.js +4 -1
- package/dist/classic/panels/panel-controller.js.map +1 -1
- package/dist/classic/panels/panel-host.js +1 -1
- package/dist/classic/panels/panel-host.js.map +1 -1
- package/dist/classic/panels/panel-wheel.js +1 -1
- package/dist/classic/panels/panel-wheel.js.map +1 -1
- package/dist/classic/render/shell-width.d.ts +0 -2
- package/dist/classic/render/shell-width.js +0 -6
- package/dist/classic/render/shell-width.js.map +1 -1
- package/dist/instructions/record.d.ts +1 -1
- package/dist/instructions/record.js +3 -3
- package/dist/llm/free-client.d.ts +2 -0
- package/dist/llm/free-client.js +52 -0
- package/dist/llm/free-client.js.map +1 -0
- package/dist/llm/free.d.ts +1 -0
- package/dist/llm/free.js +77 -176
- package/dist/llm/free.js.map +1 -1
- package/dist/llm/key-rotation.d.ts +1 -0
- package/dist/llm/key-rotation.js +13 -2
- package/dist/llm/key-rotation.js.map +1 -1
- package/dist/llm/reasoning-errors.js +1 -1
- package/dist/llm/reasoning-errors.js.map +1 -1
- package/dist/llm/wire/reasoning-artifacts.js +1 -1
- package/dist/llm/wire/reasoning-artifacts.js.map +1 -1
- package/dist/noninteractive/stdio-confirm-port.js +4 -3
- package/dist/noninteractive/stdio-confirm-port.js.map +1 -1
- package/dist/prompts/embedded.js +1 -1
- package/dist/prompts/embedded.js.map +1 -1
- package/dist/prompts/index.js +24 -21
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/system.agent.md +6 -0
- package/dist/safety/filesystem-permissions.d.ts +8 -0
- package/dist/safety/filesystem-permissions.js +38 -18
- package/dist/safety/filesystem-permissions.js.map +1 -1
- package/dist/safety/patterns.d.ts +1 -1
- package/dist/safety/patterns.js +7 -7
- package/dist/safety/patterns.js.map +1 -1
- package/dist/safety/permission-mode.js +1 -1
- package/dist/safety/permission-mode.js.map +1 -1
- package/dist/safety/shell-classification.js +1 -1
- package/dist/safety/shell-classification.js.map +1 -1
- package/dist/session-runtime/view-manager.js +1 -1
- package/dist/session-runtime/view-manager.js.map +1 -1
- package/dist/store/history/recovery.d.ts +1 -0
- package/dist/store/history/recovery.js.map +1 -1
- package/dist/store/history/sqlite-backend.js +2 -0
- package/dist/store/history/sqlite-backend.js.map +1 -1
- package/dist/store/history.d.ts +2 -2
- package/dist/store/history.js +4 -2
- package/dist/store/history.js.map +1 -1
- package/dist/store/session-prompts.d.ts +5 -0
- package/dist/store/session-prompts.js +60 -1
- package/dist/store/session-prompts.js.map +1 -1
- package/dist/tools/definitions/aggregate.js +7 -2
- package/dist/tools/definitions/aggregate.js.map +1 -1
- package/dist/tools/instructions.js +8 -1
- package/dist/tools/instructions.js.map +1 -1
- package/dist/tui-v2/app/App.js +7 -4
- package/dist/tui-v2/app/App.js.map +1 -1
- package/dist/tui-v2/bootstrap/frame-pacing.d.ts +4 -0
- package/dist/tui-v2/bootstrap/frame-pacing.js +5 -0
- package/dist/tui-v2/bootstrap/frame-pacing.js.map +1 -0
- package/dist/tui-v2/bootstrap/runtime-view.js +2 -0
- package/dist/tui-v2/bootstrap/runtime-view.js.map +1 -1
- package/dist/tui-v2/bootstrap/start-tui-v2.js +2 -0
- package/dist/tui-v2/bootstrap/start-tui-v2.js.map +1 -1
- package/dist/tui-v2/components/modal/confirm-modal.d.ts +2 -0
- package/dist/tui-v2/components/modal/confirm-modal.js +21 -35
- package/dist/tui-v2/components/modal/confirm-modal.js.map +1 -1
- package/dist/tui-v2/components/overlay/overlay-host.js +1 -1
- package/dist/tui-v2/components/overlay/overlay-host.js.map +1 -1
- package/dist/tui-v2/components/pager/pager.js +4 -1
- package/dist/tui-v2/components/pager/pager.js.map +1 -1
- package/dist/tui-v2/components/queue/queue-panel.js +2 -7
- package/dist/tui-v2/components/queue/queue-panel.js.map +1 -1
- package/dist/tui-v2/components/status/jump-to-latest.d.ts +7 -0
- package/dist/tui-v2/components/status/jump-to-latest.js +16 -0
- package/dist/tui-v2/components/status/jump-to-latest.js.map +1 -0
- package/dist/tui-v2/components/status/status-line.d.ts +1 -0
- package/dist/tui-v2/components/status/status-line.js +14 -4
- package/dist/tui-v2/components/status/status-line.js.map +1 -1
- package/dist/tui-v2/components/toast/toast-host.js +4 -7
- package/dist/tui-v2/components/toast/toast-host.js.map +1 -1
- package/dist/tui-v2/components/transcript/file-diff-card.d.ts +1 -0
- package/dist/tui-v2/components/transcript/file-diff-card.js +25 -11
- package/dist/tui-v2/components/transcript/file-diff-card.js.map +1 -1
- package/dist/tui-v2/components/transcript/tool-card.js +24 -20
- package/dist/tui-v2/components/transcript/tool-card.js.map +1 -1
- package/dist/tui-v2/components/transcript/transcript-row.js +6 -3
- package/dist/tui-v2/components/transcript/transcript-row.js.map +1 -1
- package/dist/tui-v2/components/transcript/transcript-scroll-port.d.ts +1 -0
- package/dist/tui-v2/components/transcript/transcript-scroll-port.js +3 -1
- package/dist/tui-v2/components/transcript/transcript-scroll-port.js.map +1 -1
- package/dist/tui-v2/components/transcript/transcript-scrollbar.js +17 -11
- package/dist/tui-v2/components/transcript/transcript-scrollbar.js.map +1 -1
- package/dist/tui-v2/components/transcript/transcript-view.js +41 -21
- package/dist/tui-v2/components/transcript/transcript-view.js.map +1 -1
- package/dist/tui-v2/composer/composer-editor.js +14 -9
- package/dist/tui-v2/composer/composer-editor.js.map +1 -1
- package/dist/tui-v2/rendering/pager-markdown.d.ts +3 -0
- package/dist/tui-v2/rendering/pager-markdown.js +3 -0
- package/dist/tui-v2/rendering/pager-markdown.js.map +1 -1
- package/dist/types.d.ts +12 -0
- package/dist/types.js.map +1 -1
- package/dist/ui/mentions/file-suggestions.js +17 -8
- package/dist/ui/mentions/file-suggestions.js.map +1 -1
- package/dist/ui-core/actions/format-shortcuts.js +2 -0
- package/dist/ui-core/actions/format-shortcuts.js.map +1 -1
- package/dist/ui-core/bootstrap/overlay-ports.js +8 -3
- package/dist/ui-core/bootstrap/overlay-ports.js.map +1 -1
- package/dist/ui-core/bootstrap/session-resume.js +1 -0
- package/dist/ui-core/bootstrap/session-resume.js.map +1 -1
- package/dist/ui-core/commands/change-commands.d.ts +4 -0
- package/dist/ui-core/commands/change-commands.js +48 -0
- package/dist/ui-core/commands/change-commands.js.map +1 -0
- package/dist/ui-core/commands/command-handlers.js +2 -0
- package/dist/ui-core/commands/command-handlers.js.map +1 -1
- package/dist/ui-core/composer/arrow-intent.js +2 -0
- package/dist/ui-core/composer/arrow-intent.js.map +1 -1
- package/dist/ui-core/composer/paste-placeholder.js +2 -2
- package/dist/ui-core/composer/paste-placeholder.js.map +1 -1
- package/dist/ui-core/composer/prompt-history.d.ts +12 -0
- package/dist/ui-core/composer/prompt-history.js +75 -1
- package/dist/ui-core/composer/prompt-history.js.map +1 -1
- package/dist/ui-core/composer/saved-prompt-history.d.ts +5 -0
- package/dist/ui-core/composer/saved-prompt-history.js +33 -0
- package/dist/ui-core/composer/saved-prompt-history.js.map +1 -0
- package/dist/ui-core/controllers/overlay-controller.d.ts +1 -0
- package/dist/ui-core/controllers/overlay-controller.js.map +1 -1
- package/dist/ui-core/react/use-transcript-store.js +4 -2
- package/dist/ui-core/react/use-transcript-store.js.map +1 -1
- package/dist/ui-core/rendering/artifact-pager-source.d.ts +3 -0
- package/dist/ui-core/rendering/artifact-pager-source.js.map +1 -1
- package/dist/ui-core/rendering/batch-sections.d.ts +3 -2
- package/dist/ui-core/rendering/batch-sections.js +5 -5
- package/dist/ui-core/rendering/batch-sections.js.map +1 -1
- package/dist/ui-core/rendering/card-style.d.ts +2 -0
- package/dist/ui-core/rendering/card-style.js +3 -0
- package/dist/ui-core/rendering/card-style.js.map +1 -0
- package/dist/ui-core/rendering/confirmation-preview.d.ts +9 -0
- package/dist/ui-core/rendering/confirmation-preview.js +33 -0
- package/dist/ui-core/rendering/confirmation-preview.js.map +1 -0
- package/dist/ui-core/rendering/duration.d.ts +2 -1
- package/dist/ui-core/rendering/duration.js +4 -6
- package/dist/ui-core/rendering/duration.js.map +1 -1
- package/dist/ui-core/rendering/intro-header.d.ts +1 -0
- package/dist/ui-core/rendering/intro-header.js +19 -15
- package/dist/ui-core/rendering/intro-header.js.map +1 -1
- package/dist/ui-core/rendering/jump-to-latest.d.ts +1 -0
- package/dist/ui-core/rendering/jump-to-latest.js +7 -0
- package/dist/ui-core/rendering/jump-to-latest.js.map +1 -0
- package/dist/ui-core/rendering/line-change-labels.d.ts +6 -0
- package/dist/ui-core/rendering/line-change-labels.js +12 -0
- package/dist/ui-core/rendering/line-change-labels.js.map +1 -0
- package/dist/ui-core/rendering/markdown.d.ts +5 -1
- package/dist/ui-core/rendering/markdown.js +20 -5
- package/dist/ui-core/rendering/markdown.js.map +1 -1
- package/dist/ui-core/rendering/render-markdown-lines.d.ts +3 -0
- package/dist/ui-core/rendering/render-markdown-lines.js +6 -1
- package/dist/ui-core/rendering/render-markdown-lines.js.map +1 -1
- package/dist/ui-core/rendering/session-prompts-pager-source.js +2 -0
- package/dist/ui-core/rendering/session-prompts-pager-source.js.map +1 -1
- package/dist/ui-core/rendering/status-segments.js +10 -5
- package/dist/ui-core/rendering/status-segments.js.map +1 -1
- package/dist/ui-core/rendering/subagent-presentation.js +39 -11
- package/dist/ui-core/rendering/subagent-presentation.js.map +1 -1
- package/dist/ui-core/rendering/subagent-source.js +11 -48
- package/dist/ui-core/rendering/subagent-source.js.map +1 -1
- package/dist/ui-core/rendering/subagent-tool-usage.d.ts +5 -0
- package/dist/ui-core/rendering/subagent-tool-usage.js +42 -0
- package/dist/ui-core/rendering/subagent-tool-usage.js.map +1 -0
- package/dist/ui-core/rendering/tool-diff-preview.d.ts +21 -0
- package/dist/ui-core/rendering/tool-diff-preview.js +27 -0
- package/dist/ui-core/rendering/tool-diff-preview.js.map +1 -0
- package/dist/ui-core/rendering/tool-presenter.d.ts +4 -2
- package/dist/ui-core/rendering/tool-presenter.js +19 -4
- package/dist/ui-core/rendering/tool-presenter.js.map +1 -1
- package/dist/ui-core/rendering/tool-usage-label.d.ts +2 -0
- package/dist/ui-core/rendering/tool-usage-label.js +42 -0
- package/dist/ui-core/rendering/tool-usage-label.js.map +1 -0
- package/dist/ui-core/state/hydrate/classic-transcript.js +2 -0
- package/dist/ui-core/state/hydrate/classic-transcript.js.map +1 -1
- package/dist/ui-core/state/transcript/apply-app-event.js +16 -5
- package/dist/ui-core/state/transcript/apply-app-event.js.map +1 -1
- package/dist/ui-core/state/transcript-hydrate.js +1 -0
- package/dist/ui-core/state/transcript-hydrate.js.map +1 -1
- package/dist/ui-core/state/transcript-types.d.ts +4 -0
- package/dist/ui-core/state/transcript-types.js.map +1 -1
- package/dist/version.generated.d.ts +2 -2
- package/dist/version.generated.js +2 -2
- package/package.json +1 -1
- package/dist/classic/feed/ScrollbarGutter.d.ts +0 -9
- package/dist/classic/feed/ScrollbarGutter.js +0 -41
- package/dist/classic/feed/ScrollbarGutter.js.map +0 -1
- package/dist/classic/feed/scrollbar-rows.d.ts +0 -5
- package/dist/classic/feed/scrollbar-rows.js +0 -17
- package/dist/classic/feed/scrollbar-rows.js.map +0 -1
|
@@ -1,171 +1,132 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { buildModalLines, changeVerb } from "../../tools/file-diff.js";
|
|
2
|
+
import { relativeDisplayPath, syntaxColor } from "../../ui-core/rendering/file-diff-view.js";
|
|
3
|
+
import { emptyCarry, highlightLineForPath } from "../../ui-core/rendering/syntax-highlight.js";
|
|
4
|
+
import { sanitizeDisplayText } from "../../ui-core/rendering/sanitize-display.js";
|
|
5
|
+
import { isFileDiffExpanded, isItemExpanded } from "../../ui-core/state/transcript-types.js";
|
|
6
|
+
import { clipToWidth, expandTabs, sealStyle, trimTrailingSpaces } from "../render/ansi-text.js";
|
|
7
|
+
import { layoutWidth } from "../render/measure.js";
|
|
8
|
+
import { wrapAnsiLine } from "../render/wrap.js";
|
|
9
|
+
import { clipRow } from "./block-context.js";
|
|
10
|
+
import { appendDisclosure } from "./disclosure-lines.js";
|
|
11
|
+
import { buildToolBodyLines, hintRows, toolGlyph, TOOL_STATUS_TOKEN } from "./tool-lines.js";
|
|
12
|
+
export const DIFF_PREVIEW_LINES = 3;
|
|
9
13
|
export const WRITE_MANY_LISTED_FILES = 12;
|
|
10
|
-
export const DIFF_INDENT =
|
|
14
|
+
export const DIFF_INDENT = 4;
|
|
11
15
|
export const DIFF_TAB_WIDTH = 4;
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
function changeMark(ctx, kind) {
|
|
22
|
-
if (kind === "create")
|
|
23
|
-
return { mark: "+", token: "success" };
|
|
24
|
-
if (kind === "overwrite")
|
|
25
|
-
return { mark: "~", token: "activity" };
|
|
26
|
-
return { mark: ctx.glyphs.separator, token: "toolOutput" };
|
|
27
|
-
}
|
|
28
|
-
function washToken(tone) {
|
|
29
|
-
if (tone === "add")
|
|
30
|
-
return "diffAddBg";
|
|
31
|
-
if (tone === "del")
|
|
32
|
-
return "diffDelBg";
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
function syntaxCode(ctx, row) {
|
|
36
|
-
if (ctx.ink.colorMode === "none")
|
|
37
|
-
return row.displayText;
|
|
38
|
-
let out = "";
|
|
39
|
-
for (const span of row.spans)
|
|
40
|
-
out += ctx.ink.hex(syntaxColor(span.kind, ctx.ink.theme), span.text);
|
|
41
|
-
return out;
|
|
42
|
-
}
|
|
43
|
-
function mutedCode(ctx, text) {
|
|
44
|
-
return ctx.ink.style(text, { fg: "muted", dim: true });
|
|
45
|
-
}
|
|
46
|
-
function gutterCell(ctx, row) {
|
|
47
|
-
const rail = row.tone === "add" ? "diffAdd" : row.tone === "del" ? "diffDel" : "diffGutter";
|
|
48
|
-
return `${ctx.ink.fg("diffGutter", `${row.gutter} `)}${ctx.ink.fg(rail, `${ctx.glyphs.boxVertical} `)}`;
|
|
49
|
-
}
|
|
50
|
-
function quietText(row) {
|
|
51
|
-
return row.tone === "gap" ? row.displayText.replace(CLICK_HINT, "") : row.displayText;
|
|
52
|
-
}
|
|
53
|
-
function washedRow(ctx, row, rowWidth) {
|
|
54
|
-
const gutter = gutterCell(ctx, row);
|
|
55
|
-
const line = clipToWidth(`${gutter}${markedBody(ctx, row)}`, rowWidth, ctx.glyphs.ellipsis);
|
|
56
|
-
const wash = washToken(row.tone);
|
|
57
|
-
return wash ? ctx.ink.band(line, rowWidth, { bg: wash }) : line;
|
|
58
|
-
}
|
|
59
|
-
function markedRow(ctx, row, rowWidth) {
|
|
60
|
-
const gutter = gutterCell(ctx, row);
|
|
61
|
-
return clipToWidth(`${gutter}${markedBody(ctx, row)}`, rowWidth, ctx.glyphs.ellipsis);
|
|
62
|
-
}
|
|
63
|
-
function markedBody(ctx, row) {
|
|
64
|
-
if (row.tone === "context")
|
|
65
|
-
return ` ${syntaxCode(ctx, row)}`;
|
|
66
|
-
if (row.tone !== "add" && row.tone !== "del")
|
|
67
|
-
return ` ${mutedCode(ctx, quietText(row))}`;
|
|
68
|
-
const marker = row.prefix === "−" ? "-" : row.prefix;
|
|
69
|
-
const token = row.tone === "add" ? "diffAdd" : "diffDel";
|
|
70
|
-
return `${ctx.ink.style(marker, { fg: token, bold: true })} ${syntaxCode(ctx, row)}`;
|
|
71
|
-
}
|
|
72
|
-
function diffRowLine(ctx, row) {
|
|
73
|
-
const rowWidth = Math.max(1, ctx.width - DIFF_INDENT);
|
|
74
|
-
const body = ctx.ink.washColor ? washedRow(ctx, row, rowWidth) : markedRow(ctx, row, rowWidth);
|
|
75
|
-
return trimTrailingSpaces(sealStyle(`${" ".repeat(DIFF_INDENT)}${body}`));
|
|
76
|
-
}
|
|
77
|
-
function codeBudget(ctx, change) {
|
|
78
|
-
const marker = 2;
|
|
79
|
-
return Math.max(8, ctx.width - DIFF_INDENT - gutterWidth(change) - GUTTER_RULE_WIDTH - marker);
|
|
16
|
+
function verb(item, change) {
|
|
17
|
+
const kind = change?.kind ?? "edit";
|
|
18
|
+
const status = item.status === "failed" || item.status === "blocked" ? "failed" : item.status === "ok" ? "ok" : "running";
|
|
19
|
+
if (kind === "create" && status !== "failed")
|
|
20
|
+
return status === "ok" ? "Added" : "Adding";
|
|
21
|
+
if (kind === "overwrite" || kind === "append")
|
|
22
|
+
return status === "ok" ? "Edited" : changeVerb(kind, status);
|
|
23
|
+
return changeVerb(kind, status);
|
|
80
24
|
}
|
|
81
25
|
export function diffStatsSuffix(ctx, change) {
|
|
82
|
-
const minus = ctx.ink.unicode ? "−" : "-";
|
|
83
26
|
const added = ctx.ink.style(`+${change.stats.added}`, { fg: "success", bold: true });
|
|
84
|
-
const removed = ctx.ink.style(
|
|
85
|
-
return
|
|
27
|
+
const removed = ctx.ink.style(`-${change.stats.removed}`, { fg: "diffDel", bold: true });
|
|
28
|
+
return `(${added} ${removed})`;
|
|
86
29
|
}
|
|
87
|
-
function
|
|
30
|
+
export function diffTitleLine(ctx, item, change) {
|
|
31
|
+
const changes = item.fileChanges ?? [];
|
|
32
|
+
const token = TOOL_STATUS_TOKEN[item.status];
|
|
33
|
+
const title = ctx.ink.style(verb(item, changes[0] ?? change), { fg: token, bold: true });
|
|
34
|
+
const path = changes.length > 1 ? `${changes.length} files` : relativeDisplayPath(change?.path ?? item.argsDisplay);
|
|
35
|
+
const label = ctx.ink.fg("inputBorder", sanitizeDisplayText(path));
|
|
36
|
+
const suffix = change ? ` ${diffStatsSuffix(ctx, change)}` : "";
|
|
37
|
+
const head = `${ctx.ink.fg(token, toolGlyph(ctx, item.status))} ${title} ${label}`;
|
|
38
|
+
const budget = Math.max(1, ctx.width - layoutWidth(suffix));
|
|
39
|
+
return clipRow(ctx, `${clipToWidth(head, budget, ctx.glyphs.ellipsis)}${suffix}`);
|
|
40
|
+
}
|
|
41
|
+
function carrier(changes) {
|
|
88
42
|
if (changes.length === 0)
|
|
89
43
|
return undefined;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
44
|
+
const added = changes.reduce((sum, change) => sum + change.stats.added, 0);
|
|
45
|
+
const removed = changes.reduce((sum, change) => sum + change.stats.removed, 0);
|
|
46
|
+
return { ...changes[0], stats: { ...changes[0].stats, added, removed } };
|
|
47
|
+
}
|
|
48
|
+
function sourceLines(change, expanded) {
|
|
49
|
+
if (expanded && change.afterText !== undefined && change.truncated) {
|
|
50
|
+
const allAdded = change.stats.added === change.stats.newLines;
|
|
51
|
+
return buildModalLines(change).map((line) => ({
|
|
52
|
+
op: allAdded && line.op === "context" ? "add" : line.op,
|
|
53
|
+
text: line.text, oldLine: line.oldLineNo, newLine: line.lineNo,
|
|
54
|
+
}));
|
|
97
55
|
}
|
|
98
|
-
return
|
|
99
|
-
}
|
|
100
|
-
function
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
56
|
+
return change.previewHunks.flatMap((hunk) => hunk.lines);
|
|
57
|
+
}
|
|
58
|
+
function codeText(ctx, spans) {
|
|
59
|
+
return spans.map((span) => ctx.ink.hex(syntaxColor(span.kind, ctx.ink.theme), span.text)).join("");
|
|
60
|
+
}
|
|
61
|
+
function diffRows(ctx, change, expanded) {
|
|
62
|
+
if (change.binary)
|
|
63
|
+
return [clipRow(ctx, " (binary file)")];
|
|
64
|
+
const source = sourceLines(change, expanded);
|
|
65
|
+
if (source.length === 0)
|
|
66
|
+
return [clipRow(ctx, " (no line changes)")];
|
|
67
|
+
const width = String(Math.max(change.stats.oldLines, change.stats.newLines, 1)).length;
|
|
68
|
+
const carry = emptyCarry();
|
|
69
|
+
const rows = [];
|
|
70
|
+
const shown = expanded ? source : source.slice(0, DIFF_PREVIEW_LINES);
|
|
71
|
+
for (const line of shown) {
|
|
72
|
+
const number = line.op === "del" ? line.oldLine : line.newLine ?? line.oldLine;
|
|
73
|
+
const gutter = number === undefined ? " ".repeat(width) : String(number).padStart(width, " ");
|
|
74
|
+
const marker = line.op === "add" ? "+" : line.op === "del" ? "-" : " ";
|
|
75
|
+
const token = line.op === "add" ? "diffAdd" : line.op === "del" ? "diffDel" : "diffGutter";
|
|
76
|
+
const text = expandTabs(sanitizeDisplayText(line.text), DIFF_TAB_WIDTH);
|
|
77
|
+
const spans = highlightLineForPath(text, change.path, carry);
|
|
78
|
+
const code = codeText(ctx, spans);
|
|
79
|
+
const codeWidth = Math.max(1, ctx.width - DIFF_INDENT - width - 3);
|
|
80
|
+
const chunks = expanded ? wrapAnsiLine(code, codeWidth) : [clipToWidth(code, codeWidth, ctx.glyphs.ellipsis)];
|
|
81
|
+
for (const [index, chunk] of chunks.entries()) {
|
|
82
|
+
const prefix = index === 0 ? `${gutter} ${marker} ` : " ".repeat(width + 3);
|
|
83
|
+
const body = `${" ".repeat(DIFF_INDENT)}${ctx.ink.fg(token, prefix)}${chunk}`;
|
|
84
|
+
const wash = line.op === "add" ? "diffAddBg" : line.op === "del" ? "diffDelBg" : undefined;
|
|
85
|
+
rows.push(trimTrailingSpaces(sealStyle(ctx.ink.washColor && wash ? ctx.ink.band(body, ctx.width, { bg: wash }) : body)));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return rows;
|
|
110
89
|
}
|
|
111
|
-
|
|
112
|
-
if (
|
|
90
|
+
function diffNotice(ctx, change) {
|
|
91
|
+
if (!change.truncated || change.binary)
|
|
113
92
|
return undefined;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return clipRow(ctx, ` ${ctx.ink.style(collapsedFileChangeLabel(change), { fg: "foreground", bold: true })}`);
|
|
123
|
-
}
|
|
124
|
-
function moreFilesRow(ctx, hidden) {
|
|
125
|
-
return clipRow(ctx, ` ${ctx.ink.fg("muted", `${ctx.glyphs.ellipsis} +${hidden} more file${hidden === 1 ? "" : "s"}`)}`);
|
|
93
|
+
if (change.afterText === undefined) {
|
|
94
|
+
return ctx.spool.fileChangeNotice?.(change) ?? "Full diff unavailable · retained preview shown";
|
|
95
|
+
}
|
|
96
|
+
const removed = change.deletedAt.reduce((count, segment) => count + segment.lines.length, 0);
|
|
97
|
+
const missingMarkers = change.stats.added > change.addedNewLines.length && change.stats.added !== change.stats.newLines;
|
|
98
|
+
if (removed < change.stats.removed || missingMarkers)
|
|
99
|
+
return "Some diff details were not retained · full file shown";
|
|
100
|
+
return undefined;
|
|
126
101
|
}
|
|
127
102
|
export function buildDiffLines(ctx, item) {
|
|
128
|
-
const changes = item.fileChanges ?? [];
|
|
129
|
-
const
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const hiddenFiles = changes.length - listed.length;
|
|
142
|
-
if (!diffExpanded) {
|
|
143
|
-
if (primary && !multi)
|
|
144
|
-
lines.push(labelRow(ctx, primary));
|
|
145
|
-
if (multi) {
|
|
146
|
-
for (const change of listed)
|
|
147
|
-
lines.push(fileRow(ctx, change));
|
|
148
|
-
if (hiddenFiles > 0)
|
|
149
|
-
lines.push(moreFilesRow(ctx, hiddenFiles));
|
|
103
|
+
const changes = (item.fileChanges ?? []).map((change) => ctx.spool.fileChange?.(change) ?? change);
|
|
104
|
+
const expanded = isItemExpanded(ctx.state, item);
|
|
105
|
+
const showDiff = isFileDiffExpanded(ctx.state, item.id);
|
|
106
|
+
const lines = [diffTitleLine(ctx, item, carrier(changes))];
|
|
107
|
+
if (changes.length === 0)
|
|
108
|
+
return [...lines, ...buildToolBodyLines({ ...ctx, lineOffset: lines.length }, item)];
|
|
109
|
+
const listed = expanded ? changes : changes.slice(0, WRITE_MANY_LISTED_FILES);
|
|
110
|
+
for (const [index, change] of listed.entries()) {
|
|
111
|
+
if (changes.length > 1) {
|
|
112
|
+
if (index > 0)
|
|
113
|
+
lines.push("");
|
|
114
|
+
const path = ctx.ink.fg("inputBorder", sanitizeDisplayText(relativeDisplayPath(change.path)));
|
|
115
|
+
lines.push(clipRow(ctx, ` ${ctx.glyphs.bodyBranch} ${path} ${diffStatsSuffix(ctx, change)}`));
|
|
150
116
|
}
|
|
151
|
-
|
|
152
|
-
|
|
117
|
+
if (showDiff || expanded)
|
|
118
|
+
lines.push(...diffRows(ctx, change, expanded));
|
|
119
|
+
const notice = expanded ? diffNotice(ctx, change) : undefined;
|
|
120
|
+
if (notice)
|
|
121
|
+
lines.push(...hintRows(ctx, " ", notice));
|
|
153
122
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const rows = presentFileChangePreview(change, {
|
|
159
|
-
maxLineChars: codeBudget(ctx, change),
|
|
160
|
-
maxRows,
|
|
161
|
-
tabWidth: DIFF_TAB_WIDTH,
|
|
162
|
-
});
|
|
163
|
-
for (const row of rows)
|
|
164
|
-
lines.push(diffRowLine(ctx, row));
|
|
123
|
+
if (changes.length > listed.length)
|
|
124
|
+
lines.push(clipRow(ctx, ` ${ctx.ink.fg("hint", `${changes.length - listed.length} more files`)}`));
|
|
125
|
+
if (item.status === "failed" || item.status === "blocked") {
|
|
126
|
+
return [...lines, ...buildToolBodyLines({ ...ctx, lineOffset: lines.length }, item)];
|
|
165
127
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
lines.push(...hintRows(ctx, " ", outputToggleLabel(outputExpanded)));
|
|
128
|
+
const hidden = changes.reduce((sum, change) => sum + Math.max(0, sourceLines(change, false).length - DIFF_PREVIEW_LINES), 0);
|
|
129
|
+
appendDisclosure(ctx, lines, expanded, { hidden });
|
|
169
130
|
return lines;
|
|
170
131
|
}
|
|
171
132
|
//# sourceMappingURL=diff-lines.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-lines.js","sourceRoot":"","sources":["../../../src/classic/blocks/diff-lines.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"diff-lines.js","sourceRoot":"","sources":["../../../src/classic/blocks/diff-lines.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAmB,MAAM,6CAA6C,CAAC;AAChH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAiB,MAAM,yCAAyC,CAAC;AAC5G,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAqB,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE7F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AACpC,MAAM,CAAC,MAAM,uBAAuB,GAAG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,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1I,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1D,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,kBAAkB,CAAC,EAAE,GAAG,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;IACvF,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7H,gBAAgB,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACnD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BlockContext } from "./block-context.js";
|
|
2
|
+
export interface BlockDisclosure {
|
|
3
|
+
readonly lineIndex: number;
|
|
4
|
+
readonly column: number;
|
|
5
|
+
readonly width: number;
|
|
6
|
+
readonly action?: "output";
|
|
7
|
+
}
|
|
8
|
+
export declare function outputToggleLabel(expanded: boolean): string;
|
|
9
|
+
export declare function appendDisclosure(ctx: BlockContext, lines: string[], expanded: boolean, options?: {
|
|
10
|
+
hidden?: number;
|
|
11
|
+
chord?: string;
|
|
12
|
+
indent?: number;
|
|
13
|
+
label?: string;
|
|
14
|
+
action?: "output";
|
|
15
|
+
inline?: boolean;
|
|
16
|
+
}): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { clipToWidth } from "../render/ansi-text.js";
|
|
2
|
+
import { layoutWidth } from "../render/measure.js";
|
|
3
|
+
export function outputToggleLabel(expanded) {
|
|
4
|
+
return expanded ? "- click to collapse" : "+ click to expand";
|
|
5
|
+
}
|
|
6
|
+
export function appendDisclosure(ctx, lines, expanded, options = {}) {
|
|
7
|
+
const text = options.label ?? outputToggleLabel(expanded);
|
|
8
|
+
const hidden = !expanded && options.hidden ? ` (${options.hidden} lines)` : "";
|
|
9
|
+
const hint = `${hidden} ${ctx.glyphs.separator} ${options.chord ?? "Ctrl+O"}`;
|
|
10
|
+
const head = options.inline ? lines.pop() ?? "" : "";
|
|
11
|
+
const headBudget = Math.max(1, ctx.width - layoutWidth(text + hint) - 3);
|
|
12
|
+
const prefix = options.inline ? `${clipToWidth(head, headBudget, ctx.glyphs.ellipsis)} ${ctx.glyphs.separator} ` : "";
|
|
13
|
+
const column = options.inline ? layoutWidth(prefix) : Math.min(options.indent ?? 4, Math.max(0, ctx.width - 11));
|
|
14
|
+
const label = clipToWidth(text, Math.max(0, ctx.width - column), ctx.glyphs.ellipsis);
|
|
15
|
+
const suffix = clipToWidth(hint, Math.max(0, ctx.width - column - layoutWidth(label)), "");
|
|
16
|
+
const lineIndex = (ctx.lineOffset ?? 0) + lines.length;
|
|
17
|
+
lines.push(`${prefix || " ".repeat(column)}${ctx.ink.fg("hint", label)}${ctx.ink.fg("hint", suffix)}`.trimEnd());
|
|
18
|
+
ctx.disclosures?.push({ lineIndex, column, width: layoutWidth(label), ...(options.action ? { action: options.action } : {}) });
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=disclosure-lines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disclosure-lines.js","sourceRoot":"","sources":["../../../src/classic/blocks/disclosure-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAUnD,MAAM,UAAU,iBAAiB,CAAC,QAAiB;IACjD,OAAO,QAAQ,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAA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AAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACtF,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,GAAG,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC3F,MAAM,SAAS,GAAG,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IACvD,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IACjH,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACjI,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { renderIntroHeaderLines } from "../../ui-core/rendering/intro-header.js";
|
|
2
|
+
import { CARD_BORDER_HEX } from "../../ui-core/rendering/card-style.js";
|
|
2
3
|
import { clipToWidth } from "../render/ansi-text.js";
|
|
3
4
|
import { stripAnsi } from "../render/measure.js";
|
|
4
5
|
export function buildIntroLines(ctx, input) {
|
|
@@ -11,6 +12,7 @@ export function buildIntroLines(ctx, input) {
|
|
|
11
12
|
permissions: input.permissions,
|
|
12
13
|
workdir: input.workdir,
|
|
13
14
|
variant: input.variant,
|
|
15
|
+
paintBorder: (text) => ctx.ink.hex(CARD_BORDER_HEX, text),
|
|
14
16
|
});
|
|
15
17
|
const plain = ctx.ink.colorMode === "none";
|
|
16
18
|
return rendered.map((line) => clipToWidth(plain ? stripAnsi(line) : line, ctx.width, ""));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intro-lines.js","sourceRoot":"","sources":["../../../src/classic/blocks/intro-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAajD,MAAM,UAAU,eAAe,CAAC,GAAiB,EAAE,KAAsB;IACvE,MAAM,QAAQ,GAAG,sBAAsB,CAAC;QACtC,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,OAAO,EAAE,KAAK,CAAC,OAAO;
|
|
1
|
+
{"version":3,"file":"intro-lines.js","sourceRoot":"","sources":["../../../src/classic/blocks/intro-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAajD,MAAM,UAAU,eAAe,CAAC,GAAiB,EAAE,KAAsB;IACvE,MAAM,QAAQ,GAAG,sBAAsB,CAAC;QACtC,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC;KAC1D,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC;IAC3C,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAC3B,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAC3D,CAAC;AACJ,CAAC"}
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
import { sanitizeDisplayText } from "../../ui-core/rendering/sanitize-display.js";
|
|
2
2
|
import { wrapWithPrefixes } from "../render/wrap.js";
|
|
3
3
|
import { clipRow } from "./block-context.js";
|
|
4
|
-
const PLATE_LABEL = {
|
|
5
|
-
warn: " WARN ",
|
|
6
|
-
error: " ERR ",
|
|
7
|
-
info: " INFO ",
|
|
8
|
-
};
|
|
9
|
-
const PLATE_TOKEN = {
|
|
10
|
-
warn: "activityBg",
|
|
11
|
-
error: "failedBg",
|
|
12
|
-
info: "chip",
|
|
13
|
-
};
|
|
14
|
-
const BODY_COLUMN = 7;
|
|
15
4
|
export function buildNoticeLines(ctx, item) {
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return rows.map((row, index) => clipRow(ctx, index === 0 ? `${plate} ${row}` : `${indent}${row}`));
|
|
5
|
+
const token = item.level === "error" ? "diffDel" : item.level === "warn" ? "activity" : "muted";
|
|
6
|
+
const mark = item.level === "warn" ? ctx.glyphs.warning : ctx.ink.unicode ? "•" : "*";
|
|
7
|
+
return wrapWithPrefixes(sanitizeDisplayText(item.text), { width: ctx.width, firstPrefix: `${mark} `, nextPrefix: " " })
|
|
8
|
+
.map((row) => clipRow(ctx, ctx.ink.fg(token, row)));
|
|
21
9
|
}
|
|
22
10
|
//# sourceMappingURL=notice-lines.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notice-lines.js","sourceRoot":"","sources":["../../../src/classic/blocks/notice-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"notice-lines.js","sourceRoot":"","sources":["../../../src/classic/blocks/notice-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAqB,MAAM,oBAAoB,CAAC;AAEhE,MAAM,UAAU,gBAAgB,CAAC,GAAiB,EAAE,IAAgB;IAClE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;IAChG,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACtF,OAAO,gBAAgB,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;SACrH,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ThemeToken } from "../render/ink-theme.js";
|
|
2
|
+
import type { BlockContext } from "./block-context.js";
|
|
3
|
+
export declare const OUTPUT_PREVIEW_LINES = 3;
|
|
4
|
+
export declare const PREVIEW_LINE_CHARS: number;
|
|
5
|
+
export declare function logicalOutputLines(raw: string, name?: string): string[];
|
|
6
|
+
export declare function outputBodyRows(ctx: BlockContext, source: readonly string[], expanded: boolean, options?: {
|
|
7
|
+
token?: ThemeToken;
|
|
8
|
+
maxLines?: number;
|
|
9
|
+
branch?: boolean;
|
|
10
|
+
}): string[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { sanitizeDisplayText } from "../../ui-core/rendering/sanitize-display.js";
|
|
2
|
+
import { terminalOutputLines } from "../../ui-core/rendering/terminal-output.js";
|
|
3
|
+
import { clipToWidth, expandTabs, trimTrailingSpaces } from "../render/ansi-text.js";
|
|
4
|
+
import { layoutWidth } from "../render/measure.js";
|
|
5
|
+
import { wrapAnsiLine } from "../render/wrap.js";
|
|
6
|
+
export const OUTPUT_PREVIEW_LINES = 3;
|
|
7
|
+
export const PREVIEW_LINE_CHARS = 16 * 1024;
|
|
8
|
+
export function logicalOutputLines(raw, name = "") {
|
|
9
|
+
const terminal = terminalOutputLines(raw, name);
|
|
10
|
+
const safe = terminal ? [...terminal] : sanitizeDisplayText(raw).replace(/\^\[\[[0-9;?]*[ -/]*[@-~]/g, "").split("\n");
|
|
11
|
+
while (safe.length > 0 && safe.at(-1) === "")
|
|
12
|
+
safe.pop();
|
|
13
|
+
return safe;
|
|
14
|
+
}
|
|
15
|
+
export function outputBodyRows(ctx, source, expanded, options = {}) {
|
|
16
|
+
const token = options.token ?? "toolOutput";
|
|
17
|
+
const shown = expanded ? source : source.slice(0, options.maxLines ?? OUTPUT_PREVIEW_LINES);
|
|
18
|
+
const budget = Math.max(1, ctx.width - 4);
|
|
19
|
+
const rows = [];
|
|
20
|
+
for (const [index, raw] of shown.entries()) {
|
|
21
|
+
const bounded = expanded ? raw : raw.slice(0, PREVIEW_LINE_CHARS);
|
|
22
|
+
const text = expandTabs(bounded);
|
|
23
|
+
const chunks = expanded ? wrapAnsiLine(text, budget) : [clipToWidth(text, budget, ctx.glyphs.ellipsis)];
|
|
24
|
+
if (!expanded && raw.length > bounded.length && layoutWidth(chunks[0]) < budget) {
|
|
25
|
+
chunks[0] = clipToWidth(`${chunks[0]}${ctx.glyphs.ellipsis}`, budget, ctx.glyphs.ellipsis);
|
|
26
|
+
}
|
|
27
|
+
for (const [row, chunk] of chunks.entries()) {
|
|
28
|
+
const first = options.branch !== false && index === 0 && row === 0;
|
|
29
|
+
const prefix = first ? ctx.ink.fg(token, ` ${ctx.glyphs.bodyBranch} `) : " ";
|
|
30
|
+
rows.push(trimTrailingSpaces(`${prefix}${ctx.ink.fg(token, chunk)}`));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return rows;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=output-lines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-lines.js","sourceRoot":"","sources":["../../../src/classic/blocks/output-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,UA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AAC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { type ThinkingItem } from "../../ui-core/state/transcript-types.js";
|
|
2
2
|
import { type BlockContext } from "./block-context.js";
|
|
3
|
-
export declare function thinkingTokenEstimate(content: string): number;
|
|
4
3
|
export declare function buildThinkingLines(ctx: BlockContext, item: ThinkingItem): string[];
|
|
@@ -1,42 +1,25 @@
|
|
|
1
1
|
import { sanitizeDisplayText } from "../../ui-core/rendering/sanitize-display.js";
|
|
2
2
|
import { thinkingElapsedLabel } from "../../ui-core/rendering/duration.js";
|
|
3
|
-
import { liveThinkingDisplay } from "../../ui-core/rendering/thinking-tail.js";
|
|
4
3
|
import { isItemExpanded } from "../../ui-core/state/transcript-types.js";
|
|
5
|
-
import { wrapWithPrefixes } from "../render/wrap.js";
|
|
6
4
|
import { clipRow, joinMeta } from "./block-context.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
5
|
+
import { appendDisclosure } from "./disclosure-lines.js";
|
|
6
|
+
import { logicalOutputLines, outputBodyRows } from "./output-lines.js";
|
|
10
7
|
export function buildThinkingLines(ctx, item) {
|
|
11
|
-
const gutter = ctx.ink.style(`${ctx.glyphs.thinkingGutter} `, {
|
|
12
|
-
fg: "thinking",
|
|
13
|
-
});
|
|
14
|
-
const expanded = isItemExpanded(ctx.state, item);
|
|
15
8
|
const content = sanitizeDisplayText(item.content);
|
|
9
|
+
if (!content.trim() && !item.streaming)
|
|
10
|
+
return [];
|
|
11
|
+
const expanded = isItemExpanded(ctx.state, item);
|
|
16
12
|
const elapsed = thinkingElapsedLabel(item, ctx.now);
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
? "Ctrl+T to hide"
|
|
27
|
-
: "Ctrl+T to expand",
|
|
28
|
-
]), { width: Math.max(1, ctx.width - 2) }).map((row) => clipRow(ctx, `${gutter}${ctx.ink.style(row, { fg: "thinking" })}`));
|
|
29
|
-
const bodyRows = (text) => wrapWithPrefixes(text, { width: ctx.width - 2 }).map((row) => clipRow(ctx, `${gutter}${ctx.ink.style(row, { fg: "thinking", italic: true })}`));
|
|
30
|
-
if (item.streaming) {
|
|
31
|
-
const tail = liveThinkingDisplay(content);
|
|
32
|
-
if (!tail.trim())
|
|
33
|
-
return header();
|
|
34
|
-
return [...header(), ...bodyRows(tail)];
|
|
13
|
+
const mark = ctx.ink.unicode ? "•" : "*";
|
|
14
|
+
const title = ctx.ink.style(`${mark} ${item.streaming ? "Thinking" : "Reasoning"}`, { fg: "thinking", bold: true });
|
|
15
|
+
const head = joinMeta(ctx, [title, elapsed ? ctx.ink.fg("userBorder", elapsed) : undefined]);
|
|
16
|
+
const lines = [clipRow(ctx, head)];
|
|
17
|
+
if (!item.streaming)
|
|
18
|
+
appendDisclosure(ctx, lines, expanded, { chord: "Ctrl+T", inline: true });
|
|
19
|
+
if (expanded || item.streaming) {
|
|
20
|
+
const body = outputBodyRows(ctx, logicalOutputLines(content), true, { token: "thinking", branch: false });
|
|
21
|
+
lines.push(...body);
|
|
35
22
|
}
|
|
36
|
-
|
|
37
|
-
return [];
|
|
38
|
-
if (!expanded)
|
|
39
|
-
return header();
|
|
40
|
-
return [...header(), ...bodyRows(content)];
|
|
23
|
+
return lines;
|
|
41
24
|
}
|
|
42
25
|
//# sourceMappingURL=thinking-lines.js.map
|