@canonmsg/agent-sdk 11.2.1 → 12.0.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 +171 -536
- package/dist/chunks/chunk-6VK4UZHJ.js +2806 -0
- package/dist/chunks/chunk-FPQFTTND.js +4899 -0
- package/dist/chunks/chunk-OLJ7H4E2.js +14705 -0
- package/dist/chunks/mls-crypto-NZDNSPAO.js +10 -0
- package/dist/cli.js +198 -0
- package/dist/drivers/claude.d.ts +36 -0
- package/dist/drivers/code.d.ts +18 -0
- package/dist/drivers/codex.d.ts +37 -0
- package/dist/index.d.ts +12 -25
- package/dist/index.js +69 -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 +159 -0
- package/dist/internal/backend-contracts/artifacts.d.ts +386 -0
- package/dist/internal/backend-contracts/communication.d.ts +131 -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 +103 -0
- package/dist/internal/backend-contracts/endpointContentPolicy.d.ts +37 -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 +48 -0
- package/dist/internal/backend-contracts/media-url.d.ts +6 -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 +73 -0
- package/dist/internal/backend-contracts/mlsDevCredential.d.ts +75 -0
- package/dist/internal/backend-contracts/mlsDevCredentialReconciliation.d.ts +45 -0
- package/dist/internal/backend-contracts/mlsDevDeviceCustody.d.ts +51 -0
- package/dist/internal/backend-contracts/mlsDevEnrollment.d.ts +74 -0
- package/dist/internal/backend-contracts/mlsDevGroup.d.ts +197 -0
- package/dist/internal/backend-contracts/mlsDevGroupFeed.d.ts +47 -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/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/verbContract.d.ts +848 -0
- package/dist/internal/backend-contracts/verbSchemas.d.ts +1707 -0
- package/dist/internal/backend-contracts/verbWire.d.ts +493 -0
- package/dist/internal/backend-contracts/webAuth.d.ts +8 -0
- package/dist/internal/backend-contracts/workSessions.d.ts +205 -0
- package/dist/internal/core/agent-profiles.d.ts +69 -0
- package/dist/internal/core/agent-resolver.d.ts +49 -0
- package/dist/internal/core/agent-session.d.ts +12 -0
- package/dist/internal/core/approval-format.d.ts +26 -0
- package/dist/internal/core/approval-manager.d.ts +43 -0
- package/dist/internal/core/approval-types.d.ts +74 -0
- package/dist/internal/core/artifacts.d.ts +262 -0
- package/dist/internal/core/attached-native-session.d.ts +174 -0
- package/dist/internal/core/attached-session-file-store.d.ts +3 -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 +486 -0
- package/dist/internal/core/completed-output-journal.d.ts +39 -0
- package/dist/internal/core/constants.d.ts +4 -0
- package/dist/internal/core/control-poller.d.ts +221 -0
- package/dist/internal/core/endpoint-client.d.ts +43 -0
- package/dist/internal/core/exclusive-json-file-store.d.ts +7 -0
- package/dist/internal/core/execution-environment-mode.d.ts +8 -0
- package/dist/internal/core/execution-environment.d.ts +55 -0
- package/dist/internal/core/gifs.d.ts +35 -0
- package/dist/internal/core/group-context.d.ts +25 -0
- package/dist/internal/core/host-runtime.d.ts +257 -0
- package/dist/internal/core/inbound-frame.d.ts +64 -0
- package/dist/internal/core/index.d.ts +107 -0
- package/dist/internal/core/local-runtime-catalog.d.ts +131 -0
- package/dist/internal/core/message-format.d.ts +13 -0
- package/dist/internal/core/native-session-interaction.d.ts +44 -0
- package/dist/internal/core/node-media.d.ts +6 -0
- package/dist/internal/core/policy.d.ts +2 -0
- package/dist/internal/core/provenance.d.ts +31 -0
- package/dist/internal/core/registration-cli.d.ts +40 -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 +21 -0
- package/dist/internal/core/retry.d.ts +122 -0
- package/dist/internal/core/rtdb-rest.d.ts +145 -0
- package/dist/internal/core/runtime-cards.d.ts +331 -0
- package/dist/internal/core/runtime-descriptor.d.ts +75 -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 +35 -0
- package/dist/internal/core/runtime-request-manager.d.ts +284 -0
- package/dist/internal/core/runtime-state-publisher.d.ts +42 -0
- package/dist/internal/core/self-context.d.ts +61 -0
- package/dist/internal/core/silent-turn.d.ts +86 -0
- package/dist/internal/core/stream.d.ts +77 -0
- package/dist/internal/core/turn-output-controller.d.ts +69 -0
- package/dist/internal/core/turn-protocol.d.ts +33 -0
- package/dist/internal/core/turn-verbosity.d.ts +97 -0
- package/dist/internal/core/types.d.ts +1075 -0
- package/dist/internal/core/typing-status-publisher.d.ts +14 -0
- package/dist/internal/core/unified-diff.d.ts +35 -0
- package/dist/internal/core/work-session-provider.d.ts +29 -0
- package/dist/internal/core/workspace-discovery.d.ts +17 -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 +219 -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 +172 -0
- package/dist/internal/endpoint/migration.d.ts +50 -0
- package/dist/internal/endpoint/mls-crypto.d.ts +25 -0
- package/dist/internal/endpoint/mls-dev-client.d.ts +44 -0
- package/dist/internal/endpoint/mls-dev-device.d.ts +67 -0
- package/dist/internal/endpoint/mls-dev-groups.d.ts +114 -0
- package/dist/internal/endpoint/mls-dev-key-package-service.d.ts +33 -0
- package/dist/internal/endpoint/mls-dev-key-packages.d.ts +42 -0
- package/dist/internal/endpoint/mls-dev-transport.d.ts +37 -0
- package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +24 -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 +58 -0
- package/dist/media.d.ts +1 -1
- package/dist/media.js +42 -541
- package/dist/runner/runner.d.ts +37 -0
- package/dist/runner/types.d.ts +168 -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,32 @@
|
|
|
1
|
+
import { type EndpointTransport } from './transport.js';
|
|
2
|
+
export interface EndpointTransportEvent {
|
|
3
|
+
id?: string;
|
|
4
|
+
kind: string;
|
|
5
|
+
data: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
/** `artifacts` streams `artifact.changed` hints for rooms the principal belongs to. */
|
|
8
|
+
export type EndpointEventFamily = 'messages' | 'contacts' | 'typing_presence' | 'runtime_turn' | 'voice' | 'artifacts';
|
|
9
|
+
export interface EndpointEventObserver {
|
|
10
|
+
families?: EndpointEventFamily[];
|
|
11
|
+
/** Explicit principal projections; room projections follow membership. */
|
|
12
|
+
principalScopes?: string[];
|
|
13
|
+
onConnected?(): void;
|
|
14
|
+
onDisconnected?(): void;
|
|
15
|
+
onError?(error: Error): void;
|
|
16
|
+
}
|
|
17
|
+
/** One reconnect loop and replay token per endpoint, shared by every observer. */
|
|
18
|
+
export declare function createEndpointEventHub(input: {
|
|
19
|
+
transport: EndpointTransport;
|
|
20
|
+
invalidate(event?: EndpointTransportEvent): void;
|
|
21
|
+
onEvent?(event: EndpointTransportEvent): Promise<void>;
|
|
22
|
+
onDisconnected?(): void;
|
|
23
|
+
}): {
|
|
24
|
+
isConnected: () => boolean;
|
|
25
|
+
observe(listener: (event: EndpointTransportEvent) => void, hooks?: EndpointEventObserver): () => void;
|
|
26
|
+
close(): Promise<void>;
|
|
27
|
+
};
|
|
28
|
+
/** Incremental SSE parsing handles CRLF and UTF-8 boundaries without Node APIs. */
|
|
29
|
+
export declare function readEndpointEvents(response: Response, options: {
|
|
30
|
+
signal: AbortSignal;
|
|
31
|
+
idleTimeoutMs?: number;
|
|
32
|
+
}): AsyncGenerator<EndpointTransportEvent>;
|
|
@@ -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, MlsDevGroupView, MlsDevGroupRecoveryFailure, MlsDevProtectedGroupPreparer } from './mls-dev-groups.js';
|
|
@@ -0,0 +1,172 @@
|
|
|
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
|
+
}>;
|
|
56
|
+
purpose?: 'prepare';
|
|
57
|
+
publicationGeneration?: number;
|
|
58
|
+
/** Frozen at initial staging; an upgrade must never move an uncertain delivery to another publisher. */
|
|
59
|
+
deliveryMode?: 'legacy' | 'background';
|
|
60
|
+
observation?: DeliveryObservation;
|
|
61
|
+
/** Sealed at initial staging; session renewal never changes these bytes. */
|
|
62
|
+
preparedContent?: PreparedContent;
|
|
63
|
+
attention?: DeliveryAttention;
|
|
64
|
+
background?: {
|
|
65
|
+
phase: EndpointBackgroundMediaSnapshot['status'];
|
|
66
|
+
uploadedBytes: number;
|
|
67
|
+
totalBytes: number;
|
|
68
|
+
};
|
|
69
|
+
status: 'pending' | 'sending' | 'prepared' | 'succeeded' | 'cancelled' | 'rejected';
|
|
70
|
+
error?: {
|
|
71
|
+
message: string;
|
|
72
|
+
code?: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export interface EndpointMediaProgress {
|
|
76
|
+
phase: 'preparing' | 'uploading' | 'waiting_for_connection' | 'finalizing' | 'sending' | 'cancelling';
|
|
77
|
+
uploadedBytes: number;
|
|
78
|
+
totalBytes: number;
|
|
79
|
+
}
|
|
80
|
+
export interface EndpointMediaSendOptions {
|
|
81
|
+
signal?: AbortSignal;
|
|
82
|
+
onProgress?: (progress: EndpointMediaProgress) => void;
|
|
83
|
+
beforePublish?: () => Promise<boolean>;
|
|
84
|
+
/** The caller's bounded preflight choice. Existing flows always keep their persisted mode. */
|
|
85
|
+
handoffMode?: 'background' | 'legacy';
|
|
86
|
+
}
|
|
87
|
+
export interface EndpointMediaInput<Source> {
|
|
88
|
+
conversationId: string;
|
|
89
|
+
messageId: string;
|
|
90
|
+
message: Record<string, unknown>;
|
|
91
|
+
files: Array<{
|
|
92
|
+
source: Source;
|
|
93
|
+
descriptor: EndpointMediaDescriptor;
|
|
94
|
+
}>;
|
|
95
|
+
}
|
|
96
|
+
export interface EndpointBackgroundMediaSnapshot {
|
|
97
|
+
identity?: Pick<DeliveryObservation, 'messageId' | 'conversationId' | 'installationId' | 'environmentId'>;
|
|
98
|
+
schemaVersion?: 2;
|
|
99
|
+
observation?: DeliveryObservation;
|
|
100
|
+
attention?: DeliveryAttention;
|
|
101
|
+
deliveryId: string;
|
|
102
|
+
status: 'preparing' | 'uploading' | 'waiting_for_connection' | 'sending' | 'cancelling' | 'published' | 'cancelled' | 'expired' | 'rejected';
|
|
103
|
+
uploadedBytes: number;
|
|
104
|
+
totalBytes: number;
|
|
105
|
+
errorCode?: string;
|
|
106
|
+
errorMessage?: string;
|
|
107
|
+
}
|
|
108
|
+
/** Native owns remote work once enqueue persists the request. Implementations
|
|
109
|
+
* must treat enqueue as idempotent for a deliveryId and survive missing JS callbacks. */
|
|
110
|
+
export interface EndpointBackgroundMediaAdapter<Source> {
|
|
111
|
+
observationVersion?: 2;
|
|
112
|
+
preparedContentVersion?: 1;
|
|
113
|
+
available(): Promise<boolean>;
|
|
114
|
+
sourceIdentity(source: Source): string;
|
|
115
|
+
enqueue(input: EndpointMediaInput<Source> & {
|
|
116
|
+
deliveryId: string;
|
|
117
|
+
installationId: string;
|
|
118
|
+
preparedContent?: PreparedContent;
|
|
119
|
+
}): Promise<EndpointBackgroundMediaSnapshot>;
|
|
120
|
+
inspect(): Promise<EndpointBackgroundMediaSnapshot[]>;
|
|
121
|
+
/** Query server state only. Must never enqueue/renew/start transfers. */
|
|
122
|
+
reconcile?(deliveryId: string): Promise<EndpointBackgroundMediaSnapshot>;
|
|
123
|
+
subscribe(listener: (snapshot: EndpointBackgroundMediaSnapshot) => void): () => void;
|
|
124
|
+
cancel(deliveryId: string): Promise<void>;
|
|
125
|
+
cleanup(): Promise<void>;
|
|
126
|
+
cleanupSource?(source: Source): Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
export interface EndpointMediaPipeline<Source> {
|
|
129
|
+
/** Prepare durable attachments for a later policy-controlled message publication. */
|
|
130
|
+
prepare(input: {
|
|
131
|
+
conversationId: string;
|
|
132
|
+
attachmentId: string;
|
|
133
|
+
files: Array<{
|
|
134
|
+
source: Source;
|
|
135
|
+
descriptor: EndpointMediaDescriptor;
|
|
136
|
+
}>;
|
|
137
|
+
}, options?: Omit<EndpointMediaSendOptions, 'beforePublish'>): Promise<Array<Record<string, unknown>>>;
|
|
138
|
+
send(input: {
|
|
139
|
+
conversationId: string;
|
|
140
|
+
messageId: string;
|
|
141
|
+
message: Record<string, unknown>;
|
|
142
|
+
files: Array<{
|
|
143
|
+
source: Source;
|
|
144
|
+
descriptor: EndpointMediaDescriptor;
|
|
145
|
+
}>;
|
|
146
|
+
}, options?: EndpointMediaSendOptions): Promise<string>;
|
|
147
|
+
canSendInBackground(options?: {
|
|
148
|
+
maxProbeWaitMs?: number;
|
|
149
|
+
}): Promise<boolean>;
|
|
150
|
+
resume(id: string, options?: EndpointMediaSendOptions): Promise<string>;
|
|
151
|
+
resumePending(): Promise<void>;
|
|
152
|
+
setForeground?(active: boolean): void;
|
|
153
|
+
list(conversationId: string): Promise<EndpointMediaFlow[]>;
|
|
154
|
+
subscribe(listener: (flow: EndpointMediaFlow) => void): () => void;
|
|
155
|
+
cancel(id: string): Promise<void>;
|
|
156
|
+
/** Release a prepared source after confirmed use or explicit abandonment. */
|
|
157
|
+
releasePreparedUpload(uploadId: string): Promise<void>;
|
|
158
|
+
close(options?: {
|
|
159
|
+
discard?: boolean;
|
|
160
|
+
}): Promise<void>;
|
|
161
|
+
}
|
|
162
|
+
/** One durable upload→finalize→message dependency graph for every platform. */
|
|
163
|
+
export declare function createEndpointMediaPipeline<Source>(options: {
|
|
164
|
+
endpoint: Endpoint;
|
|
165
|
+
store: EndpointStore;
|
|
166
|
+
bytes: EndpointMediaBytes<Source>;
|
|
167
|
+
hash?: (value: string) => Promise<string>;
|
|
168
|
+
ids?: () => string;
|
|
169
|
+
clock?: () => number;
|
|
170
|
+
leaseMs?: number;
|
|
171
|
+
background?: EndpointBackgroundMediaAdapter<Source>;
|
|
172
|
+
}): 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,25 @@
|
|
|
1
|
+
import { type MlsDevCredentialReceipt } 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
|
+
readonly environmentId: 'canon-dev-v1';
|
|
10
|
+
readonly enabled: true;
|
|
11
|
+
readonly principalIds: readonly string[];
|
|
12
|
+
readonly issuerKeys: readonly MlsDevIssuerKey[];
|
|
13
|
+
}
|
|
14
|
+
/** Reviewed Dev gateway routes, never values learned from a credential response. */
|
|
15
|
+
export declare const MLS_DEV_DEVICE_HTTP_CONFIGURATION: Readonly<MlsDevDeviceHttpOptions>;
|
|
16
|
+
/** Public build configuration. Issuer pins must come from reviewed provisioning;
|
|
17
|
+
* authenticated service responses are not a trust-root distribution channel. */
|
|
18
|
+
export declare function parseMlsDevClientConfiguration(value: unknown): MlsDevClientConfiguration;
|
|
19
|
+
/** Canonical issuer signature and current validity only. The coordinator binds
|
|
20
|
+
* the credential to its device/proof; services separately enforce online status.
|
|
21
|
+
* Kept in an opt-in entry point so ordinary endpoint imports load no crypto. */
|
|
22
|
+
export declare function createMlsDevCredentialVerifier(options: {
|
|
23
|
+
issuerKeys: readonly MlsDevIssuerKey[];
|
|
24
|
+
clock?: () => number;
|
|
25
|
+
}): (receipt: MlsDevCredentialReceipt) => Promise<boolean>;
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
* within five minutes of expiry. Never creates an unrequested enrollment. */
|
|
27
|
+
ensureReady(): Promise<MlsDevDeviceView>;
|
|
28
|
+
}
|
|
29
|
+
/** Internal factory: the engine owns storage, lifetime, identity and generation. */
|
|
30
|
+
export interface MlsDevDeviceClientContext {
|
|
31
|
+
store: EndpointStore;
|
|
32
|
+
ready(): Promise<{
|
|
33
|
+
identity: EndpointResolvedIdentity;
|
|
34
|
+
installationGeneration: number;
|
|
35
|
+
}>;
|
|
36
|
+
signal: AbortSignal;
|
|
37
|
+
assertOpen(): void;
|
|
38
|
+
assertCurrent(tx: EndpointStoreTransaction): Promise<void>;
|
|
39
|
+
run<T>(work: () => Promise<T>): Promise<T>;
|
|
40
|
+
transport: MlsDevDeviceTransport | undefined;
|
|
41
|
+
clock: () => number;
|
|
42
|
+
ids: () => string;
|
|
43
|
+
}
|
|
44
|
+
export declare function createMlsDevDeviceClient(options: MlsDevDeviceClientOptions, context: MlsDevDeviceClientContext): MlsDevDeviceClient;
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
installationGeneration: number;
|
|
41
|
+
prepareProtected: MlsDevProtectedPreparer;
|
|
42
|
+
/** Required independent issuer signature/trust validation, outside storage.
|
|
43
|
+
* A structural JWS parser or a caller-selected public key is insufficient. */
|
|
44
|
+
verifyCredential(receipt: MlsDevCredentialReceipt): Promise<boolean>;
|
|
45
|
+
/** Authenticates the server response independently. Structural parsing and
|
|
46
|
+
* the device's own proof cannot authenticate an observation. Missing denies. */
|
|
47
|
+
verifyGenerationObservation?(receipt: MlsDevCredentialReconciliationReceipt): Promise<boolean>;
|
|
48
|
+
}): {
|
|
49
|
+
read: () => Promise<MlsDevDeviceView>;
|
|
50
|
+
captureKeyPackagePrerequisite(tx: EndpointStoreTransaction): Promise<MlsDevKeyPackagePrerequisite>;
|
|
51
|
+
/** A credential proof pins registration in native custody. Its journal row
|
|
52
|
+
* commits with that protected state, even if no issuer receipt was received.
|
|
53
|
+
* Historical proofs remain evidence of the pin after expiry/renewal. */
|
|
54
|
+
hasCommittedCredentialProof(): Promise<boolean>;
|
|
55
|
+
/** Look up an exact committed proof without asking custody to sign again.
|
|
56
|
+
* The driver uses this before refreshing an expired, unprepared challenge. */
|
|
57
|
+
readCommittedProof(value: ProofCommand): Promise<Complete | undefined>;
|
|
58
|
+
ensureIdentity(): Promise<MlsDevEnrollmentBeginRequest>;
|
|
59
|
+
prepareEnrollmentProof(challenge: MlsDevEnrollmentChallenge): Promise<MlsDevEnrollmentCompleteRequest>;
|
|
60
|
+
prepareCredentialProof(challenge: MlsDevCredentialChallenge, expectedCredentialGeneration: number): Promise<MlsDevCredentialCompleteRequest>;
|
|
61
|
+
prepareCredentialReconciliationProof(challenge: MlsDevCredentialReconciliationChallenge, expectedCredentialGeneration: number): Promise<MlsDevCredentialReconciliationCompleteRequest>;
|
|
62
|
+
acceptRegistration(challengeId: string, value: MlsDevEnrollmentResult): Promise<MlsDevDeviceView>;
|
|
63
|
+
acceptCredential(challengeId: string, value: MlsDevCredentialReceipt): Promise<MlsDevDeviceView>;
|
|
64
|
+
acceptGenerationObservation(challengeId: string, value: MlsDevCredentialReconciliationReceipt): Promise<MlsDevDeviceView>;
|
|
65
|
+
acceptRevocation(value: MlsDevCredentialRevocationReceipt): Promise<MlsDevDeviceView>;
|
|
66
|
+
};
|
|
67
|
+
export {};
|