howtofixcli 0.7.11 → 0.7.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-credential.js +136 -0
- package/dist/account-credential.test.js +38 -0
- package/dist/activity.js +124 -0
- package/dist/agent-defs.js +237 -0
- package/dist/agent-limiter.js +68 -0
- package/dist/agents.js +554 -0
- package/dist/anim.js +361 -0
- package/dist/args.js +228 -0
- package/dist/at-file.js +28 -0
- package/dist/brand-extension.js +87 -0
- package/dist/brand.js +76 -0
- package/dist/browser.js +58 -0
- package/dist/cache-report.js +139 -0
- package/dist/checkpoint.js +437 -0
- package/dist/claims.js +167 -0
- package/dist/cli-auth.js +142 -0
- package/dist/cli-checkin.js +120 -0
- package/dist/cli-credentials.js +254 -0
- package/dist/clipboard.js +149 -0
- package/dist/collapse.js +129 -0
- package/dist/commands.js +294 -0
- package/dist/compaction-guard.js +81 -0
- package/dist/context-extension.js +17 -0
- package/dist/dcp/commands.js +172 -0
- package/dist/dcp/compress-state.js +139 -0
- package/dist/dcp/compress.js +329 -0
- package/dist/dcp/dcp-extension.js +295 -0
- package/dist/dcp/dedup.js +93 -0
- package/dist/dcp/ids.js +189 -0
- package/dist/dcp/index.js +25 -0
- package/dist/dcp/middle-prune.js +76 -0
- package/dist/dcp/prompts.js +68 -0
- package/dist/dcp/protected-content.js +221 -0
- package/dist/dcp/protected.js +161 -0
- package/dist/dcp/prune.js +418 -0
- package/dist/dcp/state.js +176 -0
- package/dist/device-id.js +90 -0
- package/dist/device-id.test.js +23 -0
- package/dist/errors.js +63 -0
- package/dist/extensions.js +48 -0
- package/dist/fatal.js +35 -0
- package/dist/feed.js +498 -0
- package/dist/fs-atomic.js +54 -0
- package/dist/gateway-errors.js +90 -0
- package/dist/git.js +230 -0
- package/dist/goal-extension.js +88 -0
- package/dist/goal.js +222 -0
- package/dist/hooks-extension.js +176 -0
- package/dist/hooks.js +443 -0
- package/dist/howtofix-account.js +735 -0
- package/dist/hud-line.js +153 -0
- package/dist/hwid.js +130 -0
- package/dist/interrupt.js +60 -0
- package/dist/json-events.js +50 -0
- package/dist/level-style.js +112 -0
- package/dist/loop-guard.js +95 -0
- package/dist/lsp-tools.js +32 -0
- package/dist/lsp.js +429 -0
- package/dist/main.js +540 -94
- package/dist/mcp-config.js +85 -0
- package/dist/mcp-lifecycle.js +147 -0
- package/dist/model-catalog.js +217 -0
- package/dist/model-facts.js +35 -0
- package/dist/model-resolve.js +65 -0
- package/dist/notes.js +78 -0
- package/dist/oauth-login.js +568 -0
- package/dist/paths.js +61 -0
- package/dist/permissions.js +298 -0
- package/dist/plan-mode.js +363 -0
- package/dist/preset-command.js +227 -0
- package/dist/preset-extension.js +35 -0
- package/dist/preset-mcp.js +292 -0
- package/dist/presets.js +727 -0
- package/dist/prompt-files.js +103 -0
- package/dist/prompt-text.js +41 -0
- package/dist/proxy.js +137 -0
- package/dist/quality/ast.js +196 -0
- package/dist/quality/cognitive.js +83 -0
- package/dist/quality/cyclomatic.js +30 -0
- package/dist/quality/halstead.js +83 -0
- package/dist/quality/index.js +18 -0
- package/dist/quality/length.js +3 -0
- package/dist/quality/maintainability.js +15 -0
- package/dist/quality/nesting.js +57 -0
- package/dist/quality/report.js +803 -0
- package/dist/quality/smells.js +67 -0
- package/dist/quality-tool.js +63 -0
- package/dist/read-only-commands.js +597 -0
- package/dist/repo-map.js +292 -0
- package/dist/rtk.js +193 -0
- package/dist/sandbox.js +105 -0
- package/dist/schema.js +214 -0
- package/dist/session-lifecycle.js +19 -0
- package/dist/session-retention.js +111 -0
- package/dist/session.js +447 -0
- package/dist/sessions.js +100 -0
- package/dist/settings.js +148 -0
- package/dist/skills.js +35 -0
- package/dist/slop-tool.js +96 -0
- package/dist/spend-cap.js +43 -0
- package/dist/subagent.js +171 -0
- package/dist/tar.js +146 -0
- package/dist/theme.js +79 -0
- package/dist/thinking.js +45 -0
- package/dist/todo.js +114 -0
- package/dist/tool-loadout.js +97 -0
- package/dist/tool-render.js +769 -0
- package/dist/tools.js +176 -0
- package/dist/ui.js +4778 -0
- package/dist/update.js +551 -0
- package/dist/usage-segment.js +69 -0
- package/dist/web-tools.js +46 -0
- package/dist/web.js +265 -0
- package/dist/welcome.js +179 -0
- package/dist/workflow-engine.js +246 -0
- package/dist/workflow-progress.js +446 -0
- package/dist/workflow-view.js +195 -0
- package/dist/workflow.js +349 -0
- package/package.json +63 -16
- package/dist/chunk-27TRKD65.js +0 -2
- package/dist/chunk-3FYCFLNK.js +0 -1
- package/dist/chunk-56SEAGAQ.js +0 -1
- package/dist/chunk-6FUWMLWO.js +0 -1
- package/dist/chunk-7CHDNTH6.js +0 -1
- package/dist/chunk-ACOMNDUL.js +0 -185
- package/dist/chunk-AGGIYXN7.js +0 -2
- package/dist/chunk-BHVBO4SC.js +0 -1
- package/dist/chunk-C6HY4Q4J.js +0 -5
- package/dist/chunk-CMRKXR6X.js +0 -5
- package/dist/chunk-DMNE4TU6.js +0 -2
- package/dist/chunk-EHLH4G5R.js +0 -1
- package/dist/chunk-FPXVDP32.js +0 -8
- package/dist/chunk-GVTLSEBC.js +0 -2
- package/dist/chunk-GXB7RZHH.js +0 -1
- package/dist/chunk-ILDDDLRC.js +0 -1
- package/dist/chunk-JFYVRWJI.js +0 -2
- package/dist/chunk-K6ZKVFKO.js +0 -34
- package/dist/chunk-MVLCGU3G.js +0 -1
- package/dist/chunk-N345KWWK.js +0 -1
- package/dist/chunk-ORJ2QZBG.js +0 -3
- package/dist/chunk-PCALBZOO.js +0 -2
- package/dist/chunk-QERX2QO6.js +0 -1
- package/dist/chunk-S4TNEP7G.js +0 -109
- package/dist/chunk-T5YJVQXI.js +0 -6
- package/dist/chunk-TSEKPGK4.js +0 -1
- package/dist/chunk-UTYFLLSM.js +0 -1
- package/dist/chunk-V3R4FYTJ.js +0 -1
- package/dist/chunk-V656XVXV.js +0 -8
- package/dist/chunk-VXTUPGAD.js +0 -2
- package/dist/chunk-WKUJ7CFO.js +0 -1
- package/dist/chunk-WOT6VMZA.js +0 -1
- package/dist/chunk-WUPU6LTD.js +0 -4
- package/dist/chunk-WX3V5P7U.js +0 -5
- package/dist/chunk-WXPWYEZK.js +0 -1
package/dist/chunk-AGGIYXN7.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function d(n,t){let e=`${n??""} ${t}`;if(/EACCES|EPERM/.test(e))return"the file or directory is not writable; check permissions and try again";if(/ENOENT/.test(e))return"a file or directory this command needs is missing";if(/ENOSPC/.test(e))return"the disk is full";if(/ECONNREFUSED|ENOTFOUND|EAI_AGAIN|ETIMEDOUT|UND_ERR|fetch failed/i.test(e))return"the network request failed; check the connection and the gateway address";if(/EADDRINUSE/.test(e))return"another process is already using that port";if(/MODULE_NOT_FOUND|ERR_MODULE_NOT_FOUND/.test(e))return"a required file or package is missing; reinstall HowToFix";if(/JSON/i.test(e)&&/parse|unexpected token|end of input/i.test(e))return"a configuration file is not valid JSON";if(/not a git repository/i.test(e))return"run the command inside a project, or pass --cwd"}function c(n){let e=(n instanceof Error?n.message:String(n)).trim()||"unknown error",i=n?.code;return{message:e,hint:d(i,e)}}function u(n,t,e,i=!1){let{message:r,hint:s}=c(e),o=[t?`${n}: ${t}: ${r}`:`${n}: ${r}`];return s&&o.push(` ${s}`),i&&e instanceof Error&&e.stack&&o.push(e.stack),o.join(`
|
|
2
|
-
`)}function f(n,t,e,i){let r=i?.debug??process.env.HOWTOFIX_DEBUG==="1";(i?.write??(a=>console.error(a)))(u(n,t,e,r))}export{c as a,f as b};
|
package/dist/chunk-BHVBO4SC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var r=/no available channel for model\s+([^\s"',)\]]+)/i;function i(t){let e=t??"";if(e.trim())return r.exec(e)?.[1]}function a(t){let e=t??"";if(!e.trim())return;let n=i(e);if(n)return`the gateway has no live channel for ${n} right now \u2014 /model lists the models that answer; pick another.`;if(/\bunknown model\b/i.test(e))return"/connect pulls the current model list from the gateway.";if(/\bcode 11128\b|\billegal api invocation\b/i.test(e))return"the gateway refused the request shape (code 11128) \u2014 /connect re-syncs each model's compatibility flags.";if(/\binsufficient (?:balance|quota|credit)\b|\bexceeded your current quota\b|http\s*402/i.test(e))return"the account is out of credit \u2014 /usage shows what is left.";if(/\bserver error\b|http\s*5\d\d/i.test(e))return"the gateway's channel is failing, not the CLI \u2014 /model lists what your account can reach; pick another.";if(/\brate.?limit|\b429\b/i.test(e))return"the gateway is rate-limiting this token \u2014 wait a moment, then resend the prompt.";if(/\bupstream api error\b/i.test(e))return"the gateway refused the request \u2014 run /connect again to re-sync your models."}export{i as a,a as b};
|
package/dist/chunk-C6HY4Q4J.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
var a="HowToFix",o="0.7.11",n=["You are HowToFix, a coding agent. The user wants the fix, not a tour of the problem.",'NEVER report a check you did not run. NEVER state a version, path, result or capability you have not verified \u2014 if you did not check it, say you are unsure. "Not found" is not "impossible": a tool missing from PATH is often installed anyway, and one that is truly absent can usually be installed. Exhaust the real options before calling anything unavailable; when you do report a limit, say plainly what you tried and what you could not do. Unexercised behaviour is not evidence.',"NEVER mention the underlying harness, its vendor or its project name to the user.","Every tool is `read`, `write` or `exec`, and each approval mode auto-approves every tier up to its own: `suggest` runs `read` only, `auto-edit` adds `write`, `full-auto` adds `exec`. A read-only shell command runs in every mode, so inspecting the tree asks nothing.","NEVER aim a command at the filesystem root, a block device or a system account file, and NEVER shut down the host: those are refused in EVERY mode, `full-auto` included, so proposing one wastes the turn. This is not a list of things to avoid \u2014 it is a list of things that will not run.","Lead with the diagnosis in one or two sentences, then change the code. SHOULD prefer the smallest correct change over a rewrite. Name the file and the reason in a short line; do not narrate tool calls.","Fix the problem that was asked for. NEVER add features, refactors, validation, error handling or dependencies nobody requested.","Something reported broken: reproduce it first, confirm the fix after. Cannot reproduce it? Say so \u2014 NEVER edit code and call it fixed.","Tests describe intended behaviour. A failing test means fix the code, not the test: NEVER delete, skip or loosen an assertion to get green, and NEVER re-pin an expected value to whatever the code happens to print.","Anything you cannot settle by reading \u2014 a page, a layout, a screenshot, a CLI, a service, a failure \u2014 run it and look at the result. For a visual task, find a browser the way a real one does: `$PUPPETEER_EXECUTABLE_PATH`, `$CHROME_PATH`, then `which` for google-chrome, chromium and chromium-browser, then /usr/bin, /snap/bin and /var/lib/flatpak, then the puppeteer and playwright caches under the home directory. Still empty? `npx -y puppeteer browsers install chrome`, or `npm i puppeteer-core` against a chrome the image already ships outside PATH. Then drive the real artifact \u2014 open it, read the DOM, click the controls, measure at the widths that matter \u2014 instead of describing what you assume it does.","Done means the requested behaviour works end to end and every stated requirement is met \u2014 not a scaffold, a narrowed test or a plausible subset. Genuinely out of reach? Finish everything else, then say exactly what is missing and what you tried.","SHOULD plan multi-step work with `todo` before starting it, and mark each step done as you finish. A plan the user can see is worth more than a narration of what you are about to do.","Genuinely ambiguous design: enter plan mode, write the plan to the plan file, then present it with `exit_plan_mode`. Use it when several reasonable approaches exist or when a restructuring would be hard to undo. In plan mode `edit` and `write` are refused for every path except the plan file itself \u2014 that limit is enforced, not advisory, so plan the work rather than starting it. Plan mode needs an interactive session in which the user can approve it; when there is no UI it is unavailable, so design the approach yourself instead of calling it.","Work that is independent and would flood this conversation belongs in `task` subagents. Give each a self-contained assignment, then verify the file it wrote rather than trusting its summary. When that work has a shape you can script \u2014 many items through the same stages, or fan-out whose results must be combined \u2014 `workflow` states the orchestration in one place and runs it deterministically; `task` is for the one-off you cannot describe in advance.","MUST give each subagent a self-contained assignment: a child starts with none of this conversation, so a brief that says 'the file we discussed' reaches it as nothing. Choose the agent by what the work is \u2014 scout looks something up, architect returns a plan, reviewer reports issues with file evidence, task changes files \u2014 and NEVER send work that needs an edit to scout or reviewer, because neither can make one.","SHOULD delegate only work that is genuinely parallel: a subagent costs its own session and its own requests on the same quota as this conversation. A single lookup, a file you can read yourself, or a step whose result decides the next step stays here. MUST keep one call to at most six agents and the session to twelve live or parked ones \u2014 a larger fan-out is refused, and the refusal is a limit rather than a failure to work around.","Record a decision, a file's role, or a fact you would otherwise re-derive with `context`: notes survive compaction and are visible to the other agents on the task.","Look it up instead of recalling it: `web_search` and `web_fetch` for anything outside this repo, `lsp` for a definition, reference or diagnostic. Name the source you checked.","Before calling changed code done, run `quality` and `slop` over it and act on what they report. A metric you did not measure is a claim you cannot make.","A command runs under a two-minute default timeout. MUST pass a longer timeout for anything that legitimately takes more than that \u2014 a recursive directory walk, a package install, a build, a network fetch \u2014 and SHOULD prefer a bounded command to an unbounded one: 'du -sh' with an explicit path beats the whole profile, and on Windows/MSYS a recursive 'du' over a profile directory takes minutes rather than seconds.","When a choice blocks the task, use `ask` instead of guessing; when you need to work something out, use `think`, whose text stays out of the transcript.","Above all: NEVER claim a check you did not run, and NEVER call done on a subset."].join(`
|
|
2
|
-
`);function s(e){return e===void 0?void 0:e.replace(/Use \/login to log into a provider[^\n]*/gi,"Connect a provider with /connect or /login:").replace(/^[ \t]*\S*hxf-coding-agent[\\/]docs[\\/][^\n]*$/gim,"").replace(/\bhxf-coding-agent\b/gi,"the harness").replace(/\n{3,}/g,`
|
|
3
|
-
|
|
4
|
-
`).trim()}var i=["# Project notes","","## What this is","","## Commands","- build:","- test:","","## Conventions","-",""].join(`
|
|
5
|
-
`);export{a,o as b,n as c,s as d,i as e};
|
package/dist/chunk-CMRKXR6X.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{b as x}from"./chunk-AGGIYXN7.js";import{D as d}from"./chunk-V656XVXV.js";import{a as S}from"./chunk-PCALBZOO.js";import"./chunk-UTYFLLSM.js";import{a as h}from"./chunk-C6HY4Q4J.js";import"./chunk-WOT6VMZA.js";import{spawnSync as O}from"node:child_process";import{readdirSync as b,readFileSync as w,statSync as j,writeFileSync as N,unlinkSync as E}from"node:fs";import{join as p}from"node:path";var g=[22,19];async function I(o="https://api.howtofix.id/api/status"){let s=[],[n,t]=process.versions.node.split(".").map(Number),i=n>g[0]||n===g[0]&&t>=g[1];s.push({name:"node",ok:i,detail:`${process.versions.node} (needs >= ${g[0]}.${g[1]})`});let a=O("git",["--version"],{encoding:"utf8"});s.push({name:"git",ok:a.status===0,detail:a.status===0?a.stdout.trim():"not found on PATH"});let e=S();s.push({name:"sandbox",ok:!!e,detail:e??"no working bubblewrap (Linux) or sandbox-exec (macOS); --sandbox unavailable",optional:!0});let c=!1,r=d;try{let u=p(d,`.doctor-${process.pid}`);N(u,"ok"),E(u),c=!0}catch(u){r=`${d} is not writable: ${u instanceof Error?u.message:String(u)}`}s.push({name:"state dir",ok:c,detail:r});let l=p(d,"auth.json"),f="no auth.json \u2014 run `howtofix` and sign in",$=!1;try{let u=JSON.parse(w(l,"utf8")),m=Object.keys(u).length;$=m>0,f=$?`${m} provider credential${m===1?"":"s"}`:f}catch{}s.push({name:"auth",ok:$,detail:f,optional:!0});try{let u=Date.now(),m=await fetch(o,{signal:AbortSignal.timeout(5e3)});s.push({name:"gateway",ok:m.ok,detail:`${o} \u2192 ${m.status} in ${Date.now()-u}ms`,optional:!0})}catch(u){s.push({name:"gateway",ok:!1,detail:`${o} unreachable: ${u instanceof Error?u.message:String(u)}`,optional:!0})}return s}async function F(){let o=await I(),s=Math.max(...o.map(t=>t.name.length));for(let t of o){let i=t.ok?"ok ":t.optional?"warn":"FAIL";console.log(` ${i} ${t.name.padEnd(s)} ${t.detail}`)}let n=o.filter(t=>!t.ok&&!t.optional);return n.length>0?(console.log(`
|
|
2
|
-
${n.length} problem${n.length===1?"":"s"} must be fixed before a session will work.`),1):0}function _(o=d){let s=p(o,"models.json"),n;try{n=w(s,"utf8")}catch(e){return e.code==="ENOENT"?console.log(` no models.json at ${s} \u2014 run \`howtofix /connect\` to pull the catalogue`):x(h,"models",e),1}let t;try{t=JSON.parse(n)}catch(e){return console.error(`${h}: models: ${s} is not valid JSON (${e instanceof Error?e.message:String(e)})`),console.error(" fix the file, or delete it and run `howtofix /connect` to write a new one"),1}let i=t.providers??{},a=0;for(let[e,c]of Object.entries(i)){let r=(c.models??[]).map(l=>l.id).filter(Boolean);a+=r.length,console.log(` ${e} (${r.length})`);for(let l of r)console.log(` ${l}`)}return a===0?(console.log(" no models configured"),1):0}function y(o=15,s=d){let n=p(s,"sessions"),t;try{t=b(n)}catch{return[]}let i=[];for(let a of t){let e=p(n,a),c;try{c=b(e)}catch{continue}for(let r of c){if(!r.endsWith(".jsonl"))continue;let l=p(e,r);try{let f=j(l);i.push({file:l,project:a,modified:f.mtimeMs,bytes:f.size})}catch{}}}return i.sort((a,e)=>e.modified-a.modified).slice(0,o)}function B(o){let s=o.indexOf("--search");if(s>=0){let e=o[s+1]?.trim();if(!e)return console.error(`${h}: sessions: --search needs a word or phrase`),2;let c=D(e);if(c.length===0)return console.log(` no session mentions "${e}"`),0;for(let r of c){let l=new Date(r.row.modified).toISOString().replace("T"," ").slice(0,16);console.log(` ${l} ${r.row.project} (${r.matches} hit${r.matches===1?"":"s"})`),console.log(` ${r.row.file}`),console.log(` ${r.snippet}`)}return 0}let n=o.indexOf("--limit"),t=n>=0&&Number(o[n+1])||15,i=y(t);if(i.length===0)return console.log(` no saved sessions under ${p(d,"sessions")}`),o.includes("--export")?1:0;let a=o.indexOf("--export");if(a>=0){let e=Number(o[a+1]);if(!Number.isInteger(e)||e<1||e>i.length)return console.error(`${h}: sessions: --export needs a number from the list (1-${i.length})`),2;let c=i[e-1];try{console.log(R(c.file))}catch(r){return x(h,"sessions",r),1}return 0}return i.forEach((e,c)=>{let r=new Date(e.modified).toISOString().replace("T"," ").slice(0,16),l=Math.round(e.bytes/1024);console.log(` ${String(c+1).padStart(2)} ${r} ${String(l).padStart(6)}k ${e.project}`),console.log(` ${e.file}`)}),0}function k(o){try{let n=JSON.parse(o).message?.content;if(typeof n=="string")return n.replace(/\s+/g," ").trim();if(Array.isArray(n))return n.map(t=>t&&typeof t=="object"&&"text"in t?String(t.text):"").join(" ").replace(/\s+/g," ").trim()}catch{}return o.replace(/\s+/g," ").trim()}function D(o,s=10,n=d){let t=o.toLowerCase(),i=[];for(let a of y(500,n)){let e;try{e=w(a.file,"utf8")}catch{continue}let c=0,r="";for(let l of e.split(`
|
|
3
|
-
`))l.toLowerCase().includes(t)&&(c++,r||(r=k(l).slice(0,160)));if(c>0&&i.push({row:a,matches:c,snippet:r}),i.length>=s)break}return i}function R(o){let s=[`# Session ${o.split(/[\\/]/).pop()??o}`,""];for(let n of w(o,"utf8").split(`
|
|
4
|
-
`)){if(!n.trim())continue;let t;try{t=JSON.parse(n)}catch{continue}if(t.type!=="message")continue;let i=k(n);i&&s.push(`## ${t.message?.role??"unknown"}`,"",i,"")}return s.join(`
|
|
5
|
-
`).trimEnd()}export{I as collectChecks,R as exportSessionMarkdown,y as listSessionFiles,F as runDoctor,_ as runModels,B as runSessions,D as searchSessions};
|
package/dist/chunk-DMNE4TU6.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as o}from"./chunk-C6HY4Q4J.js";import{createPrivateKey as p,createPublicKey as f,createHash as l,randomBytes as y,sign as m}from"node:crypto";import{arch as s,cpus as I,hostname as d,platform as c}from"node:os";var a="hf-cli-1",x="MC4CAQAwBQYDK2VwBCIEIDmKoNgInS7oDpncee1d1+Mnci1R/q4aE5xxHeCKq4Dc",C="howtofix-cli-auth-v1",i;function u(){return i||(i=p({key:Buffer.from(x,"base64"),format:"der",type:"pkcs8"})),i}function g(){return f(u())}function K(t,e,n,r){return Buffer.from([C,t,e,n,r].join(`
|
|
2
|
-
`),"utf8")}function h(){return y(16).toString("hex")}var E="tQ91uspGl0sw5Y8x+soLYnFNX6a9vEzSzCuuvalzdKk=";function P(){let t=g().export({format:"der",type:"spki"});return t.subarray(t.length-32).toString("base64")===E}function N(){let t=g().export({format:"der",type:"spki"});return l("sha256").update(t).digest("hex").slice(0,16)}function $(){let e=(I()[0]?.model??"").replace(/\s+/g," ").trim(),n=d(),r=e?`${n} (${c()}/${s()}, ${e})`:`${n} (${c()}/${s()})`;return`CLI (${o}, ${r})`}var k="X-HowToFix-Client";function A(){return`CLI (${o})`}function B(t,e){let n=h(),r=m(null,K(a,t,e,n),u());return{keyId:a,nonce:n,signature:r.toString("base64")}}export{a,g as b,K as c,h as d,P as e,N as f,$ as g,k as h,A as i,B as j};
|
package/dist/chunk-EHLH4G5R.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-T5YJVQXI.js";import"./chunk-UTYFLLSM.js";import"./chunk-DMNE4TU6.js";import"./chunk-C6HY4Q4J.js";import"./chunk-WOT6VMZA.js";export{g as CATALOG_CACHE_TTL_MS,m as DEFAULT_CONTEXT_WINDOW,a as HOWTOFIX_BASE_URL,b as HOWTOFIX_CONSOLE_URL,l as HOWTOFIX_MODEL_COMPAT,c as HOWTOFIX_PROVIDERS,j as HTTP_IDLE_TIMEOUT_MS,r as UNLIMITED_SENTINEL,v as applyCatalog,w as applyCompat,A as checkAccount,s as checkUsage,d as configuredProviderIds,x as countNewModels,k as ensureGatewaySettings,z as findLiveModels,q as isHowtofixProvider,h as loadCatalog,o as looksLikeToken,n as maskToken,u as mergeModels,e as newProviderEntry,p as parseModelIds,y as probeModel,f as repairGatewayModels,i as repairModelFacts,t as syncGatewayModelsOnStart};
|
package/dist/chunk-FPXVDP32.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{m as p,n as d}from"./chunk-V656XVXV.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";import{execFileSync as v}from"node:child_process";import{existsSync as m,mkdirSync as x,readFileSync as S,readdirSync as j,statSync as $,writeFileSync as z}from"node:fs";import{join as r,relative as b,resolve as u}from"node:path";function F(o){let e=o.replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase());return[{path:"preset.json",body:`${JSON.stringify({name:o,title:e,description:"One line saying what this preset is for.",category:"engineering",version:"1.0.0",skills:[`${o}-skill`]},null,2)}
|
|
2
|
-
`},{path:"prompt.md",body:["Rules the model should follow while this preset is active.","","This text is appended to the system prompt, never substituted for it, so it","adds to the agent's own rules rather than replacing them. Delete this file if","the preset only needs skills.",""].join(`
|
|
3
|
-
`)},{path:r("skills",`${o}-skill`,"SKILL.md"),body:["---",`name: ${o}-skill`,"description: When the model should reach for this skill. This line is what"," the model reads when deciding, so say when to use it, not what it contains.","---","",`# ${e}`,"","What the model should do, as instructions. A skill is read on demand: only the","frontmatter above is in every request, so the body costs nothing until used.","","Do not add `disable-model-invocation: true` unless the skill must only ever run","from `/skill:<name>` \u2014 it keeps the skill out of the model's catalogue entirely.",""].join(`
|
|
4
|
-
`)}]}function g(){return["usage:"," howtofix preset new <name> [dir] write a preset skeleton"," howtofix preset check [dir] validate a preset with the installer's rules"," howtofix preset pack [dir] build <name>-<version>.tar.gz for publishing","","A preset is a directory holding preset.json, an optional prompt.md, and a","skills/ tree. `check` runs the same validation the installer runs, so a preset","that passes here will not be refused at install."].join(`
|
|
5
|
-
`)}function w(o){let e=[],t=s=>{for(let l of j(s,{withFileTypes:!0}).sort((n,i)=>n.name.localeCompare(i.name))){let n=r(s,l.name);l.isDirectory()?t(n):e.push(b(o,n).split("\\").join("/"))}};return t(o),e}function C(o){let{manifest:e,problems:t}=d(o);if(!e){console.log(`not installable: ${o}`);for(let a of t)console.log(` - ${a}`);return!1}let s=p(o,e);if(s.length>0){console.log(`not installable: ${o}`);for(let a of s)console.log(` - ${a}`);return!1}let l=e.skills??[],n=0,i=0;for(let a of l){let f=r(o,"skills",a,"SKILL.md"),k=m(f)?/^---\r?\n([\s\S]*?)\r?\n---/.exec(S(f,"utf8")):null,y=k&&/^disable-model-invocation:\s*(.*)$/m.exec(k[1]);y&&y[1].trim().replace(/^["']|["']$/g,"").toLowerCase()==="true"?i+=1:n+=1}let h=w(o),c=h.reduce((a,f)=>a+$(r(o,f)).size,0);return console.log(`installable: ${e.name} ${e.version??""}`.trim()),console.log(` ${h.length} files, ${(c/1024).toFixed(1)} KB`),console.log(` ${l.length} skill(s): ${n} the model can choose`),i>0&&console.log(` ${i} invoke-only \u2014 reachable only as /skill:<name>`),!0}function L(o){let{manifest:e,problems:t}=d(o);if(!e){console.log(`cannot pack: ${o}`);for(let c of t)console.log(` - ${c}`);return!1}let s=p(o,e);if(s.length>0){console.log("cannot pack: the preset does not validate");for(let c of s)console.log(` - ${c}`);return!1}let l=e.version??"1.0.0",n=u(`${e.name}-${l}.tar.gz`),i=w(o);v("tar",["-czf",n,"-C",o,...i]);let h=$(n).size;return console.log(`packed ${n}`),console.log(` ${i.length} files, ${(h/1024).toFixed(1)} KB`),console.log(""),console.log("to offer it to the community registry, open a pull request adding an entry"),console.log("that names the repo, a pinned commit, and the skill directory inside it."),!0}function A(o){let[e,t]=o;if(!e||e==="--help"||e==="-h")return console.log(g()),e?0:2;if(e==="new"){if(!t)return console.log(`preset new: a name is required
|
|
6
|
-
`),console.log(g()),2;if(!/^[a-z0-9][a-z0-9-]*$/.test(t))return console.log(`preset new: "${t}" is not a usable name.`),console.log(" lower-case letters, digits and hyphens; must start with a letter or digit."),console.log(" The installer refuses anything else, and it refuses at install time."),2;let s=o[2]?u(o[2]):u("."),l=r(s,t);if(m(l))return console.log(`preset new: ${l} already exists.`),1;for(let n of F(t)){let i=r(l,n.path);x(r(i,".."),{recursive:!0}),z(i,n.body),console.log(` wrote ${b(l,i)}`)}return console.log(`
|
|
7
|
-
wrote ${l}`),console.log(` edit preset.json and the skill, then: howtofix preset check ${t}`),0}if(e==="check"||e==="pack"){let s=u(t??".");return m(r(s,"preset.json"))?(e==="check"?C(s):L(s))?0:1:(console.log(`${e}: no preset.json in ${s}`),2)}return console.log(`preset: unknown subcommand "${e}"
|
|
8
|
-
`),console.log(g()),2}export{A as runPresetCommand};
|
package/dist/chunk-GVTLSEBC.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as c,d as l}from"./chunk-27TRKD65.js";import{D as s}from"./chunk-V656XVXV.js";import"./chunk-UTYFLLSM.js";import{a as i,b as r}from"./chunk-C6HY4Q4J.js";import"./chunk-WOT6VMZA.js";var d=[["/connect","sign in with your howtofix.id email:password \u2014 no browser needed"],["/model","choose which model answers"],["/help","list every command"],["/quit","leave"]],u=[" \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557"," \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2554\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D"," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2557 "," \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u255D "," \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u255D \u2588\u2588\u2557\u2588\u2588\u2551 "," \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D "],m=[" _ _ _____ ","| | | | __ __ | ___|","| |_| | \\ \\/ / | |_ ","| _ | > < | _| ","|_| |_| /_/\\_\\ |_| "];function g(){if(process.platform==="win32")return!1;let e=(process.env.LC_ALL||process.env.LC_CTYPE||process.env.LANG||"").toLowerCase();return e===""||e==="c"||e==="posix"||!e.includes("utf-8")&&!e.includes("utf8")?!1:!/ja|ko|zh|_kr|_jp|_cn|_tw|_hk/.test(e)}function h(){return g()?u:m}var _="https://howtofix.id/cli";function p(e){let n=process.env.HOME??"",t=n!==""&&e.startsWith(n)?`~${e.slice(n.length)}`:e,o=t.split("/").filter(Boolean);return o.length>3?`\u2026/${o.slice(-2).join("/")}`:t}function f(e){let n=e.signedIn?d.filter(([t])=>t!=="/connect"):d;return[...h(),"",`${i} ${r} \u2014 a terminal coding agent. Describe the change you want and it reads, edits and runs the code in front of you.`,"",` working in ${p(e.cwd)}`,...e.note?[` session ${e.note}`]:[],"",...e.signedIn?[" already signed in to howtofix.id",""]:[],...n.map(([t,o])=>` ${t.padEnd(11)}${o}`),"",' Or just start typing. Every message goes to the model; anything beginning with "/" stays local.'].join(`
|
|
2
|
-
`)}function w(){return[{value:"connect",label:"Sign in to howtofix.id",description:"opens the browser, or paste a key from the panel"},{value:"ready",label:"I have a key \u2014 just give me the prompt",description:"drops you at the prompt; run /connect whenever you like"},{value:"release",label:"What's in this release",description:`opens the ${r} notes in your browser`}]}async function E(e,n,t){c(s).welcomeSeen||(l(s),t(`welcome to ${i}`,f(e)),!e.signedIn&&await new Promise(o=>{n("First run \u2014 how do you want to begin?",w(),a=>{a==="connect"&&e.runSlash("/connect"),a==="release"&&e.openExternal(_),o()},()=>o())}))}export{E as maybeShowWelcome};
|
package/dist/chunk-GXB7RZHH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as a,E as b,F as c,G as d,H as e,I as f,J as g,K as h}from"./chunk-V656XVXV.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{e as AGENTS_STORE_DIR,a as AGENT_DIR,f as USAGE_CACHE_PATH,b as USER_SKILLS_DIR,g as WORKFLOWS_DIR,d as additionalSkillPaths,h as pinAgentDir,c as projectSkillsDir};
|
package/dist/chunk-ILDDDLRC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-WX3V5P7U.js";import"./chunk-V656XVXV.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{c as formatSkillList,b as skillInvocation,a as skillSearchPaths};
|
package/dist/chunk-JFYVRWJI.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var C=new Set(["think"]),l;function E(n){let t=new WeakSet,o=e=>{if(e===null||typeof e!="object")return e;if(t.has(e))return"[circular]";if(t.add(e),Array.isArray(e))return e.map(o);let r=e,s={};for(let i of Object.keys(r).sort())s[i]=o(r[i]);return s};try{return JSON.stringify(o(n))??""}catch{return""}}function x(n,t){if(C.has(n))return;let o=`${n}\0${E(t)}`,e=l&&l.signature===o?l.count+1:1;return l={signature:o,count:e},e>=3?{repeats:e}:void 0}function Q(){l=void 0}function v(n,t){return`Refused: ${n} has been called ${t} times in a row with identical arguments, so the last attempt cannot have changed anything. Do not repeat it. Either use different arguments, use a different tool, or stop and report what you found and what is blocking you.`}var $=/^-[a-zA-Z0-9_-]/;function h(n,t){switch(t){case"number":return/^\d+$/.test(n);case"string":return!0;default:return!1}}function O(n,t){if(!/^-[^-]/.test(n)||n.includes("="))return!1;for(let o=1;o<n.length;o++){let e=t[`-${n[o]}`];if(!e)return!1;if(e!=="none")return h(n.slice(o+1),e)}return!0}function L(n,t,o){let e=t;for(;e<n.length;){let r=n[e];if(!r){e++;continue}if(r==="--")break;if($.test(r)){if(/^-\d+$/.test(r)&&o.safeFlags["-n"]){e++;continue}let s=r.includes("="),[i="",...c]=r.split("="),a=o.safeFlags[i];if(!a){if(!O(r,o.safeFlags))return!1;e++;continue}if(a==="none"){if(s)return!1;e++;continue}if(a==="optional"){e++;continue}if(s){if(!h(c.join("="),a))return!1;e++;continue}let y=n[e+1];if(y===void 0||!h(y,a))return!1;e+=2;continue}if(o.allowPositional===!1)return!1;e++}return!0}var M={"--all":"none","--branches":"none","--tags":"none","--remotes":"none"},u={"--oneline":"none","--graph":"none","--decorate":"none","--no-decorate":"none","--date":"string","--relative-date":"none"},g={"--max-count":"number","-n":"number"},p={"--stat":"none","--numstat":"none","--shortstat":"none","--name-only":"none","--name-status":"none"},d={"--color":"none","--no-color":"none"},m={"--patch":"none","-p":"none","--no-patch":"none","--no-ext-diff":"none","-s":"none"},A={"--author":"string","--committer":"string","--grep":"string"},I={"-l":"none","--list":"none","-a":"none","-r":"none","-v":"none","-vv":"none","-i":"none"},F={"git status":{safeFlags:{"-s":"none","--short":"none","-b":"none","--branch":"none","-u":"optional","--untracked-files":"optional","--porcelain":"optional","--ignored":"none","--long":"none","--no-renames":"none",...d}},"git diff":{safeFlags:{...p,...d,...m,"--cached":"none","--staged":"none","--word-diff":"none","--check":"none","--quiet":"none","--exit-code":"none","--no-renames":"none","--diff-filter":"string","--relative":"string","--full-index":"none","--binary":"none","--abbrev":"number","--unified":"number","-U":"number","--ignore-all-space":"none","--ignore-space-change":"none","--ignore-blank-lines":"none"}},"git log":{safeFlags:{...u,...g,...p,...d,...m,...A,...M,"--since":"string","--after":"string","--until":"string","--before":"string","--follow":"none","--no-merges":"none","--merges":"none","--first-parent":"none","--reverse":"none","--skip":"number","--all":"none","--format":"string","--pretty":"string","--abbrev-commit":"none","--no-abbrev-commit":"none","--left-right":"none"}},"git show":{safeFlags:{...p,...d,...m,...u,"--format":"string","--pretty":"string","--abbrev-commit":"none","--no-patch":"none","-q":"none"}},"git shortlog":{safeFlags:{...g,"-s":"none","--summary":"none","-n":"none","--numbered":"none","-e":"none","--email":"none","-sn":"none","-ns":"none","--all":"none"}},"git reflog":{safeFlags:{...g,...u,...A,"--all":"none","--date":"string"}},"git blame":{safeFlags:{"-L":"string","-w":"none","-c":"none","-n":"none","-s":"none","-e":"none","-p":"none","--porcelain":"none","--line-porcelain":"none","--date":"string","--since":"string","-C":"none","-M":"none"}},"git ls-files":{safeFlags:{"-m":"none","--modified":"none","-o":"none","--others":"none","-i":"none","--ignored":"none","-s":"none","--stage":"none","-d":"none","--deleted":"none","-c":"none","--cached":"none","-u":"none","--unmerged":"none","--exclude-standard":"none","--error-unmatch":"none","-z":"none"}},"git ls-remote":{safeFlags:{"--heads":"none","--tags":"none","--refs":"none","--symref":"none"}},"git rev-parse":{safeFlags:{"--short":"optional","--abbrev-ref":"none","--verify":"none","--quiet":"none","--git-dir":"none","--show-toplevel":"none","--show-cdup":"none","--is-inside-work-tree":"none","--is-bare-repository":"none","--symbolic-full-name":"none","--abbrev":"optional"}},"git rev-list":{safeFlags:{...g,"--count":"none","--all":"none","--objects":"none","--reverse":"none","--max-parents":"number","--min-parents":"number","--no-merges":"none","--first-parent":"none","--abbrev-commit":"none"}},"git describe":{safeFlags:{"--tags":"none","--all":"none","--long":"none","--always":"none","--dirty":"none","--abbrev":"number","--match":"string","--exclude":"string","--first-parent":"none"}},"git cat-file":{safeFlags:{"-p":"none","-t":"none","-s":"none","-e":"none","--batch-check":"none"}},"git for-each-ref":{safeFlags:{"--format":"string","--count":"number","--sort":"string","--points-at":"string","--merged":"string","--no-merged":"string"}},"git grep":{safeFlags:{"-n":"none","--line-number":"none","-i":"none","--ignore-case":"none","-l":"none","--files-with-matches":"none","-c":"none","--count":"none","-w":"none","--word-regexp":"none","-E":"none","--extended-regexp":"none","-F":"none","--fixed-strings":"none","--cached":"none","--untracked":"none","-e":"string","--and":"none","--or":"none","--not":"none"}},"git merge-base":{safeFlags:{"--all":"none","--is-ancestor":"none","--fork-point":"none","--octopus":"none"}},"git stash list":{safeFlags:{...u}},"git worktree list":{safeFlags:{"--porcelain":"none","-v":"none","--verbose":"none","-z":"none"}},"git branch":{safeFlags:{...I,"--merged":"string","--no-merged":"string","--contains":"string","--no-contains":"string","--sort":"string","--format":"string","--points-at":"string","--column":"none","--show-current":"none"},dangerous:n=>{let t=new Set(["--merged","--no-merged","--contains","--no-contains","--sort","--format","--points-at"]),o=!1;for(let e of n){if(o){o=!1;continue}if(t.has(e)){o=!0;continue}if(!e.startsWith("-"))return!0}return!1}},"git tag":{safeFlags:{"-l":"none","--list":"none","-n":"number","--contains":"string","--no-contains":"string","--merged":"string","--sort":"string","--points-at":"string","--column":"none"},dangerous:n=>{let t=new Set(["--contains","--no-contains","--merged","--sort","--points-at"]),o=!1;for(let e of n){if(o){o=!1;continue}if(t.has(e)){o=!0;continue}if(!e.startsWith("-"))return!0}return!1}},"git remote":{safeFlags:{"-v":"none","--verbose":"none"},dangerous:n=>n.some(t=>!t.startsWith("-"))},"git config --get":{safeFlags:{"--local":"none","--global":"none","--system":"none","--get-all":"none","--get-regexp":"none","--list":"none","-l":"none","--show-origin":"none","--null":"none","-z":"none"}}},S=["ls","pwd","cat","head","tail","wc","which","whoami","date","echo","sleep","true","false","type","test","seq","basename","dirname","realpath","stat","file","du","df","tree","uname","hostname","id","groups","tty","cal","uptime","free","locale","printf","grep","rg","fd","jq","bat","column","paste","nl","expand","fold","fmt","md5sum","sha1sum","sha256sum","sha512sum","b2sum","cksum","diff","cmp"],P={find:{safeFlags:{"-name":"string","-iname":"string","-type":"string","-maxdepth":"number","-mindepth":"number","-newer":"string","-path":"string","-not":"none","-print":"none","-print0":"none","-empty":"none","-size":"string","-mtime":"number","-atime":"number","-perm":"string","-L":"none","-H":"none","-P":"none"},dangerous:n=>n.some(t=>/^-(delete|exec|execdir|ok|okdir|fprint0?|fls|fprintf)$/.test(t))},sort:{safeFlags:{"-n":"none","-r":"none","-u":"none","-k":"string","-t":"string","-f":"none","-h":"none","-V":"none","-s":"none","-c":"none","-m":"none","-b":"none","-z":"none"}},uniq:{safeFlags:{"-c":"none","-d":"none","-u":"none","-i":"none","-f":"number","-s":"number","-w":"number"}},cut:{safeFlags:{"-d":"string","-f":"string","-c":"string","-b":"string","-s":"none","--complement":"none","-z":"none"}},tr:{safeFlags:{"-d":"none","-s":"none","-c":"none"}},node:{safeFlags:{"-v":"none","--version":"none"},allowPositional:!1},python:{safeFlags:{"--version":"none"},allowPositional:!1},python3:{safeFlags:{"--version":"none"},allowPositional:!1},npm:{safeFlags:{"--version":"none","-v":"none"},allowPositional:!1},sed:{safeFlags:{"-n":"none","--quiet":"none","-e":"string","-E":"none","-r":"none","--regexp-extended":"none","-s":"none","-u":"none","-z":"none","--posix":"none"},dangerous:n=>n.some(t=>/^-i|^--in-place/.test(t)||/\b[we]\s/.test(t)||/^[we]$/.test(t))},awk:{safeFlags:{"-F":"string","-v":"string","-f":"string"},dangerous:n=>n.some(t=>/\bsystem\s*\(|\|\s*"|>\s*"/.test(t))},xxd:{safeFlags:{"-l":"number","-s":"string","-c":"number","-g":"number","-p":"none","-i":"none","-u":"none","-b":"none","-e":"none","-o":"number"},dangerous:n=>n.some(t=>t==="-r"||/^-[a-z]*r/.test(t))}},k={"npm ls":{safeFlags:{"--depth":"number","--json":"none","--long":"none","--parseable":"none","--all":"none","--prod":"none","--dev":"none","--omit":"string","--link":"none","--global":"none","-g":"none","--silent":"none"}},"npm view":{safeFlags:{"--json":"none","--registry":"string"}},"docker ps":{safeFlags:{"-a":"none","--all":"none","-q":"none","--quiet":"none","--no-trunc":"none","--format":"string","-n":"number","--last":"number","-s":"none","--size":"none","--filter":"string"}},"docker images":{safeFlags:{"-a":"none","--all":"none","-q":"none","--quiet":"none","--no-trunc":"none","--format":"string","--filter":"string","--digests":"none"}},"docker inspect":{safeFlags:{"--format":"string","-f":"string","-s":"none","--size":"none","--type":"string"}},"kubectl get":{safeFlags:{"-o":"string","--output":"string","-n":"string","--namespace":"string","-A":"none","--all-namespaces":"none","--no-headers":"none","-l":"string","--selector":"string","--show-labels":"none","-w":"none","--watch":"none","--sort-by":"string"}},"kubectl describe":{safeFlags:{"-n":"string","--namespace":"string","-l":"string","--selector":"string"}},"cargo tree":{safeFlags:{"--depth":"number","-e":"string","--edges":"string","--no-dev-dependencies":"none","--prefix":"string","-i":"string","--invert":"string","-p":"string","--package":"string"}},"go version":{safeFlags:{}}},z=["cd","alias","history","arch","ip addr","ifconfig"];function G(n){if(!/\$\(|`|\$\{|>|</.test(n)&&!/(?<!&)&(?!&)/.test(n))return n.split(/\|\||&&|;|\|/).map(t=>t.trim()).filter(t=>t.length>0)}function D(n){let t=n.some(e=>/^cd\b/.test(e)),o=n.some(e=>/^git\b/.test(e));return t&&o}function q(n){let t=[],o=/'[^']*'|"[^"]*"|\S+/g;for(let e of n.match(o)??[])t.push(e.length>=2&&/^['"]/.test(e)?e.slice(1,-1):e);return t}function N(n){if(n.length===0)return;let[t="",o=""]=n,e=`${t} ${o}`;if(t==="git"&&o==="config"){let r=n[2];return r==="--get"||r==="--get-all"||r==="--get-regexp"||r==="-l"||r==="--list"?{name:"git config --get",rest:n.slice(3)}:void 0}return t==="git"&&o==="stash"?n[2]==="list"?{name:"git stash list",rest:n.slice(3)}:void 0:t==="git"&&o==="worktree"?n[2]==="list"?{name:"git worktree list",rest:n.slice(3)}:void 0:t==="git"&&F[`git ${o}`]?{name:`git ${o}`,rest:n.slice(2)}:k[e]?{name:e,rest:n.slice(2)}:{name:t,rest:n.slice(1)}}var j=new Set(["echo","printf"]);function U(n){let t=q(n),o=N(t);if(!o)return!1;let{name:e,rest:r}=o;if(j.has(e)&&r.some(i=>i.includes("$")||i.includes("`")))return!1;let s=F[e]??P[e]??k[e];return s?s.dangerous?.(r)?!1:L(r,0,s):!!(S.includes(e)||z.includes(e))}function b(n){let t=G(n);return!t||t.length===0||D(t)?!1:t.every(U)}var W=["suggest","auto-edit","full-auto"],rn={suggest:"suggest: ask before every edit and command","auto-edit":"auto-edit: edits run, commands ask","full-auto":"full-auto: nothing asks"};function sn(n){return W.includes(n)}var T={read:0,write:1,exec:2},H={suggest:"read","auto-edit":"write","full-auto":"exec"},B={read:"read",grep:"read",find:"read",ls:"read",think:"read",ask:"read",todo:"read",context:"read",web_search:"read",web_fetch:"read",lsp:"read",quality:"read",workflow:"exec",goal:"read",enter_plan_mode:"read",exit_plan_mode:"read",edit:"write",write:"write",bash:"exec",powershell:"exec",task:"exec"};function R(n){let t=B[n];return t||(n.startsWith("mcp__")?"write":"exec")}var V=new Set(["sudo","doas","env","nohup","time","exec","command","nice","setsid","stdbuf"]),Z=new Set(["-u","-g","-p","-C","-S","-U","--user","--group","--prompt","--close-from","--chdir","--setenv","--unset"]);function Y(n){let t=(n.match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(s=>s.replace(/^['"]|['"]$/g,"")),o=0;for(;o<t.length;){let s=t[o]??"";if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(s)||V.has(s)){o++;continue}if(s.startsWith("-")){o+=Z.has(s)?2:1;continue}break}let e=t[o];if(e===void 0)return;let r=e.split("/").pop()??e;if(r==="rm"){let s=t.slice(o+1),i=s.some(a=>/^-[a-zA-Z]*r[a-zA-Z]*$/i.test(a)||a==="--recursive"),c=s.find(a=>!a.startsWith("-"));return i&&(c===void 0||/^(?:\/|\/\*|~|~\/\*|\$HOME|\$HOME\/\*|\*)$/.test(c))?"recursive delete of the filesystem root or home":void 0}if(r==="dd")return t.slice(o+1).some(s=>/^of=\/dev\/(?:sd|nvme|hd|vd)/.test(s))?"raw write to a block device":void 0;if(/^mkfs(?:\.[a-z0-9]+)?$/.test(r))return"filesystem format";if(/:\(\)\s*\{.*\}\s*;:/.test(n))return"fork bomb";if(/^(?:shutdown|reboot|halt|poweroff)$/.test(r))return"host shutdown";if(/>\s*\/etc\/(?:passwd|shadow|sudoers)/.test(n))return"overwrite of a system account file"}var w="full-auto",_=async()=>!1,f=!1;function an(n){w=n}function ln(){return w}function cn(n){f=n}function un(){return f}function gn(n){_=n}function J(n,t,o){if(f)return{action:"run"};let e=typeof o?.command=="string"?o.command:"";if(t==="bash"||t==="powershell"){let s=Y(e);if(s)return{action:"deny",reason:`Refused in every mode: ${s}.`};if(b(e))return{action:"run"}}let r=R(t);return T[r]<=T[H[n]]?{action:"run"}:{action:"prompt",reason:`this is a ${r}-tier tool`}}function K(n,t){if(t&&typeof t=="object"){let o=t;if((n==="bash"||n==="powershell")&&typeof o.command=="string")return o.command;if((n==="edit"||n==="write")&&typeof o.path=="string"){let e=Array.isArray(o.edits)?` (${o.edits.length} edits)`:"";return`${o.path}${e}`}try{let e=JSON.stringify(o);if(e&&e!=="{}")return e.length>300?`${e.slice(0,297)}...`:e}catch{}}return n}function X(n,t,o){let e=[`Allow tool: ${n}`];n.startsWith("mcp__")&&e.push("Origin: MCP server tool"),e.push(`Reason: ${o}`);let r=K(n,t);return r!==n&&e.push(r),e.join(`
|
|
2
|
-
`)}function dn(n={}){return t=>{t.on("tool_call",async o=>{if(f)return;let e=x(o.toolName,o.input);if(e)return{block:!0,reason:v(o.toolName,e.repeats)};let r=w,s=J(r,o.toolName,o.input);if(s.action==="run")return;if(s.action==="deny")return{block:!0,reason:s.reason};if(n.interactive===!1)return{block:!0,reason:`Blocked: this is a ${R(o.toolName)}-tier tool and no UI can approve it here (approval mode: ${r}).`};if(!await _(`${o.toolName} wants to run`,X(o.toolName,o.input,s.reason)))return{block:!0,reason:`Blocked by the user (approval mode: ${r}).`}})}}export{Q as a,b,W as c,rn as d,sn as e,T as f,H as g,R as h,Y as i,an as j,ln as k,cn as l,un as m,gn as n,J as o,K as p,X as q,dn as r};
|
package/dist/chunk-K6ZKVFKO.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import{$ as De,A as _e,B as Te,D as E,E as L,Ea as Ke,G as F,H as $e,P as Ee,Pa as Xe,Q as Ae,Qa as Ye,R as ve,S as je,T as Oe,V as Pe,W as Re,Y as Ce,_ as H,a as C,b as D,ba as Ne,c as re,ca as Fe,d as ie,da as Me,e as ae,ea as Ie,f as ce,fa as Le,g as T,i as le,ia as Ge,j as pe,k as ue,ka as Ue,l as fe,la as G,m as me,ma as Be,na as He,o as ge,p as he,pa as W,q as we,r as ye,s as be,t as $,ta as We,u as ke,ua as ze,v as xe,w as I,wa as qe,x as Se,xa as Ze}from"./chunk-ACOMNDUL.js";import{r as se}from"./chunk-JFYVRWJI.js";import{b as de}from"./chunk-27TRKD65.js";import{D as x,G as ee,r as J,s as Q}from"./chunk-V656XVXV.js";import{c as te}from"./chunk-T5YJVQXI.js";import{g as ne,k as oe}from"./chunk-VXTUPGAD.js";import"./chunk-UTYFLLSM.js";import"./chunk-DMNE4TU6.js";import{b as M,c as Y,d as V}from"./chunk-C6HY4Q4J.js";import"./chunk-WOT6VMZA.js";import{join as St}from"node:path";import{hostname as Nn}from"node:os";import{createAgentSession as Fn,createCodemodeExtension as Mn,createMcpExtension as In,DefaultResourceLoader as Ln,SessionManager as U,SettingsManager as Gn}from"@netrodev/hxf-coding-agent";import{existsSync as Tt,readFileSync as $t}from"node:fs";import{join as Et}from"node:path";var Ve=Et(x,"APPEND_SYSTEM.md"),At=["<non-interactive>","This run has no user attached: it was started with --print, and there is nobody to answer a question. Anything that stops and waits for a reply \u2014 `ask`, a confirmation, a skill that resolves a mode by asking which mode to use \u2014 will simply end the run with the task unfinished.","So do not ask. Where an instruction tells you to ask the user and wait, take the default it describes and continue, and say which default you took and why in your final answer. The user reads that answer; they cannot answer mid-run.","Where a skill offers a choice of modes, prefer the one that applies the rules while you work over the one that audits afterwards: this is the mode for building something now, and the audit mode can still be run later by the same person who reads your answer.","</non-interactive>"].join(`
|
|
2
|
-
`),vt=16*1024;function jt(e){try{if(!Tt(e))return;let o=$t(e,"utf8").trim();return!o||Buffer.byteLength(o,"utf8")>vt?void 0:o}catch{return}}function Je(e,o){let s=[o?e:`${e}
|
|
3
|
-
|
|
4
|
-
${At}`],t=jt(Ve);return t&&s.push(`# Standing instructions from ${Ve}
|
|
5
|
-
${t}`),s}function Ot(e){return e.replace(/operating inside hxf, a coding agent harness/gi,"operating as HowToFix, a coding agent harness").replace(/^HowToFix documentation \(read only when the user asks about[^\n]*\):?$/gim,"Harness documentation (internal reference; the user is never told the harness name):").replace(/\bhxf itself\b/gi,"the harness itself").replace(/^- When reading hxf docs or examples/m,"- When reading harness docs or examples").replace(/^- When working on hxf topics/m,"- When working on harness topics").replace(/^- Always read hxf \.md files/m,"- Always read the harness .md files").replace(/\bhxf packages\b/gi,"harness packages").replace(/\bhxf \.md files\b/gi,"harness .md files").replace(/\bhxf docs\b/gi,"harness docs").replace(/^-\s*You can inspect HXF_\* environment variables/m,"- You can inspect the harness's environment variables")}var Pt=["preamble","rules","docs","addendum"];function Rt(e){if(!e)return;let o=!1,s={...e};for(let t of Pt){let n=s[t];if(typeof n!="string")continue;let r=Ot(n);r!==n&&(s[t]=r,o=!0)}return o?s:void 0}function Qe(){return e=>{e.on("context_with_system",async o=>{let s=o.messages[0];if(!s||s.role!=="system")return;let t=Rt(s.sections);return t?{messages:o.messages.map(r=>r===s?{...s,sections:t}:r)}:void 0})}}var k={hooks:{}},N;function et(){return e=>{let o=ae(re);k=o.config,N=void 0,ce(),e.on("session_start",async(s,t)=>{for(let c of o.diagnostics)t.ui.notify(`hooks.json: ${c.message}`,"warning");let{outcome:n,ran:r}=await T(k,"SessionStart",{hook_event_name:"SessionStart",cwd:t.cwd},{cwd:t.cwd});n.context&&(N=n.context),n.error&&t.ui.notify(`SessionStart hook: ${n.error}`,"warning"),r&&N&&t.ui.notify(`SessionStart hooks added ${N.length} characters of context`,"info")}),e.on("input",async(s,t)=>{if(!k.hooks.UserPromptSubmit)return;let n={hook_event_name:"UserPromptSubmit",cwd:t.cwd,prompt:s.text},{outcome:r}=await T(k,"UserPromptSubmit",n,{cwd:t.cwd});if(r.error&&t.ui.notify(`UserPromptSubmit hook: ${r.error}`,"warning"),r.block)return t.ui.notify(r.reason??"blocked by a hook","warning"),{action:"handled"};if(r.context)return{action:"transform",text:`${s.text}
|
|
6
|
-
|
|
7
|
-
${r.context}`}}),e.on("tool_call",async(s,t)=>{if(!k.hooks.PreToolUse)return;let n={hook_event_name:"PreToolUse",cwd:t.cwd,tool_name:s.toolName,tool_input:s.input},{outcome:r}=await T(k,"PreToolUse",n,{cwd:t.cwd});if(r.error&&t.ui.notify(`PreToolUse hook: ${r.error}`,"warning"),r.block)return{block:!0,reason:r.reason??"blocked by a hook"};if(r.updatedInput){let i=e.getAllTools().find(d=>d.name===s.toolName)?.parameters;if(!i)t.ui.notify(`PreToolUse hook rewrote \`${s.toolName}\`, but no schema is known for that tool \u2014 the rewrite was ignored`,"warning");else{let d=ie(i,r.updatedInput);d?t.ui.notify(`PreToolUse hook rewrite ignored \u2014 ${d}`,"warning"):Object.assign(s.input,r.updatedInput)}}}),e.on("tool_result",async(s,t)=>{if(!k.hooks.PostToolUse)return;let n=s.content.map(i=>i.type==="text"?i.text:"").join(`
|
|
8
|
-
`),r={hook_event_name:"PostToolUse",cwd:t.cwd,tool_name:s.toolName,tool_input:s.input,tool_result:n,tool_is_error:s.isError},{outcome:c}=await T(k,"PostToolUse",r,{cwd:t.cwd});if(c.error&&t.ui.notify(`PostToolUse hook: ${c.error}`,"warning"),!!c.context)return{content:[...s.content,{type:"text",text:`
|
|
9
|
-
[hook] ${c.context}`}],structuredContent:s.structuredContent}}),e.on("context_with_system",async s=>{if(!N)return;let t=s.messages[0];if(!t||t.role!=="system")return;let n=`${C(t.content)}
|
|
10
|
-
|
|
11
|
-
${N}`;return{messages:s.messages.map(c=>c===t?{...t,content:D(t.content,n)}:c)}}),e.on("session_before_compact",async(s,t)=>{if(!k.hooks.PreCompact)return;let{outcome:n}=await T(k,"PreCompact",{hook_event_name:"PreCompact",cwd:t.cwd,compact_reason:s.reason},{cwd:t.cwd});n.error&&t.ui.notify(`PreCompact hook: ${n.error}`,"warning")}),e.on("session_shutdown",async(s,t)=>{if(!k.hooks.SessionEnd)return;let{outcome:n}=await T(k,"SessionEnd",{hook_event_name:"SessionEnd",cwd:t.cwd,reason:s.reason},{cwd:t.cwd});n.error&&t.ui.notify(`SessionEnd hook: ${n.error}`,"warning")}),e.on("agent_settled",async(s,t)=>{if(!k.hooks.Stop)return;let{outcome:n}=await T(k,"Stop",{hook_event_name:"Stop",cwd:t.cwd},{cwd:t.cwd});n.error&&t.ui.notify(`Stop hook: ${n.error}`,"warning")})}}var Ct=new Set(["bash","grep","find","ls","bash_output","powershell"]),Dt=new Set(["bash","bash_output","powershell"]),Nt=40,Ft=12,Mt=8,nt=6;function It(e,o){let s=e.trim();return!!(s===""||/^[-=*_~+#]{3,}$/.test(s)||o!==void 0&&e===o)}function tt(e){return e.replace(/\d+/g,"#").trimEnd()}function Lt(e){let o=[],s=0,t=0;for(;t<e.length;){let n=tt(e[t]);if(n===""||!/\d/.test(e[t])){o.push(e[t]),t+=1;continue}let r=t+1;for(;r<e.length&&tt(e[r])===n&&/\d/.test(e[r]);)r+=1;let c=r-t;if(c>=nt)o.push(e[t]),o.push(` \u2026 ${c-2} more line${c-2===1?"":"s"} of the same shape \u2026`),o.push(e[r-1]),s+=1;else for(let i=t;i<r;i+=1)o.push(e[i]);t=r}return{out:o,collapsed:s}}function Gt(e,o,s={}){if(o?.truncated)return;let t=e.split(`
|
|
12
|
-
`);if(t.length<Nt)return;let n=[],r=0;for(let g=0;g<t.length;g+=1){if(It(t[g],n[n.length-1])){if(t[g].trim()===""&&n[n.length-1]?.trim()!==""){n.push("");continue}r+=1;continue}n.push(t[g])}let c=s.toolName===void 0||Dt.has(s.toolName),{out:i,collapsed:d}=c?Lt(n):{out:n,collapsed:0},p=s.head??Ft,u=s.tail??Mt,l=i,a=0;if(i.length>p+u+nt&&(a=i.length-p-u,l=[...i.slice(0,p),` \u2026 ${a} line${a===1?"":"s"} omitted (${p} kept from the top, ${u} from the end) \u2026`,...i.slice(i.length-u)]),!(r+d===0&&a===0))return{text:l.join(`
|
|
13
|
-
`),stats:{before:t.length,after:l.length,collapsed:d}}}function ot(e){return o=>{o.on("tool_result",s=>{if(!e.enabled()||s.isError||!Ct.has(s.toolName))return;let t=s.content.find(i=>i.type==="text");if(!t||t.type!=="text")return;let n=s.details,r=Gt(t.text,n,{toolName:s.toolName});return r?{content:s.content.map(i=>i===t?{type:"text",text:r.text}:i)}:void 0})}}import{readdirSync as Ut,readFileSync as Bt,statSync as Ht}from"node:fs";import{extname as Wt,join as st,relative as zt,resolve as qt,sep as rt}from"node:path";import{Type as P}from"@netrodev/hxf-ai";import{defineTool as Zt}from"@netrodev/hxf-coding-agent";var Kt=new Set(["node_modules",".git","dist","build","out","coverage","vendor","target","__pycache__",".venv","venv",".next",".turbo",".cache"]),A={".ts":{kind:"ts",patterns:[/^\s*export\s+(?:default\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)/gm,/^\s*export\s+(?:abstract\s+)?class\s+([A-Za-z_$][\w$]*)/gm,/^\s*export\s+(?:interface|type)\s+([A-Za-z_$][\w$]*)/gm,/^\s*export\s+const\s+([A-Za-z_$][\w$]*)/gm,/^\s*(?:export\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)/gm,/^\s*(?:export\s+)?class\s+([A-Za-z_$][\w$]*)/gm]},".tsx":{kind:"tsx",patterns:[]},".js":{kind:"js",patterns:[]},".mjs":{kind:"js",patterns:[]},".go":{kind:"go",patterns:[/^func\s+(?:\([^)]*\)\s*)?([A-Za-z_]\w*)/gm,/^type\s+([A-Za-z_]\w*)\s+(?:struct|interface)/gm]},".py":{kind:"py",patterns:[/^(?:async\s+)?def\s+([A-Za-z_]\w*)/gm,/^class\s+([A-Za-z_]\w*)/gm]},".rs":{kind:"rs",patterns:[/^\s*(?:pub\s+)?(?:async\s+)?fn\s+([A-Za-z_]\w*)/gm,/^\s*(?:pub\s+)?(?:struct|enum|trait)\s+([A-Za-z_]\w*)/gm]}};A[".tsx"].patterns=A[".ts"].patterns;A[".js"].patterns=A[".ts"].patterns;A[".mjs"].patterns=A[".ts"].patterns;var Xt=512*1024,Yt=12;function Vt(e,o){let s=A[o];if(!s)return[];let t=new Set,n=[];for(let r of s.patterns){r.lastIndex=0;for(let c of e.matchAll(r)){let i=c[1];i&&!t.has(i)&&(t.add(i),n.push(i))}}return n}function Jt(e,o){let s=new Set,t=n=>{n&&(n.startsWith("./")||n.startsWith("../"))&&s.add(n)};if(o===".ts"||o===".tsx"||o===".js"||o===".mjs"){for(let n of e.matchAll(/(?:from|require\()\s*["']([^"']+)["']/g))t(n[1]);for(let n of e.matchAll(/^\s*import\s+["']([^"']+)["']/gm))t(n[1])}else if(o===".go")for(let n of e.matchAll(/^\s*(?:[\w.]+\s+)?"([^"]+)"/gm))t(n[1]);else if(o===".py")for(let n of e.matchAll(/^\s*from\s+(\.+[\w.]*)\s+import/gm)){let r=n[1].replace(/\./g,"/");t(r.startsWith("/")?`.${r}`:`./${r}`)}else if(o===".rs")for(let n of e.matchAll(/^\s*use\s+(?:crate|super|self)::([\w:]+)/gm))t(`./${n[1].split("::").join("/")}`);return[...s]}function Qt(e,o,s){let t=e.split("/").slice(0,-1).join("/"),n=st(t,o).split(rt).join("/").replace(/^\.\//,"");return[n,`${n}.ts`,`${n}.tsx`,`${n}.js`,`${n}.mjs`,`${n}.go`,`${n}.py`,`${n}.rs`,`${n}/index.ts`,`${n}/index.tsx`,`${n}/index.js`,`${n}/mod.rs`,`${n}.py`].find(c=>s.has(c))}function en(e,o="."){let s=[],t=(n,r)=>{if(r>Yt)return;let c;try{c=Ut(n,{withFileTypes:!0})}catch{return}for(let i of c){let d=st(n,i.name);if(i.isDirectory()){if(Kt.has(i.name)||i.name.startsWith("."))continue;t(d,r+1);continue}let p=Wt(i.name);if(A[p])try{if(Ht(d).size>Xt)continue;let u=Bt(d,"utf8"),l=zt(e,d).split(rt).join("/");s.push({path:l,symbols:Vt(u,p),imports:Jt(u,p)})}catch{}}};return t(qt(e,o),0),s}function tn(e,o){if(e.length===0)return[];let s=new Set(e.map(l=>l.path)),t=new Map(e.map((l,a)=>[l.path,a])),n=e.map(()=>[]),r=e.map(()=>[]);e.forEach((l,a)=>{for(let f of l.imports){let g=Qt(l.path,f,s);if(!g||g===l.path)continue;let w=t.get(g);w!==void 0&&(n[a].push(w),r[w].push(a))}});let c=e.length,i=o?.trim().toLowerCase(),d=e.map(l=>i&&`${l.path} ${l.symbols.join(" ")}`.toLowerCase().includes(i)?4/c:1/c),p=d.reduce((l,a)=>l+a,0),u=e.map((l,a)=>d[a]/p);for(let l=0;l<20;l++){let a=e.map((f,g)=>.15*(d[g]/p));for(let f=0;f<c;f++){if(n[f].length===0){for(let g=0;g<c;g++)a[g]+=.85*u[f]/c;continue}for(let g of n[f])a[g]+=.85*u[f]/n[f].length}u=a}return e.map((l,a)=>({file:l,score:u[a],match:i?`${l.path} ${l.symbols.join(" ")}`.toLowerCase().includes(i):!1})).sort((l,a)=>Number(a.match)-Number(l.match)||a.score-l.score||l.file.path.localeCompare(a.file.path)).map(l=>l.file)}function nn(e,o={}){let t=Math.max(200,Math.min(8e3,o.budget??1200))*4,n=tn(e,o.query),r=[],c=0;for(let d of n){let p=d.symbols.slice(0,8).join(", "),u=p?`${d.path}: ${p}`:`${d.path}`;if(c+u.length+1>t)break;r.push(u),c+=u.length+1}if(r.length===0)return"(no source files found)";let i=n.length-r.length;return i>0&&r.push(`\u2026 ${i} more file${i===1?"":"s"} not shown`),r.join(`
|
|
14
|
-
`)}var it;function at(e){it=e}var ct=Zt({name:"repo_map",label:"repo_map",description:"A ranked outline of the repository: files by importance with their top declarations. Use it to find where something lives before reading files, instead of listing directories.",promptSnippet:"repo_map: ranked file outline of the project",parameters:P.Object({path:P.Optional(P.String({description:"Subdirectory to map, relative to the project root"})),query:P.Optional(P.String({description:"Keyword to bias the ranking, e.g. 'billing'"})),budget:P.Optional(P.Number({description:"Token budget, default 1200"}))}),async execute(e,o){let s=it?.()??process.cwd(),t=en(s,o.path??".");return{content:[{type:"text",text:nn(t,{budget:o.budget,query:o.query})}],details:{files:t.length}}}});function z(){return{consecutiveFailures:0,tripped:!1}}function on(e,o){return o==="manual"?!1:e.consecutiveFailures>=3}function sn(e,o){if(o)return e;let s=e.consecutiveFailures+1;return{consecutiveFailures:s,tripped:e.tripped||s>=3}}function rn(){return z()}function an(e){return[`Auto-compaction failed ${e.consecutiveFailures} times in a row, so it is switched off for this session.`,"The context is over the limit and compaction cannot recover it. Start a new session, or switch to a model with a larger context window.","Manual /compact is still allowed."].join(" ")}var v=z();function lt(){return e=>{e.on("session_start",async()=>{v=z()}),e.on("session_compact",async()=>{v=rn()}),e.on("session_compact_failed",async(o,s)=>{let t=v;v=sn(v,o.aborted),!t.tripped&&v.tripped&&s?.ui&&s.ui.notify(an(v),"warning")}),e.on("session_before_compact",async o=>{if(on(v,o.reason))return{cancel:!0}})}}function cn(e){E(F(e))}function dt(e){return`budget exhausted (${e.budget??"default"} continuations)`}function pt(){return e=>{e.on("session_start",async(o,s)=>{cn(s)}),e.on("context_with_system",async(o,s)=>{let t=F(s);if(E(t),!t||t.status!=="active")return;let n=o.messages[0];if(!n||n.role!=="system")return;let r=`${C(n.content)}
|
|
15
|
-
|
|
16
|
-
${_e(t)}`;return{messages:o.messages.map(i=>i===n?{...n,content:D(n.content,r)}:i)}}),e.on("agent_before_settle",async(o,s)=>{try{let t=F(s);if(E(t),L(t).action==="stop"||!t||o.continue||!o.context.canContinue)return;let n={...t,used:t.used+1};if(e.appendEntry(I,n),E(n),L(n).action==="stop"){let r={...n,status:"done",note:dt(n)};e.appendEntry(I,r),E(r);return}return{entries:[{type:"custom_message",customType:Se,content:Te(n),display:!0}],continue:!0}}catch{return}}),e.on("agent_settled",async(o,s)=>{try{let t=F(s),n=L(t);if(t&&n.action==="stop"&&n.close){let r={...t,status:"done",note:dt(t)};e.appendEntry(I,r),E(r)}else E(t)}catch{return}})}}function ln(e){let o=Q(e);return o.length===0?"":["The user installed the following presets. Their rules apply to this session.","",...o.map(t=>`<preset name="${t.name}">
|
|
17
|
-
${t.text}
|
|
18
|
-
</preset>`)].join(`
|
|
19
|
-
`)}function ut(e){return o=>{o.on("resources_discover",async()=>{let s=J(e);return s.length>0?{skillPaths:s}:void 0}),o.on("context_with_system",async s=>{let t=ln(e);if(!t)return;let n=s.messages[0];if(!n||n.role!=="system")return;let r=`${C(n.content)}
|
|
20
|
-
|
|
21
|
-
${t}`;return{messages:s.messages.map(i=>i===n?{...n,content:D(n.content,r)}:i)}})}}import{Type as y}from"@netrodev/hxf-ai";import{defineTool as dn}from"@netrodev/hxf-coding-agent";function pn(){return[...G.values()].map(e=>`${e.name} (${e.description})`).join(", ")}function ft(){return dn({name:"task",label:"task",description:`Spawn subagents. Available: ${pn()}. One call can carry tasks[]; each item may set agent, model, effort and isolation. Agents run concurrently, park when done, and can be resumed or messaged with /agents. Pass background: true to return as soon as they start instead of waiting for them. Use architect to design an approach before a large change. Set isolation: "worktree" on every task that writes files.`,promptSnippet:"task: spawn background agents",parameters:y.Object({agent:y.Optional(y.String()),effort:y.Optional(y.String()),model:y.Optional(y.String()),task:y.Optional(y.String()),isolation:y.Optional(y.String()),background:y.Optional(y.Boolean()),tasks:y.Optional(y.Array(y.Object({agent:y.Optional(y.String()),effort:y.Optional(y.String()),model:y.Optional(y.String()),task:y.String(),isolation:y.Optional(y.String())})))}),executionMode:"parallel",async execute(e,o,s,t,n){let r=o.tasks&&o.tasks.length>0?o.tasks.map(f=>({agent:f.agent??o.agent??"task",task:f.task,effort:f.effort??o.effort,model:f.model??o.model,isolation:f.isolation??o.isolation})):[{agent:o.agent??"task",task:o.task??"",effort:o.effort,model:o.model,isolation:o.isolation}],c=r.slice(0,W),i=r.length-c.length,d=!!o.background,p=[],u=[],l=[],a=[];try{for(let m of c){if(!m.task.trim())continue;let h;if(m.isolation==="worktree"){let b=await Ke(n?.cwd??process.cwd(),m.agent);if(b){u.push(b),h=b.path;for(let j of b.skipped)a.push(`${m.agent}:${j}`)}else l.push(m.agent)}p.push(await ze({...m,cwd:n?.cwd,background:d,parentModel:We(n?.model),worktree:h})),t?.({content:[],details:{agents:p.map(b=>({id:b.id,agent:b.agent,status:b.status}))}})}if(p.length===0)throw new Error("task or tasks is required");let f=i>0?`(only the first ${W} of ${r.length} tasks ran)`:"",g=p.filter(m=>m.worktree).length,w=[f,l.length>0?`isolation: "worktree" was requested but not available for: ${l.join(", ")}. Those agents ran in the shared working tree \u2014 check their edits for collisions before trusting them.`:"",a.length>0?`too large to copy into the isolated worktree, so it was left out: ${a.join(", ")}. An agent that needs it cannot install or build \u2014 treat any "done" from those runs as unverified.`:""].filter(Boolean),S={agents:p.map(m=>({id:m.id,status:m.status,isolated:!!m.worktree}))};if(d){qe();let m=p.map(h=>`${h.agent}#${h.id}`).join(", ");return{content:[{type:"text",text:`started ${p.length} agent${p.length===1?"":"s"} in the background: ${m}.`+(g>0?` ${g} of them in their own worktree.`:"")+`
|
|
22
|
-
Their results are not part of this turn \u2014 keep working. Read them with /agents, or message one with /agents <id> <text>.`+(w.length>0?`
|
|
23
|
-
${w.join(`
|
|
24
|
-
`)}`:"")}],details:S}}await Ze(s);let _=p.map(m=>`${He(m)}${m.worktree?" [isolated]":""}
|
|
25
|
-
${m.result??""}`);return w.length>0&&_.push(w.join(`
|
|
26
|
-
`)),{content:[{type:"text",text:_.join(`
|
|
27
|
-
|
|
28
|
-
`)}],details:S}}finally{for(let f of u)try{await f.remove()}catch{}}}})}import{readFileSync as un,readdirSync as fn,statSync as mn}from"node:fs";import{dirname as gn,join as q}from"node:path";import{getAgentDir as hn,parseFrontmatter as wn}from"@netrodev/hxf-coding-agent";var mt=["off","minimal","low","medium","high","xhigh","max"],yn=["name","description","tools","model","effort"],bn=["read","bash","edit","write","grep","find","ls","bash_output","kill_shell","todo","context","goal","task","workflow","web_search","web_fetch","lsp","quality","claim","repo_map"],kn=["read","bash","edit","write","grep","find","ls","context","todo","web_search","web_fetch","lsp","claim"];function xn(e){let s=(typeof e=="string"?e.split(","):Array.isArray(e)?e:[]).map(t=>String(t).trim().replace(/^["']|["']$/g,"")).filter(Boolean);return s.length>0?s:void 0}function Sn(e){try{return mn(e).isDirectory()}catch{return!1}}function _n(e){let o=e;for(;;){let s=q(o,".howtofix","agents");if(Sn(s))return s;let t=gn(o);if(t===o)return;o=t}}function Tn(e){let o=[{scope:"user",dir:q(hn(),"agents")}],s=_n(e);return s&&o.push({scope:"project",dir:s}),o}function $n(e,o){let s=[],t=[],n=e.replace(/^\uFEFF/,"");if(!/^---\r?\n/.test(n))return{notes:s,problems:[`${o}: no frontmatter \u2014 the file must start with --- and end the block with ---`]};let r={},c="";try{let m=wn(n);r=m.frontmatter??{},c=(m.body??"").trim()}catch(m){return{notes:s,problems:[`${o}: the frontmatter is not readable YAML \u2014 ${m instanceof Error?m.message:String(m)}`]}}for(let m of Object.keys(r))yn.includes(m)||s.push(`${o}: ignoring the unknown frontmatter key '${m}'`);let i=(o.split(/[\\/]/).pop()??o).replace(/\.md$/i,""),d=r.name,p=(typeof d=="string"&&d.trim()?d:i).trim();/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(p)||t.push(`${o}: '${p}' is not a usable agent name \u2014 letters, digits, dot, dash and underscore only`);let u=r.description,l=typeof u=="string"?u.trim():"";l||t.push(`${o}: a description is required \u2014 it is how the model decides to use this agent`),c||t.push(`${o}: no prompt body \u2014 the text below the frontmatter is the agent's standing instruction`);let a=r.effort,f=typeof a=="string"?a.trim().toLowerCase():"";f&&!mt.includes(f)&&t.push(`${o}: effort '${f}' is not one of ${mt.join(", ")}`);let g=xn(r.tools),w=g??[...kn];if(g){let m=g.filter(h=>!bn.includes(h)&&!h.startsWith("mcp__"));m.length>0&&s.push(`${o}: unknown tool${m.length===1?"":"s"} ${m.join(", ")} \u2014 kept, but nothing registers them yet`)}let S=r.model,_=typeof S=="string"&&S.trim()?S.trim():void 0;return t.length>0?{notes:s,problems:t}:{def:{name:p,description:l,tools:w,prompt:c,effort:f||"medium",model:_,source:o},notes:s,problems:t}}function gt(e,o){let s=[],t=[],n=[],r=[];for(let{scope:c,dir:i}of Tn(e)){let d;try{d=fn(i)}catch{continue}for(let p of d.filter(u=>u.toLowerCase().endsWith(".md")).sort()){let u=q(i,p),l;try{l=un(u,"utf8")}catch(g){n.push(`${u}: ${g instanceof Error?g.message:String(g)}`);continue}let a=$n(l,u);t.push(...a.notes),n.push(...a.problems);let f=a.def;f&&(o.has(f.name)&&t.push(`${u}: replaces ${Be.has(f.name)?"the built-in":"an earlier"} '${f.name}'`),o.set(f.name,f),s.push(f),r.includes(c)||r.push(c))}}if(s.length>0){let c=s.filter(i=>o.get(i.name)===i);t.unshift(`loaded ${c.length} subagent definition${c.length===1?"":"s"} (${r.join(" and ")}): ${c.map(i=>i.name).join(", ")}`)}return{loaded:s,notes:t,problems:n}}var En=["grep","find","ls","bash_output","kill_shell"];async function ht(e,{timeoutMs:o=2e3,quietTicks:s=2}={}){let t=Date.now()+o,n=e.getActiveToolNames().length,r=0;for(;Date.now()<t&&r<s;){await new Promise(i=>setTimeout(i,50));let c=e.getActiveToolNames().length;c>n?(n=c,r=0):r+=1}}function wt(e){let o=new Set(e.getActiveToolNames()),s=new Set(e.getAllTools().map(n=>n.name)),t=[];for(let n of En)s.has(n)&&!o.has(n)&&(o.add(n),t.push(n));return t.length>0&&e.setActiveToolsByName([...o]),t}import{spawnSync as An}from"node:child_process";import{join as vn}from"node:path";import{defineTool as jn}from"@netrodev/hxf-coding-agent";var On=6e3,yt=jn({name:"slop",label:"slop",description:"Check code against the project's slop gate: naming, comments, placeholder values, swallowed errors, and the LLM tells that appear in model-written code. Read-only. Use it before reporting a task finished; it returns each finding as a rule id, a line, and what is wrong, so a claim of clean code becomes something the user can verify. Defaults to the changed files; pass a path to narrow it.",promptSnippet:"slop: naming, comment and placeholder findings for changed code",parameters:$.Object({path:$.Optional($.String({description:"One file or directory, relative to the project root. Omit to scan the changed set."})),changes:$.Optional($.Boolean({description:"Scan only files changed against the base ref. Default true when path is omitted."})),base:$.Optional($.String({description:"Git ref for `changes`. Defaults to HEAD."}))}),async execute(e,o,s,t,n){let r=n.cwd??process.cwd(),i=[vn(r,"scripts","slop.mjs"),"--json"];o.path!==void 0?i.push(o.path):(o.changes??!0)&&i.push("--changes"),o.base!==void 0&&i.push("--base",o.base);let d=An("node",i,{cwd:r,encoding:"utf8",timeout:12e4}),p;try{p=JSON.parse(d.stdout)}catch{p=void 0}if(!p){let w=(d.stderr||d.stdout||"").trim()||d.error?.message||(d.signal?`killed by ${d.signal} (timed out after 120 s?)`:"no output");return{content:[{type:"text",text:`slop gate produced no report: ${w.slice(0,400)}`}],details:{error:w.slice(0,400)}}}if(p.off)return{content:[{type:"text",text:"slop gate is off"}],details:{off:!0}};let u=p.files??{},l=[],a=0;for(let[w,S]of Object.entries(u)){l.push(`${w}`);for(let _ of S)a+=1,l.push(` ${_.rule} L${_.line} ${_.message}`)}if(a===0)return{content:[{type:"text",text:"slop gate: no findings in the scanned files"}],details:{files:Object.keys(u).length,findings:0}};let f=l.join(`
|
|
29
|
-
`).slice(0,On),g=f.length<l.join(`
|
|
30
|
-
`).length?`
|
|
31
|
-
\u2026 truncated`:"";return{content:[{type:"text",text:`${a} finding${a===1?"":"s"}:
|
|
32
|
-
|
|
33
|
-
${f}${g}`}],details:{files:Object.keys(u).length,findings:a}}}});function Z(e){return e.extensionRunner.emit({type:"session_shutdown",reason:"quit"}).catch(()=>{}).finally(()=>e.dispose())}import{readdir as bt,rmdir as Pn,stat as Rn,unlink as Cn}from"node:fs/promises";import{dirname as Dn,join as K,resolve as kt}from"node:path";async function xt(e={}){let o={removed:[],failed:[],removedDirs:[]},s=K(e.agentDir??x,"sessions"),t=(e.now??Date.now())-Ye*24*60*60*1e3,n=e.keep?kt(e.keep):void 0,r;try{r=await bt(s,{withFileTypes:!0})}catch{return o}for(let c of r){if(!c.isDirectory())continue;let i=K(s,c.name),d;try{d=await bt(i)}catch{continue}let p=d.filter(u=>!u.endsWith(".jsonl"));for(let u of d){if(!u.endsWith(".jsonl"))continue;let l=K(i,u),a;try{n&&kt(l)===n?a=!1:a=(await Rn(l)).mtimeMs<t}catch{a=!1}if(!a){p.push(u);continue}try{await Cn(l),o.removed.push(l)}catch{o.failed.push(l),p.push(u)}}if(p.length===0){if(n&&Dn(n)===i)continue;try{await Pn(i),o.removedDirs.push(i)}catch{}}}return o}var X="howtofix.build",Ss=["read","repo_map","bash","edit","write","grep","find","ls","bash_output","kill_shell","task","think","ask","claim","sessions","todo","context","goal","enter_plan_mode","exit_plan_mode","workflow","web_search","web_fetch","lsp","quality","compress","slop"],Un=()=>({exclude:process.platform==="win32"?[]:["powershell"]}),_t=!1;async function _s(e){let o=Gn.create(e.cwd,x,{projectTrusted:!0}),s=de(x).compressToolOutput,t=e.sessionPath?U.open(e.sessionPath):e.noSession?U.inMemory(e.cwd):e.continueSession?U.continueRecent(e.cwd):U.create(e.cwd),n=(()=>{try{let b=t.getEntries().find(j=>j.type==="custom"&&j.customType===X)?.data?.version;return!b||b===M?void 0:`this session was written by HowToFix ${b}; you are running ${M}`}catch{return}})(),r=new Ln({cwd:e.cwd,agentDir:x,settingsManager:o,appendSystemPrompt:Je(Y,e.interactive??!0),additionalSkillPaths:ee(e.cwd),extensionFactories:[Ee(),se(),Qe(),et(),De(),Oe(),ut(e.cwd),pt(),Ae(),lt(),Mn(),ot({enabled:()=>s}),In({loadConfig:h=>le({cwd:h.cwd,projectTrusted:h.isProjectTrusted?.()??!1})})]});await r.reload();let c=gt(e.cwd,G),i=ft(),d=t.getSessionId();at(()=>e.cwd);let p=St(x,ue);we({root:()=>e.cwd,holder:()=>`session:${d}`,presenceDir:()=>p,selfId:()=>d});let u=()=>{try{fe({dir:p},{id:d,cwd:e.cwd,host:Nn(),pid:process.pid,at:Date.now()})}catch{}};u();let l=setInterval(u,Math.max(5e3,Math.floor(pe/3)));l.unref?.();let a=await Fn({cwd:e.cwd,agentDir:x,settingsManager:o,sessionManager:t,resourceLoader:r,excludeTools:Un().exclude,customTools:[i,ct,ge,he,be,ye,ke,xe,$e,ve,je,Xe(),Ne,Fe,Ie,Le,yt,Pe({state:()=>Re(H()??"dcp-sessionless"),messages:()=>Ce(H()??"dcp-sessionless")})],thinkingLevel:e.thinking});await a.session.bindExtensions({mode:"print",onError:()=>{}});let f=ne(x),g=[];if(f){let h=await oe(x,f);h.renewed?await a.session.modelRuntime.setRuntimeApiKey("howtofix",h.credential.accessToken):(h.terminal&&h.message||h.message)&&g.push(h.message)}await ht(a.session),wt(a.session);let w=a.session.model;if(e.model){let h=await a.session.modelRuntime.getAvailable(),b=Ge(h,e.model);if(!b)throw await Z(a.session),new Error(`unknown model '${e.model}'`);(w?.id!==b.id||w.provider!==b.provider)&&(await a.session.setModel(b),w=a.session.model)}else{let h=await a.session.modelRuntime.getAvailable(),b=new Map,j=[];for(let O of h){let R=b.get(O.provider);R===void 0&&(R=!!(await a.session.modelRuntime.getAuth(O.provider))?.auth?.apiKey,b.set(O.provider,R)),R&&j.push(O)}let B=te;if(!B.includes(w?.provider??"")){let O=Ue(j.filter(R=>B.includes(R.provider)),B);O&&(await a.session.setModel(O),w=a.session.model)}}if(!e.noSession&&t.getEntries().every(h=>h.type!=="custom"||h.customType!==X))try{t.appendCustomEntry(X,{version:M})}catch{}_t||(_t=!0,xt({keep:a.session.sessionFile}).catch(()=>{}));let S=w?`${w.provider}/${w.id}`:"no model",_=!!(w&&w.cost&&(w.cost.input>0||w.cost.output>0)),m=[V(a.modelFallbackMessage),...g,...c.notes,...c.problems].filter(h=>!!h);return w||m.push(`no model configured. run \`howtofix\` and use /login, or edit ${St(x,"models.json")}`),{session:a.session,dispose:async()=>{Me(),await Z(a.session),clearInterval(l),me({dir:p},d)},modelLabel:S,priced:_,setCompressToolOutput:h=>{s=h},note:[n,...m].filter(Boolean).join(`
|
|
34
|
-
`)||void 0}}export{X as BUILD_ENTRY,Ss as MAIN_TOOLS,_s as openSession};
|
package/dist/chunk-MVLCGU3G.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk-BHVBO4SC.js";import"./chunk-WOT6VMZA.js";export{a as deadChannelModel,b as diagnoseGatewayFailure};
|
package/dist/chunk-N345KWWK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d}from"./chunk-PCALBZOO.js";import"./chunk-WOT6VMZA.js";export{c as describeSandbox,a as detectSandbox,d as enterSandbox,b as sandboxArgv};
|
package/dist/chunk-ORJ2QZBG.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{readFileSync as f,statSync as u}from"node:fs";import{isAbsolute as a,resolve as p}from"node:path";var $=64*1024;function S(o,c){return o.replace(/(^|\s)@([^\s]+)/g,(e,l,i)=>{let t=i.replace(/[),.;:]+$/,""),g=i.slice(t.length),n=a(t)?t:p(c,t);try{let r=u(n);if(!r.isFile()||r.size===0||r.size>$)return e;let s=f(n);return s.includes(0)?e:`${l}<file name="${n}">
|
|
2
|
-
${s.toString("utf8").trimEnd()}
|
|
3
|
-
</file>${g}`}catch{return e}})}export{S as a};
|
package/dist/chunk-PCALBZOO.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{spawnSync as s}from"node:child_process";import{accessSync as d,constants as b}from"node:fs";import{join as l}from"node:path";function c(r){try{return d(r,b.X_OK),!0}catch{return!1}}function w(r=process.platform,e=process.env.PATH??""){let n=e.split(":").filter(Boolean),o=t=>n.map(i=>l(i,t)).find(c);if(r==="linux"){let t=o("bwrap");return t&&s(t,["--ro-bind","/","/","--","true"],{stdio:"ignore",timeout:3e3}).status===0?"bubblewrap":void 0}if(r==="darwin")return o("sandbox-exec")?"seatbelt":void 0}function a(r,e){return r==="bubblewrap"?["bwrap","--die-with-parent","--new-session","--ro-bind","/","/","--dev","/dev","--proc","/proc","--tmpfs","/tmp","--bind",e.cwd,e.cwd,"--bind",e.agentDir,e.agentDir,"--chdir",e.cwd,"--",...e.argv]:["sandbox-exec","-p",["(version 1)","(deny default)","(allow process*)","(allow signal)","(allow sysctl-read)","(allow mach-lookup)","(allow network*)","(allow file-read*)",`(allow file-write* (subpath "${e.cwd}") (subpath "${e.agentDir}") (subpath "/tmp") (subpath "/private/tmp") (subpath "/private/var/folders"))`,""].join(`
|
|
2
|
-
`),...e.argv]}function x(r){return r==="bubblewrap"?"sandbox: bubblewrap \u2014 project writable, rest of the filesystem read-only":"sandbox: seatbelt \u2014 project writable, rest of the filesystem read-only"}function g(r,e){let n=s(a(r,e)[0],a(r,e).slice(1),{stdio:"inherit",env:{...process.env,HOWTOFIX_SANDBOXED:"1"}});return n.error?(console.error(`sandbox: could not start ${r}: ${n.error.message}`),1):n.status??1}export{w as a,a as b,x as c,g as d};
|
package/dist/chunk-QERX2QO6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i}from"./chunk-VXTUPGAD.js";import"./chunk-UTYFLLSM.js";import"./chunk-DMNE4TU6.js";import"./chunk-C6HY4Q4J.js";import"./chunk-WOT6VMZA.js";export{b as CLI_REFRESH_SKEW_MS,c as accessTokenIsFresh,g as clearCliCredential,a as cliCredentialsPath,e as readCliCredential,h as refreshCliCredential,d as refreshTokenIsUsable,i as renewCliCredentialIfNeeded,f as writeCliCredential};
|