@sixb/app 0.2.3 → 0.2.5
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/assets/connector-icons/README.md +1 -0
- package/assets/connector-icons/ctm.png +0 -0
- package/dist/agent/activity-label.d.ts.map +1 -1
- package/dist/agent/agent-chat.d.ts +3 -1
- package/dist/agent/agent-chat.d.ts.map +1 -1
- package/dist/agent/agent-panel.d.ts.map +1 -1
- package/dist/agent/artifact-panel.d.ts +3 -1
- package/dist/agent/artifact-panel.d.ts.map +1 -1
- package/dist/agent/background/background-tool-row.d.ts.map +1 -1
- package/dist/agent/background/interpret.d.ts +1 -1
- package/dist/agent/background/interpret.d.ts.map +1 -1
- package/dist/agent/components/composer-settings.d.ts +1 -1
- package/dist/agent/components/composer-settings.d.ts.map +1 -1
- package/dist/agent/components/composer.d.ts +22 -5
- package/dist/agent/components/composer.d.ts.map +1 -1
- package/dist/agent/components/context-meter.d.ts +1 -1
- package/dist/agent/components/context-meter.d.ts.map +1 -1
- package/dist/agent/components/conversation-panel.d.ts +8 -2
- package/dist/agent/components/conversation-panel.d.ts.map +1 -1
- package/dist/agent/components/message-parts.d.ts +2 -1
- package/dist/agent/components/message-parts.d.ts.map +1 -1
- package/dist/agent/components/message-view.d.ts.map +1 -1
- package/dist/agent/components/pending-messages.d.ts +20 -0
- package/dist/agent/components/pending-messages.d.ts.map +1 -0
- package/dist/agent/components/sandbox-recovery.d.ts +11 -2
- package/dist/agent/components/sandbox-recovery.d.ts.map +1 -1
- package/dist/agent/components/threads-button.d.ts +1 -1
- package/dist/agent/components/threads-button.d.ts.map +1 -1
- package/dist/agent/components/transcript.d.ts +5 -0
- package/dist/agent/components/transcript.d.ts.map +1 -1
- package/dist/agent/conversation.d.ts +3 -6
- package/dist/agent/conversation.d.ts.map +1 -1
- package/dist/agent/delegation/agent-exchange.d.ts +16 -0
- package/dist/agent/delegation/agent-exchange.d.ts.map +1 -0
- package/dist/agent/delegation/child-card.d.ts +3 -3
- package/dist/agent/delegation/child-card.d.ts.map +1 -1
- package/dist/agent/delegation/child-parts.d.ts +1 -10
- package/dist/agent/delegation/child-parts.d.ts.map +1 -1
- package/dist/agent/delegation/child-work.d.ts.map +1 -1
- package/dist/agent/delegation/interpret.d.ts +9 -10
- package/dist/agent/delegation/interpret.d.ts.map +1 -1
- package/dist/agent/delegation/use-children.d.ts.map +1 -1
- package/dist/agent/file-edits/file-edit-tool-view.d.ts +10 -0
- package/dist/agent/file-edits/file-edit-tool-view.d.ts.map +1 -0
- package/dist/agent/file-edits/interpret.d.ts +25 -0
- package/dist/agent/file-edits/interpret.d.ts.map +1 -0
- package/dist/agent/hooks/use-agent-conversation.d.ts +16 -4
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-stream.d.ts.map +1 -1
- package/dist/agent/i18n/en.d.ts +114 -5
- package/dist/agent/i18n/en.d.ts.map +1 -1
- package/dist/agent/i18n/fr.d.ts.map +1 -1
- package/dist/agent/i18n/index.d.ts +190 -8
- package/dist/agent/i18n/index.d.ts.map +1 -1
- package/dist/agent/inbox-handoff.d.ts +10 -0
- package/dist/agent/inbox-handoff.d.ts.map +1 -0
- package/dist/agent/live-run.d.ts +8 -1
- package/dist/agent/live-run.d.ts.map +1 -1
- package/dist/agent/message-agent/interpret.d.ts +2 -2
- package/dist/agent/message-agent/interpret.d.ts.map +1 -1
- package/dist/agent/publish-artifact/interpret.d.ts +1 -1
- package/dist/agent/publish-artifact/interpret.d.ts.map +1 -1
- package/dist/agent/questions/interpret.d.ts +31 -0
- package/dist/agent/questions/interpret.d.ts.map +1 -0
- package/dist/agent/questions/question-card.d.ts +16 -0
- package/dist/agent/questions/question-card.d.ts.map +1 -0
- package/dist/agent/questions/question-composer.d.ts +15 -0
- package/dist/agent/questions/question-composer.d.ts.map +1 -0
- package/dist/agent/read/interpret.d.ts +8 -1
- package/dist/agent/read/interpret.d.ts.map +1 -1
- package/dist/agent/read/read-tool-view.d.ts.map +1 -1
- package/dist/agent/search/interpret.d.ts +101 -0
- package/dist/agent/search/interpret.d.ts.map +1 -0
- package/dist/agent/search/search-tool-view.d.ts +10 -0
- package/dist/agent/search/search-tool-view.d.ts.map +1 -0
- package/dist/agent/thread-state.d.ts +26 -0
- package/dist/agent/thread-state.d.ts.map +1 -0
- package/dist/agent/tool-views/built-in.d.ts.map +1 -1
- package/dist/agent/tool-views/registry.d.ts +5 -6
- package/dist/agent/tool-views/registry.d.ts.map +1 -1
- package/dist/agent/types.d.ts +5 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/view-file/view-file-tool-view.d.ts +2 -1
- package/dist/agent/view-file/view-file-tool-view.d.ts.map +1 -1
- package/dist/agent/waits.d.ts +14 -0
- package/dist/agent/waits.d.ts.map +1 -0
- package/dist/artifacts/card-preview.d.ts.map +1 -1
- package/dist/artifacts/edit-session.d.ts +11 -1
- package/dist/artifacts/edit-session.d.ts.map +1 -1
- package/dist/artifacts/editor/block-handle.d.ts +20 -0
- package/dist/artifacts/editor/block-handle.d.ts.map +1 -0
- package/dist/artifacts/editor/blocks.d.ts +34 -0
- package/dist/artifacts/editor/blocks.d.ts.map +1 -0
- package/dist/artifacts/editor/callout-view.d.ts +7 -0
- package/dist/artifacts/editor/callout-view.d.ts.map +1 -0
- package/dist/artifacts/editor/document-editor.d.ts +30 -0
- package/dist/artifacts/editor/document-editor.d.ts.map +1 -0
- package/dist/artifacts/editor/figure-view.d.ts +12 -0
- package/dist/artifacts/editor/figure-view.d.ts.map +1 -0
- package/dist/artifacts/editor/find-blocks.d.ts +6 -0
- package/dist/artifacts/editor/find-blocks.d.ts.map +1 -0
- package/dist/artifacts/editor/markdown-document.d.ts +12 -0
- package/dist/artifacts/editor/markdown-document.d.ts.map +1 -0
- package/dist/artifacts/editor/messages.d.ts +4 -0
- package/dist/artifacts/editor/messages.d.ts.map +1 -0
- package/dist/artifacts/editor/schema.d.ts +21 -0
- package/dist/artifacts/editor/schema.d.ts.map +1 -0
- package/dist/artifacts/editor/selection-toolbar.d.ts +35 -0
- package/dist/artifacts/editor/selection-toolbar.d.ts.map +1 -0
- package/dist/artifacts/editor/slash-menu.d.ts +43 -0
- package/dist/artifacts/editor/slash-menu.d.ts.map +1 -0
- package/dist/artifacts/editor/upload.d.ts +12 -0
- package/dist/artifacts/editor/upload.d.ts.map +1 -0
- package/dist/artifacts/file-source.d.ts +5 -0
- package/dist/artifacts/file-source.d.ts.map +1 -1
- package/dist/artifacts/frame-editor/bundle.d.ts +7 -0
- package/dist/artifacts/frame-editor/bundle.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/commands.d.ts +93 -0
- package/dist/artifacts/frame-editor/commands.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/entry.d.ts +2 -0
- package/dist/artifacts/frame-editor/entry.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/frame.d.ts +5 -0
- package/dist/artifacts/frame-editor/frame.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/keys.d.ts +8 -0
- package/dist/artifacts/frame-editor/keys.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/protocol.d.ts +186 -0
- package/dist/artifacts/frame-editor/protocol.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/schema.d.ts +34 -0
- package/dist/artifacts/frame-editor/schema.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/style.d.ts +2 -0
- package/dist/artifacts/frame-editor/style.d.ts.map +1 -0
- package/dist/artifacts/frame.d.ts +2 -2
- package/dist/artifacts/frame.d.ts.map +1 -1
- package/dist/artifacts/live/boards.d.ts +2 -0
- package/dist/artifacts/live/boards.d.ts.map +1 -1
- package/dist/artifacts/live/document.d.ts +32 -0
- package/dist/artifacts/live/document.d.ts.map +1 -0
- package/dist/artifacts/live/header.d.ts +4 -4
- package/dist/artifacts/live/header.d.ts.map +1 -1
- package/dist/artifacts/live/presence.d.ts.map +1 -1
- package/dist/artifacts/live/session.d.ts +2 -0
- package/dist/artifacts/live/session.d.ts.map +1 -1
- package/dist/artifacts/live/view.d.ts +4 -3
- package/dist/artifacts/live/view.d.ts.map +1 -1
- package/dist/artifacts/messages.d.ts +278 -2
- package/dist/artifacts/messages.d.ts.map +1 -1
- package/dist/artifacts/pdf.d.ts +8 -0
- package/dist/artifacts/pdf.d.ts.map +1 -0
- package/dist/artifacts/queries.d.ts +80 -0
- package/dist/artifacts/queries.d.ts.map +1 -1
- package/dist/artifacts/references/references.d.ts +3 -3
- package/dist/artifacts/references/references.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/board-editor.d.ts +11 -4
- package/dist/artifacts/renderers/canvas/board-editor.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/board.d.ts +14 -2
- package/dist/artifacts/renderers/canvas/board.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/canvas.d.ts +4 -3
- package/dist/artifacts/renderers/canvas/canvas.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comment-pins.d.ts +4 -2
- package/dist/artifacts/renderers/canvas/comment-pins.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comments-panel.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comments.d.ts +2 -1
- package/dist/artifacts/renderers/canvas/comments.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/controls.d.ts +15 -4
- package/dist/artifacts/renderers/canvas/controls.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/focus.d.ts +19 -5
- package/dist/artifacts/renderers/canvas/focus.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/gestures.d.ts +46 -0
- package/dist/artifacts/renderers/canvas/gestures.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/page-resize.d.ts +21 -0
- package/dist/artifacts/renderers/canvas/page-resize.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/page-size-controls.d.ts +21 -0
- package/dist/artifacts/renderers/canvas/page-size-controls.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/page-size.d.ts +93 -0
- package/dist/artifacts/renderers/canvas/page-size.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/page-zoom.d.ts +64 -0
- package/dist/artifacts/renderers/canvas/page-zoom.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/shown-size.d.ts +26 -0
- package/dist/artifacts/renderers/canvas/shown-size.d.ts.map +1 -0
- package/dist/artifacts/renderers/designed-document.d.ts +28 -0
- package/dist/artifacts/renderers/designed-document.d.ts.map +1 -0
- package/dist/artifacts/renderers/document-tree.d.ts +2 -0
- package/dist/artifacts/renderers/document-tree.d.ts.map +1 -1
- package/dist/artifacts/renderers/document.d.ts +9 -1
- package/dist/artifacts/renderers/document.d.ts.map +1 -1
- package/dist/artifacts/renderers/live-frame.d.ts +145 -0
- package/dist/artifacts/renderers/live-frame.d.ts.map +1 -0
- package/dist/artifacts/renderers/page-editor.d.ts +16 -0
- package/dist/artifacts/renderers/page-editor.d.ts.map +1 -0
- package/dist/artifacts/renderers/page.d.ts +10 -1
- package/dist/artifacts/renderers/page.d.ts.map +1 -1
- package/dist/artifacts/viewer.d.ts.map +1 -1
- package/dist/{chunk-001c4gnk.js → chunk-4fex83k2.js} +19965 -13027
- package/dist/chunk-4fex83k2.js.map +239 -0
- package/dist/{chunk-5crvhjp2.js → chunk-4wm09prf.js} +1633 -1999
- package/dist/chunk-4wm09prf.js.map +27 -0
- package/dist/{chunk-fwb9mxwm.js → chunk-5sgac68y.js} +1 -1
- package/dist/{chunk-kes4ygmz.js → chunk-69qgh20f.js} +1 -1
- package/dist/chunk-y51c4tsz.js +11 -0
- package/dist/chunk-y51c4tsz.js.map +10 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +5 -5
- package/dist/pages/console/data/messages.d.ts +6 -0
- package/dist/pages/console/data/messages.d.ts.map +1 -1
- package/dist/pages/console/data/shared.d.ts.map +1 -1
- package/dist/pages.js +12 -5
- package/dist/pages.js.map +6 -6
- package/dist/shell/search-command.d.ts.map +1 -1
- package/package.json +22 -5
- package/src/agent/activity-label.ts +9 -1
- package/src/agent/agent-chat.tsx +57 -37
- package/src/agent/agent-execution-trace.tsx +2 -2
- package/src/agent/agent-panel.tsx +6 -4
- package/src/agent/agent.css +254 -0
- package/src/agent/artifact-panel.tsx +77 -22
- package/src/agent/background/background-tool-row.tsx +24 -10
- package/src/agent/background/interpret.ts +60 -51
- package/src/agent/components/composer-settings.tsx +20 -10
- package/src/agent/components/composer.tsx +342 -104
- package/src/agent/components/context-meter.tsx +7 -3
- package/src/agent/components/conversation-panel.tsx +96 -37
- package/src/agent/components/message-parts.tsx +390 -64
- package/src/agent/components/message-view.tsx +12 -2
- package/src/agent/components/pending-messages.tsx +338 -0
- package/src/agent/components/sandbox-recovery.tsx +36 -17
- package/src/agent/components/threads-button.tsx +3 -2
- package/src/agent/components/transcript.tsx +92 -45
- package/src/agent/conversation.ts +203 -54
- package/src/agent/delegation/agent-exchange.tsx +53 -0
- package/src/agent/delegation/child-card.tsx +6 -40
- package/src/agent/delegation/child-parts.tsx +1 -84
- package/src/agent/delegation/child-work.tsx +19 -5
- package/src/agent/delegation/interpret.ts +64 -61
- package/src/agent/delegation/model.ts +1 -1
- package/src/agent/file-edits/file-edit-tool-view.tsx +126 -0
- package/src/agent/file-edits/interpret.ts +120 -0
- package/src/agent/hooks/use-agent-conversation.ts +360 -92
- package/src/agent/hooks/use-thread-stream.ts +10 -0
- package/src/agent/i18n/en.ts +134 -16
- package/src/agent/i18n/fr.ts +122 -16
- package/src/agent/inbox-handoff.ts +47 -0
- package/src/agent/live-run.ts +23 -2
- package/src/agent/message-agent/interpret.ts +4 -3
- package/src/agent/publish-artifact/interpret.ts +14 -5
- package/src/agent/publish-artifact/publish-artifact-tool-view.tsx +2 -2
- package/src/agent/questions/interpret.ts +90 -0
- package/src/agent/questions/question-card.tsx +57 -0
- package/src/agent/questions/question-composer.tsx +257 -0
- package/src/agent/react-router.tsx +2 -2
- package/src/agent/read/interpret.ts +34 -1
- package/src/agent/read/read-tool-view.tsx +20 -4
- package/src/agent/search/interpret.ts +367 -0
- package/src/agent/search/search-tool-view.tsx +235 -0
- package/src/agent/thread-state.ts +114 -0
- package/src/agent/tool-views/built-in.tsx +33 -6
- package/src/agent/tool-views/registry.tsx +28 -2
- package/src/agent/types.ts +7 -0
- package/src/agent/view-file/view-file-tool-view.tsx +33 -19
- package/src/agent/waits.ts +50 -0
- package/src/artifacts/artifacts.css +434 -0
- package/src/artifacts/card-preview.tsx +6 -1
- package/src/artifacts/edit-session.tsx +15 -1
- package/src/artifacts/editor/block-handle.tsx +278 -0
- package/src/artifacts/editor/blocks.ts +216 -0
- package/src/artifacts/editor/callout-view.tsx +31 -0
- package/src/artifacts/editor/document-editor.tsx +484 -0
- package/src/artifacts/editor/figure-view.tsx +66 -0
- package/src/artifacts/editor/find-blocks.ts +19 -0
- package/src/artifacts/editor/markdown-document.tsx +72 -0
- package/src/artifacts/editor/messages.ts +4 -0
- package/src/artifacts/editor/schema.ts +159 -0
- package/src/artifacts/editor/selection-toolbar.tsx +364 -0
- package/src/artifacts/editor/slash-menu.tsx +251 -0
- package/src/artifacts/editor/upload.ts +40 -0
- package/src/artifacts/file-source.ts +11 -0
- package/src/artifacts/frame-editor/bundle.ts +8 -0
- package/src/artifacts/frame-editor/commands.ts +565 -0
- package/src/artifacts/frame-editor/entry.ts +6 -0
- package/src/artifacts/frame-editor/frame.ts +847 -0
- package/src/artifacts/frame-editor/generated/editor.txt +149 -0
- package/src/artifacts/frame-editor/generated.d.ts +5 -0
- package/src/artifacts/frame-editor/keys.ts +323 -0
- package/src/artifacts/frame-editor/protocol.ts +151 -0
- package/src/artifacts/frame-editor/schema.ts +293 -0
- package/src/artifacts/frame-editor/style.ts +58 -0
- package/src/artifacts/frame.tsx +14 -5
- package/src/artifacts/live/boards.ts +46 -3
- package/src/artifacts/live/document.ts +89 -0
- package/src/artifacts/live/header.tsx +9 -14
- package/src/artifacts/live/presence.ts +5 -1
- package/src/artifacts/live/session.ts +4 -2
- package/src/artifacts/live/view.ts +14 -8
- package/src/artifacts/messages.ts +192 -2
- package/src/artifacts/pdf.ts +50 -0
- package/src/artifacts/references/references.tsx +46 -11
- package/src/artifacts/renderers/canvas/board-editor.tsx +44 -155
- package/src/artifacts/renderers/canvas/board.tsx +70 -8
- package/src/artifacts/renderers/canvas/canvas.tsx +66 -15
- package/src/artifacts/renderers/canvas/comment-pins.tsx +5 -0
- package/src/artifacts/renderers/canvas/comments-panel.tsx +58 -1
- package/src/artifacts/renderers/canvas/comments.ts +8 -4
- package/src/artifacts/renderers/canvas/controls.tsx +64 -30
- package/src/artifacts/renderers/canvas/focus.tsx +200 -56
- package/src/artifacts/renderers/canvas/gestures.ts +265 -0
- package/src/artifacts/renderers/canvas/page-resize.tsx +542 -0
- package/src/artifacts/renderers/canvas/page-size-controls.tsx +193 -0
- package/src/artifacts/renderers/canvas/page-size.ts +218 -0
- package/src/artifacts/renderers/canvas/page-zoom.ts +280 -0
- package/src/artifacts/renderers/canvas/shown-size.ts +105 -0
- package/src/artifacts/renderers/designed-document.tsx +277 -0
- package/src/artifacts/renderers/document-tree.ts +9 -0
- package/src/artifacts/renderers/document.tsx +13 -102
- package/src/artifacts/renderers/live-frame.ts +163 -0
- package/src/artifacts/renderers/page-editor.tsx +613 -0
- package/src/artifacts/renderers/page.tsx +21 -4
- package/src/artifacts/viewer.tsx +101 -41
- package/src/index.ts +8 -0
- package/src/pages/console/data/messages.ts +6 -0
- package/src/pages/console/data/projections.tsx +4 -0
- package/src/pages/console/data/shared.tsx +1 -0
- package/src/pages/console/ontology/lineage/trail.tsx +3 -0
- package/src/shell/search-command.tsx +2 -0
- package/dist/chunk-001c4gnk.js.map +0 -204
- package/dist/chunk-5crvhjp2.js.map +0 -28
- /package/dist/{chunk-fwb9mxwm.js.map → chunk-5sgac68y.js.map} +0 -0
- /package/dist/{chunk-kes4ygmz.js.map → chunk-69qgh20f.js.map} +0 -0
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
writeArtifactPanelWidth,
|
|
42
42
|
} from "./artifact-panel-state"
|
|
43
43
|
import { useAgentMessages } from "./i18n"
|
|
44
|
+
import { useThreadStateStore } from "./thread-state"
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
* A place in the panel a part of the conversation fills itself, such as a sub-agent's thread: the
|
|
@@ -100,7 +101,10 @@ export interface ArtifactPanelRootProps {
|
|
|
100
101
|
/** The conversation; a different one starts with nothing open. */
|
|
101
102
|
readonly scopeKey: string
|
|
102
103
|
readonly routeTarget?: ArtifactTarget | null
|
|
103
|
-
readonly onRouteTargetChange?: (
|
|
104
|
+
readonly onRouteTargetChange?: (
|
|
105
|
+
target: ArtifactTarget | null,
|
|
106
|
+
options?: { readonly replace?: boolean }
|
|
107
|
+
) => void
|
|
104
108
|
/** Offer each artifact's own page, to open or to copy a link to. Off for an observer. */
|
|
105
109
|
readonly pageLinks?: boolean
|
|
106
110
|
/**
|
|
@@ -128,41 +132,89 @@ export function ArtifactPanelRoot({
|
|
|
128
132
|
}: ArtifactPanelRootProps) {
|
|
129
133
|
const messages = useAgentMessages().artifacts
|
|
130
134
|
const idPrefix = useId()
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
const [trail, setTrail] = useState<readonly PanelTarget[]>([])
|
|
135
|
-
const [slotHost, setSlotHost] = useState<HTMLElement | null>(null)
|
|
135
|
+
const store = useThreadStateStore()
|
|
136
|
+
const storeRef = useRef(store)
|
|
137
|
+
storeRef.current = store
|
|
136
138
|
const presentation = artifactPanelPresentation({
|
|
137
139
|
compact,
|
|
138
140
|
isMobile: useIsMobile(),
|
|
139
141
|
hasCanvas: Boolean(overlayHost),
|
|
140
142
|
split,
|
|
141
143
|
})
|
|
144
|
+
// Restore side-by-side panels and dock canvases automatically; never auto-pop a blocking modal.
|
|
145
|
+
const canAutoRestore = presentation !== "dialog"
|
|
146
|
+
const [localTarget, setLocalTarget] = useState<PanelTarget | null>(() =>
|
|
147
|
+
routeTarget || !canAutoRestore ? null : store.readPanelTarget(scopeKey)
|
|
148
|
+
)
|
|
149
|
+
const target: PanelTarget | null = routeTarget ?? localTarget
|
|
150
|
+
// What the reader followed a reference from, so the panel can take them back.
|
|
151
|
+
const [trail, setTrail] = useState<readonly PanelTarget[]>([])
|
|
152
|
+
const [slotHost, setSlotHost] = useState<HTMLElement | null>(null)
|
|
142
153
|
const [revealCount, reveal] = useReducer((count: number) => count + 1, 0)
|
|
143
154
|
const openerRef = useRef<HTMLElement | null>(null)
|
|
144
155
|
const scopeRef = useRef(scopeKey)
|
|
156
|
+
const prevRouteKeyRef = useRef<string | null>(routeTarget ? viewerTargetKey(routeTarget) : null)
|
|
157
|
+
const localTargetRef = useRef(localTarget)
|
|
158
|
+
localTargetRef.current = localTarget
|
|
159
|
+
|
|
160
|
+
const routeRef = useRef({ routeTarget, onRouteTargetChange })
|
|
161
|
+
routeRef.current = { routeTarget, onRouteTargetChange }
|
|
145
162
|
|
|
146
163
|
useLayoutEffect(() => {
|
|
147
|
-
|
|
164
|
+
const scopeChanged = scopeRef.current !== scopeKey
|
|
165
|
+
const nextRouteKey = routeTarget ? viewerTargetKey(routeTarget) : null
|
|
166
|
+
const prevRouteKey = prevRouteKeyRef.current
|
|
148
167
|
scopeRef.current = scopeKey
|
|
149
|
-
|
|
150
|
-
setTrail([])
|
|
151
|
-
openerRef.current = null
|
|
152
|
-
}, [scopeKey])
|
|
168
|
+
prevRouteKeyRef.current = nextRouteKey
|
|
153
169
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
170
|
+
if (scopeChanged) {
|
|
171
|
+
setTrail([])
|
|
172
|
+
openerRef.current = null
|
|
173
|
+
if (routeTarget) {
|
|
157
174
|
setLocalTarget(null)
|
|
158
|
-
|
|
175
|
+
storeRef.current.writePanelTarget(scopeKey, routeTarget)
|
|
176
|
+
} else if (canAutoRestore) {
|
|
177
|
+
const restored = storeRef.current.readPanelTarget(scopeKey)
|
|
178
|
+
setLocalTarget(restored)
|
|
179
|
+
if (restored?.type === "artifact" && routeRef.current.onRouteTargetChange) {
|
|
180
|
+
routeRef.current.onRouteTargetChange(restored, { replace: true })
|
|
181
|
+
}
|
|
159
182
|
} else {
|
|
160
|
-
setLocalTarget(
|
|
161
|
-
if (onRouteTargetChange && routeTarget) onRouteTargetChange(null)
|
|
183
|
+
setLocalTarget(null)
|
|
162
184
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
185
|
+
return
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (routeTarget) {
|
|
189
|
+
setLocalTarget(null)
|
|
190
|
+
storeRef.current.writePanelTarget(scopeKey, routeTarget)
|
|
191
|
+
} else if (prevRouteKey !== null && localTargetRef.current === null) {
|
|
192
|
+
storeRef.current.writePanelTarget(scopeKey, null)
|
|
193
|
+
}
|
|
194
|
+
}, [scopeKey, routeTarget, canAutoRestore])
|
|
195
|
+
|
|
196
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: sync restored artifact once on mount
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
const changeRoute = routeRef.current.onRouteTargetChange
|
|
199
|
+
if (!routeTarget && localTarget?.type === "artifact" && changeRoute) {
|
|
200
|
+
changeRoute(localTarget, { replace: true })
|
|
201
|
+
}
|
|
202
|
+
}, [])
|
|
203
|
+
|
|
204
|
+
const show = useCallback((next: PanelTarget) => {
|
|
205
|
+
// A slot does not come back with its conversation, and neither does what it replaced.
|
|
206
|
+
storeRef.current.writePanelTarget(scopeRef.current, next.type === "slot" ? null : next)
|
|
207
|
+
const { routeTarget: currentRoute, onRouteTargetChange: changeRoute } = routeRef.current
|
|
208
|
+
if (changeRoute && next.type === "artifact") {
|
|
209
|
+
localTargetRef.current = null
|
|
210
|
+
setLocalTarget(null)
|
|
211
|
+
changeRoute(next)
|
|
212
|
+
} else {
|
|
213
|
+
localTargetRef.current = next
|
|
214
|
+
setLocalTarget(next)
|
|
215
|
+
if (changeRoute && currentRoute) changeRoute(null)
|
|
216
|
+
}
|
|
217
|
+
}, [])
|
|
166
218
|
const open = useCallback(
|
|
167
219
|
(next: PanelTarget) => {
|
|
168
220
|
const active = typeof document === "undefined" ? null : document.activeElement
|
|
@@ -177,13 +229,16 @@ export function ArtifactPanelRoot({
|
|
|
177
229
|
[show]
|
|
178
230
|
)
|
|
179
231
|
const close = useCallback(() => {
|
|
232
|
+
storeRef.current.writePanelTarget(scopeRef.current, null)
|
|
233
|
+
const { routeTarget: currentRoute, onRouteTargetChange: changeRoute } = routeRef.current
|
|
234
|
+
localTargetRef.current = null
|
|
180
235
|
setLocalTarget(null)
|
|
181
236
|
setTrail([])
|
|
182
|
-
if (
|
|
237
|
+
if (changeRoute && currentRoute) changeRoute(null)
|
|
183
238
|
const opener = openerRef.current
|
|
184
239
|
openerRef.current = null
|
|
185
240
|
if (opener?.isConnected) queueMicrotask(() => opener.focus())
|
|
186
|
-
}, [
|
|
241
|
+
}, [])
|
|
187
242
|
|
|
188
243
|
const value = useMemo<ArtifactPanelValue>(
|
|
189
244
|
() => ({
|
|
@@ -3,6 +3,7 @@ import { ActivityStatusText } from "../components/activity-status"
|
|
|
3
3
|
import { useAgentMessages } from "../i18n"
|
|
4
4
|
import type { NormalizedTool } from "../parts"
|
|
5
5
|
import { toolResultValue } from "../parts"
|
|
6
|
+
import { namedIds } from "../waits"
|
|
6
7
|
import { useBackgroundCards } from "./context"
|
|
7
8
|
import { backgroundRowLabel } from "./interpret"
|
|
8
9
|
|
|
@@ -35,22 +36,35 @@ export function BackgroundToolRow({ tool }: { readonly tool: NormalizedTool }) {
|
|
|
35
36
|
)
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* The commands a call names: its own input, what it returned, or the starts of those ids. `wait`
|
|
41
|
+
* names several by id and returns them in `commands`; the tools before it named one.
|
|
42
|
+
*/
|
|
39
43
|
function commandNamed(
|
|
40
44
|
tool: NormalizedTool,
|
|
41
45
|
commands: ReadonlyMap<string, { readonly id: string; readonly command: string }> | undefined
|
|
42
46
|
): string {
|
|
43
47
|
const input = isRecord(tool.input) ? tool.input : {}
|
|
48
|
+
if (typeof input.command === "string") return firstLine(input.command)
|
|
44
49
|
const output = toolResultValue(tool.output)
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
?
|
|
48
|
-
:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
const returned = isRecord(output)
|
|
51
|
+
? Array.isArray(output.commands)
|
|
52
|
+
? output.commands.filter(isRecord)
|
|
53
|
+
: [output]
|
|
54
|
+
: []
|
|
55
|
+
const started = [...(commands?.values() ?? [])].reverse()
|
|
56
|
+
return namedIds(tool)
|
|
57
|
+
.map((id) => {
|
|
58
|
+
const named =
|
|
59
|
+
returned.find((command) => command.id === id)?.command ??
|
|
60
|
+
started.find((command) => command.id === id)?.command
|
|
61
|
+
return (typeof named === "string" && firstLine(named)) || id
|
|
62
|
+
})
|
|
63
|
+
.join(", ")
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function firstLine(value: string): string {
|
|
67
|
+
return value.trim().split("\n")[0] ?? ""
|
|
54
68
|
}
|
|
55
69
|
|
|
56
70
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
@@ -2,16 +2,17 @@ import type { AgentConversationMessage } from "../conversation"
|
|
|
2
2
|
import type { AgentMessages } from "../i18n/en"
|
|
3
3
|
import type { NormalizedTool } from "../parts"
|
|
4
4
|
import { toolResultValue } from "../parts"
|
|
5
|
+
import { COMMAND_TOOLS, isStop, namedIds } from "../waits"
|
|
5
6
|
|
|
6
|
-
// A command the agent runs in the background outlives the call that started it: later calls
|
|
7
|
-
// it (`
|
|
7
|
+
// A command the agent runs in the background outlives the call that started it: later calls wait
|
|
8
|
+
// for it (`wait`) or stop it (`stop`), maybe turns later, and on the owner's computer the
|
|
8
9
|
// open `sixb` reports how it stands between turns. The chat shows it as one card in the work's
|
|
9
10
|
// steps, in place of its start, merging all of these: only a reader who opens the steps sees it.
|
|
10
11
|
|
|
11
12
|
export type BackgroundCommandStatus = "running" | "exited" | "stopped"
|
|
12
13
|
|
|
13
|
-
/** The tools that start, read and stop a background command. */
|
|
14
|
-
export const BACKGROUND_TOOLS: ReadonlySet<string> = new Set(["bash",
|
|
14
|
+
/** The tools that start, read and stop a background command, earlier threads' included. */
|
|
15
|
+
export const BACKGROUND_TOOLS: ReadonlySet<string> = new Set(["bash", ...COMMAND_TOOLS])
|
|
15
16
|
|
|
16
17
|
/** How much of what the agent read of a command the card keeps: its newest characters. */
|
|
17
18
|
const OUTPUT_TAIL_CHARS = 8_000
|
|
@@ -169,50 +170,46 @@ export function readThreadBackground(
|
|
|
169
170
|
continue
|
|
170
171
|
}
|
|
171
172
|
|
|
172
|
-
// A read or a stop on its way names the
|
|
173
|
+
// A read or a stop on its way names the commands it is for.
|
|
173
174
|
if (tool.state === "input-streaming" || tool.state === "input-available") {
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
? "stopping"
|
|
180
|
-
: typeof input.wait === "number" && input.wait > 0
|
|
181
|
-
? "waiting"
|
|
182
|
-
: "reading"
|
|
183
|
-
merge(key, { pending })
|
|
175
|
+
const pending = isStop(tool) ? "stopping" : waits(tool) ? "waiting" : "reading"
|
|
176
|
+
for (const id of namedIds(tool)) {
|
|
177
|
+
const key = byId.get(id)
|
|
178
|
+
if (key) merge(key, { pending })
|
|
179
|
+
}
|
|
184
180
|
continue
|
|
185
181
|
}
|
|
186
182
|
if (tool.state !== "output-available") continue
|
|
187
183
|
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
184
|
+
for (const report of reportsOf(tool)) {
|
|
185
|
+
const read = commandState(report)
|
|
186
|
+
if (!read) continue
|
|
187
|
+
const key = backgroundKey(read)
|
|
188
|
+
const known = commands.get(key)
|
|
189
|
+
// Its start is beyond what the conversation shows: the read stands for it.
|
|
190
|
+
const current: CommandFromCalls = known ?? {
|
|
191
|
+
...read,
|
|
192
|
+
runId: message.runId,
|
|
193
|
+
output: "",
|
|
194
|
+
truncated: false,
|
|
195
|
+
}
|
|
196
|
+
byId.set(read.id, key)
|
|
197
|
+
|
|
198
|
+
const written = typeof outputOf(report)?.output === "string" ? outputOf(report)?.output : ""
|
|
199
|
+
const skipped = Number(outputOf(report)?.skippedBytes ?? 0) > 0
|
|
200
|
+
const joined = current.output + (written ?? "")
|
|
201
|
+
// An end is final: a later read never says it runs again.
|
|
202
|
+
const ended = current.status !== "running" ? current : read
|
|
203
|
+
const { pending: _pending, ...rest } = current
|
|
204
|
+
commands.set(key, {
|
|
205
|
+
...rest,
|
|
206
|
+
status: ended.status,
|
|
207
|
+
...(ended.exitCode === undefined ? {} : { exitCode: ended.exitCode }),
|
|
208
|
+
...(ended.endedAt === undefined ? {} : { endedAt: ended.endedAt }),
|
|
209
|
+
output: joined.slice(-OUTPUT_TAIL_CHARS),
|
|
210
|
+
truncated: current.truncated || skipped || joined.length > OUTPUT_TAIL_CHARS,
|
|
211
|
+
})
|
|
198
212
|
}
|
|
199
|
-
byId.set(read.id, key)
|
|
200
|
-
|
|
201
|
-
const written =
|
|
202
|
-
typeof outputOf(tool.output)?.output === "string" ? outputOf(tool.output)?.output : ""
|
|
203
|
-
const skipped = Number(outputOf(tool.output)?.skippedBytes ?? 0) > 0
|
|
204
|
-
const joined = current.output + (written ?? "")
|
|
205
|
-
// An end is final: a later read never says it runs again.
|
|
206
|
-
const ended = current.status !== "running" ? current : read
|
|
207
|
-
const { pending: _pending, ...rest } = current
|
|
208
|
-
commands.set(key, {
|
|
209
|
-
...rest,
|
|
210
|
-
status: ended.status,
|
|
211
|
-
...(ended.exitCode === undefined ? {} : { exitCode: ended.exitCode }),
|
|
212
|
-
...(ended.endedAt === undefined ? {} : { endedAt: ended.endedAt }),
|
|
213
|
-
output: joined.slice(-OUTPUT_TAIL_CHARS),
|
|
214
|
-
truncated: current.truncated || skipped || joined.length > OUTPUT_TAIL_CHARS,
|
|
215
|
-
})
|
|
216
213
|
}
|
|
217
214
|
}
|
|
218
215
|
|
|
@@ -297,15 +294,13 @@ export function backgroundCardState(input: {
|
|
|
297
294
|
/** What a background call reads as, in the work and as the live label of a turn at work. */
|
|
298
295
|
export function backgroundRowLabel(tool: NormalizedTool, messages: AgentMessages): string {
|
|
299
296
|
const rows = messages.background.rows
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
tool.toolName
|
|
303
|
-
?
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
: rows.read
|
|
308
|
-
: rows.start
|
|
297
|
+
const row = isStop(tool)
|
|
298
|
+
? rows.stop
|
|
299
|
+
: COMMAND_TOOLS.has(tool.toolName)
|
|
300
|
+
? waits(tool)
|
|
301
|
+
? rows.wait
|
|
302
|
+
: rows.read
|
|
303
|
+
: rows.start
|
|
309
304
|
return tool.state === "input-streaming" || tool.state === "input-available"
|
|
310
305
|
? row.running
|
|
311
306
|
: row.title
|
|
@@ -346,6 +341,20 @@ function commandState(output: unknown): {
|
|
|
346
341
|
}
|
|
347
342
|
}
|
|
348
343
|
|
|
344
|
+
/** Whether a call waits for its commands to end: `wait` unless told 0, `bash_output` when told. */
|
|
345
|
+
function waits(tool: NormalizedTool): boolean {
|
|
346
|
+
const input = isRecord(tool.input) ? tool.input : {}
|
|
347
|
+
if (tool.toolName === "wait") return input.timeoutMs !== 0
|
|
348
|
+
return typeof input.wait === "number" && input.wait > 0
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** What a call reports of each command: `wait` and `stop` list theirs, earlier tools one. */
|
|
352
|
+
function reportsOf(tool: NormalizedTool): readonly unknown[] {
|
|
353
|
+
if (tool.toolName !== "wait" && tool.toolName !== "stop") return [tool.output]
|
|
354
|
+
const value = toolResultValue(tool.output)
|
|
355
|
+
return isRecord(value) && Array.isArray(value.commands) ? value.commands : []
|
|
356
|
+
}
|
|
357
|
+
|
|
349
358
|
function outputOf(output: unknown): Record<string, unknown> | null {
|
|
350
359
|
const value = toolResultValue(output)
|
|
351
360
|
return isRecord(value) ? value : null
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LANGUAGE_MODEL_TIERS, type ModelReasoningLevel } from "@sixb/core/models"
|
|
2
2
|
import { cn } from "@sixb/ui/lib/utils"
|
|
3
3
|
import { ChevronDown, Search } from "lucide-react"
|
|
4
|
-
import { Fragment, useEffect, useId, useMemo, useState } from "react"
|
|
4
|
+
import { Fragment, memo, useEffect, useId, useMemo, useState } from "react"
|
|
5
5
|
import { AGENT_APPROVAL_MODES, type AgentApprovalMode } from "../approvals"
|
|
6
6
|
import { useAgentMessages } from "../i18n"
|
|
7
7
|
import type { AgentMessages } from "../i18n/en"
|
|
@@ -53,7 +53,7 @@ export interface ComposerSettingsProps {
|
|
|
53
53
|
* model with its provider's mark, then the permissions' icon unless the agent has full access. Its
|
|
54
54
|
* menu holds the model, with the chosen model's thinking under it, and the permissions.
|
|
55
55
|
*/
|
|
56
|
-
export function ComposerSettings(props: ComposerSettingsProps) {
|
|
56
|
+
export const ComposerSettings = memo(function ComposerSettings(props: ComposerSettingsProps) {
|
|
57
57
|
const {
|
|
58
58
|
models = [],
|
|
59
59
|
selectedModel,
|
|
@@ -76,16 +76,26 @@ export function ComposerSettings(props: ComposerSettingsProps) {
|
|
|
76
76
|
const auto = choosesModel && autoModels(models, onResetModelSelection) && !selectedModel
|
|
77
77
|
const modeLabel = approvalMode ? agentMessages.approvalModes.modes[approvalMode].label : undefined
|
|
78
78
|
const ModeIcon = approvalMode ? APPROVAL_MODE_ICONS[approvalMode] : undefined
|
|
79
|
+
|
|
80
|
+
// While the models load, the chip names nothing rather than a stand-in it would swap a moment
|
|
81
|
+
// later: its label lands once, and the composer around it doesn't jump.
|
|
82
|
+
const loading = choosesModel && modelsLoading && !selectedModel
|
|
79
83
|
const name = !choosesModel
|
|
80
84
|
? modeLabel
|
|
81
|
-
:
|
|
82
|
-
?
|
|
83
|
-
:
|
|
84
|
-
|
|
85
|
+
: loading
|
|
86
|
+
? undefined
|
|
87
|
+
: auto
|
|
88
|
+
? agentMessages.models.auto
|
|
89
|
+
: (selectedModel?.name ??
|
|
90
|
+
(modelsError ? agentMessages.models.unavailable : agentMessages.models.defaultModel))
|
|
85
91
|
const level = auto
|
|
86
92
|
? undefined
|
|
87
93
|
: reasoningLabel(selectedModel, selectedReasoning, agentMessages.reasoning)
|
|
88
94
|
const summary = [name, level, choosesModel ? modeLabel : undefined].filter(Boolean)
|
|
95
|
+
const label =
|
|
96
|
+
summary.length > 0
|
|
97
|
+
? agentMessages.settings.chip(summary.join(", "))
|
|
98
|
+
: agentMessages.settings.title
|
|
89
99
|
|
|
90
100
|
return (
|
|
91
101
|
<ComposerMenu
|
|
@@ -97,10 +107,10 @@ export function ComposerSettings(props: ComposerSettingsProps) {
|
|
|
97
107
|
<button
|
|
98
108
|
type="button"
|
|
99
109
|
disabled={!choosesMode && (disabled || modelsLoading || models.length === 0)}
|
|
100
|
-
aria-label={
|
|
110
|
+
aria-label={label}
|
|
101
111
|
aria-haspopup="dialog"
|
|
102
112
|
aria-expanded={open}
|
|
103
|
-
title={summary.join(" · ")}
|
|
113
|
+
title={summary.length > 0 ? summary.join(" · ") : undefined}
|
|
104
114
|
data-approval-mode={approvalMode}
|
|
105
115
|
className="group/settings mb-0.5 flex h-9 min-w-0 shrink-0 items-center gap-1.5 rounded-full pr-[9px] pl-[11px] text-[13.5px] font-medium text-foreground/80 outline-none transition-colors hover:bg-black/[0.05] focus-visible:ring-2 focus-visible:ring-ring/40 disabled:cursor-default disabled:opacity-60 aria-expanded:bg-black/[0.05] dark:hover:bg-white/[0.08] dark:aria-expanded:bg-white/[0.08]"
|
|
106
116
|
>
|
|
@@ -110,7 +120,7 @@ export function ComposerSettings(props: ComposerSettingsProps) {
|
|
|
110
120
|
{!choosesModel && ModeIcon ? (
|
|
111
121
|
<ModeIcon className="size-[15px] shrink-0" strokeWidth={1.9} aria-hidden="true" />
|
|
112
122
|
) : null}
|
|
113
|
-
<span className="max-w-[11rem] truncate max-sm:max-w-[7rem]">{name}</span>
|
|
123
|
+
{name ? <span className="max-w-[11rem] truncate max-sm:max-w-[7rem]">{name}</span> : null}
|
|
114
124
|
{choosesModel && choosesMode && approvalMode !== "auto" && ModeIcon ? (
|
|
115
125
|
<>
|
|
116
126
|
<span aria-hidden="true" className="mx-px h-[13px] w-px bg-current opacity-20" />
|
|
@@ -137,7 +147,7 @@ export function ComposerSettings(props: ComposerSettingsProps) {
|
|
|
137
147
|
) : null}
|
|
138
148
|
</ComposerMenu>
|
|
139
149
|
)
|
|
140
|
-
}
|
|
150
|
+
})
|
|
141
151
|
|
|
142
152
|
/** Tiers with a way back to Auto: the list opens on Auto, and choosing a model pins it. */
|
|
143
153
|
function autoModels(models: readonly LanguageModel[], onResetModelSelection?: () => void) {
|