pi-daddy 0.51.0 → 0.53.0
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 +11 -0
- package/README.md +33 -42
- package/dist/governance/approval-prompt.d.ts +4 -0
- package/dist/governance/approval-prompt.d.ts.map +1 -1
- package/dist/governance/approval-prompt.js +4 -5
- package/dist/governance/approval-prompt.js.map +1 -1
- package/dist/governance/permission-question.d.ts +4 -0
- package/dist/governance/permission-question.d.ts.map +1 -0
- package/dist/governance/permission-question.js +102 -0
- package/dist/governance/permission-question.js.map +1 -0
- package/dist/kernel/chain.d.ts +1 -0
- package/dist/kernel/chain.d.ts.map +1 -1
- package/dist/kernel/chain.js.map +1 -1
- package/dist/kernel/dashboard-observation.d.ts +15 -5
- package/dist/kernel/dashboard-observation.d.ts.map +1 -1
- package/dist/kernel/dashboard-observation.js.map +1 -1
- package/dist/products/activity-summary.d.ts +8 -0
- package/dist/products/activity-summary.d.ts.map +1 -0
- package/dist/products/activity-summary.js +101 -0
- package/dist/products/activity-summary.js.map +1 -0
- package/dist/products/activity-timeline.d.ts +4 -1
- package/dist/products/activity-timeline.d.ts.map +1 -1
- package/dist/products/activity-timeline.js +9 -1
- package/dist/products/activity-timeline.js.map +1 -1
- package/dist/products/dashboard-activity.d.ts +9 -0
- package/dist/products/dashboard-activity.d.ts.map +1 -0
- package/dist/products/dashboard-activity.js +119 -0
- package/dist/products/dashboard-activity.js.map +1 -0
- package/dist/products/dashboard-cli.d.ts +2 -1
- package/dist/products/dashboard-cli.d.ts.map +1 -1
- package/dist/products/dashboard-cli.js +28 -6
- package/dist/products/dashboard-cli.js.map +1 -1
- package/dist/products/dashboard-components.d.ts +10 -0
- package/dist/products/dashboard-components.d.ts.map +1 -0
- package/dist/products/dashboard-components.js +196 -0
- package/dist/products/dashboard-components.js.map +1 -0
- package/dist/products/dashboard-display-controls.js +3 -3
- package/dist/products/dashboard-display-controls.js.map +1 -1
- package/dist/products/dashboard-handshake.d.ts +2 -0
- package/dist/products/dashboard-handshake.d.ts.map +1 -1
- package/dist/products/dashboard-handshake.js +39 -43
- package/dist/products/dashboard-handshake.js.map +1 -1
- package/dist/products/dashboard-herdr.d.ts.map +1 -1
- package/dist/products/dashboard-herdr.js +7 -1
- package/dist/products/dashboard-herdr.js.map +1 -1
- package/dist/products/dashboard-layout.js +20 -4
- package/dist/products/dashboard-layout.js.map +1 -1
- package/dist/products/dashboard-panels.d.ts.map +1 -1
- package/dist/products/dashboard-panels.js +128 -67
- package/dist/products/dashboard-panels.js.map +1 -1
- package/dist/products/dashboard-recap.d.ts +1 -1
- package/dist/products/dashboard-recap.d.ts.map +1 -1
- package/dist/products/dashboard-recap.js +12 -16
- package/dist/products/dashboard-recap.js.map +1 -1
- package/dist/products/dashboard-screen.d.ts +6 -2
- package/dist/products/dashboard-screen.d.ts.map +1 -1
- package/dist/products/dashboard-screen.js +104 -37
- package/dist/products/dashboard-screen.js.map +1 -1
- package/dist/products/dashboard-session-client.d.ts +10 -6
- package/dist/products/dashboard-session-client.d.ts.map +1 -1
- package/dist/products/dashboard-session-client.js +14 -10
- package/dist/products/dashboard-session-client.js.map +1 -1
- package/dist/products/dashboard-settings.d.ts +10 -1
- package/dist/products/dashboard-settings.d.ts.map +1 -1
- package/dist/products/dashboard-settings.js +26 -1
- package/dist/products/dashboard-settings.js.map +1 -1
- package/dist/products/ecosystem-versions.d.ts +2 -0
- package/dist/products/ecosystem-versions.d.ts.map +1 -1
- package/extensions/activity-timeline.ts +7 -1
- package/extensions/approvals.ts +7 -0
- package/extensions/dashboard-live.ts +45 -5
- package/extensions/dashboard-observation.ts +1 -3
- package/extensions/dashboard-session-server.ts +6 -1
- package/extensions/dashboard-settings.ts +15 -1
- package/extensions/delegate-chain.ts +2 -0
- package/extensions/delegation-artifacts.ts +26 -4
- package/extensions/delegation-operations.ts +12 -4
- package/extensions/delegation.ts +4 -0
- package/extensions/ecosystem-versions.ts +25 -3
- package/extensions/execute-child.ts +4 -0
- package/extensions/grants.ts +10 -4
- package/extensions/run-delegation.ts +2 -0
- package/extensions/runtime-snapshot.ts +8 -4
- package/extensions/session-report.ts +4 -0
- package/extensions/session.ts +4 -3
- package/package.json +2 -2
- package/src/governance/approval-prompt.ts +7 -6
- package/src/governance/permission-question.ts +108 -0
- package/src/kernel/chain.ts +1 -0
- package/src/kernel/dashboard-observation.ts +15 -1
- package/src/products/activity-summary.ts +101 -0
- package/src/products/activity-timeline.ts +11 -0
- package/src/products/dashboard-activity.ts +136 -0
- package/src/products/dashboard-cli.ts +37 -8
- package/src/products/dashboard-components.ts +219 -0
- package/src/products/dashboard-display-controls.ts +3 -3
- package/src/products/dashboard-handshake.ts +45 -49
- package/src/products/dashboard-herdr.ts +9 -1
- package/src/products/dashboard-layout.ts +27 -6
- package/src/products/dashboard-panels.ts +128 -76
- package/src/products/dashboard-recap.ts +15 -15
- package/src/products/dashboard-screen.ts +115 -39
- package/src/products/dashboard-session-client.ts +23 -12
- package/src/products/dashboard-settings.ts +36 -2
- package/src/products/ecosystem-versions.ts +2 -0
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/** Settings are owner observations; rendering never grants consent or changes execution. */
|
|
2
|
+
export const JEV_EDIT_ACTIONS = ["limit", "configure", "hints"];
|
|
3
|
+
export const isJevEditAction = (value) => JEV_EDIT_ACTIONS.some((key) => value === key);
|
|
1
4
|
export const DASHBOARD_SETTING_KEYS = [
|
|
2
5
|
"auto",
|
|
3
6
|
"jev",
|
|
@@ -7,6 +10,11 @@ export const DASHBOARD_SETTING_KEYS = [
|
|
|
7
10
|
"depth",
|
|
8
11
|
"perCall",
|
|
9
12
|
];
|
|
13
|
+
export function visibleSettingKeys(jev) {
|
|
14
|
+
const extra = JEV_EDIT_ACTIONS.filter((key) => jev?.available && jev.controls?.includes(key));
|
|
15
|
+
return ["auto", "jev", ...extra, ...DASHBOARD_SETTING_KEYS.slice(2)];
|
|
16
|
+
}
|
|
17
|
+
export const JEV_EDITOR_NOTICE = "Finish editing in the main Pi session.";
|
|
10
18
|
export const JEV_CONSENT_NOTICE = "Complete JEV paid-call and LoRA-storage choices in the parent Pi session";
|
|
11
19
|
export function dashboardJevNotice(jev) {
|
|
12
20
|
if (jev.pending)
|
|
@@ -24,9 +32,26 @@ export function dashboardSettingsLines(settings, auto, selected) {
|
|
|
24
32
|
"SETTINGS · current session",
|
|
25
33
|
row("auto", `Permission Auto: ${auto ? "ON" : "OFF"}`),
|
|
26
34
|
row("jev", `JEV: ${jev.pending ? "waiting for consent" : !jev.available ? "unavailable" : jev.enabled ? "ON" : "OFF"}`),
|
|
35
|
+
...(jev.available && jev.controls?.includes("limit")
|
|
36
|
+
? [
|
|
37
|
+
row("limit", `Call limit: ${jev.limit ?? "unknown"} per session`),
|
|
38
|
+
` ${jev.used ?? "?"} used · ${jev.remaining ?? "?"} available now`,
|
|
39
|
+
]
|
|
40
|
+
: []),
|
|
41
|
+
...(jev.available && jev.controls?.includes("configure")
|
|
42
|
+
? [row("configure", "Choose JEV model and storage…")]
|
|
43
|
+
: []),
|
|
44
|
+
...(jev.available && jev.controls?.includes("hints")
|
|
45
|
+
? [
|
|
46
|
+
row("hints", `Tool hints: ${jev.hintsEnabled === true ? "ON" : jev.hintsEnabled === false ? "OFF" : "unknown"}`),
|
|
47
|
+
" Suggestions only · above 90% confidence",
|
|
48
|
+
]
|
|
49
|
+
: []),
|
|
27
50
|
...(jev.available
|
|
28
51
|
? [
|
|
29
|
-
|
|
52
|
+
...(jev.controls?.includes("limit")
|
|
53
|
+
? [` Provider status: ${jev.availability ?? "unknown"}`]
|
|
54
|
+
: [` ${jev.availability ?? "unknown"} · ${jev.remaining ?? 0} paid calls left`]),
|
|
30
55
|
` Key: ${jev.providerReadiness ?? "unknown"}; storage: ${jev.storage ?? "not granted"}`,
|
|
31
56
|
...(jev.selectedProvider || jev.selectedModel
|
|
32
57
|
? [` Model: ${jev.selectedProvider ?? "unknown"}/${jev.selectedModel ?? "not reported"}`]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-settings.js","sourceRoot":"","sources":["../../src/products/dashboard-settings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dashboard-settings.js","sourceRoot":"","sources":["../../src/products/dashboard-settings.ts"],"names":[],"mappings":"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"}
|
|
@@ -10,6 +10,8 @@ export interface EcosystemVersionRow {
|
|
|
10
10
|
state: "current" | "reload-required" | "not-reported" | "unavailable" | "multiple";
|
|
11
11
|
commands: string[];
|
|
12
12
|
note?: string;
|
|
13
|
+
/** Pi reports the Bookie command from this installed package in the current session. */
|
|
14
|
+
commandAvailable?: boolean;
|
|
13
15
|
}
|
|
14
16
|
export interface EcosystemVersions {
|
|
15
17
|
rows: EcosystemVersionRow[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecosystem-versions.d.ts","sourceRoot":"","sources":["../../src/products/ecosystem-versions.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,MAAM,kBAAkB,GAC5B,IAAI,GAAG,UAAU,GAAG,qBAAqB,GAAG,eAAe,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AACzG,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,kBAAkB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,SAAS,GAAG,iBAAiB,GAAG,cAAc,GAAG,aAAa,GAAG,UAAU,CAAC;IACnF,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ecosystem-versions.d.ts","sourceRoot":"","sources":["../../src/products/ecosystem-versions.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,MAAM,kBAAkB,GAC5B,IAAI,GAAG,UAAU,GAAG,qBAAqB,GAAG,eAAe,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AACzG,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,kBAAkB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,SAAS,GAAG,iBAAiB,GAAG,cAAc,GAAG,aAAa,GAAG,UAAU,CAAC;IACnF,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AACD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,mBAAmB,EAAE,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
|
+
import { observedPurpose } from "../src/products/activity-summary.ts";
|
|
5
6
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
6
7
|
import { ENV_EPISODE_ID } from "../src/kernel/env-names.ts";
|
|
7
8
|
import { Type } from "typebox";
|
|
@@ -251,7 +252,12 @@ export function registerActivityTimeline(pi: ExtensionAPI, session?: ActivitySes
|
|
|
251
252
|
const value = event as { toolCallId?: string; toolName?: string; args?: { path?: unknown } };
|
|
252
253
|
if (value.toolCallId && typeof value.args?.path === "string") paths.set(value.toolCallId, value.args.path);
|
|
253
254
|
try {
|
|
254
|
-
if (value.toolName
|
|
255
|
+
if (value.toolName && recorder)
|
|
256
|
+
await recorder.append("tool_started", {
|
|
257
|
+
tool: value.toolName,
|
|
258
|
+
cwd: ctx.cwd,
|
|
259
|
+
dashboardSummary: observedPurpose(value.toolName, value.args, recorder.contentEnabled),
|
|
260
|
+
});
|
|
255
261
|
} catch {
|
|
256
262
|
/* observation cannot affect tool execution */
|
|
257
263
|
}
|
package/extensions/approvals.ts
CHANGED
|
@@ -262,6 +262,13 @@ export async function obtainApprovals(
|
|
|
262
262
|
path,
|
|
263
263
|
task,
|
|
264
264
|
signal,
|
|
265
|
+
project: session.cwd,
|
|
266
|
+
workspace: expectedBinding?.workspace_id,
|
|
267
|
+
recheckReason: pre.expired.includes(capability)
|
|
268
|
+
? "The previous permission expired."
|
|
269
|
+
: pre.scopeMismatched.includes(capability)
|
|
270
|
+
? "The saved permission covers a different request."
|
|
271
|
+
: undefined,
|
|
265
272
|
...(expectedBinding ? { bindingKey: approvalBindingDigest(expectedBinding) } : {}),
|
|
266
273
|
});
|
|
267
274
|
if (outcome.scope === null) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Bounded metadata-only Pi observations work even when optional transcript/diagnostic capture is off. */
|
|
2
|
+
import { dashboardContentEnabled, observedPurpose } from "../src/products/activity-summary.ts";
|
|
2
3
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
3
4
|
import type { DashboardContribution } from "../src/kernel/dashboard-observation.ts";
|
|
4
5
|
import type { DashboardSourceOwner } from "./dashboard-sources.ts";
|
|
@@ -7,9 +8,11 @@ export function registerDashboardLive(pi: ExtensionAPI, current: () => Dashboard
|
|
|
7
8
|
ordinal = 0;
|
|
8
9
|
let turn: DashboardContribution | undefined;
|
|
9
10
|
const activity: DashboardContribution[] = [];
|
|
11
|
+
const calls = new Map<string, { token: number; purpose: string; tool: string }>();
|
|
10
12
|
const reset = () => {
|
|
11
13
|
if (current() !== owner) {
|
|
12
14
|
owner = current();
|
|
15
|
+
calls.clear();
|
|
13
16
|
turn = undefined;
|
|
14
17
|
activity.length = 0;
|
|
15
18
|
ordinal = 0;
|
|
@@ -18,23 +21,27 @@ export function registerDashboardLive(pi: ExtensionAPI, current: () => Dashboard
|
|
|
18
21
|
const record = (kind: string, event: unknown, ctx: ExtensionContext) => {
|
|
19
22
|
reset();
|
|
20
23
|
if (!owner || ctx.sessionManager.getSessionId() !== owner.sessionId) return;
|
|
21
|
-
const value = event as { toolName?: string; isError?: boolean };
|
|
24
|
+
const value = event as { toolName?: string; toolCallId?: string; args?: unknown; isError?: boolean };
|
|
22
25
|
const tool = typeof value.toolName === "string" ? value.toolName.slice(0, 128) : undefined;
|
|
23
26
|
const at = new Date().toISOString();
|
|
24
|
-
if (kind === "agent_start")
|
|
27
|
+
if (kind === "agent_start") {
|
|
28
|
+
calls.clear();
|
|
25
29
|
turn = {
|
|
26
30
|
id: `turn:${++ordinal}`,
|
|
27
31
|
kind: "work",
|
|
28
|
-
label: "
|
|
32
|
+
label: "Pi is working on your request",
|
|
29
33
|
state: "running",
|
|
30
34
|
details: [
|
|
31
35
|
`Observed start: ${at}`,
|
|
32
36
|
`Model: ${ctx.model?.provider ?? "unknown"}/${ctx.model?.id ?? "unknown"}`.slice(0, 240),
|
|
33
37
|
],
|
|
34
38
|
};
|
|
35
|
-
|
|
39
|
+
}
|
|
40
|
+
if (kind === "agent_end" && turn) {
|
|
41
|
+
calls.clear();
|
|
36
42
|
turn = {
|
|
37
43
|
...turn,
|
|
44
|
+
label: "Pi finished its turn",
|
|
38
45
|
state: "settled",
|
|
39
46
|
details: [
|
|
40
47
|
...(turn.details ?? []),
|
|
@@ -42,12 +49,45 @@ export function registerDashboardLive(pi: ExtensionAPI, current: () => Dashboard
|
|
|
42
49
|
"Turn ended; task acceptance and child settlement remain separate.",
|
|
43
50
|
],
|
|
44
51
|
};
|
|
52
|
+
}
|
|
53
|
+
// Pair using Pi's call identity; expose only a local ordinal. Raw arguments and results stay in Pi.
|
|
54
|
+
const callId =
|
|
55
|
+
typeof value.toolCallId === "string" && value.toolCallId.length <= 200 ? value.toolCallId : undefined;
|
|
56
|
+
let call = callId ? calls.get(callId) : undefined;
|
|
57
|
+
if (tool && kind === "tool start") {
|
|
58
|
+
call = {
|
|
59
|
+
token: ++ordinal,
|
|
60
|
+
purpose: observedPurpose(tool, value.args, dashboardContentEnabled(process.env)),
|
|
61
|
+
tool,
|
|
62
|
+
};
|
|
63
|
+
if (callId) {
|
|
64
|
+
calls.set(callId, call);
|
|
65
|
+
if (calls.size > 32) calls.delete(calls.keys().next().value!);
|
|
66
|
+
}
|
|
67
|
+
if (turn?.state === "running") turn = { ...turn, label: call.purpose };
|
|
68
|
+
} else if (kind === "tool end") {
|
|
69
|
+
if (callId) {
|
|
70
|
+
calls.delete(callId);
|
|
71
|
+
if (call?.tool !== tool) call = undefined;
|
|
72
|
+
} else {
|
|
73
|
+
// Without an identity we cannot tell which same-tool action just ended.
|
|
74
|
+
for (const [key, active] of calls) if (active.tool === tool || !tool) calls.delete(key);
|
|
75
|
+
}
|
|
76
|
+
if (turn?.state === "running") {
|
|
77
|
+
const latest = Array.from(calls.values()).at(-1);
|
|
78
|
+
turn = { ...turn, label: latest?.purpose ?? "Pi is working on your request" };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
45
81
|
const item: DashboardContribution = {
|
|
46
82
|
id: `event:${++ordinal}`,
|
|
47
83
|
kind: "status",
|
|
48
84
|
label: tool ? `${tool}: ${kind}` : kind,
|
|
49
85
|
state: value.isError ? "failed" : "observed",
|
|
50
|
-
details: [
|
|
86
|
+
details: [
|
|
87
|
+
`Observed: ${at}`,
|
|
88
|
+
...(callId && call ? [`Call: ${call.token}`] : []),
|
|
89
|
+
...(call ? [`Purpose: ${call.purpose}`] : []),
|
|
90
|
+
],
|
|
51
91
|
};
|
|
52
92
|
activity.push(item);
|
|
53
93
|
if (activity.length > 32) activity.shift();
|
|
@@ -21,9 +21,7 @@ export function dashboardObservation(session: GrantsSession, now = Date.now()) {
|
|
|
21
21
|
...live,
|
|
22
22
|
sources: [...value.sources, ...(initiative ? [initiative] : []), ...(workspace ? [workspace] : [])],
|
|
23
23
|
logicalOwnerId: session.ownSpawnId,
|
|
24
|
-
artifacts: (session.dashboardArtifacts ?? [])
|
|
25
|
-
.slice(-16)
|
|
26
|
-
.map((r) => ({ operationId: r.operationId, executionId: r.executionId, sha256: r.manifest.sha256 })),
|
|
24
|
+
artifacts: (session.dashboardArtifacts ?? []).slice(-16),
|
|
27
25
|
resources: {
|
|
28
26
|
scope: "owner-process" as const,
|
|
29
27
|
sampledAt: new Date(sample.at).toISOString(),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isJevEditAction } from "../src/products/dashboard-settings.ts";
|
|
1
2
|
import { dashboardObservation } from "./dashboard-observation.ts";
|
|
2
3
|
import { dashboardSettingsSnapshot, dashboardJev, setDashboardLimit } from "./dashboard-settings.ts";
|
|
3
4
|
import { randomBytes } from "node:crypto";
|
|
@@ -87,10 +88,11 @@ async function respond(session: GrantsSession, token: string, line: string): Pro
|
|
|
87
88
|
enabled?: unknown;
|
|
88
89
|
key?: unknown;
|
|
89
90
|
seconds?: unknown;
|
|
91
|
+
option?: unknown;
|
|
90
92
|
expectedOwner?: { sessionId?: unknown; cwd?: unknown; generation?: unknown };
|
|
91
93
|
};
|
|
92
94
|
if (request.token !== token) return { ok: false, error: "unauthorised dashboard request" };
|
|
93
|
-
if (request.action !== "get" && request.expectedOwner !== undefined) {
|
|
95
|
+
if (request.action === "edit-jev" || (request.action !== "get" && request.expectedOwner !== undefined)) {
|
|
94
96
|
const observed = session.dashboardObservations?.(),
|
|
95
97
|
expected = request.expectedOwner;
|
|
96
98
|
if (
|
|
@@ -108,6 +110,9 @@ async function respond(session: GrantsSession, token: string, line: string): Pro
|
|
|
108
110
|
let jev;
|
|
109
111
|
if (request.action === "set-limit") {
|
|
110
112
|
setDashboardLimit(session, request.key, request.seconds);
|
|
113
|
+
} else if (request.action === "edit-jev") {
|
|
114
|
+
if (!isJevEditAction(request.option)) return { ok: false, error: "Unknown JEV setting" };
|
|
115
|
+
jev = await dashboardJev(session, request.option);
|
|
111
116
|
} else if (request.action === "set-jev") {
|
|
112
117
|
if (typeof request.enabled !== "boolean") return { ok: false, error: "JEV requires an explicit boolean" };
|
|
113
118
|
jev = await dashboardJev(session, request.enabled ? "enable" : "disable");
|
|
@@ -3,6 +3,7 @@ import { randomUUID } from "node:crypto";
|
|
|
3
3
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
import type { GrantsSession } from "./session.ts";
|
|
5
5
|
import type { DashboardJevState, DashboardSettingsSnapshot } from "../src/products/dashboard-settings.ts";
|
|
6
|
+
import { isJevEditAction, type JevEditAction } from "../src/products/dashboard-settings.ts";
|
|
6
7
|
import { MAX_CHILDREN_PER_CALL } from "../src/kernel/fanout.ts";
|
|
7
8
|
import {
|
|
8
9
|
ENV_CHILD_TIMEOUT,
|
|
@@ -69,7 +70,7 @@ const safeStorageRoot = (value: unknown) =>
|
|
|
69
70
|
: undefined;
|
|
70
71
|
export async function dashboardJev(
|
|
71
72
|
session: GrantsSession,
|
|
72
|
-
action: "status" | "enable" | "disable",
|
|
73
|
+
action: "status" | "enable" | "disable" | JevEditAction,
|
|
73
74
|
): Promise<DashboardJevState> {
|
|
74
75
|
const current = owner(session, action !== "status");
|
|
75
76
|
const pi = bridges.get(session);
|
|
@@ -95,6 +96,10 @@ export async function dashboardJev(
|
|
|
95
96
|
mode?: string;
|
|
96
97
|
storage?: string | null;
|
|
97
98
|
remaining?: number;
|
|
99
|
+
used?: number;
|
|
100
|
+
limit?: number;
|
|
101
|
+
hintsEnabled?: boolean;
|
|
102
|
+
controls?: unknown;
|
|
98
103
|
availability?: string;
|
|
99
104
|
providerReadiness?: string;
|
|
100
105
|
selectedProvider?: string | null;
|
|
@@ -115,8 +120,17 @@ export async function dashboardJev(
|
|
|
115
120
|
else resolve(unavailable("JEV owner is not bound to this session"));
|
|
116
121
|
return;
|
|
117
122
|
}
|
|
123
|
+
if (value.error && isJevEditAction(action)) {
|
|
124
|
+
reject(new Error("JEV settings request declined. Check the main Pi session."));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const count = (n: unknown) => (typeof n === "number" && Number.isSafeInteger(n) && n >= 0 ? n : undefined);
|
|
118
128
|
resolve({
|
|
119
129
|
available: true,
|
|
130
|
+
controls: Array.isArray(value.status.controls) ? value.status.controls.filter(isJevEditAction) : undefined,
|
|
131
|
+
used: count(value.status.used),
|
|
132
|
+
limit: count(value.status.limit),
|
|
133
|
+
hintsEnabled: typeof value.status.hintsEnabled === "boolean" ? value.status.hintsEnabled : undefined,
|
|
120
134
|
enabled: value.status.enabled,
|
|
121
135
|
pending: value.pending === true,
|
|
122
136
|
mode: safeText(value.status.mode),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { dashboardSummaryDescription } from "../src/products/activity-summary.ts";
|
|
1
2
|
import { operationIdShape, claimDelegationOperation, existingOperationOutcome } from "./delegation-operations.ts";
|
|
2
3
|
import { publicEvidenceCall } from "./public-evidence.ts";
|
|
3
4
|
import { executionEvidenceContent } from "./execution-evidence.ts";
|
|
@@ -81,6 +82,7 @@ export function registerChainTool(pi: ExtensionAPI, session: GrantsSession): voi
|
|
|
81
82
|
definitionId: Type.Optional(
|
|
82
83
|
Type.String({ description: "Snapshot id returned by delegate_describe; required for Principal phases." }),
|
|
83
84
|
),
|
|
85
|
+
dashboardSummary: Type.Optional(Type.String({ maxLength: 160, description: dashboardSummaryDescription })),
|
|
84
86
|
task: Type.String({
|
|
85
87
|
description:
|
|
86
88
|
`What this step should do. Write ${PLACEHOLDER} where the previous step's output belongs; if you omit it, ` +
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import type { OperationClaim, OperationRequest, OperationReference } from "../src/kernel/dispatch-operation.ts";
|
|
3
3
|
import type { OperationArtifactOutcome, OperationArtifactRef } from "../src/kernel/operation-artifact.ts";
|
|
4
4
|
import type { OperationArtifactStore } from "../src/governance/operation-artifacts.ts";
|
|
5
|
+
import type { DashboardResultDescription } from "../src/kernel/dashboard-observation.ts";
|
|
6
|
+
import type { OperationFinalStore } from "./delegation-operations.ts";
|
|
5
7
|
import type { GrantsSession } from "./session.ts";
|
|
6
8
|
const owners = new WeakMap<
|
|
7
9
|
OperationClaim,
|
|
@@ -9,7 +11,8 @@ const owners = new WeakMap<
|
|
|
9
11
|
store: OperationArtifactStore;
|
|
10
12
|
request: OperationRequest;
|
|
11
13
|
reference?: OperationArtifactRef;
|
|
12
|
-
|
|
14
|
+
display?: Pick<DashboardResultDescription, "agent" | "summary">;
|
|
15
|
+
publish?: OperationFinalStore["publishArtifact"];
|
|
13
16
|
}
|
|
14
17
|
>();
|
|
15
18
|
export function operationHistory(session: GrantsSession, operationId: string, includeFinal = true) {
|
|
@@ -20,6 +23,7 @@ export async function claimWithArtifact(
|
|
|
20
23
|
request: OperationRequest,
|
|
21
24
|
claim: () => Promise<OperationClaim>,
|
|
22
25
|
scope = session.reloadLifecycle?.operationFinals,
|
|
26
|
+
display?: Pick<DashboardResultDescription, "agent" | "summary">,
|
|
23
27
|
): Promise<OperationClaim> {
|
|
24
28
|
if (scope !== session.reloadLifecycle?.operationFinals) throw Error("Operation owner changed before admission");
|
|
25
29
|
const store = scope?.artifacts;
|
|
@@ -72,7 +76,12 @@ export async function claimWithArtifact(
|
|
|
72
76
|
},
|
|
73
77
|
});
|
|
74
78
|
try {
|
|
75
|
-
scope.publishArtifact?.(reference
|
|
79
|
+
scope.publishArtifact?.(reference, {
|
|
80
|
+
...display,
|
|
81
|
+
content: "record",
|
|
82
|
+
state: "not-started",
|
|
83
|
+
observedAt: owned.operation.updatedAt,
|
|
84
|
+
});
|
|
76
85
|
} catch {
|
|
77
86
|
/* optional reference hint */
|
|
78
87
|
}
|
|
@@ -82,7 +91,7 @@ export async function claimWithArtifact(
|
|
|
82
91
|
}
|
|
83
92
|
throw error;
|
|
84
93
|
}
|
|
85
|
-
const state = { store, request: { ...request }, publish: scope.publishArtifact };
|
|
94
|
+
const state = { store, request: { ...request }, publish: scope.publishArtifact, display };
|
|
86
95
|
owners.set(owned, state);
|
|
87
96
|
const started = owned.started!;
|
|
88
97
|
owned.started = async (cwd, workspaceId) => {
|
|
@@ -121,7 +130,20 @@ export function retainOperationArtifact(claim: OperationClaim, outcome: Operatio
|
|
|
121
130
|
claim.operation.artifact = reference;
|
|
122
131
|
// Pi receives only a small reference, never duplicated full authored content.
|
|
123
132
|
try {
|
|
124
|
-
|
|
133
|
+
const { operation } = outcome;
|
|
134
|
+
owner.publish?.(reference, {
|
|
135
|
+
...owner.display,
|
|
136
|
+
content: outcome.final ? "answer" : outcome.partial !== undefined ? "partial" : "record",
|
|
137
|
+
state:
|
|
138
|
+
operation.state === "not-started" || operation.state === "uncertain"
|
|
139
|
+
? operation.state
|
|
140
|
+
: operation.runtime?.work === "failed"
|
|
141
|
+
? "failed"
|
|
142
|
+
: operation.state === "settled"
|
|
143
|
+
? "settled"
|
|
144
|
+
: "unknown",
|
|
145
|
+
observedAt: operation.updatedAt,
|
|
146
|
+
});
|
|
125
147
|
} catch {
|
|
126
148
|
/* Durable publication is authoritative; optional hints are recoverable. */
|
|
127
149
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { claimWithArtifact, retainOperationArtifact } from "./delegation-artifacts.ts";
|
|
3
3
|
import { openOperationArtifacts, type OperationArtifactStore } from "../src/governance/operation-artifacts.ts";
|
|
4
4
|
import type { OperationArtifactRef } from "../src/kernel/operation-artifact.ts";
|
|
5
|
+
import type { DashboardResultDescription } from "../src/kernel/dashboard-observation.ts";
|
|
6
|
+
import { dashboardContentEnabled, safeDashboardSummary } from "../src/products/activity-summary.ts";
|
|
5
7
|
import { agentDir } from "../src/kernel/project-paths.ts";
|
|
6
8
|
import { createHash } from "node:crypto";
|
|
7
9
|
import { realpath } from "node:fs/promises";
|
|
@@ -27,7 +29,7 @@ const FINAL_BYTES = 4 * 1024 * 1024,
|
|
|
27
29
|
type Final = Extract<NonNullable<DelegationOutcome["final"]>, { state: "complete" }>;
|
|
28
30
|
export interface OperationFinalStore {
|
|
29
31
|
artifacts?: OperationArtifactStore;
|
|
30
|
-
publishArtifact?: (reference: OperationArtifactRef) => void;
|
|
32
|
+
publishArtifact?: (reference: OperationArtifactRef, description?: DashboardResultDescription) => void;
|
|
31
33
|
lifecycle: object;
|
|
32
34
|
owner: string;
|
|
33
35
|
bytes: number;
|
|
@@ -37,7 +39,7 @@ export function bindOperationFinals(
|
|
|
37
39
|
session: GrantsSession,
|
|
38
40
|
sessionId: string,
|
|
39
41
|
cwd: string,
|
|
40
|
-
publishArtifact?:
|
|
42
|
+
publishArtifact?: OperationFinalStore["publishArtifact"],
|
|
41
43
|
) {
|
|
42
44
|
const owner = JSON.stringify([sessionId, cwd]),
|
|
43
45
|
old = session.reloadLifecycle.operationFinals;
|
|
@@ -155,7 +157,8 @@ export async function claimDelegationOperation(
|
|
|
155
157
|
const operations = session.autoMode?.operations;
|
|
156
158
|
if (!operations) throw Error("Session operation admission is unavailable; no dispatch started");
|
|
157
159
|
const cwd = await realpath(ctx.cwd);
|
|
158
|
-
|
|
160
|
+
// A display-only caption may change when resuming the very same task.
|
|
161
|
+
const { operation_id: _id, dashboardSummary: _caption, ...request } = spec;
|
|
159
162
|
const requestDigest = createHash("sha256")
|
|
160
163
|
.update(
|
|
161
164
|
JSON.stringify(
|
|
@@ -185,7 +188,12 @@ export async function claimDelegationOperation(
|
|
|
185
188
|
cwd,
|
|
186
189
|
workspaceId: spec.workspace?.workspace_id ?? null,
|
|
187
190
|
};
|
|
188
|
-
|
|
191
|
+
const agent = spec.agent && /^[a-z][a-z0-9_-]{0,48}$/i.test(spec.agent) ? spec.agent : undefined;
|
|
192
|
+
const summary = dashboardContentEnabled(process.env) ? safeDashboardSummary(spec.dashboardSummary) : undefined;
|
|
193
|
+
return claimWithArtifact(session, identity, () => operations.claim(identity, signal), operationScope, {
|
|
194
|
+
agent,
|
|
195
|
+
summary,
|
|
196
|
+
});
|
|
189
197
|
};
|
|
190
198
|
if (!denied) return elect();
|
|
191
199
|
|
package/extensions/delegation.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { dashboardSummaryDescription } from "../src/products/activity-summary.ts";
|
|
1
2
|
import { operationIdShape, claimDelegationOperation } from "./delegation-operations.ts";
|
|
2
3
|
import { publicEvidenceCall } from "./public-evidence.ts";
|
|
3
4
|
import { executionEvidenceContent } from "./execution-evidence.ts";
|
|
@@ -195,6 +196,7 @@ export function registerDelegationTools(pi: ExtensionAPI, session: GrantsSession
|
|
|
195
196
|
definitionId: Type.Optional(
|
|
196
197
|
Type.String({ description: "Snapshot id returned by delegate_describe; required for Principal phases." }),
|
|
197
198
|
),
|
|
199
|
+
dashboardSummary: Type.Optional(Type.String({ maxLength: 160, description: dashboardSummaryDescription })),
|
|
198
200
|
task: Type.String({ description: "The task for this sub-agent. It receives only this." }),
|
|
199
201
|
agent: Type.Optional(Type.String({ description: describeAgent(spawnable()) })),
|
|
200
202
|
tools: Type.Optional(Type.Array(Type.String(), { description: "Capabilities, when no 'agent' fits." })),
|
|
@@ -218,6 +220,7 @@ export function registerDelegationTools(pi: ExtensionAPI, session: GrantsSession
|
|
|
218
220
|
definitionId: Type.Optional(
|
|
219
221
|
Type.String({ description: "Snapshot id returned by delegate_describe; required for Principal phases." }),
|
|
220
222
|
),
|
|
223
|
+
dashboardSummary: Type.Optional(Type.String({ maxLength: 160, description: dashboardSummaryDescription })),
|
|
221
224
|
task: Type.String({ description: "The task for the sub-agent. It receives only this." }),
|
|
222
225
|
agent: Type.Optional(Type.String({ description: describeAgent(spawnable()) })),
|
|
223
226
|
tools: Type.Optional(
|
|
@@ -272,6 +275,7 @@ export function registerDelegationTools(pi: ExtensionAPI, session: GrantsSession
|
|
|
272
275
|
operation_id: params.operation_id,
|
|
273
276
|
definitionId: params.definitionId,
|
|
274
277
|
task: params.task,
|
|
278
|
+
dashboardSummary: params.dashboardSummary,
|
|
275
279
|
agent: params.agent,
|
|
276
280
|
tools: params.tools,
|
|
277
281
|
model: params.model,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type ExtensionAPI,
|
|
8
8
|
type ExtensionContext,
|
|
9
9
|
} from "@earendil-works/pi-coding-agent";
|
|
10
|
-
import { join, resolve } from "node:path";
|
|
10
|
+
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
11
11
|
import { readBoundedTextSync } from "../src/kernel/bounded-read-sync.ts";
|
|
12
12
|
import { agentDir } from "../src/kernel/project-paths.ts";
|
|
13
13
|
import type { EcosystemPackageId, EcosystemVersionRow, EcosystemVersions } from "../src/products/ecosystem-versions.ts";
|
|
@@ -60,7 +60,7 @@ const defaultPorts = (ownRoot: string): VersionInventoryPorts => ({
|
|
|
60
60
|
});
|
|
61
61
|
/** Every package answers synchronously on Pi's native event bus; old packages stay explicitly unreported. */
|
|
62
62
|
export function createEcosystemVersionInventory(
|
|
63
|
-
pi: Pick<ExtensionAPI, "events"
|
|
63
|
+
pi: Pick<ExtensionAPI, "events"> & Partial<Pick<ExtensionAPI, "getCommands">>,
|
|
64
64
|
ownRoot: string,
|
|
65
65
|
ports = defaultPorts(ownRoot),
|
|
66
66
|
) {
|
|
@@ -78,7 +78,7 @@ export function createEcosystemVersionInventory(
|
|
|
78
78
|
if (
|
|
79
79
|
!["principal-pi-skills", "skill-harness", "pi-scout-research", "bookie-pi-skills"].includes(item.id) ||
|
|
80
80
|
typeof item.root !== "string" ||
|
|
81
|
-
!item.root
|
|
81
|
+
!isAbsolute(item.root)
|
|
82
82
|
)
|
|
83
83
|
return;
|
|
84
84
|
if (typeof item.version !== "string" || !versionPattern.test(item.version)) return;
|
|
@@ -115,6 +115,27 @@ export function createEcosystemVersionInventory(
|
|
|
115
115
|
sources.length > 1 ||
|
|
116
116
|
observedRoots.size > 1 ||
|
|
117
117
|
(loaded.length > 0 && sources.some((item) => !item.installedPath));
|
|
118
|
+
let bookieCommand = false;
|
|
119
|
+
if (pkg.id === "bookie-pi-skills" && root && !multiple) {
|
|
120
|
+
// A registered command proves the extension is loaded, even for older Bookie
|
|
121
|
+
// releases which did not announce a version. The current disk version cannot prove that.
|
|
122
|
+
try {
|
|
123
|
+
bookieCommand =
|
|
124
|
+
pi.getCommands?.().some((cmd) => {
|
|
125
|
+
if (
|
|
126
|
+
cmd.name !== "bookie-work" ||
|
|
127
|
+
cmd.source !== "extension" ||
|
|
128
|
+
!cmd.sourceInfo?.path ||
|
|
129
|
+
!isAbsolute(cmd.sourceInfo.path)
|
|
130
|
+
)
|
|
131
|
+
return false;
|
|
132
|
+
const child = relative(root, cmd.sourceInfo.path);
|
|
133
|
+
return !!child && !isAbsolute(child) && child !== ".." && !child.startsWith(".." + sep);
|
|
134
|
+
}) === true;
|
|
135
|
+
} catch {
|
|
136
|
+
/* Older Pi hosts may not expose a live command catalog. */
|
|
137
|
+
}
|
|
138
|
+
}
|
|
118
139
|
const commands =
|
|
119
140
|
pkg.id === "pi"
|
|
120
141
|
? ["pi update"]
|
|
@@ -144,6 +165,7 @@ export function createEcosystemVersionInventory(
|
|
|
144
165
|
? "not-reported"
|
|
145
166
|
: "unavailable",
|
|
146
167
|
commands,
|
|
168
|
+
...(bookieCommand ? { commandAvailable: true } : {}),
|
|
147
169
|
note: multiple
|
|
148
170
|
? "Multiple loaded or configured sources; inspect with pi list before changing versions."
|
|
149
171
|
: !loadedVersion
|
|
@@ -127,6 +127,7 @@ export interface ChildExecutionInput {
|
|
|
127
127
|
capacityReservation?: CapacityReservation;
|
|
128
128
|
plan: Delegation;
|
|
129
129
|
agent?: string;
|
|
130
|
+
dashboardSummary?: string;
|
|
130
131
|
childId: string;
|
|
131
132
|
executionId: string;
|
|
132
133
|
parentExecutionId: string | null;
|
|
@@ -264,6 +265,9 @@ async function executePreparedChild(
|
|
|
264
265
|
activityParent,
|
|
265
266
|
input.agent ?? "governed child",
|
|
266
267
|
(plan.args.at(-1) ?? "").trimStart(),
|
|
268
|
+
undefined,
|
|
269
|
+
undefined,
|
|
270
|
+
input.dashboardSummary,
|
|
267
271
|
);
|
|
268
272
|
activityStarted = true;
|
|
269
273
|
} catch {}
|
package/extensions/grants.ts
CHANGED
|
@@ -105,7 +105,9 @@ export default function (pi: ExtensionAPI, trustedSession?: GrantsSession) {
|
|
|
105
105
|
session.ensureDefinitions = () =>
|
|
106
106
|
(selectedReady ??= (async () => {
|
|
107
107
|
const lifecycle = session.reloadLifecycle;
|
|
108
|
-
|
|
108
|
+
const selected = pi.getCommands();
|
|
109
|
+
// The resource paths can stay unchanged while their bytes or companion bindings change.
|
|
110
|
+
await loadProjectDefinitions(session, session.cwd, lifecycle, selected);
|
|
109
111
|
assertDiscoveryHealthy(session, lifecycle);
|
|
110
112
|
delegation.refreshSpawnable();
|
|
111
113
|
if (selectedReportContext)
|
|
@@ -191,7 +193,11 @@ export default function (pi: ExtensionAPI, trustedSession?: GrantsSession) {
|
|
|
191
193
|
// delegate by `tools:`, and an operator whose `agent:` spawns have all started failing deserves to
|
|
192
194
|
// know it was the *scan* that broke rather than the grant.
|
|
193
195
|
try {
|
|
194
|
-
|
|
196
|
+
// Pi exposes installed selections at open. Later contributors arrive by the first
|
|
197
|
+
// request, when ensureDefinitions binds the complete snapshot before any dispatch.
|
|
198
|
+
const preview = ctx.mode === "tui" && session.depth === 0 && !session.ownExecutionId && session.governed;
|
|
199
|
+
const initialCommands = session.ensureDefinitions ? (preview ? pi.getCommands() : []) : undefined;
|
|
200
|
+
await loadProjectDefinitions(session, ctx.cwd, reload.lifecycle, initialCommands);
|
|
195
201
|
} catch (error) {
|
|
196
202
|
if (session.reloadLifecycle !== reload.lifecycle) return undefined;
|
|
197
203
|
if (error instanceof BoundedReadCleanupError) {
|
|
@@ -275,8 +281,8 @@ export default function (pi: ExtensionAPI, trustedSession?: GrantsSession) {
|
|
|
275
281
|
);
|
|
276
282
|
}
|
|
277
283
|
if (session.reloadLifecycle !== reload.lifecycle) return undefined;
|
|
278
|
-
//
|
|
279
|
-
|
|
284
|
+
// Only a parent opens the dashboard. View-only children inherit the parent's controls.
|
|
285
|
+
if (session.depth !== 0 || session.ownExecutionId || session.malformedBounds.length) return undefined;
|
|
280
286
|
try {
|
|
281
287
|
const sessionEndpoint = await ensureDashboardSessionServer(session);
|
|
282
288
|
if (session.reloadLifecycle !== reload.lifecycle) return undefined;
|
|
@@ -54,6 +54,7 @@ export interface ChildSpec {
|
|
|
54
54
|
operation_id?: string;
|
|
55
55
|
definitionId?: string;
|
|
56
56
|
task: string;
|
|
57
|
+
dashboardSummary?: string;
|
|
57
58
|
agent?: string;
|
|
58
59
|
tools?: string[];
|
|
59
60
|
model?: string;
|
|
@@ -529,6 +530,7 @@ async function runOneDelegationImplementation(
|
|
|
529
530
|
session,
|
|
530
531
|
plan,
|
|
531
532
|
agent: spec.agent,
|
|
533
|
+
dashboardSummary: spec.dashboardSummary,
|
|
532
534
|
childId: ids.childId,
|
|
533
535
|
executionId: ids.executionId,
|
|
534
536
|
parentExecutionId: ids.parentExecutionId,
|
|
@@ -268,7 +268,7 @@ export function registerRuntimeSnapshot(
|
|
|
268
268
|
}
|
|
269
269
|
if (sequence !== bindSequence || session.reloadLifecycle !== lifecycle) return;
|
|
270
270
|
lifecycle.runtimeSettlement = runtime;
|
|
271
|
-
bindOperationFinals(session, sessionId, cwd, (reference) => {
|
|
271
|
+
bindOperationFinals(session, sessionId, cwd, (reference, description) => {
|
|
272
272
|
if (
|
|
273
273
|
bound?.sessionId === sessionId &&
|
|
274
274
|
bound.cwd === cwd &&
|
|
@@ -279,11 +279,15 @@ export function registerRuntimeSnapshot(
|
|
|
279
279
|
session.dashboardArtifacts ??= [];
|
|
280
280
|
if (
|
|
281
281
|
!session.dashboardArtifacts.some(
|
|
282
|
-
(item) =>
|
|
283
|
-
item.executionId === reference.executionId && item.manifest.sha256 === reference.manifest.sha256,
|
|
282
|
+
(item) => item.executionId === reference.executionId && item.sha256 === reference.manifest.sha256,
|
|
284
283
|
)
|
|
285
284
|
)
|
|
286
|
-
session.dashboardArtifacts.push(
|
|
285
|
+
session.dashboardArtifacts.push({
|
|
286
|
+
operationId: reference.operationId,
|
|
287
|
+
executionId: reference.executionId,
|
|
288
|
+
sha256: reference.manifest.sha256,
|
|
289
|
+
...(description ? { description } : {}),
|
|
290
|
+
});
|
|
287
291
|
if (session.dashboardArtifacts.length > 16) session.dashboardArtifacts.shift();
|
|
288
292
|
try {
|
|
289
293
|
pi.appendEntry?.("pi-daddy:operation-artifact:v1", reference);
|
|
@@ -253,6 +253,10 @@ export async function reportSessionStart(session: GrantsSession, ctx: SessionRep
|
|
|
253
253
|
// Warnings and errors are NOT folded in — they go to different components (`showError`), survive on their
|
|
254
254
|
// own, and each says something an operator may need to act on separately.
|
|
255
255
|
const info: string[] = [];
|
|
256
|
+
if (session.depth === 0 && session.governed && session.grantSource === "default" && !session.malformedBounds.length)
|
|
257
|
+
info.push("Pi Daddy started with session permissions. Use /grants to inspect access.");
|
|
258
|
+
if (session.depth === 0 && session.governed && session.grantSource === "stored")
|
|
259
|
+
info.push("Pi Daddy restored this project's saved permissions.");
|
|
256
260
|
|
|
257
261
|
if (session.mayDelegate && !session.executor.refusal) {
|
|
258
262
|
info.push(`grants: executor — ${session.executor.disclosure}`);
|