stitchkit 0.136.7 → 0.136.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/update.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EAErB,KAAK,cAAc,EAGpB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAGlB,MAAM,aAAa,CAAC;AAYrB,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,mBAAmB,CAAA;CAAE,GACvE;IACE,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,uEAAuE;IACvE,SAAS,CAAC,EAAE,mBAAmB,CAAC;CACjC,GACD;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM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ACxG,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA2E5F;AAiED,MAAM,WAAW,iBAAiB;IAChC,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,mBAAmB,CAchF"}
@@ -34,8 +34,11 @@ in `stitchkit/cli` — [guide](../guide/cli.md#publishing-a-complete-version),
34
34
  | `CliShippingInputsChangedOptions` | _type_ | options for `cliShippingInputsChanged` (`repository`, `previousCommit`, `nextCommit`, `shippingPaths`, `timeoutMs`, `signal`) |
35
35
  | `assertCleanCliSource` | function | verify a clean git root matching optional `expectedCommit`, optional `untrackedPaths` globs and optional `servingSource` realpath; returns verified 40-hex `HEAD` |
36
36
  | `CleanCliSourceOptions` | _type_ | options for `assertCleanCliSource` (`repository`, `expectedCommit`, `untrackedPaths`, `servingSource`, `timeoutMs`, `signal`) |
37
- | `createCliDistributionRoutes` | function | portable `RawRoute[]` (`GET` only) serving verified signed channel manifests (`no-store`), immutable versioned manifests and descriptor-streamed binary assets, and `install.sh`, failing closed with `503 No verified CLI build is published` |
37
+ | `createCliDistributionRoutes` | function | portable `RawRoute[]` (`GET` only) serving verified signed channel manifests (`no-store`), immutable versioned manifests and descriptor-streamed binary assets, and `install.sh`; returns `CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE` (`503`, `x-stitchkit-cli-distribution-state: unpublished`) only for a missing channel manifest and fails closed with `503` (`x-stitchkit-cli-distribution-state: unavailable`) on all configuration, path, integrity and signature faults |
38
38
  | `CliDistributionRoutesOptions` | _type_ | options for `createCliDistributionRoutes` (`root`, `name`, `trust`, `channels`, `installerChannel`, `basePath`, `binaryName`, `installDir`, `maxManifestBytes`, `serviceName`, `onUnavailable`) |
39
39
  | `CliDistributionUnavailableEvent` | _type_ | diagnostic event passed to `onUnavailable` with `route`, `channel`, optional `version`/`asset`, inline `reason`, optional `verdict` and `error` |
40
+ | `CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE` | constant | frozen canonical HTTP response contract (`status: 503`, `header: 'x-stitchkit-cli-distribution-state'`, `headerValue: 'unpublished'`, `body: 'No verified CLI build is published'`) emitted only when a channel has no published manifest yet (`reason: 'missing'`) |
41
+ | `CliDistributionUnpublishedResponse` | _type_ | readonly wire-contract type of `CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE` |
42
+ | `isCliDistributionUnpublishedResponse` | function | synchronous, body-free predicate matching the exact `503` + `x-stitchkit-cli-distribution-state: unpublished` contract without consuming `response.body`, returning `false` for all fault and generic `503` responses |
40
43
 
41
44
  ---
package/llms/cli.2.txt CHANGED
@@ -270,7 +270,7 @@ exists to distrust.
270
270
  `publishCli` is an opt-in publisher for a local application-owned distribution
271
271
  directory. It commits every target and its version manifest before atomically
272
272
  replacing the public `manifest.json`. It ships from its own evolving entrypoint,
273
- `stitchkit/cli/publish`: release infrastructure follows how distributions are
273
+ `stitchkit/cli/publish`: artifact publication and HTTP serving infrastructure follows how distributions are
274
274
  published, so it is not held to the stable promise of `stitchkit/cli`
275
275
  ([ADR 0245](../decisions/0245-cli-publication-is-an-evolving-leaf.md)). The
276
276
  manifest, signatures, installer and updater it writes for stay in
@@ -348,9 +348,11 @@ be checked. A failure after public-pointer rename may already have published;
348
348
  `AtomicFilePublicationError.published` remains available when the atomic writer
349
349
  reports that boundary. Read the durable manifest and retry the admitted same
350
350
  identity to recover; an error does not promise rollback. Optional `signing` and
351
- `trust` reuse the Ed25519 contract below. The generated shell installer checks
352
- raw digest and size; the updater checks manifest authorship when given a trust
353
- root.
351
+ `trust` reuse the Ed25519 contract below; when `trust` is passed, `publishCli`
352
+ validates it eagerly with `CliTrustRootSchema` (requiring at least one valid Ed25519
353
+ public key) and requires a `'valid'` manifest signature fail-closed. The generated shell
354
+ installer checks raw digest and size; the updater checks manifest authorship when given a
355
+ trust root.
354
356
 
355
357
  ### Versioning from shipping inputs and verifying clean source
356
358
 
@@ -426,14 +428,32 @@ Each configured channel mounts `${basePath}/channels/<channel>/manifest.json`
426
428
  descriptor-streamed binary listed in the signed manifest with `Content-Length`
427
429
  and `Content-Disposition`). `${basePath}/install.sh` renders `renderCliInstaller`
428
430
  from the verified `installerChannel` manifest (`no-store`). Every read checks
429
- canonical directory containment (`realpath` + `isWithinDir`), opens regular files
430
- with `O_NOFOLLOW`, parses strict UTF-8 JSON without `__proto__`, verifies
431
- `manifest.name` and Ed25519 signature strictly (`verifyCliManifest === 'valid'`),
432
- and streams full asset bodies portably on both Bun and Node without `Bun.file`.
433
- When `root` is `undefined`, `trust.keys` is empty, or the manifest is missing,
434
- unsigned, tampered, oversized or has no assets, channel manifest and installer
435
- routes fail closed with `503 No verified CLI build is published` (`no-store`),
436
- and exceptions thrown by `onUnavailable` are isolated.
431
+ each directory segment with `lstat` plus canonical containment (`realpath` +
432
+ `isWithinDir`), opens regular files with `O_NOFOLLOW`, parses strict UTF-8 JSON
433
+ without `__proto__`, verifies `manifest.name` and Ed25519 signature strictly
434
+ (`verifyCliManifest === 'valid'`), and streams full asset bodies portably on both
435
+ Bun and Node without `Bun.file`.
436
+
437
+ Channel manifest and installer routes deliberately separate a genuinely empty
438
+ (not yet published) channel from configuration, path, integrity and signature
439
+ faults:
440
+
441
+ - When `reason` is `'missing'` (an existing `root` whose channel directory or
442
+ `manifest.json` has not been published yet), the route responds with the
443
+ exported contract `CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE` (`503`,
444
+ `Cache-Control: no-store`, header
445
+ `x-stitchkit-cli-distribution-state: unpublished`, body
446
+ `No verified CLI build is published`). External probes and gates identify this
447
+ state with the synchronous, body-free `isCliDistributionUnpublishedResponse(res)`
448
+ helper instead of matching prose strings.
449
+ - For every other failure (`unconfigured-root`, missing or non-directory `root`,
450
+ `empty-trust-root`, `unsafe-path` including dangling or escaping symlinks,
451
+ `too-large`, `invalid-manifest` including empty `assets` on `install.sh`,
452
+ `identity-mismatch`, `untrusted-signature`, or `io-error`), the route fails
453
+ closed with a distinct `503` carrying
454
+ `x-stitchkit-cli-distribution-state: unavailable` (`CLI distribution is
455
+ unavailable`), for which `isCliDistributionUnpublishedResponse(res)` always
456
+ returns `false`. Exceptions thrown by `onUnavailable` are isolated.
437
457
 
438
458
  ### Proving who built it — signing the manifest
439
459
 
@@ -916,34 +936,3 @@ delivery guarantee as distinct error codes and default exit codes:
916
936
  `GET`/`HEAD`) are never retried automatically; inspect application state before repeating.
917
937
  - **`response-received` (exit `1`)** — `UNIX_RESPONSE_TOO_LARGE`, `UNIX_HEADERS_TOO_LARGE`,
918
938
  `UNIX_RESPONSE_ABORTED`, `UNIX_REDIRECT_REFUSED`.
919
-
920
- ## Auth parity
921
-
922
- Every managed CLI (any `createCli` / `createCliInvoker` with `services` or
923
- `runtimeTools`) requires an explicit `access` policy — guard scoped commands
924
- with the same `createAuthHook` your HTTP server uses via
925
- `access: { gate: { beforeHandle: authHook } }`, and inject the identity through
926
- `context` so `resolveFromContext` can read it:
927
-
928
- ```ts
929
- const authHook = createAuthHook({ /* resolve, resolveFromContext, rules */ })
930
-
931
- await createCli({
932
- name: 'myapp',
933
- version: '1.0.0',
934
- resolveAuth: () => resolveIdentityFromToken(process.env.MYAPP_TOKEN),
935
- context: (identity) => ({ user: identity }), // resolveFromContext reads this
936
- access: { gate: { beforeHandle: authHook } }, // same policy; HTTP wires it as authorize
937
- services,
938
- })
939
- ```
940
-
941
- Omitting `access` (or passing an empty object or legacy `lifecycle`) is both a
942
- type error and a startup `TypeError` before the first command executes
943
- ([ADR 0311](../decisions/0311-planned-breaking-release-access-expose-and-clean-boundaries.md),
944
- amending [ADR 0014](../decisions/0014-tool-http-parity.md)). When a CLI talks
945
- only to a remote server that enforces its own auth, or serves a deliberately
946
- public or local-operator surface, declare that explicitly with
947
- `access: { open: 'remote' | 'public' | 'local-operator', afterHandle? }`.
948
- A native-only CLI (only `commands`, no `services` or `runtimeTools`) takes no
949
- `access`.
package/llms/cli.3.txt CHANGED
@@ -12,6 +12,37 @@ Parts of this slice:
12
12
  # Guide: CLI (docs/guide/cli.md) (continued)
13
13
  ==============================================================================
14
14
 
15
+ ## Auth parity
16
+
17
+ Every managed CLI (any `createCli` / `createCliInvoker` with `services` or
18
+ `runtimeTools`) requires an explicit `access` policy — guard scoped commands
19
+ with the same `createAuthHook` your HTTP server uses via
20
+ `access: { gate: { beforeHandle: authHook } }`, and inject the identity through
21
+ `context` so `resolveFromContext` can read it:
22
+
23
+ ```ts
24
+ const authHook = createAuthHook({ /* resolve, resolveFromContext, rules */ })
25
+
26
+ await createCli({
27
+ name: 'myapp',
28
+ version: '1.0.0',
29
+ resolveAuth: () => resolveIdentityFromToken(process.env.MYAPP_TOKEN),
30
+ context: (identity) => ({ user: identity }), // resolveFromContext reads this
31
+ access: { gate: { beforeHandle: authHook } }, // same policy; HTTP wires it as authorize
32
+ services,
33
+ })
34
+ ```
35
+
36
+ Omitting `access` (or passing an empty object or legacy `lifecycle`) is both a
37
+ type error and a startup `TypeError` before the first command executes
38
+ ([ADR 0311](../decisions/0311-planned-breaking-release-access-expose-and-clean-boundaries.md),
39
+ amending [ADR 0014](../decisions/0014-tool-http-parity.md)). When a CLI talks
40
+ only to a remote server that enforces its own auth, or serves a deliberately
41
+ public or local-operator surface, declare that explicitly with
42
+ `access: { open: 'remote' | 'public' | 'local-operator', afterHandle? }`.
43
+ A native-only CLI (only `commands`, no `services` or `runtimeTools`) takes no
44
+ `access`.
45
+
15
46
  ## Typed context
16
47
 
17
48
  For a peer-free CLI, import `createCli` directly from `stitchkit/cli` and
@@ -105,7 +136,7 @@ SDK nor the `ai` peer.
105
136
  | `rollbackCliUpdate` / `CliRollbackConfig` / `RolledBackCliUpdate` | function / _types_ | put the kept previous build back, digest-checked first and written by the same atomic rename the update uses |
106
137
  | `signCliManifest` / `verifyCliManifest` / `cliManifestSigningPayload` | function | Ed25519 over `{name, version, commit, builtAt, assets[]}` — every asset's digest included, so the chain closes on the file that executes |
107
138
  | `cliSignatureAccepted` / `CliSignatureVerdict` | function / _type_ | `valid` \| `unenforced` \| `missing` \| `unknown-key` \| `invalid`; `unenforced` keeps an unpinned build updating while making the absence of a check visible |
108
- | `CliTrustRoot` / `CliSigningKey` / `CliBuildSignature` / `CliBuildSignatureSchema` | _types_ / schema | the keys a build trusts, by id, and the detached signature a manifest carries |
139
+ | `CliTrustRoot` / `CliTrustRootSchema` / `CliSigningKey` / `CliBuildSignature` / `CliBuildSignatureSchema` | _types_ / schemas | the keys a build trusts, by id (validated non-empty Ed25519 SPKI PEM or canonical 32-byte base64 via `CliTrustRootSchema`), and the detached signature a manifest carries |
109
140
  | `selectCliBuildAsset` | function | the asset for one target, or `undefined` |
110
141
  | `currentCliBuildTarget` | function | `{ platform, arch }` of the running process |
111
142
  | `formatCliBuildStamp` | function | one line saying what the running build is |
package/llms/postgres.txt CHANGED
@@ -11,7 +11,11 @@ Contains: API reference: `stitchkit/postgres` (docs/api/reference.md)
11
11
 
12
12
  ## `stitchkit/postgres`
13
13
 
14
- Server-only, peer-free PostgreSQL application helpers. Wraps any Prisma SQL driver adapter factory
14
+ Server-only, peer-free PostgreSQL application helpers. `postgresConnectionConfig`
15
+ surgically strips `?options=` from `DATABASE_URL` and merges URL options, config options,
16
+ custom parameters, `searchPath`, and `timeZone` (default `'UTC'`) in startup-packet order
17
+ for `PrismaPg` and `pg.Pool` without rewriting unrelated parameters or importing `pg`.
18
+ `withSerializedPrismaTransactions` wraps any Prisma SQL driver adapter factory
15
19
  (such as `new PrismaPg(...)`) without importing `@prisma/adapter-pg` or `pg`, so statements inside
16
20
  each interactive transaction reach its single PostgreSQL connection one at a time while queries
17
21
  outside transactions and separate transactions stay parallel across the pool. See
@@ -19,16 +23,22 @@ outside transactions and separate transactions stay parallel across the pool. Se
19
23
 
20
24
  ```ts
21
25
  import { PrismaPg } from '@prisma/adapter-pg';
22
- import { withSerializedPrismaTransactions } from 'stitchkit/postgres';
26
+ import {
27
+ postgresConnectionConfig,
28
+ withSerializedPrismaTransactions,
29
+ } from 'stitchkit/postgres';
23
30
 
24
31
  const adapter = withSerializedPrismaTransactions(
25
- new PrismaPg({ connectionString: env.DATABASE_URL }),
32
+ new PrismaPg(postgresConnectionConfig(env.DATABASE_URL)),
26
33
  );
27
34
  const prisma = new PrismaClient({ adapter });
28
35
  ```
29
36
 
30
37
  | Export | Kind | Summary |
31
38
  |--------|------|---------|
39
+ | `postgresConnectionConfig` | function | build a `pg.PoolConfig` / `PrismaPg`-compatible config from a connection string or plain config object, stripping `?options=` surgically from the URL, validating raw fragments against `pg_split_opts` boundaries, and appending `parameters`, `searchPath` and `timeZone` (default `'UTC'`; `null` omits) so later startup flags win |
40
+ | `PostgresConnectionConfig` | _type_ | minimal `{ connectionString, options? }` shape accepted and returned by `postgresConnectionConfig`, structurally compatible with `pg.PoolConfig` without importing `pg` |
41
+ | `PostgresConnectionOptions` | _type_ | structured session options for `postgresConnectionConfig` (`timeZone`, `searchPath`, `parameters`) |
32
42
  | `withSerializedPrismaTransactions` | function | wraps a Prisma SQL driver adapter factory (`connect` and optional `connectToShadowDb`) so `queryRaw`, `executeRaw`, `commit`, `rollback` and savepoints inside each interactive transaction execute in strict FIFO order without overlapping on one connection; idempotent and fails fast with `TypeError` on non-factory inputs (such as a raw `pg.Pool`) |
33
43
  | `PrismaDriverAdapterFactory` | _type_ | minimal structural Prisma SQL driver adapter factory (`provider`, `adapterName`, `connect`, optional `connectToShadowDb`) accepted by `withSerializedPrismaTransactions` |
34
44
  | `PrismaDriverAdapter` | _type_ | minimal structural connected Prisma SQL driver adapter (`startTransaction`) |
@@ -74,7 +74,7 @@ own, recorded as an ADR.
74
74
  | `stitchkit/tools/invoker` | server | stable<br>_redefined in 3 of the 43 minors since 0.94.0, most recently 0.127.0_ | peer-free `createToolInvoker` over the canonical contract tool runner |
75
75
  | `stitchkit/tools/connections` | server (Bun or Node) | evolving<br>_redefined in 3 of the 43 minors since 0.94.0, most recently 0.127.0_ | consume external MCP servers and a bounded OpenAPI subset — typed reauthorization, a per-request host fence and per-call credentials |
76
76
  | `stitchkit/cli` | server | stable<br>_redefined in 12 of the 43 minors since 0.94.0, most recently 0.128.0_ | `createCli` / `createCliInvoker` — runtime and strict NodeNext declarations without MCP SDK / `ai` |
77
- | `stitchkit/cli/publish` | build, release and server tooling (Bun or Node, POSIX) | evolving<br>_redefined in 0 of the 43 minors since 0.94.0_ | `publishCli`, shipping-input versioning (`deriveCliVersionFromShippingInputs`, `cliShippingInputsChanged`, `assertCleanCliSource`), and `createCliDistributionRoutes` (`RawRoute[]` channel manifest, asset and installer routes); see [CLI guide](cli.md#publishing-a-complete-version) |
77
+ | `stitchkit/cli/publish` | artifact publication and HTTP serving tooling (Bun or Node, POSIX) | evolving<br>_redefined in 0 of the 43 minors since 0.94.0_ | `publishCli`, shipping-input versioning (`deriveCliVersionFromShippingInputs`, `cliShippingInputsChanged`, `assertCleanCliSource`), `createCliDistributionRoutes`, and the unpublished-channel response contract (`CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE`, `isCliDistributionUnpublishedResponse`); see [CLI guide](cli.md#publishing-a-complete-version) |
78
78
  | `stitchkit/remote` | browser **and** server | stable<br>_redefined in 1 of the 43 minors since 0.94.0, most recently 0.104.0_ | peer-free `implementRemote` for thin HTTP proxy processes |
79
79
  | `stitchkit/process` | server (Bun or Node, POSIX) | evolving<br>_redefined in 4 of the 43 minors since 0.94.0, most recently 0.133.0_ | finite native commands, byte sinks, bounded capture, process-group cancellation and opt-in Linux/Darwin owner-loss cleanup; contract operations executed in one-call child processes |
80
80
  | `stitchkit/process/bootstrap` | bundled server entry (Bun, POSIX) | evolving<br>_redefined in 0 of the 4 minors since 0.133.0_ | narrow bootstrap that keeps the process runner lazy while carrying the package's own invocations — the owner-loss guard and the process root of launched work — in a single-file bundle |
@@ -98,7 +98,7 @@ own, recorded as an ADR.
98
98
  | `stitchkit/voice` | browser **and** server | evolving<br>_redefined in 0 of the 43 minors since 0.94.0_ | the mechanics of a live voice reply — `SentenceCutter`, `speakableText`, a `SpeechQueue` that synthesises ahead and stops on interruption, the conversation phases |
99
99
  | `stitchkit/sync` | browser **and** server | evolving<br>_redefined in 1 of the 10 minors since 0.127.0, most recently 0.132.0_ | the client half of an offline-first sync — which outbox rows leave next, pending edits on top of remote rows, deletes that win until acknowledged, the cursor session, the push and page wire with an open outcome vocabulary; no driver, runs in Hermes |
100
100
  | `stitchkit/sync/postgres` | server (Bun or Node) | evolving<br>_redefined in 0 of the 10 minors since 0.127.0_ | the server half — versions that commit in order, a ledger that runs each change once, a feed of what changed, inside the app's own transaction; a memory store and `checkSyncStore` |
101
- | `stitchkit/postgres` | server (Bun or Node) | evolving<br>_redefined in 0 of the 1 minor since 0.136.7_ | peer-free PostgreSQL helpers — `withSerializedPrismaTransactions` queues interactive transaction statements one at a time on a Prisma SQL driver adapter (`PrismaPg`) while keeping pool queries parallel |
101
+ | `stitchkit/postgres` | server (Bun or Node) | evolving<br>_redefined in 0 of the 1 minor since 0.136.7_ | peer-free PostgreSQL helpers — `postgresConnectionConfig` safely merges URL `?options=` with enforced `TimeZone=UTC`, `search_path` and custom parameters for `PrismaPg`/`pg.Pool`, and `withSerializedPrismaTransactions` queues interactive transaction statements one at a time on a Prisma SQL driver adapter while keeping pool queries parallel |
102
102
  | `stitchkit/geo` | server (Bun or Node) | evolving<br>_redefined in 2 of the 43 minors since 0.94.0, most recently 0.127.0_ | managed GeoIP reader generations, last-known-good reload and the optional MaxMind adapter |
103
103
  | `stitchkit/geo/contract` | browser **and** server | evolving<br>_redefined in 0 of the 43 minors since 0.94.0_ | the place snapshot schema, for a shared contract that stores or sends `GeoAttribution`; brings `zod` |
104
104
  | `stitchkit/xlsx` | browser **and** server | evolving<br>_redefined in 0 of the 43 minors since 0.94.0_ | a workbook from rows and typed columns, with no dependency; text never runs as a formula |
@@ -260,7 +260,7 @@ map — feature → packages:
260
260
  | Anthropic native provider (`stitchkit/agent-runtime/anthropic`) | — (peer-free) |
261
261
  | AI SDK runtime adapter (`stitchkit/agent-runtime/ai-sdk`) | `ai` |
262
262
  | Postgres agent store (`stitchkit/agent-runtime/postgres`) | — (the application's own Postgres client) |
263
- | Postgres Prisma transaction serializer (`stitchkit/postgres`) | — (peer-free; wraps the application's own Prisma SQL driver adapter) |
263
+ | Postgres connection options and Prisma transaction serializer (`stitchkit/postgres`) | — (peer-free; composes with `pg.Pool` and Prisma SQL driver adapters) |
264
264
  | SQLite agent store (`stitchkit/agent-runtime/sqlite/bun` or `/node`) | — (runtime built-in) |
265
265
  | Agent executor — Claude Agent SDK leaf (`stitchkit/agent-executor/claude-sdk`) | `@anthropic-ai/claude-agent-sdk` |
266
266
  | Agent executor — consumer testing kit (`stitchkit/agent-executor/testing`) | — |
package/llms-full.txt CHANGED
@@ -65,7 +65,7 @@ own, recorded as an ADR.
65
65
  | `stitchkit/tools/invoker` | server | stable<br>_redefined in 3 of the 43 minors since 0.94.0, most recently 0.127.0_ | peer-free `createToolInvoker` over the canonical contract tool runner |
66
66
  | `stitchkit/tools/connections` | server (Bun or Node) | evolving<br>_redefined in 3 of the 43 minors since 0.94.0, most recently 0.127.0_ | consume external MCP servers and a bounded OpenAPI subset — typed reauthorization, a per-request host fence and per-call credentials |
67
67
  | `stitchkit/cli` | server | stable<br>_redefined in 12 of the 43 minors since 0.94.0, most recently 0.128.0_ | `createCli` / `createCliInvoker` — runtime and strict NodeNext declarations without MCP SDK / `ai` |
68
- | `stitchkit/cli/publish` | build, release and server tooling (Bun or Node, POSIX) | evolving<br>_redefined in 0 of the 43 minors since 0.94.0_ | `publishCli`, shipping-input versioning (`deriveCliVersionFromShippingInputs`, `cliShippingInputsChanged`, `assertCleanCliSource`), and `createCliDistributionRoutes` (`RawRoute[]` channel manifest, asset and installer routes); see [CLI guide](cli.md#publishing-a-complete-version) |
68
+ | `stitchkit/cli/publish` | artifact publication and HTTP serving tooling (Bun or Node, POSIX) | evolving<br>_redefined in 0 of the 43 minors since 0.94.0_ | `publishCli`, shipping-input versioning (`deriveCliVersionFromShippingInputs`, `cliShippingInputsChanged`, `assertCleanCliSource`), `createCliDistributionRoutes`, and the unpublished-channel response contract (`CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE`, `isCliDistributionUnpublishedResponse`); see [CLI guide](cli.md#publishing-a-complete-version) |
69
69
  | `stitchkit/remote` | browser **and** server | stable<br>_redefined in 1 of the 43 minors since 0.94.0, most recently 0.104.0_ | peer-free `implementRemote` for thin HTTP proxy processes |
70
70
  | `stitchkit/process` | server (Bun or Node, POSIX) | evolving<br>_redefined in 4 of the 43 minors since 0.94.0, most recently 0.133.0_ | finite native commands, byte sinks, bounded capture, process-group cancellation and opt-in Linux/Darwin owner-loss cleanup; contract operations executed in one-call child processes |
71
71
  | `stitchkit/process/bootstrap` | bundled server entry (Bun, POSIX) | evolving<br>_redefined in 0 of the 4 minors since 0.133.0_ | narrow bootstrap that keeps the process runner lazy while carrying the package's own invocations — the owner-loss guard and the process root of launched work — in a single-file bundle |
@@ -89,7 +89,7 @@ own, recorded as an ADR.
89
89
  | `stitchkit/voice` | browser **and** server | evolving<br>_redefined in 0 of the 43 minors since 0.94.0_ | the mechanics of a live voice reply — `SentenceCutter`, `speakableText`, a `SpeechQueue` that synthesises ahead and stops on interruption, the conversation phases |
90
90
  | `stitchkit/sync` | browser **and** server | evolving<br>_redefined in 1 of the 10 minors since 0.127.0, most recently 0.132.0_ | the client half of an offline-first sync — which outbox rows leave next, pending edits on top of remote rows, deletes that win until acknowledged, the cursor session, the push and page wire with an open outcome vocabulary; no driver, runs in Hermes |
91
91
  | `stitchkit/sync/postgres` | server (Bun or Node) | evolving<br>_redefined in 0 of the 10 minors since 0.127.0_ | the server half — versions that commit in order, a ledger that runs each change once, a feed of what changed, inside the app's own transaction; a memory store and `checkSyncStore` |
92
- | `stitchkit/postgres` | server (Bun or Node) | evolving<br>_redefined in 0 of the 1 minor since 0.136.7_ | peer-free PostgreSQL helpers — `withSerializedPrismaTransactions` queues interactive transaction statements one at a time on a Prisma SQL driver adapter (`PrismaPg`) while keeping pool queries parallel |
92
+ | `stitchkit/postgres` | server (Bun or Node) | evolving<br>_redefined in 0 of the 1 minor since 0.136.7_ | peer-free PostgreSQL helpers — `postgresConnectionConfig` safely merges URL `?options=` with enforced `TimeZone=UTC`, `search_path` and custom parameters for `PrismaPg`/`pg.Pool`, and `withSerializedPrismaTransactions` queues interactive transaction statements one at a time on a Prisma SQL driver adapter while keeping pool queries parallel |
93
93
  | `stitchkit/geo` | server (Bun or Node) | evolving<br>_redefined in 2 of the 43 minors since 0.94.0, most recently 0.127.0_ | managed GeoIP reader generations, last-known-good reload and the optional MaxMind adapter |
94
94
  | `stitchkit/geo/contract` | browser **and** server | evolving<br>_redefined in 0 of the 43 minors since 0.94.0_ | the place snapshot schema, for a shared contract that stores or sends `GeoAttribution`; brings `zod` |
95
95
  | `stitchkit/xlsx` | browser **and** server | evolving<br>_redefined in 0 of the 43 minors since 0.94.0_ | a workbook from rows and typed columns, with no dependency; text never runs as a formula |
@@ -251,7 +251,7 @@ map — feature → packages:
251
251
  | Anthropic native provider (`stitchkit/agent-runtime/anthropic`) | — (peer-free) |
252
252
  | AI SDK runtime adapter (`stitchkit/agent-runtime/ai-sdk`) | `ai` |
253
253
  | Postgres agent store (`stitchkit/agent-runtime/postgres`) | — (the application's own Postgres client) |
254
- | Postgres Prisma transaction serializer (`stitchkit/postgres`) | — (peer-free; wraps the application's own Prisma SQL driver adapter) |
254
+ | Postgres connection options and Prisma transaction serializer (`stitchkit/postgres`) | — (peer-free; composes with `pg.Pool` and Prisma SQL driver adapters) |
255
255
  | SQLite agent store (`stitchkit/agent-runtime/sqlite/bun` or `/node`) | — (runtime built-in) |
256
256
  | Agent executor — Claude Agent SDK leaf (`stitchkit/agent-executor/claude-sdk`) | `@anthropic-ai/claude-agent-sdk` |
257
257
  | Agent executor — consumer testing kit (`stitchkit/agent-executor/testing`) | — |
@@ -13584,7 +13584,7 @@ exists to distrust.
13584
13584
  `publishCli` is an opt-in publisher for a local application-owned distribution
13585
13585
  directory. It commits every target and its version manifest before atomically
13586
13586
  replacing the public `manifest.json`. It ships from its own evolving entrypoint,
13587
- `stitchkit/cli/publish`: release infrastructure follows how distributions are
13587
+ `stitchkit/cli/publish`: artifact publication and HTTP serving infrastructure follows how distributions are
13588
13588
  published, so it is not held to the stable promise of `stitchkit/cli`
13589
13589
  ([ADR 0245](../decisions/0245-cli-publication-is-an-evolving-leaf.md)). The
13590
13590
  manifest, signatures, installer and updater it writes for stay in
@@ -13662,9 +13662,11 @@ be checked. A failure after public-pointer rename may already have published;
13662
13662
  `AtomicFilePublicationError.published` remains available when the atomic writer
13663
13663
  reports that boundary. Read the durable manifest and retry the admitted same
13664
13664
  identity to recover; an error does not promise rollback. Optional `signing` and
13665
- `trust` reuse the Ed25519 contract below. The generated shell installer checks
13666
- raw digest and size; the updater checks manifest authorship when given a trust
13667
- root.
13665
+ `trust` reuse the Ed25519 contract below; when `trust` is passed, `publishCli`
13666
+ validates it eagerly with `CliTrustRootSchema` (requiring at least one valid Ed25519
13667
+ public key) and requires a `'valid'` manifest signature fail-closed. The generated shell
13668
+ installer checks raw digest and size; the updater checks manifest authorship when given a
13669
+ trust root.
13668
13670
 
13669
13671
  ### Versioning from shipping inputs and verifying clean source
13670
13672
 
@@ -13740,14 +13742,32 @@ Each configured channel mounts `${basePath}/channels/<channel>/manifest.json`
13740
13742
  descriptor-streamed binary listed in the signed manifest with `Content-Length`
13741
13743
  and `Content-Disposition`). `${basePath}/install.sh` renders `renderCliInstaller`
13742
13744
  from the verified `installerChannel` manifest (`no-store`). Every read checks
13743
- canonical directory containment (`realpath` + `isWithinDir`), opens regular files
13744
- with `O_NOFOLLOW`, parses strict UTF-8 JSON without `__proto__`, verifies
13745
- `manifest.name` and Ed25519 signature strictly (`verifyCliManifest === 'valid'`),
13746
- and streams full asset bodies portably on both Bun and Node without `Bun.file`.
13747
- When `root` is `undefined`, `trust.keys` is empty, or the manifest is missing,
13748
- unsigned, tampered, oversized or has no assets, channel manifest and installer
13749
- routes fail closed with `503 No verified CLI build is published` (`no-store`),
13750
- and exceptions thrown by `onUnavailable` are isolated.
13745
+ each directory segment with `lstat` plus canonical containment (`realpath` +
13746
+ `isWithinDir`), opens regular files with `O_NOFOLLOW`, parses strict UTF-8 JSON
13747
+ without `__proto__`, verifies `manifest.name` and Ed25519 signature strictly
13748
+ (`verifyCliManifest === 'valid'`), and streams full asset bodies portably on both
13749
+ Bun and Node without `Bun.file`.
13750
+
13751
+ Channel manifest and installer routes deliberately separate a genuinely empty
13752
+ (not yet published) channel from configuration, path, integrity and signature
13753
+ faults:
13754
+
13755
+ - When `reason` is `'missing'` (an existing `root` whose channel directory or
13756
+ `manifest.json` has not been published yet), the route responds with the
13757
+ exported contract `CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE` (`503`,
13758
+ `Cache-Control: no-store`, header
13759
+ `x-stitchkit-cli-distribution-state: unpublished`, body
13760
+ `No verified CLI build is published`). External probes and gates identify this
13761
+ state with the synchronous, body-free `isCliDistributionUnpublishedResponse(res)`
13762
+ helper instead of matching prose strings.
13763
+ - For every other failure (`unconfigured-root`, missing or non-directory `root`,
13764
+ `empty-trust-root`, `unsafe-path` including dangling or escaping symlinks,
13765
+ `too-large`, `invalid-manifest` including empty `assets` on `install.sh`,
13766
+ `identity-mismatch`, `untrusted-signature`, or `io-error`), the route fails
13767
+ closed with a distinct `503` carrying
13768
+ `x-stitchkit-cli-distribution-state: unavailable` (`CLI distribution is
13769
+ unavailable`), for which `isCliDistributionUnpublishedResponse(res)` always
13770
+ returns `false`. Exceptions thrown by `onUnavailable` are isolated.
13751
13771
 
13752
13772
  ### Proving who built it — signing the manifest
13753
13773
 
@@ -31853,7 +31873,11 @@ The server half, inside the application's own transaction. See the [sync guide](
31853
31873
 
31854
31874
  ## `stitchkit/postgres`
31855
31875
 
31856
- Server-only, peer-free PostgreSQL application helpers. Wraps any Prisma SQL driver adapter factory
31876
+ Server-only, peer-free PostgreSQL application helpers. `postgresConnectionConfig`
31877
+ surgically strips `?options=` from `DATABASE_URL` and merges URL options, config options,
31878
+ custom parameters, `searchPath`, and `timeZone` (default `'UTC'`) in startup-packet order
31879
+ for `PrismaPg` and `pg.Pool` without rewriting unrelated parameters or importing `pg`.
31880
+ `withSerializedPrismaTransactions` wraps any Prisma SQL driver adapter factory
31857
31881
  (such as `new PrismaPg(...)`) without importing `@prisma/adapter-pg` or `pg`, so statements inside
31858
31882
  each interactive transaction reach its single PostgreSQL connection one at a time while queries
31859
31883
  outside transactions and separate transactions stay parallel across the pool. See
@@ -31861,16 +31885,22 @@ outside transactions and separate transactions stay parallel across the pool. Se
31861
31885
 
31862
31886
  ```ts
31863
31887
  import { PrismaPg } from '@prisma/adapter-pg';
31864
- import { withSerializedPrismaTransactions } from 'stitchkit/postgres';
31888
+ import {
31889
+ postgresConnectionConfig,
31890
+ withSerializedPrismaTransactions,
31891
+ } from 'stitchkit/postgres';
31865
31892
 
31866
31893
  const adapter = withSerializedPrismaTransactions(
31867
- new PrismaPg({ connectionString: env.DATABASE_URL }),
31894
+ new PrismaPg(postgresConnectionConfig(env.DATABASE_URL)),
31868
31895
  );
31869
31896
  const prisma = new PrismaClient({ adapter });
31870
31897
  ```
31871
31898
 
31872
31899
  | Export | Kind | Summary |
31873
31900
  |--------|------|---------|
31901
+ | `postgresConnectionConfig` | function | build a `pg.PoolConfig` / `PrismaPg`-compatible config from a connection string or plain config object, stripping `?options=` surgically from the URL, validating raw fragments against `pg_split_opts` boundaries, and appending `parameters`, `searchPath` and `timeZone` (default `'UTC'`; `null` omits) so later startup flags win |
31902
+ | `PostgresConnectionConfig` | _type_ | minimal `{ connectionString, options? }` shape accepted and returned by `postgresConnectionConfig`, structurally compatible with `pg.PoolConfig` without importing `pg` |
31903
+ | `PostgresConnectionOptions` | _type_ | structured session options for `postgresConnectionConfig` (`timeZone`, `searchPath`, `parameters`) |
31874
31904
  | `withSerializedPrismaTransactions` | function | wraps a Prisma SQL driver adapter factory (`connect` and optional `connectToShadowDb`) so `queryRaw`, `executeRaw`, `commit`, `rollback` and savepoints inside each interactive transaction execute in strict FIFO order without overlapping on one connection; idempotent and fails fast with `TypeError` on non-factory inputs (such as a raw `pg.Pool`) |
31875
31905
  | `PrismaDriverAdapterFactory` | _type_ | minimal structural Prisma SQL driver adapter factory (`provider`, `adapterName`, `connect`, optional `connectToShadowDb`) accepted by `withSerializedPrismaTransactions` |
31876
31906
  | `PrismaDriverAdapter` | _type_ | minimal structural connected Prisma SQL driver adapter (`startTransaction`) |
@@ -32059,7 +32089,7 @@ SDK nor the `ai` peer.
32059
32089
  | `rollbackCliUpdate` / `CliRollbackConfig` / `RolledBackCliUpdate` | function / _types_ | put the kept previous build back, digest-checked first and written by the same atomic rename the update uses |
32060
32090
  | `signCliManifest` / `verifyCliManifest` / `cliManifestSigningPayload` | function | Ed25519 over `{name, version, commit, builtAt, assets[]}` — every asset's digest included, so the chain closes on the file that executes |
32061
32091
  | `cliSignatureAccepted` / `CliSignatureVerdict` | function / _type_ | `valid` \| `unenforced` \| `missing` \| `unknown-key` \| `invalid`; `unenforced` keeps an unpinned build updating while making the absence of a check visible |
32062
- | `CliTrustRoot` / `CliSigningKey` / `CliBuildSignature` / `CliBuildSignatureSchema` | _types_ / schema | the keys a build trusts, by id, and the detached signature a manifest carries |
32092
+ | `CliTrustRoot` / `CliTrustRootSchema` / `CliSigningKey` / `CliBuildSignature` / `CliBuildSignatureSchema` | _types_ / schemas | the keys a build trusts, by id (validated non-empty Ed25519 SPKI PEM or canonical 32-byte base64 via `CliTrustRootSchema`), and the detached signature a manifest carries |
32063
32093
  | `selectCliBuildAsset` | function | the asset for one target, or `undefined` |
32064
32094
  | `currentCliBuildTarget` | function | `{ platform, arch }` of the running process |
32065
32095
  | `formatCliBuildStamp` | function | one line saying what the running build is |
@@ -32131,9 +32161,12 @@ in `stitchkit/cli` — [guide](../guide/cli.md#publishing-a-complete-version),
32131
32161
  | `CliShippingInputsChangedOptions` | _type_ | options for `cliShippingInputsChanged` (`repository`, `previousCommit`, `nextCommit`, `shippingPaths`, `timeoutMs`, `signal`) |
32132
32162
  | `assertCleanCliSource` | function | verify a clean git root matching optional `expectedCommit`, optional `untrackedPaths` globs and optional `servingSource` realpath; returns verified 40-hex `HEAD` |
32133
32163
  | `CleanCliSourceOptions` | _type_ | options for `assertCleanCliSource` (`repository`, `expectedCommit`, `untrackedPaths`, `servingSource`, `timeoutMs`, `signal`) |
32134
- | `createCliDistributionRoutes` | function | portable `RawRoute[]` (`GET` only) serving verified signed channel manifests (`no-store`), immutable versioned manifests and descriptor-streamed binary assets, and `install.sh`, failing closed with `503 No verified CLI build is published` |
32164
+ | `createCliDistributionRoutes` | function | portable `RawRoute[]` (`GET` only) serving verified signed channel manifests (`no-store`), immutable versioned manifests and descriptor-streamed binary assets, and `install.sh`; returns `CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE` (`503`, `x-stitchkit-cli-distribution-state: unpublished`) only for a missing channel manifest and fails closed with `503` (`x-stitchkit-cli-distribution-state: unavailable`) on all configuration, path, integrity and signature faults |
32135
32165
  | `CliDistributionRoutesOptions` | _type_ | options for `createCliDistributionRoutes` (`root`, `name`, `trust`, `channels`, `installerChannel`, `basePath`, `binaryName`, `installDir`, `maxManifestBytes`, `serviceName`, `onUnavailable`) |
32136
32166
  | `CliDistributionUnavailableEvent` | _type_ | diagnostic event passed to `onUnavailable` with `route`, `channel`, optional `version`/`asset`, inline `reason`, optional `verdict` and `error` |
32167
+ | `CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE` | constant | frozen canonical HTTP response contract (`status: 503`, `header: 'x-stitchkit-cli-distribution-state'`, `headerValue: 'unpublished'`, `body: 'No verified CLI build is published'`) emitted only when a channel has no published manifest yet (`reason: 'missing'`) |
32168
+ | `CliDistributionUnpublishedResponse` | _type_ | readonly wire-contract type of `CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE` |
32169
+ | `isCliDistributionUnpublishedResponse` | function | synchronous, body-free predicate matching the exact `503` + `x-stitchkit-cli-distribution-state: unpublished` contract without consuming `response.body`, returning `false` for all fault and generic `503` responses |
32137
32170
 
32138
32171
  ---
32139
32172
 
package/llms.txt CHANGED
@@ -9,7 +9,7 @@ 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) 45.0 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 47.2 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 29.4 KB
12
+ - **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 45.3 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 47.2 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 29.4 KB
13
13
  - **stitchkit/live**: [llms/live.txt](llms/live.txt) 22.9 KB
14
14
  - **stitchkit/react**: [llms/react.txt](llms/react.txt) 8.7 KB
15
15
  - **stitchkit/react/keyboard**: [llms/react-keyboard.txt](llms/react-keyboard.txt) 22.7 KB
@@ -21,8 +21,8 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
21
21
  - **stitchkit/tools/contract**: [llms/tools-contract.txt](llms/tools-contract.txt) 0.2 KB
22
22
  - **stitchkit/tools/invoker**: [llms/tools-invoker.txt](llms/tools-invoker.txt) 0.2 KB
23
23
  - **stitchkit/tools/connections**: [llms/tools-connections.txt](llms/tools-connections.txt) 4.9 KB
24
- - **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 42.0 KB → [llms/cli.2.txt](llms/cli.2.txt) 47.0 KB → [llms/cli.3.txt](llms/cli.3.txt) 16.2 KB
25
- - **stitchkit/cli/publish**: [llms/cli-publish.txt](llms/cli-publish.txt) 3.6 KB
24
+ - **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 42.0 KB → [llms/cli.2.txt](llms/cli.2.txt) 46.9 KB → [llms/cli.3.txt](llms/cli.3.txt) 17.7 KB
25
+ - **stitchkit/cli/publish**: [llms/cli-publish.txt](llms/cli-publish.txt) 4.5 KB
26
26
  - **stitchkit/remote**: [llms/remote.txt](llms/remote.txt) 1.0 KB
27
27
  - **stitchkit/contract**: [llms/contract.txt](llms/contract.txt) 36.5 KB
28
28
  - **stitchkit/primitives**: [llms/primitives.txt](llms/primitives.txt) 15.2 KB
@@ -76,7 +76,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
76
76
  - **stitchkit/voice**: [llms/voice.txt](llms/voice.txt) 5.2 KB
77
77
  - **stitchkit/sync**: [llms/sync.txt](llms/sync.txt) 25.3 KB
78
78
  - **stitchkit/sync/postgres**: [llms/sync-postgres.txt](llms/sync-postgres.txt) 2.3 KB
79
- - **stitchkit/postgres**: [llms/postgres.txt](llms/postgres.txt) 2.1 KB
79
+ - **stitchkit/postgres**: [llms/postgres.txt](llms/postgres.txt) 3.2 KB
80
80
  - **stitchkit/oauth**: [llms/oauth.txt](llms/oauth.txt) 6.7 KB
81
81
  - **stitchkit/google**: [llms/google.txt](llms/google.txt) 1.4 KB
82
82
  - **stitchkit/declaration**: [llms/declaration.txt](llms/declaration.txt) 15.9 KB
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.136.7",
3
+ "version": "0.136.8",
4
4
  "description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
5
5
  "keywords": [
6
6
  "bun",
@@ -483,7 +483,7 @@
483
483
  "ky": "^2.2.0"
484
484
  },
485
485
  "devDependencies": {
486
- "@anthropic-ai/claude-agent-sdk": "0.3.332",
486
+ "@anthropic-ai/claude-agent-sdk": "0.3.336",
487
487
  "@happy-dom/global-registrator": "^21.0.4",
488
488
  "@modelcontextprotocol/client": "^2.4.0",
489
489
  "@modelcontextprotocol/ext-apps": "^2.0.4",
@@ -498,7 +498,7 @@
498
498
  "@types/react": "^19.3.3",
499
499
  "@types/react-dom": "^19.3.0",
500
500
  "@typescript/typescript6": "^6.0.2",
501
- "ai": "^7.0.185",
501
+ "ai": "^7.1.0",
502
502
  "ajv": "^8.20.0",
503
503
  "exceljs": "^4.4.0",
504
504
  "fake-indexeddb": "^6.2.8",