@opencx/widget-react-headless 5.12.0 → 5.13.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 Gt=t=>{throw TypeError(t)};var Qt=(t,e,n)=>e.has(t)||Gt("Cannot "+n);var Z=(t,e,n)=>(Qt(t,e,"read from private field"),n?n.call(t):e.get(t)),de=(t,e,n)=>e.has(t)?Gt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),K=(t,e,n,s)=>(Qt(t,e,"write to private field"),s?s.call(t,n):e.set(t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),F=require("@opencx/widget-core"),Y=require("zod/v4"),Rs=require("zod/v4/core");require("react/jsx-runtime");const D=require("zod"),wn="5.12.0";function B(t){return p.useSyncExternalStore(t.subscribe,t.get,t.get)}function _s({turnSources:t,liveItems:e,isStreaming:n,lastMessageIsFromUser:s}){var o;if(n||s)return null;const r=e.length>0?e:(o=t.at(-1))==null?void 0:o.items;return r?Ps(r):null}function Ps(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if((n==null?void 0:n.kind)==="questions")return n.request}return null}const An="vercel.ai.error",Os=Symbol.for(An);var Q=class xn extends Error{constructor({name:e,message:n,cause:s}){super(n),this[Os]=!0,this.name=e,this.cause=s}static isInstance(e){return xn.hasMarker(e,An)}static hasMarker(e,n){const s=Symbol.for(n);return e!=null&&typeof e=="object"&&s in e&&typeof e[s]=="boolean"&&e[s]===!0}};const Tn="AI_APICallError",Mn=`vercel.ai.error.${Tn}`,Ns=Symbol.for(Mn);var Rn=class extends Q{constructor({message:t,url:e,requestBodyValues:n,statusCode:s,responseHeaders:r,responseBody:o,cause:l,isRetryable:u=s!=null&&(s===408||s===409||s===429||s>=500),data:v}){super({name:Tn,message:t,cause:l}),this[Ns]=!0,this.url=e,this.requestBodyValues=n,this.statusCode=s,this.responseHeaders=r,this.responseBody=o,this.isRetryable=u,this.data=v}static isInstance(t){return Q.hasMarker(t,Mn)}};const _n="AI_EmptyResponseBodyError",Pn=`vercel.ai.error.${_n}`,ks=Symbol.for(Pn);var ct=class extends Q{constructor({message:t="Empty response body"}={}){super({name:_n,message:t}),this[ks]=!0}static isInstance(t){return Q.hasMarker(t,Pn)}};function On(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.toString():JSON.stringify(t)}const Nn="AI_InvalidArgumentError",kn=`vercel.ai.error.${Nn}`,Ds=Symbol.for(kn);var Ls=class extends Q{constructor({message:e,cause:n,argument:s}){super({name:Nn,message:e,cause:n}),this[Ds]=!0,this.argument=s}static isInstance(e){return Q.hasMarker(e,kn)}};const Dn="AI_JSONParseError",Ln=`vercel.ai.error.${Dn}`,js=Symbol.for(Ln);var Xt=class extends Q{constructor({text:t,cause:e}){super({name:Dn,message:`JSON parsing failed: Text: ${t}.
1
+ "use strict";var Gt=t=>{throw TypeError(t)};var Qt=(t,e,n)=>e.has(t)||Gt("Cannot "+n);var Z=(t,e,n)=>(Qt(t,e,"read from private field"),n?n.call(t):e.get(t)),de=(t,e,n)=>e.has(t)?Gt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),K=(t,e,n,s)=>(Qt(t,e,"write to private field"),s?s.call(t,n):e.set(t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),F=require("@opencx/widget-core"),Y=require("zod/v4"),Rs=require("zod/v4/core");require("react/jsx-runtime");const D=require("zod"),wn="5.13.0";function B(t){return p.useSyncExternalStore(t.subscribe,t.get,t.get)}function _s({turnSources:t,liveItems:e,isStreaming:n,lastMessageIsFromUser:s}){var o;if(n||s)return null;const r=e.length>0?e:(o=t.at(-1))==null?void 0:o.items;return r?Ps(r):null}function Ps(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if((n==null?void 0:n.kind)==="questions")return n.request}return null}const An="vercel.ai.error",Os=Symbol.for(An);var Q=class xn extends Error{constructor({name:e,message:n,cause:s}){super(n),this[Os]=!0,this.name=e,this.cause=s}static isInstance(e){return xn.hasMarker(e,An)}static hasMarker(e,n){const s=Symbol.for(n);return e!=null&&typeof e=="object"&&s in e&&typeof e[s]=="boolean"&&e[s]===!0}};const Tn="AI_APICallError",Mn=`vercel.ai.error.${Tn}`,Ns=Symbol.for(Mn);var Rn=class extends Q{constructor({message:t,url:e,requestBodyValues:n,statusCode:s,responseHeaders:r,responseBody:o,cause:l,isRetryable:u=s!=null&&(s===408||s===409||s===429||s>=500),data:v}){super({name:Tn,message:t,cause:l}),this[Ns]=!0,this.url=e,this.requestBodyValues=n,this.statusCode=s,this.responseHeaders=r,this.responseBody=o,this.isRetryable=u,this.data=v}static isInstance(t){return Q.hasMarker(t,Mn)}};const _n="AI_EmptyResponseBodyError",Pn=`vercel.ai.error.${_n}`,ks=Symbol.for(Pn);var ct=class extends Q{constructor({message:t="Empty response body"}={}){super({name:_n,message:t}),this[ks]=!0}static isInstance(t){return Q.hasMarker(t,Pn)}};function On(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.toString():JSON.stringify(t)}const Nn="AI_InvalidArgumentError",kn=`vercel.ai.error.${Nn}`,Ds=Symbol.for(kn);var Ls=class extends Q{constructor({message:e,cause:n,argument:s}){super({name:Nn,message:e,cause:n}),this[Ds]=!0,this.argument=s}static isInstance(e){return Q.hasMarker(e,kn)}};const Dn="AI_JSONParseError",Ln=`vercel.ai.error.${Dn}`,js=Symbol.for(Ln);var Xt=class extends Q{constructor({text:t,cause:e}){super({name:Dn,message:`JSON parsing failed: Text: ${t}.
2
2
  Error message: ${On(e)}`,cause:e}),this[js]=!0,this.text=t}static isInstance(t){return Q.hasMarker(t,Ln)}};const jn="AI_TypeValidationError",$n=`vercel.ai.error.${jn}`,$s=Symbol.for($n);var ut=class Pt extends Q{constructor({value:e,cause:n,context:s}){let r="Type validation failed";if(s!=null&&s.field&&(r+=` for ${s.field}`),s!=null&&s.entityName||s!=null&&s.entityId){r+=" (";const o=[];s.entityName&&o.push(s.entityName),s.entityId&&o.push(`id: "${s.entityId}"`),r+=o.join(", "),r+=")"}super({name:jn,message:`${r}: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${On(n)}`,cause:n}),this[$s]=!0,this.value=e,this.context=s}static isInstance(e){return Q.hasMarker(e,$n)}static wrap({value:e,cause:n,context:s}){var r,o,l;return Pt.isInstance(n)&&n.value===e&&((r=n.context)==null?void 0:r.field)===(s==null?void 0:s.field)&&((o=n.context)==null?void 0:o.entityName)===(s==null?void 0:s.entityName)&&((l=n.context)==null?void 0:l.entityId)===(s==null?void 0:s.entityId)?n:new Pt({value:e,cause:n,context:s})}};const Fn="AI_UnsupportedFunctionalityError",Un=`vercel.ai.error.${Fn}`,Fs=Symbol.for(Un);var Us=class extends Q{constructor({functionality:t,message:e=`'${t}' functionality not supported.`}){super({name:Fn,message:e}),this[Fs]=!0,this.functionality=t}static isInstance(t){return Q.hasMarker(t,Un)}};class At extends Error{constructor(e,n){super(e),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}const en=10,zs=13,Me=32;function xt(t){}function qs(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=xt,onError:n=xt,onRetry:s=xt,onComment:r,maxBufferSize:o}=t,l=[];let u=0,v=!0,h,i="",d=0,f,S=!1;function P(c){if(S)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,c.charCodeAt(0)===239&&c.charCodeAt(1)===187&&c.charCodeAt(2)===191&&(c=c.slice(3))),l.length===0){const y=O(c);y!==""&&(l.push(y),u=y.length),R();return}if(c.indexOf(`
4
4
  `)===-1&&c.indexOf("\r")===-1){l.push(c),u+=c.length,R();return}l.push(c);const g=l.join("");l.length=0,u=0;const m=O(g);m!==""&&(l.push(m),u=m.length),R()}function R(){o!==void 0&&(u+i.length<=o||(S=!0,l.length=0,u=0,h=void 0,i="",d=0,f=void 0,n(new At(`Buffered data exceeded max buffer size of ${o} characters`,{type:"max-buffer-size-exceeded"}))))}function O(c){let g=0;if(c.indexOf("\r")===-1){let m=c.indexOf(`
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { safeParseAsync as Yr, lazy as Kr, unknown as Gr, union as Qr, string as
9
9
  import { toJSONSchema as fs } from "zod/v4/core";
10
10
  import "react/jsx-runtime";
11
11
  import { z as L } from "zod";
12
- const Pn = "5.12.0";
12
+ const Pn = "5.13.0";
13
13
  function K(t) {
14
14
  return zt(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.12.0",
4
+ "version": "5.13.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "rm -rf node_modules dist .turbo",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@opencx/widget-react-headless",
3
3
  "private": false,
4
- "version": "5.12.0",
4
+ "version": "5.13.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "uuid": "^11.0.4",
18
18
  "zod": "^4.6.7",
19
- "@opencx/widget-core": "5.12.0"
19
+ "@opencx/widget-core": "5.13.0"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "@types/react": ">=18 <20",