@alexkroman1/aai-ui 0.16.0 → 0.18.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 (123) hide show
  1. package/README.md +6 -7
  2. package/dist/_submission-timing.d.ts +40 -0
  3. package/dist/_submission.d.ts +56 -0
  4. package/dist/_theme.d.ts +17 -0
  5. package/dist/_theme.test-d.d.ts +14 -0
  6. package/dist/{_utils-Mi-SCFA1.js → _utils-BlZBJPdj.js} +4 -5
  7. package/dist/_utils.d.ts +4 -5
  8. package/dist/agent-state-labels.d.ts +8 -3
  9. package/dist/agent-state.d.ts +4 -2
  10. package/dist/append-dictation.d.ts +23 -0
  11. package/dist/audio/dictation.d.ts +36 -0
  12. package/dist/audio/index.d.ts +4 -2
  13. package/dist/audio/index.js +44 -1
  14. package/dist/{chat-view-DIwPoAEG.js → chat-view-BwKpF0MN.js} +65 -45
  15. package/dist/{client-config-C7fQrioM.js → client-config-DcMCWmkO.js} +8 -13
  16. package/dist/client-config.d.ts +29 -10
  17. package/dist/components/_form-readiness.d.ts +2 -1
  18. package/dist/components/audio-result.d.ts +2 -0
  19. package/dist/components/bullet-list.d.ts +1 -0
  20. package/dist/components/button.d.ts +2 -2
  21. package/dist/components/button.js +1 -1
  22. package/dist/components/chat-view.js +1 -2
  23. package/dist/components/console-shell.d.ts +8 -5
  24. package/dist/components/controls.d.ts +1 -0
  25. package/dist/components/controls.js +2 -2
  26. package/dist/components/conversation-view.d.ts +1 -0
  27. package/dist/components/facts.d.ts +1 -0
  28. package/dist/components/form-fields.d.ts +31 -12
  29. package/dist/components/form-types.d.ts +48 -2
  30. package/dist/components/form.d.ts +10 -5
  31. package/dist/components/markdown.d.ts +1 -0
  32. package/dist/components/message-list.d.ts +1 -0
  33. package/dist/components/message-list.js +1 -2
  34. package/dist/components/session-controls.d.ts +7 -2
  35. package/dist/components/session-error-banner.d.ts +1 -0
  36. package/dist/components/session-state-dot.d.ts +45 -20
  37. package/dist/components/sidebar-layout.d.ts +2 -2
  38. package/dist/components/sidebar-layout.js +1 -1
  39. package/dist/components/start-screen.js +2 -2
  40. package/dist/components/tool-call-block.d.ts +3 -3
  41. package/dist/components/tool-call-block.js +1 -2
  42. package/dist/components/tool-call-row.d.ts +1 -0
  43. package/dist/components/tool-config-context.d.ts +23 -5
  44. package/dist/components/url-chips.d.ts +4 -3
  45. package/dist/components/workflow-fields.d.ts +36 -11
  46. package/dist/components/workflow-pending-note.d.ts +31 -12
  47. package/dist/components/workflow-run-error.d.ts +1 -0
  48. package/dist/components/workflow-run-panel.d.ts +1 -0
  49. package/dist/context-BF0KsI9X.js +473 -0
  50. package/dist/context.d.ts +8 -7
  51. package/dist/context.js +1 -381
  52. package/dist/default-client/assets/audio-CtBvSS3L.js +1 -0
  53. package/dist/default-client/assets/{capture-processor-CXCWxCO8.js → capture-processor-BZXisGjZ.js} +1 -1
  54. package/dist/default-client/assets/index-BkjCv4MX.css +2 -0
  55. package/dist/default-client/assets/index-DUQoaxdq.js +127 -0
  56. package/dist/default-client/assets/{playback-processor-DXHfyQD9.js → playback-processor-BHk-iXEU.js} +1 -1
  57. package/dist/default-client/index.html +2 -2
  58. package/dist/default-client.d.ts +1 -3
  59. package/dist/define-client.d.ts +32 -28
  60. package/dist/define-client.js +85 -44
  61. package/dist/dictation-transcriber.d.ts +49 -0
  62. package/dist/{eyebrow-UfmSz9yy.js → eyebrow-Bp4y1rZ9.js} +1 -1
  63. package/dist/{hooks-DN4gHYsj.js → hooks-1CoQY_Fc.js} +2 -2
  64. package/dist/hooks.js +1 -2
  65. package/dist/inbox-protocol.d.ts +14 -4
  66. package/dist/inbox.d.ts +1 -0
  67. package/dist/index.d.ts +12 -9
  68. package/dist/index.js +905 -277
  69. package/dist/internal.d.ts +1 -1
  70. package/dist/internal.js +6 -6
  71. package/dist/linked-client.d.ts +2 -0
  72. package/dist/{message-list-DHZcLhRA.js → message-list-BBHLK05X.js} +24 -13
  73. package/dist/page.d.ts +2 -0
  74. package/dist/phone.d.ts +1 -0
  75. package/dist/route-fetch.d.ts +8 -1
  76. package/dist/session/audio-setup.d.ts +1 -1
  77. package/dist/session/audio-state.d.ts +6 -6
  78. package/dist/session/index.js +1 -1
  79. package/dist/session/messages.d.ts +1 -9
  80. package/dist/session/preconnect.d.ts +1 -1
  81. package/dist/session/types.d.ts +4 -0
  82. package/dist/{session-CYdjRvbl.js → session-Rud8mmU-.js} +26 -15
  83. package/dist/stored-value.d.ts +2 -0
  84. package/dist/{tool-call-block-uXtMOUWN.js → tool-call-block-C8s6AhjS.js} +4 -4
  85. package/dist/tool-config-context-Bd-7xrfP.js +28 -0
  86. package/dist/types.d.ts +95 -6
  87. package/dist/{url-chips-oyy_Eiqh.js → url-chips-C_SHU6fq.js} +2 -2
  88. package/dist/use-client-runs.d.ts +2 -0
  89. package/dist/use-conversation-log.d.ts +2 -0
  90. package/dist/use-conversation.d.ts +24 -9
  91. package/dist/use-copy.d.ts +1 -0
  92. package/dist/use-dictation.d.ts +145 -0
  93. package/dist/use-download-url.d.ts +6 -1
  94. package/dist/use-flash.d.ts +1 -0
  95. package/dist/use-inbox.d.ts +2 -0
  96. package/dist/use-push-to-talk.d.ts +6 -1
  97. package/dist/use-route-mutation.d.ts +3 -0
  98. package/dist/use-route.d.ts +51 -7
  99. package/dist/use-run-key.d.ts +6 -1
  100. package/dist/use-session-controls.d.ts +1 -0
  101. package/dist/use-tap-to-talk.d.ts +5 -2
  102. package/dist/{use-user-transcript-uyHhzy4d.js → use-user-transcript-lOu_uMnf.js} +1 -1
  103. package/dist/use-user-transcript.d.ts +5 -1
  104. package/dist/use-workflow-form.d.ts +76 -167
  105. package/dist/use-workflow-progress.d.ts +5 -0
  106. package/dist/{use-workflow-run-DdhWmbx-.js → use-workflow-run-BTEemod0.js} +2 -2
  107. package/dist/use-workflow-run.d.ts +5 -0
  108. package/dist/use-workflow-runs.d.ts +18 -4
  109. package/dist/use-workflow-stream.d.ts +33 -7
  110. package/dist/use-workflows.d.ts +10 -2
  111. package/dist/workflow-client.d.ts +5 -0
  112. package/dist/workflow-def-types.d.ts +18 -2
  113. package/dist/workflow-field-kind.d.ts +66 -10
  114. package/dist/workflow-submission.d.ts +265 -0
  115. package/dist/worklets/capture-processor.d.ts +3 -3
  116. package/dist/worklets/capture-processor.js +2 -2
  117. package/dist/worklets/playback-processor.d.ts +3 -3
  118. package/dist/worklets/playback-processor.js +2 -2
  119. package/package.json +2 -2
  120. package/dist/default-client/assets/audio-DzwGxdv4.js +0 -1
  121. package/dist/default-client/assets/index-BOTLwsNO.js +0 -126
  122. package/dist/default-client/assets/index-_-x5JLLa.css +0 -2
  123. package/dist/tool-config-context-Es4YUzV2.js +0 -19
@@ -1,19 +1,37 @@
1
+ import { type Context } from "react";
1
2
  /**
2
- * Display configuration for a tool call in the UI.
3
+ * Display configuration for a tool call in the UI, keyed by tool name: the
4
+ * icon and label each tool declared with `tool({ ui })`, as the agent serves
5
+ * them in its `GET /client-config` body. `mountClient()` installs the served
6
+ * map as it is — a page has no map of its own to merge over it, so the tool's
7
+ * declaration is the one place a tool's icon lives.
3
8
  *
9
+ * Not on the package barrel: nothing an author writes names it (the value a
10
+ * page reads comes from the agent), so it is the context's value type only.
11
+ *
12
+ * @sealed
4
13
  * @public
5
14
  */
6
15
  export type ToolDisplayConfig = Record<string, {
7
- icon?: string;
8
- label?: string;
16
+ icon?: string | undefined;
17
+ label?: string | undefined;
9
18
  }>;
19
+ /**
20
+ * The value the context holds before the lookup lands (and forever, when the
21
+ * lookup fails): one frozen object, so the provider's value is stable across
22
+ * renders rather than a fresh `{}` per commit.
23
+ *
24
+ * @internal
25
+ */
26
+ export declare const EMPTY_TOOL_DISPLAY: ToolDisplayConfig;
10
27
  /**
11
28
  * Context for tool display configuration. Installed by `mountClient()` from
12
- * `ClientConfig.tools`; the built-in components read it via `useToolConfig`.
29
+ * the agent's `GET /client-config` `tools`; the built-in components read it
30
+ * via `useToolConfig`.
13
31
  *
14
32
  * @internal
15
33
  */
16
- export declare const ToolConfigContext: import("react").Context<ToolDisplayConfig>;
34
+ export declare const ToolConfigContext: Context<ToolDisplayConfig>;
17
35
  /**
18
36
  * Read tool display configuration from the nearest `ToolConfigContext.Provider`.
19
37
  *
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "react";
1
2
  /**
2
3
  * The session's shareable UI URL — the page this UI is served from, what
3
4
  * you'd send someone to talk to the agent.
@@ -6,7 +7,7 @@
6
7
  */
7
8
  export declare function UiUrlChip({ className }: {
8
9
  className?: string | undefined;
9
- }): import("react").JSX.Element;
10
+ }): JSX.Element;
10
11
  /**
11
12
  * The session's programmatic WebSocket endpoint — the URL a script or backend
12
13
  * can connect to directly instead of using this UI.
@@ -15,7 +16,7 @@ export declare function UiUrlChip({ className }: {
15
16
  */
16
17
  export declare function ApiUrlChip({ className }: {
17
18
  className?: string | undefined;
18
- }): import("react").JSX.Element;
19
+ }): JSX.Element;
19
20
  /**
20
21
  * The UI and API URLs side by side. They answer the same question — "how do I
21
22
  * reach this agent?" — so they belong together and each needs its label to be
@@ -26,4 +27,4 @@ export declare function ApiUrlChip({ className }: {
26
27
  */
27
28
  export declare function SessionUrlChips({ className }: {
28
29
  className?: string | undefined;
29
- }): import("react").JSX.Element;
30
+ }): JSX.Element;
@@ -1,6 +1,39 @@
1
1
  import type { WorkflowSummary } from "@alexkroman1/aai/workflow-api";
2
+ import { type JSX } from "react";
3
+ import type { WorkflowAppLike, WorkflowNameOf } from "../workflow-def-types.ts";
4
+ import { type WorkflowFieldRender } from "../workflow-field-kind.ts";
2
5
  /**
3
- * Render one field per scalar property of a workflow's input schema.
6
+ * Props for {@link WorkflowFields}.
7
+ *
8
+ * @typeParam App - The agent, when the page names it
9
+ * (`<WorkflowFields<typeof agentDef> workflow="digest" />`): `workflow` is
10
+ * then a name the agent declares, checked. Left to its default, any string:
11
+ * `WorkflowNameOf<WorkflowAppLike>` is `string`. The default is the
12
+ * constraint rather than the hooks' `never` because this is ONE signature —
13
+ * a form has no def form to fall to, so there is no second overload for a
14
+ * `never` to hand the call on to.
15
+ *
16
+ * @input
17
+ * @public
18
+ */
19
+ export type WorkflowFieldsProps<App extends WorkflowAppLike = WorkflowAppLike> = {
20
+ /**
21
+ * The workflow whose input schema to render. A NAME is looked up here (one
22
+ * `GET workflows`); a {@link WorkflowSummary} the page already holds fetches
23
+ * nothing. `undefined` renders nothing, so a page may pass a selection
24
+ * straight through before one is made.
25
+ */
26
+ workflow?: WorkflowSummary | WorkflowNameOf<App> | undefined;
27
+ /**
28
+ * The control to draw for a property, by name, where the schema alone does
29
+ * not say — `{ mustCover: "lines", source: "namedText" }`. Beats the schema
30
+ * for that property, never a declared upload. See `WorkflowFieldKind`.
31
+ */
32
+ render?: Readonly<Record<string, WorkflowFieldRender>> | undefined;
33
+ };
34
+ /**
35
+ * Render one field per property of a workflow's input schema that has an
36
+ * honest control — every scalar, an array of strings, a `{ name, text }` object.
4
37
  *
5
38
  * Pass the workflow's NAME and the schema is fetched here; pass a
6
39
  * {@link WorkflowSummary} you already hold and nothing is fetched. The name form
@@ -31,16 +64,8 @@ import type { WorkflowSummary } from "@alexkroman1/aai/workflow-api";
31
64
  * }
32
65
  * ```
33
66
  *
34
- * @param props - Field-set props.
67
+ * @param props - See {@link WorkflowFieldsProps}.
35
68
  *
36
69
  * @public
37
70
  */
38
- export declare function WorkflowFields({ workflow, }: {
39
- /**
40
- * The workflow whose input schema to render. A NAME is looked up here (one
41
- * `GET workflows`); a {@link WorkflowSummary} the page already holds fetches
42
- * nothing. `undefined` renders nothing, so a page may pass a selection
43
- * straight through before one is made.
44
- */
45
- workflow?: WorkflowSummary | string | undefined;
46
- }): import("react").JSX.Element | null;
71
+ export declare function WorkflowFields<App extends WorkflowAppLike = WorkflowAppLike>({ workflow, render, }: WorkflowFieldsProps<App>): JSX.Element | null;
@@ -1,20 +1,27 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { WorkflowRun } from "../workflow-client.ts";
3
+ import type { UploadStatus, WorkflowSubmissionScope } from "../workflow-submission.ts";
3
4
  /**
4
5
  * Props for {@link WorkflowPendingNote}.
5
6
  *
7
+ * @input
6
8
  * @public
7
9
  */
8
10
  export type WorkflowPendingNoteProps = {
9
11
  /**
10
12
  * The submission the page is rendering — `useWorkflowSubmit`'s or
11
- * `useWorkflowStream`'s result, or any object carrying these three fields.
12
- * Nothing renders while `pending` is false.
13
+ * `useWorkflowStream`'s result, or any object carrying the three required
14
+ * fields. Nothing renders while `pending` is false. `scope` and `upload`,
15
+ * when present, choose two more sentences — see below.
13
16
  */
14
17
  submission: {
15
18
  readonly pending: boolean;
16
19
  readonly startedHere: boolean;
17
20
  readonly run: WorkflowRun | undefined;
21
+ /** Who finds the run again — `WorkflowSubmission.scope`; the `scope` prop overrides it. */
22
+ readonly scope?: WorkflowSubmissionScope | undefined;
23
+ /** The bytes in flight — `WorkflowSubmission.upload`; a PAUSED one gets its own line. */
24
+ readonly upload?: UploadStatus | undefined;
18
25
  };
19
26
  /**
20
27
  * What the run produces, as the noun the sentences name: `"draft"`,
@@ -22,13 +29,16 @@ export type WorkflowPendingNoteProps = {
22
29
  */
23
30
  subject?: string | undefined;
24
31
  /**
25
- * Where the key that finds the run again lives. `"tab"` (the default) is
26
- * `useWorkflowSubmit`'s own `sessionStorage` key; `"browser"` is a page that
27
- * passed `useRunKey({ storage: "local" })`, whose runs any tab on this browser
28
- * can find — so the sentence says "this browser" and stops promising that
29
- * closing the tab loses anything.
32
+ * Where the key that finds the run again lives, overriding what the
33
+ * submission reports. `"tab"` is `useWorkflowSubmit`'s own `sessionStorage`
34
+ * key; `"browser"` is a page that passed `useRunKey({ storage: "local" })`,
35
+ * whose runs any tab on this browser can find — so the sentence says "this
36
+ * browser" and stops promising that closing the tab loses anything;
37
+ * `"none"` is a run nothing will find again (`recover: false`,
38
+ * `useWorkflowStream`), which the sentence has to say instead. Default: the
39
+ * submission's own `scope`, else `"tab"`.
30
40
  */
31
- scope?: "tab" | "browser" | undefined;
41
+ scope?: WorkflowSubmissionScope | undefined;
32
42
  /**
33
43
  * ADDED to the note's own `text-sm opacity-70` rather than replacing it.
34
44
  * There is no `tailwind-merge` in this package, so a class that CONFLICTS with
@@ -37,7 +47,7 @@ export type WorkflowPendingNoteProps = {
37
47
  className?: string | undefined;
38
48
  };
39
49
  /**
40
- * The one sentence a page says while a run is in flight — three situations,
50
+ * The one sentence a page says while a run is in flight — five situations,
41
51
  * one line each — as a muted line under the form, and nothing otherwise.
42
52
  *
43
53
  * Six template pages had each written the function under this, byte-identical
@@ -60,9 +70,18 @@ export type WorkflowPendingNoteProps = {
60
70
  *
61
71
  * `startedHere`, `run` and `pending` are what {@link WorkflowSubmission}
62
72
  * reports, which is why the prop is the submission itself rather than three
63
- * booleans a page would re-derive. A page with a FOURTH situation — a run that a
64
- * reload does not recover but ENDS, as `transcription-workflow`'s streaming
65
- * flow has — writes its own sentence, and that template is the one doing so.
73
+ * booleans a page would re-derive. The two situations past those three read
74
+ * two more of its fields, and used to be the one page that wrote its own note:
75
+ *
76
+ * - **A run nothing will find again** (`scope: "none"` — `useWorkflowStream`,
77
+ * whose run reads the recording as this page sends it and gives up on one
78
+ * that stops arriving, or `recover: false`): "keep this tab open", because
79
+ * a reload does not orphan that run, it ENDS it. A page telling a reader they
80
+ * can close the tab would be wrong in exactly that mode.
81
+ * - **A PAUSED upload** is that same fact arriving through a button, which is
82
+ * why it is tested first and why its two sentences differ: with no run yet
83
+ * a pause costs nothing, and in the streaming mode the run is already
84
+ * watching an upload it will give up on.
66
85
  *
67
86
  * @example
68
87
  * ```tsx
@@ -3,6 +3,7 @@ import type { WorkflowRun } from "../workflow-client.ts";
3
3
  /**
4
4
  * Props for {@link WorkflowRunError}.
5
5
  *
6
+ * @input
6
7
  * @public
7
8
  */
8
9
  export type WorkflowRunErrorProps = {
@@ -7,6 +7,7 @@ import { type WorkflowApi, type WorkflowRun } from "../workflow-client.ts";
7
7
  * @typeParam O - The run's output type; `run.output` narrows to it in the
8
8
  * completed slot.
9
9
  *
10
+ * @input
10
11
  * @public
11
12
  */
12
13
  export type WorkflowRunPanelProps<O> = {