@qvac/harness 1.0.0-rc.5 → 1.0.0-rc.7
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/CHANGELOG.md +245 -23
- package/README.md +19 -7
- package/dist-lib/index.d.ts +5 -3
- package/dist-lib/index.js +43 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.js +13 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.js +8 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +21 -19
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.js +11 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/skill-step.js +10 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.js +9 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +36 -19
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +9 -11
- package/dist-lib/lib/capabilities/completion-engine/driver.js +3 -0
- package/dist-lib/lib/capabilities/completion-engine/index.d.ts +4 -1
- package/dist-lib/lib/capabilities/completion-engine/index.js +3 -0
- package/dist-lib/lib/capabilities/completion-engine/model-round.d.ts +15 -1
- package/dist-lib/lib/capabilities/completion-engine/model-round.js +52 -0
- package/dist-lib/lib/capabilities/completion-engine/round.d.ts +3 -3
- package/dist-lib/lib/capabilities/completion-engine/round.js +5 -2
- package/dist-lib/lib/capabilities/completion-engine/tool-sets.d.ts +24 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-sets.js +15 -0
- package/dist-lib/lib/capabilities/completion-engine/turns.js +14 -4
- package/dist-lib/lib/capabilities/detect-language.d.ts +2 -1
- package/dist-lib/lib/capabilities/detect-language.js +14 -2
- package/dist-lib/lib/capabilities/sdk-tool.d.ts +9 -1
- package/dist-lib/lib/capabilities/sdk-tool.js +21 -2
- package/dist-lib/lib/capabilities/tool-plan.d.ts +4 -0
- package/dist-lib/lib/capabilities/tool-plan.js +15 -0
- package/dist-lib/lib/connect.d.ts +2 -0
- package/dist-lib/lib/connect.js +79 -3
- package/dist-lib/lib/contract/run.d.ts +2 -0
- package/dist-lib/lib/contract-types.d.ts +5 -0
- package/dist-lib/lib/errors.d.ts +4 -0
- package/dist-lib/lib/errors.js +6 -0
- package/dist-lib/lib/hardware/cpu-placement.d.ts +8 -0
- package/dist-lib/lib/hardware/cpu-placement.js +48 -0
- package/dist-lib/lib/helpers/goal-check.d.ts +2 -0
- package/dist-lib/lib/helpers/goal-check.js +18 -0
- package/dist-lib/lib/helpers/require-peers.d.ts +3 -0
- package/dist-lib/lib/helpers/require-peers.js +23 -0
- package/dist-lib/lib/machine/completion/actions/completion.js +30 -11
- package/dist-lib/lib/machine/completion/context.js +2 -1
- package/dist-lib/lib/machine/completion/rules.d.ts +1 -1
- package/dist-lib/lib/machine/completion/rules.js +7 -8
- package/dist-lib/lib/machine/completion/types.d.ts +1 -0
- package/dist-lib/lib/models/llm-presets.d.ts +1 -0
- package/dist-lib/lib/models/model-catalog.js +1 -1
- package/dist-lib/lib/models/model-pool.d.ts +4 -0
- package/dist-lib/lib/models/model-pool.js +4 -1
- package/dist-lib/lib/models/opencl-cache.js +2 -2
- package/dist-lib/lib/plugins/registry.d.ts +2 -0
- package/dist-lib/lib/plugins/registry.js +4 -0
- package/dist-lib/lib/prompt.d.ts +2 -1
- package/dist-lib/lib/prompt.js +12 -12
- package/dist-lib/lib/residency/completion-runtime.d.ts +9 -1
- package/dist-lib/lib/residency/completion-runtime.js +29 -26
- package/dist-lib/lib/residency/index.d.ts +4 -0
- package/dist-lib/lib/residency/index.js +6 -1
- package/dist-lib/lib/round-host.d.ts +12 -0
- package/dist-lib/lib/round-host.js +57 -0
- package/dist-lib/lib/round-port.d.ts +24 -0
- package/dist-lib/lib/round-port.js +81 -0
- package/dist-lib/lib/sdk-loader.d.ts +1 -1
- package/dist-lib/lib/sdk-loader.js +30 -6
- package/dist-lib/lib/sdk-storage.d.ts +1 -0
- package/dist-lib/lib/sdk-storage.js +18 -2
- package/dist-lib/lib/serve.js +68 -6
- package/dist-lib/lib/sidecar/index.d.ts +10 -0
- package/dist-lib/lib/sidecar/index.js +35 -3
- package/dist-lib/lib/sidecar/user-plugins.d.ts +1 -0
- package/dist-lib/lib/sidecar/user-plugins.js +1 -1
- package/dist-lib/lib/tools/files/grep.js +113 -15
- package/dist-lib/lib/tools/fs/edit-match.js +75 -7
- package/dist-lib/lib/tools/fs/search.d.ts +1 -1
- package/dist-lib/lib/tools/fs/search.js +2 -1
- package/dist-lib/lib/tools/http-request.js +1 -0
- package/dist-lib/lib/tools/index.d.ts +2 -1
- package/dist-lib/lib/tools/index.js +2 -2
- package/dist-lib/lib/tools/skills/skill-state-constants.d.ts +1 -0
- package/dist-lib/lib/tools/skills/skill-state-constants.js +4 -0
- package/dist-lib/lib/wire.d.ts +13 -0
- package/dist-lib/lib/wire.js +44 -1
- package/dist-lib/plugins/coding/read-only.d.ts +1 -0
- package/dist-lib/plugins/coding/read-only.js +264 -0
- package/dist-lib/plugins/coding/session.d.ts +3 -1
- package/dist-lib/plugins/coding/session.js +19 -2
- package/dist-lib/plugins/egress-proxy/index.d.ts +2 -2
- package/dist-lib/plugins/egress-proxy/index.js +5 -3
- package/dist-lib/plugins/image/index.js +7 -2
- package/dist-lib/plugins/language-hint/index.js +4 -1
- package/dist-lib/plugins/mcp/server.js +1 -1
- package/dist-lib/plugins/music/index.js +6 -2
- package/dist-lib/plugins/obsidian/readiness.js +2 -2
- package/dist-lib/plugins/obsidian/vault-read.js +17 -16
- package/dist-lib/plugins/python/index.js +1 -0
- package/dist-lib/plugins/python/loader.d.ts +1 -0
- package/dist-lib/plugins/python/loader.js +8 -0
- package/dist-lib/plugins/quickjs/index.js +4 -0
- package/dist-lib/plugins/quickjs/runtime.js +8 -3
- package/dist-lib/plugins/run-report/index.js +6 -2
- package/dist-lib/plugins/run-report/layout.js +1 -1
- package/dist-lib/plugins/sandbox-vm/index.js +3 -0
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-arm64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-x64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/speech/audio-resample.js +2 -1
- package/dist-lib/plugins/speech/index.d.ts +1 -0
- package/dist-lib/plugins/speech/index.js +8 -1
- package/dist-lib/plugins/speech/speech-runtime.js +3 -3
- package/dist-lib/plugins/translation/index.d.ts +1 -1
- package/dist-lib/plugins/translation/index.js +7 -3
- package/dist-lib/plugins/translation/translate.d.ts +2 -2
- package/dist-lib/plugins/translation/translate.js +7 -8
- package/dist-lib/plugins/walkie-talkie/index.d.ts +2 -2
- package/dist-lib/plugins/walkie-talkie/index.js +13 -5
- package/dist-lib/plugins/walkie-talkie/wire.d.ts +5 -0
- package/dist-lib/plugins/walkie-talkie/wire.js +6 -5
- package/dist-lib/schema/harness.js +12 -2
- package/dist-lib/spec/hrpc/messages.js +208 -150
- package/dist-lib/spec/hyperschema/index.js +208 -150
- package/dist-lib/spec/hyperschema/schema.json +125 -84
- package/dist-lib/spec/hyperschema/types.d.ts +4 -3
- package/package.json +150 -25
package/CHANGELOG.md
CHANGED
|
@@ -21,7 +21,12 @@ breaking change is listed under Changed and Removed.
|
|
|
21
21
|
|
|
22
22
|
### Added
|
|
23
23
|
|
|
24
|
-
- `
|
|
24
|
+
- `Tools.product` takes `files: false` to leave the file tools out, for a host
|
|
25
|
+
with no folder to share, such as a phone entry that composes its tools with
|
|
26
|
+
the mcp, web-search and weather plugins. `isDeviceSharedCredentialKey` from
|
|
27
|
+
`@qvac/harness/skill-state` names the first-party plugins' device-shared
|
|
28
|
+
credential keys for a client that has no skill readiness to read them from.
|
|
29
|
+
- `CompletionContext.modelRound` sends each `generating` and
|
|
25
30
|
`wrapping` model round to another device. It gets the request the local
|
|
26
31
|
round would send and streams `content` and `thinking` back through `emit`;
|
|
27
32
|
tools, the stop hook and `answering` stay on the run owner.
|
|
@@ -33,6 +38,41 @@ breaking change is listed under Changed and Removed.
|
|
|
33
38
|
the run emits `round-reset` for the round and the returned emitter carries
|
|
34
39
|
the new taker's chunks, while the earlier taker's late chunks are dropped.
|
|
35
40
|
The port resolves with the new taker's result. (#497)
|
|
41
|
+
- `harness.serveModelRound(request, io)` serves a model round on the model
|
|
42
|
+
host: it leases `request.modelId` and runs the same round a local
|
|
43
|
+
run does, with the context ladder and the forced-call fallback, and is
|
|
44
|
+
refused with `HARNESS_SUSPENDED` while suspended. Core sends it the
|
|
45
|
+
`ModelRoundRequest` whole. A remote round now answers an unclosed think from
|
|
46
|
+
the host's replay, and its request carries `unforced`. See the
|
|
47
|
+
[decision record](docs/decisions/2026-10-19-a-remote-host-serves-the-model-round.md).
|
|
48
|
+
(#541)
|
|
49
|
+
- A remote round crosses the wire on both sides. A `RemoteHarness` from
|
|
50
|
+
`spawnHarness`, `connectHarness` or `harnessChild` (the mobile worker) takes
|
|
51
|
+
`modelRound` and `roundCut` on the run owner, and serves
|
|
52
|
+
`serveModelRound(request, io)` on the model host, so neither device embeds a
|
|
53
|
+
second `Harness` beside its sidecar or worker. They ride the `completion`
|
|
54
|
+
stream as `model-round-*` and `round-cut` frames, and an abort crosses it as
|
|
55
|
+
the run's does. The `CAPABILITY_UNSUPPORTED` refusal from #542 is gone.
|
|
56
|
+
See the
|
|
57
|
+
[decision record](docs/decisions/2026-10-19-a-remote-host-serves-the-model-round.md).
|
|
58
|
+
(#542, #616)
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
const owner = spawnHarness(options)
|
|
62
|
+
owner.completion({ ...run, modelRound: (request, io) => host.serveModelRound(request, io) })
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- `ToolSets` names a round's tool set by hash, so a shared chat carries each
|
|
66
|
+
set's schemas once. A remote round's request now carries `toolSet`, the
|
|
67
|
+
`ToolSets.hash` of its `tools`, on every round that has tools. The run
|
|
68
|
+
owner writes the schemas only when its `ToolSets` cannot `resolve` the
|
|
69
|
+
hash, and a model host replays the chat into a `ToolSets` and resolves
|
|
70
|
+
each request's `toolSet` (#495).
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
const tools = toolSets.resolve(request.toolSet)
|
|
74
|
+
```
|
|
75
|
+
|
|
36
76
|
- A turn's context is data the host can replay. A run reports what it added to
|
|
37
77
|
each user turn (its time, the knowledge it retrieved, a `promptSubmit` hook's
|
|
38
78
|
context) once, as a `context` event. A host stores it and sends it back as
|
|
@@ -230,6 +270,9 @@ breaking change is listed under Changed and Removed.
|
|
|
230
270
|
`goal: { objective, rounds?, ms?, tokens? }` keeps a run going until every
|
|
231
271
|
step is done, emitting `goal` events whose `text` the host stores as a turn.
|
|
232
272
|
See [Plans and goals](README.md#plans-and-goals). (#234, #240)
|
|
273
|
+
- `RunGoal.checksProve`. A host whose `checks` prove the goal sets it, and the
|
|
274
|
+
goal is met once the plan is done and those checks pass, without asking the
|
|
275
|
+
model for a check of its own. Without `checks` it has no effect. (#599)
|
|
233
276
|
- Steering. `CompletionContext.input` sends `steer` and `follow-up` turns to a
|
|
234
277
|
running run, single or chained; each delivery emits an `input` event. See
|
|
235
278
|
[Steer a run while it works](README.md#steer-a-run-while-it-works). (#186,
|
|
@@ -293,7 +336,7 @@ breaking change is listed under Changed and Removed.
|
|
|
293
336
|
only. A goal's `ms` wins, and a resume keeps the budget the run started
|
|
294
337
|
with. See the
|
|
295
338
|
[decision record](docs/decisions/2026-10-13-run-time-budget.md). (#442)
|
|
296
|
-
- `CompletionContext.roundCut
|
|
339
|
+
- `CompletionContext.roundCut` hands the host a `cut(note)`
|
|
297
340
|
that stops the tool round streaming now and keeps the run. The round's whole
|
|
298
341
|
calls run, a call it may have truncated is answered with
|
|
299
342
|
`wording.toolRoundCut`, and the note is the next user turn, acked by an
|
|
@@ -361,8 +404,126 @@ breaking change is listed under Changed and Removed.
|
|
|
361
404
|
import type { DriveOpFn, GrantedDrive, ManagedSkill } from '@qvac/harness'
|
|
362
405
|
```
|
|
363
406
|
|
|
407
|
+
- `grep` takes `output` (`content`, the default; `files`, the matching paths;
|
|
408
|
+
`count`, per file), and `limit` and `offset` to page past a cut-off answer.
|
|
409
|
+
A plain-text pattern can name alternatives as `a|b`, and a miss on a pattern
|
|
410
|
+
that looks like a regular expression says to set `regex: true`. (#628)
|
|
411
|
+
- `edit_file` answers a miss with the file's closest lines, numbered as
|
|
412
|
+
`read_file` shows them, so the next try can copy them; when the new text is
|
|
413
|
+
already in the file it says the edit looks done. Old text copied with
|
|
414
|
+
`read_file`'s line numbers matches without them. (#628)
|
|
415
|
+
- The coding plugin runs a shell line that only reads, such as `rg`, `grep`,
|
|
416
|
+
`sed -n` or `cat` with files inside the shared folder, without asking. Each
|
|
417
|
+
reader allows only flags known to shape output, and a run whose shell may
|
|
418
|
+
have moved (an earlier line other than a reader, or a `cwd`) asks again.
|
|
419
|
+
(#628)
|
|
420
|
+
- `generationParams.reasoning_rounds: 'plan'` thinks only where a plan is made
|
|
421
|
+
or remade: after the user speaks and after a round whose call failed. (#628)
|
|
422
|
+
- A host that runs the sidecar names a module in `QVAC_HARNESS_HOST_MODULE`,
|
|
423
|
+
an absolute path, whose `configureHarness(harness, log)` the sidecar calls
|
|
424
|
+
after the user plugins load; a module that fails stops the sidecar.
|
|
425
|
+
`QVAC_SDK_OPTIONS` names a JSON file of SDK options the sidecar adds to the
|
|
426
|
+
SDK config it writes. The `drive`, `remote`, `remote-protocol` and five skill
|
|
427
|
+
leaves under `@qvac/harness/lib/tools/` are exported for such a host. See the
|
|
428
|
+
[decision record](docs/decisions/2026-10-25-a-host-shapes-the-harness-through-a-named-module.md).
|
|
429
|
+
(#629)
|
|
430
|
+
|
|
364
431
|
### Changed
|
|
365
432
|
|
|
433
|
+
- Every host that runs python, on Bare or Node, recopies
|
|
434
|
+
`patches/pyodide@314.0.2.patch` into its `patchedDependencies`. Guest Python
|
|
435
|
+
sees: `ctypes` calls to `emscripten_run_script*` do nothing and return 0, a
|
|
436
|
+
side module with `EM_JS` or `EM_ASM` is refused with `OSError`, `pyodide_js`
|
|
437
|
+
holds only the allowlisted members, and `loadPackage` takes lockfile names
|
|
438
|
+
only. A worker that boots an unpatched pyodide logs one line per process.
|
|
439
|
+
(#567, #586)
|
|
440
|
+
- **Breaking:** a plugin's dependencies are optional peer dependencies of
|
|
441
|
+
`@qvac/harness`, so installing the harness no longer installs any plugin's
|
|
442
|
+
native addons or libraries. A host installs the peers of the plugins it
|
|
443
|
+
imports; importing a plugin without them throws one error that names the
|
|
444
|
+
plugin and the packages. The shipped sidecar entry composes speech, image,
|
|
445
|
+
music, translation and python, so a host that spawns it installs their
|
|
446
|
+
peers; a host that wants fewer writes its own entry. See
|
|
447
|
+
[Plugin dependencies](docs/hosting.md#plugin-dependencies). (#626)
|
|
448
|
+
|
|
449
|
+
| Plugin | Peers |
|
|
450
|
+
| --------------- | ---------------------------------------------------------------------- |
|
|
451
|
+
| `speech` | `@qvac/asr-ggml`, `@qvac/tts-ggml`, `bare-ffmpeg` |
|
|
452
|
+
| `image` | `@qvac/diffusion-cpp`, `bare-image-resample`, `bare-media` |
|
|
453
|
+
| `music` | `@qvac/audiogen-ggml` |
|
|
454
|
+
| `translation` | `@qvac/translation-nmtcpp` |
|
|
455
|
+
| `python` | `pyodide` |
|
|
456
|
+
| `quickjs` | `@jitl/quickjs-singlefile-mjs-release-sync`, `quickjs-emscripten-core` |
|
|
457
|
+
| `egress-proxy` | `bare-net` |
|
|
458
|
+
| `run-report` | `elkjs` |
|
|
459
|
+
| `walkie-talkie` | `hyperswarm`, `hypercore-crypto` |
|
|
460
|
+
| `sandbox-vm` | `barevisor` |
|
|
461
|
+
|
|
462
|
+
```sh
|
|
463
|
+
# before: the harness installed every plugin's dependencies
|
|
464
|
+
npm i @qvac/harness
|
|
465
|
+
# after: a host spawning the shipped sidecar entry
|
|
466
|
+
npm i @qvac/harness @qvac/asr-ggml @qvac/tts-ggml bare-ffmpeg @qvac/diffusion-cpp \
|
|
467
|
+
bare-image-resample bare-media @qvac/audiogen-ggml @qvac/translation-nmtcpp pyodide
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
- **Breaking:** `@qvac/sdk` and the model addons are optional peer
|
|
471
|
+
dependencies of `@qvac/harness`, so installing the harness installs no model
|
|
472
|
+
engine. Each belongs to the capability that loads it: on Bare, completion
|
|
473
|
+
needs `@qvac/llm-llamacpp` and `@qvac/langdetect-text`, embeddings and the
|
|
474
|
+
`knowledge` plugin need `@qvac/embed-llamacpp`; on Node every capability
|
|
475
|
+
needs `@qvac/sdk`, which brings its own addons. A missing one throws where
|
|
476
|
+
the capability loads, naming the capability and the packages; the harness
|
|
477
|
+
entry imports without any of them. Speech and music add `@qvac/decoder-audio`
|
|
478
|
+
to their peers, and translation and `language-hint` add
|
|
479
|
+
`@qvac/langdetect-text`. The core and the plugins import the engine's
|
|
480
|
+
plugins and model catalog from `@qvac/inference`, a dependency, not through
|
|
481
|
+
`@qvac/sdk`. See [Model dependencies](docs/hosting.md#model-dependencies).
|
|
482
|
+
(#630)
|
|
483
|
+
|
|
484
|
+
```sh
|
|
485
|
+
# a desktop host on Node
|
|
486
|
+
npm i @qvac/harness @qvac/sdk @qvac/llm-llamacpp @qvac/embed-llamacpp @qvac/langdetect-text
|
|
487
|
+
# a phone app running completion on a Bare thread
|
|
488
|
+
npm i @qvac/harness @qvac/llm-llamacpp @qvac/langdetect-text
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
- **Breaking:** `harness.detectLanguage` returns a promise, since it loads the
|
|
492
|
+
detector on first use. (#630)
|
|
493
|
+
|
|
494
|
+
```js
|
|
495
|
+
// before
|
|
496
|
+
const [best] = harness.detectLanguage({ text })
|
|
497
|
+
// after
|
|
498
|
+
const [best] = await harness.detectLanguage({ text })
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
- `bare-worker` is pinned to 4.5.0 and `bare-module` is a dependency at
|
|
502
|
+
`~7.1.0`, so a host's install resolves a `bare-module` that runs on Bare
|
|
503
|
+
1.34: `bare-worker` 4.5.3 asks for `bare-module` 7.4, and npm gives it 7.5,
|
|
504
|
+
which needs Bare 1.35. (#630)
|
|
505
|
+
- The `sandbox-vm` plugin (`VmShell`, `./plugins/sandbox-vm`) is back, with
|
|
506
|
+
`barevisor` an optional peer instead of a dependency every host installed.
|
|
507
|
+
(#626)
|
|
508
|
+
- Every skill-gated tool (`docx`, `pptx`, `xlsx`, `pdf`, `generate_image`, …),
|
|
509
|
+
`http_request` and every MCP server's tools are deferred behind
|
|
510
|
+
`tool_search`. The sent tool set is fixed per chat, so a skill load no longer
|
|
511
|
+
re-primes the prompt cache: it appends the loads of the tools it grants. A
|
|
512
|
+
direct call to a deferred tool loads it and runs in the same round instead of
|
|
513
|
+
being refused. An MCP server sets `defer: false` to send its schemas whole.
|
|
514
|
+
`skill-eval` gains `--defer`. (#566)
|
|
515
|
+
- **Breaking:** `engines.node` is `^22.21.0 || >=24.9.0`. A Node host outside
|
|
516
|
+
that range crashed with `SIGSEGV` in `spawnHarness`; npm now warns at install.
|
|
517
|
+
See [On Node](docs/hosting.md#on-node). (#553)
|
|
518
|
+
- **Breaking** for guest Python that imports from `js`: the `js` module holds
|
|
519
|
+
only the names in `JS_GLOBALS`, and the python worker seals the `Function`,
|
|
520
|
+
`AsyncFunction` and generator constructors after boot. `pyodide_js` holds
|
|
521
|
+
only what pyodide's Python and micropip import, with no `FS` or
|
|
522
|
+
`mountNodeFS`, and the pyodide patch turns the `emscripten_run_script*` and
|
|
523
|
+
`EM_JS`/`EM_ASM` routes into no-ops or refusals. `pyodide.code.run_js` raises
|
|
524
|
+
in the guest. See
|
|
525
|
+
[the decision record](docs/decisions/2026-10-20-guest-python-sees-only-allowlisted-js-globals.md).
|
|
526
|
+
(#554, #567)
|
|
366
527
|
- **Breaking** for a TypeScript host that reads it: `inference-sent` no longer
|
|
367
528
|
carries `messages`. `@qvac/inference` 0.22 does not report the slice it
|
|
368
529
|
pushed, so the field was always empty; a prompt inspector reads the payload
|
|
@@ -437,8 +598,9 @@ breaking change is listed under Changed and Removed.
|
|
|
437
598
|
- A host that runs python on Node recopies `patches/pyodide@314.0.2.patch`
|
|
438
599
|
into its `patchedDependencies`. Pyodide now loads `child-process-stub.cjs`
|
|
439
600
|
by path, so guest `os.system` cannot spawn a process on Node either. A Bare
|
|
440
|
-
host needs nothing: the old patch already gave it the stub.
|
|
441
|
-
|
|
601
|
+
host needs nothing: the old patch already gave it the stub. #554 later closed
|
|
602
|
+
the `js` route to the host realm, and #567 changed the patch again for every
|
|
603
|
+
host. (#535)
|
|
442
604
|
- A call whose result is the same as its last result in the run is not
|
|
443
605
|
progress: its result carries `wording.toolUnchanged`, and 3 such calls send
|
|
444
606
|
the run to the wrap-up with the `exhausted` outcome. A round whose sent
|
|
@@ -479,6 +641,11 @@ breaking change is listed under Changed and Removed.
|
|
|
479
641
|
goal's checks in `checks` once it has some, the bench bridge's done frame
|
|
480
642
|
carries them in `goal.checks`, and the Terminal-Bench trial row keeps them as
|
|
481
643
|
`checks`. (#550)
|
|
644
|
+
- Breaking for hosts that send `checks`: passing host checks alone no longer
|
|
645
|
+
meet a checkable goal. The model must name a check of its own under a
|
|
646
|
+
`Checks:` line, and one that repeats a host check does not count. A host
|
|
647
|
+
whose checks do prove the task, such as qvac-core, sets
|
|
648
|
+
`goal.checksProve: true` (#599). (#595)
|
|
482
649
|
- A round of unchanged calls counts once toward the stop for runs with no new
|
|
483
650
|
result, not once per call. Three such rounds in a row end the run, so one
|
|
484
651
|
sweep of re-checks with nothing new no longer ends a goal run as `stalled`. (#509)
|
|
@@ -824,8 +991,8 @@ breaking change is listed under Changed and Removed.
|
|
|
824
991
|
(with `skillsDir` for `skill`), `McpPlugin` and `WebSearchPlugin`.
|
|
825
992
|
`credentialSlots` comes from `@qvac/harness/skill-manifest`,
|
|
826
993
|
`ensureBundledSkillsDir` is `Tools.bundledSkillsDir()`, and
|
|
827
|
-
`isDeviceSharedCredentialKey`
|
|
828
|
-
`SkillReadiness.deviceSharedKeys`). Only `./lib/tools/exec.ts`,
|
|
994
|
+
`isDeviceSharedCredentialKey` comes from `@qvac/harness/skill-state` (a
|
|
995
|
+
plugin declares its own in `SkillReadiness.deviceSharedKeys`). Only `./lib/tools/exec.ts`,
|
|
829
996
|
`./lib/tools/toolsets.ts`, `./lib/tools/skills/index.ts`, `mention.ts` and
|
|
830
997
|
`mention-name.ts` keep their keys. (#273, #283)
|
|
831
998
|
- **Breaking:** `./plugins` no longer exports the contract types: import
|
|
@@ -856,22 +1023,18 @@ breaking change is listed under Changed and Removed.
|
|
|
856
1023
|
|
|
857
1024
|
### Fixed
|
|
858
1025
|
|
|
859
|
-
- A
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
(
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
the paragraphs there. An attached document keeps the strict checks. In any
|
|
872
|
-
`pptx`, `docx` or `xlsx` call, an `{ "op": "output", … }` entry is dropped
|
|
873
|
-
instead of refused, and a file name in it names the file unless `output` is
|
|
874
|
-
already set. (QVAC-26944)
|
|
1026
|
+
- A message keeps the wire layout 0.8.13 shipped: `sentAt` is its fourth
|
|
1027
|
+
field again, ahead of `toolCalls`, `toolCallId`, `name`, `id` and `context`.
|
|
1028
|
+
Up to rc.6 a 1.0 harness could not decode a message from a 0.8.13 host that
|
|
1029
|
+
carried a send time. A host built against an earlier 1.0 rc must be rebuilt
|
|
1030
|
+
with this one, since those fields moved. (#623)
|
|
1031
|
+
- The wrap-up round a run ends on keeps the tool block in the prompt and
|
|
1032
|
+
forbids a call with `tool_choice: "none"`, instead of dropping the block.
|
|
1033
|
+
Under `@qvac/sdk` 0.22 the dropped block rewrote the chat's one cache file,
|
|
1034
|
+
so that round and the next turn each re-read the whole chat (19.6 s to first
|
|
1035
|
+
token on Qwen3.5-2B after a 12-turn chat). (#605)
|
|
1036
|
+
- A `skill` call that names a skill by its display name, in another case, or by
|
|
1037
|
+
the one tool it grants (`pptx`) loads that skill. (#528)
|
|
875
1038
|
- On Node, the Python plugin finds pyodide and the vendored wheels without
|
|
876
1039
|
`import.meta.asset`: it resolves both with `import.meta.resolve`. (#535)
|
|
877
1040
|
- A skill's tools are reselected on the turn the skill loads, so a run
|
|
@@ -923,6 +1086,64 @@ breaking change is listed under Changed and Removed.
|
|
|
923
1086
|
- A `FAIL` sent while a run was finishing no longer runs the finishing step and
|
|
924
1087
|
its `runEnd` hook again. (#167)
|
|
925
1088
|
|
|
1089
|
+
## [0.8.12] - 2026-10-21
|
|
1090
|
+
|
|
1091
|
+
### Added
|
|
1092
|
+
|
|
1093
|
+
- A custom GGUF the catalog does not know is sized by the engine fitter from
|
|
1094
|
+
its header and tensor list, so its preview gives a fit verdict instead of
|
|
1095
|
+
"Fit unknown". Split models stay unknown. (#562)
|
|
1096
|
+
|
|
1097
|
+
### Changed
|
|
1098
|
+
|
|
1099
|
+
- `http_request`, `mcp_call` and every skill-gated tool (`docx`, `pptx`,
|
|
1100
|
+
`xlsx`, `pdf`, `generate_image`, `weather_lookup`, compiled skill operations,
|
|
1101
|
+
…) are deferred behind `tool_search`: their schemas stay out of the prompt
|
|
1102
|
+
until searched, called or loaded with their skill. The tool set is fixed per
|
|
1103
|
+
chat, so a skill load no longer re-primes the prompt cache. `skill-eval`
|
|
1104
|
+
gains `--defer`. (#566)
|
|
1105
|
+
- `@qvac/sdk` and `@qvac/inference` move to `^0.22.0`. Loads are sized on the
|
|
1106
|
+
fitter's `floorBytes`, so more models fit under a memory cap before one is
|
|
1107
|
+
unloaded. (#564)
|
|
1108
|
+
|
|
1109
|
+
### Fixed
|
|
1110
|
+
|
|
1111
|
+
- A model name that is not an exact catalog or registry name never resolves
|
|
1112
|
+
to a vision projector (`QVAC_MODEL=Qwen3.5-4B` loaded the `mmproj` file and
|
|
1113
|
+
failed to initialize). (#551)
|
|
1114
|
+
- The device `thinkingDefault` reaches the Qwen3.5 presets, so turning
|
|
1115
|
+
thinking off works for 2B and 4B when the agent inherits. (#548)
|
|
1116
|
+
- A GGUF header read that drops its connection, or gets a 408, 429 or 5xx, is
|
|
1117
|
+
retried up to 3 times, and each failure is logged with its host and cause.
|
|
1118
|
+
Add no longer fails after a good preview on a flaky CDN. (#561)
|
|
1119
|
+
- A GGUF that names no architecture is no longer offered as a chat model: in
|
|
1120
|
+
an `sd.cpp` repo it reads as image generation, otherwise it is refused as
|
|
1121
|
+
`not-a-model`. (#529)
|
|
1122
|
+
- Small models read an attached PDF with `pdf` instead of `web_fetch` on a
|
|
1123
|
+
made-up link, and a text-less page the host already rendered as an image is
|
|
1124
|
+
pointed at that image instead of "no OCR here". (#525)
|
|
1125
|
+
- A `pptx`, `docx` or `xlsx` call that builds a new file without `output` is
|
|
1126
|
+
saved and attached instead of refused. The file is named after
|
|
1127
|
+
`create.title` (`Climate Change` → `climate_change.docx`), or
|
|
1128
|
+
`presentation.pptx`, `document.docx` or `workbook.xlsx` without one, the way
|
|
1129
|
+
the `pdf` tool names a new PDF. A 2B model often left `output` off, and the
|
|
1130
|
+
refusal sent it guessing attachment ids until the turn ended with no file.
|
|
1131
|
+
A call whose ops only read (`read`, `sheets`, `paragraphStyles`, …) returns
|
|
1132
|
+
their results and saves nothing, so it never attaches a blank file.
|
|
1133
|
+
(QVAC-26944)
|
|
1134
|
+
- A new Word document takes two more of a small model's slips instead of
|
|
1135
|
+
refusing the whole call: a block position past the end of what the call has
|
|
1136
|
+
built so far lands at the end, and `appendParagraphs` with an `at` inserts
|
|
1137
|
+
the paragraphs there. An attached document keeps the strict checks. In any
|
|
1138
|
+
`pptx`, `docx` or `xlsx` call, an `{ "op": "output", … }` entry is dropped
|
|
1139
|
+
instead of refused, and a file name in it names the file unless `output` is
|
|
1140
|
+
already set. (QVAC-26944)
|
|
1141
|
+
- In Obsidian vault folder mode, "what's in my vault" lists the notes with
|
|
1142
|
+
`obsidian files` instead of passing the vault folder to `read` or guessing
|
|
1143
|
+
commands, and a `read` that still names a folder is told to list it with
|
|
1144
|
+
`obsidian files` instead of failing with a raw file system error.
|
|
1145
|
+
(QVAC-27069)
|
|
1146
|
+
|
|
926
1147
|
## [0.8.11] - 2026-10-16
|
|
927
1148
|
|
|
928
1149
|
### Fixed
|
|
@@ -2993,7 +3214,8 @@ Install 0.2.12 or later to get them.
|
|
|
2993
3214
|
- Every dependency installs from the public npm registry: GPU stats are read
|
|
2994
3215
|
through `bare-gpu-info`. (#12)
|
|
2995
3216
|
|
|
2996
|
-
[Unreleased]: https://github.com/tetherto/qvac-harness/compare/v0.8.
|
|
3217
|
+
[Unreleased]: https://github.com/tetherto/qvac-harness/compare/v0.8.12...HEAD
|
|
3218
|
+
[0.8.12]: https://github.com/tetherto/qvac-harness/compare/v0.8.11...v0.8.12
|
|
2997
3219
|
[0.8.11]: https://github.com/tetherto/qvac-harness/compare/v0.8.10...v0.8.11
|
|
2998
3220
|
[0.8.10]: https://github.com/tetherto/qvac-harness/compare/v0.8.9...v0.8.10
|
|
2999
3221
|
[0.8.9]: https://github.com/tetherto/qvac-harness/compare/v0.8.8...v0.8.9
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</p>
|
|
27
27
|
|
|
28
28
|
```sh
|
|
29
|
-
npm i @qvac/harness
|
|
29
|
+
npm i @qvac/harness @qvac/sdk
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
```ts
|
|
@@ -192,14 +192,18 @@ const delegate = Agent.delegateTool(harness, base, { targets })
|
|
|
192
192
|
|
|
193
193
|
`plan: true` gives an agent `update_plan`, a checklist it sees after every round. A `goal` keeps the
|
|
194
194
|
run going until every step is done or a budget runs out. A goal's `checks` are commands the result
|
|
195
|
-
is judged by
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
is judged by, and until they pass each goal turn names the check and the output of its failed run.
|
|
196
|
+
On a run with a tool that takes a `command`, the model must also name its own checks under a
|
|
197
|
+
`Checks:` line, and the goal is met only once every check, the host's and the model's, ran in a
|
|
198
|
+
call's `command` and exited 0, so host checks alone never meet it. `checksProve: true` says the host
|
|
199
|
+
checks prove the task: the goal is met on them alone and the model is not asked for its own. It has
|
|
200
|
+
no effect without checks. With no tool that takes a `command` and no host checks, the goal ends when the plan is done; host
|
|
201
|
+
checks need a tool that takes a `command`, or the goal runs to its budget.
|
|
202
|
+
`planMode` refuses writes until the user approves the plan.
|
|
199
203
|
|
|
200
204
|
```ts
|
|
201
205
|
const agent = { id: 'lead', bio: 'You are the lead engineer.', plan: true }
|
|
202
|
-
const goal = { objective: 'All tests pass', rounds: 30, checks: ['npm test'] }
|
|
206
|
+
const goal = { objective: 'All tests pass', rounds: 30, checks: ['npm test'], checksProve: true }
|
|
203
207
|
harness.completion({ model, agent, messages, goal })
|
|
204
208
|
```
|
|
205
209
|
|
|
@@ -286,7 +290,15 @@ itself.
|
|
|
286
290
|
| [`Weather`](plugins/weather/README.md) | Weather lookup |
|
|
287
291
|
| [`ObsidianRoute`](plugins/obsidian/README.md) | `obsidian …` commands against a vault |
|
|
288
292
|
|
|
289
|
-
Each plugin is imported from `@qvac/harness/plugins/<folder>`.
|
|
293
|
+
Each plugin is imported from `@qvac/harness/plugins/<folder>`. Its own dependencies are optional
|
|
294
|
+
peers of `@qvac/harness`: a host installs the ones for the plugins it imports
|
|
295
|
+
(`npm i @qvac/asr-ggml @qvac/tts-ggml bare-ffmpeg` for `Speech`), and importing a plugin without
|
|
296
|
+
them throws an error naming them. The shipped sidecar entry composes speech, image, music,
|
|
297
|
+
translation and python, so a host that spawns it installs all of their peers; a host that wants
|
|
298
|
+
fewer writes its own entry with only those plugins. See
|
|
299
|
+
[Plugin dependencies](docs/hosting.md#plugin-dependencies) for each plugin's peers.
|
|
300
|
+
|
|
301
|
+
Writing your own takes one object:
|
|
290
302
|
|
|
291
303
|
```ts
|
|
292
304
|
import { Harness, PLUGIN_API_VERSION, type HarnessPlugin } from '@qvac/harness'
|
package/dist-lib/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
|
2
2
|
import ReadyResource from 'ready-resource';
|
|
3
3
|
import { Policy } from './lib/policy/index.ts';
|
|
4
4
|
import type { EngineBoot, EngineStep, RecoveryResolution } from './lib/run-log/index.ts';
|
|
5
|
-
import { type ModelRoundPort } from './lib/capabilities/completion-engine/index.ts';
|
|
5
|
+
import { type ModelRoundIo, type ModelRoundPort, type ModelRoundRequest, type ModelRoundResult } from './lib/capabilities/completion-engine/index.ts';
|
|
6
6
|
import type { AccessPolicy, AgentConfig, ApproveFn, AskUserFn, AttachFn, CompletionEvent, FetchAttachmentFn, Message, ProgressFn, ResponseFormat, RunGoal, RunInput, ToolDefinition, ToolExecuteContext } from './lib/contract/index.ts';
|
|
7
7
|
import { type DetectLanguageContext, type DetectedLanguage } from './lib/capabilities/detect-language.ts';
|
|
8
8
|
import { type Capability } from './lib/capabilities/invoke.ts';
|
|
@@ -30,7 +30,7 @@ import { type DriveOpFn, type GrantedDrive } from './lib/tools/fs/remote.ts';
|
|
|
30
30
|
import type { ResolvedSkillCatalogEntry } from './lib/tools/skills/catalog.ts';
|
|
31
31
|
import type { SkillSettingEntry } from './lib/tools/skills/skill-settings.ts';
|
|
32
32
|
export type * from './lib/contract/index.ts';
|
|
33
|
-
export { CompletionEngine, type CompletionArgs, type CompletionEngineOptions, type CompletionRun, type ModelRoundEvent, type ModelRoundIo, type ModelRoundPort, type ModelRoundRequest, type ModelRoundResult } from './lib/capabilities/completion-engine/index.ts';
|
|
33
|
+
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';
|
|
34
34
|
export declare const CONTEXT_OVERFLOW_MESSAGE: string;
|
|
35
35
|
export { imageSettingsFrom } from './lib/helpers/image-settings.ts';
|
|
36
36
|
export { skillInContext, unreadySkillState, type CompletionSkillEntry } from './lib/capabilities/skill-entry.ts';
|
|
@@ -293,7 +293,7 @@ export declare class Harness extends ReadyResource {
|
|
|
293
293
|
knowledgeStatus(): Promise<KnowledgeStatus>;
|
|
294
294
|
transcribe(context: TranscribeContext): Promise<string>;
|
|
295
295
|
private _transcribe;
|
|
296
|
-
detectLanguage(context: DetectLanguageContext): DetectedLanguage[]
|
|
296
|
+
detectLanguage(context: DetectLanguageContext): Promise<DetectedLanguage[]>;
|
|
297
297
|
speak(context: SpeakContext): Promise<SpeakResult>;
|
|
298
298
|
private _speak;
|
|
299
299
|
speakStream(context: SpeakStreamContext): AsyncIterable<SpeakResult>;
|
|
@@ -311,6 +311,8 @@ export declare class Harness extends ReadyResource {
|
|
|
311
311
|
invoke(context: InvokeContext): AsyncGenerator<CompletionEvent>;
|
|
312
312
|
private _invoke;
|
|
313
313
|
completion(context: CompletionContext | ResumeCompletionContext): AsyncGenerator<CompletionEvent>;
|
|
314
|
+
serveModelRound(request: ModelRoundRequest, io: ModelRoundIo): Promise<ModelRoundResult>;
|
|
315
|
+
private _servedRoundFailed;
|
|
314
316
|
private _completion;
|
|
315
317
|
private _runCompletion;
|
|
316
318
|
private _access;
|
package/dist-lib/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { platform, totalmem } from 'os';
|
|
|
3
3
|
import process from 'process';
|
|
4
4
|
import ReadyResource from 'ready-resource';
|
|
5
5
|
import { HarnessError } from './lib/errors.js';
|
|
6
|
+
import { androidCpuPlacement } from './lib/hardware/cpu-placement.js';
|
|
6
7
|
import { probeGpuStats } from './lib/hardware/gpu-probe.js';
|
|
7
8
|
import { probeCapabilityProfile } from './lib/hardware/capability-probe.js';
|
|
8
9
|
import { Lifecycle } from './lib/lifecycle/index.js';
|
|
@@ -39,7 +40,7 @@ import { bareRuntime } from './lib/tools/exec/bare-runtime.js';
|
|
|
39
40
|
import { runCommand } from './lib/tools/exec/runner.js';
|
|
40
41
|
import { createLocalRoots } from './lib/tools/fs/local.js';
|
|
41
42
|
import { createRemoteRoots } from './lib/tools/fs/remote.js';
|
|
42
|
-
export { CompletionEngine } from './lib/capabilities/completion-engine/index.js';
|
|
43
|
+
export { CompletionEngine, ToolSets } from './lib/capabilities/completion-engine/index.js';
|
|
43
44
|
export const CONTEXT_OVERFLOW_MESSAGE = HarnessError.CONTEXT_OVERFLOW_MESSAGE;
|
|
44
45
|
export { imageSettingsFrom } from './lib/helpers/image-settings.js';
|
|
45
46
|
export { skillInContext, unreadySkillState } from './lib/capabilities/skill-entry.js';
|
|
@@ -76,6 +77,7 @@ export const PLUGIN_API_VERSION = PluginRegistry.API_VERSION;
|
|
|
76
77
|
const SUSPEND_SETTLE_MS = 500;
|
|
77
78
|
const SPEECH_PLUGIN_MISSING = 'speech needs the speech plugin';
|
|
78
79
|
const KNOWLEDGE_PLUGIN_MISSING = 'knowledge needs the knowledge plugin';
|
|
80
|
+
const UNLOAD_FAILED = 'Runtime unload failed; close the harness before loading models again';
|
|
79
81
|
const HOST_SHELL = { name: 'host' };
|
|
80
82
|
function execOptions(exec) {
|
|
81
83
|
if (!exec)
|
|
@@ -841,13 +843,52 @@ export class Harness extends ReadyResource {
|
|
|
841
843
|
}
|
|
842
844
|
return Agent.follow({ completion: (hop) => this._completion(hop) }, { ...context, goal: undefined });
|
|
843
845
|
}
|
|
846
|
+
async serveModelRound(request, io) {
|
|
847
|
+
if (!this.opened)
|
|
848
|
+
await this.ready();
|
|
849
|
+
this._lifecycle.assertNotClosing();
|
|
850
|
+
if (this.suspended || this._lifecycle.draining) {
|
|
851
|
+
throw new HarnessError('HARNESS_SUSPENDED');
|
|
852
|
+
}
|
|
853
|
+
if (this._lifecycle.unloadFailed) {
|
|
854
|
+
throw new Error(UNLOAD_FAILED);
|
|
855
|
+
}
|
|
856
|
+
const { modelId } = request;
|
|
857
|
+
const { key, acquireRound } = this._residency.servedRound(modelId);
|
|
858
|
+
let served;
|
|
859
|
+
const round = this._lifecycle.trackCompletion((signal) => this._residency.busyStream(async function* () {
|
|
860
|
+
served = await CompletionEngine.serveModelRound(request, { signal, emit: (event) => io.emit(event), retake: () => io.retake() }, { acquireRound });
|
|
861
|
+
}), io.signal);
|
|
862
|
+
try {
|
|
863
|
+
await round.next();
|
|
864
|
+
}
|
|
865
|
+
catch (err) {
|
|
866
|
+
throw await this._servedRoundFailed(err, modelId, key);
|
|
867
|
+
}
|
|
868
|
+
if (!served) {
|
|
869
|
+
throw new Error('A served round ended without its result');
|
|
870
|
+
}
|
|
871
|
+
this._residency.clearFaults(modelId);
|
|
872
|
+
return served;
|
|
873
|
+
}
|
|
874
|
+
async _servedRoundFailed(err, model, key) {
|
|
875
|
+
const aborted = err instanceof AbortedError || this.suspended || this._lifecycle.draining;
|
|
876
|
+
if (aborted || !isSdkModelWedgedError(err)) {
|
|
877
|
+
return err;
|
|
878
|
+
}
|
|
879
|
+
const wedged = await this._residency.evictWedged(model, key);
|
|
880
|
+
if (wedged.fatal) {
|
|
881
|
+
setTimeout(() => process.exit(1), 0);
|
|
882
|
+
}
|
|
883
|
+
return new Error(wedged.message, { cause: err });
|
|
884
|
+
}
|
|
844
885
|
_completion(context) {
|
|
845
886
|
this._lifecycle.assertNotClosing();
|
|
846
887
|
if (this._lifecycle.draining) {
|
|
847
888
|
throw new HarnessError('HARNESS_SUSPENDED');
|
|
848
889
|
}
|
|
849
890
|
if (this._lifecycle.unloadFailed) {
|
|
850
|
-
throw new Error(
|
|
891
|
+
throw new Error(UNLOAD_FAILED);
|
|
851
892
|
}
|
|
852
893
|
return this._lifecycle.trackCompletion((signal) => this._residency.busyStream(() => this._runCompletion({ ...context, signal })), context.signal);
|
|
853
894
|
}
|
|
@@ -88,7 +88,8 @@ export function inspectCall(deps, context, snapshot) {
|
|
|
88
88
|
execution,
|
|
89
89
|
resource,
|
|
90
90
|
call: snapshot,
|
|
91
|
-
answeredRead
|
|
91
|
+
answeredRead,
|
|
92
|
+
unknownTool: unknownToolError(session, resolved.call.name)
|
|
92
93
|
});
|
|
93
94
|
return {
|
|
94
95
|
call: snapshot,
|
|
@@ -110,10 +111,19 @@ export function inspectCall(deps, context, snapshot) {
|
|
|
110
111
|
rejection
|
|
111
112
|
};
|
|
112
113
|
}
|
|
114
|
+
function unknownToolError(session, name) {
|
|
115
|
+
const searchable = session.sdkTools?.some((tool) => tool.name === name && tool.deferLoading);
|
|
116
|
+
const [owner] = searchable
|
|
117
|
+
? (Agent.collectToolGrants(session.inContextSkills).grantedOwners.get(name) ?? [])
|
|
118
|
+
: [];
|
|
119
|
+
return owner
|
|
120
|
+
? `${name} needs the ${owner} skill. Load it first, then call ${name}.`
|
|
121
|
+
: `unknown tool: ${name}`;
|
|
122
|
+
}
|
|
113
123
|
const SKILL_WRITE_DENIED = 'Skill loaders must be read-only; this operation was not run.';
|
|
114
124
|
const repeatedReadMessage = (name) => `The result of this exact ${name} call is already above. Answer from it now; ` +
|
|
115
125
|
`do not call ${name} again with the same arguments.`;
|
|
116
|
-
function inspectRejection({ context, plan, execution, resource, call, answeredRead }) {
|
|
126
|
+
function inspectRejection({ context, plan, execution, resource, call, answeredRead, unknownTool }) {
|
|
117
127
|
const effect = plan.effect;
|
|
118
128
|
const source = plan.source;
|
|
119
129
|
const base = { activity: null, effect, source };
|
|
@@ -165,7 +175,7 @@ function inspectRejection({ context, plan, execution, resource, call, answeredRe
|
|
|
165
175
|
if (!plan.toolAvailable) {
|
|
166
176
|
return {
|
|
167
177
|
...base,
|
|
168
|
-
result: { error:
|
|
178
|
+
result: { error: unknownTool },
|
|
169
179
|
activity: policyActivity({ call, effect, resource: null })
|
|
170
180
|
};
|
|
171
181
|
}
|
|
@@ -4,6 +4,7 @@ import { labelOf, skillEmojiFrom } from '../loop.js';
|
|
|
4
4
|
import { readyPreflightFromFacts, reportFailure } from '../tool-execution.js';
|
|
5
5
|
import { skillFileKey } from '../../tool-plan.js';
|
|
6
6
|
import { toolResultTurn } from '../../tool-turns.js';
|
|
7
|
+
import { skillLoadTurns } from '../../sdk-tool.js';
|
|
7
8
|
import { isRecord } from '../../../guards.js';
|
|
8
9
|
import { loadedSkills } from '../session.js';
|
|
9
10
|
import { trustedSources } from './execution-plan.js';
|
|
@@ -82,8 +83,14 @@ export async function loadSkill({ emit, input: deps, context }, plan) {
|
|
|
82
83
|
session.loadedFilesThisTurn.add(fileKey);
|
|
83
84
|
}
|
|
84
85
|
session.reselectTools?.(new Set([...loadedSkills(context, session), skillName]));
|
|
86
|
+
const skill = session.inContextSkills.find(({ name }) => name === skillName);
|
|
87
|
+
const loads = skillLoadTurns(skill, {
|
|
88
|
+
sent: session.sdkTools,
|
|
89
|
+
enabled: session.enabled,
|
|
90
|
+
history
|
|
91
|
+
});
|
|
85
92
|
return {
|
|
86
|
-
history: spliceFrom(context.history, history),
|
|
93
|
+
history: spliceFrom(context.history, [...history, ...loads]),
|
|
87
94
|
source: session.outbound.facts('skill', turn),
|
|
88
95
|
activate: skillName
|
|
89
96
|
};
|