@farmslot/agent-runtime 0.40.1 → 0.41.0
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 +8 -0
- package/dist/native/opencode.d.ts.map +1 -1
- package/dist/native/opencode.js +16 -0
- package/dist/native/opencode.js.map +1 -1
- package/dist/native/pi.d.ts.map +1 -1
- package/dist/native/pi.js +3 -0
- package/dist/native/pi.js.map +1 -1
- package/dist/native/registry.d.ts.map +1 -1
- package/dist/native/registry.js +11 -17
- package/dist/native/registry.js.map +1 -1
- package/dist/task-init/branch-update.d.ts +23 -3
- package/dist/task-init/branch-update.d.ts.map +1 -1
- package/dist/task-init/branch-update.js +99 -5
- package/dist/task-init/branch-update.js.map +1 -1
- package/dist/task-init/execution-provenance.d.ts +2 -0
- package/dist/task-init/execution-provenance.d.ts.map +1 -1
- package/dist/task-init/execution-provenance.js +43 -13
- package/dist/task-init/execution-provenance.js.map +1 -1
- package/dist/task-init/pin.d.ts +3 -1
- package/dist/task-init/pin.d.ts.map +1 -1
- package/dist/task-init/pin.js +13 -3
- package/dist/task-init/pin.js.map +1 -1
- package/dist/task-init/task-document.d.ts.map +1 -1
- package/dist/task-init/task-document.js +2 -1
- package/dist/task-init/task-document.js.map +1 -1
- package/dist/task-init/write.d.ts +27 -0
- package/dist/task-init/write.d.ts.map +1 -1
- package/dist/task-init/write.js +38 -2
- package/dist/task-init/write.js.map +1 -1
- package/package.json +2 -2
- package/scripts/branch-update.mjs +6 -3
- package/scripts/review-terminal.cjs +20 -17
- package/scripts/workspace-trust.cjs +35 -0
|
@@ -123,31 +123,17 @@ async function main() {
|
|
|
123
123
|
readOnlyRoots: [
|
|
124
124
|
cwd,
|
|
125
125
|
fs.realpathSync(gitRoot),
|
|
126
|
-
...(input.support ? [
|
|
126
|
+
...(input.readOnlyRoots ?? (input.support ? [input.support] : [])).map((root) =>
|
|
127
|
+
fs.realpathSync(root),
|
|
128
|
+
),
|
|
127
129
|
],
|
|
128
130
|
writableRoots: [task],
|
|
129
131
|
};
|
|
130
|
-
const runtimeRoots = input.runtimeRoots.map((root) =>
|
|
131
|
-
root.replace(/^~(?=\/|$)/, process.env.HOME),
|
|
132
|
-
);
|
|
133
|
-
const {
|
|
134
|
-
workspaceTrustByRunner,
|
|
135
|
-
reviewConfigurationRootsByRunner,
|
|
136
|
-
terminalReviewRefusalByRunner,
|
|
137
|
-
} = require('./workspace-trust.cjs');
|
|
138
|
-
if (terminalReviewRefusalByRunner[input.runner])
|
|
139
|
-
throw new Error(terminalReviewRefusalByRunner[input.runner]);
|
|
140
|
-
const guard = await sandbox(
|
|
141
|
-
policy,
|
|
142
|
-
runtimeRoots,
|
|
143
|
-
reviewConfigurationRootsByRunner[input.runner]?.(cwd) ?? [],
|
|
144
|
-
);
|
|
145
132
|
const promptFile = path.join(task, '.terminal-prompt.txt');
|
|
146
133
|
fs.writeFileSync(promptFile, input.prompt, { mode: 0o600 });
|
|
147
134
|
const environment = {
|
|
148
135
|
...process.env,
|
|
149
136
|
...input.environment.set,
|
|
150
|
-
TMPDIR: guard.temporaryDirectory,
|
|
151
137
|
DISABLE_OMX: '1',
|
|
152
138
|
DISABLE_OMC: '1',
|
|
153
139
|
};
|
|
@@ -159,6 +145,23 @@ async function main() {
|
|
|
159
145
|
'FARMSLOT_GATEWAY_PASSWORD',
|
|
160
146
|
])
|
|
161
147
|
delete environment[key];
|
|
148
|
+
const {
|
|
149
|
+
workspaceTrustByRunner,
|
|
150
|
+
reviewConfigurationRootsByRunner,
|
|
151
|
+
terminalReviewRefusalByRunner,
|
|
152
|
+
reviewRuntimeRootsByRunner,
|
|
153
|
+
} = require('./workspace-trust.cjs');
|
|
154
|
+
if (terminalReviewRefusalByRunner[input.runner])
|
|
155
|
+
throw new Error(terminalReviewRefusalByRunner[input.runner]);
|
|
156
|
+
const runtimeRoots = (
|
|
157
|
+
reviewRuntimeRootsByRunner[input.runner]?.(environment) ?? input.runtimeRoots
|
|
158
|
+
).map((root) => root.replace(/^~(?=\/|$)/, environment.HOME));
|
|
159
|
+
const guard = await sandbox(
|
|
160
|
+
policy,
|
|
161
|
+
runtimeRoots,
|
|
162
|
+
reviewConfigurationRootsByRunner[input.runner]?.(cwd) ?? [],
|
|
163
|
+
);
|
|
164
|
+
environment.TMPDIR = guard.temporaryDirectory;
|
|
162
165
|
environment.FARMSLOT_SIGNAL_ATTEMPT_ID = require('node:crypto').randomUUID();
|
|
163
166
|
// This helper accepts only the gateway's farm review launch, after identity and source-policy checks.
|
|
164
167
|
workspaceTrustByRunner[input.runner]?.(cwd, environment, undefined, {
|
|
@@ -202,6 +202,32 @@ function trustClaudeWorkspace(cwd, env = process.env, owner) {
|
|
|
202
202
|
function codexWorkspaceTrustConfig(cwd, trust) {
|
|
203
203
|
return `projects={${JSON.stringify(cwd)}={trust_level=${JSON.stringify(trust)}}}`;
|
|
204
204
|
}
|
|
205
|
+
// Both native hosts and frozen terminal bundles resolve storage on the execution node.
|
|
206
|
+
const reviewRuntimeRootsByRunner = {
|
|
207
|
+
codex: (env) => [codexHome(env)],
|
|
208
|
+
claude: (env) => [
|
|
209
|
+
env.CLAUDE_CONFIG_DIR || path.join(home(env), '.claude'),
|
|
210
|
+
...(typeof process.getuid === 'function'
|
|
211
|
+
? [path.join('/tmp', `claude-${process.getuid()}`)]
|
|
212
|
+
: []),
|
|
213
|
+
],
|
|
214
|
+
cursor: (env) => [
|
|
215
|
+
path.join(home(env), '.cursor'),
|
|
216
|
+
path.join(home(env), 'Library/Caches/cursor-compile-cache'),
|
|
217
|
+
path.join(home(env), 'Library/Application Support/Cursor'),
|
|
218
|
+
...(typeof process.getuid === 'function'
|
|
219
|
+
? [path.join('/tmp', `cursor-agent-persist-${process.getuid()}`)]
|
|
220
|
+
: []),
|
|
221
|
+
],
|
|
222
|
+
grok: (env) => [grokHome(env)],
|
|
223
|
+
pi: (env) => [env.PI_CODING_AGENT_DIR || path.join(home(env), '.pi/agent')],
|
|
224
|
+
opencode: (env) => [
|
|
225
|
+
path.join(env.XDG_DATA_HOME || path.join(home(env), '.local/share'), 'opencode'),
|
|
226
|
+
path.join(env.XDG_CACHE_HOME || path.join(home(env), '.cache'), 'opencode'),
|
|
227
|
+
path.join(env.XDG_STATE_HOME || path.join(home(env), '.local/state'), 'opencode'),
|
|
228
|
+
path.join(env.XDG_CONFIG_HOME || path.join(home(env), '.config'), 'opencode'),
|
|
229
|
+
],
|
|
230
|
+
};
|
|
205
231
|
const reviewConfigurationRoots = (cwd) =>
|
|
206
232
|
[
|
|
207
233
|
'.grok/config.toml',
|
|
@@ -218,6 +244,10 @@ const reviewConfigurationRoots = (cwd) =>
|
|
|
218
244
|
'.mcp.json',
|
|
219
245
|
'.lsp.json',
|
|
220
246
|
'.envrc',
|
|
247
|
+
'.pi',
|
|
248
|
+
'.opencode',
|
|
249
|
+
'opencode.json',
|
|
250
|
+
'opencode.jsonc',
|
|
221
251
|
].map((name) => path.join(fs.realpathSync(cwd), name));
|
|
222
252
|
// What a Grok review may write in its home: its sessions and logs, and the bytes of the sign-in
|
|
223
253
|
// lock that a token refresh takes. Everything else stays read-only: hooks, configuration, policy,
|
|
@@ -239,10 +269,13 @@ const reviewConfigurationRootsByRunner = {
|
|
|
239
269
|
grok: reviewConfigurationRoots,
|
|
240
270
|
claude: reviewConfigurationRoots,
|
|
241
271
|
cursor: reviewConfigurationRoots,
|
|
272
|
+
pi: reviewConfigurationRoots,
|
|
273
|
+
opencode: reviewConfigurationRoots,
|
|
242
274
|
};
|
|
243
275
|
|
|
244
276
|
// The review sandbox denies repository configuration. Exclude it before Claude
|
|
245
277
|
// tries to read it, rather than prompting on EPERM before accepting the task.
|
|
278
|
+
const piReadOnlyReviewArgs = ['--no-approve'];
|
|
246
279
|
const claudeReadOnlyReviewArgs = [
|
|
247
280
|
'--setting-sources',
|
|
248
281
|
'user',
|
|
@@ -251,6 +284,8 @@ const claudeReadOnlyReviewArgs = [
|
|
|
251
284
|
];
|
|
252
285
|
|
|
253
286
|
module.exports = {
|
|
287
|
+
reviewRuntimeRootsByRunner,
|
|
288
|
+
piReadOnlyReviewArgs,
|
|
254
289
|
claudeReadOnlyReviewArgs,
|
|
255
290
|
codexHome,
|
|
256
291
|
grokHome,
|