@qvac/harness 1.0.0-rc.14 → 1.0.0-rc.16
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 +112 -0
- package/README.md +36 -6
- package/dist-lib/index.d.ts +2 -0
- package/dist-lib/index.js +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.js +20 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +2 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +5 -2
- package/dist-lib/lib/capabilities/completion-engine/driver.js +15 -0
- package/dist-lib/lib/capabilities/completion-engine/engine.js +23 -39
- package/dist-lib/lib/capabilities/completion-engine/loop.js +2 -1
- package/dist-lib/lib/capabilities/completion-engine/operations.js +1 -0
- package/dist-lib/lib/capabilities/completion-engine/round.js +14 -6
- package/dist-lib/lib/contract/completion.d.ts +6 -0
- package/dist-lib/lib/contract/models.d.ts +1 -1
- package/dist-lib/lib/contract/ocr.d.ts +9 -0
- package/dist-lib/lib/contract/ocr.js +1 -0
- package/dist-lib/lib/contract/run.d.ts +2 -0
- package/dist-lib/lib/helpers/goal-check.d.ts +26 -0
- package/dist-lib/lib/helpers/goal-check.js +248 -22
- package/dist-lib/lib/helpers/spawn-path.d.ts +1 -0
- package/dist-lib/lib/helpers/spawn-path.js +2 -1
- package/dist-lib/lib/machine/completion/actions/completion.d.ts +3 -2
- package/dist-lib/lib/machine/completion/actions/completion.js +65 -15
- package/dist-lib/lib/machine/completion/actions/tools.js +47 -6
- package/dist-lib/lib/machine/completion/context.js +5 -1
- package/dist-lib/lib/machine/completion/implementations.d.ts +1 -0
- package/dist-lib/lib/machine/completion/implementations.js +7 -0
- package/dist-lib/lib/machine/completion/machine.d.ts +4 -1
- package/dist-lib/lib/machine/completion/machine.js +10 -1
- package/dist-lib/lib/machine/completion/rules.d.ts +3 -1
- package/dist-lib/lib/machine/completion/rules.js +25 -4
- package/dist-lib/lib/machine/completion/types.d.ts +16 -0
- package/dist-lib/lib/machine/index.d.ts +6 -1
- package/dist-lib/lib/machine/index.js +2 -0
- package/dist-lib/lib/models/gpu-selection.d.ts +6 -1
- package/dist-lib/lib/models/gpu-selection.js +29 -5
- package/dist-lib/lib/models/model-pool.js +1 -2
- package/dist-lib/lib/office/engine/pptx/presentation.js +10 -5
- package/dist-lib/lib/plugins/registry.d.ts +2 -0
- package/dist-lib/lib/serve.js +5 -34
- package/dist-lib/lib/sidecar/index.js +1 -1
- package/dist-lib/lib/skills-host/index.d.ts +1 -1
- package/dist-lib/lib/skills-host/index.js +3 -2
- package/dist-lib/lib/spawn.d.ts +1 -0
- package/dist-lib/lib/tools/exec/runner.d.ts +4 -0
- package/dist-lib/lib/tools/exec/runner.js +20 -3
- package/dist-lib/lib/tools/files/read-file.js +3 -3
- package/dist-lib/lib/tools/fs/document-text.d.ts +7 -1
- package/dist-lib/lib/tools/fs/document-text.js +9 -2
- package/dist-lib/lib/tools/office.js +1 -0
- package/dist-lib/lib/tools/operations/builders.d.ts +4 -3
- package/dist-lib/lib/tools/operations/builders.js +41 -3
- package/dist-lib/lib/tools/operations/calendar-range.d.ts +16 -0
- package/dist-lib/lib/tools/operations/calendar-range.js +40 -0
- package/dist-lib/lib/tools/operations/compile.js +4 -2
- package/dist-lib/lib/tools/operations/manifest.d.ts +4 -0
- package/dist-lib/lib/tools/pdf/build.d.ts +11 -1
- package/dist-lib/lib/tools/pdf/build.js +52 -16
- package/dist-lib/lib/tools/pdf/recognize.d.ts +13 -0
- package/dist-lib/lib/tools/pdf/recognize.js +58 -0
- package/dist-lib/lib/tools/pdf.js +18 -4
- package/dist-lib/lib/tools/skills/overlay-watch.d.ts +2 -2
- package/dist-lib/lib/tools/skills/overlay-watch.js +4 -3
- package/dist-lib/lib/wire.js +9 -3
- package/dist-lib/plugins/image/index.js +5 -5
- package/dist-lib/plugins/music/index.js +4 -4
- package/dist-lib/plugins/ocr/bmp.d.ts +2 -0
- package/dist-lib/plugins/ocr/bmp.js +27 -0
- package/dist-lib/plugins/ocr/index.d.ts +12 -0
- package/dist-lib/plugins/ocr/index.js +18 -0
- package/dist-lib/plugins/ocr/ocr-runtime.d.ts +23 -0
- package/dist-lib/plugins/ocr/ocr-runtime.js +82 -0
- package/dist-lib/plugins/ocr/reading-order.d.ts +5 -0
- package/dist-lib/plugins/ocr/reading-order.js +71 -0
- package/dist-lib/plugins/sandbox-linux/index.js +2 -2
- package/dist-lib/plugins/sandbox-macos/index.js +2 -2
- package/dist-lib/plugins/sandbox-vm/index.d.ts +2 -1
- package/dist-lib/plugins/sandbox-vm/index.js +2 -2
- package/dist-lib/plugins/sandbox-vm/vm-shell.d.ts +3 -1
- package/dist-lib/plugins/sandbox-vm/vm-shell.js +45 -16
- package/dist-lib/plugins/sandbox-windows/index.js +2 -2
- 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/package.json +14 -5
- package/scripts/addon-externals.cjs +3 -0
- package/worker/harness-sidecar.mjs +5 -0
- package/dist-lib/lib/capabilities/completion-engine/event-mailbox.d.ts +0 -20
- package/dist-lib/lib/capabilities/completion-engine/event-mailbox.js +0 -110
- package/dist-lib/lib/helpers/input-budget.d.ts +0 -8
- package/dist-lib/lib/helpers/input-budget.js +0 -9
- package/patches/localwatch@1.4.3.patch +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -21,6 +21,16 @@ breaking change is listed under Changed and Removed.
|
|
|
21
21
|
|
|
22
22
|
### Added
|
|
23
23
|
|
|
24
|
+
- A scanned PDF page is read by OCR. The `ocr` plugin
|
|
25
|
+
(`@qvac/harness/plugins/ocr`) runs DocTR over the SDK's `ggml-ocr` as one
|
|
26
|
+
pooled model, unloaded when idle; `pdf` and `read_file` use it for a page with
|
|
27
|
+
an image and no text layer, and the reply notes the page was read by OCR. On
|
|
28
|
+
by default; `pluginOptions.ocr: false` leaves it out for a host that shows
|
|
29
|
+
scanned pages to the model as images. See
|
|
30
|
+
[plugins/ocr/README.md](plugins/ocr/README.md) and
|
|
31
|
+
[the decision record](docs/decisions/2026-11-03-a-scanned-pdf-page-is-read-by-ocr.md).
|
|
32
|
+
(#768)
|
|
33
|
+
|
|
24
34
|
- `isLoading` covers image and music models, and a reply waiting for room. An
|
|
25
35
|
image or music row reads `true` from the request, through any wait for a
|
|
26
36
|
download or for room, until the model is resident or the load fails, and the
|
|
@@ -461,6 +471,55 @@ breaking change is listed under Changed and Removed.
|
|
|
461
471
|
|
|
462
472
|
### Changed
|
|
463
473
|
|
|
474
|
+
- Importing `@qvac/harness/plugins/image` or `@qvac/harness/plugins/music` no
|
|
475
|
+
longer needs their peers; constructing `Image` or `Music` without them throws
|
|
476
|
+
the error naming the plugin and the missing packages. A sidecar host passing no
|
|
477
|
+
image or music model installs neither's peers.
|
|
478
|
+
|
|
479
|
+
- **Breaking:** a command that times out resolves instead of throwing.
|
|
480
|
+
`runCommand` (`lib/tools/exec/runner.ts`) and the `exec` tool result come
|
|
481
|
+
back as `{ stdout, stderr, exitCode: 124 }`: `stdout` and `stderr` hold what
|
|
482
|
+
the command printed before the kill, and a note goes at the end of `stderr`,
|
|
483
|
+
added after the head/tail cut so the cut never drops it. There is no `error`
|
|
484
|
+
field and no `COMMAND_TIMED_OUT`. This holds on the host shell and the Linux,
|
|
485
|
+
macOS and Windows sandboxes. An abort still rejects with `AbortedError`. The
|
|
486
|
+
Pyodide `python` language still throws `COMMAND_TIMED_OUT` and `quickjs` still
|
|
487
|
+
throws a plain error. (#742)
|
|
488
|
+
|
|
489
|
+
```js
|
|
490
|
+
import { HarnessError } from '@qvac/harness/errors'
|
|
491
|
+
import { runCommand } from '@qvac/harness/lib/tools/exec/runner.ts'
|
|
492
|
+
|
|
493
|
+
// before
|
|
494
|
+
try {
|
|
495
|
+
await runCommand('npm test', { spawn, timeoutMs: 60_000 })
|
|
496
|
+
} catch (err) {
|
|
497
|
+
if (HarnessError.is(err, 'COMMAND_TIMED_OUT')) retry()
|
|
498
|
+
}
|
|
499
|
+
// after
|
|
500
|
+
const result = await runCommand('npm test', { spawn, timeoutMs: 60_000 })
|
|
501
|
+
if (result.exitCode === 124) retry(result.stdout)
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
- Exec sets `PYTHONUNBUFFERED=1` (`EXEC_ENV_DEFAULTS` in
|
|
505
|
+
`lib/helpers/spawn-path.ts`), so a python child's output reaches the pipe
|
|
506
|
+
before a timeout's kill instead of dying in its block buffer. `execEnv`
|
|
507
|
+
always sets it, as it is not on the env allowlist. The Linux, macOS and
|
|
508
|
+
Windows sandboxes spread it first, so a policy `env` allowlist that leaves
|
|
509
|
+
it out still passes it, and an explicit value wins. (#742)
|
|
510
|
+
|
|
511
|
+
- The ask for checks of the model's own stops after two goal turns it ignored
|
|
512
|
+
on every goal, not only one whose host checks test behaviour. A goal with no
|
|
513
|
+
host checks is then met on its plan. A goal whose host checks only test that
|
|
514
|
+
a file exists stays open until a passing check runs or reads what they test,
|
|
515
|
+
and each goal turn asks for one; a passing test runner, test script or
|
|
516
|
+
assertion that runs it is held as a check even after the model named others.
|
|
517
|
+
A run no longer repeats the same ask until its time budget. (#721)
|
|
518
|
+
|
|
519
|
+
- A spawned harness that cannot open now fails its sidecar's start with the
|
|
520
|
+
harness's own error, instead of serving a harness whose every call fails. A
|
|
521
|
+
supervising host sees the boot fail and why. (core v1 follow-up H1)
|
|
522
|
+
|
|
464
523
|
- A goal with host checks that test behaviour stops asking the model for checks
|
|
465
524
|
of its own after two goal turns it ignored. From then on the plan and the host
|
|
466
525
|
checks meet it, and a check the model names later still gates it. A goal with
|
|
@@ -468,6 +527,47 @@ breaking change is listed under Changed and Removed.
|
|
|
468
527
|
file exists (`test -s`, `[ -f ... ]`), the ask stays until the model names a
|
|
469
528
|
check or a passing test runner, test script or inline assertion proves the
|
|
470
529
|
result; that run is held as a check of its own. (#686)
|
|
530
|
+
- Breaking for hosts that send only `test -s` checks: a goal whose host checks
|
|
531
|
+
all test only that a path exists is met only once its checks pass and one of
|
|
532
|
+
them names a path the host checks test (not with `cat`, `ls` or another
|
|
533
|
+
command that only shows or moves a file, nor a `test` with no comparison),
|
|
534
|
+
runs a script whose written text names one (a heredoc, a `>` line,
|
|
535
|
+
`write_file` or `edit_file`), or runs a test runner on no given script
|
|
536
|
+
(`npm test`, `pytest`). While every check passes and none does this, each
|
|
537
|
+
goal turn asks for such a check, and until one does, the checks the model
|
|
538
|
+
names are added, so a run that used to end `met` now goes on until one passes
|
|
539
|
+
or a budget runs out. Set `goal.checksProve: true` when the
|
|
540
|
+
checks prove the task. (#698) Once that holds, one goal turn asks the model
|
|
541
|
+
to list the task's requirements and to name a check for each one the checks
|
|
542
|
+
miss, and adds those checks. (#694) A check wrapped in `timeout`, `env`,
|
|
543
|
+
`nice` or `stdbuf` is read as the command it runs; `nohup` is not, as
|
|
544
|
+
`nohup X &` exits at once. (#700, #703) On every goal, a write to a script resets
|
|
545
|
+
the pass of each check that runs it, so a pass from before the rewrite never
|
|
546
|
+
counts. (#701)
|
|
547
|
+
- Breaking for hosts that pass a `goal`: on a run with a tool that takes a
|
|
548
|
+
`command`, plan and checks no longer meet a goal on their own. Once the model
|
|
549
|
+
writes a source file, known by its extension for the languages a run can be
|
|
550
|
+
read for (Python, JavaScript and TypeScript, shell, Ruby, Perl, PHP, Lua, R,
|
|
551
|
+
Julia, Go, Rust, C and C++, Java; not `.txt`, `.json`, `.csv` or `.md`), the
|
|
552
|
+
goal stays open until a later command that runs that code exits 0, and once
|
|
553
|
+
the checks pass each goal turn asks for that run. A run is the file run as a
|
|
554
|
+
program or by its interpreter (`go run`, `Rscript`, `julia`, `tsx`,
|
|
555
|
+
`ts-node`, `java X.java`, and through `npx` or `bunx`), a test suite or test
|
|
556
|
+
script, `go run .`, `cargo run` or a build then a run in one command, or a
|
|
557
|
+
passing check that runs a script or a test suite. A reader such as `cat` or
|
|
558
|
+
`grep`, also by its `/bin` or `/usr/bin` path after a build, a run after
|
|
559
|
+
`make clean`, `make -n` or a cmake clean target, a compile, lint or syntax
|
|
560
|
+
check, and a run piped or followed by `|| true` or `;` do not count. Every
|
|
561
|
+
goal, whatever its host checks and with `checksProve` set, then takes a
|
|
562
|
+
review turn that asks for each requirement with the command that proves it.
|
|
563
|
+
The `goal` event carries `proof`, the command that ran the edited code,
|
|
564
|
+
recorded as `goalProof` in the bench trial row. (#732, #735, #745) The review
|
|
565
|
+
reply answers it only when a line above its `Checks:` names, in backticks, a
|
|
566
|
+
passed check or the run that proved the code; a reply with no calls that
|
|
567
|
+
names none is asked again, at most twice in all. A goal met with more than
|
|
568
|
+
half of each budget left takes one turn on the cases the task names; the met
|
|
569
|
+
`goal` event then carries `cases: true`, recorded as `goalCases`, and
|
|
570
|
+
`RunBudget.totalMs` keeps the whole time budget. (#740)
|
|
471
571
|
- A host reaches the drive protocol it serves, the skill catalog and the
|
|
472
572
|
user-plugin import map through named entries: `@qvac/harness/drive`
|
|
473
573
|
(`DriveRequest`, `DriveResponse`, `DriveEntry`, `GrantedDrive`, `DriveOpFn`,
|
|
@@ -1087,6 +1187,18 @@ breaking change is listed under Changed and Removed.
|
|
|
1087
1187
|
|
|
1088
1188
|
### Fixed
|
|
1089
1189
|
|
|
1190
|
+
- Calendar reads build their own query: validated arguments, encoded dates
|
|
1191
|
+
and timezone offsets, and a local day range resolved from the turn's clock
|
|
1192
|
+
that holds across pages and DST, so "today" and "tomorrow" no longer fail
|
|
1193
|
+
and get explained as a credential problem. (#770)
|
|
1194
|
+
- On Linux the NVIDIA card is pinned as `main-gpu` only when another GPU could
|
|
1195
|
+
take the load. A host whose NVIDIA GPU is the only one, such as a DGX Spark
|
|
1196
|
+
or a Jetson, registers it as integrated and was loading on the CPU. (#786)
|
|
1197
|
+
- Restore the completion output queue and pending-input handling from before #684.
|
|
1198
|
+
Output events retain their original boundaries, with no mailbox chunking,
|
|
1199
|
+
coalescing, or count/byte limits. Pending steer/follow-up inputs no longer have
|
|
1200
|
+
admission limits in the engine or transport. Unread output and pending input
|
|
1201
|
+
remain unbounded in memory.
|
|
1090
1202
|
- `tools/list` through `mcp_call` comes back as a line per tool, with each
|
|
1091
1203
|
argument's type and allowed values, and `params.names` gives the tools named
|
|
1092
1204
|
whole. Asana's 52 tools were 148 KB, so the model saw 5 of them cut or waited
|
package/README.md
CHANGED
|
@@ -194,13 +194,43 @@ const delegate = Agent.delegateTool(harness, base, { targets })
|
|
|
194
194
|
`plan: true` gives an agent `update_plan`, a checklist it sees after every round. A `goal` keeps the
|
|
195
195
|
run going until every step is done or a budget runs out. A goal's `checks` are commands the result
|
|
196
196
|
is judged by, and until they pass each goal turn names the check and the output of its failed run.
|
|
197
|
-
On a run with a tool that takes a `command`, the model
|
|
197
|
+
On a run with a tool that takes a `command`, the model is also asked to name its own checks under a
|
|
198
198
|
`Checks:` line, and the goal is met only once every check, the host's and the model's, ran in a
|
|
199
|
-
call's `command` and exited 0. With
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
199
|
+
call's `command` and exited 0. With no tool that takes a `command` and no host checks, the goal ends
|
|
200
|
+
when the plan is done; host checks need a tool that takes a `command`, or the goal runs to its
|
|
201
|
+
budget.
|
|
202
|
+
|
|
203
|
+
The ask stops after two goal turns the model ignores. From then on the plan and any host checks,
|
|
204
|
+
such as `npm test`, meet the goal once the gates below hold. When every host check only tests that a
|
|
205
|
+
path exists (`test -s out.txt`, `[ -f out.txt ]`), a passing test runner, test script or assertion
|
|
206
|
+
also counts as a check the model named. Such a goal is met only once its checks pass and one of them
|
|
207
|
+
names a path the host checks test, runs a script the model wrote that names one, or runs a test
|
|
208
|
+
runner on no given script, such as `npm test` or `pytest`. `cat`, `ls` and other commands that only
|
|
209
|
+
show or move a file do not count, nor does a `test` with no comparison. While every check passes and
|
|
210
|
+
none does this, each goal turn asks for such a check, and until one does, the checks the model names
|
|
211
|
+
are added. A check wrapped in `timeout`, `env`, `nice` or `stdbuf` counts as the command it runs.
|
|
212
|
+
|
|
213
|
+
On a run with a tool that takes a `command`, three more gates hold on every goal. Once the model
|
|
214
|
+
writes a source file, known by its extension (`.py`, `.js`, `.ts`, `.sh`, `.go`, `.rs`, `.c`,
|
|
215
|
+
`.java` and the like, not `.txt`, `.json`, `.csv` or `.md`), the goal is met only after a later
|
|
216
|
+
command runs that code and exits 0; once the checks pass, each goal turn asks for that run. A run
|
|
217
|
+
counts when it runs the file as a program or through its interpreter, runs a test suite (`pytest`,
|
|
218
|
+
`npm test`, `cargo test`, `go test`) or a test script, builds and runs the project (`go run .`,
|
|
219
|
+
`cargo run`, or a build then a run in one command), or is a passing check that runs a script or a
|
|
220
|
+
test suite. `cat`, `grep`, `diff` and other commands that only read a file do not count, nor does a
|
|
221
|
+
compile, lint or syntax check, nor a run piped or followed by `|| true` or `;`. Another write to a
|
|
222
|
+
source file needs a new run. Once the checks pass and the code ran, one goal turn asks the model to
|
|
223
|
+
list each requirement of the task with the command that proves it and the output it gave, then,
|
|
224
|
+
under a `Checks:` line, a command for each requirement nothing proved. The reply answers it only
|
|
225
|
+
when a line above its `Checks:` names, in backticks, a passed check or the run that proved the code;
|
|
226
|
+
otherwise the turn is asked again, at most twice in all. The commands it names under `Checks:` are
|
|
227
|
+
added. A goal met with more than half of each budget left (time, rounds, and the goal's tokens when
|
|
228
|
+
it caps them) then takes one turn on the cases the task names. `checksProve: true` says the host
|
|
229
|
+
checks prove the task: the goal skips the ask and the gate on the paths, and still takes the run
|
|
230
|
+
gate, the review turn and the cases turn. It has no effect without checks. On every goal,
|
|
231
|
+
`checksProve` included, a write to a script resets the pass of each check that runs it, so the check
|
|
232
|
+
must pass again.
|
|
233
|
+
|
|
204
234
|
`planMode` refuses writes until the user approves the plan.
|
|
205
235
|
|
|
206
236
|
```ts
|
package/dist-lib/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ 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
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
|
+
export { renderedTools } from './lib/capabilities/sdk-tool.ts';
|
|
34
35
|
export declare const CONTEXT_OVERFLOW_MESSAGE: string;
|
|
35
36
|
export { imageSettingsFrom } from './lib/helpers/image-settings.ts';
|
|
36
37
|
export { skillInContext, unreadySkillState, type CompletionSkillEntry } from './lib/capabilities/skill-entry.ts';
|
|
@@ -43,6 +44,7 @@ export type { ModelSourceFile, ModelSourcePreview, ModelSourceRefusal, PreviewMo
|
|
|
43
44
|
export type { ModelFitBasis, ModelFitEvidence, ModelFitVerdict } from './lib/models/model-fit.ts';
|
|
44
45
|
export * from './lib/capabilities/download.ts';
|
|
45
46
|
export type { EmbedContext } from './lib/capabilities/embed.ts';
|
|
47
|
+
export type { OcrImage, OcrService } from './lib/contract/ocr.ts';
|
|
46
48
|
export type { SpeakContext, SpeakResult, SpeakStreamContext, SpeechService, TranscribeContext } from './lib/contract/speech.ts';
|
|
47
49
|
export type { EmbedDevice } from './lib/models/embed-config.ts';
|
|
48
50
|
export type { MemoryBudget } from './lib/hardware/memory-budget.ts';
|
package/dist-lib/index.js
CHANGED
|
@@ -40,6 +40,7 @@ import { runCommand } from './lib/tools/exec/runner.js';
|
|
|
40
40
|
import { createLocalRoots } from './lib/tools/fs/local.js';
|
|
41
41
|
import { createRemoteRoots } from './lib/tools/fs/remote.js';
|
|
42
42
|
export { CompletionEngine, ToolSets } from './lib/capabilities/completion-engine/index.js';
|
|
43
|
+
export { renderedTools } from './lib/capabilities/sdk-tool.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';
|
|
@@ -156,7 +157,7 @@ export class Harness extends ReadyResource {
|
|
|
156
157
|
},
|
|
157
158
|
statusChanged: () => this._residency.invalidateStatus(),
|
|
158
159
|
teardown: async () => {
|
|
159
|
-
this._skills.close();
|
|
160
|
+
await this._skills.close();
|
|
160
161
|
await this._teardownPlugins();
|
|
161
162
|
}
|
|
162
163
|
});
|
|
@@ -11,7 +11,7 @@ import { runToolCall } from './execute.js';
|
|
|
11
11
|
import { toolCaller } from '../tool-caller.js';
|
|
12
12
|
import { loadSkill } from './loading-skill.js';
|
|
13
13
|
import { failureResultRef, storeFailureResult } from '../../../helpers/failure-result.js';
|
|
14
|
-
import { provesResult, runsCheck } from '../../../helpers/goal-check.js';
|
|
14
|
+
import { namesPath, provesResult, runsCheck, writtenTexts } from '../../../helpers/goal-check.js';
|
|
15
15
|
const CHECK_OUTPUT_CHARS = 2000;
|
|
16
16
|
export const executing = async function executing(input) {
|
|
17
17
|
const { emit, input: deps, context } = input;
|
|
@@ -56,6 +56,8 @@ export const executing = async function executing(input) {
|
|
|
56
56
|
durationMs: settled.durationMs,
|
|
57
57
|
checked: settled.checked,
|
|
58
58
|
proved: settled.proved,
|
|
59
|
+
wrote: settled.wrote,
|
|
60
|
+
ran: settled.ran,
|
|
59
61
|
plan: planned ? Agent.planSteps(callArgs) : undefined,
|
|
60
62
|
leftPlanMode: planned && context.planMode && call.leavesPlan ? true : undefined
|
|
61
63
|
};
|
|
@@ -209,6 +211,12 @@ export function settleCall({ input: { session }, context }, { ran, direct, emit
|
|
|
209
211
|
proved: executed.executed && succeeded && context.goal
|
|
210
212
|
? proofRun(callArgs.command, executed.output)
|
|
211
213
|
: undefined,
|
|
214
|
+
wrote: executed.executed && outcome.kind === 'success'
|
|
215
|
+
? writtenScripts(context, callArgs)
|
|
216
|
+
: undefined,
|
|
217
|
+
ran: executed.executed && succeeded && context.goal && typeof callArgs.command === 'string'
|
|
218
|
+
? callArgs.command
|
|
219
|
+
: undefined,
|
|
212
220
|
entry: toolResultHistoryEntry({
|
|
213
221
|
name: call.name,
|
|
214
222
|
id: resultTurnId,
|
|
@@ -226,6 +234,17 @@ function checksRun({ goal }, { command, passed, output }) {
|
|
|
226
234
|
}
|
|
227
235
|
return ran.map(({ name }) => ({ name, passed, output: outputTail(output) }));
|
|
228
236
|
}
|
|
237
|
+
function writtenScripts({ goal }, args) {
|
|
238
|
+
if (!goal) {
|
|
239
|
+
return undefined;
|
|
240
|
+
}
|
|
241
|
+
const { deliverable } = goal;
|
|
242
|
+
const fragment = typeof args.content !== 'string' && typeof args.new === 'string';
|
|
243
|
+
const wrote = writtenTexts(args).map(([path, text]) => deliverable
|
|
244
|
+
? { path, proving: namesPath(text, deliverable) || (fragment ? undefined : false) }
|
|
245
|
+
: { path });
|
|
246
|
+
return wrote.length ? wrote : undefined;
|
|
247
|
+
}
|
|
229
248
|
function proofRun(command, output) {
|
|
230
249
|
const name = typeof command === 'string' ? provesResult(command) : undefined;
|
|
231
250
|
return name ? { name, passed: true, output: outputTail(output) } : undefined;
|
|
@@ -21,6 +21,7 @@ export function resolvedCall(session, call) {
|
|
|
21
21
|
export function toolContext({ deps, context, name }) {
|
|
22
22
|
const { args, session, commitFacts } = deps;
|
|
23
23
|
return {
|
|
24
|
+
currentTime: args.messages.findLast((turn) => turn.role === 'user')?.sentAt || session.startedAt,
|
|
24
25
|
...session.toolContext(session.turnImages, context.metrics.ctxSize ?? args.ctxSize, args.signal),
|
|
25
26
|
skills: context.activated.filter((skill) => Agent.skillIsActive(skill, session.activation) &&
|
|
26
27
|
!unreadySkillState(skill, args.skillCatalog ?? [])),
|
|
@@ -32,6 +33,7 @@ export function toolContext({ deps, context, name }) {
|
|
|
32
33
|
policy: session.access,
|
|
33
34
|
toolNames: session.enabled.map((tool) => tool.name),
|
|
34
35
|
knowledge: args.knowledge,
|
|
36
|
+
ocr: deps.services?.ocr,
|
|
35
37
|
planMode: context.planMode,
|
|
36
38
|
spill: session.enabled.some((tool) => tool.name === 'read_file')
|
|
37
39
|
? runSpill(session.runId)
|
|
@@ -33,7 +33,7 @@ export const wrapUp = async function wrapUp({ emit, input: { sdk, args, session,
|
|
|
33
33
|
goalNudge: context.policy.goalNudge,
|
|
34
34
|
wrapUpNudge: context.policy.wrapUpNudge,
|
|
35
35
|
tools: session.sdkTools,
|
|
36
|
-
generationParams: wrapUpParams(session.generationParams),
|
|
36
|
+
generationParams: wrapUpParams(session.generationParams, context.outcome === 'time-capped'),
|
|
37
37
|
toolDialect: args.model ? toolDialectFor(args.model) : undefined,
|
|
38
38
|
cacheKey,
|
|
39
39
|
signal,
|
|
@@ -78,7 +78,10 @@ export const wrapUp = async function wrapUp({ emit, input: { sdk, args, session,
|
|
|
78
78
|
response: replay || contentText || fallbackResponse
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
|
-
function wrapUpParams(params) {
|
|
81
|
+
function wrapUpParams(params, timeUp) {
|
|
82
|
+
if (timeUp) {
|
|
83
|
+
return { ...params, reasoning_budget: 0, predict: WRAP_UP_PREDICT, tool_choice: 'none' };
|
|
84
|
+
}
|
|
82
85
|
if (!params) {
|
|
83
86
|
return { tool_choice: 'none' };
|
|
84
87
|
}
|
|
@@ -79,6 +79,20 @@ async function* submittedInput(input, pipeline, { runId, agentId }) {
|
|
|
79
79
|
yield submitted.context === undefined ? item : { ...item, notes: submitted.context };
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
function* cutGoal(context, runId) {
|
|
83
|
+
const { goal } = context;
|
|
84
|
+
if (goal?.status !== 'open') {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
yield {
|
|
88
|
+
type: 'goal',
|
|
89
|
+
runId,
|
|
90
|
+
status: CompletionMachine.goalStatus(context),
|
|
91
|
+
turn: goal.turns,
|
|
92
|
+
round: context.round,
|
|
93
|
+
proof: goal.proof
|
|
94
|
+
};
|
|
95
|
+
}
|
|
82
96
|
function hookManifest(hooks) {
|
|
83
97
|
const ordinals = new Map();
|
|
84
98
|
return hooks.map((hook) => {
|
|
@@ -616,6 +630,7 @@ export async function* driveCompletion(args, runtime, options) {
|
|
|
616
630
|
'tag' in result.error &&
|
|
617
631
|
result.error.tag === 'aborted') {
|
|
618
632
|
reachedPause = true;
|
|
633
|
+
yield* cutGoal(snapshot.context, runId);
|
|
619
634
|
yield* runMetrics(cancelledRound(completionState.session?.liveRound));
|
|
620
635
|
throw new AbortedError();
|
|
621
636
|
}
|
|
@@ -9,8 +9,6 @@ import { createCompletionActors, createInvokeTracker } from './actors.js';
|
|
|
9
9
|
import { replayFinalRound, replaySuccessOutput } from './replay-output.js';
|
|
10
10
|
import { AbortedError, rehydrateError, tagError } from '../../helpers/engine-error.js';
|
|
11
11
|
import { turnText } from './turns.js';
|
|
12
|
-
import { EventMailbox } from './event-mailbox.js';
|
|
13
|
-
import { acceptsInput, inputBytes } from '../../helpers/input-budget.js';
|
|
14
12
|
import { CompletionMachine } from '../../machine/index.js';
|
|
15
13
|
function readRestoredSnapshot(value) {
|
|
16
14
|
if (!isRecord(value) || Array.isArray(value))
|
|
@@ -115,7 +113,7 @@ export async function* runEngine(run, options = {}) {
|
|
|
115
113
|
yield started(run);
|
|
116
114
|
const invokes = createInvokeTracker();
|
|
117
115
|
const boot = RunLog.boundaryBoot(journal);
|
|
118
|
-
const mailbox =
|
|
116
|
+
const mailbox = createEventMailbox();
|
|
119
117
|
const { ports, context } = await run.start({
|
|
120
118
|
operations: createOperationPort(journal),
|
|
121
119
|
invokes,
|
|
@@ -151,6 +149,7 @@ async function* drive({ journal, run, machine, invokes, now, durable, onDetached
|
|
|
151
149
|
const pausedMs = run.resume && journal.snapshotSavedAt !== undefined
|
|
152
150
|
? Math.max(0, now() - journal.snapshotSavedAt)
|
|
153
151
|
: 0;
|
|
152
|
+
const { queue } = mailbox;
|
|
154
153
|
let detached = false;
|
|
155
154
|
const detach = () => {
|
|
156
155
|
detached = true;
|
|
@@ -165,17 +164,14 @@ async function* drive({ journal, run, machine, invokes, now, durable, onDetached
|
|
|
165
164
|
wakeVersion++;
|
|
166
165
|
wake();
|
|
167
166
|
};
|
|
168
|
-
let pause = () => { };
|
|
169
|
-
let inputLimitNotified = false;
|
|
170
167
|
mailbox.notify = notify;
|
|
171
|
-
mailbox.onOverflow = () => queueMicrotask(pause);
|
|
172
168
|
const { actor, persistence } = await RunLog.createPersistedActor(journal, machine, notify, now);
|
|
173
169
|
actor.on('*', (event) => {
|
|
174
|
-
|
|
170
|
+
queue.push(event);
|
|
175
171
|
notify();
|
|
176
172
|
});
|
|
177
173
|
actor.subscribe({ next: notify, error: notify });
|
|
178
|
-
pause = () => {
|
|
174
|
+
const pause = () => {
|
|
179
175
|
if (actor.getSnapshot().status === 'active') {
|
|
180
176
|
actor.send({ type: 'PAUSE' });
|
|
181
177
|
}
|
|
@@ -193,30 +189,11 @@ async function* drive({ journal, run, machine, invokes, now, durable, onDetached
|
|
|
193
189
|
return pumping;
|
|
194
190
|
}
|
|
195
191
|
if ('reason' in item) {
|
|
196
|
-
|
|
192
|
+
queue.push({ type: 'input-rejected', runId, reason: item.reason });
|
|
197
193
|
notify();
|
|
198
194
|
}
|
|
199
195
|
else {
|
|
200
|
-
|
|
201
|
-
...actor.getSnapshot().context.steering,
|
|
202
|
-
...actor.getSnapshot().context.followUps
|
|
203
|
-
];
|
|
204
|
-
const bytes = pending.reduce((total, queued) => total + inputBytes(queued), 0);
|
|
205
|
-
if (!acceptsInput(pending.length, bytes, item)) {
|
|
206
|
-
if (!inputLimitNotified) {
|
|
207
|
-
inputLimitNotified = true;
|
|
208
|
-
mailbox.push({
|
|
209
|
-
type: 'input-rejected',
|
|
210
|
-
runId,
|
|
211
|
-
reason: 'Pending input limit exceeded; one or more inputs were rejected'
|
|
212
|
-
});
|
|
213
|
-
notify();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
inputLimitNotified = false;
|
|
218
|
-
actor.send(inputMessage(item));
|
|
219
|
-
}
|
|
196
|
+
actor.send(inputMessage(item));
|
|
220
197
|
}
|
|
221
198
|
return pumping;
|
|
222
199
|
}).catch(noop);
|
|
@@ -248,11 +225,7 @@ async function* drive({ journal, run, machine, invokes, now, durable, onDetached
|
|
|
248
225
|
if (journal.hasPendingFlush()) {
|
|
249
226
|
await persistence.flush();
|
|
250
227
|
}
|
|
251
|
-
yield* drainQueue(
|
|
252
|
-
if (mailbox.failure) {
|
|
253
|
-
const snapshot = actor.getSnapshot();
|
|
254
|
-
return { status: 'error', snapshot, error: mailbox.failure };
|
|
255
|
-
}
|
|
228
|
+
yield* drainQueue(queue);
|
|
256
229
|
if (isActiveIdle(actor.getSnapshot()) && !signal?.aborted) {
|
|
257
230
|
actor.send({ type: 'START' });
|
|
258
231
|
}
|
|
@@ -268,7 +241,7 @@ async function* drive({ journal, run, machine, invokes, now, durable, onDetached
|
|
|
268
241
|
? await drainSettling({ actor, persistence, durable, detach })
|
|
269
242
|
: undefined;
|
|
270
243
|
if (settlingResult) {
|
|
271
|
-
yield* drainQueue(
|
|
244
|
+
yield* drainQueue(queue);
|
|
272
245
|
return settlingResult;
|
|
273
246
|
}
|
|
274
247
|
if (isSettling) {
|
|
@@ -282,12 +255,12 @@ async function* drive({ journal, run, machine, invokes, now, durable, onDetached
|
|
|
282
255
|
durable,
|
|
283
256
|
detach,
|
|
284
257
|
journal,
|
|
285
|
-
queue
|
|
258
|
+
queue,
|
|
286
259
|
runId
|
|
287
260
|
});
|
|
288
261
|
}
|
|
289
262
|
const observedWakeVersion = wakeVersion;
|
|
290
|
-
if (
|
|
263
|
+
if (queue.length) {
|
|
291
264
|
continue;
|
|
292
265
|
}
|
|
293
266
|
await new Promise((resolve) => {
|
|
@@ -298,7 +271,7 @@ async function* drive({ journal, run, machine, invokes, now, durable, onDetached
|
|
|
298
271
|
});
|
|
299
272
|
}
|
|
300
273
|
await persistence.flush();
|
|
301
|
-
yield* drainQueue(
|
|
274
|
+
yield* drainQueue(queue);
|
|
302
275
|
return { status: 'done', snapshot: actor.getSnapshot() };
|
|
303
276
|
}
|
|
304
277
|
finally {
|
|
@@ -419,13 +392,24 @@ function settling(snapshot) {
|
|
|
419
392
|
return value === 'pausing';
|
|
420
393
|
}
|
|
421
394
|
function* drainQueue(queue) {
|
|
422
|
-
while (queue.
|
|
395
|
+
while (queue.length) {
|
|
423
396
|
const event = queue.shift();
|
|
424
397
|
if (event) {
|
|
425
398
|
yield event;
|
|
426
399
|
}
|
|
427
400
|
}
|
|
428
401
|
}
|
|
402
|
+
function createEventMailbox() {
|
|
403
|
+
const mailbox = {
|
|
404
|
+
queue: [],
|
|
405
|
+
notify() { },
|
|
406
|
+
emit(event) {
|
|
407
|
+
mailbox.queue.push(event);
|
|
408
|
+
mailbox.notify();
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
return mailbox;
|
|
412
|
+
}
|
|
429
413
|
function createOperationPort(journal) {
|
|
430
414
|
return Object.freeze({
|
|
431
415
|
flush: () => journal.flush(),
|
|
@@ -25,7 +25,8 @@ const RUN_WALL_CLOCK_BUDGET_MS = 30 * 60_000;
|
|
|
25
25
|
export function createRunBudget(startedAt, ms) {
|
|
26
26
|
const override = Number(process.env.QVAC_RUN_BUDGET_MS);
|
|
27
27
|
const fallback = Number.isFinite(override) && override > 0 ? override : RUN_WALL_CLOCK_BUDGET_MS;
|
|
28
|
-
|
|
28
|
+
const totalMs = ms ?? fallback;
|
|
29
|
+
return { deadlineMs: startedAt + totalMs, totalMs, outputBytesUsed: 0 };
|
|
29
30
|
}
|
|
30
31
|
export function runToolContext(args, runBudget) {
|
|
31
32
|
const { agent, attach, fetchAttachment, progress, askUser, signal } = args;
|
|
@@ -145,6 +145,7 @@ export function bindOperations(deps, context, stage) {
|
|
|
145
145
|
: current.backends,
|
|
146
146
|
runBudget: {
|
|
147
147
|
deadlineMs: current.runBudget.deadlineMs,
|
|
148
|
+
totalMs: current.runBudget.totalMs,
|
|
148
149
|
outputBytesUsed: Math.max(current.runBudget.outputBytesUsed, recorded.runBudget.outputBytesUsed)
|
|
149
150
|
},
|
|
150
151
|
outcome: {
|
|
@@ -18,8 +18,9 @@ import { detachJson } from '../../helpers/detach-json.js';
|
|
|
18
18
|
import { isSkillMentionNudge, materializeCompletionHistory } from '../tool-turns.js';
|
|
19
19
|
import { completionParams } from '../../helpers/completion-params.js';
|
|
20
20
|
import { requestPromptPrefix } from '../prompt-prefix.js';
|
|
21
|
+
import { renderedTools } from '../sdk-tool.js';
|
|
21
22
|
import { isFailureResultReference } from '../../helpers/failure-result.js';
|
|
22
|
-
import { GOAL_CHECKS_ASK, GOAL_PROOF_ASK } from '../../helpers/goal-check.js';
|
|
23
|
+
import { GOAL_CHECKS_ASK, GOAL_PROOF_ASK, GOAL_REVIEW_ASK } from '../../helpers/goal-check.js';
|
|
23
24
|
import { Fold } from '../../fold/index.js';
|
|
24
25
|
import { CompletionMachine } from '../../machine/index.js';
|
|
25
26
|
import { modelTurns } from './turns.js';
|
|
@@ -225,11 +226,18 @@ export function foldTokens(stats, cacheable) {
|
|
|
225
226
|
function slotStats(stats, previous) {
|
|
226
227
|
if (!stats)
|
|
227
228
|
return undefined;
|
|
228
|
-
const { cacheTokens: _summed, ...
|
|
229
|
-
|
|
229
|
+
const { cacheTokens: _summed, promptTokensPerSecond: _scheduler, ...own } = stats;
|
|
230
|
+
const { promptTokens, timeToFirstToken } = stats;
|
|
231
|
+
const rest = promptTokens !== undefined &&
|
|
232
|
+
promptTokens > 0 &&
|
|
233
|
+
timeToFirstToken !== undefined &&
|
|
234
|
+
timeToFirstToken > 0
|
|
235
|
+
? { ...own, promptTokensPerSecond: (promptTokens / timeToFirstToken) * 1000 }
|
|
236
|
+
: own;
|
|
237
|
+
if (previous === undefined || promptTokens === undefined) {
|
|
230
238
|
return rest;
|
|
231
239
|
}
|
|
232
|
-
return { ...rest, cacheTokens: previous +
|
|
240
|
+
return { ...rest, cacheTokens: previous + promptTokens + (stats.generatedTokens ?? 0) };
|
|
233
241
|
}
|
|
234
242
|
function boundaryStats(final, predict) {
|
|
235
243
|
const stats = copy(final.stats);
|
|
@@ -391,7 +399,7 @@ function harnessTurns(args, history) {
|
|
|
391
399
|
}
|
|
392
400
|
function goalTurns(args) {
|
|
393
401
|
const goal = args.goalNudge === undefined ? [] : [args.goalNudge];
|
|
394
|
-
return [...goal, GOAL_CHECKS_ASK, GOAL_PROOF_ASK];
|
|
402
|
+
return [...goal, GOAL_CHECKS_ASK, GOAL_PROOF_ASK, GOAL_REVIEW_ASK];
|
|
395
403
|
}
|
|
396
404
|
async function foldRounds(send, history) {
|
|
397
405
|
const { sdk, args, ctxSize } = send;
|
|
@@ -752,7 +760,7 @@ export function inferenceCall({ args, droppedTurns, modelId, params, cacheKey })
|
|
|
752
760
|
droppedTurns,
|
|
753
761
|
modelId,
|
|
754
762
|
messages: params.history,
|
|
755
|
-
tools: params.tools,
|
|
763
|
+
tools: renderedTools(params.tools, params.history),
|
|
756
764
|
generationParams: params.generationParams,
|
|
757
765
|
responseFormat: params.responseFormat,
|
|
758
766
|
toolDialect: params.toolDialect,
|
|
@@ -7,6 +7,7 @@ import type { DriveRoot } from '../tools/fs/scope.ts';
|
|
|
7
7
|
import type { CliValidator } from '../tools/skills/cli-schema-types.ts';
|
|
8
8
|
import type { UsageBreakdown } from '../capabilities/usage-breakdown.ts';
|
|
9
9
|
import type { KnowledgeGrant, KnowledgeSource } from './knowledge.ts';
|
|
10
|
+
import type { OcrService } from './ocr.ts';
|
|
10
11
|
import type { AccessPolicy, CompiledPolicy } from './policy.ts';
|
|
11
12
|
import type { GoalStatus, HistoryToolCall, HookRejection, Message, ResourceDescriptor, RoundSpeed, RunBackendUse, RunBudget, RunLifecycleEvent, RunOutcome, ToolActivityEvent, ToolCallDisplay, ToolDecision, ToolEffect, ToolSpeed, TrustedSource, TrustedSourceFacts, TurnContext } from './run.ts';
|
|
12
13
|
export type { CliValidator, DriveRoot, LlmGenerationParams };
|
|
@@ -134,6 +135,7 @@ export interface ToolSpill {
|
|
|
134
135
|
sink(stream: string): SpillSink;
|
|
135
136
|
}
|
|
136
137
|
export interface ToolExecuteContext {
|
|
138
|
+
currentTime?: number | undefined;
|
|
137
139
|
agentId?: string | null | undefined;
|
|
138
140
|
skills?: readonly string[] | undefined;
|
|
139
141
|
skillsLoadedThisTurn?: readonly string[] | undefined;
|
|
@@ -162,6 +164,7 @@ export interface ToolExecuteContext {
|
|
|
162
164
|
approval?: ToolDecision | undefined;
|
|
163
165
|
fetch?: ToolFetch | undefined;
|
|
164
166
|
knowledge?: KnowledgeGrant | undefined;
|
|
167
|
+
ocr?: OcrService | undefined;
|
|
165
168
|
spill?: ToolSpill | undefined;
|
|
166
169
|
planMode?: boolean | undefined;
|
|
167
170
|
callTool?: CallTool | undefined;
|
|
@@ -183,6 +186,7 @@ export interface ToolParameterSchema {
|
|
|
183
186
|
enum?: string[];
|
|
184
187
|
items?: ToolParameterSchema;
|
|
185
188
|
properties?: Record<string, ToolParameterSchema>;
|
|
189
|
+
additionalProperties?: boolean;
|
|
186
190
|
required?: string[];
|
|
187
191
|
default?: unknown;
|
|
188
192
|
}
|
|
@@ -330,6 +334,8 @@ export type GoalEvent = {
|
|
|
330
334
|
round: number;
|
|
331
335
|
text?: string;
|
|
332
336
|
checks?: string[];
|
|
337
|
+
proof?: string;
|
|
338
|
+
cases?: true;
|
|
333
339
|
};
|
|
334
340
|
export type FoldEvent = {
|
|
335
341
|
type: 'fold';
|
|
@@ -24,7 +24,7 @@ export interface BorrowedModel {
|
|
|
24
24
|
release(): void;
|
|
25
25
|
}
|
|
26
26
|
export interface ResidentPoolSpec {
|
|
27
|
-
addon: 'tts' | 'parakeet';
|
|
27
|
+
addon: 'tts' | 'parakeet' | 'ocr';
|
|
28
28
|
modelType: PendingLoad['modelType'];
|
|
29
29
|
modelConfig?: Record<string, unknown>;
|
|
30
30
|
modelConfigFor?: (modelSrc: ModelSrc) => Readonly<Record<string, unknown>> | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
2
|
+
export interface OcrImage {
|
|
3
|
+
readonly width: number;
|
|
4
|
+
readonly height: number;
|
|
5
|
+
readonly data: Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
export interface OcrService {
|
|
8
|
+
read(image: OcrImage, signal?: BareAbortSignal): Promise<string>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export interface RunBudget {
|
|
2
2
|
readonly deadlineMs: number;
|
|
3
|
+
readonly totalMs?: number | undefined;
|
|
3
4
|
outputBytesUsed: number;
|
|
4
5
|
responseRoomChars?: number | undefined;
|
|
5
6
|
}
|
|
@@ -143,6 +144,7 @@ export interface RoundSpeed {
|
|
|
143
144
|
promptTokensPerSecond?: number;
|
|
144
145
|
tokensPerSecond?: number;
|
|
145
146
|
timeToFirstToken?: number;
|
|
147
|
+
avgConcurrentSeq?: number;
|
|
146
148
|
stopReason?: string;
|
|
147
149
|
overflows?: number;
|
|
148
150
|
contextBoundary?: true;
|