pi-durable-subagents 1.5.0 → 1.6.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 +38 -0
- package/README.md +69 -14
- package/dist/agent/capabilities.js +5 -4
- package/dist/agent/child/live.js +2 -1
- package/dist/agent/exact/capture.js +3 -2
- package/dist/agent/main/snapshots.js +10 -9
- package/dist/agent/main.js +2 -1
- package/dist/cli/chaos/stack.js +53 -21
- package/dist/cli/control.js +4 -3
- package/dist/cli/doctor.js +3 -1
- package/dist/cli/drill/index.js +35 -17
- package/dist/cli/hold.js +221 -16
- package/dist/cli/restart.js +14 -2
- package/dist/cli/service.js +77 -2
- package/dist/cli/smoke.js +10 -6
- package/dist/compat/agents.js +46 -13
- package/dist/events/log.js +33 -11
- package/dist/kernel/cache.js +3 -2
- package/dist/kernel/fsx.js +203 -0
- package/dist/kernel/ids.js +11 -0
- package/dist/kernel/journal.js +42 -25
- package/dist/kernel/mailbox.js +7 -4
- package/dist/orchestrator/engine.js +49 -46
- package/dist/orchestrator/evaluator-client.js +11 -3
- package/dist/orchestrator/executor/command.js +21 -6
- package/dist/orchestrator/executor/effects/gate.js +291 -56
- package/dist/orchestrator/executor/effects/index.js +3 -4
- package/dist/orchestrator/executor/effects/output.js +9 -5
- package/dist/orchestrator/executor/effects/prepare.js +69 -35
- package/dist/orchestrator/executor/effects/worktree-path.js +102 -0
- package/dist/orchestrator/executor/ended.js +7 -3
- package/dist/orchestrator/executor/index.js +221 -63
- package/dist/orchestrator/executor/memory.js +15 -0
- package/dist/orchestrator/executor/session.js +4 -3
- package/dist/orchestrator/executor/sweep.js +34 -1
- package/dist/orchestrator/executor/worktree.js +7 -1
- package/dist/orchestrator/main.js +4 -2
- package/dist/orchestrator/reader-ledger.js +3 -2
- package/dist/orchestrator/settled.js +2 -1
- package/dist/orchestrator/snapshot.js +29 -22
- package/dist/orchestrator/stats.js +2 -1
- package/dist/orchestrator/store.js +3 -2
- package/dist/platform/cmdline.js +3 -0
- package/dist/platform/command.js +184 -20
- package/dist/platform/containment.js +204 -40
- package/dist/platform/job.js +1404 -0
- package/dist/platform/launch.js +157 -23
- package/dist/platform/lease.js +351 -32
- package/dist/platform/lock.js +464 -16
- package/dist/platform/proctable.js +31 -2
- package/dist/platform/windows.js +642 -0
- package/dist/requests.js +1 -1
- package/dist/ui/data.js +7 -6
- package/dist/ui/session.js +6 -5
- package/package.json +3 -3
package/dist/ui/data.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { readFileSync
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
+
import { fileIdentityKey, isFileIdentityKey, statIdentitySync } from "../kernel/fsx.js";
|
|
4
5
|
import { crc32, readJournalSnapshot } from "../kernel/journal.js";
|
|
5
6
|
import { readCache, writeCache } from "../kernel/cache.js";
|
|
6
7
|
import { allWorkflows, isLive, ownWorkflows, releaseSettledJournals, SETTLED_RECHECK_MS, workflowDigest, workflowDigestChecked } from "../orchestrator/snapshot.js";
|
|
@@ -70,8 +71,7 @@ function factsVersion() {
|
|
|
70
71
|
return factsCode;
|
|
71
72
|
}
|
|
72
73
|
const sessionIdentity = (path) => { try {
|
|
73
|
-
|
|
74
|
-
return `${s.dev}:${s.ino}:${s.size}`;
|
|
74
|
+
return fileIdentityKey(statIdentitySync(path));
|
|
75
75
|
}
|
|
76
76
|
catch {
|
|
77
77
|
return "none";
|
|
@@ -83,7 +83,8 @@ function storedFacts(path, callId, endedAt, session) {
|
|
|
83
83
|
return undefined;
|
|
84
84
|
try {
|
|
85
85
|
const stored = readCache(path);
|
|
86
|
-
|
|
86
|
+
const validSession = stored?.session === "none" || isFileIdentityKey(stored?.session);
|
|
87
|
+
return stored?.v === v && stored.callId === callId && stored.endedAt === endedAt && validSession && stored.session === session &&
|
|
87
88
|
typeof stored.facts?.task === "string" && typeof stored.facts.latest === "string" && Number.isFinite(stored.facts.tools) ? { ...stored.facts, model: stored.facts.model, thinking: stored.facts.thinking, activity: stored.facts.activity, live: undefined } : undefined;
|
|
88
89
|
}
|
|
89
90
|
catch {
|
|
@@ -134,8 +135,8 @@ export class UiData {
|
|
|
134
135
|
const path = join(this.home, "config.json");
|
|
135
136
|
let identity = "none";
|
|
136
137
|
try {
|
|
137
|
-
const s =
|
|
138
|
-
identity = `${s
|
|
138
|
+
const s = statIdentitySync(path);
|
|
139
|
+
identity = `${fileIdentityKey(s)}:${s.stats.mtimeNs}:${s.stats.ctimeNs}`;
|
|
139
140
|
}
|
|
140
141
|
catch { /* optional */ }
|
|
141
142
|
if (identity === this.configIdentity)
|
package/dist/ui/session.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Read-only session tailing (C5, P21): incomplete trailing records are never displayed.
|
|
2
|
-
import { closeSync,
|
|
2
|
+
import { closeSync, openSync, readSync } from "node:fs";
|
|
3
3
|
import { StringDecoder } from "node:string_decoder";
|
|
4
|
+
import { fileIdentityKey, fstatIdentitySync, statIdentitySync } from "../kernel/fsx.js";
|
|
4
5
|
import { CT } from "../types.js";
|
|
5
6
|
/** C5: Incrementally read complete pi session records, resetting after replacement or truncation. */
|
|
6
7
|
export class SessionTail {
|
|
@@ -17,7 +18,7 @@ export class SessionTail {
|
|
|
17
18
|
read(path) {
|
|
18
19
|
let stat;
|
|
19
20
|
try {
|
|
20
|
-
stat =
|
|
21
|
+
stat = statIdentitySync(path);
|
|
21
22
|
}
|
|
22
23
|
catch (error) {
|
|
23
24
|
if (error.code !== "ENOENT")
|
|
@@ -34,18 +35,18 @@ export class SessionTail {
|
|
|
34
35
|
throw this.failure;
|
|
35
36
|
if (stat.size === this.offset) {
|
|
36
37
|
if (!stat.size)
|
|
37
|
-
this.readIdentity =
|
|
38
|
+
this.readIdentity = fileIdentityKey(stat);
|
|
38
39
|
return this.entries;
|
|
39
40
|
}
|
|
40
41
|
const fd = openSync(path, "r");
|
|
41
42
|
try {
|
|
42
|
-
stat =
|
|
43
|
+
stat = fstatIdentitySync(fd);
|
|
43
44
|
const openedIdentity = `${path}:${stat.dev}:${stat.ino}`;
|
|
44
45
|
if (openedIdentity !== this.identity || stat.size < this.offset) {
|
|
45
46
|
this.reset();
|
|
46
47
|
this.identity = openedIdentity;
|
|
47
48
|
}
|
|
48
|
-
this.readIdentity =
|
|
49
|
+
this.readIdentity = fileIdentityKey(stat);
|
|
49
50
|
this.readSize = stat.size;
|
|
50
51
|
const buffer = Buffer.alloc(Math.min(64 * 1024, stat.size - this.offset));
|
|
51
52
|
while (this.offset < stat.size) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-durable-subagents",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Subagents for pi that never lose work and never do it twice. Crash-safe workflows, automatic recovery, and a live view just like the main agent.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
38
38
|
"lint:imports": "node scripts/check-imports.mjs",
|
|
39
39
|
"test": "npm run test:unit && npm run test:pi",
|
|
40
|
-
"test:unit": "node --test
|
|
41
|
-
"test:pi": "node --test --test-concurrency=1
|
|
40
|
+
"test:unit": "node --test \"test/unit/**/*.test.ts\"",
|
|
41
|
+
"test:pi": "node --test --test-concurrency=1 \"test/pi/**/*.test.ts\"",
|
|
42
42
|
"check": "npm run typecheck && npm run lint:imports && npm test",
|
|
43
43
|
"pack:smoke": "node scripts/pack-smoke.mjs",
|
|
44
44
|
"prepack": "npm run build"
|