@ouro.bot/cli 0.1.0-alpha.1361 → 0.1.0-alpha.1363
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 +6 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/repertoire/guardrails.js +27 -1
- package/dist/repertoire/shell-sessions.js +3 -2
- package/dist/repertoire/tools-files.js +39 -15
- package/dist/repertoire/tools-shell.js +11 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
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.1363",
|
|
6
|
+
"changes": [
|
|
7
|
+
"File tools (read_file, write_file, edit_file, grep) and shell take an optional cwd that relative paths start from, and a path that names nothing says which absolute path was tried."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1361",
|
|
6
12
|
"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.1363</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -39,6 +39,7 @@ exports.insideAgentFolder = insideAgentFolder;
|
|
|
39
39
|
exports.psycheFileClass = psycheFileClass;
|
|
40
40
|
exports.psycheWriteAllowed = psycheWriteAllowed;
|
|
41
41
|
exports.psycheEditNote = psycheEditNote;
|
|
42
|
+
exports.fileToolPath = fileToolPath;
|
|
42
43
|
exports.guardInvocation = guardInvocation;
|
|
43
44
|
const fs = __importStar(require("node:fs"));
|
|
44
45
|
const path = __importStar(require("node:path"));
|
|
@@ -56,6 +57,7 @@ const REASONS = {
|
|
|
56
57
|
readBeforeEdit: "i need to read that file first before i can edit it.",
|
|
57
58
|
readBeforeOverwrite: "i need to read that file first before i can overwrite it.",
|
|
58
59
|
protectedPath: "that path is protected — i can read it but not modify it.",
|
|
60
|
+
unresolvedCwd: "this call names a cwd, but no home is known to resolve it from; pass an absolute path instead.",
|
|
59
61
|
unreadablePath: "that path is protected — i can't read it.",
|
|
60
62
|
destructiveCommand: "that command is too dangerous to run — it could cause irreversible damage.",
|
|
61
63
|
// Trust reasons (vary by relationship)
|
|
@@ -1244,13 +1246,37 @@ function syncSecretShellRefused(command) {
|
|
|
1244
1246
|
return command.includes(path.resolve((0, sync_1.syncSecretDir)()));
|
|
1245
1247
|
}
|
|
1246
1248
|
// --- main entry point ---
|
|
1247
|
-
|
|
1249
|
+
/** The file tools whose path may start from a cwd the call names. */
|
|
1250
|
+
const CWD_FILE_TOOLS = new Set(["read_file", "write_file", "edit_file", "grep"]);
|
|
1251
|
+
/**
|
|
1252
|
+
* Where a file tool's path lands: an absolute path as given; a relative one from `cwd` when the call names one (itself
|
|
1253
|
+
* relative to home unless absolute), else from home. The guard and the tool both use this, so they check the same file.
|
|
1254
|
+
*/
|
|
1255
|
+
function fileToolPath(target, cwd, home) {
|
|
1256
|
+
if (path.isAbsolute(target))
|
|
1257
|
+
return target;
|
|
1258
|
+
const base = cwd ? path.resolve(home, cwd) : home;
|
|
1259
|
+
return path.resolve(base, target);
|
|
1260
|
+
}
|
|
1261
|
+
/** The call with its path made absolute from cwd, so every check below sees the file the tool will touch; null if it can't be. */
|
|
1262
|
+
function withCwdResolved(toolName, args, home) {
|
|
1263
|
+
if (!CWD_FILE_TOOLS.has(toolName) || typeof args.cwd !== "string" || args.cwd === "")
|
|
1264
|
+
return args;
|
|
1265
|
+
if (!home)
|
|
1266
|
+
return null;
|
|
1267
|
+
const target = args.path || (toolName === "grep" ? "." : "");
|
|
1268
|
+
return target ? { ...args, path: fileToolPath(target, args.cwd, home) } : args;
|
|
1269
|
+
}
|
|
1270
|
+
function guardInvocation(toolName, rawArgs, context) {
|
|
1248
1271
|
(0, runtime_1.emitNervesEvent)({
|
|
1249
1272
|
component: "tools",
|
|
1250
1273
|
event: "tools.guard_check",
|
|
1251
1274
|
message: "guardrail check",
|
|
1252
1275
|
meta: { toolName },
|
|
1253
1276
|
});
|
|
1277
|
+
const args = withCwdResolved(toolName, rawArgs, context.agentRoot);
|
|
1278
|
+
if (!args)
|
|
1279
|
+
return deny(REASONS.unresolvedCwd);
|
|
1254
1280
|
// Read-only tools skip the structural and trust guardrails; only the sync key's directory is closed to them.
|
|
1255
1281
|
if (READ_ONLY_TOOLS.has(toolName))
|
|
1256
1282
|
return syncSecretReadRefused(toolName, args, context.agentRoot) ? deny(REASONS.unreadablePath) : allow;
|
|
@@ -11,10 +11,11 @@ const crypto_1 = require("crypto");
|
|
|
11
11
|
const runtime_1 = require("../nerves/runtime");
|
|
12
12
|
const sessions = new Map();
|
|
13
13
|
const MAX_OUTPUT_LINES = 200;
|
|
14
|
-
|
|
14
|
+
/** Runs in `cwd` when given, else in the owner's home. */
|
|
15
|
+
function spawnBackgroundShell(command, owner, cwd) {
|
|
15
16
|
const id = (0, crypto_1.randomUUID)();
|
|
16
17
|
const proc = (0, child_process_1.spawn)("sh", ["-c", command], {
|
|
17
|
-
cwd: owner.agentRoot,
|
|
18
|
+
cwd: cwd ?? owner.agentRoot,
|
|
18
19
|
stdio: ["pipe", "pipe", "pipe"],
|
|
19
20
|
});
|
|
20
21
|
const session = {
|
|
@@ -42,6 +42,7 @@ const file_state_1 = require("../mind/file-state");
|
|
|
42
42
|
const scrutiny_1 = require("../mind/scrutiny");
|
|
43
43
|
const tools_base_1 = require("./tools-base");
|
|
44
44
|
const guardrails_1 = require("./guardrails");
|
|
45
|
+
const runtime_1 = require("../nerves/runtime");
|
|
45
46
|
const tool_limits_1 = require("./tool-limits");
|
|
46
47
|
/** The profile of a file tool that only reads, so a card can say `read`; it is the dispatcher's own default. */
|
|
47
48
|
const READS_ONLY = { mutates: "none", risk: "low" };
|
|
@@ -63,13 +64,17 @@ function psycheNoteFor(resolvedPath, ctx) {
|
|
|
63
64
|
return "";
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
/** Relative paths start in the agent's home (its bundle); absolute paths are used as given. */
|
|
67
|
-
function resolveLocalToolPath(targetPath, ctx) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
/** Relative paths start in the agent's home (its bundle), or in `cwd` when the call names one; absolute paths are used as given. */
|
|
68
|
+
function resolveLocalToolPath(targetPath, ctx, cwd) {
|
|
69
|
+
return path.isAbsolute(targetPath) ? targetPath : (0, guardrails_1.fileToolPath)(targetPath, cwd || undefined, ctx?.agentRoot ?? (0, identity_1.getAgentRoot)());
|
|
70
|
+
}
|
|
71
|
+
const CWD_PARAMETER = { type: "string", description: "folder a relative path starts from (defaults to your home)" };
|
|
72
|
+
/** A result for a path that names nothing, with the absolute path tried, so a wrong starting folder shows in the result. */
|
|
73
|
+
function notFound(tool, given, tried, what) {
|
|
74
|
+
(0, runtime_1.emitNervesEvent)({ component: "tools", event: "tools.file_not_found", message: "a file tool's path named nothing", meta: { tool, relative: !path.isAbsolute(given) } });
|
|
75
|
+
return (0, tools_base_1.withCode)(`error: no ${what} at ${tried}${path.isAbsolute(given) ? "" : ` (from the relative path ${given})`}`, "not-found");
|
|
72
76
|
}
|
|
77
|
+
const isMissing = (error) => error?.code === "ENOENT";
|
|
73
78
|
function homeOf(ctx) {
|
|
74
79
|
return ctx?.agentRoot ?? (0, identity_1.getAgentRoot)();
|
|
75
80
|
}
|
|
@@ -119,6 +124,7 @@ exports.fileToolDefinitions = [
|
|
|
119
124
|
type: "object",
|
|
120
125
|
properties: {
|
|
121
126
|
path: { type: "string" },
|
|
127
|
+
cwd: CWD_PARAMETER,
|
|
122
128
|
offset: { type: "number", description: "1-based line number to start reading from" },
|
|
123
129
|
limit: { type: "number", description: "maximum number of lines to return" },
|
|
124
130
|
char_offset: { type: "number", description: "1-based character to start from within the first line shown, to read on through a line over 30,000 characters" },
|
|
@@ -128,8 +134,16 @@ exports.fileToolDefinitions = [
|
|
|
128
134
|
},
|
|
129
135
|
},
|
|
130
136
|
handler: (a, ctx) => {
|
|
131
|
-
const resolvedPath = resolveLocalToolPath(a.path, ctx);
|
|
132
|
-
|
|
137
|
+
const resolvedPath = resolveLocalToolPath(a.path, ctx, a.cwd);
|
|
138
|
+
let raw;
|
|
139
|
+
try {
|
|
140
|
+
raw = asBuffer(fs.readFileSync(resolvedPath));
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
if (isMissing(error))
|
|
144
|
+
return notFound("read_file", a.path, resolvedPath, "file");
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
133
147
|
if ((0, tool_limits_1.looksBinary)(raw))
|
|
134
148
|
return `[binary file, ${raw.length} bytes; not shown]`;
|
|
135
149
|
const full = raw.toString("utf-8");
|
|
@@ -171,8 +185,9 @@ exports.fileToolDefinitions = [
|
|
|
171
185
|
summaryKeys: ["path"],
|
|
172
186
|
riskProfile: READS_ONLY,
|
|
173
187
|
ax: { id: "tool:read_file", eager: true, 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: [
|
|
188
|
+
{ code: "not-found", means: "Nothing is at the path; the result names the absolute path tried, so a relative path that started in the wrong folder shows there.", fix: "Pass cwd for the folder the path is relative to, or an absolute path." },
|
|
174
189
|
{ 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." },
|
|
190
|
+
{ code: "invalid-arguments", means: "path is missing, cwd isn't text, or offset, limit or char_offset isn't a number.", fix: "Call read_file again with path and cwd as text and offset, limit and char_offset as numbers." },
|
|
176
191
|
] },
|
|
177
192
|
},
|
|
178
193
|
{
|
|
@@ -183,13 +198,13 @@ exports.fileToolDefinitions = [
|
|
|
183
198
|
description: "Create a file, or replace one whole. It writes what you send and nothing of what was there, so read an existing file first when you mean to keep any of it. Prefer edit_file for a change to part of a file -- it only sends the diff.",
|
|
184
199
|
parameters: {
|
|
185
200
|
type: "object",
|
|
186
|
-
properties: { path: { type: "string" }, content: { type: "string" } },
|
|
201
|
+
properties: { path: { type: "string" }, cwd: CWD_PARAMETER, content: { type: "string" } },
|
|
187
202
|
required: ["path", "content"],
|
|
188
203
|
},
|
|
189
204
|
},
|
|
190
205
|
},
|
|
191
206
|
handler: (a, ctx) => {
|
|
192
|
-
const resolvedPath = resolveLocalToolPath(a.path, ctx);
|
|
207
|
+
const resolvedPath = resolveLocalToolPath(a.path, ctx, a.cwd);
|
|
193
208
|
fs.mkdirSync(path.dirname(resolvedPath), { recursive: true });
|
|
194
209
|
fs.writeFileSync(resolvedPath, a.content, "utf-8");
|
|
195
210
|
(0, scrutiny_1.trackModifiedFile)(resolvedPath);
|
|
@@ -216,6 +231,7 @@ exports.fileToolDefinitions = [
|
|
|
216
231
|
type: "object",
|
|
217
232
|
properties: {
|
|
218
233
|
path: { type: "string" },
|
|
234
|
+
cwd: CWD_PARAMETER,
|
|
219
235
|
old_string: { type: "string" },
|
|
220
236
|
new_string: { type: "string" },
|
|
221
237
|
},
|
|
@@ -224,7 +240,9 @@ exports.fileToolDefinitions = [
|
|
|
224
240
|
},
|
|
225
241
|
},
|
|
226
242
|
handler: (a, ctx) => {
|
|
227
|
-
const resolvedPath = resolveLocalToolPath(a.path, ctx);
|
|
243
|
+
const resolvedPath = resolveLocalToolPath(a.path, ctx, a.cwd);
|
|
244
|
+
if (!fs.existsSync(resolvedPath))
|
|
245
|
+
return notFound("edit_file", a.path, resolvedPath, "file");
|
|
228
246
|
if (!tools_base_1.editFileReadTracker.has(resolvedPath)) {
|
|
229
247
|
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");
|
|
230
248
|
}
|
|
@@ -289,6 +307,7 @@ exports.fileToolDefinitions = [
|
|
|
289
307
|
summaryKeys: ["path"],
|
|
290
308
|
riskProfile: { mutates: "durable_state_write", risk: "high", reason: "edits file contents" },
|
|
291
309
|
ax: { id: "tool:edit_file", eager: true, group: "turn-files", when: "Pick this to change one exact passage of a file you have read, including psyche/TACIT.md, where what you've learned about how things work here lives; write_file is for new files and full rewrites.", effect: "write", errors: [
|
|
310
|
+
{ code: "not-found", means: "Nothing is at the path; the result names the absolute path tried, so a relative path that started in the wrong folder shows there.", fix: "Pass cwd for the folder the path is relative to, or an absolute path." },
|
|
292
311
|
{ 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
312
|
{ 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
313
|
{ 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." },
|
|
@@ -341,6 +360,8 @@ exports.fileToolDefinitions = [
|
|
|
341
360
|
},
|
|
342
361
|
handler: (a, ctx) => {
|
|
343
362
|
const cwd = a.cwd ? resolveLocalToolPath(a.cwd, ctx) : homeOf(ctx);
|
|
363
|
+
if (!fs.statSync(cwd, { throwIfNoEntry: false })?.isDirectory())
|
|
364
|
+
return notFound("glob", a.cwd ?? cwd, cwd, "folder");
|
|
344
365
|
// A cwd the caller chose is searched as asked; only the default (the whole home) leaves state/ out.
|
|
345
366
|
const skipsState = !a.cwd && searchesWholeHome(cwd, cwd);
|
|
346
367
|
const ignore = [...tool_limits_1.SKIP_DIRS.map((d) => `**/${d}/**`), ...(skipsState ? [`${RUNTIME_DATA_DIR}/**`] : [])];
|
|
@@ -353,6 +374,7 @@ exports.fileToolDefinitions = [
|
|
|
353
374
|
summaryKeys: ["pattern", "cwd"],
|
|
354
375
|
riskProfile: READS_ONLY,
|
|
355
376
|
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: [
|
|
377
|
+
{ code: "not-found", means: "Nothing is at the path; the result names the absolute path tried, so a relative path that started in the wrong folder shows there.", fix: "Pass cwd for the folder the path is relative to, or an absolute path." },
|
|
356
378
|
{ 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
379
|
{ 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
380
|
] },
|
|
@@ -367,7 +389,8 @@ exports.fileToolDefinitions = [
|
|
|
367
389
|
type: "object",
|
|
368
390
|
properties: {
|
|
369
391
|
pattern: { type: "string", description: "regex pattern to search for" },
|
|
370
|
-
path: { type: "string", description: "file or directory to search (defaults to your home)" },
|
|
392
|
+
path: { type: "string", description: "file or directory to search (defaults to cwd, else your home)" },
|
|
393
|
+
cwd: CWD_PARAMETER,
|
|
371
394
|
context_lines: { type: "number", description: "number of surrounding context lines (default 0)" },
|
|
372
395
|
include: { type: "string", description: "glob filter to limit searched files (e.g. *.md)" },
|
|
373
396
|
ignore_case: { type: "boolean", description: "match without regard to case" },
|
|
@@ -378,7 +401,7 @@ exports.fileToolDefinitions = [
|
|
|
378
401
|
},
|
|
379
402
|
},
|
|
380
403
|
handler: (a, ctx) => {
|
|
381
|
-
const targetPath = a.path ? resolveLocalToolPath(a.path, ctx) : homeOf(ctx);
|
|
404
|
+
const targetPath = a.path || a.cwd ? resolveLocalToolPath(a.path || ".", ctx, a.cwd) : homeOf(ctx);
|
|
382
405
|
const regex = new RegExp(a.pattern, a.ignore_case ? "i" : "");
|
|
383
406
|
const contextLines = parseInt(a.context_lines || "0", 10);
|
|
384
407
|
const includeGlob = a.include || undefined;
|
|
@@ -470,7 +493,7 @@ exports.fileToolDefinitions = [
|
|
|
470
493
|
}
|
|
471
494
|
const stat = fs.statSync(targetPath, { throwIfNoEntry: false });
|
|
472
495
|
if (!stat)
|
|
473
|
-
return "";
|
|
496
|
+
return notFound("grep", a.path || a.cwd || targetPath, targetPath, "file or folder");
|
|
474
497
|
let files = [targetPath];
|
|
475
498
|
if (!stat.isFile()) {
|
|
476
499
|
files = collectFiles(targetPath);
|
|
@@ -490,6 +513,7 @@ exports.fileToolDefinitions = [
|
|
|
490
513
|
summaryKeys: ["pattern", "path", "include"],
|
|
491
514
|
riskProfile: READS_ONLY,
|
|
492
515
|
ax: { id: "tool:grep", eager: true, 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: [
|
|
516
|
+
{ code: "not-found", means: "Nothing is at the path; the result names the absolute path tried, so a relative path that started in the wrong folder shows there.", fix: "Pass cwd for the folder the path is relative to, or an absolute path." },
|
|
493
517
|
{ 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
518
|
{ 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
519
|
] },
|
|
@@ -104,11 +104,12 @@ exports.shellToolDefinitions = [
|
|
|
104
104
|
type: "function",
|
|
105
105
|
function: {
|
|
106
106
|
name: "shell",
|
|
107
|
-
description: "Run a shell command in your home; cd does not persist between calls, and a failed command comes back with how it ended, its stdout and its stderr. Keeps the last 2000 lines or 30,000 characters of output and saves the full output to a file it names when it cuts.",
|
|
107
|
+
description: "Run a shell command in your home, or in cwd when you pass one; cd does not persist between calls, and a failed command comes back with how it ended, its stdout and its stderr. Keeps the last 2000 lines or 30,000 characters of output and saves the full output to a file it names when it cuts.",
|
|
108
108
|
parameters: {
|
|
109
109
|
type: "object",
|
|
110
110
|
properties: {
|
|
111
111
|
command: { type: "string" },
|
|
112
|
+
cwd: { type: "string", description: "folder to run the command in, relative to your home or absolute (defaults to your home)" },
|
|
112
113
|
timeout_ms: {
|
|
113
114
|
type: "number",
|
|
114
115
|
description: "Timeout in milliseconds. Default: 30000. Max: 600000.",
|
|
@@ -148,9 +149,15 @@ exports.shellToolDefinitions = [
|
|
|
148
149
|
meta: { command: a.command, patterns: destructivePatterns },
|
|
149
150
|
});
|
|
150
151
|
}
|
|
152
|
+
// A cwd starts from home when relative, the way the file tools' paths do; a folder that isn't there is said plainly.
|
|
153
|
+
const runIn = a.cwd ? path.resolve(shellHome(ctx), a.cwd) : undefined;
|
|
154
|
+
if (runIn !== undefined && !fs.statSync(runIn, { throwIfNoEntry: false })?.isDirectory()) {
|
|
155
|
+
(0, runtime_1.emitNervesEvent)({ component: "tools", event: "tool.shell_cwd_missing", message: "a shell call named a cwd that is not a folder", meta: { relative: !path.isAbsolute(a.cwd) } });
|
|
156
|
+
return (0, tool_error_code_1.withCode)(`error: no folder at ${runIn}${path.isAbsolute(a.cwd) ? "" : ` (from the relative cwd ${a.cwd})`}`, "not-found");
|
|
157
|
+
}
|
|
151
158
|
// Background mode: spawn and return immediately
|
|
152
159
|
if (a.background === true) {
|
|
153
|
-
const session = (0, shell_sessions_1.spawnBackgroundShell)(a.command, shellOwner(ctx));
|
|
160
|
+
const session = (0, shell_sessions_1.spawnBackgroundShell)(a.command, shellOwner(ctx), runIn);
|
|
154
161
|
return JSON.stringify({ id: session.id, command: session.command, status: session.status });
|
|
155
162
|
}
|
|
156
163
|
const MAX_TIMEOUT = 600000;
|
|
@@ -173,7 +180,7 @@ exports.shellToolDefinitions = [
|
|
|
173
180
|
const timeout = Math.min(baseTimeout, MAX_TIMEOUT);
|
|
174
181
|
const home = shellHome(ctx);
|
|
175
182
|
const raw = await new Promise((resolve, reject) => {
|
|
176
|
-
const child = (0, child_process_1.exec)(a.command, { encoding: "utf-8", timeout, cwd: home, maxBuffer: MAX_BUFFER }, (error, stdout, stderr) => {
|
|
183
|
+
const child = (0, child_process_1.exec)(a.command, { encoding: "utf-8", timeout, cwd: runIn ?? home, maxBuffer: MAX_BUFFER }, (error, stdout, stderr) => {
|
|
177
184
|
if (error) {
|
|
178
185
|
// A failing command's output gets the same tail cap and saved file, and the agent sees all of it: how it ended,
|
|
179
186
|
// what it printed and what it complained about. Node's own message keeps only stderr.
|
|
@@ -198,6 +205,7 @@ exports.shellToolDefinitions = [
|
|
|
198
205
|
ax: { id: "tool:shell", eager: true, group: "turn-shell", when: "Pick this to run a program or script in your home; for plain file reads and searches, read_file, grep and glob are safer.", effect: "consequential", confirm: "Approve shell with exact arguments <the call's arguments as JSON>?", errors: [
|
|
199
206
|
{ code: "command-failed", means: "The command ran and exited non-zero; its stdout and stderr follow the first line.", fix: "Read stderr, fix the command or its input, and run it again." },
|
|
200
207
|
{ code: "command-timed-out", means: "The command ran past its timeout and was stopped; whatever it printed follows.", fix: "Run it again with a larger timeout_ms, at most 600000, or with background: true and watch it with shell_status." },
|
|
208
|
+
{ code: "not-found", means: "cwd names no folder; the result gives the absolute path tried.", fix: "Pass cwd as a folder that exists, relative to your home or absolute." },
|
|
201
209
|
{ code: "command-not-started", means: "The shell couldn't start the command at all, so nothing ran.", fix: "Check the program's name and that it is installed, then run it again." },
|
|
202
210
|
{ code: "guardrail-blocked", means: "The line writes to a protected path, names the sync key's folder, or runs a command this person isn't trusted for.", fix: "Change the command so it stays off protected paths, or run it from a chat with your owner." },
|
|
203
211
|
{ code: "orientation-hold", means: "This turn is on a correction hold and the command changes things, so it waits.", fix: "Call orientation_get, settle what the person meant, then run the command if it is still right." },
|
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.1363",
|
|
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.1363",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@ouro.bot/friends"
|
|
12
12
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1363",
|
|
4
4
|
"description": "Ouroboros, the agent harness: agents with durable memory that live where you talk (terminal, Teams, iMessage, mail, voice) and use real tools. Start with npx ouro.bot@latest.",
|
|
5
5
|
"homepage": "https://ouroboros.bot/",
|
|
6
6
|
"engines": {
|