pi-cowboy 0.9.0 → 0.9.2
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.
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* cow-support-launch.ts — ask the worktree volume, once per session, which
|
|
3
3
|
* materializations it can honor, and let the shell answer for every later reader.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Awaited at `session_start`, so the probe's `finally rm` always runs while
|
|
6
|
+
* this process lives: a session that exits mid-probe would otherwise orphan
|
|
7
|
+
* its `.cow-probe-*` directory. The block is one small clone (~100ms), once
|
|
8
|
+
* per session. Each probe carries a claim, so a slow one cannot overwrite the
|
|
9
9
|
* answer of a newer probe about a different volume.
|
|
10
10
|
*/
|
|
11
11
|
import { detectCowAvailability, probeTargetFor } from "./spawn/cow-support.js";
|
|
@@ -16,7 +16,7 @@ function execOf(pi) {
|
|
|
16
16
|
return (command, args, options) => pi.exec(command, args, options);
|
|
17
17
|
}
|
|
18
18
|
export function startCowSupportProbe(pi) {
|
|
19
|
-
probe(pi, beginCowAvailabilityProbe());
|
|
19
|
+
return probe(pi, beginCowAvailabilityProbe());
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Ask again, because the worktree root can move to another volume. The answer
|
|
@@ -26,7 +26,7 @@ export function startCowSupportProbe(pi) {
|
|
|
26
26
|
export function refreshCowSupportProbe(pi) {
|
|
27
27
|
const claim = beginCowAvailabilityProbe();
|
|
28
28
|
setCowAvailability(claim, unprobed());
|
|
29
|
-
probe(pi, claim);
|
|
29
|
+
return probe(pi, claim);
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Run one probe and record its verdict under the claim it was opened with. An
|
|
@@ -35,7 +35,7 @@ export function refreshCowSupportProbe(pi) {
|
|
|
35
35
|
*/
|
|
36
36
|
function probe(pi, claim) {
|
|
37
37
|
const target = probeTargetFor(getStore().agent.worktreeRoot);
|
|
38
|
-
|
|
38
|
+
return detectCowAvailability(execOf(pi), target).then((availability) => {
|
|
39
39
|
setCowAvailability(claim, availability);
|
|
40
40
|
}, () => {
|
|
41
41
|
setCowAvailability(claim, probed(["checkout"]));
|
package/dist/events.js
CHANGED
|
@@ -14,6 +14,7 @@ import { ACTIVE_AGENT_PHASES } from "./types.js";
|
|
|
14
14
|
import { SpawnCoordinator } from "./spawn/spawn-coordinator.js";
|
|
15
15
|
import { toolCallListener } from "./agents/tool-execution.js";
|
|
16
16
|
import { activateExtension, deactivateExtension } from "./registration.js";
|
|
17
|
+
import { startCowSupportProbe } from "./cow-support-launch.js";
|
|
17
18
|
import { isExtensionEnabled } from "./extension-toggle.js";
|
|
18
19
|
import { hideExtensionIndicator } from "./ui/indicator.js";
|
|
19
20
|
import { createSessionTemplates, getManagerOrNull, getCoordinatorOrNull, getStore, setSessionCtx, setManager, setCoordinator, setRuntime, setSessionTemplates, } from "./shell.js";
|
|
@@ -98,6 +99,10 @@ export function setupEventListeners(pi) {
|
|
|
98
99
|
pi.on("session_start", async (_event, ctx) => {
|
|
99
100
|
setSessionCtx(ctx);
|
|
100
101
|
await loadSessionConfig(ctx);
|
|
102
|
+
// Awaited: one small clone (~100ms), and awaiting is what guarantees the
|
|
103
|
+
// probe's `finally rm` runs — a fire-and-forget probe orphaned its
|
|
104
|
+
// `.cow-probe-*` directory whenever a quick session exited mid-probe.
|
|
105
|
+
await startCowSupportProbe(pi);
|
|
101
106
|
if (isExtensionEnabled()) {
|
|
102
107
|
activateExtension(ctx.ui);
|
|
103
108
|
}
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,8 @@ import { missingCloneProgramReport } from "./infrastructure/git/cow-clone.js";
|
|
|
9
9
|
import { isInsideGitRepository } from "./infrastructure/git-client.js";
|
|
10
10
|
import { registerCowboyCommand, registerTools, registerUnavailableCowboyCommand, } from "./registration.js";
|
|
11
11
|
import { setupEventListeners } from "./events.js";
|
|
12
|
-
|
|
12
|
+
// What the worktree volume can do is probed at session_start (awaited there),
|
|
13
|
+
// once the session config has reloaded the worktree root.
|
|
13
14
|
import { prefetchHarnessModels, startHarnessAvailabilityProbe, } from "./harness-availability-launch.js";
|
|
14
15
|
/** The one reason the extension is unavailable when the session is not inside a git repository. */
|
|
15
16
|
const NOT_INSIDE_GIT_REPOSITORY = "pi-cowboy needs a git repository: this directory is not inside one, so pi-cowboy stays inactive";
|
|
@@ -55,8 +56,6 @@ export default function (pi) {
|
|
|
55
56
|
registerTools(pi);
|
|
56
57
|
registerCowboyCommand(pi);
|
|
57
58
|
setupEventListeners(pi);
|
|
58
|
-
// What the worktree volume can do decides which materializations stay on offer.
|
|
59
|
-
startCowSupportProbe(pi);
|
|
60
59
|
// Which harnesses are on PATH decides which stay on offer.
|
|
61
60
|
startHarnessAvailabilityProbe();
|
|
62
61
|
// Slow model lists start warming now, never awaited; every later listing
|
|
@@ -85,8 +85,9 @@ export async function showSpawnOptionsMenu(ctx) {
|
|
|
85
85
|
const trimmed = value.trim();
|
|
86
86
|
store.mutate.agent.setWorktreeRoot(trimmed || undefined);
|
|
87
87
|
// The new root may sit on another volume; the launch probe answered
|
|
88
|
-
// for the old one, and nothing else refreshes it.
|
|
89
|
-
|
|
88
|
+
// for the old one, and nothing else refreshes it. Not awaited: the
|
|
89
|
+
// interactive session outlives this ~100ms probe, so its cleanup runs.
|
|
90
|
+
void refreshCowSupportProbe(getPiInstance());
|
|
90
91
|
ctx.ui.notify(trimmed
|
|
91
92
|
? `Worktree root set to ${trimmed}`
|
|
92
93
|
: "Worktree root cleared (default)", "info");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-cowboy",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"packageManager": "pnpm@12.9.1",
|
|
6
6
|
"description": "Agent orchestrator for pi: can manage Codex, Claude Code, OpenCode, pi, pig and pi-bolt as subagents. Runs subagents in background Herdr panes, isolated in copy-on-write Git worktrees.",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"test:integration": "pnpm run build && vitest run --project integration-no-cow --project integration-cow",
|
|
57
57
|
"test:integration-no-cow": "pnpm run build && vitest run --project integration-no-cow",
|
|
58
58
|
"test:integration-cow": "pnpm run build && vitest run --project integration-cow",
|
|
59
|
-
"dev:install": "
|
|
59
|
+
"dev:install": "pi remove . 2>/dev/null; pi install ./dev",
|
|
60
60
|
"lint": "oxlint",
|
|
61
61
|
"lint:fix": "oxlint --fix",
|
|
62
62
|
"commitlint": "commitlint",
|