agestra 4.8.1 → 4.8.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.
@@ -12,7 +12,7 @@
12
12
  "name": "agestra",
13
13
  "source": "./",
14
14
  "description": "Orchestrate Ollama, Gemini, and Codex for multi-AI debates, cross-validation, and GraphRAG memory",
15
- "version": "4.8.1",
15
+ "version": "4.8.3",
16
16
  "author": {
17
17
  "name": "mua-vtuber"
18
18
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agestra",
3
- "version": "4.8.1",
3
+ "version": "4.8.3",
4
4
  "description": "Claude Code plugin — orchestrate Ollama, Gemini, and Codex for multi-AI debates, cross-validation, and GraphRAG memory",
5
5
  "mcpServers": {
6
6
  "agestra": {
@@ -18,7 +18,7 @@ If `$ARGUMENTS` is empty, present a starting-point choice using AskUserQuestion
18
18
  | **Use recent context** | Organize ideas from the current conversation into a design subject |
19
19
 
20
20
  - If **"Describe an idea"**: ask a follow-up "What would you like to design?" and proceed.
21
- - If **"Find ideas first"**: run the `agestra-ideator` agent (or `/agestra idea`) to generate suggestions. After the user selects an idea from the results, continue to Step 2 with that as the subject.
21
+ - If **"Find ideas first"**: run the `agestra:agestra-ideator` agent (or `/agestra idea`) to generate suggestions. After the user selects an idea from the results, continue to Step 2 with that as the subject.
22
22
  - If **"Use recent context"**: scan the current conversation for previously discussed ideas, improvements, or features. Summarize them and ask the user which to design.
23
23
 
24
24
  If `$ARGUMENTS` is provided, use it directly as the subject.
@@ -27,17 +27,17 @@ If `$ARGUMENTS` is provided, use it directly as the subject.
27
27
 
28
28
  Call `environment_check` to determine which providers and modes are available.
29
29
 
30
- - If **no providers are available**: run the `agestra-designer` agent directly (Claude only) with the subject as context. The designer will ask questions to understand intent, explore the codebase for existing patterns, propose 2-3 approaches with trade-offs, refine based on feedback, and produce a design document in `docs/plans/`. Skip to presenting the result.
30
+ - If **no providers are available**: run the `agestra:agestra-designer` agent directly (Claude only) with the subject as context. The designer will ask questions to understand intent, explore the codebase for existing patterns, propose 2-3 approaches with trade-offs, refine based on feedback, and produce a design document in `docs/plans/`. Skip to presenting the result.
31
31
  - If **1+ providers are available**: proceed to 끝장토론 execution below.
32
32
 
33
33
  ## Step 3: Execute 끝장토론
34
34
 
35
- **팀 구성:** `agestra-moderator` (리더) + `agestra-designer` (Claude) + 사용 가능한 외부 AI (gemini, codex, ollama 등)
35
+ **팀 구성:** `agestra:agestra-moderator` (리더) + `agestra:agestra-designer` (Claude) + 사용 가능한 외부 AI (gemini, codex, ollama 등)
36
36
 
37
37
  1. Independent work + initial aggregation:
38
38
 
39
39
  a. In parallel:
40
- - Spawn the `agestra-designer` agent for Claude's independent architecture exploration.
40
+ - Spawn the `agestra:agestra-designer` agent for Claude's independent architecture exploration.
41
41
  After the agent completes, save Claude's result as a document via `workspace_create_document`:
42
42
  - **title:** `Architecture Design — claude/designer`
43
43
  - **metadata:** `{ "Provider": "claude/designer", "Task": "{subject}", "Mode": "Independent" }`
@@ -53,7 +53,7 @@ Call `environment_check` to determine which providers and modes are available.
53
53
 
54
54
  b. Collect all document IDs.
55
55
 
56
- c. Spawn the `agestra-moderator` agent in **Independent Aggregation** mode:
56
+ c. Spawn the `agestra:agestra-moderator` agent in **Independent Aggregation** mode:
57
57
  - Pass the **document ID list**.
58
58
  - Moderator reads each document via `workspace_read`.
59
59
  - Moderator classifies: consensus approaches, unique ideas, disputed trade-offs.
@@ -62,7 +62,7 @@ Call `environment_check` to determine which providers and modes are available.
62
62
 
63
63
  2. Document review rounds (no max — until all agree):
64
64
  a. Moderator sends the current document to each AI for review:
65
- - Claude: spawn `agestra-designer` → analyze document → write section-by-section feedback
65
+ - Claude: spawn `agestra:agestra-designer` → analyze document → write section-by-section feedback
66
66
  - Other providers: `agent_debate_turn` with the document as prompt, requesting agree/disagree per section
67
67
  b. Moderator collects all feedback.
68
68
  c. Classify: agree/disagree per section per provider.
package/commands/idea.md CHANGED
@@ -16,17 +16,17 @@ If `$ARGUMENTS` is empty, ask the user what area to explore using AskUserQuestio
16
16
 
17
17
  Call `environment_check` to determine which providers and modes are available.
18
18
 
19
- - If **no providers are available**: run the `agestra-ideator` agent directly (Claude only) with the topic as context. The ideator will research similar projects, collect user complaints, build feature comparisons, and generate prioritized recommendations. Skip to presenting the result.
19
+ - If **no providers are available**: run the `agestra:agestra-ideator` agent directly (Claude only) with the topic as context. The ideator will research similar projects, collect user complaints, build feature comparisons, and generate prioritized recommendations. Skip to presenting the result.
20
20
  - If **1+ providers are available**: proceed to 끝장토론 execution below.
21
21
 
22
22
  ## Step 3: Execute 끝장토론
23
23
 
24
- **팀 구성:** `agestra-moderator` (리더) + `agestra-ideator` (Claude) + 사용 가능한 외부 AI (gemini, codex, ollama 등)
24
+ **팀 구성:** `agestra:agestra-moderator` (리더) + `agestra:agestra-ideator` (Claude) + 사용 가능한 외부 AI (gemini, codex, ollama 등)
25
25
 
26
26
  1. Independent work + initial aggregation:
27
27
 
28
28
  a. In parallel:
29
- - Spawn the `agestra-ideator` agent for Claude's independent improvement research.
29
+ - Spawn the `agestra:agestra-ideator` agent for Claude's independent improvement research.
30
30
  After the agent completes, save Claude's result as a document via `workspace_create_document`:
31
31
  - **title:** `Idea Exploration — claude/ideator`
32
32
  - **metadata:** `{ "Provider": "claude/ideator", "Task": "{topic}", "Mode": "Independent" }`
@@ -38,7 +38,7 @@ Call `environment_check` to determine which providers and modes are available.
38
38
 
39
39
  b. Collect all document IDs.
40
40
 
41
- c. Spawn the `agestra-moderator` agent in **Independent Aggregation** mode:
41
+ c. Spawn the `agestra:agestra-moderator` agent in **Independent Aggregation** mode:
42
42
  - Pass the **document ID list**.
43
43
  - Moderator reads each document via `workspace_read`.
44
44
  - Moderator classifies: consensus suggestions, unique ideas, disputed priorities.
@@ -47,7 +47,7 @@ Call `environment_check` to determine which providers and modes are available.
47
47
 
48
48
  2. Document review rounds (no max — until all agree):
49
49
  a. Moderator sends the current document to each AI for review:
50
- - Claude: spawn `agestra-ideator` → analyze document → write section-by-section feedback
50
+ - Claude: spawn `agestra:agestra-ideator` → analyze document → write section-by-section feedback
51
51
  - Other providers: `agent_debate_turn` with the document as prompt, requesting agree/disagree per section
52
52
  b. Moderator collects all feedback.
53
53
  c. Classify: agree/disagree per section per provider.
@@ -36,20 +36,20 @@ If no recent design doc exists for the task:
36
36
  ## Step 5: Execute
37
37
 
38
38
  ### If "Claude only":
39
- Spawn `agestra-team-lead` in Claude-only mode with the task and current project context.
39
+ Spawn `agestra:agestra-team-lead` in Claude-only mode with the task and current project context.
40
40
 
41
41
  ### If "Multi-AI":
42
- Spawn `agestra-team-lead` in Multi-AI mode with:
42
+ Spawn `agestra:agestra-team-lead` in Multi-AI mode with:
43
43
  - environment capability map
44
44
  - available providers
45
45
  - instruction to use isolated CLI workers for suitable tasks
46
46
  - instruction to review changes with `agent_changes_review`
47
47
  - instruction to merge only after review
48
- - instruction to run `qa_run` and `agestra-qa` before final completion
48
+ - instruction to run `qa_run` and `agestra:agestra-qa` before final completion
49
49
 
50
50
  ## Step 6: Final verification
51
51
 
52
52
  Before reporting completion:
53
53
  1. Run `qa_run`
54
- 2. If deeper design-compliance verification is needed, spawn `agestra-qa`
54
+ 2. If deeper design-compliance verification is needed, spawn `agestra:agestra-qa`
55
55
  3. Summarize implementation result, review result, and QA outcome
@@ -47,7 +47,7 @@ Pass the selected focus areas to all reviewers (agent and external AIs) as part
47
47
 
48
48
  Call `environment_check` to determine which providers and modes are available.
49
49
 
50
- - If **no providers are available**: run the `agestra-reviewer` agent directly (Claude only) with the target and selected focus areas as context. Skip to presenting the result.
50
+ - If **no providers are available**: run the `agestra:agestra-reviewer` agent directly (Claude only) with the target and selected focus areas as context. Skip to presenting the result.
51
51
  - If **1+ providers are available**: proceed to 끝장토론 execution below.
52
52
 
53
53
  ## Step 4: Execute 끝장토론
@@ -62,12 +62,12 @@ Call `environment_check` to determine which providers and modes are available.
62
62
  - If a background reviewer is still running, tell the user you are waiting and continue the orchestration. Do not short-circuit the workflow just because another provider finished earlier.
63
63
  - Do NOT use `agent_debate_moderate` as the primary review path. Use the turn-based flow (`agent_debate_create` + iterative `agent_debate_review` / `agent_debate_turn` + `agent_debate_conclude`) so long-running review rounds do not get cut off by host tool-call time limits.
64
64
 
65
- **팀 구성:** `agestra-moderator` (리더) + `agestra-reviewer` (Claude) + 리뷰용 외부 AI (`gemini`, `codex`, 등록된 Claude-backed reviewer 등; `ollama` 제외)
65
+ **팀 구성:** `agestra:agestra-moderator` (리더) + `agestra:agestra-reviewer` (Claude) + 리뷰용 외부 AI (`gemini`, `codex`, 등록된 Claude-backed reviewer 등; `ollama` 제외)
66
66
 
67
67
  1. Independent work + initial aggregation:
68
68
 
69
69
  a. In parallel:
70
- - Spawn the `agestra-reviewer` agent for Claude's independent analysis.
70
+ - Spawn the `agestra:agestra-reviewer` agent for Claude's independent analysis.
71
71
  After the agent completes, save Claude's result as a document via `workspace_create_document`:
72
72
  - **title:** `Code Review — claude/reviewer`
73
73
  - **metadata:** `{ "Provider": "claude/reviewer", "Task": "{review target}", "Focus": "{selected focus areas}", "Mode": "Independent" }`
@@ -84,7 +84,7 @@ Call `environment_check` to determine which providers and modes are available.
84
84
 
85
85
  b. Collect all document IDs.
86
86
 
87
- c. Spawn the `agestra-moderator` agent in **Independent Aggregation** mode:
87
+ c. Spawn the `agestra:agestra-moderator` agent in **Independent Aggregation** mode:
88
88
  - Pass the **document ID list**.
89
89
  - Moderator reads each document via `workspace_read`.
90
90
  - Moderator classifies: consensus findings, unique findings, disputed points.
package/dist/bundle.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as ___cr } from 'module';import { fileURLToPath as ___fu } from 'url';import { dirname as ___dn } from 'path';const __filename = ___fu(import.meta.url);const __dirname = ___dn(__filename);const require = ___cr(import.meta.url);
3
- var Fb=Object.create;var ec=Object.defineProperty;var Ub=Object.getOwnPropertyDescriptor;var Vb=Object.getOwnPropertyNames;var Wb=Object.getPrototypeOf,Bb=Object.prototype.hasOwnProperty;var an=(t,e)=>()=>(t&&(e=t(t=0)),e);var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),We=(t,e)=>{for(var r in e)ec(t,r,{get:e[r],enumerable:!0})},Hb=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Vb(e))!Bb.call(t,o)&&o!==r&&ec(t,o,{get:()=>e[o],enumerable:!(n=Ub(e,o))||n.enumerable});return t};var ap=(t,e,r)=>(r=t!=null?Fb(Wb(t)):{},Hb(e||!t||!t.__esModule?ec(r,"default",{value:t,enumerable:!0}):r,t));var cp,to,up,lp,dp,pp,fp,mp,hp,gp,yp,_p,vp,Ts,tc,xp,bp,ln,vr=an(()=>{"use strict";cp="4.8.1",to="http://localhost:11434",up="llama3",lp=".agestra/.jobs",dp=".agestra/traces",pp=".agestra/worktrees",fp=".agestra/sessions",mp=".agestra/workspace",hp=".agestra/messages",gp=".agestra/workers",yp=Object.freeze(["PATH","HOME","USER","USERPROFILE","APPDATA","LOCALAPPDATA","TEMP","TMP","TMPDIR","SHELL","LANG","LC_ALL","NODE_PATH","SystemRoot","SystemDrive","COMSPEC","ComSpec","windir"]),_p=2,vp=6e4,Ts=20,tc=5e4,xp="[REDACTED]",bp=["","--- REQUIRED RESPONSE FORMAT ---","Respond with JSON only, matching exactly this shape:",'{ "agrees": true | false, "feedback": "specific issues or why you agree", "suggestions": "concrete changes if you disagree (optional, may be omitted)" }',"No prose, markdown, or explanation outside the JSON object. The JSON must be the entire response or wrapped in a single ```json code fence.","-------------------------------"].join(`
3
+ var Fb=Object.create;var ec=Object.defineProperty;var Ub=Object.getOwnPropertyDescriptor;var Vb=Object.getOwnPropertyNames;var Wb=Object.getPrototypeOf,Bb=Object.prototype.hasOwnProperty;var an=(t,e)=>()=>(t&&(e=t(t=0)),e);var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),We=(t,e)=>{for(var r in e)ec(t,r,{get:e[r],enumerable:!0})},Hb=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Vb(e))!Bb.call(t,o)&&o!==r&&ec(t,o,{get:()=>e[o],enumerable:!(n=Ub(e,o))||n.enumerable});return t};var ap=(t,e,r)=>(r=t!=null?Fb(Wb(t)):{},Hb(e||!t||!t.__esModule?ec(r,"default",{value:t,enumerable:!0}):r,t));var cp,to,up,lp,dp,pp,fp,mp,hp,gp,yp,_p,vp,Ts,tc,xp,bp,ln,vr=an(()=>{"use strict";cp="4.8.3",to="http://localhost:11434",up="llama3",lp=".agestra/.jobs",dp=".agestra/traces",pp=".agestra/worktrees",fp=".agestra/sessions",mp=".agestra/workspace",hp=".agestra/messages",gp=".agestra/workers",yp=Object.freeze(["PATH","HOME","USER","USERPROFILE","APPDATA","LOCALAPPDATA","TEMP","TMP","TMPDIR","SHELL","LANG","LC_ALL","NODE_PATH","SystemRoot","SystemDrive","COMSPEC","ComSpec","windir"]),_p=2,vp=6e4,Ts=20,tc=5e4,xp="[REDACTED]",bp=["","--- REQUIRED RESPONSE FORMAT ---","Respond with JSON only, matching exactly this shape:",'{ "agrees": true | false, "feedback": "specific issues or why you agree", "suggestions": "concrete changes if you disagree (optional, may be omitted)" }',"No prose, markdown, or explanation outside the JSON object. The JSON must be the entire response or wrapped in a single ```json code fence.","-------------------------------"].join(`
4
4
  `),ln=Object.freeze({auto:Object.freeze({name:"auto",description:"Auto-detect build profile from project structure (package.json scripts, tsconfig, vitest config, etc.).",command:"npx",args:Object.freeze([])}),tsc:Object.freeze({name:"tsc",description:"TypeScript project-references build via `npx tsc -b --noEmit`.",command:"npx",args:Object.freeze(["tsc","-b","--noEmit"])}),vitest:Object.freeze({name:"vitest",description:"Run the Vitest unit-test suite in CI mode.",command:"npx",args:Object.freeze(["vitest","run","--reporter=dot"])}),"npm-build":Object.freeze({name:"npm-build",description:"Run the project's `npm run build` script.",command:"npm",args:Object.freeze(["run","build"])}),"npm-test":Object.freeze({name:"npm-test",description:"Run the project's `npm test` script.",command:"npm",args:Object.freeze(["test","--","--run"])})})});import{execFileSync as Gb}from"child_process";function dn(t){if(!Number.isFinite(t)||t<=0)return{delivered:!1};if(process.platform==="win32")try{return Gb("taskkill",["/PID",String(t),"/T","/F"],{stdio:"ignore",windowsHide:!0}),{delivered:!0}}catch{try{return process.kill(t),{delivered:!0}}catch{return{delivered:!1}}}try{return process.kill(-t,"SIGTERM"),{delivered:!0}}catch{try{return process.kill(t,"SIGTERM"),{delivered:!0}}catch{return{delivered:!1}}}}function Kt(t,e=3e3){let r=t.pid;if(r)dn(r);else try{t.kill("SIGTERM")}catch{}setTimeout(()=>{try{t.kill("SIGKILL")}catch{}},e)}var ro=an(()=>{"use strict"});import{execFileSync as Jb,spawn as Kb}from"child_process";import{existsSync as Qb}from"fs";function Xb(t){return process.platform!=="win32"||t.includes("/")||t.includes("\\")?!1:Yb.has(t.toLowerCase())}function ew(t){if(t.includes("\0"))throw new Error(`Windows shim arg contains null byte: ${JSON.stringify(t)}`);if(t.includes("%"))throw new Error(`Windows shim arg contains '%' which would trigger cmd.exe env expansion: ${JSON.stringify(t)}`);return/[\s"&^<>|()!]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function tw(t){let e=t.toLowerCase();if(pn.has(e))return pn.get(e)??null;try{let n=Jb("where.exe",[t],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],windowsHide:!0}).split(/\r?\n/).map(a=>a.trim()).filter(Boolean);if(n.length===0)return pn.set(e,null),null;let o=n.find(a=>/\.(cmd|bat)$/i.test(a));if(o){let a={type:"cmd",path:o};return pn.set(e,a),a}let i=`${n[0]}.ps1`;if(Qb(i)){let a={type:"powershell",path:i};return pn.set(e,a),a}}catch{}return pn.set(e,null),null}function Nt(t,e){if(!Xb(t))return{command:t,args:e};let r=tw(t);return r?r.type==="cmd"?{command:"cmd.exe",args:["/d","/s","/c",r.path,...e.map(n=>ew(n))]}:{command:"powershell.exe",args:["-NoProfile","-ExecutionPolicy","RemoteSigned","-File",r.path,...e]}:{command:t,args:e}}function De(t){let{command:e,args:r,timeout:n=12e4,cwd:o,env:s,stdin:i,maxBuffer:a=10485760,onStderrChunk:c}=t;return new Promise((u,l)=>{let d=Nt(e,r),p=Kb(d.command,d.args,{cwd:o,env:s?{...process.env,...s}:void 0,stdio:[i?"pipe":"ignore","pipe","pipe"],windowsHide:!0}),f="",g="",y=0,m=0,b=!1,_=null,w=!1,k=()=>{!w&&y+m>a&&(b=!0,w=!0,Kt(p))};p.stdout.on("data",j=>{y+=j.length,y<=a&&(f+=j.toString()),k()}),p.stderr.on("data",j=>{m+=j.length;let Se=j.toString();if(m<=a&&(g+=Se),k(),!w&&c){let Q=c(Se);Q&&(_=Q,w=!0,Kt(p))}}),i&&p.stdin&&(p.stdin.write(i),p.stdin.end());let P=()=>{Kt(p),l(new Error(`CLI timeout after ${n}ms of inactivity: ${e} ${r.join(" ")}`))},U=setTimeout(P,n),Z=()=>{clearTimeout(U),U=setTimeout(P,n)};p.stdout.on("data",Z),p.stderr.on("data",Z),p.on("close",j=>{if(clearTimeout(U),_){l(_);return}u({stdout:f,stderr:g,exitCode:j??1,truncated:b})}),p.on("error",j=>{clearTimeout(U),l(new Error(`CLI spawn error: ${j.message}`))})})}var Yb,pn,fn=an(()=>{"use strict";ro();Yb=new Set(["codex","gemini","npm","npx"]),pn=new Map});import{writeFileSync as v$,mkdirSync as io,openSync as ic,writeSync as ac,fsyncSync as Mp,closeSync as cc,renameSync as x$,unlinkSync as b$,appendFileSync as w$}from"fs";import{dirname as ao,join as $$}from"path";import{randomUUID as S$}from"crypto";function ie(t,e){let r=ao(t);io(r,{recursive:!0});let n=$$(r,`.tmp-${S$().slice(0,8)}`);try{v$(n,e,"utf-8"),x$(n,t)}catch(o){try{b$(n)}catch{}throw o}}function it(t,e){ie(t,JSON.stringify(e,null,2))}function co(t,e){let r=ao(t);io(r,{recursive:!0});let n=ic(t,"a");try{ac(n,e),Mp(n)}finally{cc(n)}}var Ns,js=an(()=>{"use strict";Ns=class{buffer=new Map;flushTimer=null;flushIntervalMs;maxBufferSize;auditFsync;destroyed=!1;constructor(e){this.flushIntervalMs=e?.flushIntervalMs??2e3,this.maxBufferSize=e?.maxBufferSize??100,this.auditFsync=e?.auditFsync??!0,this.flushIntervalMs>0&&(this.flushTimer=setInterval(()=>this.flush(),this.flushIntervalMs),this.flushTimer&&typeof this.flushTimer.unref=="function"&&this.flushTimer.unref())}append(e,r,n){if(this.destroyed)throw new Error("DurableAppendWriter has been destroyed");if(n==="audit"){if(this.auditFsync)co(e,r);else{let s=ao(e);io(s,{recursive:!0}),w$(e,r)}return}let o=this.buffer.get(e);o||(o=[],this.buffer.set(e,o)),o.push(r),o.length>=this.maxBufferSize&&this.flushFile(e),this.flushIntervalMs===0&&this.flushFile(e)}flush(){for(let e of this.buffer.keys())this.flushFile(e)}panicFlush(){for(let[e,r]of this.buffer)if(r.length!==0)try{let n=ao(e);io(n,{recursive:!0});let o=ic(e,"a");try{ac(o,r.join("")),Mp(o)}finally{cc(o)}}catch{}this.buffer.clear()}destroy(){this.destroyed||(this.destroyed=!0,this.flushTimer!==null&&(clearInterval(this.flushTimer),this.flushTimer=null),this.flush())}flushFile(e){let r=this.buffer.get(e);if(!r||r.length===0)return;let n=ao(e);io(n,{recursive:!0});let o=ic(e,"a");try{ac(o,r.join(""))}finally{cc(o)}this.buffer.delete(e)}}});import{existsSync as Np,realpathSync as k$}from"fs";import{basename as T$,dirname as P$,isAbsolute as Zp,join as E$,normalize as R$,resolve as uc,relative as z$}from"path";function C$(t){return t===""||!t.startsWith("..")&&!Zp(t)}function jp(t){let e=[],r=uc(t);for(;!Np(r);){let o=P$(r);if(o===r)break;e.unshift(T$(r)),r=o}let n=Np(r)?k$(r):r;return e.reduce((o,s)=>E$(o,s),n)}function qp(t,e){let r=jp(e),n=jp(t),o=z$(r,n);return C$(o)}function lc(t,e){let r=uc(e,t);return qp(r,e)}function ht(t,e){let r=uc(e,t);if(!qp(r,e))throw new Error(`Path traversal blocked: ${t} escapes ${e}`);return r}function Me(t,e){if(t.length===0)throw new Error("Filename must not be empty");if(t.includes("\0"))throw new Error(`Filename contains null byte: ${JSON.stringify(t)}`);if(t.includes("/")||t.includes("\\"))throw new Error(`Filename must not contain path separators: ${JSON.stringify(t)}`);if(t.includes(".."))throw new Error(`Filename must not contain '..': ${JSON.stringify(t)}`);return ht(t,e)}function Ft(t,e){if(Zp(t)){let r=R$(t);if(!lc(r,e))throw new Error(`Read path outside base directory: ${t} is not within ${e}`);return r}return ht(t,e)}function Ls(t){return A$.test(t)}function Zs(t,e){if(!t||typeof t!="string")throw new et(String(t),"command must be a non-empty string");if(t.includes("\0"))throw new et(t,"command contains null byte");if(t.includes("/")||t.includes("\\"))throw new et(t,"command must not contain path separators");if(!Lp.has(t))throw new et(t,`command is not in the allowlist (${[...Lp].join(", ")})`);for(let r of e){if(typeof r!="string")throw new et(t,`args contain a non-string entry: ${JSON.stringify(r)}`);if(r.includes("\0"))throw new et(t,`arg contains null byte: ${JSON.stringify(r)}`);if(I$.has(r))throw new et(t,`arg ${JSON.stringify(r)} is a code-execution flag and is not permitted`)}}var A$,Lp,I$,et,uo=an(()=>{"use strict";A$=/^[a-zA-Z0-9_-]+-\d+-[a-f0-9]{6}$/;Lp=new Set(["gemini","codex","npx","node","npm","tsc"]),I$=new Set(["-e","--eval","-c","--command","-E","--execute","--exec"]),et=class extends Error{command;reason;constructor(e,r){super(`CLI command rejected: ${e} \u2014 ${r}`),this.command=e,this.reason=r,this.name="CliCommandRejectedError"}}});var Vp={};We(Vp,{CLI_PROVIDERS:()=>Fp,resolveCliConfig:()=>Up});import{readFileSync as dc}from"fs";import{join as tt}from"path";import{spawn as D$}from"child_process";function Up(t){let e=O$[t.provider]??t.provider;return Fp[e]??null}function Nr(t,e){let r=tt(t,"status.json"),n=JSON.parse(dc(r,"utf-8"));it(r,{...n,...e})}async function M$(){let t=process.argv[2];t||process.exit(1);let e;try{e=JSON.parse(dc(tt(t,"job.json"),"utf-8"))}catch{try{it(tt(t,"status.json"),{id:"unknown",state:"error",provider:"unknown",completedAt:new Date().toISOString()}),ie(tt(t,"error.txt"),"Failed to read job.json")}catch{}process.exit(1)}let r=Up(e);r||(Nr(t,{state:"missing_cli",completedAt:new Date().toISOString()}),ie(tt(t,"error.txt"),`No CLI mapping for provider: ${e.provider}`),process.exit(1));let{command:n,buildArgs:o}=r;Nr(t,{state:"running",startedAt:new Date().toISOString()});let s=dc(tt(t,"prompt.txt"),"utf-8"),i=o(s);try{Zs(n,i)}catch(c){let u=c instanceof et?c.message:`Argv rejected: ${c.message}`;Nr(t,{state:"error",completedAt:new Date().toISOString()}),ie(tt(t,"error.txt"),u);return}let a;if(e.cwd)try{a=ht(e.cwd,process.cwd())}catch(c){Nr(t,{state:"error",completedAt:new Date().toISOString()}),ie(tt(t,"error.txt"),`Rejected descriptor.cwd: ${c.message}`);return}return new Promise(c=>{let u=Nt(n,i),l=D$(u.command,u.args,{cwd:a,stdio:["ignore","pipe","pipe"],windowsHide:!0}),d="",p="",f=0,g=0;l.stdout.on("data",m=>{f+=m.length,f<=10485760&&(d+=m.toString())}),l.stderr.on("data",m=>{g+=m.length,g<=10485760&&(p+=m.toString())});let y=setTimeout(()=>{Kt(l),ie(tt(t,"output.txt"),d),ie(tt(t,"error.txt"),p),Nr(t,{state:"timed_out",completedAt:new Date().toISOString()}),c()},e.timeout);l.on("close",m=>{clearTimeout(y),ie(tt(t,"output.txt"),d),ie(tt(t,"error.txt"),p);let b=d.trim().length>0;Nr(t,{state:m===0||b?"completed":"error",exitCode:m??1,completedAt:new Date().toISOString()}),c()}),l.on("error",m=>{clearTimeout(y);let b=m.code==="ENOENT"?"missing_cli":"error";ie(tt(t,"error.txt"),m.message),Nr(t,{state:b,completedAt:new Date().toISOString()}),c()})})}var O$,Fp,N$,Wp=an(()=>{"use strict";js();ro();uo();fn();O$={"gemini-cli":"gemini","codex-cli":"codex"},Fp={gemini:{command:"gemini",buildArgs:t=>["-p",t]},codex:{command:"codex",buildArgs:t=>["exec","--full-auto","--ephemeral",t]}};N$=process.argv[1]?.endsWith("job-worker.js")||process.argv[1]?.endsWith("job-worker.ts");N$&&M$().catch(()=>process.exit(1))});var Qo=E(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.regexpCode=ne.getEsmExportName=ne.getProperty=ne.safeStringify=ne.stringify=ne.strConcat=ne.addCodeArg=ne.str=ne._=ne.nil=ne._Code=ne.Name=ne.IDENTIFIER=ne._CodeOrName=void 0;var Jo=class{};ne._CodeOrName=Jo;ne.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Gr=class extends Jo{constructor(e){if(super(),!ne.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ne.Name=Gr;var lt=class extends Jo{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Gr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ne._Code=lt;ne.nil=new lt("");function jy(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Wu(r,e[n]),r.push(t[++n]);return new lt(r)}ne._=jy;var Vu=new lt("+");function Ly(t,...e){let r=[Ko(t[0])],n=0;for(;n<e.length;)r.push(Vu),Wu(r,e[n]),r.push(Vu,Ko(t[++n]));return RP(r),new lt(r)}ne.str=Ly;function Wu(t,e){e instanceof lt?t.push(...e._items):e instanceof Gr?t.push(e):t.push(AP(e))}ne.addCodeArg=Wu;function RP(t){let e=1;for(;e<t.length-1;){if(t[e]===Vu){let r=zP(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function zP(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Gr||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Gr))return`"${t}${e.slice(1)}`}function CP(t,e){return e.emptyStr()?t:t.emptyStr()?e:Ly`${t}${e}`}ne.strConcat=CP;function AP(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Ko(Array.isArray(t)?t.join(","):t)}function IP(t){return new lt(Ko(t))}ne.stringify=IP;function Ko(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ne.safeStringify=Ko;function DP(t){return typeof t=="string"&&ne.IDENTIFIER.test(t)?new lt(`.${t}`):jy`[${t}]`}ne.getProperty=DP;function OP(t){if(typeof t=="string"&&ne.IDENTIFIER.test(t))return new lt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ne.getEsmExportName=OP;function MP(t){return new lt(t.toString())}ne.regexpCode=MP});var Gu=E(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.ValueScope=Qe.ValueScopeName=Qe.Scope=Qe.varKinds=Qe.UsedValueState=void 0;var Ke=Qo(),Bu=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Vi;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Vi||(Qe.UsedValueState=Vi={}));Qe.varKinds={const:new Ke.Name("const"),let:new Ke.Name("let"),var:new Ke.Name("var")};var Wi=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Ke.Name?e:this.name(e)}name(e){return new Ke.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Qe.Scope=Wi;var Bi=class extends Ke.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Ke._)`.${new Ke.Name(r)}[${n}]`}};Qe.ValueScopeName=Bi;var NP=(0,Ke._)`\n`,Hu=class extends Wi{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?NP:Ke.nil}}get(){return this._scope}name(e){return new Bi(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Ke._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let s=Ke.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Vi.Started);let l=r(u);if(l){let d=this.opts.es5?Qe.varKinds.var:Qe.varKinds.const;s=(0,Ke._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,Ke._)`${s}${l}${this.opts._n}`;else throw new Bu(u);c.set(u,Vi.Completed)})}return s}};Qe.ValueScope=Hu});var B=E(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.or=H.and=H.not=H.CodeGen=H.operators=H.varKinds=H.ValueScopeName=H.ValueScope=H.Scope=H.Name=H.regexpCode=H.stringify=H.getProperty=H.nil=H.strConcat=H.str=H._=void 0;var te=Qo(),vt=Gu(),lr=Qo();Object.defineProperty(H,"_",{enumerable:!0,get:function(){return lr._}});Object.defineProperty(H,"str",{enumerable:!0,get:function(){return lr.str}});Object.defineProperty(H,"strConcat",{enumerable:!0,get:function(){return lr.strConcat}});Object.defineProperty(H,"nil",{enumerable:!0,get:function(){return lr.nil}});Object.defineProperty(H,"getProperty",{enumerable:!0,get:function(){return lr.getProperty}});Object.defineProperty(H,"stringify",{enumerable:!0,get:function(){return lr.stringify}});Object.defineProperty(H,"regexpCode",{enumerable:!0,get:function(){return lr.regexpCode}});Object.defineProperty(H,"Name",{enumerable:!0,get:function(){return lr.Name}});var Ki=Gu();Object.defineProperty(H,"Scope",{enumerable:!0,get:function(){return Ki.Scope}});Object.defineProperty(H,"ValueScope",{enumerable:!0,get:function(){return Ki.ValueScope}});Object.defineProperty(H,"ValueScopeName",{enumerable:!0,get:function(){return Ki.ValueScopeName}});Object.defineProperty(H,"varKinds",{enumerable:!0,get:function(){return Ki.varKinds}});H.operators={GT:new te._Code(">"),GTE:new te._Code(">="),LT:new te._Code("<"),LTE:new te._Code("<="),EQ:new te._Code("==="),NEQ:new te._Code("!=="),NOT:new te._Code("!"),OR:new te._Code("||"),AND:new te._Code("&&"),ADD:new te._Code("+")};var Wt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Ju=class extends Wt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?vt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Nn(this.rhs,e,r)),this}get names(){return this.rhs instanceof te._CodeOrName?this.rhs.names:{}}},Hi=class extends Wt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof te.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Nn(this.rhs,e,r),this}get names(){let e=this.lhs instanceof te.Name?{}:{...this.lhs.names};return Ji(e,this.rhs)}},Ku=class extends Hi{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Qu=class extends Wt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Yu=class extends Wt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Xu=class extends Wt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},el=class extends Wt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Nn(this.code,e,r),this}get names(){return this.code instanceof te._CodeOrName?this.code.names:{}}},Yo=class extends Wt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(e,r)||(jP(e,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Qr(e,r.names),{})}},Bt=class extends Yo{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},tl=class extends Yo{},Mn=class extends Bt{};Mn.kind="else";var Jr=class t extends Bt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Mn(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Zy(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Nn(this.condition,e,r),this}get names(){let e=super.names;return Ji(e,this.condition),this.else&&Qr(e,this.else.names),e}};Jr.kind="if";var Kr=class extends Bt{};Kr.kind="for";var rl=class extends Kr{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Nn(this.iteration,e,r),this}get names(){return Qr(super.names,this.iteration.names)}},nl=class extends Kr{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?vt.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=Ji(super.names,this.from);return Ji(e,this.to)}},Gi=class extends Kr{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Nn(this.iterable,e,r),this}get names(){return Qr(super.names,this.iterable.names)}},Xo=class extends Bt{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Xo.kind="func";var es=class extends Yo{render(e){return"return "+super.render(e)}};es.kind="return";var ol=class extends Bt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Qr(e,this.catch.names),this.finally&&Qr(e,this.finally.names),e}},ts=class extends Bt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};ts.kind="catch";var rs=class extends Bt{render(e){return"finally"+super.render(e)}};rs.kind="finally";var sl=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
5
5
  `:""},this._extScope=e,this._scope=new vt.Scope({parent:e}),this._nodes=[new tl]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Ju(e,s,n)),s}const(e,r,n){return this._def(vt.varKinds.const,e,r,n)}let(e,r,n){return this._def(vt.varKinds.let,e,r,n)}var(e,r,n){return this._def(vt.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Hi(e,r,n))}add(e,r){return this._leafNode(new Ku(e,H.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==te.nil&&this._leafNode(new el(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,te.addCodeArg)(r,o));return r.push("}"),new te._Code(r)}if(e,r,n){if(this._blockNode(new Jr(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Jr(e))}else(){return this._elseNode(new Mn)}endIf(){return this._endBlockNode(Jr,Mn)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new rl(e),r)}forRange(e,r,n,o,s=this.opts.es5?vt.varKinds.var:vt.varKinds.let){let i=this._scope.toName(e);return this._for(new nl(s,i,r,n),()=>o(i))}forOf(e,r,n,o=vt.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof te.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,te._)`${i}.length`,a=>{this.var(s,(0,te._)`${i}[${a}]`),n(s)})}return this._for(new Gi("of",o,s,r),()=>n(s))}forIn(e,r,n,o=this.opts.es5?vt.varKinds.var:vt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,te._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new Gi("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(Kr)}label(e){return this._leafNode(new Qu(e))}break(e){return this._leafNode(new Yu(e))}return(e){let r=new es;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(es)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new ol;if(this._blockNode(o),this.code(e),r){let s=this.name("e");this._currNode=o.catch=new ts(s),r(s)}return n&&(this._currNode=o.finally=new rs,this.code(n)),this._endBlockNode(ts,rs)}throw(e){return this._leafNode(new Xu(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=te.nil,n,o){return this._blockNode(new Xo(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Xo)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Jr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};H.CodeGen=sl;function Qr(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Ji(t,e){return e instanceof te._CodeOrName?Qr(t,e.names):t}function Nn(t,e,r){if(t instanceof te.Name)return n(t);if(!o(t))return t;return new te._Code(t._items.reduce((s,i)=>(i instanceof te.Name&&(i=n(i)),i instanceof te._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function o(s){return s instanceof te._Code&&s._items.some(i=>i instanceof te.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function jP(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Zy(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,te._)`!${il(t)}`}H.not=Zy;var LP=qy(H.operators.AND);function ZP(...t){return t.reduce(LP)}H.and=ZP;var qP=qy(H.operators.OR);function FP(...t){return t.reduce(qP)}H.or=FP;function qy(t){return(e,r)=>e===te.nil?r:r===te.nil?e:(0,te._)`${il(e)} ${t} ${il(r)}`}function il(t){return t instanceof te.Name?t:(0,te._)`(${t})`}});var oe=E(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.checkStrictMode=G.getErrorPath=G.Type=G.useFunc=G.setEvaluated=G.evaluatedPropsToName=G.mergeEvaluated=G.eachItem=G.unescapeJsonPointer=G.escapeJsonPointer=G.escapeFragment=G.unescapeFragment=G.schemaRefOrVal=G.schemaHasRulesButRef=G.schemaHasRules=G.checkUnknownRules=G.alwaysValidSchema=G.toHash=void 0;var le=B(),UP=Qo();function VP(t){let e={};for(let r of t)e[r]=!0;return e}G.toHash=VP;function WP(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Vy(t,e),!Wy(e,t.self.RULES.all))}G.alwaysValidSchema=WP;function Vy(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let s in e)o[s]||Gy(t,`unknown keyword: "${s}"`)}G.checkUnknownRules=Vy;function Wy(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}G.schemaHasRules=Wy;function BP(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}G.schemaHasRulesButRef=BP;function HP({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,le._)`${r}`}return(0,le._)`${t}${e}${(0,le.getProperty)(n)}`}G.schemaRefOrVal=HP;function GP(t){return By(decodeURIComponent(t))}G.unescapeFragment=GP;function JP(t){return encodeURIComponent(cl(t))}G.escapeFragment=JP;function cl(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}G.escapeJsonPointer=cl;function By(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}G.unescapeJsonPointer=By;function KP(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}G.eachItem=KP;function Fy({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof le.Name?(s instanceof le.Name?t(o,s,i):e(o,s,i),i):s instanceof le.Name?(e(o,i,s),s):r(s,i);return a===le.Name&&!(c instanceof le.Name)?n(o,c):c}}G.mergeEvaluated={props:Fy({mergeNames:(t,e,r)=>t.if((0,le._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,le._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,le._)`${r} || {}`).code((0,le._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,le._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,le._)`${r} || {}`),ul(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Hy}),items:Fy({mergeNames:(t,e,r)=>t.if((0,le._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,le._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,le._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,le._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Hy(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,le._)`{}`);return e!==void 0&&ul(t,r,e),r}G.evaluatedPropsToName=Hy;function ul(t,e,r){Object.keys(r).forEach(n=>t.assign((0,le._)`${e}${(0,le.getProperty)(n)}`,!0))}G.setEvaluated=ul;var Uy={};function QP(t,e){return t.scopeValue("func",{ref:e,code:Uy[e.code]||(Uy[e.code]=new UP._Code(e.code))})}G.useFunc=QP;var al;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(al||(G.Type=al={}));function YP(t,e,r){if(t instanceof le.Name){let n=e===al.Num;return r?n?(0,le._)`"[" + ${t} + "]"`:(0,le._)`"['" + ${t} + "']"`:n?(0,le._)`"/" + ${t}`:(0,le._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,le.getProperty)(t).toString():"/"+cl(t)}G.getErrorPath=YP;function Gy(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}G.checkStrictMode=Gy});var Ht=E(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:!0});var je=B(),XP={data:new je.Name("data"),valCxt:new je.Name("valCxt"),instancePath:new je.Name("instancePath"),parentData:new je.Name("parentData"),parentDataProperty:new je.Name("parentDataProperty"),rootData:new je.Name("rootData"),dynamicAnchors:new je.Name("dynamicAnchors"),vErrors:new je.Name("vErrors"),errors:new je.Name("errors"),this:new je.Name("this"),self:new je.Name("self"),scope:new je.Name("scope"),json:new je.Name("json"),jsonPos:new je.Name("jsonPos"),jsonLen:new je.Name("jsonLen"),jsonPart:new je.Name("jsonPart")};ll.default=XP});var ns=E(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.extendErrors=Le.resetErrorsCount=Le.reportExtraError=Le.reportError=Le.keyword$DataError=Le.keywordError=void 0;var re=B(),Qi=oe(),Ue=Ht();Le.keywordError={message:({keyword:t})=>(0,re.str)`must pass "${t}" keyword validation`};Le.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,re.str)`"${t}" keyword must be ${e} ($data)`:(0,re.str)`"${t}" keyword is invalid ($data)`};function eE(t,e=Le.keywordError,r,n){let{it:o}=t,{gen:s,compositeRule:i,allErrors:a}=o,c=Qy(t,e,r);n??(i||a)?Jy(s,c):Ky(o,(0,re._)`[${c}]`)}Le.reportError=eE;function tE(t,e=Le.keywordError,r){let{it:n}=t,{gen:o,compositeRule:s,allErrors:i}=n,a=Qy(t,e,r);Jy(o,a),s||i||Ky(n,Ue.default.vErrors)}Le.reportExtraError=tE;function rE(t,e){t.assign(Ue.default.errors,e),t.if((0,re._)`${Ue.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,re._)`${Ue.default.vErrors}.length`,e),()=>t.assign(Ue.default.vErrors,null)))}Le.resetErrorsCount=rE;function nE({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",o,Ue.default.errors,a=>{t.const(i,(0,re._)`${Ue.default.vErrors}[${a}]`),t.if((0,re._)`${i}.instancePath === undefined`,()=>t.assign((0,re._)`${i}.instancePath`,(0,re.strConcat)(Ue.default.instancePath,s.errorPath))),t.assign((0,re._)`${i}.schemaPath`,(0,re.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,re._)`${i}.schema`,r),t.assign((0,re._)`${i}.data`,n))})}Le.extendErrors=nE;function Jy(t,e){let r=t.const("err",e);t.if((0,re._)`${Ue.default.vErrors} === null`,()=>t.assign(Ue.default.vErrors,(0,re._)`[${r}]`),(0,re._)`${Ue.default.vErrors}.push(${r})`),t.code((0,re._)`${Ue.default.errors}++`)}function Ky(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,re._)`new ${t.ValidationError}(${e})`):(r.assign((0,re._)`${n}.errors`,e),r.return(!1))}var Yr={keyword:new re.Name("keyword"),schemaPath:new re.Name("schemaPath"),params:new re.Name("params"),propertyName:new re.Name("propertyName"),message:new re.Name("message"),schema:new re.Name("schema"),parentSchema:new re.Name("parentSchema")};function Qy(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,re._)`{}`:oE(t,e,r)}function oE(t,e,r={}){let{gen:n,it:o}=t,s=[sE(o,r),iE(t,r)];return aE(t,e,s),n.object(...s)}function sE({errorPath:t},{instancePath:e}){let r=e?(0,re.str)`${t}${(0,Qi.getErrorPath)(e,Qi.Type.Str)}`:t;return[Ue.default.instancePath,(0,re.strConcat)(Ue.default.instancePath,r)]}function iE({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,re.str)`${e}/${t}`;return r&&(o=(0,re.str)`${o}${(0,Qi.getErrorPath)(r,Qi.Type.Str)}`),[Yr.schemaPath,o]}function aE(t,{params:e,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Yr.keyword,o],[Yr.params,typeof e=="function"?e(t):e||(0,re._)`{}`]),c.messages&&n.push([Yr.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Yr.schema,i],[Yr.parentSchema,(0,re._)`${l}${d}`],[Ue.default.data,s]),u&&n.push([Yr.propertyName,u])}});var Xy=E(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.boolOrEmptySchema=jn.topBoolOrEmptySchema=void 0;var cE=ns(),uE=B(),lE=Ht(),dE={message:"boolean schema is false"};function pE(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Yy(t,!1):typeof r=="object"&&r.$async===!0?e.return(lE.default.data):(e.assign((0,uE._)`${n}.errors`,null),e.return(!0))}jn.topBoolOrEmptySchema=pE;function fE(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Yy(t)):r.var(e,!0)}jn.boolOrEmptySchema=fE;function Yy(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,cE.reportError)(o,dE,void 0,e)}});var dl=E(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.getRules=Ln.isJSONType=void 0;var mE=["string","number","integer","boolean","null","object","array"],hE=new Set(mE);function gE(t){return typeof t=="string"&&hE.has(t)}Ln.isJSONType=gE;function yE(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Ln.getRules=yE});var pl=E(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.shouldUseRule=dr.shouldUseGroup=dr.schemaHasRulesForType=void 0;function _E({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&e_(t,n)}dr.schemaHasRulesForType=_E;function e_(t,e){return e.rules.some(r=>t_(t,r))}dr.shouldUseGroup=e_;function t_(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}dr.shouldUseRule=t_});var os=E(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.reportTypeError=Ze.checkDataTypes=Ze.checkDataType=Ze.coerceAndCheckDataType=Ze.getJSONTypes=Ze.getSchemaTypes=Ze.DataType=void 0;var vE=dl(),xE=pl(),bE=ns(),F=B(),r_=oe(),Zn;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Zn||(Ze.DataType=Zn={}));function wE(t){let e=n_(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Ze.getSchemaTypes=wE;function n_(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(vE.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Ze.getJSONTypes=n_;function $E(t,e){let{gen:r,data:n,opts:o}=t,s=SE(e,o.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,xE.schemaHasRulesForType)(t,e[0]));if(i){let a=ml(e,n,o.strictNumbers,Zn.Wrong);r.if(a,()=>{s.length?kE(t,e,s):hl(t)})}return i}Ze.coerceAndCheckDataType=$E;var o_=new Set(["string","number","integer","boolean","null"]);function SE(t,e){return e?t.filter(r=>o_.has(r)||e==="array"&&r==="array"):[]}function kE(t,e,r){let{gen:n,data:o,opts:s}=t,i=n.let("dataType",(0,F._)`typeof ${o}`),a=n.let("coerced",(0,F._)`undefined`);s.coerceTypes==="array"&&n.if((0,F._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,F._)`${o}[0]`).assign(i,(0,F._)`typeof ${o}`).if(ml(e,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,F._)`${a} !== undefined`);for(let u of r)(o_.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),hl(t),n.endIf(),n.if((0,F._)`${a} !== undefined`,()=>{n.assign(o,a),TE(t,a)});function c(u){switch(u){case"string":n.elseIf((0,F._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,F._)`"" + ${o}`).elseIf((0,F._)`${o} === null`).assign(a,(0,F._)`""`);return;case"number":n.elseIf((0,F._)`${i} == "boolean" || ${o} === null
6
6
  || (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,F._)`+${o}`);return;case"integer":n.elseIf((0,F._)`${i} === "boolean" || ${o} === null
@@ -182,7 +182,7 @@ ${r.content}
182
182
  `:`[${n[c]}\r
183
183
  ]`;continue}o+=n[c],n[c]==="\\"?s=!0:i&&n[c]==="]"?i=!1:!i&&n[c]==="["&&(i=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}function qi(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===S.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:M(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??be(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:M(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===S.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=Zi(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===S.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===S.ZodBranded&&t.keyType._def.type._def.typeName===S.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=Li(t.keyType._def,e);return{...r,propertyNames:o}}}return r}function _y(t,e){if(e.mapStrategy==="record")return qi(t,e);let r=M(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||be(e),n=M(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||be(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function vy(t){let e=t.values,n=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),o=Array.from(new Set(n.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function xy(t){return t.target==="openAi"?void 0:{not:be({...t,currentPath:[...t.currentPath,"not"]})}}function by(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Go={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function $y(t,e){if(e.target==="openApi3")return wy(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Go&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,s)=>{let i=Go[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];default:return o}},[]);if(n.length===r.length){let o=n.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(s=>!n.includes(s))],[])};return wy(t,e)}var wy=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>M(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Sy(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Go[t.innerType._def.typeName],nullable:!0}:{type:[Go[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=M(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=M(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function ky(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",ju(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?ee(r,"minimum",n.value,n.message,e):ee(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),ee(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?ee(r,"maximum",n.value,n.message,e):ee(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),ee(r,"maximum",n.value,n.message,e));break;case"multipleOf":ee(r,"multipleOf",n.value,n.message,e);break}return r}function Ty(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},o=[],s=t.shape();for(let a in s){let c=s[a];if(c===void 0||c._def===void 0)continue;let u=kP(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=M(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||o.push(a))}o.length&&(n.required=o);let i=SP(t,e);return i!==void 0&&(n.additionalProperties=i),n}function SP(t,e){if(t.catchall._def.typeName!=="ZodNever")return M(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function kP(t){try{return t.isOptional()}catch{return!0}}var Py=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return M(t.innerType._def,e);let r=M(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:be(e)},r]}:be(e)};var Ey=(t,e)=>{if(e.pipeStrategy==="input")return M(t.in._def,e);if(e.pipeStrategy==="output")return M(t.out._def,e);let r=M(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=M(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function Ry(t,e){return M(t.type._def,e)}function zy(t,e){let n={type:"array",uniqueItems:!0,items:M(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&ee(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&ee(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function Cy(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>M(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:M(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>M(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Ay(t){return{not:be(t)}}function Iy(t){return be(t)}var Dy=(t,e)=>M(t.innerType._def,e);var Oy=(t,e,r)=>{switch(e){case S.ZodString:return Zi(t,r);case S.ZodNumber:return ky(t,r);case S.ZodObject:return Ty(t,r);case S.ZodBigInt:return uy(t,r);case S.ZodBoolean:return ly();case S.ZodDate:return Lu(t,r);case S.ZodUndefined:return Ay(r);case S.ZodNull:return by(r);case S.ZodArray:return cy(t,r);case S.ZodUnion:case S.ZodDiscriminatedUnion:return $y(t,r);case S.ZodIntersection:return hy(t,r);case S.ZodTuple:return Cy(t,r);case S.ZodRecord:return qi(t,r);case S.ZodLiteral:return gy(t,r);case S.ZodEnum:return my(t);case S.ZodNativeEnum:return vy(t);case S.ZodNullable:return Sy(t,r);case S.ZodOptional:return Py(t,r);case S.ZodMap:return _y(t,r);case S.ZodSet:return zy(t,r);case S.ZodLazy:return()=>t.getter()._def;case S.ZodPromise:return Ry(t,r);case S.ZodNaN:case S.ZodNever:return xy(r);case S.ZodEffects:return fy(t,r);case S.ZodAny:return be(r);case S.ZodUnknown:return Iy(r);case S.ZodDefault:return py(t,r);case S.ZodBranded:return Li(t,r);case S.ZodReadonly:return Dy(t,r);case S.ZodCatch:return dy(t,r);case S.ZodPipeline:return Ey(t,r);case S.ZodFunction:case S.ZodVoid:case S.ZodSymbol:return;default:return(n=>{})(e)}};function M(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==sy)return a}if(n&&!r){let a=TP(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let s=Oy(t,t.typeName,e),i=typeof s=="function"?M(s(),e):s;if(i&&PP(t,e,i),e.postProcess){let a=e.postProcess(i,t,e);return o.jsonSchema=i,a}return o.jsonSchema=i,i}var TP=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:ji(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),be(e)):e.$refStrategy==="seen"?be(e):void 0}},PP=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var Fi=(t,e)=>{let r=ay(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:M(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??be(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=M(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??be(r),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(s.title=i),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=o===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:s}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function Fu(t){let r=xi(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=xg(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Uu(t,e){let r=ar(t,e);if(!r.success)throw r.error;return r.data}var EP=6e4,Ui=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Pi,r=>{this._oncancel(r)}),this.setNotificationHandler(Ri,r=>{this._onprogress(r)}),this.setRequestHandler(Ei,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(zi,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new W(X.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Ai,async(r,n)=>{let o=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,p=new W(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new W(X.InvalidParams,`Task not found: ${s}`);if(!ur(i.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(ur(i.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[cr]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(Ii,async(r,n)=>{try{let{tasks:o,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:s,_meta:{}}}catch(o){throw new W(X.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Oi,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new W(X.InvalidParams,`Task not found: ${r.params.taskId}`);if(ur(o.status))throw new W(X.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new W(X.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof W?o:new W(X.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,o,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),W.fromError(X.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{o?.(s,i),Lo(s)||Jg(s)?this._onresponse(s):wu(s)?this._onrequest(s,i):Gg(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let r=W.fromError(X.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,s=e.params?._meta?.[cr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:X.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=Wg(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:i.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{let d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{let f={...p,relatedRequestId:e.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let g=f.relatedTask?.taskId??s;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:X.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Lo(e))n(e);else{let i=new W(e.error.code,e.error.message,e.error.data);n(i)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(Lo(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),Lo(e))o(e);else{let i=W.fromError(e.error.code,e.error.message,e.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(e,r,n)}}catch(i){yield{type:"error",error:i instanceof W?i:new W(X.InternalError,String(i))}}return}let s;try{let i=await this.request(e,Dn,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new W(X.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},ur(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new W(X.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new W(X.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof W?i:new W(X.InternalError,String(i))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=_=>{l(_)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(_){d(_);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[cr]:c}});let g=_=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(_)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)));let w=_ instanceof W?_:new W(X.RequestTimeout,String(_));l(w)};this._responseHandlers.set(p,_=>{if(!n?.signal?.aborted){if(_ instanceof Error)return l(_);try{let w=ar(r,_.result);w.success?u(w.data):l(w.error)}catch(w){l(w)}}}),n?.signal?.addEventListener("abort",()=>{g(n?.signal?.reason)});let y=n?.timeout??EP,m=()=>g(W.fromError(X.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(p,y,n?.maxTotalTimeout,m,n?.resetTimeoutOnProgress??!1);let b=c?.taskId;if(b){let _=w=>{let k=this._responseHandlers.get(p);k?k(w):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,_),this._enqueueTaskMessage(b,{type:"request",message:f,timestamp:Date.now()}).catch(w=>{this._cleanupTimeout(p),l(w)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(_=>{this._cleanupTimeout(p),l(_)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Ci,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Di,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Yg,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[cr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[cr]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[cr]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let n=Fu(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=Uu(e,o);return Promise.resolve(r(i,s))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=Fu(e);this._notificationHandlers.set(n,o=>{let s=Uu(e,o);return Promise.resolve(r(s))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,o)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&wu(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new W(X.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,s)=>{if(r.aborted){s(new W(X.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(i),s(new W(X.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let s=await n.getTask(o,r);if(!s)throw new W(X.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await n.storeTaskResult(o,s,i,r);let a=await n.getTask(o,r);if(a){let c=Vo.parse({method:"notifications/tasks/status",params:a});await this.notification(c),ur(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,s,i)=>{let a=await n.getTask(o,r);if(!a)throw new W(X.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(ur(a.status))throw new W(X.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,s,i,r);let c=await n.getTask(o,r);if(c){let u=Vo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),ur(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function My(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Ny(t,e){let r={...t};for(let n in e){let o=n,s=e[o];if(s===void 0)continue;let i=r[o];My(i)&&My(s)?r[o]={...i,...s}:r[o]=s}return r}var $x=ap(Ed(),1),Sx=ap(wx(),1);function _I(){let t=new $x.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Sx.default)(t),t}var Ta=class{constructor(e){this._ajv=e??_I()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Pa=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function kx(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function Tx(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Ea=class extends Ui{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ho.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let s=this._loggingLevels.get(o);return s?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Ta,this.setRequestHandler(ku,n=>this._oninitialize(n)),this.setNotificationHandler(Tu,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Du,async(n,o)=>{let s=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=Ho.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Pa(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ny(this._capabilities,e)}setRequestHandler(e,r){let o=xi(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let s;if(An(o)){let a=o;s=a._zod?.def?.value??a.value}else{let a=o;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=ar(Bo,c);if(!l.success){let g=l.error instanceof Error?l.error.message:String(l.error);throw new W(X.InvalidParams,`Invalid tools/call request: ${g}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let g=ar(Dn,p);if(!g.success){let y=g.error instanceof Error?g.error.message:String(g.error);throw new W(X.InvalidParams,`Invalid task creation result: ${y}`)}return g.data}let f=ar(Mi,p);if(!f.success){let g=f.error instanceof Error?f.error.message:String(f.error);throw new W(X.InvalidParams,`Invalid tools/call result: ${g}`)}return f.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Tx(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&kx(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Fg.includes(r)?r:xu,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Ti)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Mu,r):this.request({method:"sampling/createMessage",params:e},Ou,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},Ni,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:o},Ni,r);if(s.action==="accept"&&s.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(s.content);if(!a.valid)throw new W(X.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof W?i:new W(X.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Nu,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import Ex from"node:process";var Ra=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
184
184
  `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),vI(r)}clear(){this._buffer=void 0}};function vI(t){return Kg.parse(JSON.parse(t))}function Px(t){return JSON.stringify(t)+`
185
- `}var za=class{constructor(e=Ex.stdin,r=Ex.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Ra,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=Px(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};import{fileURLToPath as $D}from"url";var Md={};We(Md,{AI_CHAT_TIMEOUT_MS:()=>Ix,getTools:()=>bI,handleTool:()=>kI});import{readFileSync as Rx}from"fs";function J(t){let e=Fi(t,{target:"openApi3"});return delete e.$schema,delete e.additionalProperties,e.type==="object"&&!e.required&&(e.required=[]),e}var xI=h.object({title:h.string().describe("Document title"),metadata:h.record(h.string()).optional().describe("Optional key-value metadata")}).optional(),zx=h.object({provider:h.string().describe("Provider ID (e.g. 'ollama', 'gemini', 'codex', 'claude')"),prompt:h.string().describe("Chat prompt to send"),model:h.string().optional().describe("Model override"),system:h.string().optional().describe("System prompt"),files:h.array(h.string()).optional().describe("File paths to include as context"),save_as_document:xI.describe("If provided, automatically save the response as a workspace document with the given title and metadata. Returns document ID in the result.")}),Cx=h.object({provider:h.string().describe("Provider ID"),file_paths:h.array(h.string()).min(1).describe("File paths to analyze"),question:h.string().describe("Question to ask about the files"),save_to_file:h.string().optional().describe("Path to save the analysis result")}),Ax=h.object({providers:h.array(h.string()).min(1).describe("List of provider IDs to compare"),prompt:h.string().describe("Prompt to send to all providers"),aggregate_provider:h.string().optional().describe("Provider ID to synthesize all responses into a unified document. If omitted, returns raw comparisons only."),aggregate_prompt:h.string().optional().describe("Custom synthesis prompt. Default: synthesize and identify agreements/disagreements.")}),Ix=9e4;function bI(){return[{name:"ai_chat",title:"AI Chat",description:"Chat with a specific AI provider. Sends a prompt and returns the response. Optionally saves the response as a workspace document.",inputSchema:J(zx)},{name:"ai_analyze_files",title:"Analyze Files with AI",description:"Analyze files with an AI provider. Reads files from disk, sends contents with a question, and optionally saves the result.",inputSchema:J(Cx)},{name:"ai_compare",title:"Compare AI Providers",description:"Send the same prompt to multiple providers and return a comparison. Optionally aggregate results into a unified synthesis using a designated provider.",inputSchema:J(Ax)}]}async function wI(t,e){let r=zx.parse(t),n=e.workspaceBaseDir??process.cwd(),o=e.qualityStatsProvider??e.traceWriter,s=r.provider==="auto"?e.registry.getBestForTask("chat",o)??e.registry.getAvailable()[0]:e.registry.get(r.provider);if(!s)throw new Error("No providers available for auto-routing");let i=s.chat({prompt:r.prompt,model:r.model,system:r.system,files:r.files?.map(l=>{let d=Ft(l,n);return{path:d,content:Rx(d,"utf-8")}})}),a=e.aiChatTimeoutMs??Ix,c;try{c=await Promise.race([i,new Promise((l,d)=>setTimeout(()=>d(new Error("__AI_CHAT_TIMEOUT__")),a))])}catch(l){if(q(l)==="__AI_CHAT_TIMEOUT__"&&e.jobManager){let p=e.jobManager.submit({provider:r.provider,prompt:r.prompt,timeout:3e5});return{content:[{type:"text",text:`\u23F1 Provider "${r.provider}" timed out after ${a/1e3}s. Auto-submitted as background job.
185
+ `}var za=class{constructor(e=Ex.stdin,r=Ex.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Ra,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=Px(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};import{fileURLToPath as $D}from"url";var Md={};We(Md,{AI_CHAT_TIMEOUT_MS:()=>Ix,getTools:()=>bI,handleTool:()=>kI});import{readFileSync as Rx}from"fs";function J(t){let e=Fi(t,{target:"jsonSchema7"});return delete e.$schema,delete e.additionalProperties,e.type==="object"&&!e.required&&(e.required=[]),e}var xI=h.object({title:h.string().describe("Document title"),metadata:h.record(h.string()).optional().describe("Optional key-value metadata")}).optional(),zx=h.object({provider:h.string().describe("Provider ID (e.g. 'ollama', 'gemini', 'codex', 'claude')"),prompt:h.string().describe("Chat prompt to send"),model:h.string().optional().describe("Model override"),system:h.string().optional().describe("System prompt"),files:h.array(h.string()).optional().describe("File paths to include as context"),save_as_document:xI.describe("If provided, automatically save the response as a workspace document with the given title and metadata. Returns document ID in the result.")}),Cx=h.object({provider:h.string().describe("Provider ID"),file_paths:h.array(h.string()).min(1).describe("File paths to analyze"),question:h.string().describe("Question to ask about the files"),save_to_file:h.string().optional().describe("Path to save the analysis result")}),Ax=h.object({providers:h.array(h.string()).min(1).describe("List of provider IDs to compare"),prompt:h.string().describe("Prompt to send to all providers"),aggregate_provider:h.string().optional().describe("Provider ID to synthesize all responses into a unified document. If omitted, returns raw comparisons only."),aggregate_prompt:h.string().optional().describe("Custom synthesis prompt. Default: synthesize and identify agreements/disagreements.")}),Ix=9e4;function bI(){return[{name:"ai_chat",title:"AI Chat",description:"Chat with a specific AI provider. Sends a prompt and returns the response. Optionally saves the response as a workspace document.",inputSchema:J(zx)},{name:"ai_analyze_files",title:"Analyze Files with AI",description:"Analyze files with an AI provider. Reads files from disk, sends contents with a question, and optionally saves the result.",inputSchema:J(Cx)},{name:"ai_compare",title:"Compare AI Providers",description:"Send the same prompt to multiple providers and return a comparison. Optionally aggregate results into a unified synthesis using a designated provider.",inputSchema:J(Ax)}]}async function wI(t,e){let r=zx.parse(t),n=e.workspaceBaseDir??process.cwd(),o=e.qualityStatsProvider??e.traceWriter,s=r.provider==="auto"?e.registry.getBestForTask("chat",o)??e.registry.getAvailable()[0]:e.registry.get(r.provider);if(!s)throw new Error("No providers available for auto-routing");let i=s.chat({prompt:r.prompt,model:r.model,system:r.system,files:r.files?.map(l=>{let d=Ft(l,n);return{path:d,content:Rx(d,"utf-8")}})}),a=e.aiChatTimeoutMs??Ix,c;try{c=await Promise.race([i,new Promise((l,d)=>setTimeout(()=>d(new Error("__AI_CHAT_TIMEOUT__")),a))])}catch(l){if(q(l)==="__AI_CHAT_TIMEOUT__"&&e.jobManager){let p=e.jobManager.submit({provider:r.provider,prompt:r.prompt,timeout:3e5});return{content:[{type:"text",text:`\u23F1 Provider "${r.provider}" timed out after ${a/1e3}s. Auto-submitted as background job.
186
186
 
187
187
  **Job ID:** ${p}
188
188
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agestra",
3
- "version": "4.8.1",
3
+ "version": "4.8.3",
4
4
  "description": "Multi-host AI orchestration toolkit for Claude Code, Codex CLI, and Gemini CLI",
5
5
  "type": "module",
6
6
  "packageManager": "npm@11.11.0",
package/skills/design.md CHANGED
@@ -67,17 +67,17 @@ Brownfield: modifying or extending existing code.
67
67
 
68
68
  Call `environment_check` to determine available providers.
69
69
 
70
- - If **no providers are available**: proceed to Phase 3 (Explore → Propose → Refine → Document) directly using `agestra-designer` agent (Claude only).
70
+ - If **no providers are available**: proceed to Phase 3 (Explore → Propose → Refine → Document) directly using `agestra:agestra-designer` agent (Claude only).
71
71
  - If **1+ providers are available**: proceed to 끝장토론 execution below.
72
72
 
73
73
  ### Phase 3: Execute 끝장토론
74
74
 
75
- **팀 구성:** `agestra-moderator` (리더) + `agestra-designer` (Claude) + 사용 가능한 외부 AI (gemini, codex 등)
75
+ **팀 구성:** `agestra:agestra-moderator` (리더) + `agestra:agestra-designer` (Claude) + 사용 가능한 외부 AI (gemini, codex 등)
76
76
 
77
77
  1. Independent work + initial aggregation:
78
78
 
79
79
  a. In parallel:
80
- - Spawn the `agestra-designer` agent for Claude's independent architecture exploration.
80
+ - Spawn the `agestra:agestra-designer` agent for Claude's independent architecture exploration.
81
81
  After the agent completes, save Claude's result as a document via `workspace_create_document`:
82
82
  - **title:** `Architecture Design — claude/designer`
83
83
  - **metadata:** `{ "Provider": "claude/designer", "Task": "{subject}", "Mode": "Independent" }`
@@ -89,7 +89,7 @@ Call `environment_check` to determine available providers.
89
89
 
90
90
  b. Collect all document IDs.
91
91
 
92
- c. Spawn the `agestra-moderator` agent in **Independent Aggregation** mode:
92
+ c. Spawn the `agestra:agestra-moderator` agent in **Independent Aggregation** mode:
93
93
  - Pass the document ID list.
94
94
  - Moderator reads each document, classifies consensus/unique/disputed approaches.
95
95
  - Moderator creates an aggregated document. This becomes the starting document.
package/skills/idea.md CHANGED
@@ -73,19 +73,19 @@ After gathering context:
73
73
 
74
74
  Call `environment_check` to determine available providers.
75
75
 
76
- - If **no providers are available**: proceed to Phase 3 (Research) directly using `agestra-ideator` agent (Claude only).
76
+ - If **no providers are available**: proceed to Phase 3 (Research) directly using `agestra:agestra-ideator` agent (Claude only).
77
77
  - If **1+ providers are available**: proceed to 끝장토론 execution below.
78
78
 
79
79
  ### Phase 3: Execute 끝장토론
80
80
 
81
- **팀 구성:** `agestra-moderator` (리더) + `agestra-ideator` (Claude) + 사용 가능한 외부 AI (gemini, codex 등)
81
+ **팀 구성:** `agestra:agestra-moderator` (리더) + `agestra:agestra-ideator` (Claude) + 사용 가능한 외부 AI (gemini, codex 등)
82
82
 
83
83
  The `ai_chat` prompt for external providers differs by mode. Use the interview answers collected in Phase 1 to construct a context-rich prompt.
84
84
 
85
85
  1. Independent work + initial aggregation:
86
86
 
87
87
  a. In parallel:
88
- - Spawn the `agestra-ideator` agent for Claude's independent research.
88
+ - Spawn the `agestra:agestra-ideator` agent for Claude's independent research.
89
89
  After the agent completes, save Claude's result as a document via `workspace_create_document`:
90
90
  - **title:** `Idea Exploration — claude/ideator`
91
91
  - **metadata:** `{ "Provider": "claude/ideator", "Task": "{topic}", "Mode": "Independent" }`
@@ -163,7 +163,7 @@ The `ai_chat` prompt for external providers differs by mode. Use the interview a
163
163
 
164
164
  b. Collect all document IDs.
165
165
 
166
- c. Spawn the `agestra-moderator` agent in **Independent Aggregation** mode:
166
+ c. Spawn the `agestra:agestra-moderator` agent in **Independent Aggregation** mode:
167
167
  - Pass the document ID list.
168
168
  - Moderator reads each document, classifies consensus/unique/disputed suggestions.
169
169
  - Moderator creates an aggregated document. This becomes the starting document.
@@ -116,9 +116,9 @@ Match by **semantic intent**, not literal keywords. These triggers apply in any
116
116
 
117
117
  | Command | Specialist Agent | Purpose |
118
118
  |---------|-----------------|---------|
119
- | `/agestra review` | `agestra-reviewer` | Post-implementation quality verification |
120
- | `/agestra idea` | `agestra-ideator` | Improvement discovery and competitive analysis |
121
- | `/agestra design` | `agestra-designer` | Pre-implementation architecture exploration |
119
+ | `/agestra review` | `agestra:agestra-reviewer` | Post-implementation quality verification |
120
+ | `/agestra idea` | `agestra:agestra-ideator` | Improvement discovery and competitive analysis |
121
+ | `/agestra design` | `agestra:agestra-designer` | Pre-implementation architecture exploration |
122
122
 
123
123
  ### Utility Skills
124
124
 
@@ -129,7 +129,7 @@ Match by **semantic intent**, not literal keywords. These triggers apply in any
129
129
  | `cancel` | Gracefully stop running operations (including CLI workers) with state cleanup |
130
130
  | `worker-manage` | List, check, collect, and stop CLI workers |
131
131
 
132
- In 끝장토론 mode, each AI works independently first, then `agestra-moderator` aggregates results and facilitates review rounds until consensus.
132
+ In 끝장토론 mode, each AI works independently first, then `agestra:agestra-moderator` aggregates results and facilitates review rounds until consensus.
133
133
 
134
134
  Commands and hook-triggered suggestions go directly to 끝장토론 when providers are available. Commands are explicit entry points; hooks detect intent from natural language.
135
135
 
package/skills/review.md CHANGED
@@ -45,7 +45,7 @@ Ask what to focus on (multiSelect):
45
45
 
46
46
  Call `environment_check` to determine available providers.
47
47
 
48
- - If **no providers are available**: run the `agestra-reviewer` agent directly (Claude only) with the target and selected focus areas as context. Skip to Phase 5.
48
+ - If **no providers are available**: run the `agestra:agestra-reviewer` agent directly (Claude only) with the target and selected focus areas as context. Skip to Phase 5.
49
49
  - If **1+ providers are available**: proceed to 끝장토론 execution below.
50
50
 
51
51
  ### Phase 4: Execute 끝장토론
@@ -59,12 +59,12 @@ Call `environment_check` to determine available providers.
59
59
  - Do NOT stop or replace the Claude reviewer unless there is an explicit error, user cancellation, or no visible progress for 8+ minutes.
60
60
  - Do NOT use `agent_debate_moderate` as the primary review path. Use the turn-based flow (`agent_debate_create` + `agent_debate_turn` + `agent_debate_conclude`).
61
61
 
62
- **팀 구성:** `agestra-moderator` (리더) + `agestra-reviewer` (Claude) + 리뷰용 외부 AI (gemini, codex 등; ollama 제외)
62
+ **팀 구성:** `agestra:agestra-moderator` (리더) + `agestra:agestra-reviewer` (Claude) + 리뷰용 외부 AI (gemini, codex 등; ollama 제외)
63
63
 
64
64
  1. Independent work + initial aggregation:
65
65
 
66
66
  a. In parallel:
67
- - Spawn the `agestra-reviewer` agent for Claude's independent analysis.
67
+ - Spawn the `agestra:agestra-reviewer` agent for Claude's independent analysis.
68
68
  After the agent completes, save Claude's result as a document via `workspace_create_document`:
69
69
  - **title:** `Code Review — claude/reviewer`
70
70
  - **metadata:** `{ "Provider": "claude/reviewer", "Task": "{review target}", "Focus": "{selected focus areas}", "Mode": "Independent" }`
@@ -76,7 +76,7 @@ Call `environment_check` to determine available providers.
76
76
 
77
77
  b. Collect all document IDs.
78
78
 
79
- c. Spawn the `agestra-moderator` agent in **Independent Aggregation** mode:
79
+ c. Spawn the `agestra:agestra-moderator` agent in **Independent Aggregation** mode:
80
80
  - Pass the document ID list.
81
81
  - Moderator reads each document, classifies consensus/unique/disputed findings.
82
82
  - Moderator creates an aggregated document via `workspace_create_document`.