@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
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
import { type CanonMessage, type CanonConversation, type CanonUnifiedDiff, type
|
|
2
|
-
import type { CanonGifSearchOptions, CanonGifSearchResponse } from './gifs.js';
|
|
1
|
+
import { type CanonMessage, type CanonConversation, type CanonUnifiedDiff, type CanonMessagesPage, type AgentContext, type MediaAttachment, type SendMessageOptions, type RegistrationStatus, type AgentOriginDeclaration, type SetRuntimeTurnOptions, type SetStreamingOptions } from './types.js';
|
|
3
2
|
import type { RuntimeInputKind } from './runtime-cards.js';
|
|
4
3
|
import type { ApprovalNativeRequestMetadata, ApprovalRequestCategory, ApprovalRequestDetail, ApprovalRisk, SessionRule } from './approval-types.js';
|
|
5
4
|
import type { RuntimeInputAnswers, RuntimeInputChoice, RuntimeInputNativeMetadata, RuntimeInputQuestion, RuntimeCardNativeMetadata, RuntimeCardV1 } from './runtime-cards.js';
|
|
6
5
|
import type { InboundDisposition } from './turn-protocol.js';
|
|
7
|
-
import { type CanonVerbWireRequest, type CanonVerbWireResponse, type CommunicateInput, type CommunicateResult, type DiscoverAgentsInput, type DiscoverAgentsResult
|
|
8
|
-
import type { WorkSessionRuntimeRegistration, WorkSessionRuntimeState, WorkSessionHeartbeatInput, WorkSessionRuntimeAuth, WorkSessionClaimInput, WorkSessionClaimResult, CompleteWorkSessionInput, WorkSessionRequest, ReleaseWorkSessionBindingInput, WorkSessionReportInput } from '../backend-contracts/index.js';
|
|
6
|
+
import { type CanonVerbWireRequest, type CanonVerbWireResponse, type CommunicateInput, type CommunicateResult, type DiscoverAgentsInput, type DiscoverAgentsResult } from '../backend-contracts/index.js';
|
|
9
7
|
import { type EndpointOperation } from '../endpoint/index.js';
|
|
10
8
|
import { type CanonClientEndpointOptions, type CanonEndpoint } from './endpoint-client.js';
|
|
11
|
-
import { type CanonConversationArtifacts } from './artifacts.js';
|
|
12
|
-
export interface ResumableMediaUploadSession {
|
|
13
|
-
uploadId: string;
|
|
14
|
-
/** Private bearer capability returned by Cloud Storage. Do not persist or log it. */
|
|
15
|
-
uploadUrl: string;
|
|
16
|
-
expiresAt: string;
|
|
17
|
-
sizeBytes: number;
|
|
18
|
-
mimeType: string;
|
|
19
|
-
}
|
|
20
9
|
export interface ResumableMediaUploadResult {
|
|
21
10
|
uploadId: string;
|
|
22
11
|
url: string;
|
|
@@ -28,18 +17,6 @@ export interface ResumableMediaUploadResult {
|
|
|
28
17
|
* operator registration remain outside the conversation protocol.
|
|
29
18
|
*/
|
|
30
19
|
export declare class CanonClient {
|
|
31
|
-
private workSessionRequest;
|
|
32
|
-
registerWorkSessionRuntime(input: WorkSessionRuntimeRegistration): Promise<WorkSessionRuntimeState>;
|
|
33
|
-
heartbeatWorkSessionRuntime(input: WorkSessionHeartbeatInput): Promise<WorkSessionRuntimeState>;
|
|
34
|
-
releaseWorkSessionRuntime(input: WorkSessionRuntimeAuth): Promise<{
|
|
35
|
-
released: boolean;
|
|
36
|
-
}>;
|
|
37
|
-
claimWorkSessionRequest(input: WorkSessionClaimInput): Promise<WorkSessionClaimResult>;
|
|
38
|
-
completeWorkSessionRequest(input: CompleteWorkSessionInput): Promise<WorkSessionRequest>;
|
|
39
|
-
releaseWorkSessionBinding(input: ReleaseWorkSessionBindingInput): Promise<WorkSessionRuntimeState>;
|
|
40
|
-
reportWorkSessionDetails(input: WorkSessionReportInput): Promise<{
|
|
41
|
-
reportedAt: number;
|
|
42
|
-
}>;
|
|
43
20
|
private baseUrl;
|
|
44
21
|
private apiKey;
|
|
45
22
|
private endpointOptions;
|
|
@@ -49,16 +26,6 @@ export declare class CanonClient {
|
|
|
49
26
|
constructor(apiKey: string, baseUrl?: string, options?: CanonClientEndpointOptions);
|
|
50
27
|
/** All durable communication shares this installation's engine and journal. */
|
|
51
28
|
getEndpoint(): Promise<CanonEndpoint>;
|
|
52
|
-
/** Last-seen snapshots and participant names for shared work, per conversation. */
|
|
53
|
-
private readonly artifactMemory;
|
|
54
|
-
/**
|
|
55
|
-
* Shared work bound to one conversation. Cheap to create: replay state lives
|
|
56
|
-
* in the endpoint and "last seen" snapshots on this client, so every room
|
|
57
|
-
* object for the same conversation shares them.
|
|
58
|
-
*/
|
|
59
|
-
artifacts(conversationId: string): CanonConversationArtifacts;
|
|
60
|
-
/** Seed participant names used by shared-work views (for example an inbound message's sender). */
|
|
61
|
-
rememberParticipantNames(conversationId: string, names: Record<string, string | null | undefined>): void;
|
|
62
29
|
close(): Promise<void>;
|
|
63
30
|
getFileMediaPipeline(fetchImpl?: typeof fetch): Promise<import("../endpoint/index.js").EndpointMediaPipeline<string>>;
|
|
64
31
|
waitForOperation<T>(operationId: string, options?: {
|
|
@@ -69,41 +36,12 @@ export declare class CanonClient {
|
|
|
69
36
|
private endpointQuery;
|
|
70
37
|
private endpointPublish;
|
|
71
38
|
private authHeaders;
|
|
72
|
-
getAuthToken(): Promise<{
|
|
73
|
-
token: string;
|
|
74
|
-
expiresAt: string;
|
|
75
|
-
agentId: string;
|
|
76
|
-
}>;
|
|
77
39
|
getAgentMe(): Promise<AgentContext>;
|
|
78
40
|
discoverAgents(input?: DiscoverAgentsInput): Promise<DiscoverAgentsResult>;
|
|
79
|
-
updateAgentProfile(options: UpdateAgentProfileOptions): Promise<void>;
|
|
80
|
-
rotateAgentKey(): Promise<{
|
|
81
|
-
apiKey: string;
|
|
82
|
-
}>;
|
|
83
|
-
/**
|
|
84
|
-
* List conversations. Called with no options this is the historical request —
|
|
85
|
-
* no query string, every conversation the agent belongs to, most recent
|
|
86
|
-
* first. Passing `limit`/`before` opts into paging; use
|
|
87
|
-
* `getConversationsPage` when you need the cursor back.
|
|
88
|
-
*/
|
|
89
|
-
getConversations(options?: CanonConversationsPageOptions): Promise<CanonConversation[]>;
|
|
90
|
-
/**
|
|
91
|
-
* One page of conversations plus the cursor to continue from. Pages are cut
|
|
92
|
-
* in conversation-id order; keep calling with `before: page.nextBefore` until
|
|
93
|
-
* `nextBefore` is null. Do not stop on an empty page and do not derive the
|
|
94
|
-
* cursor from the returned array — the array is recency-sorted within the
|
|
95
|
-
* page and hidden conversations are filtered after the page is read.
|
|
96
|
-
*/
|
|
97
|
-
getConversationsPage(options?: CanonConversationsPageOptions): Promise<CanonConversationsPage>;
|
|
98
|
-
private fetchConversationsPage;
|
|
99
41
|
/** Targeted membership read; session hosts must not poll the entire account. */
|
|
100
42
|
getConversation(conversationId: string): Promise<CanonConversation | null>;
|
|
101
|
-
/** Stream and snapshot producers share the engine's monotonic roster merge. */
|
|
102
|
-
rememberConversation(conversation: CanonConversation): Promise<CanonConversation>;
|
|
103
43
|
getMessages(conversationId: string, limit?: number, before?: string): Promise<CanonMessage[]>;
|
|
104
44
|
getMessagesPage(conversationId: string, limit?: number, before?: string): Promise<CanonMessagesPage>;
|
|
105
|
-
/** Read one explicitly referenced message without extending ordinary history. */
|
|
106
|
-
getMessage(conversationId: string, messageId: string): Promise<CanonMessage | null>;
|
|
107
45
|
sendMessage(conversationId: string, text: string, options?: SendMessageOptions, delivery?: {
|
|
108
46
|
operationId?: string;
|
|
109
47
|
}): Promise<{
|
|
@@ -121,7 +59,6 @@ export declare class CanonClient {
|
|
|
121
59
|
operationId?: string;
|
|
122
60
|
signal?: AbortSignal;
|
|
123
61
|
replacesOperationId?: string;
|
|
124
|
-
proactive?: boolean;
|
|
125
62
|
}): Promise<{
|
|
126
63
|
id: string;
|
|
127
64
|
sendPart(index: number, options?: {
|
|
@@ -131,44 +68,7 @@ export declare class CanonClient {
|
|
|
131
68
|
messageId: string;
|
|
132
69
|
}>;
|
|
133
70
|
}>;
|
|
134
|
-
/** Publish a native-formatted ordered plan through the same endpoint engine. */
|
|
135
|
-
sendMessageGroup(conversationId: string, messageId: string | null, parts: Array<{
|
|
136
|
-
text: string;
|
|
137
|
-
options: SendMessageOptions;
|
|
138
|
-
}>, delivery?: {
|
|
139
|
-
proactive?: boolean;
|
|
140
|
-
}): Promise<{
|
|
141
|
-
messageId: string;
|
|
142
|
-
messageIds: string[];
|
|
143
|
-
}>;
|
|
144
71
|
cancelMessageGroup(id: string): Promise<void>;
|
|
145
|
-
/**
|
|
146
|
-
* Send outside an active inbound turn through the canonical policy boundary.
|
|
147
|
-
* Harness reply paths should keep using sendMessage; schedulers, notifications,
|
|
148
|
-
* and other detached work must use this method.
|
|
149
|
-
*/
|
|
150
|
-
sendProactiveMessage(conversationId: string, text: string, options?: SendToInput['messageOptions'], delivery?: {
|
|
151
|
-
operationId?: string;
|
|
152
|
-
}): Promise<{
|
|
153
|
-
messageId: string;
|
|
154
|
-
conversationId: string;
|
|
155
|
-
}>;
|
|
156
|
-
/** Inspect the original durable publication before renewing an expired attachment.
|
|
157
|
-
* Pending or uncertain operations must be reconciled before any replacement.
|
|
158
|
-
* A replacement operation ID belongs in the caller's durable product journal;
|
|
159
|
-
* retain the same messageId and use it only after a definitive no-effect rejection.
|
|
160
|
-
*/
|
|
161
|
-
getProactiveMessageOperation(conversationId: string, messageId: string, delivery?: {
|
|
162
|
-
operationId?: string;
|
|
163
|
-
}): Promise<EndpointOperation | undefined>;
|
|
164
|
-
/** Reconcile an existing publication without rebuilding or resubmitting its body. */
|
|
165
|
-
waitForProactiveMessage(operationId: string, options?: {
|
|
166
|
-
signal?: AbortSignal;
|
|
167
|
-
timeoutMs?: number;
|
|
168
|
-
}): Promise<{
|
|
169
|
-
messageId: string;
|
|
170
|
-
conversationId: string;
|
|
171
|
-
}>;
|
|
172
72
|
/**
|
|
173
73
|
* Execute a canonical verb over the wire contract (canon.verb-wire.v1).
|
|
174
74
|
* Bindings build the request with projectVerbIntentToWire; the endpoint
|
|
@@ -190,52 +90,12 @@ export declare class CanonClient {
|
|
|
190
90
|
*/
|
|
191
91
|
communicate(input: CommunicateInput): Promise<CommunicateResult>;
|
|
192
92
|
private executeCommunication;
|
|
193
|
-
|
|
194
|
-
createGroup(options: CreateGroupOptions): Promise<CreateGroupResult>;
|
|
195
|
-
createMemoStream(options: CreateMemoStreamOptions & {
|
|
196
|
-
streamId?: string;
|
|
197
|
-
}): Promise<CreateMemoStreamResult>;
|
|
198
|
-
appendMemoStreamChunk(conversationId: string, streamId: string, options: AppendMemoStreamChunkOptions): Promise<MemoStreamChunkAck>;
|
|
199
|
-
finalizeMemoStream(conversationId: string, streamId: string, messageId: string): Promise<void>;
|
|
200
|
-
abortMemoStream(conversationId: string, streamId: string): Promise<void>;
|
|
201
|
-
createVoiceSession(options: CreateVoiceSessionOptions): Promise<CanonVoiceSessionToken>;
|
|
202
|
-
getVoiceSessionState(conversationId: string, sessionId: string): Promise<{
|
|
203
|
-
session: CanonVoiceSession;
|
|
204
|
-
}>;
|
|
205
|
-
declineVoiceSession(conversationId: string, sessionId: string): Promise<void>;
|
|
206
|
-
joinVoiceSession(conversationId: string, sessionId: string, options?: Omit<JoinVoiceSessionOptions, 'conversationId'>): Promise<CanonVoiceSessionToken>;
|
|
207
|
-
endVoiceSession(conversationId: string, sessionId: string): Promise<void>;
|
|
208
|
-
listContacts(): Promise<CanonContact[]>;
|
|
209
|
-
getContact(contactId: string): Promise<CanonContact | null>;
|
|
210
|
-
deleteContact(contactId: string): Promise<void>;
|
|
93
|
+
private startWithheld;
|
|
211
94
|
blockUser(userId: string): Promise<void>;
|
|
212
|
-
unblockUser(userId: string): Promise<void>;
|
|
213
|
-
resolveAdmission(target: string | ResolveAdmissionTargetInput): Promise<CanonResolveAdmissionResult>;
|
|
214
|
-
uploadMedia(conversationId: string, data: string, mimeType: string, fileName?: string, options?: {
|
|
215
|
-
attachmentId?: string;
|
|
216
|
-
}): Promise<{
|
|
217
|
-
url: string;
|
|
218
|
-
attachment: MediaAttachment;
|
|
219
|
-
}>;
|
|
220
|
-
/**
|
|
221
|
-
* Start a private direct-to-Storage upload. The returned upload URL is a
|
|
222
|
-
* short-lived bearer capability; send exactly `sizeBytes` raw bytes to it,
|
|
223
|
-
* then call `finalizeResumableMediaUpload`.
|
|
224
|
-
*/
|
|
225
|
-
createResumableMediaUpload(conversationId: string, sizeBytes: number, mimeType: string, fileName?: string): Promise<ResumableMediaUploadSession>;
|
|
226
|
-
/** Promote validated pending bytes into a canonical Canon attachment. */
|
|
227
|
-
finalizeResumableMediaUpload(uploadId: string): Promise<ResumableMediaUploadResult>;
|
|
228
|
-
getFeaturedGifs(options?: Omit<CanonGifSearchOptions, 'query'>): Promise<CanonGifSearchResponse>;
|
|
229
|
-
searchGifs(query: string, options?: Omit<CanonGifSearchOptions, 'query'>): Promise<CanonGifSearchResponse>;
|
|
230
|
-
updateTopic(conversationId: string, topic: string): Promise<void>;
|
|
231
95
|
deleteMessage(conversationId: string, messageId: string): Promise<void>;
|
|
232
96
|
updateMessageDisposition(conversationId: string, messageId: string, inboundDisposition: InboundDisposition): Promise<void>;
|
|
233
97
|
markAsRead(conversationId: string): Promise<void>;
|
|
234
|
-
leaveConversation(conversationId: string): Promise<void>;
|
|
235
98
|
react(conversationId: string, messageId: string, emoji: string): Promise<void>;
|
|
236
|
-
updateConversationName(conversationId: string, name: string): Promise<void>;
|
|
237
|
-
addMember(conversationId: string, userId: string): Promise<AddMemberResult>;
|
|
238
|
-
removeMember(conversationId: string, userId: string): Promise<void>;
|
|
239
99
|
setStreaming(options: SetStreamingOptions): Promise<void>;
|
|
240
100
|
clearStreaming(conversationId: string): Promise<void>;
|
|
241
101
|
setRuntimeTurn(options: SetRuntimeTurnOptions): Promise<void>;
|
|
@@ -244,15 +104,6 @@ export declare class CanonClient {
|
|
|
244
104
|
/** Acknowledge exactly the signal observed before the native handler ran. */
|
|
245
105
|
acknowledgeRuntimeSignal(conversationId: string, signalId: string): Promise<Record<string, unknown>>;
|
|
246
106
|
consumeRuntimeSignal(conversationId: string): Promise<Record<string, unknown>>;
|
|
247
|
-
listRuntimePrimitives(conversationId: string): Promise<{
|
|
248
|
-
requests: Record<string, {
|
|
249
|
-
value: unknown;
|
|
250
|
-
revision: string;
|
|
251
|
-
}>;
|
|
252
|
-
}>;
|
|
253
|
-
consumeRuntimePrimitive(conversationId: string, requestId: string, expectedRevision: string): Promise<{
|
|
254
|
-
status: 'consumed' | 'missing' | 'mismatch';
|
|
255
|
-
}>;
|
|
256
107
|
/** Runtime adapters can inspect only their own projection in an admitted room. */
|
|
257
108
|
getRuntimeProjection(family: 'agent-runtime' | 'agent-session' | 'turn-state' | 'runtime-info' | 'runtime-activity' | 'streaming', conversationId?: string): Promise<unknown>;
|
|
258
109
|
publishRuntimeSession(conversationId: string, mode: 'patch' | 'clear', state?: Record<string, unknown>): Promise<void>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createEndpoint, type EndpointMediaBytes, type EndpointMediaPipeline, type MlsDevProtectedPreparer, type MlsDevProtectedKeyPackagePreparer, type MlsDevProtectedGroupPreparer } from '../endpoint/index.js';
|
|
2
2
|
import type { MlsDevClientConfiguration } from '../endpoint/mls-crypto.js';
|
|
3
|
+
import type { CanonClientIdentity } from '../backend-contracts/index.js';
|
|
3
4
|
export type CanonEndpoint = ReturnType<typeof createEndpoint>;
|
|
4
5
|
/** Operator-owned custody. Keep the same object for every shared endpoint lease. */
|
|
5
6
|
export interface CanonMlsDevCustody {
|
|
@@ -12,7 +13,7 @@ export interface CanonMlsDevOptions {
|
|
|
12
13
|
custody: CanonMlsDevCustody;
|
|
13
14
|
}
|
|
14
15
|
export interface CanonClientEndpointOptions {
|
|
15
|
-
/** Explicit synthetic
|
|
16
|
+
/** Explicit synthetic opt-in, bound to its configuration's environment; enrollment remains an operator action. */
|
|
16
17
|
mlsDev?: CanonMlsDevOptions;
|
|
17
18
|
/** Inject an operator-controlled store/engine for replicated or ephemeral hosts. */
|
|
18
19
|
endpoint?: CanonEndpoint;
|
|
@@ -21,6 +22,11 @@ export interface CanonClientEndpointOptions {
|
|
|
21
22
|
streamUrl?: string;
|
|
22
23
|
/** Persistent volume for the engine journal; never use a container temporary directory. */
|
|
23
24
|
stateDirectory?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The engine's installation, for a host whose installation is assigned (the class-C relay's reserved one). A store
|
|
27
|
+
* already opened under another installation refuses to start; without it a new store picks a random installation.
|
|
28
|
+
*/
|
|
29
|
+
installationId?: string;
|
|
24
30
|
mediaDirectory?: string;
|
|
25
31
|
/** Operator inspection/import does not automatically publish queued operations. */
|
|
26
32
|
autoDrain?: boolean;
|
|
@@ -28,6 +34,13 @@ export interface CanonClientEndpointOptions {
|
|
|
28
34
|
mediaBytes?: EndpointMediaBytes<string>;
|
|
29
35
|
/** Test seam for the client's out-of-protocol HTTP (identity, profile); production leaves it unset. */
|
|
30
36
|
fetch?: typeof fetch;
|
|
37
|
+
/**
|
|
38
|
+
* Names this client to Canon's client floor (`X-Canon-Client`, mls-cutover-operator.md §2 15b). The runner and the CLIs
|
|
39
|
+
* pass theirs; a client that names none is refused once a floor exists.
|
|
40
|
+
*/
|
|
41
|
+
client?: CanonClientIdentity;
|
|
42
|
+
/** Canon refused this client as below its floor, on any request or stream (`426 CLIENT_UPDATE_REQUIRED`). */
|
|
43
|
+
onClientUpdateRequired?(error: Error): void;
|
|
31
44
|
}
|
|
32
45
|
export declare function acquireFileMediaPipeline(endpoint: CanonEndpoint, options: CanonClientEndpointOptions, fetchImpl?: typeof fetch): Promise<EndpointMediaPipeline<string>>;
|
|
33
46
|
/** One protocol owner per account, environment and durable profile in this process. */
|
|
@@ -4,5 +4,3 @@
|
|
|
4
4
|
* Node hosts and browser/Expo clients can import these primitives.
|
|
5
5
|
*/
|
|
6
6
|
export type ExecutionEnvironmentMode = 'worktree' | 'locked';
|
|
7
|
-
export declare const EXECUTION_ENVIRONMENT_MODES: readonly ExecutionEnvironmentMode[];
|
|
8
|
-
export declare function isExecutionEnvironmentMode(value: unknown): value is ExecutionEnvironmentMode;
|
|
@@ -17,12 +17,6 @@ export interface CanonGifSearchResponse {
|
|
|
17
17
|
results: CanonGifResult[];
|
|
18
18
|
nextCursor: string | null;
|
|
19
19
|
}
|
|
20
|
-
export interface CanonGifSearchOptions {
|
|
21
|
-
query?: string;
|
|
22
|
-
limit?: number;
|
|
23
|
-
cursor?: string | null;
|
|
24
|
-
locale?: string | null;
|
|
25
|
-
}
|
|
26
20
|
export interface CanonGifMetadata {
|
|
27
21
|
provider: GifProvider;
|
|
28
22
|
id: string;
|
|
@@ -1,36 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { type CanonClient } from './client.js';
|
|
4
|
-
import { type ResolvedAgentBehaviorPolicy } from './policy.js';
|
|
5
|
-
import type { RTDBClientHandle } from './rtdb-rest.js';
|
|
6
|
-
import type { CanonInboundPromptOptions } from './inbound-frame.js';
|
|
7
|
-
export interface HostInboundParticipantContext {
|
|
8
|
-
conversationType: CanonConversation['type'] | 'unknown';
|
|
9
|
-
memberCount: number | null;
|
|
10
|
-
senderType: 'human' | 'ai_agent';
|
|
11
|
-
senderName: string;
|
|
12
|
-
isOwner: boolean;
|
|
13
|
-
mentionedAgent: boolean;
|
|
14
|
-
groupContext?: CanonGroupContext;
|
|
15
|
-
groupContextMode?: CanonGroupContextMode;
|
|
16
|
-
recentSenderTypes: Array<'human' | 'ai_agent'>;
|
|
17
|
-
recentHumanCount: number;
|
|
18
|
-
recentAgentCount: number;
|
|
19
|
-
consecutiveAgentTurns: number;
|
|
20
|
-
currentAgentStreakStartedByHuman: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface AutoReplyDecision {
|
|
23
|
-
allow: boolean;
|
|
24
|
-
reason: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Decide whether a coding host should auto-reply to an inbound message.
|
|
28
|
-
* Thin adapter over {@link evaluateParticipationPolicy}; lives here (not in
|
|
29
|
-
* @canonmsg/coding-agent-host) because it needs core's participation-policy
|
|
30
|
-
* engine and the context type above, and coding-agent-host is deliberately
|
|
31
|
-
* dependency-free.
|
|
32
|
-
*/
|
|
33
|
-
export declare function decideAutoReply(context: HostInboundParticipantContext, behavior?: ResolvedAgentBehaviorPolicy | null): AutoReplyDecision;
|
|
1
|
+
import type { CanonMessage } from './types.js';
|
|
2
|
+
import type { ArtifactContext } from '../backend-contracts/index.js';
|
|
34
3
|
type HostInboundMessage = {
|
|
35
4
|
id?: string | null;
|
|
36
5
|
senderId?: string | null;
|
|
@@ -61,120 +30,6 @@ export interface CanonReplyContext {
|
|
|
61
30
|
replyToPosition?: number | null;
|
|
62
31
|
found: boolean;
|
|
63
32
|
}
|
|
64
|
-
export declare const CANON_TURN_CONTEXT_SCHEMA_V2: "canon.turn.v2";
|
|
65
|
-
export interface CanonTurnContextAttachmentV2 {
|
|
66
|
-
index: number;
|
|
67
|
-
kind: NonNullable<HostInboundMessage['attachments']>[number]['kind'];
|
|
68
|
-
placeholder: string;
|
|
69
|
-
fileName: string | null;
|
|
70
|
-
mimeType: string | null;
|
|
71
|
-
sizeBytes: number | null;
|
|
72
|
-
width: number | null;
|
|
73
|
-
height: number | null;
|
|
74
|
-
durationMs: number | null;
|
|
75
|
-
}
|
|
76
|
-
export interface CanonTurnContextContactCardV2 {
|
|
77
|
-
userId: string;
|
|
78
|
-
canonContactId: string | null;
|
|
79
|
-
displayName: string;
|
|
80
|
-
userType: NonNullable<HostInboundMessage['contactCard']>['userType'];
|
|
81
|
-
ownerName: string | null;
|
|
82
|
-
about: string | null;
|
|
83
|
-
}
|
|
84
|
-
export interface CanonTurnContextReplyContextV2 {
|
|
85
|
-
artifactContext?: ArtifactContext;
|
|
86
|
-
messageId: string;
|
|
87
|
-
found: boolean;
|
|
88
|
-
senderId: string | null;
|
|
89
|
-
senderName: string | null;
|
|
90
|
-
senderType: CanonMessage['senderType'] | null;
|
|
91
|
-
contentType: CanonMessage['contentType'] | null;
|
|
92
|
-
text: string | null;
|
|
93
|
-
body: string;
|
|
94
|
-
replyToPosition: number | null;
|
|
95
|
-
attachments: CanonTurnContextAttachmentV2[];
|
|
96
|
-
contactCard: CanonTurnContextContactCardV2 | null;
|
|
97
|
-
}
|
|
98
|
-
export interface CanonTurnContextProvenanceV2 {
|
|
99
|
-
sender: {
|
|
100
|
-
id: string | null;
|
|
101
|
-
name: string | null;
|
|
102
|
-
type: HostInboundParticipantContext['senderType'];
|
|
103
|
-
isOwner: boolean;
|
|
104
|
-
};
|
|
105
|
-
mentionedAgent: boolean;
|
|
106
|
-
activeSelfContext: CanonRuntimeProvenance['activeSelfContext'];
|
|
107
|
-
}
|
|
108
|
-
export interface CanonTurnContextBehaviorV2 {
|
|
109
|
-
participationStyle: ResolvedAgentBehaviorPolicy['participation']['style'];
|
|
110
|
-
requireMentionForGroupReplies?: boolean;
|
|
111
|
-
allowAgentToAgent?: boolean;
|
|
112
|
-
allowLongRunningCollaboration?: boolean;
|
|
113
|
-
maxConsecutiveAgentTurns?: number;
|
|
114
|
-
instructions?: string[];
|
|
115
|
-
source?: ResolvedAgentBehaviorPolicy['source'];
|
|
116
|
-
}
|
|
117
|
-
export interface CanonTurnContextParticipationV2 {
|
|
118
|
-
recentRoleSummary?: HostInboundParticipantContext['recentSenderTypes'];
|
|
119
|
-
recentHumanCount?: number;
|
|
120
|
-
recentAgentCount?: number;
|
|
121
|
-
consecutiveAgentTurns?: number;
|
|
122
|
-
currentAgentStreakStartedByHuman?: boolean;
|
|
123
|
-
}
|
|
124
|
-
export interface CanonTurnContextV2 {
|
|
125
|
-
schema: typeof CANON_TURN_CONTEXT_SCHEMA_V2;
|
|
126
|
-
conversation: {
|
|
127
|
-
id: string;
|
|
128
|
-
type: HostInboundParticipantContext['conversationType'];
|
|
129
|
-
memberCount: number | null;
|
|
130
|
-
};
|
|
131
|
-
provenance: CanonTurnContextProvenanceV2;
|
|
132
|
-
behavior?: CanonTurnContextBehaviorV2;
|
|
133
|
-
participation?: CanonTurnContextParticipationV2;
|
|
134
|
-
group?: {
|
|
135
|
-
context: CanonGroupContext;
|
|
136
|
-
mode?: CanonGroupContextMode;
|
|
137
|
-
};
|
|
138
|
-
selfContext?: {
|
|
139
|
-
activeSelfContextId: string | null;
|
|
140
|
-
contexts: NonNullable<MessageCreatedPayload['selfContexts']>;
|
|
141
|
-
};
|
|
142
|
-
replyContext?: CanonTurnContextReplyContextV2;
|
|
143
|
-
session?: {
|
|
144
|
-
lines: string[];
|
|
145
|
-
};
|
|
146
|
-
message: {
|
|
147
|
-
id: string | null;
|
|
148
|
-
contentType: CanonMessage['contentType'] | null;
|
|
149
|
-
renderedContent: string;
|
|
150
|
-
/** Frozen by the sender; independent of the quoted reply target. */
|
|
151
|
-
artifactContext?: ArtifactContext;
|
|
152
|
-
/** One-line state of referenced work as of message arrival, keyed by artifact ID. */
|
|
153
|
-
artifactSummaries?: Record<string, string>;
|
|
154
|
-
attachments?: CanonTurnContextAttachmentV2[];
|
|
155
|
-
contactCard?: CanonTurnContextContactCardV2;
|
|
156
|
-
mentions?: string[];
|
|
157
|
-
replyTo?: string;
|
|
158
|
-
replyToPosition?: number;
|
|
159
|
-
deleted?: true;
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
export declare function buildCanonTurnContextV2(input: {
|
|
163
|
-
content: string;
|
|
164
|
-
conversationId: string;
|
|
165
|
-
participantContext: HostInboundParticipantContext;
|
|
166
|
-
behavior?: ResolvedAgentBehaviorPolicy | null;
|
|
167
|
-
selfContexts?: MessageCreatedPayload['selfContexts'];
|
|
168
|
-
activeSelfContextId?: string | null;
|
|
169
|
-
provenance: CanonRuntimeProvenance;
|
|
170
|
-
replyContext?: CanonReplyContext | null;
|
|
171
|
-
sessionContextLines?: string[];
|
|
172
|
-
message?: HostInboundMessage | null;
|
|
173
|
-
/** From `summarizeArtifactReferences`; lines for work the message does not reference are dropped. */
|
|
174
|
-
artifactSummaries?: Record<string, string>;
|
|
175
|
-
}): CanonTurnContextV2;
|
|
176
|
-
export declare function renderCanonTurnBriefPrompt(context: CanonTurnContextV2, options?: CanonInboundPromptOptions): string;
|
|
177
|
-
export declare function buildCanonReplyContextLines(replyContext: CanonReplyContext | null): string[];
|
|
178
33
|
/**
|
|
179
34
|
* Render the **text portion** of an inbound Canon message. Images are
|
|
180
35
|
* referenced by short placeholders — their actual bytes are delivered to the
|
|
@@ -195,63 +50,4 @@ export declare function renderCanonHostInboundContent(message: HostInboundMessag
|
|
|
195
50
|
durationMs?: number;
|
|
196
51
|
index: number;
|
|
197
52
|
}>): string;
|
|
198
|
-
export declare function resolveCanonReplyContext(input: {
|
|
199
|
-
message: HostInboundMessage;
|
|
200
|
-
messages?: ReadonlyArray<HostInboundMessage> | null;
|
|
201
|
-
}): CanonReplyContext | null;
|
|
202
|
-
/**
|
|
203
|
-
* Hydrate only an explicit reply target missing from the ordinary history page.
|
|
204
|
-
* The result stays quoted context: never append it to history or inbound work,
|
|
205
|
-
* and never follow the target's own replyTo. The endpoint enforces membership
|
|
206
|
-
* and content projection; unavailable references must not block the new input.
|
|
207
|
-
*/
|
|
208
|
-
export declare function hydrateCanonReplyContext(input: {
|
|
209
|
-
client: Pick<CanonClient, 'getMessage'>;
|
|
210
|
-
conversationId: string;
|
|
211
|
-
message: HostInboundMessage;
|
|
212
|
-
messages?: ReadonlyArray<HostInboundMessage> | null;
|
|
213
|
-
}): Promise<CanonReplyContext | null>;
|
|
214
|
-
export declare function buildHydratedInboundContext(input: {
|
|
215
|
-
agentId: string;
|
|
216
|
-
conversationId: string;
|
|
217
|
-
conversation: CanonConversation | null;
|
|
218
|
-
/** Coding hosts must verify membership before acquiring or resuming a session. */
|
|
219
|
-
requireAgentMembership?: boolean;
|
|
220
|
-
page?: CanonMessagesPage | null;
|
|
221
|
-
activeSelfContextId?: string | null;
|
|
222
|
-
selfContexts?: MessageCreatedPayload['selfContexts'];
|
|
223
|
-
provenance?: MessageCreatedPayload['provenance'];
|
|
224
|
-
message: HostInboundMessage;
|
|
225
|
-
senderName: string;
|
|
226
|
-
isOwner: boolean;
|
|
227
|
-
ownerId?: string | null;
|
|
228
|
-
ownerName?: string | null;
|
|
229
|
-
membershipChange?: CanonMembershipChange | null;
|
|
230
|
-
groupContextMode?: CanonGroupContextMode;
|
|
231
|
-
}): {
|
|
232
|
-
participantContext: HostInboundParticipantContext;
|
|
233
|
-
behavior?: ResolvedAgentBehaviorPolicy | null;
|
|
234
|
-
activeSelfContextId: string | null;
|
|
235
|
-
selfContexts: NonNullable<MessageCreatedPayload['selfContexts']>;
|
|
236
|
-
provenance: CanonRuntimeProvenance;
|
|
237
|
-
replyContext: CanonReplyContext | null;
|
|
238
|
-
hydratedFromPage: boolean;
|
|
239
|
-
};
|
|
240
|
-
export declare function publishHostAgentRuntime(agentId: string, clientType: AgentClientType, runtime: AgentRuntime, rtdb: RTDBClientHandle): Promise<void>;
|
|
241
|
-
export declare function publishHostSessionSnapshots(input: {
|
|
242
|
-
conversationIds: string[];
|
|
243
|
-
agentId: string;
|
|
244
|
-
rtdb: RTDBClientHandle;
|
|
245
|
-
clientType: AgentClientType;
|
|
246
|
-
}): Promise<void>;
|
|
247
|
-
export declare function createConversationMetadataLoader(input: {
|
|
248
|
-
client: CanonClient;
|
|
249
|
-
conversationCache: Map<string, CanonConversation>;
|
|
250
|
-
cacheTtlMs?: number;
|
|
251
|
-
}): {
|
|
252
|
-
refreshConversationCache(force?: boolean): Promise<void>;
|
|
253
|
-
getConversationMeta(conversationId: string, options?: {
|
|
254
|
-
refreshIfMemberMissing?: string;
|
|
255
|
-
}): Promise<CanonConversation | null>;
|
|
256
|
-
};
|
|
257
53
|
export {};
|