@byok-sdk/cloud 0.18.0 → 0.19.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/dist/auth/device-assertion.d.ts +41 -1
- package/dist/capabilities.d.ts +43 -0
- package/dist/cloud.d.ts +47 -1
- package/dist/errors.d.ts +10 -0
- package/dist/handlers/input-preparations.d.ts +17 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +355 -8
- package/dist/index.js.map +1 -1
- package/dist/input-preparations.d.ts +42 -0
- package/package.json +3 -3
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable remote input-preparation facts.
|
|
3
|
+
*
|
|
4
|
+
* Exactly the composition `agent-home-projections.ts` uses, for exactly the
|
|
5
|
+
* same reason: the desired request and the terminal completion are two
|
|
6
|
+
* IMMUTABLE first-write-wins receipts in the tenant-scoped receipt store, so
|
|
7
|
+
* this module needs no second mutable authority merely to survive a restart,
|
|
8
|
+
* and a replayed write is decided by comparing bodies rather than by trusting
|
|
9
|
+
* whichever writer arrived last.
|
|
10
|
+
*
|
|
11
|
+
* The one idempotency key is `(deviceId, agentRef, requestId)`, minted by the
|
|
12
|
+
* Host and carried unchanged through the cloud receipt, the device's durable
|
|
13
|
+
* namespace and the completion. A Host that times out therefore RE-READS
|
|
14
|
+
* status; it never mints a second requestId for the same turn, which is what
|
|
15
|
+
* keeps a duplicate from becoming a second counter call downstream.
|
|
16
|
+
*/
|
|
17
|
+
import { type AgentInputPreparationPayload, type InputPreparationCompletionRequest, type InputPreparationReadback } from '@byok-sdk/protocol';
|
|
18
|
+
import type { TenantId } from '@byok-sdk/core';
|
|
19
|
+
import type { TenantBoundReceipts } from './tenant-stores';
|
|
20
|
+
/** Exact request identity a host must echo to read back durable preparation status. */
|
|
21
|
+
export interface InputPreparationReceiptInput {
|
|
22
|
+
readonly requestId: string;
|
|
23
|
+
readonly agentRef: AgentInputPreparationPayload['agentRef'];
|
|
24
|
+
}
|
|
25
|
+
export declare function inputPreparationRequestKey(deviceId: string, agentRef: AgentInputPreparationPayload['agentRef'], requestId: string): string;
|
|
26
|
+
export declare function inputPreparationCompletionKey(deviceId: string, agentRef: AgentInputPreparationPayload['agentRef'], requestId: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Whole-body equality, not a field subset.
|
|
29
|
+
*
|
|
30
|
+
* The desired fact is the ENTIRE authorized request — source digest, model
|
|
31
|
+
* selection, deadline, context and required toolsets alike. Comparing only the
|
|
32
|
+
* identity fields would let the same requestId silently re-bind to a different
|
|
33
|
+
* model, a different context or a looser deadline, which is precisely the
|
|
34
|
+
* substitution the immutable receipt exists to prevent. Both sides are already
|
|
35
|
+
* schema-parsed, so key order is the only degree of freedom left, and the
|
|
36
|
+
* stored body is re-serialized from a parse for that reason.
|
|
37
|
+
*/
|
|
38
|
+
export declare function sameInputPreparationRequest(expected: AgentInputPreparationPayload, actual: AgentInputPreparationPayload): boolean;
|
|
39
|
+
export declare function receiptMatchesInputPreparation(request: AgentInputPreparationPayload, receipt: InputPreparationCompletionRequest): boolean;
|
|
40
|
+
export declare function statusInputMatchesInputPreparation(request: AgentInputPreparationPayload, input: InputPreparationReceiptInput): boolean;
|
|
41
|
+
export declare function readInputPreparationStatus(receipts: TenantBoundReceipts, tenant: TenantId, deviceId: string, input: InputPreparationReceiptInput): Promise<InputPreparationReadback | undefined>;
|
|
42
|
+
export declare function recordInputPreparationCompletion(receipts: TenantBoundReceipts, tenant: TenantId, deviceId: string, receiptInput: InputPreparationCompletionRequest): Promise<InputPreparationReadback>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byok-sdk/cloud",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.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",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"clean": "rm -rf dist"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@byok-sdk/core": "0.
|
|
48
|
-
"@byok-sdk/protocol": "0.
|
|
47
|
+
"@byok-sdk/core": "0.19.0",
|
|
48
|
+
"@byok-sdk/protocol": "0.19.0",
|
|
49
49
|
"hono": "^4.12.30",
|
|
50
50
|
"zod": "^4.4.3"
|
|
51
51
|
}
|