pi-cohort 7.1.2 → 7.2.1
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 +12 -0
- package/README.md +6 -0
- package/package.json +3 -3
- package/src/execution-backend/child-host-controller.ts +10 -8
- package/src/extension/doctor.ts +6 -2
- package/src/extension/fanout-child.ts +2 -2
- package/src/extension/index.ts +10 -45
- package/src/runs/background/async-execution.ts +154 -87
- package/src/runs/background/async-job-tracker.ts +4 -1
- package/src/runs/background/async-resume.ts +93 -17
- package/src/runs/background/async-status.ts +12 -9
- package/src/runs/background/external-attempt.ts +6 -2
- package/src/runs/background/notify.ts +2 -13
- package/src/runs/background/run-id-resolver.ts +15 -18
- package/src/runs/background/run-status.ts +22 -11
- package/src/runs/background/stale-run-reconciler.ts +9 -1
- package/src/runs/background/subagent-runner.ts +54 -79
- package/src/runs/foreground/chain-execution.ts +7 -0
- package/src/runs/foreground/execution.ts +30 -13
- package/src/runs/foreground/external-single-attempt.ts +3 -2
- package/src/runs/foreground/subagent-executor.ts +142 -63
- package/src/runs/shared/external-execution.ts +2 -0
- package/src/runs/shared/jiti-cli.ts +17 -48
- package/src/runs/shared/nested-events.ts +103 -30
- package/src/runs/shared/pi-spawn.ts +75 -67
- package/src/shared/agent-dir.ts +12 -0
- package/src/shared/atomic-json.ts +12 -1
- package/src/shared/fork-context.ts +15 -3
- package/src/shared/types.ts +11 -1
- package/src/shared/utils.ts +1 -6
package/src/shared/types.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as os from "node:os";
|
|
6
6
|
import * as path from "node:path";
|
|
7
|
+
import { PINNED_AGENT_DIR } from "./agent-dir.ts";
|
|
8
|
+
import type { PiRuntimeIdentity } from "../runs/shared/pi-spawn.ts";
|
|
7
9
|
import type { Message } from "@earendil-works/pi-ai";
|
|
8
10
|
import type { FSWatcher } from "node:fs";
|
|
9
11
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
@@ -495,6 +497,8 @@ export interface NestedStepSummary {
|
|
|
495
497
|
}
|
|
496
498
|
|
|
497
499
|
export interface NestedRunSummary extends NestedRunAddress {
|
|
500
|
+
runtime?: PiRuntimeIdentity;
|
|
501
|
+
sessionRoot?: string;
|
|
498
502
|
asyncDir?: string;
|
|
499
503
|
pid?: number;
|
|
500
504
|
sessionId?: string;
|
|
@@ -549,6 +553,8 @@ export interface AsyncStartedEvent {
|
|
|
549
553
|
}
|
|
550
554
|
|
|
551
555
|
export interface AsyncStatus {
|
|
556
|
+
runtime?: PiRuntimeIdentity;
|
|
557
|
+
error?: string;
|
|
552
558
|
runId: string;
|
|
553
559
|
sessionId?: string;
|
|
554
560
|
mode: SubagentRunMode;
|
|
@@ -660,6 +666,7 @@ export interface ForegroundResumeChild {
|
|
|
660
666
|
}
|
|
661
667
|
|
|
662
668
|
export interface ForegroundResumeRun {
|
|
669
|
+
runtime?: PiRuntimeIdentity;
|
|
663
670
|
runId: string;
|
|
664
671
|
mode: SubagentRunMode;
|
|
665
672
|
cwd: string;
|
|
@@ -750,6 +757,7 @@ export const SUBAGENT_CONTROL_EVENT = "subagent:control-event";
|
|
|
750
757
|
// ============================================================================
|
|
751
758
|
|
|
752
759
|
export interface RunSyncOptions {
|
|
760
|
+
runtime: PiRuntimeIdentity;
|
|
753
761
|
cwd?: string;
|
|
754
762
|
signal?: AbortSignal;
|
|
755
763
|
interruptSignal?: AbortSignal;
|
|
@@ -902,7 +910,9 @@ const MAX_PARALLEL = 8;
|
|
|
902
910
|
export const MAX_CONCURRENCY = 4;
|
|
903
911
|
export const TEMP_ROOT_DIR = path.join(os.tmpdir(), `pi-cohort-${resolveTempScopeId()}`);
|
|
904
912
|
export const RESULTS_DIR = path.join(TEMP_ROOT_DIR, "async-subagent-results");
|
|
905
|
-
export const
|
|
913
|
+
export const RUN_STATE_ROOT_DIR = path.join(PINNED_AGENT_DIR, "pi-cohort");
|
|
914
|
+
export const ASYNC_DIR = path.join(RUN_STATE_ROOT_DIR, "async-subagent-runs");
|
|
915
|
+
export const LEGACY_ASYNC_DIR = path.join(TEMP_ROOT_DIR, "async-subagent-runs");
|
|
906
916
|
export const CHAIN_RUNS_DIR = path.join(TEMP_ROOT_DIR, "chain-runs");
|
|
907
917
|
export const TEMP_ARTIFACTS_DIR = path.join(TEMP_ROOT_DIR, "artifacts");
|
|
908
918
|
export const WIDGET_KEY = "pi-cohort-async";
|
package/src/shared/utils.ts
CHANGED
|
@@ -13,12 +13,7 @@ import type { AgentProgress, AsyncStatus, Details, DisplayItem, ErrorInfo, Singl
|
|
|
13
13
|
// File System Utilities
|
|
14
14
|
// ============================================================================
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
const configured = process.env.PI_CODING_AGENT_DIR;
|
|
18
|
-
if (configured === "~") return os.homedir();
|
|
19
|
-
if (configured?.startsWith("~/")) return path.join(os.homedir(), configured.slice(2));
|
|
20
|
-
return configured || path.join(os.homedir(), ".pi", "agent");
|
|
21
|
-
}
|
|
16
|
+
export { getAgentDir } from "./agent-dir.ts";
|
|
22
17
|
|
|
23
18
|
const statusCache = new Map<string, { mtime: number; status: AsyncStatus }>();
|
|
24
19
|
|