oh-my-agent 14.7.2 → 14.7.3

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 (2) hide show
  1. package/bin/cli.js +2 -2
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -24,7 +24,7 @@ Expecting one of '${r.join("', '")}'`);if(this._lifeCycleHooks[e])this._lifeCycl
24
24
  `),this.outputHelp({error:!0});let r=t||{},n=r.exitCode||1,i=r.code||"commander.error";this._exit(n,i,e)}_parseOptionsEnv(){this.options.forEach((e)=>{if(e.envVar&&e.envVar in lr.env){let t=e.attributeName();if(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))if(e.required||e.optional)this.emit(`optionEnv:${e.name()}`,lr.env[e.envVar]);else this.emit(`optionEnv:${e.name()}`)}})}_parseOptionsImplied(){let e=new WL(this.options),t=(r)=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r));this.options.filter((r)=>r.implied!==void 0&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach((r)=>{Object.keys(r.implied).filter((n)=>!t(n)).forEach((n)=>{this.setOptionValueWithSource(n,r.implied[n],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let r=(o)=>{let s=o.attributeName(),a=this.getOptionValue(s),c=this.options.find((u)=>u.negate&&s===u.attributeName()),l=this.options.find((u)=>!u.negate&&s===u.attributeName());if(c&&(c.presetArg===void 0&&a===!1||c.presetArg!==void 0&&a===c.presetArg))return c;return l||o},n=(o)=>{let s=r(o),a=s.attributeName();if(this.getOptionValueSource(a)==="env")return`environment variable '${s.envVar}'`;return`option '${s.flags}'`},i=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],i=this;do{let o=i.createHelp().visibleOptions(i).filter((s)=>s.long).map((s)=>s.long);n=n.concat(o),i=i.parent}while(i&&!i._enablePositionalOptions);t=qL(e,n)}let r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,r=t===1?"":"s",n=e.length,i=this.parent?` for '${this.name()}'`:"",o=e.join(", "),s=`error: too many arguments${i}. Expected ${t} argument${r} but got ${n}: ${o}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach((i)=>{if(n.push(i.name()),i.alias())n.push(i.alias())}),t=qL(e,n)}let r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";let n=this.createOption(t,r);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}
25
25
  `),this._exit(0,"commander.version",e)}),this}description(e,t){if(e===void 0&&t===void 0)return this._description;if(this._description=e,t)this._argsDescription=t;return this}summary(e){if(e===void 0)return this._summary;return this._summary=e,this}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)t=this.commands[this.commands.length-1];if(e===t._name)throw Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(e);if(r){let n=[r.name()].concat(r.aliases()).join("|");throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${n}'`)}return t._aliases.push(e),this}aliases(e){if(e===void 0)return this._aliases;return e.forEach((t)=>this.alias(t)),this}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map((r)=>iA(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){if(e===void 0)return this._name;return this._name=e,this}helpGroup(e){if(e===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=e,this}commandsGroup(e){if(e===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=e,this}optionsGroup(e){if(e===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=e,this}_initOptionGroup(e){if(this._defaultOptionGroup&&!e.helpGroupHeading)e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){if(this._defaultCommandGroup&&!e.helpGroup())e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=ll.basename(e,ll.extname(e)),this}executableDir(e){if(e===void 0)return this._executableDir;return this._executableDir=e,this}helpInformation(e){let t=this.createHelp(),r=this._getOutputContext(e);t.prepareContext({error:r.error,helpWidth:r.helpWidth,outputHasColors:r.hasColors});let n=t.formatHelp(this,t);if(r.hasColors)return n;return this._outputConfiguration.stripColor(n)}_getOutputContext(e){e=e||{};let t=!!e.error,r,n,i;if(t)r=(s)=>this._outputConfiguration.writeErr(s),n=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth();else r=(s)=>this._outputConfiguration.writeOut(s),n=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth();return{error:t,write:(s)=>{if(!n)s=this._outputConfiguration.stripColor(s);return r(s)},hasColors:n,helpWidth:i}}outputHelp(e){let t;if(typeof e==="function")t=e,e=void 0;let r=this._getOutputContext(e),n={error:r.error,write:r.write,command:this};this._getCommandAndAncestors().reverse().forEach((o)=>o.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let i=this.helpInformation({error:r.error});if(t){if(i=t(i),typeof i!=="string"&&!Buffer.isBuffer(i))throw Error("outputHelp callback must return a string or a Buffer")}if(r.write(i),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",n),this._getCommandAndAncestors().forEach((o)=>o.emit("afterAllHelp",n))}helpOption(e,t){if(typeof e==="boolean"){if(e){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),e||t)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(lr.exitCode??0);if(t===0&&e&&typeof e!=="function"&&e.error)t=1;this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${r.join("', '")}'`);let n=`${e}Help`;return this.on(n,(i)=>{let o;if(typeof t==="function")o=t({error:i.error,command:i.command});else o=t;if(o)i.write(`${o}
27
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();if(t&&e.find((n)=>t.is(n)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}});var mdr;var i9=g(()=>{oA();jse();n9();HL();VL();mdr=new X5});var o9;var JL=g(()=>{o9={name:"oh-my-agent",version:"14.7.2",description:"Portable multi-agent harness for .agents-based skills and workflows across Antigravity, Claude Code, Codex, OpenCode, and more",type:"module",bin:{"oh-my-agent":"./bin/cli.js",oma:"./bin/cli.js"},files:["bin"],keywords:["oh-my-agent","antigravity",".agents","agent","skills","agent-skills","multi-agent","orchestrator","claude","claude-code","codex","opencode","copilot","cursor","chatgpt","pm","frontend","backend","mobile","qa","debug","terraform","database","workflow","bug-fixing"],author:"our.first.fluke <our.first.fluke@gmail.com>",contributors:["gracefullight <gracefullight.dev@gmail.com>","gahyun-git <go4it.gh@gmail.com>"],license:"MIT",funding:[{type:"github",url:"https://github.com/sponsors/first-fluke"},{type:"buymeacoffee",url:"https://buymeacoffee.com/firstfluke"}],scripts:{"sync:readme":"node ./scripts/sync-readme.mjs","generate:skill-data":"node ./scripts/generate-skill-data.mjs",build:"bun run generate:skill-data && bun run sync:readme && bun build cli.ts --outfile bin/cli.js --target node --minify --external @napi-rs/keyring --external jsonc-parser && bun run check:bundle",dev:"bun run generate:skill-data && bun run cli.ts",lint:"biome check .","lint:fix":"biome check --write --unsafe .","check:boundaries":"node ./scripts/check-boundaries.mjs","check:bundle":"node ./scripts/check-bundle.mjs","check:emit-drift":"node ./scripts/check-emit-drift.mjs",test:"vitest run","test:coverage":"vitest run --coverage",prepublishOnly:"bun run build"},dependencies:{"@clack/prompts":"^1.7.0","@date-fns/tz":"^1.5.0","@napi-rs/keyring":"^1.3.0",axios:"^1.18.1","better-sqlite3":"^13.0.2",chokidar:"^5.0.0",commander:"^15.0.0","date-fns":"^4.4.0",eld:"^2.0.3","fast-xml-parser":"^5.10.1","jsonc-parser":"^3.3.1",minimatch:"^10.2.6","p-map":"^7.0.6",picocolors:"^1.1.1","puppeteer-core":"^25.4.0",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-parse":"^11.0.0","smol-toml":"^1.7.1",unified:"^11.0.5",ws:"^8.21.1",yaml:"^2.9.0",zod:"^4.4.3"},optionalDependencies:{pptxgenjs:"^4.0.1"},devDependencies:{"@biomejs/biome":"^2.5.6","@types/better-sqlite3":"^7.6.13","@types/mdast":"^4.0.4","@types/node":"^26.1.2","@types/ws":"^8.18.1","@vitest/coverage-v8":"^4.1.10",typescript:"^7.0.2",vitest:"^4.1.10"},repository:{type:"git",url:"https://github.com/first-fluke/oh-my-agent"},homepage:"https://firstfluke.com/oh-my-agent",bugs:{url:"https://github.com/first-fluke/oh-my-agent/issues"},antigravity:{skillsPath:".agents/skills",skills:["oma-architecture","oma-brainstorm","oma-coordination","oma-pm","oma-frontend","oma-backend","oma-db","oma-mobile","oma-qa","oma-debug","oma-orchestration","oma-dev-workflow","oma-tf-infra","oma-scm","oma-pdf","oma-recap"]}}});import*as $f from"node:fs";import{homedir as dit}from"node:os";import*as s9 from"node:path";function Nse(e){if(cA)throw Error("install context already set in this process");cA=e}function Fse(){if(cA===null)throw Error("install context not set — entry point must call setInstallContext()");return cA}function ul(){return Fse().installRoot}function Ri(){return Fse().mode}function Z5(){try{return Ri()}catch{return"project"}}function Cf(){try{return ul()}catch{return process.cwd()}}function zse(e){let t=process.env.OMA_HOME,r=e.global===!0||process.env.OMA_INSTALL_GLOBAL==="1";if(t!==void 0&&t!=="")return pit(t),{installRoot:t,mode:r?"global":"project"};if(r)return{installRoot:dit(),mode:"global"};return{installRoot:process.cwd(),mode:"project"}}function pit(e){if(!s9.isAbsolute(e))throw Error("OMA_HOME must be absolute path");for(let r of Mse)if(e===r||e.startsWith(r+s9.sep))throw Error(`OMA_HOME=${e} is forbidden (system path ${r})`);let t;try{t=$f.realpathSync(e)}catch(r){let n=r instanceof Error?r.message:String(r);throw Error(`OMA_HOME=${e}: ${n}`)}for(let r of Mse)if(t===r||t.startsWith(r+s9.sep))throw Error(`OMA_HOME=${t} is forbidden (system path ${r})`);try{$f.accessSync(t,$f.constants.W_OK)}catch{throw Error(`OMA_HOME=${t} is not writable`)}}var cA=null,Mse;var Ga=g(()=>{Mse=["/etc","/usr","/bin","/boot","/sys","/proc"]});import{join as fit}from"node:path";function wd(e){return e.endsWith("/")?e:`${e}/`}function ta(e,t){let r=t.split("/").filter((n)=>n.length>0);return fit(e,...r)}var J2=".agents",lA,On,U4,kdr,wdr,Adr,mit=".antigravitycli",Bse,hit=".migration-backup",git="docs/plans",yit=".qwen/tmp",vit,bit,kit,wit,Ait,xit,Sit,YL;var Ii=g(()=>{lA=`${J2}/skills`,On=`${J2}/results`,U4=`${J2}/state`,kdr=`${U4}/sessions`,wdr=`${U4}/retry`,Adr=`${U4}/archive`,Bse=`${J2}/backup`;vit=wd(On),bit=wd(U4),kit=wd(mit),wit=wd(Bse),Ait=wd(hit),xit=wd(git),Sit=wd(yit),YL=[".agents/oma-config.local.cue",".agents/oma-config.local.yaml",kit,vit,bit,wit,xit,Ait,Sit]});var ln="first-fluke/oh-my-agent",ur,Y2,XL,Eit,$it,Q5,Vr;var X2=g(()=>{Ii();ur=lA,Y2=["antigravity","claude","codex","commandcode","cursor","grok","kimi","kiro","qwen"],XL=["pi","opencode"],Eit=["copilot","hermes"],$it=["zcode"],Q5=[...Y2,...XL,...Eit,...$it].sort(),Vr={antigravity:{projectPath:".gemini/antigravity-cli/skills",homePath:".gemini/antigravity-cli/skills",requiresHomeConsent:!0},claude:{projectPath:".claude/skills",homePath:".claude/skills"},codex:{projectPath:".codex/skills",homePath:".codex/skills"},commandcode:{projectPath:".commandcode/skills",homePath:".commandcode/skills",optIn:!0},copilot:{projectPath:".github/skills",homePath:".copilot/skills"},cursor:{projectPath:".cursor/skills",homePath:".cursor/skills"},hermes:{projectPath:".hermes/skills/oma",homePath:".hermes/skills/oma",requiresHomeConsent:!0},kimi:{projectPath:".kimi-code/skills",homePath:".kimi-code/skills",requiresHomeConsent:!0,optIn:!0},kiro:{projectPath:".kiro/skills",homePath:".kiro/skills",optIn:!0},opencode:{projectPath:".opencode/skills",homePath:".opencode/skills"},qwen:{projectPath:".qwen/skills",homePath:".qwen/skills"}}});function Ae(e,t="Output as JSON"){return e.option("--json",t).option("--output <format>","Output format (text/json)",(r)=>{let n=r.trim().toLowerCase();if(!a9.includes(n))throw Error(`Invalid output format: ${r}. Expected one of ${a9.join(", ")}`);return n})}function Cit(e){if(e?.json)return"json";let t=e?.output?.trim().toLowerCase();if(t&&a9.includes(t))return t;if(process.env[Hse]?.trim().toLowerCase()==="json")return"json";return"text"}function ke(e){return Cit(e)==="json"}function Wse(e){let t=e.at(-1);return t instanceof X5?t:null}function _it(e){let t=Wse(e);if(t)return t.opts();let r=e.at(-1);return r&&typeof r==="object"?r:{}}function Pit(e){if(e instanceof Error)return e.message;return String(e)}function G4(e){throw Error(e)}function QL(e,t){for(let r of e){let n=r.charCodeAt(0);if(n>=0&&n<=31||n===127)G4(`${t} must not contain control characters`)}}function Tit(e,t){if(QL(e,t),/[?#%]/.test(e))G4(`${t} must not contain ?, #, or %`);if(e.includes(".."))G4(`${t} must not contain '..'`)}function Rit(e,t){QL(e,t);try{new URL(e)}catch{G4(`${t} must be a valid absolute URL`)}}function ZL(e,t,r="text"){if(typeof e==="string"){if(r==="identifier"){Tit(e,t);return}if(r==="url"){Rit(e,t);return}QL(e,t);return}if(Array.isArray(e))for(let[n,i]of e.entries())ZL(i,`${t}[${n}]`,r)}function Gse(e){let t=e.toLowerCase();if(t==="url"||t.endsWith("url"))return"url";if(t.includes("id")||t.includes("type")||t.includes("vendor")||t.includes("session"))return"identifier";return"text"}function Iit(e){let t=e.vendor;if(typeof t==="string"){if(t.split(",").map((o)=>o.trim()).filter(Boolean).filter((o)=>!Q5.includes(o)).length>0)G4(`vendor must be one of ${Q5.join(", ")}`)}let r=e.output;if(typeof r==="string"&&!a9.includes(r))G4(`output must be one of ${a9.join(", ")}`)}function Oit(e){let t=e.processedArgs??e.args??[];(e.registeredArguments??[]).forEach((i,o)=>{let s=i.name?.()||String(o),a=t[o];if(ZL(a,s,Gse(s)),s==="agent-type"&&typeof a==="string"&&!Use.includes(a))G4(`agent-type must be one of ${Use.join(", ")}`)});let n=e.opts();Iit(n);for(let[i,o]of Object.entries(n))ZL(o,i,Gse(i))}function Dit(e){return(e.registeredArguments??[]).map((t)=>({name:t.name?.()||"",required:!!t.required,variadic:!!t.variadic}))}function Lit(e){return e.options.map((t)=>({flags:t.flags,long:t.long||void 0,short:t.short||void 0,description:t.description||"",required:!!t.required||!!t.mandatory,optional:!!t.optional,defaultValue:t.defaultValue}))}function Vse(e){let t=[],r=e;while(r?.parent)t.unshift(r.name()),r=r.parent;return t.join(" ")}function jit(e){return e.options.some((t)=>t.long==="--json"||t.long==="--output")}function Mit(e){return e.options.some((t)=>t.long==="--dry-run")}function qse(e){return{name:e.name(),path:Vse(e),summary:e.summary()||void 0,description:e.description(),arguments:Dit(e),options:Lit(e),supportsJsonOutput:jit(e),supportsDryRun:Mit(e),subcommands:e.commands.map((t)=>qse(t))}}function Nit(e,t){if(!t?.trim())return e;let r=t.trim(),n=[...e.commands];while(n.length>0){let i=n.shift();if(!i)continue;if(i.name()===r||Vse(i)===r)return i;n.push(...i.commands)}return null}function Kse(e,t){let r=Nit(e,t);if(!r)G4(`Unknown command: ${t}`);let n={name:e.name(),version:e.version(),description:e.description(),env:{[Hse]:"Set to json to force machine-readable output on commands that support it."},command:qse(r)};console.log(JSON.stringify(n,null,2))}function Y(e,t={}){return async(...r)=>{let n=Wse(r);if(n&&r.length>=2)r[r.length-2]=n.optsWithGlobals();let i=_it(r);try{if(n)Oit(n);await e(...r)}catch(o){let s=Pit(o);if(t.supportsJsonOutput&&ke(i))console.log(JSON.stringify({error:s},null,2));else console.error(s);process.exitCode=1}}}var Hse="OH_MY_AG_OUTPUT_FORMAT",a9,Use;var vt=g(()=>{i9();X2();a9=["text","json"],Use=["backend","frontend","mobile","qa","debug","pm"]});function te(e,t,r){function n(a,c){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let l=s.prototype,u=Object.keys(l);for(let d=0;d<u.length;d++){let p=u[d];if(!(p in a))a[p]=l[p].bind(a)}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function s(a){var c;let l=r?.Parent?new o:this;n(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}function ra(e){if(e)Object.assign(_f,e);return _f}var Jse,Pdr,dl,c9,_f;var Ad=g(()=>{Pdr=Symbol("zod_brand");dl=class dl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};c9=class c9 extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}};(Jse=globalThis).__zod_globalConfig??(Jse.__zod_globalConfig={});_f=globalThis.__zod_globalConfig});function dA(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function tj(e,t="|"){return e.map((r)=>oj(r)).join(t)}function u9(e,t){if(typeof t==="bigint")return t.toString();return t}function pA(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function fA(e){return e===null||e===void 0}function mA(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Xse(e,t){let r=e/t,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<i)return 0;return r-n}function Cr(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===Yse)return;if(n===void 0)n=Yse,n=r();return n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function xd(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function H4(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function rj(e){return JSON.stringify(e)}function Zse(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function l9(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Sd(e){if(l9(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(l9(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function ij(e){if(Sd(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}function W4(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ec(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function Le(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function oj(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function tae(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Fit(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let o=H4(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;s[a]=r.shape[a]}return xd(this,"shape",s),s},checks:[]});return ec(e,o)}function zit(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let o=H4(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete s[a]}return xd(this,"shape",s),s},checks:[]});return ec(e,o)}function Bit(e,t){if(!Sd(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=H4(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return xd(this,"shape",o),o}});return ec(e,i)}function Uit(e,t){if(!Sd(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=H4(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return xd(this,"shape",n),n}});return ec(e,r)}function Git(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=H4(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return xd(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ec(e,r)}function Hit(e,t,r){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let s=H4(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let l in r){if(!(l in a))throw Error(`Unrecognized key: "${l}"`);if(!r[l])continue;c[l]=e?new e({type:"optional",innerType:a[l]}):a[l]}else for(let l in a)c[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return xd(this,"shape",c),c},checks:[]});return ec(t,s)}function Wit(e,t,r){let n=H4(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in o))throw Error(`Unrecognized key: "${s}"`);if(!r[s])continue;o[s]=new e({type:"nonoptional",innerType:i[s]})}else for(let s in i)o[s]=new e({type:"nonoptional",innerType:i[s]});return xd(this,"shape",o),o}});return ec(t,n)}function Ed(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function nae(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function V4(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function uA(e){return typeof e==="string"?e:e?.message}function Z2(e,t,r){let n=e.message?e.message:uA(e.inst?._zod.def?.error?.(e))??uA(t?.error?.(e))??uA(r.customError?.(e))??uA(r.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;if(a.path??(a.path=[]),a.message=n,t?.reportInput)a.input=s;return a}function hA(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function iae(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function $d(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}var Yse,nj,Qse,eae,rae;var Q2=g(()=>{Ad();Yse=Symbol("evaluating");nj="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};Qse=pA(()=>{if(_f.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});eae=new Set(["string","number","symbol"]);rae={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}});function sae(e,t=(r)=>r.message){let r={},n=[];for(let i of e.issues)if(i.path.length>0)r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i));else n.push(t(i));return{formErrors:n,fieldErrors:r}}function aae(e,t=(r)=>r.message){let r={_errors:[]},n=(i,o=[])=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>n({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...o,...s.path]);else{let a=[...o,...s.path];if(a.length===0)r._errors.push(t(s));else{let c=r,l=0;while(l<a.length){let u=a[l];if(l!==a.length-1)c[u]=c[u]||{_errors:[]};else c[u]=c[u]||{_errors:[]},c[u]._errors.push(t(s));c=c[u],l++}}}};return n(e),r}var oae=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,u9,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},gA,sj;var aj=g(()=>{Ad();Q2();gA=te("$ZodError",oae),sj=te("$ZodError",oae,{Parent:Error})});var yA=(e)=>(t,r,n,i)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new dl;if(s.issues.length){let a=new(i?.Err??e)(s.issues.map((c)=>Z2(c,o,ra())));throw nj(a,i?.callee),a}return s.value},vA=(e)=>async(t,r,n,i)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(i?.Err??e)(s.issues.map((c)=>Z2(c,o,ra())));throw nj(a,i?.callee),a}return s.value},d9=(e)=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new dl;return o.issues.length?{success:!1,error:new(e??gA)(o.issues.map((s)=>Z2(s,i,ra())))}:{success:!0,data:o.value}},cae,p9=(e)=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)o=await o;return o.issues.length?{success:!1,error:new e(o.issues.map((s)=>Z2(s,i,ra())))}:{success:!0,data:o.value}},lae,uae=(e)=>(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return yA(e)(t,r,i)},dae=(e)=>(t,r,n)=>yA(e)(t,r,n),pae=(e)=>async(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return vA(e)(t,r,i)},fae=(e)=>async(t,r,n)=>vA(e)(t,r,n),mae=(e)=>(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return d9(e)(t,r,i)},hae=(e)=>(t,r,n)=>d9(e)(t,r,n),gae=(e)=>async(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return p9(e)(t,r,i)},yae=(e)=>async(t,r,n)=>p9(e)(t,r,n);var cj=g(()=>{Ad();aj();Q2();cae=d9(sj),lae=p9(sj)});function Cae(){return new RegExp(qit,"u")}function Mae(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Nae(e){return new RegExp(`^${Mae(e)}$`)}function Fae(e){let t=Mae({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Lae}T(?:${n})$`)}var vae,bae,kae,wae,Aae,xae,Sae,Eae,lj=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},$ae,qit="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_ae,Pae,Tae,Rae,Iae,uj,Oae,Dae,Lae="(?:(?:\\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])))",jae,zae=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Bae,dj,Uae,Gae,Hae,Wae;var kA=g(()=>{vae=/^[cC][0-9a-z]{6,}$/,bae=/^[0-9a-z]+$/,kae=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wae=/^[0-9a-vA-V]{20}$/,Aae=/^[A-Za-z0-9]{27}$/,xae=/^[a-zA-Z0-9_-]{21}$/,Sae=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Eae=/^([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})$/,$ae=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;_ae=/^(?:(?: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])$/,Pae=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,Tae=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,Rae=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Iae=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,uj=/^[A-Za-z0-9_-]*$/,Oae=/^https?$/,Dae=/^\+[1-9]\d{6,14}$/,jae=new RegExp(`^${Lae}$`);Bae=/^-?\d+$/,dj=/^-?\d+(?:\.\d+)?$/,Uae=/^(?:true|false)$/i,Gae=/^null$/i,Hae=/^[^A-Z]*$/,Wae=/^[^a-z]*$/});var qi,Vae,pj,fj,qae,Kae,Jae,Yae,Xae,f9,Zae,Qae,e2e,t2e,r2e,n2e,i2e;var wA=g(()=>{Ad();kA();Q2();qi=te("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Vae={number:"number",bigint:"bigint",object:"date"},pj=te("$ZodCheckLessThan",(e,t)=>{qi.init(e,t);let r=Vae[typeof t.value];e._zod.onattach.push((n)=>{let i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<o)if(t.inclusive)i.maximum=t.value;else i.exclusiveMaximum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fj=te("$ZodCheckGreaterThan",(e,t)=>{qi.init(e,t);let r=Vae[typeof t.value];e._zod.onattach.push((n)=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>o)if(t.inclusive)i.minimum=t.value;else i.exclusiveMinimum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qae=te("$ZodCheckMultipleOf",(e,t)=>{qi.init(e,t),e._zod.onattach.push((r)=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Xse(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Kae=te("$ZodCheckNumberFormat",(e,t)=>{qi.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=rae[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=i,a.maximum=o,r)a.pattern=Bae}),e._zod.check=(s)=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(a<i)s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort});if(a>o)s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Jae=te("$ZodCheckMaxLength",(e,t)=>{var r;qi.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let i=n.value;return!fA(i)&&i.length!==void 0}),e._zod.onattach.push((n)=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<i)n._zod.bag.maximum=t.maximum}),e._zod.check=(n)=>{let i=n.value;if(i.length<=t.maximum)return;let s=hA(i);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Yae=te("$ZodCheckMinLength",(e,t)=>{var r;qi.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let i=n.value;return!fA(i)&&i.length!==void 0}),e._zod.onattach.push((n)=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>i)n._zod.bag.minimum=t.minimum}),e._zod.check=(n)=>{let i=n.value;if(i.length>=t.minimum)return;let s=hA(i);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Xae=te("$ZodCheckLengthEquals",(e,t)=>{var r;qi.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let i=n.value;return!fA(i)&&i.length!==void 0}),e._zod.onattach.push((n)=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=(n)=>{let i=n.value,o=i.length;if(o===t.length)return;let s=hA(i),a=o>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),f9=te("$ZodCheckStringFormat",(e,t)=>{var r,n;if(qi.init(e,t),e._zod.onattach.push((i)=>{let o=i._zod.bag;if(o.format=t.format,t.pattern)o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(i)=>{if(t.pattern.lastIndex=0,t.pattern.test(i.value))return;i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),Zae=te("$ZodCheckRegex",(e,t)=>{f9.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Qae=te("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Hae),f9.init(e,t)}),e2e=te("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Wae),f9.init(e,t)}),t2e=te("$ZodCheckIncludes",(e,t)=>{qi.init(e,t);let r=W4(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push((i)=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=(i)=>{if(i.value.includes(t.includes,t.position))return;i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),r2e=te("$ZodCheckStartsWith",(e,t)=>{qi.init(e,t);let r=new RegExp(`^${W4(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),n2e=te("$ZodCheckEndsWith",(e,t)=>{qi.init(e,t);let r=new RegExp(`.*${W4(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),i2e=te("$ZodCheckOverwrite",(e,t)=>{qi.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}})});class mj{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
27
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();if(t&&e.find((n)=>t.is(n)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}});var mdr;var i9=g(()=>{oA();jse();n9();HL();VL();mdr=new X5});var o9;var JL=g(()=>{o9={name:"oh-my-agent",version:"14.7.3",description:"Portable multi-agent harness for .agents-based skills and workflows across Antigravity, Claude Code, Codex, OpenCode, and more",type:"module",bin:{"oh-my-agent":"./bin/cli.js",oma:"./bin/cli.js"},files:["bin"],keywords:["oh-my-agent","antigravity",".agents","agent","skills","agent-skills","multi-agent","orchestrator","claude","claude-code","codex","opencode","copilot","cursor","chatgpt","pm","frontend","backend","mobile","qa","debug","terraform","database","workflow","bug-fixing"],author:"our.first.fluke <our.first.fluke@gmail.com>",contributors:["gracefullight <gracefullight.dev@gmail.com>","gahyun-git <go4it.gh@gmail.com>"],license:"MIT",funding:[{type:"github",url:"https://github.com/sponsors/first-fluke"},{type:"buymeacoffee",url:"https://buymeacoffee.com/firstfluke"}],scripts:{"sync:readme":"node ./scripts/sync-readme.mjs","generate:skill-data":"node ./scripts/generate-skill-data.mjs",build:"bun run generate:skill-data && bun run sync:readme && bun build cli.ts --outfile bin/cli.js --target node --minify --external @napi-rs/keyring --external jsonc-parser && bun run check:bundle",dev:"bun run generate:skill-data && bun run cli.ts",lint:"biome check .","lint:fix":"biome check --write --unsafe .","check:boundaries":"node ./scripts/check-boundaries.mjs","check:bundle":"node ./scripts/check-bundle.mjs","check:emit-drift":"node ./scripts/check-emit-drift.mjs",test:"vitest run","test:coverage":"vitest run --coverage",prepublishOnly:"bun run build"},dependencies:{"@clack/prompts":"^1.7.0","@date-fns/tz":"^1.5.0","@napi-rs/keyring":"^1.3.0",axios:"^1.18.1","better-sqlite3":"^13.0.2",chokidar:"^5.0.0",commander:"^15.0.0","date-fns":"^4.4.0",eld:"^2.0.3","fast-xml-parser":"^5.10.1","jsonc-parser":"^3.3.1",minimatch:"^10.2.6","p-map":"^7.0.6",picocolors:"^1.1.1","puppeteer-core":"^25.4.0",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-parse":"^11.0.0","smol-toml":"^1.7.1",unified:"^11.0.5",ws:"^8.21.1",yaml:"^2.9.0",zod:"^4.4.3"},optionalDependencies:{pptxgenjs:"^4.0.1"},devDependencies:{"@biomejs/biome":"^2.5.6","@types/better-sqlite3":"^7.6.13","@types/mdast":"^4.0.4","@types/node":"^26.1.2","@types/ws":"^8.18.1","@vitest/coverage-v8":"^4.1.10",typescript:"^7.0.2",vitest:"^4.1.10"},repository:{type:"git",url:"https://github.com/first-fluke/oh-my-agent"},homepage:"https://firstfluke.com/oh-my-agent",bugs:{url:"https://github.com/first-fluke/oh-my-agent/issues"},antigravity:{skillsPath:".agents/skills",skills:["oma-architecture","oma-brainstorm","oma-coordination","oma-pm","oma-frontend","oma-backend","oma-db","oma-mobile","oma-qa","oma-debug","oma-orchestration","oma-dev-workflow","oma-tf-infra","oma-scm","oma-pdf","oma-recap"]}}});import*as $f from"node:fs";import{homedir as dit}from"node:os";import*as s9 from"node:path";function Nse(e){if(cA)throw Error("install context already set in this process");cA=e}function Fse(){if(cA===null)throw Error("install context not set — entry point must call setInstallContext()");return cA}function ul(){return Fse().installRoot}function Ri(){return Fse().mode}function Z5(){try{return Ri()}catch{return"project"}}function Cf(){try{return ul()}catch{return process.cwd()}}function zse(e){let t=process.env.OMA_HOME,r=e.global===!0||process.env.OMA_INSTALL_GLOBAL==="1";if(t!==void 0&&t!=="")return pit(t),{installRoot:t,mode:r?"global":"project"};if(r)return{installRoot:dit(),mode:"global"};return{installRoot:process.cwd(),mode:"project"}}function pit(e){if(!s9.isAbsolute(e))throw Error("OMA_HOME must be absolute path");for(let r of Mse)if(e===r||e.startsWith(r+s9.sep))throw Error(`OMA_HOME=${e} is forbidden (system path ${r})`);let t;try{t=$f.realpathSync(e)}catch(r){let n=r instanceof Error?r.message:String(r);throw Error(`OMA_HOME=${e}: ${n}`)}for(let r of Mse)if(t===r||t.startsWith(r+s9.sep))throw Error(`OMA_HOME=${t} is forbidden (system path ${r})`);try{$f.accessSync(t,$f.constants.W_OK)}catch{throw Error(`OMA_HOME=${t} is not writable`)}}var cA=null,Mse;var Ga=g(()=>{Mse=["/etc","/usr","/bin","/boot","/sys","/proc"]});import{join as fit}from"node:path";function wd(e){return e.endsWith("/")?e:`${e}/`}function ta(e,t){let r=t.split("/").filter((n)=>n.length>0);return fit(e,...r)}var J2=".agents",lA,On,U4,kdr,wdr,Adr,mit=".antigravitycli",Bse,hit=".migration-backup",git="docs/plans",yit=".qwen/tmp",vit,bit,kit,wit,Ait,xit,Sit,YL;var Ii=g(()=>{lA=`${J2}/skills`,On=`${J2}/results`,U4=`${J2}/state`,kdr=`${U4}/sessions`,wdr=`${U4}/retry`,Adr=`${U4}/archive`,Bse=`${J2}/backup`;vit=wd(On),bit=wd(U4),kit=wd(mit),wit=wd(Bse),Ait=wd(hit),xit=wd(git),Sit=wd(yit),YL=[".agents/oma-config.local.cue",".agents/oma-config.local.yaml",kit,vit,bit,wit,xit,Ait,Sit]});var ln="first-fluke/oh-my-agent",ur,Y2,XL,Eit,$it,Q5,Vr;var X2=g(()=>{Ii();ur=lA,Y2=["antigravity","claude","codex","commandcode","cursor","grok","kimi","kiro","qwen"],XL=["pi","opencode"],Eit=["copilot","hermes"],$it=["zcode"],Q5=[...Y2,...XL,...Eit,...$it].sort(),Vr={antigravity:{projectPath:".gemini/antigravity-cli/skills",homePath:".gemini/antigravity-cli/skills",requiresHomeConsent:!0},claude:{projectPath:".claude/skills",homePath:".claude/skills"},codex:{projectPath:".codex/skills",homePath:".codex/skills"},commandcode:{projectPath:".commandcode/skills",homePath:".commandcode/skills",optIn:!0},copilot:{projectPath:".github/skills",homePath:".copilot/skills"},cursor:{projectPath:".cursor/skills",homePath:".cursor/skills"},hermes:{projectPath:".hermes/skills/oma",homePath:".hermes/skills/oma",requiresHomeConsent:!0},kimi:{projectPath:".kimi-code/skills",homePath:".kimi-code/skills",requiresHomeConsent:!0,optIn:!0},kiro:{projectPath:".kiro/skills",homePath:".kiro/skills",optIn:!0},opencode:{projectPath:".opencode/skills",homePath:".opencode/skills"},qwen:{projectPath:".qwen/skills",homePath:".qwen/skills"}}});function Ae(e,t="Output as JSON"){return e.option("--json",t).option("--output <format>","Output format (text/json)",(r)=>{let n=r.trim().toLowerCase();if(!a9.includes(n))throw Error(`Invalid output format: ${r}. Expected one of ${a9.join(", ")}`);return n})}function Cit(e){if(e?.json)return"json";let t=e?.output?.trim().toLowerCase();if(t&&a9.includes(t))return t;if(process.env[Hse]?.trim().toLowerCase()==="json")return"json";return"text"}function ke(e){return Cit(e)==="json"}function Wse(e){let t=e.at(-1);return t instanceof X5?t:null}function _it(e){let t=Wse(e);if(t)return t.opts();let r=e.at(-1);return r&&typeof r==="object"?r:{}}function Pit(e){if(e instanceof Error)return e.message;return String(e)}function G4(e){throw Error(e)}function QL(e,t){for(let r of e){let n=r.charCodeAt(0);if(n>=0&&n<=31||n===127)G4(`${t} must not contain control characters`)}}function Tit(e,t){if(QL(e,t),/[?#%]/.test(e))G4(`${t} must not contain ?, #, or %`);if(e.includes(".."))G4(`${t} must not contain '..'`)}function Rit(e,t){QL(e,t);try{new URL(e)}catch{G4(`${t} must be a valid absolute URL`)}}function ZL(e,t,r="text"){if(typeof e==="string"){if(r==="identifier"){Tit(e,t);return}if(r==="url"){Rit(e,t);return}QL(e,t);return}if(Array.isArray(e))for(let[n,i]of e.entries())ZL(i,`${t}[${n}]`,r)}function Gse(e){let t=e.toLowerCase();if(t==="url"||t.endsWith("url"))return"url";if(t.includes("id")||t.includes("type")||t.includes("vendor")||t.includes("session"))return"identifier";return"text"}function Iit(e){let t=e.vendor;if(typeof t==="string"){if(t.split(",").map((o)=>o.trim()).filter(Boolean).filter((o)=>!Q5.includes(o)).length>0)G4(`vendor must be one of ${Q5.join(", ")}`)}let r=e.output;if(typeof r==="string"&&!a9.includes(r))G4(`output must be one of ${a9.join(", ")}`)}function Oit(e){let t=e.processedArgs??e.args??[];(e.registeredArguments??[]).forEach((i,o)=>{let s=i.name?.()||String(o),a=t[o];if(ZL(a,s,Gse(s)),s==="agent-type"&&typeof a==="string"&&!Use.includes(a))G4(`agent-type must be one of ${Use.join(", ")}`)});let n=e.opts();Iit(n);for(let[i,o]of Object.entries(n))ZL(o,i,Gse(i))}function Dit(e){return(e.registeredArguments??[]).map((t)=>({name:t.name?.()||"",required:!!t.required,variadic:!!t.variadic}))}function Lit(e){return e.options.map((t)=>({flags:t.flags,long:t.long||void 0,short:t.short||void 0,description:t.description||"",required:!!t.required||!!t.mandatory,optional:!!t.optional,defaultValue:t.defaultValue}))}function Vse(e){let t=[],r=e;while(r?.parent)t.unshift(r.name()),r=r.parent;return t.join(" ")}function jit(e){return e.options.some((t)=>t.long==="--json"||t.long==="--output")}function Mit(e){return e.options.some((t)=>t.long==="--dry-run")}function qse(e){return{name:e.name(),path:Vse(e),summary:e.summary()||void 0,description:e.description(),arguments:Dit(e),options:Lit(e),supportsJsonOutput:jit(e),supportsDryRun:Mit(e),subcommands:e.commands.map((t)=>qse(t))}}function Nit(e,t){if(!t?.trim())return e;let r=t.trim(),n=[...e.commands];while(n.length>0){let i=n.shift();if(!i)continue;if(i.name()===r||Vse(i)===r)return i;n.push(...i.commands)}return null}function Kse(e,t){let r=Nit(e,t);if(!r)G4(`Unknown command: ${t}`);let n={name:e.name(),version:e.version(),description:e.description(),env:{[Hse]:"Set to json to force machine-readable output on commands that support it."},command:qse(r)};console.log(JSON.stringify(n,null,2))}function Y(e,t={}){return async(...r)=>{let n=Wse(r);if(n&&r.length>=2)r[r.length-2]=n.optsWithGlobals();let i=_it(r);try{if(n)Oit(n);await e(...r)}catch(o){let s=Pit(o);if(t.supportsJsonOutput&&ke(i))console.log(JSON.stringify({error:s},null,2));else console.error(s);process.exitCode=1}}}var Hse="OH_MY_AG_OUTPUT_FORMAT",a9,Use;var vt=g(()=>{i9();X2();a9=["text","json"],Use=["backend","frontend","mobile","qa","debug","pm"]});function te(e,t,r){function n(a,c){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let l=s.prototype,u=Object.keys(l);for(let d=0;d<u.length;d++){let p=u[d];if(!(p in a))a[p]=l[p].bind(a)}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function s(a){var c;let l=r?.Parent?new o:this;n(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}function ra(e){if(e)Object.assign(_f,e);return _f}var Jse,Pdr,dl,c9,_f;var Ad=g(()=>{Pdr=Symbol("zod_brand");dl=class dl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};c9=class c9 extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}};(Jse=globalThis).__zod_globalConfig??(Jse.__zod_globalConfig={});_f=globalThis.__zod_globalConfig});function dA(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function tj(e,t="|"){return e.map((r)=>oj(r)).join(t)}function u9(e,t){if(typeof t==="bigint")return t.toString();return t}function pA(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function fA(e){return e===null||e===void 0}function mA(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Xse(e,t){let r=e/t,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<i)return 0;return r-n}function Cr(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===Yse)return;if(n===void 0)n=Yse,n=r();return n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function xd(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function H4(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function rj(e){return JSON.stringify(e)}function Zse(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function l9(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Sd(e){if(l9(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(l9(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function ij(e){if(Sd(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}function W4(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ec(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function Le(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function oj(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function tae(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Fit(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let o=H4(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;s[a]=r.shape[a]}return xd(this,"shape",s),s},checks:[]});return ec(e,o)}function zit(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let o=H4(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete s[a]}return xd(this,"shape",s),s},checks:[]});return ec(e,o)}function Bit(e,t){if(!Sd(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=H4(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return xd(this,"shape",o),o}});return ec(e,i)}function Uit(e,t){if(!Sd(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=H4(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return xd(this,"shape",n),n}});return ec(e,r)}function Git(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=H4(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return xd(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ec(e,r)}function Hit(e,t,r){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let s=H4(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let l in r){if(!(l in a))throw Error(`Unrecognized key: "${l}"`);if(!r[l])continue;c[l]=e?new e({type:"optional",innerType:a[l]}):a[l]}else for(let l in a)c[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return xd(this,"shape",c),c},checks:[]});return ec(t,s)}function Wit(e,t,r){let n=H4(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in o))throw Error(`Unrecognized key: "${s}"`);if(!r[s])continue;o[s]=new e({type:"nonoptional",innerType:i[s]})}else for(let s in i)o[s]=new e({type:"nonoptional",innerType:i[s]});return xd(this,"shape",o),o}});return ec(t,n)}function Ed(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function nae(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function V4(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function uA(e){return typeof e==="string"?e:e?.message}function Z2(e,t,r){let n=e.message?e.message:uA(e.inst?._zod.def?.error?.(e))??uA(t?.error?.(e))??uA(r.customError?.(e))??uA(r.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;if(a.path??(a.path=[]),a.message=n,t?.reportInput)a.input=s;return a}function hA(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function iae(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function $d(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}var Yse,nj,Qse,eae,rae;var Q2=g(()=>{Ad();Yse=Symbol("evaluating");nj="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};Qse=pA(()=>{if(_f.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});eae=new Set(["string","number","symbol"]);rae={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}});function sae(e,t=(r)=>r.message){let r={},n=[];for(let i of e.issues)if(i.path.length>0)r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i));else n.push(t(i));return{formErrors:n,fieldErrors:r}}function aae(e,t=(r)=>r.message){let r={_errors:[]},n=(i,o=[])=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>n({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...o,...s.path]);else{let a=[...o,...s.path];if(a.length===0)r._errors.push(t(s));else{let c=r,l=0;while(l<a.length){let u=a[l];if(l!==a.length-1)c[u]=c[u]||{_errors:[]};else c[u]=c[u]||{_errors:[]},c[u]._errors.push(t(s));c=c[u],l++}}}};return n(e),r}var oae=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,u9,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},gA,sj;var aj=g(()=>{Ad();Q2();gA=te("$ZodError",oae),sj=te("$ZodError",oae,{Parent:Error})});var yA=(e)=>(t,r,n,i)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new dl;if(s.issues.length){let a=new(i?.Err??e)(s.issues.map((c)=>Z2(c,o,ra())));throw nj(a,i?.callee),a}return s.value},vA=(e)=>async(t,r,n,i)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(i?.Err??e)(s.issues.map((c)=>Z2(c,o,ra())));throw nj(a,i?.callee),a}return s.value},d9=(e)=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new dl;return o.issues.length?{success:!1,error:new(e??gA)(o.issues.map((s)=>Z2(s,i,ra())))}:{success:!0,data:o.value}},cae,p9=(e)=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)o=await o;return o.issues.length?{success:!1,error:new e(o.issues.map((s)=>Z2(s,i,ra())))}:{success:!0,data:o.value}},lae,uae=(e)=>(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return yA(e)(t,r,i)},dae=(e)=>(t,r,n)=>yA(e)(t,r,n),pae=(e)=>async(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return vA(e)(t,r,i)},fae=(e)=>async(t,r,n)=>vA(e)(t,r,n),mae=(e)=>(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return d9(e)(t,r,i)},hae=(e)=>(t,r,n)=>d9(e)(t,r,n),gae=(e)=>async(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return p9(e)(t,r,i)},yae=(e)=>async(t,r,n)=>p9(e)(t,r,n);var cj=g(()=>{Ad();aj();Q2();cae=d9(sj),lae=p9(sj)});function Cae(){return new RegExp(qit,"u")}function Mae(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Nae(e){return new RegExp(`^${Mae(e)}$`)}function Fae(e){let t=Mae({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Lae}T(?:${n})$`)}var vae,bae,kae,wae,Aae,xae,Sae,Eae,lj=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},$ae,qit="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_ae,Pae,Tae,Rae,Iae,uj,Oae,Dae,Lae="(?:(?:\\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])))",jae,zae=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Bae,dj,Uae,Gae,Hae,Wae;var kA=g(()=>{vae=/^[cC][0-9a-z]{6,}$/,bae=/^[0-9a-z]+$/,kae=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wae=/^[0-9a-vA-V]{20}$/,Aae=/^[A-Za-z0-9]{27}$/,xae=/^[a-zA-Z0-9_-]{21}$/,Sae=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Eae=/^([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})$/,$ae=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;_ae=/^(?:(?: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])$/,Pae=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,Tae=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,Rae=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Iae=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,uj=/^[A-Za-z0-9_-]*$/,Oae=/^https?$/,Dae=/^\+[1-9]\d{6,14}$/,jae=new RegExp(`^${Lae}$`);Bae=/^-?\d+$/,dj=/^-?\d+(?:\.\d+)?$/,Uae=/^(?:true|false)$/i,Gae=/^null$/i,Hae=/^[^A-Z]*$/,Wae=/^[^a-z]*$/});var qi,Vae,pj,fj,qae,Kae,Jae,Yae,Xae,f9,Zae,Qae,e2e,t2e,r2e,n2e,i2e;var wA=g(()=>{Ad();kA();Q2();qi=te("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Vae={number:"number",bigint:"bigint",object:"date"},pj=te("$ZodCheckLessThan",(e,t)=>{qi.init(e,t);let r=Vae[typeof t.value];e._zod.onattach.push((n)=>{let i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<o)if(t.inclusive)i.maximum=t.value;else i.exclusiveMaximum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fj=te("$ZodCheckGreaterThan",(e,t)=>{qi.init(e,t);let r=Vae[typeof t.value];e._zod.onattach.push((n)=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>o)if(t.inclusive)i.minimum=t.value;else i.exclusiveMinimum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qae=te("$ZodCheckMultipleOf",(e,t)=>{qi.init(e,t),e._zod.onattach.push((r)=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Xse(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Kae=te("$ZodCheckNumberFormat",(e,t)=>{qi.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=rae[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=i,a.maximum=o,r)a.pattern=Bae}),e._zod.check=(s)=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(a<i)s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort});if(a>o)s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Jae=te("$ZodCheckMaxLength",(e,t)=>{var r;qi.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let i=n.value;return!fA(i)&&i.length!==void 0}),e._zod.onattach.push((n)=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<i)n._zod.bag.maximum=t.maximum}),e._zod.check=(n)=>{let i=n.value;if(i.length<=t.maximum)return;let s=hA(i);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Yae=te("$ZodCheckMinLength",(e,t)=>{var r;qi.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let i=n.value;return!fA(i)&&i.length!==void 0}),e._zod.onattach.push((n)=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>i)n._zod.bag.minimum=t.minimum}),e._zod.check=(n)=>{let i=n.value;if(i.length>=t.minimum)return;let s=hA(i);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Xae=te("$ZodCheckLengthEquals",(e,t)=>{var r;qi.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let i=n.value;return!fA(i)&&i.length!==void 0}),e._zod.onattach.push((n)=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=(n)=>{let i=n.value,o=i.length;if(o===t.length)return;let s=hA(i),a=o>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),f9=te("$ZodCheckStringFormat",(e,t)=>{var r,n;if(qi.init(e,t),e._zod.onattach.push((i)=>{let o=i._zod.bag;if(o.format=t.format,t.pattern)o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(i)=>{if(t.pattern.lastIndex=0,t.pattern.test(i.value))return;i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),Zae=te("$ZodCheckRegex",(e,t)=>{f9.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Qae=te("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Hae),f9.init(e,t)}),e2e=te("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Wae),f9.init(e,t)}),t2e=te("$ZodCheckIncludes",(e,t)=>{qi.init(e,t);let r=W4(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push((i)=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=(i)=>{if(i.value.includes(t.includes,t.position))return;i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),r2e=te("$ZodCheckStartsWith",(e,t)=>{qi.init(e,t);let r=new RegExp(`^${W4(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),n2e=te("$ZodCheckEndsWith",(e,t)=>{qi.init(e,t);let r=new RegExp(`.*${W4(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),i2e=te("$ZodCheckOverwrite",(e,t)=>{qi.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}})});class mj{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
28
28
  `).filter((o)=>o),n=Math.min(...r.map((o)=>o.length-o.trimStart().length)),i=r.map((o)=>o.slice(n)).map((o)=>" ".repeat(this.indent*2)+o);for(let o of i)this.content.push(o)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[""]).map((i)=>` ${i}`)];return new e(...t,n.join(`
29
29
  `))}}var s2e;var hj=g(()=>{s2e={major:4,minor:4,patch:3}});function D2e(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function Kit(e){if(!uj.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return D2e(r)}function Jit(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));if("typ"in i&&i?.typ!=="JWT")return!1;if(!i.alg)return!1;if(t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}function a2e(e,t,r){if(e.issues.length)t.issues.push(...V4(r,e.issues));t.value[r]=e.value}function xA(e,t,r,n,i,o){let s=r in n;if(e.issues.length){if(i&&o&&!s)return;t.issues.push(...V4(r,e.issues))}if(!s&&!i){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s)t.value[r]=void 0}else t.value[r]=e.value}function W2e(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let r=tae(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function V2e(e,t,r,n,i,o){let s=[],a=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin==="optional",d=c.optout==="optional";for(let p in t){if(p==="__proto__")continue;if(a.has(p))continue;if(l==="never"){s.push(p);continue}let f=c.run({value:t[p],issues:[]},n);if(f instanceof Promise)e.push(f.then((m)=>xA(m,r,p,t,u,d)));else xA(f,r,p,t,u,d)}if(s.length)r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o});if(!e.length)return r;return Promise.all(e).then(()=>r)}function c2e(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter((o)=>!Ed(o));if(i.length===1)return t.value=i[0].value,i[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((o)=>o.issues.map((s)=>Z2(s,n,ra())))}),t}function gj(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Sd(e)&&Sd(t)){let r=Object.keys(t),n=Object.keys(e).filter((o)=>r.indexOf(o)!==-1),i={...e,...t};for(let o of n){let s=gj(e[o],t[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=e[n],o=t[n],s=gj(i,o);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function l2e(e,t,r){let n=new Map,i;for(let a of t.issues)if(a.code==="unrecognized_keys"){i??(i=a);for(let c of a.keys){if(!n.has(c))n.set(c,{});n.get(c).l=!0}}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys){if(!n.has(c))n.set(c,{});n.get(c).r=!0}else e.issues.push(a);let o=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(o.length&&i)e.issues.push({...i,keys:o});if(Ed(e))return e;let s=gj(t.value,r.value);if(!s.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}function u2e(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}function d2e(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}function p2e(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function AA(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}function f2e(e){return e.value=Object.freeze(e.value),e}function m2e(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)i.params=n._zod.def.params;t.issues.push($d(i))}}var Qr,SA,en,h2e,g2e,y2e,v2e,b2e,k2e,w2e,A2e,x2e,S2e,E2e,$2e,C2e,_2e,P2e,T2e,R2e,I2e,O2e,L2e,j2e,M2e,N2e,yj,F2e,z2e,B2e,U2e,G2e,H2e,Yit,q2e,K2e,J2e,Y2e,X2e,Z2e,Q2e,vj,e5e,t5e,r5e,n5e,i5e,o5e,s5e,a5e,c5e;var l5e=g(()=>{wA();Ad();cj();kA();Q2();hj();Q2();Qr=te("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=s2e;let n=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))n.unshift(e);for(let i of n)for(let o of i._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(s,a,c)=>{let l=Ed(s),u;for(let d of a){if(d._zod.def.when){if(nae(s))continue;if(!d._zod.def.when(s))continue}else if(l)continue;let p=s.issues.length,f=d._zod.check(s);if(f instanceof Promise&&c?.async===!1)throw new dl;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{if(await f,s.issues.length===p)return;if(!l)l=Ed(s,p)});else{if(s.issues.length===p)continue;if(!l)l=Ed(s,p)}}if(u)return u.then(()=>s);return s},o=(s,a,c)=>{if(Ed(s))return s.aborted=!0,s;let l=i(a,n,c);if(l instanceof Promise){if(c.async===!1)throw new dl;return l.then((u)=>e._zod.parse(u,c))}return e._zod.parse(l,c)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){let l=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});if(l instanceof Promise)return l.then((u)=>o(u,s,a));return o(l,s,a)}let c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new dl;return c.then((l)=>i(l,n,a))}return i(c,n,a)}}Cr(e,"~standard",()=>({validate:(i)=>{try{let o=cae(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch(o){return lae(e,i).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),SA=te("$ZodString",(e,t)=>{Qr.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??zae(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(i){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),en=te("$ZodStringFormat",(e,t)=>{f9.init(e,t),SA.init(e,t)}),h2e=te("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Eae),en.init(e,t)}),g2e=te("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=lj(n))}else t.pattern??(t.pattern=lj());en.init(e,t)}),y2e=te("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=$ae),en.init(e,t)}),v2e=te("$ZodURL",(e,t)=>{en.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===Oae.source){if(!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let i=new URL(n);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(i.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=i.href;else r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),b2e=te("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Cae()),en.init(e,t)}),k2e=te("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=xae),en.init(e,t)}),w2e=te("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=vae),en.init(e,t)}),A2e=te("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=bae),en.init(e,t)}),x2e=te("$ZodULID",(e,t)=>{t.pattern??(t.pattern=kae),en.init(e,t)}),S2e=te("$ZodXID",(e,t)=>{t.pattern??(t.pattern=wae),en.init(e,t)}),E2e=te("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Aae),en.init(e,t)}),$2e=te("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Fae(t)),en.init(e,t)}),C2e=te("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=jae),en.init(e,t)}),_2e=te("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Nae(t)),en.init(e,t)}),P2e=te("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Sae),en.init(e,t)}),T2e=te("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=_ae),en.init(e,t),e._zod.bag.format="ipv4"}),R2e=te("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Pae),en.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),I2e=te("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Tae),en.init(e,t)}),O2e=te("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Rae),en.init(e,t),e._zod.check=(r)=>{let n=r.value.split("/");try{if(n.length!==2)throw Error();let[i,o]=n;if(!o)throw Error();let s=Number(o);if(`${s}`!==o)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});L2e=te("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Iae),en.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(D2e(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});j2e=te("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=uj),en.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(Kit(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),M2e=te("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Dae),en.init(e,t)});N2e=te("$ZodJWT",(e,t)=>{en.init(e,t),e._zod.check=(r)=>{if(Jit(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),yj=te("$ZodNumber",(e,t)=>{Qr.init(e,t),e._zod.pattern=e._zod.bag.pattern??dj,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let i=r.value;if(typeof i==="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i==="number"?Number.isNaN(i)?"NaN":!Number.isFinite(i)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),F2e=te("$ZodNumberFormat",(e,t)=>{Kae.init(e,t),yj.init(e,t)}),z2e=te("$ZodBoolean",(e,t)=>{Qr.init(e,t),e._zod.pattern=Uae,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(o){}let i=r.value;if(typeof i==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),B2e=te("$ZodNull",(e,t)=>{Qr.init(e,t),e._zod.pattern=Gae,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let i=r.value;if(i===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),r}}),U2e=te("$ZodUnknown",(e,t)=>{Qr.init(e,t),e._zod.parse=(r)=>r}),G2e=te("$ZodNever",(e,t)=>{Qr.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});H2e=te("$ZodArray",(e,t)=>{Qr.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let o=[];for(let s=0;s<i.length;s++){let a=i[s],c=t.element._zod.run({value:a,issues:[]},n);if(c instanceof Promise)o.push(c.then((l)=>a2e(l,r,s)));else a2e(c,r,s)}if(o.length)return Promise.all(o).then(()=>r);return r}});Yit=te("$ZodObject",(e,t)=>{if(Qr.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=pA(()=>W2e(t));Cr(e._zod,"propValues",()=>{let a=t.shape,c={};for(let l in a){let u=a[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(let d of u.values)c[l].add(d)}}return c});let i=l9,o=t.catchall,s;e._zod.parse=(a,c)=>{s??(s=n.value);let l=a.value;if(!i(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};let u=[],d=s.shape;for(let p of s.keys){let f=d[p],m=f._zod.optin==="optional",h=f._zod.optout==="optional",y=f._zod.run({value:l[p],issues:[]},c);if(y instanceof Promise)u.push(y.then((v)=>xA(v,a,p,l,m,h)));else xA(y,a,p,l,m,h)}if(!o)return u.length?Promise.all(u).then(()=>a):a;return V2e(u,l,a,c,n.value,e)}}),q2e=te("$ZodObjectJIT",(e,t)=>{Yit.init(e,t);let r=e._zod.parse,n=pA(()=>W2e(t)),i=(p)=>{let f=new mj(["shape","payload","ctx"]),m=n.value,h=(b)=>{let E=rj(b);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),v=0;for(let b of m.keys)y[b]=`key_${v++}`;f.write("const newResult = {};");for(let b of m.keys){let E=y[b],x=rj(b),S=p[b],w=S?._zod?.optin==="optional",A=S?._zod?.optout==="optional";if(f.write(`const ${E} = ${h(b)};`),w&&A)f.write(`
30
30
  if (${E}.issues.length) {
@@ -1644,7 +1644,7 @@ ${e.reassignedActive.map((s)=>` ${s.category}: ${s.from} -> ${s.to}`).join(`
1644
1644
  `)}function Nq(e,t,r,n={}){let i=[ri.default.bold(`OMA session ${e}`),`workflow: ${t.workflow||"(unknown)"}`,`status: ${t.status}`,`phase: ${t.currentPhase||"(none)"}`,`archived: ${n.archived===!0?"yes":"no"}`,`events: ${r.length}`];if(n.archivePath)i.push(`archivePath: ${n.archivePath}`);let o=r.filter((c)=>c.kind.startsWith("gate.")),s=r.filter((c)=>c.kind==="decision.made"),a=r.filter((c)=>c.kind==="decision.missing");if(o.length>0){i.push("",ri.default.bold("Gates"));for(let c of o)i.push(` ${c.kind} ${kv(c,"gate")} ${c.ts}`)}if(s.length>0){i.push("",ri.default.bold("Decisions"));for(let c of s)i.push(` ${kv(c,"subject")} -> ${kv(c,"decision")} ${c.ts}`)}if(a.length>0){i.push("",ri.default.bold("Missing Decisions"));for(let c of a)i.push(` ${kv(c,"workflow")}/${kv(c,"checkpoint")} ${c.ts}`)}i.push("",ri.default.bold("Events"));for(let c of r)i.push(` ${c.ts} ${c.kind} ${c.eventId}`);return i.join(`
1645
1645
  `)}var ri;var vRe=g(()=>{_n();ri=fe(Se(),1)});function Pjt(e,t,r){Ae(e.command(t).description(r).requiredOption("--workflow <workflow>","Workflow name").requiredOption("--checkpoint <checkpoint>","Required decision checkpoint").option("--sid <sid>","Target session id").option("--category <category>","Active category lookup","main").option("--no-emit-missing","Do not append a decision.missing event when verification fails")).action(Y(async(n)=>{let i=ke(n),{workflow:o,checkpoint:s}=n,a=Pq({projectDir:De(),sid:n.sid,category:n.category}),c=await YTe({projectDir:De(),sid:a,workflow:o,checkpoint:s,emitMissing:n.emitMissing!==!1});if(i)console.log(JSON.stringify(c,null,2));else if(c.ok)console.log(`Required decisions present for ${o}/${s} -> ${a}`);else{console.error(`Missing required decisions for ${o}/${s} -> ${a}:`);for(let l of c.missing)console.error(` - ${l.subject}: ${l.description}`)}if(!c.ok)process.exitCode=1},{supportsJsonOutput:!0}))}function Tjt(e){Ae(e.command("state:migrate").description("Migrate legacy sessions to the home profile and remove verified originals").option("--include-active","Also migrate active sessions under session write locks").option("--dry-run","Preview migration without writing files")).action(Y(async(t)=>{let r=e$({projectDir:De(),dryRun:t.dryRun===!0,includeActive:t.includeActive===!0});if(ke(t))console.log(JSON.stringify(r,null,2));else console.log(t$(r).join(`
1646
1646
  `)||"No legacy sessions to migrate");if(r.failed.length>0)process.exitCode=1},{supportsJsonOutput:!0})),Ae(e.command("state:get <sid>",{hidden:!0}).description("Inspect one OMA L1 session by ID")).action(Y(async(t,r)=>{let n=Iq(t);if(ke(r))console.log(JSON.stringify(n,null,2));else console.log(Nq(t,n.meta,n.events,{archived:n.archived,archivePath:n.archivePath}))},{supportsJsonOutput:!0})),Ae(e.command("state [sid]").description("Inspect OMA L1 workflow state").option("--activate <sid>","Set active session id").option("--category <category>","Active category","main").option("--archive","Move inactive terminal sessions to state archive").option("--archived","List archived sessions").option("--all-projects","List sessions from every project in the selected profile").option("--project <project>","Filter --all-projects by project ID or path").option("--search <text>","Search --all-projects session metadata").option("--purge","Delete inactive sessions older than --older-than").option("--older-than <duration>","Purge age threshold","90d").option("--dry-run","Preview purge without deleting sessions")).action(Y(async(t,r)=>{let n=ke(r),i=r.activate,o=r.category??"main",s=r.archive===!0,a=r.archived===!0,c=r.purge===!0,l=r.allProjects===!0;if((r.project||r.search)&&!l)throw Error("--project and --search require --all-projects");if(l){if(t||i||s||a||c)throw Error("--all-projects is read-only and only supports --project and --search");let d=ZTe({project:r.project,search:r.search});if(n)console.log(JSON.stringify(d,null,2));else console.log(mRe(d));return}if(t==="repair"){let d=jq({dryRun:r.dryRun===!0});if(n)console.log(JSON.stringify(d,null,2));else console.log(Mq(d));return}if(i){if(QTe(i,o),n)console.log(JSON.stringify({activated:i,category:o}));else console.log(`Activated ${o}: ${i}`);return}if(c){let d=lRe({olderThan:r.olderThan,dryRun:r.dryRun===!0});if(n)console.log(JSON.stringify(d,null,2));else console.log(gRe(d));return}if(s){let d=uRe({olderThan:r.olderThan,dryRun:r.dryRun===!0});if(n)console.log(JSON.stringify(d,null,2));else console.log(yRe(d));return}if(t){let d=Iq(t);if(n)console.log(JSON.stringify(d,null,2));else console.log(Nq(t,d.meta,d.events,{archived:d.archived,archivePath:d.archivePath}));return}if(a){let d=bv();if(n)console.log(JSON.stringify(d,null,2));else console.log(hRe(d));return}let u=vv();if(n)console.log(JSON.stringify(u,null,2));else console.log(fRe(u))},{supportsJsonOutput:!0})),Ae(e.command("state:repair").description("Repair OMA L1 workflow state files").option("--dry-run","Preview repairs without writing changes")).action(Y(async(t)=>{let r=jq({dryRun:t.dryRun===!0});if(ke(t))console.log(JSON.stringify(r,null,2));else console.log(Mq(r))},{supportsJsonOutput:!0})),Pjt(e,"state:verify","Verify required L1 events for a workflow checkpoint"),Ae(e.command("state:required-decisions [workflow]").description("List required L1 decision.made checkpoints")).action(Y(async(t,r)=>{let n=JTe(t);if(ke(r)){console.log(JSON.stringify(n,null,2));return}for(let[i,o]of Object.entries(n)){console.log(i);for(let[s,a]of Object.entries(o)){console.log(` ${s}`);for(let c of a)console.log(` - ${c.subject}`)}}},{supportsJsonOutput:!0})),Ae(e.command("state:inject-log <sid>").description("List or view per-boundary inject audit logs (D52)").option("--entry <file>","Print a specific inject-log entry")).action(Y(async(t,r)=>{let n=nRe(t,{entry:r.entry});if(ke(r))console.log(JSON.stringify(n,null,2));else console.log(pRe(n))},{supportsJsonOutput:!0})),Ae(e.command("state:summary [sid]").alias("state:mirror").description("Export a session summary to the coordination store").option("--category <category>","Active category lookup","main")).action(Y(async(t,r)=>{let n=Pq({projectDir:De(),sid:t,category:r.category}),i=await W_({projectDir:De(),sid:n});if(ke(r))console.log(JSON.stringify(i,null,2));else console.log(qTe(i));if(!i.written)process.exitCode=1},{supportsJsonOutput:!0})),Ae(e.command("state:heal-check").description("Check whether self-healing is allowed for an agent").requiredOption("--agent <agentType>","Agent or skill type, e.g. debug")).action(Y(async(t)=>{let r=e_({workspace:De(),agentType:t.agent});if(ke(t))console.log(JSON.stringify(r,null,2));else console.log(t_(r));if(!r.ok)process.exitCode=1},{supportsJsonOutput:!0}))}var bRe=g(()=>{XTe();r_();CU();Cq();vt();xt();iRe();dRe();vRe();J_()});import{randomUUID as kRe}from"node:crypto";import{existsSync as zq,linkSync as Rjt,mkdirSync as Ijt,readdirSync as Ojt,readFileSync as Djt,unlinkSync as Ljt,writeFileSync as jjt}from"node:fs";import{homedir as Mjt}from"node:os";import{isAbsolute as Njt,join as wv}from"node:path";function wRe(e){return/^(0|[1-9][0-9]{0,9})$/.test(e)}function Fjt(){let e=process.env.OMA_STATE_HOME??wv(Mjt(),".oma");if(!Njt(e))throw Error("OMA_STATE_HOME must be absolute");return e}function ARe(){return wv(Fjt(),"u")}function Fq(e){return Bq(e),wv(ARe(),e)}function i1(e){let t=wv(Fq(e),"profile.json");if(!zq(t))return null;let r;try{r=JSON.parse(Djt(t,"utf-8"))}catch{throw Error(`Invalid local profile: ${t}`)}if(!zjt(r,e))throw Error(`Invalid local profile: ${t}`);return r}function xRe(){let e=Ni(),t=ARe();if(!zq(t))return[];let r=[];for(let n of Ojt(t,{withFileTypes:!0})){if(!n.isDirectory()||!wRe(n.name))continue;let i=i1(n.name);if(i)r.push({slot:n.name,selected:n.name===e,profile:i})}return r.sort((n,i)=>Number(n.slot)-Number(i.slot))}function X_(){let e=Ni();return{slot:e,selected:!0,profile:i1(e)}}function SRe(e){Bq(e);let t=wv(Fq(e),"profile.json"),r={schemaVersion:1,slot:e,profileId:kRe(),createdAt:new Date().toISOString(),account:null};Ijt(Fq(e),{recursive:!0,mode:448});let n=`${t}.${kRe()}.tmp`;try{jjt(n,`${JSON.stringify(r,null,2)}
1647
- `,{mode:384});try{return Rjt(n,t),r}catch(o){if(o.code!=="EEXIST")throw o}}finally{if(zq(n))Ljt(n)}let i=i1(e);if(!i)throw Error(`Unable to create local profile: ${t}`);return i}function ERe(e,t){if(Bq(e),t==="fish")return`set -gx OMA_PROFILE ${e}`;return`export OMA_PROFILE=${Bjt(e)}`}function Bq(e){if(!wRe(e))throw Error("Profile slot must be a non-negative decimal number")}function zjt(e,t){if(!e||typeof e!=="object")return!1;let r=e;return r.schemaVersion===1&&r.slot===t&&typeof r.profileId==="string"&&r.profileId.length>0&&typeof r.createdAt==="string"&&(r.account===null||typeof r.account==="object"&&r.account!==null&&typeof r.account.issuer==="string"&&typeof r.account.subject==="string")}function Bjt(e){return`'${e.replaceAll("'","'\\\"'\\\"'")}'`}var Uq=g(()=>{kp()});import{spawnSync as Ujt}from"node:child_process";import{constants as Gjt}from"node:os";function $Re(e,t,r){if(!i1(e))throw Error(`Profile ${e} does not exist. Create it with: oma profile create ${e}`);let n=Ujt(t,r,{env:{...process.env,OMA_PROFILE:e},stdio:"inherit"});if(n.error)throw n.error;if(n.status!==null)return n.status;if(n.signal)return 128+(Gjt.signals[n.signal]??1);return 1}var CRe=g(()=>{Uq()});function Wjt(e){let t=e.command("profile").description("Manage local OMA execution profiles");Ae(t.command("list").description("List local profiles")).action(Y(async(r)=>{let n=xRe();if(ke(r)){console.log(JSON.stringify(n,null,2));return}if(n.length===0){console.log("No local profiles. Create one with: oma profile create 0");return}for(let i of n)console.log(`${i.selected?"*":" "} ${i.slot} ${i.profile?.profileId}`)},{supportsJsonOutput:!0})),Ae(t.command("show [slot]").description("Show a local profile")).action(Y(async(r,n)=>{let i=r?{slot:r,selected:r===X_().slot,profile:i1(r)}:X_();if(ke(n)){console.log(JSON.stringify(i,null,2));return}if(!i.profile){console.log(`Profile ${i.slot} has not been created.`);return}console.log(`Profile ${i.slot}`),console.log(`ID: ${i.profile.profileId}`),console.log(`Created: ${i.profile.createdAt}`)},{supportsJsonOutput:!0})),Ae(t.command("create <slot>").description("Create a local profile")).action(Y(async(r,n)=>{let i=SRe(r);if(ke(n))console.log(JSON.stringify(i,null,2));else console.log(`Created profile ${i.slot}: ${i.profileId}`)},{supportsJsonOutput:!0})),Ae(t.command("use <slot>").description("Print shell code to activate an existing profile").option("--shell <shell>","Target shell: sh, bash, zsh, or fish")).action(Y(async(r,n)=>{if(!i1(r))throw Error(`Profile ${r} does not exist. Create it with: oma profile create ${r}`);let i=n.shell;if(i!==void 0){if(!Hjt.has(i))throw Error("Unsupported shell. Use sh, bash, zsh, or fish");let o=ERe(r,i);if(ke(n))console.log(JSON.stringify({slot:r,shell:i,activation:o},null,2));else console.log(o);return}if(ke(n)){console.log(JSON.stringify({slot:r,selected:!1},null,2));return}console.log(`Profile ${r} ${X_().slot===r?"is already":"is not"} selected in this process. This command cannot change the parent shell.`),console.log(`Activate it with: eval "$(oma profile use ${r} --shell zsh)"`)},{supportsJsonOutput:!0})),t.command("run <slot> <command> [args...]").description("Run one command with OMA_PROFILE set for the child process").allowUnknownOption(!0).allowExcessArguments(!0).action((r,n,i)=>{process.exitCode=$Re(r,n,i)})}var Hjt;var _Re=g(()=>{Uq();vt();CRe();Hjt=new Set(["sh","bash","zsh","fish"])});import{createHash as Vjt}from"node:crypto";import{existsSync as qjt,readFileSync as Kjt}from"node:fs";import{join as Jjt}from"node:path";function xv(e,t){if(!/^[\w-]+$/.test(t))throw Error("Invalid session ID for plan lookup");return Jjt(e,".agents/results",`plan-${t}.json`)}function hh(e,t,r){let n=xv(e,t);if(!qjt(n))return null;let i=Re({tasks:Wt(Re({id:o1}).passthrough())}).parse(JSON.parse(Kjt(n,"utf8"))),o=i.tasks.map((c)=>c.id);if(new Set(o).size!==o.length)throw Error("Plan task IDs must be unique");let s=i.tasks.find((c)=>c.id===r);if(!s?.required_checks)return null;let a=Av.parse(s);if(a.dependencies.some((c)=>!o.includes(c)))throw Error("Plan dependency refers to an unknown task");return a}function PRe(e){return Vjt("sha256").update(JSON.stringify(e)).digest("hex")}function Sv(e,t,r,n){try{return PRe(hh(e,t,r))===PRe(n??null)}catch{return!1}}var o1,TRe,Yjt,Av;var Z_=g(()=>{Wa();o1=J().trim().min(1),TRe=o1.refine((e)=>!/^(?:\/|\\|[a-z]:)/i.test(e)&&!e.split(/[\\/]/).includes("..")&&!/[\0*?[\]{}]/.test(e),"Use a project-relative file or directory, without traversal or globs"),Yjt=Re({id:o1,criteria:Wt(o1).min(1),command:Wt(J()).min(1).refine((e)=>Boolean(e[0]?.trim()),"Executable is required"),cwd:TRe.default(".")}),Av=Re({id:o1,acceptance_criteria:Wt(Re({id:o1,description:o1})).min(1),required_checks:Wt(Yjt).min(1),inputs:Wt(TRe).min(1).optional(),dependencies:Wt(o1).default([]),retry_policy:Tt(["safe","manual"]).default("manual")}).superRefine((e,t)=>{let r=new Set(e.acceptance_criteria.map((s)=>s.id)),n=new Set(e.required_checks.map((s)=>s.id)),i=new Set(e.required_checks.map((s)=>JSON.stringify([s.command,s.cwd]))),o=new Set(e.required_checks.flatMap((s)=>s.criteria));if(r.size!==e.acceptance_criteria.length||n.size!==e.required_checks.length)t.addIssue({code:"custom",message:"Criterion and check IDs must be unique"});if(i.size!==e.required_checks.length)t.addIssue({code:"custom",message:"Use one check with multiple criteria for an identical command and cwd"});if([...o].some((s)=>!r.has(s))||[...r].some((s)=>!o.has(s)))t.addIssue({code:"custom",message:"Every acceptance criterion needs a declared check; references must exist"});if(e.dependencies.includes(e.id)||new Set(e.dependencies).size!==e.dependencies.length)t.addIssue({code:"custom",message:"Task dependencies must be unique and cannot include the task itself"})})});import{execFileSync as Gq,spawnSync as Xjt}from"node:child_process";import{createHash as Wq,randomUUID as Zjt}from"node:crypto";import{existsSync as RRe,lstatSync as Q_,readdirSync as Vq,readFileSync as a3,readlinkSync as Qjt}from"node:fs";import{isAbsolute as eMt,join as s3,relative as IRe,resolve as xa,sep as tMt}from"node:path";function eP(e){return Wq("sha256").update(e).digest("hex")}function rP(e,t){if(t){let s=xa(e),a=Wq("sha256"),c=(l)=>{if(Hq.test(l)||l===".git"||l.startsWith(".git/"))return;let u=xa(s,l);a.update(`${l}\x00`);try{let d=Q_(u);if(a.update(`${d.mode}\x00`),d.isSymbolicLink())throw Error(`Scoped inputs cannot follow symlinks: ${l}`);if(d.isDirectory())for(let p of Vq(u).sort())c(l?`${l}/${p}`:p);else if(d.isFile())a.update(eP(a3(u)))}catch(d){if(d.code!=="ENOENT")throw d;a.update("missing")}a.update("\x00")};for(let l of[...new Set(t.map((u)=>IRe(s,xa(s,u)).replaceAll("\\","/")))].sort()){let u=s;for(let d of l.split("/").filter(Boolean)){u=s3(u,d);try{if(Q_(u).isSymbolicLink())throw Error(`Scoped inputs cannot follow symlinks: ${l}`)}catch(p){if(p.code!=="ENOENT")throw p;break}}c(l)}return a.digest("hex")}let r=xa(e),n="unversioned",i;try{r=Gq("git",["rev-parse","--show-toplevel"],{cwd:r,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim(),i=Gq("git",["ls-files","-z","--cached","--others","--exclude-standard"],{cwd:r,encoding:"utf8",maxBuffer:33554432}).split("\x00").filter(Boolean);try{n=Gq("git",["rev-parse","HEAD"],{cwd:r,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{n="unborn"}}catch{i=[];let s=(a)=>{for(let c of Vq(s3(r,a),{withFileTypes:!0})){if([".git","node_modules"].includes(c.name))continue;let l=a?`${a}/${c.name}`:c.name;if(Hq.test(l))continue;if(c.isDirectory())s(l);else i.push(l)}};s("")}let o=Wq("sha256").update(`${n}\x00`);for(let s of[...new Set(i)].filter((a)=>!Hq.test(a)).sort()){o.update(`${s}\x00`);try{let a=s3(r,s),c=Q_(a);if(o.update(`${c.mode}\x00`),c.isSymbolicLink())o.update(Qjt(a));else if(c.isFile())o.update(eP(a3(a)));else o.update("directory")}catch(a){if(a.code!=="ENOENT")throw a;o.update("deleted")}o.update("\x00")}return o.digest("hex")}function $v(e,t){if(!/^[a-zA-Z0-9_-]+$/.test(t))throw Error("Invalid agent run ID");return s3(e,".agents/state/agent-runs",`${t}.json`)}function nP(e,t){return $v(e,t).replace(/\.json$/,".claim.json")}function Yl(e,t){let r=nMt.parse(JSON.parse(a3($v(e,t),"utf8")));if(r.runId!==t)throw Error("Invalid agent run record");return r}function gh(e){let t=hh(e.root,e.sessionId,e.taskId)??void 0;if(e.resumedFrom){let n=Yl(e.root,e.resumedFrom);if(n.sessionId!==e.sessionId||n.taskId!==e.taskId)throw Error("A retry must belong to the same session and task")}let r={schemaVersion:1,runId:Zjt(),sequence:0,taskId:e.taskId,sessionId:e.sessionId,agentId:e.agentId,vendor:e.vendor,runnerPid:e.managed?process.pid:void 0,workspace:xa(e.workspace),artifactRoot:xa(e.root),startedAt:new Date().toISOString(),status:"running",before:rP(t?.inputs?e.root:e.workspace,t?.inputs),contract:t,dispatch:e.dispatch,resumedFrom:e.resumedFrom,checks:[],changedFiles:[],unresolved:[],artifacts:{}};return p2(e.root,()=>{let n=s3(e.root,".agents/state/agent-runs/_sequence.json"),i=RRe(n)?JSON.parse(a3(n,"utf8")):0;if(typeof i!=="number"||!Number.isSafeInteger(i)||i<0)throw Error("Invalid agent run sequence");return r.sequence=i+1,Cn(n,r.sequence),Cn($v(e.root,r.runId),r),r})}function iP(e,t,r=!1){if(r)return`## Read-only result contract
1647
+ `,{mode:384});try{return Rjt(n,t),r}catch(o){if(o.code!=="EEXIST")throw o}}finally{if(zq(n))Ljt(n)}let i=i1(e);if(!i)throw Error(`Unable to create local profile: ${t}`);return i}function ERe(e,t){if(Bq(e),t==="fish")return`set -gx OMA_PROFILE ${e}`;return`export OMA_PROFILE=${Bjt(e)}`}function Bq(e){if(!wRe(e))throw Error("Profile slot must be a non-negative decimal number")}function zjt(e,t){if(!e||typeof e!=="object")return!1;let r=e;return r.schemaVersion===1&&r.slot===t&&typeof r.profileId==="string"&&r.profileId.length>0&&typeof r.createdAt==="string"&&(r.account===null||typeof r.account==="object"&&r.account!==null&&typeof r.account.issuer==="string"&&typeof r.account.subject==="string")}function Bjt(e){return`'${e.replaceAll("'","'\\\"'\\\"'")}'`}var Uq=g(()=>{kp()});import{spawnSync as Ujt}from"node:child_process";import{constants as Gjt}from"node:os";function $Re(e,t,r){if(!i1(e))throw Error(`Profile ${e} does not exist. Create it with: oma profile create ${e}`);let n=Ujt(t,r,{env:{...process.env,OMA_PROFILE:e},stdio:"inherit"});if(n.error)throw n.error;if(n.status!==null)return n.status;if(n.signal)return 128+(Gjt.signals[n.signal]??1);return 1}var CRe=g(()=>{Uq()});function Wjt(e){let t=e.command("profile").description("Manage local OMA execution profiles");Ae(t.command("list").description("List local profiles")).action(Y(async(r)=>{let n=xRe();if(ke(r)){console.log(JSON.stringify(n,null,2));return}if(n.length===0){console.log("No local profiles. Create one with: oma profile create 0");return}for(let i of n)console.log(`${i.selected?"*":" "} ${i.slot} ${i.profile?.profileId}`)},{supportsJsonOutput:!0})),Ae(t.command("show [slot]").description("Show a local profile")).action(Y(async(r,n)=>{let i=r?{slot:r,selected:r===X_().slot,profile:i1(r)}:X_();if(ke(n)){console.log(JSON.stringify(i,null,2));return}if(!i.profile){console.log(`Profile ${i.slot} has not been created.`);return}console.log(`Profile ${i.slot}`),console.log(`ID: ${i.profile.profileId}`),console.log(`Created: ${i.profile.createdAt}`)},{supportsJsonOutput:!0})),Ae(t.command("create <slot>").description("Create a local profile")).action(Y(async(r,n)=>{let i=SRe(r);if(ke(n))console.log(JSON.stringify(i,null,2));else console.log(`Created profile ${i.slot}: ${i.profileId}`)},{supportsJsonOutput:!0})),Ae(t.command("use <slot>").description("Print shell code to activate an existing profile").option("--shell <shell>","Target shell: sh, bash, zsh, or fish")).action(Y(async(r,n)=>{if(!i1(r))throw Error(`Profile ${r} does not exist. Create it with: oma profile create ${r}`);let i=n.shell;if(i!==void 0){if(!Hjt.has(i))throw Error("Unsupported shell. Use sh, bash, zsh, or fish");let o=ERe(r,i);if(ke(n))console.log(JSON.stringify({slot:r,shell:i,activation:o},null,2));else console.log(o);return}if(ke(n)){console.log(JSON.stringify({slot:r,selected:!1},null,2));return}console.log(`Profile ${r} ${X_().slot===r?"is already":"is not"} selected in this process. This command cannot change the parent shell.`),console.log(`Activate it with: eval "$(oma profile use ${r} --shell zsh)"`)},{supportsJsonOutput:!0})),t.command("run <slot> <command> [args...]").description("Run one command with OMA_PROFILE set for the child process").allowUnknownOption(!0).allowExcessArguments(!0).action((r,n,i)=>{process.exitCode=$Re(r,n,i)})}var Hjt;var _Re=g(()=>{Uq();vt();CRe();Hjt=new Set(["sh","bash","zsh","fish"])});import{createHash as Vjt}from"node:crypto";import{existsSync as qjt,readFileSync as Kjt}from"node:fs";import{join as Jjt}from"node:path";function xv(e,t){if(!/^[\w-]+$/.test(t))throw Error("Invalid session ID for plan lookup");return Jjt(e,".agents/results",`plan-${t}.json`)}function hh(e,t,r){let n=xv(e,t);if(!qjt(n))return null;let i;try{i=JSON.parse(Kjt(n,"utf8"))}catch(l){let u=l instanceof Error?l.message:String(l);throw Error(`Invalid session plan JSON at ${n}: ${u}`)}let o=Re({tasks:Wt(Re({id:o1}).passthrough())}).parse(i),s=o.tasks.map((l)=>l.id);if(new Set(s).size!==s.length)throw Error("Plan task IDs must be unique");let a=o.tasks.find((l)=>l.id===r);if(!a?.required_checks)return null;let c=Av.parse(a);if(c.dependencies.some((l)=>!s.includes(l)))throw Error("Plan dependency refers to an unknown task");return c}function PRe(e){return Vjt("sha256").update(JSON.stringify(e)).digest("hex")}function Sv(e,t,r,n){try{return PRe(hh(e,t,r))===PRe(n??null)}catch{return!1}}var o1,TRe,Yjt,Av;var Z_=g(()=>{Wa();o1=J().trim().min(1),TRe=o1.refine((e)=>!/^(?:\/|\\|[a-z]:)/i.test(e)&&!e.split(/[\\/]/).includes("..")&&!/[\0*?[\]{}]/.test(e),"Use a project-relative file or directory, without traversal or globs"),Yjt=Re({id:o1,criteria:Wt(o1).min(1),command:Wt(J()).min(1).refine((e)=>Boolean(e[0]?.trim()),"Executable is required"),cwd:TRe.default(".")}),Av=Re({id:o1,acceptance_criteria:Wt(Re({id:o1,description:o1})).min(1),required_checks:Wt(Yjt).min(1),inputs:Wt(TRe).min(1).optional(),dependencies:Wt(o1).default([]),retry_policy:Tt(["safe","manual"]).default("manual")}).superRefine((e,t)=>{let r=new Set(e.acceptance_criteria.map((s)=>s.id)),n=new Set(e.required_checks.map((s)=>s.id)),i=new Set(e.required_checks.map((s)=>JSON.stringify([s.command,s.cwd]))),o=new Set(e.required_checks.flatMap((s)=>s.criteria));if(r.size!==e.acceptance_criteria.length||n.size!==e.required_checks.length)t.addIssue({code:"custom",message:"Criterion and check IDs must be unique"});if(i.size!==e.required_checks.length)t.addIssue({code:"custom",message:"Use one check with multiple criteria for an identical command and cwd"});if([...o].some((s)=>!r.has(s))||[...r].some((s)=>!o.has(s)))t.addIssue({code:"custom",message:"Every acceptance criterion needs a declared check; references must exist"});if(e.dependencies.includes(e.id)||new Set(e.dependencies).size!==e.dependencies.length)t.addIssue({code:"custom",message:"Task dependencies must be unique and cannot include the task itself"})})});import{execFileSync as Gq,spawnSync as Xjt}from"node:child_process";import{createHash as Wq,randomUUID as Zjt}from"node:crypto";import{existsSync as RRe,lstatSync as Q_,readdirSync as Vq,readFileSync as a3,readlinkSync as Qjt}from"node:fs";import{isAbsolute as eMt,join as s3,relative as IRe,resolve as xa,sep as tMt}from"node:path";function eP(e){return Wq("sha256").update(e).digest("hex")}function rP(e,t){if(t){let s=xa(e),a=Wq("sha256"),c=(l)=>{if(Hq.test(l)||l===".git"||l.startsWith(".git/"))return;let u=xa(s,l);a.update(`${l}\x00`);try{let d=Q_(u);if(a.update(`${d.mode}\x00`),d.isSymbolicLink())throw Error(`Scoped inputs cannot follow symlinks: ${l}`);if(d.isDirectory())for(let p of Vq(u).sort())c(l?`${l}/${p}`:p);else if(d.isFile())a.update(eP(a3(u)))}catch(d){if(d.code!=="ENOENT")throw d;a.update("missing")}a.update("\x00")};for(let l of[...new Set(t.map((u)=>IRe(s,xa(s,u)).replaceAll("\\","/")))].sort()){let u=s;for(let d of l.split("/").filter(Boolean)){u=s3(u,d);try{if(Q_(u).isSymbolicLink())throw Error(`Scoped inputs cannot follow symlinks: ${l}`)}catch(p){if(p.code!=="ENOENT")throw p;break}}c(l)}return a.digest("hex")}let r=xa(e),n="unversioned",i;try{r=Gq("git",["rev-parse","--show-toplevel"],{cwd:r,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim(),i=Gq("git",["ls-files","-z","--cached","--others","--exclude-standard"],{cwd:r,encoding:"utf8",maxBuffer:33554432}).split("\x00").filter(Boolean);try{n=Gq("git",["rev-parse","HEAD"],{cwd:r,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{n="unborn"}}catch{i=[];let s=(a)=>{for(let c of Vq(s3(r,a),{withFileTypes:!0})){if([".git","node_modules"].includes(c.name))continue;let l=a?`${a}/${c.name}`:c.name;if(Hq.test(l))continue;if(c.isDirectory())s(l);else i.push(l)}};s("")}let o=Wq("sha256").update(`${n}\x00`);for(let s of[...new Set(i)].filter((a)=>!Hq.test(a)).sort()){o.update(`${s}\x00`);try{let a=s3(r,s),c=Q_(a);if(o.update(`${c.mode}\x00`),c.isSymbolicLink())o.update(Qjt(a));else if(c.isFile())o.update(eP(a3(a)));else o.update("directory")}catch(a){if(a.code!=="ENOENT")throw a;o.update("deleted")}o.update("\x00")}return o.digest("hex")}function $v(e,t){if(!/^[a-zA-Z0-9_-]+$/.test(t))throw Error("Invalid agent run ID");return s3(e,".agents/state/agent-runs",`${t}.json`)}function nP(e,t){return $v(e,t).replace(/\.json$/,".claim.json")}function Yl(e,t){let r=nMt.parse(JSON.parse(a3($v(e,t),"utf8")));if(r.runId!==t)throw Error("Invalid agent run record");return r}function gh(e){let t=hh(e.root,e.sessionId,e.taskId)??void 0;if(e.resumedFrom){let n=Yl(e.root,e.resumedFrom);if(n.sessionId!==e.sessionId||n.taskId!==e.taskId)throw Error("A retry must belong to the same session and task")}let r={schemaVersion:1,runId:Zjt(),sequence:0,taskId:e.taskId,sessionId:e.sessionId,agentId:e.agentId,vendor:e.vendor,runnerPid:e.managed?process.pid:void 0,workspace:xa(e.workspace),artifactRoot:xa(e.root),startedAt:new Date().toISOString(),status:"running",before:rP(t?.inputs?e.root:e.workspace,t?.inputs),contract:t,dispatch:e.dispatch,resumedFrom:e.resumedFrom,checks:[],changedFiles:[],unresolved:[],artifacts:{}};return p2(e.root,()=>{let n=s3(e.root,".agents/state/agent-runs/_sequence.json"),i=RRe(n)?JSON.parse(a3(n,"utf8")):0;if(typeof i!=="number"||!Number.isSafeInteger(i)||i<0)throw Error("Invalid agent run sequence");return r.sequence=i+1,Cn(n,r.sequence),Cn($v(e.root,r.runId),r),r})}function iP(e,t,r=!1){if(r)return`## Read-only result contract
1648
1648
  Run ${t.runId}, task ${t.taskId}, session ${t.sessionId}. Do not write coordination or result files. Return one final line: OMA_RESULT_JSON: {"status":"completed|partial|blocked|failed","changedFiles":[],"unresolved":[],"artifacts":[],"verificationSkipped":"specific explanation of the read-only inspection performed"}. The parent records this inspection; it does not count as executable verification.
1649
1649
  `;return`## Execution result contract
1650
1650
  Run: ${t.runId}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-agent",
3
- "version": "14.7.2",
3
+ "version": "14.7.3",
4
4
  "description": "Portable multi-agent harness for .agents-based skills and workflows across Antigravity, Claude Code, Codex, OpenCode, and more",
5
5
  "type": "module",
6
6
  "bin": {