@llblab/pi-actors 0.41.1 → 0.42.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/AGENTS.md +11 -6
- package/BACKLOG.md +1 -65
- package/CHANGELOG.md +25 -0
- package/README.md +24 -4
- package/dist/index.js +25 -121
- package/dist/lib/async-runs.d.ts +37 -5
- package/dist/lib/async-runs.js +181 -51
- package/dist/lib/automatic-review-runtime.d.ts +18 -0
- package/dist/lib/automatic-review-runtime.js +96 -0
- package/dist/lib/command-templates.js +1 -1
- package/dist/lib/draft-consolidation-transaction.d.ts +65 -0
- package/dist/lib/draft-consolidation-transaction.js +610 -0
- package/dist/lib/draft-consolidation.d.ts +35 -0
- package/dist/lib/draft-consolidation.js +126 -0
- package/dist/lib/draft-review.d.ts +56 -0
- package/dist/lib/draft-review.js +254 -0
- package/dist/lib/draft-sleep.d.ts +65 -0
- package/dist/lib/draft-sleep.js +468 -0
- package/dist/lib/file-state.d.ts +8 -1
- package/dist/lib/file-state.js +115 -18
- package/dist/lib/inspector-actions.d.ts +16 -0
- package/dist/lib/inspector-actions.js +57 -0
- package/dist/lib/inspector-command.d.ts +7 -0
- package/dist/lib/inspector-command.js +37 -0
- package/dist/lib/inspector-overlay.d.ts +23 -3
- package/dist/lib/inspector-overlay.js +327 -70
- package/dist/lib/inspector.d.ts +9 -0
- package/dist/lib/inspector.js +49 -1
- package/dist/lib/observability.d.ts +13 -0
- package/dist/lib/observability.js +160 -6
- package/dist/lib/paths.d.ts +7 -0
- package/dist/lib/paths.js +28 -0
- package/dist/lib/recipes-discovery.js +32 -24
- package/dist/lib/recipes-usage.d.ts +18 -6
- package/dist/lib/recipes-usage.js +445 -34
- package/dist/lib/review-control.d.ts +14 -0
- package/dist/lib/review-control.js +111 -0
- package/dist/lib/review-diagnostics.d.ts +11 -0
- package/dist/lib/review-diagnostics.js +148 -0
- package/dist/lib/review-projection.d.ts +14 -0
- package/dist/lib/review-projection.js +170 -0
- package/dist/lib/run-ui-runtime.d.ts +18 -0
- package/dist/lib/run-ui-runtime.js +123 -0
- package/dist/lib/runs-artifacts.d.ts +1 -1
- package/dist/lib/runs-artifacts.js +1 -1
- package/dist/lib/runs-control.d.ts +10 -2
- package/dist/lib/runs-control.js +37 -7
- package/dist/lib/runs-identity.d.ts +1 -1
- package/dist/lib/runs-identity.js +1 -1
- package/dist/lib/runs-index.d.ts +11 -2
- package/dist/lib/runs-index.js +46 -23
- package/dist/lib/runs-mailbox.d.ts +1 -1
- package/dist/lib/runs-mailbox.js +1 -1
- package/dist/lib/runs-messages.d.ts +1 -1
- package/dist/lib/runs-messages.js +1 -1
- package/dist/lib/runs-outbox.d.ts +1 -1
- package/dist/lib/runs-outbox.js +1 -1
- package/dist/lib/runs-ownership.d.ts +1 -1
- package/dist/lib/runs-ownership.js +18 -4
- package/dist/lib/runs-parent-teardown.d.ts +51 -0
- package/dist/lib/runs-parent-teardown.js +172 -0
- package/dist/lib/runs-process.d.ts +1 -1
- package/dist/lib/runs-process.js +5 -4
- package/dist/lib/runs-retention.d.ts +1 -1
- package/dist/lib/runs-retention.js +1 -1
- package/dist/lib/runs-start.d.ts +5 -3
- package/dist/lib/runs-start.js +7 -48
- package/dist/lib/runs-status.d.ts +5 -3
- package/dist/lib/runs-status.js +7 -6
- package/dist/lib/runtime.d.ts +7 -1
- package/dist/lib/runtime.js +32 -18
- package/dist/lib/tool-review-lineage-transaction.d.ts +27 -0
- package/dist/lib/tool-review-lineage-transaction.js +597 -0
- package/dist/lib/tool-review-lineage.d.ts +24 -0
- package/dist/lib/tool-review-lineage.js +98 -0
- package/dist/lib/tool-review-scheduler.d.ts +80 -0
- package/dist/lib/tool-review-scheduler.js +494 -0
- package/dist/lib/tool-review-transaction.d.ts +50 -0
- package/dist/lib/tool-review-transaction.js +362 -0
- package/dist/lib/tool-review.d.ts +56 -0
- package/dist/lib/tool-review.js +197 -0
- package/dist/lib/tools-inspect.js +28 -4
- package/dist/lib/tools-local.js +21 -4
- package/dist/lib/tools-message.d.ts +1 -0
- package/dist/lib/tools-message.js +29 -17
- package/dist/lib/tools-spawn.js +14 -2
- package/dist/lib/tools.d.ts +1 -0
- package/dist/lib/tools.js +1 -0
- package/dist/recipes/draft-review.json +24 -0
- package/dist/recipes/tool-review.json +24 -0
- package/dist/scripts/async-runner.mjs +9 -9
- package/dist/scripts/build-dist.mjs +6 -1
- package/dist/scripts/conformance.mjs +6 -1
- package/dist/scripts/recipe-utils.mjs +3 -3
- package/dist/scripts/release-gates.mjs +165 -0
- package/dist/skills/actors/SKILL.md +9 -8
- package/dist/skills/swarm/SKILL.md +1 -1
- package/docs/actor-inspector.md +20 -11
- package/docs/async-runs.md +16 -2
- package/docs/recipe-library.md +7 -3
- package/docs/template-recipes.md +4 -11
- package/docs/tool-registry.md +13 -4
- package/index.ts +27 -142
- package/lib/async-runs.ts +283 -67
- package/lib/automatic-review-runtime.ts +135 -0
- package/lib/command-templates.ts +1 -1
- package/lib/draft-consolidation-transaction.ts +821 -0
- package/lib/draft-consolidation.ts +181 -0
- package/lib/draft-review.ts +325 -0
- package/lib/draft-sleep.ts +576 -0
- package/lib/file-state.ts +143 -19
- package/lib/inspector-actions.ts +79 -0
- package/lib/inspector-command.ts +54 -0
- package/lib/inspector-overlay.ts +377 -91
- package/lib/inspector.ts +73 -1
- package/lib/observability.ts +194 -5
- package/lib/paths.ts +43 -0
- package/lib/recipes-discovery.ts +34 -26
- package/lib/recipes-usage.ts +569 -40
- package/lib/review-control.ts +137 -0
- package/lib/review-diagnostics.ts +164 -0
- package/lib/review-projection.ts +200 -0
- package/lib/run-ui-runtime.ts +153 -0
- package/lib/runs-artifacts.ts +1 -1
- package/lib/runs-control.ts +69 -6
- package/lib/runs-identity.ts +1 -1
- package/lib/runs-index.ts +57 -21
- package/lib/runs-mailbox.ts +1 -1
- package/lib/runs-messages.ts +1 -1
- package/lib/runs-outbox.ts +1 -1
- package/lib/runs-ownership.ts +23 -4
- package/lib/runs-parent-teardown.ts +257 -0
- package/lib/runs-process.ts +5 -4
- package/lib/runs-retention.ts +1 -1
- package/lib/runs-start.ts +13 -68
- package/lib/runs-status.ts +17 -8
- package/lib/runtime.ts +34 -17
- package/lib/tool-review-lineage-transaction.ts +881 -0
- package/lib/tool-review-lineage.ts +145 -0
- package/lib/tool-review-scheduler.ts +635 -0
- package/lib/tool-review-transaction.ts +563 -0
- package/lib/tool-review.ts +270 -0
- package/lib/tools-inspect.ts +35 -4
- package/lib/tools-local.ts +29 -4
- package/lib/tools-message.ts +45 -30
- package/lib/tools-spawn.ts +22 -2
- package/lib/tools.ts +5 -0
- package/package.json +5 -3
- package/recipes/draft-review.json +24 -0
- package/recipes/tool-review.json +24 -0
- package/scripts/async-runner.mjs +9 -9
- package/scripts/build-dist.mjs +6 -1
- package/scripts/conformance.mjs +6 -1
- package/scripts/recipe-utils.mjs +3 -3
- package/scripts/release-gates.mjs +165 -0
- package/skills/actors/SKILL.md +9 -8
- package/skills/swarm/SKILL.md +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Actor Inspector run actions.
|
|
3
|
+
* Owns: exact-session run-action authorization, canonical kill routing, and bounded operator feedback.
|
|
4
|
+
*/
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { safeRunId } from "./runs-identity.js";
|
|
7
|
+
const FEEDBACK_LIMIT = 180;
|
|
8
|
+
function bounded(value) {
|
|
9
|
+
const text = String(value ?? "").replaceAll(/\s+/g, " ").trim();
|
|
10
|
+
return text.length <= FEEDBACK_LIMIT
|
|
11
|
+
? text
|
|
12
|
+
: `${text.slice(0, FEEDBACK_LIMIT - 1)}…`;
|
|
13
|
+
}
|
|
14
|
+
export function killOwnedInspectorRun(ownerId, run, stateRoot, expectedRunInstanceId, deps) {
|
|
15
|
+
let stateDir;
|
|
16
|
+
try {
|
|
17
|
+
stateDir = join(stateRoot, safeRunId(run));
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return {
|
|
21
|
+
ok: false,
|
|
22
|
+
message: `Kill rejected: ${bounded(error instanceof Error ? error.message : error)}`,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const status = deps.getRunStatus(stateDir);
|
|
27
|
+
if (status.ownerId !== ownerId) {
|
|
28
|
+
return { ok: false, message: "Kill rejected: run ownership changed." };
|
|
29
|
+
}
|
|
30
|
+
if (status.status !== "running") {
|
|
31
|
+
return {
|
|
32
|
+
ok: false,
|
|
33
|
+
message: `Kill unavailable: run is ${bounded(status.status || "terminal")}.`,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (status.run_instance_id !== expectedRunInstanceId) {
|
|
37
|
+
return { ok: false, message: "Kill rejected: run generation changed." };
|
|
38
|
+
}
|
|
39
|
+
const result = deps.killRun(stateDir, {
|
|
40
|
+
ownerId,
|
|
41
|
+
runInstanceId: expectedRunInstanceId,
|
|
42
|
+
});
|
|
43
|
+
if (result.killed === true) {
|
|
44
|
+
return { ok: true, message: `Killed run:${run}.` };
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
ok: false,
|
|
48
|
+
message: `Kill failed: ${bounded(result.reason || "control rejected")}.`,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return {
|
|
53
|
+
ok: false,
|
|
54
|
+
message: `Kill failed: ${bounded(error instanceof Error ? error.message : error)}.`,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Actor Inspector command adapter.
|
|
3
|
+
* Zones: Pi command registration, overlay construction, owned-run control ports
|
|
4
|
+
* Owns host-facing Inspector launch wiring without owning Inspector state or actions.
|
|
5
|
+
*/
|
|
6
|
+
import type * as Pi from "./pi.ts";
|
|
7
|
+
export declare function registerActorInspectorCommand(pi: Pi.ExtensionAPI, getRunOwnerId: (ctx: Pi.ExtensionContext) => string): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Actor Inspector command adapter.
|
|
3
|
+
* Zones: Pi command registration, overlay construction, owned-run control ports
|
|
4
|
+
* Owns host-facing Inspector launch wiring without owning Inspector state or actions.
|
|
5
|
+
*/
|
|
6
|
+
import * as AsyncRuns from "./async-runs.js";
|
|
7
|
+
import * as InspectorActions from "./inspector-actions.js";
|
|
8
|
+
import * as InspectorOverlay from "./inspector-overlay.js";
|
|
9
|
+
import * as Paths from "./paths.js";
|
|
10
|
+
export function registerActorInspectorCommand(pi, getRunOwnerId) {
|
|
11
|
+
pi.registerCommand("actors-inspector", {
|
|
12
|
+
description: "Open the keyboard-driven actor inspector overlay",
|
|
13
|
+
handler: async (_args, ctx) => {
|
|
14
|
+
ctx.ui.setWidget("zz-pi-actors-comms", undefined);
|
|
15
|
+
await ctx.ui.custom((tui, theme, _keybindings, done) => new InspectorOverlay.ActorInspectorOverlay({
|
|
16
|
+
done,
|
|
17
|
+
killRun: (run, runInstanceId) => InspectorActions.killOwnedInspectorRun(getRunOwnerId(ctx), run, Paths.EXTENSION_RUNTIME_PATHS.runStateRoot, runInstanceId, {
|
|
18
|
+
getRunStatus: AsyncRuns.getRunStatus,
|
|
19
|
+
killRun: AsyncRuns.killRun,
|
|
20
|
+
}),
|
|
21
|
+
ownerId: getRunOwnerId(ctx),
|
|
22
|
+
stateRoot: Paths.EXTENSION_RUNTIME_PATHS.runStateRoot,
|
|
23
|
+
theme,
|
|
24
|
+
tui,
|
|
25
|
+
}), {
|
|
26
|
+
overlay: true,
|
|
27
|
+
overlayOptions: {
|
|
28
|
+
anchor: "center",
|
|
29
|
+
width: "94%",
|
|
30
|
+
minWidth: 72,
|
|
31
|
+
maxHeight: "94%",
|
|
32
|
+
margin: 1,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
@@ -5,17 +5,26 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
7
7
|
import { type TUI } from "@earendil-works/pi-tui";
|
|
8
|
-
|
|
8
|
+
import * as Inspector from "./inspector.ts";
|
|
9
|
+
export type ActorInspectorOverlayTab = "recipe" | "communications" | "turns";
|
|
10
|
+
export interface ActorInspectorOverlayActionResult {
|
|
11
|
+
ok: boolean;
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
9
14
|
export interface ActorInspectorOverlayOptions {
|
|
10
15
|
done: () => void;
|
|
16
|
+
killRun?: (run: string, runInstanceId: string) => ActorInspectorOverlayActionResult;
|
|
11
17
|
ownerId: string;
|
|
18
|
+
readTurns?: (stateDir: string) => Inspector.ActorInspectorTurnItem[];
|
|
12
19
|
stateRoot: string;
|
|
13
20
|
theme: Theme;
|
|
14
21
|
tui: TUI;
|
|
15
22
|
}
|
|
16
23
|
export declare class ActorInspectorOverlay {
|
|
17
24
|
private readonly done;
|
|
25
|
+
private readonly killRun?;
|
|
18
26
|
private readonly ownerId;
|
|
27
|
+
private readonly readTurns;
|
|
19
28
|
private readonly stateRoot;
|
|
20
29
|
private readonly theme;
|
|
21
30
|
private readonly tui;
|
|
@@ -29,16 +38,20 @@ export declare class ActorInspectorOverlay {
|
|
|
29
38
|
private detailOpen;
|
|
30
39
|
private detailScroll;
|
|
31
40
|
private detailTurn?;
|
|
32
|
-
private
|
|
41
|
+
private feedback?;
|
|
42
|
+
private killConfirmation?;
|
|
43
|
+
private killDialogChoice;
|
|
33
44
|
private readonly readKeys;
|
|
34
45
|
private focus;
|
|
35
46
|
private filterControlIndex;
|
|
36
47
|
private menuLevel;
|
|
37
48
|
private selectorIndex;
|
|
49
|
+
private recipeScroll;
|
|
38
50
|
private rowIndex;
|
|
39
51
|
private selectedRun?;
|
|
40
52
|
private subagentIndex;
|
|
41
53
|
private tab;
|
|
54
|
+
private turnCache?;
|
|
42
55
|
constructor(options: ActorInspectorOverlayOptions);
|
|
43
56
|
handleInput(data: string): void;
|
|
44
57
|
render(width: number): string[];
|
|
@@ -49,6 +62,10 @@ export declare class ActorInspectorOverlay {
|
|
|
49
62
|
private contentViewportRows;
|
|
50
63
|
private selectRun;
|
|
51
64
|
private cycleRun;
|
|
65
|
+
private requestKill;
|
|
66
|
+
private cancelKill;
|
|
67
|
+
private confirmKill;
|
|
68
|
+
private renderKillDialog;
|
|
52
69
|
private listItemCount;
|
|
53
70
|
private selectorAnchor;
|
|
54
71
|
private renderKeyHints;
|
|
@@ -57,17 +74,19 @@ export declare class ActorInspectorOverlay {
|
|
|
57
74
|
private renderTabs;
|
|
58
75
|
private renderRunSelector;
|
|
59
76
|
private renderTimeline;
|
|
77
|
+
private renderRecipe;
|
|
60
78
|
private communicationPreviews;
|
|
61
79
|
private communicationActorLabel;
|
|
62
80
|
private communicationFromOptions;
|
|
63
81
|
private communicationRows;
|
|
64
82
|
private renderDetail;
|
|
65
83
|
private wrapDetailLines;
|
|
84
|
+
private wrapPreferred;
|
|
66
85
|
private detailSection;
|
|
67
86
|
private readableValueLines;
|
|
68
87
|
private turnEvidenceLines;
|
|
69
88
|
private readablePromptText;
|
|
70
|
-
private
|
|
89
|
+
private allTurnItems;
|
|
71
90
|
private turnItems;
|
|
72
91
|
private turnRows;
|
|
73
92
|
private subagents;
|
|
@@ -91,5 +110,6 @@ export declare class ActorInspectorOverlay {
|
|
|
91
110
|
private row;
|
|
92
111
|
private takeVisiblePrefix;
|
|
93
112
|
private dropVisiblePrefix;
|
|
113
|
+
private center;
|
|
94
114
|
private fit;
|
|
95
115
|
}
|