@byok-sdk/cloud 0.11.0 → 0.13.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/activity.d.ts +13 -0
- package/dist/agent-home-projections.d.ts +2 -2
- package/dist/agent-reliability.d.ts +9 -0
- package/dist/approval-control.d.ts +75 -0
- package/dist/approval-timeline.d.ts +60 -14
- package/dist/auth/bearer.d.ts +17 -0
- package/dist/auth/plane.d.ts +3 -4
- package/dist/cloud.d.ts +116 -5
- package/dist/composition/in-memory.d.ts +4 -0
- package/dist/coordination.d.ts +8 -0
- package/dist/errors.d.ts +9 -0
- package/dist/handlers/blobs.d.ts +2 -0
- package/dist/handlers/events.d.ts +10 -4
- package/dist/handlers/messages.d.ts +7 -0
- package/dist/inbound.d.ts +45 -5
- package/dist/index.d.ts +12 -8
- package/dist/index.js +1029 -223
- package/dist/index.js.map +1 -1
- package/dist/steer-control.d.ts +81 -0
- package/dist/stores/in-memory/agent-egress.d.ts +1 -1
- package/dist/stores/in-memory/approval-timeline.d.ts +2 -1
- package/dist/stores/in-memory/blobs.d.ts +1 -0
- package/dist/stores/in-memory/dedup.d.ts +8 -5
- package/dist/stores/in-memory/nonces.d.ts +1 -2
- package/dist/stores/in-memory/pairing-codes.d.ts +9 -5
- package/dist/stores/in-memory/task-attempts.d.ts +29 -1
- package/dist/stores/ports.d.ts +177 -29
- package/dist/tenant-stores.d.ts +29 -2
- package/package.json +3 -3
package/dist/inbound.d.ts
CHANGED
|
@@ -20,17 +20,55 @@
|
|
|
20
20
|
* is not rejected here — the store's own no-op-on-missing behavior covers
|
|
21
21
|
* the latter, and it covers it per tenant, so a guessed id from another
|
|
22
22
|
* tenant writes nothing anywhere.
|
|
23
|
-
* 3. **
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* 3. **apply/recover** — every lifecycle side effect is idempotent under the
|
|
24
|
+
* envelope's own durable identity. A retry after a partial failure resumes
|
|
25
|
+
* this step rather than being hidden by transport admission.
|
|
26
|
+
* 4. **dedup** — only after every authoritative side effect converged do we
|
|
27
|
+
* mark the envelope complete. The next retry is then a no-op.
|
|
26
28
|
*
|
|
27
29
|
* A duplicate is still a wire-level success (§8.2): it just did not re-run
|
|
28
30
|
* anything. Only `rejected`/`rate_limited` are excluded from `accepted`.
|
|
31
|
+
*
|
|
32
|
+
* 5. **observe** — an optional {@link ByokCloudObserver} is told, once, about
|
|
33
|
+
* each envelope whose write committed. It runs after step 4 has returned,
|
|
34
|
+
* it cannot change the outcome, and it is not the admission hook.
|
|
29
35
|
*/
|
|
30
36
|
import { type AgentMessageDispositionPayload, type AgentMessagePublishPayload, type AgentMessageServerContext, type Envelope } from '@byok-sdk/protocol';
|
|
37
|
+
import type { TenantId } from '@byok-sdk/core';
|
|
31
38
|
import { type ActivityBounds } from './coordination';
|
|
32
39
|
import type { TenantStores } from './tenant-stores';
|
|
33
40
|
export type InboundOutcome = 'accepted' | 'duplicate' | 'rejected' | 'rate_limited';
|
|
41
|
+
/**
|
|
42
|
+
* One envelope whose write COMMITTED, handed to {@link ByokCloudObserver}.
|
|
43
|
+
*
|
|
44
|
+
* `outcome` is constant by construction — `accepted` is the only outcome that
|
|
45
|
+
* committed anything — and is carried anyway because it names the fact in the
|
|
46
|
+
* gate's own vocabulary rather than leaving the reader to infer it from the
|
|
47
|
+
* hook's name. A `duplicate` re-ran nothing, a `rejected` and a `rate_limited`
|
|
48
|
+
* wrote nothing; none of them appear here.
|
|
49
|
+
*/
|
|
50
|
+
export interface InboundCommitted {
|
|
51
|
+
readonly tenantId: TenantId;
|
|
52
|
+
readonly deviceId: string;
|
|
53
|
+
readonly envelope: Envelope;
|
|
54
|
+
readonly outcome: Extract<InboundOutcome, 'accepted'>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Post-commit relay for the host (the `TaskHandle` fan-out `@byok-sdk/server`
|
|
58
|
+
* drives off its live hub).
|
|
59
|
+
*
|
|
60
|
+
* Deliberately NOT the admission hook. `ByokCloudOptions.agentMessage.consume`
|
|
61
|
+
* runs BEFORE a write and decides whether it happens; this runs AFTER one and
|
|
62
|
+
* cannot decide anything: it returns `void`, it is called inside a `try`, and
|
|
63
|
+
* a throw from it is swallowed with the outcome already fixed. An observer
|
|
64
|
+
* that wants to refuse work has the admission hook; an observer here is
|
|
65
|
+
* watching, not gating.
|
|
66
|
+
*
|
|
67
|
+
* Synchronous and cheap by contract — it runs inline on the request path.
|
|
68
|
+
*/
|
|
69
|
+
export interface ByokCloudObserver {
|
|
70
|
+
onInboundCommitted(input: InboundCommitted): void;
|
|
71
|
+
}
|
|
34
72
|
export declare function handleAgentMessagePublish(stores: TenantStores, deviceId: string, taskId: string, payload: AgentMessagePublishPayload, consume: ((input: {
|
|
35
73
|
readonly tenant: TenantStores['tenant'];
|
|
36
74
|
readonly deviceId: string;
|
|
@@ -40,10 +78,12 @@ export declare function handleAgentMessagePublish(stores: TenantStores, deviceId
|
|
|
40
78
|
}) => Promise<{
|
|
41
79
|
readonly outcome: 'accepted' | 'held' | 'refused';
|
|
42
80
|
readonly reasonCode?: string;
|
|
43
|
-
}>) | undefined): Promise<{
|
|
81
|
+
}>) | undefined, alreadyDeduplicated: boolean): Promise<{
|
|
44
82
|
readonly outcome: InboundOutcome;
|
|
45
83
|
readonly disposition?: AgentMessageDispositionPayload;
|
|
46
84
|
}>;
|
|
85
|
+
/** Reads only a terminal immutable admission; pending rows have no disposition to acknowledge. */
|
|
86
|
+
export declare function readAgentMessageDisposition(stores: TenantStores, deviceId: string, taskId: string, payload: AgentMessagePublishPayload): Promise<AgentMessageDispositionPayload | undefined>;
|
|
47
87
|
/** Receipt key a task's terminal is recorded under — the idempotency seam S3b's journal will share. */
|
|
48
88
|
export declare function terminalReceiptKey(taskId: string): string;
|
|
49
|
-
export declare function handleInboundEnvelope(stores: TenantStores, deviceId: string, envelope: Envelope, activityBounds?: ActivityBounds): Promise<InboundOutcome>;
|
|
89
|
+
export declare function handleInboundEnvelope(stores: TenantStores, deviceId: string, envelope: Envelope, activityBounds?: ActivityBounds, agentMessageConsume?: Parameters<typeof handleAgentMessagePublish>[4], observer?: ByokCloudObserver): Promise<InboundOutcome>;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
export { isTenantId, tenantId } from '@byok-sdk/core';
|
|
16
16
|
export type { TenantId } from '@byok-sdk/core';
|
|
17
17
|
export { createByokCloud } from './cloud';
|
|
18
|
-
export type { ByokCloud, ByokCloudOptions, AgentDispatchInput, AgentEgressDispatchInput, AgentEgressFreshSessionDispatchInput, AgentContentReadInput, AgentHomeProjectionInput, AgentHomeProjectionStatusInput, EnqueueOfferInput, EnqueueToolsetOfferInput, EnqueuedAgentControl, EnqueuedAgentHomeProjection, EnqueuedOffer, } from './cloud';
|
|
18
|
+
export type { ByokCloud, ByokCloudOptions, AgentDispatchInput, AgentEgressDispatchInput, AgentEgressFreshSessionDispatchInput, AgentContentReadInput, AgentHomeProjectionInput, AgentHomeProjectionStatusInput, ApproveTaskOptions, EnqueueOfferInput, EnqueueToolsetOfferInput, RejectTaskOptions, EnqueuedAgentControl, EnqueuedAgentHomeProjection, EnqueuedOffer, } from './cloud';
|
|
19
19
|
export { agentHomeProjectionCompletionKey, agentHomeProjectionRequestKey, readAgentHomeProjectionStatus, recordAgentHomeProjectionCompletion, } from './agent-home-projections';
|
|
20
20
|
export type { AgentHomeProjectionReceiptInput } from './agent-home-projections';
|
|
21
21
|
export { AGENT_HOME_CONTRACT_CAPABILITY, DEFAULT_EVENTS_PAGE_LIMIT, DEFAULT_LONG_POLL_HOLD_MS, DEFAULT_LONG_POLL_INTERVAL_MS, DEFAULT_MAX_BLOB_SIZE_BYTES, } from './cloud';
|
|
@@ -45,16 +45,20 @@ export type { AuthPlane, AuthPlaneDeps, MintedAccessToken, PairInput } from './a
|
|
|
45
45
|
export { createWebCrypto } from './crypto/web-crypto';
|
|
46
46
|
export type { CloudCrypto } from './crypto/port';
|
|
47
47
|
export { handleInboundEnvelope, terminalReceiptKey } from './inbound';
|
|
48
|
-
export type { InboundOutcome } from './inbound';
|
|
48
|
+
export type { ByokCloudObserver, InboundCommitted, InboundOutcome } from './inbound';
|
|
49
49
|
export { projectTerminalResult } from './terminal-result';
|
|
50
50
|
export type { TerminalResult } from './terminal-result';
|
|
51
51
|
export { tenantStoresFor } from './tenant-stores';
|
|
52
52
|
export type { TenantBoundActivity, TenantBoundApprovalTimeline, TenantBoundBoard, CloudRootStores, TenantBoundBlobs, TenantBoundDedup, TenantBoundDevices, TenantBoundMailbox, TenantBoundPresence, TenantBoundQuota, TenantBoundRateLimiter, TenantBoundReceipts, TenantBoundTaskAttempts, TenantStores, } from './tenant-stores';
|
|
53
|
-
export { ApprovalObservationSchema, ApprovalTimelineEventSchema, APPROVAL_SUMMARY_MAX_BYTES, DEFAULT_APPROVAL_TIMELINE_CAPACITY, DEFAULT_APPROVAL_TIMELINE_TTL_MS, approvalTimelineCursor, parseApprovalObservations, validateApprovalTimelineAppend, } from './approval-timeline';
|
|
54
|
-
export type { ApprovalObservation, ApprovalTimelineAppendInput, ApprovalTimelineEvent, ApprovalTimelineStore, ApprovalTimelineTail, } from './approval-timeline';
|
|
55
|
-
export {
|
|
53
|
+
export { ApprovalObservationSchema, ApprovalTimelineEventSchema, APPROVAL_SUMMARY_MAX_BYTES, DEFAULT_APPROVAL_TIMELINE_CAPACITY, DEFAULT_APPROVAL_TIMELINE_TTL_MS, approvalTimelineCursor, parseApprovalObservations, validateApprovalTimelineAppend, validateApprovalTimelineResolve, } from './approval-timeline';
|
|
54
|
+
export type { ApprovalObservation, ApprovalTimelineAppendInput, ApprovalTimelineEvent, ApprovalTimelineResolvePendingInput, ApprovalTimelineResolvePendingResult, ApprovalTimelineStore, ApprovalTimelineTail, } from './approval-timeline';
|
|
55
|
+
export { StaleApprovalError, pendingApproval } from './approval-control';
|
|
56
|
+
export type { PendingApproval } from './approval-control';
|
|
57
|
+
export { SteerRejectedError } from './steer-control';
|
|
58
|
+
export type { SteerRejectionCode } from './steer-control';
|
|
59
|
+
export { assertTaskAttemptListLimit, DEFAULT_ACTIVITY_BOUNDS, DEFAULT_ACTIVITY_CAPACITY, DEFAULT_ACTIVITY_MAX_BYTES, DEFAULT_ACTIVITY_MAX_EVENTS, DEFAULT_ACTIVITY_TTL_MS, DEFAULT_BOARD_CHANNEL_MAX_BYTES, DEFAULT_BOARD_TITLE_MAX_BYTES, DEFAULT_PRESENCE_DETAIL_MAX_BYTES, DEFAULT_PRESENCE_MINIMUM_INTERVAL_MS, DEFAULT_PRESENCE_TTL_MS, } from './coordination';
|
|
56
60
|
export type { ActivityBounds } from './coordination';
|
|
57
|
-
export { TimelineEventSchema, ActivityAppendRequestSchema, activityCursor, parseTimelineEvents, projectTimelineEvents, validateActivityAppend, } from './activity';
|
|
61
|
+
export { TimelineEventSchema, ActivityAppendRequestSchema, activityCursor, activitySourceBatchState, parseTimelineEvents, projectTimelineEvents, validateActivityAppend, } from './activity';
|
|
58
62
|
export type { ActivityAppendInput, ActivityCursor, ActivityStore, ActivityTail, TimelineEvent, } from './activity';
|
|
59
63
|
export { BoardFeedClient, BoardFeedRetryableError, BoardFeedStoppedError } from './coordination-client';
|
|
60
64
|
export type { BoardFeedClientOptions, BoardFeedItem, BoardFeedMode, BoardFeedPage, BoardFeedRead, } from './coordination-client';
|
|
@@ -63,8 +67,8 @@ export { DEFAULT_MAX_TRUTH_REQUEST_BYTES, DEVICE_PROOF_HEADER, MAX_DEVICE_PROOF_
|
|
|
63
67
|
export type { PreparedTruthWrite, TruthBodyInput, TruthCommitInput, TruthCommitResponse, TruthCommitResult, TruthCommitter, TruthObjectDownloads, TruthRecordMetadata, TruthWriteRequest, } from './truth/contract';
|
|
64
68
|
export { TruthCommitError, isTruthCommitError } from './truth/errors';
|
|
65
69
|
export type { TruthCommitErrorCode } from './truth/errors';
|
|
66
|
-
export { BLOB_READ_ERROR_CODES, CLOUD_STORE_NAMES, TASK_ATTEMPT_STATUSES } from './stores/ports';
|
|
70
|
+
export { BLOB_READ_ERROR_CODES, CLOUD_STORE_NAMES, TASK_ATTEMPT_STATUSES, } from './stores/ports';
|
|
67
71
|
export { CLOUD_PORT_INTERFACES, CLOUD_PORT_METHODS } from './stores/ports-contract';
|
|
68
|
-
export type { BlobContent, BlobContentProxy, BlobDeclaration, BlobObservation, BlobReadErrorCode, BlobReadResult, BlobWriteResult, CloudBlobStore, CloudStoreName, CloudStores, DeviceDirectory, DeviceRecord, DeviceRegistration, InboundDedupStore, InboundRateLimiter, NonceStore, PairingCodeClaims, PairingCodeInfo, PairingCodeIssueInput, PairingCodeStore, ProofRequestReceipt, ProofRequestReceiptInput, ProofRequestReceiptStore, RequestReceipt, RequestReceiptStore, TaskAttempt, TaskAttemptStatus, TaskAttemptStore, AgentRef, AgentEgressRecord, AgentEgressStore, TaskCancellationMutation, TaskCancellationRequest, TaskCancellationStore, } from './stores/ports';
|
|
72
|
+
export type { BlobContent, BlobContentProxy, BlobDeclaration, BlobObservation, BlobReadErrorCode, BlobReadResult, BlobWriteResult, CloudBlobStore, CloudStoreName, CloudStores, DeviceDirectory, DeviceRecord, DeviceRegistration, InboundDedupStore, InboundRateLimiter, NonceStore, PairingCodeClaims, PairingCodeInfo, PairingCodeIssueInput, PairingCodeStore, PairingEnrollment, PairingEnrollmentInput, ProofRequestReceipt, ProofRequestReceiptInput, ProofRequestReceiptStore, RequestReceipt, RequestReceiptStore, TaskAttempt, TaskAttemptListQuery, TaskAttemptPage, TaskAttemptStatus, TaskAttemptStore, AgentRef, AgentEgressRecord, AgentEgressStore, AgentMessageAdmission, TaskCancellationMutation, TaskCancellationRequest, TaskCancellationStore, } from './stores/ports';
|
|
69
73
|
export { AllowAllRateLimiter, BLOB_URL_TTL_MS, DEDUP_RING_CAPACITY, InMemoryBlobContentProxy, InMemoryCloudBlobStore, InMemoryActivityStore, InMemoryDeviceDirectory, InMemoryInboundDedupStore, InMemoryNonceStore, InMemoryPairingCodeStore, InMemoryRequestReceiptStore, InMemoryAgentEgressStore, InMemoryProofRequestReceiptStore, InMemoryTaskAttemptStore, InMemoryTaskCancellationStore, NONCE_TTL_MS, createInMemoryBlobs, createInMemoryCloudStores, } from './stores/in-memory/index';
|
|
70
74
|
export type { InMemoryBlobStoreOptions, InMemoryBlobs, InMemoryCloudComposition, } from './stores/in-memory/index';
|