@ouro.bot/cli 0.1.0-alpha.1504 → 0.1.0-alpha.1505
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.1505",
|
|
6
|
+
"changes": [
|
|
7
|
+
"Slugger's eval projection replaces each household name, handle or email it finds in a kept file with a fixed placeholder (\"Member A\", \"member-a@example.invalid\") instead of refusing the run, and reports only how many it replaced. Leak patterns now match whole words only (a name next to digits still matches), in the redaction and the leak lint alike; a file that isn't UTF-8 text is never rewritten, and is refused if it holds a pattern."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1504",
|
|
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.1505</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -8,6 +8,8 @@ exports.archiveBundle = archiveBundle;
|
|
|
8
8
|
exports.removeArchive = removeArchive;
|
|
9
9
|
exports.projectAgentConfig = projectAgentConfig;
|
|
10
10
|
exports.readLeakPatterns = readLeakPatterns;
|
|
11
|
+
exports.placeholder = placeholder;
|
|
12
|
+
exports.redact = redact;
|
|
11
13
|
exports.leakLint = leakLint;
|
|
12
14
|
exports.projectSlugger = projectSlugger;
|
|
13
15
|
exports.sluggerProfile = sluggerProfile;
|
|
@@ -25,11 +27,17 @@ exports.sluggerProfile = sluggerProfile;
|
|
|
25
27
|
* dot-file and dot-folder (`.git`, `.backup/`, ...) and every symbolic link.
|
|
26
28
|
* - **Created empty:** every path Slugger's profile may write, so `books/` too, where the sandbox writes the books
|
|
27
29
|
* CLI's synthetic settings.
|
|
28
|
-
* - **Leak
|
|
30
|
+
* - **Leak patterns.** The household's names, handles, emails and addresses are kept in his private bundle at
|
|
29
31
|
* `eval/leak-patterns.json` (`{ "literals": [...] }`) and never committed to the harness. They are read from the
|
|
30
|
-
* same commit as the rest, so an older commit is checked against the list it had then.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
32
|
+
* same commit as the rest, so an older commit is checked against the list it had then. A pattern matches in any case
|
|
33
|
+
* and as a whole word only: not inside a longer run of letters (digits don't count, so `name99` matches). One with a
|
|
34
|
+
* letter outside basic Latin matches anywhere (see `wordPattern`).
|
|
35
|
+
* - **Redaction.** Every match in a copied file's contents is replaced with a placeholder fixed by the pattern's place
|
|
36
|
+
* in the list, the same in every file: "Member A", "Member B", ..., or "member-a@example.invalid" for a pattern
|
|
37
|
+
* holding `@`, or "@member-a" for a handle starting with it. Longer patterns are replaced first. A gap gives only how many strings and files were replaced.
|
|
38
|
+
* - **Leak lint.** After redaction the patterns are matched again against every projected file's and folder's name,
|
|
39
|
+
* every file's contents and every gap, before any model call. A match, or no pattern file, stops the projection and
|
|
40
|
+
* removes it; the error gives counts only, never a match.
|
|
33
41
|
* `git archive` follows the bundle repository's `export-ignore` and `export-subst` attributes; a top-level entry left
|
|
34
42
|
* out that way fails the archive's completeness check.
|
|
35
43
|
* What differs from the live bundle comes back as `gaps`, which every report lists.
|
|
@@ -204,10 +212,85 @@ function readLeakPatterns(archiveDir) {
|
|
|
204
212
|
}
|
|
205
213
|
return literals.map((literal) => literal.trim().toLowerCase());
|
|
206
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* A pattern in any case, as a whole word: not next to another letter, so a name inside a longer word is no match, but
|
|
217
|
+
* a handle next to digits (`name99`) is. Words in a pattern match across any run of spaces or line breaks. A pattern
|
|
218
|
+
* with a letter outside basic Latin matches anywhere, since scripts such as Japanese don't separate words and Hebrew
|
|
219
|
+
* joins prefixes to names.
|
|
220
|
+
*/
|
|
221
|
+
function wordPattern(pattern) {
|
|
222
|
+
const body = pattern.split(/\s+/).map((word) => word.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("\\s+");
|
|
223
|
+
if (/[^\p{ASCII}]/u.test(pattern))
|
|
224
|
+
return new RegExp(body, "giu");
|
|
225
|
+
return new RegExp(`(?<![\\p{L}\\p{M}])${body}(?![\\p{L}\\p{M}])`, "giu");
|
|
226
|
+
}
|
|
227
|
+
const holdsAny = (text, patterns) => patterns.some((pattern) => wordPattern(pattern).test(text));
|
|
228
|
+
/**
|
|
229
|
+
* The placeholder for the pattern at `index`: "Member A" to "Member Z", then "Member AA"; an email's is an address
|
|
230
|
+
* and a handle's (`@name`) a handle. A pattern such as `member` or `example` would match its own placeholder, which the
|
|
231
|
+
* second lint then refuses.
|
|
232
|
+
*/
|
|
233
|
+
function placeholder(index, pattern) {
|
|
234
|
+
let letters = "";
|
|
235
|
+
for (let n = index + 1; n > 0; n = Math.floor((n - 1) / 26))
|
|
236
|
+
letters = String.fromCharCode(65 + ((n - 1) % 26)) + letters;
|
|
237
|
+
if (pattern.startsWith("@"))
|
|
238
|
+
return `@member-${letters.toLowerCase()}`;
|
|
239
|
+
return pattern.includes("@") ? `member-${letters.toLowerCase()}@example.invalid` : `Member ${letters}`;
|
|
240
|
+
}
|
|
241
|
+
const utf8 = new TextDecoder("utf-8", { fatal: true });
|
|
242
|
+
function filesUnder(root) {
|
|
243
|
+
const found = [];
|
|
244
|
+
const walk = (relative) => {
|
|
245
|
+
const full = node_path_1.default.join(root, relative);
|
|
246
|
+
if (node_fs_1.default.lstatSync(full).isDirectory())
|
|
247
|
+
for (const name of node_fs_1.default.readdirSync(full).sort())
|
|
248
|
+
walk(relative ? node_path_1.default.posix.join(relative, name) : name);
|
|
249
|
+
else
|
|
250
|
+
found.push(relative);
|
|
251
|
+
};
|
|
252
|
+
walk("");
|
|
253
|
+
return found;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Replaces every match in the contents of each file under `root` with its pattern's placeholder. A file that isn't
|
|
257
|
+
* UTF-8 text is left as it is, so the lint after this refuses it if it holds a pattern.
|
|
258
|
+
*/
|
|
259
|
+
function redact(root, patterns) {
|
|
260
|
+
const order = patterns.map((pattern, index) => ({ pattern, index })).sort((a, b) => b.pattern.length - a.pattern.length || a.index - b.index);
|
|
261
|
+
let strings = 0;
|
|
262
|
+
let files = 0;
|
|
263
|
+
for (const relative of filesUnder(root)) {
|
|
264
|
+
const full = node_path_1.default.join(root, relative);
|
|
265
|
+
let text;
|
|
266
|
+
try {
|
|
267
|
+
text = utf8.decode(node_fs_1.default.readFileSync(full));
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
let here = 0;
|
|
273
|
+
for (const { pattern, index } of order) {
|
|
274
|
+
text = text.replace(wordPattern(pattern), () => { here += 1; return placeholder(index, pattern); });
|
|
275
|
+
}
|
|
276
|
+
if (here > 0) {
|
|
277
|
+
// A failed write's error names the file, whose path the lint hasn't checked yet.
|
|
278
|
+
try {
|
|
279
|
+
node_fs_1.default.writeFileSync(full, text);
|
|
280
|
+
}
|
|
281
|
+
catch {
|
|
282
|
+
refuse("a projected file couldn't be rewritten with placeholders");
|
|
283
|
+
}
|
|
284
|
+
strings += here;
|
|
285
|
+
files += 1;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return { strings, files };
|
|
289
|
+
}
|
|
207
290
|
/** Every file or folder under `root` whose path, or a file's contents, holds a pattern, by its path relative to `root`. */
|
|
208
291
|
function leakLint(root, patterns) {
|
|
209
292
|
const flagged = [];
|
|
210
|
-
const holds = (text) =>
|
|
293
|
+
const holds = (text) => holdsAny(text, patterns);
|
|
211
294
|
const walk = (relative) => {
|
|
212
295
|
const full = node_path_1.default.join(root, relative);
|
|
213
296
|
if (node_fs_1.default.lstatSync(full).isDirectory()) {
|
|
@@ -237,6 +320,7 @@ function projectSlugger(input) {
|
|
|
237
320
|
const patterns = readLeakPatterns(input.archive);
|
|
238
321
|
node_fs_1.default.mkdirSync(input.out, { recursive: true, mode: 0o755 });
|
|
239
322
|
const gaps = [];
|
|
323
|
+
let redactedStrings = 0;
|
|
240
324
|
try {
|
|
241
325
|
for (const include of input.include.filter((each) => each !== "agent.json")) {
|
|
242
326
|
const parts = include.split("/");
|
|
@@ -267,8 +351,12 @@ function projectSlugger(input) {
|
|
|
267
351
|
node_fs_1.default.mkdirSync(node_path_1.default.join(input.out, dir), { recursive: true });
|
|
268
352
|
node_fs_1.default.writeFileSync(node_path_1.default.join(input.out, "books/ledger.ndjson"), "");
|
|
269
353
|
gaps.push("psyche/TACIT.md and psyche/memory: left out", "friends, state, arc, desk and books: start empty", "browser: left out");
|
|
354
|
+
const redacted = redact(input.out, patterns);
|
|
355
|
+
redactedStrings = redacted.strings;
|
|
356
|
+
if (redacted.strings > 0)
|
|
357
|
+
gaps.push(`${redacted.strings} private strings replaced with placeholders in ${redacted.files} ${redacted.files === 1 ? "file" : "files"}`);
|
|
270
358
|
// Gaps go into every report, so they are checked like the files are.
|
|
271
|
-
const flagged = leakLint(input.out, patterns).length + gaps.filter((gap) =>
|
|
359
|
+
const flagged = leakLint(input.out, patterns).length + gaps.filter((gap) => holdsAny(gap, patterns)).length;
|
|
272
360
|
if (flagged > 0)
|
|
273
361
|
refuse(`${flagged} projected path(s) or gap(s) hold a leak pattern; nothing was run`);
|
|
274
362
|
}
|
|
@@ -276,7 +364,7 @@ function projectSlugger(input) {
|
|
|
276
364
|
node_fs_1.default.rmSync(input.out, { recursive: true, force: true });
|
|
277
365
|
throw error;
|
|
278
366
|
}
|
|
279
|
-
(0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.slugger_projection", message: "projected Slugger's bundle", meta: { gaps: gaps.length } });
|
|
367
|
+
(0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.slugger_projection", message: "projected Slugger's bundle", meta: { gaps: gaps.length, redacted: redactedStrings } });
|
|
280
368
|
return { gaps };
|
|
281
369
|
}
|
|
282
370
|
/** Slugger's profile for a run on an archive `archiveBundle` made; the caller removes the archive afterwards. */
|
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.1505",
|
|
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.1505",
|
|
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.1505",
|
|
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": {
|