@stigmer/react 3.6.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. package/billing/CreditLedgerTable.d.ts.map +1 -1
  2. package/billing/CreditLedgerTable.js +2 -7
  3. package/billing/CreditLedgerTable.js.map +1 -1
  4. package/channel/AgentChannelsPanel.d.ts.map +1 -1
  5. package/channel/AgentChannelsPanel.js +21 -2
  6. package/channel/AgentChannelsPanel.js.map +1 -1
  7. package/channel/ChannelConversationsDialog.d.ts +12 -4
  8. package/channel/ChannelConversationsDialog.d.ts.map +1 -1
  9. package/channel/ChannelConversationsDialog.js +18 -24
  10. package/channel/ChannelConversationsDialog.js.map +1 -1
  11. package/channel/providers.d.ts +23 -0
  12. package/channel/providers.d.ts.map +1 -1
  13. package/channel/providers.js +4 -0
  14. package/channel/providers.js.map +1 -1
  15. package/channel/useSaveAgentChannel.d.ts +5 -4
  16. package/channel/useSaveAgentChannel.d.ts.map +1 -1
  17. package/channel/useSaveAgentChannel.js +18 -4
  18. package/channel/useSaveAgentChannel.js.map +1 -1
  19. package/composer/ComposerToolbar.d.ts +6 -1
  20. package/composer/ComposerToolbar.d.ts.map +1 -1
  21. package/composer/ComposerToolbar.js +2 -2
  22. package/composer/ComposerToolbar.js.map +1 -1
  23. package/composer/SessionComposer.d.ts +9 -0
  24. package/composer/SessionComposer.d.ts.map +1 -1
  25. package/composer/SessionComposer.js +13 -2
  26. package/composer/SessionComposer.js.map +1 -1
  27. package/conversation/ConversationAttentionBanner.d.ts +22 -0
  28. package/conversation/ConversationAttentionBanner.d.ts.map +1 -0
  29. package/conversation/ConversationAttentionBanner.js +25 -0
  30. package/conversation/ConversationAttentionBanner.js.map +1 -0
  31. package/conversation/ConversationComposer.d.ts +41 -0
  32. package/conversation/ConversationComposer.d.ts.map +1 -0
  33. package/conversation/ConversationComposer.js +57 -0
  34. package/conversation/ConversationComposer.js.map +1 -0
  35. package/conversation/ConversationControlBanner.d.ts +52 -0
  36. package/conversation/ConversationControlBanner.d.ts.map +1 -0
  37. package/conversation/ConversationControlBanner.js +59 -0
  38. package/conversation/ConversationControlBanner.js.map +1 -0
  39. package/conversation/ConversationListPane.d.ts +68 -0
  40. package/conversation/ConversationListPane.d.ts.map +1 -0
  41. package/conversation/ConversationListPane.js +120 -0
  42. package/conversation/ConversationListPane.js.map +1 -0
  43. package/conversation/ConversationTimelineView.d.ts +46 -0
  44. package/conversation/ConversationTimelineView.d.ts.map +1 -0
  45. package/conversation/ConversationTimelineView.js +166 -0
  46. package/conversation/ConversationTimelineView.js.map +1 -0
  47. package/conversation/ConversationsWorkbench.d.ts +63 -0
  48. package/conversation/ConversationsWorkbench.d.ts.map +1 -0
  49. package/conversation/ConversationsWorkbench.js +165 -0
  50. package/conversation/ConversationsWorkbench.js.map +1 -0
  51. package/conversation/conversationPresentation.d.ts +137 -0
  52. package/conversation/conversationPresentation.d.ts.map +1 -0
  53. package/conversation/conversationPresentation.js +230 -0
  54. package/conversation/conversationPresentation.js.map +1 -0
  55. package/conversation/index.d.ts +26 -0
  56. package/conversation/index.d.ts.map +1 -0
  57. package/conversation/index.js +14 -0
  58. package/conversation/index.js.map +1 -0
  59. package/conversation/polling.d.ts +39 -0
  60. package/conversation/polling.d.ts.map +1 -0
  61. package/conversation/polling.js +39 -0
  62. package/conversation/polling.js.map +1 -0
  63. package/conversation/useConversation.d.ts +61 -0
  64. package/conversation/useConversation.d.ts.map +1 -0
  65. package/conversation/useConversation.js +153 -0
  66. package/conversation/useConversation.js.map +1 -0
  67. package/conversation/useConversationList.d.ts +98 -0
  68. package/conversation/useConversationList.d.ts.map +1 -0
  69. package/conversation/useConversationList.js +200 -0
  70. package/conversation/useConversationList.js.map +1 -0
  71. package/conversation/useConversationParticipation.d.ts +63 -0
  72. package/conversation/useConversationParticipation.d.ts.map +1 -0
  73. package/conversation/useConversationParticipation.js +84 -0
  74. package/conversation/useConversationParticipation.js.map +1 -0
  75. package/conversation/useConversationTimeline.d.ts +71 -0
  76. package/conversation/useConversationTimeline.d.ts.map +1 -0
  77. package/conversation/useConversationTimeline.js +152 -0
  78. package/conversation/useConversationTimeline.js.map +1 -0
  79. package/conversation/useConversationsWantsHumanCount.d.ts +42 -0
  80. package/conversation/useConversationsWantsHumanCount.d.ts.map +1 -0
  81. package/conversation/useConversationsWantsHumanCount.js +40 -0
  82. package/conversation/useConversationsWantsHumanCount.js.map +1 -0
  83. package/execution/useCreateAgentExecution.d.ts +14 -0
  84. package/execution/useCreateAgentExecution.d.ts.map +1 -1
  85. package/execution/useCreateAgentExecution.js +5 -0
  86. package/execution/useCreateAgentExecution.js.map +1 -1
  87. package/index.d.ts +6 -2
  88. package/index.d.ts.map +1 -1
  89. package/index.js +14 -5
  90. package/index.js.map +1 -1
  91. package/internal/Pagination.d.ts +15 -0
  92. package/internal/Pagination.d.ts.map +1 -0
  93. package/internal/Pagination.js +20 -0
  94. package/internal/Pagination.js.map +1 -0
  95. package/internal/tooltip.d.ts.map +1 -1
  96. package/internal/tooltip.js +7 -1
  97. package/internal/tooltip.js.map +1 -1
  98. package/internal/useAutoScroll.d.ts +25 -4
  99. package/internal/useAutoScroll.d.ts.map +1 -1
  100. package/internal/useAutoScroll.js +55 -15
  101. package/internal/useAutoScroll.js.map +1 -1
  102. package/internal/useFetch.d.ts.map +1 -1
  103. package/internal/useFetch.js +14 -4
  104. package/internal/useFetch.js.map +1 -1
  105. package/models/ModelSelector.d.ts +45 -1
  106. package/models/ModelSelector.d.ts.map +1 -1
  107. package/models/ModelSelector.js +49 -6
  108. package/models/ModelSelector.js.map +1 -1
  109. package/models/index.d.ts +2 -0
  110. package/models/index.d.ts.map +1 -1
  111. package/models/index.js +1 -0
  112. package/models/index.js.map +1 -1
  113. package/models/registry.d.ts +11 -0
  114. package/models/registry.d.ts.map +1 -1
  115. package/models/registry.js +3 -0
  116. package/models/registry.js.map +1 -1
  117. package/models/service-tier.d.ts +27 -0
  118. package/models/service-tier.d.ts.map +1 -0
  119. package/models/service-tier.js +34 -0
  120. package/models/service-tier.js.map +1 -0
  121. package/package.json +4 -4
  122. package/schedule/ScheduleDetailView.d.ts +31 -8
  123. package/schedule/ScheduleDetailView.d.ts.map +1 -1
  124. package/schedule/ScheduleDetailView.js +441 -29
  125. package/schedule/ScheduleDetailView.js.map +1 -1
  126. package/schedule/ScheduleForm.d.ts +7 -4
  127. package/schedule/ScheduleForm.d.ts.map +1 -1
  128. package/schedule/ScheduleForm.js +94 -8
  129. package/schedule/ScheduleForm.js.map +1 -1
  130. package/schedule/ScheduleRunsTable.d.ts +72 -0
  131. package/schedule/ScheduleRunsTable.d.ts.map +1 -0
  132. package/schedule/ScheduleRunsTable.js +161 -0
  133. package/schedule/ScheduleRunsTable.js.map +1 -0
  134. package/schedule/index.d.ts +6 -0
  135. package/schedule/index.d.ts.map +1 -1
  136. package/schedule/index.js +3 -0
  137. package/schedule/index.js.map +1 -1
  138. package/schedule/useScheduleRuns.d.ts +44 -0
  139. package/schedule/useScheduleRuns.d.ts.map +1 -0
  140. package/schedule/useScheduleRuns.js +48 -0
  141. package/schedule/useScheduleRuns.js.map +1 -0
  142. package/schedule/useTriggerSchedule.d.ts +23 -10
  143. package/schedule/useTriggerSchedule.d.ts.map +1 -1
  144. package/schedule/useTriggerSchedule.js +28 -9
  145. package/schedule/useTriggerSchedule.js.map +1 -1
  146. package/schedule/useUpdateScheduleSpec.d.ts +49 -0
  147. package/schedule/useUpdateScheduleSpec.d.ts.map +1 -0
  148. package/schedule/useUpdateScheduleSpec.js +70 -0
  149. package/schedule/useUpdateScheduleSpec.js.map +1 -0
  150. package/session/useNewSessionFlow.d.ts.map +1 -1
  151. package/session/useNewSessionFlow.js +1 -0
  152. package/session/useNewSessionFlow.js.map +1 -1
  153. package/session/useSessionConversation.d.ts +11 -0
  154. package/session/useSessionConversation.d.ts.map +1 -1
  155. package/session/useSessionConversation.js +1 -0
  156. package/session/useSessionConversation.js.map +1 -1
  157. package/session/useSessionPageFlow.d.ts.map +1 -1
  158. package/session/useSessionPageFlow.js +1 -0
  159. package/session/useSessionPageFlow.js.map +1 -1
  160. package/sharing/useSaveAgentShare.d.ts +10 -1
  161. package/sharing/useSaveAgentShare.d.ts.map +1 -1
  162. package/sharing/useSaveAgentShare.js +9 -0
  163. package/sharing/useSaveAgentShare.js.map +1 -1
  164. package/sidebar/WorkspaceSidebar.d.ts +12 -4
  165. package/sidebar/WorkspaceSidebar.d.ts.map +1 -1
  166. package/sidebar/WorkspaceSidebar.js +19 -7
  167. package/sidebar/WorkspaceSidebar.js.map +1 -1
  168. package/src/billing/CreditLedgerTable.tsx +3 -42
  169. package/src/channel/AgentChannelsPanel.tsx +33 -2
  170. package/src/channel/ChannelConversationsDialog.tsx +22 -25
  171. package/src/channel/__tests__/AgentChannelsPanel.test.tsx +36 -5
  172. package/src/channel/__tests__/ChannelConversationsDialog.test.tsx +38 -1
  173. package/src/channel/__tests__/useSaveAgentChannel.test.tsx +26 -0
  174. package/src/channel/providers.ts +27 -0
  175. package/src/channel/useSaveAgentChannel.ts +18 -4
  176. package/src/composer/ComposerToolbar.tsx +9 -0
  177. package/src/composer/SessionComposer.tsx +24 -1
  178. package/src/composer/__tests__/SessionComposer-serviceTier.test.tsx +157 -0
  179. package/src/conversation/ConversationAttentionBanner.tsx +77 -0
  180. package/src/conversation/ConversationComposer.tsx +156 -0
  181. package/src/conversation/ConversationControlBanner.tsx +193 -0
  182. package/src/conversation/ConversationListPane.tsx +459 -0
  183. package/src/conversation/ConversationTimelineView.tsx +435 -0
  184. package/src/conversation/ConversationsWorkbench.tsx +378 -0
  185. package/src/conversation/__tests__/ConversationAttentionBanner.test.tsx +82 -0
  186. package/src/conversation/__tests__/ConversationComposer.test.tsx +160 -0
  187. package/src/conversation/__tests__/ConversationControlBanner.test.tsx +190 -0
  188. package/src/conversation/__tests__/ConversationListPane.test.tsx +372 -0
  189. package/src/conversation/__tests__/ConversationTimelineView.layout.test.tsx +160 -0
  190. package/src/conversation/__tests__/ConversationTimelineView.test.tsx +405 -0
  191. package/src/conversation/__tests__/ConversationsWorkbench.test.tsx +860 -0
  192. package/src/conversation/__tests__/a11y/conversation-surfaces.a11y.test.tsx +235 -0
  193. package/src/conversation/__tests__/a11y/harness.tsx +100 -0
  194. package/src/conversation/__tests__/conversation-tooltips.layout.test.tsx +167 -0
  195. package/src/conversation/__tests__/conversationPollingComposition.test.tsx +138 -0
  196. package/src/conversation/__tests__/conversationPresentation.test.ts +289 -0
  197. package/src/conversation/__tests__/useConversation.test.tsx +243 -0
  198. package/src/conversation/__tests__/useConversationList.test.tsx +492 -0
  199. package/src/conversation/__tests__/useConversationParticipation.test.tsx +190 -0
  200. package/src/conversation/__tests__/useConversationTimeline.test.tsx +258 -0
  201. package/src/conversation/__tests__/useConversationsWantsHumanCount.test.tsx +102 -0
  202. package/src/conversation/conversationPresentation.ts +305 -0
  203. package/src/conversation/index.ts +80 -0
  204. package/src/conversation/polling.ts +41 -0
  205. package/src/conversation/useConversation.ts +221 -0
  206. package/src/conversation/useConversationList.ts +328 -0
  207. package/src/conversation/useConversationParticipation.ts +178 -0
  208. package/src/conversation/useConversationTimeline.ts +244 -0
  209. package/src/conversation/useConversationsWantsHumanCount.ts +86 -0
  210. package/src/execution/useCreateAgentExecution.ts +18 -0
  211. package/src/index.ts +76 -4
  212. package/src/internal/Pagination.tsx +72 -0
  213. package/src/internal/__tests__/fake-timer-slices.ts +29 -0
  214. package/src/internal/__tests__/useAutoScroll.layout.test.tsx +143 -0
  215. package/src/internal/__tests__/useAutoScroll.test.tsx +62 -5
  216. package/src/internal/__tests__/useFetch-poll-under-render-pressure.test.tsx +79 -0
  217. package/src/internal/tooltip.tsx +6 -1
  218. package/src/internal/useAutoScroll.ts +66 -20
  219. package/src/internal/useFetch.ts +15 -4
  220. package/src/models/ModelSelector.tsx +133 -4
  221. package/src/models/__tests__/ModelSelector-serviceTier.test.tsx +256 -0
  222. package/src/models/__tests__/useModelRegistry.test.tsx +15 -0
  223. package/src/models/index.ts +2 -0
  224. package/src/models/registry.ts +17 -0
  225. package/src/models/service-tier.ts +49 -0
  226. package/src/schedule/ScheduleDetailView.tsx +1179 -111
  227. package/src/schedule/ScheduleForm.tsx +218 -7
  228. package/src/schedule/ScheduleRunsTable.tsx +424 -0
  229. package/src/schedule/__tests__/ScheduleDetailView.test.tsx +431 -8
  230. package/src/schedule/__tests__/scheduleCreation.test.tsx +197 -0
  231. package/src/schedule/__tests__/scheduleHooks.test.tsx +94 -7
  232. package/src/schedule/index.ts +12 -0
  233. package/src/schedule/useScheduleRuns.ts +93 -0
  234. package/src/schedule/useTriggerSchedule.ts +39 -14
  235. package/src/schedule/useUpdateScheduleSpec.ts +108 -0
  236. package/src/session/useNewSessionFlow.ts +1 -0
  237. package/src/session/useSessionConversation.ts +12 -0
  238. package/src/session/useSessionPageFlow.ts +1 -0
  239. package/src/sharing/__tests__/useSaveAgentShare.test.tsx +55 -1
  240. package/src/sharing/__tests__/useShareToolReadiness.test.tsx +1 -0
  241. package/src/sharing/useSaveAgentShare.ts +19 -1
  242. package/src/sidebar/WorkspaceSidebar.tsx +62 -3
  243. package/src/sidebar/__tests__/WorkspaceSidebar.test.tsx +56 -1
  244. package/src/workflow/__tests__/inspector-forms.test.tsx +119 -2
  245. package/src/workflow/inspector/forms/AgentCallForm.tsx +260 -37
  246. package/src/workflow/inspector/tabs/RuntimeTab.tsx +72 -33
  247. package/src/workflow/starter-workflow-yaml.ts +2 -1
  248. package/styles.css +1 -1
  249. package/workflow/inspector/forms/AgentCallForm.d.ts +18 -2
  250. package/workflow/inspector/forms/AgentCallForm.d.ts.map +1 -1
  251. package/workflow/inspector/forms/AgentCallForm.js +87 -9
  252. package/workflow/inspector/forms/AgentCallForm.js.map +1 -1
  253. package/workflow/inspector/tabs/RuntimeTab.d.ts +2 -1
  254. package/workflow/inspector/tabs/RuntimeTab.d.ts.map +1 -1
  255. package/workflow/inspector/tabs/RuntimeTab.js +31 -5
  256. package/workflow/inspector/tabs/RuntimeTab.js.map +1 -1
  257. package/workflow/starter-workflow-yaml.d.ts +1 -1
  258. package/workflow/starter-workflow-yaml.d.ts.map +1 -1
  259. package/workflow/starter-workflow-yaml.js +2 -1
  260. package/workflow/starter-workflow-yaml.js.map +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConversationsWorkbench.js","sourceRoot":"","sources":["../../src/conversation/ConversationsWorkbench.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,OAAO,EACL,6BAA6B,GAE9B,MAAM,uEAAuE,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kEAAkE,CAAC;AACtG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAA6B,MAAM,2BAA2B,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,4BAA4B,E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OAAO,CAAC,IAAI,cAAc,KAAK,IAAI,EAEvE,cAAc,EAAE,sBAAsB,EACtC,QAAQ,EAAE,gBAAgB,GAC1B,KAlEG,GAAG,QAAQ,CAAC,cAAc,IAAI,QAAQ,CAAC,eAAe,EAAE,CAmEzD,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,137 @@
1
+ import { type ChannelConversation, type ConversationTimelineItem } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/conversation_io_pb";
2
+ import type { ChannelProviderId } from "../channel/providers.js";
3
+ /**
4
+ * Pure render vocabulary for the conversation surface — the single place
5
+ * the wire enums become words and layout facts (the providerPresentation
6
+ * convention). No React, no I/O; every component and every test reads the
7
+ * same mapping.
8
+ */
9
+ /** Who authored a timeline item, in render vocabulary. */
10
+ export type ConversationAuthorKind = "customer" | "agent" | "teammate" | "platform" | "unknown";
11
+ /** Map the wire author onto the render vocabulary. */
12
+ export declare function authorKindOf(item: ConversationTimelineItem): ConversationAuthorKind;
13
+ /** True for org-internal items (escalations, attention clears, notes). */
14
+ export declare function isInternalItem(item: ConversationTimelineItem): boolean;
15
+ /**
16
+ * The platform's own send attempt, in render vocabulary. `null` on items
17
+ * that carry no attempt (inbound messages, internal events).
18
+ *
19
+ * `"suppressed"` and `"failed"` are items the customer NEVER saw and
20
+ * `"pending"`/`"delivering"` are items the customer has not seen YET —
21
+ * a renderer that shows any of them as a plain sent bubble lies to staff.
22
+ */
23
+ export type SendAttemptKind = "pending" | "delivering" | "delivered" | "failed" | "suppressed";
24
+ /** Map the wire delivery status onto the render vocabulary. */
25
+ export declare function sendAttemptOf(item: ConversationTimelineItem): SendAttemptKind | null;
26
+ /**
27
+ * The provider's receipt report, in render vocabulary. `null` until the
28
+ * provider reports (and always on items with no receipt axis).
29
+ *
30
+ * A SECOND axis beside {@link sendAttemptOf}, never collapsed into it
31
+ * (channel-conversations DD-004 D-d): "we handed it to WhatsApp" and
32
+ * "it reached the phone" are different facts — an item can be
33
+ * `delivered` + `receipt_failed`.
34
+ */
35
+ export type ReceiptKind = "sent" | "delivered" | "read" | "failed";
36
+ /** Map the wire receipt state onto the render vocabulary. */
37
+ export declare function receiptOf(item: ConversationTimelineItem): ReceiptKind | null;
38
+ /**
39
+ * Placeholder copy for inbound items whose body the platform cannot
40
+ * render (`text` empty, `provider_message_type` names the kind). Media
41
+ * retrieval is a named non-goal of this surface — the placeholder tells
42
+ * staff something arrived and what shape it was.
43
+ *
44
+ * Returns `null` when the item needs no placeholder (it has text, or it
45
+ * is not a provider-typed inbound item — e.g. an attention-clear event,
46
+ * whose copy is the renderer's own vocabulary).
47
+ */
48
+ export declare function inboundPlaceholderOf(item: ConversationTimelineItem): string | null;
49
+ /**
50
+ * The list-row label for a conversation: the provider-reported display
51
+ * name when one exists, else a provider-aware fallback.
52
+ *
53
+ * The fallback is provider-aware because conversation keys are not
54
+ * uniformly meaningful: WhatsApp's key is the customer's phone number
55
+ * (a real label), while Slack's key is a thread timestamp like
56
+ * `1723012345.678900` (noise a human cannot use).
57
+ */
58
+ export declare function conversationLabelOf(conversation: ChannelConversation, provider: ChannelProviderId | null): string;
59
+ /**
60
+ * The customer's reachable address, when the label hides it: the fact a
61
+ * staffer needs to call or message the customer outside the platform.
62
+ *
63
+ * Provider-aware like {@link conversationLabelOf}, because conversation
64
+ * keys are not uniformly addresses: WhatsApp's key IS the customer's
65
+ * phone number (the wa_id), and when a display name wins the label slot
66
+ * that number would otherwise appear nowhere on the surface. Slack's
67
+ * key is a thread timestamp — not a way to reach anyone — so there is
68
+ * nothing to show. Unknown providers show nothing rather than guess.
69
+ *
70
+ * Returns `null` when the label already shows the key (no display
71
+ * name), so the same fact never renders twice. The key returns
72
+ * verbatim — no fabricated `+` prefix: the wire value is the truth this
73
+ * module reports, and formatting belongs to hosts that know their
74
+ * display rules.
75
+ */
76
+ export declare function conversationContactOf(conversation: ChannelConversation, provider: ChannelProviderId | null): string | null;
77
+ /** The service-window estimate, in render vocabulary. */
78
+ export type ServiceWindowState = "open" | "closed";
79
+ /**
80
+ * Estimate whether the provider's free-form reply window is open
81
+ * (channel-conversations DD-014 D-a). Provider-aware like
82
+ * {@link conversationLabelOf}: WhatsApp is the only windowed provider, so
83
+ * every other provider answers `null` — no window, no claim — as does a
84
+ * conversation whose customer has never written
85
+ * (`last_customer_message_at` unset; that conversation takes the
86
+ * composer's disabled branch instead).
87
+ *
88
+ * Client-derived on purpose, and NOT a divergence from DD-011 A-1's
89
+ * "the predicate is expressed once, in SQL" rule: the window is
90
+ * wall-clock-anchored — it flips with NO row change — so a
91
+ * server-computed boolean would be stale by construction between polls.
92
+ * Time-decaying presentation derived from wire instants is this
93
+ * surface's established class (relative timestamps, day grouping).
94
+ *
95
+ * Honesty caveat (DD-014 D-a): the anchor is the platform's receipt
96
+ * instant, minutes AFTER Meta's own clock started the window, so the
97
+ * estimate can claim "open" briefly after Meta closed it — which is why
98
+ * consumers warn and never block (D-b). For the same reason the exact
99
+ * 24-hour tie reads "closed": erring a moment early offsets an anchor
100
+ * that always errs late.
101
+ */
102
+ export declare function serviceWindowOf(conversation: ChannelConversation, provider: ChannelProviderId | null, now: Date): ServiceWindowState | null;
103
+ /**
104
+ * How strongly the awaiting-reply indicator renders. Two strengths, not
105
+ * one, because "waiting" means different things per holder (DD-011 D-a).
106
+ */
107
+ export type AwaitingIndicator = "strong" | "muted";
108
+ /**
109
+ * The awaiting-reply indicator for a conversation (channel-conversations
110
+ * DD-011 D-a): `"strong"` when a human holds it — the agent will not
111
+ * answer, so a person must (F-13's exact case) — and `"muted"` when the
112
+ * agent holds it: the agent is about to answer, and if its turn dies the
113
+ * conversation stays visibly waiting, which is the built-in recovery
114
+ * path (DD-011 D-b). `null` when the customer's last message has been
115
+ * answered (or the customer has not written).
116
+ *
117
+ * The fact itself is server-derived (`awaiting_reply` rides the wire as
118
+ * a boolean precisely so no client re-implements the NULL-and-compare
119
+ * rule); this helper only maps fact × holder onto render strength.
120
+ */
121
+ export declare function awaitingIndicatorOf(conversation: ChannelConversation): AwaitingIndicator | null;
122
+ /**
123
+ * The timeline item id an accepted staff reply appears under: the
124
+ * outbound ledger's `ob:` namespace over the reply output's
125
+ * `outbound_message_id` — the contract
126
+ * `useConversationParticipation.reply` documents ("the item will
127
+ * appear on the timeline as `ob:<that id>`"). The workbench's
128
+ * post-send busy state watches for exactly this id (F-05).
129
+ */
130
+ export declare function outboundItemIdOf(outboundMessageId: string): string;
131
+ /**
132
+ * Newest-first timeline order: `(at, item_id)` descending — the exact
133
+ * comparator the server pages with, so client-side merges can never
134
+ * disagree with server pages about order.
135
+ */
136
+ export declare function compareTimelineItemsNewestFirst(a: ConversationTimelineItem, b: ConversationTimelineItem): number;
137
+ //# sourceMappingURL=conversationPresentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversationPresentation.d.ts","sourceRoot":"","sources":["../../src/conversation/conversationPresentation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,mBAAmB,EAIxB,KAAK,wBAAwB,EAC9B,MAAM,uEAAuE,CAAC;AAG/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;;;GAKG;AAEH,0DAA0D;AAC1D,MAAM,MAAM,sBAAsB,GAC9B,UAAU,GACV,OAAO,GACP,UAAU,GACV,UAAU,GACV,SAAS,CAAC;AAEd,sDAAsD;AACtD,wBAAgB,YAAY,CAAC,IAAI,EAAE,wBAAwB,GAAG,sBAAsB,CAanF;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAEtE;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,YAAY,CAAC;AAEjB,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,IAAI,EAAE,wBAAwB,GAAG,eAAe,GAAG,IAAI,CAepF;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GA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uthor, ConversationLane, } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/conversation_io_pb";
3
+ import { ChannelDeliveryStatus } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/delivery_pb";
4
+ import { ChannelReceiptState } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/outbound_pb";
5
+ /** Map the wire author onto the render vocabulary. */
6
+ export function authorKindOf(item) {
7
+ switch (item.author) {
8
+ case ConversationItemAuthor.author_customer:
9
+ return "customer";
10
+ case ConversationItemAuthor.author_agent:
11
+ return "agent";
12
+ case ConversationItemAuthor.author_teammate:
13
+ return "teammate";
14
+ case ConversationItemAuthor.author_platform:
15
+ return "platform";
16
+ default:
17
+ return "unknown";
18
+ }
19
+ }
20
+ /** True for org-internal items (escalations, attention clears, notes). */
21
+ export function isInternalItem(item) {
22
+ return item.lane === ConversationLane.lane_internal;
23
+ }
24
+ /** Map the wire delivery status onto the render vocabulary. */
25
+ export function sendAttemptOf(item) {
26
+ switch (item.deliveryStatus) {
27
+ case ChannelDeliveryStatus.pending:
28
+ return "pending";
29
+ case ChannelDeliveryStatus.delivering:
30
+ return "delivering";
31
+ case ChannelDeliveryStatus.delivered:
32
+ return "delivered";
33
+ case ChannelDeliveryStatus.failed:
34
+ return "failed";
35
+ case ChannelDeliveryStatus.suppressed:
36
+ return "suppressed";
37
+ default:
38
+ return null;
39
+ }
40
+ }
41
+ /** Map the wire receipt state onto the render vocabulary. */
42
+ export function receiptOf(item) {
43
+ switch (item.receiptState) {
44
+ case ChannelReceiptState.receipt_sent:
45
+ return "sent";
46
+ case ChannelReceiptState.receipt_delivered:
47
+ return "delivered";
48
+ case ChannelReceiptState.receipt_read:
49
+ return "read";
50
+ case ChannelReceiptState.receipt_failed:
51
+ return "failed";
52
+ default:
53
+ return null;
54
+ }
55
+ }
56
+ /**
57
+ * Placeholder copy for inbound items whose body the platform cannot
58
+ * render (`text` empty, `provider_message_type` names the kind). Media
59
+ * retrieval is a named non-goal of this surface — the placeholder tells
60
+ * staff something arrived and what shape it was.
61
+ *
62
+ * Returns `null` when the item needs no placeholder (it has text, or it
63
+ * is not a provider-typed inbound item — e.g. an attention-clear event,
64
+ * whose copy is the renderer's own vocabulary).
65
+ */
66
+ export function inboundPlaceholderOf(item) {
67
+ if (item.text !== "" || item.providerMessageType === "")
68
+ return null;
69
+ switch (item.providerMessageType) {
70
+ case "text":
71
+ return null;
72
+ case "image":
73
+ return "Photo";
74
+ case "video":
75
+ return "Video";
76
+ case "audio":
77
+ return "Voice message";
78
+ case "document":
79
+ return "Document";
80
+ case "sticker":
81
+ return "Sticker";
82
+ case "location":
83
+ return "Location";
84
+ case "contacts":
85
+ return "Contact card";
86
+ default:
87
+ // The provider's vocabulary passes through verbatim (never
88
+ // re-encoded), so an unknown kind still names itself.
89
+ return `Unsupported message (${item.providerMessageType})`;
90
+ }
91
+ }
92
+ /**
93
+ * The list-row label for a conversation: the provider-reported display
94
+ * name when one exists, else a provider-aware fallback.
95
+ *
96
+ * The fallback is provider-aware because conversation keys are not
97
+ * uniformly meaningful: WhatsApp's key is the customer's phone number
98
+ * (a real label), while Slack's key is a thread timestamp like
99
+ * `1723012345.678900` (noise a human cannot use).
100
+ */
101
+ export function conversationLabelOf(conversation, provider) {
102
+ if (conversation.displayName !== "")
103
+ return conversation.displayName;
104
+ if (provider === "slack")
105
+ return "Slack thread";
106
+ return conversation.conversationKey;
107
+ }
108
+ /**
109
+ * The customer's reachable address, when the label hides it: the fact a
110
+ * staffer needs to call or message the customer outside the platform.
111
+ *
112
+ * Provider-aware like {@link conversationLabelOf}, because conversation
113
+ * keys are not uniformly addresses: WhatsApp's key IS the customer's
114
+ * phone number (the wa_id), and when a display name wins the label slot
115
+ * that number would otherwise appear nowhere on the surface. Slack's
116
+ * key is a thread timestamp — not a way to reach anyone — so there is
117
+ * nothing to show. Unknown providers show nothing rather than guess.
118
+ *
119
+ * Returns `null` when the label already shows the key (no display
120
+ * name), so the same fact never renders twice. The key returns
121
+ * verbatim — no fabricated `+` prefix: the wire value is the truth this
122
+ * module reports, and formatting belongs to hosts that know their
123
+ * display rules.
124
+ */
125
+ export function conversationContactOf(conversation, provider) {
126
+ if (provider !== "whatsapp")
127
+ return null;
128
+ if (conversation.displayName === "")
129
+ return null;
130
+ return conversation.conversationKey;
131
+ }
132
+ /**
133
+ * Meta's customer-service window: a business can send free-form WhatsApp
134
+ * messages for 24 hours after the customer's last inbound message; after
135
+ * that, only template messages deliver. The constant lives beside its
136
+ * only consumer and is promoted to `ChannelProviderDescriptor` only if a
137
+ * second windowed provider ever appears (the second-sighting rule,
138
+ * DD-014 D-a).
139
+ */
140
+ const WHATSAPP_SERVICE_WINDOW_MS = 24 * 60 * 60 * 1000;
141
+ /**
142
+ * Estimate whether the provider's free-form reply window is open
143
+ * (channel-conversations DD-014 D-a). Provider-aware like
144
+ * {@link conversationLabelOf}: WhatsApp is the only windowed provider, so
145
+ * every other provider answers `null` — no window, no claim — as does a
146
+ * conversation whose customer has never written
147
+ * (`last_customer_message_at` unset; that conversation takes the
148
+ * composer's disabled branch instead).
149
+ *
150
+ * Client-derived on purpose, and NOT a divergence from DD-011 A-1's
151
+ * "the predicate is expressed once, in SQL" rule: the window is
152
+ * wall-clock-anchored — it flips with NO row change — so a
153
+ * server-computed boolean would be stale by construction between polls.
154
+ * Time-decaying presentation derived from wire instants is this
155
+ * surface's established class (relative timestamps, day grouping).
156
+ *
157
+ * Honesty caveat (DD-014 D-a): the anchor is the platform's receipt
158
+ * instant, minutes AFTER Meta's own clock started the window, so the
159
+ * estimate can claim "open" briefly after Meta closed it — which is why
160
+ * consumers warn and never block (D-b). For the same reason the exact
161
+ * 24-hour tie reads "closed": erring a moment early offsets an anchor
162
+ * that always errs late.
163
+ */
164
+ export function serviceWindowOf(conversation, provider, now) {
165
+ if (provider !== "whatsapp")
166
+ return null;
167
+ const anchor = conversation.lastCustomerMessageAt;
168
+ if (anchor === undefined)
169
+ return null;
170
+ const elapsedMs = now.getTime() - timestampDate(anchor).getTime();
171
+ return elapsedMs >= WHATSAPP_SERVICE_WINDOW_MS ? "closed" : "open";
172
+ }
173
+ /**
174
+ * The awaiting-reply indicator for a conversation (channel-conversations
175
+ * DD-011 D-a): `"strong"` when a human holds it — the agent will not
176
+ * answer, so a person must (F-13's exact case) — and `"muted"` when the
177
+ * agent holds it: the agent is about to answer, and if its turn dies the
178
+ * conversation stays visibly waiting, which is the built-in recovery
179
+ * path (DD-011 D-b). `null` when the customer's last message has been
180
+ * answered (or the customer has not written).
181
+ *
182
+ * The fact itself is server-derived (`awaiting_reply` rides the wire as
183
+ * a boolean precisely so no client re-implements the NULL-and-compare
184
+ * rule); this helper only maps fact × holder onto render strength.
185
+ */
186
+ export function awaitingIndicatorOf(conversation) {
187
+ if (!conversation.awaitingReply)
188
+ return null;
189
+ return conversation.control === ConversationControl.control_human
190
+ ? "strong"
191
+ : "muted";
192
+ }
193
+ /**
194
+ * The timeline item id an accepted staff reply appears under: the
195
+ * outbound ledger's `ob:` namespace over the reply output's
196
+ * `outbound_message_id` — the contract
197
+ * `useConversationParticipation.reply` documents ("the item will
198
+ * appear on the timeline as `ob:<that id>`"). The workbench's
199
+ * post-send busy state watches for exactly this id (F-05).
200
+ */
201
+ export function outboundItemIdOf(outboundMessageId) {
202
+ return `ob:${outboundMessageId}`;
203
+ }
204
+ /**
205
+ * Newest-first timeline order: `(at, item_id)` descending — the exact
206
+ * comparator the server pages with, so client-side merges can never
207
+ * disagree with server pages about order.
208
+ */
209
+ export function compareTimelineItemsNewestFirst(a, b) {
210
+ const byInstant = compareInstants(b.at, a.at);
211
+ if (byInstant !== 0)
212
+ return byInstant;
213
+ return a.itemId < b.itemId ? 1 : a.itemId > b.itemId ? -1 : 0;
214
+ }
215
+ // BigInt() call form, not a 0n literal: the web console compiles SDK
216
+ // sources under a pre-ES2020 target where the literal is a syntax error.
217
+ const ZERO_SECONDS = BigInt(0);
218
+ function compareInstants(a, b) {
219
+ // A missing instant sorts oldest — the server always stamps `at`, so
220
+ // this only orders a defensively-handled corrupt item to the top of
221
+ // history rather than crashing the sort.
222
+ const aSeconds = a?.seconds ?? ZERO_SECONDS;
223
+ const bSeconds = b?.seconds ?? ZERO_SECONDS;
224
+ if (aSeconds !== bSeconds)
225
+ return aSeconds < bSeconds ? -1 : 1;
226
+ const aNanos = a?.nanos ?? 0;
227
+ const bNanos = b?.nanos ?? 0;
228
+ return aNanos - bNanos;
229
+ }
230
+ //# sourceMappingURL=conversationPresentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversationPresentation.js","sourceRoot":"","sources":["../../src/conversation/conversationPresentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAEL,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,GAEjB,MAAM,uEAAuE,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gEAAgE,CAAC;AACvG,OAAO,EAAE,mBAAmB,EAAE,MAAM,gEAAgE,CAAC;AAkBrG,sDAAsD;AACtD,MAAM,UAAU,YAAY,CAAC,IAA8B;IACzD,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,sBAAsB,CAAC,eAAe;YACzC,OAAO,UAAU,CAAC;QACpB,KAAK,sBAAsB,CAAC,YAAY;YACtC,OAAO,OAAO,CAAC;QACjB,KAAK,sBAAsB,CAAC,eAAe;YACzC,OAAO,UAAU,CAAC;QACpB,KAAK,sBAAsB,CAAC,eAAe;YACzC,OAAO,UAAU,CAAC;QACpB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,cAAc,CAAC,IAA8B;IAC3D,OAAO,IAAI,CAAC,IAAI,KAAK,gBAAgB,CAAC,aAAa,CAAC;AACtD,CAAC;AAiBD,+DAA+D;AAC/D,MAAM,UAAU,aAAa,CAAC,IAA8B;IAC1D,QAAQ,IAAI,CAAC,cAAc,EAAE,CAAC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,MAAM,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC;IAC7B,OAAO,MAAM,GAAG,MAAM,CAAC;AACzB,CAAC"}
@@ -0,0 +1,26 @@
1
+ export { ConversationsWorkbench } from "./ConversationsWorkbench.js";
2
+ export type { ConversationHeaderContext, ConversationsWorkbenchProps, } from "./ConversationsWorkbench.js";
3
+ export { ConversationListPane } from "./ConversationListPane.js";
4
+ export type { ConversationIdentity, ConversationListPaneProps, } from "./ConversationListPane.js";
5
+ export { ConversationTimelineView } from "./ConversationTimelineView.js";
6
+ export type { ConversationTimelineViewProps } from "./ConversationTimelineView.js";
7
+ export { ConversationControlBanner } from "./ConversationControlBanner.js";
8
+ export type { ConversationControlBannerProps } from "./ConversationControlBanner.js";
9
+ export { ConversationAttentionBanner } from "./ConversationAttentionBanner.js";
10
+ export type { ConversationAttentionBannerProps } from "./ConversationAttentionBanner.js";
11
+ export { ConversationComposer } from "./ConversationComposer.js";
12
+ export type { ConversationComposerProps } from "./ConversationComposer.js";
13
+ export { useConversation } from "./useConversation.js";
14
+ export type { UseConversationOptions, UseConversationReturn, } from "./useConversation.js";
15
+ export { useConversationList } from "./useConversationList.js";
16
+ export type { UseConversationListOptions, UseConversationListReturn, } from "./useConversationList.js";
17
+ export { useConversationTimeline } from "./useConversationTimeline.js";
18
+ export type { UseConversationTimelineOptions, UseConversationTimelineReturn, } from "./useConversationTimeline.js";
19
+ export { useConversationParticipation } from "./useConversationParticipation.js";
20
+ export type { ConversationCommand, UseConversationParticipationOptions, UseConversationParticipationReturn, } from "./useConversationParticipation.js";
21
+ export { useConversationsWantsHumanCount } from "./useConversationsWantsHumanCount.js";
22
+ export type { UseConversationsWantsHumanCountOptions, UseConversationsWantsHumanCountReturn, } from "./useConversationsWantsHumanCount.js";
23
+ export { authorKindOf, awaitingIndicatorOf, compareTimelineItemsNewestFirst, conversationContactOf, conversationLabelOf, inboundPlaceholderOf, isInternalItem, receiptOf, sendAttemptOf, serviceWindowOf, } from "./conversationPresentation.js";
24
+ export type { AwaitingIndicator, ConversationAuthorKind, ReceiptKind, SendAttemptKind, ServiceWindowState, } from "./conversationPresentation.js";
25
+ export { CONVERSATION_BADGE_POLL_INTERVAL_MS, CONVERSATION_DETAIL_POLL_INTERVAL_MS, CONVERSATION_LIST_POLL_INTERVAL_MS, } from "./polling.js";
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conversation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,YAAY,EACV,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EACV,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,YAAY,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAEnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,YAAY,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAErF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,YAAY,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAC;AAEzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EACV,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EACV,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EACV,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,YAAY,EACV,mBAAmB,EACnB,mCAAmC,EACnC,kCAAkC,GACnC,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,YAAY,EACV,sCAAsC,EACtC,qCAAqC,GACtC,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,+BAA+B,EAC/B,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,GAChB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EACX,eAAe,EACf,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,mCAAmC,EACnC,oCAAoC,EACpC,kCAAkC,GACnC,MAAM,cAAc,CAAC"}
@@ -0,0 +1,14 @@
1
+ export { ConversationsWorkbench } from "./ConversationsWorkbench.js";
2
+ export { ConversationListPane } from "./ConversationListPane.js";
3
+ export { ConversationTimelineView } from "./ConversationTimelineView.js";
4
+ export { ConversationControlBanner } from "./ConversationControlBanner.js";
5
+ export { ConversationAttentionBanner } from "./ConversationAttentionBanner.js";
6
+ export { ConversationComposer } from "./ConversationComposer.js";
7
+ export { useConversation } from "./useConversation.js";
8
+ export { useConversationList } from "./useConversationList.js";
9
+ export { useConversationTimeline } from "./useConversationTimeline.js";
10
+ export { useConversationParticipation } from "./useConversationParticipation.js";
11
+ export { useConversationsWantsHumanCount } from "./useConversationsWantsHumanCount.js";
12
+ export { authorKindOf, awaitingIndicatorOf, compareTimelineItemsNewestFirst, conversationContactOf, conversationLabelOf, inboundPlaceholderOf, isInternalItem, receiptOf, sendAttemptOf, serviceWindowOf, } from "./conversationPresentation.js";
13
+ export { CONVERSATION_BADGE_POLL_INTERVAL_MS, CONVERSATION_DETAIL_POLL_INTERVAL_MS, CONVERSATION_LIST_POLL_INTERVAL_MS, } from "./polling.js";
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/conversation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAMrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAMjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAG/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAMvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAM/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAMvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAOjF,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAMvF,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,+BAA+B,EAC/B,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,GAChB,MAAM,+BAA+B,CAAC;AASvC,OAAO,EACL,mCAAmC,EACnC,oCAAoC,EACpC,kCAAkC,GACnC,MAAM,cAAc,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Liveness for the conversation surface is HONEST POLLING (channel-
3
+ * conversations DD-012) — no streaming or watch RPC exists on the
4
+ * conversation query controller, and none ships until a revisit trigger
5
+ * fires (a real push consumer, or sub-second liveness becoming a product
6
+ * property). These constants are the deliberate transport seam: hooks
7
+ * default to them, consumers may override per instance, and when
8
+ * push-shaped liveness lands the defaults change here without touching a
9
+ * consumer.
10
+ *
11
+ * The latency budget is a stated contract (DD-012 D-b), not an accident
12
+ * of three numbers:
13
+ *
14
+ * | Surface | Budget | Mechanism |
15
+ * | ---------------------------------------- | ---------------------------- | ------------------------------------------------ |
16
+ * | Your own action (take over, hand back, | immediate | command answer applied to the detail AND list |
17
+ * | dismiss, reply) | | `applyServerState` seams — zero polls involved |
18
+ * | The open conversation (row + timeline) | ≤ 5s | detail polls |
19
+ * | The inbox list | ≤ 20s, immediate on refocus | list poll + focus refetch |
20
+ * | The nav badge | ≤ 60s, immediate on refocus | count poll (the filtered list's `total_count`) |
21
+ */
22
+ /** Default poll interval for the org-wide conversation list. */
23
+ export declare const CONVERSATION_LIST_POLL_INTERVAL_MS = 20000;
24
+ /**
25
+ * Default poll interval for the OPEN conversation (its row and its
26
+ * timeline head). Tighter than the list on purpose: this is where a
27
+ * teammate's takeover or the customer's next message must appear while
28
+ * a human is watching.
29
+ */
30
+ export declare const CONVERSATION_DETAIL_POLL_INTERVAL_MS = 5000;
31
+ /**
32
+ * Default poll interval for the sidebar's wants-human count. Deliberately
33
+ * the slowest budget on the surface: a badge tolerates staleness an open
34
+ * inbox does not, it renders on every console page in every tab, and each
35
+ * tick pays an FGA ListObjects before the count (DD-011 D-g's stated
36
+ * price). Focus refetch keeps it honest at the moment someone returns.
37
+ */
38
+ export declare const CONVERSATION_BADGE_POLL_INTERVAL_MS = 60000;
39
+ //# sourceMappingURL=polling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polling.d.ts","sourceRoot":"","sources":["../../src/conversation/polling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,gEAAgE;AAChE,eAAO,MAAM,kCAAkC,QAAS,CAAC;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,OAAQ,CAAC;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,mCAAmC,QAAS,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Liveness for the conversation surface is HONEST POLLING (channel-
3
+ * conversations DD-012) — no streaming or watch RPC exists on the
4
+ * conversation query controller, and none ships until a revisit trigger
5
+ * fires (a real push consumer, or sub-second liveness becoming a product
6
+ * property). These constants are the deliberate transport seam: hooks
7
+ * default to them, consumers may override per instance, and when
8
+ * push-shaped liveness lands the defaults change here without touching a
9
+ * consumer.
10
+ *
11
+ * The latency budget is a stated contract (DD-012 D-b), not an accident
12
+ * of three numbers:
13
+ *
14
+ * | Surface | Budget | Mechanism |
15
+ * | ---------------------------------------- | ---------------------------- | ------------------------------------------------ |
16
+ * | Your own action (take over, hand back, | immediate | command answer applied to the detail AND list |
17
+ * | dismiss, reply) | | `applyServerState` seams — zero polls involved |
18
+ * | The open conversation (row + timeline) | ≤ 5s | detail polls |
19
+ * | The inbox list | ≤ 20s, immediate on refocus | list poll + focus refetch |
20
+ * | The nav badge | ≤ 60s, immediate on refocus | count poll (the filtered list's `total_count`) |
21
+ */
22
+ /** Default poll interval for the org-wide conversation list. */
23
+ export const CONVERSATION_LIST_POLL_INTERVAL_MS = 20_000;
24
+ /**
25
+ * Default poll interval for the OPEN conversation (its row and its
26
+ * timeline head). Tighter than the list on purpose: this is where a
27
+ * teammate's takeover or the customer's next message must appear while
28
+ * a human is watching.
29
+ */
30
+ export const CONVERSATION_DETAIL_POLL_INTERVAL_MS = 5_000;
31
+ /**
32
+ * Default poll interval for the sidebar's wants-human count. Deliberately
33
+ * the slowest budget on the surface: a badge tolerates staleness an open
34
+ * inbox does not, it renders on every console page in every tab, and each
35
+ * tick pays an FGA ListObjects before the count (DD-011 D-g's stated
36
+ * price). Focus refetch keeps it honest at the moment someone returns.
37
+ */
38
+ export const CONVERSATION_BADGE_POLL_INTERVAL_MS = 60_000;
39
+ //# sourceMappingURL=polling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polling.js","sourceRoot":"","sources":["../../src/conversation/polling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,gEAAgE;AAChE,MAAM,CAAC,MAAM,kCAAkC,GAAG,MAAM,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,KAAK,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,MAAM,CAAC"}
@@ -0,0 +1,61 @@
1
+ import type { ChannelConversation } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/conversation_io_pb";
2
+ /** Options for {@link useConversation}. */
3
+ export interface UseConversationOptions {
4
+ /**
5
+ * Poll interval in milliseconds; `false` disables polling. Defaults to
6
+ * {@link CONVERSATION_DETAIL_POLL_INTERVAL_MS} — the open conversation
7
+ * is where another teammate's takeover must appear promptly.
8
+ */
9
+ readonly refetchIntervalMs?: number | false;
10
+ }
11
+ /** Return value of {@link useConversation}. */
12
+ export interface UseConversationReturn {
13
+ /**
14
+ * The conversation's participation state, or `null` while loading and
15
+ * while the conversation does not exist yet (see
16
+ * {@link awaitingCustomer} for the distinction).
17
+ */
18
+ readonly conversation: ChannelConversation | null;
19
+ /**
20
+ * `true` when the server answered NOT_FOUND: no conversation row
21
+ * exists yet for this key. NOT an error — a proactive cold-send can
22
+ * have a timeline before the customer ever writes, and the row is
23
+ * created by the customer's first message. Render it as
24
+ * "participation controls unlock when the customer writes".
25
+ */
26
+ readonly awaitingCustomer: boolean;
27
+ /** `true` only until the first answer (row or NOT_FOUND) arrives. */
28
+ readonly isLoading: boolean;
29
+ /** `true` while a background poll is in flight and stale state shows. */
30
+ readonly isRefetching: boolean;
31
+ /** Error from the last failed request (NOT_FOUND excluded), or `null`. */
32
+ readonly error: Error | null;
33
+ /** Imperatively re-read the row. */
34
+ readonly refetch: () => void;
35
+ /**
36
+ * Adopt a fresh row the server just returned — every participation
37
+ * command answers the post-command state (including for the loser of
38
+ * a concurrent-takeover race), and that answer is newer than anything
39
+ * a poll already in flight will deliver. Applying it also fences
40
+ * those in-flight polls so a stale answer can never overwrite it.
41
+ */
42
+ readonly applyServerState: (fresh: ChannelConversation) => void;
43
+ }
44
+ /**
45
+ * Data hook for one conversation's identity and participation state —
46
+ * the single-row read behind a conversation detail view (who holds
47
+ * control, whether attention is needed and why, the display name).
48
+ *
49
+ * Deliberately NOT built on the shared `useFetch`: participation
50
+ * commands hand back fresher state than any in-flight poll
51
+ * ({@link UseConversationReturn.applyServerState}), which needs a write
52
+ * fence over the fetch state — a seam `useFetch`'s single-writer model
53
+ * does not have. The fence is an epoch counter: applying server state
54
+ * bumps it, and a poll that started under an older epoch discards its
55
+ * answer instead of resurrecting pre-command state under the user's
56
+ * cursor.
57
+ *
58
+ * Pass empty strings to skip fetching (the `null`-fetchFn convention).
59
+ */
60
+ export declare function useConversation(agentChannelId: string, conversationKey: string, options?: UseConversationOptions): UseConversationReturn;
61
+ //# sourceMappingURL=useConversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useConversation.d.ts","sourceRoot":"","sources":["../../src/conversation/useConversation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uEAAuE,CAAC;AAUjH,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAC7C;AAED,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAClD;;;;;;OAMG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,yEAAyE;IACzE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,oCAAoC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACjE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,qBAAqB,CA8IvB"}