@canonmsg/agent-sdk 11.2.1 → 12.1.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 +248 -523
- package/dist/chunks/chunk-7N6OPPW4.js +5430 -0
- package/dist/chunks/chunk-N722GWCP.js +4897 -0
- package/dist/chunks/chunk-QZ4PPRQW.js +14247 -0
- package/dist/chunks/mls-crypto-LMNQZOS6.js +10 -0
- package/dist/cli.js +572 -0
- package/dist/drivers/claude.d.ts +42 -0
- package/dist/drivers/code.d.ts +18 -0
- package/dist/drivers/codex.d.ts +46 -0
- package/dist/drivers/connector.d.ts +34 -0
- package/dist/index.d.ts +20 -25
- package/dist/index.js +91 -13
- package/dist/internal/backend-contracts/agentBehaviorPolicy.d.ts +122 -0
- package/dist/internal/backend-contracts/agentDirectory.d.ts +32 -0
- package/dist/internal/backend-contracts/agentOrigin.d.ts +23 -0
- package/dist/internal/backend-contracts/agentSearch.d.ts +17 -0
- package/dist/internal/backend-contracts/api-origins.generated.d.ts +4 -0
- package/dist/internal/backend-contracts/apiErrors.d.ts +1 -0
- package/dist/internal/backend-contracts/artifactActions.d.ts +8 -0
- package/dist/internal/backend-contracts/artifacts.d.ts +386 -0
- package/dist/internal/backend-contracts/clientFloor.d.ts +41 -0
- package/dist/internal/backend-contracts/communication.d.ts +146 -0
- package/dist/internal/backend-contracts/connectorRelay.d.ts +179 -0
- package/dist/internal/backend-contracts/conversationMembership.d.ts +28 -0
- package/dist/internal/backend-contracts/deliveryObservation.d.ts +23 -0
- package/dist/internal/backend-contracts/diffRedaction.d.ts +6 -0
- package/dist/internal/backend-contracts/endpoint-unread.d.ts +4 -0
- package/dist/internal/backend-contracts/endpoint.d.ts +120 -0
- package/dist/internal/backend-contracts/endpointContentPolicy.d.ts +48 -0
- package/dist/internal/backend-contracts/environment.d.ts +20 -0
- package/dist/internal/backend-contracts/externalInbound.d.ts +24 -0
- package/dist/internal/backend-contracts/firestoreValues.d.ts +9 -0
- package/dist/internal/backend-contracts/index.d.ts +54 -0
- package/dist/internal/backend-contracts/media-url.d.ts +20 -0
- package/dist/internal/backend-contracts/media.d.ts +51 -0
- package/dist/internal/backend-contracts/mediaDelivery.d.ts +46 -0
- package/dist/internal/backend-contracts/mediaTransferProtocol.d.ts +17 -0
- package/dist/internal/backend-contracts/membershipChange.d.ts +21 -0
- package/dist/internal/backend-contracts/message.d.ts +86 -0
- package/dist/internal/backend-contracts/messageText.d.ts +6 -0
- package/dist/internal/backend-contracts/mlsDevApplication.d.ts +161 -0
- package/dist/internal/backend-contracts/mlsDevCredential.d.ts +78 -0
- package/dist/internal/backend-contracts/mlsDevCredentialReconciliation.d.ts +45 -0
- package/dist/internal/backend-contracts/mlsDevDeviceCustody.d.ts +52 -0
- package/dist/internal/backend-contracts/mlsDevEnrollment.d.ts +75 -0
- package/dist/internal/backend-contracts/mlsDevFeedReceipt.d.ts +43 -0
- package/dist/internal/backend-contracts/mlsDevGroup.d.ts +321 -0
- package/dist/internal/backend-contracts/mlsDevGroupFeed.d.ts +51 -0
- package/dist/internal/backend-contracts/mlsDevInteraction.d.ts +159 -0
- package/dist/internal/backend-contracts/mlsDevKeyPackage.d.ts +42 -0
- package/dist/internal/backend-contracts/mlsDevKeyPackages.d.ts +55 -0
- package/dist/internal/backend-contracts/mlsEnvironment.d.ts +35 -0
- package/dist/internal/backend-contracts/mlsPrincipalAlias.d.ts +23 -0
- package/dist/internal/backend-contracts/moderation.d.ts +7 -0
- package/dist/internal/backend-contracts/plaintextProcessors.d.ts +63 -0
- package/dist/internal/backend-contracts/preparedContent.d.ts +54 -0
- package/dist/internal/backend-contracts/replyAuthority.d.ts +14 -0
- package/dist/internal/backend-contracts/runtimeCardFields.d.ts +66 -0
- package/dist/internal/backend-contracts/runtimeCardStorage.d.ts +3 -0
- package/dist/internal/backend-contracts/runtimeDescriptor.d.ts +88 -0
- package/dist/internal/backend-contracts/selfContext.d.ts +9 -0
- package/dist/internal/backend-contracts/turnProtocol.d.ts +43 -0
- package/dist/internal/backend-contracts/upload-mime-types.d.ts +17 -0
- package/dist/internal/backend-contracts/verbContract.d.ts +856 -0
- package/dist/internal/backend-contracts/verbSchemas.d.ts +1717 -0
- package/dist/internal/backend-contracts/verbWire.d.ts +493 -0
- package/dist/internal/backend-contracts/webAuth.d.ts +8 -0
- package/dist/internal/core/agent-profiles.d.ts +65 -0
- package/dist/internal/core/approval-format.d.ts +22 -0
- package/dist/internal/core/approval-manager.d.ts +43 -0
- package/dist/internal/core/approval-types.d.ts +73 -0
- package/dist/internal/core/base-url.d.ts +1 -0
- package/dist/internal/core/cli-metadata.d.ts +13 -0
- package/dist/internal/core/client.d.ts +432 -0
- package/dist/internal/core/completed-output-journal.d.ts +39 -0
- package/dist/internal/core/constants.d.ts +1 -0
- package/dist/internal/core/endpoint-client.d.ts +56 -0
- package/dist/internal/core/execution-environment-mode.d.ts +6 -0
- package/dist/internal/core/gifs.d.ts +29 -0
- package/dist/internal/core/host-runtime.d.ts +53 -0
- package/dist/internal/core/index.d.ts +68 -0
- package/dist/internal/core/node-media.d.ts +6 -0
- package/dist/internal/core/policy.d.ts +2 -0
- package/dist/internal/core/registration-profile.d.ts +10 -0
- package/dist/internal/core/registration-session.d.ts +55 -0
- package/dist/internal/core/registration.d.ts +5 -0
- package/dist/internal/core/retry.d.ts +113 -0
- package/dist/internal/core/rtdb-rest.d.ts +141 -0
- package/dist/internal/core/runtime-cards.d.ts +286 -0
- package/dist/internal/core/runtime-descriptor.d.ts +16 -0
- package/dist/internal/core/runtime-endpoints.d.ts +26 -0
- package/dist/internal/core/runtime-heartbeat.d.ts +29 -0
- package/dist/internal/core/runtime-presentation.d.ts +9 -0
- package/dist/internal/core/runtime-request-manager.d.ts +283 -0
- package/dist/internal/core/runtime-state-publisher.d.ts +42 -0
- package/dist/internal/core/self-context.d.ts +22 -0
- package/dist/internal/core/silent-turn.d.ts +49 -0
- package/dist/internal/core/stream.d.ts +78 -0
- package/dist/internal/core/turn-protocol.d.ts +28 -0
- package/dist/internal/core/turn-verbosity.d.ts +85 -0
- package/dist/internal/core/types.d.ts +964 -0
- package/dist/internal/core/unified-diff.d.ts +35 -0
- package/dist/internal/endpoint/artifact-images.d.ts +60 -0
- package/dist/internal/endpoint/artifact-reducer.d.ts +35 -0
- package/dist/internal/endpoint/artifact-views.d.ts +113 -0
- package/dist/internal/endpoint/artifacts.d.ts +75 -0
- package/dist/internal/endpoint/delivery.d.ts +47 -0
- package/dist/internal/endpoint/engine.d.ts +249 -0
- package/dist/internal/endpoint/ephemeral.d.ts +8 -0
- package/dist/internal/endpoint/events.d.ts +32 -0
- package/dist/internal/endpoint/external-inbound.d.ts +36 -0
- package/dist/internal/endpoint/handoff.d.ts +50 -0
- package/dist/internal/endpoint/history.d.ts +22 -0
- package/dist/internal/endpoint/image-generation-errors.d.ts +2 -0
- package/dist/internal/endpoint/inbound.d.ts +29 -0
- package/dist/internal/endpoint/index.d.ts +32 -0
- package/dist/internal/endpoint/media.d.ts +177 -0
- package/dist/internal/endpoint/migration.d.ts +50 -0
- package/dist/internal/endpoint/mls-crypto.d.ts +32 -0
- package/dist/internal/endpoint/mls-dev-client.d.ts +52 -0
- package/dist/internal/endpoint/mls-dev-device.d.ts +69 -0
- package/dist/internal/endpoint/mls-dev-groups.d.ts +174 -0
- package/dist/internal/endpoint/mls-dev-interactions.d.ts +99 -0
- package/dist/internal/endpoint/mls-dev-key-package-service.d.ts +46 -0
- package/dist/internal/endpoint/mls-dev-key-packages.d.ts +62 -0
- package/dist/internal/endpoint/mls-dev-text.d.ts +67 -0
- package/dist/internal/endpoint/mls-dev-transport.d.ts +38 -0
- package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +29 -0
- package/dist/internal/endpoint/node-mls-custody.d.ts +15 -0
- package/dist/internal/endpoint/node.d.ts +7 -0
- package/dist/internal/endpoint/observe-query.d.ts +17 -0
- package/dist/internal/endpoint/portable-node-mls-custody.d.ts +23 -0
- package/dist/internal/endpoint/queue.d.ts +22 -0
- package/dist/internal/endpoint/recovery.d.ts +27 -0
- package/dist/internal/endpoint/retention.d.ts +7 -0
- package/dist/internal/endpoint/store.d.ts +22 -0
- package/dist/internal/endpoint/sync.d.ts +33 -0
- package/dist/internal/endpoint/transient-publisher.d.ts +8 -0
- package/dist/internal/endpoint/transport.d.ts +63 -0
- package/dist/media.d.ts +1 -1
- package/dist/media.js +42 -541
- package/dist/runner/errands.d.ts +118 -0
- package/dist/runner/mls.d.ts +97 -0
- package/dist/runner/relay.d.ts +87 -0
- package/dist/runner/runner.d.ts +98 -0
- package/dist/runner/types.d.ts +215 -0
- package/package.json +18 -5
- package/dist/attached-session.d.ts +0 -58
- package/dist/attached-session.js +0 -638
- package/dist/bounded-file-read.d.ts +0 -14
- package/dist/bounded-file-read.js +0 -34
- package/dist/canon-agent.d.ts +0 -236
- package/dist/canon-agent.js +0 -2531
- package/dist/debouncer.d.ts +0 -18
- package/dist/debouncer.js +0 -133
- package/dist/inbound-handoff.d.ts +0 -6
- package/dist/inbound-handoff.js +0 -17
- package/dist/managed-session-host.d.ts +0 -27
- package/dist/managed-session-host.js +0 -195
- package/dist/managed-session-setup.d.ts +0 -99
- package/dist/managed-session-setup.js +0 -234
- package/dist/realtime.d.ts +0 -62
- package/dist/realtime.js +0 -193
- package/dist/runtime-card.d.ts +0 -48
- package/dist/runtime-card.js +0 -64
- package/dist/session-manager.d.ts +0 -77
- package/dist/session-manager.js +0 -285
- package/dist/turn-streaming-request.d.ts +0 -17
- package/dist/turn-streaming-request.js +0 -22
- package/dist/turn-verbosity-option.d.ts +0 -33
- package/dist/turn-verbosity-option.js +0 -23
- package/dist/types.d.ts +0 -387
- package/dist/types.js +0 -1
- package/dist/work-session-coordination.d.ts +0 -21
- package/dist/work-session-coordination.js +0 -53
- package/dist/work-session-host.d.ts +0 -31
- package/dist/work-session-host.js +0 -617
- package/dist/work-session-interactions.d.ts +0 -12
- package/dist/work-session-interactions.js +0 -173
- package/dist/work-session-state.d.ts +0 -36
- package/dist/work-session-state.js +0 -62
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type EndpointEvent, type EndpointExternalInboundClaimResult, type EndpointExternalInboundOutcome, type EndpointExternalInboundReplyIntent, type EndpointExternalInboundSource } from '../backend-contracts/index.js';
|
|
2
|
+
import type { EndpointIntent } from './engine.js';
|
|
3
|
+
import { type EndpointStore, type EndpointStoreTransaction } from './store.js';
|
|
4
|
+
export interface ExternalInboundClaim {
|
|
5
|
+
requestId: string;
|
|
6
|
+
installationGeneration: number;
|
|
7
|
+
source: EndpointExternalInboundSource;
|
|
8
|
+
replyIntent?: EndpointExternalInboundReplyIntent;
|
|
9
|
+
replyOperationId?: string;
|
|
10
|
+
outcome?: EndpointExternalInboundOutcome;
|
|
11
|
+
}
|
|
12
|
+
/** Uses the existing inbox and its ready index. No expiry makes accepted work
|
|
13
|
+
* executable again: a lost HTTP response leaves explicit uncertain work. */
|
|
14
|
+
export declare function createExternalInboundClaims(input: {
|
|
15
|
+
store: EndpointStore;
|
|
16
|
+
ready(): Promise<unknown>;
|
|
17
|
+
assertOpen(): void;
|
|
18
|
+
assertCurrent(tx: EndpointStoreTransaction): Promise<void>;
|
|
19
|
+
clock(): number;
|
|
20
|
+
hash(value: string): Promise<string>;
|
|
21
|
+
ownershipVersion?: number;
|
|
22
|
+
}): {
|
|
23
|
+
claim(id: string, requestId: string, authorizedEvent: EndpointEvent): Promise<EndpointExternalInboundClaimResult>;
|
|
24
|
+
reserveReply(id: string, requestId: string, intent: EndpointExternalInboundReplyIntent): Promise<boolean>;
|
|
25
|
+
/** Seal the selected authority with the ordinary engine preparation identity.
|
|
26
|
+
* A reply reservation alone is not preparation; a replacement request may
|
|
27
|
+
* still refresh its authority until this transaction commits. */
|
|
28
|
+
prepareReply(id: string, requestId: string, operationId: string, prepare: () => Promise<{
|
|
29
|
+
event: EndpointEvent;
|
|
30
|
+
intent: EndpointIntent;
|
|
31
|
+
}>): Promise<{
|
|
32
|
+
event: EndpointEvent;
|
|
33
|
+
replayed: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
settle(id: string, requestId: string, outcome: EndpointExternalInboundOutcome, replyFingerprint?: string): Promise<boolean>;
|
|
36
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { EndpointInboundRecord } from './engine.js';
|
|
2
|
+
import type { EndpointStore, EndpointStoreTransaction } from './store.js';
|
|
3
|
+
export type EndpointInboundHandoffPhase = 'queued' | 'claiming' | 'submitted' | 'released' | 'settled';
|
|
4
|
+
/** Process-local capability for one durable input generation. Never serialize it. */
|
|
5
|
+
export interface EndpointInboundHandoff {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly conversationId?: string;
|
|
8
|
+
readonly phase: EndpointInboundHandoffPhase;
|
|
9
|
+
/** Retain this input in the adapter's existing queue. No retry is scheduled here. */
|
|
10
|
+
defer(reason?: string): Promise<boolean>;
|
|
11
|
+
/** Relinquish unsubmitted input to the existing durable inbox. */
|
|
12
|
+
release(reason?: string): Promise<boolean>;
|
|
13
|
+
/** Explicitly discard proven unsubmitted input. Submitted effects need reconciliation. */
|
|
14
|
+
cancel(reason?: string): Promise<boolean>;
|
|
15
|
+
/** The adapter has positive completion or non-dispatch proof. */
|
|
16
|
+
settle(reason?: string): Promise<boolean>;
|
|
17
|
+
}
|
|
18
|
+
export type EndpointInboundStartResult<T> = {
|
|
19
|
+
status: 'submitted';
|
|
20
|
+
value: T;
|
|
21
|
+
} | {
|
|
22
|
+
status: 'deferred' | 'unavailable' | 'canceled';
|
|
23
|
+
};
|
|
24
|
+
/** Owns handoff transitions, not provider scheduling, retry policy or output recovery. */
|
|
25
|
+
export declare function createInboundHandoffs(input: {
|
|
26
|
+
store: EndpointStore;
|
|
27
|
+
owner: string;
|
|
28
|
+
ids(): string;
|
|
29
|
+
clock(): number;
|
|
30
|
+
leaseMs: number;
|
|
31
|
+
ready(): Promise<unknown>;
|
|
32
|
+
assertOpen(): void;
|
|
33
|
+
assertReady(records: EndpointInboundRecord[]): Promise<void>;
|
|
34
|
+
/** Required by trusted-host positive non-submission reconciliation. */
|
|
35
|
+
assertCurrent?(tx: EndpointStoreTransaction): Promise<void>;
|
|
36
|
+
}): {
|
|
37
|
+
acquire: (id: string) => Promise<EndpointInboundHandoff | null>;
|
|
38
|
+
start: <T>(handles: EndpointInboundHandoff | readonly EndpointInboundHandoff[], submit: () => T | Promise<T>) => Promise<EndpointInboundStartResult<T>>;
|
|
39
|
+
reconcileNotSubmitted: (id: string, expected: {
|
|
40
|
+
expectedHandoffGeneration: string;
|
|
41
|
+
expectedInstallationId: string;
|
|
42
|
+
}) => Promise<boolean>;
|
|
43
|
+
/** Retry only already-requested durable writes, never native submission. */
|
|
44
|
+
retryPendingDispositions(): Promise<void>;
|
|
45
|
+
/** Reuse the consumer's existing pump; no separate handoff heartbeat. */
|
|
46
|
+
refresh(id: string): Promise<boolean>;
|
|
47
|
+
uncertain(id: string, reason?: string): Promise<boolean> | undefined;
|
|
48
|
+
settle(id: string, reason?: string): Promise<boolean> | undefined;
|
|
49
|
+
close(): Promise<void>;
|
|
50
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Endpoint } from './engine.js';
|
|
2
|
+
export interface EndpointHistorySnapshot {
|
|
3
|
+
messages: Record<string, unknown>[];
|
|
4
|
+
loading: boolean;
|
|
5
|
+
loadingMore: boolean;
|
|
6
|
+
hasMore: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface EndpointHistorySubscription {
|
|
9
|
+
loadMore(): void;
|
|
10
|
+
close(): void;
|
|
11
|
+
}
|
|
12
|
+
export interface EndpointHistoryObserver {
|
|
13
|
+
observe(parameters: {
|
|
14
|
+
conversationId: string;
|
|
15
|
+
startAt?: number;
|
|
16
|
+
admissionId?: string;
|
|
17
|
+
}, listener: (value: EndpointHistorySnapshot) => void, onError?: (error: unknown) => void): EndpointHistorySubscription;
|
|
18
|
+
close(): void;
|
|
19
|
+
}
|
|
20
|
+
/** Explicit older pages plus one bounded live page. Loaded IDs are refreshed in
|
|
21
|
+
* bounded batches so edits/deletes stay live without re-reading all older pages. */
|
|
22
|
+
export declare function createEndpointHistoryObserver(endpoint: Pick<Endpoint, 'query' | 'observeQuery'>): EndpointHistoryObserver;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { EndpointEvent } from '../backend-contracts/index.js';
|
|
2
|
+
import type { Endpoint } from './engine.js';
|
|
3
|
+
import type { EndpointStore } from './store.js';
|
|
4
|
+
export interface EndpointInboundConsumerOptions {
|
|
5
|
+
kind: string;
|
|
6
|
+
conversationId?: string;
|
|
7
|
+
/** Independent delivery handoffs per room; execution remains runtime-owned. */
|
|
8
|
+
concurrency?: 'serial' | 'conversation';
|
|
9
|
+
offer(event: EndpointEvent): Promise<void>;
|
|
10
|
+
onError?(error: unknown): void;
|
|
11
|
+
intervalMs?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface EndpointInboundConsumer {
|
|
14
|
+
receive(event: EndpointEvent): Promise<void>;
|
|
15
|
+
start(): void;
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
/** The shared inbox owns redelivery. Adapters own the proof that external work completed. */
|
|
19
|
+
export declare function createInboundConsumer(input: {
|
|
20
|
+
endpoint: Endpoint;
|
|
21
|
+
store: EndpointStore;
|
|
22
|
+
owner: string;
|
|
23
|
+
clock: () => number;
|
|
24
|
+
leaseMs: number;
|
|
25
|
+
options: EndpointInboundConsumerOptions;
|
|
26
|
+
beforeOffer?(event: EndpointEvent): Promise<void>;
|
|
27
|
+
refreshHandoff?(id: string): Promise<boolean>;
|
|
28
|
+
retryHandoffDispositions?(): Promise<void>;
|
|
29
|
+
}): EndpointInboundConsumer;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export * from './engine.js';
|
|
2
|
+
export * from './store.js';
|
|
3
|
+
export * from './transport.js';
|
|
4
|
+
export * from './observe-query.js';
|
|
5
|
+
export type { EndpointInboundConsumer, EndpointInboundConsumerOptions } from './inbound.js';
|
|
6
|
+
export type { EndpointInboundHandoff, EndpointInboundHandoffPhase, EndpointInboundStartResult } from './handoff.js';
|
|
7
|
+
export type { EndpointSyncOptions, EndpointSyncPage } from './sync.js';
|
|
8
|
+
export type { EndpointRecoveryOptions, EndpointRecoveryBaseline } from './recovery.js';
|
|
9
|
+
export type { EndpointEventFamily, EndpointEventObserver, EndpointTransportEvent } from './events.js';
|
|
10
|
+
export * from './media.js';
|
|
11
|
+
export * from './history.js';
|
|
12
|
+
export * from './ephemeral.js';
|
|
13
|
+
export * from './transient-publisher.js';
|
|
14
|
+
export { createArtifactClient, ArtifactRejectedError, type ArtifactClient, type ArtifactClientOptions, type ArtifactCreateOptions, type ArtifactLibrary, type ArtifactWriteResult, } from './artifacts.js';
|
|
15
|
+
export { createArtifactImageClient, type ArtifactImageAddInput, type ArtifactImageClient, type ArtifactImageGenerateInput, type ArtifactImageGenerateResult, type ArtifactImageRegion, } from './artifact-images.js';
|
|
16
|
+
export { isTerminalImageGenerationError } from './image-generation-errors.js';
|
|
17
|
+
export { describeArtifact, summarizeArtifact, type ArtifactChessMoveView, type ArtifactChessView, type ArtifactFormChangeView, type ArtifactFormFieldView, type ArtifactFormView, type ArtifactImageVariantView, type ArtifactImageView, type ArtifactPrincipalView, type ArtifactView, type ArtifactViewOptions, } from './artifact-views.js';
|
|
18
|
+
export { reduceArtifactRecord, replayArtifactPage, artifactCommandConflicts, artifactFormConflicts, type ArtifactConflict } from './artifact-reducer.js';
|
|
19
|
+
export type { ArtifactAsset, ArtifactChessMove, ArtifactChessPlayers, ArtifactChessState, ArtifactCommand, ArtifactCommandBody, ArtifactCommandRecord, ArtifactContext, ArtifactDefinition, ArtifactDomainOutcome, ArtifactFormChange, ArtifactFormColumn, ArtifactFormField, ArtifactFormFieldRemoval, ArtifactFormRow, ArtifactFormState, ArtifactFormTable, ArtifactFormValue, ArtifactImageState, ArtifactImageVariant, ArtifactJson, ArtifactKind, ArtifactOutcomeCode, ArtifactReadResult, ArtifactReference, ArtifactSelection, ArtifactSnapshot, } from '../backend-contracts/index.js';
|
|
20
|
+
export { eraseEndpointPlaintext } from './retention.js';
|
|
21
|
+
export type { EndpointOperationRequest, EndpointOperationReceipt, EndpointOperationError, EndpointPreconditions, EndpointEvent, EndpointQueryRequest, EndpointQueryResponse, } from '../backend-contracts/index.js';
|
|
22
|
+
export { CANON_ENDPOINT_PROTOCOL } from '../backend-contracts/index.js';
|
|
23
|
+
export { endpointContentBoundary, ENDPOINT_CONTENT_ACTIONS, ENDPOINT_CONTENT_QUERIES, ENDPOINT_CONTENT_EPHEMERALS, ENDPOINT_CONTENT_EVENTS } from '../backend-contracts/index.js';
|
|
24
|
+
export type { EndpointContentBoundary, EndpointContentClass, EndpointContentLane } from '../backend-contracts/index.js';
|
|
25
|
+
export type { EndpointRecoveryMigration, EndpointMigrationRoom, EndpointMigrationItem, EndpointMigrationReceipt } from './migration.js';
|
|
26
|
+
export type { EndpointMessageGroupInput, EndpointMessageGroup } from './delivery.js';
|
|
27
|
+
/** Synthetic Dev custody/enrollment coordination; no room activation. */
|
|
28
|
+
export { createMlsDevDeviceCoordinator, type MlsDevDeviceView, type MlsDevProtectedPreparer } from './mls-dev-device.js';
|
|
29
|
+
export type { MlsDevDeviceClient, MlsDevDeviceClientOptions } from './mls-dev-client.js';
|
|
30
|
+
export type { MlsDevDeviceTransport, MlsDevDeviceHttpOptions, MlsDevKeyPackageTransport } from './mls-dev-transport.js';
|
|
31
|
+
export type { MlsDevKeyPackageClient, MlsDevKeyPackageView, MlsDevProtectedKeyPackagePreparer, MlsDevKeyPackagePublicationView, MlsDevKeyPackageClaimView, MlsDevKeyPackageClaimInput } from './mls-dev-key-packages.js';
|
|
32
|
+
export type { MlsDevGroupClient, MlsDevVerifiedMessageBinding, MlsDevCurrentAudience, MlsDevAdmissionHold, MlsDevGroupView, MlsDevGroupRecoveryFailure, MlsDevProtectedGroupPreparer } from './mls-dev-groups.js';
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { type DeliveryObservation, type DeliveryAttention, type PreparedContent } from '../backend-contracts/index.js';
|
|
2
|
+
import type { Endpoint } from './engine.js';
|
|
3
|
+
import { type EndpointStore } from './store.js';
|
|
4
|
+
export interface EndpointMediaDescriptor {
|
|
5
|
+
mimeType: string;
|
|
6
|
+
sizeBytes: number;
|
|
7
|
+
fileName?: string;
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
durationMs?: number;
|
|
11
|
+
/** Local-only source cleanup; never sent in a stage manifest. */
|
|
12
|
+
cleanupAfterSend?: boolean;
|
|
13
|
+
/** Native-only normalization to apply after durable handoff, before staging. */
|
|
14
|
+
normalization?: {
|
|
15
|
+
kind: 'jpeg';
|
|
16
|
+
maxDimension: 1600;
|
|
17
|
+
quality: 0.85;
|
|
18
|
+
fileName: 'photo.jpg';
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface EndpointUploadSession {
|
|
22
|
+
uploadId: string;
|
|
23
|
+
uploadUrl: string;
|
|
24
|
+
sizeBytes: number;
|
|
25
|
+
mimeType: string;
|
|
26
|
+
expiresAt?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface EndpointMediaBytes<Source> {
|
|
29
|
+
/** A bounded-memory digest of the actual bytes, not filename or picker metadata. */
|
|
30
|
+
digest(source: Source): Promise<string>;
|
|
31
|
+
discardAll?(): Promise<void>;
|
|
32
|
+
/** Keep bytes outside caches until the durable message is acknowledged. */
|
|
33
|
+
retain(key: string, source: Source): Promise<string>;
|
|
34
|
+
upload(reference: string, session: EndpointUploadSession, options: {
|
|
35
|
+
signal: AbortSignal;
|
|
36
|
+
onProgress?: (uploadedBytes: number, totalBytes: number) => void;
|
|
37
|
+
}): Promise<void>;
|
|
38
|
+
release(reference: string): Promise<void>;
|
|
39
|
+
close?(): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export interface EndpointMediaFlow {
|
|
42
|
+
id: string;
|
|
43
|
+
conversationId: string;
|
|
44
|
+
messageId: string;
|
|
45
|
+
message: Record<string, unknown>;
|
|
46
|
+
fingerprint?: string;
|
|
47
|
+
createdAt?: string;
|
|
48
|
+
requiresPublicationApproval?: boolean;
|
|
49
|
+
files: Array<{
|
|
50
|
+
descriptor: EndpointMediaDescriptor;
|
|
51
|
+
reference: string;
|
|
52
|
+
uploadId?: string;
|
|
53
|
+
generation?: number;
|
|
54
|
+
attachment?: Record<string, unknown>;
|
|
55
|
+
/** How many times a resend asked Canon to process this encrypted room's failed video again. */
|
|
56
|
+
processingRetries?: number;
|
|
57
|
+
}>;
|
|
58
|
+
purpose?: 'prepare';
|
|
59
|
+
publicationGeneration?: number;
|
|
60
|
+
/** Frozen at initial staging; an upgrade must never move an uncertain delivery to another publisher. */
|
|
61
|
+
deliveryMode?: 'legacy' | 'background';
|
|
62
|
+
observation?: DeliveryObservation;
|
|
63
|
+
/** Sealed at initial staging; session renewal never changes these bytes. */
|
|
64
|
+
preparedContent?: PreparedContent;
|
|
65
|
+
attention?: DeliveryAttention;
|
|
66
|
+
background?: {
|
|
67
|
+
phase: EndpointBackgroundMediaSnapshot['status'];
|
|
68
|
+
uploadedBytes: number;
|
|
69
|
+
totalBytes: number;
|
|
70
|
+
};
|
|
71
|
+
status: 'pending' | 'sending' | 'prepared' | 'succeeded' | 'cancelled' | 'rejected';
|
|
72
|
+
error?: {
|
|
73
|
+
message: string;
|
|
74
|
+
code?: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export interface EndpointMediaProgress {
|
|
78
|
+
phase: 'preparing' | 'uploading' | 'waiting_for_connection' | 'finalizing' | 'sending' | 'cancelling';
|
|
79
|
+
uploadedBytes: number;
|
|
80
|
+
totalBytes: number;
|
|
81
|
+
}
|
|
82
|
+
export interface EndpointMediaSendOptions {
|
|
83
|
+
signal?: AbortSignal;
|
|
84
|
+
onProgress?: (progress: EndpointMediaProgress) => void;
|
|
85
|
+
beforePublish?: () => Promise<boolean>;
|
|
86
|
+
/** The caller's bounded preflight choice. Existing flows always keep their persisted mode. */
|
|
87
|
+
handoffMode?: 'background' | 'legacy';
|
|
88
|
+
}
|
|
89
|
+
export interface EndpointMediaInput<Source> {
|
|
90
|
+
conversationId: string;
|
|
91
|
+
messageId: string;
|
|
92
|
+
message: Record<string, unknown>;
|
|
93
|
+
files: Array<{
|
|
94
|
+
source: Source;
|
|
95
|
+
descriptor: EndpointMediaDescriptor;
|
|
96
|
+
}>;
|
|
97
|
+
}
|
|
98
|
+
export interface EndpointBackgroundMediaSnapshot {
|
|
99
|
+
identity?: Pick<DeliveryObservation, 'messageId' | 'conversationId' | 'installationId' | 'environmentId'>;
|
|
100
|
+
schemaVersion?: 2;
|
|
101
|
+
observation?: DeliveryObservation;
|
|
102
|
+
attention?: DeliveryAttention;
|
|
103
|
+
deliveryId: string;
|
|
104
|
+
status: 'preparing' | 'uploading' | 'waiting_for_connection' | 'sending' | 'cancelling' | 'published' | 'cancelled' | 'expired' | 'rejected';
|
|
105
|
+
uploadedBytes: number;
|
|
106
|
+
totalBytes: number;
|
|
107
|
+
errorCode?: string;
|
|
108
|
+
errorMessage?: string;
|
|
109
|
+
}
|
|
110
|
+
/** Native owns remote work once enqueue persists the request. Implementations
|
|
111
|
+
* must treat enqueue as idempotent for a deliveryId and survive missing JS callbacks. */
|
|
112
|
+
export interface EndpointBackgroundMediaAdapter<Source> {
|
|
113
|
+
observationVersion?: 2;
|
|
114
|
+
preparedContentVersion?: 1;
|
|
115
|
+
available(): Promise<boolean>;
|
|
116
|
+
sourceIdentity(source: Source): string;
|
|
117
|
+
enqueue(input: EndpointMediaInput<Source> & {
|
|
118
|
+
deliveryId: string;
|
|
119
|
+
installationId: string;
|
|
120
|
+
preparedContent?: PreparedContent;
|
|
121
|
+
}): Promise<EndpointBackgroundMediaSnapshot>;
|
|
122
|
+
inspect(): Promise<EndpointBackgroundMediaSnapshot[]>;
|
|
123
|
+
/** Query server state only. Must never enqueue/renew/start transfers. */
|
|
124
|
+
reconcile?(deliveryId: string): Promise<EndpointBackgroundMediaSnapshot>;
|
|
125
|
+
subscribe(listener: (snapshot: EndpointBackgroundMediaSnapshot) => void): () => void;
|
|
126
|
+
cancel(deliveryId: string): Promise<void>;
|
|
127
|
+
cleanup(): Promise<void>;
|
|
128
|
+
cleanupSource?(source: Source): Promise<void>;
|
|
129
|
+
}
|
|
130
|
+
export interface EndpointMediaPipeline<Source> {
|
|
131
|
+
/** Prepare durable attachments for a later policy-controlled message publication. */
|
|
132
|
+
prepare(input: {
|
|
133
|
+
conversationId: string;
|
|
134
|
+
attachmentId: string;
|
|
135
|
+
files: Array<{
|
|
136
|
+
source: Source;
|
|
137
|
+
descriptor: EndpointMediaDescriptor;
|
|
138
|
+
}>;
|
|
139
|
+
}, options?: Omit<EndpointMediaSendOptions, 'beforePublish'>): Promise<Array<Record<string, unknown>>>;
|
|
140
|
+
send(input: {
|
|
141
|
+
conversationId: string;
|
|
142
|
+
messageId: string;
|
|
143
|
+
message: Record<string, unknown>;
|
|
144
|
+
files: Array<{
|
|
145
|
+
source: Source;
|
|
146
|
+
descriptor: EndpointMediaDescriptor;
|
|
147
|
+
}>;
|
|
148
|
+
}, options?: EndpointMediaSendOptions): Promise<string>;
|
|
149
|
+
/** With `conversationId`, false for an encrypted room (or one whose mode is unknown): its files are prepared on the
|
|
150
|
+
* device and sent without the background handoff, so a caller decides before building their descriptors. */
|
|
151
|
+
canSendInBackground(options?: {
|
|
152
|
+
maxProbeWaitMs?: number;
|
|
153
|
+
conversationId?: string;
|
|
154
|
+
}): Promise<boolean>;
|
|
155
|
+
resume(id: string, options?: EndpointMediaSendOptions): Promise<string>;
|
|
156
|
+
resumePending(): Promise<void>;
|
|
157
|
+
setForeground?(active: boolean): void;
|
|
158
|
+
list(conversationId: string): Promise<EndpointMediaFlow[]>;
|
|
159
|
+
subscribe(listener: (flow: EndpointMediaFlow) => void): () => void;
|
|
160
|
+
cancel(id: string): Promise<void>;
|
|
161
|
+
/** Release a prepared source after confirmed use or explicit abandonment. */
|
|
162
|
+
releasePreparedUpload(uploadId: string): Promise<void>;
|
|
163
|
+
close(options?: {
|
|
164
|
+
discard?: boolean;
|
|
165
|
+
}): Promise<void>;
|
|
166
|
+
}
|
|
167
|
+
/** One durable upload→finalize→message dependency graph for every platform. */
|
|
168
|
+
export declare function createEndpointMediaPipeline<Source>(options: {
|
|
169
|
+
endpoint: Endpoint;
|
|
170
|
+
store: EndpointStore;
|
|
171
|
+
bytes: EndpointMediaBytes<Source>;
|
|
172
|
+
hash?: (value: string) => Promise<string>;
|
|
173
|
+
ids?: () => string;
|
|
174
|
+
clock?: () => number;
|
|
175
|
+
leaseMs?: number;
|
|
176
|
+
background?: EndpointBackgroundMediaAdapter<Source>;
|
|
177
|
+
}): EndpointMediaPipeline<Source>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { EndpointResolvedIdentity } from './engine.js';
|
|
2
|
+
import type { EndpointRecoveryBaseline } from './recovery.js';
|
|
3
|
+
import { type EndpointStore } from './store.js';
|
|
4
|
+
export interface EndpointMigrationItem {
|
|
5
|
+
id: string;
|
|
6
|
+
messageId: string;
|
|
7
|
+
kind: 'message.snapshot' | 'message.deleted';
|
|
8
|
+
state: 'review' | 'settled' | 'pending' | 'deferred' | 'uncertain';
|
|
9
|
+
/** Human-reviewed evidence, never a read receipt or last-message marker. */
|
|
10
|
+
reason?: string;
|
|
11
|
+
/** Hash of the retained native transcript/journal/export used for reconciliation. */
|
|
12
|
+
evidenceSha256?: string;
|
|
13
|
+
providerClaim?: {
|
|
14
|
+
id: string;
|
|
15
|
+
status: 'accepted' | 'uncertain' | 'completed';
|
|
16
|
+
};
|
|
17
|
+
/** Existing output identifiers stay in their native journal; import never resends them. */
|
|
18
|
+
legacyOperationIds?: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface EndpointMigrationRoom {
|
|
21
|
+
conversationId: string;
|
|
22
|
+
admissionId: string;
|
|
23
|
+
cursor: string;
|
|
24
|
+
items: EndpointMigrationItem[];
|
|
25
|
+
}
|
|
26
|
+
export interface EndpointRecoveryMigration {
|
|
27
|
+
protocol: 'canon.endpoint-migration.v1';
|
|
28
|
+
identity: EndpointResolvedIdentity;
|
|
29
|
+
baseline: EndpointRecoveryBaseline;
|
|
30
|
+
inventorySha256: string;
|
|
31
|
+
rooms: EndpointMigrationRoom[];
|
|
32
|
+
}
|
|
33
|
+
export interface EndpointMigrationReceipt {
|
|
34
|
+
reviewedSha256: string;
|
|
35
|
+
migrationId: string;
|
|
36
|
+
importedAt: string;
|
|
37
|
+
rooms: number;
|
|
38
|
+
items: number;
|
|
39
|
+
}
|
|
40
|
+
/** Operator-only migration. Inventory does not write cursors or acknowledge agent work. */
|
|
41
|
+
export declare function createEndpointMigration(input: {
|
|
42
|
+
store: EndpointStore;
|
|
43
|
+
ready(): Promise<EndpointResolvedIdentity>;
|
|
44
|
+
query<T>(name: string, parameters: Record<string, unknown>): Promise<T>;
|
|
45
|
+
hash(value: string): Promise<string>;
|
|
46
|
+
clock(): number;
|
|
47
|
+
}): {
|
|
48
|
+
plan(baseline: EndpointRecoveryBaseline, conversationIds?: string[]): Promise<EndpointRecoveryMigration>;
|
|
49
|
+
import(manifest: EndpointRecoveryMigration, reviewedSha256: string): Promise<EndpointMigrationReceipt>;
|
|
50
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type MlsDevCredentialReceipt, type MlsEnvironmentId } from '../backend-contracts/index.js';
|
|
2
|
+
import type { MlsDevDeviceHttpOptions } from './mls-dev-transport.js';
|
|
3
|
+
export interface MlsDevIssuerKey {
|
|
4
|
+
readonly keyVersion: string;
|
|
5
|
+
readonly signaturePublicKey: string;
|
|
6
|
+
}
|
|
7
|
+
export interface MlsDevClientConfiguration {
|
|
8
|
+
readonly version: 1;
|
|
9
|
+
/** A declared MLS environment (`MLS_ENVIRONMENT_PROFILES`); every issuer key belongs to it. */
|
|
10
|
+
readonly environmentId: MlsEnvironmentId;
|
|
11
|
+
readonly enabled: true;
|
|
12
|
+
/**
|
|
13
|
+
* A Dev build's synthetic accounts, the only ones it sets a device up for. A production build lists none: Canon's
|
|
14
|
+
* eligibility (`/endpoint/capabilities`) decides who uses MLS, so an account made after the build can.
|
|
15
|
+
*/
|
|
16
|
+
readonly principalIds?: readonly string[];
|
|
17
|
+
readonly issuerKeys: readonly MlsDevIssuerKey[];
|
|
18
|
+
/** The feed-receipt keys native checks Canon's signed acceptance times with (mls-signed-acceptance.md). */
|
|
19
|
+
readonly receiptKeys: readonly MlsDevIssuerKey[];
|
|
20
|
+
}
|
|
21
|
+
/** An environment's reviewed gateway routes on its own API origin, never values learned from a credential response. */
|
|
22
|
+
export declare function mlsDevDeviceHttpConfiguration(environmentId: MlsEnvironmentId): Readonly<MlsDevDeviceHttpOptions>;
|
|
23
|
+
/** Public build configuration. Issuer pins must come from reviewed provisioning;
|
|
24
|
+
* authenticated service responses are not a trust-root distribution channel. */
|
|
25
|
+
export declare function parseMlsDevClientConfiguration(value: unknown): MlsDevClientConfiguration;
|
|
26
|
+
/** Canonical issuer signature and current validity only. The coordinator binds
|
|
27
|
+
* the credential to its device/proof; services separately enforce online status.
|
|
28
|
+
* Kept in an opt-in entry point so ordinary endpoint imports load no crypto. */
|
|
29
|
+
export declare function createMlsDevCredentialVerifier(options: {
|
|
30
|
+
issuerKeys: readonly MlsDevIssuerKey[];
|
|
31
|
+
clock?: () => number;
|
|
32
|
+
}): (receipt: MlsDevCredentialReceipt) => Promise<boolean>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type MlsDevEnrollmentPrincipal, type MlsDevCredentialReceipt } from '../backend-contracts/index.js';
|
|
2
|
+
import type { EndpointResolvedIdentity } from './engine.js';
|
|
3
|
+
import { type MlsDevDeviceView, type MlsDevProtectedPreparer } from './mls-dev-device.js';
|
|
4
|
+
import type { MlsDevDeviceTransport } from './mls-dev-transport.js';
|
|
5
|
+
import { type EndpointStore, type EndpointStoreTransaction } from './store.js';
|
|
6
|
+
import type { MlsDevProtectedGroupPreparer } from './mls-dev-groups.js';
|
|
7
|
+
import type { MlsDevProtectedKeyPackagePreparer } from './mls-dev-key-packages.js';
|
|
8
|
+
export interface MlsDevDeviceClientOptions {
|
|
9
|
+
principal: MlsDevEnrollmentPrincipal;
|
|
10
|
+
prepareProtected: MlsDevProtectedPreparer;
|
|
11
|
+
/** Independently pinned issuer signature, trust and current expiry verification. */
|
|
12
|
+
verifyCredential(receipt: MlsDevCredentialReceipt): Promise<boolean>;
|
|
13
|
+
/** Opts in to local device-bound KeyPackage preparation; no publication. */
|
|
14
|
+
prepareProtectedKeyPackage?: MlsDevProtectedKeyPackagePreparer;
|
|
15
|
+
prepareProtectedGroup?: MlsDevProtectedGroupPreparer;
|
|
16
|
+
}
|
|
17
|
+
/** Explicit synthetic Dev operations. No timers, eager enrollment or room authority. */
|
|
18
|
+
export interface MlsDevDeviceClient {
|
|
19
|
+
read(): Promise<MlsDevDeviceView>;
|
|
20
|
+
/** Ensure local registration; an existing view is not an online status check. */
|
|
21
|
+
enroll(): Promise<MlsDevDeviceView>;
|
|
22
|
+
renew(): Promise<MlsDevDeviceView>;
|
|
23
|
+
/** Requires a committed same-key credential proof, but not an issuer receipt. */
|
|
24
|
+
reconcile(): Promise<MlsDevDeviceView>;
|
|
25
|
+
/** Resume deliberate provisioning and keep an enrolled device ready, renewing
|
|
26
|
+
* once less than half the credential's lifetime remains, so whatever this
|
|
27
|
+
* device sends stays valid for receivers at least that long. While the
|
|
28
|
+
* current credential is valid, a failed renewal returns it and is retried
|
|
29
|
+
* after a minute. Never creates an unrequested enrollment. */
|
|
30
|
+
ensureReady(): Promise<MlsDevDeviceView>;
|
|
31
|
+
}
|
|
32
|
+
/** Whether readiness would renew this registered device: it has no credential, or less than half its lifetime remains. */
|
|
33
|
+
export declare function isMlsDevCredentialRenewalDue(view: MlsDevDeviceView, now: number): boolean;
|
|
34
|
+
/** Internal factory: the engine owns storage, lifetime, identity and generation. */
|
|
35
|
+
export interface MlsDevDeviceClientContext {
|
|
36
|
+
store: EndpointStore;
|
|
37
|
+
ready(): Promise<{
|
|
38
|
+
identity: EndpointResolvedIdentity;
|
|
39
|
+
installationGeneration: number;
|
|
40
|
+
}>;
|
|
41
|
+
/** The account's MLS principal ID, its alias (mls-dev-groups.md, erasure privacy), as Canon gave and this device checked
|
|
42
|
+
* it; the account ID itself while it has none. Bindings, credentials and rosters carry it. */
|
|
43
|
+
mlsPrincipalId(): Promise<string>;
|
|
44
|
+
signal: AbortSignal;
|
|
45
|
+
assertOpen(): void;
|
|
46
|
+
assertCurrent(tx: EndpointStoreTransaction): Promise<void>;
|
|
47
|
+
run<T>(work: () => Promise<T>): Promise<T>;
|
|
48
|
+
transport: MlsDevDeviceTransport | undefined;
|
|
49
|
+
clock: () => number;
|
|
50
|
+
ids: () => string;
|
|
51
|
+
}
|
|
52
|
+
export declare function createMlsDevDeviceClient(options: MlsDevDeviceClientOptions, context: MlsDevDeviceClientContext): MlsDevDeviceClient;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type MlsDevCredentialChallenge, type MlsDevCredentialCompleteRequest, type MlsDevCredentialReceipt, type MlsDevCredentialRevocationReceipt, type MlsDevCredentialReconciliationChallenge, type MlsDevCredentialReconciliationCompleteRequest, type MlsDevCredentialReconciliationReceipt, type MlsDevDeviceBinding, type MlsDevDeviceCommand, type MlsDevDeviceContext, type MlsDevDevicePreparation, type MlsDevEnrollmentBeginRequest, type MlsDevEnrollmentChallenge, type MlsDevEnrollmentCompleteRequest, type MlsDevEnrollmentResult } from '../backend-contracts/index.js';
|
|
2
|
+
import { type EndpointStore, type EndpointStoreTransaction } from './store.js';
|
|
3
|
+
type ProofCommand = Exclude<MlsDevDeviceCommand, {
|
|
4
|
+
op: 'create';
|
|
5
|
+
}>;
|
|
6
|
+
type Complete = MlsDevEnrollmentCompleteRequest | MlsDevCredentialCompleteRequest | MlsDevCredentialReconciliationCompleteRequest;
|
|
7
|
+
/** Public observations only. A cached credential is not proof of current online
|
|
8
|
+
* device/issuer status. Protected state never appears in this view. */
|
|
9
|
+
export interface MlsDevDeviceView {
|
|
10
|
+
readonly status: 'absent' | 'identity_committed' | 'registered' | 'credential_committed' | 'revoked';
|
|
11
|
+
readonly binding: MlsDevDeviceBinding;
|
|
12
|
+
readonly signaturePublicKey?: string;
|
|
13
|
+
readonly credentialGeneration: number;
|
|
14
|
+
/** Monotonic local observation used for the next issuance base. Not authority. */
|
|
15
|
+
readonly observedCredentialGeneration: number;
|
|
16
|
+
readonly registration?: MlsDevEnrollmentResult;
|
|
17
|
+
readonly credential?: MlsDevCredentialReceipt;
|
|
18
|
+
readonly generationObservation?: MlsDevCredentialReconciliationReceipt;
|
|
19
|
+
readonly revocation?: MlsDevCredentialRevocationReceipt;
|
|
20
|
+
}
|
|
21
|
+
/** This is a security boundary, not a JavaScript key-generation implementation.
|
|
22
|
+
* The host must authenticate revision-bound protected state and the complete
|
|
23
|
+
* typed command, enforce its native clock, and return no private material. */
|
|
24
|
+
export type MlsDevProtectedPreparer = (context: MlsDevDeviceContext, command: MlsDevDeviceCommand, wrappedState: string | null) => Promise<MlsDevDevicePreparation>;
|
|
25
|
+
/** Internal same-journal capture for device-bound MLS preparation. It is never
|
|
26
|
+
* returned through the public device view or treated as publication authority. */
|
|
27
|
+
export interface MlsDevKeyPackagePrerequisite {
|
|
28
|
+
context: MlsDevDeviceContext;
|
|
29
|
+
wrappedState: string;
|
|
30
|
+
credential: MlsDevCredentialReceipt;
|
|
31
|
+
registration: MlsDevEnrollmentResult;
|
|
32
|
+
fingerprint: string;
|
|
33
|
+
}
|
|
34
|
+
/** Explicit synthetic Dev coordinator. It owns no transport, timer or retry
|
|
35
|
+
* loop. The caller supplies an already initialized endpoint store and sends
|
|
36
|
+
* only the committed public requests returned by these methods. */
|
|
37
|
+
export declare function createMlsDevDeviceCoordinator(input: {
|
|
38
|
+
store: EndpointStore;
|
|
39
|
+
binding: MlsDevDeviceBinding;
|
|
40
|
+
/** The endpoint identity's account, when the binding's principal is its alias. */
|
|
41
|
+
accountId?: string;
|
|
42
|
+
installationGeneration: number;
|
|
43
|
+
prepareProtected: MlsDevProtectedPreparer;
|
|
44
|
+
/** Required independent issuer signature/trust validation, outside storage.
|
|
45
|
+
* A structural JWS parser or a caller-selected public key is insufficient. */
|
|
46
|
+
verifyCredential(receipt: MlsDevCredentialReceipt): Promise<boolean>;
|
|
47
|
+
/** Authenticates the server response independently. Structural parsing and
|
|
48
|
+
* the device's own proof cannot authenticate an observation. Missing denies. */
|
|
49
|
+
verifyGenerationObservation?(receipt: MlsDevCredentialReconciliationReceipt): Promise<boolean>;
|
|
50
|
+
}): {
|
|
51
|
+
read: () => Promise<MlsDevDeviceView>;
|
|
52
|
+
captureKeyPackagePrerequisite(tx: EndpointStoreTransaction): Promise<MlsDevKeyPackagePrerequisite>;
|
|
53
|
+
/** A credential proof pins registration in native custody. Its journal row
|
|
54
|
+
* commits with that protected state, even if no issuer receipt was received.
|
|
55
|
+
* Historical proofs remain evidence of the pin after expiry/renewal. */
|
|
56
|
+
hasCommittedCredentialProof(): Promise<boolean>;
|
|
57
|
+
/** Look up an exact committed proof without asking custody to sign again.
|
|
58
|
+
* The driver uses this before refreshing an expired, unprepared challenge. */
|
|
59
|
+
readCommittedProof(value: ProofCommand): Promise<Complete | undefined>;
|
|
60
|
+
ensureIdentity(): Promise<MlsDevEnrollmentBeginRequest>;
|
|
61
|
+
prepareEnrollmentProof(challenge: MlsDevEnrollmentChallenge): Promise<MlsDevEnrollmentCompleteRequest>;
|
|
62
|
+
prepareCredentialProof(challenge: MlsDevCredentialChallenge, expectedCredentialGeneration: number): Promise<MlsDevCredentialCompleteRequest>;
|
|
63
|
+
prepareCredentialReconciliationProof(challenge: MlsDevCredentialReconciliationChallenge, expectedCredentialGeneration: number): Promise<MlsDevCredentialReconciliationCompleteRequest>;
|
|
64
|
+
acceptRegistration(challengeId: string, value: MlsDevEnrollmentResult): Promise<MlsDevDeviceView>;
|
|
65
|
+
acceptCredential(challengeId: string, value: MlsDevCredentialReceipt): Promise<MlsDevDeviceView>;
|
|
66
|
+
acceptGenerationObservation(challengeId: string, value: MlsDevCredentialReconciliationReceipt): Promise<MlsDevDeviceView>;
|
|
67
|
+
acceptRevocation(value: MlsDevCredentialRevocationReceipt): Promise<MlsDevDeviceView>;
|
|
68
|
+
};
|
|
69
|
+
export {};
|