@ouro.bot/cli 0.1.0-alpha.1304 → 0.1.0-alpha.1306
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/changelog.json +12 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/core.js +3 -2
- package/dist/repertoire/tools-base.js +9 -0
- package/dist/repertoire/tools-files.js +37 -3
- package/dist/repertoire/tools.js +7 -7
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.1306",
|
|
6
|
+
"changes": [
|
|
7
|
+
"The six file tools (read_file, write_file, edit_file, ls, glob, grep) have Ouro AX cards, and edit_file's refusals end with a code: read-first, no-match or ambiguous-match. read_file, ls, glob and grep now state a low-risk profile, so a turn's tool receipt no longer counts a successful call to them as a side effect."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"version": "0.1.0-alpha.1305",
|
|
12
|
+
"changes": [
|
|
13
|
+
"When the harness refuses a tool call before it runs (an unknown tool, bad arguments, a relationship or guardrail block, an orientation hold, a changed tool, missing commerce authority), the refusal now ends with a code, such as (code: invalid-arguments), that the tool's Ouro AX card can explain."
|
|
14
|
+
]
|
|
15
|
+
},
|
|
4
16
|
{
|
|
5
17
|
"version": "0.1.0-alpha.1304",
|
|
6
18
|
"changes": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<?xml version="1.0"?>
|
|
2
2
|
<Container version="2">
|
|
3
3
|
<Name>ouro-butler</Name>
|
|
4
|
-
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.
|
|
4
|
+
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1306</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
package/dist/heart/core.js
CHANGED
|
@@ -29,6 +29,7 @@ const shelf_claims_1 = require("./shelf-claims");
|
|
|
29
29
|
const reply_style_1 = require("./reply-style");
|
|
30
30
|
const deferred_tools_1 = require("../repertoire/deferred-tools");
|
|
31
31
|
const tools_1 = require("../repertoire/tools");
|
|
32
|
+
const tools_base_1 = require("../repertoire/tools-base");
|
|
32
33
|
const tool_images_1 = require("./tool-images");
|
|
33
34
|
const tool_arguments_1 = require("../repertoire/tool-arguments");
|
|
34
35
|
const session_events_1 = require("./session-events");
|
|
@@ -2049,8 +2050,8 @@ async function runAgent(messages, callbacks, channel, signal, options) {
|
|
|
2049
2050
|
for (const entry of validatedCalls) {
|
|
2050
2051
|
const detail = "error" in entry ? entry.error : "another call in this batch had invalid arguments";
|
|
2051
2052
|
const rejection = unadvertisedCall
|
|
2052
|
-
? `rejected: ${entry.call.name} was not advertised for this channel; no handler was executed
|
|
2053
|
-
: `invalid tool arguments: ${detail}
|
|
2053
|
+
? (0, tools_base_1.withCode)(`rejected: ${entry.call.name} was not advertised for this channel; no handler was executed.`, "unknown-tool")
|
|
2054
|
+
: (0, tools_base_1.withCode)(`invalid tool arguments: ${detail}`, "invalid-arguments");
|
|
2054
2055
|
rejections.push(rejection);
|
|
2055
2056
|
options?.toolBoundaryObserver?.({
|
|
2056
2057
|
name: entry.call.name,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tools = exports.baseToolDefinitions = exports.editFileReadTracker = exports.SELF_FRIEND_ID = exports.routineActionRequester = exports.renderInnerProgressStatus = exports.speakTool = exports.restTool = exports.settleTool = exports.observeTool = exports.ponderTool = void 0;
|
|
4
|
+
exports.withCode = withCode;
|
|
4
5
|
exports.routineActionDenied = routineActionDenied;
|
|
5
6
|
const runtime_1 = require("../nerves/runtime");
|
|
6
7
|
const tools_files_1 = require("./tools-files");
|
|
@@ -47,6 +48,14 @@ var relationship_authorization_1 = require("./relationship-authorization");
|
|
|
47
48
|
Object.defineProperty(exports, "routineActionRequester", { enumerable: true, get: function () { return relationship_authorization_1.routineActionRequester; } });
|
|
48
49
|
/** The friend id of the agent talking to itself: every private-runtime turn (awaits and its own reflection) runs with this friend. */
|
|
49
50
|
exports.SELF_FRIEND_ID = "self";
|
|
51
|
+
/**
|
|
52
|
+
* An error text a tool or the dispatcher returns, ending with the code its Ouro AX card names, so a model can look up
|
|
53
|
+
* the card's fix. The message stays first and unchanged; the code is a suffix. Pass the code as a literal: the AX
|
|
54
|
+
* census counts a card's code as raised only where it appears in the handler's file.
|
|
55
|
+
*/
|
|
56
|
+
function withCode(message, code) {
|
|
57
|
+
return `${message} (code: ${code})`;
|
|
58
|
+
}
|
|
50
59
|
function routineActionDenied(reason) {
|
|
51
60
|
const message = reason.slice(0, 500);
|
|
52
61
|
(0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.routine_action_denied", message: "routine action denied", meta: { reason: message } });
|
|
@@ -43,6 +43,8 @@ const scrutiny_1 = require("../mind/scrutiny");
|
|
|
43
43
|
const tools_base_1 = require("./tools-base");
|
|
44
44
|
const guardrails_1 = require("./guardrails");
|
|
45
45
|
const tool_limits_1 = require("./tool-limits");
|
|
46
|
+
/** The profile of a file tool that only reads, so a card can say `read`; it is the dispatcher's own default. */
|
|
47
|
+
const READS_ONLY = { mutates: "none", risk: "low" };
|
|
46
48
|
const LIST_CAP = 500;
|
|
47
49
|
const GREP_MAX_MATCHES = 100;
|
|
48
50
|
const GREP_MAX_LINE_CHARS = 500;
|
|
@@ -167,6 +169,11 @@ exports.fileToolDefinitions = [
|
|
|
167
169
|
return `${text}\n${(0, tool_limits_1.cutNotice)("read_file", `[lines ${start + 1}-${last} of ${lines.length} shown; read on with offset=${last + 1}]`, { path: resolvedPath })}`;
|
|
168
170
|
},
|
|
169
171
|
summaryKeys: ["path"],
|
|
172
|
+
riskProfile: READS_ONLY,
|
|
173
|
+
ax: { id: "tool:read_file", group: "turn-files", when: "Pick this to see a file's exact text before you quote or change it; to find which file holds something, grep or glob first.", effect: "read", idempotent: true, errors: [
|
|
174
|
+
{ code: "guardrail-blocked", means: "The path is inside the folder holding the sync key, which no tool may read, or the path can't be resolved (a link loop or a folder you can't open).", fix: "Read a file outside that folder; for a path that won't resolve, check it with ls first." },
|
|
175
|
+
{ code: "invalid-arguments", means: "path is missing, or offset, limit or char_offset isn't a number.", fix: "Call read_file again with path as text and offset, limit and char_offset as numbers." },
|
|
176
|
+
] },
|
|
170
177
|
},
|
|
171
178
|
{
|
|
172
179
|
tool: {
|
|
@@ -193,6 +200,11 @@ exports.fileToolDefinitions = [
|
|
|
193
200
|
},
|
|
194
201
|
summaryKeys: ["path"],
|
|
195
202
|
riskProfile: { mutates: "durable_state_write", risk: "high", reason: "writes file contents" },
|
|
203
|
+
ax: { id: "tool:write_file", group: "turn-files", when: "Pick this to create a new file or replace one whole; for a change to part of an existing file, edit_file is safer and smaller.", effect: "write", destructive: true, idempotent: true, errors: [
|
|
204
|
+
{ code: "guardrail-blocked", means: "The path is protected (such as agent.json, state/policy, .git, friends/, product/ or a psyche file), or this person may only have you write inside your home.", fix: "Pass an absolute path under your home that isn't protected; a psyche file changes only when your owner asks in your own chat." },
|
|
205
|
+
{ code: "orientation-hold", means: "This turn is on a correction hold, so writes wait until you know what the person meant.", fix: "Call orientation_get, settle the correction, then write the file if it is still right." },
|
|
206
|
+
{ code: "invalid-arguments", means: "path or content is missing or isn't text.", fix: "Call write_file again with path and the whole new content as text." },
|
|
207
|
+
] },
|
|
196
208
|
},
|
|
197
209
|
{
|
|
198
210
|
tool: {
|
|
@@ -214,7 +226,7 @@ exports.fileToolDefinitions = [
|
|
|
214
226
|
handler: (a, ctx) => {
|
|
215
227
|
const resolvedPath = resolveLocalToolPath(a.path, ctx);
|
|
216
228
|
if (!tools_base_1.editFileReadTracker.has(resolvedPath)) {
|
|
217
|
-
return `error: you must read the file with read_file before editing it. call read_file on ${a.path} first
|
|
229
|
+
return (0, tools_base_1.withCode)(`error: you must read the file with read_file before editing it. call read_file on ${a.path} first.`, "read-first");
|
|
218
230
|
}
|
|
219
231
|
// Check staleness before editing
|
|
220
232
|
const stalenessCheck = file_state_1.fileStateCache.isStale(resolvedPath);
|
|
@@ -236,10 +248,10 @@ exports.fileToolDefinitions = [
|
|
|
236
248
|
searchFrom = idx + 1;
|
|
237
249
|
}
|
|
238
250
|
if (occurrences.length === 0) {
|
|
239
|
-
return `error: old_string not found in ${a.path}
|
|
251
|
+
return (0, tools_base_1.withCode)(`error: old_string not found in ${a.path}`, "no-match");
|
|
240
252
|
}
|
|
241
253
|
if (occurrences.length > 1) {
|
|
242
|
-
return `error: old_string is ambiguous -- found ${occurrences.length} matches in ${a.path}. provide more context to make the match unique
|
|
254
|
+
return (0, tools_base_1.withCode)(`error: old_string is ambiguous -- found ${occurrences.length} matches in ${a.path}. provide more context to make the match unique.`, "ambiguous-match");
|
|
243
255
|
}
|
|
244
256
|
// Single unique match -- replace
|
|
245
257
|
const idx = occurrences[0];
|
|
@@ -276,6 +288,13 @@ exports.fileToolDefinitions = [
|
|
|
276
288
|
},
|
|
277
289
|
summaryKeys: ["path"],
|
|
278
290
|
riskProfile: { mutates: "durable_state_write", risk: "high", reason: "edits file contents" },
|
|
291
|
+
ax: { id: "tool:edit_file", group: "turn-files", when: "Pick this to change one exact passage of a file you have read; write_file is for new files and full rewrites.", effect: "write", errors: [
|
|
292
|
+
{ code: "read-first", means: "You haven't read this file with read_file yet, so the edit was refused.", fix: "Call read_file on the same path, then send the edit again." },
|
|
293
|
+
{ code: "no-match", means: "old_string appears nowhere in the file, often because whitespace or an earlier edit differs.", fix: "Read the file again and copy old_string from it exactly, indentation included." },
|
|
294
|
+
{ code: "ambiguous-match", means: "old_string appears more than once, so the edit can't tell which place you mean.", fix: "Add surrounding lines to old_string until it matches one place only." },
|
|
295
|
+
{ code: "guardrail-blocked", means: "The path is protected (such as agent.json, state/policy, .git or a psyche file), or this person may only have you edit inside your home.", fix: "Pass an absolute path under your home that isn't protected; a psyche file changes only when your owner asks in your own chat." },
|
|
296
|
+
{ code: "orientation-hold", means: "This turn is on a correction hold, so edits wait until you know what the person meant.", fix: "Call orientation_get, settle the correction, then make the edit if it is still right." },
|
|
297
|
+
] },
|
|
279
298
|
},
|
|
280
299
|
{
|
|
281
300
|
tool: {
|
|
@@ -298,6 +317,11 @@ exports.fileToolDefinitions = [
|
|
|
298
317
|
return lines.length > 0 ? lines.join("\n") : "(empty)";
|
|
299
318
|
},
|
|
300
319
|
summaryKeys: ["path"],
|
|
320
|
+
riskProfile: READS_ONLY,
|
|
321
|
+
ax: { id: "tool:ls", group: "turn-files", when: "Pick this to see what one folder holds, with sizes; to find files by name pattern across many folders, glob is faster.", effect: "read", idempotent: true, errors: [
|
|
322
|
+
{ code: "guardrail-blocked", means: "That folder holds the sync key, which no tool may list, or the path can't be resolved.", fix: "List a different folder; nothing in that one is meant for you." },
|
|
323
|
+
{ code: "invalid-arguments", means: "path isn't text.", fix: "Call ls again with path as a folder name, or with no path to list your home." },
|
|
324
|
+
] },
|
|
301
325
|
},
|
|
302
326
|
{
|
|
303
327
|
tool: {
|
|
@@ -327,6 +351,11 @@ exports.fileToolDefinitions = [
|
|
|
327
351
|
return [...matches.slice(0, LIST_CAP), (0, tool_limits_1.cutNotice)("glob", `[${LIST_CAP} of ${matches.length} matches shown; narrow the pattern or cwd]`, { pattern: a.pattern }), ...note].join("\n");
|
|
328
352
|
},
|
|
329
353
|
summaryKeys: ["pattern", "cwd"],
|
|
354
|
+
riskProfile: READS_ONLY,
|
|
355
|
+
ax: { id: "tool:glob", group: "turn-files", when: "Pick this to find files by name pattern, such as every Markdown file under notes; to search inside files, use grep.", effect: "read", idempotent: true, errors: [
|
|
356
|
+
{ code: "guardrail-blocked", means: "The pattern or cwd reaches into the folder holding the sync key, or cwd can't be resolved.", fix: "Narrow cwd or the pattern so the search stays out of that folder." },
|
|
357
|
+
{ code: "invalid-arguments", means: "pattern is missing, or cwd isn't text.", fix: "Call glob again with pattern set, such as **/*.md, and cwd as a folder name if you want one." },
|
|
358
|
+
] },
|
|
330
359
|
},
|
|
331
360
|
{
|
|
332
361
|
tool: {
|
|
@@ -459,5 +488,10 @@ exports.fileToolDefinitions = [
|
|
|
459
488
|
return results.join("\n");
|
|
460
489
|
},
|
|
461
490
|
summaryKeys: ["pattern", "path", "include"],
|
|
491
|
+
riskProfile: READS_ONLY,
|
|
492
|
+
ax: { id: "tool:grep", group: "turn-files", when: "Pick this to learn which files and lines contain some text or regex; then read_file shows a match in full.", effect: "read", idempotent: true, errors: [
|
|
493
|
+
{ code: "guardrail-blocked", means: "The search path is, or contains, the folder holding the sync key, or it can't be resolved.", fix: "Pass a narrower path that leaves that folder out." },
|
|
494
|
+
{ code: "invalid-arguments", means: "pattern is missing, or context_lines, ignore_case or files_only has the wrong type.", fix: "Call grep again with pattern as text, context_lines as a number and the flags as true or false." },
|
|
495
|
+
] },
|
|
462
496
|
},
|
|
463
497
|
];
|
package/dist/repertoire/tools.js
CHANGED
|
@@ -396,14 +396,14 @@ async function preflightToolCall(name, args, ctx) {
|
|
|
396
396
|
const schema = def?.tool ?? selection?.engine.find((tool) => tool.function.name === name);
|
|
397
397
|
if (!schema) {
|
|
398
398
|
(0, runtime_1.emitNervesEvent)({ level: "error", event: "tool.error", component: "tools", message: "unknown or unselected tool requested", meta: { name } });
|
|
399
|
-
return { kind: "rejected_before_handler", text: `unknown: ${name}
|
|
399
|
+
return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(`unknown: ${name}`, "unknown-tool") };
|
|
400
400
|
}
|
|
401
401
|
if (name === tools_sanctuary_host_1.rootHostToolDefinition.tool.function.name)
|
|
402
402
|
await (0, tools_sanctuary_host_1.authorizeRootHostToolInvocation)(ctx, def, args);
|
|
403
403
|
if (selection || ctx?.relationshipAuthorization) {
|
|
404
404
|
const validation = (0, tool_arguments_1.validateAdvertisedToolArguments)(JSON.stringify(args), schema.function.parameters ?? {});
|
|
405
405
|
if (!validation.ok)
|
|
406
|
-
return { kind: "rejected_before_handler", text: `invalid tool arguments: ${validation.reason}
|
|
406
|
+
return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(`invalid tool arguments: ${validation.reason}`, "invalid-arguments") };
|
|
407
407
|
}
|
|
408
408
|
(0, tool_arguments_1.assertRelationshipToolOwner)(ctx);
|
|
409
409
|
if (name === "unraid_restart_container" && ctx?.routineActionSelection?.kind === "denied") {
|
|
@@ -418,7 +418,7 @@ async function preflightToolCall(name, args, ctx) {
|
|
|
418
418
|
level: "warn", event: "tool.relationship_authorization_block", component: "tools",
|
|
419
419
|
message: "relationship authorization blocked tool execution", meta: { name, reason },
|
|
420
420
|
});
|
|
421
|
-
return { kind: "rejected_before_handler", text: `relationship authorization required: ${reason}
|
|
421
|
+
return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(`relationship authorization required: ${reason}`, "not-allowed") };
|
|
422
422
|
}
|
|
423
423
|
const currentSelection = ctx?.selectCurrentTools?.()
|
|
424
424
|
?? (name === tools_sanctuary_host_1.rootHostToolDefinition.tool.function.name ? selection
|
|
@@ -436,7 +436,7 @@ async function preflightToolCall(name, args, ctx) {
|
|
|
436
436
|
level: "warn", event: "tool.selection_rejected", component: "tools",
|
|
437
437
|
message: "selected tool is no longer current", meta: { name },
|
|
438
438
|
});
|
|
439
|
-
return { kind: "rejected_before_handler", text: `rejected: ${name} changed or is no longer available in the current tool selection
|
|
439
|
+
return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(`rejected: ${name} changed or is no longer available in the current tool selection`, "tool-changed") };
|
|
440
440
|
}
|
|
441
441
|
if (def?.mcpBinding) {
|
|
442
442
|
if (!ctx?.agentName || !ctx.agentRoot)
|
|
@@ -455,7 +455,7 @@ async function preflightToolCall(name, args, ctx) {
|
|
|
455
455
|
message: "orientation hold blocked high-risk tool execution",
|
|
456
456
|
meta: { name, mutates: mutationKindsFor(risk), reason: orientationPolicy.reason },
|
|
457
457
|
});
|
|
458
|
-
return { kind: "rejected_before_handler", text: orientationHoldMessage(name, risk, orientationPolicy.reason) };
|
|
458
|
+
return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(orientationHoldMessage(name, risk, orientationPolicy.reason), "orientation-hold") };
|
|
459
459
|
}
|
|
460
460
|
const group = ctx?.context && "isGroupChat" in ctx.context ? ctx.context.isGroupChat : undefined;
|
|
461
461
|
const guardContext = {
|
|
@@ -471,7 +471,7 @@ async function preflightToolCall(name, args, ctx) {
|
|
|
471
471
|
level: "warn", event: "tool.guardrail_block", component: "tools",
|
|
472
472
|
message: "guardrail blocked tool execution", meta: { name, reason: guard.reason },
|
|
473
473
|
});
|
|
474
|
-
return { kind: "rejected_before_handler", text: guard.reason };
|
|
474
|
+
return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(guard.reason, "guardrail-blocked") };
|
|
475
475
|
}
|
|
476
476
|
return { kind: "ready", definition: def, agentRoot: guardContext.agentRoot, friendId: guardContext.friendId };
|
|
477
477
|
}
|
|
@@ -514,7 +514,7 @@ async function executeTool(name, args, ctx, executor) {
|
|
|
514
514
|
message: "guardrail blocked tool execution",
|
|
515
515
|
meta: { name, reason: commerceReservation.reason },
|
|
516
516
|
});
|
|
517
|
-
return { kind: "rejected_before_handler", text: `commerce authority required: ${commerceReservation.reason}
|
|
517
|
+
return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(`commerce authority required: ${commerceReservation.reason}`, "commerce-authority-required") };
|
|
518
518
|
}
|
|
519
519
|
const authorizedContext = ctx;
|
|
520
520
|
const toolContext = commerceReservation?.ok
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1306",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@ouro.bot/cli",
|
|
9
|
-
"version": "0.1.0-alpha.
|
|
9
|
+
"version": "0.1.0-alpha.1306",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@ouro.bot/friends"
|
|
12
12
|
],
|