@ouro.bot/cli 0.1.0-alpha.1447 → 0.1.0-alpha.1448
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
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "Each pull request writes its own change note under changes/; the release job on main gives each landed change its version and adds the notes here (scripts/release-version.cjs). On main this file stops at the last version set by hand; the published package has every release. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.1448",
|
|
6
|
+
"changes": [
|
|
7
|
+
"An agent's shell can no longer change its psyche for someone who isn't allowed to change it. That includes another agent over A2A, a friend, or its own private turns. Before, only the file tools held that rule, so on 0.1.0-alpha.1435 another agent's request ended in a shell edit of the Butler's SOUL.md. Reading the psyche from the shell still works, and the owner can still ask for a change in their own chat."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1447",
|
|
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.1448</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -201,6 +201,103 @@ function psycheWriteAllowed(fileClass, _filePath, context) {
|
|
|
201
201
|
// On Teams only an explicit one-to-one counts; an unknown conversation type proves nothing.
|
|
202
202
|
&& (context.channel !== "teams" || context.isGroupChat === false);
|
|
203
203
|
}
|
|
204
|
+
// The shell reaches the psyche too. Since #1257 the shell works in the agent's home without path checks, so the rule on who may
|
|
205
|
+
// change who it is held only for the file tools; on 0.1.0-alpha.1435 an A2A peer's ask ended in a shell edit of SOUL.md. A turn
|
|
206
|
+
// that may not write a psyche file may still read it from the shell: a command that names the psyche runs only when every part
|
|
207
|
+
// of it is a plain read. Commands that never name the psyche are untouched.
|
|
208
|
+
const PSYCHE_SHELL_FILE = /^(?:SOUL|IDENTITY|LORE|ASPIRATIONS|TACIT)\.md$/i;
|
|
209
|
+
const PSYCHE_SHELL_PATHLIKE = /[\w.~/-]*(?:\/psyche(?:\/[\w.*-]*)?|psyche\/[\w.*-]*)/g;
|
|
210
|
+
const PSYCHE_SHELL_READERS = new Set(["cat", "head", "tail", "grep", "egrep", "fgrep", "rg", "wc", "ls", "stat", "file", "diff", "cmp", "sha256sum", "shasum", "md5sum", "cd", "pwd", "echo", "printf", "true"]);
|
|
211
|
+
const PSYCHE_SHELL_GIT_READS = new Set(["log", "show", "diff", "status", "blame"]);
|
|
212
|
+
const PSYCHE_SHELL_SEPARATORS = /\s*(?:&&|\|\||[;&|\n])\s*/;
|
|
213
|
+
/** The command's words, split on unquoted whitespace and shell operators, with their quotes removed. */
|
|
214
|
+
function shellWordsLoosely(command) {
|
|
215
|
+
const words = [];
|
|
216
|
+
let word = "";
|
|
217
|
+
let quote = null;
|
|
218
|
+
for (const char of command) {
|
|
219
|
+
if (quote) {
|
|
220
|
+
if (char === quote)
|
|
221
|
+
quote = null;
|
|
222
|
+
else
|
|
223
|
+
word += char;
|
|
224
|
+
}
|
|
225
|
+
else if (char === "'" || char === "\"") {
|
|
226
|
+
quote = char;
|
|
227
|
+
}
|
|
228
|
+
else if (/[\s;&|<>()]/.test(char)) {
|
|
229
|
+
if (word)
|
|
230
|
+
words.push(word);
|
|
231
|
+
word = "";
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
word += char;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (word)
|
|
238
|
+
words.push(word);
|
|
239
|
+
return words;
|
|
240
|
+
}
|
|
241
|
+
/** Which psyche files the command names: null for none, else whether any of them is an identity file. */
|
|
242
|
+
function shellPsycheTarget(command, agentRoot) {
|
|
243
|
+
let target = null;
|
|
244
|
+
const note = (fileClass) => { if (target !== "identity")
|
|
245
|
+
target = fileClass; };
|
|
246
|
+
for (const word of shellWordsLoosely(command)) {
|
|
247
|
+
if (PSYCHE_SHELL_FILE.test(word))
|
|
248
|
+
note(/^TACIT\.md$/i.test(word) ? "tacit" : "identity");
|
|
249
|
+
const candidates = new Set(word === "psyche" || word === "./psyche" ? [word] : []);
|
|
250
|
+
for (const match of word.matchAll(PSYCHE_SHELL_PATHLIKE))
|
|
251
|
+
candidates.add(match[0]);
|
|
252
|
+
for (const candidate of candidates) {
|
|
253
|
+
try {
|
|
254
|
+
const fileClass = psycheFileClass(candidate, agentRoot);
|
|
255
|
+
if (fileClass)
|
|
256
|
+
note(fileClass);
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
// A path whose landing place can't be read is counted as an identity file, as the file tools refuse it.
|
|
260
|
+
note("identity");
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return target;
|
|
265
|
+
}
|
|
266
|
+
/** Whether one simple command (no chaining) only reads. */
|
|
267
|
+
function shellSegmentOnlyReads(segment) {
|
|
268
|
+
const words = segment.trim().split(/\s+/).filter(Boolean);
|
|
269
|
+
// Leading assignments (FOO=1 cat ...) set the environment of the program that follows.
|
|
270
|
+
while (words.length && /^[A-Za-z_][A-Za-z0-9_]*=/.test(words[0]))
|
|
271
|
+
words.shift();
|
|
272
|
+
const program = words[0]?.split("/").pop() ?? "";
|
|
273
|
+
if (PSYCHE_SHELL_READERS.has(program))
|
|
274
|
+
return true;
|
|
275
|
+
if (program === "sed")
|
|
276
|
+
return !words.some((word) => /^-[a-zA-Z]*i/.test(word) || word.startsWith("--in-place"));
|
|
277
|
+
if (program === "git") {
|
|
278
|
+
// The subcommand is the first word that is neither an option nor the value of -C or -c.
|
|
279
|
+
const subcommand = words.find((word, index) => index > 0 && !word.startsWith("-") && words[index - 1] !== "-C" && words[index - 1] !== "-c");
|
|
280
|
+
return PSYCHE_SHELL_GIT_READS.has(subcommand ?? "");
|
|
281
|
+
}
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
/** The refusal for a shell command that could write a psyche file this turn may not write, or null. */
|
|
285
|
+
function shellPsycheRefusal(command, context) {
|
|
286
|
+
const agentRoot = context.agentRoot;
|
|
287
|
+
if (!agentRoot || !fs.existsSync(path.join(agentRoot, "psyche")))
|
|
288
|
+
return null;
|
|
289
|
+
const fileClass = shellPsycheTarget(command, agentRoot);
|
|
290
|
+
if (!fileClass || psycheWriteAllowed(fileClass, "", context))
|
|
291
|
+
return null;
|
|
292
|
+
// Output into a file (a numbered stream into /dev/null or another stream aside), a substitution or a tee can write.
|
|
293
|
+
const streams = command.replace(/\d>(?:&\d|\s*\/dev\/null)/g, "");
|
|
294
|
+
const writesOut = /(?:^|[^0-9&>])>|&>|>>|\btee\b/.test(streams);
|
|
295
|
+
const onlyReads = !writesOut && !SUBSHELL_PATTERN.test(command) && streams.split(PSYCHE_SHELL_SEPARATORS).filter(Boolean).every(shellSegmentOnlyReads);
|
|
296
|
+
if (onlyReads)
|
|
297
|
+
return null;
|
|
298
|
+
(0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.psyche_shell_refused", message: "refused a shell command that could write a psyche file this turn may not write", meta: { fileClass, channel: context.channel ?? null } });
|
|
299
|
+
return fileClass === "tacit" && isFriendTurn(context) ? exports.TACIT_REFUSAL : exports.PSYCHE_REFUSAL;
|
|
300
|
+
}
|
|
204
301
|
/** A turn that carries a person who is not family: TACIT is read-only to it. */
|
|
205
302
|
function isFriendTurn(context) {
|
|
206
303
|
return context.friendId !== undefined && context.trustLevel !== "family";
|
|
@@ -270,6 +367,9 @@ function checkProtectedPaths(toolName, args, context) {
|
|
|
270
367
|
return deny(REASONS.unreadablePath);
|
|
271
368
|
if (shellWritesToProtectedPath(command))
|
|
272
369
|
return deny(REASONS.protectedPath);
|
|
370
|
+
const psycheRefusal = shellPsycheRefusal(command, context);
|
|
371
|
+
if (psycheRefusal)
|
|
372
|
+
return deny(psycheRefusal);
|
|
273
373
|
}
|
|
274
374
|
return allow;
|
|
275
375
|
}
|
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.1448",
|
|
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.1448",
|
|
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.1448",
|
|
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": {
|