@byok-sdk/cloud 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  * The exact counterpart of `@byok-sdk/core`'s `ports-contract.ts`, and it exists
5
5
  * for the same reason: the table says what a port IS, so it has to be readable
6
6
  * by every enforcer without any of them owning it. `@byok-sdk/conformance` asserts
7
- * live compositions against it; a durable adapter (`@byok-sdk/cloud-postgres`) is
7
+ * live compositions against it; a durable adapter (`@byok-sdk/cloud-dataplane`) is
8
8
  * written against it.
9
9
  *
10
10
  * This module adds data and nothing else. It does not re-declare, re-shape, or
@@ -0,0 +1,38 @@
1
+ import { type BlobRef } from '@byok-sdk/protocol';
2
+ import type { RequestReceipt } from './stores/ports';
3
+ /**
4
+ * The typed terminal read model — the hosted counterpart of the embedded
5
+ * coordinator's `TaskResult`, projected off the receipt the inbound gate
6
+ * stores. Every field is copied verbatim from the payload the gate already
7
+ * zod-parsed before storing (`recordTerminal`, `inbound.ts`); this projection
8
+ * neither re-validates nor synthesizes one.
9
+ */
10
+ export interface TerminalResult {
11
+ readonly taskId: string;
12
+ readonly state: 'complete' | 'failed' | 'cancelled';
13
+ readonly summary?: string;
14
+ readonly sessionRef?: string;
15
+ readonly artifactRefs?: readonly BlobRef[];
16
+ /**
17
+ * The product's structured terminal result, verbatim `task.complete.document`.
18
+ * Absent — key missing, never null — when the daemon sent none, which covers
19
+ * both a legacy pre-`result-document` build and a daemon with no
20
+ * `resultDocument` extractor.
21
+ */
22
+ readonly document?: unknown;
23
+ readonly reason?: string;
24
+ readonly retryable?: boolean;
25
+ /** When the receipt store wrote the terminal fact — the first one, by its own first-write-wins rule. */
26
+ readonly recordedAt: string;
27
+ }
28
+ /**
29
+ * Pure projection of a terminal receipt onto {@link TerminalResult}. `taskId`
30
+ * names the task the receipt was read for (the receipt's key carries it, its
31
+ * body does not); `recordedAt` is the receipt store's write time.
32
+ *
33
+ * Fail closed on anything but a terminal envelope: the stored body is
34
+ * `encodeEnvelope` of what the inbound gate accepted, so an undecodable body
35
+ * or a non-terminal type means the receipt-store contract itself broke — an
36
+ * error, never a best-effort shape.
37
+ */
38
+ export declare function projectTerminalResult(taskId: string, receipt: RequestReceipt): TerminalResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byok-sdk/cloud",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "BYOK SDK hosted device surface: stateless frozen-v1 HTTP handlers over tenant-first @byok-sdk/core ports",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,8 +38,8 @@
38
38
  "dependencies": {
39
39
  "hono": "^4.12.30",
40
40
  "zod": "^4.4.3",
41
- "@byok-sdk/core": "0.3.0",
42
- "@byok-sdk/protocol": "0.3.0"
41
+ "@byok-sdk/core": "0.4.0",
42
+ "@byok-sdk/protocol": "0.4.0"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsup && tsc -p tsconfig.build.json",