@ashx-j/lunr-dev 0.2.40-dev.54.2 → 0.2.40-dev.58.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/dist/builtin-extensions/pi-subagents/src/runs/background/attempt-usage.d.ts +5 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/attempt-usage.js +31 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/child-stream.d.ts +65 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/child-stream.js +456 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/parallel-group-status.d.ts +42 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/parallel-group-status.js +79 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-log.d.ts +18 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/run-log.js +43 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/runner-event-log.d.ts +3 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/runner-event-log.js +70 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/runner-single-step.d.ts +92 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/runner-single-step.js +491 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/runner-status.d.ts +64 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/runner-status.js +26 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts +1 -115
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +17 -1160
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/async-run-control.d.ts +19 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/async-run-control.js +331 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution-input.d.ts +37 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution-input.js +321 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/executor-types.d.ts +124 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/executor-types.js +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/foreground-notifications.d.ts +17 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/foreground-notifications.js +98 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/foreground-run-registry.d.ts +40 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/foreground-run-registry.js +172 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/fork-policy.d.ts +14 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/fork-policy.js +161 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/nested-run-control.d.ts +46 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/nested-run-control.js +195 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/parallel-run.d.ts +10 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/parallel-run.js +537 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts +5 -81
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +26 -1763
- package/dist/builtin-extensions/pi-subagents/src/shared/settings.d.ts +1 -1
- package/dist/core/credential-files.d.ts +3 -2
- package/dist/core/credential-files.js +10 -4
- package/dist/core/permissions.d.ts +6 -0
- package/dist/core/permissions.js +6 -0
- package/dist/core/tool-call-hooks.js +3 -2
- package/dist/node-runtime/{acp-mode-CFYSYACH.js → acp-mode-5KZPFZBO.js} +2 -2
- package/dist/node-runtime/{agent-session-services-3ZHQJIKF.js → agent-session-services-KH5CIGC3.js} +5 -5
- package/dist/node-runtime/{builtin-extensions-VQHK3YKF.js → builtin-extensions-RZS4SMIS.js} +3 -3
- package/dist/node-runtime/{chunk-UZMXBZQT.js → chunk-AKQRASEH.js} +9 -9
- package/dist/node-runtime/{chunk-4ZEDT3YW.js → chunk-BJXBM6KD.js} +3 -3
- package/dist/node-runtime/{chunk-BNNBTBXY.js → chunk-EJMB4PAV.js} +3 -3
- package/dist/node-runtime/{chunk-HVXDYQNN.js → chunk-JI7AUY2T.js} +1 -1
- package/dist/node-runtime/{chunk-ITVBE3HR.js → chunk-JJTHGEUS.js} +5 -4
- package/dist/node-runtime/{chunk-YDY7A2WB.js → chunk-K24P7GMM.js} +7 -7
- package/dist/node-runtime/{chunk-KTCZH72R.js → chunk-LGRRFSE7.js} +3 -2
- package/dist/node-runtime/{chunk-7LCR56AK.js → chunk-NWYFKXP5.js} +1 -1
- package/dist/node-runtime/{chunk-SV42POA3.js → chunk-PGWSMQ4K.js} +1 -1
- package/dist/node-runtime/{chunk-YDMZHLBV.js → chunk-QX5I7QEW.js} +1 -1
- package/dist/node-runtime/{chunk-BNZXW77G.js → chunk-RXDLSXEC.js} +1 -1
- package/dist/node-runtime/{chunk-N574FRFF.js → chunk-TSZESZ6H.js} +2 -2
- package/dist/node-runtime/{chunk-VIYDTWDK.js → chunk-U7MTVVT3.js} +606 -604
- package/dist/node-runtime/{chunk-MFDTF25H.js → chunk-UTZCCNFC.js} +5 -5
- package/dist/node-runtime/{chunk-U2LTTIWZ.js → chunk-WYJUGRVE.js} +1 -1
- package/dist/node-runtime/{chunk-7LNPTBQJ.js → chunk-XPKOWSYN.js} +6 -2
- package/dist/node-runtime/{chunk-2ZI6Q6JG.js → chunk-YFXGOLZ6.js} +1 -1
- package/dist/node-runtime/{command-SRDEBPUR.js → command-6S6C62CX.js} +1 -1
- package/dist/node-runtime/{commands-7EETGZ7V.js → commands-GSZWAQJW.js} +5 -5
- package/dist/node-runtime/{commands-CV2JUYHM.js → commands-MM2TPV5I.js} +4 -4
- package/dist/node-runtime/{direct-tool-executor-DNZ2MS6Z.js → direct-tool-executor-WJLVHH7U.js} +6 -6
- package/dist/node-runtime/{gateway-AMEMDTUT.js → gateway-CWIWPUVC.js} +6 -6
- package/dist/node-runtime/index.js +10 -10
- package/dist/node-runtime/{init-G23PFPKF.js → init-P3RQ6EFK.js} +5 -5
- package/dist/node-runtime/{interactive-mode-7GX3UJFX.js → interactive-mode-2L5JMVKQ.js} +6 -6
- package/dist/node-runtime/{lunr-cron-OMQBN3UK.js → lunr-cron-LT3O64NO.js} +4 -4
- package/dist/node-runtime/main.js +7 -7
- package/dist/node-runtime/{mobile-commands-JQJU35OT.js → mobile-commands-PFXEWP2R.js} +3 -3
- package/dist/node-runtime/{pi-mcp-adapter-NKAL5CFR.js → pi-mcp-adapter-2OP5BBC6.js} +8 -8
- package/dist/node-runtime/{pi-subagents-36KOL5SV.js → pi-subagents-G2T5XRAX.js} +6 -6
- package/dist/node-runtime/{print-mode-Y363FXY4.js → print-mode-S6ZUVPMU.js} +6 -6
- package/dist/node-runtime/{proxy-modes-EEYRUGQL.js → proxy-modes-RD2PQ6UH.js} +6 -6
- package/dist/node-runtime/rpc-entry.js +7 -7
- package/dist/node-runtime/{rpc-mode-ENVT7AXW.js → rpc-mode-C33WERBG.js} +3 -3
- package/dist/node-runtime/{src-Y3S2FIS5.js → src-J6FSKIFT.js} +1 -1
- package/dist/node-runtime/{subagent-executor-D42G55F5.js → subagent-executor-RTGKJ35C.js} +1924 -1901
- package/install-lock/package-lock.json +24 -24
- package/install-lock/package.json +2 -2
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SubagentRunMode } from "../../shared/types.ts";
|
|
2
|
+
export declare function writeRunLog(logPath: string, input: {
|
|
3
|
+
id: string;
|
|
4
|
+
mode: SubagentRunMode;
|
|
5
|
+
cwd: string;
|
|
6
|
+
startedAt: number;
|
|
7
|
+
endedAt: number;
|
|
8
|
+
steps: Array<{
|
|
9
|
+
agent: string;
|
|
10
|
+
status: string;
|
|
11
|
+
durationMs?: number;
|
|
12
|
+
}>;
|
|
13
|
+
summary: string;
|
|
14
|
+
truncated: boolean;
|
|
15
|
+
artifactsDir?: string;
|
|
16
|
+
sessionFile?: string;
|
|
17
|
+
}): void;
|
|
18
|
+
//# sourceMappingURL=run-log.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// The markdown run log an async run writes when it finishes.
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
function formatDuration(ms) {
|
|
4
|
+
if (ms < 1000)
|
|
5
|
+
return `${ms}ms`;
|
|
6
|
+
if (ms < 60000)
|
|
7
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
8
|
+
const minutes = Math.floor(ms / 60000);
|
|
9
|
+
const seconds = Math.floor((ms % 60000) / 1000);
|
|
10
|
+
return `${minutes}m${seconds}s`;
|
|
11
|
+
}
|
|
12
|
+
export function writeRunLog(logPath, input) {
|
|
13
|
+
const lines = [];
|
|
14
|
+
lines.push(`# Subagent run ${input.id}`);
|
|
15
|
+
lines.push("");
|
|
16
|
+
lines.push(`- **Mode:** ${input.mode}`);
|
|
17
|
+
lines.push(`- **CWD:** ${input.cwd}`);
|
|
18
|
+
lines.push(`- **Started:** ${new Date(input.startedAt).toISOString()}`);
|
|
19
|
+
lines.push(`- **Ended:** ${new Date(input.endedAt).toISOString()}`);
|
|
20
|
+
lines.push(`- **Duration:** ${formatDuration(input.endedAt - input.startedAt)}`);
|
|
21
|
+
if (input.sessionFile)
|
|
22
|
+
lines.push(`- **Session:** ${input.sessionFile}`);
|
|
23
|
+
if (input.artifactsDir)
|
|
24
|
+
lines.push(`- **Artifacts:** ${input.artifactsDir}`);
|
|
25
|
+
lines.push("");
|
|
26
|
+
lines.push("## Steps");
|
|
27
|
+
lines.push("| Step | Agent | Status | Duration |");
|
|
28
|
+
lines.push("| --- | --- | --- | --- |");
|
|
29
|
+
input.steps.forEach((step, i) => {
|
|
30
|
+
const duration = step.durationMs !== undefined ? formatDuration(step.durationMs) : "-";
|
|
31
|
+
lines.push(`| ${i + 1} | ${step.agent} | ${step.status} | ${duration} |`);
|
|
32
|
+
});
|
|
33
|
+
lines.push("");
|
|
34
|
+
lines.push("## Summary");
|
|
35
|
+
if (input.truncated) {
|
|
36
|
+
lines.push("_Output truncated_");
|
|
37
|
+
lines.push("");
|
|
38
|
+
}
|
|
39
|
+
lines.push(input.summary.trim() || "(no output)");
|
|
40
|
+
lines.push("");
|
|
41
|
+
fs.writeFileSync(logPath, lines.join("\n"), "utf-8");
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=run-log.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// The async run's events.jsonl writer, with the byte cap that stops diagnostic events and leaves one truncation marker.
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import { appendJsonl as appendRawJsonl } from "../../shared/artifacts.js";
|
|
4
|
+
const DEFAULT_MAX_ASYNC_EVENTS_BYTES = 50 * 1024 * 1024;
|
|
5
|
+
const ASYNC_EVENTS_MAX_BYTES_ENV = "PI_SUBAGENT_ASYNC_EVENTS_MAX_BYTES";
|
|
6
|
+
const TRUNCATED_EVENT_TYPE = "subagent.events.truncated";
|
|
7
|
+
const TRUNCATION_MARKER_RESERVE_BYTES = 512;
|
|
8
|
+
const asyncEventLogStates = new Map();
|
|
9
|
+
function maxAsyncEventsBytes() {
|
|
10
|
+
const raw = process.env[ASYNC_EVENTS_MAX_BYTES_ENV];
|
|
11
|
+
if (!raw)
|
|
12
|
+
return DEFAULT_MAX_ASYNC_EVENTS_BYTES;
|
|
13
|
+
const parsed = Number(raw);
|
|
14
|
+
if (!Number.isFinite(parsed) || parsed < 0)
|
|
15
|
+
return DEFAULT_MAX_ASYNC_EVENTS_BYTES;
|
|
16
|
+
return Math.floor(parsed);
|
|
17
|
+
}
|
|
18
|
+
function eventLogState(filePath) {
|
|
19
|
+
let state = asyncEventLogStates.get(filePath);
|
|
20
|
+
if (state)
|
|
21
|
+
return state;
|
|
22
|
+
let bytes = 0;
|
|
23
|
+
try {
|
|
24
|
+
bytes = fs.statSync(filePath).size;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
if (error.code !== "ENOENT") {
|
|
28
|
+
// Diagnostic event accounting is best-effort; writes below are also safe.
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
state = { bytes, diagnosticsTruncated: false };
|
|
32
|
+
asyncEventLogStates.set(filePath, state);
|
|
33
|
+
return state;
|
|
34
|
+
}
|
|
35
|
+
export function appendJsonl(filePath, line) {
|
|
36
|
+
try {
|
|
37
|
+
appendRawJsonl(filePath, line);
|
|
38
|
+
const state = asyncEventLogStates.get(filePath);
|
|
39
|
+
if (state)
|
|
40
|
+
state.bytes += Buffer.byteLength(`${line}\n`, "utf-8");
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// Async event logging is diagnostic and must not fail the run.
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function appendDiagnosticJsonl(filePath, line, droppedEventType) {
|
|
47
|
+
if (!line.trim())
|
|
48
|
+
return;
|
|
49
|
+
const state = eventLogState(filePath);
|
|
50
|
+
if (state.diagnosticsTruncated)
|
|
51
|
+
return;
|
|
52
|
+
const maxBytes = maxAsyncEventsBytes();
|
|
53
|
+
const chunkBytes = Buffer.byteLength(`${line}\n`, "utf-8");
|
|
54
|
+
const diagnosticBudget = Math.max(0, maxBytes - TRUNCATION_MARKER_RESERVE_BYTES);
|
|
55
|
+
if (state.bytes + chunkBytes <= diagnosticBudget) {
|
|
56
|
+
appendJsonl(filePath, line);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const marker = JSON.stringify({
|
|
60
|
+
type: TRUNCATED_EVENT_TYPE,
|
|
61
|
+
ts: Date.now(),
|
|
62
|
+
maxBytes,
|
|
63
|
+
droppedEventType,
|
|
64
|
+
});
|
|
65
|
+
if (state.bytes + Buffer.byteLength(`${marker}\n`, "utf-8") <= maxBytes) {
|
|
66
|
+
appendJsonl(filePath, marker);
|
|
67
|
+
}
|
|
68
|
+
state.diagnosticsTruncated = true;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=runner-event-log.js.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { ChainOutputMap, ArtifactConfig, TurnBudgetState, ResolvedTurnBudget, NestedRouteInfo, ModelAttempt, ArtifactPaths, ToolBudgetState, Usage, CostSummary } from "../../shared/types.ts";
|
|
2
|
+
import type { BuiltRunnerSubagentStep as SubagentStep } from "../shared/parallel-utils.ts";
|
|
3
|
+
import type { ProtocolOutputLimit } from "../shared/child-protocol.ts";
|
|
4
|
+
import { type ChildWatchdogStateSnapshot } from "../../watchdog/child-status.ts";
|
|
5
|
+
import { type ChildEvent } from "./child-stream.ts";
|
|
6
|
+
/** Context for running a single step */
|
|
7
|
+
interface SingleStepContext {
|
|
8
|
+
supervisorSessionId?: string;
|
|
9
|
+
previousOutput: string;
|
|
10
|
+
handoffToNext?: boolean;
|
|
11
|
+
outputs?: ChainOutputMap;
|
|
12
|
+
placeholder: string;
|
|
13
|
+
cwd: string;
|
|
14
|
+
sessionCwd?: string;
|
|
15
|
+
sessionEnabled: boolean;
|
|
16
|
+
sessionDir?: string;
|
|
17
|
+
artifactsDir?: string;
|
|
18
|
+
artifactConfig?: Partial<ArtifactConfig>;
|
|
19
|
+
id: string;
|
|
20
|
+
flatIndex: number;
|
|
21
|
+
flatStepCount: number;
|
|
22
|
+
outputFile: string;
|
|
23
|
+
steerInboxDir?: string;
|
|
24
|
+
steerCapabilityPath?: string;
|
|
25
|
+
steerAckDir?: string;
|
|
26
|
+
transcriptPath?: string;
|
|
27
|
+
piPackageRoot?: string;
|
|
28
|
+
piArgv1?: string;
|
|
29
|
+
registerInterrupt?: (interrupt: (() => void) | undefined) => void;
|
|
30
|
+
registerTimeout?: (interrupt: (() => void) | undefined) => void;
|
|
31
|
+
registerStop?: (stop: (() => void) | undefined) => void;
|
|
32
|
+
registerTurnBudgetAbort?: (abort: ((message: string, state?: TurnBudgetState) => void) | undefined) => void;
|
|
33
|
+
timeoutSignal?: AbortSignal;
|
|
34
|
+
stopSignal?: AbortSignal;
|
|
35
|
+
timeoutMessage?: string;
|
|
36
|
+
stopMessage?: string;
|
|
37
|
+
turnBudget?: ResolvedTurnBudget;
|
|
38
|
+
childIntercomTarget?: string;
|
|
39
|
+
orchestratorIntercomTarget?: string;
|
|
40
|
+
nestedRoute?: NestedRouteInfo;
|
|
41
|
+
onAttemptStart?: (attempt: {
|
|
42
|
+
model?: string;
|
|
43
|
+
thinking?: string;
|
|
44
|
+
}) => void;
|
|
45
|
+
onChildEvent?: (event: ChildEvent) => void;
|
|
46
|
+
onWriterProcess?: (writer: {
|
|
47
|
+
state: "none" | "spawning";
|
|
48
|
+
} | {
|
|
49
|
+
state: "running";
|
|
50
|
+
pid: number;
|
|
51
|
+
}) => void;
|
|
52
|
+
skipAcceptance?: () => boolean;
|
|
53
|
+
}
|
|
54
|
+
/** Run a single pi agent step, returning output and metadata */
|
|
55
|
+
export declare function runSingleStep(step: SubagentStep, ctx: SingleStepContext): Promise<{
|
|
56
|
+
childId?: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
permissions?: "full" | "read-only";
|
|
59
|
+
agent: string;
|
|
60
|
+
output: string;
|
|
61
|
+
exitCode: number | null;
|
|
62
|
+
error?: string;
|
|
63
|
+
protocolError?: ProtocolOutputLimit;
|
|
64
|
+
model?: string;
|
|
65
|
+
attemptedModels?: string[];
|
|
66
|
+
modelAttempts?: ModelAttempt[];
|
|
67
|
+
artifactPaths?: ArtifactPaths;
|
|
68
|
+
transcriptPath?: string;
|
|
69
|
+
transcriptError?: string;
|
|
70
|
+
interrupted?: boolean;
|
|
71
|
+
timedOut?: boolean;
|
|
72
|
+
stopped?: boolean;
|
|
73
|
+
turnBudget?: TurnBudgetState;
|
|
74
|
+
turnBudgetExceeded?: boolean;
|
|
75
|
+
wrapUpRequested?: boolean;
|
|
76
|
+
toolBudget?: ToolBudgetState;
|
|
77
|
+
toolBudgetBlocked?: boolean;
|
|
78
|
+
sessionFile?: string;
|
|
79
|
+
receiptUsage?: Usage;
|
|
80
|
+
usageRequests?: import("../../../../../core/usage-accounting.ts").AccountedRequest[];
|
|
81
|
+
intercomTarget?: string;
|
|
82
|
+
totalCost?: CostSummary;
|
|
83
|
+
completionGuardTriggered?: boolean;
|
|
84
|
+
structuredOutput?: unknown;
|
|
85
|
+
structuredOutputPath?: string;
|
|
86
|
+
structuredOutputSchemaPath?: string;
|
|
87
|
+
acceptance?: import("../../shared/types.ts").AcceptanceLedger;
|
|
88
|
+
watchdog?: ChildWatchdogStateSnapshot;
|
|
89
|
+
}>;
|
|
90
|
+
export declare function combinedAbortSignal(signals: Array<AbortSignal | undefined>): AbortSignal | undefined;
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=runner-single-step.d.ts.map
|