@oxgeneral/orch 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App-Q7J4JGDF.js +22 -0
- package/dist/agent-WLKP6WOR.js +9 -0
- package/dist/agent-factory-HJOS7FW3.js +2 -0
- package/dist/{agent-shop-JHDTCWCD.js → agent-shop-XWVUC3MK.js} +1 -1
- package/dist/{chunk-HWEMBO36.js → chunk-3YGXRXS7.js} +3 -3
- package/dist/{chunk-3AXNSYCM.js → chunk-6E6DC7OE.js} +1 -1
- package/dist/{chunk-J7ITYXE6.js → chunk-6JQDY3PP.js} +3 -3
- package/dist/{chunk-J7ITYXE6.js.map → chunk-6JQDY3PP.js.map} +1 -1
- package/dist/chunk-C7C7Q7XO.js +4 -0
- package/dist/{chunk-JM2WRI46.js → chunk-DEHFYICU.js} +1 -1
- package/dist/chunk-EWRVHOUA.js +2 -0
- package/dist/{chunk-NLQAJ7TW.js → chunk-IESAV453.js} +14 -4
- package/dist/chunk-IESAV453.js.map +1 -0
- package/dist/chunk-ITMAWW3J.js +3 -0
- package/dist/chunk-LRYVT4D4.js +2 -0
- package/dist/{chunk-XJ6KTO3E.js → chunk-NNF3VEVJ.js} +3 -3
- package/dist/{chunk-XJ6KTO3E.js.map → chunk-NNF3VEVJ.js.map} +1 -1
- package/dist/{chunk-TWEMIPRN.js → chunk-RFN447MA.js} +3 -3
- package/dist/{chunk-TWEMIPRN.js.map → chunk-RFN447MA.js.map} +1 -1
- package/dist/chunk-XMKCAUEH.js +2 -0
- package/dist/{claude-EMBYYPW4.js → claude-KZMCTMDP.js} +4 -4
- package/dist/{claude-EMBYYPW4.js.map → claude-KZMCTMDP.js.map} +1 -1
- package/dist/claude-PH7LT3OH.js +2 -0
- package/dist/cli.js +1 -1
- package/dist/{clipboard-service-WVON5ZN4.js → clipboard-service-AJTJG2DJ.js} +1 -1
- package/dist/{codex-WQ3LU3MM.js → codex-UR7Q22OV.js} +4 -4
- package/dist/{codex-WQ3LU3MM.js.map → codex-UR7Q22OV.js.map} +1 -1
- package/dist/codex-URQN4JLZ.js +2 -0
- package/dist/container-5FLJ4QYD.js +4 -0
- package/dist/{cursor-M3EJ432K.js → cursor-EMX3ECDY.js} +1 -1
- package/dist/{cursor-TKV5FFCN.js → cursor-O6M6XOMT.js} +4 -4
- package/dist/{cursor-TKV5FFCN.js.map → cursor-O6M6XOMT.js.map} +1 -1
- package/dist/{doctor-SKIWAKHW.js → doctor-5HTCX6K7.js} +1 -1
- package/dist/goal-KQ4XOSRH.js +8 -0
- package/dist/index.d.ts +87 -2
- package/dist/index.js +588 -14
- package/dist/index.js.map +1 -1
- package/dist/init-GVM7EYPO.js +74 -0
- package/dist/{logs-CU3NC24O.js → logs-EUOQ2UZL.js} +1 -1
- package/dist/{opencode-YWT3M4NX.js → opencode-HOX5TCMD.js} +4 -4
- package/dist/{opencode-YWT3M4NX.js.map → opencode-HOX5TCMD.js.map} +1 -1
- package/dist/opencode-K22RCQ5C.js +2 -0
- package/dist/orchestrator-I3CXUOH7.js +6 -0
- package/dist/{orchestrator-FWROY4JD.js.map → orchestrator-I3CXUOH7.js.map} +1 -1
- package/dist/{orchestrator-YZHLOVJO.js → orchestrator-L34ZPKAB.js} +3 -3
- package/dist/org-WCEBMHLR.js +3 -0
- package/dist/{shell-PMLIRG3N.js → shell-C2J4AIAV.js} +4 -4
- package/dist/{shell-PMLIRG3N.js.map → shell-C2J4AIAV.js.map} +1 -1
- package/dist/shell-NPNTWDMU.js +2 -0
- package/dist/shop-picker-2HA2CDKS.js +5 -0
- package/dist/{task-2LI5CMI4.js → task-TTOAOVM7.js} +1 -1
- package/dist/tui-IWCCSBDD.js +2 -0
- package/dist/{workspace-manager-KUU7UMMC.js → workspace-manager-QH27FF55.js} +4 -4
- package/dist/{workspace-manager-KUU7UMMC.js.map → workspace-manager-QH27FF55.js.map} +1 -1
- package/dist/{workspace-manager-DG4IFFG3.js → workspace-manager-ZI5SVXJU.js} +2 -2
- package/package.json +1 -1
- package/dist/App-2CW2WICK.js +0 -22
- package/dist/agent-TU6OC7ZT.js +0 -9
- package/dist/chunk-FQ5YUP4J.js +0 -4
- package/dist/chunk-IKNBPOQL.js +0 -2
- package/dist/chunk-LOJ26OVK.js +0 -3
- package/dist/chunk-NLQAJ7TW.js.map +0 -1
- package/dist/claude-GIGROCH5.js +0 -2
- package/dist/codex-AZD52UPS.js +0 -2
- package/dist/container-RFWMXKD6.js +0 -4
- package/dist/goal-RNNZYMNR.js +0 -8
- package/dist/init-6OVZBN6B.js +0 -73
- package/dist/opencode-4G7VAZGY.js +0 -2
- package/dist/orchestrator-FWROY4JD.js +0 -6
- package/dist/org-KLYK6MMJ.js +0 -3
- package/dist/shell-JC2WDWBR.js +0 -2
- package/dist/shop-picker-LE3SKFOX.js +0 -5
- package/dist/tui-24NBO5U6.js +0 -2
- package/scripts/demo.sh +0 -202
- /package/dist/{serve-JOIPYKKG.js → serve-DE7ES7Q5.js} +0 -0
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {a as a$2}from'./chunk-N4OXN2HW.js';import {c as c$1,b as b$2}from'./chunk-HXOMNULD.js';import {a as a$1,b as b$3}from'./chunk-KR7VDF23.js';import {a}from'./chunk-CHRW4CLD.js';import {b}from'./chunk-3AXNSYCM.js';import {b as b$1,c,j as j$1,d,e,l,f as f$1,h,i as i$1,g as g$1,k as k$1}from'./chunk-ZMLF5HI5.js';import {c as c$2,k,j as j$2,g,f,i}from'./chunk-IKNBPOQL.js';import W from'path';import K,{mkdir}from'fs/promises';import {createReadStream}from'fs';import {homedir}from'os';import {nanoid}from'nanoid';var P={tui:{activity_filter:"all",notifications:{toast:true,bell:false}}};var w=class{indexPath;dir;ext;itemPath;fileFilter;readItemFn;mutex=Promise.resolve();insideMutex=false;constructor(t){this.dir=t.dir,this.ext=t.ext,this.itemPath=t.itemPath,this.indexPath=W.join(t.dir,"_index.json"),this.fileFilter=t.fileFilter??(()=>true),t.readItem?this.readItemFn=t.readItem:t.ext===".yml"?this.readItemFn=e=>b$1(e):this.readItemFn=e=>d(e);}async readIndex(){try{let t=await d(this.indexPath);if(Array.isArray(t))return t}catch{}return this.rebuildIndex()}async rebuildIndex(){await j$1(this.dir);let t=await l(this.dir,this.ext),e=await Promise.all(t.filter(this.fileFilter).map(r=>{let a=r.replace(this.ext,"");return this.readItemFn(this.itemPath(a))})),s=[];for(let r of e)r!=null&&s.push(r);return this.insideMutex?await this.writeIndexUnsafe(s):await this.withMutex(()=>this.writeIndexUnsafe(s)),s}async writeIndex(t){return this.withMutex(()=>this.writeIndexUnsafe(t))}async updateIndex(t){return this.withMutex(async()=>{let e=await this.readIndex(),s=t(e);await this.writeIndexUnsafe(s);})}async writeIndexUnsafe(t){await j$1(this.dir),await e(this.indexPath,t);}withMutex(t){let e,s=new Promise(a=>{e=a;}),r=this.mutex;return this.mutex=s,r.then(async()=>{this.insideMutex=true;try{return await t()}finally{this.insideMutex=false,e();}})}};var C=class{constructor(t){this.paths=t;this.index=new w({dir:t.tasksDir,ext:".yml",itemPath:e=>t.taskPath(e)});}index;async list(t){return (await this.index.readIndex()).filter(r=>r!==null&&(!t?.status||r.status===t.status)&&(!t?.goalId||r.goalId===t.goalId)).sort((r,a)=>{let n=ut(r.status)-ut(a.status);if(n!==0)return n;let i=a.updated_at??"",m=r.updated_at??"";return i<m?-1:i>m?1:0})}async get(t){return b$1(this.paths.taskPath(t))}async save(t){await j$1(this.paths.tasksDir),await c(this.paths.taskPath(t.id),t),await this.index.updateIndex(e=>{let s=e.filter(r=>r.id!==t.id);return s.push(t),s});}async delete(t){try{await K.unlink(this.paths.taskPath(t));}catch(e){if(e.code!=="ENOENT")throw e}await this.index.updateIndex(e=>e.filter(s=>s.id!==t));}};function ut(o){return {in_progress:0,retrying:1,review:2,todo:3,done:4,failed:5,cancelled:6}[o]}var j=class{constructor(t){this.paths=t;this.index=new w({dir:t.agentsDir,ext:".yml",itemPath:e=>t.agentPath(e)});}index;async list(){return this.index.readIndex()}async get(t){return b$1(this.paths.agentPath(t))}async getByName(t){return (await this.list()).find(s=>s.name===t)??null}async save(t){await j$1(this.paths.agentsDir),await c(this.paths.agentPath(t.id),t),await this.index.updateIndex(e=>{let s=e.filter(r=>r.id!==t.id);return s.push(t),s});}async delete(t){try{await K.unlink(this.paths.agentPath(t));}catch(e){if(e.code!=="ENOENT")throw e}await this.index.updateIndex(e=>e.filter(s=>s.id!==t));}};var M=class{constructor(t){this.paths=t;}async save(t){await j$1(this.paths.runsDir),await e(this.paths.runPath(t.id),t);}async get(t){return d(this.paths.runPath(t))}async listAll(){return this.listFiltered(()=>true)}async listForTask(t){return this.listFiltered(e=>e.task_id===t)}async listForAgent(t){return this.listFiltered(e=>e.agent_id===t)}async appendEvent(t,e){await j$1(this.paths.runsDir),await f$1(this.paths.runEventsPath(t),e);}async readEvents(t){return h(this.paths.runEventsPath(t))}async readEventsTail(t,e){return i$1(this.paths.runEventsPath(t),e)}closeRunEvents(t){g$1(this.paths.runEventsPath(t));}async*streamEvents(t,e){let s=this.paths.runEventsPath(t),r=Date.now()+3e4;for(;!e?.aborted&&Date.now()<r&&!await k$1(s);)await new Promise(i=>setTimeout(i,100));if(e?.aborted||Date.now()>=r)return;let a=createReadStream(s),{readLines:n}=await import('./process-manager-33H27MQF.js');try{for await(let i of n(a)){if(e?.aborted)break;if(i.trim())try{yield JSON.parse(i);}catch{process.stderr.write(`[RunStore] skipping corrupt JSONL line: ${i.slice(0,200)}
|
|
3
|
-
`);}}}finally{a.destroy();}}async listFiltered(t){await j$1(this.paths.runsDir);let e=await l(this.paths.runsDir,".json"),s=64,r=[];for(let a=0;a<e.length;a+=s){let n=e.slice(a,a+s),i=await Promise.all(n.map(m=>{let g=m.endsWith(".json")?m.slice(0,-5):m;return d(this.paths.runPath(g))}));for(let m of i)m!==null&&t(m)&&r.push(m);}return r.sort((a,n)=>new Date(n.started_at).getTime()-new Date(a.started_at).getTime())}};var X={version:1,onboardingCompleted:false,running:{},claimed:new Set,retry_queue:[],stats:{total_runs:0,total_tasks_completed:0,total_tasks_failed:0,total_tokens:{input:0,output:0,reasoning:0,total:0,cache_read:0,cache_write:0},total_runtime_ms:0}};var R=class{constructor(t){this.paths=t;}async read(){let t=await d(this.paths.statePath);if(!t)return structuredClone(X);let e=structuredClone(X);return {version:t.version??e.version,pid:t.pid,started_at:t.started_at,onboardingCompleted:typeof t.onboardingCompleted=="boolean"?t.onboardingCompleted:false,running:t.running&&typeof t.running=="object"?t.running:e.running,claimed:Array.isArray(t.claimed)?new Set(t.claimed):new Set(e.claimed),retry_queue:Array.isArray(t.retry_queue)?t.retry_queue:e.retry_queue,stats:{total_runs:t.stats?.total_runs??e.stats.total_runs,total_tasks_completed:t.stats?.total_tasks_completed??e.stats.total_tasks_completed,total_tasks_failed:t.stats?.total_tasks_failed??e.stats.total_tasks_failed,total_tokens:{...e.stats.total_tokens,...t.stats?.total_tokens??{}},total_runtime_ms:t.stats?.total_runtime_ms??e.stats.total_runtime_ms}}}async write(t){let e$1={...t,claimed:Array.from(t.claimed)};await e(this.paths.statePath,e$1);}};var D=class{constructor(t){this.paths=t;}async read(){let t=await b$1(this.paths.configPath);return pt(a$2,t??{})}async write(t){await c(this.paths.configPath,t);}async get(t){let e=await this.read();return Et(e,t)}async set(t,e){let s=await this.read();Ct(s,t,e),await this.write(s);}};function Et(o,t){let e=t.split("."),s=o;for(let r of e){if(s==null||typeof s!="object")return;s=s[r];}return s}function Ct(o,t,e){let s=t.split("."),r=o;for(let n=0;n<s.length-1;n++){let i=s[n];(typeof r[i]!="object"||r[i]===null)&&(r[i]={}),r=r[i];}let a=s[s.length-1];r[a]=e;}function pt(o,t){let e={...o};for(let s of Object.keys(t)){let r=t[s],a=e[s];r!=null&&typeof r=="object"&&!Array.isArray(r)&&typeof a=="object"&&a!==null&&!Array.isArray(a)?e[s]=pt(a,r):e[s]=r;}return e}var wt=W.join(homedir(),".orchestry"),ht=W.join(wt,"global.yml"),O=class{async read(){let t=await b$1(ht);if(!t)return {...P,tui:{...P.tui,notifications:{...P.tui.notifications}}};let e=t.tui,s=e?.notifications;return {tui:{activity_filter:e?.activity_filter??P.tui.activity_filter,notifications:{toast:typeof s?.toast=="boolean"?s.toast:P.tui.notifications.toast,bell:typeof s?.bell=="boolean"?s.bell:P.tui.notifications.bell}}}}async write(t){await mkdir(wt,{recursive:true}),await c(ht,t);}async set(t,e){let s=await this.read();s.tui[t]=e,await this.write(s);}};var G=class o{constructor(t){this.paths=t;this.index=new w({dir:t.contextDir,ext:".json",itemPath:e=>t.contextPath(e),fileFilter:e=>e!=="_index.json"});}index;async get(t){let e=await d(this.paths.contextPath(t));return e?St(e)?(await this.delete(t),null):e:null}static MAX_TTL_MS=720*60*60*1e3;async set(t,e$1,s){if(s!==void 0&&(!Number.isFinite(s)||s<=0||s>o.MAX_TTL_MS))throw new Error(`TTL must be a positive number up to ${o.MAX_TTL_MS}ms (30 days)`);await j$1(this.paths.contextDir);let r=new Date().toISOString(),a=await d(this.paths.contextPath(t)),n={key:t,value:e$1,created_at:a?.created_at??r,updated_at:r,ttl_ms:s,expires_at:s?new Date(Date.now()+s).toISOString():void 0};await e(this.paths.contextPath(t),n),await this.index.updateIndex(i=>{let m=i.filter(g=>g.key!==t);return m.push(n),m});}async delete(t){try{await K.unlink(this.paths.contextPath(t));}catch(e){if(e.code!=="ENOENT")throw e}await this.index.updateIndex(e=>e.filter(s=>s.key!==t));}async list(){let t=await this.index.readIndex(),e=[],s=[];for(let r of t)St(r)?e.push(r):s.push(r);return e.length>0&&(await Promise.all(e.map(r=>this.deleteFile(r.key))),await this.index.writeIndex(s)),s.sort((r,a)=>r.key.localeCompare(a.key))}async getAll(){let t=await this.list(),e={};for(let s of t)e[s.key]=s.value;return e}async deleteFile(t){try{await K.unlink(this.paths.contextPath(t));}catch(e){if(e.code!=="ENOENT")throw e}}};function St(o){return o.expires_at?new Date(o.expires_at).getTime()<Date.now():false}var L=class{constructor(t){this.paths=t;this.index=new w({dir:t.messagesDir,ext:".json",itemPath:e=>t.messagePath(e),fileFilter:e=>e!=="_index.json"});}index;async save(t){await j$1(this.paths.messagesDir),await e(this.paths.messagePath(t.id),t),await this.index.updateIndex(e=>{let s=e.filter(r=>r.id!==t.id);return s.push(t),s});}async get(t){return d(this.paths.messagePath(t))}async list(){return (await this.index.readIndex()).filter(e=>e!==null).sort((e,s)=>e.created_at.localeCompare(s.created_at))}async listPending(t){let e=await this.list(),s=Date.now();return e.filter(r=>r.status!=="pending"||r.expires_at&&new Date(r.expires_at).getTime()<s?false:r.to_agent_id===t)}async markDelivered(t){let e$1=await this.get(t);e$1&&(e$1.status="delivered",e$1.delivered_at=new Date().toISOString(),await e(this.paths.messagePath(t),e$1),await this.index.updateIndex(s=>{let r=s.filter(a=>a.id!==t);return r.push(e$1),r}));}async delete(t){try{await K.unlink(this.paths.messagePath(t));}catch(e){if(e.code!=="ENOENT")throw e}await this.index.updateIndex(e=>e.filter(s=>s.id!==t));}async purgeExpired(){let t=await this.list(),e=Date.now(),s=t.filter(a=>{let n=a.expires_at&&new Date(a.expires_at).getTime()<e,i=a.delivered_at&&e-new Date(a.delivered_at).getTime()>36e5;return n||i}),r=new Set(s.map(a=>a.id));return await Promise.all(s.map(async a=>{try{await K.unlink(this.paths.messagePath(a.id));}catch(n){if(n.code!=="ENOENT")throw n}})),await this.index.updateIndex(a=>a.filter(n=>!r.has(n.id))),s.length}};var B=class{constructor(t){this.paths=t;this.index=new w({dir:t.goalsDir,ext:".yml",itemPath:e=>t.goalPath(e)});}index;async list(t){return (await this.index.readIndex()).filter(r=>r!==null&&(!t?.status||r.status===t.status)).sort((r,a)=>{let n=c$1[r.status]-c$1[a.status];if(n!==0)return n;let i=a.updated_at??"",m=r.updated_at??"";return i<m?-1:i>m?1:0})}async get(t){return b$1(this.paths.goalPath(t))}async save(t){await j$1(this.paths.goalsDir),await c(this.paths.goalPath(t.id),t),await this.index.updateIndex(e=>{let s=e.filter(r=>r.id!==t.id);return s.push(t),s});}async delete(t){try{await K.unlink(this.paths.goalPath(t));}catch(e){if(e.code!=="ENOENT")throw e}await this.index.updateIndex(e=>e.filter(s=>s.id!==t));}};var F=class{constructor(t){this.paths=t;}async save(t){await j$1(this.paths.teamsDir),await c(this.paths.teamPath(t.id),t);}async get(t){return b$1(this.paths.teamPath(t))}async getByName(t){return (await this.list()).find(s=>s.name===t)??null}async list(){await j$1(this.paths.teamsDir);let t=await l(this.paths.teamsDir,".yml");return (await Promise.all(t.map(s=>b$1(this.paths.teamPath(s.replace(".yml","")))))).filter(s=>s!==null)}async delete(t){try{await K.unlink(this.paths.teamPath(t));}catch(e){if(e.code!=="ENOENT")throw e}}};var N=class{handlers=new Map;wildcardHandlers=new Set;maxListeners=10;warnedTypes=new Set;setMaxListeners(t){this.maxListeners=t;}getMaxListeners(){return this.maxListeners}listenerCount(t){return this.handlers.get(t)?.size??0}on(t,e){this.handlers.has(t)||this.handlers.set(t,new Set);let s=this.handlers.get(t);return s.add(e),this.maxListeners>0&&s.size>this.maxListeners&&!this.warnedTypes.has(t)&&(this.warnedTypes.add(t),console.warn(`EventBus: possible memory leak detected. ${s.size} listeners added for "${t}". Use setMaxListeners() to increase limit if this is intentional.`)),()=>this.off(t,e)}once(t,e){let s=r=>{this.off(t,s),e(r);};return this.on(t,s)}off(t,e){this.handlers.get(t)?.delete(e);}emit(t){let e=this.handlers.get(t.type);e&&this.dispatchToSet(e,t,"handler"),this.dispatchToSet(this.wildcardHandlers,t,"wildcard handler");}dispatchToSet(t,e,s){for(let r of t)try{r(e);}catch(a){console.error(`EventBus ${s} error for "${e.type}":`,a);}}onAny(t){return this.wildcardHandlers.add(t),this.maxListeners>0&&this.wildcardHandlers.size>this.maxListeners&&!this.warnedTypes.has("*")&&(this.warnedTypes.add("*"),console.warn(`EventBus: possible memory leak detected. ${this.wildcardHandlers.size} wildcard listeners added. Use setMaxListeners() to increase limit if this is intentional.`)),()=>{this.wildcardHandlers.delete(t);}}clear(){this.handlers.clear(),this.wildcardHandlers.clear(),this.warnedTypes.clear();}};var $=class{constructor(t,e,s,r){this.taskStore=t;this.eventBus=e;this.config=s;this.paths=r;}async create(t){if(!t.title.trim())throw new c$2("Task title is required");let e=t.priority??this.config.defaults.task.priority;if(!Number.isInteger(e)||e<1||e>4)throw new c$2("Priority must be an integer between 1 and 4");if(t.depends_on?.length){let n=(await Promise.all(t.depends_on.map(async i=>({depId:i,exists:!!await this.taskStore.get(i)})))).filter(i=>!i.exists).map(i=>i.depId);if(n.length>0)throw new c$2(`Unknown depends_on task ID(s): ${n.join(", ")}`)}let s=new Date().toISOString(),r={id:`tsk_${nanoid(7)}`,title:t.title.trim(),description:t.description?.trim()??"",status:"todo",priority:e,assignee:t.assignee,labels:t.labels??[],depends_on:t.depends_on??[],created_at:s,updated_at:s,attempts:0,max_attempts:t.max_attempts??this.config.defaults.task.max_attempts,workspace_mode:t.workspace_mode,review_criteria:t.review_criteria,scope:t.scope,goalId:t.goalId};if(t.attachments?.length&&this.paths){let a=await this.copyAttachments(r.id,t.attachments);r.attachments=a;}return await this.taskStore.save(r),this.eventBus.emit({type:"task:created",task:r}),r}async list(t){return this.taskStore.list(t)}async get(t){let e=await this.taskStore.get(t);if(!e)throw new f(t);return e}async updateStatus(t,e){let s=await this.get(t),r=s.status;if(!a$1(r,e))throw new i(t,r,e);return s.status=e,s.updated_at=new Date().toISOString(),await this.taskStore.save(s),this.eventBus.emit({type:"task:status_changed",taskId:t,from:r,to:e}),s}async assign(t,e){let s=await this.get(t);return s.assignee=e,s.updated_at=new Date().toISOString(),await this.taskStore.save(s),this.eventBus.emit({type:"task:assigned",taskId:t,agentId:e}),s}async cancel(t){let e=await this.get(t);if(b$3(e.status))throw new i(t,e.status,"cancelled");return this.updateStatus(t,"cancelled")}async retry(t){let e=await this.get(t);if(e.status!=="failed"&&e.status!=="cancelled")throw new i(t,e.status,"todo");let s=e.status;return e.status="todo",e.attempts=0,e.updated_at=new Date().toISOString(),await this.taskStore.save(e),this.eventBus.emit({type:"task:status_changed",taskId:t,from:s,to:"todo"}),e}async reject(t,e){let s=await this.get(t);if(s.status!=="review")throw new i(t,s.status,"todo");let r=s.status;return s.status="todo",s.attempts=0,s.feedback=e,s.updated_at=new Date().toISOString(),await this.taskStore.save(s),this.eventBus.emit({type:"task:status_changed",taskId:t,from:r,to:"todo"}),s}async update(t,e){let s=await this.get(t);if(e.title!==void 0){if(!e.title.trim())throw new c$2("Task title cannot be empty");s.title=e.title.trim();}if(e.description!==void 0&&(s.description=e.description.trim()),e.priority!==void 0){if(!Number.isInteger(e.priority)||e.priority<1||e.priority>4)throw new c$2("Priority must be an integer between 1 and 4");s.priority=e.priority;}if(e.labels!==void 0&&(s.labels=e.labels),e.attachments?.length&&this.paths){let r=await this.copyAttachments(t,e.attachments);s.attachments=[...s.attachments??[],...r];}return s.updated_at=new Date().toISOString(),await this.taskStore.save(s),s}async delete(t){if((await this.get(t)).status==="in_progress")throw new c$2("Cannot delete a running task. Cancel it first.");if(await this.taskStore.delete(t),this.paths){let s=this.paths.taskAttachmentsDir(t);await K.rm(s,{recursive:true,force:true});}}getAttachmentPath(t,e){if(!this.paths)throw new c$2("Paths not configured");return W.join(this.paths.taskAttachmentsDir(t),e)}async copyAttachments(t,e){if(!this.paths)return [];let s=this.paths.taskAttachmentsDir(t);return await j$1(s),await Promise.all(e.map(async a=>{try{await K.access(a);}catch{throw new c$2(`Attachment file not found: ${a}`)}})),await Promise.all(e.map(async a=>{let n=W.basename(a);return await K.copyFile(a,W.join(s,n)),n}))}async incrementAttempts(t){let e=await this.get(t);return e.attempts+=1,e.updated_at=new Date().toISOString(),await this.taskStore.save(e),e}};var U=class{constructor(t,e,s,r){this.agentStore=t;this.stateStore=e;this.eventBus=s;this.config=r;}async create(t){if(!t.name.trim())throw new c$2("Agent name is required");if(await this.agentStore.getByName(t.name))throw new c$2(`Agent "${t.name}" already exists`);let s={id:`agt_${nanoid(7)}`,name:t.name.trim(),adapter:t.adapter||this.config.defaults.agent.adapter,role:t.role,config:{command:t.command,model:t.model,effort:t.effort,approval_policy:t.approval_policy??this.config.defaults.agent.approval_policy,max_turns:t.max_turns??this.config.defaults.agent.max_turns,timeout_ms:t.timeout_ms??this.config.defaults.agent.timeout_ms,stall_timeout_ms:t.stall_timeout_ms??this.config.defaults.agent.stall_timeout_ms,env:t.env,system_prompt:t.system_prompt,workspace_mode:t.workspace_mode,skills:t.skills},status:"idle",stats:{tasks_completed:0,tasks_failed:0,total_runs:0,total_runtime_ms:0}};return await this.agentStore.save(s),s}async list(){return this.agentStore.list()}async get(t){let e=await this.agentStore.get(t);if(!e)throw new g(t);return e}async remove(t){let e=await this.get(t);if(e.status==="running"){let s=await this.stateStore.read();if(Object.values(s.running).some(a=>a.agent_id===t))throw new c$2("Cannot remove a running agent. Stop it first.");e.status="idle",await this.agentStore.save(e);}await this.agentStore.delete(t);}async update(t,e){let s=await this.get(t);if(e.name!==void 0){if(!e.name.trim())throw new c$2("Agent name cannot be empty");let r=await this.agentStore.getByName(e.name.trim());if(r&&r.id!==t)throw new c$2(`Agent "${e.name}" already exists`);s.name=e.name.trim();}return e.role!==void 0&&(s.role=e.role||void 0),e.model!==void 0&&(s.config.model=e.model||void 0),e.effort!==void 0&&(s.config.effort=e.effort||void 0),e.approval_policy!==void 0&&(s.config.approval_policy=e.approval_policy),await this.agentStore.save(s),s}async disable(t){return this.setStatus(t,"disabled")}async enable(t){return this.setStatus(t,"idle")}async setAutonomous(t,e){let s=await this.get(t);return s.autonomous=e,await this.agentStore.save(s),this.eventBus.emit({type:"agent:autonomous_toggled",agentId:t,autonomous:e}),s}async setStatus(t,e){let s=await this.get(t);return s.status=e,await this.agentStore.save(s),s}async updateStats(t,e){let s=await this.get(t);return Object.assign(s.stats,e),await this.agentStore.save(s),s}async findBestAgent(t){let e=await this.agentStore.list(),s=e.filter(n=>n.status==="idle");if(s.length===0)return null;if(t.assignee){let n=e.find(i=>i.id===t.assignee);return n&&n.status==="idle"?n:null}let r=t.labels?.length?t.labels.map(n=>n.toLowerCase()):void 0,a=s.map(n=>{let i=0;if(r&&n.config.skills?.length){let g=new Set(n.config.skills.map(d=>d.toLowerCase()));for(let d of r)g.has(d)&&(i+=50);}if(r&&n.role){let g=n.role.toLowerCase();r.some(d=>g.includes(d))&&(i+=30);}n.status==="idle"&&(i+=20);let m=n.stats.tasks_completed+n.stats.tasks_failed;return m>0&&(i+=Math.round(n.stats.tasks_completed/m*10)),{agent:n,score:i}});return a.sort((n,i)=>i.score-n.score),a[0]?.agent??null}};var J=class{constructor(t,e){this.runStore=t;this.eventBus=e;}async create(t){let e={id:`run_${nanoid(7)}`,task_id:t.taskId,agent_id:t.agentId,attempt:t.attempt,status:"preparing",started_at:new Date().toISOString(),workspace_path:t.workspacePath,prompt:t.prompt};return await this.runStore.save(e),e}async get(t){return this.runStore.get(t)}async start(t,e){let s=await this.runStore.get(t);if(!s)throw new Error(`Run not found: ${t}`);return s.status="running",s.pid=e,await this.runStore.save(s),this.eventBus.emit({type:"agent:started",agentId:s.agent_id,taskId:s.task_id,runId:t}),s}async finish(t,e,s,r){let a=await this.runStore.get(t);if(!a)throw new Error(`Run not found: ${t}`);return a.status=e,a.finished_at=new Date().toISOString(),a.tokens=s,a.error=r,await this.runStore.save(a),this.eventBus.emit({type:"agent:completed",runId:t,agentId:a.agent_id,success:e==="succeeded"}),a}async appendEvent(t,e){await this.runStore.appendEvent(t,e);}async listAll(){return this.runStore.listAll()}async listForTask(t){return this.runStore.listForTask(t)}async listForAgent(t){return this.runStore.listForAgent(t)}async readEvents(t){return this.runStore.readEvents(t)}async readEventsTail(t,e){return this.runStore.readEventsTail(t,e)}async getLastFailedRunContext(t){let s=(await this.runStore.listForTask(t)).filter(n=>n.status==="failed").sort((n,i)=>(i.finished_at??"").localeCompare(n.finished_at??""))[0];if(!s)return null;let r=s.error??"Unknown error",a="";try{a=(await this.runStore.readEventsTail(s.id,50)).filter(i=>i.type==="agent_output"||i.type==="error").map(i=>typeof i.data=="string"?i.data:JSON.stringify(i.data)).join(`
|
|
4
|
-
`);}catch{}return {error:r,output:a}}};var H=class{constructor(t,e,s,r){this.messageStore=t;this.agentStore=e;this.teamStore=s;this.eventBus=r;}async send(t){if(!t.body.trim())throw new c$2("Message body is required");let e=t.ttl_ms??864e5;if(e<=0||e>6048e5)throw new c$2(`TTL must be between 1ms and ${6048e5}ms`);if(!await this.agentStore.get(t.from_agent_id)&&t.from_agent_id!=="cli")throw new c$2(`Sender agent not found: ${t.from_agent_id}`);let r=new Date,a={channel:t.channel,from_agent_id:t.from_agent_id,subject:(t.subject||"(no subject)").slice(0,200),body:t.body.slice(0,4e3),created_at:r.toISOString(),expires_at:new Date(r.getTime()+e).toISOString(),status:"pending",team_id:t.team_id,reply_to:t.reply_to},n=[];if(t.channel==="broadcast"){let i=await this.agentStore.list();if(t.team_id){let d=await this.teamStore.get(t.team_id);if(d){let x=new Set(d.members.map(v=>v.agent_id));i=i.filter(v=>x.has(v.id));}}let g=i.filter(d=>d.id!==t.from_agent_id&&d.status!=="disabled").map(d=>({...a,id:`msg_${nanoid(7)}`,to_agent_id:d.id}));await Promise.all(g.map(d=>this.messageStore.save(d)));for(let d of g)n.push(d),this.emitSent(d);}else if(t.channel==="lead"){if(!t.team_id)throw new c$2("team_id is required for lead channel");let i=await this.teamStore.get(t.team_id);if(!i)throw new c$2(`Team not found: ${t.team_id}`);let m={...a,id:`msg_${nanoid(7)}`,to_agent_id:i.lead_agent_id};await this.messageStore.save(m),n.push(m),this.emitSent(m);}else {if(!t.to_agent_id)throw new c$2("to_agent_id is required for direct messages");if(!await this.agentStore.get(t.to_agent_id))throw new c$2(`Recipient agent not found: ${t.to_agent_id}`);let m={...a,id:`msg_${nanoid(7)}`,to_agent_id:t.to_agent_id};await this.messageStore.save(m),n.push(m),this.emitSent(m);}return n}async drainMailbox(t,e){let s=await this.messageStore.listPending(t);await Promise.all(s.map(r=>this.messageStore.markDelivered(r.id)));for(let r of s)this.eventBus.emit({type:"message:delivered",messageId:r.id,toAgentId:t,taskId:e});return s}async listAll(){return this.messageStore.list()}async listPendingForAgent(t){return this.messageStore.listPending(t)}async listForAgent(t){return (await this.messageStore.list()).filter(s=>s.to_agent_id===t||s.from_agent_id===t)}async purgeExpired(){return this.messageStore.purgeExpired()}emitSent(t){this.eventBus.emit({type:"message:sent",messageId:t.id,fromAgentId:t.from_agent_id,toAgentId:t.to_agent_id,channel:t.channel});}};var Nt={active:["paused","achieved","abandoned"],paused:["active","abandoned"],achieved:[],abandoned:[]},q=class{constructor(t,e,s,r,a){this.goalStore=t;this.eventBus=e;this.agentService=s;this.taskService=r;this.contextStore=a;}async create(t){if(!t.title.trim())throw new c$2("Goal title is required");let e=new Date().toISOString(),s={id:`goal_${nanoid(7)}`,title:t.title.trim(),description:t.description?.trim()??"",status:"active",assignee:t.assignee,created_at:e,updated_at:e};return await this.goalStore.save(s),this.eventBus.emit({type:"goal:created",goalId:s.id,title:s.title}),s.assignee&&await this.enableAutonomous(s.assignee),s}async list(t){return this.goalStore.list(t)}async get(t){let e=await this.goalStore.get(t);if(!e)throw new j$2(t);return e}async updateStatus(t,e){let s=await this.get(t),r=s.status;if(!Nt[r].includes(e))throw new c$2(`Cannot transition goal from '${r}' to '${e}'`);return s.status=e,s.updated_at=new Date().toISOString(),await this.goalStore.save(s),this.eventBus.emit({type:"goal:status_changed",goalId:t,from:r,to:e}),s.assignee&&(e==="paused"?(await this.maybeDisableAutonomous(s.assignee),await this.cancelPendingAutonomousTasks(s.assignee)):e==="active"&&r==="paused"?await this.enableAutonomous(s.assignee):b$2(e)&&await this.maybeDisableAutonomous(s.assignee)),s}async update(t,e){let s=await this.get(t),r=s.assignee;if(e.title!==void 0){if(!e.title.trim())throw new c$2("Goal title cannot be empty");s.title=e.title.trim();}e.description!==void 0&&(s.description=e.description.trim()),e.assignee!==void 0&&(s.assignee=e.assignee||void 0),s.updated_at=new Date().toISOString(),await this.goalStore.save(s),this.eventBus.emit({type:"goal:updated",goalId:t});let a=s.assignee;if(a!==r){let n=[];a&&n.push(this.enableAutonomous(a)),r&&n.push(this.maybeDisableAutonomous(r)),await Promise.all(n);}return s}async delete(t){let e=await this.get(t),{assignee:s}=e;await this.goalStore.delete(t),this.eventBus.emit({type:"goal:deleted",goalId:t}),s&&await this.maybeDisableAutonomous(s);}async listTasksForGoal(t){return this.taskService?.list({goalId:t})??[]}async getProgressReport(t){return this.contextStore?(await this.contextStore.get(`${t}-progress`))?.value:void 0}async enableAutonomous(t){if(this.agentService)try{await this.agentService.setAutonomous(t,!0);}catch{}}async hasActiveGoalsForAgent(t){return (await this.goalStore.list({status:"active"})).some(s=>s.assignee===t)}async cancelPendingAutonomousTasks(t){if(this.taskService)try{let[e,s]=await Promise.all([this.taskService.list({status:"todo"}),this.taskService.list({status:"retrying"})]),r=[...e,...s].filter(a$1=>a$1.assignee===t&&a$1.labels?.includes(a));await Promise.all(r.map(a=>this.taskService.cancel(a.id).catch(()=>{})));}catch{}}async maybeDisableAutonomous(t){if(this.agentService)try{await this.hasActiveGoalsForAgent(t)||await this.agentService.setAutonomous(t,!1);}catch{}}};var Pt={auto_claim:true,message_ttl_ms:864e5};var Y=class{constructor(t,e,s,r){this.teamStore=t;this.agentStore=e;this.taskStore=s;this.eventBus=r;}async create(t){if(!t.name.trim())throw new c$2("Team name is required");if(!await this.agentStore.get(t.lead_agent_id))throw new c$2(`Lead agent not found: ${t.lead_agent_id}`);if(await this.teamStore.getByName(t.name.trim()))throw new c$2(`Team "${t.name}" already exists`);let r=new Date().toISOString(),a={agent_id:t.lead_agent_id,role:"lead",joined_at:r},n=[];for(let m of t.member_agent_ids??[]){if(m===t.lead_agent_id)continue;if(!await this.agentStore.get(m))throw new c$2(`Member agent not found: ${m}`);n.push({agent_id:m,role:"member",joined_at:r});}let i={id:`team_${nanoid(7)}`,name:t.name.trim(),description:t.description,status:"active",members:[a,...n],task_pool:[],lead_agent_id:t.lead_agent_id,created_at:r,updated_at:r,config:{...Pt,...t.config??{}}};await this.teamStore.save(i),this.eventBus.emit({type:"team:created",teamId:i.id,name:i.name,leadAgentId:i.lead_agent_id});for(let m of n)this.eventBus.emit({type:"team:member_joined",teamId:i.id,agentId:m.agent_id});return i}async get(t){let e=await this.teamStore.get(t);if(!e)throw new k(t);return e}async list(){return this.teamStore.list()}async join(t,e){let s=await this.get(t);if(s.members.some(a=>a.agent_id===e))throw new c$2(`Agent ${e} is already a member of team ${t}`);if(!await this.agentStore.get(e))throw new c$2(`Agent not found: ${e}`);return s.members.push({agent_id:e,role:"member",joined_at:new Date().toISOString()}),s.updated_at=new Date().toISOString(),await this.teamStore.save(s),this.eventBus.emit({type:"team:member_joined",teamId:t,agentId:e}),s}async leave(t,e){let s=await this.get(t);if(e===s.lead_agent_id)throw new c$2("Lead cannot leave team. Disband the team or transfer lead first.");return s.members=s.members.filter(r=>r.agent_id!==e),s.updated_at=new Date().toISOString(),await this.teamStore.save(s),this.eventBus.emit({type:"team:member_left",teamId:t,agentId:e}),s}async addTask(t,e){let s=await this.get(t);if(!await this.taskStore.get(e))throw new c$2(`Task not found: ${e}`);return s.task_pool.includes(e)||(s.task_pool.push(e),s.updated_at=new Date().toISOString(),await this.teamStore.save(s),this.eventBus.emit({type:"team:task_added",teamId:t,taskId:e})),s}async removeTask(t,e){let s=await this.get(t);return s.task_pool=s.task_pool.filter(r=>r!==e),s.updated_at=new Date().toISOString(),await this.teamStore.save(s),s}async setLead(t,e){let s=await this.get(t),r=s.members.find(n=>n.agent_id===e);if(!r)throw new c$2(`Agent ${e} is not a member of team ${t}`);let a=s.members.find(n=>n.agent_id===s.lead_agent_id);return a&&(a.role="member"),r.role="lead",s.lead_agent_id=e,s.updated_at=new Date().toISOString(),await this.teamStore.save(s),s}async disband(t){let e=await this.get(t);e.status="disbanded",e.updated_at=new Date().toISOString(),await this.teamStore.save(e),this.eventBus.emit({type:"team:disbanded",teamId:t});}async findTeamForAgent(t){return (await this.teamStore.list()).find(s=>s.status==="active"&&s.members.some(r=>r.agent_id===t))??null}};async function Ut(o){let t=new b(o.projectRoot),e=new D(t),s=new O,[,r]=await Promise.all([t.requireInit(),e.read()]),a=new C(t),n=new j(t),i=new M(t),m=new R(t),g=new G(t),d=new L(t),x=new B(t),v=new F(t),_=new N,b$1=new $(a,_,r,t),h=new U(n,m,_,r),I=new J(i,_),A=new H(d,n,v,_),E=new q(x,_,h,b$1,g),S=new Y(v,n,a,_);return {context:o,paths:t,config:r,taskStore:a,agentStore:n,runStore:i,stateStore:m,configStore:e,globalConfigStore:s,globalConfig:P,contextStore:g,messageStore:d,goalStore:x,teamStore:v,eventBus:_,taskService:b$1,agentService:h,runService:I,messageService:A,goalService:E,teamService:S}}async function Jt(o){let t=await Ut(o),e=await t.globalConfigStore.read();t.globalConfig=e;let[{ProcessManager:s},{AdapterRegistry:r},{ClaudeAdapter:a},{CodexAdapter:n},{CursorAdapter:i},{ShellAdapter:m},{OpenCodeAdapter:g},{WorkspaceManager:d},{LiquidTemplateEngine:x},{SkillLoader:v},{Orchestrator:_},{DoctorService:b}]=await Promise.all([import('./process-manager-33H27MQF.js'),import('./registry-BO2PPRNG.js'),import('./claude-GIGROCH5.js'),import('./codex-AZD52UPS.js'),import('./cursor-M3EJ432K.js'),import('./shell-JC2WDWBR.js'),import('./opencode-4G7VAZGY.js'),import('./workspace-manager-DG4IFFG3.js'),import('./template-engine-VLIOJ3WX.js'),import('./skill-loader-IGRIELEM.js'),import('./orchestrator-YZHLOVJO.js'),import('./doctor-service-PB7YBH3F.js')]),h=new s,I=new x,A=new v,E=new d(o.projectRoot,t.paths.root,h),S=new r;S.register(new a(h)),S.register(new n(h)),S.register(new i(h)),S.register(new m(h)),S.register(new g(h));let xt=new b(S,h,o.projectRoot),kt=new _({taskStore:t.taskStore,agentStore:t.agentStore,runStore:t.runStore,stateStore:t.stateStore,adapterRegistry:S,workspaceManager:E,templateEngine:I,processManager:h,eventBus:t.eventBus,taskService:t.taskService,agentService:t.agentService,runService:t.runService,contextStore:t.contextStore,messageService:t.messageService,goalStore:t.goalStore,skillLoader:A,config:t.config,projectRoot:o.projectRoot,lockPath:t.paths.lockPath});return {...t,processManager:h,adapterRegistry:S,workspaceManager:E,templateEngine:I,skillLoader:A,doctorService:xt,orchestrator:kt}}async function Is(o){return Jt(o)}export{Is as buildContainer,Jt as buildFullContainer,Ut as buildLightContainer};
|
package/dist/goal-RNNZYMNR.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {a}from'./chunk-HXOMNULD.js';import {j,q,l,m,d,o,i}from'./chunk-64WUDYEM.js';var y={active:"\u25CF",paused:"\u2016",achieved:"\u2713",abandoned:"\u2715"};function w(S,s){let a$1=S.command("goal").description("Manage goals");a$1.command("add <title>").description("Create a new goal").option("--description <desc>","Goal description").option("--assignee <agentId>","Assign to a specific agent").action(async(o,e)=>{let t=await s.goalService.create({title:o,description:e.description,assignee:e.assignee});s.context.json?console.log(JSON.stringify(t,null,2)):s.context.quiet?console.log(t.id):(j(`Created goal "${t.title}" (${t.id})`),console.log(),console.log(` ${q("Tips for better results:")}`),console.log(` ${q("\u2022")} Be specific: ${q('"Implement OAuth2 with Google" > "Add auth"')}`),console.log(` ${q("\u2022")} Add ${q("--description")} with success criteria and constraints`),console.log(` ${q("\u2022")} Use ${q("--assignee")} to focus a specific agent on this goal`));}),a$1.command("list").alias("ls").description("List all goals").option("--status <status>","Filter by status").action(async o=>{let e=await s.goalService.list(o.status?{status:o.status}:void 0);if(s.context.json){console.log(JSON.stringify(e,null,2));return}if(e.length===0){console.log(q("No goals found."));return}let t=e.map(n=>[y[n.status]??"?",n.id,n.title,n.status,n.assignee??q("any")]);l(["","ID","Title","Status","Assignee"],t);}),a$1.command("show <id>").description("Show goal details").action(async o$1=>{let[e,t,n]=await Promise.all([s.goalService.get(o$1),s.goalService.listTasksForGoal(o$1),s.goalService.getProgressReport(o$1)]);if(s.context.json){console.log(JSON.stringify({...e,tasks:t,progress:n},null,2));return}if(m([["ID",e.id],["Title",e.title],["Status",e.status],["Assignee",e.assignee??q("any")],["Description",e.description||q("none")],["Created",e.created_at],["Updated",e.updated_at??q("never")]]),t.length>0){console.log(`
|
|
3
|
-
Tasks (${t.length})
|
|
4
|
-
${"\u2500".repeat(42)}`);let c=t.map(l=>[`${d(l.status)} ${l.status}`,l.id,l.title.slice(0,40),l.assignee?o(l.assignee):q("\u2014")]);l(["STATUS","ID","TITLE","AGENT"],c);}else console.log(`
|
|
5
|
-
${q("No tasks linked to this goal yet.")}`);if(n){console.log(`
|
|
6
|
-
Progress Report
|
|
7
|
-
${"\u2500".repeat(42)}`);for(let c of n.split(`
|
|
8
|
-
`))console.log(` ${c}`);}console.log();}),a$1.command("status <id> <status>").description("Change goal status (active, paused, achieved, abandoned)").action(async(o,e)=>{if(!a.includes(e)){i(`Invalid status "${e}". Valid: ${a.join(", ")}`),process.exitCode=1;return}let t=await s.goalService.updateStatus(o,e);s.context.json?console.log(JSON.stringify(t,null,2)):s.context.quiet?console.log(t.id):j(`Goal "${t.title}" \u2192 ${t.status}`);}),a$1.command("update <id>").description("Update goal fields").option("--title <title>","New title").option("--description <desc>","New description").option("--assignee <agentId>","New assignee (empty string to unassign)").action(async(o,e)=>{let t=await s.goalService.update(o,e);s.context.json?console.log(JSON.stringify(t,null,2)):s.context.quiet?console.log(t.id):j(`Updated goal "${t.title}"`);}),a$1.command("delete <id>").alias("rm").description("Delete a goal").action(async o=>{await s.goalService.delete(o),s.context.json?console.log(JSON.stringify({deleted:o})):s.context.quiet||j(`Deleted goal ${o}`);});}export{w as registerGoalCommand};
|
package/dist/init-6OVZBN6B.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {f}from'./chunk-LY3X2UHQ.js';import {a}from'./chunk-N4OXN2HW.js';import'./chunk-CHRW4CLD.js';import {b as b$1}from'./chunk-3AXNSYCM.js';import {k,j,c,a as a$1}from'./chunk-ZMLF5HI5.js';import {k as k$1,j as j$1,q}from'./chunk-64WUDYEM.js';import'./chunk-IKNBPOQL.js';import v from'path';import k$2 from'fs/promises';import {execFile}from'child_process';import {promisify}from'util';var x=`Agent architect \u2014 designs and creates AI agents for the orchestrator via \`orch agent add\`.
|
|
3
|
-
|
|
4
|
-
## CREATION PROCESS
|
|
5
|
-
|
|
6
|
-
1) ANALYZE \u2014 determine: agent function, required skills, adapter, team interactions.
|
|
7
|
-
|
|
8
|
-
2) WRITE THE ROLE \u2014 this is the most important part. A good role includes:
|
|
9
|
-
- Identity and specialization (who you are)
|
|
10
|
-
- Concrete workflow (numbered steps)
|
|
11
|
-
- Which skills to invoke (\`/skill-name\`)
|
|
12
|
-
- Rules and constraints
|
|
13
|
-
Do NOT include CLI documentation or goal-mode instructions \u2014 these are already injected by the system prompt template.
|
|
14
|
-
|
|
15
|
-
3) CHOOSE CONFIGURATION:
|
|
16
|
-
- adapter: \`claude\` (AI tasks), \`shell\` (bash scripts), \`codex\` (OpenAI Codex), \`cursor\` (Cursor IDE), \`opencode\` (OpenCode \u2014 multi-provider)
|
|
17
|
-
- model: \`claude-opus-4-6\` (complex/architectural), \`claude-sonnet-4-6\` (fast/routine), \`claude-haiku-4-5-20251001\` (simple/templated)
|
|
18
|
-
- approval_policy: \`auto\` (no confirmation) / \`suggest\` (proposes actions) / \`manual\` (human approval)
|
|
19
|
-
- max_turns: 50 (default), up to 100 for complex tasks
|
|
20
|
-
|
|
21
|
-
4) CREATE:
|
|
22
|
-
\`orch agent add "<name>" --adapter claude --model <model> --skills "<skills>" --role "<role>" --approval-policy auto\`
|
|
23
|
-
|
|
24
|
-
## SKILL TYPES
|
|
25
|
-
|
|
26
|
-
There are two types of skills:
|
|
27
|
-
|
|
28
|
-
**Library skills** \u2014 ORCH loads Markdown content and injects it into the agent's system prompt. Works with ALL adapters (claude, opencode, codex, cursor, shell). Use plain names without colons:
|
|
29
|
-
|
|
30
|
-
| Category | Skills |
|
|
31
|
-
|----------|--------|
|
|
32
|
-
| Code Review & QA | review, qa, qa-only, investigate |
|
|
33
|
-
| Planning | plan-ceo-review, plan-eng-review, plan-design-review, autoplan, office-hours |
|
|
34
|
-
| Design | design-consultation, design-review |
|
|
35
|
-
| Shipping | ship, land-and-deploy, canary, document-release |
|
|
36
|
-
| Infrastructure | browse, benchmark, setup-deploy, setup-browser-cookies |
|
|
37
|
-
| Safety | careful, freeze, unfreeze, guard |
|
|
38
|
-
| Cross-AI | codex |
|
|
39
|
-
| Meta | upgrade, retro |
|
|
40
|
-
|
|
41
|
-
**Claude Code MCP skills** \u2014 handled natively by Claude CLI. Use \`package:skill-name\` format (with colon):
|
|
42
|
-
|
|
43
|
-
Development: feature-dev:feature-dev, feature-dev:code-explorer, feature-dev:code-architect, feature-dev:code-reviewer
|
|
44
|
-
Testing: testing-suite:generate-tests, testing-suite:test-coverage, testing-suite:e2e-setup, testing-suite:test-quality-analyzer
|
|
45
|
-
Frontend: frontend-design:frontend-design, document-skills:frontend-design
|
|
46
|
-
Documents: document-skills:pdf, document-skills:xlsx, document-skills:docx, document-skills:pptx
|
|
47
|
-
Marketing: marketing-psychology, product-manager-toolkit
|
|
48
|
-
DevOps: devops-automation:cloud-architect
|
|
49
|
-
|
|
50
|
-
You can mix both types: \`--skills "review,feature-dev:code-explorer,investigate"\`
|
|
51
|
-
|
|
52
|
-
## ANTI-PATTERNS
|
|
53
|
-
|
|
54
|
-
- Never create agents without skills \u2014 they cannot be auto-matched to tasks.
|
|
55
|
-
- Never write generic roles like "helper" \u2014 be specific about actions and tools.
|
|
56
|
-
- Never use opus for simple tasks \u2014 it is expensive; use sonnet or haiku.
|
|
57
|
-
- Never assign more than 3-4 skills per agent \u2014 create specialized agents instead.
|
|
58
|
-
- Never use the -e/--edit flag in automated mode \u2014 it opens an interactive editor.
|
|
59
|
-
- Always specify --role when calling \`orch agent add\`.
|
|
60
|
-
|
|
61
|
-
After creation \u2014 \`orch context set agent-<name> "<capabilities>"\`.`;function w(){return [{id:"agt_creator",name:"Agent Creator",adapter:"claude",role:x,config:{model:"claude-sonnet-4-6",approval_policy:"suggest",max_turns:50,timeout_ms:36e5,stall_timeout_ms:3e5,skills:["document-skills:skill-creator"]},status:"idle",stats:{tasks_completed:0,tasks_failed:0,total_runs:0,total_runtime_ms:0}}]}var l=promisify(execFile);async function P(t={}){let o=process.cwd(),e=new b$1(o);if(await k(e.root)){k$1("Already initialized");return}await Promise.all([j(e.tasksDir),j(e.agentsDir),j(e.goalsDir),j(e.runsDir),j(e.templatesDir),j(e.logsDir)]);let c$1=await I(o),s=structuredClone(a);s.project.name=t.name??v.basename(o),c$1||(s.defaults.agent.workspace_mode="shared");let A=["# Runtime state","state.json","*.lock","","# Logs and runs","runs/","logs/","","# Agent workspaces","workspaces/"].join(`
|
|
62
|
-
`)+`
|
|
63
|
-
`,C=[".orchestry","node_modules",".env",".env.*","dist","build",".next","__pycache__","*.pyc",".venv"].join(`
|
|
64
|
-
`)+`
|
|
65
|
-
`,m=w();await Promise.all([c(e.configPath,s),a$1(e.gitignorePath,A),a$1(e.workspaceExcludePath,C),a$1(e.defaultTemplatePath(),f),...m.map(i=>c(e.agentPath(i.id),i))]),await b(o),c$1&&await T(o),console.log(),j$1("initialized"),console.log(),console.log(` Created ${q(".orchestry/")}`),console.log(` ${q("\u251C\u2500\u2500")} config.yml`),console.log(` ${q("\u251C\u2500\u2500")} tasks/`),console.log(` ${q("\u251C\u2500\u2500")} agents/`);for(let i of m)console.log(` ${q("\u2502 \u2514\u2500\u2500")} ${i.id}.yml ${q(`(${i.name})`)}`);console.log(` ${q("\u251C\u2500\u2500")} templates/default.md`),console.log(` ${q("\u2514\u2500\u2500")} .gitignore`),console.log();}async function I(t){try{return await l("git",["rev-parse","--is-inside-work-tree"],{cwd:t}),!0}catch{try{return await l("git",["init"],{cwd:t}),!0}catch{return false}}}async function T(t){try{await l("git",["rev-parse","HEAD"],{cwd:t});}catch{try{await l("git",["add","-A"],{cwd:t}),await l("git",["commit","-m","Initial commit","--allow-empty"],{cwd:t});}catch{}}}async function b(t){let o=v.join(t,".gitignore");try{let e=await k$2.readFile(o,"utf-8");if(e.split(`
|
|
66
|
-
`).some(s=>s.trim()===".orchestry"))return;let c=e.endsWith(`
|
|
67
|
-
`)?"":`
|
|
68
|
-
`;await k$2.appendFile(o,`${c}
|
|
69
|
-
# Orchestry state
|
|
70
|
-
.orchestry
|
|
71
|
-
`);}catch{await a$1(o,`# Orchestry state
|
|
72
|
-
.orchestry
|
|
73
|
-
`);}}function W(t){t.command("init").description("Initialize .orchestry/ in the current directory").option("--name <name>","Project name").action(async o=>{await P(o),console.log(` Next: ${q('orch task add "Create backend agent" --assignee agt_creator')}`),console.log();});}export{W as registerInitCommand,P as runInit};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {a,c}from'./chunk-FQ5YUP4J.js';import {a as a$1}from'./chunk-P4JTJBWO.js';import {n}from'./chunk-IKNBPOQL.js';import'./chunk-6MJ7V6VY.js';import {execFile}from'child_process';import {promisify}from'util';var f=promisify(execFile),d=class{constructor(e){this.processManager=e;}kind="opencode";async test(){try{let{stdout:e}=await f("opencode",["--version"]);return {ok:!0,version:e.trim()}}catch(e){let r=e instanceof Error?e.message:String(e);return {ok:false,error:"OpenCode CLI not found. Install: npm i -g opencode",errorKind:n(r)}}}execute(e){let r=["run","--format","json"];e.config.model&&r.push("--model",e.config.model);let a$1=a(e.systemPrompt,e.prompt);r.push(a$1);let{process:t,pid:n}=this.processManager.spawn("opencode",r,{cwd:e.workspace,env:{...process.env,...e.env},signal:e.signal}),s=c(t,y,"OpenCode",e.signal);return {pid:n,events:s}}async stop(e){await this.processManager.killWithGrace(e);}};function y(o){if(!o.trim())return null;try{let e=JSON.parse(o),r=new Date().toISOString(),a=e.type??"",t=e.part??{};switch(a){case "step_start":return null;case "text":return {type:"output",timestamp:r,data:t.text??t};case "tool_use":{let n$1=t.state??{};if(n$1.status==="error"){let s=typeof n$1.error=="string"?n$1.error:JSON.stringify(n$1);return {type:"error",timestamp:r,data:n$1,errorKind:n(s)}}return {type:"tool_call",timestamp:r,data:{name:t.tool,input:n$1.input}}}case "step_finish":{let n$1=t.reason,s=k(t);if(n$1==="error"){let g=typeof t.error=="string"?t.error:JSON.stringify(t);return {type:"error",timestamp:r,data:t,tokens:s,errorKind:n(g)}}return n$1==="tool-calls"?null:{type:"done",timestamp:r,data:t,tokens:s}}default:return {type:"output",timestamp:r,data:e}}}catch{return {type:"output",timestamp:new Date().toISOString(),data:o}}}function k(o){let e=o.tokens;if(!e||typeof e.input!="number")return;let r=e.input,a=typeof e.output=="number"?e.output:0,t=typeof e.reasoning=="number"?e.reasoning:0;return a$1(r,a,{reasoning:t})}export{d as OpenCodeAdapter};
|
package/dist/org-KLYK6MMJ.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {b}from'./chunk-HWEMBO36.js';import {l,q,i,j}from'./chunk-64WUDYEM.js';var d=[{key:"startup-mvp",name:"Startup MVP",description:"Ship an MVP in 48 hours",lead_index:0,agents:[{shop_key:"architect",name:"CTO"},{shop_key:"backend-dev",name:"Backend"},{shop_key:"backend-dev",name:"Backend 2"},{shop_key:"frontend-dev",name:"Frontend"},{shop_key:"qa-engineer",name:"QA"},{shop_key:"code-reviewer",name:"Reviewer"}]},{key:"pr-review-corp",name:"PR Review Corp",description:"Automated review for every PR",lead_index:0,agents:[{shop_key:"architect",name:"CTO"},{shop_key:"security-auditor",name:"Security"},{shop_key:"performance-engineer",name:"Performance"},{shop_key:"code-reviewer",name:"Style"},{shop_key:"qa-engineer",name:"QA"}]},{key:"migration-squad",name:"Migration Squad",description:"JS-to-TS migration over a weekend",lead_index:0,agents:[{shop_key:"architect",name:"CTO"},{shop_key:"fullstack-dev",name:"Migrator"},{shop_key:"fullstack-dev",name:"Migrator 2"},{shop_key:"fullstack-dev",name:"Migrator 3"},{shop_key:"qa-engineer",name:"QA"},{shop_key:"code-reviewer",name:"Reviewer"}]},{key:"security-dept",name:"Security Department",description:"Multi-layer security audit",lead_index:0,agents:[{shop_key:"security-auditor",name:"Lead Auditor"},{shop_key:"security-auditor",name:"Scanner"},{shop_key:"security-auditor",name:"Secrets Auditor"},{shop_key:"bug-hunter",name:"Hunter"},{shop_key:"code-reviewer",name:"Reviewer"}]},{key:"test-factory",name:"Test Factory",description:"Coverage from 40% to 80% overnight",lead_index:0,agents:[{shop_key:"qa-engineer",name:"Coverage Lead"},{shop_key:"backend-dev",name:"Backend"},{shop_key:"backend-dev",name:"Backend 2"},{shop_key:"qa-engineer",name:"QA"},{shop_key:"qa-engineer",name:"QA 2"},{shop_key:"code-reviewer",name:"Reviewer"}]},{key:"content-agency",name:"Content Agency",description:"Content factory: plan, write, edit, optimize",lead_index:0,agents:[{shop_key:"marketer",name:"Strategist"},{shop_key:"content-creator",name:"Writer"},{shop_key:"content-creator",name:"Writer 2"},{shop_key:"tech-writer",name:"Editor"},{shop_key:"growth-hacker",name:"SEO"}]},{key:"data-lab",name:"Data Lab",description:"3 CSVs to executive report by morning",lead_index:0,agents:[{shop_key:"data-engineer",name:"Lead Analyst"},{shop_key:"data-engineer",name:"Data Engineer"}]},{key:"sales-machine",name:"Sales Machine",description:"Outbound pipeline: research, outreach, follow-up, close",lead_index:0,agents:[{shop_key:"marketer",name:"Sales Director"},{shop_key:"content-creator",name:"SDR"},{shop_key:"content-creator",name:"SDR 2"},{shop_key:"content-creator",name:"Copywriter"},{shop_key:"growth-hacker",name:"Growth Analyst"}]},{key:"bugfix-dept",name:"Bugfix Department",description:"100 issues to 0 in a week",lead_index:0,agents:[{shop_key:"architect",name:"Triager"},{shop_key:"bug-hunter",name:"Fixer"},{shop_key:"bug-hunter",name:"Fixer 2"},{shop_key:"bug-hunter",name:"Fixer 3"},{shop_key:"qa-engineer",name:"QA"},{shop_key:"code-reviewer",name:"Reviewer"}]},{key:"docs-team",name:"Docs Team",description:"Technical docs from codebase analysis",lead_index:0,agents:[{shop_key:"architect",name:"Docs Lead"},{shop_key:"tech-writer",name:"Writer"},{shop_key:"tech-writer",name:"Writer 2"},{shop_key:"tech-writer",name:"Editor"},{shop_key:"code-reviewer",name:"Reviewer"}]}];function v(l){return d.find(t=>t.key===l)}function C(l$1,t){let h=l$1.command("org").description("Pre-built AI companies \u2014 deploy a full department with one command");h.command("list").alias("ls").description("List available company templates").action(async()=>{if(t.context.json){console.log(JSON.stringify(d,null,2));return}console.log();let c=["KEY","NAME","AGENTS","DESCRIPTION"],s=d.map(e=>[e.key,e.name,String(e.agents.length),e.description]);l(c,s),console.log(),console.log(` ${q("Deploy:")} orch org deploy <key> --goal "Your objective"`),console.log();}),h.command("deploy <template>").description("Deploy a pre-built AI company").option("--goal <goal>","Set a goal for the team").action(async(c,s)=>{let e=v(c);if(!e){i(`Unknown template "${c}"`,"Run: orch org list \u2014 to see available templates"),process.exitCode=1;return}let a=[];for(let n of e.agents){let o=b(n.shop_key);if(!o){i(`Agent shop template not found: ${n.shop_key}`),process.exitCode=1;return}try{let r=await t.agentService.create({name:n.name,adapter:o.adapter,role:o.role,model:o.model,approval_policy:o.approval_policy,skills:o.skills});a.push(r.id);}catch(r){i(`Failed to create agent "${n.name}": ${r instanceof Error?r.message:String(r)}`,a.length>0?`${a.length} agent(s) were already created. Clean up with: orch agent list`:void 0),process.exitCode=1;return}}let g=a[e.lead_index],w=a.filter(n=>n!==g),y=await t.teamService.create({name:e.name,description:e.description,lead_agent_id:g,member_agent_ids:w}),m;if(s.goal&&(m=(await t.goalService.create({title:s.goal,assignee:g})).id),t.context.json){console.log(JSON.stringify({team:y,agentIds:a,goalId:m},null,2));return}if(t.context.quiet){console.log(y.id);return}console.log(),j(`Deployed team "${e.name}" \u2014 ${e.agents.length} agents`),console.log();for(let n=0;n<e.agents.length;n++){let o=e.agents[n],r=a[n],k=n===e.lead_index,S=k?"lead":"member";console.log(` ${k?"\u2605":"\u2022"} ${o.name} ${q(`(${r}, ${S})`)}`);}console.log(`
|
|
3
|
-
Team: ${q(y.id)}`),m&&console.log(` Goal: ${q(m)} \u2014 "${s.goal}"`),console.log(),console.log(` ${q("Next:")} orch run --all --watch`),console.log();});}export{C as registerOrgCommand};
|
package/dist/shell-JC2WDWBR.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import*as a from'readline';import r from'chalk';async function w(o){if(!process.stdin.isTTY)return null;let s=0;function u(){let n=process.stdout.rows??24;return Math.max(1,Math.min(o.length,n-4))}function d(){let n=u();process.stdout.write("\x1B[2J\x1B[H"),console.log(r.bold.yellow(`
|
|
3
|
-
AGENT SHOP`)+r.gray(` \u2014 arrow keys to navigate, enter to select, q to cancel
|
|
4
|
-
`));let c=Math.max(0,Math.min(s-Math.floor(n/2),o.length-n)),t=Math.min(c+n,o.length);for(let l=c;l<t;l++){let i=o[l],e=l===s,p=e?r.yellow(" \u25B8 "):" ",m=e?r.bold.white(i.name):r.gray(i.name),g=r.gray(` \u2014 ${i.description}`),h=r.gray.dim(` [${i.model.replace("claude-","")}]`);console.log(`${p}${m}${g}${h}`);}o.length>n&&console.log(r.gray(`
|
|
5
|
-
${c+1}-${t} of ${o.length}`));}return new Promise(n=>{let c=a.createInterface({input:process.stdin});process.stdin.setRawMode(true),a.emitKeypressEvents(process.stdin);function t(){process.stdin.removeListener("keypress",l);try{process.stdin.setRawMode(!1);}catch{}c.close(),process.stdout.write("\x1B[2J\x1B[H");}let l=(i,e)=>{e.name==="up"||e.ctrl&&e.name==="p"?(s=(s-1+o.length)%o.length,d()):e.name==="down"||e.ctrl&&e.name==="n"?(s=(s+1)%o.length,d()):e.name==="return"?(t(),n(o[s])):(e.name==="q"||e.name==="escape"||e.ctrl&&e.name==="c")&&(t(),n(null));};c.on("error",()=>{t(),n(null);}),c.on("close",()=>{t(),n(null);});try{d();}catch{t(),n(null);return}process.stdin.on("keypress",l);})}export{w as pickFromShop};
|
package/dist/tui-24NBO5U6.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
function ct(d,e){d.command("tui").description("Launch interactive TUI dashboard").action(async()=>{let S=await e.taskService.list(),w=await e.agentService.list(),h=await e.stateStore.read(),{render:k}=await import('ink'),{createElement:T}=await import('react'),{App:b}=await import('./App-2CW2WICK.js'),A=async t=>{await e.orchestrator.runTask(t);},R=async(t,s)=>e.taskService.create({title:t,priority:s?.priority,description:s?.description,attachments:s?.attachments}),C=async t=>{await e.orchestrator.cancelTask(t);},_=async t=>{await e.taskService.retry(t);},E=async(t,s)=>{await e.taskService.assign(t,s);},j=async()=>{await e.orchestrator.runAll();},D=async t=>{await e.agentService.disable(t);},U=async t=>{await e.agentService.enable(t);},m=t=>e.eventBus.onAny(t),P=async()=>e.taskService.list(),G=async()=>e.agentService.list(),x=async()=>e.stateStore.read(),I=async(t,s,n)=>e.agentService.create({name:t,adapter:s??"claude",model:n?.model||void 0,effort:n?.effort||void 0,role:n?.role||void 0,approval_policy:n?.approval_policy||void 0,skills:n?.skills||void 0}),L=async t=>{await e.agentService.remove(t);},F=async t=>{await e.taskService.delete(t);},H=async t=>{await e.taskService.updateStatus(t,"done");},O=async(t,s)=>{await e.taskService.reject(t,s);},W=async(t,s)=>e.taskService.update(t,s),N=async(t,s)=>e.agentService.update(t,{...s,effort:s.effort,approval_policy:s.approval_policy}),B=async t=>{await e.orchestrator.forceStopAgent(t);},M=async(t,s)=>e.agentService.setAutonomous(t,s),V=async t=>{let s=await e.runService.listAll();s.sort((a,i)=>new Date(i.started_at).getTime()-new Date(a.started_at).getTime());let n=s.filter(a=>a.status==="succeeded"||a.status==="failed"),u=3,ot=10,y=n.slice(0,u),v=n.slice(u,ot),f=async a=>(await e.runService.readEventsTail(a.id,30)).map(r=>({timestamp:r.timestamp,agentId:a.agent_id,taskId:a.task_id,type:r.type,data:r.data}));if(y.length>0){let a=(await Promise.all(y.map(f))).flat();a.sort((i,r)=>new Date(i.timestamp).getTime()-new Date(r.timestamp).getTime()),t(a.slice(-200));}if(v.length>0){let a=(await Promise.all(v.map(f))).flat();a.sort((i,r)=>new Date(i.timestamp).getTime()-new Date(r.timestamp).getTime()),t(a.slice(-200));}},J=async t=>e.teamService.create(t),K=async()=>e.teamService.list(),q=async(t,s)=>e.teamService.join(t,s),z=async(t,s)=>e.teamService.leave(t,s),Q=async t=>{await e.teamService.disband(t);},X=async(t,s)=>e.teamService.setLead(t,s),Y=async()=>e.goalService.list(),Z=async t=>e.goalService.create(t),$=async(t,s)=>e.goalService.update(t,s),tt=async(t,s)=>e.goalService.updateStatus(t,s),et=async t=>{await e.goalService.delete(t);},st=async t=>e.goalService.getProgressReport(t),at=async()=>{await e.orchestrator.startWatch();},nt=async()=>{await e.orchestrator.stop();},c=d.version()??"0.0.0",rt=import('./update-check-R5ABF6HE.js').then(t=>t.checkForUpdateSWR(c)).catch(()=>null),l=false,p,g=false,o;try{await e.orchestrator.startWatch(),l=!0;}catch(t){p=t instanceof Error?t.message:String(t);let{DiskObserver:s}=await import('./disk-observer-B3NOZ2QA.js');o=new s({paths:e.paths,stateStore:e.stateStore}),g=true,m=n=>o.subscribe(n);}let{waitUntilExit:it}=k(T(b,{projectName:e.config.project.name,tasks:S,agents:w,state:h,onRunTask:A,onCreateTask:R,onCancelTask:C,onRetryTask:_,onAssignTask:E,onRunAll:j,onDisableAgent:D,onEnableAgent:U,onSubscribeEvents:m,onRefreshTasks:P,onRefreshAgents:G,onRefreshState:x,onLoadHistory:V,onAddAgent:I,onDeleteAgent:L,onApproveTask:H,onRejectTask:O,onDeleteTask:F,onUpdateTask:W,onUpdateAgent:N,onForceStopAgent:B,onToggleAutonomous:M,onRefreshGoals:Y,onCreateGoal:Z,onUpdateGoal:$,onUpdateGoalStatus:tt,onDeleteGoal:et,onGetGoalProgress:st,onCreateTeam:J,onListTeams:K,onJoinTeam:q,onLeaveTeam:z,onDisbandTeam:Q,onSetTeamLead:X,onStartWatch:at,onStopWatch:nt,initialWatchActive:l,observerMode:g,watchError:g?void 0:p,version:c,latestVersion:void 0,onCheckUpdate:async()=>{let t=await rt;if(t?.updateAvailable)return t.latest;let n=await(await import('./update-check-R5ABF6HE.js')).checkForUpdateNow(c);return n?.updateAvailable?n.latest:void 0},onBackgroundInstall:async t=>(await import('./update-check-R5ABF6HE.js')).backgroundInstall(t),initialActivityFilter:e.globalConfig.tui.activity_filter,onSaveActivityFilter:async t=>{await e.globalConfigStore.set("activity_filter",t);},initialNotifications:e.globalConfig.tui.notifications,onSaveNotifications:async t=>{await e.globalConfigStore.set("notifications",t);},initialMaxConcurrent:e.config.scheduling.max_concurrent_agents,onSaveMaxConcurrent:async t=>{await e.configStore.set("scheduling.max_concurrent_agents",t),e.config.scheduling.max_concurrent_agents=t;},onCompleteOnboarding:async()=>{let t=await e.stateStore.read();t.onboardingCompleted=true,await e.stateStore.write(t);}}),{incrementalRendering:true,kittyKeyboard:{mode:"auto",flags:["disambiguateEscapeCodes"]}});await it(),l&&await e.orchestrator.stop().catch(()=>{}),o&&o.stop(),e.eventBus.clear();});}export{ct as registerTuiCommand};
|
package/scripts/demo.sh
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# ============================================================
|
|
3
|
-
# ORCH Demo — asciinema-ready terminal workflow
|
|
4
|
-
#
|
|
5
|
-
# Record: asciinema rec demo.cast -c ./scripts/demo.sh \
|
|
6
|
-
# --title "ORCH — AI Agent Runtime Demo"
|
|
7
|
-
#
|
|
8
|
-
# Preview: asciinema play demo.cast
|
|
9
|
-
# To GIF: agg demo.cast demo.gif --font-size 14 --theme monokai
|
|
10
|
-
#
|
|
11
|
-
# Duration: ~75 seconds
|
|
12
|
-
# Shows: setup → add agents → add tasks → run --all →
|
|
13
|
-
# parallel execution → state transitions → status
|
|
14
|
-
# ============================================================
|
|
15
|
-
set -euo pipefail
|
|
16
|
-
|
|
17
|
-
# ── visual config ────────────────────────────────────────────
|
|
18
|
-
TYPE_SPEED=0.035 # seconds per character (adjust for recording speed)
|
|
19
|
-
CMD_PAUSE=0.7 # pause after showing command before running
|
|
20
|
-
SECTION_PAUSE=1.0 # pause between sections
|
|
21
|
-
OUTPUT_PAUSE=0.4 # pause after output before next step
|
|
22
|
-
|
|
23
|
-
# ── color helpers ────────────────────────────────────────────
|
|
24
|
-
RESET="\033[0m"
|
|
25
|
-
BOLD="\033[1m"
|
|
26
|
-
GREEN="\033[1;32m"
|
|
27
|
-
YELLOW="\033[1;33m"
|
|
28
|
-
CYAN="\033[1;36m"
|
|
29
|
-
BLUE="\033[0;34m"
|
|
30
|
-
MAGENTA="\033[0;35m"
|
|
31
|
-
DIM="\033[90m"
|
|
32
|
-
RED="\033[0;31m"
|
|
33
|
-
|
|
34
|
-
# ── utility functions ────────────────────────────────────────
|
|
35
|
-
type_cmd() {
|
|
36
|
-
printf "${GREEN}\$${RESET} "
|
|
37
|
-
local text="$1"
|
|
38
|
-
for (( i=0; i<${#text}; i++ )); do
|
|
39
|
-
printf "%s" "${text:$i:1}"
|
|
40
|
-
sleep "$TYPE_SPEED"
|
|
41
|
-
done
|
|
42
|
-
sleep "$CMD_PAUSE"
|
|
43
|
-
printf "\n"
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
run_cmd() {
|
|
47
|
-
eval "$1" 2>/dev/null || true
|
|
48
|
-
sleep "$OUTPUT_PAUSE"
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
pause() { sleep "${1:-$SECTION_PAUSE}"; }
|
|
52
|
-
|
|
53
|
-
section() {
|
|
54
|
-
printf "\n${YELLOW}# ── %s ──${RESET}\n\n" "$1"
|
|
55
|
-
sleep 0.5
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
divider() {
|
|
59
|
-
printf "${DIM}────────────────────────────────────────────────────${RESET}\n"
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
# ── demo environment setup ───────────────────────────────────
|
|
63
|
-
DEMO_DIR="/tmp/orch-demo-$$"
|
|
64
|
-
mkdir -p "$DEMO_DIR"
|
|
65
|
-
cd "$DEMO_DIR"
|
|
66
|
-
|
|
67
|
-
# pre-create .orchestry structure silently so init is instant
|
|
68
|
-
export NO_COLOR=""
|
|
69
|
-
|
|
70
|
-
# ── SCENE 0: Clear + intro ───────────────────────────────────
|
|
71
|
-
clear
|
|
72
|
-
sleep 0.5
|
|
73
|
-
|
|
74
|
-
printf "${YELLOW}${BOLD}"
|
|
75
|
-
printf " ┌─────────────────────────────────────────────────┐\n"
|
|
76
|
-
printf " │ ORCH — AI Agent Runtime │\n"
|
|
77
|
-
printf " │ 3 agents. Parallel execution. Zero babysitting │\n"
|
|
78
|
-
printf " └─────────────────────────────────────────────────┘\n"
|
|
79
|
-
printf "${RESET}\n"
|
|
80
|
-
sleep 1.5
|
|
81
|
-
|
|
82
|
-
# ── SCENE 1: Install (show only — not actually installing) ───
|
|
83
|
-
section "Install"
|
|
84
|
-
|
|
85
|
-
type_cmd "npm install -g @oxgeneral/orch"
|
|
86
|
-
printf "${DIM} added 1 package in 2.1s${RESET}\n"
|
|
87
|
-
printf "${GREEN} ✓ orch v1.0.5 installed${RESET}\n"
|
|
88
|
-
sleep "$OUTPUT_PAUSE"
|
|
89
|
-
pause 0.5
|
|
90
|
-
|
|
91
|
-
# ── SCENE 2: Init ────────────────────────────────────────────
|
|
92
|
-
section "Initialize project"
|
|
93
|
-
|
|
94
|
-
type_cmd "mkdir my-project && cd my-project"
|
|
95
|
-
printf "" # no output
|
|
96
|
-
|
|
97
|
-
type_cmd "orch init"
|
|
98
|
-
run_cmd "orch init"
|
|
99
|
-
pause 0.5
|
|
100
|
-
|
|
101
|
-
# ── SCENE 3: Add agents ──────────────────────────────────────
|
|
102
|
-
section "Add your AI team (3 agents)"
|
|
103
|
-
|
|
104
|
-
type_cmd 'orch agent add "Backend" --adapter claude --model claude-sonnet-4-6 --role "Senior TypeScript developer. Implements features end-to-end." --approval-policy auto'
|
|
105
|
-
run_cmd 'orch agent add "Backend" --adapter claude --model claude-sonnet-4-6 --role "Senior TypeScript developer. Implements features end-to-end." --approval-policy auto'
|
|
106
|
-
|
|
107
|
-
type_cmd 'orch agent add "QA" --adapter claude --model claude-sonnet-4-6 --role "QA engineer. Writes integration tests, verifies correctness." --approval-policy auto'
|
|
108
|
-
run_cmd 'orch agent add "QA" --adapter claude --model claude-sonnet-4-6 --role "QA engineer. Writes integration tests, verifies correctness." --approval-policy auto'
|
|
109
|
-
|
|
110
|
-
type_cmd 'orch agent add "Reviewer" --adapter claude --model claude-sonnet-4-6 --role "Code reviewer. Checks quality, security, and edge cases." --approval-policy auto'
|
|
111
|
-
run_cmd 'orch agent add "Reviewer" --adapter claude --model claude-sonnet-4-6 --role "Code reviewer. Checks quality, security, and edge cases." --approval-policy auto'
|
|
112
|
-
|
|
113
|
-
pause 0.3
|
|
114
|
-
type_cmd "orch agent list"
|
|
115
|
-
run_cmd "orch agent list"
|
|
116
|
-
pause
|
|
117
|
-
|
|
118
|
-
# ── SCENE 4: Add tasks ───────────────────────────────────────
|
|
119
|
-
section "Queue tasks"
|
|
120
|
-
|
|
121
|
-
type_cmd 'orch task add "Implement REST API: GET /users endpoint" -p 2'
|
|
122
|
-
run_cmd 'orch task add "Implement REST API: GET /users endpoint" -p 2'
|
|
123
|
-
|
|
124
|
-
type_cmd 'orch task add "Write integration tests for /users endpoint" -p 2'
|
|
125
|
-
run_cmd 'orch task add "Write integration tests for /users endpoint" -p 2'
|
|
126
|
-
|
|
127
|
-
type_cmd 'orch task add "Review: API implementation + test coverage" -p 3'
|
|
128
|
-
run_cmd 'orch task add "Review: API implementation + test coverage" -p 3'
|
|
129
|
-
|
|
130
|
-
pause 0.3
|
|
131
|
-
type_cmd "orch task list"
|
|
132
|
-
run_cmd "orch task list"
|
|
133
|
-
pause
|
|
134
|
-
|
|
135
|
-
# ── SCENE 5: Run — simulated parallel execution ──────────────
|
|
136
|
-
section "orch run --all (parallel execution)"
|
|
137
|
-
|
|
138
|
-
printf "${GREEN}\$${RESET} orch run --all\n"
|
|
139
|
-
sleep 0.4
|
|
140
|
-
|
|
141
|
-
printf "${DIM}[orchestrator] tick #1 — dispatching idle agents...${RESET}\n"; sleep 0.3
|
|
142
|
-
divider
|
|
143
|
-
|
|
144
|
-
# Backend and QA claim tasks simultaneously
|
|
145
|
-
printf "${BLUE}[Backend ]${RESET} ${YELLOW}▶${RESET} Claiming \"Implement REST API: GET /users endpoint\"\n"; sleep 0.15
|
|
146
|
-
printf "${MAGENTA}[QA ]${RESET} ${YELLOW}▶${RESET} Claiming \"Write integration tests for /users endpoint\"\n"; sleep 0.3
|
|
147
|
-
|
|
148
|
-
printf "${BLUE}[Backend ]${RESET} ${YELLOW}●${RESET} Running ${DIM}todo${RESET} → ${YELLOW}in_progress${RESET}\n"; sleep 0.15
|
|
149
|
-
printf "${MAGENTA}[QA ]${RESET} ${YELLOW}●${RESET} Running ${DIM}todo${RESET} → ${YELLOW}in_progress${RESET}\n"; sleep 0.4
|
|
150
|
-
|
|
151
|
-
printf "${DIM}[orchestrator] 2 agents running in parallel...${RESET}\n"; sleep 1.2
|
|
152
|
-
|
|
153
|
-
# Backend finishes first
|
|
154
|
-
printf "${BLUE}[Backend ]${RESET} ${CYAN}⏸${RESET} Awaiting ${YELLOW}in_progress${RESET} → ${CYAN}review${RESET}\n"; sleep 0.5
|
|
155
|
-
|
|
156
|
-
# QA finishes
|
|
157
|
-
printf "${MAGENTA}[QA ]${RESET} ${CYAN}⏸${RESET} Awaiting ${YELLOW}in_progress${RESET} → ${CYAN}review${RESET}\n"; sleep 0.4
|
|
158
|
-
|
|
159
|
-
printf "${DIM}[orchestrator] tick #2 — dispatching Reviewer...${RESET}\n"; sleep 0.3
|
|
160
|
-
divider
|
|
161
|
-
|
|
162
|
-
printf "${YELLOW}[Reviewer ]${RESET} ${YELLOW}▶${RESET} Claiming \"Review: API implementation + test coverage\"\n"; sleep 0.2
|
|
163
|
-
printf "${YELLOW}[Reviewer ]${RESET} ${YELLOW}●${RESET} Running ${DIM}todo${RESET} → ${YELLOW}in_progress${RESET}\n"; sleep 1.0
|
|
164
|
-
|
|
165
|
-
# Reviewer approves both
|
|
166
|
-
printf "${BLUE}[Backend ]${RESET} ${GREEN}✓${RESET} Approved ${CYAN}review${RESET} → ${GREEN}done${RESET}\n"; sleep 0.3
|
|
167
|
-
printf "${MAGENTA}[QA ]${RESET} ${GREEN}✓${RESET} Approved ${CYAN}review${RESET} → ${GREEN}done${RESET}\n"; sleep 0.4
|
|
168
|
-
printf "${YELLOW}[Reviewer ]${RESET} ${GREEN}✓${RESET} Done ${YELLOW}in_progress${RESET} → ${GREEN}done${RESET}\n"; sleep 0.3
|
|
169
|
-
|
|
170
|
-
divider
|
|
171
|
-
printf "\n${GREEN}${BOLD}✓ All 3 tasks completed. 2 agents ran in parallel. 0 failures.${RESET}\n"
|
|
172
|
-
printf "${DIM} Total: ~47s · Backend: 31s · QA: 38s · Reviewer: 22s${RESET}\n"
|
|
173
|
-
pause
|
|
174
|
-
|
|
175
|
-
# ── SCENE 6: Final status check ─────────────────────────────
|
|
176
|
-
section "Results"
|
|
177
|
-
|
|
178
|
-
type_cmd "orch task list"
|
|
179
|
-
run_cmd "orch task list"
|
|
180
|
-
pause 0.5
|
|
181
|
-
|
|
182
|
-
type_cmd "orch status"
|
|
183
|
-
run_cmd "orch status"
|
|
184
|
-
pause
|
|
185
|
-
|
|
186
|
-
# ── OUTRO ────────────────────────────────────────────────────
|
|
187
|
-
printf "\n"
|
|
188
|
-
printf "${YELLOW}${BOLD}"
|
|
189
|
-
printf "╔══════════════════════════════════════════════════════╗\n"
|
|
190
|
-
printf "║ ORCH — AI Agent Runtime ║\n"
|
|
191
|
-
printf "║ ║\n"
|
|
192
|
-
printf "║ npm install -g @oxgeneral/orch ║\n"
|
|
193
|
-
printf "║ github.com/oxgeneral/ORCH ║\n"
|
|
194
|
-
printf "║ ║\n"
|
|
195
|
-
printf "║ ⭐ Star us if this saved you time ║\n"
|
|
196
|
-
printf "╚══════════════════════════════════════════════════════╝\n"
|
|
197
|
-
printf "${RESET}\n"
|
|
198
|
-
sleep 3
|
|
199
|
-
|
|
200
|
-
# ── cleanup ──────────────────────────────────────────────────
|
|
201
|
-
cd /tmp
|
|
202
|
-
rm -rf "$DEMO_DIR"
|
|
File without changes
|