@opencx/widget-react-headless 5.4.3 → 5.5.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 qt=(t,e,s)=>e.has(t)||zt("Cannot "+s);var q=(t,e,s)=>(qt(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)=>(qt(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"),Z=require("@opencx/widget-core"),H=require("zod/v4"),pr=require("zod/v4/core");require("react/jsx-runtime");const D=require("zod"),fr="5.4.3";function W(t){return p.useSyncExternalStore(t.subscribe,t.get,t.get)}function mr({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?gr(n):null}function gr(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 ps="vercel.ai.error",hr=Symbol.for(ps);var G=class fs extends Error{constructor({name:e,message:s,cause:r}){super(s),this[hr]=!0,this.name=e,this.cause=r}static isInstance(e){return fs.hasMarker(e,ps)}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 ms="AI_APICallError",gs=`vercel.ai.error.${ms}`,yr=Symbol.for(gs);var vr=class extends G{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:ms,message:t,cause:c}),this[yr]=!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 G.hasMarker(t,gs)}};const hs="AI_EmptyResponseBodyError",ys=`vercel.ai.error.${hs}`,br=Symbol.for(ys);var Zt=class extends G{constructor({message:t="Empty response body"}={}){super({name:hs,message:t}),this[br]=!0}static isInstance(t){return G.hasMarker(t,ys)}};function vs(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.toString():JSON.stringify(t)}const bs="AI_InvalidArgumentError",Ss=`vercel.ai.error.${bs}`,Sr=Symbol.for(Ss);var Cr=class extends G{constructor({message:e,cause:s,argument:r}){super({name:bs,message:e,cause:s}),this[Sr]=!0,this.argument=r}static isInstance(e){return G.hasMarker(e,Ss)}};const Cs="AI_JSONParseError",Es=`vercel.ai.error.${Cs}`,Er=Symbol.for(Es);var Vt=class extends G{constructor({text:t,cause:e}){super({name:Cs,message:`JSON parsing failed: Text: ${t}.
1
+ "use strict";var zt=t=>{throw TypeError(t)};var qt=(t,e,s)=>e.has(t)||zt("Cannot "+s);var q=(t,e,s)=>(qt(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)=>(qt(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"),Z=require("@opencx/widget-core"),H=require("zod/v4"),pr=require("zod/v4/core");require("react/jsx-runtime");const D=require("zod"),fr="5.5.0";function W(t){return p.useSyncExternalStore(t.subscribe,t.get,t.get)}function mr({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?gr(n):null}function gr(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 ps="vercel.ai.error",hr=Symbol.for(ps);var G=class fs extends Error{constructor({name:e,message:s,cause:r}){super(s),this[hr]=!0,this.name=e,this.cause=r}static isInstance(e){return fs.hasMarker(e,ps)}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 ms="AI_APICallError",gs=`vercel.ai.error.${ms}`,yr=Symbol.for(gs);var vr=class extends G{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:ms,message:t,cause:c}),this[yr]=!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 G.hasMarker(t,gs)}};const hs="AI_EmptyResponseBodyError",ys=`vercel.ai.error.${hs}`,br=Symbol.for(ys);var Zt=class extends G{constructor({message:t="Empty response body"}={}){super({name:hs,message:t}),this[br]=!0}static isInstance(t){return G.hasMarker(t,ys)}};function vs(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.toString():JSON.stringify(t)}const bs="AI_InvalidArgumentError",Ss=`vercel.ai.error.${bs}`,Sr=Symbol.for(Ss);var Cr=class extends G{constructor({message:e,cause:s,argument:r}){super({name:bs,message:e,cause:s}),this[Sr]=!0,this.argument=r}static isInstance(e){return G.hasMarker(e,Ss)}};const Cs="AI_JSONParseError",Es=`vercel.ai.error.${Cs}`,Er=Symbol.for(Es);var Vt=class extends G{constructor({text:t,cause:e}){super({name:Cs,message:`JSON parsing failed: Text: ${t}.
2
2
  Error message: ${vs(e)}`,cause:e}),this[Er]=!0,this.text=t}static isInstance(t){return G.hasMarker(t,Es)}};const Is="AI_TypeValidationError",As=`vercel.ai.error.${Is}`,Ir=Symbol.for(As);var rt=class At extends G{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:Is,message:`${n}: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${vs(s)}`,cause:s}),this[Ir]=!0,this.value=e,this.context=r}static isInstance(e){return G.hasMarker(e,As)}static wrap({value:e,cause:s,context:r}){var n,l,c;return At.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 At({value:e,cause:s,context:r})}};const ws="AI_UnsupportedFunctionalityError",xs=`vercel.ai.error.${ws}`,Ar=Symbol.for(xs);var wr=class extends G{constructor({functionality:t,message:e=`'${t}' functionality not supported.`}){super({name:ws,message:e}),this[Ar]=!0,this.functionality=t}static isInstance(t){return G.hasMarker(t,xs)}};class vt 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 Wt=10,xr=13,Ae=32;function bt(t){}function Mr(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=bt,onError:s=bt,onRetry:r=bt,onComment:n,maxBufferSize:l}=t,c=[];let d=0,v=!0,h,i="",u=0,m,b=!1;function _(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 g=M(o);g!==""&&(c.push(g),d=g.length),w();return}if(o.indexOf(`
4
4
  `)===-1&&o.indexOf("\r")===-1){c.push(o),d+=o.length,w();return}c.push(o);const y=c.join("");c.length=0,d=0;const f=M(y);f!==""&&(c.push(f),d=f.length),w()}function w(){l!==void 0&&(d+i.length<=l||(b=!0,c.length=0,d=0,h=void 0,i="",u=0,m=void 0,s(new vt(`Buffered data exceeded max buffer size of ${l} characters`,{type:"max-buffer-size-exceeded"}))))}function M(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 On, lazy as Nn, unknown as Dn, union as jn, string as
9
9
  import { toJSONSchema as Yn } from "zod/v4/core";
10
10
  import "react/jsx-runtime";
11
11
  import { z as D } from "zod";
12
- const Gn = "5.4.3";
12
+ const Gn = "5.5.0";
13
13
  function H(t) {
14
14
  return jt(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.4.3",
4
+ "version": "5.5.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.4.3",
4
+ "version": "5.5.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.4.3"
23
+ "@opencx/widget-core": "5.5.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@types/react": ">=18 <20",