@webority/chat-core 0.157.0 → 0.158.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/runtime.js +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/runtime.d.ts +8 -4
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sniffAudioType as e}from"./audioType.js";import{ChatApiError as t,createChatClient as n,newIdempotencyKey as r}from"./client.js";import{ChatDecodeError as i}from"./decode/primitives.js";import{decodeChatPart as a}from"./decode/parts.js";import{decodeChatConversationView as o,decodeChatMessageView as s}from"./decode/messages.js";import{CHAT_CONTRACT_VERSION as c,CHAT_HANDOFF_REQUEST_ID as l}from"./contract.js";import{createConversationList as u}from"./conversationList.js";import{decodeChatProfileView as d}from"./decode/profile.js";import{
|
|
1
|
+
import{sniffAudioType as e}from"./audioType.js";import{ChatApiError as t,createChatClient as n,newIdempotencyKey as r}from"./client.js";import{ChatDecodeError as i}from"./decode/primitives.js";import{decodeChatPart as a}from"./decode/parts.js";import{decodeChatConversationView as o,decodeChatMessageView as s}from"./decode/messages.js";import{CHAT_CONTRACT_VERSION as c,CHAT_HANDOFF_REQUEST_ID as l}from"./contract.js";import{createConversationList as u}from"./conversationList.js";import{decodeChatProfileView as d}from"./decode/profile.js";import{DICTATION_NO_SPEECH_MS as f,DICTATION_SILENCE_MS as p,createDictation as m}from"./dictation.js";import{decodeChatStreamEvent as h}from"./decode/events.js";import{createExplain as g}from"./explain.js";import{formatFigure as _,toFigureRuns as v,toFigureText as y}from"./figures.js";import{createFixtureClient as b}from"./fixtureClient.js";import{decodeChatFixture as x}from"./decode/fixture.js";import{formatChatDate as S,formatChatDateTime as C,formatChatDay as w,formatChatValue as T,formatFileSize as E,messagePlainText as D}from"./format.js";import{isHandoffTarget as O}from"./handoff.js";import{IDLE_CHAT_SESSION as k,IDLE_CHAT_STATE as A}from"./idleSession.js";import{DEFAULT_CHAT_LABELS as j,mergeLabels as M}from"./labels.js";import{isSafeLinkUrl as N}from"./links.js";import{defaultChatLook as P,mergeLook as F}from"./look.js";import{pacingDelayMs as I}from"./pacing.js";import{CHAT_FEATURES as L,LOADER_STYLES as R,emptyFeatures as z,featureRecord as B,loaderView as V,resolveFeatures as H,resolveNudge as U,resolveStart as W,showsCaptchaNote as G}from"./profile.js";import{provideRuntimeCrypto as K}from"./runtime.js";import{createChatSession as q,createTurnApi as J,handoffSettledIds as Y}from"./session.js";import{CHAT_SPEECH_TOKEN_MARGIN_MS as X,ChatSpeechError as Z,createSpeechTokenSource as Q}from"./speech.js";import{humanizeService as $,selectStarters as ee}from"./starters.js";import{createSseParser as te,createStreamReader as ne}from"./stream.js";import{buildTranscript as re,transcriptToText as ie}from"./transcript.js";import{formatClipTime as ae,voiceClipBars as oe}from"./voiceClip.js";export{c as CHAT_CONTRACT_VERSION,L as CHAT_FEATURES,l as CHAT_HANDOFF_REQUEST_ID,X as CHAT_SPEECH_TOKEN_MARGIN_MS,t as ChatApiError,i as ChatDecodeError,Z as ChatSpeechError,j as DEFAULT_CHAT_LABELS,f as DICTATION_NO_SPEECH_MS,p as DICTATION_SILENCE_MS,k as IDLE_CHAT_SESSION,A as IDLE_CHAT_STATE,R as LOADER_STYLES,re as buildTranscript,n as createChatClient,q as createChatSession,u as createConversationList,m as createDictation,g as createExplain,b as createFixtureClient,Q as createSpeechTokenSource,te as createSseParser,ne as createStreamReader,J as createTurnApi,o as decodeChatConversationView,x as decodeChatFixture,s as decodeChatMessageView,a as decodeChatPart,d as decodeChatProfileView,h as decodeChatStreamEvent,P as defaultChatLook,z as emptyFeatures,B as featureRecord,S as formatChatDate,C as formatChatDateTime,w as formatChatDay,T as formatChatValue,ae as formatClipTime,_ as formatFigure,E as formatFileSize,Y as handoffSettledIds,$ as humanizeService,O as isHandoffTarget,N as isSafeLinkUrl,V as loaderView,M as mergeLabels,F as mergeLook,D as messagePlainText,r as newIdempotencyKey,I as pacingDelayMs,K as provideRuntimeCrypto,H as resolveFeatures,U as resolveNudge,W as resolveStart,ee as selectStarters,G as showsCaptchaNote,e as sniffAudioType,v as toFigureRuns,y as toFigureText,ie as transcriptToText,oe as voiceClipBars};
|
package/dist/runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=(e,t)=>Reflect.get(e,t),
|
|
1
|
+
var e,t=t=>{if(typeof t.randomUUID!=`function`&&typeof t.getRandomValues!=`function`)throw Error(`provideRuntimeCrypto needs randomUUID or getRandomValues.`);e=t},n=(e,t)=>Reflect.get(e,t),r=e=>typeof e==`object`&&!!e||typeof e==`function`,i=(e,t)=>r(e)&&typeof n(e,t)==`function`,a=(e,t,r)=>{let i=n(e,t);if(typeof i!=`function`)throw Error(`${t} is not available on this host.`);return Reflect.apply(i,e,r)},o=(e,t)=>{let i=n(globalThis,e);if(typeof i!=`function`)throw Error(`${e} is not available on this host.`);let a=Reflect.construct(i,t);if(!r(a))throw Error(`${e} did not construct an object.`);return a},s=e=>r(e)&&typeof n(e,`aborted`)==`boolean`&&i(e,`addEventListener`)&&i(e,`removeEventListener`),c=class{signal;#e;constructor(){let e=o(`AbortController`,[]),t=n(e,`signal`);if(!s(t))throw Error(`AbortController made no usable signal.`);this.#e=e,this.signal=t}abort(){a(this.#e,`abort`,[])}},l=/* @__PURE__ */ new Map,u=/* @__PURE__ */ new Map,d=1,f=(e,t,n)=>{let r=d++;return e.set(r,a(globalThis,t,n(r))),r},p=(e,t,n)=>{if(!e.has(n))return;let r=e.get(n);e.delete(n),a(globalThis,t,[r])},m=e=>i(globalThis,e)?(t,n)=>{a(globalThis,e,[t,n])}:void 0,h={AbortController:c,setTimeout:(e,t)=>f(l,`setTimeout`,n=>[()=>{l.delete(n),e()},t]),clearTimeout:e=>p(l,`clearTimeout`,e),get requestAnimationFrame(){if(i(globalThis,`requestAnimationFrame`))return e=>f(u,`requestAnimationFrame`,t=>[()=>{u.delete(t),e()}])},get cancelAnimationFrame(){if(i(globalThis,`cancelAnimationFrame`))return e=>p(u,`cancelAnimationFrame`,e)},get navigator(){let e=n(globalThis,`navigator`);if(!r(e))return;let t=n(e,`onLine`);return typeof t==`boolean`?{onLine:t}:{}},get addEventListener(){return m(`addEventListener`)},get removeEventListener(){return m(`removeEventListener`)},get location(){let e=n(globalThis,`location`);if(!r(e))return;let t=n(e,`pathname`);return typeof t==`string`?{pathname:t}:{}},get createFormData(){if(typeof n(globalThis,`FormData`)==`function`)return()=>{let e=o(`FormData`,[]);return{native:e,append:(t,n,r)=>{a(e,`append`,r===void 0?[t,n]:[t,n,r])}}}},get createObjectUrl(){let e=n(globalThis,`URL`);if(typeof n(globalThis,`Blob`)==`function`&&i(e,`createObjectURL`)&&r(e))return t=>{let n=a(e,`createObjectURL`,[o(`Blob`,[[t]])]);if(typeof n!=`string`)throw Error(`createObjectURL returned no URL.`);return n}},get revokeObjectUrl(){let e=n(globalThis,`URL`);if(r(e)&&i(e,`revokeObjectURL`))return t=>{a(e,`revokeObjectURL`,[t])}},get crypto(){if(e)return e;let t=n(globalThis,`crypto`);if(!r(t))return;let o=i(t,`randomUUID`),s=i(t,`getRandomValues`);if(!o&&!s)return;let c={};return o&&(c.randomUUID=()=>{let e=a(t,`randomUUID`,[]);if(typeof e!=`string`)throw Error(`randomUUID returned no string.`);return e}),s&&(c.getRandomValues=e=>{let n=a(t,`getRandomValues`,[e]);if(!(n instanceof Uint8Array))throw Error(`getRandomValues returned no bytes.`);return n}),c}};export{t as provideRuntimeCrypto,h as runtime};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export * from "./links";
|
|
|
15
15
|
export * from "./look";
|
|
16
16
|
export * from "./pacing";
|
|
17
17
|
export * from "./profile";
|
|
18
|
+
export type { RuntimeCrypto } from "./runtime";
|
|
19
|
+
export { provideRuntimeCrypto } from "./runtime";
|
|
18
20
|
export * from "./session";
|
|
19
21
|
export * from "./speech";
|
|
20
22
|
export * from "./starters";
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -28,9 +28,13 @@ export interface EngineRuntime {
|
|
|
28
28
|
createFormData?: (() => HostFormData) | undefined;
|
|
29
29
|
createObjectUrl?: ((bytes: ArrayBuffer) => string) | undefined;
|
|
30
30
|
revokeObjectUrl?: ((url: string) => void) | undefined;
|
|
31
|
-
crypto?:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
crypto?: RuntimeCrypto | undefined;
|
|
32
|
+
}
|
|
33
|
+
/** A source of random values: at least one of the two functions. */
|
|
34
|
+
export interface RuntimeCrypto {
|
|
35
|
+
randomUUID?: (() => string) | undefined;
|
|
36
|
+
getRandomValues?: ((bytes: Uint8Array) => Uint8Array) | undefined;
|
|
35
37
|
}
|
|
38
|
+
/** Supplies the engine's random values on a host with no global crypto. Throws when neither function is given. */
|
|
39
|
+
export declare const provideRuntimeCrypto: (crypto: RuntimeCrypto) => void;
|
|
36
40
|
export declare const runtime: EngineRuntime;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/chat-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.158.1",
|
|
4
4
|
"description": "The headless Webority Chat engine: the client over the chat routes, the session state machine over message parts, the stream reader, profile resolution with screen narrowing, the default English labels and a fixture client for sandboxes and tests. No DOM and no UI.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"type": "module",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
},
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@webority/markdown-core": "^0.
|
|
29
|
+
"@webority/markdown-core": "^0.179.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@webority/markdown-core": "0.
|
|
32
|
+
"@webority/markdown-core": "0.179.0",
|
|
33
33
|
"typescript": "^7.0.2",
|
|
34
34
|
"vite": "^8.1.6",
|
|
35
35
|
"vitest": "5.1.0"
|