@canonmsg/agent-sdk 11.2.1 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +248 -523
- package/dist/chunks/chunk-7N6OPPW4.js +5430 -0
- package/dist/chunks/chunk-N722GWCP.js +4897 -0
- package/dist/chunks/chunk-QZ4PPRQW.js +14247 -0
- package/dist/chunks/mls-crypto-LMNQZOS6.js +10 -0
- package/dist/cli.js +572 -0
- package/dist/drivers/claude.d.ts +42 -0
- package/dist/drivers/code.d.ts +18 -0
- package/dist/drivers/codex.d.ts +46 -0
- package/dist/drivers/connector.d.ts +34 -0
- package/dist/index.d.ts +20 -25
- package/dist/index.js +91 -13
- package/dist/internal/backend-contracts/agentBehaviorPolicy.d.ts +122 -0
- package/dist/internal/backend-contracts/agentDirectory.d.ts +32 -0
- package/dist/internal/backend-contracts/agentOrigin.d.ts +23 -0
- package/dist/internal/backend-contracts/agentSearch.d.ts +17 -0
- package/dist/internal/backend-contracts/api-origins.generated.d.ts +4 -0
- package/dist/internal/backend-contracts/apiErrors.d.ts +1 -0
- package/dist/internal/backend-contracts/artifactActions.d.ts +8 -0
- package/dist/internal/backend-contracts/artifacts.d.ts +386 -0
- package/dist/internal/backend-contracts/clientFloor.d.ts +41 -0
- package/dist/internal/backend-contracts/communication.d.ts +146 -0
- package/dist/internal/backend-contracts/connectorRelay.d.ts +179 -0
- package/dist/internal/backend-contracts/conversationMembership.d.ts +28 -0
- package/dist/internal/backend-contracts/deliveryObservation.d.ts +23 -0
- package/dist/internal/backend-contracts/diffRedaction.d.ts +6 -0
- package/dist/internal/backend-contracts/endpoint-unread.d.ts +4 -0
- package/dist/internal/backend-contracts/endpoint.d.ts +120 -0
- package/dist/internal/backend-contracts/endpointContentPolicy.d.ts +48 -0
- package/dist/internal/backend-contracts/environment.d.ts +20 -0
- package/dist/internal/backend-contracts/externalInbound.d.ts +24 -0
- package/dist/internal/backend-contracts/firestoreValues.d.ts +9 -0
- package/dist/internal/backend-contracts/index.d.ts +54 -0
- package/dist/internal/backend-contracts/media-url.d.ts +20 -0
- package/dist/internal/backend-contracts/media.d.ts +51 -0
- package/dist/internal/backend-contracts/mediaDelivery.d.ts +46 -0
- package/dist/internal/backend-contracts/mediaTransferProtocol.d.ts +17 -0
- package/dist/internal/backend-contracts/membershipChange.d.ts +21 -0
- package/dist/internal/backend-contracts/message.d.ts +86 -0
- package/dist/internal/backend-contracts/messageText.d.ts +6 -0
- package/dist/internal/backend-contracts/mlsDevApplication.d.ts +161 -0
- package/dist/internal/backend-contracts/mlsDevCredential.d.ts +78 -0
- package/dist/internal/backend-contracts/mlsDevCredentialReconciliation.d.ts +45 -0
- package/dist/internal/backend-contracts/mlsDevDeviceCustody.d.ts +52 -0
- package/dist/internal/backend-contracts/mlsDevEnrollment.d.ts +75 -0
- package/dist/internal/backend-contracts/mlsDevFeedReceipt.d.ts +43 -0
- package/dist/internal/backend-contracts/mlsDevGroup.d.ts +321 -0
- package/dist/internal/backend-contracts/mlsDevGroupFeed.d.ts +51 -0
- package/dist/internal/backend-contracts/mlsDevInteraction.d.ts +159 -0
- package/dist/internal/backend-contracts/mlsDevKeyPackage.d.ts +42 -0
- package/dist/internal/backend-contracts/mlsDevKeyPackages.d.ts +55 -0
- package/dist/internal/backend-contracts/mlsEnvironment.d.ts +35 -0
- package/dist/internal/backend-contracts/mlsPrincipalAlias.d.ts +23 -0
- package/dist/internal/backend-contracts/moderation.d.ts +7 -0
- package/dist/internal/backend-contracts/plaintextProcessors.d.ts +63 -0
- package/dist/internal/backend-contracts/preparedContent.d.ts +54 -0
- package/dist/internal/backend-contracts/replyAuthority.d.ts +14 -0
- package/dist/internal/backend-contracts/runtimeCardFields.d.ts +66 -0
- package/dist/internal/backend-contracts/runtimeCardStorage.d.ts +3 -0
- package/dist/internal/backend-contracts/runtimeDescriptor.d.ts +88 -0
- package/dist/internal/backend-contracts/selfContext.d.ts +9 -0
- package/dist/internal/backend-contracts/turnProtocol.d.ts +43 -0
- package/dist/internal/backend-contracts/upload-mime-types.d.ts +17 -0
- package/dist/internal/backend-contracts/verbContract.d.ts +856 -0
- package/dist/internal/backend-contracts/verbSchemas.d.ts +1717 -0
- package/dist/internal/backend-contracts/verbWire.d.ts +493 -0
- package/dist/internal/backend-contracts/webAuth.d.ts +8 -0
- package/dist/internal/core/agent-profiles.d.ts +65 -0
- package/dist/internal/core/approval-format.d.ts +22 -0
- package/dist/internal/core/approval-manager.d.ts +43 -0
- package/dist/internal/core/approval-types.d.ts +73 -0
- package/dist/internal/core/base-url.d.ts +1 -0
- package/dist/internal/core/cli-metadata.d.ts +13 -0
- package/dist/internal/core/client.d.ts +432 -0
- package/dist/internal/core/completed-output-journal.d.ts +39 -0
- package/dist/internal/core/constants.d.ts +1 -0
- package/dist/internal/core/endpoint-client.d.ts +56 -0
- package/dist/internal/core/execution-environment-mode.d.ts +6 -0
- package/dist/internal/core/gifs.d.ts +29 -0
- package/dist/internal/core/host-runtime.d.ts +53 -0
- package/dist/internal/core/index.d.ts +68 -0
- package/dist/internal/core/node-media.d.ts +6 -0
- package/dist/internal/core/policy.d.ts +2 -0
- package/dist/internal/core/registration-profile.d.ts +10 -0
- package/dist/internal/core/registration-session.d.ts +55 -0
- package/dist/internal/core/registration.d.ts +5 -0
- package/dist/internal/core/retry.d.ts +113 -0
- package/dist/internal/core/rtdb-rest.d.ts +141 -0
- package/dist/internal/core/runtime-cards.d.ts +286 -0
- package/dist/internal/core/runtime-descriptor.d.ts +16 -0
- package/dist/internal/core/runtime-endpoints.d.ts +26 -0
- package/dist/internal/core/runtime-heartbeat.d.ts +29 -0
- package/dist/internal/core/runtime-presentation.d.ts +9 -0
- package/dist/internal/core/runtime-request-manager.d.ts +283 -0
- package/dist/internal/core/runtime-state-publisher.d.ts +42 -0
- package/dist/internal/core/self-context.d.ts +22 -0
- package/dist/internal/core/silent-turn.d.ts +49 -0
- package/dist/internal/core/stream.d.ts +78 -0
- package/dist/internal/core/turn-protocol.d.ts +28 -0
- package/dist/internal/core/turn-verbosity.d.ts +85 -0
- package/dist/internal/core/types.d.ts +964 -0
- package/dist/internal/core/unified-diff.d.ts +35 -0
- package/dist/internal/endpoint/artifact-images.d.ts +60 -0
- package/dist/internal/endpoint/artifact-reducer.d.ts +35 -0
- package/dist/internal/endpoint/artifact-views.d.ts +113 -0
- package/dist/internal/endpoint/artifacts.d.ts +75 -0
- package/dist/internal/endpoint/delivery.d.ts +47 -0
- package/dist/internal/endpoint/engine.d.ts +249 -0
- package/dist/internal/endpoint/ephemeral.d.ts +8 -0
- package/dist/internal/endpoint/events.d.ts +32 -0
- package/dist/internal/endpoint/external-inbound.d.ts +36 -0
- package/dist/internal/endpoint/handoff.d.ts +50 -0
- package/dist/internal/endpoint/history.d.ts +22 -0
- package/dist/internal/endpoint/image-generation-errors.d.ts +2 -0
- package/dist/internal/endpoint/inbound.d.ts +29 -0
- package/dist/internal/endpoint/index.d.ts +32 -0
- package/dist/internal/endpoint/media.d.ts +177 -0
- package/dist/internal/endpoint/migration.d.ts +50 -0
- package/dist/internal/endpoint/mls-crypto.d.ts +32 -0
- package/dist/internal/endpoint/mls-dev-client.d.ts +52 -0
- package/dist/internal/endpoint/mls-dev-device.d.ts +69 -0
- package/dist/internal/endpoint/mls-dev-groups.d.ts +174 -0
- package/dist/internal/endpoint/mls-dev-interactions.d.ts +99 -0
- package/dist/internal/endpoint/mls-dev-key-package-service.d.ts +46 -0
- package/dist/internal/endpoint/mls-dev-key-packages.d.ts +62 -0
- package/dist/internal/endpoint/mls-dev-text.d.ts +67 -0
- package/dist/internal/endpoint/mls-dev-transport.d.ts +38 -0
- package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +29 -0
- package/dist/internal/endpoint/node-mls-custody.d.ts +15 -0
- package/dist/internal/endpoint/node.d.ts +7 -0
- package/dist/internal/endpoint/observe-query.d.ts +17 -0
- package/dist/internal/endpoint/portable-node-mls-custody.d.ts +23 -0
- package/dist/internal/endpoint/queue.d.ts +22 -0
- package/dist/internal/endpoint/recovery.d.ts +27 -0
- package/dist/internal/endpoint/retention.d.ts +7 -0
- package/dist/internal/endpoint/store.d.ts +22 -0
- package/dist/internal/endpoint/sync.d.ts +33 -0
- package/dist/internal/endpoint/transient-publisher.d.ts +8 -0
- package/dist/internal/endpoint/transport.d.ts +63 -0
- package/dist/media.d.ts +1 -1
- package/dist/media.js +42 -541
- package/dist/runner/errands.d.ts +118 -0
- package/dist/runner/mls.d.ts +97 -0
- package/dist/runner/relay.d.ts +87 -0
- package/dist/runner/runner.d.ts +98 -0
- package/dist/runner/types.d.ts +215 -0
- package/package.json +18 -5
- package/dist/attached-session.d.ts +0 -58
- package/dist/attached-session.js +0 -638
- package/dist/bounded-file-read.d.ts +0 -14
- package/dist/bounded-file-read.js +0 -34
- package/dist/canon-agent.d.ts +0 -236
- package/dist/canon-agent.js +0 -2531
- package/dist/debouncer.d.ts +0 -18
- package/dist/debouncer.js +0 -133
- package/dist/inbound-handoff.d.ts +0 -6
- package/dist/inbound-handoff.js +0 -17
- package/dist/managed-session-host.d.ts +0 -27
- package/dist/managed-session-host.js +0 -195
- package/dist/managed-session-setup.d.ts +0 -99
- package/dist/managed-session-setup.js +0 -234
- package/dist/realtime.d.ts +0 -62
- package/dist/realtime.js +0 -193
- package/dist/runtime-card.d.ts +0 -48
- package/dist/runtime-card.js +0 -64
- package/dist/session-manager.d.ts +0 -77
- package/dist/session-manager.js +0 -285
- package/dist/turn-streaming-request.d.ts +0 -17
- package/dist/turn-streaming-request.js +0 -22
- package/dist/turn-verbosity-option.d.ts +0 -33
- package/dist/turn-verbosity-option.js +0 -23
- package/dist/types.d.ts +0 -387
- package/dist/types.js +0 -1
- package/dist/work-session-coordination.d.ts +0 -21
- package/dist/work-session-coordination.js +0 -53
- package/dist/work-session-host.d.ts +0 -31
- package/dist/work-session-host.js +0 -617
- package/dist/work-session-interactions.d.ts +0 -12
- package/dist/work-session-interactions.js +0 -173
- package/dist/work-session-state.d.ts +0 -36
- package/dist/work-session-state.js +0 -62
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
export declare function parseMlsPrincipalOpening(value: unknown): MlsPrincipalOpening;
|
|
12
|
+
/**
|
|
13
|
+
* SHA-256 over the domain above, LP environment, u8 type (human 0/agent 1), LP account ID and the raw 32-byte salt,
|
|
14
|
+
* where LP is a u32 big-endian byte length followed by UTF-8, as in the enrollment proof.
|
|
15
|
+
*/
|
|
16
|
+
export declare function encodeMlsPrincipalAliasInput(environmentId: MlsEnvironmentId, opening: MlsPrincipalOpening): Uint8Array;
|
|
17
|
+
export declare function mlsPrincipalAlias(environmentId: MlsEnvironmentId, opening: MlsPrincipalOpening): Promise<string>;
|
|
18
|
+
/** Whether `opening` opens `alias` in this environment. A malformed opening opens nothing. */
|
|
19
|
+
export declare function opensMlsPrincipalAlias(environmentId: MlsEnvironmentId, alias: string, opening: unknown): Promise<boolean>;
|
|
20
|
+
/** A fresh opening for an account: Canon's server makes one the first time the account needs an alias. */
|
|
21
|
+
export declare function createMlsPrincipalOpening(type: MlsPrincipalOpening['type'], id: string): MlsPrincipalOpening;
|
|
22
|
+
/** A room's openings, `{[alias]: opening}`: the shape only. Readers still check each opening against its alias. */
|
|
23
|
+
export declare function parseMlsRoomIdentities(value: unknown): Readonly<Record<string, MlsPrincipalOpening>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type ModerationStatus = 'active' | 'ejected';
|
|
2
|
+
/**
|
|
3
|
+
* The single definition of "this account is ejected", read off an
|
|
4
|
+
* already-fetched `moderationUsers/{id}` document. A missing document reads
|
|
5
|
+
* 'active'. Fetching is the caller's job — this package holds no Firestore handle.
|
|
6
|
+
*/
|
|
7
|
+
export declare function readModerationStatus(data: unknown): ModerationStatus;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Existing server content readers. Classification is not encryption: these
|
|
2
|
+
* processors intentionally inspect plaintext in the current JSON release.
|
|
3
|
+
* Their input boundary must be redesigned before enabling encrypted rooms. */
|
|
4
|
+
export declare const PLAINTEXT_PROCESSORS: {
|
|
5
|
+
readonly preview: {
|
|
6
|
+
readonly current: "Read message/display text to derive conversation and notification previews.";
|
|
7
|
+
readonly beforeMls: "Derive on authorized endpoints; clear/reconcile deleted-message previews there.";
|
|
8
|
+
};
|
|
9
|
+
readonly push: {
|
|
10
|
+
readonly current: "Send visible titles and message previews to FCM/APNs.";
|
|
11
|
+
readonly beforeMls: "Use generic wake notifications or endpoint-decrypted notification extensions.";
|
|
12
|
+
};
|
|
13
|
+
readonly topic: {
|
|
14
|
+
readonly current: "Derive the initial topic from message text.";
|
|
15
|
+
readonly beforeMls: "Derive on an authorized endpoint and publish as encrypted conversation content.";
|
|
16
|
+
};
|
|
17
|
+
readonly forward: {
|
|
18
|
+
readonly current: "Read source content and copy plaintext attachments into the target room.";
|
|
19
|
+
readonly beforeMls: "Decrypt and re-encrypt on an authorized endpoint; keep server target admission checks.";
|
|
20
|
+
};
|
|
21
|
+
readonly message_validation: {
|
|
22
|
+
readonly current: "Inspect text, attachment descriptors and rich content before storing messages.";
|
|
23
|
+
readonly beforeMls: "Validate decrypted content on endpoints; retain bounded ciphertext/envelope checks on the server.";
|
|
24
|
+
};
|
|
25
|
+
readonly interaction_validation: {
|
|
26
|
+
readonly current: "Validate card/input/approval/plan render contracts and submitted responses.";
|
|
27
|
+
readonly beforeMls: "Validate content on authorized requesting/responding endpoints; retain public admission and lifecycle checks.";
|
|
28
|
+
};
|
|
29
|
+
readonly image_generation: {
|
|
30
|
+
readonly current: "Send prompts/source image bytes to Vertex and persist generated output.";
|
|
31
|
+
readonly beforeMls: "Require explicit provider disclosure and an authorized endpoint/processing participant; no silent server decryption.";
|
|
32
|
+
};
|
|
33
|
+
readonly media_assembly: {
|
|
34
|
+
readonly current: "Decode prepared JSON and combine ordered accepted blob descriptors into canonical publication.";
|
|
35
|
+
readonly beforeMls: "Pass an immutable encrypted envelope without interpreting or rewriting it; private blob metadata stays inside the payload.";
|
|
36
|
+
};
|
|
37
|
+
readonly streaming: {
|
|
38
|
+
readonly current: "Validate and publish plaintext live text, chunks and provisional content.";
|
|
39
|
+
readonly beforeMls: "Encrypt and validate streaming content on authorized endpoints with explicit ordering and key-epoch boundaries.";
|
|
40
|
+
};
|
|
41
|
+
readonly video_processing: {
|
|
42
|
+
readonly current: "Download plaintext video, normalize it and create a poster.";
|
|
43
|
+
readonly beforeMls: "Process on an endpoint or an explicitly authorized processing participant before encrypted upload.";
|
|
44
|
+
};
|
|
45
|
+
readonly owner_observation: {
|
|
46
|
+
readonly current: "Allow authenticated owners to inspect managed agent conversations without room membership.";
|
|
47
|
+
readonly beforeMls: "Explicitly enroll authorized owner keyholders or retire content observation; ownership alone supplies no decryption keys.";
|
|
48
|
+
};
|
|
49
|
+
readonly moderation_evidence: {
|
|
50
|
+
readonly current: "Accept user-selected plaintext message evidence for moderation.";
|
|
51
|
+
readonly beforeMls: "Design explicit selective disclosure/authenticity (including franking policy); never infer access to room keys.";
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export type PlaintextProcessorName = keyof typeof PLAINTEXT_PROCESSORS;
|
|
55
|
+
export interface PlaintextProcessorInput<T> {
|
|
56
|
+
encoding: 'json';
|
|
57
|
+
value: T;
|
|
58
|
+
}
|
|
59
|
+
/** The callback is the actual content processor, not a telemetry hook. Keeping
|
|
60
|
+
* the codec explicit ensures an opaque body cannot accidentally be processed by
|
|
61
|
+
* the JSON path. This is not authorization; callers still enforce their domain
|
|
62
|
+
* policy and every enabled transport currently requires JSON. */
|
|
63
|
+
export declare function runPlaintextProcessor<T, R>(name: PlaintextProcessorName, input: PlaintextProcessorInput<T>, process: (value: T) => R): R;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type EndpointPreconditions } from './endpoint.js';
|
|
2
|
+
export declare const PREPARED_CONTENT_VERSION: 1;
|
|
3
|
+
export declare const PREPARED_JSON_CODEC: "canon.json.v1";
|
|
4
|
+
/** Reviewed public routing context. Authentication and installation/operation
|
|
5
|
+
* identity stay in the containing endpoint request, never in this payload. */
|
|
6
|
+
export interface PreparedContentContext {
|
|
7
|
+
readonly action: string;
|
|
8
|
+
readonly conversationId?: string;
|
|
9
|
+
readonly messageId?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface PreparedBlobDependency {
|
|
12
|
+
/** Logical identity survives replacement of a transport upload session. */
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly index: number;
|
|
15
|
+
}
|
|
16
|
+
export interface PreparedContentExpected {
|
|
17
|
+
readonly installationGeneration: number;
|
|
18
|
+
readonly protocolRevision: number;
|
|
19
|
+
readonly admission?: Readonly<EndpointPreconditions>;
|
|
20
|
+
}
|
|
21
|
+
export interface PreparedContent {
|
|
22
|
+
readonly version: typeof PREPARED_CONTENT_VERSION;
|
|
23
|
+
readonly context: PreparedContentContext;
|
|
24
|
+
readonly codec: typeof PREPARED_JSON_CODEC;
|
|
25
|
+
/** Exact immutable bytes represented as UTF-8 JSON; transport retries reuse it. */
|
|
26
|
+
readonly payload: string;
|
|
27
|
+
readonly blobs: readonly PreparedBlobDependency[];
|
|
28
|
+
readonly expected: PreparedContentExpected;
|
|
29
|
+
}
|
|
30
|
+
export interface PreparedJsonInput {
|
|
31
|
+
context: PreparedContentContext;
|
|
32
|
+
body: Record<string, unknown>;
|
|
33
|
+
envelope?: Record<string, unknown>;
|
|
34
|
+
blobs?: readonly PreparedBlobDependency[];
|
|
35
|
+
expected: PreparedContentExpected;
|
|
36
|
+
}
|
|
37
|
+
export interface DecodedPreparedJsonContent {
|
|
38
|
+
body: Record<string, unknown>;
|
|
39
|
+
envelope?: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
export declare class PreparedContentError extends Error {
|
|
42
|
+
readonly code: 'INVALID_PREPARED_CONTENT' | 'UNSUPPORTED_PREPARED_CONTENT_VERSION' | 'UNSUPPORTED_PREPARED_CONTENT_CODEC' | 'PREPARED_CONTENT_MEMORY_ONLY';
|
|
43
|
+
constructor(code: 'INVALID_PREPARED_CONTENT' | 'UNSUPPORTED_PREPARED_CONTENT_VERSION' | 'UNSUPPORTED_PREPARED_CONTENT_CODEC' | 'PREPARED_CONTENT_MEMORY_ONLY');
|
|
44
|
+
}
|
|
45
|
+
/** Shared deterministic JSON after normal transport serialization. This keeps
|
|
46
|
+
* existing endpoint fingerprint semantics, including omitted undefined fields. */
|
|
47
|
+
export declare function canonicalEndpointJson(value: unknown): string;
|
|
48
|
+
/** Only the JSON processor may inspect this payload. It returns a fresh copy;
|
|
49
|
+
* neither decoding nor transport can mutate the sealed publication. */
|
|
50
|
+
export declare function decodePreparedJsonContent(value: unknown): DecodedPreparedJsonContent;
|
|
51
|
+
export declare function isPreparedContent(value: unknown): value is PreparedContent;
|
|
52
|
+
export declare function prepareJsonContent(input: PreparedJsonInput): PreparedContent;
|
|
53
|
+
/** Stable media dependency identity contains no renewable upload id or URL. */
|
|
54
|
+
export declare function logicalMediaBlobId(conversationId: string, messageId: string, index: number): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opaque, server-issued authority for one agent reply to one inbound message.
|
|
3
|
+
*
|
|
4
|
+
* The stream delivers this beside the triggering message. Runtimes keep it out
|
|
5
|
+
* of model-visible schemas and return it only on the ordinary reply path.
|
|
6
|
+
*/
|
|
7
|
+
export interface AgentReplyAuthorityV1 {
|
|
8
|
+
schema: 'canon.agent-reply-authority.v1';
|
|
9
|
+
sourceMessageId: string;
|
|
10
|
+
token: string;
|
|
11
|
+
expiresAt: string;
|
|
12
|
+
/** Agent membership admission at issuance; absent/null only for legacy membership. */
|
|
13
|
+
admissionId?: string | null;
|
|
14
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical `canon.card.v1` action-field type vocabulary. The runtime array is
|
|
3
|
+
* the single source of truth and the type is derived from it, so a value and a
|
|
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 the Hermes plugin's committed
|
|
8
|
+
* rich-cards SKILL.md, and `npm run check:skill-bundles` fails on a byte change.
|
|
9
|
+
*/
|
|
10
|
+
export declare const RUNTIME_CARD_FIELD_TYPES: readonly ["text", "textarea", "select", "multiSelect", "boolean", "date", "number", "currency", "searchSelect", "lineItems"];
|
|
11
|
+
export type RuntimeCardFieldType = (typeof RUNTIME_CARD_FIELD_TYPES)[number];
|
|
12
|
+
/**
|
|
13
|
+
* Caps shared across runtime-card normalizers, response validation, and
|
|
14
|
+
* authoring tools. Keep these backend-safe so Functions can import them.
|
|
15
|
+
*/
|
|
16
|
+
export declare const RUNTIME_CARD_LIMITS: {
|
|
17
|
+
readonly detailsRows: 32;
|
|
18
|
+
readonly lineItemRows: 50;
|
|
19
|
+
readonly lineItemColumns: 8;
|
|
20
|
+
readonly searchSelectChoices: 100;
|
|
21
|
+
};
|
|
22
|
+
export interface RuntimeCardFieldChoice {
|
|
23
|
+
label: string;
|
|
24
|
+
value?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
preview?: string;
|
|
27
|
+
}
|
|
28
|
+
/** Column cell types allowed inside a `lineItems` field. */
|
|
29
|
+
export declare const RUNTIME_CARD_LINE_ITEM_COLUMN_TYPES: readonly ["text", "number", "currency", "date", "select"];
|
|
30
|
+
export type RuntimeCardLineItemColumnType = (typeof RUNTIME_CARD_LINE_ITEM_COLUMN_TYPES)[number];
|
|
31
|
+
export interface RuntimeCardLineItemColumn {
|
|
32
|
+
id: string;
|
|
33
|
+
label: string;
|
|
34
|
+
type: RuntimeCardLineItemColumnType;
|
|
35
|
+
required?: boolean;
|
|
36
|
+
choices?: RuntimeCardFieldChoice[];
|
|
37
|
+
min?: number;
|
|
38
|
+
max?: number;
|
|
39
|
+
step?: number;
|
|
40
|
+
precision?: number;
|
|
41
|
+
currencyCode?: string;
|
|
42
|
+
allowOther?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface RuntimeCardField {
|
|
45
|
+
id: string;
|
|
46
|
+
label: string;
|
|
47
|
+
type: RuntimeCardFieldType;
|
|
48
|
+
required?: boolean;
|
|
49
|
+
placeholder?: string;
|
|
50
|
+
choices?: RuntimeCardFieldChoice[];
|
|
51
|
+
allowOther?: boolean;
|
|
52
|
+
sensitive?: boolean;
|
|
53
|
+
min?: number | string;
|
|
54
|
+
max?: number | string;
|
|
55
|
+
step?: number;
|
|
56
|
+
precision?: number;
|
|
57
|
+
currencyCode?: string;
|
|
58
|
+
columns?: RuntimeCardLineItemColumn[];
|
|
59
|
+
minRows?: number;
|
|
60
|
+
maxRows?: number;
|
|
61
|
+
}
|
|
62
|
+
export declare function validateRuntimeCardFieldValues(input: {
|
|
63
|
+
actionId: string | undefined;
|
|
64
|
+
actionFields: ReadonlyArray<RuntimeCardField> | undefined;
|
|
65
|
+
values: Record<string, unknown> | undefined;
|
|
66
|
+
}): string | null;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export type CanonControlValue = string;
|
|
2
|
+
export type CanonRuntimeStreamingMode = 'none' | 'status' | 'snapshot' | 'block' | 'delta';
|
|
3
|
+
export type CanonRuntimeDetailTier = 'primary' | 'detail' | 'diagnostic';
|
|
4
|
+
export type CanonRuntimeVisibility = 'conversation' | 'hidden';
|
|
5
|
+
export type CanonRuntimeActionAvailability = 'idle' | 'busy' | 'busy_with_queue' | 'waiting_input' | 'always';
|
|
6
|
+
export type CanonRuntimeActionPlacement = 'composer_slash' | 'command_palette' | 'session_strip';
|
|
7
|
+
export type CanonRuntimeActionCategory = 'plan' | 'turn' | 'session' | 'runtime' | 'details' | 'skill' | 'custom';
|
|
8
|
+
export type CanonRuntimePrimitiveId = 'runtime.status' | 'runtime.reasoning.set' | 'runtime.verbosity.set' | 'runtime.usage' | 'context.compact' | 'session.new' | 'session.reset';
|
|
9
|
+
export type CanonRuntimeCommandArgumentKind = 'string' | 'enum' | 'boolean';
|
|
10
|
+
export interface CanonRuntimeCommandArgumentChoice {
|
|
11
|
+
value: string;
|
|
12
|
+
label: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CanonRuntimeCommandArgumentDescriptor {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
kind: CanonRuntimeCommandArgumentKind;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
captureRemaining?: boolean;
|
|
21
|
+
choices?: ReadonlyArray<CanonRuntimeCommandArgumentChoice>;
|
|
22
|
+
}
|
|
23
|
+
export type CanonRuntimeActionDispatch = {
|
|
24
|
+
kind: 'control';
|
|
25
|
+
controlId: string;
|
|
26
|
+
value?: CanonControlValue;
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'signal';
|
|
29
|
+
signal: 'interrupt' | 'stop_and_drop' | 'new_session';
|
|
30
|
+
} | {
|
|
31
|
+
kind: 'primitive';
|
|
32
|
+
primitive: CanonRuntimePrimitiveId;
|
|
33
|
+
} | {
|
|
34
|
+
kind: 'text_passthrough';
|
|
35
|
+
template: string;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'compose';
|
|
38
|
+
text: string;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'open_details';
|
|
41
|
+
target?: string;
|
|
42
|
+
};
|
|
43
|
+
export interface CanonRuntimeActionDescriptor {
|
|
44
|
+
id: string;
|
|
45
|
+
label: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
visibility?: CanonRuntimeVisibility;
|
|
48
|
+
tier?: CanonRuntimeDetailTier;
|
|
49
|
+
sensitive?: boolean;
|
|
50
|
+
primitive?: CanonRuntimePrimitiveId;
|
|
51
|
+
aliases?: ReadonlyArray<string>;
|
|
52
|
+
category?: CanonRuntimeActionCategory;
|
|
53
|
+
placements?: ReadonlyArray<CanonRuntimeActionPlacement>;
|
|
54
|
+
availability?: ReadonlyArray<CanonRuntimeActionAvailability>;
|
|
55
|
+
ownerOnly?: boolean;
|
|
56
|
+
disabledReason?: string | null;
|
|
57
|
+
trailingTextBehavior?: 'ignore' | 'send_as_prompt';
|
|
58
|
+
args?: ReadonlyArray<CanonRuntimeCommandArgumentDescriptor>;
|
|
59
|
+
dispatch: CanonRuntimeActionDispatch;
|
|
60
|
+
}
|
|
61
|
+
export interface CanonRuntimeCommandDescriptor extends CanonRuntimeActionDescriptor {
|
|
62
|
+
primitive?: CanonRuntimePrimitiveId;
|
|
63
|
+
args?: ReadonlyArray<CanonRuntimeCommandArgumentDescriptor>;
|
|
64
|
+
}
|
|
65
|
+
export declare function normalizeRuntimeCommandAlias(value: string): string | null;
|
|
66
|
+
export declare function normalizeRuntimeCommandAliases(command: Pick<CanonRuntimeCommandDescriptor, 'id' | 'aliases'>): string[];
|
|
67
|
+
export declare const MAX_PUBLIC_RUNTIME_COMMANDS = 256;
|
|
68
|
+
export declare function isRuntimePrimitiveId(value: unknown): value is CanonRuntimePrimitiveId;
|
|
69
|
+
/** Public command metadata shared by endpoint-backed runtime publishers. Never copies local configuration. */
|
|
70
|
+
export declare function normalizePublicRuntimeCommands(value: unknown): CanonRuntimeCommandDescriptor[];
|
|
71
|
+
export interface PublicRuntimeDescriptor {
|
|
72
|
+
supportsInterrupt?: boolean;
|
|
73
|
+
supportsInputInterrupt?: boolean;
|
|
74
|
+
streamingTextMode?: CanonRuntimeStreamingMode;
|
|
75
|
+
commands?: CanonRuntimeCommandDescriptor[];
|
|
76
|
+
}
|
|
77
|
+
export declare function normalizePublicRuntimeDescriptor(value: unknown): PublicRuntimeDescriptor;
|
|
78
|
+
/** Read-only session facts, excluding local paths, inventories, and hidden/sensitive values. */
|
|
79
|
+
export declare function normalizePublicRuntimeFacts(value: unknown): {
|
|
80
|
+
id: string;
|
|
81
|
+
group: "runtime" | "model" | "connection" | "route";
|
|
82
|
+
label: string;
|
|
83
|
+
value: string;
|
|
84
|
+
tier: "primary" | "detail" | "diagnostic" | undefined;
|
|
85
|
+
tone: "neutral" | "good" | "warning" | "danger" | undefined;
|
|
86
|
+
copyable: boolean | undefined;
|
|
87
|
+
updatedAt: number | undefined;
|
|
88
|
+
}[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Stored self-context id, or null when absent, empty, or path-like. */
|
|
2
|
+
export declare function normalizeStoredSelfContextId(value: unknown): string | null;
|
|
3
|
+
/**
|
|
4
|
+
* Agent-facing projection of an `agentSelfContexts` document; null for anything
|
|
5
|
+
* that is not a usable cross-session context. Ownership and conversation
|
|
6
|
+
* scoping stay with the CALLER — both consumers check them against their own
|
|
7
|
+
* Firestore handle before calling this.
|
|
8
|
+
*/
|
|
9
|
+
export declare function serializeSelfContext(id: string, data: Record<string, unknown>): Record<string, unknown> | null;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type SenderType = 'human' | 'ai_agent';
|
|
2
|
+
export type TurnLifecycleState = 'idle' | 'thinking' | 'streaming' | 'tool' | 'waiting_input' | 'completed' | 'interrupted';
|
|
3
|
+
export type TurnMessageSemantics = 'progress' | 'turn_complete' | 'control';
|
|
4
|
+
export type DeliveryIntent = 'queue' | 'interrupt' | 'interleave' | 'stop';
|
|
5
|
+
export type InboundDisposition = 'queued' | 'accepted_now' | 'interleaved' | 'trigger_suppressed' | 'rejected' | 'cancelled';
|
|
6
|
+
export interface TurnMetadata {
|
|
7
|
+
turnId?: string | null;
|
|
8
|
+
turnSemantics?: TurnMessageSemantics;
|
|
9
|
+
deliveryIntent?: DeliveryIntent;
|
|
10
|
+
replyBehavior?: 'allow_auto_reply' | 'suppress_auto_reply';
|
|
11
|
+
inboundDisposition?: InboundDisposition;
|
|
12
|
+
requestedTurnMode?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface TriggerDecision {
|
|
15
|
+
allow: boolean;
|
|
16
|
+
semantics: TurnMessageSemantics;
|
|
17
|
+
reason: string;
|
|
18
|
+
}
|
|
19
|
+
export interface TurnStateLike {
|
|
20
|
+
state: TurnLifecycleState;
|
|
21
|
+
openedAt?: number;
|
|
22
|
+
updatedAt?: number;
|
|
23
|
+
turnUpdatedAt?: number | null;
|
|
24
|
+
}
|
|
25
|
+
export declare const ACTIVE_TURN_STALE_THRESHOLD_MS: number;
|
|
26
|
+
export declare const WAITING_INPUT_STALE_THRESHOLD_MS: number;
|
|
27
|
+
export declare function normalizeTurnMetadata(metadata: unknown): TurnMetadata | null;
|
|
28
|
+
export declare function isTurnOpen(turnState: TurnStateLike | null | undefined): boolean;
|
|
29
|
+
export declare function getTurnStateStaleThresholdMs(state: TurnLifecycleState): number;
|
|
30
|
+
export declare function isTurnStateStale(turnState: TurnStateLike | null | undefined): boolean;
|
|
31
|
+
export declare function resolveTurnMessageSemantics(input: {
|
|
32
|
+
senderType: SenderType;
|
|
33
|
+
metadata?: unknown;
|
|
34
|
+
}): TurnMessageSemantics;
|
|
35
|
+
export declare function shouldPromoteConversationMessage(input: {
|
|
36
|
+
senderType: SenderType;
|
|
37
|
+
metadata?: unknown;
|
|
38
|
+
}): boolean;
|
|
39
|
+
export declare function shouldTriggerAgentTurn(input: {
|
|
40
|
+
senderType: SenderType;
|
|
41
|
+
metadata?: unknown;
|
|
42
|
+
}): TriggerDecision;
|
|
43
|
+
export declare function normalizeRuntimeTurnState(value: unknown): TurnStateLike | null;
|
|
@@ -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;
|