@farmslot/agent-runtime 0.39.25 → 0.39.27

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.md CHANGED
@@ -4,6 +4,14 @@
4
4
 
5
5
  - Active-development baseline; add user-facing changes here before release or package publication.
6
6
 
7
+ ## 0.39.27 - 2026-11-02
8
+
9
+ - A Grok review cannot remove, rename or replace `sessions/`, `logs/` or `logs/unified.jsonl` in the Grok home, so it cannot move a link or a prepared directory into their place for a later Grok start to write through. The farm creates any of them that is missing before the review starts, and refuses to start when one is a link or the wrong type.
10
+
11
+ ## 0.39.26 - 2026-11-02
12
+
13
+ - Align `@farmslot/adapter-sdk` 0.26.1.
14
+
7
15
  ## 0.39.25 - 2026-11-02
8
16
 
9
17
  - Publishes against `@farmslot/protocol` 0.74.10.
@@ -3,6 +3,8 @@ import type { NativeWorkerFilesystemPolicy } from './worker-launch.js';
3
3
  export interface NativeReviewRuntimeAccess {
4
4
  writablePaths?: string[];
5
5
  dataFiles?: string[];
6
+ /** Files inside writable paths that keep their identity: writable, never removed or replaced. */
7
+ fixedPaths?: string[];
6
8
  }
7
9
  export interface NativeProcessSandbox {
8
10
  executable: string;
@@ -1 +1 @@
1
- {"version":3,"file":"review-sandbox.d.ts","sourceRoot":"","sources":["../../src/native/review-sandbox.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAEvE,kGAAkG;AAClG,MAAM,WAAW,yBAAyB;IACxC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AACD,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAUD,eAAO,MAAM,0BAA0B,QARxB,OAQmD,CAAC;AACnE,4FAA4F;AAC5F,eAAO,MAAM,oBAAoB,WARrB,4BAA4B,gBACtB,MAAM,EAAE,uBACD,MAAM,EAAE,kBACb,yBAAyB,KACxC,OAAO,CAAC;IAAE,OAAO,EAAE,oBAAoB,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAA;CAAE,CAIhB,CAAC"}
1
+ {"version":3,"file":"review-sandbox.d.ts","sourceRoot":"","sources":["../../src/native/review-sandbox.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAEvE,kGAAkG;AAClG,MAAM,WAAW,yBAAyB;IACxC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,iGAAiG;IACjG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AACD,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAUD,eAAO,MAAM,0BAA0B,QARxB,OAQmD,CAAC;AACnE,4FAA4F;AAC5F,eAAO,MAAM,oBAAoB,WARrB,4BAA4B,gBACtB,MAAM,EAAE,uBACD,MAAM,EAAE,kBACb,yBAAyB,KACxC,OAAO,CAAC;IAAE,OAAO,EAAE,oBAAoB,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAA;CAAE,CAIhB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"review-sandbox.js","sourceRoot":"","sources":["../../src/native/review-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAa5C,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,qCAAqC,CAQ1F,CAAC;AACF,MAAM,CAAC,MAAM,0BAA0B,GAAG,cAAc,CAAC,SAAS,CAAC;AACnE,4FAA4F;AAC5F,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,CAAC"}
1
+ {"version":3,"file":"review-sandbox.js","sourceRoot":"","sources":["../../src/native/review-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAe5C,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,qCAAqC,CAQ1F,CAAC;AACF,MAAM,CAAC,MAAM,0BAA0B,GAAG,cAAc,CAAC,SAAS,CAAC;AACnE,4FAA4F;AAC5F,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farmslot/agent-runtime",
3
- "version": "0.39.25",
3
+ "version": "0.39.27",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -69,7 +69,7 @@
69
69
  "test:branch-maintenance-live": "node --import tsx --test test/branch-maintenance-live.mts"
70
70
  },
71
71
  "dependencies": {
72
- "@farmslot/adapter-sdk": "0.26.0",
72
+ "@farmslot/adapter-sdk": "0.26.1",
73
73
  "@farmslot/protocol": "0.74.10"
74
74
  },
75
75
  "devDependencies": {
@@ -32,12 +32,17 @@ async function sandbox(policy, runtimeRoots, configurationRoots = [], runtimeAcc
32
32
  throw new Error('Writable review runtime path must belong to a runtime root');
33
33
  return resolved;
34
34
  };
35
+ // Named paths exist before the review starts, so a pin on one always holds something: a review
36
+ // cannot create an absent one as a link or a prepared directory.
35
37
  const runtimeWritable = [];
36
- for (const file of runtimeAccess.writablePaths ?? []) runtimeWritable.push(await inRuntime(file));
37
- // A data file keeps its identity: a review may write its bytes but not replace, rename or
38
- // remove it, so a later process that opens it cannot be pointed elsewhere.
39
- const runtimeData = [];
40
- for (const file of runtimeAccess.dataFiles ?? []) {
38
+ for (const file of runtimeAccess.writablePaths ?? []) {
39
+ const resolved = await inRuntime(file);
40
+ await mkdir(resolved, { recursive: true, mode: 0o700 });
41
+ if (!(await lstat(resolved)).isDirectory())
42
+ throw new Error('Review runtime writable path must be a directory');
43
+ runtimeWritable.push(resolved);
44
+ }
45
+ const runtimeFile = async (file) => {
41
46
  const resolved = await inRuntime(file);
42
47
  try {
43
48
  await writeFile(resolved, '', { flag: 'wx', mode: 0o600 });
@@ -45,12 +50,20 @@ async function sandbox(policy, runtimeRoots, configurationRoots = [], runtimeAcc
45
50
  if (error.code !== 'EEXIST') throw error;
46
51
  }
47
52
  if (!(await lstat(resolved)).isFile())
48
- throw new Error('Review runtime data file must be a regular file');
49
- runtimeData.push(resolved);
50
- }
53
+ throw new Error('Review runtime file must be a regular file');
54
+ return resolved;
55
+ };
56
+ // A data file keeps its identity: a review may write its bytes but not replace, rename or
57
+ // remove it, so a later process that opens it cannot be pointed elsewhere.
58
+ const runtimeData = [];
59
+ for (const file of runtimeAccess.dataFiles ?? []) runtimeData.push(await runtimeFile(file));
51
60
  const restrictedRuntime = runtime.filter((root) =>
52
61
  [...runtimeWritable, ...runtimeData].some((file) => file.startsWith(root + sep)),
53
62
  );
63
+ // A writable path, and any named file in it, cannot be removed, renamed or swapped, so a review
64
+ // cannot move a link or a prepared directory into its place for a later process to write through.
65
+ const runtimeFixed = [...runtimeWritable];
66
+ for (const file of runtimeAccess.fixedPaths ?? []) runtimeFixed.push(await runtimeFile(file));
54
67
  const blockedConfiguration = [];
55
68
  for (const file of configurationRoots) {
56
69
  const source = readOnly.find((root) => file.startsWith(root + sep));
@@ -83,6 +96,7 @@ async function sandbox(policy, runtimeRoots, configurationRoots = [], runtimeAcc
83
96
  `(deny file-write-create (require-all (subpath ${JSON.stringify(root)}) (vnode-type SYMLINK)))`,
84
97
  ),
85
98
  ...restrictedRuntime.map((root) => `(deny file-link (subpath ${JSON.stringify(root)}))`),
99
+ ...runtimeFixed.map((file) => `(deny file-write-unlink (literal ${JSON.stringify(file)}))`),
86
100
  ...blockedConfiguration.map(
87
101
  (root) => `(deny file-read-data (subpath ${JSON.stringify(root)}))`,
88
102
  ),
@@ -227,6 +227,8 @@ const reviewConfigurationRoots = (cwd) =>
227
227
  const grokReviewHomeAccess = (env) => ({
228
228
  writablePaths: ['sessions', 'logs'].map((name) => path.join(grokHome(env), name)),
229
229
  dataFiles: [path.join(grokHome(env), 'auth.json.lock')],
230
+ // The log an unsandboxed Grok start appends to.
231
+ fixedPaths: [path.join(grokHome(env), 'logs', 'unified.jsonl')],
230
232
  });
231
233
  // A Grok review checkout stays untrusted (ADR-057 Amendment 13), and Grok's terminal then stops
232
234
  // at "Do you trust the contents of this directory?" for any checkout with project configuration.