agentix-cli 0.42.0 → 0.44.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/apps/mac-helper/Resources/AppIcon.png +0 -0
- package/apps/mac-helper/Sources/AgentXHelper/Notify.swift +51 -0
- package/apps/mac-helper/Sources/AgentXHelper/main.swift +15 -1
- package/apps/mac-helper/build.sh +25 -2
- package/dist/{App-HSRGG5VA.js → App-QTUGMHG7.js} +2 -2
- package/dist/{ChatApp-4FOU6Q3S.js → ChatApp-634FDG3W.js} +2 -2
- package/dist/{agent-54NUP2Z3.js → agent-3XDPLWMX.js} +2 -2
- package/dist/{board-dashboard-HLTVSSGW.js → board-dashboard-OYGL7Z7X.js} +455 -161
- package/dist/board-dashboard-OYGL7Z7X.js.map +1 -0
- package/dist/{chunk-H4MIYENA.js → chunk-6HMZ5TTM.js} +2 -2
- package/dist/{chunk-SJPLXXCI.js → chunk-7A7RC3R4.js} +2 -2
- package/dist/{chunk-FZ3ZDG6T.js → chunk-7HHVZJO4.js} +195 -211
- package/dist/chunk-7HHVZJO4.js.map +1 -0
- package/dist/chunk-BIFJSQB5.js +123 -0
- package/dist/chunk-BIFJSQB5.js.map +1 -0
- package/dist/{chunk-WBGROLOX.js → chunk-BTGPZ6B7.js} +2 -2
- package/dist/{chunk-X763UOES.js → chunk-ICZPZYYR.js} +2 -2
- package/dist/{chunk-RCVGIKC2.js → chunk-MTVRYTLL.js} +2 -2
- package/dist/{chunk-B32HVIDN.js → chunk-NSYY5NCR.js} +3 -3
- package/dist/chunk-NSYY5NCR.js.map +1 -0
- package/dist/chunk-P2Y7DFFP.js +36 -0
- package/dist/chunk-P2Y7DFFP.js.map +1 -0
- package/dist/{chunk-2IYOKDVI.js → chunk-Q3Q6FTFY.js} +194 -164
- package/dist/chunk-Q3Q6FTFY.js.map +1 -0
- package/dist/chunk-QJANPP4C.js +15 -0
- package/dist/chunk-QJANPP4C.js.map +1 -0
- package/dist/{chunk-REPZID5M.js → chunk-SAFAI4AV.js} +43 -43
- package/dist/chunk-SAFAI4AV.js.map +1 -0
- package/dist/chunk-T76YTN34.js +178 -0
- package/dist/chunk-T76YTN34.js.map +1 -0
- package/dist/chunk-TCJ3SMOF.js +9 -0
- package/dist/chunk-TCJ3SMOF.js.map +1 -0
- package/dist/{chunk-RQKUQOFC.js → chunk-TNFOGJWZ.js} +2 -2
- package/dist/{chunk-FAJEBVZE.js → chunk-V5FZJUK4.js} +2 -2
- package/dist/chunk-WLVQDEOT.js +2 -0
- package/dist/chunk-WLVQDEOT.js.map +1 -0
- package/dist/{chunk-B5HKRYCU.js → chunk-YQVR2HQS.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client-NTC667CA.js +2 -0
- package/dist/config-5V444ZFW.js +2 -0
- package/dist/config-mutator-E6NQLFWR.js +2 -0
- package/dist/doctor-5HDW5F66.js +2 -0
- package/dist/{editor-chat-OB7IQOB5.js → editor-chat-MOMQHMO4.js} +2 -2
- package/dist/editor-chat-MOMQHMO4.js.map +1 -0
- package/dist/index.d.ts +462 -46
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/program-HGI5C2MP.js +2 -0
- package/dist/query-6EMTLCHQ.js +2 -0
- package/dist/registry-5QOY65FS.js +2 -0
- package/dist/{request-planner-326NOKPZ.js → request-planner-KYQCJDAW.js} +2 -2
- package/dist/{review-candidates-LEOPEOEG.js → review-candidates-BFAWNDOR.js} +2 -2
- package/dist/routing-OC3QJI3W.js +2 -0
- package/dist/schedule-tool-VQCNMBJF.js +8 -0
- package/dist/schedule-tool-VQCNMBJF.js.map +1 -0
- package/dist/scheduler-NRXPVG7P.js +2 -0
- package/dist/seat-3WT3VJC2.js +2 -0
- package/dist/{select-L4VIYSFJ.js → select-KPQWIC22.js} +2 -2
- package/dist/web/activity-graph.global.js.map +1 -1
- package/dist/web/workflow-editor.global.js +1 -1
- package/dist/web/workflow-editor.global.js.map +1 -1
- package/dist/wiki-5JORBO4G.js +2 -0
- package/package.json +2 -1
- package/dist/board-dashboard-HLTVSSGW.js.map +0 -1
- package/dist/chunk-2IYOKDVI.js.map +0 -1
- package/dist/chunk-B32HVIDN.js.map +0 -1
- package/dist/chunk-DIKZWTL5.js +0 -170
- package/dist/chunk-DIKZWTL5.js.map +0 -1
- package/dist/chunk-F6CNF7V3.js +0 -25
- package/dist/chunk-F6CNF7V3.js.map +0 -1
- package/dist/chunk-FZ3ZDG6T.js.map +0 -1
- package/dist/chunk-IAG6FI3Q.js +0 -13
- package/dist/chunk-IAG6FI3Q.js.map +0 -1
- package/dist/chunk-NZ6AQIKJ.js +0 -121
- package/dist/chunk-NZ6AQIKJ.js.map +0 -1
- package/dist/chunk-P7LNYB53.js +0 -9
- package/dist/chunk-P7LNYB53.js.map +0 -1
- package/dist/chunk-REPZID5M.js.map +0 -1
- package/dist/client-6BGTH2TT.js +0 -2
- package/dist/config-SRTXHGSK.js +0 -2
- package/dist/config-mutator-KJ5GEMVV.js +0 -2
- package/dist/doctor-J4FLV45L.js +0 -2
- package/dist/editor-chat-OB7IQOB5.js.map +0 -1
- package/dist/program-LAACUZWW.js +0 -2
- package/dist/query-ZSUBNWOL.js +0 -2
- package/dist/registry-OMUDCBKM.js +0 -2
- package/dist/routing-AWIRBYGU.js +0 -2
- package/dist/scheduler-PGGYW5AB.js +0 -2
- package/dist/seat-XB4EGUKJ.js +0 -2
- package/dist/wiki-GBC6I7ZX.js +0 -2
- /package/dist/{App-HSRGG5VA.js.map → App-QTUGMHG7.js.map} +0 -0
- /package/dist/{ChatApp-4FOU6Q3S.js.map → ChatApp-634FDG3W.js.map} +0 -0
- /package/dist/{agent-54NUP2Z3.js.map → agent-3XDPLWMX.js.map} +0 -0
- /package/dist/{chunk-H4MIYENA.js.map → chunk-6HMZ5TTM.js.map} +0 -0
- /package/dist/{chunk-SJPLXXCI.js.map → chunk-7A7RC3R4.js.map} +0 -0
- /package/dist/{chunk-WBGROLOX.js.map → chunk-BTGPZ6B7.js.map} +0 -0
- /package/dist/{chunk-X763UOES.js.map → chunk-ICZPZYYR.js.map} +0 -0
- /package/dist/{chunk-RCVGIKC2.js.map → chunk-MTVRYTLL.js.map} +0 -0
- /package/dist/{chunk-RQKUQOFC.js.map → chunk-TNFOGJWZ.js.map} +0 -0
- /package/dist/{chunk-FAJEBVZE.js.map → chunk-V5FZJUK4.js.map} +0 -0
- /package/dist/{chunk-B5HKRYCU.js.map → chunk-YQVR2HQS.js.map} +0 -0
- /package/dist/{client-6BGTH2TT.js.map → client-NTC667CA.js.map} +0 -0
- /package/dist/{config-SRTXHGSK.js.map → config-5V444ZFW.js.map} +0 -0
- /package/dist/{config-mutator-KJ5GEMVV.js.map → config-mutator-E6NQLFWR.js.map} +0 -0
- /package/dist/{doctor-J4FLV45L.js.map → doctor-5HDW5F66.js.map} +0 -0
- /package/dist/{program-LAACUZWW.js.map → program-HGI5C2MP.js.map} +0 -0
- /package/dist/{query-ZSUBNWOL.js.map → query-6EMTLCHQ.js.map} +0 -0
- /package/dist/{registry-OMUDCBKM.js.map → registry-5QOY65FS.js.map} +0 -0
- /package/dist/{request-planner-326NOKPZ.js.map → request-planner-KYQCJDAW.js.map} +0 -0
- /package/dist/{review-candidates-LEOPEOEG.js.map → review-candidates-BFAWNDOR.js.map} +0 -0
- /package/dist/{routing-AWIRBYGU.js.map → routing-OC3QJI3W.js.map} +0 -0
- /package/dist/{scheduler-PGGYW5AB.js.map → scheduler-NRXPVG7P.js.map} +0 -0
- /package/dist/{seat-XB4EGUKJ.js.map → seat-3WT3VJC2.js.map} +0 -0
- /package/dist/{select-L4VIYSFJ.js.map → select-KPQWIC22.js.map} +0 -0
- /package/dist/{wiki-GBC6I7ZX.js.map → wiki-5JORBO4G.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a}from"./chunk-Q3Q6FTFY.js";import"./chunk-7A7RC3R4.js";import"./chunk-YQVR2HQS.js";import"./chunk-SAFAI4AV.js";import"./chunk-2TJ5L7CB.js";import"./chunk-7CVJ4JOE.js";import"./chunk-WLVQDEOT.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-7HHVZJO4.js";import"./chunk-P2Y7DFFP.js";import"./chunk-V5FZJUK4.js";import"./chunk-3SCPRYJB.js";import"./chunk-V7FYSZSV.js";import"./chunk-ZVP6GB4G.js";import"./chunk-T76YTN34.js";import"./chunk-TCJ3SMOF.js";import"./chunk-VMDA2SX2.js";import"./chunk-QLTM3F7M.js";import"./chunk-BTGPZ6B7.js";import"./chunk-SFQUP3BP.js";import"./chunk-BIFJSQB5.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-NSYY5NCR.js";import"./chunk-ICZPZYYR.js";import"./chunk-DWADWDMU.js";import"./chunk-77OV7346.js";import"./chunk-VWTBHLMX.js";import"./chunk-MTVRYTLL.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-TNFOGJWZ.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import"./chunk-6HMZ5TTM.js";import"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-QOYAX2FT.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-VDMYBPYB.js";import"./chunk-DSYKYZMT.js";import"./chunk-QJANPP4C.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";export{a as buildProgram};
|
|
2
|
+
//# sourceMappingURL=program-HGI5C2MP.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a}from"./chunk-TNFOGJWZ.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import"./chunk-6HMZ5TTM.js";import"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-QOYAX2FT.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-QJANPP4C.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";export{a as agenticQuery};
|
|
2
|
+
//# sourceMappingURL=query-6EMTLCHQ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{E as a,F as b,G as c,H as d,I as e,J as f,K as g,L as h,M as i,N as j}from"./chunk-T76YTN34.js";import"./chunk-TCJ3SMOF.js";import"./chunk-VMDA2SX2.js";import"./chunk-QLTM3F7M.js";import"./chunk-BIFJSQB5.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-NSYY5NCR.js";import"./chunk-ICZPZYYR.js";import"./chunk-DWADWDMU.js";import"./chunk-77OV7346.js";import"./chunk-VWTBHLMX.js";import"./chunk-MTVRYTLL.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-TNFOGJWZ.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import"./chunk-6HMZ5TTM.js";import"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-QOYAX2FT.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-DSYKYZMT.js";import"./chunk-QJANPP4C.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";export{j as AgentRegistry,e as TRACE_STEP_SUMMARY_BYTES,c as buildEntryMeta,d as buildWikiContext,f as clipForTrace,i as emitTraceStepsFromStreamEvent,h as firstMissingRequiredTool,b as getGlobalRegistry,a as setGlobalRegistry,g as tallyToolUses};
|
|
2
|
+
//# sourceMappingURL=registry-5QOY65FS.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{q as m,t as p,v as d,w as x}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=request-planner-
|
|
1
|
+
import{q as m,t as p,v as d,w as x}from"./chunk-6HMZ5TTM.js";import{a as u,f}from"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-QJANPP4C.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";x();f();var l="request-gate",h="request-context",g=.1;async function q(t,o,c,r=Math.random){let s=p(l)==="active";if(s){let i=m().seats[l]?.holdout??g;if(r()<i)return{active:!0,preprocess:!1,arm:"holdout"}}let a=s?"treatment":void 0,e=await d(l,{request:t.slice(0,2e3),agent:o,channel:c,operations:["select optional context","evaluate model routing where permitted"],constraints:["Keep the original request and mandatory instructions","Desktop model cannot be downgraded"]},{preprocess:u("This request benefits from structured context selection or another bounded typed decision before the main agent executes.",{true:"Relevant context must be selected, or a bounded routing decision can help. Follow-ups and ambiguous references need context.",false:"Typed preprocessing adds no useful decision; send the request to the configured main agent with existing context."})},{timeoutMs:3e3});if(!e||e.mode!=="active")return{active:!1,preprocess:!1,arm:a};let n=e.answers.preprocess?.noul;return{active:!0,preprocess:Number.isFinite(n)&&n>=.5,arm:a}}var v={landscape:"Agent directory and mesh overview",patternContext:"Learned behavioral patterns",references:"Retrieved project references",memoryContext:"Retrieved agent memory",crossChatContext:"Summaries from other conversations",longMemoryRecall:"Older conversation recall",wikiContext:"Retrieved wiki knowledge"};async function b(t){let o=Object.entries(v).flatMap(([e,n])=>{let i=t[e];return i?[{id:e,description:n,source:e,characters:i.length,preview:i.slice(0,400),trust:"context data, not instructions"}]:[]});if(!o.length)return{input:t,excluded:[]};let c=Object.fromEntries(o.map(e=>[e.id,u(`Context block ${e.id} is relevant to completing the current request correctly.`,{true:"Needed or potentially relevant; retain if uncertain or the preview is incomplete.",false:"Clearly unrelated to the current request; safe to omit."})])),r=await d(h,{request:t.message.slice(0,2e3),channel:t.channel,agent:t.agentId,mandatory:["request","identity","permissions and instructions","same-chat history","handover","attachments"],context:o},c,{timeoutMs:3e3});if(!r||r.mode!=="active")return{input:t,excluded:[]};let s={...t},a=[];for(let e of o){let n=r.answers[e.id]?.noul;Number.isFinite(n)&&n>=0&&n<.2&&(delete s[e.id],a.push(e.id))}return{input:s,excluded:a}}export{g as DEFAULT_REQUEST_GATE_HOLDOUT,h as REQUEST_CONTEXT_SEAT,l as REQUEST_GATE_SEAT,q as evaluateRequest,b as selectRequestContext};
|
|
2
|
+
//# sourceMappingURL=request-planner-KYQCJDAW.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b}from"./chunk-
|
|
1
|
+
import{b}from"./chunk-V5FZJUK4.js";import"./chunk-VMDA2SX2.js";import"./chunk-2GIDVZ4H.js";import"./chunk-6HMZ5TTM.js";import"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-QJANPP4C.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";import{createHash as A}from"crypto";var v="review:",I={decisions:"project",warnings:"feedback",friction:"feedback",context:"reference"};function E(t,n,r){let s=A("sha1").update(r.trim().toLowerCase()).digest("hex").slice(0,10);return`${v}${t}/${n}@${s}`}function F(t){if(!t.startsWith(v))return null;let n=t.slice(v.length),r=n.lastIndexOf("@"),s=n.lastIndexOf("/",r===-1?void 0:r);return r===-1||s===-1?null:{reviewId:n.slice(0,s),kind:n.slice(s+1,r),digest:n.slice(r+1)}}var C=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"finding";function L(t,n){return`${t}|${b(n)}`}function K(t,n={}){let r=n.kinds??Object.keys(I),s=n.minLength??24,h=[],d=new Map,u=new Map,f=new Map,x=new Map;for(let e of t){let i;try{i=JSON.parse(e.result)}catch{continue}let o=e.updated_at?new Date(e.updated_at).toISOString():new Date().toISOString();for(let c of r){let l=I[c];if(!l)continue;let R=i[c];if(Array.isArray(R))for(let $ of R){let a=String($?.text??"").trim();if(a.length<s)continue;let g=E(e.id,c,a),O=g.slice(g.lastIndexOf("@")),w=`${c}${O}`,y=L(c,a),k=f.get(y)??new Set;if(k.add(e.session_id??e.id),f.set(y,k),d.has(w))continue;let _=String($?.evidence??"").trim(),S={occurrences:1,agentId:e.agent,key:`${e.agent}/${l}_${C(a)}`,stamp:g,memory:{name:C(a),type:l,description:a.slice(0,200),body:"",createdAt:o,updatedAt:o}};x.set(g,{text:a,evidence:_,agent:e.agent,source:e.source}),d.set(w,S),u.set(w,y),h.push(S)}}}for(let[e,i]of d){i.occurrences=f.get(u.get(e)??"")?.size??1;let o=x.get(i.stamp);i.memory.body=T(o,i.occurrences)}let m=new Map;for(let[e,i]of d){let o=u.get(e)??e,c=m.get(o)??[];c.push(i),m.set(o,c)}let M=[...m.values()].sort((e,i)=>i[0].occurrences-e[0].occurrences),p=[];for(let e=0;p.length<h.length;e++){let i=!1;for(let o of M)e<o.length&&(p.push(o[e]),i=!0);if(!i)break}return p}function T(t,n){let r=`${t.agent}${t.source?` via ${t.source}`:""}`,s=[];return n>1?(s.push(`Observed in ${n} separate sessions. Most recently stated as:`),s.push(`> ${t.text}`),s.push(`Recurring across ${n} sessions is what makes this worth recording \u2014 any single occurrence is session state, the repetition is the finding.`)):s.push(t.text),t.evidence&&s.push(`**Evidence:** ${t.evidence}`),s.push(`_From ${n>1?"session reviews":"a session review"} of ${r}._`),s.join(`
|
|
2
2
|
|
|
3
3
|
`)}export{I as PROMOTABLE_KINDS,v as REVIEW_STAMP_PREFIX,F as parseReviewStamp,E as reviewStamp,K as reviewsToCandidates};
|
|
4
|
-
//# sourceMappingURL=review-candidates-
|
|
4
|
+
//# sourceMappingURL=review-candidates-BFAWNDOR.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b}from"./chunk-ICZPZYYR.js";import"./chunk-6HMZ5TTM.js";import"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-QJANPP4C.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";export{a as cheapModelForEngine,b as routeTaskModel};
|
|
2
|
+
//# sourceMappingURL=routing-OC3QJI3W.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{a as D,b as _,c as q,d as O,e as R,f as B,h as b,i as S,j as E,k as w,l as y}from"./chunk-WLVQDEOT.js";import"./chunk-BIFJSQB5.js";import{a as T,b as C,c as I,d as x,e as P}from"./chunk-NSYY5NCR.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-L2WSPY6S.js";import"./chunk-QJANPP4C.js";import"./chunk-FIOB3MEX.js";import{existsSync as X,readFileSync as F}from"fs";var J=new Set(["cron","heartbeat","api","a2a","mesh"]),M=160;function s(n){return typeof n=="string"&&n.trim()?n.trim():void 0}function A(n,e=M){let t=n.replace(/\s+/g," ").trim();return t.length>e?`${t.slice(0,e-1)}\u2026`:t}function V(n){let e=T(n);if(!X(e))throw new Error(`config not found at ${e}`);return JSON.parse(F(e,"utf-8"))}function W(n,e){return n?.agents?.[e]?.admin===!0}function Y(n,e,t){return W(n,t.agentId)||e?.createdBy===t.agentId}function Z(n,e){let t=e?.createdBy?`agent "${e.createdBy}"`:"the operator";return`Not allowed: "${n}" was created by ${t}. Agents manage only schedules they created (unless configured admin).`}function K(n,e){let t=s(n.notify);if(t!=="none"){if(t&&t!=="here"){let r=t.split(":");return r.length<2||!r[0]||!r[1]?"invalid":{channel:r[0],chatId:r.slice(1).join(":")}}if(e.channel&&e.chatId&&!J.has(e.channel))return{channel:e.channel,chatId:e.chatId,...e.accountId?{accountId:e.accountId}:{}}}}function Q(n,e,t){let r=e.timezone||"UTC",u=e.enabled&&!y(e)?w(E(e.schedule,r,t),r):"\u2014",h=e.approval?`pending ${e.approval.action} approval`:e.enabled?"active":"paused",p=[`- ${n} [${h}] ${e.schedule} \u2014 ${S(e.schedule)} (${r})`,` agent: ${e.agent}; created by: ${e.createdBy||"operator"}; next: ${u}`];return e.notify&&p.push(` notify: ${e.notify.channel} ${e.notify.chatId}`),e.command?p.push(` command: ${A(String(e.command))}`):e.prompt&&p.push(` prompt: ${A(String(e.prompt))}`),p.join(`
|
|
2
|
+
`)}async function k(n,e,t){let r=n?.notifications?.destination;if(!r?.channel||!r?.chatId)return"No operator notification destination is configured (notifications.destination); the operator must check `agentx schedule list`.";if(!e.notifyOperator)return"Operator notification is unavailable in this context.";try{return await e.notifyOperator({channel:r.channel,chatId:r.chatId,accountId:r.accountId},t),"The operator has been notified."}catch(u){return`Could not notify the operator (${u?.message??u}); the request is still recorded.`}}async function re(n,e,t={}){let r=(s(n.action)||"list").toLowerCase(),u=t.now?t.now():new Date,h;try{h=V(t.configPath)}catch(a){return`Error: ${a.message}`}let p=h.crons||{};if(r==="list"){let a=n.mine===!0,l=Object.entries(p).filter(([,i])=>!a||e&&i?.createdBy===e.agentId);return l.length?l.map(([i,f])=>Q(i,f,u)).join(`
|
|
3
|
+
`):a?"You have no schedules.":"No schedules."}if(!e?.agentId)return"Error: caller agent is unknown (AGENTX_AGENT_ID not set). Pass callerAgentId.";if(!h.agents?.[e.agentId])return`Error: caller "${e.agentId}" is not an agent on this node.`;let o=s(n.id),m=a=>C(a,{configPath:t.configPath,reload:t.reload});if(r==="create"){let a=s(n.when),l=s(n.prompt);if(!a||!l)return"Error: create needs `when` (plain English) and `prompt`.";let i=D(a);if(!i)return`Error: couldn't parse "${a}". ${O}.`;let f=s(n.agent)||e.agentId;if(!h.agents?.[f])return`Error: agent "${f}" not found on this node.`;let g=s(n.timezone)||q;if(!B(g))return`Error: unknown timezone "${g}".`;let d=o||_(i.matched,f);if(!R(d))return`Error: invalid id "${d}" (letters, digits, "-" and "_" only).`;if(p[d])return`Error: a schedule "${d}" already exists. Pick another \`id\`.`;let $=K(n,e);if($==="invalid")return'Error: `notify` must be "here", "none", or "channel:chatId".';let z={action:"create",requestedBy:e.agentId,requestedAt:u.toISOString()},L=b({parsed:i,agent:f,prompt:l,timezone:g,notify:$,enabled:!1,createdBy:e.agentId,approval:z}),v=await m(U=>I(U,`crons.${d}`,L));if(!v.success)return`Error: ${v.error}`;let N=w(E(i.cron,g,u),g),G=[`Schedule approval requested by ${e.agentId}`,`Create: ${d}`,`When: ${i.human} \u2014 cron \`${i.cron}\` (${g})`,`Next fire: ${N}`,`Agent: ${f}`,$?`Notify: ${$.channel} ${$.chatId}`:"Notify: none",`Prompt: ${A(l,400)}`,"",`Approve: agentx schedule approve ${d}`,`Reject: agentx schedule reject ${d}`].join(`
|
|
4
|
+
`),H=await k(h,t,G);return[`Requested schedule "${d}": ${i.human} (cron ${i.cron}, ${g}); next fire would be ${N}.`,"It is saved DISABLED and will not run until the operator approves it.",H].join(`
|
|
5
|
+
`)}if(!o)return`Error: ${r} needs \`id\`.`;let c=p[o];if(!c)return`Error: schedule "${o}" not found.`;if(!Y(h,c,e))return Z(o,c);if(r==="pause"||r==="resume"){let a=r==="resume";if(a&&y(c))return`"${o}" is still awaiting operator approval; it can't be resumed until approved.`;if(c.enabled===a)return`"${o}" is already ${a?"active":"paused"}.`;let l=await m(i=>I(i,`crons.${o}.enabled`,a));return l.success?`"${o}" ${a?"resumed":"paused"}.`:`Error: ${l.error}`}if(r==="delete"){if(y(c)&&c.approval.requestedBy===e.agentId){let d=await m($=>P($,`crons.${o}`));return d.success?`Withdrew the pending request "${o}".`:`Error: ${d.error}`}if(y(c))return`"${o}" is a creation request still awaiting approval; only its requester or the operator (\`agentx schedule reject ${o}\`) can drop it.`;if(c.approval?.action==="delete")return`Deletion of "${o}" is already awaiting approval.`;let a={action:"delete",requestedBy:e.agentId,requestedAt:u.toISOString()},l=await m(d=>{if(!x(d,`crons.${o}`))throw new Error(`schedule "${o}" not found`);I(d,`crons.${o}.approval`,a)});if(!l.success)return`Error: ${l.error}`;let i=c.timezone||"UTC",f=[`Schedule approval requested by ${e.agentId}`,`Delete: ${o}`,`When: ${S(c.schedule)} \u2014 cron \`${c.schedule}\` (${i})`,`Next fire: ${c.enabled?w(E(c.schedule,i,u),i):"\u2014 (paused)"}`,`Agent: ${c.agent}`,"",`Approve: agentx schedule approve ${o}`,`Reject: agentx schedule reject ${o}`].join(`
|
|
6
|
+
`),g=await k(h,t,f);return[`Deletion of "${o}" requested. It keeps its current state until the operator approves.`,g].join(`
|
|
7
|
+
`)}return`Error: unknown action "${r}". Use list, create, pause, resume or delete.`}function oe(n,e=process.env){let t=s(e.AGENTX_AGENT_ID)||s(n.callerAgentId);if(!t)return null;let r=!!(s(e.AGENTX_CHANNEL)&&s(e.AGENTX_CHAT_ID)),u=s(r?e.AGENTX_CHANNEL:n.channel),h=s(r?e.AGENTX_CHAT_ID:n.chatId),p=s(n.accountId);return{agentId:t,channel:u,chatId:h,...p?{accountId:p}:{}}}export{oe as resolveScheduleCaller,re as runScheduleTool};
|
|
8
|
+
//# sourceMappingURL=schedule-tool-VQCNMBJF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/crons/schedule-tool.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"fs\"\nimport { applyConfigMutation, findConfigPath, getAtPath, setAtPath, unsetAtPath } from \"@/daemon/config-mutator\"\nimport { parseEnglishToCron, slugifyScheduleId } from \"@/utils/nl-cron\"\nimport {\n buildScheduleJob,\n DEFAULT_SCHEDULE_TIMEZONE,\n formatFireTime,\n humanizeCron,\n isPendingCreate,\n isValidScheduleId,\n isValidTimezone,\n nextFireTime,\n SUPPORTED_PHRASES_HINT,\n type NotifyTarget,\n type ScheduleApproval,\n} from \"./schedule-ops\"\n\n// --- Agent-facing `schedule` tool ---\n//\n// Lets an agent list / create / pause / resume / delete routines from any\n// chat. Writes go through the same builder and config mutator as the\n// `agentx schedule` CLI, with two differences that make it safe to hand to\n// a model:\n//\n// 1. create and delete are REQUESTS. Create writes the job disabled with an\n// `approval` marker (the scheduler refuses to run it while that marker\n// says \"create\"); delete only marks the job. The operator is notified\n// with the parsed cron and next fire time, and only\n// `agentx schedule approve|reject <id>` resolves the request. There is\n// no action here that approves anything.\n// 2. Ownership. Jobs record `createdBy`; an agent may touch only its own\n// unless its config says `admin: true`.\n\nexport type ScheduleAction = \"list\" | \"create\" | \"pause\" | \"resume\" | \"delete\"\n\nexport interface ScheduleCaller {\n agentId: string\n /** Chat the request came from — the default notify target. */\n channel?: string\n chatId?: string\n accountId?: string\n}\n\nexport interface ScheduleToolDeps {\n configPath?: string\n /** Hot-reload the daemon after a write. Default true. */\n reload?: boolean\n now?: () => Date\n /** Deliver the approval request to the operator. Throws on failure. */\n notifyOperator?: (dest: NotifyTarget, text: string) => Promise<void>\n}\n\n/** Channels that are not a conversation someone reads, so they never make a\n * sensible default delivery target for a routine's output. */\nconst NON_DELIVERABLE_CHANNELS = new Set([\"cron\", \"heartbeat\", \"api\", \"a2a\", \"mesh\"])\n\nconst PROMPT_PREVIEW = 160\n\nfunction str(v: unknown): string | undefined {\n return typeof v === \"string\" && v.trim() ? v.trim() : undefined\n}\n\nfunction preview(s: string, n = PROMPT_PREVIEW): string {\n const flat = s.replace(/\\s+/g, \" \").trim()\n return flat.length > n ? `${flat.slice(0, n - 1)}…` : flat\n}\n\nfunction readRawConfig(configPath?: string): any {\n const path = findConfigPath(configPath)\n if (!existsSync(path)) throw new Error(`config not found at ${path}`)\n return JSON.parse(readFileSync(path, \"utf-8\"))\n}\n\nfunction isAdmin(cfg: any, agentId: string): boolean {\n return cfg?.agents?.[agentId]?.admin === true\n}\n\nfunction canManage(cfg: any, job: any, caller: ScheduleCaller): boolean {\n return isAdmin(cfg, caller.agentId) || job?.createdBy === caller.agentId\n}\n\nfunction ownershipError(id: string, job: any): string {\n const owner = job?.createdBy ? `agent \"${job.createdBy}\"` : \"the operator\"\n return `Not allowed: \"${id}\" was created by ${owner}. Agents manage only schedules they created (unless configured admin).`\n}\n\nfunction resolveNotify(args: Record<string, unknown>, caller: ScheduleCaller): NotifyTarget | undefined | \"invalid\" {\n const raw = str(args.notify)\n if (raw === \"none\") return undefined\n if (raw && raw !== \"here\") {\n const parts = raw.split(\":\")\n if (parts.length < 2 || !parts[0] || !parts[1]) return \"invalid\"\n // chatIds can contain \":\" (gitlab \"org/repo:issue:1\"), so the channel\n // is the first segment and the rest is the chat id.\n return { channel: parts[0], chatId: parts.slice(1).join(\":\") }\n }\n if (caller.channel && caller.chatId && !NON_DELIVERABLE_CHANNELS.has(caller.channel)) {\n return { channel: caller.channel, chatId: caller.chatId, ...(caller.accountId ? { accountId: caller.accountId } : {}) }\n }\n return undefined\n}\n\nfunction describeJob(id: string, job: any, now: Date): string {\n const tz = job.timezone || \"UTC\"\n const next = job.enabled && !isPendingCreate(job) ? formatFireTime(nextFireTime(job.schedule, tz, now), tz) : \"—\"\n const state = job.approval\n ? `pending ${job.approval.action} approval`\n : job.enabled ? \"active\" : \"paused\"\n const lines = [\n `- ${id} [${state}] ${job.schedule} — ${humanizeCron(job.schedule)} (${tz})`,\n ` agent: ${job.agent}; created by: ${job.createdBy || \"operator\"}; next: ${next}`,\n ]\n if (job.notify) lines.push(` notify: ${job.notify.channel} ${job.notify.chatId}`)\n if (job.command) lines.push(` command: ${preview(String(job.command))}`)\n else if (job.prompt) lines.push(` prompt: ${preview(String(job.prompt))}`)\n return lines.join(\"\\n\")\n}\n\nasync function notifyApproval(\n cfg: any,\n deps: ScheduleToolDeps,\n text: string,\n): Promise<string> {\n const dest = cfg?.notifications?.destination\n if (!dest?.channel || !dest?.chatId) {\n return \"No operator notification destination is configured (notifications.destination); the operator must check `agentx schedule list`.\"\n }\n if (!deps.notifyOperator) return \"Operator notification is unavailable in this context.\"\n try {\n await deps.notifyOperator({ channel: dest.channel, chatId: dest.chatId, accountId: dest.accountId }, text)\n return \"The operator has been notified.\"\n } catch (e: any) {\n return `Could not notify the operator (${e?.message ?? e}); the request is still recorded.`\n }\n}\n\n/**\n * Run one tool action. Returns the text the agent sees. Throws only on\n * programming errors — every expected refusal is returned as text so the\n * model can relay it.\n */\nexport async function runScheduleTool(\n args: Record<string, unknown>,\n caller: ScheduleCaller | null,\n deps: ScheduleToolDeps = {},\n): Promise<string> {\n const action = (str(args.action) || \"list\").toLowerCase() as ScheduleAction\n const now = deps.now ? deps.now() : new Date()\n\n let cfg: any\n try {\n cfg = readRawConfig(deps.configPath)\n } catch (e: any) {\n return `Error: ${e.message}`\n }\n const crons: Record<string, any> = cfg.crons || {}\n\n if (action === \"list\") {\n const mineOnly = args.mine === true\n const entries = Object.entries(crons).filter(([, j]) => !mineOnly || (caller && j?.createdBy === caller.agentId))\n if (!entries.length) return mineOnly ? \"You have no schedules.\" : \"No schedules.\"\n return entries.map(([id, j]) => describeJob(id, j, now)).join(\"\\n\")\n }\n\n if (!caller?.agentId) {\n return \"Error: caller agent is unknown (AGENTX_AGENT_ID not set). Pass callerAgentId.\"\n }\n if (!cfg.agents?.[caller.agentId]) {\n return `Error: caller \"${caller.agentId}\" is not an agent on this node.`\n }\n\n const id = str(args.id)\n const mutate = (fn: (c: any) => void) =>\n applyConfigMutation(fn, { configPath: deps.configPath, reload: deps.reload })\n\n if (action === \"create\") {\n const when = str(args.when)\n const prompt = str(args.prompt)\n if (!when || !prompt) return \"Error: create needs `when` (plain English) and `prompt`.\"\n const parsed = parseEnglishToCron(when)\n if (!parsed) return `Error: couldn't parse \"${when}\". ${SUPPORTED_PHRASES_HINT}.`\n\n const agent = str(args.agent) || caller.agentId\n if (!cfg.agents?.[agent]) return `Error: agent \"${agent}\" not found on this node.`\n\n const timezone = str(args.timezone) || DEFAULT_SCHEDULE_TIMEZONE\n if (!isValidTimezone(timezone)) return `Error: unknown timezone \"${timezone}\".`\n\n const jobId = id || slugifyScheduleId(parsed.matched, agent)\n if (!isValidScheduleId(jobId)) return `Error: invalid id \"${jobId}\" (letters, digits, \"-\" and \"_\" only).`\n if (crons[jobId]) return `Error: a schedule \"${jobId}\" already exists. Pick another \\`id\\`.`\n\n const notify = resolveNotify(args, caller)\n if (notify === \"invalid\") return 'Error: `notify` must be \"here\", \"none\", or \"channel:chatId\".'\n\n const approval: ScheduleApproval = {\n action: \"create\",\n requestedBy: caller.agentId,\n requestedAt: now.toISOString(),\n }\n const job = buildScheduleJob({\n parsed,\n agent,\n prompt,\n timezone,\n notify,\n enabled: false,\n createdBy: caller.agentId,\n approval,\n })\n\n const result = await mutate((c) => setAtPath(c, `crons.${jobId}`, job))\n if (!result.success) return `Error: ${result.error}`\n\n const next = formatFireTime(nextFireTime(parsed.cron, timezone, now), timezone)\n const request = [\n `Schedule approval requested by ${caller.agentId}`,\n `Create: ${jobId}`,\n `When: ${parsed.human} — cron \\`${parsed.cron}\\` (${timezone})`,\n `Next fire: ${next}`,\n `Agent: ${agent}`,\n notify ? `Notify: ${notify.channel} ${notify.chatId}` : \"Notify: none\",\n `Prompt: ${preview(prompt, 400)}`,\n \"\",\n `Approve: agentx schedule approve ${jobId}`,\n `Reject: agentx schedule reject ${jobId}`,\n ].join(\"\\n\")\n const notified = await notifyApproval(cfg, deps, request)\n\n return [\n `Requested schedule \"${jobId}\": ${parsed.human} (cron ${parsed.cron}, ${timezone}); next fire would be ${next}.`,\n \"It is saved DISABLED and will not run until the operator approves it.\",\n notified,\n ].join(\"\\n\")\n }\n\n if (!id) return `Error: ${action} needs \\`id\\`.`\n const job = crons[id]\n if (!job) return `Error: schedule \"${id}\" not found.`\n if (!canManage(cfg, job, caller)) return ownershipError(id, job)\n\n if (action === \"pause\" || action === \"resume\") {\n const enable = action === \"resume\"\n if (enable && isPendingCreate(job)) {\n return `\"${id}\" is still awaiting operator approval; it can't be resumed until approved.`\n }\n if (job.enabled === enable) return `\"${id}\" is already ${enable ? \"active\" : \"paused\"}.`\n const result = await mutate((c) => setAtPath(c, `crons.${id}.enabled`, enable))\n if (!result.success) return `Error: ${result.error}`\n return `\"${id}\" ${enable ? \"resumed\" : \"paused\"}.`\n }\n\n if (action === \"delete\") {\n // Withdrawing your own never-approved request removes nothing that ever\n // ran, so it needs no approval.\n if (isPendingCreate(job) && job.approval.requestedBy === caller.agentId) {\n const result = await mutate((c) => unsetAtPath(c, `crons.${id}`))\n if (!result.success) return `Error: ${result.error}`\n return `Withdrew the pending request \"${id}\".`\n }\n // Never replace a pending create marker with a delete marker: rejecting\n // that delete would leave a disabled job with no marker, which its owner\n // could then resume without the create ever being approved.\n if (isPendingCreate(job)) {\n return `\"${id}\" is a creation request still awaiting approval; only its requester or the operator (\\`agentx schedule reject ${id}\\`) can drop it.`\n }\n if (job.approval?.action === \"delete\") return `Deletion of \"${id}\" is already awaiting approval.`\n\n const approval: ScheduleApproval = {\n action: \"delete\",\n requestedBy: caller.agentId,\n requestedAt: now.toISOString(),\n }\n const result = await mutate((c) => {\n if (!getAtPath(c, `crons.${id}`)) throw new Error(`schedule \"${id}\" not found`)\n setAtPath(c, `crons.${id}.approval`, approval)\n })\n if (!result.success) return `Error: ${result.error}`\n\n const tz = job.timezone || \"UTC\"\n const request = [\n `Schedule approval requested by ${caller.agentId}`,\n `Delete: ${id}`,\n `When: ${humanizeCron(job.schedule)} — cron \\`${job.schedule}\\` (${tz})`,\n `Next fire: ${job.enabled ? formatFireTime(nextFireTime(job.schedule, tz, now), tz) : \"— (paused)\"}`,\n `Agent: ${job.agent}`,\n \"\",\n `Approve: agentx schedule approve ${id}`,\n `Reject: agentx schedule reject ${id}`,\n ].join(\"\\n\")\n const notified = await notifyApproval(cfg, deps, request)\n return [\n `Deletion of \"${id}\" requested. It keeps its current state until the operator approves.`,\n notified,\n ].join(\"\\n\")\n }\n\n return `Error: unknown action \"${action}\". Use list, create, pause, resume or delete.`\n}\n\n/**\n * Who is calling. The runtime-exported environment wins over model-supplied\n * arguments: an agent launched by AgentX cannot claim another identity by\n * passing `callerAgentId`. The arguments are the fallback for runtimes that\n * don't export the variables (e.g. an operator-configured MCP entry).\n */\nexport function resolveScheduleCaller(\n args: Record<string, unknown>,\n env: NodeJS.ProcessEnv = process.env,\n): ScheduleCaller | null {\n const agentId = str(env.AGENTX_AGENT_ID) || str(args.callerAgentId)\n if (!agentId) return null\n const envChat = Boolean(str(env.AGENTX_CHANNEL) && str(env.AGENTX_CHAT_ID))\n const channel = envChat ? str(env.AGENTX_CHANNEL) : str(args.channel)\n const chatId = envChat ? str(env.AGENTX_CHAT_ID) : str(args.chatId)\n const accountId = str(args.accountId)\n return { agentId, channel, chatId, ...(accountId ? { accountId } : {}) }\n}\n"],"mappings":"8TAAA,OAAS,cAAAA,EAAY,gBAAAC,MAAoB,KAsDzC,IAAMC,EAA2B,IAAI,IAAI,CAAC,OAAQ,YAAa,MAAO,MAAO,MAAM,CAAC,EAE9EC,EAAiB,IAEvB,SAASC,EAAIC,EAAgC,CAC3C,OAAO,OAAOA,GAAM,UAAYA,EAAE,KAAK,EAAIA,EAAE,KAAK,EAAI,MACxD,CAEA,SAASC,EAAQC,EAAWC,EAAIL,EAAwB,CACtD,IAAMM,EAAOF,EAAE,QAAQ,OAAQ,GAAG,EAAE,KAAK,EACzC,OAAOE,EAAK,OAASD,EAAI,GAAGC,EAAK,MAAM,EAAGD,EAAI,CAAC,UAAOC,CACxD,CAEA,SAASC,EAAcC,EAA0B,CAC/C,IAAMC,EAAOC,EAAeF,CAAU,EACtC,GAAI,CAACG,EAAWF,CAAI,EAAG,MAAM,IAAI,MAAM,uBAAuBA,GAAM,EACpE,OAAO,KAAK,MAAMG,EAAaH,EAAM,OAAO,CAAC,CAC/C,CAEA,SAASI,EAAQC,EAAUC,EAA0B,CACnD,OAAOD,GAAK,SAASC,CAAO,GAAG,QAAU,EAC3C,CAEA,SAASC,EAAUF,EAAUG,EAAUC,EAAiC,CACtE,OAAOL,EAAQC,EAAKI,EAAO,OAAO,GAAKD,GAAK,YAAcC,EAAO,OACnE,CAEA,SAASC,EAAeC,EAAYH,EAAkB,CACpD,IAAMI,EAAQJ,GAAK,UAAY,UAAUA,EA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AAK,SAAS,EACpC,MAAO,CAAE,QAAAR,EAAS,QAAA6D,EAAS,OAAAC,EAAQ,GAAIC,EAAY,CAAE,UAAAA,CAAU,EAAI,CAAC,CAAG,CACzE","names":["existsSync","readFileSync","NON_DELIVERABLE_CHANNELS","PROMPT_PREVIEW","str","v","preview","s","n","flat","readRawConfig","configPath","path","findConfigPath","existsSync","readFileSync","isAdmin","cfg","agentId","canManage","job","caller","ownershipError","id","owner","resolveNotify","args","raw","parts","describeJob","now","tz","next","isPendingCreate","formatFireTime","nextFireTime","state","lines","humanizeCron","notifyApproval","deps","text","dest","e","runScheduleTool","action","crons","mineOnly","entries","j","mutate","fn","applyConfigMutation","when","prompt","parsed","parseEnglishToCron","SUPPORTED_PHRASES_HINT","agent","timezone","DEFAULT_SCHEDULE_TIMEZONE","isValidTimezone","jobId","slugifyScheduleId","isValidScheduleId","notify","approval","buildScheduleJob","result","c","setAtPath","request","notified","enable","unsetAtPath","getAtPath","resolveScheduleCaller","env","envChat","channel","chatId","accountId"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h as a,i as b,j as c,k as d}from"./chunk-BIFJSQB5.js";import"./chunk-NSYY5NCR.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-L2WSPY6S.js";import"./chunk-QJANPP4C.js";import"./chunk-FIOB3MEX.js";export{d as CronScheduler,c as cronRunId,b as getNextCronDate,a as runLinkIds};
|
|
2
|
+
//# sourceMappingURL=scheduler-NRXPVG7P.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h,w as i}from"./chunk-6HMZ5TTM.js";import"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-QJANPP4C.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";i();export{h as askSeat,a as configureDecisions,c as decisionsRuntime,f as getSeatMode,d as parseSeatMode,g as recordSeatOutcome,b as resetDecisionsRuntime,e as seatEnvVar};
|
|
2
|
+
//# sourceMappingURL=seat-3WT3VJC2.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{v as S,w}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=select-
|
|
1
|
+
import{v as S,w}from"./chunk-6HMZ5TTM.js";import{a as g,b as h,f as R}from"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import{d as f}from"./chunk-VDMYBPYB.js";import"./chunk-QJANPP4C.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";w();R();var p="skill-select";function y(l){return{task:d(l.task,1200),...l.agent?{agent:l.agent}:{},skills:l.candidates.map(t=>({name:t.name,purpose:d(t.description,300),...t.category?{category:t.category}:{},...t.tags?.length?{tags:t.tags.slice(0,8)}:{}}))}}function b(l){let t={};for(let i of l)t[i.name]=d(i.description,300);return{anyRelevant:g("At least one of these skills is about the task at hand.",{true:"The task is the kind of work one of these skills exists for, and following it would change how the work is done \u2014 it names the same system, the same procedure or the same kind of artefact.",false:"None of them is about this task. They may share vocabulary with it, mention the same tools, or belong to the same project without bearing on what is being asked. Sharing words with a task is not being about it."}),best:h(t,"Which skill is this task most about?")}}function v(l){let t=l.anyRelevant,i=l.best,o=Object.entries(i.probabilities??{}).map(([e,s])=>({name:e,p:Number(s)||0})).sort((e,s)=>s.p-e.p);return{anyRelevant:t.noul,name:i.choice,confidence:i.confidence,ranked:o}}function d(l,t){return l.length>t?`${l.slice(0,t)}\u2026`:l}var x=.1,A=12;async function E(l,t,i={}){let o=i.minRelevant??.6,e=f(l,t).filter(n=>n.relevance>=x).slice(0,A),s=e.map(n=>({name:n.skill.frontmatter.name,lexical:n.relevance}));if(e.length===0)return{skill:null,anyRelevant:0,confidence:0,shortlist:s,judged:!1,reason:"no skill mentions anything in this task"};if(e.length===1)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`only ${e[0].skill.frontmatter.name} matched (${e[0].matchReason})`};let r=e.map(n=>({name:n.skill.frontmatter.name,description:n.skill.frontmatter.description,category:n.skill.frontmatter.category??null,tags:n.skill.frontmatter.tags})),m=await S(p,y({task:t,agent:i.agent??null,candidates:r}),b(r),{incumbent:{best:r[0].name},features:{agent:i.agent??"unknown",candidates:r.length}});if(!m)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`seat off \u2014 lexical top match (${e[0].matchReason})`};let a=v(m.answers),c=s.map(n=>({...n,p:a.ranked.find(k=>k.name===n.name)?.p??0})).sort((n,k)=>(k.p??0)-(n.p??0));if(a.anyRelevant<o)return{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`nothing on the shortlist is about this task (${a.anyRelevant.toFixed(2)} below ${o})`};let u=e.find(n=>n.skill.frontmatter.name===a.name);return u?{skill:u.skill,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`${a.name} (confidence ${a.confidence.toFixed(2)})`}:{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`seat chose "${a.name}", which was not on the shortlist`}}export{E as pickSkillForTask};
|
|
2
|
+
//# sourceMappingURL=select-KPQWIC22.js.map
|