@alexkroman1/aai-ui 16.1.0 → 18.0.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 (39) hide show
  1. package/README.md +3 -2
  2. package/dist/_page-shell.d.ts +11 -0
  3. package/dist/{chat-view-DsylXJsw.js → chat-view-P12pHKQU.js} +1 -1
  4. package/dist/{client-config-DJQHnYjm.js → client-config-CFhkMkmv.js} +15 -13
  5. package/dist/client-config.d.ts +14 -13
  6. package/dist/components/chat-view.js +1 -1
  7. package/dist/components/controls.js +1 -1
  8. package/dist/components/message-list.js +1 -1
  9. package/dist/components/tool-call-block.js +1 -1
  10. package/dist/context.d.ts +27 -5
  11. package/dist/context.js +3 -3
  12. package/dist/default-client/assets/index-5XG8PqGw.css +2 -0
  13. package/dist/default-client/assets/index-tc-nAWq3.js +121 -0
  14. package/dist/default-client/index.html +2 -2
  15. package/dist/default-client.d.ts +21 -0
  16. package/dist/define-client.js +4 -4
  17. package/dist/hooks.d.ts +19 -9
  18. package/dist/hooks.js +1 -1
  19. package/dist/index.d.ts +17 -13
  20. package/dist/index.js +734 -433
  21. package/dist/internal.js +3 -3
  22. package/dist/{message-list-BLyPRS1Q.js → message-list-CJX560b5.js} +1 -1
  23. package/dist/page.d.ts +47 -21
  24. package/dist/{session-core-gwePM95B.js → session-core-TOdm_Con.js} +424 -174
  25. package/dist/session-core-audio-effects.d.ts +26 -0
  26. package/dist/session-core-audio-setup.d.ts +38 -31
  27. package/dist/session-core-audio-state.d.ts +152 -0
  28. package/dist/session-core-messages.d.ts +9 -10
  29. package/dist/session-core-types.d.ts +60 -21
  30. package/dist/session-core-user-turn.d.ts +30 -0
  31. package/dist/session-core.js +1 -1
  32. package/dist/use-push-to-talk.d.ts +105 -0
  33. package/dist/{use-workflow-run-CNahvlgL.js → use-workflow-run-ZqJWJn2-.js} +24 -11
  34. package/dist/workflow-client.d.ts +26 -12
  35. package/package.json +2 -2
  36. package/dist/default-client/assets/index-CMh4E-Ci.css +0 -2
  37. package/dist/default-client/assets/index-eOmPq2sS.js +0 -284
  38. package/dist/{tool-call-block-C2t_5fpp.js → tool-call-block-4gXoL_eP.js} +1 -1
  39. package/dist/{url-chips-D62RTz7v.js → url-chips-0n35fPJY.js} +1 -1
package/dist/internal.js CHANGED
@@ -1,8 +1,8 @@
1
- import { r as loadClientConfig, t as buildAgentUrl } from "./client-config-DJQHnYjm.js";
1
+ import { r as loadClientConfig, t as buildAgentUrl } from "./client-config-CFhkMkmv.js";
2
2
  import { SessionProvider, ThemeProvider } from "./context.js";
3
- import { n as SessionUrlChips, r as UiUrlChip, t as ApiUrlChip } from "./url-chips-D62RTz7v.js";
3
+ import { n as SessionUrlChips, r as UiUrlChip, t as ApiUrlChip } from "./url-chips-0n35fPJY.js";
4
4
  import { t as TRANSCRIBING_PLACEHOLDER } from "./use-user-transcript-uyHhzy4d.js";
5
5
  import { t as ToolConfigContext } from "./tool-config-context-Es4YUzV2.js";
6
- import { i as DEFAULT_PROGRESS_POLL_MS, n as MAX_MISSING_READS, t as DEFAULT_WORKFLOW_POLL_MS } from "./use-workflow-run-CNahvlgL.js";
6
+ import { i as DEFAULT_PROGRESS_POLL_MS, n as MAX_MISSING_READS, t as DEFAULT_WORKFLOW_POLL_MS } from "./use-workflow-run-ZqJWJn2-.js";
7
7
  import { VOICE_CAPTURE_CONSTRAINTS } from "./types.js";
8
8
  export { ApiUrlChip, DEFAULT_PROGRESS_POLL_MS, DEFAULT_WORKFLOW_POLL_MS, MAX_MISSING_READS, SessionProvider, SessionUrlChips, TRANSCRIBING_PLACEHOLDER, ThemeProvider, ToolConfigContext, UiUrlChip, VOICE_CAPTURE_CONSTRAINTS, buildAgentUrl, loadClientConfig };
@@ -1,7 +1,7 @@
1
1
  import { useSessionSelector, useTheme } from "./context.js";
2
2
  import { a as inkTint, o as primaryTint } from "./_colors-CpZO-88A.js";
3
3
  import { n as useUserTranscript } from "./use-user-transcript-uyHhzy4d.js";
4
- import { n as ToolCallRow, t as ToolCallBlock } from "./tool-call-block-C2t_5fpp.js";
4
+ import { n as ToolCallRow, t as ToolCallBlock } from "./tool-call-block-4gXoL_eP.js";
5
5
  import clsx from "clsx";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { StickToBottom } from "use-stick-to-bottom";
package/dist/page.d.ts CHANGED
@@ -14,7 +14,13 @@
14
14
  * Authoring is otherwise identical — the file is still `client.tsx`, still
15
15
  * React, still Tailwind, still the same theme tokens — so a workflow app reads
16
16
  * like every other agent. What it reaches for instead of `useSession()` is
17
- * `createWorkflowApi()` / `useWorkflowRun()`.
17
+ * `useWorkflowSubmit()` / `useWorkflowRun()`, neither of which needs a client
18
+ * built for it.
19
+ *
20
+ * And `component` is OPTIONAL, the way `mountClient()`'s is: with none, this
21
+ * mounts the generated shell in `_page-shell.tsx`. That is also what a workflow
22
+ * app with NO `client.tsx` at all now gets — `default-client.tsx`, the prebuilt
23
+ * page, branches on the agent's declared front door and mounts this.
18
24
  */
19
25
  import { type ComponentType } from "react";
20
26
  import type { ClientTheme } from "./types.ts";
@@ -25,10 +31,17 @@ import type { ClientTheme } from "./types.ts";
25
31
  */
26
32
  export type PageConfig = {
27
33
  /**
28
- * The root component. Required — a workflow app has no default shell to fall
29
- * back to, because there is no session for one to render.
34
+ * The root component, rendered instead of the generated shell.
35
+ *
36
+ * **Optional**, the way `mountClient()`'s is: leave it out and `mountPage()`
37
+ * renders a form per declared workflow, the run's progress, its failure and
38
+ * its output — see `_page-shell.tsx` for what that shell is composed of and
39
+ * why it is deliberately functional rather than designed. It was REQUIRED,
40
+ * because "a workflow app has no default shell to fall back to" — true of a
41
+ * session and false of the page, and it cost the six shipped workflow
42
+ * templates 220-511 lines each of the same composition.
30
43
  */
31
- component: ComponentType;
44
+ component?: ComponentType;
32
45
  /** CSS selector or DOM element to render into. Defaults to `"#app"`. */
33
46
  target?: string | HTMLElement;
34
47
  /**
@@ -53,28 +66,41 @@ export type PageHandle = {
53
66
  /**
54
67
  * Mount a page for an agent whose work happens in workflows.
55
68
  *
56
- * There is deliberately no session, no microphone, and no socket: the component
57
- * talks to the agent over the workflow HTTP API
58
- * (`createWorkflowApi`/`useWorkflowRun`), which is durable and outlives the tab.
69
+ * There is deliberately no session, no microphone, and no socket: the page talks
70
+ * to the agent over the workflow HTTP API (`useWorkflowSubmit`/`useWorkflowRun`),
71
+ * which is durable and outlives the tab.
72
+ *
73
+ * **Config only:** leave `component` out and the generated shell renders — a
74
+ * form per declared workflow, the run's progress, its failure, its output.
75
+ *
76
+ * **A custom component:** pass `component` and it is rendered inside the theme
77
+ * provider instead. The pieces the default shell is built from are all published
78
+ * (`useWorkflows`, `<WorkflowFields>`, `useWorkflowSubmit`,
79
+ * `<WorkflowProgress>`, `<WorkflowRunError>`), so replacing the shell does not
80
+ * mean starting from `fetch`.
59
81
  *
60
- * @example
82
+ * @example The default shell
61
83
  * ```tsx
62
- * import { createWorkflowApi, mountPage, useWorkflowRun } from "@alexkroman1/aai-ui";
63
- * import { useState } from "react";
84
+ * import { mountPage } from "@alexkroman1/aai-ui";
64
85
  *
65
- * // Hoisted: a client built in render is a new object every render.
66
- * const api = createWorkflowApi();
86
+ * mountPage({ name: "Digest" });
87
+ * ```
88
+ *
89
+ * @example A custom component
90
+ * ```tsx
91
+ * import { mountPage, useWorkflows } from "@alexkroman1/aai-ui";
67
92
  *
68
93
  * function App() {
69
- * const [runId, setRunId] = useState<string>();
70
- * const { run } = useWorkflowRun(runId, { api });
94
+ * // No client to build and none to hoist: every workflow hook defaults to one
95
+ * // aimed at the agent serving this page, built lazily and once.
96
+ * const { workflows, loading } = useWorkflows();
97
+ * if (loading) return <p>Loading…</p>;
71
98
  * return (
72
- * <button
73
- * type="button"
74
- * onClick={() => void api.start("digest", { topic: "ai" }).then(setRunId)}
75
- * >
76
- * {run ? run.status : "Start"}
77
- * </button>
99
+ * <ul>
100
+ * {workflows.map((entry) => (
101
+ * <li key={entry.name}>{entry.description ?? entry.name}</li>
102
+ * ))}
103
+ * </ul>
78
104
  * );
79
105
  * }
80
106
  *
@@ -85,4 +111,4 @@ export type PageHandle = {
85
111
  *
86
112
  * @public
87
113
  */
88
- export declare function mountPage(config: PageConfig): PageHandle;
114
+ export declare function mountPage(config?: PageConfig): PageHandle;