@blade-hq/agent-kit 1.0.25 → 1.0.28
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/dist/chunk-7LEKQI47.js +32 -0
- package/dist/chunk-7LEKQI47.js.map +1 -0
- package/dist/{chunk-3I4ZURKH.js → chunk-BGNKHPCD.js} +223 -50
- package/dist/chunk-BGNKHPCD.js.map +1 -0
- package/dist/{chunk-4D4EXLVT.js → chunk-DQCXSPHP.js} +2 -2
- package/dist/chunk-HCQDDDOX.js +23 -0
- package/dist/chunk-HCQDDDOX.js.map +1 -0
- package/dist/{chunk-QODAKTG5.js → chunk-JCJFFJ42.js} +2 -31
- package/dist/chunk-JCJFFJ42.js.map +1 -0
- package/dist/{chunk-XCIDE3JW.js → chunk-OGHUIKCY.js} +7 -7
- package/dist/{chunk-WPLEMYL7.js → chunk-PYYDXV2A.js} +2 -2
- package/dist/{chunk-VJY6RLYU.js → chunk-TVWC3PED.js} +2 -2
- package/dist/{chunk-WVXXQ3KM.js → chunk-UWNQ4PXK.js} +134 -1201
- package/dist/chunk-UWNQ4PXK.js.map +1 -0
- package/dist/{chunk-M45K3554.js → chunk-YJ6BX3FU.js} +1382 -32
- package/dist/chunk-YJ6BX3FU.js.map +1 -0
- package/dist/client/auth.d.ts +8 -0
- package/dist/client/blade-client.d.ts +82 -0
- package/dist/client/index.d.ts +23 -15348
- package/dist/client/index.js +3 -1
- package/dist/client/resources/api-keys.d.ts +28 -0
- package/dist/client/resources/app-dev-templates.d.ts +93 -0
- package/dist/client/resources/auth.d.ts +26 -0
- package/dist/client/resources/env-buckets.d.ts +20 -0
- package/dist/client/resources/gis.d.ts +8 -0
- package/dist/client/resources/headless.d.ts +33 -0
- package/dist/client/resources/memories.d.ts +63 -0
- package/dist/client/resources/models.d.ts +26 -0
- package/dist/client/resources/published-apps.d.ts +8 -0
- package/dist/client/resources/registry.d.ts +58 -0
- package/dist/client/resources/runs.d.ts +8 -0
- package/dist/client/resources/scenarios.d.ts +49 -0
- package/dist/client/resources/sessions.d.ts +253 -0
- package/dist/client/resources/skills.d.ts +38 -0
- package/dist/client/resources/solutions.d.ts +31 -0
- package/dist/client/resources/user-preferences.d.ts +26 -0
- package/dist/client/rest.d.ts +19 -0
- package/dist/client/shared/projection/builder.d.ts +59 -0
- package/dist/client/shared/projection/helpers.d.ts +34 -0
- package/dist/client/shared/projection/history.d.ts +12 -0
- package/dist/client/shared/projection/index.d.ts +3 -0
- package/dist/client/shared/projection/state.d.ts +22 -0
- package/dist/client/socket.d.ts +9 -0
- package/dist/client/types/index.d.ts +8 -0
- package/dist/client/types/rest.d.ts +16316 -0
- package/dist/client/types/sdk-profile.d.ts +47 -0
- package/dist/client/types/socket-events.d.ts +389 -0
- package/dist/react/api/api-keys.d.ts +6 -0
- package/dist/react/api/app-dev-templates.d.ts +5 -0
- package/dist/react/api/auth.d.ts +7 -0
- package/dist/react/api/client.d.ts +8 -0
- package/dist/react/api/env-buckets.d.ts +10 -0
- package/dist/react/api/gis-api.d.ts +4 -0
- package/dist/react/api/memories.d.ts +14 -0
- package/dist/react/api/model-config.d.ts +68 -0
- package/dist/react/api/models.d.ts +13 -0
- package/dist/react/api/partner-skill.d.ts +2 -0
- package/dist/react/api/prod-solution.d.ts +456 -0
- package/dist/react/api/published-apps.d.ts +21 -0
- package/dist/react/api/published-apps.js +14 -0
- package/dist/react/api/published-apps.js.map +1 -0
- package/dist/react/api/registry.d.ts +46 -0
- package/dist/react/api/scenarios.d.ts +9 -0
- package/dist/react/api/scheduled-tasks.d.ts +24 -0
- package/dist/react/api/session-skill.d.ts +2 -0
- package/dist/react/api/sessions.d.ts +109 -0
- package/dist/react/api/sessions.js +93 -0
- package/dist/react/api/sessions.js.map +1 -0
- package/dist/react/api/skills.d.ts +27 -0
- package/dist/react/api/socket.d.ts +5 -0
- package/dist/react/api/solutions.d.ts +11 -0
- package/dist/react/api/user-preferences.d.ts +8 -0
- package/dist/react/asr/VoiceWaveform.d.ts +10 -0
- package/dist/react/asr/use-tiptap-voice-input.d.ts +29 -0
- package/dist/react/asr/use-voice-input.d.ts +17 -0
- package/dist/react/asr/voice-input-support.d.ts +5 -0
- package/dist/react/bootstrap.d.ts +4 -0
- package/dist/react/cards/register.d.ts +1 -2
- package/dist/react/cards/register.js +3 -2
- package/dist/react/cards/register.js.map +1 -1
- package/dist/react/components/ai-elements/file-tree.d.ts +26 -0
- package/dist/react/components/ai-elements/reasoning.d.ts +32 -0
- package/dist/react/components/ai-elements/shimmer.d.ts +11 -0
- package/dist/react/components/card/CardCodeBlock.d.ts +5 -0
- package/dist/react/components/card/CardContext.d.ts +7 -0
- package/dist/react/components/card/CardRenderer.d.ts +7 -0
- package/dist/react/components/card/CardStates.d.ts +8 -0
- package/dist/react/components/card/cards/attraction-card.d.ts +2 -0
- package/dist/react/components/card/cards/cite-card.d.ts +10 -0
- package/dist/react/components/card/cards/comprehensive-analysis-card.d.ts +2 -0
- package/dist/react/components/card/cards/conflict-detection-card.d.ts +4 -0
- package/dist/react/components/card/cards/counter.d.ts +2 -0
- package/dist/react/components/card/cards/damage-effect-card.d.ts +4 -0
- package/dist/react/components/card/cards/destination-card.d.ts +2 -0
- package/dist/react/components/card/cards/diff-card.d.ts +2 -0
- package/dist/react/components/card/cards/execution-order-card.d.ts +2 -0
- package/dist/react/components/card/cards/experience-card-with-options.d.ts +4 -0
- package/dist/react/components/card/cards/flight-card.d.ts +2 -0
- package/dist/react/components/card/cards/hotel-card.d.ts +2 -0
- package/dist/react/components/card/cards/kill-chain-card.d.ts +2 -0
- package/dist/react/components/card/cards/kill-chain-types.d.ts +157 -0
- package/dist/react/components/card/cards/map-card.d.ts +2 -0
- package/dist/react/components/card/cards/order-status-card.d.ts +2 -0
- package/dist/react/components/card/cards/patch-card.d.ts +15 -0
- package/dist/react/components/card/cards/product-recommendation-card.d.ts +2 -0
- package/dist/react/components/card/cards/reflection-optimization-card.d.ts +2 -0
- package/dist/react/components/card/cards/resolution-modifications-card.d.ts +2 -0
- package/dist/react/components/card/cards/resolution-summary-card.d.ts +2 -0
- package/dist/react/components/card/cards/restaurant-card.d.ts +2 -0
- package/dist/react/components/card/cards/shopping-list-card.d.ts +2 -0
- package/dist/react/components/card/cards/simulation-event-card.d.ts +4 -0
- package/dist/react/components/card/cards/survival-effect-card.d.ts +4 -0
- package/dist/react/components/card/cards/travel-itinerary-card.d.ts +2 -0
- package/dist/react/components/card/register.d.ts +1 -0
- package/dist/react/components/chat/AgentLoopBlock.d.ts +8 -0
- package/dist/react/components/chat/AskUserQuestionBlock.d.ts +32 -0
- package/dist/react/components/chat/AssistantTurnBlock.d.ts +28 -0
- package/dist/react/components/chat/AttachmentPreviewDialog.d.ts +26 -0
- package/dist/react/components/chat/BackgroundTasksPill.d.ts +3 -0
- package/dist/react/components/chat/ChatInput.d.ts +94 -0
- package/dist/react/components/chat/ChatView.d.ts +18 -0
- package/dist/react/components/chat/CompactionCard.d.ts +6 -0
- package/dist/react/components/chat/ConnectionBanner.d.ts +1 -0
- package/dist/react/components/chat/FileCompletionMenu.d.ts +13 -0
- package/dist/react/components/chat/FileSizeLimitDialog.d.ts +9 -0
- package/dist/react/components/chat/ImageLightbox.d.ts +11 -0
- package/dist/react/components/chat/MessageActions.d.ts +6 -0
- package/dist/react/components/chat/MessageContextPills.d.ts +6 -0
- package/dist/react/components/chat/MessageFileAttachmentList.d.ts +13 -0
- package/dist/react/components/chat/MessageList.d.ts +15 -0
- package/dist/react/components/chat/ProgressCircle.d.ts +12 -0
- package/dist/react/components/chat/RenderErrorBoundary.d.ts +19 -0
- package/dist/react/components/chat/ResourceIframe.d.ts +5 -0
- package/dist/react/components/chat/Shimmer.d.ts +6 -0
- package/dist/react/components/chat/SkillCompletionMenu.d.ts +9 -0
- package/dist/react/components/chat/SkillStatusBar.d.ts +8 -0
- package/dist/react/components/chat/StickyStatusBar.d.ts +10 -0
- package/dist/react/components/chat/TextAttachmentPills.d.ts +10 -0
- package/dist/react/components/chat/ThinkingToggle.d.ts +7 -0
- package/dist/react/components/chat/ToolCallBlock.d.ts +18 -0
- package/dist/react/components/chat/TurnNavRail.d.ts +11 -0
- package/dist/react/components/chat/UserMessageBubble.d.ts +20 -0
- package/dist/react/components/chat/WhatIfUserBubble.d.ts +13 -0
- package/dist/react/components/chat/customization.d.ts +82 -0
- package/dist/react/components/chat/display-utils.d.ts +35 -0
- package/dist/react/components/chat/extensions/file-mention.d.ts +12 -0
- package/dist/react/components/chat/extensions/skill-mention.d.ts +25 -0
- package/dist/react/components/chat/index.d.ts +16 -115
- package/dist/react/components/chat/index.js +8 -7
- package/dist/react/components/chat/scroll-anchor.d.ts +8 -0
- package/dist/react/components/chat/tool-renderers/BashRenderer.d.ts +2 -0
- package/dist/react/components/chat/tool-renderers/FileEditRenderer.d.ts +2 -0
- package/dist/react/components/chat/tool-renderers/FileReadRenderer.d.ts +2 -0
- package/dist/react/components/chat/tool-renderers/SearchRenderer.d.ts +2 -0
- package/dist/react/components/chat/tool-renderers/SubmitResultRenderer.d.ts +2 -0
- package/dist/react/components/chat/tool-renderers/registry.d.ts +9 -0
- package/dist/react/components/chat/tool-renderers/shared.d.ts +26 -0
- package/dist/react/components/chat/whatif-quote-context.d.ts +15 -0
- package/dist/react/components/markdown/ExternalLinkDialog.d.ts +8 -0
- package/dist/react/components/markdown/FileCardComponent.d.ts +10 -0
- package/dist/react/components/markdown/MarkdownContent.d.ts +19 -0
- package/dist/react/components/model/ModelSelector.d.ts +9 -0
- package/dist/react/components/plan/PlanSummaryCard.d.ts +8 -0
- package/dist/react/components/plan/PlanVisualization.d.ts +13 -0
- package/dist/react/components/plan/debug-log.d.ts +21 -0
- package/dist/react/components/plan/extract-plan-messages.d.ts +2 -0
- package/dist/react/components/plan/index.d.ts +6 -110
- package/dist/react/components/plan/index.js +7 -6
- package/dist/react/components/plan/index.js.map +1 -1
- package/dist/react/components/plan/parse-plan-messages.d.ts +10 -0
- package/dist/react/components/plan/parse-plan-tree.d.ts +16 -0
- package/dist/react/components/plan/phases/PlanMindMap.d.ts +8 -0
- package/dist/react/components/plan/phases/PlanStatusIcon.d.ts +5 -0
- package/dist/react/components/plan/phases/PlanTree.d.ts +8 -0
- package/dist/react/components/plan/phases/SkillAnalysis.d.ts +7 -0
- package/dist/react/components/plan/phases/SkillDiscovery.d.ts +10 -0
- package/dist/react/components/plan/types.d.ts +56 -0
- package/dist/react/components/session/SessionDetail.d.ts +8 -0
- package/dist/react/components/session/SessionList.d.ts +9 -0
- package/dist/react/components/session/SessionListItem.d.ts +8 -0
- package/dist/react/components/session/StatusBadge.d.ts +3 -0
- package/dist/react/components/session/index.d.ts +5 -53
- package/dist/react/components/session/index.js +6 -5
- package/dist/react/components/session/index.js.map +1 -1
- package/dist/react/components/session/session-utils.d.ts +19 -0
- package/dist/react/components/ui/collapsible.d.ts +5 -0
- package/dist/react/components/workspace/FileTree.d.ts +21 -0
- package/dist/react/components/workspace/WorkspaceFilesPanel.d.ts +30 -0
- package/dist/react/components/workspace/file-icon-assets.d.ts +3 -0
- package/dist/react/components/workspace/index.d.ts +2 -59
- package/dist/react/components/workspace/index.js +6 -5
- package/dist/react/components/workspace/index.js.map +1 -1
- package/dist/react/context.d.ts +2 -0
- package/dist/react/devtools/bridge-devtools/BridgeDevtoolsFab.d.ts +1 -0
- package/dist/react/devtools/bridge-devtools/index.d.ts +3 -36
- package/dist/react/devtools/bridge-devtools/mount.d.ts +1 -0
- package/dist/react/devtools/bridge-devtools/store.d.ts +15 -0
- package/dist/react/devtools/bridge-devtools/tap.d.ts +5 -0
- package/dist/react/devtools/bridge-devtools/types.d.ts +29 -0
- package/dist/react/hooks/use-background-tasks.d.ts +7 -0
- package/dist/react/hooks/use-card-state.d.ts +1 -0
- package/dist/react/hooks/use-chat.d.ts +13 -0
- package/dist/react/hooks/use-check-skill-file.d.ts +4 -0
- package/dist/react/hooks/use-check-solution-file.d.ts +4 -0
- package/dist/react/hooks/use-context-stats.d.ts +7 -0
- package/dist/react/hooks/use-gis.d.ts +17 -0
- package/dist/react/hooks/use-global-skill-stats.d.ts +6 -0
- package/dist/react/hooks/use-input-history.d.ts +7 -0
- package/dist/react/hooks/use-model-preferences.d.ts +18 -0
- package/dist/react/hooks/use-registry.d.ts +53 -0
- package/dist/react/hooks/use-resolved-model.d.ts +6 -0
- package/dist/react/hooks/use-session.d.ts +10 -0
- package/dist/react/hooks/use-skill-stats.d.ts +7 -0
- package/dist/react/hooks/use-skills.d.ts +6 -0
- package/dist/react/hooks/use-token-pressure.d.ts +6 -0
- package/dist/react/index.d.ts +124 -2034
- package/dist/react/index.js +125 -50
- package/dist/react/index.js.map +1 -1
- package/dist/react/lib/analytics.d.ts +7 -0
- package/dist/react/lib/attachment-upload.d.ts +10 -0
- package/dist/react/lib/card-registry.d.ts +35 -0
- package/dist/react/lib/chat.d.ts +48 -0
- package/dist/react/lib/code-highlight.d.ts +9 -0
- package/dist/react/lib/html-element-selection.d.ts +140 -0
- package/dist/react/lib/html-source-locator.d.ts +16 -0
- package/dist/react/lib/open-session-file.d.ts +2 -0
- package/dist/react/lib/parent-bridge.d.ts +22 -0
- package/dist/react/lib/preview-dispatch.d.ts +24 -0
- package/dist/react/lib/resource-bridge.d.ts +11 -0
- package/dist/react/lib/session-file-preview.d.ts +8 -0
- package/dist/react/lib/step-ranges.d.ts +42 -0
- package/dist/react/lib/tool-preview.d.ts +2 -0
- package/dist/react/lib/ui-meta.d.ts +9 -0
- package/dist/react/lib/utils.d.ts +3 -0
- package/dist/react/lib/whatif-prompt.d.ts +45 -0
- package/dist/react/provider.d.ts +8 -0
- package/dist/react/routes.d.ts +1 -0
- package/dist/react/schemas/background.d.ts +16 -0
- package/dist/react/schemas/event.d.ts +51 -0
- package/dist/react/schemas/gis.d.ts +50 -0
- package/dist/{AskUserQuestionBlock---kOTouk.d.ts → react/schemas/message.d.ts} +15 -48
- package/dist/react/schemas/partner-skill.d.ts +46 -0
- package/dist/{projection-BWYEFYNn.d.ts → react/schemas/projection.d.ts} +12 -10
- package/dist/react/schemas/published-apps.d.ts +38 -0
- package/dist/react/schemas/scheduled-task.d.ts +32 -0
- package/dist/react/schemas/session.d.ts +121 -0
- package/dist/react/schemas/skill.d.ts +50 -0
- package/dist/react/schemas/studio/agent.d.ts +12 -0
- package/dist/react/schemas/studio/database.d.ts +39 -0
- package/dist/react/schemas/studio/env.d.ts +7 -0
- package/dist/react/schemas/studio/knowledge.d.ts +18 -0
- package/dist/react/schemas/studio/resource-base.d.ts +7 -0
- package/dist/react/schemas/studio/scene.d.ts +12 -0
- package/dist/react/schemas/studio/tool.d.ts +25 -0
- package/dist/react/schemas/task.d.ts +12 -0
- package/dist/react/sockets/event-bridge.d.ts +115 -0
- package/dist/react/sockets/socket-state.d.ts +4 -0
- package/dist/react/stores/answer-callback-store.d.ts +9 -0
- package/dist/react/stores/auth-store.d.ts +38 -0
- package/dist/react/stores/background-store.d.ts +13 -0
- package/dist/react/stores/card-state-store.d.ts +10 -0
- package/dist/react/stores/chat-store.d.ts +34 -0
- package/dist/react/stores/client-aware.d.ts +7 -0
- package/dist/react/stores/connection-store.d.ts +14 -0
- package/dist/react/stores/gis-store.d.ts +19 -0
- package/dist/react/stores/index.d.ts +14 -0
- package/dist/react/stores/runtime-features-store.d.ts +21 -0
- package/dist/react/stores/runtime-store.d.ts +18 -0
- package/dist/react/stores/session-store.d.ts +44 -0
- package/dist/react/stores/task-store.d.ts +9 -0
- package/dist/react/stores/ui-bridge-store.d.ts +32 -0
- package/dist/react/stores/ui-store.d.ts +69 -0
- package/dist/react/types/index.d.ts +7 -0
- package/dist/react/types/solution.d.ts +101 -0
- package/package.json +41 -11
- package/dist/SkillStatusBar-U6fbQxMu.d.ts +0 -340
- package/dist/blade-client-qTOovekU.d.ts +0 -1609
- package/dist/chunk-3I4ZURKH.js.map +0 -1
- package/dist/chunk-M45K3554.js.map +0 -1
- package/dist/chunk-QODAKTG5.js.map +0 -1
- package/dist/chunk-WVXXQ3KM.js.map +0 -1
- package/dist/session-CNnotR90.d.ts +0 -227
- package/dist/sessions-BvfLGbjw.d.ts +0 -177
- /package/dist/{chunk-4D4EXLVT.js.map → chunk-DQCXSPHP.js.map} +0 -0
- /package/dist/{chunk-XCIDE3JW.js.map → chunk-OGHUIKCY.js.map} +0 -0
- /package/dist/{chunk-WPLEMYL7.js.map → chunk-PYYDXV2A.js.map} +0 -0
- /package/dist/{chunk-VJY6RLYU.js.map → chunk-TVWC3PED.js.map} +0 -0
|
@@ -1,17 +1,65 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
tapBridgeEvent
|
|
3
|
+
} from "./chunk-J3XVFPOV.js";
|
|
4
|
+
import {
|
|
5
|
+
BladeClient,
|
|
6
|
+
ClientProjectionBuilder
|
|
7
|
+
} from "./chunk-YJ6BX3FU.js";
|
|
4
8
|
import {
|
|
5
9
|
createClientActions,
|
|
6
10
|
useCardStateStore
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
tapBridgeEvent
|
|
10
|
-
} from "./chunk-J3XVFPOV.js";
|
|
11
|
+
} from "./chunk-JCJFFJ42.js";
|
|
11
12
|
import {
|
|
12
13
|
__export
|
|
13
14
|
} from "./chunk-PZ5AY32C.js";
|
|
14
15
|
|
|
16
|
+
// src/react/api/sessions.ts
|
|
17
|
+
var sessions_exports = {};
|
|
18
|
+
__export(sessions_exports, {
|
|
19
|
+
checkoutSession: () => checkoutSession,
|
|
20
|
+
copyFile: () => copyFile,
|
|
21
|
+
createSession: () => createSession,
|
|
22
|
+
createSessionWithRequest: () => createSessionWithRequest,
|
|
23
|
+
createShare: () => createShare,
|
|
24
|
+
deleteFile: () => deleteFile,
|
|
25
|
+
deleteSession: () => deleteSession,
|
|
26
|
+
exportSession: () => exportSession,
|
|
27
|
+
getBackgroundTask: () => getBackgroundTask,
|
|
28
|
+
getDownloadDirUrl: () => getDownloadDirUrl,
|
|
29
|
+
getSession: () => getSession,
|
|
30
|
+
getSessionCheckpoints: () => getSessionCheckpoints,
|
|
31
|
+
getSessionContextStats: () => getSessionContextStats,
|
|
32
|
+
getSessionExtraInfoByTask: () => getSessionExtraInfoByTask,
|
|
33
|
+
getSessionHistory: () => getSessionHistory,
|
|
34
|
+
getSessionTasks: () => getSessionTasks,
|
|
35
|
+
getSessionTurns: () => getSessionTurns,
|
|
36
|
+
getSharedSession: () => getSharedSession,
|
|
37
|
+
importSession: () => importSession,
|
|
38
|
+
listBackgroundTasks: () => listBackgroundTasks,
|
|
39
|
+
listDir: () => listDir,
|
|
40
|
+
listSessions: () => listSessions,
|
|
41
|
+
listSessionsPaginated: () => listSessionsPaginated,
|
|
42
|
+
listSessionsWithSkillData: () => listSessionsWithSkillData,
|
|
43
|
+
pinSession: () => pinSession,
|
|
44
|
+
previewImport: () => previewImport,
|
|
45
|
+
probeSessionUrl: () => probeSessionUrl,
|
|
46
|
+
renameFile: () => renameFile,
|
|
47
|
+
revokeShare: () => revokeShare,
|
|
48
|
+
rewindSession: () => rewindSession,
|
|
49
|
+
shareFile: () => shareFile,
|
|
50
|
+
startReplaySession: () => startReplaySession,
|
|
51
|
+
stopBackgroundTask: () => stopBackgroundTask,
|
|
52
|
+
switchBranch: () => switchBranch,
|
|
53
|
+
tokenizeMessages: () => tokenizeMessages,
|
|
54
|
+
tokenizePrompt: () => tokenizePrompt,
|
|
55
|
+
updateReplaySession: () => updateReplaySession,
|
|
56
|
+
updateSession: () => updateSession,
|
|
57
|
+
updateSessionMemory: () => updateSessionMemory,
|
|
58
|
+
updateSharing: () => updateSharing,
|
|
59
|
+
uploadFiles: () => uploadFiles,
|
|
60
|
+
writeFile: () => writeFile
|
|
61
|
+
});
|
|
62
|
+
|
|
15
63
|
// src/react/api/partner-skill.ts
|
|
16
64
|
var partner_skill_exports = {};
|
|
17
65
|
__export(partner_skill_exports, {
|
|
@@ -571,1104 +619,6 @@ function isUiMeta(value) {
|
|
|
571
619
|
return true;
|
|
572
620
|
}
|
|
573
621
|
|
|
574
|
-
// src/react/projection/helpers.ts
|
|
575
|
-
function upsertToolCall(state, toolCallId, toolName, displayName, args) {
|
|
576
|
-
if (!toolCallId) return;
|
|
577
|
-
let found = false;
|
|
578
|
-
for (let i = 0; i < state.toolCalls.length; i++) {
|
|
579
|
-
if (state.toolCalls[i].id !== toolCallId) continue;
|
|
580
|
-
const tc = state.toolCalls[i];
|
|
581
|
-
state.toolCalls[i] = {
|
|
582
|
-
...tc,
|
|
583
|
-
tool_name: toolName || tc.tool_name,
|
|
584
|
-
display_name: displayName || tc.display_name,
|
|
585
|
-
arguments: args || tc.arguments
|
|
586
|
-
};
|
|
587
|
-
found = true;
|
|
588
|
-
break;
|
|
589
|
-
}
|
|
590
|
-
if (!found) {
|
|
591
|
-
state.toolCalls.push({
|
|
592
|
-
id: toolCallId,
|
|
593
|
-
tool_name: toolName,
|
|
594
|
-
display_name: displayName,
|
|
595
|
-
arguments: args,
|
|
596
|
-
status: "pending"
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
let blockFound = false;
|
|
600
|
-
for (let i = 0; i < state.blocks.length; i++) {
|
|
601
|
-
const b = state.blocks[i];
|
|
602
|
-
if (b.type !== "tool_use" || b.tool_call_id !== toolCallId) continue;
|
|
603
|
-
state.blocks[i] = {
|
|
604
|
-
...b,
|
|
605
|
-
content: args || b.content,
|
|
606
|
-
tool_name: toolName || b.tool_name,
|
|
607
|
-
display_name: displayName || b.display_name
|
|
608
|
-
};
|
|
609
|
-
blockFound = true;
|
|
610
|
-
break;
|
|
611
|
-
}
|
|
612
|
-
if (!blockFound) {
|
|
613
|
-
state.blocks.push({
|
|
614
|
-
type: "tool_use",
|
|
615
|
-
content: args,
|
|
616
|
-
tool_call_id: toolCallId,
|
|
617
|
-
tool_name: toolName || null,
|
|
618
|
-
display_name: displayName || null
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
function applyToolResult(state, toolCallId, result, status, durationMs, sourceLoop) {
|
|
623
|
-
let toolName = "";
|
|
624
|
-
let displayName = "";
|
|
625
|
-
let finalResult = result;
|
|
626
|
-
for (let i = 0; i < state.toolCalls.length; i++) {
|
|
627
|
-
const tc = state.toolCalls[i];
|
|
628
|
-
if (tc.id !== toolCallId) continue;
|
|
629
|
-
if (typeof result === "string") {
|
|
630
|
-
finalResult = maybeEnrichAskUserResult(tc.tool_name, result, sourceLoop);
|
|
631
|
-
}
|
|
632
|
-
const update = { status, result: finalResult };
|
|
633
|
-
if (durationMs != null) update.duration_ms = durationMs;
|
|
634
|
-
state.toolCalls[i] = { ...tc, ...update };
|
|
635
|
-
toolName = tc.tool_name;
|
|
636
|
-
displayName = tc.display_name;
|
|
637
|
-
break;
|
|
638
|
-
}
|
|
639
|
-
upsertToolResultBlock(state, toolCallId, finalResult, toolName, displayName);
|
|
640
|
-
}
|
|
641
|
-
function appendToolResultDelta(state, toolCallId, delta) {
|
|
642
|
-
if (!toolCallId || !delta) return;
|
|
643
|
-
let toolName = "";
|
|
644
|
-
let displayName = "";
|
|
645
|
-
let currentResult = "";
|
|
646
|
-
for (let i = 0; i < state.toolCalls.length; i++) {
|
|
647
|
-
const tc = state.toolCalls[i];
|
|
648
|
-
if (tc.id !== toolCallId) continue;
|
|
649
|
-
toolName = tc.tool_name;
|
|
650
|
-
displayName = tc.display_name;
|
|
651
|
-
if (typeof tc.result === "string") currentResult = tc.result;
|
|
652
|
-
state.toolCalls[i] = { ...tc, result: currentResult + delta };
|
|
653
|
-
break;
|
|
654
|
-
}
|
|
655
|
-
for (const block of state.blocks) {
|
|
656
|
-
if (block.type !== "tool_result" || block.tool_call_id !== toolCallId) continue;
|
|
657
|
-
if (typeof block.content === "string") currentResult = block.content;
|
|
658
|
-
break;
|
|
659
|
-
}
|
|
660
|
-
upsertToolResultBlock(state, toolCallId, currentResult + delta, toolName, displayName);
|
|
661
|
-
}
|
|
662
|
-
function upsertToolResultBlock(state, toolCallId, content, toolName, displayName) {
|
|
663
|
-
for (let i = 0; i < state.blocks.length; i++) {
|
|
664
|
-
const block = state.blocks[i];
|
|
665
|
-
if (block.type !== "tool_result" || block.tool_call_id !== toolCallId) continue;
|
|
666
|
-
state.blocks[i] = {
|
|
667
|
-
...block,
|
|
668
|
-
content,
|
|
669
|
-
tool_name: toolName || block.tool_name,
|
|
670
|
-
display_name: displayName || block.display_name
|
|
671
|
-
};
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
state.blocks.push({
|
|
675
|
-
type: "tool_result",
|
|
676
|
-
content,
|
|
677
|
-
tool_call_id: toolCallId,
|
|
678
|
-
tool_name: toolName || null,
|
|
679
|
-
display_name: displayName || null
|
|
680
|
-
});
|
|
681
|
-
}
|
|
682
|
-
function appendTextBlock(state, blockType, content) {
|
|
683
|
-
if (content == null || content === "") return;
|
|
684
|
-
const text = String(content);
|
|
685
|
-
const lastBlock = state.blocks[state.blocks.length - 1];
|
|
686
|
-
if (lastBlock && lastBlock.type === blockType && typeof lastBlock.content === "string") {
|
|
687
|
-
state.blocks[state.blocks.length - 1] = {
|
|
688
|
-
...lastBlock,
|
|
689
|
-
content: lastBlock.content + text
|
|
690
|
-
};
|
|
691
|
-
return;
|
|
692
|
-
}
|
|
693
|
-
state.blocks.push({ type: blockType, content: text });
|
|
694
|
-
}
|
|
695
|
-
function appendToolCallArguments(state, toolCallId, delta) {
|
|
696
|
-
let newArgs = "";
|
|
697
|
-
for (let i = 0; i < state.toolCalls.length; i++) {
|
|
698
|
-
const tc = state.toolCalls[i];
|
|
699
|
-
if (tc.id === toolCallId) {
|
|
700
|
-
newArgs = tc.arguments + delta;
|
|
701
|
-
state.toolCalls[i] = { ...tc, arguments: newArgs };
|
|
702
|
-
break;
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
if (!newArgs) return;
|
|
706
|
-
for (let i = 0; i < state.blocks.length; i++) {
|
|
707
|
-
const b = state.blocks[i];
|
|
708
|
-
if (b.type === "tool_use" && b.tool_call_id === toolCallId) {
|
|
709
|
-
state.blocks[i] = { ...b, content: newArgs };
|
|
710
|
-
break;
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
function maybeEnrichAskUserResult(toolName, result, sourceLoop) {
|
|
715
|
-
if (!sourceLoop) return result;
|
|
716
|
-
const normalized = toolName.includes(":") ? toolName.split(":").pop() : toolName;
|
|
717
|
-
if (normalized !== "AskUserQuestion") return result;
|
|
718
|
-
try {
|
|
719
|
-
const payload = JSON.parse(result);
|
|
720
|
-
if (typeof payload !== "object" || payload === null) return result;
|
|
721
|
-
payload.source_loop = sourceLoop;
|
|
722
|
-
return JSON.stringify(payload);
|
|
723
|
-
} catch {
|
|
724
|
-
return result;
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
function buildSystemNotificationTurn(sequence, turnId, loopId, notificationType, status, title, detail, metadata) {
|
|
728
|
-
return {
|
|
729
|
-
id: turnId,
|
|
730
|
-
sequence,
|
|
731
|
-
turn_id: turnId,
|
|
732
|
-
loop_id: loopId,
|
|
733
|
-
kind: "message",
|
|
734
|
-
role: "system",
|
|
735
|
-
status: "completed",
|
|
736
|
-
blocks: [
|
|
737
|
-
{
|
|
738
|
-
type: "system_notification",
|
|
739
|
-
content: {
|
|
740
|
-
notification_type: notificationType,
|
|
741
|
-
status,
|
|
742
|
-
title,
|
|
743
|
-
detail,
|
|
744
|
-
metadata
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
],
|
|
748
|
-
tool_calls: [],
|
|
749
|
-
model: null,
|
|
750
|
-
usage: null,
|
|
751
|
-
duration_ms: 0
|
|
752
|
-
};
|
|
753
|
-
}
|
|
754
|
-
function buildSystemNotificationBlock(notificationType, status, title, detail, metadata) {
|
|
755
|
-
return {
|
|
756
|
-
type: "system_notification",
|
|
757
|
-
content: {
|
|
758
|
-
notification_type: notificationType,
|
|
759
|
-
status,
|
|
760
|
-
title,
|
|
761
|
-
detail,
|
|
762
|
-
metadata
|
|
763
|
-
}
|
|
764
|
-
};
|
|
765
|
-
}
|
|
766
|
-
function buildMarkerTurn(sequence, turnId, loopId, blockType, content) {
|
|
767
|
-
return {
|
|
768
|
-
id: turnId,
|
|
769
|
-
sequence,
|
|
770
|
-
turn_id: turnId,
|
|
771
|
-
loop_id: loopId,
|
|
772
|
-
kind: "message",
|
|
773
|
-
role: "assistant",
|
|
774
|
-
status: "completed",
|
|
775
|
-
blocks: [{ type: blockType, content }],
|
|
776
|
-
tool_calls: [],
|
|
777
|
-
model: null,
|
|
778
|
-
usage: null,
|
|
779
|
-
duration_ms: 0
|
|
780
|
-
};
|
|
781
|
-
}
|
|
782
|
-
function buildCompactionTurn(sequence, compactionId, loopId, status, data) {
|
|
783
|
-
const tokensBefore = asInt(data.tokens_before);
|
|
784
|
-
const tokensAfter = asInt(data.tokens_after);
|
|
785
|
-
let savedRatio = null;
|
|
786
|
-
if (tokensBefore && tokensBefore > 0 && tokensAfter != null) {
|
|
787
|
-
savedRatio = 1 - tokensAfter / tokensBefore;
|
|
788
|
-
} else {
|
|
789
|
-
savedRatio = asFloat(data.saved_ratio);
|
|
790
|
-
}
|
|
791
|
-
let archivedCount = asInt(data.archived_count);
|
|
792
|
-
if (archivedCount == null && Array.isArray(data.archived_files)) {
|
|
793
|
-
archivedCount = data.archived_files.length;
|
|
794
|
-
}
|
|
795
|
-
const content = data.content;
|
|
796
|
-
const summaryFull = compactionSummaryFull(content);
|
|
797
|
-
const summaryPreview = summaryFull ? summaryFull.split("\n").map((l) => l.trim()).filter(Boolean).join(" ").slice(0, 200) : null;
|
|
798
|
-
return {
|
|
799
|
-
id: `compaction:${compactionId}`,
|
|
800
|
-
sequence,
|
|
801
|
-
turn_id: `compaction:${compactionId}`,
|
|
802
|
-
loop_id: loopId,
|
|
803
|
-
kind: "compaction",
|
|
804
|
-
role: "system",
|
|
805
|
-
status,
|
|
806
|
-
blocks: [],
|
|
807
|
-
tool_calls: [],
|
|
808
|
-
model: null,
|
|
809
|
-
usage: null,
|
|
810
|
-
duration_ms: 0,
|
|
811
|
-
compaction_id: compactionId,
|
|
812
|
-
summary_preview: summaryPreview,
|
|
813
|
-
summary_full: summaryFull,
|
|
814
|
-
archived_count: archivedCount,
|
|
815
|
-
tokens_before: tokensBefore,
|
|
816
|
-
tokens_after: tokensAfter,
|
|
817
|
-
saved_ratio: savedRatio,
|
|
818
|
-
trigger: asTrigger(data.trigger),
|
|
819
|
-
failure_reason: typeof data.reason === "string" && data.reason ? data.reason : null,
|
|
820
|
-
fallback_applied: typeof data.fallback_applied === "boolean" ? data.fallback_applied : null
|
|
821
|
-
};
|
|
822
|
-
}
|
|
823
|
-
function compactionSummaryFull(content) {
|
|
824
|
-
const text = String(content ?? "");
|
|
825
|
-
if (!text) return null;
|
|
826
|
-
const cleaned = text.replace("<compaction-summary>", "").replace("</compaction-summary>", "").replace(/\r\n/g, "\n").replace(/\r/g, "\n").trim();
|
|
827
|
-
return cleaned || null;
|
|
828
|
-
}
|
|
829
|
-
function asInt(value) {
|
|
830
|
-
if (typeof value === "boolean") return null;
|
|
831
|
-
if (typeof value === "number") return Math.trunc(value);
|
|
832
|
-
return null;
|
|
833
|
-
}
|
|
834
|
-
function asFloat(value) {
|
|
835
|
-
if (typeof value === "boolean") return null;
|
|
836
|
-
if (typeof value === "number") return value;
|
|
837
|
-
return null;
|
|
838
|
-
}
|
|
839
|
-
function asTrigger(value) {
|
|
840
|
-
if (value === "auto" || value === "manual" || value === "forced_retry") return value;
|
|
841
|
-
return null;
|
|
842
|
-
}
|
|
843
|
-
function setToolCallStatus(turn, toolCallId, status, result, pendingQuestionRef) {
|
|
844
|
-
if (!turn || !toolCallId) return;
|
|
845
|
-
const toolCalls = "toolCalls" in turn ? turn.toolCalls : turn.tool_calls;
|
|
846
|
-
for (let i = 0; i < toolCalls.length; i++) {
|
|
847
|
-
if (toolCalls[i].id !== toolCallId) continue;
|
|
848
|
-
toolCalls[i] = {
|
|
849
|
-
...toolCalls[i],
|
|
850
|
-
status,
|
|
851
|
-
result,
|
|
852
|
-
pending_question_ref: pendingQuestionRef
|
|
853
|
-
};
|
|
854
|
-
return;
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
function applyAskUserPauseToTurn(turn, pauseToolData, toolCallId, childLoopName, description, displayNameResolver) {
|
|
858
|
-
if (!turn || !toolCallId) return;
|
|
859
|
-
const sourceLoop = childLoopName ? { loop_name: childLoopName, description } : null;
|
|
860
|
-
const toolName = String(pauseToolData.name ?? "AskUserQuestion");
|
|
861
|
-
const args = JSON.stringify(pauseToolData.arguments ?? {});
|
|
862
|
-
const result = askUserResultFromPausePayload(pauseToolData, sourceLoop);
|
|
863
|
-
const isTurnState = "toolCalls" in turn;
|
|
864
|
-
const toolCalls = isTurnState ? turn.toolCalls : turn.tool_calls;
|
|
865
|
-
const blocks = turn.blocks;
|
|
866
|
-
const displayName = displayNameResolver(toolName);
|
|
867
|
-
let found = false;
|
|
868
|
-
for (let i = 0; i < toolCalls.length; i++) {
|
|
869
|
-
if (toolCalls[i].id !== toolCallId) continue;
|
|
870
|
-
toolCalls[i] = {
|
|
871
|
-
...toolCalls[i],
|
|
872
|
-
tool_name: toolName || toolCalls[i].tool_name,
|
|
873
|
-
display_name: displayName || toolCalls[i].display_name,
|
|
874
|
-
arguments: args || toolCalls[i].arguments
|
|
875
|
-
};
|
|
876
|
-
found = true;
|
|
877
|
-
break;
|
|
878
|
-
}
|
|
879
|
-
if (!found) {
|
|
880
|
-
toolCalls.push({
|
|
881
|
-
id: toolCallId,
|
|
882
|
-
tool_name: toolName,
|
|
883
|
-
display_name: displayName,
|
|
884
|
-
arguments: args,
|
|
885
|
-
status: "pending"
|
|
886
|
-
});
|
|
887
|
-
}
|
|
888
|
-
let blockFound = false;
|
|
889
|
-
for (let i = 0; i < blocks.length; i++) {
|
|
890
|
-
if (blocks[i].type !== "tool_use" || blocks[i].tool_call_id !== toolCallId) continue;
|
|
891
|
-
blocks[i] = { ...blocks[i], content: args, tool_name: toolName, display_name: displayName };
|
|
892
|
-
blockFound = true;
|
|
893
|
-
break;
|
|
894
|
-
}
|
|
895
|
-
if (!blockFound) {
|
|
896
|
-
blocks.push({
|
|
897
|
-
type: "tool_use",
|
|
898
|
-
content: args,
|
|
899
|
-
tool_call_id: toolCallId,
|
|
900
|
-
tool_name: toolName,
|
|
901
|
-
display_name: displayName
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
setToolCallStatus(turn, toolCallId, "awaiting_answer", result, null);
|
|
905
|
-
let resultBlockFound = false;
|
|
906
|
-
for (let i = 0; i < blocks.length; i++) {
|
|
907
|
-
if (blocks[i].type !== "tool_result" || blocks[i].tool_call_id !== toolCallId) continue;
|
|
908
|
-
blocks[i] = { ...blocks[i], content: result };
|
|
909
|
-
resultBlockFound = true;
|
|
910
|
-
break;
|
|
911
|
-
}
|
|
912
|
-
if (!resultBlockFound) {
|
|
913
|
-
blocks.push({
|
|
914
|
-
type: "tool_result",
|
|
915
|
-
content: result,
|
|
916
|
-
tool_call_id: toolCallId,
|
|
917
|
-
tool_name: toolName,
|
|
918
|
-
display_name: displayName
|
|
919
|
-
});
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
function applyChildPauseToParent(parentTurn, parentToolCallId, childLoopName, childToolCallId, description, displayNameResolver) {
|
|
923
|
-
if (!parentTurn || !parentToolCallId) return;
|
|
924
|
-
const toolCalls = "toolCalls" in parentTurn ? parentTurn.toolCalls : parentTurn.tool_calls;
|
|
925
|
-
const blocks = parentTurn.blocks;
|
|
926
|
-
const displayName = displayNameResolver("Agent");
|
|
927
|
-
let found = false;
|
|
928
|
-
for (let i = 0; i < toolCalls.length; i++) {
|
|
929
|
-
if (toolCalls[i].id !== parentToolCallId) continue;
|
|
930
|
-
toolCalls[i] = {
|
|
931
|
-
...toolCalls[i],
|
|
932
|
-
tool_name: "Agent",
|
|
933
|
-
display_name: displayName || toolCalls[i].display_name
|
|
934
|
-
};
|
|
935
|
-
found = true;
|
|
936
|
-
break;
|
|
937
|
-
}
|
|
938
|
-
if (!found) {
|
|
939
|
-
toolCalls.push({
|
|
940
|
-
id: parentToolCallId,
|
|
941
|
-
tool_name: "Agent",
|
|
942
|
-
display_name: displayName,
|
|
943
|
-
arguments: "",
|
|
944
|
-
status: "pending"
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
let blockFound = false;
|
|
948
|
-
for (let i = 0; i < blocks.length; i++) {
|
|
949
|
-
if (blocks[i].type !== "tool_use" || blocks[i].tool_call_id !== parentToolCallId) continue;
|
|
950
|
-
blockFound = true;
|
|
951
|
-
break;
|
|
952
|
-
}
|
|
953
|
-
if (!blockFound) {
|
|
954
|
-
blocks.push({
|
|
955
|
-
type: "tool_use",
|
|
956
|
-
content: "",
|
|
957
|
-
tool_call_id: parentToolCallId,
|
|
958
|
-
tool_name: "Agent",
|
|
959
|
-
display_name: displayName
|
|
960
|
-
});
|
|
961
|
-
}
|
|
962
|
-
setToolCallStatus(parentTurn, parentToolCallId, "awaiting_answer", null, {
|
|
963
|
-
child_loop_name: childLoopName,
|
|
964
|
-
child_tool_call_id: childToolCallId,
|
|
965
|
-
description: description || null
|
|
966
|
-
});
|
|
967
|
-
}
|
|
968
|
-
function askUserResultFromPausePayload(pauseToolData, sourceLoop) {
|
|
969
|
-
const args = typeof pauseToolData.arguments === "object" && pauseToolData.arguments !== null ? pauseToolData.arguments : {};
|
|
970
|
-
const payload = { questions: args.questions ?? [] };
|
|
971
|
-
if (sourceLoop) payload.source_loop = sourceLoop;
|
|
972
|
-
return JSON.stringify(payload);
|
|
973
|
-
}
|
|
974
|
-
function sourceLoopFor(loopId, loopDescriptions) {
|
|
975
|
-
if (loopId === "root") return null;
|
|
976
|
-
const description = loopDescriptions.get(loopId);
|
|
977
|
-
if (!description) return null;
|
|
978
|
-
return { loop_name: loopId, description };
|
|
979
|
-
}
|
|
980
|
-
function normalizeChildPause(pausePayload) {
|
|
981
|
-
const rawPtd = pausePayload.pause_tool_data;
|
|
982
|
-
const pauseToolData = typeof rawPtd === "object" && rawPtd !== null ? { ...rawPtd } : { ...pausePayload };
|
|
983
|
-
let sourceLoop = pauseToolData.source_loop;
|
|
984
|
-
if (typeof sourceLoop !== "object" || sourceLoop === null) {
|
|
985
|
-
sourceLoop = pausePayload.source_loop;
|
|
986
|
-
}
|
|
987
|
-
const childLoopName = String(pausePayload.child_loop_name ?? "") || (typeof sourceLoop === "object" && sourceLoop ? String(sourceLoop.name ?? "") : "");
|
|
988
|
-
const childToolCallId = String(
|
|
989
|
-
pausePayload.child_pause_tool_call_id ?? pauseToolData.tool_call_id ?? ""
|
|
990
|
-
);
|
|
991
|
-
const description = typeof sourceLoop === "object" && sourceLoop ? String(sourceLoop.description ?? "") : "";
|
|
992
|
-
if (childLoopName && description) {
|
|
993
|
-
pauseToolData.source_loop = { name: childLoopName, description };
|
|
994
|
-
}
|
|
995
|
-
return { pauseToolData, childLoopName, childToolCallId, description };
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
// src/react/schemas/message.ts
|
|
999
|
-
function inferToolStatus(resultStr) {
|
|
1000
|
-
if (resultStr.includes('"Cancelled by user"')) return "cancelled";
|
|
1001
|
-
try {
|
|
1002
|
-
const parsed = JSON.parse(resultStr);
|
|
1003
|
-
if (typeof parsed === "object" && parsed !== null) {
|
|
1004
|
-
if ("error" in parsed && parsed.error) return "error";
|
|
1005
|
-
const nested = parsed.result;
|
|
1006
|
-
if (typeof nested === "object" && nested !== null && "error" in nested && nested.error) {
|
|
1007
|
-
return "error";
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
} catch {
|
|
1011
|
-
}
|
|
1012
|
-
return "done";
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
// src/react/projection/state.ts
|
|
1016
|
-
function createTurnState(turnId, loopId, opts = {}) {
|
|
1017
|
-
return {
|
|
1018
|
-
turnId,
|
|
1019
|
-
loopId,
|
|
1020
|
-
role: "assistant",
|
|
1021
|
-
model: opts.model ?? null,
|
|
1022
|
-
startedAt: Date.now(),
|
|
1023
|
-
contextWindow: opts.contextWindow ?? 0,
|
|
1024
|
-
blocks: [],
|
|
1025
|
-
toolCalls: [],
|
|
1026
|
-
usage: null,
|
|
1027
|
-
memoryRefs: opts.memoryRefs ?? null,
|
|
1028
|
-
parentForkToolCallId: null
|
|
1029
|
-
};
|
|
1030
|
-
}
|
|
1031
|
-
function snapshot(state, sequence, status) {
|
|
1032
|
-
return {
|
|
1033
|
-
id: state.turnId,
|
|
1034
|
-
sequence,
|
|
1035
|
-
turn_id: state.turnId,
|
|
1036
|
-
loop_id: state.loopId,
|
|
1037
|
-
kind: "message",
|
|
1038
|
-
role: state.role,
|
|
1039
|
-
status,
|
|
1040
|
-
blocks: [...state.blocks],
|
|
1041
|
-
tool_calls: [...state.toolCalls],
|
|
1042
|
-
model: state.model,
|
|
1043
|
-
usage: state.usage ? { ...state.usage } : null,
|
|
1044
|
-
duration_ms: Math.max(0, Date.now() - state.startedAt),
|
|
1045
|
-
started_at: new Date(state.startedAt).toISOString(),
|
|
1046
|
-
context_window: state.contextWindow,
|
|
1047
|
-
memory_refs: state.memoryRefs,
|
|
1048
|
-
parent_fork_tool_call_id: state.parentForkToolCallId
|
|
1049
|
-
};
|
|
1050
|
-
}
|
|
1051
|
-
var PAUSE_TOOL_NAMES = /* @__PURE__ */ new Set(["AskUserQuestion", "ExitPlanMode"]);
|
|
1052
|
-
function toolStatusFromResult(result) {
|
|
1053
|
-
const text = typeof result === "string" ? result : Array.isArray(result) ? result.filter(
|
|
1054
|
-
(p) => typeof p === "object" && p !== null && p.type === "text"
|
|
1055
|
-
).map((p) => p.text ?? "").join("\n") : String(result ?? "");
|
|
1056
|
-
return inferToolStatus(text);
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
// src/react/projection/builder.ts
|
|
1060
|
-
var ClientProjectionBuilder = class {
|
|
1061
|
-
activeTurns = /* @__PURE__ */ new Map();
|
|
1062
|
-
lastTurnIds = /* @__PURE__ */ new Map();
|
|
1063
|
-
latestTurns = /* @__PURE__ */ new Map();
|
|
1064
|
-
loopDescriptions = /* @__PURE__ */ new Map();
|
|
1065
|
-
pendingChildPauses = /* @__PURE__ */ new Map();
|
|
1066
|
-
pendingMemoryRefs = /* @__PURE__ */ new Map();
|
|
1067
|
-
activeCompactions = /* @__PURE__ */ new Map();
|
|
1068
|
-
seq = 0;
|
|
1069
|
-
syntheticCounter = 0;
|
|
1070
|
-
displayNameResolver;
|
|
1071
|
-
constructor(displayNameResolver) {
|
|
1072
|
-
this.displayNameResolver = displayNameResolver ?? ((n) => n);
|
|
1073
|
-
}
|
|
1074
|
-
processBatch(events) {
|
|
1075
|
-
const lastUpsertByTurn = /* @__PURE__ */ new Map();
|
|
1076
|
-
const nonUpserts = [];
|
|
1077
|
-
for (const event of events) {
|
|
1078
|
-
const updates = this.processEvent(event);
|
|
1079
|
-
if (!updates) continue;
|
|
1080
|
-
for (const u of updates) {
|
|
1081
|
-
if (u.kind === "upsert") {
|
|
1082
|
-
lastUpsertByTurn.set(u.turn.turn_id, u);
|
|
1083
|
-
} else {
|
|
1084
|
-
nonUpserts.push(u);
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
return [...nonUpserts, ...lastUpsertByTurn.values()];
|
|
1089
|
-
}
|
|
1090
|
-
processEvent(event) {
|
|
1091
|
-
const payload = event.payload;
|
|
1092
|
-
const loopId = String(payload.loop_name ?? "root");
|
|
1093
|
-
switch (event.type) {
|
|
1094
|
-
case "memory:inject:done":
|
|
1095
|
-
return this.onMemoryInject(loopId, payload);
|
|
1096
|
-
case "memory:inject:none":
|
|
1097
|
-
return null;
|
|
1098
|
-
case "loop:turn":
|
|
1099
|
-
return this.onLoopTurn(loopId, payload);
|
|
1100
|
-
case "mode:change":
|
|
1101
|
-
return this.onModeChange(loopId, payload);
|
|
1102
|
-
case "plan:status:update":
|
|
1103
|
-
return this.onPlanStatusUpdate(loopId, payload);
|
|
1104
|
-
case "workspace:changed":
|
|
1105
|
-
return this.onWorkspaceChanged(loopId, payload);
|
|
1106
|
-
case "agent:start":
|
|
1107
|
-
return this.onAgentStart(loopId, payload);
|
|
1108
|
-
case "bg:started":
|
|
1109
|
-
return this.onBgStarted(loopId, payload);
|
|
1110
|
-
case "bg:tasks_completed":
|
|
1111
|
-
return this.onBgTasksCompleted(loopId, payload);
|
|
1112
|
-
case "loop:ask_user_answer":
|
|
1113
|
-
return this.onAskUserAnswer(loopId, payload);
|
|
1114
|
-
case "user:message":
|
|
1115
|
-
return this.onUserMessage(loopId, payload);
|
|
1116
|
-
}
|
|
1117
|
-
if (event.type.startsWith("compaction:"))
|
|
1118
|
-
return this.onCompaction(event.type, loopId, payload);
|
|
1119
|
-
const state = this.activeTurns.get(loopId);
|
|
1120
|
-
if (!state) {
|
|
1121
|
-
if (event.type === "chat:end") {
|
|
1122
|
-
this.pendingMemoryRefs.delete(loopId);
|
|
1123
|
-
return null;
|
|
1124
|
-
}
|
|
1125
|
-
if (event.type === "agent:end") return this.onAgentEnd(null, loopId, payload);
|
|
1126
|
-
return null;
|
|
1127
|
-
}
|
|
1128
|
-
switch (event.type) {
|
|
1129
|
-
case "llm:thinking:delta":
|
|
1130
|
-
return this.onDelta(state, "thinking", "", String(payload.content ?? ""));
|
|
1131
|
-
case "llm:content:delta":
|
|
1132
|
-
return this.onDelta(state, "text", "", String(payload.content ?? ""));
|
|
1133
|
-
case "llm:tool_call:created":
|
|
1134
|
-
return this.onToolCallCreated(state, payload);
|
|
1135
|
-
case "llm:response:done":
|
|
1136
|
-
return this.onResponseDone(state, loopId, payload);
|
|
1137
|
-
case "tool:result:delta":
|
|
1138
|
-
return this.onToolResultDelta(state, payload);
|
|
1139
|
-
case "tool:result:done":
|
|
1140
|
-
return this.onToolResultDone(state, loopId, payload);
|
|
1141
|
-
case "loop:tool_ui":
|
|
1142
|
-
return this.onToolUi(state, payload);
|
|
1143
|
-
case "loop:tool_bridge":
|
|
1144
|
-
return this.onToolBridge(state, payload);
|
|
1145
|
-
case "tool:approval:required":
|
|
1146
|
-
return this.onToolApprovalRequired(state, payload);
|
|
1147
|
-
case "loop:child_pause":
|
|
1148
|
-
return this.onChildPause(state, loopId, payload);
|
|
1149
|
-
case "chat:end":
|
|
1150
|
-
return this.onChatEnd(state, loopId, payload);
|
|
1151
|
-
case "agent:end":
|
|
1152
|
-
return this.onAgentEnd(state, loopId, payload);
|
|
1153
|
-
default:
|
|
1154
|
-
return null;
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
reset() {
|
|
1158
|
-
this.activeTurns.clear();
|
|
1159
|
-
this.lastTurnIds.clear();
|
|
1160
|
-
this.latestTurns.clear();
|
|
1161
|
-
this.loopDescriptions.clear();
|
|
1162
|
-
this.pendingChildPauses.clear();
|
|
1163
|
-
this.pendingMemoryRefs.clear();
|
|
1164
|
-
this.activeCompactions.clear();
|
|
1165
|
-
this.seq = 0;
|
|
1166
|
-
this.syntheticCounter = 0;
|
|
1167
|
-
}
|
|
1168
|
-
seedSequence(maxSeq) {
|
|
1169
|
-
if (maxSeq > this.seq) {
|
|
1170
|
-
this.seq = maxSeq;
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
// --- Event handlers ---
|
|
1174
|
-
onMemoryInject(loopId, payload) {
|
|
1175
|
-
const refs = payload.memory_refs;
|
|
1176
|
-
const turnId = String(payload.turn_id ?? "");
|
|
1177
|
-
if (Array.isArray(refs) && refs.length > 0) {
|
|
1178
|
-
this.pendingMemoryRefs.set(loopId, {
|
|
1179
|
-
turnId,
|
|
1180
|
-
refs: refs.map((r4) => ({
|
|
1181
|
-
id: Number(r4.id),
|
|
1182
|
-
content_preview: String(r4.content_preview ?? ""),
|
|
1183
|
-
skill_name: r4.skill_name != null ? String(r4.skill_name) : null
|
|
1184
|
-
}))
|
|
1185
|
-
});
|
|
1186
|
-
}
|
|
1187
|
-
return null;
|
|
1188
|
-
}
|
|
1189
|
-
onLoopTurn(loopId, payload) {
|
|
1190
|
-
let turnId = String(payload.turn_id ?? this.nextTurnId(`turn:${loopId}`));
|
|
1191
|
-
let memoryRefs = null;
|
|
1192
|
-
const pending = this.pendingMemoryRefs.get(loopId);
|
|
1193
|
-
if (pending) {
|
|
1194
|
-
this.pendingMemoryRefs.delete(loopId);
|
|
1195
|
-
if (pending.turnId) turnId = pending.turnId;
|
|
1196
|
-
memoryRefs = pending.refs;
|
|
1197
|
-
}
|
|
1198
|
-
const rawCw = payload.context_window;
|
|
1199
|
-
const contextWindow = typeof rawCw === "number" && rawCw > 0 ? Math.trunc(rawCw) : 0;
|
|
1200
|
-
const state = createTurnState(turnId, loopId, {
|
|
1201
|
-
model: optStr(payload.model),
|
|
1202
|
-
contextWindow,
|
|
1203
|
-
memoryRefs
|
|
1204
|
-
});
|
|
1205
|
-
this.activeTurns.set(loopId, state);
|
|
1206
|
-
this.lastTurnIds.set(loopId, turnId);
|
|
1207
|
-
const turn = snapshot(state, this.nextSeq(), "streaming");
|
|
1208
|
-
this.latestTurns.set(loopId, turn);
|
|
1209
|
-
return [{ kind: "upsert", turn }];
|
|
1210
|
-
}
|
|
1211
|
-
onModeChange(loopId, payload) {
|
|
1212
|
-
const content = {};
|
|
1213
|
-
if (payload.from != null && payload.from !== "") content.from = String(payload.from);
|
|
1214
|
-
if (payload.to != null && payload.to !== "") content.to = String(payload.to);
|
|
1215
|
-
const turn = buildMarkerTurn(
|
|
1216
|
-
this.nextSeq(),
|
|
1217
|
-
this.nextTurnId("mode_change"),
|
|
1218
|
-
loopId,
|
|
1219
|
-
"mode_change",
|
|
1220
|
-
content
|
|
1221
|
-
);
|
|
1222
|
-
return [{ kind: "upsert", turn }];
|
|
1223
|
-
}
|
|
1224
|
-
onPlanStatusUpdate(loopId, payload) {
|
|
1225
|
-
let statuses = payload.statuses;
|
|
1226
|
-
if (typeof statuses !== "object" || statuses === null) {
|
|
1227
|
-
statuses = payload._statuses ?? {};
|
|
1228
|
-
}
|
|
1229
|
-
const turn = buildMarkerTurn(
|
|
1230
|
-
this.nextSeq(),
|
|
1231
|
-
this.nextTurnId("plan_status"),
|
|
1232
|
-
loopId,
|
|
1233
|
-
"plan_status",
|
|
1234
|
-
{ plan_yaml: payload.plan_yaml ?? "", statuses }
|
|
1235
|
-
);
|
|
1236
|
-
return [{ kind: "upsert", turn }];
|
|
1237
|
-
}
|
|
1238
|
-
onWorkspaceChanged(loopId, payload) {
|
|
1239
|
-
const updates = [
|
|
1240
|
-
{
|
|
1241
|
-
kind: "workspace_changed",
|
|
1242
|
-
loopId,
|
|
1243
|
-
toolCallId: optStr(payload.tool_call_id) ?? void 0,
|
|
1244
|
-
toolName: toolNameFromPayload(payload) ?? void 0
|
|
1245
|
-
}
|
|
1246
|
-
];
|
|
1247
|
-
const state = this.activeTurns.get(loopId);
|
|
1248
|
-
if (state) {
|
|
1249
|
-
const turn = snapshot(state, this.nextSeq(), "streaming");
|
|
1250
|
-
this.latestTurns.set(loopId, turn);
|
|
1251
|
-
this.lastTurnIds.set(loopId, turn.turn_id);
|
|
1252
|
-
updates.push({ kind: "upsert", turn });
|
|
1253
|
-
}
|
|
1254
|
-
return updates;
|
|
1255
|
-
}
|
|
1256
|
-
onAgentStart(loopId, payload) {
|
|
1257
|
-
const description = optStr(payload.description);
|
|
1258
|
-
if (description) this.loopDescriptions.set(loopId, description);
|
|
1259
|
-
const turn = buildSystemNotificationTurn(
|
|
1260
|
-
this.nextSeq(),
|
|
1261
|
-
this.nextTurnId("agent:start"),
|
|
1262
|
-
loopId,
|
|
1263
|
-
"agent:start",
|
|
1264
|
-
"running",
|
|
1265
|
-
`Agent: ${payload.description ?? payload.skill_id ?? "agent"}`,
|
|
1266
|
-
optStr(payload.prompt),
|
|
1267
|
-
{
|
|
1268
|
-
skill_id: optStr(payload.skill_id),
|
|
1269
|
-
description: optStr(payload.description),
|
|
1270
|
-
parent_fork_tool_call_id: optStr(payload.parent_fork_tool_call_id)
|
|
1271
|
-
}
|
|
1272
|
-
);
|
|
1273
|
-
return [{ kind: "upsert", turn }];
|
|
1274
|
-
}
|
|
1275
|
-
onBgStarted(loopId, payload) {
|
|
1276
|
-
const taskId = optStr(payload.task_id) ?? "";
|
|
1277
|
-
const command = optStr(payload.command);
|
|
1278
|
-
const description = optStr(payload.description);
|
|
1279
|
-
const turn = buildSystemNotificationTurn(
|
|
1280
|
-
this.nextSeq(),
|
|
1281
|
-
this.nextTurnId("bg:started"),
|
|
1282
|
-
loopId,
|
|
1283
|
-
"bg:started",
|
|
1284
|
-
"running",
|
|
1285
|
-
description ?? `Background: ${taskId || "task"}`,
|
|
1286
|
-
command,
|
|
1287
|
-
{ task_id: taskId, command, description }
|
|
1288
|
-
);
|
|
1289
|
-
return [{ kind: "upsert", turn }];
|
|
1290
|
-
}
|
|
1291
|
-
onBgTasksCompleted(loopId, payload) {
|
|
1292
|
-
const taskIds = Array.isArray(payload.task_ids) ? payload.task_ids : [];
|
|
1293
|
-
const count = typeof payload.count === "number" ? payload.count : taskIds.length;
|
|
1294
|
-
const detail = taskIds.map(String).join(", ");
|
|
1295
|
-
const turn = buildSystemNotificationTurn(
|
|
1296
|
-
this.nextSeq(),
|
|
1297
|
-
this.nextTurnId("bg:tasks_completed"),
|
|
1298
|
-
loopId,
|
|
1299
|
-
"bg:tasks_completed",
|
|
1300
|
-
"done",
|
|
1301
|
-
`Background tasks completed (${count})`,
|
|
1302
|
-
detail || null,
|
|
1303
|
-
{ task_ids: taskIds, count }
|
|
1304
|
-
);
|
|
1305
|
-
return [{ kind: "upsert", turn }];
|
|
1306
|
-
}
|
|
1307
|
-
onAskUserAnswer(loopId, payload) {
|
|
1308
|
-
const toolCallId = String(payload.tool_call_id ?? "");
|
|
1309
|
-
const pending = this.pendingChildPauses.get(toolCallId);
|
|
1310
|
-
const parentLoopId = pending?.parentLoopName;
|
|
1311
|
-
if (pending) {
|
|
1312
|
-
this.pendingChildPauses.delete(toolCallId);
|
|
1313
|
-
const childTurn = this.activeTurns.get(pending.childLoopName) ?? this.latestTurns.get(pending.childLoopName);
|
|
1314
|
-
setToolCallStatus(childTurn, pending.childToolCallId, "done", null, null);
|
|
1315
|
-
const parentTurn = this.activeTurns.get(pending.parentLoopName) ?? this.latestTurns.get(pending.parentLoopName);
|
|
1316
|
-
setToolCallStatus(parentTurn, pending.parentToolCallId, "done", null, null);
|
|
1317
|
-
}
|
|
1318
|
-
const directTurn = this.activeTurns.get(loopId) ?? this.latestTurns.get(loopId);
|
|
1319
|
-
setToolCallStatus(directTurn, toolCallId, "done", null, null);
|
|
1320
|
-
return this.collectLoopUpdates(loopId, parentLoopId);
|
|
1321
|
-
}
|
|
1322
|
-
onUserMessage(_loopId, payload) {
|
|
1323
|
-
const entryId = String(payload.entry_id ?? this.nextTurnId("user"));
|
|
1324
|
-
const displayContent = payload.display_content ?? payload.content ?? "";
|
|
1325
|
-
const turn = {
|
|
1326
|
-
id: entryId,
|
|
1327
|
-
sequence: this.nextSeq(),
|
|
1328
|
-
turn_id: entryId,
|
|
1329
|
-
loop_id: "root",
|
|
1330
|
-
kind: "message",
|
|
1331
|
-
role: "user",
|
|
1332
|
-
status: "completed",
|
|
1333
|
-
blocks: [{ type: "text", content: displayContent }],
|
|
1334
|
-
tool_calls: [],
|
|
1335
|
-
model: null,
|
|
1336
|
-
usage: null,
|
|
1337
|
-
duration_ms: 0
|
|
1338
|
-
};
|
|
1339
|
-
return [{ kind: "upsert", turn }];
|
|
1340
|
-
}
|
|
1341
|
-
// --- Delta / streaming events ---
|
|
1342
|
-
onDelta(state, blockType, _toolCallId, content) {
|
|
1343
|
-
if (!content) return null;
|
|
1344
|
-
appendTextBlock(state, blockType, content);
|
|
1345
|
-
return this.syncPatch(state);
|
|
1346
|
-
}
|
|
1347
|
-
onToolCallCreated(state, payload) {
|
|
1348
|
-
if ("arguments_delta" in payload) {
|
|
1349
|
-
const delta = String(payload.arguments_delta ?? "");
|
|
1350
|
-
const toolCallId2 = String(payload.id ?? "");
|
|
1351
|
-
if (delta && toolCallId2) {
|
|
1352
|
-
appendToolCallArguments(state, toolCallId2, delta);
|
|
1353
|
-
return this.syncPatch(state);
|
|
1354
|
-
}
|
|
1355
|
-
return null;
|
|
1356
|
-
}
|
|
1357
|
-
const toolCallId = String(payload.id ?? "");
|
|
1358
|
-
const toolName = toolNameFromPayload(payload);
|
|
1359
|
-
const displayName = String(payload.display_name ?? "") || this.displayNameResolver(toolName);
|
|
1360
|
-
const args = toolArgsFromPayload(payload);
|
|
1361
|
-
upsertToolCall(state, toolCallId, toolName, displayName, args);
|
|
1362
|
-
return this.syncPatch(state);
|
|
1363
|
-
}
|
|
1364
|
-
onResponseDone(state, loopId, payload) {
|
|
1365
|
-
const model = optStr(payload.model);
|
|
1366
|
-
if (model) state.model = model;
|
|
1367
|
-
if (typeof payload.usage === "object" && payload.usage !== null) {
|
|
1368
|
-
state.usage = { ...payload.usage };
|
|
1369
|
-
}
|
|
1370
|
-
const toolCalls = payload.tool_calls;
|
|
1371
|
-
if (Array.isArray(toolCalls)) {
|
|
1372
|
-
for (const raw of toolCalls) {
|
|
1373
|
-
if (typeof raw !== "object" || raw === null) continue;
|
|
1374
|
-
const tc = raw;
|
|
1375
|
-
const fn = tc.function ?? {};
|
|
1376
|
-
const toolName = String(fn.name ?? "");
|
|
1377
|
-
const displayName = String(tc.display_name ?? "") || this.displayNameResolver(toolName);
|
|
1378
|
-
upsertToolCall(
|
|
1379
|
-
state,
|
|
1380
|
-
String(tc.id ?? ""),
|
|
1381
|
-
toolName,
|
|
1382
|
-
displayName,
|
|
1383
|
-
String(fn.arguments ?? "")
|
|
1384
|
-
);
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
if (state.toolCalls.length === 0) {
|
|
1388
|
-
return this.finalize(loopId, "completed");
|
|
1389
|
-
}
|
|
1390
|
-
return this.syncPatch(state);
|
|
1391
|
-
}
|
|
1392
|
-
onToolResultDone(state, loopId, payload) {
|
|
1393
|
-
const toolCallId = String(payload.tool_call_id ?? "");
|
|
1394
|
-
const content = payload.content ?? "";
|
|
1395
|
-
const status = toolStatusFromResult(content);
|
|
1396
|
-
const rawDuration = payload.duration_ms;
|
|
1397
|
-
const durationMs = typeof rawDuration === "number" && rawDuration >= 0 ? Math.round(rawDuration) : null;
|
|
1398
|
-
const sl = sourceLoopFor(state.loopId, this.loopDescriptions);
|
|
1399
|
-
applyToolResult(state, toolCallId, content, status, durationMs, sl);
|
|
1400
|
-
if (this.shouldFinalizeAfterToolResults(state)) {
|
|
1401
|
-
return this.finalize(loopId, "completed");
|
|
1402
|
-
}
|
|
1403
|
-
return this.syncPatch(state);
|
|
1404
|
-
}
|
|
1405
|
-
onToolResultDelta(state, payload) {
|
|
1406
|
-
appendToolResultDelta(
|
|
1407
|
-
state,
|
|
1408
|
-
String(payload.tool_call_id ?? ""),
|
|
1409
|
-
String(payload.content ?? "")
|
|
1410
|
-
);
|
|
1411
|
-
return this.syncPatch(state);
|
|
1412
|
-
}
|
|
1413
|
-
onToolUi(state, payload) {
|
|
1414
|
-
const toolCallId = String(payload.tool_call_id ?? "");
|
|
1415
|
-
const ui = payload.ui;
|
|
1416
|
-
if (toolCallId && typeof ui === "object" && ui !== null) {
|
|
1417
|
-
state.blocks.push({
|
|
1418
|
-
type: "tool_ui",
|
|
1419
|
-
content: ui,
|
|
1420
|
-
tool_call_id: toolCallId
|
|
1421
|
-
});
|
|
1422
|
-
}
|
|
1423
|
-
return this.syncPatch(state);
|
|
1424
|
-
}
|
|
1425
|
-
onToolBridge(state, payload) {
|
|
1426
|
-
const bridge = payload.bridge;
|
|
1427
|
-
if (typeof bridge !== "object" || bridge === null) return null;
|
|
1428
|
-
state.blocks.push({
|
|
1429
|
-
type: "tool_bridge",
|
|
1430
|
-
content: bridge,
|
|
1431
|
-
tool_call_id: String(payload.tool_call_id ?? "") || null
|
|
1432
|
-
});
|
|
1433
|
-
return this.syncPatch(state);
|
|
1434
|
-
}
|
|
1435
|
-
onToolApprovalRequired(state, payload) {
|
|
1436
|
-
const toolCallId = String(payload.tool_call_id ?? "");
|
|
1437
|
-
const toolName = String(payload.tool_name ?? "");
|
|
1438
|
-
const displayName = this.displayNameResolver(toolName);
|
|
1439
|
-
upsertToolCall(state, toolCallId, toolName, displayName, "");
|
|
1440
|
-
return this.syncPatch(state);
|
|
1441
|
-
}
|
|
1442
|
-
onChildPause(state, loopId, payload) {
|
|
1443
|
-
const pauseToolData = payload.pause_tool_data;
|
|
1444
|
-
if (typeof pauseToolData !== "object" || pauseToolData === null)
|
|
1445
|
-
return this.syncPatch(state);
|
|
1446
|
-
const ptd = pauseToolData;
|
|
1447
|
-
const sourceLoop = ptd.source_loop;
|
|
1448
|
-
if (typeof sourceLoop === "object" && sourceLoop) {
|
|
1449
|
-
const slName = String(sourceLoop.name ?? "");
|
|
1450
|
-
const slDesc = optStr(sourceLoop.description);
|
|
1451
|
-
if (slName && slDesc) this.loopDescriptions.set(slName, slDesc);
|
|
1452
|
-
}
|
|
1453
|
-
const { childLoopName, childToolCallId, description } = normalizeChildPause(payload);
|
|
1454
|
-
if (!childToolCallId) return this.syncPatch(state);
|
|
1455
|
-
const existing = this.pendingChildPauses.get(childToolCallId);
|
|
1456
|
-
const parentLoopName = String(
|
|
1457
|
-
payload.parent_loop_name ?? existing?.parentLoopName ?? "root"
|
|
1458
|
-
);
|
|
1459
|
-
const parentToolCallId = String(
|
|
1460
|
-
payload.parent_fork_tool_call_id ?? existing?.parentToolCallId ?? ""
|
|
1461
|
-
);
|
|
1462
|
-
const resolvedChildLoopName = String(payload.child_loop_name ?? "") || existing?.childLoopName || childLoopName || loopId;
|
|
1463
|
-
this.pendingChildPauses.set(childToolCallId, {
|
|
1464
|
-
parentLoopName,
|
|
1465
|
-
parentToolCallId,
|
|
1466
|
-
childLoopName: resolvedChildLoopName,
|
|
1467
|
-
childToolCallId,
|
|
1468
|
-
description: description || existing?.description || ""
|
|
1469
|
-
});
|
|
1470
|
-
applyAskUserPauseToTurn(
|
|
1471
|
-
state,
|
|
1472
|
-
ptd,
|
|
1473
|
-
childToolCallId,
|
|
1474
|
-
resolvedChildLoopName,
|
|
1475
|
-
this.pendingChildPauses.get(childToolCallId).description,
|
|
1476
|
-
this.displayNameResolver
|
|
1477
|
-
);
|
|
1478
|
-
const parentTurn = this.activeTurns.get(parentLoopName) ?? this.latestTurns.get(parentLoopName);
|
|
1479
|
-
if (parentTurn) {
|
|
1480
|
-
applyChildPauseToParent(
|
|
1481
|
-
parentTurn,
|
|
1482
|
-
parentToolCallId,
|
|
1483
|
-
resolvedChildLoopName,
|
|
1484
|
-
childToolCallId,
|
|
1485
|
-
this.pendingChildPauses.get(childToolCallId).description,
|
|
1486
|
-
this.displayNameResolver
|
|
1487
|
-
);
|
|
1488
|
-
}
|
|
1489
|
-
return this.collectLoopUpdates(loopId, parentLoopName);
|
|
1490
|
-
}
|
|
1491
|
-
onChatEnd(state, loopId, payload) {
|
|
1492
|
-
const status = String(payload.status ?? "completed");
|
|
1493
|
-
const pauseToolData = payload.pause_tool_data;
|
|
1494
|
-
if (typeof pauseToolData === "object" && pauseToolData !== null) {
|
|
1495
|
-
const ptd = pauseToolData;
|
|
1496
|
-
const pauseToolName = String(ptd.name ?? "");
|
|
1497
|
-
const normalized = pauseToolName.includes(":") ? pauseToolName.split(":").pop() : pauseToolName;
|
|
1498
|
-
const sourceLoop = ptd.source_loop;
|
|
1499
|
-
if (typeof sourceLoop === "object" && sourceLoop) {
|
|
1500
|
-
const slName = String(sourceLoop.name ?? "");
|
|
1501
|
-
const slDesc = optStr(sourceLoop.description);
|
|
1502
|
-
if (slName && slDesc) this.loopDescriptions.set(slName, slDesc);
|
|
1503
|
-
if (status === "paused" && slName) {
|
|
1504
|
-
applyChildPauseToParent(
|
|
1505
|
-
state,
|
|
1506
|
-
String(ptd.parent_fork_tool_call_id ?? ""),
|
|
1507
|
-
slName,
|
|
1508
|
-
String(ptd.tool_call_id ?? ""),
|
|
1509
|
-
slDesc ?? "",
|
|
1510
|
-
this.displayNameResolver
|
|
1511
|
-
);
|
|
1512
|
-
const childTurn = this.activeTurns.get(slName);
|
|
1513
|
-
if (childTurn) {
|
|
1514
|
-
applyAskUserPauseToTurn(
|
|
1515
|
-
childTurn,
|
|
1516
|
-
ptd,
|
|
1517
|
-
String(ptd.tool_call_id ?? ""),
|
|
1518
|
-
slName,
|
|
1519
|
-
slDesc ?? "",
|
|
1520
|
-
this.displayNameResolver
|
|
1521
|
-
);
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
} else if (status === "paused" && normalized === "AskUserQuestion") {
|
|
1525
|
-
applyAskUserPauseToTurn(
|
|
1526
|
-
state,
|
|
1527
|
-
ptd,
|
|
1528
|
-
String(ptd.tool_call_id ?? ""),
|
|
1529
|
-
"",
|
|
1530
|
-
"",
|
|
1531
|
-
this.displayNameResolver
|
|
1532
|
-
);
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
const finalStatus = { completed: "completed", paused: "paused", failed: "failed", interrupted: "interrupted" }[status];
|
|
1536
|
-
if (!finalStatus) return null;
|
|
1537
|
-
if (!this.activeTurns.has(loopId)) {
|
|
1538
|
-
this.pendingMemoryRefs.delete(loopId);
|
|
1539
|
-
}
|
|
1540
|
-
return this.finalize(loopId, finalStatus);
|
|
1541
|
-
}
|
|
1542
|
-
onAgentEnd(state, loopId, payload) {
|
|
1543
|
-
const ok = payload.ok !== false;
|
|
1544
|
-
const status = ok ? "done" : "error";
|
|
1545
|
-
const title = `Agent: ${payload.description ?? payload.skill_id ?? "agent"}`;
|
|
1546
|
-
const detail = optStr(payload.error);
|
|
1547
|
-
const metadata = {
|
|
1548
|
-
skill_id: optStr(payload.skill_id),
|
|
1549
|
-
description: optStr(payload.description),
|
|
1550
|
-
parent_fork_tool_call_id: optStr(payload.parent_fork_tool_call_id),
|
|
1551
|
-
ok
|
|
1552
|
-
};
|
|
1553
|
-
if (state) {
|
|
1554
|
-
state.blocks.push(buildSystemNotificationBlock("agent:end", status, title, detail, metadata));
|
|
1555
|
-
return this.finalize(loopId, ok ? "completed" : "failed");
|
|
1556
|
-
}
|
|
1557
|
-
const turn = buildSystemNotificationTurn(
|
|
1558
|
-
this.nextSeq(),
|
|
1559
|
-
this.nextTurnId("agent:end"),
|
|
1560
|
-
loopId,
|
|
1561
|
-
"agent:end",
|
|
1562
|
-
status,
|
|
1563
|
-
title,
|
|
1564
|
-
detail,
|
|
1565
|
-
metadata
|
|
1566
|
-
);
|
|
1567
|
-
return [{ kind: "upsert", turn }];
|
|
1568
|
-
}
|
|
1569
|
-
onCompaction(eventType, loopId, payload) {
|
|
1570
|
-
const compactionId = String(payload.compaction_id ?? "");
|
|
1571
|
-
if (!compactionId) return null;
|
|
1572
|
-
const current = {
|
|
1573
|
-
...this.activeCompactions.get(compactionId) ?? {},
|
|
1574
|
-
...payload,
|
|
1575
|
-
loop_id: loopId
|
|
1576
|
-
};
|
|
1577
|
-
let status;
|
|
1578
|
-
switch (eventType) {
|
|
1579
|
-
case "compaction:start":
|
|
1580
|
-
status = "streaming";
|
|
1581
|
-
this.activeCompactions.set(compactionId, current);
|
|
1582
|
-
break;
|
|
1583
|
-
case "compaction:end":
|
|
1584
|
-
status = "completed";
|
|
1585
|
-
this.activeCompactions.delete(compactionId);
|
|
1586
|
-
break;
|
|
1587
|
-
case "compaction:abort":
|
|
1588
|
-
status = "interrupted";
|
|
1589
|
-
this.activeCompactions.delete(compactionId);
|
|
1590
|
-
break;
|
|
1591
|
-
case "compaction:error":
|
|
1592
|
-
status = "failed";
|
|
1593
|
-
this.activeCompactions.delete(compactionId);
|
|
1594
|
-
break;
|
|
1595
|
-
default:
|
|
1596
|
-
status = "streaming";
|
|
1597
|
-
this.activeCompactions.set(compactionId, current);
|
|
1598
|
-
}
|
|
1599
|
-
const turn = buildCompactionTurn(this.nextSeq(), compactionId, loopId, status, current);
|
|
1600
|
-
return [{ kind: "upsert", turn }];
|
|
1601
|
-
}
|
|
1602
|
-
// --- Internal helpers ---
|
|
1603
|
-
syncPatch(state) {
|
|
1604
|
-
const turn = snapshot(state, this.nextSeq(), "streaming");
|
|
1605
|
-
this.latestTurns.set(state.loopId, turn);
|
|
1606
|
-
this.lastTurnIds.set(state.loopId, turn.turn_id);
|
|
1607
|
-
return [{ kind: "upsert", turn }];
|
|
1608
|
-
}
|
|
1609
|
-
finalize(loopId, status) {
|
|
1610
|
-
const state = this.activeTurns.get(loopId);
|
|
1611
|
-
if (!state) return null;
|
|
1612
|
-
this.activeTurns.delete(loopId);
|
|
1613
|
-
const turn = snapshot(state, this.nextSeq(), status);
|
|
1614
|
-
this.lastTurnIds.set(loopId, turn.turn_id);
|
|
1615
|
-
this.latestTurns.set(loopId, turn);
|
|
1616
|
-
return [{ kind: "upsert", turn }];
|
|
1617
|
-
}
|
|
1618
|
-
shouldFinalizeAfterToolResults(state) {
|
|
1619
|
-
if (state.toolCalls.length === 0) return true;
|
|
1620
|
-
if (state.toolCalls.some((tc) => tc.status === "pending")) return false;
|
|
1621
|
-
return !state.toolCalls.some((tc) => {
|
|
1622
|
-
const normalized = tc.tool_name.includes(":") ? tc.tool_name.split(":").pop() : tc.tool_name;
|
|
1623
|
-
return PAUSE_TOOL_NAMES.has(normalized);
|
|
1624
|
-
});
|
|
1625
|
-
}
|
|
1626
|
-
collectLoopUpdates(...loopIds) {
|
|
1627
|
-
const updates = [];
|
|
1628
|
-
for (const loopId of loopIds) {
|
|
1629
|
-
if (!loopId) continue;
|
|
1630
|
-
const state = this.activeTurns.get(loopId);
|
|
1631
|
-
if (state) {
|
|
1632
|
-
updates.push(...this.syncPatch(state));
|
|
1633
|
-
continue;
|
|
1634
|
-
}
|
|
1635
|
-
const proj = this.latestTurns.get(loopId);
|
|
1636
|
-
if (proj) {
|
|
1637
|
-
const updated = { ...proj, sequence: this.nextSeq() };
|
|
1638
|
-
this.latestTurns.set(loopId, updated);
|
|
1639
|
-
updates.push({ kind: "upsert", turn: updated });
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
return updates;
|
|
1643
|
-
}
|
|
1644
|
-
nextSeq() {
|
|
1645
|
-
return ++this.seq;
|
|
1646
|
-
}
|
|
1647
|
-
nextTurnId(prefix) {
|
|
1648
|
-
this.syntheticCounter++;
|
|
1649
|
-
const hex = Math.random().toString(16).slice(2, 10);
|
|
1650
|
-
return `${prefix}:${this.syntheticCounter}:${hex}`;
|
|
1651
|
-
}
|
|
1652
|
-
};
|
|
1653
|
-
function optStr(value) {
|
|
1654
|
-
if (value == null || value === "") return null;
|
|
1655
|
-
return String(value);
|
|
1656
|
-
}
|
|
1657
|
-
function toolNameFromPayload(payload) {
|
|
1658
|
-
const fn = payload.function;
|
|
1659
|
-
if (typeof fn === "object" && fn !== null) {
|
|
1660
|
-
return String(fn.name ?? "");
|
|
1661
|
-
}
|
|
1662
|
-
return String(payload.tool_name ?? "");
|
|
1663
|
-
}
|
|
1664
|
-
function toolArgsFromPayload(payload) {
|
|
1665
|
-
const fn = payload.function;
|
|
1666
|
-
if (typeof fn === "object" && fn !== null) {
|
|
1667
|
-
return String(fn.arguments ?? "");
|
|
1668
|
-
}
|
|
1669
|
-
return "";
|
|
1670
|
-
}
|
|
1671
|
-
|
|
1672
622
|
// src/react/stores/auth-store.ts
|
|
1673
623
|
import { create as create6 } from "zustand";
|
|
1674
624
|
import { createJSONStorage, persist } from "zustand/middleware";
|
|
@@ -1698,100 +648,6 @@ function getSocket() {
|
|
|
1698
648
|
// src/react/stores/session-store.ts
|
|
1699
649
|
import { create as create5 } from "zustand";
|
|
1700
650
|
|
|
1701
|
-
// src/react/api/sessions.ts
|
|
1702
|
-
var sessions_exports = {};
|
|
1703
|
-
__export(sessions_exports, {
|
|
1704
|
-
checkoutSession: () => checkoutSession,
|
|
1705
|
-
copyFile: () => copyFile,
|
|
1706
|
-
createSession: () => createSession,
|
|
1707
|
-
createSessionWithRequest: () => createSessionWithRequest,
|
|
1708
|
-
createShare: () => createShare,
|
|
1709
|
-
deleteFile: () => deleteFile,
|
|
1710
|
-
deleteSession: () => deleteSession,
|
|
1711
|
-
exportSession: () => exportSession,
|
|
1712
|
-
getBackgroundTask: () => getBackgroundTask,
|
|
1713
|
-
getDownloadDirUrl: () => getDownloadDirUrl,
|
|
1714
|
-
getSession: () => getSession,
|
|
1715
|
-
getSessionCheckpoints: () => getSessionCheckpoints,
|
|
1716
|
-
getSessionContextStats: () => getSessionContextStats,
|
|
1717
|
-
getSessionExtraInfoByTask: () => getSessionExtraInfoByTask,
|
|
1718
|
-
getSessionHistory: () => getSessionHistory,
|
|
1719
|
-
getSessionTasks: () => getSessionTasks,
|
|
1720
|
-
getSessionTurns: () => getSessionTurns,
|
|
1721
|
-
getSharedSession: () => getSharedSession,
|
|
1722
|
-
importSession: () => importSession,
|
|
1723
|
-
listBackgroundTasks: () => listBackgroundTasks,
|
|
1724
|
-
listDir: () => listDir,
|
|
1725
|
-
listSessions: () => listSessions,
|
|
1726
|
-
listSessionsPaginated: () => listSessionsPaginated,
|
|
1727
|
-
listSessionsWithSkillData: () => listSessionsWithSkillData,
|
|
1728
|
-
pinSession: () => pinSession,
|
|
1729
|
-
previewImport: () => previewImport,
|
|
1730
|
-
probeSessionUrl: () => probeSessionUrl,
|
|
1731
|
-
renameFile: () => renameFile,
|
|
1732
|
-
revokeShare: () => revokeShare,
|
|
1733
|
-
rewindSession: () => rewindSession,
|
|
1734
|
-
shareFile: () => shareFile,
|
|
1735
|
-
startReplaySession: () => startReplaySession,
|
|
1736
|
-
stopBackgroundTask: () => stopBackgroundTask,
|
|
1737
|
-
switchBranch: () => switchBranch,
|
|
1738
|
-
tokenizeMessages: () => tokenizeMessages,
|
|
1739
|
-
tokenizePrompt: () => tokenizePrompt,
|
|
1740
|
-
updateReplaySession: () => updateReplaySession,
|
|
1741
|
-
updateSession: () => updateSession,
|
|
1742
|
-
updateSessionMemory: () => updateSessionMemory,
|
|
1743
|
-
updateSharing: () => updateSharing,
|
|
1744
|
-
uploadFiles: () => uploadFiles,
|
|
1745
|
-
writeFile: () => writeFile
|
|
1746
|
-
});
|
|
1747
|
-
var r3 = () => getClient().sessions;
|
|
1748
|
-
var listSessions = (...args) => r3().listSessions(...args);
|
|
1749
|
-
var listSessionsPaginated = (...args) => r3().listSessionsPaginated(...args);
|
|
1750
|
-
var listSessionsWithSkillData = (...args) => r3().listSessionsWithSkillData(...args);
|
|
1751
|
-
var createSession = (...args) => r3().createSession(...args);
|
|
1752
|
-
var createSessionWithRequest = (...args) => r3().createSessionWithRequest(...args);
|
|
1753
|
-
var getSession = (...args) => r3().getSession(...args);
|
|
1754
|
-
var updateSession = (...args) => r3().updateSession(...args);
|
|
1755
|
-
var pinSession = (...args) => r3().pinSession(...args);
|
|
1756
|
-
var startReplaySession = (...args) => r3().startReplaySession(...args);
|
|
1757
|
-
var updateReplaySession = (...args) => r3().updateReplaySession(...args);
|
|
1758
|
-
var updateSharing = (...args) => r3().updateSharing(...args);
|
|
1759
|
-
var updateSessionMemory = (...args) => r3().updateSessionMemory(...args);
|
|
1760
|
-
var createShare = (...args) => r3().createShare(...args);
|
|
1761
|
-
var revokeShare = (...args) => r3().revokeShare(...args);
|
|
1762
|
-
var getSharedSession = (...args) => r3().getSharedSession(...args);
|
|
1763
|
-
var getSessionTasks = (...args) => r3().getSessionTasks(...args);
|
|
1764
|
-
var getSessionTurns = (...args) => r3().getSessionTurns(...args);
|
|
1765
|
-
var getSessionContextStats = (...args) => r3().getSessionContextStats(...args);
|
|
1766
|
-
var getSessionHistory = (...args) => r3().getSessionHistory(...args);
|
|
1767
|
-
var tokenizePrompt = (...args) => r3().tokenizePrompt(...args);
|
|
1768
|
-
var tokenizeMessages = (...args) => r3().tokenizeMessages(...args);
|
|
1769
|
-
var getSessionCheckpoints = (...args) => r3().getSessionCheckpoints(...args);
|
|
1770
|
-
var checkoutSession = (...args) => r3().checkoutSession(...args);
|
|
1771
|
-
var rewindSession = (...args) => r3().rewindSession(...args);
|
|
1772
|
-
var switchBranch = (...args) => r3().switchBranch(...args);
|
|
1773
|
-
var deleteSession = (...args) => r3().deleteSession(...args);
|
|
1774
|
-
var listBackgroundTasks = (...args) => r3().listBackgroundTasks(...args);
|
|
1775
|
-
var getBackgroundTask = (...args) => r3().getBackgroundTask(...args);
|
|
1776
|
-
var stopBackgroundTask = (...args) => r3().stopBackgroundTask(...args);
|
|
1777
|
-
var probeSessionUrl = (...args) => r3().probeSessionUrl(...args);
|
|
1778
|
-
var listDir = (...args) => r3().listDir(...args);
|
|
1779
|
-
var uploadFiles = (...args) => r3().uploadFiles(...args);
|
|
1780
|
-
var deleteFile = (...args) => r3().deleteFile(...args);
|
|
1781
|
-
var writeFile = (...args) => r3().writeFile(...args);
|
|
1782
|
-
var renameFile = (...args) => r3().renameFile(...args);
|
|
1783
|
-
var copyFile = (...args) => r3().copyFile(...args);
|
|
1784
|
-
var shareFile = (...args) => r3().shareFile(...args);
|
|
1785
|
-
var getDownloadDirUrl = (...args) => r3().getDownloadDirUrl(...args);
|
|
1786
|
-
var exportSession = (...args) => r3().exportSession(...args);
|
|
1787
|
-
var previewImport = (...args) => r3().previewImport(...args);
|
|
1788
|
-
var importSession = (...args) => r3().importSession(...args);
|
|
1789
|
-
function getSessionExtraInfoByTask(taskId) {
|
|
1790
|
-
return apiFetch(
|
|
1791
|
-
`/api/sessions/extra_info/by_task/${encodeURIComponent(taskId)}`
|
|
1792
|
-
);
|
|
1793
|
-
}
|
|
1794
|
-
|
|
1795
651
|
// src/react/stores/chat-store.ts
|
|
1796
652
|
import { create as create3 } from "zustand";
|
|
1797
653
|
|
|
@@ -4178,7 +3034,7 @@ var AgentSocket = class {
|
|
|
4178
3034
|
const join = new Promise((resolve, reject) => {
|
|
4179
3035
|
this.socket.timeout(5e3).emit(
|
|
4180
3036
|
"session:subscribe",
|
|
4181
|
-
{ session_id: sessionId },
|
|
3037
|
+
{ session_id: sessionId, event_format: "raw" },
|
|
4182
3038
|
(err, response) => {
|
|
4183
3039
|
if (err) {
|
|
4184
3040
|
reject(err);
|
|
@@ -4210,7 +3066,7 @@ var AgentSocket = class {
|
|
|
4210
3066
|
_refreshRunningState(sessionId) {
|
|
4211
3067
|
this.socket.timeout(5e3).emit(
|
|
4212
3068
|
"session:subscribe",
|
|
4213
|
-
{ session_id: sessionId },
|
|
3069
|
+
{ session_id: sessionId, event_format: "raw" },
|
|
4214
3070
|
(err, response) => {
|
|
4215
3071
|
if (err || !response) return;
|
|
4216
3072
|
if (response.is_running) {
|
|
@@ -4515,6 +3371,55 @@ function getClient() {
|
|
|
4515
3371
|
return getBootstrappedClient();
|
|
4516
3372
|
}
|
|
4517
3373
|
|
|
3374
|
+
// src/react/api/sessions.ts
|
|
3375
|
+
var r3 = () => getClient().sessions;
|
|
3376
|
+
var listSessions = (...args) => r3().listSessions(...args);
|
|
3377
|
+
var listSessionsPaginated = (...args) => r3().listSessionsPaginated(...args);
|
|
3378
|
+
var listSessionsWithSkillData = (...args) => r3().listSessionsWithSkillData(...args);
|
|
3379
|
+
var createSession = (...args) => r3().createSession(...args);
|
|
3380
|
+
var createSessionWithRequest = (...args) => r3().createSessionWithRequest(...args);
|
|
3381
|
+
var getSession = (...args) => r3().getSession(...args);
|
|
3382
|
+
var updateSession = (...args) => r3().updateSession(...args);
|
|
3383
|
+
var pinSession = (...args) => r3().pinSession(...args);
|
|
3384
|
+
var startReplaySession = (...args) => r3().startReplaySession(...args);
|
|
3385
|
+
var updateReplaySession = (...args) => r3().updateReplaySession(...args);
|
|
3386
|
+
var updateSharing = (...args) => r3().updateSharing(...args);
|
|
3387
|
+
var updateSessionMemory = (...args) => r3().updateSessionMemory(...args);
|
|
3388
|
+
var createShare = (...args) => r3().createShare(...args);
|
|
3389
|
+
var revokeShare = (...args) => r3().revokeShare(...args);
|
|
3390
|
+
var getSharedSession = (...args) => r3().getSharedSession(...args);
|
|
3391
|
+
var getSessionTasks = (...args) => r3().getSessionTasks(...args);
|
|
3392
|
+
var getSessionTurns = (...args) => r3().getSessionTurns(...args);
|
|
3393
|
+
var getSessionContextStats = (...args) => r3().getSessionContextStats(...args);
|
|
3394
|
+
var getSessionHistory = (...args) => r3().getSessionHistory(...args);
|
|
3395
|
+
var tokenizePrompt = (...args) => r3().tokenizePrompt(...args);
|
|
3396
|
+
var tokenizeMessages = (...args) => r3().tokenizeMessages(...args);
|
|
3397
|
+
var getSessionCheckpoints = (...args) => r3().getSessionCheckpoints(...args);
|
|
3398
|
+
var checkoutSession = (...args) => r3().checkoutSession(...args);
|
|
3399
|
+
var rewindSession = (...args) => r3().rewindSession(...args);
|
|
3400
|
+
var switchBranch = (...args) => r3().switchBranch(...args);
|
|
3401
|
+
var deleteSession = (...args) => r3().deleteSession(...args);
|
|
3402
|
+
var listBackgroundTasks = (...args) => r3().listBackgroundTasks(...args);
|
|
3403
|
+
var getBackgroundTask = (...args) => r3().getBackgroundTask(...args);
|
|
3404
|
+
var stopBackgroundTask = (...args) => r3().stopBackgroundTask(...args);
|
|
3405
|
+
var probeSessionUrl = (...args) => r3().probeSessionUrl(...args);
|
|
3406
|
+
var listDir = (...args) => r3().listDir(...args);
|
|
3407
|
+
var uploadFiles = (...args) => r3().uploadFiles(...args);
|
|
3408
|
+
var deleteFile = (...args) => r3().deleteFile(...args);
|
|
3409
|
+
var writeFile = (...args) => r3().writeFile(...args);
|
|
3410
|
+
var renameFile = (...args) => r3().renameFile(...args);
|
|
3411
|
+
var copyFile = (...args) => r3().copyFile(...args);
|
|
3412
|
+
var shareFile = (...args) => r3().shareFile(...args);
|
|
3413
|
+
var getDownloadDirUrl = (...args) => r3().getDownloadDirUrl(...args);
|
|
3414
|
+
var exportSession = (...args) => r3().exportSession(...args);
|
|
3415
|
+
var previewImport = (...args) => r3().previewImport(...args);
|
|
3416
|
+
var importSession = (...args) => r3().importSession(...args);
|
|
3417
|
+
function getSessionExtraInfoByTask(taskId) {
|
|
3418
|
+
return apiFetch(
|
|
3419
|
+
`/api/sessions/extra_info/by_task/${encodeURIComponent(taskId)}`
|
|
3420
|
+
);
|
|
3421
|
+
}
|
|
3422
|
+
|
|
4518
3423
|
export {
|
|
4519
3424
|
getBaseUrl,
|
|
4520
3425
|
getAuthedUrl,
|
|
@@ -4561,19 +3466,47 @@ export {
|
|
|
4561
3466
|
agentSocket,
|
|
4562
3467
|
getSocket,
|
|
4563
3468
|
listSessions,
|
|
3469
|
+
listSessionsPaginated,
|
|
3470
|
+
listSessionsWithSkillData,
|
|
3471
|
+
createSession,
|
|
3472
|
+
createSessionWithRequest,
|
|
3473
|
+
getSession,
|
|
3474
|
+
updateSession,
|
|
3475
|
+
pinSession,
|
|
3476
|
+
startReplaySession,
|
|
3477
|
+
updateReplaySession,
|
|
3478
|
+
updateSharing,
|
|
3479
|
+
updateSessionMemory,
|
|
3480
|
+
createShare,
|
|
3481
|
+
revokeShare,
|
|
3482
|
+
getSharedSession,
|
|
3483
|
+
getSessionTasks,
|
|
4564
3484
|
getSessionTurns,
|
|
4565
3485
|
getSessionContextStats,
|
|
3486
|
+
getSessionHistory,
|
|
3487
|
+
tokenizePrompt,
|
|
3488
|
+
tokenizeMessages,
|
|
4566
3489
|
getSessionCheckpoints,
|
|
4567
3490
|
checkoutSession,
|
|
3491
|
+
rewindSession,
|
|
3492
|
+
switchBranch,
|
|
3493
|
+
deleteSession,
|
|
4568
3494
|
listBackgroundTasks,
|
|
4569
3495
|
getBackgroundTask,
|
|
3496
|
+
stopBackgroundTask,
|
|
3497
|
+
probeSessionUrl,
|
|
4570
3498
|
listDir,
|
|
4571
3499
|
uploadFiles,
|
|
4572
3500
|
deleteFile,
|
|
4573
3501
|
writeFile,
|
|
4574
3502
|
renameFile,
|
|
4575
3503
|
copyFile,
|
|
3504
|
+
shareFile,
|
|
4576
3505
|
getDownloadDirUrl,
|
|
3506
|
+
exportSession,
|
|
3507
|
+
previewImport,
|
|
3508
|
+
importSession,
|
|
3509
|
+
getSessionExtraInfoByTask,
|
|
4577
3510
|
sessions_exports,
|
|
4578
3511
|
formatToolName,
|
|
4579
3512
|
getToolDisplayLabel,
|
|
@@ -4599,4 +3532,4 @@ export {
|
|
|
4599
3532
|
bootstrapBladeClient,
|
|
4600
3533
|
getBootstrappedClient
|
|
4601
3534
|
};
|
|
4602
|
-
//# sourceMappingURL=chunk-
|
|
3535
|
+
//# sourceMappingURL=chunk-UWNQ4PXK.js.map
|