@runtypelabs/persona 4.33.0 → 4.34.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/activity-ui.d.cts +3 -15
- package/dist/activity-ui.d.ts +3 -15
- package/dist/animations/glyph-cycle.d.cts +1 -3
- package/dist/animations/glyph-cycle.d.ts +1 -3
- package/dist/animations/wipe.d.cts +1 -3
- package/dist/animations/wipe.d.ts +1 -3
- package/dist/approval-ui.cjs +2 -2
- package/dist/approval-ui.d.cts +3 -15
- package/dist/approval-ui.d.ts +3 -15
- package/dist/approval-ui.js +1 -1
- package/dist/artifacts-ui.cjs +1 -1
- package/dist/artifacts-ui.d.cts +3 -21
- package/dist/artifacts-ui.d.ts +3 -21
- package/dist/background-runtime.d.cts +2 -3
- package/dist/background-runtime.d.ts +2 -3
- package/dist/{chunk-gu34lr-P.js → chunk-Brdx4NCz.js} +1 -1
- package/dist/{chunk-dLJWKfOb.js → chunk-C-rux8Q9.js} +1 -1
- package/dist/{chunk-Ds_twaZn.js → chunk-C4v-HNhS.js} +1 -1
- package/dist/{chunk-Bkma5hIU.js → chunk-CE4seJxF.js} +1 -1
- package/dist/{chunk-D6U0E82p.js → chunk-CV8EPIhT.js} +1 -1
- package/dist/{chunk-ql5N2I_t.js → chunk-CWzHNuVK.js} +1 -1
- package/dist/{chunk-DbGLjU2P.js → chunk-CYpt7PsO.js} +1 -1
- package/dist/{chunk-DOZmcve8.js → chunk-Csr59G5V.js} +1 -1
- package/dist/{chunk-DW7Vg_l2.js → chunk-CxNPSY-b.js} +1 -1
- package/dist/chunk-Dqa_GOcj.js +1 -0
- package/dist/chunk-DsWv3EGF.js +1 -0
- package/dist/{chunk-C7-m0EmI.js → chunk-NUNdcnAZ.js} +1 -1
- package/dist/{chunk-CXQJG7pb.js → chunk-YMkMvAsa.js} +2 -2
- package/dist/{chunk-C-EHtpbB.js → chunk-h5aOI_Pa.js} +1 -1
- package/dist/chunk-kizhspe5.js +1 -0
- package/dist/client-dispatch.js +1 -1
- package/dist/client-history.js +1 -1
- package/dist/client-stream.js +1 -1
- package/dist/{code-generators-DqauYyfX.d.cts → code-generators-DPAqTcAz.d.cts} +0 -2
- package/dist/{code-generators-DqauYyfX.d.ts → code-generators-DPAqTcAz.d.ts} +0 -2
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.d.cts +1 -1
- package/dist/codegen.d.ts +1 -1
- package/dist/codegen.js +1 -1
- package/dist/composer-actions-runtime.cjs +1 -1
- package/dist/composer-actions-runtime.d.cts +4 -20
- package/dist/composer-actions-runtime.d.ts +4 -20
- package/dist/composer-actions-runtime.js +1 -1
- package/dist/{composer-input-DnqGCXZz.d.ts → composer-input-i_FiUp6J.d.cts} +1 -7
- package/dist/{composer-input-DnqGCXZz.d.cts → composer-input-i_FiUp6J.d.ts} +1 -7
- package/dist/{composer-store-6Iwy6WLI.d.ts → composer-store-DhGNgG7Z.d.cts} +1 -3
- package/dist/{composer-store-6Iwy6WLI.d.cts → composer-store-DhGNgG7Z.d.ts} +1 -3
- package/dist/config-diagnostics.d.cts +0 -2
- package/dist/config-diagnostics.d.ts +0 -2
- package/dist/{context-mention-manager-B-rHF98n.d.ts → context-mention-manager-DL-xwGfL.d.cts} +2 -6
- package/dist/{context-mention-manager-B-rHF98n.d.cts → context-mention-manager-DL-xwGfL.d.ts} +2 -6
- package/dist/context-mentions-inline.cjs +1 -1
- package/dist/context-mentions-inline.d.cts +2 -4
- package/dist/context-mentions-inline.d.ts +2 -4
- package/dist/context-mentions-inline.js +1 -1
- package/dist/context-mentions.cjs +1 -1
- package/dist/context-mentions.d.cts +3 -9
- package/dist/context-mentions.d.ts +3 -9
- package/dist/{defaults-BuOjqUAG.d.ts → defaults-Bga2Xrsp.d.cts} +1 -5
- package/dist/{defaults-BuOjqUAG.d.cts → defaults-Bga2Xrsp.d.ts} +1 -5
- package/dist/dictation-runtime.cjs +1 -1
- package/dist/dictation-runtime.d.cts +4 -13
- package/dist/dictation-runtime.d.ts +4 -13
- package/dist/dictation-runtime.js +1 -1
- package/dist/{dom-context-DHTabIn7.d.cts → dom-context-Bw-_9Evh.d.cts} +0 -2
- package/dist/{dom-context-DHTabIn7.d.ts → dom-context-Bw-_9Evh.d.ts} +0 -2
- package/dist/event-stream-view.cjs +1 -1
- package/dist/event-stream-view.d.cts +3 -16
- package/dist/event-stream-view.d.ts +3 -16
- package/dist/{fallback-speech-engine-SqEfkGda.d.ts → fallback-speech-engine-kLdyPcmk.d.cts} +1 -3
- package/dist/{fallback-speech-engine-SqEfkGda.d.cts → fallback-speech-engine-kLdyPcmk.d.ts} +1 -3
- package/dist/{feature-preferences-DqAmje-2.d.ts → feature-preferences-CmwZGKrf.d.cts} +1 -5
- package/dist/{feature-preferences-DqAmje-2.d.cts → feature-preferences-CmwZGKrf.d.ts} +1 -5
- package/dist/forms-ui.d.cts +2 -4
- package/dist/forms-ui.d.ts +2 -4
- package/dist/{history-confirm-dialog-B3L7QNcO.d.cts → history-confirm-dialog-i46-lPN_.d.cts} +2 -14
- package/dist/{history-confirm-dialog-B3L7QNcO.d.ts → history-confirm-dialog-i46-lPN_.d.ts} +2 -14
- package/dist/history-shell.cjs +1 -1
- package/dist/history-shell.d.cts +8 -27
- package/dist/history-shell.d.ts +8 -27
- package/dist/history-shell.js +1 -1
- package/dist/history-view.d.cts +1 -1
- package/dist/history-view.d.ts +1 -1
- package/dist/icons-extra.cjs +1 -1
- package/dist/icons-extra.d.cts +0 -2
- package/dist/icons-extra.d.ts +0 -2
- package/dist/index.cjs +45 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.global.js +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +49 -49
- package/dist/index.js.map +1 -1
- package/dist/install.global.js +1 -1
- package/dist/install.global.js.map +1 -1
- package/dist/launcher.global.js +2 -2
- package/dist/launcher.global.js.map +1 -1
- package/dist/{loading-label-runtime-loader-JecjOfJS.d.ts → loading-label-runtime-loader-Ccr3ETd3.d.cts} +1 -3
- package/dist/{loading-label-runtime-loader-JecjOfJS.d.cts → loading-label-runtime-loader-Ccr3ETd3.d.ts} +1 -3
- package/dist/loading-label-runtime.cjs +1 -1
- package/dist/loading-label-runtime.d.cts +1 -1
- package/dist/loading-label-runtime.d.ts +1 -1
- package/dist/loading-label-runtime.js +1 -1
- package/dist/markdown-parsers.js +1 -1
- package/dist/{message-bubble-CBYtpDsT.d.ts → message-bubble-C6AVaH7f.d.cts} +20 -3
- package/dist/{message-bubble-CBYtpDsT.d.cts → message-bubble-C6AVaH7f.d.ts} +20 -3
- package/dist/{plugin-kit-C1mRjLgW.d.cts → plugin-kit-BVggqE3C.d.cts} +0 -2
- package/dist/{plugin-kit-C1mRjLgW.d.ts → plugin-kit-BVggqE3C.d.ts} +0 -2
- package/dist/plugin-kit.d.cts +1 -1
- package/dist/plugin-kit.d.ts +1 -1
- package/dist/preferences-runtime.cjs +1 -1
- package/dist/preferences-runtime.d.cts +1 -1
- package/dist/preferences-runtime.d.ts +1 -1
- package/dist/preferences-runtime.js +1 -1
- package/dist/{preview-_UJwwt2L.d.cts → preview-BMdRffo4.d.cts} +2 -6
- package/dist/{preview-_UJwwt2L.d.ts → preview-BMdRffo4.d.ts} +2 -6
- package/dist/{registry-B5ZV3K-h.d.ts → registry-B16l8s1b.d.cts} +1 -8
- package/dist/{registry-B5ZV3K-h.d.cts → registry-B16l8s1b.d.ts} +1 -8
- package/dist/{session-Bys8_XuB.d.cts → session-CtZHe7fc.d.cts} +8 -92
- package/dist/{session-Bys8_XuB.d.ts → session-CtZHe7fc.d.ts} +8 -92
- package/dist/session-reconnect.d.cts +2 -4
- package/dist/session-reconnect.d.ts +2 -4
- package/dist/smart-dom-reader.d.cts +2 -8
- package/dist/smart-dom-reader.d.ts +2 -8
- package/dist/testing.d.cts +0 -2
- package/dist/testing.d.ts +0 -2
- package/dist/theme-editor-preview.cjs +42 -42
- package/dist/theme-editor-preview.d.cts +1 -1
- package/dist/theme-editor-preview.d.ts +1 -1
- package/dist/theme-editor-preview.js +25 -25
- package/dist/theme-editor.cjs +25 -5
- package/dist/theme-editor.d.cts +2 -22
- package/dist/theme-editor.d.ts +2 -22
- package/dist/theme-editor.js +1 -1
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +2 -4
- package/dist/theme-reference.d.ts +2 -4
- package/dist/theme-reference.js +1 -1
- package/dist/{tool-loading-animation-d5qAQcwv.d.ts → tool-loading-animation-D2cyFvmM.d.cts} +1 -7
- package/dist/{tool-loading-animation-d5qAQcwv.d.cts → tool-loading-animation-D2cyFvmM.d.ts} +1 -7
- package/dist/{tooltip-BkW-8MnD.d.cts → tooltip-DbXkAuJL.d.cts} +0 -2
- package/dist/{tooltip-BkW-8MnD.d.ts → tooltip-DbXkAuJL.d.ts} +0 -2
- package/dist/{turn-activity-ui-q6fHVnx-.d.cts → turn-activity-ui-Do1Nd-Ow.d.cts} +2 -12
- package/dist/{turn-activity-ui-q6fHVnx-.d.ts → turn-activity-ui-Do1Nd-Ow.d.ts} +2 -12
- package/dist/turn-activity-ui.d.cts +1 -1
- package/dist/turn-activity-ui.d.ts +1 -1
- package/dist/{types-B_mj21jg.d.cts → types-BC7MRxO5.d.cts} +76 -29
- package/dist/{types-B_mj21jg.d.ts → types-BC7MRxO5.d.ts} +76 -29
- package/dist/ui-extras.js +3 -3
- package/dist/voice-client-tools.d.cts +1 -3
- package/dist/voice-client-tools.d.ts +1 -3
- package/dist/voice-runtime.cjs +1 -1
- package/dist/voice-runtime.d.cts +2 -12
- package/dist/voice-runtime.d.ts +2 -12
- package/dist/voice-runtime.js +2 -2
- package/dist/voice-worklet-player.d.cts +2 -6
- package/dist/voice-worklet-player.d.ts +2 -6
- package/dist/{webmcp-runtime-entry-ClEO3qdI.d.ts → webmcp-runtime-entry-B8g46vS0.d.cts} +1 -5
- package/dist/{webmcp-runtime-entry-ClEO3qdI.d.cts → webmcp-runtime-entry-B8g46vS0.d.ts} +1 -5
- package/dist/webmcp-runtime.d.cts +1 -1
- package/dist/webmcp-runtime.d.ts +1 -1
- package/dist/widget.css +1 -1
- package/package.json +4 -4
- package/src/components/event-stream-view.test.ts +5 -0
- package/src/components/message-bubble.ts +26 -6
- package/src/components/scroll-to-bottom.test.ts +135 -0
- package/src/components/scroll-to-bottom.ts +50 -13
- package/src/components/user-message-collapse.ts +117 -0
- package/src/defaults.ts +6 -0
- package/src/styles/widget.css +56 -0
- package/src/theme-reference.ts +2 -2
- package/src/types/theme.ts +29 -0
- package/src/types.ts +49 -5
- package/src/ui.scroll-additive.test.ts +219 -117
- package/src/ui.scroll.test.ts +176 -13
- package/src/ui.ts +230 -107
- package/src/ui.turn-activity.test.ts +7 -7
- package/src/ui.user-message-collapse.test.ts +540 -0
- package/src/utils/auto-follow.test.ts +0 -38
- package/src/utils/auto-follow.ts +0 -35
- package/src/utils/theme.test.ts +23 -0
- package/src/utils/tokens.ts +16 -0
- package/dist/chunk-CVMIncEY.js +0 -1
- package/dist/chunk-DVgzoVCB.js +0 -1
- package/dist/chunk-d54BJdKd.js +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Oo as SemanticTokens, Po as ThemeValidationResult, So as PersonaTheme, To as ResolvedToken, _o as DeepPartial, go as CreateThemeOptions, k as AgentWidgetConfig, mo as ComponentTokens } from "./types-
|
|
2
|
-
//#region src/utils/tokens.d.ts
|
|
1
|
+
import { Oo as SemanticTokens, Po as ThemeValidationResult, So as PersonaTheme, To as ResolvedToken, _o as DeepPartial, go as CreateThemeOptions, k as AgentWidgetConfig, mo as ComponentTokens } from "./types-BC7MRxO5.js";
|
|
3
2
|
declare const DEFAULT_PALETTE: {
|
|
4
3
|
spacing: Record<0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64, string>;
|
|
5
4
|
typography: {
|
|
@@ -398,8 +397,6 @@ declare const THEME_ZONES: {
|
|
|
398
397
|
readonly 'artifact-inline-chrome': 'Inline artifact title bar';
|
|
399
398
|
};
|
|
400
399
|
type ThemeZone = keyof typeof THEME_ZONES;
|
|
401
|
-
//#endregion
|
|
402
|
-
//#region src/defaults.d.ts
|
|
403
400
|
/**
|
|
404
401
|
* Default width for the floating launcher panel (when not overridden).
|
|
405
402
|
* Benchmarks: many chat products use ~300–400px; 400px is a frequent “standard” default.
|
|
@@ -416,6 +413,5 @@ declare const DEFAULT_WIDGET_CONFIG: Partial<AgentWidgetConfig>;
|
|
|
416
413
|
* This ensures all default values are present while allowing selective overrides
|
|
417
414
|
*/
|
|
418
415
|
declare function mergeWithDefaults(config?: Partial<AgentWidgetConfig>): Partial<AgentWidgetConfig>;
|
|
419
|
-
//#endregion
|
|
420
416
|
export { mergeWithDefaults as a, DEFAULT_SEMANTIC as c, ThemeZone as d, createTheme as f, validateTheme as g, themeToCssVariables as h, DefaultsVersion as i, THEME_ZONES as l, resolveTokens as m, DEFAULT_FLOATING_LAUNCHER_WIDTH as n, DEFAULT_COMPONENTS as o, resolveThemeDefaults as p, DEFAULT_WIDGET_CONFIG as r, DEFAULT_PALETTE as s, DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH as t, ThemeDefaultsVersion as u };
|
|
421
417
|
export {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class{constructor(e){this.callbacks=e,this.state=Object.freeze({phase:`idle`,recordingId:0,transcript:``,interimTranscript:``,error:null,audioLevel:null}),this.provider=null,this.generation=0,this.destroyed=!1,this.sendOnCompletion=!1,this.sent=!1,this.ready=!1,this.finishRequested=!1,this.disconnecting=Promise.resolve()}getState(){return this.state}refresh(){this.destroyed||this.callbacks.onState(this.state,!1)}publish(e,t=!1){this.state=Object.freeze({...this.state,...e}),this.callbacks.onState(this.state,t)}start(e,n){if(this.destroyed||this.state.phase===`recording`||this.state.phase===`processing`)return!1;this.release();let r=++this.generation;this.sendOnCompletion=n.autoSend,this.sent=!1,this.ready=!1,this.finishRequested=!1,this.publish({phase:`recording`,recordingId:r,transcript:``,interimTranscript:``,error:null,audioLevel:null});let i=()=>!this.destroyed&&r===this.generation&&[`recording`,`processing`].includes(this.state.phase);try{let r=e.custom,a=e.type===`custom`?typeof r==`function`?r():r:t(e.browser,n.pauseDuration);if(!a||a.type===`runtype`)throw Error(`Dictation requires a speech-to-text provider.`);this.provider=a;let o=(e,t)=>{i()&&(t?(this.publish({transcript:e,interimTranscript:``}),this.complete()):this.publish({interimTranscript:e}))};a.onResult(e=>o(e.text,e.isFinal!==!1)),a.onTranscript?.((e,t,n)=>{e===`user`&&o(t,n)}),a.onLevel?.(e=>{i()&&this.state.phase===`recording`&&Number.isFinite(e)&&this.publish({audioLevel:Math.max(0,Math.min(1,e))},!0)}),a.onError(e=>{i()&&this.fail(e)}),a.onProcessingStart?.(()=>{i()&&this.publish({phase:`processing`,audioLevel:null})}),a.onStatusChange(e=>{i()&&(e===`processing`&&this.publish({phase:`processing`,audioLevel:null}),e===`idle`&&this.complete(),e===`error`&&this.fail(/* @__PURE__ */ Error(`Speech recognition failed.`)))}),this.disconnecting.then(async()=>{i()&&(await a.connect(),i()?(await a.startListening(),i()?(this.ready=!0,this.finishRequested&&await a.stopListening()):await a.disconnect()):await a.disconnect())}).catch(e=>{i()&&this.fail(e)})}catch(e){this.fail(e)}return!0}finish(e=!1){if(this.state.phase===`review`)return e?this.send():!1;if(this.state.phase!==`recording`)return!1;this.sendOnCompletion||=e;let t=this.generation;return this.publish({phase:`processing`,audioLevel:null}),this.finishRequested=!0,this.ready&&this.provider?.stopListening().catch(e=>{t===this.generation&&this.state.phase===`processing`&&this.fail(e)}),!0}cancel(){return this.destroyed||this.state.phase===`idle`?!1:(++this.generation,this.release(),this.publish({phase:`idle`,transcript:``,interimTranscript:``,error:null,audioLevel:null}),!0)}send(){return this.destroyed||this.state.phase!==`review`||this.sent?!1:(this.sent=!0,this.publish({phase:`idle`,audioLevel:null}),this.callbacks.onSend(),!0)}complete(){if(![`recording`,`processing`].includes(this.state.phase))return;let e=(this.state.transcript||this.state.interimTranscript).trim();e?(this.state.phase===`recording`&&this.publish({phase:`processing`,audioLevel:null}),this.release(),this.callbacks.onReview(e),this.publish({phase:`review`,transcript:e,interimTranscript:``,audioLevel:null}),this.sendOnCompletion&&this.send()):this.fail(/* @__PURE__ */ Error(`No speech was recognized.`))}fail(e){this.release(),this.publish({phase:`error`,error:e instanceof Error?e.message:String(e),audioLevel:null})}release(){let e=this.provider;this.provider=null,e&&(this.disconnecting=this.disconnecting.then(()=>e.disconnect()).catch(()=>{}))}destroy(){this.destroyed=!0,++this.generation,this.release()}};function t(e,t=2e3){let n=window,r=n.SpeechRecognition??n.webkitSpeechRecognition;if(!r)throw Error(`Browser speech recognition is unavailable.`);let i=new r;i.lang=e?.language??`en-US`,i.continuous=e?.continuous??!0,i.interimResults=!0;let a=``,o,s=!1,c=()=>{},l=()=>{},u=()=>{},d=()=>{clearTimeout(o),o=void 0};return i.onresult=e=>{s||(a=Array.from(e.results).map(e=>e[0].transcript).join(` `),c({text:a,provider:`browser`,isFinal:!1}),d(),a.trim()&&(o=setTimeout(()=>{u(`processing`),i.stop()},t)))},i.onend=()=>{s||(d(),c({text:a,provider:`browser`}),u(`idle`))},i.onerror=({error:e})=>{!s&&e!==`no-speech`&&l(Error(e))},{type:`browser`,connect:async()=>{},startListening:async()=>{i.start()},stopListening:async()=>{d(),i.stop()},disconnect:async()=>{s=!0,d(),i.abort(),i.onresult=null,i.onend=null,i.onerror=null},onResult:e=>{c=e},onError:e=>{l=e},onStatusChange:e=>{u=e}}}const n=(e,t={},...n)=>{let r=document.createElement(e);if(t.className&&(r.className=t.className),t.text!==void 0&&(r.textContent=t.text),t.attrs)for(let[e,n]of Object.entries(t.attrs))r.setAttribute(e,n);if(t.style){let e=r.style,n=t.style;for(let t of Object.keys(n)){let r=n[t];r!=null&&(e[t]=r)}}let i=n.filter(e=>e!=null);return i.length>0&&r.append(...i),r};function r(e,{renderLucideIcon:t,attachTooltip:r}){let i=e,a=n(`section`,{className:`persona-dictation`,attrs:{"data-persona-dictation":``,"aria-label":`Voice dictation`},style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:`12px`,width:`100%`,minWidth:`0`,gridColumn:`1 / -1`,color:`var(--persona-text, #18181b)`,fontFamily:`inherit`,fontSize:`var(--persona-composer-font-size, 16px)`,lineHeight:`1.5`}}),o=n(`div`,{attrs:{"data-persona-dictation-transcript":``,dir:`auto`},style:{flex:`1 1 auto`,width:`max-content`,maxWidth:`100%`,boxSizing:`border-box`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,maxHeight:`120px`,overflowY:`auto`,padding:`2px 4px`}}),s=n(`span`),c=n(`span`,{attrs:{"data-persona-dictation-interim":``}});o.append(s,c);let l=n(`div`,{style:{display:`flex`,flex:`0 1 auto`,alignItems:`center`,gap:`10px`,width:`100%`,maxWidth:`100%`,minWidth:`0`,marginInlineStart:`auto`}}),u=n(`div`,{attrs:{role:`status`,"aria-live":`polite`,"aria-atomic":`true`},style:{flex:`1 1 0`,minWidth:`0`,color:`var(--persona-input-placeholder, var(--persona-text-muted, #71717a))`}}),d=n(`div`,{attrs:{"data-persona-dictation-waveform":``,"aria-hidden":`true`},style:{alignItems:`center`,justifyContent:`center`,gap:`4px`,height:`36px`,minWidth:`0`,color:`var(--persona-input-placeholder, var(--persona-text-muted, #71717a))`}}),f=Array.from({length:19},()=>n(`span`,{style:{width:`3px`,flexShrink:`0`,borderRadius:`3px`,background:`currentColor`}}));d.append(...f);let p=[],m=(e,a,o)=>{let s=n(`button`,{className:`persona-composer-control`,attrs:{type:`button`,"aria-label":a,"data-persona-dictation-action":e},style:{flexShrink:`0`,borderRadius:`50%`,alignItems:`center`,justifyContent:`center`,border:`1px solid var(--persona-border, #d4d4d8)`,color:`inherit`,background:`transparent`,cursor:`pointer`,padding:`0`}}),c=t(o,18,`currentColor`,2);return c?s.append(c):s.textContent=a,s.addEventListener(`click`,()=>i.actions[e]?.()),p.push(r({anchor:s,text:()=>s.getAttribute(`aria-label`)??a})),s},h=m(`cancel`,`Cancel dictation`,`x`),g=m(`finish`,`Finish dictation`,`check`),_=m(`send`,`Finish and send`,`arrow-up`);l.append(u,d,h,g,_),a.append(o,l);let v=(e,t,n=`block`)=>{e.hidden=!t,e.style.display=t?n:`none`},y=e=>{let t=i.state;i=e;let{state:n}=e,r=e.config.voiceRecognition?.dictation??{},p=r.display===`waveform`,m=!!(n.transcript||n.interimTranscript);v(a,n.phase!==`idle`&&n.phase!==`review`,`flex`),a.dataset.phase=n.phase,a.dataset.display=r.display??`transcript`,(n.phase!==t.phase||n.error!==t.error||!u.textContent)&&(u.textContent=n.phase===`recording`?`Listening…`:n.phase===`processing`?`Transcribing…`:n.error??``),s.textContent=n.transcript,c.textContent=n.interimTranscript,c.style.fontStyle=r.interimText?.fontStyle??`italic`,c.style.color=r.interimText?.color??`var(--persona-input-placeholder, var(--persona-text-muted, #71717a))`,u.style.fontStyle=n.phase===`recording`&&!p?r.interimText?.fontStyle??`italic`:`normal`,v(o,m&&r.display!==`inline`&&!p&&n.phase!==`error`),l.style.width=o.hidden?`100%`:`auto`;let y=(r.waveform??p)&&n.audioLevel!==null&&n.phase===`recording`;v(d,y,`flex`);let b=n.phase===`recording`&&(p?y:m);u.className=b?`persona-sr-only`:``,u.style.flex=b?`0 0 auto`:`1 1 0`,d.style.flex=p?`1 1 0`:`0 1 140px`,d.style.width=p?``:`140px`,d.style.marginInlineStart=`auto`,h.style.order=p?`-1`:`0`;let x=a.ownerDocument.defaultView?.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;f.forEach((e,t)=>{let r=x?6:3+(n.audioLevel??0)*Math.max(2,31-Math.abs(9-t)*3);e.style.height=`${r}px`,e.style.transition=x?`none`:`height 80ms linear`}),v(h,r.showCancel!==!1,`inline-flex`),v(g,r.showFinish!==!1&&n.phase!==`error`,`inline-flex`),g.disabled=n.phase!==`recording`,g.style.opacity=g.disabled?`0.45`:`1`,v(_,!!e.actions.send&&n.phase!==`error`,`inline-flex`),_.disabled=n.phase!==`recording`,_.style.opacity=_.disabled?`0.45`:`1`};return y(e),{element:a,update:y,destroy:()=>{p.forEach(e=>e.destroy()),a.remove()}}}function i(t){let n=null,i=``,a=null,o=!1,s=null,c=`idle`,l=/* @__PURE__ */ new Map,u=()=>{for(let[e,t]of l)e.style.display=t;l.clear()},d=(e=``)=>{let n=(i&&e&&!/\s$/.test(i)?` `:``)+e,r=t.getInlineInput();r?.replaceLogicalRange&&a!==null?(r.replaceLogicalRange(a,r.getLogicalText().length,n),r.dispatchInput()):t.getTextarea().value=i+n,t.syncText()},f=new e({onReview:d,onSend:()=>{t.isSendBlocked()||t.onSend()},onState:(e,i)=>{let a=t.getConfig(),p=t.getTextarea(),m=t.getFooter(),h=c;c=e.phase;let g=e.phase===`recording`||e.phase===`processing`;if(p.readOnly=g||o,p instanceof HTMLTextAreaElement||p.setAttribute(`contenteditable`,g||t.isInputDisabled()?`false`:s??`true`),e.phase===`idle`&&[`recording`,`processing`,`error`].includes(h))d();else if(g&&a.voiceRecognition?.dictation?.display===`inline`){let t=e.transcript||e.interimTranscript;d(t)}e.phase===`error`&&d();let _={instanceId:t.instanceId,state:e,config:a,actions:{cancel:()=>{f.cancel()},finish:()=>{f.finish()},...a.voiceRecognition?.dictation?.showSend&&!t.isSendBlocked()?{send:()=>{t.isSendBlocked()||f.finish(!0)||f.send()}}:{}},defaultRenderer:()=>r(_,t.rendererDeps)},v=[`recording`,`processing`,`error`].includes(e.phase);if(!n&&v){for(let e of t.plugins){let t=e.renderDictation?.(_);if(t){n=t instanceof HTMLElement?{element:t}:t;break}}n??=_.defaultRenderer(),n.element.addEventListener(`keydown`,e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),f.cancel())})}if(n&&v){let t=m.querySelector(`[data-persona-composer-form]`)??m;n.element.parentElement!==t&&t.append(n.element),u();let r=a.voiceRecognition?.dictation?.display===`inline`?Array.from(t.querySelectorAll(`[data-persona-composer-actions-start], [data-persona-composer-actions-end]`)):Array.from(t.children).filter(e=>e instanceof HTMLElement&&e!==n?.element);for(let e of r)l.set(e,e.style.display),e.style.display=`none`;n.update?.(_),(e.phase===`recording`&&h!==`recording`&&h!==`processing`||e.phase===`error`&&h!==`error`)&&n.element.querySelector(`button:not(:disabled), [tabindex]`)?.focus()}else u(),n?.destroy?.(),n?.element.remove(),n=null,(e.phase===`review`||e.phase===`idle`)&&e.phase!==h&&p.focus();i||t.onState(e,g)}});return{start(e,t,n){return i=n.text,a=n.logicalEnd,o=n.readOnly,s=n.contentEditable,f.start(e,t)},getState:()=>f.getState(),refresh:()=>f.refresh(),cancel:()=>f.cancel(),finish:(e=!1)=>f.finish(e),send:()=>f.send(),destroy(){f.destroy(),u(),n?.destroy?.(),n?.element.remove()}}}function a(e){let t=`--persona-voice-level`,n=.5,r=null,i=-1,a=0,o=n=>{let r=Math.round(Math.max(0,Math.min(1,n))*100)/100;if(r!==i){i=r;for(let n of e.targets())n.style.setProperty(t,String(r))}},s=()=>{i=-1,a=0;for(let n of e.targets())n.style.removeProperty(t)};function c(){if(r!==null)return;if(typeof requestAnimationFrame!=`function`){o(e.sample().level??n);return}let t=()=>{r=requestAnimationFrame(t);let{level:i,fallback:c}=e.sample();i===null&&!c?s():i===null?o(n):(a+=(i-a)*.3,o(a))};r=requestAnimationFrame(t)}function l(){r!==null&&(cancelAnimationFrame(r),r=null),s()}return{start:c,stop:l}}function o(e){let t=null;return{result:n=>{if(!e.isActive())return;let r=``,i=``;for(let e=0;e<n.results.length;e++){let t=n.results[e],a=t[0].transcript;t.isFinal?r+=a+` `:i=a}let a=e.initialText+r+i;e.textarea.value=a,e.syncText(),t&&clearTimeout(t),(r||i)&&(t=window.setTimeout(()=>{if(e.textarea.value.trim()&&e.isActive()){if(e.stop(),e.review())return;e.submit()}},e.pauseDuration))},error:t=>{e.isActive()&&t.error!==`no-speech`&&e.stop()},end:()=>{if(e.isActive()&&e.isActive()){let t=e.textarea.value.trim();!e.review()&&t&&t!==e.initialText.trim()&&e.submit(),e.stop()}},dispose:()=>{t!==null&&clearTimeout(t),t=null}}}exports.DictationController=e,exports.createBrowserRecognitionHandlers=o,exports.createDictationRenderer=r,exports.createDictationSession=i,exports.createVoiceLevelIndicator=a;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class{constructor(e){this.callbacks=e,this.state=Object.freeze({phase:`idle`,recordingId:0,transcript:``,interimTranscript:``,error:null,audioLevel:null}),this.provider=null,this.generation=0,this.destroyed=!1,this.sendOnCompletion=!1,this.sent=!1,this.ready=!1,this.finishRequested=!1,this.disconnecting=Promise.resolve()}getState(){return this.state}refresh(){this.destroyed||this.callbacks.onState(this.state,!1)}publish(e,t=!1){this.state=Object.freeze({...this.state,...e}),this.callbacks.onState(this.state,t)}start(e,n){if(this.destroyed||this.state.phase===`recording`||this.state.phase===`processing`)return!1;this.release();let r=++this.generation;this.sendOnCompletion=n.autoSend,this.sent=!1,this.ready=!1,this.finishRequested=!1,this.publish({phase:`recording`,recordingId:r,transcript:``,interimTranscript:``,error:null,audioLevel:null});let i=()=>!this.destroyed&&r===this.generation&&[`recording`,`processing`].includes(this.state.phase);try{let r=e.custom,a=e.type===`custom`?typeof r==`function`?r():r:t(e.browser,n.pauseDuration);if(!a||a.type===`runtype`)throw Error(`Dictation requires a speech-to-text provider.`);this.provider=a;let o=(e,t)=>{i()&&(t?(this.publish({transcript:e,interimTranscript:``}),this.complete()):this.publish({interimTranscript:e}))};a.onResult(e=>o(e.text,e.isFinal!==!1)),a.onTranscript?.((e,t,n)=>{e===`user`&&o(t,n)}),a.onLevel?.(e=>{i()&&this.state.phase===`recording`&&Number.isFinite(e)&&this.publish({audioLevel:Math.max(0,Math.min(1,e))},!0)}),a.onError(e=>{i()&&this.fail(e)}),a.onProcessingStart?.(()=>{i()&&this.publish({phase:`processing`,audioLevel:null})}),a.onStatusChange(e=>{i()&&(e===`processing`&&this.publish({phase:`processing`,audioLevel:null}),e===`idle`&&this.complete(),e===`error`&&this.fail(/* @__PURE__ */ Error(`Speech recognition failed.`)))}),this.disconnecting.then(async()=>{i()&&(await a.connect(),i()?(await a.startListening(),i()?(this.ready=!0,this.finishRequested&&await a.stopListening()):await a.disconnect()):await a.disconnect())}).catch(e=>{i()&&this.fail(e)})}catch(e){this.fail(e)}return!0}finish(e=!1){if(this.state.phase===`review`)return e?this.send():!1;if(this.state.phase!==`recording`)return!1;this.sendOnCompletion||=e;let t=this.generation;return this.publish({phase:`processing`,audioLevel:null}),this.finishRequested=!0,this.ready&&this.provider?.stopListening().catch(e=>{t===this.generation&&this.state.phase===`processing`&&this.fail(e)}),!0}cancel(){return this.destroyed||this.state.phase===`idle`?!1:(++this.generation,this.release(),this.publish({phase:`idle`,transcript:``,interimTranscript:``,error:null,audioLevel:null}),!0)}send(){return this.destroyed||this.state.phase!==`review`||this.sent?!1:(this.sent=!0,this.publish({phase:`idle`,audioLevel:null}),this.callbacks.onSend(),!0)}complete(){if(![`recording`,`processing`].includes(this.state.phase))return;let e=(this.state.transcript||this.state.interimTranscript).trim();e?(this.state.phase===`recording`&&this.publish({phase:`processing`,audioLevel:null}),this.release(),this.callbacks.onReview(e),this.publish({phase:`review`,transcript:e,interimTranscript:``,audioLevel:null}),this.sendOnCompletion&&this.send()):this.fail(/* @__PURE__ */ Error(`No speech was recognized.`))}fail(e){this.release(),this.publish({phase:`error`,error:e instanceof Error?e.message:String(e),audioLevel:null})}release(){let e=this.provider;this.provider=null,e&&(this.disconnecting=this.disconnecting.then(()=>e.disconnect()).catch(()=>{}))}destroy(){this.destroyed=!0,++this.generation,this.release()}};function t(e,t=2e3){let n=window,r=n.SpeechRecognition??n.webkitSpeechRecognition;if(!r)throw Error(`Browser speech recognition is unavailable.`);let i=new r;i.lang=e?.language??`en-US`,i.continuous=e?.continuous??!0,i.interimResults=!0;let a=``,o,s=!1,c=()=>{},l=()=>{},u=()=>{},d=()=>{clearTimeout(o),o=void 0};return i.onresult=e=>{s||(a=Array.from(e.results).map(e=>e[0].transcript).join(` `),c({text:a,provider:`browser`,isFinal:!1}),d(),a.trim()&&(o=setTimeout(()=>{u(`processing`),i.stop()},t)))},i.onend=()=>{s||(d(),c({text:a,provider:`browser`}),u(`idle`))},i.onerror=({error:e})=>{!s&&e!==`no-speech`&&l(Error(e))},{type:`browser`,connect:async()=>{},startListening:async()=>{i.start()},stopListening:async()=>{d(),i.stop()},disconnect:async()=>{s=!0,d(),i.abort(),i.onresult=null,i.onend=null,i.onerror=null},onResult:e=>{c=e},onError:e=>{l=e},onStatusChange:e=>{u=e}}}const n=(e,t={},...n)=>{let r=document.createElement(e);if(t.className&&(r.className=t.className),t.text!==void 0&&(r.textContent=t.text),t.attrs)for(let[e,n]of Object.entries(t.attrs))r.setAttribute(e,n);if(t.style){let e=r.style,n=t.style;for(let t of Object.keys(n)){let r=n[t];r!=null&&(e[t]=r)}}let i=n.filter(e=>e!=null);return i.length>0&&r.append(...i),r};function r(e,{renderLucideIcon:t,attachTooltip:r}){let i=e,a=n(`section`,{className:`persona-dictation`,attrs:{"data-persona-dictation":``,"aria-label":`Voice dictation`},style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:`12px`,width:`100%`,minWidth:`0`,gridColumn:`1 / -1`,color:`var(--persona-text, #18181b)`,fontFamily:`inherit`,fontSize:`var(--persona-composer-font-size, 16px)`,lineHeight:`1.5`}}),o=n(`div`,{attrs:{"data-persona-dictation-transcript":``,dir:`auto`},style:{flex:`1 1 auto`,width:`max-content`,maxWidth:`100%`,boxSizing:`border-box`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,maxHeight:`120px`,overflowY:`auto`,padding:`2px 4px`}}),s=n(`span`),c=n(`span`,{attrs:{"data-persona-dictation-interim":``}});o.append(s,c);let l=n(`div`,{style:{display:`flex`,flex:`0 1 auto`,alignItems:`center`,gap:`10px`,width:`100%`,maxWidth:`100%`,minWidth:`0`,marginInlineStart:`auto`}}),u=n(`div`,{attrs:{role:`status`,"aria-live":`polite`,"aria-atomic":`true`},style:{flex:`1 1 0`,minWidth:`0`,color:`var(--persona-input-placeholder, var(--persona-text-muted, #71717a))`}}),d=n(`div`,{attrs:{"data-persona-dictation-waveform":``,"aria-hidden":`true`},style:{alignItems:`center`,justifyContent:`center`,gap:`4px`,height:`36px`,minWidth:`0`,color:`var(--persona-input-placeholder, var(--persona-text-muted, #71717a))`}}),f=Array.from({length:19},()=>n(`span`,{style:{width:`3px`,flexShrink:`0`,borderRadius:`3px`,background:`currentColor`}}));d.append(...f);let p=[],m=(e,a,o)=>{let s=n(`button`,{className:`persona-composer-control`,attrs:{type:`button`,"aria-label":a,"data-persona-dictation-action":e},style:{flexShrink:`0`,borderRadius:`50%`,alignItems:`center`,justifyContent:`center`,border:`1px solid var(--persona-border, #d4d4d8)`,color:`inherit`,background:`transparent`,cursor:`pointer`,padding:`0`}}),c=t(o,18,`currentColor`,2);return c?s.append(c):s.textContent=a,s.addEventListener(`click`,()=>i.actions[e]?.()),p.push(r({anchor:s,text:()=>s.getAttribute(`aria-label`)??a})),s},h=m(`cancel`,`Cancel dictation`,`x`),g=m(`finish`,`Finish dictation`,`check`),_=m(`send`,`Finish and send`,`arrow-up`);l.append(u,d,h,g,_),a.append(o,l);let v=(e,t,n=`block`)=>{e.hidden=!t,e.style.display=t?n:`none`},y=e=>{let t=i.state;i=e;let{state:n}=e,r=e.config.voiceRecognition?.dictation??{},p=r.display===`waveform`,m=!!(n.transcript||n.interimTranscript);v(a,n.phase!==`idle`&&n.phase!==`review`,`flex`),a.dataset.phase=n.phase,a.dataset.display=r.display??`transcript`,n.phase===t.phase&&n.error===t.error&&u.textContent||(u.textContent=n.phase===`recording`?`Listening…`:n.phase===`processing`?`Transcribing…`:n.error??``),s.textContent=n.transcript,c.textContent=n.interimTranscript,c.style.fontStyle=r.interimText?.fontStyle??`italic`,c.style.color=r.interimText?.color??`var(--persona-input-placeholder, var(--persona-text-muted, #71717a))`,u.style.fontStyle=n.phase===`recording`&&!p?r.interimText?.fontStyle??`italic`:`normal`,v(o,m&&r.display!==`inline`&&!p&&n.phase!==`error`),l.style.width=o.hidden?`100%`:`auto`;let y=(r.waveform??p)&&n.audioLevel!==null&&n.phase===`recording`;v(d,y,`flex`);let b=n.phase===`recording`&&(p?y:m);u.className=b?`persona-sr-only`:``,u.style.flex=b?`0 0 auto`:`1 1 0`,d.style.flex=p?`1 1 0`:`0 1 140px`,d.style.width=p?``:`140px`,d.style.marginInlineStart=`auto`,h.style.order=p?`-1`:`0`;let x=a.ownerDocument.defaultView?.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;f.forEach((e,t)=>{let r=x?6:3+(n.audioLevel??0)*Math.max(2,31-Math.abs(9-t)*3);e.style.height=`${r}px`,e.style.transition=x?`none`:`height 80ms linear`}),v(h,r.showCancel!==!1,`inline-flex`),v(g,r.showFinish!==!1&&n.phase!==`error`,`inline-flex`),g.disabled=n.phase!==`recording`,g.style.opacity=g.disabled?`0.45`:`1`,v(_,!!e.actions.send&&n.phase!==`error`,`inline-flex`),_.disabled=n.phase!==`recording`,_.style.opacity=_.disabled?`0.45`:`1`};return y(e),{element:a,update:y,destroy:()=>{p.forEach(e=>e.destroy()),a.remove()}}}function i(t){let n=null,i=``,a=null,o=!1,s=null,c=`idle`,l=/* @__PURE__ */ new Map,u=()=>{for(let[e,t]of l)e.style.display=t;l.clear()},d=(e=``)=>{let n=(i&&e&&!/\s$/.test(i)?` `:``)+e,r=t.getInlineInput();r?.replaceLogicalRange&&a!==null?(r.replaceLogicalRange(a,r.getLogicalText().length,n),r.dispatchInput()):t.getTextarea().value=i+n,t.syncText()},f=new e({onReview:d,onSend:()=>{t.isSendBlocked()||t.onSend()},onState:(e,i)=>{let a=t.getConfig(),p=t.getTextarea(),m=t.getFooter(),h=c;c=e.phase;let g=e.phase===`recording`||e.phase===`processing`;if(p.readOnly=g||o,p instanceof HTMLTextAreaElement||p.setAttribute(`contenteditable`,g||t.isInputDisabled()?`false`:s??`true`),e.phase===`idle`&&[`recording`,`processing`,`error`].includes(h))d();else if(g&&a.voiceRecognition?.dictation?.display===`inline`){let t=e.transcript||e.interimTranscript;d(t)}e.phase===`error`&&d();let _={instanceId:t.instanceId,state:e,config:a,actions:{cancel:()=>{f.cancel()},finish:()=>{f.finish()},...a.voiceRecognition?.dictation?.showSend&&!t.isSendBlocked()?{send:()=>{t.isSendBlocked()||f.finish(!0)||f.send()}}:{}},defaultRenderer:()=>r(_,t.rendererDeps)},v=[`recording`,`processing`,`error`].includes(e.phase);if(!n&&v){for(let e of t.plugins){let t=e.renderDictation?.(_);if(t){n=t instanceof HTMLElement?{element:t}:t;break}}n??=_.defaultRenderer(),n.element.addEventListener(`keydown`,e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),f.cancel())})}if(n&&v){let t=m.querySelector(`[data-persona-composer-form]`)??m;n.element.parentElement!==t&&t.append(n.element),u();let r=a.voiceRecognition?.dictation?.display===`inline`?Array.from(t.querySelectorAll(`[data-persona-composer-actions-start], [data-persona-composer-actions-end]`)):Array.from(t.children).filter(e=>e instanceof HTMLElement&&e!==n?.element);for(let e of r)l.set(e,e.style.display),e.style.display=`none`;n.update?.(_),(e.phase===`recording`&&h!==`recording`&&h!==`processing`||e.phase===`error`&&h!==`error`)&&n.element.querySelector(`button:not(:disabled), [tabindex]`)?.focus()}else u(),n?.destroy?.(),n?.element.remove(),n=null,(e.phase===`review`||e.phase===`idle`)&&e.phase!==h&&p.focus();i||t.onState(e,g)}});return{start(e,t,n){return i=n.text,a=n.logicalEnd,o=n.readOnly,s=n.contentEditable,f.start(e,t)},getState:()=>f.getState(),refresh:()=>f.refresh(),cancel:()=>f.cancel(),finish:(e=!1)=>f.finish(e),send:()=>f.send(),destroy(){f.destroy(),u(),n?.destroy?.(),n?.element.remove()}}}function a(e){let t=`--persona-voice-level`,n=.5,r=null,i=-1,a=0,o=n=>{let r=Math.round(Math.max(0,Math.min(1,n))*100)/100;if(r!==i){i=r;for(let n of e.targets())n.style.setProperty(t,String(r))}},s=()=>{i=-1,a=0;for(let n of e.targets())n.style.removeProperty(t)};function c(){if(r!==null)return;if(typeof requestAnimationFrame!=`function`){o(e.sample().level??n);return}let t=()=>{r=requestAnimationFrame(t);let{level:i,fallback:c}=e.sample();i===null&&!c?s():i===null?o(n):(a+=(i-a)*.3,o(a))};r=requestAnimationFrame(t)}function l(){r!==null&&(cancelAnimationFrame(r),r=null),s()}return{start:c,stop:l}}function o(e){let t=null;return{result:n=>{if(!e.isActive())return;let r=``,i=``;for(let e=0;e<n.results.length;e++){let t=n.results[e],a=t[0].transcript;t.isFinal?r+=a+` `:i=a}let a=e.initialText+r+i;e.textarea.value=a,e.syncText(),t&&clearTimeout(t),(r||i)&&(t=window.setTimeout(()=>{if(e.textarea.value.trim()&&e.isActive()){if(e.stop(),e.review())return;e.submit()}},e.pauseDuration))},error:t=>{e.isActive()&&t.error!==`no-speech`&&e.stop()},end:()=>{if(e.isActive()&&e.isActive()){let t=e.textarea.value.trim();!e.review()&&t&&t!==e.initialText.trim()&&e.submit(),e.stop()}},dispose:()=>{t!==null&&clearTimeout(t),t=null}}}exports.DictationController=e,exports.createBrowserRecognitionHandlers=o,exports.createDictationRenderer=r,exports.createDictationSession=i,exports.createVoiceLevelIndicator=a;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Gr as DictationPhase, Jr as DictationRenderHandle, Kr as DictationProviderConfig, Ro as AgentWidgetPlugin, Yr as DictationState, ja as renderLucideIcon, k as AgentWidgetConfig, qr as DictationRenderContext } from "./types-
|
|
2
|
-
import { t as ComposerInputCapability } from "./composer-input-
|
|
3
|
-
import { r as attachTooltip } from "./tooltip-
|
|
4
|
-
//#region src/voice/dictation.d.ts
|
|
1
|
+
import { Gr as DictationPhase, Jr as DictationRenderHandle, Kr as DictationProviderConfig, Ro as AgentWidgetPlugin, Yr as DictationState, ja as renderLucideIcon, k as AgentWidgetConfig, qr as DictationRenderContext } from "./types-BC7MRxO5.cjs";
|
|
2
|
+
import { t as ComposerInputCapability } from "./composer-input-i_FiUp6J.cjs";
|
|
3
|
+
import { r as attachTooltip } from "./tooltip-DbXkAuJL.cjs";
|
|
5
4
|
type DictationCallbacks = {
|
|
6
5
|
onState: (state: DictationState, levelOnly: boolean) => void;
|
|
7
6
|
onReview: (transcript: string) => void;
|
|
@@ -35,16 +34,12 @@ export declare class DictationController {
|
|
|
35
34
|
private release;
|
|
36
35
|
destroy(): void;
|
|
37
36
|
}
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/components/dictation.d.ts
|
|
40
37
|
type DictationRendererDeps = {
|
|
41
38
|
renderLucideIcon: typeof renderLucideIcon;
|
|
42
39
|
attachTooltip: typeof attachTooltip;
|
|
43
40
|
};
|
|
44
41
|
/** The built-in surface uses the same state/actions/lifecycle as plugin renderers. */
|
|
45
42
|
export declare function createDictationRenderer(initial: DictationRenderContext, { renderLucideIcon, attachTooltip }: DictationRendererDeps): DictationRenderHandle;
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region src/dictation-session.d.ts
|
|
48
43
|
interface DictationSessionOptions {
|
|
49
44
|
instanceId: string;
|
|
50
45
|
getTextarea: () => HTMLTextAreaElement;
|
|
@@ -81,8 +76,6 @@ export declare function createDictationSession(options: DictationSessionOptions)
|
|
|
81
76
|
send: () => boolean;
|
|
82
77
|
destroy(): void;
|
|
83
78
|
};
|
|
84
|
-
//#endregion
|
|
85
|
-
//#region src/voice/level-indicator.d.ts
|
|
86
79
|
/** Live amplitude styling, loaded with the optional dictation UI. */
|
|
87
80
|
export declare function createVoiceLevelIndicator(options: {
|
|
88
81
|
targets: () => HTMLElement[];
|
|
@@ -94,8 +87,6 @@ export declare function createVoiceLevelIndicator(options: {
|
|
|
94
87
|
start: () => void;
|
|
95
88
|
stop: () => void;
|
|
96
89
|
};
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region src/voice/browser-recognition-handlers.d.ts
|
|
99
90
|
interface BrowserRecognitionEvent {
|
|
100
91
|
results: ArrayLike<{
|
|
101
92
|
isFinal: boolean;
|
|
@@ -121,5 +112,5 @@ export declare function createBrowserRecognitionHandlers(options: {
|
|
|
121
112
|
end: () => void;
|
|
122
113
|
dispose: () => void;
|
|
123
114
|
};
|
|
124
|
-
|
|
115
|
+
export {};
|
|
125
116
|
export {}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Gr as DictationPhase, Jr as DictationRenderHandle, Kr as DictationProviderConfig, Ro as AgentWidgetPlugin, Yr as DictationState, ja as renderLucideIcon, k as AgentWidgetConfig, qr as DictationRenderContext } from "./types-
|
|
2
|
-
import { t as ComposerInputCapability } from "./composer-input-
|
|
3
|
-
import { r as attachTooltip } from "./tooltip-
|
|
4
|
-
//#region src/voice/dictation.d.ts
|
|
1
|
+
import { Gr as DictationPhase, Jr as DictationRenderHandle, Kr as DictationProviderConfig, Ro as AgentWidgetPlugin, Yr as DictationState, ja as renderLucideIcon, k as AgentWidgetConfig, qr as DictationRenderContext } from "./types-BC7MRxO5.js";
|
|
2
|
+
import { t as ComposerInputCapability } from "./composer-input-i_FiUp6J.js";
|
|
3
|
+
import { r as attachTooltip } from "./tooltip-DbXkAuJL.js";
|
|
5
4
|
type DictationCallbacks = {
|
|
6
5
|
onState: (state: DictationState, levelOnly: boolean) => void;
|
|
7
6
|
onReview: (transcript: string) => void;
|
|
@@ -35,16 +34,12 @@ export declare class DictationController {
|
|
|
35
34
|
private release;
|
|
36
35
|
destroy(): void;
|
|
37
36
|
}
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/components/dictation.d.ts
|
|
40
37
|
type DictationRendererDeps = {
|
|
41
38
|
renderLucideIcon: typeof renderLucideIcon;
|
|
42
39
|
attachTooltip: typeof attachTooltip;
|
|
43
40
|
};
|
|
44
41
|
/** The built-in surface uses the same state/actions/lifecycle as plugin renderers. */
|
|
45
42
|
export declare function createDictationRenderer(initial: DictationRenderContext, { renderLucideIcon, attachTooltip }: DictationRendererDeps): DictationRenderHandle;
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region src/dictation-session.d.ts
|
|
48
43
|
interface DictationSessionOptions {
|
|
49
44
|
instanceId: string;
|
|
50
45
|
getTextarea: () => HTMLTextAreaElement;
|
|
@@ -81,8 +76,6 @@ export declare function createDictationSession(options: DictationSessionOptions)
|
|
|
81
76
|
send: () => boolean;
|
|
82
77
|
destroy(): void;
|
|
83
78
|
};
|
|
84
|
-
//#endregion
|
|
85
|
-
//#region src/voice/level-indicator.d.ts
|
|
86
79
|
/** Live amplitude styling, loaded with the optional dictation UI. */
|
|
87
80
|
export declare function createVoiceLevelIndicator(options: {
|
|
88
81
|
targets: () => HTMLElement[];
|
|
@@ -94,8 +87,6 @@ export declare function createVoiceLevelIndicator(options: {
|
|
|
94
87
|
start: () => void;
|
|
95
88
|
stop: () => void;
|
|
96
89
|
};
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region src/voice/browser-recognition-handlers.d.ts
|
|
99
90
|
interface BrowserRecognitionEvent {
|
|
100
91
|
results: ArrayLike<{
|
|
101
92
|
isFinal: boolean;
|
|
@@ -121,5 +112,5 @@ export declare function createBrowserRecognitionHandlers(options: {
|
|
|
121
112
|
end: () => void;
|
|
122
113
|
dispose: () => void;
|
|
123
114
|
};
|
|
124
|
-
|
|
115
|
+
export {};
|
|
125
116
|
export {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=class{constructor(e){this.callbacks=e,this.state=Object.freeze({phase:`idle`,recordingId:0,transcript:``,interimTranscript:``,error:null,audioLevel:null}),this.provider=null,this.generation=0,this.destroyed=!1,this.sendOnCompletion=!1,this.sent=!1,this.ready=!1,this.finishRequested=!1,this.disconnecting=Promise.resolve()}getState(){return this.state}refresh(){this.destroyed||this.callbacks.onState(this.state,!1)}publish(e,t=!1){this.state=Object.freeze({...this.state,...e}),this.callbacks.onState(this.state,t)}start(e,n){if(this.destroyed||this.state.phase===`recording`||this.state.phase===`processing`)return!1;this.release();let r=++this.generation;this.sendOnCompletion=n.autoSend,this.sent=!1,this.ready=!1,this.finishRequested=!1,this.publish({phase:`recording`,recordingId:r,transcript:``,interimTranscript:``,error:null,audioLevel:null});let i=()=>!this.destroyed&&r===this.generation&&[`recording`,`processing`].includes(this.state.phase);try{let r=e.custom,a=e.type===`custom`?typeof r==`function`?r():r:t(e.browser,n.pauseDuration);if(!a||a.type===`runtype`)throw Error(`Dictation requires a speech-to-text provider.`);this.provider=a;let o=(e,t)=>{i()&&(t?(this.publish({transcript:e,interimTranscript:``}),this.complete()):this.publish({interimTranscript:e}))};a.onResult(e=>o(e.text,e.isFinal!==!1)),a.onTranscript?.((e,t,n)=>{e===`user`&&o(t,n)}),a.onLevel?.(e=>{i()&&this.state.phase===`recording`&&Number.isFinite(e)&&this.publish({audioLevel:Math.max(0,Math.min(1,e))},!0)}),a.onError(e=>{i()&&this.fail(e)}),a.onProcessingStart?.(()=>{i()&&this.publish({phase:`processing`,audioLevel:null})}),a.onStatusChange(e=>{i()&&(e===`processing`&&this.publish({phase:`processing`,audioLevel:null}),e===`idle`&&this.complete(),e===`error`&&this.fail(/* @__PURE__ */ Error(`Speech recognition failed.`)))}),this.disconnecting.then(async()=>{i()&&(await a.connect(),i()?(await a.startListening(),i()?(this.ready=!0,this.finishRequested&&await a.stopListening()):await a.disconnect()):await a.disconnect())}).catch(e=>{i()&&this.fail(e)})}catch(e){this.fail(e)}return!0}finish(e=!1){if(this.state.phase===`review`)return e?this.send():!1;if(this.state.phase!==`recording`)return!1;this.sendOnCompletion||=e;let t=this.generation;return this.publish({phase:`processing`,audioLevel:null}),this.finishRequested=!0,this.ready&&this.provider?.stopListening().catch(e=>{t===this.generation&&this.state.phase===`processing`&&this.fail(e)}),!0}cancel(){return this.destroyed||this.state.phase===`idle`?!1:(++this.generation,this.release(),this.publish({phase:`idle`,transcript:``,interimTranscript:``,error:null,audioLevel:null}),!0)}send(){return this.destroyed||this.state.phase!==`review`||this.sent?!1:(this.sent=!0,this.publish({phase:`idle`,audioLevel:null}),this.callbacks.onSend(),!0)}complete(){if(![`recording`,`processing`].includes(this.state.phase))return;let e=(this.state.transcript||this.state.interimTranscript).trim();e?(this.state.phase===`recording`&&this.publish({phase:`processing`,audioLevel:null}),this.release(),this.callbacks.onReview(e),this.publish({phase:`review`,transcript:e,interimTranscript:``,audioLevel:null}),this.sendOnCompletion&&this.send()):this.fail(/* @__PURE__ */ Error(`No speech was recognized.`))}fail(e){this.release(),this.publish({phase:`error`,error:e instanceof Error?e.message:String(e),audioLevel:null})}release(){let e=this.provider;this.provider=null,e&&(this.disconnecting=this.disconnecting.then(()=>e.disconnect()).catch(()=>{}))}destroy(){this.destroyed=!0,++this.generation,this.release()}};function t(e,t=2e3){let n=window,r=n.SpeechRecognition??n.webkitSpeechRecognition;if(!r)throw Error(`Browser speech recognition is unavailable.`);let i=new r;i.lang=e?.language??`en-US`,i.continuous=e?.continuous??!0,i.interimResults=!0;let a=``,o,s=!1,c=()=>{},l=()=>{},u=()=>{},d=()=>{clearTimeout(o),o=void 0};return i.onresult=e=>{s||(a=Array.from(e.results).map(e=>e[0].transcript).join(` `),c({text:a,provider:`browser`,isFinal:!1}),d(),a.trim()&&(o=setTimeout(()=>{u(`processing`),i.stop()},t)))},i.onend=()=>{s||(d(),c({text:a,provider:`browser`}),u(`idle`))},i.onerror=({error:e})=>{!s&&e!==`no-speech`&&l(Error(e))},{type:`browser`,connect:async()=>{},startListening:async()=>{i.start()},stopListening:async()=>{d(),i.stop()},disconnect:async()=>{s=!0,d(),i.abort(),i.onresult=null,i.onend=null,i.onerror=null},onResult:e=>{c=e},onError:e=>{l=e},onStatusChange:e=>{u=e}}}const n=(e,t={},...n)=>{let r=document.createElement(e);if(t.className&&(r.className=t.className),t.text!==void 0&&(r.textContent=t.text),t.attrs)for(let[e,n]of Object.entries(t.attrs))r.setAttribute(e,n);if(t.style){let e=r.style,n=t.style;for(let t of Object.keys(n)){let r=n[t];r!=null&&(e[t]=r)}}let i=n.filter(e=>e!=null);return i.length>0&&r.append(...i),r};function r(e,{renderLucideIcon:t,attachTooltip:r}){let i=e,a=n(`section`,{className:`persona-dictation`,attrs:{"data-persona-dictation":``,"aria-label":`Voice dictation`},style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:`12px`,width:`100%`,minWidth:`0`,gridColumn:`1 / -1`,color:`var(--persona-text, #18181b)`,fontFamily:`inherit`,fontSize:`var(--persona-composer-font-size, 16px)`,lineHeight:`1.5`}}),o=n(`div`,{attrs:{"data-persona-dictation-transcript":``,dir:`auto`},style:{flex:`1 1 auto`,width:`max-content`,maxWidth:`100%`,boxSizing:`border-box`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,maxHeight:`120px`,overflowY:`auto`,padding:`2px 4px`}}),s=n(`span`),c=n(`span`,{attrs:{"data-persona-dictation-interim":``}});o.append(s,c);let l=n(`div`,{style:{display:`flex`,flex:`0 1 auto`,alignItems:`center`,gap:`10px`,width:`100%`,maxWidth:`100%`,minWidth:`0`,marginInlineStart:`auto`}}),u=n(`div`,{attrs:{role:`status`,"aria-live":`polite`,"aria-atomic":`true`},style:{flex:`1 1 0`,minWidth:`0`,color:`var(--persona-input-placeholder, var(--persona-text-muted, #71717a))`}}),d=n(`div`,{attrs:{"data-persona-dictation-waveform":``,"aria-hidden":`true`},style:{alignItems:`center`,justifyContent:`center`,gap:`4px`,height:`36px`,minWidth:`0`,color:`var(--persona-input-placeholder, var(--persona-text-muted, #71717a))`}}),f=Array.from({length:19},()=>n(`span`,{style:{width:`3px`,flexShrink:`0`,borderRadius:`3px`,background:`currentColor`}}));d.append(...f);let p=[],m=(e,a,o)=>{let s=n(`button`,{className:`persona-composer-control`,attrs:{type:`button`,"aria-label":a,"data-persona-dictation-action":e},style:{flexShrink:`0`,borderRadius:`50%`,alignItems:`center`,justifyContent:`center`,border:`1px solid var(--persona-border, #d4d4d8)`,color:`inherit`,background:`transparent`,cursor:`pointer`,padding:`0`}}),c=t(o,18,`currentColor`,2);return c?s.append(c):s.textContent=a,s.addEventListener(`click`,()=>i.actions[e]?.()),p.push(r({anchor:s,text:()=>s.getAttribute(`aria-label`)??a})),s},h=m(`cancel`,`Cancel dictation`,`x`),g=m(`finish`,`Finish dictation`,`check`),_=m(`send`,`Finish and send`,`arrow-up`);l.append(u,d,h,g,_),a.append(o,l);let v=(e,t,n=`block`)=>{e.hidden=!t,e.style.display=t?n:`none`},y=e=>{let t=i.state;i=e;let{state:n}=e,r=e.config.voiceRecognition?.dictation??{},p=r.display===`waveform`,m=!!(n.transcript||n.interimTranscript);v(a,n.phase!==`idle`&&n.phase!==`review`,`flex`),a.dataset.phase=n.phase,a.dataset.display=r.display??`transcript`,(n.phase!==t.phase||n.error!==t.error||!u.textContent)&&(u.textContent=n.phase===`recording`?`Listening…`:n.phase===`processing`?`Transcribing…`:n.error??``),s.textContent=n.transcript,c.textContent=n.interimTranscript,c.style.fontStyle=r.interimText?.fontStyle??`italic`,c.style.color=r.interimText?.color??`var(--persona-input-placeholder, var(--persona-text-muted, #71717a))`,u.style.fontStyle=n.phase===`recording`&&!p?r.interimText?.fontStyle??`italic`:`normal`,v(o,m&&r.display!==`inline`&&!p&&n.phase!==`error`),l.style.width=o.hidden?`100%`:`auto`;let y=(r.waveform??p)&&n.audioLevel!==null&&n.phase===`recording`;v(d,y,`flex`);let b=n.phase===`recording`&&(p?y:m);u.className=b?`persona-sr-only`:``,u.style.flex=b?`0 0 auto`:`1 1 0`,d.style.flex=p?`1 1 0`:`0 1 140px`,d.style.width=p?``:`140px`,d.style.marginInlineStart=`auto`,h.style.order=p?`-1`:`0`;let x=a.ownerDocument.defaultView?.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;f.forEach((e,t)=>{let r=x?6:3+(n.audioLevel??0)*Math.max(2,31-Math.abs(9-t)*3);e.style.height=`${r}px`,e.style.transition=x?`none`:`height 80ms linear`}),v(h,r.showCancel!==!1,`inline-flex`),v(g,r.showFinish!==!1&&n.phase!==`error`,`inline-flex`),g.disabled=n.phase!==`recording`,g.style.opacity=g.disabled?`0.45`:`1`,v(_,!!e.actions.send&&n.phase!==`error`,`inline-flex`),_.disabled=n.phase!==`recording`,_.style.opacity=_.disabled?`0.45`:`1`};return y(e),{element:a,update:y,destroy:()=>{p.forEach(e=>e.destroy()),a.remove()}}}function i(t){let n=null,i=``,a=null,o=!1,s=null,c=`idle`,l=/* @__PURE__ */ new Map,u=()=>{for(let[e,t]of l)e.style.display=t;l.clear()},d=(e=``)=>{let n=(i&&e&&!/\s$/.test(i)?` `:``)+e,r=t.getInlineInput();r?.replaceLogicalRange&&a!==null?(r.replaceLogicalRange(a,r.getLogicalText().length,n),r.dispatchInput()):t.getTextarea().value=i+n,t.syncText()},f=new e({onReview:d,onSend:()=>{t.isSendBlocked()||t.onSend()},onState:(e,i)=>{let a=t.getConfig(),p=t.getTextarea(),m=t.getFooter(),h=c;c=e.phase;let g=e.phase===`recording`||e.phase===`processing`;if(p.readOnly=g||o,p instanceof HTMLTextAreaElement||p.setAttribute(`contenteditable`,g||t.isInputDisabled()?`false`:s??`true`),e.phase===`idle`&&[`recording`,`processing`,`error`].includes(h))d();else if(g&&a.voiceRecognition?.dictation?.display===`inline`){let t=e.transcript||e.interimTranscript;d(t)}e.phase===`error`&&d();let _={instanceId:t.instanceId,state:e,config:a,actions:{cancel:()=>{f.cancel()},finish:()=>{f.finish()},...a.voiceRecognition?.dictation?.showSend&&!t.isSendBlocked()?{send:()=>{t.isSendBlocked()||f.finish(!0)||f.send()}}:{}},defaultRenderer:()=>r(_,t.rendererDeps)},v=[`recording`,`processing`,`error`].includes(e.phase);if(!n&&v){for(let e of t.plugins){let t=e.renderDictation?.(_);if(t){n=t instanceof HTMLElement?{element:t}:t;break}}n??=_.defaultRenderer(),n.element.addEventListener(`keydown`,e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),f.cancel())})}if(n&&v){let t=m.querySelector(`[data-persona-composer-form]`)??m;n.element.parentElement!==t&&t.append(n.element),u();let r=a.voiceRecognition?.dictation?.display===`inline`?Array.from(t.querySelectorAll(`[data-persona-composer-actions-start], [data-persona-composer-actions-end]`)):Array.from(t.children).filter(e=>e instanceof HTMLElement&&e!==n?.element);for(let e of r)l.set(e,e.style.display),e.style.display=`none`;n.update?.(_),(e.phase===`recording`&&h!==`recording`&&h!==`processing`||e.phase===`error`&&h!==`error`)&&n.element.querySelector(`button:not(:disabled), [tabindex]`)?.focus()}else u(),n?.destroy?.(),n?.element.remove(),n=null,(e.phase===`review`||e.phase===`idle`)&&e.phase!==h&&p.focus();i||t.onState(e,g)}});return{start(e,t,n){return i=n.text,a=n.logicalEnd,o=n.readOnly,s=n.contentEditable,f.start(e,t)},getState:()=>f.getState(),refresh:()=>f.refresh(),cancel:()=>f.cancel(),finish:(e=!1)=>f.finish(e),send:()=>f.send(),destroy(){f.destroy(),u(),n?.destroy?.(),n?.element.remove()}}}function a(e){let t=`--persona-voice-level`,n=.5,r=null,i=-1,a=0,o=n=>{let r=Math.round(Math.max(0,Math.min(1,n))*100)/100;if(r!==i){i=r;for(let n of e.targets())n.style.setProperty(t,String(r))}},s=()=>{i=-1,a=0;for(let n of e.targets())n.style.removeProperty(t)};function c(){if(r!==null)return;if(typeof requestAnimationFrame!=`function`){o(e.sample().level??n);return}let t=()=>{r=requestAnimationFrame(t);let{level:i,fallback:c}=e.sample();i===null&&!c?s():i===null?o(n):(a+=(i-a)*.3,o(a))};r=requestAnimationFrame(t)}function l(){r!==null&&(cancelAnimationFrame(r),r=null),s()}return{start:c,stop:l}}function o(e){let t=null;return{result:n=>{if(!e.isActive())return;let r=``,i=``;for(let e=0;e<n.results.length;e++){let t=n.results[e],a=t[0].transcript;t.isFinal?r+=a+` `:i=a}let a=e.initialText+r+i;e.textarea.value=a,e.syncText(),t&&clearTimeout(t),(r||i)&&(t=window.setTimeout(()=>{if(e.textarea.value.trim()&&e.isActive()){if(e.stop(),e.review())return;e.submit()}},e.pauseDuration))},error:t=>{e.isActive()&&t.error!==`no-speech`&&e.stop()},end:()=>{if(e.isActive()&&e.isActive()){let t=e.textarea.value.trim();!e.review()&&t&&t!==e.initialText.trim()&&e.submit(),e.stop()}},dispose:()=>{t!==null&&clearTimeout(t),t=null}}}export{e as DictationController,o as createBrowserRecognitionHandlers,r as createDictationRenderer,i as createDictationSession,a as createVoiceLevelIndicator};
|
|
1
|
+
var e=class{constructor(e){this.callbacks=e,this.state=Object.freeze({phase:`idle`,recordingId:0,transcript:``,interimTranscript:``,error:null,audioLevel:null}),this.provider=null,this.generation=0,this.destroyed=!1,this.sendOnCompletion=!1,this.sent=!1,this.ready=!1,this.finishRequested=!1,this.disconnecting=Promise.resolve()}getState(){return this.state}refresh(){this.destroyed||this.callbacks.onState(this.state,!1)}publish(e,t=!1){this.state=Object.freeze({...this.state,...e}),this.callbacks.onState(this.state,t)}start(e,n){if(this.destroyed||this.state.phase===`recording`||this.state.phase===`processing`)return!1;this.release();let r=++this.generation;this.sendOnCompletion=n.autoSend,this.sent=!1,this.ready=!1,this.finishRequested=!1,this.publish({phase:`recording`,recordingId:r,transcript:``,interimTranscript:``,error:null,audioLevel:null});let i=()=>!this.destroyed&&r===this.generation&&[`recording`,`processing`].includes(this.state.phase);try{let r=e.custom,a=e.type===`custom`?typeof r==`function`?r():r:t(e.browser,n.pauseDuration);if(!a||a.type===`runtype`)throw Error(`Dictation requires a speech-to-text provider.`);this.provider=a;let o=(e,t)=>{i()&&(t?(this.publish({transcript:e,interimTranscript:``}),this.complete()):this.publish({interimTranscript:e}))};a.onResult(e=>o(e.text,e.isFinal!==!1)),a.onTranscript?.((e,t,n)=>{e===`user`&&o(t,n)}),a.onLevel?.(e=>{i()&&this.state.phase===`recording`&&Number.isFinite(e)&&this.publish({audioLevel:Math.max(0,Math.min(1,e))},!0)}),a.onError(e=>{i()&&this.fail(e)}),a.onProcessingStart?.(()=>{i()&&this.publish({phase:`processing`,audioLevel:null})}),a.onStatusChange(e=>{i()&&(e===`processing`&&this.publish({phase:`processing`,audioLevel:null}),e===`idle`&&this.complete(),e===`error`&&this.fail(/* @__PURE__ */ Error(`Speech recognition failed.`)))}),this.disconnecting.then(async()=>{i()&&(await a.connect(),i()?(await a.startListening(),i()?(this.ready=!0,this.finishRequested&&await a.stopListening()):await a.disconnect()):await a.disconnect())}).catch(e=>{i()&&this.fail(e)})}catch(e){this.fail(e)}return!0}finish(e=!1){if(this.state.phase===`review`)return e?this.send():!1;if(this.state.phase!==`recording`)return!1;this.sendOnCompletion||=e;let t=this.generation;return this.publish({phase:`processing`,audioLevel:null}),this.finishRequested=!0,this.ready&&this.provider?.stopListening().catch(e=>{t===this.generation&&this.state.phase===`processing`&&this.fail(e)}),!0}cancel(){return this.destroyed||this.state.phase===`idle`?!1:(++this.generation,this.release(),this.publish({phase:`idle`,transcript:``,interimTranscript:``,error:null,audioLevel:null}),!0)}send(){return this.destroyed||this.state.phase!==`review`||this.sent?!1:(this.sent=!0,this.publish({phase:`idle`,audioLevel:null}),this.callbacks.onSend(),!0)}complete(){if(![`recording`,`processing`].includes(this.state.phase))return;let e=(this.state.transcript||this.state.interimTranscript).trim();e?(this.state.phase===`recording`&&this.publish({phase:`processing`,audioLevel:null}),this.release(),this.callbacks.onReview(e),this.publish({phase:`review`,transcript:e,interimTranscript:``,audioLevel:null}),this.sendOnCompletion&&this.send()):this.fail(/* @__PURE__ */ Error(`No speech was recognized.`))}fail(e){this.release(),this.publish({phase:`error`,error:e instanceof Error?e.message:String(e),audioLevel:null})}release(){let e=this.provider;this.provider=null,e&&(this.disconnecting=this.disconnecting.then(()=>e.disconnect()).catch(()=>{}))}destroy(){this.destroyed=!0,++this.generation,this.release()}};function t(e,t=2e3){let n=window,r=n.SpeechRecognition??n.webkitSpeechRecognition;if(!r)throw Error(`Browser speech recognition is unavailable.`);let i=new r;i.lang=e?.language??`en-US`,i.continuous=e?.continuous??!0,i.interimResults=!0;let a=``,o,s=!1,c=()=>{},l=()=>{},u=()=>{},d=()=>{clearTimeout(o),o=void 0};return i.onresult=e=>{s||(a=Array.from(e.results).map(e=>e[0].transcript).join(` `),c({text:a,provider:`browser`,isFinal:!1}),d(),a.trim()&&(o=setTimeout(()=>{u(`processing`),i.stop()},t)))},i.onend=()=>{s||(d(),c({text:a,provider:`browser`}),u(`idle`))},i.onerror=({error:e})=>{!s&&e!==`no-speech`&&l(Error(e))},{type:`browser`,connect:async()=>{},startListening:async()=>{i.start()},stopListening:async()=>{d(),i.stop()},disconnect:async()=>{s=!0,d(),i.abort(),i.onresult=null,i.onend=null,i.onerror=null},onResult:e=>{c=e},onError:e=>{l=e},onStatusChange:e=>{u=e}}}const n=(e,t={},...n)=>{let r=document.createElement(e);if(t.className&&(r.className=t.className),t.text!==void 0&&(r.textContent=t.text),t.attrs)for(let[e,n]of Object.entries(t.attrs))r.setAttribute(e,n);if(t.style){let e=r.style,n=t.style;for(let t of Object.keys(n)){let r=n[t];r!=null&&(e[t]=r)}}let i=n.filter(e=>e!=null);return i.length>0&&r.append(...i),r};function r(e,{renderLucideIcon:t,attachTooltip:r}){let i=e,a=n(`section`,{className:`persona-dictation`,attrs:{"data-persona-dictation":``,"aria-label":`Voice dictation`},style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:`12px`,width:`100%`,minWidth:`0`,gridColumn:`1 / -1`,color:`var(--persona-text, #18181b)`,fontFamily:`inherit`,fontSize:`var(--persona-composer-font-size, 16px)`,lineHeight:`1.5`}}),o=n(`div`,{attrs:{"data-persona-dictation-transcript":``,dir:`auto`},style:{flex:`1 1 auto`,width:`max-content`,maxWidth:`100%`,boxSizing:`border-box`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,maxHeight:`120px`,overflowY:`auto`,padding:`2px 4px`}}),s=n(`span`),c=n(`span`,{attrs:{"data-persona-dictation-interim":``}});o.append(s,c);let l=n(`div`,{style:{display:`flex`,flex:`0 1 auto`,alignItems:`center`,gap:`10px`,width:`100%`,maxWidth:`100%`,minWidth:`0`,marginInlineStart:`auto`}}),u=n(`div`,{attrs:{role:`status`,"aria-live":`polite`,"aria-atomic":`true`},style:{flex:`1 1 0`,minWidth:`0`,color:`var(--persona-input-placeholder, var(--persona-text-muted, #71717a))`}}),d=n(`div`,{attrs:{"data-persona-dictation-waveform":``,"aria-hidden":`true`},style:{alignItems:`center`,justifyContent:`center`,gap:`4px`,height:`36px`,minWidth:`0`,color:`var(--persona-input-placeholder, var(--persona-text-muted, #71717a))`}}),f=Array.from({length:19},()=>n(`span`,{style:{width:`3px`,flexShrink:`0`,borderRadius:`3px`,background:`currentColor`}}));d.append(...f);let p=[],m=(e,a,o)=>{let s=n(`button`,{className:`persona-composer-control`,attrs:{type:`button`,"aria-label":a,"data-persona-dictation-action":e},style:{flexShrink:`0`,borderRadius:`50%`,alignItems:`center`,justifyContent:`center`,border:`1px solid var(--persona-border, #d4d4d8)`,color:`inherit`,background:`transparent`,cursor:`pointer`,padding:`0`}}),c=t(o,18,`currentColor`,2);return c?s.append(c):s.textContent=a,s.addEventListener(`click`,()=>i.actions[e]?.()),p.push(r({anchor:s,text:()=>s.getAttribute(`aria-label`)??a})),s},h=m(`cancel`,`Cancel dictation`,`x`),g=m(`finish`,`Finish dictation`,`check`),_=m(`send`,`Finish and send`,`arrow-up`);l.append(u,d,h,g,_),a.append(o,l);let v=(e,t,n=`block`)=>{e.hidden=!t,e.style.display=t?n:`none`},y=e=>{let t=i.state;i=e;let{state:n}=e,r=e.config.voiceRecognition?.dictation??{},p=r.display===`waveform`,m=!!(n.transcript||n.interimTranscript);v(a,n.phase!==`idle`&&n.phase!==`review`,`flex`),a.dataset.phase=n.phase,a.dataset.display=r.display??`transcript`,n.phase===t.phase&&n.error===t.error&&u.textContent||(u.textContent=n.phase===`recording`?`Listening…`:n.phase===`processing`?`Transcribing…`:n.error??``),s.textContent=n.transcript,c.textContent=n.interimTranscript,c.style.fontStyle=r.interimText?.fontStyle??`italic`,c.style.color=r.interimText?.color??`var(--persona-input-placeholder, var(--persona-text-muted, #71717a))`,u.style.fontStyle=n.phase===`recording`&&!p?r.interimText?.fontStyle??`italic`:`normal`,v(o,m&&r.display!==`inline`&&!p&&n.phase!==`error`),l.style.width=o.hidden?`100%`:`auto`;let y=(r.waveform??p)&&n.audioLevel!==null&&n.phase===`recording`;v(d,y,`flex`);let b=n.phase===`recording`&&(p?y:m);u.className=b?`persona-sr-only`:``,u.style.flex=b?`0 0 auto`:`1 1 0`,d.style.flex=p?`1 1 0`:`0 1 140px`,d.style.width=p?``:`140px`,d.style.marginInlineStart=`auto`,h.style.order=p?`-1`:`0`;let x=a.ownerDocument.defaultView?.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;f.forEach((e,t)=>{let r=x?6:3+(n.audioLevel??0)*Math.max(2,31-Math.abs(9-t)*3);e.style.height=`${r}px`,e.style.transition=x?`none`:`height 80ms linear`}),v(h,r.showCancel!==!1,`inline-flex`),v(g,r.showFinish!==!1&&n.phase!==`error`,`inline-flex`),g.disabled=n.phase!==`recording`,g.style.opacity=g.disabled?`0.45`:`1`,v(_,!!e.actions.send&&n.phase!==`error`,`inline-flex`),_.disabled=n.phase!==`recording`,_.style.opacity=_.disabled?`0.45`:`1`};return y(e),{element:a,update:y,destroy:()=>{p.forEach(e=>e.destroy()),a.remove()}}}function i(t){let n=null,i=``,a=null,o=!1,s=null,c=`idle`,l=/* @__PURE__ */ new Map,u=()=>{for(let[e,t]of l)e.style.display=t;l.clear()},d=(e=``)=>{let n=(i&&e&&!/\s$/.test(i)?` `:``)+e,r=t.getInlineInput();r?.replaceLogicalRange&&a!==null?(r.replaceLogicalRange(a,r.getLogicalText().length,n),r.dispatchInput()):t.getTextarea().value=i+n,t.syncText()},f=new e({onReview:d,onSend:()=>{t.isSendBlocked()||t.onSend()},onState:(e,i)=>{let a=t.getConfig(),p=t.getTextarea(),m=t.getFooter(),h=c;c=e.phase;let g=e.phase===`recording`||e.phase===`processing`;if(p.readOnly=g||o,p instanceof HTMLTextAreaElement||p.setAttribute(`contenteditable`,g||t.isInputDisabled()?`false`:s??`true`),e.phase===`idle`&&[`recording`,`processing`,`error`].includes(h))d();else if(g&&a.voiceRecognition?.dictation?.display===`inline`){let t=e.transcript||e.interimTranscript;d(t)}e.phase===`error`&&d();let _={instanceId:t.instanceId,state:e,config:a,actions:{cancel:()=>{f.cancel()},finish:()=>{f.finish()},...a.voiceRecognition?.dictation?.showSend&&!t.isSendBlocked()?{send:()=>{t.isSendBlocked()||f.finish(!0)||f.send()}}:{}},defaultRenderer:()=>r(_,t.rendererDeps)},v=[`recording`,`processing`,`error`].includes(e.phase);if(!n&&v){for(let e of t.plugins){let t=e.renderDictation?.(_);if(t){n=t instanceof HTMLElement?{element:t}:t;break}}n??=_.defaultRenderer(),n.element.addEventListener(`keydown`,e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),f.cancel())})}if(n&&v){let t=m.querySelector(`[data-persona-composer-form]`)??m;n.element.parentElement!==t&&t.append(n.element),u();let r=a.voiceRecognition?.dictation?.display===`inline`?Array.from(t.querySelectorAll(`[data-persona-composer-actions-start], [data-persona-composer-actions-end]`)):Array.from(t.children).filter(e=>e instanceof HTMLElement&&e!==n?.element);for(let e of r)l.set(e,e.style.display),e.style.display=`none`;n.update?.(_),(e.phase===`recording`&&h!==`recording`&&h!==`processing`||e.phase===`error`&&h!==`error`)&&n.element.querySelector(`button:not(:disabled), [tabindex]`)?.focus()}else u(),n?.destroy?.(),n?.element.remove(),n=null,(e.phase===`review`||e.phase===`idle`)&&e.phase!==h&&p.focus();i||t.onState(e,g)}});return{start(e,t,n){return i=n.text,a=n.logicalEnd,o=n.readOnly,s=n.contentEditable,f.start(e,t)},getState:()=>f.getState(),refresh:()=>f.refresh(),cancel:()=>f.cancel(),finish:(e=!1)=>f.finish(e),send:()=>f.send(),destroy(){f.destroy(),u(),n?.destroy?.(),n?.element.remove()}}}function a(e){let t=`--persona-voice-level`,n=.5,r=null,i=-1,a=0,o=n=>{let r=Math.round(Math.max(0,Math.min(1,n))*100)/100;if(r!==i){i=r;for(let n of e.targets())n.style.setProperty(t,String(r))}},s=()=>{i=-1,a=0;for(let n of e.targets())n.style.removeProperty(t)};function c(){if(r!==null)return;if(typeof requestAnimationFrame!=`function`){o(e.sample().level??n);return}let t=()=>{r=requestAnimationFrame(t);let{level:i,fallback:c}=e.sample();i===null&&!c?s():i===null?o(n):(a+=(i-a)*.3,o(a))};r=requestAnimationFrame(t)}function l(){r!==null&&(cancelAnimationFrame(r),r=null),s()}return{start:c,stop:l}}function o(e){let t=null;return{result:n=>{if(!e.isActive())return;let r=``,i=``;for(let e=0;e<n.results.length;e++){let t=n.results[e],a=t[0].transcript;t.isFinal?r+=a+` `:i=a}let a=e.initialText+r+i;e.textarea.value=a,e.syncText(),t&&clearTimeout(t),(r||i)&&(t=window.setTimeout(()=>{if(e.textarea.value.trim()&&e.isActive()){if(e.stop(),e.review())return;e.submit()}},e.pauseDuration))},error:t=>{e.isActive()&&t.error!==`no-speech`&&e.stop()},end:()=>{if(e.isActive()&&e.isActive()){let t=e.textarea.value.trim();!e.review()&&t&&t!==e.initialText.trim()&&e.submit(),e.stop()}},dispose:()=>{t!==null&&clearTimeout(t),t=null}}}export{e as DictationController,o as createBrowserRecognitionHandlers,r as createDictationRenderer,i as createDictationSession,a as createVoiceLevelIndicator};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/utils/dom-context.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Enriched DOM context collection for providing richer page information to AI.
|
|
4
3
|
*
|
|
@@ -134,6 +133,5 @@ declare function collectEnrichedPageContext(options?: DomContextOptions): Enrich
|
|
|
134
133
|
* those render under **Structured summaries** before the usual interactivity groups.
|
|
135
134
|
*/
|
|
136
135
|
declare function formatEnrichedContext(elements: EnrichedPageElement[], options?: FormatEnrichedContextOptions): string;
|
|
137
|
-
//#endregion
|
|
138
136
|
export { ParseOptionsConfig as a, collectEnrichedPageContext as c, generateStableSelector as d, FormatEnrichedContextOptions as i, defaultParseRules as l, DomContextOptions as n, ParseRule as o, EnrichedPageElement as r, RuleScoringContext as s, DomContextMode as t, formatEnrichedContext as u };
|
|
139
137
|
export {}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/utils/dom-context.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Enriched DOM context collection for providing richer page information to AI.
|
|
4
3
|
*
|
|
@@ -134,6 +133,5 @@ declare function collectEnrichedPageContext(options?: DomContextOptions): Enrich
|
|
|
134
133
|
* those render under **Structured summaries** before the usual interactivity groups.
|
|
135
134
|
*/
|
|
136
135
|
declare function formatEnrichedContext(elements: EnrichedPageElement[], options?: FormatEnrichedContextOptions): string;
|
|
137
|
-
//#endregion
|
|
138
136
|
export { ParseOptionsConfig as a, collectEnrichedPageContext as c, generateStableSelector as d, FormatEnrichedContextOptions as i, defaultParseRules as l, DomContextOptions as n, ParseRule as o, EnrichedPageElement as r, RuleScoringContext as s, DomContextMode as t, formatEnrichedContext as u };
|
|
139
137
|
export {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);const t=(e,t)=>{let n=document.createElement(e);return t&&(n.className=t),n}
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports);const t=(e,t)=>{let n=document.createElement(e);return t&&(n.className=t),n}
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide v1.18.0 - ISC
|
|
4
4
|
*
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Ro as AgentWidgetPlugin, Wi as SSEEventRecord, k as AgentWidgetConfig } from "./types-
|
|
2
|
-
//#region src/utils/scroll-animation.d.ts
|
|
1
|
+
import { Ro as AgentWidgetPlugin, Wi as SSEEventRecord, k as AgentWidgetConfig } from "./types-BC7MRxO5.cjs";
|
|
3
2
|
/** Explicit jump only: automatic following keeps its separate policy and animation. */
|
|
4
3
|
declare function createScrollToLatest(element: HTMLElement, keyboardScope: HTMLElement, onFrame: () => void, onComplete: () => void, onCancel: () => void): {
|
|
5
4
|
readonly active: boolean;
|
|
@@ -9,16 +8,13 @@ declare function createScrollToLatest(element: HTMLElement, keyboardScope: HTMLE
|
|
|
9
8
|
start(config: AgentWidgetConfig): void;
|
|
10
9
|
destroy(): void;
|
|
11
10
|
};
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/components/scroll-to-bottom.d.ts
|
|
14
11
|
/** Shared chrome; custom renderers own only the decorative glyph. */
|
|
15
12
|
declare function createScrollToBottomControl(renderIcon: (name: string, size?: string, color?: string, strokeWidth?: number) => SVGElement | null, view: "transcript" | "event-stream", focusTarget?: HTMLElement): {
|
|
16
13
|
element: HTMLButtonElement;
|
|
17
|
-
|
|
14
|
+
/** `approval` marks a pending approval below the fold: the control names it. */
|
|
15
|
+
update(nextConfig: AgentWidgetConfig, visible: boolean, active?: boolean, count?: number, approval?: boolean): void;
|
|
18
16
|
destroy(): void;
|
|
19
17
|
};
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/utils/event-stream-store.d.ts
|
|
22
18
|
export declare class EventStreamStore {
|
|
23
19
|
#private;
|
|
24
20
|
constructor(dbName?: string, storeName?: string);
|
|
@@ -31,8 +27,6 @@ export declare class EventStreamStore {
|
|
|
31
27
|
close(): void;
|
|
32
28
|
destroy(): Promise<void>;
|
|
33
29
|
}
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/utils/event-stream-buffer.d.ts
|
|
36
30
|
export declare class EventStreamBuffer {
|
|
37
31
|
#private;
|
|
38
32
|
constructor(maxSize?: number, store?: EventStreamStore | null);
|
|
@@ -48,8 +42,6 @@ export declare class EventStreamBuffer {
|
|
|
48
42
|
destroy(): void;
|
|
49
43
|
getEventTypes(): string[];
|
|
50
44
|
}
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region src/utils/throughput-tracker.d.ts
|
|
53
45
|
type ThroughputMetricStatus = "idle" | "running" | "complete" | "error";
|
|
54
46
|
type ThroughputMetricSource = "usage" | "estimate";
|
|
55
47
|
interface ThroughputMetric {
|
|
@@ -76,8 +68,6 @@ export declare class ThroughputTracker {
|
|
|
76
68
|
reset(): void;
|
|
77
69
|
processEvent(eventType: string, payload: unknown): void;
|
|
78
70
|
}
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region src/components/event-stream-view.d.ts
|
|
81
71
|
type EventStreamViewOptions = {
|
|
82
72
|
scroll: {
|
|
83
73
|
createScrollToLatest: typeof createScrollToLatest;
|
|
@@ -113,10 +103,7 @@ export declare function createEventStreamView(options: EventStreamViewOptions):
|
|
|
113
103
|
update: () => void;
|
|
114
104
|
destroy: () => void;
|
|
115
105
|
};
|
|
116
|
-
//#endregion
|
|
117
|
-
//#region src/event-stream-view-entry.d.ts
|
|
118
106
|
/** Mounted-view handle: what `createEventStreamView` returns. */
|
|
119
107
|
type EventStreamViewHandle = ReturnType<typeof createEventStreamView>;
|
|
120
|
-
//#endregion
|
|
121
108
|
export type { EventStreamViewHandle, EventStreamViewOptions };
|
|
122
109
|
export {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Ro as AgentWidgetPlugin, Wi as SSEEventRecord, k as AgentWidgetConfig } from "./types-
|
|
2
|
-
//#region src/utils/scroll-animation.d.ts
|
|
1
|
+
import { Ro as AgentWidgetPlugin, Wi as SSEEventRecord, k as AgentWidgetConfig } from "./types-BC7MRxO5.js";
|
|
3
2
|
/** Explicit jump only: automatic following keeps its separate policy and animation. */
|
|
4
3
|
declare function createScrollToLatest(element: HTMLElement, keyboardScope: HTMLElement, onFrame: () => void, onComplete: () => void, onCancel: () => void): {
|
|
5
4
|
readonly active: boolean;
|
|
@@ -9,16 +8,13 @@ declare function createScrollToLatest(element: HTMLElement, keyboardScope: HTMLE
|
|
|
9
8
|
start(config: AgentWidgetConfig): void;
|
|
10
9
|
destroy(): void;
|
|
11
10
|
};
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/components/scroll-to-bottom.d.ts
|
|
14
11
|
/** Shared chrome; custom renderers own only the decorative glyph. */
|
|
15
12
|
declare function createScrollToBottomControl(renderIcon: (name: string, size?: string, color?: string, strokeWidth?: number) => SVGElement | null, view: "transcript" | "event-stream", focusTarget?: HTMLElement): {
|
|
16
13
|
element: HTMLButtonElement;
|
|
17
|
-
|
|
14
|
+
/** `approval` marks a pending approval below the fold: the control names it. */
|
|
15
|
+
update(nextConfig: AgentWidgetConfig, visible: boolean, active?: boolean, count?: number, approval?: boolean): void;
|
|
18
16
|
destroy(): void;
|
|
19
17
|
};
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/utils/event-stream-store.d.ts
|
|
22
18
|
export declare class EventStreamStore {
|
|
23
19
|
#private;
|
|
24
20
|
constructor(dbName?: string, storeName?: string);
|
|
@@ -31,8 +27,6 @@ export declare class EventStreamStore {
|
|
|
31
27
|
close(): void;
|
|
32
28
|
destroy(): Promise<void>;
|
|
33
29
|
}
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/utils/event-stream-buffer.d.ts
|
|
36
30
|
export declare class EventStreamBuffer {
|
|
37
31
|
#private;
|
|
38
32
|
constructor(maxSize?: number, store?: EventStreamStore | null);
|
|
@@ -48,8 +42,6 @@ export declare class EventStreamBuffer {
|
|
|
48
42
|
destroy(): void;
|
|
49
43
|
getEventTypes(): string[];
|
|
50
44
|
}
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region src/utils/throughput-tracker.d.ts
|
|
53
45
|
type ThroughputMetricStatus = "idle" | "running" | "complete" | "error";
|
|
54
46
|
type ThroughputMetricSource = "usage" | "estimate";
|
|
55
47
|
interface ThroughputMetric {
|
|
@@ -76,8 +68,6 @@ export declare class ThroughputTracker {
|
|
|
76
68
|
reset(): void;
|
|
77
69
|
processEvent(eventType: string, payload: unknown): void;
|
|
78
70
|
}
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region src/components/event-stream-view.d.ts
|
|
81
71
|
type EventStreamViewOptions = {
|
|
82
72
|
scroll: {
|
|
83
73
|
createScrollToLatest: typeof createScrollToLatest;
|
|
@@ -113,10 +103,7 @@ export declare function createEventStreamView(options: EventStreamViewOptions):
|
|
|
113
103
|
update: () => void;
|
|
114
104
|
destroy: () => void;
|
|
115
105
|
};
|
|
116
|
-
//#endregion
|
|
117
|
-
//#region src/event-stream-view-entry.d.ts
|
|
118
106
|
/** Mounted-view handle: what `createEventStreamView` returns. */
|
|
119
107
|
type EventStreamViewHandle = ReturnType<typeof createEventStreamView>;
|
|
120
|
-
//#endregion
|
|
121
108
|
export type { EventStreamViewHandle, EventStreamViewOptions };
|
|
122
109
|
export {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Ji as SpeechCallbacks, Xi as SpeechRequest, Yi as SpeechEngine } from "./types-
|
|
2
|
-
//#region src/voice/fallback-speech-engine.d.ts
|
|
1
|
+
import { Ji as SpeechCallbacks, Xi as SpeechRequest, Yi as SpeechEngine } from "./types-BC7MRxO5.cjs";
|
|
3
2
|
interface FallbackSpeechEngineOptions {
|
|
4
3
|
/**
|
|
5
4
|
* Called once when the primary engine fails before audio starts and the
|
|
@@ -20,6 +19,5 @@ declare class FallbackSpeechEngine implements SpeechEngine {
|
|
|
20
19
|
stop(): void;
|
|
21
20
|
destroy(): void;
|
|
22
21
|
}
|
|
23
|
-
//#endregion
|
|
24
22
|
export { FallbackSpeechEngineOptions as n, FallbackSpeechEngine as t };
|
|
25
23
|
export {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Ji as SpeechCallbacks, Xi as SpeechRequest, Yi as SpeechEngine } from "./types-
|
|
2
|
-
//#region src/voice/fallback-speech-engine.d.ts
|
|
1
|
+
import { Ji as SpeechCallbacks, Xi as SpeechRequest, Yi as SpeechEngine } from "./types-BC7MRxO5.js";
|
|
3
2
|
interface FallbackSpeechEngineOptions {
|
|
4
3
|
/**
|
|
5
4
|
* Called once when the primary engine fails before audio starts and the
|
|
@@ -20,6 +19,5 @@ declare class FallbackSpeechEngine implements SpeechEngine {
|
|
|
20
19
|
stop(): void;
|
|
21
20
|
destroy(): void;
|
|
22
21
|
}
|
|
23
|
-
//#endregion
|
|
24
22
|
export { FallbackSpeechEngineOptions as n, FallbackSpeechEngine as t };
|
|
25
23
|
export {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Ai as PersonaArtifactDisplayModeInput, Li as PersonaArtifactRecord, Oa as WidgetPreferenceSlice, Pi as PersonaArtifactKind, _ as AgentWidgetArtifactsFeature, k as AgentWidgetConfig, ki as PersonaArtifactDisplayMode, nt as AgentWidgetFeatureFlags } from "./types-
|
|
2
|
-
//#region src/utils/artifact-display.d.ts
|
|
1
|
+
import { Ai as PersonaArtifactDisplayModeInput, Li as PersonaArtifactRecord, Oa as WidgetPreferenceSlice, Pi as PersonaArtifactKind, _ as AgentWidgetArtifactsFeature, k as AgentWidgetConfig, ki as PersonaArtifactDisplayMode, nt as AgentWidgetFeatureFlags } from "./types-BC7MRxO5.cjs";
|
|
3
2
|
/** Canonicalize the deprecated `"card"` alias to `"collapsed"`. */
|
|
4
3
|
declare function canonicalArtifactDisplayMode(mode: PersonaArtifactDisplayModeInput): PersonaArtifactDisplayMode;
|
|
5
4
|
type PersonaArtifactDisplayDescriptor = Pick<PersonaArtifactRecord, "artifactType" | "file" | "presentation">;
|
|
@@ -41,8 +40,6 @@ declare function resolveArtifactDisplay(feature: AgentWidgetArtifactsFeature | u
|
|
|
41
40
|
* explain which rule selected it.
|
|
42
41
|
*/
|
|
43
42
|
declare function resolveArtifactDisplayMode(feature: AgentWidgetArtifactsFeature | undefined, artifact: PersonaArtifactDisplayDescriptor): PersonaArtifactDisplayMode;
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/utils/feature-preferences.d.ts
|
|
46
43
|
type WidgetPreferenceParseIssueCode = "invalid_type" | "invalid_value" | "unknown_key" | "deprecated_key";
|
|
47
44
|
type WidgetPreferenceParseIssue = {
|
|
48
45
|
path: string;
|
|
@@ -71,6 +68,5 @@ declare function applyFeaturePreferences(baseFeatures: AgentWidgetFeatureFlags |
|
|
|
71
68
|
* pre-preference base features, not from a previously resolved result.
|
|
72
69
|
*/
|
|
73
70
|
declare function resolveConfigPreferences(config: AgentWidgetConfig): AgentWidgetConfig;
|
|
74
|
-
//#endregion
|
|
75
71
|
export { parseWidgetPreferenceSlice as a, PersonaArtifactDisplayMatch as c, normalizeMediaType as d, resolveArtifactDisplay as f, applyFeaturePreferences as i, PersonaArtifactDisplayResolution as l, WidgetPreferenceParseIssueCode as n, resolveConfigPreferences as o, resolveArtifactDisplayMode as p, WidgetPreferenceParseResult as r, PersonaArtifactDisplayDescriptor as s, WidgetPreferenceParseIssue as t, canonicalArtifactDisplayMode as u };
|
|
76
72
|
export {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Ai as PersonaArtifactDisplayModeInput, Li as PersonaArtifactRecord, Oa as WidgetPreferenceSlice, Pi as PersonaArtifactKind, _ as AgentWidgetArtifactsFeature, k as AgentWidgetConfig, ki as PersonaArtifactDisplayMode, nt as AgentWidgetFeatureFlags } from "./types-
|
|
2
|
-
//#region src/utils/artifact-display.d.ts
|
|
1
|
+
import { Ai as PersonaArtifactDisplayModeInput, Li as PersonaArtifactRecord, Oa as WidgetPreferenceSlice, Pi as PersonaArtifactKind, _ as AgentWidgetArtifactsFeature, k as AgentWidgetConfig, ki as PersonaArtifactDisplayMode, nt as AgentWidgetFeatureFlags } from "./types-BC7MRxO5.js";
|
|
3
2
|
/** Canonicalize the deprecated `"card"` alias to `"collapsed"`. */
|
|
4
3
|
declare function canonicalArtifactDisplayMode(mode: PersonaArtifactDisplayModeInput): PersonaArtifactDisplayMode;
|
|
5
4
|
type PersonaArtifactDisplayDescriptor = Pick<PersonaArtifactRecord, "artifactType" | "file" | "presentation">;
|
|
@@ -41,8 +40,6 @@ declare function resolveArtifactDisplay(feature: AgentWidgetArtifactsFeature | u
|
|
|
41
40
|
* explain which rule selected it.
|
|
42
41
|
*/
|
|
43
42
|
declare function resolveArtifactDisplayMode(feature: AgentWidgetArtifactsFeature | undefined, artifact: PersonaArtifactDisplayDescriptor): PersonaArtifactDisplayMode;
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/utils/feature-preferences.d.ts
|
|
46
43
|
type WidgetPreferenceParseIssueCode = "invalid_type" | "invalid_value" | "unknown_key" | "deprecated_key";
|
|
47
44
|
type WidgetPreferenceParseIssue = {
|
|
48
45
|
path: string;
|
|
@@ -71,6 +68,5 @@ declare function applyFeaturePreferences(baseFeatures: AgentWidgetFeatureFlags |
|
|
|
71
68
|
* pre-preference base features, not from a previously resolved result.
|
|
72
69
|
*/
|
|
73
70
|
declare function resolveConfigPreferences(config: AgentWidgetConfig): AgentWidgetConfig;
|
|
74
|
-
//#endregion
|
|
75
71
|
export { parseWidgetPreferenceSlice as a, PersonaArtifactDisplayMatch as c, normalizeMediaType as d, resolveArtifactDisplay as f, applyFeaturePreferences as i, PersonaArtifactDisplayResolution as l, WidgetPreferenceParseIssueCode as n, resolveConfigPreferences as o, resolveArtifactDisplayMode as p, WidgetPreferenceParseResult as r, PersonaArtifactDisplayDescriptor as s, WidgetPreferenceParseIssue as t, canonicalArtifactDisplayMode as u };
|
|
76
72
|
export {}
|
package/dist/forms-ui.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Ct as AgentWidgetMessage, k as AgentWidgetConfig } from "./types-
|
|
2
|
-
import { t as AgentWidgetSession } from "./session-
|
|
3
|
-
//#region src/components/forms.d.ts
|
|
1
|
+
import { Ct as AgentWidgetMessage, k as AgentWidgetConfig } from "./types-BC7MRxO5.cjs";
|
|
2
|
+
import { t as AgentWidgetSession } from "./session-CtZHe7fc.cjs";
|
|
4
3
|
export declare const formDefinitions: Record<string, {
|
|
5
4
|
title: string;
|
|
6
5
|
description?: string;
|
|
@@ -14,5 +13,4 @@ export declare const formDefinitions: Record<string, {
|
|
|
14
13
|
submitLabel?: string;
|
|
15
14
|
}>;
|
|
16
15
|
export declare const enhanceWithForms: (bubble: HTMLElement, message: AgentWidgetMessage, config: AgentWidgetConfig, session: AgentWidgetSession) => void;
|
|
17
|
-
//#endregion
|
|
18
16
|
export {}
|
package/dist/forms-ui.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Ct as AgentWidgetMessage, k as AgentWidgetConfig } from "./types-
|
|
2
|
-
import { t as AgentWidgetSession } from "./session-
|
|
3
|
-
//#region src/components/forms.d.ts
|
|
1
|
+
import { Ct as AgentWidgetMessage, k as AgentWidgetConfig } from "./types-BC7MRxO5.js";
|
|
2
|
+
import { t as AgentWidgetSession } from "./session-CtZHe7fc.js";
|
|
4
3
|
export declare const formDefinitions: Record<string, {
|
|
5
4
|
title: string;
|
|
6
5
|
description?: string;
|
|
@@ -14,5 +13,4 @@ export declare const formDefinitions: Record<string, {
|
|
|
14
13
|
submitLabel?: string;
|
|
15
14
|
}>;
|
|
16
15
|
export declare const enhanceWithForms: (bubble: HTMLElement, message: AgentWidgetMessage, config: AgentWidgetConfig, session: AgentWidgetSession) => void;
|
|
17
|
-
//#endregion
|
|
18
16
|
export {}
|
package/dist/{history-confirm-dialog-B3L7QNcO.d.cts → history-confirm-dialog-i46-lPN_.d.cts}
RENAMED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import { Fa as HistoryOperationContext, Ra as HistoryProvider, ct as AgentWidgetHistoryListAction, li as HistoryIdentityStatus, lt as AgentWidgetHistoryRenderActions, ot as AgentWidgetHistoryCopy, si as HistoryConversationSummary } from "./types-
|
|
2
|
-
import { n as TooltipOptions, t as TooltipHandle } from "./tooltip-
|
|
3
|
-
//#region src/components/history-view/copy.d.ts
|
|
1
|
+
import { Fa as HistoryOperationContext, Ra as HistoryProvider, ct as AgentWidgetHistoryListAction, li as HistoryIdentityStatus, lt as AgentWidgetHistoryRenderActions, ot as AgentWidgetHistoryCopy, si as HistoryConversationSummary } from "./types-BC7MRxO5.cjs";
|
|
2
|
+
import { n as TooltipOptions, t as TooltipHandle } from "./tooltip-DbXkAuJL.cjs";
|
|
4
3
|
type HistoryViewCopyInput = AgentWidgetHistoryCopy;
|
|
5
4
|
type ResolvedHistoryViewCopy = Required<AgentWidgetHistoryCopy>;
|
|
6
5
|
declare const HISTORY_VIEW_COPY_DEFAULTS: ResolvedHistoryViewCopy;
|
|
7
6
|
/** Idempotent: safe to call on an already-resolved copy object. */
|
|
8
7
|
declare function resolveHistoryViewCopy(copy: HistoryViewCopyInput | undefined): ResolvedHistoryViewCopy;
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/components/history-view/grouping.d.ts
|
|
11
8
|
/** `features.history.grouping`. Starred rows keep their pinned group in both. */
|
|
12
9
|
type HistoryGroupingMode = "time" | "none";
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/components/history-view/rows.d.ts
|
|
15
10
|
type RowPending = "opening" | "deleting" | null;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/components/history-view/state.d.ts
|
|
18
11
|
type HistoryListErrorReason = "unavailable" | "authentication_failed" | "authentication_required" | "identity_provider_failed" | "proof_not_admitted" | "unsupported_scope" | "unknown";
|
|
19
12
|
type HistoryListState = {
|
|
20
13
|
kind: "loading";
|
|
@@ -33,8 +26,6 @@ type HistoryListState = {
|
|
|
33
26
|
} | {
|
|
34
27
|
kind: "new_conversation_required";
|
|
35
28
|
};
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region src/components/history-view.d.ts
|
|
38
29
|
type HistoryViewPresentation = "panel" | "rail";
|
|
39
30
|
/**
|
|
40
31
|
* Where the top bar's contents live. `"external"` hands them to the shell,
|
|
@@ -296,8 +287,6 @@ interface HistoryViewHandle {
|
|
|
296
287
|
destroy(): void;
|
|
297
288
|
}
|
|
298
289
|
declare function createHistoryView(options: HistoryViewOptions): HistoryViewHandle;
|
|
299
|
-
//#endregion
|
|
300
|
-
//#region src/components/history-confirm-dialog.d.ts
|
|
301
290
|
/**
|
|
302
291
|
* Shell-owned destructive confirmation for history actions
|
|
303
292
|
* (`docs/visitor-history-implementation-plan.md` D7, accessibility contract).
|
|
@@ -317,6 +306,5 @@ interface HistoryConfirmOptions {
|
|
|
317
306
|
}
|
|
318
307
|
/** Resolves `true` only for the confirming action. */
|
|
319
308
|
declare function showHistoryConfirm(options: HistoryConfirmOptions): Promise<boolean>;
|
|
320
|
-
//#endregion
|
|
321
309
|
export { HistoryViewPresentation as a, HistoryListState as c, ResolvedHistoryViewCopy as d, resolveHistoryViewCopy as f, HistoryViewPendingAction as i, HISTORY_VIEW_COPY_DEFAULTS as l, HistoryViewHandle as n, createHistoryView as o, HistoryViewOptions as r, HistoryListErrorReason as s, showHistoryConfirm as t, HistoryViewCopyInput as u };
|
|
322
310
|
export {}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import { Fa as HistoryOperationContext, Ra as HistoryProvider, ct as AgentWidgetHistoryListAction, li as HistoryIdentityStatus, lt as AgentWidgetHistoryRenderActions, ot as AgentWidgetHistoryCopy, si as HistoryConversationSummary } from "./types-
|
|
2
|
-
import { n as TooltipOptions, t as TooltipHandle } from "./tooltip-
|
|
3
|
-
//#region src/components/history-view/copy.d.ts
|
|
1
|
+
import { Fa as HistoryOperationContext, Ra as HistoryProvider, ct as AgentWidgetHistoryListAction, li as HistoryIdentityStatus, lt as AgentWidgetHistoryRenderActions, ot as AgentWidgetHistoryCopy, si as HistoryConversationSummary } from "./types-BC7MRxO5.js";
|
|
2
|
+
import { n as TooltipOptions, t as TooltipHandle } from "./tooltip-DbXkAuJL.js";
|
|
4
3
|
type HistoryViewCopyInput = AgentWidgetHistoryCopy;
|
|
5
4
|
type ResolvedHistoryViewCopy = Required<AgentWidgetHistoryCopy>;
|
|
6
5
|
declare const HISTORY_VIEW_COPY_DEFAULTS: ResolvedHistoryViewCopy;
|
|
7
6
|
/** Idempotent: safe to call on an already-resolved copy object. */
|
|
8
7
|
declare function resolveHistoryViewCopy(copy: HistoryViewCopyInput | undefined): ResolvedHistoryViewCopy;
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/components/history-view/grouping.d.ts
|
|
11
8
|
/** `features.history.grouping`. Starred rows keep their pinned group in both. */
|
|
12
9
|
type HistoryGroupingMode = "time" | "none";
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/components/history-view/rows.d.ts
|
|
15
10
|
type RowPending = "opening" | "deleting" | null;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/components/history-view/state.d.ts
|
|
18
11
|
type HistoryListErrorReason = "unavailable" | "authentication_failed" | "authentication_required" | "identity_provider_failed" | "proof_not_admitted" | "unsupported_scope" | "unknown";
|
|
19
12
|
type HistoryListState = {
|
|
20
13
|
kind: "loading";
|
|
@@ -33,8 +26,6 @@ type HistoryListState = {
|
|
|
33
26
|
} | {
|
|
34
27
|
kind: "new_conversation_required";
|
|
35
28
|
};
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region src/components/history-view.d.ts
|
|
38
29
|
type HistoryViewPresentation = "panel" | "rail";
|
|
39
30
|
/**
|
|
40
31
|
* Where the top bar's contents live. `"external"` hands them to the shell,
|
|
@@ -296,8 +287,6 @@ interface HistoryViewHandle {
|
|
|
296
287
|
destroy(): void;
|
|
297
288
|
}
|
|
298
289
|
declare function createHistoryView(options: HistoryViewOptions): HistoryViewHandle;
|
|
299
|
-
//#endregion
|
|
300
|
-
//#region src/components/history-confirm-dialog.d.ts
|
|
301
290
|
/**
|
|
302
291
|
* Shell-owned destructive confirmation for history actions
|
|
303
292
|
* (`docs/visitor-history-implementation-plan.md` D7, accessibility contract).
|
|
@@ -317,6 +306,5 @@ interface HistoryConfirmOptions {
|
|
|
317
306
|
}
|
|
318
307
|
/** Resolves `true` only for the confirming action. */
|
|
319
308
|
declare function showHistoryConfirm(options: HistoryConfirmOptions): Promise<boolean>;
|
|
320
|
-
//#endregion
|
|
321
309
|
export { HistoryViewPresentation as a, HistoryListState as c, ResolvedHistoryViewCopy as d, resolveHistoryViewCopy as f, HistoryViewPendingAction as i, HISTORY_VIEW_COPY_DEFAULTS as l, HistoryViewHandle as n, createHistoryView as o, HistoryViewOptions as r, HistoryListErrorReason as s, showHistoryConfirm as t, HistoryViewCopyInput as u };
|
|
322
310
|
export {}
|