stitchkit 0.135.0 → 0.135.1
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 +8 -0
- package/dist/agent-runtime/providers/openrouter-audio.d.ts +122 -0
- package/dist/agent-runtime/providers/openrouter-audio.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-catalog-cache.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-catalog.d.ts +2 -0
- package/dist/agent-runtime/providers/openrouter-catalog.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-http.d.ts +100 -0
- package/dist/agent-runtime/providers/openrouter-http.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-media.d.ts +160 -0
- package/dist/agent-runtime/providers/openrouter-media.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-models.d.ts +1 -1
- package/dist/agent-runtime/providers/openrouter-models.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-options.d.ts +2 -0
- package/dist/agent-runtime/providers/openrouter-options.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-response.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-retrieval.d.ts +114 -0
- package/dist/agent-runtime/providers/openrouter-retrieval.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-spend.d.ts +5 -1
- package/dist/agent-runtime/providers/openrouter-spend.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-stream.d.ts +29 -0
- package/dist/agent-runtime/providers/openrouter-stream.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-systemone.d.ts +82 -0
- package/dist/agent-runtime/providers/openrouter-systemone.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-url.d.ts +13 -0
- package/dist/agent-runtime/providers/openrouter-url.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter.d.ts +4 -1
- package/dist/agent-runtime/providers/openrouter.d.ts.map +1 -1
- package/dist/agent-runtime/providers/provider-http.d.ts +15 -1
- package/dist/agent-runtime/providers/provider-http.d.ts.map +1 -1
- package/dist/agent-runtime/stores/branch-observations.d.ts +42 -42
- package/dist/agent-runtime/testing/store-conformance-lifecycle.d.ts +20 -20
- package/dist/agent-runtime/testing/store-conformance-support.d.ts +10 -10
- package/dist/entrypoints/agent-runtime/anthropic.js +1 -1
- package/dist/entrypoints/agent-runtime/openai.js +1 -1
- package/dist/entrypoints/agent-runtime/openrouter.d.ts +7 -0
- package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/openrouter.js +1444 -241
- package/dist/{index-zfrysr1e.js → index-ht71v1ag.js} +52 -32
- package/llms/agent-runtime-openrouter.txt +11 -3
- package/llms/agent-runtime.2.txt +333 -224
- package/llms/agent-runtime.3.txt +225 -380
- package/llms/agent-runtime.4.txt +381 -158
- package/llms/agent-runtime.5.txt +157 -152
- package/llms/agent-runtime.6.txt +164 -0
- package/llms/agent-runtime.txt +30 -332
- package/llms/spend.txt +17 -1
- package/llms-full.txt +54 -4
- package/llms.txt +3 -3
- package/package.json +1 -1
package/llms/agent-runtime.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# stitchkit/agent-runtime — stitchkit docs slice, part 1 of
|
|
1
|
+
# stitchkit/agent-runtime — stitchkit docs slice, part 1 of 6
|
|
2
2
|
|
|
3
3
|
> Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
|
|
4
4
|
> `llms.txt` in this package.
|
|
@@ -8,8 +8,9 @@ Parts of this slice:
|
|
|
8
8
|
- `llms/agent-runtime.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
9
9
|
- `llms/agent-runtime.2.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
10
10
|
- `llms/agent-runtime.3.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
11
|
-
- `llms/agent-runtime.4.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
12
|
-
- `llms/agent-runtime.5.txt`: API reference: `stitchkit/agent-runtime` (docs/api/reference.md)
|
|
11
|
+
- `llms/agent-runtime.4.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
12
|
+
- `llms/agent-runtime.5.txt`: API reference: `stitchkit/agent-runtime` (docs/api/reference.md)
|
|
13
|
+
- `llms/agent-runtime.6.txt`: API reference: `stitchkit/agent-runtime` (docs/api/reference.md) · API reference: `stitchkit-tui` (docs/api/reference.md)
|
|
13
14
|
|
|
14
15
|
==============================================================================
|
|
15
16
|
# Guide: Agent application runtime (docs/guide/agent-runtime.md)
|
|
@@ -233,6 +234,32 @@ const base = openAiProvider({ apiKey: env.OPENAI_API_KEY }).create('gpt-5')
|
|
|
233
234
|
const guarded = composeModelDrivers(base, [admissionDecorator, telemetryDecorator])
|
|
234
235
|
```
|
|
235
236
|
|
|
237
|
+
### OpenRouter non-chat endpoints and shared transport
|
|
238
|
+
|
|
239
|
+
`stitchkit/agent-runtime/openrouter` also exports the canonical `OPENROUTER_API_BASE_URL`
|
|
240
|
+
(`https://openrouter.ai/api/v1`), `OpenRouterFetch`, generic non-chat transport helpers
|
|
241
|
+
(`openRouterRequestJson` and `openRouterRequestStream`), and typed modality clients — all
|
|
242
|
+
peer-free, Web Fetch-clean, redirect-safe (`redirect: 'error'` plus response-level refusal), and
|
|
243
|
+
compatible with `gateway.fetchFor('openrouter')` and custom `baseUrl` overrides:
|
|
244
|
+
|
|
245
|
+
- **Decision models (`POST /systemone`):** `openRouterSystemOne` sends `noul`, `choice`, and
|
|
246
|
+
`score` questions over text or structured `state` and returns calibrated probability answers plus
|
|
247
|
+
`generationId` and `costUsd`.
|
|
248
|
+
- **Audio (`POST /audio/transcriptions` and `POST /audio/speech`):** `openRouterAudioTranscription`
|
|
249
|
+
accepts `audio: { kind: 'base64' | 'url' | 'file' }` (JSON or automatic `FormData` multipart
|
|
250
|
+
without manual `Content-Type`), `verbose_json`, `timestampGranularities`, and `diarize`;
|
|
251
|
+
`openRouterAudioSpeech` streams synthesized audio bytes (`ReadableStream<Uint8Array>`).
|
|
252
|
+
- **Images & Video (`POST /images` and `/videos`):** `openRouterGenerateImages` targets OpenRouter's
|
|
253
|
+
Unified Image API (`b64_json` or signed `url`), while `openRouterSubmitVideo`,
|
|
254
|
+
`openRouterGetVideo`, and `openRouterDownloadVideo` cover the async submit → poll → stream
|
|
255
|
+
download lifecycle.
|
|
256
|
+
- **Embeddings & Rerank (`POST /embeddings`, `POST /rerank`):** `openRouterEmbeddings` and
|
|
257
|
+
`openRouterRerank` provide typed RAG vector and rescoring calls.
|
|
258
|
+
- **Any other OpenRouter API v1 endpoint:** `openRouterRequestJson` (with optional Zod `schema`) and
|
|
259
|
+
`openRouterRequestStream` (with open-phase `timeoutMs` disarmed once 2xx headers arrive) handle
|
|
260
|
+
management or future endpoints (`/credits`, `/key`, `/responses`, `/images/models`, `/videos/models`)
|
|
261
|
+
without custom wrappers.
|
|
262
|
+
|
|
236
263
|
### OpenRouter catalog snapshots, pricing ceilings, and cache
|
|
237
264
|
|
|
238
265
|
`stitchkit/agent-runtime/openrouter` also provides a peer-free, Web Fetch-clean catalog layer for
|
|
@@ -459,332 +486,3 @@ comparison, but provider serialization and tokenization differ: use existing
|
|
|
459
486
|
provider-reported input usage and cost to decide whether the extra search round
|
|
460
487
|
is beneficial. Controller evidence intentionally omits query text, prompts,
|
|
461
488
|
arguments and application context. → ADR 0129.
|
|
462
|
-
|
|
463
|
-
### Published headless harness and structured runner
|
|
464
|
-
|
|
465
|
-
`stitchkit/agent-runtime/harness` publishes the resource-aware composition over
|
|
466
|
-
`createAgentRuntime`. `createHeadlessAgentHarness` accepts the existing protocol and store,
|
|
467
|
-
caller-provided model resolution, bounded instruction/skill/resource loading, direct tools and a
|
|
468
|
-
prompt-budget callback. Resource names are unique; count, UTF-8 bytes and diagnostics are bounded.
|
|
469
|
-
Invalid resources fail before a provider request. Diagnostics are evidence for the caller: their
|
|
470
|
-
observer is isolated, and the loader decides whether a reported condition is fatal.
|
|
471
|
-
|
|
472
|
-
`createAgentHarnessFileResources` is the optional filesystem implementation. It reads only
|
|
473
|
-
caller-declared absolute roots, refuses symlinks and reports provenance as
|
|
474
|
-
`rootId:relative/path`. Instructions enter the prompt immediately. Skills and ordinary resources
|
|
475
|
-
enter as bounded name/description summaries; `read_resource` loads one exact body later as
|
|
476
|
-
a normal direct typed tool. Custom loaders remain supported unchanged.
|
|
477
|
-
|
|
478
|
-
Each run may resolve a different provider adapter without changing the harness. The
|
|
479
|
-
`profile-applied` observation records the actual `AgentModelDescriptor`, resource kind/name/
|
|
480
|
-
provenance and sorted direct tool names; it intentionally contains no resource text, prompts,
|
|
481
|
-
arguments or credentials. Observer failure never changes the canonical run outcome.
|
|
482
|
-
|
|
483
|
-
[`packages/core/examples/agent-runtime/headless-agent-runner.ts`](../../packages/core/examples/agent-runtime/headless-agent-runner.ts)
|
|
484
|
-
is a reference structured control loop for `submit`, `interrupt`, `snapshot` and bounded `close`.
|
|
485
|
-
It starts no process and chooses no framing, authentication or transport. Importing either example
|
|
486
|
-
has no side effect; an external supervisor owns process placement and restart.
|
|
487
|
-
|
|
488
|
-
| Concern | Public StitchKit composition | Boundary |
|
|
489
|
-
| --- | --- | --- |
|
|
490
|
-
| execution loop | `createAgentRuntime` | already available; do not copy a second loop |
|
|
491
|
-
| model choice | `defineModelRegistry` and `models.resolve` | provider credentials/discovery stay application-owned |
|
|
492
|
-
| resources | `createHeadlessAgentHarness` → `composeAgentPrompt` | paths, trust, precedence and watching stay application-owned |
|
|
493
|
-
| tools | `mountAgentTools` + `createAgentToolFenceLifecycle` | auth and domain effects stay application-owned |
|
|
494
|
-
| follow-up | `runs.inputPolicy: 'queue'` | durable FIFO after the current run |
|
|
495
|
-
| interrupt | `interrupt` or `interrupt-next` | `interrupt-next` terminates the active run and gives the new durable admission next priority |
|
|
496
|
-
| recovery | `runtime.recover` + `scanRecoverable` | replay safety and context reconstruction are explicit callbacks |
|
|
497
|
-
| reconnect | canonical snapshot + `advanceAgentMultiSessionCursor` | conversation/run-scoped gaps require resync |
|
|
498
|
-
| persistence | memory reference, public driver, or SQLite leaf | product rows/outbox remain outside the runtime store |
|
|
499
|
-
| executable lifecycle | structured runner example | framing, auth, process placement, restart and OS isolation stay host-owned |
|
|
500
|
-
|
|
501
|
-
`createAgentHarnessControlServer` adds transport-neutral correlated requests, shared observers and
|
|
502
|
-
one exclusive controller lease per conversation. `close()` on a connection detaches only that
|
|
503
|
-
client; it never closes the harness. A request the harness rejects answers `REQUEST_REJECTED`; its
|
|
504
|
-
cause goes to the config's `onError` (else `console.error`), never to the client. Normal `event` delivery stays serialized. A bounded slow
|
|
505
|
-
consumer is detached and receives `resync-required` through the required synchronous
|
|
506
|
-
`onOverflow` callback; that callback closes/aborts the underlying transport, which then reconnects
|
|
507
|
-
and requests a fresh snapshot. It never writes a second frame concurrently with a blocked
|
|
508
|
-
`deliver`. Browser code uses `createAgentControlView`,
|
|
509
|
-
`reduceAgentControlSnapshot` and `reduceAgentControlEvent`; the reducer owns no renderer and marks a
|
|
510
|
-
conversation `resyncRequired` after a transient sequence gap.
|
|
511
|
-
|
|
512
|
-
Configure `loop.toolApproval` for the runtime's native approval policy and
|
|
513
|
-
`loop.toolApprovalSecret` to bind exact requests with WebCrypto HMAC-SHA256 signatures. A request
|
|
514
|
-
is stored on the terminal assistant before any effect. `pendingApprovals()` derives unresolved
|
|
515
|
-
requests from canonical messages; `respondToApproval()` writes one tool-role approval response and
|
|
516
|
-
queues a successor. The native loop revalidates the signature/tool call/input once before any
|
|
517
|
-
retry attempts and before the original direct tool reaches its existing fence. Reconnect and SQLite
|
|
518
|
-
reopen require no promise registry. Remembered policy and a stronger cross-crash exactly-once
|
|
519
|
-
guarantee remain application concerns.
|
|
520
|
-
|
|
521
|
-
Approval requests suspend a call; they do not settle its result. History carries exact call and
|
|
522
|
-
approval identity across assistant/tool records, so an approved result can precede the next signed
|
|
523
|
-
request in a successor run. Automatic decisions follow the same chronology. Unknown/duplicate
|
|
524
|
-
responses and results with a different call or tool name are invalid; dropping an invalid active
|
|
525
|
-
approval input fails the run with a private diagnostic rather than starting a fresh model turn.
|
|
526
|
-
|
|
527
|
-
`stitchkit/agent-runtime/coding-tools` returns ordinary direct runtime tools named `read_file`,
|
|
528
|
-
`write_file`, `edit_file`, `list_directory`, `glob`, `search_files`, `run_command` and optional
|
|
529
|
-
`read_output`. Every call passes a required host authorization callback. An optional async/sync
|
|
530
|
-
`authorizePath({ path })` is the one operation-independent policy for direct file access and
|
|
531
|
-
discovery: direct read/write/edit refuses a denied path, while listing, glob and search omit it.
|
|
532
|
-
Denial is recursive on every surface — direct access asks about each named ancestor and the file,
|
|
533
|
-
outermost first, stopping at the first refusal; discovery rooted at `.` also asks about `.`.
|
|
534
|
-
Thus denying `credentials` denies everything
|
|
535
|
-
under it. The comparison is segment-wise, so it does not deny `credentials-backup`, and a path of
|
|
536
|
-
depth N costs N questions for direct access. Directory decisions happen before descent; file decisions and
|
|
537
|
-
`search_files.include` happen before opening content. Incompatible glob directory prefixes are
|
|
538
|
-
pruned before policy or directory opens. Requested paths use `/`: a backslash is
|
|
539
|
-
refused rather than normalised, because the workspace walk reads it as a separator and every
|
|
540
|
-
authorization callback would otherwise be asked about a different decomposition than the one opened. File paths are relative, bounded and contained after
|
|
541
|
-
descriptor-relative resolution: each ancestor is opened without following symlinks. Reads and edits
|
|
542
|
-
stay pinned through authorization; `write_file` plans before it and opens the parent after, because
|
|
543
|
-
the parent it creates does not exist yet. Reads revalidate the pinned file identity;
|
|
544
|
-
writes and patches revalidate the pinned parent identity; search and resource discovery descend
|
|
545
|
-
only through opened directories. Every filesystem tool selects its root capability before operation or path authorization and retains
|
|
546
|
-
that identity if a callback replaces the root path or configured alias. On Linux the ordinary
|
|
547
|
-
command launcher spawns the command with the pinned directory's `/proc` descriptor link as its cwd;
|
|
548
|
-
on macOS it inherits the pinned cwd through an isolated guard — one short-lived guard process per
|
|
549
|
-
command, tens of milliseconds, outside `shellTimeoutMs`, which counts from the command's start. The
|
|
550
|
-
application process never changes cwd. Where
|
|
551
|
-
contained descriptors are unavailable (Windows), `run_command` accepts a cwd whose realpath is
|
|
552
|
-
that same name under the root — a symlink segment refuses there too — and checks the directory's
|
|
553
|
-
identity again immediately before launch, after every host decision.
|
|
554
|
-
A custom sandbox launcher owns atomic cwd capture at its pathname handoff; the SDK refuses a
|
|
555
|
-
changed identity after policy/prepare and immediately before that handoff. A path that changed
|
|
556
|
-
during direct-access authorization refuses with `CONFLICT`.
|
|
557
|
-
A path spelled differently from the name stored on disk refuses before any policy reads it, so on a
|
|
558
|
-
case-insensitive volume a rule on `credentials` cannot be passed by asking for `CREDENTIALS`.
|
|
559
|
-
NUL bytes are refused before either host policy sees a path.
|
|
560
|
-
Reads and edits open file candidates without blocking on special files, then require a regular
|
|
561
|
-
file. A writerless FIFO therefore refuses instead of occupying a filesystem worker. `write_file`
|
|
562
|
-
supplies the exact missing-directory plan as `createsDirectories` to host authorization; the
|
|
563
|
-
descriptor walk may create only those entries. An ancestor that disappears after approval refuses
|
|
564
|
-
with `CONFLICT`, without expanding that plan. Linux traverses `/proc/self/fd`; macOS uses the package's
|
|
565
|
-
architecture-specific Node-API `openat` backend. Unsupported platforms, including FreeBSD until a
|
|
566
|
-
real backend is qualified, fail closed. The package needs no install-time compiler or script.
|
|
567
|
-
Other platforms fail these filesystem operations closed because Node exposes no equivalent
|
|
568
|
-
portable directory-handle-relative API. Writes/edits reject symlink targets, content is strict
|
|
569
|
-
UTF-8 and retained bytes are finite. Shell accepts a finite alias mapped by the host to an absolute executable plus an
|
|
570
|
-
argument array — never a shell command string — and uses only the explicitly supplied environment.
|
|
571
|
-
Arguments, output and time are bounded, while cancellation terminates the child. The configured
|
|
572
|
-
root and cwd are path boundaries, not a security sandbox: isolate the process when an executable
|
|
573
|
-
must not access the rest of the machine. Path admission does not constrain `run_command`; an
|
|
574
|
-
executable requires process isolation for that guarantee. → ADR 0172
|
|
575
|
-
|
|
576
|
-
An absolute path is still refused. When it is inside the canonical workspace root, the refusal
|
|
577
|
-
includes the exact workspace-relative `recoveryPath`; an absolute path outside the root has no
|
|
578
|
-
suggested replacement. Applying the suggestion still passes the same descriptor-relative
|
|
579
|
-
containment and symlink checks.
|
|
580
|
-
|
|
581
|
-
`edit_file` replaces one exact snippet. It inserts `newText` literally in both single and
|
|
582
|
-
`replaceAll` modes, including JavaScript replacement tokens such as `$$`, `$&`, `` $` `` and `$'`.
|
|
583
|
-
`oldText` is itself the freshness guard for the region it changes, so the digest is the optional `expectedSha256` and an edit is one call; pass the digest
|
|
584
|
-
`read_file` returned when you want the whole-file guarantee, and read the `sha256` it returns to
|
|
585
|
-
chain the next edit without re-reading. The read, the occurrence count and the construction of the
|
|
586
|
-
new content all happen inside one per-target lock, so two concurrent edits of different snippets in
|
|
587
|
-
one file cannot each build a file from the same base and have the second erase the first — the lock
|
|
588
|
-
is process-local, which covers many agents in one process and not two processes over one workspace.
|
|
589
|
-
It authorizes the exact replacement count, result digest and byte size, and deliberately does not
|
|
590
|
-
claim multi-file atomicity.
|
|
591
|
-
|
|
592
|
-
`write_file` creates missing parent directories inside the root and names them in
|
|
593
|
-
`createdDirectories`; the walk that finds them runs before authorization and reports them in the
|
|
594
|
-
authorization payload, so no directory is created before a host approves it.
|
|
595
|
-
|
|
596
|
-
**Every ordinary outcome is a refusal a model can act on** — a missing file is `NOT_FOUND`, an
|
|
597
|
-
existing file without `overwrite` is `CONFLICT`, an ambiguous snippet is `CONFLICT` carrying its
|
|
598
|
-
occurrence count, a path outside the root is `FORBIDDEN`, an unknown spilled-output reference is
|
|
599
|
-
`SPILL_REFERENCE_UNKNOWN` — each with a `hint` naming the next move.
|
|
600
|
-
Host-level causes stay scrubbed to `INTERNAL_SERVER_ERROR` and name nothing outside the workspace.
|
|
601
|
-
Every refusal code is a member of `STITCH_ERROR_STATUS`, so its status survives an envelope that
|
|
602
|
-
crosses a process boundary and is rebuilt from the wire.
|
|
603
|
-
→ ADR 0139
|
|
604
|
-
|
|
605
|
-
`list_directory` marks excluded directories rather than hiding them, and `glob` reports
|
|
606
|
-
`skippedDirectories` beside its matches: an empty result from a tree whose files all live under an
|
|
607
|
-
excluded directory is not "no files", and a model told only "nothing found" concludes the wrong
|
|
608
|
-
thing. `search_files` takes `regex`, `context` lines and an anchored `include` pattern matched
|
|
609
|
-
against the whole workspace-relative path. `*` does not cross `/`, so files in subdirectories need
|
|
610
|
-
`**/`; `scannedFiles` counts files admitted by both that filter and host authorization that reached
|
|
611
|
-
comparison. One finite glob automaton matches files and prunes incompatible directory prefixes;
|
|
612
|
-
`glob` also confines its walk to the requested path. A `hint` can explain include filtering or
|
|
613
|
-
pruning, without counting files below unopened directories.
|
|
614
|
-
|
|
615
|
-
Search processes one file at a time. List, glob and search share directory, entry, serialized-output,
|
|
616
|
-
timeout and cancellation budgets, including canonical spelling checks before path authorization.
|
|
617
|
-
`list_directory` caps raw enumeration at the smaller of `maxListEntries` and `maxSearchEntries`;
|
|
618
|
-
its coverage scope lists symlinks while glob/search skip them. Glob patterns are limited to 4,096
|
|
619
|
-
UTF-16 units. A scoped glob measures depth from its requested base directory. In addition to `maxSearchFiles` (10,000), `maxSearchDepth`
|
|
620
|
-
(32), `maxSearchResults` (100) and `maxReadBytes` (262,144), hosts can configure
|
|
621
|
-
`maxSearchDirectories` (1,000 directory-open attempts, root included), `maxSearchEntries`
|
|
622
|
-
(20,000 entries observed by bounded readers), `maxSearchBytes` (16,777,216 aggregate content
|
|
623
|
-
bytes, including rejected UTF-8), `maxSearchOutputBytes` (65,536 bytes for the entire serialized
|
|
624
|
-
UTF-8 JSON, minimum 1,024) and `searchTimeoutMs` (5,000). An input whose minimum coverage
|
|
625
|
-
envelope cannot fit the output ceiling refuses before filesystem access. Directory readers cap
|
|
626
|
-
enumeration before materialization and sorting; reaching an entry or result ceiling is
|
|
627
|
-
conservatively partial, without reading a lookahead entry or match.
|
|
628
|
-
|
|
629
|
-
`list_directory`, `glob` and `search_files` return `coverage.complete` and `coverage.reasons`
|
|
630
|
-
to distinguish full empty results from partial work. Glob `resultTruncated` conservatively marks
|
|
631
|
-
the result ceiling even when no extra match was read.
|
|
632
|
-
Coverage names the include/exclusion/symlink scope, directory and entry counters, actual content
|
|
633
|
-
bytes and elapsed milliseconds. Limits, cancellation, denial, unreadable files and oversized
|
|
634
|
-
lines are explicit reasons. `errors` names only a workspace-relative path, operation and safe code;
|
|
635
|
-
`errorsTruncated` and `deniedTruncated` report shortened diagnostics. Excluded directories and
|
|
636
|
-
symlinks are outside the declared search scope. The caller's signal and deadline reach host
|
|
637
|
-
authorization, file reads and traversal; CPU checkpoints and asynchronous races stop further work.
|
|
638
|
-
Late opened handles are closed, while already-running kernel calls may finish later. Directory
|
|
639
|
-
enumeration and glob matching have internal checkpoints; cancellation stops their producer loops.
|
|
640
|
-
Host policy and visitor exceptions propagate to error hooks with their original cause, rather
|
|
641
|
-
than becoming filesystem diagnostics. Diagnostic byte admission is linear and checks the deadline
|
|
642
|
-
even for an empty result.
|
|
643
|
-
|
|
644
|
-
Regex searches use JavaScript `RegExp` syntax without flags — groups, alternation, classes,
|
|
645
|
-
anchors, `\b`, quantifiers and `(?ims-ims:…)` modifiers — with bounded cost per line. A line
|
|
646
|
-
whose backtracking work (paths × longest path × line length × (number of groups + 1), every
|
|
647
|
-
repetition capped at the line length beyond the iterations it requires) stays within 2^24 steps runs on the native engine, so ordinary `.*` searches over code
|
|
648
|
-
lines keep native speed and the deadline is observed between lines; any other line runs on a
|
|
649
|
-
cached linear automaton, so `(a+)+$` on a long line costs the same as `a+` and the deadline is
|
|
650
|
-
observed inside the line. Backreferences and
|
|
651
|
-
lookaround refuse before I/O; lines over 8,192 UTF-8 bytes are skipped with incomplete coverage.
|
|
652
|
-
Literal queries allow up to 8,192 UTF-16 units and include patterns up to 4,096.
|
|
653
|
-
|
|
654
|
-
With an optional `AgentCodingArtifactStore`, shell output beyond the inline
|
|
655
|
-
preview continues into an opaque bounded artifact and `read_output` reads slices without
|
|
656
|
-
exposing a host path. Without a store, the previous finite output-limit behavior is unchanged.
|
|
657
|
-
|
|
658
|
-
`run_command` treats every invocation as finite. `shellTimeoutMs` bounds normal execution and
|
|
659
|
-
`shellTerminationGraceMs` bounds settlement after timeout, caller cancellation, output overflow or
|
|
660
|
-
parent exit. POSIX hosts launch a dedicated process group and kill every descendant remaining in
|
|
661
|
-
that group; a process that deliberately escapes the group is outside the guarantee. Node's
|
|
662
|
-
portable Windows child-process API cannot kill a complete descendant tree without invoking a
|
|
663
|
-
second host executable, so Windows kills the direct child, destroys retained pipes at the grace
|
|
664
|
-
deadline and makes no descendant-cleanup claim. A signal already aborted before execution returns
|
|
665
|
-
`cancelled` without spawning.
|
|
666
|
-
|
|
667
|
-
Coding commands compose the shared native execution owner. Artifact retention and UTF-8
|
|
668
|
-
previews remain coding-tool policy; normal leader exit still forcibly stops remaining POSIX
|
|
669
|
-
group members before draining. A structural sandbox launcher uses the same settlement owner
|
|
670
|
-
with a finite output queue. Sandbox shutdown waits for actual owned completion and surfaces
|
|
671
|
-
cleanup refusal rather than treating it as successful teardown.
|
|
672
|
-
|
|
673
|
-
One `createAgentHarnessFileResources` instance represents one immutable discovery generation:
|
|
674
|
-
concurrent and repeated `load()` calls share it, so a direct resource read cannot cross into a
|
|
675
|
-
new catalog unexpectedly. Discovery uses the same descriptor-anchored traversal as coding search;
|
|
676
|
-
construct a new loader to refresh after filesystem changes.
|
|
677
|
-
|
|
678
|
-
Runtime events preserve reasoning/text/tool lifecycle order. Durable admission,
|
|
679
|
-
checkpoint, run-state and terminal events carry stable identities; transient
|
|
680
|
-
deltas carry one runtime epoch and monotonic sequence. On a transient gap,
|
|
681
|
-
reload the canonical snapshot and resume from the durable record instead of
|
|
682
|
-
persisting deltas as a second history.
|
|
683
|
-
|
|
684
|
-
Prompt `contextWindow` budgeting is a pre-request decision over the assembled
|
|
685
|
-
context. `AgentRun.usage` is cumulative measured/provider-reported execution
|
|
686
|
-
evidence across attempts and compaction. They answer different questions and
|
|
687
|
-
must not be substituted for each other. TTFT and throughput require timestamps
|
|
688
|
-
from the actual provider stream plus a provider-reported or tokenizer-measured
|
|
689
|
-
token count; character counts cannot produce exact token or throughput figures.
|
|
690
|
-
|
|
691
|
-
`recordIds` is optional. Supply stable application record IDs when an accepted-response transport must
|
|
692
|
-
return durable placeholders before the run finishes. `ticket.admission` resolves after the store
|
|
693
|
-
acceptance CAS and reports the canonical committed `input`, assigned `run`, a typed `pending`
|
|
694
|
-
assistant projection, compatibility IDs and snapshot version.
|
|
695
|
-
Those assigned IDs can differ from the proposal when an input coalesces into an existing queued
|
|
696
|
-
successor. Reuse the same `inputMessageId` for retries carrying the same idempotency key; input
|
|
697
|
-
identity is caller-stable, while the receipt reports the run/assistant identities that assignment
|
|
698
|
-
may change. Await `admission` first on the immediate accepted-response path. `ticket.accepted`
|
|
699
|
-
remains the signal-only compatibility surface and additionally waits for admission publication.
|
|
700
|
-
|
|
701
|
-
The in-memory store is a reference adapter and has process-local durability
|
|
702
|
-
only. Production applications normally call `createAgentRuntimeStore()` and
|
|
703
|
-
provide one database transaction driver. Its `transaction` owns the retry of a
|
|
704
|
-
serialization conflict, wherever the database reports it: on a statement or on
|
|
705
|
-
`COMMIT`, which some clients surface in a different shape. Pass
|
|
706
|
-
`commitConflict: { arm }` to `runAgentStoreConformance` to prove it (a single-writer
|
|
707
|
-
engine declares `{ impossible: 'single-writer' }` instead):
|
|
708
|
-
|
|
709
|
-
```ts
|
|
710
|
-
const store = createAgentRuntimeStore({
|
|
711
|
-
transaction: (work, options) =>
|
|
712
|
-
options?.access === 'read'
|
|
713
|
-
? db.readTransaction(tx => work(tx))
|
|
714
|
-
: db.writeTransaction(tx => work(tx)),
|
|
715
|
-
head: {
|
|
716
|
-
load: (tx, conversationId) => loadRuntimeHead(tx, conversationId),
|
|
717
|
-
compareAndSwap: (tx, operation) => casRuntimeHead(tx, operation),
|
|
718
|
-
},
|
|
719
|
-
runs: {
|
|
720
|
-
load: (tx, identity) => loadRun(tx, identity),
|
|
721
|
-
loadByAssistantMessageId: (tx, identity) => loadRunByAssistant(tx, identity),
|
|
722
|
-
loadMany: (tx, identities) => loadRuns(tx, identities),
|
|
723
|
-
listActive: (tx, conversationId) => listActiveRuns(tx, conversationId),
|
|
724
|
-
save: (tx, record) => saveRun(tx, record),
|
|
725
|
-
},
|
|
726
|
-
admissions: {
|
|
727
|
-
load: (tx, identity) => loadAdmission(tx, identity),
|
|
728
|
-
loadByInputMessageId: (tx, identity) => loadAdmissionByInput(tx, identity),
|
|
729
|
-
create: (tx, receipt) => createAdmission(tx, receipt),
|
|
730
|
-
},
|
|
731
|
-
seeds: {
|
|
732
|
-
load: (tx, identity) => loadSeedReceipt(tx, identity),
|
|
733
|
-
create: (tx, receipt) => createSeedReceipt(tx, receipt),
|
|
734
|
-
},
|
|
735
|
-
history: {
|
|
736
|
-
load: (tx, conversationId) => loadCanonicalMessages(tx, conversationId),
|
|
737
|
-
hasMessage: (tx, identity) => hasAnyMessage(tx, identity), // compacted rows too
|
|
738
|
-
apply: (tx, mutation) => applyCanonicalHistoryMutation(tx, mutation),
|
|
739
|
-
restore: (tx, baseline) => restoreBaseline(tx, baseline), // optional
|
|
740
|
-
},
|
|
741
|
-
events: {
|
|
742
|
-
append: (tx, event) => appendEvent(tx, event),
|
|
743
|
-
list: (tx, page) => listEvents(tx, page),
|
|
744
|
-
find: (tx, identity) => findEvent(tx, identity), // a unique index on the event id
|
|
745
|
-
},
|
|
746
|
-
archive: { export: exportCompanions, import: importCompanions }, // optional
|
|
747
|
-
scanRecoverable: page => scanRecoverableRuns(page),
|
|
748
|
-
})
|
|
749
|
-
|
|
750
|
-
await runAgentStoreConformance({
|
|
751
|
-
createStore: () => store,
|
|
752
|
-
capabilities: { branch: true, planBranch: true, archive: true, historyRestore: true },
|
|
753
|
-
commitConflict: { arm: () => db.failNextCommitWithSerializationError() },
|
|
754
|
-
})
|
|
755
|
-
```
|
|
756
|
-
|
|
757
|
-
`archive` and `history.restore` are the driver's optional members, and
|
|
758
|
-
`store.capabilities` (`{ archive, historyRestore, purge }`) says which this one
|
|
759
|
-
has. A store without `archive` refuses an archive carrying spills or companion
|
|
760
|
-
projections, and a branch source carrying spills; one without `history.restore`
|
|
761
|
-
refuses a compacted baseline. Each refusal is an
|
|
762
|
-
`AgentStoreUnsupportedCapabilityError` naming the `capability`, thrown before
|
|
763
|
-
anything is written — never a silent drop of spills or a compacted row brought
|
|
764
|
-
back as active history. The conformance kit compares the declared `capabilities`
|
|
765
|
-
with `store.capabilities` and proves each by behaviour.
|
|
766
|
-
|
|
767
|
-
Prompt budgeting keeps reservation deficits signed. If instructions,
|
|
768
|
-
`reservedOutput`, tool schemas, attachments and provider overhead already exceed
|
|
769
|
-
`contextWindow`, `composeAgentPrompt` returns `contextDecision: 'oversized'`
|
|
770
|
-
and a negative `availableHistoryTokens` even when history is empty. A `compact`
|
|
771
|
-
policy is returned only when removing history could actually make the prompt
|
|
772
|
-
fit. Exact equality (including a zero window with zero reservations/history)
|
|
773
|
-
fits; any unavailable component keeps the decision `unavailable`.
|
|
774
|
-
|
|
775
|
-
The same opaque `tx` reaches head, run, admission and history callbacks. The adapter maps rows
|
|
776
|
-
and supplies atomicity; StitchKit owns transition validation and revision
|
|
777
|
-
arithmetic. The executable reference is
|
|
778
|
-
[`examples/agent-store-prisma/adapter.ts`](../../examples/agent-store-prisma/adapter.ts).
|
|
779
|
-
`compareAndSwap` returns either `{ outcome: 'applied' }` or
|
|
780
|
-
`{ outcome: 'conflict', actualVersion }`. Decide that outcome by reading the
|
|
781
|
-
version, comparing it and then writing unconditionally — inside the transaction
|
|
782
|
-
the adapter supplies, that is atomic. A conditional upsert is the shorter thing
|
|
783
|
-
to write and it is wrong twice: `ON CONFLICT ... WHERE` guards the update branch
|
|
784
|
-
only, so the first write to a conversation applies whatever `expectedVersion` it
|
|
785
|
-
was given, and the affected-row count that would report the outcome is the
|
|
786
|
-
driver's, which need not be the rows the statement moved. The head contains only
|
|
787
|
-
schema version, conversation identity and monotonic version. Runs and admission receipts are normalized records;
|
|
788
|
-
recovery queries active run states directly instead of maintaining a second projection.
|
|
789
|
-
An admission receipt retains its canonical input, and a terminal run retains its canonical
|
|
790
|
-
assistant, so physical product-history compaction cannot break idempotent retries.
|
package/llms/spend.txt
CHANGED
|
@@ -138,7 +138,23 @@ test('every model call goes through the spend gateway', async () => {
|
|
|
138
138
|
root: 'src',
|
|
139
139
|
policy: {
|
|
140
140
|
modules: [
|
|
141
|
-
{
|
|
141
|
+
{
|
|
142
|
+
module: 'stitchkit/agent-runtime/openrouter',
|
|
143
|
+
symbols: [
|
|
144
|
+
'openRouterProvider',
|
|
145
|
+
'openRouterRequestJson',
|
|
146
|
+
'openRouterRequestStream',
|
|
147
|
+
'openRouterSystemOne',
|
|
148
|
+
'openRouterAudioTranscription',
|
|
149
|
+
'openRouterAudioSpeech',
|
|
150
|
+
'openRouterGenerateImages',
|
|
151
|
+
'openRouterSubmitVideo',
|
|
152
|
+
'openRouterGetVideo',
|
|
153
|
+
'openRouterDownloadVideo',
|
|
154
|
+
'openRouterEmbeddings',
|
|
155
|
+
'openRouterRerank',
|
|
156
|
+
],
|
|
157
|
+
},
|
|
142
158
|
{ module: 'stitchkit/agent-runtime/openai', symbols: ['openAiProvider'] },
|
|
143
159
|
{ module: 'stitchkit/agent-runtime/anthropic', symbols: ['anthropicProvider'] },
|
|
144
160
|
],
|
package/llms-full.txt
CHANGED
|
@@ -6595,6 +6595,32 @@ const base = openAiProvider({ apiKey: env.OPENAI_API_KEY }).create('gpt-5')
|
|
|
6595
6595
|
const guarded = composeModelDrivers(base, [admissionDecorator, telemetryDecorator])
|
|
6596
6596
|
```
|
|
6597
6597
|
|
|
6598
|
+
### OpenRouter non-chat endpoints and shared transport
|
|
6599
|
+
|
|
6600
|
+
`stitchkit/agent-runtime/openrouter` also exports the canonical `OPENROUTER_API_BASE_URL`
|
|
6601
|
+
(`https://openrouter.ai/api/v1`), `OpenRouterFetch`, generic non-chat transport helpers
|
|
6602
|
+
(`openRouterRequestJson` and `openRouterRequestStream`), and typed modality clients — all
|
|
6603
|
+
peer-free, Web Fetch-clean, redirect-safe (`redirect: 'error'` plus response-level refusal), and
|
|
6604
|
+
compatible with `gateway.fetchFor('openrouter')` and custom `baseUrl` overrides:
|
|
6605
|
+
|
|
6606
|
+
- **Decision models (`POST /systemone`):** `openRouterSystemOne` sends `noul`, `choice`, and
|
|
6607
|
+
`score` questions over text or structured `state` and returns calibrated probability answers plus
|
|
6608
|
+
`generationId` and `costUsd`.
|
|
6609
|
+
- **Audio (`POST /audio/transcriptions` and `POST /audio/speech`):** `openRouterAudioTranscription`
|
|
6610
|
+
accepts `audio: { kind: 'base64' | 'url' | 'file' }` (JSON or automatic `FormData` multipart
|
|
6611
|
+
without manual `Content-Type`), `verbose_json`, `timestampGranularities`, and `diarize`;
|
|
6612
|
+
`openRouterAudioSpeech` streams synthesized audio bytes (`ReadableStream<Uint8Array>`).
|
|
6613
|
+
- **Images & Video (`POST /images` and `/videos`):** `openRouterGenerateImages` targets OpenRouter's
|
|
6614
|
+
Unified Image API (`b64_json` or signed `url`), while `openRouterSubmitVideo`,
|
|
6615
|
+
`openRouterGetVideo`, and `openRouterDownloadVideo` cover the async submit → poll → stream
|
|
6616
|
+
download lifecycle.
|
|
6617
|
+
- **Embeddings & Rerank (`POST /embeddings`, `POST /rerank`):** `openRouterEmbeddings` and
|
|
6618
|
+
`openRouterRerank` provide typed RAG vector and rescoring calls.
|
|
6619
|
+
- **Any other OpenRouter API v1 endpoint:** `openRouterRequestJson` (with optional Zod `schema`) and
|
|
6620
|
+
`openRouterRequestStream` (with open-phase `timeoutMs` disarmed once 2xx headers arrive) handle
|
|
6621
|
+
management or future endpoints (`/credits`, `/key`, `/responses`, `/images/models`, `/videos/models`)
|
|
6622
|
+
without custom wrappers.
|
|
6623
|
+
|
|
6598
6624
|
### OpenRouter catalog snapshots, pricing ceilings, and cache
|
|
6599
6625
|
|
|
6600
6626
|
`stitchkit/agent-runtime/openrouter` also provides a peer-free, Web Fetch-clean catalog layer for
|
|
@@ -17441,7 +17467,23 @@ test('every model call goes through the spend gateway', async () => {
|
|
|
17441
17467
|
root: 'src',
|
|
17442
17468
|
policy: {
|
|
17443
17469
|
modules: [
|
|
17444
|
-
{
|
|
17470
|
+
{
|
|
17471
|
+
module: 'stitchkit/agent-runtime/openrouter',
|
|
17472
|
+
symbols: [
|
|
17473
|
+
'openRouterProvider',
|
|
17474
|
+
'openRouterRequestJson',
|
|
17475
|
+
'openRouterRequestStream',
|
|
17476
|
+
'openRouterSystemOne',
|
|
17477
|
+
'openRouterAudioTranscription',
|
|
17478
|
+
'openRouterAudioSpeech',
|
|
17479
|
+
'openRouterGenerateImages',
|
|
17480
|
+
'openRouterSubmitVideo',
|
|
17481
|
+
'openRouterGetVideo',
|
|
17482
|
+
'openRouterDownloadVideo',
|
|
17483
|
+
'openRouterEmbeddings',
|
|
17484
|
+
'openRouterRerank',
|
|
17485
|
+
],
|
|
17486
|
+
},
|
|
17445
17487
|
{ module: 'stitchkit/agent-runtime/openai', symbols: ['openAiProvider'] },
|
|
17446
17488
|
{ module: 'stitchkit/agent-runtime/anthropic', symbols: ['anthropicProvider'] },
|
|
17447
17489
|
],
|
|
@@ -29411,10 +29453,18 @@ Server-only, peer-free native OpenRouter provider over Web `fetch` and Chat Comp
|
|
|
29411
29453
|
| `findOpenRouterModel` / `listOpenRouterModels` / `OpenRouterModelFilter` | functions / _type_ | query an `OpenRouterCatalogSnapshot` by exact `id` or `canonicalSlug`, or filter models by `tools`, `reasoning` (`reasoning`, `include_reasoning`, or declared efforts), `inputModalities`, `outputModalities`, `minContextLength` (via effective context `min(contextLength, topProviderContextLength)`), `maxPromptUsdPerMillion`, `maxCompletionUsdPerMillion`, `maxCacheWriteUsdPerMillion` (using the same ceiling semantics as `evaluateOpenRouterModelAdmission`), `freeOnly`, and `author` |
|
|
29412
29454
|
| `createOpenRouterCatalogCache` / `OpenRouterCatalogCache` / `OpenRouterCatalogCacheOptions` / `OpenRouterCatalogCacheReadResult` / `OpenRouterCatalogStore` | function / _types_ | Web Fetch-clean cached OpenRouter catalog reader with single-flight coalescing, per-caller `AbortSignal` isolation, `freshMs` TTL, `retryBackoffMs` stale fallback, optional pluggable persistence (`store`), and `read`/`refresh`/`getModel`/`listModels`; `OpenRouterCatalogCacheReadResult` is a discriminated union on `status` (`'current' \| 'stale' \| 'unavailable'`) narrowing `snapshot`, `observedAt`, `models`, and `lastError` without casts (use `read()` for admission/billing decisions; `getModel`/`listModels` map `'unavailable'` to `undefined`/`[]`) |
|
|
29413
29455
|
| `evaluateOpenRouterModelAdmission` / `OpenRouterAdmissionPolicySchema` / `OpenRouterAdmissionPolicy` / `OpenRouterModelAdmissionSchema` / `OpenRouterModelAdmission` / `OpenRouterAdmissionReasonSchema` / `OpenRouterAdmissionReason` | function / schemas / _types_ | decide one model from a stored snapshot: `admitted`, `unverified` (stale or future-dated snapshot, `'context-unknown'`, `'price-unknown'`, `'endpoints-unknown'`) or `rejected` with a reason (`requiredParameters`, `requiredInputModalities`, effective context `min(contextLength, topProviderContextLength)`, separated worst-case pricing ceilings `maxPromptUsdPerMillion` / `maxCompletionUsdPerMillion` / `maxCacheWriteUsdPerMillion` via `resolveOpenRouterModelCeiling`, live endpoint); `~`, `-latest`, `:batch`, `stealth/`, `openrouter/auto`, `aliasOf`, and `aliasTarget` models are always refused as `'floating-alias'`; the result is a schema, so a stored decision reads back |
|
|
29414
|
-
| `openRouterSpendProvider` / `createOpenRouterSpendReconciler` | functions | OpenRouter for `stitchkit/spend`: the gateway provider (origin, key read per call, usage
|
|
29456
|
+
| `openRouterSpendProvider` / `createOpenRouterSpendReconciler` | functions | OpenRouter for `stitchkit/spend`: the gateway provider (origin derived from optional `baseUrl` override, key read per call, chat + non-chat usage facts including `x-generation-id`, `input_tokens`/`output_tokens`, `generation_id`, and `usage.seconds` as `workUnit: 'seconds'`) and the reconciler that prices an attempt by its generation id (`GET /api/v1/generation`, optional `baseUrl` override; a 404 is "not yet"; `apiKey` may be a function of the record, since OpenRouter prices a generation only for the key that made it) |
|
|
29415
29457
|
| `OpenRouterHttpError` | class | a non-2xx answer from OpenRouter, with its `status` |
|
|
29416
|
-
| `openRouterModelCatalog` | function | complete tool-capable text catalog (`sort=top-weekly`) plus independent weekly popularity and available benchmark observations (optional static or async `apiKey`); a `timeoutMs` that is not an integer from 1 to 2147483647 ms (the timer range) is refused when the catalog is created (`RangeError`) |
|
|
29417
|
-
| `OpenRouterModelCatalogOptions` / `OpenRouterCatalogFetch` | _type_ | optional static/dynamic credential, timeout, clock and injected fetch boundary for catalog loading |
|
|
29458
|
+
| `openRouterModelCatalog` | function | complete tool-capable text catalog (`sort=top-weekly`) plus independent weekly popularity and available benchmark observations (optional static or async `apiKey` and `baseUrl` override); a `timeoutMs` that is not an integer from 1 to 2147483647 ms (the timer range) is refused when the catalog is created (`RangeError`) |
|
|
29459
|
+
| `OpenRouterModelCatalogOptions` / `OpenRouterCatalogFetch` | _type_ | optional static/dynamic credential, `baseUrl` override, timeout, clock and injected fetch boundary for catalog loading |
|
|
29460
|
+
| `OPENROUTER_API_BASE_URL` / `OpenRouterFetch` | const / _type_ | canonical default OpenRouter API v1 base URL (`https://openrouter.ai/api/v1`) and Web Fetch-compatible transport type shared by `openRouterProvider` and non-chat endpoint helpers |
|
|
29461
|
+
| `openRouterRequestJson` / `openRouterRequestStream` / `OpenRouterTransportOptions` / `OpenRouterRequestJsonOptions` / `OpenRouterRequestStreamOptions` / `OpenRouterJsonResponse` / `OpenRouterStreamResponse` / `OpenRouterHttpMethod` / `OpenRouterQueryParams` | functions / _types_ | peer-free, Web Fetch-clean transport for any OpenRouter API v1 JSON, multipart (`FormData`), or binary streaming endpoint: validates `baseUrl` and relative `path` against traversal or origin override, enforces `redirect: 'error'` plus defense-in-depth redirect refusal, bounds response/error bodies, throws redacted `AgentProviderError` on non-2xx or invalid JSON/schema, extracts `generationId`, `requestId`, and BYOK-aware `costUsd`, and disarms `openRouterRequestStream`'s open-phase `timeoutMs` once 2xx headers arrive while keeping caller `signal` linked to stream cancellation |
|
|
29462
|
+
| `openRouterSystemOne` / `OpenRouterSystemOneInput` / `OpenRouterSystemOneQuestion` / `OpenRouterSystemOneResponseSchema` / `OpenRouterSystemOneResponse` / `OpenRouterSystemOneResult` | function / schema / _types_ | typed client for OpenRouter's `POST /systemone` decision endpoint (`noul`, `choice`, and `score` questions over text or structured `state`, optional `provider` routing and `extraBody`, calibrated probability answers plus `generationId` and `costUsd`) |
|
|
29463
|
+
| `openRouterAudioTranscription` / `OpenRouterAudioTranscriptionInput` / `OpenRouterAudioSource` / `OpenRouterAudioTranscriptionResponseSchema` / `OpenRouterAudioTranscriptionResponse` / `OpenRouterAudioTranscriptionResult` | function / schema / _types_ | typed client for OpenRouter's `POST /audio/transcriptions` speech-to-text endpoint supporting `base64` JSON (`input_audio`), remote `url` (`source_url`), and multipart `file` uploads (`Blob` / `Uint8Array` / `ArrayBuffer`), `verbose_json`, `timestampGranularities`, `diarize` (enforcing `verbose_json`), `provider` routing, `generationId`, and `costUsd` |
|
|
29464
|
+
| `openRouterAudioSpeech` / `OpenRouterAudioSpeechInput` / `OpenRouterSpeechFormat` / `OpenRouterAudioSpeechResult` | function / _types_ | streaming text-to-speech client for OpenRouter's `POST /audio/speech` endpoint returning binary audio `ReadableStream<Uint8Array>`, `contentType`, and `generationId` |
|
|
29465
|
+
| `openRouterGenerateImages` / `OpenRouterImageGenerationInput` / `OpenRouterImageGenerationResponseSchema` / `OpenRouterImageGenerationResponse` / `OpenRouterImageGenerationResult` | function / schema / _types_ | typed client for OpenRouter's Unified Image API (`POST /images`) supporting `prompt`, `n`, `aspectRatio`, `resolution`, `responseFormat` (`'b64_json' \| 'url'`), `inputReferences`, `provider` routing, `generationId`, and `costUsd` |
|
|
29466
|
+
| `openRouterSubmitVideo` / `openRouterGetVideo` / `openRouterDownloadVideo` / `OpenRouterVideoSubmitInput` / `OpenRouterVideoJobInput` / `OpenRouterVideoSubmitResponse` / `OpenRouterVideoSubmitResult` / `OpenRouterVideoStatusResponse` / `OpenRouterVideoStatusResult` | functions / _types_ | typed submit (`POST /videos`), status poll (`GET /videos/{jobId}`), and authenticated binary stream download (`GET /videos/{jobId}/content`) clients for OpenRouter's asynchronous Video Generation API with `jobId` path-segment validation, `frameImages`, `inputReferences`, `generateAudio`, `callbackUrl`, `generationId`, and `costUsd` |
|
|
29467
|
+
| `openRouterEmbeddings` / `OpenRouterEmbeddingsInput` / `OpenRouterEmbeddingsResponse` / `OpenRouterEmbeddingsResult` / `openRouterRerank` / `OpenRouterRerankInput` / `OpenRouterRerankResponse` / `OpenRouterRerankResult` | functions / _types_ | typed clients for OpenRouter's `POST /embeddings` vector generation and `POST /rerank` document rescoring endpoints with `provider` routing, `generationId`, and `costUsd` |
|
|
29418
29468
|
|
|
29419
29469
|
## `stitchkit/agent-runtime/openai`
|
|
29420
29470
|
|
package/llms.txt
CHANGED
|
@@ -29,12 +29,12 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
29
29
|
- **stitchkit/handler**: [llms/handler.txt](llms/handler.txt) 2.3 KB
|
|
30
30
|
- **stitchkit/server**: [llms/server.txt](llms/server.txt) 44.9 KB → [llms/server.2.txt](llms/server.2.txt) 46.1 KB → [llms/server.3.txt](llms/server.3.txt) 47.1 KB → [llms/server.4.txt](llms/server.4.txt) 43.1 KB → [llms/server.5.txt](llms/server.5.txt) 26.4 KB
|
|
31
31
|
- **stitchkit/observability**: [llms/observability.txt](llms/observability.txt) 39.7 KB → [llms/observability.2.txt](llms/observability.2.txt) 10.1 KB
|
|
32
|
-
- **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt)
|
|
32
|
+
- **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt) 24.8 KB → [llms/agent-runtime.2.txt](llms/agent-runtime.2.txt) 43.9 KB → [llms/agent-runtime.3.txt](llms/agent-runtime.3.txt) 38.2 KB → [llms/agent-runtime.4.txt](llms/agent-runtime.4.txt) 33.6 KB → [llms/agent-runtime.5.txt](llms/agent-runtime.5.txt) 44.2 KB → [llms/agent-runtime.6.txt](llms/agent-runtime.6.txt) 17.5 KB
|
|
33
33
|
- **stitchkit/agent-runtime/testing**: [llms/agent-runtime-testing.txt](llms/agent-runtime-testing.txt) 3.8 KB
|
|
34
34
|
- **stitchkit/agent-runtime/harness**: [llms/agent-runtime-harness.txt](llms/agent-runtime-harness.txt) 13.7 KB
|
|
35
35
|
- **stitchkit/agent-runtime/coding-tools**: [llms/agent-runtime-coding-tools.txt](llms/agent-runtime-coding-tools.txt) 5.0 KB
|
|
36
36
|
- **stitchkit/agent-runtime/browser**: [llms/agent-runtime-browser.txt](llms/agent-runtime-browser.txt) 5.4 KB
|
|
37
|
-
- **stitchkit/agent-runtime/openrouter**: [llms/agent-runtime-openrouter.txt](llms/agent-runtime-openrouter.txt) 8
|
|
37
|
+
- **stitchkit/agent-runtime/openrouter**: [llms/agent-runtime-openrouter.txt](llms/agent-runtime-openrouter.txt) 12.8 KB
|
|
38
38
|
- **stitchkit/agent-runtime/openai**: [llms/agent-runtime-openai.txt](llms/agent-runtime-openai.txt) 2.3 KB
|
|
39
39
|
- **stitchkit/agent-runtime/anthropic**: [llms/agent-runtime-anthropic.txt](llms/agent-runtime-anthropic.txt) 2.9 KB
|
|
40
40
|
- **stitchkit/agent-executor**: [llms/agent-executor.txt](llms/agent-executor.txt) 13.5 KB
|
|
@@ -54,7 +54,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
54
54
|
- **stitchkit/application/diagnostic-journal**: [llms/application-diagnostic-journal.txt](llms/application-diagnostic-journal.txt) 1.8 KB
|
|
55
55
|
- **stitchkit/testing**: [llms/testing.txt](llms/testing.txt) 34.1 KB
|
|
56
56
|
- **stitchkit/agent-runtime/sandbox**: [llms/agent-runtime-sandbox.txt](llms/agent-runtime-sandbox.txt) 14.1 KB
|
|
57
|
-
- **stitchkit/spend**: [llms/spend.txt](llms/spend.txt)
|
|
57
|
+
- **stitchkit/spend**: [llms/spend.txt](llms/spend.txt) 11.0 KB
|
|
58
58
|
- **stitchkit/spend/testing**: [llms/spend-testing.txt](llms/spend-testing.txt) 1.2 KB
|
|
59
59
|
- **stitchkit/files**: [llms/files.txt](llms/files.txt) 11.4 KB
|
|
60
60
|
- **stitchkit/service-host**: [llms/service-host.txt](llms/service-host.txt) 10.3 KB
|
package/package.json
CHANGED