@opengeni/react 0.40.0 → 0.42.1

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.
@@ -1,4 +1,5 @@
1
1
  import type { ClientVoiceInputConfig, OpenGeniClient, TranscriptionAdapter, WorkspaceTranscriptionPolicy } from "@opengeni/sdk";
2
+ import type { VoiceRecordingStore } from "../voice-recording-store";
2
3
  export type ComposerTranscriptionMessages = {
3
4
  start: string;
4
5
  stop: string;
@@ -6,7 +7,12 @@ export type ComposerTranscriptionMessages = {
6
7
  retry: string;
7
8
  requestingPermission: string;
8
9
  recording: string;
10
+ saving: string;
9
11
  transcribing: string;
12
+ recovered: string;
13
+ recoveredTranscript: string;
14
+ insertRecoveredTranscript: string;
15
+ discardRecovered: string;
10
16
  unavailableDisabled: string;
11
17
  unavailable: string;
12
18
  errorPermissionDenied: string;
@@ -14,6 +20,9 @@ export type ComposerTranscriptionMessages = {
14
20
  errorUnavailable: string;
15
21
  errorTooLarge: string;
16
22
  errorInvalidAudio: string;
23
+ errorStorageUnavailable: string;
24
+ errorRetryable: string;
25
+ errorHandoffUncertain: string;
17
26
  errorUnknown: string;
18
27
  };
19
28
  export type ComposerTranscriptionControlProps = {
@@ -31,6 +40,10 @@ export type ComposerTranscriptionControlProps = {
31
40
  onDiagnostic?: unknown;
32
41
  messages?: Partial<ComposerTranscriptionMessages> | undefined;
33
42
  className?: string | undefined;
43
+ /** Test/embed seam. Production defaults to origin-scoped IndexedDB. */
44
+ createRecordingStore?: (() => VoiceRecordingStore) | undefined;
45
+ /** Test/embed seam. Production acquires a coordinated browser-document owner lease. */
46
+ createOwnerId?: (() => string) | undefined;
34
47
  };
35
48
  /** One provider-neutral microphone control for the nearest editable composer. */
36
- export declare function ComposerTranscriptionControl({ client, workspaceId, capability, workspaceEnabled, messages: overrides, className, }: ComposerTranscriptionControlProps): import("react/jsx-runtime").JSX.Element;
49
+ export declare function ComposerTranscriptionControl({ client, workspaceId, capability, workspaceEnabled, messages: overrides, className, createRecordingStore, createOwnerId, }: ComposerTranscriptionControlProps): import("react/jsx-runtime").JSX.Element;
@@ -10,5 +10,7 @@ export { Actions, AttachButton, Attachments, CommandPalette, Confirmation, Contr
10
10
  export type { ChatComposerController, ChatComposerContextValue, ChatComposerMessages, ComposerActionsProps, ComposerAttachButtonProps, ComposerCommandPaletteProps, ComposerControlLinks, ComposerControlState, ComposerControlsProps, ComposerDelivery, ComposerDraftState, ComposerFooterProps, ComposerFrameProps, ComposerHintProps, ComposerInputProps, ComposerModelPickerProps, ComposerPauseButtonProps, ComposerRootProps, ComposerSendButtonProps, ComposerSubmitBlocker, ComposerSubmitMode, ComposerSurfaceProps, UseChatComposerControllerOptions, } from "./components/composer";
11
11
  export { ComposerTranscriptionControl } from "./components/composer-transcription-control";
12
12
  export type { ComposerTranscriptionControlProps, ComposerTranscriptionMessages, } from "./components/composer-transcription-control";
13
- export { useVoiceInput } from "./hooks/use-voice-input";
13
+ export { VOICE_RECORDING_CLIENT_MAX_DURATION_SECONDS, VOICE_RECORDING_OWNER_HEARTBEAT_MILLISECONDS, VOICE_RECORDING_OWNER_STALE_MILLISECONDS, VOICE_RECORDING_TIMESLICE_MILLISECONDS, useVoiceInput, } from "./hooks/use-voice-input";
14
14
  export type { UseVoiceInputOptions, UseVoiceInputResult, VoiceInputStatus, } from "./hooks/use-voice-input";
15
+ export { IndexedDbVoiceRecordingStore, VoiceRecordingChunkConflictError, VoiceRecordingChunkSequenceError, VoiceRecordingNotFoundError, VoiceRecordingOwnedError, VoiceRecordingStorageUnavailableError, createVoiceRecordingManifest, planVoiceRecordingChunkCommit, prepareVoiceRecordingChunk, } from "./voice-recording-store";
16
+ export type { PersistVoiceRecordingChunkInput, PersistVoiceRecordingChunkResult, VoiceRecordingCaptureState, VoiceRecordingChunk, VoiceRecordingChunkUploadState, VoiceRecordingFinalizationState, VoiceRecordingManifest, VoiceRecordingStore, VoiceRecordingTranscriptionState, VoiceRecordingUploadState, } from "./voice-recording-store";
package/dist/composer.js CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  Frame,
11
11
  Help,
12
12
  Hint,
13
+ IndexedDbVoiceRecordingStore,
13
14
  Input,
14
15
  ModelPicker2 as ModelPicker,
15
16
  OPEN_WORKSTREAM_CONTROL_EVENT,
@@ -20,11 +21,23 @@ import {
20
21
  SendButton,
21
22
  Status,
22
23
  Surface,
24
+ VOICE_RECORDING_CLIENT_MAX_DURATION_SECONDS,
25
+ VOICE_RECORDING_OWNER_HEARTBEAT_MILLISECONDS,
26
+ VOICE_RECORDING_OWNER_STALE_MILLISECONDS,
27
+ VOICE_RECORDING_TIMESLICE_MILLISECONDS,
28
+ VoiceRecordingChunkConflictError,
29
+ VoiceRecordingChunkSequenceError,
30
+ VoiceRecordingNotFoundError,
31
+ VoiceRecordingOwnedError,
32
+ VoiceRecordingStorageUnavailableError,
33
+ createVoiceRecordingManifest,
23
34
  defaultChatComposerMessages,
35
+ planVoiceRecordingChunkCommit,
36
+ prepareVoiceRecordingChunk,
24
37
  useChatComposer,
25
38
  useChatComposerController,
26
39
  useVoiceInput
27
- } from "./chunk-OMCFRWHL.js";
40
+ } from "./chunk-UWYTCQWW.js";
28
41
  import "./chunk-Q2NCKWTK.js";
29
42
  import "./chunk-EB67J347.js";
30
43
  import {
@@ -54,6 +67,7 @@ export {
54
67
  Frame,
55
68
  Help,
56
69
  Hint,
70
+ IndexedDbVoiceRecordingStore,
57
71
  Input,
58
72
  ModelPicker,
59
73
  ModelPolicyPicker,
@@ -69,8 +83,20 @@ export {
69
83
  SendButton,
70
84
  Status,
71
85
  Surface,
86
+ VOICE_RECORDING_CLIENT_MAX_DURATION_SECONDS,
87
+ VOICE_RECORDING_OWNER_HEARTBEAT_MILLISECONDS,
88
+ VOICE_RECORDING_OWNER_STALE_MILLISECONDS,
89
+ VOICE_RECORDING_TIMESLICE_MILLISECONDS,
90
+ VoiceRecordingChunkConflictError,
91
+ VoiceRecordingChunkSequenceError,
92
+ VoiceRecordingNotFoundError,
93
+ VoiceRecordingOwnedError,
94
+ VoiceRecordingStorageUnavailableError,
95
+ createVoiceRecordingManifest,
72
96
  defaultChatComposerMessages,
73
97
  defaultModelPolicyPickerMessages,
98
+ planVoiceRecordingChunkCommit,
99
+ prepareVoiceRecordingChunk,
74
100
  useChatComposer,
75
101
  useChatComposerController,
76
102
  useVoiceInput
@@ -1,5 +1,6 @@
1
1
  import type { ClientVoiceInputConfig, OpenGeniClient } from "@opengeni/sdk";
2
- export type VoiceInputStatus = "idle" | "requesting-permission" | "recording" | "transcribing" | "error";
2
+ import { type VoiceRecordingStore } from "../voice-recording-store";
3
+ export type VoiceInputStatus = "idle" | "requesting-permission" | "recording" | "saving" | "transcribing" | "recovered" | "transcript-ready" | "error";
3
4
  export type UseVoiceInputOptions = {
4
5
  client: Pick<OpenGeniClient, "transcribeAudio"> | null;
5
6
  workspaceId: string;
@@ -9,6 +10,11 @@ export type UseVoiceInputOptions = {
9
10
  setValue: (value: string) => void;
10
11
  focusInput: () => void;
11
12
  disabled?: boolean | undefined;
13
+ /** Test/embed seam. Production defaults to the origin-scoped IndexedDB store. */
14
+ createRecordingStore?: (() => VoiceRecordingStore) | undefined;
15
+ createRecordingId?: (() => string) | undefined;
16
+ createOwnerId?: (() => string) | undefined;
17
+ now?: (() => Date) | undefined;
12
18
  };
13
19
  export type UseVoiceInputResult = {
14
20
  status: VoiceInputStatus;
@@ -16,10 +22,25 @@ export type UseVoiceInputResult = {
16
22
  available: boolean;
17
23
  /** Live mic stream while recording; null once stopped/cancelled. */
18
24
  stream: MediaStream | null;
25
+ recordingId: string | null;
26
+ durationSeconds: number;
27
+ locallySaved: boolean;
28
+ hasRecoverableRecording: boolean;
29
+ savedTranscript: string | null;
19
30
  start: () => Promise<boolean>;
20
- /** Stop capture and immediately upload/transcribe into the draft (no Send). */
31
+ /** Stop capture, durably settle the final chunk, then transcribe into the draft. */
21
32
  stop: () => void;
22
- /** Discard the in-flight recording or transcription; Escape also cancels. */
33
+ /** Retry finalization/transcription from the already-persisted recording. */
34
+ retry: () => void;
35
+ /** Explicitly insert a durably saved transcript whose prior handoff may be uncertain. */
36
+ insertSavedTranscript: () => Promise<void>;
37
+ /** Cancel active work. A stopped/transcribing recording remains recoverable. */
23
38
  cancel: () => void;
39
+ /** Intentionally delete the current durable recording. */
40
+ discard: () => Promise<void>;
24
41
  };
25
- export declare function useVoiceInput({ client, workspaceId, capability, enabled, value, setValue, focusInput, disabled, }: UseVoiceInputOptions): UseVoiceInputResult;
42
+ export declare const VOICE_RECORDING_TIMESLICE_MILLISECONDS = 5000;
43
+ export declare const VOICE_RECORDING_OWNER_HEARTBEAT_MILLISECONDS = 5000;
44
+ export declare const VOICE_RECORDING_OWNER_STALE_MILLISECONDS = 30000;
45
+ export declare const VOICE_RECORDING_CLIENT_MAX_DURATION_SECONDS = 600;
46
+ export declare function useVoiceInput({ client, workspaceId, capability, enabled, value, setValue, focusInput, disabled, createRecordingStore, createRecordingId, createOwnerId, now, }: UseVoiceInputOptions): UseVoiceInputResult;
package/dist/index.d.ts CHANGED
@@ -9,8 +9,10 @@ export { SESSION_EVENT_BROWSER_MAX_BYTES, SESSION_EVENT_BROWSER_MAX_COUNT, SESSI
9
9
  export type { BrowserSessionEventWindow, SessionEventsConnectionState, UseSessionEventsOptions, UseSessionEventsResult, } from "./hooks/use-session-events";
10
10
  export { useComposer, composeSendInput, shouldSteerOnKey, shouldSubmitOnKey, FILE_ONLY_MESSAGE_TEXT, } from "./hooks/use-composer";
11
11
  export type { ComposerSendExtras, ComposerState, UseComposerOptions } from "./hooks/use-composer";
12
- export { useVoiceInput } from "./hooks/use-voice-input";
12
+ export { VOICE_RECORDING_CLIENT_MAX_DURATION_SECONDS, VOICE_RECORDING_OWNER_HEARTBEAT_MILLISECONDS, VOICE_RECORDING_OWNER_STALE_MILLISECONDS, VOICE_RECORDING_TIMESLICE_MILLISECONDS, useVoiceInput, } from "./hooks/use-voice-input";
13
13
  export type { UseVoiceInputOptions, UseVoiceInputResult, VoiceInputStatus, } from "./hooks/use-voice-input";
14
+ export { IndexedDbVoiceRecordingStore, VoiceRecordingChunkConflictError, VoiceRecordingChunkSequenceError, VoiceRecordingNotFoundError, VoiceRecordingOwnedError, VoiceRecordingStorageUnavailableError, createVoiceRecordingManifest, planVoiceRecordingChunkCommit, prepareVoiceRecordingChunk, } from "./voice-recording-store";
15
+ export type { PersistVoiceRecordingChunkInput, PersistVoiceRecordingChunkResult, VoiceRecordingCaptureState, VoiceRecordingChunk, VoiceRecordingChunkUploadState, VoiceRecordingFinalizationState, VoiceRecordingManifest, VoiceRecordingStore, VoiceRecordingTranscriptionState, VoiceRecordingUploadState, } from "./voice-recording-store";
14
16
  export { COMPOSER_PAYMENT_REQUIRED_MESSAGE, composerSubmissionErrorMessage } from "./lib/format";
15
17
  export { INITIAL_TRANSCRIPTION_CONTROL_STATE, appendFinalTranscript, transitionTranscriptionControl, useTranscription, } from "./hooks/use-transcription";
16
18
  export type { TranscriptionControlAction, TranscriptionControlState, TranscriptionControlTransition, UseTranscriptionOptions, UseTranscriptionResult, } from "./hooks/use-transcription";
package/dist/index.js CHANGED
@@ -131,6 +131,7 @@ import {
131
131
  Help,
132
132
  Hint,
133
133
  INITIAL_TRANSCRIPTION_CONTROL_STATE,
134
+ IndexedDbVoiceRecordingStore,
134
135
  Input,
135
136
  ModelPicker,
136
137
  ModelPicker2,
@@ -142,8 +143,18 @@ import {
142
143
  SendButton,
143
144
  Status,
144
145
  Surface,
146
+ VOICE_RECORDING_CLIENT_MAX_DURATION_SECONDS,
147
+ VOICE_RECORDING_OWNER_HEARTBEAT_MILLISECONDS,
148
+ VOICE_RECORDING_OWNER_STALE_MILLISECONDS,
149
+ VOICE_RECORDING_TIMESLICE_MILLISECONDS,
150
+ VoiceRecordingChunkConflictError,
151
+ VoiceRecordingChunkSequenceError,
152
+ VoiceRecordingNotFoundError,
153
+ VoiceRecordingOwnedError,
154
+ VoiceRecordingStorageUnavailableError,
145
155
  appendFinalTranscript,
146
156
  argHint,
157
+ createVoiceRecordingManifest,
147
158
  defaultChatComposerMessages,
148
159
  defaultCommands,
149
160
  filterCommands,
@@ -151,12 +162,14 @@ import {
151
162
  hasPermission,
152
163
  matchCommand,
153
164
  parseCommandLine,
165
+ planVoiceRecordingChunkCommit,
166
+ prepareVoiceRecordingChunk,
154
167
  transitionTranscriptionControl,
155
168
  useChatComposerController,
156
169
  useSlashCommands,
157
170
  useTranscription,
158
171
  useVoiceInput
159
- } from "./chunk-OMCFRWHL.js";
172
+ } from "./chunk-UWYTCQWW.js";
160
173
  import {
161
174
  FILE_ONLY_MESSAGE_TEXT,
162
175
  composeSendInput,
@@ -8423,6 +8436,7 @@ export {
8423
8436
  HumanInputForm,
8424
8437
  HumanInputSurface,
8425
8438
  INITIAL_TRANSCRIPTION_CONTROL_STATE,
8439
+ IndexedDbVoiceRecordingStore,
8426
8440
  LightboxProvider,
8427
8441
  MACHINE_STATE_BADGE_META,
8428
8442
  METRICS,
@@ -8474,6 +8488,15 @@ export {
8474
8488
  TooltipProvider,
8475
8489
  TooltipTrigger,
8476
8490
  TurnSummary,
8491
+ VOICE_RECORDING_CLIENT_MAX_DURATION_SECONDS,
8492
+ VOICE_RECORDING_OWNER_HEARTBEAT_MILLISECONDS,
8493
+ VOICE_RECORDING_OWNER_STALE_MILLISECONDS,
8494
+ VOICE_RECORDING_TIMESLICE_MILLISECONDS,
8495
+ VoiceRecordingChunkConflictError,
8496
+ VoiceRecordingChunkSequenceError,
8497
+ VoiceRecordingNotFoundError,
8498
+ VoiceRecordingOwnedError,
8499
+ VoiceRecordingStorageUnavailableError,
8477
8500
  WINDOW_LABEL,
8478
8501
  WORKBENCH_SURFACES,
8479
8502
  WORKBENCH_TAB_CHANGES,
@@ -8502,6 +8525,7 @@ export {
8502
8525
  copyTextToClipboard,
8503
8526
  createDefaultToolRegistry,
8504
8527
  createToolRegistry,
8528
+ createVoiceRecordingManifest,
8505
8529
  creditExhaustedFromEvents,
8506
8530
  defaultApprovalSurfaceMessages,
8507
8531
  defaultChatComposerMessages,
@@ -8550,7 +8574,9 @@ export {
8550
8574
  parseExecBannerSessionId,
8551
8575
  parseToolArgs,
8552
8576
  payerSummaryForModel,
8577
+ planVoiceRecordingChunkCommit,
8553
8578
  pointsFor,
8579
+ prepareVoiceRecordingChunk,
8554
8580
  projectClientModelRows,
8555
8581
  projectPendingApprovals,
8556
8582
  projectPendingHumanInputRequests,