@qvac/harness 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.md +171 -6
  2. package/README.md +39 -0
  3. package/dist-lib/index.d.ts +32 -304
  4. package/dist-lib/index.js +16 -1147
  5. package/dist-lib/lib/agent/child-run.d.ts +33 -0
  6. package/dist-lib/lib/agent/child-run.js +58 -0
  7. package/dist-lib/lib/agent/delegate.d.ts +3 -19
  8. package/dist-lib/lib/agent/delegate.js +8 -31
  9. package/dist-lib/lib/agent/index.d.ts +7 -0
  10. package/dist-lib/lib/agent/index.js +5 -0
  11. package/dist-lib/lib/agent/read-parts.d.ts +47 -0
  12. package/dist-lib/lib/agent/read-parts.js +85 -0
  13. package/dist-lib/lib/capabilities/completion-engine/driver.js +6 -2
  14. package/dist-lib/lib/capabilities/completion-engine/engine.d.ts +4 -0
  15. package/dist-lib/lib/capabilities/completion-engine/engine.js +27 -18
  16. package/dist-lib/lib/capabilities/completion-engine/model-round.d.ts +4 -1
  17. package/dist-lib/lib/capabilities/completion-engine/round.js +5 -4
  18. package/dist-lib/lib/client/index.js +1 -3
  19. package/dist-lib/lib/connect/decode.d.ts +3 -2
  20. package/dist-lib/lib/connect/decode.js +14 -0
  21. package/dist-lib/lib/connect.d.ts +1 -0
  22. package/dist-lib/lib/connect.js +11 -5
  23. package/dist-lib/lib/context-window.d.ts +2 -0
  24. package/dist-lib/lib/context-window.js +17 -14
  25. package/dist-lib/lib/contract/models.d.ts +13 -1
  26. package/dist-lib/lib/contract-types.d.ts +9 -0
  27. package/dist-lib/lib/harness.d.ts +269 -0
  28. package/dist-lib/lib/harness.js +1154 -0
  29. package/dist-lib/lib/models/custom-model-cache.d.ts +2 -0
  30. package/dist-lib/lib/models/custom-model-cache.js +21 -0
  31. package/dist-lib/lib/models/memory-cap.d.ts +6 -0
  32. package/dist-lib/lib/models/memory-cap.js +20 -0
  33. package/dist-lib/lib/models/model-catalog.d.ts +2 -0
  34. package/dist-lib/lib/models/model-catalog.js +8 -2
  35. package/dist-lib/lib/models/model-fit.d.ts +59 -10
  36. package/dist-lib/lib/models/model-fit.js +172 -35
  37. package/dist-lib/lib/models/model-handle.d.ts +2 -1
  38. package/dist-lib/lib/models/model-pool.d.ts +3 -2
  39. package/dist-lib/lib/models/model-pool.js +30 -13
  40. package/dist-lib/lib/models/tts-model-default.d.ts +1 -1
  41. package/dist-lib/lib/models/tts-model-default.js +7 -6
  42. package/dist-lib/lib/residency/completion-runtime.d.ts +1 -1
  43. package/dist-lib/lib/residency/completion-runtime.js +1 -1
  44. package/dist-lib/lib/residency/index.d.ts +31 -9
  45. package/dist-lib/lib/residency/index.js +286 -88
  46. package/dist-lib/lib/run-log/boundary.d.ts +4 -1
  47. package/dist-lib/lib/run-log/boundary.js +2 -1
  48. package/dist-lib/lib/run-log/index.d.ts +2 -1
  49. package/dist-lib/lib/run-log/index.js +2 -1
  50. package/dist-lib/lib/run-log/persisted-actor.d.ts +10 -0
  51. package/dist-lib/lib/run-log/persisted-actor.js +15 -0
  52. package/dist-lib/lib/run-log/run-journal.d.ts +3 -0
  53. package/dist-lib/lib/run-log/run-journal.js +19 -8
  54. package/dist-lib/lib/serve/requests.d.ts +3 -0
  55. package/dist-lib/lib/serve.js +3 -0
  56. package/dist-lib/lib/spawn.d.ts +4 -1
  57. package/dist-lib/lib/tools/exec.d.ts +2 -0
  58. package/dist-lib/lib/tools/exec.js +29 -1
  59. package/dist-lib/lib/tools/files/list-dir.js +79 -32
  60. package/dist-lib/lib/tools/fs/walk.d.ts +11 -1
  61. package/dist-lib/lib/tools/fs/walk.js +64 -30
  62. package/dist-lib/lib/tools/office.js +8 -5
  63. package/dist-lib/lib/tools/pdf/pages.d.ts +1 -1
  64. package/dist-lib/lib/tools/pdf/pages.js +3 -14
  65. package/dist-lib/lib/tools/pdf/recognize.d.ts +3 -0
  66. package/dist-lib/lib/tools/pdf/recognize.js +45 -7
  67. package/dist-lib/plugins/image/generate-image.d.ts +2 -2
  68. package/dist-lib/plugins/image/generate-image.js +9 -1
  69. package/dist-lib/plugins/image/index.js +6 -2
  70. package/dist-lib/plugins/knowledge/chunk-index.d.ts +4 -0
  71. package/dist-lib/plugins/knowledge/chunk-index.js +191 -0
  72. package/dist-lib/plugins/knowledge/index.d.ts +1 -0
  73. package/dist-lib/plugins/knowledge/index.js +1 -0
  74. package/dist-lib/plugins/knowledge/manifest.d.ts +2 -1
  75. package/dist-lib/plugins/knowledge/manifest.js +2 -9
  76. package/dist-lib/plugins/knowledge/store.d.ts +5 -1
  77. package/dist-lib/plugins/knowledge/store.js +44 -16
  78. package/dist-lib/plugins/lsp/rpc.d.ts +9 -1
  79. package/dist-lib/plugins/lsp/rpc.js +81 -17
  80. package/dist-lib/plugins/music/generate-music.d.ts +2 -2
  81. package/dist-lib/plugins/music/generate-music.js +14 -1
  82. package/dist-lib/plugins/music/index.js +4 -1
  83. package/dist-lib/plugins/sandbox-windows/prebuilds/win32-arm64/qvac-sandbox.exe +0 -0
  84. package/dist-lib/plugins/sandbox-windows/prebuilds/win32-x64/qvac-sandbox.exe +0 -0
  85. package/dist-lib/plugins/speech/speech-engine.d.ts +5 -2
  86. package/dist-lib/plugins/speech/speech-engine.js +28 -7
  87. package/dist-lib/schema/harness.js +28 -2
  88. package/dist-lib/spec/bind.js +3 -0
  89. package/dist-lib/spec/calls.js +1 -0
  90. package/dist-lib/spec/hrpc/hrpc.json +13 -0
  91. package/dist-lib/spec/hrpc/index.js +15 -3
  92. package/dist-lib/spec/hrpc/messages.js +87 -6
  93. package/dist-lib/spec/hyperschema/index.js +87 -6
  94. package/dist-lib/spec/hyperschema/schema.json +70 -2
  95. package/dist-lib/spec/hyperschema/types.d.ts +21 -1
  96. package/package.json +29 -28
  97. package/scripts/addon-externals.cjs +1 -0
  98. package/worker/harness-sidecar.mjs +12 -1
package/CHANGELOG.md CHANGED
@@ -12,6 +12,173 @@ API had in that release; a breaking change shows the call before and after.
12
12
 
13
13
  ## [Unreleased]
14
14
 
15
+ ## [1.2.0] - 2026-11-20
16
+
17
+ ### Added
18
+
19
+ - `Agent.readParts` reads parts side by side when given a `limiter` (`Agent.limiter(width)`), which
20
+ several reads can share, and reports each note as it lands through `onNote`. Notes still come back
21
+ in reading order. Calls named as one group with `parallel: { group, slots, ctxSize? }` share one
22
+ load of the model with slots when that fits, else the agent's own load. See
23
+ [Read a long document part by part](README.md#read-a-long-document-part-by-part). (#945)
24
+
25
+ ```ts
26
+ await Agent.readParts(
27
+ harness,
28
+ { model, agent, parallel: { group: 'book', slots: 4 } },
29
+ { read: 'book', title: 'book.pdf', parts, noteTokens: 640, limiter: Agent.limiter(4) }
30
+ )
31
+ ```
32
+
33
+ ### Changed
34
+
35
+ - With `slots` above 1, a fit that cannot answer loads 1 slot: a machine with no GPU, a CPU
36
+ device, or a fit that timed out. It used to load every slot unchecked. (#946)
37
+
38
+ ### Fixed
39
+
40
+ - `exec` refuses a `curl` or `wget` fetch of a public `http(s)://` URL when `http_request` is offered
41
+ in the round, so the model retries with `http_request` instead of stopping at an approval card.
42
+ Private hosts and downloads to disk still run through `exec`. (#943)
43
+ - With `slots` above 1, a model that only fit by moving layers to the CPU loaded partly on the CPU
44
+ at the full slot count, so a 27B on a 20 GB card ran at about 1 token/s. The slot count now
45
+ halves until every layer stays on the GPU, an agent's own context included, and the context
46
+ steps down only at 1 slot. A context climb never moves layers to the CPU either. (#946)
47
+
48
+ ## [1.1.0] - 2026-11-18
49
+
50
+ ### Added
51
+
52
+ - `Agent.readParts` reads a text too long for the window one part at a time, each part in a
53
+ child run of the request with no tools, no thinking and a note capped at `noteTokens`.
54
+ `Agent.notesContext` frames the notes for the run that answers. See
55
+ [Read a long document part by part](README.md#read-a-long-document-part-by-part). (#922)
56
+
57
+ ```ts
58
+ const notes = await Agent.readParts(harness, { model, agent }, { read: 'book', title, parts })
59
+ const context = Agent.notesContext([{ title, notes }])
60
+ ```
61
+
62
+ - `embeddingWeights(model)` names the checksum of the weights an embedding model resolves to, so
63
+ a host can key its own vectors on them and embed again when an SDK update moves the weights
64
+ under the same name. (#930)
65
+ - `memoryUsage()` lists each memory pool loaded models draw on, in `pools`: its `id` (`'host'`, a
66
+ GPU's own, or `'budget'` for the budget's GPU until the SDK names it), what is loaded in it
67
+ (`usedBytes`), and its `capBytes` and `totalBytes` when it has them. (#934)
68
+ - A memory cap applies on a mobile device too: `setModelMemoryCap` keeps the models that fit
69
+ the cap loaded together there, where a phone kept one chat model a request loaded whatever
70
+ the cap. A phone's budget is well under what its GPU reports, so there the cap is the percent
71
+ of the budget, and `pools[].totalBytes` reports the memory a pool has for models. `0` still
72
+ keeps one chat model. `capability()` answers `mobileMemoryCap: true`, so a host can tell this
73
+ harness from one that ignores a cap on a phone before it pushes one. (#937)
74
+ - The knowledge plugin's `hostVectors` option, also on the spawn's `knowledge` config, is for a
75
+ host that feeds its own vectors and re-feeds them for new weights. A store with it set empties
76
+ itself when the weights change, its text on disk included, instead of re-embedding that text.
77
+ (#930)
78
+ - At open, the harness deletes the model files SDK 0.24 retired from its models folder: 0.23's
79
+ four EmbeddingGemma-300M files, 278 MB for the Q4_0 that core used. A host that shares the
80
+ folder with an app still on 0.23 leaves that app without its embedder. (#930)
81
+
82
+ ### Changed
83
+
84
+ - The shipped sidecar entry and `firstPartyPlugins` load the `ripgrep` plugin, so
85
+ `grep` and `glob` search a shared local folder with its engine past the JS walk's
86
+ 10,000-entry cap. A host that spawns the entry installs `bare-ripgrep`;
87
+ `pluginOptions.ripgrep: false` leaves it out. (#926)
88
+ - **Breaking** for a host: the harness runs on `@qvac/sdk` and `@qvac/inference` ^0.24, and its
89
+ addon peers move to the floors that release sets:
90
+ - `@qvac/llm-llamacpp` ^0.70, `@qvac/embed-llamacpp` ^0.56, `@qvac/asr-ggml` ^0.12;
91
+ - `@qvac/audiogen-ggml` ^0.10.1, `@qvac/decoder-audio` ^0.9, `@qvac/diffusion-cpp` ^0.35;
92
+ - `@qvac/ocr-ggml` ^0.33, `@qvac/translation-nmtcpp` ^0.25, `@qvac/tts-ggml` ^0.15 and
93
+ `@qvac/turbovec-ggml` ^0.5.
94
+
95
+ On a 0.x caret none of these overlaps the 0.23 range, so a host still on SDK 0.23 gets a peer
96
+ conflict when it installs this harness. Move the SDK and the addons you install to these
97
+ floors in the same change. No range can take both, since the harness calls 0.24-only APIs: the
98
+ fitter's per-model answer, the load's `fitProbe`, and the vector index's `requestId`. A host
99
+ that keeps vectors it got from `embed()` for `EMBEDDINGGEMMA_300M_Q4_0` embeds them again: 0.24
100
+ changed that model's weights (below), and `embeddingWeights(model)` names them for a key.
101
+
102
+ The lock resolves hyperswarm 4.17.2, hyperdht 6.36.0, dht-rpc 6.28.0 and udx-native
103
+ 1.22.1, the networking the model registry moved to. Model fit now comes only from the engine's
104
+ fitter. A downloaded model is fitted from its file, and a list row not yet downloaded reads
105
+ `fit: 'unknown'` on the first list while its registry description is fetched in the
106
+ background, then carries the verdict. `fit` keeps its values; `fitBasis`, `fitEvidence` and
107
+ their types are deprecated and never set. (#930)
108
+
109
+ - A knowledge store records the checksum of the weights its model name resolved to, and
110
+ re-embeds its cached text when they change under the same name. SDK 0.24 points
111
+ `EMBEDDINGGEMMA_300M_Q4_0` at a new conversion: the old one left out the model's two Dense
112
+ layers, so its vectors were not EmbeddingGemma embeddings (tetherto/qvac#5508, #5589, #5634).
113
+ Every existing store re-embeds once on upgrade, in the background. (#930)
114
+
115
+ - The knowledge plugin's default `minScore` is 0.33, down from 0.4. The 0.24 EmbeddingGemma
116
+ scores about 0.1 lower, so 0.4 kept the right passage for 60% of questions where it kept 81%.
117
+ On core's graded floor benchmark, rerun on the new weights (73 documents, a 2B's answers
118
+ graded at 14 floors, tetherto/qvac-core#938), 0.33 is where the trade turns: against 0.4 on
119
+ the old weights it answers 27 fewer of 878 questions and derails 30 fewer of 542 unrelated
120
+ prompts, and above it answers fall with nothing saved. (#930)
121
+
122
+ - Under a memory cap, a load is counted in the memory pool each of its devices draws on, and
123
+ held against that pool's cap. On a host with a GPU of its own memory, the bytes a load keeps
124
+ on the host no longer count against the GPU's cap, so a second model that fits the GPU is no
125
+ longer refused or made to unload the first. The host's memory there takes the same share of
126
+ what the SDK says it holds. `memoryUsage()` reports the bytes in the memory the budget
127
+ measured; a row's `memoryBytes` is still the model's bytes everywhere. (#931)
128
+ - A memory cap is a percent of the memory the SDK names each pool, where it was a percent of
129
+ `memoryBudget`, which caps its pool only until an answer names it. Which models stay loaded
130
+ moves with it, and so does the cap a host should show: 15.10 GiB against 16.32 GiB at 85% on
131
+ a 24 GB Mac. Read it from `memoryUsage().pools[].capBytes`. (#934)
132
+ - The pool `memoryBudget` measures never gets more memory than the budget allows, on any device.
133
+ Where the SDK names it more than that, as a CPU-only load does for the host on a desktop
134
+ whose budget is 80% of its RAM, the cap is the percent of the budget, as it was before the
135
+ SDK's figure was read. (#937)
136
+
137
+ ### Fixed
138
+
139
+ - **Breaking:** speech defaults to Supertonic 3 again, and Audio8 speaks only in a cloned
140
+ voice. Audio8 has no voice of its own: without a recording it picked a new speaker for every
141
+ utterance, and in `speakStream` for every sentence. A `speak` that names no model loads the
142
+ Supertonic quant the device profile carries, as it did before 1.0.0, and
143
+ `defaultTtsModelName`, `defaultTtsFor` and `infraModelsFor` answer it. (#941)
144
+
145
+ `new Speech({ tts: 'audio8' })` takes `voice`, the recording to clone, and
146
+ `voiceTranscript`, what it says word for word; without both, `validate()` rejects it. The
147
+ first load also downloads the Audio8 codec encoder. A `speak`, `speakStream`, `warmModel` or
148
+ `loadModel` that names `Audio8-Q8_0` on a Speech without them rejects before it loads.
149
+ `pluginOptions.speech` takes the same fields. `supertonicModelName` stays exported from
150
+ `@qvac/harness/model-defaults` and names the same quant as `defaultTtsModelName`.
151
+
152
+ ```js
153
+ // before: Audio8 in a different voice each time
154
+ new Speech()
155
+ // after: Supertonic, or Audio8 in one voice
156
+ new Speech()
157
+ new Speech({ tts: 'audio8', voice: '/voices/me.wav', voiceTranscript: 'What I say.' })
158
+ ```
159
+
160
+ - Under a memory cap, an image or music model counts for the memory it holds while it is
161
+ loaded: `memoryUsage()` and its list row's `memoryBytes` include it, and a load that has no
162
+ room beside it unloads it. A plugin's `makeRoom` (the `models` service) takes the load as
163
+ `{ srcs, unloadIdle }` and answers with a release that gives the room back once the model is
164
+ out of memory. Passing only the srcs, as in 1.0, still makes room and counts nothing. (#932)
165
+ - Under a memory cap, a loaded model counts for what the engine sized its load at, where the
166
+ estimate before the load could not open the weight. An embedding or voice model was counted
167
+ at its download size: EmbeddingGemma read 0.26 GiB while its load takes 0.52 GiB. (#933)
168
+ - When a saved office document leaves out an image uploaded to the chat, the tool's reply gives
169
+ the model the exact call that adds it, so a small model no longer creates a new document
170
+ instead. (#939)
171
+
172
+ ## [1.0.1] - 2026-11-17
173
+
174
+ ### Fixed
175
+
176
+ - A bad TLS certificate stops a run instead of being worked around. `web_fetch` and
177
+ `http_request` answer a certificate failure with code `tls` and a message that names the host
178
+ and the OpenSSL reason and tells the model not to retry or bypass verification, on Node and on
179
+ Bare. `exec` refuses `curl -k`, `--insecure`, `wget --no-check-certificate` and
180
+ `NODE_TLS_REJECT_UNAUTHORIZED=0`, also through `env`. (#925)
181
+
15
182
  ## [1.0.0] - 2026-11-17
16
183
 
17
184
  1.0 makes the harness a small core that plugins extend. Speech, translation,
@@ -1495,11 +1662,6 @@ breaking change is listed under Changed and Removed.
1495
1662
 
1496
1663
  ### Fixed
1497
1664
 
1498
- - A bad TLS certificate stops a run instead of being worked around. `web_fetch` and
1499
- `http_request` answer a certificate failure with code `tls` and a message that names the host
1500
- and the OpenSSL reason and tells the model not to retry or bypass verification, on Node and on
1501
- Bare. `exec` refuses `curl -k`, `--insecure`, `wget --no-check-certificate` and
1502
- `NODE_TLS_REJECT_UNAUTHORIZED=0`, also through `env`.
1503
1665
  - A run on a remote model host no longer stays busy after its answer arrived. The
1504
1666
  completion frame's unused `byteLength` field decoded as 0 on every frame, and
1505
1667
  streamx read that as the frame's size, so when two frames reached the harness
@@ -3938,7 +4100,10 @@ Install 0.2.12 or later to get them.
3938
4100
  - Every dependency installs from the public npm registry: GPU stats are read
3939
4101
  through `bare-gpu-info`. (#12)
3940
4102
 
3941
- [Unreleased]: https://github.com/tetherto/qvac-harness/compare/v1.0.0...HEAD
4103
+ [Unreleased]: https://github.com/tetherto/qvac-harness/compare/v1.2.0...HEAD
4104
+ [1.2.0]: https://github.com/tetherto/qvac-harness/compare/v1.1.0...v1.2.0
4105
+ [1.1.0]: https://github.com/tetherto/qvac-harness/compare/v1.0.1...v1.1.0
4106
+ [1.0.1]: https://github.com/tetherto/qvac-harness/compare/v1.0.0...v1.0.1
3942
4107
  [1.0.0]: https://github.com/tetherto/qvac-harness/compare/v0.8.12...v1.0.0
3943
4108
  [0.8.12]: https://github.com/tetherto/qvac-harness/compare/v0.8.11...v0.8.12
3944
4109
  [0.8.11]: https://github.com/tetherto/qvac-harness/compare/v0.8.10...v0.8.11
package/README.md CHANGED
@@ -170,6 +170,45 @@ const delegate = Agent.delegateTool(harness, base)
170
170
  harness.completion({ model, messages, tools: [delegate], grantedDirs: [projectDir] })
171
171
  ```
172
172
 
173
+ ### Read a long document part by part
174
+
175
+ `readParts` reads a text too long for the window one part at a time, each part in a child run with
176
+ no tools, no thinking and a capped note. `notesContext` frames the notes for the run that answers.
177
+
178
+ ```ts
179
+ const notes = await Agent.readParts(
180
+ harness,
181
+ { model, agent },
182
+ {
183
+ read: 'book',
184
+ title: 'book.pdf',
185
+ parts: [
186
+ { text: firstPages, span: 'pages 1-28' },
187
+ { text: nextPages, span: 'pages 29-55' }
188
+ ],
189
+ noteTokens: 640,
190
+ onPart: ({ part, parts }) => console.log(`reading part ${part} of ${parts}`)
191
+ }
192
+ )
193
+ const whole = notes.length === 2 && notes.every((note) => note.status === 'answered')
194
+ const context = whole ? Agent.notesContext([{ title: 'book.pdf', notes }]) : undefined
195
+ ```
196
+
197
+ Pass a `limiter` to read parts side by side, and name the calls as one group with `parallel` so the
198
+ model is loaded with slots for them when that fits:
199
+
200
+ ```ts
201
+ await Agent.readParts(
202
+ harness,
203
+ { model, agent, parallel: { group: 'book', slots: 4 } },
204
+ { read: 'book', title: 'book.pdf', parts, noteTokens: 640, limiter: Agent.limiter(4) }
205
+ )
206
+ ```
207
+
208
+ The read stops at the first part that does not answer, so fewer notes than parts means the document
209
+ was not read whole: frame the notes only when every part answered. `read` names the read under the
210
+ parent run, so two reads of one run never share a child run id.
211
+
173
212
  ### Hand the hard parts to Claude Code
174
213
 
175
214
  The same `delegate` tool can reach agents outside the harness: Claude Code, Codex, or anything that
@@ -1,329 +1,57 @@
1
- import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
2
- import ReadyResource from 'ready-resource';
3
- import { Policy } from './lib/policy/index.ts';
4
- import type { EngineBoot, EngineStep, RecoveryResolution } from './lib/run-log/index.ts';
5
- import { type CompletionArgs, type ModelRoundIo, type ModelRoundPort, type ModelRoundRequest, type ModelRoundResult } from './lib/capabilities/completion-engine/index.ts';
6
- import type { AccessPolicy, AgentConfig, ApproveFn, AskUserFn, AttachFn, CompletionEvent, FetchAttachmentFn, MediaRoundIo, MediaRoundPort, MediaRoundRequest, MediaRoundResult, Message, ProgressFn, WorkspaceSkill, ResponseFormat, RunGoal, RunInput, ShowImageFn, ToolDefinition, ToolExecuteContext, ProjectSkill } from './lib/contract/index.ts';
7
- import { type DetectLanguageContext, type DetectedLanguage } from './lib/capabilities/detect-language.ts';
8
- import { type Capability } from './lib/capabilities/invoke.ts';
9
- import { type ModelSourcePreview, type PreviewModelSourceContext } from './lib/capabilities/preview-model-source.ts';
10
- import { type EnhanceMode } from './lib/capabilities/enhance.ts';
11
- import { type DownloadArgs, type DownloadEventStream } from './lib/capabilities/download.ts';
12
- import type { EmbedContext } from './lib/capabilities/embed.ts';
13
- import { type KvCacheDeletionResult } from './lib/capabilities/kv-cache.ts';
14
- import type { LlmGenerationParams } from './lib/models/llm-presets.ts';
15
- import type { OcrPage, OcrReadContext } from './lib/contract/ocr.ts';
16
- import type { SpeakContext, SpeakResult, SpeakStreamContext, TranscribeContext } from './lib/contract/speech.ts';
17
- import type { CapabilityInfo, CredentialEntry, HarnessDiagnostics, InfraModel, LoadModelResult, MemoryUsage, SkillWriteResult, UnloadModelContext, UnloadModelResult } from './lib/contract-types.ts';
18
- import { RunLatency } from './lib/helpers/run-latency.ts';
19
- import { type CustomModelEntry } from './lib/models/model-catalog.ts';
20
- import { type ListModelsOptions, type ModelInfo } from './lib/models/model-list.ts';
21
- import { type DeleteModelSummary } from './lib/models/model-delete.ts';
22
- import { type LlamaLoadKnobs } from './lib/models/model-pool.ts';
23
- import type { EmbedDevice } from './lib/models/embed-config.ts';
24
- import { type SdkLoader } from './lib/sdk-loader.ts';
25
- import { type WarmModelOptions } from './lib/residency/index.ts';
26
- import { type ToolCatalogEntry } from './lib/tools/catalog.ts';
27
- import { type HarnessSkillsOptions } from './lib/skills-host/index.ts';
28
- import type { CredentialStoreFn, CredentialStoreValue } from './lib/tools/skills/auth-resolver.ts';
29
- import type { CopyBaseResult, DeleteOverlayResult, ManagedSkill, SkillFileContent } from './lib/tools/skills/overlay-crud.ts';
30
- import { HarnessLog } from './lib/log.ts';
31
- import type { DriveOpFn, GrantedDrive } from './lib/tools/fs/remote-protocol.ts';
32
- import type { ResolvedSkillCatalogEntry } from './lib/tools/skills/catalog.ts';
33
- import type { SkillSettingEntry } from './lib/tools/skills/skill-settings.ts';
34
- export type * from './lib/contract/index.ts';
35
- export { CompletionEngine, type CompletionArgs, type CompletionEngineOptions, type CompletionRun, type ModelRoundEvent, type ModelRoundIo, type ModelRoundPort, type ModelRoundRequest, type ModelRoundResult, ToolSets } from './lib/capabilities/completion-engine/index.ts';
36
- export { renderedTools } from './lib/capabilities/sdk-tool.ts';
37
- export declare const CONTEXT_OVERFLOW_MESSAGE: string;
38
- export { imageSettingsFrom } from './lib/helpers/image-settings.ts';
39
- export { skillInContext, unreadySkillState, type CompletionSkillEntry } from './lib/capabilities/skill-entry.ts';
40
- export { toSdkTool } from './lib/capabilities/sdk-tool.ts';
41
- export { attachmentTurn, loadedSkillsFrom, skillLoadedTurn } from './lib/capabilities/tool-turns.ts';
42
- export { CAPABILITIES, isCapability, type Capability } from './lib/capabilities/invoke.ts';
43
- export type { EnhanceMode } from './lib/capabilities/enhance.ts';
44
- export type { DetectLanguageContext, DetectedLanguage } from './lib/capabilities/detect-language.ts';
45
- export type { ModelSourceFile, ModelSourcePreview, ModelSourceRefusal, PreviewModelSourceContext } from './lib/capabilities/preview-model-source.ts';
46
- export type { ModelFitBasis, ModelFitEvidence, ModelFitVerdict } from './lib/models/model-fit.ts';
1
+ export { CompletionEngine, ToolSets, type CompletionArgs, type CompletionEngineOptions, type CompletionRun, type ModelRoundEvent, type ModelRoundIo, type ModelRoundPort, type ModelRoundRequest, type ModelRoundResult } from './lib/capabilities/completion-engine/index.ts';
2
+ export type { DetectedLanguage, DetectLanguageContext } from './lib/capabilities/detect-language.ts';
47
3
  export * from './lib/capabilities/download.ts';
48
4
  export type { EmbedContext } from './lib/capabilities/embed.ts';
5
+ export type { EnhanceMode } from './lib/capabilities/enhance.ts';
6
+ export { CAPABILITIES, isCapability, type Capability } from './lib/capabilities/invoke.ts';
7
+ export type { KvCacheDeletionResult } from './lib/capabilities/kv-cache.ts';
8
+ export type { ModelSourceFile, ModelSourcePreview, ModelSourceRefusal, PreviewModelSourceContext } from './lib/capabilities/preview-model-source.ts';
9
+ export { renderedTools, toSdkTool } from './lib/capabilities/sdk-tool.ts';
10
+ export { skillInContext, unreadySkillState, type CompletionSkillEntry } from './lib/capabilities/skill-entry.ts';
11
+ export { attachmentTurn, loadedSkillsFrom, skillLoadedTurn } from './lib/capabilities/tool-turns.ts';
12
+ export { connectHarness, HARNESS_DIED, RemoteHarness } from './lib/connect.ts';
13
+ export type { ConnectOptions, HostRunLog, HostRunLogLease } from './lib/connect.ts';
14
+ export type { AgentKnobs, ApprovalCall, ChatMessage, CredentialEntry, DownloadContext, HarnessContract, HarnessDiagnostics, HarnessEvent, HarnessInfo, HarnessStatus, InfraModel, LoadedModel, LoadFit, ModelState, SkillsOptions, SkillWriteResult } from './lib/contract-types.ts';
15
+ export type * from './lib/contract/index.ts';
49
16
  export type { OcrImage, OcrPage, OcrReadContext, OcrService } from './lib/contract/ocr.ts';
50
17
  export type { RootSearch, RootSearchQuery, RootSearchResult, RootSearchScope, RootWalkResult } from './lib/contract/root-search.ts';
51
18
  export type { SpeakContext, SpeakResult, SpeakStreamContext, SpeechService, TranscribeContext } from './lib/contract/speech.ts';
52
- export type { EmbedDevice } from './lib/models/embed-config.ts';
53
19
  export type { MemoryBudget } from './lib/hardware/memory-budget.ts';
20
+ export { imageSettingsFrom } from './lib/helpers/image-settings.ts';
21
+ export type { LogLevel } from './lib/log.ts';
22
+ export type { EmbedDevice } from './lib/models/embed-config.ts';
54
23
  export * from './lib/models/model-catalog.ts';
24
+ export type { DeleteModelResult, DeleteModelSummary } from './lib/models/model-delete.ts';
25
+ export type { ModelFitBasis, ModelFitEvidence, ModelFitVerdict } from './lib/models/model-fit.ts';
55
26
  export * from './lib/models/model-list.ts';
56
27
  export type { ModelTaskType } from './lib/models/model-task.ts';
57
- export type { DeleteModelResult, DeleteModelSummary } from './lib/models/model-delete.ts';
58
28
  export type { RecoveryResolution } from './lib/run-log/index.ts';
59
29
  export { harnessChild, spawnHarness, type HarnessChartsOptions, type HarnessChildOptions, type HarnessKnowledgeConfig, type HarnessMcpServer, type HarnessPluginOptions, type HarnessSpeechOptions, type SpawnHarnessOptions } from './lib/spawn.ts';
60
- export * from './lib/tools/skills/catalog.ts';
61
- export { requiredSettings, settingEnvName, type SkillSettingEntry, type SkillSettingsFn } from './lib/tools/skills/skill-settings.ts';
62
30
  export type { ToolCatalogEntry } from './lib/tools/catalog.ts';
63
- export { TOOLSETS, toolsetEnabled, type Toolset } from './lib/tools/toolsets.ts';
31
+ export type { CredentialRecord, CredentialStoreValue } from './lib/tools/skills/auth-resolver.ts';
32
+ export * from './lib/tools/skills/catalog.ts';
64
33
  export { markCredentialRejected, markCredentialValid, recordCredentialHealth, resetAllCredentialHealth, resetCredentialHealth } from './lib/tools/skills/credential-health.ts';
65
- export type { InstallStep, SkillOAuthConfig, SkillOAuthVerify, SkillOAuthVerifyRule, SkillRequires, SkillSetup, SkillSetupField, SkillSetupRoute } from './lib/tools/skills/manifest.ts';
66
34
  export { readSetup as normalizeSkillSetup } from './lib/tools/skills/manifest-parse.ts';
67
- export type { CredentialRecord, CredentialStoreValue } from './lib/tools/skills/auth-resolver.ts';
35
+ export type { InstallStep, SkillOAuthConfig, SkillOAuthVerify, SkillOAuthVerifyRule, SkillRequires, SkillSetup, SkillSetupField, SkillSetupRoute } from './lib/tools/skills/manifest.ts';
36
+ export { requiredSettings, settingEnvName, type SkillSettingEntry, type SkillSettingsFn } from './lib/tools/skills/skill-settings.ts';
68
37
  export { isAvailableState, SKILL_STATE, type SkillState } from './lib/tools/skills/skill-state.ts';
69
- export { connectHarness, HARNESS_DIED, RemoteHarness } from './lib/connect.ts';
70
- export type { ConnectOptions, HostRunLog, HostRunLogLease } from './lib/connect.ts';
71
- export type { KvCacheDeletionResult } from './lib/capabilities/kv-cache.ts';
72
- export type { AgentKnobs, ApprovalCall, ChatMessage, CredentialEntry, DownloadContext, HarnessContract, HarnessDiagnostics, HarnessEvent, HarnessInfo, HarnessStatus, InfraModel, LoadedModel, LoadFit, ModelState, SkillsOptions, SkillWriteResult } from './lib/contract-types.ts';
73
- import type { DownloadsAllowedOptions, HarnessInfo } from './lib/contract-types.ts';
38
+ export { toolsetEnabled, TOOLSETS, type Toolset } from './lib/tools/toolsets.ts';
39
+ import { HarnessLog } from './lib/log.ts';
40
+ export { HarnessLog, HarnessLog as harnessLog };
41
+ export declare const CONTEXT_OVERFLOW_MESSAGE: string;
74
42
  export declare const serveHarness: (stream: import("./lib/rpc-session.ts").Stream, harness: import("./index.ts").HarnessContract) => void;
75
- export { HarnessLog };
76
- export type { LogLevel } from './lib/log.ts';
77
- export declare const harnessLog: typeof HarnessLog;
78
43
  export declare const hlog: typeof HarnessLog.info;
79
44
  export declare const setHarnessLog: typeof HarnessLog.enable;
80
45
  export declare const setHarnessLogLevel: typeof HarnessLog.setLevel;
81
46
  export declare const setHarnessLogSink: typeof HarnessLog.setSink;
82
- import { HookPipeline } from './lib/hooks/index.ts';
83
- export { HookPipeline };
84
- export { Policy };
85
- import type { HarnessHook } from './lib/contract/index.ts';
86
- export type { HarnessHook, HookContext, HookResult } from './lib/contract/index.ts';
87
- import type { KnowledgeArtifact, KnowledgeGrant, KnowledgeHit, KnowledgeQuery, KnowledgeRemoved, KnowledgeStatus, KnowledgeUpsertResult } from './lib/contract/knowledge.ts';
88
- export type * from './lib/contract/knowledge.ts';
89
- export type { EmbedHost, EmbedRequest, VectorIndexSdk } from './lib/contract/models.ts';
90
- import { type HarnessPlugin } from './lib/plugins/index.ts';
91
- import { type ExecToolOptions } from './lib/tools/exec.ts';
92
47
  export declare const PLUGIN_API_VERSION = 1;
93
- export type { AddonLoaders } from './lib/contract/index.ts';
94
48
  export type { ExecLanguage, ExecRoute, ExecShell } from './lib/contract/exec.ts';
49
+ export type { AddonLoaders, HarnessHook, HookContext, HookResult } from './lib/contract/index.ts';
50
+ export type * from './lib/contract/knowledge.ts';
51
+ export type { EmbedHost, EmbedRequest, VectorIndexSdk } from './lib/contract/models.ts';
95
52
  export type { HarnessPlugin, PluginContext, PluginExec, PluginSetup, Services } from './lib/plugins/index.ts';
96
- export type HarnessExecOptions = Pick<ExecToolOptions, 'spawn' | 'killProcess' | 'realpath' | 'policyVersion'>;
97
- export interface HarnessOptions {
98
- tools?: ToolDefinition[];
99
- gpuStats?: unknown;
100
- sdkLoader?: SdkLoader;
101
- skillsDir?: string;
102
- modelsDir?: string;
103
- sdkHome?: string;
104
- exec?: boolean | HarnessExecOptions;
105
- projectionModel?: string | Record<string, string>;
106
- llmDevice?: 'cpu' | 'gpu';
107
- llmGpuLayers?: number;
108
- contextSize?: number;
109
- kvCacheK?: string;
110
- kvCacheV?: string;
111
- llmLoad?: LlamaLoadKnobs;
112
- slots?: number;
113
- embedDevice?: EmbedDevice;
114
- embedGpuLayers?: number;
115
- embedBatchSize?: number;
116
- transcriptionDevice?: 'cpu' | 'gpu';
117
- credentialStore?: CredentialStoreFn;
118
- platform?: string;
119
- completionModelCap?: number;
120
- hooks?: readonly HarnessHook[];
121
- plugins?: readonly HarnessPlugin[];
122
- pluginMode?: 'frozen' | 'dynamic';
123
- policy?: AccessPolicy;
124
- }
125
- export interface CompletionContext {
126
- runId?: string;
127
- parentRunId?: string;
128
- tools?: ToolDefinition[];
129
- policy?: AccessPolicy;
130
- now?: () => number;
131
- maxToolRounds?: number;
132
- budgetMs?: number;
133
- knowledge?: KnowledgeGrant;
134
- planMode?: boolean;
135
- deferTools?: boolean;
136
- goal?: RunGoal;
137
- wording?: CompletionArgs['wording'];
138
- resume?: boolean;
139
- recovery?: RecoveryResolution[];
140
- model: string;
141
- agent?: AgentConfig;
142
- projectSkills?: readonly ProjectSkill[];
143
- workspaceSkills?: readonly WorkspaceSkill[];
144
- agents?: Record<string, AgentConfig>;
145
- messages: Message[];
146
- typedText?: string;
147
- cacheKey?: string;
148
- replaysContext?: boolean;
149
- session?: string;
150
- thinkingDefault?: string;
151
- toolConfigs?: Record<string, Record<string, unknown>>;
152
- generationParams?: LlmGenerationParams;
153
- responseFormat?: ResponseFormat;
154
- captureInferenceCalls?: boolean;
155
- grantedDirs?: string[];
156
- grantedDrives?: GrantedDrive[];
157
- driveOp?: DriveOpFn;
158
- grantedWriteDirs?: string[];
159
- approve?: ApproveFn;
160
- attach?: AttachFn;
161
- fetchAttachment?: FetchAttachmentFn;
162
- showImage?: ShowImageFn;
163
- progress?: ProgressFn;
164
- askUser?: AskUserFn;
165
- boot?: EngineBoot;
166
- onStep?: (step: EngineStep) => Promise<void>;
167
- requestDigestKey?: Uint8Array;
168
- signal?: BareAbortSignal;
169
- input?: AsyncIterable<RunInput>;
170
- roundCut?: (cut: (note: string) => void) => void;
171
- modelRound?: ModelRoundPort;
172
- mediaRound?: MediaRoundPort;
173
- latency?: RunLatency;
174
- hopLog?: (hop: RunHop) => RunHopLog;
175
- }
176
- export interface RunHop {
177
- index: number;
178
- agent: string;
179
- }
180
- export interface RunHopLog {
181
- boot: EngineBoot;
182
- onStep: (step: EngineStep) => Promise<void>;
183
- requestDigestKey?: Uint8Array;
184
- }
185
- export type ResumeCompletionContext = Omit<Partial<CompletionContext>, 'runId' | 'resume'> & {
186
- runId: string;
187
- resume: true;
188
- };
189
- export interface InvokeContext {
190
- capability: Capability;
191
- args: Record<string, unknown>;
192
- enhance?: EnhanceMode;
193
- agent?: AgentConfig;
194
- attach?: AttachFn;
195
- fetchAttachment?: FetchAttachmentFn;
196
- progress?: ProgressFn;
197
- signal?: BareAbortSignal;
198
- }
53
+ export { HookPipeline } from './lib/hooks/index.ts';
54
+ export { Policy } from './lib/policy/index.ts';
199
55
  export type { HarnessSkillsOptions } from './lib/skills-host/index.ts';
200
56
  export type { WarmModelOptions } from './lib/residency/index.ts';
201
- export declare class Harness extends ReadyResource {
202
- private readonly _hostTools;
203
- private _tools;
204
- private _capabilities;
205
- private _sdk;
206
- private readonly _loads;
207
- private readonly _downloads;
208
- private readonly _hold;
209
- private readonly _residency;
210
- private readonly _embeddings;
211
- private readonly _voicePools;
212
- private readonly _skills;
213
- private readonly _lifecycle;
214
- private _closeRetryNeeded;
215
- private readonly _modelsDir?;
216
- private readonly _skillsDir?;
217
- private readonly _exec;
218
- private readonly _deniedRoots;
219
- private readonly _policy;
220
- private _shell;
221
- private _projectionModel;
222
- private _customProjection;
223
- private readonly _speculative;
224
- private readonly _contextSize?;
225
- private readonly _recentFits;
226
- private readonly _gpuStats?;
227
- private _capability;
228
- private _capabilityInflight;
229
- private readonly _hostHooks;
230
- private _hooks;
231
- private readonly _plugins;
232
- private readonly _prefix;
233
- private readonly _pluginMode;
234
- private _pluginsStarted;
235
- constructor({ tools, sdkLoader, skillsDir, modelsDir, sdkHome, exec, projectionModel, llmDevice, llmGpuLayers, contextSize, kvCacheK, kvCacheV, llmLoad, slots, embedDevice, embedGpuLayers, embedBatchSize, transcriptionDevice, completionModelCap, credentialStore, platform, gpuStats, hooks, plugins, pluginMode, policy }?: HarnessOptions);
236
- _open(): Promise<void>;
237
- private _startPlugins;
238
- private _runPluginStart;
239
- private _publishPlugins;
240
- private _execTools;
241
- addPlugin(plugin: HarnessPlugin): Promise<void>;
242
- removePlugin(name: string): Promise<void>;
243
- reloadPlugin(name: string, plugin: HarnessPlugin): Promise<void>;
244
- private _dynamicPlugins;
245
- private _modelHost;
246
- private _registerPool;
247
- private _createVoicePool;
248
- private _embedHost;
249
- private _loadAddons;
250
- private _teardownPlugins;
251
- get suspended(): boolean;
252
- get skillNames(): string[];
253
- setCredentials(entries: ReadonlyArray<CredentialEntry>): void;
254
- setSkillSettings(entries: ReadonlyArray<SkillSettingEntry>): void;
255
- skillSettings(skill: string, agentId?: string | null): Record<string, string>;
256
- listManagedSkills(): Promise<ManagedSkill[]>;
257
- readSkillFile(name: string): Promise<SkillFileContent | null>;
258
- writeSkillFile(name: string, content: string): Promise<SkillWriteResult>;
259
- copyBaseForEdit(name: string): Promise<CopyBaseResult>;
260
- deleteOverlaySkill(name: string): Promise<DeleteOverlayResult>;
261
- resolveCredential(key: string, ctx?: ToolExecuteContext): Promise<CredentialStoreValue> | CredentialStoreValue;
262
- skills(agentId?: string | null, modelName?: string | null, options?: HarnessSkillsOptions): Promise<ResolvedSkillCatalogEntry[]>;
263
- tools(): Promise<ToolCatalogEntry[]>;
264
- get toolNames(): string[];
265
- get supportsImages(): boolean;
266
- supportsImagesFor(model: string): boolean;
267
- private _draftFor;
268
- private _projectionFor;
269
- setCustomModels(entries: ReadonlyArray<CustomModelEntry>): void;
270
- setModelIdleTimeout(ms: number): void;
271
- setModelMemoryCap(percent: number): Promise<void>;
272
- memoryUsage(): Promise<MemoryUsage>;
273
- setDownloadsAllowed({ allowed }: DownloadsAllowedOptions): void;
274
- private _isModelCached;
275
- previewModelSource(context: PreviewModelSourceContext): Promise<ModelSourcePreview>;
276
- describe(): Promise<HarnessInfo>;
277
- diagnostics(): HarnessDiagnostics;
278
- getEmbeddingDevice(): EmbedDevice;
279
- setEmbeddingDevice(device: EmbedDevice): Promise<void>;
280
- presuspend(): Promise<void>;
281
- suspend(): Promise<void>;
282
- resume(): Promise<void>;
283
- wakeup(): Promise<void>;
284
- ready(): Promise<void>;
285
- _close(): Promise<void>;
286
- close(): Promise<void>;
287
- private _closeWhileOpening;
288
- download(args: DownloadArgs): DownloadEventStream;
289
- embed(context: EmbedContext): Promise<number[][]>;
290
- private _speechService;
291
- private _knowledgeService;
292
- knowledgeUpsert(artifact: KnowledgeArtifact): Promise<KnowledgeUpsertResult>;
293
- knowledgeRemove(artifactId: string): Promise<KnowledgeRemoved>;
294
- knowledgeSearch(query: KnowledgeQuery): Promise<KnowledgeHit[]>;
295
- knowledgeStatus(): Promise<KnowledgeStatus>;
296
- transcribe(context: TranscribeContext): Promise<string>;
297
- private _transcribe;
298
- ocrRead({ image, signal }: OcrReadContext): Promise<OcrPage>;
299
- private _ocrService;
300
- detectLanguage(context: DetectLanguageContext): Promise<DetectedLanguage[]>;
301
- speak(context: SpeakContext): Promise<SpeakResult>;
302
- private _speak;
303
- speakStream(context: SpeakStreamContext): AsyncIterable<SpeakResult>;
304
- private _speakStream;
305
- private _defaultTts;
306
- list(options?: ListModelsOptions): Promise<ModelInfo[]>;
307
- deleteModel(name: string): Promise<DeleteModelSummary>;
308
- clearKvCache(): Promise<KvCacheDeletionResult>;
309
- deleteKvCache(kvCacheKey: string): Promise<KvCacheDeletionResult>;
310
- infraModels(profile: string): Promise<InfraModel[]>;
311
- capability(): Promise<CapabilityInfo>;
312
- warmModel(context: WarmModelOptions): Promise<void>;
313
- loadModel(context: WarmModelOptions): Promise<LoadModelResult>;
314
- unloadModel(context: UnloadModelContext): Promise<UnloadModelResult>;
315
- invoke(context: InvokeContext): AsyncGenerator<CompletionEvent>;
316
- private _invoke;
317
- completion(context: CompletionContext | ResumeCompletionContext): AsyncGenerator<CompletionEvent>;
318
- serveModelRound(request: ModelRoundRequest, io: ModelRoundIo): Promise<ModelRoundResult>;
319
- serveMediaRound(request: MediaRoundRequest, io: MediaRoundIo): Promise<MediaRoundResult>;
320
- private _servedRoundFailed;
321
- private _completion;
322
- private _runCompletion;
323
- private _seeding;
324
- private _residentLease;
325
- private _access;
326
- private _providers;
327
- private _completionFailed;
328
- private _residentEnhancer;
329
- }
57
+ export { Harness, type CompletionContext, type HarnessExecOptions, type HarnessOptions, type InvokeContext, type ResumeCompletionContext, type RunHop, type RunHopLog } from './lib/harness.ts';