@ahggg/dsh-side-chat 0.4.1 → 0.5.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/lib/client/index.d.ts +1 -1
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +1 -1
- package/lib/client/index.js.map +1 -1
- package/lib/client/panel/SelectionQuote.d.ts.map +1 -1
- package/lib/client/panel/SelectionQuote.js +26 -1
- package/lib/client/panel/SelectionQuote.js.map +1 -1
- package/lib/client/parent-composer/ParentConversationAnnotations.d.ts.map +1 -1
- package/lib/client/parent-composer/ParentConversationAnnotations.js +4 -2
- package/lib/client/parent-composer/ParentConversationAnnotations.js.map +1 -1
- package/lib/client/parent-composer/add-to-conversation.d.ts +16 -0
- package/lib/client/parent-composer/add-to-conversation.d.ts.map +1 -1
- package/lib/client/parent-composer/add-to-conversation.js +143 -17
- package/lib/client/parent-composer/add-to-conversation.js.map +1 -1
- package/lib/client/parent-composer/annotation-persistence.d.ts +19 -0
- package/lib/client/parent-composer/annotation-persistence.d.ts.map +1 -0
- package/lib/client/parent-composer/annotation-persistence.js +97 -0
- package/lib/client/parent-composer/annotation-persistence.js.map +1 -0
- package/lib/client/rc6/ArchivedConversation.d.ts +2 -1
- package/lib/client/rc6/ArchivedConversation.d.ts.map +1 -1
- package/lib/client/rc6/ArchivedConversation.js +9 -90
- package/lib/client/rc6/ArchivedConversation.js.map +1 -1
- package/lib/client/rc6/Rc6SideChatOverlay.d.ts.map +1 -1
- package/lib/client/rc6/Rc6SideChatOverlay.js +53 -4
- package/lib/client/rc6/Rc6SideChatOverlay.js.map +1 -1
- package/lib/client/rc6/SideChatTool.d.ts +23 -0
- package/lib/client/rc6/SideChatTool.d.ts.map +1 -0
- package/lib/client/rc6/SideChatTool.js +395 -0
- package/lib/client/rc6/SideChatTool.js.map +1 -0
- package/lib/client/rc6/sessions-adapter.d.ts +11 -0
- package/lib/client/rc6/sessions-adapter.d.ts.map +1 -1
- package/lib/client/rc6/sessions-adapter.js +67 -16
- package/lib/client/rc6/sessions-adapter.js.map +1 -1
- package/lib/client/selection/ConversationAnnotationMarkers.d.ts +9 -0
- package/lib/client/selection/ConversationAnnotationMarkers.d.ts.map +1 -0
- package/lib/client/selection/ConversationAnnotationMarkers.js +241 -0
- package/lib/client/selection/ConversationAnnotationMarkers.js.map +1 -0
- package/lib/client/selection/SelectionActions.d.ts +6 -1
- package/lib/client/selection/SelectionActions.d.ts.map +1 -1
- package/lib/client/selection/SelectionActions.js +9 -8
- package/lib/client/selection/SelectionActions.js.map +1 -1
- package/lib/client/selection/selection-controller.d.ts +11 -0
- package/lib/client/selection/selection-controller.d.ts.map +1 -1
- package/lib/client/selection/selection-controller.js +54 -0
- package/lib/client/selection/selection-controller.js.map +1 -1
- package/lib/client.js +1187 -202
- package/lib/client.js.map +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -8,7 +8,7 @@ window.__ModuleLoader__.load({
|
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
10
10
|
//#region \0dsh-side-chat-css:L2hvbWUvcnVubmVyL3dvcmsvZHNoLXNpZGUtY2hhdC9kc2gtc2lkZS1jaGF0L3NyYy9jbGllbnQvcGFuZWwvc2lkZS1jaGF0LmNzcw
|
|
11
|
-
var _dsh_side_chat_css_L2hvbWUvcnVubmVyL3dvcmsvZHNoLXNpZGUtY2hhdC9kc2gtc2lkZS1jaGF0L3NyYy9jbGllbnQvcGFuZWwvc2lkZS1jaGF0LmNzcw_default = ".dsh-side-chat-overlay {\n pointer-events: none;\n}\n\n.dsh-side-chat-overlay > * {\n pointer-events: auto;\n}\n\n.dsh-side-chat-panel {\n --side-chat-border: var(--dsw-border, #d8d8de);\n --side-chat-bg: var(--dsw-surface, #ffffff);\n --side-chat-muted: var(--dsw-text-muted, #62636a);\n position: fixed;\n z-index: 70;\n right: clamp(12px, 2vw, 20px);\n bottom: clamp(12px, 2vw, 20px);\n display: flex;\n width: min(840px, calc(100vw - 32px));\n height: clamp(460px, 62dvh, 980px);\n max-height: calc(100dvh - 32px);\n min-width: 0;\n min-height: 0;\n box-sizing: border-box;\n flex-direction: column;\n overflow: hidden;\n border: 1px solid var(--side-chat-border);\n border-radius: 28px;\n background: var(--side-chat-bg);\n color: var(--dsw-text, #19191d);\n box-shadow: 0 12px 36px rgb(0 0 0 / 11%), 0 2px 8px rgb(0 0 0 / 6%);\n}\n\n.dsh-side-chat-conversation {\n display: flex;\n height: 100%;\n min-height: 0;\n flex-direction: column;\n overflow: hidden;\n}\n\n.dsh-side-chat-transcript {\n display: flex;\n min-height: 0;\n flex: 1;\n flex-direction: column;\n gap: 12px;\n overflow-x: hidden;\n overflow-y: auto;\n padding: 18px 20px 24px;\n scrollbar-color: color-mix(in srgb, var(--side-chat-muted) 34%, transparent) transparent;\n scrollbar-width: thin;\n}\n\n.dsh-side-chat-message {\n max-width: 92%;\n padding: 10px 12px;\n border: 1px solid var(--side-chat-border);\n border-radius: 12px;\n background: var(--dsw-surface-subtle, #f7f7f9);\n}\n\n.dsh-side-chat-message[data-role=\"user\"] {\n align-self: end;\n background: var(--dsw-accent-soft, #eef4ff);\n}\n\n.dsh-side-chat-message[data-role=\"assistant\"] {\n align-self: start;\n min-width: 0;\n max-width: 100%;\n border-color: transparent;\n background: transparent;\n overflow-wrap: anywhere;\n}\n.dsh-side-chat-message-role,\n.dsh-side-chat-message-note { display: block; margin-bottom: 5px; color: var(--side-chat-muted); font-size: 12px; }\n.dsh-side-chat-message-text { white-space: pre-wrap; overflow-wrap: anywhere; }\n.dsh-side-chat-message pre,\n.dsh-side-chat-turn-notice pre { overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }\n.dsh-side-chat-message[data-role=\"assistant\"] :where(table) {\n display: block;\n max-width: 100%;\n overflow-x: auto;\n}\n.dsh-side-chat-tool {\n min-width: 0;\n max-width: 100%;\n flex: 0 0 auto;\n border: 1px solid var(--side-chat-border);\n border-radius: 10px;\n background: var(--dsw-surface-subtle, #f7f7f9);\n overflow: hidden;\n}\n.dsh-side-chat-tool > .dsh-side-chat-tool-toggle {\n display: grid;\n width: 100%;\n min-height: 38px;\n box-sizing: border-box;\n grid-template-columns: 18px auto minmax(0, 1fr) auto;\n gap: 8px;\n align-items: center;\n padding: 7px 10px;\n border: 0;\n border-radius: 0;\n background: transparent;\n color: inherit;\n cursor: pointer;\n font: inherit;\n text-align: left;\n}\n.dsh-side-chat-tool > .dsh-side-chat-tool-toggle:hover { background: rgb(0 0 0 / 4%); }\n.dsh-side-chat-tool > .dsh-side-chat-tool-toggle:focus-visible {\n outline: 2px solid color-mix(in srgb, var(--dsw-alias-button-info, #1473e6) 48%, transparent);\n outline-offset: -2px;\n}\n.dsh-side-chat-tool-status {\n display: grid;\n width: 16px;\n height: 16px;\n box-sizing: border-box;\n place-items: center;\n border: 1.5px solid color-mix(in srgb, var(--side-chat-muted) 58%, transparent);\n border-radius: 999px;\n color: var(--side-chat-muted);\n font-size: 11px;\n line-height: 1;\n}\n.dsh-side-chat-tool[data-state=\"success\"] .dsh-side-chat-tool-status::after { content: '✓'; }\n.dsh-side-chat-tool[data-state=\"pending\"] .dsh-side-chat-tool-status::after { content: '·'; }\n.dsh-side-chat-tool[data-state=\"error\"] .dsh-side-chat-tool-status::after { content: '!'; }\n.dsh-side-chat-tool[data-state=\"interrupted\"] .dsh-side-chat-tool-status::after { content: '×'; }\n.dsh-side-chat-tool[data-state=\"running\"] .dsh-side-chat-tool-status {\n border-color: color-mix(in srgb, var(--dsw-alias-button-info, #1473e6) 25%, transparent);\n border-top-color: var(--dsw-alias-button-info, #1473e6);\n animation: dsh-side-chat-tool-spin 800ms linear infinite;\n}\n.dsh-side-chat-tool-name { font-size: 13px; font-weight: 500; white-space: nowrap; }\n.dsh-side-chat-tool-summary {\n min-width: 0;\n overflow: hidden;\n color: var(--side-chat-muted);\n font-size: 12px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.dsh-side-chat-tool-state { color: var(--side-chat-muted); font-size: 12px; }\n.dsh-side-chat-tool[data-state=\"error\"] .dsh-side-chat-tool-state { color: var(--dsw-danger, #b42318); }\n.dsh-side-chat-tool-body {\n display: grid;\n gap: 0;\n border-top: 1px solid var(--side-chat-border);\n background: var(--side-chat-bg);\n}\n.dsh-side-chat-tool-body section { min-width: 0; padding: 10px 12px; }\n.dsh-side-chat-tool-body section + section { border-top: 1px solid var(--side-chat-border); }\n.dsh-side-chat-tool-body strong { color: var(--side-chat-muted); font-size: 12px; font-weight: 500; }\n.dsh-side-chat-tool-body pre {\n max-height: 260px;\n margin: 6px 0 0;\n overflow: auto;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;\n}\n@keyframes dsh-side-chat-tool-spin { to { transform: rotate(360deg); } }\n.dsh-side-chat-turn-notice,\n.dsh-side-chat-interaction,\n.dsh-side-chat-queue { padding: 10px; border: 1px solid var(--side-chat-border); border-radius: 10px; }\n.dsh-side-chat-interaction fieldset { margin: 8px 0; border: 1px solid var(--side-chat-border); border-radius: 8px; }\n.dsh-side-chat-question-option { display: flex; gap: 8px; margin: 8px 0; }\n.dsh-side-chat-interaction textarea { width: 100%; box-sizing: border-box; resize: vertical; }\n.dsh-side-chat-interaction-actions,\n.dsh-side-chat-composer > div,\n.dsh-side-chat-queue > div { display: flex; justify-content: end; gap: 8px; }\n.dsh-side-chat-interaction button,\n.dsh-side-chat-composer button,\n.dsh-side-chat-queue button { min-height: 32px; border: 1px solid var(--side-chat-border); border-radius: 7px; background: var(--dsw-control, #f7f7f9); color: inherit; cursor: pointer; }\n.dsh-side-chat-composer {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n gap: 8px;\n align-items: end;\n margin: 0 12px 12px;\n padding: 8px 8px 8px 12px;\n border: 1px solid var(--side-chat-border);\n border-radius: 24px;\n background: var(--side-chat-bg);\n box-shadow: 0 2px 8px rgb(0 0 0 / 5%);\n}\n.dsh-side-chat-composer textarea {\n width: 100%;\n height: auto;\n min-height: 24px;\n max-height: 160px;\n box-sizing: border-box;\n resize: none;\n overflow-y: hidden;\n padding: 6px;\n border: 0;\n outline: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n line-height: 1.5;\n}\n.dsh-side-chat-composer button { align-self: end; }\n.dsh-side-chat-loading { display: grid; height: 100%; place-items: center; color: var(--side-chat-muted); }\n\n.dsh-side-chat-header {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n gap: 8px 12px;\n align-items: center;\n flex: 0 0 auto;\n min-height: 46px;\n box-sizing: border-box;\n padding: 5px 10px 5px 16px;\n border-bottom: 1px solid var(--side-chat-border);\n background: var(--side-chat-bg);\n}\n\n.dsh-side-chat-heading { display: flex; min-width: 0; flex-direction: column; }\n.dsh-side-chat-heading strong { font-size: 14px; font-weight: 600; }\n.dsh-side-chat-footer { color: var(--side-chat-muted); font-size: 12px; }\n.dsh-side-chat-header button,\n.dsh-side-chat-inline-actions button,\n.dsh-side-chat-draft button,\n.dsh-side-chat-error button,\n.dsh-side-chat-selection-actions button {\n min-height: 32px;\n border: 1px solid var(--side-chat-border);\n border-radius: 7px;\n background: var(--dsw-control, #f7f7f9);\n color: inherit;\n cursor: pointer;\n}\n.dsh-side-chat-header button:disabled { cursor: not-allowed; opacity: .55; }\n.dsh-side-chat-header .dsh-side-chat-heading {\n align-items: flex-start;\n min-height: 0;\n padding: 4px 0;\n border: 0;\n background: transparent;\n text-align: left;\n}\n.dsh-side-chat-header > button:last-child {\n width: 32px;\n min-height: 32px;\n padding: 0;\n border: 0;\n border-radius: 999px;\n background: transparent;\n font-size: 20px;\n line-height: 1;\n}\n.dsh-side-chat-header > button:last-child:hover { background: var(--dsw-surface-subtle, #f3f3f5); }\n\n.dsh-side-chat-quote { position: relative; max-width: 100%; align-self: flex-start; }\n.dsh-side-chat-quote-chip {\n display: inline-flex;\n min-height: 36px;\n align-items: center;\n overflow: hidden;\n padding: 0;\n border: 1px solid var(--side-chat-border);\n border-radius: 999px;\n background: var(--side-chat-bg);\n transition: background-color 120ms ease;\n}\n.dsh-side-chat-quote:hover .dsh-side-chat-quote-chip,\n.dsh-side-chat-quote:focus-within .dsh-side-chat-quote-chip,\n.dsh-side-chat-quote[data-expanded] .dsh-side-chat-quote-chip { background: var(--dsw-surface-subtle, #f3f3f5); }\n.dsh-side-chat-quote-chip .dsh-side-chat-quote-trigger {\n display: inline-flex;\n min-height: 34px;\n align-items: center;\n gap: 8px;\n padding: 0 11px;\n border: 0;\n border-radius: 0;\n background: transparent;\n color: inherit;\n cursor: pointer;\n font: inherit;\n}\n.dsh-side-chat-quote-trigger strong { font-size: 13px; font-weight: 500; line-height: 1; }\n.dsh-side-chat-quote-icon {\n width: 16px;\n height: 16px;\n flex: 0 0 auto;\n color: var(--side-chat-muted);\n fill: none;\n stroke: currentColor;\n stroke-linecap: round;\n stroke-linejoin: round;\n stroke-width: 1.7;\n}\n.dsh-side-chat-quote-chip .dsh-side-chat-quote-remove {\n display: grid;\n width: 0;\n height: 34px;\n min-height: 34px;\n box-sizing: border-box;\n flex: 0 0 auto;\n place-items: center;\n overflow: hidden;\n padding: 0;\n border: 0;\n border-radius: 0;\n background: transparent;\n color: var(--side-chat-muted);\n cursor: pointer;\n font: inherit;\n font-size: 18px;\n line-height: 1;\n opacity: 0;\n pointer-events: none;\n transition: width 120ms ease, margin-left 120ms ease, opacity 100ms ease, background-color 100ms ease;\n}\n.dsh-side-chat-quote:hover .dsh-side-chat-quote-remove,\n.dsh-side-chat-quote:focus-within .dsh-side-chat-quote-remove {\n width: 30px;\n opacity: 1;\n pointer-events: auto;\n}\n.dsh-side-chat-quote-remove:hover { background: rgb(0 0 0 / 6%); color: inherit; }\n.dsh-side-chat-quote-details {\n position: absolute;\n z-index: 10;\n bottom: calc(100% + 8px);\n left: 0;\n width: min(520px, calc(100vw - 64px));\n max-width: calc(100vw - 48px);\n box-sizing: border-box;\n padding: 14px 16px;\n border: 1px solid var(--side-chat-border);\n border-radius: 16px;\n background: var(--side-chat-bg);\n box-shadow: 0 4px 14px rgb(0 0 0 / 8%);\n font-size: 14px;\n line-height: 1.45;\n opacity: 0;\n pointer-events: none;\n transform: translate(var(--dsh-side-chat-quote-offset-x, 0px), 4px);\n visibility: hidden;\n transition: opacity 100ms ease, transform 120ms ease, visibility 100ms ease;\n}\n.dsh-side-chat-quote-details::before {\n content: '';\n position: absolute;\n right: 0;\n bottom: -8px;\n left: 0;\n height: 8px;\n}\n.dsh-side-chat-quote:hover .dsh-side-chat-quote-details,\n.dsh-side-chat-quote[data-hovered] .dsh-side-chat-quote-details,\n.dsh-side-chat-quote:focus-within .dsh-side-chat-quote-details,\n.dsh-side-chat-quote[data-expanded] .dsh-side-chat-quote-details {\n opacity: 1;\n pointer-events: auto;\n transform: translate(var(--dsh-side-chat-quote-offset-x, 0px), 0);\n visibility: visible;\n}\n.dsh-side-chat-annotated-user-message .dsh-side-chat-quote-details {\n top: calc(100% + 8px);\n right: 0;\n bottom: auto;\n left: auto;\n}\n.dsh-side-chat-annotated-user-message .dsh-side-chat-quote-details::before {\n top: -8px;\n bottom: auto;\n}\n.dsh-side-chat-quote-details-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }\n.dsh-side-chat-quote-details-header strong { color: var(--side-chat-muted); font-size: 13px; font-weight: 500; }\n.dsh-side-chat-quote-detail + .dsh-side-chat-quote-detail {\n margin-top: 12px;\n padding-top: 12px;\n border-top: 1px solid var(--side-chat-border);\n}\n.dsh-side-chat-quote pre {\n max-height: 180px;\n margin: 4px 0 0;\n overflow: auto;\n white-space: pre-wrap;\n font: inherit;\n}\n.dsh-side-chat-quote-comment {\n margin-top: 9px;\n}\n.dsh-side-chat-quote-comment > strong { color: var(--side-chat-muted); font-size: 13px; font-weight: 500; }\n.dsh-side-chat-quote-comment > pre { margin-top: 4px; }\n.dsh-side-chat-error { margin: 10px 16px 0; padding: 10px 12px; border: 1px solid var(--side-chat-border); border-radius: 14px; background: var(--dsw-surface-subtle, #f7f7f9); }\n.dsh-side-chat-error { border-color: var(--dsw-danger, #b42318); }\n.dsh-side-chat-body { min-height: 0; flex: 1; overflow: hidden; }\n.dsh-side-chat-annotated-user-message {\n display: flex;\n max-width: 92%;\n align-self: end;\n align-items: flex-start;\n flex-direction: column;\n gap: 8px;\n}\n.dsh-side-chat-annotated-user-message .dsh-side-chat-message { max-width: 100%; align-self: stretch; }\n\n/* The DSH occurrence remains the durable serialization carrier, while this\n plugin-owned capsule supplies the visible and interactive projection. */\n[data-composer-seat] [data-decoration=\"chip\"][title=\"__dsh_side_chat_annotations__\"] {\n visibility: hidden;\n}\n.dsh-side-chat-parent-annotation-dock,\n.dsh-side-chat-parent-user-message {\n --side-chat-border: var(--dsw-border, #d8d8de);\n --side-chat-bg: var(--dsw-surface, #ffffff);\n --side-chat-muted: var(--dsw-text-muted, #62636a);\n color: var(--dsw-text, #19191d);\n}\n.dsh-side-chat-parent-annotation-dock {\n position: relative;\n z-index: 20;\n width: calc(100% - 32px);\n max-width: var(--dsh-composer-card-max-width, 780px);\n height: 0;\n margin: 0 auto;\n pointer-events: none;\n}\n.dsh-side-chat-parent-annotation-dock > .dsh-side-chat-quote {\n position: absolute;\n top: 16px;\n left: 16px;\n pointer-events: auto;\n}\n.dsh-side-chat-parent-user-message {\n display: flex;\n width: 100%;\n flex-direction: column;\n align-items: flex-end;\n gap: 8px;\n}\n.dsh-side-chat-parent-user-message > .dsh-side-chat-quote { align-self: flex-end; }\n.dsh-side-chat-parent-user-message > .dsh-side-chat-quote .dsh-side-chat-quote-details {\n right: 0;\n left: auto;\n}\n.dsh-side-chat-draft {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n min-height: 0;\n flex: 0 0 auto;\n gap: 8px;\n align-items: end;\n margin: auto 12px 12px;\n padding: 12px;\n border: 1px solid var(--side-chat-border);\n border-radius: 24px;\n background: var(--side-chat-bg);\n box-shadow: 0 2px 8px rgb(0 0 0 / 5%);\n}\n.dsh-side-chat-draft > .dsh-side-chat-quote { grid-column: 1 / -1; }\n.dsh-side-chat-draft label {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n}\n.dsh-side-chat-draft textarea {\n width: 100%;\n height: auto;\n min-height: 24px;\n max-height: 160px;\n box-sizing: border-box;\n resize: none;\n overflow-y: hidden;\n padding: 6px 2px;\n border: 0;\n outline: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n line-height: 1.5;\n}\n.dsh-side-chat-draft > button { align-self: end; }\n.dsh-side-chat-panel .dsh-side-chat-send-button,\n.dsh-side-chat-panel .dsh-side-chat-stop-button {\n display: grid;\n width: 34px;\n height: 34px;\n min-height: 34px;\n flex: none;\n place-items: center;\n padding: 1px 6px;\n border: 0;\n border-radius: 999px;\n background: var(--dsw-alias-button-info-fill, #4176e6);\n color: #fff;\n cursor: pointer;\n line-height: 1;\n transform: translateY(-2px);\n transition: background-color 100ms ease;\n}\n.dsh-side-chat-panel .dsh-side-chat-send-button:hover:not(:disabled),\n.dsh-side-chat-panel .dsh-side-chat-stop-button:hover:not(:disabled) {\n background: var(--dsw-alias-button-info-hover, #3467d6);\n}\n.dsh-side-chat-panel .dsh-side-chat-send-button:disabled,\n.dsh-side-chat-panel .dsh-side-chat-stop-button:disabled { cursor: default; opacity: .4; }\n.dsh-side-chat-footer { display: none; }\n.dsh-side-chat-announcer { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }\n\n.dsh-side-chat-selection-actions {\n position: fixed;\n z-index: 90;\n display: flex;\n max-width: calc(100vw - 16px);\n flex-wrap: wrap;\n gap: 0;\n padding: 0;\n border: 1px solid var(--dsw-border, #d8d8de);\n border-radius: 999px;\n background: var(--dsw-surface, #fff);\n box-shadow: 0 4px 14px rgb(0 0 0 / 12%);\n overflow: hidden;\n}\n.dsh-side-chat-selection-actions button {\n min-height: 36px;\n padding: 0 14px;\n border: 0;\n border-radius: 0;\n background: transparent;\n color: inherit;\n transition: background-color 120ms ease;\n}\n.dsh-side-chat-selection-actions button:hover:not(:disabled),\n.dsh-side-chat-selection-actions button:focus-visible {\n background: var(--dsw-surface-subtle, #f3f3f5);\n}\n.dsh-side-chat-selection-actions button + button {\n border-left: 1px solid var(--dsw-border, #d8d8de);\n border-radius: 0;\n}\n\n.dsh-side-chat-selection-marker {\n position: fixed;\n z-index: 91;\n display: grid;\n width: 28px;\n height: 28px;\n place-items: center;\n border: 2px solid var(--dsw-surface, #fff);\n border-radius: 999px;\n background: var(--dsw-alias-button-info, #1473e6);\n box-shadow: 0 2px 6px rgb(0 0 0 / 12%);\n color: #fff;\n font-size: 13px;\n font-weight: 600;\n line-height: 1;\n pointer-events: none;\n}\n\n.dsh-side-chat-selection-comment {\n position: fixed;\n z-index: 92;\n display: grid;\n max-width: calc(100vw - 16px);\n box-sizing: border-box;\n gap: 10px;\n padding: 12px;\n border: 1px solid var(--dsw-border, #d8d8de);\n border-radius: 20px;\n background: var(--dsw-surface, #fff);\n box-shadow: 0 5px 18px rgb(0 0 0 / 9%);\n color: var(--dsw-text, #19191d);\n}\n.dsh-side-chat-selection-comment textarea {\n width: 100%;\n min-height: 48px;\n max-height: 128px;\n box-sizing: border-box;\n resize: none;\n padding: 6px 8px;\n overflow-y: auto;\n border: 0;\n outline: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n line-height: 1.45;\n}\n.dsh-side-chat-selection-comment-actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n}\n.dsh-side-chat-selection-comment-actions button {\n min-height: 32px;\n padding: 0 14px;\n border: 1px solid var(--dsw-border, #d8d8de);\n border-radius: 999px;\n background: var(--dsw-surface, #fff);\n color: inherit;\n cursor: pointer;\n font: inherit;\n}\n.dsh-side-chat-selection-comment-actions button:hover { background: var(--dsw-surface-subtle, #f3f3f5); }\n.dsh-side-chat-selection-comment-actions .dsh-side-chat-selection-comment-save {\n border-color: transparent;\n background: var(--dsw-alias-button-info, #1473e6);\n color: #fff;\n}\n.dsh-side-chat-selection-comment-actions .dsh-side-chat-selection-comment-save:hover {\n background: var(--dsw-alias-button-info-hover, #3467d6);\n}\n\n@media (max-width: 900px) {\n .dsh-side-chat-panel {\n right: 12px;\n bottom: 12px;\n width: calc(100vw - 24px);\n max-height: calc(100dvh - 24px);\n border-radius: 24px;\n }\n}\n\n@media (max-width: 720px) {\n .dsh-side-chat-panel {\n right: 8px;\n bottom: 8px;\n width: calc(100vw - 16px);\n height: min(78dvh, 760px);\n max-height: calc(100dvh - 16px);\n border-radius: 22px;\n }\n .dsh-side-chat-transcript { padding: 14px 14px 20px; }\n .dsh-side-chat-header { padding-left: 14px; }\n .dsh-side-chat-error { margin-inline: 12px; }\n}\n\n@media (max-height: 620px) {\n .dsh-side-chat-panel {\n bottom: 8px;\n height: calc(100dvh - 16px);\n max-height: calc(100dvh - 16px);\n }\n}\n\n@media (prefers-reduced-motion: no-preference) {\n .dsh-side-chat-panel { animation: dsh-side-chat-enter 160ms ease-out; }\n @keyframes dsh-side-chat-enter { from { transform: translateY(18px) scale(.985); opacity: .7; } }\n}\n\n@media (forced-colors: active) {\n.dsh-side-chat-panel,\n.dsh-side-chat-selection-actions,\n.dsh-side-chat-selection-comment { border: 1px solid CanvasText; }\n}\n";
|
|
11
|
+
var _dsh_side_chat_css_L2hvbWUvcnVubmVyL3dvcmsvZHNoLXNpZGUtY2hhdC9kc2gtc2lkZS1jaGF0L3NyYy9jbGllbnQvcGFuZWwvc2lkZS1jaGF0LmNzcw_default = ".dsh-side-chat-overlay {\n pointer-events: none;\n}\n\n.dsh-side-chat-overlay > * {\n pointer-events: auto;\n}\n\n.dsh-side-chat-panel {\n --side-chat-border: var(--dsw-border, #d8d8de);\n --side-chat-bg: var(--dsw-surface, #ffffff);\n --side-chat-muted: var(--dsw-text-muted, #62636a);\n position: fixed;\n z-index: 70;\n right: clamp(12px, 2vw, 20px);\n bottom: clamp(12px, 2vw, 20px);\n display: flex;\n width: min(840px, calc(100vw - 32px));\n height: clamp(460px, 62dvh, 980px);\n max-height: calc(100dvh - 32px);\n min-width: 0;\n min-height: 0;\n box-sizing: border-box;\n flex-direction: column;\n overflow: hidden;\n border: 1px solid var(--side-chat-border);\n border-radius: 28px;\n background: var(--side-chat-bg);\n color: var(--dsw-text, #19191d);\n box-shadow: 0 12px 36px rgb(0 0 0 / 11%), 0 2px 8px rgb(0 0 0 / 6%);\n}\n\n.dsh-side-chat-conversation {\n display: flex;\n height: 100%;\n min-height: 0;\n flex-direction: column;\n overflow: hidden;\n}\n\n.dsh-side-chat-transcript {\n display: flex;\n min-height: 0;\n flex: 1;\n flex-direction: column;\n gap: 12px;\n overflow-x: hidden;\n overflow-y: auto;\n padding: 18px 20px 24px;\n scrollbar-color: color-mix(in srgb, var(--side-chat-muted) 34%, transparent) transparent;\n scrollbar-width: thin;\n}\n\n.dsh-side-chat-message {\n max-width: 92%;\n padding: 10px 12px;\n border: 1px solid var(--side-chat-border);\n border-radius: 12px;\n background: var(--dsw-surface-subtle, #f7f7f9);\n}\n\n.dsh-side-chat-message[data-role=\"user\"] {\n align-self: end;\n background: var(--dsw-accent-soft, #eef4ff);\n}\n\n.dsh-side-chat-message[data-role=\"assistant\"] {\n align-self: start;\n min-width: 0;\n max-width: 100%;\n border-color: transparent;\n background: transparent;\n overflow-wrap: anywhere;\n}\n.dsh-side-chat-message-role,\n.dsh-side-chat-message-note { display: block; margin-bottom: 5px; color: var(--side-chat-muted); font-size: 12px; }\n.dsh-side-chat-message-text { white-space: pre-wrap; overflow-wrap: anywhere; }\n.dsh-side-chat-message pre,\n.dsh-side-chat-turn-notice pre { overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }\n.dsh-side-chat-message[data-role=\"assistant\"] :where(table) {\n display: block;\n max-width: 100%;\n overflow-x: auto;\n}\n.dsh-side-chat-tool-branch {\n min-width: 0;\n max-width: 100%;\n flex: 0 0 auto;\n}\n.dsh-side-chat-tool {\n display: flex;\n min-width: 0;\n max-width: 100%;\n flex: 0 0 auto;\n flex-direction: column;\n border-radius: 6px;\n}\n.dsh-side-chat-tool-row {\n position: relative;\n overflow: hidden;\n}\n.dsh-side-chat-tool[data-state=\"running\"] .dsh-side-chat-tool-row::after,\n.dsh-side-chat-tool[data-state=\"pending\"] .dsh-side-chat-tool-row::after {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 300px;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n color-mix(in srgb, var(--dsw-alias-bg-base, #fff) 60%, transparent) 55%,\n transparent 100%\n );\n content: '';\n pointer-events: none;\n animation: dsh-side-chat-tool-sweep 2.6s ease-out infinite;\n}\n@keyframes dsh-side-chat-tool-sweep {\n 0% { left: -300px; }\n 90%, 100% { left: 100%; }\n}\n.dsh-side-chat-tool-row:focus-visible {\n border-radius: 4px;\n outline: 2px solid color-mix(in srgb, var(--dsw-alias-button-info, #1473e6) 42%, transparent);\n outline-offset: 1px;\n}\n.dsh-side-chat-tool-leading { flex-shrink: 0; }\n.dsh-side-chat-tool-chevron { color: var(--dsw-alias-label-secondary, var(--side-chat-muted)); }\n.dsh-side-chat-tool-title { font-weight: 400; }\n.dsh-side-chat-tool-separator {\n width: 2px;\n height: 2px;\n flex: none;\n margin: 0 8px;\n border-radius: 1px;\n background: var(--dsw-alias-label-caption, #a1a1aa);\n}\n.dsh-side-chat-tool-summary {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n color: var(--dsw-alias-label-tertiary, var(--side-chat-muted));\n font-size: 14px;\n line-height: 24px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.dsh-side-chat-tool-error-summary { color: var(--dsw-alias-state-error-primary, var(--dsw-danger, #b42318)); }\n.dsh-side-chat-tool-body-wrap {\n display: flex;\n min-width: 0;\n flex-direction: column;\n}\n.dsh-side-chat-tool-code,\n.dsh-side-chat-tool-diff,\n.dsh-side-chat-tool-read,\n.dsh-side-chat-tool-search,\n.dsh-side-chat-tool-terminal,\n.dsh-side-chat-tool-web {\n margin: 4px 0 4px 4px;\n}\n.dsh-side-chat-tool-code { --dsl-code-block-content-font: var(--dsw-font-markdown-code-block-small); }\n.dsh-side-chat-tool-terminal {\n --dsl-terminal-font: var(--dsw-font-markdown-code-block-small);\n --dsl-terminal-line-height: 18px;\n --dsl-terminal-output-max-height: 224px;\n border: 1px solid var(--dsw-alias-border-l1, var(--side-chat-border));\n}\n.dsh-side-chat-tool-io-card {\n display: flex;\n flex-direction: column;\n margin: 4px 0 4px 4px;\n border: 1px solid var(--dsw-alias-border-l1, var(--side-chat-border));\n border-radius: 12px;\n background: var(--dsw-alias-markdown-code-block, #f6f6f7);\n font: var(--dsw-font-markdown-code-block-small, 12px/18px ui-monospace, SFMono-Regular, Consolas, monospace);\n}\n.dsh-side-chat-tool-io-section {\n display: grid;\n max-height: 150px;\n grid-template-columns: max-content minmax(0, 1fr);\n column-gap: 14px;\n align-items: baseline;\n overflow-y: auto;\n padding: 12px 16px;\n}\n.dsh-side-chat-tool-io-divider {\n height: 1px;\n flex: none;\n background: var(--dsw-alias-border-l2, var(--side-chat-border));\n}\n.dsh-side-chat-tool-io-label {\n position: sticky;\n top: 0;\n align-self: start;\n color: var(--dsw-alias-label-caption, #8d8d95);\n}\n.dsh-side-chat-tool-io-text {\n min-width: 0;\n white-space: pre-wrap;\n word-break: break-word;\n color: var(--dsw-alias-label-secondary, #4b4b52);\n}\n.dsh-side-chat-tool-io-text[data-error] { color: var(--dsw-alias-state-error-primary, var(--dsw-danger, #b42318)); }\n.dsh-side-chat-tool-subcalls {\n display: flex;\n flex-direction: column;\n gap: 4px;\n margin: 4px 0 2px 22px;\n padding-left: 8px;\n border-left: 1px solid var(--dsw-alias-border-l2, var(--side-chat-border));\n}\n.dsh-side-chat-tool-visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n}\n.dsh-side-chat-turn-notice,\n.dsh-side-chat-interaction,\n.dsh-side-chat-queue { padding: 10px; border: 1px solid var(--side-chat-border); border-radius: 10px; }\n.dsh-side-chat-interaction fieldset { margin: 8px 0; border: 1px solid var(--side-chat-border); border-radius: 8px; }\n.dsh-side-chat-question-option { display: flex; gap: 8px; margin: 8px 0; }\n.dsh-side-chat-interaction textarea { width: 100%; box-sizing: border-box; resize: vertical; }\n.dsh-side-chat-interaction-actions,\n.dsh-side-chat-composer > div,\n.dsh-side-chat-queue > div { display: flex; justify-content: end; gap: 8px; }\n.dsh-side-chat-interaction button,\n.dsh-side-chat-composer button,\n.dsh-side-chat-queue button { min-height: 32px; border: 1px solid var(--side-chat-border); border-radius: 7px; background: var(--dsw-control, #f7f7f9); color: inherit; cursor: pointer; }\n.dsh-side-chat-composer {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n gap: 8px;\n align-items: end;\n margin: 0 12px 12px;\n padding: 8px 8px 8px 12px;\n border: 1px solid var(--side-chat-border);\n border-radius: 24px;\n background: var(--side-chat-bg);\n box-shadow: 0 2px 8px rgb(0 0 0 / 5%);\n}\n.dsh-side-chat-composer textarea {\n width: 100%;\n height: auto;\n min-height: 24px;\n max-height: 160px;\n box-sizing: border-box;\n resize: none;\n overflow-y: hidden;\n padding: 6px;\n border: 0;\n outline: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n line-height: 1.5;\n}\n.dsh-side-chat-composer button { align-self: end; }\n.dsh-side-chat-loading { display: grid; height: 100%; place-items: center; color: var(--side-chat-muted); }\n\n.dsh-side-chat-header {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n gap: 8px 12px;\n align-items: center;\n flex: 0 0 auto;\n min-height: 46px;\n box-sizing: border-box;\n padding: 5px 10px 5px 16px;\n border-bottom: 1px solid var(--side-chat-border);\n background: var(--side-chat-bg);\n}\n\n.dsh-side-chat-heading { display: flex; min-width: 0; flex-direction: column; }\n.dsh-side-chat-heading strong { font-size: 14px; font-weight: 600; }\n.dsh-side-chat-footer { color: var(--side-chat-muted); font-size: 12px; }\n.dsh-side-chat-header button,\n.dsh-side-chat-inline-actions button,\n.dsh-side-chat-draft button,\n.dsh-side-chat-error button,\n.dsh-side-chat-selection-actions button {\n min-height: 32px;\n border: 1px solid var(--side-chat-border);\n border-radius: 7px;\n background: var(--dsw-control, #f7f7f9);\n color: inherit;\n cursor: pointer;\n}\n.dsh-side-chat-header button:disabled { cursor: not-allowed; opacity: .55; }\n.dsh-side-chat-header .dsh-side-chat-heading {\n align-items: flex-start;\n min-height: 0;\n padding: 4px 0;\n border: 0;\n background: transparent;\n text-align: left;\n}\n.dsh-side-chat-header > button:last-child {\n width: 32px;\n min-height: 32px;\n padding: 0;\n border: 0;\n border-radius: 999px;\n background: transparent;\n font-size: 20px;\n line-height: 1;\n}\n.dsh-side-chat-header > button:last-child:hover { background: var(--dsw-surface-subtle, #f3f3f5); }\n\n.dsh-side-chat-quote { position: relative; max-width: 100%; align-self: flex-start; }\n.dsh-side-chat-quote-chip {\n display: inline-flex;\n min-height: 36px;\n align-items: center;\n overflow: hidden;\n padding: 0;\n border: 1px solid var(--side-chat-border);\n border-radius: 999px;\n background: var(--side-chat-bg);\n transition: background-color 120ms ease;\n}\n.dsh-side-chat-quote:hover .dsh-side-chat-quote-chip,\n.dsh-side-chat-quote:focus-within .dsh-side-chat-quote-chip,\n.dsh-side-chat-quote[data-expanded] .dsh-side-chat-quote-chip { background: var(--dsw-surface-subtle, #f3f3f5); }\n.dsh-side-chat-quote-chip .dsh-side-chat-quote-trigger {\n display: inline-flex;\n min-height: 34px;\n align-items: center;\n gap: 8px;\n padding: 0 11px;\n border: 0;\n border-radius: 0;\n background: transparent;\n color: inherit;\n cursor: pointer;\n font: inherit;\n}\n.dsh-side-chat-quote-trigger strong { font-size: 13px; font-weight: 500; line-height: 1; }\n.dsh-side-chat-quote-icon {\n width: 16px;\n height: 16px;\n flex: 0 0 auto;\n color: var(--side-chat-muted);\n fill: none;\n stroke: currentColor;\n stroke-linecap: round;\n stroke-linejoin: round;\n stroke-width: 1.7;\n}\n.dsh-side-chat-quote-chip .dsh-side-chat-quote-remove {\n display: grid;\n width: 0;\n height: 34px;\n min-height: 34px;\n box-sizing: border-box;\n flex: 0 0 auto;\n place-items: center;\n overflow: hidden;\n padding: 0;\n border: 0;\n border-radius: 0;\n background: transparent;\n color: var(--side-chat-muted);\n cursor: pointer;\n font: inherit;\n font-size: 18px;\n line-height: 1;\n opacity: 0;\n pointer-events: none;\n transition: width 120ms ease, margin-left 120ms ease, opacity 100ms ease, background-color 100ms ease;\n}\n.dsh-side-chat-quote:hover .dsh-side-chat-quote-remove,\n.dsh-side-chat-quote:focus-within .dsh-side-chat-quote-remove {\n width: 30px;\n opacity: 1;\n pointer-events: auto;\n}\n.dsh-side-chat-quote-remove:hover { background: rgb(0 0 0 / 6%); color: inherit; }\n.dsh-side-chat-quote-details {\n position: absolute;\n z-index: 10;\n bottom: calc(100% + 8px);\n left: 0;\n width: min(520px, calc(100vw - 64px));\n max-width: calc(100vw - 48px);\n box-sizing: border-box;\n padding: 14px 16px;\n border: 1px solid var(--side-chat-border);\n border-radius: 16px;\n background: var(--side-chat-bg);\n box-shadow: 0 4px 14px rgb(0 0 0 / 8%);\n font-size: 14px;\n line-height: 1.45;\n opacity: 0;\n pointer-events: none;\n transform: translate(var(--dsh-side-chat-quote-offset-x, 0px), 4px);\n visibility: hidden;\n transition: opacity 100ms ease, transform 120ms ease, visibility 100ms ease;\n}\n.dsh-side-chat-quote-details::before {\n content: '';\n position: absolute;\n right: 0;\n bottom: -8px;\n left: 0;\n height: 8px;\n}\n.dsh-side-chat-quote[data-hovered] .dsh-side-chat-quote-details,\n.dsh-side-chat-quote[data-expanded] .dsh-side-chat-quote-details {\n opacity: 1;\n pointer-events: auto;\n transform: translate(var(--dsh-side-chat-quote-offset-x, 0px), 0);\n visibility: visible;\n}\n.dsh-side-chat-annotated-user-message .dsh-side-chat-quote-details {\n top: calc(100% + 8px);\n right: 0;\n bottom: auto;\n left: auto;\n}\n.dsh-side-chat-annotated-user-message .dsh-side-chat-quote-details::before {\n top: -8px;\n bottom: auto;\n}\n.dsh-side-chat-quote-details-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }\n.dsh-side-chat-quote-details-header strong { color: var(--side-chat-muted); font-size: 13px; font-weight: 500; }\n.dsh-side-chat-quote-detail + .dsh-side-chat-quote-detail {\n margin-top: 12px;\n padding-top: 12px;\n border-top: 1px solid var(--side-chat-border);\n}\n.dsh-side-chat-quote pre {\n max-height: 180px;\n margin: 4px 0 0;\n overflow: auto;\n white-space: pre-wrap;\n font: inherit;\n}\n.dsh-side-chat-quote-comment {\n margin-top: 9px;\n}\n.dsh-side-chat-quote-comment > strong { color: var(--side-chat-muted); font-size: 13px; font-weight: 500; }\n.dsh-side-chat-quote-comment > pre { margin-top: 4px; }\n.dsh-side-chat-error { margin: 10px 16px 0; padding: 10px 12px; border: 1px solid var(--side-chat-border); border-radius: 14px; background: var(--dsw-surface-subtle, #f7f7f9); }\n.dsh-side-chat-error { border-color: var(--dsw-danger, #b42318); }\n.dsh-side-chat-body { min-height: 0; flex: 1; overflow: hidden; }\n.dsh-side-chat-annotated-user-message {\n display: flex;\n max-width: 92%;\n align-self: end;\n align-items: flex-start;\n flex-direction: column;\n gap: 8px;\n}\n.dsh-side-chat-annotated-user-message .dsh-side-chat-message { max-width: 100%; align-self: stretch; }\n\n/* The DSH occurrence remains the durable serialization carrier, while this\n plugin-owned capsule supplies the visible and interactive projection. */\n[data-composer-seat] [data-decoration=\"chip\"][title=\"__dsh_side_chat_annotations__\"] {\n visibility: hidden;\n}\n.dsh-side-chat-parent-annotation-dock,\n.dsh-side-chat-parent-user-message {\n --side-chat-border: var(--dsw-border, #d8d8de);\n --side-chat-bg: var(--dsw-surface, #ffffff);\n --side-chat-muted: var(--dsw-text-muted, #62636a);\n color: var(--dsw-text, #19191d);\n}\n.dsh-side-chat-parent-annotation-dock {\n position: relative;\n z-index: 20;\n width: calc(100% - 32px);\n max-width: var(--dsh-composer-card-max-width, 780px);\n height: 0;\n /* The terminal zero-height dock would otherwise add a second gap between\n Todo/Goal/Queue and the input card. Its child still lands 10px inside the\n following card: -gap + top:16px against the card's own 6px gap. */\n margin: calc(0px - var(--dsh-composer-stack-gap, 6px)) auto 0;\n pointer-events: none;\n}\n.dsh-side-chat-parent-annotation-dock > .dsh-side-chat-quote {\n position: absolute;\n top: 16px;\n left: 16px;\n pointer-events: auto;\n}\n.dsh-side-chat-parent-user-message {\n display: flex;\n width: 100%;\n min-width: 0;\n flex-direction: column;\n align-items: stretch;\n gap: 8px;\n}\n.dsh-side-chat-parent-user-message > .dsh-side-chat-quote { align-self: flex-end; }\n/* rc.6 caps its inner user stack at 82%; give that percentage the full chat\n column as its containing width instead of the annotation chip's shrink width. */\n.dsh-side-chat-parent-user-message-body { width: 100%; min-width: 0; }\n.dsh-side-chat-parent-user-message > .dsh-side-chat-quote .dsh-side-chat-quote-details {\n right: 0;\n left: auto;\n}\n.dsh-side-chat-draft {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n min-height: 0;\n flex: 0 0 auto;\n gap: 8px;\n align-items: end;\n margin: auto 12px 12px;\n padding: 12px;\n border: 1px solid var(--side-chat-border);\n border-radius: 24px;\n background: var(--side-chat-bg);\n box-shadow: 0 2px 8px rgb(0 0 0 / 5%);\n}\n.dsh-side-chat-draft > .dsh-side-chat-quote { grid-column: 1 / -1; }\n.dsh-side-chat-draft label {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n}\n.dsh-side-chat-draft textarea {\n width: 100%;\n height: auto;\n min-height: 24px;\n max-height: 160px;\n box-sizing: border-box;\n resize: none;\n overflow-y: hidden;\n padding: 6px 2px;\n border: 0;\n outline: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n line-height: 1.5;\n}\n.dsh-side-chat-draft > button { align-self: end; }\n.dsh-side-chat-panel .dsh-side-chat-send-button,\n.dsh-side-chat-panel .dsh-side-chat-stop-button {\n display: grid;\n width: 34px;\n height: 34px;\n min-height: 34px;\n flex: none;\n place-items: center;\n padding: 1px 6px;\n border: 0;\n border-radius: 999px;\n background: var(--dsw-alias-button-info-fill, #4176e6);\n color: #fff;\n cursor: pointer;\n line-height: 1;\n transform: translateY(-2px);\n transition: background-color 100ms ease;\n}\n.dsh-side-chat-panel .dsh-side-chat-send-button:hover:not(:disabled),\n.dsh-side-chat-panel .dsh-side-chat-stop-button:hover:not(:disabled) {\n background: var(--dsw-alias-button-info-hover, #3467d6);\n}\n.dsh-side-chat-panel .dsh-side-chat-send-button:disabled,\n.dsh-side-chat-panel .dsh-side-chat-stop-button:disabled { cursor: default; opacity: .4; }\n.dsh-side-chat-footer { display: none; }\n.dsh-side-chat-announcer { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }\n\n.dsh-side-chat-selection-actions {\n position: fixed;\n z-index: 90;\n display: flex;\n max-width: calc(100vw - 16px);\n flex-wrap: wrap;\n gap: 0;\n padding: 0;\n border: 1px solid var(--dsw-border, #d8d8de);\n border-radius: 999px;\n background: var(--dsw-surface, #fff);\n box-shadow: 0 4px 14px rgb(0 0 0 / 12%);\n overflow: hidden;\n}\n.dsh-side-chat-selection-actions button {\n min-height: 36px;\n padding: 0 14px;\n border: 0;\n border-radius: 0;\n background: transparent;\n color: inherit;\n transition: background-color 120ms ease;\n}\n.dsh-side-chat-selection-actions button:hover:not(:disabled),\n.dsh-side-chat-selection-actions button:focus-visible {\n background: var(--dsw-surface-subtle, #f3f3f5);\n}\n.dsh-side-chat-selection-actions button + button {\n border-left: 1px solid var(--dsw-border, #d8d8de);\n border-radius: 0;\n}\n\n::highlight(dsh-side-chat-annotations) {\n background: color-mix(in srgb, var(--dsw-alias-button-info, #1473e6) 18%, transparent);\n}\n::highlight(dsh-side-chat-active-annotation) {\n background: color-mix(in srgb, var(--dsw-alias-button-info, #1473e6) 32%, transparent);\n text-decoration: underline;\n text-decoration-color: color-mix(in srgb, var(--dsw-alias-button-info, #1473e6) 70%, transparent);\n text-decoration-thickness: 1px;\n}\n\n.dsh-side-chat-annotation-marker,\n.dsh-side-chat-selection-marker {\n position: fixed;\n z-index: 91;\n display: grid;\n width: 22px;\n height: 22px;\n min-height: 22px;\n box-sizing: border-box;\n place-items: center;\n padding: 0;\n border: 0;\n border-radius: 999px;\n background: var(--dsw-alias-button-info, #1473e6);\n box-shadow: 0 2px 6px rgb(0 0 0 / 14%);\n color: #fff;\n font: inherit;\n font-size: 11px;\n font-weight: 600;\n line-height: 1;\n}\n.dsh-side-chat-annotation-marker { cursor: pointer; }\n.dsh-side-chat-selection-marker { pointer-events: none; }\n.dsh-side-chat-annotation-marker[data-large],\n.dsh-side-chat-selection-marker[data-large] { font-size: 9px; }\n.dsh-side-chat-annotation-marker[data-active] {\n background: var(--dsw-alias-button-info-hover, #3467d6);\n}\n.dsh-side-chat-annotation-marker:focus-visible {\n outline: 2px solid color-mix(in srgb, var(--dsw-alias-button-info, #1473e6) 32%, transparent);\n outline-offset: 1px;\n}\n\n.dsh-side-chat-selection-comment {\n position: fixed;\n z-index: 92;\n display: grid;\n max-width: calc(100vw - 16px);\n box-sizing: border-box;\n gap: 10px;\n padding: 12px;\n border: 1px solid var(--dsw-border, #d8d8de);\n border-radius: 20px;\n background: var(--dsw-surface, #fff);\n box-shadow: 0 5px 18px rgb(0 0 0 / 9%);\n color: var(--dsw-text, #19191d);\n}\n.dsh-side-chat-selection-comment textarea {\n width: 100%;\n min-height: 48px;\n max-height: 128px;\n box-sizing: border-box;\n resize: none;\n padding: 6px 8px;\n overflow-y: auto;\n border: 0;\n outline: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n line-height: 1.45;\n}\n.dsh-side-chat-selection-comment-actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n}\n.dsh-side-chat-selection-comment-actions button {\n min-height: 32px;\n padding: 0 14px;\n border: 1px solid var(--dsw-border, #d8d8de);\n border-radius: 999px;\n background: var(--dsw-surface, #fff);\n color: inherit;\n cursor: pointer;\n font: inherit;\n}\n.dsh-side-chat-selection-comment-actions button:hover { background: var(--dsw-surface-subtle, #f3f3f5); }\n.dsh-side-chat-selection-comment-actions .dsh-side-chat-selection-comment-save {\n border-color: transparent;\n background: var(--dsw-alias-button-info, #1473e6);\n color: #fff;\n}\n.dsh-side-chat-selection-comment-actions .dsh-side-chat-selection-comment-save:hover {\n background: var(--dsw-alias-button-info-hover, #3467d6);\n}\n\n@media (max-width: 900px) {\n .dsh-side-chat-panel {\n right: 12px;\n bottom: 12px;\n width: calc(100vw - 24px);\n max-height: calc(100dvh - 24px);\n border-radius: 24px;\n }\n}\n\n@media (max-width: 720px) {\n .dsh-side-chat-panel {\n right: 8px;\n bottom: 8px;\n width: calc(100vw - 16px);\n height: min(78dvh, 760px);\n max-height: calc(100dvh - 16px);\n border-radius: 22px;\n }\n .dsh-side-chat-transcript { padding: 14px 14px 20px; }\n .dsh-side-chat-header { padding-left: 14px; }\n .dsh-side-chat-error { margin-inline: 12px; }\n}\n\n@media (max-height: 620px) {\n .dsh-side-chat-panel {\n bottom: 8px;\n height: calc(100dvh - 16px);\n max-height: calc(100dvh - 16px);\n }\n}\n\n@media (prefers-reduced-motion: no-preference) {\n .dsh-side-chat-panel { animation: dsh-side-chat-enter 160ms ease-out; }\n @keyframes dsh-side-chat-enter { from { transform: translateY(18px) scale(.985); opacity: .7; } }\n}\n\n@media (forced-colors: active) {\n.dsh-side-chat-panel,\n.dsh-side-chat-selection-actions,\n.dsh-side-chat-selection-comment,\n.dsh-side-chat-annotation-marker { border: 1px solid CanvasText; }\n}\n";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/client/parent-composer/add-to-conversation.ts
|
|
14
14
|
const SELECTION_REFERENCE_SOURCE = "dsh-side-chat-selection";
|
|
@@ -20,25 +20,61 @@ window.__ModuleLoader__.load({
|
|
|
20
20
|
const trimmedComment = comment?.trim();
|
|
21
21
|
return {
|
|
22
22
|
text: selection.text,
|
|
23
|
+
selection,
|
|
23
24
|
...trimmedComment === void 0 || trimmedComment.length === 0 ? {} : { comment: trimmedComment }
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
27
|
function encodeSelectionReference(annotations) {
|
|
27
28
|
return JSON.stringify({
|
|
28
|
-
version:
|
|
29
|
+
version: 2,
|
|
29
30
|
annotations
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
+
function isSelection(value) {
|
|
34
|
+
if (typeof value !== "object" || value === null) return false;
|
|
35
|
+
const selection = value;
|
|
36
|
+
if (typeof selection.parentSessionId !== "string" || typeof selection.text !== "string" || !Number.isSafeInteger(selection.atSeq) || !Array.isArray(selection.fragments) || typeof selection.rect !== "object" || selection.rect === null) return false;
|
|
37
|
+
const rect = selection.rect;
|
|
38
|
+
if (![
|
|
39
|
+
rect.x,
|
|
40
|
+
rect.y,
|
|
41
|
+
rect.width,
|
|
42
|
+
rect.height,
|
|
43
|
+
rect.viewportWidth,
|
|
44
|
+
rect.viewportHeight
|
|
45
|
+
].every((number) => typeof number === "number" && Number.isFinite(number))) return false;
|
|
46
|
+
return selection.fragments.every((candidate) => {
|
|
47
|
+
if (typeof candidate !== "object" || candidate === null) return false;
|
|
48
|
+
const fragment = candidate;
|
|
49
|
+
return typeof fragment.nodeKey === "string" && typeof fragment.nodeKind === "string" && typeof fragment.turnKey === "string" && Number.isSafeInteger(fragment.seq) && Number.isSafeInteger(fragment.startOffset) && Number.isSafeInteger(fragment.endOffset) && typeof fragment.text === "string" && [
|
|
50
|
+
"user",
|
|
51
|
+
"assistant",
|
|
52
|
+
"context",
|
|
53
|
+
"code"
|
|
54
|
+
].includes(fragment.source ?? "") && typeof fragment.modelVisible === "boolean" && typeof fragment.settled === "boolean";
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function isStoredAnnotation(value) {
|
|
33
58
|
if (typeof value !== "object" || value === null) return false;
|
|
34
59
|
const annotation = value;
|
|
35
|
-
return typeof annotation.text === "string" && (annotation.comment === void 0 || typeof annotation.comment === "string");
|
|
60
|
+
return typeof annotation.text === "string" && (annotation.comment === void 0 || typeof annotation.comment === "string") && (annotation.selection === void 0 || isSelection(annotation.selection));
|
|
36
61
|
}
|
|
37
|
-
function
|
|
62
|
+
function visibleAnnotation(annotation) {
|
|
63
|
+
return {
|
|
64
|
+
text: annotation.text,
|
|
65
|
+
...annotation.comment === void 0 ? {} : { comment: annotation.comment }
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function decodeStoredSelectionReference(ref) {
|
|
38
69
|
const value = JSON.parse(ref);
|
|
39
|
-
if (
|
|
40
|
-
if (value
|
|
41
|
-
|
|
70
|
+
if (isStoredAnnotation(value)) return [value];
|
|
71
|
+
if (typeof value !== "object" || value === null) throw new Error("The selected conversation annotation is no longer valid.");
|
|
72
|
+
const payload = value;
|
|
73
|
+
if (payload.version !== 1 && payload.version !== 2 || !Array.isArray(payload.annotations) || payload.annotations.length === 0 || !payload.annotations.every(isStoredAnnotation)) throw new Error("The selected conversation annotation is no longer valid.");
|
|
74
|
+
return payload.annotations;
|
|
75
|
+
}
|
|
76
|
+
function decodeSelectionReference(ref) {
|
|
77
|
+
return decodeStoredSelectionReference(ref).map(visibleAnnotation);
|
|
42
78
|
}
|
|
43
79
|
function selectedContext(annotations) {
|
|
44
80
|
return [
|
|
@@ -63,16 +99,32 @@ window.__ModuleLoader__.load({
|
|
|
63
99
|
function selectionOccurrences(snapshot) {
|
|
64
100
|
return snapshot.occurrences.filter((occurrence) => occurrence.source === SELECTION_REFERENCE_SOURCE);
|
|
65
101
|
}
|
|
66
|
-
|
|
67
|
-
function conversationAnnotations(snapshot) {
|
|
102
|
+
function storedConversationAnnotations(snapshot) {
|
|
68
103
|
return selectionOccurrences(snapshot).flatMap((occurrence) => {
|
|
69
104
|
try {
|
|
70
|
-
return [...
|
|
105
|
+
return [...decodeStoredSelectionReference(occurrence.ref)];
|
|
71
106
|
} catch {
|
|
72
107
|
return [];
|
|
73
108
|
}
|
|
74
109
|
});
|
|
75
110
|
}
|
|
111
|
+
/** Read all plugin annotations represented by the current DSH input occurrence. */
|
|
112
|
+
function conversationAnnotations(snapshot) {
|
|
113
|
+
return storedConversationAnnotations(snapshot).map(visibleAnnotation);
|
|
114
|
+
}
|
|
115
|
+
/** Read annotations that retain an exact source-selection anchor. */
|
|
116
|
+
function conversationSelectionAnnotations(snapshot) {
|
|
117
|
+
const anchored = [];
|
|
118
|
+
storedConversationAnnotations(snapshot).forEach((annotation, annotationIndex) => {
|
|
119
|
+
if (annotation.selection === void 0) return;
|
|
120
|
+
anchored.push({
|
|
121
|
+
...visibleAnnotation(annotation),
|
|
122
|
+
annotationIndex,
|
|
123
|
+
selection: annotation.selection
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
return anchored;
|
|
127
|
+
}
|
|
76
128
|
function draftWithoutSelectionOccurrences(snapshot) {
|
|
77
129
|
const occurrences = [...selectionOccurrences(snapshot)].sort((a, b) => b.offset - a.offset);
|
|
78
130
|
let draft = snapshot.draft;
|
|
@@ -105,10 +157,7 @@ window.__ModuleLoader__.load({
|
|
|
105
157
|
}
|
|
106
158
|
}
|
|
107
159
|
};
|
|
108
|
-
|
|
109
|
-
function addSelectionToConversation(input, selection, comment) {
|
|
110
|
-
const before = input.state.getSnapshot();
|
|
111
|
-
const annotations = [...conversationAnnotations(before), annotationFromSelection(selection, comment)];
|
|
160
|
+
function writeConversationAnnotations(input, before, annotations) {
|
|
112
161
|
const draft = draftWithoutSelectionOccurrences(before);
|
|
113
162
|
if (selectionOccurrences(before).length > 0) input.setDraft(draft);
|
|
114
163
|
const insertionState = input.state.getSnapshot();
|
|
@@ -125,6 +174,61 @@ window.__ModuleLoader__.load({
|
|
|
125
174
|
input.setDraft(`${OBJECT_REPLACEMENT_CHARACTER}\n\n${draft}`);
|
|
126
175
|
return true;
|
|
127
176
|
}
|
|
177
|
+
/** Add one passage to the parent composer's aggregated annotation occurrence. */
|
|
178
|
+
function addSelectionToConversation(input, selection, comment) {
|
|
179
|
+
const before = input.state.getSnapshot();
|
|
180
|
+
return writeConversationAnnotations(input, before, [...storedConversationAnnotations(before), annotationFromSelection(selection, comment)]);
|
|
181
|
+
}
|
|
182
|
+
/** Replace the optional comment on one unsent selected-passage annotation. */
|
|
183
|
+
function updateConversationAnnotation(input, annotationIndex, comment) {
|
|
184
|
+
const before = input.state.getSnapshot();
|
|
185
|
+
const annotations = [...storedConversationAnnotations(before)];
|
|
186
|
+
const current = annotations[annotationIndex];
|
|
187
|
+
if (!Number.isSafeInteger(annotationIndex) || current === void 0) return false;
|
|
188
|
+
const trimmedComment = comment?.trim();
|
|
189
|
+
annotations[annotationIndex] = {
|
|
190
|
+
text: current.text,
|
|
191
|
+
...current.selection === void 0 ? {} : { selection: current.selection },
|
|
192
|
+
...trimmedComment === void 0 || trimmedComment.length === 0 ? {} : { comment: trimmedComment }
|
|
193
|
+
};
|
|
194
|
+
return writeConversationAnnotations(input, before, annotations);
|
|
195
|
+
}
|
|
196
|
+
/** Return the valid aggregated reference currently occupying the leading draft slot. */
|
|
197
|
+
function conversationAnnotationReference(snapshot) {
|
|
198
|
+
const occurrence = selectionOccurrences(snapshot).find((candidate) => candidate.offset === 0);
|
|
199
|
+
if (occurrence === void 0 || !snapshot.draft.startsWith(OBJECT_REPLACEMENT_CHARACTER)) return;
|
|
200
|
+
try {
|
|
201
|
+
decodeStoredSelectionReference(occurrence.ref);
|
|
202
|
+
return occurrence.ref;
|
|
203
|
+
} catch {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function draftWithoutOrphanedAnnotationPrefix(snapshot) {
|
|
208
|
+
const prefix = `${OBJECT_REPLACEMENT_CHARACTER}\n\n`;
|
|
209
|
+
if (!snapshot.draft.startsWith(prefix) || snapshot.occurrences.some((occurrence) => occurrence.offset === 0)) return;
|
|
210
|
+
return snapshot.draft.slice(prefix.length);
|
|
211
|
+
}
|
|
212
|
+
/** Remove the plugin-owned prefix when rc.6 restored its draft without occurrences. */
|
|
213
|
+
function removeOrphanedConversationAnnotationPlaceholder(input) {
|
|
214
|
+
const draft = draftWithoutOrphanedAnnotationPrefix(input.state.getSnapshot());
|
|
215
|
+
if (draft === void 0) return false;
|
|
216
|
+
input.setDraft(draft);
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
/** Rehydrate a lost rc.6 occurrence only over the exact plugin-owned orphan prefix. */
|
|
220
|
+
function restoreConversationAnnotationReference(input, ref) {
|
|
221
|
+
let annotations;
|
|
222
|
+
try {
|
|
223
|
+
annotations = decodeStoredSelectionReference(ref);
|
|
224
|
+
} catch {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
const draft = draftWithoutOrphanedAnnotationPrefix(input.state.getSnapshot());
|
|
228
|
+
if (draft === void 0) return false;
|
|
229
|
+
input.setDraft(draft);
|
|
230
|
+
return writeConversationAnnotations(input, input.state.getSnapshot(), annotations);
|
|
231
|
+
}
|
|
128
232
|
function unescapeXmlText(value) {
|
|
129
233
|
return value.replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
130
234
|
}
|
|
@@ -248,6 +352,22 @@ window.__ModuleLoader__.load({
|
|
|
248
352
|
(0, react.useEffect)(() => () => {
|
|
249
353
|
if (leaveTimerRef.current !== void 0) window.clearTimeout(leaveTimerRef.current);
|
|
250
354
|
}, []);
|
|
355
|
+
(0, react.useEffect)(() => {
|
|
356
|
+
if (!expanded) return;
|
|
357
|
+
const dismissOutside = (event) => {
|
|
358
|
+
const quote = quoteRef.current;
|
|
359
|
+
const target = event.target;
|
|
360
|
+
if (quote !== null && target instanceof Node && quote.contains(target)) return;
|
|
361
|
+
if (leaveTimerRef.current !== void 0) window.clearTimeout(leaveTimerRef.current);
|
|
362
|
+
leaveTimerRef.current = void 0;
|
|
363
|
+
setHovered(false);
|
|
364
|
+
setExpanded(false);
|
|
365
|
+
};
|
|
366
|
+
document.addEventListener("mousedown", dismissOutside, true);
|
|
367
|
+
return () => {
|
|
368
|
+
document.removeEventListener("mousedown", dismissOutside, true);
|
|
369
|
+
};
|
|
370
|
+
}, [expanded]);
|
|
251
371
|
const constrainDetailsToBoundary = () => {
|
|
252
372
|
const details = detailsRef.current;
|
|
253
373
|
const boundary = quoteRef.current?.closest(".dsh-side-chat-panel, [data-composer-seat], [data-chat-flow-kind]");
|
|
@@ -280,6 +400,11 @@ window.__ModuleLoader__.load({
|
|
|
280
400
|
"aria-expanded": expanded,
|
|
281
401
|
"aria-label": `${expanded ? messages.collapse : messages.expand}: ${messages.selectedPassage}`,
|
|
282
402
|
onClick: () => {
|
|
403
|
+
if (expanded) {
|
|
404
|
+
if (leaveTimerRef.current !== void 0) window.clearTimeout(leaveTimerRef.current);
|
|
405
|
+
leaveTimerRef.current = void 0;
|
|
406
|
+
setHovered(false);
|
|
407
|
+
}
|
|
283
408
|
setExpanded((value) => !value);
|
|
284
409
|
},
|
|
285
410
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
@@ -339,7 +464,7 @@ window.__ModuleLoader__.load({
|
|
|
339
464
|
})
|
|
340
465
|
});
|
|
341
466
|
}
|
|
342
|
-
function contentText$
|
|
467
|
+
function contentText$2(content) {
|
|
343
468
|
return content.map((block) => {
|
|
344
469
|
if (typeof block !== "object" || block === null) return "";
|
|
345
470
|
const value = block;
|
|
@@ -370,7 +495,7 @@ window.__ModuleLoader__.load({
|
|
|
370
495
|
/** Wrap DSH's own user renderer only when this plugin's durable prefix exists. */
|
|
371
496
|
function annotatedUserMessageRenderer(Original) {
|
|
372
497
|
return function AnnotatedUserMessageRenderer(props) {
|
|
373
|
-
const parsed = parseAnnotatedConversationPrompt(contentText$
|
|
498
|
+
const parsed = parseAnnotatedConversationPrompt(contentText$2(props.node.data.content));
|
|
374
499
|
if (parsed === void 0) return (0, react.createElement)(Original, props);
|
|
375
500
|
const node = {
|
|
376
501
|
...props.node,
|
|
@@ -384,9 +509,12 @@ window.__ModuleLoader__.load({
|
|
|
384
509
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectionQuote, {
|
|
385
510
|
selections: parsed.annotations,
|
|
386
511
|
messages: SIDE_CHAT_MESSAGES[currentLocale()]
|
|
387
|
-
}), (0,
|
|
388
|
-
|
|
389
|
-
|
|
512
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
513
|
+
className: "dsh-side-chat-parent-user-message-body",
|
|
514
|
+
children: (0, react.createElement)(Original, {
|
|
515
|
+
...props,
|
|
516
|
+
node
|
|
517
|
+
})
|
|
390
518
|
})]
|
|
391
519
|
});
|
|
392
520
|
};
|
|
@@ -397,7 +525,7 @@ window.__ModuleLoader__.load({
|
|
|
397
525
|
const removeDock = slots.inject("conversation.input.dock", () => slots.register({
|
|
398
526
|
name: "conversation.input.dock",
|
|
399
527
|
id: "dsh-side-chat-annotations",
|
|
400
|
-
order:
|
|
528
|
+
order: 30
|
|
401
529
|
}, ({ input }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParentComposerAnnotations, {
|
|
402
530
|
input,
|
|
403
531
|
onRemove: removeAnnotations
|
|
@@ -5445,14 +5573,280 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5445
5573
|
}
|
|
5446
5574
|
});
|
|
5447
5575
|
}
|
|
5576
|
+
function anchorByKey(root, nodeKey) {
|
|
5577
|
+
return [...root.querySelectorAll("[data-chat-anchor-key]")].find((anchor) => anchor.dataset["chatAnchorKey"] === nodeKey);
|
|
5578
|
+
}
|
|
5579
|
+
function restoreFragmentRanges(root, fragment) {
|
|
5580
|
+
const anchor = anchorByKey(root, fragment.nodeKey);
|
|
5581
|
+
if (anchor === void 0) return;
|
|
5582
|
+
const nodes = acceptedTextNodes(anchor, root);
|
|
5583
|
+
const visibleText = nodes.map((node) => node.data).join("");
|
|
5584
|
+
if (!Number.isSafeInteger(fragment.startOffset) || !Number.isSafeInteger(fragment.endOffset) || fragment.startOffset < 0 || fragment.endOffset <= fragment.startOffset || fragment.endOffset > visibleText.length || visibleText.slice(fragment.startOffset, fragment.endOffset) !== fragment.text) return;
|
|
5585
|
+
const ranges = [];
|
|
5586
|
+
let visibleOffset = 0;
|
|
5587
|
+
for (const node of nodes) {
|
|
5588
|
+
const nodeEnd = visibleOffset + node.data.length;
|
|
5589
|
+
const start = Math.max(fragment.startOffset, visibleOffset) - visibleOffset;
|
|
5590
|
+
const end = Math.min(fragment.endOffset, nodeEnd) - visibleOffset;
|
|
5591
|
+
if (end > start) {
|
|
5592
|
+
const range = document.createRange();
|
|
5593
|
+
range.setStart(node, start);
|
|
5594
|
+
range.setEnd(node, end);
|
|
5595
|
+
ranges.push(range);
|
|
5596
|
+
}
|
|
5597
|
+
visibleOffset = nodeEnd;
|
|
5598
|
+
if (visibleOffset >= fragment.endOffset) break;
|
|
5599
|
+
}
|
|
5600
|
+
return ranges.length === 0 ? void 0 : ranges;
|
|
5601
|
+
}
|
|
5602
|
+
/** Rebuild a saved selection only when its anchored visible text still matches. */
|
|
5603
|
+
function restoreDomConversationSelection(input) {
|
|
5604
|
+
const ranges = [];
|
|
5605
|
+
for (const fragment of input.selection.fragments) {
|
|
5606
|
+
const restored = restoreFragmentRanges(input.conversationRoot, fragment);
|
|
5607
|
+
if (restored === void 0) return;
|
|
5608
|
+
ranges.push(...restored);
|
|
5609
|
+
}
|
|
5610
|
+
const first = ranges[0];
|
|
5611
|
+
const last = ranges.at(-1);
|
|
5612
|
+
if (first === void 0 || last === void 0) return;
|
|
5613
|
+
const browserRange = document.createRange();
|
|
5614
|
+
browserRange.setStart(first.startContainer, first.startOffset);
|
|
5615
|
+
browserRange.setEnd(last.endContainer, last.endOffset);
|
|
5616
|
+
return {
|
|
5617
|
+
ranges,
|
|
5618
|
+
browserRange
|
|
5619
|
+
};
|
|
5620
|
+
}
|
|
5621
|
+
//#endregion
|
|
5622
|
+
//#region src/client/selection/ConversationAnnotationMarkers.tsx
|
|
5623
|
+
const ANNOTATION_HIGHLIGHT = "dsh-side-chat-annotations";
|
|
5624
|
+
const ACTIVE_ANNOTATION_HIGHLIGHT = "dsh-side-chat-active-annotation";
|
|
5625
|
+
function clamp$1(value, minimum, maximum) {
|
|
5626
|
+
return Math.min(Math.max(minimum, value), Math.max(minimum, maximum));
|
|
5627
|
+
}
|
|
5628
|
+
function boundsOf(rect) {
|
|
5629
|
+
const left = Number.isFinite(rect.left) ? rect.left : rect.x;
|
|
5630
|
+
const top = Number.isFinite(rect.top) ? rect.top : rect.y;
|
|
5631
|
+
const right = Number.isFinite(rect.right) ? rect.right : left + rect.width;
|
|
5632
|
+
const bottom = Number.isFinite(rect.bottom) ? rect.bottom : top + rect.height;
|
|
5633
|
+
return [
|
|
5634
|
+
left,
|
|
5635
|
+
top,
|
|
5636
|
+
right,
|
|
5637
|
+
bottom
|
|
5638
|
+
].every(Number.isFinite) ? {
|
|
5639
|
+
left,
|
|
5640
|
+
top,
|
|
5641
|
+
right,
|
|
5642
|
+
bottom
|
|
5643
|
+
} : void 0;
|
|
5644
|
+
}
|
|
5645
|
+
function rangeBounds(ranges) {
|
|
5646
|
+
const boxes = [];
|
|
5647
|
+
for (const range of ranges) {
|
|
5648
|
+
const clientRects = typeof range.getClientRects === "function" ? [...range.getClientRects()] : [];
|
|
5649
|
+
const rects = clientRects.length > 0 ? clientRects : typeof range.getBoundingClientRect === "function" ? [range.getBoundingClientRect()] : [];
|
|
5650
|
+
for (const rect of rects) {
|
|
5651
|
+
const bounds = boundsOf(rect);
|
|
5652
|
+
if (bounds !== void 0 && (bounds.right > bounds.left || bounds.bottom > bounds.top)) boxes.push(bounds);
|
|
5653
|
+
}
|
|
5654
|
+
}
|
|
5655
|
+
if (boxes.length === 0) return;
|
|
5656
|
+
return {
|
|
5657
|
+
left: Math.min(...boxes.map((box) => box.left)),
|
|
5658
|
+
top: Math.min(...boxes.map((box) => box.top)),
|
|
5659
|
+
right: Math.max(...boxes.map((box) => box.right)),
|
|
5660
|
+
bottom: Math.max(...boxes.map((box) => box.bottom))
|
|
5661
|
+
};
|
|
5662
|
+
}
|
|
5663
|
+
function selectionRect(bounds) {
|
|
5664
|
+
return {
|
|
5665
|
+
x: bounds.left,
|
|
5666
|
+
y: bounds.top,
|
|
5667
|
+
width: bounds.right - bounds.left,
|
|
5668
|
+
height: bounds.bottom - bounds.top,
|
|
5669
|
+
viewportWidth: window.innerWidth,
|
|
5670
|
+
viewportHeight: window.innerHeight
|
|
5671
|
+
};
|
|
5672
|
+
}
|
|
5673
|
+
function visibleViewport(range) {
|
|
5674
|
+
let viewport = {
|
|
5675
|
+
left: 0,
|
|
5676
|
+
top: 0,
|
|
5677
|
+
right: window.innerWidth,
|
|
5678
|
+
bottom: window.innerHeight
|
|
5679
|
+
};
|
|
5680
|
+
const start = range.startContainer;
|
|
5681
|
+
const scrollport = (start.nodeType === Node.ELEMENT_NODE ? start : start.parentElement)?.closest("[data-conversation-scroll]");
|
|
5682
|
+
if (scrollport === null || scrollport === void 0) return viewport;
|
|
5683
|
+
const scrollBounds = boundsOf(scrollport.getBoundingClientRect());
|
|
5684
|
+
if (scrollBounds !== void 0 && scrollBounds.right > scrollBounds.left && scrollBounds.bottom > scrollBounds.top) viewport = {
|
|
5685
|
+
left: Math.max(viewport.left, scrollBounds.left),
|
|
5686
|
+
top: Math.max(viewport.top, scrollBounds.top),
|
|
5687
|
+
right: Math.min(viewport.right, scrollBounds.right),
|
|
5688
|
+
bottom: Math.min(viewport.bottom, scrollBounds.bottom)
|
|
5689
|
+
};
|
|
5690
|
+
const composer = scrollport.querySelector("[data-composer-seat]");
|
|
5691
|
+
const composerBounds = composer === null ? void 0 : boundsOf(composer.getBoundingClientRect());
|
|
5692
|
+
if (composerBounds !== void 0 && composerBounds.right > composerBounds.left && composerBounds.bottom > composerBounds.top && composerBounds.bottom > viewport.top && composerBounds.top < viewport.bottom) viewport = {
|
|
5693
|
+
...viewport,
|
|
5694
|
+
bottom: Math.min(viewport.bottom, composerBounds.top)
|
|
5695
|
+
};
|
|
5696
|
+
return viewport;
|
|
5697
|
+
}
|
|
5698
|
+
function intersects(bounds, viewport) {
|
|
5699
|
+
return bounds.right > viewport.left && bounds.bottom > viewport.top && bounds.left < viewport.right && bounds.top < viewport.bottom;
|
|
5700
|
+
}
|
|
5701
|
+
function markerPositionsEqual(previous, next) {
|
|
5702
|
+
return previous.length === next.length && previous.every((position, index) => {
|
|
5703
|
+
const candidate = next[index];
|
|
5704
|
+
return candidate !== void 0 && candidate.annotationIndex === position.annotationIndex && candidate.left === position.left && candidate.top === position.top;
|
|
5705
|
+
});
|
|
5706
|
+
}
|
|
5707
|
+
function clearHighlights() {
|
|
5708
|
+
if (typeof CSS === "undefined" || CSS.highlights === void 0) return;
|
|
5709
|
+
CSS.highlights.delete(ANNOTATION_HIGHLIGHT);
|
|
5710
|
+
CSS.highlights.delete(ACTIVE_ANNOTATION_HIGHLIGHT);
|
|
5711
|
+
}
|
|
5712
|
+
function publishHighlights(ranges, activeRanges) {
|
|
5713
|
+
if (typeof CSS === "undefined" || CSS.highlights === void 0 || typeof Highlight === "undefined") return;
|
|
5714
|
+
CSS.highlights.set(ANNOTATION_HIGHLIGHT, new Highlight(...ranges));
|
|
5715
|
+
if (activeRanges.length === 0) {
|
|
5716
|
+
CSS.highlights.delete(ACTIVE_ANNOTATION_HIGHLIGHT);
|
|
5717
|
+
return;
|
|
5718
|
+
}
|
|
5719
|
+
const active = new Highlight(...activeRanges);
|
|
5720
|
+
active.priority = 1;
|
|
5721
|
+
CSS.highlights.set(ACTIVE_ANNOTATION_HIGHLIGHT, active);
|
|
5722
|
+
}
|
|
5723
|
+
function restoreBrowserSelection(range) {
|
|
5724
|
+
const browserSelection = window.getSelection();
|
|
5725
|
+
if (browserSelection === null) return;
|
|
5726
|
+
browserSelection.removeAllRanges();
|
|
5727
|
+
browserSelection.addRange(range);
|
|
5728
|
+
}
|
|
5729
|
+
/** Persistent source markers for unsent parent-composer annotations. */
|
|
5730
|
+
function ConversationAnnotationMarkers({ annotations, activeAnnotationIndex, onEdit }) {
|
|
5731
|
+
const resolvedRef = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
5732
|
+
const [positions, setPositions] = (0, react.useState)([]);
|
|
5733
|
+
(0, react.useEffect)(() => {
|
|
5734
|
+
if (annotations.length === 0) {
|
|
5735
|
+
resolvedRef.current.clear();
|
|
5736
|
+
setPositions((previous) => previous.length === 0 ? previous : []);
|
|
5737
|
+
clearHighlights();
|
|
5738
|
+
return;
|
|
5739
|
+
}
|
|
5740
|
+
let animationFrame;
|
|
5741
|
+
let observedConversationRoot = null;
|
|
5742
|
+
let resizeObserver;
|
|
5743
|
+
const refresh = () => {
|
|
5744
|
+
animationFrame = void 0;
|
|
5745
|
+
const conversationRoot = document.querySelector("[data-chat-flow]");
|
|
5746
|
+
if (conversationRoot !== observedConversationRoot) {
|
|
5747
|
+
resizeObserver?.disconnect();
|
|
5748
|
+
observedConversationRoot = conversationRoot;
|
|
5749
|
+
if (conversationRoot !== null) resizeObserver?.observe(conversationRoot);
|
|
5750
|
+
}
|
|
5751
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
5752
|
+
const nextPositions = [];
|
|
5753
|
+
const highlightRanges = [];
|
|
5754
|
+
const activeRanges = [];
|
|
5755
|
+
if (conversationRoot !== null) for (const annotation of annotations) {
|
|
5756
|
+
const restored = restoreDomConversationSelection({
|
|
5757
|
+
selection: annotation.selection,
|
|
5758
|
+
conversationRoot
|
|
5759
|
+
});
|
|
5760
|
+
if (restored === void 0) continue;
|
|
5761
|
+
highlightRanges.push(...restored.ranges);
|
|
5762
|
+
if (annotation.annotationIndex === activeAnnotationIndex) activeRanges.push(...restored.ranges);
|
|
5763
|
+
const bounds = rangeBounds(restored.ranges);
|
|
5764
|
+
const viewport = visibleViewport(restored.browserRange);
|
|
5765
|
+
if (bounds === void 0 || !intersects(bounds, viewport)) continue;
|
|
5766
|
+
const rect = selectionRect(bounds);
|
|
5767
|
+
resolved.set(annotation.annotationIndex, {
|
|
5768
|
+
browserRange: restored.browserRange,
|
|
5769
|
+
rect
|
|
5770
|
+
});
|
|
5771
|
+
nextPositions.push({
|
|
5772
|
+
annotationIndex: annotation.annotationIndex,
|
|
5773
|
+
left: clamp$1(bounds.right + 3, viewport.left + 4, viewport.right - 26),
|
|
5774
|
+
top: clamp$1(bounds.top - 12, viewport.top + 4, viewport.bottom - 26)
|
|
5775
|
+
});
|
|
5776
|
+
}
|
|
5777
|
+
resolvedRef.current = resolved;
|
|
5778
|
+
setPositions((previous) => markerPositionsEqual(previous, nextPositions) ? previous : nextPositions);
|
|
5779
|
+
publishHighlights(highlightRanges, activeRanges);
|
|
5780
|
+
};
|
|
5781
|
+
const scheduleRefresh = () => {
|
|
5782
|
+
if (animationFrame !== void 0) return;
|
|
5783
|
+
animationFrame = window.requestAnimationFrame(refresh);
|
|
5784
|
+
};
|
|
5785
|
+
resizeObserver = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(scheduleRefresh);
|
|
5786
|
+
refresh();
|
|
5787
|
+
const mutationObserver = new MutationObserver(scheduleRefresh);
|
|
5788
|
+
mutationObserver.observe(document.body, {
|
|
5789
|
+
childList: true,
|
|
5790
|
+
characterData: true,
|
|
5791
|
+
subtree: true
|
|
5792
|
+
});
|
|
5793
|
+
document.addEventListener("scroll", scheduleRefresh, true);
|
|
5794
|
+
window.addEventListener("resize", scheduleRefresh);
|
|
5795
|
+
return () => {
|
|
5796
|
+
if (animationFrame !== void 0) window.cancelAnimationFrame(animationFrame);
|
|
5797
|
+
mutationObserver?.disconnect();
|
|
5798
|
+
resizeObserver?.disconnect();
|
|
5799
|
+
document.removeEventListener("scroll", scheduleRefresh, true);
|
|
5800
|
+
window.removeEventListener("resize", scheduleRefresh);
|
|
5801
|
+
clearHighlights();
|
|
5802
|
+
};
|
|
5803
|
+
}, [activeAnnotationIndex, annotations]);
|
|
5804
|
+
return positions.map((position) => {
|
|
5805
|
+
const annotation = annotations.find((candidate) => candidate.annotationIndex === position.annotationIndex);
|
|
5806
|
+
if (annotation === void 0) return null;
|
|
5807
|
+
const style = {
|
|
5808
|
+
left: position.left,
|
|
5809
|
+
top: position.top
|
|
5810
|
+
};
|
|
5811
|
+
const number = annotation.annotationIndex + 1;
|
|
5812
|
+
const badge = number > 99 ? "99+" : String(number);
|
|
5813
|
+
const activate = () => {
|
|
5814
|
+
const resolved = resolvedRef.current.get(annotation.annotationIndex);
|
|
5815
|
+
if (resolved === void 0) return;
|
|
5816
|
+
restoreBrowserSelection(resolved.browserRange);
|
|
5817
|
+
onEdit(annotation, {
|
|
5818
|
+
...annotation.selection,
|
|
5819
|
+
rect: resolved.rect
|
|
5820
|
+
});
|
|
5821
|
+
window.requestAnimationFrame(() => {
|
|
5822
|
+
restoreBrowserSelection(resolved.browserRange);
|
|
5823
|
+
});
|
|
5824
|
+
};
|
|
5825
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
5826
|
+
type: "button",
|
|
5827
|
+
className: "dsh-side-chat-annotation-marker",
|
|
5828
|
+
style,
|
|
5829
|
+
"data-active": annotation.annotationIndex === activeAnnotationIndex || void 0,
|
|
5830
|
+
"data-large": number > 99 || void 0,
|
|
5831
|
+
"aria-label": `Edit annotation ${String(number)}`,
|
|
5832
|
+
title: `Edit annotation ${String(number)}`,
|
|
5833
|
+
onMouseDown: (event) => {
|
|
5834
|
+
event.preventDefault();
|
|
5835
|
+
event.stopPropagation();
|
|
5836
|
+
},
|
|
5837
|
+
onClick: activate,
|
|
5838
|
+
children: badge
|
|
5839
|
+
}, `${annotation.selection.parentSessionId}:${annotation.selection.fragments[0]?.nodeKey ?? ""}:${String(annotation.annotationIndex)}`);
|
|
5840
|
+
});
|
|
5841
|
+
}
|
|
5448
5842
|
//#endregion
|
|
5449
5843
|
//#region src/client/selection/SelectionActions.tsx
|
|
5450
5844
|
function clamp(value, minimum, maximum) {
|
|
5451
5845
|
return Math.min(Math.max(minimum, value), Math.max(minimum, maximum));
|
|
5452
5846
|
}
|
|
5453
|
-
function SelectionActions({ selection, askDisabledReason, annotationNumber = 1, onAddToChat, onMoreDetails, onAskInSideChat, onAnnotationEditorChange, onDismiss }) {
|
|
5454
|
-
const [editingAnnotation, setEditingAnnotation] = (0, react.useState)(
|
|
5455
|
-
const [comment, setComment] = (0, react.useState)("");
|
|
5847
|
+
function SelectionActions({ selection, askDisabledReason, annotationNumber = 1, annotationEditor, onAddToChat, onMoreDetails, onAskInSideChat, onAnnotationEditorChange, onDismiss }) {
|
|
5848
|
+
const [editingAnnotation, setEditingAnnotation] = (0, react.useState)(annotationEditor !== void 0);
|
|
5849
|
+
const [comment, setComment] = (0, react.useState)(annotationEditor?.initialComment ?? "");
|
|
5456
5850
|
const commentRef = (0, react.useRef)(null);
|
|
5457
5851
|
const center = selection.rect.x + selection.rect.width / 2;
|
|
5458
5852
|
const style = {
|
|
@@ -5468,9 +5862,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5468
5862
|
width: editorWidth
|
|
5469
5863
|
};
|
|
5470
5864
|
const markerStyle = {
|
|
5471
|
-
left: clamp(selection.rect.x + selection.rect.width
|
|
5472
|
-
top: selection.rect.y
|
|
5865
|
+
left: clamp(selection.rect.x + selection.rect.width + 3, 4, selection.rect.viewportWidth - 26),
|
|
5866
|
+
top: clamp(selection.rect.y - 12, 4, selection.rect.viewportHeight - 26)
|
|
5473
5867
|
};
|
|
5868
|
+
const markerNumber = annotationNumber > 99 ? "99+" : String(annotationNumber);
|
|
5474
5869
|
const keepSelection = (event) => {
|
|
5475
5870
|
event.preventDefault();
|
|
5476
5871
|
};
|
|
@@ -5481,6 +5876,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5481
5876
|
setEditingAnnotation(false);
|
|
5482
5877
|
setComment("");
|
|
5483
5878
|
onAnnotationEditorChange?.(false);
|
|
5879
|
+
if (annotationEditor !== void 0) onDismiss();
|
|
5484
5880
|
};
|
|
5485
5881
|
const saveAnnotation = () => {
|
|
5486
5882
|
const trimmed = comment.trim();
|
|
@@ -5504,15 +5900,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5504
5900
|
saveAnnotation();
|
|
5505
5901
|
}
|
|
5506
5902
|
};
|
|
5507
|
-
if (editingAnnotation) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5903
|
+
if (editingAnnotation) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [annotationEditor === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5508
5904
|
className: "dsh-side-chat-selection-marker",
|
|
5509
5905
|
"aria-hidden": "true",
|
|
5906
|
+
"data-large": annotationNumber > 99 || void 0,
|
|
5510
5907
|
style: markerStyle,
|
|
5511
|
-
children:
|
|
5908
|
+
children: markerNumber
|
|
5512
5909
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
5513
5910
|
className: "dsh-side-chat-selection-comment",
|
|
5514
5911
|
role: "dialog",
|
|
5515
|
-
"aria-label": "Add annotation comment",
|
|
5912
|
+
"aria-label": annotationEditor?.dialogLabel ?? "Add annotation comment",
|
|
5516
5913
|
style: editorStyle,
|
|
5517
5914
|
onSubmit: submitAnnotation,
|
|
5518
5915
|
onMouseDown: (event) => {
|
|
@@ -5605,8 +6002,62 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5605
6002
|
});
|
|
5606
6003
|
}
|
|
5607
6004
|
//#endregion
|
|
5608
|
-
//#region src/client/rc6/
|
|
5609
|
-
|
|
6005
|
+
//#region src/client/rc6/SideChatTool.tsx
|
|
6006
|
+
const TOOL_VARIANTS = {
|
|
6007
|
+
bash: "bash",
|
|
6008
|
+
pwsh: "bash",
|
|
6009
|
+
read: "read",
|
|
6010
|
+
web_fetch: "read",
|
|
6011
|
+
web_search: "search",
|
|
6012
|
+
grep: "search",
|
|
6013
|
+
glob: "search",
|
|
6014
|
+
write: "write",
|
|
6015
|
+
edit: "edit",
|
|
6016
|
+
run_code: "code"
|
|
6017
|
+
};
|
|
6018
|
+
const VARIANT_TITLES = {
|
|
6019
|
+
search: "Search",
|
|
6020
|
+
read: "Read",
|
|
6021
|
+
bash: "Bash",
|
|
6022
|
+
write: "Write",
|
|
6023
|
+
edit: "Edit",
|
|
6024
|
+
code: "Code",
|
|
6025
|
+
others: "Tool call"
|
|
6026
|
+
};
|
|
6027
|
+
const SUMMARY_KEYS = {
|
|
6028
|
+
bash: ["description", "command"],
|
|
6029
|
+
read: [
|
|
6030
|
+
"path",
|
|
6031
|
+
"file_path",
|
|
6032
|
+
"url"
|
|
6033
|
+
],
|
|
6034
|
+
search: [
|
|
6035
|
+
"query",
|
|
6036
|
+
"pattern",
|
|
6037
|
+
"url"
|
|
6038
|
+
],
|
|
6039
|
+
write: ["path", "file_path"],
|
|
6040
|
+
edit: ["path", "file_path"],
|
|
6041
|
+
code: ["description"],
|
|
6042
|
+
others: []
|
|
6043
|
+
};
|
|
6044
|
+
function record(value) {
|
|
6045
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
6046
|
+
}
|
|
6047
|
+
function stringValue(value) {
|
|
6048
|
+
return typeof value === "string" && value !== "" ? value : void 0;
|
|
6049
|
+
}
|
|
6050
|
+
function numberValue(value) {
|
|
6051
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
6052
|
+
}
|
|
6053
|
+
function booleanValue(value) {
|
|
6054
|
+
return typeof value === "boolean" ? value : void 0;
|
|
6055
|
+
}
|
|
6056
|
+
function firstLine(text) {
|
|
6057
|
+
const newline = text.indexOf("\n");
|
|
6058
|
+
return newline === -1 ? text : text.slice(0, newline);
|
|
6059
|
+
}
|
|
6060
|
+
function stringify$1(value) {
|
|
5610
6061
|
if (typeof value === "string") return value;
|
|
5611
6062
|
try {
|
|
5612
6063
|
return JSON.stringify(value, null, 2);
|
|
@@ -5614,127 +6065,455 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5614
6065
|
return String(value);
|
|
5615
6066
|
}
|
|
5616
6067
|
}
|
|
5617
|
-
function contentText(content) {
|
|
6068
|
+
function contentText$1(content) {
|
|
5618
6069
|
return content.map((block) => {
|
|
5619
6070
|
if (block.type === "text" || block.type === "reasoning") return block.text;
|
|
5620
6071
|
if (block.type === "image") return "[Image]";
|
|
5621
6072
|
if (block.type === "tool-call") return `${block.name}(${block.arguments})`;
|
|
5622
|
-
if (block.type === "tool-result") return contentText(block.content);
|
|
5623
|
-
return stringify(block);
|
|
6073
|
+
if (block.type === "tool-result") return contentText$1(block.content);
|
|
6074
|
+
return stringify$1(block);
|
|
5624
6075
|
}).filter(Boolean).join("\n");
|
|
5625
6076
|
}
|
|
5626
6077
|
function toolOutputText(content) {
|
|
5627
|
-
const text = contentText(content);
|
|
6078
|
+
const text = contentText$1(content);
|
|
5628
6079
|
return /^<path>[\s\S]*?<\/path>\s*<type>[\s\S]*?<\/type>\s*<content>\s*\n?([\s\S]*?)\n?<\/content>\s*$/u.exec(text)?.[1]?.trimEnd() ?? text;
|
|
5629
6080
|
}
|
|
5630
|
-
function
|
|
5631
|
-
return /<user_question>([\s\S]*?)<\/user_question>/u.exec(text)?.[1]?.trim() ?? text;
|
|
5632
|
-
}
|
|
5633
|
-
function parsedToolArguments(argsRaw) {
|
|
6081
|
+
function parseArguments(argsRaw) {
|
|
5634
6082
|
try {
|
|
5635
|
-
|
|
5636
|
-
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : null;
|
|
6083
|
+
return record(JSON.parse(argsRaw));
|
|
5637
6084
|
} catch {
|
|
5638
6085
|
return null;
|
|
5639
6086
|
}
|
|
5640
6087
|
}
|
|
5641
|
-
function
|
|
5642
|
-
if (name.toLowerCase() === "pwsh") return "Pwsh";
|
|
5643
|
-
return name.split(/[-_\s]+/u).filter(Boolean).map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`).join(" ");
|
|
5644
|
-
}
|
|
5645
|
-
function toolSummary(name, argsRaw) {
|
|
5646
|
-
const args = parsedToolArguments(argsRaw);
|
|
5647
|
-
if (args === null) return null;
|
|
5648
|
-
const normalizedName = name.toLowerCase();
|
|
5649
|
-
const candidates = normalizedName === "pwsh" ? ["description", "command"] : normalizedName === "grep" ? ["pattern", "path"] : [
|
|
5650
|
-
"file_path",
|
|
5651
|
-
"path",
|
|
5652
|
-
"pattern",
|
|
5653
|
-
"query",
|
|
5654
|
-
"url",
|
|
5655
|
-
"command",
|
|
5656
|
-
"description"
|
|
5657
|
-
];
|
|
5658
|
-
for (const key of candidates) {
|
|
5659
|
-
const value = args[key];
|
|
5660
|
-
if (typeof value !== "string" || value.trim().length === 0) continue;
|
|
5661
|
-
if (key === "file_path") return value.split(/[\\/]/u).at(-1) ?? value;
|
|
5662
|
-
return value;
|
|
5663
|
-
}
|
|
5664
|
-
return null;
|
|
5665
|
-
}
|
|
5666
|
-
function formattedToolArguments(argsRaw) {
|
|
6088
|
+
function formattedArguments(argsRaw) {
|
|
5667
6089
|
try {
|
|
5668
6090
|
return JSON.stringify(JSON.parse(argsRaw), null, 2);
|
|
5669
6091
|
} catch {
|
|
5670
6092
|
return argsRaw;
|
|
5671
6093
|
}
|
|
5672
6094
|
}
|
|
5673
|
-
function
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
6095
|
+
function classifyTool(name) {
|
|
6096
|
+
return TOOL_VARIANTS[name.toLowerCase()] ?? "others";
|
|
6097
|
+
}
|
|
6098
|
+
function toolTitle(name, variant) {
|
|
6099
|
+
if (name.toLowerCase() === "pwsh") return "Pwsh";
|
|
6100
|
+
return VARIANT_TITLES[variant];
|
|
6101
|
+
}
|
|
6102
|
+
function pickArgument(args, keys) {
|
|
6103
|
+
for (const key of keys) {
|
|
6104
|
+
const value = stringValue(args[key]);
|
|
6105
|
+
if (value !== void 0) return value;
|
|
6106
|
+
}
|
|
6107
|
+
return Object.values(args).find((value) => typeof value === "string" && value !== "");
|
|
6108
|
+
}
|
|
6109
|
+
function relativizeToCwd(path, cwd) {
|
|
6110
|
+
if (cwd === void 0 || cwd === "") return path;
|
|
6111
|
+
const root = cwd.replace(/[/\\]+$/u, "");
|
|
6112
|
+
const lowerPath = path.toLowerCase();
|
|
6113
|
+
const lowerRoot = root.toLowerCase();
|
|
6114
|
+
return lowerPath.startsWith(`${lowerRoot}/`) || lowerPath.startsWith(`${lowerRoot}\\`) ? path.slice(root.length + 1) : path;
|
|
6115
|
+
}
|
|
6116
|
+
function summaryFromArguments(name, variant, argsRaw, callId, cwd) {
|
|
6117
|
+
const args = parseArguments(argsRaw);
|
|
6118
|
+
const base = relativizeToCwd(firstLine((args === null ? void 0 : pickArgument(args, SUMMARY_KEYS[variant])) ?? (argsRaw === "" || argsRaw === "{}" ? callId : argsRaw)), cwd);
|
|
6119
|
+
return variant === "others" && name !== "" ? `${name} · ${base}` : base;
|
|
6120
|
+
}
|
|
6121
|
+
function filePathFromArguments(variant, argsRaw) {
|
|
6122
|
+
if (variant !== "read" && variant !== "write" && variant !== "edit") return void 0;
|
|
6123
|
+
const args = parseArguments(argsRaw);
|
|
6124
|
+
if (args === null) return void 0;
|
|
6125
|
+
return stringValue(args["path"]) ?? stringValue(args["file_path"]);
|
|
6126
|
+
}
|
|
6127
|
+
function variantIcon(variant) {
|
|
6128
|
+
switch (variant) {
|
|
6129
|
+
case "search": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSearchOutline16, { size: 14 });
|
|
6130
|
+
case "read": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutline16, { size: 14 });
|
|
6131
|
+
case "bash": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconApiOutline14, { size: 14 });
|
|
6132
|
+
case "write":
|
|
6133
|
+
case "edit": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutline16, { size: 14 });
|
|
6134
|
+
case "code": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCodeOutline16, { size: 14 });
|
|
6135
|
+
case "others": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSparkle16, { size: 14 });
|
|
6136
|
+
}
|
|
6137
|
+
}
|
|
6138
|
+
function resolveTerminalCwd(viewCwd, cwd) {
|
|
6139
|
+
if (viewCwd === void 0 || viewCwd === "") return cwd;
|
|
6140
|
+
if (cwd === void 0 || cwd === "" || /^(?:[A-Za-z]:[/\\]|[/\\]{1,2})/u.test(viewCwd)) return viewCwd;
|
|
6141
|
+
return `${cwd.replace(/[/\\]+$/u, "")}\\${viewCwd}`;
|
|
6142
|
+
}
|
|
6143
|
+
function terminalCard(variant, argsRaw, state, output, callView, resultView, cwd) {
|
|
6144
|
+
const call = record(callView);
|
|
6145
|
+
const result = record(resultView);
|
|
6146
|
+
const callIsTerminal = call?.["card"] === "terminal";
|
|
6147
|
+
const resultIsTerminal = result?.["card"] === "terminal";
|
|
6148
|
+
if (variant !== "bash" && !callIsTerminal && !resultIsTerminal) return null;
|
|
6149
|
+
const args = parseArguments(argsRaw);
|
|
6150
|
+
return {
|
|
6151
|
+
command: stringValue(result?.["title"]) ?? stringValue(call?.["title"]) ?? (args === null ? void 0 : stringValue(args["command"])) ?? "",
|
|
6152
|
+
cwd: resolveTerminalCwd(stringValue(call?.["cwd"]), cwd),
|
|
6153
|
+
output: stringValue(result?.["output"]) ?? output,
|
|
6154
|
+
exitCode: numberValue(result?.["exitCode"]),
|
|
6155
|
+
signal: stringValue(result?.["signal"]),
|
|
6156
|
+
running: state === "running" || state === "pending",
|
|
6157
|
+
description: stringValue(call?.["description"])
|
|
6158
|
+
};
|
|
6159
|
+
}
|
|
6160
|
+
function languageForPath(path) {
|
|
6161
|
+
if (path === void 0) return void 0;
|
|
6162
|
+
const extension = /\.([^.\\/]+)$/u.exec(path)?.[1]?.toLowerCase();
|
|
6163
|
+
return extension === void 0 ? void 0 : {
|
|
6164
|
+
js: "javascript",
|
|
6165
|
+
jsx: "jsx",
|
|
6166
|
+
ts: "typescript",
|
|
6167
|
+
tsx: "tsx",
|
|
6168
|
+
json: "json",
|
|
6169
|
+
css: "css",
|
|
6170
|
+
html: "html",
|
|
6171
|
+
md: "markdown",
|
|
6172
|
+
yml: "yaml",
|
|
6173
|
+
yaml: "yaml",
|
|
6174
|
+
py: "python",
|
|
6175
|
+
ps1: "powershell",
|
|
6176
|
+
sh: "bash",
|
|
6177
|
+
toml: "toml",
|
|
6178
|
+
xml: "xml"
|
|
6179
|
+
}[extension];
|
|
6180
|
+
}
|
|
6181
|
+
function validReadLines(value) {
|
|
6182
|
+
if (!Array.isArray(value)) return null;
|
|
6183
|
+
const lines = [];
|
|
6184
|
+
for (const item of value) {
|
|
6185
|
+
const line = record(item);
|
|
6186
|
+
const number = numberValue(line?.["number"]);
|
|
6187
|
+
const text = stringValue(line?.["text"]) ?? (line?.["text"] === "" ? "" : void 0);
|
|
6188
|
+
if (number === void 0 || text === void 0) return null;
|
|
6189
|
+
lines.push({
|
|
6190
|
+
number,
|
|
6191
|
+
text
|
|
6192
|
+
});
|
|
6193
|
+
}
|
|
6194
|
+
return lines;
|
|
6195
|
+
}
|
|
6196
|
+
function readCard(name, argsRaw, state, output, resultView, cwd) {
|
|
6197
|
+
if (state === "running" || state === "pending" || state === "error" || state === "interrupted") return null;
|
|
6198
|
+
const result = record(resultView);
|
|
6199
|
+
if (result?.["card"] === "read") {
|
|
6200
|
+
const lines = validReadLines(result["lines"]);
|
|
6201
|
+
const totalLines = numberValue(result["totalLines"]);
|
|
6202
|
+
const path = stringValue(result["path"]);
|
|
6203
|
+
if (lines === null || totalLines === void 0) return null;
|
|
6204
|
+
return {
|
|
6205
|
+
label: stringValue(result["title"]) ?? (path === void 0 ? void 0 : relativizeToCwd(path, cwd)),
|
|
6206
|
+
lines,
|
|
6207
|
+
totalLines,
|
|
6208
|
+
lang: stringValue(result["lang"])
|
|
6209
|
+
};
|
|
6210
|
+
}
|
|
6211
|
+
if (name.toLowerCase() !== "read" || output === void 0) return null;
|
|
6212
|
+
const path = filePathFromArguments("read", argsRaw);
|
|
6213
|
+
const texts = output.split("\n");
|
|
6214
|
+
return {
|
|
6215
|
+
label: path === void 0 ? void 0 : relativizeToCwd(path, cwd),
|
|
6216
|
+
lines: texts.map((text, index) => ({
|
|
6217
|
+
number: index + 1,
|
|
6218
|
+
text
|
|
6219
|
+
})),
|
|
6220
|
+
totalLines: texts.length,
|
|
6221
|
+
lang: languageForPath(path)
|
|
6222
|
+
};
|
|
6223
|
+
}
|
|
6224
|
+
function validSearchCard(resultView) {
|
|
6225
|
+
const result = record(resultView);
|
|
6226
|
+
if (result?.["card"] !== "search") return null;
|
|
6227
|
+
const truncated = booleanValue(result["truncated"]);
|
|
6228
|
+
const total = numberValue(result["total"]);
|
|
6229
|
+
if (truncated === void 0 || total === void 0) return null;
|
|
6230
|
+
if (result["shape"] === "paths") {
|
|
6231
|
+
const paths = result["paths"];
|
|
6232
|
+
return Array.isArray(paths) && paths.every((path) => typeof path === "string") ? {
|
|
6233
|
+
kind: "paths",
|
|
6234
|
+
paths,
|
|
6235
|
+
truncated,
|
|
6236
|
+
total
|
|
6237
|
+
} : null;
|
|
6238
|
+
}
|
|
6239
|
+
if (result["shape"] !== "matches" || !Array.isArray(result["files"])) return null;
|
|
6240
|
+
const files = [];
|
|
6241
|
+
for (const item of result["files"]) {
|
|
6242
|
+
const file = record(item);
|
|
6243
|
+
const path = stringValue(file?.["path"]);
|
|
6244
|
+
const matchesValue = file?.["matches"];
|
|
6245
|
+
if (path === void 0 || !Array.isArray(matchesValue)) return null;
|
|
6246
|
+
const matches = [];
|
|
6247
|
+
for (const matchValue of matchesValue) {
|
|
6248
|
+
const match = record(matchValue);
|
|
6249
|
+
const lineNumber = numberValue(match?.["lineNumber"]);
|
|
6250
|
+
const line = stringValue(match?.["line"]) ?? (match?.["line"] === "" ? "" : void 0);
|
|
6251
|
+
if (lineNumber === void 0 || line === void 0) return null;
|
|
6252
|
+
matches.push({
|
|
6253
|
+
lineNumber,
|
|
6254
|
+
line
|
|
6255
|
+
});
|
|
6256
|
+
}
|
|
6257
|
+
files.push({
|
|
6258
|
+
path,
|
|
6259
|
+
matches
|
|
6260
|
+
});
|
|
6261
|
+
}
|
|
6262
|
+
return {
|
|
6263
|
+
kind: "matches",
|
|
6264
|
+
files,
|
|
6265
|
+
truncated,
|
|
6266
|
+
total
|
|
6267
|
+
};
|
|
6268
|
+
}
|
|
6269
|
+
function validDiffs(view) {
|
|
6270
|
+
const value = record(view);
|
|
6271
|
+
if (value?.["card"] !== "diff" || !Array.isArray(value["diffs"]) || value["diffs"].length === 0) return null;
|
|
6272
|
+
const diffs = [];
|
|
6273
|
+
for (const item of value["diffs"]) {
|
|
6274
|
+
const hunk = record(item);
|
|
6275
|
+
const path = stringValue(hunk?.["path"]);
|
|
6276
|
+
const oldText = hunk?.["oldText"];
|
|
6277
|
+
const newText = stringValue(hunk?.["newText"]) ?? (hunk?.["newText"] === "" ? "" : void 0);
|
|
6278
|
+
if (path === void 0 || oldText !== null && typeof oldText !== "string" || newText === void 0) return null;
|
|
6279
|
+
diffs.push({
|
|
6280
|
+
path,
|
|
6281
|
+
oldText,
|
|
6282
|
+
newText
|
|
6283
|
+
});
|
|
6284
|
+
}
|
|
6285
|
+
return diffs;
|
|
6286
|
+
}
|
|
6287
|
+
function validWebCard(view) {
|
|
6288
|
+
const result = record(view);
|
|
6289
|
+
if (result?.["card"] !== "web") return null;
|
|
6290
|
+
const truncated = booleanValue(result["truncated"]);
|
|
6291
|
+
if (truncated === void 0) return null;
|
|
6292
|
+
if (result["kind"] === "fetch") {
|
|
6293
|
+
const url = stringValue(result["url"]);
|
|
6294
|
+
const statusCode = numberValue(result["statusCode"]);
|
|
6295
|
+
return url === void 0 || statusCode === void 0 ? null : {
|
|
6296
|
+
kind: "fetch",
|
|
6297
|
+
url,
|
|
6298
|
+
statusCode,
|
|
6299
|
+
truncated
|
|
6300
|
+
};
|
|
6301
|
+
}
|
|
6302
|
+
if (result["kind"] !== "search" || !Array.isArray(result["sources"])) return null;
|
|
6303
|
+
const sources = [];
|
|
6304
|
+
for (const item of result["sources"]) {
|
|
6305
|
+
const source = record(item);
|
|
6306
|
+
const url = stringValue(source?.["url"]);
|
|
6307
|
+
if (url === void 0) return null;
|
|
6308
|
+
const title = stringValue(source?.["title"]);
|
|
6309
|
+
const snippet = stringValue(source?.["snippet"]);
|
|
6310
|
+
const publishedAt = stringValue(source?.["publishedAt"]);
|
|
6311
|
+
sources.push({
|
|
6312
|
+
url,
|
|
6313
|
+
...title === void 0 ? {} : { title },
|
|
6314
|
+
...snippet === void 0 ? {} : { snippet },
|
|
6315
|
+
...publishedAt === void 0 ? {} : { publishedAt }
|
|
6316
|
+
});
|
|
6317
|
+
}
|
|
6318
|
+
const answer = stringValue(result["answer"]);
|
|
6319
|
+
return {
|
|
6320
|
+
kind: "search",
|
|
6321
|
+
sources,
|
|
6322
|
+
truncated,
|
|
6323
|
+
...answer === void 0 ? {} : { answer }
|
|
6324
|
+
};
|
|
6325
|
+
}
|
|
6326
|
+
function genericBody(variant, argsRaw) {
|
|
6327
|
+
if (argsRaw === "" || argsRaw === "{}") return null;
|
|
6328
|
+
if (variant === "read" || variant === "write" || variant === "edit") return null;
|
|
6329
|
+
return formattedArguments(argsRaw);
|
|
6330
|
+
}
|
|
6331
|
+
function leadingFor(state, icon) {
|
|
6332
|
+
if (state === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "error" });
|
|
6333
|
+
if (state === "interrupted") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "warning" });
|
|
6334
|
+
return icon;
|
|
6335
|
+
}
|
|
6336
|
+
function toolStatus(state) {
|
|
6337
|
+
if (state === "running" || state === "pending") return "Running";
|
|
6338
|
+
if (state === "error") return "Failed";
|
|
6339
|
+
if (state === "interrupted") return "Stopped";
|
|
6340
|
+
return null;
|
|
6341
|
+
}
|
|
6342
|
+
function ToolCard({ callId, name, argsRaw, state, output, callView, resultView, cwd }) {
|
|
6343
|
+
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
6344
|
+
const variant = classifyTool(name);
|
|
6345
|
+
const terminal = terminalCard(variant, argsRaw, state, output, callView, resultView, cwd);
|
|
6346
|
+
const terminalFailed = terminal !== null && !terminal.running && (terminal.exitCode !== void 0 && terminal.exitCode !== 0 || terminal.signal !== void 0);
|
|
6347
|
+
const visualState = state === "success" && terminalFailed ? "error" : state;
|
|
6348
|
+
const read = readCard(name, argsRaw, visualState, output, resultView, cwd);
|
|
6349
|
+
const search = validSearchCard(resultView);
|
|
6350
|
+
const diffs = validDiffs(resultView) ?? validDiffs(callView);
|
|
6351
|
+
const web = validWebCard(resultView);
|
|
6352
|
+
const args = parseArguments(argsRaw);
|
|
6353
|
+
const code = variant === "code" && args !== null ? stringValue(args["code"]) : void 0;
|
|
6354
|
+
const body = genericBody(variant, argsRaw);
|
|
6355
|
+
const summary = terminal?.description ?? stringValue(record(resultView)?.["title"]) ?? summaryFromArguments(name, variant, argsRaw, callId, cwd);
|
|
6356
|
+
const failureLine = visualState === "error" && output !== void 0 ? firstLine(output) : null;
|
|
6357
|
+
const summaryText = failureLine ?? summary;
|
|
6358
|
+
const expandable = terminal !== null || read !== null || search !== null || diffs !== null || web !== null || code !== void 0 || body !== null || output !== void 0;
|
|
6359
|
+
const open = expanded && expandable;
|
|
6360
|
+
const status = toolStatus(visualState);
|
|
5680
6361
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
5681
6362
|
className: "dsh-side-chat-tool",
|
|
5682
6363
|
"data-call-id": callId,
|
|
5683
|
-
"data-state":
|
|
5684
|
-
"data-expanded":
|
|
5685
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
"
|
|
5690
|
-
|
|
6364
|
+
"data-state": visualState,
|
|
6365
|
+
"data-expanded": open || void 0,
|
|
6366
|
+
children: [status !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6367
|
+
className: "dsh-side-chat-tool-visually-hidden",
|
|
6368
|
+
children: status
|
|
6369
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
|
|
6370
|
+
rowClassName: "dsh-side-chat-tool-row",
|
|
6371
|
+
leadingClassName: "dsh-side-chat-tool-leading",
|
|
6372
|
+
titleClassName: "dsh-side-chat-tool-title",
|
|
6373
|
+
chevronClassName: "dsh-side-chat-tool-chevron",
|
|
6374
|
+
icon: leadingFor(visualState, variantIcon(variant)),
|
|
6375
|
+
title: toolTitle(name, variant),
|
|
6376
|
+
open,
|
|
6377
|
+
expandable,
|
|
6378
|
+
expandOnRowClick: true,
|
|
6379
|
+
keepContentWhenOpen: true,
|
|
6380
|
+
onToggle: () => {
|
|
5691
6381
|
setExpanded((current) => !current);
|
|
5692
6382
|
},
|
|
5693
|
-
children: [
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
6383
|
+
collapsedContent: summaryText !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6384
|
+
className: "dsh-side-chat-tool-separator",
|
|
6385
|
+
"aria-hidden": "true"
|
|
6386
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6387
|
+
className: failureLine === null ? "dsh-side-chat-tool-summary" : "dsh-side-chat-tool-summary dsh-side-chat-tool-error-summary",
|
|
6388
|
+
children: summaryText
|
|
6389
|
+
})] }),
|
|
6390
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6391
|
+
className: "dsh-side-chat-tool-body-wrap",
|
|
6392
|
+
children: terminal !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.TerminalBlock, {
|
|
6393
|
+
command: terminal.command,
|
|
6394
|
+
cwd: terminal.cwd,
|
|
6395
|
+
output: terminal.output,
|
|
6396
|
+
exitCode: terminal.exitCode,
|
|
6397
|
+
signal: terminal.signal,
|
|
6398
|
+
running: terminal.running,
|
|
6399
|
+
maxLines: Infinity,
|
|
6400
|
+
className: "dsh-side-chat-tool-terminal"
|
|
6401
|
+
}) : read !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.ReadBlock, {
|
|
6402
|
+
...read,
|
|
6403
|
+
maxLines: 8,
|
|
6404
|
+
className: "dsh-side-chat-tool-read"
|
|
6405
|
+
}) : search !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SearchBlock, {
|
|
6406
|
+
...search,
|
|
6407
|
+
maxLines: 8,
|
|
6408
|
+
className: "dsh-side-chat-tool-search"
|
|
6409
|
+
}) : diffs !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.DiffBlock, {
|
|
6410
|
+
diffs,
|
|
6411
|
+
maxLines: 8,
|
|
6412
|
+
className: "dsh-side-chat-tool-diff"
|
|
6413
|
+
}) : web !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.WebBlock, {
|
|
6414
|
+
...web,
|
|
6415
|
+
className: "dsh-side-chat-tool-web"
|
|
6416
|
+
}) : code !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.CodeBlock, {
|
|
6417
|
+
code,
|
|
6418
|
+
lang: "typescript",
|
|
6419
|
+
copyLabel: "Copy",
|
|
6420
|
+
copiedLabel: "Copied",
|
|
6421
|
+
className: "dsh-side-chat-tool-code"
|
|
6422
|
+
}) : (body !== null || output !== void 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6423
|
+
className: "dsh-side-chat-tool-io-card",
|
|
6424
|
+
children: [
|
|
6425
|
+
body !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6426
|
+
className: "dsh-side-chat-tool-io-section",
|
|
6427
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6428
|
+
className: "dsh-side-chat-tool-io-label",
|
|
6429
|
+
children: "IN"
|
|
6430
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6431
|
+
className: "dsh-side-chat-tool-io-text",
|
|
6432
|
+
children: body
|
|
6433
|
+
})]
|
|
6434
|
+
}),
|
|
6435
|
+
body !== null && output !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6436
|
+
className: "dsh-side-chat-tool-io-divider",
|
|
6437
|
+
"aria-hidden": "true"
|
|
6438
|
+
}),
|
|
6439
|
+
output !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6440
|
+
className: "dsh-side-chat-tool-io-section",
|
|
6441
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6442
|
+
className: "dsh-side-chat-tool-io-label",
|
|
6443
|
+
children: "OUT"
|
|
6444
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6445
|
+
className: "dsh-side-chat-tool-io-text",
|
|
6446
|
+
"data-error": visualState === "error" || void 0,
|
|
6447
|
+
children: output
|
|
6448
|
+
})]
|
|
6449
|
+
})
|
|
6450
|
+
]
|
|
5709
6451
|
})
|
|
5710
|
-
|
|
5711
|
-
}), expanded && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5712
|
-
className: "dsh-side-chat-tool-body",
|
|
5713
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: "Input" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", { children: formattedToolArguments(argsRaw) })] }), output !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: "Output" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", { children: output })] })]
|
|
6452
|
+
})
|
|
5714
6453
|
})]
|
|
5715
6454
|
});
|
|
5716
6455
|
}
|
|
5717
|
-
function
|
|
5718
|
-
|
|
5719
|
-
const
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
6456
|
+
function resultState(node, output) {
|
|
6457
|
+
if (!node.isError) return "success";
|
|
6458
|
+
const identity = `${node.error?.name ?? ""} ${node.error?.code ?? ""} ${output}`;
|
|
6459
|
+
return /\b(?:aborted|cancelled|canceled)\b/iu.test(identity) ? "interrupted" : "error";
|
|
6460
|
+
}
|
|
6461
|
+
function ToolBlockCard({ block, cwd }) {
|
|
6462
|
+
const settled = "kind" in block;
|
|
6463
|
+
const output = settled ? toolOutputText(block.content) : void 0;
|
|
6464
|
+
const state = settled ? resultState(block, output ?? "") : "running";
|
|
6465
|
+
const name = settled ? block.call?.name ?? block.callId : block.name;
|
|
6466
|
+
const argsRaw = settled ? block.call?.argsRaw ?? "{}" : block.argsRaw;
|
|
6467
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6468
|
+
className: "dsh-side-chat-tool-branch",
|
|
6469
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolCard, {
|
|
6470
|
+
callId: block.callId,
|
|
6471
|
+
name,
|
|
6472
|
+
argsRaw,
|
|
6473
|
+
state,
|
|
6474
|
+
output,
|
|
6475
|
+
callView: block.callView,
|
|
6476
|
+
resultView: settled ? block.resultView : null,
|
|
6477
|
+
cwd
|
|
6478
|
+
}), block.subCalls.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6479
|
+
className: "dsh-side-chat-tool-subcalls",
|
|
6480
|
+
"data-subcalls": true,
|
|
6481
|
+
children: block.subCalls.map((child) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolBlockCard, {
|
|
6482
|
+
block: child,
|
|
6483
|
+
cwd
|
|
6484
|
+
}, child.callId))
|
|
6485
|
+
})]
|
|
5727
6486
|
});
|
|
5728
6487
|
}
|
|
5729
|
-
function RunningToolCard({ call }) {
|
|
5730
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
argsRaw: call.argsRaw,
|
|
5734
|
-
state: "running"
|
|
6488
|
+
function RunningToolCard({ call, cwd }) {
|
|
6489
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolBlockCard, {
|
|
6490
|
+
block: call,
|
|
6491
|
+
cwd
|
|
5735
6492
|
});
|
|
5736
6493
|
}
|
|
5737
|
-
|
|
6494
|
+
//#endregion
|
|
6495
|
+
//#region src/client/rc6/ArchivedConversation.tsx
|
|
6496
|
+
function stringify(value) {
|
|
6497
|
+
if (typeof value === "string") return value;
|
|
6498
|
+
try {
|
|
6499
|
+
return JSON.stringify(value, null, 2);
|
|
6500
|
+
} catch {
|
|
6501
|
+
return String(value);
|
|
6502
|
+
}
|
|
6503
|
+
}
|
|
6504
|
+
function contentText(content) {
|
|
6505
|
+
return content.map((block) => {
|
|
6506
|
+
if (block.type === "text" || block.type === "reasoning") return block.text;
|
|
6507
|
+
if (block.type === "image") return "[Image]";
|
|
6508
|
+
if (block.type === "tool-call") return `${block.name}(${block.arguments})`;
|
|
6509
|
+
if (block.type === "tool-result") return contentText(block.content);
|
|
6510
|
+
return stringify(block);
|
|
6511
|
+
}).filter(Boolean).join("\n");
|
|
6512
|
+
}
|
|
6513
|
+
function firstSideChatQuestion(text) {
|
|
6514
|
+
return /<user_question>([\s\S]*?)<\/user_question>/u.exec(text)?.[1]?.trim() ?? text;
|
|
6515
|
+
}
|
|
6516
|
+
function AssistantBlocks({ blocks, streaming = false, projectedToolCallIds, unprojectedToolState = "pending", cwd }) {
|
|
5738
6517
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: blocks.map((block, index) => {
|
|
5739
6518
|
const key = `${block.kind}-${String(index)}`;
|
|
5740
6519
|
if (block.kind === "text") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
|
|
@@ -5752,13 +6531,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5752
6531
|
callId: block.callId,
|
|
5753
6532
|
name: block.name,
|
|
5754
6533
|
argsRaw: block.argsRaw,
|
|
5755
|
-
state: unprojectedToolState
|
|
6534
|
+
state: unprojectedToolState,
|
|
6535
|
+
cwd
|
|
5756
6536
|
}, key);
|
|
5757
6537
|
}
|
|
5758
6538
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", { children: stringify(block.block) }, key);
|
|
5759
6539
|
}) });
|
|
5760
6540
|
}
|
|
5761
|
-
function MessageRow({ node, projectedToolCallIds }) {
|
|
6541
|
+
function MessageRow({ node, projectedToolCallIds, cwd }) {
|
|
5762
6542
|
if (node.kind === "user" || node.kind === "steering") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
|
|
5763
6543
|
className: "dsh-side-chat-message",
|
|
5764
6544
|
"data-role": "user",
|
|
@@ -5781,7 +6561,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5781
6561
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AssistantBlocks, {
|
|
5782
6562
|
blocks: node.blocks,
|
|
5783
6563
|
projectedToolCallIds,
|
|
5784
|
-
unprojectedToolState: node.interrupted === true ? "interrupted" : "pending"
|
|
6564
|
+
unprojectedToolState: node.interrupted === true ? "interrupted" : "pending",
|
|
6565
|
+
cwd
|
|
5785
6566
|
}),
|
|
5786
6567
|
node.interrupted === true && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5787
6568
|
className: "dsh-side-chat-message-note",
|
|
@@ -5793,7 +6574,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5793
6574
|
className: "dsh-side-chat-message dsh-side-chat-context-message",
|
|
5794
6575
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("summary", { children: ["Context · ", node.provenance.label ?? node.provenance.role] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", { children: contentText(node.content) })]
|
|
5795
6576
|
});
|
|
5796
|
-
if (node.kind === "tool-result") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
6577
|
+
if (node.kind === "tool-result") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolBlockCard, {
|
|
6578
|
+
block: node,
|
|
6579
|
+
cwd
|
|
6580
|
+
});
|
|
5797
6581
|
if (node.kind === "turn-error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5798
6582
|
className: "dsh-side-chat-turn-notice",
|
|
5799
6583
|
role: "alert",
|
|
@@ -5963,7 +6747,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5963
6747
|
});
|
|
5964
6748
|
}
|
|
5965
6749
|
/** Functional rc.6 conversation surface bound to a non-current child Session. */
|
|
5966
|
-
function ArchivedConversation({ face, inheritedThroughSeq, controller, selection, locale = "en" }) {
|
|
6750
|
+
function ArchivedConversation({ face, inheritedThroughSeq, controller, selection, locale = "en", cwd }) {
|
|
5967
6751
|
const snapshot = (0, react.useSyncExternalStore)((listener) => face.subscribe(listener), () => face.getSnapshot(), () => face.getSnapshot());
|
|
5968
6752
|
const [draft, setDraft] = (0, react.useState)("");
|
|
5969
6753
|
const [sending, setSending] = (0, react.useState)(false);
|
|
@@ -6016,11 +6800,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6016
6800
|
messages: SIDE_CHAT_MESSAGES[locale]
|
|
6017
6801
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MessageRow, {
|
|
6018
6802
|
node,
|
|
6019
|
-
projectedToolCallIds
|
|
6803
|
+
projectedToolCallIds,
|
|
6804
|
+
cwd
|
|
6020
6805
|
})]
|
|
6021
6806
|
}, `${node.kind}-${String(node.seq)}`) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MessageRow, {
|
|
6022
6807
|
node,
|
|
6023
|
-
projectedToolCallIds
|
|
6808
|
+
projectedToolCallIds,
|
|
6809
|
+
cwd
|
|
6024
6810
|
}, `${node.kind}-${String(node.seq)}`)),
|
|
6025
6811
|
snapshot.partial !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
|
|
6026
6812
|
className: "dsh-side-chat-message",
|
|
@@ -6032,10 +6818,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6032
6818
|
blocks: snapshot.partial.blocks,
|
|
6033
6819
|
streaming: true,
|
|
6034
6820
|
projectedToolCallIds,
|
|
6035
|
-
unprojectedToolState: "running"
|
|
6821
|
+
unprojectedToolState: "running",
|
|
6822
|
+
cwd
|
|
6036
6823
|
})]
|
|
6037
6824
|
}),
|
|
6038
|
-
runningCalls.map((call) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RunningToolCard, {
|
|
6825
|
+
runningCalls.map((call) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RunningToolCard, {
|
|
6826
|
+
call,
|
|
6827
|
+
cwd
|
|
6828
|
+
}, call.callId)),
|
|
6039
6829
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PendingCards, {
|
|
6040
6830
|
pending: snapshot.pending,
|
|
6041
6831
|
controller
|
|
@@ -6094,6 +6884,89 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6094
6884
|
return value;
|
|
6095
6885
|
}
|
|
6096
6886
|
//#endregion
|
|
6887
|
+
//#region src/client/parent-composer/annotation-persistence.ts
|
|
6888
|
+
const STORAGE_PREFIX = "dsh-side-chat:composer-annotations:";
|
|
6889
|
+
function browserSessionStorage() {
|
|
6890
|
+
if (typeof window === "undefined") return;
|
|
6891
|
+
try {
|
|
6892
|
+
return window.sessionStorage;
|
|
6893
|
+
} catch {
|
|
6894
|
+
return;
|
|
6895
|
+
}
|
|
6896
|
+
}
|
|
6897
|
+
function storageKey(sessionId) {
|
|
6898
|
+
return `${STORAGE_PREFIX}${encodeURIComponent(sessionId)}`;
|
|
6899
|
+
}
|
|
6900
|
+
function recordOf(snapshot) {
|
|
6901
|
+
const ref = conversationAnnotationReference(snapshot);
|
|
6902
|
+
return ref === void 0 ? void 0 : {
|
|
6903
|
+
version: 1,
|
|
6904
|
+
draft: snapshot.draft,
|
|
6905
|
+
ref
|
|
6906
|
+
};
|
|
6907
|
+
}
|
|
6908
|
+
/** Tab-scoped recovery for rc.6 drafts that persist U+FFFC without occurrences. */
|
|
6909
|
+
var ConversationAnnotationPersistence = class {
|
|
6910
|
+
storage;
|
|
6911
|
+
observedSessions = /* @__PURE__ */ new Set();
|
|
6912
|
+
constructor(storage = browserSessionStorage()) {
|
|
6913
|
+
this.storage = storage;
|
|
6914
|
+
}
|
|
6915
|
+
reconcile(sessionId, input) {
|
|
6916
|
+
const key = storageKey(sessionId);
|
|
6917
|
+
const snapshot = input.state.getSnapshot();
|
|
6918
|
+
const current = recordOf(snapshot);
|
|
6919
|
+
if (current !== void 0) {
|
|
6920
|
+
this.observedSessions.add(key);
|
|
6921
|
+
this.write(key, current);
|
|
6922
|
+
return;
|
|
6923
|
+
}
|
|
6924
|
+
const stored = this.read(key);
|
|
6925
|
+
if (stored !== void 0 && snapshot.draft === stored.draft) {
|
|
6926
|
+
this.observedSessions.add(key);
|
|
6927
|
+
if (restoreConversationAnnotationReference(input, stored.ref)) return;
|
|
6928
|
+
this.remove(key);
|
|
6929
|
+
removeOrphanedConversationAnnotationPlaceholder(input);
|
|
6930
|
+
return;
|
|
6931
|
+
}
|
|
6932
|
+
if (this.observedSessions.has(key)) {
|
|
6933
|
+
this.remove(key);
|
|
6934
|
+
removeOrphanedConversationAnnotationPlaceholder(input);
|
|
6935
|
+
return;
|
|
6936
|
+
}
|
|
6937
|
+
if (stored !== void 0 && snapshot.draft === "") return;
|
|
6938
|
+
if (stored !== void 0) this.remove(key);
|
|
6939
|
+
removeOrphanedConversationAnnotationPlaceholder(input);
|
|
6940
|
+
}
|
|
6941
|
+
read(key) {
|
|
6942
|
+
if (this.storage === void 0) return;
|
|
6943
|
+
try {
|
|
6944
|
+
const raw = this.storage.getItem(key);
|
|
6945
|
+
if (raw === null) return;
|
|
6946
|
+
const value = JSON.parse(raw);
|
|
6947
|
+
return value.version === 1 && typeof value.draft === "string" && typeof value.ref === "string" ? {
|
|
6948
|
+
version: 1,
|
|
6949
|
+
draft: value.draft,
|
|
6950
|
+
ref: value.ref
|
|
6951
|
+
} : void 0;
|
|
6952
|
+
} catch {
|
|
6953
|
+
return;
|
|
6954
|
+
}
|
|
6955
|
+
}
|
|
6956
|
+
write(key, record) {
|
|
6957
|
+
if (this.storage === void 0) return;
|
|
6958
|
+
try {
|
|
6959
|
+
this.storage.setItem(key, JSON.stringify(record));
|
|
6960
|
+
} catch {}
|
|
6961
|
+
}
|
|
6962
|
+
remove(key) {
|
|
6963
|
+
if (this.storage === void 0) return;
|
|
6964
|
+
try {
|
|
6965
|
+
this.storage.removeItem(key);
|
|
6966
|
+
} catch {}
|
|
6967
|
+
}
|
|
6968
|
+
};
|
|
6969
|
+
//#endregion
|
|
6097
6970
|
//#region src/client/rc6/sessions-adapter.ts
|
|
6098
6971
|
const BINDING_WAIT_MS = 8e3;
|
|
6099
6972
|
function sideChatError(error, fallback) {
|
|
@@ -6235,11 +7108,34 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6235
7108
|
var Rc6SideChatSessions = class {
|
|
6236
7109
|
ctx;
|
|
6237
7110
|
renamed = /* @__PURE__ */ new Set();
|
|
7111
|
+
annotationPersistence = new ConversationAnnotationPersistence();
|
|
6238
7112
|
constructor(ctx) {
|
|
6239
7113
|
this.ctx = ctx;
|
|
6240
7114
|
}
|
|
6241
7115
|
/** Observable rc.6 Session-list surface used to follow main-session switches. */
|
|
6242
7116
|
subscribeList = (listener) => this.ctx.sessions.list.subscribe(listener);
|
|
7117
|
+
/** Follow both current-session switches and that session's composer state. */
|
|
7118
|
+
subscribeConversationInput = (listener) => {
|
|
7119
|
+
let input;
|
|
7120
|
+
let removeInputListener = () => {};
|
|
7121
|
+
const bindInput = () => {
|
|
7122
|
+
const next = this.currentParentInput();
|
|
7123
|
+
if (next === input) return;
|
|
7124
|
+
removeInputListener();
|
|
7125
|
+
input = next;
|
|
7126
|
+
removeInputListener = input?.state.subscribe?.(listener) ?? (() => {});
|
|
7127
|
+
};
|
|
7128
|
+
bindInput();
|
|
7129
|
+
const removeListListener = this.ctx.sessions.list.subscribe(() => {
|
|
7130
|
+
bindInput();
|
|
7131
|
+
listener();
|
|
7132
|
+
});
|
|
7133
|
+
return () => {
|
|
7134
|
+
removeListListener();
|
|
7135
|
+
removeInputListener();
|
|
7136
|
+
};
|
|
7137
|
+
};
|
|
7138
|
+
currentConversationInputSnapshot = () => this.currentParentInput()?.state.getSnapshot();
|
|
6243
7139
|
currentSessionId() {
|
|
6244
7140
|
const current = this.ctx.sessions.list.getSnapshot().current;
|
|
6245
7141
|
return current === void 0 ? void 0 : SessionId(current);
|
|
@@ -6260,25 +7156,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6260
7156
|
/** Add one selected passage to the native composer of its parent Session. */
|
|
6261
7157
|
addSelectionToConversation(selection, comment) {
|
|
6262
7158
|
if (this.currentSessionId() !== selection.parentSessionId) return false;
|
|
6263
|
-
const
|
|
6264
|
-
if (
|
|
6265
|
-
|
|
7159
|
+
const input = this.currentParentInput();
|
|
7160
|
+
if (input === void 0 || !addSelectionToConversation(input, selection, comment)) return false;
|
|
7161
|
+
this.annotationPersistence.reconcile(selection.parentSessionId, input);
|
|
7162
|
+
return true;
|
|
7163
|
+
}
|
|
7164
|
+
/** Update an existing unsent annotation without adding a duplicate passage. */
|
|
7165
|
+
updateConversationAnnotation(annotationIndex, comment) {
|
|
7166
|
+
const sessionId = this.currentSessionId();
|
|
7167
|
+
const input = this.currentParentInput();
|
|
7168
|
+
if (sessionId === void 0 || input === void 0 || !updateConversationAnnotation(input, annotationIndex, comment)) return false;
|
|
7169
|
+
this.annotationPersistence.reconcile(sessionId, input);
|
|
7170
|
+
return true;
|
|
7171
|
+
}
|
|
7172
|
+
/** Mirror or recover the current Session's unsent annotation occurrence. */
|
|
7173
|
+
reconcileConversationAnnotationPersistence() {
|
|
7174
|
+
const sessionId = this.currentSessionId();
|
|
7175
|
+
const input = this.currentParentInput();
|
|
7176
|
+
if (sessionId !== void 0 && input !== void 0) this.annotationPersistence.reconcile(sessionId, input);
|
|
6266
7177
|
}
|
|
6267
7178
|
/** Number assigned to the next annotation shown beside the selected passage. */
|
|
6268
7179
|
nextConversationAnnotationNumber() {
|
|
6269
|
-
const
|
|
6270
|
-
|
|
6271
|
-
const scope = this.ctx.sessions.scope(dshSessionId(sessionId));
|
|
6272
|
-
if (scope === void 0) return 1;
|
|
6273
|
-
return conversationAnnotations(this.ctx.conversation.input.for(scope).state.getSnapshot()).length + 1;
|
|
7180
|
+
const snapshot = this.currentConversationInputSnapshot();
|
|
7181
|
+
return snapshot === void 0 ? 1 : conversationAnnotations(snapshot).length + 1;
|
|
6274
7182
|
}
|
|
6275
7183
|
/** Remove the current Session's unsent selected-passage annotations. */
|
|
6276
7184
|
removeConversationAnnotations() {
|
|
6277
7185
|
const sessionId = this.currentSessionId();
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
return
|
|
7186
|
+
const input = this.currentParentInput();
|
|
7187
|
+
if (sessionId === void 0 || input === void 0 || !removeConversationAnnotations(input)) return false;
|
|
7188
|
+
this.annotationPersistence.reconcile(sessionId, input);
|
|
7189
|
+
return true;
|
|
6282
7190
|
}
|
|
6283
7191
|
async retain(sessionId) {
|
|
6284
7192
|
const binding = await this.waitForBinding(dshSessionId(sessionId));
|
|
@@ -6308,6 +7216,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6308
7216
|
title(sessionId) {
|
|
6309
7217
|
return this.ctx.sessions.list.getSnapshot().byId[dshSessionId(sessionId)]?.displayTitle;
|
|
6310
7218
|
}
|
|
7219
|
+
cwd(sessionId) {
|
|
7220
|
+
return this.ctx.sessions.list.getSnapshot().byId[dshSessionId(sessionId)]?.cwd;
|
|
7221
|
+
}
|
|
7222
|
+
currentParentInput() {
|
|
7223
|
+
const sessionId = this.currentSessionId();
|
|
7224
|
+
if (sessionId === void 0) return;
|
|
7225
|
+
const scope = this.ctx.sessions.scope(dshSessionId(sessionId));
|
|
7226
|
+
return scope === void 0 ? void 0 : this.ctx.conversation.input.for(scope);
|
|
7227
|
+
}
|
|
6311
7228
|
waitForBinding(sessionId) {
|
|
6312
7229
|
const immediate = this.ctx.sessions.binding(sessionId);
|
|
6313
7230
|
if (immediate !== void 0) return Promise.resolve(immediate);
|
|
@@ -6358,7 +7275,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6358
7275
|
return !(target instanceof Element && target.closest([
|
|
6359
7276
|
"[data-side-chat-panel]",
|
|
6360
7277
|
".dsh-side-chat-selection-actions",
|
|
6361
|
-
".dsh-side-chat-selection-comment"
|
|
7278
|
+
".dsh-side-chat-selection-comment",
|
|
7279
|
+
".dsh-side-chat-annotation-marker"
|
|
6362
7280
|
].join(", ")) !== null);
|
|
6363
7281
|
}
|
|
6364
7282
|
function focusParentComposer() {
|
|
@@ -6384,7 +7302,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6384
7302
|
function Rc6SideChatOverlay({ controller, sessions }) {
|
|
6385
7303
|
const state = (0, react.useSyncExternalStore)(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
|
|
6386
7304
|
const currentSessionId = (0, react.useSyncExternalStore)(sessions.subscribeList, () => sessions.currentSessionId(), () => sessions.currentSessionId());
|
|
7305
|
+
const composerInput = (0, react.useSyncExternalStore)(sessions.subscribeConversationInput, sessions.currentConversationInputSnapshot, sessions.currentConversationInputSnapshot);
|
|
7306
|
+
const annotations = (0, react.useMemo)(() => composerInput === void 0 ? [] : conversationSelectionAnnotations(composerInput), [composerInput]);
|
|
6387
7307
|
const [selection, setSelection] = (0, react.useState)(null);
|
|
7308
|
+
const [editingAnnotation, setEditingAnnotation] = (0, react.useState)(null);
|
|
6388
7309
|
const captureGeneration = (0, react.useRef)(0);
|
|
6389
7310
|
const mouseDownPoint = (0, react.useRef)(null);
|
|
6390
7311
|
const annotationEditing = (0, react.useRef)(false);
|
|
@@ -6427,6 +7348,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6427
7348
|
annotationEditing.current = false;
|
|
6428
7349
|
++captureGeneration.current;
|
|
6429
7350
|
setSelection(null);
|
|
7351
|
+
setEditingAnnotation(null);
|
|
6430
7352
|
};
|
|
6431
7353
|
const onMouseUp = (event) => {
|
|
6432
7354
|
const start = mouseDownPoint.current;
|
|
@@ -6444,7 +7366,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6444
7366
|
const onKeyUp = (event) => {
|
|
6445
7367
|
if (event.key === "Escape") {
|
|
6446
7368
|
++captureGeneration.current;
|
|
7369
|
+
annotationEditing.current = false;
|
|
6447
7370
|
setSelection(null);
|
|
7371
|
+
setEditingAnnotation(null);
|
|
6448
7372
|
controller.close();
|
|
6449
7373
|
return;
|
|
6450
7374
|
}
|
|
@@ -6465,79 +7389,139 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6465
7389
|
++captureGeneration.current;
|
|
6466
7390
|
annotationEditing.current = false;
|
|
6467
7391
|
setSelection(null);
|
|
7392
|
+
setEditingAnnotation(null);
|
|
6468
7393
|
}, [currentSessionId]);
|
|
7394
|
+
(0, react.useEffect)(() => {
|
|
7395
|
+
if (composerInput !== void 0) sessions.reconcileConversationAnnotationPersistence();
|
|
7396
|
+
}, [composerInput, sessions]);
|
|
7397
|
+
(0, react.useEffect)(() => {
|
|
7398
|
+
if (editingAnnotation === null) return;
|
|
7399
|
+
if (annotations.some((annotation) => annotation.annotationIndex === editingAnnotation.annotationIndex)) return;
|
|
7400
|
+
annotationEditing.current = false;
|
|
7401
|
+
setEditingAnnotation(null);
|
|
7402
|
+
}, [annotations, editingAnnotation]);
|
|
6469
7403
|
const askDisabledReason = state.phase === "closed" ? void 0 : "Close the current Side Chat before starting another one.";
|
|
6470
7404
|
const childFace = state.childSessionId === void 0 ? void 0 : sessions.face(state.childSessionId);
|
|
7405
|
+
const childCwd = state.childSessionId === void 0 ? void 0 : sessions.cwd(state.childSessionId);
|
|
6471
7406
|
const inheritedThroughSeq = state.inheritedThroughSeq;
|
|
6472
7407
|
const locale = navigator.language.toLowerCase().startsWith("zh") ? "zh-CN" : "en";
|
|
6473
7408
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6474
7409
|
className: "dsh-side-chat-overlay",
|
|
6475
|
-
children: [
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
7410
|
+
children: [
|
|
7411
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConversationAnnotationMarkers, {
|
|
7412
|
+
annotations,
|
|
7413
|
+
...editingAnnotation === null ? {} : { activeAnnotationIndex: editingAnnotation.annotationIndex },
|
|
7414
|
+
onEdit: (annotation, restoredSelection) => {
|
|
7415
|
+
annotationEditing.current = true;
|
|
7416
|
+
++captureGeneration.current;
|
|
7417
|
+
setSelection(null);
|
|
7418
|
+
setEditingAnnotation({
|
|
7419
|
+
...annotation,
|
|
7420
|
+
selection: restoredSelection
|
|
7421
|
+
});
|
|
7422
|
+
}
|
|
7423
|
+
}),
|
|
7424
|
+
selection !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectionActions, {
|
|
7425
|
+
selection,
|
|
7426
|
+
annotationNumber: sessions.nextConversationAnnotationNumber(),
|
|
7427
|
+
...askDisabledReason === void 0 ? {} : { askDisabledReason },
|
|
7428
|
+
onAddToChat: (captured, comment) => {
|
|
7429
|
+
try {
|
|
7430
|
+
if (sessions.addSelectionToConversation(captured, comment)) focusParentComposer();
|
|
7431
|
+
else sessions.notify({
|
|
7432
|
+
kind: "warning",
|
|
7433
|
+
text: "Could not add the selection to the current chat."
|
|
7434
|
+
});
|
|
7435
|
+
} catch {
|
|
7436
|
+
sessions.notify({
|
|
7437
|
+
kind: "warning",
|
|
7438
|
+
text: "Could not add the selection to the current chat."
|
|
7439
|
+
});
|
|
7440
|
+
}
|
|
7441
|
+
setSelection(null);
|
|
7442
|
+
},
|
|
7443
|
+
onAnnotationEditorChange: (open) => {
|
|
7444
|
+
annotationEditing.current = open;
|
|
7445
|
+
},
|
|
7446
|
+
onMoreDetails: (captured) => {
|
|
7447
|
+
const opened = controller.openDraft({ selection: captured });
|
|
7448
|
+
if (!opened.ok) sessions.notify({
|
|
6483
7449
|
kind: "warning",
|
|
6484
|
-
text:
|
|
7450
|
+
text: opened.error.message
|
|
6485
7451
|
});
|
|
6486
|
-
|
|
6487
|
-
|
|
7452
|
+
else controller.sendFirst(MORE_DETAILS_PROMPT);
|
|
7453
|
+
setSelection(null);
|
|
7454
|
+
},
|
|
7455
|
+
onAskInSideChat: (captured) => {
|
|
7456
|
+
const opened = controller.openDraft({ selection: captured });
|
|
7457
|
+
if (!opened.ok) sessions.notify({
|
|
6488
7458
|
kind: "warning",
|
|
6489
|
-
text:
|
|
7459
|
+
text: opened.error.message
|
|
6490
7460
|
});
|
|
7461
|
+
setSelection(null);
|
|
7462
|
+
},
|
|
7463
|
+
onDismiss: () => {
|
|
7464
|
+
annotationEditing.current = false;
|
|
7465
|
+
setSelection(null);
|
|
6491
7466
|
}
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
7467
|
+
}),
|
|
7468
|
+
editingAnnotation !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectionActions, {
|
|
7469
|
+
selection: editingAnnotation.selection,
|
|
7470
|
+
annotationNumber: editingAnnotation.annotationIndex + 1,
|
|
7471
|
+
annotationEditor: {
|
|
7472
|
+
...editingAnnotation.comment === void 0 ? {} : { initialComment: editingAnnotation.comment },
|
|
7473
|
+
dialogLabel: "Edit annotation comment"
|
|
7474
|
+
},
|
|
7475
|
+
onAddToChat: (_captured, comment) => {
|
|
7476
|
+
try {
|
|
7477
|
+
if (!sessions.updateConversationAnnotation(editingAnnotation.annotationIndex, comment)) sessions.notify({
|
|
7478
|
+
kind: "warning",
|
|
7479
|
+
text: "Could not update the annotation."
|
|
7480
|
+
});
|
|
7481
|
+
} catch {
|
|
7482
|
+
sessions.notify({
|
|
7483
|
+
kind: "warning",
|
|
7484
|
+
text: "Could not update the annotation."
|
|
7485
|
+
});
|
|
7486
|
+
}
|
|
7487
|
+
annotationEditing.current = false;
|
|
7488
|
+
setEditingAnnotation(null);
|
|
7489
|
+
},
|
|
7490
|
+
onAnnotationEditorChange: (open) => {
|
|
7491
|
+
annotationEditing.current = open;
|
|
7492
|
+
},
|
|
7493
|
+
onMoreDetails: () => {},
|
|
7494
|
+
onAskInSideChat: () => {},
|
|
7495
|
+
onDismiss: () => {
|
|
7496
|
+
annotationEditing.current = false;
|
|
7497
|
+
setEditingAnnotation(null);
|
|
7498
|
+
}
|
|
7499
|
+
}, `annotation:${String(editingAnnotation.annotationIndex)}`),
|
|
7500
|
+
state.phase !== "closed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SideChatPanel, {
|
|
7501
|
+
state,
|
|
7502
|
+
locale,
|
|
7503
|
+
...childFace === void 0 || inheritedThroughSeq === void 0 ? {} : { embeddedConversation: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArchivedConversation, {
|
|
7504
|
+
face: childFace,
|
|
7505
|
+
inheritedThroughSeq,
|
|
7506
|
+
controller,
|
|
7507
|
+
cwd: childCwd,
|
|
7508
|
+
...state.selection === void 0 ? {} : { selection: state.selection },
|
|
7509
|
+
locale
|
|
7510
|
+
}) },
|
|
7511
|
+
onDraftChange: (draft) => {
|
|
7512
|
+
controller.setDraft(draft);
|
|
7513
|
+
},
|
|
7514
|
+
onFirstSend: (question) => controller.sendFirst(question),
|
|
7515
|
+
onClose: () => controller.close(),
|
|
7516
|
+
onRetry: () => controller.retry(),
|
|
7517
|
+
onFocusParent: () => {
|
|
7518
|
+
if (state.parentSessionId !== void 0) sessions.openSession(state.parentSessionId);
|
|
7519
|
+
},
|
|
7520
|
+
onRemoveSelection: () => {
|
|
7521
|
+
controller.clearSelection();
|
|
7522
|
+
}
|
|
7523
|
+
})
|
|
7524
|
+
]
|
|
6541
7525
|
});
|
|
6542
7526
|
}
|
|
6543
7527
|
//#endregion
|
|
@@ -6597,6 +7581,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6597
7581
|
exports.inject = inject;
|
|
6598
7582
|
exports.name = name;
|
|
6599
7583
|
exports.normalizeSelectedText = normalizeSelectedText;
|
|
7584
|
+
exports.restoreDomConversationSelection = restoreDomConversationSelection;
|
|
6600
7585
|
exports.selectionFitsLimit = selectionFitsLimit;
|
|
6601
7586
|
exports.summarizeSelection = summarizeSelection;
|
|
6602
7587
|
exports.utf8ByteLength = utf8ByteLength;
|