Reorganize worker runtime layer into worker/runtime/ (M8 part 2/3)

Groups the pi Agent lifecycle, factory, signature contract, and env/redaction helpers into src/main/worker/runtime/. WorkerRunner is the module's public entry and lives in runtime/index.ts; pi-agent-factory and pi-hook-contract stay named for their role as visible runtime boundaries; helpers.ts carries ParentMessage/ChildMessage/RunJob types plus redactor + env override utilities. entry/index.ts and agent-runtime/runtime-message-injector.ts updated to import from the new paths.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-20 11:40:01 -04:00
1 parent e7f879bed0
commit da3543fcd9
7 files changed
+9 -9

No files matched your search

+2 -2
View File
@@ -1,6 +1,6 @@
import type { ChildMessage, ParentMessage, RunJob } from "../worker-helpers";
import type { ChildMessage, ParentMessage, RunJob } from "../runtime/helpers";
import { WorkerRpcClient } from "./rpc";
import { WorkerRunner } from "../worker-runner";
import { WorkerRunner } from "../runtime";
const parentPort = process.parentPort;
+1 -1
View File
@@ -1,5 +1,5 @@
import { randomUUID } from "node:crypto";
import type { ChildMessage } from "../worker-helpers";
import type { ChildMessage } from "../runtime/helpers";
interface PendingRpc {
resolve: (value: { ok: true; result: unknown } | { ok: false; error: string }) => void;
File renamed without changes.
@@ -1,11 +1,11 @@
import type { Agent, AgentMessage } from "@mariozechner/pi-agent-core";
import { resolveModel, resolveExtraStreamHeaders } from "../model-resolver";
import { resolveModel, resolveExtraStreamHeaders } from "../../model-resolver";
import type { RunStatus } from "@shared/types";
import type { ChildMessage, RunJob } from "./worker-helpers";
import { applyEnvOverrides, buildRedactor } from "./worker-helpers";
import type { ChildMessage, RunJob } from "./helpers";
import { applyEnvOverrides, buildRedactor } from "./helpers";
import { createCodingTools } from "@mariozechner/pi-coding-agent";
import { createPiAgent, resolveThinkingLevel } from "./pi-agent-factory";
import type { WorkerRpcClient } from "./entry/rpc";
import type { WorkerRpcClient } from "../entry/rpc";
interface PrepareRunResult {
provider: string;
@@ -29,7 +29,7 @@ import type {
TransformContextRpcPayload,
TransformContextRpcResult,
} from "@main/agent-runtime/hook-rpc";
import type { WorkerRpcClient } from "./entry/rpc";
import type { WorkerRpcClient } from "../entry/rpc";
// Side-effect import: drags the hook signature contract into the typecheck
// graph so any drift in pi-agent-core hook shapes breaks the build here.
import "./pi-hook-contract";