@agent-deck/backend 2.3.2 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/agent-run/service.d.ts +10 -1
  3. package/dist/agent-run/service.d.ts.map +1 -1
  4. package/dist/agent-run/service.js +9 -1
  5. package/dist/agent-run/service.js.map +1 -1
  6. package/dist/agent-run-api/host.d.ts.map +1 -1
  7. package/dist/agent-run-api/host.js +9 -0
  8. package/dist/agent-run-api/host.js.map +1 -1
  9. package/dist/mcp-server.d.ts +7 -0
  10. package/dist/mcp-server.d.ts.map +1 -1
  11. package/dist/mcp-server.js +16 -0
  12. package/dist/mcp-server.js.map +1 -1
  13. package/dist/mcp-session-binding.d.ts +17 -0
  14. package/dist/mcp-session-binding.d.ts.map +1 -1
  15. package/dist/mcp-session-binding.js +32 -0
  16. package/dist/mcp-session-binding.js.map +1 -1
  17. package/dist/mcp-tools/register.d.ts +5 -1
  18. package/dist/mcp-tools/register.d.ts.map +1 -1
  19. package/dist/mcp-tools/register.js +2 -0
  20. package/dist/mcp-tools/register.js.map +1 -1
  21. package/dist/mcp-tools/run-tools.d.ts +3 -0
  22. package/dist/mcp-tools/run-tools.d.ts.map +1 -0
  23. package/dist/mcp-tools/run-tools.js +102 -0
  24. package/dist/mcp-tools/run-tools.js.map +1 -0
  25. package/dist/routes/agent-runs.d.ts +1 -1
  26. package/dist/routes/agent-runs.d.ts.map +1 -1
  27. package/dist/routes/agent-runs.js +231 -46
  28. package/dist/routes/agent-runs.js.map +1 -1
  29. package/dist/routes/trusted-session.d.ts.map +1 -1
  30. package/dist/routes/trusted-session.js +12 -0
  31. package/dist/routes/trusted-session.js.map +1 -1
  32. package/dist/trusted-session/route-policy-registry.d.ts.map +1 -1
  33. package/dist/trusted-session/route-policy-registry.js +8 -0
  34. package/dist/trusted-session/route-policy-registry.js.map +1 -1
  35. package/dist/trusted-session/store.d.ts +11 -0
  36. package/dist/trusted-session/store.d.ts.map +1 -1
  37. package/dist/trusted-session/store.js +24 -3
  38. package/dist/trusted-session/store.js.map +1 -1
  39. package/package.json +2 -2
  40. package/static-ui/assets/{index-BSYloDBW.js → index-Bbu6K9ON.js} +1 -1
  41. package/static-ui/index.html +1 -1
@@ -29,7 +29,7 @@ Error generating stack: `+e.message+`
29
29
  ${r?`hover:scale-110 hover:rotate-0`:`hover:scale-105`}
30
30
  `,style:{borderColor:p,boxShadow:`0 0 20px ${p}20`},children:[(0,H.jsx)(Ql,{warnings:l}),t&&(0,H.jsx)(au,{}),(0,H.jsx)(`div`,{className:`absolute top-1 left-1 text-xs font-bold`,children:(0,H.jsx)(`div`,{className:`leading-none`,style:{color:p},children:`PB`})}),(0,H.jsx)(`div`,{className:`absolute bottom-1 right-1 text-xs font-bold rotate-180`,children:(0,H.jsx)(`div`,{className:`leading-none`,style:{color:p},children:`PB`})}),(0,H.jsx)(ru,{usage:u,createdAt:e.createdAt,color:p,onDelete:t=>{t.stopPropagation(),window.confirm(`Delete playbook "${e.title}"?`)&&g.mutate()},deleteTitle:`Delete ${e.title}`}),(0,H.jsxs)(`div`,{className:`absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center`,children:[(0,H.jsx)(`div`,{className:`mb-2`,style:{color:p},children:(0,H.jsx)(di,{className:`h-7 w-7`,strokeWidth:2.25})}),(0,H.jsx)(`h3`,{className:`font-bold text-xs mb-1 line-clamp-2`,style:{color:p},children:e.title}),(0,H.jsxs)(`div`,{className:`text-[8px] px-1 py-0.5 rounded border opacity-70`,style:{color:p,borderColor:p},children:[`Playbook`,m>0?` · ${m} deps`:``]})]}),(0,H.jsx)(`div`,{className:`absolute bottom-6 inset-x-1`,children:(0,H.jsx)(K,{size:`sm`,className:`w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border`,style:{color:p,borderColor:p},onClick:e=>{e.stopPropagation(),h.mutate()},disabled:t||h.isPending||!n,children:t?`IN DECK`:`ADD`})}),(0,H.jsx)(`div`,{className:`absolute inset-0 rounded-lg bg-gradient-to-br from-transparent via-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 pointer-events-none`})]})})}var pu=(0,b.memo)(fu),mu=64,hu=4,gu=12,_u=1.08;function vu(e=gu,t=_u){let n=e*Math.PI/180,r=128*Math.sin(n)+192*Math.cos(n);return Math.ceil(r*t)+8}var yu=vu();function bu(e,t=48){return e===0?0:128+Math.max(0,e-1)*(128-t)}function xu(e=10,t=48,n=12){return bu(e,t)+2*n}function Su(e,t=48){return bu(e,t)+24}var Cu=xu();function wu(e,t,n,r=gu){let i=t+n/2,a=n/2;if(a<=0)return 0;let o=(e-i)/a;return Math.max(-r,Math.min(r,o*r))}function Tu(e){return{flexShrink:0,marginLeft:e===0?0:`-48px`}}function Eu(e,t,n){return n===e?999999:t-e}function Du({cardCount:e,children:t}){let n=(0,b.useRef)(null),r=(0,b.useRef)([]),i=(0,b.useRef)(0),a=(0,b.useRef)(void 0),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(!1),g=(0,b.useRef)(!1),_=(0,b.useRef)(!1),[v,y]=(0,b.useState)(null),x=(0,b.useRef)(null);x.current=v;let S=(0,b.useCallback)(()=>{let t=n.current;if(!t)return;let i=t.getBoundingClientRect(),a=x.current;r.current.forEach((t,n)=>{if(!t)return;let r=t.getBoundingClientRect(),o=r.left+r.width/2,s=a===n?0:wu(o,i.left,i.width),c=a===n?_u:1;t.style.transform=`rotate(${s}deg) scale(${c})`,t.style.transformOrigin=`center center`,t.style.zIndex=String(Eu(n,e,a))})},[e]),C=(0,b.useCallback)(e=>{let t=n.current;t&&t.scrollBy({left:e===`left`?-80:80,behavior:`smooth`})},[]),w=(0,b.useCallback)(()=>{let t=n.current;if(!t)return;let r=Su(e,48)>t.clientWidth+2;s(r),l(r&&t.scrollLeft>4),d(r&&t.scrollLeft+t.clientWidth<t.scrollWidth-4),S()},[e,S]);(0,b.useLayoutEffect)(()=>{let e=n.current;if(!e)return;w();let t=new ResizeObserver(w);return t.observe(e),e.addEventListener(`scroll`,w,{passive:!0}),()=>{t.disconnect(),e.removeEventListener(`scroll`,w)}},[e,w]),(0,b.useEffect)(()=>{let e=()=>{let t=n.current,r=i.current;if(t&&r!==0){t.scrollLeft+=r,S();let e=t.scrollLeft>4,n=t.scrollLeft+t.clientWidth<t.scrollWidth-4;l(e),d(n)}let o=r<0,s=r>0;o!==g.current&&(g.current=o,p(o)),s!==_.current&&(_.current=s,h(s)),a.current=requestAnimationFrame(e)};return a.current=requestAnimationFrame(e),()=>{a.current!==void 0&&cancelAnimationFrame(a.current)}},[S]);let T=e=>{let t=n.current;if(!t||!o){i.current=0;return}let r=t.getBoundingClientRect(),a=e.clientX-r.left;if(a<mu&&c){let e=1-a/mu;i.current=-(hu+e*10)}else if(a>r.width-mu&&u){let e=1-(r.width-a)/mu;i.current=hu+e*10}else i.current=0;S()},E=()=>{i.current=0,g.current=!1,_.current=!1,p(!1),h(!1)};if((0,b.useLayoutEffect)(()=>{r.current.length=e,S()},[e,v,S]),e===0)return(0,H.jsx)(H.Fragment,{children:t});let D=(e,t)=>`absolute ${e===`left`?`left-2`:`right-2`} top-1/2 z-30 -translate-y-1/2 rounded-full bg-gray-950/90 p-1.5 text-yellow-300 shadow-lg ring-1 ring-black/50 transition-all duration-150 hover:bg-gray-950 hover:ring-yellow-300/40 ${t?`scale-110`:`scale-100`}`;return(0,H.jsxs)(`div`,{className:`relative flex h-full w-full min-w-0 max-w-full items-center justify-center overflow-hidden`,"data-testid":`deck-fan`,onMouseMove:T,onMouseLeave:E,children:[o&&c&&(0,H.jsx)(`button`,{type:`button`,className:D(`left`,f),"aria-label":`Scroll deck left`,"data-testid":`deck-scroll-left`,onClick:()=>C(`left`),children:(0,H.jsx)(gi,{className:`h-6 w-6`,strokeWidth:2.5})}),o&&u&&(0,H.jsx)(`button`,{type:`button`,className:D(`right`,m),"aria-label":`Scroll deck right`,"data-testid":`deck-scroll-right`,onClick:()=>C(`right`),children:(0,H.jsx)(_i,{className:`h-6 w-6`,strokeWidth:2.5})}),(0,H.jsx)(`div`,{ref:n,className:`max-w-full overflow-x-auto overflow-y-visible [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,style:{width:Cu,maxWidth:`100%`},children:(0,H.jsx)(`div`,{className:`flex items-center justify-start isolate group/fan`,style:{minHeight:yu,paddingLeft:12,paddingRight:12},children:b.Children.map(t,(e,t)=>(0,H.jsx)(`div`,{ref:e=>{r.current[t]=e},className:`relative flex items-center justify-center transition-[transform,box-shadow] duration-500 will-change-transform`,style:{...Tu(t),minHeight:yu},onMouseEnter:()=>y(t),onMouseLeave:()=>y(null),children:e},e&&typeof e==`object`&&`key`in e?e.key:t))})})]})}var Ou=b.forwardRef(({className:e,type:t,...n},r)=>(0,H.jsx)(`input`,{type:t,className:Xa(`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:r,...n}));Ou.displayName=`Input`;var ku=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getParsedType=e.ZodParsedType=e.objectUtil=e.util=void 0;var t;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(t||(e.util=t={}));var n;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(n||(e.objectUtil=n={})),e.ZodParsedType=t.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),e.getParsedType=t=>{switch(typeof t){case`undefined`:return e.ZodParsedType.undefined;case`string`:return e.ZodParsedType.string;case`number`:return Number.isNaN(t)?e.ZodParsedType.nan:e.ZodParsedType.number;case`boolean`:return e.ZodParsedType.boolean;case`function`:return e.ZodParsedType.function;case`bigint`:return e.ZodParsedType.bigint;case`symbol`:return e.ZodParsedType.symbol;case`object`:return Array.isArray(t)?e.ZodParsedType.array:t===null?e.ZodParsedType.null:t.then&&typeof t.then==`function`&&t.catch&&typeof t.catch==`function`?e.ZodParsedType.promise:typeof Map<`u`&&t instanceof Map?e.ZodParsedType.map:typeof Set<`u`&&t instanceof Set?e.ZodParsedType.set:typeof Date<`u`&&t instanceof Date?e.ZodParsedType.date:e.ZodParsedType.object;default:return e.ZodParsedType.unknown}}})),Au=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ZodError=e.quotelessJson=e.ZodIssueCode=void 0;var t=ku();e.ZodIssueCode=t.util.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),e.quotelessJson=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,`$1:`);var n=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,t.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};e.ZodError=n,n.create=e=>new n(e)})),ju=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Au(),n=ku();e.default=(e,r)=>{let i;switch(e.code){case t.ZodIssueCode.invalid_type:i=e.received===n.ZodParsedType.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case t.ZodIssueCode.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(e.expected,n.util.jsonStringifyReplacer)}`;break;case t.ZodIssueCode.unrecognized_keys:i=`Unrecognized key(s) in object: ${n.util.joinValues(e.keys,`, `)}`;break;case t.ZodIssueCode.invalid_union:i=`Invalid input`;break;case t.ZodIssueCode.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${n.util.joinValues(e.options)}`;break;case t.ZodIssueCode.invalid_enum_value:i=`Invalid enum value. Expected ${n.util.joinValues(e.options)}, received '${e.received}'`;break;case t.ZodIssueCode.invalid_arguments:i=`Invalid function arguments`;break;case t.ZodIssueCode.invalid_return_type:i=`Invalid function return type`;break;case t.ZodIssueCode.invalid_date:i=`Invalid date`;break;case t.ZodIssueCode.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(i=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(i=`${i} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?i=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?i=`Invalid input: must end with "${e.validation.endsWith}"`:n.util.assertNever(e.validation):i=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case t.ZodIssueCode.too_small:i=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case t.ZodIssueCode.too_big:i=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case t.ZodIssueCode.custom:i=`Invalid input`;break;case t.ZodIssueCode.invalid_intersection_types:i=`Intersection results could not be merged`;break;case t.ZodIssueCode.not_multiple_of:i=`Number must be a multiple of ${e.multipleOf}`;break;case t.ZodIssueCode.not_finite:i=`Number must be finite`;break;default:i=r.defaultError,n.util.assertNever(e)}return{message:i}}})),Mu=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.defaultErrorMap=void 0,e.setErrorMap=i,e.getErrorMap=a;var n=t(ju());e.defaultErrorMap=n.default;var r=n.default;function i(e){r=e}function a(){return r}})),Nu=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.isAsync=e.isValid=e.isDirty=e.isAborted=e.OK=e.DIRTY=e.INVALID=e.ParseStatus=e.EMPTY_PATH=e.makeIssue=void 0,e.addIssueToContext=i;var n=Mu(),r=t(ju());e.makeIssue=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},e.EMPTY_PATH=[];function i(t,i){let a=(0,n.getErrorMap)(),o=(0,e.makeIssue)({issueData:i,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a,a===r.default?void 0:r.default].filter(e=>!!e)});t.common.issues.push(o)}e.ParseStatus=class t{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(t,n){let r=[];for(let i of n){if(i.status===`aborted`)return e.INVALID;i.status===`dirty`&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return t.mergeObjectSync(e,r)}static mergeObjectSync(t,n){let r={};for(let i of n){let{key:n,value:a}=i;if(n.status===`aborted`||a.status===`aborted`)return e.INVALID;n.status===`dirty`&&t.dirty(),a.status===`dirty`&&t.dirty(),n.value!==`__proto__`&&(a.value!==void 0||i.alwaysSet)&&(r[n.value]=a.value)}return{status:t.value,value:r}}},e.INVALID=Object.freeze({status:`aborted`}),e.DIRTY=e=>({status:`dirty`,value:e}),e.OK=e=>({status:`valid`,value:e}),e.isAborted=e=>e.status===`aborted`,e.isDirty=e=>e.status===`dirty`,e.isValid=e=>e.status===`valid`,e.isAsync=e=>typeof Promise<`u`&&e instanceof Promise})),Pu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),Fu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.errorUtil=void 0;var t;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(t||(e.errorUtil=t={}))})),Iu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.discriminatedUnion=e.date=e.boolean=e.bigint=e.array=e.any=e.coerce=e.ZodFirstPartyTypeKind=e.late=e.ZodSchema=e.Schema=e.ZodReadonly=e.ZodPipeline=e.ZodBranded=e.BRAND=e.ZodNaN=e.ZodCatch=e.ZodDefault=e.ZodNullable=e.ZodOptional=e.ZodTransformer=e.ZodEffects=e.ZodPromise=e.ZodNativeEnum=e.ZodEnum=e.ZodLiteral=e.ZodLazy=e.ZodFunction=e.ZodSet=e.ZodMap=e.ZodRecord=e.ZodTuple=e.ZodIntersection=e.ZodDiscriminatedUnion=e.ZodUnion=e.ZodObject=e.ZodArray=e.ZodVoid=e.ZodNever=e.ZodUnknown=e.ZodAny=e.ZodNull=e.ZodUndefined=e.ZodSymbol=e.ZodDate=e.ZodBoolean=e.ZodBigInt=e.ZodNumber=e.ZodString=e.ZodType=void 0,e.NEVER=e.void=e.unknown=e.union=e.undefined=e.tuple=e.transformer=e.symbol=e.string=e.strictObject=e.set=e.record=e.promise=e.preprocess=e.pipeline=e.ostring=e.optional=e.onumber=e.oboolean=e.object=e.number=e.nullable=e.null=e.never=e.nativeEnum=e.nan=e.map=e.literal=e.lazy=e.intersection=e.instanceof=e.function=e.enum=e.effect=void 0,e.datetimeRegex=A,e.custom=Fe;var t=Au(),n=Mu(),r=Fu(),i=Nu(),a=ku(),o=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},s=(e,n)=>{if((0,i.isValid)(n))return{success:!0,data:n.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let n=new t.ZodError(e.common.issues);return this._error=n,this._error}}};function c(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var l=class{get description(){return this._def.description}_getType(e){return(0,a.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,a.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new i.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,a.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0,i.isAsync)(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,a.getParsedType)(e)};return s(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,a.getParsedType)(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return(0,i.isValid)(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>(0,i.isValid)(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,a.getParsedType)(e)},r=this._parse({data:e,path:n.path,parent:n});return s(n,await((0,i.isAsync)(r)?r:Promise.resolve(r)))}refine(e,n){let r=e=>typeof n==`string`||n===void 0?{message:n}:typeof n==`function`?n(e):n;return this._refinement((n,i)=>{let a=e(n),o=()=>i.addIssue({code:t.ZodIssueCode.custom,...r(n)});return typeof Promise<`u`&&a instanceof Promise?a.then(e=>e?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new Te({schema:this,typeName:V.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return Ee.create(this,this._def)}nullable(){return De.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return oe.create(this)}promise(){return we.create(this,this._def)}or(e){return le.create([this,e],this._def)}and(e){return pe.create(this,e,this._def)}transform(e){return new Te({...c(this._def),schema:this,typeName:V.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new Oe({...c(this._def),innerType:this,defaultValue:t,typeName:V.ZodDefault})}brand(){return new je({typeName:V.ZodBranded,type:this,...c(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new ke({...c(this._def),innerType:this,catchValue:t,typeName:V.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Me.create(this,e)}readonly(){return Ne.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};e.ZodType=l,e.Schema=l,e.ZodSchema=l;var u=/^c[^\s-]{8,}$/i,d=/^[0-9a-z]+$/,f=/^[0-9A-HJKMNP-TV-Z]{26}$/i,p=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,m=/^[a-z0-9_-]{21}$/i,h=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,g=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,v=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,y,b=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,x=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,S=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,C=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,w=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,T=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,E=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,D=RegExp(`^${E}$`);function O(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function k(e){return RegExp(`^${O(e)}$`)}function A(e){let t=`${E}T${O(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function j(e,t){return!((t!==`v4`&&t||!b.test(e))&&(t!==`v6`&&t||!S.test(e)))}function M(e,t){if(!h.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function N(e,t){return!((t!==`v4`&&t||!x.test(e))&&(t!==`v6`&&t||!C.test(e)))}var P=class e extends l{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==a.ZodParsedType.string){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.string,received:n.parsedType}),i.INVALID}let n=new i.ParseStatus,r;for(let o of this._def.checks)if(o.kind===`min`)e.data.length<o.value&&(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,minimum:o.value,type:`string`,inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind===`max`)e.data.length>o.value&&(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,maximum:o.value,type:`string`,inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind===`length`){let a=e.data.length>o.value,s=e.data.length<o.value;(a||s)&&(r=this._getOrReturnCtx(e,r),a?(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,maximum:o.value,type:`string`,inclusive:!0,exact:!0,message:o.message}):s&&(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,minimum:o.value,type:`string`,inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind===`email`)_.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`email`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`emoji`)y||=new RegExp(v,`u`),y.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`emoji`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`uuid`)p.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`uuid`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`nanoid`)m.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`nanoid`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`cuid`)u.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`cuid`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`cuid2`)d.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`cuid2`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`ulid`)f.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`ulid`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`url`)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`url`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()}else o.kind===`regex`?(o.regex.lastIndex=0,o.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`regex`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty())):o.kind===`trim`?e.data=e.data.trim():o.kind===`includes`?e.data.includes(o.value,o.position)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind===`toLowerCase`?e.data=e.data.toLowerCase():o.kind===`toUpperCase`?e.data=e.data.toUpperCase():o.kind===`startsWith`?e.data.startsWith(o.value)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind===`endsWith`?e.data.endsWith(o.value)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind===`datetime`?A(o).test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:`datetime`,message:o.message}),n.dirty()):o.kind===`date`?D.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:`date`,message:o.message}),n.dirty()):o.kind===`time`?k(o).test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:`time`,message:o.message}),n.dirty()):o.kind===`duration`?g.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`duration`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind===`ip`?j(e.data,o.version)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`ip`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind===`jwt`?M(e.data,o.alg)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`jwt`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind===`cidr`?N(e.data,o.version)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`cidr`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind===`base64`?w.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`base64`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind===`base64url`?T.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`base64url`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):a.util.assertNever(o);return{status:n.value,value:e.data}}_regex(e,n,i){return this.refinement(t=>e.test(t),{validation:n,code:t.ZodIssueCode.invalid_string,...r.errorUtil.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...r.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...r.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...r.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...r.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...r.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...r.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...r.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...r.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...r.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...r.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...r.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...r.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...r.errorUtil.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...r.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...r.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...r.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...r.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...r.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...r.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...r.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...r.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...r.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...r.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,r.errorUtil.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};e.ZodString=P,P.create=e=>new P({checks:[],typeName:V.ZodString,coerce:e?.coerce??!1,...c(e)});function F(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var I=class e extends l{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==a.ZodParsedType.number){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.number,received:n.parsedType}),i.INVALID}let n,r=new i.ParseStatus;for(let o of this._def.checks)o.kind===`int`?a.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:`integer`,received:`float`,message:o.message}),r.dirty()):o.kind===`min`?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.too_small,minimum:o.value,type:`number`,inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind===`max`?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.too_big,maximum:o.value,type:`number`,inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind===`multipleOf`?F(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):o.kind===`finite`?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.not_finite,message:o.message}),r.dirty()):a.util.assertNever(o);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,r.errorUtil.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,r.errorUtil.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,r.errorUtil.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,r.errorUtil.toString(t))}setLimit(t,n,i,a){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:r.errorUtil.toString(a)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:r.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:r.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:r.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:r.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:r.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:r.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:r.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:r.errorUtil.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:r.errorUtil.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&a.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};e.ZodNumber=I,I.create=e=>new I({checks:[],typeName:V.ZodNumber,coerce:e?.coerce||!1,...c(e)});var L=class e extends l{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==a.ZodParsedType.bigint)return this._getInvalidInput(e);let n,r=new i.ParseStatus;for(let o of this._def.checks)o.kind===`min`?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.too_small,type:`bigint`,minimum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind===`max`?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.too_big,type:`bigint`,maximum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind===`multipleOf`?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):a.util.assertNever(o);return{status:r.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.bigint,received:n.parsedType}),i.INVALID}gte(e,t){return this.setLimit(`min`,e,!0,r.errorUtil.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,r.errorUtil.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,r.errorUtil.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,r.errorUtil.toString(t))}setLimit(t,n,i,a){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:r.errorUtil.toString(a)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:r.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:r.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:r.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:r.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:r.errorUtil.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};e.ZodBigInt=L,L.create=e=>new L({checks:[],typeName:V.ZodBigInt,coerce:e?.coerce??!1,...c(e)});var ee=class extends l{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==a.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.boolean,received:n.parsedType}),i.INVALID}return(0,i.OK)(e.data)}};e.ZodBoolean=ee,ee.create=e=>new ee({typeName:V.ZodBoolean,coerce:e?.coerce||!1,...c(e)});var te=class e extends l{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==a.ZodParsedType.date){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.date,received:n.parsedType}),i.INVALID}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_date}),i.INVALID}let n=new i.ParseStatus,r;for(let o of this._def.checks)o.kind===`min`?e.data.getTime()<o.value&&(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:`date`}),n.dirty()):o.kind===`max`?e.data.getTime()>o.value&&(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:`date`}),n.dirty()):a.util.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:r.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:r.errorUtil.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};e.ZodDate=te,te.create=e=>new te({checks:[],coerce:e?.coerce||!1,typeName:V.ZodDate,...c(e)});var ne=class extends l{_parse(e){if(this._getType(e)!==a.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.symbol,received:n.parsedType}),i.INVALID}return(0,i.OK)(e.data)}};e.ZodSymbol=ne,ne.create=e=>new ne({typeName:V.ZodSymbol,...c(e)});var R=class extends l{_parse(e){if(this._getType(e)!==a.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.undefined,received:n.parsedType}),i.INVALID}return(0,i.OK)(e.data)}};e.ZodUndefined=R,R.create=e=>new R({typeName:V.ZodUndefined,...c(e)});var z=class extends l{_parse(e){if(this._getType(e)!==a.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.null,received:n.parsedType}),i.INVALID}return(0,i.OK)(e.data)}};e.ZodNull=z,z.create=e=>new z({typeName:V.ZodNull,...c(e)});var B=class extends l{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,i.OK)(e.data)}};e.ZodAny=B,B.create=e=>new B({typeName:V.ZodAny,...c(e)});var re=class extends l{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,i.OK)(e.data)}};e.ZodUnknown=re,re.create=e=>new re({typeName:V.ZodUnknown,...c(e)});var ie=class extends l{_parse(e){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.never,received:n.parsedType}),i.INVALID}};e.ZodNever=ie,ie.create=e=>new ie({typeName:V.ZodNever,...c(e)});var ae=class extends l{_parse(e){if(this._getType(e)!==a.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.void,received:n.parsedType}),i.INVALID}return(0,i.OK)(e.data)}};e.ZodVoid=ae,ae.create=e=>new ae({typeName:V.ZodVoid,...c(e)});var oe=class e extends l{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==a.ZodParsedType.array)return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.array,received:n.parsedType}),i.INVALID;if(s.exactLength!==null){let e=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(e||a)&&((0,i.addIssueToContext)(n,{code:e?t.ZodIssueCode.too_big:t.ZodIssueCode.too_small,minimum:a?s.exactLength.value:void 0,maximum:e?s.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&((0,i.addIssueToContext)(n,{code:t.ZodIssueCode.too_small,minimum:s.minLength.value,type:`array`,inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&((0,i.addIssueToContext)(n,{code:t.ZodIssueCode.too_big,maximum:s.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((e,t)=>s.type._parseAsync(new o(n,e,n.path,t)))).then(e=>i.ParseStatus.mergeArray(r,e));let c=[...n.data].map((e,t)=>s.type._parseSync(new o(n,e,n.path,t)));return i.ParseStatus.mergeArray(r,c)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:r.errorUtil.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:r.errorUtil.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:r.errorUtil.toString(n)}})}nonempty(e){return this.min(1,e)}};e.ZodArray=oe,oe.create=(e,t)=>new oe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:V.ZodArray,...c(t)});function se(e){if(e instanceof ce){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Ee.create(se(r))}return new ce({...e._def,shape:()=>t})}return e instanceof oe?new oe({...e._def,type:se(e.element)}):e instanceof Ee?Ee.create(se(e.unwrap())):e instanceof De?De.create(se(e.unwrap())):e instanceof me?me.create(e.items.map(e=>se(e))):e}var ce=class e extends l{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=a.util.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==a.ZodParsedType.object){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.object,received:n.parsedType}),i.INVALID}let{status:n,ctx:r}=this._processInputParams(e),{shape:s,keys:c}=this._getCached(),l=[];if(!(this._def.catchall instanceof ie&&this._def.unknownKeys===`strip`))for(let e in r.data)c.includes(e)||l.push(e);let u=[];for(let e of c){let t=s[e],n=r.data[e];u.push({key:{status:`valid`,value:e},value:t._parse(new o(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof ie){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of l)u.push({key:{status:`valid`,value:e},value:{status:`valid`,value:r.data[e]}});else if(e===`strict`)l.length>0&&((0,i.addIssueToContext)(r,{code:t.ZodIssueCode.unrecognized_keys,keys:l}),n.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of l){let n=r.data[t];u.push({key:{status:`valid`,value:t},value:e._parse(new o(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of u){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>i.ParseStatus.mergeObjectSync(n,e)):i.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return r.errorUtil.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let i=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:r.errorUtil.errToObj(t).message??i}:{message:i}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:V.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of a.util.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of a.util.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return se(this)}partial(t){let n={};for(let e of a.util.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of a.util.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Ee;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return xe(a.util.objectKeys(this.shape))}};e.ZodObject=ce,ce.create=(e,t)=>new ce({shape:()=>e,unknownKeys:`strip`,catchall:ie.create(),typeName:V.ZodObject,...c(t)}),ce.strictCreate=(e,t)=>new ce({shape:()=>e,unknownKeys:`strict`,catchall:ie.create(),typeName:V.ZodObject,...c(t)}),ce.lazycreate=(e,t)=>new ce({shape:e,unknownKeys:`strip`,catchall:ie.create(),typeName:V.ZodObject,...c(t)});var le=class extends l{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function a(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let t of e)if(t.result.status===`dirty`)return n.common.issues.push(...t.ctx.common.issues),t.result;let r=e.map(e=>new t.ZodError(e.ctx.common.issues));return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_union,unionErrors:r}),i.INVALID}if(n.common.async)return Promise.all(r.map(async e=>{let t={...n,common:{...n.common,issues:[]},parent:null};return{result:await e._parseAsync({data:n.data,path:n.path,parent:t}),ctx:t}})).then(a);{let e,a=[];for(let t of r){let r={...n,common:{...n.common,issues:[]},parent:null},i=t._parseSync({data:n.data,path:n.path,parent:r});if(i.status===`valid`)return i;i.status===`dirty`&&!e&&(e={result:i,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return n.common.issues.push(...e.ctx.common.issues),e.result;let o=a.map(e=>new t.ZodError(e));return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_union,unionErrors:o}),i.INVALID}}get options(){return this._def.options}};e.ZodUnion=le,le.create=(e,t)=>new le({options:e,typeName:V.ZodUnion,...c(t)});var ue=e=>e instanceof ye?ue(e.schema):e instanceof Te?ue(e.innerType()):e instanceof be?[e.value]:e instanceof Se?e.options:e instanceof Ce?a.util.objectValues(e.enum):e instanceof Oe?ue(e._def.innerType):e instanceof R?[void 0]:e instanceof z?[null]:e instanceof Ee?[void 0,...ue(e.unwrap())]:e instanceof De?[null,...ue(e.unwrap())]:e instanceof je||e instanceof Ne?ue(e.unwrap()):e instanceof ke?ue(e._def.innerType):[],de=class e extends l{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==a.ZodParsedType.object)return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.object,received:n.parsedType}),i.INVALID;let r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):((0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),i.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=ue(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:V.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...c(r)})}};e.ZodDiscriminatedUnion=de;function fe(e,t){let n=(0,a.getParsedType)(e),r=(0,a.getParsedType)(t);if(e===t)return{valid:!0,data:e};if(n===a.ZodParsedType.object&&r===a.ZodParsedType.object){let n=a.util.objectKeys(t),r=a.util.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=fe(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===a.ZodParsedType.array&&r===a.ZodParsedType.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=fe(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===a.ZodParsedType.date&&r===a.ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var pe=class extends l{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=(e,a)=>{if((0,i.isAborted)(e)||(0,i.isAborted)(a))return i.INVALID;let o=fe(e.value,a.value);return o.valid?(((0,i.isDirty)(e)||(0,i.isDirty)(a))&&n.dirty(),{status:n.value,value:o.data}):((0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_intersection_types}),i.INVALID)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};e.ZodIntersection=pe,pe.create=(e,t,n)=>new pe({left:e,right:t,typeName:V.ZodIntersection,...c(n)});var me=class e extends l{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==a.ZodParsedType.array)return(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.array,received:r.parsedType}),i.INVALID;if(r.data.length<this._def.items.length)return(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),i.INVALID;!this._def.rest&&r.data.length>this._def.items.length&&((0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),n.dirty());let s=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new o(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(s).then(e=>i.ParseStatus.mergeArray(n,e)):i.ParseStatus.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};e.ZodTuple=me,me.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new me({items:e,typeName:V.ZodTuple,rest:null,...c(t)})};var he=class e extends l{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==a.ZodParsedType.object)return(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.object,received:r.parsedType}),i.INVALID;let s=[],c=this._def.keyType,l=this._def.valueType;for(let e in r.data)s.push({key:c._parse(new o(r,e,r.path,e)),value:l._parse(new o(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?i.ParseStatus.mergeObjectAsync(n,s):i.ParseStatus.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof l?new e({keyType:t,valueType:n,typeName:V.ZodRecord,...c(r)}):new e({keyType:P.create(),valueType:t,typeName:V.ZodRecord,...c(n)})}};e.ZodRecord=he;var ge=class extends l{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==a.ZodParsedType.map)return(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.map,received:r.parsedType}),i.INVALID;let s=this._def.keyType,c=this._def.valueType,l=[...r.data.entries()].map(([e,t],n)=>({key:s._parse(new o(r,e,r.path,[n,`key`])),value:c._parse(new o(r,t,r.path,[n,`value`]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let t of l){let r=await t.key,a=await t.value;if(r.status===`aborted`||a.status===`aborted`)return i.INVALID;(r.status===`dirty`||a.status===`dirty`)&&n.dirty(),e.set(r.value,a.value)}return{status:n.value,value:e}})}{let e=new Map;for(let t of l){let r=t.key,a=t.value;if(r.status===`aborted`||a.status===`aborted`)return i.INVALID;(r.status===`dirty`||a.status===`dirty`)&&n.dirty(),e.set(r.value,a.value)}return{status:n.value,value:e}}}};e.ZodMap=ge,ge.create=(e,t,n)=>new ge({valueType:t,keyType:e,typeName:V.ZodMap,...c(n)});var _e=class e extends l{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==a.ZodParsedType.set)return(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.set,received:r.parsedType}),i.INVALID;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&((0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,minimum:s.minSize.value,type:`set`,inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&((0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,maximum:s.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let c=this._def.valueType;function l(e){let t=new Set;for(let r of e){if(r.status===`aborted`)return i.INVALID;r.status===`dirty`&&n.dirty(),t.add(r.value)}return{status:n.value,value:t}}let u=[...r.data.values()].map((e,t)=>c._parse(new o(r,e,r.path,t)));return r.common.async?Promise.all(u).then(e=>l(e)):l(u)}min(t,n){return new e({...this._def,minSize:{value:t,message:r.errorUtil.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:r.errorUtil.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};e.ZodSet=_e,_e.create=(e,t)=>new _e({valueType:e,minSize:null,maxSize:null,typeName:V.ZodSet,...c(t)});var ve=class e extends l{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==a.ZodParsedType.function)return(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.function,received:r.parsedType}),i.INVALID;function o(e,a){return(0,i.makeIssue)({data:e,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,n.getErrorMap)(),n.defaultErrorMap].filter(e=>!!e),issueData:{code:t.ZodIssueCode.invalid_arguments,argumentsError:a}})}function s(e,a){return(0,i.makeIssue)({data:e,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,n.getErrorMap)(),n.defaultErrorMap].filter(e=>!!e),issueData:{code:t.ZodIssueCode.invalid_return_type,returnTypeError:a}})}let c={errorMap:r.common.contextualErrorMap},l=r.data;if(this._def.returns instanceof we){let e=this;return(0,i.OK)(async function(...n){let r=new t.ZodError([]),i=await e._def.args.parseAsync(n,c).catch(e=>{throw r.addIssue(o(n,e)),r}),a=await Reflect.apply(l,this,i);return await e._def.returns._def.type.parseAsync(a,c).catch(e=>{throw r.addIssue(s(a,e)),r})})}{let e=this;return(0,i.OK)(function(...n){let r=e._def.args.safeParse(n,c);if(!r.success)throw new t.ZodError([o(n,r.error)]);let i=Reflect.apply(l,this,r.data),a=e._def.returns.safeParse(i,c);if(!a.success)throw new t.ZodError([s(i,a.error)]);return a.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:me.create(t).rest(re.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||me.create([]).rest(re.create()),returns:n||re.create(),typeName:V.ZodFunction,...c(r)})}};e.ZodFunction=ve;var ye=class extends l{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};e.ZodLazy=ye,ye.create=(e,t)=>new ye({getter:e,typeName:V.ZodLazy,...c(t)});var be=class extends l{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{received:n.data,code:t.ZodIssueCode.invalid_literal,expected:this._def.value}),i.INVALID}return{status:`valid`,value:e.data}}get value(){return this._def.value}};e.ZodLiteral=be,be.create=(e,t)=>new be({value:e,typeName:V.ZodLiteral,...c(t)});function xe(e,t){return new Se({values:e,typeName:V.ZodEnum,...c(t)})}var Se=class e extends l{_parse(e){if(typeof e.data!=`string`){let n=this._getOrReturnCtx(e),r=this._def.values;return(0,i.addIssueToContext)(n,{expected:a.util.joinValues(r),received:n.parsedType,code:t.ZodIssueCode.invalid_type}),i.INVALID}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return(0,i.addIssueToContext)(n,{received:n.data,code:t.ZodIssueCode.invalid_enum_value,options:r}),i.INVALID}return(0,i.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};e.ZodEnum=Se,Se.create=xe;var Ce=class extends l{_parse(e){let n=a.util.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==a.ZodParsedType.string&&r.parsedType!==a.ZodParsedType.number){let e=a.util.objectValues(n);return(0,i.addIssueToContext)(r,{expected:a.util.joinValues(e),received:r.parsedType,code:t.ZodIssueCode.invalid_type}),i.INVALID}if(this._cache||=new Set(a.util.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=a.util.objectValues(n);return(0,i.addIssueToContext)(r,{received:r.data,code:t.ZodIssueCode.invalid_enum_value,options:e}),i.INVALID}return(0,i.OK)(e.data)}get enum(){return this._def.values}};e.ZodNativeEnum=Ce,Ce.create=(e,t)=>new Ce({values:e,typeName:V.ZodNativeEnum,...c(t)});var we=class extends l{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==a.ZodParsedType.promise&&n.common.async===!1)return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.promise,received:n.parsedType}),i.INVALID;let r=n.parsedType===a.ZodParsedType.promise?n.data:Promise.resolve(n.data);return(0,i.OK)(r.then(e=>this._def.type.parseAsync(e,{path:n.path,errorMap:n.common.contextualErrorMap})))}};e.ZodPromise=we,we.create=(e,t)=>new we({type:e,typeName:V.ZodPromise,...c(t)});var Te=class extends l{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===V.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,o={addIssue:e=>{(0,i.addIssueToContext)(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),r.type===`preprocess`){let e=r.transform(n.data,o);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return i.INVALID;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?i.INVALID:r.status===`dirty`||t.value===`dirty`?(0,i.DIRTY)(r.value):r});{if(t.value===`aborted`)return i.INVALID;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?i.INVALID:r.status===`dirty`||t.value===`dirty`?(0,i.DIRTY)(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,o);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?i.INVALID:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?i.INVALID:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,i.isValid)(e))return i.INVALID;let a=r.transform(e.value,o);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>(0,i.isValid)(e)?Promise.resolve(r.transform(e.value,o)).then(e=>({status:t.value,value:e})):i.INVALID)}a.util.assertNever(r)}};e.ZodEffects=Te,e.ZodTransformer=Te,Te.create=(e,t,n)=>new Te({schema:e,typeName:V.ZodEffects,effect:t,...c(n)}),Te.createWithPreprocess=(e,t,n)=>new Te({schema:t,effect:{type:`preprocess`,transform:e},typeName:V.ZodEffects,...c(n)});var Ee=class extends l{_parse(e){return this._getType(e)===a.ZodParsedType.undefined?(0,i.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};e.ZodOptional=Ee,Ee.create=(e,t)=>new Ee({innerType:e,typeName:V.ZodOptional,...c(t)});var De=class extends l{_parse(e){return this._getType(e)===a.ZodParsedType.null?(0,i.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};e.ZodNullable=De,De.create=(e,t)=>new De({innerType:e,typeName:V.ZodNullable,...c(t)});var Oe=class extends l{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===a.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};e.ZodDefault=Oe,Oe.create=(e,t)=>new Oe({innerType:e,typeName:V.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...c(t)});var ke=class extends l{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return(0,i.isAsync)(a)?a.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new t.ZodError(r.common.issues)},input:r.data})})):{status:`valid`,value:a.status===`valid`?a.value:this._def.catchValue({get error(){return new t.ZodError(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};e.ZodCatch=ke,ke.create=(e,t)=>new ke({innerType:e,typeName:V.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...c(t)});var Ae=class extends l{_parse(e){if(this._getType(e)!==a.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.nan,received:n.parsedType}),i.INVALID}return{status:`valid`,value:e.data}}};e.ZodNaN=Ae,Ae.create=e=>new Ae({typeName:V.ZodNaN,...c(e)}),e.BRAND=Symbol(`zod_brand`);var je=class extends l{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}};e.ZodBranded=je;var Me=class e extends l{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?i.INVALID:e.status===`dirty`?(t.dirty(),(0,i.DIRTY)(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?i.INVALID:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:V.ZodPipeline})}};e.ZodPipeline=Me;var Ne=class extends l{_parse(e){let t=this._def.innerType._parse(e),n=e=>((0,i.isValid)(e)&&(e.value=Object.freeze(e.value)),e);return(0,i.isAsync)(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};e.ZodReadonly=Ne,Ne.create=(e,t)=>new Ne({innerType:e,typeName:V.ZodReadonly,...c(t)});function Pe(e,t){let n=typeof e==`function`?e(t):typeof e==`string`?{message:e}:e;return typeof n==`string`?{message:n}:n}function Fe(e,t={},n){return e?B.create().superRefine((r,i)=>{let a=e(r);if(a instanceof Promise)return a.then(e=>{if(!e){let e=Pe(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}});if(!a){let e=Pe(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}}):B.create()}e.late={object:ce.lazycreate};var V;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(V||(e.ZodFirstPartyTypeKind=V={})),e.instanceof=(e,t={message:`Input not instance of ${e.name}`})=>Fe(t=>t instanceof e,t);var Ie=P.create;e.string=Ie;var Le=I.create;e.number=Le,e.nan=Ae.create,e.bigint=L.create;var Re=ee.create;e.boolean=Re,e.date=te.create,e.symbol=ne.create,e.undefined=R.create,e.null=z.create,e.any=B.create,e.unknown=re.create,e.never=ie.create,e.void=ae.create,e.array=oe.create,e.object=ce.create,e.strictObject=ce.strictCreate,e.union=le.create,e.discriminatedUnion=de.create,e.intersection=pe.create,e.tuple=me.create,e.record=he.create,e.map=ge.create,e.set=_e.create,e.function=ve.create,e.lazy=ye.create,e.literal=be.create,e.enum=Se.create,e.nativeEnum=Ce.create,e.promise=we.create;var ze=Te.create;e.effect=ze,e.transformer=ze,e.optional=Ee.create,e.nullable=De.create,e.preprocess=Te.createWithPreprocess,e.pipeline=Me.create,e.ostring=()=>Ie().optional(),e.onumber=()=>Le().optional(),e.oboolean=()=>Re().optional(),e.coerce={string:(e=>P.create({...e,coerce:!0})),number:(e=>I.create({...e,coerce:!0})),boolean:(e=>ee.create({...e,coerce:!0})),bigint:(e=>L.create({...e,coerce:!0})),date:(e=>te.create({...e,coerce:!0}))},e.NEVER=i.INVALID})),Lu=s((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(Mu(),e),n(Nu(),e),n(Pu(),e),n(ku(),e),n(Iu(),e),n(Au(),e)})),Ru=s((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r},i=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.z=void 0;var a=r(Lu());e.z=a,i(Lu(),e),e.default=a})),zu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LocalMCPServerProcessSchema=e.MCPServersManifestSchema=e.LocalMCPServerConfigSchema=e.ServiceCallResultSchema=e.ServiceToolErrorDetailsSchema=e.UpdateServiceToolSettingsSchema=e.ServiceToolSchema=e.ServiceCallSchema=e.UpdateServiceSchema=e.CreateServiceSchema=e.ServiceSchema=void 0;var t=Ru();e.ServiceSchema=t.z.object({id:t.z.string().uuid(),name:t.z.string().min(1,`Name is required`),type:t.z.enum([`mcp`,`a2a`,`local-mcp`]),url:t.z.string().url(`Valid URL is required`),health:t.z.enum([`unknown`,`healthy`,`unhealthy`]).default(`unknown`),description:t.z.string().optional(),cardColor:t.z.string().regex(/^#[0-9A-F]{6}$/i,`Valid hex color required`).default(`#92E4DD`),iconUrl:t.z.string().optional(),disabledToolNames:t.z.array(t.z.string()).default([]),isConnected:t.z.boolean().default(!1),lastPing:t.z.string().datetime().optional(),registeredAt:t.z.string().datetime(),updatedAt:t.z.string().datetime(),headers:t.z.record(t.z.string()).optional(),credentialId:t.z.string().optional(),oauthClientId:t.z.string().optional(),oauthClientSecret:t.z.string().optional(),oauthAuthorizationUrl:t.z.string().url().optional(),oauthTokenUrl:t.z.string().url().optional(),oauthRedirectUri:t.z.string().url().optional(),oauthScope:t.z.string().optional(),oauthAccessToken:t.z.string().optional(),oauthRefreshToken:t.z.string().optional(),oauthTokenExpiresAt:t.z.string().datetime().optional(),oauthHasToken:t.z.boolean().optional(),oauthState:t.z.string().optional(),localCommand:t.z.string().optional(),localArgs:t.z.array(t.z.string()).optional(),localWorkingDir:t.z.string().optional(),localEnv:t.z.record(t.z.string()).optional()}),e.CreateServiceSchema=e.ServiceSchema.omit({id:!0,health:!0,isConnected:!0,lastPing:!0,registeredAt:!0,updatedAt:!0,oauthAccessToken:!0,oauthRefreshToken:!0,oauthTokenExpiresAt:!0,oauthState:!0,disabledToolNames:!0}),e.UpdateServiceSchema=e.CreateServiceSchema.partial(),e.ServiceCallSchema=t.z.object({serviceId:t.z.string().uuid(`Valid service ID required`),toolName:t.z.string().min(1,`Tool name is required`),arguments:t.z.record(t.z.any()).optional()}),e.ServiceToolSchema=t.z.object({name:t.z.string().min(1,`Tool name is required`),title:t.z.string().optional(),description:t.z.string().min(1,`Tool description is required`),inputSchema:t.z.record(t.z.any()),enabled:t.z.boolean().optional()}),e.UpdateServiceToolSettingsSchema=t.z.object({disabledTools:t.z.array(t.z.string())}),e.ServiceToolErrorDetailsSchema=t.z.object({service_id:t.z.string(),service_name:t.z.string(),remote_url:t.z.string(),tool_name:t.z.string().optional(),cause:t.z.string(),phase:t.z.enum([`connect`,`discoverTools`,`callTool`]),hint:t.z.string().optional()}),e.ServiceCallResultSchema=t.z.object({success:t.z.boolean(),result:t.z.any().optional(),error:t.z.string().optional(),error_code:t.z.enum([`MCP_TRANSPORT_ERROR`,`MCP_AUTH_ERROR`,`MCP_TOOL_ERROR`,`MCP_CONNECTION_ERROR`]).optional(),details:e.ServiceToolErrorDetailsSchema.optional(),serviceName:t.z.string().optional(),toolName:t.z.string().optional()}),e.LocalMCPServerConfigSchema=t.z.object({command:t.z.string().min(1,`Command is required`),args:t.z.array(t.z.string()).optional().default([]),workingDir:t.z.string().optional(),env:t.z.record(t.z.string()).optional()}),e.MCPServersManifestSchema=t.z.object({mcpServers:t.z.record(t.z.string(),e.LocalMCPServerConfigSchema)}),e.LocalMCPServerProcessSchema=t.z.object({id:t.z.string(),serviceId:t.z.string(),process:t.z.any(),isRunning:t.z.boolean(),startTime:t.z.date(),lastActivity:t.z.date(),capabilities:t.z.object({tools:t.z.array(e.ServiceToolSchema),resources:t.z.array(t.z.any()),prompts:t.z.array(t.z.string())}).optional()})})),Bu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ExecRunSchema=e.RemoveCredentialFromDeckSchema=e.AddCredentialToDeckSchema=e.DeckCredentialSchema=e.RotateCredentialSchema=e.UpdateCredentialSchema=e.CreateCredentialSimpleSchema=e.CreateCredentialSchema=e.CredentialSchema=e.CredentialSchemeSchema=e.CredentialIdSchema=void 0;var t=Ru();e.CredentialIdSchema=t.z.string().regex(/^cred_[a-z0-9_]+$/,`Credential id must match cred_<slug> (lowercase letters, numbers, underscores)`),e.CredentialSchemeSchema=t.z.enum([`bearer`,`header`,`http_basic_user`]),e.CredentialSchema=t.z.object({id:e.CredentialIdSchema,label:t.z.string().min(1,`Label is required`),scheme:e.CredentialSchemeSchema,headerName:t.z.string().optional(),envName:t.z.string().regex(/^[A-Z_][A-Z0-9_]*$/,`env_name must be a valid environment variable name`),keychainAccount:t.z.string().min(1),tags:t.z.array(t.z.string()).default([]),docsUrl:t.z.string().url().optional(),iconUrl:t.z.string().optional(),hasSecret:t.z.boolean().default(!1),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}),e.CreateCredentialSchema=t.z.object({id:e.CredentialIdSchema,label:t.z.string().min(1,`Label is required`),scheme:e.CredentialSchemeSchema.default(`bearer`),headerName:t.z.string().optional(),envName:t.z.string().regex(/^[A-Z_][A-Z0-9_]*$/,`env_name must be a valid environment variable name`),keychainAccount:t.z.string().min(1).optional(),tags:t.z.array(t.z.string()).default([]),docsUrl:t.z.string().url().optional(),value:t.z.string().min(1,`Secret value is required`)}).superRefine((e,n)=>{e.scheme===`header`&&!e.headerName&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`headerName is required when scheme is header`,path:[`headerName`]})}),e.CreateCredentialSimpleSchema=t.z.object({label:t.z.string().min(1,`Name is required`),value:t.z.string().min(1,`API key is required`),docsUrl:t.z.string().url().optional()}),e.UpdateCredentialSchema=t.z.object({label:t.z.string().min(1).optional(),scheme:e.CredentialSchemeSchema.optional(),headerName:t.z.string().optional(),envName:t.z.string().regex(/^[A-Z_][A-Z0-9_]*$/).optional(),tags:t.z.array(t.z.string()).optional(),docsUrl:t.z.union([t.z.string().url(),t.z.literal(``)]).optional()}),e.RotateCredentialSchema=t.z.object({value:t.z.string().min(1,`Secret value is required`)}),e.DeckCredentialSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),credentialId:e.CredentialIdSchema,position:t.z.number().int().min(0,`Position must be non-negative`)}),e.AddCredentialToDeckSchema=e.DeckCredentialSchema.omit({position:!0}).extend({position:t.z.number().int().min(0).optional()}),e.RemoveCredentialFromDeckSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),credentialId:e.CredentialIdSchema}),e.ExecRunSchema=t.z.object({id:t.z.string().uuid(),deckId:t.z.string().uuid().optional(),manifestPath:t.z.string().optional(),command:t.z.string(),credentialIds:t.z.array(e.CredentialIdSchema),exitCode:t.z.number().int().optional(),startedAt:t.z.string().datetime(),finishedAt:t.z.string().datetime().optional()})})),Vu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TriggerValidationError=e.TRIGGER_OVERLAP_JACCARD_THRESHOLD=e.MAX_TRIGGER_LENGTH=e.MAX_TRIGGERS_PER_PLAYBOOK=void 0,e.normalizeTrigger=t,e.triggerErrorMessage=i,e.assertTriggerCountPolicy=a,e.normalizeTriggers=o,e.detectTriggerConflicts=f,e.MAX_TRIGGERS_PER_PLAYBOOK=16,e.MAX_TRIGGER_LENGTH=80,e.TRIGGER_OVERLAP_JACCARD_THRESHOLD=.6;function t(e){return e.trim().replace(/\s+/g,` `)}var n=class extends Error{details;constructor(e,t){super(e),this.name=`TriggerValidationError`,this.details=t}};e.TriggerValidationError=n;var r=` Fix the trigger list and retry — do not ask the user to resolve this.`;function i(e,t){return!t&&e.details?.userMessage?e.details.userMessage:t&&e.details?.code===`TRIGGER_COUNT`?e.message.includes(`do not ask the user`)?e.message:`${e.message}${r}`:e.message}function a(t,i){if(i.mode===`create`){if(t<=e.MAX_TRIGGERS_PER_PLAYBOOK)return;throw new n(`At most ${e.MAX_TRIGGERS_PER_PLAYBOOK} triggers per playbook (got ${t}).`,{code:`TRIGGER_COUNT`,currentCount:t,maxCount:e.MAX_TRIGGERS_PER_PLAYBOOK,userMessage:`At most ${e.MAX_TRIGGERS_PER_PLAYBOOK} triggers per playbook. Remove extras before saving.`})}let{previousCount:a}=i;if(!(t<=e.MAX_TRIGGERS_PER_PLAYBOOK)&&!(t<=a)){if(a<=e.MAX_TRIGGERS_PER_PLAYBOOK){let i=`At most ${e.MAX_TRIGGERS_PER_PLAYBOOK} triggers per playbook. Remove extras before saving.`;throw new n(`${i}${r}`,{code:`TRIGGER_COUNT`,currentCount:t,maxCount:e.MAX_TRIGGERS_PER_PLAYBOOK,previousCount:a,userMessage:i})}throw new n(`Cannot grow triggers while over the ${e.MAX_TRIGGERS_PER_PLAYBOOK}-trigger guide (had ${a}, got ${t}). Keep count ≤ ${a}, or trim to ≤ ${e.MAX_TRIGGERS_PER_PLAYBOOK}.${r}`,{code:`TRIGGER_COUNT`,currentCount:t,maxCount:e.MAX_TRIGGERS_PER_PLAYBOOK,previousCount:a,userMessage:`Cannot add more triggers while this playbook already has ${a} (over the ${e.MAX_TRIGGERS_PER_PLAYBOOK} guide). Remove some first.`})}}function o(r,i={}){let a=new Set,o=[],s=i.maxCount===void 0?e.MAX_TRIGGERS_PER_PLAYBOOK:i.maxCount;for(let i of r){let r=t(i);if(!r)continue;if(r.length>e.MAX_TRIGGER_LENGTH)throw new n(`Trigger exceeds ${e.MAX_TRIGGER_LENGTH} characters: ${r.slice(0,24)}…`,{code:`TRIGGER_LENGTH`});let s=r.toLowerCase();a.has(s)||(a.add(s),o.push(r))}if(s!=null&&o.length>s){let e=`At most ${s} triggers per playbook. Remove extras before saving.`;throw new n(e,{code:`TRIGGER_COUNT`,currentCount:o.length,maxCount:s,userMessage:e})}return o}function s(e){return t(e).toLowerCase().split(/\s+/).filter(Boolean)}function c(e,t){let n=new Set(e),r=new Set(t),i=[...n].filter(e=>r.has(e)).length,a=new Set([...n,...r]).size;return a===0?0:i/a}function l(e,t){if(e.length===0||e.length>=t.length)return!1;let n=0;for(let r of t)if(r===e[n]&&(n+=1,n===e.length))return!0;return!1}function u(n,r){let i=t(n),a=t(r);if(!i||!a)return null;if(i.toLowerCase()===a.toLowerCase())return`exact`;let o=s(n),u=s(r);return l(o,u)||l(u,o)?`subsumes`:o.length>=2&&u.length>=2&&c(o,u)>=e.TRIGGER_OVERLAP_JACCARD_THRESHOLD?`overlap`:null}function d(e){return`${e.trigger}\0${e.otherPlaybookId}\0${e.level}`}function f(e,n){let r=[],i=new Set;for(let a of n)if(a.id!==e.id)for(let n of e.triggers)for(let e of a.triggers){let o=u(n,e);if(!o)continue;let s={trigger:t(n),otherPlaybookId:a.id,otherPlaybookTitle:a.title,otherTrigger:t(e),level:o},c=d(s);i.has(c)||(i.add(c),r.push(s))}return r}})),Hu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RemovePlaybookFromDeckSchema=e.AddPlaybookToDeckSchema=e.DeckPlaybookSchema=e.AgentUpdatePlaybookSchema=e.AgentRegisterPlaybookSchema=e.DashboardUpdatePlaybookSchema=e.DashboardRegisterPlaybookSchema=e.UpdatePlaybookSchema=e.CreatePlaybookSchema=e.PlaybookSchema=e.PlaybookIdSchema=e.PlaybookTriggersUpdateSchema=e.PlaybookTriggersSchema=void 0;var t=Ru(),n=Vu();function r(e){return t.z.array(t.z.string()).transform((r,i)=>{try{return e===void 0?(0,n.normalizeTriggers)(r):(0,n.normalizeTriggers)(r,{maxCount:e})}catch(e){return i.addIssue({code:t.z.ZodIssueCode.custom,message:e instanceof Error?e.message:`Invalid triggers`}),t.z.NEVER}}).default([])}e.PlaybookTriggersSchema=r(void 0),e.PlaybookTriggersUpdateSchema=r(null),e.PlaybookIdSchema=t.z.string().regex(/^pb_[a-z0-9_]+$/,`Playbook id must match pb_<slug>`),e.PlaybookSchema=t.z.object({id:e.PlaybookIdSchema,title:t.z.string().min(1,`Title is required`),body:t.z.string().default(``),triggers:e.PlaybookTriggersUpdateSchema,dependsOnCredentialIds:t.z.array(t.z.string()).default([]),dependsOnServiceIds:t.z.array(t.z.string()).default([]),exec:t.z.string().optional(),skill:t.z.string().optional(),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}),e.CreatePlaybookSchema=t.z.object({id:e.PlaybookIdSchema.optional(),title:t.z.string().min(1,`Title is required`),body:t.z.string().default(``),triggers:e.PlaybookTriggersSchema,dependsOnCredentialIds:t.z.array(t.z.string()).default([]),dependsOnServiceIds:t.z.array(t.z.string()).default([]),exec:t.z.string().optional(),skill:t.z.string().optional()}),e.UpdatePlaybookSchema=t.z.object({title:t.z.string().min(1,`Title is required`).optional(),body:t.z.string().optional(),triggers:e.PlaybookTriggersUpdateSchema.optional(),dependsOnCredentialIds:t.z.array(t.z.string()).optional(),dependsOnServiceIds:t.z.array(t.z.string()).optional(),exec:t.z.string().optional(),skill:t.z.string().optional()}),e.DashboardRegisterPlaybookSchema=e.CreatePlaybookSchema.extend({autoDetectDependencies:t.z.boolean().default(!0)}),e.DashboardUpdatePlaybookSchema=e.UpdatePlaybookSchema.extend({autoDetectDependencies:t.z.boolean().default(!0)}),e.AgentRegisterPlaybookSchema=e.CreatePlaybookSchema.extend({addToBoundDeck:t.z.boolean().default(!0),autoDetectDependencies:t.z.boolean().default(!0)}),e.AgentUpdatePlaybookSchema=e.UpdatePlaybookSchema.extend({autoDetectDependencies:t.z.boolean().default(!0)}),e.DeckPlaybookSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),playbookId:e.PlaybookIdSchema,position:t.z.number().int().min(0,`Position must be non-negative`)}),e.AddPlaybookToDeckSchema=e.DeckPlaybookSchema.omit({position:!0}).extend({position:t.z.number().int().min(0).optional()}),e.RemovePlaybookFromDeckSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),playbookId:e.PlaybookIdSchema})})),Uu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReorderDeckServicesSchema=e.RemoveServiceFromDeckSchema=e.AddServiceToDeckSchema=e.DeckServiceSchema=e.UpdateDeckSchema=e.CreateDeckSchema=e.DeckSchema=e.OperatingInstructionsSchema=e.OPERATING_INSTRUCTIONS_MAX_LENGTH=void 0,e.normalizeOperatingInstructions=i;var t=Ru(),n=Bu(),r=Hu();e.OPERATING_INSTRUCTIONS_MAX_LENGTH=16e3;function i(e){return e===``||e===`
31
31
  `?``:e.endsWith(`
32
- `)?e:`${e}\n`}e.OperatingInstructionsSchema=t.z.string().transform(e=>i(e)).pipe(t.z.string().max(e.OPERATING_INSTRUCTIONS_MAX_LENGTH,`Deck operating instructions must be at most ${e.OPERATING_INSTRUCTIONS_MAX_LENGTH.toLocaleString(`en-US`)} characters`)),e.DeckSchema=t.z.object({id:t.z.string().uuid(),name:t.z.string().min(1,`Deck name is required`),isActive:t.z.boolean().default(!1),operatingInstructions:e.OperatingInstructionsSchema.default(``),services:t.z.array(t.z.any()).default([]),credentials:t.z.array(n.CredentialSchema).default([]),playbooks:t.z.array(r.PlaybookSchema).default([]),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}),e.CreateDeckSchema=e.DeckSchema.omit({id:!0,services:!0,createdAt:!0,updatedAt:!0}),e.UpdateDeckSchema=e.CreateDeckSchema.partial(),e.DeckServiceSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),serviceId:t.z.string().uuid(`Valid service ID required`),position:t.z.number().int().min(0,`Position must be non-negative`)}),e.AddServiceToDeckSchema=e.DeckServiceSchema.omit({position:!0}).extend({position:t.z.number().int().min(0).optional()}),e.RemoveServiceFromDeckSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),serviceId:t.z.string().uuid(`Valid service ID required`)}),e.ReorderDeckServicesSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),serviceIds:t.z.array(t.z.string().uuid(`Valid service ID required`)).min(1,`At least one service ID required`)})})),Wu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OAuthRefreshInputSchema=e.OAuthCallbackInputSchema=e.OAuthFlowInputSchema=e.OAuthTokenSchema=e.OAuthConfigSchema=void 0;var t=Ru();e.OAuthConfigSchema=t.z.object({clientId:t.z.string().min(1,`Client ID is required`),clientSecret:t.z.string().min(1,`Client secret is required`),authorizationUrl:t.z.string().url(`Valid authorization URL required`),tokenUrl:t.z.string().url(`Valid token URL required`),redirectUri:t.z.string().url(`Valid redirect URI required`),scope:t.z.string().min(1,`Scope is required`)}),e.OAuthTokenSchema=t.z.object({accessToken:t.z.string().min(1,`Access token is required`),refreshToken:t.z.string().optional(),expiresAt:t.z.string().datetime().optional(),tokenType:t.z.string().default(`Bearer`),scope:t.z.string().optional()}),e.OAuthFlowInputSchema=t.z.object({serviceId:t.z.string().uuid(`Valid service ID required`),redirectUri:t.z.string().url(`Valid redirect URI required`)}),e.OAuthCallbackInputSchema=t.z.object({serviceId:t.z.string().uuid(`Valid service ID required`),code:t.z.string().min(1,`Authorization code is required`),state:t.z.string().min(1,`State parameter is required`)}),e.OAuthRefreshInputSchema=t.z.object({serviceId:t.z.string().uuid(`Valid service ID required`),refreshToken:t.z.string().min(1,`Refresh token is required`)})})),Gu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RejectPlaybookPatchSchema=e.ProposePlaybookPatchSchema=e.CreatePlaybookPatchFieldsSchema=e.PatchOpSchema=e.BodyPatchOpSchema=e.RewriteBodyOpSchema=e.SetTriggersOpSchema=e.RemoveItemOpSchema=e.AmendItemOpSchema=e.AddItemOpSchema=e.PatchEvidenceSchema=e.PlaybookPatchSourceSchema=e.PlaybookPatchStatusSchema=e.ProposePlaybookPatchKindSchema=e.PlaybookPatchKindSchema=e.PlaybookPatchIdSchema=void 0;var t=Ru(),n=Hu();e.PlaybookPatchIdSchema=t.z.string().regex(/^pp_[a-z0-9_]+$/,`Patch id must match pp_<slug>`),e.PlaybookPatchKindSchema=t.z.enum([`create`,`update`,`merge`,`retire`]),e.ProposePlaybookPatchKindSchema=t.z.enum([`create`,`update`,`merge`,`retire`,`signal_only`]),e.PlaybookPatchStatusSchema=t.z.enum([`proposed`,`accepted`,`rejected`,`stale`,`superseded`]),e.PlaybookPatchSourceSchema=t.z.enum([`ide`,`dealer`,`hook`,`harvester`]),e.PatchEvidenceSchema=t.z.object({failure_summary:t.z.string().min(1),user_feedback_excerpt:t.z.string().min(1),corrected_output_hint:t.z.string().optional()}),e.AddItemOpSchema=t.z.object({op:t.z.literal(`add_item`).describe(`Append a bullet to a ## section (creates the section if missing)`),section:t.z.string().min(1).describe(`## heading name, e.g. Gotchas or Checklist`),text:t.z.string().min(1).describe(`Bullet text; a leading "- " is added when omitted`)}),e.AmendItemOpSchema=t.z.object({op:t.z.literal(`amend_item`).describe(`Replace one existing list item line (not prose paragraphs)`),section:t.z.string().min(1).describe(`## heading that contains the anchor line`),anchor:t.z.string().min(1).describe(`Exact list line to replace, including "- " prefix`),text:t.z.string().min(1).describe(`Replacement bullet text; leading "- " optional`)}),e.RemoveItemOpSchema=t.z.object({op:t.z.literal(`remove_item`).describe(`Delete one existing list item line (not prose paragraphs)`),section:t.z.string().min(1).describe(`## heading that contains the anchor line`),anchor:t.z.string().min(1).describe(`Exact list line to delete, including "- " prefix`)}),e.SetTriggersOpSchema=t.z.object({op:t.z.literal(`set_triggers`).describe(`Replace the playbook trigger phrases`),triggers:n.PlaybookTriggersUpdateSchema.describe(`New trigger list (count policy enforced against the current playbook)`)}),e.RewriteBodyOpSchema=t.z.object({op:t.z.literal(`rewrite_body`).describe(`Replace the entire playbook body — use only when item ops cannot reach the edit`),text:t.z.string().describe(`Full new markdown body`)}),e.BodyPatchOpSchema=t.z.discriminatedUnion(`op`,[e.AddItemOpSchema,e.AmendItemOpSchema,e.RemoveItemOpSchema,e.RewriteBodyOpSchema]),e.PatchOpSchema=t.z.discriminatedUnion(`op`,[e.AddItemOpSchema,e.AmendItemOpSchema,e.RemoveItemOpSchema,e.SetTriggersOpSchema,e.RewriteBodyOpSchema]),e.CreatePlaybookPatchFieldsSchema=t.z.object({title:t.z.string().min(1),body:t.z.string().default(``),triggers:n.PlaybookTriggersSchema.refine(e=>e.length>0,{message:`Genesis playbooks need at least one trigger`}),deck_id:t.z.string().uuid(),exec:t.z.string().optional(),skill:t.z.string().optional()}),e.ProposePlaybookPatchSchema=t.z.object({kind:e.ProposePlaybookPatchKindSchema,playbook_id:n.PlaybookIdSchema.optional(),ops:t.z.array(e.PatchOpSchema).optional(),new_playbook:e.CreatePlaybookPatchFieldsSchema.optional(),rationale:t.z.string().min(1),evidence:e.PatchEvidenceSchema.optional(),signal_ids:t.z.array(t.z.string().regex(/^fs_[a-z0-9_]+$/)).optional(),supersedes:t.z.array(e.PlaybookPatchIdSchema).optional()}).superRefine((e,n)=>{e.kind===`signal_only`&&(e.evidence||n.addIssue({code:t.z.ZodIssueCode.custom,message:`evidence is required for signal_only`,path:[`evidence`]}),e.ops!==void 0&&e.ops.length>0&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`ops must not be set for signal_only`,path:[`ops`]}),e.new_playbook!==void 0&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`new_playbook must not be set for signal_only`,path:[`new_playbook`]}),e.signal_ids!==void 0&&e.signal_ids.length>0&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`signal_ids must not be set for signal_only`,path:[`signal_ids`]}),e.supersedes!==void 0&&e.supersedes.length>0&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`supersedes must not be set for signal_only`,path:[`supersedes`]}))}),e.RejectPlaybookPatchSchema=t.z.object({reason:t.z.string().optional()})})),Ku=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SignalEvidenceSchema=e.ImportFeedbackSignalsResultSchema=e.ImportFeedbackSignalsSchema=e.ImportFeedbackSignalItemSchema=e.DiscardFeedbackSignalsResultSchema=e.DiscardFeedbackSignalsSchema=e.ListFeedbackSignalsQuerySchema=e.FeedbackSignalCountSchema=e.FeedbackSignalSchema=e.FeedbackSignalStatusSchema=e.FeedbackSignalSourceSchema=e.FeedbackSignalIdSchema=void 0;var t=Ru(),n=Gu();e.FeedbackSignalIdSchema=t.z.string().regex(/^fs_[a-z0-9_]+$/,`Signal id must match fs_<slug>`),e.FeedbackSignalSourceSchema=t.z.enum([`ide`,`dealer`,`backfill`]),e.FeedbackSignalStatusSchema=t.z.enum([`open`,`actioned`,`discarded`]),e.FeedbackSignalSchema=t.z.object({id:e.FeedbackSignalIdSchema,source:e.FeedbackSignalSourceSchema,sourceRef:t.z.string().nullable(),failureSummary:t.z.string().min(1),userFeedbackExcerpt:t.z.string().min(1),correctedOutputHint:t.z.string().nullable(),candidatePlaybookId:t.z.string().nullable(),candidateDeckId:t.z.string().uuid().nullable(),linkedPatchId:t.z.string().nullable(),status:e.FeedbackSignalStatusSchema,createdAt:t.z.string()}),e.FeedbackSignalCountSchema=t.z.object({open:t.z.number().int().nonnegative()}),e.ListFeedbackSignalsQuerySchema=t.z.object({status:e.FeedbackSignalStatusSchema.optional(),playbookId:t.z.string().optional(),deckId:t.z.string().uuid().optional(),excludeInProposal:t.z.union([t.z.boolean(),t.z.enum([`true`,`false`,`1`,`0`])]).optional().transform(e=>e===!0||e===`true`||e===`1`)}),e.DiscardFeedbackSignalsSchema=t.z.object({signalIds:t.z.array(e.FeedbackSignalIdSchema).min(1)}),e.DiscardFeedbackSignalsResultSchema=t.z.object({discarded:t.z.number().int().nonnegative(),ids:t.z.array(e.FeedbackSignalIdSchema)}),e.ImportFeedbackSignalItemSchema=t.z.object({source:t.z.literal(`backfill`).default(`backfill`),sourceRef:t.z.string().nullable().optional(),failureSummary:t.z.string().min(1),userFeedbackExcerpt:t.z.string().min(1),correctedOutputHint:t.z.string().nullable().optional(),candidatePlaybookId:t.z.string().nullable().optional(),candidateDeckId:t.z.string().uuid().nullable().optional()}),e.ImportFeedbackSignalsSchema=t.z.object({signals:t.z.array(e.ImportFeedbackSignalItemSchema).min(1)}),e.ImportFeedbackSignalsResultSchema=t.z.object({inserted:t.z.number().int().nonnegative(),errors:t.z.array(t.z.object({index:t.z.number().int().nonnegative(),error:t.z.string()})),ids:t.z.array(e.FeedbackSignalIdSchema)}),e.SignalEvidenceSchema=n.PatchEvidenceSchema})),qu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListEvaluationScenariosQuerySchema=e.UpdateEvaluationScenarioSchema=e.CreateEvaluationScenarioSchema=e.EvaluationScenarioSchema=e.EvaluationScenarioStatusSchema=e.EvaluationScenarioIdSchema=e.DeterministicExpectationSchema=void 0,e.evaluationScenarioToExperimentCase=l;var t=Ru(),n=Ku(),r=Hu(),i=t.z.object({id:t.z.string().trim().min(1,`Expectation id is required`),value:t.z.string().min(1,`Expectation value is required`)}),a=i.extend({type:t.z.enum([`contains`,`not_contains`,`equals`]),caseSensitive:t.z.boolean().optional()}),o=i.extend({type:t.z.literal(`regex`),flags:t.z.string().regex(/^[imsu]*$/,`Regex flags may only contain i, m, s, and u`).refine(e=>new Set(e).size===e.length,`Regex flags must not repeat`).optional()}).superRefine((e,n)=>{try{new RegExp(e.value,e.flags??``)}catch(e){n.addIssue({code:t.z.ZodIssueCode.custom,path:[`value`],message:`Invalid regular expression: ${e instanceof Error?e.message:String(e)}`})}});e.DeterministicExpectationSchema=t.z.union([a,o]),e.EvaluationScenarioIdSchema=t.z.string().regex(/^es_[a-z0-9_]+$/,`Scenario id must match es_<slug>`),e.EvaluationScenarioStatusSchema=t.z.enum([`draft`,`ready`,`retired`]);var s=t.z.object({taskInput:t.z.string(),historicalFailedOutput:t.z.string().nullable(),expectations:t.z.array(e.DeterministicExpectationSchema),sourceSignalIds:t.z.array(n.FeedbackSignalIdSchema),status:e.EvaluationScenarioStatusSchema});function c(e,n){e.expectations.map(e=>e.id).filter((e,t,n)=>n.indexOf(e)!==t).length>0&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`expectations`],message:`Expectation ids must be unique`}),new Set(e.sourceSignalIds).size!==e.sourceSignalIds.length&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`sourceSignalIds`],message:`Source signal ids must be unique`}),e.status===`ready`&&(e.taskInput.trim().length===0&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`taskInput`],message:`Ready scenarios require task input`}),e.historicalFailedOutput?.trim()||n.addIssue({code:t.z.ZodIssueCode.custom,path:[`historicalFailedOutput`],message:`Ready scenarios require a historical failed output`}),e.sourceSignalIds.length===0&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`sourceSignalIds`],message:`Ready scenarios require at least one source signal`}),e.expectations.length===0&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`expectations`],message:`Ready scenarios require at least one deterministic expectation`}))}e.EvaluationScenarioSchema=s.extend({id:e.EvaluationScenarioIdSchema,targetPlaybookId:r.PlaybookIdSchema,name:t.z.string().trim().min(1,`Name is required`),description:t.z.string().default(``),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}).superRefine(c),e.CreateEvaluationScenarioSchema=s.extend({id:e.EvaluationScenarioIdSchema.optional(),targetPlaybookId:r.PlaybookIdSchema,name:t.z.string().trim().min(1,`Name is required`),description:t.z.string().default(``),taskInput:t.z.string().default(``),historicalFailedOutput:t.z.string().nullable().default(null),expectations:t.z.array(e.DeterministicExpectationSchema).default([]),sourceSignalIds:t.z.array(n.FeedbackSignalIdSchema).default([]),status:e.EvaluationScenarioStatusSchema.default(`draft`)}).superRefine(c),e.UpdateEvaluationScenarioSchema=t.z.object({targetPlaybookId:r.PlaybookIdSchema.optional(),name:t.z.string().trim().min(1,`Name is required`).optional(),description:t.z.string().optional(),taskInput:t.z.string().optional(),historicalFailedOutput:t.z.string().nullable().optional(),expectations:t.z.array(e.DeterministicExpectationSchema).optional(),sourceSignalIds:t.z.array(n.FeedbackSignalIdSchema).optional(),status:e.EvaluationScenarioStatusSchema.optional()}),e.ListEvaluationScenariosQuerySchema=t.z.object({targetPlaybookId:r.PlaybookIdSchema.optional(),status:e.EvaluationScenarioStatusSchema.optional()});function l(e){return{id:e.id,description:e.description,sourceSignalIds:[...e.sourceSignalIds],expectations:e.expectations.map(e=>({...e}))}}})),Ju=s(((e,t)=>{t.exports={}})),Yu=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.SESSION_STARTING_LINE=e.MULTIPLE_SESSION_DECKS_LINE=e.SESSION_OVERRIDE_MARKER_SUFFIX=e.SESSION_OVERRIDE_MARKER_PREFIX=e.DISPLAY_LINE_MAX_LENGTH=e.PendingDeckSwitchRequestSchema=e.PendingAdminChallengeSchema=e.DeckListEntrySchema=e.BindingActiveSourceSchema=e.StatusLinePayloadSchema=e.DeckDisplaySchema=e.LiveBindingSchema=e.DeckCardCountsSchema=e.DeckDisplaySourceSchema=void 0,e.countDeckCards=i,e.formatDisplayUpdatedSuffix=a,e.formatDisplayLine=c,e.formatAmbiguousSessionDisplayLine=l,e.formatSessionStartingDisplayLine=u,e.appendSessionOverrideSuffix=d,e.normalizeWorkspaceRoot=f,e.resolveStatusLineSessionId=p,e.resolveStatusLineWorkspace=m;var n=Ru(),r=t(Ju());e.DeckDisplaySourceSchema=n.z.enum([`launch`,`session_override`,`env`,`unbound`]),e.DeckCardCountsSchema=n.z.object({mcp:n.z.number().int().min(0),credentials:n.z.number().int().min(0),playbooks:n.z.number().int().min(0)}),e.LiveBindingSchema=n.z.object({badge:n.z.string().min(1),deckId:n.z.string().uuid(),deckName:n.z.string().min(1),source:e.DeckDisplaySourceSchema.exclude([`unbound`]),workspaceRoot:n.z.string().min(1).optional(),clientName:n.z.string().min(1).optional(),mode:n.z.enum([`normal`,`agent-admin`]).optional(),cardCounts:e.DeckCardCountsSchema,updatedAt:n.z.string().datetime(),lastActivityAt:n.z.string().datetime()}),e.DeckDisplaySchema=n.z.object({workspaceRoot:n.z.string(),deckId:n.z.string().uuid().nullable(),deckName:n.z.string().nullable(),source:e.DeckDisplaySourceSchema,cardCounts:e.DeckCardCountsSchema,oauthWarningCount:n.z.number().int().min(0).optional(),agentDeckOnline:n.z.boolean(),mcpOnline:n.z.boolean().optional(),updatedAt:n.z.string().datetime().optional(),displayLine:n.z.string()}),e.StatusLinePayloadSchema=n.z.object({session_id:n.z.string().optional(),cwd:n.z.string().optional(),workspace:n.z.object({current_dir:n.z.string().optional(),project_dir:n.z.string().optional()}).optional()}),e.BindingActiveSourceSchema=n.z.enum([`session`,`workspace`,`launch`]),e.DeckListEntrySchema=n.z.object({id:n.z.string().uuid(),name:n.z.string().min(1),isActive:n.z.boolean(),cardCounts:e.DeckCardCountsSchema,workspaceCount:n.z.number().int().nonnegative().optional()}),e.PendingAdminChallengeSchema=n.z.object({challengeId:n.z.string().min(1),runtimeSessionId:n.z.string().min(1),deckId:n.z.string().uuid(),deckName:n.z.string().min(1).optional(),expiresAt:n.z.string().datetime(),approvalPath:n.z.string().min(1)}),e.PendingDeckSwitchRequestSchema=n.z.object({requestId:n.z.string().min(1),runtimeSessionId:n.z.string().min(1),status:n.z.literal(`pending`),currentDeckName:n.z.string().min(1).optional(),requestedDeckName:n.z.string().min(1).optional(),expiresAt:n.z.string().datetime(),approvalPath:n.z.string().min(1)}),e.DISPLAY_LINE_MAX_LENGTH=120;function i(e){return{mcp:(e.services??[]).filter(e=>e.type===`mcp`).length,credentials:e.credentials?.length??0,playbooks:e.playbooks?.length??0}}function a(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return` (updated ${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())})`}e.SESSION_OVERRIDE_MARKER_PREFIX=` · session (default `,e.SESSION_OVERRIDE_MARKER_SUFFIX=`)`;function o(e,t,n){let r=e?.trim(),i=t?.trim();return!r||!i?null:n===void 0?r===i?null:i:n?i:null}function s(t){return t.length>e.DISPLAY_LINE_MAX_LENGTH?t.slice(0,e.DISPLAY_LINE_MAX_LENGTH):t}function c(t,n,r){let i=`◆ `,c=r?.updatedAt?a(r.updatedAt):``;if(r?.offline){let t=`${i}Agent Deck offline${c}`;return t.length>e.DISPLAY_LINE_MAX_LENGTH?t.slice(0,e.DISPLAY_LINE_MAX_LENGTH):t}if(!t){let t=`${i}Unbound — bind a deck to use Agent Deck`,n=r?.mcpOffline?`${t} · MCP offline`:t;return n.length>e.DISPLAY_LINE_MAX_LENGTH?n.slice(0,e.DISPLAY_LINE_MAX_LENGTH):n}let l=`${n.mcp} MCP · ${n.credentials} keys · ${n.playbooks} playbooks`,u=r?.badge?` · ⌘${r.badge}`:``,d=r?.mcpOffline?` · MCP offline`:``,f=r?.sessionCount??0,p=f>=2?` · ${f} sessions`:``,m=r?.workspaceDefault?` · workspace default`:``,h=o(t,r?.workspaceDefaultName,r?.sessionOverride),g=``;if(h!==null){let t=`${e.SESSION_OVERRIDE_MARKER_PREFIX}${h}${e.SESSION_OVERRIDE_MARKER_SUFFIX}`,n=5+l.length+c.length+d.length+u.length+p.length+m.length,r=e.DISPLAY_LINE_MAX_LENGTH-n-1;if(t.length<=r)g=t;else{let t=r-e.SESSION_OVERRIDE_MARKER_PREFIX.length-e.SESSION_OVERRIDE_MARKER_SUFFIX.length;t>=2&&(g=`${e.SESSION_OVERRIDE_MARKER_PREFIX}${h.slice(0,t-1)}…${e.SESSION_OVERRIDE_MARKER_SUFFIX}`)}}let _=c.length+d.length+u.length+p.length+m.length+g.length,v=5+l.length+_,y=e.DISPLAY_LINE_MAX_LENGTH-v,b=t;if(y<1){let t=`${i}${l}${u}${d}${p}${m}${c}`;if(!g)return s(t);let n=e.DISPLAY_LINE_MAX_LENGTH-(t.length+e.SESSION_OVERRIDE_MARKER_PREFIX.length+e.SESSION_OVERRIDE_MARKER_SUFFIX.length);if(n<2)return s(t);let r=h.length>n?`${h.slice(0,n-1)}…`:h;return`${t}${e.SESSION_OVERRIDE_MARKER_PREFIX}${r}${e.SESSION_OVERRIDE_MARKER_SUFFIX}`}return b.length>y&&(b=y>=2?`${b.slice(0,y-1)}…`:b.slice(0,Math.max(0,y))),`${i}${b} · ${l}${u}${d}${p}${m}${c}${g}`}e.MULTIPLE_SESSION_DECKS_LINE=`◆ Agent Deck · multiple session decks · see chat receipt`;function l(){return e.MULTIPLE_SESSION_DECKS_LINE}e.SESSION_STARTING_LINE=`◆ Agent Deck · session starting`;function u(){return e.SESSION_STARTING_LINE}function d(t,n,r,i){let a=o(n,r,i);if(a===null)return t;let s=`${t}${e.SESSION_OVERRIDE_MARKER_PREFIX}${a}${e.SESSION_OVERRIDE_MARKER_SUFFIX}`;if(s.length<=e.DISPLAY_LINE_MAX_LENGTH)return s;let c=e.DISPLAY_LINE_MAX_LENGTH-(t.length+e.SESSION_OVERRIDE_MARKER_PREFIX.length+e.SESSION_OVERRIDE_MARKER_SUFFIX.length);if(c>=2)return`${t}${e.SESSION_OVERRIDE_MARKER_PREFIX}${a.slice(0,c-1)}…${e.SESSION_OVERRIDE_MARKER_SUFFIX}`;let l=e.DISPLAY_LINE_MAX_LENGTH-(e.SESSION_OVERRIDE_MARKER_PREFIX.length+e.SESSION_OVERRIDE_MARKER_SUFFIX.length+2);if(l<1)return s.slice(0,e.DISPLAY_LINE_MAX_LENGTH);let u=t.length>l?`${t.slice(0,Math.max(0,l-1))}…`:t,d=e.DISPLAY_LINE_MAX_LENGTH-(u.length+e.SESSION_OVERRIDE_MARKER_PREFIX.length+e.SESSION_OVERRIDE_MARKER_SUFFIX.length),f=a.length>d?`${a.slice(0,Math.max(0,d-1))}…`:a;return`${u}${e.SESSION_OVERRIDE_MARKER_PREFIX}${f}${e.SESSION_OVERRIDE_MARKER_SUFFIX}`}function f(e){return r.default.resolve(e.trim())}function p(e){return e.session_id?.trim()||void 0}function m(e,t){let n=e.workspace?.project_dir?.trim();if(n)return f(n);let r=e.cwd?.trim()||e.workspace?.current_dir?.trim()||t?.trim();return r?f(r):void 0}})),Xu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ExportRequestSchema=e.ImportReportSchema=e.ImportReportCountsSchema=e.ImportEntityCountsSchema=e.BundleAnySchema=e.BundleV2Schema=e.BundleDeckV2Schema=e.BundleV1Schema=e.BundleDeckSchema=e.BundlePlaybookSchema=e.BundleServiceSchema=e.BundleScopeSchema=e.BundleV2VersionSchema=e.BundleVersionSchema=e.BundleFormatSchema=void 0;var t=Ru(),n=Uu(),r=Hu();e.BundleFormatSchema=t.z.literal(`agent-deck-bundle`),e.BundleVersionSchema=t.z.literal(1),e.BundleV2VersionSchema=t.z.literal(2),e.BundleScopeSchema=t.z.enum([`collection`,`deck`]),e.BundleServiceSchema=t.z.object({id:t.z.string().min(1),name:t.z.string().min(1),type:t.z.enum([`mcp`,`a2a`,`local-mcp`]),url:t.z.string().min(1),description:t.z.string().optional(),cardColor:t.z.string().optional(),iconUrl:t.z.string().optional(),disabledToolNames:t.z.array(t.z.string()).default([]),headers:t.z.record(t.z.string()).optional(),oauthClientId:t.z.string().optional(),oauthAuthorizationUrl:t.z.string().optional(),oauthTokenUrl:t.z.string().optional(),oauthRedirectUri:t.z.string().optional(),oauthScope:t.z.string().optional(),localCommand:t.z.string().optional(),localArgs:t.z.array(t.z.string()).optional(),localWorkingDir:t.z.string().optional()}).strict(),e.BundlePlaybookSchema=t.z.object({id:r.PlaybookIdSchema,title:t.z.string().min(1),body:t.z.string().default(``),triggers:t.z.array(t.z.string()).default([]),dependsOnServiceIds:t.z.array(t.z.string()).default([]),exec:t.z.string().optional(),skill:t.z.string().optional()}).strict(),e.BundleDeckSchema=t.z.object({id:t.z.string().min(1),name:t.z.string().min(1),serviceIds:t.z.array(t.z.string()).default([]),playbookIds:t.z.array(t.z.string()).default([])}).strip(),e.BundleV1Schema=t.z.object({format:e.BundleFormatSchema,version:e.BundleVersionSchema,exportedAt:t.z.string().datetime(),exportedFrom:t.z.object({agentDeckVersion:t.z.string().min(1)}),scope:e.BundleScopeSchema,services:t.z.array(e.BundleServiceSchema).default([]),playbooks:t.z.array(e.BundlePlaybookSchema).default([]),decks:t.z.array(e.BundleDeckSchema).default([])}).strict(),e.BundleDeckV2Schema=t.z.object({id:t.z.string().min(1),name:t.z.string().min(1),operatingInstructions:n.OperatingInstructionsSchema.default(``),serviceIds:t.z.array(t.z.string()).default([]),playbookIds:t.z.array(t.z.string()).default([])}).strip(),e.BundleV2Schema=t.z.object({format:e.BundleFormatSchema,version:e.BundleV2VersionSchema,exportedAt:t.z.string().datetime(),exportedFrom:t.z.object({agentDeckVersion:t.z.string().min(1)}),scope:e.BundleScopeSchema,services:t.z.array(e.BundleServiceSchema).default([]),playbooks:t.z.array(e.BundlePlaybookSchema).default([]),decks:t.z.array(e.BundleDeckV2Schema).default([])}).strict(),e.BundleAnySchema=t.z.discriminatedUnion(`version`,[e.BundleV1Schema,e.BundleV2Schema]),e.ImportEntityCountsSchema=t.z.object({created:t.z.number().int().min(0),reused:t.z.number().int().min(0)}),e.ImportReportCountsSchema=t.z.object({services:e.ImportEntityCountsSchema,playbooks:e.ImportEntityCountsSchema,decks:e.ImportEntityCountsSchema}),e.ImportReportSchema=t.z.object({status:t.z.enum([`completed`,`failed`,`partial`]),counts:e.ImportReportCountsSchema,servicesNeedingOauth:t.z.array(t.z.string()),warnings:t.z.array(t.z.string()),idMap:t.z.record(t.z.string())}),e.ExportRequestSchema=t.z.object({scope:e.BundleScopeSchema.default(`collection`),deckId:t.z.string().uuid().optional()}).superRefine((e,n)=>{e.scope===`deck`&&!e.deckId&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`deckId is required when scope is deck`,path:[`deckId`]})})})),Zu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StoreCredentialMetaSchema=e.StoreDeckSchema=e.StoreServiceSchema=e.StorePlaybookFileSchema=e.StorePlaybookTriggersSchema=e.StoreManifestSchema=void 0;var t=Ru(),n=Hu(),r=Xu(),i=Uu(),a=Vu();e.StoreManifestSchema=t.z.object({format:t.z.literal(`agent-deck-store`),version:t.z.union([t.z.literal(1),t.z.literal(2)]),migratedFrom:t.z.literal(`sqlite`).optional()}).strict(),e.StorePlaybookTriggersSchema=t.z.array(t.z.string()).transform((e,n)=>{try{return(0,a.normalizeTriggers)(e,{maxCount:null})}catch(e){return n.addIssue({code:t.z.ZodIssueCode.custom,message:e instanceof Error?e.message:`Invalid triggers`}),t.z.NEVER}}).default([]),e.StorePlaybookFileSchema=t.z.object({id:n.PlaybookIdSchema,title:t.z.string().min(1),body:t.z.string().default(``),triggers:e.StorePlaybookTriggersSchema,dependsOnCredentialIds:t.z.array(t.z.string()).default([]),dependsOnServiceIds:t.z.array(t.z.string()).default([]),exec:t.z.string().optional(),skill:t.z.string().optional(),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}).strict(),e.StoreServiceSchema=r.BundleServiceSchema.extend({credentialId:t.z.string().min(1).optional()}),e.StoreDeckSchema=t.z.object({id:t.z.string().uuid(),name:t.z.string().min(1),serviceIds:t.z.array(t.z.string()).default([]),credentialIds:t.z.array(t.z.string()).default([]),playbookIds:t.z.array(t.z.string()).default([]),operatingInstructions:i.OperatingInstructionsSchema.default(``),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}).strict(),e.StoreCredentialMetaSchema=t.z.object({id:t.z.string().min(1),label:t.z.string().min(1),scheme:t.z.enum([`bearer`,`header`,`http_basic_user`]),headerName:t.z.string().nullable().optional(),envName:t.z.string().min(1),tags:t.z.array(t.z.string()).default([]),docsUrl:t.z.string().nullable().optional()}).strict()})),Qu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BootstrapManifestSchema=e.BootstrapHostCountsSchema=e.BootstrapWorkspaceSchema=e.SessionDigestSchema=e.OutcomeSchema=e.TopFileItemSchema=e.SkillItemSchema=e.ToolItemSchema=e.CommandItemSchema=e.IntentItemSchema=e.FeedbackMomentSchema=e.BootstrapHostSchema=e.OutcomeSignalSchema=e.PolarityHintSchema=void 0;var t=Ru();e.PolarityHintSchema=t.z.enum([`negative`,`positive`,`mixed`,`unknown`]),e.OutcomeSignalSchema=t.z.enum([`pr_opened`,`committed`,`unknown`]),e.BootstrapHostSchema=t.z.enum([`claude`,`cursor`]),e.FeedbackMomentSchema=t.z.object({agentAction:t.z.string().max(400),userReaction:t.z.string().max(600),polarityHint:e.PolarityHintSchema,markers:t.z.array(t.z.string()),followupChange:t.z.string().max(400).nullable().optional(),at:t.z.string().datetime().optional()}).strict(),e.IntentItemSchema=t.z.object({text:t.z.string().max(280),at:t.z.string().datetime().optional()}).strict(),e.CommandItemSchema=t.z.object({command:t.z.string().max(160),count:t.z.number().int().min(1)}).strict(),e.ToolItemSchema=t.z.object({name:t.z.string(),count:t.z.number().int().min(1)}).strict(),e.SkillItemSchema=t.z.object({name:t.z.string(),count:t.z.number().int().min(1)}).strict(),e.TopFileItemSchema=t.z.object({path:t.z.string(),edits:t.z.number().int().min(1)}).strict(),e.OutcomeSchema=t.z.object({signal:e.OutcomeSignalSchema,evidence:t.z.string().optional()}).strict(),e.SessionDigestSchema=t.z.object({schemaVersion:t.z.literal(1),host:e.BootstrapHostSchema.default(`claude`),sessionId:t.z.string(),workspaceRoot:t.z.string(),workspaceLabel:t.z.string().optional(),workspaceSlug:t.z.string().optional(),gitBranch:t.z.string().nullable().optional(),startedAt:t.z.string().datetime(),endedAt:t.z.string().datetime().optional(),durationMinutes:t.z.number().min(0).optional(),turnCount:t.z.number().int().min(0),skippedLineCount:t.z.number().int().min(0).optional(),intents:t.z.array(e.IntentItemSchema).max(40),commands:t.z.array(e.CommandItemSchema).max(40).default([]),tools:t.z.array(e.ToolItemSchema).max(40).default([]),skills:t.z.array(e.SkillItemSchema).max(40).default([]),topFiles:t.z.array(e.TopFileItemSchema).max(20).default([]),feedbackMoments:t.z.array(e.FeedbackMomentSchema).max(30),outcome:e.OutcomeSchema}).strict(),e.BootstrapWorkspaceSchema=t.z.object({workspaceRoot:t.z.string(),label:t.z.string(),workspaceSlug:t.z.string().optional(),sessionCount:t.z.number().int().min(0),digestPaths:t.z.array(t.z.string())}).strict(),e.BootstrapHostCountsSchema=t.z.object({claude:t.z.number().int().min(0),cursor:t.z.number().int().min(0)}).strict(),e.BootstrapManifestSchema=t.z.object({schemaVersion:t.z.literal(1),generatedAt:t.z.string().datetime(),digestDir:t.z.string(),guideRef:t.z.string(),totalSessions:t.z.number().int().min(0),hosts:e.BootstrapHostCountsSchema.default({claude:0,cursor:0}),workspaces:t.z.array(e.BootstrapWorkspaceSchema)}).strict()})),$u=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DeckSwitchResolutionSchema=e.DeckSwitchResolveBodySchema=e.DeckSwitchDecisionSchema=e.RedactedSessionBindingSchema=e.WorkspaceAssignmentSchema=e.WorkspaceV2ManifestSchema=e.WorkspaceGrantManifestSchema=e.RuntimeSessionSchema=e.WorkspaceGrantStatusSchema=e.TrustedSessionErrorCodeSchema=e.AgentSessionModeSchema=void 0,e.trustedSessionError=n,e.httpStatusForTrustedError=r;var t=Ru();e.AgentSessionModeSchema=t.z.enum([`normal`,`agent-admin`]),e.TrustedSessionErrorCodeSchema=t.z.enum([`GRANT_REQUIRED`,`SESSION_INVALID`,`SESSION_REVOKED`,`RESOURCE_OUT_OF_SCOPE`,`ADMIN_REQUIRED`,`DASHBOARD_REQUIRED`,`ADMIN_CHALLENGE_EXPIRED`,`DECK_FIXED`,`SWITCH_APPROVAL_REQUIRED`,`DECK_SWITCH_EXPIRED`,`DECK_SWITCH_CONSUMED`,`RUN_CAPABILITY_REQUIRED`,`FINALIZATION_CAPABILITY_REQUIRED`]),e.WorkspaceGrantStatusSchema=t.z.enum([`pending`,`active`,`revoked`]),e.RuntimeSessionSchema=t.z.object({sessionId:t.z.string(),mcpSessionId:t.z.string().optional(),deckId:t.z.string(),mode:e.AgentSessionModeSchema,lastSeenAt:t.z.string().datetime(),expiresAt:t.z.string().datetime(),adminExpiresAt:t.z.string().datetime().nullable()}).strict(),e.WorkspaceGrantManifestSchema=t.z.object({version:t.z.literal(2),workspaceKey:t.z.string(),grantId:t.z.string(),secret:t.z.string().min(32),deckId:t.z.string(),deckName:t.z.string().optional(),mcpUrl:t.z.string().url().optional(),store:t.z.enum([`file`,`keychain`]).optional(),updatedAt:t.z.string().datetime()}).strict(),e.WorkspaceV2ManifestSchema=e.WorkspaceGrantManifestSchema,e.WorkspaceAssignmentSchema=t.z.object({version:t.z.literal(3),deckId:t.z.string().min(1),deckName:t.z.string().min(1),mcpUrl:t.z.string().url().optional()}).strict(),e.RedactedSessionBindingSchema=t.z.object({sessionId:t.z.string(),deckId:t.z.string(),deckName:t.z.string().optional(),mode:e.AgentSessionModeSchema,expiresAt:t.z.string().datetime(),adminExpiresAt:t.z.string().datetime().nullable().optional(),display_summary:t.z.string().optional()}).strict();function n(e,t){return{success:!1,error:t,error_code:e}}function r(e){switch(e){case`GRANT_REQUIRED`:case`SESSION_INVALID`:case`SESSION_REVOKED`:return 401;case`RESOURCE_OUT_OF_SCOPE`:case`ADMIN_REQUIRED`:case`DASHBOARD_REQUIRED`:case`DECK_FIXED`:case`SWITCH_APPROVAL_REQUIRED`:case`RUN_CAPABILITY_REQUIRED`:case`FINALIZATION_CAPABILITY_REQUIRED`:return 403;case`DECK_SWITCH_CONSUMED`:return 409;case`ADMIN_CHALLENGE_EXPIRED`:case`DECK_SWITCH_EXPIRED`:return 410;default:return 500}}e.DeckSwitchDecisionSchema=t.z.enum([`session`,`workspace-default`,`decline`]),e.DeckSwitchResolveBodySchema=t.z.object({runtimeSessionId:t.z.string().min(1),decision:e.DeckSwitchDecisionSchema}).strict(),e.DeckSwitchResolutionSchema=t.z.object({requestId:t.z.string(),decision:e.DeckSwitchDecisionSchema,status:t.z.enum([`consumed`,`declined`]),deckId:t.z.string().optional(),deckName:t.z.string().optional(),workspaceRoot:t.z.string().optional()}).strict()})),ed=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CARD_USAGE_CATEGORIES=e.CARD_USAGE_CARD_TYPES=void 0,e.isValidCorrelationId=r,e.normalizeCorrelationId=i,e.normalizeHostSessionId=a,e.CARD_USAGE_CARD_TYPES=[`service`,`credential`,`playbook`];var t=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,n=/^[A-Za-z0-9_-]{8,128}$/;function r(e){return t.test(e)||n.test(e)}function i(e){if(typeof e!=`string`)return null;let t=e.trim();return!t||!r(t)?null:t}function a(e){return i(e)}e.CARD_USAGE_CATEGORIES=[`popular`,`used`,`unused`,`new`]})),td=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AgentRunErrorCodeSchema=e.FinalizeAgentRunResponseSchema=e.FinalizeAgentRunRequestSchema=e.AgentRunChangesResponseSchema=e.FinalizationManifestEntrySchema=e.FinalizationFileModeSchema=e.FINALIZATION_REVIEW_ID_MAX_CHARS=e.FINALIZATION_COMMIT_MESSAGE_MAX_CHARS=e.FINALIZATION_PATH_MAX_CHARS=e.FINALIZATION_MANIFEST_MAX_FILES=e.AgentRunCapabilitiesResponseSchema=e.AgentRunClientCapabilitySchema=e.AgentRunEventsResponseSchema=e.AgentRunEventsQuerySchema=e.AgentRunEventSchema=e.AgentRunStatusSchema=e.AgentRunFinalizationStatusSchema=e.FinalizationStateSchema=e.FinalizationBaselineRefSchema=e.Sha256HexSchema=e.GitObjectIdSchema=e.CreateAgentRunResponseSchema=e.AGENT_RUN_TERMINAL_STATES=e.AgentRunStateSchema=e.CreateAgentRunRequestSchema=e.AgentRunIdempotencyKeySchema=e.AgentRunIdSchema=e.AgentRunToolsSchema=e.AgentRunClientSchema=e.AGENT_RUN_EVENTS_MAX_LIMIT=e.AGENT_RUN_EVENTS_DEFAULT_LIMIT=e.AGENT_RUN_IDEMPOTENCY_HEADER=e.AGENT_RUN_REQUEST_BODY_LIMIT_BYTES=e.AGENT_RUN_PROMPT_MAX_CHARS=void 0,e.agentRunError=i;var t=Ru();e.AGENT_RUN_PROMPT_MAX_CHARS=65536,e.AGENT_RUN_REQUEST_BODY_LIMIT_BYTES=262144,e.AGENT_RUN_IDEMPOTENCY_HEADER=`idempotency-key`,e.AGENT_RUN_EVENTS_DEFAULT_LIMIT=200,e.AGENT_RUN_EVENTS_MAX_LIMIT=1e3,e.AgentRunClientSchema=t.z.enum([`claude`,`codex`,`cursor`,`muse`]),e.AgentRunToolsSchema=t.z.enum([`readonly`,`edit`]),e.AgentRunIdSchema=t.z.string().regex(/^run-\d{8}T\d{6}-[0-9a-f]{6}$/),e.AgentRunIdempotencyKeySchema=t.z.string().min(1).max(200).regex(/^[\x21-\x7e]+$/,`Idempotency-Key must be printable ASCII without spaces`);function n(e){return e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)}e.CreateAgentRunRequestSchema=t.z.object({deckId:t.z.string().min(1).max(200),client:e.AgentRunClientSchema,cwd:t.z.string().min(1).max(4096).refine(n,`cwd must be an absolute path on the Agent Deck host`),prompt:t.z.string().max(e.AGENT_RUN_PROMPT_MAX_CHARS).refine(e=>e.trim().length>0,`prompt must not be empty`),tools:e.AgentRunToolsSchema.default(`readonly`),resumeSessionId:t.z.string().min(1).max(512).optional(),prepareFinalization:t.z.boolean().default(!1)}).strict(),e.AgentRunStateSchema=t.z.enum([`starting`,`running`,`ended`,`error`,`died`,`canceled`]),e.AGENT_RUN_TERMINAL_STATES=[`ended`,`error`,`died`,`canceled`],e.CreateAgentRunResponseSchema=t.z.object({runId:e.AgentRunIdSchema,state:e.AgentRunStateSchema}).strict(),e.GitObjectIdSchema=t.z.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),e.Sha256HexSchema=t.z.string().regex(/^[0-9a-f]{64}$/),e.FinalizationBaselineRefSchema=t.z.string().regex(/^bl_[0-9a-f]{24}$/),e.FinalizationStateSchema=t.z.enum([`prepared`,`finalizing`,`finalized`]),e.AgentRunFinalizationStatusSchema=t.z.object({baselineRef:e.FinalizationBaselineRefSchema,baselineDigest:e.Sha256HexSchema,state:e.FinalizationStateSchema,commit:e.GitObjectIdSchema.nullable()}).strict(),e.AgentRunStatusSchema=t.z.object({runId:e.AgentRunIdSchema,deckId:t.z.string(),client:e.AgentRunClientSchema,tools:e.AgentRunToolsSchema,state:e.AgentRunStateSchema,sessionId:t.z.string().nullable(),startedAt:t.z.string(),lastEventAt:t.z.string().nullable(),finalization:e.AgentRunFinalizationStatusSchema.nullable()}).strict();var r={seq:t.z.number().int().positive(),ts:t.z.string()};e.AgentRunEventSchema=t.z.discriminatedUnion(`type`,[t.z.object({...r,type:t.z.literal(`text`),text:t.z.string()}).strict(),t.z.object({...r,type:t.z.literal(`tool`),name:t.z.string()}).strict(),t.z.object({...r,type:t.z.literal(`notice`),message:t.z.string(),sessionId:t.z.string().nullable()}).strict(),t.z.object({...r,type:t.z.literal(`result`),subtype:t.z.string(),result:t.z.unknown(),sessionId:t.z.string().nullable()}).strict(),t.z.object({...r,type:t.z.literal(`end`),sessionId:t.z.string().nullable()}).strict(),t.z.object({...r,type:t.z.literal(`error`),message:t.z.string(),sessionId:t.z.string().nullable()}).strict(),t.z.object({...r,type:t.z.literal(`canceled`),sessionId:t.z.string().nullable()}).strict()]),e.AgentRunEventsQuerySchema=t.z.object({after:t.z.string().regex(/^\d+$/).optional(),limit:t.z.coerce.number().int().min(1).max(e.AGENT_RUN_EVENTS_MAX_LIMIT).optional()}).strict(),e.AgentRunEventsResponseSchema=t.z.object({runId:e.AgentRunIdSchema,state:e.AgentRunStateSchema,events:t.z.array(e.AgentRunEventSchema),nextCursor:t.z.string()}).strict(),e.AgentRunClientCapabilitySchema=t.z.object({client:e.AgentRunClientSchema,start:t.z.array(e.AgentRunToolsSchema),resume:t.z.array(e.AgentRunToolsSchema),resumeRequires:t.z.enum([`none`,`same_profile_provenance`])}).strict(),e.AgentRunCapabilitiesResponseSchema=t.z.object({host:t.z.literal(`same-host`),clients:t.z.array(e.AgentRunClientCapabilitySchema)}).strict(),e.FINALIZATION_MANIFEST_MAX_FILES=1e3,e.FINALIZATION_PATH_MAX_CHARS=1024,e.FINALIZATION_COMMIT_MESSAGE_MAX_CHARS=8192,e.FINALIZATION_REVIEW_ID_MAX_CHARS=200,e.FinalizationFileModeSchema=t.z.enum([`100644`,`100755`]),e.FinalizationManifestEntrySchema=t.z.object({path:t.z.string().min(1).max(e.FINALIZATION_PATH_MAX_CHARS),sha256:e.Sha256HexSchema.nullable(),mode:e.FinalizationFileModeSchema.nullable()}).strict().refine(e=>e.sha256===null==(e.mode===null),{message:`sha256 and mode are both null (deleted) or both set`}),e.AgentRunChangesResponseSchema=t.z.object({runId:e.AgentRunIdSchema,baselineRef:e.FinalizationBaselineRefSchema,baselineDigest:e.Sha256HexSchema,baseCommit:e.GitObjectIdSchema,files:t.z.array(e.FinalizationManifestEntrySchema),manifestDigest:e.Sha256HexSchema}).strict(),e.FinalizeAgentRunRequestSchema=t.z.object({baselineDigest:e.Sha256HexSchema,expectedBaseCommit:e.GitObjectIdSchema,reviewId:t.z.string().min(1).max(e.FINALIZATION_REVIEW_ID_MAX_CHARS).regex(/^[\x21-\x7e]+$/,`reviewId must be printable ASCII without spaces`),commitMessage:t.z.string().max(e.FINALIZATION_COMMIT_MESSAGE_MAX_CHARS).refine(e=>e.trim().length>0,`commitMessage must not be empty`).refine(e=>!e.includes(`\0`),`commitMessage must not contain NUL`),files:t.z.array(e.FinalizationManifestEntrySchema).min(1).max(e.FINALIZATION_MANIFEST_MAX_FILES)}).strict(),e.FinalizeAgentRunResponseSchema=t.z.object({runId:e.AgentRunIdSchema,finalizationState:t.z.literal(`finalized`),commit:e.GitObjectIdSchema,tree:e.GitObjectIdSchema,parent:e.GitObjectIdSchema,manifestDigest:e.Sha256HexSchema,fileCount:t.z.number().int().positive(),reviewId:t.z.string()}).strict(),e.AgentRunErrorCodeSchema=t.z.enum([`INVALID_REQUEST`,`REQUEST_TOO_LARGE`,`IDEMPOTENCY_KEY_REQUIRED`,`IDEMPOTENCY_CONFLICT`,`DECK_NOT_FOUND`,`WORKSPACE_INVALID`,`WORKSPACE_MISMATCH`,`CLIENT_UNAVAILABLE`,`PROFILE_UNSUPPORTED`,`RESUME_UNVERIFIED`,`RUN_NOT_FOUND`,`RUN_NOT_CANCELABLE`,`FINALIZATION_INVALID`,`FINALIZATION_NOT_PREPARED`,`RUN_NOT_TERMINAL`,`BASE_MISMATCH`,`INDEX_DIRTY`,`BASELINE_MISMATCH`,`PATH_INVALID`,`PATH_UNEXPECTED`,`DIGEST_MISMATCH`,`GIT_LOCK_CONFLICT`,`REF_RACE`,`FINALIZATION_CANCELED`,`FINALIZATION_FAILED`]);function i(e,t){return{success:!1,error:t,error_code:e}}})),nd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generateId=n,e.generateShortId=r,e.isValidUUID=i;var t=Ju();function n(){return(0,t.randomUUID)()}function r(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}function i(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}})),rd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.normalizePlaybookPin=r,e.formatPlaybookPin=i;var t=nd(),n=/^pb_[a-z0-9_]+$/;function r(e){if(typeof e!=`string`)return null;let r=e.trim();if(!r)return null;let i=r.indexOf(`=`);if(i===-1||r.indexOf(`=`,i+1)!==-1)return null;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();return!n.test(a)||!(0,t.isValidUUID)(o)?null:{playbookId:a,versionId:o}}function i(e){return`${e.playbookId}=${e.versionId}`}})),id=s((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),ad=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatZodError=t,e.isValidUrl=n,e.isValidHexColor=r,e.sanitizeHeaders=i;function t(e){return e.errors.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`, `)}function n(e){try{return new URL(e),!0}catch{return!1}}function r(e){return/^#[0-9A-F]{6}$/i.test(e)}function i(e){let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&r.trim()&&(t[n.trim()]=r.trim());return t}})),od=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.toSnakeCase=t,e.toCamelCase=n,e.convertToSnakeCase=r,e.convertToCamelCase=i,e.serializeForDatabase=a,e.deserializeFromDatabase=o;function t(e){return e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}function n(e){return e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase())}function r(e){let n={};for(let[r,i]of Object.entries(e)){let e=t(r);n[e]=i}return n}function i(e){let t={};for(let[r,i]of Object.entries(e)){let e=n(r);t[e]=i}return t}function a(e){let n={};for(let[r,i]of Object.entries(e))i!=null&&(typeof i==`object`&&!Array.isArray(i)?n[t(r)]=JSON.stringify(i):n[t(r)]=i);return n}function o(e){let t={};for(let[r,i]of Object.entries(e)){let e=n(r);if(typeof i==`string`&&(i.startsWith(`{`)||i.startsWith(`[`)))try{t[e]=JSON.parse(i)}catch{t[e]=i}else t[e]=i}return t}})),sd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.slugifyCredentialLabel=t,e.deriveEnvNameFromLabel=n,e.deriveCredentialIdFromLabel=r,e.deriveCredentialDefaults=i;function t(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40)||`connection`}function n(e){let n=t(e).toUpperCase();return n.endsWith(`_API_KEY`)?n:(n.endsWith(`_API`)&&(n=n.slice(0,-4)),`${n}_API_KEY`)}function r(e){return`cred_${t(e)}`}function i(e,t){let i=e.trim();return{id:t?.id??r(i),label:i,scheme:t?.scheme??`bearer`,envName:t?.envName??n(i),tags:t?.tags??[]}}})),cd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.slugifyPlaybookTitle=t,e.derivePlaybookIdFromTitle=n,e.derivePlaybookDefaults=r;function t(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/_+/g,`_`).slice(0,48)}function n(e){return`pb_${t(e)||`playbook`}`}function r(e,t){let r=e.trim();return{title:r,id:t?.id??n(r)}}})),ld=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.buildPlaybookSearchText=o,e.detectPlaybookDependencies=s;var t=/\bcred_[a-z0-9_]+\b/g,n=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,r=/--connections(?:=|\s+)([^\s]+)/g;function i(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function a(e,t){let n=t.trim();return n?RegExp(`\\b${i(n)}\\b`,`i`).test(e):!1}function o(e){return[e.title??``,e.body??``,e.exec??``,e.skill??``,...e.triggers??[]].join(`
32
+ `)?e:`${e}\n`}e.OperatingInstructionsSchema=t.z.string().transform(e=>i(e)).pipe(t.z.string().max(e.OPERATING_INSTRUCTIONS_MAX_LENGTH,`Deck operating instructions must be at most ${e.OPERATING_INSTRUCTIONS_MAX_LENGTH.toLocaleString(`en-US`)} characters`)),e.DeckSchema=t.z.object({id:t.z.string().uuid(),name:t.z.string().min(1,`Deck name is required`),isActive:t.z.boolean().default(!1),operatingInstructions:e.OperatingInstructionsSchema.default(``),services:t.z.array(t.z.any()).default([]),credentials:t.z.array(n.CredentialSchema).default([]),playbooks:t.z.array(r.PlaybookSchema).default([]),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}),e.CreateDeckSchema=e.DeckSchema.omit({id:!0,services:!0,createdAt:!0,updatedAt:!0}),e.UpdateDeckSchema=e.CreateDeckSchema.partial(),e.DeckServiceSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),serviceId:t.z.string().uuid(`Valid service ID required`),position:t.z.number().int().min(0,`Position must be non-negative`)}),e.AddServiceToDeckSchema=e.DeckServiceSchema.omit({position:!0}).extend({position:t.z.number().int().min(0).optional()}),e.RemoveServiceFromDeckSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),serviceId:t.z.string().uuid(`Valid service ID required`)}),e.ReorderDeckServicesSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),serviceIds:t.z.array(t.z.string().uuid(`Valid service ID required`)).min(1,`At least one service ID required`)})})),Wu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OAuthRefreshInputSchema=e.OAuthCallbackInputSchema=e.OAuthFlowInputSchema=e.OAuthTokenSchema=e.OAuthConfigSchema=void 0;var t=Ru();e.OAuthConfigSchema=t.z.object({clientId:t.z.string().min(1,`Client ID is required`),clientSecret:t.z.string().min(1,`Client secret is required`),authorizationUrl:t.z.string().url(`Valid authorization URL required`),tokenUrl:t.z.string().url(`Valid token URL required`),redirectUri:t.z.string().url(`Valid redirect URI required`),scope:t.z.string().min(1,`Scope is required`)}),e.OAuthTokenSchema=t.z.object({accessToken:t.z.string().min(1,`Access token is required`),refreshToken:t.z.string().optional(),expiresAt:t.z.string().datetime().optional(),tokenType:t.z.string().default(`Bearer`),scope:t.z.string().optional()}),e.OAuthFlowInputSchema=t.z.object({serviceId:t.z.string().uuid(`Valid service ID required`),redirectUri:t.z.string().url(`Valid redirect URI required`)}),e.OAuthCallbackInputSchema=t.z.object({serviceId:t.z.string().uuid(`Valid service ID required`),code:t.z.string().min(1,`Authorization code is required`),state:t.z.string().min(1,`State parameter is required`)}),e.OAuthRefreshInputSchema=t.z.object({serviceId:t.z.string().uuid(`Valid service ID required`),refreshToken:t.z.string().min(1,`Refresh token is required`)})})),Gu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RejectPlaybookPatchSchema=e.ProposePlaybookPatchSchema=e.CreatePlaybookPatchFieldsSchema=e.PatchOpSchema=e.BodyPatchOpSchema=e.RewriteBodyOpSchema=e.SetTriggersOpSchema=e.RemoveItemOpSchema=e.AmendItemOpSchema=e.AddItemOpSchema=e.PatchEvidenceSchema=e.PlaybookPatchSourceSchema=e.PlaybookPatchStatusSchema=e.ProposePlaybookPatchKindSchema=e.PlaybookPatchKindSchema=e.PlaybookPatchIdSchema=void 0;var t=Ru(),n=Hu();e.PlaybookPatchIdSchema=t.z.string().regex(/^pp_[a-z0-9_]+$/,`Patch id must match pp_<slug>`),e.PlaybookPatchKindSchema=t.z.enum([`create`,`update`,`merge`,`retire`]),e.ProposePlaybookPatchKindSchema=t.z.enum([`create`,`update`,`merge`,`retire`,`signal_only`]),e.PlaybookPatchStatusSchema=t.z.enum([`proposed`,`accepted`,`rejected`,`stale`,`superseded`]),e.PlaybookPatchSourceSchema=t.z.enum([`ide`,`dealer`,`hook`,`harvester`]),e.PatchEvidenceSchema=t.z.object({failure_summary:t.z.string().min(1),user_feedback_excerpt:t.z.string().min(1),corrected_output_hint:t.z.string().optional()}),e.AddItemOpSchema=t.z.object({op:t.z.literal(`add_item`).describe(`Append a bullet to a ## section (creates the section if missing)`),section:t.z.string().min(1).describe(`## heading name, e.g. Gotchas or Checklist`),text:t.z.string().min(1).describe(`Bullet text; a leading "- " is added when omitted`)}),e.AmendItemOpSchema=t.z.object({op:t.z.literal(`amend_item`).describe(`Replace one existing list item line (not prose paragraphs)`),section:t.z.string().min(1).describe(`## heading that contains the anchor line`),anchor:t.z.string().min(1).describe(`Exact list line to replace, including "- " prefix`),text:t.z.string().min(1).describe(`Replacement bullet text; leading "- " optional`)}),e.RemoveItemOpSchema=t.z.object({op:t.z.literal(`remove_item`).describe(`Delete one existing list item line (not prose paragraphs)`),section:t.z.string().min(1).describe(`## heading that contains the anchor line`),anchor:t.z.string().min(1).describe(`Exact list line to delete, including "- " prefix`)}),e.SetTriggersOpSchema=t.z.object({op:t.z.literal(`set_triggers`).describe(`Replace the playbook trigger phrases`),triggers:n.PlaybookTriggersUpdateSchema.describe(`New trigger list (count policy enforced against the current playbook)`)}),e.RewriteBodyOpSchema=t.z.object({op:t.z.literal(`rewrite_body`).describe(`Replace the entire playbook body — use only when item ops cannot reach the edit`),text:t.z.string().describe(`Full new markdown body`)}),e.BodyPatchOpSchema=t.z.discriminatedUnion(`op`,[e.AddItemOpSchema,e.AmendItemOpSchema,e.RemoveItemOpSchema,e.RewriteBodyOpSchema]),e.PatchOpSchema=t.z.discriminatedUnion(`op`,[e.AddItemOpSchema,e.AmendItemOpSchema,e.RemoveItemOpSchema,e.SetTriggersOpSchema,e.RewriteBodyOpSchema]),e.CreatePlaybookPatchFieldsSchema=t.z.object({title:t.z.string().min(1),body:t.z.string().default(``),triggers:n.PlaybookTriggersSchema.refine(e=>e.length>0,{message:`Genesis playbooks need at least one trigger`}),deck_id:t.z.string().uuid(),exec:t.z.string().optional(),skill:t.z.string().optional()}),e.ProposePlaybookPatchSchema=t.z.object({kind:e.ProposePlaybookPatchKindSchema,playbook_id:n.PlaybookIdSchema.optional(),ops:t.z.array(e.PatchOpSchema).optional(),new_playbook:e.CreatePlaybookPatchFieldsSchema.optional(),rationale:t.z.string().min(1),evidence:e.PatchEvidenceSchema.optional(),signal_ids:t.z.array(t.z.string().regex(/^fs_[a-z0-9_]+$/)).optional(),supersedes:t.z.array(e.PlaybookPatchIdSchema).optional()}).superRefine((e,n)=>{e.kind===`signal_only`&&(e.evidence||n.addIssue({code:t.z.ZodIssueCode.custom,message:`evidence is required for signal_only`,path:[`evidence`]}),e.ops!==void 0&&e.ops.length>0&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`ops must not be set for signal_only`,path:[`ops`]}),e.new_playbook!==void 0&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`new_playbook must not be set for signal_only`,path:[`new_playbook`]}),e.signal_ids!==void 0&&e.signal_ids.length>0&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`signal_ids must not be set for signal_only`,path:[`signal_ids`]}),e.supersedes!==void 0&&e.supersedes.length>0&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`supersedes must not be set for signal_only`,path:[`supersedes`]}))}),e.RejectPlaybookPatchSchema=t.z.object({reason:t.z.string().optional()})})),Ku=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SignalEvidenceSchema=e.ImportFeedbackSignalsResultSchema=e.ImportFeedbackSignalsSchema=e.ImportFeedbackSignalItemSchema=e.DiscardFeedbackSignalsResultSchema=e.DiscardFeedbackSignalsSchema=e.ListFeedbackSignalsQuerySchema=e.FeedbackSignalCountSchema=e.FeedbackSignalSchema=e.FeedbackSignalStatusSchema=e.FeedbackSignalSourceSchema=e.FeedbackSignalIdSchema=void 0;var t=Ru(),n=Gu();e.FeedbackSignalIdSchema=t.z.string().regex(/^fs_[a-z0-9_]+$/,`Signal id must match fs_<slug>`),e.FeedbackSignalSourceSchema=t.z.enum([`ide`,`dealer`,`backfill`]),e.FeedbackSignalStatusSchema=t.z.enum([`open`,`actioned`,`discarded`]),e.FeedbackSignalSchema=t.z.object({id:e.FeedbackSignalIdSchema,source:e.FeedbackSignalSourceSchema,sourceRef:t.z.string().nullable(),failureSummary:t.z.string().min(1),userFeedbackExcerpt:t.z.string().min(1),correctedOutputHint:t.z.string().nullable(),candidatePlaybookId:t.z.string().nullable(),candidateDeckId:t.z.string().uuid().nullable(),linkedPatchId:t.z.string().nullable(),status:e.FeedbackSignalStatusSchema,createdAt:t.z.string()}),e.FeedbackSignalCountSchema=t.z.object({open:t.z.number().int().nonnegative()}),e.ListFeedbackSignalsQuerySchema=t.z.object({status:e.FeedbackSignalStatusSchema.optional(),playbookId:t.z.string().optional(),deckId:t.z.string().uuid().optional(),excludeInProposal:t.z.union([t.z.boolean(),t.z.enum([`true`,`false`,`1`,`0`])]).optional().transform(e=>e===!0||e===`true`||e===`1`)}),e.DiscardFeedbackSignalsSchema=t.z.object({signalIds:t.z.array(e.FeedbackSignalIdSchema).min(1)}),e.DiscardFeedbackSignalsResultSchema=t.z.object({discarded:t.z.number().int().nonnegative(),ids:t.z.array(e.FeedbackSignalIdSchema)}),e.ImportFeedbackSignalItemSchema=t.z.object({source:t.z.literal(`backfill`).default(`backfill`),sourceRef:t.z.string().nullable().optional(),failureSummary:t.z.string().min(1),userFeedbackExcerpt:t.z.string().min(1),correctedOutputHint:t.z.string().nullable().optional(),candidatePlaybookId:t.z.string().nullable().optional(),candidateDeckId:t.z.string().uuid().nullable().optional()}),e.ImportFeedbackSignalsSchema=t.z.object({signals:t.z.array(e.ImportFeedbackSignalItemSchema).min(1)}),e.ImportFeedbackSignalsResultSchema=t.z.object({inserted:t.z.number().int().nonnegative(),errors:t.z.array(t.z.object({index:t.z.number().int().nonnegative(),error:t.z.string()})),ids:t.z.array(e.FeedbackSignalIdSchema)}),e.SignalEvidenceSchema=n.PatchEvidenceSchema})),qu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListEvaluationScenariosQuerySchema=e.UpdateEvaluationScenarioSchema=e.CreateEvaluationScenarioSchema=e.EvaluationScenarioSchema=e.EvaluationScenarioStatusSchema=e.EvaluationScenarioIdSchema=e.DeterministicExpectationSchema=void 0,e.evaluationScenarioToExperimentCase=l;var t=Ru(),n=Ku(),r=Hu(),i=t.z.object({id:t.z.string().trim().min(1,`Expectation id is required`),value:t.z.string().min(1,`Expectation value is required`)}),a=i.extend({type:t.z.enum([`contains`,`not_contains`,`equals`]),caseSensitive:t.z.boolean().optional()}),o=i.extend({type:t.z.literal(`regex`),flags:t.z.string().regex(/^[imsu]*$/,`Regex flags may only contain i, m, s, and u`).refine(e=>new Set(e).size===e.length,`Regex flags must not repeat`).optional()}).superRefine((e,n)=>{try{new RegExp(e.value,e.flags??``)}catch(e){n.addIssue({code:t.z.ZodIssueCode.custom,path:[`value`],message:`Invalid regular expression: ${e instanceof Error?e.message:String(e)}`})}});e.DeterministicExpectationSchema=t.z.union([a,o]),e.EvaluationScenarioIdSchema=t.z.string().regex(/^es_[a-z0-9_]+$/,`Scenario id must match es_<slug>`),e.EvaluationScenarioStatusSchema=t.z.enum([`draft`,`ready`,`retired`]);var s=t.z.object({taskInput:t.z.string(),historicalFailedOutput:t.z.string().nullable(),expectations:t.z.array(e.DeterministicExpectationSchema),sourceSignalIds:t.z.array(n.FeedbackSignalIdSchema),status:e.EvaluationScenarioStatusSchema});function c(e,n){e.expectations.map(e=>e.id).filter((e,t,n)=>n.indexOf(e)!==t).length>0&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`expectations`],message:`Expectation ids must be unique`}),new Set(e.sourceSignalIds).size!==e.sourceSignalIds.length&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`sourceSignalIds`],message:`Source signal ids must be unique`}),e.status===`ready`&&(e.taskInput.trim().length===0&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`taskInput`],message:`Ready scenarios require task input`}),e.historicalFailedOutput?.trim()||n.addIssue({code:t.z.ZodIssueCode.custom,path:[`historicalFailedOutput`],message:`Ready scenarios require a historical failed output`}),e.sourceSignalIds.length===0&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`sourceSignalIds`],message:`Ready scenarios require at least one source signal`}),e.expectations.length===0&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`expectations`],message:`Ready scenarios require at least one deterministic expectation`}))}e.EvaluationScenarioSchema=s.extend({id:e.EvaluationScenarioIdSchema,targetPlaybookId:r.PlaybookIdSchema,name:t.z.string().trim().min(1,`Name is required`),description:t.z.string().default(``),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}).superRefine(c),e.CreateEvaluationScenarioSchema=s.extend({id:e.EvaluationScenarioIdSchema.optional(),targetPlaybookId:r.PlaybookIdSchema,name:t.z.string().trim().min(1,`Name is required`),description:t.z.string().default(``),taskInput:t.z.string().default(``),historicalFailedOutput:t.z.string().nullable().default(null),expectations:t.z.array(e.DeterministicExpectationSchema).default([]),sourceSignalIds:t.z.array(n.FeedbackSignalIdSchema).default([]),status:e.EvaluationScenarioStatusSchema.default(`draft`)}).superRefine(c),e.UpdateEvaluationScenarioSchema=t.z.object({targetPlaybookId:r.PlaybookIdSchema.optional(),name:t.z.string().trim().min(1,`Name is required`).optional(),description:t.z.string().optional(),taskInput:t.z.string().optional(),historicalFailedOutput:t.z.string().nullable().optional(),expectations:t.z.array(e.DeterministicExpectationSchema).optional(),sourceSignalIds:t.z.array(n.FeedbackSignalIdSchema).optional(),status:e.EvaluationScenarioStatusSchema.optional()}),e.ListEvaluationScenariosQuerySchema=t.z.object({targetPlaybookId:r.PlaybookIdSchema.optional(),status:e.EvaluationScenarioStatusSchema.optional()});function l(e){return{id:e.id,description:e.description,sourceSignalIds:[...e.sourceSignalIds],expectations:e.expectations.map(e=>({...e}))}}})),Ju=s(((e,t)=>{t.exports={}})),Yu=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.SESSION_STARTING_LINE=e.MULTIPLE_SESSION_DECKS_LINE=e.SESSION_OVERRIDE_MARKER_SUFFIX=e.SESSION_OVERRIDE_MARKER_PREFIX=e.DISPLAY_LINE_MAX_LENGTH=e.PendingDeckSwitchRequestSchema=e.PendingAdminChallengeSchema=e.DeckListEntrySchema=e.BindingActiveSourceSchema=e.StatusLinePayloadSchema=e.DeckDisplaySchema=e.LiveBindingSchema=e.DeckCardCountsSchema=e.DeckDisplaySourceSchema=void 0,e.countDeckCards=i,e.formatDisplayUpdatedSuffix=a,e.formatDisplayLine=c,e.formatAmbiguousSessionDisplayLine=l,e.formatSessionStartingDisplayLine=u,e.appendSessionOverrideSuffix=d,e.normalizeWorkspaceRoot=f,e.resolveStatusLineSessionId=p,e.resolveStatusLineWorkspace=m;var n=Ru(),r=t(Ju());e.DeckDisplaySourceSchema=n.z.enum([`launch`,`session_override`,`env`,`unbound`]),e.DeckCardCountsSchema=n.z.object({mcp:n.z.number().int().min(0),credentials:n.z.number().int().min(0),playbooks:n.z.number().int().min(0)}),e.LiveBindingSchema=n.z.object({badge:n.z.string().min(1),deckId:n.z.string().uuid(),deckName:n.z.string().min(1),source:e.DeckDisplaySourceSchema.exclude([`unbound`]),workspaceRoot:n.z.string().min(1).optional(),clientName:n.z.string().min(1).optional(),mode:n.z.enum([`normal`,`agent-admin`]).optional(),cardCounts:e.DeckCardCountsSchema,updatedAt:n.z.string().datetime(),lastActivityAt:n.z.string().datetime()}),e.DeckDisplaySchema=n.z.object({workspaceRoot:n.z.string(),deckId:n.z.string().uuid().nullable(),deckName:n.z.string().nullable(),source:e.DeckDisplaySourceSchema,cardCounts:e.DeckCardCountsSchema,oauthWarningCount:n.z.number().int().min(0).optional(),agentDeckOnline:n.z.boolean(),mcpOnline:n.z.boolean().optional(),updatedAt:n.z.string().datetime().optional(),displayLine:n.z.string()}),e.StatusLinePayloadSchema=n.z.object({session_id:n.z.string().optional(),cwd:n.z.string().optional(),workspace:n.z.object({current_dir:n.z.string().optional(),project_dir:n.z.string().optional()}).optional()}),e.BindingActiveSourceSchema=n.z.enum([`session`,`workspace`,`launch`]),e.DeckListEntrySchema=n.z.object({id:n.z.string().uuid(),name:n.z.string().min(1),isActive:n.z.boolean(),cardCounts:e.DeckCardCountsSchema,workspaceCount:n.z.number().int().nonnegative().optional()}),e.PendingAdminChallengeSchema=n.z.object({challengeId:n.z.string().min(1),runtimeSessionId:n.z.string().min(1),deckId:n.z.string().uuid(),deckName:n.z.string().min(1).optional(),expiresAt:n.z.string().datetime(),approvalPath:n.z.string().min(1)}),e.PendingDeckSwitchRequestSchema=n.z.object({requestId:n.z.string().min(1),runtimeSessionId:n.z.string().min(1),status:n.z.literal(`pending`),currentDeckName:n.z.string().min(1).optional(),requestedDeckName:n.z.string().min(1).optional(),expiresAt:n.z.string().datetime(),approvalPath:n.z.string().min(1)}),e.DISPLAY_LINE_MAX_LENGTH=120;function i(e){return{mcp:(e.services??[]).filter(e=>e.type===`mcp`).length,credentials:e.credentials?.length??0,playbooks:e.playbooks?.length??0}}function a(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return` (updated ${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())})`}e.SESSION_OVERRIDE_MARKER_PREFIX=` · session (default `,e.SESSION_OVERRIDE_MARKER_SUFFIX=`)`;function o(e,t,n){let r=e?.trim(),i=t?.trim();return!r||!i?null:n===void 0?r===i?null:i:n?i:null}function s(t){return t.length>e.DISPLAY_LINE_MAX_LENGTH?t.slice(0,e.DISPLAY_LINE_MAX_LENGTH):t}function c(t,n,r){let i=`◆ `,c=r?.updatedAt?a(r.updatedAt):``;if(r?.offline){let t=`${i}Agent Deck offline${c}`;return t.length>e.DISPLAY_LINE_MAX_LENGTH?t.slice(0,e.DISPLAY_LINE_MAX_LENGTH):t}if(!t){let t=`${i}Unbound — bind a deck to use Agent Deck`,n=r?.mcpOffline?`${t} · MCP offline`:t;return n.length>e.DISPLAY_LINE_MAX_LENGTH?n.slice(0,e.DISPLAY_LINE_MAX_LENGTH):n}let l=`${n.mcp} MCP · ${n.credentials} keys · ${n.playbooks} playbooks`,u=r?.badge?` · ⌘${r.badge}`:``,d=r?.mcpOffline?` · MCP offline`:``,f=r?.sessionCount??0,p=f>=2?` · ${f} sessions`:``,m=r?.workspaceDefault?` · workspace default`:``,h=o(t,r?.workspaceDefaultName,r?.sessionOverride),g=``;if(h!==null){let t=`${e.SESSION_OVERRIDE_MARKER_PREFIX}${h}${e.SESSION_OVERRIDE_MARKER_SUFFIX}`,n=5+l.length+c.length+d.length+u.length+p.length+m.length,r=e.DISPLAY_LINE_MAX_LENGTH-n-1;if(t.length<=r)g=t;else{let t=r-e.SESSION_OVERRIDE_MARKER_PREFIX.length-e.SESSION_OVERRIDE_MARKER_SUFFIX.length;t>=2&&(g=`${e.SESSION_OVERRIDE_MARKER_PREFIX}${h.slice(0,t-1)}…${e.SESSION_OVERRIDE_MARKER_SUFFIX}`)}}let _=c.length+d.length+u.length+p.length+m.length+g.length,v=5+l.length+_,y=e.DISPLAY_LINE_MAX_LENGTH-v,b=t;if(y<1){let t=`${i}${l}${u}${d}${p}${m}${c}`;if(!g)return s(t);let n=e.DISPLAY_LINE_MAX_LENGTH-(t.length+e.SESSION_OVERRIDE_MARKER_PREFIX.length+e.SESSION_OVERRIDE_MARKER_SUFFIX.length);if(n<2)return s(t);let r=h.length>n?`${h.slice(0,n-1)}…`:h;return`${t}${e.SESSION_OVERRIDE_MARKER_PREFIX}${r}${e.SESSION_OVERRIDE_MARKER_SUFFIX}`}return b.length>y&&(b=y>=2?`${b.slice(0,y-1)}…`:b.slice(0,Math.max(0,y))),`${i}${b} · ${l}${u}${d}${p}${m}${c}${g}`}e.MULTIPLE_SESSION_DECKS_LINE=`◆ Agent Deck · multiple session decks · see chat receipt`;function l(){return e.MULTIPLE_SESSION_DECKS_LINE}e.SESSION_STARTING_LINE=`◆ Agent Deck · session starting`;function u(){return e.SESSION_STARTING_LINE}function d(t,n,r,i){let a=o(n,r,i);if(a===null)return t;let s=`${t}${e.SESSION_OVERRIDE_MARKER_PREFIX}${a}${e.SESSION_OVERRIDE_MARKER_SUFFIX}`;if(s.length<=e.DISPLAY_LINE_MAX_LENGTH)return s;let c=e.DISPLAY_LINE_MAX_LENGTH-(t.length+e.SESSION_OVERRIDE_MARKER_PREFIX.length+e.SESSION_OVERRIDE_MARKER_SUFFIX.length);if(c>=2)return`${t}${e.SESSION_OVERRIDE_MARKER_PREFIX}${a.slice(0,c-1)}…${e.SESSION_OVERRIDE_MARKER_SUFFIX}`;let l=e.DISPLAY_LINE_MAX_LENGTH-(e.SESSION_OVERRIDE_MARKER_PREFIX.length+e.SESSION_OVERRIDE_MARKER_SUFFIX.length+2);if(l<1)return s.slice(0,e.DISPLAY_LINE_MAX_LENGTH);let u=t.length>l?`${t.slice(0,Math.max(0,l-1))}…`:t,d=e.DISPLAY_LINE_MAX_LENGTH-(u.length+e.SESSION_OVERRIDE_MARKER_PREFIX.length+e.SESSION_OVERRIDE_MARKER_SUFFIX.length),f=a.length>d?`${a.slice(0,Math.max(0,d-1))}…`:a;return`${u}${e.SESSION_OVERRIDE_MARKER_PREFIX}${f}${e.SESSION_OVERRIDE_MARKER_SUFFIX}`}function f(e){return r.default.resolve(e.trim())}function p(e){return e.session_id?.trim()||void 0}function m(e,t){let n=e.workspace?.project_dir?.trim();if(n)return f(n);let r=e.cwd?.trim()||e.workspace?.current_dir?.trim()||t?.trim();return r?f(r):void 0}})),Xu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ExportRequestSchema=e.ImportReportSchema=e.ImportReportCountsSchema=e.ImportEntityCountsSchema=e.BundleAnySchema=e.BundleV2Schema=e.BundleDeckV2Schema=e.BundleV1Schema=e.BundleDeckSchema=e.BundlePlaybookSchema=e.BundleServiceSchema=e.BundleScopeSchema=e.BundleV2VersionSchema=e.BundleVersionSchema=e.BundleFormatSchema=void 0;var t=Ru(),n=Uu(),r=Hu();e.BundleFormatSchema=t.z.literal(`agent-deck-bundle`),e.BundleVersionSchema=t.z.literal(1),e.BundleV2VersionSchema=t.z.literal(2),e.BundleScopeSchema=t.z.enum([`collection`,`deck`]),e.BundleServiceSchema=t.z.object({id:t.z.string().min(1),name:t.z.string().min(1),type:t.z.enum([`mcp`,`a2a`,`local-mcp`]),url:t.z.string().min(1),description:t.z.string().optional(),cardColor:t.z.string().optional(),iconUrl:t.z.string().optional(),disabledToolNames:t.z.array(t.z.string()).default([]),headers:t.z.record(t.z.string()).optional(),oauthClientId:t.z.string().optional(),oauthAuthorizationUrl:t.z.string().optional(),oauthTokenUrl:t.z.string().optional(),oauthRedirectUri:t.z.string().optional(),oauthScope:t.z.string().optional(),localCommand:t.z.string().optional(),localArgs:t.z.array(t.z.string()).optional(),localWorkingDir:t.z.string().optional()}).strict(),e.BundlePlaybookSchema=t.z.object({id:r.PlaybookIdSchema,title:t.z.string().min(1),body:t.z.string().default(``),triggers:t.z.array(t.z.string()).default([]),dependsOnServiceIds:t.z.array(t.z.string()).default([]),exec:t.z.string().optional(),skill:t.z.string().optional()}).strict(),e.BundleDeckSchema=t.z.object({id:t.z.string().min(1),name:t.z.string().min(1),serviceIds:t.z.array(t.z.string()).default([]),playbookIds:t.z.array(t.z.string()).default([])}).strip(),e.BundleV1Schema=t.z.object({format:e.BundleFormatSchema,version:e.BundleVersionSchema,exportedAt:t.z.string().datetime(),exportedFrom:t.z.object({agentDeckVersion:t.z.string().min(1)}),scope:e.BundleScopeSchema,services:t.z.array(e.BundleServiceSchema).default([]),playbooks:t.z.array(e.BundlePlaybookSchema).default([]),decks:t.z.array(e.BundleDeckSchema).default([])}).strict(),e.BundleDeckV2Schema=t.z.object({id:t.z.string().min(1),name:t.z.string().min(1),operatingInstructions:n.OperatingInstructionsSchema.default(``),serviceIds:t.z.array(t.z.string()).default([]),playbookIds:t.z.array(t.z.string()).default([])}).strip(),e.BundleV2Schema=t.z.object({format:e.BundleFormatSchema,version:e.BundleV2VersionSchema,exportedAt:t.z.string().datetime(),exportedFrom:t.z.object({agentDeckVersion:t.z.string().min(1)}),scope:e.BundleScopeSchema,services:t.z.array(e.BundleServiceSchema).default([]),playbooks:t.z.array(e.BundlePlaybookSchema).default([]),decks:t.z.array(e.BundleDeckV2Schema).default([])}).strict(),e.BundleAnySchema=t.z.discriminatedUnion(`version`,[e.BundleV1Schema,e.BundleV2Schema]),e.ImportEntityCountsSchema=t.z.object({created:t.z.number().int().min(0),reused:t.z.number().int().min(0)}),e.ImportReportCountsSchema=t.z.object({services:e.ImportEntityCountsSchema,playbooks:e.ImportEntityCountsSchema,decks:e.ImportEntityCountsSchema}),e.ImportReportSchema=t.z.object({status:t.z.enum([`completed`,`failed`,`partial`]),counts:e.ImportReportCountsSchema,servicesNeedingOauth:t.z.array(t.z.string()),warnings:t.z.array(t.z.string()),idMap:t.z.record(t.z.string())}),e.ExportRequestSchema=t.z.object({scope:e.BundleScopeSchema.default(`collection`),deckId:t.z.string().uuid().optional()}).superRefine((e,n)=>{e.scope===`deck`&&!e.deckId&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`deckId is required when scope is deck`,path:[`deckId`]})})})),Zu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StoreCredentialMetaSchema=e.StoreDeckSchema=e.StoreServiceSchema=e.StorePlaybookFileSchema=e.StorePlaybookTriggersSchema=e.StoreManifestSchema=void 0;var t=Ru(),n=Hu(),r=Xu(),i=Uu(),a=Vu();e.StoreManifestSchema=t.z.object({format:t.z.literal(`agent-deck-store`),version:t.z.union([t.z.literal(1),t.z.literal(2)]),migratedFrom:t.z.literal(`sqlite`).optional()}).strict(),e.StorePlaybookTriggersSchema=t.z.array(t.z.string()).transform((e,n)=>{try{return(0,a.normalizeTriggers)(e,{maxCount:null})}catch(e){return n.addIssue({code:t.z.ZodIssueCode.custom,message:e instanceof Error?e.message:`Invalid triggers`}),t.z.NEVER}}).default([]),e.StorePlaybookFileSchema=t.z.object({id:n.PlaybookIdSchema,title:t.z.string().min(1),body:t.z.string().default(``),triggers:e.StorePlaybookTriggersSchema,dependsOnCredentialIds:t.z.array(t.z.string()).default([]),dependsOnServiceIds:t.z.array(t.z.string()).default([]),exec:t.z.string().optional(),skill:t.z.string().optional(),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}).strict(),e.StoreServiceSchema=r.BundleServiceSchema.extend({credentialId:t.z.string().min(1).optional()}),e.StoreDeckSchema=t.z.object({id:t.z.string().uuid(),name:t.z.string().min(1),serviceIds:t.z.array(t.z.string()).default([]),credentialIds:t.z.array(t.z.string()).default([]),playbookIds:t.z.array(t.z.string()).default([]),operatingInstructions:i.OperatingInstructionsSchema.default(``),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}).strict(),e.StoreCredentialMetaSchema=t.z.object({id:t.z.string().min(1),label:t.z.string().min(1),scheme:t.z.enum([`bearer`,`header`,`http_basic_user`]),headerName:t.z.string().nullable().optional(),envName:t.z.string().min(1),tags:t.z.array(t.z.string()).default([]),docsUrl:t.z.string().nullable().optional()}).strict()})),Qu=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BootstrapManifestSchema=e.BootstrapHostCountsSchema=e.BootstrapWorkspaceSchema=e.SessionDigestSchema=e.OutcomeSchema=e.TopFileItemSchema=e.SkillItemSchema=e.ToolItemSchema=e.CommandItemSchema=e.IntentItemSchema=e.FeedbackMomentSchema=e.BootstrapHostSchema=e.OutcomeSignalSchema=e.PolarityHintSchema=void 0;var t=Ru();e.PolarityHintSchema=t.z.enum([`negative`,`positive`,`mixed`,`unknown`]),e.OutcomeSignalSchema=t.z.enum([`pr_opened`,`committed`,`unknown`]),e.BootstrapHostSchema=t.z.enum([`claude`,`cursor`]),e.FeedbackMomentSchema=t.z.object({agentAction:t.z.string().max(400),userReaction:t.z.string().max(600),polarityHint:e.PolarityHintSchema,markers:t.z.array(t.z.string()),followupChange:t.z.string().max(400).nullable().optional(),at:t.z.string().datetime().optional()}).strict(),e.IntentItemSchema=t.z.object({text:t.z.string().max(280),at:t.z.string().datetime().optional()}).strict(),e.CommandItemSchema=t.z.object({command:t.z.string().max(160),count:t.z.number().int().min(1)}).strict(),e.ToolItemSchema=t.z.object({name:t.z.string(),count:t.z.number().int().min(1)}).strict(),e.SkillItemSchema=t.z.object({name:t.z.string(),count:t.z.number().int().min(1)}).strict(),e.TopFileItemSchema=t.z.object({path:t.z.string(),edits:t.z.number().int().min(1)}).strict(),e.OutcomeSchema=t.z.object({signal:e.OutcomeSignalSchema,evidence:t.z.string().optional()}).strict(),e.SessionDigestSchema=t.z.object({schemaVersion:t.z.literal(1),host:e.BootstrapHostSchema.default(`claude`),sessionId:t.z.string(),workspaceRoot:t.z.string(),workspaceLabel:t.z.string().optional(),workspaceSlug:t.z.string().optional(),gitBranch:t.z.string().nullable().optional(),startedAt:t.z.string().datetime(),endedAt:t.z.string().datetime().optional(),durationMinutes:t.z.number().min(0).optional(),turnCount:t.z.number().int().min(0),skippedLineCount:t.z.number().int().min(0).optional(),intents:t.z.array(e.IntentItemSchema).max(40),commands:t.z.array(e.CommandItemSchema).max(40).default([]),tools:t.z.array(e.ToolItemSchema).max(40).default([]),skills:t.z.array(e.SkillItemSchema).max(40).default([]),topFiles:t.z.array(e.TopFileItemSchema).max(20).default([]),feedbackMoments:t.z.array(e.FeedbackMomentSchema).max(30),outcome:e.OutcomeSchema}).strict(),e.BootstrapWorkspaceSchema=t.z.object({workspaceRoot:t.z.string(),label:t.z.string(),workspaceSlug:t.z.string().optional(),sessionCount:t.z.number().int().min(0),digestPaths:t.z.array(t.z.string())}).strict(),e.BootstrapHostCountsSchema=t.z.object({claude:t.z.number().int().min(0),cursor:t.z.number().int().min(0)}).strict(),e.BootstrapManifestSchema=t.z.object({schemaVersion:t.z.literal(1),generatedAt:t.z.string().datetime(),digestDir:t.z.string(),guideRef:t.z.string(),totalSessions:t.z.number().int().min(0),hosts:e.BootstrapHostCountsSchema.default({claude:0,cursor:0}),workspaces:t.z.array(e.BootstrapWorkspaceSchema)}).strict()})),$u=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DeckSwitchResolutionSchema=e.DeckSwitchResolveBodySchema=e.DeckSwitchDecisionSchema=e.RedactedSessionBindingSchema=e.WorkspaceAssignmentSchema=e.WorkspaceV2ManifestSchema=e.WorkspaceGrantManifestSchema=e.RuntimeSessionSchema=e.WorkspaceGrantStatusSchema=e.TrustedSessionErrorCodeSchema=e.AgentSessionModeSchema=void 0,e.trustedSessionError=n,e.httpStatusForTrustedError=r;var t=Ru();e.AgentSessionModeSchema=t.z.enum([`normal`,`agent-admin`]),e.TrustedSessionErrorCodeSchema=t.z.enum([`GRANT_REQUIRED`,`SESSION_INVALID`,`SESSION_REVOKED`,`RESOURCE_OUT_OF_SCOPE`,`ADMIN_REQUIRED`,`DASHBOARD_REQUIRED`,`ADMIN_CHALLENGE_EXPIRED`,`DECK_FIXED`,`SWITCH_APPROVAL_REQUIRED`,`DECK_SWITCH_EXPIRED`,`DECK_SWITCH_CONSUMED`,`RUN_CAPABILITY_REQUIRED`,`FINALIZATION_CAPABILITY_REQUIRED`]),e.WorkspaceGrantStatusSchema=t.z.enum([`pending`,`active`,`revoked`]),e.RuntimeSessionSchema=t.z.object({sessionId:t.z.string(),mcpSessionId:t.z.string().optional(),deckId:t.z.string(),mode:e.AgentSessionModeSchema,lastSeenAt:t.z.string().datetime(),expiresAt:t.z.string().datetime(),adminExpiresAt:t.z.string().datetime().nullable()}).strict(),e.WorkspaceGrantManifestSchema=t.z.object({version:t.z.literal(2),workspaceKey:t.z.string(),grantId:t.z.string(),secret:t.z.string().min(32),deckId:t.z.string(),deckName:t.z.string().optional(),mcpUrl:t.z.string().url().optional(),store:t.z.enum([`file`,`keychain`]).optional(),updatedAt:t.z.string().datetime()}).strict(),e.WorkspaceV2ManifestSchema=e.WorkspaceGrantManifestSchema,e.WorkspaceAssignmentSchema=t.z.object({version:t.z.literal(3),deckId:t.z.string().min(1),deckName:t.z.string().min(1),mcpUrl:t.z.string().url().optional()}).strict(),e.RedactedSessionBindingSchema=t.z.object({sessionId:t.z.string(),deckId:t.z.string(),deckName:t.z.string().optional(),mode:e.AgentSessionModeSchema,expiresAt:t.z.string().datetime(),adminExpiresAt:t.z.string().datetime().nullable().optional(),display_summary:t.z.string().optional()}).strict();function n(e,t){return{success:!1,error:t,error_code:e}}function r(e){switch(e){case`GRANT_REQUIRED`:case`SESSION_INVALID`:case`SESSION_REVOKED`:return 401;case`RESOURCE_OUT_OF_SCOPE`:case`ADMIN_REQUIRED`:case`DASHBOARD_REQUIRED`:case`DECK_FIXED`:case`SWITCH_APPROVAL_REQUIRED`:case`RUN_CAPABILITY_REQUIRED`:case`FINALIZATION_CAPABILITY_REQUIRED`:return 403;case`DECK_SWITCH_CONSUMED`:return 409;case`ADMIN_CHALLENGE_EXPIRED`:case`DECK_SWITCH_EXPIRED`:return 410;default:return 500}}e.DeckSwitchDecisionSchema=t.z.enum([`session`,`workspace-default`,`decline`]),e.DeckSwitchResolveBodySchema=t.z.object({runtimeSessionId:t.z.string().min(1),decision:e.DeckSwitchDecisionSchema}).strict(),e.DeckSwitchResolutionSchema=t.z.object({requestId:t.z.string(),decision:e.DeckSwitchDecisionSchema,status:t.z.enum([`consumed`,`declined`]),deckId:t.z.string().optional(),deckName:t.z.string().optional(),workspaceRoot:t.z.string().optional()}).strict()})),ed=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CARD_USAGE_CATEGORIES=e.CARD_USAGE_CARD_TYPES=void 0,e.isValidCorrelationId=r,e.normalizeCorrelationId=i,e.normalizeHostSessionId=a,e.CARD_USAGE_CARD_TYPES=[`service`,`credential`,`playbook`];var t=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,n=/^[A-Za-z0-9_-]{8,128}$/;function r(e){return t.test(e)||n.test(e)}function i(e){if(typeof e!=`string`)return null;let t=e.trim();return!t||!r(t)?null:t}function a(e){return i(e)}e.CARD_USAGE_CATEGORIES=[`popular`,`used`,`unused`,`new`]})),td=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AgentRunErrorCodeSchema=e.FinalizeAgentRunResponseSchema=e.FinalizeAgentRunRequestSchema=e.AgentRunChangesResponseSchema=e.FinalizationManifestEntrySchema=e.FinalizationFileModeSchema=e.FINALIZATION_REVIEW_ID_MAX_CHARS=e.FINALIZATION_COMMIT_MESSAGE_MAX_CHARS=e.FINALIZATION_PATH_MAX_CHARS=e.FINALIZATION_MANIFEST_MAX_FILES=e.AgentRunCapabilitiesResponseSchema=e.AgentRunClientCapabilitySchema=e.SessionAgentRunResponseSchema=e.AgentRunEventsResponseSchema=e.AgentRunEventsQuerySchema=e.AgentRunEventSchema=e.AgentRunStatusSchema=e.AgentRunFinalizationStatusSchema=e.FinalizationStateSchema=e.FinalizationBaselineRefSchema=e.Sha256HexSchema=e.GitObjectIdSchema=e.CreateAgentRunResponseSchema=e.AGENT_RUN_TERMINAL_STATES=e.AgentRunStateSchema=e.AGENT_RUN_WORKSPACE_REQUIRED_MESSAGE=e.StartSessionAgentRunRequestSchema=e.CreateAgentRunRequestSchema=e.AgentRunIdempotencyKeySchema=e.AgentRunIdSchema=e.AgentRunToolsSchema=e.AgentRunClientSchema=e.AGENT_RUN_EVENTS_MAX_LIMIT=e.AGENT_RUN_EVENTS_DEFAULT_LIMIT=e.AGENT_RUN_IDEMPOTENCY_HEADER=e.AGENT_RUN_REQUEST_BODY_LIMIT_BYTES=e.AGENT_RUN_PROMPT_MAX_CHARS=void 0,e.agentRunError=i;var t=Ru();e.AGENT_RUN_PROMPT_MAX_CHARS=65536,e.AGENT_RUN_REQUEST_BODY_LIMIT_BYTES=262144,e.AGENT_RUN_IDEMPOTENCY_HEADER=`idempotency-key`,e.AGENT_RUN_EVENTS_DEFAULT_LIMIT=200,e.AGENT_RUN_EVENTS_MAX_LIMIT=1e3,e.AgentRunClientSchema=t.z.enum([`claude`,`codex`,`cursor`,`muse`]),e.AgentRunToolsSchema=t.z.enum([`readonly`,`edit`]),e.AgentRunIdSchema=t.z.string().regex(/^run-\d{8}T\d{6}-[0-9a-f]{6}$/),e.AgentRunIdempotencyKeySchema=t.z.string().min(1).max(200).regex(/^[\x21-\x7e]+$/,`Idempotency-Key must be printable ASCII without spaces`);function n(e){return e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)}e.CreateAgentRunRequestSchema=t.z.object({deckId:t.z.string().min(1).max(200),client:e.AgentRunClientSchema,cwd:t.z.string().min(1).max(4096).refine(n,`cwd must be an absolute path on the Agent Deck host`),prompt:t.z.string().max(e.AGENT_RUN_PROMPT_MAX_CHARS).refine(e=>e.trim().length>0,`prompt must not be empty`),tools:e.AgentRunToolsSchema.default(`readonly`),resumeSessionId:t.z.string().min(1).max(512).optional(),prepareFinalization:t.z.boolean().default(!1)}).strict(),e.StartSessionAgentRunRequestSchema=t.z.object({client:e.AgentRunClientSchema,prompt:t.z.string().max(e.AGENT_RUN_PROMPT_MAX_CHARS).refine(e=>e.trim().length>0,`prompt must not be empty`),tools:e.AgentRunToolsSchema.default(`readonly`),resumeSessionId:t.z.string().min(1).max(512).optional(),prepareFinalization:t.z.boolean().default(!1),playbookVersion:t.z.object({playbookId:t.z.string().min(1).max(200),versionId:t.z.string().min(1).max(200)}).strict().optional()}).strict(),e.AGENT_RUN_WORKSPACE_REQUIRED_MESSAGE=`This MCP session was launched without a host execution workspace, so start_run has nowhere to run and the agent cannot choose one. The launcher that started this session (for example Agent Dealer) must provide its workspace when it launches the session.`,e.AgentRunStateSchema=t.z.enum([`starting`,`running`,`ended`,`error`,`died`,`canceled`]),e.AGENT_RUN_TERMINAL_STATES=[`ended`,`error`,`died`,`canceled`],e.CreateAgentRunResponseSchema=t.z.object({runId:e.AgentRunIdSchema,state:e.AgentRunStateSchema}).strict(),e.GitObjectIdSchema=t.z.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),e.Sha256HexSchema=t.z.string().regex(/^[0-9a-f]{64}$/),e.FinalizationBaselineRefSchema=t.z.string().regex(/^bl_[0-9a-f]{24}$/),e.FinalizationStateSchema=t.z.enum([`prepared`,`finalizing`,`finalized`]),e.AgentRunFinalizationStatusSchema=t.z.object({baselineRef:e.FinalizationBaselineRefSchema,baselineDigest:e.Sha256HexSchema,state:e.FinalizationStateSchema,commit:e.GitObjectIdSchema.nullable()}).strict(),e.AgentRunStatusSchema=t.z.object({runId:e.AgentRunIdSchema,deckId:t.z.string(),client:e.AgentRunClientSchema,tools:e.AgentRunToolsSchema,state:e.AgentRunStateSchema,sessionId:t.z.string().nullable(),startedAt:t.z.string(),lastEventAt:t.z.string().nullable(),finalization:e.AgentRunFinalizationStatusSchema.nullable()}).strict();var r={seq:t.z.number().int().positive(),ts:t.z.string()};e.AgentRunEventSchema=t.z.discriminatedUnion(`type`,[t.z.object({...r,type:t.z.literal(`text`),text:t.z.string()}).strict(),t.z.object({...r,type:t.z.literal(`tool`),name:t.z.string()}).strict(),t.z.object({...r,type:t.z.literal(`notice`),message:t.z.string(),sessionId:t.z.string().nullable()}).strict(),t.z.object({...r,type:t.z.literal(`result`),subtype:t.z.string(),result:t.z.unknown(),sessionId:t.z.string().nullable()}).strict(),t.z.object({...r,type:t.z.literal(`end`),sessionId:t.z.string().nullable()}).strict(),t.z.object({...r,type:t.z.literal(`error`),message:t.z.string(),sessionId:t.z.string().nullable()}).strict(),t.z.object({...r,type:t.z.literal(`canceled`),sessionId:t.z.string().nullable()}).strict()]),e.AgentRunEventsQuerySchema=t.z.object({after:t.z.string().regex(/^\d+$/).optional(),limit:t.z.coerce.number().int().min(1).max(e.AGENT_RUN_EVENTS_MAX_LIMIT).optional()}).strict(),e.AgentRunEventsResponseSchema=t.z.object({runId:e.AgentRunIdSchema,state:e.AgentRunStateSchema,events:t.z.array(e.AgentRunEventSchema),nextCursor:t.z.string()}).strict(),e.SessionAgentRunResponseSchema=e.AgentRunStatusSchema.extend({events:t.z.array(e.AgentRunEventSchema),nextCursor:t.z.string()}).strict(),e.AgentRunClientCapabilitySchema=t.z.object({client:e.AgentRunClientSchema,start:t.z.array(e.AgentRunToolsSchema),resume:t.z.array(e.AgentRunToolsSchema),resumeRequires:t.z.enum([`none`,`same_profile_provenance`])}).strict(),e.AgentRunCapabilitiesResponseSchema=t.z.object({host:t.z.literal(`same-host`),clients:t.z.array(e.AgentRunClientCapabilitySchema)}).strict(),e.FINALIZATION_MANIFEST_MAX_FILES=1e3,e.FINALIZATION_PATH_MAX_CHARS=1024,e.FINALIZATION_COMMIT_MESSAGE_MAX_CHARS=8192,e.FINALIZATION_REVIEW_ID_MAX_CHARS=200,e.FinalizationFileModeSchema=t.z.enum([`100644`,`100755`]),e.FinalizationManifestEntrySchema=t.z.object({path:t.z.string().min(1).max(e.FINALIZATION_PATH_MAX_CHARS),sha256:e.Sha256HexSchema.nullable(),mode:e.FinalizationFileModeSchema.nullable()}).strict().refine(e=>e.sha256===null==(e.mode===null),{message:`sha256 and mode are both null (deleted) or both set`}),e.AgentRunChangesResponseSchema=t.z.object({runId:e.AgentRunIdSchema,baselineRef:e.FinalizationBaselineRefSchema,baselineDigest:e.Sha256HexSchema,baseCommit:e.GitObjectIdSchema,files:t.z.array(e.FinalizationManifestEntrySchema),manifestDigest:e.Sha256HexSchema}).strict(),e.FinalizeAgentRunRequestSchema=t.z.object({baselineDigest:e.Sha256HexSchema,expectedBaseCommit:e.GitObjectIdSchema,reviewId:t.z.string().min(1).max(e.FINALIZATION_REVIEW_ID_MAX_CHARS).regex(/^[\x21-\x7e]+$/,`reviewId must be printable ASCII without spaces`),commitMessage:t.z.string().max(e.FINALIZATION_COMMIT_MESSAGE_MAX_CHARS).refine(e=>e.trim().length>0,`commitMessage must not be empty`).refine(e=>!e.includes(`\0`),`commitMessage must not contain NUL`),files:t.z.array(e.FinalizationManifestEntrySchema).min(1).max(e.FINALIZATION_MANIFEST_MAX_FILES)}).strict(),e.FinalizeAgentRunResponseSchema=t.z.object({runId:e.AgentRunIdSchema,finalizationState:t.z.literal(`finalized`),commit:e.GitObjectIdSchema,tree:e.GitObjectIdSchema,parent:e.GitObjectIdSchema,manifestDigest:e.Sha256HexSchema,fileCount:t.z.number().int().positive(),reviewId:t.z.string()}).strict(),e.AgentRunErrorCodeSchema=t.z.enum(`INVALID_REQUEST.REQUEST_TOO_LARGE.IDEMPOTENCY_KEY_REQUIRED.IDEMPOTENCY_CONFLICT.DECK_NOT_FOUND.WORKSPACE_INVALID.WORKSPACE_MISMATCH.WORKSPACE_REQUIRED.CLIENT_UNAVAILABLE.PROFILE_UNSUPPORTED.RESUME_UNVERIFIED.RUN_NOT_FOUND.RUN_NOT_CANCELABLE.FINALIZATION_INVALID.FINALIZATION_NOT_PREPARED.RUN_NOT_TERMINAL.BASE_MISMATCH.INDEX_DIRTY.BASELINE_MISMATCH.PATH_INVALID.PATH_UNEXPECTED.DIGEST_MISMATCH.GIT_LOCK_CONFLICT.REF_RACE.FINALIZATION_CANCELED.FINALIZATION_FAILED`.split(`.`));function i(e,t){return{success:!1,error:t,error_code:e}}})),nd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generateId=n,e.generateShortId=r,e.isValidUUID=i;var t=Ju();function n(){return(0,t.randomUUID)()}function r(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}function i(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}})),rd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.normalizePlaybookPin=r,e.formatPlaybookPin=i;var t=nd(),n=/^pb_[a-z0-9_]+$/;function r(e){if(typeof e!=`string`)return null;let r=e.trim();if(!r)return null;let i=r.indexOf(`=`);if(i===-1||r.indexOf(`=`,i+1)!==-1)return null;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();return!n.test(a)||!(0,t.isValidUUID)(o)?null:{playbookId:a,versionId:o}}function i(e){return`${e.playbookId}=${e.versionId}`}})),id=s((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),ad=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatZodError=t,e.isValidUrl=n,e.isValidHexColor=r,e.sanitizeHeaders=i;function t(e){return e.errors.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`, `)}function n(e){try{return new URL(e),!0}catch{return!1}}function r(e){return/^#[0-9A-F]{6}$/i.test(e)}function i(e){let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&r.trim()&&(t[n.trim()]=r.trim());return t}})),od=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.toSnakeCase=t,e.toCamelCase=n,e.convertToSnakeCase=r,e.convertToCamelCase=i,e.serializeForDatabase=a,e.deserializeFromDatabase=o;function t(e){return e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}function n(e){return e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase())}function r(e){let n={};for(let[r,i]of Object.entries(e)){let e=t(r);n[e]=i}return n}function i(e){let t={};for(let[r,i]of Object.entries(e)){let e=n(r);t[e]=i}return t}function a(e){let n={};for(let[r,i]of Object.entries(e))i!=null&&(typeof i==`object`&&!Array.isArray(i)?n[t(r)]=JSON.stringify(i):n[t(r)]=i);return n}function o(e){let t={};for(let[r,i]of Object.entries(e)){let e=n(r);if(typeof i==`string`&&(i.startsWith(`{`)||i.startsWith(`[`)))try{t[e]=JSON.parse(i)}catch{t[e]=i}else t[e]=i}return t}})),sd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.slugifyCredentialLabel=t,e.deriveEnvNameFromLabel=n,e.deriveCredentialIdFromLabel=r,e.deriveCredentialDefaults=i;function t(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40)||`connection`}function n(e){let n=t(e).toUpperCase();return n.endsWith(`_API_KEY`)?n:(n.endsWith(`_API`)&&(n=n.slice(0,-4)),`${n}_API_KEY`)}function r(e){return`cred_${t(e)}`}function i(e,t){let i=e.trim();return{id:t?.id??r(i),label:i,scheme:t?.scheme??`bearer`,envName:t?.envName??n(i),tags:t?.tags??[]}}})),cd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.slugifyPlaybookTitle=t,e.derivePlaybookIdFromTitle=n,e.derivePlaybookDefaults=r;function t(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/_+/g,`_`).slice(0,48)}function n(e){return`pb_${t(e)||`playbook`}`}function r(e,t){let r=e.trim();return{title:r,id:t?.id??n(r)}}})),ld=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.buildPlaybookSearchText=o,e.detectPlaybookDependencies=s;var t=/\bcred_[a-z0-9_]+\b/g,n=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,r=/--connections(?:=|\s+)([^\s]+)/g;function i(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function a(e,t){let n=t.trim();return n?RegExp(`\\b${i(n)}\\b`,`i`).test(e):!1}function o(e){return[e.title??``,e.body??``,e.exec??``,e.skill??``,...e.triggers??[]].join(`
33
33
  `)}function s(e,i,o={}){let s=new Set(o.credentialIds??[]),c=new Set(o.serviceIds??[]),l=new Set(i.credentials.map(e=>e.id)),u=new Map(i.services.map(e=>[e.id.toLowerCase(),e.id]));for(let n of e.matchAll(t)){let e=n[0];l.has(e)&&s.add(e)}for(let t of e.matchAll(r))for(let e of t[1].split(`,`)){let t=e.trim();l.has(t)&&s.add(t)}for(let t of i.credentials)t.envName&&e.includes(t.envName)&&s.add(t.id),a(e,t.label)&&s.add(t.id);for(let t of e.matchAll(n)){let e=u.get(t[0].toLowerCase());e&&c.add(e)}for(let t of i.services)a(e,t.name)&&c.add(t.id);return{dependsOnCredentialIds:[...s].sort(),dependsOnServiceIds:[...c].sort()}}})),ud=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.serviceHasOAuthToken=n,e.isOAuthSessionValid=r,e.isOAuthAccessTokenExpired=i;var t=dd();function n(e){return!!(e.oauthHasToken||e.oauthAccessToken)}function r(e){return n(e)?!(0,t.isOAuthTokenExpiringSoon)(e.oauthTokenExpiresAt):!1}function i(e,t=3e5){return n(e)?e.oauthTokenExpiresAt?new Date(e.oauthTokenExpiresAt).getTime()<=Date.now()+t:!1:!0}})),dd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isOAuthTokenExpiringSoon=r,e.getServiceWarnings=o,e.getCredentialWarnings=s,e.getPlaybookWarnings=c,e.buildCollectionCatalog=l,e.summarizeCollectionWarnings=u,e.primaryCollectionWarning=d;var t=ud(),n=3e5;function r(e){return e?new Date(e).getTime()<=Date.now()+n:!1}function i(e){return!!(e.oauthClientId||e.oauthAuthorizationUrl||e.oauthTokenUrl)}function a(e){return(0,t.isOAuthSessionValid)(e)}function o(e,n={}){let r=[];if(e.health===`unhealthy`){let t=e.type===`mcp`&&a(e);r.push({kind:`service_unhealthy`,message:t?`OAuth OK but MCP unreachable — for Slack, enable MCP under Agents & AI Apps in your app settings`:`Service reported unhealthy`,severity:`warning`})}if(e.type!==`mcp`||a(e)||!(n.oauthRequired===!0||i(e)))return r;if(!(e.oauthHasToken||e.oauthAccessToken))return r.push({kind:`oauth_required`,message:`OAuth authentication required`,severity:`error`}),r;if(!(0,t.isOAuthSessionValid)(e)){if(n.hasRefreshToken)return r;r.push({kind:`oauth_expired`,message:`OAuth token expired — re-authenticate`,severity:`error`})}return r}function s(e){return e.hasSecret?[]:[{kind:`credential_missing_secret`,message:`Key missing from vault — open to add or rotate`,severity:`error`}]}function c(e,t){let n=e.dependsOnCredentialIds.filter(e=>!t.credentialIds.has(e)),r=e.dependsOnServiceIds.filter(e=>!t.serviceIds.has(e)),i=n.length+r.length;return i===0?[]:[{kind:`playbook_missing_deps`,message:`${i} missing dependency reference${i===1?``:`s`}`,severity:`warning`}]}function l(e,t){return{credentialIds:new Set(e.map(e=>e.id)),serviceIds:new Set(t.map(e=>e.id))}}function u(e,t,n,r={}){let i=l(t,e),a=new Map,u=new Map,d=new Map,f={oauth_required:0,oauth_expired:0,service_unhealthy:0,credential_missing_secret:0,playbook_missing_deps:0};for(let t of e){let e=o(t,r[t.id]);if(e.length>0){a.set(t.id,e);for(let t of e)f[t.kind]+=1}}for(let e of t){let t=s(e);if(t.length>0){u.set(e.id,t);for(let e of t)f[e.kind]+=1}}for(let e of n){let t=c(e,i);if(t.length>0){d.set(e.id,t);for(let e of t)f[e.kind]+=1}}return{total:a.size+u.size+d.size,byKind:f,serviceWarnings:a,credentialWarnings:u,playbookWarnings:d}}function d(e){if(e?.length)return e.find(e=>e.severity===`error`)??e[0]}})),fd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.stripJsonMarkdownFences=i,e.normalizeLocalMcpManifestInput=a,e.parseLocalMcpManifestJson=o;function t(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function n(e){return t(e)&&typeof e.command==`string`}function r(e){return!t(e)||Object.keys(e).length===0?!1:Object.values(e).every(n)}function i(e){let t=e.trim();return t.startsWith("```")?t.replace(/^```(?:json)?\s*\n?/i,``).replace(/\n?```\s*$/,``).trim():t}function a(e){if(!t(e))throw Error(`Configuration must be a JSON object`);if(t(e.config)&&r(e.config.mcpServers))return{mcpServers:e.config.mcpServers};if(r(e.mcpServers))return{mcpServers:e.mcpServers};if(t(e)&&typeof e.command==`string`){let t=typeof e.name==`string`&&e.name.trim()?e.name.trim():`local-server`,{name:r,...i}=e;if(!n(i))throw Error(`Missing or invalid command`);return{mcpServers:{[t]:i}}}if(r(e))return{mcpServers:e};throw Error(`Invalid configuration: expected a top-level "mcpServers" object. Example:
34
34
  {
35
35
  "mcpServers": {
@@ -8,7 +8,7 @@
8
8
  <link rel="preconnect" href="https://fonts.googleapis.com">
9
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
10
  <link href="https://fonts.googleapis.com/css2?family=Architects+Daughter&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Fira+Code:wght@300..700&family=Geist+Mono:wght@100..900&family=Geist:wght@100..900&family=IBM+Plex+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&family=IBM+Plex+Sans:ital,wght@0,100..700;1,100..700&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Lora:ital,wght@0,400..700;1,400..700&family=Merriweather:ital,opsz,wght@0,18..144,300..900;1,18..144,300..900&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Outfit:wght@100..900&family=Oxanium:wght@200..800&family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Roboto:ital,wght@0,100..900;1,100..900&family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&family=Space+Grotesk:wght@300..700&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
11
- <script type="module" crossorigin src="/assets/index-BSYloDBW.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-Bbu6K9ON.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-BKJkKaDa.css">
13
13
  </head>
14
14
  <body>