@dudko.dev/agent-web-react 0.0.38 → 0.0.39
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 +7 -0
- package/dist/{chunk-G5GGIMD4.js → chunk-RJM7JCWI.js} +12 -1
- package/dist/chunk-RJM7JCWI.js.map +1 -0
- package/dist/{elicitation-BgSf-xzh.d.cts → elicitation-DdzjMut9.d.cts} +2 -0
- package/dist/{elicitation-BgSf-xzh.d.ts → elicitation-DdzjMut9.d.ts} +2 -0
- package/dist/index.cjs +1372 -245
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +493 -15
- package/dist/index.d.ts +493 -15
- package/dist/index.js +1328 -231
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.cts +2 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/pipeline.cjs.map +1 -1
- package/dist/pipeline.js +1 -1
- package/dist/styles.css +90 -0
- package/package.json +3 -3
- package/dist/chunk-G5GGIMD4.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { DependencyList, ReactNode, RefObject, ComponentType, CSSProperties } from 'react';
|
|
3
3
|
import { AskUserRequest, AskUserContext, AskUserAnswer, AskUserConfig, AskUserHandler, AgentEvent, RunFile, RunResult, Agent, ToolApprovalMode, AppToolCallRequest, AppSamplingRequest, AppSamplingView, AppSamplingResult, CompactResult, IUsage, AgentEventHandler, BrowserAgentConfig, VirtualFileInfo, VirtualFileSystem, CredentialStore, createWebLLMModel, WebLLMModelOptions, ModelTier, TierReason, EscalationReason, DecisionFallbackReason, Skill, IPlan, ToolApprovalRequest, ToolApprovalContext, ToolApprovalDecision } from '@dudko.dev/agent-web';
|
|
4
4
|
export { Agent, AgentEvent, AgentEventHandler, AgentLoggerSink, AgentTool, AgentToolSet, AppToolCallRequest, AskUserAnswer, AskUserConfig, AskUserContext, AskUserHandler, AskUserOption, AskUserRequest, AttachmentsNotSupportedError, BrowserAgentConfig, CompactResult, CompactionConfig, CredentialStore, FileToolsOptions, IPlan, IPlanStep, IStepResult, IToolCall, IUsage, ImagesNotSupportedError, IndexedDBStore, LearningConfig, LogLevel, McpAppCsp, McpAppResource, McpAppToolResult, MemoryCredentialStore, MemorySkillStore, MemoryStore, ModelInput, ProviderModelSpec, ProviderType, RunControl, RunFile, RunOptions, RunResult, SessionBusyError, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillStore, StorageChange, StorageChangeKind, StorageChangeOp, SubagentInfo, SubagentToolOptions, SubagentWorkerConfig, ThinkingLevel, ThinkingSetting, TokenLimits, ToolApprovalConfig, ToolApprovalContext, ToolApprovalMode, ToolApprovalRequest, VaultCredentialStore, VfsSkillStore, VirtualFile, VirtualFileInfo, VirtualFileSystem, WatchSessionOptions, createAgent, createFileTools, createRunControl, createSubagentTool, createWebLLMModel, defineSkill, defineTool, isWebGPUAvailable, loadSkillFromUrl, markReadOnly, onStorageChange, parseSkillMarkdown, postStorageChange, preloadWebLLMModel, serveSubagentWorker, supportsImages, supportsPdf, unloadWebLLMModel, watchSession } from '@dudko.dev/agent-web';
|
|
5
|
-
import { A as AgentUiState, C as ChatAttachment, a as ApprovalView, b as ChatMessage, c as AgentStatus, E as ElicitationIssueKind, d as ElicitationOutcomeReason, M as McpAppSandboxReason, R as RemoteRunView, L as LessonView, S as SubagentView, e as SubagentNode, P as PendingElicitation, f as McpElicitationResult, g as ElicitationView, W as WrittenFileView, T as ToolCallView, h as StepView, U as UserNoteView, D as DecisionView, i as MediaView, j as AppView, Q as QuestionView, k as McpAppsConnectionLike, l as McpAppSandboxOptions, m as AppRequestView, n as TranscriptView, B as BudgetView, o as CompactionView, p as ModelLoadState, q as McpAppHost, r as AppRequestAnswerOptions } from './elicitation-
|
|
6
|
-
export { s as APP_DEFAULT_HEIGHT, t as APP_MAX_HEIGHT, u as APP_MIN_HEIGHT, v as AppDownload, w as AppDownloadView, x as AppFileSaverEnv, y as AppLink, z as AppReadyDownload, F as AppResourceReader, G as ElicitationControl, H as ElicitationDraft, I as ElicitationDraftValue, J as ElicitationField, K as ElicitationFormOutcome, N as ElicitationIssue, O as ElicitationLink, V as ElicitationOption, X as FetchView, Y as MCP_APP_DISPLAY_MODES, Z as MCP_APP_MAX_ARGS_CHARS, _ as MCP_APP_MAX_DOWNLOAD_BYTES, $ as MCP_APP_MAX_FILE_NAME_CHARS, a0 as MCP_APP_MAX_IN_FLIGHT, a1 as MCP_APP_MAX_MESSAGE_CHARS, a2 as MCP_APP_MAX_URL_CHARS, a3 as MCP_APP_NOTIFICATIONS, a4 as MCP_APP_OPTIONAL_REQUESTS, a5 as MCP_APP_PROTOCOL_VERSION, a6 as MCP_APP_REFUSED, a7 as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, a8 as MCP_APP_REFUSED_DOWNLOAD_TYPES, a9 as MCP_APP_RELAY, aa as MCP_APP_REQUESTS, ab as MCP_APP_SANDBOX_FRAME_TOKENS, ac as MCP_APP_SANDBOX_GRACE_MS, ad as MCP_APP_SANDBOX_SERVER, ae as MCP_APP_SANDBOX_TIMEOUT_MS, af as McpAppBridge, ag as McpAppBridgeHandlers, ah as McpAppBridgeOptions, ai as McpAppDisplayMode, aj as McpAppRpcError, ak as McpAppRpcMessage, al as McpAppSandboxInput, am as McpAppSandboxLink, an as McpAppSandboxLinkOptions, ao as McpAppSandboxTarget, ap as McpElicitationFieldSchema, aq as McpElicitationRequest, ar as McpElicitationSchema, as as QueuedMessageView, at as ReplanState, au as SkillConsentView, av as StepEscalationView, aw as UseMcpAppHostOptions, ax as appDisplayModeAllowed, ay as appDownloadOf, az as appDownloadRefusal, aA as appFileExtensionOf, aB as appFileNameOf, aC as appGestureOf, aD as appLinkOf, aE as appMessageTextOf, aF as appMimeTypeOf, aG as appSamplingErrorOf, aH as buildMcpAppDocument, aI as buildMcpAppSandboxShell, aJ as clampAppHeight, aK as elicitationFields, aL as elicitationFormAnswer, aM as elicitationInitialDraft, aN as elicitationLink, aO as formatCountdown, aP as grantedAppCsp, aQ as mcpAppCsp, aR as mcpAppHostCapabilities, aS as mcpAppSandboxProxyUrl, aT as mcpAppSandboxShellCsp, aU as mcpAppSandboxTarget, aV as resolveAppDownload, aW as saveAppFile, aX as useMcpAppHost } from './elicitation-
|
|
5
|
+
import { A as AgentUiState, C as ChatAttachment, a as ApprovalView, b as ChatMessage, c as AgentStatus, E as ElicitationIssueKind, d as ElicitationOutcomeReason, M as McpAppSandboxReason, R as RemoteRunView, L as LessonView, S as SubagentView, e as SubagentNode, P as PendingElicitation, f as McpElicitationResult, g as ElicitationView, W as WrittenFileView, T as ToolCallView, h as StepView, U as UserNoteView, D as DecisionView, i as MediaView, j as AppView, Q as QuestionView, k as McpAppsConnectionLike, l as McpAppSandboxOptions, m as AppRequestView, n as TranscriptView, B as BudgetView, o as CompactionView, p as ModelLoadState, q as McpAppHost, r as AppRequestAnswerOptions } from './elicitation-DdzjMut9.cjs';
|
|
6
|
+
export { s as APP_DEFAULT_HEIGHT, t as APP_MAX_HEIGHT, u as APP_MIN_HEIGHT, v as AppDownload, w as AppDownloadView, x as AppFileSaverEnv, y as AppLink, z as AppReadyDownload, F as AppResourceReader, G as ElicitationControl, H as ElicitationDraft, I as ElicitationDraftValue, J as ElicitationField, K as ElicitationFormOutcome, N as ElicitationIssue, O as ElicitationLink, V as ElicitationOption, X as FetchView, Y as MCP_APP_DISPLAY_MODES, Z as MCP_APP_MAX_ARGS_CHARS, _ as MCP_APP_MAX_DOWNLOAD_BYTES, $ as MCP_APP_MAX_FILE_NAME_CHARS, a0 as MCP_APP_MAX_IN_FLIGHT, a1 as MCP_APP_MAX_MESSAGE_CHARS, a2 as MCP_APP_MAX_URL_CHARS, a3 as MCP_APP_NOTIFICATIONS, a4 as MCP_APP_OPTIONAL_REQUESTS, a5 as MCP_APP_PROTOCOL_VERSION, a6 as MCP_APP_REFUSED, a7 as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, a8 as MCP_APP_REFUSED_DOWNLOAD_TYPES, a9 as MCP_APP_RELAY, aa as MCP_APP_REQUESTS, ab as MCP_APP_SANDBOX_FRAME_TOKENS, ac as MCP_APP_SANDBOX_GRACE_MS, ad as MCP_APP_SANDBOX_SERVER, ae as MCP_APP_SANDBOX_TIMEOUT_MS, af as McpAppBridge, ag as McpAppBridgeHandlers, ah as McpAppBridgeOptions, ai as McpAppDisplayMode, aj as McpAppRpcError, ak as McpAppRpcMessage, al as McpAppSandboxInput, am as McpAppSandboxLink, an as McpAppSandboxLinkOptions, ao as McpAppSandboxTarget, ap as McpElicitationFieldSchema, aq as McpElicitationRequest, ar as McpElicitationSchema, as as QueuedMessageView, at as ReplanState, au as SkillConsentView, av as StepEscalationView, aw as UseMcpAppHostOptions, ax as appDisplayModeAllowed, ay as appDownloadOf, az as appDownloadRefusal, aA as appFileExtensionOf, aB as appFileNameOf, aC as appGestureOf, aD as appLinkOf, aE as appMessageTextOf, aF as appMimeTypeOf, aG as appSamplingErrorOf, aH as buildMcpAppDocument, aI as buildMcpAppSandboxShell, aJ as clampAppHeight, aK as elicitationFields, aL as elicitationFormAnswer, aM as elicitationInitialDraft, aN as elicitationLink, aO as formatCountdown, aP as grantedAppCsp, aQ as mcpAppCsp, aR as mcpAppHostCapabilities, aS as mcpAppSandboxProxyUrl, aT as mcpAppSandboxShellCsp, aU as mcpAppSandboxTarget, aV as resolveAppDownload, aW as saveAppFile, aX as useMcpAppHost } from './elicitation-DdzjMut9.cjs';
|
|
7
7
|
export { M as MCP_APP_POLICY_TOKEN_MAX_CHARS, a as MCP_APP_SANDBOX_PROXY_READY, b as MCP_APP_SANDBOX_RESOURCE_READY, i as isMcpAppSandboxMessage, m as mcpAppPolicyToken } from './mcp-app-policy-DIUmGPJP.cjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -156,6 +156,7 @@ interface RunGoalOptions {
|
|
|
156
156
|
/**
|
|
157
157
|
* What the transcript shows for this turn when it differs from what the
|
|
158
158
|
* agent receives — e.g. the typed text without the attached files' contents.
|
|
159
|
+
* `''` with `attachments`: a message of attachments only - the transcript shows them, no text.
|
|
159
160
|
*/
|
|
160
161
|
label?: string;
|
|
161
162
|
/** Images sent to the model with the goal (vision models; see `agent.capabilities`). */
|
|
@@ -356,8 +357,23 @@ declare class ChatHistoryStore {
|
|
|
356
357
|
delete(id: string): Promise<void>;
|
|
357
358
|
clear(): Promise<void>;
|
|
358
359
|
}
|
|
359
|
-
/**
|
|
360
|
-
|
|
360
|
+
/** The words a chat's title and a message of attachments only are said with (`AgentLabels`'). */
|
|
361
|
+
interface AttachmentTexts {
|
|
362
|
+
/** A recording - audio attachments only (default "Voice message"). */
|
|
363
|
+
voiceMessage?: string;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* A message of attachments only, in words - where a text is needed (a chat's title, the name a
|
|
367
|
+
* screen reader gives the message): `voiceMessage` when every attachment is audio (a voice
|
|
368
|
+
* message), else the files' names.
|
|
369
|
+
*/
|
|
370
|
+
declare const attachmentsText: (attachments: readonly ChatAttachment[], texts?: AttachmentTexts) => string;
|
|
371
|
+
/**
|
|
372
|
+
* A chat's title: its first user message, trimmed. A first message of attachments only is named
|
|
373
|
+
* by what was said in it once the run has transcribed it (the next answer's transcript of an
|
|
374
|
+
* attachment), else by `attachmentsText` - "Voice message", or the files' names.
|
|
375
|
+
*/
|
|
376
|
+
declare const chatTitle: (messages: ChatMessage[], texts?: AttachmentTexts) => string;
|
|
361
377
|
/** A fresh, sortable conversation id (also a valid memory session id). */
|
|
362
378
|
declare const newChatId: () => string;
|
|
363
379
|
|
|
@@ -368,6 +384,12 @@ interface UseChatHistoryOptions {
|
|
|
368
384
|
enabled?: boolean;
|
|
369
385
|
/** Open the most recent chat on mount (default true). */
|
|
370
386
|
resumeLatest?: boolean;
|
|
387
|
+
/**
|
|
388
|
+
* The words a chat that starts with attachments only is titled with (`chatTitle`): pass your
|
|
389
|
+
* `voiceMessage` label so that a chat begun by a voice message is named in your language until
|
|
390
|
+
* its transcript is there.
|
|
391
|
+
*/
|
|
392
|
+
labels?: AttachmentTexts;
|
|
371
393
|
}
|
|
372
394
|
interface UseChatHistoryReturn {
|
|
373
395
|
chats: ChatSummary[];
|
|
@@ -396,7 +418,9 @@ declare const unchangedSince: (messages: ChatMessage[], base: ChatBase | undefin
|
|
|
396
418
|
* everything that is not this tab's own: this tab's own new messages - by identity, not by count,
|
|
397
419
|
* so a reset or a trim here drops nothing there - go after it.
|
|
398
420
|
*/
|
|
399
|
-
declare const mergeChatRecord: (view: ChatRecord, stored: ChatRecord | undefined, base: ChatBase | undefined
|
|
421
|
+
declare const mergeChatRecord: (view: ChatRecord, stored: ChatRecord | undefined, base: ChatBase | undefined,
|
|
422
|
+
/** The words of a title of attachments only (`chatTitle`). */
|
|
423
|
+
texts?: AttachmentTexts) => {
|
|
400
424
|
record: ChatRecord;
|
|
401
425
|
merged: boolean;
|
|
402
426
|
};
|
|
@@ -405,7 +429,7 @@ declare const mergeChatRecord: (view: ChatRecord, stored: ChatRecord | undefined
|
|
|
405
429
|
* written in ONE readwrite transaction (`ChatHistoryStore.putMerged`), so another tab's save
|
|
406
430
|
* cannot land between the two.
|
|
407
431
|
*/
|
|
408
|
-
declare const saveChat: (store: ChatHistoryStore, view: ChatRecord, base: ChatBase | undefined) => Promise<{
|
|
432
|
+
declare const saveChat: (store: ChatHistoryStore, view: ChatRecord, base: ChatBase | undefined, texts?: AttachmentTexts) => Promise<{
|
|
409
433
|
record: ChatRecord;
|
|
410
434
|
merged: boolean;
|
|
411
435
|
}>;
|
|
@@ -452,8 +476,13 @@ interface SpeechRecognizerLike {
|
|
|
452
476
|
stop(): void;
|
|
453
477
|
abort?(): void;
|
|
454
478
|
onresult: ((ev: SpeechResultEventLike) => void) | null;
|
|
479
|
+
/**
|
|
480
|
+
* `error` is the Web Speech API's code (`not-allowed`, `audio-capture`, `network`, ...) or a
|
|
481
|
+
* recognizer's own; `message`, when given, is what to say - in the host's words.
|
|
482
|
+
*/
|
|
455
483
|
onerror: ((ev: {
|
|
456
484
|
error?: string;
|
|
485
|
+
message?: string;
|
|
457
486
|
}) => void) | null;
|
|
458
487
|
onend: (() => void) | null;
|
|
459
488
|
}
|
|
@@ -472,8 +501,9 @@ interface UseSpeechToTextOptions {
|
|
|
472
501
|
/** Keep listening across pauses until stopped (default true). */
|
|
473
502
|
continuous?: boolean;
|
|
474
503
|
/**
|
|
475
|
-
* Build your own recognizer
|
|
476
|
-
* of
|
|
504
|
+
* Build your own recognizer instead of the browser's `SpeechRecognition` - a fully local
|
|
505
|
+
* Whisper / WebGPU one, or a model of your provider through `createRecordingRecognizer`
|
|
506
|
+
* (records, then transcribes).
|
|
477
507
|
*/
|
|
478
508
|
createRecognizer?: () => SpeechRecognizerLike;
|
|
479
509
|
/** Final text chunks, as they are recognized. */
|
|
@@ -483,9 +513,17 @@ interface UseSpeechToTextReturn {
|
|
|
483
513
|
/** The browser (or your `createRecognizer`) can do speech-to-text. */
|
|
484
514
|
supported: boolean;
|
|
485
515
|
listening: boolean;
|
|
516
|
+
/**
|
|
517
|
+
* Stopped, and the last words are still coming: a recording recognizer is waiting for its
|
|
518
|
+
* model (show "Transcribing…"); the browser's is finishing what it heard.
|
|
519
|
+
*/
|
|
520
|
+
finishing: boolean;
|
|
486
521
|
/** Words heard but not final yet (for a live preview). */
|
|
487
522
|
interim: string;
|
|
523
|
+
/** The last error's code (`not-allowed`: the microphone was refused). */
|
|
488
524
|
error?: string;
|
|
525
|
+
/** What the recognizer said of it, when it said something (already in the host's words). */
|
|
526
|
+
errorMessage?: string;
|
|
489
527
|
start: () => void;
|
|
490
528
|
stop: () => void;
|
|
491
529
|
toggle: () => void;
|
|
@@ -497,6 +535,341 @@ interface UseSpeechToTextReturn {
|
|
|
497
535
|
*/
|
|
498
536
|
declare const useSpeechToText: (options?: UseSpeechToTextOptions) => UseSpeechToTextReturn;
|
|
499
537
|
|
|
538
|
+
/**
|
|
539
|
+
* Recording from the microphone, for dictation through a model and for voice messages. No React:
|
|
540
|
+
* a hook and the composer are built on it. The browser's `getUserMedia` and `MediaRecorder` can
|
|
541
|
+
* be handed in (`RecordingDeps`), which is how the tests drive it.
|
|
542
|
+
*
|
|
543
|
+
* The rules it keeps:
|
|
544
|
+
* - the permission is asked only by `startRecording` - call it from the person's tap;
|
|
545
|
+
* - every track of the stream is stopped when the recording ends: stopped, cancelled, cut at its
|
|
546
|
+
* longest, or failed - the browser's "recording" indicator goes away;
|
|
547
|
+
* - nothing is kept here: the audio is handed to the caller once, as a `Blob`.
|
|
548
|
+
*/
|
|
549
|
+
/** Why the microphone could not be used, as the composer says it (`micProblemLabel`). */
|
|
550
|
+
type MicProblem =
|
|
551
|
+
/** The person (or the browser, for this site) refused the permission. */
|
|
552
|
+
'not-allowed'
|
|
553
|
+
/** No microphone on the device (or none that fits). */
|
|
554
|
+
| 'audio-capture'
|
|
555
|
+
/** The microphone is held by another app (or the system refused to start it). */
|
|
556
|
+
| 'busy'
|
|
557
|
+
/** No recording here at all: no `mediaDevices` (an insecure page) or no `MediaRecorder`. */
|
|
558
|
+
| 'unsupported' | 'failed';
|
|
559
|
+
/** An error of the microphone, with its `MicProblem`. */
|
|
560
|
+
declare class MicError extends Error {
|
|
561
|
+
readonly code: MicProblem;
|
|
562
|
+
constructor(code: MicProblem, message?: string);
|
|
563
|
+
}
|
|
564
|
+
/** What a recording gave: the bytes, their media type (no codec parameters) and how long it ran. */
|
|
565
|
+
interface RecordedAudio {
|
|
566
|
+
blob: Blob;
|
|
567
|
+
/** `audio/webm`, `audio/mp4` (Safari, iOS), `audio/ogg`... - the container, without `;codecs=`. */
|
|
568
|
+
mediaType: string;
|
|
569
|
+
durationMs: number;
|
|
570
|
+
}
|
|
571
|
+
/** The slice of `MediaRecorder` this module drives. */
|
|
572
|
+
interface MediaRecorderLike {
|
|
573
|
+
readonly mimeType: string;
|
|
574
|
+
readonly state: 'inactive' | 'recording' | 'paused';
|
|
575
|
+
start(timeslice?: number): void;
|
|
576
|
+
stop(): void;
|
|
577
|
+
ondataavailable: ((event: {
|
|
578
|
+
data: Blob;
|
|
579
|
+
}) => void) | null;
|
|
580
|
+
onstop: (() => void) | null;
|
|
581
|
+
onerror: ((event: unknown) => void) | null;
|
|
582
|
+
}
|
|
583
|
+
interface MediaRecorderConstructorLike {
|
|
584
|
+
new (stream: MediaStream, options?: {
|
|
585
|
+
mimeType?: string;
|
|
586
|
+
}): MediaRecorderLike;
|
|
587
|
+
isTypeSupported?(type: string): boolean;
|
|
588
|
+
}
|
|
589
|
+
interface RecordingDeps {
|
|
590
|
+
/** Default: `navigator.mediaDevices.getUserMedia`. */
|
|
591
|
+
getUserMedia?: (constraints: MediaStreamConstraints) => Promise<MediaStream>;
|
|
592
|
+
/** Default: the page's `MediaRecorder`. */
|
|
593
|
+
MediaRecorder?: MediaRecorderConstructorLike;
|
|
594
|
+
/** Default: `Date.now`. */
|
|
595
|
+
now?: () => number;
|
|
596
|
+
}
|
|
597
|
+
/** The longest recording unless the caller says otherwise: five minutes. */
|
|
598
|
+
declare const RECORDING_DEFAULT_MAX_MS: number;
|
|
599
|
+
/**
|
|
600
|
+
* The containers asked for, in order: Opus in WebM (Chrome, Edge, Firefox), AAC in MP4 (Safari -
|
|
601
|
+
* iOS records nothing else), Opus in Ogg. Every one is a type the core transcribes and plays.
|
|
602
|
+
*/
|
|
603
|
+
declare const RECORDING_TYPES: readonly ["audio/webm;codecs=opus", "audio/webm", "audio/mp4", "audio/ogg;codecs=opus", "audio/ogg"];
|
|
604
|
+
/** The first type the recorder takes, or undefined (the browser then picks its own). */
|
|
605
|
+
declare const pickRecordingType: (isTypeSupported: ((type: string) => boolean) | undefined) => string | undefined;
|
|
606
|
+
/**
|
|
607
|
+
* A recorder's media type as a file's: the container without parameters, and the names browsers
|
|
608
|
+
* use for the same thing brought to one (`audio/x-m4a`, `audio/m4a`, `video/mp4` from Safari →
|
|
609
|
+
* `audio/mp4`; `video/webm` → `audio/webm`). Unknown or empty: `audio/webm`.
|
|
610
|
+
*/
|
|
611
|
+
declare const audioTypeOf: (type: string | undefined) => string;
|
|
612
|
+
/** The file extension of an audio type (`audioTypeOf`'s): `webm`, `m4a`, `ogg`, `wav`, `mp3`, `aac`. */
|
|
613
|
+
declare const audioExtensionOf: (type: string) => string;
|
|
614
|
+
/** What a failed `getUserMedia` (or recorder) means, by the DOMException's name. */
|
|
615
|
+
declare const micProblemOf: (err: unknown) => MicProblem;
|
|
616
|
+
/** Whether this browser can record at all (it does not ask for anything). */
|
|
617
|
+
declare const recordingSupported: (deps?: RecordingDeps) => boolean;
|
|
618
|
+
/** Stop every track of a stream: the microphone is let go. */
|
|
619
|
+
declare const stopTracks: (stream: MediaStream | undefined) => void;
|
|
620
|
+
/** A recording under way. */
|
|
621
|
+
interface Recording {
|
|
622
|
+
/** When it started (the clock of `RecordingDeps.now`). */
|
|
623
|
+
readonly startedAt: number;
|
|
624
|
+
/** Stop it and get the audio. The microphone is let go first. */
|
|
625
|
+
stop(): Promise<RecordedAudio>;
|
|
626
|
+
/** Throw it away. The microphone is let go; `stop` then rejects. */
|
|
627
|
+
cancel(): void;
|
|
628
|
+
/** Settles when the recording has ended, whichever way (the tracks are stopped by then). */
|
|
629
|
+
readonly ended: Promise<void>;
|
|
630
|
+
}
|
|
631
|
+
interface StartRecordingOptions extends RecordingDeps {
|
|
632
|
+
/** Cut it here (default `RECORDING_DEFAULT_MAX_MS`); `onLimit` is told, `stop` still gives the audio. */
|
|
633
|
+
maxMs?: number;
|
|
634
|
+
onLimit?: () => void;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Ask for the microphone and start recording. Rejects with a `MicError` when the microphone
|
|
638
|
+
* cannot be had (the permission refused, no device, held elsewhere, no recorder) - and then no
|
|
639
|
+
* track is left running.
|
|
640
|
+
*/
|
|
641
|
+
declare const startRecording: (options?: StartRecordingOptions) => Promise<Recording>;
|
|
642
|
+
|
|
643
|
+
interface UseAudioRecorderOptions extends RecordingDeps {
|
|
644
|
+
/** The longest recording (default five minutes): it is then stopped and kept. */
|
|
645
|
+
maxMs?: number;
|
|
646
|
+
}
|
|
647
|
+
interface UseAudioRecorderReturn {
|
|
648
|
+
/** This browser can record (`getUserMedia` and `MediaRecorder`). */
|
|
649
|
+
supported: boolean;
|
|
650
|
+
/** `starting`: the permission is being asked; `stopping`: the last bytes are being collected. */
|
|
651
|
+
state: 'idle' | 'starting' | 'recording' | 'stopping';
|
|
652
|
+
/** Milliseconds recorded so far (while recording). */
|
|
653
|
+
elapsedMs: number;
|
|
654
|
+
/** Why the last start failed. */
|
|
655
|
+
error: MicProblem | undefined;
|
|
656
|
+
/** A recording that reached `maxMs` and was stopped by itself, waiting to be taken. */
|
|
657
|
+
limited: RecordedAudio | undefined;
|
|
658
|
+
/** Ask for the microphone and record (call it from a tap). */
|
|
659
|
+
start: () => Promise<void>;
|
|
660
|
+
/** Stop and get the audio; undefined when nothing was being recorded. */
|
|
661
|
+
stop: () => Promise<RecordedAudio | undefined>;
|
|
662
|
+
/** Throw the recording away. */
|
|
663
|
+
cancel: () => void;
|
|
664
|
+
/** Forget `limited` and `error`. */
|
|
665
|
+
clear: () => void;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Record from the microphone (a voice message): the permission is asked at `start`, every track
|
|
669
|
+
* is stopped when the recording ends - `stop`, `cancel`, `maxMs`, a failure, or unmount.
|
|
670
|
+
*/
|
|
671
|
+
declare const useAudioRecorder: (options?: UseAudioRecorderOptions) => UseAudioRecorderReturn;
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Reading answers aloud: the text an answer is read as (`speakableText`), and two engines behind
|
|
675
|
+
* one shape (`SpeakText`) - the browser's own `speechSynthesis` (on the device, free, offline
|
|
676
|
+
* where the voice is local) and any engine that makes audio (`createAudioSpeaker`: a provider's
|
|
677
|
+
* text-to-speech model, played from a `blob:` URL). No React; `useReadAloud` and the message
|
|
678
|
+
* list's Listen button are built on it.
|
|
679
|
+
*/
|
|
680
|
+
/** Where a reading is: making its audio, playing, paused. */
|
|
681
|
+
type ReadAloudState = 'loading' | 'playing' | 'paused';
|
|
682
|
+
/** A reading under way. */
|
|
683
|
+
interface SpeechPlayback {
|
|
684
|
+
pause(): void;
|
|
685
|
+
resume(): void;
|
|
686
|
+
/** End it now; `done` then resolves. */
|
|
687
|
+
stop(): void;
|
|
688
|
+
/** Resolves when the reading ends - read to the end, or stopped; rejects when it failed. */
|
|
689
|
+
readonly done: Promise<void>;
|
|
690
|
+
}
|
|
691
|
+
/** Start reading a text. `onState` hears every change of state until `done` settles. */
|
|
692
|
+
type SpeakText = (text: string, options: {
|
|
693
|
+
lang?: string;
|
|
694
|
+
onState: (state: ReadAloudState) => void;
|
|
695
|
+
}) => SpeechPlayback;
|
|
696
|
+
/**
|
|
697
|
+
* A reading that failed in the engine itself (the browser's voice, the audio element) - a code,
|
|
698
|
+
* not words for the person: the Listen button says its own label. An error a host's
|
|
699
|
+
* `synthesize` throws is shown with its message.
|
|
700
|
+
*/
|
|
701
|
+
declare class SpeechOutputError extends Error {
|
|
702
|
+
readonly code: string;
|
|
703
|
+
constructor(code: string);
|
|
704
|
+
}
|
|
705
|
+
interface SpeakableOptions {
|
|
706
|
+
/** Said in place of a code block (default: nothing - the block is skipped). */
|
|
707
|
+
code?: string;
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* An answer's Markdown as the words to say: no markers (`#`, `*`, `_`, backticks, `>`, list
|
|
711
|
+
* bullets, table rules), a link as its text, a picture as its alt text, a bare URL as its host, a
|
|
712
|
+
* code block NOT read symbol by symbol (left out, or said as `options.code`), inline code as its
|
|
713
|
+
* text, a table's cells one after another. Blocks end in a stop so the voice pauses between them.
|
|
714
|
+
*/
|
|
715
|
+
declare const speakableText: (markdown: string, options?: SpeakableOptions) => string;
|
|
716
|
+
/**
|
|
717
|
+
* A text in pieces of at most `max` characters, cut after a sentence where one ends in time,
|
|
718
|
+
* else after a word: engines read long text badly in one go (Chrome's voices stop after some
|
|
719
|
+
* seconds; a provider takes a few thousand characters per call).
|
|
720
|
+
*/
|
|
721
|
+
declare const splitForSpeech: (text: string, max?: number) => string[];
|
|
722
|
+
/** The slice of a `SpeechSynthesisVoice` used here. */
|
|
723
|
+
interface SpeechVoiceLike {
|
|
724
|
+
voiceURI: string;
|
|
725
|
+
name: string;
|
|
726
|
+
lang: string;
|
|
727
|
+
localService?: boolean;
|
|
728
|
+
default?: boolean;
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* The voice to read a language with: the person's (by `voiceURI`) while the browser has it; else
|
|
732
|
+
* one of exactly that language (`pt-BR`), then of its base (`pt`) - a voice on the device before a
|
|
733
|
+
* network one, the browser's default of the language first. Undefined: none for the language (the
|
|
734
|
+
* browser then reads with its own default).
|
|
735
|
+
*/
|
|
736
|
+
declare const voiceFor: <V extends SpeechVoiceLike>(voices: readonly V[], lang: string | undefined, preferred?: string) => V | undefined;
|
|
737
|
+
/** The voices of a language (`voiceFor`'s matching), for a picker. */
|
|
738
|
+
declare const voicesOf: <V extends SpeechVoiceLike>(voices: readonly V[], lang: string | undefined) => V[];
|
|
739
|
+
/** The slice of `speechSynthesis` this module drives. */
|
|
740
|
+
interface SpeechSynthesisLike {
|
|
741
|
+
speak(utterance: SpeechUtteranceLike): void;
|
|
742
|
+
cancel(): void;
|
|
743
|
+
pause(): void;
|
|
744
|
+
resume(): void;
|
|
745
|
+
getVoices(): SpeechVoiceLike[];
|
|
746
|
+
readonly speaking?: boolean;
|
|
747
|
+
}
|
|
748
|
+
interface SpeechUtteranceLike {
|
|
749
|
+
text: string;
|
|
750
|
+
lang: string;
|
|
751
|
+
voice: SpeechVoiceLike | null;
|
|
752
|
+
rate: number;
|
|
753
|
+
onstart: (() => void) | null;
|
|
754
|
+
onend: (() => void) | null;
|
|
755
|
+
onerror: ((event: {
|
|
756
|
+
error?: string;
|
|
757
|
+
}) => void) | null;
|
|
758
|
+
}
|
|
759
|
+
/** Whether the browser can read aloud (it has `speechSynthesis`). */
|
|
760
|
+
declare const speechSynthesisSupported: () => boolean;
|
|
761
|
+
interface BrowserSpeakerOptions {
|
|
762
|
+
/** The person's voice (`voiceURI`); else one of the text's language (`voiceFor`). */
|
|
763
|
+
voice?: string;
|
|
764
|
+
/** 0.1-10, default 1. */
|
|
765
|
+
rate?: number;
|
|
766
|
+
/** Default: the page's `speechSynthesis` and `SpeechSynthesisUtterance` (tests hand in their own). */
|
|
767
|
+
synth?: SpeechSynthesisLike;
|
|
768
|
+
createUtterance?: (text: string) => SpeechUtteranceLike;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Read with the browser's `speechSynthesis`: on the device (a local voice works offline), free.
|
|
772
|
+
* The text goes in pieces (`splitForSpeech`); one reading at a time in the whole page - starting
|
|
773
|
+
* one cancels any other.
|
|
774
|
+
*/
|
|
775
|
+
declare const createBrowserSpeaker: (options?: BrowserSpeakerOptions) => SpeakText;
|
|
776
|
+
/** Make the audio of a text: the host's call to a text-to-speech model. */
|
|
777
|
+
type SynthesizeSpeech = (text: string, context: {
|
|
778
|
+
lang?: string;
|
|
779
|
+
signal: AbortSignal;
|
|
780
|
+
}) => Promise<Blob>;
|
|
781
|
+
/** The slice of an `HTMLAudioElement` this module drives. */
|
|
782
|
+
interface AudioLike {
|
|
783
|
+
src: string;
|
|
784
|
+
paused: boolean;
|
|
785
|
+
play(): Promise<void>;
|
|
786
|
+
pause(): void;
|
|
787
|
+
onended: (() => void) | null;
|
|
788
|
+
onerror: (() => void) | null;
|
|
789
|
+
}
|
|
790
|
+
interface AudioSpeakerOptions {
|
|
791
|
+
synthesize: SynthesizeSpeech;
|
|
792
|
+
/** Characters per call (default 2000): a long answer is several calls, the next made while one plays. */
|
|
793
|
+
maxChars?: number;
|
|
794
|
+
/** Default: `new Audio()`. */
|
|
795
|
+
createAudio?: () => AudioLike;
|
|
796
|
+
/** Default: `URL.createObjectURL` / `URL.revokeObjectURL`. */
|
|
797
|
+
objectUrl?: {
|
|
798
|
+
create: (blob: Blob) => string;
|
|
799
|
+
revoke: (url: string) => void;
|
|
800
|
+
};
|
|
801
|
+
/**
|
|
802
|
+
* Play a moment of silence on the element at once, inside the person's tap (default true): iOS
|
|
803
|
+
* Safari plays an element later - after the audio was made - only if it was played inside the
|
|
804
|
+
* gesture. Call `speak` from the click handler for it to count.
|
|
805
|
+
*/
|
|
806
|
+
unlock?: boolean;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Read with an engine that makes audio - a provider's text-to-speech model: each piece of the text
|
|
810
|
+
* (`maxChars`) is made by `synthesize` and played from a `blob:` URL, revoked when it has played
|
|
811
|
+
* or the reading stops. Stopping aborts a call in flight (`signal`). Nothing is stored.
|
|
812
|
+
*/
|
|
813
|
+
declare const createAudioSpeaker: (options: AudioSpeakerOptions) => SpeakText;
|
|
814
|
+
|
|
815
|
+
interface UseReadAloudReturn {
|
|
816
|
+
/** The id of what is being read (a message's), or undefined. */
|
|
817
|
+
current: string | undefined;
|
|
818
|
+
/** Where that reading is. */
|
|
819
|
+
state: ReadAloudState | undefined;
|
|
820
|
+
/**
|
|
821
|
+
* The id whose last reading failed (until another starts), with the host's words for it - none
|
|
822
|
+
* when the engine itself failed (`SpeechOutputError`: say your own label).
|
|
823
|
+
*/
|
|
824
|
+
failed: {
|
|
825
|
+
id: string;
|
|
826
|
+
message?: string;
|
|
827
|
+
} | undefined;
|
|
828
|
+
/** Read `text` as `id`: whatever else was being read stops first - one at a time. */
|
|
829
|
+
start: (id: string, text: string) => void;
|
|
830
|
+
pause: () => void;
|
|
831
|
+
resume: () => void;
|
|
832
|
+
stop: () => void;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* One reading at a time over a list (the chat's answers): `start` stops the one before, `stop`
|
|
836
|
+
* ends it, unmounting ends it. The engine is any `SpeakText` - the browser's voices
|
|
837
|
+
* (`createBrowserSpeaker`) or a provider's (`createAudioSpeaker`).
|
|
838
|
+
*/
|
|
839
|
+
declare const useReadAloud: (speak: SpeakText | undefined, lang?: string) => UseReadAloudReturn;
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* The browser's voices (`speechSynthesis.getVoices()`), kept current: most browsers fill the list
|
|
843
|
+
* after the page loads (`voiceschanged`). Empty where there is no `speechSynthesis`.
|
|
844
|
+
*/
|
|
845
|
+
declare const useSpeechVoices: () => SpeechVoiceLike[];
|
|
846
|
+
|
|
847
|
+
/** Turn a recording into text: the host's call to a speech-to-text model. */
|
|
848
|
+
type TranscribeAudio = (audio: RecordedAudio, context: {
|
|
849
|
+
/** The recognizer's language (BCP-47), a hint for the model. */
|
|
850
|
+
lang: string;
|
|
851
|
+
/** Aborted when the person cancels (or the composer goes away). */
|
|
852
|
+
signal: AbortSignal;
|
|
853
|
+
}) => Promise<string>;
|
|
854
|
+
interface RecordingRecognizerOptions extends RecordingDeps {
|
|
855
|
+
/** The speech-to-text call - a provider's transcription model, an on-device engine. */
|
|
856
|
+
transcribe: TranscribeAudio;
|
|
857
|
+
/** The longest dictation (default: the recorder's five minutes). */
|
|
858
|
+
maxMs?: number;
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* A recognizer for `useSpeechToText` / the composer's mic (`speech.createRecognizer`) that
|
|
862
|
+
* RECORDS and then hands the audio to `transcribe`: tap to start (the microphone is asked for
|
|
863
|
+
* then), tap again to stop - the words arrive once, as one final result, after the model has
|
|
864
|
+
* answered (`useSpeechToText().finishing` meanwhile). The microphone is let go as soon as the
|
|
865
|
+
* recording stops; the audio is given to `transcribe` and kept nowhere.
|
|
866
|
+
*
|
|
867
|
+
* Errors come as the Web Speech API's codes where there is one (`not-allowed`, `audio-capture`),
|
|
868
|
+
* the recorder's otherwise (`busy`, `unsupported`), and `transcription` with the thrown error's
|
|
869
|
+
* `message` - say it in the host's words: the composer shows the message as given.
|
|
870
|
+
*/
|
|
871
|
+
declare const createRecordingRecognizer: (options: RecordingRecognizerOptions) => (() => SpeechRecognizerLike);
|
|
872
|
+
|
|
500
873
|
interface UseCredentialsReturn {
|
|
501
874
|
/** The underlying store — pass this straight to `createAgent({ credentials })`. */
|
|
502
875
|
store: CredentialStore;
|
|
@@ -765,6 +1138,8 @@ interface ComposerAttachment {
|
|
|
765
1138
|
path?: string;
|
|
766
1139
|
/** "converted from report.pdf" and the like. */
|
|
767
1140
|
note?: string;
|
|
1141
|
+
/** A recording's length in milliseconds (a voice message). */
|
|
1142
|
+
durationMs?: number;
|
|
768
1143
|
}
|
|
769
1144
|
/** The kind of an attachment from its media type and name. */
|
|
770
1145
|
declare const attachmentKindOf: (mediaType: string, name: string) => ComposerAttachment["kind"];
|
|
@@ -883,6 +1258,16 @@ interface NoticeTexts {
|
|
|
883
1258
|
* latest compaction, a failure to start. Pure — derived from the UI state.
|
|
884
1259
|
*/
|
|
885
1260
|
declare const noticesOf: (state: AgentUiState, texts?: Partial<NoticeTexts>) => ComposerNotice[];
|
|
1261
|
+
/** A recording's length as a clock: `0:07`, `12:30`, `1:02:05`. */
|
|
1262
|
+
declare const formatClock: (ms: number) => string;
|
|
1263
|
+
/**
|
|
1264
|
+
* What to say of a microphone or dictation failure: the recognizer's own words when it gave some
|
|
1265
|
+
* (a host's transcription error, already in its language), else the label of the code - a refused
|
|
1266
|
+
* permission says how to allow it again.
|
|
1267
|
+
*/
|
|
1268
|
+
declare const micProblemText: (code: string | undefined, message: string | undefined, labels: Pick<AgentLabels, "micDenied" | "micMissing" | "micBusy" | "micUnsupported" | "dictationFailed" | "microphone">) => string;
|
|
1269
|
+
/** A voice message's file name, from when it was recorded: `voice-2026-11-29-1052.webm`. */
|
|
1270
|
+
declare const voiceMessageName: (at: Date, extension: string) => string;
|
|
886
1271
|
|
|
887
1272
|
/**
|
|
888
1273
|
* What a workspace file is to the UI. `image` is only what the core's media tools accept
|
|
@@ -951,6 +1336,35 @@ interface AgentLabels {
|
|
|
951
1336
|
dictateTitle: string;
|
|
952
1337
|
stopDictation: string;
|
|
953
1338
|
microphone: string;
|
|
1339
|
+
/** While a recording recognizer waits for its model (`useSpeechToText().finishing`). */
|
|
1340
|
+
transcribing: string;
|
|
1341
|
+
/** The microphone was refused (`not-allowed`): how to allow it again. */
|
|
1342
|
+
micDenied: string;
|
|
1343
|
+
/** No microphone on the device (`audio-capture`). */
|
|
1344
|
+
micMissing: string;
|
|
1345
|
+
/** The microphone is held by another app (`busy`). */
|
|
1346
|
+
micBusy: string;
|
|
1347
|
+
/** No recording here at all (`unsupported`: an insecure page, no `MediaRecorder`). */
|
|
1348
|
+
micUnsupported: string;
|
|
1349
|
+
/** A dictation that failed without words of its own. */
|
|
1350
|
+
dictationFailed: string;
|
|
1351
|
+
/** The composer's voice-message button (`voiceMessage` of the composer). */
|
|
1352
|
+
recordVoiceMessage: string;
|
|
1353
|
+
/**
|
|
1354
|
+
* A recording, in words: the title of a chat a voice message starts (until its transcript is
|
|
1355
|
+
* there), the name a screen reader gives a message that is only a recording.
|
|
1356
|
+
*/
|
|
1357
|
+
voiceMessage: string;
|
|
1358
|
+
/** The length shown beside a voice message's player (`formatClock`: "0:07"). */
|
|
1359
|
+
audioDuration: (clock: string) => string;
|
|
1360
|
+
/** The strip while a voice message is recorded: "Recording 0:07". */
|
|
1361
|
+
recording: (elapsed: string) => string;
|
|
1362
|
+
/** Its button that keeps the recording as an attachment. */
|
|
1363
|
+
recordingDone: string;
|
|
1364
|
+
/** Its button that throws the recording away. */
|
|
1365
|
+
recordingCancel: string;
|
|
1366
|
+
/** A voice message that reached the longest recording and was stopped by itself. */
|
|
1367
|
+
recordingLimit: string;
|
|
954
1368
|
model: string;
|
|
955
1369
|
thinking: string;
|
|
956
1370
|
toolConsent: string;
|
|
@@ -964,6 +1378,7 @@ interface AgentLabels {
|
|
|
964
1378
|
agentsTitle: string;
|
|
965
1379
|
/** Banners: a limit stopped the run / the context was compacted. */
|
|
966
1380
|
notices: NoticeTexts;
|
|
1381
|
+
/** No longer shown: a message of attachments only is shown as its attachments, with no text. */
|
|
967
1382
|
attachmentsOnly: string;
|
|
968
1383
|
seeAttachments: string;
|
|
969
1384
|
tooLarge: (name: string, mb: number) => string;
|
|
@@ -1104,6 +1519,18 @@ interface AgentLabels {
|
|
|
1104
1519
|
transcriptOf: (name: string) => string;
|
|
1105
1520
|
/** Says whose words a transcript is: the content of the user's file, not the agent's. */
|
|
1106
1521
|
transcriptNote: string;
|
|
1522
|
+
/** The accessible name of an attached audio file's player (a voice message). */
|
|
1523
|
+
audioAttachment: (name: string) => string;
|
|
1524
|
+
readAloud: string;
|
|
1525
|
+
readAloudPause: string;
|
|
1526
|
+
readAloudResume: string;
|
|
1527
|
+
readAloudStop: string;
|
|
1528
|
+
/** While the audio is made (a provider's voice). */
|
|
1529
|
+
readAloudLoading: string;
|
|
1530
|
+
/** Said in place of a code block - the code is not read out. Empty: the block is skipped. */
|
|
1531
|
+
readAloudCode: string;
|
|
1532
|
+
/** A reading that failed without words of its own. */
|
|
1533
|
+
readAloudFailed: string;
|
|
1107
1534
|
/** Above the chips: "3 files written in this turn". */
|
|
1108
1535
|
filesWritten: (n: number) => string;
|
|
1109
1536
|
/** In the activity summary: "3 files". */
|
|
@@ -1554,6 +1981,11 @@ interface ComposerModelOption {
|
|
|
1554
1981
|
interface ComposerModelChip {
|
|
1555
1982
|
/** What the chip says, e.g. "Gemini 3.5 Flash". */
|
|
1556
1983
|
label: string;
|
|
1984
|
+
/**
|
|
1985
|
+
* What it says when `label` does not fit (a phone) - e.g. "Auto" for "Google AI · Auto". Taken
|
|
1986
|
+
* only while the full label would be cut; the full `label` stays its tooltip.
|
|
1987
|
+
*/
|
|
1988
|
+
shortLabel?: string;
|
|
1557
1989
|
/** Models to switch to from the chip's menu (omit for a read-only label). */
|
|
1558
1990
|
options?: ComposerModelOption[];
|
|
1559
1991
|
value?: string;
|
|
@@ -1647,9 +2079,23 @@ interface AgentComposerProps {
|
|
|
1647
2079
|
* its own panel).
|
|
1648
2080
|
*/
|
|
1649
2081
|
dropZone?: 'self' | 'window' | RefObject<HTMLElement | null>;
|
|
1650
|
-
/**
|
|
2082
|
+
/**
|
|
2083
|
+
* Speech-to-text mic (default: on when supported): the browser's Web Speech API, or your own
|
|
2084
|
+
* recognizer - `createRecognizer` (keep it stable), e.g. `createRecordingRecognizer` with a
|
|
2085
|
+
* provider's transcription model: it records, and the words land in the box when the model has
|
|
2086
|
+
* answered. The microphone is asked for only when the mic is tapped.
|
|
2087
|
+
*/
|
|
1651
2088
|
speech?: boolean | {
|
|
1652
2089
|
lang?: string;
|
|
2090
|
+
createRecognizer?: () => SpeechRecognizerLike;
|
|
2091
|
+
};
|
|
2092
|
+
/**
|
|
2093
|
+
* A voice-message button beside "+" (default false): tap to record, then attach the recording
|
|
2094
|
+
* (or discard it); it is sent as an audio attachment - for an agent whose core transcribes audio
|
|
2095
|
+
* (`media.transcriptionModel`). Needs `attachments`. `maxMs`: the longest (default 5 min).
|
|
2096
|
+
*/
|
|
2097
|
+
voiceMessage?: boolean | {
|
|
2098
|
+
maxMs?: number;
|
|
1653
2099
|
};
|
|
1654
2100
|
/** Run timer chip (default true). */
|
|
1655
2101
|
showTimer?: boolean;
|
|
@@ -1703,7 +2149,7 @@ interface AgentComposerProps {
|
|
|
1703
2149
|
*
|
|
1704
2150
|
* Every piece can be switched off; `<AgentChat>` uses it as its footer.
|
|
1705
2151
|
*/
|
|
1706
|
-
declare const AgentComposer: ({ controller: agent, placeholder, model, thinking, labels: labelsOverride, commands, builtinCommands, skillCommands, attachments, convertFile, convert, files: vfs, dropZone, speech, showTimer, showAgents, showApprovalMode, showNotices, steering, showQueued, compactWidth, toolbarExtra, toolbarEnd, renderAttachment, draft, disabled, className, }: AgentComposerProps) => react.JSX.Element;
|
|
2152
|
+
declare const AgentComposer: ({ controller: agent, placeholder, model, thinking, labels: labelsOverride, commands, builtinCommands, skillCommands, attachments, convertFile, convert, files: vfs, dropZone, speech, voiceMessage, showTimer, showAgents, showApprovalMode, showNotices, steering, showQueued, compactWidth, toolbarExtra, toolbarEnd, renderAttachment, draft, disabled, className, }: AgentComposerProps) => react.JSX.Element;
|
|
1707
2153
|
|
|
1708
2154
|
interface ChatHistoryListProps {
|
|
1709
2155
|
/** From `useChatHistory(agent)`. */
|
|
@@ -2044,6 +2490,15 @@ interface StepListProps {
|
|
|
2044
2490
|
*/
|
|
2045
2491
|
declare const StepList: ({ steps, subagents, approvals, notes, showNotes, onStopSubagent, showToolCalls, showUsage, showThoughts, showTiers, showReplanFailed, showDecisions, showSearchResults, showSubagents, renderToolCall, renderSubagent, labels, className, }: StepListProps) => react.JSX.Element | null;
|
|
2046
2492
|
|
|
2493
|
+
/** Read the answers aloud: a Listen button on each finished answer (`<AgentChat readAloud>`). */
|
|
2494
|
+
interface ReadAloudOptions {
|
|
2495
|
+
/** The engine: `createBrowserSpeaker()` (the device's voices) or `createAudioSpeaker(...)`. Keep it stable. */
|
|
2496
|
+
speak: SpeakText;
|
|
2497
|
+
/** The answers' language (BCP-47): the browser's voice is picked for it. */
|
|
2498
|
+
lang?: string;
|
|
2499
|
+
/** What is read of an answer. Default: its Markdown as words (`speakableText`, code left out). */
|
|
2500
|
+
textOf?: (message: ChatMessage) => string;
|
|
2501
|
+
}
|
|
2047
2502
|
interface MessageListProps {
|
|
2048
2503
|
messages: ChatMessage[];
|
|
2049
2504
|
/** Rendered when there are no messages yet. */
|
|
@@ -2109,6 +2564,11 @@ interface MessageListProps {
|
|
|
2109
2564
|
renderMessage?: (message: ChatMessage, fallback: ReactNode) => ReactNode;
|
|
2110
2565
|
/** An attachment shown with a message (thumbnail / chip by default). */
|
|
2111
2566
|
renderAttachment?: (attachment: ChatAttachment, message: ChatMessage) => ReactNode;
|
|
2567
|
+
/**
|
|
2568
|
+
* A Listen button on each finished answer - one reading at a time, with Pause / Resume / Stop
|
|
2569
|
+
* (default: none).
|
|
2570
|
+
*/
|
|
2571
|
+
readAloud?: ReadAloudOptions;
|
|
2112
2572
|
/** Tool calls inside the activity. */
|
|
2113
2573
|
renderToolCall?: RenderToolCall;
|
|
2114
2574
|
/**
|
|
@@ -2130,9 +2590,21 @@ interface MessageListProps {
|
|
|
2130
2590
|
}
|
|
2131
2591
|
/** "in 12k · out 456 · think 120 · cached 9k · 4.2 s" for one answer. */
|
|
2132
2592
|
declare const usageLine: (usage: IUsage | undefined, durationMs?: number) => string;
|
|
2133
|
-
/**
|
|
2134
|
-
|
|
2593
|
+
/**
|
|
2594
|
+
* Chrome's recordings (WebM from `MediaRecorder`) carry no duration: the native player shows
|
|
2595
|
+
* 0:00 and cannot seek until the media was read to its end. Seeking far past the end makes the
|
|
2596
|
+
* browser read it and set the duration; then it goes back to the start. Only for such a file.
|
|
2597
|
+
*/
|
|
2598
|
+
declare const settleAudioDuration: (el: HTMLAudioElement) => void;
|
|
2599
|
+
/**
|
|
2600
|
+
* The built-in attachment: an image thumbnail (opens in the viewer), an audio file as a player
|
|
2601
|
+
* (with `files` and the file's workspace path: read into a `blob:` URL; else a chip with its
|
|
2602
|
+
* length), or a file chip.
|
|
2603
|
+
*/
|
|
2604
|
+
declare const AttachmentView: ({ attachment: a, files, labels, }: {
|
|
2135
2605
|
attachment: ChatAttachment;
|
|
2606
|
+
files?: VirtualFileSystem;
|
|
2607
|
+
labels?: AgentLabelsOverride;
|
|
2136
2608
|
}) => react.JSX.Element;
|
|
2137
2609
|
/**
|
|
2138
2610
|
* The chat transcript. User turns show their text and attachments (image
|
|
@@ -2141,7 +2613,7 @@ declare const AttachmentView: ({ attachment: a }: {
|
|
|
2141
2613
|
* subagents, consent decisions — and the tokens it spent by kind. Every part
|
|
2142
2614
|
* can be hidden, relabelled or rendered by the host.
|
|
2143
2615
|
*/
|
|
2144
|
-
declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, showNotes, showLearned, showTiers, showReplanFailed, showDecisions, showSearchResults, showSubagents, showMedia, showFileChips, files, htmlPreview, onShowFiles, renderFile, renderFileContent, renderMedia, renderSubagent, onStopSubagent, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, renderApp, showApps, imageViewer, renderImageViewer, labels, className, }: MessageListProps) => react.JSX.Element | null;
|
|
2616
|
+
declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, showNotes, showLearned, showTiers, showReplanFailed, showDecisions, showSearchResults, showSubagents, showMedia, showFileChips, files, htmlPreview, onShowFiles, renderFile, renderFileContent, renderMedia, renderSubagent, onStopSubagent, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, renderApp, showApps, imageViewer, renderImageViewer, readAloud, labels, className, }: MessageListProps) => react.JSX.Element | null;
|
|
2145
2617
|
|
|
2146
2618
|
interface QuestionPromptProps {
|
|
2147
2619
|
/**
|
|
@@ -2389,6 +2861,12 @@ interface AgentChatProps {
|
|
|
2389
2861
|
renderContent?: MessageListProps['renderContent'];
|
|
2390
2862
|
renderMessage?: MessageListProps['renderMessage'];
|
|
2391
2863
|
renderAttachment?: MessageListProps['renderAttachment'];
|
|
2864
|
+
/**
|
|
2865
|
+
* A Listen button on each finished answer (default: none): `{ speak, lang? }` with
|
|
2866
|
+
* `createBrowserSpeaker()` for the device's voices, or `createAudioSpeaker({ synthesize })` for
|
|
2867
|
+
* a provider's. One answer is read at a time.
|
|
2868
|
+
*/
|
|
2869
|
+
readAloud?: MessageListProps['readAloud'];
|
|
2392
2870
|
renderToolCall?: RenderToolCall;
|
|
2393
2871
|
/** A node of the subagent tree. */
|
|
2394
2872
|
renderSubagent?: RenderSubagent;
|
|
@@ -2950,5 +3428,5 @@ interface AppRequestPromptProps {
|
|
|
2950
3428
|
*/
|
|
2951
3429
|
declare const AppRequestPrompt: ({ requests, onAnswer, renderRequest, labels, className, }: AppRequestPromptProps) => react.JSX.Element | null;
|
|
2952
3430
|
|
|
2953
|
-
export { ASK_USER_TOOL_NAME, ATTACHMENT_BOUNDS, AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, AttachmentView, BudgetView, ChatAttachment, ChatHistoryList, ChatHistoryStore, ChatMessage, CompactionView, Composer, ContextMeter, DecisionView, ElicitationIssueKind, ElicitationOutcomeReason, ElicitationPrompt, ElicitationView, FILE_PREVIEW_CHARS, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, FileChip, FileChips, FilesPanel, GeneratedMedia, HTML_PREVIEW_MAX_CHARS, ImageThumb, ImageViewer, ImageViewerProvider, LearnedSkills, LessonView, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MessageList, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, QUESTION_TIMEOUT_MS, QuestionPrompt, QuestionView, RemoteRunView, SandboxedFrame, SourceView, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, agentStatusOf, askUserOutputKept, askUserWith, attachmentKindOf, attachmentOverLimit, attachmentRefusal, attachmentTransformOf, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createInitialAgentState, createQuestionQueue, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, followsAfterResize, followsAfterScroll, formatElapsed, imageExtensionOf, imageSizeOf, lessonsOf, linkedFilesOf, mediaFamilyOf, menuKeyTarget, menuSections, mergeChatRecord, mergeLabels, messageOverLimit, newChatId, noticesOf, parseSlash, pendingApprovalsOf, questionChoiceOf, questionOtherOf, questionTimeoutOf, sandboxTokens, sandboxedCsp, saveChat, steerIntent, subagentTree, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useFollowScroll, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, webSearchOf, withAttachments, withCspFirst, withPolicyFirst, withoutOwnWords };
|
|
2954
|
-
export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, AttachmentBounds, AttachmentOverLimit, AttachmentTransform, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerModelOption, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, ImageSize, ImageThumbProps, ImageViewerProps, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MenuSection, MessageListProps, ModelLoadBarProps, NoticeTexts, PendingQuestion, PlanViewProps, QuestionOutcomeReason, QuestionPromptProps, QuestionQueue, QuestionQueueOptions, RenderImageViewer, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, ScrollMeasure, SlashCommand, SourceToken, SourceViewProps, SpeechRecognizerLike, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, ToolApprovalPromptProps, ToolCallRowProps, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, ViewerImage, WebLLMModelFactory, WebSearchResultView, WebSearchView };
|
|
3431
|
+
export { ASK_USER_TOOL_NAME, ATTACHMENT_BOUNDS, AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, AttachmentView, BudgetView, ChatAttachment, ChatHistoryList, ChatHistoryStore, ChatMessage, CompactionView, Composer, ContextMeter, DecisionView, ElicitationIssueKind, ElicitationOutcomeReason, ElicitationPrompt, ElicitationView, FILE_PREVIEW_CHARS, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, FileChip, FileChips, FilesPanel, GeneratedMedia, HTML_PREVIEW_MAX_CHARS, ImageThumb, ImageViewer, ImageViewerProvider, LearnedSkills, LessonView, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MessageList, MicError, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, QUESTION_TIMEOUT_MS, QuestionPrompt, QuestionView, RECORDING_DEFAULT_MAX_MS, RECORDING_TYPES, RemoteRunView, SandboxedFrame, SourceView, SpeechOutputError, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, agentStatusOf, askUserOutputKept, askUserWith, attachmentKindOf, attachmentOverLimit, attachmentRefusal, attachmentTransformOf, attachmentsText, audioExtensionOf, audioTypeOf, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createAudioSpeaker, createBrowserSpeaker, createInitialAgentState, createQuestionQueue, createRecordingRecognizer, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, followsAfterResize, followsAfterScroll, formatClock, formatElapsed, imageExtensionOf, imageSizeOf, lessonsOf, linkedFilesOf, mediaFamilyOf, menuKeyTarget, menuSections, mergeChatRecord, mergeLabels, messageOverLimit, micProblemOf, micProblemText, newChatId, noticesOf, parseSlash, pendingApprovalsOf, pickRecordingType, questionChoiceOf, questionOtherOf, questionTimeoutOf, recordingSupported, sandboxTokens, sandboxedCsp, saveChat, settleAudioDuration, speakableText, speechSynthesisSupported, splitForSpeech, startRecording, steerIntent, stopTracks, subagentTree, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useAudioRecorder, useChatHistory, useCredentials, useFollowScroll, useLabels, useLocalModel, useOptionalAgentContext, useReadAloud, useSpeechToText, useSpeechVoices, useVirtualFiles, useWebLLMModel, voiceFor, voiceMessageName, voicesOf, webSearchOf, withAttachments, withCspFirst, withPolicyFirst, withoutOwnWords };
|
|
3432
|
+
export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, AttachmentBounds, AttachmentOverLimit, AttachmentTexts, AttachmentTransform, AudioLike, AudioSpeakerOptions, BrowserSpeakerOptions, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerModelOption, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, ImageSize, ImageThumbProps, ImageViewerProps, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MediaRecorderConstructorLike, MediaRecorderLike, MenuSection, MessageListProps, MicProblem, ModelLoadBarProps, NoticeTexts, PendingQuestion, PlanViewProps, QuestionOutcomeReason, QuestionPromptProps, QuestionQueue, QuestionQueueOptions, ReadAloudOptions, ReadAloudState, RecordedAudio, Recording, RecordingDeps, RecordingRecognizerOptions, RenderImageViewer, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, ScrollMeasure, SlashCommand, SourceToken, SourceViewProps, SpeakText, SpeakableOptions, SpeechPlayback, SpeechRecognizerLike, SpeechSynthesisLike, SpeechUtteranceLike, SpeechVoiceLike, StartRecordingOptions, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, SynthesizeSpeech, ToolApprovalPromptProps, ToolCallRowProps, TranscribeAudio, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseAudioRecorderOptions, UseAudioRecorderReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseReadAloudReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, ViewerImage, WebLLMModelFactory, WebSearchResultView, WebSearchView };
|