@canonmsg/agent-sdk 11.2.1 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +248 -523
- package/dist/chunks/chunk-7N6OPPW4.js +5430 -0
- package/dist/chunks/chunk-N722GWCP.js +4897 -0
- package/dist/chunks/chunk-QZ4PPRQW.js +14247 -0
- package/dist/chunks/mls-crypto-LMNQZOS6.js +10 -0
- package/dist/cli.js +572 -0
- package/dist/drivers/claude.d.ts +42 -0
- package/dist/drivers/code.d.ts +18 -0
- package/dist/drivers/codex.d.ts +46 -0
- package/dist/drivers/connector.d.ts +34 -0
- package/dist/index.d.ts +20 -25
- package/dist/index.js +91 -13
- package/dist/internal/backend-contracts/agentBehaviorPolicy.d.ts +122 -0
- package/dist/internal/backend-contracts/agentDirectory.d.ts +32 -0
- package/dist/internal/backend-contracts/agentOrigin.d.ts +23 -0
- package/dist/internal/backend-contracts/agentSearch.d.ts +17 -0
- package/dist/internal/backend-contracts/api-origins.generated.d.ts +4 -0
- package/dist/internal/backend-contracts/apiErrors.d.ts +1 -0
- package/dist/internal/backend-contracts/artifactActions.d.ts +8 -0
- package/dist/internal/backend-contracts/artifacts.d.ts +386 -0
- package/dist/internal/backend-contracts/clientFloor.d.ts +41 -0
- package/dist/internal/backend-contracts/communication.d.ts +146 -0
- package/dist/internal/backend-contracts/connectorRelay.d.ts +179 -0
- package/dist/internal/backend-contracts/conversationMembership.d.ts +28 -0
- package/dist/internal/backend-contracts/deliveryObservation.d.ts +23 -0
- package/dist/internal/backend-contracts/diffRedaction.d.ts +6 -0
- package/dist/internal/backend-contracts/endpoint-unread.d.ts +4 -0
- package/dist/internal/backend-contracts/endpoint.d.ts +120 -0
- package/dist/internal/backend-contracts/endpointContentPolicy.d.ts +48 -0
- package/dist/internal/backend-contracts/environment.d.ts +20 -0
- package/dist/internal/backend-contracts/externalInbound.d.ts +24 -0
- package/dist/internal/backend-contracts/firestoreValues.d.ts +9 -0
- package/dist/internal/backend-contracts/index.d.ts +54 -0
- package/dist/internal/backend-contracts/media-url.d.ts +20 -0
- package/dist/internal/backend-contracts/media.d.ts +51 -0
- package/dist/internal/backend-contracts/mediaDelivery.d.ts +46 -0
- package/dist/internal/backend-contracts/mediaTransferProtocol.d.ts +17 -0
- package/dist/internal/backend-contracts/membershipChange.d.ts +21 -0
- package/dist/internal/backend-contracts/message.d.ts +86 -0
- package/dist/internal/backend-contracts/messageText.d.ts +6 -0
- package/dist/internal/backend-contracts/mlsDevApplication.d.ts +161 -0
- package/dist/internal/backend-contracts/mlsDevCredential.d.ts +78 -0
- package/dist/internal/backend-contracts/mlsDevCredentialReconciliation.d.ts +45 -0
- package/dist/internal/backend-contracts/mlsDevDeviceCustody.d.ts +52 -0
- package/dist/internal/backend-contracts/mlsDevEnrollment.d.ts +75 -0
- package/dist/internal/backend-contracts/mlsDevFeedReceipt.d.ts +43 -0
- package/dist/internal/backend-contracts/mlsDevGroup.d.ts +321 -0
- package/dist/internal/backend-contracts/mlsDevGroupFeed.d.ts +51 -0
- package/dist/internal/backend-contracts/mlsDevInteraction.d.ts +159 -0
- package/dist/internal/backend-contracts/mlsDevKeyPackage.d.ts +42 -0
- package/dist/internal/backend-contracts/mlsDevKeyPackages.d.ts +55 -0
- package/dist/internal/backend-contracts/mlsEnvironment.d.ts +35 -0
- package/dist/internal/backend-contracts/mlsPrincipalAlias.d.ts +23 -0
- package/dist/internal/backend-contracts/moderation.d.ts +7 -0
- package/dist/internal/backend-contracts/plaintextProcessors.d.ts +63 -0
- package/dist/internal/backend-contracts/preparedContent.d.ts +54 -0
- package/dist/internal/backend-contracts/replyAuthority.d.ts +14 -0
- package/dist/internal/backend-contracts/runtimeCardFields.d.ts +66 -0
- package/dist/internal/backend-contracts/runtimeCardStorage.d.ts +3 -0
- package/dist/internal/backend-contracts/runtimeDescriptor.d.ts +88 -0
- package/dist/internal/backend-contracts/selfContext.d.ts +9 -0
- package/dist/internal/backend-contracts/turnProtocol.d.ts +43 -0
- package/dist/internal/backend-contracts/upload-mime-types.d.ts +17 -0
- package/dist/internal/backend-contracts/verbContract.d.ts +856 -0
- package/dist/internal/backend-contracts/verbSchemas.d.ts +1717 -0
- package/dist/internal/backend-contracts/verbWire.d.ts +493 -0
- package/dist/internal/backend-contracts/webAuth.d.ts +8 -0
- package/dist/internal/core/agent-profiles.d.ts +65 -0
- package/dist/internal/core/approval-format.d.ts +22 -0
- package/dist/internal/core/approval-manager.d.ts +43 -0
- package/dist/internal/core/approval-types.d.ts +73 -0
- package/dist/internal/core/base-url.d.ts +1 -0
- package/dist/internal/core/cli-metadata.d.ts +13 -0
- package/dist/internal/core/client.d.ts +432 -0
- package/dist/internal/core/completed-output-journal.d.ts +39 -0
- package/dist/internal/core/constants.d.ts +1 -0
- package/dist/internal/core/endpoint-client.d.ts +56 -0
- package/dist/internal/core/execution-environment-mode.d.ts +6 -0
- package/dist/internal/core/gifs.d.ts +29 -0
- package/dist/internal/core/host-runtime.d.ts +53 -0
- package/dist/internal/core/index.d.ts +68 -0
- package/dist/internal/core/node-media.d.ts +6 -0
- package/dist/internal/core/policy.d.ts +2 -0
- package/dist/internal/core/registration-profile.d.ts +10 -0
- package/dist/internal/core/registration-session.d.ts +55 -0
- package/dist/internal/core/registration.d.ts +5 -0
- package/dist/internal/core/retry.d.ts +113 -0
- package/dist/internal/core/rtdb-rest.d.ts +141 -0
- package/dist/internal/core/runtime-cards.d.ts +286 -0
- package/dist/internal/core/runtime-descriptor.d.ts +16 -0
- package/dist/internal/core/runtime-endpoints.d.ts +26 -0
- package/dist/internal/core/runtime-heartbeat.d.ts +29 -0
- package/dist/internal/core/runtime-presentation.d.ts +9 -0
- package/dist/internal/core/runtime-request-manager.d.ts +283 -0
- package/dist/internal/core/runtime-state-publisher.d.ts +42 -0
- package/dist/internal/core/self-context.d.ts +22 -0
- package/dist/internal/core/silent-turn.d.ts +49 -0
- package/dist/internal/core/stream.d.ts +78 -0
- package/dist/internal/core/turn-protocol.d.ts +28 -0
- package/dist/internal/core/turn-verbosity.d.ts +85 -0
- package/dist/internal/core/types.d.ts +964 -0
- package/dist/internal/core/unified-diff.d.ts +35 -0
- package/dist/internal/endpoint/artifact-images.d.ts +60 -0
- package/dist/internal/endpoint/artifact-reducer.d.ts +35 -0
- package/dist/internal/endpoint/artifact-views.d.ts +113 -0
- package/dist/internal/endpoint/artifacts.d.ts +75 -0
- package/dist/internal/endpoint/delivery.d.ts +47 -0
- package/dist/internal/endpoint/engine.d.ts +249 -0
- package/dist/internal/endpoint/ephemeral.d.ts +8 -0
- package/dist/internal/endpoint/events.d.ts +32 -0
- package/dist/internal/endpoint/external-inbound.d.ts +36 -0
- package/dist/internal/endpoint/handoff.d.ts +50 -0
- package/dist/internal/endpoint/history.d.ts +22 -0
- package/dist/internal/endpoint/image-generation-errors.d.ts +2 -0
- package/dist/internal/endpoint/inbound.d.ts +29 -0
- package/dist/internal/endpoint/index.d.ts +32 -0
- package/dist/internal/endpoint/media.d.ts +177 -0
- package/dist/internal/endpoint/migration.d.ts +50 -0
- package/dist/internal/endpoint/mls-crypto.d.ts +32 -0
- package/dist/internal/endpoint/mls-dev-client.d.ts +52 -0
- package/dist/internal/endpoint/mls-dev-device.d.ts +69 -0
- package/dist/internal/endpoint/mls-dev-groups.d.ts +174 -0
- package/dist/internal/endpoint/mls-dev-interactions.d.ts +99 -0
- package/dist/internal/endpoint/mls-dev-key-package-service.d.ts +46 -0
- package/dist/internal/endpoint/mls-dev-key-packages.d.ts +62 -0
- package/dist/internal/endpoint/mls-dev-text.d.ts +67 -0
- package/dist/internal/endpoint/mls-dev-transport.d.ts +38 -0
- package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +29 -0
- package/dist/internal/endpoint/node-mls-custody.d.ts +15 -0
- package/dist/internal/endpoint/node.d.ts +7 -0
- package/dist/internal/endpoint/observe-query.d.ts +17 -0
- package/dist/internal/endpoint/portable-node-mls-custody.d.ts +23 -0
- package/dist/internal/endpoint/queue.d.ts +22 -0
- package/dist/internal/endpoint/recovery.d.ts +27 -0
- package/dist/internal/endpoint/retention.d.ts +7 -0
- package/dist/internal/endpoint/store.d.ts +22 -0
- package/dist/internal/endpoint/sync.d.ts +33 -0
- package/dist/internal/endpoint/transient-publisher.d.ts +8 -0
- package/dist/internal/endpoint/transport.d.ts +63 -0
- package/dist/media.d.ts +1 -1
- package/dist/media.js +42 -541
- package/dist/runner/errands.d.ts +118 -0
- package/dist/runner/mls.d.ts +97 -0
- package/dist/runner/relay.d.ts +87 -0
- package/dist/runner/runner.d.ts +98 -0
- package/dist/runner/types.d.ts +215 -0
- package/package.json +18 -5
- package/dist/attached-session.d.ts +0 -58
- package/dist/attached-session.js +0 -638
- package/dist/bounded-file-read.d.ts +0 -14
- package/dist/bounded-file-read.js +0 -34
- package/dist/canon-agent.d.ts +0 -236
- package/dist/canon-agent.js +0 -2531
- package/dist/debouncer.d.ts +0 -18
- package/dist/debouncer.js +0 -133
- package/dist/inbound-handoff.d.ts +0 -6
- package/dist/inbound-handoff.js +0 -17
- package/dist/managed-session-host.d.ts +0 -27
- package/dist/managed-session-host.js +0 -195
- package/dist/managed-session-setup.d.ts +0 -99
- package/dist/managed-session-setup.js +0 -234
- package/dist/realtime.d.ts +0 -62
- package/dist/realtime.js +0 -193
- package/dist/runtime-card.d.ts +0 -48
- package/dist/runtime-card.js +0 -64
- package/dist/session-manager.d.ts +0 -77
- package/dist/session-manager.js +0 -285
- package/dist/turn-streaming-request.d.ts +0 -17
- package/dist/turn-streaming-request.js +0 -22
- package/dist/turn-verbosity-option.d.ts +0 -33
- package/dist/turn-verbosity-option.js +0 -23
- package/dist/types.d.ts +0 -387
- package/dist/types.js +0 -1
- package/dist/work-session-coordination.d.ts +0 -21
- package/dist/work-session-coordination.js +0 -53
- package/dist/work-session-host.d.ts +0 -31
- package/dist/work-session-host.js +0 -617
- package/dist/work-session-interactions.d.ts +0 -12
- package/dist/work-session-interactions.js +0 -173
- package/dist/work-session-state.d.ts +0 -36
- package/dist/work-session-state.js +0 -62
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The class-C relay (docs/design/agent-runner.md §11): a Canon-operated process that relays a connector agent's
|
|
3
|
+
* encrypted rooms, holding an MLS device for the agent and decrypting and re-encrypting messages for the assistant (which
|
|
4
|
+
* its provider runs, not Canon), so those rooms are not end-to-end encrypted to that agent. Its installation id carries a
|
|
5
|
+
* reserved prefix, which the device's registration shows, and with it every MLS credential the issuer signs and every
|
|
6
|
+
* room roster: that is the machine-readable marker that a member is relayed. Only the agent's owner-approved relay
|
|
7
|
+
* installation may be enrolled under the prefix, and only with that relay's own credential.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CONNECTOR_RELAY_INSTALLATION_PREFIX = "canon-relay:";
|
|
10
|
+
export declare const CONNECTOR_RELAY_INSTALLATION_PATTERN: RegExp;
|
|
11
|
+
export declare function isConnectorRelayInstallation(installationId: unknown): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Canon's per-relay credential (§11.4): minted when the owner approves (or re-approves) the relay and delivered once, over
|
|
14
|
+
* the channel, to that agent's relay alone; Canon keeps only its SHA-256, on the agent's relay binding. It authenticates
|
|
15
|
+
* the relay as its agent for the relay's own work only: its installation's endpoint operations and MLS device, and the
|
|
16
|
+
* encrypted rooms' live hints. It is never accepted for plaintext rooms or any other route, and it stops working when the
|
|
17
|
+
* relay is disabled or re-approved, its connection is revoked, replaced or expires, or the agent's ownership changes.
|
|
18
|
+
*/
|
|
19
|
+
export declare const CONNECTOR_RELAY_CREDENTIAL_PREFIX = "canon_relay_";
|
|
20
|
+
export declare const CONNECTOR_RELAY_CREDENTIAL_PATTERN: RegExp;
|
|
21
|
+
export declare function isConnectorRelayCredential(value: unknown): value is string;
|
|
22
|
+
/** What the channel's `credential` operation carries; the connection is the request's `grantId`. */
|
|
23
|
+
export interface ConnectorRelayCredentialDelivery {
|
|
24
|
+
installationId: string;
|
|
25
|
+
generation: number;
|
|
26
|
+
credential: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A relay binding is current for `installationId` (and, given one, the credential with that hash): the agent is active,
|
|
30
|
+
* not mid-transfer, and still at the binding's ownership generation; its connection's grant is active, unexpired, for the
|
|
31
|
+
* same agent, owner and generation; neither agent nor owner is ejected. Functions and the stream service read the same
|
|
32
|
+
* documents (`users/{agentId}`, the binding's `connectorGrants/{grantId}`) and decide with this one rule.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isConnectorRelayBindingCurrent(input: {
|
|
35
|
+
agentId: string;
|
|
36
|
+
installationId: string;
|
|
37
|
+
ownershipVersion?: number;
|
|
38
|
+
credentialDigest?: string;
|
|
39
|
+
agent: Record<string, any> | undefined;
|
|
40
|
+
grant: Record<string, any> | undefined;
|
|
41
|
+
agentEjected: boolean;
|
|
42
|
+
ownerEjected: boolean;
|
|
43
|
+
now: number;
|
|
44
|
+
}): boolean;
|
|
45
|
+
/** A relayed turn as the connector's pickup tools name it: never reused, and it names nothing about the turn. */
|
|
46
|
+
export declare const CONNECTOR_RELAY_INPUT_ID_PATTERN: RegExp;
|
|
47
|
+
export declare const CONNECTOR_RELAY_MAX_BODY_BYTES: number;
|
|
48
|
+
/** An encrypted room's text is one message of at most 32 KiB. */
|
|
49
|
+
export declare const CONNECTOR_RELAY_MAX_TEXT_BYTES: number;
|
|
50
|
+
/**
|
|
51
|
+
* The one budget for a relay answer, serialized: Functions refuses a longer response body, and the relay fits every answer
|
|
52
|
+
* under it before it changes any state (a claim's input is fitted before the claim is taken, a history page is cut short).
|
|
53
|
+
*/
|
|
54
|
+
export declare const CONNECTOR_RELAY_MAX_RESPONSE_BYTES: number;
|
|
55
|
+
/** Functions' deadline for one exchange with the relay, request to last response byte. */
|
|
56
|
+
export declare const CONNECTOR_RELAY_CHANNEL_TIMEOUT_MS = 10000;
|
|
57
|
+
/**
|
|
58
|
+
* The relay answers every exchange within this, measured from the request's arrival, leaving the rest of Functions'
|
|
59
|
+
* deadline for the network. Work that may outlast it answers before it changes state (a busy refusal) or after it is
|
|
60
|
+
* durable (a send answers `pending` only once it is journaled).
|
|
61
|
+
*/
|
|
62
|
+
export declare const CONNECTOR_RELAY_ANSWER_WITHIN_MS = 7000;
|
|
63
|
+
/** A value's size as the channel serializes it (UTF-8 JSON). */
|
|
64
|
+
export declare function connectorRelayResponseBytes(value: unknown): number;
|
|
65
|
+
export type ConnectorRelaySettleOutcome = 'completed' | 'no_reply' | 'failed';
|
|
66
|
+
/** One request from Functions to the relay; Functions initiates every exchange (§11.6). */
|
|
67
|
+
export type ConnectorRelayRequest = {
|
|
68
|
+
version: 1;
|
|
69
|
+
agentId: string;
|
|
70
|
+
grantId: string;
|
|
71
|
+
} & ({
|
|
72
|
+
op: 'pending';
|
|
73
|
+
args: {
|
|
74
|
+
conversationId: string;
|
|
75
|
+
limit?: number;
|
|
76
|
+
};
|
|
77
|
+
} | {
|
|
78
|
+
op: 'claim';
|
|
79
|
+
args: {
|
|
80
|
+
inputId: string;
|
|
81
|
+
requestId: string;
|
|
82
|
+
};
|
|
83
|
+
} | {
|
|
84
|
+
op: 'reply';
|
|
85
|
+
args: {
|
|
86
|
+
inputId: string;
|
|
87
|
+
requestId: string;
|
|
88
|
+
text: string;
|
|
89
|
+
};
|
|
90
|
+
} | {
|
|
91
|
+
op: 'settle';
|
|
92
|
+
args: {
|
|
93
|
+
inputId: string;
|
|
94
|
+
requestId: string;
|
|
95
|
+
outcome: ConnectorRelaySettleOutcome;
|
|
96
|
+
};
|
|
97
|
+
} | {
|
|
98
|
+
op: 'read';
|
|
99
|
+
args: {
|
|
100
|
+
conversationId: string;
|
|
101
|
+
limit?: number;
|
|
102
|
+
before?: string;
|
|
103
|
+
};
|
|
104
|
+
} | {
|
|
105
|
+
op: 'send';
|
|
106
|
+
args: {
|
|
107
|
+
conversationId: string;
|
|
108
|
+
messageId: string;
|
|
109
|
+
text: string;
|
|
110
|
+
};
|
|
111
|
+
} | {
|
|
112
|
+
op: 'credential';
|
|
113
|
+
args: ConnectorRelayCredentialDelivery;
|
|
114
|
+
});
|
|
115
|
+
export type ConnectorRelayOp = ConnectorRelayRequest['op'];
|
|
116
|
+
export interface ConnectorRelayInputRef {
|
|
117
|
+
inputId: string;
|
|
118
|
+
conversationId: string;
|
|
119
|
+
messageId: string;
|
|
120
|
+
createdAt: string;
|
|
121
|
+
}
|
|
122
|
+
export interface ConnectorRelayMessage {
|
|
123
|
+
id: string;
|
|
124
|
+
senderId: string;
|
|
125
|
+
senderName?: string;
|
|
126
|
+
senderType: 'human' | 'ai_agent';
|
|
127
|
+
isOwner?: boolean;
|
|
128
|
+
text: string;
|
|
129
|
+
createdAt: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* What the assistant gets with its first claim: the turn's messages and, for context, the history window before them,
|
|
133
|
+
* each once (structured, as the plaintext connector's claim is; no rendered prompt repeats them). History is trimmed,
|
|
134
|
+
* oldest first, to fit the response budget; the turn's own messages always fit.
|
|
135
|
+
*/
|
|
136
|
+
export interface ConnectorRelayInput {
|
|
137
|
+
conversationId: string;
|
|
138
|
+
room: 'direct' | 'group';
|
|
139
|
+
sender: {
|
|
140
|
+
id: string;
|
|
141
|
+
name?: string;
|
|
142
|
+
type: 'human' | 'ai_agent';
|
|
143
|
+
isOwner: boolean;
|
|
144
|
+
};
|
|
145
|
+
messages: ConnectorRelayMessage[];
|
|
146
|
+
history: ConnectorRelayMessage[];
|
|
147
|
+
}
|
|
148
|
+
export interface ConnectorRelayClaim {
|
|
149
|
+
inputId: string;
|
|
150
|
+
requestId: string;
|
|
151
|
+
runAllowed: boolean;
|
|
152
|
+
state: 'claimed' | 'answered' | 'withdrawn';
|
|
153
|
+
input?: ConnectorRelayInput;
|
|
154
|
+
}
|
|
155
|
+
export interface ConnectorRelayAck {
|
|
156
|
+
inputId: string;
|
|
157
|
+
state: 'accepted';
|
|
158
|
+
outcome: 'reply' | ConnectorRelaySettleOutcome;
|
|
159
|
+
}
|
|
160
|
+
/** Messages Canon accepted into the room's feed, newest first; the relay's own unaccepted sends are not history. */
|
|
161
|
+
export interface ConnectorRelayPage {
|
|
162
|
+
messages: ConnectorRelayMessage[];
|
|
163
|
+
nextBefore: string | null;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* `messageId` is the send's identity: sending again with it (or with the id the caller first gave) is the same message,
|
|
167
|
+
* never a second one. `historyMessageId` is the id the message has in the conversation's history.
|
|
168
|
+
*/
|
|
169
|
+
export interface ConnectorRelaySent {
|
|
170
|
+
conversationId: string;
|
|
171
|
+
messageId: string;
|
|
172
|
+
historyMessageId: string;
|
|
173
|
+
status: 'sent' | 'pending';
|
|
174
|
+
}
|
|
175
|
+
export declare class ConnectorRelayRequestError extends Error {
|
|
176
|
+
name: string;
|
|
177
|
+
}
|
|
178
|
+
/** The closed request schema both sides check: Functions before it signs, the relay after it verifies the signature. */
|
|
179
|
+
export declare function parseConnectorRelayRequest(value: unknown): ConnectorRelayRequest;
|
|
@@ -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,120 @@
|
|
|
1
|
+
import { type PreparedContent } from './preparedContent.js';
|
|
2
|
+
import type { MlsPrincipalOpening } from './mlsPrincipalAlias.js';
|
|
3
|
+
/** Plaintext endpoint protocol. Identity and authority come from authenticated transport. */
|
|
4
|
+
export declare const CANON_ENDPOINT_PROTOCOL: "canon.endpoint.v1";
|
|
5
|
+
export interface EndpointPreconditions {
|
|
6
|
+
conversationId?: string;
|
|
7
|
+
membershipRevision?: number;
|
|
8
|
+
admissionId?: string;
|
|
9
|
+
targetAdmissionId?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface EndpointOperationRequest {
|
|
12
|
+
protocol: typeof CANON_ENDPOINT_PROTOCOL;
|
|
13
|
+
operationId: string;
|
|
14
|
+
installationId: string;
|
|
15
|
+
action: string;
|
|
16
|
+
/** Agent ownership generation selected when authored; absent for humans. */
|
|
17
|
+
ownershipVersion?: number;
|
|
18
|
+
envelope?: Record<string, unknown>;
|
|
19
|
+
preconditions?: EndpointPreconditions;
|
|
20
|
+
body: {
|
|
21
|
+
encoding: 'json';
|
|
22
|
+
value: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
/** Additive sealed submission, sent only after capability negotiation. */
|
|
25
|
+
preparedContent?: PreparedContent;
|
|
26
|
+
}
|
|
27
|
+
export interface EndpointOperationError {
|
|
28
|
+
code: string;
|
|
29
|
+
message: string;
|
|
30
|
+
status?: number;
|
|
31
|
+
retryable?: boolean;
|
|
32
|
+
retryAfterMs?: number;
|
|
33
|
+
}
|
|
34
|
+
export type EndpointReceiptStatus = 'pending' | 'succeeded' | 'rejected' | 'uncertain';
|
|
35
|
+
export type EndpointResultReference = {
|
|
36
|
+
kind: 'artifact_asset';
|
|
37
|
+
conversationId: string;
|
|
38
|
+
artifactId: string;
|
|
39
|
+
assetId: string;
|
|
40
|
+
} | {
|
|
41
|
+
kind: 'interaction';
|
|
42
|
+
conversationId: string;
|
|
43
|
+
interactionKind: 'input' | 'approval' | 'card' | 'plan';
|
|
44
|
+
requestId: string;
|
|
45
|
+
operationKey: string;
|
|
46
|
+
} | {
|
|
47
|
+
kind: 'upload';
|
|
48
|
+
uploadId: string;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'media_delivery';
|
|
51
|
+
deliveryId: string;
|
|
52
|
+
installationId: string;
|
|
53
|
+
} | {
|
|
54
|
+
kind: 'voice';
|
|
55
|
+
conversationId: string;
|
|
56
|
+
sessionId: string;
|
|
57
|
+
};
|
|
58
|
+
export interface EndpointOperationReceipt<T = unknown> {
|
|
59
|
+
protocol: typeof CANON_ENDPOINT_PROTOCOL;
|
|
60
|
+
operationId: string;
|
|
61
|
+
installationId: string;
|
|
62
|
+
action: string;
|
|
63
|
+
status: EndpointReceiptStatus;
|
|
64
|
+
result?: T;
|
|
65
|
+
/** Sensitive/bearer results are hydrated for the response, never journaled. */
|
|
66
|
+
resultReference?: EndpointResultReference;
|
|
67
|
+
/** Transient hydration failure: the durable mutation remains succeeded. */
|
|
68
|
+
resultError?: EndpointOperationError;
|
|
69
|
+
error?: EndpointOperationError;
|
|
70
|
+
createdAt: string;
|
|
71
|
+
updatedAt: string;
|
|
72
|
+
}
|
|
73
|
+
export interface EndpointQueryRequest {
|
|
74
|
+
protocol: typeof CANON_ENDPOINT_PROTOCOL;
|
|
75
|
+
query: string;
|
|
76
|
+
parameters: Record<string, unknown>;
|
|
77
|
+
}
|
|
78
|
+
export interface EndpointQueryResponse<T = unknown> {
|
|
79
|
+
protocol: typeof CANON_ENDPOINT_PROTOCOL;
|
|
80
|
+
result: T;
|
|
81
|
+
}
|
|
82
|
+
/** Durable application cursors differ from the live transport's reconnect token. */
|
|
83
|
+
export interface EndpointEvent {
|
|
84
|
+
id: string;
|
|
85
|
+
kind: string;
|
|
86
|
+
conversationId?: string;
|
|
87
|
+
revision?: number;
|
|
88
|
+
cursor?: string;
|
|
89
|
+
durable: boolean;
|
|
90
|
+
data: Record<string, unknown>;
|
|
91
|
+
}
|
|
92
|
+
export interface EndpointCapabilities {
|
|
93
|
+
preparedContentVersion?: 1;
|
|
94
|
+
preparedMediaContentVersion?: 1;
|
|
95
|
+
mediaDeliveryObservationVersion?: 2;
|
|
96
|
+
protocol: typeof CANON_ENDPOINT_PROTOCOL;
|
|
97
|
+
actions: string[];
|
|
98
|
+
queries: string[];
|
|
99
|
+
maintenance: boolean;
|
|
100
|
+
/** Only for a principal eligible for MLS here: how new rooms are born (functions `rollout.ts`, `CANON_MLS_DEV_ROOMS`). */
|
|
101
|
+
mls?: {
|
|
102
|
+
eligible: true;
|
|
103
|
+
roomMode: 'allowlist' | 'eligible' | 'default';
|
|
104
|
+
/** The principal's MLS identity, its alias (mls-dev-groups.md, erasure privacy), and the opening that proves the alias
|
|
105
|
+
* is its own; null until it has an alias, when the account is its own principal. Absent from older servers. */
|
|
106
|
+
principal?: {
|
|
107
|
+
type: 'human' | 'ai_agent';
|
|
108
|
+
id: string;
|
|
109
|
+
};
|
|
110
|
+
opening?: MlsPrincipalOpening | null;
|
|
111
|
+
};
|
|
112
|
+
/** While a client floor exists (`clientFloor.ts`): the minimum for the caller's kind, or null when it has none. */
|
|
113
|
+
clientFloor?: {
|
|
114
|
+
minimum: string | null;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export declare const ENDPOINT_ID_PATTERN: RegExp;
|
|
118
|
+
export declare const ENDPOINT_ACTION_PATTERN: RegExp;
|
|
119
|
+
export declare function isEndpointOperationRequest(value: unknown): value is EndpointOperationRequest;
|
|
120
|
+
export declare function isEndpointOperationReceipt(value: unknown): value is EndpointOperationReceipt;
|
|
@@ -0,0 +1,48 @@
|
|
|
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 ["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", "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", "mls_group_admissions", "mls_interactions", "list_artifacts", "get_artifact_log", "get_artifact_asset", "discover_agents", "get_unread_summary", "peek_runtime_signal", "list_runtime_primitives", "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", "same_owner_agents"];
|
|
13
|
+
export declare const ENDPOINT_CONTENT_QUERIES: readonly ["mls_group_feed", "mls_group_controls", "mls_group_admissions", "mls_interactions", "list_artifacts", "get_artifact_log", "get_artifact_asset", "discover_agents", "get_unread_summary", "peek_runtime_signal", "list_runtime_primitives", "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", "same_owner_agents", "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
|
+
/**
|
|
22
|
+
* An encrypted room's content-free turn state (owner ruling 2026-10-16; agent-runner.md §6): Canon learns when an agent
|
|
23
|
+
* is busy there, never what it does. On `publish_turn` a closed state (`thinking` while the agent works, `waiting_input`
|
|
24
|
+
* while a card waits on a person, `interrupted`, `idle`), the runner's random turn id and two times are public metadata,
|
|
25
|
+
* each only with such a value; queue depth, speaker, active messages, capabilities, `streaming`/`tool` and anything else
|
|
26
|
+
* stay private, so an encrypted room refuses them.
|
|
27
|
+
*/
|
|
28
|
+
export declare const ENDPOINT_TURN_PRESENCE_STATES: readonly ["thinking", "waiting_input", "interrupted", "idle"];
|
|
29
|
+
export interface EndpointContentBoundary {
|
|
30
|
+
readonly lane: EndpointContentLane;
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly defaultClass: 'private-content';
|
|
33
|
+
/** Paths address the actual payload. Query/result/event paths are relative to
|
|
34
|
+
* their parameters/result/data; operation paths include body.value. */
|
|
35
|
+
classify(path: readonly string[]): EndpointContentClass;
|
|
36
|
+
}
|
|
37
|
+
/** Local journal policy is separate from wire classification. Input answers and
|
|
38
|
+
* card values can carry passwords even when the response omits the original
|
|
39
|
+
* request's secret/sudo/field metadata. Only reviewed response shapes without
|
|
40
|
+
* those value bags may be retried from durable storage. Unknown response fields
|
|
41
|
+
* fail closed; a caller's `sensitive: false` cannot weaken this policy. */
|
|
42
|
+
export declare function endpointOperationRequestRetention(action: string, body: Record<string, unknown>, envelope?: Record<string, unknown>): 'journal' | 'memory';
|
|
43
|
+
/** Validate the lane before accepting/transmitting its payload. No body values
|
|
44
|
+
* are logged, copied into metadata, or claimed to be encrypted by this API. */
|
|
45
|
+
export declare function endpointContentBoundary(lane: EndpointContentLane, name: string, payload?: unknown): EndpointContentBoundary;
|
|
46
|
+
/** Whether every leaf of an ephemeral body is public metadata: all an encrypted (MLS) room may receive on that lane. The
|
|
47
|
+
* endpoint applies this before publishing (its MLS preflight); Functions applies it again on receipt. */
|
|
48
|
+
export declare function endpointEphemeralIsMetadataOnly(name: string, body: unknown): boolean;
|
|
@@ -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,54 @@
|
|
|
1
|
+
export * from './diffRedaction.js';
|
|
2
|
+
export * from './environment.js';
|
|
3
|
+
export * from './clientFloor.js';
|
|
4
|
+
export * from './api-origins.generated.js';
|
|
5
|
+
export * from './media.js';
|
|
6
|
+
export * from './mediaDelivery.js';
|
|
7
|
+
export * from './media-url.js';
|
|
8
|
+
export * from './upload-mime-types.js';
|
|
9
|
+
export * from './message.js';
|
|
10
|
+
export * from './messageText.js';
|
|
11
|
+
export * from './runtimeCardFields.js';
|
|
12
|
+
export * from './runtimeCardStorage.js';
|
|
13
|
+
export * from './turnProtocol.js';
|
|
14
|
+
export * from './agentBehaviorPolicy.js';
|
|
15
|
+
export * from './agentSearch.js';
|
|
16
|
+
export * from './agentDirectory.js';
|
|
17
|
+
export * from './agentOrigin.js';
|
|
18
|
+
export * from './verbContract.js';
|
|
19
|
+
export * from './verbSchemas.js';
|
|
20
|
+
export * from './verbWire.js';
|
|
21
|
+
export * from './communication.js';
|
|
22
|
+
export * from './apiErrors.js';
|
|
23
|
+
export * from './firestoreValues.js';
|
|
24
|
+
export * from './moderation.js';
|
|
25
|
+
export * from './selfContext.js';
|
|
26
|
+
export * from './replyAuthority.js';
|
|
27
|
+
export * from './runtimeDescriptor.js';
|
|
28
|
+
export type { WebPhoneAccountRequest, WebPhoneTokenResponse } from './webAuth.js';
|
|
29
|
+
export * from './conversationMembership.js';
|
|
30
|
+
export * from './endpoint.js';
|
|
31
|
+
export * from './externalInbound.js';
|
|
32
|
+
export * from './connectorRelay.js';
|
|
33
|
+
export * from './endpointContentPolicy.js';
|
|
34
|
+
export * from './plaintextProcessors.js';
|
|
35
|
+
export { computeEndpointUnreadProjection } from './endpoint-unread.js';
|
|
36
|
+
export * from './membershipChange.js';
|
|
37
|
+
export * from './deliveryObservation.js';
|
|
38
|
+
export * from './mediaTransferProtocol.js';
|
|
39
|
+
export * from './preparedContent.js';
|
|
40
|
+
export * from './artifacts.js';
|
|
41
|
+
export * from './artifactActions.js';
|
|
42
|
+
export * from './mlsEnvironment.js';
|
|
43
|
+
export * from './mlsDevEnrollment.js';
|
|
44
|
+
export * from './mlsDevCredential.js';
|
|
45
|
+
export * from './mlsDevCredentialReconciliation.js';
|
|
46
|
+
export * from './mlsDevDeviceCustody.js';
|
|
47
|
+
export * from './mlsDevKeyPackage.js';
|
|
48
|
+
export * from './mlsDevKeyPackages.js';
|
|
49
|
+
export * from './mlsDevGroup.js';
|
|
50
|
+
export * from './mlsDevApplication.js';
|
|
51
|
+
export * from './mlsDevGroupFeed.js';
|
|
52
|
+
export * from './mlsDevFeedReceipt.js';
|
|
53
|
+
export * from './mlsDevInteraction.js';
|
|
54
|
+
export * from './mlsPrincipalAlias.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
/** Whether `url` is on one of Canon's media origins (its `/files` download links). */
|
|
6
|
+
export declare function isCanonMediaOrigin(url: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Whether `url` is Canon's own download link for one upload of this room in this environment: its media origin, the
|
|
9
|
+
* room's object path, the upload's canonical file (or, with `poster`, its video poster) and a bearer token, nothing
|
|
10
|
+
* else. An encrypted item names its upload by such a link (mls-payload-v3.md §4); any other URL would have every
|
|
11
|
+
* member's phone and agent fetch it.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isCanonUploadUrl(url: string, input: {
|
|
14
|
+
environmentId: string;
|
|
15
|
+
conversationId: string;
|
|
16
|
+
uploadId: string;
|
|
17
|
+
poster?: boolean;
|
|
18
|
+
}): boolean;
|
|
19
|
+
/** Presentation upgrade for existing messages without rewriting their stored URLs. */
|
|
20
|
+
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
|
+
}
|