@opengeni/react 0.15.0 → 0.23.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 (103) hide show
  1. package/README.md +110 -10
  2. package/dist/{chunk-TOJR776I.js → chunk-6XUS5VFM.js} +45 -369
  3. package/dist/chunk-6XUS5VFM.js.map +1 -0
  4. package/dist/chunk-CATATY77.js +2393 -0
  5. package/dist/chunk-CATATY77.js.map +1 -0
  6. package/dist/chunk-I3BJZIG5.js +439 -0
  7. package/dist/chunk-I3BJZIG5.js.map +1 -0
  8. package/dist/chunk-TK7G6XLT.js +18 -0
  9. package/dist/chunk-TK7G6XLT.js.map +1 -0
  10. package/dist/chunk-UAHPKLB6.js +2237 -0
  11. package/dist/chunk-UAHPKLB6.js.map +1 -0
  12. package/dist/chunk-UQS7OQDE.js +591 -0
  13. package/dist/chunk-UQS7OQDE.js.map +1 -0
  14. package/dist/chunk-YDNWMKXO.js +102 -0
  15. package/dist/chunk-YDNWMKXO.js.map +1 -0
  16. package/dist/composer-CVm5uoUI.d.ts +585 -0
  17. package/dist/composer.d.ts +6 -0
  18. package/dist/composer.js +56 -0
  19. package/dist/composer.js.map +1 -0
  20. package/dist/index.d.ts +1288 -1785
  21. package/dist/index.js +7140 -8817
  22. package/dist/index.js.map +1 -1
  23. package/dist/machines.d.ts +412 -3
  24. package/dist/machines.js +3 -1
  25. package/dist/noto-sans-arabic-loader-IA2T4X2A.js +21 -0
  26. package/dist/noto-sans-arabic-loader-IA2T4X2A.js.map +1 -0
  27. package/dist/noto-sans-jp-loader.generated-HFGLYBR3.js +292 -0
  28. package/dist/noto-sans-jp-loader.generated-HFGLYBR3.js.map +1 -0
  29. package/dist/queue-surface-implementation-3UW3MIIR.js +890 -0
  30. package/dist/queue-surface-implementation-3UW3MIIR.js.map +1 -0
  31. package/dist/session-Db00TRwl.d.ts +446 -0
  32. package/dist/session-context-rgrfElMl.d.ts +58 -0
  33. package/dist/session.d.ts +4 -0
  34. package/dist/session.js +54 -0
  35. package/dist/session.js.map +1 -0
  36. package/dist/use-composer-By1wn3MM.d.ts +99 -0
  37. package/package.json +20 -4
  38. package/src/approvals.ts +5 -3
  39. package/src/client.ts +44 -0
  40. package/src/components/approval-surface.tsx +198 -0
  41. package/src/components/chat-composer.tsx +94 -993
  42. package/src/components/code-editor.tsx +104 -26
  43. package/src/components/command-palette.tsx +8 -2
  44. package/src/components/composer-transcription-control.tsx +211 -0
  45. package/src/components/composer.tsx +1536 -0
  46. package/src/components/desktop-viewer.tsx +3 -3
  47. package/src/components/enrollment-consent.tsx +2 -2
  48. package/src/components/file-browser.tsx +367 -29
  49. package/src/components/human-input-form.tsx +417 -0
  50. package/src/components/machine-card.tsx +1 -1
  51. package/src/components/machines-dashboard.tsx +3 -3
  52. package/src/components/message-timeline.tsx +205 -25
  53. package/src/components/model-picker.tsx +12 -3
  54. package/src/components/pierre-diff.tsx +32 -6
  55. package/src/components/queue-draft-policy.ts +18 -0
  56. package/src/components/queue-surface-implementation.tsx +1037 -0
  57. package/src/components/queue-surface-state.tsx +94 -0
  58. package/src/components/queue-surface.tsx +42 -559
  59. package/src/components/sandbox-files.tsx +138 -14
  60. package/src/components/sandbox-terminal.tsx +8 -2
  61. package/src/components/sandbox-workspace.tsx +339 -119
  62. package/src/components/workbench-changes.tsx +84 -33
  63. package/src/components/workspace-dock.tsx +188 -18
  64. package/src/composer.ts +60 -0
  65. package/src/hooks/internal.ts +115 -34
  66. package/src/hooks/use-composer.ts +385 -104
  67. package/src/hooks/use-human-input.ts +131 -0
  68. package/src/hooks/use-machine-chip.ts +2 -2
  69. package/src/hooks/use-machines.ts +27 -11
  70. package/src/hooks/use-sandbox-files.ts +310 -62
  71. package/src/hooks/use-sandbox-git.ts +154 -40
  72. package/src/hooks/use-sandbox-terminal.ts +28 -6
  73. package/src/hooks/use-session-capabilities.ts +38 -9
  74. package/src/hooks/use-session-control.ts +37 -8
  75. package/src/hooks/use-session-events.ts +522 -48
  76. package/src/hooks/use-session-mcp-approval-policy.ts +161 -0
  77. package/src/hooks/use-slash-commands.ts +38 -38
  78. package/src/hooks/use-transcription.ts +757 -0
  79. package/src/hooks/use-turn-queue.ts +134 -66
  80. package/src/hooks/use-windowed-sections.ts +2 -2
  81. package/src/hooks/use-workspace-capture.ts +146 -40
  82. package/src/hooks/use-workspace-edit.ts +50 -14
  83. package/src/hooks/use-workspace-sessions.ts +3 -0
  84. package/src/human-input.ts +72 -0
  85. package/src/index.ts +85 -6
  86. package/src/lib/noto-sans-arabic-loader.ts +21 -0
  87. package/src/lib/noto-sans-jp-loader.generated.ts +295 -0
  88. package/src/lib/use-portal-token-style.ts +51 -0
  89. package/src/lib/use-unicode-fonts.ts +57 -0
  90. package/src/provider.tsx +4 -69
  91. package/src/session-context.ts +160 -0
  92. package/src/session.ts +89 -0
  93. package/src/timeline/parsers.ts +35 -0
  94. package/src/timeline/projection.ts +12 -4
  95. package/src/timeline/tool-renderers.tsx +41 -0
  96. package/src/timeline/turn-summary.tsx +2 -2
  97. package/src/timeline/types.ts +10 -9
  98. package/styles/index.css +56 -0
  99. package/styles/index.d.ts +2 -0
  100. package/styles/tokens.css +11 -6
  101. package/styles/tokens.d.ts +2 -0
  102. package/dist/chunk-TOJR776I.js.map +0 -1
  103. package/dist/machines-BpdwuQcD.d.ts +0 -449
@@ -0,0 +1,585 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { KeyboardEvent, ButtonHTMLAttributes, ClipboardEvent, RefObject, DragEvent, ChangeEvent, ComponentPropsWithoutRef, ReactNode } from 'react';
4
+ import * as _opengeni_sdk from '@opengeni/sdk';
5
+ import { Permission, SessionStatus, FileAsset, FileResourceRef, EffectiveSessionControl, ClientModel, TranscriptionLifecycleStatus, TranscriptionErrorCode, TranscriptionEvent, TranscriptionAdapter, WorkspaceTranscriptionPolicy, TranscriptionTargetSelection, TranscriptionDiagnostic, TranscriptionPolicyBlockReason } from '@opengeni/sdk';
6
+ import { S as SessionClientLike, C as ClientOverride } from './session-context-rgrfElMl.js';
7
+ import { C as ComposerState } from './use-composer-By1wn3MM.js';
8
+
9
+ /**
10
+ * The slash-command registry. A command is a SESSION / OPERATOR control — an
11
+ * action on the session or the UI (clear, compact, pause the goal, show help) —
12
+ * NOT a structured way to talk to the agent. The human↔agent channel stays
13
+ * plain chat; the palette only recognizes a leading "/" and never sends a
14
+ * command to the model.
15
+ *
16
+ * Two kinds, modeled by where the handler does its work:
17
+ * - CLIENT commands touch only the local UI (e.g. /help, /clear-view).
18
+ * - SERVER commands call the API through the SDK (e.g. /clear, /compact,
19
+ * /goal).
20
+ * Both are just `run(args, ctx)`; `ctx` exposes the client for server commands
21
+ * and the UI affordances (notice, openHelp, clearView, confirm) for both.
22
+ */
23
+ /** A positional argument a command accepts after its name. */
24
+ type SlashArg = {
25
+ name: string;
26
+ /** Enter runs only once every required arg is present; otherwise autocompletes. */
27
+ required?: boolean;
28
+ /** Closed value set (rendered as a hint; validated by the command itself). */
29
+ oneOf?: readonly string[];
30
+ description?: string;
31
+ };
32
+ /** Transient feedback surfaced in the composer (generalized error line). */
33
+ type Notice = {
34
+ tone: "ok" | "error";
35
+ message: string;
36
+ };
37
+ /** Everything a command handler can reach. Assembled by the composer. */
38
+ type CommandContext = {
39
+ /** SDK-shaped client for server commands. */
40
+ client: SessionClientLike;
41
+ workspaceId: string;
42
+ /** Null before a session exists (server commands should guard on this). */
43
+ sessionId: string | null;
44
+ status: SessionStatus | null;
45
+ /** The operator's permissions on this workspace (gates command visibility). */
46
+ permissions: Permission[];
47
+ /** Surface a transient ok/error notice in the composer. */
48
+ notice: (notice: Notice) => void;
49
+ /** Open the in-composer /help panel (rendered from the registry). */
50
+ openHelp: () => void;
51
+ /**
52
+ * Reset only the LOCAL timeline view — no server call. Returns whether a
53
+ * view-reset affordance was actually wired (and thus had an effect): the host
54
+ * surface supplies one via the composer's `onClearView` prop, and consoles
55
+ * that don't (no resettable local timeline) get `false`. The /clear-view
56
+ * command uses this to avoid reporting a false "cleared" success on a no-op.
57
+ */
58
+ clearView: () => boolean;
59
+ /** Show the danger confirm bar; resolves true once the operator confirms. */
60
+ confirm: () => Promise<boolean>;
61
+ };
62
+ type CommandResult = {
63
+ status: "ok" | "error";
64
+ message?: string;
65
+ /**
66
+ * Keep the composer draft instead of clearing it on an ok result. Used when a
67
+ * command resolves to a no-op the operator may want to retry — e.g. canceling
68
+ * the /clear confirm bar returns ok (no error) but must NOT wipe the typed
69
+ * "/clear" draft. Default false: a successful command clears the draft.
70
+ */
71
+ keepDraft?: boolean;
72
+ };
73
+ type SlashCommand = {
74
+ /** Primary token after the slash (no leading "/"). */
75
+ name: string;
76
+ /** Alternate tokens that resolve to this command. */
77
+ aliases?: readonly string[];
78
+ description: string;
79
+ args?: readonly SlashArg[];
80
+ /** Required permission; the command is hidden from the palette without it. */
81
+ permission?: Permission;
82
+ /** Destructive — the palette shows a confirm bar before running. */
83
+ danger?: boolean;
84
+ /**
85
+ * Dynamic availability beyond the permission gate (e.g. hide a server command
86
+ * until a session exists). Returning false hides the command.
87
+ */
88
+ available?: (ctx: Pick<CommandContext, "sessionId" | "status" | "permissions">) => boolean;
89
+ /** Execute the command. Throwing is caught and surfaced as an error notice. */
90
+ run: (args: string[], ctx: CommandContext) => Promise<CommandResult> | CommandResult;
91
+ };
92
+
93
+ /**
94
+ * Context the composer supplies for command execution and visibility. The
95
+ * composer owns the UI affordances (notice/openHelp/clearView/confirm), so they
96
+ * are NOT part of this slice — the hook closes over them via `handlers`.
97
+ */
98
+ type SlashCommandContext = Pick<CommandContext, "client" | "workspaceId" | "sessionId" | "status" | "permissions">;
99
+ /**
100
+ * UI affordances the composer supplies. `confirm` differs from the registry-
101
+ * facing {@link CommandContext.confirm} (which takes no args): the composer's
102
+ * confirm receives the command being run so the confirm bar renders from that
103
+ * exact command's identity. The hook bridges the two in {@link buildContext}.
104
+ */
105
+ type SlashCommandHandlers = Pick<CommandContext, "notice" | "openHelp" | "clearView"> & {
106
+ confirm: (command: SlashCommand) => Promise<boolean>;
107
+ };
108
+ type ConfirmState = {
109
+ command: SlashCommand;
110
+ /** Resolve the pending confirm() promise. */
111
+ resolve: (confirmed: boolean) => void;
112
+ } | null;
113
+ type UseSlashCommandsOptions = {
114
+ commands: readonly SlashCommand[];
115
+ context: SlashCommandContext | undefined;
116
+ handlers: SlashCommandHandlers;
117
+ /** The current composer draft. */
118
+ value: string;
119
+ /** Replace the composer draft (autocomplete writes through this). */
120
+ setValue: (value: string) => void;
121
+ };
122
+ type UseSlashCommandsResult = {
123
+ /** Whether the palette is open (a command token is being typed). */
124
+ open: boolean;
125
+ /**
126
+ * Whether the draft is a slash-command attempt (matches a registered command)
127
+ * — true even after Escape dismisses the popover. The composer blocks its send
128
+ * path while this holds so a command can't be delivered to the agent as chat.
129
+ */
130
+ isCommandDraft: boolean;
131
+ /** Commands shown for the current token + context, in display order. */
132
+ items: SlashCommand[];
133
+ /** Index into `items` of the highlighted row. */
134
+ highlight: number;
135
+ setHighlight: (index: number) => void;
136
+ /** The matched command once the name is closed by a space (arg-hint mode). */
137
+ activeCommand: SlashCommand | null;
138
+ /** The arg hint string for the active command (footer), or "". */
139
+ activeArgHint: string;
140
+ /**
141
+ * Key handler for the textarea. Returns true when it consumed the event
142
+ * (the composer must then NOT run its send path). Only consumes while open.
143
+ */
144
+ onKeyDown: (event: KeyboardEvent<HTMLTextAreaElement>) => boolean;
145
+ /** Run the highlighted command (or the active command in arg-hint mode). */
146
+ runHighlighted: () => Promise<void>;
147
+ /**
148
+ * Run the command at an explicitly chosen index (a pointer click on a row).
149
+ * Bypasses the exact-match token heuristic that runHighlighted uses for
150
+ * keyboard Enter, so an explicit click always runs the clicked command.
151
+ */
152
+ runAt: (index: number) => Promise<void>;
153
+ /** Autocomplete the highlighted command name + a trailing space. */
154
+ autocompleteHighlighted: () => void;
155
+ };
156
+ declare function useSlashCommands(options: UseSlashCommandsOptions): UseSlashCommandsResult;
157
+
158
+ type UseFileAttachmentsOptions = ClientOverride & {
159
+ /**
160
+ * Only files matching this predicate are accepted by {@link
161
+ * UseFileAttachmentsResult.addFromPaste} (the clipboard path). Defaults to
162
+ * `image/*` — the console's historical paste filter. {@link
163
+ * UseFileAttachmentsResult.addFiles} (the explicit picker / drop path)
164
+ * bypasses it.
165
+ */
166
+ pasteFilter?: ((file: File) => boolean) | undefined;
167
+ };
168
+ type FileAttachment = {
169
+ id: string;
170
+ name: string;
171
+ contentType: string;
172
+ sizeBytes: number;
173
+ status: "uploading" | "ready" | "failed";
174
+ /** The SDK `FileAsset` once the upload finishes. */
175
+ file?: FileAsset | undefined;
176
+ /** Object-URL for an inline preview; minted for `image/*` files only. */
177
+ previewUrl?: string | undefined;
178
+ error?: string | undefined;
179
+ };
180
+ type UseFileAttachmentsResult = {
181
+ attachments: FileAttachment[];
182
+ /**
183
+ * `FileResourceRef[]` for every attachment that finished uploading — feed
184
+ * straight into `useComposer`'s `sendExtras.resources`.
185
+ */
186
+ readyResources: FileResourceRef[];
187
+ /** True while any attachment is still uploading (drives the send-gate). */
188
+ uploading: boolean;
189
+ /** Explicit picker / drop path — uploads every file, no filter. */
190
+ addFiles: (files: Iterable<File>) => void;
191
+ /** Clipboard path — applies `pasteFilter` (default `image/*`) then uploads. */
192
+ addFromPaste: (event: {
193
+ clipboardData: DataTransfer | null;
194
+ }) => void;
195
+ /**
196
+ * Re-run the upload for a `failed` attachment, in place (same id, same
197
+ * source file). No-op for an id that isn't a known failed upload.
198
+ */
199
+ retry: (id: string) => void;
200
+ /** Remove one attachment; revokes its object-URL. */
201
+ remove: (id: string) => void;
202
+ /** Remove all; revokes every object-URL. Call from `useComposer`'s `onSent`. */
203
+ clear: () => void;
204
+ };
205
+ /**
206
+ * Upload-and-track state for files attached to the next message. Owns the
207
+ * full client-side upload layer: a per-file `uploading | ready | failed`
208
+ * status machine driven by the SDK's `client.uploadFile`, object-URL image
209
+ * previews with create/revoke lifecycle, the `image/*` clipboard paste filter,
210
+ * and a `FileResourceRef[]` projection that drops straight into a message's
211
+ * `resources`. Workspace-scoped, so it resolves both client and workspace from
212
+ * the {@link OpenGeniProvider} (or a per-call `{ client, workspaceId }`).
213
+ */
214
+ declare function useFileAttachments(options?: UseFileAttachmentsOptions): UseFileAttachmentsResult;
215
+
216
+ declare const OPEN_WORKSTREAM_CONTROL_EVENT = "opengeni:open-workstream-control";
217
+ type ComposerDelivery = Pick<ComposerState, "value" | "setValue" | "send" | "steer" | "sending" | "canSend" | "error" | "clearError">;
218
+ type ComposerDraftState = Pick<ComposerState, "draftConflict" | "draftSaving" | "resolveDraftConflict" | "restoredResources" | "removeRestoredResource">;
219
+ type ComposerControlState = Pick<ComposerState, "pause" | "pausing" | "resume" | "resumeScope" | "resuming">;
220
+ type ComposerControlLinks = {
221
+ workspaceHref?: string | undefined;
222
+ sessionHref?: ((sessionId: string) => string) | undefined;
223
+ };
224
+ type ChatComposerMessages = {
225
+ messagePlaceholder: string;
226
+ pausedPlaceholder: string;
227
+ inputLabel: string;
228
+ keyboardHint: string;
229
+ slashCommandBlocked: string;
230
+ controlChangedError: string;
231
+ sendFailedError: string;
232
+ dropFiles: string;
233
+ attachFiles: string;
234
+ pauseAriaLabel: string;
235
+ pauseTitle: string;
236
+ sendMessageAriaLabel: string;
237
+ sendAndResumeAriaLabel: string;
238
+ sendTitle: string;
239
+ sendAndResumeTitle: string;
240
+ workspacePaused: string;
241
+ pausedHere: string;
242
+ parentBlocker: string;
243
+ narrowerPause: string;
244
+ pausedBy: (displayName: string) => string;
245
+ queuedAhead: (count: number) => string;
246
+ resumingAndSending: string;
247
+ nextMessageResumes: string;
248
+ resumeThisWorkstream: string;
249
+ resumeShort: string;
250
+ hidePauseDetails: string;
251
+ showPauseDetails: string;
252
+ pauseReasonsLabel: string;
253
+ pausedByLabel: string;
254
+ alsoPausedByLabel: string;
255
+ resumeWorkspace: string;
256
+ resumeFromSession: string;
257
+ sessionCanRun: string;
258
+ stillPausedBy: (displayName: string) => string;
259
+ restoredResourcesLabel: string;
260
+ restoredFile: (fileId: string) => string;
261
+ removeRestoredResource: (index: number) => string;
262
+ uploading: string;
263
+ uploadFailed: string;
264
+ retryAttachment: (name: string) => string;
265
+ retryUpload: string;
266
+ removeAttachment: (name: string) => string;
267
+ confirmCommand: (name: string) => string;
268
+ confirmDescription: (command: SlashCommand) => string;
269
+ cancel: string;
270
+ runCommand: (name: string) => string;
271
+ commands: string;
272
+ slashCommandsLabel: string;
273
+ modelLabel: string;
274
+ close: string;
275
+ danger: string;
276
+ draftConflict: string;
277
+ useOtherDraft: string;
278
+ keepMine: string;
279
+ savingDraft: string;
280
+ formatBytes: (bytes: number) => string;
281
+ formatRelativeTime: (changedAt: string) => string;
282
+ };
283
+ declare const defaultChatComposerMessages: ChatComposerMessages;
284
+ type ComposerSubmitMode = "queue" | "steer";
285
+ type ComposerSubmitBlocker = "disabled" | "uploading" | "sending" | "command" | "empty" | null;
286
+ type UseChatComposerControllerOptions = {
287
+ delivery: ComposerDelivery;
288
+ draft?: ComposerDraftState | undefined;
289
+ control?: ComposerControlState | undefined;
290
+ effectiveControl?: EffectiveSessionControl | null | undefined;
291
+ queuedAheadCount?: number | undefined;
292
+ canControlWorkspace?: boolean | undefined;
293
+ controlLinks?: ComposerControlLinks | undefined;
294
+ disabled?: boolean | undefined;
295
+ attachments?: UseFileAttachmentsResult | undefined;
296
+ commands?: readonly SlashCommand[] | undefined;
297
+ commandContext?: SlashCommandContext | undefined;
298
+ onClearView?: (() => void) | undefined;
299
+ onPaste?: ((event: ClipboardEvent<HTMLTextAreaElement>) => void) | undefined;
300
+ messages?: Partial<ChatComposerMessages> | undefined;
301
+ };
302
+ /**
303
+ * Headless interaction layer for a chat composer. It is the single owner of
304
+ * delivery guards, keyboard routing, command interception, drag/drop, focus,
305
+ * confirmation, and feedback state used by both the preset and primitives.
306
+ */
307
+ declare function useChatComposerController({ delivery, draft, control, effectiveControl, queuedAheadCount, canControlWorkspace, controlLinks, disabled, attachments, commands, commandContext, onClearView, onPaste, messages: messageOverrides, }: UseChatComposerControllerOptions): {
308
+ id: string;
309
+ rootRef: RefObject<HTMLDivElement | null>;
310
+ textareaRef: RefObject<HTMLTextAreaElement | null>;
311
+ pauseButtonRef: RefObject<HTMLButtonElement | null>;
312
+ fileInputRef: RefObject<HTMLInputElement | null>;
313
+ listboxId: string;
314
+ effectiveControl: EffectiveSessionControl | null | undefined;
315
+ queuedAheadCount: number;
316
+ canControlWorkspace: boolean;
317
+ controlLinks: ComposerControlLinks | undefined;
318
+ disabled: boolean;
319
+ attachments: UseFileAttachmentsResult | undefined;
320
+ messages: {
321
+ messagePlaceholder: string;
322
+ pausedPlaceholder: string;
323
+ inputLabel: string;
324
+ keyboardHint: string;
325
+ slashCommandBlocked: string;
326
+ controlChangedError: string;
327
+ sendFailedError: string;
328
+ dropFiles: string;
329
+ attachFiles: string;
330
+ pauseAriaLabel: string;
331
+ pauseTitle: string;
332
+ sendMessageAriaLabel: string;
333
+ sendAndResumeAriaLabel: string;
334
+ sendTitle: string;
335
+ sendAndResumeTitle: string;
336
+ workspacePaused: string;
337
+ pausedHere: string;
338
+ parentBlocker: string;
339
+ narrowerPause: string;
340
+ pausedBy: (displayName: string) => string;
341
+ queuedAhead: (count: number) => string;
342
+ resumingAndSending: string;
343
+ nextMessageResumes: string;
344
+ resumeThisWorkstream: string;
345
+ resumeShort: string;
346
+ hidePauseDetails: string;
347
+ showPauseDetails: string;
348
+ pauseReasonsLabel: string;
349
+ pausedByLabel: string;
350
+ alsoPausedByLabel: string;
351
+ resumeWorkspace: string;
352
+ resumeFromSession: string;
353
+ sessionCanRun: string;
354
+ stillPausedBy: (displayName: string) => string;
355
+ restoredResourcesLabel: string;
356
+ restoredFile: (fileId: string) => string;
357
+ removeRestoredResource: (index: number) => string;
358
+ uploading: string;
359
+ uploadFailed: string;
360
+ retryAttachment: (name: string) => string;
361
+ retryUpload: string;
362
+ removeAttachment: (name: string) => string;
363
+ confirmCommand: (name: string) => string;
364
+ confirmDescription: (command: SlashCommand) => string;
365
+ cancel: string;
366
+ runCommand: (name: string) => string;
367
+ commands: string;
368
+ slashCommandsLabel: string;
369
+ modelLabel: string;
370
+ close: string;
371
+ danger: string;
372
+ draftConflict: string;
373
+ useOtherDraft: string;
374
+ keepMine: string;
375
+ savingDraft: string;
376
+ formatBytes: (bytes: number) => string;
377
+ formatRelativeTime: (changedAt: string) => string;
378
+ };
379
+ sending: boolean;
380
+ error: Error | null;
381
+ clearError: () => void;
382
+ hasDraftState: boolean;
383
+ draftConflict: Error | null;
384
+ draftSaving: boolean;
385
+ restoredResources: _opengeni_sdk.ResourceRef[];
386
+ removeRestoredResource: ((index: number) => void) | undefined;
387
+ resolveDraftConflict: ((choice: "keep_mine" | "use_remote") => Promise<void>) | undefined;
388
+ hasControl: boolean;
389
+ pausing: boolean;
390
+ resuming: boolean;
391
+ pause: (reason?: string) => Promise<boolean>;
392
+ resume: (reason?: string) => Promise<boolean>;
393
+ resumeScope: (option: EffectiveSessionControl["resumeOptions"][number]) => Promise<boolean>;
394
+ paused: boolean;
395
+ controlDetailsOpen: boolean;
396
+ setControlDetailsOpen: react.Dispatch<react.SetStateAction<boolean>>;
397
+ paletteMounted: boolean;
398
+ setPaletteMounted: react.Dispatch<react.SetStateAction<boolean>>;
399
+ dragging: boolean;
400
+ handleDragOver: (event: DragEvent<HTMLDivElement>) => void;
401
+ handleDragLeave: (event: DragEvent<HTMLDivElement>) => void;
402
+ handleDrop: (event: DragEvent<HTMLDivElement>) => void;
403
+ palette: UseSlashCommandsResult;
404
+ paletteEnabled: boolean;
405
+ commandDraftBlocked: boolean;
406
+ confirmState: ConfirmState;
407
+ settleConfirmation: (confirmed: boolean) => void;
408
+ helpOpen: boolean;
409
+ setHelpOpen: react.Dispatch<react.SetStateAction<boolean>>;
410
+ helpCommands: SlashCommand[];
411
+ activeNotice: Notice | null;
412
+ canSubmit: boolean;
413
+ submitBlocker: ComposerSubmitBlocker;
414
+ submit: (mode: ComposerSubmitMode) => Promise<boolean>;
415
+ handleKeyDown: (event: KeyboardEvent<HTMLTextAreaElement>) => void;
416
+ handlePaste: (event: ClipboardEvent<HTMLTextAreaElement>) => void;
417
+ handleFileChange: (event: ChangeEvent<HTMLInputElement>) => void;
418
+ focusInput: () => void | undefined;
419
+ setValue: (value: string) => void;
420
+ value: string;
421
+ };
422
+ type ChatComposerController = ReturnType<typeof useChatComposerController>;
423
+ type ChatComposerContextValue = Pick<ChatComposerController, "id" | "value" | "setValue" | "focusInput" | "submit" | "canSubmit" | "submitBlocker" | "disabled" | "sending" | "error" | "clearError" | "attachments" | "messages" | "effectiveControl" | "paused" | "hasControl" | "pausing" | "resuming" | "pause" | "resume" | "resumeScope">;
424
+ /** Read the nearest compound composer's safe accessory-facing state and actions. */
425
+ declare function useChatComposer(): ChatComposerContextValue;
426
+ type ComposerRootProps = Omit<ComponentPropsWithoutRef<"div">, "children"> & {
427
+ controller: ChatComposerController;
428
+ children: ReactNode;
429
+ };
430
+ declare const Root: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children"> & {
431
+ controller: ChatComposerController;
432
+ children: ReactNode;
433
+ } & react.RefAttributes<HTMLDivElement>>;
434
+ type ComposerFrameProps = ComponentPropsWithoutRef<"div">;
435
+ declare const Frame: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
436
+ type ComposerCommandPaletteProps = {
437
+ className?: string | undefined;
438
+ };
439
+ declare function CommandPalette({ className }: ComposerCommandPaletteProps): react_jsx_runtime.JSX.Element | null;
440
+ type OwnedSurfaceProps = "onDragOver" | "onDragLeave" | "onDrop";
441
+ type ComposerSurfaceProps = Omit<ComponentPropsWithoutRef<"div">, OwnedSurfaceProps>;
442
+ declare const Surface: react.ForwardRefExoticComponent<ComposerSurfaceProps & react.RefAttributes<HTMLDivElement>>;
443
+ declare function PausedState(): react_jsx_runtime.JSX.Element | null;
444
+ declare function RestoredResources(): react_jsx_runtime.JSX.Element | null;
445
+ declare function Attachments(): react_jsx_runtime.JSX.Element | null;
446
+ type OwnedInputProps = "value" | "defaultValue" | "onChange" | "onKeyDown" | "onPaste" | "disabled" | "aria-autocomplete" | "aria-controls" | "aria-activedescendant" | "aria-keyshortcuts";
447
+ type ComposerInputProps = Omit<ComponentPropsWithoutRef<"textarea">, OwnedInputProps>;
448
+ declare const Input: react.ForwardRefExoticComponent<ComposerInputProps & react.RefAttributes<HTMLTextAreaElement>>;
449
+ declare function Confirmation(): react_jsx_runtime.JSX.Element | null;
450
+ type ComposerFooterProps = ComponentPropsWithoutRef<"div">;
451
+ declare const Footer: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
452
+ type ComposerControlsProps = ComponentPropsWithoutRef<"span">;
453
+ declare const Controls: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & react.RefAttributes<HTMLSpanElement>>;
454
+ type ComposerHintProps = ComponentPropsWithoutRef<"span">;
455
+ declare const Hint: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & react.RefAttributes<HTMLSpanElement>>;
456
+ type ComposerActionsProps = ComponentPropsWithoutRef<"span">;
457
+ declare const Actions: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & react.RefAttributes<HTMLSpanElement>>;
458
+ type OwnedButtonProps = "type" | "onClick" | "disabled";
459
+ type ComposerAttachButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, OwnedButtonProps> & {
460
+ accept?: string | undefined;
461
+ multiple?: boolean | undefined;
462
+ };
463
+ declare const AttachButton: react.ForwardRefExoticComponent<Omit<ButtonHTMLAttributes<HTMLButtonElement>, OwnedButtonProps> & {
464
+ accept?: string | undefined;
465
+ multiple?: boolean | undefined;
466
+ } & react.RefAttributes<HTMLButtonElement>>;
467
+ type ComposerModelPickerProps = {
468
+ models: ClientModel[];
469
+ value?: string | undefined;
470
+ onChange?: ((modelId: string) => void) | undefined;
471
+ label?: string | undefined;
472
+ className?: string | undefined;
473
+ };
474
+ declare function ModelPicker({ models, value, onChange, label, className, }: ComposerModelPickerProps): react_jsx_runtime.JSX.Element;
475
+ type ComposerPauseButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, OwnedButtonProps>;
476
+ declare const PauseButton: react.ForwardRefExoticComponent<ComposerPauseButtonProps & react.RefAttributes<HTMLButtonElement>>;
477
+ type ComposerSendButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, OwnedButtonProps>;
478
+ declare const SendButton: react.ForwardRefExoticComponent<ComposerSendButtonProps & react.RefAttributes<HTMLButtonElement>>;
479
+ declare function Help(): react_jsx_runtime.JSX.Element;
480
+ declare function Status(): react_jsx_runtime.JSX.Element;
481
+
482
+ type TranscriptionControlState = {
483
+ status: TranscriptionLifecycleStatus;
484
+ generation: number;
485
+ localSessionId: string | null;
486
+ providerSessionId: string | null;
487
+ lastSequence: number;
488
+ partial: string;
489
+ error: {
490
+ code: TranscriptionErrorCode;
491
+ recoverable: boolean;
492
+ } | null;
493
+ acceptedFinalIds: string[];
494
+ audioMilliseconds: number;
495
+ costUsd: number | null;
496
+ };
497
+ declare const INITIAL_TRANSCRIPTION_CONTROL_STATE: TranscriptionControlState;
498
+ type TranscriptionControlAction = {
499
+ type: "start";
500
+ generation: number;
501
+ localSessionId: string;
502
+ } | {
503
+ type: "event";
504
+ generation: number;
505
+ event: TranscriptionEvent;
506
+ } | {
507
+ type: "start.failed";
508
+ generation: number;
509
+ code: TranscriptionErrorCode;
510
+ } | {
511
+ type: "cancel";
512
+ generation: number;
513
+ } | {
514
+ type: "cancel.settled";
515
+ generation: number;
516
+ } | {
517
+ type: "reset";
518
+ };
519
+ type TranscriptionControlTransition = {
520
+ state: TranscriptionControlState;
521
+ /** A newly accepted final to append to the current editable draft once. */
522
+ commit: string | null;
523
+ };
524
+ declare function transitionTranscriptionControl(state: TranscriptionControlState, action: TranscriptionControlAction): TranscriptionControlTransition;
525
+ declare function appendFinalTranscript(draft: string, transcript: string): string;
526
+ type UseTranscriptionOptions = {
527
+ adapter: TranscriptionAdapter | null;
528
+ policy: WorkspaceTranscriptionPolicy;
529
+ selection?: TranscriptionTargetSelection | undefined;
530
+ value: string;
531
+ setValue: (value: string) => void;
532
+ focusInput: () => void;
533
+ disabled?: boolean | undefined;
534
+ createLocalSessionId?: (() => string) | undefined;
535
+ lifecycleTimeouts?: Partial<TranscriptionLifecycleTimeouts> | undefined;
536
+ /** Receives bounded, redacted diagnostics; this detail is never rendered by the hook. */
537
+ onDiagnostic?: ((diagnostic: TranscriptionDiagnostic) => void) | undefined;
538
+ };
539
+ type TranscriptionLifecycleTimeouts = {
540
+ startMs: number;
541
+ cleanupMs: number;
542
+ };
543
+ type UseTranscriptionResult = {
544
+ state: TranscriptionControlState;
545
+ available: boolean;
546
+ unavailableReason: TranscriptionPolicyBlockReason | "adapter_missing" | "composer_disabled" | null;
547
+ start: () => Promise<boolean>;
548
+ cancel: () => Promise<boolean>;
549
+ reset: () => void;
550
+ };
551
+ declare function useTranscription({ adapter, policy, selection, value, setValue, focusInput, disabled, createLocalSessionId, lifecycleTimeouts, onDiagnostic, }: UseTranscriptionOptions): UseTranscriptionResult;
552
+
553
+ type ComposerTranscriptionMessages = {
554
+ start: string;
555
+ stop: string;
556
+ retry: string;
557
+ requestingPermission: string;
558
+ listening: string;
559
+ reconnecting: string;
560
+ cancelling: string;
561
+ unavailableDisabled: string;
562
+ unavailableAdapter: string;
563
+ unavailablePolicy: string;
564
+ errorPermissionDenied: string;
565
+ errorNotSupported: string;
566
+ errorNetwork: string;
567
+ errorProvider: string;
568
+ errorPolicyBlocked: string;
569
+ errorTimeout: string;
570
+ errorCancelled: string;
571
+ errorUnknown: string;
572
+ };
573
+ type ComposerTranscriptionControlProps = {
574
+ adapter: TranscriptionAdapter | null;
575
+ policy: WorkspaceTranscriptionPolicy;
576
+ selection?: TranscriptionTargetSelection | undefined;
577
+ messages?: Partial<ComposerTranscriptionMessages> | undefined;
578
+ className?: string | undefined;
579
+ lifecycleTimeouts?: Partial<TranscriptionLifecycleTimeouts> | undefined;
580
+ onDiagnostic?: ((diagnostic: TranscriptionDiagnostic) => void) | undefined;
581
+ };
582
+ /** One provider-neutral microphone control for the nearest editable composer. */
583
+ declare function ComposerTranscriptionControl({ adapter, policy, selection, messages: overrides, className, lifecycleTimeouts, onDiagnostic, }: ComposerTranscriptionControlProps): react_jsx_runtime.JSX.Element;
584
+
585
+ export { type ComposerSubmitMode as $, Actions as A, type ChatComposerController as B, type ComposerControlLinks as C, CommandPalette as D, type ComposerActionsProps as E, type FileAttachment as F, type ComposerAttachButtonProps as G, type ComposerCommandPaletteProps as H, INITIAL_TRANSCRIPTION_CONTROL_STATE as I, type ComposerControlState as J, type ComposerControlsProps as K, type ComposerDelivery as L, type ComposerDraftState as M, type Notice as N, OPEN_WORKSTREAM_CONTROL_EVENT as O, type ComposerFooterProps as P, type ComposerFrameProps as Q, type ComposerHintProps as R, type SlashCommand as S, type TranscriptionControlAction as T, type UseFileAttachmentsResult as U, type ComposerInputProps as V, type ComposerModelPickerProps as W, type ComposerPauseButtonProps as X, type ComposerRootProps as Y, type ComposerSendButtonProps as Z, type ComposerSubmitBlocker as _, type ComposerTranscriptionControlProps as a, type ComposerSurfaceProps as a0, Confirmation as a1, Controls as a2, Footer as a3, Frame as a4, Help as a5, Hint as a6, Input as a7, ModelPicker as a8, PauseButton as a9, PausedState as aa, RestoredResources as ab, Root as ac, SendButton as ad, Status as ae, Surface as af, type UseChatComposerControllerOptions as ag, useChatComposer as ah, useChatComposerController as ai, type SlashCommandContext as b, type ChatComposerMessages as c, type SlashArg as d, type CommandContext as e, type CommandResult as f, ComposerTranscriptionControl as g, type ComposerTranscriptionMessages as h, type ConfirmState as i, type SlashCommandHandlers as j, type TranscriptionControlState as k, type TranscriptionControlTransition as l, type UseFileAttachmentsOptions as m, type UseSlashCommandsOptions as n, type UseSlashCommandsResult as o, type UseTranscriptionOptions as p, type UseTranscriptionResult as q, appendFinalTranscript as r, defaultChatComposerMessages as s, transitionTranscriptionControl as t, useFileAttachments as u, useSlashCommands as v, useTranscription as w, AttachButton as x, Attachments as y, type ChatComposerContextValue as z };
@@ -0,0 +1,6 @@
1
+ export { A as Actions, x as AttachButton, y as Attachments, z as ChatComposerContextValue, B as ChatComposerController, c as ChatComposerMessages, D as CommandPalette, E as ComposerActionsProps, G as ComposerAttachButtonProps, H as ComposerCommandPaletteProps, C as ComposerControlLinks, J as ComposerControlState, K as ComposerControlsProps, L as ComposerDelivery, M as ComposerDraftState, P as ComposerFooterProps, Q as ComposerFrameProps, R as ComposerHintProps, V as ComposerInputProps, W as ComposerModelPickerProps, X as ComposerPauseButtonProps, Y as ComposerRootProps, Z as ComposerSendButtonProps, _ as ComposerSubmitBlocker, $ as ComposerSubmitMode, a0 as ComposerSurfaceProps, g as ComposerTranscriptionControl, a as ComposerTranscriptionControlProps, h as ComposerTranscriptionMessages, a1 as Confirmation, a2 as Controls, a3 as Footer, a4 as Frame, a5 as Help, a6 as Hint, a7 as Input, a8 as ModelPicker, O as OPEN_WORKSTREAM_CONTROL_EVENT, a9 as PauseButton, aa as PausedState, ab as RestoredResources, ac as Root, ad as SendButton, ae as Status, af as Surface, ag as UseChatComposerControllerOptions, s as defaultChatComposerMessages, ah as useChatComposer, ai as useChatComposerController } from './composer-CVm5uoUI.js';
2
+ import 'react/jsx-runtime';
3
+ import 'react';
4
+ import '@opengeni/sdk';
5
+ import './session-context-rgrfElMl.js';
6
+ import './use-composer-By1wn3MM.js';
@@ -0,0 +1,56 @@
1
+ import {
2
+ Actions,
3
+ AttachButton,
4
+ Attachments,
5
+ CommandPalette2 as CommandPalette,
6
+ ComposerTranscriptionControl,
7
+ Confirmation,
8
+ Controls,
9
+ Footer,
10
+ Frame,
11
+ Help,
12
+ Hint,
13
+ Input,
14
+ ModelPicker2 as ModelPicker,
15
+ OPEN_WORKSTREAM_CONTROL_EVENT,
16
+ PauseButton,
17
+ PausedState,
18
+ RestoredResources,
19
+ Root,
20
+ SendButton,
21
+ Status,
22
+ Surface,
23
+ defaultChatComposerMessages,
24
+ useChatComposer,
25
+ useChatComposerController
26
+ } from "./chunk-CATATY77.js";
27
+ import "./chunk-TK7G6XLT.js";
28
+ import "./chunk-UQS7OQDE.js";
29
+ import "./chunk-I3BJZIG5.js";
30
+ export {
31
+ Actions,
32
+ AttachButton,
33
+ Attachments,
34
+ CommandPalette,
35
+ ComposerTranscriptionControl,
36
+ Confirmation,
37
+ Controls,
38
+ Footer,
39
+ Frame,
40
+ Help,
41
+ Hint,
42
+ Input,
43
+ ModelPicker,
44
+ OPEN_WORKSTREAM_CONTROL_EVENT,
45
+ PauseButton,
46
+ PausedState,
47
+ RestoredResources,
48
+ Root,
49
+ SendButton,
50
+ Status,
51
+ Surface,
52
+ defaultChatComposerMessages,
53
+ useChatComposer,
54
+ useChatComposerController
55
+ };
56
+ //# sourceMappingURL=composer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}