agentix-cli 0.215.0 → 0.217.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-OUWMH6QG.js → App-IXJCCCGN.js} +2 -2
- package/dist/{ChatApp-EZ5A47FV.js → ChatApp-4YCCRL5M.js} +2 -2
- package/dist/{absorb-eval-WM6JQGYG.js → absorb-eval-YE57HA6N.js} +2 -2
- package/dist/{adapter-W26OC6ET.js → adapter-CRVWPQBN.js} +2 -2
- package/dist/{agent-KOKQSRAH.js → agent-CTZN3P2K.js} +2 -2
- package/dist/{board-dashboard-NVQUQSWI.js → board-dashboard-2WE2HBEW.js} +621 -394
- package/dist/board-dashboard-2WE2HBEW.js.map +1 -0
- package/dist/{chunk-OQNJIIR2.js → chunk-2F7KQ4DJ.js} +2 -2
- package/dist/{chunk-XHON5WB5.js → chunk-2MAKXLK2.js} +3 -3
- package/dist/{chunk-GGAEFVXL.js → chunk-3B7RH3IK.js} +2 -2
- package/dist/{chunk-ACPGDZOV.js → chunk-3C6UDZDX.js} +2 -2
- package/dist/{chunk-H4DWZIU7.js → chunk-56UTQ4FU.js} +2 -2
- package/dist/chunk-5FFNFW4C.js +20 -0
- package/dist/chunk-5FFNFW4C.js.map +1 -0
- package/dist/{chunk-MIUITI47.js → chunk-64IVC2G6.js} +2 -2
- package/dist/{chunk-IHFOW4JF.js → chunk-AOPNASCE.js} +2 -2
- package/dist/chunk-BXK5S2KK.js +13 -0
- package/dist/chunk-BXK5S2KK.js.map +1 -0
- package/dist/{chunk-QOGZD6Z3.js → chunk-ELC3M5WS.js} +318 -316
- package/dist/chunk-ELC3M5WS.js.map +1 -0
- package/dist/{chunk-PSYHAO57.js → chunk-FFLMSNTN.js} +2 -2
- package/dist/{chunk-JLH73NRM.js → chunk-GEKEILPL.js} +5 -5
- package/dist/{chunk-JLH73NRM.js.map → chunk-GEKEILPL.js.map} +1 -1
- package/dist/{chunk-J2R47R56.js → chunk-I4FXWN7I.js} +2 -2
- package/dist/{chunk-CSC45PA7.js → chunk-IP67DTXX.js} +2 -2
- package/dist/chunk-KBSQRQPF.js +10 -0
- package/dist/chunk-KBSQRQPF.js.map +1 -0
- package/dist/{chunk-4BYJN2A3.js → chunk-LLNLDZNA.js} +2 -2
- package/dist/{chunk-N476XZD3.js → chunk-LSFLSB7C.js} +2 -2
- package/dist/{chunk-4ZD2C76P.js → chunk-M42GMRZF.js} +2 -2
- package/dist/{chunk-JKMFKNGS.js → chunk-MFZNBE65.js} +2 -2
- package/dist/{chunk-4DCQIHWU.js → chunk-NFUHYIYG.js} +2 -2
- package/dist/chunk-O2YDS2P3.js +8 -0
- package/dist/chunk-O2YDS2P3.js.map +1 -0
- package/dist/{chunk-B7HDWFKR.js → chunk-OJ4RUZZY.js} +2 -2
- package/dist/chunk-PZ2F6J2E.js +134 -0
- package/dist/chunk-PZ2F6J2E.js.map +1 -0
- package/dist/{chunk-CAH6TNC6.js → chunk-Q432O462.js} +2 -2
- package/dist/{chunk-Z7632XS3.js → chunk-QEOGWSRR.js} +2 -2
- package/dist/{chunk-QR3P5RG7.js → chunk-QGRIW7SE.js} +2 -2
- package/dist/{chunk-JEBU5JUM.js → chunk-RKKAP4EY.js} +2 -2
- package/dist/{chunk-HY4PE6R3.js → chunk-SJJ7QEFE.js} +2 -2
- package/dist/{chunk-6UTOBSEA.js → chunk-SYIDD7CI.js} +2 -2
- package/dist/{chunk-7AFXLWWW.js → chunk-WHAMZPEG.js} +141 -87
- package/dist/chunk-WHAMZPEG.js.map +1 -0
- package/dist/{chunk-QMICGPM6.js → chunk-X2GBLX3E.js} +2 -2
- package/dist/{chunk-M4H2RYP4.js → chunk-XQH4LCZR.js} +2 -2
- package/dist/{chunk-Q7Y5VQGX.js → chunk-YXGZSVPY.js} +2 -2
- package/dist/{chunk-ZRBTLW2B.js → chunk-Z5HYCMDF.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/client-UPXDV3SM.js +2 -0
- package/dist/config-LAM4HUTA.js +2 -0
- package/dist/config-mutate-P4QLFUVH.js +2 -0
- package/dist/config-mutator-RIPSMYAO.js +2 -0
- package/dist/{contributions-FXUTKU6R.js → contributions-SHSEI3TX.js} +2 -2
- package/dist/{doctor-GP2KVKWE.js → doctor-TLDBNHYM.js} +2 -2
- package/dist/{follow-up-tool-C4PLLZIT.js → follow-up-tool-VM4ZDRC5.js} +2 -2
- package/dist/{follow-up-tool-C4PLLZIT.js.map → follow-up-tool-VM4ZDRC5.js.map} +1 -1
- package/dist/{grants-U2734ZHZ.js → grants-ZA35QVTX.js} +2 -2
- package/dist/hub-7Y6ZUVJV.js +2 -0
- package/dist/index.d.ts +375 -295
- package/dist/index.js +1 -1
- package/dist/org-tool-TOHI7MBS.js +2 -0
- package/dist/{org-tool-6PPIGWH2.js.map → org-tool-TOHI7MBS.js.map} +1 -1
- package/dist/{program-WSGVQTFM.js → program-QZKK3Y2W.js} +310 -310
- package/dist/program-QZKK3Y2W.js.map +1 -0
- package/dist/{promote-CXXMZWWH.js → promote-OBTQ3ZUN.js} +2 -2
- package/dist/push-bridge-T5HZZRA2.js +1 -1
- package/dist/{query-RPZIRN3X.js → query-K6NR3GQE.js} +2 -2
- package/dist/{query-settings-EBOBWOAL.js → query-settings-NIZBB73K.js} +2 -2
- package/dist/{registry-KRU6AWVW.js → registry-B7X6YGS7.js} +2 -2
- package/dist/{request-planner-LNNKTY7K.js → request-planner-YDIX4BQW.js} +2 -2
- package/dist/{review-candidates-HQBKXAJA.js → review-candidates-3QCCHXWM.js} +2 -2
- package/dist/routing-BGMIY5JY.js +2 -0
- package/dist/schedule-tool-P6XM6W3S.js +2 -0
- package/dist/scheduler-PUKN5YSL.js +2 -0
- package/dist/{seat-BSWBTNCP.js → seat-OTAJJ5BP.js} +2 -2
- package/dist/{select-T4F42G6W.js → select-KKMXIVVL.js} +2 -2
- package/dist/{set-enabled-UK4TPVC7.js → set-enabled-BNF427ZN.js} +2 -2
- package/dist/{sprint-tool-DN3BKLUY.js → sprint-tool-Y72HTX5X.js} +2 -2
- package/dist/{sprint-tool-DN3BKLUY.js.map → sprint-tool-Y72HTX5X.js.map} +1 -1
- package/dist/{tool-L3CQUOAZ.js → tool-DW6MYEG2.js} +2 -2
- package/dist/{tool-L3CQUOAZ.js.map → tool-DW6MYEG2.js.map} +1 -1
- package/dist/tool-EA4FWTH6.js +2 -0
- package/dist/{tool-ZVYUWVJQ.js → tool-F4ZVMX4J.js} +2 -2
- package/dist/{tool-ZVYUWVJQ.js.map → tool-F4ZVMX4J.js.map} +1 -1
- package/dist/{tool-ZCSGJ2ZF.js → tool-HUOT3I42.js} +2 -2
- package/dist/{tool-ZCSGJ2ZF.js.map → tool-HUOT3I42.js.map} +1 -1
- package/dist/tool-QDAD4ACK.js +4 -0
- package/dist/{tool-JJGEGQF3.js.map → tool-QDAD4ACK.js.map} +1 -1
- package/dist/wiki-J6MSHSVD.js +2 -0
- package/dist/wiki-enrich-3Y3TZ6ZK.js +2 -0
- package/dist/{workspace-setup-VGXHYCD5.js → workspace-setup-CQ5FMT2B.js} +2 -2
- package/dist/workspace-setup-CQ5FMT2B.js.map +1 -0
- package/package.json +1 -1
- package/dist/board-dashboard-NVQUQSWI.js.map +0 -1
- package/dist/chunk-35UGFFHA.js +0 -20
- package/dist/chunk-35UGFFHA.js.map +0 -1
- package/dist/chunk-7AFXLWWW.js.map +0 -1
- package/dist/chunk-KAM4ZWRE.js +0 -133
- package/dist/chunk-KAM4ZWRE.js.map +0 -1
- package/dist/chunk-OQQTV3OF.js +0 -12
- package/dist/chunk-OQQTV3OF.js.map +0 -1
- package/dist/chunk-QOGZD6Z3.js.map +0 -1
- package/dist/chunk-RKPAVWXF.js +0 -2
- package/dist/chunk-RKPAVWXF.js.map +0 -1
- package/dist/chunk-UUOCCLIL.js +0 -8
- package/dist/chunk-UUOCCLIL.js.map +0 -1
- package/dist/client-U3OFNJ5W.js +0 -2
- package/dist/config-S522VXLI.js +0 -2
- package/dist/config-mutate-KBZV2T4X.js +0 -2
- package/dist/config-mutator-YNNEGRV3.js +0 -2
- package/dist/hub-V2AGLA7T.js +0 -2
- package/dist/org-tool-6PPIGWH2.js +0 -2
- package/dist/program-WSGVQTFM.js.map +0 -1
- package/dist/routing-XXA7GIBA.js +0 -2
- package/dist/schedule-tool-65TFOUWK.js +0 -2
- package/dist/scheduler-DIPOBJBF.js +0 -2
- package/dist/tool-JJGEGQF3.js +0 -4
- package/dist/wiki-IDLRJ6WL.js +0 -2
- package/dist/wiki-enrich-XWLDJAZI.js +0 -2
- /package/dist/{App-OUWMH6QG.js.map → App-IXJCCCGN.js.map} +0 -0
- /package/dist/{ChatApp-EZ5A47FV.js.map → ChatApp-4YCCRL5M.js.map} +0 -0
- /package/dist/{absorb-eval-WM6JQGYG.js.map → absorb-eval-YE57HA6N.js.map} +0 -0
- /package/dist/{adapter-W26OC6ET.js.map → adapter-CRVWPQBN.js.map} +0 -0
- /package/dist/{agent-KOKQSRAH.js.map → agent-CTZN3P2K.js.map} +0 -0
- /package/dist/{chunk-OQNJIIR2.js.map → chunk-2F7KQ4DJ.js.map} +0 -0
- /package/dist/{chunk-XHON5WB5.js.map → chunk-2MAKXLK2.js.map} +0 -0
- /package/dist/{chunk-GGAEFVXL.js.map → chunk-3B7RH3IK.js.map} +0 -0
- /package/dist/{chunk-ACPGDZOV.js.map → chunk-3C6UDZDX.js.map} +0 -0
- /package/dist/{chunk-H4DWZIU7.js.map → chunk-56UTQ4FU.js.map} +0 -0
- /package/dist/{chunk-MIUITI47.js.map → chunk-64IVC2G6.js.map} +0 -0
- /package/dist/{chunk-IHFOW4JF.js.map → chunk-AOPNASCE.js.map} +0 -0
- /package/dist/{chunk-PSYHAO57.js.map → chunk-FFLMSNTN.js.map} +0 -0
- /package/dist/{chunk-J2R47R56.js.map → chunk-I4FXWN7I.js.map} +0 -0
- /package/dist/{chunk-CSC45PA7.js.map → chunk-IP67DTXX.js.map} +0 -0
- /package/dist/{chunk-4BYJN2A3.js.map → chunk-LLNLDZNA.js.map} +0 -0
- /package/dist/{chunk-N476XZD3.js.map → chunk-LSFLSB7C.js.map} +0 -0
- /package/dist/{chunk-4ZD2C76P.js.map → chunk-M42GMRZF.js.map} +0 -0
- /package/dist/{chunk-JKMFKNGS.js.map → chunk-MFZNBE65.js.map} +0 -0
- /package/dist/{chunk-4DCQIHWU.js.map → chunk-NFUHYIYG.js.map} +0 -0
- /package/dist/{chunk-B7HDWFKR.js.map → chunk-OJ4RUZZY.js.map} +0 -0
- /package/dist/{chunk-CAH6TNC6.js.map → chunk-Q432O462.js.map} +0 -0
- /package/dist/{chunk-Z7632XS3.js.map → chunk-QEOGWSRR.js.map} +0 -0
- /package/dist/{chunk-QR3P5RG7.js.map → chunk-QGRIW7SE.js.map} +0 -0
- /package/dist/{chunk-JEBU5JUM.js.map → chunk-RKKAP4EY.js.map} +0 -0
- /package/dist/{chunk-HY4PE6R3.js.map → chunk-SJJ7QEFE.js.map} +0 -0
- /package/dist/{chunk-6UTOBSEA.js.map → chunk-SYIDD7CI.js.map} +0 -0
- /package/dist/{chunk-QMICGPM6.js.map → chunk-X2GBLX3E.js.map} +0 -0
- /package/dist/{chunk-M4H2RYP4.js.map → chunk-XQH4LCZR.js.map} +0 -0
- /package/dist/{chunk-Q7Y5VQGX.js.map → chunk-YXGZSVPY.js.map} +0 -0
- /package/dist/{chunk-ZRBTLW2B.js.map → chunk-Z5HYCMDF.js.map} +0 -0
- /package/dist/{client-U3OFNJ5W.js.map → client-UPXDV3SM.js.map} +0 -0
- /package/dist/{config-S522VXLI.js.map → config-LAM4HUTA.js.map} +0 -0
- /package/dist/{config-mutate-KBZV2T4X.js.map → config-mutate-P4QLFUVH.js.map} +0 -0
- /package/dist/{config-mutator-YNNEGRV3.js.map → config-mutator-RIPSMYAO.js.map} +0 -0
- /package/dist/{contributions-FXUTKU6R.js.map → contributions-SHSEI3TX.js.map} +0 -0
- /package/dist/{doctor-GP2KVKWE.js.map → doctor-TLDBNHYM.js.map} +0 -0
- /package/dist/{grants-U2734ZHZ.js.map → grants-ZA35QVTX.js.map} +0 -0
- /package/dist/{hub-V2AGLA7T.js.map → hub-7Y6ZUVJV.js.map} +0 -0
- /package/dist/{promote-CXXMZWWH.js.map → promote-OBTQ3ZUN.js.map} +0 -0
- /package/dist/{query-RPZIRN3X.js.map → query-K6NR3GQE.js.map} +0 -0
- /package/dist/{query-settings-EBOBWOAL.js.map → query-settings-NIZBB73K.js.map} +0 -0
- /package/dist/{registry-KRU6AWVW.js.map → registry-B7X6YGS7.js.map} +0 -0
- /package/dist/{request-planner-LNNKTY7K.js.map → request-planner-YDIX4BQW.js.map} +0 -0
- /package/dist/{review-candidates-HQBKXAJA.js.map → review-candidates-3QCCHXWM.js.map} +0 -0
- /package/dist/{routing-XXA7GIBA.js.map → routing-BGMIY5JY.js.map} +0 -0
- /package/dist/{schedule-tool-65TFOUWK.js.map → schedule-tool-P6XM6W3S.js.map} +0 -0
- /package/dist/{scheduler-DIPOBJBF.js.map → scheduler-PUKN5YSL.js.map} +0 -0
- /package/dist/{seat-BSWBTNCP.js.map → seat-OTAJJ5BP.js.map} +0 -0
- /package/dist/{select-T4F42G6W.js.map → select-KKMXIVVL.js.map} +0 -0
- /package/dist/{set-enabled-UK4TPVC7.js.map → set-enabled-BNF427ZN.js.map} +0 -0
- /package/dist/{wiki-IDLRJ6WL.js.map → tool-EA4FWTH6.js.map} +0 -0
- /package/dist/{wiki-enrich-XWLDJAZI.js.map → wiki-J6MSHSVD.js.map} +0 -0
- /package/dist/{workspace-setup-VGXHYCD5.js.map → wiki-enrich-3Y3TZ6ZK.js.map} +0 -0
|
@@ -48,7 +48,7 @@ The "modified" field is optional and can contain updated values to pass forward.
|
|
|
48
48
|
... (output truncated)`:i;return s.exitCode!==0?{tool_use_id:e.id,content:`Command exited with code ${s.exitCode}:
|
|
49
49
|
${l}`,is_error:!0}:{tool_use_id:e.id,content:l||"(no output)"}}async editFile(e){let t=String(e.input.path||""),o=e.input.edits,r=ge.resolve(this.cwd,t);if(!o||o.length===0)return{tool_use_id:e.id,content:"No edits provided.",is_error:!0};let s=await W.checkFileWrite(t);if(s==="deny")return{tool_use_id:e.id,content:`File write blocked by permissions: ${t}`,is_error:!0};if(s==="skip")return{tool_use_id:e.id,content:`File write skipped (plan mode): ${t}`};if(f.has("pre:file-write")){let a=await f.execute("pre:file-write",{event:"pre:file-write",file:r,cwd:this.cwd});if(a.blocked)return{tool_use_id:e.id,content:a.message||`File edit blocked by pre:file-write hook: ${t}`,is_error:!0}}let i=await ne.readFile(r,"utf8"),l=[];for(let a of o)i.includes(a.old_text)?(i=i.replace(a.old_text,a.new_text),l.push(`Replaced: "${a.old_text.slice(0,40)}..."`)):l.push(`Not found: "${a.old_text.slice(0,40)}..."`);return this.options.dryRun||await ne.writeFile(r,i,"utf8"),f.has("post:file-write")&&await f.execute("post:file-write",{event:"post:file-write",file:r,fileContent:i,cwd:this.cwd}),{tool_use_id:e.id,content:`Edited ${t}:
|
|
50
50
|
${l.join(`
|
|
51
|
-
`)}`}}async createFiles(e){let t=e.input,o=t.files||[];return{tool_use_id:e.id,content:t.summary||`Queued ${o.length} file(s) for creation.`,files:o}}async spawnAgent(e){let t=String(e.input.agent_id||""),o=String(e.input.prompt||""),r=Number(e.input.timeout_seconds)||300;if(!t||!o)return{tool_use_id:e.id,content:"agent_id and prompt are required.",is_error:!0};try{let{SubAgentManager:s}=await import("./subagent-XY5N7TUU.js"),{getGlobalRegistry:i}=await import("./registry-
|
|
51
|
+
`)}`}}async createFiles(e){let t=e.input,o=t.files||[];return{tool_use_id:e.id,content:t.summary||`Queued ${o.length} file(s) for creation.`,files:o}}async spawnAgent(e){let t=String(e.input.agent_id||""),o=String(e.input.prompt||""),r=Number(e.input.timeout_seconds)||300;if(!t||!o)return{tool_use_id:e.id,content:"agent_id and prompt are required.",is_error:!0};try{let{SubAgentManager:s}=await import("./subagent-XY5N7TUU.js"),{getGlobalRegistry:i}=await import("./registry-B7X6YGS7.js"),l=i();if(!l)return{tool_use_id:e.id,content:"Sub-agent spawning requires the daemon to be running.",is_error:!0};let p=await new s(l).spawn({targetAgentId:t,prompt:o,parentAgentId:"orchestrator",timeout:r*1e3});return p.success?{tool_use_id:e.id,content:`Sub-agent "${t}" completed (${Math.round(p.duration/1e3)}s):
|
|
52
52
|
|
|
53
53
|
${p.content}`}:{tool_use_id:e.id,content:`Sub-agent "${t}" failed: ${p.error}`,is_error:!0}}catch(s){return{tool_use_id:e.id,content:`Failed to spawn sub-agent: ${s.message}`,is_error:!0}}}async askUser(e){let t=String(e.input.question||""),o=e.input.options,r=t;return o?.length&&(r+=`
|
|
54
54
|
Options: ${o.join(", ")}`),{tool_use_id:e.id,content:"Question sent to user.",followUp:r}}};async function Oe(n){let{provider:e,systemPrompt:t,messages:o,providerOptions:r,cwd:s,maxIterations:i=20,enabledTools:l,interactive:a=!0,overwrite:p=!1,dryRun:c=!1,onProgress:d,abortSignal:u}=n,m=u?{...r,abortSignal:u}:r;if(!e.generateRaw)return mt(n);let I=new se(s,{interactive:a,overwrite:p,dryRun:c,acmeContext:n.acmeContext,abortSignal:u}),D=be(l);if(n.acmeContext)for(let g of ct)D.push({name:g.name,description:g.description,input_schema:g.input_schema});let E=new Set;if(n.mcpTools?.length)for(let g of n.mcpTools)D.push({name:g.name,description:g.description,input_schema:g.input_schema}),E.add(g.name);let C=o.filter(g=>g.role!=="system").map(g=>({role:g.role,content:g.content})),B=[],G=0,F=0,O=0,A="",j,_=0;for(;_<i;){if(_++,u?.aborted)throw new Error("cancelled");d?.({type:"iteration_start",iteration:_}),k.step(_,`Agentic loop iteration (${D.length} tools available)`);let g,M=!!e.generateRawStream&&!!d;try{if(M){let S=null,H=null,v="";for await(let x of e.generateRawStream(C,t,D,m))x.type==="text_delta"?(v+=x.text,d?.({type:"text_delta",text:x.text})):x.type==="thinking_delta"?d?.({type:"thinking_delta",text:x.text}):x.type==="raw_result"?S=x.result:x.type==="error"&&(H=x.error);if(H&&!S)throw new Error(H);if(!S)throw new Error("generateRawStream returned no raw_result event");g=S,g._streamedText=v}else g=await e.generateRaw(C,t,D,m)}catch(S){if(S.message?.includes("not available"))return mt(n);throw S}G+=g.usage.input_tokens+g.usage.output_tokens,F+=g.usage.input_tokens,O+=g.usage.output_tokens;let P=g._streamedText;for(let S of g.content)S.type==="text"&&(A+=S.text,P===void 0&&d?.({type:"text_delta",text:S.text}));if(P!==void 0&&delete g._streamedText,g.stop_reason==="end_turn"||g.stop_reason==="max_tokens")break;if(g.stop_reason==="tool_use"){let S=g.content.filter(v=>v.type==="tool_use");if(S.length===0)break;C.push({role:"assistant",content:g.content});let H=[];for(let v of S){d?.({type:"tool_call",name:v.name,id:v.id,input:v.input}),k.step(_,`Tool call: ${v.name}`);let x;if(E.has(v.name)&&n.mcpDispatch){let h=await n.mcpDispatch(v.name,v.input);x={tool_use_id:v.id,content:h.content,is_error:h.isError}}else x=await I.execute({name:v.name,id:v.id,input:v.input});d?.({type:"tool_result",name:v.name,id:v.id,content:x.content.slice(0,200),is_error:x.is_error}),x.files?.length&&(B.push(...x.files),d?.({type:"files_created",files:x.files})),x.followUp&&(j=x.followUp),H.push({type:"tool_result",tool_use_id:x.tool_use_id,content:x.content,is_error:x.is_error})}if(C.push({role:"user",content:H}),j)break;continue}break}return d?.({type:"complete",iterations:_,totalTokens:G}),{files:B,content:A,followUp:j,tokensUsed:G,inputTokens:F||void 0,outputTokens:O||void 0,iterations:_}}async function mt(n){let{provider:e,systemPrompt:t,messages:o,providerOptions:r,maxIterations:s=5}=n,l=[{role:"system",content:t+`
|
|
@@ -123,4 +123,4 @@ ${n.projectInstructions}`),n.memoryContext&&o.push(n.memoryContext),o.push(`# Ou
|
|
|
123
123
|
Generate output appropriate for: ${e}. Use the \`create_files\` tool to output all files.`),o.join(`
|
|
124
124
|
|
|
125
125
|
`)}export{We as a,Xt as b,Qt as c,Je as d,Ke as e,Xe as f,Qe as g,Pe as h,ee as i,Re as j,ce as k,te as l,Pt as m,oe as n,Et as o,f as p,ot as q,rt as r,Me as s,de as t,W as u,re as v,lt as w,Ee as x,$e as y,se as z,gt as A,tn as B,on as C};
|
|
126
|
-
//# sourceMappingURL=chunk-
|
|
126
|
+
//# sourceMappingURL=chunk-X2GBLX3E.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{r as j,s as R,u as F}from"./chunk-BXK5S2KK.js";import{f as L,g as G}from"./chunk-LY4G7PCW.js";import{existsSync as y,mkdirSync as ae,writeFileSync as S,readFileSync as A}from"fs";import{resolve as m}from"path";import{createHash as Ye}from"crypto";import{readFileSync as me,existsSync as fe,unlinkSync as ye,readdirSync as mt}from"fs";import{resolve as H}from"path";function yt(e,n){let r={},s=t=>{let o=H(e,t);if(fe(o))try{return me(o,"utf-8").trim()||void 0}catch{return}};if(n){let t=s(`SOUL.${n}.md`);t?(r.soul=t,r.soulProfile=n):r.soul=s("SOUL.md")}else r.soul=s("SOUL.md");if(r.identity=s("IDENTITY.md"),r.user=s("USER.md"),r.agents=s("AGENTS.md"),r.bootstrap=s("BOOTSTRAP.md"),r.bootstrap)try{ye(H(e,"BOOTSTRAP.md"))}catch{}return r}function bt(e){let n=[];return e.identity&&n.push(`[Identity]
|
|
2
2
|
${e.identity}`),e.soul&&n.push(`[Personality & Boundaries]
|
|
3
3
|
${e.soul}`),e.user&&n.push(`[User Profile]
|
|
4
4
|
${e.user}`),e.bootstrap&&n.push(`[First-Run Instructions \u2014 one time only]
|
|
@@ -112,4 +112,4 @@ Always include:
|
|
|
112
112
|
5. Screenshots if applicable
|
|
113
113
|
`});break}return s}function ut(e,n,r="19900",s=console.error){let t=[],o=[],i=n.workspace;if(!y(i))return s(`Workspace not found: ${i}`),{created:t,skipped:o};if(n.tier!=="claude-code"&&n.tier!=="codex-cli")return{created:t,skipped:o};let a=(c,p)=>{y(c)?o.push(c):(ae(m(c,".."),{recursive:!0}),S(c,p),t.push(c))},l=(c,p,g)=>{if(!y(c)){ae(m(c,".."),{recursive:!0}),S(c,p),t.push(c);return}let d;try{d=A(c,"utf8")}catch{o.push(c);return}let f=Ve(d);if(f===null){o.push(c);return}if(f===g){o.push(c);return}S(c,p),t.push(`${c} (refreshed)`)};if(a(m(i,"AGENTS.md"),W({name:n.name,id:e,role:n.systemPrompt?.split(`
|
|
114
114
|
`)[0],workspace:i,tier:n.tier})),n.tier==="codex-cli")return t.length>0&&s(`[${e}] workspace setup: created ${t.length} file(s)`),{created:t,skipped:o};l(m(i,"CLAUDE.md"),ze(e,n,r),ce(n));let u=m(i,".claude/settings.json");a(u,JSON.stringify(it(e,n,r),null,2));let h=ct(e,n);for(let c of h){let p=m(i,".claude/rules",c.name);c.replaces&&y(p)&&c.replaces.includes(A(p,"utf8"))?(S(p,c.content),t.push(p)):a(p,c.content)}return t.length>0&&s(`[${e}] workspace setup: created ${t.length} file(s)`),{created:t,skipped:o}}function lt(e,n){let r=m(e,".claude/settings.json");if(!y(r))return!1;try{let s=JSON.parse(A(r,"utf-8")),t=!1;for(let[o,i]of Object.entries(n))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){s[o]||(s[o]={});for(let[a,l]of Object.entries(i))s[o][a]===void 0&&(s[o][a]=l,t=!0)}else s[o]===void 0&&(s[o]=i,t=!0);return t&&S(r,JSON.stringify(s,null,2)),t}catch{return!1}}function pt(e,n,r="19900",s){let t=m(e,".claude/settings.json");if(!y(t))return!1;try{let o=JSON.parse(A(t,"utf-8")),i=!1,a=o.permissions??={},l=Array.isArray(a.deny)?a.deny:a.deny=[];for(let d of P)l.includes(d)||(l.push(d),i=!0);let u=o.hooks??={},c=[...Array.isArray(u.PreToolUse)?u.PreToolUse.filter(d=>!ot(d)):[],...pe(n,r,s)];JSON.stringify(u.PreToolUse??null)!==JSON.stringify(c)&&(u.PreToolUse=c,i=!0);let g=[...Array.isArray(u.PostToolUse)?u.PostToolUse.filter(d=>!rt(d)):[],de(r)];return JSON.stringify(u.PostToolUse??null)!==JSON.stringify(g)&&(u.PostToolUse=g,i=!0),i&&S(t,JSON.stringify(o,null,2)),i}catch{return!1}}function dt(e){return Array.isArray(e?.hooks)&&e.hooks.some(n=>typeof n?.command=="string"&&n.command.includes(D))}function ht(e,n,r,s){let t=m(e,".claude/settings.json");if(!y(t))return!1;try{let o=JSON.parse(A(t,"utf-8")),i=JSON.stringify(o),a=s.enabled&&s.tools.length>0,l=`Read(/${te(s.dir,n)}/**)`,u=Array.isArray(o.hooks?.PostToolUse)?o.hooks.PostToolUse:[],h=u.filter(g=>!dt(g)),c=Array.isArray(o.permissions?.allow)?o.permissions.allow:[],p=c.filter(g=>g!==l);if(a){let d=`curl -s --max-time 5 -H 'Content-Type: application/json' --data-binary @- '${`http://127.0.0.1:${r}${D}?agent=${encodeURIComponent(n)}`}' 2>/dev/null || true`;h.push({matcher:s.tools.join("|"),hooks:[{type:"command",command:d,timeout:10}]}),p.push(l)}return(a||u.length>0)&&((o.hooks??={}).PostToolUse=h),(a||c.length>0)&&((o.permissions??={}).allow=p),JSON.stringify(o)===i?!1:(S(t,JSON.stringify(o,null,2)),!0)}catch{return!1}}function Vt(e,n="19900",r=console.error,s){let t=0,o=0,i=0,a=0,l=0,u=0;for(let[h,c]of Object.entries(e)){if(c.tier!=="claude-code"&&c.tier!=="codex-cli")continue;let p=ut(h,c,n,r);if(t+=p.created.length,c.tier==="claude-code"&<(c.workspace,{env:{CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:"1"}})&&o++,c.tier==="claude-code"&&pt(c.workspace,h,n,c.mcp)&&i++,c.tier==="claude-code"&&s){let g=ne(c.permissionMode);s.enabled&&!g&&u++;let d=s.enabled&&g;ht(c.workspace,h,n,{...s,enabled:d})&&(d?a++:l++)}}t>0&&r(`Workspace setup: ${t} file(s) created across agent workspaces`),o>0&&r(`Workspace patch: ${o} workspace(s) updated with agent teams support`),i>0&&r(`Guardrails: ${i} workspace(s) backfilled with deny list + PreToolUse guard hook`),a>0&&r(`ObservationPack: PostToolUse hook written to ${a} workspace(s)`),l>0&&r(`ObservationPack: PostToolUse hook removed from ${l} workspace(s)`),u>0&&r(`ObservationPack: ${u} agent(s) not packed: permissionMode is not "bypassPermissions", so they could not read a saved original back`)}export{yt as a,bt as b,kt as c,St as d,At as e,D as f,Et as g,te as h,ne as i,vt as j,Dt as k,Mt as l,We as m,M as n,Gt as o,ie as p,Ve as q,ze as r,le as s,et as t,tt as u,nt as v,ut as w,pt as x,ht as y,Vt as z};
|
|
115
|
-
//# sourceMappingURL=chunk-
|
|
115
|
+
//# sourceMappingURL=chunk-XQH4LCZR.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ze,b as k,c as D,d as ea,e as fe,f as he,g as H,h as be,i as L,j as N,n as aa,o as ta,p as ra,q as na}from"./chunk-EFGAPAYZ.js";import{e as Ve,i as Qe}from"./chunk-QAWKN2N4.js";import{b as me}from"./chunk-DODL5POT.js";import{
|
|
1
|
+
import{a as Ze,b as k,c as D,d as ea,e as fe,f as he,g as H,h as be,i as L,j as N,n as aa,o as ta,p as ra,q as na}from"./chunk-EFGAPAYZ.js";import{e as Ve,i as Qe}from"./chunk-QAWKN2N4.js";import{b as me}from"./chunk-DODL5POT.js";import{Kb as Ge,Wa as Ke,Xa as Ye,Ya as Je,_a as Xe,c as Le,ua as _,za as qe}from"./chunk-WHAMZPEG.js";import{a as V}from"./chunk-IMLAPB7G.js";import{k as Be}from"./chunk-FFLMSNTN.js";import{b as Q}from"./chunk-2VDO2HEK.js";import{c as Ne,e as We}from"./chunk-LQE73AZR.js";import{a as Z,b as Ue}from"./chunk-3C6UDZDX.js";import{b as Fe}from"./chunk-MRIVENBY.js";import{ia as G}from"./chunk-3B7RH3IK.js";import{b as ue}from"./chunk-7AB3QUGH.js";import{a as K,b as X}from"./chunk-LSFLSB7C.js";import{s as ge,u as Oe}from"./chunk-BXK5S2KK.js";import{b as He}from"./chunk-LLNLDZNA.js";import{c as De,d as Me}from"./chunk-OWNQ2FD4.js";import{a as je}from"./chunk-ROLSSYXE.js";import{Bc as xe,J as le,Kb as Ee,M as F,Rb as at,S as Za,Va as ce,Wa as Pe,fb as et,mc as pe,qc as q,rc as Re}from"./chunk-PZ2F6J2E.js";import{existsSync as Y,readFileSync as xa,writeFileSync as ga,appendFileSync as lt,mkdirSync as ct}from"fs";import{dirname as pt,resolve as M}from"path";import{fileURLToPath as xt}from"url";import{hostname as gt}from"os";import{spawn as ut}from"child_process";var ve=`:root {
|
|
2
2
|
/* --- Brand (agentina) --------------------------------------------- */
|
|
3
3
|
--ax-blue: #2979FF;
|
|
4
4
|
--ax-blue-d: #1B5FD9;
|
|
@@ -2903,4 +2903,4 @@ tr:hover td { background: var(--bg-hover); }
|
|
|
2903
2903
|
${r}`).all(a,...t,...n).map(i=>({id:i.id,state:i.state,channel:i.channel,agentId:i.agent_id,text:i.text,createdAt:i.created_at})):[]}function Qo(e,a){return Ua(e,a,ce,"ORDER BY created_at")}function Zo(e,a,t=50){return Ua(e,a,[...ce,...Pe],"ORDER BY created_at DESC, rowid DESC LIMIT ?",Math.max(1,Math.min(t,500)))}at();var ze="member:",pr=90,xr="members",gr="tailscale-user-login",ur=400,mr=60*60*1e3;function fr(e){let a=e.scopes.find(t=>t.startsWith(ze));return a?a.slice(ze.length):null}function qa(e,a){if(!e)return null;let t=a.verify(e),r=t?fr(t):null;return t&&r?{rec:t,personId:r}:null}function ii(e,a){let t=e.people().find(s=>s.id===a);if(!t)return{ok:!1,error:`No person "${a}". Add them first: agentx people add ${a} --name "\u2026"`};let{token:r,record:n}=e.tokens.create({name:`${t.name} (machine not paired yet)`,scopes:[`${ze}${t.id}`],expiresInDays:pr}),{code:o,expiresAt:i}=e.codes.create({token:r,tokenId:n.id,name:t.id});return e.members.log({person:t.id,device:n.id,event:"invited"}),{ok:!0,code:o,expiresAt:i,tokenId:n.id,person:t}}var hr=Math.round(Ne/6e4);function br(e){return e==="client"?"Your project":"My work"}function si(e){let a=br(e.person.role),t=e.person.role==="client"?`I use AgentX to keep track of the work I do for you. It has a page for you, "${a}": what you asked us for, and where each request stands.`:`I use AgentX to give our AI agents their jobs. It has a page for you, "${a}": what you asked the agents for, and where each request stands.`;return[`Hi ${e.person.name},`,"",t,"","To open it:","1. Accept the Tailscale share I sent you. Tailscale is a small program that connects your computer to mine, privately.",`2. Open ${e.origin.replace(/\/+$/,"")}/member in Edge or Chrome, give your computer a name and type this code: ${We(e.code)}`,` The code works once, for ${hr} minutes. If it has stopped working, tell me and I will send you a new one.`,"","I then approve your machine, and the page opens by itself."].join(`
|
|
2904
2904
|
`)}var vr="The private network says someone else is connecting from this machine. Ask the person who invited you for a new code.",wr="Too many machines are waiting for the owner's answer. Try again later.",Fa="That code didn't work. Check it, or ask the person who invited you for a new one.",Ka=(e,a)=>{let t=e.headers[a];return(Array.isArray(t)?t[0]:t||"").trim()};function Ya(e){let a=e.socket?.remoteAddress||"";return a==="127.0.0.1"||a==="::1"||a==="::ffff:127.0.0.1"}function yr(e){if(!Ya(e))return null;let a=Ka(e,gr).toLowerCase();return a?a.slice(0,80):null}function kr(e){let a=e.socket?.remoteAddress||"unknown";if(!Ya(e))return a;let t=Ka(e,"x-forwarded-for").split(",").pop().trim();return/^[0-9a-fA-F:.]{2,45}$/.test(t)?t:a}function $r(e){return typeof e=="string"?e.replace(/[^\p{L}\p{N} ._'()-]/gu," ").replace(/\s+/g," ").trim().slice(0,60):""}function _r(e){return e.identities.map(Ee).filter(a=>!!a&&a.channel==="tailscale").map(a=>a.value)}async function di(e,a){let t=Date.now(),r=a.now??Date.now,n=a.log??(b=>console.log(b)),o=kr(e),i=a.limiter.retryAfter(o);if(i>0)return n(`[member] pair-code refused from ${o}: locked out for ${i}s more`),{status:429,body:{error:"too many attempts",retryAfter:i},retryAfter:i};let s=null,d="";try{let b=await Q(e,2048);s=b.code,d=$r(b.machine)}catch{}let l=a.codes.redeem(s),c=l?qa(l.token,a.tokens):null;if(await Cr(t,a.minMs??ur),!l||!c)return a.limiter.fail(o),n(`[member] pair-code failed from ${o}`),{status:401,body:{error:Fa}};a.limiter.succeed(o);let{rec:m,personId:g}=c,u=a.people().find(b=>b.id===g);if(!u)return a.tokens.revoke(m.id),a.members.log({person:g,device:m.id,event:"refused",address:o,detail:"person no longer listed"}),n(`[member] pair-code for ${g} refused from ${o}: person no longer listed`),{status:403,body:{error:Fa}};let x=yr(e),f=_r(u);if(f.length&&(!x||!f.includes(x)))return a.tokens.revoke(m.id),a.members.log({person:g,device:m.id,event:"refused",address:o,detail:`network login ${x??"missing"}; expected ${f.join(" or ")}`}),n(`[member] ${g}: pairing from ${o} refused: the network says "${x??"nobody"}", expected ${f.join(" or ")}`),{status:403,body:{error:vr}};let A=d||"Unnamed machine",y=u.name.slice(0,40),v=Oe(a.root,{title:`New machine for ${y}`,ask:`From ${o}, ${x?`network login ${x}`:"no network login reported"}. Machine name, as typed there: "${A}". Let it see their own work?`,recommend:`Yes if ${y} told you they just paired this machine. No if you did not expect it.`,if_silent:"discard",raised_by:xr},{now:r()});return v.ok?(a.members.add({tokenId:m.id,personId:g,name:A,state:"pending",cardId:v.card.id,address:o,...x?{network:x}:{},createdAt:new Date(r()).toISOString()}),a.members.log({person:g,device:m.id,event:"paired",address:o,detail:A}),n(`[member] ${g} paired "${A}" from ${o}; waiting for the owner (card ${v.card.id})`),{status:200,body:{person:g,name:A,state:"pending"},token:l.token}):(a.tokens.revoke(m.id),a.members.log({person:g,device:m.id,event:"refused",address:o,detail:v.error}),n(`[member] ${g}: pairing from ${o} refused: ${v.error}`),{status:503,body:{error:wr}})}var de="this machine is not paired",Sr="waiting for the owner to approve this machine";function Ja(e){return e?e.status==="decided"?e.verdict??null:e.status==="expired"?"no":null:null}function li(e,a){return a.state==="pending"&&a.cardId?Ja(ge(e,a.cardId)):null}function ci(e,a,t){let r=a.now??Date.now,n=a.log??(c=>console.log(c)),o=qa(e,a.tokens);if(!o)return{ok:!1,status:401,error:de};let{rec:i,personId:s}=o,d=a.members.byToken(i.id);if(!d||d.state==="removed"||d.personId!==s)return{ok:!1,status:401,error:de};if(a.people&&!a.people().some(c=>c.id===s))return Xa(a,i.id,"person no longer listed"),n(`[member] ${s}: "${d.name}" ended: person no longer listed`),{ok:!1,status:401,error:de};if(d.state==="pending"){let c=d.cardId?ge(a.root,d.cardId):null,m=Ja(c);if(m==="yes")d=a.members.update(i.id,{state:"active",approvedAt:new Date(r()).toISOString()})??d,a.members.log({person:s,device:i.id,event:"approved",detail:c?.decided_by}),n(`[member] ${s}: "${d.name}" approved`);else if(m==="no"){let g=c?.status==="expired"?"the owner did not answer in time":"the owner said no";return a.tokens.revoke(i.id),a.members.update(i.id,{state:"removed",removedAt:new Date(r()).toISOString(),removedReason:g}),a.members.log({person:s,device:i.id,event:"refused",detail:g}),n(`[member] ${s}: "${d.name}" refused: ${g}`),{ok:!1,status:401,error:de}}else return{ok:!1,status:403,error:Sr,waiting:!0}}let l=d.lastSeenAt?Date.parse(d.lastSeenAt):0;return t&&(r()-l>=mr||d.lastAddress!==t)&&(d=a.members.update(i.id,{lastSeenAt:new Date(r()).toISOString(),lastAddress:t})??d,a.members.log({person:s,device:i.id,event:"signed-in",address:t})),{ok:!0,device:d,personId:s,rec:i}}function Xa(e,a,t="removed by the owner"){let r=e.members.byToken(a);if(!r)return null;e.tokens.revoke(a);let n=e.members.update(a,{state:"removed",removedAt:new Date((e.now??Date.now)()).toISOString(),removedReason:t});return e.members.log({person:r.personId,device:a,event:"removed",detail:t}),n}function pi(e,a){return e.members.devices(a).filter(t=>t.state!=="removed").map(t=>Xa(e,t.tokenId,"person removed by the owner")).filter(t=>!!t)}async function Cr(e,a){let t=e+a-Date.now();t>0&&await new Promise(r=>setTimeout(r,t))}var Ga=["gitlab","github"];function Ar(e,a,t){let r=String(a||"").trim().toLowerCase();if(!Ga.includes(r))throw new Error(`Request status works on ${Ga.join(" and ")}, not on "${a}".`);e.requestStatus=e.requestStatus&&typeof e.requestStatus=="object"?e.requestStatus:{};let n=Array.isArray(e.requestStatus.channels)?e.requestStatus.channels.map(o=>String(o).toLowerCase()):[];return e.requestStatus.channels=t?[...new Set([...n,r])]:n.filter(o=>o!==r),`request status on ${r} is ${t?"on":"off"}`}function ui(e){return Array.isArray(e?.requestStatus?.channels)?e.requestStatus.channels.map(a=>String(a).toLowerCase()):[]}function mi(e){let{summary:a}=Z(t=>Ar(t,e?.channel,!!e?.enabled));return{summary:a}}var hi="https://myaccount.google.com/apppasswords";function bi(e){let a=e.split("@")[1]?.toLowerCase()??"";if(a==="gmail.com"||a==="googlemail.com")return{imapHost:"imap.gmail.com",imapPort:993,smtpHost:"smtp.gmail.com",smtpPort:465}}function vi(e){let a=e.user&&e.user!==e.address?{user:e.user}:{};return{agent:e.agent,address:e.address,imap:{host:e.imapHost,port:e.imapPort,secure:e.imapPort===993,...a,password:`\${${e.passwordEnv}}`},smtp:{host:e.smtpHost,port:e.smtpPort,secure:e.smtpPort===465},allowFrom:e.allowFrom,send:e.send}}function wi(e){return`EMAIL_${e.toUpperCase().replace(/[^A-Z0-9]/g,"_")}_PASSWORD`}function $i(e){return`${e.name} <${e.from}> via ${e.host}:${e.port}`}async function _i(e,a){return Be({host:e.host,port:e.port,secure:e.secure,user:e.user,password:e.password},{name:e.name,address:e.from},a,{"Auto-Submitted":"auto-generated"})}function Si(e,a){return{to:e,subject:`${a.name}: test mail`,text:[`This is a test mail from ${a.name}.`,"","If it reached you, AgentX can send mail through this sender.","You can ignore it."].join(`
|
|
2905
2905
|
`)}}function Ai(e){return new Set(Object.entries(e).filter(([,a])=>a?.wiki?.absorb?.enabled===!1).map(([a])=>a))}function Ti(e,a){return a.only?{agents:[a.only],skipped:[]}:{agents:e.filter(t=>!a.off.has(t)),skipped:e.filter(t=>a.off.has(t))}}function Ii(e,a){return`absorb is off for this agent (agents.${e}.wiki.absorb.enabled); skipped.${e===a?" It reads the wiki notes inbox, so the inbox was not read.":""} Use --agent ${e} to run it anyway.`}function zi(e,a){if(a){if(!e.wiki?.absorb)return;delete e.wiki.absorb.enabled,Object.keys(e.wiki.absorb).length===0&&delete e.wiki.absorb,Object.keys(e.wiki).length===0&&delete e.wiki;return}e.wiki??={},e.wiki.absorb??={},e.wiki.absorb.enabled=!1}var Tr="https://ntfy.sh";function Ei(e){return{enabled:!!e?.enabled,server:e?.server||Tr,topicSet:!!e?.topic,tokenSet:!!e?.token}}function Ri(e,a){let t={...e??{}};if("enabled"in a&&(t.enabled=!!a.enabled),"server"in a){let r=String(a.server).trim().replace(/\/+$/,"");if(!/^https?:\/\/\S+$/.test(r))throw new Error("ntfy server must be an http(s) URL");t.server=r}if("topic"in a){let r=String(a.topic).trim();if(!r)throw new Error("ntfy topic cannot be empty");t.topic=r}if("token"in a){let r=String(a.token??"").trim();r?t.token=r:delete t.token}if(t.enabled&&!t.topic)throw new Error("set a topic before enabling ntfy");return t}Za();function Va(e){return/^(agent|person):/.test(e)?F(e):`person:${e}`}function ji(e){let a=(e?.projects??[]).filter(t=>t?.id);return a.map(t=>({id:t.id,name:t.name?.trim()||t.id,client:Le(t.id,a),...t.pm?{pm:F(t.pm)}:{},...t.lead?{lead:Va(t.lead)}:{},team:[...new Set((t.team??[]).filter(Boolean).map(F))]})).sort((t,r)=>t.client.localeCompare(r.client)||t.name.localeCompare(r.name)||t.id.localeCompare(r.id))}function Hi(e,a,t){if(!t.lead&&!t.team?.length)return;let r=new Set(Object.keys(e.business?.orgChart||{})),n=new Set((e.people||[]).map(i=>String(i.id))),o={id:a,name:a,client:"",...t.lead?{lead:Va(t.lead)}:{},team:(t.team??[]).map(F)};return Ir([o],r,n)}function Ir(e,a,t){let r=n=>{let o=le(n);return o.kind==="agent"?a.has(o.id)?void 0:`"${o.id}", which is not an agent in business.orgChart`:t.has(o.id)?void 0:`"${o.id}", which is not a person in people`};for(let n of e){if(n.lead){if(le(n.lead).kind!=="person")return`Project ${n.name} is led by "${n.lead}"; a lead is a person (person:<id>), the PM is the agent`;let o=r(n.lead);if(o)return`Project ${n.name} is led by ${o}`}for(let o of n.team){let i=r(o);if(i)return`Project ${n.name} has ${i} in its team`}}}export{ve as a,da as b,ye as c,nt as d,ot as e,it as f,ua as g,mt as h,_n as i,Sn as j,Cn as k,ko as l,Co as m,Ba as n,Yo as o,Jo as p,Rn as q,On as r,It as s,Et as t,ke as u,Dn as v,Mn as w,Rt as x,Bn as y,Un as z,Fn as A,Vo as B,Qo as C,Zo as D,pr as E,xr as F,ii as G,hr as H,br as I,si as J,vr as K,wr as L,yr as M,kr as N,$r as O,_r as P,di as Q,Ja as R,li as S,ci as T,Xa as U,pi as V,Ga as W,Ar as X,ui as Y,mi as Z,hi as _,bi as $,vi as aa,wi as ba,$i as ca,_i as da,Si as ea,Ai as fa,Ti as ga,Ii as ha,zi as ia,Ei as ja,Ri as ka,Va as la,ji as ma,Hi as na,Ir as oa,Qt as pa,go as qa,vo as ra,wo as sa};
|
|
2906
|
-
//# sourceMappingURL=chunk-
|
|
2906
|
+
//# sourceMappingURL=chunk-YXGZSVPY.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as M,b as E,c as R,d as T,e as j,j as O}from"./chunk-
|
|
1
|
+
import{a as M,b as E,c as R,d as T,e as j,j as O}from"./chunk-QEOGWSRR.js";import{c as P,d as N}from"./chunk-OWNQ2FD4.js";import{c as _,d as x}from"./chunk-AHWWJ7AF.js";import{b as I}from"./chunk-KEXBEUSU.js";import{a as B}from"./chunk-ROLSSYXE.js";import{y as C,z as K}from"./chunk-64IVC2G6.js";import{readFileSync as $,writeFileSync as b,appendFileSync as V,existsSync as w,mkdirSync as L,readdirSync as D,statSync as F}from"fs";import{resolve as h,join as Y,relative as k,dirname as z}from"path";K();function U(A){return B.includes(A)}function G(A){if(!A)return;let t;try{t=JSON.parse(A)}catch{return}if(!Array.isArray(t))return;let e=t.filter(s=>typeof s=="object"&&s!==null&&typeof s.property=="string"&&s.property!==""&&typeof s.value=="string"&&s.value!=="");return e.length?e:void 0}function H(A,t){let e=a=>{let o=/^(.*Z)(?:-(\d+))?\.md$/.exec(a);return o?[o[1],o[2]?Number(o[2]):0]:[a,0]},[s,i]=e(A),[n,r]=e(t);return s<n?-1:s>n?1:i-r}var J=class{baseDir;rawDir;log;lockWaitMs=5e3;constructor(t=h(process.cwd(),".agentx/wiki"),e=console.error.bind(console,"[wiki]")){this.baseDir=t,this.rawDir=h(t,"raw/entries"),this.log=e,L(this.rawDir,{recursive:!0}),L(h(t,"raw"),{recursive:!0}),this.ensureSchema()}canRead(t,e){return t.access==="public"?!0:e?!!(t.owner===e||t.access==="shared"&&t.sharedWith?.includes(e)):!1}canWrite(t,e){return t.owner===e}addEntry(t){let e=`${t.date}_${t.id}.md`,s=h(this.rawDir,e),i=["---",`id: ${t.id}`,`date: ${t.date}`,`agent: ${t.agentId}`,`source: ${t.source}`];if(t.sourceContext&&i.push(`context: ${t.sourceContext}`),t.meta)for(let[n,r]of Object.entries(t.meta))i.push(`${n}: ${JSON.stringify(r)}`);return i.push("---","",t.content),b(s,i.join(`
|
|
2
2
|
`)),this.appendLog("ingest",`${t.id} from ${t.agentId} via ${t.source}`),e}readEntries(t){if(t.length===0||!w(this.rawDir))return[];let e=new Set(t),s=[];for(let i of D(this.rawDir)){let n=i.replace(/\.md$/,"").replace(/^\d{4}-\d{2}-\d{2}_/,"");if(!e.has(n))continue;let r=this.parseEntry($(h(this.rawDir,i),"utf-8"),i);r&&s.push(r)}return s}listEntries(t){if(!w(this.rawDir))return[];let e=D(this.rawDir).filter(i=>i.endsWith(".md")).sort(),s=[];for(let i of e){let n=$(h(this.rawDir,i),"utf-8"),r=this.parseEntry(n,i);r&&(t?.agentId&&r.agentId!==t.agentId||t?.after&&r.date<t.after||t?.before&&r.date>t.before||s.push(r))}return s}parseEntry(t,e){let s=t.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);if(!s)return null;let i=s[1],n=s[2].trim(),r=c=>i.match(new RegExp(`^${c}:\\s*(.+)$`,"m"))?.[1]?.trim()||"",a=new Set(["id","date","agent","source","context"]),o={};for(let c of i.split(`
|
|
3
3
|
`)){let l=c.match(/^(\w+):\s*(.+)$/);if(!(!l||a.has(l[1])))try{o[l[1]]=JSON.parse(l[2])}catch{o[l[1]]=l[2].trim()}}return{id:r("id")||e.replace(".md",""),date:r("date"),agentId:r("agent"),source:r("source"),sourceContext:r("context")||void 0,content:n,meta:Object.keys(o).length>0?o:void 0}}withArticleLock(t,e){let s=`${h(this.baseDir,"_locks",t)}.lock`;return N(h(this.baseDir,t),e,{lock:s,what:`wiki page ${t}`,timeoutMs:this.lockWaitMs,staleMs:1e4})}writeArticle(t,e,s,i){try{return this.withArticleLock(t,()=>this.writeArticleLocked(t,e,s,i))}catch(n){if(!(n instanceof P))throw n;return this.log(n.message),!1}}writeArticleLocked(t,e,s,i){let n=this.readArticle(t);if(n&&!this.canWrite(n.meta,i))return this.log(`Permission denied: "${i}" cannot write "${t}" (owner: ${n.meta.owner})`),!1;e.type&&!I(e.type)&&(this.log(`Dropping invalid article type "${e.type}" for "${t}" \u2014 enum is [person, project, place, concept, event, decision, pattern]`),e={...e,type:void 0});let r=h(this.baseDir,t);n&&this.saveVersion(t,r),L(z(r),{recursive:!0});let a=["---",`title: "${e.title}"`];e.type&&a.push(`type: ${e.type}`),e.related?.length&&a.push(`related: [${e.related.map(c=>`"${c}"`).join(", ")}]`),a.push(`tags: [${(e.tags||[]).map(c=>`"${c}"`).join(", ")}]`,`owner: ${e.owner}`,`access: ${e.access}`),e.sharedWith?.length&&a.push(`shared_with: [${e.sharedWith.map(c=>`"${c}"`).join(", ")}]`),a.push(`created: ${e.created}`,`last_updated: ${e.lastUpdated}`,`sources: [${e.sources.map(c=>`"${c}"`).join(", ")}]`),e.graphPath?.length&&a.push(`graph_path: [${e.graphPath.map(c=>`"${c}"`).join(", ")}]`),e.class&&a.push(`class: ${e.class}`),e.importance&&a.push(`importance: ${e.importance}`),e.importanceProposed&&a.push(`importance_proposed: ${e.importanceProposed}`),e.date&&a.push(`date: ${e.date}`),e.rolledUpInto&&a.push(`rolled_up_into: ${JSON.stringify(e.rolledUpInto)}`),e.aliases?.length&&a.push(`aliases: ${JSON.stringify(e.aliases)}`),e.statements?.length&&a.push(`statements: ${JSON.stringify(e.statements)}`),a.push("---","",s),b(r,a.join(`
|
|
4
4
|
`));let o=n?"update":"create";return this.appendLog(o,`${e.title} [${(e.tags||[]).slice(0,5).join(", ")}] by ${i} at ${t}`),!0}saveVersion(t,e){try{if(!w(e))return;let s=$(e,"utf-8"),i=new Date().toISOString().replace(/[:.]/g,"-"),n=h(this.baseDir,"_versions",t.replace(/\.md$/,""));L(n,{recursive:!0});for(let r=0;;r++)try{b(h(n,`${r?`${i}-${r}`:i}.md`),s,{flag:"wx"});return}catch(a){if(a.code!=="EEXIST")throw a}}catch{}}getVersions(t){let e=h(this.baseDir,"_versions",t.replace(/\.md$/,""));if(!w(e))return[];try{return D(e).filter(s=>s.endsWith(".md")).sort(H).reverse().map(s=>({timestamp:s.replace(/\.md$/,"").replace(/-/g,(i,n)=>n<19?n===10?"T":n===13||n===16?":":"-":i),path:h(e,s)}))}catch{return[]}}restoreVersion(t,e){let s=this.getVersions(t),i=s.find(n=>n.timestamp===e)??s.find(n=>n.timestamp.startsWith(e));return i?this.withArticleLock(t,()=>this.restoreLocked(t,i.path,e)):!1}restoreLocked(t,e,s){try{let i=$(e,"utf-8"),n=h(this.baseDir,t);return this.saveVersion(t,n),b(n,i),this.appendLog("restore",`${t} restored to ${s}`),!0}catch{return!1}}readArticle(t){let e=h(this.baseDir,t);if(!w(e))return null;let s=$(e,"utf-8");return this.parseArticle(s,t)}readArticleAs(t,e){let s=this.readArticle(t);return!s||!this.canRead(s.meta,e)?null:s}parseArticle(t,e){let s=t.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);if(!s)return null;let i=s[1],n=s[2].trim(),r=W=>i.match(new RegExp(`^${W}:\\s*(.+)$`,"m"))?.[1]?.trim().replace(/^"(.*)"$/,"$1")||"",a=W=>{let v=i.match(new RegExp(`^${W}:\\s*\\[(.*)\\]$`,"m"));return v?[...v[1].matchAll(/\s*(?:"(.*?)"(?=\s*(?:,|$))|([^,]+))/g)].map(S=>(S[1]??S[2]).trim()).filter(Boolean):[]},o=r("type")||r("kind"),l=new Set(["person","project","place","concept","event","decision","pattern"]).has(o)?o:void 0,g=a("tags").filter((W,v,S)=>W&&S.indexOf(W)===v),d=a("related"),p=a("graph_path"),m=a("aliases"),u=r("importance"),f=r("importance_proposed"),y=r("date");return{meta:{title:r("title"),type:l,related:d.length?d:void 0,tags:g,owner:r("owner"),access:r("access")||"public",sharedWith:a("shared_with"),created:r("created"),lastUpdated:r("last_updated"),sources:a("sources"),graphPath:p.length?p:void 0,class:/^[a-z][a-z0-9_]*$/.test(r("class"))?r("class"):void 0,importance:U(u)?u:void 0,importanceProposed:U(f)?f:void 0,date:/^\d{4}-\d{2}-\d{2}/.test(y)?y.slice(0,10):void 0,rolledUpInto:r("rolled_up_into")||void 0,aliases:m.length?m:void 0,statements:G(r("statements"))},content:n,path:e}}listCache=new Map;listArticles(t){return this.listCached(t)}listAllArticles(){return this.listCached(null)}listCached(t){let e=[],s=[];this.walkDir(this.baseDir,(o,c)=>{if(!o.endsWith(".md"))return;let l=k(this.baseDir,o);l.startsWith("raw/")||l.startsWith("_")||(e.push(l),s.push(`${l}:${c?.mtimeMs??"?"}:${c?.size??"?"}`))});let i=s.join("|"),n=t??"\0all",r=this.listCache.get(n);if(r&&r.signature===i)return r.articles.slice();let a=[];for(let o of e){let c=this.readArticle(o);c&&(t===null||this.canRead(c.meta,t))&&a.push(c)}return this.listCache.set(n,{signature:i,articles:a}),a.slice()}search(t,e,s=10){let i=t.toLowerCase(),n=[];if(this.walkDir(this.baseDir,d=>{if(!d.endsWith(".md"))return;let p=k(this.baseDir,d);if(p.startsWith("raw/")||p.startsWith("_"))return;let m=this.readArticle(p);!m||!this.canRead(m.meta,e)||n.push(m)}),n.length===0)return[];let r=n.map(d=>d.content),a=h(this.baseDir,"_bm25_cache.json"),o=x(r,a),c=_(t,o),l=new Map(c.map(d=>[d.docIndex,d.score]));return n.map((d,p)=>{let m=l.get(p)??0;return d.meta.title.toLowerCase().includes(i)&&(m+=10),d.meta.tags?.some(u=>u.toLowerCase().includes(i))&&(m+=5),{article:d,score:m}}).filter(d=>d.score>0).sort((d,p)=>p.score-d.score).slice(0,s).map(d=>d.article)}async findRelevantReranked(t,e,s=10,i={}){let n=Math.max(s,i.shortlist??E),r=this.findRelevant(t,e,n);if(r.length<2)return r.slice(0,s);let a=r.map((l,g)=>({id:`c${g}`,title:l.meta.title||`(untitled ${g})`,tags:l.meta.tags,excerpt:l.content})),o=await C(M,R({query:t,candidates:a,excerptChars:i.excerptChars}),T(a),{incumbent:{best:a[0].id},features:{agent:e??"unknown"}});return!o||o.mode!=="active"?r.slice(0,s):j(o.answers,a).ranked.map(l=>r[Number(l.slice(1))]).filter(l=>!!l).slice(0,s)}findRelevant(t,e,s=3,i,n={graph:.6,bm25:.4}){let r=[];if(this.walkDir(this.baseDir,u=>{if(!u.endsWith(".md"))return;let f=k(this.baseDir,u);if(f.startsWith("raw/")||f.startsWith("_"))return;let y=this.readArticle(f);!y||!this.canRead(y.meta,e)||r.push(y)}),r.length===0)return[];let a=r.map(u=>`${u.meta.title} ${(u.meta.tags||[]).join(" ")} ${u.content}`),o=h(this.baseDir,"_bm25_relevance_cache.json"),c=x(a,o),l=_(t,c),g=l.reduce((u,f)=>Math.max(u,f.score),0)||1,d=new Map(l.map(u=>[u.docIndex,u.score/g])),p=!!(i&&i.length>0);return r.map((u,f)=>{let y=d.get(f)??0,W=0;p&&u.meta.graphPath?.length&&(W=O(i,u.meta.graphPath));let v=p?n.graph*W+n.bm25*y:y;return{article:u,score:v}}).filter(u=>u.score>0).sort((u,f)=>f.score-u.score).slice(0,s).map(u=>u.article)}buildContext(t,e=4e3){if(t.length===0)return"";let s=["[Wiki Knowledge]"],i=0;for(let n of t){let r=`
|
|
@@ -102,4 +102,4 @@ We use GitLab for version control.
|
|
|
102
102
|
There are ${e.length} unprocessed entries. Read each, understand what it means, and create or update wiki articles.
|
|
103
103
|
|
|
104
104
|
${s}`}walkDir(t,e){if(w(t))for(let s of D(t)){let i=Y(t,s),n=F(i);n.isDirectory()?this.walkDir(i,e):e(i,n)}}};export{J as a};
|
|
105
|
-
//# sourceMappingURL=chunk-
|
|
105
|
+
//# sourceMappingURL=chunk-Z5HYCMDF.js.map
|
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{b as o}from"./chunk-OSH2PEBH.js";import"./chunk-QIJLFPWE.js";var e=o(process.versions.node);e&&(console.error(e),process.exit(1));var{buildProgram:s}=await import("./program-
|
|
2
|
+
import{b as o}from"./chunk-OSH2PEBH.js";import"./chunk-QIJLFPWE.js";var e=o(process.versions.node);e&&(console.error(e),process.exit(1));var{buildProgram:s}=await import("./program-QZKK3Y2W.js"),{installCliSignalExit:r}=await import("./signal-exit-C5EUGHKI.js"),{applyConnectAttemptTimeout:i,configPathFromArgv:a,readConnectAttemptTimeout:n}=await import("./net-family-X2P3OVDP.js");r();i(n(process.cwd(),a(process.argv.slice(2))));var t=await s();process.argv.slice(2).length===0?t.outputHelp():t.parse();
|
|
3
3
|
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g}from"./chunk-QGRIW7SE.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
|
|
2
|
+
//# sourceMappingURL=client-UPXDV3SM.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{$b as f,Bc as G,Wb as a,Xb as b,Yb as c,Zb as d,_b as e,ac as g,bc as h,cc as i,dc as j,ec as k,fc as l,gc as m,hc as n,ic as o,jc as p,kc as q,lc as r,mc as s,nc as t,oc as u,pc as v,qc as w,rc as x,sc as y,tc as z,uc as A,vc as B,wc as C,xc as D,yc as E,zc as F}from"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";G();export{a as INTEGRATION_KINDS,B as WIKI_CONTRIBUTE_JOB,C as WIKI_CONTRIBUTE_MERGE_JOB,E as WIKI_SUMMARIZE_JOB,s as approvalsConfigSchema,g as callsSchema,e as cameraBotSchema,z as crossFieldProblems,v as daemonConfigSchema,c as emailAccountSchema,b as eventSubscriptionSchema,w as expandEnvVars,r as improveConfigSchema,f as isCronExpression,y as literalSecretProblems,x as loadDaemonConfig,d as mailSenderSchema,o as membersConfigSchema,j as mergePolicyConfigSchema,t as numbersConfigSchema,n as peopleConfigSchema,m as personSchema,q as qualityReportConfigSchema,p as requestStatusConfigSchema,l as requestsConfigSchema,h as reviewGateConfigSchema,i as trackersConfigSchema,A as validateWorkspaces,u as wallConfigSchema,k as watchersConfigSchema,D as withContributionJobs,F as withSummariesJob};
|
|
2
|
+
//# sourceMappingURL=config-LAM4HUTA.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b}from"./chunk-3C6UDZDX.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{a as mutateAgentxConfig,b as writeAgentxConfig};
|
|
2
|
+
//# sourceMappingURL=config-mutate-P4QLFUVH.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b,c,d,e}from"./chunk-LSFLSB7C.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{b as applyConfigMutation,a as findConfigPath,d as getAtPath,c as setAtPath,e as unsetAtPath};
|
|
2
|
+
//# sourceMappingURL=config-mutator-RIPSMYAO.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ee}from"./chunk-
|
|
1
|
+
import{a as ee}from"./chunk-SJJ7QEFE.js";import"./chunk-AOPNASCE.js";import{f as Q,k as V}from"./chunk-IH65GDJR.js";import"./chunk-2MAKXLK2.js";import"./chunk-JTFCU5LH.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import{b as O}from"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-BERWTVG2.js";import"./chunk-A7JSRDJL.js";import"./chunk-QEOGWSRR.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import{b as N,c as H}from"./chunk-AHWWJ7AF.js";import{b as X}from"./chunk-KEXBEUSU.js";import"./chunk-64IVC2G6.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QUFIUXMQ.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as le}from"crypto";import{existsSync as z,mkdirSync as ne,readdirSync as re,readFileSync as ge,renameSync as se,writeFileSync as pe}from"fs";import{resolve as w}from"path";var _={maxPatches:30,maxCostUsd:.5,maxItems:60},he=12,fe=2e3,me=1500,M=8,U=300,be=12,B="## Checked facts";function S(n){return w(n,"_contributions")}function E(n,r){if(!z(n))return r;try{return JSON.parse(ge(n,"utf-8"))}catch(t){throw new Error(`${n} is not valid JSON: ${t.message}`)}}function L(n,r){ne(w(n,".."),{recursive:!0});let t=`${n}.${process.pid}.tmp`;pe(t,`${JSON.stringify(r,null,2)}
|
|
2
2
|
`),se(t,n)}function ie(n){return{agents:E(w(S(n),"state.json"),{agents:{}}).agents??{}}}function ye(n){let r=w(S(n),"pending");return z(r)?re(r).filter(t=>t.endsWith(".json")).sort().map(t=>E(w(r,t),null)).filter(t=>!!t):[]}function G(n){return w(S(n),"held.json")}function K(n,r={}){let t=E(G(n),[]);return r.all?t:t.filter(a=>a.status==="held")}function _e(n){let r=w(S(n),"reports");if(!z(r))return null;let t=re(r).filter(a=>a.endsWith(".json")).sort().pop();return t?E(w(r,t),null):null}function ke(n,r,t,a={}){let o=ie(r).agents[t],c=a.now??Date.now(),e=a.since??o?.lastRunAt??new Date(c-864e5).toISOString(),d=e.slice(0,10),u=new Set(o?.processed??[]),s=[];for(let g of n.getAgentEntries(t))g.date<d||u.has(g.id)||s.push({id:g.id,at:g.date,kind:"chat",title:[g.source,g.sourceContext].filter(Boolean).join(" \xB7 "),text:g.content});if(a.db){let g=Date.parse(e);for(let l of V(a.db,{agentId:t,since:Number.isFinite(g)?g:void 0,limit:500})){if(l.status==="in-flight"||u.has(l.taskId))continue;let k=(Q(a.db,l.taskId)?.steps??[]).filter(b=>b.name==="tool_use"||b.action).slice(0,be).map(b=>`- ${b.action??b.name}${b.inputSummary?` ${x(b.inputSummary,160)}`:""}${b.outputSummary?` \u2192 ${x(b.outputSummary,240)}`:""}${b.error?` \u2717 ${x(b.error,120)}`:""}`),y=[`Request: ${x(l.originalMessage??l.messagePreview??"",600)}`,k.length?`Tool calls:
|
|
3
3
|
${k.join(`
|
|
4
4
|
`)}`:"",l.finalResponse?`Reply: ${x(l.finalResponse,800)}`:""].filter(Boolean).join(`
|
|
@@ -54,4 +54,4 @@ _Sources: ${t.sources.join("; ")}._`,a);return n.writeArticle(r,{title:t.title,.
|
|
|
54
54
|
`).replace(/\n{3,}/g,`
|
|
55
55
|
|
|
56
56
|
`).trim(),superseded:d}}function Ce(n){let r=n.previous?` (previously: ${n.previous})`:"";return`- **${n.attribute}:** ${n.value} \u2014 ${n.source}; checked ${n.checkedAt.slice(0,10)} by ${n.by}${r}`}function Re(n){let r=n.match(/^- \*\*.+?:\*\* (.*?) — .*?; checked (\S+) by \S+(?: \(previously: (.*)\))?$/);return r?{value:r[1],checkedAt:r[2],...r[3]?{previous:r[3]}:{}}:void 0}function J(n,r){return`contribution:${n}@${r.slice(0,10)}`}var Te={person:"people",project:"projects",place:"places",concept:"concepts",event:"events",decision:"decisions",pattern:"patterns"};function de(n,r,t){let a=r.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"").slice(0,60)||"page",o=t?Te[t]:"contributions",c=`${o}/${a}.md`;for(let e=2;n.readArticle(c);e++)c=`${o}/${a}-${e}.md`;return c}export{_ as DEFAULT_CONTRIBUTION_LIMITS,B as FACTS_HEADING,ue as applyFactLines,De as approveHeld,xe as buildContributionPrompt,S as contributionsDir,_e as latestReport,K as listHeld,ye as listPendingBatches,Be as mergeContributions,W as pageKey,Ae as parseContributionPatches,ke as pendingWork,Se as possibleDuplicate,Fe as rejectHeld,ce as replaceOnce,Me as runContribution};
|
|
57
|
-
//# sourceMappingURL=contributions-
|
|
57
|
+
//# sourceMappingURL=contributions-SHSEI3TX.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=doctor-
|
|
1
|
+
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j}from"./chunk-M42GMRZF.js";import"./chunk-WMZ4TGMR.js";import"./chunk-2YDG5CSS.js";import"./chunk-2F7KQ4DJ.js";import"./chunk-IMLAPB7G.js";import"./chunk-QPABR72X.js";import"./chunk-KP7KDLZ2.js";import"./chunk-BXK5S2KK.js";import"./chunk-4NZ4T3TQ.js";import"./chunk-LY4G7PCW.js";import"./chunk-7IW25T4K.js";import"./chunk-Q3A5P373.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-QUFIUXMQ.js";import"./chunk-OSH2PEBH.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{j as daemonVoiceCheck,b as doctor,i as mcpHeaderEnvChecks,g as meshPeerTokenChecks,h as meshTokenChecksFromConfig,a as runDoctorChecks,e as runMirrorChecks,d as runNativeChecks,c as runNotificationChecks,f as runReminderChecks};
|
|
2
|
+
//# sourceMappingURL=doctor-TLDBNHYM.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{d as h}from"./chunk-O2YDS2P3.js";import{b as I}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-56UTQ4FU.js";import"./chunk-Q432O462.js";import"./chunk-LSFLSB7C.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var p=t=>typeof t=="string"?t.trim():"";function $(t){return[`Run ${t.runId} "${t.title}" [${t.status}] on step ${t.step}: waiting on ${t.waitingOn}.`,t.tags?.length?`Tags: ${t.tags.join(", ")}`:"",...(t.steps??[]).slice(-8).map(s=>`- ${String(s.at).slice(0,16).replace("T"," ")} ${s.step} ${s.status}${s.note?`: ${s.note}`:""}`)].filter(Boolean).join(`
|
|
2
2
|
`)}async function T(t,c){let s=c.fetch??fetch,m=c.daemonUrl.replace(/\/$/,""),r=(p(t.action)||"list").toLowerCase(),f=c.env??process.env,w=async i=>{let l=await s(`${m}${i}`,{signal:AbortSignal.timeout(1e4)}),n=await l.json().catch(()=>({}));return{ok:l.ok,status:l.status,data:n}};try{if(r==="list"){let e=await w("/follow-up");if(!e.ok)return`Error: ${e.data?.error||`HTTP ${e.status}`}`;let o=e.data.groups??[];return o.length?o.map(d=>[`${d.tag}:`,...d.rows.map(a=>`- ${a.runId} "${a.title}" on ${a.step}: waiting on ${a.waitingOn} (since ${String(a.since).slice(0,16).replace("T"," ")} UTC)`)].join(`
|
|
3
3
|
`)).join(`
|
|
4
4
|
`):"No follow-up workflows are running."}if(r==="match"){let e=p(t.request)||p(t.title);if(!e)return"Error: match needs `request`: the owner's request in their words.";let o=h(t,f),d=await w(`/follow-up/match?q=${encodeURIComponent(e)}${o?`&agentId=${encodeURIComponent(o.agentId)}`:""}`);if(!d.ok)return`Error: ${d.data?.error||`HTTP ${d.status}`}`;let a=d.data.matches??[];return a.length?["Saved workflows, best fit first (confidence 0-1):",...a.map(u=>`- ${u.workflowId} "${u.title}" (${u.confidence}${u.autoStart?", starts without asking":""}): ${u.steps.map(k=>k.id).join(" \u2192 ")}`),'Start one with {action:"start", workflowId:"<id>", title:"\u2026", tags:["client:<name>"]}. Run its steps through the workflow, not by hand.'].join(`
|
|
5
5
|
`):"No saved workflow fits. If the request has several steps, build one: start with title and steps."}if(r==="status"){let e=p(t.runId);if(!e)return"Error: status needs runId.";let o=await w(`/follow-up/${encodeURIComponent(e)}`);return o.ok?$(o.data.run):`Error: ${o.data?.error||`HTTP ${o.status}`}`}let i=h(t,f);if(!i)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let l=await s(`${m}/follow-up`,{method:"POST",headers:{"Content-Type":"application/json",...I(f)},body:JSON.stringify({action:r,agentId:i.agentId,workflowId:t.workflowId,title:t.title,description:t.description,tags:t.tags,inputs:t.inputs,steps:t.steps,edges:t.edges,approval:t.approval,autoStart:t.autoStart,requestId:t.requestId,runId:t.runId,step:t.step,evidence:t.evidence,note:t.note,reason:t.reason,fromRun:t.fromRun,status:t.status}),signal:AbortSignal.timeout(2e4)}),n=await l.json().catch(()=>({}));if(!l.ok)return`Error: ${n?.error||`HTTP ${l.status}`}`;if(r==="start"){let e=n.run;return[`Started run ${e.runId} "${e.title}"${n.built?" (built from the steps you gave; propose it with fromRun to keep it)":""}.`,n.awaitingApproval?"It waits for the owner's approval before the first step.":`It is on step ${e.step}: ${e.waitingOn}.`,"AgentX follows it from here: it starts each step, reminds whoever is slow, and tells the owner when it ends. Do not run its steps by hand.",...n.warning?[`Note: ${n.warning}`]:[]].join(" ")}return r==="plan"?[`Plan recorded on run ${n.run?.runId??t.runId}:`,...(n.plan??[]).map(e=>`- ${e.id} ${e.title}`),'Report each step with {action:"step", runId, step:"<id>", status:"started"|"done"|"failed"}.'].join(`
|
|
6
6
|
`):r==="step"?`Step recorded. ${n.run?$(n.run):""}`.trim():r==="done"?`Step recorded as done. ${n.run?$(n.run):""}`.trim():r==="blocked"?"The step is marked blocked and the owner is told. Nothing more happens on it until it is sorted.":`Saved ${n.workflowId} switched off, and asked the owner (card ${n.cardId}) whether to keep it as a reusable workflow.`}catch(i){return`Error: couldn't reach the daemon (${i?.message??i}).`}}export{T as runWorkflowTool};
|
|
7
|
-
//# sourceMappingURL=follow-up-tool-
|
|
7
|
+
//# sourceMappingURL=follow-up-tool-VM4ZDRC5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/workflows/follow-up-tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\nimport { callerHeaders } from \"@/calls/service\"\n\n// --- Agent-facing `agentx_workflow` tool (#788) ---\n//\n// A request with several steps is run as a workflow, not by hand:\n// match saved workflows that fit the request in front of you\n// start start one (workflowId), or build one from the owner's words\n// (title + steps) and run it; tags say what it concerns\n// status one run: the step it is on and what it waits on\n// list every follow-up still going, grouped by tag\n// done the step you own is finished (evidence)\n// blocked your step cannot go on without the owner (reason)\n// propose ask the owner to keep a workflow as a reusable template\n// plan write or change the plan of the run your task is wrapped in\n// step report a step of that plan (started, done, failed)\n// It talks to the daemon's /follow-up endpoints.\n\nexport interface WorkflowToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\nconst str = (v: unknown) => (typeof v === \"string\" ? v.trim() : \"\")\n\nfunction describe(run: any): string {\n const lines = [\n `Run ${run.runId} \"${run.title}\" [${run.status}] on step ${run.step}: waiting on ${run.waitingOn}.`,\n run.tags?.length ? `Tags: ${run.tags.join(\", \")}` : \"\",\n ...(run.steps ?? []).slice(-8).map((s: any) => `- ${String(s.at).slice(0, 16).replace(\"T\", \" \")} ${s.step} ${s.status}${s.note ? `: ${s.note}` : \"\"}`),\n ]\n return lines.filter(Boolean).join(\"\\n\")\n}\n\n/** Returns the text the agent sees. Every refusal is text, never a throw. */\nexport async function runWorkflowTool(args: Record<string, unknown>, deps: WorkflowToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const action = (str(args.action) || \"list\").toLowerCase()\n const env = deps.env ?? process.env\n const read = async (path: string) => {\n const res = await doFetch(`${base}${path}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n return { ok: res.ok, status: res.status, data }\n }\n\n try {\n if (action === \"list\") {\n const r = await read(\"/follow-up\")\n if (!r.ok) return `Error: ${r.data?.error || `HTTP ${r.status}`}`\n const groups = r.data.groups ?? []\n if (!groups.length) return \"No follow-up workflows are running.\"\n return groups.map((g: any) => [`${g.tag}:`, ...g.rows.map((row: any) => `- ${row.runId} \"${row.title}\" on ${row.step}: waiting on ${row.waitingOn} (since ${String(row.since).slice(0, 16).replace(\"T\", \" \")} UTC)`)].join(\"\\n\")).join(\"\\n\")\n }\n if (action === \"match\") {\n const q = str(args.request) || str(args.title)\n if (!q) return \"Error: match needs `request`: the owner's request in their words.\"\n const caller = resolveScheduleCaller(args, env)\n const r = await read(`/follow-up/match?q=${encodeURIComponent(q)}${caller ? `&agentId=${encodeURIComponent(caller.agentId)}` : \"\"}`)\n if (!r.ok) return `Error: ${r.data?.error || `HTTP ${r.status}`}`\n const matches = r.data.matches ?? []\n if (!matches.length) return \"No saved workflow fits. If the request has several steps, build one: start with title and steps.\"\n return [\n \"Saved workflows, best fit first (confidence 0-1):\",\n ...matches.map((x: any) => `- ${x.workflowId} \"${x.title}\" (${x.confidence}${x.autoStart ? \", starts without asking\" : \"\"}): ${x.steps.map((s: any) => s.id).join(\" → \")}`),\n `Start one with {action:\"start\", workflowId:\"<id>\", title:\"…\", tags:[\"client:<name>\"]}. Run its steps through the workflow, not by hand.`,\n ].join(\"\\n\")\n }\n if (action === \"status\") {\n const runId = str(args.runId)\n if (!runId) return \"Error: status needs runId.\"\n const r = await read(`/follow-up/${encodeURIComponent(runId)}`)\n if (!r.ok) return `Error: ${r.data?.error || `HTTP ${r.status}`}`\n return describe(r.data.run)\n }\n\n const caller = resolveScheduleCaller(args, env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const res = await doFetch(`${base}/follow-up`, {\n method: \"POST\",\n // The headers name this run: the daemon refuses a write that does\n // not come from a running turn of the agent.\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(env) },\n body: JSON.stringify({\n action, agentId: caller.agentId,\n workflowId: args.workflowId, title: args.title, description: args.description, tags: args.tags, inputs: args.inputs,\n steps: args.steps, edges: args.edges, approval: args.approval, autoStart: args.autoStart, requestId: args.requestId,\n runId: args.runId, step: args.step, evidence: args.evidence, note: args.note, reason: args.reason, fromRun: args.fromRun, status: args.status,\n }),\n signal: AbortSignal.timeout(20_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n if (action === \"start\") {\n const run = data.run\n return [\n `Started run ${run.runId} \"${run.title}\"${data.built ? \" (built from the steps you gave; propose it with fromRun to keep it)\" : \"\"}.`,\n data.awaitingApproval ? \"It waits for the owner's approval before the first step.\" : `It is on step ${run.step}: ${run.waitingOn}.`,\n \"AgentX follows it from here: it starts each step, reminds whoever is slow, and tells the owner when it ends. Do not run its steps by hand.\",\n ...(data.warning ? [`Note: ${data.warning}`] : []),\n ].join(\" \")\n }\n if (action === \"plan\") {\n return [\n `Plan recorded on run ${data.run?.runId ?? args.runId}:`,\n ...(data.plan ?? []).map((s: any) => `- ${s.id} ${s.title}`),\n `Report each step with {action:\"step\", runId, step:\"<id>\", status:\"started\"|\"done\"|\"failed\"}.`,\n ].join(\"\\n\")\n }\n if (action === \"step\") return `Step recorded. ${data.run ? describe(data.run) : \"\"}`.trim()\n if (action === \"done\") return `Step recorded as done. ${data.run ? describe(data.run) : \"\"}`.trim()\n if (action === \"blocked\") return \"The step is marked blocked and the owner is told. Nothing more happens on it until it is sorted.\"\n return `Saved ${data.workflowId} switched off, and asked the owner (card ${data.cardId}) whether to keep it as a reusable workflow.`\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"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","names":["str","v","describe","run","runWorkflowTool","args","deps","doFetch","base","action","env","read","path","res","data","r","groups","g","row","q","caller","resolveScheduleCaller","matches","x","s","runId","callerHeaders","e"]}
|
|
1
|
+
{"version":3,"sources":["../src/workflows/follow-up-tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\nimport { callerHeaders } from \"@/calls/service\"\n\n// --- Agent-facing `agentx_workflow` tool (#788) ---\n//\n// A request with several steps is run as a workflow, not by hand:\n// match saved workflows that fit the request in front of you\n// start start one (workflowId), or build one from the owner's words\n// (title + steps) and run it; tags say what it concerns\n// status one run: the step it is on and what it waits on\n// list every follow-up still going, grouped by tag\n// done the step you own is finished (evidence)\n// blocked your step cannot go on without the owner (reason)\n// propose ask the owner to keep a workflow as a reusable template\n// plan write or change the plan of the run your task is wrapped in\n// step report a step of that plan (started, done, failed)\n// It talks to the daemon's /follow-up endpoints.\n\nexport interface WorkflowToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\nconst str = (v: unknown) => (typeof v === \"string\" ? v.trim() : \"\")\n\nfunction describe(run: any): string {\n const lines = [\n `Run ${run.runId} \"${run.title}\" [${run.status}] on step ${run.step}: waiting on ${run.waitingOn}.`,\n run.tags?.length ? `Tags: ${run.tags.join(\", \")}` : \"\",\n ...(run.steps ?? []).slice(-8).map((s: any) => `- ${String(s.at).slice(0, 16).replace(\"T\", \" \")} ${s.step} ${s.status}${s.note ? `: ${s.note}` : \"\"}`),\n ]\n return lines.filter(Boolean).join(\"\\n\")\n}\n\n/** Returns the text the agent sees. Every refusal is text, never a throw. */\nexport async function runWorkflowTool(args: Record<string, unknown>, deps: WorkflowToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const action = (str(args.action) || \"list\").toLowerCase()\n const env = deps.env ?? process.env\n const read = async (path: string) => {\n const res = await doFetch(`${base}${path}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n return { ok: res.ok, status: res.status, data }\n }\n\n try {\n if (action === \"list\") {\n const r = await read(\"/follow-up\")\n if (!r.ok) return `Error: ${r.data?.error || `HTTP ${r.status}`}`\n const groups = r.data.groups ?? []\n if (!groups.length) return \"No follow-up workflows are running.\"\n return groups.map((g: any) => [`${g.tag}:`, ...g.rows.map((row: any) => `- ${row.runId} \"${row.title}\" on ${row.step}: waiting on ${row.waitingOn} (since ${String(row.since).slice(0, 16).replace(\"T\", \" \")} UTC)`)].join(\"\\n\")).join(\"\\n\")\n }\n if (action === \"match\") {\n const q = str(args.request) || str(args.title)\n if (!q) return \"Error: match needs `request`: the owner's request in their words.\"\n const caller = resolveScheduleCaller(args, env)\n const r = await read(`/follow-up/match?q=${encodeURIComponent(q)}${caller ? `&agentId=${encodeURIComponent(caller.agentId)}` : \"\"}`)\n if (!r.ok) return `Error: ${r.data?.error || `HTTP ${r.status}`}`\n const matches = r.data.matches ?? []\n if (!matches.length) return \"No saved workflow fits. If the request has several steps, build one: start with title and steps.\"\n return [\n \"Saved workflows, best fit first (confidence 0-1):\",\n ...matches.map((x: any) => `- ${x.workflowId} \"${x.title}\" (${x.confidence}${x.autoStart ? \", starts without asking\" : \"\"}): ${x.steps.map((s: any) => s.id).join(\" → \")}`),\n `Start one with {action:\"start\", workflowId:\"<id>\", title:\"…\", tags:[\"client:<name>\"]}. Run its steps through the workflow, not by hand.`,\n ].join(\"\\n\")\n }\n if (action === \"status\") {\n const runId = str(args.runId)\n if (!runId) return \"Error: status needs runId.\"\n const r = await read(`/follow-up/${encodeURIComponent(runId)}`)\n if (!r.ok) return `Error: ${r.data?.error || `HTTP ${r.status}`}`\n return describe(r.data.run)\n }\n\n const caller = resolveScheduleCaller(args, env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const res = await doFetch(`${base}/follow-up`, {\n method: \"POST\",\n // The headers name this run: the daemon refuses a write that does\n // not come from a running turn of the agent.\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(env) },\n body: JSON.stringify({\n action, agentId: caller.agentId,\n workflowId: args.workflowId, title: args.title, description: args.description, tags: args.tags, inputs: args.inputs,\n steps: args.steps, edges: args.edges, approval: args.approval, autoStart: args.autoStart, requestId: args.requestId,\n runId: args.runId, step: args.step, evidence: args.evidence, note: args.note, reason: args.reason, fromRun: args.fromRun, status: args.status,\n }),\n signal: AbortSignal.timeout(20_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n if (action === \"start\") {\n const run = data.run\n return [\n `Started run ${run.runId} \"${run.title}\"${data.built ? \" (built from the steps you gave; propose it with fromRun to keep it)\" : \"\"}.`,\n data.awaitingApproval ? \"It waits for the owner's approval before the first step.\" : `It is on step ${run.step}: ${run.waitingOn}.`,\n \"AgentX follows it from here: it starts each step, reminds whoever is slow, and tells the owner when it ends. Do not run its steps by hand.\",\n ...(data.warning ? [`Note: ${data.warning}`] : []),\n ].join(\" \")\n }\n if (action === \"plan\") {\n return [\n `Plan recorded on run ${data.run?.runId ?? args.runId}:`,\n ...(data.plan ?? []).map((s: any) => `- ${s.id} ${s.title}`),\n `Report each step with {action:\"step\", runId, step:\"<id>\", status:\"started\"|\"done\"|\"failed\"}.`,\n ].join(\"\\n\")\n }\n if (action === \"step\") return `Step recorded. ${data.run ? describe(data.run) : \"\"}`.trim()\n if (action === \"done\") return `Step recorded as done. ${data.run ? describe(data.run) : \"\"}`.trim()\n if (action === \"blocked\") return \"The step is marked blocked and the owner is told. Nothing more happens on it until it is sorted.\"\n return `Saved ${data.workflowId} switched off, and asked the owner (card ${data.cardId}) whether to keep it as a reusable workflow.`\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"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","names":["str","v","describe","run","runWorkflowTool","args","deps","doFetch","base","action","env","read","path","res","data","r","groups","g","row","q","caller","resolveScheduleCaller","matches","x","s","runId","callerHeaders","e"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=grants-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"./chunk-SYIDD7CI.js";import"./chunk-BXK5S2KK.js";import"./chunk-4NZ4T3TQ.js";import"./chunk-7I7IEX4S.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{c as DEFAULT_GRANT_DAYS,a as GUEST_SCOPE_PREFIX,b as JOIN_CARD_BY,h as JOIN_FAILED,d as MAX_GRANT_DAYS,j as NO_GRANT,l as PAUSED,k as WAITING_HOST,s as endGrant,o as grantBrief,u as grantForGuest,e as grantIdOf,n as guestAccess,p as guestTask,g as inviteGuest,i as joinGuest,f as newGrantId,q as pauseGrant,r as resumeGrant,m as settleGrant,t as updateGrant};
|
|
2
|
+
//# sourceMappingURL=grants-ZA35QVTX.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b}from"./chunk-LLNLDZNA.js";import"./chunk-Z5HYCMDF.js";import"./chunk-QEOGWSRR.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-64IVC2G6.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as WikiHub,a as existingWikiDir};
|
|
2
|
+
//# sourceMappingURL=hub-7Y6ZUVJV.js.map
|