@canonmsg/backend-contracts 8.0.1 → 8.1.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.
@@ -0,0 +1,29 @@
1
+ import type { CommunicationRule } from './communication.js';
2
+ /** Shared paging bounds for Canon's discoverable-agent directory. */
3
+ export declare const DEFAULT_DISCOVER_AGENTS_LIMIT = 20;
4
+ export declare const MAX_DISCOVER_AGENTS_LIMIT = 25;
5
+ export declare const MAX_DISCOVER_AGENTS_QUERY_LENGTH = 64;
6
+ export interface DiscoverAgentsInput {
7
+ query?: string;
8
+ limit?: number;
9
+ cursor?: string | null;
10
+ }
11
+ /** Public, addressable identity returned to an authenticated agent caller. */
12
+ export interface CanonAgentDirectoryEntry {
13
+ principalId: string;
14
+ canonContactId?: string;
15
+ displayName?: string;
16
+ description?: string;
17
+ /** Human principal accountable for this agent. */
18
+ owner: {
19
+ principalId: string;
20
+ displayName?: string;
21
+ };
22
+ inboundPolicy?: CommunicationRule;
23
+ groupJoinPolicy?: CommunicationRule;
24
+ shareable: boolean;
25
+ }
26
+ export interface DiscoverAgentsResult {
27
+ agents: CanonAgentDirectoryEntry[];
28
+ nextCursor: string | null;
29
+ }
@@ -0,0 +1,4 @@
1
+ /** Shared paging bounds for Canon's discoverable-agent directory. */
2
+ export const DEFAULT_DISCOVER_AGENTS_LIMIT = 20;
3
+ export const MAX_DISCOVER_AGENTS_LIMIT = 25;
4
+ export const MAX_DISCOVER_AGENTS_QUERY_LENGTH = 64;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAX_DISCOVER_AGENTS_QUERY_LENGTH = exports.MAX_DISCOVER_AGENTS_LIMIT = exports.DEFAULT_DISCOVER_AGENTS_LIMIT = void 0;
4
+ /** Shared paging bounds for Canon's discoverable-agent directory. */
5
+ exports.DEFAULT_DISCOVER_AGENTS_LIMIT = 20;
6
+ exports.MAX_DISCOVER_AGENTS_LIMIT = 25;
7
+ exports.MAX_DISCOVER_AGENTS_QUERY_LENGTH = 64;
package/dist/cjs/index.js CHANGED
@@ -24,6 +24,7 @@ __exportStar(require("./runtimeCardStorage.js"), exports);
24
24
  __exportStar(require("./turnProtocol.js"), exports);
25
25
  __exportStar(require("./agentBehaviorPolicy.js"), exports);
26
26
  __exportStar(require("./agentSearch.js"), exports);
27
+ __exportStar(require("./agentDirectory.js"), exports);
27
28
  __exportStar(require("./verbContract.js"), exports);
28
29
  __exportStar(require("./verbSchemas.js"), exports);
29
30
  __exportStar(require("./verbWire.js"), exports);
@@ -118,6 +118,13 @@ function shouldPromoteConversationMessage(input) {
118
118
  if (isHiddenRuntimeCardMetadata(input.metadata)) {
119
119
  return false;
120
120
  }
121
+ // Ordinary agent speech can update previews and notify people without
122
+ // opting into automatic agent-to-agent turns. Keep malformed explicit
123
+ // semantics on the existing conservative fallback.
124
+ if (input.metadata == null
125
+ || (isRecord(input.metadata) && input.metadata.turnSemantics === undefined)) {
126
+ return true;
127
+ }
121
128
  return resolveTurnMessageSemantics(input) !== 'progress';
122
129
  }
123
130
  function shouldTriggerAgentTurn(input) {
@@ -1,3 +1,4 @@
1
+ import type { DiscoverAgentsInput, DiscoverAgentsResult } from './agentDirectory.js';
1
2
  /** The deliberately small policy vocabulary for principal communication. */
2
3
  export type CommunicationRule = 'open' | 'approval-required' | 'closed';
3
4
  /** Missing or invalid policy never widens access. */
@@ -11,7 +12,9 @@ export type DirectConversationSelection = {
11
12
  mode: 'specific';
12
13
  conversationId: string;
13
14
  };
14
- export type CommunicateInput = {
15
+ export type CommunicateInput = ({
16
+ action: 'discover_agents';
17
+ } & DiscoverAgentsInput) | {
15
18
  action: 'message_existing';
16
19
  conversationId: string;
17
20
  text: string;
@@ -44,7 +47,9 @@ export type CommunicateInput = {
44
47
  userId: string;
45
48
  operation: 'add' | 'remove';
46
49
  };
47
- export type CommunicateResult = {
50
+ export type CommunicateResult = ({
51
+ status: 'discovered';
52
+ } & DiscoverAgentsResult) | {
48
53
  status: 'messaged';
49
54
  conversationId: string;
50
55
  messageId: string;
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export * from './runtimeCardStorage.js';
8
8
  export * from './turnProtocol.js';
9
9
  export * from './agentBehaviorPolicy.js';
10
10
  export * from './agentSearch.js';
11
+ export * from './agentDirectory.js';
11
12
  export * from './verbContract.js';
12
13
  export * from './verbSchemas.js';
13
14
  export * from './verbWire.js';
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ export * from './runtimeCardStorage.js';
8
8
  export * from './turnProtocol.js';
9
9
  export * from './agentBehaviorPolicy.js';
10
10
  export * from './agentSearch.js';
11
+ export * from './agentDirectory.js';
11
12
  export * from './verbContract.js';
12
13
  export * from './verbSchemas.js';
13
14
  export * from './verbWire.js';
@@ -107,6 +107,13 @@ export function shouldPromoteConversationMessage(input) {
107
107
  if (isHiddenRuntimeCardMetadata(input.metadata)) {
108
108
  return false;
109
109
  }
110
+ // Ordinary agent speech can update previews and notify people without
111
+ // opting into automatic agent-to-agent turns. Keep malformed explicit
112
+ // semantics on the existing conservative fallback.
113
+ if (input.metadata == null
114
+ || (isRecord(input.metadata) && input.metadata.turnSemantics === undefined)) {
115
+ return true;
116
+ }
110
117
  return resolveTurnMessageSemantics(input) !== 'progress';
111
118
  }
112
119
  export function shouldTriggerAgentTurn(input) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/backend-contracts",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Canon backend contract helpers shared by Functions and stream-service",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.js",