stitchkit 0.134.0 → 0.134.2
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 +26 -0
- package/README.md +6 -6
- package/dist/agent-executor/claude/cli-driver.d.ts +6 -0
- package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -1
- package/dist/agent-executor/claude/session.d.ts +2 -0
- package/dist/agent-executor/claude/session.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/driver.d.ts +9 -1
- package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/engine-spawn.d.ts +18 -5
- package/dist/agent-executor/claude-sdk/engine-spawn.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/probe.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/query-manager.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/query-options.d.ts +16 -0
- package/dist/agent-executor/claude-sdk/query-options.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/session.d.ts +1 -0
- package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -1
- package/dist/agent-runtime/harness-contract.d.ts +5 -5
- package/dist/agent-runtime/harness-contract.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +13 -13
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-process-macos.d.ts +5 -4
- package/dist/agent-runtime/sandbox-process-macos.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-process-spec.d.ts +6 -0
- package/dist/agent-runtime/sandbox-process-spec.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-process-wrapper.d.ts +2 -1
- package/dist/agent-runtime/sandbox-process-wrapper.d.ts.map +1 -1
- package/dist/agent-runtime/sql-rows.d.ts +10 -10
- package/dist/agent-runtime/sqlite-schema.d.ts +2 -2
- package/dist/agent-runtime/sqlite.d.ts +1 -1
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts +20 -20
- package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
- package/dist/agent-runtime/terminal-commit.d.ts +10 -10
- package/dist/application/grammy.d.ts +1 -1
- package/dist/browser/contract-identity.d.ts +1 -1
- package/dist/browser/http-fetch.d.ts +1 -1
- package/dist/browser/socket-io-contract.d.ts +1 -1
- package/dist/contract/bridge-envelope.d.ts +1 -1
- package/dist/contract/client-types.d.ts +1 -1
- package/dist/contract/define.d.ts +2 -2
- package/dist/contract/errors-factory.d.ts +1 -1
- package/dist/contract/fingerprint.d.ts +1 -1
- package/dist/device-relay/hub.d.ts +1 -1
- package/dist/entrypoints/agent-executor/claude-sdk.js +323 -153
- package/dist/entrypoints/agent-executor/claude.js +40 -26
- package/dist/entrypoints/agent-runtime/postgres.js +3 -3
- package/dist/entrypoints/agent-runtime/sandbox.js +21 -16
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +1 -1
- package/dist/entrypoints/agent-runtime/sqlite/node.js +1 -1
- package/dist/entrypoints/bin/upgrade-cli.js +1 -1
- package/dist/entrypoints/files/packaging.js +2 -2
- package/dist/entrypoints/handler.js +2 -2
- package/dist/entrypoints/node.js +2 -2
- package/dist/entrypoints/server.js +2 -2
- package/dist/entrypoints/tools/mcp.js +3 -3
- package/dist/entrypoints/tools/toolkit.js +3 -3
- package/dist/entrypoints/tools.js +2 -2
- package/dist/files/native-packaging-layout.d.ts +1 -1
- package/dist/{index-654rhe5d.js → index-7mjsb7zv.js} +5 -1
- package/dist/{index-kdw0n92g.js → index-a09r9ff0.js} +1 -1
- package/dist/{index-epyj7ptp.js → index-a84wj6y8.js} +4 -4
- package/dist/{index-qymek778.js → index-m2b49tvc.js} +76 -22
- package/dist/{index-mrng24wq.js → index-zag9sjpd.js} +1 -1
- package/dist/internal/postgres-query.d.ts +1 -1
- package/dist/react/query-client.d.ts +1 -1
- package/dist/server/bridge-host.d.ts +1 -1
- package/dist/server/bun.d.ts +1 -1
- package/dist/server/endpoint-dispatch.d.ts.map +1 -1
- package/dist/server/middleware/cors.d.ts +3 -3
- package/dist/server/middleware/cors.d.ts.map +1 -1
- package/dist/server/socket-io-config.d.ts +1 -1
- package/dist/service-host/identity.d.ts +1 -1
- package/dist/service-host/systemd-inspect.d.ts +1 -1
- package/dist/testing/manual-clock.d.ts +1 -1
- package/dist/tools/connections/types.d.ts +1 -1
- package/dist/tools/mcp/handler.d.ts +1 -1
- package/dist/tools/mcp/lazy-discovery.d.ts +1 -1
- package/dist/tools/mcp/mount.d.ts +1 -1
- package/dist/tools/mcp/stdio.d.ts +1 -1
- package/llms/agent-executor-claude-sdk.txt +1 -1
- package/llms/agent-executor-claude.txt +1 -1
- package/llms/agent-runtime-browser.txt +1 -1
- package/llms/agent-runtime-sandbox.txt +12 -8
- package/llms/agent-runtime-sqlite-bun.txt +1 -1
- package/llms/agent-runtime.2.txt +1 -1
- package/llms/agent-runtime.3.txt +4 -4
- package/llms/agent-runtime.txt +3 -3
- package/llms/application.2.txt +4 -4
- package/llms/application.txt +4 -4
- package/llms/cli.2.txt +27 -6
- package/llms/cli.txt +2 -2
- package/llms/contract.txt +1 -1
- package/llms/files-packaging.txt +1 -1
- package/llms/geo.txt +1 -1
- package/llms/live.txt +1 -1
- package/llms/oauth.txt +4 -4
- package/llms/observability.txt +3 -3
- package/llms/primitives.txt +1 -1
- package/llms/process.2.txt +7 -7
- package/llms/react.txt +4 -4
- package/llms/server.2.txt +7 -7
- package/llms/server.3.txt +5 -5
- package/llms/server.4.txt +6 -6
- package/llms/server.txt +13 -5
- package/llms/stitchkit.2.txt +3 -3
- package/llms/stitchkit.3.txt +1 -1
- package/llms/stitchkit.txt +4 -4
- package/llms/telegram.txt +1 -1
- package/llms/testing.txt +4 -4
- package/llms/tools-connections.txt +1 -1
- package/llms/tools-toolkit.txt +3 -1
- package/llms/tools.2.txt +6 -6
- package/llms/tools.3.txt +8 -8
- package/llms/upgrading-0.106.0-0.126.0.txt +1 -1
- package/llms/upgrading-0.128.0-0.134.0.txt +7 -1
- package/llms/upgrading-0.37.0-0.53.0.txt +7 -7
- package/llms/upgrading-0.69.0-0.95.0.txt +1 -1
- package/llms/upgrading-0.96.0-0.105.0.txt +1 -1
- package/llms-full.txt +163 -122
- package/llms.txt +8 -8
- package/package.json +1 -1
|
@@ -67,10 +67,10 @@ export declare function deniedRequestCors(config: Pick<CorsConfig, 'methods' | '
|
|
|
67
67
|
* - `traceparent` / `tracestate` — W3C Trace Context, what
|
|
68
68
|
* `createHttpClient({ trace: true })` emits on every request; without it that
|
|
69
69
|
* feature dies on the cross-origin preflight.
|
|
70
|
-
* - `
|
|
71
|
-
* `createClient` / `createHttpClient
|
|
70
|
+
* - `x-stitchkit-timeout-ms` — relative remaining deadline budget propagated by
|
|
71
|
+
* `createClient` / `createHttpClient` (`DEADLINE_BUDGET_HEADER`).
|
|
72
72
|
*/
|
|
73
|
-
export declare const DEFAULT_CORS_ALLOW_HEADERS = "Content-Type, Authorization, X-Trace-Id, traceparent, tracestate,
|
|
73
|
+
export declare const DEFAULT_CORS_ALLOW_HEADERS = "Content-Type, Authorization, X-Trace-Id, traceparent, tracestate, x-stitchkit-timeout-ms";
|
|
74
74
|
/**
|
|
75
75
|
* The default `Access-Control-Expose-Headers`. Without it a cross-origin
|
|
76
76
|
* `fetch` can read only the CORS-safelisted response headers, so a browser
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cors.d.ts","sourceRoot":"","sources":["../../../src/server/middleware/cors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cors.d.ts","sourceRoot":"","sources":["../../../src/server/middleware/cors.ts"],"names":[],"mappings":"AAGA,sFAAsF;AACtF,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,CAAC;AAElE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,UAAU,EAAE,SAAS,GAAG,SAAS,GAAG,eAAe,CAAC;IACjE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC7E,4EAA4E;IAC5E,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,eAAe,GAAG,SAAS,GAAG,SAAS,CAAC;CAClE;AAqBD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,GAAG,gBAAgB,EACrC,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAcpC;AAqBD,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,GAAG,SAAS,GAAG,eAAe,CAAC,GAChE,WAAW,CAKb;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,0BAA0B,6FAAgG,CAAC;AAExI;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,2BAA2B,qHAC4E,CAAC;AAErH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,gBAAgB,GAAG,IAAI,CA4B5E;AAwBD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACvC,OAAO,CAMT;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,UAAU,EAClB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAC5B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYxB;AA6BD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,GAAG,QAAQ,CAKhF;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,CAehF"}
|
|
@@ -4,7 +4,7 @@ import type { z } from 'zod';
|
|
|
4
4
|
/**
|
|
5
5
|
* How this project loads its optional Socket.IO peers.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* StitchKit resolves them through a variable rather than a literal
|
|
8
8
|
* `import('socket.io')`, deliberately: a consumer bundling an unrelated
|
|
9
9
|
* `stitchkit/server` export must not have to resolve peers it never uses, and
|
|
10
10
|
* `@socket.io/bun-engine` is Bun-only, so a top-level value import would break
|
|
@@ -98,7 +98,7 @@ export type SupervisedProcessVerification = {
|
|
|
98
98
|
};
|
|
99
99
|
/**
|
|
100
100
|
* Create the default process-identity adapter backed by Linux `/proc` and
|
|
101
|
-
*
|
|
101
|
+
* StitchKit's `observeProcessInstance` / `probeProcessOwner`. A `socketPath` check needs
|
|
102
102
|
* iproute2 `ss` at `/usr/bin/ss` or `/usr/sbin/ss`; it never looks `ss` up on `PATH`.
|
|
103
103
|
*/
|
|
104
104
|
export declare function createDefaultProcessIdentityAdapter(procRoot?: string): ProcessIdentityAdapter;
|
|
@@ -60,7 +60,7 @@ export interface CheckSystemdUnitOptions {
|
|
|
60
60
|
* - `digest-mismatch`: the file at `unitPath` has other bytes;
|
|
61
61
|
* - `fragment-mismatch`: systemd answers for the name from somewhere other than `unitPath` — a
|
|
62
62
|
* vendor, transient or generated unit, a mask, a loaded unit with no file — or has not loaded it;
|
|
63
|
-
* - `foreign-drop-in`: a drop-in
|
|
63
|
+
* - `foreign-drop-in`: a drop-in StitchKit does not trust changes the unit.
|
|
64
64
|
*/
|
|
65
65
|
export type SystemdUnitCheckStatus = 'matches' | 'missing' | 'digest-mismatch' | 'fragment-mismatch' | 'foreign-drop-in';
|
|
66
66
|
/** Structured inspection report produced by {@link checkSystemdUnit}. */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Time stands still until the test moves it, and due timers fire strictly in deadline order
|
|
5
5
|
* (ties in scheduling order), so "retry after 5 s" runs in milliseconds and the same way every
|
|
6
|
-
* time. It satisfies every timer boundary
|
|
6
|
+
* time. It satisfies every timer boundary StitchKit accepts: `ManagedScheduleClock`,
|
|
7
7
|
* `DurabilityClock`, `RevisionSignalClock` and `BoundedAdmissionClock`.
|
|
8
8
|
*
|
|
9
9
|
* Between firings the clock yields to the **real event loop** (`setImmediate` turns), not just to
|
|
@@ -69,7 +69,7 @@ export interface McpClientConnectionConfig {
|
|
|
69
69
|
limits?: McpConnectionLimits;
|
|
70
70
|
/**
|
|
71
71
|
* Where the discovered catalog is kept between processes. When the server stamps its
|
|
72
|
-
* catalog (a
|
|
72
|
+
* catalog (a StitchKit server does), a stored catalog with the live stamp is mounted without
|
|
73
73
|
* asking for `tools/list`; any other answer lists and stores again.
|
|
74
74
|
*/
|
|
75
75
|
catalog?: McpConnectionCatalogStore;
|
|
@@ -45,7 +45,7 @@ export interface McpHttpHandler {
|
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Build a stateless MCP HTTP handler on the official SDK v2 request factory.
|
|
48
|
-
* Every request gets a fresh SDK server and a fresh
|
|
48
|
+
* Every request gets a fresh SDK server and a fresh StitchKit tool context;
|
|
49
49
|
* no protocol session, event store or `Mcp-Session-Id` exists in this layer.
|
|
50
50
|
*/
|
|
51
51
|
export declare function createMcpHandler<TAuth, const TSurfaces extends McpSurfaceRegistry = McpSurfaceRegistry>(config: McpHandlerConfig<TAuth, TSurfaces>): McpHttpHandler;
|
|
@@ -30,7 +30,7 @@ export interface ManagedLazyMcpTool {
|
|
|
30
30
|
export declare function validateMcpLazyDiscovery(rawConfig: unknown, contractToolNames: readonly string[], reservedToolNames?: readonly string[]): ValidatedMcpLazyDiscovery;
|
|
31
31
|
/**
|
|
32
32
|
* Hide non-initial contract tools on this `McpServer` session and register the built-in discovery
|
|
33
|
-
* tool through
|
|
33
|
+
* tool through StitchKit's standard runtime-tool pipeline (`access`, `hooks`, `catalog` stamp).
|
|
34
34
|
*/
|
|
35
35
|
export declare function applyMcpLazyDiscovery(input: {
|
|
36
36
|
readonly server: McpServer;
|
|
@@ -181,7 +181,7 @@ export declare function buildMcpServer(config: McpServerBuildConfig<undefined>):
|
|
|
181
181
|
export declare function buildMcpServer<TAuth>(config: McpServerBuildConfig<TAuth>, auth: TAuth): McpServer;
|
|
182
182
|
/**
|
|
183
183
|
* The stamp of everything a built server advertises in `tools/list`, or `undefined` when part
|
|
184
|
-
* of it is unknown to
|
|
184
|
+
* of it is unknown to StitchKit (`rawTools`).
|
|
185
185
|
*/
|
|
186
186
|
export declare function servedMcpCatalog(server: McpServer): McpCatalogStamp | undefined;
|
|
187
187
|
/** Build one fresh server from a deterministic surface prepared by its owner. */
|
|
@@ -21,7 +21,7 @@ export interface McpStdioHandle {
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Serve one dual-era MCP connection over process stdio. The official SDK owns
|
|
24
|
-
* opening-era negotiation and transport shutdown;
|
|
24
|
+
* opening-era negotiation and transport shutdown; StitchKit owns the surface.
|
|
25
25
|
*/
|
|
26
26
|
export declare function createStdioMcpServer<TAuth>(config: StdioMcpServerConfig<TAuth>): Promise<McpStdioHandle>;
|
|
27
27
|
//# sourceMappingURL=stdio.d.ts.map
|
|
@@ -26,7 +26,7 @@ profile's transcript. Evolving.
|
|
|
26
26
|
|
|
27
27
|
| Export | Kind | Purpose |
|
|
28
28
|
|--------|------|---------|
|
|
29
|
-
| `createClaudeSdkDriver` / `ClaudeSdkDriver` / `ClaudeSdkDriverConfig` | function / _types_ | the driver: `query` and `sdkVersion` required; optional `forkSession`, `model`, `permissionMode` (default `default`), `allowDangerouslySkipPermissions`, `pathToClaudeCodeExecutable`, `systemPrompt`, `settingSources`, `enableFileCheckpointing`, `supportedDialogKinds` / `onUserDialog`, `hooks`, `tools`, `allowedTools`, `disallowedTools`, `mcpServers`, `mcpServersDelivery`, `strictMcpConfig`, `plugins`, `agents`, `extraArgs`, `stderr`, `spawnClaudeCodeProcess`, `onProviderPid`, `onQueryExit`, `onElicitation`, `onPermissionRequest`, `onEvent`, `onTurnUsage`, `verifyDelegation`, `resolveFile`, `maxImageBytes` (default 5 MiB), `ambient`, and `onObserverError`. `onObserverError(error, hook)` receives every failure of a host callback the driver contained, with the name of the option that failed; without it such a failure is contained and dropped. Exposes `probeCapabilities(input)` for isolated never-yielding capability probes, `status` over passive `rate_limit_event` or active `readUsage()`, and `forkSession(sessionId, options?)` |
|
|
29
|
+
| `createClaudeSdkDriver` / `ClaudeSdkDriver` / `ClaudeSdkDriverConfig` | function / _types_ | the driver: `query` and `sdkVersion` required; optional `forkSession`, `model`, `permissionMode` (default `default`), `allowDangerouslySkipPermissions`, `pathToClaudeCodeExecutable`, `systemPrompt`, `settingSources`, `enableFileCheckpointing`, `supportedDialogKinds` / `onUserDialog`, `hooks`, `tools`, `allowedTools`, `disallowedTools`, `mcpServers`, `mcpServersDelivery`, `strictMcpConfig`, `plugins`, `agents`, `extraArgs`, `stderr`, `spawnClaudeCodeProcess`, `wrapCommand` (command wrapper invoked inside `spawnOwnedClaudeCode` before spawning Claude Code — compatible with `createProcessSandbox(...).wrapCommand`, preserving `providerPid`, `ownerLoss: 'terminate'`, `session.close()` wait, eager fail-closed `open()`, and `probeCapabilities()`, mutually exclusive with `spawnClaudeCodeProcess`), `onProviderPid`, `onQueryExit`, `onElicitation`, `onPermissionRequest`, `onEvent`, `onTurnUsage`, `verifyDelegation`, `resolveFile`, `maxImageBytes` (default 5 MiB), `ambient`, and `onObserverError`. `onObserverError(error, hook)` receives every failure of a host callback the driver contained, with the name of the option that failed; without it such a failure is contained and dropped. Exposes `probeCapabilities(input)` for isolated never-yielding capability probes, `status` over passive `rate_limit_event` or active `readUsage()`, and `forkSession(sessionId, options?)` |
|
|
30
30
|
| `ClaudeSdkSession` / `ClaudeSdkOpenInput` / `ClaudeSdkUsageRead` / `ClaudeSdkQueryExitContext` / `ClaudeSdkPermissionRequestMeta` / `ClaudeSdkFlagSettings` | _types_ | extended session returned by `open(ClaudeSdkOpenInput)` (supporting `resumeSessionAt`, `resumeDropsTurn`, and `onStartupPhase`): exposes `providerPid`, `readUsage(opts?)`, `setModel`, `setPermissionMode` (returning `SDKControlSetPermissionModeResponse \| undefined`), `applyFlagSettings(ClaudeSdkFlagSettings)`, `initializationResult`, `supportedModels`, `supportedCommands`, `accountInfo`, `getContextUsage`, `mcpServerStatus`, `toggleMcpServer`, `reconnectMcpServer`, `setMcpServers`, `stopTask`, `backgroundTasks`, and `rewindFiles`; supports `approve` with `updatedInput` for `AskUserQuestion` and emits `ClaudeSdkPermissionRequestMeta` (`input: Readonly<Record<string, JsonRpcValue>>`) to `onPermissionRequest` |
|
|
31
31
|
| `ClaudeRuntimeEventSchema` / `ClaudeRuntimeEvent` / `ClaudeTaskUsageSchema` / `ClaudeTaskUsage` / `ClaudeSdkTurnUsageSchema` / `ClaudeSdkTurnUsage` / `ClaudeSdkTokenPairSchema` / `ClaudeSdkTokenPair` | schemas / _types_ | structured runtime events delivered to `onEvent` during and after turns (`task_started`, `task_updated`, `task_progress`, `task_notification`, `background_tasks_changed`, `tool_progress`, `api_retry`, `elicitation_complete`) alongside `compact_boundary` → `window { reset: 'context' }`, plus per-turn additive `modelUsage` deltas and `otherUsage` delivered to `onTurnUsage` |
|
|
32
32
|
| `ClaudeSdkProbeCapabilitiesInput` / `ClaudeSdkCapabilitiesProbe` | _types_ | input and result shapes for `driver.probeCapabilities(input)`: runs an isolated never-yielding SDK query to inspect models, commands, account info, and optional usage, always closing the query in `finally` |
|
|
@@ -21,7 +21,7 @@ Evolving.
|
|
|
21
21
|
|
|
22
22
|
| Export | Kind | Purpose |
|
|
23
23
|
|--------|------|---------|
|
|
24
|
-
| `createClaudeCliDriver` / `ClaudeCliDriverConfig` | function / _type_ | the driver; `permissionMode` defaults to `default`, so the server decides every tool the profile does not already allow; optional `resolveFile` and `maxImageBytes` (default 5 MiB) enable ordered turn-input image attachments; `onObserverError(error, hook)` receives every failure of a host callback the driver contained, with the name of the option that failed; without it such a failure is contained and dropped. |
|
|
24
|
+
| `createClaudeCliDriver` / `ClaudeCliDriverConfig` | function / _type_ | the driver; `permissionMode` defaults to `default`, so the server decides every tool the profile does not already allow; optional `wrapCommand` (command wrapper invoked before spawn, e.g. `createProcessSandbox(...).wrapCommand`, for sessions and `info()`/`status()` probes), `resolveFile` and `maxImageBytes` (default 5 MiB) enable ordered turn-input image attachments; `onObserverError(error, hook)` receives every failure of a host callback the driver contained, with the name of the option that failed; without it such a failure is contained and dropped. |
|
|
25
25
|
| `claudeFakeScenarios` | constant | the conformance scenarios in this dialect, for a scripted engine |
|
|
26
26
|
| `claudeTranscriptPath` / `claudeTranscriptHasUuid` / `findTranscriptInput` | functions | offline Claude transcript path resolution (resolving `realpath` of `cwd` or its nearest existing ancestor) and bounded streaming UUID lookup / reconciliation without instantiating a driver |
|
|
27
27
|
| `claudePlanWindows` / `claudeUsagePlanLimits` | functions | Claude's `rate_limit_event` windows and open-bucket usage / `/api/oauth/usage` `PlanLimits` mapping preserving `plan` and the reported model name as `scope` and `label` on model-scoped windows |
|
|
@@ -57,7 +57,7 @@ protocol but exclude runtime `context`. Submit permits only strict text/file par
|
|
|
57
57
|
file ownership and metadata policy are checked by server authorization. The shared
|
|
58
58
|
`agentControlRealtimeContract` owns `agent:control` acknowledgements and `agent:delivery`.
|
|
59
59
|
|
|
60
|
-
`createAgentController` / `AgentControllerConfig` take an existing
|
|
60
|
+
`createAgentController` / `AgentControllerConfig` take an existing StitchKit
|
|
61
61
|
realtime `transport`, `conversationId`, `access` (`observe` or `control`), optional
|
|
62
62
|
`timeoutMs` (10000), `maxBufferedEvents` (256), `maxBufferedBytes` (1048576) and
|
|
63
63
|
`maxPendingRequests` (32). All bounds are positive safe integers. One controller owns one
|
|
@@ -144,10 +144,11 @@ be refused explicitly by the backend.
|
|
|
144
144
|
|
|
145
145
|
## Long-lived process sandbox (`createProcessSandbox`)
|
|
146
146
|
|
|
147
|
-
When isolating a long-lived streaming stdio or IPC engine process (
|
|
148
|
-
that must keep its real host workspace path and streaming pipes, use
|
|
149
|
-
`probeProcessSandbox`. Its `wrapCommand` method matches
|
|
150
|
-
`CodexDriverConfig.wrapCommand`
|
|
147
|
+
When isolating a long-lived streaming stdio or IPC engine process (Codex, ACP, Claude SDK, or
|
|
148
|
+
Claude CLI) that must keep its real host workspace path and streaming pipes, use
|
|
149
|
+
`createProcessSandbox` and `probeProcessSandbox`. Its `wrapCommand` method matches
|
|
150
|
+
`AcpDriverConfig.wrapCommand`, `CodexDriverConfig.wrapCommand`, `ClaudeSdkDriverConfig.wrapCommand`,
|
|
151
|
+
and `ClaudeCliDriverConfig.wrapCommand` structurally:
|
|
151
152
|
|
|
152
153
|
```ts
|
|
153
154
|
import { createProcessSandbox, probeProcessSandbox } from 'stitchkit/agent-runtime/sandbox';
|
|
@@ -188,9 +189,12 @@ const driver = createCodexDriver({ wrapCommand: sandbox.wrapCommand });
|
|
|
188
189
|
(`workspace-strict`), `homeDir`, `writableDirs`, and explicitly allowed `unixSockets` (with
|
|
189
190
|
`workspace` denied for writes in `workspace-readonly`, and explicit socket allows ordered after
|
|
190
191
|
that deny and before `denyPaths`). Reads remain permitted by default for macOS frameworks and
|
|
191
|
-
binaries except paths listed in `denyPaths`,
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
binaries except paths listed in `denyPaths`, where Seatbelt denies `file-read*`, `file-write*`,
|
|
193
|
+
`network-outbound` (`remote unix-socket`), and `network-bind`/`network-inbound` (`local
|
|
194
|
+
unix-socket`) across both lexical and symlink-resolved ancestor paths — even when `network` is
|
|
195
|
+
`'allow'` — so callers on macOS must explicitly add control sockets, sibling workspaces, and
|
|
196
|
+
host secrets to `denyPaths`. Seatbelt cannot remap Unix socket paths: supplying `mountPath !==
|
|
197
|
+
hostPath` fails closed with `SANDBOX_UNAVAILABLE`.
|
|
194
198
|
|
|
195
199
|
==============================================================================
|
|
196
200
|
# API reference: `stitchkit/agent-runtime/sandbox` (docs/api/reference.md)
|
|
@@ -208,7 +212,7 @@ host-only `SandboxCodingBinding`, with shared authorization, command collection
|
|
|
208
212
|
Its types are `AgentSandboxGrade`, `AgentSandboxRestriction`, `BubblewrapSandboxConfig`, `SandboxBackend`, `SandboxCommand`,
|
|
209
213
|
`SandboxCreateInput`, `SandboxDriver`, `SandboxHandle`, `SandboxNetworkPolicy`,
|
|
210
214
|
`SandboxPrewarmInput`, `SandboxProcess`, `SandboxRunOptions`, `SandboxSession`,
|
|
211
|
-
and `SandboxState`. `createProcessSandbox`, `probeProcessSandbox`, and `buildSeatbeltProfile` provide a reusable fail-closed OS process sandbox wrapper for long-lived streaming stdio/IPC processes (`workspace-strict` and `workspace-readonly` profiles with real workspace paths, explicit `writableDirs`, `readOnlyPaths`, `denyPaths`, `unixSockets`, `network` policy, `envAllowlist`, `homeDir`, Linux `bwrap` and macOS Seatbelt `sandbox-exec`, throwing `SandboxError('SANDBOX_UNAVAILABLE', ...)` rather than falling back silently; its `wrapCommand` fits `AcpDriverConfig.wrapCommand` and `
|
|
215
|
+
and `SandboxState`. `createProcessSandbox`, `probeProcessSandbox`, and `buildSeatbeltProfile` provide a reusable fail-closed OS process sandbox wrapper for long-lived streaming stdio/IPC processes (`workspace-strict` and `workspace-readonly` profiles with real workspace paths, explicit `writableDirs`, `readOnlyPaths`, `denyPaths`, `unixSockets`, `network` policy, `envAllowlist`, `homeDir`, Linux `bwrap` and macOS Seatbelt `sandbox-exec`, throwing `SandboxError('SANDBOX_UNAVAILABLE', ...)` rather than falling back silently; its `wrapCommand` fits `AcpDriverConfig.wrapCommand`, `CodexDriverConfig.wrapCommand`, `ClaudeSdkDriverConfig.wrapCommand`, and `ClaudeCliDriverConfig.wrapCommand`). Its schemas and types are `ProcessSandboxSpecSchema`, `ProcessSandboxSpec`, `ProcessSandboxProfileSchema`, `ProcessSandboxProfile`, `ProcessSandboxNetworkSchema`, `ProcessSandboxNetwork`, `ProcessSandboxBackendKindSchema`, `ProcessSandboxBackendKind`, `ProcessSandboxUnixSocketSchema`, `ProcessSandboxUnixSocket`, `ProcessSandboxProbeResultSchema`, `ProcessSandboxProbeResult`, `ProcessSandboxProbeOptions`, `ProcessSandboxCommandSpec`, and `ProcessSandbox`.
|
|
212
216
|
|
|
213
217
|
The [sandbox guide](../guide/sandbox.md) specifies lifecycle,
|
|
214
218
|
network enforcement, gateway credentials and platform/resource boundaries.
|
|
@@ -22,7 +22,7 @@ loaded by the neutral, browser or Node runtime surfaces.
|
|
|
22
22
|
| `createBunSqliteAgentRuntimeStore` | function | open an owned Bun SQLite connection, initialize/validate the schema, migrate older versions transactionally and return `{ store, conversations, host, close }` |
|
|
23
23
|
| `BunSqliteAgentRuntimeStoreConfig` | _type_ | database filename plus optional create and initialization policies |
|
|
24
24
|
| `createSqliteAgentRuntimeStore` | function | build the normalized store over an injected synchronous SQLite boundary |
|
|
25
|
-
| `initializeAgentRuntimeSqlite` | function | initialize or validate only
|
|
25
|
+
| `initializeAgentRuntimeSqlite` | function | initialize or validate only StitchKit's namespaced SQLite schema |
|
|
26
26
|
| `SqliteDatabase` / `SqliteStatement` / `SqliteValue` | _type_ | minimal runtime-neutral synchronous SQLite boundary |
|
|
27
27
|
| `SqliteAgentRuntimeStore` / `SqliteAgentRuntimeStoreConfig` | _type_ | durable store handle — `store`, `conversations`, `host`, `close` — owned connection lifecycle, initialization policy, and the companion host every companion takes |
|
|
28
28
|
|
package/llms/agent-runtime.2.txt
CHANGED
|
@@ -41,7 +41,7 @@ const sqlite = createNodeSqliteAgentRuntimeStore({ filename: './agent-runtime.sq
|
|
|
41
41
|
Initialization creates only `stitchkit_agent_runtime_*` tables and records
|
|
42
42
|
schema version 2 in `stitchkit_agent_runtime_meta`; it does not use
|
|
43
43
|
`PRAGMA user_version` or mutate application tables. An unknown schema version or
|
|
44
|
-
unversioned partial
|
|
44
|
+
unversioned partial StitchKit schema is refused. The connection is owned by the
|
|
45
45
|
returned handle and closes only after accepted operations drain.
|
|
46
46
|
|
|
47
47
|
Each handle serializes its transactions. Separate connections use
|
package/llms/agent-runtime.3.txt
CHANGED
|
@@ -45,7 +45,7 @@ what it produced"**:
|
|
|
45
45
|
surface that sends nothing until the run is done never showed it at all. When
|
|
46
46
|
it reached nobody, it is not part of the conversation. That is `supersede`.
|
|
47
47
|
|
|
48
|
-
**
|
|
48
|
+
**StitchKit cannot answer that question for you** — delivery belongs to the
|
|
49
49
|
transport, and the runtime sees an abort, not a screen. Hence a declared policy
|
|
50
50
|
(→ ADR 0108), and hence `inputPolicy` accepting a function, so one application
|
|
51
51
|
can hold two surfaces with different rules without the core learning which is
|
|
@@ -173,7 +173,7 @@ while the predecessor still owns managed callbacks. A hung predecessor blocks
|
|
|
173
173
|
the lane in the first version.
|
|
174
174
|
|
|
175
175
|
Shutdown is two-phase, and both budgets carry the names they carry everywhere
|
|
176
|
-
else in
|
|
176
|
+
else in StitchKit:
|
|
177
177
|
|
|
178
178
|
```ts
|
|
179
179
|
const closed = await runtime.close({ gracePeriodMs: 30_000, forceTimeoutMs: 5_000 })
|
|
@@ -535,7 +535,7 @@ The agent `terminal` event and the adapter's delivery receipt are intentionally
|
|
|
535
535
|
different records. A successful run does not prove that a reply reached its
|
|
536
536
|
channel, and a delivery failure never rewrites the canonical agent result.
|
|
537
537
|
Shutdown stops ingress, drains accepted process-local work and leaves ambiguous
|
|
538
|
-
outbox records visible for a later reconciliation pass.
|
|
538
|
+
outbox records visible for a later reconciliation pass. StitchKit does not own
|
|
539
539
|
a channel database, durable broker, provider payload schema or application
|
|
540
540
|
identity policy.
|
|
541
541
|
|
|
@@ -574,7 +574,7 @@ prepareStep: (step) => {
|
|
|
574
574
|
```
|
|
575
575
|
|
|
576
576
|
That deliberate refusal ends the run as `context_overflow` on the durable
|
|
577
|
-
record, delivery terminal and operator event.
|
|
577
|
+
record, delivery terminal and operator event. StitchKit does not inspect error
|
|
578
578
|
messages — it recognises failures by identity, not by text. A store refusing an
|
|
579
579
|
owned mutation ends the run `storage_conflict`; `protocol.acceptTerminal`
|
|
580
580
|
refusing a finished message ends it `output_rejected`; a check the SDK runs on
|
package/llms/agent-runtime.txt
CHANGED
|
@@ -24,7 +24,7 @@ Parts of this slice:
|
|
|
24
24
|
> from `stitchkit/tools/agent` for an AI SDK loop) is the direct path.
|
|
25
25
|
|
|
26
26
|
`stitchkit/agent-runtime` is the peer-free, server-only, opinionated layer above
|
|
27
|
-
`mountAgentTools`. Use it when the application wants
|
|
27
|
+
`mountAgentTools`. Use it when the application wants StitchKit to own conversation
|
|
28
28
|
mechanics: durable acceptance, history projection, the native `AgentModelDriver`
|
|
29
29
|
step loop, checkpoints, keyed interruption, terminal commit and stable application
|
|
30
30
|
events.
|
|
@@ -472,7 +472,7 @@ is a reference structured control loop for `submit`, `interrupt`, `snapshot` and
|
|
|
472
472
|
It starts no process and chooses no framing, authentication or transport. Importing either example
|
|
473
473
|
has no side effect; an external supervisor owns process placement and restart.
|
|
474
474
|
|
|
475
|
-
| Concern | Public
|
|
475
|
+
| Concern | Public StitchKit composition | Boundary |
|
|
476
476
|
| --- | --- | --- |
|
|
477
477
|
| execution loop | `createAgentRuntime` | already available; do not copy a second loop |
|
|
478
478
|
| model choice | `defineModelRegistry` and `models.resolve` | provider credentials/discovery stay application-owned |
|
|
@@ -760,7 +760,7 @@ fit. Exact equality (including a zero window with zero reservations/history)
|
|
|
760
760
|
fits; any unavailable component keeps the decision `unavailable`.
|
|
761
761
|
|
|
762
762
|
The same opaque `tx` reaches head, run, admission and history callbacks. The adapter maps rows
|
|
763
|
-
and supplies atomicity;
|
|
763
|
+
and supplies atomicity; StitchKit owns transition validation and revision
|
|
764
764
|
arithmetic. The executable reference is
|
|
765
765
|
[`examples/agent-store-prisma/adapter.ts`](../../examples/agent-store-prisma/adapter.ts).
|
|
766
766
|
`compareAndSwap` returns either `{ outcome: 'applied' }` or
|
package/llms/application.2.txt
CHANGED
|
@@ -296,7 +296,7 @@ only through `stitchkit/application` exports.
|
|
|
296
296
|
## Database connection
|
|
297
297
|
|
|
298
298
|
Wrap connection allocation and readiness in `start`, and make `close` safe after
|
|
299
|
-
partial setup.
|
|
299
|
+
partial setup. StitchKit invokes cleanup for every attempted start, including a
|
|
300
300
|
start that allocates a client and then rejects.
|
|
301
301
|
|
|
302
302
|
```ts
|
|
@@ -319,7 +319,7 @@ allocation and proves one rollback close.
|
|
|
319
319
|
|
|
320
320
|
An application-owned client is an ordinary managed resource. Keep SDK creation,
|
|
321
321
|
credentials, authorization and reconnect policy in the application; no Telegram
|
|
322
|
-
client SDK is required by
|
|
322
|
+
client SDK is required by StitchKit. Create a fresh client inside each `start`,
|
|
323
323
|
publish it after connection/readiness succeeds, and share one memoized destroy
|
|
324
324
|
promise between partial-start cleanup, `close` and `force`:
|
|
325
325
|
|
|
@@ -485,7 +485,7 @@ async function handleDelivery(delivery: Delivery) {
|
|
|
485
485
|
}
|
|
486
486
|
```
|
|
487
487
|
|
|
488
|
-
|
|
488
|
+
StitchKit owns only process-local admission accounting and drain. Durable claims,
|
|
489
489
|
visibility timeouts, deduplication, idempotency and retry classification remain
|
|
490
490
|
in the queue/product layer.
|
|
491
491
|
|
|
@@ -514,7 +514,7 @@ await publisher.close()
|
|
|
514
514
|
```
|
|
515
515
|
|
|
516
516
|
The monitoring backend, transport retry and cross-process aggregation remain
|
|
517
|
-
outside
|
|
517
|
+
outside StitchKit. The executable recipe blocks revision 0, coalesces
|
|
518
518
|
intermediate revisions, explicitly admits the final absolute snapshot after
|
|
519
519
|
unsubscribe and proves that `close()` flushes revision 3. Do not rely on an
|
|
520
520
|
asynchronous subscriber callback racing cleanup: publish `getSnapshot()` before
|
package/llms/application.txt
CHANGED
|
@@ -104,7 +104,7 @@ no cost to binding first.
|
|
|
104
104
|
|
|
105
105
|
The exact resource callbacks are typed by their public configuration. The
|
|
106
106
|
important ownership rule is stable: the application decides what the
|
|
107
|
-
database/server/provider objects are and how they are configured;
|
|
107
|
+
database/server/provider objects are and how they are configured; StitchKit
|
|
108
108
|
orders their process-local lifecycle and decides *when* they come into
|
|
109
109
|
existence.
|
|
110
110
|
|
|
@@ -117,9 +117,9 @@ dependency.
|
|
|
117
117
|
|
|
118
118
|
Start and readiness are different. A connection can finish setup and return a
|
|
119
119
|
ready handle. A poller can return a handle immediately, settle `ready` later,
|
|
120
|
-
and keep a long-lived `completion` promise.
|
|
120
|
+
and keep a long-lived `completion` promise. StitchKit observes both.
|
|
121
121
|
|
|
122
|
-
Once
|
|
122
|
+
Once StitchKit invokes start/activation, cleanup is guaranteed to be attempted.
|
|
123
123
|
Write `close` so it is safe when setup was partial:
|
|
124
124
|
|
|
125
125
|
```ts
|
|
@@ -267,7 +267,7 @@ failure, and the startup error stays the `cause` of the `AggregateError` that
|
|
|
267
267
|
failed startup from ever reporting why it failed.
|
|
268
268
|
|
|
269
269
|
A required long-lived completion that rejects after startup makes readiness
|
|
270
|
-
false and health unhealthy.
|
|
270
|
+
false and health unhealthy. StitchKit records the failure but does not restart
|
|
271
271
|
the resource or process.
|
|
272
272
|
|
|
273
273
|
`ApplicationResourceShutdown.failures` names the phase that failed — `start`,
|
package/llms/cli.2.txt
CHANGED
|
@@ -106,7 +106,7 @@ on stdout. A native `defineCliCommand` declares none of those facts, so a failed
|
|
|
106
106
|
|
|
107
107
|
A CLI that mounts a server's tools through `defineMcpClientConnection` never sees the
|
|
108
108
|
method or contract `effect` — every MCP call is a `POST` — so it reads the `readOnlyHint`
|
|
109
|
-
the server publishes. A
|
|
109
|
+
the server publishes. A StitchKit server publishes it for every repeatable read by the
|
|
110
110
|
rule above ([MCP → `readOnlyHint`](./mcp-and-agents.md#saying-which-tools-only-read--readonlyhint)),
|
|
111
111
|
so the same command behaves the same over the contract and over MCP. The hint is the
|
|
112
112
|
server's word: a server that labels a write as read-only makes the CLI withhold that
|
|
@@ -720,7 +720,7 @@ counts raw UTF-8 body bytes, including SSE framing, regardless of `Content-Lengt
|
|
|
720
720
|
Pending legacy calls also count comments and wrong-id frames. `budget.maxTools`
|
|
721
721
|
and `budget.maxSchemaBytes` remain separate mount limits.
|
|
722
722
|
|
|
723
|
-
**A stored catalog is mounted while it is current.** A
|
|
723
|
+
**A stored catalog is mounted while it is current.** A StitchKit server sends its
|
|
724
724
|
[catalog stamp](./mcp-and-agents.md#knowing-your-catalog-is-stale--the-catalog-stamp) with
|
|
725
725
|
the `initialize` answer, as the `stitchkit-catalog` response header. Given a `catalog:
|
|
726
726
|
{ load, store }`, the connection compares it with the stamp of the stored `tools/list`
|
|
@@ -731,7 +731,7 @@ stores again. A listing is stored only when every tool in it carries the stamp t
|
|
|
731
731
|
`initialize` answer announced, so a rolling deploy answering the two requests from
|
|
732
732
|
different builds stores nothing. A server without a stamp, a surface with raw SDK tools
|
|
733
733
|
and a failing `load` or `store` all cost one `tools/list`, never the mount. The stamp
|
|
734
|
-
covers what `tools/list` publishes as
|
|
734
|
+
covers what `tools/list` publishes as StitchKit builds it; the JSON Schema text the
|
|
735
735
|
server's MCP SDK renders from the same schema is not hashed separately.
|
|
736
736
|
|
|
737
737
|
Only the initial `initialize` can negotiate HTTP-to-legacy fallback on 400, 404
|
|
@@ -867,11 +867,32 @@ A native-only CLI (only `commands`, no `services` or `runtimeTools`) takes no
|
|
|
867
867
|
|
|
868
868
|
## Typed context
|
|
869
869
|
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
870
|
+
For a peer-free CLI, import `createCli` directly from `stitchkit/cli` and
|
|
871
|
+
annotate the `context` factory's return type against your app's context shape
|
|
872
|
+
— no optional peers are loaded:
|
|
873
873
|
|
|
874
874
|
```ts
|
|
875
|
+
import { createCli } from 'stitchkit/cli'
|
|
876
|
+
|
|
877
|
+
await createCli({
|
|
878
|
+
name: 'myapp',
|
|
879
|
+
version: '1.0.0',
|
|
880
|
+
services,
|
|
881
|
+
access: { gate: { beforeHandle: authHook } },
|
|
882
|
+
context: (identity): { user: User | undefined } => ({ user: identity }),
|
|
883
|
+
})
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
If your application already installs both `@modelcontextprotocol/server` and
|
|
887
|
+
`ai` and mounts MCP, AI SDK `mountAgent`, and CLI surfaces together, you can
|
|
888
|
+
also pin the shared context type once via `createToolkit<AppContext>()` from
|
|
889
|
+
`stitchkit/tools/toolkit` — the tool-side mirror of `createImplement`
|
|
890
|
+
([ADR 0017](../decisions/0017-typed-tool-context.md),
|
|
891
|
+
[ADR 0284](../decisions/0284-the-tools-barrel-loads-no-optional-peer.md)):
|
|
892
|
+
|
|
893
|
+
```ts
|
|
894
|
+
import { createToolkit } from 'stitchkit/tools/toolkit'
|
|
895
|
+
|
|
875
896
|
const tools = createToolkit<{ user: User }>()
|
|
876
897
|
await tools.createCli({
|
|
877
898
|
name: 'myapp',
|
package/llms/cli.txt
CHANGED
|
@@ -112,7 +112,7 @@ await createCli({
|
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
`createCli({ signal })` and its wait loop honor an explicit caller
|
|
115
|
-
`AbortSignal`.
|
|
115
|
+
`AbortSignal`. StitchKit does not install a process-global SIGINT handler for
|
|
116
116
|
ordinary CLI programs: if desired, the application binds SIGINT to an
|
|
117
117
|
`AbortController` and passes its signal. Aborting wait stops polling only; it
|
|
118
118
|
does not cancel the underlying job.
|
|
@@ -213,7 +213,7 @@ const doctor = defineCliCommand({
|
|
|
213
213
|
})
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
`present` returns the exact stdout bytes, which
|
|
216
|
+
`present` returns the exact stdout bytes, which StitchKit writes once. Without
|
|
217
217
|
it the canonical JSON output is unchanged. `exitCode` classifies a successfully
|
|
218
218
|
validated result and must return an integer in `0..255`; failed `ToolResult`
|
|
219
219
|
envelopes and the application-wide `exitCodes` mapping remain authoritative for
|
package/llms/contract.txt
CHANGED
|
@@ -88,7 +88,7 @@ export const users = defineContract({ prefix: 'users' }, {
|
|
|
88
88
|
`HEAD` is an explicit HTTP-only operation, never an automatic alias for `GET`.
|
|
89
89
|
It must declare `rawResponse: true`; request body, `input`, multipart, `rawBody`,
|
|
90
90
|
typed `output` and tool exposure are rejected. The handler owns status and
|
|
91
|
-
headers, while
|
|
91
|
+
headers, while StitchKit guarantees an empty wire body even if the returned
|
|
92
92
|
`Response` accidentally contains one.
|
|
93
93
|
|
|
94
94
|
## `params` vs `input` vs `output`
|
package/llms/files-packaging.txt
CHANGED
|
@@ -23,7 +23,7 @@ fails a build whose entry imports the default loader of another `stitchkit` inst
|
|
|
23
23
|
both versions and roots.
|
|
24
24
|
It resolves the installed package's target/version, reads each selected addon once and checks it
|
|
25
25
|
against the `size` and `sha256` published in the package's `native-assets.json` (`formatVersion: 2`,
|
|
26
|
-
written when
|
|
26
|
+
written when StitchKit is built). Call it once per build and reuse the result.
|
|
27
27
|
`platform`, `architecture`, `delivery`, `entryPath` and `assetPath` are the explicit inputs of
|
|
28
28
|
companion delivery; embedded delivery takes `platform`, one `architecture` and `delivery` only, and
|
|
29
29
|
refuses a path. `assetPath` accepts one template, `[hash]`, replaced by the first 16 hex digits of
|
package/llms/geo.txt
CHANGED
|
@@ -117,7 +117,7 @@ The previous reader closes only after its in-flight lookups finish.
|
|
|
117
117
|
|
|
118
118
|
Use `GeoIpReaderLoader` when the database is not MaxMind-compatible. `revision`
|
|
119
119
|
must identify the complete input generation and return `null` when it cannot be
|
|
120
|
-
read. `open` returns a reader for exactly that revision.
|
|
120
|
+
read. `open` returns a reader for exactly that revision. StitchKit serializes
|
|
121
121
|
reloads, swaps generations and owns their close lifecycle.
|
|
122
122
|
|
|
123
123
|
Download schedules, licenses, database paths, attribution persistence and
|
package/llms/live.txt
CHANGED
|
@@ -53,7 +53,7 @@ is where the full name is *built*, not a second name for the same topic.
|
|
|
53
53
|
### The wire is the socket you already run
|
|
54
54
|
|
|
55
55
|
`toRealtimeContract` projects the declaration onto `RealtimeContract`. Everything
|
|
56
|
-
after that is the machinery
|
|
56
|
+
after that is the machinery StitchKit already ships — validation both ways,
|
|
57
57
|
rejection reporting, rooms, and the client's `retain:` replay.
|
|
58
58
|
|
|
59
59
|
```ts
|
package/llms/oauth.txt
CHANGED
|
@@ -11,7 +11,7 @@ Contains: Guide: OAuth & OpenID Connect (docs/guide/oauth.md) · API reference:
|
|
|
11
11
|
|
|
12
12
|
# Browser OAuth and Google OIDC
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
StitchKit separates the browser's Authorization Code + PKCE transaction from the server's
|
|
15
15
|
provider credential verification. The application still owns navigation, users, account matching
|
|
16
16
|
and merge policy, persistence, sessions, roles, unlink policy and UI.
|
|
17
17
|
|
|
@@ -19,13 +19,13 @@ and merge policy, persistence, sessions, roles, unlink policy and UI.
|
|
|
19
19
|
|
|
20
20
|
The current Google adapter supports one explicit profile: **web OpenID Connect Authorization Code
|
|
21
21
|
with PKCE**. A browser performs a top-level redirect, an application backend exchanges the
|
|
22
|
-
one-time code, and
|
|
22
|
+
one-time code, and StitchKit returns a verified identity. It is the redirect-based sign-in path;
|
|
23
23
|
it is not a generic name for every Google identity or authorization mechanism.
|
|
24
24
|
|
|
25
25
|
Keep adjacent Google capabilities separate because their credentials, lifecycle and trust
|
|
26
26
|
boundaries differ:
|
|
27
27
|
|
|
28
|
-
| Capability | Credential/result |
|
|
28
|
+
| Capability | Credential/result | StitchKit support |
|
|
29
29
|
| --- | --- | --- |
|
|
30
30
|
| Web OIDC Authorization Code + PKCE | verified user identity | `stitchkit/oauth` + `stitchkit/google` |
|
|
31
31
|
| Google Identity Services button, One Tap or FedCM | browser-delivered ID credential | not implemented |
|
|
@@ -107,7 +107,7 @@ const identity = await google.exchangeAuthorizationCode({
|
|
|
107
107
|
|
|
108
108
|
The redirect must match the immutable allowlist exactly before any outbound call. The token
|
|
109
109
|
exchange is bounded by an abort deadline; `google-auth-library` verifies the ID-token signature,
|
|
110
|
-
issuer, audience and expiry.
|
|
110
|
+
issuer, audience and expiry. StitchKit additionally requires `sub`, a valid verified email and an
|
|
111
111
|
exact nonce. Access, refresh and raw ID tokens never leave the adapter.
|
|
112
112
|
|
|
113
113
|
`GoogleOidcError.code` distinguishes `MISCONFIGURED`, `INVALID_CREDENTIAL` and
|
package/llms/observability.txt
CHANGED
|
@@ -230,7 +230,7 @@ bound observes the same drain under its own limit rather than starting another.
|
|
|
230
230
|
Passing no bound keeps the previous behaviour exactly, including the identical
|
|
231
231
|
returned promise.
|
|
232
232
|
|
|
233
|
-
|
|
233
|
+
StitchKit manages only in-process delivery. If process-crash durability matters,
|
|
234
234
|
make `write` enqueue into a consumer-owned durable outbox and let that adapter
|
|
235
235
|
own retry, replay and storage policy:
|
|
236
236
|
|
|
@@ -518,7 +518,7 @@ locally; you do not need to change `NODE_ENV` or deploy.
|
|
|
518
518
|
Every response the stitchkit handler produces carries the resolved id as
|
|
519
519
|
**`x-request-id`**. With `cors` configured it is in the default
|
|
520
520
|
`Access-Control-Expose-Headers`, so a browser client can read it and quote it in
|
|
521
|
-
a bug report.
|
|
521
|
+
a bug report. StitchKit browser clients retain it as `ApiError.traceId` on
|
|
522
522
|
response-backed failures. Note the deliberate asymmetry: inbound the id may arrive as
|
|
523
523
|
`X-Trace-Id` *or* `X-Request-Id`; outbound there is one name and no alias.
|
|
524
524
|
|
|
@@ -570,7 +570,7 @@ cross-origin `trace: true` client works out of the box. If you set a custom
|
|
|
570
570
|
the preflight will reject the trace header.
|
|
571
571
|
|
|
572
572
|
MCP tools use the same context. On a modern HTTP or stdio `tools/call`, the
|
|
573
|
-
official SDK exposes W3C propagation values from request `_meta`;
|
|
573
|
+
official SDK exposes W3C propagation values from request `_meta`; StitchKit
|
|
574
574
|
continues a valid `_meta.traceparent` before validation, lifecycle and hooks.
|
|
575
575
|
If MCP metadata omits `traceparent`, an HTTP call keeps its ambient HTTP trace
|
|
576
576
|
and a stdio call starts a new root. If the key is present but malformed or
|
package/llms/primitives.txt
CHANGED
|
@@ -50,7 +50,7 @@ an immutable branded value; `transition()` produces the next one. `availableTran
|
|
|
50
50
|
|
|
51
51
|
`defineOwnerScope` resolves one owner from authenticated identity. Reading across owners is a
|
|
52
52
|
separate `acrossAllOwners(identity)` call and permission. Pass the resulting branded `OwnerScope`
|
|
53
|
-
to the data adapter. This proves the scope was explicit;
|
|
53
|
+
to the data adapter. This proves the scope was explicit; StitchKit cannot prove what SQL an
|
|
54
54
|
arbitrary adapter emits. `scanOwnerFilterRisks` maps existing caller-named manual filters before a
|
|
55
55
|
migration.
|
|
56
56
|
|
package/llms/process.2.txt
CHANGED
|
@@ -15,11 +15,11 @@ Parts of this slice:
|
|
|
15
15
|
|
|
16
16
|
Public leaves keep optional peers out of their import closure. Installing `stitchkit` still
|
|
17
17
|
installs the complete package and ky; selective imports alone do not avoid that installation.
|
|
18
|
-
A library can use
|
|
18
|
+
A library can use StitchKit as a build dependency, bundle its selected public native imports,
|
|
19
19
|
keep Zod external, and publish the resulting implementation with its library artifact.
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
|
-
// The library's build entry; all mechanisms remain owned by
|
|
22
|
+
// The library's build entry; all mechanisms remain owned by StitchKit.
|
|
23
23
|
export { canonicalJson } from 'stitchkit/primitives';
|
|
24
24
|
export { writeFileAtomic, withExclusiveLock } from 'stitchkit/files';
|
|
25
25
|
export { observeProcessInstance, probeProcessOwner, runNativeCommand } from 'stitchkit/process';
|
|
@@ -81,7 +81,7 @@ identity, live-owner refusal, dead-owner recovery and contained file operations
|
|
|
81
81
|
with the packaging plugin, and check that an unpackaged build reports the backend `unavailable`
|
|
82
82
|
with stage `packaging` rather than certifying a dead owner. Bun and Node package imports retain the same
|
|
83
83
|
lazy loader; importing a portable leaf does not load a Darwin addon on another OS. Test
|
|
84
|
-
declarations too, and check that importing an unbundled
|
|
84
|
+
declarations too, and check that importing an unbundled StitchKit leaf fails in a deliberately
|
|
85
85
|
isolated library distribution. A separate schema-only entry must not import the native entry.
|
|
86
86
|
|
|
87
87
|
If the Darwin backend cannot load, `observeProcessInstance` still returns `unavailable`.
|
|
@@ -95,20 +95,20 @@ failures or turn unavailable identity into proof that an owner is dead. If a run
|
|
|
95
95
|
no recognized native error code, the stage stays `load`; the loader never infers errno from text.
|
|
96
96
|
|
|
97
97
|
This delivery removes a runtime kernel installation; it does not remove the build-time
|
|
98
|
-
|
|
98
|
+
StitchKit installation or create an independent lightweight npm package.
|
|
99
99
|
|
|
100
100
|
## Public native packaging
|
|
101
101
|
|
|
102
102
|
Custom archives and installers use `stitchkit/files/packaging` at **build time**.
|
|
103
103
|
`createNativePackaging` resolves the installed version and target addon, reads the addon once and
|
|
104
|
-
checks it against the size and SHA256 that
|
|
104
|
+
checks it against the size and SHA256 that StitchKit published in its `native-assets.json` when the
|
|
105
105
|
package was built. A ready asset carries those verified `bytes` with the published `size` and
|
|
106
106
|
`sha256`; its Bun-compatible plugin integrates the same bytes with the same lazy native loader.
|
|
107
107
|
Each call reads and hashes the selected addons, so call it once per build and reuse the result.
|
|
108
108
|
The leaf is evolving. It requires no optional peer or Bun ambient declarations for Node imports.
|
|
109
109
|
Calling it must happen in a process that runs it from its installed package: it locates the
|
|
110
110
|
package's `native-assets.json` beside its own file and throws `Native packaging must run from its
|
|
111
|
-
installed
|
|
111
|
+
installed StitchKit package` anywhere else, such as inside an application's runtime artifact.
|
|
112
112
|
Importing the leaf is side-effect free (it loads no addon and reads no file), so a module that
|
|
113
113
|
both builds and is bundled may import it; only the call has to stay in the build step.
|
|
114
114
|
|
|
@@ -155,7 +155,7 @@ second time. An installed addon whose size or SHA256 differs from the published
|
|
|
155
155
|
with `mismatch` / `NATIVE_ASSET_DIGEST_MISMATCH`, so a file substituted after installation never
|
|
156
156
|
reaches an artifact. Archive the complete output directory with an integrity manifest that records
|
|
157
157
|
`asset.sha256`, unpack to a clean directory, verify the same hashes there, and run offline without
|
|
158
|
-
the build tree or `node_modules`. The published digest ties the bytes to the package
|
|
158
|
+
the build tree or `node_modules`. The published digest ties the bytes to the package StitchKit
|
|
159
159
|
built; the package itself is only as trusted as its tarball (the lockfile integrity of the install).
|
|
160
160
|
Signature and trust policy remain application-owned.
|
|
161
161
|
|