@llblab/pi-actors 0.55.0 → 0.56.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 +108 -20
- package/BACKLOG.md +198 -4
- package/CHANGELOG.md +17 -0
- package/README.md +31 -1
- package/dist/index.js +1 -1
- package/dist/lib/async-runs.d.ts +37 -0
- package/dist/lib/async-runs.js +131 -62
- package/dist/lib/automatic-review-runtime.d.ts +2 -0
- package/dist/lib/automatic-review-runtime.js +3 -2
- package/dist/lib/command-templates.d.ts +37 -0
- package/dist/lib/command-templates.js +263 -129
- package/dist/lib/execution-files.d.ts +32 -0
- package/dist/lib/execution-files.js +128 -0
- package/dist/lib/execution-output.js +5 -4
- package/dist/lib/execution-sessions.d.ts +19 -1
- package/dist/lib/execution-sessions.js +62 -26
- package/dist/lib/execution.d.ts +4 -1
- package/dist/lib/execution.js +6 -1
- package/dist/lib/extension-runtime.d.ts +9 -2
- package/dist/lib/extension-runtime.js +92 -14
- package/dist/lib/file-state.js +21 -2
- package/dist/lib/inspector-command.js +2 -2
- package/dist/lib/inspector-overlay.d.ts +25 -7
- package/dist/lib/inspector-overlay.js +562 -262
- package/dist/lib/inspector.d.ts +20 -10
- package/dist/lib/inspector.js +80 -91
- package/dist/lib/limits.d.ts +1 -0
- package/dist/lib/limits.js +1 -0
- package/dist/lib/observability.d.ts +15 -1
- package/dist/lib/observability.js +216 -99
- package/dist/lib/pi.d.ts +5 -4
- package/dist/lib/pi.js +64 -10
- package/dist/lib/recipe-projection.d.ts +18 -0
- package/dist/lib/recipe-projection.js +220 -0
- package/dist/lib/recipes-context.d.ts +2 -0
- package/dist/lib/recipes-context.js +30 -6
- package/dist/lib/registry.js +280 -36
- package/dist/lib/run-delivery.d.ts +213 -5
- package/dist/lib/run-delivery.js +1909 -40
- package/dist/lib/run-supervision.d.ts +107 -0
- package/dist/lib/run-supervision.js +412 -0
- package/dist/lib/run-ui-runtime.d.ts +9 -2
- package/dist/lib/run-ui-runtime.js +283 -60
- package/dist/lib/runs-artifacts.d.ts +26 -1
- package/dist/lib/runs-artifacts.js +68 -2
- package/dist/lib/runs-context-exports.d.ts +451 -0
- package/dist/lib/runs-context-exports.js +2315 -0
- package/dist/lib/runs-context-index.d.ts +97 -0
- package/dist/lib/runs-context-index.js +368 -0
- package/dist/lib/runs-control-delivery.js +46 -7
- package/dist/lib/runs-control.d.ts +78 -2
- package/dist/lib/runs-control.js +334 -2
- package/dist/lib/runs-controls.js +4 -1
- package/dist/lib/runs-descendant-launches.d.ts +80 -0
- package/dist/lib/runs-descendant-launches.js +287 -0
- package/dist/lib/runs-execution-evidence.d.ts +110 -0
- package/dist/lib/runs-execution-evidence.js +282 -0
- package/dist/lib/runs-index.d.ts +66 -1
- package/dist/lib/runs-index.js +349 -13
- package/dist/lib/runs-native-launches.d.ts +73 -0
- package/dist/lib/runs-native-launches.js +227 -0
- package/dist/lib/runs-outcomes.d.ts +141 -0
- package/dist/lib/runs-outcomes.js +292 -0
- package/dist/lib/runs-ownership.d.ts +10 -1
- package/dist/lib/runs-ownership.js +36 -4
- package/dist/lib/runs-process-windows-mi.d.ts +46 -0
- package/dist/lib/runs-process-windows-mi.js +114 -0
- package/dist/lib/runs-process.d.ts +34 -1
- package/dist/lib/runs-process.js +158 -26
- package/dist/lib/runs-results.d.ts +116 -0
- package/dist/lib/runs-results.js +518 -0
- package/dist/lib/runs-retention.d.ts +15 -2
- package/dist/lib/runs-retention.js +148 -9
- package/dist/lib/runs-session-exports.d.ts +95 -0
- package/dist/lib/runs-session-exports.js +470 -0
- package/dist/lib/runs-snapshot.d.ts +58 -0
- package/dist/lib/runs-snapshot.js +92 -0
- package/dist/lib/runs-start.d.ts +2 -0
- package/dist/lib/runs-start.js +44 -3
- package/dist/lib/runs-status.d.ts +15 -1
- package/dist/lib/runs-status.js +337 -13
- package/dist/lib/runs-supervision.d.ts +105 -0
- package/dist/lib/runs-supervision.js +501 -0
- package/dist/lib/runs-trace.d.ts +1 -0
- package/dist/lib/runs-trace.js +14 -3
- package/dist/lib/runtime.js +22 -3
- package/dist/lib/session-evidence.d.ts +37 -0
- package/dist/lib/session-evidence.js +59 -3
- package/dist/lib/state-readers.d.ts +4 -1
- package/dist/lib/state-readers.js +14 -8
- package/dist/lib/temp.d.ts +2 -4
- package/dist/lib/temp.js +4 -56
- package/dist/lib/tools-access.d.ts +3 -0
- package/dist/lib/tools-access.js +13 -0
- package/dist/lib/tools-inspect.d.ts +1 -0
- package/dist/lib/tools-inspect.js +110 -43
- package/dist/lib/tools-local.d.ts +3 -0
- package/dist/lib/tools-local.js +18 -6
- package/dist/lib/tools-message.d.ts +4 -1
- package/dist/lib/tools-message.js +126 -31
- package/dist/lib/tools-response.d.ts +31 -3
- package/dist/lib/tools-response.js +311 -47
- package/dist/lib/tools-spawn.d.ts +3 -0
- package/dist/lib/tools-spawn.js +29 -7
- package/dist/lib/trace-projection.d.ts +20 -0
- package/dist/lib/trace-projection.js +192 -43
- package/dist/scripts/async-runner.mjs +272 -194
- package/dist/scripts/conformance.mjs +14 -2
- package/dist/skills/actors/SKILL.md +46 -2
- package/dist/skills/actors/references/diagnostics.md +40 -0
- package/dist/skills/actors/references/runs.md +55 -1
- package/docs/README.md +9 -1
- package/docs/actor-inspector.md +84 -15
- package/docs/agent-experience.md +216 -0
- package/docs/async-runs.md +18 -2
- package/docs/composition-transport.md +103 -0
- package/docs/coordinator-delivery.md +204 -4
- package/docs/inspection.md +38 -2
- package/docs/output-projection-map.md +130 -0
- package/docs/releasing.md +19 -2
- package/docs/run-supervision.md +1622 -0
- package/docs/template-recipes.md +4 -0
- package/docs/windows-process-observation.md +248 -0
- package/index.ts +1 -1
- package/lib/async-runs.ts +164 -73
- package/lib/automatic-review-runtime.ts +4 -2
- package/lib/command-templates.ts +287 -138
- package/lib/execution-files.ts +118 -0
- package/lib/execution-output.ts +4 -4
- package/lib/execution-sessions.ts +57 -27
- package/lib/execution.ts +8 -0
- package/lib/extension-runtime.ts +102 -12
- package/lib/file-state.ts +16 -2
- package/lib/inspector-command.ts +2 -2
- package/lib/inspector-overlay.ts +524 -261
- package/lib/inspector.ts +101 -130
- package/lib/limits.ts +1 -0
- package/lib/observability.ts +235 -116
- package/lib/pi.ts +59 -11
- package/lib/recipe-projection.ts +232 -0
- package/lib/recipes-context.ts +27 -6
- package/lib/registry.ts +275 -36
- package/lib/run-delivery.ts +1737 -49
- package/lib/run-supervision.ts +411 -0
- package/lib/run-ui-runtime.ts +237 -73
- package/lib/runs-artifacts.ts +73 -1
- package/lib/runs-context-exports.ts +1871 -0
- package/lib/runs-context-index.ts +372 -0
- package/lib/runs-control-delivery.ts +36 -18
- package/lib/runs-control.ts +297 -1
- package/lib/runs-controls.ts +3 -1
- package/lib/runs-descendant-launches.ts +338 -0
- package/lib/runs-execution-evidence.ts +302 -0
- package/lib/runs-index.ts +345 -17
- package/lib/runs-native-launches.ts +270 -0
- package/lib/runs-outcomes.ts +377 -0
- package/lib/runs-ownership.ts +37 -4
- package/lib/runs-process-windows-mi.ts +113 -0
- package/lib/runs-process.ts +210 -34
- package/lib/runs-results.ts +601 -0
- package/lib/runs-retention.ts +134 -10
- package/lib/runs-session-exports.ts +406 -0
- package/lib/runs-snapshot.ts +143 -0
- package/lib/runs-start.ts +44 -2
- package/lib/runs-status.ts +252 -10
- package/lib/runs-supervision.ts +394 -0
- package/lib/runs-trace.ts +14 -3
- package/lib/runtime.ts +22 -3
- package/lib/session-evidence.ts +76 -4
- package/lib/state-readers.ts +16 -7
- package/lib/temp.ts +3 -56
- package/lib/tools-access.ts +13 -0
- package/lib/tools-inspect.ts +110 -51
- package/lib/tools-local.ts +37 -24
- package/lib/tools-message.ts +120 -37
- package/lib/tools-response.ts +273 -50
- package/lib/tools-spawn.ts +31 -10
- package/lib/trace-projection.ts +165 -42
- package/package.json +10 -6
- package/scripts/async-runner.mjs +272 -194
- package/scripts/conformance.mjs +14 -2
- package/skills/actors/SKILL.md +46 -2
- package/skills/actors/references/diagnostics.md +40 -0
- package/skills/actors/references/runs.md +55 -1
- package/banner.jpg +0 -0
- package/dist/lib/inspector-actions.d.ts +0 -16
- package/dist/lib/inspector-actions.js +0 -57
- package/lib/inspector-actions.ts +0 -79
package/lib/inspector.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Actor Inspector evidence
|
|
3
|
-
* Zones: owned
|
|
4
|
-
* Owns
|
|
2
|
+
* Actor Inspector owned-Run evidence and actions.
|
|
3
|
+
* Zones: owned inventory, captured Recipe reads, exact-session/generation action fencing
|
|
4
|
+
* Owns Inspector domain operations; command/overlay wiring and lifecycle actuation stay in adapters.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as fs from "node:fs";
|
|
8
8
|
import * as path from "node:path";
|
|
9
|
+
import { join } from "node:path";
|
|
9
10
|
|
|
10
|
-
import
|
|
11
|
+
import { projectRunRecipe, type RunRecipeView } from "./recipe-projection.ts";
|
|
12
|
+
import { safeRunId } from "./runs-identity.ts";
|
|
11
13
|
import { readJsonFileResilient } from "./state-readers.ts";
|
|
14
|
+
import { formatMarkdownField } from "./tools-response.ts";
|
|
12
15
|
|
|
13
16
|
export interface ActorInspectorRunItem {
|
|
14
17
|
run: string;
|
|
@@ -73,132 +76,100 @@ export function readActorInspectorRuns(
|
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
78
|
|
|
76
|
-
export
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
diagnostics: string[];
|
|
80
|
-
identity: Record<string, unknown>;
|
|
81
|
-
launch: Record<string, unknown>;
|
|
79
|
+
export function readActorInspectorRecipe(stateDir: string): RunRecipeView {
|
|
80
|
+
const result = readJsonFileResilient<Record<string, unknown>>(path.join(stateDir, "run.json"), {});
|
|
81
|
+
return projectRunRecipe(result.value, result.diagnostics.map(diagnostic => diagnostic.message));
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}),
|
|
176
|
-
),
|
|
177
|
-
...(definition ? { definition: redactedRecord(definition) } : {}),
|
|
178
|
-
diagnostics: result.diagnostics.map((diagnostic) => diagnostic.message),
|
|
179
|
-
identity: redactedRecord({
|
|
180
|
-
run: meta.run,
|
|
181
|
-
recipe: meta.recipe,
|
|
182
|
-
recipe_stem: primary?.name ?? meta.recipe,
|
|
183
|
-
logical_reference: primaryLogicalReference,
|
|
184
|
-
...(typeof primary?.skill === "string" ? { skill: primary.skill } : {}),
|
|
185
|
-
source_kind: primarySourceKind,
|
|
186
|
-
launch_kind: meta.launch_kind ?? meta.launch_source,
|
|
187
|
-
launch_source: meta.launch_source,
|
|
188
|
-
...(meta.singleton === true
|
|
189
|
-
? { singleton: true, singleton_recipe_id: meta.singleton_recipe_id }
|
|
190
|
-
: {}),
|
|
191
|
-
}),
|
|
192
|
-
launch: redactedRecord({
|
|
193
|
-
cwd: meta.cwd,
|
|
194
|
-
template: meta.template,
|
|
195
|
-
values: launchValues,
|
|
196
|
-
model_policy: meta.model_policy,
|
|
197
|
-
control: meta.control,
|
|
198
|
-
artifacts: meta.artifacts,
|
|
199
|
-
notification_policy: meta.notification_policy,
|
|
200
|
-
retire_when: meta.retire_when,
|
|
201
|
-
singleton_values: meta.singleton_values,
|
|
202
|
-
}),
|
|
203
|
-
};
|
|
84
|
+
const FEEDBACK_LIMIT = 180;
|
|
85
|
+
|
|
86
|
+
export interface ActorInspectorKillResult {
|
|
87
|
+
ok: boolean;
|
|
88
|
+
message: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface ActorInspectorKillDeps {
|
|
92
|
+
getRunStatus: (runOrDir: string) => Record<string, unknown>;
|
|
93
|
+
killRun: (
|
|
94
|
+
runOrDir: string,
|
|
95
|
+
expected: { ownerId: string; runInstanceId: string },
|
|
96
|
+
) => Record<string, unknown>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Pure presentation of an already selected value; legacy metadata grants no source/privacy authority. */
|
|
100
|
+
export function formatActorInspectorKillFeedback(
|
|
101
|
+
result: "rejected" | "unavailable" | "failed",
|
|
102
|
+
selected: string,
|
|
103
|
+
legacy?: { readonly clipped: boolean },
|
|
104
|
+
): string {
|
|
105
|
+
const key = result === "unavailable" ? "state" : "diagnostic";
|
|
106
|
+
const fields = [formatMarkdownField("action", "kill"), formatMarkdownField("result", result)];
|
|
107
|
+
if (Buffer.from(selected).toString("utf8") !== selected) {
|
|
108
|
+
fields.push(formatMarkdownField(key, "unavailable"), formatMarkdownField(`${key}_reason`, "malformed_legacy_preview"),
|
|
109
|
+
formatMarkdownField(`${key}_omission`, "[omitted: unknown]"));
|
|
110
|
+
} else {
|
|
111
|
+
fields.push(formatMarkdownField(key, selected + (legacy?.clipped ? "…" : "")));
|
|
112
|
+
if (legacy?.clipped) fields.push(formatMarkdownField(`${key}_omission`, "[omitted: unknown]"));
|
|
113
|
+
}
|
|
114
|
+
if (legacy) fields.push(formatMarkdownField("preview_basis", "selected legacy preview; upstream completeness/privacy unproven"));
|
|
115
|
+
fields.push(formatMarkdownField("closure", "unconfirmed"));
|
|
116
|
+
if (result === "failed") fields.push(formatMarkdownField("safety", "Do not repeat automatically."));
|
|
117
|
+
return fields.join("\n");
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function bounded(result: "rejected" | "unavailable" | "failed", value: unknown): string {
|
|
121
|
+
const text = String(value ?? "").replaceAll(/\s+/g, " ").trim();
|
|
122
|
+
const clipped = text.length > FEEDBACK_LIMIT;
|
|
123
|
+
let end = clipped ? FEEDBACK_LIMIT - 1 : text.length;
|
|
124
|
+
if (clipped && end > 0 && /[\uD800-\uDBFF]/u.test(text[end - 1]!) && /[\uDC00-\uDFFF]/u.test(text[end]!)) end -= 1;
|
|
125
|
+
return formatActorInspectorKillFeedback(result, clipped ? text.slice(0, end) : text, { clipped });
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function killOwnedRunFromInspector(
|
|
129
|
+
ownerId: string,
|
|
130
|
+
run: string,
|
|
131
|
+
stateRoot: string,
|
|
132
|
+
expectedRunInstanceId: string,
|
|
133
|
+
deps: ActorInspectorKillDeps,
|
|
134
|
+
): ActorInspectorKillResult {
|
|
135
|
+
let stateDir: string;
|
|
136
|
+
try {
|
|
137
|
+
stateDir = join(stateRoot, safeRunId(run));
|
|
138
|
+
} catch (error) {
|
|
139
|
+
return {
|
|
140
|
+
ok: false,
|
|
141
|
+
message: bounded("rejected", error instanceof Error ? error.message : error),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
const status = deps.getRunStatus(stateDir);
|
|
146
|
+
if (status.ownerId !== ownerId) {
|
|
147
|
+
return { ok: false, message: formatActorInspectorKillFeedback("rejected", "run ownership changed.") };
|
|
148
|
+
}
|
|
149
|
+
if (status.status !== "running") {
|
|
150
|
+
return {
|
|
151
|
+
ok: false,
|
|
152
|
+
message: bounded("unavailable", status.status || "terminal"),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
if (status.run_instance_id !== expectedRunInstanceId) {
|
|
156
|
+
return { ok: false, message: formatActorInspectorKillFeedback("rejected", "run generation changed.") };
|
|
157
|
+
}
|
|
158
|
+
const result = deps.killRun(stateDir, {
|
|
159
|
+
ownerId,
|
|
160
|
+
runInstanceId: expectedRunInstanceId,
|
|
161
|
+
});
|
|
162
|
+
if (result.killed === true) {
|
|
163
|
+
return { ok: true, message: `Killed run:${run}.` };
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
ok: false,
|
|
167
|
+
message: bounded("failed", result.reason || "control rejected"),
|
|
168
|
+
};
|
|
169
|
+
} catch (error) {
|
|
170
|
+
return {
|
|
171
|
+
ok: false,
|
|
172
|
+
message: bounded("failed", error instanceof Error ? error.message : error),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
204
175
|
}
|
package/lib/limits.ts
CHANGED
|
@@ -31,6 +31,7 @@ export const RUN_RETENTION_MAX_BYTES = 1024 * 1024;
|
|
|
31
31
|
export const RUN_DELIVERY_BATCH_MAX_MEMBERS = 256;
|
|
32
32
|
export const RUN_DELIVERY_MODEL_MAX_MEMBERS = 64;
|
|
33
33
|
export const RUN_DELIVERY_MODEL_MAX_BYTES = 16 * 1024;
|
|
34
|
+
export const RUN_COMPLETION_MODEL_MAX_BYTES = 48 * 1024;
|
|
34
35
|
export const RUN_DELIVERY_RECEIPT_LIMIT = 128;
|
|
35
36
|
export const RUN_DELIVERY_SESSION_MAX_ENTRIES = 256;
|
|
36
37
|
export const RUN_DELIVERY_SESSION_MAX_BYTES = 1024 * 1024;
|