@canonmsg/agent-tools 0.4.0 → 0.5.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/dist/verb-tools.d.ts +2 -0
- package/dist/verb-tools.js +25 -8
- package/package.json +2 -2
package/dist/verb-tools.d.ts
CHANGED
|
@@ -77,6 +77,8 @@ export interface VerbExecutionContext {
|
|
|
77
77
|
turnId?: string;
|
|
78
78
|
/** Default responder (e.g. the author of the turn being served). */
|
|
79
79
|
responseUserId?: string;
|
|
80
|
+
/** Canon message id of the inbound message that triggered this turn. */
|
|
81
|
+
sourceMessageId?: string;
|
|
80
82
|
}
|
|
81
83
|
export interface ExecuteVerbToolOptions {
|
|
82
84
|
/**
|
package/dist/verb-tools.js
CHANGED
|
@@ -94,6 +94,15 @@ export function canonVerbToolDefinitions(options = {}) {
|
|
|
94
94
|
delete properties[field];
|
|
95
95
|
inputSchema = { ...inputSchema, properties };
|
|
96
96
|
}
|
|
97
|
+
if (verb === 'no_reply') {
|
|
98
|
+
// Binding-owned like turnId: injected from turn context, never asked
|
|
99
|
+
// of the model — a guessed id is worse than none.
|
|
100
|
+
const properties = {
|
|
101
|
+
...(inputSchema.properties ?? {}),
|
|
102
|
+
};
|
|
103
|
+
delete properties.messageId;
|
|
104
|
+
inputSchema = { ...inputSchema, properties };
|
|
105
|
+
}
|
|
97
106
|
// The contract marks conversationId optional because bindings default it
|
|
98
107
|
// to the active conversation — a projection without one must require it
|
|
99
108
|
// from the model instead. Context-bound fields are either injected by
|
|
@@ -172,15 +181,23 @@ const DEFAULT_INTERACTION_TIMEOUT_MS = 5 * 60 * 1000;
|
|
|
172
181
|
*/
|
|
173
182
|
export function normalizeVerbToolArgs(verb, args, context, now = Date.now()) {
|
|
174
183
|
if (verb === 'no_reply') {
|
|
175
|
-
|
|
176
|
-
//
|
|
177
|
-
//
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (typeof context?.
|
|
181
|
-
|
|
184
|
+
const completed = { ...args };
|
|
185
|
+
// messageId is binding-owned (like turnId on interaction verbs): the
|
|
186
|
+
// model never knows the triggering id more reliably than the binding,
|
|
187
|
+
// and a wrong id misattributes the silence record.
|
|
188
|
+
delete completed.messageId;
|
|
189
|
+
if (typeof context?.sourceMessageId === 'string' && context.sourceMessageId) {
|
|
190
|
+
completed.messageId = context.sourceMessageId;
|
|
182
191
|
}
|
|
183
|
-
|
|
192
|
+
// Silence carries a conversation for the server's durable silence marker
|
|
193
|
+
// (/runtime-silence/{convoId}/{agentId}), so it defaults like an
|
|
194
|
+
// interaction verb but never FAILS without one — a turn can decline to
|
|
195
|
+
// reply from a binding that has no active conversation.
|
|
196
|
+
if ((typeof completed.conversationId !== 'string' || !completed.conversationId)
|
|
197
|
+
&& typeof context?.conversationId === 'string' && context.conversationId) {
|
|
198
|
+
completed.conversationId = context.conversationId;
|
|
199
|
+
}
|
|
200
|
+
return { args: completed };
|
|
184
201
|
}
|
|
185
202
|
if (!INTERACTION_VERBS.has(verb))
|
|
186
203
|
return { args };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonmsg/agent-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Canonical Canon verb tools — shared projections of canon.verbs.v1 for runtime bindings",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@canonmsg/core": "^10.
|
|
43
|
+
"@canonmsg/core": "^10.2.0",
|
|
44
44
|
"@canonmsg/rich-cards": "^0.9.1",
|
|
45
45
|
"@modelcontextprotocol/sdk": "^1.29.0"
|
|
46
46
|
},
|