@byok-sdk/cloud 0.22.0 → 0.23.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.
@@ -73,7 +73,7 @@ export declare const CLOUD_CAPABILITIES: {
73
73
  * DEVICE's only way to discharge a mailbox row this same deployment handed
74
74
  * it — withholding it would strand the device's redelivery cursor rather
75
75
  * than degrade a feature. For the same reason the completion route asserts
76
- * no DEVICE capability either: the device-level `agent-input-preparation-v7`
76
+ * no DEVICE capability either: the device-level `agent-input-preparation-v8`
77
77
  * flag gates ADMISSION (`enqueueInputPreparation`) and nothing else, so an
78
78
  * unconfigured device is refused a row instead of being handed one whose
79
79
  * only honest answer — `input_preparation_unconfigured` — it could not then
package/dist/cloud.d.ts CHANGED
@@ -19,7 +19,7 @@ import { type RecurringExecutionInput } from './recurring';
19
19
  import { type BoardItem, type BoardItemInput, type BoardListQuery, type BoardPage, type CapabilityDeclaration, type Clock, type CoreStores, type PresenceHint, type SkillPackStore, type TenantId, type TenantReadiness } from '@byok-sdk/core';
20
20
  import type { ActivityTail } from './activity';
21
21
  import type { ApprovalTimelineTail } from './approval-timeline';
22
- import { type Envelope, type TaskOfferType, type AgentRef, type AgentContentReadPayload, type AgentMessageDispositionPayload, type AgentMessagePublishPayload, type AgentMessageServerContext, type AgentHomeProjectionCompletionRequest, type AgentHomeProjectionPayload, type AgentHomeProjectionReadback, type AgentInputPreparationPayload, type InputPreparationCompletionRequest, type InputPreparationReadback, type AgentMemoryProjectionEraseResult, type TaskOfferPayload, type TaskSteerPayload, type TaskOfferForAgentPayload, type TaskOfferPreparedPayload, type TaskOfferForAgentWithEgressPayload, type TaskOfferForAgentWithEgressFreshPayload, type TaskOfferWithToolsetsPayload } from '@byok-sdk/protocol';
22
+ import { type Envelope, type TaskOfferType, type AgentRef, type AgentContentReadPayload, type AgentMessageDispositionPayload, type AgentMessagePublishPayload, type AgentMessageServerContext, type AgentHomeProjectionCompletionRequest, type AgentHomeProjectionPayload, type AgentHomeProjectionReadback, type AgentInputPreparationPayload, type ProviderProvisioningAvailablePayload, type InputPreparationCompletionRequest, type InputPreparationReadback, type AgentMemoryProjectionEraseResult, type TaskOfferPayload, type TaskSteerPayload, type TaskOfferForAgentPayload, type TaskOfferPreparedPayload, type TaskOfferForAgentWithEgressPayload, type TaskOfferForAgentWithEgressFreshPayload, type TaskOfferWithToolsetsPayload } from '@byok-sdk/protocol';
23
23
  import type { TokenSigner } from './auth/tokens';
24
24
  import type { CloudCrypto } from './crypto/port';
25
25
  import { type RouteDescriptor } from './router/registry';
@@ -197,6 +197,12 @@ export interface AgentContentReadInput {
197
197
  }
198
198
  /** Task-free exact-device projection desired state, intentionally unrelated to TaskAttempt. */
199
199
  export type AgentHomeProjectionInput = AgentHomeProjectionPayload;
200
+ /**
201
+ * Task-free sealed provider provisioning notice: exactly `{ requestId }`. The
202
+ * sealed request itself stays in the Host's own store and is fetched by the
203
+ * device over Host routes; nothing else can be carried by this input.
204
+ */
205
+ export type ProviderProvisioningNoticeInput = ProviderProvisioningAvailablePayload;
200
206
  /** Exact request identity a host must echo to read back durable projection status. */
201
207
  export type AgentHomeProjectionStatusInput = AgentHomeProjectionReceiptInput;
202
208
  /** Task-free exact-device remote preparation request, intentionally unrelated to TaskAttempt. */
@@ -285,7 +291,7 @@ export interface ByokCloud {
285
291
  * Host control plane: enqueue an offer for an already-counted preparation.
286
292
  *
287
293
  * Admission requires the device to durably advertise both the Agent-home
288
- * contract and `agent-input-preparation-v7` — the second because only a device
294
+ * contract and `agent-input-preparation-v8` — the second because only a device
289
295
  * that can prepare holds the durable record this offer names. A device that
290
296
  * advertises neither never receives the message, and a device whose protocol
291
297
  * build predates the type skips it whole rather than running it as an
@@ -320,6 +326,19 @@ export interface ByokCloud {
320
326
  * and NO delivery row behind.
321
327
  */
322
328
  enqueueInputPreparation(tenant: TenantId, deviceId: string, input: InputPreparationInput): Promise<EnqueuedInputPreparation>;
329
+ /**
330
+ * Durable, task-free `provider.provisioning.available` notice for precisely
331
+ * one device that durably advertised `provider-provisioning.v1`. The payload
332
+ * is validated strictly before admission, and admission happens before the
333
+ * mailbox append, so a refused call leaves no delivery row behind.
334
+ *
335
+ * Idempotent per (tenant, device, requestId): the mailbox message id is
336
+ * derived from that identity, so a retried enqueue returns the existing row
337
+ * and its seq instead of appending a second notice. The completion and its
338
+ * durable readback are Host authority on Host routes; this plane records no
339
+ * provisioning receipt of its own.
340
+ */
341
+ enqueueProviderProvisioningNotice(tenant: TenantId, deviceId: string, input: ProviderProvisioningNoticeInput): Promise<EnqueuedAgentControl>;
323
342
  /** Tenant/device/request-bound durable desired-state and terminal-outcome readback. */
324
343
  getInputPreparationStatus(tenant: TenantId, deviceId: string, input: InputPreparationStatusInput): Promise<InputPreparationReadback | undefined>;
325
344
  /** Direct device completion endpoint authority; first exact terminal receipt wins. */
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ export { isTenantId, tenantId } from '@byok-sdk/core';
16
16
  export type { TenantId } from '@byok-sdk/core';
17
17
  export { createByokCloud } from './cloud';
18
18
  export type { TaskAgentMessage } from './task-agent-message';
19
- export type { ByokCloud, ByokCloudOptions, AgentDispatchInput, AgentEgressDispatchInput, AgentEgressFreshSessionDispatchInput, AgentContentReadInput, AgentHomeProjectionInput, AgentHomeProjectionStatusInput, InputPreparationInput, InputPreparationStatusInput, ApproveTaskOptions, EnqueueOfferInput, EnqueueToolsetOfferInput, RejectTaskOptions, EnqueuedAgentControl, EnqueuedAgentHomeProjection, EnqueuedInputPreparation, EnqueuedOffer, TaskOfferReadback, } from './cloud';
19
+ export type { ByokCloud, ByokCloudOptions, AgentDispatchInput, AgentEgressDispatchInput, AgentEgressFreshSessionDispatchInput, AgentContentReadInput, AgentHomeProjectionInput, ProviderProvisioningNoticeInput, AgentHomeProjectionStatusInput, InputPreparationInput, InputPreparationStatusInput, ApproveTaskOptions, EnqueueOfferInput, EnqueueToolsetOfferInput, RejectTaskOptions, EnqueuedAgentControl, EnqueuedAgentHomeProjection, EnqueuedInputPreparation, EnqueuedOffer, TaskOfferReadback, } from './cloud';
20
20
  export { agentHomeProjectionCompletionKey, agentHomeProjectionRequestKey, readAgentHomeProjectionStatus, recordAgentHomeProjectionCompletion, } from './agent-home-projections';
21
21
  export type { AgentHomeProjectionReceiptInput } from './agent-home-projections';
22
22
  export { inputPreparationCompletionKey, inputPreparationRequestKey, readInputPreparationStatus, recordInputPreparationCompletion, sameInputPreparationRequest, } from './input-preparations';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BOARD_STATUSES, CapabilityDeclarationSchema, NONCE_SIGNING_DOMAIN, hasCapability, isTenantId, tenantId, principalTenant, parseDeviceProofEnvelope, deviceProofSigningInput, contentHash, parseCapabilityDeclaration, ByokCoreError, tenantKey, PRESENCE_LEVELS, createInMemoryCoreStores, authenticateDeviceAssertion, authenticateTaskAssertion, assertCapability, isCoreConflictError, isCoreError, DEVICE_PROOF_HEADER, TRUTH_RECORD_KINDS, STORAGE_ERROR_CODES, STORAGE_ERROR_HTTP_STATUS } from '@byok-sdk/core';
2
2
  export { DEVICE_PROOF_HEADER, NONCE_SIGNING_DOMAIN, isTenantId, tenantId } from '@byok-sdk/core';
3
3
  import { z } from 'zod';
4
- import { AgentEventOrUnknownSchema, AgentMessageServerContextSchema, AgentMessageEgressRequirementSchema, AgentRefSchema, TaskOfferForAgentWithEgressFreshPayloadSchema, PROTOCOL_VERSION, DAEMON_TO_SERVER_TYPES, AGENT_EGRESS_RELIABLE_ACK_CAPABILITY, encodeEnvelope, decodeEnvelope, AgentHomeProjectionCompletionRequestSchema, AgentInputPreparationPayloadSchema, InputPreparationCompletionRequestSchema, BYOK_PAIR_PATH, BYOK_CHALLENGE_PATH, BYOK_TOKEN_PATH, BYOK_CAPABILITIES_PATH, BYOK_AGENT_MEMORY_PROJECTIONS_PATH, BYOK_EVENTS_PATH, BYOK_MESSAGES_PATH, BYOK_AGENT_HOME_PROJECTION_COMPLETION_ROUTE, BYOK_INPUT_PREPARATION_COMPLETION_ROUTE, BYOK_INPUT_PREPARATION_STATUS_ROUTE, BYOK_BOARD_PATH, BYOK_BOARD_CLAIM_ROUTE, BYOK_BOARD_UNCLAIM_ROUTE, BYOK_BOARD_STATUS_ROUTE, BYOK_BOARD_STREAM_PATH, BYOK_PRESENCE_PATH, BYOK_ACTIVITY_PATH, BYOK_RECORDS_PATH, BYOK_RECORD_ROUTE, BYOK_SKILL_PACKS_PATH, BYOK_SKILL_PACK_FILE_ROUTE, BYOK_BLOBS_PATH, BYOK_BLOB_FINALIZE_ROUTE, BYOK_BLOB_URL_ROUTE, BYOK_BLOB_CONTENT_ROUTE, AgentMessagePublishPayloadSchema, isTaskOfferType, MESSAGE_PAYLOAD_SCHEMAS, createEnvelope, AgentHomeProjectionPayloadSchema, AgentContentReadPayloadSchema, AGENT_EGRESS_POLICY_CAPABILITY, AGENT_MESSAGE_EGRESS_CAPABILITY, TERMINAL_PROJECTION_SELECTION_CAPABILITY, TaskOfferForAgentWithEgressPayloadSchema, AGENT_INPUT_PREPARATION_CAPABILITY, AGENT_EGRESS_FRESH_SESSION_CAPABILITY, TaskOfferPreparedPayloadSchema, TaskOfferForAgentPayloadSchema, AgentMemoryProjectionMutationSchema, AgentMemoryProjectionReceiptSchema, AGENT_MEMORY_PROJECTION_MAX_ORDERING_VALUE, AgentMemoryProjectionEraseResultSchema, HarnessIdSchema, STRICT_AGENT_ONLY_CAPABILITY, AGENT_CONTENT_ARTIFACT_READ_CAPABILITY, AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY, AGENT_CONTENT_WORKSPACE_READ_CAPABILITY, AGENT_HOME_PROJECTION_CAPABILITY, PairRequestSchema, PairResponseSchema, ChallengeRequestSchema, TokenRequestSchema, AgentMemoryProjectionCommitRequestSchema, agentMemoryProjectionBase64UrlByteLength, MAILBOX_READ_AHEAD_MAX_SEQS, MAILBOX_READ_AHEAD_CAPABILITY, MessagesSendRequestSchema, InputPreparationStatusQuerySchema, PresencePublishRequestSchema, CreateBlobRequestSchema, byokBlobContentPath, AgentMessageDispositionPayloadSchema, AgentEgressAckPayloadSchema, AgentContentReceiptPayloadSchema } from '@byok-sdk/protocol';
4
+ import { AgentEventOrUnknownSchema, AgentMessageServerContextSchema, AgentMessageEgressRequirementSchema, AgentRefSchema, TaskOfferForAgentWithEgressFreshPayloadSchema, PROTOCOL_VERSION, DAEMON_TO_SERVER_TYPES, AGENT_EGRESS_RELIABLE_ACK_CAPABILITY, encodeEnvelope, decodeEnvelope, AgentHomeProjectionCompletionRequestSchema, AgentInputPreparationPayloadSchema, InputPreparationCompletionRequestSchema, BYOK_PAIR_PATH, BYOK_CHALLENGE_PATH, BYOK_TOKEN_PATH, BYOK_CAPABILITIES_PATH, BYOK_AGENT_MEMORY_PROJECTIONS_PATH, BYOK_EVENTS_PATH, BYOK_MESSAGES_PATH, BYOK_AGENT_HOME_PROJECTION_COMPLETION_ROUTE, BYOK_INPUT_PREPARATION_COMPLETION_ROUTE, BYOK_INPUT_PREPARATION_STATUS_ROUTE, BYOK_BOARD_PATH, BYOK_BOARD_CLAIM_ROUTE, BYOK_BOARD_UNCLAIM_ROUTE, BYOK_BOARD_STATUS_ROUTE, BYOK_BOARD_STREAM_PATH, BYOK_PRESENCE_PATH, BYOK_ACTIVITY_PATH, BYOK_RECORDS_PATH, BYOK_RECORD_ROUTE, BYOK_SKILL_PACKS_PATH, BYOK_SKILL_PACK_FILE_ROUTE, BYOK_BLOBS_PATH, BYOK_BLOB_FINALIZE_ROUTE, BYOK_BLOB_URL_ROUTE, BYOK_BLOB_CONTENT_ROUTE, AgentMessagePublishPayloadSchema, isTaskOfferType, MESSAGE_PAYLOAD_SCHEMAS, createEnvelope, ProviderProvisioningAvailablePayloadSchema, AgentHomeProjectionPayloadSchema, AgentContentReadPayloadSchema, AGENT_EGRESS_POLICY_CAPABILITY, AGENT_MESSAGE_EGRESS_CAPABILITY, TERMINAL_PROJECTION_SELECTION_CAPABILITY, TaskOfferForAgentWithEgressPayloadSchema, AGENT_INPUT_PREPARATION_CAPABILITY, AGENT_EGRESS_FRESH_SESSION_CAPABILITY, TaskOfferPreparedPayloadSchema, TaskOfferForAgentPayloadSchema, AgentMemoryProjectionMutationSchema, AgentMemoryProjectionReceiptSchema, AGENT_MEMORY_PROJECTION_MAX_ORDERING_VALUE, AgentMemoryProjectionEraseResultSchema, HarnessIdSchema, STRICT_AGENT_ONLY_CAPABILITY, AGENT_CONTENT_ARTIFACT_READ_CAPABILITY, AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY, AGENT_CONTENT_WORKSPACE_READ_CAPABILITY, AGENT_HOME_PROJECTION_CAPABILITY, PROVIDER_PROVISIONING_CAPABILITY, PairRequestSchema, PairResponseSchema, ChallengeRequestSchema, TokenRequestSchema, AgentMemoryProjectionCommitRequestSchema, agentMemoryProjectionBase64UrlByteLength, MAILBOX_READ_AHEAD_MAX_SEQS, MAILBOX_READ_AHEAD_CAPABILITY, MessagesSendRequestSchema, InputPreparationStatusQuerySchema, PresencePublishRequestSchema, CreateBlobRequestSchema, byokBlobContentPath, AgentMessageDispositionPayloadSchema, AgentEgressAckPayloadSchema, AgentContentReceiptPayloadSchema } from '@byok-sdk/protocol';
5
5
  import { Hono } from 'hono';
6
6
 
7
7
  // src/index.ts
@@ -1217,7 +1217,7 @@ var CLOUD_CAPABILITIES = {
1217
1217
  * DEVICE's only way to discharge a mailbox row this same deployment handed
1218
1218
  * it — withholding it would strand the device's redelivery cursor rather
1219
1219
  * than degrade a feature. For the same reason the completion route asserts
1220
- * no DEVICE capability either: the device-level `agent-input-preparation-v7`
1220
+ * no DEVICE capability either: the device-level `agent-input-preparation-v8`
1221
1221
  * flag gates ADMISSION (`enqueueInputPreparation`) and nothing else, so an
1222
1222
  * unconfigured device is refused a row instead of being handed one whose
1223
1223
  * only honest answer — `input_preparation_unconfigured` — it could not then
@@ -4060,6 +4060,35 @@ function createByokCloud(options) {
4060
4060
  return { ...control, status };
4061
4061
  },
4062
4062
  getInputPreparationStatus,
4063
+ async enqueueProviderProvisioningNotice(tenant, deviceId, input) {
4064
+ const payload = ProviderProvisioningAvailablePayloadSchema.parse(input);
4065
+ await assertAgentCapabilities(tenant, deviceId, [PROVIDER_PROVISIONING_CAPABILITY]);
4066
+ const messageId = uuidFromSha256(
4067
+ await options.crypto.sha256(
4068
+ new TextEncoder().encode(
4069
+ JSON.stringify({
4070
+ domain: "byok:provider-provisioning-notice",
4071
+ tenant,
4072
+ deviceId,
4073
+ requestId: payload.requestId
4074
+ })
4075
+ )
4076
+ )
4077
+ );
4078
+ const control = await enqueueAgentControlEnvelope(
4079
+ tenant,
4080
+ deviceId,
4081
+ messageId,
4082
+ (seq) => createEnvelope("provider.provisioning.available", payload, { id: messageId, seq })
4083
+ );
4084
+ if (control.envelope.type !== "provider.provisioning.available" || control.envelope.payload.requestId !== payload.requestId) {
4085
+ throw new ByokCloudError(
4086
+ "mailbox_receipt_mismatch",
4087
+ `Mailbox message ${messageId} does not carry provider provisioning notice ${payload.requestId}.`
4088
+ );
4089
+ }
4090
+ return control;
4091
+ },
4063
4092
  completeInputPreparation,
4064
4093
  eraseAgentMemoryProjection,
4065
4094
  approveTask(tenant, taskId, opts) {