@opencx/widget-react-headless 5.6.0 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Zt=t=>{throw TypeError(t)};var Vt=(t,e,s)=>e.has(t)||Zt("Cannot "+s);var Z=(t,e,s)=>(Vt(t,e,"read from private field"),s?s.call(t):e.get(t)),de=(t,e,s)=>e.has(t)?Zt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),K=(t,e,s,r)=>(Vt(t,e,"write to private field"),r?r.call(t,s):e.set(t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),q=require("@opencx/widget-core"),H=require("zod/v4"),mr=require("zod/v4/core");require("react/jsx-runtime");const k=require("zod"),gr="5.6.0";function W(t){return p.useSyncExternalStore(t.subscribe,t.get,t.get)}function hr({turnSources:t,liveItems:e,isStreaming:s,lastMessageIsFromUser:r}){var l;if(s||r)return null;const n=e.length>0?e:(l=t.at(-1))==null?void 0:l.items;return n?yr(n):null}function yr(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if((s==null?void 0:s.kind)==="questions")return s.request}return null}const ms="vercel.ai.error",vr=Symbol.for(ms);var Y=class gs extends Error{constructor({name:e,message:s,cause:r}){super(s),this[vr]=!0,this.name=e,this.cause=r}static isInstance(e){return gs.hasMarker(e,ms)}static hasMarker(e,s){const r=Symbol.for(s);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};const hs="AI_APICallError",ys=`vercel.ai.error.${hs}`,br=Symbol.for(ys);var Sr=class extends Y{constructor({message:t,url:e,requestBodyValues:s,statusCode:r,responseHeaders:n,responseBody:l,cause:c,isRetryable:d=r!=null&&(r===408||r===409||r===429||r>=500),data:v}){super({name:hs,message:t,cause:c}),this[br]=!0,this.url=e,this.requestBodyValues=s,this.statusCode=r,this.responseHeaders=n,this.responseBody=l,this.isRetryable=d,this.data=v}static isInstance(t){return Y.hasMarker(t,ys)}};const vs="AI_EmptyResponseBodyError",bs=`vercel.ai.error.${vs}`,Cr=Symbol.for(bs);var Wt=class extends Y{constructor({message:t="Empty response body"}={}){super({name:vs,message:t}),this[Cr]=!0}static isInstance(t){return Y.hasMarker(t,bs)}};function Ss(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.toString():JSON.stringify(t)}const Cs="AI_InvalidArgumentError",Es=`vercel.ai.error.${Cs}`,Er=Symbol.for(Es);var Ir=class extends Y{constructor({message:e,cause:s,argument:r}){super({name:Cs,message:e,cause:s}),this[Er]=!0,this.argument=r}static isInstance(e){return Y.hasMarker(e,Es)}};const Is="AI_JSONParseError",As=`vercel.ai.error.${Is}`,Ar=Symbol.for(As);var Bt=class extends Y{constructor({text:t,cause:e}){super({name:Is,message:`JSON parsing failed: Text: ${t}.
1
+ "use strict";var Zt=t=>{throw TypeError(t)};var Vt=(t,e,s)=>e.has(t)||Zt("Cannot "+s);var Z=(t,e,s)=>(Vt(t,e,"read from private field"),s?s.call(t):e.get(t)),de=(t,e,s)=>e.has(t)?Zt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),K=(t,e,s,r)=>(Vt(t,e,"write to private field"),r?r.call(t,s):e.set(t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),q=require("@opencx/widget-core"),H=require("zod/v4"),mr=require("zod/v4/core");require("react/jsx-runtime");const k=require("zod"),gr="5.7.0";function W(t){return p.useSyncExternalStore(t.subscribe,t.get,t.get)}function hr({turnSources:t,liveItems:e,isStreaming:s,lastMessageIsFromUser:r}){var l;if(s||r)return null;const n=e.length>0?e:(l=t.at(-1))==null?void 0:l.items;return n?yr(n):null}function yr(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if((s==null?void 0:s.kind)==="questions")return s.request}return null}const ms="vercel.ai.error",vr=Symbol.for(ms);var Y=class gs extends Error{constructor({name:e,message:s,cause:r}){super(s),this[vr]=!0,this.name=e,this.cause=r}static isInstance(e){return gs.hasMarker(e,ms)}static hasMarker(e,s){const r=Symbol.for(s);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};const hs="AI_APICallError",ys=`vercel.ai.error.${hs}`,br=Symbol.for(ys);var Sr=class extends Y{constructor({message:t,url:e,requestBodyValues:s,statusCode:r,responseHeaders:n,responseBody:l,cause:c,isRetryable:d=r!=null&&(r===408||r===409||r===429||r>=500),data:v}){super({name:hs,message:t,cause:c}),this[br]=!0,this.url=e,this.requestBodyValues=s,this.statusCode=r,this.responseHeaders=n,this.responseBody=l,this.isRetryable=d,this.data=v}static isInstance(t){return Y.hasMarker(t,ys)}};const vs="AI_EmptyResponseBodyError",bs=`vercel.ai.error.${vs}`,Cr=Symbol.for(bs);var Wt=class extends Y{constructor({message:t="Empty response body"}={}){super({name:vs,message:t}),this[Cr]=!0}static isInstance(t){return Y.hasMarker(t,bs)}};function Ss(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.toString():JSON.stringify(t)}const Cs="AI_InvalidArgumentError",Es=`vercel.ai.error.${Cs}`,Er=Symbol.for(Es);var Ir=class extends Y{constructor({message:e,cause:s,argument:r}){super({name:Cs,message:e,cause:s}),this[Er]=!0,this.argument=r}static isInstance(e){return Y.hasMarker(e,Es)}};const Is="AI_JSONParseError",As=`vercel.ai.error.${Is}`,Ar=Symbol.for(As);var Bt=class extends Y{constructor({text:t,cause:e}){super({name:Is,message:`JSON parsing failed: Text: ${t}.
2
2
  Error message: ${Ss(e)}`,cause:e}),this[Ar]=!0,this.text=t}static isInstance(t){return Y.hasMarker(t,As)}};const ws="AI_TypeValidationError",xs=`vercel.ai.error.${ws}`,wr=Symbol.for(xs);var it=class xt extends Y{constructor({value:e,cause:s,context:r}){let n="Type validation failed";if(r!=null&&r.field&&(n+=` for ${r.field}`),r!=null&&r.entityName||r!=null&&r.entityId){n+=" (";const l=[];r.entityName&&l.push(r.entityName),r.entityId&&l.push(`id: "${r.entityId}"`),n+=l.join(", "),n+=")"}super({name:ws,message:`${n}: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${Ss(s)}`,cause:s}),this[wr]=!0,this.value=e,this.context=r}static isInstance(e){return Y.hasMarker(e,xs)}static wrap({value:e,cause:s,context:r}){var n,l,c;return xt.isInstance(s)&&s.value===e&&((n=s.context)==null?void 0:n.field)===(r==null?void 0:r.field)&&((l=s.context)==null?void 0:l.entityName)===(r==null?void 0:r.entityName)&&((c=s.context)==null?void 0:c.entityId)===(r==null?void 0:r.entityId)?s:new xt({value:e,cause:s,context:r})}};const Ms="AI_UnsupportedFunctionalityError",Ts=`vercel.ai.error.${Ms}`,xr=Symbol.for(Ts);var Mr=class extends Y{constructor({functionality:t,message:e=`'${t}' functionality not supported.`}){super({name:Ms,message:e}),this[xr]=!0,this.functionality=t}static isInstance(t){return Y.hasMarker(t,Ts)}};class St extends Error{constructor(e,s){super(e),this.name="ParseError",this.type=s.type,this.field=s.field,this.value=s.value,this.line=s.line}}const Jt=10,Tr=13,we=32;function Ct(t){}function Rr(t){if(typeof t=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");const{onEvent:e=Ct,onError:s=Ct,onRetry:r=Ct,onComment:n,maxBufferSize:l}=t,c=[];let d=0,v=!0,g,i="",u=0,m,b=!1;function O(o){if(b)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(v&&(v=!1,o.charCodeAt(0)===239&&o.charCodeAt(1)===187&&o.charCodeAt(2)===191&&(o=o.slice(3))),c.length===0){const h=P(o);h!==""&&(c.push(h),d=h.length),T();return}if(o.indexOf(`
4
4
  `)===-1&&o.indexOf("\r")===-1){c.push(o),d+=o.length,T();return}c.push(o);const y=c.join("");c.length=0,d=0;const f=P(y);f!==""&&(c.push(f),d=f.length),T()}function T(){l!==void 0&&(d+i.length<=l||(b=!0,c.length=0,d=0,g=void 0,i="",u=0,m=void 0,s(new St(`Buffered data exceeded max buffer size of ${l} characters`,{type:"max-buffer-size-exceeded"}))))}function P(o){let y=0;if(o.indexOf("\r")===-1){let f=o.indexOf(`
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { safeParseAsync as jn, lazy as Ln, unknown as $n, union as kn, string as
9
9
  import { toJSONSchema as Xn } from "zod/v4/core";
10
10
  import "react/jsx-runtime";
11
11
  import { z as D } from "zod";
12
- const es = "5.6.0";
12
+ const es = "5.7.0";
13
13
  function H(t) {
14
14
  return $t(t.subscribe, t.get, t.get);
15
15
  }
@@ -1,7 +1,7 @@
1
1
  declare const _default: {
2
2
  "name": "@opencx/widget-react-headless",
3
3
  "private": false,
4
- "version": "5.6.0",
4
+ "version": "5.7.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@opencx/widget-react-headless",
3
3
  "private": false,
4
- "version": "5.6.0",
4
+ "version": "5.7.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "uuid": "^11.0.4",
22
22
  "zod": "^4.3.6",
23
- "@opencx/widget-core": "5.6.0"
23
+ "@opencx/widget-core": "5.7.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@types/react": ">=18 <20",