@buoy-gg/ask-buoy 7.0.34 → 7.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -8
- package/lib/commonjs/blocks/AskBlocks.js +338 -1
- package/lib/commonjs/blocks/AskBlocks.js.map +1 -0
- package/lib/commonjs/blocks/BlockRenderer.js +262 -1
- package/lib/commonjs/blocks/BlockRenderer.js.map +1 -0
- package/lib/commonjs/blocks/ChromePrototypes.js +514 -1
- package/lib/commonjs/blocks/ChromePrototypes.js.map +1 -0
- package/lib/commonjs/blocks/DataBlocks.js +781 -1
- package/lib/commonjs/blocks/DataBlocks.js.map +1 -0
- package/lib/commonjs/blocks/ExtraBlocks.js +1860 -1
- package/lib/commonjs/blocks/ExtraBlocks.js.map +1 -0
- package/lib/commonjs/blocks/MediaBlocks.js +156 -1
- package/lib/commonjs/blocks/MediaBlocks.js.map +1 -0
- package/lib/commonjs/blocks/ReceiptBlocks.js +586 -1
- package/lib/commonjs/blocks/ReceiptBlocks.js.map +1 -0
- package/lib/commonjs/blocks/blockText.js +60 -0
- package/lib/commonjs/blocks/blockText.js.map +1 -0
- package/lib/commonjs/blocks/blockText.test.js +53 -0
- package/lib/commonjs/blocks/blockText.test.js.map +1 -0
- package/lib/commonjs/blocks/context.js +42 -1
- package/lib/commonjs/blocks/context.js.map +1 -0
- package/lib/commonjs/blocks/icons.js +96 -1
- package/lib/commonjs/blocks/icons.js.map +1 -0
- package/lib/commonjs/blocks/index.js +95 -1
- package/lib/commonjs/blocks/index.js.map +1 -0
- package/lib/commonjs/blocks/listRow.test.js +55 -0
- package/lib/commonjs/blocks/listRow.test.js.map +1 -0
- package/lib/commonjs/blocks/pageState.js +34 -0
- package/lib/commonjs/blocks/pageState.js.map +1 -0
- package/lib/commonjs/blocks/pageState.test.js +57 -0
- package/lib/commonjs/blocks/pageState.test.js.map +1 -0
- package/lib/commonjs/blocks/primitives.js +457 -1
- package/lib/commonjs/blocks/primitives.js.map +1 -0
- package/lib/commonjs/blocks/primitivesIndex.js +62 -1
- package/lib/commonjs/blocks/primitivesIndex.js.map +1 -0
- package/lib/commonjs/components/ApprovalCard.js +244 -1
- package/lib/commonjs/components/ApprovalCard.js.map +1 -0
- package/lib/commonjs/components/AskBuoyHeader.js +196 -1
- package/lib/commonjs/components/AskBuoyHeader.js.map +1 -0
- package/lib/commonjs/components/AskBuoyIcon.js +19 -1
- package/lib/commonjs/components/AskBuoyIcon.js.map +1 -0
- package/lib/commonjs/components/AskBuoyModal.js +479 -1
- package/lib/commonjs/components/AskBuoyModal.js.map +1 -0
- package/lib/commonjs/components/AskBuoySettings.js +119 -0
- package/lib/commonjs/components/AskBuoySettings.js.map +1 -0
- package/lib/commonjs/components/ChangesBar.js +211 -1
- package/lib/commonjs/components/ChangesBar.js.map +1 -0
- package/lib/commonjs/components/Composer.js +255 -1
- package/lib/commonjs/components/Composer.js.map +1 -0
- package/lib/commonjs/components/EmptyState.js +161 -1
- package/lib/commonjs/components/EmptyState.js.map +1 -0
- package/lib/commonjs/components/KeyboardPad.js +80 -0
- package/lib/commonjs/components/KeyboardPad.js.map +1 -0
- package/lib/commonjs/components/Markdown.js +310 -1
- package/lib/commonjs/components/Markdown.js.map +1 -0
- package/lib/commonjs/components/MessageList.js +930 -1
- package/lib/commonjs/components/MessageList.js.map +1 -0
- package/lib/commonjs/components/QueuedMessages.js +145 -0
- package/lib/commonjs/components/QueuedMessages.js.map +1 -0
- package/lib/commonjs/components/ThinkingStrip.js +223 -0
- package/lib/commonjs/components/ThinkingStrip.js.map +1 -0
- package/lib/commonjs/components/TypingDots.js +63 -1
- package/lib/commonjs/components/TypingDots.js.map +1 -0
- package/lib/commonjs/components/markdownParse.js +131 -0
- package/lib/commonjs/components/markdownParse.js.map +1 -0
- package/lib/commonjs/components/markdownParse.test.js +99 -0
- package/lib/commonjs/components/markdownParse.test.js.map +1 -0
- package/lib/commonjs/components/useCopyAction.js +50 -0
- package/lib/commonjs/components/useCopyAction.js.map +1 -0
- package/lib/commonjs/index.js +252 -1
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/preset.js +90 -1
- package/lib/commonjs/preset.js.map +1 -0
- package/lib/commonjs/store/activityGroups.js +110 -0
- package/lib/commonjs/store/activityGroups.js.map +1 -0
- package/lib/commonjs/store/activityGroups.test.js +78 -0
- package/lib/commonjs/store/activityGroups.test.js.map +1 -0
- package/lib/commonjs/store/askBuoySettings.js +72 -0
- package/lib/commonjs/store/askBuoySettings.js.map +1 -0
- package/lib/commonjs/store/askBuoyStore.js +547 -1
- package/lib/commonjs/store/askBuoyStore.js.map +1 -0
- package/lib/commonjs/store/blockPlacement.js +64 -0
- package/lib/commonjs/store/blockPlacement.js.map +1 -0
- package/lib/commonjs/store/blockPlacement.test.js +123 -0
- package/lib/commonjs/store/blockPlacement.test.js.map +1 -0
- package/lib/commonjs/store/queue.test.js +150 -0
- package/lib/commonjs/store/queue.test.js.map +1 -0
- package/lib/commonjs/store/resetConversation.js +77 -0
- package/lib/commonjs/store/resetConversation.js.map +1 -0
- package/lib/commonjs/store/restorePending.test.js +63 -0
- package/lib/commonjs/store/restorePending.test.js.map +1 -0
- package/lib/commonjs/store/restoredIds.test.js +47 -0
- package/lib/commonjs/store/restoredIds.test.js.map +1 -0
- package/lib/commonjs/store/suggestions.js +54 -0
- package/lib/commonjs/store/suggestions.js.map +1 -0
- package/lib/commonjs/store/suggestions.test.js +58 -0
- package/lib/commonjs/store/suggestions.test.js.map +1 -0
- package/lib/commonjs/store/systemLine.test.js +77 -0
- package/lib/commonjs/store/systemLine.test.js.map +1 -0
- package/lib/commonjs/store/ticketPrompt.js +17 -0
- package/lib/commonjs/store/ticketPrompt.js.map +1 -0
- package/lib/commonjs/store/traceText.js +81 -0
- package/lib/commonjs/store/traceText.js.map +1 -0
- package/lib/commonjs/store/traceText.test.js +112 -0
- package/lib/commonjs/store/traceText.test.js.map +1 -0
- package/lib/commonjs/store/transcriptPersistence.js +297 -0
- package/lib/commonjs/store/transcriptPersistence.js.map +1 -0
- package/lib/commonjs/store/transcriptPersistence.test.js +333 -0
- package/lib/commonjs/store/transcriptPersistence.test.js.map +1 -0
- package/lib/commonjs/store/turnRendering.test.js +151 -0
- package/lib/commonjs/store/turnRendering.test.js.map +1 -0
- package/lib/commonjs/store/useAskBuoy.js +622 -1
- package/lib/commonjs/store/useAskBuoy.js.map +1 -0
- package/lib/commonjs/store/useAskBuoySettings.js +14 -0
- package/lib/commonjs/store/useAskBuoySettings.js.map +1 -0
- package/lib/commonjs/sync/askBuoySyncAdapter.js +140 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.js.map +1 -0
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js +141 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +1 -0
- package/lib/commonjs/sync/wire.js +58 -1
- package/lib/commonjs/sync/wire.js.map +1 -0
- package/lib/commonjs/types.js +6 -1
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/blocks/AskBlocks.js +331 -1
- package/lib/module/blocks/AskBlocks.js.map +1 -0
- package/lib/module/blocks/BlockRenderer.js +257 -1
- package/lib/module/blocks/BlockRenderer.js.map +1 -0
- package/lib/module/blocks/ChromePrototypes.js +503 -1
- package/lib/module/blocks/ChromePrototypes.js.map +1 -0
- package/lib/module/blocks/DataBlocks.js +767 -1
- package/lib/module/blocks/DataBlocks.js.map +1 -0
- package/lib/module/blocks/ExtraBlocks.js +1833 -1
- package/lib/module/blocks/ExtraBlocks.js.map +1 -0
- package/lib/module/blocks/MediaBlocks.js +151 -1
- package/lib/module/blocks/MediaBlocks.js.map +1 -0
- package/lib/module/blocks/ReceiptBlocks.js +574 -1
- package/lib/module/blocks/ReceiptBlocks.js.map +1 -0
- package/lib/module/blocks/blockText.js +55 -0
- package/lib/module/blocks/blockText.js.map +1 -0
- package/lib/module/blocks/blockText.test.js +53 -0
- package/lib/module/blocks/blockText.test.js.map +1 -0
- package/lib/module/blocks/context.js +35 -1
- package/lib/module/blocks/context.js.map +1 -0
- package/lib/module/blocks/icons.js +91 -1
- package/lib/module/blocks/icons.js.map +1 -0
- package/lib/module/blocks/index.js +8 -1
- package/lib/module/blocks/index.js.map +1 -0
- package/lib/module/blocks/listRow.test.js +56 -0
- package/lib/module/blocks/listRow.test.js.map +1 -0
- package/lib/module/blocks/pageState.js +30 -0
- package/lib/module/blocks/pageState.js.map +1 -0
- package/lib/module/blocks/pageState.test.js +56 -0
- package/lib/module/blocks/pageState.test.js.map +1 -0
- package/lib/module/blocks/primitives.js +445 -1
- package/lib/module/blocks/primitives.js.map +1 -0
- package/lib/module/blocks/primitivesIndex.js +5 -1
- package/lib/module/blocks/primitivesIndex.js.map +1 -0
- package/lib/module/components/ApprovalCard.js +239 -1
- package/lib/module/components/ApprovalCard.js.map +1 -0
- package/lib/module/components/AskBuoyHeader.js +193 -1
- package/lib/module/components/AskBuoyHeader.js.map +1 -0
- package/lib/module/components/AskBuoyIcon.js +8 -1
- package/lib/module/components/AskBuoyIcon.js.map +1 -0
- package/lib/module/components/AskBuoyModal.js +474 -1
- package/lib/module/components/AskBuoyModal.js.map +1 -0
- package/lib/module/components/AskBuoySettings.js +114 -0
- package/lib/module/components/AskBuoySettings.js.map +1 -0
- package/lib/module/components/ChangesBar.js +206 -1
- package/lib/module/components/ChangesBar.js.map +1 -0
- package/lib/module/components/Composer.js +250 -1
- package/lib/module/components/Composer.js.map +1 -0
- package/lib/module/components/EmptyState.js +156 -1
- package/lib/module/components/EmptyState.js.map +1 -0
- package/lib/module/components/KeyboardPad.js +75 -0
- package/lib/module/components/KeyboardPad.js.map +1 -0
- package/lib/module/components/Markdown.js +305 -1
- package/lib/module/components/Markdown.js.map +1 -0
- package/lib/module/components/MessageList.js +924 -1
- package/lib/module/components/MessageList.js.map +1 -0
- package/lib/module/components/QueuedMessages.js +140 -0
- package/lib/module/components/QueuedMessages.js.map +1 -0
- package/lib/module/components/ThinkingStrip.js +218 -0
- package/lib/module/components/ThinkingStrip.js.map +1 -0
- package/lib/module/components/TypingDots.js +58 -1
- package/lib/module/components/TypingDots.js.map +1 -0
- package/lib/module/components/markdownParse.js +125 -0
- package/lib/module/components/markdownParse.js.map +1 -0
- package/lib/module/components/markdownParse.test.js +98 -0
- package/lib/module/components/markdownParse.test.js.map +1 -0
- package/lib/module/components/useCopyAction.js +46 -0
- package/lib/module/components/useCopyAction.js.map +1 -0
- package/lib/module/index.js +34 -1
- package/lib/module/index.js.map +1 -0
- package/lib/module/preset.js +73 -1
- package/lib/module/preset.js.map +1 -0
- package/lib/module/store/activityGroups.js +103 -0
- package/lib/module/store/activityGroups.js.map +1 -0
- package/lib/module/store/activityGroups.test.js +77 -0
- package/lib/module/store/activityGroups.test.js.map +1 -0
- package/lib/module/store/askBuoySettings.js +67 -0
- package/lib/module/store/askBuoySettings.js.map +1 -0
- package/lib/module/store/askBuoyStore.js +541 -1
- package/lib/module/store/askBuoyStore.js.map +1 -0
- package/lib/module/store/blockPlacement.js +59 -0
- package/lib/module/store/blockPlacement.js.map +1 -0
- package/lib/module/store/blockPlacement.test.js +122 -0
- package/lib/module/store/blockPlacement.test.js.map +1 -0
- package/lib/module/store/queue.test.js +149 -0
- package/lib/module/store/queue.test.js.map +1 -0
- package/lib/module/store/resetConversation.js +72 -0
- package/lib/module/store/resetConversation.js.map +1 -0
- package/lib/module/store/restorePending.test.js +62 -0
- package/lib/module/store/restorePending.test.js.map +1 -0
- package/lib/module/store/restoredIds.test.js +46 -0
- package/lib/module/store/restoredIds.test.js.map +1 -0
- package/lib/module/store/suggestions.js +49 -0
- package/lib/module/store/suggestions.js.map +1 -0
- package/lib/module/store/suggestions.test.js +57 -0
- package/lib/module/store/suggestions.test.js.map +1 -0
- package/lib/module/store/systemLine.test.js +76 -0
- package/lib/module/store/systemLine.test.js.map +1 -0
- package/lib/module/store/ticketPrompt.js +13 -0
- package/lib/module/store/ticketPrompt.js.map +1 -0
- package/lib/module/store/traceText.js +75 -0
- package/lib/module/store/traceText.js.map +1 -0
- package/lib/module/store/traceText.test.js +111 -0
- package/lib/module/store/traceText.test.js.map +1 -0
- package/lib/module/store/transcriptPersistence.js +287 -0
- package/lib/module/store/transcriptPersistence.js.map +1 -0
- package/lib/module/store/transcriptPersistence.test.js +332 -0
- package/lib/module/store/transcriptPersistence.test.js.map +1 -0
- package/lib/module/store/turnRendering.test.js +150 -0
- package/lib/module/store/turnRendering.test.js.map +1 -0
- package/lib/module/store/useAskBuoy.js +616 -1
- package/lib/module/store/useAskBuoy.js.map +1 -0
- package/lib/module/store/useAskBuoySettings.js +9 -0
- package/lib/module/store/useAskBuoySettings.js.map +1 -0
- package/lib/module/sync/askBuoySyncAdapter.js +135 -1
- package/lib/module/sync/askBuoySyncAdapter.js.map +1 -0
- package/lib/module/sync/askBuoySyncAdapter.test.js +140 -1
- package/lib/module/sync/askBuoySyncAdapter.test.js.map +1 -0
- package/lib/module/sync/wire.js +47 -1
- package/lib/module/sync/wire.js.map +1 -0
- package/lib/module/types.js +4 -1
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/blocks/AskBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/BlockRenderer.d.ts.map +1 -0
- package/lib/typescript/blocks/ChromePrototypes.d.ts.map +1 -0
- package/lib/typescript/blocks/DataBlocks.d.ts +42 -0
- package/lib/typescript/blocks/DataBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/ExtraBlocks.d.ts +29 -2
- package/lib/typescript/blocks/ExtraBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/MediaBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +1 -0
- package/lib/typescript/blocks/blockText.d.ts +14 -0
- package/lib/typescript/blocks/blockText.d.ts.map +1 -0
- package/lib/typescript/blocks/blockText.test.d.ts +2 -0
- package/lib/typescript/blocks/blockText.test.d.ts.map +1 -0
- package/lib/typescript/blocks/context.d.ts.map +1 -0
- package/lib/typescript/blocks/icons.d.ts.map +1 -0
- package/lib/typescript/blocks/index.d.ts.map +1 -0
- package/lib/typescript/blocks/listRow.test.d.ts +2 -0
- package/lib/typescript/blocks/listRow.test.d.ts.map +1 -0
- package/lib/typescript/blocks/pageState.d.ts +23 -0
- package/lib/typescript/blocks/pageState.d.ts.map +1 -0
- package/lib/typescript/blocks/pageState.test.d.ts +2 -0
- package/lib/typescript/blocks/pageState.test.d.ts.map +1 -0
- package/lib/typescript/blocks/primitives.d.ts +55 -10
- package/lib/typescript/blocks/primitives.d.ts.map +1 -0
- package/lib/typescript/blocks/primitivesIndex.d.ts +2 -1
- package/lib/typescript/blocks/primitivesIndex.d.ts.map +1 -0
- package/lib/typescript/components/ApprovalCard.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoyHeader.d.ts +41 -1
- package/lib/typescript/components/AskBuoyHeader.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoyIcon.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoyModal.d.ts.map +1 -0
- package/lib/typescript/components/AskBuoySettings.d.ts +2 -0
- package/lib/typescript/components/AskBuoySettings.d.ts.map +1 -0
- package/lib/typescript/components/ChangesBar.d.ts.map +1 -0
- package/lib/typescript/components/Composer.d.ts +16 -1
- package/lib/typescript/components/Composer.d.ts.map +1 -0
- package/lib/typescript/components/EmptyState.d.ts +5 -1
- package/lib/typescript/components/EmptyState.d.ts.map +1 -0
- package/lib/typescript/components/KeyboardPad.d.ts +33 -0
- package/lib/typescript/components/KeyboardPad.d.ts.map +1 -0
- package/lib/typescript/components/Markdown.d.ts +0 -10
- package/lib/typescript/components/Markdown.d.ts.map +1 -0
- package/lib/typescript/components/MessageList.d.ts +19 -7
- package/lib/typescript/components/MessageList.d.ts.map +1 -0
- package/lib/typescript/components/QueuedMessages.d.ts +10 -0
- package/lib/typescript/components/QueuedMessages.d.ts.map +1 -0
- package/lib/typescript/components/ThinkingStrip.d.ts +5 -0
- package/lib/typescript/components/ThinkingStrip.d.ts.map +1 -0
- package/lib/typescript/components/TypingDots.d.ts.map +1 -0
- package/lib/typescript/components/markdownParse.d.ts +49 -0
- package/lib/typescript/components/markdownParse.d.ts.map +1 -0
- package/lib/typescript/components/markdownParse.test.d.ts +2 -0
- package/lib/typescript/components/markdownParse.test.d.ts.map +1 -0
- package/lib/typescript/components/useCopyAction.d.ts +5 -0
- package/lib/typescript/components/useCopyAction.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts.map +1 -0
- package/lib/typescript/store/activityGroups.d.ts +29 -0
- package/lib/typescript/store/activityGroups.d.ts.map +1 -0
- package/lib/typescript/store/activityGroups.test.d.ts +2 -0
- package/lib/typescript/store/activityGroups.test.d.ts.map +1 -0
- package/lib/typescript/store/askBuoySettings.d.ts +44 -0
- package/lib/typescript/store/askBuoySettings.d.ts.map +1 -0
- package/lib/typescript/store/askBuoyStore.d.ts +216 -18
- package/lib/typescript/store/askBuoyStore.d.ts.map +1 -0
- package/lib/typescript/store/blockPlacement.d.ts +30 -0
- package/lib/typescript/store/blockPlacement.d.ts.map +1 -0
- package/lib/typescript/store/blockPlacement.test.d.ts +2 -0
- package/lib/typescript/store/blockPlacement.test.d.ts.map +1 -0
- package/lib/typescript/store/queue.test.d.ts +2 -0
- package/lib/typescript/store/queue.test.d.ts.map +1 -0
- package/lib/typescript/store/resetConversation.d.ts +38 -0
- package/lib/typescript/store/resetConversation.d.ts.map +1 -0
- package/lib/typescript/store/restorePending.test.d.ts +2 -0
- package/lib/typescript/store/restorePending.test.d.ts.map +1 -0
- package/lib/typescript/store/restoredIds.test.d.ts +2 -0
- package/lib/typescript/store/restoredIds.test.d.ts.map +1 -0
- package/lib/typescript/store/suggestions.d.ts +32 -0
- package/lib/typescript/store/suggestions.d.ts.map +1 -0
- package/lib/typescript/store/suggestions.test.d.ts +2 -0
- package/lib/typescript/store/suggestions.test.d.ts.map +1 -0
- package/lib/typescript/store/systemLine.test.d.ts +2 -0
- package/lib/typescript/store/systemLine.test.d.ts.map +1 -0
- package/lib/typescript/store/ticketPrompt.d.ts +11 -0
- package/lib/typescript/store/ticketPrompt.d.ts.map +1 -0
- package/lib/typescript/store/traceText.d.ts +33 -0
- package/lib/typescript/store/traceText.d.ts.map +1 -0
- package/lib/typescript/store/traceText.test.d.ts +2 -0
- package/lib/typescript/store/traceText.test.d.ts.map +1 -0
- package/lib/typescript/store/transcriptPersistence.d.ts +79 -0
- package/lib/typescript/store/transcriptPersistence.d.ts.map +1 -0
- package/lib/typescript/store/transcriptPersistence.test.d.ts +2 -0
- package/lib/typescript/store/transcriptPersistence.test.d.ts.map +1 -0
- package/lib/typescript/store/turnRendering.test.d.ts +2 -0
- package/lib/typescript/store/turnRendering.test.d.ts.map +1 -0
- package/lib/typescript/store/useAskBuoy.d.ts +23 -1
- package/lib/typescript/store/useAskBuoy.d.ts.map +1 -0
- package/lib/typescript/store/useAskBuoySettings.d.ts +3 -0
- package/lib/typescript/store/useAskBuoySettings.d.ts.map +1 -0
- package/lib/typescript/sync/askBuoySyncAdapter.d.ts +26 -6
- package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +1 -0
- package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +1 -0
- package/lib/typescript/sync/wire.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +24 -1
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +9 -9
|
@@ -1 +1,547 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.askBuoyStore = void 0;
|
|
7
|
+
exports.queuePauseReason = queuePauseReason;
|
|
8
|
+
exports.turnPhaseOf = turnPhaseOf;
|
|
9
|
+
var _agentCore = require("@buoy-gg/agent-core");
|
|
10
|
+
/**
|
|
11
|
+
* Conversation state for the sheet.
|
|
12
|
+
*
|
|
13
|
+
* A module-level store rather than component state for two reasons: the sheet
|
|
14
|
+
* is unmounted whenever the tool is closed or minimised (and a conversation
|
|
15
|
+
* that vanished because someone tapped away would be maddening), and the sync
|
|
16
|
+
* adapter needs to read the same transcript to show it on the desktop.
|
|
17
|
+
*
|
|
18
|
+
* Persisted across restarts, on purpose, with the payloads left out — see
|
|
19
|
+
* `transcriptPersistence.ts` for what is written and what that costs. The
|
|
20
|
+
* store itself stays a plain in-memory store; saving is a subscriber, and
|
|
21
|
+
* `hydrate` is the one way anything comes back in.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/** A block in a message, and (for receipts) the tool call that produced it. */
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A stretch of the model's own reasoning, and where it fell.
|
|
28
|
+
*
|
|
29
|
+
* `afterCalls` is how many tool calls this message had already made when the
|
|
30
|
+
* thought arrived, so the thinking view can lay reasoning and steps out in the
|
|
31
|
+
* order they actually happened. One assistant bubble spans every turn of a
|
|
32
|
+
* multi-step run, so "think, act, think, act" is the normal shape and showing
|
|
33
|
+
* all the thoughts in a lump at the top would misreport it.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A message typed while a turn was running.
|
|
38
|
+
*
|
|
39
|
+
* A list with ids, not a string: the single slot it replaced OVERWROTE — type
|
|
40
|
+
* two things mid-turn and the first vanished, which is precisely the loss the
|
|
41
|
+
* queue exists to prevent. Ids so two identical requests stay distinguishable
|
|
42
|
+
* and the list can be edited by row.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The one word every component reads to know what the chat is doing.
|
|
47
|
+
*
|
|
48
|
+
* Presentation state (minimised, settings open) is NOT in here on purpose —
|
|
49
|
+
* it sits on top. This exists because the header, the composer, the queue
|
|
50
|
+
* flush and the modal each used to derive their own answer from five
|
|
51
|
+
* overlapping booleans, and disagreed: the queue fired after an error because
|
|
52
|
+
* "not busy" looked like "idle" to it.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Message ids carry this run's token — see agent-core's `runId`. A plain `m1`
|
|
57
|
+
* collided head-on with the `m1` in a restored transcript, and the message
|
|
58
|
+
* list keys on it.
|
|
59
|
+
*/
|
|
60
|
+
const nextId = (0, _agentCore.idFactory)("m");
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Params, as one readable line. Capped because a step can carry a whole
|
|
64
|
+
* response body or a store's full state, and this is chrome inside a chat
|
|
65
|
+
* bubble — the full value is a tool read away.
|
|
66
|
+
*/
|
|
67
|
+
const MAX_PARAM_CHARS = 400;
|
|
68
|
+
function encodeParams(params) {
|
|
69
|
+
if (!params || Object.keys(params).length === 0) return undefined;
|
|
70
|
+
try {
|
|
71
|
+
const json = JSON.stringify(params);
|
|
72
|
+
return json.length > MAX_PARAM_CHARS ? `${json.slice(0, MAX_PARAM_CHARS)}…` : json;
|
|
73
|
+
} catch {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Queue ids carry the run token too — a restored queue keys on them. */
|
|
79
|
+
const nextQueuedId = (0, _agentCore.idFactory)("q");
|
|
80
|
+
let state = {
|
|
81
|
+
messages: [],
|
|
82
|
+
busy: false,
|
|
83
|
+
stopping: false,
|
|
84
|
+
pending: null,
|
|
85
|
+
notice: null,
|
|
86
|
+
configured: false,
|
|
87
|
+
answers: {},
|
|
88
|
+
awaitingBlockId: null,
|
|
89
|
+
actionState: {},
|
|
90
|
+
queued: [],
|
|
91
|
+
draft: null,
|
|
92
|
+
usage: {
|
|
93
|
+
input: 0,
|
|
94
|
+
output: 0,
|
|
95
|
+
requests: 0
|
|
96
|
+
},
|
|
97
|
+
meta: {}
|
|
98
|
+
};
|
|
99
|
+
const listeners = new Set();
|
|
100
|
+
let ledgerRef = null;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The session outlives the sheet the same way the transcript does. Session and
|
|
104
|
+
* ledger used to be per-mount: closing and reopening the tool kept the visible
|
|
105
|
+
* conversation but silently swapped in an empty ledger and a blank model
|
|
106
|
+
* memory — the undo bar vanished while the agent's changes stayed live in the
|
|
107
|
+
* app. Held here, keyed by a config signature so a real reconfiguration
|
|
108
|
+
* (different endpoint/model/tool set) still rebuilds.
|
|
109
|
+
*/
|
|
110
|
+
let heldSession = null;
|
|
111
|
+
function set(next) {
|
|
112
|
+
state = {
|
|
113
|
+
...state,
|
|
114
|
+
...next
|
|
115
|
+
};
|
|
116
|
+
for (const fn of listeners) {
|
|
117
|
+
try {
|
|
118
|
+
fn();
|
|
119
|
+
} catch {
|
|
120
|
+
// A throwing subscriber must not take the transcript down mid-answer.
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const askBuoyStore = exports.askBuoyStore = {
|
|
125
|
+
getState: () => state,
|
|
126
|
+
subscribe(fn) {
|
|
127
|
+
listeners.add(fn);
|
|
128
|
+
return () => listeners.delete(fn);
|
|
129
|
+
},
|
|
130
|
+
setLedger(ledger) {
|
|
131
|
+
ledgerRef = ledger;
|
|
132
|
+
},
|
|
133
|
+
getLedger() {
|
|
134
|
+
return ledgerRef;
|
|
135
|
+
},
|
|
136
|
+
holdSession(session, signature) {
|
|
137
|
+
heldSession = {
|
|
138
|
+
session,
|
|
139
|
+
signature
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
getHeldSession() {
|
|
143
|
+
return heldSession;
|
|
144
|
+
},
|
|
145
|
+
setNotice(notice) {
|
|
146
|
+
set({
|
|
147
|
+
notice
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
setConfigured(configured) {
|
|
151
|
+
if (configured !== state.configured) set({
|
|
152
|
+
configured
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
setMeta(meta) {
|
|
156
|
+
const same = Object.keys(meta).every(k => state.meta[k] === meta[k]);
|
|
157
|
+
if (!same) set({
|
|
158
|
+
meta: {
|
|
159
|
+
...state.meta,
|
|
160
|
+
...meta
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
addUser(text) {
|
|
165
|
+
set({
|
|
166
|
+
messages: [...state.messages, {
|
|
167
|
+
id: nextId(),
|
|
168
|
+
role: "user",
|
|
169
|
+
text,
|
|
170
|
+
toolCalls: [],
|
|
171
|
+
blocks: []
|
|
172
|
+
}],
|
|
173
|
+
busy: true
|
|
174
|
+
});
|
|
175
|
+
},
|
|
176
|
+
/** Mark a turn as running without adding a bubble — the retry path. */
|
|
177
|
+
beginTurn() {
|
|
178
|
+
set({
|
|
179
|
+
busy: true
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
/** Park a message typed mid-turn, behind whatever is already parked. */
|
|
183
|
+
enqueue(text) {
|
|
184
|
+
const item = {
|
|
185
|
+
id: nextQueuedId(),
|
|
186
|
+
text
|
|
187
|
+
};
|
|
188
|
+
set({
|
|
189
|
+
queued: [...state.queued, item]
|
|
190
|
+
});
|
|
191
|
+
return item;
|
|
192
|
+
},
|
|
193
|
+
/** Drop one parked message — the ✕ on its row. */
|
|
194
|
+
removeQueued(id) {
|
|
195
|
+
if (!state.queued.some(q => q.id === id)) return;
|
|
196
|
+
set({
|
|
197
|
+
queued: state.queued.filter(q => q.id !== id)
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
/** Take the FIRST parked message off the queue — the flush path. */
|
|
201
|
+
shiftQueued() {
|
|
202
|
+
const [next, ...rest] = state.queued;
|
|
203
|
+
if (!next) return undefined;
|
|
204
|
+
set({
|
|
205
|
+
queued: rest
|
|
206
|
+
});
|
|
207
|
+
return next;
|
|
208
|
+
},
|
|
209
|
+
/** Hand one parked message back to the composer to edit. See `draft`. */
|
|
210
|
+
takeQueuedToDraft(id) {
|
|
211
|
+
const item = state.queued.find(q => q.id === id);
|
|
212
|
+
if (!item) return;
|
|
213
|
+
set({
|
|
214
|
+
queued: state.queued.filter(q => q.id !== id),
|
|
215
|
+
draft: item.text
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
/**
|
|
219
|
+
* The user pressed Stop. The turn is still winding down — the abort is only
|
|
220
|
+
* read between calls — so the phase is `stopping`, not `idle`, until
|
|
221
|
+
* `finishAssistant` lands.
|
|
222
|
+
*/
|
|
223
|
+
requestStop() {
|
|
224
|
+
if (!state.busy || state.stopping) return;
|
|
225
|
+
set({
|
|
226
|
+
stopping: true
|
|
227
|
+
});
|
|
228
|
+
},
|
|
229
|
+
/** The composer has taken the draft into its input. */
|
|
230
|
+
clearDraft() {
|
|
231
|
+
if (state.draft === null) return;
|
|
232
|
+
set({
|
|
233
|
+
draft: null
|
|
234
|
+
});
|
|
235
|
+
},
|
|
236
|
+
/** Drop one message — the failed assistant bubble a retry replaces. */
|
|
237
|
+
removeMessage(id) {
|
|
238
|
+
set({
|
|
239
|
+
messages: state.messages.filter(m => m.id !== id)
|
|
240
|
+
});
|
|
241
|
+
},
|
|
242
|
+
/** The user answered (or skipped) an Ask block. */
|
|
243
|
+
recordAnswer(answer) {
|
|
244
|
+
set({
|
|
245
|
+
answers: {
|
|
246
|
+
...state.answers,
|
|
247
|
+
[answer.blockId]: answer
|
|
248
|
+
},
|
|
249
|
+
awaitingBlockId: state.awaitingBlockId === answer.blockId ? null : state.awaitingBlockId
|
|
250
|
+
});
|
|
251
|
+
},
|
|
252
|
+
setActionState(key, value) {
|
|
253
|
+
const next = {
|
|
254
|
+
...state.actionState
|
|
255
|
+
};
|
|
256
|
+
if (value === null) delete next[key];else next[key] = value;
|
|
257
|
+
set({
|
|
258
|
+
actionState: next
|
|
259
|
+
});
|
|
260
|
+
},
|
|
261
|
+
/** Open a new assistant bubble for the turn that is about to stream. */
|
|
262
|
+
startAssistant() {
|
|
263
|
+
const id = nextId();
|
|
264
|
+
set({
|
|
265
|
+
messages: [...state.messages, {
|
|
266
|
+
id,
|
|
267
|
+
role: "assistant",
|
|
268
|
+
text: "",
|
|
269
|
+
toolCalls: [],
|
|
270
|
+
blocks: [],
|
|
271
|
+
streaming: true,
|
|
272
|
+
startedAt: Date.now()
|
|
273
|
+
}]
|
|
274
|
+
});
|
|
275
|
+
return id;
|
|
276
|
+
},
|
|
277
|
+
/**
|
|
278
|
+
* Fold one engine event into the open assistant message.
|
|
279
|
+
*
|
|
280
|
+
* Tool calls render as rows inside the bubble rather than as raw payloads:
|
|
281
|
+
* the label is already domain-flavoured ("Set points to 1500"), which is the
|
|
282
|
+
* only form a non-developer can actually check.
|
|
283
|
+
*/
|
|
284
|
+
applyEvent(messageId, ev) {
|
|
285
|
+
if (ev.type === "history-trimmed") {
|
|
286
|
+
// Before the answer it affects, so it reads as a caption on the gap
|
|
287
|
+
// rather than as part of the reply.
|
|
288
|
+
const at = state.messages.findIndex(m => m.id === messageId);
|
|
289
|
+
const line = {
|
|
290
|
+
id: nextId(),
|
|
291
|
+
role: "assistant",
|
|
292
|
+
system: true,
|
|
293
|
+
text: `Older messages were trimmed from the agent's memory (${ev.droppedRounds} exchange${ev.droppedRounds === 1 ? "" : "s"}). It may not recall setup from earlier in this chat — the changes bar still lists what is applied.`,
|
|
294
|
+
toolCalls: [],
|
|
295
|
+
blocks: [],
|
|
296
|
+
endedAt: Date.now()
|
|
297
|
+
};
|
|
298
|
+
const next = [...state.messages];
|
|
299
|
+
next.splice(at < 0 ? next.length : at, 0, line);
|
|
300
|
+
set({
|
|
301
|
+
messages: next
|
|
302
|
+
});
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const messages = state.messages.map(m => {
|
|
306
|
+
if (m.id !== messageId) return m;
|
|
307
|
+
switch (ev.type) {
|
|
308
|
+
case "text":
|
|
309
|
+
return {
|
|
310
|
+
...m,
|
|
311
|
+
text: (m.breakBeforeNextText || ev.breakBefore) && m.text ? `${m.text.trimEnd()}\n\n${ev.delta}` : m.text + ev.delta,
|
|
312
|
+
breakBeforeNextText: false
|
|
313
|
+
};
|
|
314
|
+
case "reasoning":
|
|
315
|
+
return {
|
|
316
|
+
...m,
|
|
317
|
+
breakBeforeNextText: true,
|
|
318
|
+
reasoning: [...(m.reasoning ?? []), {
|
|
319
|
+
text: ev.text,
|
|
320
|
+
afterCalls: m.toolCalls.length
|
|
321
|
+
}]
|
|
322
|
+
};
|
|
323
|
+
case "tool-start":
|
|
324
|
+
return {
|
|
325
|
+
...m,
|
|
326
|
+
toolCalls: [...m.toolCalls, {
|
|
327
|
+
id: ev.id,
|
|
328
|
+
toolId: ev.toolId,
|
|
329
|
+
action: ev.action,
|
|
330
|
+
label: ev.label,
|
|
331
|
+
description: ev.description,
|
|
332
|
+
status: "running",
|
|
333
|
+
params: encodeParams(ev.params),
|
|
334
|
+
effect: ev.effect,
|
|
335
|
+
startedAt: Date.now()
|
|
336
|
+
}]
|
|
337
|
+
};
|
|
338
|
+
case "tool-end":
|
|
339
|
+
return {
|
|
340
|
+
...m,
|
|
341
|
+
breakBeforeNextText: true,
|
|
342
|
+
toolCalls: m.toolCalls.map(c => c.id === ev.id ? {
|
|
343
|
+
...c,
|
|
344
|
+
status: !ev.ok && ev.summary === "refused" ? "refused" : !ev.ok && ev.summary === "declined" ? "declined" : !ev.ok && ev.summary === "stopped" ? "stopped" : ev.ok ? "ok" : "failed",
|
|
345
|
+
summary: ev.summary,
|
|
346
|
+
durationMs: ev.durationMs,
|
|
347
|
+
result: ev.result
|
|
348
|
+
} : c)
|
|
349
|
+
};
|
|
350
|
+
case "block":
|
|
351
|
+
return {
|
|
352
|
+
...m,
|
|
353
|
+
breakBeforeNextText: true,
|
|
354
|
+
blocks: [...m.blocks, {
|
|
355
|
+
block: ev.block,
|
|
356
|
+
forToolCallId: ev.forToolCallId
|
|
357
|
+
}]
|
|
358
|
+
};
|
|
359
|
+
case "usage":
|
|
360
|
+
// Also folded into the session total below. Per MESSAGE as well,
|
|
361
|
+
// because "which answer cost 40k tokens" is the question you ask
|
|
362
|
+
// when a bill looks wrong, and a session total cannot answer it.
|
|
363
|
+
return {
|
|
364
|
+
...m,
|
|
365
|
+
usage: {
|
|
366
|
+
input: (m.usage?.input ?? 0) + ev.input,
|
|
367
|
+
output: (m.usage?.output ?? 0) + ev.output,
|
|
368
|
+
requests: (m.usage?.requests ?? 0) + 1
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
case "error":
|
|
372
|
+
return {
|
|
373
|
+
...m,
|
|
374
|
+
error: ev.message
|
|
375
|
+
};
|
|
376
|
+
default:
|
|
377
|
+
return m;
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
set({
|
|
381
|
+
messages,
|
|
382
|
+
...(ev.type === "awaiting-user" ? {
|
|
383
|
+
awaitingBlockId: ev.blockId
|
|
384
|
+
} : {}),
|
|
385
|
+
...(ev.type === "usage" ? {
|
|
386
|
+
usage: {
|
|
387
|
+
input: state.usage.input + ev.input,
|
|
388
|
+
output: state.usage.output + ev.output,
|
|
389
|
+
requests: state.usage.requests + 1
|
|
390
|
+
}
|
|
391
|
+
} : {})
|
|
392
|
+
});
|
|
393
|
+
},
|
|
394
|
+
/** The user pressed Stop on this turn. See `ChatMessage.stopped`. */
|
|
395
|
+
markStopped(messageId) {
|
|
396
|
+
set({
|
|
397
|
+
messages: state.messages.map(m => m.id === messageId ? {
|
|
398
|
+
...m,
|
|
399
|
+
stopped: true
|
|
400
|
+
} : m)
|
|
401
|
+
});
|
|
402
|
+
},
|
|
403
|
+
finishAssistant(messageId) {
|
|
404
|
+
set({
|
|
405
|
+
messages: state.messages.map(m => m.id === messageId ? {
|
|
406
|
+
...m,
|
|
407
|
+
streaming: false,
|
|
408
|
+
endedAt: Date.now()
|
|
409
|
+
} : m),
|
|
410
|
+
busy: false,
|
|
411
|
+
stopping: false
|
|
412
|
+
});
|
|
413
|
+
},
|
|
414
|
+
askApproval(input) {
|
|
415
|
+
return new Promise(resolve => {
|
|
416
|
+
set({
|
|
417
|
+
pending: {
|
|
418
|
+
...input,
|
|
419
|
+
resolve
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
},
|
|
424
|
+
answerApproval(approved) {
|
|
425
|
+
const pending = state.pending;
|
|
426
|
+
set({
|
|
427
|
+
pending: null
|
|
428
|
+
});
|
|
429
|
+
pending?.resolve(approved);
|
|
430
|
+
},
|
|
431
|
+
/**
|
|
432
|
+
* Put an unanswered approval back after a restart.
|
|
433
|
+
*
|
|
434
|
+
* A question the app asked and then forgot is worse than not asking: the
|
|
435
|
+
* user tapped nothing, so as far as they are concerned the change is still
|
|
436
|
+
* waiting for them. `resolve` is a no-op because nothing is waiting on this
|
|
437
|
+
* one any more; `restored` is what tells the sheet to run the call rather
|
|
438
|
+
* than answer a dead promise.
|
|
439
|
+
*
|
|
440
|
+
* Refused once a turn is under way, for the same reason `hydrate` is: a slow
|
|
441
|
+
* disk read must not shove an old question in front of a live conversation.
|
|
442
|
+
*/
|
|
443
|
+
restorePending(input) {
|
|
444
|
+
if (state.pending || state.busy) return false;
|
|
445
|
+
set({
|
|
446
|
+
pending: {
|
|
447
|
+
...input,
|
|
448
|
+
restored: true,
|
|
449
|
+
resolve: () => {}
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
return true;
|
|
453
|
+
},
|
|
454
|
+
/**
|
|
455
|
+
* A line in the transcript from Buoy itself rather than from the model.
|
|
456
|
+
*
|
|
457
|
+
* It wears the assistant's bubble because that is the only shape the list
|
|
458
|
+
* renders, but nothing is sent to the model and nothing lands in its
|
|
459
|
+
* history — it exists so an approval answered after a restart leaves a
|
|
460
|
+
* trace, instead of the card silently vanishing a second time.
|
|
461
|
+
*/
|
|
462
|
+
addNote(text) {
|
|
463
|
+
set({
|
|
464
|
+
messages: [...state.messages, {
|
|
465
|
+
id: nextId(),
|
|
466
|
+
role: "assistant",
|
|
467
|
+
text,
|
|
468
|
+
toolCalls: [],
|
|
469
|
+
blocks: [],
|
|
470
|
+
endedAt: Date.now()
|
|
471
|
+
}]
|
|
472
|
+
});
|
|
473
|
+
},
|
|
474
|
+
/**
|
|
475
|
+
* Put a saved conversation back, once, at open.
|
|
476
|
+
*
|
|
477
|
+
* Refuses if anything has been said already: a slow disk read landing after
|
|
478
|
+
* the user has started typing must not shove an old chat in front of them.
|
|
479
|
+
*/
|
|
480
|
+
hydrate(input) {
|
|
481
|
+
if (state.messages.length > 0 || state.busy) return false;
|
|
482
|
+
set({
|
|
483
|
+
messages: input.messages.map(m => ({
|
|
484
|
+
...m,
|
|
485
|
+
restored: true
|
|
486
|
+
})),
|
|
487
|
+
answers: input.answers,
|
|
488
|
+
usage: input.usage,
|
|
489
|
+
queued: input.queued ?? []
|
|
490
|
+
});
|
|
491
|
+
return true;
|
|
492
|
+
},
|
|
493
|
+
reset() {
|
|
494
|
+
// Reject anything still waiting, or the turn hangs forever on a promise
|
|
495
|
+
// whose only resolver just left the screen.
|
|
496
|
+
state.pending?.resolve(false);
|
|
497
|
+
set({
|
|
498
|
+
messages: [],
|
|
499
|
+
busy: false,
|
|
500
|
+
stopping: false,
|
|
501
|
+
pending: null,
|
|
502
|
+
notice: null,
|
|
503
|
+
answers: {},
|
|
504
|
+
awaitingBlockId: null,
|
|
505
|
+
actionState: {},
|
|
506
|
+
queued: [],
|
|
507
|
+
draft: null,
|
|
508
|
+
usage: {
|
|
509
|
+
input: 0,
|
|
510
|
+
output: 0,
|
|
511
|
+
requests: 0
|
|
512
|
+
}
|
|
513
|
+
// `meta` survives: it describes the app and the endpoint, not the
|
|
514
|
+
// conversation, and re-deriving it would need another render pass.
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
/** See TurnPhase. Pure, so every component and the flush effect agree. */
|
|
520
|
+
function turnPhaseOf(s) {
|
|
521
|
+
if (s.pending) return "awaitingApproval";
|
|
522
|
+
if (s.busy) return s.stopping ? "stopping" : "running";
|
|
523
|
+
if (s.awaitingBlockId) return "awaitingAnswer";
|
|
524
|
+
return "idle";
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Why parked messages are NOT being sent right now, in the user's words — or
|
|
529
|
+
* null when the queue may deliver.
|
|
530
|
+
*
|
|
531
|
+
* A queued message is a next TASK, not an answer. It used to go the moment
|
|
532
|
+
* `busy` dropped: after an error it fired into the same dead connection, and
|
|
533
|
+
* with a choice block open it was sent as the reply to the question. So the
|
|
534
|
+
* queue holds on error, Stop, an approval and an unanswered Ask block, and
|
|
535
|
+
* says which.
|
|
536
|
+
*/
|
|
537
|
+
function queuePauseReason(s) {
|
|
538
|
+
const phase = turnPhaseOf(s);
|
|
539
|
+
if (phase === "running" || phase === "stopping") return null;
|
|
540
|
+
if (phase === "awaitingApproval") return "Paused — answer the approval above first.";
|
|
541
|
+
if (phase === "awaitingAnswer") return "Paused — answer the question above first.";
|
|
542
|
+
const last = s.messages[s.messages.length - 1];
|
|
543
|
+
if (last?.role === "assistant" && last.error) return "Paused — the last turn failed.";
|
|
544
|
+
if (last?.role === "assistant" && last.stopped) return "Paused — you stopped the last turn.";
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
//# sourceMappingURL=askBuoyStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_agentCore","require","nextId","idFactory","MAX_PARAM_CHARS","encodeParams","params","Object","keys","length","undefined","json","JSON","stringify","slice","nextQueuedId","state","messages","busy","stopping","pending","notice","configured","answers","awaitingBlockId","actionState","queued","draft","usage","input","output","requests","meta","listeners","Set","ledgerRef","heldSession","set","next","fn","askBuoyStore","exports","getState","subscribe","add","delete","setLedger","ledger","getLedger","holdSession","session","signature","getHeldSession","setNotice","setConfigured","setMeta","same","every","k","addUser","text","id","role","toolCalls","blocks","beginTurn","enqueue","item","removeQueued","some","q","filter","shiftQueued","rest","takeQueuedToDraft","find","requestStop","clearDraft","removeMessage","m","recordAnswer","answer","blockId","setActionState","key","value","startAssistant","streaming","startedAt","Date","now","applyEvent","messageId","ev","type","at","findIndex","line","system","droppedRounds","endedAt","splice","map","breakBeforeNextText","breakBefore","trimEnd","delta","reasoning","afterCalls","toolId","action","label","description","status","effect","c","ok","summary","durationMs","result","block","forToolCallId","error","message","markStopped","stopped","finishAssistant","askApproval","Promise","resolve","answerApproval","approved","restorePending","restored","addNote","hydrate","reset","turnPhaseOf","s","queuePauseReason","phase","last"],"sourceRoot":"../../../src","sources":["store/askBuoyStore.ts"],"mappings":";;;;;;;;AAaA,IAAAA,UAAA,GAAAC,OAAA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;;AA+CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgDA;AACA;AACA;AACA;AACA;AACA,MAAMC,MAAM,GAAG,IAAAC,oBAAS,EAAC,GAAG,CAAC;;AAE7B;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAG,GAAG;AAE3B,SAASC,YAAYA,CAACC,MAA+B,EAAsB;EACzE,IAAI,CAACA,MAAM,IAAIC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACG,MAAM,KAAK,CAAC,EAAE,OAAOC,SAAS;EACjE,IAAI;IACF,MAAMC,IAAI,GAAGC,IAAI,CAACC,SAAS,CAACP,MAAM,CAAC;IACnC,OAAOK,IAAI,CAACF,MAAM,GAAGL,eAAe,GAAG,GAAGO,IAAI,CAACG,KAAK,CAAC,CAAC,EAAEV,eAAe,CAAC,GAAG,GAAGO,IAAI;EACpF,CAAC,CAAC,MAAM;IACN,OAAOD,SAAS;EAClB;AACF;;AAEA;AACA,MAAMK,YAAY,GAAG,IAAAZ,oBAAS,EAAC,GAAG,CAAC;AAEnC,IAAIa,KAAmB,GAAG;EACxBC,QAAQ,EAAE,EAAE;EACZC,IAAI,EAAE,KAAK;EACXC,QAAQ,EAAE,KAAK;EACfC,OAAO,EAAE,IAAI;EACbC,MAAM,EAAE,IAAI;EACZC,UAAU,EAAE,KAAK;EACjBC,OAAO,EAAE,CAAC,CAAC;EACXC,eAAe,EAAE,IAAI;EACrBC,WAA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A2C;EACpF,IAAIA,KAAK,KAAK,gBAAgB,EAAE,OAAO,2CAA2C;EAClF,MAAMC,IAAI,GAAGH,CAAC,CAACzH,QAAQ,CAACyH,CAAC,CAACzH,QAAQ,CAACR,MAAM,GAAG,CAAC,CAAC;EAC9C,IAAIoI,IAAI,EAAE/E,IAAI,KAAK,WAAW,IAAI+E,IAAI,CAACnB,KAAK,EAAE,OAAO,gCAAgC;EACrF,IAAImB,IAAI,EAAE/E,IAAI,KAAK,WAAW,IAAI+E,IAAI,CAAChB,OAAO,EAAE,OAAO,qCAAqC;EAC5F,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.placeBlocks = placeBlocks;
|
|
7
|
+
var _agentCore = require("@buoy-gg/agent-core");
|
|
8
|
+
/**
|
|
9
|
+
* Where each block of a turn is drawn: inside a step row, after the prose as
|
|
10
|
+
* the answer itself, or last of all as the thing being asked.
|
|
11
|
+
*
|
|
12
|
+
* Pure and separate from MessageList because the rule is subtle and the cost
|
|
13
|
+
* of getting it wrong is silent — a block that lands in no bucket renders
|
|
14
|
+
* nowhere at all, and nothing in the UI says so. That is exactly what
|
|
15
|
+
* happened: "show me the shop as pictures" built its imageGrid, the engine
|
|
16
|
+
* accepted it, and the sheet dropped it on the floor twice while the model
|
|
17
|
+
* narrated the artwork in prose.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A receipt that belongs inside its step row rather than in the answer: it
|
|
22
|
+
* came from a tool call, and it reports what was READ, not what was changed.
|
|
23
|
+
*
|
|
24
|
+
* ONLY a receipt nests, which is why this tests for the receipt provenances
|
|
25
|
+
* rather than for "not changed". A model-authored block (`buoy_ui`, source
|
|
26
|
+
* "model") also carries the id of the call that produced it — but `buoy_ui`
|
|
27
|
+
* emits no activity row, so there was no step for it to nest under.
|
|
28
|
+
*/
|
|
29
|
+
function nestsUnderStep({
|
|
30
|
+
block,
|
|
31
|
+
forToolCallId
|
|
32
|
+
}) {
|
|
33
|
+
if (!forToolCallId) return false;
|
|
34
|
+
const source = "source" in block ? block.source : undefined;
|
|
35
|
+
return source === "live" || source === "mocked";
|
|
36
|
+
}
|
|
37
|
+
function placeBlocks(blocks, stepIds) {
|
|
38
|
+
const steps = new Set(stepIds);
|
|
39
|
+
const nested = new Map();
|
|
40
|
+
const afterText = [];
|
|
41
|
+
const ask = [];
|
|
42
|
+
for (const placed of blocks) {
|
|
43
|
+
if ((0, _agentCore.isAskBlock)(placed.block)) {
|
|
44
|
+
ask.push(placed);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
// A block may only nest under a step that actually has a row. Anything
|
|
48
|
+
// pointing at a call the activity list never drew renders with the answer
|
|
49
|
+
// — never nowhere.
|
|
50
|
+
if (nestsUnderStep(placed) && steps.has(placed.forToolCallId)) {
|
|
51
|
+
const list = nested.get(placed.forToolCallId) ?? [];
|
|
52
|
+
list.push(placed.block);
|
|
53
|
+
nested.set(placed.forToolCallId, list);
|
|
54
|
+
} else {
|
|
55
|
+
afterText.push(placed);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
nested,
|
|
60
|
+
afterText,
|
|
61
|
+
ask
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=blockPlacement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_agentCore","require","nestsUnderStep","block","forToolCallId","source","undefined","placeBlocks","blocks","stepIds","steps","Set","nested","Map","afterText","ask","placed","isAskBlock","push","has","list","get","set"],"sourceRoot":"../../../src","sources":["store/blockPlacement.ts"],"mappings":";;;;;;AAWA,IAAAA,UAAA,GAAAC,OAAA;AAXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA;AACA;A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