dispach 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +596 -0
- package/dist/App-dxqm39zx.js +11 -0
- package/dist/App-dxqm39zx.js.map +25 -0
- package/dist/ConfigEditor-7v5nebvy.js +6 -0
- package/dist/ConfigEditor-7v5nebvy.js.map +11 -0
- package/dist/KeyProbe-vjhmdpx6.js +5 -0
- package/dist/KeyProbe-vjhmdpx6.js.map +11 -0
- package/dist/Picker-jxaesaxy.js +5 -0
- package/dist/Picker-jxaesaxy.js.map +10 -0
- package/dist/SessionPicker-z2t0p4b5.js +5 -0
- package/dist/SessionPicker-z2t0p4b5.js.map +11 -0
- package/dist/SkillBrowser-yyf2gy0q.js +5 -0
- package/dist/SkillBrowser-yyf2gy0q.js.map +11 -0
- package/dist/WizardApp-12ndxgqv.js +5 -0
- package/dist/WizardApp-12ndxgqv.js.map +13 -0
- package/dist/agents.d.ts +9 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/browse.d.ts +63 -0
- package/dist/browse.d.ts.map +1 -0
- package/dist/client.d.ts +25 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +34 -0
- package/dist/client.js.map +11 -0
- package/dist/components/App.d.ts +28 -0
- package/dist/components/App.d.ts.map +1 -0
- package/dist/components/Banner.d.ts +16 -0
- package/dist/components/Banner.d.ts.map +1 -0
- package/dist/components/Brandmark.d.ts +31 -0
- package/dist/components/Brandmark.d.ts.map +1 -0
- package/dist/components/CheckList.d.ts +38 -0
- package/dist/components/CheckList.d.ts.map +1 -0
- package/dist/components/CommandOutput.d.ts +29 -0
- package/dist/components/CommandOutput.d.ts.map +1 -0
- package/dist/components/ConfigEditor.d.ts +64 -0
- package/dist/components/ConfigEditor.d.ts.map +1 -0
- package/dist/components/HistorySearch.d.ts +23 -0
- package/dist/components/HistorySearch.d.ts.map +1 -0
- package/dist/components/KeyProbe.d.ts +36 -0
- package/dist/components/KeyProbe.d.ts.map +1 -0
- package/dist/components/LineCursor.d.ts +55 -0
- package/dist/components/LineCursor.d.ts.map +1 -0
- package/dist/components/Live.d.ts +17 -0
- package/dist/components/Live.d.ts.map +1 -0
- package/dist/components/Palette.d.ts +21 -0
- package/dist/components/Palette.d.ts.map +1 -0
- package/dist/components/Picker.d.ts +23 -0
- package/dist/components/Picker.d.ts.map +1 -0
- package/dist/components/Prompt.d.ts +20 -0
- package/dist/components/Prompt.d.ts.map +1 -0
- package/dist/components/Screen.d.ts +39 -0
- package/dist/components/Screen.d.ts.map +1 -0
- package/dist/components/SelectList.d.ts +34 -0
- package/dist/components/SelectList.d.ts.map +1 -0
- package/dist/components/SessionPicker.d.ts +26 -0
- package/dist/components/SessionPicker.d.ts.map +1 -0
- package/dist/components/SkillBrowser.d.ts +39 -0
- package/dist/components/SkillBrowser.d.ts.map +1 -0
- package/dist/components/Spinner.d.ts +13 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/StatusBar.d.ts +11 -0
- package/dist/components/StatusBar.d.ts.map +1 -0
- package/dist/components/SummaryCard.d.ts +11 -0
- package/dist/components/SummaryCard.d.ts.map +1 -0
- package/dist/components/TextField.d.ts +39 -0
- package/dist/components/TextField.d.ts.map +1 -0
- package/dist/components/Transcript.d.ts +23 -0
- package/dist/components/Transcript.d.ts.map +1 -0
- package/dist/components/WizardApp.d.ts +18 -0
- package/dist/components/WizardApp.d.ts.map +1 -0
- package/dist/components/WizardFrame.d.ts +19 -0
- package/dist/components/WizardFrame.d.ts.map +1 -0
- package/dist/config-yz0nz51b.js +24 -0
- package/dist/config-yz0nz51b.js.map +10 -0
- package/dist/config.d.ts +71 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/credential-wgt4gvcz.js +19 -0
- package/dist/credential-wgt4gvcz.js.map +10 -0
- package/dist/credential.d.ts +68 -0
- package/dist/credential.d.ts.map +1 -0
- package/dist/daemon.d.ts +47 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/editor.d.ts +81 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/hooks/useElapsed.d.ts +10 -0
- package/dist/hooks/useElapsed.d.ts.map +1 -0
- package/dist/hooks/useTerminalSize.d.ts +14 -0
- package/dist/hooks/useTerminalSize.d.ts.map +1 -0
- package/dist/hooks/useTurn.d.ts +41 -0
- package/dist/hooks/useTurn.d.ts.map +1 -0
- package/dist/index-2cvtz0fy.js +903 -0
- package/dist/index-2cvtz0fy.js.map +194 -0
- package/dist/index-3nwfz9jq.js +12 -0
- package/dist/index-3nwfz9jq.js.map +11 -0
- package/dist/index-6b7qvh1x.js +6 -0
- package/dist/index-6b7qvh1x.js.map +10 -0
- package/dist/index-6z0yr17z.js +12 -0
- package/dist/index-6z0yr17z.js.map +11 -0
- package/dist/index-7da4fqcr.js +7 -0
- package/dist/index-7da4fqcr.js.map +11 -0
- package/dist/index-8bmhd2hj.js +6 -0
- package/dist/index-8bmhd2hj.js.map +10 -0
- package/dist/index-9d011p3q.js +6 -0
- package/dist/index-9d011p3q.js.map +10 -0
- package/dist/index-9f9pp2ef.js +6 -0
- package/dist/index-9f9pp2ef.js.map +10 -0
- package/dist/index-9nsfs0vy.js +6 -0
- package/dist/index-9nsfs0vy.js.map +10 -0
- package/dist/index-9pj1ws0p.js +77 -0
- package/dist/index-9pj1ws0p.js.map +12 -0
- package/dist/index-b5wwtxzk.js +66 -0
- package/dist/index-b5wwtxzk.js.map +12 -0
- package/dist/index-b8zwg8a3.js +6 -0
- package/dist/index-b8zwg8a3.js.map +10 -0
- package/dist/index-bry9bzt3.js +427 -0
- package/dist/index-bry9bzt3.js.map +11 -0
- package/dist/index-bwckzbf8.js +6 -0
- package/dist/index-bwckzbf8.js.map +10 -0
- package/dist/index-cx3vz7sf.js +6 -0
- package/dist/index-cx3vz7sf.js.map +11 -0
- package/dist/index-e8n70sgj.js +6 -0
- package/dist/index-e8n70sgj.js.map +11 -0
- package/dist/index-fvhg0xyd.js +167 -0
- package/dist/index-fvhg0xyd.js.map +19 -0
- package/dist/index-gbnc99j8.js +14 -0
- package/dist/index-gbnc99j8.js.map +13 -0
- package/dist/index-h2yds678.js +7 -0
- package/dist/index-h2yds678.js.map +11 -0
- package/dist/index-j97vttdt.js +10 -0
- package/dist/index-j97vttdt.js.map +10 -0
- package/dist/index-jk0def33.js +6 -0
- package/dist/index-jk0def33.js.map +12 -0
- package/dist/index-jym27m75.js +6 -0
- package/dist/index-jym27m75.js.map +10 -0
- package/dist/index-mgdgx22q.js +10 -0
- package/dist/index-mgdgx22q.js.map +10 -0
- package/dist/index-mrtb5y08.js +6 -0
- package/dist/index-mrtb5y08.js.map +11 -0
- package/dist/index-my5cjx00.js +6 -0
- package/dist/index-my5cjx00.js.map +10 -0
- package/dist/index-qc2vrq9z.js +7 -0
- package/dist/index-qc2vrq9z.js.map +11 -0
- package/dist/index-rqbtm761.js +6 -0
- package/dist/index-rqbtm761.js.map +10 -0
- package/dist/index-rqzg861g.js +6 -0
- package/dist/index-rqzg861g.js.map +10 -0
- package/dist/index-t1xvacym.js +6 -0
- package/dist/index-t1xvacym.js.map +11 -0
- package/dist/index-xgqzk5cq.js +9 -0
- package/dist/index-xgqzk5cq.js.map +12 -0
- package/dist/index-xqyms08r.js +6 -0
- package/dist/index-xqyms08r.js.map +10 -0
- package/dist/index-yr25dnf5.js +6 -0
- package/dist/index-yr25dnf5.js.map +10 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +527 -0
- package/dist/index.js.map +48 -0
- package/dist/init.d.ts +34 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/keymap.d.ts +126 -0
- package/dist/keymap.d.ts.map +1 -0
- package/dist/keys.d.ts +17 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/lib/ambient.d.ts +69 -0
- package/dist/lib/ambient.d.ts.map +1 -0
- package/dist/lib/args.d.ts +33 -0
- package/dist/lib/args.d.ts.map +1 -0
- package/dist/lib/bootstrap.d.ts +84 -0
- package/dist/lib/bootstrap.d.ts.map +1 -0
- package/dist/lib/browse.d.ts +89 -0
- package/dist/lib/browse.d.ts.map +1 -0
- package/dist/lib/browser.d.ts +55 -0
- package/dist/lib/browser.d.ts.map +1 -0
- package/dist/lib/chat-frame.d.ts +156 -0
- package/dist/lib/chat-frame.d.ts.map +1 -0
- package/dist/lib/clipboard.d.ts +32 -0
- package/dist/lib/clipboard.d.ts.map +1 -0
- package/dist/lib/commands.d.ts +26 -0
- package/dist/lib/commands.d.ts.map +1 -0
- package/dist/lib/composer.d.ts +85 -0
- package/dist/lib/composer.d.ts.map +1 -0
- package/dist/lib/config-apply.d.ts +51 -0
- package/dist/lib/config-apply.d.ts.map +1 -0
- package/dist/lib/config-editor.d.ts +113 -0
- package/dist/lib/config-editor.d.ts.map +1 -0
- package/dist/lib/config-env.d.ts +110 -0
- package/dist/lib/config-env.d.ts.map +1 -0
- package/dist/lib/config-rows.d.ts +37 -0
- package/dist/lib/config-rows.d.ts.map +1 -0
- package/dist/lib/config-view.d.ts +133 -0
- package/dist/lib/config-view.d.ts.map +1 -0
- package/dist/lib/confirm.d.ts +86 -0
- package/dist/lib/confirm.d.ts.map +1 -0
- package/dist/lib/const.d.ts +213 -0
- package/dist/lib/const.d.ts.map +1 -0
- package/dist/lib/csi.d.ts +70 -0
- package/dist/lib/csi.d.ts.map +1 -0
- package/dist/lib/curated.d.ts +44 -0
- package/dist/lib/curated.d.ts.map +1 -0
- package/dist/lib/daemon-plan.d.ts +151 -0
- package/dist/lib/daemon-plan.d.ts.map +1 -0
- package/dist/lib/dotenv-edit.d.ts +30 -0
- package/dist/lib/dotenv-edit.d.ts.map +1 -0
- package/dist/lib/env.d.ts +10 -0
- package/dist/lib/env.d.ts.map +1 -0
- package/dist/lib/exit.d.ts +170 -0
- package/dist/lib/exit.d.ts.map +1 -0
- package/dist/lib/help.d.ts +10 -0
- package/dist/lib/help.d.ts.map +1 -0
- package/dist/lib/init-flow.d.ts +539 -0
- package/dist/lib/init-flow.d.ts.map +1 -0
- package/dist/lib/init-skills.d.ts +46 -0
- package/dist/lib/init-skills.d.ts.map +1 -0
- package/dist/lib/keyboard.d.ts +76 -0
- package/dist/lib/keyboard.d.ts.map +1 -0
- package/dist/lib/keys-view.d.ts +57 -0
- package/dist/lib/keys-view.d.ts.map +1 -0
- package/dist/lib/launchd.d.ts +151 -0
- package/dist/lib/launchd.d.ts.map +1 -0
- package/dist/lib/lifecycle.d.ts +126 -0
- package/dist/lib/lifecycle.d.ts.map +1 -0
- package/dist/lib/log-follow.d.ts +71 -0
- package/dist/lib/log-follow.d.ts.map +1 -0
- package/dist/lib/mouse.d.ts +84 -0
- package/dist/lib/mouse.d.ts.map +1 -0
- package/dist/lib/multiselect.d.ts +37 -0
- package/dist/lib/multiselect.d.ts.map +1 -0
- package/dist/lib/origins.d.ts +40 -0
- package/dist/lib/origins.d.ts.map +1 -0
- package/dist/lib/output.d.ts +29 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/palette.d.ts +69 -0
- package/dist/lib/palette.d.ts.map +1 -0
- package/dist/lib/probe.d.ts +158 -0
- package/dist/lib/probe.d.ts.map +1 -0
- package/dist/lib/providers.d.ts +63 -0
- package/dist/lib/providers.d.ts.map +1 -0
- package/dist/lib/provision.d.ts +163 -0
- package/dist/lib/provision.d.ts.map +1 -0
- package/dist/lib/remove-plan.d.ts +120 -0
- package/dist/lib/remove-plan.d.ts.map +1 -0
- package/dist/lib/render.d.ts +78 -0
- package/dist/lib/render.d.ts.map +1 -0
- package/dist/lib/resume.d.ts +69 -0
- package/dist/lib/resume.d.ts.map +1 -0
- package/dist/lib/rows.d.ts +69 -0
- package/dist/lib/rows.d.ts.map +1 -0
- package/dist/lib/sandbox.d.ts +101 -0
- package/dist/lib/sandbox.d.ts.map +1 -0
- package/dist/lib/schema.d.ts +491 -0
- package/dist/lib/schema.d.ts.map +1 -0
- package/dist/lib/screen.d.ts +102 -0
- package/dist/lib/screen.d.ts.map +1 -0
- package/dist/lib/scroll.d.ts +64 -0
- package/dist/lib/scroll.d.ts.map +1 -0
- package/dist/lib/select.d.ts +23 -0
- package/dist/lib/select.d.ts.map +1 -0
- package/dist/lib/service-env.d.ts +38 -0
- package/dist/lib/service-env.d.ts.map +1 -0
- package/dist/lib/service.d.ts +102 -0
- package/dist/lib/service.d.ts.map +1 -0
- package/dist/lib/session-commands.d.ts +229 -0
- package/dist/lib/session-commands.d.ts.map +1 -0
- package/dist/lib/session-key.d.ts +55 -0
- package/dist/lib/session-key.d.ts.map +1 -0
- package/dist/lib/sessions-view.d.ts +31 -0
- package/dist/lib/sessions-view.d.ts.map +1 -0
- package/dist/lib/source-cache.d.ts +105 -0
- package/dist/lib/source-cache.d.ts.map +1 -0
- package/dist/lib/source.d.ts +281 -0
- package/dist/lib/source.d.ts.map +1 -0
- package/dist/lib/sources.d.ts +107 -0
- package/dist/lib/sources.d.ts.map +1 -0
- package/dist/lib/spawn.d.ts +56 -0
- package/dist/lib/spawn.d.ts.map +1 -0
- package/dist/lib/stdin-tap.d.ts +41 -0
- package/dist/lib/stdin-tap.d.ts.map +1 -0
- package/dist/lib/subcommand.d.ts +57 -0
- package/dist/lib/subcommand.d.ts.map +1 -0
- package/dist/lib/systemd.d.ts +60 -0
- package/dist/lib/systemd.d.ts.map +1 -0
- package/dist/lib/templates.d.ts +35 -0
- package/dist/lib/templates.d.ts.map +1 -0
- package/dist/lib/terminal.d.ts +98 -0
- package/dist/lib/terminal.d.ts.map +1 -0
- package/dist/lib/text-selection.d.ts +75 -0
- package/dist/lib/text-selection.d.ts.map +1 -0
- package/dist/lib/theme.d.ts +90 -0
- package/dist/lib/theme.d.ts.map +1 -0
- package/dist/lib/types.d.ts +467 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/warnings.d.ts +79 -0
- package/dist/lib/warnings.d.ts.map +1 -0
- package/dist/lib/width.d.ts +39 -0
- package/dist/lib/width.d.ts.map +1 -0
- package/dist/lib/wizard.d.ts +95 -0
- package/dist/lib/wizard.d.ts.map +1 -0
- package/dist/lib/wordmark.d.ts +60 -0
- package/dist/lib/wordmark.d.ts.map +1 -0
- package/dist/lib/wrap.d.ts +74 -0
- package/dist/lib/wrap.d.ts.map +1 -0
- package/dist/memory.d.ts +25 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/model.d.ts +47 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/plugins.d.ts +15 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/remove.d.ts +52 -0
- package/dist/remove.d.ts.map +1 -0
- package/dist/run.d.ts +42 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/schedules.d.ts +41 -0
- package/dist/schedules.d.ts.map +1 -0
- package/dist/serve.d.ts +41 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/sessions.d.ts +13 -0
- package/dist/sessions.d.ts.map +1 -0
- package/dist/skills.d.ts +80 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/soul.d.ts +19 -0
- package/dist/soul.d.ts.map +1 -0
- package/dist/sources.d.ts +32 -0
- package/dist/sources.d.ts.map +1 -0
- package/dist/start.d.ts +26 -0
- package/dist/start.d.ts.map +1 -0
- package/dist/stop.d.ts +58 -0
- package/dist/stop.d.ts.map +1 -0
- package/dist/terminal-setup.d.ts +31 -0
- package/dist/terminal-setup.d.ts.map +1 -0
- package/dist/tools.d.ts +22 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/transcript.d.ts +124 -0
- package/dist/transcript.d.ts.map +1 -0
- package/dist/validate.d.ts +36 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/web-w7r68df1.js +14 -0
- package/dist/web-w7r68df1.js.map +11 -0
- package/dist/web.d.ts +36 -0
- package/dist/web.d.ts.map +1 -0
- package/dist/wire.d.ts +10 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +33 -0
- package/dist/wire.js.map +10 -0
- package/dist/workspace.d.ts +19 -0
- package/dist/workspace.d.ts.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{r,a,k,Fe,h,i,Te,N,g,Nt,$o,_e,$e,F,K}from"./index-2cvtz0fy.js";var at="dispach",dt="Dispach",lt=1;function Y(e,t){return{slug:e,name:t,envPrefix:`${e.toUpperCase()}_`,stateDir:`.${e}`,apiVersion:`${e}/v${lt}`,packageScope:`@${e}`}}var C=Y(at,dt),D=`${C.envPrefix}BRAND`,he=/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;function fe(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function me(e){if(e===void 0)return C;let t=e.trim();if(t==="")throw Error(`${D} is set but empty. hint: unset ${D} 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(!he.test(t))throw Error(`${D}="${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===C.slug)return C;return Y(t,fe(t))}var Q=me(process.env[D]);function ct(e,t){let n=Array.from({length:t.length+1},(s,o)=>o);for(let s=1;s<=e.length;s+=1){let o=[s];for(let d=1;d<=t.length;d+=1){let l=(n[d-1]??0)+(e[s-1]===t[d-1]?0:1),c=(o[d-1]??0)+1,m=(n[d]??0)+1;o.push(Math.min(l,c,m))}n=o}return n[t.length]??Math.max(e.length,t.length)}function bt(e,t){let n,s=Number.POSITIVE_INFINITY;for(let o of t){let d=ct(e,o);if(d<s)s=d,n=o}return n!==void 0&&s<=Math.max(2,Math.floor(e.length/3))?n:void 0}var pe=Symbol.for("dispach.HarnessError");function ke(e){return typeof e==="object"&&e!==null&&pe in e}class j 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[pe]=!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 y extends j{static ERROR_NAME="ConfigError"}class f extends j{static ERROR_NAME="ToolError"}function ge(e,t){return new y({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 ye(e,t){return new f({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 we(){return new f({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 be(e){return new f({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."})}var Bt="0.1.0";var ut="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 ht=3.8;function Ne(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/ht)+t}var Ce=["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"],_=(e)=>String.fromCharCode(e),R=_(27),Ie=_(7),ft=new RegExp(`${R}\\[[0-?]*[ -/]*[@-~]`,"g"),mt=new RegExp(`${R}\\][\\s\\S]*?(?:${Ie}|${R}\\\\|$)`,"g"),pt=new RegExp(`${R}[P^_X][\\s\\S]*?(?:${R}\\\\|${Ie}|$)`,"g"),gt=new RegExp(`${R}[@-Z\\\\-_0-9=><]?`,"g"),yt=new RegExp(`[${_(128)}-${_(159)}]`,"g"),wt=new RegExp(`[${_(0)}-${_(8)}${_(11)}${_(12)}${_(14)}-${_(31)}${_(127)}]`,"g");function Se(e){return e.replace(/\r\n/g,`
|
|
5
|
+
`).replace(/\r/g,`
|
|
6
|
+
`).replace(mt,"").replace(pt,"").replace(ft,"").replace(gt,"").replace(yt,"").replace(wt,"")}var vt=/\r\n\r\n|\n\n|\r\r/;function ve(e){let t=[],n,s,o;for(let d of e.split(/\r\n|\n|\r/)){if(d===""||d.startsWith(":"))continue;let l=d.indexOf(":"),c=l===-1?d:d.slice(0,l),m=l===-1?"":d.slice(l+1);if(m.startsWith(" "))m=m.slice(1);switch(c){case"data":t.push(m);break;case"event":n=m;break;case"id":s=m;break;case"retry":{let u=Number.parseInt(m,10);if(Number.isFinite(u))o=u;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},...o===void 0?{}:{retry:o}}}async function*Cn(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 o=vt.exec(n);if(o===null)break;let d=n.slice(0,o.index);n=n.slice(o.index+o[0].length);let l=ve(d);if(l!==void 0)yield l}}if(n+=t.decode(),n.trim()!==""){let s=ve(n);if(s!==void 0)yield s}}function Pn(){return{push:(e)=>e,endStep:()=>"",end:()=>""}}var Re="<<<",Oe=">>>",H=/^\s*(?:[-*+]\s+|\d+[.)]\s+)?<?\s*action\s*:\s*(.+?)\s*>?\s*$/i,kt=/^\s*(?:[-*+]\s+|\d+[.)]\s+)?([A-Za-z_][\w.-]*?)\s*:\s*(.*)$/,J=/^\s*`{3,}\s*[\w+-]*\s*$/,Ee=/^\s*end\s*$/i,Tt=/^\s*<\s*action\s*>\s*$/i,Ae=/^\s*<\s*\/\s*action\s*>\s*$/i,Et=/^\s*<\/?\s*[A-Za-z_][\w.:-]*\s*\/?\s*>\s*$/;function z(e){return e.replace(/^[`'"*<]+/,"").replace(/[`'"*>]+$/,"").replace(/[.,;:]+$/,"").trim()}function Le(e,t,n){let s=e.fields.get(t);if(s===void 0)e.fields.set(t,[n]);else s.push(n)}function Me(e){if(e.block===void 0||e.heredocKey===void 0)return;let t=[...e.heredocLines];if(t[t.length-1]==="")t.pop();Le(e.block,e.heredocKey,t.join(`
|
|
8
|
+
`)),e.block.wrapped.add(e.heredocKey),e.heredocKey=void 0,e.heredocLines=[]}function I(e){if(Me(e),e.block!==void 0)e.blocks.push(e.block);e.block=void 0,e.openKey=void 0,e.awaitingSlug=!1}function xe(){return{block:void 0,openKey:void 0,heredocKey:void 0,heredocLines:[],justClosed:!1,awaitingSlug:!1,text:[],blocks:[]}}function _t(e,t,n){let s=t.trim();if(e.heredocKey!==void 0){if(s===Oe){Me(e);return}if(Ee.test(s)){I(e),e.justClosed=!0;return}if(H.test(t)){I(e);let l=H.exec(t),c=z(l?.[1]??"");if(c!=="")e.block={slug:c,fields:new Map,wrapped:new Set};return}e.heredocLines.push(t);return}let o=H.exec(t);if(o!==null){let l=z(o[1]??"");if(I(e),l==="")return;e.block={slug:l,fields:new Map,wrapped:new Set};return}if(Tt.test(t)){I(e),e.awaitingSlug=!0;return}if(e.awaitingSlug){if(s==="")return;if(Ae.test(t)){e.awaitingSlug=!1;return}let l=z(s);if(e.awaitingSlug=!1,l!=="")e.block={slug:l,fields:new Map,wrapped:new Set};return}if(Ae.test(t)){if(e.block!==void 0)I(e),e.justClosed=!0;return}if(Et.test(t))return;if(e.block===void 0){if(J.test(t)&&(e.justClosed||n())){e.justClosed=!1;return}if(e.text.push(t),s!=="")e.justClosed=!1;return}if(s===""){e.openKey=void 0;return}if(Ee.test(s)){I(e),e.justClosed=!0;return}if(J.test(t))return;let d=kt.exec(t);if(d!==null){let l=(d[1]??"").trim(),c=(d[2]??"").trim();if(c===Re)e.heredocKey=l,e.heredocLines=[],e.openKey=void 0;else Le(e.block,l,c),e.openKey=l;return}if(e.openKey!==void 0){let l=e.block.fields.get(e.openKey),c=l?.[l.length-1];if(l!==void 0&&c!==void 0)l[l.length-1]=c===""?s:`${c}
|
|
9
|
+
${s}`;return}I(e),e.text.push(t)}function At(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 V(e){return e.endsWith("\r")?e.slice(0,-1):e}function Mn(){let e=xe(),t="",n=0,s,o="",d=!1,l=(p)=>{if(p==="")return"";if(p.trim()==="")return o+=p,"";let w=o+p;if(o="",d)return w;return d=!0,w.replace(/^\s+/,"")},c=(p,w)=>{let b=e.text.length;return _t(e,p,()=>w!==void 0&&H.test(w)),e.text.length>b?p:void 0},m=(p,w,b)=>{let T=c(p,w);if(T===void 0)return"";return l(T.slice(b))+l(`
|
|
10
|
+
`)},u=(p)=>{if(s===void 0)return"";let w=s;return s=void 0,m(w,p,0)};return{push(p){let w="";t+=p;let b=t.indexOf(`
|
|
11
|
+
`);while(b!==-1){let E=V(t.slice(0,b));if(t=t.slice(b+1),w+=u(E),e.block===void 0&&J.test(E)&&!e.justClosed)s=E;else w+=m(E,void 0,n);n=0,b=t.indexOf(`
|
|
12
|
+
`)}let T=V(t);if(e.block===void 0&&!e.awaitingSlug&&s===void 0&&!At(T))w+=l(T.slice(n)),n=T.length;return w},endStep(){let p=v();return o=`
|
|
13
|
+
|
|
14
|
+
`,e=xe(),p},end:v};function v(){let p=u(void 0),w=V(t);if(w!==""){let b=c(w,void 0);if(b!==void 0)p+=l(b.slice(n))}return t="",n=0,s=void 0,p}}var As=`# 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 \`${Re}\` and close it with \`${Oe}\` 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 Be,mkdir as wn,readFile as bn}from"node:fs/promises";import{join as Xe}from"node:path";import{appendFile as Ge,mkdir as vn,readFile as kn,writeFile as Tn}from"node:fs/promises";import{join as En}from"node:path";import{readFile as Xn,writeFile as Gn}from"node:fs/promises";var St=`${Q.slug}_`,xt="0123456789abcdefghjkmnpqrstvwxyz",$t=32;function Ln(){let e=new Uint8Array($t);crypto.getRandomValues(e);let t="";for(let n of e)t+=xt[n&31]??"0";return`${St}${t}`}async function Dn(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 Fn=64,It=new RegExp("[\\u0000-\\u001f\\u007f]");function qr(e){if(e.trim()==="")return"A key label cannot be empty.";if(e.length>Fn)return`A key label is at most ${Fn} characters; this one is ${e.length}.`;if(It.test(e))return"A key label cannot contain control characters, including newlines and tabs.";return}function Rt(e){let t=`${e.channel}:${e.peerId}`;return e.thread===void 0||e.thread===""?t:`${t}:${e.thread}`}var De="0123456789abcdefghijklmnopqrstuvwxyz";function Ot(e){let t=new Uint8Array(e);crypto.getRandomValues(t);let n="";for(let s of t)n+=De[s%De.length];return n}function ae(e,t){return`${e}_${t.toString(36)}${Ot(8)}`}function Kt(e=Date.now()){return ae("t",e)}function Gr(e=Date.now()){return ae("r",e)}function Zr(e=Date.now()){return ae("k",e)}var Ue="phase_set",Qe="*",je="tag:";function Vr(e){let t=Object.keys(e);return t.find((s)=>e[s]?.entry===!0)??t[0]}function We(e){return e.toLowerCase().replace(/[\s_.-]+/g,"")}function Lt(e,t){if(e===Qe)return!0;if(e.startsWith(je)){let n=e.slice(je.length).toLowerCase();return t.tags.some((s)=>s.toLowerCase()===n)}return We(e)===We(t.slug)}function Mt(e,t){let n=e[t];if(n===void 0)return[Qe];return n.allow.includes(Ue)?n.allow:[...n.allow,Ue]}function dr(e){return e!==void 0&&Object.keys(e).length>1}function Yr(e,t){return Object.keys(e).filter((n)=>Mt(e,n).some((s)=>Lt(s,t)))}var Pe=["user","agent"];var Ct=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,Dt=/<!--[\s\S]*?-->/g,Ut=/\n{3,}/g;function Ft(e){let t=Ct.exec(e);return t===null||t===void 0?e:e.slice(t[0].length)}function Pt(e){return e.replace(Dt,"").replace(Ut,`
|
|
36
|
+
|
|
37
|
+
`).trim()}var B={static:2000,volatile:3500,reminder:500,total:6000};var S=r().min(1),jt=i({delimiters:g(["xml","markdown","plain"]).optional(),intensity:g(["emphatic","neutral","soft"]).optional(),examplesIn:g(["system","user"]).optional(),skillsIn:g(["system","user"]).optional()}).strict(),Wt=i({nativeTools:k().optional(),strictSchema:k().optional(),thinking:g(["none","anthropic","openai","deepseek"]).optional(),promptCache:g(["none","anthropic","openai"]).optional(),parallelToolCalls:k().optional(),contextWindow:a().int().positive().optional(),maxOutput:a().int().positive().optional(),promptStyle:jt.optional()}).strict(),X=i({id:r().min(1),baseUrl:r().min(1),apiKeyEnv:r().min(1).optional(),temperature:a().min(0).max(2).optional(),topP:a().min(0).max(1).optional(),maxTokens:a().int().positive().optional(),reasoningEffort:g(["none","minimal","low","medium","high"]).optional(),headers:N(r(),r()).optional(),streamUsage:k().optional(),capabilities:Wt.optional()}).strict(),Ht=i({main:X,selector:X.optional(),compactor:X.optional()}).catchall(X),Xt=i({snip:a().default(0.6),micro:a().default(0.7),collapse:a().default(0.8),reset:a().default(0.88),trim:a().default(0.95)}).strict(),Gt=i({static:a().int().positive().default(B.static),volatile:a().int().positive().default(B.volatile),reminder:a().int().positive().default(B.reminder),total:a().int().positive().default(B.total)}).strict(),qt=i({perRuleSuccess:a().gt(0).lte(1).default(0.9),reliabilityTarget:a().gt(0).lt(1).default(0.8),onExceed:g(["fail","warn"]).default("fail")}).strict(),Yt=i({file:r().min(1),requires:i({contextWindow:r().min(1).optional(),class:g(["frontier","small"]).optional()}).strict().optional(),onUnmet:g(["distill","omit","fail"]).default("distill"),distilled:r().min(1).optional()}).strict(),zt=i({dir:r().min(1),maxActive:a().int().nonnegative().default(2),budget:a().int().positive().default(600)}).strict(),Vt=i({window:a().int().positive().optional(),reserveOutput:a().int().positive().default(4096),observationMaxTokens:a().int().positive().default(2000),files:h(r().min(1)).default([]),workspace:r().min(1).default("./workspace"),static:h(r().min(1)).default([]),volatile:h(r().min(1)).default([]),reminder:r().min(1).optional(),budgets:Gt.prefault({}),rules:qt.prefault({}),soul:Yt.optional(),compactionNotice:k().optional(),thresholds:Xt.prefault({})}).strict(),Jt=i({max:a().int().positive().default(24),reserveWrite:a().int().nonnegative().default(6)}).strict(),Zt=i({onMutate:g(["refuse","confirm","allow"]).default("refuse")}).strict(),Qt=i({mode:g(["ask","allow","deny"]).default("allow"),allow:h(r().min(1)).default([]),deny:h(r().min(1)).default([]),onNoApprover:g(["deny","allow"]).default("deny")}).strict(),en=i({dialect:g(["nlt","native"]).default("nlt"),providers:N(S,N(r(),Fe())).default({}),provider:S.optional(),providerConfig:N(r(),Fe()).default({}),budget:Jt.prefault({}),pinned:h(r().min(1)).default([]),search:i({enabled:k().default(!1)}).strict().prefault({}),local:h(r().min(1)).default([]),untrusted:Zt.prefault({}),policy:Qt.prefault({})}).strict(),tn=i({allow:h(r().min(1)),entry:k().optional()}).strict(),nn=i({dir:r().min(1).default("./skills"),maxActive:a().int().nonnegative().default(1),threshold:a().default(0.35)}).strict(),sn=i({retriever:r().min(1).default("fts5"),dir:r().min(1).default("./memory"),maxActive:a().int().nonnegative().default(5),threshold:a().default(0.2),budget:a().int().positive().default(2000),includeHistory:k().default(!0)}).strict(),rn=i({type:S,id:S,allowFrom:h(r().min(1)).optional(),enabled:k().default(!0)}).passthrough(),et=i({channel:S,to:r().min(1)}).strict(),on=i({default:S.optional(),targets:N(r(),et).default({})}).strict(),re=$o(()=>i({type:g(["string","number","integer","boolean","array","object"]),description:r().optional(),enum:h(Te([r(),a(),k()])).optional(),items:re.optional(),properties:N(r(),re).optional(),required:h(r()).optional()})),an=i({id:S,manifest:r().min(1),task:r().min(1),artifact:i({type:Nt("object"),properties:N(r(),re),required:h(r()).optional()}).strict()}).strict(),dn=i({members:h(an).min(1)}).strict(),tt=i({id:S,kind:g(["cron","every","at"]),expr:r().min(1),task:r().min(1),deliver:Te([Nt("none"),et]),session:r().min(1).default("isolated"),role:S.optional(),enabled:k().default(!0),timezone:r().min(1).optional()}).strict(),ln=Te([r().min(1),i({spec:r().min(1),config:N(r(),Fe()).default({})}).strict()]),cn=i({identicalCalls:a().int().min(2).default(3)}).strict(),un=i({maxSteps:a().int().positive().default(40),noProgress:cn.prefault({}),turnTimeoutMs:a().int().positive().default(1800000),toolTimeoutMs:a().int().positive().default(120000),maxParallelTools:a().int().positive().default(4)}).strict(),hn=i({enabled:k().default(!1),port:a().int().min(1).max(65535).default(7420),host:r().min(1).default("127.0.0.1"),tokenEnv:r().min(1).default(`${Q.envPrefix}API_TOKEN`),allowedOrigins:h(r().min(1)).default([]),allowedHosts:h(r().min(1)).default([])}).strict(),fn=i({apiVersion:r().min(1),id:S,name:r().min(1).optional(),extends:r().min(1).optional(),model:Ht,context:Vt.prefault({}),tools:en.prefault({}),phases:N(r(),tn).optional(),skills:nn.optional(),knowledge:zt.optional(),memory:sn.optional(),channels:h(rn).default([]),delivery:on.optional(),schedules:h(tt).default([]),team:dn.optional(),plugins:h(ln).default([]),limits:un.prefault({}),server:hn.prefault({})}).strict(),oe=["main","selector","compactor"];function mn(e){return oe.includes(e)}function He(e){return Object.keys(e).filter((t)=>!mn(t))}var pn={nativeTools:!1,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:8192,maxOutput:4096},Z={nativeTools:!0,strictSchema:!1,thinking:"anthropic",promptCache:"none",parallelToolCalls:!0},ee="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.",yo=[{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:{...Z,contextWindow:1e6,maxOutput:128000},note:ee})),{pattern:"claude-haiku-*",capabilities:{...Z,contextWindow:200000,maxOutput:64000},note:ee},{pattern:"claude-*",capabilities:{...Z,contextWindow:200000,maxOutput:8192},note:ee},{pattern:"gemini*",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*",capabilities:{nativeTools:!0,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:32768,maxOutput:8192}},{pattern:"llama*",capabilities:{nativeTools:!0,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:128000,maxOutput:4096}},{pattern:"mistral*",capabilities:{nativeTools:!0,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:32768,maxOutput:8192}},{pattern:"mixtral*",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*",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*",capabilities:{nativeTools:!0,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:65536,maxOutput:8192}},{pattern:"gemma*",capabilities:{nativeTools:!1,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:8192,maxOutput:4096}},{pattern:"phi*",capabilities:{nativeTools:!1,strictSchema:!1,thinking:"none",promptCache:"none",parallelToolCalls:!1,contextWindow:16384,maxOutput:4096}},{pattern:"*",capabilities:pn}];var Ke=/^(?:timeout\s+\S+|time|nice(?:\s+-n\s+\S+)?|stdbuf(?:\s+-\S+)*|command|builtin)\s+/i;function gn(e){let t=e.trim();for(let n=0;n<4&&Ke.test(t);n+=1)t=t.replace(Ke,"").trim();return t}var yn=/\s*(?:&&|\|\||;|\||&|\n)\s*/;function Xr(e){return e.split(yn).map((t)=>gn(t)).filter((t)=>t!=="")}var _n=/^(?:[-*+]|\d+[.)])[ \t]+\S/,An=/\*\*(\d{4})-(\d{2})-\d{2}T/;function Sn(e){let t=[],n=-1,s=(o)=>{if(n===-1)return;t.push({start:n,end:o,text:e.slice(n,o).join(`
|
|
38
|
+
`).trimEnd()}),n=-1};for(let o=0;o<e.length;o+=1){let d=e[o]??"";if(_n.test(d)){s(o),n=o;continue}if(n===-1)continue;if(d.trim()===""||/^[ \t]/.test(d))continue;s(o)}return s(e.length),t}function ie(e){return Ne(Pt(Ft(e)))}function xn(e,t){let n=An.exec(e);if(n!==null)return`${n[1]}-${n[2]}.md`;let s=t.getUTCFullYear(),o=`${t.getUTCMonth()+1}`.padStart(2,"0");return`${s}-${o}.md`}function $n(e,t){let n=e.split(/\r?\n/),s=Sn(n),o=[],d=s,l=e,c=ie(l);while(c>t&&d.length>1){let m=d[0];if(m===void 0)break;o.push(m),d=d.slice(1),l=Nn(n,o),c=ie(l)}if(c<=t)return{evict:o,remaining:l,tokens:c};return{evict:o,remaining:l,tokens:c,shortfall:d.length<=1?`${c} tokens remain against a ${t}-token budget with one note left, so eviction cannot help`:`${c} tokens remain against a ${t}-token budget`}}function Nn(e,t){let n=new Set;for(let s of t)for(let o=s.start;o<s.end;o+=1)n.add(o);return e.filter((s,o)=>!n.has(o)).join(`
|
|
39
|
+
`).replace(/\n{3,}/g,`
|
|
40
|
+
|
|
41
|
+
`)}async function In(e){let t=e.tags.length===0?"":` _(${e.tags.join(", ")})_`,n=`
|
|
42
|
+
- **${e.now.toISOString()}**${t} ${e.text}
|
|
43
|
+
`;await Ge(e.path,n,"utf8");let s=await kn(e.path,"utf8"),o=$n(s,e.budget);if(o.evict.length===0)return{file:e.name,evicted:0,archives:[],...o.shortfall===void 0?{}:{shortfall:o.shortfall}};let d=new Map;for(let l of o.evict){let c=xn(l.text,e.now);d.set(c,[...d.get(c)??[],l.text])}await vn(e.archiveDir,{recursive:!0});for(let[l,c]of d)await Ge(En(e.archiveDir,l),`${c.join(`
|
|
44
|
+
`)}
|
|
45
|
+
`,"utf8");return await Tn(e.path,o.remaining,"utf8"),{file:e.name,evicted:o.evict.length,archives:[...d.keys()].sort(),...o.shortfall===void 0?{}:{shortfall:o.shortfall}}}var de="local",qe="memory",Ye="notes.md",Rn={spec:{slug:"now",provider:de,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`${On(n,s)} (${s})`}};function On(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=(d)=>n.find((l)=>l.type===d)?.value??"",o=s("timeZoneName").replace("GMT","");return`${s("year")}-${s("month")}-${s("day")}T${s("hour")}:${s("minute")}:${s("second")}${o===""?"Z":o}`}var jn={spec:{slug:"memory_write",provider:de,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((u)=>String(u)):[],o=t.now().toISOString(),d=s.length===0?"":` _(${s.join(", ")})_`,l=`
|
|
46
|
+
- **${o}**${d} ${n}
|
|
47
|
+
`,c=t.writeTarget;if(c?.mode==="refused")throw ye(c.name,c.reason??"none");if(c?.path!==void 0){if(c.budget!==void 0&&t.memoryDir!==void 0&&c.eviction==="oldest"){let u=await In({path:c.path,name:c.name,budget:c.budget,archiveDir:t.memoryDir,text:n,tags:s,now:t.now()});if(u.shortfall!==void 0)return`Saved to ${u.file}, but it is still over budget: ${u.shortfall}. Ask the person to raise the budget or shorten the file — the agent will not load until they do.`;if(u.evicted===0)return`Saved to ${u.file}.`;return`Saved to ${u.file}. Moved ${u.evicted} older ${u.evicted===1?"note":"notes"} into ${u.archives.join(", ")}, still searchable.`}if(await Be(c.path,l,"utf8"),c.budget!==void 0){let u=ie(await bn(c.path,"utf8"))-c.budget;if(u>0)return`Saved to ${c.name}, which is now ${u} tokens over its ${c.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 ${c.name}.`}let m=Xe(t.dir,qe);return await wn(m,{recursive:!0}),await Be(Xe(m,Ye),l,"utf8"),`Saved to ${qe}/${Ye}.`}},Wn=1200,Hn=Wn*3,Kn={spec:{slug:"artifact_read",provider:de,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 we();let o=await t.readArtifact(n);if(o===void 0)throw be(n);let d=o.slug===void 0?"observation":`${o.slug} observation`,l=o.content.slice(s,s+Hn),c=s+l.length,m=`Compacted ${d}, ${o.tokens} tokens${s===0?"":`, from character ${s}`}:`;if(c>=o.content.length)return`${m}
|
|
48
|
+
${l}`;return`${m}
|
|
49
|
+
${l}
|
|
50
|
+
|
|
51
|
+
[cut here — ${o.content.length-c} characters remain; continue with artifact_read(id, from: ${c})]`}};var Bn=[Rn,jn,Kn],To=Bn.map((e)=>e.spec.slug);function qn(e){let t=e.providers??{},n=Object.keys(t),s=e.provider,o=e.providerConfig??{};if(n.length>0&&(s!==void 0||Object.keys(o).length>0))throw ge(n,s);if(s!==void 0)return{selections:[{id:s,config:o,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 d=n.map((l)=>({id:l,config:t[l]??{},legacy:!1}));if(Object.keys(o).length>0)return{selections:d,warnings:[{code:"tools_provider_config_orphaned",message:`tools.providerConfig has ${Object.keys(o).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:d,warnings:[]}}var ze=new Map;function nt(e){let t=ze.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 y({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 ze.set(e,n),n}function Yn(e){nt(e)}function q(e,t){let n=nt(e).formatToParts(new Date(t)),s=(c)=>{let m=n.find((u)=>u.type===c);return m===void 0?0:Number(m.value)},o=s("year"),d=s("month"),l=s("day");return{year:o,month:d,day:l,hour:s("hour"),minute:s("minute"),second:s("second"),weekday:new Date(Date.UTC(o,d-1,l)).getUTCDay()}}function zn(e,t){return q(e,t)}function Ve(e,t){let n=q(e,t);return Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-(t-t%1000)}function Vn(e,t){let n=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second),s=n-Ve(e,n);s=n-Ve(e,s);let o=q(e,s);if(!(o.year===t.year&&o.month===t.month&&o.day===t.day&&o.hour===t.hour&&o.minute===t.minute&&o.second===t.second))return;let l=s-3600000,c=q(e,l);return c.year===t.year&&c.month===t.month&&c.day===t.day&&c.hour===t.hour&&c.minute===t.minute&&c.second===t.second?l:s}function Jn(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}var Zn=1462,st=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],Qn=["sun","mon","tue","wed","thu","fri","sat"],O={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:st,label:"month"},dayOfWeek:{min:0,max:7,names:Qn,label:"day of week"}};function x(e,t,n,s){throw new y({code:"schedule_cron_malformed",message:`"${e}" is not a valid cron expression: ${t}`,hint:n,field:s})}function te(e,t,n,s){let o=t.names?.indexOf(e.toLowerCase());if(o!==void 0&&o!==-1)return o+(t.names===st?1:0);if(!/^\d+$/.test(e))x(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 d=Number(e);if(d<t.min||d>t.max)x(n,`${d} 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 d}function L(e,t,n,s){let o=new Set,d=!0;for(let l of e.split(",")){let c=l.trim();if(c==="")x(n,"an empty entry in a comma list.","Remove the stray comma.",s);let[m="",u]=c.split("/",2),v=u===void 0?1:Number(u);if(u!==void 0&&(!/^\d+$/.test(u)||v<1))x(n,`"${u}" is not a step.`,"A step is a whole number above zero, as in */15.",s);let p,w;if(m==="*"){if(p=t.min,w=t.max,v===1)d=!1}else if(m.includes("-")){let[b="",T=""]=m.split("-",2);if(p=te(b,t,n,s),w=te(T,t,n,s),p>w)x(n,`the range ${m} runs backwards.`,"Write the lower bound first, or use a comma list to wrap around.",s)}else p=te(m,t,n,s),w=u===void 0?p:t.max;for(let b=p;b<=w;b+=v)o.add(b)}if(o.size===0)x(n,"it matches nothing.","Every field must admit at least one value.",s);return{values:o,restricted:d}}function es(e,t){let n=e.trim();if(n.startsWith("@"))x(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((W)=>W!=="");if(s.length!==5&&s.length!==6)x(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 o=s.length===6,[d,l,c,m,u,v]=o?s:["0",...s],p=L(d??"0",O.second,n,t),w=L(l??"",O.minute,n,t),b=L(c??"",O.hour,n,t),T=L(m??"",O.dayOfMonth,n,t),E=L(u??"",O.month,n,t),A=L(v??"",O.dayOfWeek,n,t),ue=new Set;for(let W of A.values)ue.add(W===7?0:W);return{seconds:p.values,minutes:w.values,hours:b.values,daysOfMonth:T.values,months:E.values,daysOfWeek:ue,domRestricted:T.restricted,dowRestricted:A.restricted,source:n}}function ts(e,t,n){let s=e.daysOfMonth.has(t),o=e.daysOfWeek.has(n);if(e.domRestricted&&e.dowRestricted)return s||o;if(e.domRestricted)return s;if(e.dowRestricted)return o;return!0}function Je(e,t,n,s){let o=new Date(Date.UTC(e,t-1,n+s));return[o.getUTCFullYear(),o.getUTCMonth()+1,o.getUTCDate()]}function ns(e,t,n){return new Date(Date.UTC(e,t-1,n)).getUTCDay()}function U(e,t,n){let s=zn(n,t+1000),o=new Date(Date.UTC(s.year,s.month-1,s.day+Zn)),[d,l,c]=[s.year,s.month,s.day],m=!0;while(Date.UTC(d,l-1,c)<=o.getTime()){if(!e.months.has(l)){[d,l,c]=l===12?[d+1,1,1]:[d,l+1,1],m=!1;continue}if(!ts(e,c,ns(d,l,c))){[d,l,c]=Je(d,l,c,1),m=!1;continue}for(let u of[...e.hours].sort((v,p)=>v-p)){if(m&&u<s.hour)continue;for(let v of[...e.minutes].sort((p,w)=>p-w)){if(m&&u===s.hour&&v<s.minute)continue;for(let p of[...e.seconds].sort((w,b)=>w-b)){if(m&&u===s.hour&&v===s.minute&&p<s.second)continue;let w=Vn(n,{year:d,month:l,day:c,hour:u,minute:v,second:p});if(w!==void 0)return w}}}[d,l,c]=Je(d,l,c,1),m=!1}return}var ss=/^(\d+)(s|m|h|d)$/,rs={s:1000,m:60000,h:3600000,d:86400000},os=1000,is=315360000000;function as(e,t){let n=ss.exec(e.trim());if(n===null)throw new y({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]),o=n[2]??"",d=s*(rs[o]??0);if(d<os)throw new y({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(d>is)throw new y({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:d,source:e.trim()}}var ds=315360000000,ls=900000,ne=1000;function rt(e){let t=e.timezone??Jn();Yn(t);let n=e.expr.trim();if(e.kind==="cron"){let o=es(n,e.field);if(U(o,e.now,t)===void 0)throw new y({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:o,zone:t,source:n}}if(e.kind==="every")return{kind:"every",every:as(n,e.field),zone:t,source:n};let s=Date.parse(n);if(Number.isNaN(s))throw new y({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+ds)throw new y({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 cs(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 us(e,t){if(t===void 0||t<=0)return 0;let n=Math.min(Math.floor(t/10),ls);return n<=0?0:cs(e)%n}function hs(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 fs(e,t,n,s,o={}){if(e.kind==="at"){if(o.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 d=us(t,hs(e,n));if(e.kind==="every"){let u=s-n,v=u<=0?0:Math.floor(u/e.every.ms),p=Math.min(v,ne),w=v+1,b=n+w*e.every.ms;return{runAt:b+d,anchor:b,missed:p,missedCapped:v>ne,late:!1}}let l=n,c=0,m=!1;for(;;){let u=U(e.spec,l,e.zone);if(u===void 0)return{runAt:void 0,anchor:void 0,missed:c,missedCapped:m,late:!1};if(u+d>s)return{runAt:u+d,anchor:u,missed:c,missedCapped:m,late:!1};if(l=u,c+=1,c>=ne){m=!0;let v=U(e.spec,s,e.zone);return{runAt:v===void 0?void 0:v+d,anchor:v,missed:c,missedCapped:!0,late:!1}}}}function ms(e,t,n){let s=[],o=Array.isArray(e.schedules)?e.schedules:[],d=new Set((Array.isArray(e.channels)?e.channels:[]).map((u)=>u!==null&&typeof u==="object"&&!Array.isArray(u)?u.id:void 0).filter((u)=>typeof u==="string")),l=new Set([...oe,...He(t.model)]),c=new Set,m=new Set;for(let[u,v]of o.entries()){if(v===null||typeof v!=="object"||Array.isArray(v))continue;let p=v,w=typeof p.id==="string"?p.id:`[${u}]`;if(m.has(w))s.push({code:"schedule_id_duplicate",message:`Two schedules share the id "${w}".`,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[${u}].id`});m.add(w);let b=p.deliver;if(b===void 0)s.push({code:"schedule_missing_delivery",message:`Schedule "${w}" has no delivery target.`,hint:'Set deliver to { channel, to }, or the literal "none" to return results only via the event stream.',field:`schedules[${u}].deliver`});else if(b!=="none"&&typeof b==="object"&&!Array.isArray(b)){let A=b.channel;if(typeof A==="string"&&!d.has(A))s.push({code:"schedule_delivery_channel_unknown",message:`Schedule "${w}" delivers to "${A}", which is not a channel id on this agent.${d.size===0?" The agent declares no channels.":` Declared: ${[...d].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[${u}].deliver.channel`})}let T=p.role;if(typeof T==="string"){if(c.add(T),!l.has(T))s.push({code:"schedule_role_unknown",message:`Schedule "${w}" names the model role "${T}", which is not declared under model:. Declared: ${[...l].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[${u}].role`})}let E=t.schedules[u];if(E!==void 0)try{rt({id:E.id,kind:E.kind,expr:E.expr,timezone:E.timezone,now:n,field:`schedules[${u}].expr`})}catch(A){if(!(A instanceof j))throw A;s.push(A.toDetail())}}for(let u of He(t.model)){if(c.has(u))continue;s.push({code:"model_role_unreferenced",message:`model.${u} is declared but no schedule names it, so nothing will ever use it.`,hint:`If "${u}" was meant to be one of ${oe.join(", ")}, it is misspelled — and the misspelled one is silently falling back to main. Otherwise point a schedule at it with role: ${u}, or remove it.`,field:`model.${u}`})}return s}function ot(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 F(e)===e?e:JSON.stringify(e)}catch{return JSON.stringify(e)}}function P(e){return e.length-e.trimStart().length}function le(e){let t=e.trim();return t===""||t.startsWith("#")}function Ze(e,t,n,s){let o=new RegExp(`^\\s{${n}}${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*:`);for(let d=s;d<e.length;d+=1){let l=e[d]??"";if(le(l))continue;if(P(l)<n)return;if(P(l)===n&&o.test(l))return d}return}function se(e,t,n){let s=t;for(let o=t+1;o<e.length;o+=1){let d=e[o]??"";if(le(d))continue;if(P(d)<=n)break;s=o}return s}function ps(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 o=n;while(o>0&&/\s/.test(e[o-1]??""))o-=1;return e.slice(o)}return""}function ce(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function M(e,t,n){let s=" ".repeat(n);if(Array.isArray(t)){if(t.length===0)return[`${s}${e}: []`];return[`${s}${e}:`,...t.flatMap((o)=>gs(o,n+2))]}if(ce(t)){let o=Object.entries(t);if(o.length===0)return[`${s}${e}: {}`];return[`${s}${e}:`,...o.flatMap(([d,l])=>M(d,l,n+2))]}return[`${s}${e}: ${ot(t)}`]}function gs(e,t){let n=" ".repeat(t);if(!ce(e))return[`${n}- ${ot(e)}`];let s=Object.entries(e);if(s.length===0)return[`${n}- {}`];let o=s.flatMap(([c,m])=>M(c,m,t+2)),[d,...l]=o;return[`${n}- ${(d??"").trimStart()}`,...l]}function ys(e,t,n){if(t.length===0)return;let s=e.split(`
|
|
56
|
+
`),o=0,d=0,l,c=0;for(;c<t.length-1;c+=1){let p=Ze(s,t[c]??"",d,o);if(p===void 0)break;l=p,o=p+1;let w=s.slice(p+1).find((b)=>!le(b)&&P(b)>d);if(w===void 0)return;d=P(w)}if(c<t.length-1){if(l===void 0)return;let p=se(s,l,d-1)+1;return[...s.slice(0,p),...it(t.slice(c),n,d),...s.slice(p)].join(`
|
|
57
|
+
`)}let m=t[t.length-1]??"",u=Ze(s,m,d,o);if(u!==void 0){let p=s[u]??"",w=Array.isArray(n)||ce(n)?"":ps(p),b=se(s,u,d),T=M(m,n,d);if(w!=="")T[0]=`${T[0]}${w}`;return[...s.slice(0,u),...T,...s.slice(b+1)].join(`
|
|
58
|
+
`)}if(l===void 0)return;let v=se(s,l,d-1)+1;return[...s.slice(0,v),...M(m,n,d),...s.slice(v)].join(`
|
|
59
|
+
`)}function it(e,t,n){let[s,...o]=e;if(s===void 0)return[];if(o.length===0)return M(s,t,n);return[`${" ".repeat(n)}${s}:`,...it(o,t,n+ws)]}var ws=2;function bs(e,t,n){let s=e.split(`
|
|
60
|
+
`),o=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=new RegExp(`^#\\s*${o}\\s*:`),l=s.findIndex((u)=>d.test(u));if(l===-1)return;let c=l;while(/^#\s{2,}\S/.test(s[c+1]??""))c+=1;let m=/^#\s*Phase \d/.test(s[l-1]??"")?l-1:l;return[...s.slice(0,m),...M(t,n,0),...s.slice(c+1)].join(`
|
|
61
|
+
`)}function vs(e,t){let n=[...t.path],s=n.join("."),o=ks(K(e),n),d=ys(e,n,t.value)??t.fallback?.(e)??(n.length===1?bs(e,n[0]??"",t.value):void 0),l;if(d===void 0){let p=K(e);p.setIn(n,t.value),l=String(p)}else l=d;let c=K(l);if(c.errors.length>0)throw G(s,`the result is not valid YAML — ${c.errors[0]?.message??"unparseable"}`);let m=fn.safeParse(c.toJS());if(!m.success){let p=m.error.issues[0];throw G(s,`${p?.path.join(".")??s}: ${p?.message??"does not fit the schema"}`)}let v=ms(c.toJS(),m.data,Date.now())[0];if(v!==void 0)throw G(s,`${v.message} ${v.hint}`);try{qn(m.data.tools)}catch(p){throw G(s,p instanceof Error?p.message:"the providers block does not resolve")}return{next:l,before:o,reflowed:d===void 0,manifest:m.data}}async function Jr(e){let t;try{t=await Xn(e.file,"utf8")}catch(s){throw Ts(e.file,s)}let n=vs(t,e);return await Gn(e.file,n.next,"utf8"),{...n,after:e.value}}function Qr(e){let t=e.trim();if(t==="")return"";let n=K(t);if(n.errors.length>0)throw new j({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 ks(e,t){let n=e.getIn([...t],!1);if(n===void 0||n===null)return;return _e(n)||$e(n)?n.toJS(e):n}function Ts(e,t){return new j({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 G(e,t){return new j({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 Un=[{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}];var cr=Un.filter((e)=>e.agentListed).map((e)=>e.path),No=Un.filter((e)=>e.via===void 0&&!e.path.includes("<")&&!e.path.includes("[")).map((e)=>e.path);var Ro=["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 Es="schedule";function eo(e,t,n){if(e.startsWith("shared:")){let s=e.slice(7);if(s!=="")return s}return Rt({channel:Es,peerId:t,thread:n})}function to(e){let t=tt.safeParse(e.body);if(!t.success){let c=t.error.issues[0];throw new y({code:"schedule_invalid",message:`Schedule rejected: ${c?.path.join(".")??"body"} ${c?.message??"is invalid"}.`,hint:"A schedule needs id, kind (cron|every|at), expr, task and deliver. See docs/02-SPEC-MANIFEST.md.",...c?.path.length===void 0||c.path.length===0?{}:{field:c.path.join(".")}})}let n=t.data;if(n.deliver!=="none"){if(!e.channelIds.includes(n.deliver.channel))throw new y({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 y({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=rt({id:n.id,kind:n.kind,expr:n.expr,timezone:n.timezone,now:e.now,field:"expr"}),o=new Date(e.now).toISOString(),d=fs(s,n.id,e.now,e.now),l=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,...l===void 0?{}:{deliverChannel:l.channel,deliverTo:l.to},sessionMode:n.session,...n.role===void 0?{}:{role:n.role},enabled:n.enabled,origin:e.origin,anchorAt:d.anchor===void 0?o:new Date(d.anchor).toISOString(),nextRunAt:d.runAt===void 0?void 0:new Date(d.runAt).toISOString(),sourcePath:"",now:o}}var Oo=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{Q,bt,ke,j,y,f,Bt,Ce,Se,Cn,Pn,Mn,Ln,Dn,Fn,qr,Kt,Gr,Zr,Vr,dr,Yr,Pe,Xr,Jr,Qr,Un,cr,eo,to};
|
|
64
|
+
|
|
65
|
+
//# debugId=29CAFCBF0507D01E64756E2164756E21
|
|
66
|
+
//# sourceMappingURL=index-b5wwtxzk.js.map
|