@alexkroman1/aai-ui 0.12.3 → 0.13.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 (201) hide show
  1. package/README.md +257 -0
  2. package/dist/_colors-CpZO-88A.js +78 -0
  3. package/dist/_module-url-C13kAJ87.js +15 -0
  4. package/dist/_page-shell.d.ts +11 -0
  5. package/dist/_recover-run.d.ts +79 -0
  6. package/dist/_repeat-until.d.ts +30 -0
  7. package/dist/_run-controls.d.ts +33 -0
  8. package/dist/_submission-state.d.ts +92 -0
  9. package/dist/_tap-to-talk-state.d.ts +88 -0
  10. package/dist/_utils-Mi-SCFA1.js +47 -0
  11. package/dist/_utils.d.ts +26 -0
  12. package/dist/_web-storage.d.ts +43 -0
  13. package/dist/_workflow-api-ref.d.ts +37 -0
  14. package/dist/_workflow-files.d.ts +34 -0
  15. package/dist/_workflow-test-defs.d.ts +38 -0
  16. package/dist/aai-logo-D8pMVn9_.js +85 -0
  17. package/dist/agent-state-labels.d.ts +65 -0
  18. package/dist/agent-state.d.ts +108 -0
  19. package/dist/audio/capture.d.ts +44 -0
  20. package/dist/audio/index.d.ts +18 -0
  21. package/dist/audio/index.js +431 -0
  22. package/dist/audio/preconnect.d.ts +87 -0
  23. package/dist/audio/voice-io.d.ts +112 -0
  24. package/dist/build-default-client.d.ts +1 -0
  25. package/dist/chat-view-BCbI7gD4.js +396 -0
  26. package/dist/client-config-C7fQrioM.js +139 -0
  27. package/dist/client-config.d.ts +119 -0
  28. package/dist/client-dir.d.ts +44 -0
  29. package/dist/client-dir.js +58 -0
  30. package/dist/client-identity.d.ts +131 -0
  31. package/dist/client-tool.d.ts +51 -0
  32. package/dist/components/_colors.d.ts +73 -0
  33. package/dist/components/_form-readiness.d.ts +56 -0
  34. package/dist/components/_form-values.d.ts +19 -0
  35. package/dist/components/aai-logo.d.ts +12 -0
  36. package/dist/components/audio-result.d.ts +94 -0
  37. package/dist/components/auto-scroll.d.ts +74 -0
  38. package/dist/components/bullet-list.d.ts +74 -0
  39. package/dist/components/button.d.ts +29 -21
  40. package/dist/components/button.js +62 -23
  41. package/dist/components/chat-view.d.ts +24 -18
  42. package/dist/components/chat-view.js +2 -60
  43. package/dist/components/console-shell.d.ts +85 -0
  44. package/dist/components/controls.d.ts +21 -6
  45. package/dist/components/controls.js +31 -19
  46. package/dist/components/conversation-view.d.ts +130 -0
  47. package/dist/components/eyebrow.d.ts +12 -0
  48. package/dist/components/facts.d.ts +81 -0
  49. package/dist/components/form-fields.d.ts +142 -0
  50. package/dist/components/form-types.d.ts +73 -0
  51. package/dist/components/form.d.ts +96 -0
  52. package/dist/components/markdown.d.ts +57 -0
  53. package/dist/components/message-list.d.ts +34 -7
  54. package/dist/components/message-list.js +2 -75
  55. package/dist/components/session-controls.d.ts +125 -0
  56. package/dist/components/session-error-banner.d.ts +69 -0
  57. package/dist/components/session-state-dot.d.ts +111 -0
  58. package/dist/components/sidebar-layout.d.ts +31 -10
  59. package/dist/components/sidebar-layout.js +32 -12
  60. package/dist/components/start-screen.d.ts +17 -6
  61. package/dist/components/start-screen.js +34 -14
  62. package/dist/components/tool-call-block.d.ts +15 -14
  63. package/dist/components/tool-call-block.js +2 -117
  64. package/dist/components/tool-call-row.d.ts +75 -0
  65. package/dist/components/tool-config-context.d.ts +22 -0
  66. package/dist/components/upload-progress.d.ts +76 -0
  67. package/dist/components/url-chips.d.ts +29 -0
  68. package/dist/components/workflow-fields.d.ts +46 -0
  69. package/dist/components/workflow-pending-note.d.ts +81 -0
  70. package/dist/components/workflow-progress.d.ts +81 -0
  71. package/dist/components/workflow-run-error.d.ts +48 -0
  72. package/dist/components/workflow-run-panel.d.ts +79 -0
  73. package/dist/context.d.ts +288 -0
  74. package/dist/context.js +382 -0
  75. package/dist/conversation-log.d.ts +88 -0
  76. package/dist/default-client/assets/_module-url-BX0RuRU2.js +1 -0
  77. package/dist/default-client/assets/audio-cGFGID-2.js +1 -0
  78. package/dist/default-client/assets/capture-processor-BUABoo3_.js +90 -0
  79. package/dist/default-client/assets/index-8ihb1Urm.css +2 -0
  80. package/dist/default-client/assets/index-BQURVARl.js +126 -0
  81. package/dist/default-client/assets/playback-processor-ABOa11j0.js +314 -0
  82. package/dist/default-client/favicon.ico +0 -0
  83. package/dist/default-client/index.html +15 -0
  84. package/dist/default-client.d.ts +23 -0
  85. package/dist/define-client.d.ts +162 -26
  86. package/dist/define-client.js +201 -55
  87. package/dist/eyebrow-UfmSz9yy.js +27 -0
  88. package/dist/hooks-DN4gHYsj.js +182 -0
  89. package/dist/hooks.d.ts +172 -0
  90. package/dist/hooks.js +3 -0
  91. package/dist/hooks.test-d.d.ts +14 -0
  92. package/dist/inbox-protocol.d.ts +128 -0
  93. package/dist/inbox.d.ts +132 -0
  94. package/dist/index.d.ts +126 -29
  95. package/dist/index.js +5500 -15
  96. package/dist/internal.d.ts +43 -0
  97. package/dist/internal.js +8 -0
  98. package/dist/linked-client.d.ts +70 -0
  99. package/dist/message-list-DHZcLhRA.js +682 -0
  100. package/dist/notice-player.d.ts +70 -0
  101. package/dist/page.d.ts +114 -0
  102. package/dist/phone.d.ts +50 -0
  103. package/dist/route-fetch.d.ts +79 -0
  104. package/dist/session/audio-effects.d.ts +31 -0
  105. package/dist/session/audio-setup.d.ts +57 -0
  106. package/dist/session/audio-state.d.ts +157 -0
  107. package/dist/session/browser-session.d.ts +30 -0
  108. package/dist/session/close.d.ts +26 -0
  109. package/dist/session/dial.d.ts +65 -0
  110. package/dist/session/handshake.d.ts +60 -0
  111. package/dist/session/index.d.ts +17 -0
  112. package/dist/session/index.js +2 -0
  113. package/dist/session/messages.d.ts +63 -0
  114. package/dist/session/mic.d.ts +64 -0
  115. package/dist/session/preconnect.d.ts +48 -0
  116. package/dist/session/reconnect.d.ts +25 -0
  117. package/dist/session/resume-store.d.ts +57 -0
  118. package/dist/session/state.d.ts +146 -0
  119. package/dist/session/ticket.d.ts +44 -0
  120. package/dist/session/types.d.ts +476 -0
  121. package/dist/session/url.d.ts +17 -0
  122. package/dist/session/user-turn.d.ts +55 -0
  123. package/dist/session-CE0Ipsb3.js +2129 -0
  124. package/dist/stored-value.d.ts +103 -0
  125. package/dist/tool-call-block-uXtMOUWN.js +204 -0
  126. package/dist/tool-config-context-Es4YUzV2.js +19 -0
  127. package/dist/types.d.ts +272 -34
  128. package/dist/types.js +35 -4
  129. package/dist/upload/files.d.ts +83 -0
  130. package/dist/upload/index.d.ts +15 -0
  131. package/dist/upload/pause.d.ts +31 -0
  132. package/dist/upload/recall.d.ts +67 -0
  133. package/dist/upload/report.d.ts +26 -0
  134. package/dist/upload/session.d.ts +99 -0
  135. package/dist/url-chips-oyy_Eiqh.js +239 -0
  136. package/dist/use-client-runs.d.ts +87 -0
  137. package/dist/use-conversation-log.d.ts +86 -0
  138. package/dist/use-conversation.d.ts +131 -0
  139. package/dist/use-copy.d.ts +74 -0
  140. package/dist/use-download-url.d.ts +84 -0
  141. package/dist/use-flash.d.ts +61 -0
  142. package/dist/use-inbox.d.ts +101 -0
  143. package/dist/use-push-to-talk.d.ts +105 -0
  144. package/dist/use-route-mutation.d.ts +113 -0
  145. package/dist/use-route.d.ts +82 -0
  146. package/dist/use-run-key.d.ts +133 -0
  147. package/dist/use-session-controls.d.ts +69 -0
  148. package/dist/use-session-id.d.ts +57 -0
  149. package/dist/use-tap-to-talk.d.ts +138 -0
  150. package/dist/use-user-transcript-uyHhzy4d.js +73 -0
  151. package/dist/use-user-transcript.d.ts +75 -0
  152. package/dist/use-workflow-form.d.ts +285 -0
  153. package/dist/use-workflow-progress.d.ts +137 -0
  154. package/dist/use-workflow-run-DdhWmbx-.js +697 -0
  155. package/dist/use-workflow-run.d.ts +100 -0
  156. package/dist/use-workflow-runs.d.ts +71 -0
  157. package/dist/use-workflow-stream.d.ts +154 -0
  158. package/dist/use-workflows.d.ts +77 -0
  159. package/dist/workflow-client.d.ts +136 -0
  160. package/dist/workflow-def-types.d.ts +31 -0
  161. package/dist/workflow-events.d.ts +39 -0
  162. package/dist/workflow-field-kind.d.ts +95 -0
  163. package/dist/workflow-status-labels.d.ts +35 -0
  164. package/dist/worklets/_module-url.d.ts +10 -0
  165. package/dist/worklets/_playback-bench-harness.d.ts +181 -0
  166. package/dist/worklets/_playback-bench-host.d.ts +63 -0
  167. package/dist/worklets/_playback-bench-page.d.ts +65 -0
  168. package/dist/worklets/_tts-trace-harness.d.ts +142 -0
  169. package/dist/worklets/_worklet-test-utils.d.ts +27 -0
  170. package/dist/worklets/capture-processor.d.ts +4 -2
  171. package/dist/worklets/capture-processor.js +73 -33
  172. package/dist/worklets/playback-processor.d.ts +4 -2
  173. package/dist/worklets/playback-processor.js +258 -42
  174. package/package.json +57 -32
  175. package/styles.css +152 -30
  176. package/dist/audio.d.ts +0 -45
  177. package/dist/audio.js +0 -121
  178. package/dist/client-context.d.ts +0 -33
  179. package/dist/client-context.js +0 -15
  180. package/dist/client-handler.d.ts +0 -43
  181. package/dist/components/app.d.ts +0 -23
  182. package/dist/components/app.js +0 -41
  183. package/dist/components/error-banner.d.ts +0 -21
  184. package/dist/components/error-banner.js +0 -27
  185. package/dist/components/message-bubble.d.ts +0 -23
  186. package/dist/components/message-bubble.js +0 -35
  187. package/dist/components/state-indicator.d.ts +0 -29
  188. package/dist/components/state-indicator.js +0 -37
  189. package/dist/components/thinking-indicator.d.ts +0 -16
  190. package/dist/components/thinking-indicator.js +0 -34
  191. package/dist/components/tool-icons.d.ts +0 -17
  192. package/dist/components/tool-icons.js +0 -128
  193. package/dist/components/transcript.d.ts +0 -25
  194. package/dist/components/transcript.js +0 -35
  195. package/dist/session-CWB7vmqz.js +0 -429
  196. package/dist/session.d.ts +0 -69
  197. package/dist/session.js +0 -2
  198. package/dist/signals.d.ts +0 -120
  199. package/dist/signals.js +0 -161
  200. package/dist/tsdown.config.d.ts +0 -2
  201. package/dist/types.test-d.d.ts +0 -7
@@ -0,0 +1,137 @@
1
+ /**
2
+ * `useWorkflowProgress` — read what a run has WRITTEN while it runs.
3
+ *
4
+ * The sibling of `useWorkflowRun`, and the split between them is the whole
5
+ * reason this exists. That hook reports a run's STATE: the status transitions
6
+ * the world records, which every run has. This reports what the run itself
7
+ * wrote through `getWritable()`, which is the only thing a long run can say
8
+ * before it finishes — a snapshot carries a status and, once terminal, an
9
+ * output, and nothing in between. A page that shows only status shows
10
+ * "Working…" for ten minutes and then a result.
11
+ *
12
+ * ## There is no poll fallback, and that is not an omission
13
+ *
14
+ * `useWorkflowRun` degrades to polling `GET /runs/:id` because a run's STATE is
15
+ * readable that way. A run's written chunks are not: the stream is the only
16
+ * route to them, so an agent that does not serve it has no progress to give and
17
+ * `supported` says so once, rather than a poll pretending to look for something
18
+ * that is not there. A page renders its status line either way.
19
+ *
20
+ * ## Chunks are RETAINED, so this is a replay as much as a tail
21
+ *
22
+ * The run's stream keeps every chunk, so a page that mounts late — a reload, a
23
+ * second tab, a link opened tomorrow — reads the whole history from index 0 and
24
+ * arrives at the same list as one that watched throughout. That is what makes a
25
+ * durable run's progress durable too, and it is why the default `startIndex` is
26
+ * 0 rather than "from now": a tail-only default would make the same page show
27
+ * different things depending on when it opened.
28
+ *
29
+ * ## It RE-OPENS while the run is live, because a progress read is bounded
30
+ *
31
+ * The route answers with the chunks written when the request arrived and then
32
+ * ends, reporting `complete` — whether the run itself was terminal. It has to:
33
+ * a workflow stream signals its end only once CLOSED, and a progress channel
34
+ * written by one step after another is never closed, so a read that waited for
35
+ * the end would hang forever on a finished run. (It did: see the route's own
36
+ * doc.)
37
+ *
38
+ * So this hook re-opens from where it left off until a read comes back
39
+ * `complete`. That is a poll, and the honest description of progress is a durable
40
+ * log rather than a socket — but it is a poll of a CHEAP shape: each read asks
41
+ * only for chunks past the last index it saw, so a quiet run costs an empty
42
+ * answer rather than the whole log again.
43
+ *
44
+ * ## A FAILED read is not an absent route, whether or not it carried a status
45
+ *
46
+ * Because the loop stops for good once it decides the route is absent, that
47
+ * decision is the one place a single bad request can cost a live run its entire
48
+ * narration — and it did. Every non-2xx used to read as "this agent serves no
49
+ * progress route", so one transient answer hid the log permanently while the run
50
+ * carried on and the status line went on saying `running`. See
51
+ * {@link isTransientRead} for the split and `readOnce` for what each arm costs.
52
+ */
53
+ import type { WorkflowApi } from "./workflow-client.ts";
54
+ /** The slice of the client this needs: one method. */
55
+ export type RunProgressReader = Pick<WorkflowApi, "streamOutput">;
56
+ export type UseWorkflowProgressResult<T = string> = {
57
+ /** Every chunk the run has written, oldest first. */
58
+ progress: T[];
59
+ /** The newest chunk, or undefined before the first one lands. */
60
+ latest: T | undefined;
61
+ /** True while the run is still being read — it may yet say more. */
62
+ streaming: boolean;
63
+ /**
64
+ * False once the agent has answered that it does not serve this route.
65
+ *
66
+ * Distinguishes "this deploy predates progress streams" from "the run has not
67
+ * written anything yet", which look identical from `progress` alone. A page
68
+ * uses it to hide the section rather than show an empty one forever.
69
+ */
70
+ supported: boolean;
71
+ };
72
+ /**
73
+ * How often a live run's progress is re-read once a bounded read has ended.
74
+ *
75
+ * **Five seconds, up from one, because narration is the cheapest thing on the
76
+ * page and it was the most expensive thing on the wire.**
77
+ *
78
+ * On the platform every one of these reads BROKERS (see `useWorkflowRun`'s note
79
+ * on the same hazard), and a page routinely mounts TWO of these hooks against one
80
+ * run — `transcription-workflow` renders `<WorkflowProgress>` for the run's own
81
+ * narration and `<LiveTranscript>` for the segments as they land. At one second
82
+ * that is 2 requests/second from a single tab, which is exactly the platform's
83
+ * whole per-IP surface budget (`WORKFLOW_IP_RATE_LIMIT`, 600 per 5 minutes) — so
84
+ * one tab watching one run, with a history entry expanded, answers
85
+ * `429 Too many workflow requests` partway through its own run.
86
+ *
87
+ * It is also contending for the link with the UPLOAD, which on this page is the
88
+ * thing the reader is actually waiting for: a workflow app's whole wall clock is
89
+ * bytes going out, and progress polling spends the same uplink to describe it.
90
+ *
91
+ * What five costs is that a line appears up to five seconds after the run wrote
92
+ * it. That is the right trade for a log a person SKIMS while waiting minutes —
93
+ * and it is not the run's completion, which arrives on `useWorkflowRun`'s event
94
+ * stream (see {@link DEFAULT_WORKFLOW_POLL_MS}, deliberately left at two seconds
95
+ * because it answers "is it done", not "what is it doing").
96
+ *
97
+ * A page that really wants a live feed passes `intervalMs` and owns the
98
+ * consequence. That option is the authoring surface for this choice, which is why
99
+ * this constant is `/internal` rather than public.
100
+ */
101
+ export declare const DEFAULT_PROGRESS_POLL_MS = 5000;
102
+ /**
103
+ * Follow one run's progress stream.
104
+ *
105
+ * Passing `undefined` (nothing started yet) costs nothing, and reading stops for
106
+ * good once a read reports the run terminal — so a finished run costs one read.
107
+ *
108
+ * @example
109
+ * ```tsx
110
+ * import { useWorkflowProgress } from "@alexkroman1/aai-ui";
111
+ *
112
+ * function Progress({ runId }: { runId?: string }) {
113
+ * const { progress, streaming, supported } = useWorkflowProgress(runId);
114
+ * if (!supported) return null;
115
+ * return (
116
+ * <pre>
117
+ * {progress.join("\n")}
118
+ * {streaming && "\n…"}
119
+ * </pre>
120
+ * );
121
+ * }
122
+ * ```
123
+ *
124
+ * @typeParam T - What the workflow writes. Defaults to `string`, which is what
125
+ * a progress channel usually carries; a workflow writing objects names its own
126
+ * shape. Nothing in the browser can verify it — the route describes no type —
127
+ * so this is the page's assertion about its own agent, narrowed once here
128
+ * rather than at every read.
129
+ *
130
+ * @public
131
+ */
132
+ export declare function useWorkflowProgress<T = string>(runId: string | undefined, options?: {
133
+ api?: WorkflowApi;
134
+ namespace?: string;
135
+ startIndex?: number;
136
+ intervalMs?: number;
137
+ }): UseWorkflowProgressResult<T>;