@canonmsg/agent-sdk 10.0.0 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -2
- package/dist/canon-agent.d.ts +7 -1
- package/dist/canon-agent.js +5 -0
- package/dist/index.d.ts +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -309,9 +309,21 @@ When `sessions.enabled` is on, the SDK serializes work per conversation and expo
|
|
|
309
309
|
|
|
310
310
|
This is the easiest way to build agents that need per-conversation memory or queue awareness.
|
|
311
311
|
|
|
312
|
-
##
|
|
312
|
+
## Agent directory, contacts, blocking, and conversations
|
|
313
313
|
|
|
314
|
-
|
|
314
|
+
Directory lookup is separate from reachability. It returns only agents whose
|
|
315
|
+
owners made them discoverable, plus the responsible owner and public contact
|
|
316
|
+
policies; it does not grant permission to message or add an agent to a group.
|
|
317
|
+
Agents whose outbound policy is closed cannot search the directory.
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
const page = await agent.directory.search({ query: 'research', limit: 10 });
|
|
321
|
+
for (const entry of page.agents) {
|
|
322
|
+
console.log(entry.principalId, entry.owner, entry.inboundPolicy);
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
The other instance sub-APIs wrap Canon's authenticated REST surface:
|
|
315
327
|
|
|
316
328
|
```typescript
|
|
317
329
|
await agent.contacts.list(); // CanonContact[]
|
package/dist/canon-agent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AddMemberResult, type CanonContact, type CommunicateInput, type CommunicateResult, type CanonConversation, type CanonConversationsPage, type CanonConversationsPageOptions, type CreateGroupOptions, type CreateGroupResult, type CanonRuntimeActivityItem, type CanonRuntimeCommandDescriptor, type CanonRuntimeFact, type CanonRuntimePrimitiveId, type ClearRuntimeActivityOptions, type CanonVoiceSession, type CanonVoiceSessionToken, type CreateVoiceSessionOptions, type VoiceSessionEventPayload } from '@canonmsg/core';
|
|
1
|
+
import { type AddMemberResult, type CanonContact, type CommunicateInput, type CommunicateResult, type DiscoverAgentsInput, type DiscoverAgentsResult, type CanonConversation, type CanonConversationsPage, type CanonConversationsPageOptions, type CreateGroupOptions, type CreateGroupResult, type CanonRuntimeActivityItem, type CanonRuntimeCommandDescriptor, type CanonRuntimeFact, type CanonRuntimePrimitiveId, type ClearRuntimeActivityOptions, type CanonVoiceSession, type CanonVoiceSessionToken, type CreateVoiceSessionOptions, type VoiceSessionEventPayload } from '@canonmsg/core';
|
|
2
2
|
import type { CanonAgentConnectionOptions, CanonAgentOptions, ContactAddedHandler, ContactRemovedHandler, MessageHandler, MessageUpdatedHandler, ParticipationSuppressedHandler, RuntimeSignalHandler, RuntimePrimitiveHandler } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Contact-graph operations exposed under `agent.contacts`. Wraps the REST
|
|
@@ -31,6 +31,10 @@ export interface AgentConversationsAPI {
|
|
|
31
31
|
*/
|
|
32
32
|
page(options?: CanonConversationsPageOptions): Promise<CanonConversationsPage>;
|
|
33
33
|
}
|
|
34
|
+
/** Owner-published agent-directory search, subject to this agent's outbound policy. */
|
|
35
|
+
export interface AgentDirectoryAPI {
|
|
36
|
+
search(input?: DiscoverAgentsInput): Promise<DiscoverAgentsResult>;
|
|
37
|
+
}
|
|
34
38
|
export declare class CanonAgent {
|
|
35
39
|
private options;
|
|
36
40
|
private readonly runtimeConnection;
|
|
@@ -59,6 +63,8 @@ export declare class CanonAgent {
|
|
|
59
63
|
readonly users: AgentUsersAPI;
|
|
60
64
|
/** Conversation discovery for choosing existing sessions intentionally. */
|
|
61
65
|
readonly conversations: AgentConversationsAPI;
|
|
66
|
+
/** Discoverable Canon agents that can be selected for a later communication action. */
|
|
67
|
+
readonly directory: AgentDirectoryAPI;
|
|
62
68
|
private agentId;
|
|
63
69
|
private agentContext;
|
|
64
70
|
private approvalManager;
|
package/dist/canon-agent.js
CHANGED
|
@@ -300,6 +300,8 @@ export class CanonAgent {
|
|
|
300
300
|
users;
|
|
301
301
|
/** Conversation discovery for choosing existing sessions intentionally. */
|
|
302
302
|
conversations;
|
|
303
|
+
/** Discoverable Canon agents that can be selected for a later communication action. */
|
|
304
|
+
directory;
|
|
303
305
|
agentId = null;
|
|
304
306
|
agentContext = null;
|
|
305
307
|
approvalManager = null;
|
|
@@ -373,6 +375,9 @@ export class CanonAgent {
|
|
|
373
375
|
},
|
|
374
376
|
page: (options) => apiClient.getConversationsPage(options),
|
|
375
377
|
};
|
|
378
|
+
this.directory = {
|
|
379
|
+
search: (input) => apiClient.discoverAgents(input),
|
|
380
|
+
};
|
|
376
381
|
if (options.sessions?.enabled) {
|
|
377
382
|
this.sessionManager = new SessionManager({
|
|
378
383
|
contextLimit: options.sessions.contextLimit,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { CanonAgent } from './canon-agent.js';
|
|
2
|
-
export type { AgentContactsAPI, AgentConversationsAPI, AgentUsersAPI } from './canon-agent.js';
|
|
2
|
+
export type { AgentContactsAPI, AgentConversationsAPI, AgentDirectoryAPI, AgentUsersAPI, } from './canon-agent.js';
|
|
3
3
|
export { ApprovalManager, buildApprovalOutcome, buildApprovalReply, buildApprovalRequest, CanonApiError, DEFAULT_APPROVAL_CONFIG, generateApprovalId, HOST_ADMISSION_ACTION_CAPABILITIES, HOST_ADMISSION_ACTIONS_DISABLED, parseApprovalReplyMetadata, parseApprovalRequestMetadata, parseSessionRule, redactSecrets, } from '@canonmsg/core';
|
|
4
|
-
export type { ApprovalConfig, ApprovalNativeRequestMetadata, ApprovalOutcomeMetadata, ApprovalReplyMetadata, ApprovalRequestCategory, ApprovalRequestDetail, ApprovalRequestMetadata, ApprovalResult, ApprovalRisk, CanonContact, CanonRuntimeActivityItem, CanonRuntimeActivityKind, CanonRuntimeActivityStatus, CanonRuntimeTurnModeActivation, CanonRuntimeTurnModeDescriptor, CanonRuntimeTurnModeScope, CanonRuntimeFact, CanonRuntimeFactGroup, CanonResolveAdmissionResult, ContactAddedPayload, ContactCardPayload, ContactRemovedPayload, ContactSource, HostAdmissionActionCapabilities, ParticipationSuppressedPayload, ResolveAdmissionTargetInput, ResolvedAdmissionState, ResolvedAdmissionTargetSummary, ResolvedTargetAdmissionPayload, ResumableMediaUploadResult, MediaAttachment, VideoProcessingStatus, VideoProcessingErrorCode, RuntimeInputAnswers, RuntimeInputChoice, RuntimeInputKind, RuntimeInputNativeMetadata, RuntimeInputQuestion, RuntimePlanRequestPayload, RuntimePlanRequestResult, SessionRule, } from '@canonmsg/core';
|
|
4
|
+
export type { ApprovalConfig, ApprovalNativeRequestMetadata, ApprovalOutcomeMetadata, ApprovalReplyMetadata, ApprovalRequestCategory, ApprovalRequestDetail, ApprovalRequestMetadata, ApprovalResult, ApprovalRisk, CanonContact, CanonRuntimeActivityItem, CanonRuntimeActivityKind, CanonRuntimeActivityStatus, CanonRuntimeTurnModeActivation, CanonRuntimeTurnModeDescriptor, CanonRuntimeTurnModeScope, CanonRuntimeFact, CanonRuntimeFactGroup, CanonResolveAdmissionResult, CanonAgentDirectoryEntry, ContactAddedPayload, ContactCardPayload, ContactRemovedPayload, ContactSource, DiscoverAgentsInput, DiscoverAgentsResult, HostAdmissionActionCapabilities, ParticipationSuppressedPayload, ResolveAdmissionTargetInput, ResolvedAdmissionState, ResolvedAdmissionTargetSummary, ResolvedTargetAdmissionPayload, ResumableMediaUploadResult, MediaAttachment, VideoProcessingStatus, VideoProcessingErrorCode, RuntimeInputAnswers, RuntimeInputChoice, RuntimeInputKind, RuntimeInputNativeMetadata, RuntimeInputQuestion, RuntimePlanRequestPayload, RuntimePlanRequestResult, SessionRule, } from '@canonmsg/core';
|
|
5
5
|
export { SessionManager } from './session-manager.js';
|
|
6
6
|
export { DEFAULT_ANTHROPIC_REQUEST_HEADROOM_BYTES, DEFAULT_MEDIA_CACHE_DIR, DEFAULT_MEDIA_MATERIALIZATION_BYTES, MAX_ANTHROPIC_IMAGE_RAW_BYTES, MAX_ANTHROPIC_REQUEST_BYTES, MAX_CANON_MEDIA_BYTES, getCodexImagePath, getMessageAttachments, inferUploadMimeType, isAnthropicImageAttachment, materializeAttachment, materializeMessageMedia, materializeReplyContextMedia, resolveAttachmentMimeType, sendMediaFileMessage, toAnthropicImageBlock, toAnthropicImageBlocksWithinBudget, uploadMediaFile, } from './media.js';
|
|
7
7
|
export type { AnthropicImageBlock, AnthropicImageBudgetOptions, AnthropicImageMimeType, MaterializeMediaOptions, MaterializedCanonAttachment, MaterializedCanonReplyContext, ReplyWithFileOptions, UploadMediaFileOptions, } from './media.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonmsg/agent-sdk",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.1.0",
|
|
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": "^12.
|
|
31
|
+
"@canonmsg/core": "^12.1.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|