@canonmsg/agent-sdk 12.0.0 → 12.2.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-HITMISWV.js +4897 -0
  3. package/dist/chunks/{chunk-FPQFTTND.js → chunk-J63YVAKA.js} +1627 -1099
  4. package/dist/chunks/{chunk-OLJ7H4E2.js → chunk-O5C3ZGI4.js} +6363 -7011
  5. package/dist/chunks/{mls-crypto-NZDNSPAO.js → mls-crypto-ITVGUEP7.js} +3 -3
  6. package/dist/cli.js +403 -30
  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 +52 -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 +6 -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 +26 -0
  31. package/dist/internal/backend-contracts/runtimeCardFields.d.ts +0 -4
  32. package/dist/internal/backend-contracts/upload-mime-types.d.ts +17 -0
  33. package/dist/internal/backend-contracts/verbContract.d.ts +23 -19
  34. package/dist/internal/backend-contracts/verbSchemas.d.ts +38 -29
  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 +3 -152
  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 +22 -63
  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/turn-protocol.d.ts +0 -5
  55. package/dist/internal/core/turn-verbosity.d.ts +5 -23
  56. package/dist/internal/core/types.d.ts +0 -292
  57. package/dist/internal/endpoint/engine.d.ts +31 -1
  58. package/dist/internal/endpoint/index.d.ts +1 -1
  59. package/dist/internal/endpoint/media.d.ts +5 -0
  60. package/dist/internal/endpoint/mls-crypto.d.ts +12 -5
  61. package/dist/internal/endpoint/mls-dev-client.d.ts +9 -1
  62. package/dist/internal/endpoint/mls-dev-device.d.ts +2 -0
  63. package/dist/internal/endpoint/mls-dev-groups.d.ts +65 -5
  64. package/dist/internal/endpoint/mls-dev-interactions.d.ts +99 -0
  65. package/dist/internal/endpoint/mls-dev-key-package-service.d.ts +13 -0
  66. package/dist/internal/endpoint/mls-dev-key-packages.d.ts +23 -3
  67. package/dist/internal/endpoint/mls-dev-text.d.ts +67 -0
  68. package/dist/internal/endpoint/mls-dev-transport.d.ts +2 -1
  69. package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +5 -0
  70. package/dist/internal/endpoint/transport.d.ts +6 -1
  71. package/dist/media.js +2 -2
  72. package/dist/runner/errands.d.ts +118 -0
  73. package/dist/runner/mls.d.ts +97 -0
  74. package/dist/runner/relay.d.ts +87 -0
  75. package/dist/runner/runner.d.ts +61 -0
  76. package/dist/runner/types.d.ts +51 -4
  77. package/package.json +1 -1
  78. package/dist/chunks/chunk-6VK4UZHJ.js +0 -2806
  79. package/dist/internal/backend-contracts/workSessions.d.ts +0 -205
  80. package/dist/internal/core/agent-resolver.d.ts +0 -49
  81. package/dist/internal/core/agent-session.d.ts +0 -12
  82. package/dist/internal/core/artifacts.d.ts +0 -262
  83. package/dist/internal/core/attached-native-session.d.ts +0 -174
  84. package/dist/internal/core/attached-session-file-store.d.ts +0 -3
  85. package/dist/internal/core/control-poller.d.ts +0 -221
  86. package/dist/internal/core/exclusive-json-file-store.d.ts +0 -7
  87. package/dist/internal/core/execution-environment.d.ts +0 -55
  88. package/dist/internal/core/group-context.d.ts +0 -25
  89. package/dist/internal/core/inbound-frame.d.ts +0 -64
  90. package/dist/internal/core/local-runtime-catalog.d.ts +0 -131
  91. package/dist/internal/core/message-format.d.ts +0 -13
  92. package/dist/internal/core/native-session-interaction.d.ts +0 -44
  93. package/dist/internal/core/provenance.d.ts +0 -31
  94. package/dist/internal/core/registration-cli.d.ts +0 -40
  95. package/dist/internal/core/stream.d.ts +0 -77
  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
package/dist/index.d.ts CHANGED
@@ -1,13 +1,21 @@
1
1
  export { createRunner, runtimeDescriptor } from './runner/runner.js';
2
2
  export type { Runner, RunnerOptions } from './runner/runner.js';
3
- export { DriverSessionError } from './runner/types.js';
4
- export type { ActivityEvent, AskAnswer, AskRequest, DriverCapabilities, DriverResult, DriverState, DriverTurn, RuntimeDriver, ToolDefinition, ToolResult, TurnInput, TurnInputMessage, TurnTools, } from './runner/types.js';
3
+ export { ConnectorRelayError, DriverSessionError } from './runner/types.js';
4
+ export { loadMlsDevConfiguration, MLS_SETUP_ACTIONS, mlsDevRoomPackageId, runMlsDevSetup } from './runner/mls.js';
5
+ export type { MlsSetupAction, RunnerMlsOptions } from './runner/mls.js';
6
+ export type { ActivityEvent, AskAnswer, AskRequest, DriverCapabilities, DriverResult, DriverState, DriverTurn, ErrandFacts, RuntimeDriver, ToolDefinition, ToolResult, TurnInput, TurnInputMessage, TurnTools, } from './runner/types.js';
7
+ export { errandJournal, errandsDirectory, queueErrand } from './runner/errands.js';
8
+ export type { ErrandCommand, ErrandInput, ErrandKind, ErrandRecord, ErrandStatus } from './runner/errands.js';
5
9
  export { codeDriver } from './drivers/code.js';
6
10
  export type { CodeHandler, CodeTurn } from './drivers/code.js';
7
11
  export { claudeDriver, loadClaudeQuery } from './drivers/claude.js';
8
12
  export type { ClaudeDriverOptions, ClaudeQuery } from './drivers/claude.js';
9
13
  export { checkCodex, codexDriver } from './drivers/codex.js';
10
14
  export type { CodexDriverOptions } from './drivers/codex.js';
15
+ export { connectorDriver } from './drivers/connector.js';
16
+ export type { ConnectorDriver, ConnectorInbox } from './drivers/connector.js';
17
+ export { loadRelayConfiguration, startRelayChannel } from './runner/relay.js';
18
+ export type { RelayChannel, RelayChannelOptions, RelayConfiguration, RelayCredentialDelivery, RelayTarget } from './runner/relay.js';
11
19
  export { CanonApiError, clearPendingRegistration, ensureAgentProfile, resumeRegistration } from './internal/core/index.js';
12
20
  export type { CommunicateInput, CommunicateResult, EnsureAgentProfileOptions, MediaAttachment, RegistrationCredentials, RegistrationProgress, RegistrationSession, RegistrationStatus, RegistrationStore, ResumableMediaUploadResult, ResumeRegistrationOptions, VideoProcessingErrorCode, VideoProcessingStatus, } from './internal/core/index.js';
13
21
  export { DEFAULT_ANTHROPIC_REQUEST_HEADROOM_BYTES, DEFAULT_MEDIA_CACHE_DIR, DEFAULT_MEDIA_MATERIALIZATION_BYTES, MAX_ANTHROPIC_IMAGE_RAW_BYTES, MAX_ANTHROPIC_REQUEST_BYTES, MAX_CANON_MEDIA_BYTES, getCodexImagePath, getMessageAttachments, inferUploadMimeType, isAnthropicImageAttachment, conversationMediaCacheDir, materializeAttachment, materializeMessageMedia, materializeReplyContextMedia, resolveAttachmentMimeType, sendMediaFileMessage, toAnthropicImageBlock, toAnthropicImageBlocksWithinBudget, uploadMediaFile, } from './media.js';
package/dist/index.js CHANGED
@@ -1,13 +1,24 @@
1
1
  import {
2
+ ConnectorRelayError,
2
3
  DriverSessionError,
4
+ MLS_SETUP_ACTIONS,
3
5
  checkCodex,
4
6
  claudeDriver,
5
7
  codeDriver,
6
8
  codexDriver,
9
+ connectorDriver,
7
10
  createRunner,
11
+ errandJournal,
12
+ errandsDirectory,
8
13
  loadClaudeQuery,
9
- runtimeDescriptor
10
- } from "./chunks/chunk-6VK4UZHJ.js";
14
+ loadMlsDevConfiguration,
15
+ loadRelayConfiguration,
16
+ mlsDevRoomPackageId,
17
+ queueErrand,
18
+ runMlsDevSetup,
19
+ runtimeDescriptor,
20
+ startRelayChannel
21
+ } from "./chunks/chunk-HITMISWV.js";
11
22
  import {
12
23
  CanonApiError,
13
24
  DEFAULT_ANTHROPIC_REQUEST_HEADROOM_BYTES,
@@ -32,10 +43,11 @@ import {
32
43
  toAnthropicImageBlock,
33
44
  toAnthropicImageBlocksWithinBudget,
34
45
  uploadMediaFile
35
- } from "./chunks/chunk-OLJ7H4E2.js";
36
- import "./chunks/chunk-FPQFTTND.js";
46
+ } from "./chunks/chunk-O5C3ZGI4.js";
47
+ import "./chunks/chunk-J63YVAKA.js";
37
48
  export {
38
49
  CanonApiError,
50
+ ConnectorRelayError,
39
51
  DEFAULT_ANTHROPIC_REQUEST_HEADROOM_BYTES,
40
52
  DEFAULT_MEDIA_CACHE_DIR,
41
53
  DEFAULT_MEDIA_MATERIALIZATION_BYTES,
@@ -43,26 +55,36 @@ export {
43
55
  MAX_ANTHROPIC_IMAGE_RAW_BYTES,
44
56
  MAX_ANTHROPIC_REQUEST_BYTES,
45
57
  MAX_CANON_MEDIA_BYTES,
58
+ MLS_SETUP_ACTIONS,
46
59
  checkCodex,
47
60
  claudeDriver,
48
61
  clearPendingRegistration,
49
62
  codeDriver,
50
63
  codexDriver,
64
+ connectorDriver,
51
65
  conversationMediaCacheDir,
52
66
  createRunner,
53
67
  ensureAgentProfile,
68
+ errandJournal,
69
+ errandsDirectory,
54
70
  getCodexImagePath,
55
71
  getMessageAttachments,
56
72
  inferUploadMimeType,
57
73
  isAnthropicImageAttachment,
58
74
  loadClaudeQuery,
75
+ loadMlsDevConfiguration,
76
+ loadRelayConfiguration,
59
77
  materializeAttachment,
60
78
  materializeMessageMedia,
61
79
  materializeReplyContextMedia,
80
+ mlsDevRoomPackageId,
81
+ queueErrand,
62
82
  resolveAttachmentMimeType,
63
83
  resumeRegistration,
84
+ runMlsDevSetup,
64
85
  runtimeDescriptor,
65
86
  sendMediaFileMessage,
87
+ startRelayChannel,
66
88
  toAnthropicImageBlock,
67
89
  toAnthropicImageBlocksWithinBudget,
68
90
  uploadMediaFile
@@ -1,84 +1,3 @@
1
- import { type ArtifactCommandType, type ArtifactFormField, type ArtifactFormTable, type ArtifactFormValue } from './artifacts.js';
2
- /**
3
- * The agent-facing vocabulary of shared work: what a model, an SDK handler or
4
- * a person asks for. An endpoint turns an action into a protocol command
5
- * against what its author last saw; agents never write commands, revision IDs
6
- * or command IDs. The parsers check everything that does not need the work
7
- * itself; the shared rules (the endpoint reducer) decide the rest.
8
- */
9
- /** A form value as an author gives it. Core turns numeric text for number inputs (and "true"/"false" for checkboxes) into typed values. */
10
- export type ArtifactActionValue = ArtifactFormValue;
11
- export interface ArtifactCellAction {
12
- row: string;
13
- column: string;
14
- value: ArtifactActionValue;
15
- }
16
- /** Without `id`, a stable row ID is generated and returned as `addedRowIds`. */
17
- export interface ArtifactRowAction {
18
- id?: string;
19
- cells: Record<string, ArtifactActionValue>;
20
- }
21
- export declare const ARTIFACT_UPDATE_ACTION_TYPES: readonly ["chess.move", "chess.resign", "form.set", "form.fields", "image.select", "archive"];
22
- export type ArtifactUpdateActionType = typeof ARTIFACT_UPDATE_ACTION_TYPES[number];
23
- export type ArtifactUpdateAction =
24
- /** SAN ("Nf3") or UCI ("g1f3"); trimmed, at most 16 characters. */
25
- {
26
- type: 'chess.move';
27
- move: string;
28
- } | {
29
- type: 'chess.resign';
30
- } | {
31
- type: 'form.set';
32
- values?: Record<string, ArtifactActionValue>;
33
- cells?: ArtifactCellAction[];
34
- addRows?: ArtifactRowAction[];
35
- removeRows?: string[];
36
- }
37
- /** `remove` names fields; the endpoint sends each one's last-seen value, so a newer value conflicts instead of being discarded. */
38
- | {
39
- type: 'form.fields';
40
- add?: ArtifactFormField[];
41
- remove?: string[];
42
- } | {
43
- type: 'image.select';
44
- variantId: string;
45
- } | {
46
- type: 'archive';
47
- archived: boolean;
48
- };
49
- /** `opponent` (a participant ID) is host-owned: tools fill it with the person whose message started the turn. */
50
- export type ArtifactCreateAction = {
51
- kind: 'chess';
52
- title: string;
53
- playAs?: 'white' | 'black';
54
- opponent?: string;
55
- fen?: string;
56
- } | {
57
- kind: 'form';
58
- title: string;
59
- fields: ArtifactFormField[];
60
- values?: Record<string, ArtifactActionValue>;
61
- table?: ArtifactFormTable;
62
- rows?: ArtifactRowAction[];
63
- } | {
64
- kind: 'image';
65
- title: string;
66
- };
67
- /** The model-facing create input (`artifact_create`): kind-specific options nest under `chess` or `form`. */
68
- export interface ArtifactCreateToolInput {
69
- kind: 'chess' | 'form' | 'image';
70
- title: string;
71
- chess?: {
72
- playAs?: 'white' | 'black';
73
- fen?: string;
74
- };
75
- form?: {
76
- fields: ArtifactFormField[];
77
- values?: Record<string, ArtifactActionValue>;
78
- table?: ArtifactFormTable;
79
- rows?: ArtifactRowAction[];
80
- };
81
- }
82
1
  /** Fractions of the image, origin top-left. */
83
2
  export interface ArtifactImageRegion {
84
3
  x: number;
@@ -86,74 +5,4 @@ export interface ArtifactImageRegion {
86
5
  width: number;
87
6
  height: number;
88
7
  }
89
- /** 'current' edits the current version (or starts fresh when there is none); 'new' uses the prompt alone. */
90
- export type ArtifactImageSource = 'current' | 'new' | {
91
- variantId: string;
92
- };
93
- /** Models may also give a bare version ID as `from`; the parser turns it into `{ variantId }`. */
94
- export interface ArtifactGenerateImageAction {
95
- prompt: string;
96
- label: string;
97
- from: ArtifactImageSource;
98
- region?: ArtifactImageRegion;
99
- }
100
- /**
101
- * At most one source: a local file (`path`, only where the host allows local
102
- * files) or a message attachment (`messageId`, `attachmentIndex`). With
103
- * neither, hosts use the image on the message that started the turn.
104
- */
105
- export interface ArtifactAddImageAction {
106
- label: string;
107
- prompt?: string;
108
- sourceVariantId?: string;
109
- path?: string;
110
- messageId?: string;
111
- attachmentIndex?: number;
112
- }
113
- export type ArtifactJsonSchema = Record<string, unknown>;
114
- export interface ArtifactActionSchemas {
115
- create: ArtifactJsonSchema;
116
- update: ArtifactJsonSchema;
117
- generateImage: ArtifactJsonSchema;
118
- addImage: ArtifactJsonSchema;
119
- }
120
- /** The model-facing input of each action (without the work's artifactId). */
121
- export declare function artifactActionSchemas(): ArtifactActionSchemas;
122
- export declare const ARTIFACT_TOOL_NAMES: readonly ["artifact_list", "artifact_read", "artifact_create", "artifact_update", "artifact_generate_image", "artifact_add_image"];
123
- export type ArtifactToolName = typeof ARTIFACT_TOOL_NAMES[number];
124
- /** The complete model-facing input of each shared-work tool. */
125
- export declare function artifactToolInputSchemas(): Record<ArtifactToolName, ArtifactJsonSchema>;
126
- /** The model-facing create input (`artifact_create`). `opponent` is never taken from it. */
127
- export declare function parseArtifactCreateToolInput(input: unknown): ArtifactCreateAction;
128
- /** The flat create action (SDK callers), including the host-owned `opponent`. */
129
- export declare function parseArtifactCreateAction(input: unknown): ArtifactCreateAction;
130
- /** An `artifact_update` action, or an SDK `update` action. */
131
- export declare function parseArtifactUpdateAction(input: unknown): ArtifactUpdateAction;
132
8
  export declare function parseArtifactImageRegion(input: unknown): ArtifactImageRegion;
133
- export declare function parseArtifactImageSource(input: unknown): ArtifactImageSource;
134
- /** An `artifact_generate_image` input (without the work's artifactId), or an SDK `generateImage` input. */
135
- export declare function parseArtifactGenerateImageAction(input: unknown): ArtifactGenerateImageAction;
136
- /** An `artifact_add_image` input (without the work's artifactId). Hosts check that `path` is absolute and allowed. */
137
- export declare function parseArtifactAddImageAction(input: unknown): ArtifactAddImageAction;
138
- export type ArtifactActionName = 'create' | ArtifactUpdateActionType | 'image.generate' | 'image.add';
139
- export interface ArtifactActionSemantics {
140
- /** Who sees the result: every current member of the conversation (no narrower audience exists). */
141
- audience: 'conversation-members';
142
- /** What the change is judged against: the revision the author saw, the values the author saw, or nothing. */
143
- base: 'current-revision' | 'before-values' | 'none';
144
- conflict: string;
145
- /** How a retried request maps to the same change. */
146
- idempotency: string;
147
- persistence: string;
148
- /** What a receipt means and what decides the outcome. */
149
- completion: string;
150
- /** Member-authored input (action paths) that future encryption must cover: never in IDs, receipts, logs or other server-visible metadata. */
151
- privateFields: readonly string[];
152
- /** Server-visible routing the action needs. IDs are opaque (random or keyed per installation). */
153
- routing: readonly string[];
154
- /** Content a processor outside the audience receives by design. */
155
- processorDisclosure?: readonly string[];
156
- /** Protocol commands the action becomes. */
157
- commands: readonly ArtifactCommandType[];
158
- }
159
- export declare const ARTIFACT_ACTION_SEMANTICS: Readonly<Record<ArtifactActionName, ArtifactActionSemantics>>;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Which client is calling, and the oldest version Canon still serves (mls-cutover-operator.md §2 15b). Every client names
3
+ * itself on its endpoint requests with `X-Canon-Client: <kind>/<version>`. While a floor exists, Canon refuses a kind
4
+ * below its minimum, and any request without a valid header, with `426 CLIENT_UPDATE_REQUIRED`.
5
+ */
6
+ export declare const CANON_CLIENT_HEADER = "X-Canon-Client";
7
+ export declare const CLIENT_UPDATE_REQUIRED = "CLIENT_UPDATE_REQUIRED";
8
+ /**
9
+ * - `app-ios`, `app-android`: the native build's version (an OTA update cannot add native code, so the bundle's does not count);
10
+ * - `web`, `runner` (`@canonmsg/agent-sdk`), `hermes` (the plugin), and `core` for other first-party tools (the CLIs);
11
+ * - `connector`: Canon's hosted MCP connector, which deploys with Functions. Like `web`, it ships one build at a time and
12
+ * names itself `0.0.0`; neither gets a minimum.
13
+ */
14
+ export declare const CANON_CLIENT_KINDS: readonly ["app-ios", "app-android", "web", "runner", "hermes", "core", "connector"];
15
+ export type CanonClientKind = typeof CANON_CLIENT_KINDS[number];
16
+ export interface CanonClientIdentity {
17
+ readonly kind: CanonClientKind;
18
+ readonly version: string;
19
+ }
20
+ /** `major.minor.patch`, each at most six digits: no prerelease or build suffix, so versions compare exactly. */
21
+ export declare function isCanonClientVersion(value: unknown): value is string;
22
+ export declare function formatCanonClientHeader(client: CanonClientIdentity): string;
23
+ /** A malformed header is treated as absent. */
24
+ export declare function parseCanonClientHeader(value: unknown): CanonClientIdentity | null;
25
+ export declare function compareCanonClientVersions(left: string, right: string): number;
26
+ /** The server-only floor record (mls-cutover-operator.md §2 15b), written by `scripts/mls-rollout.mjs floor-set`. */
27
+ export declare const CANON_CLIENT_FLOOR_PATH = "mlsRollout/clientFloor";
28
+ /** The record's per-kind minimums. A kind it does not name has none. */
29
+ export interface CanonClientFloor {
30
+ readonly minimum: Readonly<Partial<Record<CanonClientKind, string>>>;
31
+ }
32
+ /** The server-only record, in its exact shape; anything else is a broken floor, which the caller refuses rather than ignore. */
33
+ export declare function parseCanonClientFloor(data: unknown): CanonClientFloor;
34
+ /** A server's cached floor: one `get` per `ttlMs`, null when none is set. A malformed record rejects (through `invalid`),
35
+ * so the caller fails closed rather than serve every client; a failed read is not remembered. */
36
+ export declare function createCanonClientFloorReader(get: () => Promise<{
37
+ readonly exists: boolean;
38
+ data(): unknown;
39
+ }>, ttlMs: number, invalid?: () => never): {
40
+ read(now?: number): Promise<CanonClientFloor | null>;
41
+ reset(): void;
42
+ };
43
+ /** The refusal's message, naming the minimum, so a runner or plugin log says what to install. */
44
+ export declare function canonClientUpdateMessage(refusal: {
45
+ kind: CanonClientKind | null;
46
+ minimum: string | null;
47
+ }): string;
48
+ /** The refusal a request gets under a floor, or null when it passes: no valid header, or a version below its kind's minimum. */
49
+ export declare function canonClientBelowFloor(floor: CanonClientFloor, header: unknown): {
50
+ kind: CanonClientKind | null;
51
+ minimum: string | null;
52
+ } | null;
@@ -109,9 +109,15 @@ export type CommunicateResult = ({
109
109
  /** Principal-neutral app/SDK command. Humans may open a composer before sending. */
110
110
  export interface StartDirectInput {
111
111
  targetUserId: string;
112
+ /** `withheld`: the client holds a line it sends only encrypted. Canon reserves `messageId` and answers
113
+ * `openingText: 'deferred'` for an encrypted room, and `opening-text-required` (writing nothing) for a plaintext one,
114
+ * which the client then starts again with its text (mls-rooms-by-default.md §2a.9). */
112
115
  opener?: {
113
116
  text: string;
114
117
  messageId?: string;
118
+ } | {
119
+ withheld: true;
120
+ messageId: string;
115
121
  } | null;
116
122
  selection?: DirectConversationSelection;
117
123
  }
@@ -121,9 +127,18 @@ export type StartDirectResult = {
121
127
  messageId?: string;
122
128
  created?: boolean;
123
129
  reused?: boolean;
130
+ /** The room is encrypted, so Canon stored no opening text: the requester's client sends it encrypted, under
131
+ * `messageId` (mls-rooms-by-default.md §2a.9). */
132
+ openingText?: 'deferred';
124
133
  } | {
125
134
  status: 'requested' | 'pending';
126
135
  requestId: string;
136
+ /** The room the request made, which the requester may open and write in (§2a.2). An encrypted room stores no
137
+ * opener: the requester's client sends it into `conversationId` under `messageId` once the request's other
138
+ * approvers have approved and the target's device is in (§2a.4, §2a.9). */
139
+ conversationId?: string;
140
+ messageId?: string;
141
+ openingText?: 'deferred';
127
142
  } | {
128
143
  status: 'blocked' | 'unavailable';
129
144
  reason: string;
@@ -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;
@@ -1,4 +1,5 @@
1
1
  import { type PreparedContent } from './preparedContent.js';
2
+ import type { MlsPrincipalOpening } from './mlsPrincipalAlias.js';
2
3
  /** Plaintext endpoint protocol. Identity and authority come from authenticated transport. */
3
4
  export declare const CANON_ENDPOINT_PROTOCOL: "canon.endpoint.v1";
4
5
  export interface EndpointPreconditions {
@@ -96,6 +97,22 @@ export interface EndpointCapabilities {
96
97
  actions: string[];
97
98
  queries: string[];
98
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: '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
+ };
99
116
  }
100
117
  export declare const ENDPOINT_ID_PATTERN: RegExp;
101
118
  export declare const ENDPOINT_ACTION_PATTERN: RegExp;
@@ -7,10 +7,10 @@ export type EndpointContentLane = 'operation.request' | 'operation.receipt' | 'q
7
7
  /** ID-only operations can still mutate encrypted semantics. These require an
8
8
  * authenticated encrypted protocol before they can operate on a protected room.
9
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"];
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
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
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
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[]];
@@ -18,6 +18,14 @@ export declare class EndpointContentPolicyError extends Error {
18
18
  readonly code = "ENDPOINT_CONTENT_UNCLASSIFIED";
19
19
  constructor(lane: string, name: string);
20
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"];
21
29
  export interface EndpointContentBoundary {
22
30
  readonly lane: EndpointContentLane;
23
31
  readonly name: string;
@@ -35,3 +43,6 @@ export declare function endpointOperationRequestRetention(action: string, body:
35
43
  /** Validate the lane before accepting/transmitting its payload. No body values
36
44
  * are logged, copied into metadata, or claimed to be encrypted by this API. */
37
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;
@@ -1,9 +1,11 @@
1
1
  export * from './diffRedaction.js';
2
2
  export * from './environment.js';
3
+ export * from './clientFloor.js';
3
4
  export * from './api-origins.generated.js';
4
5
  export * from './media.js';
5
6
  export * from './mediaDelivery.js';
6
7
  export * from './media-url.js';
8
+ export * from './upload-mime-types.js';
7
9
  export * from './message.js';
8
10
  export * from './messageText.js';
9
11
  export * from './runtimeCardFields.js';
@@ -23,11 +25,11 @@ export * from './moderation.js';
23
25
  export * from './selfContext.js';
24
26
  export * from './replyAuthority.js';
25
27
  export * from './runtimeDescriptor.js';
26
- export * from './workSessions.js';
27
28
  export type { WebPhoneAccountRequest, WebPhoneTokenResponse } from './webAuth.js';
28
29
  export * from './conversationMembership.js';
29
30
  export * from './endpoint.js';
30
31
  export * from './externalInbound.js';
32
+ export * from './connectorRelay.js';
31
33
  export * from './endpointContentPolicy.js';
32
34
  export * from './plaintextProcessors.js';
33
35
  export { computeEndpointUnreadProjection } from './endpoint-unread.js';
@@ -37,6 +39,7 @@ export * from './mediaTransferProtocol.js';
37
39
  export * from './preparedContent.js';
38
40
  export * from './artifacts.js';
39
41
  export * from './artifactActions.js';
42
+ export * from './mlsEnvironment.js';
40
43
  export * from './mlsDevEnrollment.js';
41
44
  export * from './mlsDevCredential.js';
42
45
  export * from './mlsDevCredentialReconciliation.js';
@@ -46,3 +49,6 @@ export * from './mlsDevKeyPackages.js';
46
49
  export * from './mlsDevGroup.js';
47
50
  export * from './mlsDevApplication.js';
48
51
  export * from './mlsDevGroupFeed.js';
52
+ export * from './mlsDevFeedReceipt.js';
53
+ export * from './mlsDevInteraction.js';
54
+ export * from './mlsPrincipalAlias.js';