@byok-sdk/cloud 0.2.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.
- package/README.md +44 -1
- package/dist/auth/verify.d.ts +1 -20
- package/dist/capabilities.d.ts +18 -0
- package/dist/cloud.d.ts +33 -2
- package/dist/composition/in-memory.d.ts +9 -1
- package/dist/errors.d.ts +10 -5
- package/dist/handlers/skill-packs.d.ts +33 -0
- package/dist/handlers/truth.d.ts +2 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.js +209 -85
- package/dist/index.js.map +1 -1
- package/dist/stores/in-memory/index.d.ts +0 -1
- package/dist/stores/ports-contract.d.ts +1 -1
- package/dist/stores/ports.d.ts +1 -16
- package/dist/tenant-stores.d.ts +0 -4
- package/dist/terminal-result.d.ts +38 -0
- package/package.json +3 -3
- package/dist/stores/in-memory/sequence.d.ts +0 -11
|
@@ -14,7 +14,6 @@ export { BLOB_URL_TTL_MS, InMemoryBlobContentProxy, InMemoryCloudBlobStore, crea
|
|
|
14
14
|
export type { InMemoryBlobs, InMemoryBlobStoreOptions } from './blobs';
|
|
15
15
|
export { DEDUP_RING_CAPACITY, InMemoryInboundDedupStore } from './dedup';
|
|
16
16
|
export { InMemoryDeviceDirectory } from './device-directory';
|
|
17
|
-
export { InMemoryDeviceSequenceStore } from './sequence';
|
|
18
17
|
export { InMemoryNonceStore, NONCE_TTL_MS } from './nonces';
|
|
19
18
|
export { InMemoryPairingCodeStore } from './pairing-codes';
|
|
20
19
|
export { InMemoryRequestReceiptStore } from './receipts';
|
|
@@ -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-
|
|
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
|
package/dist/stores/ports.d.ts
CHANGED
|
@@ -191,20 +191,6 @@ export interface ProofRequestReceiptStore {
|
|
|
191
191
|
}>;
|
|
192
192
|
get(tenant: TenantId, deviceId: string, requestId: string): Promise<ProofRequestReceipt | undefined>;
|
|
193
193
|
}
|
|
194
|
-
/**
|
|
195
|
-
* The daemon's redelivery cursor is the envelope-level `seq`, which has to be
|
|
196
|
-
* baked into the envelope BEFORE it can be handed to `MailboxStore.append` —
|
|
197
|
-
* the mailbox transports opaque bytes and cannot number an envelope it is
|
|
198
|
-
* being given. So the delivery number is allocated here first, and the
|
|
199
|
-
* enqueue path then asserts the mailbox agreed (`mailbox_seq_mismatch`)
|
|
200
|
-
* rather than letting two counters drift apart silently.
|
|
201
|
-
*
|
|
202
|
-
* A port rather than a counter held by the composition, so no handler-adjacent
|
|
203
|
-
* module carries mutable state (S3.5 boxes 14-15).
|
|
204
|
-
*/
|
|
205
|
-
export interface DeviceSequenceStore {
|
|
206
|
-
next(tenant: TenantId, deviceId: string): Promise<number>;
|
|
207
|
-
}
|
|
208
194
|
export interface BlobDeclaration {
|
|
209
195
|
readonly size: number;
|
|
210
196
|
readonly contentType: string;
|
|
@@ -300,10 +286,9 @@ export interface CloudStores {
|
|
|
300
286
|
readonly tasks: TaskAttemptStore;
|
|
301
287
|
readonly receipts: RequestReceiptStore;
|
|
302
288
|
readonly proofReceipts: ProofRequestReceiptStore;
|
|
303
|
-
readonly sequence: DeviceSequenceStore;
|
|
304
289
|
readonly blobs: CloudBlobStore;
|
|
305
290
|
readonly rateLimiter: InboundRateLimiter;
|
|
306
291
|
}
|
|
307
292
|
/** Names of the ports in {@link CloudStores}, in contract order. */
|
|
308
|
-
export declare const CLOUD_STORE_NAMES: readonly ['devices', 'pairingCodes', 'nonces', 'dedup', 'tasks', 'receipts', 'proofReceipts', '
|
|
293
|
+
export declare const CLOUD_STORE_NAMES: readonly ['devices', 'pairingCodes', 'nonces', 'dedup', 'tasks', 'receipts', 'proofReceipts', 'blobs', 'rateLimiter'];
|
|
309
294
|
export type CloudStoreName = (typeof CLOUD_STORE_NAMES)[number];
|
package/dist/tenant-stores.d.ts
CHANGED
|
@@ -94,9 +94,6 @@ export interface TenantBoundQuota {
|
|
|
94
94
|
finalizeReservation(input: StorageFinalizeInput): Promise<StorageFinalizeResult>;
|
|
95
95
|
abortReservation(reservationId: string): Promise<StorageReservation>;
|
|
96
96
|
}
|
|
97
|
-
export interface TenantBoundSequence {
|
|
98
|
-
next(deviceId: string): Promise<number>;
|
|
99
|
-
}
|
|
100
97
|
export interface TenantBoundRateLimiter {
|
|
101
98
|
consume(deviceId: string): Promise<boolean>;
|
|
102
99
|
}
|
|
@@ -113,7 +110,6 @@ export interface TenantStores {
|
|
|
113
110
|
readonly receipts: TenantBoundReceipts;
|
|
114
111
|
readonly blobs: TenantBoundBlobs;
|
|
115
112
|
readonly quota: TenantBoundQuota;
|
|
116
|
-
readonly sequence: TenantBoundSequence;
|
|
117
113
|
readonly rateLimiter: TenantBoundRateLimiter;
|
|
118
114
|
}
|
|
119
115
|
/** Every naked store a composition supplies. Only {@link tenantStoresFor} reads this. */
|
|
@@ -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
|
+
"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/
|
|
42
|
-
"@byok-sdk/
|
|
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",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* In-memory {@link DeviceSequenceStore}: a monotonic per-(tenant, device)
|
|
3
|
-
* delivery counter starting at 1, matching what a mailbox numbers its first
|
|
4
|
-
* row.
|
|
5
|
-
*/
|
|
6
|
-
import { type TenantId } from '@byok-sdk/core';
|
|
7
|
-
import type { DeviceSequenceStore } from '../ports';
|
|
8
|
-
export declare class InMemoryDeviceSequenceStore implements DeviceSequenceStore {
|
|
9
|
-
#private;
|
|
10
|
-
next(tenant: TenantId, deviceId: string): Promise<number>;
|
|
11
|
-
}
|