@canonmsg/agent-sdk 12.1.0 → 12.2.1
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/dist/chunks/{chunk-QZ4PPRQW.js → chunk-FCG2Z57F.js} +79 -248
- package/dist/chunks/{chunk-7N6OPPW4.js → chunk-J63YVAKA.js} +13 -16
- package/dist/chunks/{chunk-N722GWCP.js → chunk-LFTYXZUY.js} +19 -7
- package/dist/chunks/{mls-crypto-LMNQZOS6.js → mls-crypto-ITVGUEP7.js} +1 -1
- package/dist/cli.js +4 -5
- package/dist/index.js +3 -3
- package/dist/internal/backend-contracts/clientFloor.d.ts +12 -1
- package/dist/internal/backend-contracts/endpoint.d.ts +1 -1
- package/dist/internal/backend-contracts/message.d.ts +1 -1
- package/dist/internal/backend-contracts/mlsDevEnrollment.d.ts +3 -0
- package/dist/internal/backend-contracts/mlsPrincipalAlias.d.ts +3 -0
- package/dist/internal/backend-contracts/runtimeCardFields.d.ts +0 -4
- package/dist/internal/backend-contracts/verbContract.d.ts +8 -12
- package/dist/internal/backend-contracts/verbSchemas.d.ts +3 -4
- package/dist/internal/core/client.d.ts +2 -97
- package/dist/internal/core/endpoint-client.d.ts +2 -2
- package/dist/internal/core/index.d.ts +2 -4
- package/dist/internal/core/turn-verbosity.d.ts +5 -11
- package/dist/internal/core/types.d.ts +0 -181
- package/dist/media.js +2 -2
- package/dist/runner/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/internal/core/stream.d.ts +0 -78
|
@@ -141,25 +141,6 @@ export interface CanonConversation {
|
|
|
141
141
|
activeCall?: CanonActiveCallSummary | null;
|
|
142
142
|
createdAt: string;
|
|
143
143
|
}
|
|
144
|
-
/** Opt-in paging for `GET /conversations`. Omit both fields for the full list. */
|
|
145
|
-
export interface CanonConversationsPageOptions {
|
|
146
|
-
/** Page size, 1..100 (server default 50 when the parameter is present). */
|
|
147
|
-
limit?: number;
|
|
148
|
-
/** Cursor from a previous page's `nextBefore`. */
|
|
149
|
-
before?: string;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* One page of conversations. Pages are cut in conversation-id order (stable
|
|
153
|
-
* under live traffic); each page's array is still sorted most-recent-first
|
|
154
|
-
* *within the page*, so concatenating pages is not globally recency-sorted.
|
|
155
|
-
* `nextBefore` is null when the sweep is exhausted — a short page is not a
|
|
156
|
-
* reliable end signal, because hidden conversations are filtered after the
|
|
157
|
-
* page is read.
|
|
158
|
-
*/
|
|
159
|
-
export interface CanonConversationsPage {
|
|
160
|
-
conversations: CanonConversation[];
|
|
161
|
-
nextBefore: string | null;
|
|
162
|
-
}
|
|
163
144
|
export interface CanonMessagesPage {
|
|
164
145
|
messages: CanonMessage[];
|
|
165
146
|
nextBefore?: string | null;
|
|
@@ -185,34 +166,9 @@ export interface CanonRuntimeProvenance {
|
|
|
185
166
|
type?: CanonSelfContext['type'] | string | null;
|
|
186
167
|
} | null;
|
|
187
168
|
}
|
|
188
|
-
/**
|
|
189
|
-
* Outcome of `CanonClient.addMember` / `agent.addMember`. The REST endpoint
|
|
190
|
-
* returns 201 on immediate add and 202 when a group invite is waiting for
|
|
191
|
-
* policy approval.
|
|
192
|
-
* Both are success from the protocol's perspective — distinct outcomes for
|
|
193
|
-
* the caller.
|
|
194
|
-
*/
|
|
195
|
-
export type AddMemberResult = {
|
|
196
|
-
status: 'added';
|
|
197
|
-
} | {
|
|
198
|
-
status: 'pending';
|
|
199
|
-
requestId: string;
|
|
200
|
-
};
|
|
201
169
|
export type ContactSource = 'direct_add' | 'phone_book' | 'contact_request' | 'link' | 'qr' | 'group' | 'open_inbound_message'
|
|
202
170
|
/** Sentinel value emitted by stream-service when a doc lacks a source field. */
|
|
203
171
|
| 'unknown';
|
|
204
|
-
/** A single entry from the agent's `users/{agentId}/contacts/` subcollection. */
|
|
205
|
-
export interface CanonContact {
|
|
206
|
-
/** The contact's userId. */
|
|
207
|
-
id: string;
|
|
208
|
-
source: ContactSource;
|
|
209
|
-
addedAt: string | null;
|
|
210
|
-
displayNameOverride: string | null;
|
|
211
|
-
}
|
|
212
|
-
export type ContactAddedPayload = CanonContact;
|
|
213
|
-
export type ContactRemovedPayload = {
|
|
214
|
-
id: string;
|
|
215
|
-
};
|
|
216
172
|
export type ResolvedAdmissionState = 'self' | 'not-found' | 'allowed' | 'request-required' | 'pending-outbound' | 'blocked' | 'inactive';
|
|
217
173
|
export interface ResolvedAdmissionTargetSummary {
|
|
218
174
|
id: string;
|
|
@@ -236,13 +192,6 @@ export interface ResolvedTargetAdmissionPayload {
|
|
|
236
192
|
blockedByViewer?: boolean;
|
|
237
193
|
blockedByTarget?: boolean;
|
|
238
194
|
}
|
|
239
|
-
export type ResolveAdmissionTargetInput = {
|
|
240
|
-
targetUserId: string;
|
|
241
|
-
canonContactId?: never;
|
|
242
|
-
} | {
|
|
243
|
-
canonContactId: string;
|
|
244
|
-
targetUserId?: never;
|
|
245
|
-
};
|
|
246
195
|
export interface CanonResolveAdmissionResult {
|
|
247
196
|
resolvedTargetUserId?: string | null;
|
|
248
197
|
target: ResolvedAdmissionTargetSummary | null;
|
|
@@ -591,29 +540,6 @@ export interface MessageCreatedPayload {
|
|
|
591
540
|
contactCard?: ContactCardPayload;
|
|
592
541
|
};
|
|
593
542
|
}
|
|
594
|
-
export interface MessageUpdatedPayload {
|
|
595
|
-
conversationId: string;
|
|
596
|
-
messageId: string;
|
|
597
|
-
actorId?: string;
|
|
598
|
-
updatedAt?: string;
|
|
599
|
-
changes: {
|
|
600
|
-
reactions?: Record<string, string[]>;
|
|
601
|
-
/** Canonical ready attachments after asynchronous media processing. */
|
|
602
|
-
attachments?: MediaAttachment[];
|
|
603
|
-
[key: string]: unknown;
|
|
604
|
-
};
|
|
605
|
-
}
|
|
606
|
-
export interface TypingPayload {
|
|
607
|
-
conversationId: string;
|
|
608
|
-
userId: string;
|
|
609
|
-
isTyping: boolean;
|
|
610
|
-
status?: 'thinking' | 'typing';
|
|
611
|
-
timestamp?: number;
|
|
612
|
-
}
|
|
613
|
-
export interface PresencePayload {
|
|
614
|
-
userId: string;
|
|
615
|
-
online: boolean;
|
|
616
|
-
}
|
|
617
543
|
export interface RuntimeUpdatedPayload {
|
|
618
544
|
conversationId: string;
|
|
619
545
|
agentId: string;
|
|
@@ -621,61 +547,6 @@ export interface RuntimeUpdatedPayload {
|
|
|
621
547
|
runtimeInfo?: RuntimeInfoPayload | null;
|
|
622
548
|
agentSession: AgentSessionSnapshot | null;
|
|
623
549
|
}
|
|
624
|
-
export interface TurnUpdatedPayload {
|
|
625
|
-
conversationId: string;
|
|
626
|
-
agentId: string;
|
|
627
|
-
turn: import('./turn-protocol.js').TurnState | null;
|
|
628
|
-
}
|
|
629
|
-
/**
|
|
630
|
-
* Observe-only notice that the participation gate suppressed a turn this
|
|
631
|
-
* agent would otherwise have been dispatched (cap reached, mention required,
|
|
632
|
-
* agent-to-agent disabled). Hosts must not run a turn off this event; it
|
|
633
|
-
* exists so a benched agent can tell deliberate policy from a dead stream.
|
|
634
|
-
*/
|
|
635
|
-
export interface ParticipationSuppressedPayload {
|
|
636
|
-
conversationId: string;
|
|
637
|
-
/** The triggering message whose dispatch was suppressed. */
|
|
638
|
-
messageId: string;
|
|
639
|
-
/** Machine code, e.g. 'agent_turn_limit_reached' | 'group_mention_required'. */
|
|
640
|
-
reasonCode: string;
|
|
641
|
-
/** Human-readable form of the same reason. */
|
|
642
|
-
reason: string;
|
|
643
|
-
/** ISO timestamp stamped by stream-service at suppression time. */
|
|
644
|
-
suppressedAt: string;
|
|
645
|
-
}
|
|
646
|
-
export type RuntimeControlEventKind = 'interaction_response' | 'session' | 'signal' | 'primitive' | 'runtimeInput' | 'runtimeCard' | 'runtimeApproval';
|
|
647
|
-
export interface RuntimeControlEventPayload {
|
|
648
|
-
conversationId: string;
|
|
649
|
-
agentId: string;
|
|
650
|
-
kind: RuntimeControlEventKind;
|
|
651
|
-
requestId?: string;
|
|
652
|
-
updatedAt?: number;
|
|
653
|
-
value: Record<string, unknown>;
|
|
654
|
-
/** Conversation-scoped reply capability for an accepted interaction receipt. */
|
|
655
|
-
replyAuthority?: import('../backend-contracts/index.js').AgentReplyAuthorityV1;
|
|
656
|
-
}
|
|
657
|
-
export interface CanonMembershipChange {
|
|
658
|
-
addedMemberIds: string[];
|
|
659
|
-
removedMemberIds: string[];
|
|
660
|
-
memberCount: number;
|
|
661
|
-
}
|
|
662
|
-
export interface ConversationUpdatedPayload {
|
|
663
|
-
conversationId: string;
|
|
664
|
-
changes: Record<string, unknown>;
|
|
665
|
-
membershipChange?: CanonMembershipChange;
|
|
666
|
-
}
|
|
667
|
-
export interface VoiceSessionEventPayload {
|
|
668
|
-
conversationId: string;
|
|
669
|
-
session: CanonVoiceSession;
|
|
670
|
-
/**
|
|
671
|
-
* True when this call targets the receiving agent (runtime_voice aimed at
|
|
672
|
-
* it). Voice events are conversation-scoped — group and human-mode calls
|
|
673
|
-
* arrive with targetsMe false; never auto-join on a bare 'started'.
|
|
674
|
-
* Absent on streams older than the media/video rollout: treat as targeted
|
|
675
|
-
* (the legacy filter only delivered targeted sessions).
|
|
676
|
-
*/
|
|
677
|
-
targetsMe?: boolean;
|
|
678
|
-
}
|
|
679
550
|
export interface SendMessageOptions {
|
|
680
551
|
messageId?: string;
|
|
681
552
|
contentType?: 'text' | 'audio' | 'image' | 'video' | 'file' | 'contact_card';
|
|
@@ -692,13 +563,6 @@ export interface SendMessageOptions {
|
|
|
692
563
|
/** Trusted transport context injected by the host, never by the model. */
|
|
693
564
|
replyAuthority?: import('../backend-contracts/index.js').AgentReplyAuthorityV1;
|
|
694
565
|
}
|
|
695
|
-
export interface CreateGroupOptions {
|
|
696
|
-
memberIds: string[];
|
|
697
|
-
name: string;
|
|
698
|
-
}
|
|
699
|
-
export interface CreateGroupResult {
|
|
700
|
-
conversationId: string;
|
|
701
|
-
}
|
|
702
566
|
export type CanonVoiceSessionMode = 'human' | 'runtime_voice';
|
|
703
567
|
export type CanonVoiceSessionStatus = 'active' | 'ended' | 'error';
|
|
704
568
|
/** Call media. Absent anywhere in the wire always means 'audio'. */
|
|
@@ -746,51 +610,6 @@ export interface CanonVoiceSessionToken {
|
|
|
746
610
|
targetAgentId?: string | null;
|
|
747
611
|
expiresAt: string;
|
|
748
612
|
}
|
|
749
|
-
export interface CreateVoiceSessionOptions {
|
|
750
|
-
conversationId: string;
|
|
751
|
-
targetAgentId?: string | null;
|
|
752
|
-
/** Requested call media; the server defaults absent/unknown to 'audio'. */
|
|
753
|
-
media?: CanonVoiceSessionMedia;
|
|
754
|
-
}
|
|
755
|
-
export interface CreateMemoStreamOptions {
|
|
756
|
-
conversationId: string;
|
|
757
|
-
/** v1 accepts 'wav' only (byte-append decodable and seekable everywhere). */
|
|
758
|
-
container: 'wav';
|
|
759
|
-
codec: {
|
|
760
|
-
mimeType: string;
|
|
761
|
-
sampleRate: number;
|
|
762
|
-
channels: number;
|
|
763
|
-
bitsPerSample: number;
|
|
764
|
-
};
|
|
765
|
-
/** Byte offset of PCM data in the sender's file (RIFF headers precede it). */
|
|
766
|
-
dataOffset?: number;
|
|
767
|
-
/** Pre-allocated durable message id, for the live→durable timeline handoff. */
|
|
768
|
-
messageId?: string | null;
|
|
769
|
-
}
|
|
770
|
-
export interface CreateMemoStreamResult {
|
|
771
|
-
streamId: string;
|
|
772
|
-
bucket: string;
|
|
773
|
-
}
|
|
774
|
-
export interface AppendMemoStreamChunkOptions {
|
|
775
|
-
/** Zero-based, strictly sequential. Retries of the last chunk are acked. */
|
|
776
|
-
seq: number;
|
|
777
|
-
/** Base64 chunk bytes; may be empty when only carrying the final marker. */
|
|
778
|
-
data: string;
|
|
779
|
-
/** Normalized 0..1 amplitude bars for live waveforms. */
|
|
780
|
-
peaks?: number[];
|
|
781
|
-
/** Running duration of the recording in milliseconds. */
|
|
782
|
-
durationMs?: number;
|
|
783
|
-
/** Marks the recording finished; the stream leaves the live window. */
|
|
784
|
-
final?: boolean;
|
|
785
|
-
}
|
|
786
|
-
export interface MemoStreamChunkAck {
|
|
787
|
-
chunkCount: number;
|
|
788
|
-
totalBytes: number;
|
|
789
|
-
applied: boolean;
|
|
790
|
-
}
|
|
791
|
-
export interface JoinVoiceSessionOptions {
|
|
792
|
-
conversationId: string;
|
|
793
|
-
}
|
|
794
613
|
export type StreamingStatus = 'thinking' | 'streaming' | 'tool' | 'waiting_input';
|
|
795
614
|
export interface SetStreamingOptions {
|
|
796
615
|
conversationId: string;
|
package/dist/media.js
CHANGED
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
toAnthropicImageBlock,
|
|
19
19
|
toAnthropicImageBlocksWithinBudget,
|
|
20
20
|
uploadMediaFile
|
|
21
|
-
} from "./chunks/chunk-
|
|
22
|
-
import "./chunks/chunk-
|
|
21
|
+
} from "./chunks/chunk-FCG2Z57F.js";
|
|
22
|
+
import "./chunks/chunk-J63YVAKA.js";
|
|
23
23
|
export {
|
|
24
24
|
DEFAULT_ANTHROPIC_REQUEST_HEADROOM_BYTES,
|
|
25
25
|
DEFAULT_MEDIA_CACHE_DIR,
|
package/dist/runner/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { MediaAttachment } from '../internal/core/index.js';
|
|
|
5
5
|
* the claude and codex drivers pass the conformance suite.
|
|
6
6
|
*/
|
|
7
7
|
export interface RuntimeDriver {
|
|
8
|
-
readonly name: 'code' | 'claude' | 'codex' | '
|
|
8
|
+
readonly name: 'code' | 'claude' | 'codex' | 'connector';
|
|
9
9
|
/** Input to the generated runtime descriptor; never a static table. */
|
|
10
10
|
readonly capabilities: DriverCapabilities;
|
|
11
11
|
runTurn(turn: DriverTurn): Promise<DriverResult>;
|
package/package.json
CHANGED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type { CanonEndpoint } from './endpoint-client.js';
|
|
2
|
-
import type { AgentContext, ContactAddedPayload, ContactRemovedPayload, ConversationUpdatedPayload, MessageCreatedPayload, MessageUpdatedPayload, TypingPayload, PresencePayload, RuntimeUpdatedPayload, RuntimeControlEventPayload, TurnUpdatedPayload, ParticipationSuppressedPayload, VoiceSessionEventPayload } from './types.js';
|
|
3
|
-
export interface CanonStreamErrorPayload {
|
|
4
|
-
code?: string;
|
|
5
|
-
message?: string;
|
|
6
|
-
retryAfterMs?: number;
|
|
7
|
-
activeConnections?: number;
|
|
8
|
-
maxConnections?: number;
|
|
9
|
-
[key: string]: unknown;
|
|
10
|
-
}
|
|
11
|
-
export interface ReplayExpiredPayload {
|
|
12
|
-
/** Oldest event id still available in the server's replay buffer, if any. */
|
|
13
|
-
lastAvailableId?: string | null;
|
|
14
|
-
message?: string;
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
}
|
|
17
|
-
export declare class CanonStreamError extends Error {
|
|
18
|
-
readonly code?: string;
|
|
19
|
-
readonly retryAfterMs?: number;
|
|
20
|
-
readonly payload: CanonStreamErrorPayload;
|
|
21
|
-
constructor(payload: CanonStreamErrorPayload, fallbackMessage: string);
|
|
22
|
-
}
|
|
23
|
-
export type StreamHandler = {
|
|
24
|
-
onMessage: (payload: MessageCreatedPayload) => void;
|
|
25
|
-
onMessageUpdated?: (payload: MessageUpdatedPayload) => void;
|
|
26
|
-
onAgentContext?: (ctx: AgentContext) => void;
|
|
27
|
-
onContactAdded?: (payload: ContactAddedPayload) => void;
|
|
28
|
-
onContactRemoved?: (payload: ContactRemovedPayload) => void;
|
|
29
|
-
onTyping?: (data: TypingPayload) => void;
|
|
30
|
-
onPresence?: (data: PresencePayload) => void;
|
|
31
|
-
onRuntimeUpdated?: (payload: RuntimeUpdatedPayload) => void;
|
|
32
|
-
onTurnUpdated?: (payload: TurnUpdatedPayload) => void;
|
|
33
|
-
/** Observe-only: the participation gate suppressed a turn for this agent. */
|
|
34
|
-
onParticipationSuppressed?: (payload: ParticipationSuppressedPayload) => void;
|
|
35
|
-
onRuntimeControl?: (payload: RuntimeControlEventPayload) => void;
|
|
36
|
-
onVoiceSessionStarted?: (payload: VoiceSessionEventPayload) => void;
|
|
37
|
-
onVoiceSessionEnded?: (payload: VoiceSessionEventPayload) => void;
|
|
38
|
-
onMessageDeleted?: (payload: {
|
|
39
|
-
conversationId: string;
|
|
40
|
-
messageId: string;
|
|
41
|
-
}) => void;
|
|
42
|
-
onConversationUpdated?: (payload: ConversationUpdatedPayload) => void;
|
|
43
|
-
onConnected?: () => void;
|
|
44
|
-
onDisconnected?: () => void;
|
|
45
|
-
/**
|
|
46
|
-
* Fired when the server reports the replay window expired (`replay.expired`):
|
|
47
|
-
* the reconnect cursor was evicted, so events in the gap were NOT replayed
|
|
48
|
-
* and must be recovered out-of-band (e.g. via the REST API). The transport
|
|
49
|
-
* stays policy-free — it only clears its cursor and surfaces the expiry.
|
|
50
|
-
*
|
|
51
|
-
* When this handler is provided it REPLACES the synthetic
|
|
52
|
-
* `Replay expired — some messages may have been missed` error on `onError`;
|
|
53
|
-
* raw consumers that only register `onError` keep the existing behavior.
|
|
54
|
-
*/
|
|
55
|
-
onReplayExpired?: (payload: ReplayExpiredPayload) => void;
|
|
56
|
-
/** `conversationId` names the room when endpoint recovery failed for one. */
|
|
57
|
-
onError?: (error: Error, conversationId?: string) => void;
|
|
58
|
-
};
|
|
59
|
-
/** Typed agent event projection; the endpoint owns authentication, SSE and reconnect. */
|
|
60
|
-
export declare class CanonStream {
|
|
61
|
-
private readonly endpoint;
|
|
62
|
-
private readonly agentId;
|
|
63
|
-
private readonly handler;
|
|
64
|
-
private unsubscribe?;
|
|
65
|
-
private releaseRecovery?;
|
|
66
|
-
private running;
|
|
67
|
-
private generation;
|
|
68
|
-
private resolveStopped?;
|
|
69
|
-
constructor(options: {
|
|
70
|
-
endpoint: CanonEndpoint;
|
|
71
|
-
agentId: string;
|
|
72
|
-
handler: StreamHandler;
|
|
73
|
-
});
|
|
74
|
-
start(): Promise<void>;
|
|
75
|
-
private forwardPlaintextMessage;
|
|
76
|
-
stop(): void;
|
|
77
|
-
isRunning(): boolean;
|
|
78
|
-
}
|