pi-daddy 0.43.0 → 0.44.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 +104 -33
- package/README.md +27 -5
- package/THIRD_PARTY_LICENSES/musl-COPYRIGHT.txt +193 -0
- package/THIRD_PARTY_LICENSES/zig-MIT.txt +21 -0
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/contracts/ledger-record/v1/README.md +40 -25
- package/dist/cli.d.ts +2 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +10 -5
- package/dist/cli.js.map +1 -1
- package/dist/executors/activity-session.js +116 -65
- package/dist/executors/activity-session.js.map +1 -1
- package/dist/executors/captured-execution.d.ts +13 -0
- package/dist/executors/captured-execution.d.ts.map +1 -0
- package/dist/executors/captured-execution.js +53 -0
- package/dist/executors/captured-execution.js.map +1 -0
- package/dist/executors/child-final.d.ts +31 -0
- package/dist/executors/child-final.d.ts.map +1 -0
- package/dist/executors/child-final.js +197 -0
- package/dist/executors/child-final.js.map +1 -0
- package/dist/executors/executor.d.ts +2 -1
- package/dist/executors/executor.d.ts.map +1 -1
- package/dist/executors/executor.js +12 -0
- package/dist/executors/executor.js.map +1 -1
- package/dist/executors/owned-worker.d.ts +18 -0
- package/dist/executors/owned-worker.d.ts.map +1 -0
- package/dist/executors/owned-worker.js +295 -0
- package/dist/executors/owned-worker.js.map +1 -0
- package/dist/executors/worker-artifact.d.ts +3 -0
- package/dist/executors/worker-artifact.d.ts.map +1 -0
- package/dist/executors/worker-artifact.js +3 -0
- package/dist/executors/worker-artifact.js.map +1 -0
- package/dist/governance/approval-prompt.d.ts +4 -3
- package/dist/governance/approval-prompt.d.ts.map +1 -1
- package/dist/governance/approval-prompt.js +13 -6
- package/dist/governance/approval-prompt.js.map +1 -1
- package/dist/governance/captured-worker-record.d.ts +9 -0
- package/dist/governance/captured-worker-record.d.ts.map +1 -0
- package/dist/governance/captured-worker-record.js +123 -0
- package/dist/governance/captured-worker-record.js.map +1 -0
- package/dist/governance/lease-record.d.ts +4 -0
- package/dist/governance/lease-record.d.ts.map +1 -1
- package/dist/governance/lease-record.js +19 -2
- package/dist/governance/lease-record.js.map +1 -1
- package/dist/governance/ledger-events.d.ts +5 -5
- package/dist/governance/ledger-events.d.ts.map +1 -1
- package/dist/governance/ledger-v3-validation.js +1 -1
- package/dist/governance/ledger-v3-validation.js.map +1 -1
- package/dist/governance/workspace-acceptance.d.ts +3 -1
- package/dist/governance/workspace-acceptance.d.ts.map +1 -1
- package/dist/governance/workspace-acceptance.js +21 -5
- package/dist/governance/workspace-acceptance.js.map +1 -1
- package/dist/governance/workspace-lease.d.ts.map +1 -1
- package/dist/governance/workspace-lease.js +44 -1
- package/dist/governance/workspace-lease.js.map +1 -1
- package/dist/kernel/authority-text.d.ts +3 -0
- package/dist/kernel/authority-text.d.ts.map +1 -0
- package/dist/kernel/authority-text.js +22 -0
- package/dist/kernel/authority-text.js.map +1 -0
- package/dist/kernel/bounded-read-failures.d.ts +9 -0
- package/dist/kernel/bounded-read-failures.d.ts.map +1 -0
- package/dist/kernel/bounded-read-failures.js +33 -0
- package/dist/kernel/bounded-read-failures.js.map +1 -0
- package/dist/kernel/bounded-read-sync.d.ts +24 -0
- package/dist/kernel/bounded-read-sync.d.ts.map +1 -0
- package/dist/kernel/bounded-read-sync.js +75 -0
- package/dist/kernel/bounded-read-sync.js.map +1 -0
- package/dist/kernel/bounded-read.d.ts +29 -2
- package/dist/kernel/bounded-read.d.ts.map +1 -1
- package/dist/kernel/bounded-read.js +98 -9
- package/dist/kernel/bounded-read.js.map +1 -1
- package/dist/kernel/capacity.d.ts +36 -0
- package/dist/kernel/capacity.d.ts.map +1 -0
- package/dist/kernel/capacity.js +94 -0
- package/dist/kernel/capacity.js.map +1 -0
- package/dist/kernel/captured-worker-contract.d.ts +38 -0
- package/dist/kernel/captured-worker-contract.d.ts.map +1 -0
- package/dist/kernel/captured-worker-contract.js +2 -0
- package/dist/kernel/captured-worker-contract.js.map +1 -0
- package/dist/kernel/catalog.d.ts +12 -3
- package/dist/kernel/catalog.d.ts.map +1 -1
- package/dist/kernel/catalog.js +28 -8
- package/dist/kernel/catalog.js.map +1 -1
- 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/definitions.d.ts +11 -1
- package/dist/kernel/definitions.d.ts.map +1 -1
- package/dist/kernel/definitions.js +6 -3
- package/dist/kernel/definitions.js.map +1 -1
- package/dist/kernel/fanout.d.ts +5 -25
- package/dist/kernel/fanout.d.ts.map +1 -1
- package/dist/kernel/fanout.js +15 -30
- package/dist/kernel/fanout.js.map +1 -1
- package/dist/kernel/grant-env.d.ts +0 -2
- package/dist/kernel/grant-env.d.ts.map +1 -1
- package/dist/kernel/grant-env.js +0 -1
- package/dist/kernel/grant-env.js.map +1 -1
- package/dist/kernel/model-preflight.d.ts +8 -0
- package/dist/kernel/model-preflight.d.ts.map +1 -1
- package/dist/kernel/model-preflight.js +23 -0
- package/dist/kernel/model-preflight.js.map +1 -1
- package/dist/kernel/selected-definitions.d.ts +15 -0
- package/dist/kernel/selected-definitions.d.ts.map +1 -0
- package/dist/kernel/selected-definitions.js +146 -0
- package/dist/kernel/selected-definitions.js.map +1 -0
- package/dist/kernel/skill-packages.d.ts +4 -2
- package/dist/kernel/skill-packages.d.ts.map +1 -1
- package/dist/kernel/skill-packages.js +34 -41
- package/dist/kernel/skill-packages.js.map +1 -1
- package/dist/kernel/skill-resources.d.ts.map +1 -1
- package/dist/kernel/skill-resources.js +8 -11
- package/dist/kernel/skill-resources.js.map +1 -1
- package/dist/kernel/workspace.d.ts +6 -3
- package/dist/kernel/workspace.d.ts.map +1 -1
- package/dist/kernel/workspace.js +10 -6
- package/dist/kernel/workspace.js.map +1 -1
- package/dist/products/dashboard-cli.js +1 -1
- package/dist/products/dashboard-cli.js.map +1 -1
- package/dist/products/dashboard-render.d.ts +1 -2
- package/dist/products/dashboard-render.d.ts.map +1 -1
- package/dist/products/dashboard-render.js +3 -1
- package/dist/products/dashboard-render.js.map +1 -1
- package/dist/products/dashboard-session-client.d.ts +1 -2
- package/dist/products/dashboard-session-client.d.ts.map +1 -1
- package/dist/products/dashboard-session-client.js.map +1 -1
- package/dist/products/episode-report.d.ts +12 -8
- package/dist/products/episode-report.d.ts.map +1 -1
- package/dist/products/episode-report.js +61 -12
- package/dist/products/episode-report.js.map +1 -1
- package/extensions/approvals.ts +1 -1
- package/extensions/chain-plan.ts +9 -3
- package/extensions/context-staging.ts +30 -35
- package/extensions/dashboard-session-server.ts +1 -2
- package/extensions/definition-describe.ts +44 -0
- package/extensions/definition-runtime.ts +89 -26
- package/extensions/delegate-chain.ts +273 -256
- package/extensions/delegation-activation.ts +1 -1
- package/extensions/delegation.ts +41 -53
- package/extensions/execute-child.ts +167 -134
- package/extensions/fanout-outcome.ts +1 -9
- package/extensions/grants-command.ts +2 -9
- package/extensions/grants.ts +106 -38
- package/extensions/init-command.ts +52 -12
- package/extensions/reload-environment.ts +21 -2
- package/extensions/retired-inputs.ts +7 -0
- package/extensions/run-delegation.ts +212 -265
- package/extensions/session-capacity.ts +53 -0
- package/extensions/session-environment.ts +5 -2
- package/extensions/session-model-prompt.ts +33 -32
- package/extensions/session-report.ts +28 -11
- package/extensions/session.ts +200 -157
- package/extensions/workspace-runtime.ts +2 -1
- package/native/README.md +25 -0
- package/native/linux-x64/worker +0 -0
- package/native/linux-x64/worker.sha256 +1 -0
- package/native/provenance.json +42 -0
- package/native/toolchain.json +18 -0
- package/native/worker.c +209 -0
- package/package.json +15 -7
- package/src/cli.ts +16 -6
- package/src/executors/activity-session.ts +120 -66
- package/src/executors/captured-execution.ts +61 -0
- package/src/executors/child-final.ts +190 -0
- package/src/executors/executor.ts +14 -1
- package/src/executors/owned-worker.ts +322 -0
- package/src/executors/worker-artifact.ts +2 -0
- package/src/governance/approval-prompt.ts +18 -8
- package/src/governance/captured-worker-record.ts +138 -0
- package/src/governance/lease-record.ts +21 -2
- package/src/governance/ledger-events.ts +5 -5
- package/src/governance/ledger-v3-validation.ts +1 -1
- package/src/governance/workspace-acceptance.ts +20 -4
- package/src/governance/workspace-lease.ts +59 -1
- package/src/kernel/authority-text.ts +17 -0
- package/src/kernel/bounded-read-failures.ts +42 -0
- package/src/kernel/bounded-read-sync.ts +87 -0
- package/src/kernel/bounded-read.ts +128 -11
- package/src/kernel/capacity.ts +123 -0
- package/src/kernel/captured-worker-contract.ts +29 -0
- package/src/kernel/catalog.ts +45 -16
- package/src/kernel/chain.ts +1 -0
- package/src/kernel/definitions.ts +11 -2
- package/src/kernel/fanout.ts +17 -32
- package/src/kernel/grant-env.ts +0 -3
- package/src/kernel/model-preflight.ts +29 -0
- package/src/kernel/selected-definitions.ts +156 -0
- package/src/kernel/skill-packages.ts +40 -38
- package/src/kernel/skill-resources.ts +8 -9
- package/src/kernel/workspace.ts +12 -5
- package/src/products/dashboard-cli.ts +1 -1
- package/src/products/dashboard-render.ts +6 -2
- package/src/products/dashboard-session-client.ts +1 -2
- package/src/products/episode-report.ts +80 -17
- package/dist/advisors/advisor.d.ts +0 -90
- package/dist/advisors/advisor.d.ts.map +0 -1
- package/dist/advisors/advisor.js +0 -154
- package/dist/advisors/advisor.js.map +0 -1
- package/dist/advisors/decider.d.ts +0 -88
- package/dist/advisors/decider.d.ts.map +0 -1
- package/dist/advisors/decider.js +0 -29
- package/dist/advisors/decider.js.map +0 -1
- package/dist/advisors/jev.d.ts +0 -41
- package/dist/advisors/jev.d.ts.map +0 -1
- package/dist/advisors/jev.js +0 -139
- package/dist/advisors/jev.js.map +0 -1
- package/dist/advisors/settings.d.ts +0 -49
- package/dist/advisors/settings.d.ts.map +0 -1
- package/dist/advisors/settings.js +0 -99
- package/dist/advisors/settings.js.map +0 -1
- package/dist/governance/episode-cost-gate.d.ts +0 -31
- package/dist/governance/episode-cost-gate.d.ts.map +0 -1
- package/dist/governance/episode-cost-gate.js +0 -112
- package/dist/governance/episode-cost-gate.js.map +0 -1
- package/extensions/advisor-session.ts +0 -67
- package/extensions/effort-advice.ts +0 -112
- package/extensions/pruning-advice.ts +0 -133
- package/src/advisors/advisor.ts +0 -246
- package/src/advisors/decider.ts +0 -74
- package/src/advisors/jev.ts +0 -163
- package/src/advisors/settings.ts +0 -115
- package/src/governance/episode-cost-gate.ts +0 -128
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BoundedReadCleanupError, readBoundedFile } from "../src/kernel/bounded-read.ts";
|
|
2
2
|
import { appendLedgerEvent, buildSessionConfigEvent } from "../src/governance/ledger.ts";
|
|
3
3
|
import { readRecords } from "../src/governance/record.ts";
|
|
4
4
|
import {
|
|
@@ -16,9 +16,6 @@ export interface SessionModelPromptState {
|
|
|
16
16
|
definitions: Map<string, { name: string }>;
|
|
17
17
|
definitionRuntimeSettings: DefinitionRuntimeSettings;
|
|
18
18
|
definitionRuntimeOverrides: Map<string, DefinitionRuntimeChoice>;
|
|
19
|
-
sessionModelPrompt: "ask" | "never";
|
|
20
|
-
sessionModelPrompted: boolean;
|
|
21
|
-
sessionModelPromptInFlight?: Promise<void>;
|
|
22
19
|
}
|
|
23
20
|
export interface SessionModelPromptUI {
|
|
24
21
|
hasUI: boolean;
|
|
@@ -26,19 +23,27 @@ export interface SessionModelPromptUI {
|
|
|
26
23
|
notify(message: string, type?: "info" | "warning" | "error"): void;
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
/** Trusted composition only; no requester or environment can supply these lifecycle/I/O ports. */
|
|
27
|
+
export interface ManualModelControl {
|
|
28
|
+
read?: typeof readBoundedFile;
|
|
29
|
+
assertHealthy?: () => void;
|
|
30
|
+
onReadCleanup?: (error: BoundedReadCleanupError) => void;
|
|
31
|
+
}
|
|
32
|
+
async function historicalDefinitions(path: string | undefined, read = readBoundedFile): Promise<string[]> {
|
|
30
33
|
if (!path) return [];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
.filter((body) => body.event === "capability_decision" && typeof body.agentType === "string")
|
|
36
|
-
.map((body) => body.agentType as string)
|
|
37
|
-
.filter((name) => name !== "delegate");
|
|
38
|
-
} catch (error) {
|
|
39
|
-
if ((error as NodeJS.ErrnoException).code === "ENOENT") return [];
|
|
40
|
-
throw error;
|
|
34
|
+
const result = await read(path, { maxBytes: 64 * 1024 * 1024, timeoutMs: 3000 });
|
|
35
|
+
if (!result.ok) {
|
|
36
|
+
if ("code" in result && result.code === "ENOENT") return [];
|
|
37
|
+
throw new Error(`manual model history unavailable: ${result.detail}`);
|
|
41
38
|
}
|
|
39
|
+
const parsed = readRecords(result.text);
|
|
40
|
+
if (parsed.damage)
|
|
41
|
+
throw new Error(`manual model history damaged at line ${parsed.damage.line}: ${parsed.damage.reason}`);
|
|
42
|
+
return parsed.records
|
|
43
|
+
.map((record) => record.body as { event?: unknown; agentType?: unknown })
|
|
44
|
+
.filter((body) => body.event === "capability_decision" && typeof body.agentType === "string")
|
|
45
|
+
.map((body) => body.agentType as string)
|
|
46
|
+
.filter((name) => name !== "delegate");
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
export function sessionModelRows(state: SessionModelPromptState, names: readonly string[]) {
|
|
@@ -115,9 +120,11 @@ async function choose(
|
|
|
115
120
|
current: readonly string[],
|
|
116
121
|
ui: SessionModelPromptUI,
|
|
117
122
|
trigger: "first-delegation" | "grants-models",
|
|
123
|
+
control: ManualModelControl,
|
|
118
124
|
): Promise<void> {
|
|
119
|
-
const names = [...new Set([...(await historicalDefinitions(state.ledgerPath)), ...current])].sort();
|
|
120
|
-
|
|
125
|
+
const names = [...new Set([...(await historicalDefinitions(state.ledgerPath, control.read)), ...current])].sort();
|
|
126
|
+
control.assertHealthy?.();
|
|
127
|
+
if (!ui.hasUI) {
|
|
121
128
|
await record(state, "kept", trigger);
|
|
122
129
|
return;
|
|
123
130
|
}
|
|
@@ -126,6 +133,7 @@ async function choose(
|
|
|
126
133
|
`Child model defaults\n\n${table(state, names)}\n\nPress Enter to keep, or enter edits one per line.`,
|
|
127
134
|
"<definition> <provider:model> <thinking> | all <provider:model> <thinking>",
|
|
128
135
|
);
|
|
136
|
+
control.assertHealthy?.();
|
|
129
137
|
if (answer === undefined) throw new Error("session model selection was dismissed; no child was spawned");
|
|
130
138
|
if (!answer.trim()) {
|
|
131
139
|
await record(state, "kept", trigger);
|
|
@@ -152,28 +160,21 @@ export async function saveSessionModelEdits(
|
|
|
152
160
|
return null;
|
|
153
161
|
}
|
|
154
162
|
|
|
155
|
-
export async function
|
|
163
|
+
export async function changeSessionModels(
|
|
156
164
|
state: SessionModelPromptState,
|
|
157
|
-
current: readonly string[],
|
|
158
165
|
ui: SessionModelPromptUI,
|
|
166
|
+
control: ManualModelControl = {},
|
|
159
167
|
): Promise<void> {
|
|
160
|
-
if (state.sessionModelPrompted) return;
|
|
161
|
-
if (!state.sessionModelPromptInFlight) {
|
|
162
|
-
state.sessionModelPromptInFlight = choose(state, current, ui, "first-delegation").then(() => {
|
|
163
|
-
state.sessionModelPrompted = true;
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
168
|
try {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
control.assertHealthy?.();
|
|
170
|
+
await choose(state, [...state.definitions.keys()], ui, "grants-models", control);
|
|
171
|
+
control.assertHealthy?.();
|
|
172
|
+
} catch (error) {
|
|
173
|
+
if (error instanceof BoundedReadCleanupError) control.onReadCleanup?.(error);
|
|
174
|
+
throw error;
|
|
170
175
|
}
|
|
171
176
|
}
|
|
172
177
|
|
|
173
|
-
export async function changeSessionModels(state: SessionModelPromptState, ui: SessionModelPromptUI): Promise<void> {
|
|
174
|
-
await choose(state, [...state.definitions.keys()], ui, "grants-models");
|
|
175
|
-
}
|
|
176
|
-
|
|
177
178
|
export function renderSessionModels(state: SessionModelPromptState): string {
|
|
178
179
|
return table(state, [...state.definitions.keys()].sort());
|
|
179
180
|
}
|
|
@@ -47,6 +47,7 @@ export interface SessionReportContext {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export async function reportSessionStart(session: GrantsSession, ctx: SessionReportContext): Promise<void> {
|
|
50
|
+
if (session.capacityRefusal) ctx.ui.notify(`grants: ${session.capacityRefusal.message}`, "warning");
|
|
50
51
|
// A malformed bound is now loud as well as safe. Silently disabling spawning would be just as
|
|
51
52
|
// confusing as silently disabling the limit was dangerous — the operator set the variable, so
|
|
52
53
|
// they need to know it did not take effect (G7 / A-S4).
|
|
@@ -277,17 +278,7 @@ export async function reportSessionStart(session: GrantsSession, ctx: SessionRep
|
|
|
277
278
|
// exactly — one added `await` inside the blanket catch cancelling every control below it in
|
|
278
279
|
// silence.
|
|
279
280
|
try {
|
|
280
|
-
const line =
|
|
281
|
-
await summariseSpawnable(
|
|
282
|
-
session.definitions,
|
|
283
|
-
(name) => planWithApprovals(session, { task: "(preview)", agent: name }, {}, null),
|
|
284
|
-
// The session facts that make every per-definition verdict identical. `mayDelegate` in
|
|
285
|
-
// particular: without `tool:delegate` there is no delegate tool at all, and the line used to
|
|
286
|
-
// report definitions as spawnable in the one session where nothing can ever be spawned.
|
|
287
|
-
{ mayDelegate: session.mayDelegate, depth: session.depth, maxDepth: session.maxDepth },
|
|
288
|
-
),
|
|
289
|
-
session.definitions.size,
|
|
290
|
-
);
|
|
281
|
+
const line = await selectedDefinitionsSummary(session);
|
|
291
282
|
if (line) info.push(line);
|
|
292
283
|
} catch (error) {
|
|
293
284
|
ctx.ui.notify(
|
|
@@ -303,3 +294,29 @@ export async function reportSessionStart(session: GrantsSession, ctx: SessionRep
|
|
|
303
294
|
// multi-line status screen has always survived while these separate lines did not.
|
|
304
295
|
if (info.length > 0) ctx.ui.notify(info.join("\n"), "info");
|
|
305
296
|
}
|
|
297
|
+
|
|
298
|
+
/** Public selected resources become available after session start; report their frozen snapshot then. */
|
|
299
|
+
export async function reportSelectedDefinitions(session: GrantsSession, ctx: SessionReportContext): Promise<void> {
|
|
300
|
+
for (const reason of session.definitionSkips)
|
|
301
|
+
ctx.ui.notify(`grants: a definition was not loaded — ${reason}`, "warning");
|
|
302
|
+
if (!session.governed) return;
|
|
303
|
+
try {
|
|
304
|
+
const line = await selectedDefinitionsSummary(session);
|
|
305
|
+
if (line) ctx.ui.notify(line, "info");
|
|
306
|
+
} catch (error) {
|
|
307
|
+
ctx.ui.notify(
|
|
308
|
+
`grants: selected definitions could not be summarized (${String(error)}) — run /grants for detail.`,
|
|
309
|
+
"warning",
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
function selectedDefinitionsSummary(session: GrantsSession): Promise<string | null> {
|
|
314
|
+
return summariseSpawnable(
|
|
315
|
+
session.definitions,
|
|
316
|
+
(name) => planWithApprovals(session, { task: "(preview)", agent: name }, {}, null),
|
|
317
|
+
// The session facts that make every per-definition verdict identical. `mayDelegate` in
|
|
318
|
+
// particular: without `tool:delegate` there is no delegate tool at all, and the line used to
|
|
319
|
+
// report definitions as spawnable in the one session where nothing can ever be spawned.
|
|
320
|
+
{ mayDelegate: session.mayDelegate, depth: session.depth, maxDepth: session.maxDepth },
|
|
321
|
+
).then((summary) => renderSpawnableSummary(summary, session.definitions.size));
|
|
322
|
+
}
|