@canonmsg/agent-sdk 12.0.0 → 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.
Files changed (99) hide show
  1. package/README.md +97 -7
  2. package/dist/chunks/{chunk-FPQFTTND.js → chunk-7N6OPPW4.js} +1616 -1085
  3. package/dist/chunks/chunk-N722GWCP.js +4897 -0
  4. package/dist/chunks/{chunk-OLJ7H4E2.js → chunk-QZ4PPRQW.js} +6462 -6920
  5. package/dist/chunks/{mls-crypto-NZDNSPAO.js → mls-crypto-LMNQZOS6.js} +3 -3
  6. package/dist/cli.js +403 -29
  7. package/dist/drivers/claude.d.ts +8 -2
  8. package/dist/drivers/codex.d.ts +11 -2
  9. package/dist/drivers/connector.d.ts +34 -0
  10. package/dist/index.d.ts +10 -2
  11. package/dist/index.js +26 -4
  12. package/dist/internal/backend-contracts/artifactActions.d.ts +0 -151
  13. package/dist/internal/backend-contracts/clientFloor.d.ts +41 -0
  14. package/dist/internal/backend-contracts/communication.d.ts +15 -0
  15. package/dist/internal/backend-contracts/connectorRelay.d.ts +179 -0
  16. package/dist/internal/backend-contracts/endpoint.d.ts +17 -0
  17. package/dist/internal/backend-contracts/endpointContentPolicy.d.ts +15 -4
  18. package/dist/internal/backend-contracts/index.d.ts +7 -1
  19. package/dist/internal/backend-contracts/media-url.d.ts +14 -0
  20. package/dist/internal/backend-contracts/message.d.ts +1 -1
  21. package/dist/internal/backend-contracts/mlsDevApplication.d.ts +90 -2
  22. package/dist/internal/backend-contracts/mlsDevCredential.d.ts +5 -2
  23. package/dist/internal/backend-contracts/mlsDevDeviceCustody.d.ts +2 -1
  24. package/dist/internal/backend-contracts/mlsDevEnrollment.d.ts +3 -2
  25. package/dist/internal/backend-contracts/mlsDevFeedReceipt.d.ts +43 -0
  26. package/dist/internal/backend-contracts/mlsDevGroup.d.ts +129 -5
  27. package/dist/internal/backend-contracts/mlsDevGroupFeed.d.ts +6 -2
  28. package/dist/internal/backend-contracts/mlsDevInteraction.d.ts +159 -0
  29. package/dist/internal/backend-contracts/mlsEnvironment.d.ts +35 -0
  30. package/dist/internal/backend-contracts/mlsPrincipalAlias.d.ts +23 -0
  31. package/dist/internal/backend-contracts/runtimeCardFields.d.ts +2 -2
  32. package/dist/internal/backend-contracts/upload-mime-types.d.ts +17 -0
  33. package/dist/internal/backend-contracts/verbContract.d.ts +15 -7
  34. package/dist/internal/backend-contracts/verbSchemas.d.ts +35 -25
  35. package/dist/internal/core/agent-profiles.d.ts +0 -4
  36. package/dist/internal/core/approval-format.d.ts +1 -5
  37. package/dist/internal/core/approval-types.d.ts +1 -2
  38. package/dist/internal/core/client.d.ts +2 -56
  39. package/dist/internal/core/constants.d.ts +0 -3
  40. package/dist/internal/core/endpoint-client.d.ts +14 -1
  41. package/dist/internal/core/execution-environment-mode.d.ts +0 -2
  42. package/dist/internal/core/gifs.d.ts +0 -6
  43. package/dist/internal/core/host-runtime.d.ts +2 -206
  44. package/dist/internal/core/index.d.ts +21 -60
  45. package/dist/internal/core/registration.d.ts +1 -17
  46. package/dist/internal/core/retry.d.ts +0 -9
  47. package/dist/internal/core/rtdb-rest.d.ts +0 -4
  48. package/dist/internal/core/runtime-cards.d.ts +0 -45
  49. package/dist/internal/core/runtime-descriptor.d.ts +1 -60
  50. package/dist/internal/core/runtime-presentation.d.ts +1 -27
  51. package/dist/internal/core/runtime-request-manager.d.ts +0 -1
  52. package/dist/internal/core/self-context.d.ts +0 -39
  53. package/dist/internal/core/silent-turn.d.ts +1 -38
  54. package/dist/internal/core/stream.d.ts +2 -1
  55. package/dist/internal/core/turn-protocol.d.ts +0 -5
  56. package/dist/internal/core/turn-verbosity.d.ts +0 -12
  57. package/dist/internal/core/types.d.ts +0 -111
  58. package/dist/internal/endpoint/engine.d.ts +31 -1
  59. package/dist/internal/endpoint/index.d.ts +1 -1
  60. package/dist/internal/endpoint/media.d.ts +5 -0
  61. package/dist/internal/endpoint/mls-crypto.d.ts +12 -5
  62. package/dist/internal/endpoint/mls-dev-client.d.ts +9 -1
  63. package/dist/internal/endpoint/mls-dev-device.d.ts +2 -0
  64. package/dist/internal/endpoint/mls-dev-groups.d.ts +65 -5
  65. package/dist/internal/endpoint/mls-dev-interactions.d.ts +99 -0
  66. package/dist/internal/endpoint/mls-dev-key-package-service.d.ts +13 -0
  67. package/dist/internal/endpoint/mls-dev-key-packages.d.ts +23 -3
  68. package/dist/internal/endpoint/mls-dev-text.d.ts +67 -0
  69. package/dist/internal/endpoint/mls-dev-transport.d.ts +2 -1
  70. package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +5 -0
  71. package/dist/internal/endpoint/transport.d.ts +6 -1
  72. package/dist/media.js +2 -2
  73. package/dist/runner/errands.d.ts +118 -0
  74. package/dist/runner/mls.d.ts +97 -0
  75. package/dist/runner/relay.d.ts +87 -0
  76. package/dist/runner/runner.d.ts +61 -0
  77. package/dist/runner/types.d.ts +51 -4
  78. package/package.json +1 -1
  79. package/dist/chunks/chunk-6VK4UZHJ.js +0 -2806
  80. package/dist/internal/backend-contracts/workSessions.d.ts +0 -205
  81. package/dist/internal/core/agent-resolver.d.ts +0 -49
  82. package/dist/internal/core/agent-session.d.ts +0 -12
  83. package/dist/internal/core/artifacts.d.ts +0 -262
  84. package/dist/internal/core/attached-native-session.d.ts +0 -174
  85. package/dist/internal/core/attached-session-file-store.d.ts +0 -3
  86. package/dist/internal/core/control-poller.d.ts +0 -221
  87. package/dist/internal/core/exclusive-json-file-store.d.ts +0 -7
  88. package/dist/internal/core/execution-environment.d.ts +0 -55
  89. package/dist/internal/core/group-context.d.ts +0 -25
  90. package/dist/internal/core/inbound-frame.d.ts +0 -64
  91. package/dist/internal/core/local-runtime-catalog.d.ts +0 -131
  92. package/dist/internal/core/message-format.d.ts +0 -13
  93. package/dist/internal/core/native-session-interaction.d.ts +0 -44
  94. package/dist/internal/core/provenance.d.ts +0 -31
  95. package/dist/internal/core/registration-cli.d.ts +0 -40
  96. package/dist/internal/core/turn-output-controller.d.ts +0 -69
  97. package/dist/internal/core/typing-status-publisher.d.ts +0 -14
  98. package/dist/internal/core/work-session-provider.d.ts +0 -29
  99. package/dist/internal/core/workspace-discovery.d.ts +0 -17
@@ -2,5 +2,19 @@ export declare function buildFirebaseMediaUrl(bucket: string, storagePath: strin
2
2
  export declare function buildMediaDownloadUrl(bucket: string, storagePath: string, token: string): string;
3
3
  /** Accept historical Firebase URLs and Canon links, only for the expected bucket. */
4
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;
5
19
  /** Presentation upgrade for existing messages without rewriting their stored URLs. */
6
20
  export declare function canonMediaDownloadUrl(value: string, downloadFileName?: string): string;
@@ -2,7 +2,7 @@ import { MediaAttachment } from './media.js';
2
2
  import { type MlsDevMessageReference } from './mlsDevApplication.js';
3
3
  export type SerializedSenderType = 'human' | 'ai_agent';
4
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"];
5
+ export declare const AGENT_CLIENT_TYPES: readonly ["claude-code", "codex", "hermes", "generic"];
6
6
  export type SerializedAgentClientType = typeof AGENT_CLIENT_TYPES[number];
7
7
  export type SerializedContentType = 'text' | 'image' | 'audio' | 'video' | 'file' | 'contact_card' | 'interaction';
8
8
  export interface ForwardedFrom {
@@ -1,5 +1,21 @@
1
1
  import { type MlsDevGroupHead } from './mlsDevGroup.js';
2
+ import { type MlsEnvironmentId } from './mlsEnvironment.js';
2
3
  export declare const MLS_DEV_TEXT_PROTOCOL: "canon.mls.dev-text.v1";
4
+ /** Text plus encrypted interactions (docs/design/encrypted-interactions.md §2.1). Fresh rooms only, immutable from birth. */
5
+ export declare const MLS_DEV_TEXT_PROTOCOL_V2: "canon.mls.dev-text.v2";
6
+ /** v2 plus a text's reply and mentions inside the ciphertext (docs/design/mls-payload-v3.md §2). What Canon births. */
7
+ export declare const MLS_DEV_TEXT_PROTOCOL_V3: "canon.mls.dev-text.v3";
8
+ export declare const MLS_DEV_TEXT_PROTOCOLS: readonly ["canon.mls.dev-text.v1", "canon.mls.dev-text.v2", "canon.mls.dev-text.v3"];
9
+ export type MlsDevTextProtocol = typeof MLS_DEV_TEXT_PROTOCOLS[number];
10
+ export declare function isMlsDevTextProtocol(value: unknown): value is MlsDevTextProtocol;
11
+ /** Whether a room carries encrypted cards: v2, and v3, which is v2 with richer text. */
12
+ export declare function mlsDevProtocolCarriesCards(value: unknown): boolean;
13
+ export declare const MLS_DEV_REPLY_QUOTE_MAX_CHARACTERS = 1024;
14
+ export declare const MLS_DEV_MENTIONS_MAX = 32;
15
+ /** Shared with Functions' runtime request ids (`RUNTIME_ID_PATTERN`): the runner's `ask-<sha256>` fits. */
16
+ export declare const MLS_DEV_INTERACTION_ID_PATTERN: RegExp;
17
+ export declare const MLS_DEV_INTERACTION_KINDS: readonly ["approval", "question", "secret"];
18
+ export type MlsDevInteractionKind = typeof MLS_DEV_INTERACTION_KINDS[number];
3
19
  export declare const MLS_DEV_APPLICATION_TLS_MAX_BYTES: number;
4
20
  export declare const MLS_DEV_APPLICATION_MAX_BYTES: number;
5
21
  export declare const MLS_DEV_TEXT_MAX_BYTES: number;
@@ -7,15 +23,33 @@ export interface MlsDevApplicationPreconditions {
7
23
  readonly membershipRevision: number;
8
24
  readonly admissionId: string;
9
25
  }
26
+ /** Public, device-signed and MLS-authenticated interaction routing (§2.2). Only a v2 room accepts it. The requester is
27
+ * the authenticated sender principal; titles, options, answers, decisions and scope stay in the encrypted payload. */
28
+ export type MlsDevInteractionBinding = {
29
+ readonly role: 'request';
30
+ readonly requestId: string;
31
+ readonly kind: MlsDevInteractionKind;
32
+ readonly responderIds: readonly [string];
33
+ readonly expiresAtMs: number;
34
+ } | {
35
+ readonly role: 'response';
36
+ readonly requestId: string;
37
+ readonly agentId: string;
38
+ } | {
39
+ readonly role: 'withdraw';
40
+ readonly requestId: string;
41
+ };
10
42
  export interface MlsDevApplicationBinding {
11
43
  readonly version: 1;
12
- readonly environmentId: 'canon-dev-v1';
44
+ readonly environmentId: MlsEnvironmentId;
13
45
  readonly conversationId: string;
14
46
  readonly groupId: string;
15
47
  readonly messageId: string;
16
48
  readonly senderCredential: string;
17
49
  readonly expectedHead: MlsDevGroupHead;
18
50
  readonly preconditions: MlsDevApplicationPreconditions;
51
+ /** Absent for text. Framed after `preconditions` into the proof, envelope hash and MLS AAD. */
52
+ readonly interaction?: MlsDevInteractionBinding;
19
53
  }
20
54
  export interface MlsDevApplicationUnsignedEnvelope extends MlsDevApplicationBinding {
21
55
  readonly ciphertext: string;
@@ -44,22 +78,71 @@ export interface MlsDevTextPayload {
44
78
  readonly operationId: string;
45
79
  readonly senderDeviceId: string;
46
80
  readonly text: string;
81
+ /** v3 only: the message replied to, with an excerpt a device admitted after it can still show. */
82
+ readonly replyTo?: {
83
+ readonly messageId: string;
84
+ readonly quote: string;
85
+ };
86
+ /** v3 only: the accounts the text mentions, 1 to 32, each once. */
87
+ readonly mentions?: readonly string[];
88
+ }
89
+ /** The media kinds an encrypted item carries (payload v3 §2). Contact cards and artifacts are not items yet. */
90
+ export declare const MLS_DEV_ITEM_TYPES: readonly ["image", "video", "audio", "file"];
91
+ /**
92
+ * An item's reference inside the ciphertext. Its bytes stay in Canon's media pipeline and are not end-to-end
93
+ * encrypted; `url` is the upload's bearer download URL, which only the room's members receive this way. The file
94
+ * name and caption reach Canon only here, encrypted.
95
+ */
96
+ export interface MlsDevItem {
97
+ readonly type: typeof MLS_DEV_ITEM_TYPES[number];
98
+ readonly uploadId: string;
99
+ readonly url: string;
100
+ readonly mimeType: string;
101
+ readonly sizeBytes: number;
102
+ readonly fileName?: string;
103
+ readonly width?: number;
104
+ readonly height?: number;
105
+ readonly durationMs?: number;
106
+ readonly thumbnailUrl?: string;
107
+ readonly caption?: string;
108
+ /** As a v3 text's: the message replied to, with its excerpt, and the accounts mentioned. They ride inside the item,
109
+ * which native carries opaquely. */
110
+ readonly replyTo?: MlsDevTextPayload['replyTo'];
111
+ readonly mentions?: readonly string[];
112
+ }
113
+ export interface MlsDevItemPayload {
114
+ readonly version: 1;
115
+ readonly kind: 'item';
116
+ readonly conversationId: string;
117
+ readonly groupId: string;
118
+ readonly messageId: string;
119
+ readonly operationId: string;
120
+ readonly senderDeviceId: string;
121
+ readonly item: MlsDevItem;
47
122
  }
48
123
  /** Public projection only. Plaintext is produced locally after authenticated MLS receive. */
49
124
  export interface MlsDevMessageReference {
50
125
  readonly version: 1;
51
- readonly protocol: typeof MLS_DEV_TEXT_PROTOCOL;
126
+ readonly protocol: MlsDevTextProtocol;
52
127
  readonly groupId: string;
53
128
  readonly messageId: string;
54
129
  readonly operationId: string;
55
130
  readonly feedOrdinal: number;
56
131
  readonly head: MlsDevGroupHead;
57
132
  readonly envelopeHash: string;
133
+ /** The public binding's role only, so triggers can withhold previews, pushes and unread counts from answers. */
134
+ readonly interaction?: {
135
+ readonly role: MlsDevInteractionBinding['role'];
136
+ };
58
137
  }
59
138
  export declare class MlsDevApplicationValidationError extends Error {
60
139
  readonly code = "INVALID_MLS_DEV_APPLICATION";
61
140
  constructor();
62
141
  }
142
+ /** An encrypted message's ID: an endpoint ID that is not a membership notice's (`membership-<revision>`). */
143
+ export declare function isMlsDevMessageId(value: unknown): value is string;
144
+ /** Parses the closed public interaction binding (§2.2); the field order here is the framed order. */
145
+ export declare function parseMlsDevInteractionBinding(value: unknown): MlsDevInteractionBinding;
63
146
  export declare function parseMlsDevApplicationWire(value: unknown): string;
64
147
  export declare function parseMlsDevApplicationPreconditions(value: unknown): MlsDevApplicationPreconditions;
65
148
  export declare function parseMlsDevApplicationBinding(value: unknown): MlsDevApplicationBinding;
@@ -67,7 +150,12 @@ export declare function parseMlsDevApplicationUnsignedEnvelope(value: unknown):
67
150
  export declare function parseMlsDevApplicationEnvelope(value: unknown): MlsDevApplicationEnvelope;
68
151
  export declare function parseMlsDevApplicationReceipt(value: unknown): MlsDevApplicationReceipt;
69
152
  export declare function parseMlsDevTextPayload(value: unknown): MlsDevTextPayload;
153
+ /** An encrypted item (payload v3 §2): its reference and caption, as the ciphertext carries them. */
154
+ export declare function parseMlsDevItemPayload(value: unknown): MlsDevItemPayload;
70
155
  export declare function parseMlsDevMessageReference(value: unknown): MlsDevMessageReference;
156
+ /** `domain`, then the operation ID and the JSON value, each behind its 4-byte big-endian length: the bytes Canon's MLS
157
+ * proofs sign. */
158
+ export declare function frameMlsDevStatement(domain: string, value: unknown, operationId: string): Uint8Array;
71
159
  export declare function encodeMlsDevApplicationProof(value: unknown, operationId: string): Uint8Array;
72
160
  export declare function encodeMlsDevApplicationEnvelopeHash(value: unknown, operationId: string): Uint8Array;
73
161
  export declare function encodeMlsDevApplicationAad(value: unknown, operationId: string): Uint8Array;
@@ -1,11 +1,13 @@
1
1
  import { type MlsDevEnrollmentDevice } from './mlsDevEnrollment.js';
2
+ import { type MlsEnvironmentId, type MlsIssuerId } from './mlsEnvironment.js';
2
3
  export declare const MLS_DEV_CREDENTIAL_TTL_MS = 86400000;
3
4
  export declare const MLS_DEV_CREDENTIAL_CHALLENGE_TTL_MS = 300000;
4
5
  export declare const MLS_DEV_CREDENTIAL_MAX_BYTES = 8192;
5
6
  export interface MlsDevCredentialClaims {
6
7
  readonly version: 1;
7
8
  readonly credentialId: string;
8
- readonly issuer: 'canon-mls-dev-v1';
9
+ /** The device's environment's issuer (`MLS_ENVIRONMENT_PROFILES`). */
10
+ readonly issuer: MlsIssuerId;
9
11
  readonly device: MlsDevEnrollmentDevice;
10
12
  readonly generation: number;
11
13
  readonly issuedAtMs: number;
@@ -52,7 +54,8 @@ export declare class MlsDevCredentialValidationError extends Error {
52
54
  readonly code = "INVALID_MLS_DEV_CREDENTIAL";
53
55
  constructor();
54
56
  }
55
- export declare function parseMlsDevIssuerKeyVersion(value: unknown): string;
57
+ /** A version of an environment's issuer key: of `environmentId`'s when given, else of any declared environment's. */
58
+ export declare function parseMlsDevIssuerKeyVersion(value: unknown, environmentId?: MlsEnvironmentId): string;
56
59
  export declare function parseMlsDevCredentialClaims(value: unknown): MlsDevCredentialClaims;
57
60
  export declare function parseMlsDevCredentialUnsigned(value: unknown): MlsDevCredentialUnsigned;
58
61
  export declare function parseMlsDevCredentialChallenge(value: unknown): MlsDevCredentialChallenge;
@@ -1,13 +1,14 @@
1
1
  import { type MlsDevEnrollmentChallenge, type MlsDevEnrollmentPrincipal, type MlsDevEnrollmentResult } from './mlsDevEnrollment.js';
2
2
  import { type MlsDevCredentialChallenge } from './mlsDevCredential.js';
3
3
  import { type MlsDevCredentialReconciliationChallenge } from './mlsDevCredentialReconciliation.js';
4
+ import { type MlsEnvironmentId } from './mlsEnvironment.js';
4
5
  /** Synthetic Dev native bridge contracts; never an issuer or membership grant. */
5
6
  export declare const MLS_DEV_DEVICE_CONTEXT_MAX_BYTES = 2048;
6
7
  export declare const MLS_DEV_DEVICE_COMMAND_MAX_BYTES = 16384;
7
8
  export declare const MLS_DEV_DEVICE_WRAPPED_STATE_MAX_BYTES = 6144;
8
9
  export interface MlsDevDeviceBinding {
9
10
  readonly version: 1;
10
- readonly environmentId: 'canon-dev-v1';
11
+ readonly environmentId: MlsEnvironmentId;
11
12
  readonly principal: MlsDevEnrollmentPrincipal;
12
13
  readonly installationId: string;
13
14
  }
@@ -1,3 +1,4 @@
1
+ import { type MlsEnvironmentId } from './mlsEnvironment.js';
1
2
  /** Dev device-key registration only. These records are not MLS issuer credentials. */
2
3
  export declare const MLS_DEV_ENROLLMENT_CHALLENGE_TTL_MS = 300000;
3
4
  export declare const MLS_DEV_ENROLLMENT_MAX_BYTES = 4096;
@@ -23,7 +24,7 @@ export interface MlsDevEnrollmentChallenge {
23
24
  readonly version: 1;
24
25
  readonly challengeId: string;
25
26
  readonly deviceId: string;
26
- readonly environmentId: 'canon-dev-v1';
27
+ readonly environmentId: MlsEnvironmentId;
27
28
  readonly principal: MlsDevEnrollmentPrincipal;
28
29
  readonly installationId: string;
29
30
  readonly ciphersuite: 1;
@@ -36,7 +37,7 @@ export interface MlsDevEnrollmentChallenge {
36
37
  export interface MlsDevEnrollmentDevice {
37
38
  readonly version: 1;
38
39
  readonly deviceId: string;
39
- readonly environmentId: 'canon-dev-v1';
40
+ readonly environmentId: MlsEnvironmentId;
40
41
  readonly principal: MlsDevEnrollmentPrincipal;
41
42
  readonly installationId: string;
42
43
  readonly ciphersuite: 1;
@@ -0,0 +1,43 @@
1
+ import type { MlsDevGroupFeedEntry } from './mlsDevGroupFeed.js';
2
+ import { type MlsEnvironmentId } from './mlsEnvironment.js';
3
+ /**
4
+ * Signed acceptance times (docs/design/mls-signed-acceptance.md): when Canon accepts an MLS feed entry it signs the
5
+ * time, with the environment's feed-receipt key, so a device judges the entry's sender at that time instead of by its
6
+ * own clock. The proof travels beside the entry; the receipt and the accepted control themselves are unchanged.
7
+ */
8
+ export declare const MLS_DEV_FEED_RECEIPT_DOMAIN = "canon.mls.feed-receipt.v1\0";
9
+ /** What Canon signs for one accepted entry, in this field order. `entryHash` binds the exact accepted bytes: an
10
+ * application's `envelopeHash`, or an accepted control's `head.hash`. */
11
+ export interface MlsDevFeedReceiptStatement {
12
+ readonly environmentId: MlsEnvironmentId;
13
+ readonly conversationId: string;
14
+ readonly groupId: string;
15
+ readonly feedOrdinal: number;
16
+ readonly kind: 'application' | 'control';
17
+ readonly entryHash: string;
18
+ readonly acceptedAtMs: number;
19
+ }
20
+ export interface MlsDevFeedReceiptProof {
21
+ /** A version of the environment's feed-receipt key. */
22
+ readonly keyVersion: string;
23
+ /** Ed25519 over `encodeMlsDevFeedReceipt`, canonical base64url. */
24
+ readonly signature: string;
25
+ }
26
+ export declare class MlsDevFeedReceiptValidationError extends Error {
27
+ readonly code = "INVALID_MLS_DEV_FEED_RECEIPT";
28
+ constructor();
29
+ }
30
+ export declare function parseMlsDevReceiptKeyVersion(value: unknown, environmentId?: MlsEnvironmentId): string;
31
+ export declare function parseMlsDevFeedReceiptProof(value: unknown): MlsDevFeedReceiptProof;
32
+ /** The statement for an accepted feed entry, in the environment that accepted it. */
33
+ export declare function mlsDevFeedReceiptStatement(entry: MlsDevGroupFeedEntry, environmentId: MlsEnvironmentId): {
34
+ statement: MlsDevFeedReceiptStatement;
35
+ operationId: string;
36
+ };
37
+ /** The exact bytes the feed-receipt key signs: the statement framed under its domain and the entry's operation. */
38
+ export declare function encodeMlsDevFeedReceipt(statement: MlsDevFeedReceiptStatement, operationId: string): Uint8Array;
39
+ /** Native refuses, for now, an entry Canon accepted more than 10 minutes ahead of this device's clock: a retryable
40
+ * pause, never a room failure (mls-signed-acceptance.md §2.9). */
41
+ export declare const MLS_DEV_GROUP_RECEIPT_CLOCK_SKEW = "MLS_DEV_GROUP_RECEIPT_CLOCK_SKEW";
42
+ /** Whether a native or custody response is exactly that pause (the portable helper adds `version: 1`). */
43
+ export declare function isMlsDevReceiptClockSkew(value: unknown): boolean;
@@ -1,7 +1,9 @@
1
- import { MLS_DEV_TEXT_PROTOCOL, type MlsDevApplicationEnvelope, type MlsDevApplicationPreconditions } from './mlsDevApplication.js';
1
+ import { type MlsDevTextProtocol, type MlsDevInteractionBinding, type MlsDevItem, type MlsDevTextPayload, type MlsDevApplicationEnvelope, type MlsDevApplicationPreconditions } from './mlsDevApplication.js';
2
2
  import { type MlsDevGroupFeedApplicationEntry } from './mlsDevGroupFeed.js';
3
+ import { type MlsDevFeedReceiptProof } from './mlsDevFeedReceipt.js';
3
4
  import { type MlsDevEnrollmentDevice } from './mlsDevEnrollment.js';
4
5
  import { type MlsDevKeyPackageClaimReceipt } from './mlsDevKeyPackages.js';
6
+ import { type MlsEnvironmentId } from './mlsEnvironment.js';
5
7
  export declare const MLS_DEV_GROUP_ROSTER_MAX = 32;
6
8
  export declare const MLS_DEV_GROUP_TLS_MAX_BYTES: number;
7
9
  export declare const MLS_DEV_GROUP_CONTROL_MAX_BYTES: number;
@@ -16,7 +18,7 @@ export interface MlsDevGroupCreateConversation {
16
18
  readonly version: 1;
17
19
  readonly conversationId: string;
18
20
  readonly credential: string;
19
- readonly protocol?: typeof MLS_DEV_TEXT_PROTOCOL;
21
+ readonly protocol?: MlsDevTextProtocol;
20
22
  };
21
23
  }
22
24
  export interface MlsDevGroupHead {
@@ -40,7 +42,7 @@ export interface MlsDevGroupPreconditions {
40
42
  }
41
43
  export interface MlsDevGroupUnsignedControl {
42
44
  readonly version: 1;
43
- readonly environmentId: 'canon-dev-v1';
45
+ readonly environmentId: MlsEnvironmentId;
44
46
  readonly kind: 'create' | 'add' | 'remove';
45
47
  readonly conversationId: string;
46
48
  readonly groupId: string;
@@ -69,6 +71,31 @@ export interface MlsDevGroupAcceptedControl {
69
71
  readonly acceptedAtMs: number;
70
72
  readonly membershipRevision: number;
71
73
  }
74
+ /** Which current members' devices a room still needs to admit (mls-rooms-by-default.md §2.4), asked by an admitted device. */
75
+ export interface MlsDevGroupAdmissionsQuery {
76
+ readonly version: 1;
77
+ readonly conversationId: string;
78
+ readonly credential: string;
79
+ }
80
+ export interface MlsDevGroupAdmissionCandidate {
81
+ readonly principal: {
82
+ readonly type: 'human' | 'ai_agent';
83
+ readonly id: string;
84
+ };
85
+ readonly deviceId: string;
86
+ /** The member's admission, the `targetAdmissionId` a claim for this device names. */
87
+ readonly targetAdmissionId: string;
88
+ }
89
+ export interface MlsDevGroupAdmissionsResult {
90
+ readonly version: 1;
91
+ readonly conversationId: string;
92
+ readonly membershipRevision: number;
93
+ /** Registered, eligible devices of current members that are not in the group and have a KeyPackage available. */
94
+ readonly candidates: readonly MlsDevGroupAdmissionCandidate[];
95
+ /** Current members with no device in the group (whether or not one is a candidate): the room's send hold (D2). */
96
+ readonly waitingPrincipalIds: readonly string[];
97
+ }
98
+ export declare const MLS_DEV_GROUP_ADMISSION_MAX_CANDIDATES = 64;
72
99
  export interface MlsDevGroupQuery {
73
100
  readonly version: 1;
74
101
  readonly conversationId: string;
@@ -91,14 +118,14 @@ export interface MlsDevGroupQueryResult {
91
118
  }
92
119
  export interface MlsDevGroupContext {
93
120
  readonly version: 1;
94
- readonly environmentId: 'canon-dev-v1';
121
+ readonly environmentId: MlsEnvironmentId;
95
122
  readonly conversationId: string;
96
123
  readonly groupId: string;
97
124
  readonly deviceId: string;
98
125
  readonly installationId: string;
99
126
  /** Local protected-state revision, distinct from server sequence and MLS epoch. */
100
127
  readonly revision: number;
101
- readonly protocol?: typeof MLS_DEV_TEXT_PROTOCOL;
128
+ readonly protocol?: MlsDevTextProtocol;
102
129
  }
103
130
  export type MlsDevGroupCommand = {
104
131
  readonly op: 'encrypt_text';
@@ -108,9 +135,47 @@ export type MlsDevGroupCommand = {
108
135
  readonly expectedHead: MlsDevGroupHead;
109
136
  readonly preconditions: MlsDevApplicationPreconditions;
110
137
  readonly text: string;
138
+ /** v3 rooms only (mls-payload-v3.md §2); native refuses either in a v1 or v2 room. */
139
+ readonly replyTo?: MlsDevTextPayload['replyTo'];
140
+ readonly mentions?: MlsDevTextPayload['mentions'];
141
+ } | {
142
+ /** v3 rooms only (mls-payload-v3.md §2): native carries the item as an opaque object this contract validates. */
143
+ readonly op: 'encrypt_item';
144
+ readonly operationId: string;
145
+ readonly messageId: string;
146
+ readonly credential: string;
147
+ readonly expectedHead: MlsDevGroupHead;
148
+ readonly preconditions: MlsDevApplicationPreconditions;
149
+ readonly item: MlsDevItem;
111
150
  } | {
112
151
  readonly op: 'process_application';
113
152
  readonly entry: MlsDevGroupFeedApplicationEntry;
153
+ } | {
154
+ /** v2 only (encrypted-interactions.md §2.3). `body` is the payload's `interaction` object; native adds a secret
155
+ * request's one-time `secretKey`, and with `seal` seals the answer text into `answer.sealed` for the requester. */
156
+ readonly op: 'encrypt_interaction';
157
+ readonly operationId: string;
158
+ readonly messageId: string;
159
+ readonly credential: string;
160
+ readonly expectedHead: MlsDevGroupHead;
161
+ readonly preconditions: MlsDevApplicationPreconditions;
162
+ readonly interaction: MlsDevInteractionBinding;
163
+ readonly body: Readonly<Record<string, unknown>>;
164
+ readonly seal: {
165
+ readonly text: string;
166
+ readonly publicKey: string;
167
+ readonly requesterDeviceId: string;
168
+ } | null;
169
+ } | {
170
+ /** The requester opens a sealed answer once; native removes the request's key from the state it returns (§2.5). */
171
+ readonly op: 'open_secret_answer';
172
+ readonly requestId: string;
173
+ readonly responderId: string;
174
+ readonly responderDeviceId: string;
175
+ readonly sealed: {
176
+ readonly enc: string;
177
+ readonly ciphertext: string;
178
+ };
114
179
  } | {
115
180
  readonly op: 'create';
116
181
  readonly operationId: string;
@@ -141,22 +206,62 @@ export type MlsDevGroupCommand = {
141
206
  readonly op: 'join';
142
207
  readonly credential: string;
143
208
  readonly accepted: MlsDevGroupAcceptedControl;
209
+ /** Canon's signed acceptance time for the control at `feedOrdinal` (mls-signed-acceptance.md). */
210
+ readonly receiptProof: MlsDevFeedReceiptProof;
211
+ readonly feedOrdinal: number;
144
212
  readonly keyPackageId: string;
145
213
  } | {
146
214
  readonly op: 'process';
147
215
  readonly credential: string;
148
216
  readonly accepted: MlsDevGroupAcceptedControl;
217
+ readonly receiptProof: MlsDevFeedReceiptProof;
218
+ readonly feedOrdinal: number;
149
219
  };
150
220
  export type MlsDevGroupPayload = {
151
221
  readonly kind: 'application';
152
222
  readonly envelope: MlsDevApplicationEnvelope;
223
+ /** `encrypt_item` only: the exact authored item plaintext, the endpoint's own copy. */
224
+ readonly payload?: string;
225
+ } | {
226
+ /** A received item: its exact plaintext JSON, which the endpoint parses (`parseMlsDevItemPayload`). */
227
+ readonly kind: 'item';
228
+ readonly messageId: string;
229
+ readonly operationId: string;
230
+ readonly senderDeviceId: string;
231
+ readonly payload: string;
232
+ readonly feedOrdinal: number;
153
233
  } | {
154
234
  readonly kind: 'text';
155
235
  readonly messageId: string;
156
236
  readonly operationId: string;
157
237
  readonly senderDeviceId: string;
158
238
  readonly text: string;
239
+ readonly replyTo?: MlsDevTextPayload['replyTo'];
240
+ readonly mentions?: MlsDevTextPayload['mentions'];
241
+ readonly feedOrdinal: number;
242
+ } | {
243
+ /** `payload` is the exact authored plaintext JSON: a secret request's public key, or only a sealed answer. */
244
+ readonly kind: 'interaction_application';
245
+ readonly envelope: MlsDevApplicationEnvelope;
246
+ readonly payload: string;
247
+ } | {
248
+ readonly kind: 'interaction';
249
+ readonly messageId: string;
250
+ readonly operationId: string;
251
+ readonly senderDeviceId: string;
252
+ readonly payload: string;
253
+ readonly feedOrdinal: number;
254
+ } | {
255
+ /** v2 only: content that failed native checks after an authenticated receive. Consumed, logged, never applied. */
256
+ readonly kind: 'invalid';
257
+ readonly messageId: string;
258
+ readonly operationId: string;
259
+ readonly senderDeviceId: string;
159
260
  readonly feedOrdinal: number;
261
+ } | {
262
+ readonly kind: 'secret';
263
+ readonly requestId: string;
264
+ readonly text: string;
160
265
  } | {
161
266
  readonly kind: 'discarded';
162
267
  readonly operationId: string;
@@ -183,10 +288,29 @@ export declare function parseMlsDevGroupCreateConversation(value: unknown): MlsD
183
288
  export declare function parseMlsDevGroupHead(value: unknown): MlsDevGroupHead;
184
289
  export declare function parseMlsDevGroupMarker(value: unknown): MlsDevGroupMarker;
185
290
  export declare function parseMlsDevGroupRoster(value: unknown): readonly MlsDevGroupRosterEntry[];
291
+ /** Hold, then close (owner ruling 2026-10-16; mls-dev-groups.md): how long an erased member's devices wait for a commit. */
292
+ export declare const MLS_DEV_ROOM_REMOVAL_DEADLINE_MS: number;
293
+ export interface MlsDevRoomRemovalEntry {
294
+ readonly principalId: string;
295
+ /** The erased principal's devices still in the MLS roster; any other admitted device may commit their removal. */
296
+ readonly deviceIds: readonly string[];
297
+ readonly deadlineAtMs: number;
298
+ }
299
+ /** `conversations/{id}.mlsRemoval`: `pending` holds every send; `closing` and `closed` refuse every later send and roster
300
+ * change. `closing` still lists the erased principals whose Canon membership the scheduler has yet to remove. */
301
+ export interface MlsDevRoomRemoval {
302
+ readonly version: 1;
303
+ readonly status: 'pending' | 'closing' | 'closed';
304
+ readonly pending: readonly MlsDevRoomRemovalEntry[];
305
+ readonly closedAtMs: number | null;
306
+ }
307
+ export declare function parseMlsDevRoomRemoval(value: unknown): MlsDevRoomRemoval;
186
308
  export declare function parseMlsDevGroupPreconditions(value: unknown): MlsDevGroupPreconditions;
187
309
  export declare function parseMlsDevGroupUnsignedControl(value: unknown): MlsDevGroupUnsignedControl;
188
310
  export declare function parseMlsDevGroupControl(value: unknown): MlsDevGroupControl;
189
311
  export declare function parseMlsDevGroupAcceptedControl(value: unknown): MlsDevGroupAcceptedControl;
312
+ export declare function parseMlsDevGroupAdmissionsQuery(value: unknown): MlsDevGroupAdmissionsQuery;
313
+ export declare function parseMlsDevGroupAdmissionsResult(value: unknown): MlsDevGroupAdmissionsResult;
190
314
  export declare function parseMlsDevGroupQuery(value: unknown): MlsDevGroupQuery;
191
315
  export declare function parseMlsDevGroupQueryResult(value: unknown): MlsDevGroupQueryResult;
192
316
  export declare function parseMlsDevGroupContext(value: unknown): MlsDevGroupContext;
@@ -1,5 +1,6 @@
1
1
  import { type MlsDevGroupAcceptedControl, type MlsDevGroupMarker, type MlsDevGroupRosterEntry } from './mlsDevGroup.js';
2
- import { MLS_DEV_TEXT_PROTOCOL, type MlsDevApplicationEnvelope, type MlsDevApplicationReceipt } from './mlsDevApplication.js';
2
+ import { type MlsDevTextProtocol, type MlsDevApplicationEnvelope, type MlsDevApplicationReceipt } from './mlsDevApplication.js';
3
+ import { type MlsDevFeedReceiptProof } from './mlsDevFeedReceipt.js';
3
4
  export declare const MLS_DEV_GROUP_FEED_MAX_ENTRIES = 4;
4
5
  export declare const MLS_DEV_GROUP_FEED_MAX_BYTES: number;
5
6
  export interface MlsDevGroupFeedControlEntry {
@@ -7,6 +8,8 @@ export interface MlsDevGroupFeedControlEntry {
7
8
  readonly ordinal: number;
8
9
  readonly kind: 'control';
9
10
  readonly accepted: MlsDevGroupAcceptedControl;
11
+ /** Canon's signature over the time it accepted this entry (mls-signed-acceptance.md). */
12
+ readonly receiptProof?: MlsDevFeedReceiptProof;
10
13
  }
11
14
  export interface MlsDevGroupFeedApplicationEntry {
12
15
  readonly version: 1;
@@ -14,6 +17,7 @@ export interface MlsDevGroupFeedApplicationEntry {
14
17
  readonly kind: 'application';
15
18
  readonly receipt: MlsDevApplicationReceipt;
16
19
  readonly envelope: MlsDevApplicationEnvelope;
20
+ readonly receiptProof?: MlsDevFeedReceiptProof;
17
21
  }
18
22
  export type MlsDevGroupFeedEntry = MlsDevGroupFeedControlEntry | MlsDevGroupFeedApplicationEntry;
19
23
  export interface MlsDevGroupFeedQuery {
@@ -25,7 +29,7 @@ export interface MlsDevGroupFeedQuery {
25
29
  }
26
30
  export interface MlsDevGroupFeedResult {
27
31
  readonly version: 1;
28
- readonly protocol: typeof MLS_DEV_TEXT_PROTOCOL;
32
+ readonly protocol: MlsDevTextProtocol;
29
33
  readonly conversationId: string;
30
34
  readonly marker: MlsDevGroupMarker | null;
31
35
  readonly membershipRevision: number;