@runtypelabs/persona 4.26.0 → 4.26.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.
Files changed (48) hide show
  1. package/dist/approval-ui.d.cts +6 -0
  2. package/dist/approval-ui.d.ts +6 -0
  3. package/dist/artifacts-ui.d.cts +6 -0
  4. package/dist/artifacts-ui.d.ts +6 -0
  5. package/dist/chunk-GKPCIQPB.js +1 -0
  6. package/dist/{client-history-YPEG45Q4.js → client-history-GOZWBDA5.js} +1 -1
  7. package/dist/client-history.js +1 -1
  8. package/dist/codegen.cjs +1 -1
  9. package/dist/codegen.js +1 -1
  10. package/dist/context-mentions.d.cts +6 -0
  11. package/dist/context-mentions.d.ts +6 -0
  12. package/dist/event-stream-view.d.cts +6 -0
  13. package/dist/event-stream-view.d.ts +6 -0
  14. package/dist/forms-ui.d.cts +6 -0
  15. package/dist/forms-ui.d.ts +6 -0
  16. package/dist/index.cjs +7 -7
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +6 -0
  19. package/dist/index.d.ts +6 -0
  20. package/dist/index.global.js +1 -1
  21. package/dist/index.global.js.map +1 -1
  22. package/dist/index.js +7 -7
  23. package/dist/index.js.map +1 -1
  24. package/dist/session-reconnect.d.cts +6 -0
  25. package/dist/session-reconnect.d.ts +6 -0
  26. package/dist/smart-dom-reader.d.cts +6 -0
  27. package/dist/smart-dom-reader.d.ts +6 -0
  28. package/dist/theme-editor-preview.cjs +14 -14
  29. package/dist/theme-editor-preview.d.cts +6 -0
  30. package/dist/theme-editor-preview.d.ts +6 -0
  31. package/dist/theme-editor-preview.js +5 -5
  32. package/dist/theme-editor.d.cts +6 -0
  33. package/dist/theme-editor.d.ts +6 -0
  34. package/dist/voice-runtime-XLU6YK2N.js +17 -0
  35. package/dist/voice-runtime.cjs +3 -3
  36. package/dist/voice-runtime.d.cts +6 -0
  37. package/dist/voice-runtime.d.ts +6 -0
  38. package/dist/voice-runtime.js +3 -3
  39. package/package.json +1 -1
  40. package/src/approval-paused-tool-settle.test.ts +108 -4
  41. package/src/session.ts +51 -10
  42. package/src/session.voice.test.ts +1 -0
  43. package/src/types.ts +6 -0
  44. package/src/voice/runtype-voice-provider.ts +19 -9
  45. package/src/voice/voice-delegation.ts +1 -1
  46. package/src/voice/voice.test.ts +81 -2
  47. package/dist/chunk-QPPJUSZH.js +0 -1
  48. package/dist/voice-runtime-UOQOFAFY.js +0 -17
@@ -7144,6 +7144,12 @@ type VoiceDelegationResult = {
7144
7144
  status: VoiceDelegationStatus;
7145
7145
  /** The assistant text (Markdown allowed). */
7146
7146
  text: string;
7147
+ /**
7148
+ * `false` when no chat message carries this answer (it is only spoken), so
7149
+ * the voice model's read-back of it stays visible as a caption.
7150
+ * @default true
7151
+ */
7152
+ inChat?: boolean;
7147
7153
  /**
7148
7154
  * Set when the turn parked on approvals (`text` then asks for the decision).
7149
7155
  * Resolves with the terminal result once the visitor decides (or the
@@ -7144,6 +7144,12 @@ type VoiceDelegationResult = {
7144
7144
  status: VoiceDelegationStatus;
7145
7145
  /** The assistant text (Markdown allowed). */
7146
7146
  text: string;
7147
+ /**
7148
+ * `false` when no chat message carries this answer (it is only spoken), so
7149
+ * the voice model's read-back of it stays visible as a caption.
7150
+ * @default true
7151
+ */
7152
+ inChat?: boolean;
7147
7153
  /**
7148
7154
  * Set when the turn parked on approvals (`text` then asks for the decision).
7149
7155
  * Resolves with the terminal result once the visitor decides (or the
@@ -7146,6 +7146,12 @@ type VoiceDelegationResult = {
7146
7146
  status: VoiceDelegationStatus;
7147
7147
  /** The assistant text (Markdown allowed). */
7148
7148
  text: string;
7149
+ /**
7150
+ * `false` when no chat message carries this answer (it is only spoken), so
7151
+ * the voice model's read-back of it stays visible as a caption.
7152
+ * @default true
7153
+ */
7154
+ inChat?: boolean;
7149
7155
  /**
7150
7156
  * Set when the turn parked on approvals (`text` then asks for the decision).
7151
7157
  * Resolves with the terminal result once the visitor decides (or the
@@ -7146,6 +7146,12 @@ type VoiceDelegationResult = {
7146
7146
  status: VoiceDelegationStatus;
7147
7147
  /** The assistant text (Markdown allowed). */
7148
7148
  text: string;
7149
+ /**
7150
+ * `false` when no chat message carries this answer (it is only spoken), so
7151
+ * the voice model's read-back of it stays visible as a caption.
7152
+ * @default true
7153
+ */
7154
+ inChat?: boolean;
7149
7155
  /**
7150
7156
  * Set when the turn parked on approvals (`text` then asks for the decision).
7151
7157
  * Resolves with the terminal result once the visitor decides (or the
@@ -0,0 +1 @@
1
+ var t="4.26.1";var n=t;export{n as a};
@@ -1 +1 @@
1
- import{a as g}from"./chunk-QPPJUSZH.js";var H=32768,c=49152,p=t=>{let e=t??{},i=typeof e.targetId=="string"?e.targetId:null;return{id:typeof e.id=="string"?e.id:"",title:typeof e.title=="string"?e.title:"",targetId:i,preview:typeof e.preview=="string"?e.preview:null,messageCount:typeof e.messageCount=="number"?e.messageCount:0,createdAt:typeof e.createdAt=="string"?e.createdAt:"",updatedAt:typeof e.updatedAt=="string"?e.updatedAt:""}},v="The identity proof was not admitted; account history is unavailable",m="The identity proof was rejected",C="The request carried no visitor credential",w="The stored visitor belongs to a different signed-in user";function E(t,e,i){let r=new URLSearchParams;for(let[n,s]of Object.entries(i))s===void 0||s===""||r.set(n,String(s));let o=r.toString();return`${t.clientApiBase()}/v1/client/${e}${o?`?${o}`:""}`}function b(t,e){if(e)return e;let i=t.config.features?.history?.scope;return i||(t.config.getIdentityProof?"verified-user":"browser")}async function T(t,e,i){let r=t.config.getIdentityProof;if(!r)return i&&t.setHistoryIdentityStatus(t.browserOnlyStatus()),null;i&&t.setHistoryIdentityStatus({state:"verifying"});let o;try{o=await r()??null}catch{throw i&&t.setHistoryIdentityStatus({state:"identity_provider_failed"}),new t.HistoryClientError("identity_provider_failed","The identity proof provider failed")}if(o)return o;if(e.visitor?.endUserId!=null)throw i&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"proof_unavailable_after_binding"}),new t.HistoryClientError("authentication_required","This browser is bound to a signed-in user and needs a fresh identity proof");return i&&t.setHistoryIdentityStatus({state:"browser_only",reason:"proof_unavailable_before_binding"}),null}async function P(t,e,i,r){if(e.visitor?.endUserId!=null)return e;let o=await t.reinitWithProof(i);if(!(o.visitor?.identityStatus==="admitted"&&o.visitor?.endUserId!=null))throw r&&t.setHistoryIdentityStatus({state:"configuration_error",reason:"proof_not_admitted"}),new t.HistoryClientError("proof_not_admitted",v);return o}async function _(t,e){let i=await e.json().catch(()=>({}));return typeof i.error=="string"?i.error:typeof i.message=="string"?i.message:""}async function A(t,e,i,r){let o=e.toLowerCase();if(o.includes("invalid_identity_proof"))throw r&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"invalid_identity_proof"}),new t.HistoryClientError("invalid_identity_proof",m);if(o.includes("visitor token required"))throw new t.HistoryClientError("visitor_token_missing",C);if(o.includes("visitor_identity_mismatch")){if(!i)throw r&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"proof_unavailable_after_binding"}),new t.HistoryClientError("visitor_identity_mismatch",w);return t.reinitWithProof(i)}if(o.includes("expired")||o.includes("not found"))return t.clearClientSession(),t.initSession();throw new t.HistoryClientError("unauthorized",e||"History request was not authorized")}async function h(t,e,i){let r=await _(t,e);if(e.status===404)return new t.HistoryClientError("not_found","Conversation not found");if(e.status===429){let o=Number.parseInt(e.headers.get("Retry-After")??"",10);return new t.HistoryClientError("rate_limited","Too many history requests",{...Number.isFinite(o)?{retryAfterSeconds:o}:{}})}if(e.status===503&&r.includes("identity_proof_not_admitted"))return i&&t.setHistoryIdentityStatus({state:"configuration_error",reason:"proof_not_admitted"}),new t.HistoryClientError("proof_not_admitted",v);if(e.status===401){let o=r.toLowerCase();return o.includes("invalid_identity_proof")?(i&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"invalid_identity_proof"}),new t.HistoryClientError("invalid_identity_proof",m)):o.includes("visitor token required")?new t.HistoryClientError("visitor_token_missing",C):o.includes("visitor_identity_mismatch")?new t.HistoryClientError("visitor_identity_mismatch",w):new t.HistoryClientError("unauthorized",r||"History request was not authorized")}return new t.HistoryClientError("request_failed",r||`History request failed (${e.status})`)}function R(t,e,i,r){let o=e?.toLowerCase()??null;if(i){if(o==="admitted"){r&&t.setHistoryIdentityStatus({state:"verified"});return}throw r&&t.setHistoryIdentityStatus({state:"configuration_error",reason:"proof_not_admitted"}),o==="ignored"?new t.HistoryClientError("identity_contract_violation","Server reported an ignored identity proof on a success response"):new t.HistoryClientError("proof_not_admitted","The response did not acknowledge the identity proof this request sent")}if(o==="admitted")throw new t.HistoryClientError("identity_contract_violation","Server admitted an identity proof that was never sent");r&&t.setHistoryIdentityStatus(t.browserOnlyStatus())}async function y(t,e,i){f(t);let r=i.trackIdentity!==!1,o=await t.initSession(),n=null;b(t,i.scope)==="verified-user"&&(n=await T(t,o,r),n&&(o=await P(t,o,n,r)));let s=t.historyInternals.visitorStore,a=!1;for(;;){let u=s?.revision()??0,d=await t.readVisitorToken();if(!d&&!i.visitorTokenOptional)throw new t.HistoryClientError("visitor_token_missing","No visitor credential is stored for this browser");let l=await fetch(E(t,e,{...i.query,sessionId:o.sessionId}),{method:i.method,headers:{"X-Persona-Version":g,...d?{"X-Visitor-Token":d}:{},...n?{"X-Identity-Proof":n}:{},...i.body!==void 0?{"Content-Type":"application/json"}:{}},...i.body!==void 0?{body:JSON.stringify(i.body)}:{},...i.keepalive?{keepalive:!0}:{}});if(l.status===401&&!a){a=!0,o=await A(t,await _(t,l),n,r);continue}if(!l.ok)throw await h(t,l,r);let S=l.headers.get("X-History-Identity-Status"),I=await l.json().catch(()=>{});if(s&&s.revision()!==u)throw new t.HistoryClientError("credential_changed","The visitor credential changed while the request was in flight");return R(t,S,n!==null,r),I}}function f(t){if(!t.isClientTokenMode())throw new Error("Conversation history is only available in client token mode");if(!t.isHistoryCapable())throw new t.HistoryClientError("history_disabled","Visitor history is disabled for this surface")}async function O(t,e){let i=await y(t,"conversations",{method:"GET",query:{...e?.cursor?{cursor:e.cursor}:{},...e?.limit!==void 0?{limit:e.limit}:{},...e?.targetId?{targetId:e.targetId}:{}},...e?.scope?{scope:e.scope}:{}});return{data:(Array.isArray(i?.data)?i.data:[]).map(p),nextCursor:typeof i?.nextCursor=="string"?i.nextCursor:null}}async function x(t,e,i){let r=await y(t,`conversations/${encodeURIComponent(e)}`,{method:"GET",query:{...i?.messageCursor?{messageCursor:i.messageCursor}:{}},...i?.scope?{scope:i.scope}:{}});return{summary:p(r),messages:Array.isArray(r?.messages)?r.messages:[],nextMessageCursor:typeof r?.nextMessageCursor=="string"?r.nextMessageCursor:null,conversationRevision:typeof r?.conversationRevision=="string"?r.conversationRevision:null}}async function q(t,e,i){f(t);let r=0;for(let u of i){let d=u.displayContent.length;if(d>H)throw new t.HistoryClientError("payload_too_large",`displayContent exceeds the ${H} character limit`);r+=d}if(r>c)throw new t.HistoryClientError("payload_too_large",`Display projection batch exceeds the ${c} character limit`);await t.initSession();let o=t.historyInternals.visitorStore,n=o?.revision()??0,s=await y(t,`conversations/${encodeURIComponent(e)}/display-projections`,{method:"PATCH",body:{messages:i},scope:"browser",keepalive:r<=c,trackIdentity:!1}),a=typeof s?.conversationRevision=="string"?s.conversationRevision:null;return a&&t.clientSession?.conversationId===e&&(o?.revision()??0)===n&&t.historyInternals.setStoredConversationRevision?.(a),{conversationRevision:a}}async function D(t,e,i){let r=await y(t,`conversations/${encodeURIComponent(e)}`,{method:"DELETE",...i?.scope?{scope:i.scope}:{}});return{deleted:typeof r?.deleted=="number"?r.deleted:0}}async function M(t,e){let i=await y(t,"conversations",{method:"DELETE",query:{...e?.targetId!==void 0?{targetId:e.targetId}:{}},...e?.scope?{scope:e.scope}:{}});return{deleted:typeof i?.deleted=="number"?i.deleted:0}}async function N(t){f(t),t.setHistoryIdentityStatus({state:"resetting"});try{await y(t,"visitor/reset",{method:"POST",scope:"browser",visitorTokenOptional:!0})}finally{await t.historyInternals.visitorStore?.clear(),t.setHistoryIdentityStatus(t.derivedBrowserOnly())}return{reset:!0}}export{M as deleteAllConversations,D as deleteConversation,q as finalizeDisplayProjections,x as getConversation,h as historyErrorFor,O as listConversations,_ as readErrorCode,A as recoverFromUnauthorized,N as resetVisitor};
1
+ import{a as g}from"./chunk-GKPCIQPB.js";var H=32768,c=49152,p=t=>{let e=t??{},i=typeof e.targetId=="string"?e.targetId:null;return{id:typeof e.id=="string"?e.id:"",title:typeof e.title=="string"?e.title:"",targetId:i,preview:typeof e.preview=="string"?e.preview:null,messageCount:typeof e.messageCount=="number"?e.messageCount:0,createdAt:typeof e.createdAt=="string"?e.createdAt:"",updatedAt:typeof e.updatedAt=="string"?e.updatedAt:""}},v="The identity proof was not admitted; account history is unavailable",m="The identity proof was rejected",C="The request carried no visitor credential",w="The stored visitor belongs to a different signed-in user";function E(t,e,i){let r=new URLSearchParams;for(let[n,s]of Object.entries(i))s===void 0||s===""||r.set(n,String(s));let o=r.toString();return`${t.clientApiBase()}/v1/client/${e}${o?`?${o}`:""}`}function b(t,e){if(e)return e;let i=t.config.features?.history?.scope;return i||(t.config.getIdentityProof?"verified-user":"browser")}async function T(t,e,i){let r=t.config.getIdentityProof;if(!r)return i&&t.setHistoryIdentityStatus(t.browserOnlyStatus()),null;i&&t.setHistoryIdentityStatus({state:"verifying"});let o;try{o=await r()??null}catch{throw i&&t.setHistoryIdentityStatus({state:"identity_provider_failed"}),new t.HistoryClientError("identity_provider_failed","The identity proof provider failed")}if(o)return o;if(e.visitor?.endUserId!=null)throw i&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"proof_unavailable_after_binding"}),new t.HistoryClientError("authentication_required","This browser is bound to a signed-in user and needs a fresh identity proof");return i&&t.setHistoryIdentityStatus({state:"browser_only",reason:"proof_unavailable_before_binding"}),null}async function P(t,e,i,r){if(e.visitor?.endUserId!=null)return e;let o=await t.reinitWithProof(i);if(!(o.visitor?.identityStatus==="admitted"&&o.visitor?.endUserId!=null))throw r&&t.setHistoryIdentityStatus({state:"configuration_error",reason:"proof_not_admitted"}),new t.HistoryClientError("proof_not_admitted",v);return o}async function _(t,e){let i=await e.json().catch(()=>({}));return typeof i.error=="string"?i.error:typeof i.message=="string"?i.message:""}async function A(t,e,i,r){let o=e.toLowerCase();if(o.includes("invalid_identity_proof"))throw r&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"invalid_identity_proof"}),new t.HistoryClientError("invalid_identity_proof",m);if(o.includes("visitor token required"))throw new t.HistoryClientError("visitor_token_missing",C);if(o.includes("visitor_identity_mismatch")){if(!i)throw r&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"proof_unavailable_after_binding"}),new t.HistoryClientError("visitor_identity_mismatch",w);return t.reinitWithProof(i)}if(o.includes("expired")||o.includes("not found"))return t.clearClientSession(),t.initSession();throw new t.HistoryClientError("unauthorized",e||"History request was not authorized")}async function h(t,e,i){let r=await _(t,e);if(e.status===404)return new t.HistoryClientError("not_found","Conversation not found");if(e.status===429){let o=Number.parseInt(e.headers.get("Retry-After")??"",10);return new t.HistoryClientError("rate_limited","Too many history requests",{...Number.isFinite(o)?{retryAfterSeconds:o}:{}})}if(e.status===503&&r.includes("identity_proof_not_admitted"))return i&&t.setHistoryIdentityStatus({state:"configuration_error",reason:"proof_not_admitted"}),new t.HistoryClientError("proof_not_admitted",v);if(e.status===401){let o=r.toLowerCase();return o.includes("invalid_identity_proof")?(i&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"invalid_identity_proof"}),new t.HistoryClientError("invalid_identity_proof",m)):o.includes("visitor token required")?new t.HistoryClientError("visitor_token_missing",C):o.includes("visitor_identity_mismatch")?new t.HistoryClientError("visitor_identity_mismatch",w):new t.HistoryClientError("unauthorized",r||"History request was not authorized")}return new t.HistoryClientError("request_failed",r||`History request failed (${e.status})`)}function R(t,e,i,r){let o=e?.toLowerCase()??null;if(i){if(o==="admitted"){r&&t.setHistoryIdentityStatus({state:"verified"});return}throw r&&t.setHistoryIdentityStatus({state:"configuration_error",reason:"proof_not_admitted"}),o==="ignored"?new t.HistoryClientError("identity_contract_violation","Server reported an ignored identity proof on a success response"):new t.HistoryClientError("proof_not_admitted","The response did not acknowledge the identity proof this request sent")}if(o==="admitted")throw new t.HistoryClientError("identity_contract_violation","Server admitted an identity proof that was never sent");r&&t.setHistoryIdentityStatus(t.browserOnlyStatus())}async function y(t,e,i){f(t);let r=i.trackIdentity!==!1,o=await t.initSession(),n=null;b(t,i.scope)==="verified-user"&&(n=await T(t,o,r),n&&(o=await P(t,o,n,r)));let s=t.historyInternals.visitorStore,a=!1;for(;;){let u=s?.revision()??0,d=await t.readVisitorToken();if(!d&&!i.visitorTokenOptional)throw new t.HistoryClientError("visitor_token_missing","No visitor credential is stored for this browser");let l=await fetch(E(t,e,{...i.query,sessionId:o.sessionId}),{method:i.method,headers:{"X-Persona-Version":g,...d?{"X-Visitor-Token":d}:{},...n?{"X-Identity-Proof":n}:{},...i.body!==void 0?{"Content-Type":"application/json"}:{}},...i.body!==void 0?{body:JSON.stringify(i.body)}:{},...i.keepalive?{keepalive:!0}:{}});if(l.status===401&&!a){a=!0,o=await A(t,await _(t,l),n,r);continue}if(!l.ok)throw await h(t,l,r);let S=l.headers.get("X-History-Identity-Status"),I=await l.json().catch(()=>{});if(s&&s.revision()!==u)throw new t.HistoryClientError("credential_changed","The visitor credential changed while the request was in flight");return R(t,S,n!==null,r),I}}function f(t){if(!t.isClientTokenMode())throw new Error("Conversation history is only available in client token mode");if(!t.isHistoryCapable())throw new t.HistoryClientError("history_disabled","Visitor history is disabled for this surface")}async function O(t,e){let i=await y(t,"conversations",{method:"GET",query:{...e?.cursor?{cursor:e.cursor}:{},...e?.limit!==void 0?{limit:e.limit}:{},...e?.targetId?{targetId:e.targetId}:{}},...e?.scope?{scope:e.scope}:{}});return{data:(Array.isArray(i?.data)?i.data:[]).map(p),nextCursor:typeof i?.nextCursor=="string"?i.nextCursor:null}}async function x(t,e,i){let r=await y(t,`conversations/${encodeURIComponent(e)}`,{method:"GET",query:{...i?.messageCursor?{messageCursor:i.messageCursor}:{}},...i?.scope?{scope:i.scope}:{}});return{summary:p(r),messages:Array.isArray(r?.messages)?r.messages:[],nextMessageCursor:typeof r?.nextMessageCursor=="string"?r.nextMessageCursor:null,conversationRevision:typeof r?.conversationRevision=="string"?r.conversationRevision:null}}async function q(t,e,i){f(t);let r=0;for(let u of i){let d=u.displayContent.length;if(d>H)throw new t.HistoryClientError("payload_too_large",`displayContent exceeds the ${H} character limit`);r+=d}if(r>c)throw new t.HistoryClientError("payload_too_large",`Display projection batch exceeds the ${c} character limit`);await t.initSession();let o=t.historyInternals.visitorStore,n=o?.revision()??0,s=await y(t,`conversations/${encodeURIComponent(e)}/display-projections`,{method:"PATCH",body:{messages:i},scope:"browser",keepalive:r<=c,trackIdentity:!1}),a=typeof s?.conversationRevision=="string"?s.conversationRevision:null;return a&&t.clientSession?.conversationId===e&&(o?.revision()??0)===n&&t.historyInternals.setStoredConversationRevision?.(a),{conversationRevision:a}}async function D(t,e,i){let r=await y(t,`conversations/${encodeURIComponent(e)}`,{method:"DELETE",...i?.scope?{scope:i.scope}:{}});return{deleted:typeof r?.deleted=="number"?r.deleted:0}}async function M(t,e){let i=await y(t,"conversations",{method:"DELETE",query:{...e?.targetId!==void 0?{targetId:e.targetId}:{}},...e?.scope?{scope:e.scope}:{}});return{deleted:typeof i?.deleted=="number"?i.deleted:0}}async function N(t){f(t),t.setHistoryIdentityStatus({state:"resetting"});try{await y(t,"visitor/reset",{method:"POST",scope:"browser",visitorTokenOptional:!0})}finally{await t.historyInternals.visitorStore?.clear(),t.setHistoryIdentityStatus(t.derivedBrowserOnly())}return{reset:!0}}export{M as deleteAllConversations,D as deleteConversation,q as finalizeDisplayProjections,x as getConversation,h as historyErrorFor,O as listConversations,_ as readErrorCode,A as recoverFromUnauthorized,N as resetVisitor};
@@ -1 +1 @@
1
- var y="4.26.0";var f=y;var g=32768,p=49152,b=t=>{let e=t??{},i=typeof e.targetId=="string"?e.targetId:null;return{id:typeof e.id=="string"?e.id:"",title:typeof e.title=="string"?e.title:"",targetId:i,preview:typeof e.preview=="string"?e.preview:null,messageCount:typeof e.messageCount=="number"?e.messageCount:0,createdAt:typeof e.createdAt=="string"?e.createdAt:"",updatedAt:typeof e.updatedAt=="string"?e.updatedAt:""}},v="The identity proof was not admitted; account history is unavailable",w="The identity proof was rejected",H="The request carried no visitor credential",C="The stored visitor belongs to a different signed-in user";function j(t,e,i){let s=new URLSearchParams;for(let[r,o]of Object.entries(i))o===void 0||o===""||s.set(r,String(o));let n=s.toString();return`${t.clientApiBase()}/v1/client/${e}${n?`?${n}`:""}`}function I(t,e){if(e)return e;let i=t.config.features?.history?.scope;return i||(t.config.getIdentityProof?"verified-user":"browser")}async function E(t,e,i){let s=t.config.getIdentityProof;if(!s)return i&&t.setHistoryIdentityStatus(t.browserOnlyStatus()),null;i&&t.setHistoryIdentityStatus({state:"verifying"});let n;try{n=await s()??null}catch{throw i&&t.setHistoryIdentityStatus({state:"identity_provider_failed"}),new t.HistoryClientError("identity_provider_failed","The identity proof provider failed")}if(n)return n;if(e.visitor?.endUserId!=null)throw i&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"proof_unavailable_after_binding"}),new t.HistoryClientError("authentication_required","This browser is bound to a signed-in user and needs a fresh identity proof");return i&&t.setHistoryIdentityStatus({state:"browser_only",reason:"proof_unavailable_before_binding"}),null}async function k(t,e,i,s){if(e.visitor?.endUserId!=null)return e;let n=await t.reinitWithProof(i);if(!(n.visitor?.identityStatus==="admitted"&&n.visitor?.endUserId!=null))throw s&&t.setHistoryIdentityStatus({state:"configuration_error",reason:"proof_not_admitted"}),new t.HistoryClientError("proof_not_admitted",v);return n}async function h(t,e){let i=await e.json().catch(()=>({}));return typeof i.error=="string"?i.error:typeof i.message=="string"?i.message:""}async function T(t,e,i,s){let n=e.toLowerCase();if(n.includes("invalid_identity_proof"))throw s&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"invalid_identity_proof"}),new t.HistoryClientError("invalid_identity_proof",w);if(n.includes("visitor token required"))throw new t.HistoryClientError("visitor_token_missing",H);if(n.includes("visitor_identity_mismatch")){if(!i)throw s&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"proof_unavailable_after_binding"}),new t.HistoryClientError("visitor_identity_mismatch",C);return t.reinitWithProof(i)}if(n.includes("expired")||n.includes("not found"))return t.clearClientSession(),t.initSession();throw new t.HistoryClientError("unauthorized",e||"History request was not authorized")}async function q(t,e,i){let s=await h(t,e);if(e.status===404)return new t.HistoryClientError("not_found","Conversation not found");if(e.status===429){let n=Number.parseInt(e.headers.get("Retry-After")??"",10);return new t.HistoryClientError("rate_limited","Too many history requests",{...Number.isFinite(n)?{retryAfterSeconds:n}:{}})}if(e.status===503&&s.includes("identity_proof_not_admitted"))return i&&t.setHistoryIdentityStatus({state:"configuration_error",reason:"proof_not_admitted"}),new t.HistoryClientError("proof_not_admitted",v);if(e.status===401){let n=s.toLowerCase();return n.includes("invalid_identity_proof")?(i&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"invalid_identity_proof"}),new t.HistoryClientError("invalid_identity_proof",w)):n.includes("visitor token required")?new t.HistoryClientError("visitor_token_missing",H):n.includes("visitor_identity_mismatch")?new t.HistoryClientError("visitor_identity_mismatch",C):new t.HistoryClientError("unauthorized",s||"History request was not authorized")}return new t.HistoryClientError("request_failed",s||`History request failed (${e.status})`)}function P(t,e,i,s){let n=e?.toLowerCase()??null;if(i){if(n==="admitted"){s&&t.setHistoryIdentityStatus({state:"verified"});return}throw s&&t.setHistoryIdentityStatus({state:"configuration_error",reason:"proof_not_admitted"}),n==="ignored"?new t.HistoryClientError("identity_contract_violation","Server reported an ignored identity proof on a success response"):new t.HistoryClientError("proof_not_admitted","The response did not acknowledge the identity proof this request sent")}if(n==="admitted")throw new t.HistoryClientError("identity_contract_violation","Server admitted an identity proof that was never sent");s&&t.setHistoryIdentityStatus(t.browserOnlyStatus())}async function l(t,e,i){m(t);let s=i.trackIdentity!==!1,n=await t.initSession(),r=null;I(t,i.scope)==="verified-user"&&(r=await E(t,n,s),r&&(n=await k(t,n,r,s)));let o=t.historyInternals.visitorStore,a=!1;for(;;){let c=o?.revision()??0,d=await t.readVisitorToken();if(!d&&!i.visitorTokenOptional)throw new t.HistoryClientError("visitor_token_missing","No visitor credential is stored for this browser");let u=await fetch(j(t,e,{...i.query,sessionId:n.sessionId}),{method:i.method,headers:{"X-Persona-Version":f,...d?{"X-Visitor-Token":d}:{},...r?{"X-Identity-Proof":r}:{},...i.body!==void 0?{"Content-Type":"application/json"}:{}},...i.body!==void 0?{body:JSON.stringify(i.body)}:{},...i.keepalive?{keepalive:!0}:{}});if(u.status===401&&!a){a=!0,n=await T(t,await h(t,u),r,s);continue}if(!u.ok)throw await q(t,u,s);let x=u.headers.get("X-History-Identity-Status"),_=await u.json().catch(()=>{});if(o&&o.revision()!==c)throw new t.HistoryClientError("credential_changed","The visitor credential changed while the request was in flight");return P(t,x,r!==null,s),_}}function m(t){if(!t.isClientTokenMode())throw new Error("Conversation history is only available in client token mode");if(!t.isHistoryCapable())throw new t.HistoryClientError("history_disabled","Visitor history is disabled for this surface")}async function z(t,e){let i=await l(t,"conversations",{method:"GET",query:{...e?.cursor?{cursor:e.cursor}:{},...e?.limit!==void 0?{limit:e.limit}:{},...e?.targetId?{targetId:e.targetId}:{}},...e?.scope?{scope:e.scope}:{}});return{data:(Array.isArray(i?.data)?i.data:[]).map(b),nextCursor:typeof i?.nextCursor=="string"?i.nextCursor:null}}async function M(t,e,i){let s=await l(t,`conversations/${encodeURIComponent(e)}`,{method:"GET",query:{...i?.messageCursor?{messageCursor:i.messageCursor}:{}},...i?.scope?{scope:i.scope}:{}});return{summary:b(s),messages:Array.isArray(s?.messages)?s.messages:[],nextMessageCursor:typeof s?.nextMessageCursor=="string"?s.nextMessageCursor:null,conversationRevision:typeof s?.conversationRevision=="string"?s.conversationRevision:null}}async function N(t,e,i){m(t);let s=0;for(let c of i){let d=c.displayContent.length;if(d>g)throw new t.HistoryClientError("payload_too_large",`displayContent exceeds the ${g} character limit`);s+=d}if(s>p)throw new t.HistoryClientError("payload_too_large",`Display projection batch exceeds the ${p} character limit`);await t.initSession();let n=t.historyInternals.visitorStore,r=n?.revision()??0,o=await l(t,`conversations/${encodeURIComponent(e)}/display-projections`,{method:"PATCH",body:{messages:i},scope:"browser",keepalive:s<=p,trackIdentity:!1}),a=typeof o?.conversationRevision=="string"?o.conversationRevision:null;return a&&t.clientSession?.conversationId===e&&(n?.revision()??0)===r&&t.historyInternals.setStoredConversationRevision?.(a),{conversationRevision:a}}async function L(t,e,i){let s=await l(t,`conversations/${encodeURIComponent(e)}`,{method:"DELETE",...i?.scope?{scope:i.scope}:{}});return{deleted:typeof s?.deleted=="number"?s.deleted:0}}async function U(t,e){let i=await l(t,"conversations",{method:"DELETE",query:{...e?.targetId!==void 0?{targetId:e.targetId}:{}},...e?.scope?{scope:e.scope}:{}});return{deleted:typeof i?.deleted=="number"?i.deleted:0}}async function $(t){m(t),t.setHistoryIdentityStatus({state:"resetting"});try{await l(t,"visitor/reset",{method:"POST",scope:"browser",visitorTokenOptional:!0})}finally{await t.historyInternals.visitorStore?.clear(),t.setHistoryIdentityStatus(t.derivedBrowserOnly())}return{reset:!0}}export{U as deleteAllConversations,L as deleteConversation,N as finalizeDisplayProjections,M as getConversation,q as historyErrorFor,z as listConversations,h as readErrorCode,T as recoverFromUnauthorized,$ as resetVisitor};
1
+ var y="4.26.1";var f=y;var g=32768,p=49152,b=t=>{let e=t??{},i=typeof e.targetId=="string"?e.targetId:null;return{id:typeof e.id=="string"?e.id:"",title:typeof e.title=="string"?e.title:"",targetId:i,preview:typeof e.preview=="string"?e.preview:null,messageCount:typeof e.messageCount=="number"?e.messageCount:0,createdAt:typeof e.createdAt=="string"?e.createdAt:"",updatedAt:typeof e.updatedAt=="string"?e.updatedAt:""}},v="The identity proof was not admitted; account history is unavailable",w="The identity proof was rejected",H="The request carried no visitor credential",C="The stored visitor belongs to a different signed-in user";function j(t,e,i){let s=new URLSearchParams;for(let[r,o]of Object.entries(i))o===void 0||o===""||s.set(r,String(o));let n=s.toString();return`${t.clientApiBase()}/v1/client/${e}${n?`?${n}`:""}`}function I(t,e){if(e)return e;let i=t.config.features?.history?.scope;return i||(t.config.getIdentityProof?"verified-user":"browser")}async function E(t,e,i){let s=t.config.getIdentityProof;if(!s)return i&&t.setHistoryIdentityStatus(t.browserOnlyStatus()),null;i&&t.setHistoryIdentityStatus({state:"verifying"});let n;try{n=await s()??null}catch{throw i&&t.setHistoryIdentityStatus({state:"identity_provider_failed"}),new t.HistoryClientError("identity_provider_failed","The identity proof provider failed")}if(n)return n;if(e.visitor?.endUserId!=null)throw i&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"proof_unavailable_after_binding"}),new t.HistoryClientError("authentication_required","This browser is bound to a signed-in user and needs a fresh identity proof");return i&&t.setHistoryIdentityStatus({state:"browser_only",reason:"proof_unavailable_before_binding"}),null}async function k(t,e,i,s){if(e.visitor?.endUserId!=null)return e;let n=await t.reinitWithProof(i);if(!(n.visitor?.identityStatus==="admitted"&&n.visitor?.endUserId!=null))throw s&&t.setHistoryIdentityStatus({state:"configuration_error",reason:"proof_not_admitted"}),new t.HistoryClientError("proof_not_admitted",v);return n}async function h(t,e){let i=await e.json().catch(()=>({}));return typeof i.error=="string"?i.error:typeof i.message=="string"?i.message:""}async function T(t,e,i,s){let n=e.toLowerCase();if(n.includes("invalid_identity_proof"))throw s&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"invalid_identity_proof"}),new t.HistoryClientError("invalid_identity_proof",w);if(n.includes("visitor token required"))throw new t.HistoryClientError("visitor_token_missing",H);if(n.includes("visitor_identity_mismatch")){if(!i)throw s&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"proof_unavailable_after_binding"}),new t.HistoryClientError("visitor_identity_mismatch",C);return t.reinitWithProof(i)}if(n.includes("expired")||n.includes("not found"))return t.clearClientSession(),t.initSession();throw new t.HistoryClientError("unauthorized",e||"History request was not authorized")}async function q(t,e,i){let s=await h(t,e);if(e.status===404)return new t.HistoryClientError("not_found","Conversation not found");if(e.status===429){let n=Number.parseInt(e.headers.get("Retry-After")??"",10);return new t.HistoryClientError("rate_limited","Too many history requests",{...Number.isFinite(n)?{retryAfterSeconds:n}:{}})}if(e.status===503&&s.includes("identity_proof_not_admitted"))return i&&t.setHistoryIdentityStatus({state:"configuration_error",reason:"proof_not_admitted"}),new t.HistoryClientError("proof_not_admitted",v);if(e.status===401){let n=s.toLowerCase();return n.includes("invalid_identity_proof")?(i&&t.setHistoryIdentityStatus({state:"authentication_required",reason:"invalid_identity_proof"}),new t.HistoryClientError("invalid_identity_proof",w)):n.includes("visitor token required")?new t.HistoryClientError("visitor_token_missing",H):n.includes("visitor_identity_mismatch")?new t.HistoryClientError("visitor_identity_mismatch",C):new t.HistoryClientError("unauthorized",s||"History request was not authorized")}return new t.HistoryClientError("request_failed",s||`History request failed (${e.status})`)}function P(t,e,i,s){let n=e?.toLowerCase()??null;if(i){if(n==="admitted"){s&&t.setHistoryIdentityStatus({state:"verified"});return}throw s&&t.setHistoryIdentityStatus({state:"configuration_error",reason:"proof_not_admitted"}),n==="ignored"?new t.HistoryClientError("identity_contract_violation","Server reported an ignored identity proof on a success response"):new t.HistoryClientError("proof_not_admitted","The response did not acknowledge the identity proof this request sent")}if(n==="admitted")throw new t.HistoryClientError("identity_contract_violation","Server admitted an identity proof that was never sent");s&&t.setHistoryIdentityStatus(t.browserOnlyStatus())}async function l(t,e,i){m(t);let s=i.trackIdentity!==!1,n=await t.initSession(),r=null;I(t,i.scope)==="verified-user"&&(r=await E(t,n,s),r&&(n=await k(t,n,r,s)));let o=t.historyInternals.visitorStore,a=!1;for(;;){let c=o?.revision()??0,d=await t.readVisitorToken();if(!d&&!i.visitorTokenOptional)throw new t.HistoryClientError("visitor_token_missing","No visitor credential is stored for this browser");let u=await fetch(j(t,e,{...i.query,sessionId:n.sessionId}),{method:i.method,headers:{"X-Persona-Version":f,...d?{"X-Visitor-Token":d}:{},...r?{"X-Identity-Proof":r}:{},...i.body!==void 0?{"Content-Type":"application/json"}:{}},...i.body!==void 0?{body:JSON.stringify(i.body)}:{},...i.keepalive?{keepalive:!0}:{}});if(u.status===401&&!a){a=!0,n=await T(t,await h(t,u),r,s);continue}if(!u.ok)throw await q(t,u,s);let x=u.headers.get("X-History-Identity-Status"),_=await u.json().catch(()=>{});if(o&&o.revision()!==c)throw new t.HistoryClientError("credential_changed","The visitor credential changed while the request was in flight");return P(t,x,r!==null,s),_}}function m(t){if(!t.isClientTokenMode())throw new Error("Conversation history is only available in client token mode");if(!t.isHistoryCapable())throw new t.HistoryClientError("history_disabled","Visitor history is disabled for this surface")}async function z(t,e){let i=await l(t,"conversations",{method:"GET",query:{...e?.cursor?{cursor:e.cursor}:{},...e?.limit!==void 0?{limit:e.limit}:{},...e?.targetId?{targetId:e.targetId}:{}},...e?.scope?{scope:e.scope}:{}});return{data:(Array.isArray(i?.data)?i.data:[]).map(b),nextCursor:typeof i?.nextCursor=="string"?i.nextCursor:null}}async function M(t,e,i){let s=await l(t,`conversations/${encodeURIComponent(e)}`,{method:"GET",query:{...i?.messageCursor?{messageCursor:i.messageCursor}:{}},...i?.scope?{scope:i.scope}:{}});return{summary:b(s),messages:Array.isArray(s?.messages)?s.messages:[],nextMessageCursor:typeof s?.nextMessageCursor=="string"?s.nextMessageCursor:null,conversationRevision:typeof s?.conversationRevision=="string"?s.conversationRevision:null}}async function N(t,e,i){m(t);let s=0;for(let c of i){let d=c.displayContent.length;if(d>g)throw new t.HistoryClientError("payload_too_large",`displayContent exceeds the ${g} character limit`);s+=d}if(s>p)throw new t.HistoryClientError("payload_too_large",`Display projection batch exceeds the ${p} character limit`);await t.initSession();let n=t.historyInternals.visitorStore,r=n?.revision()??0,o=await l(t,`conversations/${encodeURIComponent(e)}/display-projections`,{method:"PATCH",body:{messages:i},scope:"browser",keepalive:s<=p,trackIdentity:!1}),a=typeof o?.conversationRevision=="string"?o.conversationRevision:null;return a&&t.clientSession?.conversationId===e&&(n?.revision()??0)===r&&t.historyInternals.setStoredConversationRevision?.(a),{conversationRevision:a}}async function L(t,e,i){let s=await l(t,`conversations/${encodeURIComponent(e)}`,{method:"DELETE",...i?.scope?{scope:i.scope}:{}});return{deleted:typeof s?.deleted=="number"?s.deleted:0}}async function U(t,e){let i=await l(t,"conversations",{method:"DELETE",query:{...e?.targetId!==void 0?{targetId:e.targetId}:{}},...e?.scope?{scope:e.scope}:{}});return{deleted:typeof i?.deleted=="number"?i.deleted:0}}async function $(t){m(t),t.setHistoryIdentityStatus({state:"resetting"});try{await l(t,"visitor/reset",{method:"POST",scope:"browser",visitorTokenOptional:!0})}finally{await t.historyInternals.visitorStore?.clear(),t.setHistoryIdentityStatus(t.derivedBrowserOnly())}return{reset:!0}}export{U as deleteAllConversations,L as deleteConversation,N as finalizeDisplayProjections,M as getConversation,q as historyErrorFor,z as listConversations,h as readErrorCode,T as recoverFromUnauthorized,$ as resetVisitor};
package/dist/codegen.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var $=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var W=(e,i)=>{for(var r in i)$(e,r,{get:i[r],enumerable:!0})},H=(e,i,r,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of M(i))!R.call(e,a)&&a!==r&&$(e,a,{get:()=>i[a],enumerable:!(s=T(i,a))||s.enumerable});return e};var N=e=>H($({},"__esModule",{value:!0}),e);var X={};W(X,{generateCodeSnippet:()=>I});module.exports=N(X);var j="4.26.0";var A=j;function x(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${A}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function q(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var O=`({ text, message }: any) => {
1
+ "use strict";var $=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var W=(e,i)=>{for(var r in i)$(e,r,{get:i[r],enumerable:!0})},H=(e,i,r,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of M(i))!R.call(e,a)&&a!==r&&$(e,a,{get:()=>i[a],enumerable:!(s=T(i,a))||s.enumerable});return e};var N=e=>H($({},"__esModule",{value:!0}),e);var X={};W(X,{generateCodeSnippet:()=>I});module.exports=N(X);var j="4.26.1";var A=j;function x(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${A}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function q(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var O=`({ text, message }: any) => {
2
2
  const jsonSource = (message as any).rawContent || text || message.content;
3
3
  if (!jsonSource || typeof jsonSource !== 'string') return null;
4
4
  let cleanJson = jsonSource
package/dist/codegen.js CHANGED
@@ -1,4 +1,4 @@
1
- var S="4.26.0";var j=S;function $(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${j}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function _(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var A=`({ text, message }: any) => {
1
+ var S="4.26.1";var j=S;function $(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${j}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function _(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var A=`({ text, message }: any) => {
2
2
  const jsonSource = (message as any).rawContent || text || message.content;
3
3
  if (!jsonSource || typeof jsonSource !== 'string') return null;
4
4
  let cleanJson = jsonSource
@@ -7144,6 +7144,12 @@ type VoiceDelegationResult = {
7144
7144
  status: VoiceDelegationStatus;
7145
7145
  /** The assistant text (Markdown allowed). */
7146
7146
  text: string;
7147
+ /**
7148
+ * `false` when no chat message carries this answer (it is only spoken), so
7149
+ * the voice model's read-back of it stays visible as a caption.
7150
+ * @default true
7151
+ */
7152
+ inChat?: boolean;
7147
7153
  /**
7148
7154
  * Set when the turn parked on approvals (`text` then asks for the decision).
7149
7155
  * Resolves with the terminal result once the visitor decides (or the
@@ -7144,6 +7144,12 @@ type VoiceDelegationResult = {
7144
7144
  status: VoiceDelegationStatus;
7145
7145
  /** The assistant text (Markdown allowed). */
7146
7146
  text: string;
7147
+ /**
7148
+ * `false` when no chat message carries this answer (it is only spoken), so
7149
+ * the voice model's read-back of it stays visible as a caption.
7150
+ * @default true
7151
+ */
7152
+ inChat?: boolean;
7147
7153
  /**
7148
7154
  * Set when the turn parked on approvals (`text` then asks for the decision).
7149
7155
  * Resolves with the terminal result once the visitor decides (or the
@@ -7144,6 +7144,12 @@ type VoiceDelegationResult = {
7144
7144
  status: VoiceDelegationStatus;
7145
7145
  /** The assistant text (Markdown allowed). */
7146
7146
  text: string;
7147
+ /**
7148
+ * `false` when no chat message carries this answer (it is only spoken), so
7149
+ * the voice model's read-back of it stays visible as a caption.
7150
+ * @default true
7151
+ */
7152
+ inChat?: boolean;
7147
7153
  /**
7148
7154
  * Set when the turn parked on approvals (`text` then asks for the decision).
7149
7155
  * Resolves with the terminal result once the visitor decides (or the
@@ -7144,6 +7144,12 @@ type VoiceDelegationResult = {
7144
7144
  status: VoiceDelegationStatus;
7145
7145
  /** The assistant text (Markdown allowed). */
7146
7146
  text: string;
7147
+ /**
7148
+ * `false` when no chat message carries this answer (it is only spoken), so
7149
+ * the voice model's read-back of it stays visible as a caption.
7150
+ * @default true
7151
+ */
7152
+ inChat?: boolean;
7147
7153
  /**
7148
7154
  * Set when the turn parked on approvals (`text` then asks for the decision).
7149
7155
  * Resolves with the terminal result once the visitor decides (or the
@@ -7313,6 +7313,12 @@ type VoiceDelegationResult = {
7313
7313
  status: VoiceDelegationStatus;
7314
7314
  /** The assistant text (Markdown allowed). */
7315
7315
  text: string;
7316
+ /**
7317
+ * `false` when no chat message carries this answer (it is only spoken), so
7318
+ * the voice model's read-back of it stays visible as a caption.
7319
+ * @default true
7320
+ */
7321
+ inChat?: boolean;
7316
7322
  /**
7317
7323
  * Set when the turn parked on approvals (`text` then asks for the decision).
7318
7324
  * Resolves with the terminal result once the visitor decides (or the
@@ -7313,6 +7313,12 @@ type VoiceDelegationResult = {
7313
7313
  status: VoiceDelegationStatus;
7314
7314
  /** The assistant text (Markdown allowed). */
7315
7315
  text: string;
7316
+ /**
7317
+ * `false` when no chat message carries this answer (it is only spoken), so
7318
+ * the voice model's read-back of it stays visible as a caption.
7319
+ * @default true
7320
+ */
7321
+ inChat?: boolean;
7316
7322
  /**
7317
7323
  * Set when the turn parked on approvals (`text` then asks for the decision).
7318
7324
  * Resolves with the terminal result once the visitor decides (or the