@llblab/pi-actors 0.53.1 → 0.53.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.
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +4 -0
- package/dist/lib/inspector-overlay.js +2 -1
- package/dist/lib/trace-projection.d.ts +2 -0
- package/dist/lib/trace-projection.js +11 -7
- package/docs/actor-inspector.md +1 -1
- package/lib/inspector-overlay.ts +2 -1
- package/lib/trace-projection.ts +13 -6
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -86,7 +86,7 @@ Canonical event:
|
|
|
86
86
|
{"id":"…","ts":"…","kind":"…","summary":"…","data":{},"level":"info","attention":"notify"}
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
Trace is a bounded retained suffix, not an audit archive. Every first-party writer must call `appendRunTraceEvent`; under the canonical token-owned lock it appends within both fixed bounds or atomically retains the newest suffix plus one cumulative warning-only `runtime.trace_compacted` marker. The marker means older history was discarded; terminal/result/execution/artifact files remain authoritative independently. Reads are newline-safe and order equal timestamps by same-source ordinal, fixed source rank, then stable id without exposing ordering metadata. Never write `trace.jsonl` directly. Generic command lifecycle is Trace-only: `command.done` preserves complete bounded execution evidence but never requests or projects any attention value, and Recipe grammar has no command-completion delivery switch. Semantic attention is explicit: `notify` is visible status, `followup` is an ordinary checkpoint hint, and actor-authored `steer` is durable urgent delivery at Pi's next safe boundary. Never infer attention from status or exit code. Admit steer by exact event and Run generation before `deliverAs: "steer"`; acknowledge only its exact model-bound context envelope, and preserve the later root-terminal completion batch. Sequence, parallel, repeat, and import branches remain internal, while each separately launched Run owns a separate generation.
|
|
89
|
+
Trace is a bounded retained suffix, not an audit archive. Every first-party writer must call `appendRunTraceEvent`; under the canonical token-owned lock it appends within both fixed bounds or atomically retains the newest suffix plus one cumulative warning-only `runtime.trace_compacted` marker. The marker means older history was discarded; terminal/result/execution/artifact files remain authoritative independently. Reads are newline-safe and order equal timestamps by same-source ordinal, fixed source rank, then stable id without exposing ordering metadata. Actor Inspector derives stable source-local row sequences before applying its visible-tail bound, including cumulative compaction offsets for canonical Trace, so appends never renumber retained rows. Never write `trace.jsonl` directly. Generic command lifecycle is Trace-only: `command.done` preserves complete bounded execution evidence but never requests or projects any attention value, and Recipe grammar has no command-completion delivery switch. Semantic attention is explicit: `notify` is visible status, `followup` is an ordinary checkpoint hint, and actor-authored `steer` is durable urgent delivery at Pi's next safe boundary. Never infer attention from status or exit code. Admit steer by exact event and Run generation before `deliverAs: "steer"`; acknowledge only its exact model-bound context envelope, and preserve the later root-terminal completion batch. Sequence, parallel, repeat, and import branches remain internal, while each separately launched Run owns a separate generation.
|
|
90
90
|
|
|
91
91
|
### Control
|
|
92
92
|
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## 0.53.2: Stable Inspector Trace Sequences
|
|
8
|
+
|
|
9
|
+
- `Stable Inspector Trace Sequences`: Actor Inspector now numbers Trace rows from stable source-local chronology before applying the 100-row projection bound. Canonical Trace rows include cumulative compaction offsets and owned Pi turns retain their native sequence, so adding `#100` no longer renumbers the previous `#99`; newest-first ordering, source filters, public Trace JSON, and focus-by-id remain unchanged.
|
|
10
|
+
|
|
7
11
|
## 0.53.1: Filterable Skills and drift-safe Git installs
|
|
8
12
|
|
|
9
13
|
- `Filterable Packaged Skills`: Manifest-loaded runtime leaves all six bundled Skills to `pi.skills`, preserving filters and provenance. Auto-discovered checkouts contribute source Skills even when Pi selects compiled code; resolver regressions cover both modes. Unsupported source manifest aliases are removed, and the committed distributive supports git installs with drift-checking atomic builds.
|
|
@@ -583,7 +583,8 @@ export class ActorInspectorOverlay {
|
|
|
583
583
|
const prefix = this.focus === "list" && index === this.rowIndex
|
|
584
584
|
? this.theme.fg("accent", " ▶ ")
|
|
585
585
|
: " ";
|
|
586
|
-
const
|
|
586
|
+
const sequence = item[TraceProjection.TRACE_ITEM_SEQUENCE] ?? items.length - index - 1;
|
|
587
|
+
const row = `${prefix}${this.theme.fg("text", `#${sequence}`)} ${marker} ${this.theme.fg("muted", item.source)}/${this.theme.fg(item.level === "error" ? "error" : "accent", item.kind)} ${this.theme.fg("text", item.summary)}`;
|
|
587
588
|
return this.focus === "list" && index === this.rowIndex
|
|
588
589
|
? this.theme.fg("accent", row)
|
|
589
590
|
: row;
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
import { type RunArtifactDeclaration } from "./runs-artifacts.ts";
|
|
7
7
|
export type TraceSource = "lifecycle" | "control" | "process" | "agent" | "artifact" | "runtime";
|
|
8
8
|
export type TraceSourceFilter = TraceSource | "all";
|
|
9
|
+
export declare const TRACE_ITEM_SEQUENCE: unique symbol;
|
|
9
10
|
export interface TraceItem {
|
|
10
11
|
id: string;
|
|
11
12
|
ts: string;
|
|
13
|
+
[TRACE_ITEM_SEQUENCE]?: number;
|
|
12
14
|
source: TraceSource;
|
|
13
15
|
kind: string;
|
|
14
16
|
summary: string;
|
|
@@ -14,6 +14,7 @@ import { tailFile } from "./runs-status.js";
|
|
|
14
14
|
import * as RunsTrace from "./runs-trace.js";
|
|
15
15
|
import * as SessionEvidence from "./session-evidence.js";
|
|
16
16
|
import { readJsonFileResilient, } from "./state-readers.js";
|
|
17
|
+
export const TRACE_ITEM_SEQUENCE = Symbol("trace-item-sequence");
|
|
17
18
|
const LIFECYCLE_PREFIXES = ["run.", "command."];
|
|
18
19
|
const SOURCE_LIMIT = 100;
|
|
19
20
|
const SOURCE_RANK = {
|
|
@@ -32,7 +33,8 @@ function sourceForEvent(event) {
|
|
|
32
33
|
? "lifecycle"
|
|
33
34
|
: "runtime";
|
|
34
35
|
}
|
|
35
|
-
function ordered(item, sourceKey, ordinal) {
|
|
36
|
+
function ordered(item, sourceKey, ordinal, sequence = ordinal) {
|
|
37
|
+
Object.defineProperty(item, TRACE_ITEM_SEQUENCE, { value: sequence });
|
|
36
38
|
return { item, ordinal, sourceKey };
|
|
37
39
|
}
|
|
38
40
|
function compareTraceItems(left, right) {
|
|
@@ -83,6 +85,8 @@ function controlDiagnosticItems(diagnostics) {
|
|
|
83
85
|
}
|
|
84
86
|
function traceEventItems(stateDir) {
|
|
85
87
|
const read = RunsTrace.readRunTraceJournal(stateDir);
|
|
88
|
+
const summary = RunsTrace.summarizeRunTraceJournal(read);
|
|
89
|
+
const sequenceOffset = summary.dropped_events + Math.max(0, summary.compactions_total - 1);
|
|
86
90
|
const retained = read.events.slice(-SOURCE_LIMIT);
|
|
87
91
|
const projected = retained.map(({ event, ordinal }) => ordered({
|
|
88
92
|
id: event.id,
|
|
@@ -95,7 +99,7 @@ function traceEventItems(stateDir) {
|
|
|
95
99
|
...(event.attention ? { attention: event.attention } : {}),
|
|
96
100
|
...(event.data !== undefined ? { data: event.data } : {}),
|
|
97
101
|
}),
|
|
98
|
-
}, "trace", ordinal));
|
|
102
|
+
}, "trace", ordinal, sequenceOffset + Math.max(0, ordinal - 1)));
|
|
99
103
|
const diagnostics = diagnosticItems(read.diagnostics).map((item, index) => ordered(item, "trace", read.events.length + index + 1));
|
|
100
104
|
const hasMarker = read.events.some(({ event }) => event.kind === "runtime.trace_compacted");
|
|
101
105
|
if (read.omittedPrefixBytes > 0 && !hasMarker) {
|
|
@@ -128,7 +132,7 @@ function controlItems(stateDir) {
|
|
|
128
132
|
summary: `${value.action} ${value.status}`,
|
|
129
133
|
...(value.status === "failed" ? { level: "error" } : {}),
|
|
130
134
|
detail: value,
|
|
131
|
-
}, "control", start + index + 1);
|
|
135
|
+
}, "control", start + index + 1, start + index);
|
|
132
136
|
});
|
|
133
137
|
return [
|
|
134
138
|
...projected,
|
|
@@ -153,7 +157,7 @@ function agentItems(stateDir) {
|
|
|
153
157
|
});
|
|
154
158
|
}
|
|
155
159
|
function processItems(stateDir) {
|
|
156
|
-
return ["stdout", "stderr"].flatMap((stream) => {
|
|
160
|
+
return ["stdout", "stderr"].flatMap((stream, index) => {
|
|
157
161
|
const path = join(stateDir, `${stream}.log`);
|
|
158
162
|
if (!existsSync(path))
|
|
159
163
|
return [];
|
|
@@ -169,7 +173,7 @@ function processItems(stateDir) {
|
|
|
169
173
|
summary: `${stream} (${stat.size} bytes)`,
|
|
170
174
|
...(stream === "stderr" ? { level: "warning" } : {}),
|
|
171
175
|
detail: redact({ bytes: stat.size, path, tail }),
|
|
172
|
-
}, `process:${stream}`, 1)];
|
|
176
|
+
}, `process:${stream}`, 1, index)];
|
|
173
177
|
});
|
|
174
178
|
}
|
|
175
179
|
function resultItems(stateDir) {
|
|
@@ -190,7 +194,7 @@ function resultItems(stateDir) {
|
|
|
190
194
|
summary: failed ? "Run process failed" : "Run process completed",
|
|
191
195
|
...(failed ? { level: "error" } : {}),
|
|
192
196
|
detail: redact(read.value),
|
|
193
|
-
}, "process:result", 1), ...diagnosticItems(read.diagnostics).map((item, index) => ordered(item, "process:result", index + 2))];
|
|
197
|
+
}, "process:result", 1, 2), ...diagnosticItems(read.diagnostics).map((item, index) => ordered(item, "process:result", index + 2))];
|
|
194
198
|
}
|
|
195
199
|
function artifactItems(stateDir, declarations) {
|
|
196
200
|
const manifest = resolveArtifactManifest(declarations);
|
|
@@ -211,7 +215,7 @@ function artifactItems(stateDir, declarations) {
|
|
|
211
215
|
required: artifact.required,
|
|
212
216
|
...(artifact.size !== undefined ? { size: artifact.size } : {}),
|
|
213
217
|
}),
|
|
214
|
-
}, "artifact", index + 1));
|
|
218
|
+
}, "artifact", index + 1, index));
|
|
215
219
|
}
|
|
216
220
|
export function projectRunTrace(stateDir, options = {}) {
|
|
217
221
|
const source = options.source ?? "all";
|
package/docs/actor-inspector.md
CHANGED
|
@@ -25,7 +25,7 @@ Captured Recipe evidence belongs to the Run generation and does not change when
|
|
|
25
25
|
|
|
26
26
|
Shows the unified bounded Trace projection. Sources include lifecycle/runtime observations, Controls, owned Pi turns, command-log tails, results, artifacts, and diagnostics. The source selector displays only `all` plus sources present in the current projection from `lifecycle`, `control`, `process`, `agent`, `artifact`, and `runtime`. Select a row to open structured detail.
|
|
27
27
|
|
|
28
|
-
Trace ordering stays deterministic and newest-first: timestamp descending, same-source physical ordinal descending, fixed internal source rank, then stable id.
|
|
28
|
+
Trace ordering stays deterministic and newest-first: timestamp descending, same-source physical ordinal descending, fixed internal source rank, then stable id. Row numbers use stable zero-based source sequences rather than positions inside the visible 100-row tail: when `#100` arrives, the existing `#99` remains `#99`. Canonical journal rows reconstruct their absolute sequence from retained ordinals plus cumulative compaction evidence; owned Pi turns keep their native turn sequence. Sequences are source-local and never imply cross-source causality. The summary states whether retained history is complete; `runtime.trace_compacted` means older history was discarded and shows bounded cumulative drop evidence. Terminal/result/execution/artifact evidence keeps its own authority. The projection applies path containment and redaction before rendering.
|
|
29
29
|
|
|
30
30
|
## Control
|
|
31
31
|
|
package/lib/inspector-overlay.ts
CHANGED
|
@@ -653,7 +653,8 @@ export class ActorInspectorOverlay {
|
|
|
653
653
|
const prefix = this.focus === "list" && index === this.rowIndex
|
|
654
654
|
? this.theme.fg("accent", " ▶ ")
|
|
655
655
|
: " ";
|
|
656
|
-
const
|
|
656
|
+
const sequence = item[TraceProjection.TRACE_ITEM_SEQUENCE] ?? items.length - index - 1;
|
|
657
|
+
const row = `${prefix}${this.theme.fg("text", `#${sequence}`)} ${marker} ${this.theme.fg("muted", item.source)}/${this.theme.fg(item.level === "error" ? "error" : "accent", item.kind)} ${this.theme.fg("text", item.summary)}`;
|
|
657
658
|
return this.focus === "list" && index === this.rowIndex
|
|
658
659
|
? this.theme.fg("accent", row)
|
|
659
660
|
: row;
|
package/lib/trace-projection.ts
CHANGED
|
@@ -34,9 +34,12 @@ export type TraceSource =
|
|
|
34
34
|
|
|
35
35
|
export type TraceSourceFilter = TraceSource | "all";
|
|
36
36
|
|
|
37
|
+
export const TRACE_ITEM_SEQUENCE = Symbol("trace-item-sequence");
|
|
38
|
+
|
|
37
39
|
export interface TraceItem {
|
|
38
40
|
id: string;
|
|
39
41
|
ts: string;
|
|
42
|
+
[TRACE_ITEM_SEQUENCE]?: number;
|
|
40
43
|
source: TraceSource;
|
|
41
44
|
kind: string;
|
|
42
45
|
summary: string;
|
|
@@ -75,7 +78,9 @@ function ordered(
|
|
|
75
78
|
item: TraceItem,
|
|
76
79
|
sourceKey: string,
|
|
77
80
|
ordinal: number,
|
|
81
|
+
sequence = ordinal,
|
|
78
82
|
): OrderedTraceItem {
|
|
83
|
+
Object.defineProperty(item, TRACE_ITEM_SEQUENCE, { value: sequence });
|
|
79
84
|
return { item, ordinal, sourceKey };
|
|
80
85
|
}
|
|
81
86
|
|
|
@@ -133,6 +138,8 @@ function controlDiagnosticItems(
|
|
|
133
138
|
|
|
134
139
|
function traceEventItems(stateDir: string): OrderedTraceItem[] {
|
|
135
140
|
const read = RunsTrace.readRunTraceJournal(stateDir);
|
|
141
|
+
const summary = RunsTrace.summarizeRunTraceJournal(read);
|
|
142
|
+
const sequenceOffset = summary.dropped_events + Math.max(0, summary.compactions_total - 1);
|
|
136
143
|
const retained = read.events.slice(-SOURCE_LIMIT);
|
|
137
144
|
const projected = retained.map(({ event, ordinal }) => ordered({
|
|
138
145
|
id: event.id,
|
|
@@ -145,7 +152,7 @@ function traceEventItems(stateDir: string): OrderedTraceItem[] {
|
|
|
145
152
|
...(event.attention ? { attention: event.attention } : {}),
|
|
146
153
|
...(event.data !== undefined ? { data: event.data } : {}),
|
|
147
154
|
}),
|
|
148
|
-
}, "trace", ordinal));
|
|
155
|
+
}, "trace", ordinal, sequenceOffset + Math.max(0, ordinal - 1)));
|
|
149
156
|
const diagnostics = diagnosticItems(read.diagnostics).map((item, index) =>
|
|
150
157
|
ordered(item, "trace", read.events.length + index + 1)
|
|
151
158
|
);
|
|
@@ -183,7 +190,7 @@ function controlItems(stateDir: string): OrderedTraceItem[] {
|
|
|
183
190
|
summary: `${value.action} ${value.status}`,
|
|
184
191
|
...(value.status === "failed" ? { level: "error" as const } : {}),
|
|
185
192
|
detail: value,
|
|
186
|
-
}, "control", start + index + 1);
|
|
193
|
+
}, "control", start + index + 1, start + index);
|
|
187
194
|
});
|
|
188
195
|
return [
|
|
189
196
|
...projected,
|
|
@@ -212,7 +219,7 @@ function agentItems(stateDir: string): OrderedTraceItem[] {
|
|
|
212
219
|
}
|
|
213
220
|
|
|
214
221
|
function processItems(stateDir: string): OrderedTraceItem[] {
|
|
215
|
-
return ["stdout", "stderr"].flatMap((stream) => {
|
|
222
|
+
return ["stdout", "stderr"].flatMap((stream, index) => {
|
|
216
223
|
const path = join(stateDir, `${stream}.log`);
|
|
217
224
|
if (!existsSync(path)) return [];
|
|
218
225
|
const stat = statSync(path);
|
|
@@ -226,7 +233,7 @@ function processItems(stateDir: string): OrderedTraceItem[] {
|
|
|
226
233
|
summary: `${stream} (${stat.size} bytes)`,
|
|
227
234
|
...(stream === "stderr" ? { level: "warning" as const } : {}),
|
|
228
235
|
detail: redact({ bytes: stat.size, path, tail }),
|
|
229
|
-
}, `process:${stream}`, 1)];
|
|
236
|
+
}, `process:${stream}`, 1, index)];
|
|
230
237
|
});
|
|
231
238
|
}
|
|
232
239
|
|
|
@@ -250,7 +257,7 @@ function resultItems(stateDir: string): OrderedTraceItem[] {
|
|
|
250
257
|
summary: failed ? "Run process failed" : "Run process completed",
|
|
251
258
|
...(failed ? { level: "error" as const } : {}),
|
|
252
259
|
detail: redact(read.value),
|
|
253
|
-
}, "process:result", 1), ...diagnosticItems(read.diagnostics).map(
|
|
260
|
+
}, "process:result", 1, 2), ...diagnosticItems(read.diagnostics).map(
|
|
254
261
|
(item, index) => ordered(item, "process:result", index + 2),
|
|
255
262
|
)];
|
|
256
263
|
}
|
|
@@ -277,7 +284,7 @@ function artifactItems(
|
|
|
277
284
|
required: artifact.required,
|
|
278
285
|
...(artifact.size !== undefined ? { size: artifact.size } : {}),
|
|
279
286
|
}),
|
|
280
|
-
}, "artifact", index + 1),
|
|
287
|
+
}, "artifact", index + 1, index),
|
|
281
288
|
);
|
|
282
289
|
}
|
|
283
290
|
|