stitchkit 0.136.6 → 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.
Files changed (34) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/entrypoints/cli/publish.d.ts +4 -4
  3. package/dist/entrypoints/cli/publish.d.ts.map +1 -1
  4. package/dist/entrypoints/cli/publish.js +154 -46
  5. package/dist/entrypoints/cli.d.ts +1 -1
  6. package/dist/entrypoints/cli.d.ts.map +1 -1
  7. package/dist/entrypoints/cli.js +3 -1
  8. package/dist/entrypoints/postgres.d.ts +8 -0
  9. package/dist/entrypoints/postgres.d.ts.map +1 -0
  10. package/dist/entrypoints/postgres.js +380 -0
  11. package/dist/{index-f103md2v.js → index-3zt0r4y0.js} +84 -19
  12. package/dist/postgres/connection-config.d.ts +54 -0
  13. package/dist/postgres/connection-config.d.ts.map +1 -0
  14. package/dist/postgres/serialize-prisma.d.ts +40 -0
  15. package/dist/postgres/serialize-prisma.d.ts.map +1 -0
  16. package/dist/tools/cli/distribution-config.d.ts +39 -1
  17. package/dist/tools/cli/distribution-config.d.ts.map +1 -1
  18. package/dist/tools/cli/distribution-routes.d.ts +4 -2
  19. package/dist/tools/cli/distribution-routes.d.ts.map +1 -1
  20. package/dist/tools/cli/publication-contract.d.ts +9 -2
  21. package/dist/tools/cli/publication-contract.d.ts.map +1 -1
  22. package/dist/tools/cli/publication.d.ts.map +1 -1
  23. package/dist/tools/cli/signature.d.ts +23 -9
  24. package/dist/tools/cli/signature.d.ts.map +1 -1
  25. package/dist/tools/cli/update.d.ts +6 -1
  26. package/dist/tools/cli/update.d.ts.map +1 -1
  27. package/llms/cli-publish.txt +4 -1
  28. package/llms/cli.2.txt +32 -43
  29. package/llms/cli.3.txt +32 -1
  30. package/llms/postgres.txt +47 -0
  31. package/llms/stitchkit.txt +3 -1
  32. package/llms-full.txt +77 -15
  33. package/llms.txt +4 -3
  34. package/package.json +7 -3
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Configuration validation and safe path matching for `createCliDistributionRoutes`.
3
3
  */
4
- import type { CliSignatureVerdict, CliTrustRoot } from './signature.js';
4
+ import { type CliSignatureVerdict, type CliTrustRoot } from './signature.js';
5
5
  export declare const SAFE_ASSET_SEGMENT: RegExp;
6
6
  /** Diagnostic event emitted when a CLI distribution route responds with 503 or 404. */
7
7
  export interface CliDistributionUnavailableEvent {
@@ -52,5 +52,43 @@ export interface ResolvedDistributionConfig {
52
52
  readonly onUnavailable: ((event: CliDistributionUnavailableEvent) => void) | undefined;
53
53
  }
54
54
  export declare function resolveDistributionConfig(options: CliDistributionRoutesOptions): ResolvedDistributionConfig;
55
+ export declare const DISTRIBUTION_STATE_HEADER = "x-stitchkit-cli-distribution-state";
56
+ export declare const UNPUBLISHED_STATE = "unpublished";
57
+ export declare const UNAVAILABLE_STATE = "unavailable";
58
+ export declare const UNPUBLISHED_BODY = "No verified CLI build is published";
59
+ export declare const UNAVAILABLE_BODY = "CLI distribution is unavailable";
60
+ /**
61
+ * Wire contract returned by {@link createCliDistributionRoutes} on channel manifest and installer
62
+ * routes when a channel has no published manifest yet (`reason: 'missing'`).
63
+ *
64
+ * Integrity, signature, path, I/O and configuration failures deliberately return a distinct `503`
65
+ * response without `headerValue: 'unpublished'` so external probes and gates never mistake a
66
+ * broken or tampered channel for an empty one.
67
+ */
68
+ export interface CliDistributionUnpublishedResponse {
69
+ readonly status: 503;
70
+ readonly header: 'x-stitchkit-cli-distribution-state';
71
+ readonly headerValue: 'unpublished';
72
+ readonly body: 'No verified CLI build is published';
73
+ }
74
+ /**
75
+ * Canonical HTTP response contract for an unpublished (empty) CLI distribution channel.
76
+ */
77
+ export declare const CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE: CliDistributionUnpublishedResponse;
78
+ /**
79
+ * True when an HTTP response carries the exact status and state header emitted by
80
+ * {@link createCliDistributionRoutes} for a genuinely empty (not yet published) CLI channel.
81
+ *
82
+ * Synchronous and body-free: never consumes `response.body`, and returns `false` for all
83
+ * integrity, signature, path, configuration, proxy or generic `503` responses.
84
+ */
85
+ export declare function isCliDistributionUnpublishedResponse(response: {
86
+ readonly status: number;
87
+ readonly headers: {
88
+ get(name: string): string | null;
89
+ };
90
+ }): boolean;
91
+ /** True when `trust` passes {@link CliTrustRootSchema} (non-empty valid Ed25519 keys). */
92
+ export declare function hasUsableTrustKeys(trust: CliTrustRoot): boolean;
55
93
  export declare function assetMatchesUrl(entryUrl: string, asset: string): boolean;
56
94
  //# sourceMappingURL=distribution-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"distribution-config.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/distribution-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AASrE,eAAO,MAAM,kBAAkB,QAAiC,CAAC;AAKjE,uFAAuF;AACvF,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,kBAAkB,GAAG,OAAO,GAAG,WAAW,CAAC;IACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EACX,mBAAmB,GACnB,kBAAkB,GAClB,SAAS,GACT,aAAa,GACb,WAAW,GACX,kBAAkB,GAClB,mBAAmB,GACnB,qBAAqB,GACrB,gBAAgB,GAChB,UAAU,CAAC;IACf,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,6DAA6D;AAC7D,MAAM,WAAW,4BAA4B;IAC3C,qGAAqG;IACrG,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,sFAAsF;IACtF,QAAQ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ED,eAAO,MAAM,yBAAyB,uCAAuC,CAAC;AAC9E,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C,eAAO,MAAM,gBAAgB,uCAAuC,CAAC;AACrE,eAAO,MAAM,gBAAgB,oCAAoC,CAAC;AAElE;;;;;;;GAOG;AACH,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,oCAAoC,CAAC;IACtD,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,oCAAoC,CAAC;CACrD;AAED;;GAEG;AACH,eAAO,MAAM,qCAAqC,EAAE,kCAMhD,CAAC;AAEL;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAAC,QAAQ,EAAE;IAC7D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CACxD,GAAG,OAAO,CAQV;AAED,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAE/D;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAexE"}
@@ -13,8 +13,10 @@ import { type CliDistributionRoutesOptions } from './distribution-config.js';
13
13
  /**
14
14
  * Create portable `RawRoute[]` handlers serving signed CLI channel manifests, immutable
15
15
  * versioned manifests and binary assets, and `install.sh` (`GET` only, full-body descriptor
16
- * streaming). Fails closed with `503 No verified CLI build is published` when unconfigured,
17
- * missing, unsigned, or untrusted.
16
+ * streaming). Returns {@link CLI_DISTRIBUTION_UNPUBLISHED_RESPONSE} (`503` with
17
+ * `x-stitchkit-cli-distribution-state: unpublished`) only when a channel has no published
18
+ * manifest yet (`reason: 'missing'`); all configuration, path, integrity and signature
19
+ * failures fail closed with a distinct `503` (`x-stitchkit-cli-distribution-state: unavailable`).
18
20
  */
19
21
  export declare function createCliDistributionRoutes(options: CliDistributionRoutesOptions): RawRoute[];
20
22
  //# sourceMappingURL=distribution-routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"distribution-routes.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/distribution-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAEL,KAAK,4BAA4B,EAKlC,MAAM,uBAAuB,CAAC;AAuS/B;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,4BAA4B,GACpC,QAAQ,EAAE,CAwCZ"}
1
+ {"version":3,"file":"distribution-routes.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/distribution-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAGL,KAAK,4BAA4B,EASlC,MAAM,uBAAuB,CAAC;AAsX/B;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,4BAA4B,GACpC,QAAQ,EAAE,CAwCZ"}
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { type CliBuildStamp, type CliBuildTarget } from './manifest.js';
3
- import type { CliSigningKey, CliTrustRoot } from './signature.js';
3
+ import { type CliSigningKey, type CliTrustRoot } from './signature.js';
4
4
  export declare const PublicationTargetSchema: z.ZodObject<{
5
5
  platform: z.ZodString;
6
6
  arch: z.ZodString;
@@ -75,7 +75,14 @@ export type CliPublicationOptions = Omit<z.input<typeof dataSchema>, 'limits' |
75
75
  };
76
76
  trust?: CliTrustRoot;
77
77
  };
78
- export type PublicationData = z.infer<typeof dataSchema>;
78
+ export interface PublicationSigningSnapshot {
79
+ readonly keyId: string;
80
+ readonly privateKey: CliSigningKey;
81
+ }
82
+ export type PublicationData = z.infer<typeof dataSchema> & {
83
+ readonly trust?: CliTrustRoot;
84
+ readonly signing?: PublicationSigningSnapshot;
85
+ };
79
86
  export declare function publicationData(options: CliPublicationOptions): PublicationData;
80
87
  export declare function assetFilename(name: string, target: CliBuildTarget): string;
81
88
  export declare function assetUrl(baseUrl: string, version: string, filename: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"publication-contract.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/publication-contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,cAAc,EAEpB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK/D,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AACH,eAAO,MAAM,wBAAwB,aAiBmB,CAAC;AACzD,QAAA,MAAM,YAAY;;;;;;;;;iBAShB,CAAC;AACH,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;iBAsBd,CAAC;AACH,QAAA,MAAM,WAAW;;;;;EAAoD,CAAC;AACtE;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAC9D;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,GAAG;IAC3F,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IACnC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;IACtC,iFAAiF;IACjF,KAAK,CAAC,KAAK,EAAE;QACX,KAAK,EAAE,mBAAmB,CAAC;QAC3B,Q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,wBAAsB,UAAU,CAC9B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAU/B"}
1
+ {"version":3,"file":"publication.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/publication.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,OAAO,EAGL,KAAK,qBAAqB,EAI3B,MAAM,wBAAwB,CAAC;AAoBhC,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAEzF,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGhB,CAAC;AACH;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAwThE;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAU/B"}
@@ -31,15 +31,29 @@ export type CliBuildSignature = z.infer<typeof CliBuildSignatureSchema>;
31
31
  * to remove.
32
32
  */
33
33
  export type CliSignatureVerdict = 'valid' | 'unenforced' | 'missing' | 'unknown-key' | 'invalid';
34
- /** The keys a build trusts, by id. A build with none enforces nothing. */
35
- export interface CliTrustRoot {
36
- /**
37
- * `keyId` → public key, as SPKI PEM or base64 of the raw 32-byte Ed25519 key.
38
- * Compiled into the binary: a trust root fetched at runtime from the same
39
- * origin as the manifest proves nothing.
40
- */
41
- keys: Readonly<Record<string, string>>;
42
- }
34
+ /**
35
+ * Schema for the keys a build trusts, by id.
36
+ *
37
+ * Requires at least one valid Ed25519 SPKI PEM or 32-byte base64 public key and rejects
38
+ * empty, padded, or prototype-polluting key ids.
39
+ */
40
+ export declare const CliTrustRootSchema: z.ZodObject<{
41
+ keys: z.ZodPipe<z.ZodUnknown, z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>>;
42
+ }, z.core.$strict>;
43
+ /** The keys a build trusts, by id. Enforce non-empty keys with {@link CliTrustRootSchema}. */
44
+ export type CliTrustRoot = z.infer<typeof CliTrustRootSchema>;
45
+ /** True when a trust key id is a prototype property name that must be refused. */
46
+ export declare function isUnsafeTrustKeyId(keyId: string): boolean;
47
+ /**
48
+ * True when `trust` is an explicit empty `{ keys: {} }` root with no own prototype-polluting
49
+ * keys — the documented ADR 0193 unenforced update posture.
50
+ */
51
+ export declare function isUnenforcedEmptyTrustRoot(trust: unknown): boolean;
52
+ /**
53
+ * Return an immutable null-prototype snapshot of a trust root so caller mutation
54
+ * after validation cannot alter signature checks mid-operation.
55
+ */
56
+ export declare function freezeTrustRoot(trust: CliTrustRoot): CliTrustRoot;
43
57
  /**
44
58
  * The exact bytes a signature covers.
45
59
  *
@@ -1 +1 @@
1
- {"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/signature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,iFAAiF;AACjF,eAAO,MAAM,uBAAuB;;;;iBAMlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAC3B,OAAO,GACP,YAAY,GACZ,SAAS,GACT,aAAa,GACb,SAAS,CAAC;AAEd,0EAA0E;AAC1E,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACxC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAkB5E;AAgBD;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAA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H,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAMjE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAkB5E;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,UAAU,CAAC;AAEhD,oFAAoF;AACpF,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,aAAa,CAAA;CAAE,GACpD,iBAAiB,CAenB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,iBAAiB,GAAG,SAAS,EACxC,KAAK,CAAC,EAAE,YAAY,GACnB,mBAAmB,CAiBrB;AAED,mEAAmE;AACnE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAE1E"}
@@ -82,7 +82,12 @@ export interface CliUpdateApplyConfig {
82
82
  * it downloads anything.
83
83
  */
84
84
  manifest?: CliBuildManifest;
85
- /** Keys this build trusts. With `manifest`, the pair is checked before the fetch. */
85
+ /**
86
+ * Keys this build trusts. When `trust.keys` is non-empty, the trust root is validated with
87
+ * {@link CliTrustRootSchema}, frozen, and the manifest signature plus every signed asset field
88
+ * (`sha256`, `size`, `compression`, `platform`, `arch`) are verified before the fetch. An
89
+ * explicit empty `{ keys: {} }` retains the documented `'unenforced'` behaviour (ADR 0193).
90
+ */
86
91
  trust?: CliTrustRoot;
87
92
  /**
88
93
  * Keep the bytes being replaced, here, so there is something to go back to.
@@ -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,CAA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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 |
@@ -0,0 +1,47 @@
1
+ # stitchkit/postgres — stitchkit docs slice
2
+
3
+ > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
+ > `llms.txt` in this package.
5
+
6
+ Contains: API reference: `stitchkit/postgres` (docs/api/reference.md)
7
+
8
+ ==============================================================================
9
+ # API reference: `stitchkit/postgres` (docs/api/reference.md)
10
+ ==============================================================================
11
+
12
+ ## `stitchkit/postgres`
13
+
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
19
+ (such as `new PrismaPg(...)`) without importing `@prisma/adapter-pg` or `pg`, so statements inside
20
+ each interactive transaction reach its single PostgreSQL connection one at a time while queries
21
+ outside transactions and separate transactions stay parallel across the pool. See
22
+ [ADR 0344](../decisions/0344-peer-free-prisma-transaction-serialization.md).
23
+
24
+ ```ts
25
+ import { PrismaPg } from '@prisma/adapter-pg';
26
+ import {
27
+ postgresConnectionConfig,
28
+ withSerializedPrismaTransactions,
29
+ } from 'stitchkit/postgres';
30
+
31
+ const adapter = withSerializedPrismaTransactions(
32
+ new PrismaPg(postgresConnectionConfig(env.DATABASE_URL)),
33
+ );
34
+ const prisma = new PrismaClient({ adapter });
35
+ ```
36
+
37
+ | Export | Kind | Summary |
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`) |
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`) |
43
+ | `PrismaDriverAdapterFactory` | _type_ | minimal structural Prisma SQL driver adapter factory (`provider`, `adapterName`, `connect`, optional `connectToShadowDb`) accepted by `withSerializedPrismaTransactions` |
44
+ | `PrismaDriverAdapter` | _type_ | minimal structural connected Prisma SQL driver adapter (`startTransaction`) |
45
+ | `PrismaDriverTransaction` | _type_ | minimal structural interactive transaction handle (`queryRaw`, `executeRaw`, `commit`, `rollback` and optional savepoints) |
46
+
47
+ ---
@@ -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,6 +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 — `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 |
101
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 |
102
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` |
103
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 |
@@ -259,6 +260,7 @@ map — feature → packages:
259
260
  | Anthropic native provider (`stitchkit/agent-runtime/anthropic`) | — (peer-free) |
260
261
  | AI SDK runtime adapter (`stitchkit/agent-runtime/ai-sdk`) | `ai` |
261
262
  | Postgres agent store (`stitchkit/agent-runtime/postgres`) | — (the application's own Postgres client) |
263
+ | Postgres connection options and Prisma transaction serializer (`stitchkit/postgres`) | — (peer-free; composes with `pg.Pool` and Prisma SQL driver adapters) |
262
264
  | SQLite agent store (`stitchkit/agent-runtime/sqlite/bun` or `/node`) | — (runtime built-in) |
263
265
  | Agent executor — Claude Agent SDK leaf (`stitchkit/agent-executor/claude-sdk`) | `@anthropic-ai/claude-agent-sdk` |
264
266
  | Agent executor — consumer testing kit (`stitchkit/agent-executor/testing`) | — |