pi-extensible-workflows 2.0.0 → 3.0.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/README.md +3 -1
- package/dist/src/agent-execution.d.ts +1 -15
- package/dist/src/agent-execution.js +15 -199
- package/dist/src/budget.d.ts +38 -0
- package/dist/src/budget.js +160 -0
- package/dist/src/cli.js +13 -7
- package/dist/src/execution.d.ts +17 -0
- package/dist/src/execution.js +630 -0
- package/dist/src/host.d.ts +62 -0
- package/dist/src/host.js +2696 -0
- package/dist/src/index.d.ts +10 -633
- package/dist/src/index.js +8 -4431
- package/dist/src/persistence.d.ts +6 -19
- package/dist/src/persistence.js +126 -60
- package/dist/src/registry.d.ts +31 -0
- package/dist/src/registry.js +169 -0
- package/dist/src/session-inspector.js +1 -1
- package/dist/src/types.d.ts +565 -0
- package/dist/src/types.js +27 -0
- package/dist/src/utils.d.ts +26 -0
- package/dist/src/utils.js +128 -0
- package/dist/src/validation.d.ts +24 -0
- package/dist/src/validation.js +740 -0
- package/package.json +1 -1
- package/skills/pi-extensible-workflows/SKILL.md +28 -27
- package/src/agent-execution.ts +17 -155
- package/src/budget.ts +75 -0
- package/src/cli.ts +15 -6
- package/src/execution.ts +540 -0
- package/src/host.ts +2265 -0
- package/src/index.ts +11 -3855
- package/src/persistence.ts +87 -36
- package/src/registry.ts +157 -0
- package/src/session-inspector.ts +1 -1
- package/src/types.ts +113 -0
- package/src/utils.ts +108 -0
- package/src/validation.ts +616 -0
package/dist/src/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
7
7
|
import { ProjectTrustStore, SessionManager, SettingsManager, createAgentSessionFromServices, createAgentSessionServices, getAgentDir, hasTrustRequiringProjectResources } from "@earendil-works/pi-coding-agent";
|
|
8
8
|
import { Value } from "typebox/value";
|
|
9
9
|
import { doctor, doctorExitCode, formatDoctorReport } from "./doctor.js";
|
|
10
|
-
import workflowExtension, { formatWorkflowProgress, workflowCatalog } from "./index.js";
|
|
10
|
+
import workflowExtension, { formatWorkflowProgress, truncateWorkflowProgress, workflowCatalog } from "./index.js";
|
|
11
11
|
import { runSessionInspector, transcriptFileLines } from "./session-inspector.js";
|
|
12
12
|
function object(value) { return typeof value === "object" && value !== null && !Array.isArray(value); }
|
|
13
13
|
function has(value, key) { return Object.prototype.hasOwnProperty.call(value, key); }
|
|
@@ -321,21 +321,27 @@ function writeLauncher(destination, workflowName, force) {
|
|
|
321
321
|
rmSync(tempDir, { recursive: true, force: true });
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
+
function terminalProgressStyles(enabled) {
|
|
325
|
+
const style = (code) => enabled ? (text) => `\x1b[${String(code)}m${text}\x1b[0m` : (text) => text;
|
|
326
|
+
return { accent: style(36), success: style(32), error: style(31), warning: style(33), muted: style(90), dim: style(2), bold: style(1) };
|
|
327
|
+
}
|
|
324
328
|
class CliProgress {
|
|
325
329
|
stderr;
|
|
326
|
-
tty;
|
|
327
330
|
#lastStable = "";
|
|
328
331
|
#lines = 0;
|
|
329
332
|
#frame = 0;
|
|
330
333
|
#run;
|
|
331
334
|
#timer;
|
|
335
|
+
#interactive;
|
|
336
|
+
#styles;
|
|
332
337
|
constructor(stderr, tty) {
|
|
333
338
|
this.stderr = stderr;
|
|
334
|
-
this
|
|
339
|
+
this.#interactive = tty && process.env.NO_COLOR === undefined && process.env.TERM !== "dumb";
|
|
340
|
+
this.#styles = terminalProgressStyles(this.#interactive);
|
|
335
341
|
}
|
|
336
342
|
update(run) {
|
|
337
|
-
const stable = formatWorkflowProgress(run, "◇");
|
|
338
|
-
if (!this
|
|
343
|
+
const stable = formatWorkflowProgress(run, "◇", this.#styles);
|
|
344
|
+
if (!this.#interactive) {
|
|
339
345
|
if (stable !== this.#lastStable) {
|
|
340
346
|
this.#lastStable = stable;
|
|
341
347
|
this.stderr(`${stable}\n`);
|
|
@@ -352,7 +358,7 @@ class CliProgress {
|
|
|
352
358
|
return;
|
|
353
359
|
const spinner = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"][this.#frame++ % 10] ?? "◇";
|
|
354
360
|
const width = process.stderr.columns || 80;
|
|
355
|
-
const text = formatWorkflowProgress(this.#run, spinner
|
|
361
|
+
const text = truncateWorkflowProgress(formatWorkflowProgress(this.#run, spinner, this.#styles), width).join("\n");
|
|
356
362
|
this.stderr(`${this.#lines ? `\x1b[${String(this.#lines)}A` : ""}${this.#lines ? "" : "\x1b[?25l"}\x1b[0J${text}\n`);
|
|
357
363
|
this.#lines = text.split("\n").length;
|
|
358
364
|
}
|
|
@@ -361,7 +367,7 @@ class CliProgress {
|
|
|
361
367
|
clearInterval(this.#timer);
|
|
362
368
|
this.#timer = undefined;
|
|
363
369
|
}
|
|
364
|
-
if (this
|
|
370
|
+
if (this.#interactive && this.#lines) {
|
|
365
371
|
this.stderr(`\x1b[${String(this.#lines)}A\x1b[0J\x1b[?25h`);
|
|
366
372
|
this.#lines = 0;
|
|
367
373
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RunStore } from "./persistence.js";
|
|
2
|
+
import type { AgentAttempt } from "./agent-execution.js";
|
|
3
|
+
import type { AgentIdentity, JsonValue, ShellIdentity, ShellOptions, ShellResult, WorkflowBridge, WorkflowExecution } from "./types.js";
|
|
4
|
+
export declare const RPC_LIMIT_BYTES: number;
|
|
5
|
+
export declare const HEARTBEAT_TIMEOUT_MS = 5000;
|
|
6
|
+
export declare function encoded(value: unknown): string;
|
|
7
|
+
export declare function agentIdentityPath(identity: AgentIdentity): string;
|
|
8
|
+
export declare function shellIdentityPath(identity: ShellIdentity): string;
|
|
9
|
+
export declare function readShellResult(value: unknown): ShellResult;
|
|
10
|
+
export declare function agentWorktree(identity: AgentIdentity): {
|
|
11
|
+
worktreeOwner?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function executeShellCommand(command: string, options: ShellOptions, signal: AbortSignal, cwd?: string): Promise<ShellResult>;
|
|
14
|
+
export declare function runWorkflow(script: string, args?: JsonValue, bridge?: WorkflowBridge, signal?: AbortSignal): WorkflowExecution;
|
|
15
|
+
export declare function persistActiveAgentAttempt(store: RunStore, id: string, active: Pick<AgentAttempt, "attempt" | "sessionId" | "sessionFile" | "setup">): Promise<void>;
|
|
16
|
+
export declare function persistAgentAttempts(store: RunStore, id: string, attempts: readonly AgentAttempt[]): Promise<void>;
|
|
17
|
+
export type { AgentIdentity, ShellIdentity, WorkflowBridge, WorkflowExecution } from "./types.js";
|