@yieldfabric/terminal 1.1.2 → 1.2.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.
- package/dist/index.cjs +1120 -3
- package/dist/index.d.cts +366 -2
- package/dist/index.d.ts +366 -2
- package/dist/index.js +1107 -5
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -874,6 +874,10 @@ interface TerminalSlots {
|
|
|
874
874
|
afterEntries?: React.ReactNode;
|
|
875
875
|
/** Rendered inside the input bar area, between the toolbar hints and the action buttons. */
|
|
876
876
|
inputBarExtra?: React.ReactNode;
|
|
877
|
+
/** Rendered first on the input bar's toolbar row, left, and always — the
|
|
878
|
+
* helper chips beside it appear only while the person is writing. For a
|
|
879
|
+
* control the composer should always carry (which conversation this is). */
|
|
880
|
+
inputBarLeading?: React.ReactNode;
|
|
877
881
|
/** When provided, **replaces** the default Auto/Reason mode selector in the
|
|
878
882
|
* input bar toolbar. Consumers can inject any button (e.g. Direct/Coach in
|
|
879
883
|
* the Agent Studio) while keeping the same toolbar position and styling. */
|
|
@@ -1199,6 +1203,9 @@ interface TerminalInputBarProps {
|
|
|
1199
1203
|
selectedPaletteItem: number;
|
|
1200
1204
|
onSelectPaletteItem: (id: string) => void;
|
|
1201
1205
|
inputBarExtra?: React.ReactNode;
|
|
1206
|
+
/** First on the toolbar row, and shown whether or not the person is
|
|
1207
|
+
* writing (see `TerminalSlots.inputBarLeading`). */
|
|
1208
|
+
leading?: React.ReactNode;
|
|
1202
1209
|
/** When provided, replaces the default Auto/Reason selector in the toolbar. */
|
|
1203
1210
|
modeSelector?: React.ReactNode;
|
|
1204
1211
|
/** Keeps toolbar affordances icon-sized even in a wide container. */
|
|
@@ -1220,7 +1227,34 @@ interface TerminalInputBarProps {
|
|
|
1220
1227
|
*/
|
|
1221
1228
|
autoFocus?: boolean;
|
|
1222
1229
|
}
|
|
1223
|
-
declare function TerminalInputBar({ inputRef, fileInputRef, currentCommand, isExecuting, disabled, placeholder, onInputChange, onKeyDown, onSubmit, onTyping, onUploadFiles, onListFilesCommand, availableKGs, activeKGScope, onKGScopeChange, reasoningMode, onReasoningModeChange, knownMentionNames, onCaretChange, showUploadButton, showFilesButton, commandPaletteItems, selectedPaletteItem, onSelectPaletteItem, inputBarExtra, modeSelector, compactToolbar, submitTitle, autoFocus, }: TerminalInputBarProps): react_jsx_runtime.JSX.Element;
|
|
1230
|
+
declare function TerminalInputBar({ inputRef, fileInputRef, currentCommand, isExecuting, disabled, placeholder, onInputChange, onKeyDown, onSubmit, onTyping, onUploadFiles, onListFilesCommand, availableKGs, activeKGScope, onKGScopeChange, reasoningMode, onReasoningModeChange, knownMentionNames, onCaretChange, showUploadButton, showFilesButton, commandPaletteItems, selectedPaletteItem, onSelectPaletteItem, inputBarExtra, leading, modeSelector, compactToolbar, submitTitle, autoFocus, }: TerminalInputBarProps): react_jsx_runtime.JSX.Element;
|
|
1231
|
+
|
|
1232
|
+
/** Where a live voice session is, as the button shows it. */
|
|
1233
|
+
type VoiceButtonState = 'off' | 'connecting' | 'live';
|
|
1234
|
+
interface VoiceInputButtonProps {
|
|
1235
|
+
state: VoiceButtonState;
|
|
1236
|
+
/** Start when off, end when connecting or live. */
|
|
1237
|
+
onToggle: () => void;
|
|
1238
|
+
disabled?: boolean;
|
|
1239
|
+
/** Live loudness 0..1 (whoever is speaking), polled every frame while
|
|
1240
|
+
* live to drive the bars. Without it the bars idle. */
|
|
1241
|
+
level?: () => number;
|
|
1242
|
+
/** Accessible label while off. */
|
|
1243
|
+
startTitle?: string;
|
|
1244
|
+
/** Accessible label while connecting or live. */
|
|
1245
|
+
stopTitle?: string;
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* The microphone toggle for `TerminalInputBar`'s `inputBarExtra` slot.
|
|
1249
|
+
* Presentational: the host owns the session and passes its state (and,
|
|
1250
|
+
* optionally, a loudness getter) in.
|
|
1251
|
+
*
|
|
1252
|
+
* Off, it is a quiet accent-tinted mic. Connecting, it spins. Live, it
|
|
1253
|
+
* fills with the accent, breathes a halo, and its four bars move with the
|
|
1254
|
+
* voice — so the one control that ends the session is also the one that
|
|
1255
|
+
* shows it is listening.
|
|
1256
|
+
*/
|
|
1257
|
+
declare function VoiceInputButton({ state, onToggle, disabled, level, startTitle, stopTitle, }: VoiceInputButtonProps): react_jsx_runtime.JSX.Element;
|
|
1224
1258
|
|
|
1225
1259
|
interface SlashMentionCandidate {
|
|
1226
1260
|
entity_id: string;
|
|
@@ -1277,6 +1311,336 @@ interface Props {
|
|
|
1277
1311
|
}
|
|
1278
1312
|
declare function SlashMentionPicker({ candidates, selectedIndex, onPick }: Props): react_jsx_runtime.JSX.Element;
|
|
1279
1313
|
|
|
1314
|
+
/**
|
|
1315
|
+
* Who is talking in a live voice session.
|
|
1316
|
+
*
|
|
1317
|
+
* Every field is optional: what you leave out is the deployment's default
|
|
1318
|
+
* (agents' `YF_VOICE_*` settings — Javier, `cedar`, English, a Latin
|
|
1319
|
+
* American accent — which `GET /voice/status` reports as `persona`). The
|
|
1320
|
+
* server validates the persona and refuses a session whose persona it
|
|
1321
|
+
* cannot honour (`400 invalid_persona`).
|
|
1322
|
+
*
|
|
1323
|
+
* The persona decides who speaks and how. It cannot change what the voice
|
|
1324
|
+
* may do: its one tool, approvals staying on screen, never inventing — the
|
|
1325
|
+
* server writes those rules ahead of any persona text.
|
|
1326
|
+
*/
|
|
1327
|
+
interface VoicePersona {
|
|
1328
|
+
/** What the voice calls itself and answers to. Letters, spaces,
|
|
1329
|
+
* hyphens, apostrophes and full stops; at most 40 characters. */
|
|
1330
|
+
name?: string;
|
|
1331
|
+
/** One of the speech model's own voices. */
|
|
1332
|
+
voice?: VoiceName;
|
|
1333
|
+
/** The one language it speaks (ISO 639-1). It answers in this language
|
|
1334
|
+
* whatever it is spoken to in, and transcribes the person in it. */
|
|
1335
|
+
language?: VoiceLanguage;
|
|
1336
|
+
/** How it sounds speaking, completing "you speak fluent <language> with
|
|
1337
|
+
* …", e.g. `"a warm, natural Latin American Spanish accent"`. `null` for
|
|
1338
|
+
* none. At most 120 characters. */
|
|
1339
|
+
accent?: string | null;
|
|
1340
|
+
/** Its manner in a sentence or two, e.g. `"crisp and upbeat"`. At most
|
|
1341
|
+
* 500 characters. */
|
|
1342
|
+
style?: string;
|
|
1343
|
+
}
|
|
1344
|
+
/** The speech model's own voices. (Azure text-to-speech voices are a
|
|
1345
|
+
* deployment setting only: they bill on a separate meter.) */
|
|
1346
|
+
declare const VOICE_NAMES: readonly ["alloy", "ash", "ballad", "cedar", "coral", "echo", "marin", "sage", "shimmer", "verse"];
|
|
1347
|
+
type VoiceName = (typeof VOICE_NAMES)[number];
|
|
1348
|
+
declare const VOICE_LANGUAGES: readonly ["en", "es", "pt", "fr", "de", "it", "nl", "ar", "hi", "ja", "ko", "zh"];
|
|
1349
|
+
type VoiceLanguage = (typeof VOICE_LANGUAGES)[number];
|
|
1350
|
+
/** The persona as the `?persona=` query value, or null when there is
|
|
1351
|
+
* nothing to override. Undefined fields are dropped; `accent: null` is
|
|
1352
|
+
* kept (it switches the accent off). */
|
|
1353
|
+
declare function encodePersona(persona: VoicePersona | undefined): string | null;
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* A live voice session with an agents deployment.
|
|
1357
|
+
*
|
|
1358
|
+
* The browser streams microphone audio to agents `/voice/realtime`, which
|
|
1359
|
+
* relays it to a speech model and streams the spoken reply back. The
|
|
1360
|
+
* speech model has one tool: when it needs the person's data it sends
|
|
1361
|
+
* `tool_call {question}`, and the host answers it with its own agent loop
|
|
1362
|
+
* (`onAsk`) — so voice gets the same answers, approvals and sources as
|
|
1363
|
+
* typing, and nothing the voice says is ever acted on by itself.
|
|
1364
|
+
*
|
|
1365
|
+
* Wire (agents `src/voice/protocol.rs`): binary frames are PCM16 mono
|
|
1366
|
+
* 24 kHz both ways; text frames are JSON events. The browser may send only
|
|
1367
|
+
* `tool_result`, `progress` (what the host has done and found while it
|
|
1368
|
+
* works, told as paced updates), `cancel_response` and `clear_input`.
|
|
1369
|
+
*/
|
|
1370
|
+
|
|
1371
|
+
/** How to reach agents, as whom, and who is talking. */
|
|
1372
|
+
interface VoiceConnection {
|
|
1373
|
+
/** The agents service, e.g. `https://agents.example.com`. */
|
|
1374
|
+
baseUrl: string;
|
|
1375
|
+
/** The person's OWN access token, read at each connect. Voice is a
|
|
1376
|
+
* personal session: never pass an installed delegation token. */
|
|
1377
|
+
getToken: () => string | null | Promise<string | null>;
|
|
1378
|
+
/** Where the capture worklet is served from your origin (see
|
|
1379
|
+
* `VOICE_CAPTURE_WORKLET_SOURCE`). Leave unset only if your CSP allows
|
|
1380
|
+
* `blob:` scripts. */
|
|
1381
|
+
workletUrl?: string;
|
|
1382
|
+
/** Who is talking. Unset fields keep the deployment's default. */
|
|
1383
|
+
persona?: VoicePersona;
|
|
1384
|
+
/** The conversation thread spoken-only exchanges are written to. */
|
|
1385
|
+
threadId?: string;
|
|
1386
|
+
/** Pins `threadId` to this working group. */
|
|
1387
|
+
workingGroupId?: string;
|
|
1388
|
+
}
|
|
1389
|
+
/** `ws://` for `http://`, `wss://` for `https://`. */
|
|
1390
|
+
declare function socketBase(base: string): string;
|
|
1391
|
+
type VoicePhase = 'connecting' | 'listening' | 'hearing' | 'thinking' | 'speaking';
|
|
1392
|
+
type VoiceEndReason = 'stopped'
|
|
1393
|
+
/** The conversation came to its end: they said they were done and the
|
|
1394
|
+
* goodbye has been heard. */
|
|
1395
|
+
| 'finished' | 'time_limit' | 'replaced' | 'blocked' | 'unavailable' | 'mic_denied' | 'lost';
|
|
1396
|
+
interface VoiceStatus {
|
|
1397
|
+
enabled: boolean;
|
|
1398
|
+
/** A billing code (`card_required`, `credit_exhausted`, …) when the
|
|
1399
|
+
* person's plan refuses voice, else null. */
|
|
1400
|
+
blocked: string | null;
|
|
1401
|
+
maxSessionSecs: number;
|
|
1402
|
+
/** The deployment's default persona. */
|
|
1403
|
+
persona: Required<Pick<VoicePersona, 'name' | 'voice' | 'language'>> & {
|
|
1404
|
+
accent: string | null;
|
|
1405
|
+
} | null;
|
|
1406
|
+
}
|
|
1407
|
+
declare function getVoiceStatus(connection: VoiceConnection, signal?: AbortSignal): Promise<VoiceStatus>;
|
|
1408
|
+
/** One side of a spoken exchange, with the id the relay writes it under
|
|
1409
|
+
* (a live turn given the same id is replaced, not doubled, by a reload). */
|
|
1410
|
+
interface VoiceUtterance {
|
|
1411
|
+
itemId: string;
|
|
1412
|
+
messageId: string;
|
|
1413
|
+
text: string;
|
|
1414
|
+
}
|
|
1415
|
+
interface VoiceReply {
|
|
1416
|
+
messageId: string;
|
|
1417
|
+
/** The utterance it answers, when there was one. */
|
|
1418
|
+
itemId: string | null;
|
|
1419
|
+
text: string;
|
|
1420
|
+
interrupted: boolean;
|
|
1421
|
+
}
|
|
1422
|
+
/** What the host has done (`'step'`) or found (`'found'`) while it works. */
|
|
1423
|
+
type VoiceProgress = (text: string, kind: 'step' | 'found') => void;
|
|
1424
|
+
interface VoiceHandlers {
|
|
1425
|
+
onPhase(phase: VoicePhase): void;
|
|
1426
|
+
/** What the person is saying, as transcribed; `final` once it is done. */
|
|
1427
|
+
onHeard(text: string, final: boolean): void;
|
|
1428
|
+
/** What the voice is saying; `final` once it is done. */
|
|
1429
|
+
onSaying(text: string, final: boolean): void;
|
|
1430
|
+
/** The voice needs your agent. `heard` is the person's own words for
|
|
1431
|
+
* this utterance when transcription caught them, `utterance` its ids.
|
|
1432
|
+
* Call `progress` as your agent works: `'found'` for what came back
|
|
1433
|
+
* ("2 threads match “RSM objection”.") and `'step'` for what it is doing
|
|
1434
|
+
* now. The voice knows the findings whenever it speaks meanwhile, and
|
|
1435
|
+
* tells them as a story on a slow pace (agents decides when; steps alone
|
|
1436
|
+
* are never spoken). Resolve with the text the voice should speak from;
|
|
1437
|
+
* a rejection is spoken as a failure.
|
|
1438
|
+
*
|
|
1439
|
+
* Questions come one at a time: one asked while another is being worked
|
|
1440
|
+
* on waits its turn, and a correction ("no, it's actually…") replaces it
|
|
1441
|
+
* — `signal` aborts when yours was replaced; stop your agent there (what
|
|
1442
|
+
* you resolve with afterwards is not spoken). */
|
|
1443
|
+
onAsk(question: string, heard: string | null, utterance: {
|
|
1444
|
+
itemId: string;
|
|
1445
|
+
messageId: string;
|
|
1446
|
+
} | null, progress: VoiceProgress, signal: AbortSignal): Promise<string>;
|
|
1447
|
+
/** The person finished an utterance (for a transcript). */
|
|
1448
|
+
onUtterance?(utterance: VoiceUtterance): void;
|
|
1449
|
+
/** The voice answered by itself (for a transcript). Delegated answers
|
|
1450
|
+
* are your agent's turns and never arrive here. */
|
|
1451
|
+
onReply?(reply: VoiceReply): void;
|
|
1452
|
+
onEnd(reason: VoiceEndReason, detail?: string): void;
|
|
1453
|
+
}
|
|
1454
|
+
/** Loudness of each side right now, 0..1 (RMS), for the UI to draw. */
|
|
1455
|
+
interface VoiceLevels {
|
|
1456
|
+
/** The person's microphone. */
|
|
1457
|
+
input: number;
|
|
1458
|
+
/** The voice's reply, as it plays. */
|
|
1459
|
+
output: number;
|
|
1460
|
+
}
|
|
1461
|
+
declare const SILENT: VoiceLevels;
|
|
1462
|
+
/** The socket URL for a connection: token, thread and persona as query
|
|
1463
|
+
* parameters (a browser WebSocket cannot send headers). */
|
|
1464
|
+
declare function voiceSocketUrl(connection: VoiceConnection, token: string): string;
|
|
1465
|
+
declare class VoiceSession {
|
|
1466
|
+
private readonly h;
|
|
1467
|
+
private readonly connection;
|
|
1468
|
+
private ctx;
|
|
1469
|
+
private stream;
|
|
1470
|
+
private node;
|
|
1471
|
+
private ws;
|
|
1472
|
+
private player;
|
|
1473
|
+
private inputAnalyser;
|
|
1474
|
+
private outputAnalyser;
|
|
1475
|
+
private inputBuf;
|
|
1476
|
+
private outputBuf;
|
|
1477
|
+
private ready;
|
|
1478
|
+
private ended;
|
|
1479
|
+
private phase;
|
|
1480
|
+
/** The voice's questions to the host, one at a time (see `askQueue.ts`). */
|
|
1481
|
+
private readonly asks;
|
|
1482
|
+
private heard;
|
|
1483
|
+
private partialHeard;
|
|
1484
|
+
private saying;
|
|
1485
|
+
private endingReason;
|
|
1486
|
+
private finishTimer;
|
|
1487
|
+
private blobUrl;
|
|
1488
|
+
constructor(h: VoiceHandlers, connection: VoiceConnection);
|
|
1489
|
+
/** Call from the tap itself: iOS only lets audio start inside a gesture,
|
|
1490
|
+
* so the AudioContext is created before the first `await`. */
|
|
1491
|
+
start(): Promise<void>;
|
|
1492
|
+
stop(): void;
|
|
1493
|
+
/** Cheap enough to call every animation frame. */
|
|
1494
|
+
levels(): VoiceLevels;
|
|
1495
|
+
private setPhase;
|
|
1496
|
+
private settle;
|
|
1497
|
+
private send;
|
|
1498
|
+
private onAudio;
|
|
1499
|
+
private onEvent;
|
|
1500
|
+
/** They are done: end once the goodbye has finished playing. */
|
|
1501
|
+
private finishAfterGoodbye;
|
|
1502
|
+
private cancelFinish;
|
|
1503
|
+
private release;
|
|
1504
|
+
private end;
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
interface VoiceEnded {
|
|
1508
|
+
reason: VoiceEndReason;
|
|
1509
|
+
detail?: string;
|
|
1510
|
+
}
|
|
1511
|
+
/** What a host hands its voice session: `onAsk` answers the voice's
|
|
1512
|
+
* questions with the host's own agent loop; the line callbacks put spoken
|
|
1513
|
+
* exchanges in its transcript. The latest of each is always used. */
|
|
1514
|
+
type VoiceHost = Pick<VoiceHandlers, 'onAsk' | 'onUtterance' | 'onReply'>;
|
|
1515
|
+
interface VoiceSessionState {
|
|
1516
|
+
/** Voice is switched on for this deployment and person. */
|
|
1517
|
+
available: boolean;
|
|
1518
|
+
/** The deployment's default persona name (before your overrides). */
|
|
1519
|
+
defaultName: string | null;
|
|
1520
|
+
phase: VoicePhase | 'off';
|
|
1521
|
+
/** What the person is saying now. */
|
|
1522
|
+
heard: string;
|
|
1523
|
+
/** What the voice is saying now. */
|
|
1524
|
+
saying: string;
|
|
1525
|
+
ended: VoiceEnded | null;
|
|
1526
|
+
/** When the session became live (ms epoch), for a clock. */
|
|
1527
|
+
startedAt: number | null;
|
|
1528
|
+
maxSessionSecs: number;
|
|
1529
|
+
/** Loudness of both sides, polled each frame by visuals. */
|
|
1530
|
+
levels: () => VoiceLevels;
|
|
1531
|
+
/** Whoever is louder right now, 0..1 — for `VoiceInputButton`'s bars. */
|
|
1532
|
+
level: () => number;
|
|
1533
|
+
/** For `VoiceInputButton`. */
|
|
1534
|
+
buttonState: VoiceButtonState;
|
|
1535
|
+
start: () => void;
|
|
1536
|
+
stop: () => void;
|
|
1537
|
+
toggle: () => void;
|
|
1538
|
+
/** Clear `ended`. */
|
|
1539
|
+
dismiss: () => void;
|
|
1540
|
+
}
|
|
1541
|
+
/**
|
|
1542
|
+
* One live voice session for a conversation surface.
|
|
1543
|
+
*
|
|
1544
|
+
* `connection` says where agents is, how to get the person's token, which
|
|
1545
|
+
* thread spoken-only exchanges belong to, and — `persona` — who is
|
|
1546
|
+
* talking. It is read when a session STARTS, so a change applies to the
|
|
1547
|
+
* next session.
|
|
1548
|
+
*
|
|
1549
|
+
* ```tsx
|
|
1550
|
+
* const voice = useVoiceSession(
|
|
1551
|
+
* // `progress` keeps the voice informed while your agent works; `signal`
|
|
1552
|
+
* // aborts when the person corrected the question.
|
|
1553
|
+
* { onAsk: (question, heard, utterance, progress, signal) =>
|
|
1554
|
+
* myAgent.ask(question, { signal, onFound: (f) => progress(f, 'found'), onStep: (s) => progress(s, 'step') }).then(toSpeech) },
|
|
1555
|
+
* {
|
|
1556
|
+
* baseUrl: AGENTS_URL,
|
|
1557
|
+
* getToken: () => auth.userToken(),
|
|
1558
|
+
* workletUrl: '/voice-capture-worklet.js',
|
|
1559
|
+
* persona: { name: 'Javier', voice: 'cedar', language: 'en', accent: 'a warm, natural Latin American Spanish accent' },
|
|
1560
|
+
* },
|
|
1561
|
+
* )
|
|
1562
|
+
* <VoiceDeck voice={voice} name="Javier" />
|
|
1563
|
+
* <TerminalInputBar inputBarExtra={voice.available ? <VoiceInputButton state={voice.buttonState} onToggle={voice.toggle} level={voice.level} /> : null} … />
|
|
1564
|
+
* ```
|
|
1565
|
+
*/
|
|
1566
|
+
declare function useVoiceSession(host: VoiceHost, connection: VoiceConnection): VoiceSessionState;
|
|
1567
|
+
/** One line for why a session ended, or null when nothing needs saying. */
|
|
1568
|
+
declare function voiceEndedMessage(ended: VoiceEnded | null, name?: string): string | null;
|
|
1569
|
+
|
|
1570
|
+
interface VoiceDeckProps {
|
|
1571
|
+
/** From `useVoiceSession`. The deck renders nothing while voice is off. */
|
|
1572
|
+
voice: VoiceSessionState;
|
|
1573
|
+
/** Who is talking, shown while they speak. Defaults to the deployment's
|
|
1574
|
+
* persona name. */
|
|
1575
|
+
name?: string;
|
|
1576
|
+
/** Larger type, a taller band and a thumb-sized End, for phones. */
|
|
1577
|
+
phone?: boolean;
|
|
1578
|
+
/** What to show before anything has been said. */
|
|
1579
|
+
hint?: string;
|
|
1580
|
+
}
|
|
1581
|
+
/**
|
|
1582
|
+
* Live voice, above a composer: a band that weaves the conversation into
|
|
1583
|
+
* glyphs (the person in the theme's ink, the voice in its accent, a
|
|
1584
|
+
* travelling swell while the host's agent works), the last thing heard and
|
|
1585
|
+
* said, a session clock and a way out. The substance of every answer lands
|
|
1586
|
+
* in the host's transcript, as for typing.
|
|
1587
|
+
*
|
|
1588
|
+
* Styled from the terminal theme (`TerminalThemeProvider`): render it inside
|
|
1589
|
+
* the same provider as your input bar.
|
|
1590
|
+
*/
|
|
1591
|
+
declare function VoiceDeck({ voice, name, phone, hint }: VoiceDeckProps): react_jsx_runtime.JSX.Element;
|
|
1592
|
+
|
|
1593
|
+
/**
|
|
1594
|
+
* The voice's questions to the host, one at a time.
|
|
1595
|
+
*
|
|
1596
|
+
* A host's agent answers one question at a time, and a person keeps talking
|
|
1597
|
+
* while it works: "and also check my calendar" is a new question, "no, it's
|
|
1598
|
+
* actually called the CORD Knowledge Base" is a correction. A new question
|
|
1599
|
+
* waits its turn; a correction (`replaces`) stops the one being worked on,
|
|
1600
|
+
* drops anything waiting, and goes next. A question that was replaced is
|
|
1601
|
+
* closed without a word (`speak: false`), so the voice only answers what
|
|
1602
|
+
* the person still wants.
|
|
1603
|
+
*/
|
|
1604
|
+
interface QueuedAsk {
|
|
1605
|
+
callId: string;
|
|
1606
|
+
question: string;
|
|
1607
|
+
/** It corrects or replaces the question being worked on. */
|
|
1608
|
+
replaces: boolean;
|
|
1609
|
+
}
|
|
1610
|
+
/** What a replaced question is closed with. Never spoken. */
|
|
1611
|
+
declare const REPLACED_OUTPUT = "Replaced by their corrected question, which is being answered instead. Say nothing about this one.";
|
|
1612
|
+
declare class AskQueue<A extends QueuedAsk> {
|
|
1613
|
+
private readonly run;
|
|
1614
|
+
private readonly finish;
|
|
1615
|
+
private waiting;
|
|
1616
|
+
private running;
|
|
1617
|
+
/**
|
|
1618
|
+
* `run` asks the host (resolves with what the voice speaks from; a
|
|
1619
|
+
* rejection is reported as a failure). `finish` sends the result: `speak`
|
|
1620
|
+
* false for a replaced question.
|
|
1621
|
+
*/
|
|
1622
|
+
constructor(run: (ask: A, signal: AbortSignal) => Promise<string>, finish: (ask: A, output: string, speak: boolean) => void);
|
|
1623
|
+
/** Questions being worked on or waiting. */
|
|
1624
|
+
get size(): number;
|
|
1625
|
+
add(ask: A): void;
|
|
1626
|
+
private next;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
/**
|
|
1630
|
+
* The microphone capture AudioWorklet, as source.
|
|
1631
|
+
*
|
|
1632
|
+
* A worklet module must be loaded by URL. Hosts whose Content-Security-Policy
|
|
1633
|
+
* allows `blob:` scripts need do nothing (the session loads this source as
|
|
1634
|
+
* a blob). Hosts that do not — yieldfabric-app among them — serve this
|
|
1635
|
+
* source as a file from their own origin (e.g. `public/voice-capture-worklet.js`)
|
|
1636
|
+
* and pass its URL as `workletUrl`.
|
|
1637
|
+
*
|
|
1638
|
+
* It does as little as possible on the audio thread: copies the first input
|
|
1639
|
+
* channel into ~40 ms batches and posts them to the page, which resamples
|
|
1640
|
+
* them (`pcm.ts`, where the math is tested).
|
|
1641
|
+
*/
|
|
1642
|
+
declare const VOICE_CAPTURE_WORKLET_SOURCE = "class YfVoiceCapture extends AudioWorkletProcessor {\n constructor() {\n super();\n this.batch = new Float32Array(2048);\n this.filled = 0;\n }\n process(inputs) {\n const channel = inputs[0] && inputs[0][0];\n if (channel) {\n let offset = 0;\n while (offset < channel.length) {\n const n = Math.min(channel.length - offset, this.batch.length - this.filled);\n this.batch.set(channel.subarray(offset, offset + n), this.filled);\n this.filled += n;\n offset += n;\n if (this.filled === this.batch.length) {\n this.port.postMessage(this.batch, [this.batch.buffer]);\n this.batch = new Float32Array(2048);\n this.filled = 0;\n }\n }\n }\n return true;\n }\n}\nregisterProcessor('yf-voice-capture', YfVoiceCapture);\n";
|
|
1643
|
+
|
|
1280
1644
|
interface ParsedCommand {
|
|
1281
1645
|
endpoint: ApiEndpoint;
|
|
1282
1646
|
args: Record<string, string>;
|
|
@@ -2545,4 +2909,4 @@ declare const terminalClassNames: {
|
|
|
2545
2909
|
promptSymbol: string;
|
|
2546
2910
|
};
|
|
2547
2911
|
|
|
2548
|
-
export { ADVANCE_PHASE_SIGNAL, AGENT_PALETTE, type AIAction, type ActivityItem, AgentAvatar, type AgentAvatarProps, type AgentAvatarSize, type AgentCompletion, AgentPresenceBar, AgentStepTrace, type AgentToolStep, type Annotation, AnnotationThread, type ApiEndpoint, type ApiParameter, type BaseTerminalProps, CLAIM_STATUS_COLORS, ChatTerminal, type ChatTerminalProps, CheckpointCard, type CheckpointType, ClaimNode, type ClaimNodeData, type ClaimStatus, ConstructionProgress, CoreTerminal, type CoreTerminalProps, type CreateNoteResult, DEFAULT_AGENT_LABEL, DOCUMENT_PIPELINE_STEPS, type DocumentProcessingEvent, DocumentProcessingProgress, EDGE_TYPE_COLORS, EdgeDetailDrawer, EdgeMarkerDefs, CoreTerminal as EmbeddedTerminal, type CoreTerminalProps as EmbeddedTerminalProps, ExpandableTerminal, type ExpandableTerminalProps, type FileUploadResult, type GapOption, type GapQuestion, type GenericKGSnapshot, type GenericSnapshotEdge, type GenericSnapshotNode, GraphChatPanel, type GraphChatPanelProps, GraphEdge, type GraphEdgeData, type GraphLayer, GraphNode, type GraphNodeData, type HelpTopic, InlineTerminal, type InlineTerminalProps, type KGAnnotation, type KGChunkLink$1 as KGChunkLink, type KGScope, type KGSearchResult, type KGSnapshot, type KGSnapshotEdge, type KGSnapshotNode, type KnowledgeGraphDataCallbacks, KnowledgeGraphView, LIVE_KG_ID, type LegacyKGSnapshot, type LegacyKGSnapshotEdge, type LegacyKGSnapshotNode, type LineageEntry, type ListRagFilesResult, type ListedRagFile, LiveActivityTicker, MarkdownContent, MarkdownEditor, type Mention, type MentionTarget, type MessageAudience, type MessageSender, NODE_TYPE_COLORS, NODE_TYPE_LABELS, NodeDetailDrawer, PROGRESS_EVENT_NAME, type PageSuggestion, type ParsedCommand, type PipelineBuilderAction, type PipelineDraft, type PipelineDraftStep, PipelineProgressBar, type PluginContext, type ProcessingDetail, type ProgressEventDetail, type ProgressState, type RagFileActionResult, ReasoningHistoryCard, ReasoningOverlay, type ReasoningOverlayProps, type ReasoningProgressEvent, type ReasoningSnapshot, ReasoningView, type ReasoningViewProps, SSE_KEEPALIVE_MS, SSE_STALL_MS, SYNTHESIS_DONE_SIGNAL, type SaveNoteResult, ScopedReasoningProvider, SettlementBar, type SlashMentionCandidate, SlashMentionPicker, StageCanvas, StandardTerminal, type StandardTerminalProps, type StreamChunk, type StreamHandler, type StreamHandlers, type SubgraphEdge, type SubgraphNode, type TeamSetupAgent, type TerminalCommand, type TerminalCommandResult, type TerminalConfig, type TerminalEntry, TerminalInputBar, type TerminalInputBarProps, type TerminalPlugin, type TerminalSlots, type TerminalSource, type TerminalTheme, TerminalThemeProvider, type TerminalWidget, type WorkingGroupContext, agentSeed, agentStepTraceExtra, avatarColor, blueScope, buildClaimsGraph, buildTerminalCommand, buttonShadow, captureReasoningSnapshot, defaultTheme, dispatchProgressEvent, documentEventToActivity, emeraldCollab, emeraldRevised, eventToActivity, extractKGSources, extractKgId, filterCommands, formatAssetDisplay, formatPaymentAmount, formatTokenAssetId, getAgentColor, getBuiltInCommands, getClaimStatusColors, getEdgeColor, getEdgeTypeLabel, getNodeColors, getNodeTypeLabel, getVocabTypeColors, getVocabTypeLabel, greenAction, handleSSEStream, handleStreamingResponse, hostApp, initials, isFixedKgId, isNaturalLanguage, layoutGraph, mergeTheme, openPipelineEventStream, orangeRebuttal, parseTerminalCommand, pipelineBg, processStreamLines, purple, reduceProgress, renderMarkdownBlock, resolvePaymentAssetDisplay, snapshotToSubgraph, terminalClassNames, terminalColors, useScopedProgressEvent, useSlashMentionPicker, useTheme, warmBg, withStallTimeout };
|
|
2912
|
+
export { ADVANCE_PHASE_SIGNAL, AGENT_PALETTE, type AIAction, type ActivityItem, AgentAvatar, type AgentAvatarProps, type AgentAvatarSize, type AgentCompletion, AgentPresenceBar, AgentStepTrace, type AgentToolStep, type Annotation, AnnotationThread, type ApiEndpoint, type ApiParameter, AskQueue, type BaseTerminalProps, CLAIM_STATUS_COLORS, ChatTerminal, type ChatTerminalProps, CheckpointCard, type CheckpointType, ClaimNode, type ClaimNodeData, type ClaimStatus, ConstructionProgress, CoreTerminal, type CoreTerminalProps, type CreateNoteResult, DEFAULT_AGENT_LABEL, DOCUMENT_PIPELINE_STEPS, type DocumentProcessingEvent, DocumentProcessingProgress, EDGE_TYPE_COLORS, EdgeDetailDrawer, EdgeMarkerDefs, CoreTerminal as EmbeddedTerminal, type CoreTerminalProps as EmbeddedTerminalProps, ExpandableTerminal, type ExpandableTerminalProps, type FileUploadResult, type GapOption, type GapQuestion, type GenericKGSnapshot, type GenericSnapshotEdge, type GenericSnapshotNode, GraphChatPanel, type GraphChatPanelProps, GraphEdge, type GraphEdgeData, type GraphLayer, GraphNode, type GraphNodeData, type HelpTopic, InlineTerminal, type InlineTerminalProps, type KGAnnotation, type KGChunkLink$1 as KGChunkLink, type KGScope, type KGSearchResult, type KGSnapshot, type KGSnapshotEdge, type KGSnapshotNode, type KnowledgeGraphDataCallbacks, KnowledgeGraphView, LIVE_KG_ID, type LegacyKGSnapshot, type LegacyKGSnapshotEdge, type LegacyKGSnapshotNode, type LineageEntry, type ListRagFilesResult, type ListedRagFile, LiveActivityTicker, MarkdownContent, MarkdownEditor, type Mention, type MentionTarget, type MessageAudience, type MessageSender, NODE_TYPE_COLORS, NODE_TYPE_LABELS, NodeDetailDrawer, PROGRESS_EVENT_NAME, type PageSuggestion, type ParsedCommand, type PipelineBuilderAction, type PipelineDraft, type PipelineDraftStep, PipelineProgressBar, type PluginContext, type ProcessingDetail, type ProgressEventDetail, type ProgressState, type QueuedAsk, REPLACED_OUTPUT, type RagFileActionResult, ReasoningHistoryCard, ReasoningOverlay, type ReasoningOverlayProps, type ReasoningProgressEvent, type ReasoningSnapshot, ReasoningView, type ReasoningViewProps, SILENT, SSE_KEEPALIVE_MS, SSE_STALL_MS, SYNTHESIS_DONE_SIGNAL, type SaveNoteResult, ScopedReasoningProvider, SettlementBar, type SlashMentionCandidate, SlashMentionPicker, StageCanvas, StandardTerminal, type StandardTerminalProps, type StreamChunk, type StreamHandler, type StreamHandlers, type SubgraphEdge, type SubgraphNode, type TeamSetupAgent, type TerminalCommand, type TerminalCommandResult, type TerminalConfig, type TerminalEntry, TerminalInputBar, type TerminalInputBarProps, type TerminalPlugin, type TerminalSlots, type TerminalSource, type TerminalTheme, TerminalThemeProvider, type TerminalWidget, VOICE_CAPTURE_WORKLET_SOURCE, VOICE_LANGUAGES, VOICE_NAMES, type VoiceButtonState, type VoiceConnection, VoiceDeck, type VoiceDeckProps, type VoiceEndReason, type VoiceEnded, type VoiceHandlers, type VoiceHost, VoiceInputButton, type VoiceInputButtonProps, type VoiceLanguage, type VoiceLevels, type VoiceName, type VoicePersona, type VoicePhase, type VoiceProgress, type VoiceReply, VoiceSession, type VoiceSessionState, type VoiceStatus, type VoiceUtterance, type WorkingGroupContext, agentSeed, agentStepTraceExtra, avatarColor, blueScope, buildClaimsGraph, buildTerminalCommand, buttonShadow, captureReasoningSnapshot, defaultTheme, dispatchProgressEvent, documentEventToActivity, emeraldCollab, emeraldRevised, encodePersona, eventToActivity, extractKGSources, extractKgId, filterCommands, formatAssetDisplay, formatPaymentAmount, formatTokenAssetId, getAgentColor, getBuiltInCommands, getClaimStatusColors, getEdgeColor, getEdgeTypeLabel, getNodeColors, getNodeTypeLabel, getVocabTypeColors, getVocabTypeLabel, getVoiceStatus, greenAction, handleSSEStream, handleStreamingResponse, hostApp, initials, isFixedKgId, isNaturalLanguage, layoutGraph, mergeTheme, openPipelineEventStream, orangeRebuttal, parseTerminalCommand, pipelineBg, processStreamLines, purple, reduceProgress, renderMarkdownBlock, resolvePaymentAssetDisplay, snapshotToSubgraph, socketBase, terminalClassNames, terminalColors, useScopedProgressEvent, useSlashMentionPicker, useTheme, useVoiceSession, voiceEndedMessage, voiceSocketUrl, warmBg, withStallTimeout };
|