qriton 0.3.1 → 0.3.2
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 +11 -11
- package/dist/qriton.js +1 -1
- package/docs/energy.md +1 -1
- package/docs/hlm.md +2 -2
- package/docs/network-policy.md +1 -1
- package/docs/shield.md +1 -1
- package/docs/workspace-trust.md +2 -2
- package/package.json +1 -1
- package/release/contract.json +1 -1
package/README.md
CHANGED
|
@@ -44,13 +44,13 @@ Qriton CLI keeps the evidence of a coding session attached to the session. You c
|
|
|
44
44
|
|
|
45
45
|
**Hopfield recall.** `qriton pull bge-m3` installs the embedding model. With embeddings enabled, recall also reads the query against an energy landscape. A low-energy query matches a known basin. A high-energy query is new. A query between two basins — eureka — returns both. `/memory probe` compares ordinary recall with that reading. Keyword and graph recall remain available without embeddings.
|
|
46
46
|
|
|
47
|
-
**HLM.** The [HLM workbench](docs/hlm.md) keeps a base model's weights frozen and applies a reversible memory overlay: preview, compare the next token, apply, evaluate, restore. The operation is on the local model. It does not replace the model conducting the coding session.
|
|
47
|
+
**HLM.** The [HLM workbench](https://unpkg.com/qriton/docs/hlm.md) keeps a base model's weights frozen and applies a reversible memory overlay: preview, compare the next token, apply, evaluate, restore. The operation is on the local model. It does not replace the model conducting the coding session.
|
|
48
48
|
|
|
49
|
-
**Energy Language.** The [Energy Language workbench](docs/energy.md) is programmable memory for a supported Hopfield checkpoint. Edits are staged, evaluated, and restored from bounded scripts. The source checkpoint is preserved.
|
|
49
|
+
**Energy Language.** The [Energy Language workbench](https://unpkg.com/qriton/docs/energy.md) is programmable memory for a supported Hopfield checkpoint. Edits are staged, evaluated, and restored from bounded scripts. The source checkpoint is preserved.
|
|
50
50
|
|
|
51
51
|
**Research with sources.** `research` queries several angles, reads the selected pages, and returns the passages that address the question, with numbered sources.
|
|
52
52
|
|
|
53
|
-
**A session you can resume.** `qriton --continue` restores the latest session in this directory. `/sessions` lists them. See [session recovery](docs/session-recovery.md). `qriton capabilities` reports what is installed, without loading a model.
|
|
53
|
+
**A session you can resume.** `qriton --continue` restores the latest session in this directory. `/sessions` lists them. See [session recovery](https://unpkg.com/qriton/docs/session-recovery.md). `qriton capabilities` reports what is installed, without loading a model.
|
|
54
54
|
|
|
55
55
|
The runtime adds the terminal interface, provider SDKs, Hopfield analysis, and controlled HTTP.
|
|
56
56
|
|
|
@@ -91,7 +91,7 @@ qriton --model openai/gpt-5-mini
|
|
|
91
91
|
export OPENAI_BASE_URL=https://openrouter.ai/api/v1 # also Groq, vLLM, LM Studio
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
Set `network.allowHostedFallback` in user configuration when a hosted model should be available alongside Ollama. A managed machine can run shell, Git, and Python through the container profile in the [deployment guide](docs/production-operations.md).
|
|
94
|
+
Set `network.allowHostedFallback` in user configuration when a hosted model should be available alongside Ollama. A managed machine can run shell, Git, and Python through the container profile in the [deployment guide](https://unpkg.com/qriton/docs/production-operations.md).
|
|
95
95
|
|
|
96
96
|
Check everything is wired up:
|
|
97
97
|
|
|
@@ -117,7 +117,7 @@ qriton --image shot.png "what is wrong here"
|
|
|
117
117
|
|
|
118
118
|
Writes and shell commands are confirmed before they run. Use `/auto on` to run them without approval prompts for this session, and `/auto off` to restore confirmations. `/auto` toggles, and `Shift+Tab` cycles modes only when the composer is empty and idle. In an open list it moves to the previous choice. The footer always shows the current mode and auto-run status.
|
|
119
119
|
|
|
120
|
-
[Network policy](docs/network-policy.md) can limit destinations to this machine or to an exact list of origins. A restricted profile runs shell, Git, and Python through the [container profile](docs/production-operations.md).
|
|
120
|
+
[Network policy](https://unpkg.com/qriton/docs/network-policy.md) can limit destinations to this machine or to an exact list of origins. A restricted profile runs shell, Git, and Python through the [container profile](https://unpkg.com/qriton/docs/production-operations.md).
|
|
121
121
|
|
|
122
122
|
You can also use `/mode` or a startup flag:
|
|
123
123
|
|
|
@@ -160,7 +160,7 @@ Choose a discovered server with Enter, or use `/server <url>`. Qriton verifies i
|
|
|
160
160
|
|
|
161
161
|
Type `/` to discover commands. `↑`/`↓` moves the highlighted suggestion, `Tab` fills it, and `Esc` closes suggestions without clearing the draft. `Enter` fills a partial command first; press it again to run the completed command. Common options are suggested too: try `/theme `, `/mode `, `/auto `, `/queue ` or `/auth `.
|
|
162
162
|
|
|
163
|
-
`/sessions` opens a searchable list of conversations in the current workspace. Filter by title, model or ID; use arrows or `Tab`/`Shift+Tab` to navigate, `Enter` to resume, and `Esc` to return. The footer shows shortcuts for the active control. See [terminal interaction principles](docs/terminal-interaction.md) for the keyboard contract and current scope.
|
|
163
|
+
`/sessions` opens a searchable list of conversations in the current workspace. Filter by title, model or ID; use arrows or `Tab`/`Shift+Tab` to navigate, `Enter` to resume, and `Esc` to return. The footer shows shortcuts for the active control. See [terminal interaction principles](https://unpkg.com/qriton/docs/terminal-interaction.md) for the keyboard contract and current scope.
|
|
164
164
|
|
|
165
165
|
| | |
|
|
166
166
|
|---|---|
|
|
@@ -211,7 +211,7 @@ Resuming a session restores its model unless `--model` overrides it. The current
|
|
|
211
211
|
|
|
212
212
|
Both are optional and run locally. Python and PyTorch are installed separately. The model conducting the coding session is unchanged.
|
|
213
213
|
|
|
214
|
-
HLM keeps a published base model frozen and stages a memory overlay. `qriton hlm catalog` lists the releases. The [walkthrough](docs/hlm.md) covers setup.
|
|
214
|
+
HLM keeps a published base model frozen and stages a memory overlay. `qriton hlm catalog` lists the releases. The [walkthrough](https://unpkg.com/qriton/docs/hlm.md) covers setup.
|
|
215
215
|
|
|
216
216
|
```sh
|
|
217
217
|
qriton hlm compare hlm5-1b "The capital of Veldoria is"
|
|
@@ -221,7 +221,7 @@ qriton hlm evaluate <proposal-id>
|
|
|
221
221
|
qriton hlm restore <proposal-id>
|
|
222
222
|
```
|
|
223
223
|
|
|
224
|
-
Energy Language does the reversible edit for a supported Hopfield checkpoint, using a bounded script. The [guide](docs/energy.md) covers the runtime and the evaluation suite. Apply and restore ask for approval.
|
|
224
|
+
Energy Language does the reversible edit for a supported Hopfield checkpoint, using a bounded script. The [guide](https://unpkg.com/qriton/docs/energy.md) covers the runtime and the evaluation suite. Apply and restore ask for approval.
|
|
225
225
|
|
|
226
226
|
```sh
|
|
227
227
|
qriton energy doctor
|
|
@@ -251,7 +251,7 @@ Read-only tools run in parallel and never prompt. Everything else is serialised
|
|
|
251
251
|
|
|
252
252
|
## Configuration
|
|
253
253
|
|
|
254
|
-
`~/.qriton/config.json`, or `.qriton/config.json` in a project to override per workspace. Project configuration requires an explicit grant: run `qriton trust show`, review the file, then `qriton trust grant <fingerprint>`. Changes require a new grant. `qriton doctor policy` inspects effective settings and their origins offline; `/policy` shows the active session. See [workspace configuration trust](docs/workspace-trust.md).
|
|
254
|
+
`~/.qriton/config.json`, or `.qriton/config.json` in a project to override per workspace. Project configuration requires an explicit grant: run `qriton trust show`, review the file, then `qriton trust grant <fingerprint>`. Changes require a new grant. `qriton doctor policy` inspects effective settings and their origins offline; `/policy` shows the active session. See [workspace configuration trust](https://unpkg.com/qriton/docs/workspace-trust.md).
|
|
255
255
|
|
|
256
256
|
`qriton` already starts on `qwen3.5:4b`. Save this file to keep an 8K context and embeddings for later sessions. `qriton --light` still applies the bounded session for a single run, with keyword memory for that run. The `model` field also accepts `grok-4.6`, `anthropic/claude-opus-5`, `openai/gpt-5-mini`, or any model served through `OPENAI_BASE_URL`.
|
|
257
257
|
|
|
@@ -355,7 +355,7 @@ The `reasoning` setting chooses whether a model's scratchpad is shown in its own
|
|
|
355
355
|
|
|
356
356
|
## Development
|
|
357
357
|
|
|
358
|
-
Local [Shield scanning](docs/shield.md) checks retrieved content and withholds recognized credentials. `qriton shield status` and `qriton shield scan SKILL.md` run offline.
|
|
358
|
+
Local [Shield scanning](https://unpkg.com/qriton/docs/shield.md) checks retrieved content and withholds recognized credentials. `qriton shield status` and `qriton shield scan SKILL.md` run offline.
|
|
359
359
|
|
|
360
360
|
```bash
|
|
361
361
|
npm run dev # esbuild watch
|
|
@@ -369,4 +369,4 @@ npm run typecheck
|
|
|
369
369
|
|
|
370
370
|
MIT
|
|
371
371
|
|
|
372
|
-
The [deployment guide](docs/production-operations.md) covers installation, the container profile, memory authorization, backup and restore, and rollback.
|
|
372
|
+
The [deployment guide](https://unpkg.com/qriton/docs/production-operations.md) covers installation, the container profile, memory authorization, backup and restore, and rollback.
|
package/dist/qriton.js
CHANGED
|
@@ -1086,7 +1086,7 @@ if __name__ == '__main__':
|
|
|
1086
1086
|
except Exception as error:
|
|
1087
1087
|
print(json.dumps({'ok': False, 'error': str(error)}))
|
|
1088
1088
|
sys.exit(1)
|
|
1089
|
-
`;import{constants as uYe}from"node:fs";import{chmod as dYe,copyFile as hYe,mkdir as Dde,open as fYe,rename as gYe,rm as pYe,stat as aT}from"node:fs/promises";import{join as cL,resolve as kde}from"node:path";import{randomUUID as mYe}from"node:crypto";var Rde=[{id:"hlm5-1b",repo:"qriton/hlm5-1b-trunk",revision:"b761f94844b800e0f7e46f4cd2c77ab03d548684",format:"hlm5-pt",description:"Frozen HLM5 trunk: local inference and certificate-governed single-token memory edits.",editing:!0,files:[{name:"hlm5_lm_baseline_fineweb_g3_final.pt",bytes:4178834297,sha256:"3e1c94d28125c2f86f3eeca030db3610f2fa679512c29c6b6608b24fc363e0f1"},{name:"fineweb-65536-compat.json",bytes:2001146,sha256:"15993635191a1c5f1a5dc7aeaacbdf9a44a45d90abef954fc77b686f4fbbe588"},{name:"LICENSE",bytes:3751,sha256:"ed69bc3c8be8abfcd7db18f3ba48a736a50fc87e4627c9927b1150bf2645ceef"},{name:"README.md",bytes:4781,sha256:"4906e419e830284eefa5df4ac70576e6cf2fdd6b59684d9d90ea613871826875"}]},{id:"hlm5-1b-hybrid",repo:"qriton/hlm5-1b-trunk",revision:"b761f94844b800e0f7e46f4cd2c77ab03d548684",format:"hlm5-pt",description:"Co-trained memory arm for local inference and controlled editing comparisons.",editing:!0,files:[{name:"hlm5_lm_hybrid_fineweb_g3_final.pt",bytes:4208213095,sha256:"16b14b294514d4af938c1aa50d3a4cf8f49d6aeeea742a5d6ff87c61c80865bb"},{name:"fineweb-65536-compat.json",bytes:2001146,sha256:"15993635191a1c5f1a5dc7aeaacbdf9a44a45d90abef954fc77b686f4fbbe588"},{name:"LICENSE",bytes:3751,sha256:"ed69bc3c8be8abfcd7db18f3ba48a736a50fc87e4627c9927b1150bf2645ceef"},{name:"README.md",bytes:4781,sha256:"4906e419e830284eefa5df4ac70576e6cf2fdd6b59684d9d90ea613871826875"}]},{id:"hlm5-3b",repo:"qriton/hlm5-3b-base",revision:"d4b82f1c7073fe623e312d3ec28f30b1a2bd4b5a",format:"hlm5-safetensors",description:"Larger base model for local inference; editing is not enabled for this release.",editing:!1,files:[{name:"config.json",bytes:482,sha256:"d9bb8e074de2908818015f6fac6dc34383c0fec4f4e1faa2f577f69bb20f4d52"},{name:"model.safetensors.index.json",bytes:30126,sha256:"56fdc598997569c049ed3115ce749999db866f3be750821c3abb3e692a61c3ef"},{name:"model-00001-of-00003.safetensors",bytes:3750271968,sha256:"071b079c8ff30e12827e83b2b6bed0198af250f57cffdaf71640b2fde1ca9145"},{name:"model-00002-of-00003.safetensors",bytes:3697832816,sha256:"f3a2367ce5647e267e8f80f6ee2849d35bf0275f4025dc6f56a351ef730275d6"},{name:"model-00003-of-00003.safetensors",bytes:3304121008,sha256:"3a28e206d3c6ed0f0fb0219e51045b957f80f908763a6adf3d249d80330bcb65"},{name:"tokenizer.json",bytes:2066108,sha256:"5d8dd8050b6beffbb546f9eb85253a8e858afe694e305c7d3500cf47d2e5efa9"},{name:"LICENSE",bytes:3685,sha256:"fd34fc9d979b97d0fb49228c4247311f7f565fc6cfbf3c75947cbdfb0513ac45"},{name:"README.md",bytes:2697,sha256:"ac74a7a48dfc9aad70bb76426dec7fdb4af59bc7f8de26fe450f47df24dd72cb"}]}];import{createHash as oYe}from"node:crypto";import{mkdir as aYe,readFile as lYe,stat as AYe}from"node:fs/promises";import{join as cYe}from"node:path";var gc=t=>oYe("sha256").update(JSON.stringify(t)).digest("hex"),dA=(t,...e)=>zn(t,cYe(".qriton","hlm",...e)),lL=t=>typeof t=="string"&&/^[a-f0-9]{64}$/.test(t);function AL(t){if(!/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/.test(t))throw new Error("Invalid HLM proposal id.");return t}async function fI(t){if((await AYe(t)).size>1e6)throw new Error("HLM metadata exceeds 1 MB.");return JSON.parse(await lYe(t,"utf8"))}async function oT(t,e){await aL(t,e)}async function kp(t,e,n){return n?.throwIfAborted(),await aYe(dA(t),{recursive:!0,mode:448}),oL(dA(t,"operation.sqlite"),dA(t,"operation.lock"),e,n)}var EYe=Rde,yYe=[{repo:"qriton/hlm-micro-gesture-v2-uwave",task:"Accelerometer gesture classification"},{repo:"qriton/hlm-micro-har-v1-uci-har",task:"Human activity classification"},{repo:"qriton/hlm-micro-keyword-v1-speechcommands",task:"Audio keyword classification"},{repo:"qriton/hlm-vision-mix-cifar10",task:"CIFAR-10 image classification"},{repo:"qriton/hlm-spatial-modelnet10-small",task:"ModelNet10 3D classification"}].map(t=>({...t,supportedHere:!1,reason:"Requires its task-specific inputs and evaluation; not a coding or language model."})),uL=class{constructor(e,n=EYe,r=Bp){this.cwd=e;this.entries=n;this.request=r}cwd;entries;request;entry(e){let n=this.entries.find(r=>r.id===e);if(!n)throw new Error(`Unknown HLM model: ${e}. Use hlm catalog.`);return n}async catalog(){return{models:await Promise.all(this.entries.map(async e=>({...e,bytes:e.files.reduce((n,r)=>n+r.bytes,0),installed:await aT(dA(this.cwd,"models",e.id,"manifest.json")).then(()=>!0,()=>!1),url:`https://huggingface.co/${e.repo}`}))),related:yYe,note:"Pinned Qriton releases. Base language models are exposed for evaluation and completion, not as instruction-following coding providers."}}async get(e,n){let r=this.entry(e),s=dA(this.cwd,"models",e),i;try{i=await fI(zn(this.cwd,cL(s,"manifest.json")))}catch(l){throw l.code==="ENOENT"?new Error(`Model ${e} is not installed. Use hlm import or hlm fetch.`):l}if(gc(i)!==gc(r))throw new Error("Installed model manifest differs from its pinned release. Re-import into a clean model directory.");for(let l of r.files){let c=zn(this.cwd,cL(s,l.name));if((await aT(c)).size!==l.bytes||await Ao(c,n)!==l.sha256)throw new Error(`HLM asset integrity check failed: ${l.name}`)}return{...r,directory:s,fingerprint:gc(r)}}async install(e,n,r,s=()=>{}){let i=this.entry(e);return kp(this.cwd,async()=>{let l=dA(this.cwd,"models",e);try{return await aT(l),await this.get(e,r)}catch(h){if(h.code!=="ENOENT")throw h}await Dde(dA(this.cwd,"models"),{recursive:!0,mode:448});let c=dA(this.cwd,"models",`${e}-${mYe()}`);await Dde(c,{mode:448});try{for(let h of i.files){r?.throwIfAborted(),s(`${n?"Importing":"Downloading"} ${h.name} (${Math.ceil(h.bytes/1048576)} MB)`);let f=zn(this.cwd,cL(c,h.name));if(n){let m=kde(this.cwd,n,h.name);if(h.name==="fineweb-65536-compat.json")try{await aT(m)}catch(C){if(C.code!=="ENOENT")throw C;m=kde(this.cwd,n,"tokenizers",h.name)}await hYe(m,f,uYe.COPYFILE_FICLONE)}else{let m=`https://huggingface.co/${i.repo}/resolve/${i.revision}/${h.name}`,C=await this.request(m,{signal:AbortSignal.any([r??new AbortController().signal,AbortSignal.timeout(30*6e4)])});if(!C.ok||!C.body)throw await C.body?.cancel(),new Error(`Model download failed: HTTP ${C.status} (${h.name})`);let y=await fYe(f,"wx",384),Q=0;try{for await(let b of C.body){if(r?.throwIfAborted(),Q+=b.byteLength,Q>h.bytes)throw new Error(`Downloaded asset exceeds pinned size: ${h.name}`);let S=0;for(;S<b.length;)S+=(await y.write(b,S,b.length-S)).bytesWritten}}finally{await y.close()}}if((await aT(f)).size!==h.bytes||await Ao(f,r)!==h.sha256)throw new Error(`HLM asset integrity check failed: ${h.name}`);await dYe(f,384)}r?.throwIfAborted(),await oT(cL(c,"manifest.json"),i),await gYe(c,l)}finally{await pYe(c,{recursive:!0,force:!0})}return{...i,directory:l,fingerprint:gc(i)}},r)}};function Bz(t){let e=t.split(/\r?\n/).map(l=>l.trim()).filter(l=>l&&!l.startsWith("#"));if(e.length!==1)throw new Error("Use one memorize, correct, or forget command per HLM5 preview.");let n=/^(memorize|correct|forget)\s+(.+)$/.exec(e[0]);if(!n)throw new Error('Expected: memorize "key prompt" " target token", correct "key prompt" " target token", or forget "key prompt".');let r=n[2],s=[];for(;r;){let l=/^("(?:[^"\\]|\\.)*")/.exec(r);if(!l)throw new Error("HLM5 text arguments must be double-quoted JSON strings.");if(s.push(JSON.parse(l[1])),r=r.slice(l[0].length),r&&!/^\s/.test(r))throw new Error("Separate HLM5 arguments with spaces.");r=r.trim()}let i=n[1];if(s.length!==(i==="forget"?1:2)||s.some(l=>!l.trim()||l.length>2e3))throw new Error("Invalid HLM5 arguments: use a nonempty prompt and a single-token target, up to 2000 characters each.");return{operation:i,prompt:s[0],...i==="forget"?{}:{target:s[1]}}}function Qz(t){let e=t?.controls;if(!Array.isArray(e)||e.length<2||e.length>16||e.some(n=>typeof n!="string"||!n.trim()||n.length>2e3)||new Set(e).size!==e.length)throw new Error("HLM5 evaluation needs 2\u201316 distinct control prompts (include a paraphrase and an unrelated prompt).");return{controls:e}}var Ud=class{constructor(e,n,r,s){this.cwd=e;this.config=n;this.runtime=r??yz(n,e,Cz,{sourcePath:n.sourcePath,bridgeSha256:CYe("sha256").update(Cz).digest("hex")},"HLM"),this.assets=s??new uL(e)}cwd;config;runtime;assets;path(e,n="proposal.json"){return dA(this.cwd,"proposals",AL(e),n)}async state(){let e;try{e=await fI(dA(this.cwd,"state.json"))}catch(n){if(n.code==="ENOENT")return{version:1,models:{},history:[]};throw n}if(e.version!==1||!e.models||typeof e.models!="object"||Array.isArray(e.models)||!Array.isArray(e.history))throw new Error("Invalid HLM state.");for(let[n,r]of Object.entries(e.models))this.assets.entry(n),r!==null&&AL(r);return e}async status(){return this.state()}async doctor(e){return this.runtime({action:"doctor"},e)}async proposal(e){let n=await fI(this.path(e));if(n.version!==1||n.id!==e||typeof n.script!="string"||!n.report?.runtime||n.modelFingerprint!==gc(this.assets.entry(n.model)))throw new Error("Invalid HLM proposal or changed model manifest.");if(!lL(n.candidateHash)||!lL(n.suiteHash)||(n.parent===null?n.baselineHash!==null:!lL(n.baselineHash)))throw new Error("Invalid HLM proposal fingerprints.");if(n.parent!==null&&AL(n.parent),gc(Bz(n.script))!==gc(n.edit))throw new Error("HLM proposal does not match its script.");return n}async verify(e,n){let r=[["candidate.pt",e.candidateHash],["suite.json",e.suiteHash]];e.baselineHash&&r.push(["baseline.pt",e.baselineHash]);for(let[s,i]of r)if(await Ao(this.path(e.id,s),n)!==i)throw new Error(`HLM proposal ${s} changed. Create a new preview.`)}async current(e,n){let r=(await this.state()).models[e.id]??null;if(!r)return{revision:null,path:null,proposal:null};let s=await this.proposal(r);if(s.model!==e.id||s.modelFingerprint!==e.fingerprint)throw new Error("Active HLM revision belongs to a different model.");return await this.verify(s,n),{revision:r,path:this.path(r,"candidate.pt"),proposal:s}}async inspect(e,n){return kp(this.cwd,async()=>{let r=await this.assets.get(e,n),s=await this.current(r,n);return{...await this.runtime({action:"inspect",model:r,expectedRuntime:s.proposal?.report.runtime},n),revision:s.revision}},n)}async predict(e,n,r=0,s){if(!Number.isInteger(r)||r<0||r>64)throw new Error("HLM completion length must be 0\u201364 tokens.");return this.prediction("predict",e,n,r,s)}async compare(e,n,r){return this.prediction("compare",e,n,0,r)}async prediction(e,n,r,s,i){if(!r.trim()||r.length>2e3)throw new Error("HLM prompt must contain 1\u20132000 characters.");return kp(this.cwd,async()=>{let l=await this.assets.get(n,i),c=await this.current(l,i),h=await this.runtime({action:e,model:l,prompt:r,maxTokens:s,baseline:c.path,expectedRuntime:c.proposal?.report.runtime},i);return c.proposal&&await this.verify(c.proposal,i),{...h,model:n,revision:c.revision}},i)}async preview(e,n,r,s){if(!this.assets.entry(e).editing)throw new Error("This HLM release supports inference only.");let i=zn(this.cwd,n);if((await _Ye(i)).size>8192)throw new Error("HLM scripts are limited to 8 KB.");let l=await bYe(i,"utf8"),c=Bz(l),h=Qz(await fI(zn(this.cwd,r)));if(h.controls.includes(c.prompt))throw new Error("The edit prompt cannot be a control prompt.");return kp(this.cwd,async()=>{let f=await this.assets.get(e,s),m=await this.current(f,s),C=IYe(),y=this.path(C,".");await wYe(y,{recursive:!0,mode:448});let Q=!1;try{let b=null;if(m.path&&(await QYe(m.path,this.path(C,"baseline.pt")),b=await Ao(this.path(C,"baseline.pt"),s),b!==m.proposal.candidateHash))throw new Error("Active memory changed during preview.");let S=await this.runtime({action:"preview",model:f,baseline:m.path?this.path(C,"baseline.pt"):null,output:this.path(C,"candidate.pt"),edit:c,suite:h,expectedRuntime:m.proposal?.report.runtime},s);await BYe(this.path(C,"candidate.pt"),384),await vYe(this.path(C,"suite.json"),JSON.stringify(h),{flag:"wx",mode:384});let D={version:1,id:C,createdAt:new Date().toISOString(),model:e,modelFingerprint:f.fingerprint,parent:m.revision,baselineHash:b,candidateHash:await Ao(this.path(C,"candidate.pt"),s),suiteHash:await Ao(this.path(C,"suite.json"),s),script:l,edit:c,report:S};return await this.verify(D,s),s?.throwIfAborted(),await oT(this.path(C),D),Q=!0,D}finally{Q||await SYe(y,{recursive:!0,force:!0})}},s)}async evaluate(e,n){return kp(this.cwd,async()=>{let r=await this.proposal(e);await this.verify(r,n);let s=await this.assets.get(r.model,n),i=await this.runtime({action:"evaluate",model:s,edit:r.edit,suite:Qz(await fI(this.path(e,"suite.json"))),baseline:r.baselineHash?this.path(e,"baseline.pt"):null,candidate:this.path(e,"candidate.pt"),expectedRuntime:r.report.runtime},n);return await this.verify(r,n),{proposal:e,...i,note:"Reran saved target, existing-fact and control checks. The original activation decision is unchanged."}},n)}async approvalFingerprint(e,n="apply"){let r=await this.proposal(e);return await this.verify(r),gc({action:n,proposal:r,state:await this.state(),runtime:n==="apply"?(await this.doctor()).runtime:null,model:(await this.assets.get(r.model)).fingerprint})}async activate(e,n,r,s){if(r==="plan")throw new Error("Plan mode cannot change HLM memory revisions.");return kp(this.cwd,async()=>{let i=await this.proposal(e);await this.verify(i,s);let l=await this.assets.get(i.model,s),c=await this.current(l,s);if(n==="apply"){if(gc((await this.doctor(s)).runtime)!==gc(i.report.runtime))throw new Error("HLM runtime changed since the preview.");if(i.report.allowed!==!0||i.report.target?.passed!==!0)throw new Error("HLM preview failed its admission or behavior checks.");if(c.revision!==i.parent||(c.proposal?.candidateHash??null)!==i.baselineHash)throw new Error("HLM preview is stale; create a new preview.")}else{if(c.revision!==e)throw new Error("Restore the active HLM revision first.");if(i.parent){let m=await this.proposal(i.parent);if(await this.verify(m,s),m.model!==i.model||m.candidateHash!==i.baselineHash)throw new Error("HLM restore target changed.")}}let h=await this.state(),f=n==="apply"?e:i.parent;return h.models[i.model]=f,h.history.push({action:n,proposal:e,model:i.model,at:new Date().toISOString()}),h.history=h.history.slice(-500),s?.throwIfAborted(),await oT(dA(this.cwd,"state.json"),h),{action:n,model:i.model,revision:f,overlayPath:f?this.path(f,"candidate.pt"):null,trunkUnchanged:!0,...n==="restore"?{restoredHash:i.baselineHash,exactRestore:!0}:{},note:"This memory revision is used by hlm predict. The original base checkpoint is preserved."}},s)}};var Rw={name:"qriton",version:"0.3.1",description:"Qriton CLI is a terminal coding agent that runs on infrastructure you control. Local models or any major model API, with a memory record, HLM, and Energy Language.",type:"module",bin:{qriton:"./dist/qriton.js",qr:"./dist/qriton.js"},files:["dist","README.md","docs/energy.md","docs/hlm.md","docs/workspace-trust.md","docs/session-recovery.md","docs/terminal-interaction.md","docs/network-policy.md","docs/shield.md","docs/production-operations.md","examples/energy","examples/hlm","containers/runner.Dockerfile","LICENSE","THIRD_PARTY_NOTICES.md","release/contract.json","release/qriton-ed25519.spki.pem"],engines:{node:"^22.16.0 || >=24.0.0"},scripts:{build:"node build.mjs",dev:"node build.mjs --watch",start:"node dist/qriton.js",typecheck:"tsc --noEmit",prepublishOnly:"node scripts/release-check.mjs --for-publish","publish:release":"node scripts/publish.mjs",test:"node test-runner.mjs","bench:retrieval":"node bench/memory/run-retrieval.mjs","release:check":"node scripts/release-check.mjs","bench:coding":"node bench/coding/run.mjs"},dependencies:{"@anthropic-ai/sdk":"0.125.0","@qriton/hopfield-anomaly":"4.0.1","@qriton/shield":"3.3.0",ink:"7.1.1",openai:"7.15.0",react:"19.3.0","string-width":"8.2.0",undici:"7.29.1"},devDependencies:{"@types/node":"^24.0.0","@types/react":"^19.2.0",esbuild:"^0.28.2",typescript:"^5.9.0"},keywords:["ollama","xai","grok","anthropic","claude","openai","agent","cli","tui","local-llm","coding-agent","terminal"],license:"MIT",homepage:"https://qriton.com",author:"Marius Dima",publishConfig:{access:"public"}};var Sa={name:Rw.name,version:Rw.version,author:Rw.author,license:Rw.license,homepage:Rw.homepage};function DYe(t){return t.memory.enabled?t.memory.embeddings?"keyword + graph + configured vector recall":"keyword + graph recall":"disabled"}function kYe(t){return t.memory.enabled?t.memory.embeddings?t.memory.hopfield?"configured; needs compatible query and stored embeddings":"off (plain recall selected)":"off (embeddings disabled)":"off (memory disabled)"}function wz(t){return[`Project memory: ${DYe(t)}. Supports durable notes, links, correction history and restorable forgetting when enabled.`,`Hopfield recall: ${kYe(t)}. Novelty/composition readings describe embedding geometry, not factual truth.`,`HLM5 agent tools: ${t.hlm.enabled?"enabled":"disabled"}. Optional local completion and reversible exact-prompt, single-token memory edits with admission and behavior checks. Requires separately installed runtime and model assets.`,`Energy Language agent tools: ${t.energy.enabled?"enabled":"disabled"}. Optional HLM3 checkpoint editing, evaluation and restore.`].join(`
|
|
1089
|
+
`;import{constants as uYe}from"node:fs";import{chmod as dYe,copyFile as hYe,mkdir as Dde,open as fYe,rename as gYe,rm as pYe,stat as aT}from"node:fs/promises";import{join as cL,resolve as kde}from"node:path";import{randomUUID as mYe}from"node:crypto";var Rde=[{id:"hlm5-1b",repo:"qriton/hlm5-1b-trunk",revision:"b761f94844b800e0f7e46f4cd2c77ab03d548684",format:"hlm5-pt",description:"Frozen HLM5 trunk: local inference and certificate-governed single-token memory edits.",editing:!0,files:[{name:"hlm5_lm_baseline_fineweb_g3_final.pt",bytes:4178834297,sha256:"3e1c94d28125c2f86f3eeca030db3610f2fa679512c29c6b6608b24fc363e0f1"},{name:"fineweb-65536-compat.json",bytes:2001146,sha256:"15993635191a1c5f1a5dc7aeaacbdf9a44a45d90abef954fc77b686f4fbbe588"},{name:"LICENSE",bytes:3751,sha256:"ed69bc3c8be8abfcd7db18f3ba48a736a50fc87e4627c9927b1150bf2645ceef"},{name:"README.md",bytes:4781,sha256:"4906e419e830284eefa5df4ac70576e6cf2fdd6b59684d9d90ea613871826875"}]},{id:"hlm5-1b-hybrid",repo:"qriton/hlm5-1b-trunk",revision:"b761f94844b800e0f7e46f4cd2c77ab03d548684",format:"hlm5-pt",description:"Co-trained memory arm for local inference and controlled editing comparisons.",editing:!0,files:[{name:"hlm5_lm_hybrid_fineweb_g3_final.pt",bytes:4208213095,sha256:"16b14b294514d4af938c1aa50d3a4cf8f49d6aeeea742a5d6ff87c61c80865bb"},{name:"fineweb-65536-compat.json",bytes:2001146,sha256:"15993635191a1c5f1a5dc7aeaacbdf9a44a45d90abef954fc77b686f4fbbe588"},{name:"LICENSE",bytes:3751,sha256:"ed69bc3c8be8abfcd7db18f3ba48a736a50fc87e4627c9927b1150bf2645ceef"},{name:"README.md",bytes:4781,sha256:"4906e419e830284eefa5df4ac70576e6cf2fdd6b59684d9d90ea613871826875"}]},{id:"hlm5-3b",repo:"qriton/hlm5-3b-base",revision:"d4b82f1c7073fe623e312d3ec28f30b1a2bd4b5a",format:"hlm5-safetensors",description:"Larger base model for local inference; editing is not enabled for this release.",editing:!1,files:[{name:"config.json",bytes:482,sha256:"d9bb8e074de2908818015f6fac6dc34383c0fec4f4e1faa2f577f69bb20f4d52"},{name:"model.safetensors.index.json",bytes:30126,sha256:"56fdc598997569c049ed3115ce749999db866f3be750821c3abb3e692a61c3ef"},{name:"model-00001-of-00003.safetensors",bytes:3750271968,sha256:"071b079c8ff30e12827e83b2b6bed0198af250f57cffdaf71640b2fde1ca9145"},{name:"model-00002-of-00003.safetensors",bytes:3697832816,sha256:"f3a2367ce5647e267e8f80f6ee2849d35bf0275f4025dc6f56a351ef730275d6"},{name:"model-00003-of-00003.safetensors",bytes:3304121008,sha256:"3a28e206d3c6ed0f0fb0219e51045b957f80f908763a6adf3d249d80330bcb65"},{name:"tokenizer.json",bytes:2066108,sha256:"5d8dd8050b6beffbb546f9eb85253a8e858afe694e305c7d3500cf47d2e5efa9"},{name:"LICENSE",bytes:3685,sha256:"fd34fc9d979b97d0fb49228c4247311f7f565fc6cfbf3c75947cbdfb0513ac45"},{name:"README.md",bytes:2697,sha256:"ac74a7a48dfc9aad70bb76426dec7fdb4af59bc7f8de26fe450f47df24dd72cb"}]}];import{createHash as oYe}from"node:crypto";import{mkdir as aYe,readFile as lYe,stat as AYe}from"node:fs/promises";import{join as cYe}from"node:path";var gc=t=>oYe("sha256").update(JSON.stringify(t)).digest("hex"),dA=(t,...e)=>zn(t,cYe(".qriton","hlm",...e)),lL=t=>typeof t=="string"&&/^[a-f0-9]{64}$/.test(t);function AL(t){if(!/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/.test(t))throw new Error("Invalid HLM proposal id.");return t}async function fI(t){if((await AYe(t)).size>1e6)throw new Error("HLM metadata exceeds 1 MB.");return JSON.parse(await lYe(t,"utf8"))}async function oT(t,e){await aL(t,e)}async function kp(t,e,n){return n?.throwIfAborted(),await aYe(dA(t),{recursive:!0,mode:448}),oL(dA(t,"operation.sqlite"),dA(t,"operation.lock"),e,n)}var EYe=Rde,yYe=[{repo:"qriton/hlm-micro-gesture-v2-uwave",task:"Accelerometer gesture classification"},{repo:"qriton/hlm-micro-har-v1-uci-har",task:"Human activity classification"},{repo:"qriton/hlm-micro-keyword-v1-speechcommands",task:"Audio keyword classification"},{repo:"qriton/hlm-vision-mix-cifar10",task:"CIFAR-10 image classification"},{repo:"qriton/hlm-spatial-modelnet10-small",task:"ModelNet10 3D classification"}].map(t=>({...t,supportedHere:!1,reason:"Requires its task-specific inputs and evaluation; not a coding or language model."})),uL=class{constructor(e,n=EYe,r=Bp){this.cwd=e;this.entries=n;this.request=r}cwd;entries;request;entry(e){let n=this.entries.find(r=>r.id===e);if(!n)throw new Error(`Unknown HLM model: ${e}. Use hlm catalog.`);return n}async catalog(){return{models:await Promise.all(this.entries.map(async e=>({...e,bytes:e.files.reduce((n,r)=>n+r.bytes,0),installed:await aT(dA(this.cwd,"models",e.id,"manifest.json")).then(()=>!0,()=>!1),url:`https://huggingface.co/${e.repo}`}))),related:yYe,note:"Pinned Qriton releases. Base language models are exposed for evaluation and completion, not as instruction-following coding providers."}}async get(e,n){let r=this.entry(e),s=dA(this.cwd,"models",e),i;try{i=await fI(zn(this.cwd,cL(s,"manifest.json")))}catch(l){throw l.code==="ENOENT"?new Error(`Model ${e} is not installed. Use hlm import or hlm fetch.`):l}if(gc(i)!==gc(r))throw new Error("Installed model manifest differs from its pinned release. Re-import into a clean model directory.");for(let l of r.files){let c=zn(this.cwd,cL(s,l.name));if((await aT(c)).size!==l.bytes||await Ao(c,n)!==l.sha256)throw new Error(`HLM asset integrity check failed: ${l.name}`)}return{...r,directory:s,fingerprint:gc(r)}}async install(e,n,r,s=()=>{}){let i=this.entry(e);return kp(this.cwd,async()=>{let l=dA(this.cwd,"models",e);try{return await aT(l),await this.get(e,r)}catch(h){if(h.code!=="ENOENT")throw h}await Dde(dA(this.cwd,"models"),{recursive:!0,mode:448});let c=dA(this.cwd,"models",`${e}-${mYe()}`);await Dde(c,{mode:448});try{for(let h of i.files){r?.throwIfAborted(),s(`${n?"Importing":"Downloading"} ${h.name} (${Math.ceil(h.bytes/1048576)} MB)`);let f=zn(this.cwd,cL(c,h.name));if(n){let m=kde(this.cwd,n,h.name);if(h.name==="fineweb-65536-compat.json")try{await aT(m)}catch(C){if(C.code!=="ENOENT")throw C;m=kde(this.cwd,n,"tokenizers",h.name)}await hYe(m,f,uYe.COPYFILE_FICLONE)}else{let m=`https://huggingface.co/${i.repo}/resolve/${i.revision}/${h.name}`,C=await this.request(m,{signal:AbortSignal.any([r??new AbortController().signal,AbortSignal.timeout(30*6e4)])});if(!C.ok||!C.body)throw await C.body?.cancel(),new Error(`Model download failed: HTTP ${C.status} (${h.name})`);let y=await fYe(f,"wx",384),Q=0;try{for await(let b of C.body){if(r?.throwIfAborted(),Q+=b.byteLength,Q>h.bytes)throw new Error(`Downloaded asset exceeds pinned size: ${h.name}`);let S=0;for(;S<b.length;)S+=(await y.write(b,S,b.length-S)).bytesWritten}}finally{await y.close()}}if((await aT(f)).size!==h.bytes||await Ao(f,r)!==h.sha256)throw new Error(`HLM asset integrity check failed: ${h.name}`);await dYe(f,384)}r?.throwIfAborted(),await oT(cL(c,"manifest.json"),i),await gYe(c,l)}finally{await pYe(c,{recursive:!0,force:!0})}return{...i,directory:l,fingerprint:gc(i)}},r)}};function Bz(t){let e=t.split(/\r?\n/).map(l=>l.trim()).filter(l=>l&&!l.startsWith("#"));if(e.length!==1)throw new Error("Use one memorize, correct, or forget command per HLM5 preview.");let n=/^(memorize|correct|forget)\s+(.+)$/.exec(e[0]);if(!n)throw new Error('Expected: memorize "key prompt" " target token", correct "key prompt" " target token", or forget "key prompt".');let r=n[2],s=[];for(;r;){let l=/^("(?:[^"\\]|\\.)*")/.exec(r);if(!l)throw new Error("HLM5 text arguments must be double-quoted JSON strings.");if(s.push(JSON.parse(l[1])),r=r.slice(l[0].length),r&&!/^\s/.test(r))throw new Error("Separate HLM5 arguments with spaces.");r=r.trim()}let i=n[1];if(s.length!==(i==="forget"?1:2)||s.some(l=>!l.trim()||l.length>2e3))throw new Error("Invalid HLM5 arguments: use a nonempty prompt and a single-token target, up to 2000 characters each.");return{operation:i,prompt:s[0],...i==="forget"?{}:{target:s[1]}}}function Qz(t){let e=t?.controls;if(!Array.isArray(e)||e.length<2||e.length>16||e.some(n=>typeof n!="string"||!n.trim()||n.length>2e3)||new Set(e).size!==e.length)throw new Error("HLM5 evaluation needs 2\u201316 distinct control prompts (include a paraphrase and an unrelated prompt).");return{controls:e}}var Ud=class{constructor(e,n,r,s){this.cwd=e;this.config=n;this.runtime=r??yz(n,e,Cz,{sourcePath:n.sourcePath,bridgeSha256:CYe("sha256").update(Cz).digest("hex")},"HLM"),this.assets=s??new uL(e)}cwd;config;runtime;assets;path(e,n="proposal.json"){return dA(this.cwd,"proposals",AL(e),n)}async state(){let e;try{e=await fI(dA(this.cwd,"state.json"))}catch(n){if(n.code==="ENOENT")return{version:1,models:{},history:[]};throw n}if(e.version!==1||!e.models||typeof e.models!="object"||Array.isArray(e.models)||!Array.isArray(e.history))throw new Error("Invalid HLM state.");for(let[n,r]of Object.entries(e.models))this.assets.entry(n),r!==null&&AL(r);return e}async status(){return this.state()}async doctor(e){return this.runtime({action:"doctor"},e)}async proposal(e){let n=await fI(this.path(e));if(n.version!==1||n.id!==e||typeof n.script!="string"||!n.report?.runtime||n.modelFingerprint!==gc(this.assets.entry(n.model)))throw new Error("Invalid HLM proposal or changed model manifest.");if(!lL(n.candidateHash)||!lL(n.suiteHash)||(n.parent===null?n.baselineHash!==null:!lL(n.baselineHash)))throw new Error("Invalid HLM proposal fingerprints.");if(n.parent!==null&&AL(n.parent),gc(Bz(n.script))!==gc(n.edit))throw new Error("HLM proposal does not match its script.");return n}async verify(e,n){let r=[["candidate.pt",e.candidateHash],["suite.json",e.suiteHash]];e.baselineHash&&r.push(["baseline.pt",e.baselineHash]);for(let[s,i]of r)if(await Ao(this.path(e.id,s),n)!==i)throw new Error(`HLM proposal ${s} changed. Create a new preview.`)}async current(e,n){let r=(await this.state()).models[e.id]??null;if(!r)return{revision:null,path:null,proposal:null};let s=await this.proposal(r);if(s.model!==e.id||s.modelFingerprint!==e.fingerprint)throw new Error("Active HLM revision belongs to a different model.");return await this.verify(s,n),{revision:r,path:this.path(r,"candidate.pt"),proposal:s}}async inspect(e,n){return kp(this.cwd,async()=>{let r=await this.assets.get(e,n),s=await this.current(r,n);return{...await this.runtime({action:"inspect",model:r,expectedRuntime:s.proposal?.report.runtime},n),revision:s.revision}},n)}async predict(e,n,r=0,s){if(!Number.isInteger(r)||r<0||r>64)throw new Error("HLM completion length must be 0\u201364 tokens.");return this.prediction("predict",e,n,r,s)}async compare(e,n,r){return this.prediction("compare",e,n,0,r)}async prediction(e,n,r,s,i){if(!r.trim()||r.length>2e3)throw new Error("HLM prompt must contain 1\u20132000 characters.");return kp(this.cwd,async()=>{let l=await this.assets.get(n,i),c=await this.current(l,i),h=await this.runtime({action:e,model:l,prompt:r,maxTokens:s,baseline:c.path,expectedRuntime:c.proposal?.report.runtime},i);return c.proposal&&await this.verify(c.proposal,i),{...h,model:n,revision:c.revision}},i)}async preview(e,n,r,s){if(!this.assets.entry(e).editing)throw new Error("This HLM release supports inference only.");let i=zn(this.cwd,n);if((await _Ye(i)).size>8192)throw new Error("HLM scripts are limited to 8 KB.");let l=await bYe(i,"utf8"),c=Bz(l),h=Qz(await fI(zn(this.cwd,r)));if(h.controls.includes(c.prompt))throw new Error("The edit prompt cannot be a control prompt.");return kp(this.cwd,async()=>{let f=await this.assets.get(e,s),m=await this.current(f,s),C=IYe(),y=this.path(C,".");await wYe(y,{recursive:!0,mode:448});let Q=!1;try{let b=null;if(m.path&&(await QYe(m.path,this.path(C,"baseline.pt")),b=await Ao(this.path(C,"baseline.pt"),s),b!==m.proposal.candidateHash))throw new Error("Active memory changed during preview.");let S=await this.runtime({action:"preview",model:f,baseline:m.path?this.path(C,"baseline.pt"):null,output:this.path(C,"candidate.pt"),edit:c,suite:h,expectedRuntime:m.proposal?.report.runtime},s);await BYe(this.path(C,"candidate.pt"),384),await vYe(this.path(C,"suite.json"),JSON.stringify(h),{flag:"wx",mode:384});let D={version:1,id:C,createdAt:new Date().toISOString(),model:e,modelFingerprint:f.fingerprint,parent:m.revision,baselineHash:b,candidateHash:await Ao(this.path(C,"candidate.pt"),s),suiteHash:await Ao(this.path(C,"suite.json"),s),script:l,edit:c,report:S};return await this.verify(D,s),s?.throwIfAborted(),await oT(this.path(C),D),Q=!0,D}finally{Q||await SYe(y,{recursive:!0,force:!0})}},s)}async evaluate(e,n){return kp(this.cwd,async()=>{let r=await this.proposal(e);await this.verify(r,n);let s=await this.assets.get(r.model,n),i=await this.runtime({action:"evaluate",model:s,edit:r.edit,suite:Qz(await fI(this.path(e,"suite.json"))),baseline:r.baselineHash?this.path(e,"baseline.pt"):null,candidate:this.path(e,"candidate.pt"),expectedRuntime:r.report.runtime},n);return await this.verify(r,n),{proposal:e,...i,note:"Reran saved target, existing-fact and control checks. The original activation decision is unchanged."}},n)}async approvalFingerprint(e,n="apply"){let r=await this.proposal(e);return await this.verify(r),gc({action:n,proposal:r,state:await this.state(),runtime:n==="apply"?(await this.doctor()).runtime:null,model:(await this.assets.get(r.model)).fingerprint})}async activate(e,n,r,s){if(r==="plan")throw new Error("Plan mode cannot change HLM memory revisions.");return kp(this.cwd,async()=>{let i=await this.proposal(e);await this.verify(i,s);let l=await this.assets.get(i.model,s),c=await this.current(l,s);if(n==="apply"){if(gc((await this.doctor(s)).runtime)!==gc(i.report.runtime))throw new Error("HLM runtime changed since the preview.");if(i.report.allowed!==!0||i.report.target?.passed!==!0)throw new Error("HLM preview failed its admission or behavior checks.");if(c.revision!==i.parent||(c.proposal?.candidateHash??null)!==i.baselineHash)throw new Error("HLM preview is stale; create a new preview.")}else{if(c.revision!==e)throw new Error("Restore the active HLM revision first.");if(i.parent){let m=await this.proposal(i.parent);if(await this.verify(m,s),m.model!==i.model||m.candidateHash!==i.baselineHash)throw new Error("HLM restore target changed.")}}let h=await this.state(),f=n==="apply"?e:i.parent;return h.models[i.model]=f,h.history.push({action:n,proposal:e,model:i.model,at:new Date().toISOString()}),h.history=h.history.slice(-500),s?.throwIfAborted(),await oT(dA(this.cwd,"state.json"),h),{action:n,model:i.model,revision:f,overlayPath:f?this.path(f,"candidate.pt"):null,trunkUnchanged:!0,...n==="restore"?{restoredHash:i.baselineHash,exactRestore:!0}:{},note:"This memory revision is used by hlm predict. The original base checkpoint is preserved."}},s)}};var Rw={name:"qriton",version:"0.3.2",description:"Qriton CLI is a terminal coding agent that runs on infrastructure you control. Local models or any major model API, with a memory record, HLM, and Energy Language.",type:"module",bin:{qriton:"./dist/qriton.js",qr:"./dist/qriton.js"},files:["dist","README.md","docs/energy.md","docs/hlm.md","docs/workspace-trust.md","docs/session-recovery.md","docs/terminal-interaction.md","docs/network-policy.md","docs/shield.md","docs/production-operations.md","examples/energy","examples/hlm","containers/runner.Dockerfile","LICENSE","THIRD_PARTY_NOTICES.md","release/contract.json","release/qriton-ed25519.spki.pem"],engines:{node:"^22.16.0 || >=24.0.0"},scripts:{build:"node build.mjs",dev:"node build.mjs --watch",start:"node dist/qriton.js",typecheck:"tsc --noEmit",prepublishOnly:"node scripts/release-check.mjs --for-publish","publish:release":"node scripts/publish.mjs",test:"node test-runner.mjs","bench:retrieval":"node bench/memory/run-retrieval.mjs","release:check":"node scripts/release-check.mjs","bench:coding":"node bench/coding/run.mjs"},dependencies:{"@anthropic-ai/sdk":"0.125.0","@qriton/hopfield-anomaly":"4.0.1","@qriton/shield":"3.3.0",ink:"7.1.1",openai:"7.15.0",react:"19.3.0","string-width":"8.2.0",undici:"7.29.1"},devDependencies:{"@types/node":"^24.0.0","@types/react":"^19.2.0",esbuild:"^0.28.2",typescript:"^5.9.0"},keywords:["ollama","xai","grok","anthropic","claude","openai","agent","cli","tui","local-llm","coding-agent","terminal"],license:"MIT",homepage:"https://qriton.com",author:"Marius Dima",publishConfig:{access:"public"}};var Sa={name:Rw.name,version:Rw.version,author:Rw.author,license:Rw.license,homepage:Rw.homepage};function DYe(t){return t.memory.enabled?t.memory.embeddings?"keyword + graph + configured vector recall":"keyword + graph recall":"disabled"}function kYe(t){return t.memory.enabled?t.memory.embeddings?t.memory.hopfield?"configured; needs compatible query and stored embeddings":"off (plain recall selected)":"off (embeddings disabled)":"off (memory disabled)"}function wz(t){return[`Project memory: ${DYe(t)}. Supports durable notes, links, correction history and restorable forgetting when enabled.`,`Hopfield recall: ${kYe(t)}. Novelty/composition readings describe embedding geometry, not factual truth.`,`HLM5 agent tools: ${t.hlm.enabled?"enabled":"disabled"}. Optional local completion and reversible exact-prompt, single-token memory edits with admission and behavior checks. Requires separately installed runtime and model assets.`,`Energy Language agent tools: ${t.energy.enabled?"enabled":"disabled"}. Optional HLM3 checkpoint editing, evaluation and restore.`].join(`
|
|
1090
1090
|
`)}function Tde(t){return`${t.memory.enabled?"graph memory":"memory off"} \xB7 HLM ${t.hlm.enabled?"tools enabled":"optional"} \xB7 /capabilities`}async function dL(t,e,n=!1){let r=l=>n?`/${l}`:`qriton ${l}`,s=new Ud(t,e.hlm),i=["Qriton capabilities","",`${Sa.name} v${Sa.version} by ${Sa.author} \xB7 ${Sa.license}`,`Website: ${Sa.homepage}`,`Coding model: ${e.model} (configured; connection not checked).`,"Read, edit, run and verify workspace code; research the web; resume saved sessions.",wz(e),"","HLM5 models in this workspace:"];try{let l=await s.assets.catalog(),c=await s.status();for(let h of l.models){let f=c.models[h.id];i.push(` ${h.id}: ${h.editing?"completion + editable memory":"completion only"}; ${h.installed?"installation manifest present":"not installed"}; ${f?`revision ${f}`:"no active overlay"}.`)}}catch(l){i.push(` Metadata unavailable: ${l instanceof Error?l.message:String(l)}`)}return i.push("Metadata only; assets and runtime are verified when used. HLM commands load models only when explicitly invoked.","","Explore:",` ${r("hlm")} \u2014 setup and editable-memory workflow`,` ${r('hlm compare hlm5-1b "The capital of Veldoria is"')} \u2014 frozen versus active next token`,` ${r("hlm evaluate <proposal-id>")} \u2014 rerun target, retention and control checks`,` ${r("memory probe <query>")} \u2014 inspect plain versus Hopfield recall`,` ${r("energy")} \u2014 checkpoint workbench`,"","In chat, Enter adds an instruction during work; Esc interrupts. Use /queue to manage pending requests.","HLM overlays affect local HLM predictions. They do not train the coding provider.","This overview loads no models. See docs/hlm.md for setup, recorded checks and limits."),i.join(`
|
|
1091
1091
|
`)}function Qi(t,e){let n=AbortSignal.timeout(e);return t?AbortSignal.any([t,n]):n}function bz(t,e){return e?.throwIfAborted(),new Promise((n,r)=>{let i=setTimeout(()=>{e?.removeEventListener("abort",l),n()},t),l=()=>{clearTimeout(i),e?.removeEventListener("abort",l),r(e?.reason)};e?.addEventListener("abort",l,{once:!0})})}async function xde(t){if(!t.ok||!t.body)throw await t.body?.cancel(),new Error("Ollama did not return a successful response.");let e=t.body.getReader(),n=[],r=0;try{for(;;){let{done:s,value:i}=await e.read();if(s)break;if(r+=i.byteLength,r>256e3)throw new Error("Ollama discovery response is too large.");n.push(i)}return JSON.parse(Buffer.concat(n).toString("utf8"))}finally{await e.cancel().catch(()=>{})}}async function Sz(t,e,n=!1){let r=wO(t,n),s=Qi(e,n?900:3e3),i=await xde(await r(`${t}/api/version`,{signal:s}));if(typeof i?.version!="string"||!/^\d+\.\d+\.\d+[\w.+-]*$/.test(i.version))throw new Error("Not an Ollama version response.");let l=await xde(await r(`${t}/api/tags`,{signal:s}));if(!Array.isArray(l?.models)||l.models.some(c=>typeof c?.name!="string"||c.name.length>256||/[\x00-\x1f\x7f]/.test(c.name)))throw new Error("Not an Ollama model list.");return{url:t,version:i.version,models:l.models.map(c=>c.name)}}async function Nde(t=!1,e){let n=yO(t),r=[],s=0,i=0,l=0;return await Promise.all(Array.from({length:Math.min(8,n.length)},async()=>{for(;s<n.length;){e?.throwIfAborted();let c=n[s++];try{r.push(await Sz(c,e,!0))}catch(h){ff(h)&&l++}i++}})),e?.throwIfAborted(),{servers:r.sort((c,h)=>c.url.localeCompare(h.url,void 0,{numeric:!0})),checked:i,blocked:l}}import{randomUUID as TYe}from"node:crypto";import{mkdirSync as xYe,lstatSync as NYe,openSync as MYe,writeFileSync as UYe,fsyncSync as OYe,closeSync as LYe}from"node:fs";import{join as Mde}from"node:path";var FYe=Mde(Dr,"feedback");function Ude(t,e=FYe){let n=t.trim();if(!n||n.length>8e3)throw new Error("Feedback must contain between 1 and 8,000 characters.");if(xYe(e,{recursive:!0,mode:448}),NYe(e).isSymbolicLink())throw new Error("The feedback directory must not be a symlink.");let r=TYe(),s=Mde(e,`${r}.json`),i=MYe(s,"wx",384);try{UYe(i,JSON.stringify({id:r,createdAt:new Date().toISOString(),version:Sa.version,message:n},null,2)+`
|
|
1092
1092
|
`),OYe(i)}finally{LYe(i)}return s}import{appendFileSync as JYe,existsSync as Fde,readFileSync as Hde,renameSync as zYe,writeFileSync as VYe}from"node:fs";var HYe={"grok-4.6":{input:2,output:6,cached:.5,longAt:2e5,long:{input:4,output:12,cached:1}},"grok-4.5":{input:2,output:6,cached:.3,longAt:2e5,long:{input:4,output:12,cached:.6}},"grok-4.3":{input:1.25,output:2.5,cached:.2,longAt:2e5,long:{input:2.5,output:5,cached:.4}},"grok-build-0.1":{input:1,output:2,cached:.2,longAt:2e5,long:{input:2,output:4,cached:.4}},"grok-4.20":{input:1.25,output:2.5,cached:.2,longAt:2e5,long:{input:2.5,output:5,cached:.4}}},PYe={"gpt-5":{input:1.25,output:10,cached:.125},"gpt-5-mini":{input:.25,output:2,cached:.025},"gpt-4.1":{input:2,output:8,cached:.5},"gpt-4o":{input:2.5,output:10,cached:1.25}},GYe={"claude-opus-5":{input:15,output:75,cached:1.5},"claude-sonnet-5":{input:3,output:15,cached:.3},"claude-haiku-4-5":{input:1,output:5,cached:.1},"claude-fable-5-1":{input:15,output:75,cached:1.5}};function YYe(t,e){let n=e.toLowerCase(),r=t==="xai"?HYe:t==="openai"?PYe:t==="anthropic"?GYe:null;if(!r)return null;if(r[n])return r[n];let s=Object.keys(r).sort((i,l)=>l.length-i.length).find(i=>n.startsWith(`${i}-`));return s?r[s]:null}function Ode(t){if(t.provider==="ollama")return 0;let e=YYe(t.provider,t.model);if(!e)return null;let n=Math.min(t.cachedTokens??0,t.promptTokens),r=e.longAt&&t.promptTokens>=e.longAt&&e.long?e.long:e;return(Math.max(0,t.promptTokens-n)*r.input+n*(r.cached??r.input)+t.completionTokens*r.output)/1e6}var qYe=1e10;function Lde(t){return t/qYe}function Qu(t){return t==null||Number.isNaN(t)?"\u2014":t===0?"$0":t<1e-4?"<$0.0001":t<.01?`$${t.toFixed(4)}`:t<1?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`}var jYe={calls:0,promptTokens:0,completionTokens:0,cachedTokens:0,costUsd:0,knownCost:!0},Tp=class{constructor(e=kd("usage.jsonl")){this.path=e}path;record(e){let n=e.costUsd??null,r=n!=null?"provider":"estimate";e.provider==="ollama"?(n=0,r="local"):n==null&&(n=Ode(e),r="estimate");let s={...e,cachedTokens:e.cachedTokens||0,costUsd:n,costSource:r};try{JYe(this.path,JSON.stringify(s)+`
|
package/docs/energy.md
CHANGED
|
@@ -27,7 +27,7 @@ Set the interpreter in the workspace's `.qriton/config.json`. Merge this into ex
|
|
|
27
27
|
|
|
28
28
|
`enabled` advertises the three agent tools. Direct CLI and slash commands remain available when it is false. Python packages are optional; normal coding sessions do not import Python, download checkpoints, or add Energy tool schemas by default.
|
|
29
29
|
|
|
30
|
-
Review the project configuration with `qriton trust show`, then grant the reviewed fingerprint with `qriton trust grant <fingerprint>`. Project settings are applied only with a current grant; changes require review again. See [workspace configuration trust](workspace-trust.md).
|
|
30
|
+
Review the project configuration with `qriton trust show`, then grant the reviewed fingerprint with `qriton trust grant <fingerprint>`. Project settings are applied only with a current grant; changes require review again. See [workspace configuration trust](https://unpkg.com/qriton/docs/workspace-trust.md).
|
|
31
31
|
|
|
32
32
|
```sh
|
|
33
33
|
qriton energy doctor
|
package/docs/hlm.md
CHANGED
|
@@ -11,7 +11,7 @@ Qriton exposes the parts of the HLM ecosystem that fit a coding workspace: local
|
|
|
11
11
|
| [HLM5 3B Base](https://huggingface.co/qriton/hlm5-3b-base) | Pinned sharded-safetensors import/download and FP32 completion | Inference only. Loader coverage does not establish full-model quality or editing support. |
|
|
12
12
|
| [HLM5 certificate package](https://github.com/qriton/hlm5) | Upstream certificate/dose and editable-memory APIs | Separately installed; model weights remain frozen. |
|
|
13
13
|
| `.hlm` programs | Text-addressed `memorize`, `correct`, `forget` through `/hlm`; numerical basin edits through `/energy` | Two explicitly separate adapters. |
|
|
14
|
-
| [Energy Language](https://github.com/qriton/energy-lang) / `qriton-hlm` | Existing [HLM3 checkpoint workbench](energy.md) | Degree-3 polynomial Hopfield checkpoints; sampled structural checks and optional text evaluation. |
|
|
14
|
+
| [Energy Language](https://github.com/qriton/energy-lang) / `qriton-hlm` | Existing [HLM3 checkpoint workbench](https://unpkg.com/qriton/docs/energy.md) | Degree-3 polynomial Hopfield checkpoints; sampled structural checks and optional text evaluation. |
|
|
15
15
|
| `@qriton/hopfield-anomaly` | Existing memory recall plus `memory probe` diagnostics | Embedding novelty/composition and plain-vs-Hopfield retrieval comparison. |
|
|
16
16
|
| Qriton's gesture, activity, audio, CIFAR-10 and ModelNet10 models | Discoverable in `hlm catalog` with their task and compatibility status | Their sensor/image inputs do not fit the coding/text workflow. No automatic download or unsupported inference claims. |
|
|
17
17
|
| [HF certificate explorer](https://huggingface.co/spaces/qriton/hlm5-energy-language) | Reference demonstration | The local integration runs in its own Python process; private prompts are not sent to the Space. |
|
|
@@ -76,7 +76,7 @@ python3.10 -m venv .qriton/hlm-venv
|
|
|
76
76
|
|
|
77
77
|
The interpreter needs `torch`, `tokenizers`, and, for 3B, `safetensors`. `sourcePath` contains the upstream `hlm5/` package. It can be empty if that package is already installed in the interpreter. Model code is executable code selected through this configuration; the downloader fetches model data, tokenizer, documentation and license files, not Python source.
|
|
78
78
|
|
|
79
|
-
When using `.qriton/config.json`, review it with `qriton trust show` and grant its fingerprint with `qriton trust grant <fingerprint>` before running the commands below. Editing that file requires a new grant. See [workspace configuration trust](workspace-trust.md).
|
|
79
|
+
When using `.qriton/config.json`, review it with `qriton trust show` and grant its fingerprint with `qriton trust grant <fingerprint>` before running the commands below. Editing that file requires a new grant. See [workspace configuration trust](https://unpkg.com/qriton/docs/workspace-trust.md).
|
|
80
80
|
|
|
81
81
|
```sh
|
|
82
82
|
qriton hlm doctor
|
package/docs/network-policy.md
CHANGED
|
@@ -71,6 +71,6 @@ Remote service endpoints now require HTTPS. HTTP remains supported for loopback
|
|
|
71
71
|
- Policy errors propagate to the UI and headless stderr. Cancellation remains active during response streaming. Connections are closed after requests and destroyed when the CLI session ends. Explicit per-request dispatchers do not use ambient proxy dispatchers; proxy-based deployment is not a supported policy profile yet.
|
|
72
72
|
- `local-only` and `allowlist` block unconfined shell commands, Git commands, HLM/Energy Python execution, Ollama auto-start, model pulls, and recognized cloud-model delegation. Approval and `--yolo` do not bypass these checks. Local file tools and stored-session operations remain available.
|
|
73
73
|
|
|
74
|
-
The [container profile](production-operations.md) permits shell, Git and Python in restricted modes with no container network and one workspace mount. Host processes, delegated downloads and service auto-start remain blocked. This does not sandbox other software, allowed services or trusted launcher/credential-store helpers. Untrusted Node preload code, replacement executables or a modified CLI can bypass application controls; protecting the launcher and installation is an operator responsibility. In-flight requests are not retroactively revoked when a policy file changes; subsequent requests fail and require restart. Memory scope enforcement and durable agent-tool records are described in the same operator guide.
|
|
74
|
+
The [container profile](https://unpkg.com/qriton/docs/production-operations.md) permits shell, Git and Python in restricted modes with no container network and one workspace mount. Host processes, delegated downloads and service auto-start remain blocked. This does not sandbox other software, allowed services or trusted launcher/credential-store helpers. Untrusted Node preload code, replacement executables or a modified CLI can bypass application controls; protecting the launcher and installation is an operator responsibility. In-flight requests are not retroactively revoked when a policy file changes; subsequent requests fail and require restart. Memory scope enforcement and durable agent-tool records are described in the same operator guide.
|
|
75
75
|
|
|
76
76
|
The HTTP client uses pinned `undici`. Its [Agent connection options](https://github.com/nodejs/undici/blob/v7.29.1/docs/docs/api/Client.md) provide the DNS lookup hook needed to validate and connect to the same addresses while retaining Node's streaming fetch and TLS handling. This avoids implementing a second HTTP/TLS stack. Programmatic integrations must use `withNetworkPolicy`; the CLI also binds the policy for terminal callbacks created outside the async session.
|
package/docs/shield.md
CHANGED
|
@@ -59,4 +59,4 @@ This layer does not sandbox processes, enforce organization memory scopes, repla
|
|
|
59
59
|
|
|
60
60
|
The upstream HLM hook is not used: its published implementation initiates background classification and may return before a fresh result exists. Connecting HLM security classification would need a bounded, awaited decision through Qriton's HTTP boundary and separate accuracy/false-positive evidence.
|
|
61
61
|
|
|
62
|
-
The Apache license and upstream notice are included in [THIRD_PARTY_NOTICES.md](
|
|
62
|
+
The Apache license and upstream notice are included in [THIRD_PARTY_NOTICES.md](https://unpkg.com/qriton/THIRD_PARTY_NOTICES.md).
|
package/docs/workspace-trust.md
CHANGED
|
@@ -57,7 +57,7 @@ QRITON_POLICY=/absolute/path/to/managed-policy.json qriton -C /path/to/project
|
|
|
57
57
|
|
|
58
58
|
`allowProjectConfig: false` prevents project settings from being applied even if a receipt already exists, and prevents new grants. Project configuration is still read for inspection and validated as a bounded JSON object; malformed files cause an error. This switch does not disable reading repository instruction files as task context.
|
|
59
59
|
|
|
60
|
-
The optional `network` block adds [destination limits and hosted-fallback controls](network-policy.md). Every applicable user and managed network policy must permit a request; project configuration cannot set network policy. Only the documented policy fields and `version` are accepted. Invalid, missing, or unreadable selected policy files fail closed. Changing or removing a loaded policy causes subsequent guarded actions to stop until Qriton is restarted. Keep the policy file, launcher environment, and user-state location under the administrator's control when using these limits for a managed deployment.
|
|
60
|
+
The optional `network` block adds [destination limits and hosted-fallback controls](https://unpkg.com/qriton/docs/network-policy.md). Every applicable user and managed network policy must permit a request; project configuration cannot set network policy. Only the documented policy fields and `version` are accepted. Invalid, missing, or unreadable selected policy files fail closed. Changing or removing a loaded policy causes subsequent guarded actions to stop until Qriton is restarted. Keep the policy file, launcher environment, and user-state location under the administrator's control when using these limits for a managed deployment.
|
|
61
61
|
|
|
62
62
|
## Scope of these controls
|
|
63
63
|
|
|
@@ -65,4 +65,4 @@ This feature authorizes configuration. It does not approve every repository file
|
|
|
65
65
|
|
|
66
66
|
CLI startup, interactive commands, agent mode changes, tool execution after approval, and background model/memory work check the loaded trust and policy. Internal programmatic callers that construct a `Config` directly are trusted host code; the public CLI uses the guarded loader.
|
|
67
67
|
|
|
68
|
-
The implemented managed limits cover approval modes, project-configuration loading, and [HTTP destination policy](network-policy.md). [Session conflicts and save failures](session-recovery.md) also have recovery handling. This grant does not provide OS isolation or organization-wide memory administration. Restricted network profiles block unconfined shell, Git and Python execution. In unrestricted mode, shell commands run with the user's OS privileges. Application checks do not contain arbitrary code that already has access to the same account.
|
|
68
|
+
The implemented managed limits cover approval modes, project-configuration loading, and [HTTP destination policy](https://unpkg.com/qriton/docs/network-policy.md). [Session conflicts and save failures](https://unpkg.com/qriton/docs/session-recovery.md) also have recovery handling. This grant does not provide OS isolation or organization-wide memory administration. Restricted network profiles block unconfined shell, Git and Python execution. In unrestricted mode, shell commands run with the user's OS privileges. Application checks do not contain arbitrary code that already has access to the same account.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qriton",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Qriton CLI is a terminal coding agent that runs on infrastructure you control. Local models or any major model API, with a memory record, HLM, and Energy Language.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/release/contract.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.3.
|
|
2
|
+
"version": "0.3.2",
|
|
3
3
|
"supportedCodingModel": "local Ollama, plus xAI, Anthropic, OpenAI, and OpenAI-compatible APIs",
|
|
4
4
|
"codingEvidence": "One session keeps its transcript, tools, and memory graph across those providers. HLM and Energy Language are separate local workbenches.",
|
|
5
5
|
"localModels": "Optional. A bare qriton command still starts the configured local model. Local models are not the supported coding path.",
|