@nervekit/desktop 0.43.0 → 0.43.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/builtin/configure-nerve/reference/extensions/api/extension-sdk/components/components.d.ts +2 -0
- package/dist/builtin/configure-nerve/reference/extensions/api/extension-sdk/components/ui-kit/components/composites/log-view/index.d.ts +3 -0
- package/dist/builtin/configure-nerve/reference/extensions/api/extension-sdk/components/ui-kit/components/composites/log-view/log-source.d.ts +43 -0
- package/dist/builtin/configure-nerve/reference/extensions/api/extension-sdk/components/ui-kit/components/composites/log-view/log-view.svelte.d.ts +22 -0
- package/dist/builtin/configure-nerve/reference/extensions/api/extension-sdk/components/ui-kit/components/composites/log-view/log-window.d.ts +77 -0
- package/dist/builtin/configure-nerve/reference/extensions/api/extension-sdk/components/ui-kit/components/composites/log-view/terminal-text.svelte.d.ts +6 -0
- package/dist/builtin/configure-nerve/reference/extensions/api/extension-sdk/components/ui-kit/terminal/ansi.d.ts +4 -0
- package/dist/builtin/configure-nerve/reference/extensions/components.md +2 -1
- package/dist/builtin/configure-nerve/reference/extensions/scripts/nerve-version.json +1 -1
- package/dist/{chunk-XIVWNWL7.js → chunk-3LWB5SGT.js} +3 -18
- package/dist/{chunk-EBDLSTDH.js → chunk-WQHOXPLV.js} +549 -236
- package/dist/{chunk-HKBJTS2Z.js → chunk-ZTG7VIGB.js} +1 -1
- package/dist/daemon.js +3 -3
- package/dist/main.js +2 -2
- package/dist/web/assets/AsyncBashCenterHost-BlxXoXd6.js +2 -0
- package/dist/web/assets/{ConversationListItem-DALhochc.js → ConversationListItem-DfSMoYfe.js} +1 -1
- package/dist/web/assets/{ConversationsWorkbenchPanel-ChtoTW2H.js → ConversationsWorkbenchPanel-BOIMwRZx.js} +1 -1
- package/dist/web/assets/{DiscoverCenterHost-Bju7ypB-.js → DiscoverCenterHost-Bi6audxE.js} +1 -1
- package/dist/web/assets/{ExtensionPageCenterHost-BO-5q4j_.js → ExtensionPageCenterHost-DEg-LHcU.js} +1 -1
- package/dist/web/assets/{FileCenterComposedHost-BxLlLMBI.js → FileCenterComposedHost-CPwzMZI9.js} +1 -1
- package/dist/web/assets/FilesWorkbenchPanel-DnKQd6QC.js +12 -0
- package/dist/web/assets/{GitDiffCenterHost-D8i3Jq9A.js → GitDiffCenterHost-DtsFPa1z.js} +1 -1
- package/dist/web/assets/{GitWorkbenchPanel-CtZPJKqJ.js → GitWorkbenchPanel-BfJKdIkE.js} +1 -1
- package/dist/web/assets/LaunchCenterHost-C5Bd9ELF.js +1 -0
- package/dist/web/assets/LaunchConfigurationNotice-Dp3rBKil.js +1 -0
- package/dist/web/assets/LaunchOutputPane-BuCSQcxg.js +2 -0
- package/dist/web/assets/LaunchesWorkbenchPanel-CMd3Xcbp.js +1 -0
- package/dist/web/assets/{LogsCenterHost-xynA0TWK.js → LogsCenterHost-Be6EbsrZ.js} +1 -1
- package/dist/web/assets/{MermaidCenterHost-kAV1ocvE.js → MermaidCenterHost-BdQ8CGeb.js} +1 -1
- package/dist/web/assets/{MobileFilesBody-CiwIT8Vf.js → MobileFilesBody-C1q-YRaD.js} +1 -1
- package/dist/web/assets/{MobileFilesHost-DvQOpQFH.js → MobileFilesHost-DK769osZ.js} +1 -1
- package/dist/web/assets/MobileLaunchOutputHost-BLDX3-Tn.js +1 -0
- package/dist/web/assets/MobileLaunchesHost-Dv2gfOEY.js +2 -0
- package/dist/web/assets/{MobileNoteEditorHost-DSuZ0mU5.js → MobileNoteEditorHost-ZRzzwCYD.js} +1 -1
- package/dist/web/assets/{MobileNotesHost-Lg699XCv.js → MobileNotesHost-COOtVfAp.js} +1 -1
- package/dist/web/assets/{MobileSettingsHost-Bv1P74ck.js → MobileSettingsHost-BU2lCcG2.js} +1 -1
- package/dist/web/assets/{MobileSettingsPageHost-DudFqhZC.js → MobileSettingsPageHost-BC5LOq7Y.js} +1 -1
- package/dist/web/assets/{NotesWorkbenchPanel-C8sctQWR.js → NotesWorkbenchPanel-BiTDbfjj.js} +1 -1
- package/dist/web/assets/{PullRequestCenterHost-BWJ-exw1.js → PullRequestCenterHost-DV3V3yxm.js} +1 -1
- package/dist/web/assets/{PullRequestsWorkbenchPanel-8Fb0-hW3.js → PullRequestsWorkbenchPanel-Dpvt9W-q.js} +1 -1
- package/dist/web/assets/{SearchWorkbenchPanel-B35YmwtL.js → SearchWorkbenchPanel-Bfj8fwPg.js} +1 -1
- package/dist/web/assets/{SettingsCenterHost-BuiirrId.js → SettingsCenterHost-sHWZehrB.js} +1 -1
- package/dist/web/assets/{SystemPromptCenterHost-BqKV92Ew.js → SystemPromptCenterHost-CA9i8UbB.js} +1 -1
- package/dist/web/assets/{ThemePreviewPicker-C6J0H91i.js → ThemePreviewPicker-PySjP6aS.js} +1 -1
- package/dist/web/assets/{adapters-C5HB2cBr.js → adapters-fVomUv3-.js} +1 -1
- package/dist/web/assets/{agent-profiles.svelte-DjdXLJnE.js → agent-profiles.svelte-CenutfXA.js} +1 -1
- package/dist/web/assets/{appearance.svelte-fB4gKc-X.js → appearance.svelte-BKxiMJ3c.js} +1 -1
- package/dist/web/assets/{center-tabs.svelte-8YpJhA1o.js → center-tabs.svelte-i0d5hUO3.js} +1 -1
- package/dist/web/assets/{channel-3Wv484LF.js → channel-DB8mSlhP.js} +2 -2
- package/dist/web/assets/{client-CjIsgPXA.js → client-DHxa8CWS.js} +1 -1
- package/dist/web/assets/{code-BDTZAlQg.js → code-CsVM8hq8.js} +2 -2
- package/dist/web/assets/{conversation-connection-Dm9Zr6Yb.js → conversation-connection-CaV3KY7Z.js} +1 -1
- package/dist/web/assets/{discover-Cwv6pB0p.js → discover-Do0oQbdF.js} +1 -1
- package/dist/web/assets/{dist-BENZZeCy.js → dist-B887qHIr.js} +1 -1
- package/dist/web/assets/{dist-CIK1TmOX.js → dist-Bg8Vm0DE.js} +1 -1
- package/dist/web/assets/{dist-DoKRJEPu.js → dist-C2z70795.js} +1 -1
- package/dist/web/assets/{dist-DUPZ8ZaX.js → dist-CcBabmlO.js} +1 -1
- package/dist/web/assets/{dist-BBlCv_-z.js → dist-HSfz5y1D.js} +1 -1
- package/dist/web/assets/{dist-BB4fpXjy.js → dist-HUxdivoH.js} +1 -1
- package/dist/web/assets/{dist-BqcaQXZ-.js → dist-wvfFRict.js} +1 -1
- package/dist/web/assets/{extension-themes.svelte-D2TAUtUA.js → extension-themes.svelte-nXDPOl_E.js} +1 -1
- package/dist/web/assets/{file-tabs.svelte-DxL_vZZv.js → file-tabs.svelte-BxCAtif2.js} +2 -2
- package/dist/web/assets/{files-vq7_WbHL.js → files-DcUCbPX1.js} +1 -1
- package/dist/web/assets/filesystem-9b72Tdkw.js +1 -0
- package/dist/web/assets/{git-store.svelte-D9S4P9gI.js → git-store.svelte-DIVFeLGG.js} +1 -1
- package/dist/web/assets/{index-B8XniJoh.js → index-6mIS-NWJ.js} +108 -108
- package/dist/web/assets/index-D2aeJHnc.css +1 -0
- package/dist/web/assets/launches-Dafgn_my.js +5 -0
- package/dist/web/assets/{launches.api-C4z0obJK.js → launches.api-ZZ-IwIQ_.js} +1 -1
- package/dist/web/assets/log-view-Dqspnrs0.js +1 -0
- package/dist/web/assets/{logs.api-BtGxtYFi.js → logs.api-BxN21LL0.js} +1 -1
- package/dist/web/assets/{maintenance-state.svelte-BusQWeCR.js → maintenance-state.svelte-BAKtNG-i.js} +1 -1
- package/dist/web/assets/{menu-icons-DLuZ586C.js → menu-icons-tnCN992t.js} +1 -1
- package/dist/web/assets/page-tabs.svelte-wduGZwmi.js +4 -0
- package/dist/web/assets/{popover-panel-SA7quIc1.js → popover-panel-DO5nPkvA.js} +1 -1
- package/dist/web/assets/pr-view-loader.svelte-RSHgeFYM.js +1 -0
- package/dist/web/assets/{progress-BZbo8ynI.js → progress-CRuzrJQt.js} +1 -1
- package/dist/web/assets/{scratch-notes-state.svelte-B4NySamQ.js → scratch-notes-state.svelte-BcqgnE6z.js} +1 -1
- package/dist/web/assets/{scratch-notes.api-BMBs2yoU.js → scratch-notes.api-D9wtv1Mn.js} +1 -1
- package/dist/web/assets/{settings-Cu_0wNkX.js → settings-CKsESd2i.js} +1 -1
- package/dist/web/assets/{settings-DTw27q0i.js → settings-Crny2xGb.js} +1 -1
- package/dist/web/assets/{settings-scope-Bz4U5ImL.js → settings-scope-BiY5kIdC.js} +1 -1
- package/dist/web/assets/shell-layout.svelte-9B3T60gv.js +2 -0
- package/dist/web/assets/{views-DIrSFdZB.js → views-Bl6CiPE0.js} +1 -1
- package/dist/web/assets/{workbench-connection-BpvUZMVX.js → workbench-connection-CyMud_mZ.js} +1 -1
- package/dist/web/assets/{workspace-uXAUsF3x.js → workspace-V-yCOfn1.js} +1 -1
- package/dist/web/assets/workspace-actions.svelte-D8-Agx2d.js +1 -0
- package/dist/web/assets/{workspace-selectors.svelte-B90FdGfV.js → workspace-selectors.svelte-DQ1mQdvX.js} +1 -1
- package/dist/web/index.html +36 -37
- package/dist/web/sw.js +1 -1
- package/dist/worker.js +2 -2
- package/package.json +7 -7
- package/dist/web/assets/AsyncBashCenterHost-Dcx6zVCo.js +0 -2
- package/dist/web/assets/FilesWorkbenchPanel-jyqwIQAe.js +0 -12
- package/dist/web/assets/LaunchCenterHost-CSy1io6s.js +0 -1
- package/dist/web/assets/LaunchConfigurationNotice-DugBa05c.js +0 -1
- package/dist/web/assets/LaunchesWorkbenchPanel-CNqGG_AP.js +0 -1
- package/dist/web/assets/LogStream-C70iQmUI.css +0 -1
- package/dist/web/assets/LogStream-DfJ4LiCv.js +0 -1
- package/dist/web/assets/MobileLaunchOutputHost-pFJgIV1_.js +0 -1
- package/dist/web/assets/MobileLaunchesHost-0VtdW0x8.js +0 -2
- package/dist/web/assets/filesystem-DiVFVMn3.js +0 -1
- package/dist/web/assets/index-DC_ohlBG.css +0 -1
- package/dist/web/assets/launches-CmB4KShL.js +0 -5
- package/dist/web/assets/launches.svelte-D2bNAphM.js +0 -2
- package/dist/web/assets/page-tabs.svelte-Cc5F8hMx.js +0 -4
- package/dist/web/assets/pr-view-loader.svelte-eOmDNaGf.js +0 -1
- package/dist/web/assets/shell-layout.svelte-Dyx_fbRn.js +0 -2
- package/dist/web/assets/workspace-actions.svelte-DE0mQsY6.js +0 -1
- /package/dist/{chunk-EBDLSTDH.js.LEGAL.txt → chunk-WQHOXPLV.js.LEGAL.txt} +0 -0
|
@@ -52,6 +52,6 @@ function e(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object
|
|
|
52
52
|
|
|
53
53
|
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},s,c=ae,l=!b.jitless,u=l&&oe.value,d=t.catchall,f;e._zod.parse=(i,a)=>{f??=r.value;let p=i.value;return c(p)?l&&u&&a?.async===!1&&a.jitless!==!0?(s||=o(t.shape),i=s(i,a),d?Mr([],p,i,a,f,e,a?.abortEarly===!0):i):n(i,a):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Fr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!_(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Ae(e,r,et())))}),t)}var Ir=y(`$ZodUnion`,(e,t)=>{S.init(e,t),v(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),v(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),v(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),v(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>o(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Fr(t,r,e,i)):Fr(o,r,e,i)}});function Lr(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Rr=y(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ir.init(e,t);let n=e._zod.parse;v(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||u(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=d(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=i(()=>Lr(t));e._zod.parse=(i,a)=>{let o=i.value;if(!ae(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),zr=y(`$ZodIntersection`,(e,t)=>{S.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Vr(e,t,n)):Vr(e,i,a)}});function Br(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(se(e)&&se(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Br(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Br(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Vr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Br(t.value,n.value);if(!c.valid){if(_(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Hr=y(`$ZodTuple`,(e,t)=>{S.init(e,t);let n=t.items,r=b.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=Ur(n,`optin`),l=Ur(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=_(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if(_(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>Wr(t,i,e))):Wr(r,i,e)}}return s.length?Promise.all(s).then(()=>Gr(u,i,n,o,l)):Gr(u,i,n,o,l)}});function Ur(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function Wr(e,t,n){e.issues.length&&t.issues.push(...Ee(n,e.issues)),t.value[n]=e.value}function Gr(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...Ee(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var Kr=y(`$ZodRecord`,(e,t)=>{S.init(e,t);let n=b.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!se(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Ae(e,i,et())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Ee(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Ee(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&an.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Ae(e,i,et())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Ee(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Ee(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),qr=y(`$ZodEnum`,(t,n)=>{S.init(t,n);let r=e(n.entries),i=new Set(r);t._zod.values=i,v(t,`pattern`,t=>{let n=e(t.def.entries).filter(e=>le.has(typeof e));return RegExp(n.length?`^(${n.map(e=>ue(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),t._zod.parse=(e,n)=>{let a=e.value;return i.has(a)||e.issues.push({code:`invalid_value`,values:r,input:a,inst:t}),e}}),Jr=y(`$ZodLiteral`,(e,t)=>{S.init(e,t);let n=new Set(t.values);e._zod.values=n,v(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?ue(e):e?ue(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Yr=y(`$ZodTransform`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,b.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new $e(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Qe;return n.value=i,n}});function Xr(e,t){return e.value=t.issues.length?void 0:t.value,e}var Zr=y(`$ZodOptional`,(e,t)=>{S.init(e,t),v(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,v(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),v(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${o(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Xr(e,t)):Xr(e,r)}return t.innerType._zod.run(e,n)}}),Qr=y(`$ZodExactOptional`,(e,t)=>{Zr.init(e,t),v(e,`values`,e=>e.def.innerType._zod.values),v(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),$r=y(`$ZodNullable`,(e,t)=>{S.init(e,t),v(e,`optin`,e=>e.def.innerType._zod.optin),v(e,`optout`,e=>e.def.innerType._zod.optout),v(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${o(t.source)}|null)$`):void 0}),v(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ei=y(`$ZodDefault`,(e,t)=>{S.init(e,t),e._zod.optin=`defaulted`,v(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>ti(e,t)):ti(r,t)}});function ti(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ni=y(`$ZodPrefault`,(e,t)=>{S.init(e,t),e._zod.optin=`defaulted`,v(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ri=y(`$ZodNonOptional`,(e,t)=>{S.init(e,t),v(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ii(t,e)):ii(i,e)}});function ii(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function ai(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Ae(e,r,et()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var oi=y(`$ZodCatch`,(e,t)=>{S.init(e,t),v(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),v(e,`optout`,e=>e.def.innerType._zod.optout),v(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>ai(e,r,t,n)):ai(e,r,t,n)}}),si=y(`$ZodPipe`,(e,t)=>{S.init(e,t),v(e,`values`,e=>e.def.in._zod.values),v(e,`optin`,e=>e.def.in._zod.optin),v(e,`optout`,e=>e.def.out._zod.optout),v(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ci(e,t.in,n)):ci(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ci(e,t.out,n)):ci(r,t.out,n)}});function ci(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var li=y(`$ZodPreprocess`,(e,t)=>{si.init(e,t)}),ui=y(`$ZodReadonly`,(e,t)=>{S.init(e,t),v(e,`propValues`,e=>e.def.innerType._zod.propValues),v(e,`values`,e=>e.def.innerType._zod.values),v(e,`optin`,e=>e.def.innerType?._zod?.optin),v(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(di):di(r)}});function di(e){return e.memo||(e.value=Object.freeze(e.value)),e}var fi=y(`$ZodLazy`,(e,t)=>{S.init(e,t),l(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),v(e,`pattern`,e=>e.innerType?._zod?.pattern),v(e,`propValues`,e=>e.innerType?._zod?.propValues),v(e,`optin`,e=>e.innerType?._zod?.optin??void 0),v(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),pi=y(`$ZodCustom`,(e,t)=>{x.init(e,t),S.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>mi(t,n,r,e));mi(i,n,r,e)}});function mi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Fe(e))}}var hi=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},gi=`~memo`,_i=[];function vi(e){return typeof e==`object`&&!!e}function yi(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var bi=new WeakMap,xi=0,Si=1,Ci=2;function wi(e,t,n){let r=bi.get(e);if(r!==void 0)return r?Ci:xi;if(t.has(e))return Ci;t.add(e);let i=xi,a=e=>{if(i!==Ci&&e?._zod){let r=wi(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=xi;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Si:o.value?._zod?wi(o.value,t,n):xi;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=d(c);s(e?o(e,!0):Si),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?wi(r,t,!1):Si);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Ti(e,i)}function Ti(e,t){return t!==Si&&bi.set(e,t===Ci),t}function Ei(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Di,Oi=[],ki={alloc(e,t,n){let r=Di;if(!r)return n;Di=void 0;let i={value:n,issues:null};return r.set(t.value,i),Oi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&ji(n,e.value))throw new hi;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=wi(e,new Set,!1);if(i===xi)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Ci||r?n=!0:r=!0}let l=s.value;if(!vi(l))return t(s,c);let u=c[gi];u||(u={buckets:new WeakMap,backEdges:void 0},c[gi]=u);let d;i===c?d=a:(d=Ei(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...yi(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Di=d;let p=Oi.length,ee=t(s,c);Di=void 0;let m=Oi.length>p?Oi.pop():void 0;return ee instanceof Promise?ee.then(e=>(m&&(m.issues=e.issues.length?yi(e.issues):_i),e)):(m&&(m.issues=ee.issues.length?yi(ee.issues):_i),ee)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Ai(){return ki}function ji(e,t){let n=e[gi]?.backEdges;return n!==void 0&&vi(t)&&n.has(t)}var Mi=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function n(t){return e[t]??null}let r={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},i={nan:`NaN`};function a(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):i[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${a(e.expected)}, received ${a(Pe(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${fe(e.values[0])}`:`Invalid option: expected one of ${t(e.values,`|`)}`;case`too_big`:{let t=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=n(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${t}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${t}${e.maximum.toString()}`}case`too_small`:{let t=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=n(e.origin);return r?`Too small: expected ${e.origin} to have ${t}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${t}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${r[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${t(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Ni(){return{localeError:Mi()}}var Pi,Fi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ii(){return new Fi}(Pi=globalThis).__zod_globalRegistry??(Pi.__zod_globalRegistry=Ii());var Li=globalThis.__zod_globalRegistry;function Ri(e){return e.checks&&=[...e.checks],e}function zi(e,t){return new e(Ri({type:`string`,...g(t)}))}function Bi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...g(t)})}function Vi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...g(t)})}function Hi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...g(t)})}function Ui(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...g(t)})}function Wi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...g(t)})}function Gi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...g(t)})}function Ki(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...g(t)})}function qi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...g(t)})}function Ji(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...g(t)})}function Yi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...g(t)})}function Xi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...g(t)})}function Zi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...g(t)})}function Qi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...g(t)})}function $i(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...g(t)})}function ea(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...g(t)})}function ta(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...g(t)})}function na(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...g(t)})}function ra(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...g(t)})}function ia(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...g(t)})}function aa(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...g(t)})}function oa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...g(t)})}function sa(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...g(t)})}function ca(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...g(t)})}function la(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...g(t)})}function ua(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...g(t)})}function da(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...g(t)})}function fa(e,t){return new e(Ri({type:`number`,checks:[],...g(t)}))}function pa(e,t){return new e(Ri({type:`number`,coerce:!0,checks:[],...g(t)}))}function ma(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...g(t)})}function ha(e,t){return new e({type:`boolean`,...g(t)})}function ga(e,t){return new e({type:`boolean`,coerce:!0,...g(t)})}function _a(e,t){return new e({type:`undefined`,...g(t)})}function va(e,t){return new e({type:`null`,...g(t)})}function ya(e){return new e({type:`unknown`})}function ba(e,t){return new e({type:`never`,...g(t)})}function xa(e,t){return new pn({check:`less_than`,...g(t),value:e,inclusive:!1})}function Sa(e,t){return new pn({check:`less_than`,...g(t),value:e,inclusive:!0})}function Ca(e,t){return new mn({check:`greater_than`,...g(t),value:e,inclusive:!1})}function wa(e,t){return new mn({check:`greater_than`,...g(t),value:e,inclusive:!0})}function Ta(e,t){return new hn({check:`multiple_of`,...g(t),value:e})}function Ea(e,t){return new _n({check:`max_length`,...g(t),maximum:e})}function Da(e,t){return new vn({check:`min_length`,...g(t),minimum:e})}function Oa(e,t){return new yn({check:`length_equals`,...g(t),length:e})}function ka(e,t){return new xn({check:`string_format`,format:`regex`,...g(t),pattern:e})}function Aa(e){return new Sn({check:`string_format`,format:`lowercase`,...g(e)})}function ja(e){return new Cn({check:`string_format`,format:`uppercase`,...g(e)})}function Ma(e,t){return new wn({check:`string_format`,format:`includes`,...g(t),includes:e})}function Na(e,t){return new Tn({check:`string_format`,format:`starts_with`,...g(t),prefix:e})}function Pa(e,t){return new En({check:`string_format`,format:`ends_with`,...g(t),suffix:e})}function Fa(e){return new Dn({check:`overwrite`,tx:e})}function Ia(e){return Fa(t=>t.normalize(e))}function La(){return Fa(e=>e.trim())}function Ra(){return Fa(e=>e.toLowerCase())}function za(){return Fa(e=>e.toUpperCase())}function Ba(){return Fa(e=>re(e))}function Va(e,t,n){return new e({type:`array`,element:t,...g(n)})}function Ha(e,t,n){let r=g(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function Ua(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...g(n)})}function Wa(e,t){let n=Ga(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Fe(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Fe(r))}},e(t.value,t)),t);return n}function Ga(e,t){let n=new x({check:`custom`,...g(t)});return n._zod.check=e,n}function Ka(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&u(e,t,n[t]);return e}function qa(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Li,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Ja(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function w(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,w(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ka(o.schema,c),t.io===`input`&&T(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ya(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Xa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Ya(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ya(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
54
54
|
|
|
55
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Za(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Za(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Qa=new Set([`type`,`properties`,`required`,`additionalProperties`]),$a=[`oneOf`,`anyOf`];function eo(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function to(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Qa.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??eo(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}u(n,r,e.length===1?e[0]:to(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=eo(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function no(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Qa)if(t in e)return;let n=t.filter(e=>$a.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=to(t);else{let e=n[0],i=$a.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>to([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ka(e,r))}function ro(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Ka(i,s),Ka(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Za(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])no(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Ka(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,u(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ao(t,`input`,e.processors),output:ao(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function T(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return T(r.element,n);if(r.type===`set`)return T(r.valueType,n);if(r.type===`lazy`)return T(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return T(r.innerType,n);if(r.type===`intersection`)return T(r.left,n)||T(r.right,n);if(r.type===`record`||r.type===`map`)return T(r.keyType,n)||T(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:T(r.in,n)||T(r.out,n);if(r.type===`object`){for(let e in r.shape)if(T(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(T(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(T(e,n))return!0;return!!(r.rest&&T(r.rest,n))}return!1}var io=(e,t={})=>n=>{let r=qa({...n,processors:t});return w(e,r),Xa(r,e),ro(r,e)},ao=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=qa({...i??{},target:a,io:t,processors:n});return w(e,o),Xa(o,e),ro(o,e)},oo=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},so=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},co=(e,t)=>{oo(e,`minimum`,t),so(e,`maximum`,t)},lo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},uo=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},fo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},po=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},mo=(e,t)=>oo(e,`minimum`,t.minimum),ho=(e,t)=>so(e,`maximum`,t.maximum),go=e=>(t,n)=>{po(t,n.format);let[r,i]=e[n.format];oo(t,`minimum`,r),so(t,`maximum`,i)},_o={greater_than:(e,t)=>oo(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>so(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>lo(e,t.value),number_format:go(me),bigint_format:go(he),min_length:mo,max_length:ho,length_equals:(e,t)=>co(e,t.length),min_size:mo,max_size:ho,size_equals:(e,t)=>co(e,t.size),string_format:(e,t)=>{po(e,t.format),t.pattern&&uo(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>fo(e,t.mime)};function E(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)_o[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&oo(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&oo(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&so(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&so(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&lo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&fo(t,i.mime);for(let e of i.patterns??[])uo(t,e);return t}var vo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},yo=new Map([[ur,Kt],[fr,qt]]),bo=e=>yo.get(e)??e,xo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=E(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=vo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(bo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},So=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=E(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ja(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Co=(e,t,n,r)=>{n.type=`boolean`},wo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},To=(e,t,n,r)=>{Ja(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{n.not={}},Do=(t,n,r,i)=>{let a=t._zod.def,o=e(a.entries);o.length===0?r.not={}:(o.every(e=>typeof e==`number`)&&(r.type=`number`),o.every(e=>typeof e==`string`)&&(r.type=`string`),r.enum=o)},Oo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ja(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ja(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},ko=(e,t,n,r)=>{Ja(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ao=(e,t,n,r)=>{Ja(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},jo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=E(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=w(a.element,t,{...r,path:[...r.path,`items`]})};function Mo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Mo(t.out):t.type===`catch`?Mo(t.innerType):e._zod.optin}var No=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ja(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)u(i.properties,e,w(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Mo(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=w(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Po=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>w(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Fo=(e,t,n,r)=>{let i=e._zod.def,a=w(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=w(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Io=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>w(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?w(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Mo(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:ee}=E(e);typeof p==`number`&&(i.minItems=p),typeof ee==`number`&&(i.maxItems=ee)};function Lo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Lo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Lo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?an:rn).source)),p}var Ro=new WeakMap;function zo(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Ro.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Lo(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Bo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=E(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=w(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)u(i.patternProperties,bo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=w(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Ro.get(t);n||(n=[],Ro.set(t,n),t.deferred.push(()=>zo(t))),n.push(e)}i.additionalProperties=w(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Mo(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Vo=(e,t,n,r)=>{let i=e._zod.def,a=w(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ho=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Uo=Symbol();function Wo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ja(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Uo):JSON.parse(o)}var Go=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Wo(i.defaultValue,e,t,n,r);o!==Uo&&(n.default=o)},Ko=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Wo(i.defaultValue,e,t,n,r);o!==Uo&&(n._prefault=o)},qo=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ja(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Jo=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;w(o,t,r);let s=t.seen.get(e);s.ref=o},Yo=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Xo=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Zo=(e,t,n,r)=>{let i=e._zod.innerType;w(i,t,r);let a=t.seen.get(e);a.ref=i},Qo=new WeakSet([Object.prototype,Error.prototype]);function $o(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var D=y(`ZodError`,(e,t)=>{ot.init(e,t),e.name=`ZodError`;let r=Object.getPrototypeOf(e);Qo.has(r)||(Qo.add(r),$o(r,`format`,e=>t=>lt(e,t)),$o(r,`flatten`,e=>t=>ct(e,t)),$o(r,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,n,2)}),$o(r,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,n,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),es=dt(D),ts=ft(D),ns=pt(D),rs=ht(D),is=xt(D),as=St(D),os=Ct(D),ss=wt(D),cs=Tt(D),ls=Et(D),us=Dt(D),ds=Ot(D);function fs(){b.localeError||et(Ni())}function ps(){b.memoizer||et({memoizer:Ai()})}var O=y(`ZodType`,(e,t)=>(fs(),S.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(h(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return de(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Pc(e,t))},superRefine(e,t){return this.check(Fc(e,t))},overwrite(e){return this.check(Fa(e))},optional(){return fc(this)},exactOptional(){return mc(this)},nullable(){return gc(this)},nullish(){return fc(gc(this))},nonoptional(e){return Sc(this,e)},array(){return P(this)},or(e){return L([this,e])},and(e){return nc(this,e)},transform(e){return Ec(this,uc(e))},default(e){return vc(this,e)},prefault(e){return bc(this,e)},catch(e){return wc(this,e)},pipe(e){return Ec(this,e)},readonly(){return kc(this)},describe(e){let t=this.clone();return Li.add(t,{description:e}),t},meta(...e){if(e.length===0)return Li.get(this);let t=this.clone();return Li.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Re(this,`~standard`,{...Mn(this),jsonSchema:{input:ao(this,`input`),output:ao(this,`output`)}})},set"~standard"(e){Le(this,`~standard`,e)},parse:function e(t,n){return es(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ts(this,t,n,{callee:e})},safeParse(e,t){return ns(this,e,t)},async safeParseAsync(e,t){return rs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Le(this,`spa`,e)},validate(e,t){return vt(this,e,t)},validateAsync(e,t){return bt(this,e,t)},encode:function e(t,n){return is(this,t,n,{callee:e})},decode:function e(t,n){return as(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await os(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ss(this,t,n,{callee:e})},safeEncode(e,t){return cs(this,e,t)},safeDecode(e,t){return ls(this,e,t)},async safeEncodeAsync(e,t){return us(this,e,t)},async safeDecodeAsync(e,t){return ds(this,e,t)},toJSONSchema(e){return io(this,{})(e)},get description(){return Li.get(this)?.description},get _def(){return this._zod.def}}),ms=y(`_ZodString`,(e,t)=>{Nn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)},ze({format:e=>E(e).format??null,minLength:e=>E(e).minimum??null,maxLength:e=>E(e).maximum??null},{regex(...e){return this.check(ka(...e))},includes(...e){return this.check(Ma(...e))},startsWith(...e){return this.check(Na(...e))},endsWith(...e){return this.check(Pa(...e))},min(...e){return this.check(Da(...e))},max(...e){return this.check(Ea(...e))},length(...e){return this.check(Oa(...e))},nonempty(...e){return this.check(Da(1,...e))},lowercase(e){return this.check(Aa(e))},uppercase(e){return this.check(ja(e))},trim(){return this.check(La())},normalize(...e){return this.check(Ia(...e))},toLowerCase(){return this.check(Ra())},toUpperCase(){return this.check(za())},slugify(){return this.check(Ba())}})),hs=y(`ZodString`,(e,t)=>{Nn.init(e,t),ms.init(e,t)},{email(e){return this.check(Bi(bs,e))},url(e){return this.check(Ki(Cs,e))},jwt(e){return this.check(sa(Rs,e))},emoji(e){return this.check(qi(ws,e))},guid(e){return this.check(Vi(xs,e))},uuid(e){return this.check(Hi(Ss,e))},uuidv4(e){return this.check(Ui(Ss,e))},uuidv6(e){return this.check(Wi(Ss,e))},uuidv7(e){return this.check(Gi(Ss,e))},nanoid(e){return this.check(Ji(Ts,e))},cuid(e){return this.check(Yi(Es,e))},cuid2(e){return this.check(Xi(Ds,e))},ulid(e){return this.check(Zi(Os,e))},base64(e){return this.check(ia(Fs,e))},base64url(e){return this.check(aa(Is,e))},xid(e){return this.check(Qi(ks,e))},ksuid(e){return this.check($i(As,e))},ipv4(e){return this.check(ea(js,e))},ipv6(e){return this.check(ta(Ms,e))},cidrv4(e){return this.check(na(Ns,e))},cidrv6(e){return this.check(ra(Ps,e))},e164(e){return this.check(oa(Ls,e))},datetime(e){return this.check(ca(gs,e))},date(e){return this.check(la(_s,e))},time(e){return this.check(ua(vs,e))},duration(e){return this.check(da(ys,e))}});function k(e){return zi(hs,e)}var A=y(`ZodStringFormat`,(e,t)=>{C.init(e,t),ms.init(e,t)}),gs=y(`ZodISODateTime`,(e,t)=>{Qn.init(e,t),A.init(e,t)}),_s=y(`ZodISODate`,(e,t)=>{$n.init(e,t),A.init(e,t)}),vs=y(`ZodISOTime`,(e,t)=>{er.init(e,t),A.init(e,t)}),ys=y(`ZodISODuration`,(e,t)=>{tr.init(e,t),A.init(e,t)}),bs=y(`ZodEmail`,(e,t)=>{In.init(e,t),A.init(e,t)}),xs=y(`ZodGUID`,(e,t)=>{Pn.init(e,t),A.init(e,t)}),Ss=y(`ZodUUID`,(e,t)=>{Fn.init(e,t),A.init(e,t)}),Cs=y(`ZodURL`,(e,t)=>{Wn.init(e,t),A.init(e,t)}),ws=y(`ZodEmoji`,(e,t)=>{Gn.init(e,t),A.init(e,t)}),Ts=y(`ZodNanoID`,(e,t)=>{Kn.init(e,t),A.init(e,t)}),Es=y(`ZodCUID`,(e,t)=>{qn.init(e,t),A.init(e,t)}),Ds=y(`ZodCUID2`,(e,t)=>{Jn.init(e,t),A.init(e,t)}),Os=y(`ZodULID`,(e,t)=>{Yn.init(e,t),A.init(e,t)}),ks=y(`ZodXID`,(e,t)=>{Xn.init(e,t),A.init(e,t)}),As=y(`ZodKSUID`,(e,t)=>{Zn.init(e,t),A.init(e,t)}),js=y(`ZodIPv4`,(e,t)=>{nr.init(e,t),A.init(e,t)}),Ms=y(`ZodIPv6`,(e,t)=>{ar.init(e,t),A.init(e,t)}),Ns=y(`ZodCIDRv4`,(e,t)=>{or.init(e,t),A.init(e,t)}),Ps=y(`ZodCIDRv6`,(e,t)=>{cr.init(e,t),A.init(e,t)}),Fs=y(`ZodBase64`,(e,t)=>{dr.init(e,t),A.init(e,t)}),Is=y(`ZodBase64URL`,(e,t)=>{mr.init(e,t),A.init(e,t)}),Ls=y(`ZodE164`,(e,t)=>{hr.init(e,t),A.init(e,t)}),Rs=y(`ZodJWT`,(e,t)=>{_r.init(e,t),A.init(e,t)}),zs=y(`ZodNumber`,(e,t)=>{vr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),e.isFinite=!0},ze({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=E(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=E(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=E(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>E(e).format??null},{gt(e,t){return this.check(Ca(e,t))},gte(e,t){return this.check(wa(e,t))},min(e,t){return this.check(wa(e,t))},lt(e,t){return this.check(xa(e,t))},lte(e,t){return this.check(Sa(e,t))},max(e,t){return this.check(Sa(e,t))},int(e){return this.check(Vs(e))},safe(e){return this.check(Vs(e))},positive(e){return this.check(Ca(0,e))},nonnegative(e){return this.check(wa(0,e))},negative(e){return this.check(xa(0,e))},nonpositive(e){return this.check(Sa(0,e))},multipleOf(e,t){return this.check(Ta(e,t))},step(e,t){return this.check(Ta(e,t))},finite(){return this}}));function j(e){return fa(zs,e)}var Bs=y(`ZodNumberFormat`,(e,t)=>{yr.init(e,t),zs.init(e,t)});function Vs(e){return ma(Bs,e)}var Hs=y(`ZodBoolean`,(e,t)=>{br.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r)});function M(e){return ha(Hs,e)}var Us=y(`ZodUndefined`,(e,t)=>{xr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r)});function Ws(e){return _a(Us,e)}var Gs=y(`ZodNull`,(e,t)=>{Sr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)});function Ks(e){return va(Gs,e)}var qs=y(`ZodUnknown`,(e,t)=>{Cr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function N(){return ya(qs)}var Js=y(`ZodNever`,(e,t)=>{wr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r)});function Ys(e){return ba(Js,e)}var Xs=y(`ZodArray`,(e,t)=>{ps(),Or.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Da(e,t))},nonempty(e){return this.check(Da(1,e))},max(e,t){return this.check(Ea(e,t))},length(e,t){return this.check(Oa(e,t))},unwrap(){return this.element}});function P(e,t){return Va(Xs,e,t)}var Zs=y(`ZodObject`,(e,t)=>{ps(),Pr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),Ge(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return B(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(h(this._zod.def,{catchall:e}))},passthrough(){return this.clone(h(this._zod.def,{catchall:N()}))},loose(){return this.clone(h(this._zod.def,{catchall:N()}))},strict(){return this.clone(h(this._zod.def,{catchall:Ys()}))},strip(){return this.clone(h(this._zod.def,{catchall:void 0}))},extend(e){return ye(this,e)},safeExtend(e){return xe(this,e)},merge(e){return Se(this,e)},pick(e){return ge(this,e)},omit(e){return ve(this,e)},partial(...e){return Ce(dc,this,e[0])},exactPartial(...e){return Ce(pc,this,e[0],`exactPartial`)},required(...e){return we(xc,this,e[0])}});function F(e,t){return new Zs({type:`object`,shape:e??{},...g(t)})}function I(e,t){return new Zs({type:`object`,shape:e,catchall:Ys(),...g(t)})}function Qs(e,t){return new Zs({type:`object`,shape:e,catchall:N(),...g(t)})}var $s=y(`ZodUnion`,(e,t)=>{Ir.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.options=t.options});function L(e,t){return new $s({type:`union`,options:e,...g(t)})}var ec=y(`ZodDiscriminatedUnion`,(e,t)=>{$s.init(e,t),Rr.init(e,t)});function R(e,t,n){return new ec({type:`union`,options:t,discriminator:e,...g(n)})}var tc=y(`ZodIntersection`,(e,t)=>{zr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r)});function nc(e,t){return new tc({type:`intersection`,left:e,right:t})}var rc=y(`ZodTuple`,(e,t)=>{ps(),Hr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new dc({type:`optional`,innerType:e}))})}});function ic(e,t,n){let r=t instanceof S;return new rc({type:`tuple`,items:e,rest:r?t:null,...g(r?n:t)})}var ac=y(`ZodRecord`,(e,t)=>{ps(),Kr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function z(e,t,n){return!t||!t._zod?new ac({type:`record`,keyType:k(),valueType:e,...g(t)}):new ac({type:`record`,keyType:e,valueType:t,...g(n)})}function oc(e,t,n){return new ac({type:`record`,keyType:e,valueType:t,...g(n),partial:!0})}var sc=y(`ZodEnum`,(e,t)=>{qr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new sc({...t,checks:[],...g(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new sc({...t,checks:[],...g(r),entries:i})}});function B(e,t){return new sc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...g(t)})}var cc=y(`ZodLiteral`,(e,t)=>{Jr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function V(e,t){return new cc({type:`literal`,values:Array.isArray(e)?e:[e],...g(t)})}var lc=y(`ZodTransform`,(e,t)=>{ps(),Yr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new $e(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Fe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Fe(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function uc(e){return new lc({type:`transform`,transform:e})}var dc=y(`ZodOptional`,(e,t)=>{Zr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fc(e){return new dc({type:`optional`,innerType:e})}var pc=y(`ZodExactOptional`,(e,t)=>{Qr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mc(e){return new pc({type:`optional`,innerType:e})}var hc=y(`ZodNullable`,(e,t)=>{$r.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gc(e){return new hc({type:`nullable`,innerType:e})}var _c=y(`ZodDefault`,(e,t)=>{ei.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function vc(e,t){return new _c({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ce(t)}})}var yc=y(`ZodPrefault`,(e,t)=>{ni.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bc(e,t){return new yc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ce(t)}})}var xc=y(`ZodNonOptional`,(e,t)=>{ri.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sc(e,t){return new xc({type:`nonoptional`,innerType:e,...g(t)})}var Cc=y(`ZodCatch`,(e,t)=>{oi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wc(e,t){return new Cc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:qe(t)})}var Tc=y(`ZodPipe`,(e,t)=>{si.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.in=t.in,e.out=t.out});function Ec(e,t){return new Tc({type:`pipe`,in:e,out:t})}var Dc=y(`ZodPreprocess`,(e,t)=>{Tc.init(e,t),li.init(e,t)}),Oc=y(`ZodReadonly`,(e,t)=>{ui.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kc(e){return new Oc({type:`readonly`,innerType:e})}var Ac=y(`ZodLazy`,(e,t)=>{fi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function jc(e){return new Ac({type:`lazy`,getter:e})}var Mc=y(`ZodCustom`,(e,t)=>{pi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r)});function Nc(e,t){return Ha(Mc,e??(()=>!0),t)}function Pc(e,t={}){return Ua(Mc,e,t)}function Fc(e,t){return Wa(e,t)}function H(e){let t=jc(()=>L([k(e),j(),M(),Ks(),P(t),z(k(),t)]));return t}function Ic(e,t){return new Dc({type:`pipe`,in:uc(e),out:t})}var Lc=B([`user`,`project`]),Rc=B([`builtin`,`user`,`project`]),zc=B([`user`,`project`,`conversation`]),Bc=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Vc=B(Bc).meta({description:`Reasoning effort. A level the selected model does not support is adjusted, or a conflict when required.`}),Hc=F({provider:k().min(1).meta({description:`Provider id from the user's configured models. Never guess it.`}),modelId:k().min(1).meta({description:`Model id from the user's configured models. Never guess it.`})}),Uc=B([`text`,`image`]),Wc=F({provider:k(),modelId:k(),name:k(),label:k(),reasoning:M().default(!1),input:P(Uc).default([`text`]),supportedThinkingLevels:P(Vc).default([`off`]),faux:M().optional(),contextWindow:j().int().nonnegative().default(0),maxOutputTokens:j().int().nonnegative().default(0)});F({tokens:j().int().nonnegative().nullable(),contextWindow:j().int().nonnegative(),percent:j().nullable()});var Gc=B([`needs_review`,`trusted`,`declined`]),Kc=k().trim().min(1).max(128).regex(/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/),qc=k().trim().min(1).max(256),Jc=L([k().max(8192),j().finite(),M()]),Yc=B([`allow`,`prompt`,`deny`]).meta({description:"`allow` runs the call, `prompt` asks the user, `deny` refuses it."}),Xc=B([`overridable`,`guardrail`]).meta({description:"`overridable` rules are ordered by scope and priority. A `guardrail` beats every overridable rule, may only `prompt` or `deny`, and is allowed only in user overlays."}),Zc=B([`filesystem`,`command`,`code`,`external_read`,`interaction`,`orchestration`,`deployment`,`integration`,`other`]).meta({description:`Static category of a tool.`}),Qc=B([`read`,`write`,`external_read`,`external_write`,`secret`,`destructive`,`deployment`,`agent_spawn`,`interaction`,`unknown`]).meta({description:"Risk class of a tool call. `bash` and `python_exec` calls are always `unknown`; match them by tool name and argument."}),$c=B([`path`,`url`,`agent`,`resource`,`whole_tool`]).meta({description:`Kind of target a call touches.`}),el=B([`project`,`nerve_home`,`nerve_data`,`plans`]).meta({description:`Directory a path target is relative to: the project directory, the Nerve home, its data directory or the plans directory.`}),tl=k().max(4096).superRefine((e,t)=>{(e.includes(`\\`)||e.startsWith(`/`)||/^[A-Za-z]:/.test(e)||e.split(`/`).includes(`..`)||e.includes(`\0`))&&t.addIssue({code:`custom`,message:`Paths must be normalized root-relative POSIX paths.`})}),nl=F({kind:V(`path`),access:B([`read`,`write`]),scope:B([`exact`,`tree`]),root:el,relativePath:tl}).strict(),rl=k().min(1).max(32768).superRefine((e,t)=>{(e.includes(`\0`)||!e.startsWith(`/`)&&!/^[A-Za-z]:[\\/]/.test(e)&&!e.startsWith(`\\\\`))&&t.addIssue({code:`custom`,message:`External path targets must use absolute platform paths.`})}),il=L([nl,F({kind:V(`path`),access:B([`read`,`write`]),scope:B([`exact`,`tree`]),absolutePath:rl}).strict(),F({kind:V(`url`),normalizedUrl:k().url().max(8192),access:B([`read`,`write`])}).strict(),F({kind:V(`agent`),agentId:qc}).strict(),F({kind:V(`resource`),value:k().trim().min(1).max(2048)}).strict(),F({kind:V(`whole_tool`)}).strict()]),al=L([Jc,P(Jc).max(256)]).meta({description:`String, number, boolean or an array of those (at most 256).`}),ol="Operators: `equals`/`not_equals` compare the whole value; `in` matches any listed value; `glob` matches a pattern against the whole value (`*` stays within one `/` segment, `**` spans segments, `{a,b}` alternates); `exists` tests presence (`value` true or false).",sl=P(Jc).min(1).max(256).meta({description:`Values to match; the call matches any of them.`}),cl=k().max(8192).meta({description:`Glob pattern, matched against the whole value.`}),ll=R(`operator`,[F({operator:B([`equals`,`not_equals`]),value:al}).strict(),F({operator:V(`in`),value:sl}).strict(),F({operator:V(`glob`),value:cl}).strict(),F({operator:V(`exists`),value:M().meta({description:"`true` matches when present, `false` when absent."})}).strict()]).meta({description:`Compares a single value, such as the tool's primary argument. ${ol} Command lines are one value, so a glob like \`pnpm test*\` also matches \`pnpm test && rm -rf x\`; prefer \`equals\` or \`in\` for commands.`}),ul=k().min(6).max(512).regex(/^args\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*$/).meta({description:"Path to a tool argument: `args.<name>` or nested `args.<name>.<name>`."}),dl=R(`operator`,[F({path:ul,operator:B([`equals`,`not_equals`]),value:al}).strict(),F({path:ul,operator:V(`in`),value:sl}).strict(),F({path:ul,operator:V(`glob`),value:cl}).strict(),F({path:ul,operator:V(`exists`),value:M().meta({description:"`true` matches when present, `false` when absent."})}).strict()]).meta({description:`Compares one named argument of the tool call. ${ol}`}),fl=k().max(8192).meta({description:"Single-line glob over the path relative to its root, the full URL, the agent id or the resource value. Path patterns are relative POSIX globs: no leading `/`, no `..`, no backslashes."}).superRefine((e,t)=>{/\r|\n|\0/.test(e)&&t.addIssue({code:`custom`,message:`Target patterns must be a single line.`})}),pl=F({kind:$c.optional(),access:B([`read`,`write`]).meta({description:`Whether the call reads or writes the target.`}).optional(),scope:B([`exact`,`tree`]).meta({description:"Paths only: `exact` for one file, `tree` for a directory and everything below it."}).optional(),root:el.meta({description:"Paths only: `project` (the project directory), `nerve_home`, `nerve_data` or `plans`. A path outside every root has no root and matches only matchers without `root` and `pattern`."}).optional(),pattern:fl.optional()}).strict().meta({description:"Matches one target of a call. Every present field must match. `scope` and `root` need `kind` `path` or no `kind`."}).superRefine((e,t)=>{(e.scope!==void 0||e.root!==void 0)&&e.kind!==void 0&&e.kind!==`path`&&t.addIssue({code:`custom`,message:`Path scope and root require a path target matcher.`}),e.pattern!==void 0&&(e.kind===`path`||e.root!==void 0)&&(e.pattern.includes(`\\`)||e.pattern.startsWith(`/`)||/^[A-Za-z]:/.test(e.pattern)||e.pattern.split(`/`).includes(`..`))&&t.addIssue({code:`custom`,path:[`pattern`],message:`Path patterns must be root-relative POSIX globs.`})}),ml=F({toolNames:P(qc).min(1).max(256).meta({description:`The tool name is one of these.`}).optional(),toolKinds:P(Zc).min(1).max(16).meta({description:`The tool's kind is one of these.`}).optional(),toolGroups:P(qc).min(1).max(256).meta({description:`The tool's group, or the quick_script namespace of an SDK operation, is one of these.`}).optional(),baseRisks:P(Qc).min(1).max(16).meta({description:`The call's risk is one of these.`}).optional(),primaryArgument:ll.meta({description:"Matcher on the tool's primary argument (for `bash`, the command line)."}).optional(),primaryTarget:pl.meta({description:`Matcher on the call's first target.`}).optional(),targets:F({quantifier:B([`any`,`all`]).meta({description:"`any`: at least one target matches. `all`: the call has targets and every one matches; use it for `allow` rules so a call touching an allowed and another path is not allowed."}),matcher:pl}).strict().meta({description:`Matcher applied to all targets of the call.`}).optional(),arguments:P(dl).min(1).max(64).meta({description:`Matchers on named arguments; all must match.`}).optional()}).strict().meta({description:"Selects calls. Every present field must match; `{}` matches every call."}),hl=F({id:Kc.meta({description:"Lowercase letters, digits, `.`, `_`, `-`; starts and ends with a letter or digit; at most 128. Unique within the document."}),description:k().trim().min(1).max(1024).meta({description:`Shown to the user as the reason when this rule decides; write it for them.`}).optional(),enabled:M().meta({description:`Disabled rules are ignored.`}),priority:j().int().min(-1e3).max(1e3).meta({description:`Higher wins among rules of the same scope and enforcement. Unique per enforcement class within one document.`}),enforcement:Xc,when:ml,decision:Yc}).strict().meta({description:"One permission rule. A `guardrail` rule may only `prompt` or `deny`."}).superRefine((e,t)=>{e.enforcement===`guardrail`&&e.decision===`allow`&&t.addIssue({code:`custom`,path:[`decision`],message:`Guardrails may only prompt or deny.`})}),gl=Kc,_l=B([`builtin`,`user`]);function vl(e,t){let n=new Set,r=new Set;for(let[i,a]of e.entries()){r.has(a.id)&&t.addIssue({code:`custom`,path:[`rules`,i,`id`],message:`Rule IDs must be unique within their owning source.`}),r.add(a.id);let e=`${a.enforcement}:${a.priority}`;n.has(e)&&t.addIssue({code:`custom`,path:[`rules`,i,`priority`],message:`Priorities must be unique within each enforcement class.`}),n.add(e)}}var yl=F({schemaVersion:V(1).meta({description:`Always 1.`}),id:Kc.meta({description:"Rule set id; equals the file name without `.json`. Same format as a rule id. Must not reuse a built-in id: the built-in wins."}),name:k().trim().min(1).max(128).meta({description:`Name shown in the permission picker.`}),description:k().trim().min(1).max(1024).meta({description:`What the rule set is for.`}).optional(),source:_l.meta({description:"Always `user` for files you write."}),enabled:M().meta({description:`A disabled rule set cannot be selected.`}),rules:P(hl).min(1).max(256).meta({description:"All rules must be `overridable`. End with a catch-all rule (`when: {}`) so every call gets a deliberate decision. A rule set used by sub-agents must have no enabled `prompt` rule."})}).strict().meta({description:"A user permission rule set, `<home>/config/rule-sets/<id>.json`. Not expressible here: rule ids are unique, priorities are unique per enforcement class, and rules may not be `guardrail`."}).superRefine((e,t)=>{vl(e.rules,t);for(let[n,r]of e.rules.entries())r.enforcement===`guardrail`&&t.addIssue({code:`custom`,path:[`rules`,n,`enforcement`],message:`Rule sets may contain only overridable rules.`})}),bl=F({ruleSetId:gl.meta({description:`Id of the rule set these rules extend. They apply only while that rule set is selected.`}),rules:P(hl).max(256).meta({description:`Rules added on top of the rule set.`})}).strict().meta({description:`Extra rules bound to one rule set.`}).superRefine((e,t)=>vl(e.rules,t)),xl=F({schemaVersion:V(2).meta({description:`Always 2.`}),overlays:P(bl).max(256).meta({description:`One entry per rule set id; add rules to the existing entry. At most 256 rules in the whole document.`})}).strict().meta({description:"Permission overlays (`permissions.json`). Not expressible here: `ruleSetId` is unique per document, rule ids are unique and priorities are unique per enforcement class within each overlay, and the document holds at most 256 rules in total."}).superRefine((e,t)=>{let n=new Set,r=0;for(let[i,a]of e.overlays.entries())n.has(a.ruleSetId)&&t.addIssue({code:`custom`,path:[`overlays`,i,`ruleSetId`],message:`Overlay rule-set IDs must be unique within a document.`}),n.add(a.ruleSetId),r+=a.rules.length;r>256&&t.addIssue({code:`custom`,path:[`overlays`],message:`Permission overlay documents may contain at most 256 rules.`})}),Sl=B([`baseline`,`rule_set`,`user`,`project`,`conversation`]),Cl=F({enforcementRank:j().int().min(0).max(1),scopeRank:j().int().min(0).max(4),priority:j().int().min(-1e3).max(1e3)}).strict(),wl=F({origin:zc,path:k().min(1).max(4096),reason:k().min(1).max(4096)}).strict();F({decision:Yc,reason:k().min(1).max(4096),baseRisk:Qc,normalizedTargets:P(il).max(128),winningRuleId:Kc,winningRule:hl,winningRuleOrigin:Sl,winningRuleSetId:gl,winningRuleEnforcement:Xc,winningRulePrecedence:Cl,activeRuleSetIds:P(Kc).min(1).max(16),selectedRuleSetId:gl,ignoredOverlays:P(wl).max(16),policySnapshotHash:k().regex(/^sha256:[a-f0-9]{64}$/),suggestedRules:P(hl).max(16)}).strict();var Tl=F({id:Kc,name:k().min(1).max(128),description:k().max(1024).optional(),source:_l,enabled:M(),available:M(),diagnostic:k().max(4096).optional()}).strict().extend({rules:P(hl).max(256)});B([`user`,`project`,`conversation`]);var El=F({status:B([`missing`,`invalid`,...Gc.options]),digest:k().regex(/^sha256:[a-f0-9]{64}$/).optional(),trustedDigest:k().regex(/^sha256:[a-f0-9]{64}$/).optional(),trustedAt:k().datetime().optional(),reason:k().max(4096).optional()}).strict(),Dl=F({ruleSets:P(Tl).max(256),userOverlays:xl,projectOverlays:xl,conversationOverlays:xl.optional(),projectTrust:El,diagnostics:P(k().max(4096)).max(256)}).strict();function Ol(e,t,n,r=[]){if(e!==`user`)for(let[i,a]of t.rules.entries())a.enforcement===`guardrail`&&n.addIssue({code:`custom`,path:[...r,`rules`,i,`enforcement`],message:`${e} overlays may contain only overridable rules.`}),e===`project`&&(a.when.primaryTarget?.root===`nerve_home`||a.when.primaryTarget?.root===`nerve_data`||a.when.targets?.matcher.root===`nerve_home`||a.when.targets?.matcher.root===`nerve_data`)&&a.decision===`allow`&&n.addIssue({code:`custom`,path:[...r,`rules`,i,`when`],message:`Project overlays cannot grant broad Nerve-owned root access.`})}function kl(e){return bl.superRefine((t,n)=>Ol(e,t,n))}var Al=B([`debug`,`info`,`warn`,`error`]),jl=B([`orchestrator`,`desktop`,`web`,`cli`]),Ml=F({name:k().optional(),message:k(),stack:k().optional(),cause:k().optional()}),Nl={requestId:k().optional(),projectId:k().startsWith(`proj_`).optional(),conversationId:k().startsWith(`conv_`).optional(),agentId:k().startsWith(`agent_`).optional(),runId:k().startsWith(`run_`).optional(),toolCallId:k().startsWith(`tool_`).optional(),launchId:k().startsWith(`launch_`).optional()},Pl=F({seq:j().int().positive(),id:k().startsWith(`log_`),ts:k().datetime(),level:Al,source:jl,component:k().min(1),message:k().min(1),...Nl,durationMs:j().nonnegative().optional(),context:z(k(),N()).optional(),error:Ml.optional()}),Fl=B([`uncaughtException`,`unhandledRejection`,`childExit`,`healthFailure`,`startupExit`,`startupTimeout`,`startupError`,`previousUncleanExit`]);F({id:k().startsWith(`crash_`),ts:k().datetime(),source:jl,kind:Fl,message:k().min(1),pid:j().int().positive().optional(),exitCode:j().int().nullable().optional(),signal:k().nullable().optional(),uptimeMs:j().int().nonnegative().optional(),dataDir:k().optional(),error:Ml.optional(),outputTail:k().optional(),context:z(k(),N()).optional(),runtime:F({node:k(),platform:k(),arch:k()}).optional()});var Il=F({level:Al.optional(),source:jl.optional(),component:k().min(1).optional(),contains:k().optional(),sinceSeq:j().int().nonnegative().optional(),beforeSeq:j().int().positive().optional(),limit:j().int().positive().max(500).optional(),...Nl});Il.refine(e=>e.sinceSeq===void 0||e.beforeSeq===void 0,{message:`sinceSeq and beforeSeq cannot be combined`,path:[`beforeSeq`]}),F({logs:P(Pl),nextCursor:j().int().nonnegative(),hasMoreBefore:M()});var Ll=Il.omit({limit:!0,sinceSeq:!0,beforeSeq:!0}),Rl=F({pruned:j().int().nonnegative(),remaining:j().int().nonnegative()}),zl=F({seq:j().int().nonnegative(),ts:k().datetime(),level:Al,message:k()}).passthrough();F({level:Al.optional(),contains:k().min(1).optional(),sinceSeq:j().int().nonnegative().optional(),limit:j().int().positive().max(1e3).optional()}),F({logs:P(zl),nextCursor:j().int().nonnegative(),dropped:j().int().nonnegative()}),F({logs:P(Pl.omit({seq:!0,id:!0,ts:!0,source:!0}).extend({ts:k().datetime().optional(),source:V(`web`).optional()})).min(1).max(50)});var Bl=L([V(443),V(8443),V(1e4)]),Vl=R(`code`,[F({code:V(`not_installed`)}),F({code:V(`not_running`)}),F({code:V(`no_magic_dns`)}),F({code:V(`serve_not_enabled`),approvalUrl:k().url().optional()}),F({code:V(`permission_denied`)}),F({code:V(`port_in_use`),httpsPort:j().int()}),F({code:V(`funnel_enabled`),httpsPort:j().int()}),F({code:V(`entry_changed`)}),F({code:V(`command_failed`),detail:k()})]),Hl=R(`state`,[F({state:V(`off`)}),F({state:V(`starting`)}),F({state:V(`certificate`),url:k().url()}),F({state:V(`ready`),url:k().url()}),F({state:V(`problem`),problem:Vl})]),Ul=B([`automatic`,`manual`]),Wl=F({maxConcurrentModelRuns:j().int().min(1).max(32),maxParallelToolsPerRun:j().int().min(1).max(16),maxActiveProcesses:j().int().min(1).max(256)}),Gl=F({logicalCpuCount:j().int().positive(),effectiveCpuCount:j().int().positive(),totalMemoryMb:j().int().positive()}),Kl={maxConcurrentModelRuns:10,maxParallelToolsPerRun:3,maxActiveProcesses:16},ql=B([`auto`,`x11`,`wayland`]),Jl=B([`system`,`none`,`slight`,`medium`,`full`]),Yl=F({peers:P(k().trim().min(1))}),Xl=F({enabled:M().default(!1),httpsPort:Bl.default(443),listenerPort:j().int().min(1).max(65535).optional()}),Zl=k().trim().url(),Ql=F({network:F({host:k().trim().min(1).default(`127.0.0.1`),port:j().int().min(1).max(65535).default(3747),allowRemote:M().default(!1),mobileHttps:M().default(!1),httpsPort:j().int().min(1).max(65535).default(3748),publicUrl:Zl.optional(),trustProxy:Yl.optional(),tunnel:Xl.optional()}),diagnostics:F({loggingEnabled:M().default(!1),performanceEnabled:M().optional()}),daemon:F({startupTimeoutMs:j().int().positive().default(6e4),maxOldSpaceMb:j().int().positive().default(4096)}),resources:F({mode:Ul.default(`automatic`),...Wl.shape}).default({mode:`automatic`,...Kl}),electron:F({ozonePlatform:ql.default(`auto`),fontRenderHinting:Jl.default(`slight`)})}),$l={network:{host:`127.0.0.1`,port:3747,allowRemote:!1,mobileHttps:!1,httpsPort:3748},diagnostics:{loggingEnabled:!1},daemon:{startupTimeoutMs:6e4,maxOldSpaceMb:4096},resources:{mode:`automatic`,...Kl},electron:{ozonePlatform:`auto`,fontRenderHinting:`slight`}},eu=F({network:F({host:k().trim().min(1).optional(),port:j().int().min(1).max(65535).optional(),allowRemote:M().optional(),mobileHttps:M().optional(),httpsPort:j().int().min(1).max(65535).optional(),publicUrl:L([Zl,V(``)]).optional(),trustProxy:Yl.optional(),tunnel:F({enabled:M().optional(),httpsPort:Bl.optional()}).optional()}).optional(),diagnostics:F({loggingEnabled:M().optional(),performanceEnabled:M().optional()}).optional(),daemon:F({startupTimeoutMs:j().int().positive().optional(),maxOldSpaceMb:j().int().min(512).optional()}).optional(),resources:F({mode:Ul.optional(),maxConcurrentModelRuns:Wl.shape.maxConcurrentModelRuns.optional(),maxParallelToolsPerRun:Wl.shape.maxParallelToolsPerRun.optional(),maxActiveProcesses:Wl.shape.maxActiveProcesses.optional()}).optional(),electron:F({ozonePlatform:ql.optional(),fontRenderHinting:Jl.optional()}).optional()}),tu=F({application:eu.optional(),logging:F({level:Al.optional(),retentionDays:j().int().positive().optional(),maxBufferedLogs:j().int().positive().optional()}).optional()}),nu=F({kind:B([`settings`,`environment`,`command_line`,`development_default`,`automatic`]),name:k().optional()}),ru=B([`none`,`daemon`,`desktop`]);function iu(e){return F({activeValue:e,savedValue:e,source:nu,editable:M(),restartTarget:ru,pendingRestart:M()})}var au=iu(k()),ou=iu(j()),su=iu(M()),cu=F({application:F({network:F({host:au,port:ou,allowRemote:su,mobileHttps:su,httpsPort:ou,publicUrl:au,trustProxyPeers:iu(P(k())),tunnelEnabled:su,tunnelHttpsPort:iu(Bl)}),diagnostics:F({loggingEnabled:su,performanceEnabled:su,level:iu(Al),retentionDays:ou,maxBufferedLogs:ou}),daemon:F({startupTimeoutMs:ou,maxOldSpaceMb:ou}),resources:F({mode:iu(Ul),maxConcurrentModelRuns:ou,maxParallelToolsPerRun:ou,maxActiveProcesses:ou}),electron:F({ozonePlatform:iu(ql),fontRenderHinting:iu(Jl)})}),context:F({dataDir:k(),dataDirSource:B([`default`,`environment`]),platform:k(),packaged:M().optional(),webAssetsOverridden:M(),proxyConfigured:M(),proxyDebugEnabled:M(),resources:F({detected:Gl,recommended:Wl,effective:Wl,controlWorkConcurrency:j().int().positive()})})}),lu=16384,uu=`coding`,U=k().min(1).max(32).regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,`Name must use lowercase letters, numbers, and single hyphens`);function du(e){return new TextEncoder().encode(e).length}var fu=k().refine(e=>du(e)<=lu,{message:`Instructions must be at most ${lu} bytes`}),pu=B([`read`,`bash`,`python_exec`,`edit`,`write`,`grep`,`find`,`ls`,`ask_user`,`web_fetch`,`quick_script`]),mu=B([`plan_present`,`subagent_prompt`,`subagent_status`,`subagent_stop`,`web_search`,`web_fetch`,`python_exec`]),hu=B([`subagent_prompt`,`subagent_status`,`subagent_stop`,`async_bash`,`plan_present`]),gu=B([...pu.options,...hu.options]),_u=Nc(e=>gu.safeParse(e).success||typeof e==`string`&&/^[a-z][a-z0-9_]{1,63}$/.test(e),`Invalid tool name.`);k().min(1).max(128);var vu=[`subagent_prompt`,`subagent_status`,`subagent_stop`];B(vu);var yu=B([`idle`,`running`,`stopping`]),bu=B([`completed`,`cancelled`,`failed`,`interrupted`]);function xu(e){return vu.includes(e)}var Su=[`subagent_new`,`subagent_list`],Cu=[`explore`,`explain_image`],wu=P(B([...mu.options,...Su,...Cu])).transform(Tu);function Tu(e){let t=Su,n=Cu,r=e.filter(e=>!n.includes(e)),i=r.some(e=>xu(e)||t.includes(e));return[...new Set([...r.filter(e=>!t.includes(e)),...i?vu:[]])]}var Eu=B([`read`,`workspace_write`,`external_write`,`command`,`external_read`,`secret`,`destructive`,`agent_spawn`,`deployment`,`interaction`]),Du=B([`allow`,`deny`]),Ou=B([`path_glob`,`command_glob`,`url_glob`,`tool`]),ku=B([`never`,`tool`,`target`]),Au=/^(?:[A-Za-z][A-Za-z0-9]*|\*)(?:\.(?:[A-Za-z][A-Za-z0-9]*|\*))*$/,ju=new Set([`read`,`edit`,`write`,`grep`,`find`,`ls`]),Mu=Nc(e=>gu.safeParse(e).success,`Not a core tool. Extension tools are targeted by operation: use tool "quick_script" with the operation as the rule, for example "search.web".`),Nu=P(F({id:k().startsWith(`exception_`).max(128),tool:Mu,effect:Du,rule:k().trim().min(1).max(1024)}).superRefine((e,t)=>{let n=e.rule;/\r|\n|\0/.test(n)&&t.addIssue({code:`custom`,message:`Permission rules must be a single line.`,path:[`rule`]}),ju.has(e.tool)?(n.includes(`\\`)||n.startsWith(`/`)||/^[A-Za-z]:/.test(n)||n.split(`/`).includes(`..`))&&t.addIssue({code:`custom`,message:`Path rules must be project-relative POSIX globs.`,path:[`rule`]}):e.tool===`bash`?n===`*`&&t.addIssue({code:`custom`,message:`Bash rules must use a focused command glob.`,path:[`rule`]}):e.tool===`quick_script`?Au.test(n)||t.addIssue({code:`custom`,message:`Quick Script rules must be an operation glob such as 'namespace.items.*' (dotted path; '*' segments).`,path:[`rule`]}):e.tool===`web_fetch`?n.includes(`://`)||t.addIssue({code:`custom`,message:`Web Fetch rules must include a URL scheme glob.`,path:[`rule`]}):n!==`*`&&t.addIssue({code:`custom`,message:`Whole-tool permission rules must be '*'.`,path:[`rule`]})})).max(256).superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Duplicate permission exception id '${i.id}'`,path:[r,`id`]}),n.add(i.id)});function Pu(e){return e===`write`?`workspace_write`:e===`unknown`?`command`:e}var Fu=B([`nerve-light`,`nerve-dark`,`melange-light`,`melange-dark`,`graphite`,`indigo`]),Iu=k().regex(/^ext:[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,`must look like ext:<extension-id>/<theme-id>`).max(140),Lu=L([Fu,Iu]),Ru=`nerve-dark`,zu={"nerve-light":`light`,"nerve-dark":`dark`,"melange-light":`light`,"melange-dark":`dark`,graphite:`dark`,indigo:`dark`};function Bu(e,t){return e in zu?zu[e]:t?.(e)??zu[`nerve-dark`]}var Vu=B([`auto`,`linux`,`windows`,`macos`]),Hu=F({exceptions:Nu}),Uu=F({enabled:M().meta({description:`Turn background promotion on or off.`}),afterMs:j().int().positive().max(864e5).meta({description:`Milliseconds a command runs in the foreground before it is moved to the background.`})}),Wu=F({interpreterPath:k().trim().min(1).meta({description:`Absolute path of the Python interpreter. Omit to use the default interpreter.`}).optional()}).strict(),Gu=F({approvalProfile:U.meta({description:`Name of the lead agent profile that applies when the user approves a plan.`})}).strict(),Ku=F({shellPath:k().trim().min(1).meta({description:`Absolute path of the shell that runs commands. Omit for the default shell.`}).optional(),autoPromotion:Uu.meta({description:`Moves a foreground command that runs too long to the background instead of blocking the agent.`}),maxTimeoutMs:j().int().min(1e3).max(36e5).meta({description:`Longest time in milliseconds a command may run (1000-3600000). Default 900000.`}).default(9e5)});F({model:Hc.optional(),thinkingLevel:Vc});var qu=F({disabled:wu,bash:Ku,pythonExec:Wu,planPresent:Gu}),Ju=B([`aggressive`,`balanced`,`conservative`,`custom`]),W=B([`none`,`bell`,`chime`,`click`,`pop`,`success`,`alert`,`ping`,`pulse`,`ripple`,`sparkle`,`knock`,`signal`]),Yu={question:`bell`,planReview:`chime`,approval:`bell`,completed:`success`,failed:`alert`},Xu=F({question:W,planReview:W,approval:W,completed:W,failed:W}),Zu=F({auto:M(),profile:Ju,customTriggerPercent:j().int().min(60).max(90)}).strict(),Qu=B([`gpt-transcribe`,`gpt-4o-transcribe`,`gpt-4o-mini-transcribe`]),$u=k().trim().regex(/^[a-z]{2,3}(?:-[a-z]{2})?$/),ed=k().trim().min(1).max(100).regex(/^[^<>\r\n]+$/),td=F({model:Qu,languages:P($u).max(10),vocabulary:P(ed).max(50)}),nd=F({enabled:M(),model:Hc.nullable()}),rd=F({defaultAgentProfile:U.optional(),defaultPermissionRuleSetId:gl,defaultModel:Hc.optional(),defaultThinkingLevel:Vc,application:Ql,ui:F({zoomLevel:j().int().min(-8).max(8)}),desktop:F({closeToTray:M(),headerType:Vu}),notifications:F({systemEnabled:M(),soundsEnabled:M(),events:Xu}),conversationTitles:nd.default({enabled:!1,model:null}),transcription:td,compaction:Zu,logging:F({level:Al,retentionDays:j().int().positive(),maxBufferedLogs:j().int().positive()}),retry:F({enabled:M(),maxRetries:j().int().nonnegative(),baseDelayMs:j().int().positive()}),permissions:Hu,tools:qu,skills:F({disabled:P(k().min(1)),nerve:F({enabled:P(k().min(1))}),agentBrowser:F({enabled:P(k().min(1))})}),scopedModels:P(Hc)}),id={defaultPermissionRuleSetId:`autonomous`,defaultThinkingLevel:`off`,application:$l,ui:{zoomLevel:0},desktop:{closeToTray:!1,headerType:`auto`},notifications:{systemEnabled:!0,soundsEnabled:!0,events:Yu},conversationTitles:{enabled:!1,model:null},transcription:{model:`gpt-4o-transcribe`,languages:[],vocabulary:[]},compaction:{auto:!0,profile:`balanced`,customTriggerPercent:80},logging:{level:`info`,retentionDays:14,maxBufferedLogs:2e3},retry:{enabled:!0,maxRetries:3,baseDelayMs:2e3},permissions:{exceptions:[]},tools:{disabled:[`plan_present`,...vu],bash:{autoPromotion:{enabled:!0,afterMs:12e4},maxTimeoutMs:9e5},pythonExec:{},planPresent:{approvalProfile:`coding`}},skills:{disabled:[],nerve:{enabled:[]},agentBrowser:{enabled:[]}},scopedModels:[]},ad=I({conversationTitles:nd.optional(),application:eu.optional(),ui:F({zoomLevel:j().int().min(-8).max(8).optional()}).optional(),desktop:F({closeToTray:M().optional(),headerType:Vu.optional()}).optional(),notifications:F({systemEnabled:M().optional(),soundsEnabled:M().optional(),events:F({question:W.optional(),planReview:W.optional(),approval:W.optional(),completed:W.optional(),failed:W.optional()}).optional()}).optional(),transcription:F({model:Qu.optional(),languages:P($u).max(10).optional(),vocabulary:P(ed).max(50).optional()}).optional(),logging:F({level:Al.optional(),retentionDays:j().int().positive().optional(),maxBufferedLogs:j().int().positive().optional()}).optional(),permissions:F({exceptions:Nu.optional()}).optional()}),od=`Can you look at why the websocket reconnect backoff never resets after a successful reconnect?`,sd=R(`category`,[F({category:V(`success`),title:k(),latencyMs:j()}),F({category:B([`timeout`,`auth`,`rate limit`,`invalid output`,`unavailable`])})]),cd=/(?:^|[_-])(authorization|cookie|credential|password|passwd|secret|token|api[_-]?key|private[_-]?key)(?:$|[_-])/i,ld=/^[a-z][a-z0-9+.-]*:\/\/[^/\s]*@/i,ud=65536,dd=16384,fd=1048576,pd=12,md=256;function hd(e,t){return Ic(yd,H()).superRefine((n,r)=>{let i;try{i=new TextEncoder().encode(JSON.stringify(n)).byteLength}catch{r.addIssue({code:`custom`,message:`public data must be JSON-safe`});return}i>e&&r.addIssue({code:`custom`,message:`public data may not exceed ${e} bytes`}),bd(n,r,[],0,t)})}var gd=hd(ud,dd),_d=hd(ud,dd),vd=hd(fd,void 0);Ic(yd,z(k().min(1).max(128),_d)).superRefine((e,t)=>{bd(e,t,[],0,dd),Object.keys(e).length>md&&t.addIssue({code:`custom`,message:`public objects may contain at most ${md} fields`})});function yd(e){return Array.isArray(e)?e.map(yd):!e||typeof e!=`object`?e:Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>[e,yd(t)]))}function bd(e,t,n,r,i){if(r>pd){t.addIssue({code:`custom`,path:n,message:`public data is too deep`});return}if(typeof e==`string`){i!==void 0&&e.length>i&&t.addIssue({code:`custom`,path:n,message:`public text is too long`}),ld.test(e)&&t.addIssue({code:`custom`,path:n,message:`credential-bearing URLs are forbidden`});return}if(Array.isArray(e)){e.length>md&&t.addIssue({code:`custom`,path:n,message:`public arrays are too large`}),e.forEach((e,a)=>bd(e,t,[...n,a],r+1,i));return}if(!e||typeof e!=`object`)return;let a=Object.entries(e);a.length>md&&t.addIssue({code:`custom`,path:n,message:`public objects are too large`});for(let[e,o]of a)cd.test(e)&&t.addIssue({code:`custom`,path:[...n,e],message:`secret-like public data keys are forbidden`}),bd(o,t,[...n,e],r+1,i)}var xd=[`workbench_server`];function Sd(e,t,n,r={}){return{name:t,payloadSchema:e.transform(e=>n.parse(e)),delivery:r.delivery??`sequenced`,supersedable:r.supersedable??!1,allowedSourceRoles:r.allowedSourceRoles??xd,coalescing:r.delivery===`ephemeral`?r.coalescing:void 0,scope:r.scope??[]}}function Cd(e,t,n={}){return Sd(gd,e,t,n)}function G(e,t,n={}){return Sd(vd,e,t,n)}var wd=F({id:k(),name:k(),directory:k(),createdAt:k().datetime(),updatedAt:k().datetime()}),Td=I({level:B([`error`,`warning`]),code:k().min(1),message:k().min(1),pointer:k().optional()}),Ed=Td.extend({path:k().min(1)}),Dd=Rc,Od=B([`enabled`,`pending_consent`,`incompatible`,`invalid`,`shadowed`]),kd=I({kind:B([`network`,`account`,`model`,`frame`,`tools`,`namespace`,`ui`,`code`]),text:k(),broad:M().optional()}),Ad=I({update:M(),contentHash:k().min(1),items:P(kd),text:k()}),jd=I({network:P(k()),models:P(k()),frame:P(k()),accounts:P(k()),namespaces:z(k(),P(k())),tools:P(k()),ui:P(k()),credentials:P(k()).optional()}),Md=I({id:k().min(1),source:Dd,state:Od,path:k().optional(),name:k().optional(),description:k().optional(),version:k().optional(),sdkVersion:k().optional(),shadowedBy:Dd.optional(),diagnostics:P(Td),adds:P(kd).optional(),consent:Ad.optional(),trustState:B([`needs_review`,`declined`]).optional()}),Nd=k().regex(/^[A-Za-z0-9_-]+$/).max(64),Pd=k().regex(/^[A-Za-z0-9_-]+$/).max(64),Fd=Lc,Id=R(`scope`,[I({scope:V(`user`)}),I({scope:V(`project`),projectId:k().min(1)})]),Ld=B([`stdio`,`http`]),Rd=I({type:Ld.optional(),command:k().optional(),args:P(k()).optional(),env:z(k(),k()).optional(),cwd:k().optional(),url:k().optional(),headers:z(k(),k()).optional(),enabled:M().optional(),description:k().optional(),timeout:j().optional()}),zd=Gc,Bd=B([`connected`,`idle`,`failed`,`disabled`,`needs_review`,`declined`]),Vd=I({kind:B([`env`,`secret`]),name:k(),field:B([`command`,`args`,`env`,`cwd`,`url`,`headers`]),key:k().optional()}),Hd=I({transport:Ld,command:k().optional(),args:P(k()).optional(),url:k().optional(),cwd:k().optional(),env:P(I({name:k(),value:k(),changesExecution:M()})).optional(),headers:P(I({name:k(),value:k()})).optional(),inheritsEnvironment:M().optional(),references:P(Vd)}),Ud=I({name:Nd,scope:Fd,status:zd,digest:k(),grants:Hd,sends:P(k()),notes:P(k()).optional()}),Wd=I({name:Pd,set:M()}),Gd=I({name:Nd,scope:Fd,inherited:M(),replacesUser:M(),shadowed:M(),transport:Ld,description:k().optional(),entry:Rd,state:Bd,error:k().optional(),review:zd,enabled:M(),server:I({name:k(),version:k()}).optional(),toolCount:j().int().nonnegative().optional(),secrets:P(Wd)}),Kd=I({path:k(),exists:M(),problems:P(k())}),qd=I({servers:P(Gd),file:Kd}),Jd=I({target:Id,name:Nd,entry:Rd,previousName:Nd.optional(),secrets:z(Pd,k()).optional(),replaceInvalid:M().optional()}),Yd=R(`status`,[I({status:V(`saved`),server:Gd}),I({status:V(`invalid`),problems:P(k())}),I({status:V(`file_invalid`),problems:P(k())})]),Xd=I({target:Id,name:Nd}),Zd=I({removed:M()}),Qd=R(`status`,[I({status:V(`ok`),server:I({name:k(),version:k()}).optional(),instructions:k().optional(),tools:P(I({name:k(),title:k().optional(),description:k().optional(),inputSchema:z(k(),N())})),resources:P(I({uri:k(),name:k(),description:k().optional(),mimeType:k().optional()}))}),I({status:V(`failed`),error:k()}),I({status:V(`refused`),state:Bd.or(V(`not_found`)),reason:k()})]),$d=I({disconnected:M()}),ef=Ud.nullable(),tf="a URL path such as `/oauth/callback`: segments of letters, digits and `._~-` between single slashes, no `.` or `..` segments, no query or fragment, at most 200 characters",nf=k().max(200,`Must be ${tf}.`).regex(/^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]*$/,`Must be ${tf}.`).refine(e=>!e.split(`/`).some(e=>/^\.{1,2}$/.test(e)),`Must be ${tf}.`),rf=zc,af=k().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/).max(64),of=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,sf=k().regex(/^[a-z][A-Za-z0-9]*$/).max(64),cf={label:k().min(1),description:k().optional(),section:k().optional(),scopes:P(rf).min(1).optional(),visibleWhen:I({field:sf,equals:L([k(),M()])}).optional(),advanced:M().optional()},lf=R(`type`,[I({...cf,type:V(`boolean`),default:M()}),I({...cf,type:V(`string`),default:k().optional(),format:B([`url`,`text`]).optional(),placeholder:k().optional(),maxLength:j().int().positive().optional()}),I({...cf,type:V(`number`),default:j().optional(),min:j().optional(),max:j().optional(),step:j().positive().optional(),unit:k().optional()}),I({...cf,type:V(`enum`),default:k(),options:P(I({value:k(),label:k(),description:k().optional()})).min(1)}),I({...cf,type:V(`account`),kind:L([k().min(1),P(k().min(1)).min(1)]).optional(),platform:k().regex(of).optional()}).refine(e=>e.kind===void 0!=(e.platform===void 0),{message:"An account field names either `kind` or `platform`."}),I({...cf,type:V(`model`),capability:V(`vision`).optional(),reasoning:M().optional()}),I({...cf,type:V(`imageModel`)}),I({...cf,type:V(`agentProfile`)}),I({...cf,type:V(`permissionRuleSet`)})]);function uf(e){return e.kind===void 0?[]:typeof e.kind==`string`?[e.kind]:e.kind}var df=I({platform:k().regex(of),scopes:P(k().min(1)).optional(),origins:P(k().min(1)).optional()}),ff=I({sections:P(I({id:k().min(1),title:k().min(1),description:k().optional()})).optional(),fields:z(sf,lf)}),pf=sf,mf=R(`scheme`,[I({scheme:V(`basic`),user:sf,secret:pf.optional()}),I({scheme:V(`bearer`),secret:pf.optional()}),I({scheme:V(`header`),name:k().regex(/^[A-Za-z0-9-]+$/),secret:pf.optional()}),I({scheme:V(`query`),name:k().min(1).max(128),secret:pf.optional()})]),hf=I({label:k().min(1),help:k().optional(),multiline:M().optional()}),gf=`secret`;function _f(e){return e.secrets?{...e.secrets}:e.secret?{[gf]:e.secret}:{}}var vf=k().min(1).max(2048),yf=I({type:V(`oauth2`),flows:P(B([`authorization_code`,`device_code`])).min(1).optional(),discovery:vf.optional(),authorizationUrl:vf.optional(),tokenUrl:vf.optional(),deviceAuthorizationUrl:vf.optional(),revocationUrl:vf.optional(),scopes:P(k().min(1)).optional(),clientIdField:sf.optional(),clientSecret:pf.optional(),authorizationParams:z(k(),k()).optional(),redirectPath:nf.optional(),userinfo:I({url:vf,identity:z(sf,k().min(1))}).optional()}),bf=e=>e.clientIdField??`clientId`,xf=new Set([`boolean`,`string`,`number`,`enum`]),Sf=I({kind:k().min(1),label:k().min(1),platform:k().regex(of).optional(),fields:z(sf,lf).superRefine((e,t)=>{for(let[n,r]of Object.entries(e))xf.has(r.type)||t.addIssue({code:`custom`,path:[n,`type`],message:`Account kinds cannot have ${r.type} fields: the account dialog cannot show them. Use string, number, boolean or enum.`})}),secret:hf.optional(),secrets:z(pf,hf).optional(),auth:L([mf,P(mf).min(1)]).optional(),provider:L([yf,V(`extension`)]).optional(),signInOrigins:P(k().min(1)).optional(),origins:P(k().min(1)).optional(),test:V(!0).optional()});function Cf(e,t,n,r){let i=(e,t)=>r.addIssue({code:`custom`,path:[`provider`,e],message:t});e.auth!==void 0&&r.addIssue({code:`custom`,path:[`auth`],message:"A kind with an `oauth2` provider sends its access token as a bearer token; remove `auth`."});let a=t.flows??[`authorization_code`];!t.tokenUrl&&!t.discovery&&i(`tokenUrl`,"Give `tokenUrl` or `discovery`."),a.includes(`authorization_code`)&&!t.authorizationUrl&&!t.discovery&&i(`authorizationUrl`,"Give `authorizationUrl` or `discovery`."),a.includes(`device_code`)&&!t.deviceAuthorizationUrl&&!t.discovery&&i(`deviceAuthorizationUrl`,"Give `deviceAuthorizationUrl` or `discovery`.");let o=bf(t);e.fields[o]?.type!==`string`&&i(`clientIdField`,`The client id needs a string field '${o}' (give it a default to ship a client id).`),t.clientSecret&&!n.includes(t.clientSecret)&&i(`clientSecret`,`'${t.clientSecret}' is not one of the kind's secrets.`);for(let e of n)e!==t.clientSecret&&i(`clientSecret`,`The secret '${e}' is not used: an oauth2 kind has only its client secret.`)}function wf(e,t){e.auth!==void 0&&t.addIssue({code:`custom`,path:[`auth`],message:'A kind with `provider: "extension"` signs requests in its credential provider; remove `auth`.'}),e.origins?.length||t.addIssue({code:`custom`,path:[`origins`],message:'A kind with `provider: "extension"` needs `origins`: the credential is sent only there.'})}var Tf=(e,t)=>{e.secret&&e.secrets&&t.addIssue({code:`custom`,path:[`secrets`],message:"Declare either `secret` or `secrets`, not both."});let n=Object.keys(_f(e)),r=e.provider;r===`extension`?wf(e,t):r?Cf(e,r,n,t):n.length===0&&t.addIssue({code:`custom`,path:[`secret`],message:"An account kind needs a `secret` or at least one `secrets` entry."});for(let[r,i]of(e.auth===void 0?[]:Array.isArray(e.auth)?e.auth:[e.auth]).entries())i.secret===void 0&&n.length>1?t.addIssue({code:`custom`,path:[`auth`,r,`secret`],message:`Name the secret this injection uses (${n.join(`, `)}).`}):i.secret!==void 0&&!n.includes(i.secret)&&t.addIssue({code:`custom`,path:[`auth`,r,`secret`],message:`'${i.secret}' is not one of the kind's secrets (${n.join(`, `)}).`})},Ef=Sf.superRefine(Tf),Df=Sf.omit({kind:!0}).superRefine(Tf),Of=I({network:P(k().min(1)).optional(),models:P(B([`image`,`vision`,`text`])).optional(),frame:P(B([`chat.startConversation`])).optional()}),kf=B([`blocks`,`eye`,`globe`,`image-plus`,`layers`,`workflow`]),Af=R(`type`,[I({type:V(`lucide`),name:kf}),I({type:V(`svg`),src:k().startsWith(`data:image/svg+xml,`)})]),jf=I({id:af,name:k().min(1),description:k(),icon:Af,source:Rc,settingsVersion:j().int().positive(),enabledByDefault:M(),permissions:Of,contributes:I({namespaces:P(I({id:k().min(1),label:k().min(1).optional(),enabledBy:L([k(),P(k())]).optional(),requiresAccount:k().optional(),helper:M().optional(),summary:k()})),tools:P(I({name:k().min(1),label:k().min(1),description:k()})),skills:P(k())})});function Mf(e){return e.scopes??[`user`,`project`,`conversation`]}var Nf=I({version:j().int().positive().meta({description:`Settings version the extension declares for these settings.`}),enabled:M().meta({description:`Turn the extension on or off.`}).optional(),settings:z(k(),N()).meta({description:`Extension settings by field key, as the extension documents them.`}).optional()});I({schemaVersion:V(1),revision:j().int().nonnegative().max(2**53-1),extensions:z(af,Nf)});var Pf=I({recommendations:z(af,Nf).meta({description:`Extension entries used unless the conversation chooses otherwise.`}).optional(),requirements:z(af,Nf).meta({description:`Extension entries locked while the profile is applied.`}).optional()}),Ff=B([...mu.exclude(vu).options,`subagents`,`quick_script`]);B([...Ff.options,`bash`]);var If=z(k().trim().min(1).max(256),M()).meta({description:`Skill name to true (enable) or false (disable). At most 512 entries.`}).refine(e=>Object.keys(e).length<=512,`At most 512 skill overrides are allowed.`),Lf=F({file:If,nerve:If,agentBrowser:If}).strict();function Rf(e){return F({enabled:M().optional(),settings:e.optional()}).strict()}var zf=Rf(Ys()),Bf={python_exec:Rf(Wu),web_search:zf,web_fetch:zf,plan_present:Rf(Gu),subagents:zf,quick_script:zf,bash:F({settings:Ku}).strict()},Vf=Hc.strict(),Hf=e=>Object.keys(e).length>0,Uf=`Automatic compaction of the conversation context.`,Wf=`Retry of failed model requests.`,Gf=I({auto:M().meta({description:`Compact the conversation automatically.`}),profile:Ju.meta({description:"How early automatic compaction triggers. `custom` uses `customTriggerPercent`."}),customTriggerPercent:j().int().min(60).max(90).meta({description:"Context usage percent (60-90) that triggers compaction when `profile` is `custom`."})}).meta({description:Uf}),Kf=I({enabled:M().meta({description:`Retry failed model requests.`}),maxRetries:j().int().nonnegative().meta({description:`Maximum retries per request.`}),baseDelayMs:j().int().positive().meta({description:`Initial delay in milliseconds before the first retry.`})}).meta({description:Wf}),qf=Ku.extend({autoPromotion:Ku.shape.autoPromotion.strict().meta({description:`Moves a foreground command that runs too long to the background instead of blocking the agent.`}),maxTimeoutMs:Ku.shape.maxTimeoutMs.removeDefault()}).strict(),Jf=`Whether skills of each source are enabled unless a per-skill override says otherwise.`,Yf=I({file:M().meta({description:`Default for skills from files (user and project skill folders).`}),nerve:M().meta({description:`Default for Nerve's built-in skills.`}),agentBrowser:M().meta({description:`Default for agent-browser skills.`})}).meta({description:Jf}),Xf=Lf.partial().extend({defaults:Yf.partial().meta({description:Jf}).optional()}).strict().meta({description:"Per-skill overrides by source (`file`, `nerve`, `agentBrowser`) and source defaults."}),Zf=I({defaults:M().meta({description:`Default for servers without a named entry.`}).optional(),servers:z(Nd,M()).meta({description:`Per-server on/off by server name.`}).optional()}).meta({description:"Which MCP servers the agent may use, by server name. A named entry beats `defaults`; a server with no decision follows its own `enabled` in mcp.json (default on)."}),Qf=`Tool entry; at least one field is required.`;function $f(e){return I({enabled:M().meta({description:`Turn the tool on or off.`}).optional(),settings:e.meta({description:`Tool settings; include only fields to set.`}).optional()}).refine(Hf,`Empty tool entry`).meta({description:Qf})}var ep=I({enabled:M().meta({description:`Turn the tool on or off.`})}).meta({description:`Tool toggle.`}),tp={python_exec:$f(Wu.partial()),web_search:ep,quick_script:ep,web_fetch:ep,bash:I({settings:qf.partial().refine(Hf).meta({description:`Shell settings; include only fields to set, at least one. The bash tool is always on.`})}).meta({description:Qf})},np=I({...tp,plan_present:$f(Gu.partial().refine(Hf)),subagents:ep.meta({description:`Delegation to sub-agents on or off (lead only).`})}).partial().meta({description:`Tool toggles and settings by tool name. Every entry must be non-empty.`}),rp=I(tp).partial().meta({description:`Tool toggles and settings by tool name. Every entry must be non-empty.`}),ip=I({model:Vf.meta({description:`Model this sub-agent launches with.`}).optional(),reasoningLevel:Vc.optional()}),ap=ip,op=ip.extend({enabled:M().meta({description:`Make this sub-agent profile available to the lead or not.`}).optional()}).refine(Hf).meta({description:`Launch settings for one sub-agent profile. At least one field is required.`}),sp={model:Vf.meta({description:"Model to use. Take `provider` and `modelId` from the user's configured models."}).optional(),reasoningLevel:Vc.optional(),permissionRuleSetId:gl.meta({description:"Id of a built-in or user permission rule set. Sub-agents need a rule set without `prompt` rules."}).optional(),compaction:Gf.partial().meta({description:Uf}).optional(),retry:Kf.partial().meta({description:Wf}).optional(),tools:rp.optional(),skills:Xf.optional(),mcpServers:Zf.optional()},cp=I(sp),K=I({...sp,tools:np.optional(),subagents:z(U,op).meta({description:`Lead only. Launch settings by sub-agent profile name: turn a teammate on or off or give it a model.`}).optional()}),lp=I({python_exec:I({enabled:M(),settings:Wu}),web_search:Bf.web_search.required({enabled:!0}),quick_script:Bf.quick_script.required({enabled:!0}).optional(),web_fetch:ep,bash:I({settings:qf})}),up=cp.extend({reasoningLevel:Vc,permissionRuleSetId:gl,compaction:Gf,retry:Kf,tools:lp,skills:Lf.extend({defaults:Yf}).strict(),mcpServers:Zf.optional()}),dp=k().regex(/^[a-f0-9]{64}$/),fp=j().int().nonnegative().max(2**53-1),pp={name:U,source:Rc,sourceDigest:dp,instructions:fu},mp=K.extend({skills:Lf.partial().strict().meta({description:"Per-skill overrides by source (`file`, `nerve`, `agentBrowser`). Profiles cannot set `defaults`."}).optional(),mcpServers:I({servers:z(Nd,M()).meta({description:`Per-server on/off by server name.`}).optional()}).meta({description:"Per-server overrides by server name. Profiles cannot set `defaults`."}).optional()}),hp=I({...pp,recommendations:mp,requirements:mp,extensions:Pf.optional()}).superRefine(Ap),gp=I({schemaVersion:V(1).meta({description:`Always 1.`}),revision:fp.meta({description:`Write counter managed by Nerve. Keep the existing value.`}),overrides:K.meta({description:`Settings object. Every field is optional; an omitted field falls back to the lower layer.`})}).meta({description:"Agent preferences (`agent.json`) at user or project scope: default model, reasoning, permissions, tools and skills."}),_p=I({id:k().min(1),kind:B([`profile`,`plan-approval`])}),vp=I({instructions:fu.optional(),systemPrompt:k().optional()});gp.extend({context:vp.optional(),appliedProfile:hp.nullable(),lastTransition:_p.optional()}),I({schemaVersion:V(1),revision:fp,overrides:cp,appliedProfile:hp.nullable(),frozenDefaults:up,context:vp.optional(),lastTransition:_p.optional()}).superRefine((e,t)=>{if(e.appliedProfile)for(let n of[`recommendations`,`requirements`])cp.safeParse(e.appliedProfile[n]).success||t.addIssue({code:`custom`,path:[`appliedProfile`,n],message:`Child-prohibited profile contribution`})});var yp=I({schemaVersion:V(1).meta({description:`Always 1.`}),name:U.meta({description:"Profile name; equals the file name without `.json`. Lowercase letters and digits in hyphen-separated words, at most 32 characters."}),label:k().trim().min(1).max(80).meta({description:`Display name, 1-80 characters.`}).optional(),whenToUse:k().trim().min(1).max(200).meta({description:`1-200 characters. Sub-agent profiles: the line the lead chooses the teammate by; name the kind of task and the outcome.`}),enabled:M().meta({description:"Sub-agent profiles: `false` makes the profile unavailable to leads by default; the user can enable it per conversation. Default `true`."}).optional(),usableBy:B([`lead`,`subagent`,`both`]).meta({description:"Who may use the profile. `subagent` and `both` profiles may only use settings that sub-agents support."}),instructions:fu.meta({description:`Text added to the agent's system prompt, at most 16384 UTF-8 bytes. May be empty for a settings-only profile.`}),recommendations:mp.meta({description:`Settings object: values used unless the conversation chooses otherwise.`}).optional(),requirements:mp.meta({description:"Settings object: values enforced while the profile is applied. The same setting may not appear in both `recommendations` and `requirements`."}).optional(),extensions:Pf.meta({description:`Extension entries the profile recommends or requires, by extension id. Use only when asked, with the extension's documented settings.`}).optional()}).meta({description:"Agent profile file. Not expressible here: `recommendations` and `requirements` must not set the same setting (also `extensions.<id>.settings.<key>` and `enabled`). A `subagent` or `both` profile may not use `tools.plan_present`, `tools.subagents` or `subagents`."}).superRefine((e,t)=>{if(Ap(e,t),e.usableBy!==`lead`)for(let n of[`recommendations`,`requirements`])e[n]&&!cp.safeParse(e[n]).success&&t.addIssue({code:`custom`,path:[n],message:`Profile must be child-compatible`})}),bp=I({schemaVersion:V(1),revision:fp,overrides:I({defaultAgentProfile:U.optional(),scopedModels:P(Vf).optional()})}),xp=I({model:Vf.optional(),reasoningLevel:Vc.optional(),permissionRuleSetId:gl.optional(),agentProfile:U.optional()});I({schemaVersion:V(1),entries:z(k().min(1),xp.extend({observedDigest:dp}))});var Sp=I({scope:zc,scopeId:k().optional(),document:k().min(1),path:k(),schemaVersion:j().int().optional(),code:k().min(1),pointer:k(),message:k().optional(),affectedCapability:k().min(1),recoveryChoices:P(B([`retry`,`reload`,`repair`,`reset`,`upgrade`]))}),Cp=I({source:B([`builtin`,`user`,`project`,`process`,`recommendation`,`conversation`,`requirement`,`frozen`,`launch`]),profile:U.optional(),adjusted:M().optional()}).superRefine((e,t)=>{e.source!==`requirement`&&e.source!==`recommendation`||e.profile||t.addIssue({code:`custom`,path:[`profile`],message:`Profile contributions must identify the controlling profile`})}),wp=I({code:B([`model-required`,`reasoning-adjusted`,`unsupported-reasoning`,`missing-reference`]),pointer:k()}),Tp=I({settings:K,provenance:z(k().regex(/^\/(?:[^~]|~[01])*$/),Cp),diagnostics:P(wp)});function Ep(e){return e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}function Dp(e){let t=[];function n(e,r){let i=/(?:^|\/)model$/.test(r)||r===`/tools/bash/settings/autoPromotion`;if(e!==void 0&&(i||typeof e!=`object`||!e||Array.isArray(e)))t.push([r,e]);else if(e)for(let[t,i]of Object.entries(e))n(i,`${r}/${Ep(t)}`)}return n(e,``),t}function Op(e={},t={}){let n=Dp(e).map(([e])=>e),r=Dp(t).map(([e])=>e);function i(e,t){if(e===t||e.startsWith(t+`/`)||t.startsWith(e+`/`)||e.startsWith(`/mcpServers/defaults`)&&t.startsWith(`/mcpServers/servers/`)||t.startsWith(`/mcpServers/defaults`)&&e.startsWith(`/mcpServers/servers/`))return!0;let n=e=>e.startsWith(`/skills/defaults/`)?e.slice(17):e.startsWith(`/skills/`)?e.split(`/`)[2]:void 0;return n(e)!==void 0&&n(e)===n(t)&&(e.startsWith(`/skills/defaults/`)||t.startsWith(`/skills/defaults/`))}return n.filter(e=>r.some(t=>i(e,t)))}function kp(e){let t=[];for(let[n,r]of Object.entries(e?.requirements??{})){let i=e?.recommendations?.[n];if(i){i.enabled!==void 0&&r.enabled!==void 0&&t.push(`/extensions/${n}/enabled`);for(let e of Object.keys(r.settings??{}))i.settings&&Object.hasOwn(i.settings,e)&&t.push(`/extensions/${n}/settings/${e}`)}}return t}function Ap(e,t){for(let n of kp(e.extensions))t.addIssue({code:`custom`,path:[`extensions`,`requirements`],message:`Recommendation/requirement overlap: ${n}`});for(let n of Op(e.recommendations,e.requirements))t.addIssue({code:`custom`,path:[`requirements`],message:`Recommendation/requirement overlap: ${n}`})}var jp={reasoningLevel:id.defaultThinkingLevel,permissionRuleSetId:id.defaultPermissionRuleSetId,compaction:id.compaction,retry:id.retry,tools:{python_exec:{enabled:!0,settings:{}},web_search:{enabled:!0},web_fetch:{enabled:!0},quick_script:{enabled:!0},bash:{settings:id.tools.bash},plan_present:{enabled:!1,settings:id.tools.planPresent},subagents:{enabled:!1}},skills:{defaults:{file:!0,nerve:!1,agentBrowser:!1},file:{},nerve:{},agentBrowser:{}}};function Mp(e){return e.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}function Np(e,t,n){let r=Mp(t),i=e;for(let e of r.slice(0,-1))Object.hasOwn(i,e)||Object.defineProperty(i,e,{value:{},writable:!0,enumerable:!0,configurable:!0}),i=i[e];Object.defineProperty(i,r.at(-1),{value:structuredClone(n),writable:!0,enumerable:!0,configurable:!0})}function Pp(e){let t=structuredClone(K.parse(e));return delete t.subagents,t.tools&&(delete t.tools.subagents,delete t.tools.plan_present),cp.parse(t)}function Fp(e){let t=e.appliedProfile;if(Op(t?.recommendations,t?.requirements).length)throw Error(`Overlapping profile contributions`);let n=e.role===`child`?cp:K;if(t&&(n.parse(t.recommendations),n.parse(t.requirements)),e.role===`lead`&&(e.frozenDefaults||e.launch))throw Error(`Child-only creation inputs`);if(e.frozenDefaults&&e.launch)throw Error(`An existing child's launch choices are already frozen`);let r=[];if(e.frozenDefaults)r.push({source:`frozen`,value:up.parse(e.frozenDefaults)});else{for(let[t,n]of[[`builtin`,{...jp,subagents:Object.fromEntries(Object.entries(e.subagentDefaults??{}).map(([e,t])=>[e,{enabled:t}]))}],[`user`,e.user],[`project`,e.project],[`process`,e.process]])n&&r.push({source:t,value:e.role===`child`?Pp(K.parse(n)):K.parse(n)});t&&r.push({source:`recommendation`,value:t.recommendations})}e.conversation&&r.push({source:`conversation`,value:n.parse(e.conversation)}),e.launch&&r.push({source:`launch`,value:ap.parse(e.launch)}),t&&r.push({source:`requirement`,value:t.requirements});let i={settings:{tools:{python_exec:{settings:{}}},skills:{file:{},nerve:{},agentBrowser:{}}},provenance:{},diagnostics:[]};for(let{source:e,value:n}of r)for(let[r,a]of Dp(n))Np(i.settings,r,a),i.provenance[r]={source:e,...(e===`recommendation`||e===`requirement`)&&t?{profile:t.name}:{}};for(let n of[`file`,`nerve`,`agentBrowser`]){let a=e.frozenDefaults?Object.keys(e.frozenDefaults.skills[n]):[...new Set(e.eligibleSkills?.[n]??r.flatMap(e=>Object.keys(e.value.skills?.[n]??{})))];e.frozenDefaults&&i.settings.skills&&(i.settings.skills[n]={});for(let e of a)for(let a of[...r].reverse()){let r=a.value.skills?.[n],o=(r&&Object.hasOwn(r,e)?r[e]:void 0)??a.value.skills?.defaults?.[n];if(o!==void 0){let r=`/skills/${n}/${e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`;Np(i.settings,r,o),i.provenance[r]={source:a.source,...a.source===`requirement`||a.source===`recommendation`?{profile:t?.name}:{}};break}}}Lp(i,r,e,t?.name);let{model:a,reasoningLevel:o}=i.settings;if(a||i.diagnostics.push({code:`model-required`,pointer:`/model`}),a&&o&&e.clampThinking){let t=e.clampThinking(a,o);if(t!==o){let e=i.provenance[`/reasoningLevel`].source,n=i.provenance[`/model`].source;e===`requirement`||e===n?i.diagnostics.push({code:`unsupported-reasoning`,pointer:`/reasoningLevel`}):(i.settings.reasoningLevel=t,i.provenance[`/reasoningLevel`].adjusted=!0,i.diagnostics.push({code:`reasoning-adjusted`,pointer:`/reasoningLevel`}))}}if(e.referenceAvailable)for(let[t,n]of Dp(i.settings))(t.endsWith(`/model`)||t.endsWith(`/profileId`)||t.endsWith(`/permissionRuleSetId`)||t.endsWith(`/approvalProfile`))&&!e.referenceAvailable(t,n)&&i.diagnostics.push({code:`missing-reference`,pointer:t});return i}var Ip=e=>e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`);function Lp(e,t,n,r){for(let t of Object.keys(e.provenance))t.startsWith(`/mcpServers/servers/`)&&delete e.provenance[t];e.settings.mcpServers&&delete e.settings.mcpServers.servers;let i=new Set(n.eligibleMcpServers??t.flatMap(e=>Object.keys(e.value.mcpServers?.servers??{})));for(let n of i)for(let i of[...t].reverse()){let t=i.value.mcpServers,a=t?.servers,o=(a&&Object.hasOwn(a,n)?a[n]:void 0)??(t&&`defaults`in t?t.defaults:void 0);if(o===void 0)continue;let s=`/mcpServers/servers/${Ip(n)}`;Np(e.settings,s,o),e.provenance[s]={source:i.source,...i.source===`requirement`||i.source===`recommendation`?{profile:r}:{}};break}}var q=I({expectedRevision:j().int().nonnegative().max(2**53-1),expectedDigest:L([dp,V(`missing`)]),changes:K,resets:P(k().regex(/^\/overrides(?:\/(?:[^~/]|~[01])*)+$/))});function Rp(e,t,n={},r=`lead`){let i=q.parse(t),a=r===`child`?cp:K,o=a.parse(e);a.parse(i.changes),a.parse(n);let s=[...Dp(i.changes).map(([e])=>`/overrides${e}`),...i.resets],c=(e,t)=>e===t||e.startsWith(t+`/`)||t.startsWith(e+`/`),l=Dp(n).map(([e])=>`/overrides${e}`);for(let[e,t]of s.entries()){if(s.slice(e+1).some(e=>c(t,e)))throw Error(`Overlapping mutation operations`);let r=l.some(e=>{let n=/^\/overrides\/skills\/defaults\/([^/]+)$/.exec(e);return n&&c(t,`/overrides/skills/${n[1]}`)}),a=l.includes(`/overrides/mcpServers/defaults`)&&t.startsWith(`/overrides/mcpServers/servers`);if(l.some(e=>c(t,e))||r||a||Op(i.changes,n).length)throw Error(`Required field is not editable`)}let u=o;for(let e of i.resets){let t=Mp(e).slice(1),n=e.slice(10);if([`/model`,`/tools/bash/settings/autoPromotion`].some(e=>n.startsWith(e+`/`))||/^\/subagents\/[^/]+\/model\//.test(n))throw Error(`Reset must target a canonical merge unit`);let r=a;for(let e of t){for(;r instanceof dc;)r=r.unwrap();if(r instanceof Zs&&Object.hasOwn(r.shape,e))r=r.shape[e];else if(r instanceof ac)es(r.keyType,e),r=r.valueType;else throw Error(`Unknown reset path`)}function i(e,n){let r=t[n];n===t.length-1?delete e[r]:Object.hasOwn(e,r)&&e[r]&&typeof e[r]==`object`&&(i(e[r],n+1),Object.keys(e[r]).length||delete e[r])}i(u,0)}for(let[e,t]of Dp(i.changes))Np(u,e,t);return a.parse(u)}var zp=R(`scope`,[I({scope:V(`user`)}),I({scope:V(`project`),projectId:k().min(1)})]),Bp=R(`scope`,[...zp.options,I({scope:V(`conversation`),conversationId:k().min(1)})]),Vp=I({revision:gp.shape.revision,digest:q.shape.expectedDigest}),Hp=Vp.extend({scope:Bp,path:k().min(1),generation:j().int().nonnegative().max(2**53-1)}),Up=P(Sp),Wp=I({status:V(`conflict`),current:Vp.optional(),diagnostics:Up}),Gp=I({status:V(`unavailable`),diagnostics:Up.min(1)}),Kp=R(`status`,[Wp,Gp,I({status:V(`invalid`),diagnostics:Up.min(1)})]),qp=I({scope:Bp}),Jp=R(`status`,[I({status:V(`available`),source:Hp,overrides:K,inherited:K,trustState:Gc.optional()}),Gp]),Yp=q.extend({scope:Bp}).superRefine((e,t)=>{try{Rp({},{expectedRevision:e.expectedRevision,expectedDigest:e.expectedDigest,changes:e.changes,resets:e.resets})}catch{t.addIssue({code:`custom`,message:`Invalid, overlapping or non-canonical mutation paths`})}}),Xp=L([I({status:V(`saved`),source:Hp,overrides:K}),Kp]),Zp=I({status:V(`available`),conversationId:k().min(1),role:B([`lead`,`child`]),appliedProfile:hp.nullable(),resolution:Tp,diagnostics:Up,sources:P(Hp)}),Qp=I({conversationId:k().min(1)}),$p=R(`status`,[Zp,Gp.extend({conversationId:k().min(1)})]),em=I({expectedRevision:q.shape.expectedRevision,expectedDigest:q.shape.expectedDigest,changes:bp.shape.overrides,resets:P(B([`/overrides/defaultAgentProfile`,`/overrides/scopedModels`]))}).superRefine((e,t)=>{(new Set(e.resets).size!==e.resets.length||e.resets.some(t=>Object.hasOwn(e.changes,t.slice(11))))&&t.addIssue({code:`custom`,message:`Overlapping creation preference operations`})}),tm=Hp.extend({scope:zp}),nm=I({scope:zp}),rm=R(`status`,[I({status:V(`available`),source:tm,overrides:bp.shape.overrides,inherited:bp.shape.overrides,effective:bp.shape.overrides.required({defaultAgentProfile:!0}),diagnostics:Up}),Gp]),im=em.safeExtend({scope:zp}),am=L([I({status:V(`saved`),source:tm,overrides:bp.shape.overrides}),Kp]),om=I({name:U,digest:dp}),sm=I({projectId:k().min(1),agentProfile:om.optional(),overrides:K.optional()}),cm=R(`status`,[I({status:V(`available`),appliedProfile:hp,resolution:Tp,inherited:K,diagnostics:Up}),Gp]),lm=ap,um=I({targetProfile:om,expectedRevision:q.shape.expectedRevision,expectedDigest:q.shape.expectedDigest,transitionId:k().min(1),choices:lm.optional()}),dm=I({targetDefinition:yp,changedFields:P(I({pointer:k(),before:N(),after:N(),beforeSource:Cp.optional(),afterSource:Cp.optional()})),unchangedRequirements:P(I({pointer:k(),value:N()})),targetProfile:om,source:Rc,expectedRevision:q.shape.expectedRevision,expectedDigest:q.shape.expectedDigest,recommendations:K,requirements:K,resolution:Tp}),fm=I({status:V(`refresh_required`),reason:B([`target_changed`,`target_unavailable`,`target_untrusted`,`requirement_conflict`,`configuration_changed`]),diagnostics:Up,preview:dm.optional()}),pm=I({conversationId:k().min(1),profile:U}),mm=L([I({status:V(`ready`),preview:dm}),fm,Gp]),hm=um.omit({choices:!0,transitionId:!0}).extend({conversationId:k().min(1),action:B([`switch`,`reapply`])}),gm=L([I({status:V(`applied`),source:Hp.extend({scope:Bp.options[2]}),effective:$p}),fm,Gp]),_m=R(`decision`,[I({kind:V(`plan_review`),decision:V(`approve`),confirmation:um,feedback:k().optional()}),I({kind:V(`plan_review`),decision:V(`reject`),feedback:k().optional()})]),vm=L([I({status:V(`resolved`)}),gm]),ym=F({operation:k(),targets:P(k()),targetsKnown:M(),count:j().int().positive()}),bm=F({method:k(),targets:P(k()).optional(),authorizedAs:k().optional(),summary:k().optional(),outcome:B([`completed`,`failed`,`denied`]),error:k().optional(),durationMs:j().nonnegative(),edit:F({files:j().int().nonnegative(),added:j().int().nonnegative(),removed:j().int().nonnegative(),diff:k(),diffFile:k().optional(),dryRun:M().optional()}).optional()}).passthrough(),xm=`sdk_calls`,Sm=R(`phase`,[F({phase:V(`started`),seq:j().int().nonnegative(),method:k(),summary:k().optional()}),F({phase:V(`finished`),seq:j().int().nonnegative(),method:k(),summary:k().optional(),outcome:B([`completed`,`failed`,`denied`]),error:k().optional(),durationMs:j().nonnegative()})]),Cm=F({handle:k(),path:k(),bytes:j().int().nonnegative(),mediaType:k(),width:j().int().positive().optional(),height:j().int().positive().optional()}),wm=F({status:B([`completed`,`failed`,`timed_out`,`cancelled`,`memory_limit`]),error:k().optional(),durationMs:j().nonnegative(),memoryUsedBytes:j().nonnegative().optional(),outputTruncated:M().optional(),hostCalls:P(bm),artifacts:P(Cm).optional(),created:P(k()).optional()}).passthrough(),Tm=I({toolCallId:k().min(1),toolName:k().min(1),argumentsDigest:dp,executionTargetDigest:dp,policyAuthorityDigest:dp}),Em=z(k().min(1),j().int().nonnegative().max(2**53-1));I({binding:Tm,requestGenerations:Em,policyGenerations:Em});var Dm=B([`supervising`,`awaiting_approval`,`ready`,`running`,`awaiting_input`]),Om=B([`model`,`user`]),km=I({decision:B([`allow`,`approval`,`deny`]),approval:Tm.optional(),reason:k().optional(),effectiveRisk:Ic(e=>e===`network`?`external_read`:e,Eu).optional(),matchedRule:H().optional(),suggestedRules:P(H()),operations:P(ym).optional(),authority:H()}),Am=F({option:k().optional(),text:k().optional()}),jm=I({kind:V(`configuration_blocked`),decision:B([`retry`,`cancel`])}),Mm=I({diagnostics:P(Sp).min(1)});function Nm(e,t,n,r={}){let i={kind:V(e),request:t,resolution:n.optional(),resolutionRequestId:r.strict?k().min(1).optional():k().optional()};return{kind:e,resolution:n,interaction:r.strict?I(i):F(i)}}var Pm=F({reason:k(),suggestedRules:P(H())}),Fm=F({kind:V(`approval`),decision:B([`approve`,`deny`]),persistScope:B([`conversation`,`project`,`user`]).optional()}),Im=F({kind:V(`user_input`),answers:z(k(),L([k(),P(k()),Am])),dismissed:V(!0).optional()}),Lm=F({label:k().min(1).max(200),description:k().optional(),recommended:M().optional()}),Rm=F({questions:P(F({id:k().min(1).max(40).regex(/^[a-z0-9_-]+$/),question:k(),context:k().optional(),recommendation:k().optional(),options:P(Lm).max(6).superRefine((e,t)=>{new Set(e.map(e=>e.label)).size!==e.length&&t.addIssue({code:`custom`,message:`Option labels must be unique`}),e.filter(e=>e.recommended).length>1&&t.addIssue({code:`custom`,message:`Only one option may be recommended`})}).optional()})).min(1).max(5).superRefine((e,t)=>{new Set(e.map(e=>e.id)).size!==e.length&&t.addIssue({code:`custom`,message:`Question ids must be unique`})})});function zm(e){if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return Array.isArray(t.questions)?{...t,questions:t.questions.map((e,t)=>e&&typeof e==`object`&&!Array.isArray(e)?{...e,id:e.id===void 0?`q${t+1}`:e.id}:e)}:!(`questions`in t)&&typeof t.question==`string`?{questions:[{...t,id:`answer`}]}:e}function Bm(e){return Rm.parse(zm(e))}var Vm=I({targetProfile:om,expectedRevision:q.shape.expectedRevision,expectedDigest:q.shape.expectedDigest,assetId:k(),path:k(),title:k().optional(),summary:k().optional(),content:k().optional()}),Hm=Nm(`approval`,Pm,Fm),Um=Nm(`user_input`,Ic(zm,Rm),Im),Wm=Nm(`plan_review`,Vm,_m),Gm=Nm(`configuration_blocked`,Mm,jm,{strict:!0});Gm.interaction;var Km=R(`kind`,[Hm.resolution,Um.resolution,Wm.resolution,Gm.resolution]),qm=R(`kind`,[Hm.interaction,Um.interaction,Wm.interaction,Gm.interaction]),Jm=F({id:k(),conversationId:k(),turnId:k(),providerCallId:k().nullable(),assistantEventId:k().nullable(),contentIndex:j().int().nonnegative().nullable(),origin:Om,toolName:k(),arguments:z(k(),H()),state:Dm,supervision:km.nullable(),interaction:qm.nullable(),executionClaim:k().nullable(),updatedAt:k().datetime()}).superRefine((e,t)=>{let n=e.supervision?.approval;n&&(n.toolCallId!==e.id||n.toolName!==e.toolName)&&t.addIssue({code:`custom`,path:[`supervision`,`approval`],message:`Approval binding belongs to a different tool call`}),e.interaction?.kind===`configuration_blocked`&&!e.interaction.resolution&&e.state!==`awaiting_input`&&t.addIssue({code:`custom`,path:[`state`],message:`Unresolved configuration-blocked calls must await input`});let r=e.providerCallId!==null&&e.assistantEventId!==null&&e.contentIndex!==null,i=e.providerCallId===null&&e.assistantEventId===null&&e.contentIndex===null;(e.origin===`model`?!r:!i)&&t.addIssue({code:`custom`,message:`Tool-call references contradict its origin`})}),Ym=B([`user`,`parent_conversation`,`system`]),Xm=B([`next_turn`,`specific_execution`,`next_execution`]),Zm=B([`completed`,`failed`,`cancelled`,`timed_out`,`interrupted`]),Qm=R(`subtype`,[F({subtype:V(`task_result`),producer:k(),task:R(`kind`,[F({kind:V(`bash`),id:k(),exitCode:j().int().nullable()}),F({kind:V(`subagent`),id:k(),assignmentId:k()})]),outcome:Zm,text:k(),assetIds:P(k())}),F({subtype:V(`user_intervention`),producer:k(),text:k()}),F({subtype:V(`notification`),producer:k(),text:k()})]),$m=F({inputId:k(),conversationId:k(),acceptanceSequence:j().int().positive(),source:Ym,senderConversationId:k().nullable(),content:L([k(),Qm]),deliveryTarget:Xm,targetExecutionId:k().nullable(),wakeWhenIdle:M(),acceptedAt:k().datetime()}).superRefine((e,t)=>{e.source===`system`!=(typeof e.content!=`string`)&&t.addIssue({code:`custom`,message:`System inputs require a notice; other sources require text`}),e.source!==`parent_conversation`&&e.senderConversationId!==null&&t.addIssue({code:`custom`,message:`Only parent inputs may have a sender conversation`}),e.source===`parent_conversation`&&e.senderConversationId===null&&t.addIssue({code:`custom`,message:`Parent inputs require a sender`}),e.deliveryTarget===`specific_execution`&&e.targetExecutionId===null&&t.addIssue({code:`custom`,message:`Specific execution requires a target`})}),eh=F({conversationId:k(),inputId:k(),text:k(),deliveryTarget:Xm.optional(),targetExecutionId:k().nullable().optional(),source:B([`user`,`parent_conversation`]),senderConversationId:k().optional(),wakeWhenIdle:M().optional()}).superRefine((e,t)=>{e.source===`parent_conversation`&&!e.senderConversationId&&t.addIssue({code:`custom`,message:`Parent inputs require a sender`}),e.source===`user`&&e.senderConversationId!==void 0&&t.addIssue({code:`custom`,message:`User inputs cannot have a sender conversation`}),e.deliveryTarget===`specific_execution`&&!e.targetExecutionId&&t.addIssue({code:`custom`,message:`Specific execution requires a target`})}),th=B([`running`,`completed`,`failed`,`timed_out`,`cancelled`,`lost`]),nh=F({id:k(),conversationId:k(),toolCallId:k(),command:k(),workingDirectory:k(),status:th,processRef:k().nullable(),exitCode:j().int().nullable(),startedAt:k().datetime(),finishedAt:k().datetime().nullable()}),rh=F({conversationId:k(),bashId:k(),offset:j().int().nonnegative().optional(),limit:j().int().positive().max(65536).optional()}),ih=F({bash:nh,page:F({text:k(),offset:j().int().nonnegative(),nextOffset:j().int().nonnegative(),totalBytes:j().int().nonnegative()})}),ah=F({id:k(),revision:j().int().positive(),reason:B([`manual`,`threshold`,`overflow`]),status:B([`queued`,`running`,`stopping`,`completed`,`failed`,`cancelled`]),startedAt:k().datetime(),endedAt:k().datetime().optional(),executionId:k().optional(),headEventId:k().nullable(),attempt:L([V(1),V(2)]),summaryPreview:k().max(65536),eventId:k().optional(),errorMessage:k().optional()}),oh=B([`idle`,`running`,`waiting`,`failed`,`interrupted`]),sh=F({id:k(),projectId:k(),parentConversationId:k().nullable(),parentToolCallId:k().nullable(),headEventId:k().nullable(),title:k(),status:oh,statusEventSequence:j().int().nonnegative(),statusClearedAt:k().datetime().nullable(),paused:M(),nextInputSequence:j().int().positive(),pinnedAt:k().datetime().nullable(),completedAt:k().datetime().nullable(),lastUserMessageAt:k().datetime().nullable(),createdAt:k().datetime(),updatedAt:k().datetime()}),ch=F({conversationId:k(),model:Hc,reasoningLevel:Vc,systemPrompt:k().nullable(),instructions:fu.nullable(),permissionRuleSetId:k(),agentProfile:U,workingDirectory:k()});ch.pick({conversationId:!0,systemPrompt:!0,instructions:!0,workingDirectory:!0}).partial({systemPrompt:!0,instructions:!0});var lh=ch.partial({model:!0,reasoningLevel:!0,permissionRuleSetId:!0,agentProfile:!0,systemPrompt:!0,instructions:!0}),uh=F({provider:k().min(1),resourceKey:k().min(1),kind:k().min(1),relationship:B([`referenced`,`created`]),url:k().url().refine(e=>e.startsWith(`https://`)).nullable(),container:k(),identifier:k()}),dh=sh.omit({headEventId:!0,statusEventSequence:!0,nextInputSequence:!0}).extend({lastParentPromptAt:k().datetime().nullable().optional(),references:P(uh),childCount:j().int().nonnegative(),pendingWork:M(),pendingInput:F({conversationId:k(),conversationTitle:k(),toolCallId:k(),kind:B([`approval`,`user_input`,`plan_review`,`configuration_blocked`])}).nullable(),agentProfile:U.optional(),model:Hc.optional(),reasoningLevel:Vc.optional(),permissionRuleSetId:k().optional()}),fh=F({conversation:sh,lastSequence:j().int().nonnegative(),config:lh,toolCalls:P(Jm),queue:P($m),asyncBash:P(nh),children:P(dh),compaction:ah.nullable().optional()}),ph=B([`source_text`,`process_output`,`script_output`,`search_matches`,`file_listing`,`search_summaries`,`network_prose`,`resource_detail`,`mutation_acknowledgement`,`lifecycle_state`,`delegation_report`,`primary_file_result`,`human_response`,`vision_explanation`,`terminal_outcome`,`conservative_fallback`]),mh=B([`unchanged`,`head`,`tail`,`head_tail`,`item_aware`,`continuation_aware`,`artifact_index`,`terminal_outcome`]),hh=B([`primary_result`,`supporting_data`,`overflow_recovery`]),gh=R(`kind`,[F({kind:V(`agent_file`),path:k().min(1)}).strict(),F({kind:V(`managed_reference`),logicalPath:k().min(1)}).strict(),F({kind:V(`metadata_only`),location:k().min(1).optional()}).strict()]),_h=F({kind:B([`markdown`,`text`,`json`,`jsonl`,`image`,`binary`,`directory_manifest`]),mediaType:k().min(1),encoding:V(`utf-8`).optional()}).strict();F({version:V(1),id:k().min(1),role:hh,access:gh,availability:B([`available`,`unavailable`]),format:_h,size:F({bytes:j().int().nonnegative(),lines:j().int().nonnegative().optional(),items:j().int().nonnegative().optional(),itemKind:k().min(1).optional()}).strict(),recommendedTools:P(B([`read`,`grep`,`explain_image`])).max(3),label:k().min(1).max(256),unavailableReason:B([`missing`,`unsafe_path`,`symlink`,`not_regular`,`unsupported_format`,`validation_failed`]).optional()}).strict().superRefine((e,t)=>{e.availability===`unavailable`&&!e.unavailableReason&&t.addIssue({code:`custom`,path:[`unavailableReason`],message:`Unavailable artifacts require a reason.`}),e.availability===`available`&&e.unavailableReason&&t.addIssue({code:`custom`,path:[`unavailableReason`],message:`Available artifacts cannot have an unavailable reason.`}),e.format.encoding===`utf-8`&&![`markdown`,`text`,`json`,`jsonl`,`directory_manifest`].includes(e.format.kind)&&t.addIssue({code:`custom`,path:[`format`,`encoding`],message:`UTF-8 encoding is valid only for readable text formats.`}),e.access.kind!==`agent_file`&&e.recommendedTools.length>0&&t.addIssue({code:`custom`,path:[`recommendedTools`],message:`Only agent files may recommend inspection tools.`})});var vh=F({kind:B([`line`,`byte`,`item`,`event`,`task`]),original:j().int().nonnegative(),displayed:j().int().nonnegative(),omitted:j().int().nonnegative()}),yh=R(`kind`,[F({kind:V(`line`),nextOffset:j().int().nonnegative(),displayedStart:j().int().nonnegative(),displayedEnd:j().int().nonnegative(),total:j().int().nonnegative()}),F({kind:V(`byte`),nextByteOffset:j().int().nonnegative(),displayedStart:j().int().nonnegative(),displayedEnd:j().int().nonnegative(),total:j().int().nonnegative()}),F({kind:V(`cursor`),cursorName:k().min(1),value:L([k(),j()]),direction:B([`before`,`after`])}),F({kind:V(`page_token`),parameter:k().min(1),value:k()})]),bh=F({version:V(1),profile:ph,strategy:mh,terminalOutcomePrecedence:M(),fastPath:M(),recovery:B([`none`,`artifact`,`complete_payload`]),artifactRoles:P(hh),counts:P(vh),originalTextBytes:j().int().nonnegative(),displayedTextBytes:j().int().nonnegative(),originalTextLines:j().int().nonnegative(),displayedTextLines:j().int().nonnegative(),continuation:P(yh).optional()}).strict(),xh=R(`type`,[F({type:V(`text`),text:k()}),F({type:V(`image`),mimeType:k().min(1),byteLength:j().int().nonnegative().safe(),digest:k().regex(/^[a-f0-9]{64}$/),resultContentBlockIndex:j().int().nonnegative().safe()})]);F({version:V(1),blocks:P(xh).max(256)}).strict();var Sh=B([`single`,`concurrent`]),Ch=j().int().min(1).max(65535),wh=F({kind:V(`project`),projectId:k().startsWith(`proj_`)}),Th={parentFolderId:k().startsWith(`launchfolder_`).nullable().meta({description:"Id of the containing folder, or `null` for the top level."}),order:j().int().nonnegative().meta({description:`Position among siblings (folders and definitions with the same parent): exactly 0, 1, ..., n-1. Renumber siblings when inserting or removing.`})},Eh={id:k().startsWith(`launchdef_`).meta({description:"Starts with `launchdef_`; unique in the file. Use a readable suffix, e.g. `launchdef_web`."}),label:k().min(1).meta({description:"Display name, and the name `launches.*` calls select it by; without it the command is the name. Give each definition a distinct name."}).optional(),command:k().refine(e=>e.trim().length>0,`Command must be nonblank`).meta({description:"Shell command, not blank. There is no environment field; put variables in the command (`PORT=3000 pnpm dev`)."}),cwd:k().min(1).meta({description:`Working directory relative to the project directory. Default: the project directory. Prefer relative paths.`}).optional(),port:Ch.meta({description:`Port (1-65535) the process serves, shown to the user.`}).optional(),runPolicy:Sh.meta({description:"`single`: one run at a time. `concurrent`: several runs at once. Default `single`."}).default(`single`),createdAt:k().datetime().meta({description:`ISO 8601 date-time of creation.`}),updatedAt:k().datetime().meta({description:`ISO 8601 date-time of the last change; update it when you change the definition.`})},Dh=F({...Eh,scope:wh,...Th}),Oh=Dh.extend({scope:F({kind:V(`project`)}).strict().meta({description:'Always `{ "kind": "project" }`.'})}).strict().meta({description:`A saved project command.`}),kh=F({id:k().startsWith(`launchfolder_`).meta({description:"Starts with `launchfolder_`; unique in the file."}),label:k().min(1).refine(e=>e===e.trim(),`Folder label must be trimmed`).meta({description:`Folder name without leading or trailing spaces. Unique among sibling folders, ignoring case.`}),...Th}).strict().meta({description:`Organizes definitions; passes no settings to them.`}),Ah=R(`kind`,[F({kind:V(`folder`),id:k().startsWith(`launchfolder_`)}),F({kind:V(`definition`),id:k().startsWith(`launchdef_`)})]);F({version:V(1),definitions:P(F({...Eh,scope:F({kind:V(`project`),projectId:k().optional()}).strict().transform(({kind:e})=>({kind:e}))}).strict())}).strict(),F({version:V(2).meta({description:`Always 2.`}),folders:P(kh).meta({description:`All folders; may be empty.`}),definitions:P(Oh).meta({description:`All launch definitions; may be empty.`})}).strict().meta({description:"Launch definitions of a project, `<project>/.nerve/launches/definitions.json`. Not expressible here: ids are unique across folders and definitions; every `parentFolderId` names an existing folder and folders form no cycles; `order` values among the children of one parent (folders and definitions together) are exactly 0..n-1; sibling folder labels are unique ignoring case."}).superRefine((e,t)=>{let n=[...e.folders,...e.definitions],r=new Set,i=new Map(e.folders.map(e=>[e.id,e])),a=new Map,o=e=>t.addIssue({code:`custom`,message:e});for(let e of n){r.has(e.id)&&o(`Duplicate ID: ${e.id}`),r.add(e.id),e.parentFolderId!==null&&!i.has(e.parentFolderId)&&o(`Missing parent: ${e.parentFolderId}`);let t=a.get(e.parentFolderId)??[];t.push(e),a.set(e.parentFolderId,t)}for(let e of a.values()){e.map(e=>e.order).sort((e,t)=>e-t).some((e,t)=>e!==t)&&o(`Sibling orders must be contiguous and unique`);let t=new Set;for(let n of e.filter(e=>e.id.startsWith(`launchfolder_`))){let e=n.label.trim().toLowerCase();t.has(e)&&o(`Duplicate sibling folder name`),t.add(e)}}for(let t of e.folders){let e=new Set([t.id]),n=t.parentFolderId;for(;n!==null&&i.has(n);){if(e.has(n)){o(`Folder cycle`);break}e.add(n),n=i.get(n).parentFolderId}}});var jh=F({projectId:k().startsWith(`proj_`),revision:k(),folders:P(kh),definitions:P(Dh)}),Mh=F({label:Eh.label,command:Eh.command,cwd:Eh.cwd,port:Eh.port,runPolicy:Eh.runPolicy,sourceLaunchId:k().startsWith(`launch_`).optional(),parentFolderId:Th.parentFolderId.default(null),beforeSibling:Ah.nullable().default(null)}),Nh=Mh.omit({sourceLaunchId:!0,parentFolderId:!0,beforeSibling:!0}).extend({runPolicy:Sh}),Ph=B([`starting`,`running`,`ready`,`stopping`,`completed`,`failed`,`timed_out`,`cancelled`]),Fh=B([`foreground`,`background`]),Ih=F({readyUrl:k().url().optional(),readyOnUrl:M().optional(),readyPattern:k().optional(),timeoutMs:j().int().nonnegative().optional(),outcome:B([`pending`,`ready`,`timeout`,`exited`,`unavailable`,`none`]),matched:k().optional(),readyAt:k().datetime().optional()}),Lh=F({protocol:B([`tcp`,`tcp6`]),address:k().min(1),port:j().int().positive().max(65535),pid:j().int().positive(),identity:k().min(1),processName:k().min(1).optional()}),Rh=F({protocol:B([`tcp`,`tcp6`]),address:k().min(1),port:j().int().positive().max(65535),pid:j().int().positive().optional(),processGroupId:j().int().positive().optional(),processStartTimeTicks:j().int().nonnegative().optional(),detectedAt:k().datetime()}),zh=R(`kind`,[F({kind:V(`linux`),startTimeTicks:j().int().nonnegative()}),F({kind:V(`darwin`),startFingerprint:k().startsWith(`darwin:`)}),F({kind:V(`win32`),creationDate:k().startsWith(`win32:`)})]),Bh=F({version:V(2),platform:k().min(1),childPid:j().int().positive(),processGroupId:j().int().positive().optional(),detached:M(),shell:M(),containment:B([`job-object`,`process-group`]),spawnedAt:k().datetime(),identity:zh,listeningPorts:P(Rh).optional(),capabilities:F({identity:M(),processTree:M(),listeningPorts:M(),detail:k().optional()})}),Vh=F({keys:P(k().min(1)).default([]),persisted:M(),redacted:V(!0).default(!0)}),Hh=F({totalBytes:j().int().nonnegative(),retainedBytes:j().int().nonnegative(),omittedBytes:j().int().nonnegative(),totalLines:j().int().nonnegative(),retainedLines:j().int().nonnegative(),omittedLines:j().int().nonnegative(),headMaxBytes:j().int().positive(),tailMaxBytes:j().int().positive(),truncated:M(),tailPath:k().min(1).optional()}),Uh=F({id:k().startsWith(`launch_`),definitionId:k().startsWith(`launchdef_`).optional(),name:k().min(1).optional(),displayName:k().min(1).optional(),groupId:k().startsWith(`launchgrp_`).optional(),groupName:k().min(1).optional(),projectId:k().startsWith(`proj_`).optional(),cwd:k().min(1),command:k().min(1),envInfo:Vh.optional(),status:Ph,readiness:Ih,stdoutPath:k().min(1),stderrPath:k().min(1),combinedPath:k().min(1).optional(),logsPath:k().min(1),startedAt:k().datetime(),updatedAt:k().datetime(),finishedAt:k().datetime().optional(),exitCode:j().int().nullable().optional(),signal:k().nullable().optional(),error:k().optional(),timeoutMs:j().int().positive().optional(),restartedFromLaunchId:k().startsWith(`launch_`).optional(),restartRootLaunchId:k().startsWith(`launch_`).optional(),restartGeneration:j().int().nonnegative().optional(),runtime:Bh.optional(),outputRetention:Hh.optional(),visibility:Fh.default(`background`)}),Wh=B([`SIGTERM`,`SIGINT`,`SIGKILL`]),Gh=F({definitionId:k().startsWith(`launchdef_`).optional(),definitionRunPolicy:Sh.optional(),name:k().min(1).optional(),displayName:k().min(1).optional(),groupId:k().startsWith(`launchgrp_`).optional(),groupName:k().min(1).optional(),projectId:k().startsWith(`proj_`).optional(),cwd:k().min(1),command:k().min(1),env:z(k(),k()).optional(),readyUrl:k().url().optional(),readyOnUrl:M().optional(),readyPattern:k().min(1).optional(),readyTimeoutMs:j().int().nonnegative().max(6e4).optional(),timeoutMs:j().int().positive().max(864e5).optional()});F({signal:Wh.optional(),timeoutMs:j().int().positive().max(3e4).optional(),reason:k().min(1).optional()}),F({removed:P(k().startsWith(`launch_`))});var Kh=F({seq:j().int().positive(),ts:k().datetime(),stream:B([`stdout`,`stderr`]),level:B([`info`,`warn`,`error`]),line:k(),raw:F({start:j().int().nonnegative(),end:j().int().nonnegative(),terminatorBytes:j().int().nonnegative().max(2),fidelity:B([`captured`,`reconstructed`])}).optional()}),qh=F({mode:B([`recent`,`errors`,`warnings`,`since_cursor`,`first_failure`]).optional(),sinceSeq:j().int().nonnegative().optional(),beforeSeq:j().int().nonnegative().optional(),contains:k().optional(),regex:k().optional(),contextLines:j().int().nonnegative().max(20).optional(),limit:j().int().positive().max(500).optional()}).superRefine((e,t)=>{let n=e.mode??`recent`;n===`since_cursor`&&e.beforeSeq!==void 0&&t.addIssue({code:`custom`,path:[`beforeSeq`],message:`since_cursor cannot use beforeSeq.`}),n!==`since_cursor`&&e.sinceSeq!==void 0&&t.addIssue({code:`custom`,path:[`sinceSeq`],message:`${n} cannot use sinceSeq.`}),n===`first_failure`&&e.beforeSeq!==void 0&&t.addIssue({code:`custom`,path:[`beforeSeq`],message:`first_failure cannot use a directional cursor.`})}),Jh=F({launch:Uh,events:P(Kh),nextCursor:j().int().nonnegative(),firstSeq:j().int().positive().optional(),lastSeq:j().int().positive().optional(),hasMoreBefore:M(),hasMoreAfter:M(),olderBeforeSeq:j().int().positive().optional(),futureSinceSeq:j().int().nonnegative().optional(),originalEventCount:j().int().nonnegative().optional(),displayedEventCount:j().int().nonnegative().optional(),omittedEventCount:j().int().nonnegative().optional(),streamArtifacts:F({stdoutPath:k().min(1),stderrPath:k().min(1),eventsPath:k().min(1),combinedPath:k().min(1).optional(),fidelity:B([`captured`,`reconstructed`])}).optional(),mode:k(),previewPath:k().min(1).optional(),truncated:M().optional(),outputRetention:Hh.optional()}),Yh=L([F({type:V(`text`),text:k()}),F({type:V(`image`),data:k(),mimeType:k()})]),Xh=B([`head`,`tail`,`line`,`head_tail`]),Zh=F({truncated:M(),direction:Xh.optional(),originalBytes:j().nonnegative().optional(),displayedBytes:j().nonnegative().optional(),omittedBytes:j().nonnegative().optional(),originalChars:j().nonnegative().optional(),displayedChars:j().nonnegative().optional(),omittedChars:j().nonnegative().optional(),originalLines:j().nonnegative().optional(),displayedLines:j().nonnegative().optional(),omittedLines:j().nonnegative().optional(),truncatedLines:j().nonnegative().optional(),maxBytes:j().positive().optional(),maxLines:j().positive().optional(),maxLineChars:j().positive().optional(),partialLine:M().optional()}).passthrough(),Qh=F({kind:B([`full_output`,`raw_result`,`fetched_content`,`transcript`]),path:k().min(1),label:k().optional(),bytes:j().nonnegative().optional(),chars:j().nonnegative().optional(),lines:j().nonnegative().optional()}).passthrough(),$h=F({id:k().min(1).optional(),role:B([`primary_result`,`supporting_data`,`overflow_recovery`]),path:k().min(1).optional(),logicalPath:k().min(1).optional(),format:F({kind:B([`markdown`,`text`,`json`,`jsonl`,`image`,`binary`,`directory_manifest`]),mediaType:k().min(1),encoding:V(`utf-8`).optional()}),bytes:j().int().nonnegative().optional(),lines:j().int().nonnegative().optional(),items:j().int().nonnegative().optional(),itemKind:k().min(1).optional(),label:k().min(1).max(256),recommendedTools:P(B([`read`,`grep`,`explain_image`])).max(3)}).refine(e=>!!(e.path||e.logicalPath),{message:`Artifact claims require a path or logicalPath.`}),eg=F({capped:M(),direction:V(`tail`),maxChars:j().positive(),maxChunks:j().positive(),totalChars:j().nonnegative().optional(),displayedChars:j().nonnegative().optional(),omittedChars:j().nonnegative().optional(),totalLines:j().nonnegative().optional(),displayedLines:j().nonnegative().optional(),omittedLines:j().nonnegative().optional()}).passthrough(),tg=F({execution:Zh.optional(),storage:Zh.extend({rawResultPath:k().optional()}).optional(),model:Zh.extend({contentKind:B([`content_blocks`,`formatted_text`]).optional()}).optional(),live:eg.optional(),artifacts:P(L([$h,Qh])).optional(),continuation:F({nextOffset:j().optional(),nextByteOffset:j().optional(),hint:k().optional()}).passthrough().optional()}).passthrough(),ng=F({truncated:M().optional(),omittedLines:j().optional(),omittedChars:j().optional(),omittedBytes:j().optional(),truncatedLines:j().optional(),direction:B([`head`,`tail`,`line`,`head_tail`]).optional(),partialLine:M().optional(),nextOffset:j().optional(),nextByteOffset:j().optional(),maxLines:j().optional(),maxBytes:j().optional(),originalChars:j().optional(),displayedChars:j().optional(),maxLineChars:j().optional(),byteOffset:j().optional(),byteLimit:j().optional(),rawResultPath:k().optional()}).passthrough(),rg=F({bytes:j().optional(),lines:j().optional(),displayedBytes:j().optional(),displayedLines:j().optional(),truncated:M().optional(),omittedLines:j().optional(),omittedChars:j().optional(),omittedBytes:j().optional(),truncatedLines:j().optional(),direction:B([`head`,`tail`,`line`,`head_tail`]).optional(),maxLineChars:j().optional(),savedTo:k().optional()}).passthrough(),ig=F({stdout:rg.optional(),stderr:rg.optional(),combined:rg.optional()}).passthrough(),ag=F({diff:k().optional(),firstChangedLine:j().optional(),lineEnding:L([V(`
|
|
55
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Za(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Za(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Qa=new Set([`type`,`properties`,`required`,`additionalProperties`]),$a=[`oneOf`,`anyOf`];function eo(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function to(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Qa.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??eo(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}u(n,r,e.length===1?e[0]:to(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=eo(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function no(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Qa)if(t in e)return;let n=t.filter(e=>$a.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=to(t);else{let e=n[0],i=$a.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>to([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ka(e,r))}function ro(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Ka(i,s),Ka(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Za(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])no(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Ka(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,u(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ao(t,`input`,e.processors),output:ao(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function T(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return T(r.element,n);if(r.type===`set`)return T(r.valueType,n);if(r.type===`lazy`)return T(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return T(r.innerType,n);if(r.type===`intersection`)return T(r.left,n)||T(r.right,n);if(r.type===`record`||r.type===`map`)return T(r.keyType,n)||T(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:T(r.in,n)||T(r.out,n);if(r.type===`object`){for(let e in r.shape)if(T(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(T(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(T(e,n))return!0;return!!(r.rest&&T(r.rest,n))}return!1}var io=(e,t={})=>n=>{let r=qa({...n,processors:t});return w(e,r),Xa(r,e),ro(r,e)},ao=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=qa({...i??{},target:a,io:t,processors:n});return w(e,o),Xa(o,e),ro(o,e)},oo=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},so=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},co=(e,t)=>{oo(e,`minimum`,t),so(e,`maximum`,t)},lo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},uo=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},fo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},po=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},mo=(e,t)=>oo(e,`minimum`,t.minimum),ho=(e,t)=>so(e,`maximum`,t.maximum),go=e=>(t,n)=>{po(t,n.format);let[r,i]=e[n.format];oo(t,`minimum`,r),so(t,`maximum`,i)},_o={greater_than:(e,t)=>oo(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>so(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>lo(e,t.value),number_format:go(me),bigint_format:go(he),min_length:mo,max_length:ho,length_equals:(e,t)=>co(e,t.length),min_size:mo,max_size:ho,size_equals:(e,t)=>co(e,t.size),string_format:(e,t)=>{po(e,t.format),t.pattern&&uo(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>fo(e,t.mime)};function E(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)_o[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&oo(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&oo(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&so(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&so(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&lo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&fo(t,i.mime);for(let e of i.patterns??[])uo(t,e);return t}var vo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},yo=new Map([[ur,Kt],[fr,qt]]),bo=e=>yo.get(e)??e,xo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=E(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=vo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(bo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},So=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=E(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ja(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Co=(e,t,n,r)=>{n.type=`boolean`},wo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},To=(e,t,n,r)=>{Ja(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{n.not={}},Do=(t,n,r,i)=>{let a=t._zod.def,o=e(a.entries);o.length===0?r.not={}:(o.every(e=>typeof e==`number`)&&(r.type=`number`),o.every(e=>typeof e==`string`)&&(r.type=`string`),r.enum=o)},Oo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ja(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ja(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},ko=(e,t,n,r)=>{Ja(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ao=(e,t,n,r)=>{Ja(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},jo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=E(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=w(a.element,t,{...r,path:[...r.path,`items`]})};function Mo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Mo(t.out):t.type===`catch`?Mo(t.innerType):e._zod.optin}var No=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ja(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)u(i.properties,e,w(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Mo(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=w(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Po=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>w(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Fo=(e,t,n,r)=>{let i=e._zod.def,a=w(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=w(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Io=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>w(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?w(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Mo(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:ee}=E(e);typeof p==`number`&&(i.minItems=p),typeof ee==`number`&&(i.maxItems=ee)};function Lo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Lo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Lo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?an:rn).source)),p}var Ro=new WeakMap;function zo(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Ro.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Lo(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Bo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=E(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=w(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)u(i.patternProperties,bo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=w(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Ro.get(t);n||(n=[],Ro.set(t,n),t.deferred.push(()=>zo(t))),n.push(e)}i.additionalProperties=w(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Mo(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Vo=(e,t,n,r)=>{let i=e._zod.def,a=w(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ho=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Uo=Symbol();function Wo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ja(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Uo):JSON.parse(o)}var Go=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Wo(i.defaultValue,e,t,n,r);o!==Uo&&(n.default=o)},Ko=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Wo(i.defaultValue,e,t,n,r);o!==Uo&&(n._prefault=o)},qo=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ja(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Jo=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;w(o,t,r);let s=t.seen.get(e);s.ref=o},Yo=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Xo=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Zo=(e,t,n,r)=>{let i=e._zod.innerType;w(i,t,r);let a=t.seen.get(e);a.ref=i},Qo=new WeakSet([Object.prototype,Error.prototype]);function $o(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var D=y(`ZodError`,(e,t)=>{ot.init(e,t),e.name=`ZodError`;let r=Object.getPrototypeOf(e);Qo.has(r)||(Qo.add(r),$o(r,`format`,e=>t=>lt(e,t)),$o(r,`flatten`,e=>t=>ct(e,t)),$o(r,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,n,2)}),$o(r,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,n,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),es=dt(D),ts=ft(D),ns=pt(D),rs=ht(D),is=xt(D),as=St(D),os=Ct(D),ss=wt(D),cs=Tt(D),ls=Et(D),us=Dt(D),ds=Ot(D);function fs(){b.localeError||et(Ni())}function ps(){b.memoizer||et({memoizer:Ai()})}var O=y(`ZodType`,(e,t)=>(fs(),S.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(h(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return de(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Pc(e,t))},superRefine(e,t){return this.check(Fc(e,t))},overwrite(e){return this.check(Fa(e))},optional(){return fc(this)},exactOptional(){return mc(this)},nullable(){return gc(this)},nullish(){return fc(gc(this))},nonoptional(e){return Sc(this,e)},array(){return P(this)},or(e){return L([this,e])},and(e){return nc(this,e)},transform(e){return Ec(this,uc(e))},default(e){return vc(this,e)},prefault(e){return bc(this,e)},catch(e){return wc(this,e)},pipe(e){return Ec(this,e)},readonly(){return kc(this)},describe(e){let t=this.clone();return Li.add(t,{description:e}),t},meta(...e){if(e.length===0)return Li.get(this);let t=this.clone();return Li.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Re(this,`~standard`,{...Mn(this),jsonSchema:{input:ao(this,`input`),output:ao(this,`output`)}})},set"~standard"(e){Le(this,`~standard`,e)},parse:function e(t,n){return es(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ts(this,t,n,{callee:e})},safeParse(e,t){return ns(this,e,t)},async safeParseAsync(e,t){return rs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Le(this,`spa`,e)},validate(e,t){return vt(this,e,t)},validateAsync(e,t){return bt(this,e,t)},encode:function e(t,n){return is(this,t,n,{callee:e})},decode:function e(t,n){return as(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await os(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ss(this,t,n,{callee:e})},safeEncode(e,t){return cs(this,e,t)},safeDecode(e,t){return ls(this,e,t)},async safeEncodeAsync(e,t){return us(this,e,t)},async safeDecodeAsync(e,t){return ds(this,e,t)},toJSONSchema(e){return io(this,{})(e)},get description(){return Li.get(this)?.description},get _def(){return this._zod.def}}),ms=y(`_ZodString`,(e,t)=>{Nn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)},ze({format:e=>E(e).format??null,minLength:e=>E(e).minimum??null,maxLength:e=>E(e).maximum??null},{regex(...e){return this.check(ka(...e))},includes(...e){return this.check(Ma(...e))},startsWith(...e){return this.check(Na(...e))},endsWith(...e){return this.check(Pa(...e))},min(...e){return this.check(Da(...e))},max(...e){return this.check(Ea(...e))},length(...e){return this.check(Oa(...e))},nonempty(...e){return this.check(Da(1,...e))},lowercase(e){return this.check(Aa(e))},uppercase(e){return this.check(ja(e))},trim(){return this.check(La())},normalize(...e){return this.check(Ia(...e))},toLowerCase(){return this.check(Ra())},toUpperCase(){return this.check(za())},slugify(){return this.check(Ba())}})),hs=y(`ZodString`,(e,t)=>{Nn.init(e,t),ms.init(e,t)},{email(e){return this.check(Bi(bs,e))},url(e){return this.check(Ki(Cs,e))},jwt(e){return this.check(sa(Rs,e))},emoji(e){return this.check(qi(ws,e))},guid(e){return this.check(Vi(xs,e))},uuid(e){return this.check(Hi(Ss,e))},uuidv4(e){return this.check(Ui(Ss,e))},uuidv6(e){return this.check(Wi(Ss,e))},uuidv7(e){return this.check(Gi(Ss,e))},nanoid(e){return this.check(Ji(Ts,e))},cuid(e){return this.check(Yi(Es,e))},cuid2(e){return this.check(Xi(Ds,e))},ulid(e){return this.check(Zi(Os,e))},base64(e){return this.check(ia(Fs,e))},base64url(e){return this.check(aa(Is,e))},xid(e){return this.check(Qi(ks,e))},ksuid(e){return this.check($i(As,e))},ipv4(e){return this.check(ea(js,e))},ipv6(e){return this.check(ta(Ms,e))},cidrv4(e){return this.check(na(Ns,e))},cidrv6(e){return this.check(ra(Ps,e))},e164(e){return this.check(oa(Ls,e))},datetime(e){return this.check(ca(gs,e))},date(e){return this.check(la(_s,e))},time(e){return this.check(ua(vs,e))},duration(e){return this.check(da(ys,e))}});function k(e){return zi(hs,e)}var A=y(`ZodStringFormat`,(e,t)=>{C.init(e,t),ms.init(e,t)}),gs=y(`ZodISODateTime`,(e,t)=>{Qn.init(e,t),A.init(e,t)}),_s=y(`ZodISODate`,(e,t)=>{$n.init(e,t),A.init(e,t)}),vs=y(`ZodISOTime`,(e,t)=>{er.init(e,t),A.init(e,t)}),ys=y(`ZodISODuration`,(e,t)=>{tr.init(e,t),A.init(e,t)}),bs=y(`ZodEmail`,(e,t)=>{In.init(e,t),A.init(e,t)}),xs=y(`ZodGUID`,(e,t)=>{Pn.init(e,t),A.init(e,t)}),Ss=y(`ZodUUID`,(e,t)=>{Fn.init(e,t),A.init(e,t)}),Cs=y(`ZodURL`,(e,t)=>{Wn.init(e,t),A.init(e,t)}),ws=y(`ZodEmoji`,(e,t)=>{Gn.init(e,t),A.init(e,t)}),Ts=y(`ZodNanoID`,(e,t)=>{Kn.init(e,t),A.init(e,t)}),Es=y(`ZodCUID`,(e,t)=>{qn.init(e,t),A.init(e,t)}),Ds=y(`ZodCUID2`,(e,t)=>{Jn.init(e,t),A.init(e,t)}),Os=y(`ZodULID`,(e,t)=>{Yn.init(e,t),A.init(e,t)}),ks=y(`ZodXID`,(e,t)=>{Xn.init(e,t),A.init(e,t)}),As=y(`ZodKSUID`,(e,t)=>{Zn.init(e,t),A.init(e,t)}),js=y(`ZodIPv4`,(e,t)=>{nr.init(e,t),A.init(e,t)}),Ms=y(`ZodIPv6`,(e,t)=>{ar.init(e,t),A.init(e,t)}),Ns=y(`ZodCIDRv4`,(e,t)=>{or.init(e,t),A.init(e,t)}),Ps=y(`ZodCIDRv6`,(e,t)=>{cr.init(e,t),A.init(e,t)}),Fs=y(`ZodBase64`,(e,t)=>{dr.init(e,t),A.init(e,t)}),Is=y(`ZodBase64URL`,(e,t)=>{mr.init(e,t),A.init(e,t)}),Ls=y(`ZodE164`,(e,t)=>{hr.init(e,t),A.init(e,t)}),Rs=y(`ZodJWT`,(e,t)=>{_r.init(e,t),A.init(e,t)}),zs=y(`ZodNumber`,(e,t)=>{vr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),e.isFinite=!0},ze({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=E(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=E(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=E(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>E(e).format??null},{gt(e,t){return this.check(Ca(e,t))},gte(e,t){return this.check(wa(e,t))},min(e,t){return this.check(wa(e,t))},lt(e,t){return this.check(xa(e,t))},lte(e,t){return this.check(Sa(e,t))},max(e,t){return this.check(Sa(e,t))},int(e){return this.check(Vs(e))},safe(e){return this.check(Vs(e))},positive(e){return this.check(Ca(0,e))},nonnegative(e){return this.check(wa(0,e))},negative(e){return this.check(xa(0,e))},nonpositive(e){return this.check(Sa(0,e))},multipleOf(e,t){return this.check(Ta(e,t))},step(e,t){return this.check(Ta(e,t))},finite(){return this}}));function j(e){return fa(zs,e)}var Bs=y(`ZodNumberFormat`,(e,t)=>{yr.init(e,t),zs.init(e,t)});function Vs(e){return ma(Bs,e)}var Hs=y(`ZodBoolean`,(e,t)=>{br.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r)});function M(e){return ha(Hs,e)}var Us=y(`ZodUndefined`,(e,t)=>{xr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r)});function Ws(e){return _a(Us,e)}var Gs=y(`ZodNull`,(e,t)=>{Sr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)});function Ks(e){return va(Gs,e)}var qs=y(`ZodUnknown`,(e,t)=>{Cr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function N(){return ya(qs)}var Js=y(`ZodNever`,(e,t)=>{wr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r)});function Ys(e){return ba(Js,e)}var Xs=y(`ZodArray`,(e,t)=>{ps(),Or.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Da(e,t))},nonempty(e){return this.check(Da(1,e))},max(e,t){return this.check(Ea(e,t))},length(e,t){return this.check(Oa(e,t))},unwrap(){return this.element}});function P(e,t){return Va(Xs,e,t)}var Zs=y(`ZodObject`,(e,t)=>{ps(),Pr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),Ge(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return B(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(h(this._zod.def,{catchall:e}))},passthrough(){return this.clone(h(this._zod.def,{catchall:N()}))},loose(){return this.clone(h(this._zod.def,{catchall:N()}))},strict(){return this.clone(h(this._zod.def,{catchall:Ys()}))},strip(){return this.clone(h(this._zod.def,{catchall:void 0}))},extend(e){return ye(this,e)},safeExtend(e){return xe(this,e)},merge(e){return Se(this,e)},pick(e){return ge(this,e)},omit(e){return ve(this,e)},partial(...e){return Ce(dc,this,e[0])},exactPartial(...e){return Ce(pc,this,e[0],`exactPartial`)},required(...e){return we(xc,this,e[0])}});function F(e,t){return new Zs({type:`object`,shape:e??{},...g(t)})}function I(e,t){return new Zs({type:`object`,shape:e,catchall:Ys(),...g(t)})}function Qs(e,t){return new Zs({type:`object`,shape:e,catchall:N(),...g(t)})}var $s=y(`ZodUnion`,(e,t)=>{Ir.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.options=t.options});function L(e,t){return new $s({type:`union`,options:e,...g(t)})}var ec=y(`ZodDiscriminatedUnion`,(e,t)=>{$s.init(e,t),Rr.init(e,t)});function R(e,t,n){return new ec({type:`union`,options:t,discriminator:e,...g(n)})}var tc=y(`ZodIntersection`,(e,t)=>{zr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r)});function nc(e,t){return new tc({type:`intersection`,left:e,right:t})}var rc=y(`ZodTuple`,(e,t)=>{ps(),Hr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new dc({type:`optional`,innerType:e}))})}});function ic(e,t,n){let r=t instanceof S;return new rc({type:`tuple`,items:e,rest:r?t:null,...g(r?n:t)})}var ac=y(`ZodRecord`,(e,t)=>{ps(),Kr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function z(e,t,n){return!t||!t._zod?new ac({type:`record`,keyType:k(),valueType:e,...g(t)}):new ac({type:`record`,keyType:e,valueType:t,...g(n)})}function oc(e,t,n){return new ac({type:`record`,keyType:e,valueType:t,...g(n),partial:!0})}var sc=y(`ZodEnum`,(e,t)=>{qr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new sc({...t,checks:[],...g(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new sc({...t,checks:[],...g(r),entries:i})}});function B(e,t){return new sc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...g(t)})}var cc=y(`ZodLiteral`,(e,t)=>{Jr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function V(e,t){return new cc({type:`literal`,values:Array.isArray(e)?e:[e],...g(t)})}var lc=y(`ZodTransform`,(e,t)=>{ps(),Yr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new $e(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Fe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Fe(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function uc(e){return new lc({type:`transform`,transform:e})}var dc=y(`ZodOptional`,(e,t)=>{Zr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fc(e){return new dc({type:`optional`,innerType:e})}var pc=y(`ZodExactOptional`,(e,t)=>{Qr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mc(e){return new pc({type:`optional`,innerType:e})}var hc=y(`ZodNullable`,(e,t)=>{$r.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gc(e){return new hc({type:`nullable`,innerType:e})}var _c=y(`ZodDefault`,(e,t)=>{ei.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function vc(e,t){return new _c({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ce(t)}})}var yc=y(`ZodPrefault`,(e,t)=>{ni.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bc(e,t){return new yc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ce(t)}})}var xc=y(`ZodNonOptional`,(e,t)=>{ri.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sc(e,t){return new xc({type:`nonoptional`,innerType:e,...g(t)})}var Cc=y(`ZodCatch`,(e,t)=>{oi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wc(e,t){return new Cc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:qe(t)})}var Tc=y(`ZodPipe`,(e,t)=>{si.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.in=t.in,e.out=t.out});function Ec(e,t){return new Tc({type:`pipe`,in:e,out:t})}var Dc=y(`ZodPreprocess`,(e,t)=>{Tc.init(e,t),li.init(e,t)}),Oc=y(`ZodReadonly`,(e,t)=>{ui.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kc(e){return new Oc({type:`readonly`,innerType:e})}var Ac=y(`ZodLazy`,(e,t)=>{fi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function jc(e){return new Ac({type:`lazy`,getter:e})}var Mc=y(`ZodCustom`,(e,t)=>{pi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r)});function Nc(e,t){return Ha(Mc,e??(()=>!0),t)}function Pc(e,t={}){return Ua(Mc,e,t)}function Fc(e,t){return Wa(e,t)}function H(e){let t=jc(()=>L([k(e),j(),M(),Ks(),P(t),z(k(),t)]));return t}function Ic(e,t){return new Dc({type:`pipe`,in:uc(e),out:t})}var Lc=B([`user`,`project`]),Rc=B([`builtin`,`user`,`project`]),zc=B([`user`,`project`,`conversation`]),Bc=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Vc=B(Bc).meta({description:`Reasoning effort. A level the selected model does not support is adjusted, or a conflict when required.`}),Hc=F({provider:k().min(1).meta({description:`Provider id from the user's configured models. Never guess it.`}),modelId:k().min(1).meta({description:`Model id from the user's configured models. Never guess it.`})}),Uc=B([`text`,`image`]),Wc=F({provider:k(),modelId:k(),name:k(),label:k(),reasoning:M().default(!1),input:P(Uc).default([`text`]),supportedThinkingLevels:P(Vc).default([`off`]),faux:M().optional(),contextWindow:j().int().nonnegative().default(0),maxOutputTokens:j().int().nonnegative().default(0)});F({tokens:j().int().nonnegative().nullable(),contextWindow:j().int().nonnegative(),percent:j().nullable()});var Gc=B([`needs_review`,`trusted`,`declined`]),Kc=k().trim().min(1).max(128).regex(/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/),qc=k().trim().min(1).max(256),Jc=L([k().max(8192),j().finite(),M()]),Yc=B([`allow`,`prompt`,`deny`]).meta({description:"`allow` runs the call, `prompt` asks the user, `deny` refuses it."}),Xc=B([`overridable`,`guardrail`]).meta({description:"`overridable` rules are ordered by scope and priority. A `guardrail` beats every overridable rule, may only `prompt` or `deny`, and is allowed only in user overlays."}),Zc=B([`filesystem`,`command`,`code`,`external_read`,`interaction`,`orchestration`,`deployment`,`integration`,`other`]).meta({description:`Static category of a tool.`}),Qc=B([`read`,`write`,`external_read`,`external_write`,`secret`,`destructive`,`deployment`,`agent_spawn`,`interaction`,`unknown`]).meta({description:"Risk class of a tool call. `bash` and `python_exec` calls are always `unknown`; match them by tool name and argument."}),$c=B([`path`,`url`,`agent`,`resource`,`whole_tool`]).meta({description:`Kind of target a call touches.`}),el=B([`project`,`nerve_home`,`nerve_data`,`plans`]).meta({description:`Directory a path target is relative to: the project directory, the Nerve home, its data directory or the plans directory.`}),tl=k().max(4096).superRefine((e,t)=>{(e.includes(`\\`)||e.startsWith(`/`)||/^[A-Za-z]:/.test(e)||e.split(`/`).includes(`..`)||e.includes(`\0`))&&t.addIssue({code:`custom`,message:`Paths must be normalized root-relative POSIX paths.`})}),nl=F({kind:V(`path`),access:B([`read`,`write`]),scope:B([`exact`,`tree`]),root:el,relativePath:tl}).strict(),rl=k().min(1).max(32768).superRefine((e,t)=>{(e.includes(`\0`)||!e.startsWith(`/`)&&!/^[A-Za-z]:[\\/]/.test(e)&&!e.startsWith(`\\\\`))&&t.addIssue({code:`custom`,message:`External path targets must use absolute platform paths.`})}),il=L([nl,F({kind:V(`path`),access:B([`read`,`write`]),scope:B([`exact`,`tree`]),absolutePath:rl}).strict(),F({kind:V(`url`),normalizedUrl:k().url().max(8192),access:B([`read`,`write`])}).strict(),F({kind:V(`agent`),agentId:qc}).strict(),F({kind:V(`resource`),value:k().trim().min(1).max(2048)}).strict(),F({kind:V(`whole_tool`)}).strict()]),al=L([Jc,P(Jc).max(256)]).meta({description:`String, number, boolean or an array of those (at most 256).`}),ol="Operators: `equals`/`not_equals` compare the whole value; `in` matches any listed value; `glob` matches a pattern against the whole value (`*` stays within one `/` segment, `**` spans segments, `{a,b}` alternates); `exists` tests presence (`value` true or false).",sl=P(Jc).min(1).max(256).meta({description:`Values to match; the call matches any of them.`}),cl=k().max(8192).meta({description:`Glob pattern, matched against the whole value.`}),ll=R(`operator`,[F({operator:B([`equals`,`not_equals`]),value:al}).strict(),F({operator:V(`in`),value:sl}).strict(),F({operator:V(`glob`),value:cl}).strict(),F({operator:V(`exists`),value:M().meta({description:"`true` matches when present, `false` when absent."})}).strict()]).meta({description:`Compares a single value, such as the tool's primary argument. ${ol} Command lines are one value, so a glob like \`pnpm test*\` also matches \`pnpm test && rm -rf x\`; prefer \`equals\` or \`in\` for commands.`}),ul=k().min(6).max(512).regex(/^args\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*$/).meta({description:"Path to a tool argument: `args.<name>` or nested `args.<name>.<name>`."}),dl=R(`operator`,[F({path:ul,operator:B([`equals`,`not_equals`]),value:al}).strict(),F({path:ul,operator:V(`in`),value:sl}).strict(),F({path:ul,operator:V(`glob`),value:cl}).strict(),F({path:ul,operator:V(`exists`),value:M().meta({description:"`true` matches when present, `false` when absent."})}).strict()]).meta({description:`Compares one named argument of the tool call. ${ol}`}),fl=k().max(8192).meta({description:"Single-line glob over the path relative to its root, the full URL, the agent id or the resource value. Path patterns are relative POSIX globs: no leading `/`, no `..`, no backslashes."}).superRefine((e,t)=>{/\r|\n|\0/.test(e)&&t.addIssue({code:`custom`,message:`Target patterns must be a single line.`})}),pl=F({kind:$c.optional(),access:B([`read`,`write`]).meta({description:`Whether the call reads or writes the target.`}).optional(),scope:B([`exact`,`tree`]).meta({description:"Paths only: `exact` for one file, `tree` for a directory and everything below it."}).optional(),root:el.meta({description:"Paths only: `project` (the project directory), `nerve_home`, `nerve_data` or `plans`. A path outside every root has no root and matches only matchers without `root` and `pattern`."}).optional(),pattern:fl.optional()}).strict().meta({description:"Matches one target of a call. Every present field must match. `scope` and `root` need `kind` `path` or no `kind`."}).superRefine((e,t)=>{(e.scope!==void 0||e.root!==void 0)&&e.kind!==void 0&&e.kind!==`path`&&t.addIssue({code:`custom`,message:`Path scope and root require a path target matcher.`}),e.pattern!==void 0&&(e.kind===`path`||e.root!==void 0)&&(e.pattern.includes(`\\`)||e.pattern.startsWith(`/`)||/^[A-Za-z]:/.test(e.pattern)||e.pattern.split(`/`).includes(`..`))&&t.addIssue({code:`custom`,path:[`pattern`],message:`Path patterns must be root-relative POSIX globs.`})}),ml=F({toolNames:P(qc).min(1).max(256).meta({description:`The tool name is one of these.`}).optional(),toolKinds:P(Zc).min(1).max(16).meta({description:`The tool's kind is one of these.`}).optional(),toolGroups:P(qc).min(1).max(256).meta({description:`The tool's group, or the quick_script namespace of an SDK operation, is one of these.`}).optional(),baseRisks:P(Qc).min(1).max(16).meta({description:`The call's risk is one of these.`}).optional(),primaryArgument:ll.meta({description:"Matcher on the tool's primary argument (for `bash`, the command line)."}).optional(),primaryTarget:pl.meta({description:`Matcher on the call's first target.`}).optional(),targets:F({quantifier:B([`any`,`all`]).meta({description:"`any`: at least one target matches. `all`: the call has targets and every one matches; use it for `allow` rules so a call touching an allowed and another path is not allowed."}),matcher:pl}).strict().meta({description:`Matcher applied to all targets of the call.`}).optional(),arguments:P(dl).min(1).max(64).meta({description:`Matchers on named arguments; all must match.`}).optional()}).strict().meta({description:"Selects calls. Every present field must match; `{}` matches every call."}),hl=F({id:Kc.meta({description:"Lowercase letters, digits, `.`, `_`, `-`; starts and ends with a letter or digit; at most 128. Unique within the document."}),description:k().trim().min(1).max(1024).meta({description:`Shown to the user as the reason when this rule decides; write it for them.`}).optional(),enabled:M().meta({description:`Disabled rules are ignored.`}),priority:j().int().min(-1e3).max(1e3).meta({description:`Higher wins among rules of the same scope and enforcement. Unique per enforcement class within one document.`}),enforcement:Xc,when:ml,decision:Yc}).strict().meta({description:"One permission rule. A `guardrail` rule may only `prompt` or `deny`."}).superRefine((e,t)=>{e.enforcement===`guardrail`&&e.decision===`allow`&&t.addIssue({code:`custom`,path:[`decision`],message:`Guardrails may only prompt or deny.`})}),gl=Kc,_l=B([`builtin`,`user`]);function vl(e,t){let n=new Set,r=new Set;for(let[i,a]of e.entries()){r.has(a.id)&&t.addIssue({code:`custom`,path:[`rules`,i,`id`],message:`Rule IDs must be unique within their owning source.`}),r.add(a.id);let e=`${a.enforcement}:${a.priority}`;n.has(e)&&t.addIssue({code:`custom`,path:[`rules`,i,`priority`],message:`Priorities must be unique within each enforcement class.`}),n.add(e)}}var yl=F({schemaVersion:V(1).meta({description:`Always 1.`}),id:Kc.meta({description:"Rule set id; equals the file name without `.json`. Same format as a rule id. Must not reuse a built-in id: the built-in wins."}),name:k().trim().min(1).max(128).meta({description:`Name shown in the permission picker.`}),description:k().trim().min(1).max(1024).meta({description:`What the rule set is for.`}).optional(),source:_l.meta({description:"Always `user` for files you write."}),enabled:M().meta({description:`A disabled rule set cannot be selected.`}),rules:P(hl).min(1).max(256).meta({description:"All rules must be `overridable`. End with a catch-all rule (`when: {}`) so every call gets a deliberate decision. A rule set used by sub-agents must have no enabled `prompt` rule."})}).strict().meta({description:"A user permission rule set, `<home>/config/rule-sets/<id>.json`. Not expressible here: rule ids are unique, priorities are unique per enforcement class, and rules may not be `guardrail`."}).superRefine((e,t)=>{vl(e.rules,t);for(let[n,r]of e.rules.entries())r.enforcement===`guardrail`&&t.addIssue({code:`custom`,path:[`rules`,n,`enforcement`],message:`Rule sets may contain only overridable rules.`})}),bl=F({ruleSetId:gl.meta({description:`Id of the rule set these rules extend. They apply only while that rule set is selected.`}),rules:P(hl).max(256).meta({description:`Rules added on top of the rule set.`})}).strict().meta({description:`Extra rules bound to one rule set.`}).superRefine((e,t)=>vl(e.rules,t)),xl=F({schemaVersion:V(2).meta({description:`Always 2.`}),overlays:P(bl).max(256).meta({description:`One entry per rule set id; add rules to the existing entry. At most 256 rules in the whole document.`})}).strict().meta({description:"Permission overlays (`permissions.json`). Not expressible here: `ruleSetId` is unique per document, rule ids are unique and priorities are unique per enforcement class within each overlay, and the document holds at most 256 rules in total."}).superRefine((e,t)=>{let n=new Set,r=0;for(let[i,a]of e.overlays.entries())n.has(a.ruleSetId)&&t.addIssue({code:`custom`,path:[`overlays`,i,`ruleSetId`],message:`Overlay rule-set IDs must be unique within a document.`}),n.add(a.ruleSetId),r+=a.rules.length;r>256&&t.addIssue({code:`custom`,path:[`overlays`],message:`Permission overlay documents may contain at most 256 rules.`})}),Sl=B([`baseline`,`rule_set`,`user`,`project`,`conversation`]),Cl=F({enforcementRank:j().int().min(0).max(1),scopeRank:j().int().min(0).max(4),priority:j().int().min(-1e3).max(1e3)}).strict(),wl=F({origin:zc,path:k().min(1).max(4096),reason:k().min(1).max(4096)}).strict();F({decision:Yc,reason:k().min(1).max(4096),baseRisk:Qc,normalizedTargets:P(il).max(128),winningRuleId:Kc,winningRule:hl,winningRuleOrigin:Sl,winningRuleSetId:gl,winningRuleEnforcement:Xc,winningRulePrecedence:Cl,activeRuleSetIds:P(Kc).min(1).max(16),selectedRuleSetId:gl,ignoredOverlays:P(wl).max(16),policySnapshotHash:k().regex(/^sha256:[a-f0-9]{64}$/),suggestedRules:P(hl).max(16)}).strict();var Tl=F({id:Kc,name:k().min(1).max(128),description:k().max(1024).optional(),source:_l,enabled:M(),available:M(),diagnostic:k().max(4096).optional()}).strict().extend({rules:P(hl).max(256)});B([`user`,`project`,`conversation`]);var El=F({status:B([`missing`,`invalid`,...Gc.options]),digest:k().regex(/^sha256:[a-f0-9]{64}$/).optional(),trustedDigest:k().regex(/^sha256:[a-f0-9]{64}$/).optional(),trustedAt:k().datetime().optional(),reason:k().max(4096).optional()}).strict(),Dl=F({ruleSets:P(Tl).max(256),userOverlays:xl,projectOverlays:xl,conversationOverlays:xl.optional(),projectTrust:El,diagnostics:P(k().max(4096)).max(256)}).strict();function Ol(e,t,n,r=[]){if(e!==`user`)for(let[i,a]of t.rules.entries())a.enforcement===`guardrail`&&n.addIssue({code:`custom`,path:[...r,`rules`,i,`enforcement`],message:`${e} overlays may contain only overridable rules.`}),e===`project`&&(a.when.primaryTarget?.root===`nerve_home`||a.when.primaryTarget?.root===`nerve_data`||a.when.targets?.matcher.root===`nerve_home`||a.when.targets?.matcher.root===`nerve_data`)&&a.decision===`allow`&&n.addIssue({code:`custom`,path:[...r,`rules`,i,`when`],message:`Project overlays cannot grant broad Nerve-owned root access.`})}function kl(e){return bl.superRefine((t,n)=>Ol(e,t,n))}var Al=B([`debug`,`info`,`warn`,`error`]),jl=B([`orchestrator`,`desktop`,`web`,`cli`]),Ml=F({name:k().optional(),message:k(),stack:k().optional(),cause:k().optional()}),Nl={requestId:k().optional(),projectId:k().startsWith(`proj_`).optional(),conversationId:k().startsWith(`conv_`).optional(),agentId:k().startsWith(`agent_`).optional(),runId:k().startsWith(`run_`).optional(),toolCallId:k().startsWith(`tool_`).optional(),launchId:k().startsWith(`launch_`).optional()},Pl=F({seq:j().int().positive(),id:k().startsWith(`log_`),ts:k().datetime(),level:Al,source:jl,component:k().min(1),message:k().min(1),...Nl,durationMs:j().nonnegative().optional(),context:z(k(),N()).optional(),error:Ml.optional()}),Fl=B([`uncaughtException`,`unhandledRejection`,`childExit`,`healthFailure`,`startupExit`,`startupTimeout`,`startupError`,`previousUncleanExit`]);F({id:k().startsWith(`crash_`),ts:k().datetime(),source:jl,kind:Fl,message:k().min(1),pid:j().int().positive().optional(),exitCode:j().int().nullable().optional(),signal:k().nullable().optional(),uptimeMs:j().int().nonnegative().optional(),dataDir:k().optional(),error:Ml.optional(),outputTail:k().optional(),context:z(k(),N()).optional(),runtime:F({node:k(),platform:k(),arch:k()}).optional()});var Il=F({level:Al.optional(),source:jl.optional(),component:k().min(1).optional(),contains:k().optional(),sinceSeq:j().int().nonnegative().optional(),beforeSeq:j().int().positive().optional(),limit:j().int().positive().max(500).optional(),...Nl});Il.refine(e=>e.sinceSeq===void 0||e.beforeSeq===void 0,{message:`sinceSeq and beforeSeq cannot be combined`,path:[`beforeSeq`]}),F({logs:P(Pl),nextCursor:j().int().nonnegative(),hasMoreBefore:M()});var Ll=Il.omit({limit:!0,sinceSeq:!0,beforeSeq:!0}),Rl=F({pruned:j().int().nonnegative(),remaining:j().int().nonnegative()}),zl=F({seq:j().int().nonnegative(),ts:k().datetime(),level:Al,message:k()}).passthrough();F({level:Al.optional(),contains:k().min(1).optional(),sinceSeq:j().int().nonnegative().optional(),limit:j().int().positive().max(1e3).optional()}),F({logs:P(zl),nextCursor:j().int().nonnegative(),dropped:j().int().nonnegative()}),F({logs:P(Pl.omit({seq:!0,id:!0,ts:!0,source:!0}).extend({ts:k().datetime().optional(),source:V(`web`).optional()})).min(1).max(50)});var Bl=L([V(443),V(8443),V(1e4)]),Vl=R(`code`,[F({code:V(`not_installed`)}),F({code:V(`not_running`)}),F({code:V(`no_magic_dns`)}),F({code:V(`serve_not_enabled`),approvalUrl:k().url().optional()}),F({code:V(`permission_denied`)}),F({code:V(`port_in_use`),httpsPort:j().int()}),F({code:V(`funnel_enabled`),httpsPort:j().int()}),F({code:V(`entry_changed`)}),F({code:V(`command_failed`),detail:k()})]),Hl=R(`state`,[F({state:V(`off`)}),F({state:V(`starting`)}),F({state:V(`certificate`),url:k().url()}),F({state:V(`ready`),url:k().url()}),F({state:V(`problem`),problem:Vl})]),Ul=B([`automatic`,`manual`]),Wl=F({maxConcurrentModelRuns:j().int().min(1).max(32),maxParallelToolsPerRun:j().int().min(1).max(16),maxActiveProcesses:j().int().min(1).max(256)}),Gl=F({logicalCpuCount:j().int().positive(),effectiveCpuCount:j().int().positive(),totalMemoryMb:j().int().positive()}),Kl={maxConcurrentModelRuns:10,maxParallelToolsPerRun:3,maxActiveProcesses:16},ql=B([`auto`,`x11`,`wayland`]),Jl=B([`system`,`none`,`slight`,`medium`,`full`]),Yl=F({peers:P(k().trim().min(1))}),Xl=F({enabled:M().default(!1),httpsPort:Bl.default(443),listenerPort:j().int().min(1).max(65535).optional()}),Zl=k().trim().url(),Ql=F({network:F({host:k().trim().min(1).default(`127.0.0.1`),port:j().int().min(1).max(65535).default(3747),allowRemote:M().default(!1),mobileHttps:M().default(!1),httpsPort:j().int().min(1).max(65535).default(3748),publicUrl:Zl.optional(),trustProxy:Yl.optional(),tunnel:Xl.optional()}),diagnostics:F({loggingEnabled:M().default(!1),performanceEnabled:M().optional()}),daemon:F({startupTimeoutMs:j().int().positive().default(6e4),maxOldSpaceMb:j().int().positive().default(4096)}),resources:F({mode:Ul.default(`automatic`),...Wl.shape}).default({mode:`automatic`,...Kl}),electron:F({ozonePlatform:ql.default(`auto`),fontRenderHinting:Jl.default(`slight`)})}),$l={network:{host:`127.0.0.1`,port:3747,allowRemote:!1,mobileHttps:!1,httpsPort:3748},diagnostics:{loggingEnabled:!1},daemon:{startupTimeoutMs:6e4,maxOldSpaceMb:4096},resources:{mode:`automatic`,...Kl},electron:{ozonePlatform:`auto`,fontRenderHinting:`slight`}},eu=F({network:F({host:k().trim().min(1).optional(),port:j().int().min(1).max(65535).optional(),allowRemote:M().optional(),mobileHttps:M().optional(),httpsPort:j().int().min(1).max(65535).optional(),publicUrl:L([Zl,V(``)]).optional(),trustProxy:Yl.optional(),tunnel:F({enabled:M().optional(),httpsPort:Bl.optional()}).optional()}).optional(),diagnostics:F({loggingEnabled:M().optional(),performanceEnabled:M().optional()}).optional(),daemon:F({startupTimeoutMs:j().int().positive().optional(),maxOldSpaceMb:j().int().min(512).optional()}).optional(),resources:F({mode:Ul.optional(),maxConcurrentModelRuns:Wl.shape.maxConcurrentModelRuns.optional(),maxParallelToolsPerRun:Wl.shape.maxParallelToolsPerRun.optional(),maxActiveProcesses:Wl.shape.maxActiveProcesses.optional()}).optional(),electron:F({ozonePlatform:ql.optional(),fontRenderHinting:Jl.optional()}).optional()}),tu=F({application:eu.optional(),logging:F({level:Al.optional(),retentionDays:j().int().positive().optional(),maxBufferedLogs:j().int().positive().optional()}).optional()}),nu=F({kind:B([`settings`,`environment`,`command_line`,`development_default`,`automatic`]),name:k().optional()}),ru=B([`none`,`daemon`,`desktop`]);function iu(e){return F({activeValue:e,savedValue:e,source:nu,editable:M(),restartTarget:ru,pendingRestart:M()})}var au=iu(k()),ou=iu(j()),su=iu(M()),cu=F({application:F({network:F({host:au,port:ou,allowRemote:su,mobileHttps:su,httpsPort:ou,publicUrl:au,trustProxyPeers:iu(P(k())),tunnelEnabled:su,tunnelHttpsPort:iu(Bl)}),diagnostics:F({loggingEnabled:su,performanceEnabled:su,level:iu(Al),retentionDays:ou,maxBufferedLogs:ou}),daemon:F({startupTimeoutMs:ou,maxOldSpaceMb:ou}),resources:F({mode:iu(Ul),maxConcurrentModelRuns:ou,maxParallelToolsPerRun:ou,maxActiveProcesses:ou}),electron:F({ozonePlatform:iu(ql),fontRenderHinting:iu(Jl)})}),context:F({dataDir:k(),dataDirSource:B([`default`,`environment`]),platform:k(),packaged:M().optional(),webAssetsOverridden:M(),proxyConfigured:M(),proxyDebugEnabled:M(),resources:F({detected:Gl,recommended:Wl,effective:Wl,controlWorkConcurrency:j().int().positive()})})}),lu=16384,uu=`coding`,U=k().min(1).max(32).regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,`Name must use lowercase letters, numbers, and single hyphens`);function du(e){return new TextEncoder().encode(e).length}var fu=k().refine(e=>du(e)<=lu,{message:`Instructions must be at most ${lu} bytes`}),pu=B([`read`,`bash`,`python_exec`,`edit`,`write`,`grep`,`find`,`ls`,`ask_user`,`web_fetch`,`quick_script`]),mu=B([`plan_present`,`subagent_prompt`,`subagent_status`,`subagent_stop`,`web_search`,`web_fetch`,`python_exec`]),hu=B([`subagent_prompt`,`subagent_status`,`subagent_stop`,`async_bash`,`plan_present`]),gu=B([...pu.options,...hu.options]),_u=Nc(e=>gu.safeParse(e).success||typeof e==`string`&&/^[a-z][a-z0-9_]{1,63}$/.test(e),`Invalid tool name.`);k().min(1).max(128);var vu=[`subagent_prompt`,`subagent_status`,`subagent_stop`];B(vu);var yu=B([`idle`,`running`,`stopping`]),bu=B([`completed`,`cancelled`,`failed`,`interrupted`]);function xu(e){return vu.includes(e)}var Su=[`subagent_new`,`subagent_list`],Cu=[`explore`,`explain_image`],wu=P(B([...mu.options,...Su,...Cu])).transform(Tu);function Tu(e){let t=Su,n=Cu,r=e.filter(e=>!n.includes(e)),i=r.some(e=>xu(e)||t.includes(e));return[...new Set([...r.filter(e=>!t.includes(e)),...i?vu:[]])]}var Eu=B([`read`,`workspace_write`,`external_write`,`command`,`external_read`,`secret`,`destructive`,`agent_spawn`,`deployment`,`interaction`]),Du=B([`allow`,`deny`]),Ou=B([`path_glob`,`command_glob`,`url_glob`,`tool`]),ku=B([`never`,`tool`,`target`]),Au=/^(?:[A-Za-z][A-Za-z0-9]*|\*)(?:\.(?:[A-Za-z][A-Za-z0-9]*|\*))*$/,ju=new Set([`read`,`edit`,`write`,`grep`,`find`,`ls`]),Mu=Nc(e=>gu.safeParse(e).success,`Not a core tool. Extension tools are targeted by operation: use tool "quick_script" with the operation as the rule, for example "search.web".`),Nu=P(F({id:k().startsWith(`exception_`).max(128),tool:Mu,effect:Du,rule:k().trim().min(1).max(1024)}).superRefine((e,t)=>{let n=e.rule;/\r|\n|\0/.test(n)&&t.addIssue({code:`custom`,message:`Permission rules must be a single line.`,path:[`rule`]}),ju.has(e.tool)?(n.includes(`\\`)||n.startsWith(`/`)||/^[A-Za-z]:/.test(n)||n.split(`/`).includes(`..`))&&t.addIssue({code:`custom`,message:`Path rules must be project-relative POSIX globs.`,path:[`rule`]}):e.tool===`bash`?n===`*`&&t.addIssue({code:`custom`,message:`Bash rules must use a focused command glob.`,path:[`rule`]}):e.tool===`quick_script`?Au.test(n)||t.addIssue({code:`custom`,message:`Quick Script rules must be an operation glob such as 'namespace.items.*' (dotted path; '*' segments).`,path:[`rule`]}):e.tool===`web_fetch`?n.includes(`://`)||t.addIssue({code:`custom`,message:`Web Fetch rules must include a URL scheme glob.`,path:[`rule`]}):n!==`*`&&t.addIssue({code:`custom`,message:`Whole-tool permission rules must be '*'.`,path:[`rule`]})})).max(256).superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Duplicate permission exception id '${i.id}'`,path:[r,`id`]}),n.add(i.id)});function Pu(e){return e===`write`?`workspace_write`:e===`unknown`?`command`:e}var Fu=B([`nerve-light`,`nerve-dark`,`melange-light`,`melange-dark`,`graphite`,`indigo`]),Iu=k().regex(/^ext:[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,`must look like ext:<extension-id>/<theme-id>`).max(140),Lu=L([Fu,Iu]),Ru=`nerve-dark`,zu={"nerve-light":`light`,"nerve-dark":`dark`,"melange-light":`light`,"melange-dark":`dark`,graphite:`dark`,indigo:`dark`};function Bu(e,t){return e in zu?zu[e]:t?.(e)??zu[`nerve-dark`]}var Vu=B([`auto`,`linux`,`windows`,`macos`]),Hu=F({exceptions:Nu}),Uu=F({enabled:M().meta({description:`Turn background promotion on or off.`}),afterMs:j().int().positive().max(864e5).meta({description:`Milliseconds a command runs in the foreground before it is moved to the background.`})}),Wu=F({interpreterPath:k().trim().min(1).meta({description:`Absolute path of the Python interpreter. Omit to use the default interpreter.`}).optional()}).strict(),Gu=F({approvalProfile:U.meta({description:`Name of the lead agent profile that applies when the user approves a plan.`})}).strict(),Ku=F({shellPath:k().trim().min(1).meta({description:`Absolute path of the shell that runs commands. Omit for the default shell.`}).optional(),autoPromotion:Uu.meta({description:`Moves a foreground command that runs too long to the background instead of blocking the agent.`}),maxTimeoutMs:j().int().min(1e3).max(36e5).meta({description:`Longest time in milliseconds a command may run (1000-3600000). Default 900000.`}).default(9e5)});F({model:Hc.optional(),thinkingLevel:Vc});var qu=F({disabled:wu,bash:Ku,pythonExec:Wu,planPresent:Gu}),Ju=B([`aggressive`,`balanced`,`conservative`,`custom`]),W=B([`none`,`bell`,`chime`,`click`,`pop`,`success`,`alert`,`ping`,`pulse`,`ripple`,`sparkle`,`knock`,`signal`]),Yu={question:`bell`,planReview:`chime`,approval:`bell`,completed:`success`,failed:`alert`},Xu=F({question:W,planReview:W,approval:W,completed:W,failed:W}),Zu=F({auto:M(),profile:Ju,customTriggerPercent:j().int().min(60).max(90)}).strict(),Qu=B([`gpt-transcribe`,`gpt-4o-transcribe`,`gpt-4o-mini-transcribe`]),$u=k().trim().regex(/^[a-z]{2,3}(?:-[a-z]{2})?$/),ed=k().trim().min(1).max(100).regex(/^[^<>\r\n]+$/),td=F({model:Qu,languages:P($u).max(10),vocabulary:P(ed).max(50)}),nd=F({enabled:M(),model:Hc.nullable()}),rd=F({defaultAgentProfile:U.optional(),defaultPermissionRuleSetId:gl,defaultModel:Hc.optional(),defaultThinkingLevel:Vc,application:Ql,ui:F({zoomLevel:j().int().min(-8).max(8)}),desktop:F({closeToTray:M(),headerType:Vu}),notifications:F({systemEnabled:M(),soundsEnabled:M(),events:Xu}),conversationTitles:nd.default({enabled:!1,model:null}),transcription:td,compaction:Zu,logging:F({level:Al,retentionDays:j().int().positive(),maxBufferedLogs:j().int().positive()}),retry:F({enabled:M(),maxRetries:j().int().nonnegative(),baseDelayMs:j().int().positive()}),permissions:Hu,tools:qu,skills:F({disabled:P(k().min(1)),nerve:F({enabled:P(k().min(1))}),agentBrowser:F({enabled:P(k().min(1))})}),scopedModels:P(Hc)}),id={defaultPermissionRuleSetId:`autonomous`,defaultThinkingLevel:`off`,application:$l,ui:{zoomLevel:0},desktop:{closeToTray:!1,headerType:`auto`},notifications:{systemEnabled:!0,soundsEnabled:!0,events:Yu},conversationTitles:{enabled:!1,model:null},transcription:{model:`gpt-4o-transcribe`,languages:[],vocabulary:[]},compaction:{auto:!0,profile:`balanced`,customTriggerPercent:80},logging:{level:`info`,retentionDays:14,maxBufferedLogs:2e3},retry:{enabled:!0,maxRetries:3,baseDelayMs:2e3},permissions:{exceptions:[]},tools:{disabled:[`plan_present`,...vu],bash:{autoPromotion:{enabled:!0,afterMs:12e4},maxTimeoutMs:9e5},pythonExec:{},planPresent:{approvalProfile:`coding`}},skills:{disabled:[],nerve:{enabled:[]},agentBrowser:{enabled:[]}},scopedModels:[]},ad=I({conversationTitles:nd.optional(),application:eu.optional(),ui:F({zoomLevel:j().int().min(-8).max(8).optional()}).optional(),desktop:F({closeToTray:M().optional(),headerType:Vu.optional()}).optional(),notifications:F({systemEnabled:M().optional(),soundsEnabled:M().optional(),events:F({question:W.optional(),planReview:W.optional(),approval:W.optional(),completed:W.optional(),failed:W.optional()}).optional()}).optional(),transcription:F({model:Qu.optional(),languages:P($u).max(10).optional(),vocabulary:P(ed).max(50).optional()}).optional(),logging:F({level:Al.optional(),retentionDays:j().int().positive().optional(),maxBufferedLogs:j().int().positive().optional()}).optional(),permissions:F({exceptions:Nu.optional()}).optional()}),od=`Can you look at why the websocket reconnect backoff never resets after a successful reconnect?`,sd=R(`category`,[F({category:V(`success`),title:k(),latencyMs:j()}),F({category:B([`timeout`,`auth`,`rate limit`,`invalid output`,`unavailable`])})]),cd=/(?:^|[_-])(authorization|cookie|credential|password|passwd|secret|token|api[_-]?key|private[_-]?key)(?:$|[_-])/i,ld=/^[a-z][a-z0-9+.-]*:\/\/[^/\s]*@/i,ud=65536,dd=16384,fd=1048576,pd=12,md=256;function hd(e,t){return Ic(yd,H()).superRefine((n,r)=>{let i;try{i=new TextEncoder().encode(JSON.stringify(n)).byteLength}catch{r.addIssue({code:`custom`,message:`public data must be JSON-safe`});return}i>e&&r.addIssue({code:`custom`,message:`public data may not exceed ${e} bytes`}),bd(n,r,[],0,t)})}var gd=hd(ud,dd),_d=hd(ud,dd),vd=hd(fd,void 0);Ic(yd,z(k().min(1).max(128),_d)).superRefine((e,t)=>{bd(e,t,[],0,dd),Object.keys(e).length>md&&t.addIssue({code:`custom`,message:`public objects may contain at most ${md} fields`})});function yd(e){return Array.isArray(e)?e.map(yd):!e||typeof e!=`object`?e:Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>[e,yd(t)]))}function bd(e,t,n,r,i){if(r>pd){t.addIssue({code:`custom`,path:n,message:`public data is too deep`});return}if(typeof e==`string`){i!==void 0&&e.length>i&&t.addIssue({code:`custom`,path:n,message:`public text is too long`}),ld.test(e)&&t.addIssue({code:`custom`,path:n,message:`credential-bearing URLs are forbidden`});return}if(Array.isArray(e)){e.length>md&&t.addIssue({code:`custom`,path:n,message:`public arrays are too large`}),e.forEach((e,a)=>bd(e,t,[...n,a],r+1,i));return}if(!e||typeof e!=`object`)return;let a=Object.entries(e);a.length>md&&t.addIssue({code:`custom`,path:n,message:`public objects are too large`});for(let[e,o]of a)cd.test(e)&&t.addIssue({code:`custom`,path:[...n,e],message:`secret-like public data keys are forbidden`}),bd(o,t,[...n,e],r+1,i)}var xd=[`workbench_server`];function Sd(e,t,n,r={}){return{name:t,payloadSchema:e.transform(e=>n.parse(e)),delivery:r.delivery??`sequenced`,supersedable:r.supersedable??!1,allowedSourceRoles:r.allowedSourceRoles??xd,coalescing:r.delivery===`ephemeral`?r.coalescing:void 0,scope:r.scope??[]}}function Cd(e,t,n={}){return Sd(gd,e,t,n)}function G(e,t,n={}){return Sd(vd,e,t,n)}var wd=F({id:k(),name:k(),directory:k(),createdAt:k().datetime(),updatedAt:k().datetime()}),Td=I({level:B([`error`,`warning`]),code:k().min(1),message:k().min(1),pointer:k().optional()}),Ed=Td.extend({path:k().min(1)}),Dd=Rc,Od=B([`enabled`,`pending_consent`,`incompatible`,`invalid`,`shadowed`]),kd=I({kind:B([`network`,`account`,`model`,`frame`,`tools`,`namespace`,`ui`,`code`]),text:k(),broad:M().optional()}),Ad=I({update:M(),contentHash:k().min(1),items:P(kd),text:k()}),jd=I({network:P(k()),models:P(k()),frame:P(k()),accounts:P(k()),namespaces:z(k(),P(k())),tools:P(k()),ui:P(k()),credentials:P(k()).optional()}),Md=I({id:k().min(1),source:Dd,state:Od,path:k().optional(),name:k().optional(),description:k().optional(),version:k().optional(),sdkVersion:k().optional(),shadowedBy:Dd.optional(),diagnostics:P(Td),adds:P(kd).optional(),consent:Ad.optional(),trustState:B([`needs_review`,`declined`]).optional()}),Nd=k().regex(/^[A-Za-z0-9_-]+$/).max(64),Pd=k().regex(/^[A-Za-z0-9_-]+$/).max(64),Fd=Lc,Id=R(`scope`,[I({scope:V(`user`)}),I({scope:V(`project`),projectId:k().min(1)})]),Ld=B([`stdio`,`http`]),Rd=I({type:Ld.optional(),command:k().optional(),args:P(k()).optional(),env:z(k(),k()).optional(),cwd:k().optional(),url:k().optional(),headers:z(k(),k()).optional(),enabled:M().optional(),description:k().optional(),timeout:j().optional()}),zd=Gc,Bd=B([`connected`,`idle`,`failed`,`disabled`,`needs_review`,`declined`]),Vd=I({kind:B([`env`,`secret`]),name:k(),field:B([`command`,`args`,`env`,`cwd`,`url`,`headers`]),key:k().optional()}),Hd=I({transport:Ld,command:k().optional(),args:P(k()).optional(),url:k().optional(),cwd:k().optional(),env:P(I({name:k(),value:k(),changesExecution:M()})).optional(),headers:P(I({name:k(),value:k()})).optional(),inheritsEnvironment:M().optional(),references:P(Vd)}),Ud=I({name:Nd,scope:Fd,status:zd,digest:k(),grants:Hd,sends:P(k()),notes:P(k()).optional()}),Wd=I({name:Pd,set:M()}),Gd=I({name:Nd,scope:Fd,inherited:M(),replacesUser:M(),shadowed:M(),transport:Ld,description:k().optional(),entry:Rd,state:Bd,error:k().optional(),review:zd,enabled:M(),server:I({name:k(),version:k()}).optional(),toolCount:j().int().nonnegative().optional(),secrets:P(Wd)}),Kd=I({path:k(),exists:M(),problems:P(k())}),qd=I({servers:P(Gd),file:Kd}),Jd=I({target:Id,name:Nd,entry:Rd,previousName:Nd.optional(),secrets:z(Pd,k()).optional(),replaceInvalid:M().optional()}),Yd=R(`status`,[I({status:V(`saved`),server:Gd}),I({status:V(`invalid`),problems:P(k())}),I({status:V(`file_invalid`),problems:P(k())})]),Xd=I({target:Id,name:Nd}),Zd=I({removed:M()}),Qd=R(`status`,[I({status:V(`ok`),server:I({name:k(),version:k()}).optional(),instructions:k().optional(),tools:P(I({name:k(),title:k().optional(),description:k().optional(),inputSchema:z(k(),N())})),resources:P(I({uri:k(),name:k(),description:k().optional(),mimeType:k().optional()}))}),I({status:V(`failed`),error:k()}),I({status:V(`refused`),state:Bd.or(V(`not_found`)),reason:k()})]),$d=I({disconnected:M()}),ef=Ud.nullable(),tf="a URL path such as `/oauth/callback`: segments of letters, digits and `._~-` between single slashes, no `.` or `..` segments, no query or fragment, at most 200 characters",nf=k().max(200,`Must be ${tf}.`).regex(/^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]*$/,`Must be ${tf}.`).refine(e=>!e.split(`/`).some(e=>/^\.{1,2}$/.test(e)),`Must be ${tf}.`),rf=zc,af=k().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/).max(64),of=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,sf=k().regex(/^[a-z][A-Za-z0-9]*$/).max(64),cf={label:k().min(1),description:k().optional(),section:k().optional(),scopes:P(rf).min(1).optional(),visibleWhen:I({field:sf,equals:L([k(),M()])}).optional(),advanced:M().optional()},lf=R(`type`,[I({...cf,type:V(`boolean`),default:M()}),I({...cf,type:V(`string`),default:k().optional(),format:B([`url`,`text`]).optional(),placeholder:k().optional(),maxLength:j().int().positive().optional()}),I({...cf,type:V(`number`),default:j().optional(),min:j().optional(),max:j().optional(),step:j().positive().optional(),unit:k().optional()}),I({...cf,type:V(`enum`),default:k(),options:P(I({value:k(),label:k(),description:k().optional()})).min(1)}),I({...cf,type:V(`account`),kind:L([k().min(1),P(k().min(1)).min(1)]).optional(),platform:k().regex(of).optional()}).refine(e=>e.kind===void 0!=(e.platform===void 0),{message:"An account field names either `kind` or `platform`."}),I({...cf,type:V(`model`),capability:V(`vision`).optional(),reasoning:M().optional()}),I({...cf,type:V(`imageModel`)}),I({...cf,type:V(`agentProfile`)}),I({...cf,type:V(`permissionRuleSet`)})]);function uf(e){return e.kind===void 0?[]:typeof e.kind==`string`?[e.kind]:e.kind}var df=I({platform:k().regex(of),scopes:P(k().min(1)).optional(),origins:P(k().min(1)).optional()}),ff=I({sections:P(I({id:k().min(1),title:k().min(1),description:k().optional()})).optional(),fields:z(sf,lf)}),pf=sf,mf=R(`scheme`,[I({scheme:V(`basic`),user:sf,secret:pf.optional()}),I({scheme:V(`bearer`),secret:pf.optional()}),I({scheme:V(`header`),name:k().regex(/^[A-Za-z0-9-]+$/),secret:pf.optional()}),I({scheme:V(`query`),name:k().min(1).max(128),secret:pf.optional()})]),hf=I({label:k().min(1),help:k().optional(),multiline:M().optional()}),gf=`secret`;function _f(e){return e.secrets?{...e.secrets}:e.secret?{[gf]:e.secret}:{}}var vf=k().min(1).max(2048),yf=I({type:V(`oauth2`),flows:P(B([`authorization_code`,`device_code`])).min(1).optional(),discovery:vf.optional(),authorizationUrl:vf.optional(),tokenUrl:vf.optional(),deviceAuthorizationUrl:vf.optional(),revocationUrl:vf.optional(),scopes:P(k().min(1)).optional(),clientIdField:sf.optional(),clientSecret:pf.optional(),authorizationParams:z(k(),k()).optional(),redirectPath:nf.optional(),userinfo:I({url:vf,identity:z(sf,k().min(1))}).optional()}),bf=e=>e.clientIdField??`clientId`,xf=new Set([`boolean`,`string`,`number`,`enum`]),Sf=I({kind:k().min(1),label:k().min(1),platform:k().regex(of).optional(),fields:z(sf,lf).superRefine((e,t)=>{for(let[n,r]of Object.entries(e))xf.has(r.type)||t.addIssue({code:`custom`,path:[n,`type`],message:`Account kinds cannot have ${r.type} fields: the account dialog cannot show them. Use string, number, boolean or enum.`})}),secret:hf.optional(),secrets:z(pf,hf).optional(),auth:L([mf,P(mf).min(1)]).optional(),provider:L([yf,V(`extension`)]).optional(),signInOrigins:P(k().min(1)).optional(),origins:P(k().min(1)).optional(),test:V(!0).optional()});function Cf(e,t,n,r){let i=(e,t)=>r.addIssue({code:`custom`,path:[`provider`,e],message:t});e.auth!==void 0&&r.addIssue({code:`custom`,path:[`auth`],message:"A kind with an `oauth2` provider sends its access token as a bearer token; remove `auth`."});let a=t.flows??[`authorization_code`];!t.tokenUrl&&!t.discovery&&i(`tokenUrl`,"Give `tokenUrl` or `discovery`."),a.includes(`authorization_code`)&&!t.authorizationUrl&&!t.discovery&&i(`authorizationUrl`,"Give `authorizationUrl` or `discovery`."),a.includes(`device_code`)&&!t.deviceAuthorizationUrl&&!t.discovery&&i(`deviceAuthorizationUrl`,"Give `deviceAuthorizationUrl` or `discovery`.");let o=bf(t);e.fields[o]?.type!==`string`&&i(`clientIdField`,`The client id needs a string field '${o}' (give it a default to ship a client id).`),t.clientSecret&&!n.includes(t.clientSecret)&&i(`clientSecret`,`'${t.clientSecret}' is not one of the kind's secrets.`);for(let e of n)e!==t.clientSecret&&i(`clientSecret`,`The secret '${e}' is not used: an oauth2 kind has only its client secret.`)}function wf(e,t){e.auth!==void 0&&t.addIssue({code:`custom`,path:[`auth`],message:'A kind with `provider: "extension"` signs requests in its credential provider; remove `auth`.'}),e.origins?.length||t.addIssue({code:`custom`,path:[`origins`],message:'A kind with `provider: "extension"` needs `origins`: the credential is sent only there.'})}var Tf=(e,t)=>{e.secret&&e.secrets&&t.addIssue({code:`custom`,path:[`secrets`],message:"Declare either `secret` or `secrets`, not both."});let n=Object.keys(_f(e)),r=e.provider;r===`extension`?wf(e,t):r?Cf(e,r,n,t):n.length===0&&t.addIssue({code:`custom`,path:[`secret`],message:"An account kind needs a `secret` or at least one `secrets` entry."});for(let[r,i]of(e.auth===void 0?[]:Array.isArray(e.auth)?e.auth:[e.auth]).entries())i.secret===void 0&&n.length>1?t.addIssue({code:`custom`,path:[`auth`,r,`secret`],message:`Name the secret this injection uses (${n.join(`, `)}).`}):i.secret!==void 0&&!n.includes(i.secret)&&t.addIssue({code:`custom`,path:[`auth`,r,`secret`],message:`'${i.secret}' is not one of the kind's secrets (${n.join(`, `)}).`})},Ef=Sf.superRefine(Tf),Df=Sf.omit({kind:!0}).superRefine(Tf),Of=I({network:P(k().min(1)).optional(),models:P(B([`image`,`vision`,`text`])).optional(),frame:P(B([`chat.startConversation`])).optional()}),kf=B([`blocks`,`eye`,`globe`,`image-plus`,`layers`,`workflow`]),Af=R(`type`,[I({type:V(`lucide`),name:kf}),I({type:V(`svg`),src:k().startsWith(`data:image/svg+xml,`)})]),jf=I({id:af,name:k().min(1),description:k(),icon:Af,source:Rc,settingsVersion:j().int().positive(),enabledByDefault:M(),permissions:Of,contributes:I({namespaces:P(I({id:k().min(1),label:k().min(1).optional(),enabledBy:L([k(),P(k())]).optional(),requiresAccount:k().optional(),helper:M().optional(),summary:k()})),tools:P(I({name:k().min(1),label:k().min(1),description:k()})),skills:P(k())})});function Mf(e){return e.scopes??[`user`,`project`,`conversation`]}var Nf=I({version:j().int().positive().meta({description:`Settings version the extension declares for these settings.`}),enabled:M().meta({description:`Turn the extension on or off.`}).optional(),settings:z(k(),N()).meta({description:`Extension settings by field key, as the extension documents them.`}).optional()});I({schemaVersion:V(1),revision:j().int().nonnegative().max(2**53-1),extensions:z(af,Nf)});var Pf=I({recommendations:z(af,Nf).meta({description:`Extension entries used unless the conversation chooses otherwise.`}).optional(),requirements:z(af,Nf).meta({description:`Extension entries locked while the profile is applied.`}).optional()}),Ff=B([...mu.exclude(vu).options,`subagents`,`quick_script`]);B([...Ff.options,`bash`]);var If=z(k().trim().min(1).max(256),M()).meta({description:`Skill name to true (enable) or false (disable). At most 512 entries.`}).refine(e=>Object.keys(e).length<=512,`At most 512 skill overrides are allowed.`),Lf=F({file:If,nerve:If,agentBrowser:If}).strict();function Rf(e){return F({enabled:M().optional(),settings:e.optional()}).strict()}var zf=Rf(Ys()),Bf={python_exec:Rf(Wu),web_search:zf,web_fetch:zf,plan_present:Rf(Gu),subagents:zf,quick_script:zf,bash:F({settings:Ku}).strict()},Vf=Hc.strict(),Hf=e=>Object.keys(e).length>0,Uf=`Automatic compaction of the conversation context.`,Wf=`Retry of failed model requests.`,Gf=I({auto:M().meta({description:`Compact the conversation automatically.`}),profile:Ju.meta({description:"How early automatic compaction triggers. `custom` uses `customTriggerPercent`."}),customTriggerPercent:j().int().min(60).max(90).meta({description:"Context usage percent (60-90) that triggers compaction when `profile` is `custom`."})}).meta({description:Uf}),Kf=I({enabled:M().meta({description:`Retry failed model requests.`}),maxRetries:j().int().nonnegative().meta({description:`Maximum retries per request.`}),baseDelayMs:j().int().positive().meta({description:`Initial delay in milliseconds before the first retry.`})}).meta({description:Wf}),qf=Ku.extend({autoPromotion:Ku.shape.autoPromotion.strict().meta({description:`Moves a foreground command that runs too long to the background instead of blocking the agent.`}),maxTimeoutMs:Ku.shape.maxTimeoutMs.removeDefault()}).strict(),Jf=`Whether skills of each source are enabled unless a per-skill override says otherwise.`,Yf=I({file:M().meta({description:`Default for skills from files (user and project skill folders).`}),nerve:M().meta({description:`Default for Nerve's built-in skills.`}),agentBrowser:M().meta({description:`Default for agent-browser skills.`})}).meta({description:Jf}),Xf=Lf.partial().extend({defaults:Yf.partial().meta({description:Jf}).optional()}).strict().meta({description:"Per-skill overrides by source (`file`, `nerve`, `agentBrowser`) and source defaults."}),Zf=I({defaults:M().meta({description:`Default for servers without a named entry.`}).optional(),servers:z(Nd,M()).meta({description:`Per-server on/off by server name.`}).optional()}).meta({description:"Which MCP servers the agent may use, by server name. A named entry beats `defaults`; a server with no decision follows its own `enabled` in mcp.json (default on)."}),Qf=`Tool entry; at least one field is required.`;function $f(e){return I({enabled:M().meta({description:`Turn the tool on or off.`}).optional(),settings:e.meta({description:`Tool settings; include only fields to set.`}).optional()}).refine(Hf,`Empty tool entry`).meta({description:Qf})}var ep=I({enabled:M().meta({description:`Turn the tool on or off.`})}).meta({description:`Tool toggle.`}),tp={python_exec:$f(Wu.partial()),web_search:ep,quick_script:ep,web_fetch:ep,bash:I({settings:qf.partial().refine(Hf).meta({description:`Shell settings; include only fields to set, at least one. The bash tool is always on.`})}).meta({description:Qf})},np=I({...tp,plan_present:$f(Gu.partial().refine(Hf)),subagents:ep.meta({description:`Delegation to sub-agents on or off (lead only).`})}).partial().meta({description:`Tool toggles and settings by tool name. Every entry must be non-empty.`}),rp=I(tp).partial().meta({description:`Tool toggles and settings by tool name. Every entry must be non-empty.`}),ip=I({model:Vf.meta({description:`Model this sub-agent launches with.`}).optional(),reasoningLevel:Vc.optional()}),ap=ip,op=ip.extend({enabled:M().meta({description:`Make this sub-agent profile available to the lead or not.`}).optional()}).refine(Hf).meta({description:`Launch settings for one sub-agent profile. At least one field is required.`}),sp={model:Vf.meta({description:"Model to use. Take `provider` and `modelId` from the user's configured models."}).optional(),reasoningLevel:Vc.optional(),permissionRuleSetId:gl.meta({description:"Id of a built-in or user permission rule set. Sub-agents need a rule set without `prompt` rules."}).optional(),compaction:Gf.partial().meta({description:Uf}).optional(),retry:Kf.partial().meta({description:Wf}).optional(),tools:rp.optional(),skills:Xf.optional(),mcpServers:Zf.optional()},cp=I(sp),K=I({...sp,tools:np.optional(),subagents:z(U,op).meta({description:`Lead only. Launch settings by sub-agent profile name: turn a teammate on or off or give it a model.`}).optional()}),lp=I({python_exec:I({enabled:M(),settings:Wu}),web_search:Bf.web_search.required({enabled:!0}),quick_script:Bf.quick_script.required({enabled:!0}).optional(),web_fetch:ep,bash:I({settings:qf})}),up=cp.extend({reasoningLevel:Vc,permissionRuleSetId:gl,compaction:Gf,retry:Kf,tools:lp,skills:Lf.extend({defaults:Yf}).strict(),mcpServers:Zf.optional()}),dp=k().regex(/^[a-f0-9]{64}$/),fp=j().int().nonnegative().max(2**53-1),pp={name:U,source:Rc,sourceDigest:dp,instructions:fu},mp=K.extend({skills:Lf.partial().strict().meta({description:"Per-skill overrides by source (`file`, `nerve`, `agentBrowser`). Profiles cannot set `defaults`."}).optional(),mcpServers:I({servers:z(Nd,M()).meta({description:`Per-server on/off by server name.`}).optional()}).meta({description:"Per-server overrides by server name. Profiles cannot set `defaults`."}).optional()}),hp=I({...pp,recommendations:mp,requirements:mp,extensions:Pf.optional()}).superRefine(Ap),gp=I({schemaVersion:V(1).meta({description:`Always 1.`}),revision:fp.meta({description:`Write counter managed by Nerve. Keep the existing value.`}),overrides:K.meta({description:`Settings object. Every field is optional; an omitted field falls back to the lower layer.`})}).meta({description:"Agent preferences (`agent.json`) at user or project scope: default model, reasoning, permissions, tools and skills."}),_p=I({id:k().min(1),kind:B([`profile`,`plan-approval`])}),vp=I({instructions:fu.optional(),systemPrompt:k().optional()});gp.extend({context:vp.optional(),appliedProfile:hp.nullable(),lastTransition:_p.optional()}),I({schemaVersion:V(1),revision:fp,overrides:cp,appliedProfile:hp.nullable(),frozenDefaults:up,context:vp.optional(),lastTransition:_p.optional()}).superRefine((e,t)=>{if(e.appliedProfile)for(let n of[`recommendations`,`requirements`])cp.safeParse(e.appliedProfile[n]).success||t.addIssue({code:`custom`,path:[`appliedProfile`,n],message:`Child-prohibited profile contribution`})});var yp=I({schemaVersion:V(1).meta({description:`Always 1.`}),name:U.meta({description:"Profile name; equals the file name without `.json`. Lowercase letters and digits in hyphen-separated words, at most 32 characters."}),label:k().trim().min(1).max(80).meta({description:`Display name, 1-80 characters.`}).optional(),whenToUse:k().trim().min(1).max(200).meta({description:`1-200 characters. Sub-agent profiles: the line the lead chooses the teammate by; name the kind of task and the outcome.`}),enabled:M().meta({description:"Sub-agent profiles: `false` makes the profile unavailable to leads by default; the user can enable it per conversation. Default `true`."}).optional(),usableBy:B([`lead`,`subagent`,`both`]).meta({description:"Who may use the profile. `subagent` and `both` profiles may only use settings that sub-agents support."}),instructions:fu.meta({description:`Text added to the agent's system prompt, at most 16384 UTF-8 bytes. May be empty for a settings-only profile.`}),recommendations:mp.meta({description:`Settings object: values used unless the conversation chooses otherwise.`}).optional(),requirements:mp.meta({description:"Settings object: values enforced while the profile is applied. The same setting may not appear in both `recommendations` and `requirements`."}).optional(),extensions:Pf.meta({description:`Extension entries the profile recommends or requires, by extension id. Use only when asked, with the extension's documented settings.`}).optional()}).meta({description:"Agent profile file. Not expressible here: `recommendations` and `requirements` must not set the same setting (also `extensions.<id>.settings.<key>` and `enabled`). A `subagent` or `both` profile may not use `tools.plan_present`, `tools.subagents` or `subagents`."}).superRefine((e,t)=>{if(Ap(e,t),e.usableBy!==`lead`)for(let n of[`recommendations`,`requirements`])e[n]&&!cp.safeParse(e[n]).success&&t.addIssue({code:`custom`,path:[n],message:`Profile must be child-compatible`})}),bp=I({schemaVersion:V(1),revision:fp,overrides:I({defaultAgentProfile:U.optional(),scopedModels:P(Vf).optional()})}),xp=I({model:Vf.optional(),reasoningLevel:Vc.optional(),permissionRuleSetId:gl.optional(),agentProfile:U.optional()});I({schemaVersion:V(1),entries:z(k().min(1),xp.extend({observedDigest:dp}))});var Sp=I({scope:zc,scopeId:k().optional(),document:k().min(1),path:k(),schemaVersion:j().int().optional(),code:k().min(1),pointer:k(),message:k().optional(),affectedCapability:k().min(1),recoveryChoices:P(B([`retry`,`reload`,`repair`,`reset`,`upgrade`]))}),Cp=I({source:B([`builtin`,`user`,`project`,`process`,`recommendation`,`conversation`,`requirement`,`frozen`,`launch`]),profile:U.optional(),adjusted:M().optional()}).superRefine((e,t)=>{e.source!==`requirement`&&e.source!==`recommendation`||e.profile||t.addIssue({code:`custom`,path:[`profile`],message:`Profile contributions must identify the controlling profile`})}),wp=I({code:B([`model-required`,`reasoning-adjusted`,`unsupported-reasoning`,`missing-reference`]),pointer:k()}),Tp=I({settings:K,provenance:z(k().regex(/^\/(?:[^~]|~[01])*$/),Cp),diagnostics:P(wp)});function Ep(e){return e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}function Dp(e){let t=[];function n(e,r){let i=/(?:^|\/)model$/.test(r)||r===`/tools/bash/settings/autoPromotion`;if(e!==void 0&&(i||typeof e!=`object`||!e||Array.isArray(e)))t.push([r,e]);else if(e)for(let[t,i]of Object.entries(e))n(i,`${r}/${Ep(t)}`)}return n(e,``),t}function Op(e={},t={}){let n=Dp(e).map(([e])=>e),r=Dp(t).map(([e])=>e);function i(e,t){if(e===t||e.startsWith(t+`/`)||t.startsWith(e+`/`)||e.startsWith(`/mcpServers/defaults`)&&t.startsWith(`/mcpServers/servers/`)||t.startsWith(`/mcpServers/defaults`)&&e.startsWith(`/mcpServers/servers/`))return!0;let n=e=>e.startsWith(`/skills/defaults/`)?e.slice(17):e.startsWith(`/skills/`)?e.split(`/`)[2]:void 0;return n(e)!==void 0&&n(e)===n(t)&&(e.startsWith(`/skills/defaults/`)||t.startsWith(`/skills/defaults/`))}return n.filter(e=>r.some(t=>i(e,t)))}function kp(e){let t=[];for(let[n,r]of Object.entries(e?.requirements??{})){let i=e?.recommendations?.[n];if(i){i.enabled!==void 0&&r.enabled!==void 0&&t.push(`/extensions/${n}/enabled`);for(let e of Object.keys(r.settings??{}))i.settings&&Object.hasOwn(i.settings,e)&&t.push(`/extensions/${n}/settings/${e}`)}}return t}function Ap(e,t){for(let n of kp(e.extensions))t.addIssue({code:`custom`,path:[`extensions`,`requirements`],message:`Recommendation/requirement overlap: ${n}`});for(let n of Op(e.recommendations,e.requirements))t.addIssue({code:`custom`,path:[`requirements`],message:`Recommendation/requirement overlap: ${n}`})}var jp={reasoningLevel:id.defaultThinkingLevel,permissionRuleSetId:id.defaultPermissionRuleSetId,compaction:id.compaction,retry:id.retry,tools:{python_exec:{enabled:!0,settings:{}},web_search:{enabled:!0},web_fetch:{enabled:!0},quick_script:{enabled:!0},bash:{settings:id.tools.bash},plan_present:{enabled:!1,settings:id.tools.planPresent},subagents:{enabled:!1}},skills:{defaults:{file:!0,nerve:!1,agentBrowser:!1},file:{},nerve:{},agentBrowser:{}}};function Mp(e){return e.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}function Np(e,t,n){let r=Mp(t),i=e;for(let e of r.slice(0,-1))Object.hasOwn(i,e)||Object.defineProperty(i,e,{value:{},writable:!0,enumerable:!0,configurable:!0}),i=i[e];Object.defineProperty(i,r.at(-1),{value:structuredClone(n),writable:!0,enumerable:!0,configurable:!0})}function Pp(e){let t=structuredClone(K.parse(e));return delete t.subagents,t.tools&&(delete t.tools.subagents,delete t.tools.plan_present),cp.parse(t)}function Fp(e){let t=e.appliedProfile;if(Op(t?.recommendations,t?.requirements).length)throw Error(`Overlapping profile contributions`);let n=e.role===`child`?cp:K;if(t&&(n.parse(t.recommendations),n.parse(t.requirements)),e.role===`lead`&&(e.frozenDefaults||e.launch))throw Error(`Child-only creation inputs`);if(e.frozenDefaults&&e.launch)throw Error(`An existing child's launch choices are already frozen`);let r=[];if(e.frozenDefaults)r.push({source:`frozen`,value:up.parse(e.frozenDefaults)});else{for(let[t,n]of[[`builtin`,{...jp,subagents:Object.fromEntries(Object.entries(e.subagentDefaults??{}).map(([e,t])=>[e,{enabled:t}]))}],[`user`,e.user],[`project`,e.project],[`process`,e.process]])n&&r.push({source:t,value:e.role===`child`?Pp(K.parse(n)):K.parse(n)});t&&r.push({source:`recommendation`,value:t.recommendations})}e.conversation&&r.push({source:`conversation`,value:n.parse(e.conversation)}),e.launch&&r.push({source:`launch`,value:ap.parse(e.launch)}),t&&r.push({source:`requirement`,value:t.requirements});let i={settings:{tools:{python_exec:{settings:{}}},skills:{file:{},nerve:{},agentBrowser:{}}},provenance:{},diagnostics:[]};for(let{source:e,value:n}of r)for(let[r,a]of Dp(n))Np(i.settings,r,a),i.provenance[r]={source:e,...(e===`recommendation`||e===`requirement`)&&t?{profile:t.name}:{}};for(let n of[`file`,`nerve`,`agentBrowser`]){let a=e.frozenDefaults?Object.keys(e.frozenDefaults.skills[n]):[...new Set(e.eligibleSkills?.[n]??r.flatMap(e=>Object.keys(e.value.skills?.[n]??{})))];e.frozenDefaults&&i.settings.skills&&(i.settings.skills[n]={});for(let e of a)for(let a of[...r].reverse()){let r=a.value.skills?.[n],o=(r&&Object.hasOwn(r,e)?r[e]:void 0)??a.value.skills?.defaults?.[n];if(o!==void 0){let r=`/skills/${n}/${e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`;Np(i.settings,r,o),i.provenance[r]={source:a.source,...a.source===`requirement`||a.source===`recommendation`?{profile:t?.name}:{}};break}}}Lp(i,r,e,t?.name);let{model:a,reasoningLevel:o}=i.settings;if(a||i.diagnostics.push({code:`model-required`,pointer:`/model`}),a&&o&&e.clampThinking){let t=e.clampThinking(a,o);if(t!==o){let e=i.provenance[`/reasoningLevel`].source,n=i.provenance[`/model`].source;e===`requirement`||e===n?i.diagnostics.push({code:`unsupported-reasoning`,pointer:`/reasoningLevel`}):(i.settings.reasoningLevel=t,i.provenance[`/reasoningLevel`].adjusted=!0,i.diagnostics.push({code:`reasoning-adjusted`,pointer:`/reasoningLevel`}))}}if(e.referenceAvailable)for(let[t,n]of Dp(i.settings))(t.endsWith(`/model`)||t.endsWith(`/profileId`)||t.endsWith(`/permissionRuleSetId`)||t.endsWith(`/approvalProfile`))&&!e.referenceAvailable(t,n)&&i.diagnostics.push({code:`missing-reference`,pointer:t});return i}var Ip=e=>e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`);function Lp(e,t,n,r){for(let t of Object.keys(e.provenance))t.startsWith(`/mcpServers/servers/`)&&delete e.provenance[t];e.settings.mcpServers&&delete e.settings.mcpServers.servers;let i=new Set(n.eligibleMcpServers??t.flatMap(e=>Object.keys(e.value.mcpServers?.servers??{})));for(let n of i)for(let i of[...t].reverse()){let t=i.value.mcpServers,a=t?.servers,o=(a&&Object.hasOwn(a,n)?a[n]:void 0)??(t&&`defaults`in t?t.defaults:void 0);if(o===void 0)continue;let s=`/mcpServers/servers/${Ip(n)}`;Np(e.settings,s,o),e.provenance[s]={source:i.source,...i.source===`requirement`||i.source===`recommendation`?{profile:r}:{}};break}}var q=I({expectedRevision:j().int().nonnegative().max(2**53-1),expectedDigest:L([dp,V(`missing`)]),changes:K,resets:P(k().regex(/^\/overrides(?:\/(?:[^~/]|~[01])*)+$/))});function Rp(e,t,n={},r=`lead`){let i=q.parse(t),a=r===`child`?cp:K,o=a.parse(e);a.parse(i.changes),a.parse(n);let s=[...Dp(i.changes).map(([e])=>`/overrides${e}`),...i.resets],c=(e,t)=>e===t||e.startsWith(t+`/`)||t.startsWith(e+`/`),l=Dp(n).map(([e])=>`/overrides${e}`);for(let[e,t]of s.entries()){if(s.slice(e+1).some(e=>c(t,e)))throw Error(`Overlapping mutation operations`);let r=l.some(e=>{let n=/^\/overrides\/skills\/defaults\/([^/]+)$/.exec(e);return n&&c(t,`/overrides/skills/${n[1]}`)}),a=l.includes(`/overrides/mcpServers/defaults`)&&t.startsWith(`/overrides/mcpServers/servers`);if(l.some(e=>c(t,e))||r||a||Op(i.changes,n).length)throw Error(`Required field is not editable`)}let u=o;for(let e of i.resets){let t=Mp(e).slice(1),n=e.slice(10);if([`/model`,`/tools/bash/settings/autoPromotion`].some(e=>n.startsWith(e+`/`))||/^\/subagents\/[^/]+\/model\//.test(n))throw Error(`Reset must target a canonical merge unit`);let r=a;for(let e of t){for(;r instanceof dc;)r=r.unwrap();if(r instanceof Zs&&Object.hasOwn(r.shape,e))r=r.shape[e];else if(r instanceof ac)es(r.keyType,e),r=r.valueType;else throw Error(`Unknown reset path`)}function i(e,n){let r=t[n];n===t.length-1?delete e[r]:Object.hasOwn(e,r)&&e[r]&&typeof e[r]==`object`&&(i(e[r],n+1),Object.keys(e[r]).length||delete e[r])}i(u,0)}for(let[e,t]of Dp(i.changes))Np(u,e,t);return a.parse(u)}var zp=R(`scope`,[I({scope:V(`user`)}),I({scope:V(`project`),projectId:k().min(1)})]),Bp=R(`scope`,[...zp.options,I({scope:V(`conversation`),conversationId:k().min(1)})]),Vp=I({revision:gp.shape.revision,digest:q.shape.expectedDigest}),Hp=Vp.extend({scope:Bp,path:k().min(1),generation:j().int().nonnegative().max(2**53-1)}),Up=P(Sp),Wp=I({status:V(`conflict`),current:Vp.optional(),diagnostics:Up}),Gp=I({status:V(`unavailable`),diagnostics:Up.min(1)}),Kp=R(`status`,[Wp,Gp,I({status:V(`invalid`),diagnostics:Up.min(1)})]),qp=I({scope:Bp}),Jp=R(`status`,[I({status:V(`available`),source:Hp,overrides:K,inherited:K,trustState:Gc.optional()}),Gp]),Yp=q.extend({scope:Bp}).superRefine((e,t)=>{try{Rp({},{expectedRevision:e.expectedRevision,expectedDigest:e.expectedDigest,changes:e.changes,resets:e.resets})}catch{t.addIssue({code:`custom`,message:`Invalid, overlapping or non-canonical mutation paths`})}}),Xp=L([I({status:V(`saved`),source:Hp,overrides:K}),Kp]),Zp=I({status:V(`available`),conversationId:k().min(1),role:B([`lead`,`child`]),appliedProfile:hp.nullable(),resolution:Tp,diagnostics:Up,sources:P(Hp)}),Qp=I({conversationId:k().min(1)}),$p=R(`status`,[Zp,Gp.extend({conversationId:k().min(1)})]),em=I({expectedRevision:q.shape.expectedRevision,expectedDigest:q.shape.expectedDigest,changes:bp.shape.overrides,resets:P(B([`/overrides/defaultAgentProfile`,`/overrides/scopedModels`]))}).superRefine((e,t)=>{(new Set(e.resets).size!==e.resets.length||e.resets.some(t=>Object.hasOwn(e.changes,t.slice(11))))&&t.addIssue({code:`custom`,message:`Overlapping creation preference operations`})}),tm=Hp.extend({scope:zp}),nm=I({scope:zp}),rm=R(`status`,[I({status:V(`available`),source:tm,overrides:bp.shape.overrides,inherited:bp.shape.overrides,effective:bp.shape.overrides.required({defaultAgentProfile:!0}),diagnostics:Up}),Gp]),im=em.safeExtend({scope:zp}),am=L([I({status:V(`saved`),source:tm,overrides:bp.shape.overrides}),Kp]),om=I({name:U,digest:dp}),sm=I({projectId:k().min(1),agentProfile:om.optional(),overrides:K.optional()}),cm=R(`status`,[I({status:V(`available`),appliedProfile:hp,resolution:Tp,inherited:K,diagnostics:Up}),Gp]),lm=ap,um=I({targetProfile:om,expectedRevision:q.shape.expectedRevision,expectedDigest:q.shape.expectedDigest,transitionId:k().min(1),choices:lm.optional()}),dm=I({targetDefinition:yp,changedFields:P(I({pointer:k(),before:N(),after:N(),beforeSource:Cp.optional(),afterSource:Cp.optional()})),unchangedRequirements:P(I({pointer:k(),value:N()})),targetProfile:om,source:Rc,expectedRevision:q.shape.expectedRevision,expectedDigest:q.shape.expectedDigest,recommendations:K,requirements:K,resolution:Tp}),fm=I({status:V(`refresh_required`),reason:B([`target_changed`,`target_unavailable`,`target_untrusted`,`requirement_conflict`,`configuration_changed`]),diagnostics:Up,preview:dm.optional()}),pm=I({conversationId:k().min(1),profile:U}),mm=L([I({status:V(`ready`),preview:dm}),fm,Gp]),hm=um.omit({choices:!0,transitionId:!0}).extend({conversationId:k().min(1),action:B([`switch`,`reapply`])}),gm=L([I({status:V(`applied`),source:Hp.extend({scope:Bp.options[2]}),effective:$p}),fm,Gp]),_m=R(`decision`,[I({kind:V(`plan_review`),decision:V(`approve`),confirmation:um,feedback:k().optional()}),I({kind:V(`plan_review`),decision:V(`reject`),feedback:k().optional()})]),vm=L([I({status:V(`resolved`)}),gm]),ym=F({operation:k(),targets:P(k()),targetsKnown:M(),count:j().int().positive()}),bm=F({method:k(),targets:P(k()).optional(),authorizedAs:k().optional(),summary:k().optional(),outcome:B([`completed`,`failed`,`denied`]),error:k().optional(),durationMs:j().nonnegative(),edit:F({files:j().int().nonnegative(),added:j().int().nonnegative(),removed:j().int().nonnegative(),diff:k(),diffFile:k().optional(),dryRun:M().optional()}).optional()}).passthrough(),xm=`sdk_calls`,Sm=R(`phase`,[F({phase:V(`started`),seq:j().int().nonnegative(),method:k(),summary:k().optional()}),F({phase:V(`finished`),seq:j().int().nonnegative(),method:k(),summary:k().optional(),outcome:B([`completed`,`failed`,`denied`]),error:k().optional(),durationMs:j().nonnegative()})]),Cm=F({handle:k(),path:k(),bytes:j().int().nonnegative(),mediaType:k(),width:j().int().positive().optional(),height:j().int().positive().optional()}),wm=F({status:B([`completed`,`failed`,`timed_out`,`cancelled`,`memory_limit`]),error:k().optional(),durationMs:j().nonnegative(),memoryUsedBytes:j().nonnegative().optional(),outputTruncated:M().optional(),hostCalls:P(bm),artifacts:P(Cm).optional(),created:P(k()).optional()}).passthrough(),Tm=I({toolCallId:k().min(1),toolName:k().min(1),argumentsDigest:dp,executionTargetDigest:dp,policyAuthorityDigest:dp}),Em=z(k().min(1),j().int().nonnegative().max(2**53-1));I({binding:Tm,requestGenerations:Em,policyGenerations:Em});var Dm=B([`supervising`,`awaiting_approval`,`ready`,`running`,`awaiting_input`]),Om=B([`model`,`user`]),km=I({decision:B([`allow`,`approval`,`deny`]),approval:Tm.optional(),reason:k().optional(),effectiveRisk:Ic(e=>e===`network`?`external_read`:e,Eu).optional(),matchedRule:H().optional(),suggestedRules:P(H()),operations:P(ym).optional(),authority:H()}),Am=F({option:k().optional(),text:k().optional()}),jm=I({kind:V(`configuration_blocked`),decision:B([`retry`,`cancel`])}),Mm=I({diagnostics:P(Sp).min(1)});function Nm(e,t,n,r={}){let i={kind:V(e),request:t,resolution:n.optional(),resolutionRequestId:r.strict?k().min(1).optional():k().optional()};return{kind:e,resolution:n,interaction:r.strict?I(i):F(i)}}var Pm=F({reason:k(),suggestedRules:P(H())}),Fm=F({kind:V(`approval`),decision:B([`approve`,`deny`]),persistScope:B([`conversation`,`project`,`user`]).optional()}),Im=F({kind:V(`user_input`),answers:z(k(),L([k(),P(k()),Am])),dismissed:V(!0).optional()}),Lm=F({label:k().min(1).max(200),description:k().optional(),recommended:M().optional()}),Rm=F({questions:P(F({id:k().min(1).max(40).regex(/^[a-z0-9_-]+$/),question:k(),context:k().optional(),recommendation:k().optional(),options:P(Lm).max(6).superRefine((e,t)=>{new Set(e.map(e=>e.label)).size!==e.length&&t.addIssue({code:`custom`,message:`Option labels must be unique`}),e.filter(e=>e.recommended).length>1&&t.addIssue({code:`custom`,message:`Only one option may be recommended`})}).optional()})).min(1).max(5).superRefine((e,t)=>{new Set(e.map(e=>e.id)).size!==e.length&&t.addIssue({code:`custom`,message:`Question ids must be unique`})})});function zm(e){if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return Array.isArray(t.questions)?{...t,questions:t.questions.map((e,t)=>e&&typeof e==`object`&&!Array.isArray(e)?{...e,id:e.id===void 0?`q${t+1}`:e.id}:e)}:!(`questions`in t)&&typeof t.question==`string`?{questions:[{...t,id:`answer`}]}:e}function Bm(e){return Rm.parse(zm(e))}var Vm=I({targetProfile:om,expectedRevision:q.shape.expectedRevision,expectedDigest:q.shape.expectedDigest,assetId:k(),path:k(),title:k().optional(),summary:k().optional(),content:k().optional()}),Hm=Nm(`approval`,Pm,Fm),Um=Nm(`user_input`,Ic(zm,Rm),Im),Wm=Nm(`plan_review`,Vm,_m),Gm=Nm(`configuration_blocked`,Mm,jm,{strict:!0});Gm.interaction;var Km=R(`kind`,[Hm.resolution,Um.resolution,Wm.resolution,Gm.resolution]),qm=R(`kind`,[Hm.interaction,Um.interaction,Wm.interaction,Gm.interaction]),Jm=F({id:k(),conversationId:k(),turnId:k(),providerCallId:k().nullable(),assistantEventId:k().nullable(),contentIndex:j().int().nonnegative().nullable(),origin:Om,toolName:k(),arguments:z(k(),H()),state:Dm,supervision:km.nullable(),interaction:qm.nullable(),executionClaim:k().nullable(),updatedAt:k().datetime()}).superRefine((e,t)=>{let n=e.supervision?.approval;n&&(n.toolCallId!==e.id||n.toolName!==e.toolName)&&t.addIssue({code:`custom`,path:[`supervision`,`approval`],message:`Approval binding belongs to a different tool call`}),e.interaction?.kind===`configuration_blocked`&&!e.interaction.resolution&&e.state!==`awaiting_input`&&t.addIssue({code:`custom`,path:[`state`],message:`Unresolved configuration-blocked calls must await input`});let r=e.providerCallId!==null&&e.assistantEventId!==null&&e.contentIndex!==null,i=e.providerCallId===null&&e.assistantEventId===null&&e.contentIndex===null;(e.origin===`model`?!r:!i)&&t.addIssue({code:`custom`,message:`Tool-call references contradict its origin`})}),Ym=B([`user`,`parent_conversation`,`system`]),Xm=B([`next_turn`,`specific_execution`,`next_execution`]),Zm=B([`completed`,`failed`,`cancelled`,`timed_out`,`interrupted`]),Qm=R(`subtype`,[F({subtype:V(`task_result`),producer:k(),task:R(`kind`,[F({kind:V(`bash`),id:k(),exitCode:j().int().nullable()}),F({kind:V(`subagent`),id:k(),assignmentId:k()})]),outcome:Zm,text:k(),assetIds:P(k())}),F({subtype:V(`user_intervention`),producer:k(),text:k()}),F({subtype:V(`notification`),producer:k(),text:k()})]),$m=F({inputId:k(),conversationId:k(),acceptanceSequence:j().int().positive(),source:Ym,senderConversationId:k().nullable(),content:L([k(),Qm]),deliveryTarget:Xm,targetExecutionId:k().nullable(),wakeWhenIdle:M(),acceptedAt:k().datetime()}).superRefine((e,t)=>{e.source===`system`!=(typeof e.content!=`string`)&&t.addIssue({code:`custom`,message:`System inputs require a notice; other sources require text`}),e.source!==`parent_conversation`&&e.senderConversationId!==null&&t.addIssue({code:`custom`,message:`Only parent inputs may have a sender conversation`}),e.source===`parent_conversation`&&e.senderConversationId===null&&t.addIssue({code:`custom`,message:`Parent inputs require a sender`}),e.deliveryTarget===`specific_execution`&&e.targetExecutionId===null&&t.addIssue({code:`custom`,message:`Specific execution requires a target`})}),eh=F({conversationId:k(),inputId:k(),text:k(),deliveryTarget:Xm.optional(),targetExecutionId:k().nullable().optional(),source:B([`user`,`parent_conversation`]),senderConversationId:k().optional(),wakeWhenIdle:M().optional()}).superRefine((e,t)=>{e.source===`parent_conversation`&&!e.senderConversationId&&t.addIssue({code:`custom`,message:`Parent inputs require a sender`}),e.source===`user`&&e.senderConversationId!==void 0&&t.addIssue({code:`custom`,message:`User inputs cannot have a sender conversation`}),e.deliveryTarget===`specific_execution`&&!e.targetExecutionId&&t.addIssue({code:`custom`,message:`Specific execution requires a target`})}),th=B([`running`,`completed`,`failed`,`timed_out`,`cancelled`,`lost`]),nh=F({id:k(),conversationId:k(),toolCallId:k(),command:k(),workingDirectory:k(),status:th,processRef:k().nullable(),exitCode:j().int().nullable(),startedAt:k().datetime(),finishedAt:k().datetime().nullable()}),rh=F({conversationId:k(),bashId:k(),offset:j().int().nonnegative().optional(),limit:j().int().positive().max(65536).optional()}),ih=F({bash:nh,page:F({text:k(),offset:j().int().nonnegative(),nextOffset:j().int().nonnegative(),totalBytes:j().int().nonnegative()})}),ah=F({id:k(),revision:j().int().positive(),reason:B([`manual`,`threshold`,`overflow`]),status:B([`queued`,`running`,`stopping`,`completed`,`failed`,`cancelled`]),startedAt:k().datetime(),endedAt:k().datetime().optional(),executionId:k().optional(),headEventId:k().nullable(),attempt:L([V(1),V(2)]),summaryPreview:k().max(65536),eventId:k().optional(),errorMessage:k().optional()}),oh=B([`idle`,`running`,`waiting`,`failed`,`interrupted`]),sh=F({id:k(),projectId:k(),parentConversationId:k().nullable(),parentToolCallId:k().nullable(),headEventId:k().nullable(),title:k(),status:oh,statusEventSequence:j().int().nonnegative(),statusClearedAt:k().datetime().nullable(),paused:M(),nextInputSequence:j().int().positive(),pinnedAt:k().datetime().nullable(),completedAt:k().datetime().nullable(),lastUserMessageAt:k().datetime().nullable(),createdAt:k().datetime(),updatedAt:k().datetime()}),ch=F({conversationId:k(),model:Hc,reasoningLevel:Vc,systemPrompt:k().nullable(),instructions:fu.nullable(),permissionRuleSetId:k(),agentProfile:U,workingDirectory:k()});ch.pick({conversationId:!0,systemPrompt:!0,instructions:!0,workingDirectory:!0}).partial({systemPrompt:!0,instructions:!0});var lh=ch.partial({model:!0,reasoningLevel:!0,permissionRuleSetId:!0,agentProfile:!0,systemPrompt:!0,instructions:!0}),uh=F({provider:k().min(1),resourceKey:k().min(1),kind:k().min(1),relationship:B([`referenced`,`created`]),url:k().url().refine(e=>e.startsWith(`https://`)).nullable(),container:k(),identifier:k()}),dh=sh.omit({headEventId:!0,statusEventSequence:!0,nextInputSequence:!0}).extend({lastParentPromptAt:k().datetime().nullable().optional(),references:P(uh),childCount:j().int().nonnegative(),pendingWork:M(),pendingInput:F({conversationId:k(),conversationTitle:k(),toolCallId:k(),kind:B([`approval`,`user_input`,`plan_review`,`configuration_blocked`])}).nullable(),agentProfile:U.optional(),model:Hc.optional(),reasoningLevel:Vc.optional(),permissionRuleSetId:k().optional()}),fh=F({conversation:sh,lastSequence:j().int().nonnegative(),config:lh,toolCalls:P(Jm),queue:P($m),asyncBash:P(nh),children:P(dh),compaction:ah.nullable().optional()}),ph=B([`source_text`,`process_output`,`script_output`,`search_matches`,`file_listing`,`search_summaries`,`network_prose`,`resource_detail`,`mutation_acknowledgement`,`lifecycle_state`,`delegation_report`,`primary_file_result`,`human_response`,`vision_explanation`,`terminal_outcome`,`conservative_fallback`]),mh=B([`unchanged`,`head`,`tail`,`head_tail`,`item_aware`,`continuation_aware`,`artifact_index`,`terminal_outcome`]),hh=B([`primary_result`,`supporting_data`,`overflow_recovery`]),gh=R(`kind`,[F({kind:V(`agent_file`),path:k().min(1)}).strict(),F({kind:V(`managed_reference`),logicalPath:k().min(1)}).strict(),F({kind:V(`metadata_only`),location:k().min(1).optional()}).strict()]),_h=F({kind:B([`markdown`,`text`,`json`,`jsonl`,`image`,`binary`,`directory_manifest`]),mediaType:k().min(1),encoding:V(`utf-8`).optional()}).strict();F({version:V(1),id:k().min(1),role:hh,access:gh,availability:B([`available`,`unavailable`]),format:_h,size:F({bytes:j().int().nonnegative(),lines:j().int().nonnegative().optional(),items:j().int().nonnegative().optional(),itemKind:k().min(1).optional()}).strict(),recommendedTools:P(B([`read`,`grep`,`explain_image`])).max(3),label:k().min(1).max(256),unavailableReason:B([`missing`,`unsafe_path`,`symlink`,`not_regular`,`unsupported_format`,`validation_failed`]).optional()}).strict().superRefine((e,t)=>{e.availability===`unavailable`&&!e.unavailableReason&&t.addIssue({code:`custom`,path:[`unavailableReason`],message:`Unavailable artifacts require a reason.`}),e.availability===`available`&&e.unavailableReason&&t.addIssue({code:`custom`,path:[`unavailableReason`],message:`Available artifacts cannot have an unavailable reason.`}),e.format.encoding===`utf-8`&&![`markdown`,`text`,`json`,`jsonl`,`directory_manifest`].includes(e.format.kind)&&t.addIssue({code:`custom`,path:[`format`,`encoding`],message:`UTF-8 encoding is valid only for readable text formats.`}),e.access.kind!==`agent_file`&&e.recommendedTools.length>0&&t.addIssue({code:`custom`,path:[`recommendedTools`],message:`Only agent files may recommend inspection tools.`})});var vh=F({kind:B([`line`,`byte`,`item`,`event`,`task`]),original:j().int().nonnegative(),displayed:j().int().nonnegative(),omitted:j().int().nonnegative()}),yh=R(`kind`,[F({kind:V(`line`),nextOffset:j().int().nonnegative(),displayedStart:j().int().nonnegative(),displayedEnd:j().int().nonnegative(),total:j().int().nonnegative()}),F({kind:V(`byte`),nextByteOffset:j().int().nonnegative(),displayedStart:j().int().nonnegative(),displayedEnd:j().int().nonnegative(),total:j().int().nonnegative()}),F({kind:V(`cursor`),cursorName:k().min(1),value:L([k(),j()]),direction:B([`before`,`after`])}),F({kind:V(`page_token`),parameter:k().min(1),value:k()})]),bh=F({version:V(1),profile:ph,strategy:mh,terminalOutcomePrecedence:M(),fastPath:M(),recovery:B([`none`,`artifact`,`complete_payload`]),artifactRoles:P(hh),counts:P(vh),originalTextBytes:j().int().nonnegative(),displayedTextBytes:j().int().nonnegative(),originalTextLines:j().int().nonnegative(),displayedTextLines:j().int().nonnegative(),continuation:P(yh).optional()}).strict(),xh=R(`type`,[F({type:V(`text`),text:k()}),F({type:V(`image`),mimeType:k().min(1),byteLength:j().int().nonnegative().safe(),digest:k().regex(/^[a-f0-9]{64}$/),resultContentBlockIndex:j().int().nonnegative().safe()})]);F({version:V(1),blocks:P(xh).max(256)}).strict();var Sh=B([`single`,`concurrent`]),Ch=j().int().min(1).max(65535),wh=F({kind:V(`project`),projectId:k().startsWith(`proj_`)}),Th={parentFolderId:k().startsWith(`launchfolder_`).nullable().meta({description:"Id of the containing folder, or `null` for the top level."}),order:j().int().nonnegative().meta({description:`Position among siblings (folders and definitions with the same parent): exactly 0, 1, ..., n-1. Renumber siblings when inserting or removing.`})},Eh={id:k().startsWith(`launchdef_`).meta({description:"Starts with `launchdef_`; unique in the file. Use a readable suffix, e.g. `launchdef_web`."}),label:k().min(1).meta({description:"Display name, and the name `launches.*` calls select it by; without it the command is the name. Give each definition a distinct name."}).optional(),command:k().refine(e=>e.trim().length>0,`Command must be nonblank`).meta({description:"Shell command, not blank. There is no environment field; put variables in the command (`PORT=3000 pnpm dev`)."}),cwd:k().min(1).meta({description:`Working directory relative to the project directory. Default: the project directory. Prefer relative paths.`}).optional(),port:Ch.meta({description:`Port (1-65535) the process serves, shown to the user.`}).optional(),runPolicy:Sh.meta({description:"`single`: one run at a time. `concurrent`: several runs at once. Default `single`."}).default(`single`),createdAt:k().datetime().meta({description:`ISO 8601 date-time of creation.`}),updatedAt:k().datetime().meta({description:`ISO 8601 date-time of the last change; update it when you change the definition.`})},Dh=F({...Eh,scope:wh,...Th}),Oh=Dh.extend({scope:F({kind:V(`project`)}).strict().meta({description:'Always `{ "kind": "project" }`.'})}).strict().meta({description:`A saved project command.`}),kh=F({id:k().startsWith(`launchfolder_`).meta({description:"Starts with `launchfolder_`; unique in the file."}),label:k().min(1).refine(e=>e===e.trim(),`Folder label must be trimmed`).meta({description:`Folder name without leading or trailing spaces. Unique among sibling folders, ignoring case.`}),...Th}).strict().meta({description:`Organizes definitions; passes no settings to them.`}),Ah=R(`kind`,[F({kind:V(`folder`),id:k().startsWith(`launchfolder_`)}),F({kind:V(`definition`),id:k().startsWith(`launchdef_`)})]);F({version:V(1),definitions:P(F({...Eh,scope:F({kind:V(`project`),projectId:k().optional()}).strict().transform(({kind:e})=>({kind:e}))}).strict())}).strict(),F({version:V(2).meta({description:`Always 2.`}),folders:P(kh).meta({description:`All folders; may be empty.`}),definitions:P(Oh).meta({description:`All launch definitions; may be empty.`})}).strict().meta({description:"Launch definitions of a project, `<project>/.nerve/launches/definitions.json`. Not expressible here: ids are unique across folders and definitions; every `parentFolderId` names an existing folder and folders form no cycles; `order` values among the children of one parent (folders and definitions together) are exactly 0..n-1; sibling folder labels are unique ignoring case."}).superRefine((e,t)=>{let n=[...e.folders,...e.definitions],r=new Set,i=new Map(e.folders.map(e=>[e.id,e])),a=new Map,o=e=>t.addIssue({code:`custom`,message:e});for(let e of n){r.has(e.id)&&o(`Duplicate ID: ${e.id}`),r.add(e.id),e.parentFolderId!==null&&!i.has(e.parentFolderId)&&o(`Missing parent: ${e.parentFolderId}`);let t=a.get(e.parentFolderId)??[];t.push(e),a.set(e.parentFolderId,t)}for(let e of a.values()){e.map(e=>e.order).sort((e,t)=>e-t).some((e,t)=>e!==t)&&o(`Sibling orders must be contiguous and unique`);let t=new Set;for(let n of e.filter(e=>e.id.startsWith(`launchfolder_`))){let e=n.label.trim().toLowerCase();t.has(e)&&o(`Duplicate sibling folder name`),t.add(e)}}for(let t of e.folders){let e=new Set([t.id]),n=t.parentFolderId;for(;n!==null&&i.has(n);){if(e.has(n)){o(`Folder cycle`);break}e.add(n),n=i.get(n).parentFolderId}}});var jh=F({projectId:k().startsWith(`proj_`),revision:k(),folders:P(kh),definitions:P(Dh)}),Mh=F({label:Eh.label,command:Eh.command,cwd:Eh.cwd,port:Eh.port,runPolicy:Eh.runPolicy,sourceLaunchId:k().startsWith(`launch_`).optional(),parentFolderId:Th.parentFolderId.default(null),beforeSibling:Ah.nullable().default(null)}),Nh=Mh.omit({sourceLaunchId:!0,parentFolderId:!0,beforeSibling:!0}).extend({runPolicy:Sh}),Ph=B([`starting`,`running`,`ready`,`stopping`,`completed`,`failed`,`timed_out`,`cancelled`]),Fh=B([`foreground`,`background`]),Ih=F({readyUrl:k().url().optional(),readyOnUrl:M().optional(),readyPattern:k().optional(),timeoutMs:j().int().nonnegative().optional(),outcome:B([`pending`,`ready`,`timeout`,`exited`,`unavailable`,`none`]),matched:k().optional(),readyAt:k().datetime().optional()}),Lh=F({protocol:B([`tcp`,`tcp6`]),address:k().min(1),port:j().int().positive().max(65535),pid:j().int().positive(),identity:k().min(1),processName:k().min(1).optional()}),Rh=F({protocol:B([`tcp`,`tcp6`]),address:k().min(1),port:j().int().positive().max(65535),pid:j().int().positive().optional(),processGroupId:j().int().positive().optional(),processStartTimeTicks:j().int().nonnegative().optional(),detectedAt:k().datetime()}),zh=R(`kind`,[F({kind:V(`linux`),startTimeTicks:j().int().nonnegative()}),F({kind:V(`darwin`),startFingerprint:k().startsWith(`darwin:`)}),F({kind:V(`win32`),creationDate:k().startsWith(`win32:`)})]),Bh=F({version:V(2),platform:k().min(1),childPid:j().int().positive(),processGroupId:j().int().positive().optional(),detached:M(),shell:M(),containment:B([`job-object`,`process-group`]),spawnedAt:k().datetime(),identity:zh,listeningPorts:P(Rh).optional(),capabilities:F({identity:M(),processTree:M(),listeningPorts:M(),detail:k().optional()})}),Vh=F({keys:P(k().min(1)).default([]),persisted:M(),redacted:V(!0).default(!0)}),Hh=F({id:k().startsWith(`launch_`),definitionId:k().startsWith(`launchdef_`).optional(),name:k().min(1).optional(),displayName:k().min(1).optional(),groupId:k().startsWith(`launchgrp_`).optional(),groupName:k().min(1).optional(),projectId:k().startsWith(`proj_`).optional(),cwd:k().min(1),command:k().min(1),envInfo:Vh.optional(),status:Ph,readiness:Ih,stdoutPath:k().min(1),stderrPath:k().min(1),combinedPath:k().min(1).optional(),logsPath:k().min(1),startedAt:k().datetime(),updatedAt:k().datetime(),finishedAt:k().datetime().optional(),exitCode:j().int().nullable().optional(),signal:k().nullable().optional(),error:k().optional(),timeoutMs:j().int().positive().optional(),restartedFromLaunchId:k().startsWith(`launch_`).optional(),restartRootLaunchId:k().startsWith(`launch_`).optional(),restartGeneration:j().int().nonnegative().optional(),runtime:Bh.optional(),visibility:Fh.default(`background`)}),Uh=B([`SIGTERM`,`SIGINT`,`SIGKILL`]),Wh=F({definitionId:k().startsWith(`launchdef_`).optional(),definitionRunPolicy:Sh.optional(),name:k().min(1).optional(),displayName:k().min(1).optional(),groupId:k().startsWith(`launchgrp_`).optional(),groupName:k().min(1).optional(),projectId:k().startsWith(`proj_`).optional(),cwd:k().min(1),command:k().min(1),env:z(k(),k()).optional(),readyUrl:k().url().optional(),readyOnUrl:M().optional(),readyPattern:k().min(1).optional(),readyTimeoutMs:j().int().nonnegative().max(6e4).optional(),timeoutMs:j().int().positive().max(864e5).optional()});F({signal:Uh.optional(),timeoutMs:j().int().positive().max(3e4).optional(),reason:k().min(1).optional()}),F({removed:P(k().startsWith(`launch_`))});var Gh=F({seq:j().int().positive(),ts:k().datetime(),stream:B([`stdout`,`stderr`]),level:B([`info`,`warn`,`error`]),line:k(),raw:F({start:j().int().nonnegative(),end:j().int().nonnegative(),terminatorBytes:j().int().nonnegative().max(2),fidelity:B([`captured`,`reconstructed`])}).optional()}),Kh=F({mode:B([`recent`,`errors`,`warnings`,`since_cursor`,`first_failure`]).optional(),sinceSeq:j().int().nonnegative().optional(),beforeSeq:j().int().nonnegative().optional(),contains:k().optional(),regex:k().optional(),contextLines:j().int().nonnegative().max(20).optional(),limit:j().int().positive().max(500).optional()}).superRefine((e,t)=>{let n=e.mode??`recent`;n===`since_cursor`&&e.beforeSeq!==void 0&&t.addIssue({code:`custom`,path:[`beforeSeq`],message:`since_cursor cannot use beforeSeq.`}),n!==`since_cursor`&&e.sinceSeq!==void 0&&t.addIssue({code:`custom`,path:[`sinceSeq`],message:`${n} cannot use sinceSeq.`}),n===`first_failure`&&e.beforeSeq!==void 0&&t.addIssue({code:`custom`,path:[`beforeSeq`],message:`first_failure cannot use a directional cursor.`})}),qh=F({launch:Hh,events:P(Gh),nextCursor:j().int().nonnegative(),firstSeq:j().int().positive().optional(),lastSeq:j().int().positive().optional(),hasMoreBefore:M(),hasMoreAfter:M(),olderBeforeSeq:j().int().positive().optional(),futureSinceSeq:j().int().nonnegative().optional(),originalEventCount:j().int().nonnegative().optional(),displayedEventCount:j().int().nonnegative().optional(),omittedEventCount:j().int().nonnegative().optional(),streamArtifacts:F({stdoutPath:k().min(1),stderrPath:k().min(1),eventsPath:k().min(1),combinedPath:k().min(1).optional(),fidelity:B([`captured`,`reconstructed`])}).optional(),mode:k(),previewPath:k().min(1).optional(),truncated:M().optional()}),Jh=L([F({type:V(`text`),text:k()}),F({type:V(`image`),data:k(),mimeType:k()})]),Yh=B([`head`,`tail`,`line`,`head_tail`]),Xh=F({truncated:M(),direction:Yh.optional(),originalBytes:j().nonnegative().optional(),displayedBytes:j().nonnegative().optional(),omittedBytes:j().nonnegative().optional(),originalChars:j().nonnegative().optional(),displayedChars:j().nonnegative().optional(),omittedChars:j().nonnegative().optional(),originalLines:j().nonnegative().optional(),displayedLines:j().nonnegative().optional(),omittedLines:j().nonnegative().optional(),truncatedLines:j().nonnegative().optional(),maxBytes:j().positive().optional(),maxLines:j().positive().optional(),maxLineChars:j().positive().optional(),partialLine:M().optional()}).passthrough(),Zh=F({kind:B([`full_output`,`raw_result`,`fetched_content`,`transcript`]),path:k().min(1),label:k().optional(),bytes:j().nonnegative().optional(),chars:j().nonnegative().optional(),lines:j().nonnegative().optional()}).passthrough(),Qh=F({id:k().min(1).optional(),role:B([`primary_result`,`supporting_data`,`overflow_recovery`]),path:k().min(1).optional(),logicalPath:k().min(1).optional(),format:F({kind:B([`markdown`,`text`,`json`,`jsonl`,`image`,`binary`,`directory_manifest`]),mediaType:k().min(1),encoding:V(`utf-8`).optional()}),bytes:j().int().nonnegative().optional(),lines:j().int().nonnegative().optional(),items:j().int().nonnegative().optional(),itemKind:k().min(1).optional(),label:k().min(1).max(256),recommendedTools:P(B([`read`,`grep`,`explain_image`])).max(3)}).refine(e=>!!(e.path||e.logicalPath),{message:`Artifact claims require a path or logicalPath.`}),$h=F({capped:M(),direction:V(`tail`),maxChars:j().positive(),maxChunks:j().positive(),totalChars:j().nonnegative().optional(),displayedChars:j().nonnegative().optional(),omittedChars:j().nonnegative().optional(),totalLines:j().nonnegative().optional(),displayedLines:j().nonnegative().optional(),omittedLines:j().nonnegative().optional()}).passthrough(),eg=F({execution:Xh.optional(),storage:Xh.extend({rawResultPath:k().optional()}).optional(),model:Xh.extend({contentKind:B([`content_blocks`,`formatted_text`]).optional()}).optional(),live:$h.optional(),artifacts:P(L([Qh,Zh])).optional(),continuation:F({nextOffset:j().optional(),nextByteOffset:j().optional(),hint:k().optional()}).passthrough().optional()}).passthrough(),tg=F({truncated:M().optional(),omittedLines:j().optional(),omittedChars:j().optional(),omittedBytes:j().optional(),truncatedLines:j().optional(),direction:B([`head`,`tail`,`line`,`head_tail`]).optional(),partialLine:M().optional(),nextOffset:j().optional(),nextByteOffset:j().optional(),maxLines:j().optional(),maxBytes:j().optional(),originalChars:j().optional(),displayedChars:j().optional(),maxLineChars:j().optional(),byteOffset:j().optional(),byteLimit:j().optional(),rawResultPath:k().optional()}).passthrough(),ng=F({bytes:j().optional(),lines:j().optional(),displayedBytes:j().optional(),displayedLines:j().optional(),truncated:M().optional(),omittedLines:j().optional(),omittedChars:j().optional(),omittedBytes:j().optional(),truncatedLines:j().optional(),direction:B([`head`,`tail`,`line`,`head_tail`]).optional(),maxLineChars:j().optional(),savedTo:k().optional()}).passthrough(),rg=F({stdout:ng.optional(),stderr:ng.optional(),combined:ng.optional()}).passthrough(),ig=F({diff:k().optional(),firstChangedLine:j().optional(),lineEnding:L([V(`
|
|
56
56
|
`),V(`\r
|
|
57
|
-
`)]).optional(),bom:M().optional()}).passthrough(),og=F({index:j().int().nonnegative(),type:B([`replace_text`,`insert_text`,`replace_lines`,`insert_lines`,`apply_patch`]),source:B([`replacements`,`insertions`,`lineReplacements`,`lineInsertions`,`patch`,`edits`]).optional(),sourceIndex:j().int().nonnegative().optional(),status:B([`applied`,`failed`,`not_applied`]).optional(),error:k().optional(),matchMode:B([`exact`,`trimmed`,`whitespace`]).optional(),occurrence:j().int().positive().optional(),matchCount:j().int().nonnegative().optional(),startLine:j().int().positive().optional(),endLine:j().int().positive().optional(),matchedBy:B([`unique`,`occurrence`,`line_range`,`line_insert`,`patch`]).optional()}).passthrough(),sg=ag.extend({dryRun:M().optional(),appliedCount:j().int().nonnegative().optional(),operationCount:j().int().nonnegative(),operations:P(og)}),cg=R(`disposition`,[F({disposition:V(`completed`)}),F({disposition:V(`backgrounded`),taskId:k().startsWith(`task_`),status:Ph,elapsedMs:j().nonnegative(),terminalUpdate:V(`automatic`)})]),lg=F({truncation:ng.optional(),fullOutputPath:k().optional(),rawResultPath:k().optional(),signal:k().nullable().optional(),execution:cg.optional()}).passthrough(),ug=F({path:k(),size:j().nonnegative().optional()}).passthrough(),dg=F({truncation:ng.optional(),fullOutputPath:k().optional(),rawResultPath:k().optional(),signal:k().nullable().optional(),executable:k().optional(),version:k().optional(),timeoutSeconds:j().optional(),durationMs:j().optional(),timedOut:M().optional(),timeoutKilled:M().optional(),allowNetwork:M().optional(),allowFileWrite:M().optional(),inputMode:B([`inline`,`file`]).optional(),scriptPath:k().optional(),streams:ig.optional(),artifactDir:k().optional(),artifacts:P(ug).optional(),envKeys:P(k()).optional()}).passthrough(),fg=F({path:k(),kind:B([`file`,`directory`,`other`])}),pg=F({path:k(),line:j(),text:k()}),mg=Qs({outcome:B([`created`,`overwritten`]).optional(),bytes:j().int().nonnegative().optional()}),hg=Qs({totalMatches:j().int().nonnegative().optional(),totalFiles:j().int().nonnegative().optional()}),gg=Qs({totalEntries:j().int().nonnegative().optional()}),_g=Qs({assignments:P(F({name:k(),profile:k().optional(),disposition:B([`created`,`follow_up`,`rejected`]),agentId:k().optional(),reason:k().optional()})).optional()}),vg=Qs({agents:P(F({name:k(),agentId:k().optional(),profile:k().optional(),state:B([`running`,`waiting`,`idle`,`stopped`,`failed`,`interrupted`]),contextPercent:j().min(0).max(100).optional(),lastActivityAt:k().datetime().optional()})).optional()}),yg=Qs({results:P(F({name:k(),outcome:B([`stopped`,`already_idle`,`not_found`,`failed`]),runMs:j().nonnegative().optional(),reason:k().optional()})).optional()});F({query:k(),answer:k().optional(),results:P(F({title:k(),url:k(),content:k().optional(),score:j().optional()}))});var bg=F({url:k(),status:j(),contentType:k(),size:j(),savedTo:k().optional(),converted:M()});R(`mode`,[F({mode:V(`lines`),requestedStartLine:j().int().positive(),requestedLimit:j().int().positive(),sourceTotalLines:j().int().nonnegative(),returnedStartLine:j().int().positive(),returnedEndLine:j().int().nonnegative(),returnedContentLines:j().int().nonnegative(),sourceEndsWithNewline:M(),nextOffset:j().int().positive().optional(),nextByteOffset:j().int().nonnegative().optional()}),F({mode:V(`bytes`),requestedByteOffset:j().int().nonnegative(),requestedByteLimit:j().int().positive(),sourceBytes:j().int().nonnegative(),returnedByteStart:j().int().nonnegative(),returnedByteEnd:j().int().nonnegative(),utf8AdjustedStart:j().int().nonnegative(),utf8AdjustedEnd:j().int().nonnegative(),nextByteOffset:j().int().nonnegative().optional()})]);var xg=F({content:k().optional(),contentBlocks:P(Yh).optional(),details:N().optional(),path:k().optional(),entries:P(fg).optional(),matches:P(pg).optional(),stdout:k().optional(),stderr:k().optional(),exitCode:j().optional()}),Sg=F({questions:P(F({id:k(),question:k(),answer:Am.optional(),skipped:V(!0).optional()})),dismissed:M().optional()}),Cg=F({type:V(`text`),text:k(),textSignature:k().optional()}),wg=F({type:V(`image`),data:k(),mimeType:k()}),Tg=F({type:V(`thinking`),thinking:k(),thinkingSignature:k().optional(),redacted:M().optional()}),Eg=F({type:V(`toolCall`),id:k(),name:k(),arguments:z(k(),H()),argumentsError:k().optional(),thoughtSignature:k().optional(),namespace:k().optional()}),Dg=R(`type`,[Cg,Tg,Eg]);R(`type`,[Cg,wg]);var Og=P(R(`type`,[Cg,F({type:V(`image`),assetId:k(),mimeType:k()})])),kg=xg.extend({contentBlocks:P(L([Cg,F({type:V(`image`),assetId:k(),mimeType:k(),byteLength:j().nonnegative().optional()})])).optional()}),Ag=F({argsPreview:H(),resultPreview:H(),previewOverflow:F({hidden:j().nonnegative(),noun:k(),direction:B([`head`,`tail`,`mixed`]).optional()}).optional()}),jg=F({input:j(),output:j(),cacheRead:j(),cacheWrite:j(),cacheWrite1h:j().optional(),reasoning:j().optional(),totalTokens:j(),cost:F({input:j(),output:j(),cacheRead:j(),cacheWrite:j(),total:j()})}),Mg=F({text:k(),originalText:k(),acceptedAt:k().datetime().optional(),source:B([`user`,`parent_conversation`]),senderConversationId:k().nullable()}),Ng=F({content:P(Dg),usage:jg,stopReason:B([`pending`,`stop`,`length`,`toolUse`,`error`,`aborted`,`deferred`]),api:k(),provider:k(),model:k(),errorMessage:k().optional(),responseModel:k().optional(),responseId:k().optional(),providerThinkingLevel:k().optional(),rawStopReason:k().optional()});B([`started`,`waiting`,`retrying`,`completed`,`failed`,`cancelled`,`interrupted`]);var Pg={retry:F({attempt:j().int().positive(),maxAttempts:j().int().positive(),delayMs:j().nonnegative(),exhausted:M().optional(),error:k()}).optional(),waiting:F({toolCallId:k().optional(),childConversationId:k().optional()}).optional(),failure:F({message:k(),category:k().optional()}).optional()},Fg=R(`transition`,[F({subtype:V(`execution_state`),transition:V(`started`),...Pg}),F({subtype:V(`execution_state`),transition:B([`waiting`,`retrying`,`completed`,`failed`,`cancelled`,`interrupted`]),executionId:k(),...Pg})]),Ig=F({subtype:V(`fork`),sourceConversationId:k(),sourceTitle:k(),subagents:P(k()),text:k()}),Lg=R(`subtype`,[...Qm.options,Fg,Ig]),Rg=B([`completed`,`failed`,`denied`,`cancelled`,`indeterminate`]),zg=F({toolCallId:k(),providerCallId:k().nullable(),toolName:k(),arguments:z(k(),H()),origin:Om,assistantEventId:k().nullable(),contentIndex:j().int().nonnegative().nullable(),outcome:Rg,startedAt:k().datetime().optional(),agentProjection:Og,agentProjectionSnapshot:bh.optional(),userProjection:Ag,supervision:km.nullable(),interactionResolution:Km.nullable(),resolutionRequestId:k().nullable(),assetIds:P(k())}),Bg=F({summary:k(),firstKeptEventId:k().nullable(),tokensBefore:j().int().nonnegative(),details:H().nullable()}),Vg=B([`none`,`user`,`assistant`,`tool_result`]),Hg=B([`user_message`,`assistant_message`,`system_event`,`tool_call_response`,`compaction`]),Ug={id:k(),conversationId:k(),sequence:j().int().positive(),previousEventId:k().nullable(),turnId:k().nullable(),inputId:k().nullable(),createdAt:k().datetime()},Wg=R(`type`,[F({...Ug,type:V(`user_message`),llmRepresentation:V(`user`),payload:Mg}),F({...Ug,type:V(`assistant_message`),llmRepresentation:V(`assistant`),payload:Ng}),F({...Ug,type:V(`system_event`),llmRepresentation:B([`none`,`user`]),payload:Lg}),F({...Ug,type:V(`tool_call_response`),llmRepresentation:Vg,payload:zg}),F({...Ug,type:V(`compaction`),llmRepresentation:V(`user`),payload:Bg})]).superRefine((e,t)=>{if(e.type===`tool_call_response`&&(e.payload.origin===`model`?e.llmRepresentation!==`tool_result`:![`user`,`none`].includes(e.llmRepresentation))&&t.addIssue({code:`custom`,message:`Tool response representation contradicts its origin`}),e.type===`tool_call_response`){let n=e.payload,r=n.providerCallId!==null&&n.assistantEventId!==null&&n.contentIndex!==null,i=n.providerCallId===null&&n.assistantEventId===null&&n.contentIndex===null;(n.origin===`model`?!r:!i)&&t.addIssue({code:`custom`,message:`Tool-response references contradict its origin`})}e.type===`system_event`&&e.payload.subtype===`execution_state`&&e.llmRepresentation!==`none`&&t.addIssue({code:`custom`,message:`Execution facts cannot contribute to context`})}),Gg=F({id:k(),previousEventId:k().nullable(),type:Hg,preview:k(),createdAt:k().datetime()}),Kg=R(`type`,[Cg.omit({textSignature:!0}),Tg.omit({thinkingSignature:!0}),Eg]),qg=R(`type`,[Wg.options[0],Wg.options[1].extend({payload:Ng.extend({content:P(Kg)})}),Wg.options[2],Wg.options[4],Wg.options[3].extend({payload:zg.omit({agentProjection:!0})})]),Jg=k().regex(/^[a-z][a-z0-9_-]{0,31}$/),Yg=F({chunk:k(),stream:Jg.optional()}),Xg=R(`type`,[F({type:V(`assistant_reset`),turnId:k()}),F({type:V(`assistant_text`),turnId:k(),contentIndex:j().int().nonnegative(),delta:k()}),F({type:V(`assistant_thinking`),turnId:k(),contentIndex:j().int().nonnegative(),delta:k()}),F({type:V(`tool_call_arguments`),turnId:k(),contentIndex:j().int().nonnegative(),providerCallId:k(),name:k(),partialArgsText:k()}),F({type:V(`tool_progress`),toolCallId:k(),update:Yg}),F({type:V(`execution_activity`),activity:k()})]),Zg=F({responseCount:j().int().nonnegative(),input:j(),output:j(),cacheRead:j(),cacheWrite:j(),totalTokens:j(),cost:j()}),Qg=F({own:Zg,subagents:Zg,total:Zg,subagentCount:j().int().nonnegative()});function $g(e){return e.split(``).flatMap((e,t)=>[...t?[{type:`image`}]:[],...e?[{type:`text`,text:e}]:[]])}function e_(e){return e.replaceAll(``,`(image)`)}var t_=I({id:k(),projectId:k(),parentConversationId:k().nullable().optional(),title:k(),config:ch.pick({systemPrompt:!0,instructions:!0,workingDirectory:!0}).partial().strict(),overrides:K.optional(),agentProfile:om.optional()}),n_=F({projectId:k(),parentConversationId:k().nullable().optional()}),r_=F({conversationId:k(),patch:ch.pick({systemPrompt:!0,instructions:!0,workingDirectory:!0}).partial().strict()}).strict(),i_=F({conversationId:k(),patch:F({title:k().trim().min(1).max(200).optional(),pinned:M().optional(),completed:M().optional(),clearStatus:M().optional()})}),a_=I({toolCallId:k(),resolutionRequestId:k(),resolution:Km}),J=F({conversationId:k()}),o_=F({}),Y=Ks(),X={"project.create":{params:wd.omit({createdAt:!0,updatedAt:!0}),result:wd},"project.list":{params:o_,result:P(wd)},"project.get":{params:F({projectId:k()}),result:wd.nullable()},"project.update":{params:F({projectId:k(),patch:wd.pick({name:!0,directory:!0}).partial()}),result:wd},"project.delete":{params:F({projectId:k()}),result:Y},"conversation.create":{params:t_,result:fh},"conversation.list":{params:n_,result:P(dh)},"conversation.getUsage":{params:J,result:Qg},"conversation.getSnapshot":{params:J,result:fh},"conversation.getHistory":{params:J.extend({beforeEventId:k().optional(),limit:j().int().positive()}),result:P(qg)},"toolCall.getDetails":{params:J.extend({toolCallId:k()}),result:F({agentProjection:Og,result:kg})},"conversation.getTree":{params:J,result:P(Gg)},"conversation.getEventsSince":{params:J.extend({sequence:j().int().nonnegative()}),result:P(qg)},"conversation.configure":{params:r_,result:Y},"conversation.setAgentProfile":{params:hm,result:gm},"conversation.previewAgentProfile":{params:pm,result:mm},"agentConfiguration.get":{params:qp,result:Jp},"agentConfiguration.save":{params:Yp,result:Xp},"agentConfiguration.getEffective":{params:Qp,result:$p},"agentConfiguration.resolveProject":{params:sm,result:cm},"conversationDefaults.get":{params:nm,result:rm},"conversationDefaults.save":{params:im,result:am},"conversation.update":{params:i_,result:Y},"conversation.selectHead":{params:J.extend({eventId:k().nullable()}),result:Y},"conversation.fork":{params:J.extend({eventId:k()}),result:fh},"conversation.compact":{params:J,result:Y},"conversation.cancelCompaction":{params:J,result:Y},"conversation.delete":{params:J,result:Y},"conversation.pause":{params:J,result:Y},"conversation.resume":{params:J,result:Y},"conversation.stop":{params:J,result:Y},"conversation.retryResponse":{params:J,result:Y},"conversation.forcePush":{params:J,result:Y},"conversation.continue":{params:J,result:Y},"input.submit":{params:eh,result:Y},"input.cancel":{params:F({inputId:k()}),result:Y},"interaction.resolve":{params:a_,result:vm},"asyncBash.logs":{params:rh,result:ih},"asyncBash.cancel":{params:F({bashId:k()}),result:Y}};function Z(e,t,n,r,i,a,o={}){return{method:e,paramsSchema:t,resultSchema:n,kind:r,allowedTargetRoles:i,requiredCapability:a,invocationScope:o.invocationScope??`stateless`,trustedResult:o.trustedResult??!1}}var s_=B([`agent-preferences`,`agent-profile`,`rule-set`,`permission-overlay`,`launch-catalog`,`mcp-servers`,`skill`,`prompt-suggestion`,`extension`]),c_=I({kind:s_,id:k().min(1),scope:B([`builtin`,`user`,`project`,`conversation`]),path:k().optional(),state:B([`active`,`disabled`,`shadowed`,`invalid`,`incompatible`,`needs_review`,`declined`]),approval:I({kind:B([`trust`,`consent`]),where:k().min(1)}).optional(),shadowedBy:Rc.optional(),previousVersionActive:V(!0).optional(),diagnostics:P(Td)}),l_=I({kind:s_,scope:B([`user`,`project`]),projectId:k().optional(),id:k().min(1)}),u_=I({text:k().min(1),short:k().min(1).max(32),broad:M(),new:M()}),d_=I({path:k().min(1),label:k().min(1),bytes:j().int().nonnegative().optional(),script:M().optional()}),f_=I({target:l_,name:k().min(1),kindLabel:k().min(1),state:Gc,changedSinceDecision:M(),changedAt:k().datetime().optional(),items:P(u_),sources:P(d_),digest:k().min(1)}),p_=I({target:l_,digest:k().min(1),trusted:M()}),m_=B([`user`,`project`,`nerve`,`agentBrowser`]),h_=F({skills:P(F({name:k().min(1),description:k(),filePath:k().min(1),source:m_,trustState:Gc.optional(),changedSinceDecision:V(!0).optional()}))}),g_=I({path:k().min(1),bytes:j().int().nonnegative(),script:M()}),__=I({projectId:k().min(1),name:k().min(1)}),v_=I({name:k().min(1),description:k(),folder:k().min(1),contentDigest:k().min(1),trustState:Gc,changedSinceDecision:M(),files:P(g_)}),y_=e=>e===`agentBrowser`?`agentBrowser`:e===`nerve`?`nerve`:`file`,b_=[`project`,`user`,`agentBrowser`,`nerve`];function x_(e){return[...e].sort((e,t)=>b_.indexOf(e.source)-b_.indexOf(t.source))}var S_=B([`text`,`markdown`,`links`,`table`,`artifacts`]),C_=k().regex(/^[a-z][a-z0-9_-]{0,31}$/),w_=I({id:C_,type:S_,label:k().min(1).max(64).optional(),live:B([`stream`,`transient`]).optional()}),T_=I({header:I({argument:k().min(1),format:B([`text`,`path`]).optional()}).optional(),meta:P(k().min(1)).max(3).optional(),sections:P(w_).min(1)}),E_=Qs({extension:k(),tool:k(),sections:P(I({id:C_,type:S_,label:k().optional(),value:N()}))}),D_=B([`subagents`,`fileInspection`,`fileEditing`,`shell`,`python`,`web`,`quickScript`,`extension`,`input`,`process`,`planMode`]),O_=B([`local`,`host`]),k_=B([`write_capable`,`read_only_network`,`long_running`,`credentialed`,`suspending`]),A_=F({name:_u,kind:Zc,groups:P(k().trim().min(1).max(128)).min(1),baseRisk:Qc,primaryArguments:P(k().trim().min(1).max(128)),targetKinds:P($c).min(1),argumentSensitive:M().default(!1),description:k(),group:D_,extension:k().optional(),view:T_.optional(),executionKind:O_,traits:P(k_),permission:F({ruleKind:Ou,durableAllow:ku})});B([`committed`,`waiting`,`running`,`completed`,`denied`,`failed`,`cancelled`]),B([`drafting`,`drafted`,`executing`,`completed`,`failed`,`denied`,`cancelled`,`interrupted`]);var j_=B([`slash`,`file`,`directory`,`launch`,`pull_request`,`issue`,`skill`,`tool`,`agent_profile`,`launch_definition`,`subagent`]),M_=ic([j().int().nonnegative(),j().int().nonnegative()]),N_=F({documentId:k().min(1).optional(),version:k().min(1).optional(),enabled:M().optional(),available:M().optional(),canDisable:M().optional(),unavailableReason:k().optional(),status:k().optional(),scoreFactors:F({lexical:j(),context:j(),usage:j(),state:j(),prior:j().optional()}).optional(),label:k().min(1),detail:k().optional(),info:k().optional(),kind:j_,apply:k().optional(),displayLabel:k().optional(),sortScore:j().optional(),matchRanges:P(M_).optional(),detailMatchRanges:P(M_).optional()}),P_=L([I({conversationId:k().min(1)}),I({projectId:k().min(1),overrides:K,agentProfile:om.optional(),config:ch.pick({systemPrompt:!0,instructions:!0,workingDirectory:!0}).partial().strict().optional()})]),F_=I({name:k(),description:k(),parameters:z(k(),N())}),I_=R(`status`,[I({status:V(`available`),systemPrompt:k(),tools:P(F_),resolution:Tp}),Gp]),L_=F({}).optional(),Q=[`workbench_server`],R_=F({scope:Lc,projectId:k().optional(),ruleSetId:gl}),z_=[Z(`agentConfiguration.get`,X[`agentConfiguration.get`].params,X[`agentConfiguration.get`].result,`read`,Q,`operation.agentConfiguration.get`),Z(`agentConfiguration.save`,X[`agentConfiguration.save`].params,X[`agentConfiguration.save`].result,`mutation`,Q,`operation.agentConfiguration.save`),Z(`agentConfiguration.getEffective`,X[`agentConfiguration.getEffective`].params,X[`agentConfiguration.getEffective`].result,`read`,Q,`operation.agentConfiguration.getEffective`),Z(`agentConfiguration.resolveProject`,X[`agentConfiguration.resolveProject`].params,X[`agentConfiguration.resolveProject`].result,`read`,Q,`operation.agentConfiguration.resolveProject`),Z(`conversationDefaults.get`,X[`conversationDefaults.get`].params,X[`conversationDefaults.get`].result,`read`,Q,`operation.conversationDefaults.get`),Z(`conversationDefaults.save`,X[`conversationDefaults.save`].params,X[`conversationDefaults.save`].result,`mutation`,Q,`operation.conversationDefaults.save`),Z(`conversation.previewAgentProfile`,X[`conversation.previewAgentProfile`].params,X[`conversation.previewAgentProfile`].result,`read`,Q,`operation.conversation.previewAgentProfile`),Z(`toolCall.getDetails`,X[`toolCall.getDetails`].params,X[`toolCall.getDetails`].result,`read`,Q,`operation.toolCall.getDetails`),Z(`project.create`,X[`project.create`].params,X[`project.create`].result,`mutation`,Q,`operation.project.create`),Z(`project.list`,X[`project.list`].params,X[`project.list`].result,`read`,Q,`operation.project.list`),Z(`project.get`,X[`project.get`].params,X[`project.get`].result,`read`,Q,`operation.project.get`),Z(`project.update`,X[`project.update`].params,X[`project.update`].result,`mutation`,Q,`operation.project.update`),Z(`project.delete`,X[`project.delete`].params,X[`project.delete`].result,`mutation`,Q,`operation.project.delete`),Z(`conversation.create`,X[`conversation.create`].params,X[`conversation.create`].result,`mutation`,Q,`operation.conversation.create`),Z(`conversation.list`,X[`conversation.list`].params,X[`conversation.list`].result,`read`,Q,`operation.conversation.list`),Z(`conversation.getSnapshot`,X[`conversation.getSnapshot`].params,X[`conversation.getSnapshot`].result,`read`,Q,`operation.conversation.getSnapshot`),Z(`conversation.getUsage`,X[`conversation.getUsage`].params,X[`conversation.getUsage`].result,`read`,Q,`operation.conversation.getUsage`),Z(`conversation.previewSystemPrompt`,P_,I_,`read`,Q,`operation.conversation.previewSystemPrompt`),Z(`conversation.getHistory`,X[`conversation.getHistory`].params,X[`conversation.getHistory`].result,`read`,Q,`operation.conversation.getHistory`,{trustedResult:!0}),Z(`conversation.getTree`,X[`conversation.getTree`].params,X[`conversation.getTree`].result,`read`,Q,`operation.conversation.getTree`),Z(`conversation.getEventsSince`,X[`conversation.getEventsSince`].params,X[`conversation.getEventsSince`].result,`read`,Q,`operation.conversation.getEventsSince`,{trustedResult:!0}),Z(`conversation.setAgentProfile`,X[`conversation.setAgentProfile`].params,X[`conversation.setAgentProfile`].result,`mutation`,Q,`operation.conversation.setAgentProfile`),Z(`conversation.configure`,X[`conversation.configure`].params,X[`conversation.configure`].result,`mutation`,Q,`operation.conversation.configure`),Z(`conversation.update`,X[`conversation.update`].params,X[`conversation.update`].result,`mutation`,Q,`operation.conversation.update`),Z(`conversation.selectHead`,X[`conversation.selectHead`].params,X[`conversation.selectHead`].result,`mutation`,Q,`operation.conversation.selectHead`),Z(`conversation.fork`,X[`conversation.fork`].params,X[`conversation.fork`].result,`mutation`,Q,`operation.conversation.fork`),Z(`conversation.compact`,X[`conversation.compact`].params,X[`conversation.compact`].result,`mutation`,Q,`operation.conversation.compact`),Z(`conversation.cancelCompaction`,X[`conversation.cancelCompaction`].params,X[`conversation.cancelCompaction`].result,`mutation`,Q,`operation.conversation.cancelCompaction`),Z(`conversation.delete`,X[`conversation.delete`].params,X[`conversation.delete`].result,`mutation`,Q,`operation.conversation.delete`),Z(`conversation.pause`,X[`conversation.pause`].params,X[`conversation.pause`].result,`mutation`,Q,`operation.conversation.pause`),Z(`conversation.resume`,X[`conversation.resume`].params,X[`conversation.resume`].result,`mutation`,Q,`operation.conversation.resume`),Z(`conversation.retryResponse`,X[`conversation.retryResponse`].params,X[`conversation.retryResponse`].result,`mutation`,Q,`operation.conversation.retryResponse`),Z(`conversation.stop`,X[`conversation.stop`].params,X[`conversation.stop`].result,`mutation`,Q,`operation.conversation.stop`),Z(`conversation.forcePush`,X[`conversation.forcePush`].params,X[`conversation.forcePush`].result,`mutation`,Q,`operation.conversation.forcePush`),Z(`conversation.continue`,X[`conversation.continue`].params,X[`conversation.continue`].result,`mutation`,Q,`operation.conversation.continue`),Z(`input.submit`,X[`input.submit`].params,X[`input.submit`].result,`mutation`,Q,`operation.input.submit`),Z(`input.cancel`,X[`input.cancel`].params,X[`input.cancel`].result,`mutation`,Q,`operation.input.cancel`),Z(`interaction.resolve`,X[`interaction.resolve`].params,X[`interaction.resolve`].result,`mutation`,Q,`operation.interaction.resolve`),Z(`asyncBash.logs`,X[`asyncBash.logs`].params,X[`asyncBash.logs`].result,`read`,Q,`operation.asyncBash.logs`),Z(`asyncBash.cancel`,X[`asyncBash.cancel`].params,X[`asyncBash.cancel`].result,`mutation`,Q,`operation.asyncBash.cancel`),Z(`model.list`,L_,F({models:P(Wc)}),`read`,Q,`operation.model.list`),Z(`permissionRuleSet.list`,L_,F({ruleSets:P(yl)}),`read`,Q,`operation.permissionRuleSet.list`),Z(`permission.configuration.get`,F({projectId:k().optional()}).optional(),Dl,`read`,Q,`operation.permission.configuration.get`),Z(`permission.rule.save`,R_.extend({previousRuleId:k().optional(),rule:hl}),Dl,`mutation`,Q,`operation.permission.rule.save`),Z(`permission.rule.delete`,R_.extend({ruleId:k()}),Dl,`mutation`,Q,`operation.permission.rule.delete`),Z(`skill.list`,F({projectId:k().optional()}).optional(),h_,`read`,Q,`operation.skill.list`),Z(`configuration.attention`,I({projectId:k().optional()}),I({resources:P(c_)}),`read`,Q,`operation.configuration.attention`),Z(`configuration.review`,l_,f_,`read`,Q,`operation.configuration.review`),Z(`configuration.decide`,p_,f_,`mutation`,Q,`operation.configuration.decide`),Z(`skill.review`,__,v_,`read`,Q,`operation.skill.review`),Z(`tool.list`,L_,F({tools:P(A_)}),`read`,Q,`operation.tool.list`),Z(`completion.slash.list`,L_,F({items:P(N_)}),`read`,Q,`operation.completion.slash.list`)],$={"agentConfiguration.changed":I({scope:Bp}),"conversationDefaults.changed":I({scope:zp}),"conversation.event":qg,"conversation.head":F({conversationId:k(),headEventId:k().nullable()}),"conversation.changed":F({projectId:k(),summary:dh}),"conversation.deleted":F({projectId:k(),conversationId:k()}),"conversation.config":F({conversationId:k(),config:lh}),"conversation.toolCall":F({conversationId:k(),toolCall:L([Jm,F({id:k(),removed:V(!0)})])}),"conversation.queue":F({conversationId:k(),queue:P($m)}),"conversation.asyncBash":F({conversationId:k(),asyncBash:P(nh)}),"conversation.compaction":F({conversationId:k(),compaction:ah}),"conversation.live":F({conversationId:k(),delta:Xg})},B_=[G(`conversationDefaults.changed`,$[`conversationDefaults.changed`],{delivery:`ephemeral`,scope:[]}),G(`agentConfiguration.changed`,$[`agentConfiguration.changed`],{delivery:`ephemeral`,scope:[]}),G(`conversation.event`,$[`conversation.event`],{delivery:`sequenced`,scope:[`conversationId`]}),G(`conversation.head`,$[`conversation.head`],{delivery:`ephemeral`,scope:[`conversationId`],supersedable:!0,coalescing:{strategy:`latest_by_scope`}}),G(`conversation.changed`,$[`conversation.changed`],{delivery:`ephemeral`,scope:[`projectId`,`summary.id`]}),G(`conversation.deleted`,$[`conversation.deleted`],{delivery:`ephemeral`,scope:[`projectId`,`conversationId`]}),G(`conversation.config`,$[`conversation.config`],{delivery:`ephemeral`,scope:[`conversationId`],supersedable:!0,coalescing:{strategy:`latest_by_scope`}}),G(`conversation.toolCall`,$[`conversation.toolCall`],{delivery:`ephemeral`,scope:[`conversationId`,`toolCall.id`]}),G(`conversation.queue`,$[`conversation.queue`],{delivery:`ephemeral`,scope:[`conversationId`],supersedable:!0,coalescing:{strategy:`latest_by_scope`}}),G(`conversation.asyncBash`,$[`conversation.asyncBash`],{delivery:`ephemeral`,scope:[`conversationId`],supersedable:!0,coalescing:{strategy:`latest_by_scope`}}),G(`conversation.compaction`,$[`conversation.compaction`],{delivery:`ephemeral`,scope:[`conversationId`],supersedable:!0,coalescing:{strategy:`latest_by_scope`}}),G(`conversation.live`,$[`conversation.live`],{delivery:`ephemeral`,scope:[`conversationId`]})];export{Tp as $,gu as $t,qh as A,Ks as An,wd as At,kh as B,oc as Bn,id as Bt,yg as C,Bc as Cn,qd as Ct,bg as D,gs as Dn,jd as Dt,ng as E,Hs as En,Md as Et,Gh as F,jc as Fn,Fu as Ft,Sm as G,L as Gn,rd as Gt,Bm as H,I as Hn,Vu as Ht,Mh as I,V as In,zu as It,Kp as J,pa as Jn,ad as Jt,wm as K,N as Kn,sd as Kt,Ah as L,Qs as Ln,Lu as Lt,Uh as M,P as Mn,Cd as Mt,Bh as N,M as Nn,od as Nt,mg as O,zs as On,Td as Ot,Wh as P,R as Pn,Zu as Pt,Fp as Q,yu as Qt,jh as R,j as Rn,nd as Rt,vg as S,Vc as Sn,Yd as St,tg as T,Rc as Tn,Qd as Tt,xm as U,k as Un,W as Ut,Nh as V,z as Vn,Iu as Vt,Cm as W,ic as Wn,Bu as Wt,om as X,Nu as Xt,zp as Y,ca as Yn,Pu as Yt,Rp as Z,bu as Zt,sg as _,hl as _n,Hd as _t,E_ as a,Jl as an,Ff as at,dg as b,Uc as bn,ef as bt,x_ as c,Yl as cn,Ef as ct,e_ as d,Hl as dn,jf as dt,lu as en,Dp as et,$g as f,Al as fn,Of as ft,lg as g,kl as gn,$d as gt,Sg as h,xl as hn,ff as ht,N_ as i,cu as in,yp as it,Lh as j,Ws as jn,G as jt,Jh as k,B as kn,Ed as kt,l_ as l,tu as ln,_f as lt,qg as m,Rl as mn,df as mt,B_ as n,U as nn,bp as nt,T_ as o,ql as on,uf as ot,kg as p,Ll as pn,Mf as pt,Bp as q,ga as qn,Qu as qt,z_ as r,du as rn,K as rt,y_ as s,Zl as sn,Df as st,$ as t,uu as tn,Sp as tt,Z as u,Bl as un,af as ut,gg as v,gl as vn,Xd as vt,xg as w,Lc as wn,Id as wt,_g as x,Hc as xn,Jd as xt,hg as y,Gc as yn,Zd as yt,Dh as z,F as zn,Ru as zt};
|
|
57
|
+
`)]).optional(),bom:M().optional()}).passthrough(),ag=F({index:j().int().nonnegative(),type:B([`replace_text`,`insert_text`,`replace_lines`,`insert_lines`,`apply_patch`]),source:B([`replacements`,`insertions`,`lineReplacements`,`lineInsertions`,`patch`,`edits`]).optional(),sourceIndex:j().int().nonnegative().optional(),status:B([`applied`,`failed`,`not_applied`]).optional(),error:k().optional(),matchMode:B([`exact`,`trimmed`,`whitespace`]).optional(),occurrence:j().int().positive().optional(),matchCount:j().int().nonnegative().optional(),startLine:j().int().positive().optional(),endLine:j().int().positive().optional(),matchedBy:B([`unique`,`occurrence`,`line_range`,`line_insert`,`patch`]).optional()}).passthrough(),og=ig.extend({dryRun:M().optional(),appliedCount:j().int().nonnegative().optional(),operationCount:j().int().nonnegative(),operations:P(ag)}),sg=R(`disposition`,[F({disposition:V(`completed`)}),F({disposition:V(`backgrounded`),taskId:k().startsWith(`task_`),status:Ph,elapsedMs:j().nonnegative(),terminalUpdate:V(`automatic`)})]),cg=F({truncation:tg.optional(),fullOutputPath:k().optional(),rawResultPath:k().optional(),signal:k().nullable().optional(),execution:sg.optional()}).passthrough(),lg=F({path:k(),size:j().nonnegative().optional()}).passthrough(),ug=F({truncation:tg.optional(),fullOutputPath:k().optional(),rawResultPath:k().optional(),signal:k().nullable().optional(),executable:k().optional(),version:k().optional(),timeoutSeconds:j().optional(),durationMs:j().optional(),timedOut:M().optional(),timeoutKilled:M().optional(),allowNetwork:M().optional(),allowFileWrite:M().optional(),inputMode:B([`inline`,`file`]).optional(),scriptPath:k().optional(),streams:rg.optional(),artifactDir:k().optional(),artifacts:P(lg).optional(),envKeys:P(k()).optional()}).passthrough(),dg=F({path:k(),kind:B([`file`,`directory`,`other`])}),fg=F({path:k(),line:j(),text:k()}),pg=Qs({outcome:B([`created`,`overwritten`]).optional(),bytes:j().int().nonnegative().optional()}),mg=Qs({totalMatches:j().int().nonnegative().optional(),totalFiles:j().int().nonnegative().optional()}),hg=Qs({totalEntries:j().int().nonnegative().optional()}),gg=Qs({assignments:P(F({name:k(),profile:k().optional(),disposition:B([`created`,`follow_up`,`rejected`]),agentId:k().optional(),reason:k().optional()})).optional()}),_g=Qs({agents:P(F({name:k(),agentId:k().optional(),profile:k().optional(),state:B([`running`,`waiting`,`idle`,`stopped`,`failed`,`interrupted`]),contextPercent:j().min(0).max(100).optional(),lastActivityAt:k().datetime().optional()})).optional()}),vg=Qs({results:P(F({name:k(),outcome:B([`stopped`,`already_idle`,`not_found`,`failed`]),runMs:j().nonnegative().optional(),reason:k().optional()})).optional()});F({query:k(),answer:k().optional(),results:P(F({title:k(),url:k(),content:k().optional(),score:j().optional()}))});var yg=F({url:k(),status:j(),contentType:k(),size:j(),savedTo:k().optional(),converted:M()});R(`mode`,[F({mode:V(`lines`),requestedStartLine:j().int().positive(),requestedLimit:j().int().positive(),sourceTotalLines:j().int().nonnegative(),returnedStartLine:j().int().positive(),returnedEndLine:j().int().nonnegative(),returnedContentLines:j().int().nonnegative(),sourceEndsWithNewline:M(),nextOffset:j().int().positive().optional(),nextByteOffset:j().int().nonnegative().optional()}),F({mode:V(`bytes`),requestedByteOffset:j().int().nonnegative(),requestedByteLimit:j().int().positive(),sourceBytes:j().int().nonnegative(),returnedByteStart:j().int().nonnegative(),returnedByteEnd:j().int().nonnegative(),utf8AdjustedStart:j().int().nonnegative(),utf8AdjustedEnd:j().int().nonnegative(),nextByteOffset:j().int().nonnegative().optional()})]);var bg=F({content:k().optional(),contentBlocks:P(Jh).optional(),details:N().optional(),path:k().optional(),entries:P(dg).optional(),matches:P(fg).optional(),stdout:k().optional(),stderr:k().optional(),exitCode:j().optional()}),xg=F({questions:P(F({id:k(),question:k(),answer:Am.optional(),skipped:V(!0).optional()})),dismissed:M().optional()}),Sg=F({type:V(`text`),text:k(),textSignature:k().optional()}),Cg=F({type:V(`image`),data:k(),mimeType:k()}),wg=F({type:V(`thinking`),thinking:k(),thinkingSignature:k().optional(),redacted:M().optional()}),Tg=F({type:V(`toolCall`),id:k(),name:k(),arguments:z(k(),H()),argumentsError:k().optional(),thoughtSignature:k().optional(),namespace:k().optional()}),Eg=R(`type`,[Sg,wg,Tg]);R(`type`,[Sg,Cg]);var Dg=P(R(`type`,[Sg,F({type:V(`image`),assetId:k(),mimeType:k()})])),Og=bg.extend({contentBlocks:P(L([Sg,F({type:V(`image`),assetId:k(),mimeType:k(),byteLength:j().nonnegative().optional()})])).optional()}),kg=F({argsPreview:H(),resultPreview:H(),previewOverflow:F({hidden:j().nonnegative(),noun:k(),direction:B([`head`,`tail`,`mixed`]).optional()}).optional()}),Ag=F({input:j(),output:j(),cacheRead:j(),cacheWrite:j(),cacheWrite1h:j().optional(),reasoning:j().optional(),totalTokens:j(),cost:F({input:j(),output:j(),cacheRead:j(),cacheWrite:j(),total:j()})}),jg=F({text:k(),originalText:k(),acceptedAt:k().datetime().optional(),source:B([`user`,`parent_conversation`]),senderConversationId:k().nullable()}),Mg=F({content:P(Eg),usage:Ag,stopReason:B([`pending`,`stop`,`length`,`toolUse`,`error`,`aborted`,`deferred`]),api:k(),provider:k(),model:k(),errorMessage:k().optional(),responseModel:k().optional(),responseId:k().optional(),providerThinkingLevel:k().optional(),rawStopReason:k().optional()});B([`started`,`waiting`,`retrying`,`completed`,`failed`,`cancelled`,`interrupted`]);var Ng={retry:F({attempt:j().int().positive(),maxAttempts:j().int().positive(),delayMs:j().nonnegative(),exhausted:M().optional(),error:k()}).optional(),waiting:F({toolCallId:k().optional(),childConversationId:k().optional()}).optional(),failure:F({message:k(),category:k().optional()}).optional()},Pg=R(`transition`,[F({subtype:V(`execution_state`),transition:V(`started`),...Ng}),F({subtype:V(`execution_state`),transition:B([`waiting`,`retrying`,`completed`,`failed`,`cancelled`,`interrupted`]),executionId:k(),...Ng})]),Fg=F({subtype:V(`fork`),sourceConversationId:k(),sourceTitle:k(),subagents:P(k()),text:k()}),Ig=R(`subtype`,[...Qm.options,Pg,Fg]),Lg=B([`completed`,`failed`,`denied`,`cancelled`,`indeterminate`]),Rg=F({toolCallId:k(),providerCallId:k().nullable(),toolName:k(),arguments:z(k(),H()),origin:Om,assistantEventId:k().nullable(),contentIndex:j().int().nonnegative().nullable(),outcome:Lg,startedAt:k().datetime().optional(),agentProjection:Dg,agentProjectionSnapshot:bh.optional(),userProjection:kg,supervision:km.nullable(),interactionResolution:Km.nullable(),resolutionRequestId:k().nullable(),assetIds:P(k())}),zg=F({summary:k(),firstKeptEventId:k().nullable(),tokensBefore:j().int().nonnegative(),details:H().nullable()}),Bg=B([`none`,`user`,`assistant`,`tool_result`]),Vg=B([`user_message`,`assistant_message`,`system_event`,`tool_call_response`,`compaction`]),Hg={id:k(),conversationId:k(),sequence:j().int().positive(),previousEventId:k().nullable(),turnId:k().nullable(),inputId:k().nullable(),createdAt:k().datetime()},Ug=R(`type`,[F({...Hg,type:V(`user_message`),llmRepresentation:V(`user`),payload:jg}),F({...Hg,type:V(`assistant_message`),llmRepresentation:V(`assistant`),payload:Mg}),F({...Hg,type:V(`system_event`),llmRepresentation:B([`none`,`user`]),payload:Ig}),F({...Hg,type:V(`tool_call_response`),llmRepresentation:Bg,payload:Rg}),F({...Hg,type:V(`compaction`),llmRepresentation:V(`user`),payload:zg})]).superRefine((e,t)=>{if(e.type===`tool_call_response`&&(e.payload.origin===`model`?e.llmRepresentation!==`tool_result`:![`user`,`none`].includes(e.llmRepresentation))&&t.addIssue({code:`custom`,message:`Tool response representation contradicts its origin`}),e.type===`tool_call_response`){let n=e.payload,r=n.providerCallId!==null&&n.assistantEventId!==null&&n.contentIndex!==null,i=n.providerCallId===null&&n.assistantEventId===null&&n.contentIndex===null;(n.origin===`model`?!r:!i)&&t.addIssue({code:`custom`,message:`Tool-response references contradict its origin`})}e.type===`system_event`&&e.payload.subtype===`execution_state`&&e.llmRepresentation!==`none`&&t.addIssue({code:`custom`,message:`Execution facts cannot contribute to context`})}),Wg=F({id:k(),previousEventId:k().nullable(),type:Vg,preview:k(),createdAt:k().datetime()}),Gg=R(`type`,[Sg.omit({textSignature:!0}),wg.omit({thinkingSignature:!0}),Tg]),Kg=R(`type`,[Ug.options[0],Ug.options[1].extend({payload:Mg.extend({content:P(Gg)})}),Ug.options[2],Ug.options[4],Ug.options[3].extend({payload:Rg.omit({agentProjection:!0})})]),qg=k().regex(/^[a-z][a-z0-9_-]{0,31}$/),Jg=F({chunk:k(),stream:qg.optional()}),Yg=R(`type`,[F({type:V(`assistant_reset`),turnId:k()}),F({type:V(`assistant_text`),turnId:k(),contentIndex:j().int().nonnegative(),delta:k()}),F({type:V(`assistant_thinking`),turnId:k(),contentIndex:j().int().nonnegative(),delta:k()}),F({type:V(`tool_call_arguments`),turnId:k(),contentIndex:j().int().nonnegative(),providerCallId:k(),name:k(),partialArgsText:k()}),F({type:V(`tool_progress`),toolCallId:k(),update:Jg}),F({type:V(`execution_activity`),activity:k()})]),Xg=F({responseCount:j().int().nonnegative(),input:j(),output:j(),cacheRead:j(),cacheWrite:j(),totalTokens:j(),cost:j()}),Zg=F({own:Xg,subagents:Xg,total:Xg,subagentCount:j().int().nonnegative()});function Qg(e){return e.split(``).flatMap((e,t)=>[...t?[{type:`image`}]:[],...e?[{type:`text`,text:e}]:[]])}function $g(e){return e.replaceAll(``,`(image)`)}var e_=I({id:k(),projectId:k(),parentConversationId:k().nullable().optional(),title:k(),config:ch.pick({systemPrompt:!0,instructions:!0,workingDirectory:!0}).partial().strict(),overrides:K.optional(),agentProfile:om.optional()}),t_=F({projectId:k(),parentConversationId:k().nullable().optional()}),n_=F({conversationId:k(),patch:ch.pick({systemPrompt:!0,instructions:!0,workingDirectory:!0}).partial().strict()}).strict(),r_=F({conversationId:k(),patch:F({title:k().trim().min(1).max(200).optional(),pinned:M().optional(),completed:M().optional(),clearStatus:M().optional()})}),i_=I({toolCallId:k(),resolutionRequestId:k(),resolution:Km}),J=F({conversationId:k()}),a_=F({}),Y=Ks(),X={"project.create":{params:wd.omit({createdAt:!0,updatedAt:!0}),result:wd},"project.list":{params:a_,result:P(wd)},"project.get":{params:F({projectId:k()}),result:wd.nullable()},"project.update":{params:F({projectId:k(),patch:wd.pick({name:!0,directory:!0}).partial()}),result:wd},"project.delete":{params:F({projectId:k()}),result:Y},"conversation.create":{params:e_,result:fh},"conversation.list":{params:t_,result:P(dh)},"conversation.getUsage":{params:J,result:Zg},"conversation.getSnapshot":{params:J,result:fh},"conversation.getHistory":{params:J.extend({beforeEventId:k().optional(),limit:j().int().positive()}),result:P(Kg)},"toolCall.getDetails":{params:J.extend({toolCallId:k()}),result:F({agentProjection:Dg,result:Og})},"conversation.getTree":{params:J,result:P(Wg)},"conversation.getEventsSince":{params:J.extend({sequence:j().int().nonnegative()}),result:P(Kg)},"conversation.configure":{params:n_,result:Y},"conversation.setAgentProfile":{params:hm,result:gm},"conversation.previewAgentProfile":{params:pm,result:mm},"agentConfiguration.get":{params:qp,result:Jp},"agentConfiguration.save":{params:Yp,result:Xp},"agentConfiguration.getEffective":{params:Qp,result:$p},"agentConfiguration.resolveProject":{params:sm,result:cm},"conversationDefaults.get":{params:nm,result:rm},"conversationDefaults.save":{params:im,result:am},"conversation.update":{params:r_,result:Y},"conversation.selectHead":{params:J.extend({eventId:k().nullable()}),result:Y},"conversation.fork":{params:J.extend({eventId:k()}),result:fh},"conversation.compact":{params:J,result:Y},"conversation.cancelCompaction":{params:J,result:Y},"conversation.delete":{params:J,result:Y},"conversation.pause":{params:J,result:Y},"conversation.resume":{params:J,result:Y},"conversation.stop":{params:J,result:Y},"conversation.retryResponse":{params:J,result:Y},"conversation.forcePush":{params:J,result:Y},"conversation.continue":{params:J,result:Y},"input.submit":{params:eh,result:Y},"input.cancel":{params:F({inputId:k()}),result:Y},"interaction.resolve":{params:i_,result:vm},"asyncBash.logs":{params:rh,result:ih},"asyncBash.cancel":{params:F({bashId:k()}),result:Y}};function Z(e,t,n,r,i,a,o={}){return{method:e,paramsSchema:t,resultSchema:n,kind:r,allowedTargetRoles:i,requiredCapability:a,invocationScope:o.invocationScope??`stateless`,trustedResult:o.trustedResult??!1}}var o_=B([`agent-preferences`,`agent-profile`,`rule-set`,`permission-overlay`,`launch-catalog`,`mcp-servers`,`skill`,`prompt-suggestion`,`extension`]),s_=I({kind:o_,id:k().min(1),scope:B([`builtin`,`user`,`project`,`conversation`]),path:k().optional(),state:B([`active`,`disabled`,`shadowed`,`invalid`,`incompatible`,`needs_review`,`declined`]),approval:I({kind:B([`trust`,`consent`]),where:k().min(1)}).optional(),shadowedBy:Rc.optional(),previousVersionActive:V(!0).optional(),diagnostics:P(Td)}),c_=I({kind:o_,scope:B([`user`,`project`]),projectId:k().optional(),id:k().min(1)}),l_=I({text:k().min(1),short:k().min(1).max(32),broad:M(),new:M()}),u_=I({path:k().min(1),label:k().min(1),bytes:j().int().nonnegative().optional(),script:M().optional()}),d_=I({target:c_,name:k().min(1),kindLabel:k().min(1),state:Gc,changedSinceDecision:M(),changedAt:k().datetime().optional(),items:P(l_),sources:P(u_),digest:k().min(1)}),f_=I({target:c_,digest:k().min(1),trusted:M()}),p_=B([`user`,`project`,`nerve`,`agentBrowser`]),m_=F({skills:P(F({name:k().min(1),description:k(),filePath:k().min(1),source:p_,trustState:Gc.optional(),changedSinceDecision:V(!0).optional()}))}),h_=I({path:k().min(1),bytes:j().int().nonnegative(),script:M()}),g_=I({projectId:k().min(1),name:k().min(1)}),__=I({name:k().min(1),description:k(),folder:k().min(1),contentDigest:k().min(1),trustState:Gc,changedSinceDecision:M(),files:P(h_)}),v_=e=>e===`agentBrowser`?`agentBrowser`:e===`nerve`?`nerve`:`file`,y_=[`project`,`user`,`agentBrowser`,`nerve`];function b_(e){return[...e].sort((e,t)=>y_.indexOf(e.source)-y_.indexOf(t.source))}var x_=B([`text`,`markdown`,`links`,`table`,`artifacts`]),S_=k().regex(/^[a-z][a-z0-9_-]{0,31}$/),C_=I({id:S_,type:x_,label:k().min(1).max(64).optional(),live:B([`stream`,`transient`]).optional()}),w_=I({header:I({argument:k().min(1),format:B([`text`,`path`]).optional()}).optional(),meta:P(k().min(1)).max(3).optional(),sections:P(C_).min(1)}),T_=Qs({extension:k(),tool:k(),sections:P(I({id:S_,type:x_,label:k().optional(),value:N()}))}),E_=B([`subagents`,`fileInspection`,`fileEditing`,`shell`,`python`,`web`,`quickScript`,`extension`,`input`,`process`,`planMode`]),D_=B([`local`,`host`]),O_=B([`write_capable`,`read_only_network`,`long_running`,`credentialed`,`suspending`]),k_=F({name:_u,kind:Zc,groups:P(k().trim().min(1).max(128)).min(1),baseRisk:Qc,primaryArguments:P(k().trim().min(1).max(128)),targetKinds:P($c).min(1),argumentSensitive:M().default(!1),description:k(),group:E_,extension:k().optional(),view:w_.optional(),executionKind:D_,traits:P(O_),permission:F({ruleKind:Ou,durableAllow:ku})});B([`committed`,`waiting`,`running`,`completed`,`denied`,`failed`,`cancelled`]),B([`drafting`,`drafted`,`executing`,`completed`,`failed`,`denied`,`cancelled`,`interrupted`]);var A_=B([`slash`,`file`,`directory`,`launch`,`pull_request`,`issue`,`skill`,`tool`,`agent_profile`,`launch_definition`,`subagent`]),j_=ic([j().int().nonnegative(),j().int().nonnegative()]),M_=F({documentId:k().min(1).optional(),version:k().min(1).optional(),enabled:M().optional(),available:M().optional(),canDisable:M().optional(),unavailableReason:k().optional(),status:k().optional(),scoreFactors:F({lexical:j(),context:j(),usage:j(),state:j(),prior:j().optional()}).optional(),label:k().min(1),detail:k().optional(),info:k().optional(),kind:A_,apply:k().optional(),displayLabel:k().optional(),sortScore:j().optional(),matchRanges:P(j_).optional(),detailMatchRanges:P(j_).optional()}),N_=L([I({conversationId:k().min(1)}),I({projectId:k().min(1),overrides:K,agentProfile:om.optional(),config:ch.pick({systemPrompt:!0,instructions:!0,workingDirectory:!0}).partial().strict().optional()})]),P_=I({name:k(),description:k(),parameters:z(k(),N())}),F_=R(`status`,[I({status:V(`available`),systemPrompt:k(),tools:P(P_),resolution:Tp}),Gp]),I_=F({}).optional(),Q=[`workbench_server`],L_=F({scope:Lc,projectId:k().optional(),ruleSetId:gl}),R_=[Z(`agentConfiguration.get`,X[`agentConfiguration.get`].params,X[`agentConfiguration.get`].result,`read`,Q,`operation.agentConfiguration.get`),Z(`agentConfiguration.save`,X[`agentConfiguration.save`].params,X[`agentConfiguration.save`].result,`mutation`,Q,`operation.agentConfiguration.save`),Z(`agentConfiguration.getEffective`,X[`agentConfiguration.getEffective`].params,X[`agentConfiguration.getEffective`].result,`read`,Q,`operation.agentConfiguration.getEffective`),Z(`agentConfiguration.resolveProject`,X[`agentConfiguration.resolveProject`].params,X[`agentConfiguration.resolveProject`].result,`read`,Q,`operation.agentConfiguration.resolveProject`),Z(`conversationDefaults.get`,X[`conversationDefaults.get`].params,X[`conversationDefaults.get`].result,`read`,Q,`operation.conversationDefaults.get`),Z(`conversationDefaults.save`,X[`conversationDefaults.save`].params,X[`conversationDefaults.save`].result,`mutation`,Q,`operation.conversationDefaults.save`),Z(`conversation.previewAgentProfile`,X[`conversation.previewAgentProfile`].params,X[`conversation.previewAgentProfile`].result,`read`,Q,`operation.conversation.previewAgentProfile`),Z(`toolCall.getDetails`,X[`toolCall.getDetails`].params,X[`toolCall.getDetails`].result,`read`,Q,`operation.toolCall.getDetails`),Z(`project.create`,X[`project.create`].params,X[`project.create`].result,`mutation`,Q,`operation.project.create`),Z(`project.list`,X[`project.list`].params,X[`project.list`].result,`read`,Q,`operation.project.list`),Z(`project.get`,X[`project.get`].params,X[`project.get`].result,`read`,Q,`operation.project.get`),Z(`project.update`,X[`project.update`].params,X[`project.update`].result,`mutation`,Q,`operation.project.update`),Z(`project.delete`,X[`project.delete`].params,X[`project.delete`].result,`mutation`,Q,`operation.project.delete`),Z(`conversation.create`,X[`conversation.create`].params,X[`conversation.create`].result,`mutation`,Q,`operation.conversation.create`),Z(`conversation.list`,X[`conversation.list`].params,X[`conversation.list`].result,`read`,Q,`operation.conversation.list`),Z(`conversation.getSnapshot`,X[`conversation.getSnapshot`].params,X[`conversation.getSnapshot`].result,`read`,Q,`operation.conversation.getSnapshot`),Z(`conversation.getUsage`,X[`conversation.getUsage`].params,X[`conversation.getUsage`].result,`read`,Q,`operation.conversation.getUsage`),Z(`conversation.previewSystemPrompt`,N_,F_,`read`,Q,`operation.conversation.previewSystemPrompt`),Z(`conversation.getHistory`,X[`conversation.getHistory`].params,X[`conversation.getHistory`].result,`read`,Q,`operation.conversation.getHistory`,{trustedResult:!0}),Z(`conversation.getTree`,X[`conversation.getTree`].params,X[`conversation.getTree`].result,`read`,Q,`operation.conversation.getTree`),Z(`conversation.getEventsSince`,X[`conversation.getEventsSince`].params,X[`conversation.getEventsSince`].result,`read`,Q,`operation.conversation.getEventsSince`,{trustedResult:!0}),Z(`conversation.setAgentProfile`,X[`conversation.setAgentProfile`].params,X[`conversation.setAgentProfile`].result,`mutation`,Q,`operation.conversation.setAgentProfile`),Z(`conversation.configure`,X[`conversation.configure`].params,X[`conversation.configure`].result,`mutation`,Q,`operation.conversation.configure`),Z(`conversation.update`,X[`conversation.update`].params,X[`conversation.update`].result,`mutation`,Q,`operation.conversation.update`),Z(`conversation.selectHead`,X[`conversation.selectHead`].params,X[`conversation.selectHead`].result,`mutation`,Q,`operation.conversation.selectHead`),Z(`conversation.fork`,X[`conversation.fork`].params,X[`conversation.fork`].result,`mutation`,Q,`operation.conversation.fork`),Z(`conversation.compact`,X[`conversation.compact`].params,X[`conversation.compact`].result,`mutation`,Q,`operation.conversation.compact`),Z(`conversation.cancelCompaction`,X[`conversation.cancelCompaction`].params,X[`conversation.cancelCompaction`].result,`mutation`,Q,`operation.conversation.cancelCompaction`),Z(`conversation.delete`,X[`conversation.delete`].params,X[`conversation.delete`].result,`mutation`,Q,`operation.conversation.delete`),Z(`conversation.pause`,X[`conversation.pause`].params,X[`conversation.pause`].result,`mutation`,Q,`operation.conversation.pause`),Z(`conversation.resume`,X[`conversation.resume`].params,X[`conversation.resume`].result,`mutation`,Q,`operation.conversation.resume`),Z(`conversation.retryResponse`,X[`conversation.retryResponse`].params,X[`conversation.retryResponse`].result,`mutation`,Q,`operation.conversation.retryResponse`),Z(`conversation.stop`,X[`conversation.stop`].params,X[`conversation.stop`].result,`mutation`,Q,`operation.conversation.stop`),Z(`conversation.forcePush`,X[`conversation.forcePush`].params,X[`conversation.forcePush`].result,`mutation`,Q,`operation.conversation.forcePush`),Z(`conversation.continue`,X[`conversation.continue`].params,X[`conversation.continue`].result,`mutation`,Q,`operation.conversation.continue`),Z(`input.submit`,X[`input.submit`].params,X[`input.submit`].result,`mutation`,Q,`operation.input.submit`),Z(`input.cancel`,X[`input.cancel`].params,X[`input.cancel`].result,`mutation`,Q,`operation.input.cancel`),Z(`interaction.resolve`,X[`interaction.resolve`].params,X[`interaction.resolve`].result,`mutation`,Q,`operation.interaction.resolve`),Z(`asyncBash.logs`,X[`asyncBash.logs`].params,X[`asyncBash.logs`].result,`read`,Q,`operation.asyncBash.logs`),Z(`asyncBash.cancel`,X[`asyncBash.cancel`].params,X[`asyncBash.cancel`].result,`mutation`,Q,`operation.asyncBash.cancel`),Z(`model.list`,I_,F({models:P(Wc)}),`read`,Q,`operation.model.list`),Z(`permissionRuleSet.list`,I_,F({ruleSets:P(yl)}),`read`,Q,`operation.permissionRuleSet.list`),Z(`permission.configuration.get`,F({projectId:k().optional()}).optional(),Dl,`read`,Q,`operation.permission.configuration.get`),Z(`permission.rule.save`,L_.extend({previousRuleId:k().optional(),rule:hl}),Dl,`mutation`,Q,`operation.permission.rule.save`),Z(`permission.rule.delete`,L_.extend({ruleId:k()}),Dl,`mutation`,Q,`operation.permission.rule.delete`),Z(`skill.list`,F({projectId:k().optional()}).optional(),m_,`read`,Q,`operation.skill.list`),Z(`configuration.attention`,I({projectId:k().optional()}),I({resources:P(s_)}),`read`,Q,`operation.configuration.attention`),Z(`configuration.review`,c_,d_,`read`,Q,`operation.configuration.review`),Z(`configuration.decide`,f_,d_,`mutation`,Q,`operation.configuration.decide`),Z(`skill.review`,g_,__,`read`,Q,`operation.skill.review`),Z(`tool.list`,I_,F({tools:P(k_)}),`read`,Q,`operation.tool.list`),Z(`completion.slash.list`,I_,F({items:P(M_)}),`read`,Q,`operation.completion.slash.list`)],$={"agentConfiguration.changed":I({scope:Bp}),"conversationDefaults.changed":I({scope:zp}),"conversation.event":Kg,"conversation.head":F({conversationId:k(),headEventId:k().nullable()}),"conversation.changed":F({projectId:k(),summary:dh}),"conversation.deleted":F({projectId:k(),conversationId:k()}),"conversation.config":F({conversationId:k(),config:lh}),"conversation.toolCall":F({conversationId:k(),toolCall:L([Jm,F({id:k(),removed:V(!0)})])}),"conversation.queue":F({conversationId:k(),queue:P($m)}),"conversation.asyncBash":F({conversationId:k(),asyncBash:P(nh)}),"conversation.compaction":F({conversationId:k(),compaction:ah}),"conversation.live":F({conversationId:k(),delta:Yg})},z_=[G(`conversationDefaults.changed`,$[`conversationDefaults.changed`],{delivery:`ephemeral`,scope:[]}),G(`agentConfiguration.changed`,$[`agentConfiguration.changed`],{delivery:`ephemeral`,scope:[]}),G(`conversation.event`,$[`conversation.event`],{delivery:`sequenced`,scope:[`conversationId`]}),G(`conversation.head`,$[`conversation.head`],{delivery:`ephemeral`,scope:[`conversationId`],supersedable:!0,coalescing:{strategy:`latest_by_scope`}}),G(`conversation.changed`,$[`conversation.changed`],{delivery:`ephemeral`,scope:[`projectId`,`summary.id`]}),G(`conversation.deleted`,$[`conversation.deleted`],{delivery:`ephemeral`,scope:[`projectId`,`conversationId`]}),G(`conversation.config`,$[`conversation.config`],{delivery:`ephemeral`,scope:[`conversationId`],supersedable:!0,coalescing:{strategy:`latest_by_scope`}}),G(`conversation.toolCall`,$[`conversation.toolCall`],{delivery:`ephemeral`,scope:[`conversationId`,`toolCall.id`]}),G(`conversation.queue`,$[`conversation.queue`],{delivery:`ephemeral`,scope:[`conversationId`],supersedable:!0,coalescing:{strategy:`latest_by_scope`}}),G(`conversation.asyncBash`,$[`conversation.asyncBash`],{delivery:`ephemeral`,scope:[`conversationId`],supersedable:!0,coalescing:{strategy:`latest_by_scope`}}),G(`conversation.compaction`,$[`conversation.compaction`],{delivery:`ephemeral`,scope:[`conversationId`],supersedable:!0,coalescing:{strategy:`latest_by_scope`}}),G(`conversation.live`,$[`conversation.live`],{delivery:`ephemeral`,scope:[`conversationId`]})];export{Tp as $,gu as $t,Kh as A,Ks as An,wd as At,kh as B,oc as Bn,id as Bt,vg as C,Bc as Cn,qd as Ct,yg as D,gs as Dn,jd as Dt,tg as E,Hs as En,Md as Et,Wh as F,jc as Fn,Fu as Ft,Sm as G,L as Gn,rd as Gt,Bm as H,I as Hn,Vu as Ht,Mh as I,V as In,zu as It,Kp as J,pa as Jn,ad as Jt,wm as K,N as Kn,sd as Kt,Ah as L,Qs as Ln,Lu as Lt,Hh as M,P as Mn,Cd as Mt,Bh as N,M as Nn,od as Nt,pg as O,zs as On,Td as Ot,Uh as P,R as Pn,Zu as Pt,Fp as Q,yu as Qt,jh as R,j as Rn,nd as Rt,_g as S,Vc as Sn,Yd as St,eg as T,Rc as Tn,Qd as Tt,xm as U,k as Un,W as Ut,Nh as V,z as Vn,Iu as Vt,Cm as W,ic as Wn,Bu as Wt,om as X,Nu as Xt,zp as Y,ca as Yn,Pu as Yt,Rp as Z,bu as Zt,og as _,hl as _n,Hd as _t,T_ as a,Jl as an,Ff as at,ug as b,Uc as bn,ef as bt,b_ as c,Yl as cn,Ef as ct,$g as d,Hl as dn,jf as dt,lu as en,Dp as et,Qg as f,Al as fn,Of as ft,cg as g,kl as gn,$d as gt,xg as h,xl as hn,ff as ht,M_ as i,cu as in,yp as it,Lh as j,Ws as jn,G as jt,qh as k,B as kn,Ed as kt,c_ as l,tu as ln,_f as lt,Kg as m,Rl as mn,df as mt,z_ as n,U as nn,bp as nt,w_ as o,ql as on,uf as ot,Og as p,Ll as pn,Mf as pt,Bp as q,ga as qn,Qu as qt,R_ as r,du as rn,K as rt,v_ as s,Zl as sn,Df as st,$ as t,uu as tn,Sp as tt,Z as u,Bl as un,af as ut,hg as v,gl as vn,Xd as vt,bg as w,Lc as wn,Id as wt,gg as x,Hc as xn,Jd as xt,mg as y,Gc as yn,Zd as yt,Dh as z,F as zn,Ru as zt};
|