@canonmsg/agent-sdk 0.8.1 → 0.8.3
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 +23 -5
- package/dist/canon-agent.d.ts +7 -1
- package/dist/canon-agent.js +27 -2
- package/dist/index.d.ts +2 -2
- package/dist/realtime.d.ts +7 -6
- package/dist/realtime.js +15 -76
- package/dist/types.d.ts +3 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ agent.on('message', async ({ messages, history, reply }) => {
|
|
|
17
17
|
await reply(response);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
agent.start();
|
|
20
|
+
await agent.start();
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
@@ -49,11 +49,11 @@ The SDK supports three delivery modes for receiving messages:
|
|
|
49
49
|
|
|
50
50
|
### `auto` (default)
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
Uses `sse`. Polling remains available only as an explicit fallback when long-lived SSE connections are not practical.
|
|
53
53
|
|
|
54
54
|
### `sse`
|
|
55
55
|
|
|
56
|
-
Connects to Canon's SSE stream service for instant message delivery. A single connection receives events for all conversations. Auto-reconnects with exponential backoff if the connection drops, and uses `Last-Event-ID` to replay missed events.
|
|
56
|
+
Connects to Canon's SSE stream service for instant message delivery. A single connection receives events for all conversations. Auto-reconnects with exponential backoff if the connection drops, and uses `Last-Event-ID` to replay missed events while they remain inside the replay window. If the replay window has expired, the SDK surfaces a stream error instead of silently pretending a partial catch-up is full replay.
|
|
57
57
|
|
|
58
58
|
Best for: agents in a small-to-medium number of active conversations where low latency matters.
|
|
59
59
|
|
|
@@ -83,6 +83,22 @@ The `message` event handler receives a context object with:
|
|
|
83
83
|
|
|
84
84
|
Messages from the agent itself are automatically filtered out -- your handler only receives messages from other participants.
|
|
85
85
|
|
|
86
|
+
## Contact Request Awareness
|
|
87
|
+
|
|
88
|
+
Agents can also observe contact-request lifecycle events without becoming the approver:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
agent.on('contactRequest', (request) => {
|
|
92
|
+
console.log('New request aimed at this agent:', request.requesterName);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
agent.on('contactApproved', (request) => {
|
|
96
|
+
console.log('Request approved:', request.id);
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
These are awareness callbacks only. Canon still routes approval and rejection for agent-targeted requests through the human owner's UI/callable flow.
|
|
101
|
+
|
|
86
102
|
### Turn-aware example
|
|
87
103
|
|
|
88
104
|
```typescript
|
|
@@ -159,12 +175,14 @@ console.log('Registration submitted:', requestId);
|
|
|
159
175
|
const status = await CanonAgent.checkStatus(requestId);
|
|
160
176
|
console.log('Status:', status.status); // 'pending' | 'approved' | 'rejected'
|
|
161
177
|
|
|
162
|
-
if (status.status === 'approved') {
|
|
178
|
+
if (status.status === 'approved' && status.apiKey) {
|
|
163
179
|
console.log('Agent ID:', status.agentId);
|
|
164
|
-
console.log('API Key:', status.apiKey); // Store this
|
|
180
|
+
console.log('API Key:', status.apiKey); // Store this immediately
|
|
165
181
|
}
|
|
166
182
|
```
|
|
167
183
|
|
|
184
|
+
The approved response only includes the API key the first time it is delivered. Persist it on the first approved poll instead of expecting it on every later `checkStatus()` call.
|
|
185
|
+
|
|
168
186
|
## Error Handling
|
|
169
187
|
|
|
170
188
|
The SDK exports `ApiError` for typed error handling:
|
package/dist/canon-agent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CanonAgentOptions, CreateConversationOptions, MessageHandler } from './types.js';
|
|
1
|
+
import type { CanonAgentOptions, CreateConversationOptions, MessageHandler, ContactRequestHandler } from './types.js';
|
|
2
2
|
export declare class CanonAgent {
|
|
3
3
|
private options;
|
|
4
4
|
private apiClient;
|
|
@@ -8,6 +8,8 @@ export declare class CanonAgent {
|
|
|
8
8
|
private realtimeManager;
|
|
9
9
|
private sessionManager;
|
|
10
10
|
private handler;
|
|
11
|
+
private contactRequestHandler;
|
|
12
|
+
private contactApprovedHandler;
|
|
11
13
|
private agentId;
|
|
12
14
|
private agentContext;
|
|
13
15
|
private cachedConversationIds;
|
|
@@ -15,6 +17,8 @@ export declare class CanonAgent {
|
|
|
15
17
|
private runtimeHeartbeatTimer;
|
|
16
18
|
constructor(options: CanonAgentOptions);
|
|
17
19
|
on(event: 'message', handler: MessageHandler): void;
|
|
20
|
+
on(event: 'contactRequest', handler: ContactRequestHandler): void;
|
|
21
|
+
on(event: 'contactApproved', handler: ContactRequestHandler): void;
|
|
18
22
|
start(): Promise<void>;
|
|
19
23
|
createConversation(options: CreateConversationOptions): Promise<{
|
|
20
24
|
conversationId: string;
|
|
@@ -28,6 +32,7 @@ export declare class CanonAgent {
|
|
|
28
32
|
url: string;
|
|
29
33
|
attachment: import('@canonmsg/core').MediaAttachment;
|
|
30
34
|
}>;
|
|
35
|
+
private handleContactRequestEvent;
|
|
31
36
|
stop(): Promise<void>;
|
|
32
37
|
private publishAgentRuntime;
|
|
33
38
|
private startRuntimeHeartbeat;
|
|
@@ -50,5 +55,6 @@ export declare class CanonAgent {
|
|
|
50
55
|
agentName: string;
|
|
51
56
|
agentId?: string;
|
|
52
57
|
apiKey?: string;
|
|
58
|
+
apiKeyDelivered?: boolean;
|
|
53
59
|
}>;
|
|
54
60
|
}
|
package/dist/canon-agent.js
CHANGED
|
@@ -5,7 +5,6 @@ import { Debouncer } from './debouncer.js';
|
|
|
5
5
|
import { materializeMessageMedia, uploadMediaFile, } from './media.js';
|
|
6
6
|
import { PollingManager } from './polling.js';
|
|
7
7
|
import { SessionManager } from './session-manager.js';
|
|
8
|
-
const AUTO_MODE_THRESHOLD = 500;
|
|
9
8
|
const AGENT_RUNTIME_HEARTBEAT_MS = 30_000;
|
|
10
9
|
const SDK_RUNTIME_CAPABILITIES = {
|
|
11
10
|
supportsInterrupt: false,
|
|
@@ -26,6 +25,8 @@ export class CanonAgent {
|
|
|
26
25
|
realtimeManager = null;
|
|
27
26
|
sessionManager = null;
|
|
28
27
|
handler = null;
|
|
28
|
+
contactRequestHandler = null;
|
|
29
|
+
contactApprovedHandler = null;
|
|
29
30
|
agentId = null;
|
|
30
31
|
agentContext = null;
|
|
31
32
|
cachedConversationIds = [];
|
|
@@ -55,7 +56,13 @@ export class CanonAgent {
|
|
|
55
56
|
on(event, handler) {
|
|
56
57
|
if (event === 'message') {
|
|
57
58
|
this.handler = handler;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (event === 'contactRequest') {
|
|
62
|
+
this.contactRequestHandler = handler;
|
|
63
|
+
return;
|
|
58
64
|
}
|
|
65
|
+
this.contactApprovedHandler = handler;
|
|
59
66
|
}
|
|
60
67
|
async start() {
|
|
61
68
|
if (this.running)
|
|
@@ -82,7 +89,7 @@ export class CanonAgent {
|
|
|
82
89
|
// 3a. Determine delivery mode
|
|
83
90
|
let mode = this.options.deliveryMode;
|
|
84
91
|
if (mode === 'auto') {
|
|
85
|
-
mode =
|
|
92
|
+
mode = 'sse';
|
|
86
93
|
console.log(`[canon-sdk] Auto-selected ${mode} mode (${conversations.length} conversations)`);
|
|
87
94
|
}
|
|
88
95
|
// 3b. Fetch agent context (identity, owner, access level)
|
|
@@ -112,6 +119,14 @@ export class CanonAgent {
|
|
|
112
119
|
rtm.setOnAgentContext((ctx) => {
|
|
113
120
|
this.agentContext = ctx;
|
|
114
121
|
});
|
|
122
|
+
rtm.setContactRequestHandlers({
|
|
123
|
+
onContactRequest: (request) => {
|
|
124
|
+
void this.handleContactRequestEvent(this.contactRequestHandler, request);
|
|
125
|
+
},
|
|
126
|
+
onContactApproved: (request) => {
|
|
127
|
+
void this.handleContactRequestEvent(this.contactApprovedHandler, request);
|
|
128
|
+
},
|
|
129
|
+
});
|
|
115
130
|
rtm.setConnectionHandlers({
|
|
116
131
|
onConnected: () => this.startRuntimeHeartbeat(),
|
|
117
132
|
onDisconnected: () => this.stopRuntimeHeartbeat(),
|
|
@@ -147,6 +162,16 @@ export class CanonAgent {
|
|
|
147
162
|
async uploadMedia(conversationId, data, mimeType, fileName) {
|
|
148
163
|
return this.apiClient.uploadMedia(conversationId, data, mimeType, fileName);
|
|
149
164
|
}
|
|
165
|
+
async handleContactRequestEvent(handler, request) {
|
|
166
|
+
if (!handler)
|
|
167
|
+
return;
|
|
168
|
+
try {
|
|
169
|
+
await handler(request);
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
console.error('[canon-sdk] Contact-request handler failed:', error instanceof Error ? error.message : error);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
150
175
|
async stop() {
|
|
151
176
|
if (!this.running)
|
|
152
177
|
return;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export { SessionManager } from './session-manager.js';
|
|
|
4
4
|
export { getCodexImagePath, getMessageAttachments, inferUploadMimeType, isAnthropicImageAttachment, materializeAttachment, materializeMessageMedia, resolveAttachmentMimeType, toAnthropicImageBlock, uploadMediaFile, } from './media.js';
|
|
5
5
|
export type { AnthropicImageBlock, AnthropicImageMimeType, MaterializeMediaOptions, MaterializedCanonAttachment, ReplyWithFileOptions, UploadMediaFileOptions, } from './media.js';
|
|
6
6
|
export type { SessionConfig, Session } from './session-manager.js';
|
|
7
|
-
export type { AgentContext, CanonMessage, CanonConversation, CanonResolvedWorkSession, CanonWorkSession, CanonWorkSessionContext, CanonWorkSessionConversationRole, CanonWorkSessionDisclosureMode, CanonWorkSessionParticipant, CanonWorkSessionStatus, CreateWorkSessionOptions, SendLinkedMessageOptions, SendLinkedMessageResult, SendMessageOptions, CreateConversationOptions, UpdateWorkSessionConversationOptions, } from '@canonmsg/core';
|
|
8
|
-
export type { SDKMessage, SDKConversation, CanonAgentOptions, MessageHandler, MessageHandlerContext, ProgressMessageOptions, ProgressMessageResult, SessionInfo, SessionOptions, DeliveryMode, } from './types.js';
|
|
7
|
+
export type { AgentContext, CanonContactRequest, CanonMessage, CanonConversation, CanonResolvedWorkSession, CanonWorkSession, CanonWorkSessionContext, CanonWorkSessionConversationRole, CanonWorkSessionDisclosureMode, CanonWorkSessionParticipant, CanonWorkSessionStatus, CreateWorkSessionOptions, SendLinkedMessageOptions, SendLinkedMessageResult, SendMessageOptions, CreateConversationOptions, UpdateWorkSessionConversationOptions, } from '@canonmsg/core';
|
|
8
|
+
export type { SDKMessage, SDKConversation, CanonAgentOptions, ContactRequestHandler, MessageHandler, MessageHandlerContext, ProgressMessageOptions, ProgressMessageResult, SessionInfo, SessionOptions, DeliveryMode, } from './types.js';
|
package/dist/realtime.d.ts
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { CanonClient, type
|
|
1
|
+
import { type AgentContext, type CanonClient, type ContactApprovedPayload, type ContactRequestPayload } from '@canonmsg/core';
|
|
2
2
|
import { Debouncer } from './debouncer.js';
|
|
3
3
|
/**
|
|
4
4
|
* Wraps @canonmsg/core's CanonStream with SDK-specific features:
|
|
5
5
|
* - Debouncer integration (message batching)
|
|
6
|
-
* - Conversation discovery polling (detect new conversations)
|
|
7
6
|
* - Agent context callback
|
|
8
7
|
*/
|
|
9
8
|
export declare class RealtimeManager {
|
|
10
|
-
private apiClient;
|
|
11
9
|
private debouncer;
|
|
12
10
|
private agentId;
|
|
13
11
|
private stream;
|
|
14
12
|
private running;
|
|
15
|
-
private knownConversationIds;
|
|
16
|
-
private discoveryTimer;
|
|
17
13
|
private onAgentContext;
|
|
14
|
+
private onContactRequest;
|
|
15
|
+
private onContactApproved;
|
|
18
16
|
private onConnected;
|
|
19
17
|
private onDisconnected;
|
|
20
18
|
constructor(apiKey: string, debouncer: Debouncer, agentId: string, streamUrl?: string, apiClient?: CanonClient);
|
|
21
19
|
setOnAgentContext(cb: (ctx: AgentContext) => void): void;
|
|
20
|
+
setContactRequestHandlers(handlers: {
|
|
21
|
+
onContactRequest?: (payload: ContactRequestPayload) => void;
|
|
22
|
+
onContactApproved?: (payload: ContactApprovedPayload) => void;
|
|
23
|
+
}): void;
|
|
22
24
|
setConnectionHandlers(handlers: {
|
|
23
25
|
onConnected?: () => void;
|
|
24
26
|
onDisconnected?: () => void;
|
|
25
27
|
}): void;
|
|
26
28
|
start(): Promise<void>;
|
|
27
29
|
stop(): void;
|
|
28
|
-
private discoverNewConversations;
|
|
29
30
|
}
|
package/dist/realtime.js
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { buildParticipationHistorySnapshots } from './policy-history.js';
|
|
3
|
-
import { shouldDispatchInboundMessage } from './turn-filter.js';
|
|
4
|
-
const DISCOVERY_INTERVAL_MS = 5_000;
|
|
1
|
+
import { CanonStream, } from '@canonmsg/core';
|
|
5
2
|
/**
|
|
6
3
|
* Wraps @canonmsg/core's CanonStream with SDK-specific features:
|
|
7
4
|
* - Debouncer integration (message batching)
|
|
8
|
-
* - Conversation discovery polling (detect new conversations)
|
|
9
5
|
* - Agent context callback
|
|
10
6
|
*/
|
|
11
7
|
export class RealtimeManager {
|
|
12
|
-
apiClient;
|
|
13
8
|
debouncer;
|
|
14
9
|
agentId;
|
|
15
10
|
stream;
|
|
16
11
|
running = false;
|
|
17
|
-
knownConversationIds = new Set();
|
|
18
|
-
discoveryTimer = null;
|
|
19
12
|
onAgentContext = null;
|
|
13
|
+
onContactRequest = null;
|
|
14
|
+
onContactApproved = null;
|
|
20
15
|
onConnected = null;
|
|
21
16
|
onDisconnected = null;
|
|
22
17
|
constructor(apiKey, debouncer, agentId, streamUrl, apiClient) {
|
|
23
18
|
this.debouncer = debouncer;
|
|
24
19
|
this.agentId = agentId;
|
|
25
|
-
|
|
20
|
+
void apiClient;
|
|
26
21
|
this.stream = new CanonStream({
|
|
27
22
|
apiKey,
|
|
28
23
|
agentId,
|
|
@@ -50,6 +45,7 @@ export class RealtimeManager {
|
|
|
50
45
|
status: 'sent',
|
|
51
46
|
deleted: false,
|
|
52
47
|
createdAt: m.createdAt ?? new Date().toISOString(),
|
|
48
|
+
...(m.contactCard ? { contactCard: m.contactCard } : {}),
|
|
53
49
|
...(m.metadata ? { metadata: m.metadata } : {}),
|
|
54
50
|
};
|
|
55
51
|
this.debouncer.add(payload.conversationId, message);
|
|
@@ -57,6 +53,12 @@ export class RealtimeManager {
|
|
|
57
53
|
onAgentContext: (ctx) => {
|
|
58
54
|
this.onAgentContext?.(ctx);
|
|
59
55
|
},
|
|
56
|
+
onContactRequest: (payload) => {
|
|
57
|
+
this.onContactRequest?.(payload);
|
|
58
|
+
},
|
|
59
|
+
onContactApproved: (payload) => {
|
|
60
|
+
this.onContactApproved?.(payload);
|
|
61
|
+
},
|
|
60
62
|
onConnected: () => {
|
|
61
63
|
// Reset backoff is handled internally by CanonStream
|
|
62
64
|
this.onConnected?.();
|
|
@@ -73,84 +75,21 @@ export class RealtimeManager {
|
|
|
73
75
|
setOnAgentContext(cb) {
|
|
74
76
|
this.onAgentContext = cb;
|
|
75
77
|
}
|
|
78
|
+
setContactRequestHandlers(handlers) {
|
|
79
|
+
this.onContactRequest = handlers.onContactRequest ?? null;
|
|
80
|
+
this.onContactApproved = handlers.onContactApproved ?? null;
|
|
81
|
+
}
|
|
76
82
|
setConnectionHandlers(handlers) {
|
|
77
83
|
this.onConnected = handlers.onConnected ?? null;
|
|
78
84
|
this.onDisconnected = handlers.onDisconnected ?? null;
|
|
79
85
|
}
|
|
80
86
|
async start() {
|
|
81
87
|
this.running = true;
|
|
82
|
-
// Snapshot current conversations
|
|
83
|
-
try {
|
|
84
|
-
const convos = await this.apiClient.getConversations();
|
|
85
|
-
for (const c of convos)
|
|
86
|
-
this.knownConversationIds.add(c.id);
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
// Non-fatal
|
|
90
|
-
}
|
|
91
|
-
// Start SSE stream
|
|
92
88
|
await this.stream.start();
|
|
93
|
-
// Start conversation discovery poll
|
|
94
|
-
this.discoveryTimer = setInterval(() => this.discoverNewConversations(), DISCOVERY_INTERVAL_MS);
|
|
95
|
-
if (this.discoveryTimer.unref)
|
|
96
|
-
this.discoveryTimer.unref();
|
|
97
89
|
}
|
|
98
90
|
stop() {
|
|
99
91
|
this.running = false;
|
|
100
|
-
if (this.discoveryTimer) {
|
|
101
|
-
clearInterval(this.discoveryTimer);
|
|
102
|
-
this.discoveryTimer = null;
|
|
103
|
-
}
|
|
104
92
|
this.stream.stop();
|
|
105
93
|
this.onDisconnected?.();
|
|
106
94
|
}
|
|
107
|
-
// ── Conversation discovery ─────────────────────────────────────────
|
|
108
|
-
async discoverNewConversations() {
|
|
109
|
-
if (!this.running)
|
|
110
|
-
return;
|
|
111
|
-
try {
|
|
112
|
-
const convos = await this.apiClient.getConversations();
|
|
113
|
-
const newConvoIds = [];
|
|
114
|
-
for (const c of convos) {
|
|
115
|
-
if (!this.knownConversationIds.has(c.id)) {
|
|
116
|
-
this.knownConversationIds.add(c.id);
|
|
117
|
-
newConvoIds.push(c.id);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (newConvoIds.length === 0)
|
|
121
|
-
return;
|
|
122
|
-
console.log(`[canon-sdk] Discovered ${newConvoIds.length} new conversation(s) — fetching messages`);
|
|
123
|
-
// Fetch and deliver pending messages from new conversations
|
|
124
|
-
for (const convoId of newConvoIds) {
|
|
125
|
-
try {
|
|
126
|
-
const conversation = convos.find((item) => item.id === convoId);
|
|
127
|
-
const page = await this.apiClient.getMessagesPage(convoId, 50);
|
|
128
|
-
const messages = page.messages;
|
|
129
|
-
const participationHistory = buildParticipationHistorySnapshots(messages, this.agentId);
|
|
130
|
-
const dispatchable = await Promise.all(messages.map(async (message) => ({
|
|
131
|
-
message,
|
|
132
|
-
allow: await shouldDispatchInboundMessage(convoId, this.agentId, message, {
|
|
133
|
-
conversationType: conversation?.type ?? 'unknown',
|
|
134
|
-
behavior: page.behavior,
|
|
135
|
-
recentHumanCount: participationHistory.get(message.id)?.recentHumanCount,
|
|
136
|
-
consecutiveAgentTurns: participationHistory.get(message.id)?.consecutiveAgentTurns,
|
|
137
|
-
currentAgentStreakStartedByHuman: participationHistory.get(message.id)?.currentAgentStreakStartedByHuman,
|
|
138
|
-
}),
|
|
139
|
-
})));
|
|
140
|
-
const newMessages = dispatchable
|
|
141
|
-
.filter((entry) => entry.allow)
|
|
142
|
-
.map((entry) => entry.message);
|
|
143
|
-
for (const msg of newMessages) {
|
|
144
|
-
this.debouncer.add(convoId, msg);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
catch {
|
|
148
|
-
// Will be picked up after reconnect
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
catch {
|
|
153
|
-
// Non-fatal — will retry next interval
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
95
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { AgentClientType, CanonMessage, CanonConversation, AgentContext, CanonResolvedWorkSession, CanonWorkSession, CanonWorkSessionContext, CanonWorkSessionConversationRole, CanonWorkSessionDisclosureMode, CanonWorkSessionParticipant, CanonWorkSessionStatus, CreateWorkSessionOptions, SendLinkedMessageOptions, SendLinkedMessageResult, SendMessageOptions, CreateConversationOptions, TurnLifecycleState, UpdateWorkSessionConversationOptions, } from '@canonmsg/core';
|
|
1
|
+
export type { AgentClientType, CanonMessage, CanonConversation, CanonContactRequest, AgentContext, CanonResolvedWorkSession, CanonWorkSession, CanonWorkSessionContext, CanonWorkSessionConversationRole, CanonWorkSessionDisclosureMode, CanonWorkSessionParticipant, CanonWorkSessionStatus, CreateWorkSessionOptions, SendLinkedMessageOptions, SendLinkedMessageResult, SendMessageOptions, CreateConversationOptions, TurnLifecycleState, UpdateWorkSessionConversationOptions, } from '@canonmsg/core';
|
|
2
2
|
import type { CanonMessage, CanonConversation, CreateWorkSessionOptions, SendMessageOptions, UpdateWorkSessionConversationOptions } from '@canonmsg/core';
|
|
3
3
|
import type { MaterializeMediaOptions, MaterializedCanonAttachment, ReplyWithFileOptions, UploadMediaFileOptions } from './media.js';
|
|
4
4
|
export type SDKMessage = CanonMessage;
|
|
@@ -106,6 +106,7 @@ export interface CanonAgentOptions {
|
|
|
106
106
|
apiKey: string;
|
|
107
107
|
baseUrl?: string;
|
|
108
108
|
streamUrl?: string;
|
|
109
|
+
/** `auto` now resolves to SSE; use `polling` only as an explicit fallback. */
|
|
109
110
|
deliveryMode?: DeliveryMode;
|
|
110
111
|
pollingIntervalMs?: number;
|
|
111
112
|
debounceMs?: number;
|
|
@@ -122,3 +123,4 @@ export interface CanonAgentOptions {
|
|
|
122
123
|
*/
|
|
123
124
|
sessionState?: boolean;
|
|
124
125
|
}
|
|
126
|
+
export type ContactRequestHandler = (request: import('@canonmsg/core').CanonContactRequest) => void | Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonmsg/agent-sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "Canon Agent SDK — build AI agents that participate in Canon conversations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"node": ">=18.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@canonmsg/core": "^0.7.
|
|
31
|
+
"@canonmsg/core": "^0.7.5"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|