@alexkroman1/aai-ui 0.12.3 → 0.14.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.
- package/README.md +253 -0
- package/dist/_colors-CpZO-88A.js +78 -0
- package/dist/_module-url-C13kAJ87.js +15 -0
- package/dist/_page-shell.d.ts +11 -0
- package/dist/_recover-run.d.ts +79 -0
- package/dist/_repeat-until.d.ts +30 -0
- package/dist/_run-controls.d.ts +33 -0
- package/dist/_submission-state.d.ts +92 -0
- package/dist/_tap-to-talk-state.d.ts +88 -0
- package/dist/_utils-Mi-SCFA1.js +47 -0
- package/dist/_utils.d.ts +26 -0
- package/dist/_web-storage.d.ts +43 -0
- package/dist/_workflow-api-ref.d.ts +37 -0
- package/dist/_workflow-files.d.ts +34 -0
- package/dist/_workflow-test-defs.d.ts +34 -0
- package/dist/aai-logo-D8pMVn9_.js +85 -0
- package/dist/agent-state-labels.d.ts +65 -0
- package/dist/agent-state.d.ts +108 -0
- package/dist/audio/capture.d.ts +44 -0
- package/dist/audio/index.d.ts +18 -0
- package/dist/audio/index.js +431 -0
- package/dist/audio/preconnect.d.ts +87 -0
- package/dist/audio/voice-io.d.ts +112 -0
- package/dist/build-default-client.d.ts +1 -0
- package/dist/chat-view-BCbI7gD4.js +396 -0
- package/dist/client-config-C7fQrioM.js +139 -0
- package/dist/client-config.d.ts +119 -0
- package/dist/client-dir.d.ts +44 -0
- package/dist/client-dir.js +58 -0
- package/dist/client-identity.d.ts +131 -0
- package/dist/client-tool.d.ts +51 -0
- package/dist/components/_colors.d.ts +73 -0
- package/dist/components/_form-readiness.d.ts +56 -0
- package/dist/components/_form-values.d.ts +19 -0
- package/dist/components/aai-logo.d.ts +12 -0
- package/dist/components/audio-result.d.ts +94 -0
- package/dist/components/auto-scroll.d.ts +74 -0
- package/dist/components/bullet-list.d.ts +74 -0
- package/dist/components/button.d.ts +29 -21
- package/dist/components/button.js +62 -23
- package/dist/components/chat-view.d.ts +24 -18
- package/dist/components/chat-view.js +2 -60
- package/dist/components/console-shell.d.ts +85 -0
- package/dist/components/controls.d.ts +21 -6
- package/dist/components/controls.js +31 -19
- package/dist/components/conversation-view.d.ts +130 -0
- package/dist/components/eyebrow.d.ts +12 -0
- package/dist/components/facts.d.ts +81 -0
- package/dist/components/form-fields.d.ts +142 -0
- package/dist/components/form-types.d.ts +73 -0
- package/dist/components/form.d.ts +96 -0
- package/dist/components/markdown.d.ts +57 -0
- package/dist/components/message-list.d.ts +34 -7
- package/dist/components/message-list.js +2 -75
- package/dist/components/session-controls.d.ts +125 -0
- package/dist/components/session-error-banner.d.ts +69 -0
- package/dist/components/session-state-dot.d.ts +111 -0
- package/dist/components/sidebar-layout.d.ts +31 -10
- package/dist/components/sidebar-layout.js +32 -12
- package/dist/components/start-screen.d.ts +17 -6
- package/dist/components/start-screen.js +34 -14
- package/dist/components/tool-call-block.d.ts +15 -14
- package/dist/components/tool-call-block.js +2 -117
- package/dist/components/tool-call-row.d.ts +75 -0
- package/dist/components/tool-config-context.d.ts +22 -0
- package/dist/components/upload-progress.d.ts +76 -0
- package/dist/components/url-chips.d.ts +29 -0
- package/dist/components/workflow-fields.d.ts +46 -0
- package/dist/components/workflow-pending-note.d.ts +81 -0
- package/dist/components/workflow-progress.d.ts +81 -0
- package/dist/components/workflow-run-error.d.ts +48 -0
- package/dist/components/workflow-run-panel.d.ts +79 -0
- package/dist/context.d.ts +288 -0
- package/dist/context.js +382 -0
- package/dist/conversation-log.d.ts +88 -0
- package/dist/default-client/assets/_module-url-BX0RuRU2.js +1 -0
- package/dist/default-client/assets/audio-mpgipo2Q.js +1 -0
- package/dist/default-client/assets/capture-processor-D0q7Qrdd.js +90 -0
- package/dist/default-client/assets/index-8ihb1Urm.css +2 -0
- package/dist/default-client/assets/index-DPfmSFmc.js +126 -0
- package/dist/default-client/assets/playback-processor-CjDbc9iH.js +314 -0
- package/dist/default-client/favicon.ico +0 -0
- package/dist/default-client/index.html +15 -0
- package/dist/default-client-entry.d.ts +6 -0
- package/dist/default-client.d.ts +19 -0
- package/dist/define-client.d.ts +169 -26
- package/dist/define-client.js +209 -55
- package/dist/eyebrow-UfmSz9yy.js +27 -0
- package/dist/hooks-DN4gHYsj.js +182 -0
- package/dist/hooks.d.ts +172 -0
- package/dist/hooks.js +3 -0
- package/dist/hooks.test-d.d.ts +14 -0
- package/dist/inbox-protocol.d.ts +128 -0
- package/dist/inbox.d.ts +132 -0
- package/dist/index.d.ts +126 -29
- package/dist/index.js +5500 -15
- package/dist/internal.d.ts +43 -0
- package/dist/internal.js +8 -0
- package/dist/linked-client.d.ts +70 -0
- package/dist/message-list-DHZcLhRA.js +682 -0
- package/dist/notice-player.d.ts +70 -0
- package/dist/page.d.ts +114 -0
- package/dist/phone.d.ts +50 -0
- package/dist/route-fetch.d.ts +79 -0
- package/dist/session/audio-effects.d.ts +37 -0
- package/dist/session/audio-setup.d.ts +57 -0
- package/dist/session/audio-state.d.ts +157 -0
- package/dist/session/browser-session.d.ts +39 -0
- package/dist/session/close.d.ts +26 -0
- package/dist/session/dial.d.ts +65 -0
- package/dist/session/handshake.d.ts +60 -0
- package/dist/session/index.d.ts +17 -0
- package/dist/session/index.js +2 -0
- package/dist/session/messages.d.ts +63 -0
- package/dist/session/mic.d.ts +64 -0
- package/dist/session/preconnect.d.ts +48 -0
- package/dist/session/reconnect.d.ts +25 -0
- package/dist/session/resume-store.d.ts +57 -0
- package/dist/session/state.d.ts +146 -0
- package/dist/session/ticket.d.ts +44 -0
- package/dist/session/types.d.ts +476 -0
- package/dist/session/url.d.ts +17 -0
- package/dist/session/user-turn.d.ts +55 -0
- package/dist/session-D9jM5-TF.js +2140 -0
- package/dist/stored-value.d.ts +103 -0
- package/dist/tool-call-block-uXtMOUWN.js +204 -0
- package/dist/tool-config-context-Es4YUzV2.js +19 -0
- package/dist/types.d.ts +272 -34
- package/dist/types.js +35 -4
- package/dist/upload/files.d.ts +83 -0
- package/dist/upload/index.d.ts +15 -0
- package/dist/upload/pause.d.ts +31 -0
- package/dist/upload/recall.d.ts +67 -0
- package/dist/upload/report.d.ts +26 -0
- package/dist/upload/session.d.ts +99 -0
- package/dist/url-chips-oyy_Eiqh.js +239 -0
- package/dist/use-client-runs.d.ts +87 -0
- package/dist/use-conversation-log.d.ts +86 -0
- package/dist/use-conversation.d.ts +131 -0
- package/dist/use-copy.d.ts +74 -0
- package/dist/use-download-url.d.ts +84 -0
- package/dist/use-flash.d.ts +61 -0
- package/dist/use-inbox.d.ts +101 -0
- package/dist/use-push-to-talk.d.ts +105 -0
- package/dist/use-route-mutation.d.ts +113 -0
- package/dist/use-route.d.ts +82 -0
- package/dist/use-run-key.d.ts +133 -0
- package/dist/use-session-controls.d.ts +69 -0
- package/dist/use-session-id.d.ts +57 -0
- package/dist/use-tap-to-talk.d.ts +138 -0
- package/dist/use-user-transcript-uyHhzy4d.js +73 -0
- package/dist/use-user-transcript.d.ts +75 -0
- package/dist/use-workflow-form.d.ts +285 -0
- package/dist/use-workflow-progress.d.ts +137 -0
- package/dist/use-workflow-run-DdhWmbx-.js +697 -0
- package/dist/use-workflow-run.d.ts +100 -0
- package/dist/use-workflow-runs.d.ts +71 -0
- package/dist/use-workflow-stream.d.ts +154 -0
- package/dist/use-workflows.d.ts +77 -0
- package/dist/workflow-client.d.ts +136 -0
- package/dist/workflow-def-types.d.ts +31 -0
- package/dist/workflow-events.d.ts +39 -0
- package/dist/workflow-field-kind.d.ts +95 -0
- package/dist/workflow-status-labels.d.ts +35 -0
- package/dist/worklets/_module-url.d.ts +10 -0
- package/dist/worklets/_playback-bench-harness.d.ts +181 -0
- package/dist/worklets/_playback-bench-host.d.ts +63 -0
- package/dist/worklets/_playback-bench-page.d.ts +65 -0
- package/dist/worklets/_tts-trace-harness.d.ts +142 -0
- package/dist/worklets/_worklet-test-utils.d.ts +27 -0
- package/dist/worklets/capture-processor.d.ts +4 -2
- package/dist/worklets/capture-processor.js +73 -33
- package/dist/worklets/playback-processor.d.ts +4 -2
- package/dist/worklets/playback-processor.js +258 -42
- package/package.json +59 -32
- package/styles.css +152 -30
- package/dist/_jsdom-setup.d.ts +0 -0
- package/dist/audio.d.ts +0 -45
- package/dist/audio.js +0 -121
- package/dist/client-context.d.ts +0 -33
- package/dist/client-context.js +0 -15
- package/dist/client-handler.d.ts +0 -43
- package/dist/components/app.d.ts +0 -23
- package/dist/components/app.js +0 -41
- package/dist/components/error-banner.d.ts +0 -21
- package/dist/components/error-banner.js +0 -27
- package/dist/components/message-bubble.d.ts +0 -23
- package/dist/components/message-bubble.js +0 -35
- package/dist/components/state-indicator.d.ts +0 -29
- package/dist/components/state-indicator.js +0 -37
- package/dist/components/thinking-indicator.d.ts +0 -16
- package/dist/components/thinking-indicator.js +0 -34
- package/dist/components/tool-icons.d.ts +0 -17
- package/dist/components/tool-icons.js +0 -128
- package/dist/components/transcript.d.ts +0 -25
- package/dist/components/transcript.js +0 -35
- package/dist/session-CWB7vmqz.js +0 -429
- package/dist/session.d.ts +0 -69
- package/dist/session.js +0 -2
- package/dist/signals.d.ts +0 -120
- package/dist/signals.js +0 -161
- package/dist/tsdown.config.d.ts +0 -2
- 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>;
|