@canonmsg/agent-sdk 12.5.1 → 13.0.2
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 +57 -24
- package/dist/chunks/{chunk-C2WJT3VX.js → chunk-5WPAB5MB.js} +1047 -856
- package/dist/chunks/{chunk-3KFVBOVI.js → chunk-DNHJGAEL.js} +1115 -1020
- package/dist/chunks/chunk-DTAWEQCM.js +406 -0
- package/dist/chunks/{chunk-TFSURFF6.js → chunk-TYZT346O.js} +1720 -4006
- package/dist/chunks/chunk-YHDDOADK.js +118 -0
- package/dist/chunks/chunk-YJUPKU47.js +1490 -0
- package/dist/chunks/{mls-crypto-Y44BOSEM.js → mls-crypto-NZVMSUFU.js} +2 -1
- package/dist/cli.js +86 -48
- package/dist/drivers/acp.d.ts +56 -0
- package/dist/drivers/codex.d.ts +1 -2
- package/dist/drivers/subprocess.d.ts +38 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +12 -3
- package/dist/internal/backend-contracts/endpointContentPolicy.d.ts +2 -2
- package/dist/internal/backend-contracts/index.d.ts +1 -0
- package/dist/internal/backend-contracts/loggedOutSessions.d.ts +7 -0
- package/dist/internal/backend-contracts/mlsDevCredential.d.ts +3 -0
- package/dist/internal/backend-contracts/mlsDevGroup.d.ts +17 -0
- package/dist/internal/core/completed-output-journal.d.ts +0 -5
- package/dist/internal/core/index.d.ts +3 -9
- package/dist/internal/core/retry.d.ts +2 -89
- package/dist/internal/core/silent-turn.d.ts +4 -33
- package/dist/internal/endpoint/engine.d.ts +6 -0
- package/dist/internal/endpoint/mls-dev-client.d.ts +2 -0
- package/dist/internal/endpoint/mls-dev-groups.d.ts +12 -0
- package/dist/internal/endpoint/mls-dev-text.d.ts +32 -0
- package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +5 -0
- package/dist/internal/endpoint/node.d.ts +1 -0
- package/dist/internal/endpoint/transport.d.ts +1 -1
- package/dist/media.js +4 -2
- package/dist/mls/darwin-arm64/canon-mls-custody +0 -0
- package/dist/mls/linux-arm64/canon-mls-custody +0 -0
- package/dist/mls/linux-x64/canon-mls-custody +0 -0
- package/dist/mls/wasm/canon_mls_wasm.js +363 -0
- package/dist/mls/wasm/canon_mls_wasm_bg.wasm +0 -0
- package/dist/mls-wasm-host.js +258 -0
- package/dist/runner/mls-bundled.d.ts +15 -2
- package/dist/runner/mls-managed.d.ts +6 -3
- package/dist/runner/mls.d.ts +4 -7
- package/dist/runner/runner.d.ts +9 -12
- package/dist/runner/types.d.ts +37 -1
- package/package.json +1 -1
- package/dist/internal/core/approval-manager.d.ts +0 -43
- package/dist/internal/core/runtime-request-manager.d.ts +0 -283
- package/dist/internal/core/turn-verbosity.d.ts +0 -79
|
@@ -1,82 +1,12 @@
|
|
|
1
|
-
import type { SendMessageOptions } from './types.js';
|
|
2
|
-
import { type CanonClient } from './client.js';
|
|
3
|
-
export interface SendMessageRetryOptions {
|
|
4
|
-
/** Stable replacement recorded by the product after a conclusive rejection. */
|
|
5
|
-
operationId?: string;
|
|
6
|
-
replacesOperationId?: string;
|
|
7
|
-
signal?: AbortSignal;
|
|
8
|
-
timeoutMs?: number;
|
|
9
|
-
maxAttempts?: number;
|
|
10
|
-
baseDelayMs?: number;
|
|
11
|
-
maxDelayMs?: number;
|
|
12
|
-
sleep?: (ms: number) => Promise<void>;
|
|
13
|
-
}
|
|
14
1
|
export declare const CANON_MESSAGE_TEXT_MAX_BYTES: number;
|
|
15
2
|
export declare const DEFAULT_CHUNKED_MESSAGE_TEXT_MAX_BYTES = 3800;
|
|
16
|
-
export interface SendMessageChunkingOptions {
|
|
17
|
-
maxTextBytes?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Opt in to resumable chunked delivery.
|
|
20
|
-
*
|
|
21
|
-
* With it on, a mid-sequence failure throws a `ChunkedSendMessageError`
|
|
22
|
-
* carrying the ids of the parts that ARE durable, so a later attempt can pick
|
|
23
|
-
* up the tail. Off by default so callers that do not resume keep today's
|
|
24
|
-
* behaviour: the raw send error, unwrapped.
|
|
25
|
-
*
|
|
26
|
-
* Implied by a non-empty `deliveredMessageIds` — passing progress back IS
|
|
27
|
-
* opting in.
|
|
28
|
-
*/
|
|
29
|
-
resumable?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Ids of the parts an earlier attempt already made durable, in part order.
|
|
32
|
-
* Those parts are skipped and their ids are carried into the result, so a
|
|
33
|
-
* resumed send still reports the whole answer.
|
|
34
|
-
*/
|
|
35
|
-
deliveredMessageIds?: readonly string[];
|
|
36
|
-
}
|
|
37
|
-
export interface ChunkedSendMessageResult {
|
|
38
|
-
messageIds: string[];
|
|
39
|
-
}
|
|
40
3
|
/** Pending delivery is visible, but cannot truthfully produce a failure notice. */
|
|
41
4
|
export declare function isPendingCanonOperation(error: unknown): boolean;
|
|
42
|
-
/**
|
|
43
|
-
* A chunked send that stopped part-way, with the progress needed to resume it.
|
|
44
|
-
*
|
|
45
|
-
* Parts 1..`deliveredMessageIds.length` are durable in Canon; only the tail is
|
|
46
|
-
* missing. Handing `deliveredMessageIds` back to `sendMessageWithRetryChunked`
|
|
47
|
-
* restarts at the next part instead of re-sending the answer's head — which the
|
|
48
|
-
* server would reject or duplicate, and which the reader has already seen.
|
|
49
|
-
*/
|
|
50
|
-
export declare class ChunkedSendMessageError extends Error {
|
|
51
|
-
/** Ids of the parts that are durable in Canon, in part order. */
|
|
52
|
-
readonly deliveredMessageIds: string[];
|
|
53
|
-
/** The part the send stopped on (1-based). */
|
|
54
|
-
readonly failedPart: number;
|
|
55
|
-
/** How many parts the text splits into in total. */
|
|
56
|
-
readonly totalParts: number;
|
|
57
|
-
/** The underlying send failure — what callers should classify. */
|
|
58
|
-
readonly cause: unknown;
|
|
59
|
-
constructor(input: {
|
|
60
|
-
cause: unknown;
|
|
61
|
-
deliveredMessageIds: readonly string[];
|
|
62
|
-
failedPart: number;
|
|
63
|
-
totalParts: number;
|
|
64
|
-
});
|
|
65
|
-
/** How many parts are durable — a resume starts at the next one. */
|
|
66
|
-
get deliveredParts(): number;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Structural check as well as `instanceof`, so progress survives a caller that
|
|
70
|
-
* ended up with a second copy of this module (a workspace package resolved to
|
|
71
|
-
* both `dist` and source, say) instead of silently degrading to "no progress".
|
|
72
|
-
*/
|
|
73
|
-
export declare function isChunkedSendMessageError(error: unknown): error is ChunkedSendMessageError;
|
|
74
5
|
export declare function isRetryableCanonDeliveryError(error: unknown): boolean;
|
|
75
|
-
export declare function sendMessageWithRetry(client: CanonClient, conversationId: string, text: string, options?: SendMessageOptions, retryOptions?: SendMessageRetryOptions): Promise<{
|
|
76
|
-
messageId: string;
|
|
77
|
-
}>;
|
|
78
6
|
export declare function utf8ByteLength(value: string): number;
|
|
79
7
|
export declare function splitTextByUtf8Bytes(text: string, maxBytes?: number): string[];
|
|
8
|
+
/** The same split for a limit of the caller's own: an encrypted room's text takes up to 32 KiB. */
|
|
9
|
+
export declare function splitTextWithinBytes(text: string, byteLimit: number): string[];
|
|
80
10
|
export declare function chunkMessageId(baseMessageId: string | undefined, index: number): string | undefined;
|
|
81
11
|
export interface ChunkedMessagePartMetadataInput {
|
|
82
12
|
/** Stable group id shared by every part, normally the unsuffixed message id. */
|
|
@@ -94,20 +24,3 @@ export interface ChunkedMessagePartMetadataInput {
|
|
|
94
24
|
* preceding message parts.
|
|
95
25
|
*/
|
|
96
26
|
export declare function buildChunkedMessagePartMetadata(input: ChunkedMessagePartMetadataInput): Record<string, unknown>;
|
|
97
|
-
/**
|
|
98
|
-
* Send `text` as one message, or as an ordered sequence of `-part-N` messages
|
|
99
|
-
* when it exceeds the byte budget.
|
|
100
|
-
*
|
|
101
|
-
* Sequential by construction, so a failure leaves parts 1..k durable and the
|
|
102
|
-
* tail unsent. Callers that opt into `resumable` get that progress back (see
|
|
103
|
-
* `ChunkedSendMessageError`) and can hand it to a later attempt, which then
|
|
104
|
-
* picks up at part k+1. The split is a pure function of the text and the byte
|
|
105
|
-
* budget, so part N of a resumed attempt is byte-identical to part N of the
|
|
106
|
-
* attempt that delivered it — which is what makes the `-part-N` ids a safe
|
|
107
|
-
* resume cursor.
|
|
108
|
-
*
|
|
109
|
-
* A byte-identical replay succeeds at the server. Any idempotency conflict
|
|
110
|
-
* therefore means the stored part differs and is always reported; treating it
|
|
111
|
-
* as delivered would stitch two different answers together.
|
|
112
|
-
*/
|
|
113
|
-
export declare function sendMessageWithRetryChunked(client: CanonClient, conversationId: string, text: string, options?: SendMessageOptions, retryOptions?: SendMessageRetryOptions, chunkingOptions?: SendMessageChunkingOptions): Promise<ChunkedSendMessageResult>;
|
|
@@ -11,39 +11,10 @@
|
|
|
11
11
|
* the server and the hosts depend on.
|
|
12
12
|
*/
|
|
13
13
|
export { NO_REPLY_ACK_NOTE } from '../backend-contracts/index.js';
|
|
14
|
-
import { type CanonVerbWireRequest } from '../backend-contracts/index.js';
|
|
15
|
-
/** The one client capability the outcome report needs. */
|
|
16
|
-
export interface NoReplyReportClient {
|
|
17
|
-
executeVerbWire(wire: CanonVerbWireRequest): Promise<unknown>;
|
|
18
|
-
}
|
|
19
14
|
/**
|
|
20
|
-
* What `
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* text. The reason a binding was handed never leaves its process.
|
|
15
|
+
* What a `no_reply` verb carries in place of any caller-supplied reason text.
|
|
16
|
+
* The server stores only `hasReason` and discards the text, so transmitting
|
|
17
|
+
* the model- or handler-authored sentence would be pure exposure: the sentinel
|
|
18
|
+
* preserves the server's `hasReason` signal without moving the text.
|
|
25
19
|
*/
|
|
26
20
|
export declare const NO_REPLY_REASON_SENTINEL = "given";
|
|
27
|
-
/**
|
|
28
|
-
* Report a locally-answered `no_reply` to the server, fire-and-forget.
|
|
29
|
-
*
|
|
30
|
-
* Four of the five runtimes answer the silence tool inside their own process
|
|
31
|
-
* and never reach `POST /agent/verbs/no_reply`, so Canon's durable record of
|
|
32
|
-
* deliberate silence (`/runtime-silence/{convoId}/{agentId}`) would otherwise
|
|
33
|
-
* cover Claude turns only. This is telemetry, not behavior: the silence flag
|
|
34
|
-
* is already set locally before this is called, so a failed or unreachable
|
|
35
|
-
* report degrades to exactly the pre-report behavior — never to a posted
|
|
36
|
-
* message and never to a failed turn.
|
|
37
|
-
*
|
|
38
|
-
* `params.reason` is read only for its presence: the wire carries
|
|
39
|
-
* `NO_REPLY_REASON_SENTINEL` in its place, never the caller's text.
|
|
40
|
-
*
|
|
41
|
-
* The Claude host must NOT call this helper: its binding already POSTs the
|
|
42
|
-
* verb via agent-tools, so calling both would double-record the silence.
|
|
43
|
-
*/
|
|
44
|
-
export declare function reportNoReplyOutcome(client: NoReplyReportClient, params: {
|
|
45
|
-
conversationId: string;
|
|
46
|
-
messageId?: string;
|
|
47
|
-
reason?: string;
|
|
48
|
-
now?: number;
|
|
49
|
-
}): void;
|
|
@@ -34,6 +34,9 @@ export interface EndpointExecuteOptions {
|
|
|
34
34
|
operationId?: string;
|
|
35
35
|
sensitive?: boolean;
|
|
36
36
|
guardId?: string;
|
|
37
|
+
/** A person's text in an encrypted room that is held (D2): kept on this device and sent once the room may send, the
|
|
38
|
+
* call waiting with it, instead of refused with `MLS_DEV_GROUP_ADMISSION_PENDING`. */
|
|
39
|
+
waitWhileHeld?: boolean;
|
|
37
40
|
}
|
|
38
41
|
export interface EndpointWaitOptions {
|
|
39
42
|
signal?: AbortSignal;
|
|
@@ -132,6 +135,9 @@ export interface EndpointOptions {
|
|
|
132
135
|
autoDrain?: boolean;
|
|
133
136
|
/** Explicit synthetic Dev device identity operations, using this endpoint's store and lifecycle. */
|
|
134
137
|
mlsDevDevice?: MlsDevDeviceClientOptions;
|
|
138
|
+
/** A person's inbox rows show each encrypted room's last message from this device's copy. Never set for an agent: an
|
|
139
|
+
* inbox read can serve a turn from someone outside that room. */
|
|
140
|
+
localInboxPreviews?: boolean;
|
|
135
141
|
}
|
|
136
142
|
export type EndpointContentMode = 'plaintext' | 'mls-dev-text' | 'mls-required';
|
|
137
143
|
export interface Endpoint {
|
|
@@ -37,6 +37,8 @@ export interface MlsDevDeviceClient {
|
|
|
37
37
|
* to a room, and readiness refuses it. A device Canon never registered has
|
|
38
38
|
* nothing to revoke; a revoked one is returned as it is. Rooms keep its leaf until Canon can remove devices (step 5c). */
|
|
39
39
|
revoke(): Promise<MlsDevDeviceView>;
|
|
40
|
+
/** Logs out another of this account's devices (its device list); this one leaves through `revoke`. */
|
|
41
|
+
revokeOther(deviceId: string): Promise<void>;
|
|
40
42
|
}
|
|
41
43
|
/** Whether readiness would renew this registered device: it has no credential, or less than half its lifetime remains. */
|
|
42
44
|
export declare function isMlsDevCredentialRenewalDue(view: MlsDevDeviceView, now: number): boolean;
|
|
@@ -46,6 +46,8 @@ export interface MlsDevVerifiedMessageBinding {
|
|
|
46
46
|
export interface MlsDevAdmissionHold {
|
|
47
47
|
readonly held: boolean;
|
|
48
48
|
readonly waitingPrincipalIds: readonly string[];
|
|
49
|
+
/** This device joined after the room's first message, so its history starts later (mls-rooms-by-default.md §2.7). */
|
|
50
|
+
readonly missedEarlier?: true;
|
|
49
51
|
}
|
|
50
52
|
export interface MlsDevCurrentAudience {
|
|
51
53
|
readonly version: 1;
|
|
@@ -173,6 +175,16 @@ export declare function createMlsDevGroups(options: MlsDevDeviceClientOptions, c
|
|
|
173
175
|
* encrypted room (mls-payload-v3.md §4). Items and cards are not forwarded yet. */
|
|
174
176
|
forwardText(value: unknown, operationId: string, guardId?: string): Promise<EndpointOperation>;
|
|
175
177
|
sendText(value: unknown, operationId: string, guardId?: string): Promise<EndpointOperation>;
|
|
178
|
+
/** `sendText` for a person's composer: in a held room the text is kept, not refused (undefined), until `sendHeldTexts`. */
|
|
179
|
+
holdText(value: unknown, operationId: string): Promise<EndpointOperation | undefined>;
|
|
180
|
+
sendHeldTexts(conversationId: string): Promise<{
|
|
181
|
+
sent: EndpointOperation[];
|
|
182
|
+
failed: {
|
|
183
|
+
operationId: string;
|
|
184
|
+
error: EndpointError;
|
|
185
|
+
}[];
|
|
186
|
+
waiting: boolean;
|
|
187
|
+
}>;
|
|
176
188
|
/** A room this device holds caught up is read as it holds it: what fetches the room's new entries says so
|
|
177
189
|
* (bridge.historyChanged). Otherwise a read fetches the feed first, which the polling fallback and the connected
|
|
178
190
|
* stream's minute-long safety poll rely on. */
|
|
@@ -23,6 +23,35 @@ export declare const mlsDevOwnAnswerKey: (conversationId: string, agentId: strin
|
|
|
23
23
|
/** Whether this device's answer to a card is committed and still on its way: queued, or its outcome uncertain, and not
|
|
24
24
|
* yet applied from the feed (where the reduction takes over) nor refused. The card waits for it rather than answer twice. */
|
|
25
25
|
export declare function isMlsDevOwnAnswerSending(tx: EndpointStoreTransaction, conversationId: string, agentId: string, requestId: string): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* A text its sender sent while the room was held (D2, mls-rooms-by-default.md §2.7): kept here, unencrypted and never in a
|
|
28
|
+
* request, until the hold lifts. Then it is encrypted and queued as any send, in the order sent, and this record goes.
|
|
29
|
+
*/
|
|
30
|
+
export interface MlsDevHeldText {
|
|
31
|
+
version: 1;
|
|
32
|
+
/** The send's body as authored, its message ID fixed: what is encrypted once the room may send. */
|
|
33
|
+
body: {
|
|
34
|
+
conversationId: string;
|
|
35
|
+
messageId: string;
|
|
36
|
+
text: string;
|
|
37
|
+
replyTo?: string;
|
|
38
|
+
mentions?: string[];
|
|
39
|
+
};
|
|
40
|
+
operationId: string;
|
|
41
|
+
senderId: string;
|
|
42
|
+
senderType: 'human' | 'ai_agent';
|
|
43
|
+
createdAtMs: number;
|
|
44
|
+
/** The order sent, within the room's kept texts. */
|
|
45
|
+
sequence: number;
|
|
46
|
+
/** Refused for good when its turn came; kept so its sender sees it failed and can send it again. */
|
|
47
|
+
failed?: string;
|
|
48
|
+
}
|
|
49
|
+
export declare const mlsDevHeldTextPrefix: (conversationId?: string) => string;
|
|
50
|
+
export declare const mlsDevHeldTextKey: (conversationId: string, messageId: string) => string;
|
|
51
|
+
/** A room's held texts, oldest first. */
|
|
52
|
+
export declare function readMlsDevHeldTexts(tx: EndpointStoreTransaction, conversationId: string): Promise<MlsDevHeldText[]>;
|
|
53
|
+
/** Held texts per room. A send past it is refused, as a held send was before rooms kept them. */
|
|
54
|
+
export declare const MLS_DEV_HELD_TEXT_MAX = 100;
|
|
26
55
|
/** A deletion for everyone that reached this device, before or after the message itself (mls-payload-v3.md §4). */
|
|
27
56
|
export declare const mlsDevTextDeletedKey: (conversationId: string, messageId: string) => string;
|
|
28
57
|
/** The reactions Canon holds for a message's public stub, which the history shows beside its decrypted text. */
|
|
@@ -40,6 +69,9 @@ export declare function putMlsDevTextMessage(tx: EndpointStoreTransaction, value
|
|
|
40
69
|
/** What a v3 reply quotes from this device's copy of the message it answers, trimmed to the payload's bound: a text, or
|
|
41
70
|
* an item's caption or else what it is. Nothing for a card, a message deleted for everyone, or one not held here. */
|
|
42
71
|
export declare function mlsDevReplyQuote(value: MlsDevLocalTextMessage | undefined, maximum: number): string | undefined;
|
|
72
|
+
/** An inbox page with each last message this device holds in place of Canon's stub. The page is for this person's own
|
|
73
|
+
* screen: a row then carries a room's plaintext, so it never reaches an HTTP request or an agent's turn. */
|
|
74
|
+
export declare function overlayMlsDevInboxPreviews<T>(tx: EndpointStoreTransaction, page: T): Promise<T>;
|
|
43
75
|
/** `account` opens the stored sender alias to its account (mls-dev-groups.md, erasure privacy). */
|
|
44
76
|
export declare function projectMlsDevTextMessage(value: MlsDevLocalTextMessage, account: MlsDevAccountResolver): Record<string, unknown>;
|
|
45
77
|
/** Opens a stored principal (an alias, with the type its credential gave) to its account. */
|
|
@@ -23,6 +23,11 @@ export declare function requireValue(value: unknown): asserts value;
|
|
|
23
23
|
export declare function record(value: unknown, fields: string[]): Record<string, unknown>;
|
|
24
24
|
export declare function sealed(value: unknown, maximum: number, nullable?: boolean): string | null;
|
|
25
25
|
export declare function frame(operation: number, values: readonly (string | null)[]): Buffer;
|
|
26
|
+
/** What `frame` wrote: its operation and arguments. */
|
|
27
|
+
export declare function parseFrame(input: Buffer): {
|
|
28
|
+
operation: number;
|
|
29
|
+
values: (string | null)[];
|
|
30
|
+
};
|
|
26
31
|
/** JSON.parse supplies grammar validation; this pass rejects duplicate object
|
|
27
32
|
* names (including escaped aliases) before the closed contract parsers run. */
|
|
28
33
|
export declare function parseJson(bytes: Buffer): unknown;
|
|
@@ -5,3 +5,4 @@ export declare function createNodeEndpointStore(options: {
|
|
|
5
5
|
}): Promise<EndpointStore>;
|
|
6
6
|
export { createNodeMlsDevCustody, NodeMlsDevCustodyError, type NodeMlsDevCustody, type NodeMlsDevCustodyOptions } from './node-mls-custody.js';
|
|
7
7
|
export { createPortableNodeMlsDevCustody, type PortableNodeMlsDevCustody, type PortableNodeMlsDevCustodyOptions } from './portable-node-mls-custody.js';
|
|
8
|
+
export { custodyFailure, custodyValue, frame, MAX_INPUT, MAX_OUTPUT, parseFrame, rejected, requireValue, typedNodeMlsDevCustody } from './node-mls-custody-protocol.js';
|
|
@@ -58,6 +58,6 @@ export declare function createHttpEndpointTransport(options: {
|
|
|
58
58
|
/** Names this client on every request and stream (`X-Canon-Client`), so Canon can apply its client floor. */
|
|
59
59
|
client?: CanonClientIdentity;
|
|
60
60
|
/** Canon refused this client as below its floor (`426 CLIENT_UPDATE_REQUIRED`), on any request or stream. Called
|
|
61
|
-
* before the error is thrown,
|
|
61
|
+
* once before the error is thrown; further operations, queries, publishes and streams are blocked, not capabilities. */
|
|
62
62
|
onClientUpdateRequired?(error: EndpointError): void;
|
|
63
63
|
}): EndpointTransport;
|
package/dist/media.js
CHANGED
|
@@ -18,8 +18,10 @@ import {
|
|
|
18
18
|
toAnthropicImageBlock,
|
|
19
19
|
toAnthropicImageBlocksWithinBudget,
|
|
20
20
|
uploadMediaFile
|
|
21
|
-
} from "./chunks/chunk-
|
|
22
|
-
import "./chunks/chunk-
|
|
21
|
+
} from "./chunks/chunk-TYZT346O.js";
|
|
22
|
+
import "./chunks/chunk-YJUPKU47.js";
|
|
23
|
+
import "./chunks/chunk-YHDDOADK.js";
|
|
24
|
+
import "./chunks/chunk-5WPAB5MB.js";
|
|
23
25
|
export {
|
|
24
26
|
DEFAULT_ANTHROPIC_REQUEST_HEADROOM_BYTES,
|
|
25
27
|
DEFAULT_MEDIA_CACHE_DIR,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
/* @ts-self-types="./canon_mls_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @returns {number}
|
|
5
|
+
*/
|
|
6
|
+
export function abi_version() {
|
|
7
|
+
const ret = wasm.abi_version();
|
|
8
|
+
return ret >>> 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {Uint8Array} identity_context
|
|
13
|
+
* @param {Uint8Array} group_context
|
|
14
|
+
* @param {Uint8Array} command
|
|
15
|
+
* @param {Uint8Array} identity_state
|
|
16
|
+
* @param {Uint8Array | null | undefined} group_state
|
|
17
|
+
* @param {Uint8Array | null | undefined} key_package_state
|
|
18
|
+
* @param {Uint8Array} issuer_keys
|
|
19
|
+
* @param {Uint8Array} receipt_keys
|
|
20
|
+
* @param {number} now_ms
|
|
21
|
+
* @returns {Uint8Array}
|
|
22
|
+
*/
|
|
23
|
+
export function prepare_group(identity_context, group_context, command, identity_state, group_state, key_package_state, issuer_keys, receipt_keys, now_ms) {
|
|
24
|
+
const ptr0 = passArray8ToWasm0(identity_context, wasm.__wbindgen_malloc);
|
|
25
|
+
const len0 = WASM_VECTOR_LEN;
|
|
26
|
+
const ptr1 = passArray8ToWasm0(group_context, wasm.__wbindgen_malloc);
|
|
27
|
+
const len1 = WASM_VECTOR_LEN;
|
|
28
|
+
const ptr2 = passArray8ToWasm0(command, wasm.__wbindgen_malloc);
|
|
29
|
+
const len2 = WASM_VECTOR_LEN;
|
|
30
|
+
const ptr3 = passArray8ToWasm0(identity_state, wasm.__wbindgen_malloc);
|
|
31
|
+
const len3 = WASM_VECTOR_LEN;
|
|
32
|
+
var ptr4 = isLikeNone(group_state) ? 0 : passArray8ToWasm0(group_state, wasm.__wbindgen_malloc);
|
|
33
|
+
var len4 = WASM_VECTOR_LEN;
|
|
34
|
+
var ptr5 = isLikeNone(key_package_state) ? 0 : passArray8ToWasm0(key_package_state, wasm.__wbindgen_malloc);
|
|
35
|
+
var len5 = WASM_VECTOR_LEN;
|
|
36
|
+
const ptr6 = passArray8ToWasm0(issuer_keys, wasm.__wbindgen_malloc);
|
|
37
|
+
const len6 = WASM_VECTOR_LEN;
|
|
38
|
+
const ptr7 = passArray8ToWasm0(receipt_keys, wasm.__wbindgen_malloc);
|
|
39
|
+
const len7 = WASM_VECTOR_LEN;
|
|
40
|
+
const ret = wasm.prepare_group(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, now_ms);
|
|
41
|
+
var v9 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
42
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
43
|
+
return v9;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {Uint8Array} context
|
|
48
|
+
* @param {Uint8Array} command
|
|
49
|
+
* @param {Uint8Array} identity_state
|
|
50
|
+
* @param {Uint8Array} issuer_keys
|
|
51
|
+
* @param {number} now_ms
|
|
52
|
+
* @returns {Uint8Array}
|
|
53
|
+
*/
|
|
54
|
+
export function prepare_key_package(context, command, identity_state, issuer_keys, now_ms) {
|
|
55
|
+
const ptr0 = passArray8ToWasm0(context, wasm.__wbindgen_malloc);
|
|
56
|
+
const len0 = WASM_VECTOR_LEN;
|
|
57
|
+
const ptr1 = passArray8ToWasm0(command, wasm.__wbindgen_malloc);
|
|
58
|
+
const len1 = WASM_VECTOR_LEN;
|
|
59
|
+
const ptr2 = passArray8ToWasm0(identity_state, wasm.__wbindgen_malloc);
|
|
60
|
+
const len2 = WASM_VECTOR_LEN;
|
|
61
|
+
const ptr3 = passArray8ToWasm0(issuer_keys, wasm.__wbindgen_malloc);
|
|
62
|
+
const len3 = WASM_VECTOR_LEN;
|
|
63
|
+
const ret = wasm.prepare_key_package(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, now_ms);
|
|
64
|
+
var v5 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
65
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
66
|
+
return v5;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @param {Uint8Array} context
|
|
71
|
+
* @param {Uint8Array} command
|
|
72
|
+
* @param {Uint8Array | null | undefined} state
|
|
73
|
+
* @param {number} now_ms
|
|
74
|
+
* @returns {Uint8Array}
|
|
75
|
+
*/
|
|
76
|
+
export function prepare_signing(context, command, state, now_ms) {
|
|
77
|
+
const ptr0 = passArray8ToWasm0(context, wasm.__wbindgen_malloc);
|
|
78
|
+
const len0 = WASM_VECTOR_LEN;
|
|
79
|
+
const ptr1 = passArray8ToWasm0(command, wasm.__wbindgen_malloc);
|
|
80
|
+
const len1 = WASM_VECTOR_LEN;
|
|
81
|
+
var ptr2 = isLikeNone(state) ? 0 : passArray8ToWasm0(state, wasm.__wbindgen_malloc);
|
|
82
|
+
var len2 = WASM_VECTOR_LEN;
|
|
83
|
+
const ret = wasm.prepare_signing(ptr0, len0, ptr1, len1, ptr2, len2, now_ms);
|
|
84
|
+
var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
85
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
86
|
+
return v4;
|
|
87
|
+
}
|
|
88
|
+
function __wbg_get_imports() {
|
|
89
|
+
const import0 = {
|
|
90
|
+
__proto__: null,
|
|
91
|
+
__wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) {
|
|
92
|
+
const ret = typeof(arg0) === 'function';
|
|
93
|
+
return ret;
|
|
94
|
+
},
|
|
95
|
+
__wbg___wbindgen_is_object_3c45d4f2dde4e749: function(arg0) {
|
|
96
|
+
const val = arg0;
|
|
97
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
98
|
+
return ret;
|
|
99
|
+
},
|
|
100
|
+
__wbg___wbindgen_is_string_90b56bc79aad6f6c: function(arg0) {
|
|
101
|
+
const ret = typeof(arg0) === 'string';
|
|
102
|
+
return ret;
|
|
103
|
+
},
|
|
104
|
+
__wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
|
|
105
|
+
const ret = arg0 === undefined;
|
|
106
|
+
return ret;
|
|
107
|
+
},
|
|
108
|
+
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
109
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
110
|
+
},
|
|
111
|
+
__wbg_call_187d372bd5fdd4aa: function() { return handleError(function (arg0, arg1, arg2) {
|
|
112
|
+
const ret = arg0.call(arg1, arg2);
|
|
113
|
+
return ret;
|
|
114
|
+
}, arguments); },
|
|
115
|
+
__wbg_crypto_38df2bab126b63dc: function(arg0) {
|
|
116
|
+
const ret = arg0.crypto;
|
|
117
|
+
return ret;
|
|
118
|
+
},
|
|
119
|
+
__wbg_getRandomValues_436a51d0629d84e1: function() { return handleError(function (arg0, arg1) {
|
|
120
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
121
|
+
}, arguments); },
|
|
122
|
+
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
123
|
+
arg0.getRandomValues(arg1);
|
|
124
|
+
}, arguments); },
|
|
125
|
+
__wbg_length_7f3c00c40364105e: function(arg0) {
|
|
126
|
+
const ret = arg0.length;
|
|
127
|
+
return ret;
|
|
128
|
+
},
|
|
129
|
+
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
|
|
130
|
+
const ret = arg0.msCrypto;
|
|
131
|
+
return ret;
|
|
132
|
+
},
|
|
133
|
+
__wbg_new_with_length_3da0ad195f6f63ba: function(arg0) {
|
|
134
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
135
|
+
return ret;
|
|
136
|
+
},
|
|
137
|
+
__wbg_node_84ea875411254db1: function(arg0) {
|
|
138
|
+
const ret = arg0.node;
|
|
139
|
+
return ret;
|
|
140
|
+
},
|
|
141
|
+
__wbg_now_aa4ccb83129e9e55: function() {
|
|
142
|
+
const ret = Date.now();
|
|
143
|
+
return ret;
|
|
144
|
+
},
|
|
145
|
+
__wbg_process_44c7a14e11e9f69e: function(arg0) {
|
|
146
|
+
const ret = arg0.process;
|
|
147
|
+
return ret;
|
|
148
|
+
},
|
|
149
|
+
__wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
|
|
150
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
151
|
+
},
|
|
152
|
+
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
153
|
+
arg0.randomFillSync(arg1);
|
|
154
|
+
}, arguments); },
|
|
155
|
+
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
|
|
156
|
+
const ret = module.require;
|
|
157
|
+
return ret;
|
|
158
|
+
}, arguments); },
|
|
159
|
+
__wbg_static_accessor_GLOBAL_266715b9d96ba635: function() {
|
|
160
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
161
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
162
|
+
},
|
|
163
|
+
__wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179: function() {
|
|
164
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
165
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
166
|
+
},
|
|
167
|
+
__wbg_static_accessor_SELF_0b583911f537483a: function() {
|
|
168
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
169
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
170
|
+
},
|
|
171
|
+
__wbg_static_accessor_WINDOW_d7f903d1508cbdc4: function() {
|
|
172
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
173
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
174
|
+
},
|
|
175
|
+
__wbg_subarray_002b94d5e13d1411: function(arg0, arg1, arg2) {
|
|
176
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
177
|
+
return ret;
|
|
178
|
+
},
|
|
179
|
+
__wbg_versions_276b2795b1c6a219: function(arg0) {
|
|
180
|
+
const ret = arg0.versions;
|
|
181
|
+
return ret;
|
|
182
|
+
},
|
|
183
|
+
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
184
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
185
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
186
|
+
return ret;
|
|
187
|
+
},
|
|
188
|
+
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
189
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
190
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
191
|
+
return ret;
|
|
192
|
+
},
|
|
193
|
+
__wbindgen_init_externref_table: function() {
|
|
194
|
+
const table = wasm.__wbindgen_externrefs;
|
|
195
|
+
const offset = table.grow(4);
|
|
196
|
+
table.set(0, undefined);
|
|
197
|
+
table.set(offset + 0, undefined);
|
|
198
|
+
table.set(offset + 1, null);
|
|
199
|
+
table.set(offset + 2, true);
|
|
200
|
+
table.set(offset + 3, false);
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
return {
|
|
204
|
+
__proto__: null,
|
|
205
|
+
"./canon_mls_wasm_bg.js": import0,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function addToExternrefTable0(obj) {
|
|
210
|
+
const idx = wasm.__externref_table_alloc();
|
|
211
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
212
|
+
return idx;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
216
|
+
ptr = ptr >>> 0;
|
|
217
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function getStringFromWasm0(ptr, len) {
|
|
221
|
+
return decodeText(ptr >>> 0, len);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
let cachedUint8ArrayMemory0 = null;
|
|
225
|
+
function getUint8ArrayMemory0() {
|
|
226
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
227
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
228
|
+
}
|
|
229
|
+
return cachedUint8ArrayMemory0;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function handleError(f, args) {
|
|
233
|
+
try {
|
|
234
|
+
return f.apply(this, args);
|
|
235
|
+
} catch (e) {
|
|
236
|
+
const idx = addToExternrefTable0(e);
|
|
237
|
+
wasm.__wbindgen_exn_store(idx);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function isLikeNone(x) {
|
|
242
|
+
return x === undefined || x === null;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
246
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
247
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
248
|
+
WASM_VECTOR_LEN = arg.length;
|
|
249
|
+
return ptr;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
253
|
+
cachedTextDecoder.decode();
|
|
254
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
255
|
+
let numBytesDecoded = 0;
|
|
256
|
+
function decodeText(ptr, len) {
|
|
257
|
+
numBytesDecoded += len;
|
|
258
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
259
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
260
|
+
cachedTextDecoder.decode();
|
|
261
|
+
numBytesDecoded = len;
|
|
262
|
+
}
|
|
263
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
let WASM_VECTOR_LEN = 0;
|
|
267
|
+
|
|
268
|
+
let wasmModule, wasmInstance, wasm;
|
|
269
|
+
function __wbg_finalize_init(instance, module) {
|
|
270
|
+
wasmInstance = instance;
|
|
271
|
+
wasm = instance.exports;
|
|
272
|
+
wasmModule = module;
|
|
273
|
+
cachedUint8ArrayMemory0 = null;
|
|
274
|
+
wasm.__wbindgen_start();
|
|
275
|
+
return wasm;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
async function __wbg_load(module, imports) {
|
|
279
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
280
|
+
if (!module.ok) {
|
|
281
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
285
|
+
try {
|
|
286
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
287
|
+
} catch (e) {
|
|
288
|
+
const validResponse = expectedResponseType(module.type);
|
|
289
|
+
|
|
290
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
291
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
292
|
+
|
|
293
|
+
} else { throw e; }
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const bytes = await module.arrayBuffer();
|
|
298
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
299
|
+
} else {
|
|
300
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
301
|
+
|
|
302
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
303
|
+
return { instance, module };
|
|
304
|
+
} else {
|
|
305
|
+
return instance;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function expectedResponseType(type) {
|
|
310
|
+
switch (type) {
|
|
311
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
312
|
+
}
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function initSync(module) {
|
|
318
|
+
if (wasm !== undefined) return wasm;
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
if (module !== undefined) {
|
|
322
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
323
|
+
({module} = module)
|
|
324
|
+
} else {
|
|
325
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const imports = __wbg_get_imports();
|
|
330
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
331
|
+
module = new WebAssembly.Module(module);
|
|
332
|
+
}
|
|
333
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
334
|
+
return __wbg_finalize_init(instance, module);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
async function __wbg_init(module_or_path) {
|
|
338
|
+
if (wasm !== undefined) return wasm;
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
if (module_or_path !== undefined) {
|
|
342
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
343
|
+
({module_or_path} = module_or_path)
|
|
344
|
+
} else {
|
|
345
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (module_or_path === undefined) {
|
|
350
|
+
module_or_path = new URL('canon_mls_wasm_bg.wasm', import.meta.url);
|
|
351
|
+
}
|
|
352
|
+
const imports = __wbg_get_imports();
|
|
353
|
+
|
|
354
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
355
|
+
module_or_path = fetch(module_or_path);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
359
|
+
|
|
360
|
+
return __wbg_finalize_init(instance, module);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|