dispach 0.1.2 → 0.2.0-pilot.1
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/README.md +196 -118
- package/dist/APEv2Parser-2wqk09q7.js +5 -0
- package/dist/APEv2Parser-2wqk09q7.js.map +9 -0
- package/dist/AiffParser-zw4g2bdd.js +5 -0
- package/dist/AiffParser-zw4g2bdd.js.map +12 -0
- package/dist/App-ez7ve0yp.js +11 -0
- package/dist/{App-b1yrwrcq.js.map → App-ez7ve0yp.js.map} +6 -7
- package/dist/AsfParser-2hfcf5z2.js +5 -0
- package/dist/AsfParser-2hfcf5z2.js.map +14 -0
- package/dist/ConfigEditor-aamadrx3.js +6 -0
- package/dist/{ConfigEditor-n8hdw6r7.js.map → ConfigEditor-aamadrx3.js.map} +2 -2
- package/dist/DsdiffParser-n8smktvb.js +5 -0
- package/dist/DsdiffParser-n8smktvb.js.map +11 -0
- package/dist/DsfParser-npmjp4vr.js +5 -0
- package/dist/DsfParser-npmjp4vr.js.map +11 -0
- package/dist/FlacParser-xpbs2zmb.js +5 -0
- package/dist/FlacParser-xpbs2zmb.js.map +9 -0
- package/dist/KeyProbe-4fp152yv.js +5 -0
- package/dist/{KeyProbe-9jjeze5r.js.map → KeyProbe-4fp152yv.js.map} +2 -2
- package/dist/MP4Parser-es3afcmw.js +5 -0
- package/dist/MP4Parser-es3afcmw.js.map +12 -0
- package/dist/MatroskaParser-kxysj649.js +5 -0
- package/dist/MatroskaParser-kxysj649.js.map +13 -0
- package/dist/MpegParser-b3rr7b0f.js +5 -0
- package/dist/MpegParser-b3rr7b0f.js.map +13 -0
- package/dist/MusepackParser-sgjzmq0r.js +5 -0
- package/dist/MusepackParser-sgjzmq0r.js.map +16 -0
- package/dist/OggParser-x8h54ynf.js +5 -0
- package/dist/OggParser-x8h54ynf.js.map +18 -0
- package/dist/Picker-rq015kzc.js +5 -0
- package/dist/{Picker-hfeh1g6m.js.map → Picker-rq015kzc.js.map} +2 -2
- package/dist/SessionPicker-03zyvd2f.js +5 -0
- package/dist/{SessionPicker-zyqkg4dn.js.map → SessionPicker-03zyvd2f.js.map} +2 -2
- package/dist/SkillBrowser-8s8rjv98.js +5 -0
- package/dist/{SkillBrowser-3qdp8080.js.map → SkillBrowser-8s8rjv98.js.map} +2 -2
- package/dist/WavPackParser-w515nnw2.js +5 -0
- package/dist/WavPackParser-w515nnw2.js.map +11 -0
- package/dist/WaveParser-sb0w9m20.js +5 -0
- package/dist/WaveParser-sb0w9m20.js.map +13 -0
- package/dist/WizardApp-wr1tftcr.js +5 -0
- package/dist/{WizardApp-vzpbydy3.js.map → WizardApp-wr1tftcr.js.map} +3 -3
- package/dist/agents.d.ts +19 -3
- package/dist/agents.d.ts.map +1 -1
- package/dist/channels-gx951qdp.js +31 -0
- package/dist/channels-gx951qdp.js.map +10 -0
- package/dist/channels.d.ts +26 -0
- package/dist/channels.d.ts.map +1 -0
- package/dist/client.js +11 -11
- package/dist/client.js.map +3 -3
- package/dist/config-wvjeejgd.js +24 -0
- package/dist/{config-g7za9x13.js.map → config-wvjeejgd.js.map} +2 -2
- package/dist/credential-10dn3fxj.js +19 -0
- package/dist/{credential-npr6z8c8.js.map → credential-10dn3fxj.js.map} +1 -1
- package/dist/daemon.d.ts.map +1 -1
- package/dist/index-10009hp8.js +11 -0
- package/dist/index-10009hp8.js.map +11 -0
- package/dist/index-1xwrkwh5.js +14 -0
- package/dist/index-1xwrkwh5.js.map +50 -0
- package/dist/index-34p39yfc.js +47 -0
- package/dist/index-34p39yfc.js.map +15 -0
- package/dist/index-3y96s740.js +6 -0
- package/dist/{index-hwpvhaza.js.map → index-3y96s740.js.map} +1 -1
- package/dist/index-4ybeefmn.js +6 -0
- package/dist/index-4ybeefmn.js.map +11 -0
- package/dist/index-59z88wrb.js +6 -0
- package/dist/{index-h9mw7b9d.js.map → index-59z88wrb.js.map} +2 -2
- package/dist/index-5fwzn21m.js +6 -0
- package/dist/{index-gz9x25tz.js.map → index-5fwzn21m.js.map} +2 -2
- package/dist/index-6dvnfk8y.js +6 -0
- package/dist/index-6dvnfk8y.js.map +10 -0
- package/dist/index-6p70fnb7.js +153 -0
- package/dist/index-6p70fnb7.js.map +20 -0
- package/dist/index-6s471ydn.js +12 -0
- package/dist/{index-j55s3ehk.js.map → index-6s471ydn.js.map} +2 -2
- package/dist/index-87wcawta.js +6 -0
- package/dist/{index-0d93hyfc.js.map → index-87wcawta.js.map} +2 -2
- package/dist/index-92gfcbw0.js +6 -0
- package/dist/index-92gfcbw0.js.map +9 -0
- package/dist/index-a0h0p20f.js +991 -0
- package/dist/{index-tv4yv7d2.js.map → index-a0h0p20f.js.map} +27 -23
- package/dist/index-bamw24xc.js +6 -0
- package/dist/{index-6q4wf8e3.js.map → index-bamw24xc.js.map} +1 -1
- package/dist/index-c8ge88a9.js +12 -0
- package/dist/{index-258d8bzg.js.map → index-c8ge88a9.js.map} +4 -3
- package/dist/index-cb2q8nae.js +6 -0
- package/dist/index-cb2q8nae.js.map +13 -0
- package/dist/index-ct6bw0a6.js +6 -0
- package/dist/{index-4z7axw4r.js.map → index-ct6bw0a6.js.map} +1 -1
- package/dist/index-cz6yjxyz.js +10 -0
- package/dist/index-cz6yjxyz.js.map +42 -0
- package/dist/index-d0c5abkw.js +6 -0
- package/dist/{index-vgc3y3rm.js.map → index-d0c5abkw.js.map} +3 -3
- package/dist/index-d0vagham.js +31 -0
- package/dist/index-d0vagham.js.map +188 -0
- package/dist/index-d0zxvr99.js +90 -0
- package/dist/index-d0zxvr99.js.map +13 -0
- package/dist/{index-s9mbq7h6.js → index-d9c97ver.js} +4 -4
- package/dist/{index-s9mbq7h6.js.map → index-d9c97ver.js.map} +1 -1
- package/dist/index-e508e0vt.js +6 -0
- package/dist/{index-tf71ap9v.js.map → index-e508e0vt.js.map} +1 -1
- package/dist/index-esq0knqx.js +6 -0
- package/dist/index-esq0knqx.js.map +10 -0
- package/dist/index-featyhps.js +6 -0
- package/dist/index-featyhps.js.map +10 -0
- package/dist/index-fnq44zdt.js +45 -0
- package/dist/index-fnq44zdt.js.map +74 -0
- package/dist/index-gmn80dwc.js +7 -0
- package/dist/{index-02dn6m2j.js.map → index-gmn80dwc.js.map} +2 -2
- package/dist/index-gwhx69qs.js +66 -0
- package/dist/index-gwhx69qs.js.map +12 -0
- package/dist/index-kjgzhf3w.js +9 -0
- package/dist/{index-6p999cx4.js.map → index-kjgzhf3w.js.map} +4 -6
- package/dist/index-m68cd91a.js +12 -0
- package/dist/index-m68cd91a.js.map +23 -0
- package/dist/{index-3g3ny01d.js → index-mhmgw54j.js} +4 -4
- package/dist/{index-3g3ny01d.js.map → index-mhmgw54j.js.map} +1 -1
- package/dist/{index-gme2egyq.js → index-qm612hwa.js} +4 -4
- package/dist/{index-gme2egyq.js.map → index-qm612hwa.js.map} +1 -1
- package/dist/{index-j7gyr5nx.js → index-qwntpbwe.js} +7 -7
- package/dist/{index-j7gyr5nx.js.map → index-qwntpbwe.js.map} +1 -1
- package/dist/index-qx3xdk4x.js +6 -0
- package/dist/{index-d4x6yvqh.js.map → index-qx3xdk4x.js.map} +3 -4
- package/dist/{index-4cf6v9nb.js → index-rh0meegk.js} +4 -4
- package/dist/{index-4cf6v9nb.js.map → index-rh0meegk.js.map} +1 -1
- package/dist/index-ryb159ff.js +9 -0
- package/dist/{index-ff514z3y.js.map → index-ryb159ff.js.map} +3 -5
- package/dist/{index-ammv5st7.js → index-s6zfpyqa.js} +6 -6
- package/dist/{index-ammv5st7.js.map → index-s6zfpyqa.js.map} +1 -1
- package/dist/index-s9va2kmc.js +429 -0
- package/dist/index-s9va2kmc.js.map +11 -0
- package/dist/index-v5dmsgpx.js +7 -0
- package/dist/index-v5dmsgpx.js.map +11 -0
- package/dist/index-vaj3mn3a.js +6 -0
- package/dist/index-vaj3mn3a.js.map +14 -0
- package/dist/index-vy0rbzws.js +6 -0
- package/dist/{index-fex44816.js.map → index-vy0rbzws.js.map} +2 -2
- package/dist/index-w0s77wfx.js +6 -0
- package/dist/{index-v8e92nfw.js.map → index-w0s77wfx.js.map} +1 -1
- package/dist/index-wx1jzjzr.js +6 -0
- package/dist/{index-qdbq8crg.js.map → index-wx1jzjzr.js.map} +2 -2
- package/dist/index-xbn26c8g.js +126 -0
- package/dist/index-xbn26c8g.js.map +14 -0
- package/dist/index-ytvwyp6k.js +6 -0
- package/dist/{index-9r0wyj6w.js.map → index-ytvwyp6k.js.map} +2 -2
- package/dist/{index-cqqb6gaq.js → index-yvnwpxbb.js} +5 -5
- package/dist/{index-cqqb6gaq.js.map → index-yvnwpxbb.js.map} +1 -1
- package/dist/index.js +379 -448
- package/dist/index.js.map +26 -28
- package/dist/init.d.ts.map +1 -1
- package/dist/lib/agent-secrets.d.ts +38 -0
- package/dist/lib/agent-secrets.d.ts.map +1 -0
- package/dist/lib/agent-template.d.ts +54 -0
- package/dist/lib/agent-template.d.ts.map +1 -0
- package/dist/lib/channel-actions.d.ts +103 -0
- package/dist/lib/channel-actions.d.ts.map +1 -0
- package/dist/lib/chat-frame.d.ts +12 -1
- package/dist/lib/chat-frame.d.ts.map +1 -1
- package/dist/lib/commands.d.ts +13 -0
- package/dist/lib/commands.d.ts.map +1 -1
- package/dist/lib/const.d.ts +1 -1
- package/dist/lib/daemon-plan.d.ts.map +1 -1
- package/dist/lib/help.d.ts.map +1 -1
- package/dist/lib/host-actions.d.ts +121 -0
- package/dist/lib/host-actions.d.ts.map +1 -0
- package/dist/lib/init-flow.d.ts +32 -0
- package/dist/lib/init-flow.d.ts.map +1 -1
- package/dist/lib/init-whatsapp.d.ts +52 -0
- package/dist/lib/init-whatsapp.d.ts.map +1 -0
- package/dist/lib/plugin-install.d.ts +120 -0
- package/dist/lib/plugin-install.d.ts.map +1 -0
- package/dist/lib/providers.d.ts.map +1 -1
- package/dist/lib/provision.d.ts +13 -0
- package/dist/lib/provision.d.ts.map +1 -1
- package/dist/lib/readme-table.d.ts +15 -0
- package/dist/lib/readme-table.d.ts.map +1 -0
- package/dist/lib/sandbox.d.ts +17 -0
- package/dist/lib/sandbox.d.ts.map +1 -1
- package/dist/lib/schema.d.ts +34 -1
- package/dist/lib/schema.d.ts.map +1 -1
- package/dist/lib/subcommand.d.ts.map +1 -1
- package/dist/lib/web-url.d.ts +15 -0
- package/dist/lib/web-url.d.ts.map +1 -0
- package/dist/lib/wizard.d.ts.map +1 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/plugins.d.ts +27 -8
- package/dist/plugins.d.ts.map +1 -1
- package/dist/restart.d.ts +21 -0
- package/dist/restart.d.ts.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/schedules.d.ts.map +1 -1
- package/dist/serve.d.ts.map +1 -1
- package/dist/sessions.d.ts.map +1 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/status.d.ts +16 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/web-61cjhpv2.js +14 -0
- package/dist/{web-vkb16r62.js.map → web-61cjhpv2.js.map} +3 -3
- package/dist/web.d.ts +2 -13
- package/dist/web.d.ts.map +1 -1
- package/dist/workspace.d.ts.map +1 -1
- package/dist/wrapper-9msjh1xg.js +5 -0
- package/dist/wrapper-9msjh1xg.js.map +9 -0
- package/package.json +6 -3
- package/dist/App-b1yrwrcq.js +0 -11
- package/dist/ConfigEditor-n8hdw6r7.js +0 -6
- package/dist/KeyProbe-9jjeze5r.js +0 -5
- package/dist/Picker-hfeh1g6m.js +0 -5
- package/dist/SessionPicker-zyqkg4dn.js +0 -5
- package/dist/SkillBrowser-3qdp8080.js +0 -5
- package/dist/WizardApp-vzpbydy3.js +0 -5
- package/dist/config-g7za9x13.js +0 -24
- package/dist/credential-npr6z8c8.js +0 -19
- package/dist/index-02dn6m2j.js +0 -7
- package/dist/index-0d93hyfc.js +0 -6
- package/dist/index-1c5113t4.js +0 -66
- package/dist/index-1c5113t4.js.map +0 -12
- package/dist/index-258d8bzg.js +0 -12
- package/dist/index-4z7axw4r.js +0 -6
- package/dist/index-6p999cx4.js +0 -9
- package/dist/index-6q4wf8e3.js +0 -6
- package/dist/index-9r0wyj6w.js +0 -6
- package/dist/index-d4x6yvqh.js +0 -6
- package/dist/index-fecm8xe7.js +0 -77
- package/dist/index-fecm8xe7.js.map +0 -12
- package/dist/index-fex44816.js +0 -6
- package/dist/index-ff514z3y.js +0 -14
- package/dist/index-gz9x25tz.js +0 -6
- package/dist/index-h9mw7b9d.js +0 -6
- package/dist/index-hwpvhaza.js +0 -6
- package/dist/index-j55s3ehk.js +0 -12
- package/dist/index-mtn0g9vc.js +0 -7
- package/dist/index-mtn0g9vc.js.map +0 -11
- package/dist/index-qdbq8crg.js +0 -6
- package/dist/index-tf71ap9v.js +0 -6
- package/dist/index-ttwyrdjs.js +0 -427
- package/dist/index-ttwyrdjs.js.map +0 -11
- package/dist/index-tv4yv7d2.js +0 -903
- package/dist/index-ty24n0jh.js +0 -167
- package/dist/index-ty24n0jh.js.map +0 -19
- package/dist/index-v8e92nfw.js +0 -6
- package/dist/index-vgc3y3rm.js +0 -6
- package/dist/index-whaw4b18.js +0 -6
- package/dist/index-whaw4b18.js.map +0 -10
- package/dist/web-vkb16r62.js +0 -14
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{Kn,Yr}from"./index-yvnwpxbb.js";import{i}from"./index-qx3xdk4x.js";import{ao,At}from"./index-6s471ydn.js";import{te}from"./index-featyhps.js";var B=1;function en(t,s){let u=Math.max(1,s-B),n=t.value.split(`
|
|
3
|
+
`),c=ao(t),d=[],m=0,a=0;for(let[f,o]of n.entries()){let h=Kn(o,u),b=f===c.line?Yr(o,c.column):-1,l=-1;if(b>=0){l=h.length-1;for(let[p,e]of h.entries())if(b<=e.to){l=p;break}}for(let[p,e]of h.entries()){if(p===l)m=d.length;d.push({start:a+e.from,end:a+e.to,lead:e.lead,text:e.text,caret:p===l?e.lead+Math.max(0,Math.min(b-e.from,e.to-e.from)):void 0})}a+=[...o].length+1}return{rows:d,caretRow:m}}function k(t,s){let u=[...t.text],n=[];for(let[c,d]of u.entries()){let m=c<t.lead?-1:t.start+(c-t.lead),a=s!==void 0&&m>=s.start&&m<s.end,f=t.caret===c,o=n.at(-1);if(o!==void 0&&!f&&!o.caret&&o.selected===a){n[n.length-1]={...o,text:o.text+d};continue}n.push({text:d,selected:a,caret:f})}if(t.caret!==void 0&&t.caret>=u.length)n.push({text:" ",selected:!1,caret:!0});return n}import{Box as _,Text as r}from"ink";import{jsx as y,jsxs as w}from"react/jsx-runtime";function An({editor:t,placeholder:s,secret:u,gutter:n="",maxRows:c,columns:d}){let m=[...n].length,a=" ".repeat(m);if(t.value===""&&s!==void 0&&s!==""){let x=[...s];return w(r,{dimColor:!0,wrap:"truncate",children:[y(r,{color:i.accent,children:n}),y(r,{inverse:!0,children:x[0]??" "}),x.slice(1).join("")]})}let f=At(t),{rows:o,caretRow:h}=en(t,Math.max(1,(d??Number.MAX_SAFE_INTEGER)-m)),b=c??o.length,{from:l,to:p}=te(o.length,h,Math.max(1,b)),e=l,T=o.length-p;return w(_,{flexDirection:"column",children:[e>0?w(r,{dimColor:!0,wrap:"truncate",children:[a,"… ",e," line",e===1?"":"s"," above"]}):null,o.slice(l,p).map((x,v)=>{let C=l+v,M=u===!0?[...x.text].map(()=>"•"):[...x.text],S=C===l&&e===0?n:a;if(x.caret===void 0&&f===void 0)return w(r,{wrap:"truncate",children:[y(r,{color:i.accent,children:S}),M.join("")]},`row-${C}`);let A=k(x,f),L=0;return w(r,{wrap:"truncate",children:[y(r,{color:i.accent,children:S}),A.map((g)=>{let R=`run-${C}-${L}`;L+=[...g.text].length;let E=u===!0?[...g.text].map(()=>"•").join(""):g.text;if(g.caret)return y(r,{inverse:!0,children:E},R);if(g.selected)return y(r,{backgroundColor:i.selection,children:E},R);return y(r,{children:E},R)})]},`row-${C}`)}),T>0?w(r,{dimColor:!0,wrap:"truncate",children:[a,"… ",T," line",T===1?"":"s"," below"]}):null]})}
|
|
4
|
+
export{en,An};
|
|
5
|
+
|
|
6
|
+
//# debugId=4705CB7CB5B170E964756E2164756E21
|
|
7
|
+
//# sourceMappingURL=index-gmn80dwc.js.map
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"/**\n * The composer's visual rows and where the caret sits on them. Pure, so the layout is arithmetic.\n *\n * ## Why the input box needs its own wrapping at all\n *\n * It rendered each logical line with `wrap=\"truncate\"` and no wrapping of its own, which is half of the\n * rule `lib/wrap.ts` states and the half that does not work. Ink truncates to the width Yoga measured,\n * and a `<Box>` with no explicit width takes its *content* width — so a long message made the box wider\n * than the terminal, and what happened next was the terminal's decision rather than ours. Measured at 100\n * columns: VS Code cut the line at the border and took the caret with it, so you could not see what you\n * were typing; Warp wrapped the over-wide row and the tail landed on top of the right-hand border. One\n * cause, two symptoms, and neither reproducible in the other terminal.\n *\n * So the composer wraps its own text, exactly as the transcript and the live pane do, and every row is\n * drawn `wrap=\"truncate\"` as a backstop rather than as the layout.\n *\n * ## One column is reserved, deliberately\n *\n * The caret is drawn as an inverse cell, so it needs a cell — including when it sits at the end of a line\n * that exactly fills the row. Wrapping to `columns - 1` buys that cell once, for every row, with no\n * special case; the alternative is an extra visual row that appears and disappears as you type past the\n * edge, which moves the whole frame on a surface that has no room to move.\n *\n * ## One derivation, two callers\n *\n * `LineCursor` draws these rows and `chat-frame.promptRows` counts them. That is the pairing the repo has\n * been bitten by before — a component that grows a row without the frame arithmetic knowing is a frame\n * taller than the terminal, which on the alternate buffer is corruption rather than crowding. Here the\n * count is `layout.rows.length` plus the notices, by construction.\n */\n\nimport { lineInfo } from \"#editor\"\nimport type { EditorState } from \"#lib/types\"\nimport { expandColumn, wrapRows } from \"#lib/wrap\"\n\n/** A cell reserved so the caret has somewhere to sit at the end of a full row. */\nconst CARET_CELL = 1\n\nexport interface ComposerRow {\n /** What is painted, hanging indent included. Never wider than the window. */\n readonly text: string\n /** Where the caret sits in this row, or `undefined` when it is on another row. */\n readonly caret: number | undefined\n /**\n * Buffer-absolute code-point offsets of the source this row draws, `start` inclusive and `end` not.\n *\n * Absolute rather than line-relative, which is the only form a selection can use: `wrapRows` reports\n * offsets into a single *line*, and a selection is a range over the whole buffer. Adding the line's own\n * start here is the one place that translation belongs — a renderer recomputing it would need the\n * split, the tab expansion and the wrap all over again to get the same number.\n */\n readonly start: number\n readonly end: number\n /** Columns of `text` that are re-applied indent, which no selection may highlight. */\n readonly lead: number\n}\n\n/** A run of a row that is drawn the same way: selected or not, caret or not. */\nexport interface RowSegment {\n readonly text: string\n readonly selected: boolean\n /** The single cell the caret inverts. Never wider than one code point. */\n readonly caret: boolean\n}\n\nexport interface ComposerLayout {\n /** Every visual row of the buffer, in order. At least one, even for an empty buffer. */\n readonly rows: readonly ComposerRow[]\n /** Index into `rows` holding the caret. */\n readonly caretRow: number\n}\n\n/**\n * Every visual row of `editor`'s buffer at `columns`, and which one the caret is on.\n *\n * `columns` is the width available *inside* whatever draws it — a caller with a border and padding\n * subtracts those first, because this cannot see them.\n */\nexport function composerLayout(editor: EditorState, columns: number): ComposerLayout {\n const width = Math.max(1, columns - CARET_CELL)\n const lines = editor.value.split(\"\\n\")\n const cursor = lineInfo(editor)\n\n const rows: ComposerRow[] = []\n let caretRow = 0\n // Where each line starts in the buffer, in code points. The `+ 1` is the newline itself, which no row\n // draws and every offset after it has to account for.\n let base = 0\n for (const [at, line] of lines.entries()) {\n const wrapped = wrapRows(line, width)\n // The caret's column has to be translated into the same tab-expanded coordinates the rows are\n // measured in, or a line containing a tab puts it seven columns to the left of where it is.\n const column = at === cursor.line ? expandColumn(line, cursor.column) : -1\n // Walked backwards so a caret exactly on a break lands at the *end* of the earlier row rather\n // than the start of the later one, which is where a person expects it after pressing → .\n let on = -1\n if (column >= 0) {\n on = wrapped.length - 1\n for (const [n, row] of wrapped.entries()) {\n if (column <= row.to) {\n on = n\n break\n }\n }\n }\n for (const [n, row] of wrapped.entries()) {\n if (n === on) caretRow = rows.length\n rows.push({\n start: base + row.from,\n end: base + row.to,\n lead: row.lead,\n text: row.text,\n // Clamped into the row: a caret past `to` can only mean the source column sat in the\n // whitespace a break consumed, and the end of the row is the honest place for it.\n caret:\n n === on\n ? row.lead + Math.max(0, Math.min(column - row.from, row.to - row.from))\n : undefined,\n })\n }\n base += [...line].length + 1\n }\n return { rows, caretRow }\n}\n\n/**\n * One row, split into the runs a renderer can paint in one go.\n *\n * Built as runs rather than as three slices because the caret can sit anywhere — including inside the\n * selection — and slicing for both produces overlapping ranges that have to be reconciled. Walking the row\n * once and grouping adjacent code points by how they are drawn has no such case, and the caret staying\n * exactly one cell wide is a property of the walk rather than something to remember.\n *\n * The indent is never selected. Those columns are chrome the wrap re-applied; highlighting them would\n * suggest text is included that no offset in the buffer corresponds to.\n */\nexport function rowSegments(\n row: ComposerRow,\n selection: { readonly start: number; readonly end: number } | undefined,\n): readonly RowSegment[] {\n const cells = [...row.text]\n const segments: RowSegment[] = []\n for (const [column, cell] of cells.entries()) {\n // A column past the indent maps back to the source by the same arithmetic the caret uses; one\n // inside it maps to nothing, which is why it can never be selected.\n const offset = column < row.lead ? -1 : row.start + (column - row.lead)\n const isSelected =\n selection !== undefined && offset >= selection.start && offset < selection.end\n const isCaret = row.caret === column\n const last = segments.at(-1)\n // The caret is its own run always, so it stays one cell wide even in the middle of a selection.\n if (last !== undefined && !isCaret && !last.caret && last.selected === isSelected) {\n segments[segments.length - 1] = { ...last, text: last.text + cell }\n continue\n }\n segments.push({ text: cell, selected: isSelected, caret: isCaret })\n }\n // A caret past the last character has no cell to invert, so it needs one. Same reason `LineCursor`\n // inverts a trailing space today.\n if (row.caret !== undefined && row.caret >= cells.length) {\n segments.push({ text: \" \", selected: false, caret: true })\n }\n return segments\n}\n",
|
|
6
6
|
"/**\n * Editable text with an inverse-video cursor — the rendering half of `editor.ts`.\n *\n * Shared by the chat composer and the wizard's text fields, so there is one cursor implementation:\n * code-point split (never UTF-16 units), the character under the cursor drawn inverse, and a trailing\n * space inverted when the cursor sits at the end. When the buffer is empty and a placeholder is given,\n * the placeholder renders dim with the cursor on its first character — the affordance every modern CLI\n * uses for \"press enter to accept this\".\n *\n * ## Why it renders rows rather than lines\n *\n * The chat buffer became multi-line in Phase 5.5, and the alternative to generalising this was a second\n * component for the composer — which would be a second cursor implementation, the exact thing this file\n * was extracted to prevent. So it renders a column of rows with a caller-supplied `gutter`, and a\n * single-line field is the one-row case of that.\n *\n * A **row is not a line**, and conflating them was the defect. Nothing here wrapped: each logical line was\n * handed to Ink with `wrap=\"truncate\"`, so a message wider than the box was cut and the caret went with it\n * — you could not see what you were typing. `composerLayout` now decides the rows and where the caret sits\n * on them, `wrap=\"truncate\"` is a backstop rather than the layout, and `chat-frame.promptRows` counts the\n * same rows this draws.\n *\n * Two consequences worth stating. The cursor is never drawn *on* a newline: the line break is structure\n * rather than a character, so the caret sits at the end of one row or the start of the next, which is\n * where a person expects it. And the view scrolls to follow the caret through `viewport()` — the same\n * function the catalogue list uses, because \"keep the interesting row visible\" is one rule.\n */\n\nimport { Box, Text } from \"ink\"\nimport { selectionRange } from \"#editor\"\nimport { composerLayout, rowSegments } from \"#lib/composer\"\nimport { viewport } from \"#lib/rows\"\nimport { THEME } from \"#lib/theme\"\nimport type { EditorState } from \"#lib/types\"\n\nexport interface LineCursorProps {\n readonly editor: EditorState\n readonly placeholder?: string\n /**\n * Render every character as a dot. For a value that must not appear on screen, in scrollback, or\n * over a shoulder — the cursor still moves normally, because the editing model is unchanged and\n * only the rendering differs.\n */\n readonly secret?: boolean\n /**\n * Drawn before the first line. Continuation lines get an equal-width blank, so the text stays in\n * one column and a two-line message does not look like two messages.\n */\n readonly gutter?: string\n /** Visible rows before the view starts scrolling to follow the cursor. */\n readonly maxRows?: number\n /**\n * Columns available for the text, the gutter included.\n *\n * Required for anything that can hold a long message. Omitted, nothing wraps and a line wider than\n * whatever draws this is truncated by Ink at a width nobody chose — which is what this component did\n * everywhere until Phase 5.6.\n */\n readonly columns?: number\n}\n\nexport function LineCursor({\n editor,\n placeholder,\n secret,\n gutter = \"\",\n maxRows,\n columns,\n}: LineCursorProps) {\n const lead = [...gutter].length\n const pad = \" \".repeat(lead)\n\n if (editor.value === \"\" && placeholder !== undefined && placeholder !== \"\") {\n const chars = [...placeholder]\n return (\n <Text dimColor wrap=\"truncate\">\n <Text color={THEME.accent}>{gutter}</Text>\n <Text inverse>{chars[0] ?? \" \"}</Text>\n {chars.slice(1).join(\"\")}\n </Text>\n )\n }\n\n // The gutter is drawn on the first row and matched by a blank on every row after it, so the text\n // stays in one column — which means the text itself only ever gets what is left.\n // Derived here rather than passed in: it is a function of the editor state this component already\n // has, and a prop would let a caller draw a highlight the reducer does not believe in.\n const selection = selectionRange(editor)\n const { rows: all, caretRow } = composerLayout(\n editor,\n Math.max(1, (columns ?? Number.MAX_SAFE_INTEGER) - lead),\n )\n const window = maxRows ?? all.length\n const { from, to } = viewport(all.length, caretRow, Math.max(1, window))\n const hiddenAbove = from\n const hiddenBelow = all.length - to\n\n return (\n <Box flexDirection=\"column\">\n {hiddenAbove > 0 ? (\n <Text dimColor wrap=\"truncate\">\n {pad}… {hiddenAbove} line{hiddenAbove === 1 ? \"\" : \"s\"} above\n </Text>\n ) : null}\n {all.slice(from, to).map((row, offset) => {\n const at = from + offset\n // Masked per code point, so the dot count matches what was typed rather than its byte\n // length.\n const chars = secret === true ? [...row.text].map(() => \"•\") : [...row.text]\n const glyph = at === from && hiddenAbove === 0 ? gutter : pad\n if (row.caret === undefined && selection === undefined) {\n return (\n // Keyed by index: two identical rows in a message are not the same row, and a\n // content key would collapse them.\n <Text key={`row-${at}`} wrap=\"truncate\">\n <Text color={THEME.accent}>{glyph}</Text>\n {chars.join(\"\")}\n </Text>\n )\n }\n // Runs rather than slices. The caret can sit inside the selection, and slicing for both\n // produces overlapping ranges that have to be reconciled; `rowSegments` walks the row once\n // and the caret stays one cell wide by construction. Masking is applied after the split so\n // a secret field's dots line up with the runs rather than with the source.\n const runs = rowSegments(row, selection)\n let column = 0\n return (\n <Text key={`row-${at}`} wrap=\"truncate\">\n <Text color={THEME.accent}>{glyph}</Text>\n {runs.map((run) => {\n const key = `run-${at}-${column}`\n column += [...run.text].length\n const text =\n secret === true ? [...run.text].map(() => \"•\").join(\"\") : run.text\n // Inverting a trailing space is how the caret stays visible at end of line;\n // `rowSegments` supplies that space when the caret is past the last character.\n if (run.caret) {\n return (\n <Text key={key} inverse>\n {text}\n </Text>\n )\n }\n if (run.selected) {\n return (\n <Text key={key} backgroundColor={THEME.selection}>\n {text}\n </Text>\n )\n }\n return <Text key={key}>{text}</Text>\n })}\n </Text>\n )\n })}\n {hiddenBelow > 0 ? (\n <Text dimColor wrap=\"truncate\">\n {pad}… {hiddenBelow} line{hiddenBelow === 1 ? \"\" : \"s\"} below\n </Text>\n ) : null}\n </Box>\n )\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": ";qJAoCA,IAAM,EAAa,EA0CZ,SAAS,EAAc,CAAC,EAAqB,EAAiC,CACjF,IAAM,EAAQ,KAAK,IAAI,EAAG,EAAU,CAAU,EACxC,EAAQ,EAAO,MAAM,MAAM;AAAA,CAAI,EAC/B,EAAS,GAAS,CAAM,EAExB,EAAsB,CAAC,EACzB,EAAW,EAGX,EAAO,EACX,QAAY,EAAI,KAAS,EAAM,QAAQ,EAAG,CACtC,IAAM,EAAU,GAAS,EAAM,CAAK,EAG9B,EAAS,IAAO,EAAO,KAAO,GAAa,EAAM,EAAO,MAAM,EAAI,GAGpE,EAAK,GACT,GAAI,GAAU,EAAG,CACb,EAAK,EAAQ,OAAS,EACtB,QAAY,EAAG,KAAQ,EAAQ,QAAQ,EACnC,GAAI,GAAU,EAAI,GAAI,CAClB,EAAK,EACL,OAIZ,QAAY,EAAG,KAAQ,EAAQ,QAAQ,EAAG,CACtC,GAAI,IAAM,EAAI,EAAW,EAAK,OAC9B,EAAK,KAAK,CACN,MAAO,EAAO,EAAI,KAClB,IAAK,EAAO,EAAI,GAChB,KAAM,EAAI,KACV,KAAM,EAAI,KAGV,MACI,IAAM,EACA,EAAI,KAAO,KAAK,IAAI,EAAG,KAAK,IAAI,EAAS,EAAI,KAAM,EAAI,GAAK,EAAI,IAAI,CAAC,EACrE,MACd,CAAC,EAEL,GAAQ,CAAC,GAAG,CAAI,EAAE,OAAS,EAE/B,MAAO,CAAE,OAAM,UAAS,EAcrB,SAAS,CAAW,CACvB,EACA,EACqB,CACrB,IAAM,EAAQ,CAAC,GAAG,EAAI,IAAI,EACpB,EAAyB,CAAC,EAChC,QAAY,EAAQ,KAAS,EAAM,QAAQ,EAAG,CAG1C,IAAM,EAAS,EAAS,EAAI,KAAO,GAAK,EAAI,OAAS,EAAS,EAAI,MAC5D,EACF,IAAc,QAAa,GAAU,EAAU,OAAS,EAAS,EAAU,IACzE,EAAU,EAAI,QAAU,EACxB,EAAO,EAAS,GAAG,EAAE,EAE3B,GAAI,IAAS,QAAa,CAAC,GAAW,CAAC,EAAK,OAAS,EAAK,WAAa,EAAY,CAC/E,EAAS,EAAS,OAAS,GAAK,IAAK,EAAM,KAAM,EAAK,KAAO,CAAK,EAClE,SAEJ,EAAS,KAAK,CAAE,KAAM,EAAM,SAAU,EAAY,MAAO,CAAQ,CAAC,EAItE,GAAI,EAAI,QAAU,QAAa,EAAI,OAAS,EAAM,OAC9C,EAAS,KAAK,CAAE,KAAM,IAAK,SAAU,GAAO,MAAO,EAAK,CAAC,EAE7D,OAAO,ECtIX,cAAS,UAAK,8DAiCP,SAAS,EAAU,EACtB,SACA,cACA,SACA,SAAS,GACT,UACA,WACgB,CAChB,IAAM,EAAO,CAAC,GAAG,CAAM,EAAE,OACnB,EAAM,IAAI,OAAO,CAAI,EAE3B,GAAI,EAAO,QAAU,IAAM,IAAgB,QAAa,IAAgB,GAAI,CACxE,IAAM,EAAQ,CAAC,GAAG,CAAW,EAC7B,OACI,EAIE,EAJF,CAAM,SAAQ,GAAC,KAAK,WAApB,SAIE,CAHE,EAAqC,EAArC,CAAM,MAAO,EAAM,OAAnB,SAA4B,EAAS,EACrC,EAAiC,EAAjC,CAAM,QAAO,GAAb,SAAe,EAAM,IAAM,IAAM,EAChC,EAAM,MAAM,CAAC,EAAE,KAAK,EAAE,GACzB,EAQV,IAAM,EAAY,GAAe,CAAM,GAC/B,KAAM,EAAK,YAAa,GAC5B,EACA,KAAK,IAAI,GAAI,GAAW,OAAO,kBAAoB,CAAI,CAC3D,EACM,EAAS,GAAW,EAAI,QACtB,OAAM,MAAO,GAAS,EAAI,OAAQ,EAAU,KAAK,IAAI,EAAG,CAAM,CAAC,EACjE,EAAc,EACd,EAAc,EAAI,OAAS,EAEjC,OACI,EA8DE,EA9DF,CAAK,cAAc,SAAnB,SA8DE,CA7DG,EAAc,EACX,EAEE,EAFF,CAAM,SAAQ,GAAC,KAAK,WAApB,SAEE,CADG,EADL,KACY,EADZ,QAC8B,IAAgB,EAAI,GAAK,IADvD,UAEE,EACF,KACH,EAAI,MAAM,EAAM,CAAE,EAAE,IAAI,CAAC,EAAK,IAAW,CACtC,IAAM,EAAK,EAAO,EAGZ,EAAQ,IAAW,GAAO,CAAC,GAAG,EAAI,IAAI,EAAE,IAAI,IAAM,GAAG,EAAI,CAAC,GAAG,EAAI,IAAI,EACrE,EAAQ,IAAO,GAAQ,IAAgB,EAAI,EAAS,EAC1D,GAAI,EAAI,QAAU,QAAa,IAAc,OACzC,OAGI,EAGE,EAHF,CAAwB,KAAK,WAA7B,SAGE,CAFE,EAAoC,EAApC,CAAM,MAAO,EAAM,OAAnB,SAA4B,EAAQ,EACnC,EAAM,KAAK,EAAE,IAFP,OAAO,GAGhB,EAOV,IAAM,EAAO,EAAY,EAAK,CAAS,EACnC,EAAS,EACb,OACI,EAyBE,EAzBF,CAAwB,KAAK,WAA7B,SAyBE,CAxBE,EAAoC,EAApC,CAAM,MAAO,EAAM,OAAnB,SAA4B,EAAQ,EACnC,EAAK,IAAI,CAAC,IAAQ,CACf,IAAM,EAAM,OAAO,KAAM,IACzB,GAAU,CAAC,GAAG,EAAI,IAAI,EAAE,OACxB,IAAM,EACF,IAAW,GAAO,CAAC,GAAG,EAAI,IAAI,EAAE,IAAI,IAAM,GAAG,EAAE,KAAK,EAAE,EAAI,EAAI,KAGlE,GAAI,EAAI,MACJ,OACI,EAEE,EAFF,CAAgB,QAAO,GAAvB,SACK,GADM,CAET,EAGV,GAAI,EAAI,SACJ,OACI,EAEE,EAFF,CAAgB,gBAAiB,EAAM,UAAvC,SACK,GADM,CAET,EAGV,OAAO,EAAwB,EAAxB,UAAiB,GAAN,CAAa,EAClC,IAxBM,OAAO,GAyBhB,EAET,EACA,EAAc,EACX,EAEE,EAFF,CAAM,SAAQ,GAAC,KAAK,WAApB,SAEE,CADG,EADL,KACY,EADZ,QAC8B,IAAgB,EAAI,GAAK,IADvD,UAEE,EACF,MACN",
|
|
9
|
+
"debugId": "4705CB7CB5B170E964756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{o,l,F,LA,b,I,yA,ee,R,Ft,Lr,mA,SA,W,Ee}from"./index-a0h0p20f.js";var it="dispach",ot="Dispach",at=1;function G(e,t){return{slug:e,name:t,envPrefix:`${e.toUpperCase()}_`,stateDir:`.${e}`,apiVersion:`${e}/v${at}`,packageScope:`@${e}`}}var M=G(it,ot),C=`${M.envPrefix}BRAND`,fe=/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;function me(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function pe(e){if(e===void 0)return M;let t=e.trim();if(t==="")throw Error(`${C} is set but empty. hint: unset ${C} entirely to use the default brand — an empty value `+'is treated as a mistake rather than as "no override", because a declared-but-unset variable is usually a container passing through a name it never assigned.');if(!fe.test(t))throw Error(`${C}="${t}" is not a usable brand slug. hint: the slug becomes an env var prefix, a dot-directory, an npm scope, and the `+"manifest apiVersion, so it must be lowercase alphanumeric with inner hyphens — "+"e.g. acme or acme-run.");if(t===M.slug)return M;return G(t,me(t))}var be=pe(process.env[C]);function dt(e,t){let n=Array.from({length:t.length+1},(s,r)=>r);for(let s=1;s<=e.length;s+=1){let r=[s];for(let i=1;i<=t.length;i+=1){let a=(n[i-1]??0)+(e[s-1]===t[i-1]?0:1),d=(r[i-1]??0)+1,u=(n[i]??0)+1;r.push(Math.min(a,d,u))}n=r}return n[t.length]??Math.max(e.length,t.length)}function lt(e,t){let n,s=Number.POSITIVE_INFINITY;for(let r of t){let i=dt(e,r);if(i<s)s=i,n=r}return n!==void 0&&s<=Math.max(2,Math.floor(e.length/3))?n:void 0}var ge=Symbol.for("dispach.HarnessError");function de(e){return typeof e==="object"&&e!==null&&ge in e}class Be extends Error{static ERROR_NAME="HarnessError";code;hint;field;details;constructor(e){super(e.message,e.cause===void 0?void 0:{cause:e.cause});this.name=new.target.ERROR_NAME??"HarnessError",this[ge]=!0,this.code=e.code,this.hint=e.hint,this.field=e.field,this.details=e.details??[]}toDetail(){return this.field===void 0?{code:this.code,message:this.message,hint:this.hint}:{code:this.code,message:this.message,hint:this.hint,field:this.field}}format(){let e=[`${this.code}: ${this.message}`];if(this.field!==void 0)e.push(` field: ${this.field}`);if(e.push(` hint: ${this.hint}`),this.details.length===1)return e.join(`
|
|
3
|
+
`);for(let t of this.details){if(e.push(""),e.push(` ${t.code}: ${t.message}`),t.field!==void 0)e.push(` field: ${t.field}`);e.push(` hint: ${t.hint}`)}return e.join(`
|
|
4
|
+
`)}}class _ extends Be{static ERROR_NAME="ConfigError"}class O extends Be{static ERROR_NAME="ToolError"}function ye(e,t){return new _({code:"tools_provider_alias_conflict",message:`The manifest sets tools.providers (${e.join(", ")}) and also the deprecated tools.provider${t===void 0?"Config":` (${t})`}.`,hint:`Keep tools.providers and delete the other two. Merging them would give the scalar a position in the map that nobody wrote, and provider order decides which one wins a slug collision${t===void 0?"":` — move ${t}'s settings into tools.providers.${t}`}.`,field:"tools.provider"})}function we(e,t){return new O({code:"workspace_not_editable",message:`${e} is declared editable: ${t}, so it cannot be written to.`,hint:"Point the write at a volatile file whose frontmatter allows it (editable: append or replace), or change that file's frontmatter. Read-only identity is deliberate — it is the most effective known mitigation for persona drift, so this refuses rather than silently doing nothing."})}function ve(){return new O({code:"artifact_unavailable",message:"This runtime has no artifact store, so a compacted observation cannot be read back.",hint:"artifact_read only works inside a session backed by a store. If you are seeing a compaction pointer without one, the pointer was written by a different process — report the text of the pointer rather than guessing at what it replaced."})}function ke(e){return new O({code:"artifact_not_found",message:`No compacted observation is stored under ${JSON.stringify(e)} in this conversation.`,hint:"Copy the id exactly from the pointer in the conversation — it is not guessable and it is scoped to this conversation. If the pointer came from a session you have since switched away from, the observation is not reachable from here."})}class So{runtimeId;#n=new Map;#e=new Map;#t=0;#s;#r;constructor(e){this.runtimeId=e.runtimeId,this.#r=e.now??(()=>new Date().toISOString()),this.#s=e.onHandlerError??((t,n)=>{console.error(`event handler threw while handling ${n.type}:`,t)})}on(e,t,n={}){if(e==="*"){let i=this.#e.has(t),a=n.chunks===!0,d=i?this.#e.get(t)??!1:!1;if(this.#e.set(t,a||d),!i&&a)this.#t+=1;else if(i&&a&&!d)this.#t+=1;return()=>{if(!this.#e.has(t))return;if(this.#e.get(t)===!0)this.#t-=1;this.#e.delete(t)}}let s=this.#n.get(e);if(s===void 0)s=new Set,this.#n.set(e,s);let r=!s.has(t);if(s.add(t),r&&e==="model.chunk")this.#t+=1;return()=>{if(s?.delete(t)===!0&&e==="model.chunk")this.#t-=1}}once(e,t,n={}){let s=this.on(e,(r)=>{s(),t(r)},n);return s}next(e,t,n={}){return new Promise((s,r)=>{let i=this.on(e,(d)=>{i(),t?.removeEventListener("abort",a),s(d)},n),a=()=>{i(),r(t?.reason??Error("aborted"))};t?.addEventListener("abort",a,{once:!0})})}get chunkSubscribers(){return this.#t}emit(e,t,n={}){if(e==="model.chunk"&&this.#t===0)return;let s={v:1,ts:this.#r(),runtimeId:this.runtimeId,...n.agentId===void 0?{}:{agentId:n.agentId},...n.sessionKey===void 0?{}:{sessionKey:n.sessionKey},...n.turnId===void 0?{}:{turnId:n.turnId},...n.stepId===void 0?{}:{stepId:n.stepId},type:e,data:t};this.#o(s)}#o(e){let t=e.type==="model.chunk",n=this.#n.get(e.type);if(n!==void 0)for(let s of[...n])this.#i(s,e);for(let[s,r]of[...this.#e]){if(t&&!r)continue;this.#i(s,e)}}#i(e,t){try{e(t)}catch(n){this.#s(n,t)}}}var NA="0.2.0-pilot.1",ct=/^(\d+)\.(\d+)\.(\d+)$/,ut=/^(\d+)(?:\.(\d+))?(?:\.(\d+))?$/;function ht(e){let t=ct.exec(e.trim());if(t===null)return;return{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3])}}function ft(e){let t=/^(\d+\.\d+\.\d+)(?:-[0-9A-Za-z.-]+)?$/.exec(e.trim());return t===null?void 0:ht(t[1]??"")}function mt(e){let t=ut.exec(e.trim());if(t===null)return;let[,n,s,r]=t;return{version:{major:Number(n),minor:Number(s??0),patch:Number(r??0)},specified:r!==void 0?3:s!==void 0?2:1}}function T(e,t){if(e.major!==t.major)return e.major-t.major;if(e.minor!==t.minor)return e.minor-t.minor;return e.patch-t.patch}function pt(e){if(e.major!==0)return{major:e.major+1,minor:0,patch:0};if(e.minor!==0)return{major:0,minor:e.minor+1,patch:0};return{major:0,minor:0,patch:e.patch+1}}function gt(e,t){if(t===1)return{major:e.major+1,minor:0,patch:0};return{major:e.major,minor:e.minor+1,patch:0}}function yt(e,t){if(t==="*"||t==="x"||t==="X")return!0;let n=/^(>=|<=|>|<|=|\^|~)?\s*(.+)$/.exec(t);if(n===null)return;let s=mt(n[2]??"");if(s===void 0)return;let{version:r,specified:i}=s;switch(n[1]){case"^":return T(e,r)>=0&&T(e,pt(r))<0;case"~":return T(e,r)>=0&&T(e,gt(r,i))<0;case">=":return T(e,r)>=0;case"<=":return T(e,r)<=0;case">":return T(e,r)>0;case"<":return T(e,r)<0;default:if(i===3)return T(e,r)===0;if(i===2)return e.major===r.major&&e.minor===r.minor;return e.major===r.major}}function Do(e,t){let n=ft(e);if(n===void 0)return;let s=t.split("||"),r=!1;for(let i of s){let a=i.trim().split(/\s+/).filter((u)=>u!=="");if(a.length===0)return;let d=!0;for(let u of a){let c=yt(n,u);if(c===void 0)return;if(!c)d=!1}if(r=!0,d)return!0}return r?!1:void 0}var wo=200;var wt="What I already know, carried from before this conversation and kept current. "+"Not a transcript — these are standing facts about the person I work for and my own working notes. "+"If they ask what I know or remember about them, this is the answer.";var bt=3.8;function Se(e){if(e==="")return 0;let t=0;for(let n=0;n<e.length;n+=1)if(e.charCodeAt(n)===10)t+=1;return Math.ceil(e.length/bt)+t}var pA=["runtime.ready","store.ready","runtime.stopping","agent.loaded","agent.disposed","agent.warning","plugin.loaded","plugin.slow","approval.requested","approval.resolved","handoff.start","handoff.result","turn.start","context.assembled","context.dropped","context.pressure","compaction.stage","context.reset","phase.changed","model.call","model.chunk","model.retry","model.result","tool.call","tool.result","tool.gated","tool.repair","tools.refreshed","agent.channel.status","agent.channel.error","agent.channel.rejected","delivery.sent","delivery.retry","delivery.failed","delivery.uncertain","runtime.released","schedules.reconciled","schedule.fired","schedule.skipped","schedule.deferred","schedule.error","turn.end","error"],w=(e)=>String.fromCharCode(e),S=w(27),$e=w(7),vt=new RegExp(`${S}\\[[0-?]*[ -/]*[@-~]`,"g"),kt=new RegExp(`${S}\\][\\s\\S]*?(?:${$e}|${S}\\\\|$)`,"g"),Tt=new RegExp(`${S}[P^_X][\\s\\S]*?(?:${S}\\\\|${$e}|$)`,"g"),_t=new RegExp(`${S}[@-Z\\\\-_0-9=><]?`,"g"),Et=new RegExp(`[${w(128)}-${w(159)}]`,"g"),At=new RegExp(`[${w(0)}-${w(8)}${w(11)}${w(12)}${w(14)}-${w(31)}${w(127)}]`,"g");function fA(e){return e.replace(/\r\n/g,`
|
|
5
|
+
`).replace(/\r/g,`
|
|
6
|
+
`).replace(kt,"").replace(Tt,"").replace(vt,"").replace(_t,"").replace(Et,"").replace(At,"")}var St=/\r\n\r\n|\n\n|\r\r/;function Te(e){let t=[],n,s,r;for(let i of e.split(/\r\n|\n|\r/)){if(i===""||i.startsWith(":"))continue;let a=i.indexOf(":"),d=a===-1?i:i.slice(0,a),u=a===-1?"":i.slice(a+1);if(u.startsWith(" "))u=u.slice(1);switch(d){case"data":t.push(u);break;case"event":n=u;break;case"id":s=u;break;case"retry":{let c=Number.parseInt(u,10);if(Number.isFinite(c))r=c;break}default:break}}if(t.length===0&&n===void 0)return;return{...n===void 0?{}:{event:n},data:t.join(`
|
|
7
|
+
`),...s===void 0?{}:{id:s},...r===void 0?{}:{retry:r}}}async function*Oo(e){let t=new TextDecoder,n="";for await(let s of e){n+=typeof s==="string"?s:t.decode(s,{stream:!0});while(!0){let r=St.exec(n);if(r===null)break;let i=n.slice(0,r.index);n=n.slice(r.index+r[0].length);let a=Te(i);if(a!==void 0)yield a}}if(n+=t.decode(),n.trim()!==""){let s=Te(n);if(s!==void 0)yield s}}function bo(){return{push:(e)=>e,endStep:()=>"",end:()=>""}}var Ne="<<<",xe=">>>",D=/^\s*(?:[-*+]\s+|\d+[.)]\s+)?<?\s*action\s*:\s*(.+?)\s*>?\s*$/i,$t=/^\s*(?:[-*+]\s+|\d+[.)]\s+)?([A-Za-z_][\w.-]*?)\s*:\s*(.*)$/,V=/^\s*`{3,}\s*[\w+-]*\s*$/,q=/^\s*end\s*$/i,Nt=/^\s*<\s*action\s*>\s*$/i,_e=/^\s*<\s*\/\s*action\s*>\s*$/i,xt=/^\s*<\/?\s*[A-Za-z_][\w.:-]*\s*\/?\s*>\s*$/;function Y(e){return e.replace(/^[`'"*<]+/,"").replace(/[`'"*>]+$/,"").replace(/[.,;:]+$/,"").trim()}function Ie(e,t,n){let s=e.fields.get(t);if(s===void 0)e.fields.set(t,[n]);else s.push(n)}function Re(e){if(e.block===void 0||e.heredocKey===void 0)return;let t=[...e.heredocLines];if(t[t.length-1]==="")t.pop();Ie(e.block,e.heredocKey,t.join(`
|
|
8
|
+
`)),e.block.wrapped.add(e.heredocKey),e.heredocKey=void 0,e.heredocLines=[]}function A(e){if(Re(e),e.block!==void 0)e.blocks.push(e.block);e.block=void 0,e.openKey=void 0,e.awaitingSlug=!1}function Ae(){return{block:void 0,openKey:void 0,severedKey:void 0,severedPending:void 0,heredocKey:void 0,heredocLines:[],justClosed:!1,awaitingSlug:!1,text:[],blocks:[]}}function It(e,t,n){let s=t.trim();if(e.heredocKey!==void 0){if(s===xe){Re(e);return}if(q.test(s)){A(e),e.justClosed=!0;return}if(D.test(t)){A(e);let a=D.exec(t),d=Y(a?.[1]??"");if(d!=="")e.block={slug:d,fields:new Map,wrapped:new Set,severed:new Set};return}e.heredocLines.push(t);return}let r=D.exec(t);if(r!==null){let a=Y(r[1]??"");if(A(e),a==="")return;e.block={slug:a,fields:new Map,wrapped:new Set,severed:new Set};return}if(Nt.test(t)){A(e),e.awaitingSlug=!0;return}if(e.awaitingSlug){if(s==="")return;if(_e.test(t)){e.awaitingSlug=!1;return}let a=Y(s);if(e.awaitingSlug=!1,a!=="")e.block={slug:a,fields:new Map,wrapped:new Set,severed:new Set};return}if(_e.test(t)){if(e.block!==void 0)A(e),e.justClosed=!0;return}if(xt.test(t))return;if(e.block===void 0){if(V.test(t)&&(e.justClosed||n())){e.justClosed=!1;return}if(q.test(s)&&e.severedPending!==void 0){e.severedPending.block.severed.add(e.severedPending.key),e.severedPending=void 0;return}if(D.test(t))e.severedPending=void 0;if(e.text.push(t),s!=="")e.justClosed=!1;return}if(s===""){if(e.openKey!==void 0)e.severedKey=e.openKey;e.openKey=void 0;return}if(q.test(s)){e.severedKey=void 0,A(e),e.justClosed=!0;return}if(V.test(t))return;let i=$t.exec(t);if(i!==null){let a=(i[1]??"").trim(),d=(i[2]??"").trim();if(e.severedKey=void 0,d===Ne)e.heredocKey=a,e.heredocLines=[],e.openKey=void 0;else Ie(e.block,a,d),e.openKey=a;return}if(e.openKey!==void 0){let a=e.block.fields.get(e.openKey),d=a?.[a.length-1];if(a!==void 0&&d!==void 0)a[a.length-1]=d===""?s:`${d}
|
|
9
|
+
${s}`;return}if(e.severedKey!==void 0)e.severedPending={block:e.block,key:e.severedKey},e.severedKey=void 0;A(e),e.text.push(t)}function Rt(e){if(/^\s*(?:[-*+]|\d+[.)]?)?\s*$/.test(e))return!0;let t=e.replace(/^\s*(?:[-*+]\s+|\d+[.)]\s+)?/,"").toLowerCase(),n=t.startsWith("<")?t.slice(1):t;if("action:".startsWith(n)||n.startsWith("action:"))return!0;if(/^<\/?$/.test(t)||/^<\/?[a-z_][\w.:-]*>?$/.test(t))return!0;return/^`{1,3}[\w+-]*$/.test(t)}function z(e){return e.endsWith("\r")?e.slice(0,-1):e}function Mo(){let e=Ae(),t="",n=0,s,r="",i=!1,a=(h)=>{if(h==="")return"";if(h.trim()==="")return r+=h,"";let f=r+h;if(r="",i)return f;return i=!0,f.replace(/^\s+/,"")},d=(h,f)=>{let p=e.text.length;return It(e,h,()=>f!==void 0&&D.test(f)),e.text.length>p?h:void 0},u=(h,f,p)=>{let g=d(h,f);if(g===void 0)return"";return a(g.slice(p))+a(`
|
|
10
|
+
`)},c=(h)=>{if(s===void 0)return"";let f=s;return s=void 0,u(f,h,0)};return{push(h){let f="";t+=h;let p=t.indexOf(`
|
|
11
|
+
`);while(p!==-1){let y=z(t.slice(0,p));if(t=t.slice(p+1),f+=c(y),e.block===void 0&&V.test(y)&&!e.justClosed)s=y;else f+=u(y,void 0,n);n=0,p=t.indexOf(`
|
|
12
|
+
`)}let g=z(t);if(e.block===void 0&&!e.awaitingSlug&&s===void 0&&!Rt(g))f+=a(g.slice(n)),n=g.length;return f},endStep(){let h=m();return r=`
|
|
13
|
+
|
|
14
|
+
`,e=Ae(),h},end:m};function m(){let h=c(void 0),f=z(t);if(f!==""){let p=d(f,void 0);if(p!==void 0)h+=a(p.slice(n))}return t="",n=0,s=void 0,h}}var $s=`# Tools
|
|
15
|
+
|
|
16
|
+
To use a tool, write an ACTION block. Start each line at the left margin, exactly like this:
|
|
17
|
+
|
|
18
|
+
ACTION: weather_lookup
|
|
19
|
+
city: Lisbon
|
|
20
|
+
units: celsius
|
|
21
|
+
END
|
|
22
|
+
|
|
23
|
+
That block is an example of the shape only. Your own tools are listed below — take the tool name and
|
|
24
|
+
every field name from that list, spelled exactly as it is written there.
|
|
25
|
+
|
|
26
|
+
Rules for a block:
|
|
27
|
+
- One field per line, written as \`name: value\`, where \`name\` is one of that tool's own field names.
|
|
28
|
+
- For a value spanning several lines, open it with \`${Ne}\` and close it with \`${xe}\` alone on its own line.
|
|
29
|
+
- Finish every block with \`END\` alone on its own line.
|
|
30
|
+
- Several blocks are allowed. They run in the order you write them.
|
|
31
|
+
- Use only the tools listed below, only their listed fields, and always give every required field.
|
|
32
|
+
|
|
33
|
+
Anything you write outside a block is shown to the person you are talking to, so keep explanations
|
|
34
|
+
short and keep them out of the block. When no tool fits, simply reply — never invent a tool, and
|
|
35
|
+
never guess a value for a required field you have not been given.`;import{appendFile as Fe,mkdir as En,readFile as An}from"node:fs/promises";import{join as Pe}from"node:path";import{appendFile as je,mkdir as $n,readFile as Nn,writeFile as xn}from"node:fs/promises";import{join as In}from"node:path";import{readFile as Gn,writeFile as qn}from"node:fs/promises";var Ot=`${be.slug}_`,Lt="0123456789abcdefghjkmnpqrstvwxyz",Mt=32;function No(){let e=new Uint8Array(Mt);crypto.getRandomValues(e);let t="";for(let n of e)t+=Lt[n&31]??"0";return`${Ot}${t}`}async function To(e){let t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));return[...new Uint8Array(t)].map((n)=>n.toString(16).padStart(2,"0")).join("")}var Ro=64,Ct=new RegExp("[\\u0000-\\u001f\\u007f]");function fr(e){if(e.trim()==="")return"A key label cannot be empty.";if(e.length>Ro)return`A key label is at most ${Ro} characters; this one is ${e.length}.`;if(Ct.test(e))return"A key label cannot contain control characters, including newlines and tabs.";return}function Dt(e){let t=`${e.channel}:${e.peerId}`;return e.thread===void 0||e.thread===""?t:`${t}:${e.thread}`}var Oe="0123456789abcdefghijklmnopqrstuvwxyz";function Ut(e){let t=new Uint8Array(e);crypto.getRandomValues(t);let n="";for(let s of t)n+=Oe[s%Oe.length];return n}function ae(e,t){return`${e}_${t.toString(36)}${Ut(8)}`}function mn(e=Date.now()){return ae("t",e)}function hr(e=Date.now()){return ae("r",e)}function Qr(e=Date.now()){return ae("k",e)}var Le="phase_set",Ye="*",Me="tag:";function yr(e){let t=Object.keys(e);return t.find((s)=>e[s]?.entry===!0)??t[0]}function Ce(e){return e.toLowerCase().replace(/[\s_.-]+/g,"")}function Pt(e,t){if(e===Ye)return!0;if(e.startsWith(Me)){let n=e.slice(Me.length).toLowerCase();return t.tags.some((s)=>s.toLowerCase()===n)}return Ce(e)===Ce(t.slug)}function jt(e,t){let n=e[t];if(n===void 0)return[Ye];return n.allow.includes(Le)?n.allow:[...n.allow,Le]}function oi(e){return e!==void 0&&Object.keys(e).length>1}function mr(e,t){return Object.keys(e).filter((n)=>jt(e,n).some((s)=>Pt(s,t)))}var TA=["user","agent"];var Wt=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,Ht=/<!--[\s\S]*?-->/g,Xt=/\n{3,}/g;function Bt(e){let t=Wt.exec(e);return t===null||t===void 0?e:e.slice(t[0].length)}function Kt(e){return e.replace(Ht,"").replace(Xt,`
|
|
36
|
+
|
|
37
|
+
`).trim()}var H={static:2000,volatile:3500,reminder:500,total:6000};var k=o().min(1),Gt=I({delimiters:R(["xml","markdown","plain"]).optional(),intensity:R(["emphatic","neutral","soft"]).optional(),examplesIn:R(["system","user"]).optional(),skillsIn:R(["system","user"]).optional()}).strict(),qt=I({nativeTools:F().optional(),strictSchema:F().optional(),thinking:R(["none","anthropic","openai","deepseek"]).optional(),promptCache:R(["none","anthropic","openai"]).optional(),parallelToolCalls:F().optional(),contextWindow:l().int().positive().optional(),maxOutput:l().int().positive().optional(),promptStyle:Gt.optional()}).strict(),X=I({id:o().min(1),baseUrl:o().min(1),apiKeyEnv:o().min(1).optional(),temperature:l().min(0).max(2).optional(),topP:l().min(0).max(1).optional(),maxTokens:l().int().positive().optional(),reasoningEffort:R(["none","minimal","low","medium","high"]).optional(),headers:ee(o(),o()).optional(),streamUsage:F().optional(),capabilities:qt.optional()}).strict(),Yt=I({main:X,selector:X.optional(),compactor:X.optional()}).catchall(X),zt=I({snip:l().default(0.6),micro:l().default(0.7),collapse:l().default(0.8),reset:l().default(0.88),trim:l().default(0.95)}).strict(),Vt=I({static:l().int().positive().default(H.static),volatile:l().int().positive().default(H.volatile),reminder:l().int().positive().default(H.reminder),total:l().int().positive().default(H.total)}).strict(),Jt=I({perRuleSuccess:l().gt(0).lte(1).default(0.9),reliabilityTarget:l().gt(0).lt(1).default(0.8),onExceed:R(["fail","warn"]).default("fail")}).strict(),Zt=I({file:o().min(1),requires:I({contextWindow:o().min(1).optional(),class:R(["frontier","small"]).optional()}).strict().optional(),onUnmet:R(["distill","omit","fail"]).default("distill"),distilled:o().min(1).optional()}).strict(),Qt=I({dir:o().min(1),maxActive:l().int().nonnegative().default(2),budget:l().int().positive().default(600)}).strict(),en=I({window:l().int().positive().optional(),reserveOutput:l().int().positive().default(4096),observationMaxTokens:l().int().positive().default(2000),files:b(o().min(1)).default([]),workspace:o().min(1).default("./workspace"),static:b(o().min(1)).default([]),volatile:b(o().min(1)).default([]),reminder:o().min(1).optional(),budgets:Vt.prefault({}),rules:Jt.prefault({}),soul:Zt.optional(),compactionNotice:F().optional(),thresholds:zt.prefault({})}).strict(),tn=I({max:l().int().positive().default(24),reserveWrite:l().int().nonnegative().default(6)}).strict(),nn=I({onMutate:R(["refuse","confirm","allow"]).default("refuse")}).strict(),sn=I({mode:R(["ask","allow","deny"]).default("allow"),allow:b(o().min(1)).default([]),deny:b(o().min(1)).default([]),onNoApprover:R(["deny","allow"]).default("deny")}).strict(),rn=I({dialect:R(["nlt","native"]).default("nlt"),providers:ee(k,ee(o(),LA())).default({}),provider:k.optional(),providerConfig:ee(o(),LA()).default({}),budget:tn.prefault({}),pinned:b(o().min(1)).default([]),search:I({enabled:F().default(!1)}).strict().prefault({}),local:b(o().min(1)).default([]),untrusted:nn.prefault({}),policy:sn.prefault({})}).strict(),on=I({allow:b(o().min(1)),entry:F().optional()}).strict(),an=I({dir:o().min(1).default("./skills"),maxActive:l().int().nonnegative().default(1),threshold:l().default(0.35)}).strict(),dn=I({retriever:o().min(1).default("fts5"),dir:o().min(1).default("./memory"),maxActive:l().int().nonnegative().default(5),threshold:l().default(0.2),budget:l().int().positive().default(2000),includeHistory:F().default(!0)}).strict(),ln=I({type:k,id:k,allowFrom:b(o().min(1)).optional(),enabled:F().default(!0)}).passthrough(),ze=I({channel:k,to:o().min(1)}).strict(),cn=I({default:k.optional(),targets:ee(o(),ze).default({})}).strict(),se=Lr(()=>I({type:R(["string","number","integer","boolean","array","object"]),description:o().optional(),enum:b(yA([o(),l(),F()])).optional(),items:se.optional(),properties:ee(o(),se).optional(),required:b(o()).optional()})),un=I({id:k,manifest:o().min(1),task:o().min(1),artifact:I({type:Ft("object"),properties:ee(o(),se),required:b(o()).optional()}).strict()}).strict(),hn=I({members:b(un).min(1)}).strict(),Ve=I({id:k,kind:R(["cron","every","at"]),expr:o().min(1),task:o().min(1),deliver:yA([Ft("none"),ze]),session:o().min(1).default("isolated"),role:k.optional(),enabled:F().default(!0),timezone:o().min(1).optional()}).strict(),fn=yA([o().min(1),I({spec:o().min(1),config:ee(o(),LA()).default({})}).strict()]),pn=I({identicalCalls:l().int().min(2).default(3)}).strict(),gn=I({maxSteps:l().int().positive().default(40),noProgress:pn.prefault({}),turnTimeoutMs:l().int().positive().default(1800000),toolTimeoutMs:l().int().positive().default(120000),maxParallelTools:l().int().positive().default(4),maxConcurrentTurns:l().int().positive().optional(),tokens:I({max:l().int().positive(),windowMs:l().int().positive()}).strict().optional()}).strict(),yn=I({enabled:F().default(!1),port:l().int().min(1).max(65535).default(7420),host:o().min(1).default("127.0.0.1"),tokenEnv:o().min(1).default(`${be.envPrefix}API_TOKEN`),allowedOrigins:b(o().min(1)).default([]),allowedHosts:b(o().min(1)).default([])}).strict(),bn=I({apiVersion:o().min(1),id:k,name:o().min(1).optional(),extends:o().min(1).optional(),model:Yt,context:en.prefault({}),tools:rn.prefault({}),phases:ee(o(),on).optional(),skills:an.optional(),knowledge:Qt.optional(),memory:dn.optional(),channels:b(ln).default([]),delivery:cn.optional(),schedules:b(Ve).default([]),team:hn.optional(),plugins:b(fn).default([]),limits:gn.prefault({}),server:yn.prefault({})}).strict(),re=["main","selector","compactor"];function vn(e){return re.includes(e)}function De(e){return Object.keys(e).filter((t)=>!vn(t))}var kn={nativeTools:!1,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:8192,maxOutput:4096},J={nativeTools:!0,strictSchema:!1,thinking:"anthropic",promptCache:"none",parallelToolCalls:!0},Z="Thinking blocks must be replayed with tool results or multi-step reasoning degrades silently. Prompt caching is unavailable on the OpenAI-compatible endpoint; the native Messages API is the only route to it.",Ai=[{pattern:"gpt-4o*",capabilities:{nativeTools:!0,strictSchema:!0,thinking:"none",promptCache:"openai",parallelToolCalls:!0,contextWindow:128000,maxOutput:16384}},{pattern:"gpt-4.1*",capabilities:{nativeTools:!0,strictSchema:!0,thinking:"none",promptCache:"openai",parallelToolCalls:!0,contextWindow:1e6,maxOutput:32768}},{pattern:"gpt-4-turbo*",capabilities:{nativeTools:!0,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!0,contextWindow:128000,maxOutput:4096}},{pattern:"gpt-3.5*",capabilities:{nativeTools:!0,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!0,contextWindow:16385,maxOutput:4096}},{pattern:"gpt-5*",capabilities:{nativeTools:!0,strictSchema:!0,thinking:"openai",promptCache:"openai",parallelToolCalls:!0,contextWindow:200000,maxOutput:32768},note:"Deliberately conservative on window and output. Override if your endpoint serves more."},{pattern:"o1*",capabilities:{nativeTools:!0,strictSchema:!0,thinking:"openai",promptCache:"openai",parallelToolCalls:!1,contextWindow:200000,maxOutput:1e5}},{pattern:"o3*",capabilities:{nativeTools:!0,strictSchema:!0,thinking:"openai",promptCache:"openai",parallelToolCalls:!1,contextWindow:200000,maxOutput:1e5}},{pattern:"o4*",capabilities:{nativeTools:!0,strictSchema:!0,thinking:"openai",promptCache:"openai",parallelToolCalls:!1,contextWindow:200000,maxOutput:1e5}},...["claude-fable-5*","claude-opus-5*","claude-opus-4-8*","claude-opus-4-7*","claude-opus-4-6*","claude-sonnet-5*","claude-sonnet-4-6*"].map((e)=>({pattern:e,capabilities:{...J,contextWindow:1e6,maxOutput:128000},note:Z})),{pattern:"claude-haiku-*",capabilities:{...J,contextWindow:200000,maxOutput:64000},note:Z},{pattern:"claude-*",family:!0,capabilities:{...J,contextWindow:200000,maxOutput:8192},note:Z},{pattern:"gemini*",family:!0,capabilities:{nativeTools:!0,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!0,contextWindow:1e6,maxOutput:8192}},{pattern:"qwen3.5*",capabilities:{nativeTools:!0,strictSchema:!1,thinking:"deepseek",promptCache:"none",parallelToolCalls:!1,contextWindow:32768,maxOutput:8192},note:"Served locally by Ollama, which reports no token usage unless model.<role>.streamUsage is set — token figures come from the estimator until it is. Reasoning is billed to the output budget, so context.reserveOutput must cover reasoning plus the reply.",verified:"2026-08-13 against qwen3.5:9b on localhost:11434/v1"},{pattern:"qwen*",family:!0,capabilities:{nativeTools:!0,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:32768,maxOutput:8192}},{pattern:"llama*",family:!0,capabilities:{nativeTools:!0,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:128000,maxOutput:4096}},{pattern:"mistral*",family:!0,capabilities:{nativeTools:!0,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:32768,maxOutput:8192}},{pattern:"mixtral*",family:!0,capabilities:{nativeTools:!0,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:32768,maxOutput:8192}},{pattern:"deepseek-v4-pro*",capabilities:{nativeTools:!0,strictSchema:!1,thinking:"deepseek",promptCache:"none",parallelToolCalls:!1,contextWindow:393216,maxOutput:393216},note:"Reasoning tokens are billed to the output budget. With max_tokens=16 this model returned empty content and finish_reason=length; context.reserveOutput must cover reasoning plus the reply.",verified:"2026-08-12 against api.deepseek.com/v1"},{pattern:"deepseek-v4-flash*",capabilities:{nativeTools:!0,strictSchema:!1,thinking:"deepseek",promptCache:"none",parallelToolCalls:!1,contextWindow:1048576,maxOutput:393216},verified:"2026-08-12 against api.deepseek.com/v1 (reasoning confirmed). Measured 2026-08-25 by `model probe --window`: contextWindow 1048576 as a ceiling — the endpoint refused a 1048576-token prompt and named that number; maxOutput 393216 from a refusal naming the range [1, 393216]; automatic prompt caching confirmed at 1024 of 1115 prompt tokens with no breakpoints sent, which is why promptCache stays `none` (it describes the runtime's job, not the provider's behaviour)."},{pattern:"deepseek-v4*",family:!0,capabilities:{nativeTools:!0,strictSchema:!1,thinking:"deepseek",promptCache:"none",parallelToolCalls:!1,contextWindow:393216,maxOutput:393216},note:"Family fallback for v4 ids this registry has not seen. Assumes reasoning, because both measured v4 models emit it."},{pattern:"deepseek-reasoner*",capabilities:{nativeTools:!1,strictSchema:!1,thinking:"deepseek",promptCache:"none",parallelToolCalls:!1,contextWindow:65536,maxOutput:8192},note:"Not served by the account this registry was tested against. Numbers are from provider documentation and are deliberately low — override them if your endpoint serves this id."},{pattern:"deepseek-chat*",capabilities:{nativeTools:!0,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!0,contextWindow:65536,maxOutput:8192},note:"Unverified, from provider documentation."},{pattern:"deepseek-r1*",capabilities:{nativeTools:!1,strictSchema:!1,thinking:"deepseek",promptCache:"none",parallelToolCalls:!1,contextWindow:65536,maxOutput:8192},note:"The open-weight name for the reasoner, used by self-hosted and Ollama deployments."},{pattern:"deepseek*",family:!0,capabilities:{nativeTools:!0,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:65536,maxOutput:8192}},{pattern:"gemma*",family:!0,capabilities:{nativeTools:!1,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:8192,maxOutput:4096}},{pattern:"phi*",family:!0,capabilities:{nativeTools:!1,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:16384,maxOutput:4096}},{pattern:"*",capabilities:kn}];var Ue=/^(?:timeout\s+\S+|time|nice(?:\s+-n\s+\S+)?|stdbuf(?:\s+-\S+)*|command|builtin)\s+/i;function Tn(e){let t=e.trim();for(let n=0;n<4&&Ue.test(t);n+=1)t=t.replace(Ue,"").trim();return t}var _n=/\s*(?:&&|\|\||;|\||&|\n)\s*/;function Sr(e){return e.split(_n).map((t)=>Tn(t)).filter((t)=>t!=="")}var Rn=/^(?:[-*+]|\d+[.)])[ \t]+\S/,On=/\*\*(\d{4})-(\d{2})-\d{2}T/;function Ln(e){let t=[],n=-1,s=(r)=>{if(n===-1)return;t.push({start:n,end:r,text:e.slice(n,r).join(`
|
|
38
|
+
`).trimEnd()}),n=-1};for(let r=0;r<e.length;r+=1){let i=e[r]??"";if(Rn.test(i)){s(r),n=r;continue}if(n===-1)continue;if(i.trim()===""||/^[ \t]/.test(i))continue;s(r)}return s(e.length),t}function ie(e){return Se(Kt(Bt(e)))}function Mn(e,t){let n=On.exec(e);if(n!==null)return`${n[1]}-${n[2]}.md`;let s=t.getUTCFullYear(),r=`${t.getUTCMonth()+1}`.padStart(2,"0");return`${s}-${r}.md`}function Cn(e,t){let n=e.split(/\r?\n/),s=Ln(n),r=[],i=s,a=e,d=ie(a);while(d>t&&i.length>1){let u=i[0];if(u===void 0)break;r.push(u),i=i.slice(1),a=Un(n,r),d=ie(a)}if(d<=t)return{evict:r,remaining:a,tokens:d};return{evict:r,remaining:a,tokens:d,shortfall:i.length<=1?`${d} tokens remain against a ${t}-token budget with one note left, so eviction cannot help`:`${d} tokens remain against a ${t}-token budget`}}function Un(e,t){let n=new Set;for(let s of t)for(let r=s.start;r<s.end;r+=1)n.add(r);return e.filter((s,r)=>!n.has(r)).join(`
|
|
39
|
+
`).replace(/\n{3,}/g,`
|
|
40
|
+
|
|
41
|
+
`)}async function Fn(e){let t=e.tags.length===0?"":` _(${e.tags.join(", ")})_`,n=`
|
|
42
|
+
- **${e.now.toISOString()}**${t} ${e.text}
|
|
43
|
+
`;await je(e.path,n,"utf8");let s=await Nn(e.path,"utf8"),r=Cn(s,e.budget);if(r.evict.length===0)return{file:e.name,evicted:0,archives:[],...r.shortfall===void 0?{}:{shortfall:r.shortfall}};let i=new Map;for(let a of r.evict){let d=Mn(a.text,e.now);i.set(d,[...i.get(d)??[],a.text])}await $n(e.archiveDir,{recursive:!0});for(let[a,d]of i)await je(In(e.archiveDir,a),`${d.join(`
|
|
44
|
+
`)}
|
|
45
|
+
`,"utf8");return await xn(e.path,r.remaining,"utf8"),{file:e.name,evicted:r.evict.length,archives:[...i.keys()].sort(),...r.shortfall===void 0?{}:{shortfall:r.shortfall}}}var le="local",We="memory",He="notes.md",Pn={spec:{slug:"now",provider:le,summary:"Reports the current date and time.",whenToUse:"you need today's date or the current time — including to work out what 'tomorrow' or 'in three hours' means",whenNotToUse:"the person already told you the date or time; use theirs rather than replacing it with the clock",mutating:!1,tags:["read","time"],parameters:{type:"object",properties:{timezone:{type:"string",description:"IANA name such as Europe/London. Defaults to UTC."},format:{type:"string",description:"iso for a machine-readable timestamp, human for a readable one",enum:["iso","human"],default:"iso"}}}},handler(e,t){let n=t.now(),s=typeof e.timezone==="string"&&e.timezone!==""?e.timezone:"UTC";if(e.format==="human")return`${new Intl.DateTimeFormat("en-GB",{dateStyle:"full",timeStyle:"short",timeZone:s}).format(n)} (${s})`;if(s==="UTC")return n.toISOString();return`${jn(n,s)} (${s})`}};function jn(e,t){let n=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZoneName:"longOffset"}).formatToParts(e),s=(i)=>n.find((a)=>a.type===i)?.value??"",r=s("timeZoneName").replace("GMT","");return`${s("year")}-${s("month")}-${s("day")}T${s("hour")}:${s("minute")}:${s("second")}${r===""?"Z":r}`}var Wn={spec:{slug:"memory_write",provider:le,summary:"Saves a short note for later recall.",whenToUse:"the person tells you something durable about themselves or their work that later conversations should know",whenNotToUse:"for anything already in this conversation, for secrets or credentials, or to store your own reasoning",mutating:!0,tags:["write","memory"],parameters:{type:"object",properties:{text:{type:"string",description:"The note, in one or two sentences."},tags:{type:"array",items:{type:"string"},description:"Optional labels."}},required:["text"]}},async handler(e,t){let n=typeof e.text==="string"?e.text.trim():"",s=Array.isArray(e.tags)?e.tags.map((c)=>String(c)):[],r=t.now().toISOString(),i=s.length===0?"":` _(${s.join(", ")})_`,a=`
|
|
46
|
+
- **${r}**${i} ${n}
|
|
47
|
+
`,d=t.writeTarget;if(d?.mode==="refused")throw we(d.name,d.reason??"none");if(d?.path!==void 0){if(d.budget!==void 0&&t.memoryDir!==void 0&&d.eviction==="oldest"){let c=await Fn({path:d.path,name:d.name,budget:d.budget,archiveDir:t.memoryDir,text:n,tags:s,now:t.now()});if(c.shortfall!==void 0)return`Saved to ${c.file}, but it is still over budget: ${c.shortfall}. Ask the person to raise the budget or shorten the file — the agent will not load until they do.`;if(c.evicted===0)return`Saved to ${c.file}.`;return`Saved to ${c.file}. Moved ${c.evicted} older ${c.evicted===1?"note":"notes"} into ${c.archives.join(", ")}, still searchable.`}if(await Fe(d.path,a,"utf8"),d.budget!==void 0){let c=ie(await An(d.path,"utf8"))-d.budget;if(c>0)return`Saved to ${d.name}, which is now ${c} tokens over its ${d.budget}-token budget. The agent will not load until that is fixed: add \`eviction: oldest\` to its frontmatter so older notes move to the memory directory, or raise the budget.`}return`Saved to ${d.name}.`}let u=Pe(t.dir,We);return await En(u,{recursive:!0}),await Fe(Pe(u,He),a,"utf8"),`Saved to ${We}/${He}.`}},Hn=1200,Xn=Hn*3,Bn={spec:{slug:"artifact_read",provider:le,summary:"Reads back a tool result that compaction replaced with a pointer.",whenToUse:"a compaction marker in this conversation names an id, and you need the tool result it replaced",whenNotToUse:"for anything still written out in the conversation, or to explore — every id comes from a marker, so there is nothing to browse",mutating:!1,tags:["read","context"],parameters:{type:"object",properties:{id:{type:"string",description:"The id printed inside the compaction marker, copied character for character."},from:{type:"integer",description:"Character offset to continue from. Omit for the beginning; a truncated reply says the number to pass."}},required:["id"]}},async handler(e,t){let n=typeof e.id==="string"?e.id.trim():"",s=typeof e.from==="number"&&e.from>0?Math.floor(e.from):0;if(t.readArtifact===void 0)throw ve();let r=await t.readArtifact(n);if(r===void 0)throw ke(n);let i=r.slug===void 0?"observation":`${r.slug} observation`,a=r.content.slice(s,s+Xn),d=s+a.length,u=`Compacted ${i}, ${r.tokens} tokens${s===0?"":`, from character ${s}`}:`;if(d>=r.content.length)return`${u}
|
|
48
|
+
${a}`;return`${u}
|
|
49
|
+
${a}
|
|
50
|
+
|
|
51
|
+
[cut here — ${r.content.length-d} characters remain; continue with artifact_read(id, from: ${d})]`}};var Kn=[Pn,Wn,Bn],Ii=Kn.map((e)=>e.spec.slug);function Yn(e){let t=e.providers??{},n=Object.keys(t),s=e.provider,r=e.providerConfig??{};if(n.length>0&&(s!==void 0||Object.keys(r).length>0))throw ye(n,s);if(s!==void 0)return{selections:[{id:s,config:r,legacy:!0}],warnings:[{code:"tools_provider_deprecated",message:`tools.provider is deprecated; "${s}" was loaded as tools.providers.${s}.`,hint:`Rewrite it as:
|
|
52
|
+
tools:
|
|
53
|
+
providers:
|
|
54
|
+
${s}: { … the contents of providerConfig … }
|
|
55
|
+
The scalar permits exactly one provider, which is why an agent could not have the shell and the web at the same time. It still works and will keep working for now; nothing about the resolved catalogue changes.`,field:"tools.provider"}]};let i=n.map((a)=>({id:a,config:t[a]??{},legacy:!1}));if(Object.keys(r).length>0)return{selections:i,warnings:[{code:"tools_provider_config_orphaned",message:`tools.providerConfig has ${Object.keys(r).length} setting(s) and no tools.provider names a provider to apply them to, so they do nothing.`,hint:"Move them into the matching tools.providers.<id> block and delete tools.providerConfig. Reported rather than ignored: a configuration that looks applied and is not is worse than one that fails.",field:"tools.providerConfig"}]};return{selections:i,warnings:[]}}var Xe=new Map;function Je(e){let t=Xe.get(e);if(t!==void 0)return t;let n;try{n=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch(s){throw new _({code:"schedule_timezone_unknown",message:`"${e}" is not a timezone this runtime recognises.`,hint:"Use an IANA name such as Asia/Dhaka, Europe/London or America/Sao_Paulo — not an abbreviation like BST and not a UTC offset. Omit the field to use the TZ environment variable, then UTC.",field:"timezone",cause:s})}return Xe.set(e,n),n}function zn(e){Je(e)}function K(e,t){let n=Je(e).formatToParts(new Date(t)),s=(d)=>{let u=n.find((c)=>c.type===d);return u===void 0?0:Number(u.value)},r=s("year"),i=s("month"),a=s("day");return{year:r,month:i,day:a,hour:s("hour"),minute:s("minute"),second:s("second"),weekday:new Date(Date.UTC(r,i-1,a)).getUTCDay()}}function Vn(e,t){return K(e,t)}function Ke(e,t){let n=K(e,t);return Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-(t-t%1000)}function Jn(e,t){let n=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second),s=n-Ke(e,n);s=n-Ke(e,s);let r=K(e,s);if(!(r.year===t.year&&r.month===t.month&&r.day===t.day&&r.hour===t.hour&&r.minute===t.minute&&r.second===t.second))return;let a=s-3600000,d=K(e,a);return d.year===t.year&&d.month===t.month&&d.day===t.day&&d.hour===t.hour&&d.minute===t.minute&&d.second===t.second?a:s}function Zn(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}var Qn=1462,Ze=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],es=["sun","mon","tue","wed","thu","fri","sat"],N={second:{min:0,max:59,label:"second"},minute:{min:0,max:59,label:"minute"},hour:{min:0,max:23,label:"hour"},dayOfMonth:{min:1,max:31,label:"day of month"},month:{min:1,max:12,names:Ze,label:"month"},dayOfWeek:{min:0,max:7,names:es,label:"day of week"}};function E(e,t,n,s){throw new _({code:"schedule_cron_malformed",message:`"${e}" is not a valid cron expression: ${t}`,hint:n,field:s})}function Q(e,t,n,s){let r=t.names?.indexOf(e.toLowerCase());if(r!==void 0&&r!==-1)return r+(t.names===Ze?1:0);if(!/^\d+$/.test(e))E(n,`"${e}" is not a ${t.label}.`,t.names===void 0?`The ${t.label} field takes numbers ${t.min}-${t.max}, ranges, steps and comma lists.`:`The ${t.label} field takes ${t.min}-${t.max} or a name (${t.names.slice(0,3).join(", ")}…).`,s);let i=Number(e);if(i<t.min||i>t.max)E(n,`${i} is outside the ${t.label} range ${t.min}-${t.max}.`,`Check the field order: ${t.label==="second"?"second minute hour day-of-month month day-of-week":"minute hour day-of-month month day-of-week"}.`,s);return i}function x(e,t,n,s){let r=new Set,i=!0;for(let a of e.split(",")){let d=a.trim();if(d==="")E(n,"an empty entry in a comma list.","Remove the stray comma.",s);let[u="",c]=d.split("/",2),m=c===void 0?1:Number(c);if(c!==void 0&&(!/^\d+$/.test(c)||m<1))E(n,`"${c}" is not a step.`,"A step is a whole number above zero, as in */15.",s);let h,f;if(u==="*"){if(h=t.min,f=t.max,m===1)i=!1}else if(u.includes("-")){let[p="",g=""]=u.split("-",2);if(h=Q(p,t,n,s),f=Q(g,t,n,s),h>f)E(n,`the range ${u} runs backwards.`,"Write the lower bound first, or use a comma list to wrap around.",s)}else h=Q(u,t,n,s),f=c===void 0?h:t.max;for(let p=h;p<=f;p+=m)r.add(p)}if(r.size===0)E(n,"it matches nothing.","Every field must admit at least one value.",s);return{values:r,restricted:i}}function ts(e,t){let n=e.trim();if(n.startsWith("@"))E(n,"macros are not supported.",'Write the fields out — @daily is "0 0 * * *", @hourly is "0 * * * *", @weekly is "0 0 * * 0". For a plain interval use kind: every with an expression like 24h.',t);let s=n.split(/\s+/).filter((j)=>j!=="");if(s.length!==5&&s.length!==6)E(n,`it has ${s.length} field${s.length===1?"":"s"}, not 5 or 6.`,"Five fields are minute hour day-of-month month day-of-week. A sixth leading field is seconds.",t);let r=s.length===6,[i,a,d,u,c,m]=r?s:["0",...s],h=x(i??"0",N.second,n,t),f=x(a??"",N.minute,n,t),p=x(d??"",N.hour,n,t),g=x(u??"",N.dayOfMonth,n,t),y=x(c??"",N.month,n,t),v=x(m??"",N.dayOfWeek,n,t),he=new Set;for(let j of v.values)he.add(j===7?0:j);return{seconds:h.values,minutes:f.values,hours:p.values,daysOfMonth:g.values,months:y.values,daysOfWeek:he,domRestricted:g.restricted,dowRestricted:v.restricted,source:n}}function ns(e,t,n){let s=e.daysOfMonth.has(t),r=e.daysOfWeek.has(n);if(e.domRestricted&&e.dowRestricted)return s||r;if(e.domRestricted)return s;if(e.dowRestricted)return r;return!0}function Ge(e,t,n,s){let r=new Date(Date.UTC(e,t-1,n+s));return[r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate()]}function ss(e,t,n){return new Date(Date.UTC(e,t-1,n)).getUTCDay()}function U(e,t,n){let s=Vn(n,t+1000),r=new Date(Date.UTC(s.year,s.month-1,s.day+Qn)),[i,a,d]=[s.year,s.month,s.day],u=!0;while(Date.UTC(i,a-1,d)<=r.getTime()){if(!e.months.has(a)){[i,a,d]=a===12?[i+1,1,1]:[i,a+1,1],u=!1;continue}if(!ns(e,d,ss(i,a,d))){[i,a,d]=Ge(i,a,d,1),u=!1;continue}for(let c of[...e.hours].sort((m,h)=>m-h)){if(u&&c<s.hour)continue;for(let m of[...e.minutes].sort((h,f)=>h-f)){if(u&&c===s.hour&&m<s.minute)continue;for(let h of[...e.seconds].sort((f,p)=>f-p)){if(u&&c===s.hour&&m===s.minute&&h<s.second)continue;let f=Jn(n,{year:i,month:a,day:d,hour:c,minute:m,second:h});if(f!==void 0)return f}}}[i,a,d]=Ge(i,a,d,1),u=!1}return}var rs=/^(\d+)(s|m|h|d)$/,is={s:1000,m:60000,h:3600000,d:86400000},os=1000,as=315360000000;function ds(e,t){let n=rs.exec(e.trim());if(n===null)throw new _({code:"schedule_duration_malformed",message:`"${e}" is not a duration.`,hint:"A duration is a whole number and one unit: 90s, 15m, 2h, 7d. There is no combined form — write 90m rather than 1h30m.",field:t});let s=Number(n[1]),r=n[2]??"",i=s*(is[r]??0);if(i<os)throw new _({code:"schedule_duration_too_small",message:`"${e}" is under the one-second minimum.`,hint:"An interval below a second is a busy loop rather than a schedule. If the intent is to run continuously, a schedule is the wrong mechanism.",field:t});if(i>as)throw new _({code:"schedule_duration_too_large",message:`"${e}" is over the ten-year maximum.`,hint:"An interval this long is almost always a unit typo — check whether d was meant where h was written.",field:t});return{ms:i,source:e.trim()}}var ls=315360000000,cs=900000,te=1000;function Qe(e){let t=e.timezone??Zn();zn(t);let n=e.expr.trim();if(e.kind==="cron"){let r=ts(n,e.field);if(U(r,e.now,t)===void 0)throw new _({code:"schedule_cron_unsatisfiable",message:`"${n}" never matches a real date.`,hint:"The expression parses but names a day that does not occur — 30 February, or a weekday-and-date pair that never coincide. Checked over four years, so a leap-year schedule like 0 3 29 2 * is accepted.",field:e.field});return{kind:"cron",spec:r,zone:t,source:n}}if(e.kind==="every")return{kind:"every",every:ds(n,e.field),zone:t,source:n};let s=Date.parse(n);if(Number.isNaN(s))throw new _({code:"schedule_at_malformed",message:`"${n}" is not an ISO 8601 instant.`,hint:"Write a full timestamp with an offset, as in 2026-12-25T09:00:00+06:00 or 2026-12-25T03:00:00Z. A bare date has no time of day.",field:e.field});if(s>e.now+ls)throw new _({code:"schedule_at_too_far",message:`${n} is more than ten years away.`,hint:"A one-shot this far out is almost always a year typo. Ten years is the documented bound.",field:e.field});return{kind:"at",at:s,zone:t,source:n}}function us(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t}function hs(e,t){if(t===void 0||t<=0)return 0;let n=Math.min(Math.floor(t/10),cs);return n<=0?0:us(e)%n}function fs(e,t){if(e.kind==="every")return e.every.ms;if(e.kind==="at")return;let n=U(e.spec,t,e.zone);if(n===void 0)return;let s=U(e.spec,n,e.zone);return s===void 0?void 0:s-n}function ms(e,t,n,s,r={}){if(e.kind==="at"){if(r.consumed===!0)return{runAt:void 0,anchor:void 0,missed:0,missedCapped:!1,late:!1};if(e.at<=s)return{runAt:s,anchor:e.at,missed:0,missedCapped:!1,late:!0};return{runAt:e.at,anchor:e.at,missed:0,missedCapped:!1,late:!1}}let i=hs(t,fs(e,n));if(e.kind==="every"){let c=s-n,m=c<=0?0:Math.floor(c/e.every.ms),h=Math.min(m,te),f=m+1,p=n+f*e.every.ms;return{runAt:p+i,anchor:p,missed:h,missedCapped:m>te,late:!1}}let a=n,d=0,u=!1;for(;;){let c=U(e.spec,a,e.zone);if(c===void 0)return{runAt:void 0,anchor:void 0,missed:d,missedCapped:u,late:!1};if(c+i>s)return{runAt:c+i,anchor:c,missed:d,missedCapped:u,late:!1};if(a=c,d+=1,d>=te){u=!0;let m=U(e.spec,s,e.zone);return{runAt:m===void 0?void 0:m+i,anchor:m,missed:d,missedCapped:!0,late:!1}}}}function ps(e,t,n){let s=[],r=Array.isArray(e.schedules)?e.schedules:[],i=new Set((Array.isArray(e.channels)?e.channels:[]).map((c)=>c!==null&&typeof c==="object"&&!Array.isArray(c)?c.id:void 0).filter((c)=>typeof c==="string")),a=new Set([...re,...De(t.model)]),d=new Set,u=new Set;for(let[c,m]of r.entries()){if(m===null||typeof m!=="object"||Array.isArray(m))continue;let h=m,f=typeof h.id==="string"?h.id:`[${c}]`;if(u.has(f))s.push({code:"schedule_id_duplicate",message:`Two schedules share the id "${f}".`,hint:"A schedule id is the key reconciliation matches on and the segment of its session key, so it must be unique within an agent.",field:`schedules[${c}].id`});u.add(f);let p=h.deliver;if(p===void 0)s.push({code:"schedule_missing_delivery",message:`Schedule "${f}" has no delivery target.`,hint:'Set deliver to { channel, to }, or the literal "none" to return results only via the event stream.',field:`schedules[${c}].deliver`});else if(p!=="none"&&typeof p==="object"&&!Array.isArray(p)){let v=p.channel;if(typeof v==="string"&&!i.has(v))s.push({code:"schedule_delivery_channel_unknown",message:`Schedule "${f}" delivers to "${v}", which is not a channel id on this agent.${i.size===0?" The agent declares no channels.":` Declared: ${[...i].join(", ")}.`}`,hint:`A delivery target names a channel's id, not its type. Use deliver: "none" to return results through the event stream instead.`,field:`schedules[${c}].deliver.channel`})}let g=h.role;if(typeof g==="string"){if(d.add(g),!a.has(g))s.push({code:"schedule_role_unknown",message:`Schedule "${f}" names the model role "${g}", which is not declared under model:. Declared: ${[...a].join(", ")}.`,hint:"Add the role under model:, or point the schedule at one of the declared roles. Omit role entirely to use main.",field:`schedules[${c}].role`})}let y=t.schedules[c];if(y!==void 0)try{Qe({id:y.id,kind:y.kind,expr:y.expr,timezone:y.timezone,now:n,field:`schedules[${c}].expr`})}catch(v){if(!(v instanceof Be))throw v;s.push(v.toDetail())}}for(let c of De(t.model)){if(d.has(c))continue;s.push({code:"model_role_unreferenced",message:`model.${c} is declared but no schedule names it, so nothing will ever use it.`,hint:`If "${c}" was meant to be one of ${re.join(", ")}, it is misspelled — and the misspelled one is silently falling back to main. Otherwise point a schedule at it with role: ${c}, or remove it.`,field:`model.${c}`})}return s}function et(e){if(typeof e!=="string")return String(e);let t=/^[A-Za-z0-9_./@~-]+$/.test(e),n=/^[A-Za-z0-9_./]/.test(e);if(!t||!n)return JSON.stringify(e);try{return W(e)===e?e:JSON.stringify(e)}catch{return JSON.stringify(e)}}function P(e){return e.length-e.trimStart().length}function ce(e){let t=e.trim();return t===""||t.startsWith("#")}function qe(e,t,n,s){let r=new RegExp(`^\\s{${n}}${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*:`);for(let i=s;i<e.length;i+=1){let a=e[i]??"";if(ce(a))continue;if(P(a)<n)return;if(P(a)===n&&r.test(a))return i}return}function ne(e,t,n){let s=t;for(let r=t+1;r<e.length;r+=1){let i=e[r]??"";if(ce(i))continue;if(P(i)<=n)break;s=r}return s}function gs(e){let t;for(let n=0;n<e.length;n+=1){let s=e[n];if(t!==void 0){if(s===t)t=void 0;continue}if(s==='"'||s==="'"){t=s;continue}if(s!=="#"||n===0||!/\s/.test(e[n-1]??""))continue;let r=n;while(r>0&&/\s/.test(e[r-1]??""))r-=1;return e.slice(r)}return""}function ue(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function L(e,t,n){let s=" ".repeat(n);if(Array.isArray(t)){if(t.length===0)return[`${s}${e}: []`];return[`${s}${e}:`,...t.flatMap((r)=>ys(r,n+2))]}if(ue(t)){let r=Object.entries(t);if(r.length===0)return[`${s}${e}: {}`];return[`${s}${e}:`,...r.flatMap(([i,a])=>L(i,a,n+2))]}return[`${s}${e}: ${et(t)}`]}function ys(e,t){let n=" ".repeat(t);if(!ue(e))return[`${n}- ${et(e)}`];let s=Object.entries(e);if(s.length===0)return[`${n}- {}`];let r=s.flatMap(([d,u])=>L(d,u,t+2)),[i,...a]=r;return[`${n}- ${(i??"").trimStart()}`,...a]}function ws(e,t,n){if(t.length===0)return;let s=e.split(`
|
|
56
|
+
`),r=0,i=0,a,d=0;for(;d<t.length-1;d+=1){let h=qe(s,t[d]??"",i,r);if(h===void 0)break;a=h,r=h+1;let f=s.slice(h+1).find((p)=>!ce(p)&&P(p)>i);if(f===void 0)return;i=P(f)}if(d<t.length-1){if(a===void 0)return;let h=ne(s,a,i-1)+1;return[...s.slice(0,h),...tt(t.slice(d),n,i),...s.slice(h)].join(`
|
|
57
|
+
`)}let u=t[t.length-1]??"",c=qe(s,u,i,r);if(c!==void 0){let h=s[c]??"",f=Array.isArray(n)||ue(n)?"":gs(h),p=ne(s,c,i),g=L(u,n,i);if(f!=="")g[0]=`${g[0]}${f}`;return[...s.slice(0,c),...g,...s.slice(p+1)].join(`
|
|
58
|
+
`)}if(a===void 0)return;let m=ne(s,a,i-1)+1;return[...s.slice(0,m),...L(u,n,i),...s.slice(m)].join(`
|
|
59
|
+
`)}function tt(e,t,n){let[s,...r]=e;if(s===void 0)return[];if(r.length===0)return L(s,t,n);return[`${" ".repeat(n)}${s}:`,...tt(r,t,n+bs)]}var bs=2;function vs(e,t,n){let s=e.split(`
|
|
60
|
+
`),r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`^#\\s*${r}\\s*:`),a=s.findIndex((c)=>i.test(c));if(a===-1)return;let d=a;while(/^#\s{2,}\S/.test(s[d+1]??""))d+=1;let u=/^#\s*Phase \d/.test(s[a-1]??"")?a-1:a;return[...s.slice(0,u),...L(t,n,0),...s.slice(d+1)].join(`
|
|
61
|
+
`)}function ks(e,t){let n=[...t.path],s=n.join("."),r=nt(Ee(e),n),i=ws(e,n,t.value)??t.fallback?.(e)??(n.length===1?vs(e,n[0]??"",t.value):void 0),a;if(i===void 0){let h=Ee(e);h.setIn(n,t.value),a=String(h)}else a=i;let d=Ee(a);if(d.errors.length>0)throw B(s,`the result is not valid YAML — ${d.errors[0]?.message??"unparseable"}`);let u=bn.safeParse(d.toJS());if(!u.success){let h=u.error.issues[0];throw B(s,`${h?.path.join(".")??s}: ${h?.message??"does not fit the schema"}`)}let m=ps(d.toJS(),u.data,Date.now())[0];if(m!==void 0)throw B(s,`${m.message} ${m.hint}`);try{Yn(u.data.tools)}catch(h){throw B(s,h instanceof Error?h.message:"the providers block does not resolve")}return{next:a,before:r,reflowed:i===void 0,manifest:u.data}}async function Sn(e){let t;try{t=await Gn(e.file,"utf8")}catch(s){throw Ts(e.file,s)}let n=ks(t,e);return await qn(e.file,n.next,"utf8"),{...n,after:e.value}}function Dn(e){let t=e.trim();if(t==="")return"";let n=Ee(t);if(n.errors.length>0)throw new Be({code:"manifest_value_unreadable",message:`Cannot read ${JSON.stringify(e)} as a value.`,hint:'A bare word, a number, true or false, a list as ["a", "b"], or a map as {k: v}. Quote anything containing a colon or a "#".'});return n.toJS()}function Dr(e,t){return nt(Ee(e),t)}function nt(e,t){let n=e.getIn([...t],!1);if(n===void 0||n===null)return;return mA(n)||SA(n)?n.toJS(e):n}function Ts(e,t){return new Be({code:"manifest_edit_unreadable",message:`Cannot read the manifest at ${e} to change it.`,hint:"Check the path and file permissions. Nothing was written.",cause:t})}function B(e,t){return new Be({code:"manifest_edit_invalid",message:`Setting ${e} would make the manifest invalid: ${t}`,hint:"Nothing was written. Check the value's shape — a list is [a, b], a map is {k: v} — against the field this path names."})}var RA=[{path:"tools.local",means:"built-in tools: now, memory_write, artifact_read",agentListed:!0},{path:"tools.providers",means:"where tools come from, as a map — {system: {}} for shell and files, {web: {backend: tavily, apiKeyEnv: TAVILY_API_KEY}} for the internet. Several at once",toAgent:"A writeRoots key inside is refused",agentListed:!0},{path:"tools.pinned",means:"the tools from those providers this agent may call",agentListed:!0},{path:"tools.policy.allow",means:'rules permitting a call: "exec", or narrower like "exec(git *)". Also what lets a mutating tool run in a turn that has read untrusted content',agentListed:!0},{path:"tools.policy.deny",means:"rules refusing a call. Beats any allow rule",toAgent:"Replacing these is refused: it is the one edit whose only purpose is to remove a restriction someone set",agentListed:!0,confirm:"Deny rules are the restrictions that beat every allow rule. Replacing them removes whatever was deliberately put out of reach."},{path:"tools.policy.mode",means:"allow | ask | deny — for calls no rule mentions",agentListed:!0},{path:"tools.untrusted.onMutate",means:"refuse | confirm | allow — what happens when a tool that changes something is asked for in a turn that has read outside content",toAgent:'Cannot be set to "allow"',agentListed:!0,confirm:'Setting this to "allow" turns off the check that stops text from outside the conversation driving a tool that changes things. A fetched page that says "now delete the backups" would be acted on.'},{path:"tools.dialect",means:"nlt | native — how tool calls are written",agentListed:!0},{path:"model.main.id",means:"the model this agent runs on",agentListed:!0},{path:"model.main.temperature",means:"0 to 2",agentListed:!0},{path:"limits.maxSteps",means:"tool calls allowed in one turn",agentListed:!0},{path:"limits.toolTimeoutMs",means:"how long any single tool may take",agentListed:!0},{path:"context.observationMaxTokens",means:"how much of a tool's output reaches the model",agentListed:!0},{path:"channels",means:"how people reach this agent, as a list — [{type: telegram, id: tg, tokenEnv: TELEGRAM_BOT_TOKEN, mode: longpoll}]. The token goes in the .env",toAgent:"The token itself goes in the .env, which only a person can write. allowFrom is refused here: who may talk to you is not yours to decide",agentListed:!0},{path:"delivery",means:"where a reply goes when a turn has no origin — {default: tg}. Names a channel id, not a channel type",agentListed:!0},{path:"schedules",means:'what runs unattended, as a list — [{id, kind: cron|every|at, expr, task, deliver}]. expr is a 5- or 6-field cron, a duration like 15m, or an ISO instant; deliver is {channel, to} or the literal "none"',toAgent:"Only `serve` fires these; under `run` they are validated and listed and no timer starts. deliver.to is the address a reply is *sent* to — on Telegram the numeric chat id, never an @handle, which addresses a channel and not a person. It is the id inbound messages arrive on, so read it off your own session keys (tg:<id>); allowFrom holds handles and confers nothing here. Set role to name a model other than main. The whole list is replaced, so read it first",agentListed:!0},{path:"server.enabled",means:"true | false — serve the HTTP API on 127.0.0.1",toAgent:"host and tokenEnv are refused: binding anywhere reachable is not yours to decide",agentListed:!0},{path:"server.port",means:"port for the HTTP API",agentListed:!0},{path:"channels[].allowFrom",means:"who may talk to this agent through a channel. Empty or absent refuses everyone — a bot that is connected, healthy and answering nobody is almost always this",agentListed:!1,via:"config allow"},{path:"server.host",means:"the address the HTTP API binds. 127.0.0.1 is local only; anything else is reachable from the network",agentListed:!1},{path:"server.tokenEnv",means:"the env var holding the bearer token the API requires. Without it the API is unauthenticated",agentListed:!1},{path:"tools.providers.<id>.writeRoots",means:"the directories a file tool may write to, for that provider. Nothing outside them is writable — and this binds file tools only, never exec, which carries its target inside a shell string",agentListed:!1}];function wr(e){return RA.find((t)=>t.path===e)}var ii=RA.filter((e)=>e.agentListed).map((e)=>e.path),wn=RA.filter((e)=>e.via===void 0&&!e.path.includes("<")&&!e.path.includes("[")).map((e)=>e.path);var st={kind:"public"};function rt(e){let t=e.split(".");if(t.length!==4)return;let n=[];for(let s of t){if(s.length===0||s.length>3||!/^[0-9]+$/.test(s))return;if(s.length>1&&s.startsWith("0"))return;let r=Number(s);if(r>255)return;n.push(r)}return n}function _s(e){let t=e.split("%")[0]??"";if(t==="")return;if(!/^[0-9a-fA-F:.]+$/.test(t))return;let n=t.split("::");if(n.length>2)return;let s=(d)=>{if(d==="")return[];let u=d.split(":"),c=[];for(let m=0;m<u.length;m+=1){let h=u[m]??"";if(h.includes(".")){if(m!==u.length-1)return;let p=rt(h);if(p===void 0)return;c.push(...p);continue}if(h.length===0||h.length>4)return;let f=Number.parseInt(h,16);if(Number.isNaN(f))return;c.push(f>>8&255,f&255)}return c};if(n.length===1){let d=s(t);return d!==void 0&&d.length===16?d:void 0}let r=s(n[0]??""),i=s(n[1]??"");if(r===void 0||i===void 0)return;let a=16-r.length-i.length;if(a<0)return;return[...r,...Array(a).fill(0),...i]}function oe(e){let[t=0,n=0,s=0,r=0]=e;if(t===0)return{kind:"unspecified",range:"0.0.0.0/8"};if(t===127)return{kind:"loopback",range:"127.0.0.0/8"};if(t===10)return{kind:"private",range:"10.0.0.0/8"};if(t===172&&n>=16&&n<=31)return{kind:"private",range:"172.16.0.0/12"};if(t===192&&n===168)return{kind:"private",range:"192.168.0.0/16"};if(t===100&&n>=64&&n<=127)return{kind:"cgnat",range:"100.64.0.0/10"};if(t===169&&n===254)return{kind:"link-local",range:"169.254.0.0/16"};if(t===192&&n===0&&s===0)return{kind:"reserved",range:"192.0.0.0/24"};if(t===192&&n===0&&s===2)return{kind:"reserved",range:"192.0.2.0/24 (TEST-NET-1)"};if(t===198&&(n===18||n===19))return{kind:"reserved",range:"198.18.0.0/15"};if(t===198&&n===51&&s===100)return{kind:"reserved",range:"198.51.100.0/24 (TEST-NET-2)"};if(t===203&&n===0&&s===113)return{kind:"reserved",range:"203.0.113.0/24 (TEST-NET-3)"};if(t>=224&&t<=239)return{kind:"multicast",range:"224.0.0.0/4"};if(t===255&&n===255&&s===255&&r===255)return{kind:"reserved",range:"255.255.255.255"};if(t>=240)return{kind:"reserved",range:"240.0.0.0/4"};return st}function Es(e){if(e.length!==16)return{kind:"reserved",range:"unparseable"};if(e.slice(0,10).every((i)=>i===0)&&e[10]===255&&e[11]===255)return oe(e.slice(12));if(e[0]===0&&e[1]===100&&e[2]===255&&e[3]===155&&e.slice(4,12).every((i)=>i===0))return oe(e.slice(12));if(e.every((i)=>i===0))return{kind:"unspecified",range:"::"};if(e.slice(0,15).every((i)=>i===0)&&e[15]===1)return{kind:"loopback",range:"::1"};let s=e[0]??0,r=e[1]??0;if((s&254)===252)return{kind:"private",range:"fc00::/7"};if(s===254&&(r&192)===128)return{kind:"link-local",range:"fe80::/10"};if(s===255)return{kind:"multicast",range:"ff00::/8"};if(s===32&&r===1&&e[2]===13&&e[3]===184)return{kind:"reserved",range:"2001:db8::/32"};return st}function ko(e){let t=e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e,n=rt(t);if(n!==void 0)return oe(n);let s=_s(t);if(s!==void 0)return Es(s);return}var Fi=["Summarise the conversation above for your own future reference. You are writing notes to yourself, not a report for a person.","","The person's own requests are preserved verbatim below your summary, so do not restate them.","Keep: decisions taken and why, facts established by tool results, and anything still outstanding.","Drop: pleasantries, your own reasoning, and anything already superseded.","Write plain prose under 300 words. No headings, no preamble, no closing summary.","End with one line naming what this summary does not cover, so a later step knows to ask rather than assume."].join(`
|
|
62
|
+
`);var Pi=(()=>{let e=Symbol.for(`${be.slug}.liveRuntimes`),t=globalThis;return t[e]??=new Set,t[e]})();var ri=["agent","model","day","sender"];function Or(){let e=new Uint8Array(24);return crypto.getRandomValues(e),`whsec_${Buffer.from(e).toString("base64")}`}function br(e){return e!=="model.chunk"}var As="schedule";function Mr(e,t,n){if(e.startsWith("shared:")){let s=e.slice(7);if(s!=="")return s}return Dt({channel:As,peerId:t,thread:n})}function Nr(e){let t=Ve.safeParse(e.body);if(!t.success){let d=t.error.issues[0];throw new _({code:"schedule_invalid",message:`Schedule rejected: ${d?.path.join(".")??"body"} ${d?.message??"is invalid"}.`,hint:"A schedule needs id, kind (cron|every|at), expr, task and deliver. See docs/02-SPEC-MANIFEST.md.",...d?.path.length===void 0||d.path.length===0?{}:{field:d.path.join(".")}})}let n=t.data;if(n.deliver!=="none"){if(!e.channelIds.includes(n.deliver.channel))throw new _({code:"schedule_delivery_channel_unknown",message:`Schedule "${n.id}" delivers to "${n.deliver.channel}", which is not a channel id on this agent.${e.channelIds.length===0?" The agent declares no channels.":` Declared: ${e.channelIds.join(", ")}.`}`,hint:`A delivery target names a channel's id, not its type. Use deliver: "none" to return results through the event stream instead.`,field:"deliver.channel"})}if(n.role!==void 0&&!e.roleNames.includes(n.role))throw new _({code:"schedule_role_unknown",message:`Schedule "${n.id}" names the model role "${n.role}", which is not declared under model:. Declared: ${e.roleNames.join(", ")}.`,hint:"Add the role under model: in the manifest, or point the schedule at one of the declared roles. Omit role entirely to use main.",field:"role"});let s=Qe({id:n.id,kind:n.kind,expr:n.expr,timezone:n.timezone,now:e.now,field:"expr"}),r=new Date(e.now).toISOString(),i=ms(s,n.id,e.now,e.now),a=n.deliver==="none"?void 0:n.deliver;return{agentId:e.agentId,id:n.id,kind:n.kind,expr:n.expr,...n.timezone===void 0?{}:{timezone:n.timezone},task:n.task,...a===void 0?{}:{deliverChannel:a.channel,deliverTo:a.to},sessionMode:n.session,...n.role===void 0?{}:{role:n.role},enabled:n.enabled,origin:e.origin,anchorAt:i.anchor===void 0?r:new Date(i.anchor).toISOString(),nextRunAt:i.runAt===void 0?void 0:new Date(i.runAt).toISOString(),sourcePath:"",now:r}}var ji=new Set("a an and are as at be but by do does for from had has have he her his i if in is it its me my not of on or our she that the their them then there they this to was we were what when which who will with you your would could should im ive dont its ill".split(" "));
|
|
63
|
+
export{be,lt,de,Be,_,O,So,NA,Do,wo,pA,fA,Oo,bo,Mo,No,To,Ro,fr,mn,hr,Qr,yr,oi,mr,TA,Sr,Sn,Dn,Dr,RA,wr,ii,wn,ko,ri,Or,br,Mr,Nr};
|
|
64
|
+
|
|
65
|
+
//# debugId=8EBF3468079EC48A64756E2164756E21
|
|
66
|
+
//# sourceMappingURL=index-gwhx69qs.js.map
|