@farmslot/agent-runtime 0.8.0 → 0.9.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 +14 -0
- package/README.md +2 -2
- package/bin/farmslot-agent.mjs +3 -43
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/native/affinity.test.d.ts +2 -0
- package/dist/native/affinity.test.d.ts.map +1 -0
- package/dist/native/affinity.test.js +30 -0
- package/dist/native/affinity.test.js.map +1 -0
- package/dist/native/claude.d.ts +11 -0
- package/dist/native/claude.d.ts.map +1 -0
- package/dist/native/claude.js +490 -0
- package/dist/native/claude.js.map +1 -0
- package/dist/native/client.d.ts +21 -0
- package/dist/native/client.d.ts.map +1 -0
- package/dist/native/client.js +106 -0
- package/dist/native/client.js.map +1 -0
- package/dist/native/codex.d.ts +3 -0
- package/dist/native/codex.d.ts.map +1 -0
- package/dist/native/codex.js +266 -0
- package/dist/native/codex.js.map +1 -0
- package/dist/native/durability.test.d.ts +2 -0
- package/dist/native/durability.test.d.ts.map +1 -0
- package/dist/native/durability.test.js +516 -0
- package/dist/native/durability.test.js.map +1 -0
- package/dist/native/host.d.ts +2 -0
- package/dist/native/host.d.ts.map +1 -0
- package/dist/native/host.js +90 -0
- package/dist/native/host.js.map +1 -0
- package/dist/native/index.d.ts +4 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +3 -0
- package/dist/native/index.js.map +1 -0
- package/dist/native/ipc.d.ts +49 -0
- package/dist/native/ipc.d.ts.map +1 -0
- package/dist/native/ipc.js +109 -0
- package/dist/native/ipc.js.map +1 -0
- package/dist/native/manager.d.ts +43 -0
- package/dist/native/manager.d.ts.map +1 -0
- package/dist/native/manager.js +510 -0
- package/dist/native/manager.js.map +1 -0
- package/dist/native/process-tree.d.ts +15 -0
- package/dist/native/process-tree.d.ts.map +1 -0
- package/dist/native/process-tree.js +128 -0
- package/dist/native/process-tree.js.map +1 -0
- package/dist/native/process-tree.test.d.ts +2 -0
- package/dist/native/process-tree.test.d.ts.map +1 -0
- package/dist/native/process-tree.test.js +49 -0
- package/dist/native/process-tree.test.js.map +1 -0
- package/dist/native/process.d.ts +34 -0
- package/dist/native/process.d.ts.map +1 -0
- package/dist/native/process.js +223 -0
- package/dist/native/process.js.map +1 -0
- package/dist/native/service.d.ts +7 -0
- package/dist/native/service.d.ts.map +1 -0
- package/dist/native/service.js +117 -0
- package/dist/native/service.js.map +1 -0
- package/dist/native/storage.d.ts +11 -0
- package/dist/native/storage.d.ts.map +1 -0
- package/dist/native/storage.js +102 -0
- package/dist/native/storage.js.map +1 -0
- package/dist/native/supervisor.d.ts +2 -0
- package/dist/native/supervisor.d.ts.map +1 -0
- package/dist/native/supervisor.js +127 -0
- package/dist/native/supervisor.js.map +1 -0
- package/dist/native/types.d.ts +26 -0
- package/dist/native/types.d.ts.map +1 -0
- package/dist/native/types.js +2 -0
- package/dist/native/types.js.map +1 -0
- package/dist/native/workspace-files.d.ts +6 -0
- package/dist/native/workspace-files.d.ts.map +1 -0
- package/dist/native/workspace-files.js +62 -0
- package/dist/native/workspace-files.js.map +1 -0
- package/dist/native/workspace.d.ts +5 -0
- package/dist/native/workspace.d.ts.map +1 -0
- package/dist/native/workspace.js +120 -0
- package/dist/native/workspace.js.map +1 -0
- package/dist/task-init/index.d.ts +66 -0
- package/dist/task-init/index.d.ts.map +1 -0
- package/dist/task-init/index.js +120 -0
- package/dist/task-init/index.js.map +1 -0
- package/dist/task-init/task-document.d.ts +98 -0
- package/dist/task-init/task-document.d.ts.map +1 -0
- package/dist/task-init/task-document.js +184 -0
- package/dist/task-init/task-document.js.map +1 -0
- package/dist/task-init/write.d.ts +48 -0
- package/dist/task-init/write.d.ts.map +1 -0
- package/dist/task-init/write.js +70 -0
- package/dist/task-init/write.js.map +1 -0
- package/package.json +13 -4
- package/scripts/checklist-target.cjs +5 -3
- package/scripts/execution-template-cli.mjs +9 -7
- package/scripts/mark-checklist-step.cjs +4 -2
- package/scripts/task-init-cli.mjs +166 -0
- package/scripts/worker-terminal-contract.cjs +15 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
- Active-development baseline; add user-facing changes here before release or package publication.
|
|
6
6
|
|
|
7
|
+
## 0.9.0 - 2026-09-13
|
|
8
|
+
|
|
9
|
+
- Add `task init` (library `taskInit` + `farmslot-agent task init`): the one producer of a task directory (`TASK.md`, `CHECKLIST.md`, `mark`, `inputs/handoff.json`, `inputs/worker-terminal-contract.json`) for control planes and harnesses alike. `handoff.json` now carries the selected checklist reference (`executionTemplate`) and, for Farmslot, `templateProvenance`; `inputs/execution-template.json` and `inputs/template-provenance.json` are no longer written. `checklist-target.json` is optional: absent means `CHECKLIST.md` + `SIGNAL.json`; `task init` never writes it, role switches do, and a control plane may write the default-valued file during a transition. The `mark` shim is one recorded command with a `FARMSLOT_MARK_CMD` override; `install-mark` is gone. `TASK.md` renders a `## Task` key only when it has a value (no more blank `PR_NUMBER:` / `TICKET_URL:` lines), and its checklist sentence no longer names Farmslot.
|
|
10
|
+
- Worker-template structure lint now rejects a flow template that still carries a `## Task` block or `TASK_DIR:` line (the task writer generates TASK.md); nested-loop role checklists may keep theirs via `lintWorkerTemplateStructure(content, { roleChecklist: true })`.
|
|
11
|
+
- Add idempotent native session creation with caller-reserved IDs, preserving live and terminal reservations across retries.
|
|
12
|
+
- Share native session and bounded workspace operations with execution nodes, with node identity pinned to each host and journal.
|
|
13
|
+
- Preserve native failed-turn diagnostics so clients can show login and provider errors.
|
|
14
|
+
- Add a supervised native session host with private local IPC, durable prompts and command receipts, event replay, and explicit saved-conversation recovery. Disable recovery for older Claude histories affected by documented native history-loss bugs.
|
|
15
|
+
- Include the proposed file changes from native tool events with permission requests so clients can display the action before approval.
|
|
16
|
+
|
|
17
|
+
## 0.8.1 - 2026-08-14
|
|
18
|
+
|
|
19
|
+
- fix(mark): generate and retain an opaque identity for each worker signal attempt.
|
|
20
|
+
|
|
7
21
|
## 0.8.0 - 2026-08-10
|
|
8
22
|
|
|
9
23
|
- fix(execution-templates): an explicit template id excluded only by the domain gate now fails naming the enabling source and domains; the participation gate is exported (`executionTemplateSourceParticipates`/`executionTemplateEntryParticipates`) as the single authority (MANUAL-000076).
|
package/README.md
CHANGED
|
@@ -18,8 +18,8 @@ It does not execute recipes. Recipe graph execution belongs in
|
|
|
18
18
|
## CLI
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
farmslot-agent
|
|
22
|
-
farmslot-agent mark <task-
|
|
21
|
+
farmslot-agent task init <task-dir> --flow fix-bug --run-mode autonomous --platform mobile --template fix-bug/autonomous.mobile --package-templates <catalog> --title "…" --task-text "…"
|
|
22
|
+
farmslot-agent mark <task-dir> complete --mark-last
|
|
23
23
|
farmslot-agent artifact-check <task-dir> --require-recipe-quality-if-recipe
|
|
24
24
|
farmslot-agent recipe-quality build --input recipe-quality-input.json --output artifacts/recipe-quality.json
|
|
25
25
|
farmslot-agent contract resolve --flow fix-bug
|
package/bin/farmslot-agent.mjs
CHANGED
|
@@ -15,7 +15,7 @@ function usage(exitCode = 0) {
|
|
|
15
15
|
'Commands:',
|
|
16
16
|
' mark <task-md> <signal-json> <args...>',
|
|
17
17
|
' artifact-check <task-dir> [args...]',
|
|
18
|
-
'
|
|
18
|
+
' task init <task-dir> --flow f --run-mode m --platform p --template id --title t [options]',
|
|
19
19
|
' recipe-quality build [--input input.json] [--output artifacts/recipe-quality.json]',
|
|
20
20
|
' (flags override top-level input fields; training fields are merged)',
|
|
21
21
|
' contract resolve --flow <flow> [--project-config path] [--mode mode]',
|
|
@@ -382,46 +382,6 @@ async function buildRecipeQuality(args) {
|
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
-
function parseInstallMarkArgs(args) {
|
|
386
|
-
const parsed = { taskDir: args[0], task: 'TASK.md', signal: 'SIGNAL.json' };
|
|
387
|
-
for (let i = 1; i < args.length; i += 1) {
|
|
388
|
-
const arg = args[i];
|
|
389
|
-
if (arg === '--task') {
|
|
390
|
-
parsed.task = args[++i] || parsed.task;
|
|
391
|
-
} else if (arg.startsWith('--task=')) {
|
|
392
|
-
parsed.task = arg.slice('--task='.length);
|
|
393
|
-
} else if (arg === '--signal') {
|
|
394
|
-
parsed.signal = args[++i] || parsed.signal;
|
|
395
|
-
} else if (arg.startsWith('--signal=')) {
|
|
396
|
-
parsed.signal = arg.slice('--signal='.length);
|
|
397
|
-
} else {
|
|
398
|
-
usage(2);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
if (!parsed.taskDir) usage(2);
|
|
402
|
-
return parsed;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
function installMark(args) {
|
|
406
|
-
const parsed = parseInstallMarkArgs(args);
|
|
407
|
-
const taskDir = path.resolve(parsed.taskDir);
|
|
408
|
-
mkdirSync(taskDir, { recursive: true });
|
|
409
|
-
const markPath = path.join(taskDir, 'mark');
|
|
410
|
-
const binPath = path.join(packageRoot, 'bin', 'farmslot-agent.mjs');
|
|
411
|
-
writeFileSync(
|
|
412
|
-
markPath,
|
|
413
|
-
[
|
|
414
|
-
'#!/usr/bin/env bash',
|
|
415
|
-
'set -euo pipefail',
|
|
416
|
-
'DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"',
|
|
417
|
-
`node ${JSON.stringify(binPath)} mark "$DIR" "$@"`,
|
|
418
|
-
'',
|
|
419
|
-
].join('\n'),
|
|
420
|
-
{ mode: 0o755 },
|
|
421
|
-
);
|
|
422
|
-
console.log(`installed ${markPath}`);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
385
|
function parseContractResolveArgs(args) {
|
|
426
386
|
const parsed = { flow: null, mode: null, projectConfig: null };
|
|
427
387
|
for (let i = 0; i < args.length; i += 1) {
|
|
@@ -465,8 +425,8 @@ async function main() {
|
|
|
465
425
|
path.join(packageRoot, 'scripts', 'check-task-artifact-contract.mjs'),
|
|
466
426
|
[subcommand, ...rest].filter((arg) => arg !== undefined),
|
|
467
427
|
);
|
|
468
|
-
} else if (command === '
|
|
469
|
-
|
|
428
|
+
} else if (command === 'task' && subcommand === 'init') {
|
|
429
|
+
runNode(path.join(packageRoot, 'scripts', 'task-init-cli.mjs'), rest);
|
|
470
430
|
} else if (command === 'contract' && subcommand === 'resolve') {
|
|
471
431
|
resolveContract(rest);
|
|
472
432
|
} else if (command === 'recipe-quality' && subcommand === 'build') {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ export declare const AGENT_RUNTIME_SCRIPT_EXPORTS: {
|
|
|
3
3
|
readonly markChecklistStep: "@farmslot/agent-runtime/scripts/mark-checklist-step.cjs";
|
|
4
4
|
readonly workerTerminalContract: "@farmslot/agent-runtime/scripts/worker-terminal-contract.cjs";
|
|
5
5
|
readonly checkTaskArtifactContract: "@farmslot/agent-runtime/scripts/check-task-artifact-contract.mjs";
|
|
6
|
+
readonly taskInitCli: "@farmslot/agent-runtime/scripts/task-init-cli.mjs";
|
|
6
7
|
};
|
|
7
8
|
export * from './execution-template/index.js';
|
|
8
9
|
export * from './recipe-quality.js';
|
|
10
|
+
export * from './task-init/index.js';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,4BAA4B,CAAC;AAE/D,eAAO,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,4BAA4B,CAAC;AAE/D,eAAO,MAAM,4BAA4B;;;;;CAK/B,CAAC;AAEX,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,9 @@ export const AGENT_RUNTIME_SCRIPT_EXPORTS = {
|
|
|
3
3
|
markChecklistStep: '@farmslot/agent-runtime/scripts/mark-checklist-step.cjs',
|
|
4
4
|
workerTerminalContract: '@farmslot/agent-runtime/scripts/worker-terminal-contract.cjs',
|
|
5
5
|
checkTaskArtifactContract: '@farmslot/agent-runtime/scripts/check-task-artifact-contract.mjs',
|
|
6
|
+
taskInitCli: '@farmslot/agent-runtime/scripts/task-init-cli.mjs',
|
|
6
7
|
};
|
|
7
8
|
export * from './execution-template/index.js';
|
|
8
9
|
export * from './recipe-quality.js';
|
|
10
|
+
export * from './task-init/index.js';
|
|
9
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAE/D,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,iBAAiB,EAAE,yDAAyD;IAC5E,sBAAsB,EAAE,8DAA8D;IACtF,yBAAyB,EAAE,kEAAkE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAE/D,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,iBAAiB,EAAE,yDAAyD;IAC5E,sBAAsB,EAAE,8DAA8D;IACtF,yBAAyB,EAAE,kEAAkE;IAC7F,WAAW,EAAE,mDAAmD;CACxD,CAAC;AAEX,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affinity.test.d.ts","sourceRoot":"","sources":["../../src/native/affinity.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import test from 'node:test';
|
|
6
|
+
import { NativeSessionClient } from './client.js';
|
|
7
|
+
import { NativeSessionManager } from './manager.js';
|
|
8
|
+
test('native clients refuse state directories and journals from a different execution node', async () => {
|
|
9
|
+
const root = mkdtempSync(join(tmpdir(), 'native-affinity-'));
|
|
10
|
+
try {
|
|
11
|
+
writeFileSync(join(root, 'host.json'), JSON.stringify({
|
|
12
|
+
executionNodeId: 'node-a',
|
|
13
|
+
pid: process.pid,
|
|
14
|
+
socket: join(root, 'socket'),
|
|
15
|
+
token: 'fixture',
|
|
16
|
+
}), { mode: 0o600 });
|
|
17
|
+
await assert.rejects(new NativeSessionClient(root, 'node-b').list('owner'), /another execution node/);
|
|
18
|
+
writeFileSync(join(root, 'session.journal'), JSON.stringify({ info: { id: 'session', executionNodeId: 'node-a' }, context: {} }) + '\n', { mode: 0o600 });
|
|
19
|
+
assert.throws(() => new NativeSessionManager(root, 'node-b'), /another execution node/);
|
|
20
|
+
await assert.rejects(new NativeSessionManager(join(root, 'fresh'), 'node-a').create('owner', {
|
|
21
|
+
executionNodeId: 'node-b',
|
|
22
|
+
runner: 'codex',
|
|
23
|
+
cwd: root,
|
|
24
|
+
}), /another execution node/);
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
rmSync(root, { recursive: true, force: true });
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=affinity.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affinity.test.js","sourceRoot":"","sources":["../../src/native/affinity.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,E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F,MAAM,MAAM,CAAC,OAAO,CAClB,IAAI,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE;YACtE,eAAe,EAAE,QAAQ;YACzB,MAAM,EAAE,OAAO;YACf,GAAG,EAAE,IAAI;SACV,CAAC,EACF,wBAAwB,CACzB,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NativeAdapter } from './types.js';
|
|
2
|
+
/** Upstream fixed hook-history loss in 2.1.83 and interrupted-tool resume in 2.1.265. */
|
|
3
|
+
export declare function claudeResumeUnavailableReason(version: string): string | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Claude Code's documented stream-json mode is bidirectional: the host sends
|
|
6
|
+
* user/control messages over stdin and receives structured events over stdout.
|
|
7
|
+
* This deliberately runs the installed Claude binary; it does not reproduce
|
|
8
|
+
* Claude's agent loop or authentication through an SDK.
|
|
9
|
+
*/
|
|
10
|
+
export declare const claudeNativeAdapter: NativeAdapter;
|
|
11
|
+
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/native/claude.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAoB,MAAM,YAAY,CAAC;AAIlE,yFAAyF;AACzF,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKjF;AAoCD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,aA8cjC,CAAC"}
|