@qvac/harness 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/CHANGELOG.md +137 -6
  2. package/README.md +28 -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 +29 -0
  6. package/dist-lib/lib/agent/child-run.js +32 -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 +4 -0
  10. package/dist-lib/lib/agent/index.js +3 -0
  11. package/dist-lib/lib/agent/read-parts.d.ts +45 -0
  12. package/dist-lib/lib/agent/read-parts.js +60 -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/round.js +5 -4
  17. package/dist-lib/lib/client/index.js +1 -3
  18. package/dist-lib/lib/connect/decode.d.ts +3 -2
  19. package/dist-lib/lib/connect/decode.js +14 -0
  20. package/dist-lib/lib/connect.d.ts +1 -0
  21. package/dist-lib/lib/connect.js +11 -5
  22. package/dist-lib/lib/context-window.d.ts +2 -0
  23. package/dist-lib/lib/context-window.js +17 -14
  24. package/dist-lib/lib/contract/models.d.ts +8 -1
  25. package/dist-lib/lib/contract-types.d.ts +9 -0
  26. package/dist-lib/lib/harness.d.ts +267 -0
  27. package/dist-lib/lib/harness.js +1154 -0
  28. package/dist-lib/lib/models/custom-model-cache.d.ts +2 -0
  29. package/dist-lib/lib/models/custom-model-cache.js +21 -0
  30. package/dist-lib/lib/models/memory-cap.d.ts +6 -0
  31. package/dist-lib/lib/models/memory-cap.js +20 -0
  32. package/dist-lib/lib/models/model-catalog.d.ts +2 -0
  33. package/dist-lib/lib/models/model-catalog.js +8 -2
  34. package/dist-lib/lib/models/model-fit.d.ts +39 -7
  35. package/dist-lib/lib/models/model-fit.js +133 -18
  36. package/dist-lib/lib/models/model-handle.d.ts +2 -1
  37. package/dist-lib/lib/models/model-pool.d.ts +3 -2
  38. package/dist-lib/lib/models/model-pool.js +30 -13
  39. package/dist-lib/lib/models/tts-model-default.d.ts +1 -1
  40. package/dist-lib/lib/models/tts-model-default.js +7 -6
  41. package/dist-lib/lib/residency/index.d.ts +21 -7
  42. package/dist-lib/lib/residency/index.js +187 -80
  43. package/dist-lib/lib/run-log/boundary.d.ts +4 -1
  44. package/dist-lib/lib/run-log/boundary.js +2 -1
  45. package/dist-lib/lib/run-log/index.d.ts +2 -1
  46. package/dist-lib/lib/run-log/index.js +2 -1
  47. package/dist-lib/lib/run-log/persisted-actor.d.ts +10 -0
  48. package/dist-lib/lib/run-log/persisted-actor.js +15 -0
  49. package/dist-lib/lib/run-log/run-journal.d.ts +3 -0
  50. package/dist-lib/lib/run-log/run-journal.js +19 -8
  51. package/dist-lib/lib/serve/requests.d.ts +3 -0
  52. package/dist-lib/lib/serve.js +3 -0
  53. package/dist-lib/lib/spawn.d.ts +4 -1
  54. package/dist-lib/lib/tools/files/list-dir.js +79 -32
  55. package/dist-lib/lib/tools/fs/walk.d.ts +11 -1
  56. package/dist-lib/lib/tools/fs/walk.js +64 -30
  57. package/dist-lib/lib/tools/office.js +8 -5
  58. package/dist-lib/lib/tools/pdf/pages.d.ts +1 -1
  59. package/dist-lib/lib/tools/pdf/pages.js +3 -14
  60. package/dist-lib/lib/tools/pdf/recognize.d.ts +3 -0
  61. package/dist-lib/lib/tools/pdf/recognize.js +45 -7
  62. package/dist-lib/plugins/image/generate-image.d.ts +2 -2
  63. package/dist-lib/plugins/image/generate-image.js +9 -1
  64. package/dist-lib/plugins/image/index.js +6 -2
  65. package/dist-lib/plugins/knowledge/chunk-index.d.ts +4 -0
  66. package/dist-lib/plugins/knowledge/chunk-index.js +191 -0
  67. package/dist-lib/plugins/knowledge/index.d.ts +1 -0
  68. package/dist-lib/plugins/knowledge/index.js +1 -0
  69. package/dist-lib/plugins/knowledge/manifest.d.ts +2 -1
  70. package/dist-lib/plugins/knowledge/manifest.js +2 -9
  71. package/dist-lib/plugins/knowledge/store.d.ts +5 -1
  72. package/dist-lib/plugins/knowledge/store.js +44 -16
  73. package/dist-lib/plugins/lsp/rpc.d.ts +9 -1
  74. package/dist-lib/plugins/lsp/rpc.js +81 -17
  75. package/dist-lib/plugins/music/generate-music.d.ts +2 -2
  76. package/dist-lib/plugins/music/generate-music.js +14 -1
  77. package/dist-lib/plugins/music/index.js +4 -1
  78. package/dist-lib/plugins/sandbox-windows/prebuilds/win32-arm64/qvac-sandbox.exe +0 -0
  79. package/dist-lib/plugins/sandbox-windows/prebuilds/win32-x64/qvac-sandbox.exe +0 -0
  80. package/dist-lib/plugins/speech/speech-engine.d.ts +5 -2
  81. package/dist-lib/plugins/speech/speech-engine.js +28 -7
  82. package/dist-lib/schema/harness.js +28 -2
  83. package/dist-lib/spec/bind.js +3 -0
  84. package/dist-lib/spec/calls.js +1 -0
  85. package/dist-lib/spec/hrpc/hrpc.json +13 -0
  86. package/dist-lib/spec/hrpc/index.js +15 -3
  87. package/dist-lib/spec/hrpc/messages.js +87 -6
  88. package/dist-lib/spec/hyperschema/index.js +87 -6
  89. package/dist-lib/spec/hyperschema/schema.json +70 -2
  90. package/dist-lib/spec/hyperschema/types.d.ts +21 -1
  91. package/package.json +29 -28
  92. package/scripts/addon-externals.cjs +1 -0
  93. package/worker/harness-sidecar.mjs +12 -1
package/CHANGELOG.md CHANGED
@@ -12,6 +12,140 @@ API had in that release; a breaking change shows the call before and after.
12
12
 
13
13
  ## [Unreleased]
14
14
 
15
+ ## [1.1.0] - 2026-11-18
16
+
17
+ ### Added
18
+
19
+ - `Agent.readParts` reads a text too long for the window one part at a time, each part in a
20
+ child run of the request with no tools, no thinking and a note capped at `noteTokens`.
21
+ `Agent.notesContext` frames the notes for the run that answers. See
22
+ [Read a long document part by part](README.md#read-a-long-document-part-by-part). (#922)
23
+
24
+ ```ts
25
+ const notes = await Agent.readParts(harness, { model, agent }, { read: 'book', title, parts })
26
+ const context = Agent.notesContext([{ title, notes }])
27
+ ```
28
+
29
+ - `embeddingWeights(model)` names the checksum of the weights an embedding model resolves to, so
30
+ a host can key its own vectors on them and embed again when an SDK update moves the weights
31
+ under the same name. (#930)
32
+ - `memoryUsage()` lists each memory pool loaded models draw on, in `pools`: its `id` (`'host'`, a
33
+ GPU's own, or `'budget'` for the budget's GPU until the SDK names it), what is loaded in it
34
+ (`usedBytes`), and its `capBytes` and `totalBytes` when it has them. (#934)
35
+ - A memory cap applies on a mobile device too: `setModelMemoryCap` keeps the models that fit
36
+ the cap loaded together there, where a phone kept one chat model a request loaded whatever
37
+ the cap. A phone's budget is well under what its GPU reports, so there the cap is the percent
38
+ of the budget, and `pools[].totalBytes` reports the memory a pool has for models. `0` still
39
+ keeps one chat model. `capability()` answers `mobileMemoryCap: true`, so a host can tell this
40
+ harness from one that ignores a cap on a phone before it pushes one. (#937)
41
+ - The knowledge plugin's `hostVectors` option, also on the spawn's `knowledge` config, is for a
42
+ host that feeds its own vectors and re-feeds them for new weights. A store with it set empties
43
+ itself when the weights change, its text on disk included, instead of re-embedding that text.
44
+ (#930)
45
+ - At open, the harness deletes the model files SDK 0.24 retired from its models folder: 0.23's
46
+ four EmbeddingGemma-300M files, 278 MB for the Q4_0 that core used. A host that shares the
47
+ folder with an app still on 0.23 leaves that app without its embedder. (#930)
48
+
49
+ ### Changed
50
+
51
+ - The shipped sidecar entry and `firstPartyPlugins` load the `ripgrep` plugin, so
52
+ `grep` and `glob` search a shared local folder with its engine past the JS walk's
53
+ 10,000-entry cap. A host that spawns the entry installs `bare-ripgrep`;
54
+ `pluginOptions.ripgrep: false` leaves it out. (#926)
55
+ - **Breaking** for a host: the harness runs on `@qvac/sdk` and `@qvac/inference` ^0.24, and its
56
+ addon peers move to the floors that release sets:
57
+ - `@qvac/llm-llamacpp` ^0.70, `@qvac/embed-llamacpp` ^0.56, `@qvac/asr-ggml` ^0.12;
58
+ - `@qvac/audiogen-ggml` ^0.10.1, `@qvac/decoder-audio` ^0.9, `@qvac/diffusion-cpp` ^0.35;
59
+ - `@qvac/ocr-ggml` ^0.33, `@qvac/translation-nmtcpp` ^0.25, `@qvac/tts-ggml` ^0.15 and
60
+ `@qvac/turbovec-ggml` ^0.5.
61
+
62
+ On a 0.x caret none of these overlaps the 0.23 range, so a host still on SDK 0.23 gets a peer
63
+ conflict when it installs this harness. Move the SDK and the addons you install to these
64
+ floors in the same change. No range can take both, since the harness calls 0.24-only APIs: the
65
+ fitter's per-model answer, the load's `fitProbe`, and the vector index's `requestId`. A host
66
+ that keeps vectors it got from `embed()` for `EMBEDDINGGEMMA_300M_Q4_0` embeds them again: 0.24
67
+ changed that model's weights (below), and `embeddingWeights(model)` names them for a key.
68
+
69
+ The lock resolves hyperswarm 4.17.2, hyperdht 6.36.0, dht-rpc 6.28.0 and udx-native
70
+ 1.22.1, the networking the model registry moved to. Model fit now comes only from the engine's
71
+ fitter. A downloaded model is fitted from its file, and a list row not yet downloaded reads
72
+ `fit: 'unknown'` on the first list while its registry description is fetched in the
73
+ background, then carries the verdict. `fit` keeps its values; `fitBasis`, `fitEvidence` and
74
+ their types are deprecated and never set. (#930)
75
+
76
+ - A knowledge store records the checksum of the weights its model name resolved to, and
77
+ re-embeds its cached text when they change under the same name. SDK 0.24 points
78
+ `EMBEDDINGGEMMA_300M_Q4_0` at a new conversion: the old one left out the model's two Dense
79
+ layers, so its vectors were not EmbeddingGemma embeddings (tetherto/qvac#5508, #5589, #5634).
80
+ Every existing store re-embeds once on upgrade, in the background. (#930)
81
+
82
+ - The knowledge plugin's default `minScore` is 0.33, down from 0.4. The 0.24 EmbeddingGemma
83
+ scores about 0.1 lower, so 0.4 kept the right passage for 60% of questions where it kept 81%.
84
+ On core's graded floor benchmark, rerun on the new weights (73 documents, a 2B's answers
85
+ graded at 14 floors, tetherto/qvac-core#938), 0.33 is where the trade turns: against 0.4 on
86
+ the old weights it answers 27 fewer of 878 questions and derails 30 fewer of 542 unrelated
87
+ prompts, and above it answers fall with nothing saved. (#930)
88
+
89
+ - Under a memory cap, a load is counted in the memory pool each of its devices draws on, and
90
+ held against that pool's cap. On a host with a GPU of its own memory, the bytes a load keeps
91
+ on the host no longer count against the GPU's cap, so a second model that fits the GPU is no
92
+ longer refused or made to unload the first. The host's memory there takes the same share of
93
+ what the SDK says it holds. `memoryUsage()` reports the bytes in the memory the budget
94
+ measured; a row's `memoryBytes` is still the model's bytes everywhere. (#931)
95
+ - A memory cap is a percent of the memory the SDK names each pool, where it was a percent of
96
+ `memoryBudget`, which caps its pool only until an answer names it. Which models stay loaded
97
+ moves with it, and so does the cap a host should show: 15.10 GiB against 16.32 GiB at 85% on
98
+ a 24 GB Mac. Read it from `memoryUsage().pools[].capBytes`. (#934)
99
+ - The pool `memoryBudget` measures never gets more memory than the budget allows, on any device.
100
+ Where the SDK names it more than that, as a CPU-only load does for the host on a desktop
101
+ whose budget is 80% of its RAM, the cap is the percent of the budget, as it was before the
102
+ SDK's figure was read. (#937)
103
+
104
+ ### Fixed
105
+
106
+ - **Breaking:** speech defaults to Supertonic 3 again, and Audio8 speaks only in a cloned
107
+ voice. Audio8 has no voice of its own: without a recording it picked a new speaker for every
108
+ utterance, and in `speakStream` for every sentence. A `speak` that names no model loads the
109
+ Supertonic quant the device profile carries, as it did before 1.0.0, and
110
+ `defaultTtsModelName`, `defaultTtsFor` and `infraModelsFor` answer it. (#941)
111
+
112
+ `new Speech({ tts: 'audio8' })` takes `voice`, the recording to clone, and
113
+ `voiceTranscript`, what it says word for word; without both, `validate()` rejects it. The
114
+ first load also downloads the Audio8 codec encoder. A `speak`, `speakStream`, `warmModel` or
115
+ `loadModel` that names `Audio8-Q8_0` on a Speech without them rejects before it loads.
116
+ `pluginOptions.speech` takes the same fields. `supertonicModelName` stays exported from
117
+ `@qvac/harness/model-defaults` and names the same quant as `defaultTtsModelName`.
118
+
119
+ ```js
120
+ // before: Audio8 in a different voice each time
121
+ new Speech()
122
+ // after: Supertonic, or Audio8 in one voice
123
+ new Speech()
124
+ new Speech({ tts: 'audio8', voice: '/voices/me.wav', voiceTranscript: 'What I say.' })
125
+ ```
126
+
127
+ - Under a memory cap, an image or music model counts for the memory it holds while it is
128
+ loaded: `memoryUsage()` and its list row's `memoryBytes` include it, and a load that has no
129
+ room beside it unloads it. A plugin's `makeRoom` (the `models` service) takes the load as
130
+ `{ srcs, unloadIdle }` and answers with a release that gives the room back once the model is
131
+ out of memory. Passing only the srcs, as in 1.0, still makes room and counts nothing. (#932)
132
+ - Under a memory cap, a loaded model counts for what the engine sized its load at, where the
133
+ estimate before the load could not open the weight. An embedding or voice model was counted
134
+ at its download size: EmbeddingGemma read 0.26 GiB while its load takes 0.52 GiB. (#933)
135
+ - When a saved office document leaves out an image uploaded to the chat, the tool's reply gives
136
+ the model the exact call that adds it, so a small model no longer creates a new document
137
+ instead. (#939)
138
+
139
+ ## [1.0.1] - 2026-11-17
140
+
141
+ ### Fixed
142
+
143
+ - A bad TLS certificate stops a run instead of being worked around. `web_fetch` and
144
+ `http_request` answer a certificate failure with code `tls` and a message that names the host
145
+ and the OpenSSL reason and tells the model not to retry or bypass verification, on Node and on
146
+ Bare. `exec` refuses `curl -k`, `--insecure`, `wget --no-check-certificate` and
147
+ `NODE_TLS_REJECT_UNAUTHORIZED=0`, also through `env`. (#925)
148
+
15
149
  ## [1.0.0] - 2026-11-17
16
150
 
17
151
  1.0 makes the harness a small core that plugins extend. Speech, translation,
@@ -1495,11 +1629,6 @@ breaking change is listed under Changed and Removed.
1495
1629
 
1496
1630
  ### Fixed
1497
1631
 
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
1632
  - A run on a remote model host no longer stays busy after its answer arrived. The
1504
1633
  completion frame's unused `byteLength` field decoded as 0 on every frame, and
1505
1634
  streamx read that as the frame's size, so when two frames reached the harness
@@ -3938,7 +4067,9 @@ Install 0.2.12 or later to get them.
3938
4067
  - Every dependency installs from the public npm registry: GPU stats are read
3939
4068
  through `bare-gpu-info`. (#12)
3940
4069
 
3941
- [Unreleased]: https://github.com/tetherto/qvac-harness/compare/v1.0.0...HEAD
4070
+ [Unreleased]: https://github.com/tetherto/qvac-harness/compare/v1.1.0...HEAD
4071
+ [1.1.0]: https://github.com/tetherto/qvac-harness/compare/v1.0.1...v1.1.0
4072
+ [1.0.1]: https://github.com/tetherto/qvac-harness/compare/v1.0.0...v1.0.1
3942
4073
  [1.0.0]: https://github.com/tetherto/qvac-harness/compare/v0.8.12...v1.0.0
3943
4074
  [0.8.12]: https://github.com/tetherto/qvac-harness/compare/v0.8.11...v0.8.12
3944
4075
  [0.8.11]: https://github.com/tetherto/qvac-harness/compare/v0.8.10...v0.8.11
package/README.md CHANGED
@@ -170,6 +170,34 @@ 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
+ The read stops at the first part that does not answer, so fewer notes than parts means the document
198
+ was not read whole: frame the notes only when every part answered. `read` names the read under the
199
+ parent run, so two reads of one run never share a child run id.
200
+
173
201
  ### Hand the hard parts to Claude Code
174
202
 
175
203
  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';