@steerable/agent-ui 0.2.3 → 0.2.4
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/cards/ActionSegmentCard.d.ts +18 -0
- package/dist/cards/ActionSegmentCard.d.ts.map +1 -0
- package/dist/cards/ActionSegmentCard.js +26 -0
- package/dist/cards/ActionSegmentCard.js.map +1 -0
- package/dist/cards/AnalysisDocumentCard.d.ts +33 -0
- package/dist/cards/AnalysisDocumentCard.d.ts.map +1 -0
- package/dist/cards/AnalysisDocumentCard.js +11 -0
- package/dist/cards/AnalysisDocumentCard.js.map +1 -0
- package/dist/cards/AskUserQuestionsCard.d.ts +43 -0
- package/dist/cards/AskUserQuestionsCard.d.ts.map +1 -0
- package/dist/cards/AskUserQuestionsCard.js +171 -0
- package/dist/cards/AskUserQuestionsCard.js.map +1 -0
- package/dist/cards/CoverageReportCard.d.ts +41 -0
- package/dist/cards/CoverageReportCard.d.ts.map +1 -0
- package/dist/cards/CoverageReportCard.js +55 -0
- package/dist/cards/CoverageReportCard.js.map +1 -0
- package/dist/cards/OrchestrationPlanCard.d.ts +60 -0
- package/dist/cards/OrchestrationPlanCard.d.ts.map +1 -0
- package/dist/cards/OrchestrationPlanCard.js +103 -0
- package/dist/cards/OrchestrationPlanCard.js.map +1 -0
- package/dist/cards/PlanSelectorCard.d.ts +40 -0
- package/dist/cards/PlanSelectorCard.d.ts.map +1 -0
- package/dist/cards/PlanSelectorCard.js +106 -0
- package/dist/cards/PlanSelectorCard.js.map +1 -0
- package/dist/cards/PlanStepsCard.d.ts +18 -0
- package/dist/cards/PlanStepsCard.d.ts.map +1 -0
- package/dist/cards/PlanStepsCard.js +25 -0
- package/dist/cards/PlanStepsCard.js.map +1 -0
- package/dist/cards/QuizCard.d.ts +44 -0
- package/dist/cards/QuizCard.d.ts.map +1 -0
- package/dist/cards/QuizCard.js +113 -0
- package/dist/cards/QuizCard.js.map +1 -0
- package/dist/cards/ResearchPlanCard.d.ts +23 -0
- package/dist/cards/ResearchPlanCard.d.ts.map +1 -0
- package/dist/cards/ResearchPlanCard.js +50 -0
- package/dist/cards/ResearchPlanCard.js.map +1 -0
- package/dist/cards/SearchSourcesCard.d.ts +29 -0
- package/dist/cards/SearchSourcesCard.d.ts.map +1 -0
- package/dist/cards/SearchSourcesCard.js +83 -0
- package/dist/cards/SearchSourcesCard.js.map +1 -0
- package/dist/cards/SuggestedRepliesCard.d.ts +18 -0
- package/dist/cards/SuggestedRepliesCard.d.ts.map +1 -0
- package/dist/cards/SuggestedRepliesCard.js +14 -0
- package/dist/cards/SuggestedRepliesCard.js.map +1 -0
- package/dist/cards/SummaryMessageCard.d.ts +40 -0
- package/dist/cards/SummaryMessageCard.d.ts.map +1 -0
- package/dist/cards/SummaryMessageCard.js +56 -0
- package/dist/cards/SummaryMessageCard.js.map +1 -0
- package/dist/cards/ThinkingProcessCard.d.ts +46 -0
- package/dist/cards/ThinkingProcessCard.d.ts.map +1 -0
- package/dist/cards/ThinkingProcessCard.js +79 -0
- package/dist/cards/ThinkingProcessCard.js.map +1 -0
- package/dist/cards/ToolExecutionCard.d.ts +21 -0
- package/dist/cards/ToolExecutionCard.d.ts.map +1 -0
- package/dist/cards/ToolExecutionCard.js +65 -0
- package/dist/cards/ToolExecutionCard.js.map +1 -0
- package/dist/cards/icons.d.ts +38 -0
- package/dist/cards/icons.d.ts.map +1 -0
- package/dist/cards/icons.js +87 -0
- package/dist/cards/icons.js.map +1 -0
- package/dist/cards/index.d.ts +38 -0
- package/dist/cards/index.d.ts.map +1 -0
- package/dist/cards/index.js +24 -0
- package/dist/cards/index.js.map +1 -0
- package/dist/cards/types.d.ts +24 -0
- package/dist/cards/types.d.ts.map +1 -0
- package/dist/cards/types.js +7 -0
- package/dist/cards/types.js.map +1 -0
- package/dist/components/AgentSelector.d.ts +23 -0
- package/dist/components/AgentSelector.d.ts.map +1 -0
- package/dist/components/AgentSelector.js +63 -0
- package/dist/components/AgentSelector.js.map +1 -0
- package/dist/components/AgentSelector.stories.d.ts +12 -0
- package/dist/components/AgentSelector.stories.d.ts.map +1 -0
- package/dist/components/AgentSelector.stories.js +95 -0
- package/dist/components/AgentSelector.stories.js.map +1 -0
- package/dist/components/ChatPanel.d.ts +138 -21
- package/dist/components/ChatPanel.d.ts.map +1 -1
- package/dist/components/ChatPanel.js +181 -26
- package/dist/components/ChatPanel.js.map +1 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/state/ChatSessionProvider.d.ts +59 -0
- package/dist/state/ChatSessionProvider.d.ts.map +1 -0
- package/dist/state/ChatSessionProvider.js +71 -0
- package/dist/state/ChatSessionProvider.js.map +1 -0
- package/dist/state/MockChatStreamTransport.d.ts +54 -0
- package/dist/state/MockChatStreamTransport.d.ts.map +1 -0
- package/dist/state/MockChatStreamTransport.js +86 -0
- package/dist/state/MockChatStreamTransport.js.map +1 -0
- package/dist/state/MockChatStreamTransport.stories.d.ts +13 -0
- package/dist/state/MockChatStreamTransport.stories.d.ts.map +1 -0
- package/dist/state/MockChatStreamTransport.stories.js +60 -0
- package/dist/state/MockChatStreamTransport.stories.js.map +1 -0
- package/dist/state/bridgeLegacySSE.d.ts +42 -0
- package/dist/state/bridgeLegacySSE.d.ts.map +1 -0
- package/dist/state/bridgeLegacySSE.js +102 -0
- package/dist/state/bridgeLegacySSE.js.map +1 -0
- package/dist/state/index.d.ts +32 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +24 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/parseSSE.d.ts +50 -0
- package/dist/state/parseSSE.d.ts.map +1 -0
- package/dist/state/parseSSE.js +112 -0
- package/dist/state/parseSSE.js.map +1 -0
- package/dist/state/useChatComposer.d.ts +51 -0
- package/dist/state/useChatComposer.d.ts.map +1 -0
- package/dist/state/useChatComposer.js +82 -0
- package/dist/state/useChatComposer.js.map +1 -0
- package/dist/state/useChatList.d.ts +71 -0
- package/dist/state/useChatList.d.ts.map +1 -0
- package/dist/state/useChatList.js +158 -0
- package/dist/state/useChatList.js.map +1 -0
- package/dist/state/useChatSession.d.ts +29 -0
- package/dist/state/useChatSession.d.ts.map +1 -0
- package/dist/state/useChatSession.js +37 -0
- package/dist/state/useChatSession.js.map +1 -0
- package/dist/state/useScrollLock.d.ts +35 -0
- package/dist/state/useScrollLock.d.ts.map +1 -0
- package/dist/state/useScrollLock.js +74 -0
- package/dist/state/useScrollLock.js.map +1 -0
- package/dist/state/useToolCallStream.d.ts +38 -0
- package/dist/state/useToolCallStream.d.ts.map +1 -0
- package/dist/state/useToolCallStream.js +74 -0
- package/dist/state/useToolCallStream.js.map +1 -0
- package/package.json +10 -2
- package/src/cards/ActionSegmentCard.tsx +60 -0
- package/src/cards/AnalysisDocumentCard.tsx +81 -0
- package/src/cards/AskUserQuestionsCard.tsx +354 -0
- package/src/cards/CoverageReportCard.tsx +215 -0
- package/src/cards/OrchestrationPlanCard.tsx +328 -0
- package/src/cards/PlanSelectorCard.tsx +312 -0
- package/src/cards/PlanStepsCard.tsx +52 -0
- package/src/cards/QuizCard.tsx +309 -0
- package/src/cards/ResearchPlanCard.tsx +169 -0
- package/src/cards/SearchSourcesCard.tsx +244 -0
- package/src/cards/SuggestedRepliesCard.tsx +48 -0
- package/src/cards/SummaryMessageCard.tsx +145 -0
- package/src/cards/ThinkingProcessCard.tsx +155 -0
- package/src/cards/ToolExecutionCard.tsx +152 -0
- package/src/cards/cards.test.tsx +492 -0
- package/src/cards/icons.tsx +249 -0
- package/src/cards/index.ts +53 -0
- package/src/cards/types.ts +27 -0
- package/src/components/AgentSelector.stories.tsx +113 -0
- package/src/components/AgentSelector.test.tsx +70 -0
- package/src/components/AgentSelector.tsx +147 -0
- package/src/components/ChatPanel.test.tsx +130 -0
- package/src/components/ChatPanel.tsx +612 -138
- package/src/components/index.ts +13 -1
- package/src/index.ts +43 -0
- package/src/state/ChatSessionProvider.test.tsx +85 -0
- package/src/state/ChatSessionProvider.tsx +98 -0
- package/src/state/MockChatStreamTransport.stories.tsx +95 -0
- package/src/state/MockChatStreamTransport.test.ts +163 -0
- package/src/state/MockChatStreamTransport.ts +123 -0
- package/src/state/bridgeLegacySSE.test.ts +134 -0
- package/src/state/bridgeLegacySSE.ts +134 -0
- package/src/state/index.ts +82 -0
- package/src/state/parseSSE.test.ts +123 -0
- package/src/state/parseSSE.ts +123 -0
- package/src/state/useChatComposer.test.ts +145 -0
- package/src/state/useChatComposer.ts +117 -0
- package/src/state/useChatList.test.ts +135 -0
- package/src/state/useChatList.ts +217 -0
- package/src/state/useChatSession.test.ts +61 -0
- package/src/state/useChatSession.ts +64 -0
- package/src/state/useScrollLock.test.ts +99 -0
- package/src/state/useScrollLock.ts +105 -0
- package/src/state/useToolCallStream.test.ts +86 -0
- package/src/state/useToolCallStream.ts +110 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* `ChatSessionProvider` + `useChatSessionContext`
|
|
4
|
+
*
|
|
5
|
+
* Lifts the chat-session primitives out of the host app's god-context (e.g.
|
|
6
|
+
* deeppath's `ChatUIContext`, deeppath-agent's hooks) into a framework-owned
|
|
7
|
+
* provider. Concretely it owns:
|
|
8
|
+
*
|
|
9
|
+
* - the streaming transcript: `messages`, `isStreaming`, `streamingMessageId`
|
|
10
|
+
* - send / cancel / clear actions
|
|
11
|
+
* - the composer (draft, send, cancel, key handlers)
|
|
12
|
+
*
|
|
13
|
+
* App-specific concerns that don't belong here (file uploads, geolocation,
|
|
14
|
+
* suggestion banners, chat tool toggles, chat list / agent selector) stay in
|
|
15
|
+
* the host app's own context. The `extras` slot lets apps thread custom
|
|
16
|
+
* values through the same provider so chat cards can call host actions
|
|
17
|
+
* without prop-drilling.
|
|
18
|
+
*
|
|
19
|
+
* Usage in a host app:
|
|
20
|
+
*
|
|
21
|
+
* <ChatSessionProvider
|
|
22
|
+
* value={{ ...useChatSession({ transport }), extras: { ...appHooks } }}
|
|
23
|
+
* >
|
|
24
|
+
* <ChatPanel.Root>...</ChatPanel.Root>
|
|
25
|
+
* </ChatSessionProvider>
|
|
26
|
+
*
|
|
27
|
+
* Cards / shell pieces consume via `useChatSessionContext()` so they don't
|
|
28
|
+
* import the host's context directly. This is the seam that lets the same
|
|
29
|
+
* compound `ChatPanel` work in deeppath, deeppath-agent, and the framework
|
|
30
|
+
* `examples/web-shell`.
|
|
31
|
+
*/
|
|
32
|
+
import * as React from 'react';
|
|
33
|
+
const ChatSessionContext = React.createContext(null);
|
|
34
|
+
export function ChatSessionProvider({ value, children, }) {
|
|
35
|
+
return (_jsx(ChatSessionContext.Provider, { value: value, children: children }));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Read the active chat session. Throws if no `ChatSessionProvider` is
|
|
39
|
+
* mounted above -- this is intentional: cards / shell pieces should be
|
|
40
|
+
* usable both inside the provider (typical) and via direct props for
|
|
41
|
+
* apps that haven't migrated yet (use `useOptionalChatSession()` for that).
|
|
42
|
+
*/
|
|
43
|
+
export function useChatSessionContext() {
|
|
44
|
+
const ctx = React.useContext(ChatSessionContext);
|
|
45
|
+
if (!ctx) {
|
|
46
|
+
throw new Error('useChatSessionContext must be used inside a <ChatSessionProvider />');
|
|
47
|
+
}
|
|
48
|
+
return ctx;
|
|
49
|
+
}
|
|
50
|
+
/** Non-throwing variant for components that want to fall back to props. */
|
|
51
|
+
export function useOptionalChatSession() {
|
|
52
|
+
const ctx = React.useContext(ChatSessionContext);
|
|
53
|
+
return ctx;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Convenience selector for the most-used slice in cards (`{ messages,
|
|
57
|
+
* isStreaming, sendUserMessage, cancel }`). Returns null when there's no
|
|
58
|
+
* provider so cards can opt into context-driven mode incrementally.
|
|
59
|
+
*/
|
|
60
|
+
export function useChatSessionSlice() {
|
|
61
|
+
const ctx = useOptionalChatSession();
|
|
62
|
+
if (!ctx)
|
|
63
|
+
return null;
|
|
64
|
+
return {
|
|
65
|
+
messages: ctx.messages,
|
|
66
|
+
isStreaming: ctx.isStreaming,
|
|
67
|
+
sendUserMessage: ctx.sendUserMessage,
|
|
68
|
+
cancel: ctx.cancel,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=ChatSessionProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatSessionProvider.js","sourceRoot":"","sources":["../../src/state/ChatSessionProvider.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,MAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAiC,IAAI,CAAC,CAAC;AAOrF,MAAM,UAAU,mBAAmB,CAAoB,EACrD,KAAK,EACL,QAAQ,GAC0B;IAClC,OAAO,CACL,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAgC,YACjE,QAAQ,GACmB,CAC/B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IACjD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,GAAuC,CAAC;AACjD,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,sBAAsB;IAGpC,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IACjD,OAAO,GAA8C,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IAGjC,MAAM,GAAG,GAAG,sBAAsB,EAAE,CAAC;IACrC,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,OAAO;QACL,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,eAAe,EAAE,GAAG,CAAC,eAAe;QACpC,MAAM,EAAE,GAAG,CAAC,MAAM;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `MockChatStreamTransport` — canned-script transport for stories, tests, and
|
|
3
|
+
* the framework's runnable web-shell example.
|
|
4
|
+
*
|
|
5
|
+
* Replays a deterministic list of `SSEEvent` per call to `stream()`. Optional
|
|
6
|
+
* per-event delays make streaming feel real in demos. Loop the same script
|
|
7
|
+
* forever, or vary by index — the constructor accepts either an array (one
|
|
8
|
+
* script per turn) or a function `(turn: number) => SSEEvent[]`.
|
|
9
|
+
*
|
|
10
|
+
* const transport = new MockChatStreamTransport({
|
|
11
|
+
* scripts: [
|
|
12
|
+
* [{ type: 'content', content: 'Hello, ' }, { type: 'content', content: 'world!' }, { type: 'done' }],
|
|
13
|
+
* ],
|
|
14
|
+
* defaultDelayMs: 25,
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* const { messages, sendUserMessage } = useChatStream({ transport });
|
|
18
|
+
*/
|
|
19
|
+
import type { SSEEvent } from '@steerable/agent-protocol';
|
|
20
|
+
import type { ChatStreamSendInput, ChatStreamTransport } from '../hooks/useChatStream.js';
|
|
21
|
+
export type MockScriptStep = SSEEvent | {
|
|
22
|
+
event: SSEEvent;
|
|
23
|
+
delayMs?: number;
|
|
24
|
+
};
|
|
25
|
+
export type MockScript = MockScriptStep[];
|
|
26
|
+
export interface MockChatStreamTransportOptions {
|
|
27
|
+
/**
|
|
28
|
+
* A list of scripts (one per turn), or a callback that returns a script for
|
|
29
|
+
* the current turn. Required.
|
|
30
|
+
*/
|
|
31
|
+
scripts: MockScript[] | ((turn: number, input: ChatStreamSendInput) => MockScript);
|
|
32
|
+
/** Delay between events when the step doesn't specify one. Defaults to 0. */
|
|
33
|
+
defaultDelayMs?: number;
|
|
34
|
+
/**
|
|
35
|
+
* What to do when there are fewer scripts than turns:
|
|
36
|
+
* - 'cycle' (default): wrap modulo `scripts.length`.
|
|
37
|
+
* - 'last': stay on the last script.
|
|
38
|
+
* - 'empty': emit only a `done` event.
|
|
39
|
+
*/
|
|
40
|
+
exhaustionPolicy?: 'cycle' | 'last' | 'empty';
|
|
41
|
+
}
|
|
42
|
+
export declare class MockChatStreamTransport implements ChatStreamTransport {
|
|
43
|
+
private readonly options;
|
|
44
|
+
private turn;
|
|
45
|
+
/** Set of in-flight cancel signals, exposed for tests. */
|
|
46
|
+
readonly cancelled: Set<number>;
|
|
47
|
+
constructor(options: MockChatStreamTransportOptions);
|
|
48
|
+
/** Reset the turn counter — useful between fixture-driven test cases. */
|
|
49
|
+
reset(): void;
|
|
50
|
+
stream(input: ChatStreamSendInput, onEvent: (event: SSEEvent) => void): Promise<() => void>;
|
|
51
|
+
private resolveScript;
|
|
52
|
+
private run;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=MockChatStreamTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockChatStreamTransport.d.ts","sourceRoot":"","sources":["../../src/state/MockChatStreamTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C,MAAM,MAAM,UAAU,GAAG,cAAc,EAAE,CAAC;AAE1C,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,KAAK,UAAU,CAAC,CAAC;IACnF,6EAA6E;IAC7E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;CAC/C;AAED,qBAAa,uBAAwB,YAAW,mBAAmB;IAKrD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJpC,OAAO,CAAC,IAAI,CAAK;IACjB,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,cAAqB;gBAEV,OAAO,EAAE,8BAA8B;IAEpE,yEAAyE;IACzE,KAAK,IAAI,IAAI;IAKP,MAAM,CACV,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,GACjC,OAAO,CAAC,MAAM,IAAI,CAAC;IActB,OAAO,CAAC,aAAa;YAgBP,GAAG;CAclB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `MockChatStreamTransport` — canned-script transport for stories, tests, and
|
|
3
|
+
* the framework's runnable web-shell example.
|
|
4
|
+
*
|
|
5
|
+
* Replays a deterministic list of `SSEEvent` per call to `stream()`. Optional
|
|
6
|
+
* per-event delays make streaming feel real in demos. Loop the same script
|
|
7
|
+
* forever, or vary by index — the constructor accepts either an array (one
|
|
8
|
+
* script per turn) or a function `(turn: number) => SSEEvent[]`.
|
|
9
|
+
*
|
|
10
|
+
* const transport = new MockChatStreamTransport({
|
|
11
|
+
* scripts: [
|
|
12
|
+
* [{ type: 'content', content: 'Hello, ' }, { type: 'content', content: 'world!' }, { type: 'done' }],
|
|
13
|
+
* ],
|
|
14
|
+
* defaultDelayMs: 25,
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* const { messages, sendUserMessage } = useChatStream({ transport });
|
|
18
|
+
*/
|
|
19
|
+
export class MockChatStreamTransport {
|
|
20
|
+
options;
|
|
21
|
+
turn = 0;
|
|
22
|
+
/** Set of in-flight cancel signals, exposed for tests. */
|
|
23
|
+
cancelled = new Set();
|
|
24
|
+
constructor(options) {
|
|
25
|
+
this.options = options;
|
|
26
|
+
}
|
|
27
|
+
/** Reset the turn counter — useful between fixture-driven test cases. */
|
|
28
|
+
reset() {
|
|
29
|
+
this.turn = 0;
|
|
30
|
+
this.cancelled.clear();
|
|
31
|
+
}
|
|
32
|
+
async stream(input, onEvent) {
|
|
33
|
+
const turn = this.turn++;
|
|
34
|
+
const script = this.resolveScript(turn, input);
|
|
35
|
+
let cancelled = false;
|
|
36
|
+
const cancel = () => {
|
|
37
|
+
cancelled = true;
|
|
38
|
+
this.cancelled.add(turn);
|
|
39
|
+
};
|
|
40
|
+
void this.run(script, onEvent, () => cancelled);
|
|
41
|
+
// Return synchronously so the framework hook can capture the cancel handle
|
|
42
|
+
// without waiting for the full script.
|
|
43
|
+
return cancel;
|
|
44
|
+
}
|
|
45
|
+
resolveScript(turn, input) {
|
|
46
|
+
const { scripts, exhaustionPolicy = 'cycle' } = this.options;
|
|
47
|
+
if (typeof scripts === 'function')
|
|
48
|
+
return scripts(turn, input);
|
|
49
|
+
if (scripts.length === 0)
|
|
50
|
+
return [{ type: 'done' }];
|
|
51
|
+
if (turn < scripts.length)
|
|
52
|
+
return scripts[turn];
|
|
53
|
+
switch (exhaustionPolicy) {
|
|
54
|
+
case 'last':
|
|
55
|
+
return scripts[scripts.length - 1];
|
|
56
|
+
case 'empty':
|
|
57
|
+
return [{ type: 'done' }];
|
|
58
|
+
case 'cycle':
|
|
59
|
+
default:
|
|
60
|
+
return scripts[turn % scripts.length];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async run(script, onEvent, isCancelled) {
|
|
64
|
+
const defaultDelay = this.options.defaultDelayMs ?? 0;
|
|
65
|
+
for (const step of script) {
|
|
66
|
+
if (isCancelled())
|
|
67
|
+
return;
|
|
68
|
+
const { event, delayMs } = normaliseStep(step, defaultDelay);
|
|
69
|
+
if (delayMs > 0)
|
|
70
|
+
await sleep(delayMs);
|
|
71
|
+
if (isCancelled())
|
|
72
|
+
return;
|
|
73
|
+
onEvent(event);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function normaliseStep(step, defaultDelayMs) {
|
|
78
|
+
if ('event' in step && step.event && typeof step.event === 'object') {
|
|
79
|
+
return { event: step.event, delayMs: step.delayMs ?? defaultDelayMs };
|
|
80
|
+
}
|
|
81
|
+
return { event: step, delayMs: defaultDelayMs };
|
|
82
|
+
}
|
|
83
|
+
function sleep(ms) {
|
|
84
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=MockChatStreamTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockChatStreamTransport.js","sourceRoot":"","sources":["../../src/state/MockChatStreamTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA+BH,MAAM,OAAO,uBAAuB;IAKL;IAJrB,IAAI,GAAG,CAAC,CAAC;IACjB,0DAA0D;IACjD,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IAEvC,YAA6B,OAAuC;QAAvC,YAAO,GAAP,OAAO,CAAgC;IAAG,CAAC;IAExE,yEAAyE;IACzE,KAAK;QACH,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,MAAM,CACV,KAA0B,EAC1B,OAAkC;QAElC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC/C,IAAI,SAAS,GAAG,KAAK,C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AW,EAAE;gBAAE,OAAO;YAC1B,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YAC7D,IAAI,OAAO,GAAG,CAAC;gBAAE,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;YACtC,IAAI,WAAW,EAAE;gBAAE,OAAO;YAC1B,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;CACF;AAED,SAAS,aAAa,CACpB,IAAoB,EACpB,cAAsB;IAEtB,IAAI,OAAO,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACpE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,cAAc,EAAE,CAAC;IACxE,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAgB,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;AAC9D,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storybook story for `MockChatStreamTransport` paired with `useChatSession`.
|
|
3
|
+
* This is the canonical "framework runs end-to-end with zero backend" demo —
|
|
4
|
+
* the same pattern is used by `examples/web-shell` in wave 5.
|
|
5
|
+
*/
|
|
6
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
7
|
+
declare const meta: Meta;
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj;
|
|
10
|
+
export declare const ContentOnly: Story;
|
|
11
|
+
export declare const WithToolCall: Story;
|
|
12
|
+
export declare const Cycling: Story;
|
|
13
|
+
//# sourceMappingURL=MockChatStreamTransport.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockChatStreamTransport.stories.d.ts","sourceRoot":"","sources":["../../src/state/MockChatStreamTransport.stories.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOvD,QAAA,MAAM,IAAI,EAAE,IAWX,CAAC;AACF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AA0DtB,eAAO,MAAM,WAAW,EAAE,KAEzB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAE1B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { ChatPanel } from '../components/ChatPanel.js';
|
|
4
|
+
import { MockChatStreamTransport } from './MockChatStreamTransport.js';
|
|
5
|
+
import { useChatSession } from './useChatSession.js';
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'State/MockChatStreamTransport',
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'fullscreen',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'Scripted SSE transport used in tests, stories, and the framework web-shell example. Pair with `useChatSession` for a fully offline chat demo.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
const baselineScript = [
|
|
19
|
+
{ type: 'content', content: 'Sure — ' },
|
|
20
|
+
{ type: 'content', content: "here's a plan:\n\n" },
|
|
21
|
+
{ type: 'content', content: '1. Outline goals\n' },
|
|
22
|
+
{ type: 'content', content: '2. Gather inputs\n' },
|
|
23
|
+
{ type: 'content', content: '3. Iterate\n\n' },
|
|
24
|
+
{ type: 'content', content: 'Want me to dive deeper into any step?' },
|
|
25
|
+
{ type: 'done' },
|
|
26
|
+
];
|
|
27
|
+
const toolCallScript = [
|
|
28
|
+
{ type: 'content', content: 'Checking the weather…\n' },
|
|
29
|
+
{
|
|
30
|
+
type: 'tool_call',
|
|
31
|
+
payload: { id: 'c1', name: 'get_weather', arguments: { city: 'Tokyo' } },
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
type: 'tool_result',
|
|
35
|
+
payload: { success: true, data: { temp: 22, conditions: 'clear' } },
|
|
36
|
+
},
|
|
37
|
+
{ type: 'content', content: '\nIt is 22°C and clear in Tokyo right now.' },
|
|
38
|
+
{ type: 'done' },
|
|
39
|
+
];
|
|
40
|
+
function DemoChat({ scripts, delayMs }) {
|
|
41
|
+
const transport = useMemo(() => new MockChatStreamTransport({
|
|
42
|
+
scripts,
|
|
43
|
+
defaultDelayMs: delayMs,
|
|
44
|
+
exhaustionPolicy: 'cycle',
|
|
45
|
+
}), [scripts, delayMs]);
|
|
46
|
+
const session = useChatSession({ transport });
|
|
47
|
+
return (_jsx("div", { className: "h-[640px] w-full max-w-3xl border border-agent-border bg-agent-canvas", children: _jsx(ChatPanel, { messages: session.messages, isStreaming: session.isStreaming, onSubmit: async ({ content }) => {
|
|
48
|
+
await session.sendUserMessage({ content });
|
|
49
|
+
}, onCancel: session.cancel, emptyState: _jsxs("div", { className: "m-auto max-w-sm text-center text-sm text-agent-muted-foreground", children: [_jsx("p", { className: "font-medium text-agent-foreground", children: "Try the mock transport" }), _jsx("p", { className: "mt-1", children: "Anything you type triggers the next scripted reply." })] }) }) }));
|
|
50
|
+
}
|
|
51
|
+
export const ContentOnly = {
|
|
52
|
+
render: () => _jsx(DemoChat, { scripts: [baselineScript], delayMs: 30 }),
|
|
53
|
+
};
|
|
54
|
+
export const WithToolCall = {
|
|
55
|
+
render: () => _jsx(DemoChat, { scripts: [toolCallScript], delayMs: 30 }),
|
|
56
|
+
};
|
|
57
|
+
export const Cycling = {
|
|
58
|
+
render: () => _jsx(DemoChat, { scripts: [baselineScript, toolCallScript], delayMs: 30 }),
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=MockChatStreamTransport.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockChatStreamTransport.stories.js","sourceRoot":"","sources":["../../src/state/MockChatStreamTransport.stories.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,IAAI,GAAS;IACjB,KAAK,EAAE,+BAA+B;IACtC,UAAU,EAAE;QACV,MAAM,EAAE,YAAY;QACpB,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EACP,+IAA+I;aAClJ;SACF;KACF;CACF,CAAC;AACF,eAAe,IAAI,CAAC;AAGpB,MAAM,cAAc,GAAe;IACjC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE;IACvC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,EAAE;IAClD,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,EAAE;IAClD,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,EAAE;IAClD,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE;IAC9C,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,uCAAuC,EAAE;IACrE,EAAE,IAAI,EAAE,MAAM,EAAE;CACjB,CAAC;AAEF,MAAM,cAAc,GAAe;IACjC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,yBAAyB,EAAE;IACvD;QACE,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,E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AE,CAAC,KAAC,QAAQ,IAAC,OAAO,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,GAAI;CACnE,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,MAAM,EAAE,GAAG,EAAE,CAAC,KAAC,QAAQ,IAAC,OAAO,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,GAAI;CACnE,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,MAAM,EAAE,GAAG,EAAE,CAAC,KAAC,QAAQ,IAAC,OAAO,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,GAAI;CACnF,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `bridgeLegacySSE` — turn the heterogeneous wire envelopes that deeppath's
|
|
3
|
+
* Next.js API and deeppath-agent's local backend speak into the canonical
|
|
4
|
+
* `SSEEvent` consumed by `useChatStream`.
|
|
5
|
+
*
|
|
6
|
+
* Lifted from:
|
|
7
|
+
* - deeppath/apps/web/src/lib/utils/framework-sse-bridge.ts (normalize())
|
|
8
|
+
* - deeppath-agent/apps/web/src/lib/chat-transport.ts (normaliseLocalPayload())
|
|
9
|
+
*
|
|
10
|
+
* The two implementations are merged here, with deeppath-agent's richer
|
|
11
|
+
* `completion` / `executed_actions` / `user_message` / `message_id` handling
|
|
12
|
+
* promoted as the default and the older deeppath wire shapes added as
|
|
13
|
+
* `EnvelopeProfile.deeppathCloud`. A consumer picks a profile (or "auto"),
|
|
14
|
+
* and the bridge does the rest.
|
|
15
|
+
*
|
|
16
|
+
* The bridge is intentionally pure — no I/O, no DOM, no electron — so it can
|
|
17
|
+
* back any transport (fetch SSE, IPC streaming, mocked fixtures, JSON-RPC).
|
|
18
|
+
*/
|
|
19
|
+
import type { SSEEvent } from '@steerable/agent-protocol';
|
|
20
|
+
export type EnvelopeProfile = 'auto'
|
|
21
|
+
/** Next.js `/api/chats/:id/send` legacy wire — `{content}` deltas, `{error}` envelopes. */
|
|
22
|
+
| 'deeppathCloud'
|
|
23
|
+
/** Electron local-backend wire — typed completion/executed_actions/user_message. */
|
|
24
|
+
| 'deeppathLocal';
|
|
25
|
+
export interface BridgeLegacySSEOptions {
|
|
26
|
+
profile?: EnvelopeProfile;
|
|
27
|
+
/**
|
|
28
|
+
* If we see a typed event with `type` outside the canonical SSEEvent union
|
|
29
|
+
* (e.g. `stage-complete`, `executed_actions`), repackage it as an `agent`
|
|
30
|
+
* event whose `payload` is the raw envelope. Defaults to `true` so the
|
|
31
|
+
* framework `useChatStream`'s `onUnknownEvent` channel sees them.
|
|
32
|
+
*/
|
|
33
|
+
passthroughUnknownAsAgent?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Convert one parsed envelope (the JSON value of `data:` plus the optional
|
|
37
|
+
* `event:` name) into zero or one `SSEEvent`. Returns null if the envelope is
|
|
38
|
+
* deliberately suppressed (e.g. `user_message` echoes, since useChatStream
|
|
39
|
+
* already appends the user message locally).
|
|
40
|
+
*/
|
|
41
|
+
export declare function bridgeLegacySSE(parsed: unknown, eventName?: string, options?: BridgeLegacySSEOptions): SSEEvent | null;
|
|
42
|
+
//# sourceMappingURL=bridgeLegacySSE.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridgeLegacySSE.d.ts","sourceRoot":"","sources":["../../src/state/bridgeLegacySSE.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,MAAM,eAAe,GACvB,MAAM;AACR,2FAA2F;GACzF,eAAe;AACjB,oFAAoF;GAClF,eAAe,CAAC;AAEpB,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAeD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,OAAO,EACf,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,GAAE,sBAA2B,GACnC,QAAQ,GAAG,IAAI,CA2CjB"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `bridgeLegacySSE` — turn the heterogeneous wire envelopes that deeppath's
|
|
3
|
+
* Next.js API and deeppath-agent's local backend speak into the canonical
|
|
4
|
+
* `SSEEvent` consumed by `useChatStream`.
|
|
5
|
+
*
|
|
6
|
+
* Lifted from:
|
|
7
|
+
* - deeppath/apps/web/src/lib/utils/framework-sse-bridge.ts (normalize())
|
|
8
|
+
* - deeppath-agent/apps/web/src/lib/chat-transport.ts (normaliseLocalPayload())
|
|
9
|
+
*
|
|
10
|
+
* The two implementations are merged here, with deeppath-agent's richer
|
|
11
|
+
* `completion` / `executed_actions` / `user_message` / `message_id` handling
|
|
12
|
+
* promoted as the default and the older deeppath wire shapes added as
|
|
13
|
+
* `EnvelopeProfile.deeppathCloud`. A consumer picks a profile (or "auto"),
|
|
14
|
+
* and the bridge does the rest.
|
|
15
|
+
*
|
|
16
|
+
* The bridge is intentionally pure — no I/O, no DOM, no electron — so it can
|
|
17
|
+
* back any transport (fetch SSE, IPC streaming, mocked fixtures, JSON-RPC).
|
|
18
|
+
*/
|
|
19
|
+
const KNOWN_EVENT_TYPES = new Set([
|
|
20
|
+
'content',
|
|
21
|
+
'error',
|
|
22
|
+
'agent',
|
|
23
|
+
'orchestration',
|
|
24
|
+
'loader-hint',
|
|
25
|
+
'keepalive',
|
|
26
|
+
'done',
|
|
27
|
+
'budget_exhausted',
|
|
28
|
+
'tool_call',
|
|
29
|
+
'tool_result',
|
|
30
|
+
]);
|
|
31
|
+
/**
|
|
32
|
+
* Convert one parsed envelope (the JSON value of `data:` plus the optional
|
|
33
|
+
* `event:` name) into zero or one `SSEEvent`. Returns null if the envelope is
|
|
34
|
+
* deliberately suppressed (e.g. `user_message` echoes, since useChatStream
|
|
35
|
+
* already appends the user message locally).
|
|
36
|
+
*/
|
|
37
|
+
export function bridgeLegacySSE(parsed, eventName, options = {}) {
|
|
38
|
+
const profile = options.profile ?? 'auto';
|
|
39
|
+
const passthroughUnknown = options.passthroughUnknownAsAgent ?? true;
|
|
40
|
+
if (typeof parsed === 'string') {
|
|
41
|
+
return parsed.length > 0 ? { type: 'content', content: parsed } : null;
|
|
42
|
+
}
|
|
43
|
+
if (parsed === null || typeof parsed !== 'object') {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const data = parsed;
|
|
47
|
+
if (eventName === 'error') {
|
|
48
|
+
return {
|
|
49
|
+
type: 'error',
|
|
50
|
+
message: typeof data.message === 'string' ? data.message : 'unknown error',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// Legacy: `{ content: '...' }` carries an incremental token (deeppath cloud).
|
|
54
|
+
if (typeof data.content === 'string' && !('type' in data)) {
|
|
55
|
+
return { type: 'content', content: data.content };
|
|
56
|
+
}
|
|
57
|
+
// Legacy: `{ error: '...' }` is an inline error envelope (deeppath cloud).
|
|
58
|
+
if (typeof data.error === 'string' && !('type' in data)) {
|
|
59
|
+
return { type: 'error', message: data.error };
|
|
60
|
+
}
|
|
61
|
+
// Canonical typed events.
|
|
62
|
+
if (typeof data.type === 'string') {
|
|
63
|
+
if (KNOWN_EVENT_TYPES.has(data.type)) {
|
|
64
|
+
return data;
|
|
65
|
+
}
|
|
66
|
+
if (profile === 'deeppathLocal' || profile === 'auto') {
|
|
67
|
+
const mapped = mapLocalBackendEnvelope(data);
|
|
68
|
+
if (mapped !== undefined)
|
|
69
|
+
return mapped;
|
|
70
|
+
}
|
|
71
|
+
if (passthroughUnknown) {
|
|
72
|
+
return { type: 'agent', event: data.type, payload: data };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
function mapLocalBackendEnvelope(data) {
|
|
78
|
+
switch (data.type) {
|
|
79
|
+
case 'completion': {
|
|
80
|
+
const status = data.status;
|
|
81
|
+
if (status === 'completed' || status === 'failed') {
|
|
82
|
+
return { type: 'done', payload: data };
|
|
83
|
+
}
|
|
84
|
+
if (status === 'budget_exhausted') {
|
|
85
|
+
return {
|
|
86
|
+
type: 'budget_exhausted',
|
|
87
|
+
message: typeof data.reason === 'string' ? data.reason : undefined,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return { type: 'agent', event: 'round_end', payload: data };
|
|
91
|
+
}
|
|
92
|
+
case 'executed_actions':
|
|
93
|
+
return { type: 'agent', event: 'executed_actions', payload: data };
|
|
94
|
+
case 'user_message':
|
|
95
|
+
return null;
|
|
96
|
+
case 'message_id':
|
|
97
|
+
return { type: 'agent', event: 'message_id', payload: data };
|
|
98
|
+
default:
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=bridgeLegacySSE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridgeLegacySSE.js","sourceRoot":"","sources":["../../src/state/bridgeLegacySSE.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAsBH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAmB;IAClD,SAAS;IACT,OAAO;IACP,OAAO;IACP,eAAe;IACf,aAAa;IACb,WAAW;IACX,MAAM;IACN,kBAAkB;IAClB,WAAW;IACX,aAAa;CACd,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAe,EACf,SAAkB,EAClB,UAAkC,EAAE;IAEpC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC;IAC1C,MAAM,kBAAkB,GAAG,OAAO,CAAC,yBAAyB,IAAI,IAAI,CAAC;IAErE,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,MAAM,CAAC,MAAM,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,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@steerable/agent-ui/state` — chat-state primitives lifted out of deeppath
|
|
3
|
+
* and deeppath-agent. Composes with the existing `hooks/` exports.
|
|
4
|
+
*
|
|
5
|
+
* Subpath import recommended:
|
|
6
|
+
*
|
|
7
|
+
* import { useChatSession, MockChatStreamTransport } from '@steerable/agent-ui/state';
|
|
8
|
+
*
|
|
9
|
+
* but the same identifiers are also re-exported from the package root for
|
|
10
|
+
* back-compat.
|
|
11
|
+
*/
|
|
12
|
+
export { SSEParser, parseSSEData } from './parseSSE.js';
|
|
13
|
+
export type { SSEFrame, SSEParserOptions } from './parseSSE.js';
|
|
14
|
+
export { bridgeLegacySSE } from './bridgeLegacySSE.js';
|
|
15
|
+
export type { EnvelopeProfile, BridgeLegacySSEOptions } from './bridgeLegacySSE.js';
|
|
16
|
+
export { MockChatStreamTransport } from './MockChatStreamTransport.js';
|
|
17
|
+
export type { MockScript, MockScriptStep, MockChatStreamTransportOptions, } from './MockChatStreamTransport.js';
|
|
18
|
+
export { useChatComposer } from './useChatComposer.js';
|
|
19
|
+
export type { UseChatComposerOptions, UseChatComposerReturn, } from './useChatComposer.js';
|
|
20
|
+
export { useChatList } from './useChatList.js';
|
|
21
|
+
export type { ChatListTransport, UseChatListOptions, UseChatListReturn, } from './useChatList.js';
|
|
22
|
+
export { useChatSession } from './useChatSession.js';
|
|
23
|
+
export type { UseChatSessionOptions, UseChatSessionReturn, } from './useChatSession.js';
|
|
24
|
+
export { ChatSessionProvider, useChatSessionContext, useOptionalChatSession, useChatSessionSlice, } from './ChatSessionProvider.js';
|
|
25
|
+
export type { ChatSessionContextValue, ChatSessionProviderProps, } from './ChatSessionProvider.js';
|
|
26
|
+
export { useToolCallStream, useToolCallStatus, } from './useToolCallStream.js';
|
|
27
|
+
export type { ToolCallEntry, UseToolCallStreamOptions, UseToolCallStreamReturn, } from './useToolCallStream.js';
|
|
28
|
+
export { useScrollLock } from './useScrollLock.js';
|
|
29
|
+
export type { UseScrollLockOptions, UseScrollLockReturn, } from './useScrollLock.js';
|
|
30
|
+
export { useChatStream, } from '../hooks/useChatStream.js';
|
|
31
|
+
export type { UseChatStreamOptions, UseChatStreamReturn, ChatStreamSendInput, ChatStreamTransport, } from '../hooks/useChatStream.js';
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACxD,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EACV,UAAU,EACV,cAAc,EACd,8BAA8B,GAC/B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EACV,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EACV,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,aAAa,EACb,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EACL,aAAa,GACd,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@steerable/agent-ui/state` — chat-state primitives lifted out of deeppath
|
|
3
|
+
* and deeppath-agent. Composes with the existing `hooks/` exports.
|
|
4
|
+
*
|
|
5
|
+
* Subpath import recommended:
|
|
6
|
+
*
|
|
7
|
+
* import { useChatSession, MockChatStreamTransport } from '@steerable/agent-ui/state';
|
|
8
|
+
*
|
|
9
|
+
* but the same identifiers are also re-exported from the package root for
|
|
10
|
+
* back-compat.
|
|
11
|
+
*/
|
|
12
|
+
export { SSEParser, parseSSEData } from './parseSSE.js';
|
|
13
|
+
export { bridgeLegacySSE } from './bridgeLegacySSE.js';
|
|
14
|
+
export { MockChatStreamTransport } from './MockChatStreamTransport.js';
|
|
15
|
+
export { useChatComposer } from './useChatComposer.js';
|
|
16
|
+
export { useChatList } from './useChatList.js';
|
|
17
|
+
export { useChatSession } from './useChatSession.js';
|
|
18
|
+
export { ChatSessionProvider, useChatSessionContext, useOptionalChatSession, useChatSessionSlice, } from './ChatSessionProvider.js';
|
|
19
|
+
export { useToolCallStream, useToolCallStatus, } from './useToolCallStream.js';
|
|
20
|
+
export { useScrollLock } from './useScrollLock.js';
|
|
21
|
+
// Re-export the canonical chat-stream surface so callers can stay on a single
|
|
22
|
+
// import root if they don't want to think about subpaths.
|
|
23
|
+
export { useChatStream, } from '../hooks/useChatStream.js';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAOvE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAMvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAMrD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMnD,8EAA8E;AAC9E,0DAA0D;AAC1D,OAAO,EACL,aAAa,GACd,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `parseSSE` — wire-level Server-Sent-Events parser.
|
|
3
|
+
*
|
|
4
|
+
* Feed it raw text chunks from any source (fetch ReadableStream chunks,
|
|
5
|
+
* Electron IPC `webContents.send` payloads, mocked fixtures, …). It buffers,
|
|
6
|
+
* splits on the `\r?\n\r?\n` frame terminator, and emits one
|
|
7
|
+
* `{ event?, data?, id?, retry? }` per complete frame. JSON parsing of `data`
|
|
8
|
+
* is intentionally out of scope; downstream layers like {@link bridgeLegacySSE}
|
|
9
|
+
* handle that.
|
|
10
|
+
*
|
|
11
|
+
* Replaces deeppath's `SSEParser` and deeppath-agent's `LocalBackendSseParser`
|
|
12
|
+
* with a single dependency-free implementation that compiles to both Node and
|
|
13
|
+
* the browser. Heartbeat-timeout watchdogs (deeppath had a 30 s gate) live on
|
|
14
|
+
* the transport, not here — this class is a pure parser.
|
|
15
|
+
*/
|
|
16
|
+
export interface SSEFrame {
|
|
17
|
+
/** The `event: …` field; undefined for default `message` events. */
|
|
18
|
+
event?: string;
|
|
19
|
+
/** Concatenated `data: …` lines (newline-joined per the SSE spec). */
|
|
20
|
+
data?: string;
|
|
21
|
+
/** The `id: …` field. */
|
|
22
|
+
id?: string;
|
|
23
|
+
/** The `retry: …` field, as milliseconds. */
|
|
24
|
+
retry?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface SSEParserOptions {
|
|
27
|
+
onFrame: (frame: SSEFrame) => void;
|
|
28
|
+
onError?: (err: Error) => void;
|
|
29
|
+
/** Called when the stream emits the canonical `data: [DONE]` terminator. */
|
|
30
|
+
onComplete?: () => void;
|
|
31
|
+
}
|
|
32
|
+
export declare class SSEParser {
|
|
33
|
+
private readonly options;
|
|
34
|
+
private buffer;
|
|
35
|
+
private completed;
|
|
36
|
+
constructor(options: SSEParserOptions);
|
|
37
|
+
/** Feed one chunk. Safe to call with partial UTF-8 strings (we don't decode). */
|
|
38
|
+
feed(chunk: string): void;
|
|
39
|
+
/** Call when the source signals end-of-stream. Flushes any trailing frame. */
|
|
40
|
+
end(): void;
|
|
41
|
+
/** Drop all state and stop emitting. */
|
|
42
|
+
cleanup(): void;
|
|
43
|
+
private processFrame;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Tolerant JSON parser for SSE `data:` payloads — returns the raw string when
|
|
47
|
+
* the body isn't JSON, which deeppath relies on for bare-text content deltas.
|
|
48
|
+
*/
|
|
49
|
+
export declare function parseSSEData(data: string): unknown;
|
|
50
|
+
//# sourceMappingURL=parseSSE.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseSSE.d.ts","sourceRoot":"","sources":["../../src/state/parseSSE.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,QAAQ;IACvB,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IACnC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;IAC/B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,qBAAa,SAAS;IAIR,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,SAAS,CAAS;gBAEG,OAAO,EAAE,gBAAgB;IAEtD,iFAAiF;IACjF,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAUzB,8EAA8E;IAC9E,GAAG,IAAI,IAAI;IAMX,wCAAwC;IACxC,OAAO,IAAI,IAAI;IAKf,OAAO,CAAC,YAAY;CA8CrB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMlD"}
|