@canonmsg/agent-sdk 11.2.0 → 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 -238
- package/dist/canon-agent.js +0 -2534
- 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,28 @@
|
|
|
1
|
+
import { type CommunicationRule } from './communication.js';
|
|
2
|
+
/** Shared social membership semantics; presentation and runtime ownership are separate. */
|
|
3
|
+
export type ConversationRole = 'admin' | 'member';
|
|
4
|
+
export type ConversationParticipantType = 'human' | 'ai_agent';
|
|
5
|
+
export interface ConversationParticipantSummary {
|
|
6
|
+
humanCount: number;
|
|
7
|
+
agentCount: number;
|
|
8
|
+
totalCount: number;
|
|
9
|
+
}
|
|
10
|
+
/** `owner` is a read-only legacy spelling, never superior to another admin. */
|
|
11
|
+
export declare function normalizeConversationRole(value: unknown): ConversationRole | null;
|
|
12
|
+
export declare function isConversationAdminRole(value: unknown): boolean;
|
|
13
|
+
export declare function readMembershipRevision(value: unknown): number;
|
|
14
|
+
/** Behavioral scope follows the current roster, never the legacy shape label. */
|
|
15
|
+
export declare function resolveConversationPolicyScope(memberIdsOrCount: unknown): 'direct' | 'group' | 'unknown';
|
|
16
|
+
export declare function buildConversationParticipantSummary(participants: readonly {
|
|
17
|
+
userId: string;
|
|
18
|
+
userType: unknown;
|
|
19
|
+
}[]): {
|
|
20
|
+
participantTypes: Record<string, ConversationParticipantType>;
|
|
21
|
+
participantSummary: ConversationParticipantSummary;
|
|
22
|
+
isAgentChat: boolean;
|
|
23
|
+
};
|
|
24
|
+
/** Legacy fields are compatibility inputs to one conservative invitation policy. */
|
|
25
|
+
export declare function readConversationInvitationPolicy(data: {
|
|
26
|
+
inboundPolicy?: unknown;
|
|
27
|
+
groupJoinPolicy?: unknown;
|
|
28
|
+
} | null | undefined): CommunicationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Transport execution and message publication are different facts. Only an
|
|
2
|
+
* authenticated delivery observation can establish a remote terminal outcome. */
|
|
3
|
+
export type DeliveryRemoteOutcome = 'unknown' | 'pending' | 'published' | 'cancelled' | 'expired' | 'rejected';
|
|
4
|
+
export type DeliveryExecutionPhase = 'preparing' | 'uploading' | 'waiting_for_connection' | 'sending' | 'cancelling' | 'idle';
|
|
5
|
+
export interface DeliveryObservation {
|
|
6
|
+
schemaVersion: 2;
|
|
7
|
+
deliveryId: string;
|
|
8
|
+
messageId: string;
|
|
9
|
+
conversationId: string;
|
|
10
|
+
installationId: string;
|
|
11
|
+
environmentId: string;
|
|
12
|
+
revision: number;
|
|
13
|
+
outcome: DeliveryRemoteOutcome;
|
|
14
|
+
}
|
|
15
|
+
export interface DeliveryAttention {
|
|
16
|
+
code: string;
|
|
17
|
+
retryable: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const isTerminalDeliveryOutcome: (outcome: DeliveryRemoteOutcome) => boolean;
|
|
20
|
+
/** No timestamps/arrival order: a delayed callback cannot undo a server fact. */
|
|
21
|
+
export declare function mergeDeliveryObservation(current: DeliveryObservation | undefined, next: DeliveryObservation, expected: Pick<DeliveryObservation, 'deliveryId' | 'messageId' | 'conversationId'> & Partial<Pick<DeliveryObservation, 'installationId' | 'environmentId'>>): DeliveryObservation | undefined;
|
|
22
|
+
/** Compatibility only; domain state (interaction/agent execution) stays separate. */
|
|
23
|
+
export declare function projectDeliveryStatus(outcome: DeliveryRemoteOutcome, phase: DeliveryExecutionPhase): 'pending' | 'sending' | 'succeeded' | 'cancelled' | 'rejected';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Matches the header line of a PEM private-key block. */
|
|
2
|
+
export declare const PRIVATE_KEY_BLOCK: RegExp;
|
|
3
|
+
/** True when a diff file path (or rename source) matches the sensitive list. */
|
|
4
|
+
export declare function isSensitiveDiffPath(path: string): boolean;
|
|
5
|
+
/** Replace high-confidence credential shapes inside hunk text with `[redacted]`. */
|
|
6
|
+
export declare function redactSecretTokens(text: string): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Metadata-only unread projection, shared by serving and the offline migration. */
|
|
2
|
+
export declare function computeEndpointUnreadProjection(principalId: string, conversation: Record<string, unknown> | undefined, member: Record<string, unknown> | undefined): {
|
|
3
|
+
unmutedAtMs: number;
|
|
4
|
+
} | null;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { type PreparedContent } from './preparedContent.js';
|
|
2
|
+
/** Plaintext endpoint protocol. Identity and authority come from authenticated transport. */
|
|
3
|
+
export declare const CANON_ENDPOINT_PROTOCOL: "canon.endpoint.v1";
|
|
4
|
+
export interface EndpointPreconditions {
|
|
5
|
+
conversationId?: string;
|
|
6
|
+
membershipRevision?: number;
|
|
7
|
+
admissionId?: string;
|
|
8
|
+
targetAdmissionId?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface EndpointOperationRequest {
|
|
11
|
+
protocol: typeof CANON_ENDPOINT_PROTOCOL;
|
|
12
|
+
operationId: string;
|
|
13
|
+
installationId: string;
|
|
14
|
+
action: string;
|
|
15
|
+
/** Agent ownership generation selected when authored; absent for humans. */
|
|
16
|
+
ownershipVersion?: number;
|
|
17
|
+
envelope?: Record<string, unknown>;
|
|
18
|
+
preconditions?: EndpointPreconditions;
|
|
19
|
+
body: {
|
|
20
|
+
encoding: 'json';
|
|
21
|
+
value: Record<string, unknown>;
|
|
22
|
+
};
|
|
23
|
+
/** Additive sealed submission, sent only after capability negotiation. */
|
|
24
|
+
preparedContent?: PreparedContent;
|
|
25
|
+
}
|
|
26
|
+
export interface EndpointOperationError {
|
|
27
|
+
code: string;
|
|
28
|
+
message: string;
|
|
29
|
+
status?: number;
|
|
30
|
+
retryable?: boolean;
|
|
31
|
+
retryAfterMs?: number;
|
|
32
|
+
}
|
|
33
|
+
export type EndpointReceiptStatus = 'pending' | 'succeeded' | 'rejected' | 'uncertain';
|
|
34
|
+
export type EndpointResultReference = {
|
|
35
|
+
kind: 'artifact_asset';
|
|
36
|
+
conversationId: string;
|
|
37
|
+
artifactId: string;
|
|
38
|
+
assetId: string;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'interaction';
|
|
41
|
+
conversationId: string;
|
|
42
|
+
interactionKind: 'input' | 'approval' | 'card' | 'plan';
|
|
43
|
+
requestId: string;
|
|
44
|
+
operationKey: string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: 'upload';
|
|
47
|
+
uploadId: string;
|
|
48
|
+
} | {
|
|
49
|
+
kind: 'media_delivery';
|
|
50
|
+
deliveryId: string;
|
|
51
|
+
installationId: string;
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'voice';
|
|
54
|
+
conversationId: string;
|
|
55
|
+
sessionId: string;
|
|
56
|
+
};
|
|
57
|
+
export interface EndpointOperationReceipt<T = unknown> {
|
|
58
|
+
protocol: typeof CANON_ENDPOINT_PROTOCOL;
|
|
59
|
+
operationId: string;
|
|
60
|
+
installationId: string;
|
|
61
|
+
action: string;
|
|
62
|
+
status: EndpointReceiptStatus;
|
|
63
|
+
result?: T;
|
|
64
|
+
/** Sensitive/bearer results are hydrated for the response, never journaled. */
|
|
65
|
+
resultReference?: EndpointResultReference;
|
|
66
|
+
/** Transient hydration failure: the durable mutation remains succeeded. */
|
|
67
|
+
resultError?: EndpointOperationError;
|
|
68
|
+
error?: EndpointOperationError;
|
|
69
|
+
createdAt: string;
|
|
70
|
+
updatedAt: string;
|
|
71
|
+
}
|
|
72
|
+
export interface EndpointQueryRequest {
|
|
73
|
+
protocol: typeof CANON_ENDPOINT_PROTOCOL;
|
|
74
|
+
query: string;
|
|
75
|
+
parameters: Record<string, unknown>;
|
|
76
|
+
}
|
|
77
|
+
export interface EndpointQueryResponse<T = unknown> {
|
|
78
|
+
protocol: typeof CANON_ENDPOINT_PROTOCOL;
|
|
79
|
+
result: T;
|
|
80
|
+
}
|
|
81
|
+
/** Durable application cursors differ from the live transport's reconnect token. */
|
|
82
|
+
export interface EndpointEvent {
|
|
83
|
+
id: string;
|
|
84
|
+
kind: string;
|
|
85
|
+
conversationId?: string;
|
|
86
|
+
revision?: number;
|
|
87
|
+
cursor?: string;
|
|
88
|
+
durable: boolean;
|
|
89
|
+
data: Record<string, unknown>;
|
|
90
|
+
}
|
|
91
|
+
export interface EndpointCapabilities {
|
|
92
|
+
preparedContentVersion?: 1;
|
|
93
|
+
preparedMediaContentVersion?: 1;
|
|
94
|
+
mediaDeliveryObservationVersion?: 2;
|
|
95
|
+
protocol: typeof CANON_ENDPOINT_PROTOCOL;
|
|
96
|
+
actions: string[];
|
|
97
|
+
queries: string[];
|
|
98
|
+
maintenance: boolean;
|
|
99
|
+
}
|
|
100
|
+
export declare const ENDPOINT_ID_PATTERN: RegExp;
|
|
101
|
+
export declare const ENDPOINT_ACTION_PATTERN: RegExp;
|
|
102
|
+
export declare function isEndpointOperationRequest(value: unknown): value is EndpointOperationRequest;
|
|
103
|
+
export declare function isEndpointOperationReceipt(value: unknown): value is EndpointOperationReceipt;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Classification, not confidentiality: every enabled endpoint codec is JSON.
|
|
2
|
+
* Unknown fields are private content, including inside an `envelope`. Adding a
|
|
3
|
+
* lane requires review; adding content to an existing schema does not make it
|
|
4
|
+
* public. These definitions refer to existing payload schemas, not copies. */
|
|
5
|
+
export type EndpointContentClass = 'public-metadata' | 'private-content' | 'restricted-secret';
|
|
6
|
+
export type EndpointContentLane = 'operation.request' | 'operation.receipt' | 'query.request' | 'query.result' | 'ephemeral.request' | 'ephemeral.result' | 'event';
|
|
7
|
+
/** ID-only operations can still mutate encrypted semantics. These require an
|
|
8
|
+
* authenticated encrypted protocol before they can operate on a protected room.
|
|
9
|
+
* Their routing fields remain public metadata; classification is not authority. */
|
|
10
|
+
export declare const MLS_DEV_UNSUPPORTED_CONTENT_ACTIONS: readonly ["delete_message", "forward_message"];
|
|
11
|
+
export declare const ENDPOINT_CONTENT_ACTIONS: readonly ["mls_application", "mls_group_control", "initialize_endpoint", "append_artifact_command", "retain_artifact_asset", "sync_phone_contacts", "request_work_session", "resolve_work_session_request", "update_agent_behavior_policy", "update_conversation_agent_behavior_policy", "send_message", "delete_message", "forward_message", "react", "verb_execute", "send_contextual_message", "create_interaction", "consume_interaction", "start_conversation", "create_conversation", "add_member", "remove_member", "leave_conversation", "update_member_role", "update_conversation", "rename_conversation", "update_topic", "update_group_avatar", "mark_read", "cancel_queued_message", "set_conversation_preferences", "set_block", "save_contact", "remove_contact", "respond_interaction", "session_control", "approve_contact_request", "reject_contact_request", "cancel_direct_request", "update_message_disposition", "create_upload", "finalize_upload", "delete_upload", "retry_video_processing", "stage_media_message", "cancel_media_message", "renew_media_message_upload", "finalize_memo_stream", "abort_memo_stream", "create_voice_session", "join_voice_session", "decline_voice_session", "end_voice_session", "consume_runtime_signal", "consume_runtime_primitive", "generate_image"];
|
|
12
|
+
export declare const ENDPOINT_CONTENT_FUNCTION_QUERIES: readonly ["mls_group_feed", "mls_group_controls", "list_artifacts", "get_artifact_log", "get_artifact_asset", "discover_agents", "get_unread_summary", "peek_runtime_signal", "list_runtime_primitives", "get_work_session_catalog", "get_work_session_details", "get_work_session_request", "get_agent_behavior_policy", "get_conversation_agent_behavior_policy", "get_ephemeral", "list_voice_sessions", "list_contact_requests", "list_conversations", "list_messages", "get_messages", "admission_fences", "list_contacts", "get_contact", "get_members", "resolve_admission", "resolve_group_admission", "get_runtime_card_state", "conversation", "conversation_changes", "get_upload", "get_media_message", "get_voice_session", "get_image_generation", "get_image_generation_status"];
|
|
13
|
+
export declare const ENDPOINT_CONTENT_QUERIES: readonly ["mls_group_feed", "mls_group_controls", "list_artifacts", "get_artifact_log", "get_artifact_asset", "discover_agents", "get_unread_summary", "peek_runtime_signal", "list_runtime_primitives", "get_work_session_catalog", "get_work_session_details", "get_work_session_request", "get_agent_behavior_policy", "get_conversation_agent_behavior_policy", "get_ephemeral", "list_voice_sessions", "list_contact_requests", "list_conversations", "list_messages", "get_messages", "admission_fences", "list_contacts", "get_contact", "get_members", "resolve_admission", "resolve_group_admission", "get_runtime_card_state", "conversation", "conversation_changes", "get_upload", "get_media_message", "get_voice_session", "get_image_generation", "get_image_generation_status", "admit_messages"];
|
|
14
|
+
export declare const ENDPOINT_CONTENT_EPHEMERALS: readonly ["create_memo_stream", "publish_presence", "publish_typing", "publish_streaming", "publish_turn", "publish_runtime_status", "publish_session_state", "publish_runtime_info", "publish_runtime_activity", "append_memo_chunk"];
|
|
15
|
+
export declare const ENDPOINT_CONTENT_EPHEMERAL_FAMILIES: readonly ["typing", "streaming", "turn-state", "agent-session", "runtime-card-state", "memo-streams", "runtime-info", "runtime-activity", "runtime-suppression", "runtime-silence", "runtime-attention", "call-attention", "agent-runtime", "presence"];
|
|
16
|
+
export declare const ENDPOINT_CONTENT_EVENTS: readonly ["connected", "heartbeat", "agent.context", "replay.expired", "error", "participation.suppressed", "artifact.changed", "message.created", "message.snapshot", "message.updated", "message.deleted", "message.media_terminal", "conversation.updated", "conversation.changed", "conversation.removed", "conversations.changed", "contacts.changed", "contact.added", "contact.updated", "contact.removed", "presence", "typing", "runtime.updated", "runtime.control", "turn.updated", "voice.session.started", "voice.session.ended", ...string[]];
|
|
17
|
+
export declare class EndpointContentPolicyError extends Error {
|
|
18
|
+
readonly code = "ENDPOINT_CONTENT_UNCLASSIFIED";
|
|
19
|
+
constructor(lane: string, name: string);
|
|
20
|
+
}
|
|
21
|
+
export interface EndpointContentBoundary {
|
|
22
|
+
readonly lane: EndpointContentLane;
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly defaultClass: 'private-content';
|
|
25
|
+
/** Paths address the actual payload. Query/result/event paths are relative to
|
|
26
|
+
* their parameters/result/data; operation paths include body.value. */
|
|
27
|
+
classify(path: readonly string[]): EndpointContentClass;
|
|
28
|
+
}
|
|
29
|
+
/** Local journal policy is separate from wire classification. Input answers and
|
|
30
|
+
* card values can carry passwords even when the response omits the original
|
|
31
|
+
* request's secret/sudo/field metadata. Only reviewed response shapes without
|
|
32
|
+
* those value bags may be retried from durable storage. Unknown response fields
|
|
33
|
+
* fail closed; a caller's `sensitive: false` cannot weaken this policy. */
|
|
34
|
+
export declare function endpointOperationRequestRetention(action: string, body: Record<string, unknown>, envelope?: Record<string, unknown>): 'journal' | 'memory';
|
|
35
|
+
/** Validate the lane before accepting/transmitting its payload. No body values
|
|
36
|
+
* are logged, copied into metadata, or claimed to be encrypted by this API. */
|
|
37
|
+
export declare function endpointContentBoundary(lane: EndpointContentLane, name: string, payload?: unknown): EndpointContentBoundary;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const CANON_ENVIRONMENT_CONTRACTS: Readonly<{
|
|
2
|
+
readonly 'canon-dev-v1': Readonly<{
|
|
3
|
+
name: "dev";
|
|
4
|
+
projectId: "canonmail-dev";
|
|
5
|
+
region: "europe-west1";
|
|
6
|
+
}>;
|
|
7
|
+
readonly 'canon-prod-v1': Readonly<{
|
|
8
|
+
name: "prod";
|
|
9
|
+
projectId: "canonmail-prod";
|
|
10
|
+
region: "europe-west1";
|
|
11
|
+
}>;
|
|
12
|
+
}>;
|
|
13
|
+
export type CanonEnvironmentId = keyof typeof CANON_ENVIRONMENT_CONTRACTS;
|
|
14
|
+
export type CanonEnvironmentName = (typeof CANON_ENVIRONMENT_CONTRACTS)[CanonEnvironmentId]['name'];
|
|
15
|
+
export type CanonEnvironmentContract = {
|
|
16
|
+
[EnvironmentId in CanonEnvironmentId]: {
|
|
17
|
+
environmentId: EnvironmentId;
|
|
18
|
+
} & (typeof CANON_ENVIRONMENT_CONTRACTS)[EnvironmentId];
|
|
19
|
+
}[CanonEnvironmentId];
|
|
20
|
+
export declare function getCanonEnvironmentContract(value: string): CanonEnvironmentContract;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** A durable acceptance boundary for an episodic, externally hosted consumer.
|
|
2
|
+
* Replaying a claim reconciles an unknown response; it never authorizes a second run. */
|
|
3
|
+
export interface EndpointExternalInboundClaimResult {
|
|
4
|
+
inputId: string;
|
|
5
|
+
requestId: string;
|
|
6
|
+
status: 'claimed' | 'replayed' | 'unavailable';
|
|
7
|
+
runAllowed: boolean;
|
|
8
|
+
state?: 'uncertain' | 'settled';
|
|
9
|
+
}
|
|
10
|
+
export type EndpointExternalInboundOutcome = 'completed' | 'no_reply';
|
|
11
|
+
export interface EndpointExternalInboundSource {
|
|
12
|
+
conversationId: string;
|
|
13
|
+
messageId: string;
|
|
14
|
+
admissionId: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface EndpointExternalInboundReplyIntent {
|
|
17
|
+
fingerprint: string;
|
|
18
|
+
messageId: string;
|
|
19
|
+
turnId: string;
|
|
20
|
+
}
|
|
21
|
+
/** Closed communication view for delegated consumers. The stream's private
|
|
22
|
+
* memory/policy envelope may evolve without expanding an OAuth grant. Nested
|
|
23
|
+
* message bodies and metadata are already public conversation content. */
|
|
24
|
+
export declare function projectExternalInboundContext(data: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Trimmed string, or null when absent/empty. */
|
|
2
|
+
export declare function normalizeStoredString(value: unknown): string | null;
|
|
3
|
+
/**
|
|
4
|
+
* Firestore Timestamp-like -> ISO 8601, or null. Accepts only objects exposing
|
|
5
|
+
* `toDate()`. A raw `Date` is deliberately NOT accepted: that matches both call
|
|
6
|
+
* sites this replaced. `message.ts` keeps its own
|
|
7
|
+
* Date-tolerant normalizers — a different contract, not this one.
|
|
8
|
+
*/
|
|
9
|
+
export declare function firestoreTimestampToISOString(value: unknown): string | null;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export * from './diffRedaction.js';
|
|
2
|
+
export * from './environment.js';
|
|
3
|
+
export * from './api-origins.generated.js';
|
|
4
|
+
export * from './media.js';
|
|
5
|
+
export * from './mediaDelivery.js';
|
|
6
|
+
export * from './media-url.js';
|
|
7
|
+
export * from './message.js';
|
|
8
|
+
export * from './messageText.js';
|
|
9
|
+
export * from './runtimeCardFields.js';
|
|
10
|
+
export * from './runtimeCardStorage.js';
|
|
11
|
+
export * from './turnProtocol.js';
|
|
12
|
+
export * from './agentBehaviorPolicy.js';
|
|
13
|
+
export * from './agentSearch.js';
|
|
14
|
+
export * from './agentDirectory.js';
|
|
15
|
+
export * from './agentOrigin.js';
|
|
16
|
+
export * from './verbContract.js';
|
|
17
|
+
export * from './verbSchemas.js';
|
|
18
|
+
export * from './verbWire.js';
|
|
19
|
+
export * from './communication.js';
|
|
20
|
+
export * from './apiErrors.js';
|
|
21
|
+
export * from './firestoreValues.js';
|
|
22
|
+
export * from './moderation.js';
|
|
23
|
+
export * from './selfContext.js';
|
|
24
|
+
export * from './replyAuthority.js';
|
|
25
|
+
export * from './runtimeDescriptor.js';
|
|
26
|
+
export * from './workSessions.js';
|
|
27
|
+
export type { WebPhoneAccountRequest, WebPhoneTokenResponse } from './webAuth.js';
|
|
28
|
+
export * from './conversationMembership.js';
|
|
29
|
+
export * from './endpoint.js';
|
|
30
|
+
export * from './externalInbound.js';
|
|
31
|
+
export * from './endpointContentPolicy.js';
|
|
32
|
+
export * from './plaintextProcessors.js';
|
|
33
|
+
export { computeEndpointUnreadProjection } from './endpoint-unread.js';
|
|
34
|
+
export * from './membershipChange.js';
|
|
35
|
+
export * from './deliveryObservation.js';
|
|
36
|
+
export * from './mediaTransferProtocol.js';
|
|
37
|
+
export * from './preparedContent.js';
|
|
38
|
+
export * from './artifacts.js';
|
|
39
|
+
export * from './artifactActions.js';
|
|
40
|
+
export * from './mlsDevEnrollment.js';
|
|
41
|
+
export * from './mlsDevCredential.js';
|
|
42
|
+
export * from './mlsDevCredentialReconciliation.js';
|
|
43
|
+
export * from './mlsDevDeviceCustody.js';
|
|
44
|
+
export * from './mlsDevKeyPackage.js';
|
|
45
|
+
export * from './mlsDevKeyPackages.js';
|
|
46
|
+
export * from './mlsDevGroup.js';
|
|
47
|
+
export * from './mlsDevApplication.js';
|
|
48
|
+
export * from './mlsDevGroupFeed.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function buildFirebaseMediaUrl(bucket: string, storagePath: string, token: string): string;
|
|
2
|
+
export declare function buildMediaDownloadUrl(bucket: string, storagePath: string, token: string): string;
|
|
3
|
+
/** Accept historical Firebase URLs and Canon links, only for the expected bucket. */
|
|
4
|
+
export declare function parseMediaStoragePath(value: unknown, bucket: string): string | null;
|
|
5
|
+
/** Presentation upgrade for existing messages without rewriting their stored URLs. */
|
|
6
|
+
export declare function canonMediaDownloadUrl(value: string, downloadFileName?: string): string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export type MediaAttachmentKind = 'image' | 'audio' | 'video' | 'file';
|
|
2
|
+
/** Allow private conditional caching, but recheck access before every reuse. */
|
|
3
|
+
export declare const MEDIA_CACHE_CONTROL = "private, max-age=0, must-revalidate";
|
|
4
|
+
/** Preserve Unicode and the extension while removing unsafe filesystem characters. */
|
|
5
|
+
export declare function sanitizeDownloadFileName(value: unknown, fallback?: string): string;
|
|
6
|
+
/** RFC 6266: readable ASCII fallback plus the exact UTF-8 filename. */
|
|
7
|
+
export declare function buildMediaContentDisposition(input: {
|
|
8
|
+
fileName?: unknown;
|
|
9
|
+
fallbackFileName: string;
|
|
10
|
+
disposition?: 'inline' | 'attachment';
|
|
11
|
+
}): string;
|
|
12
|
+
/** The processor changes the container to MP4; keep its name consistent everywhere. */
|
|
13
|
+
export declare function processedVideoFileName(value: unknown): string;
|
|
14
|
+
/** Lifecycle for newly uploaded videos that are normalized server-side. */
|
|
15
|
+
export type VideoProcessingStatus = 'processing' | 'ready' | 'failed';
|
|
16
|
+
/** Stable, display-safe reasons for a terminal video processing failure. */
|
|
17
|
+
export type VideoProcessingErrorCode = 'invalid_video' | 'video_limits_exceeded' | 'video_processing_failed';
|
|
18
|
+
export interface MediaAttachment {
|
|
19
|
+
kind: MediaAttachmentKind;
|
|
20
|
+
url: string;
|
|
21
|
+
/**
|
|
22
|
+
* Server-issued identity for a finalized upload. The send path
|
|
23
|
+
* uses this to retain temporary canonical media atomically with the message.
|
|
24
|
+
* Older attachments and forwarded copies may omit it.
|
|
25
|
+
*/
|
|
26
|
+
uploadId?: string;
|
|
27
|
+
mimeType?: string;
|
|
28
|
+
fileName?: string;
|
|
29
|
+
sizeBytes?: number;
|
|
30
|
+
width?: number;
|
|
31
|
+
height?: number;
|
|
32
|
+
durationMs?: number;
|
|
33
|
+
/** Server-generated poster for a normalized video. */
|
|
34
|
+
thumbnailUrl?: string;
|
|
35
|
+
/** Missing means a legacy attachment that is immediately playable. */
|
|
36
|
+
processingStatus?: VideoProcessingStatus;
|
|
37
|
+
processingErrorCode?: VideoProcessingErrorCode;
|
|
38
|
+
}
|
|
39
|
+
export declare function inferMediaAttachmentKind(mimeType: string): MediaAttachmentKind;
|
|
40
|
+
export declare function getStoredFileExtension(input: {
|
|
41
|
+
mimeType?: string | null;
|
|
42
|
+
fileName?: string | null;
|
|
43
|
+
}): string;
|
|
44
|
+
export declare function normalizeStoredAttachments(value: unknown): MediaAttachment[] | null;
|
|
45
|
+
export declare function getMessageAttachments(input: {
|
|
46
|
+
attachments?: unknown;
|
|
47
|
+
}): MediaAttachment[];
|
|
48
|
+
export declare function getPrimaryAttachment(input: {
|
|
49
|
+
attachments?: unknown;
|
|
50
|
+
}): MediaAttachment | null;
|
|
51
|
+
export declare function describeAttachment(attachment: MediaAttachment | null | undefined): string | null;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { PreparedContent } from './preparedContent.js';
|
|
2
|
+
/** A background transfer remains one message even when its files finish separately. */
|
|
3
|
+
export interface MediaDeliveryFileDescriptor {
|
|
4
|
+
fileId: string;
|
|
5
|
+
kind: 'image' | 'video' | 'audio' | 'file';
|
|
6
|
+
mimeType: string;
|
|
7
|
+
fileName?: string;
|
|
8
|
+
sizeBytes: number;
|
|
9
|
+
width?: number;
|
|
10
|
+
height?: number;
|
|
11
|
+
durationMs?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface StageMediaMessageBody {
|
|
14
|
+
/** Capability-gated JSON preparation; absent records settle by their original contract. */
|
|
15
|
+
contentVersion?: 1;
|
|
16
|
+
preparedContent?: PreparedContent;
|
|
17
|
+
conversationId: string;
|
|
18
|
+
messageId: string;
|
|
19
|
+
/** Original send_message body, excluding attachments. The server binds IDs. */
|
|
20
|
+
message: Record<string, unknown>;
|
|
21
|
+
/** Array order is the eventual message attachment order. */
|
|
22
|
+
files: MediaDeliveryFileDescriptor[];
|
|
23
|
+
}
|
|
24
|
+
export type MediaDeliveryStatus = 'pending' | 'published' | 'cancelled' | 'expired' | 'rejected';
|
|
25
|
+
export interface MediaDeliveryFileSession {
|
|
26
|
+
fileId: string;
|
|
27
|
+
uploadId: string;
|
|
28
|
+
generation: number;
|
|
29
|
+
status: 'pending' | 'accepted';
|
|
30
|
+
/** Restricted bearer material, never persisted in an endpoint receipt. */
|
|
31
|
+
uploadUrl?: string;
|
|
32
|
+
expiresAt?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface MediaDeliverySnapshot {
|
|
35
|
+
/** Semantic ordering, independent of callback arrival or device clocks. */
|
|
36
|
+
revision?: number;
|
|
37
|
+
schemaVersion?: 2;
|
|
38
|
+
conversationId?: string;
|
|
39
|
+
installationId?: string;
|
|
40
|
+
environmentId?: string;
|
|
41
|
+
deliveryId: string;
|
|
42
|
+
messageId: string;
|
|
43
|
+
status: MediaDeliveryStatus;
|
|
44
|
+
expiresAt: string;
|
|
45
|
+
files: MediaDeliveryFileSession[];
|
|
46
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type TransferReceiptDecision = 'result' | 'pending' | 'uncertain' | 'rejected' | 'invalid';
|
|
2
|
+
export interface TransferReceiptIdentity {
|
|
3
|
+
protocol: string;
|
|
4
|
+
operationId: string;
|
|
5
|
+
installationId: string;
|
|
6
|
+
action: string;
|
|
7
|
+
}
|
|
8
|
+
/** A transport failure is local attention, never a remote delivery outcome. */
|
|
9
|
+
export declare function classifyTransferHttpFailure(status: number): 'retry' | 'attention';
|
|
10
|
+
/** A successful mutation with failed restricted-result hydration is still
|
|
11
|
+
* unresolved locally. Never translate an operation rejection into a delivery outcome. */
|
|
12
|
+
export declare function classifyTransferReceipt(value: unknown, expected: TransferReceiptIdentity): TransferReceiptDecision;
|
|
13
|
+
/** Shared native recovery policy. Random is injected so all implementations run
|
|
14
|
+
* the same fixture corpus; a longer server retry hint is never truncated. */
|
|
15
|
+
export declare function transferRetryDelay(attempt: number, random: number, retryAfterMs?: number): number;
|
|
16
|
+
/** Expiry bounds automatic work, not the ability to reconcile an unknown result. */
|
|
17
|
+
export declare function mayAttemptMediaTransfer(nowMs: number, createdAtMs: number, expiresAtMs?: number | null): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** A server-written membership transition stored in the ordinary chat history. */
|
|
2
|
+
export interface MembershipChangeMetadata extends Record<string, unknown> {
|
|
3
|
+
type: 'membership_change';
|
|
4
|
+
action: 'added' | 'removed' | 'left';
|
|
5
|
+
actorId: string | null;
|
|
6
|
+
actorName: string | null;
|
|
7
|
+
memberId: string | null;
|
|
8
|
+
memberName: string;
|
|
9
|
+
membershipRevision: number;
|
|
10
|
+
turnSemantics: 'control';
|
|
11
|
+
replyBehavior: 'suppress_auto_reply';
|
|
12
|
+
}
|
|
13
|
+
/** Recognize the reserved marker even when the remaining metadata is malformed. */
|
|
14
|
+
export declare function isMembershipChangeMessage(message: {
|
|
15
|
+
metadata?: unknown;
|
|
16
|
+
}): boolean;
|
|
17
|
+
/** Membership revisions own these document IDs; user messages cannot claim them. */
|
|
18
|
+
export declare function isMembershipChangeMessageId(messageId: unknown): boolean;
|
|
19
|
+
export declare function readMembershipChangeMetadata(metadata: unknown): MembershipChangeMetadata | null;
|
|
20
|
+
/** Uses stored names so the notice remains readable after a profile leaves the roster. */
|
|
21
|
+
export declare function formatMembershipChangeNotice(metadata: MembershipChangeMetadata, currentUserId?: string): string;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { MediaAttachment } from './media.js';
|
|
2
|
+
import { type MlsDevMessageReference } from './mlsDevApplication.js';
|
|
3
|
+
export type SerializedSenderType = 'human' | 'ai_agent';
|
|
4
|
+
/** Canonical agent client identifiers shared by Canon services and clients. */
|
|
5
|
+
export declare const AGENT_CLIENT_TYPES: readonly ["claude-code", "openclaw", "codex", "hermes", "deepseek-harness", "generic"];
|
|
6
|
+
export type SerializedAgentClientType = typeof AGENT_CLIENT_TYPES[number];
|
|
7
|
+
export type SerializedContentType = 'text' | 'image' | 'audio' | 'video' | 'file' | 'contact_card' | 'interaction';
|
|
8
|
+
export interface ForwardedFrom {
|
|
9
|
+
sourceConversationId: string;
|
|
10
|
+
messageId: string;
|
|
11
|
+
}
|
|
12
|
+
export type SerializedReactions = Record<string, string[]>;
|
|
13
|
+
export interface SerializedContactCard {
|
|
14
|
+
userId: string;
|
|
15
|
+
canonContactId?: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
avatarUrl: string | null;
|
|
18
|
+
userType: SerializedSenderType;
|
|
19
|
+
clientType?: SerializedAgentClientType;
|
|
20
|
+
about?: string;
|
|
21
|
+
isActive?: boolean;
|
|
22
|
+
ownerId?: string;
|
|
23
|
+
ownerName?: string;
|
|
24
|
+
lifecycleState?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface SerializedMessage {
|
|
27
|
+
/** Public encrypted-message hint; content is read only from the authenticated MLS feed. */
|
|
28
|
+
mls?: MlsDevMessageReference;
|
|
29
|
+
id: string;
|
|
30
|
+
senderId: string;
|
|
31
|
+
senderName?: string;
|
|
32
|
+
senderType: SerializedSenderType;
|
|
33
|
+
isOwner: boolean;
|
|
34
|
+
contentType: SerializedContentType;
|
|
35
|
+
text: string | null;
|
|
36
|
+
attachments: MediaAttachment[];
|
|
37
|
+
mentions: string[];
|
|
38
|
+
replyTo: string | null;
|
|
39
|
+
replyToPosition: number | null;
|
|
40
|
+
forwarded?: boolean;
|
|
41
|
+
forwardedFrom?: ForwardedFrom;
|
|
42
|
+
status: 'sent' | 'read';
|
|
43
|
+
createdAt: string;
|
|
44
|
+
metadata?: Record<string, unknown>;
|
|
45
|
+
contactCard?: SerializedContactCard;
|
|
46
|
+
/** Durable canon.card.v1 runtime card content, passed through opaquely. */
|
|
47
|
+
runtimeCard?: Record<string, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Plaintext, server-authorized interaction envelope for `contentType:
|
|
50
|
+
* 'interaction'` messages (card / input / approval / plan / contact). The
|
|
51
|
+
* authorization contract (`response`) and preview live here; the opaque
|
|
52
|
+
* request payload rides in `body`.
|
|
53
|
+
*/
|
|
54
|
+
interaction?: SerializedInteraction;
|
|
55
|
+
/** Opaque interaction payload (JSON string or ciphertext); never parsed here. */
|
|
56
|
+
body?: string;
|
|
57
|
+
reactions?: SerializedReactions;
|
|
58
|
+
}
|
|
59
|
+
export type SerializedInteractionKind = 'contact' | 'approval' | 'input' | 'plan' | 'card';
|
|
60
|
+
export interface SerializedInteraction {
|
|
61
|
+
kind: SerializedInteractionKind;
|
|
62
|
+
requestId: string;
|
|
63
|
+
interactive: boolean;
|
|
64
|
+
responseUserId?: string;
|
|
65
|
+
expiresAt?: string;
|
|
66
|
+
schemaVersion?: string;
|
|
67
|
+
preview?: {
|
|
68
|
+
title?: string;
|
|
69
|
+
blockKinds?: string[];
|
|
70
|
+
};
|
|
71
|
+
response?: {
|
|
72
|
+
actionIds?: string[];
|
|
73
|
+
actionFields?: Record<string, unknown>;
|
|
74
|
+
questions?: Array<{
|
|
75
|
+
id: string;
|
|
76
|
+
sensitive?: boolean;
|
|
77
|
+
}>;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export interface SerializeMessageInput {
|
|
81
|
+
id: string;
|
|
82
|
+
data: Record<string, unknown>;
|
|
83
|
+
senderName?: string;
|
|
84
|
+
isOwner: boolean;
|
|
85
|
+
}
|
|
86
|
+
export declare function serializeStoredMessage(input: SerializeMessageInput): SerializedMessage;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Maximum UTF-8 payload size for a human-authored message. */
|
|
2
|
+
export declare const HUMAN_MESSAGE_TEXT_MAX_BYTES: number;
|
|
3
|
+
/** Returns the encoded UTF-8 size used by the message API. */
|
|
4
|
+
export declare function messageTextUtf8ByteLength(value: string): number;
|
|
5
|
+
/** Whether human-authored message text fits the API's UTF-8 byte budget. */
|
|
6
|
+
export declare function isHumanMessageTextWithinLimit(value: string): boolean;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type MlsDevGroupHead } from './mlsDevGroup.js';
|
|
2
|
+
export declare const MLS_DEV_TEXT_PROTOCOL: "canon.mls.dev-text.v1";
|
|
3
|
+
export declare const MLS_DEV_APPLICATION_TLS_MAX_BYTES: number;
|
|
4
|
+
export declare const MLS_DEV_APPLICATION_MAX_BYTES: number;
|
|
5
|
+
export declare const MLS_DEV_TEXT_MAX_BYTES: number;
|
|
6
|
+
export interface MlsDevApplicationPreconditions {
|
|
7
|
+
readonly membershipRevision: number;
|
|
8
|
+
readonly admissionId: string;
|
|
9
|
+
}
|
|
10
|
+
export interface MlsDevApplicationBinding {
|
|
11
|
+
readonly version: 1;
|
|
12
|
+
readonly environmentId: 'canon-dev-v1';
|
|
13
|
+
readonly conversationId: string;
|
|
14
|
+
readonly groupId: string;
|
|
15
|
+
readonly messageId: string;
|
|
16
|
+
readonly senderCredential: string;
|
|
17
|
+
readonly expectedHead: MlsDevGroupHead;
|
|
18
|
+
readonly preconditions: MlsDevApplicationPreconditions;
|
|
19
|
+
}
|
|
20
|
+
export interface MlsDevApplicationUnsignedEnvelope extends MlsDevApplicationBinding {
|
|
21
|
+
readonly ciphertext: string;
|
|
22
|
+
}
|
|
23
|
+
export interface MlsDevApplicationEnvelope extends MlsDevApplicationUnsignedEnvelope {
|
|
24
|
+
readonly proof: string;
|
|
25
|
+
}
|
|
26
|
+
export interface MlsDevApplicationReceipt {
|
|
27
|
+
readonly version: 1;
|
|
28
|
+
readonly authorization: 'encrypted_text_only';
|
|
29
|
+
readonly operationId: string;
|
|
30
|
+
readonly conversationId: string;
|
|
31
|
+
readonly groupId: string;
|
|
32
|
+
readonly messageId: string;
|
|
33
|
+
readonly feedOrdinal: number;
|
|
34
|
+
readonly head: MlsDevGroupHead;
|
|
35
|
+
readonly acceptedAtMs: number;
|
|
36
|
+
readonly envelopeHash: string;
|
|
37
|
+
}
|
|
38
|
+
export interface MlsDevTextPayload {
|
|
39
|
+
readonly version: 1;
|
|
40
|
+
readonly kind: 'text';
|
|
41
|
+
readonly conversationId: string;
|
|
42
|
+
readonly groupId: string;
|
|
43
|
+
readonly messageId: string;
|
|
44
|
+
readonly operationId: string;
|
|
45
|
+
readonly senderDeviceId: string;
|
|
46
|
+
readonly text: string;
|
|
47
|
+
}
|
|
48
|
+
/** Public projection only. Plaintext is produced locally after authenticated MLS receive. */
|
|
49
|
+
export interface MlsDevMessageReference {
|
|
50
|
+
readonly version: 1;
|
|
51
|
+
readonly protocol: typeof MLS_DEV_TEXT_PROTOCOL;
|
|
52
|
+
readonly groupId: string;
|
|
53
|
+
readonly messageId: string;
|
|
54
|
+
readonly operationId: string;
|
|
55
|
+
readonly feedOrdinal: number;
|
|
56
|
+
readonly head: MlsDevGroupHead;
|
|
57
|
+
readonly envelopeHash: string;
|
|
58
|
+
}
|
|
59
|
+
export declare class MlsDevApplicationValidationError extends Error {
|
|
60
|
+
readonly code = "INVALID_MLS_DEV_APPLICATION";
|
|
61
|
+
constructor();
|
|
62
|
+
}
|
|
63
|
+
export declare function parseMlsDevApplicationWire(value: unknown): string;
|
|
64
|
+
export declare function parseMlsDevApplicationPreconditions(value: unknown): MlsDevApplicationPreconditions;
|
|
65
|
+
export declare function parseMlsDevApplicationBinding(value: unknown): MlsDevApplicationBinding;
|
|
66
|
+
export declare function parseMlsDevApplicationUnsignedEnvelope(value: unknown): MlsDevApplicationUnsignedEnvelope;
|
|
67
|
+
export declare function parseMlsDevApplicationEnvelope(value: unknown): MlsDevApplicationEnvelope;
|
|
68
|
+
export declare function parseMlsDevApplicationReceipt(value: unknown): MlsDevApplicationReceipt;
|
|
69
|
+
export declare function parseMlsDevTextPayload(value: unknown): MlsDevTextPayload;
|
|
70
|
+
export declare function parseMlsDevMessageReference(value: unknown): MlsDevMessageReference;
|
|
71
|
+
export declare function encodeMlsDevApplicationProof(value: unknown, operationId: string): Uint8Array;
|
|
72
|
+
export declare function encodeMlsDevApplicationEnvelopeHash(value: unknown, operationId: string): Uint8Array;
|
|
73
|
+
export declare function encodeMlsDevApplicationAad(value: unknown, operationId: string): Uint8Array;
|