@opencx/widget-react-headless 4.0.62 → 5.0.0-beta.1

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.
Files changed (99) hide show
  1. package/README.md +17 -0
  2. package/dist/index.cjs +23 -1
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.js +4748 -182
  5. package/dist/index.js.map +1 -1
  6. package/dist/package.json.d.ts +53 -0
  7. package/dist/src/ComponentRegistry.d.ts.map +1 -1
  8. package/dist/src/WidgetProvider.d.ts +9 -2
  9. package/dist/src/WidgetProvider.d.ts.map +1 -1
  10. package/dist/src/__tests__/ComponentRegistry.spec.d.ts +2 -0
  11. package/dist/src/__tests__/ComponentRegistry.spec.d.ts.map +1 -0
  12. package/dist/src/__tests__/WidgetProvider.capabilities.spec.d.ts +2 -0
  13. package/dist/src/__tests__/WidgetProvider.capabilities.spec.d.ts.map +1 -0
  14. package/dist/src/__tests__/WidgetProvider.initialization.spec.d.ts +2 -0
  15. package/dist/src/__tests__/WidgetProvider.initialization.spec.d.ts.map +1 -0
  16. package/dist/src/agent-chat/AgentChatContext.d.ts +58 -0
  17. package/dist/src/agent-chat/AgentChatContext.d.ts.map +1 -0
  18. package/dist/src/agent-chat/__tests__/WidgetProvider.agent-chat.spec.d.ts +2 -0
  19. package/dist/src/agent-chat/__tests__/WidgetProvider.agent-chat.spec.d.ts.map +1 -0
  20. package/dist/src/agent-chat/__tests__/agent-chat-queue.spec.d.ts +2 -0
  21. package/dist/src/agent-chat/__tests__/agent-chat-queue.spec.d.ts.map +1 -0
  22. package/dist/src/agent-chat/__tests__/agent-chat-stream.spec.d.ts +2 -0
  23. package/dist/src/agent-chat/__tests__/agent-chat-stream.spec.d.ts.map +1 -0
  24. package/dist/src/agent-chat/__tests__/agent-chat-transport.spec.d.ts +2 -0
  25. package/dist/src/agent-chat/__tests__/agent-chat-transport.spec.d.ts.map +1 -0
  26. package/dist/src/agent-chat/__tests__/agent-turn-sources.spec.d.ts +2 -0
  27. package/dist/src/agent-chat/__tests__/agent-turn-sources.spec.d.ts.map +1 -0
  28. package/dist/src/agent-chat/__tests__/ask-questions.spec.d.ts +2 -0
  29. package/dist/src/agent-chat/__tests__/ask-questions.spec.d.ts.map +1 -0
  30. package/dist/src/agent-chat/__tests__/pending-clarification.spec.d.ts +2 -0
  31. package/dist/src/agent-chat/__tests__/pending-clarification.spec.d.ts.map +1 -0
  32. package/dist/src/agent-chat/__tests__/stop-agent-chat-turn.spec.d.ts +2 -0
  33. package/dist/src/agent-chat/__tests__/stop-agent-chat-turn.spec.d.ts.map +1 -0
  34. package/dist/src/agent-chat/__tests__/use-agent-chat.client-context.spec.d.ts +2 -0
  35. package/dist/src/agent-chat/__tests__/use-agent-chat.client-context.spec.d.ts.map +1 -0
  36. package/dist/src/agent-chat/__tests__/use-agent-chat.drain-order.spec.d.ts +2 -0
  37. package/dist/src/agent-chat/__tests__/use-agent-chat.drain-order.spec.d.ts.map +1 -0
  38. package/dist/src/agent-chat/__tests__/use-agent-chat.failed-turn.spec.d.ts +2 -0
  39. package/dist/src/agent-chat/__tests__/use-agent-chat.failed-turn.spec.d.ts.map +1 -0
  40. package/dist/src/agent-chat/__tests__/use-agent-chat.feature-narrowing.spec.d.ts +2 -0
  41. package/dist/src/agent-chat/__tests__/use-agent-chat.feature-narrowing.spec.d.ts.map +1 -0
  42. package/dist/src/agent-chat/__tests__/use-agent-chat.send-features.spec.d.ts +2 -0
  43. package/dist/src/agent-chat/__tests__/use-agent-chat.send-features.spec.d.ts.map +1 -0
  44. package/dist/src/agent-chat/__tests__/use-agent-chat.steer.spec.d.ts +2 -0
  45. package/dist/src/agent-chat/__tests__/use-agent-chat.steer.spec.d.ts.map +1 -0
  46. package/dist/src/agent-chat/__tests__/use-agent-chat.stop-partial.spec.d.ts +2 -0
  47. package/dist/src/agent-chat/__tests__/use-agent-chat.stop-partial.spec.d.ts.map +1 -0
  48. package/dist/src/agent-chat/__tests__/use-agent-chat.stream-handoff.spec.d.ts +2 -0
  49. package/dist/src/agent-chat/__tests__/use-agent-chat.stream-handoff.spec.d.ts.map +1 -0
  50. package/dist/src/agent-chat/__tests__/use-agent-chat.turn-retention.spec.d.ts +2 -0
  51. package/dist/src/agent-chat/__tests__/use-agent-chat.turn-retention.spec.d.ts.map +1 -0
  52. package/dist/src/agent-chat/__tests__/use-chat-post-finish-data-part.spec.d.ts +2 -0
  53. package/dist/src/agent-chat/__tests__/use-chat-post-finish-data-part.spec.d.ts.map +1 -0
  54. package/dist/src/agent-chat/agent-chat-queue.d.ts +29 -0
  55. package/dist/src/agent-chat/agent-chat-queue.d.ts.map +1 -0
  56. package/dist/src/agent-chat/agent-chat-stream.d.ts +74 -0
  57. package/dist/src/agent-chat/agent-chat-stream.d.ts.map +1 -0
  58. package/dist/src/agent-chat/agent-chat-transport.d.ts +29 -0
  59. package/dist/src/agent-chat/agent-chat-transport.d.ts.map +1 -0
  60. package/dist/src/agent-chat/agent-turn-sources.d.ts +23 -0
  61. package/dist/src/agent-chat/agent-turn-sources.d.ts.map +1 -0
  62. package/dist/src/agent-chat/ask-questions.d.ts +51 -0
  63. package/dist/src/agent-chat/ask-questions.d.ts.map +1 -0
  64. package/dist/src/agent-chat/pending-clarification.d.ts +27 -0
  65. package/dist/src/agent-chat/pending-clarification.d.ts.map +1 -0
  66. package/dist/src/agent-chat/steer-into-live-turn.d.ts +35 -0
  67. package/dist/src/agent-chat/steer-into-live-turn.d.ts.map +1 -0
  68. package/dist/src/agent-chat/stop-agent-chat-turn.d.ts +12 -0
  69. package/dist/src/agent-chat/stop-agent-chat-turn.d.ts.map +1 -0
  70. package/dist/src/agent-chat/useAgentChat.d.ts +54 -0
  71. package/dist/src/agent-chat/useAgentChat.d.ts.map +1 -0
  72. package/dist/src/hooks/__tests__/use-display-mode.spec.d.ts +2 -0
  73. package/dist/src/hooks/__tests__/use-display-mode.spec.d.ts.map +1 -0
  74. package/dist/src/hooks/__tests__/use-widget-layout.spec.d.ts +2 -0
  75. package/dist/src/hooks/__tests__/use-widget-layout.spec.d.ts.map +1 -0
  76. package/dist/src/hooks/__tests__/useHostLocation.spec.d.ts +2 -0
  77. package/dist/src/hooks/__tests__/useHostLocation.spec.d.ts.map +1 -0
  78. package/dist/src/hooks/useBot.d.ts +8 -0
  79. package/dist/src/hooks/useBot.d.ts.map +1 -0
  80. package/dist/src/hooks/useCsat.d.ts +1 -1
  81. package/dist/src/hooks/useCsat.d.ts.map +1 -1
  82. package/dist/src/hooks/useDictation.d.ts +22 -0
  83. package/dist/src/hooks/useDictation.d.ts.map +1 -0
  84. package/dist/src/hooks/useDisplayMode.d.ts +7 -0
  85. package/dist/src/hooks/useDisplayMode.d.ts.map +1 -0
  86. package/dist/src/hooks/useHostLocation.d.ts +17 -0
  87. package/dist/src/hooks/useHostLocation.d.ts.map +1 -0
  88. package/dist/src/hooks/useIsAwaitingBotReply.d.ts.map +1 -1
  89. package/dist/src/hooks/useMessages.d.ts +3 -6
  90. package/dist/src/hooks/useMessages.d.ts.map +1 -1
  91. package/dist/src/hooks/useModes.d.ts +5 -12
  92. package/dist/src/hooks/useModes.d.ts.map +1 -1
  93. package/dist/src/hooks/useSessions.d.ts.map +1 -1
  94. package/dist/src/hooks/useUploadFiles.d.ts +1 -1
  95. package/dist/src/hooks/useWidgetLayout.d.ts +60 -0
  96. package/dist/src/hooks/useWidgetLayout.d.ts.map +1 -0
  97. package/dist/src/index.d.ts +10 -0
  98. package/dist/src/index.d.ts.map +1 -1
  99. package/package.json +9 -3
@@ -0,0 +1,53 @@
1
+ declare const _default: {
2
+ "name": "@opencx/widget-react-headless",
3
+ "private": false,
4
+ "version": "5.0.0-beta.1",
5
+ "type": "module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/openchatai/widget"
9
+ },
10
+ "scripts": {
11
+ "clean": "rm -rf node_modules dist .turbo",
12
+ "clean:dist": "rm -rf dist .turbo",
13
+ "build": "vite build",
14
+ "test": "vitest run",
15
+ "type-check": "tsc --noEmit",
16
+ "lint": "eslint .",
17
+ "format": "prettier --write ."
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.js",
26
+ "require": "./dist/index.cjs"
27
+ }
28
+ },
29
+ "dependencies": {
30
+ "@opencx/widget-core": "workspace:*",
31
+ "uuid": "^11.0.4",
32
+ "zod": "^4.3.6"
33
+ },
34
+ "peerDependencies": {
35
+ "@types/react": ">=18 <20",
36
+ "@types/react-dom": ">=18 <20",
37
+ "react": ">=18 <20",
38
+ "react-dom": ">=18 <20"
39
+ },
40
+ "devDependencies": {
41
+ "@ai-sdk/react": "4.0.34",
42
+ "@opencx/eslint-config": "workspace:*",
43
+ "@opencx/tsconfig": "workspace:*",
44
+ "@types/react": "^19.2.18",
45
+ "@types/react-dom": "^19.2.5",
46
+ "ai": "^7.0.31",
47
+ "react": "^19.2.8",
48
+ "react-dom": "^19.2.8"
49
+ }
50
+ }
51
+ ;
52
+
53
+ export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentRegistry.d.ts","sourceRoot":"","sources":["../../src/ComponentRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,qBAAa,iBAAiB;IAC5B,UAAU,EAAE,mBAAmB,EAAE,CAAM;gBAE3B,IAAI,EAAE;QAAE,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAA;KAAE;IAgBxD,QAAQ,CAAC,SAAS,EAAE,mBAAmB;IAWvC,OAAO,CAAC,GAAG;IAQJ,YAAY,CAAC,GAAG,EAAE,MAAM;CAGhC"}
1
+ {"version":3,"file":"ComponentRegistry.d.ts","sourceRoot":"","sources":["../../src/ComponentRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,qBAAa,iBAAiB;IAC5B,UAAU,EAAE,mBAAmB,EAAE,CAAM;gBAE3B,IAAI,EAAE;QAAE,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAA;KAAE;IAexD,QAAQ,CAAC,SAAS,EAAE,mBAAmB;IAavC,OAAO,CAAC,GAAG;IAQJ,YAAY,CAAC,GAAG,EAAE,MAAM;CAGhC"}
@@ -10,7 +10,7 @@ interface WidgetProviderValue {
10
10
  version: string;
11
11
  contentIframeRef?: React.MutableRefObject<HTMLIFrameElement | null>;
12
12
  }
13
- export declare function WidgetProvider({ options: config, children, components, storage, loadingComponent, }: {
13
+ export declare function WidgetProvider({ options: config, children, components, storage, loadingComponent, errorComponent, }: {
14
14
  options: WidgetConfig;
15
15
  children: React.ReactNode;
16
16
  components?: WidgetComponentType[];
@@ -20,7 +20,14 @@ export declare function WidgetProvider({ options: config, children, components,
20
20
  * Not to be confused with the `loading` custom component which renders when the bot's reply is pending
21
21
  */
22
22
  loadingComponent?: React.ReactNode;
23
- }): string | number | bigint | true | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null;
23
+ /**
24
+ * Render initialization failures (invalid token, network failure). When
25
+ * omitted the widget renders nothing and reports the failure to the
26
+ * console — a support widget must never take the host's React tree down
27
+ * with it.
28
+ */
29
+ errorComponent?: (error: Error) => React.ReactNode;
30
+ }): React.ReactElement | null;
24
31
  export declare function useWidget(): WidgetProviderValue;
25
32
  export {};
26
33
  //# sourceMappingURL=WidgetProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetProvider.d.ts","sourceRoot":"","sources":["../../src/WidgetProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,SAAS,EACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,UAAU,mBAAmB;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACnC,cAAc,EAAE,iBAAiB,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CACrE;AAID,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EAAE,MAAM,EACf,QAAQ,EACR,UAAU,EACV,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACnC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC,oRA0CA;AAED,wBAAgB,SAAS,wBAMxB"}
1
+ {"version":3,"file":"WidgetProvider.d.ts","sourceRoot":"","sources":["../../src/WidgetProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EAEjB,SAAS,EACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,UAAU,mBAAmB;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACnC,cAAc,EAAE,iBAAiB,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CACrE;AAID,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EAAE,MAAM,EACf,QAAQ,EACR,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,cAAc,GACf,EAAE;IACD,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACnC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,KAAK,CAAC,SAAS,CAAC;CACpD,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAwE5B;AAED,wBAAgB,SAAS,wBAMxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ComponentRegistry.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentRegistry.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/ComponentRegistry.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=WidgetProvider.capabilities.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WidgetProvider.capabilities.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/WidgetProvider.capabilities.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=WidgetProvider.initialization.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WidgetProvider.initialization.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/WidgetProvider.initialization.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,58 @@
1
+ import { WidgetConfig, WidgetCtx, WidgetUserMessage } from '@opencx/widget-core';
2
+ import { default as React } from 'react';
3
+ import { StreamingTurnItem } from './agent-chat-stream';
4
+ import { TurnRenderSource } from './agent-turn-sources';
5
+ import { AskQuestionsRequest } from './ask-questions';
6
+ import { AgentChatPageEffect } from './useAgentChat';
7
+ /**
8
+ * Streaming state for the agent-chat surface, produced by the single
9
+ * `useAgentChat` (one useChat instance) and consumed by the message list
10
+ * (live overlay) and the shared composer (stop button + the queue pill above
11
+ * the input).
12
+ *
13
+ * On embeds whose org does not stream there is no provider, so the defaults
14
+ * below apply.
15
+ */
16
+ export type AgentChatUiValue = {
17
+ isStreaming: boolean;
18
+ liveItems: StreamingTurnItem[];
19
+ /**
20
+ * Finished turns' render sources: the transcript rows each covers and the
21
+ * streaming items that replace those rows' plain bubbles (retained live
22
+ * turns + server-fetched historical `ui_parts`).
23
+ */
24
+ turnSources: TurnRenderSource[];
25
+ /**
26
+ * The live turn's node key — stable through the retained promotion. Null
27
+ * while no turn is live or settling.
28
+ */
29
+ liveTurnKey: string | null;
30
+ /** The last turn failed — the transcript shows an error row with retry. */
31
+ turnFailed: boolean;
32
+ retryFailedTurn: () => void;
33
+ /** Messages the user queued mid-turn — rendered in the composer's queue pill. */
34
+ queuedUserMessages: WidgetUserMessage[];
35
+ /** Drop one queued (not-yet-sent) message from the pill. */
36
+ removeQueued: (messageId: string) => void;
37
+ /** Stop the live response; queued messages survive and drain next. */
38
+ stop: () => void;
39
+ /** Host-page effects normalized from the current assistant tool parts. */
40
+ pageEffects: AgentChatPageEffect[];
41
+ /**
42
+ * The clarification the agent is waiting on — the composer shows the
43
+ * questionnaire in its place — or null.
44
+ */
45
+ pendingClarification: AskQuestionsRequest | null;
46
+ };
47
+ /** Reads the agent streaming state; safe defaults when not in an agent surface. */
48
+ export declare function useAgentChatUi(): AgentChatUiValue;
49
+ /**
50
+ * WidgetProvider-owned engine mount. Non-streaming widgets get the same safe
51
+ * context interface without loading a useChat instance.
52
+ */
53
+ export declare function AgentChatProvider({ children, widgetCtx, config, }: {
54
+ children: React.ReactNode;
55
+ widgetCtx: WidgetCtx;
56
+ config: WidgetConfig;
57
+ }): React.JSX.Element;
58
+ //# sourceMappingURL=AgentChatContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentChatContext.d.ts","sourceRoot":"","sources":["../../../src/agent-chat/AgentChatContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAExE;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B;;;;OAIG;IACH,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC;;;OAGG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,2EAA2E;IAC3E,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,iFAAiF;IACjF,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IACxC,4DAA4D;IAC5D,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,sEAAsE;IACtE,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,0EAA0E;IAC1E,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC;;;OAGG;IACH,oBAAoB,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAClD,CAAC;AAkBF,mFAAmF;AACnF,wBAAgB,cAAc,IAAI,gBAAgB,CAEjD;AA6ED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,MAAM,GACP,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;CACtB,qBAaA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=WidgetProvider.agent-chat.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WidgetProvider.agent-chat.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/WidgetProvider.agent-chat.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=agent-chat-queue.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-chat-queue.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/agent-chat-queue.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=agent-chat-stream.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-chat-stream.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/agent-chat-stream.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=agent-chat-transport.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-chat-transport.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/agent-chat-transport.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=agent-turn-sources.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-turn-sources.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/agent-turn-sources.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ask-questions.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-questions.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/ask-questions.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=pending-clarification.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pending-clarification.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/pending-clarification.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=stop-agent-chat-turn.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stop-agent-chat-turn.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/stop-agent-chat-turn.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-agent-chat.client-context.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-agent-chat.client-context.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/use-agent-chat.client-context.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-agent-chat.drain-order.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-agent-chat.drain-order.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/use-agent-chat.drain-order.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-agent-chat.failed-turn.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-agent-chat.failed-turn.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/use-agent-chat.failed-turn.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-agent-chat.feature-narrowing.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-agent-chat.feature-narrowing.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/use-agent-chat.feature-narrowing.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-agent-chat.send-features.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-agent-chat.send-features.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/use-agent-chat.send-features.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-agent-chat.steer.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-agent-chat.steer.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/use-agent-chat.steer.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-agent-chat.stop-partial.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-agent-chat.stop-partial.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/use-agent-chat.stop-partial.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-agent-chat.stream-handoff.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-agent-chat.stream-handoff.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/use-agent-chat.stream-handoff.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-agent-chat.turn-retention.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-agent-chat.turn-retention.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/use-agent-chat.turn-retention.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-chat-post-finish-data-part.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-chat-post-finish-data-part.spec.d.ts","sourceRoot":"","sources":["../../../../src/agent-chat/__tests__/use-chat-post-finish-data-part.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A bounded FIFO buffer for multi-send. While an agent turn is streaming
3
+ * (useChat `status !== 'ready'`) the user's sends are queued here and drained
4
+ * one-per-turn when the turn ends — by finishing, erroring, or being stopped.
5
+ * Once accepted, an item is never displaced by a later enqueue: capacity
6
+ * rejects the newest proposal so its caller can keep the payload intact.
7
+ */
8
+ export declare class AgentChatQueue<T> {
9
+ private buffer;
10
+ /** Effective cap is at least 1. */
11
+ private readonly cap;
12
+ constructor(max: number);
13
+ get size(): number;
14
+ /** Read-only snapshot of pending items, oldest first. */
15
+ get items(): readonly T[];
16
+ /**
17
+ * Append an item when capacity permits. Returns `false` without mutating
18
+ * the accepted FIFO backlog when full.
19
+ */
20
+ enqueue(item: T): boolean;
21
+ /** Remove and return the next item (FIFO), or `null` when empty. */
22
+ dequeueNext(): T | null;
23
+ /**
24
+ * Remove and return the first item matching `predicate`, or `null` when
25
+ * nothing matches. Used by the queue pill's per-message remove button.
26
+ */
27
+ removeWhere(predicate: (item: T) => boolean): T | null;
28
+ }
29
+ //# sourceMappingURL=agent-chat-queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-chat-queue.d.ts","sourceRoot":"","sources":["../../../src/agent-chat/agent-chat-queue.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qBAAa,cAAc,CAAC,CAAC;IAC3B,OAAO,CAAC,MAAM,CAAW;IACzB,mCAAmC;IACnC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;gBAEjB,GAAG,EAAE,MAAM;IAIvB,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,yDAAyD;IACzD,IAAI,KAAK,IAAI,SAAS,CAAC,EAAE,CAExB;IAED;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO;IAMzB,oEAAoE;IACpE,WAAW,IAAI,CAAC,GAAG,IAAI;IAIvB;;;OAGG;IACH,WAAW,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GAAG,CAAC,GAAG,IAAI;CAMvD"}
@@ -0,0 +1,74 @@
1
+ import { AskQuestionsRequest } from './ask-questions';
2
+ /** One line of a turn's activity trace (reasoning or a tool call). */
3
+ export type StreamingStep = {
4
+ kind: 'reasoning' | 'tool';
5
+ /** Reasoning text, or the tool name. */
6
+ label: string;
7
+ done: boolean;
8
+ /**
9
+ * Tool steps only: the call's arguments and its result, carried straight
10
+ * off the part. Rendered only where the embedder opted in
11
+ * (`showStepToolIO`); every other surface reads the label alone, so this
12
+ * costs nothing but a reference.
13
+ */
14
+ input?: unknown;
15
+ output?: unknown;
16
+ };
17
+ /**
18
+ * The wire type `pipeJsonRender` gives the ` ```spec ` fenced JSONL patches it
19
+ * drains out of model text as typed `data-spec` UIMessage parts. The styled
20
+ * renderer assembles these into a renderable element-tree spec.
21
+ */
22
+ declare const SPEC_DATA_PART_TYPE = "data-spec";
23
+ export type SpecDataPart = {
24
+ type: typeof SPEC_DATA_PART_TYPE;
25
+ data: unknown;
26
+ };
27
+ /** One chronological render entry in an agent turn. */
28
+ export type StreamingTurnItem = {
29
+ kind: 'text';
30
+ text: string;
31
+ } | {
32
+ kind: 'steps';
33
+ steps: StreamingStep[];
34
+ } | {
35
+ kind: 'spec';
36
+ parts: SpecDataPart[];
37
+ }
38
+ /**
39
+ * A clarification the agent asked. Never rendered in the transcript: the
40
+ * NEWEST one still pending takes the composer's place instead
41
+ * (`pendingClarification`), and an answered one leaves no card behind.
42
+ */
43
+ | {
44
+ kind: 'questions';
45
+ request: AskQuestionsRequest;
46
+ };
47
+ /** The in-flight turn's render state: active + its ordered items. */
48
+ export type StreamingTurnState = {
49
+ active: boolean;
50
+ items: StreamingTurnItem[];
51
+ };
52
+ /**
53
+ * The structural surface read from live AI SDK parts and persisted `ui_parts`,
54
+ * keeping both paths behind one mapper so they cannot drift.
55
+ */
56
+ type UiPartLike = {
57
+ type: string;
58
+ text?: unknown;
59
+ state?: unknown;
60
+ data?: unknown;
61
+ toolName?: unknown;
62
+ toolCallId?: unknown;
63
+ input?: unknown;
64
+ output?: unknown;
65
+ [key: string]: unknown;
66
+ };
67
+ /** The message surface consumed by the item mapper. */
68
+ export type UiMessageLike = {
69
+ parts: ReadonlyArray<UiPartLike>;
70
+ };
71
+ /** Flatten UIMessage parts into chronological render items. */
72
+ export declare function mapUiPartsToItems(parts: ReadonlyArray<UiPartLike>): StreamingTurnItem[];
73
+ export {};
74
+ //# sourceMappingURL=agent-chat-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-chat-stream.d.ts","sourceRoot":"","sources":["../../../src/agent-chat/agent-chat-stream.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,iBAAiB,CAAC;AAEzB,sEAAsE;AACtE,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC;IAC3B,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,mBAAmB,cAAc,CAAC;AAExC,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,OAAO,mBAAmB,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAE/E,uDAAuD;AACvD,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,aAAa,EAAE,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,YAAY,EAAE,CAAA;CAAE;AACzC;;;;GAIG;GACD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAExD,qEAAqE;AACrE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B,CAAC;AAEF;;;GAGG;AACH,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,uDAAuD;AACvD,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;CAClC,CAAC;AAEF,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,GAC/B,iBAAiB,EAAE,CA0DrB"}
@@ -0,0 +1,29 @@
1
+ import { DefaultChatTransport, UIMessage } from 'ai';
2
+ /** Wiring the api layer hands the agent-chat transport (send + reconnect URLs + auth). */
3
+ export type AgentChatTransportOptions = {
4
+ /** POST endpoint that starts a turn and streams it. */
5
+ api: string;
6
+ /** Session-scoped GET the transport hits to resume an in-flight stream. */
7
+ reconnectApi: (sessionId: string) => string;
8
+ /**
9
+ * Auth headers (X-Bot-Token + Authorization), content-type stripped,
10
+ * resolved PER REQUEST: the contact JWT is minted lazily on first contact
11
+ * creation, so a snapshot taken at mount would send every stream request
12
+ * without Authorization (401) for the rest of the session.
13
+ */
14
+ headers: () => Record<string, string>;
15
+ };
16
+ /** Build the reconnect request used by `useChat` to resume a session stream. */
17
+ export declare function agentChatReconnectPreparer(options: AgentChatTransportOptions): ({ id }: {
18
+ id: string;
19
+ }) => {
20
+ api: string;
21
+ headers: Record<string, string>;
22
+ };
23
+ /**
24
+ * The AI SDK adapter for agent chat. It owns only SDK request wiring: the
25
+ * whole wire body is handed to each send (`buildSendMessageBody`) and
26
+ * forwarded as-is.
27
+ */
28
+ export declare function buildAgentChatTransport(options: AgentChatTransportOptions): DefaultChatTransport<UIMessage>;
29
+ //# sourceMappingURL=agent-chat-transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-chat-transport.d.ts","sourceRoot":"","sources":["../../../src/agent-chat/agent-chat-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,IAAI,CAAC;AAE1D,0FAA0F;AAC1F,MAAM,MAAM,yBAAyB,GAAG;IACtC,uDAAuD;IACvD,GAAG,EAAE,MAAM,CAAC;IACZ,2EAA2E;IAC3E,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C;;;;;OAKG;IACH,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,yBAAyB,IACnE,QAAQ;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;;;EAI/B;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,yBAAyB,GACjC,oBAAoB,CAAC,SAAS,CAAC,CASjC"}
@@ -0,0 +1,23 @@
1
+ import { AgentTurnMessagesDto } from '@opencx/widget-core';
2
+ import { StreamingTurnItem } from './agent-chat-stream';
3
+ /** One settled turn's transcript coverage and styled render model. */
4
+ export type TurnRenderSource = {
5
+ key: string;
6
+ turnId: string;
7
+ rowIds: string[];
8
+ items: StreamingTurnItem[];
9
+ };
10
+ /** Fold a fresh history fetch into the current list of turn render sources. */
11
+ export declare function mergeTurnSources({ existing, fetched, }: {
12
+ existing: TurnRenderSource[];
13
+ fetched: AgentTurnMessagesDto;
14
+ }): TurnRenderSource[];
15
+ /** Read the terminal turn identity emitted on a finished useChat message. */
16
+ export declare function parseTurnSettledPart(parts: ReadonlyArray<{
17
+ type: string;
18
+ data?: unknown;
19
+ }>): {
20
+ turnId: string;
21
+ rowIds: string[];
22
+ } | null;
23
+ //# sourceMappingURL=agent-turn-sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-turn-sources.d.ts","sourceRoot":"","sources":["../../../src/agent-chat/agent-turn-sources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAqB,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEhF,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B,CAAC;AAEF,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,OAAO,EAAE,oBAAoB,CAAC;CAC/B,GAAG,gBAAgB,EAAE,CAyCrB;AAQD,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GACrD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAc7C"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The `ask_questions` clarification payload.
3
+ *
4
+ * When the agent needs to narrow a request before acting it calls this tool
5
+ * instead of writing a paragraph of questions. Rendering that call as an
6
+ * ordinary tool step would show the customer raw JSON, so the stream mapper
7
+ * lifts it out of the activity trace and the styled layer renders the QUESTION
8
+ * — the same trade the companion has always made.
9
+ *
10
+ * The payload arrives in two shapes and both are accepted:
11
+ *
12
+ * 1. as the tool's INPUT — the model emits the questions in the tool-call
13
+ * chunk and the step finishes without a result, because the customer's
14
+ * reply IS the result, fed back as the next user message;
15
+ * 2. as the tool's OUTPUT — an MCP server answers with a structured response
16
+ * carrying `request_id` and per-option `{ id, label }`.
17
+ *
18
+ * The loose model-emitted shape is normalised into the strict rendered shape,
19
+ * so selection state can key off stable ids no matter which shape arrived.
20
+ */
21
+ export type AskQuestionsRequest = {
22
+ request_id: string;
23
+ questions: Array<{
24
+ id: string;
25
+ prompt: string;
26
+ selection: 'single' | 'multiple';
27
+ /**
28
+ * Chips to pick from. May be empty once the "I'll type it" restatements
29
+ * are dropped — the questionnaire then offers the free-text answer alone.
30
+ */
31
+ options: Array<{
32
+ id: string;
33
+ label: string;
34
+ }>;
35
+ }>;
36
+ };
37
+ /** Matches the bare name and any MCP-prefixed form (`mcp__opencx__ask_questions`). */
38
+ export declare function isAskQuestionsToolName(toolName: string | undefined): boolean;
39
+ /**
40
+ * Parses a clarification request from a tool part's output or input. Returns
41
+ * `null` on anything unrecognised — a malformed payload must fall back to the
42
+ * ordinary step rendering, never blank the turn or throw inside the stream.
43
+ */
44
+ export declare function parseAskQuestionsPayload(payload: unknown, fallbackRequestId?: string): AskQuestionsRequest | null;
45
+ /**
46
+ * The single combined message sent back when the customer submits. One
47
+ * `Q:`/`A:` block per answered question keeps the mapping explicit for the
48
+ * agent reading it as an ordinary user turn.
49
+ */
50
+ export declare function formatAskQuestionsAnswers(request: AskQuestionsRequest, answersByQuestionId: ReadonlyMap<string, string>): string;
51
+ //# sourceMappingURL=ask-questions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-questions.d.ts","sourceRoot":"","sources":["../../../src/agent-chat/ask-questions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,KAAK,CAAC;QACf,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,QAAQ,GAAG,UAAU,CAAC;QACjC;;;WAGG;QACH,OAAO,EAAE,KAAK,CAAC;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC/C,CAAC,CAAC;CACJ,CAAC;AAmBF,sFAAsF;AACtF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAE5E;AA2ED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,iBAAiB,CAAC,EAAE,MAAM,GACzB,mBAAmB,GAAG,IAAI,CAK5B;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,mBAAmB,EAC5B,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/C,MAAM,CAQR"}
@@ -0,0 +1,27 @@
1
+ import { StreamingTurnItem } from './agent-chat-stream';
2
+ import { AskQuestionsRequest } from './ask-questions';
3
+ import { TurnRenderSource } from './agent-turn-sources';
4
+ /**
5
+ * The clarification the agent is currently WAITING on, or `null`.
6
+ *
7
+ * A pending clarification replaces the composer, so this answers "should the
8
+ * customer be picking an option instead of typing?" — not merely "was a
9
+ * question asked at some point". Three rules decide it, and each one exists
10
+ * because of how the answer is delivered (as an ordinary user message):
11
+ *
12
+ * - Nothing while the turn is still streaming. The agent may yet ask again,
13
+ * and chips rendered mid-stream look clickable while the answer they would
14
+ * send is about to be superseded.
15
+ * - The NEWEST questionnaire wins — the live turn's over any settled turn's,
16
+ * and the last of several within one turn.
17
+ * - Nothing once the customer has spoken since. Their reply IS the answer, so
18
+ * a questionnaire still on screen after it would collect a second one.
19
+ */
20
+ export declare function pendingClarification({ turnSources, liveItems, isStreaming, lastMessageIsFromUser, }: {
21
+ turnSources: ReadonlyArray<Pick<TurnRenderSource, 'items'>>;
22
+ liveItems: ReadonlyArray<StreamingTurnItem>;
23
+ isStreaming: boolean;
24
+ /** The transcript's last row is the customer's — they have already answered. */
25
+ lastMessageIsFromUser: boolean;
26
+ }): AskQuestionsRequest | null;
27
+ //# sourceMappingURL=pending-clarification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pending-clarification.d.ts","sourceRoot":"","sources":["../../../src/agent-chat/pending-clarification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,WAAW,EACX,SAAS,EACT,WAAW,EACX,qBAAqB,GACtB,EAAE;IACD,WAAW,EAAE,aAAa,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5D,SAAS,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC5C,WAAW,EAAE,OAAO,CAAC;IACrB,gFAAgF;IAChF,qBAAqB,EAAE,OAAO,CAAC;CAChC,GAAG,mBAAmB,GAAG,IAAI,CAS7B"}