stitchkit 0.99.0 → 0.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/agent-runtime/contained-darwin.d.ts +0 -17
- package/dist/agent-runtime/contained-darwin.d.ts.map +1 -1
- package/dist/agent-runtime/contained-write.d.ts.map +1 -1
- package/dist/agent-runtime/invocation-attempt.d.ts +22 -0
- package/dist/agent-runtime/invocation-attempt.d.ts.map +1 -0
- package/dist/agent-runtime/invocation-failure.d.ts +6 -0
- package/dist/agent-runtime/invocation-failure.d.ts.map +1 -0
- package/dist/agent-runtime/invocation-payload.d.ts +18 -0
- package/dist/agent-runtime/invocation-payload.d.ts.map +1 -0
- package/dist/agent-runtime/invocation-read.d.ts +131 -0
- package/dist/agent-runtime/invocation-read.d.ts.map +1 -0
- package/dist/agent-runtime/invocation-schema.d.ts +378 -0
- package/dist/agent-runtime/invocation-schema.d.ts.map +1 -0
- package/dist/agent-runtime/invocations.d.ts +46 -0
- package/dist/agent-runtime/invocations.d.ts.map +1 -0
- package/dist/agent-runtime/run-acquisition.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution-state.d.ts +4 -2
- package/dist/agent-runtime/run-execution-state.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/run-failure.d.ts.map +1 -1
- package/dist/agent-runtime/run-model-attempts.d.ts.map +1 -1
- package/dist/agent-runtime/run-operation-lifecycle.d.ts +2 -2
- package/dist/agent-runtime/run-operation-lifecycle.d.ts.map +1 -1
- package/dist/agent-runtime/run-provider-ledger.d.ts +1 -0
- package/dist/agent-runtime/run-provider-ledger.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +11 -0
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/store-create.d.ts.map +1 -1
- package/dist/agent-runtime/store-event-once.d.ts +29 -0
- package/dist/agent-runtime/store-event-once.d.ts.map +1 -0
- package/dist/agent-runtime/store.d.ts +5 -0
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/application/change-subscription.d.ts +36 -0
- package/dist/application/change-subscription.d.ts.map +1 -0
- package/dist/application/diagnostic-journal-contract.d.ts +3 -6
- package/dist/application/diagnostic-journal-contract.d.ts.map +1 -1
- package/dist/application/notification-delivery.d.ts +32 -0
- package/dist/application/notification-delivery.d.ts.map +1 -0
- package/dist/application/notification-outbox-state.d.ts +37 -0
- package/dist/application/notification-outbox-state.d.ts.map +1 -0
- package/dist/application/notification-outbox.d.ts +7 -1
- package/dist/application/notification-outbox.d.ts.map +1 -1
- package/dist/application/watch-hub-core.d.ts +10 -15
- package/dist/application/watch-hub-core.d.ts.map +1 -1
- package/dist/application/watch-hub.d.ts +10 -2
- package/dist/application/watch-hub.d.ts.map +1 -1
- package/dist/browser/session-credentials.d.ts +20 -0
- package/dist/browser/session-credentials.d.ts.map +1 -0
- package/dist/browser/session.d.ts +31 -0
- package/dist/browser/session.d.ts.map +1 -0
- package/dist/durability/events.d.ts +6 -0
- package/dist/durability/events.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/coding-tools.js +3 -2
- package/dist/entrypoints/agent-runtime/harness.js +5 -3
- package/dist/entrypoints/agent-runtime/sandbox.js +3 -2
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
- package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
- package/dist/entrypoints/agent-runtime/testing.js +3 -3
- package/dist/entrypoints/agent-runtime.d.ts +3 -0
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime.js +15 -4
- package/dist/entrypoints/application/diagnostic-journal.js +2 -1
- package/dist/entrypoints/application.d.ts +3 -1
- package/dist/entrypoints/application.d.ts.map +1 -1
- package/dist/entrypoints/application.js +629 -189
- package/dist/entrypoints/files.js +2 -1
- package/dist/entrypoints/index.d.ts +2 -0
- package/dist/entrypoints/index.d.ts.map +1 -1
- package/dist/entrypoints/index.js +172 -0
- package/dist/entrypoints/live.js +68 -13
- package/dist/entrypoints/react.d.ts +1 -1
- package/dist/entrypoints/react.d.ts.map +1 -1
- package/dist/entrypoints/react.js +59 -16
- package/dist/{index-wsm5w4ee.js → index-0b1cnze2.js} +35 -3
- package/dist/{index-gxrt5h6v.js → index-cyktc4bp.js} +3 -0
- package/dist/{index-px2gm2jp.js → index-fhwqwxe0.js} +17 -55
- package/dist/{index-e4hkgm5t.js → index-gw8bmyaj.js} +4 -2
- package/dist/{index-8p52kd5p.js → index-js7gqrb1.js} +96 -14
- package/dist/{index-wt743f7f.js → index-k6gpggb9.js} +2 -1
- package/dist/index-q3pyb9n0.js +22 -0
- package/dist/{index-sp1tzwnb.js → index-s84he4v7.js} +2 -2
- package/dist/{index-jhx828hc.js → index-xwhjjw2x.js} +878 -279
- package/dist/{index-1m2thnq0.js → index-y9qn426m.js} +2 -2
- package/dist/index-zjjyynm3.js +42 -0
- package/dist/internal/coalesced-task.d.ts +15 -0
- package/dist/internal/coalesced-task.d.ts.map +1 -0
- package/dist/internal/darwin-binding.d.ts +19 -0
- package/dist/internal/darwin-binding.d.ts.map +1 -0
- package/dist/internal/exclusive-lock.d.ts +20 -7
- package/dist/internal/exclusive-lock.d.ts.map +1 -1
- package/dist/internal/mutation-queue.d.ts +4 -0
- package/dist/internal/mutation-queue.d.ts.map +1 -0
- package/dist/internal/process-identity.d.ts +1 -1
- package/dist/internal/process-identity.d.ts.map +1 -1
- package/dist/internal/process-instance.d.ts +26 -0
- package/dist/internal/process-instance.d.ts.map +1 -0
- package/dist/live/watch-client-state.d.ts +71 -0
- package/dist/live/watch-client-state.d.ts.map +1 -0
- package/dist/live/watch-client.d.ts +5 -1
- package/dist/live/watch-client.d.ts.map +1 -1
- package/dist/live/watch-contract.d.ts +12 -0
- package/dist/live/watch-contract.d.ts.map +1 -1
- package/dist/react/cache-bridge.d.ts +10 -0
- package/dist/react/cache-bridge.d.ts.map +1 -1
- package/llms/agent-runtime.2.txt +94 -0
- package/llms/agent-runtime.3.txt +24 -0
- package/llms/application.2.txt +68 -2
- package/llms/application.txt +32 -2
- package/llms/files.txt +1 -1
- package/llms/live.txt +7 -0
- package/llms/react.txt +8 -0
- package/llms/server.3.txt +35 -0
- package/llms/stitchkit.2.txt +41 -0
- package/llms/stitchkit.3.txt +22 -0
- package/llms/stitchkit.txt +3 -3
- package/llms/upgrading-0.37.0.txt +176 -0
- package/llms/{upgrading-0.37.0-0.58.0.txt → upgrading-0.44.0-0.60.0.txt} +229 -169
- package/llms/{upgrading-0.59.0-0.71.0.txt → upgrading-0.61.0-0.73.0.txt} +122 -229
- package/llms/{upgrading-0.72.0-0.99.0.txt → upgrading-0.74.0-0.100.0.txt} +67 -122
- package/llms/upgrading.txt +4 -3
- package/llms-full.txt +393 -6
- package/llms.txt +10 -9
- package/native/darwin-arm64.node +0 -0
- package/native/darwin-x64.node +0 -0
- package/package.json +1 -1
- package/dist/agent-runtime/run-mutation-queue.d.ts +0 -21
- package/dist/agent-runtime/run-mutation-queue.d.ts.map +0 -1
package/llms-full.txt
CHANGED
|
@@ -68,11 +68,11 @@ own, recorded as an ADR.
|
|
|
68
68
|
| `stitchkit/geo` | server (Bun or Node) | evolving | managed GeoIP reader generations, last-known-good reload and the optional MaxMind adapter |
|
|
69
69
|
| `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
|
|
70
70
|
| `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
|
|
71
|
-
| `stitchkit/observability` | server | stable<br>_redefined in 2 of the
|
|
71
|
+
| `stitchkit/observability` | server | stable<br>_redefined in 2 of the 45 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
|
|
72
72
|
| `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, plus the managed-resource conformance kit |
|
|
73
73
|
| `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
|
|
74
74
|
| `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
|
|
75
|
-
| `stitchkit/agent-runtime` | server | evolving<br>_redefined in 22 of the
|
|
75
|
+
| `stitchkit/agent-runtime` | server | evolving<br>_redefined in 22 of the 45 minors since 0.56.2, most recently 0.97.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
|
|
76
76
|
| `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
|
|
77
77
|
| `stitchkit/agent-runtime/testing` | tests on Bun or Node | evolving | credential-free replay, scripted provider faults, deterministic race controls and the agent-store conformance kit |
|
|
78
78
|
| `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
|
|
@@ -82,7 +82,7 @@ own, recorded as an ADR.
|
|
|
82
82
|
| `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
|
|
83
83
|
| `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
|
|
84
84
|
| `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
|
|
85
|
-
| `stitchkit/application` | browser + server | evolving<br>_redefined in
|
|
85
|
+
| `stitchkit/application` | browser + server | evolving<br>_redefined in 10 of the 45 minors since 0.56.2, most recently 0.100.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
|
|
86
86
|
| `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
|
|
87
87
|
| `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
|
|
88
88
|
| `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
|
|
@@ -3245,6 +3245,47 @@ hour and drops again starts its next retry at `minDelayMs` rather than the
|
|
|
3245
3245
|
ceiling it reached last time. Aborting the signal ends the iteration promptly,
|
|
3246
3246
|
including in the middle of a wait.
|
|
3247
3247
|
|
|
3248
|
+
## Operations belong to a login lifetime
|
|
3249
|
+
|
|
3250
|
+
Use `createSessionScope` when a client can log out or switch accounts. The scope is
|
|
3251
|
+
host-owned and context is immutable. Replace it for **every** login, even to the
|
|
3252
|
+
same account. Capture once for an entire compound operation:
|
|
3253
|
+
|
|
3254
|
+
```ts
|
|
3255
|
+
import { createClient, createSessionScope } from 'stitchkit'
|
|
3256
|
+
|
|
3257
|
+
const sessions = createSessionScope<{ accountId: string }>()
|
|
3258
|
+
const operation = sessions.replace({ accountId: 'account-a' })
|
|
3259
|
+
const client = createClient(contract, {
|
|
3260
|
+
baseUrl,
|
|
3261
|
+
fetch: operation.bindFetch(fetch, () => ({ Authorization: tokenFor(operation) })),
|
|
3262
|
+
})
|
|
3263
|
+
const value = await operation.run(() => client.read())
|
|
3264
|
+
operation.deliver(() => applyResult(value))
|
|
3265
|
+
```
|
|
3266
|
+
|
|
3267
|
+
Capture before the first request, keep the same operation for a second request or
|
|
3268
|
+
one explicitly allowed auth retry, and guard the **actual** final transport send
|
|
3269
|
+
or local state change. An async delivery callback needs another check after its
|
|
3270
|
+
await; `deliver` itself is synchronous. Guard error delivery too. Cancellation is
|
|
3271
|
+
additional protection and cannot undo server effects. `SessionExpiredError` means
|
|
3272
|
+
discard the stale operation, not refresh a new user's credentials. For raw/stream
|
|
3273
|
+
responses, guard each consumed chunk and final delivery; `run` returning a stream
|
|
3274
|
+
does not mean its future contents have been consumed.
|
|
3275
|
+
|
|
3276
|
+
`createSessionCredentials({ scope, refresh, storage })` coordinates the same scope.
|
|
3277
|
+
`login(context, credentials)` creates a generation, `read(operation)` resolves only
|
|
3278
|
+
that generation's credentials, and concurrent `refresh(operation)` shares one
|
|
3279
|
+
flight. `logout()` invalidates memory immediately and resolves after its ordered
|
|
3280
|
+
storage clear (or a newer login superseding that clear). Handle storage and capacity
|
|
3281
|
+
errors explicitly; a rejected write is not proof of durable login/logout. Refresh
|
|
3282
|
+
network work never holds the storage queue. Callers decide whether a failed command
|
|
3283
|
+
may be retried once; do not replay a multi-step callback or treat any `403` as expiry.
|
|
3284
|
+
|
|
3285
|
+
This is per-instance coordination. Route all writes through it; shared tabs/processes
|
|
3286
|
+
need storage-level locking. Replace the local session counter and refresh queue when
|
|
3287
|
+
adopting these primitives instead of retaining two independent lifetimes.
|
|
3288
|
+
|
|
3248
3289
|
|
|
3249
3290
|
==============================================================================
|
|
3250
3291
|
# Guide: MCP & agents (docs/guide/mcp-and-agents.md)
|
|
@@ -6273,6 +6314,100 @@ can provision those parents; the optional `cleanup(context)` removes them again,
|
|
|
6273
6314
|
whether the scenario passed or failed. A factory that owns no fixture state ignores the argument and
|
|
6274
6315
|
keeps working unchanged.
|
|
6275
6316
|
|
|
6317
|
+
## Plain completions and shared invocation receipts
|
|
6318
|
+
|
|
6319
|
+
Use `createModelInvocationLedger` from `stitchkit/agent-runtime` when a direct text
|
|
6320
|
+
completion and an agent must share causal provider evidence. It uses the existing
|
|
6321
|
+
runtime store, not a second database. The completion path sends exactly one user
|
|
6322
|
+
prompt, no framework instructions and no tools. It never starts an agent loop.
|
|
6323
|
+
|
|
6324
|
+
```ts
|
|
6325
|
+
import { createModelInvocationLedger } from 'stitchkit/agent-runtime';
|
|
6326
|
+
|
|
6327
|
+
const invocations = createModelInvocationLedger({
|
|
6328
|
+
store, // the same AgentRuntimeStore object passed to createAgentRuntime
|
|
6329
|
+
models, // an existing defineModelRegistry result
|
|
6330
|
+
payloadKey, // 32 bytes from the host's secret store; retain separately from archives
|
|
6331
|
+
authorize: async ({ context, conversationId, action, trace }) => {
|
|
6332
|
+
const session = await authenticate(context);
|
|
6333
|
+
await authorizeConversation(session, conversationId, action, trace);
|
|
6334
|
+
return { subject: session.subject }; // verified identity, never a body field
|
|
6335
|
+
},
|
|
6336
|
+
});
|
|
6337
|
+
|
|
6338
|
+
const completion = await invocations.complete({
|
|
6339
|
+
conversationId: 'evaluation-42',
|
|
6340
|
+
idempotencyKey: 'summary-case-3',
|
|
6341
|
+
trace: {
|
|
6342
|
+
operationId: 'summary-42', purpose: 'summarize', project: 'example',
|
|
6343
|
+
parent: { traceId: 'trace-42' }, experiment: 'evaluation', case: 'case-3',
|
|
6344
|
+
},
|
|
6345
|
+
prompt: 'Summarize these supplied facts.',
|
|
6346
|
+
models: ['primary', 'fallback'], // registry keys; repeat a key for an explicit retry
|
|
6347
|
+
settings: { maxOutputTokens: 500 },
|
|
6348
|
+
timeoutMs: 30_000,
|
|
6349
|
+
}, authenticatedContext);
|
|
6350
|
+
|
|
6351
|
+
// Add to the existing createAgentRuntime configuration:
|
|
6352
|
+
const receiptConfig = {
|
|
6353
|
+
ledger: invocations,
|
|
6354
|
+
trace: ({ run }) => ({
|
|
6355
|
+
operationId: run.id, purpose: 'assistant-turn', project: 'example',
|
|
6356
|
+
}),
|
|
6357
|
+
};
|
|
6358
|
+
// createAgentRuntime({ ...existingConfig, invocations: receiptConfig });
|
|
6359
|
+
|
|
6360
|
+
const page = await invocations.read({
|
|
6361
|
+
conversationId: 'evaluation-42', limit: 100,
|
|
6362
|
+
}, authenticatedContext);
|
|
6363
|
+
// Continue with fromSeq: page.nextSeq while it is defined.
|
|
6364
|
+
```
|
|
6365
|
+
|
|
6366
|
+
`complete` returns `invocationId`, `outcome` and, on success, `text`. `duplicate`
|
|
6367
|
+
returns the existing ID without provider execution or replaying plaintext. Changed
|
|
6368
|
+
input, trace or caller under the same key is a conflict. Model attempts are explicit
|
|
6369
|
+
and bounded to eight; SDK retries are disabled. Only provider failures trigger the
|
|
6370
|
+
next attempt. Abort, audit refusal and configuration errors do not. An admitted call
|
|
6371
|
+
whose process died stays claimed: inspect the receipt before choosing a new key.
|
|
6372
|
+
|
|
6373
|
+
The agent retains its existing prompt, tools and loop. Both modes produce
|
|
6374
|
+
`invocation/started`, `provider/request`, `provider/response` and
|
|
6375
|
+
`invocation/finished` records through `read`. Each attempt has its own ID; response
|
|
6376
|
+
usage is counted once and keeps `unavailable` distinct from measured zero. Requested
|
|
6377
|
+
registry selection, sent adapter identity and effective provider identity are
|
|
6378
|
+
separate. Effective identity is null when not reported. A gateway's hidden retries
|
|
6379
|
+
are not visible as additional attempts.
|
|
6380
|
+
|
|
6381
|
+
`currentModelInvocationAttempt()` returns the causal context inside a provider's
|
|
6382
|
+
`fetch` callback or streamed read. Use it to join a host transport audit to
|
|
6383
|
+
`operationId`, `invocationId`, `attemptId`, optional `runId` and `step`.
|
|
6384
|
+
`onAttempt` is an awaited admission hook; a rejected hook prevents the provider call.
|
|
6385
|
+
SDK payload hashes are not represented as hashes of HTTP wire bytes.
|
|
6386
|
+
|
|
6387
|
+
Prompts and output are AES-256-GCM payload artifacts. `read` returns references and
|
|
6388
|
+
hashes; `readPayload({ conversationId, artifactId }, context)` separately authorizes
|
|
6389
|
+
`read-payload` and checks authentication tags and hashes. `payloadKey` must be 32
|
|
6390
|
+
bytes and is copied at construction. Keep it outside the event store/backups; retain
|
|
6391
|
+
the appropriate key when restoring an archive. `maxPayloadBytes` defaults to 4 MiB
|
|
6392
|
+
(range 1 KiB–64 MiB); streaming output evidence is capped at 1 MiB. Request headers
|
|
6393
|
+
are excluded. Protect existing agent history independently: enabling receipts does
|
|
6394
|
+
not encrypt its ordinary conversation records.
|
|
6395
|
+
|
|
6396
|
+
The built-in memory and SQLite stores implement `appendEventOnce`. Custom stores
|
|
6397
|
+
must implement its once-only check and append atomically, returning the original
|
|
6398
|
+
event on a duplicate key scoped by conversation and kind. A factory without this
|
|
6399
|
+
capability refuses receipt setup. The driver-backed implementation reads bounded
|
|
6400
|
+
pages under one transaction, without another table or database.
|
|
6401
|
+
|
|
6402
|
+
### Migration from direct SDK completions
|
|
6403
|
+
|
|
6404
|
+
**Who must act:** applications opting into shared completion/agent receipts.
|
|
6405
|
+
Replace the direct `generateText` call with `invocations.complete`, configure host
|
|
6406
|
+
authorization and a retained payload key, and pass the same ledger in the agent's
|
|
6407
|
+
`invocations` option. Use the returned invocation ID and the paginated `read` method
|
|
6408
|
+
for receipt queries; do not import runtime internals. This API is unreleased; it is
|
|
6409
|
+
not present in 0.99.0. Existing runtime configurations need no migration.
|
|
6410
|
+
|
|
6276
6411
|
|
|
6277
6412
|
==============================================================================
|
|
6278
6413
|
# Guide: Managed application kernel (docs/guide/application-kernel.md)
|
|
@@ -6922,7 +7057,12 @@ refusals are explicit; accepted ordered frames are never evicted.
|
|
|
6922
7057
|
The absolute path's parent must already exist and be operator-controlled. One manager owns it via
|
|
6923
7058
|
an exclusive `.lock`; new files use mode `0600` by default. `maxFiles` includes the active file,
|
|
6924
7059
|
and a non-newline startup tail is rotated intact rather than guessed or repaired. An abrupt process
|
|
6925
|
-
death may leave
|
|
7060
|
+
death may leave a lock. The default `refuse` policy leaves recovery to the operator;
|
|
7061
|
+
`lock: 'reclaim-stale'` compares machine, boot and process birth identity before
|
|
7062
|
+
recovery. A reused PID cannot impersonate a modern owner. Legacy records with a
|
|
7063
|
+
live PID, foreign namespaces and unavailable identity refuse automatic recovery;
|
|
7064
|
+
see the upgrading guide for quiescent legacy recovery. The same mechanism owns the
|
|
7065
|
+
short-lived reclaim guard.
|
|
6926
7066
|
|
|
6927
7067
|
`flush()` means every accepted append through that call's boundary settled. It is not `fsync`, a
|
|
6928
7068
|
durable receipt, exactly-once execution or remote delivery. Timeout/cancellation bound only the
|
|
@@ -7253,6 +7393,55 @@ holder — after which the heartbeat wins and the lock is abandoned. Temporary f
|
|
|
7253
7393
|
the store's first update. Ledger corruption may be declared reconstructable;
|
|
7254
7394
|
an outbox must fail closed rather than silently discard pending delivery.
|
|
7255
7395
|
|
|
7396
|
+
## Recovering change subscriptions
|
|
7397
|
+
|
|
7398
|
+
`changeSubscriptionResource` is an optional resource over a consumer-owned driver.
|
|
7399
|
+
It uses a finite declared key set, subscribes before reading, reconciles after
|
|
7400
|
+
reconnect and periodically repairs lost hints. `reconcileIntervalMs` is explicit;
|
|
7401
|
+
notifications alone cannot prove freshness. Within a key, hints coalesce into one
|
|
7402
|
+
trailing read and a failed read retries with backoff. Use the supplied
|
|
7403
|
+
`context.commit(() => publish(value))` after awaits to reject an obsolete connection.
|
|
7404
|
+
|
|
7405
|
+
Drivers implement `connect(signal)` and return `subscribe({ signal, hint,
|
|
7406
|
+
disconnected })` plus `close()`. Subscribe must establish the notification boundary
|
|
7407
|
+
before resolving. A database LISTEN driver owns its connection, channels, decoding
|
|
7408
|
+
and transaction ordering; no SQL or database driver is included here. The resource
|
|
7409
|
+
owns reconnect, deadlines and shutdown. Drivers must honor abort. If one ignores it,
|
|
7410
|
+
its slot remains occupied until settlement; deadlines cannot safely manufacture
|
|
7411
|
+
successful cleanup or permit an overlapping connection.
|
|
7412
|
+
|
|
7413
|
+
For watched reads, set `reconcileIntervalMs` on the existing `createWatchHub` rather
|
|
7414
|
+
than building a second read loop. Its per-key machinery is shared with managed
|
|
7415
|
+
subscriptions. Limits default to 1024 sources and 1024 subscribers per hub; set
|
|
7416
|
+
explicit finite values for larger workloads. Supply a server-verified admission
|
|
7417
|
+
scope to `attach` and abort it on logout, permission revocation or session replacement.
|
|
7418
|
+
The read callback receives the trusted scope as its third argument. A client owner
|
|
7419
|
+
ID in arguments is not authentication.
|
|
7420
|
+
|
|
7421
|
+
## Multi-action notification delivery
|
|
7422
|
+
|
|
7423
|
+
Opt into `delivery: { version, actions, project }` on `createNotificationOutbox`.
|
|
7424
|
+
The pure `actions(payload)` selector runs at enqueue; the versioned plan remains
|
|
7425
|
+
fixed throughout retry. Each `send` receives its action and a stable idempotency
|
|
7426
|
+
key; return a small JSON receipt such as a remote message or uploaded object ID.
|
|
7427
|
+
`project(notification, receipts)` applies all confirmed results locally and must
|
|
7428
|
+
be idempotent. Checkpoints and the final projection timestamp live in the existing
|
|
7429
|
+
atomic StateStore; completed receipts retain them within retention/byte limits.
|
|
7430
|
+
|
|
7431
|
+
This supports, for example, text plus attachment delivery with a local timeline
|
|
7432
|
+
projection, or upload plus publication with a local asset index. These are protocol
|
|
7433
|
+
examples, not claims of deployed consumer adoption. A failure in projection does
|
|
7434
|
+
not repeat confirmed sends. A crash after remote success but before receipt commit
|
|
7435
|
+
is ambiguous: the provider must deduplicate the action key or reconcile its result.
|
|
7436
|
+
A projection can also repeat if its completion checkpoint is lost.
|
|
7437
|
+
|
|
7438
|
+
A new executor version must explicitly migrate or terminally classify incompatible
|
|
7439
|
+
queued plans. Existing `classify`/`onDropped` handles terminal items; a durable
|
|
7440
|
+
quarantine is the application's responsibility. Whole-state file and memory stores
|
|
7441
|
+
remain supported. Atomic enqueue with an unrelated business transaction is not
|
|
7442
|
+
provided by this contract; retain the application's transactional adapter when that
|
|
7443
|
+
boundary is required. Send and projection callbacks own their external deadlines.
|
|
7444
|
+
|
|
7256
7445
|
|
|
7257
7446
|
==============================================================================
|
|
7258
7447
|
# Guide: Optional process sandbox (docs/guide/sandbox.md)
|
|
@@ -9728,6 +9917,41 @@ through `emitTo`; a broadcast through `realtime.to(room).emit` reaches the
|
|
|
9728
9917
|
socket immediately, replay or not, so keep room traffic whose order matters
|
|
9729
9918
|
relative to the snapshot on the registry.
|
|
9730
9919
|
|
|
9920
|
+
## Session-scoped watches and query cache
|
|
9921
|
+
|
|
9922
|
+
Pass the captured login operation as `createWatchClient(contract, { transport,
|
|
9923
|
+
session })`. It adds a lifetime nonce to watch keys and detaches on invalidation;
|
|
9924
|
+
a late frame for a previous login cannot match a new client's key on the same socket.
|
|
9925
|
+
Both client and server must support the new optional `WatchKey.instance` field.
|
|
9926
|
+
The nonce is not authorization: the server still admits a verified identity and
|
|
9927
|
+
uses `hub.attach(subscriber, { key: verifiedScope, signal: revocationSignal })`.
|
|
9928
|
+
The scope key must change with session and permission boundaries.
|
|
9929
|
+
|
|
9930
|
+
`createCacheBridge` can bind watched handles directly:
|
|
9931
|
+
|
|
9932
|
+
```ts
|
|
9933
|
+
const bridge = createCacheBridge({
|
|
9934
|
+
socket, queryClient, handlers: {}, session,
|
|
9935
|
+
watched: [{
|
|
9936
|
+
handle: watches.list({ folderId }),
|
|
9937
|
+
queryKey: ['items', session.id, folderId],
|
|
9938
|
+
state: frame => showWatchState(frame),
|
|
9939
|
+
}],
|
|
9940
|
+
})
|
|
9941
|
+
bridge.connect()
|
|
9942
|
+
```
|
|
9943
|
+
|
|
9944
|
+
A value updates that exact query; non-live state marks it stale while retaining its
|
|
9945
|
+
value. The existing phases (`opening`, `live`, `unavailable`, `resync-required`)
|
|
9946
|
+
remain the status model. Do not replace unavailable data with an empty collection.
|
|
9947
|
+
Session invalidation removes bound queries. Include the session identity in query
|
|
9948
|
+
keys and guard any application-level side effects with that same operation.
|
|
9949
|
+
|
|
9950
|
+
Use existing shared watches for paginated lists and selected-detail queries; bind
|
|
9951
|
+
each exact argument set to its query key. No global domain/query registry or new
|
|
9952
|
+
UI components are needed. Reconnect and revision/delta recovery remain owned by the
|
|
9953
|
+
watch client; silent lost notifications are repaired by hub reconciliation.
|
|
9954
|
+
|
|
9731
9955
|
|
|
9732
9956
|
==============================================================================
|
|
9733
9957
|
# Guide: Live data (docs/guide/live.md)
|
|
@@ -13035,6 +13259,70 @@ analytics policy belong to the application.
|
|
|
13035
13259
|
|
|
13036
13260
|
# Upgrading stitchkit
|
|
13037
13261
|
|
|
13262
|
+
## Released migration: 0.100.0
|
|
13263
|
+
|
|
13264
|
+
### watch capacity and session/live/delivery adoption
|
|
13265
|
+
|
|
13266
|
+
**Who must act:** watch consumers exceeding 1024 hub sources, 1024 hub subscribers,
|
|
13267
|
+
1024 client keys or 128 listeners per key. These previously unbounded collections
|
|
13268
|
+
now refuse excess admission. Choose explicit positive finite limits, for example:
|
|
13269
|
+
|
|
13270
|
+
```ts
|
|
13271
|
+
// Before: no hub-wide capacity bounds.
|
|
13272
|
+
createWatchHub({ read, watchable });
|
|
13273
|
+
// After: explicitly budget a larger workload.
|
|
13274
|
+
createWatchHub({ read, watchable, maxSources: 4096, maxSubscribers: 4096 });
|
|
13275
|
+
// Client limits are configured independently.
|
|
13276
|
+
createWatchClient({ ...clientConfig, maxKeys: 2048, maxListenersPerKey: 256 });
|
|
13277
|
+
```
|
|
13278
|
+
|
|
13279
|
+
The remaining steps apply only to applications opting into session lifetimes,
|
|
13280
|
+
scoped watched reads, managed subscriptions or multi-action notification delivery.
|
|
13281
|
+
Existing clients within the limits and single-send outboxes need no migration.
|
|
13282
|
+
|
|
13283
|
+
Replace local session generation counters with one `createSessionScope`; share it
|
|
13284
|
+
with `createSessionCredentials`. Guard transport attempts, complete asynchronous
|
|
13285
|
+
operations and final synchronous delivery. Route credential persistence through
|
|
13286
|
+
one coordinator. Keep provider-specific error classification and bounded command
|
|
13287
|
+
retry in the application. Coordination is per client instance.
|
|
13288
|
+
|
|
13289
|
+
Upgrade both watch endpoints before enabling session-scoped watches: strict older
|
|
13290
|
+
servers reject the new optional `WatchKey.instance`. Server-verified scope controls
|
|
13291
|
+
sharing; the client instance is only routing identity. Bind exact watched handles
|
|
13292
|
+
to session-qualified cache keys. Existing delta/reconnect behavior stays in place.
|
|
13293
|
+
For applications needing more than 1024 hub sources/subscribers or client keys, set
|
|
13294
|
+
explicit finite capacity options. Enable a reconciliation interval when lost hints
|
|
13295
|
+
must recover without a reconnect.
|
|
13296
|
+
|
|
13297
|
+
For multi-action outboxes, enqueue new items with a versioned delivery plan and
|
|
13298
|
+
return small JSON receipts from `send`. Existing queued single-send items should
|
|
13299
|
+
be drained before enabling a delivery executor on that queue, or migrated under
|
|
13300
|
+
the store's atomic transition. Preserve executor versions until their queues drain.
|
|
13301
|
+
Make projection idempotent. Provider idempotency/reconciliation remains necessary
|
|
13302
|
+
for a crash between remote success and checkpoint. These APIs are available starting with 0.100.0.
|
|
13303
|
+
|
|
13304
|
+
### exclusive lock recovery
|
|
13305
|
+
|
|
13306
|
+
New lock and reclaim-guard records include `owner.process`: kernel boot identity,
|
|
13307
|
+
process birth token and namespace. `readDiagnosticJournalLockDiagnosis(error)`
|
|
13308
|
+
adds `identity` to distinguish matched lifetime evidence, PID reuse, a different
|
|
13309
|
+
boot, an absent PID, a legacy record or unavailable identity. Legacy `alive` only
|
|
13310
|
+
means the PID is present; it does not prove that the recorded writer still exists.
|
|
13311
|
+
|
|
13312
|
+
**Who must act:** deployments recovering a legacy lock with a reused live PID,
|
|
13313
|
+
or bundling file-lock consumers into a standalone Darwin executable. Legacy
|
|
13314
|
+
records cannot safely infer their missing boot/start identity from `acquiredAt`.
|
|
13315
|
+
Stop all writers to that resource, verify exclusive ownership, preserve the old
|
|
13316
|
+
lock for incident evidence outside the active lock path, and restart with the
|
|
13317
|
+
new package. Never delete a lock merely because it is old. New acquisitions
|
|
13318
|
+
write the modern record; no journal data migration is needed.
|
|
13319
|
+
|
|
13320
|
+
Darwin distributions must retain the package's architecture-matched native
|
|
13321
|
+
`.node` asset for process birth measurement, as for contained filesystem access.
|
|
13322
|
+
If native/proc identity cannot be read, new locks explicitly record null and
|
|
13323
|
+
recovery refuses rather than treating unknown ownership as death. Existing
|
|
13324
|
+
`refuse` policy and the separately configured ownerless-file grace are unchanged.
|
|
13325
|
+
|
|
13038
13326
|
## Released migration: 0.99.0
|
|
13039
13327
|
|
|
13040
13328
|
### structural alternatives in flattened tool schemas
|
|
@@ -17000,6 +17288,28 @@ can emit / propagate a `traceparent` (see `HttpClientConfig.trace`).
|
|
|
17000
17288
|
|
|
17001
17289
|
---
|
|
17002
17290
|
|
|
17291
|
+
### Session lifetime and credential coordination
|
|
17292
|
+
|
|
17293
|
+
`createSessionScope` (`stitchkit`) returns the generic `SessionScope`: `replace(context)`
|
|
17294
|
+
creates a new login lifetime (including same-account relogin), `capture()` returns
|
|
17295
|
+
its `SessionOperation<T>`, `clear()` invalidates it, and `stop()` permanently closes
|
|
17296
|
+
the host. Operations expose `id`, `generation`, `context`, `signal`, `current()` and
|
|
17297
|
+
`assertCurrent()`. `run(callback)` checks both success and failure across an await;
|
|
17298
|
+
`deliver(callback)` admits a synchronous final send/state change or returns false.
|
|
17299
|
+
`bindFetch(fetch, headers?)` guards every attempt and scopes its abort signal. Wrap
|
|
17300
|
+
the complete client call in `run` too: headers are not the response body boundary.
|
|
17301
|
+
Expired work throws `SessionExpiredError`, not a refresh instruction.
|
|
17302
|
+
|
|
17303
|
+
`createSessionCredentials` accepts `SessionCredentialsConfig`:
|
|
17304
|
+
`scope`, `refresh(credentials, signal)`, `storage.write(session, credentials)`,
|
|
17305
|
+
`storage.clear()`, `maxPendingWrites` (128), and `refreshTimeoutMs` (30000, at most one
|
|
17306
|
+
hour). `SessionCredentials` provides `login`, `logout`, `read(operation)` and
|
|
17307
|
+
`refresh(operation)`. Concurrent refresh calls in one generation share the same
|
|
17308
|
+
promise. Logout invalidates memory before its returned persistence promise settles.
|
|
17309
|
+
Storage errors and queue-capacity refusals reject; callers must handle them. All
|
|
17310
|
+
writes must pass through the same instance. There is no cross-process/tab lock,
|
|
17311
|
+
provider error classifier or automatic retry of arbitrary application callbacks.
|
|
17312
|
+
|
|
17003
17313
|
## `stitchkit/contract`
|
|
17004
17314
|
|
|
17005
17315
|
The contract layer alone — browser-and-server safe. All of this is also exported
|
|
@@ -17140,6 +17450,13 @@ realtime contract from `stitchkit`, and the server halves live in `stitchkit/app
|
|
|
17140
17450
|
|
|
17141
17451
|
---
|
|
17142
17452
|
|
|
17453
|
+
### Session-scoped watch lifetime
|
|
17454
|
+
|
|
17455
|
+
`WatchClientConfig.session` captures a `SessionOperation`; `maxKeys` (1024) and
|
|
17456
|
+
`maxListenersPerKey` (128) bound retained subscriptions. Its lifetime nonce travels
|
|
17457
|
+
in optional `WatchKey.instance`, preventing old-session frames from matching a new
|
|
17458
|
+
client on the same socket. This is routing identity, never authorization.
|
|
17459
|
+
|
|
17143
17460
|
## `stitchkit/primitives`
|
|
17144
17461
|
|
|
17145
17462
|
Browser-and-server-safe declarations for facts an application wants to define once. See the
|
|
@@ -17528,7 +17845,7 @@ cutovers are covered by the executable
|
|
|
17528
17845
|
| `DiagnosticJournalConfig` / `DiagnosticJournal` | _type_ | owner schema/path/limits/failure observer and the synchronous `submit`, bounded-wait `flush`/`close`, status handle |
|
|
17529
17846
|
| `DiagnosticJournalLimitsSchema` / `DiagnosticJournalLimits` | schema / _type_ | positive event, pending-item, pending-byte, file-byte and retained-file limits |
|
|
17530
17847
|
| `DiagnosticJournalLockPolicySchema` / `DiagnosticJournalLockPolicy` | schema / _type_ | `refuse` (default) or `reclaim-stale`, which reclaims only a lock whose recorded owner is provably gone |
|
|
17531
|
-
| `readDiagnosticJournalLockDiagnosis` / `DiagnosticJournalLockDiagnosis` | function / _type_ | why a `reclaim-stale` acquisition refused —
|
|
17848
|
+
| `readDiagnosticJournalLockDiagnosis` / `DiagnosticJournalLockDiagnosis` | function / _type_ | why a `reclaim-stale` acquisition refused — attribution, PID liveness and optional process `identity` evidence (`matched`, `different-boot`, `reused-pid`, `pid-gone`, `legacy`, `unavailable`) — read off the thrown `EEXIST` |
|
|
17532
17849
|
| `DiagnosticJournalSubmitResultSchema` / `DiagnosticJournalSubmitResult` | schema / _type_ | accepted epoch/sequence or explicit invalid, oversized, capacity, closed or failed refusal |
|
|
17533
17850
|
| `DiagnosticJournalStatusSchema` / `DiagnosticJournalStatus` | schema / _type_ | state, limits, exact admission/write/failure counters, pending ownership, rotations, partial tails and last safe sequences |
|
|
17534
17851
|
| `DiagnosticJournalFrameSchema` / `DiagnosticJournalFrame` | schema / _type_ | version-1 JSONL frame carrying process epoch, contiguous accepted sequence and schema-validated JSON event |
|
|
@@ -17631,6 +17948,44 @@ vocabulary with an event topic declared `mode: 'decision'`.
|
|
|
17631
17948
|
→ [ADR 0152](../decisions/0152-a-keyspace-is-memory-that-nothing-reaches-before-it-is-durable.md),
|
|
17632
17949
|
[ADR 0153](../decisions/0153-a-watched-read-is-one-read-per-question.md).
|
|
17633
17950
|
|
|
17951
|
+
### Managed change subscriptions and scoped watches
|
|
17952
|
+
|
|
17953
|
+
`changeSubscriptionResource` (`stitchkit/application`) accepts
|
|
17954
|
+
`ChangeSubscriptionConfig`: `id`, unique `keys` (1–128, at most 256 characters each),
|
|
17955
|
+
`connect(signal)`, `reconcile(key, context)`, required `reconcileIntervalMs` (10 ms–1 h),
|
|
17956
|
+
optional `timeoutMs` (30000; 1 ms–1 h), `backoff`, and `onError`.
|
|
17957
|
+
`ChangeConnection` supplies `subscribe({ signal, hint, disconnected })`, which completes subscription
|
|
17958
|
+
before the first read; `close()` releases it. `ChangeReconciliation` exposes `signal`
|
|
17959
|
+
and a synchronous `commit(callback)` guard against late publication. Drivers must
|
|
17960
|
+
honor cancellation. Uncooperative work retains its slot until settled instead of
|
|
17961
|
+
allowing overlapping connections/reads. Errors reach `onError`; no raw payload or
|
|
17962
|
+
connection string is logged by this resource. Recovery runs after reconnect and
|
|
17963
|
+
periodically even when no notification arrives.
|
|
17964
|
+
|
|
17965
|
+
`WatchHubConfig` adds `maxSources` (1024), `maxSubscribers` (1024), and optional
|
|
17966
|
+
`reconcileIntervalMs` (10 ms–1 h). `hub.attach(subscriber, scope?)` accepts a
|
|
17967
|
+
`WatchAdmissionScope` containing a **server-verified** `key` (1–512 characters) and
|
|
17968
|
+
revocation `signal`. The key separates sharing and is the optional third argument
|
|
17969
|
+
of `read(operation, args, scope)`. It must represent account, session and permissions;
|
|
17970
|
+
never trust a client-supplied owner ID as that scope.
|
|
17971
|
+
|
|
17972
|
+
|
|
17973
|
+
|
|
17974
|
+
### Notification action and projection receipts
|
|
17975
|
+
|
|
17976
|
+
`NotificationOutboxConfig.delivery` accepts `NotificationDeliveryConfig`:
|
|
17977
|
+
immutable executor `version`, pure `actions(payload)` plan selector (1–128 unique
|
|
17978
|
+
names, each at most 128 characters), and idempotent `project(notification, receipts)`.
|
|
17979
|
+
`send` receives optional `action` and stable `idempotencyKey`, and returns a JSON
|
|
17980
|
+
remote receipt (void becomes null). `NotificationDeliveryStateSchema` validates the
|
|
17981
|
+
optional `NotificationDeliveryState` on queued items and completed receipts:
|
|
17982
|
+
`version`, `actions`, `receipts` and optional `projectedAt`. Checkpoints share the
|
|
17983
|
+
existing atomic StateStore and lease fence. Receipt retention and serialized byte
|
|
17984
|
+
budgets still apply. Single-send configuration remains valid without `delivery`.
|
|
17985
|
+
A remote result lost before its checkpoint may be sent again; provider idempotency
|
|
17986
|
+
or reconciliation is required. A projection may repeat after a crash before its
|
|
17987
|
+
checkpoint. Business-transaction enqueue and durable quarantine are not implied.
|
|
17988
|
+
|
|
17634
17989
|
## `stitchkit/application/grammy`
|
|
17635
17990
|
|
|
17636
17991
|
Isolated optional-peer lifecycle adapters. Importing `stitchkit/application`
|
|
@@ -17963,6 +18318,30 @@ Managed effects and operator telemetry additionally export `AgentToolFenceConfig
|
|
|
17963
18318
|
may accompany checkpoint/terminal writes and tool context; internal causes are redacted unless an
|
|
17964
18319
|
operator-only observability sink explicitly opts in.
|
|
17965
18320
|
|
|
18321
|
+
### Completion and agent invocation receipts
|
|
18322
|
+
|
|
18323
|
+
`createModelInvocationLedger` constructs a `ModelInvocationLedger` from
|
|
18324
|
+
`ModelInvocationConfig`: the existing store and model registry, a 32-byte payload
|
|
18325
|
+
key, required host authorization, optional bounded payload size and `onAttempt`.
|
|
18326
|
+
`complete(input, context, signal?)` executes only the supplied prompt, with no tools
|
|
18327
|
+
or framework instructions; repeated keys return the existing invocation ID.
|
|
18328
|
+
`read(input, context)` returns a bounded event page shared by agent and completion;
|
|
18329
|
+
`readPayload(input, context)` requires a separate authorization action to decrypt
|
|
18330
|
+
one protected artifact. See the [guide and migration example](../guide/agent-runtime.md#plain-completions-and-shared-invocation-receipts).
|
|
18331
|
+
|
|
18332
|
+
| Export | Kind | Purpose |
|
|
18333
|
+
| --- | --- | --- |
|
|
18334
|
+
| `CompletionInvocationInputSchema` / `CompletionInvocationInput` | schema/type | strict prompt, model-attempt list, deadline, idempotency key and trace input |
|
|
18335
|
+
| `ModelInvocationTraceSchema` / `ModelInvocationTrace` | schema/type | operation, purpose, project, parent trace and optional experiment/case/profile |
|
|
18336
|
+
| `ModelInvocationRecordSchema` / `ModelInvocationRecord` | schema/type | discriminated invocation start/finish and per-attempt requested/sent/effective evidence |
|
|
18337
|
+
| `ModelInvocationAttemptContext` | type | conversation, operation, invocation, attempt, step and optional agent run identity |
|
|
18338
|
+
| `currentModelInvocationAttempt` | function | returns causal IDs inside the provider transport; undefined outside an invocation |
|
|
18339
|
+
|
|
18340
|
+
The runtime `invocations` option takes this ledger and a trace callback; it requires
|
|
18341
|
+
the same store and preserves the existing tool loop. `AgentRuntimeStore.appendEventOnce`
|
|
18342
|
+
is an optional atomic capability required by receipt admission. Built-in stores
|
|
18343
|
+
supply it; custom adapters must honor its once-only transaction contract.
|
|
18344
|
+
|
|
17966
18345
|
## `stitchkit/agent-runtime/testing`
|
|
17967
18346
|
|
|
17968
18347
|
Credential-free provider and concurrency fixtures for Bun and Node tests.
|
|
@@ -18639,7 +19018,7 @@ available from `stitchkit/contract`.
|
|
|
18639
19018
|
| `ManagedFileInspector` | _type_ | bounded-prefix read/write inspection callback with a finite cancellation signal that cannot own path or size |
|
|
18640
19019
|
| `ManagedFileInspectionInput` / `ManagedFileInspection` | _type_ | inspector prefix/name/declared media/signal input and validated metadata-only result |
|
|
18641
19020
|
| `writeFileAtomic` / `writeFileAtomicSync` / `WriteFileAtomicOptions` | function / _type_ | replace a file atomically: a random staging name created exclusively (never through a planted link), the mode set on the descriptor before the file is visible (default `0o600`, not masked by the umask), `fsync`, rename; a failure leaves the target and no staging file. The asynchronous form keeps the event loop running |
|
|
18642
|
-
| `withExclusiveLock` / `ExclusiveLockOptions` / `ExclusiveLock` / `ExclusiveLockOwner` | function / _type_ | run work under an exclusive lock between processes — a file recording its owner (pid, host, machine identity, time); waits up to `timeoutMs` (default 10 s) and stops on `signal`; a dead owner on this machine is taken over, a live, slow or foreign one never is; an ownerless lock only after `ownerlessGraceMs` |
|
|
19021
|
+
| `withExclusiveLock` / `ExclusiveLockOptions` / `ExclusiveLock` / `ExclusiveLockOwner` | function / _type_ | run work under an exclusive lock between processes — a file recording its owner (pid, host, machine identity, time and nullable kernel process identity); waits up to `timeoutMs` (default 10 s) and stops on `signal`; a dead owner on this machine is taken over, a live, slow or foreign one never is; an ownerless lock only after `ownerlessGraceMs` |
|
|
18643
19022
|
| `ExclusiveLockError` | class | `LOCK_TIMEOUT` naming the resource and its holder, or `LOCK_ABORTED` with the signal's reason |
|
|
18644
19023
|
|
|
18645
19024
|
---
|
|
@@ -19019,6 +19398,14 @@ For the rationale behind these APIs — why `Bun.serve` and not a framework, why
|
|
|
19019
19398
|
two context types, why thin wrappers — see the
|
|
19020
19399
|
[Architecture Decisions](../decisions/).
|
|
19021
19400
|
|
|
19401
|
+
### Watched handles in the query cache
|
|
19402
|
+
|
|
19403
|
+
`CacheBridgeConfig.watched` accepts `WatchCacheBinding` entries with `handle`,
|
|
19404
|
+
`queryKey` and optional `state(frame)` observer. Include the session in query keys.
|
|
19405
|
+
`CacheBridgeConfig.session` fences events and removes bound queries when that login
|
|
19406
|
+
ends. Watch loss marks a query stale without triggering an independent refetch;
|
|
19407
|
+
recovery belongs to the watched read.
|
|
19408
|
+
|
|
19022
19409
|
## `stitchkit/agent-runtime/sandbox`
|
|
19023
19410
|
|
|
19024
19411
|
Optional server-only namespace sandbox. Exports:
|
package/llms.txt
CHANGED
|
@@ -9,9 +9,9 @@ Build with stitchkit: define a contract once, then `implement` it and serve it (
|
|
|
9
9
|
Load the slice for each entrypoint your code imports — `import … from 'stitchkit/server'` → `llms/server.txt`; the root `stitchkit` import → `llms/stitchkit.txt`. A slice holds that entrypoint's API reference section and the guide pages whose home it is; every guide lives in exactly one slice, and a slice that needs another's guide names it under "Also read". Each file is at most 50.0 KB; a longer one continues in numbered parts, each naming the next at its top. Moving across versions: load `llms/upgrading.txt` and the range slices it lists between your version and the target. `llms-full.txt` inlines everything; it is far larger than a context window, so do not read it whole.
|
|
10
10
|
|
|
11
11
|
## Entrypoint slices
|
|
12
|
-
- **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 15.6 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt)
|
|
13
|
-
- **stitchkit/live**: [llms/live.txt](llms/live.txt) 21.
|
|
14
|
-
- **stitchkit/react**: [llms/react.txt](llms/react.txt)
|
|
12
|
+
- **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 15.6 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 37.2 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 15.7 KB
|
|
13
|
+
- **stitchkit/live**: [llms/live.txt](llms/live.txt) 21.6 KB
|
|
14
|
+
- **stitchkit/react**: [llms/react.txt](llms/react.txt) 9.0 KB
|
|
15
15
|
- **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 45.0 KB → [llms/tools.2.txt](llms/tools.2.txt) 26.3 KB → [llms/tools.3.txt](llms/tools.3.txt) 25.4 KB
|
|
16
16
|
- **stitchkit/tools/contract**: [llms/tools-contract.txt](llms/tools-contract.txt) 0.2 KB
|
|
17
17
|
- **stitchkit/tools/invoker**: [llms/tools-invoker.txt](llms/tools-invoker.txt) 0.2 KB
|
|
@@ -20,9 +20,9 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
20
20
|
- **stitchkit/remote**: [llms/remote.txt](llms/remote.txt) 1.0 KB
|
|
21
21
|
- **stitchkit/contract**: [llms/contract.txt](llms/contract.txt) 31.9 KB
|
|
22
22
|
- **stitchkit/primitives**: [llms/primitives.txt](llms/primitives.txt) 9.3 KB
|
|
23
|
-
- **stitchkit/server**: [llms/server.txt](llms/server.txt) 45.3 KB → [llms/server.2.txt](llms/server.2.txt) 14.6 KB → [llms/server.3.txt](llms/server.3.txt)
|
|
23
|
+
- **stitchkit/server**: [llms/server.txt](llms/server.txt) 45.3 KB → [llms/server.2.txt](llms/server.2.txt) 14.6 KB → [llms/server.3.txt](llms/server.3.txt) 44.3 KB → [llms/server.4.txt](llms/server.4.txt) 37.5 KB → [llms/server.5.txt](llms/server.5.txt) 21.8 KB
|
|
24
24
|
- **stitchkit/observability**: [llms/observability.txt](llms/observability.txt) 43.4 KB
|
|
25
|
-
- **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt) 36.4 KB → [llms/agent-runtime.2.txt](llms/agent-runtime.2.txt)
|
|
25
|
+
- **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt) 36.4 KB → [llms/agent-runtime.2.txt](llms/agent-runtime.2.txt) 46.1 KB → [llms/agent-runtime.3.txt](llms/agent-runtime.3.txt) 33.8 KB
|
|
26
26
|
- **stitchkit/agent-runtime/testing**: [llms/agent-runtime-testing.txt](llms/agent-runtime-testing.txt) 2.2 KB
|
|
27
27
|
- **stitchkit/agent-runtime/harness**: [llms/agent-runtime-harness.txt](llms/agent-runtime-harness.txt) 4.1 KB
|
|
28
28
|
- **stitchkit/agent-runtime/coding-tools**: [llms/agent-runtime-coding-tools.txt](llms/agent-runtime-coding-tools.txt) 4.9 KB
|
|
@@ -30,7 +30,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
30
30
|
- **stitchkit/agent-runtime/openrouter**: [llms/agent-runtime-openrouter.txt](llms/agent-runtime-openrouter.txt) 1.1 KB
|
|
31
31
|
- **stitchkit/agent-runtime/sqlite/bun**: [llms/agent-runtime-sqlite-bun.txt](llms/agent-runtime-sqlite-bun.txt) 1.8 KB
|
|
32
32
|
- **stitchkit/agent-runtime/sqlite/node**: [llms/agent-runtime-sqlite-node.txt](llms/agent-runtime-sqlite-node.txt) 1.7 KB
|
|
33
|
-
- **stitchkit/application**: [llms/application.txt](llms/application.txt)
|
|
33
|
+
- **stitchkit/application**: [llms/application.txt](llms/application.txt) 46.6 KB → [llms/application.2.txt](llms/application.2.txt) 37.2 KB
|
|
34
34
|
- **stitchkit/application/grammy**: [llms/application-grammy.txt](llms/application-grammy.txt) 2.3 KB
|
|
35
35
|
- **stitchkit/application/opentelemetry**: [llms/application-opentelemetry.txt](llms/application-opentelemetry.txt) 1.6 KB
|
|
36
36
|
- **stitchkit/application/directory-inbox**: [llms/application-directory-inbox.txt](llms/application-directory-inbox.txt) 0.3 KB
|
|
@@ -52,9 +52,10 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
52
52
|
|
|
53
53
|
## Upgrading slices
|
|
54
54
|
- **Upgrading — how to move across versions**: [llms/upgrading.txt](llms/upgrading.txt) 10.3 KB
|
|
55
|
-
- **Upgrading 0.
|
|
56
|
-
- **Upgrading 0.
|
|
57
|
-
- **Upgrading 0.
|
|
55
|
+
- **Upgrading 0.74.0 → 0.100.0**: [llms/upgrading-0.74.0-0.100.0.txt](llms/upgrading-0.74.0-0.100.0.txt) 44.3 KB
|
|
56
|
+
- **Upgrading 0.61.0 → 0.73.0**: [llms/upgrading-0.61.0-0.73.0.txt](llms/upgrading-0.61.0-0.73.0.txt) 41.2 KB
|
|
57
|
+
- **Upgrading 0.44.0 → 0.60.0**: [llms/upgrading-0.44.0-0.60.0.txt](llms/upgrading-0.44.0-0.60.0.txt) 43.9 KB
|
|
58
|
+
- **Upgrading 0.37.0 → 0.37.0**: [llms/upgrading-0.37.0.txt](llms/upgrading-0.37.0.txt) 6.2 KB
|
|
58
59
|
|
|
59
60
|
## Guide (web)
|
|
60
61
|
- [Getting started](https://github.com/max-listov/stitchkit/blob/master/docs/guide/getting-started.md): install, entrypoints, and a first contract → server → client app
|
package/native/darwin-arm64.node
CHANGED
|
Binary file
|
package/native/darwin-x64.node
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Owned mutations of one run, applied one at a time.
|
|
3
|
-
*
|
|
4
|
-
* Every owned mutation is a compare-and-set against the run's current revision,
|
|
5
|
-
* and the revision it must name is the one the previous mutation produced.
|
|
6
|
-
* Reading that revision and writing it back are therefore safe apart only while
|
|
7
|
-
* nothing else can write in between — which stops being true the moment a store
|
|
8
|
-
* returns a promise that yields. With an asynchronous store the assistant
|
|
9
|
-
* checkpoint and the model-request admission both name the revision they read
|
|
10
|
-
* before their own `await`, the later write is rejected as a conflict, and the
|
|
11
|
-
* run fails without the provider ever having been called.
|
|
12
|
-
*
|
|
13
|
-
* The terminal commit answers the same hazard with a bounded retry, which suits
|
|
14
|
-
* it: committing a terminal twice is a duplicate the store recognises. It does
|
|
15
|
-
* not suit these two — a retried operation write would publish a second
|
|
16
|
-
* lifecycle event for one provider call — so they take their turn instead.
|
|
17
|
-
*/
|
|
18
|
-
export type RunMutationQueue = <T>(mutation: () => Promise<T>) => Promise<T>;
|
|
19
|
-
/** A queue of owned mutations for one run. */
|
|
20
|
-
export declare function createRunMutationQueue(): RunMutationQueue;
|
|
21
|
-
//# sourceMappingURL=run-mutation-queue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-mutation-queue.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/run-mutation-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7E,8CAA8C;AAC9C,wBAAgB,sBAAsB,IAAI,gBAAgB,CAgBzD"}
|