@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.
- package/README.md +97 -7
- package/dist/chunks/chunk-HITMISWV.js +4897 -0
- package/dist/chunks/{chunk-FPQFTTND.js → chunk-J63YVAKA.js} +1627 -1099
- package/dist/chunks/{chunk-OLJ7H4E2.js → chunk-O5C3ZGI4.js} +6363 -7011
- package/dist/chunks/{mls-crypto-NZDNSPAO.js → mls-crypto-ITVGUEP7.js} +3 -3
- package/dist/cli.js +403 -30
- package/dist/drivers/claude.d.ts +8 -2
- package/dist/drivers/codex.d.ts +11 -2
- package/dist/drivers/connector.d.ts +34 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +26 -4
- package/dist/internal/backend-contracts/artifactActions.d.ts +0 -151
- package/dist/internal/backend-contracts/clientFloor.d.ts +52 -0
- package/dist/internal/backend-contracts/communication.d.ts +15 -0
- package/dist/internal/backend-contracts/connectorRelay.d.ts +179 -0
- package/dist/internal/backend-contracts/endpoint.d.ts +17 -0
- package/dist/internal/backend-contracts/endpointContentPolicy.d.ts +15 -4
- package/dist/internal/backend-contracts/index.d.ts +7 -1
- package/dist/internal/backend-contracts/media-url.d.ts +14 -0
- package/dist/internal/backend-contracts/message.d.ts +1 -1
- package/dist/internal/backend-contracts/mlsDevApplication.d.ts +90 -2
- package/dist/internal/backend-contracts/mlsDevCredential.d.ts +5 -2
- package/dist/internal/backend-contracts/mlsDevDeviceCustody.d.ts +2 -1
- package/dist/internal/backend-contracts/mlsDevEnrollment.d.ts +6 -2
- package/dist/internal/backend-contracts/mlsDevFeedReceipt.d.ts +43 -0
- package/dist/internal/backend-contracts/mlsDevGroup.d.ts +129 -5
- package/dist/internal/backend-contracts/mlsDevGroupFeed.d.ts +6 -2
- package/dist/internal/backend-contracts/mlsDevInteraction.d.ts +159 -0
- package/dist/internal/backend-contracts/mlsEnvironment.d.ts +35 -0
- package/dist/internal/backend-contracts/mlsPrincipalAlias.d.ts +26 -0
- package/dist/internal/backend-contracts/runtimeCardFields.d.ts +0 -4
- package/dist/internal/backend-contracts/upload-mime-types.d.ts +17 -0
- package/dist/internal/backend-contracts/verbContract.d.ts +23 -19
- package/dist/internal/backend-contracts/verbSchemas.d.ts +38 -29
- package/dist/internal/core/agent-profiles.d.ts +0 -4
- package/dist/internal/core/approval-format.d.ts +1 -5
- package/dist/internal/core/approval-types.d.ts +1 -2
- package/dist/internal/core/client.d.ts +3 -152
- package/dist/internal/core/constants.d.ts +0 -3
- package/dist/internal/core/endpoint-client.d.ts +14 -1
- package/dist/internal/core/execution-environment-mode.d.ts +0 -2
- package/dist/internal/core/gifs.d.ts +0 -6
- package/dist/internal/core/host-runtime.d.ts +2 -206
- package/dist/internal/core/index.d.ts +22 -63
- package/dist/internal/core/registration.d.ts +1 -17
- package/dist/internal/core/retry.d.ts +0 -9
- package/dist/internal/core/rtdb-rest.d.ts +0 -4
- package/dist/internal/core/runtime-cards.d.ts +0 -45
- package/dist/internal/core/runtime-descriptor.d.ts +1 -60
- package/dist/internal/core/runtime-presentation.d.ts +1 -27
- package/dist/internal/core/runtime-request-manager.d.ts +0 -1
- package/dist/internal/core/self-context.d.ts +0 -39
- package/dist/internal/core/silent-turn.d.ts +1 -38
- package/dist/internal/core/turn-protocol.d.ts +0 -5
- package/dist/internal/core/turn-verbosity.d.ts +5 -23
- package/dist/internal/core/types.d.ts +0 -292
- package/dist/internal/endpoint/engine.d.ts +31 -1
- package/dist/internal/endpoint/index.d.ts +1 -1
- package/dist/internal/endpoint/media.d.ts +5 -0
- package/dist/internal/endpoint/mls-crypto.d.ts +12 -5
- package/dist/internal/endpoint/mls-dev-client.d.ts +9 -1
- package/dist/internal/endpoint/mls-dev-device.d.ts +2 -0
- package/dist/internal/endpoint/mls-dev-groups.d.ts +65 -5
- package/dist/internal/endpoint/mls-dev-interactions.d.ts +99 -0
- package/dist/internal/endpoint/mls-dev-key-package-service.d.ts +13 -0
- package/dist/internal/endpoint/mls-dev-key-packages.d.ts +23 -3
- package/dist/internal/endpoint/mls-dev-text.d.ts +67 -0
- package/dist/internal/endpoint/mls-dev-transport.d.ts +2 -1
- package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +5 -0
- package/dist/internal/endpoint/transport.d.ts +6 -1
- package/dist/media.js +2 -2
- 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 +61 -0
- package/dist/runner/types.d.ts +51 -4
- package/package.json +1 -1
- package/dist/chunks/chunk-6VK4UZHJ.js +0 -2806
- package/dist/internal/backend-contracts/workSessions.d.ts +0 -205
- package/dist/internal/core/agent-resolver.d.ts +0 -49
- package/dist/internal/core/agent-session.d.ts +0 -12
- package/dist/internal/core/artifacts.d.ts +0 -262
- package/dist/internal/core/attached-native-session.d.ts +0 -174
- package/dist/internal/core/attached-session-file-store.d.ts +0 -3
- package/dist/internal/core/control-poller.d.ts +0 -221
- package/dist/internal/core/exclusive-json-file-store.d.ts +0 -7
- package/dist/internal/core/execution-environment.d.ts +0 -55
- package/dist/internal/core/group-context.d.ts +0 -25
- package/dist/internal/core/inbound-frame.d.ts +0 -64
- package/dist/internal/core/local-runtime-catalog.d.ts +0 -131
- package/dist/internal/core/message-format.d.ts +0 -13
- package/dist/internal/core/native-session-interaction.d.ts +0 -44
- package/dist/internal/core/provenance.d.ts +0 -31
- package/dist/internal/core/registration-cli.d.ts +0 -40
- package/dist/internal/core/stream.d.ts +0 -77
- package/dist/internal/core/turn-output-controller.d.ts +0 -69
- package/dist/internal/core/typing-status-publisher.d.ts +0 -14
- package/dist/internal/core/work-session-provider.d.ts +0 -29
- package/dist/internal/core/workspace-discovery.d.ts +0 -17
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { type MlsDevInteractionBinding, type MlsDevInteractionKind, type MlsDevItemPayload, type MlsDevTextPayload } from './mlsDevApplication.js';
|
|
2
|
+
import { type MlsDevGroupHead } from './mlsDevGroup.js';
|
|
3
|
+
/**
|
|
4
|
+
* Encrypted approvals and questions in `canon.mls.dev-text.v2` rooms (docs/design/encrypted-interactions.md §2.3–§2.4).
|
|
5
|
+
* The MLS plaintext is a closed union on `kind`; every variant carries the text payload's shared ids. These parsers run
|
|
6
|
+
* in the sender's endpoint before encryption and in every recipient after decryption. Native custody treats an
|
|
7
|
+
* interaction body as canonical JSON and checks only the shared ids, kind and size.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MLS_DEV_INTERACTION_LIMITS: Readonly<{
|
|
10
|
+
title: 200;
|
|
11
|
+
details: 8000;
|
|
12
|
+
options: 10;
|
|
13
|
+
optionLabel: 120;
|
|
14
|
+
text: 4000;
|
|
15
|
+
}>;
|
|
16
|
+
/** RFC 9180 base mode, DHKEM(X25519, HKDF-SHA256), HKDF-SHA256, AES-128-GCM: MLS suite 1's primitives. */
|
|
17
|
+
export declare const MLS_DEV_SECRET_ANSWER_SUITE: "x25519-hkdf-sha256-aes128gcm";
|
|
18
|
+
/** UTF-8 of at most 4,000 code points (4 bytes each) plus the AES-GCM tag. */
|
|
19
|
+
export declare const MLS_DEV_SECRET_ANSWER_MAX_BYTES: number;
|
|
20
|
+
export declare const MLS_DEV_INTERACTION_WITHDRAW_REASONS: readonly ["stopped", "turn_ended", "expired", "restart"];
|
|
21
|
+
export type MlsDevInteractionWithdrawReason = typeof MLS_DEV_INTERACTION_WITHDRAW_REASONS[number];
|
|
22
|
+
export interface MlsDevInteractionOption {
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly label: string;
|
|
25
|
+
}
|
|
26
|
+
export interface MlsDevInteractionRequestBody {
|
|
27
|
+
readonly requestId: string;
|
|
28
|
+
readonly kind: MlsDevInteractionKind;
|
|
29
|
+
readonly title: string;
|
|
30
|
+
readonly details?: string;
|
|
31
|
+
readonly options?: readonly MlsDevInteractionOption[];
|
|
32
|
+
readonly multiple?: boolean;
|
|
33
|
+
readonly risk?: 'normal' | 'destructive';
|
|
34
|
+
readonly allowSession?: boolean;
|
|
35
|
+
readonly scopeKey?: string;
|
|
36
|
+
readonly responderIds: readonly [string];
|
|
37
|
+
readonly expiresAtMs: number;
|
|
38
|
+
/** A secret request's one-time HPKE recipient key, generated and held by the requesting device's custody (§2.5). */
|
|
39
|
+
readonly secretKey?: {
|
|
40
|
+
readonly kem: 'x25519';
|
|
41
|
+
readonly publicKey: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export type MlsDevInteractionAnswer = {
|
|
45
|
+
readonly decision: 'allow' | 'deny';
|
|
46
|
+
readonly scope: 'once' | 'session';
|
|
47
|
+
} | {
|
|
48
|
+
readonly choices: readonly string[];
|
|
49
|
+
} | {
|
|
50
|
+
readonly text: string;
|
|
51
|
+
} | {
|
|
52
|
+
readonly sealed: {
|
|
53
|
+
readonly enc: string;
|
|
54
|
+
readonly ciphertext: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** The responder's Cancel/Skip on a question or secret card (review of #1081). */
|
|
58
|
+
| {
|
|
59
|
+
readonly cancelled: true;
|
|
60
|
+
};
|
|
61
|
+
export interface MlsDevInteractionResponseBody {
|
|
62
|
+
readonly requestId: string;
|
|
63
|
+
readonly agentId: string;
|
|
64
|
+
readonly answer: MlsDevInteractionAnswer;
|
|
65
|
+
}
|
|
66
|
+
export interface MlsDevInteractionWithdrawBody {
|
|
67
|
+
readonly requestId: string;
|
|
68
|
+
readonly reason: MlsDevInteractionWithdrawReason;
|
|
69
|
+
}
|
|
70
|
+
interface MlsDevApplicationPayloadIds {
|
|
71
|
+
readonly version: 1;
|
|
72
|
+
readonly conversationId: string;
|
|
73
|
+
readonly groupId: string;
|
|
74
|
+
readonly messageId: string;
|
|
75
|
+
readonly operationId: string;
|
|
76
|
+
readonly senderDeviceId: string;
|
|
77
|
+
}
|
|
78
|
+
export type MlsDevInteractionPayload = (MlsDevApplicationPayloadIds & {
|
|
79
|
+
readonly kind: 'interaction.request';
|
|
80
|
+
readonly interaction: MlsDevInteractionRequestBody;
|
|
81
|
+
}) | (MlsDevApplicationPayloadIds & {
|
|
82
|
+
readonly kind: 'interaction.response';
|
|
83
|
+
readonly interaction: MlsDevInteractionResponseBody;
|
|
84
|
+
}) | (MlsDevApplicationPayloadIds & {
|
|
85
|
+
readonly kind: 'interaction.withdraw';
|
|
86
|
+
readonly interaction: MlsDevInteractionWithdrawBody;
|
|
87
|
+
});
|
|
88
|
+
export type MlsDevApplicationPayload = MlsDevTextPayload | MlsDevItemPayload | MlsDevInteractionPayload;
|
|
89
|
+
export type MlsDevInteractionPayloadKind = MlsDevInteractionPayload['kind'];
|
|
90
|
+
export declare const MLS_DEV_INTERACTION_PAYLOAD_KINDS: readonly ["interaction.request", "interaction.response", "interaction.withdraw"];
|
|
91
|
+
/** The server's metadata-only record (§2.4): no title, options, decision, scope or answer. */
|
|
92
|
+
export interface MlsDevInteractionRecord {
|
|
93
|
+
readonly version: 1;
|
|
94
|
+
readonly conversationId: string;
|
|
95
|
+
readonly agentId: string;
|
|
96
|
+
readonly requesterDeviceId: string;
|
|
97
|
+
readonly requestId: string;
|
|
98
|
+
readonly kind: MlsDevInteractionKind;
|
|
99
|
+
readonly responderIds: readonly [string];
|
|
100
|
+
readonly expiresAtMs: number;
|
|
101
|
+
readonly status: 'pending' | 'answered' | 'withdrawn';
|
|
102
|
+
readonly binding: {
|
|
103
|
+
readonly groupId: string;
|
|
104
|
+
readonly head: MlsDevGroupHead;
|
|
105
|
+
readonly membershipRevision: number;
|
|
106
|
+
readonly requestMessageId: string;
|
|
107
|
+
readonly requestOrdinal: number;
|
|
108
|
+
};
|
|
109
|
+
readonly answer?: {
|
|
110
|
+
readonly responderId: string;
|
|
111
|
+
readonly responderDeviceId: string;
|
|
112
|
+
readonly messageId: string;
|
|
113
|
+
readonly ordinal: number;
|
|
114
|
+
readonly acceptedAtMs: number;
|
|
115
|
+
};
|
|
116
|
+
readonly withdrawal?: {
|
|
117
|
+
readonly messageId: string;
|
|
118
|
+
readonly ordinal: number;
|
|
119
|
+
readonly acceptedAtMs: number;
|
|
120
|
+
};
|
|
121
|
+
readonly createdAtMs: number;
|
|
122
|
+
}
|
|
123
|
+
export interface MlsDevInteractionsQuery {
|
|
124
|
+
readonly version: 1;
|
|
125
|
+
readonly conversationId?: string;
|
|
126
|
+
}
|
|
127
|
+
/** The caller's answerable pending requests, for badges and web's content-free waiting notice. */
|
|
128
|
+
export interface MlsDevInteractionsResult {
|
|
129
|
+
readonly version: 1;
|
|
130
|
+
readonly interactions: readonly {
|
|
131
|
+
readonly conversationId: string;
|
|
132
|
+
readonly agentId: string;
|
|
133
|
+
readonly requestId: string;
|
|
134
|
+
readonly kind: MlsDevInteractionKind;
|
|
135
|
+
readonly expiresAtMs: number;
|
|
136
|
+
}[];
|
|
137
|
+
}
|
|
138
|
+
export declare const MLS_DEV_INTERACTIONS_QUERY_MAX = 50;
|
|
139
|
+
export declare class MlsDevInteractionValidationError extends Error {
|
|
140
|
+
readonly code = "INVALID_MLS_DEV_INTERACTION";
|
|
141
|
+
constructor();
|
|
142
|
+
}
|
|
143
|
+
export declare function parseMlsDevInteractionRequestBody(value: unknown): MlsDevInteractionRequestBody;
|
|
144
|
+
export declare function parseMlsDevInteractionAnswer(value: unknown): MlsDevInteractionAnswer;
|
|
145
|
+
export declare function parseMlsDevInteractionResponseBody(value: unknown): MlsDevInteractionResponseBody;
|
|
146
|
+
export declare function parseMlsDevInteractionWithdrawBody(value: unknown): MlsDevInteractionWithdrawBody;
|
|
147
|
+
/** The closed v2 plaintext union. A v1 room accepts only `kind: 'text'` (`parseMlsDevTextPayload`). */
|
|
148
|
+
export declare function parseMlsDevApplicationPayload(value: unknown): MlsDevApplicationPayload;
|
|
149
|
+
/** Receipt-time check (`applyApplication`): the encrypted payload repeats exactly what its public binding announced. */
|
|
150
|
+
export declare function assertMlsDevInteractionPayloadBinding(payload: MlsDevApplicationPayload, binding: MlsDevInteractionBinding | undefined): void;
|
|
151
|
+
/**
|
|
152
|
+
* Whether an answer has the shape its request allows. A session-scoped decision needs a request that offered a session
|
|
153
|
+
* rule (`allowSession`; a destructive action never does, §3); the runner also counts one only from the agent's owner.
|
|
154
|
+
*/
|
|
155
|
+
export declare function isMlsDevInteractionAnswerAllowed(request: MlsDevInteractionRequestBody, answer: MlsDevInteractionAnswer): boolean;
|
|
156
|
+
export declare function parseMlsDevInteractionRecord(value: unknown): MlsDevInteractionRecord;
|
|
157
|
+
export declare function parseMlsDevInteractionsQuery(value: unknown): MlsDevInteractionsQuery;
|
|
158
|
+
export declare function parseMlsDevInteractionsResult(value: unknown): MlsDevInteractionsResult;
|
|
159
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Each environment's MLS identity: the values signed into its credentials, group controls and application AAD. A
|
|
3
|
+
* production device, credential or group can never verify as Dev (or the reverse) because these differ. Dev's values
|
|
4
|
+
* are today's literals, so Dev bytes are unchanged. A declared profile only defines the wire; whether an environment
|
|
5
|
+
* runs MLS is decided by its deployment (Functions gates, configuration, native builds), never here.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MLS_ENVIRONMENT_PROFILES: Readonly<{
|
|
8
|
+
readonly 'canon-dev-v1': Readonly<{
|
|
9
|
+
issuer: "canon-mls-dev-v1";
|
|
10
|
+
credentialType: "canon-mls-dev-credential+jws";
|
|
11
|
+
issuerKeyPath: "projects/canonmail-dev/locations/europe-west1/keyRings/canon-mls/cryptoKeys/device-issuer";
|
|
12
|
+
receiptKeyPath: "projects/canonmail-dev/locations/europe-west1/keyRings/canon-mls/cryptoKeys/feed-receipt";
|
|
13
|
+
}>;
|
|
14
|
+
readonly 'canon-prod-v1': Readonly<{
|
|
15
|
+
issuer: "canon-mls-prod-v1";
|
|
16
|
+
credentialType: "canon-mls-prod-credential+jws";
|
|
17
|
+
issuerKeyPath: "projects/canonmail-prod/locations/europe-west1/keyRings/canon-mls/cryptoKeys/device-issuer";
|
|
18
|
+
receiptKeyPath: "projects/canonmail-prod/locations/europe-west1/keyRings/canon-mls/cryptoKeys/feed-receipt";
|
|
19
|
+
}>;
|
|
20
|
+
}>;
|
|
21
|
+
export type MlsEnvironmentId = keyof typeof MLS_ENVIRONMENT_PROFILES;
|
|
22
|
+
export type MlsEnvironmentProfile = (typeof MLS_ENVIRONMENT_PROFILES)[MlsEnvironmentId];
|
|
23
|
+
export type MlsIssuerId = MlsEnvironmentProfile['issuer'];
|
|
24
|
+
/**
|
|
25
|
+
* Exact match only: no trimming or case folding, so an alias never reaches signed bytes. Throws the shared internal
|
|
26
|
+
* parser error, which each public boundary replaces with its own.
|
|
27
|
+
*/
|
|
28
|
+
export declare function requireMlsEnvironmentId(value: unknown): MlsEnvironmentId;
|
|
29
|
+
/** The same exact match as a predicate, for callers that refuse with their own error. */
|
|
30
|
+
export declare function isMlsEnvironmentId(value: unknown): value is MlsEnvironmentId;
|
|
31
|
+
export declare function mlsEnvironmentProfile(environmentId: MlsEnvironmentId): MlsEnvironmentProfile;
|
|
32
|
+
/** The environment whose issuer key a KMS key-version path names, or undefined for any other path. */
|
|
33
|
+
export declare function mlsEnvironmentOfIssuerKeyVersion(value: string): MlsEnvironmentId | undefined;
|
|
34
|
+
/** The environment whose feed-receipt key (mls-signed-acceptance.md) a KMS key-version path names, or undefined. */
|
|
35
|
+
export declare function mlsEnvironmentOfReceiptKeyVersion(value: string): MlsEnvironmentId | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type MlsEnvironmentId } from './mlsEnvironment.js';
|
|
2
|
+
export declare const MLS_PRINCIPAL_ALIAS_PREFIX = "mlsa_";
|
|
3
|
+
export interface MlsPrincipalOpening {
|
|
4
|
+
readonly type: 'human' | 'ai_agent';
|
|
5
|
+
readonly accountId: string;
|
|
6
|
+
/** 32 random bytes, canonical base64url. */
|
|
7
|
+
readonly salt: string;
|
|
8
|
+
}
|
|
9
|
+
/** An alias's shape; whether it opens to an account needs its opening. Account IDs never have it. */
|
|
10
|
+
export declare function isMlsPrincipalAlias(value: unknown): value is string;
|
|
11
|
+
/** An account ID (a Firebase uid, an agent's document ID): an MLS principal ID that is also exactly one document ID, so
|
|
12
|
+
* never containing `/` and never `.` or `..`. */
|
|
13
|
+
export declare function isMlsAccountId(value: unknown): value is string;
|
|
14
|
+
export declare function parseMlsPrincipalOpening(value: unknown): MlsPrincipalOpening;
|
|
15
|
+
/**
|
|
16
|
+
* SHA-256 over the domain above, LP environment, u8 type (human 0/agent 1), LP account ID and the raw 32-byte salt,
|
|
17
|
+
* where LP is a u32 big-endian byte length followed by UTF-8, as in the enrollment proof.
|
|
18
|
+
*/
|
|
19
|
+
export declare function encodeMlsPrincipalAliasInput(environmentId: MlsEnvironmentId, opening: MlsPrincipalOpening): Uint8Array;
|
|
20
|
+
export declare function mlsPrincipalAlias(environmentId: MlsEnvironmentId, opening: MlsPrincipalOpening): Promise<string>;
|
|
21
|
+
/** Whether `opening` opens `alias` in this environment. A malformed opening opens nothing. */
|
|
22
|
+
export declare function opensMlsPrincipalAlias(environmentId: MlsEnvironmentId, alias: string, opening: unknown): Promise<boolean>;
|
|
23
|
+
/** A fresh opening for an account: Canon's server makes one the first time the account needs an alias. */
|
|
24
|
+
export declare function createMlsPrincipalOpening(type: MlsPrincipalOpening['type'], id: string): MlsPrincipalOpening;
|
|
25
|
+
/** A room's openings, `{[alias]: opening}`: the shape only. Readers still check each opening against its alias. */
|
|
26
|
+
export declare function parseMlsRoomIdentities(value: unknown): Readonly<Record<string, MlsPrincipalOpening>>;
|
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
* Canonical `canon.card.v1` action-field type vocabulary. The runtime array is
|
|
3
3
|
* the single source of truth and the type is derived from it, so a value and a
|
|
4
4
|
* type cannot drift.
|
|
5
|
-
*
|
|
6
|
-
* ORDER IS LOAD-BEARING: scripts/generate-skill-bundles.mjs renders this list
|
|
7
|
-
* verbatim (via @canonmsg/rich-cards) into two committed SKILL.md files, and
|
|
8
|
-
* `npm run check:skill-bundles` fails on a byte change.
|
|
9
5
|
*/
|
|
10
6
|
export declare const RUNTIME_CARD_FIELD_TYPES: readonly ["text", "textarea", "select", "multiSelect", "boolean", "date", "number", "currency", "searchSelect", "lineItems"];
|
|
11
7
|
export type RuntimeCardFieldType = (typeof RUNTIME_CARD_FIELD_TYPES)[number];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The media types Canon accepts for an upload, resolved the same way on a device and on the server. */
|
|
2
|
+
export type AllowedUploadKind = 'image' | 'audio' | 'video' | 'file';
|
|
3
|
+
export declare const SAFE_IMAGE_MIME_TYPES: Set<string>;
|
|
4
|
+
export declare const SAFE_AUDIO_MIME_TYPES: Set<string>;
|
|
5
|
+
export declare const SAFE_VIDEO_MIME_TYPES: Set<string>;
|
|
6
|
+
export declare const SAFE_FILE_MIME_TYPES: Set<string>;
|
|
7
|
+
export declare function normalizeMimeType(value: unknown): string | null;
|
|
8
|
+
export declare function classifyAllowedUploadMimeType(value: unknown): AllowedUploadKind | null;
|
|
9
|
+
export declare function normalizeAllowedUploadMimeType(value: unknown): string | null;
|
|
10
|
+
export declare function resolveAllowedUploadMimeType(input: {
|
|
11
|
+
mimeType?: unknown;
|
|
12
|
+
fileName?: unknown;
|
|
13
|
+
}): string | null;
|
|
14
|
+
export declare function getAllowedUploadExtension(input: {
|
|
15
|
+
mimeType: string;
|
|
16
|
+
fileName?: unknown;
|
|
17
|
+
}): string;
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* (v1 scope: messaging, HITL interactions, contact sharing, and the read
|
|
5
5
|
* verbs bindings need alongside them).
|
|
6
6
|
*
|
|
7
|
-
* One verb = one intent-level action. Each runtime binding (
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* One verb = one intent-level action. Each runtime binding (MCP server, codex
|
|
8
|
+
* dynamicTools, agent-sdk method, CLI) projects these verbs into its native
|
|
9
|
+
* tool surface; the names, argument shapes, limits, and result vocabularies
|
|
10
|
+
* defined here are the single source of truth. JSON
|
|
11
11
|
* Schemas for each verb live in `verbSchemas.ts` and are also emitted as a
|
|
12
12
|
* plain JSON artifact at build time (`dist/canon-verbs.schema.json`) so
|
|
13
|
-
* non-TypeScript consumers (
|
|
14
|
-
*
|
|
13
|
+
* non-TypeScript consumers (external integrators) can consume the identical
|
|
14
|
+
* contract.
|
|
15
15
|
*
|
|
16
16
|
* Deliberately NOT verbs: replying in the active conversation, streaming
|
|
17
17
|
* partials, typing, and read receipts stay host-mediated — the model talks
|
|
@@ -51,8 +51,7 @@ export declare const CANON_VERB_NAMESPACE = "canon";
|
|
|
51
51
|
/**
|
|
52
52
|
* $id of the canonical canon.card.v1 document schema
|
|
53
53
|
* (@canonmsg/rich-cards RUNTIME_CARD_JSON_SCHEMA_V1). The verbs bundle only
|
|
54
|
-
* validates the card ENVELOPE
|
|
55
|
-
* verbs via `getVerbInputSchema(verb, { cardSchema })`.
|
|
54
|
+
* validates the card ENVELOPE.
|
|
56
55
|
*/
|
|
57
56
|
export declare const CANON_CARD_SCHEMA_ID = "https://canonmsg.com/schemas/canon.card.v1.json";
|
|
58
57
|
/**
|
|
@@ -100,9 +99,7 @@ export declare const VERB_LIMITS: {
|
|
|
100
99
|
readonly externalSourceLabelChars: 80;
|
|
101
100
|
/**
|
|
102
101
|
* Contact-request note. Values longer than this are truncated by senders
|
|
103
|
-
* (slice(0,497)+'...')
|
|
104
|
-
* functions/src/api/sendContextualMessage.ts, packages/core/src/reach-out.ts
|
|
105
|
-
* and the hermes plugin; this constant is the canonical figure.
|
|
102
|
+
* (slice(0,497)+'...'); this constant is the canonical figure.
|
|
106
103
|
*/
|
|
107
104
|
readonly contactRequestNoteChars: 500;
|
|
108
105
|
/** Group membership cap incl. creator (functions/src/utils/conversations.ts MAX_GROUP_MEMBERS). */
|
|
@@ -308,14 +305,23 @@ export type SendToResult = {
|
|
|
308
305
|
created?: boolean;
|
|
309
306
|
reused?: boolean;
|
|
310
307
|
sessionSelection?: string;
|
|
308
|
+
}
|
|
309
|
+
/** The room is encrypted, so Canon stored no opening text: the sender sends it encrypted under `messageId`. */
|
|
310
|
+
| {
|
|
311
|
+
status: 'opened';
|
|
312
|
+
conversationId: string;
|
|
313
|
+
messageId: string;
|
|
314
|
+
openingText: 'deferred';
|
|
315
|
+
created?: boolean;
|
|
316
|
+
reused?: boolean;
|
|
311
317
|
} | {
|
|
312
|
-
status: 'requested';
|
|
313
|
-
requestId: string | null;
|
|
314
|
-
deferredIntentId?: string | null;
|
|
315
|
-
} | {
|
|
316
|
-
status: 'pending';
|
|
318
|
+
status: 'requested' | 'pending';
|
|
317
319
|
requestId: string | null;
|
|
318
320
|
deferredIntentId?: string | null;
|
|
321
|
+
/** An encrypted room stores no opener: the sender sends it into `conversationId` under `messageId`. */
|
|
322
|
+
conversationId?: string;
|
|
323
|
+
messageId?: string;
|
|
324
|
+
openingText?: 'deferred';
|
|
319
325
|
} | {
|
|
320
326
|
status: 'setup_required';
|
|
321
327
|
reason: string;
|
|
@@ -752,9 +758,7 @@ export declare const CANON_VERB_LIMITS_ARTIFACT: {
|
|
|
752
758
|
readonly externalSourceLabelChars: 80;
|
|
753
759
|
/**
|
|
754
760
|
* Contact-request note. Values longer than this are truncated by senders
|
|
755
|
-
* (slice(0,497)+'...')
|
|
756
|
-
* functions/src/api/sendContextualMessage.ts, packages/core/src/reach-out.ts
|
|
757
|
-
* and the hermes plugin; this constant is the canonical figure.
|
|
761
|
+
* (slice(0,497)+'...'); this constant is the canonical figure.
|
|
758
762
|
*/
|
|
759
763
|
readonly contactRequestNoteChars: 500;
|
|
760
764
|
/** Group membership cap incl. creator (functions/src/utils/conversations.ts MAX_GROUP_MEMBERS). */
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
* `<verb>_result` definition per verb under `$defs` plus shared shapes. The
|
|
6
6
|
* document is emitted verbatim to `dist/canon-verbs.schema.json` at build
|
|
7
7
|
* time (see scripts/emit-verb-schemas.mjs) so non-TypeScript bindings can
|
|
8
|
-
* consume the byte-identical contract instead of hand-porting it (
|
|
9
|
-
*
|
|
10
|
-
* generated CLIs read it from the npm package).
|
|
8
|
+
* consume the byte-identical contract instead of hand-porting it (external
|
|
9
|
+
* integrators and generated CLIs read it from the npm package).
|
|
11
10
|
*
|
|
12
11
|
* Conventions:
|
|
13
12
|
* - Verb INPUT schemas are strict (`additionalProperties: false`) — a binding
|
|
@@ -686,7 +685,7 @@ export declare const CANON_VERBS_JSON_SCHEMA: {
|
|
|
686
685
|
}];
|
|
687
686
|
};
|
|
688
687
|
readonly send_to_result: {
|
|
689
|
-
readonly description:
|
|
688
|
+
readonly description: "Canonical outcome vocabulary.";
|
|
690
689
|
readonly oneOf: readonly [{
|
|
691
690
|
readonly type: "object";
|
|
692
691
|
readonly required: readonly ["status", "conversationId"];
|
|
@@ -714,6 +713,31 @@ export declare const CANON_VERBS_JSON_SCHEMA: {
|
|
|
714
713
|
readonly type: "string";
|
|
715
714
|
};
|
|
716
715
|
};
|
|
716
|
+
}, {
|
|
717
|
+
readonly type: "object";
|
|
718
|
+
readonly required: readonly ["status", "conversationId", "messageId", "openingText"];
|
|
719
|
+
readonly additionalProperties: true;
|
|
720
|
+
readonly description: "The room is encrypted, so Canon stored no opening text: the sender sends it encrypted under messageId.";
|
|
721
|
+
readonly properties: {
|
|
722
|
+
readonly status: {
|
|
723
|
+
readonly const: "opened";
|
|
724
|
+
};
|
|
725
|
+
readonly conversationId: {
|
|
726
|
+
readonly type: "string";
|
|
727
|
+
};
|
|
728
|
+
readonly messageId: {
|
|
729
|
+
readonly type: "string";
|
|
730
|
+
};
|
|
731
|
+
readonly openingText: {
|
|
732
|
+
readonly const: "deferred";
|
|
733
|
+
};
|
|
734
|
+
readonly created: {
|
|
735
|
+
readonly type: "boolean";
|
|
736
|
+
};
|
|
737
|
+
readonly reused: {
|
|
738
|
+
readonly type: "boolean";
|
|
739
|
+
};
|
|
740
|
+
};
|
|
717
741
|
}, {
|
|
718
742
|
readonly type: "object";
|
|
719
743
|
readonly required: readonly ["status", "requestId"];
|
|
@@ -729,6 +753,16 @@ export declare const CANON_VERBS_JSON_SCHEMA: {
|
|
|
729
753
|
readonly type: readonly ["string", "null"];
|
|
730
754
|
readonly description: "Present when the send is deferred until the contact request resolves.";
|
|
731
755
|
};
|
|
756
|
+
readonly conversationId: {
|
|
757
|
+
readonly type: "string";
|
|
758
|
+
};
|
|
759
|
+
readonly messageId: {
|
|
760
|
+
readonly type: "string";
|
|
761
|
+
};
|
|
762
|
+
readonly openingText: {
|
|
763
|
+
readonly const: "deferred";
|
|
764
|
+
readonly description: "The room is encrypted, so Canon stored no opening text: the sender sends it encrypted under messageId.";
|
|
765
|
+
};
|
|
732
766
|
};
|
|
733
767
|
}, {
|
|
734
768
|
readonly type: "object";
|
|
@@ -1678,30 +1712,5 @@ export interface CanonVerbSchemaRefs {
|
|
|
1678
1712
|
export declare const CANON_VERB_SCHEMA_REFS: Record<CanonVerbName, CanonVerbSchemaRefs>;
|
|
1679
1713
|
/** A verb subschema extracted from the bundle, self-contained for embedding. */
|
|
1680
1714
|
export type CanonVerbJsonSchema = Record<string, unknown>;
|
|
1681
|
-
export interface GetVerbSchemaOptions {
|
|
1682
|
-
/**
|
|
1683
|
-
* The full canon.card.v1 document schema (@canonmsg/rich-cards
|
|
1684
|
-
* RUNTIME_CARD_JSON_SCHEMA_V1) to compose into card-carrying verbs. When
|
|
1685
|
-
* provided, the envelope-only `runtimeCard` definition is replaced so block
|
|
1686
|
-
* structures validate too. backend-contracts deliberately does not depend
|
|
1687
|
-
* on rich-cards (build-order/dependency direction), so the binding supplies
|
|
1688
|
-
* the schema.
|
|
1689
|
-
*
|
|
1690
|
-
* The card schema is REBASED, not nested: its own `$defs` are merged into
|
|
1691
|
-
* the verb schema's `$defs` under `card__`-prefixed names and every
|
|
1692
|
-
* internal `#/$defs/...` ref (including `<card $id>#/$defs/...` forms) is
|
|
1693
|
-
* rewritten accordingly. The result is a single self-contained schema
|
|
1694
|
-
* resource with plain internal refs — no embedded `$id` — so it compiles
|
|
1695
|
-
* on naive validators and never conflicts with a separately registered
|
|
1696
|
-
* canon.card.v1 resource on the same Ajv instance.
|
|
1697
|
-
*
|
|
1698
|
-
* Ajv note: the real card schema uses spec-valid union types
|
|
1699
|
-
* (min/max: number | date-string), so compile composed schemas with
|
|
1700
|
-
* `{ strict: true, allowUnionTypes: true }`.
|
|
1701
|
-
*/
|
|
1702
|
-
cardSchema?: Record<string, unknown>;
|
|
1703
|
-
}
|
|
1704
|
-
/** Self-contained input schema for a verb (for embedding into tool definitions). */
|
|
1705
|
-
export declare function getVerbInputSchema(verb: CanonVerbName, options?: GetVerbSchemaOptions): CanonVerbJsonSchema;
|
|
1706
1715
|
/** Self-contained result schema for a verb. */
|
|
1707
1716
|
export declare function getVerbResultSchema(verb: CanonVerbName): CanonVerbJsonSchema;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared agent profile management — loading, locking, and resolution.
|
|
3
|
-
* Used by both host.ts and server.ts.
|
|
4
3
|
*/
|
|
5
4
|
import type { CanonEnvironmentId } from '../backend-contracts/index.js';
|
|
6
5
|
import type { AgentClientType } from './types.js';
|
|
7
|
-
import { type CanonRuntimeConnectionOptions } from './runtime-endpoints.js';
|
|
8
6
|
export interface AgentProfileInput {
|
|
9
7
|
apiKey: string;
|
|
10
8
|
agentId: string;
|
|
@@ -64,6 +62,4 @@ export interface PendingRegistration {
|
|
|
64
62
|
}
|
|
65
63
|
export declare function loadPendingRegistrations(): Record<string, PendingRegistration>;
|
|
66
64
|
export declare function savePendingRegistrations(pending: Record<string, PendingRegistration>): void;
|
|
67
|
-
export declare function getOrCreatePendingRegistration(profile: string, clientType?: AgentClientType, connectionOptions?: CanonRuntimeConnectionOptions): PendingRegistration;
|
|
68
|
-
export declare function updatePendingRegistration(profile: string, patch: Partial<Pick<PendingRegistration, 'requestId' | 'pollToken' | 'clientType'>>): PendingRegistration;
|
|
69
65
|
export declare function clearPendingRegistration(profile: string): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApprovalRequestCategory, ApprovalRequestDetail, ApprovalRequestMetadata, ApprovalNativeRequestMetadata, ApprovalRisk
|
|
1
|
+
import type { ApprovalRequestCategory, ApprovalRequestDetail, ApprovalRequestMetadata, ApprovalNativeRequestMetadata, ApprovalRisk } from './approval-types.js';
|
|
2
2
|
import type { CanonUnifiedDiff } from './types.js';
|
|
3
3
|
export declare function generateApprovalId(): string;
|
|
4
4
|
export declare function redactSecrets(text: string, patterns: string[]): string;
|
|
@@ -19,8 +19,4 @@ export declare function buildApprovalRequest(approvalId: string, toolName: strin
|
|
|
19
19
|
text: string;
|
|
20
20
|
metadata: ApprovalRequestMetadata;
|
|
21
21
|
};
|
|
22
|
-
export declare function buildApprovalReply(approvalId: string, decision: 'allow' | 'deny', sessionRule?: SessionRule): {
|
|
23
|
-
text: string;
|
|
24
|
-
metadata: ApprovalReplyMetadata;
|
|
25
|
-
};
|
|
26
22
|
export declare function buildApprovalOutcome(approvalId: string, toolName: string, toolSummary: string, decision: 'allow' | 'deny', reason: 'replied' | 'timeout' | 'session-rule'): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { VerbNativeMetadata } from '../backend-contracts/index.js';
|
|
2
2
|
import type { CanonUnifiedDiff } from './types.js';
|
|
3
3
|
export interface ApprovalRequestMetadata {
|
|
4
4
|
type: 'approval_request';
|
|
@@ -71,4 +71,3 @@ export interface ApprovalConfig {
|
|
|
71
71
|
export declare const DEFAULT_APPROVAL_CONFIG: ApprovalConfig;
|
|
72
72
|
export declare function parseSessionRule(value: unknown): SessionRule | null;
|
|
73
73
|
export declare function parseApprovalReplyMetadata(value: unknown): ApprovalReplyMetadata | null;
|
|
74
|
-
export declare function parseApprovalRequestMetadata(value: unknown): ApprovalRequestMetadata | null;
|