@h-rig/cli 0.0.6-alpha.22 → 0.0.6-alpha.23
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/bin/rig.js +832 -491
- package/dist/src/commands/_operator-view.js +528 -228
- package/dist/src/commands/_pi-frontend.js +727 -0
- package/dist/src/commands/_pi-worker-bridge-extension.js +645 -0
- package/dist/src/commands/_preflight.js +1 -81
- package/dist/src/commands/_server-client.js +80 -1
- package/dist/src/commands/run.js +528 -228
- package/dist/src/commands/task-run-driver.js +51 -5
- package/dist/src/commands/task.js +532 -312
- package/dist/src/commands.js +832 -491
- package/dist/src/index.js +832 -491
- package/package.json +6 -6
|
@@ -1465,8 +1465,7 @@ async function executeRigOwnedTaskRun(context, input) {
|
|
|
1465
1465
|
...input.model ? ["--model", input.model] : [],
|
|
1466
1466
|
"--prompt"
|
|
1467
1467
|
] : input.runtimeAdapter === "pi" ? [
|
|
1468
|
-
"
|
|
1469
|
-
"rpc",
|
|
1468
|
+
"__rig_pi_session_daemon__",
|
|
1470
1469
|
...input.model ? ["--model", input.model] : []
|
|
1471
1470
|
] : [
|
|
1472
1471
|
"--print",
|
|
@@ -1563,7 +1562,7 @@ ${planningClassification.planningRequired ? `Before implementing, write a concis
|
|
|
1563
1562
|
projectRoot: context.projectRoot,
|
|
1564
1563
|
runId: input.runId,
|
|
1565
1564
|
stage,
|
|
1566
|
-
detail: stage === "Launch Pi" ? "Pi
|
|
1565
|
+
detail: stage === "Launch Pi" ? "Worker Pi SDK session daemon starting; local frontend will attach over Rig-proxied WebSocket." : stage === "Plan" ? `${planningClassification.planningRequired ? "recorded" : "skipped"} (${planningClassification.reason}; size=${planningClassification.size}; risk=${planningClassification.risk})` : stage === "Implement" ? "Pi implementation pass is running in the worker runtime." : null,
|
|
1567
1566
|
status: stage === "Implement" || stage === "Launch Pi" ? "running" : "completed"
|
|
1568
1567
|
});
|
|
1569
1568
|
}
|
|
@@ -1604,6 +1603,7 @@ ${planningClassification.planningRequired ? `Before implementing, write a concis
|
|
|
1604
1603
|
let latestProviderCommand = null;
|
|
1605
1604
|
let latestRuntimeBranch = resumeMode && typeof existingRunRecord?.branch === "string" ? existingRunRecord.branch : null;
|
|
1606
1605
|
let snapshotSidecarPromise = null;
|
|
1606
|
+
let wrapperManagesRuntimeSnapshot = false;
|
|
1607
1607
|
let dirtyBaselineApplied = false;
|
|
1608
1608
|
const childEnv = {
|
|
1609
1609
|
...process.env,
|
|
@@ -1672,6 +1672,7 @@ ${planningClassification.planningRequired ? `Before implementing, write a concis
|
|
|
1672
1672
|
latestSessionDir = typeof payload.sessionDir === "string" ? payload.sessionDir : latestSessionDir;
|
|
1673
1673
|
latestLogsDir = typeof payload.logsDir === "string" ? payload.logsDir : latestLogsDir;
|
|
1674
1674
|
const runtimeId = typeof payload.runtimeId === "string" ? payload.runtimeId : null;
|
|
1675
|
+
wrapperManagesRuntimeSnapshot = payload.snapshotManaged === true;
|
|
1675
1676
|
latestRuntimeBranch = runtimeId;
|
|
1676
1677
|
provisioningAction.complete(latestRuntimeWorkspace ?? "Runtime ready.", {
|
|
1677
1678
|
runtimeId: runtimeId ?? null,
|
|
@@ -1709,7 +1710,7 @@ ${planningClassification.planningRequired ? `Before implementing, write a concis
|
|
|
1709
1710
|
});
|
|
1710
1711
|
emitServerRunEvent({ type: "log", runId: input.runId, title: "Dirty baseline snapshot" });
|
|
1711
1712
|
}
|
|
1712
|
-
if (!snapshotSidecarPromise && runtimeId && loadRuntimeSnapshotConfig(context.projectRoot).enabled) {
|
|
1713
|
+
if (!wrapperManagesRuntimeSnapshot && !snapshotSidecarPromise && runtimeId && loadRuntimeSnapshotConfig(context.projectRoot).enabled) {
|
|
1713
1714
|
snapshotSidecarPromise = (async () => {
|
|
1714
1715
|
const { sidecar, error } = await resolveTaskRunSnapshotSidecar({
|
|
1715
1716
|
projectRoot: context.projectRoot,
|
|
@@ -1791,6 +1792,51 @@ ${planningClassification.planningRequired ? `Before implementing, write a concis
|
|
|
1791
1792
|
}
|
|
1792
1793
|
return true;
|
|
1793
1794
|
}
|
|
1795
|
+
if (event.type === "pi.sessiond.starting" || event.type === "pi.sessiond.ready" || event.type === "pi.session.event_stream.connected" || event.type === "pi.prompt.sent" || event.type === "pi.prompt.waiting" || event.type === "pi.session.agent_end" || event.type === "pi.session.error") {
|
|
1796
|
+
const title = event.type === "pi.sessiond.starting" ? "Starting worker Pi session daemon" : event.type === "pi.sessiond.ready" ? "Worker Pi daemon ready" : event.type === "pi.session.event_stream.connected" ? "Worker Pi event stream connected" : event.type === "pi.prompt.sent" ? "Delivered initial prompt to worker Pi" : event.type === "pi.prompt.waiting" ? "Worker Pi prompt waiting" : event.type === "pi.session.agent_end" ? "Worker Pi turn complete" : "Worker Pi session error";
|
|
1797
|
+
const detail = event.type === "pi.sessiond.ready" ? "Daemon accepted control connection; waiting for SDK session metadata." : event.type === "pi.sessiond.starting" ? String(payload.workspaceDir ?? "worker runtime") : event.type === "pi.prompt.sent" ? `${String(payload.bytes ?? "unknown")} prompt bytes sent.` : event.type === "pi.prompt.waiting" ? String(payload.reason ?? "empty prompt") : event.type === "pi.session.error" ? String(payload.message ?? "session error") : String(payload.sessionId ?? payload.runId ?? "worker Pi session");
|
|
1798
|
+
appendRunLog(context.projectRoot, input.runId, {
|
|
1799
|
+
id: nextRunLogId(),
|
|
1800
|
+
title,
|
|
1801
|
+
detail,
|
|
1802
|
+
tone: event.type === "pi.session.error" ? "error" : "info",
|
|
1803
|
+
status: reviewStarted ? "reviewing" : verificationStarted ? "validating" : "running",
|
|
1804
|
+
payload: {
|
|
1805
|
+
eventType: event.type,
|
|
1806
|
+
runId: typeof payload.runId === "string" ? payload.runId : null,
|
|
1807
|
+
runtimeId: typeof payload.runtimeId === "string" ? payload.runtimeId : null,
|
|
1808
|
+
sessionId: typeof payload.sessionId === "string" ? payload.sessionId : null
|
|
1809
|
+
},
|
|
1810
|
+
createdAt: new Date().toISOString()
|
|
1811
|
+
});
|
|
1812
|
+
emitServerRunEvent({ type: "log", runId: input.runId, title });
|
|
1813
|
+
return true;
|
|
1814
|
+
}
|
|
1815
|
+
if (event.type === "pi.session.ready") {
|
|
1816
|
+
const privateMetadata = payload.privateMetadata && typeof payload.privateMetadata === "object" && !Array.isArray(payload.privateMetadata) ? payload.privateMetadata : null;
|
|
1817
|
+
const publicMetadata = payload.metadata && typeof payload.metadata === "object" && !Array.isArray(payload.metadata) ? payload.metadata : null;
|
|
1818
|
+
if (privateMetadata) {
|
|
1819
|
+
patchAuthorityRun(context.projectRoot, input.runId, {
|
|
1820
|
+
piSession: publicMetadata,
|
|
1821
|
+
piSessionPrivate: privateMetadata
|
|
1822
|
+
});
|
|
1823
|
+
const sessionId = typeof publicMetadata?.sessionId === "string" ? publicMetadata.sessionId : typeof privateMetadata.public === "object" && privateMetadata.public && !Array.isArray(privateMetadata.public) ? String(privateMetadata.public.sessionId ?? "") : "";
|
|
1824
|
+
appendRunLog(context.projectRoot, input.runId, {
|
|
1825
|
+
id: `log:${input.runId}:pi-session-ready`,
|
|
1826
|
+
title: "Worker Pi session ready",
|
|
1827
|
+
detail: sessionId ? `Session ${sessionId} is ready for WebSocket attach.` : "Worker Pi SDK session daemon is ready for WebSocket attach.",
|
|
1828
|
+
tone: "info",
|
|
1829
|
+
status: "running",
|
|
1830
|
+
payload: {
|
|
1831
|
+
sessionId: sessionId || null,
|
|
1832
|
+
runtimeId: typeof payload.runtimeId === "string" ? payload.runtimeId : null
|
|
1833
|
+
},
|
|
1834
|
+
createdAt: new Date().toISOString()
|
|
1835
|
+
});
|
|
1836
|
+
emitServerRunEvent({ type: "log", runId: input.runId, title: "Worker Pi session ready" });
|
|
1837
|
+
}
|
|
1838
|
+
return true;
|
|
1839
|
+
}
|
|
1794
1840
|
if (event.type === "pi.rpc.prompt.sent" || event.type === "pi.rpc.steering.delivered" || event.type === "pi.rpc.steering.poll.failed" || event.type === "pi.rpc.extension_ui.cancelled") {
|
|
1795
1841
|
const title = event.type === "pi.rpc.prompt.sent" ? "Delivered initial prompt to worker Pi" : event.type === "pi.rpc.steering.delivered" ? "Delivered steering to worker Pi" : event.type === "pi.rpc.steering.poll.failed" ? "Worker Pi steering poll failed" : "Pi RPC UI request auto-cancelled";
|
|
1796
1842
|
const detail = event.type === "pi.rpc.prompt.sent" ? `${String(payload.kind ?? "prompt")} prompt (${String(payload.bytes ?? "unknown")} bytes)` : event.type === "pi.rpc.steering.delivered" ? `${String(payload.actor ?? "operator")}: ${String(payload.message ?? "")}`.slice(0, 500) : event.type === "pi.rpc.steering.poll.failed" ? String(payload.error ?? "steering poll failed") : `${String(payload.method ?? "ui")}: ${String(payload.reason ?? "noninteractive worker session")}`;
|
|
@@ -2322,7 +2368,7 @@ Failed to update task source for ${input.taskId ?? runtimeTaskId} to failed: ${e
|
|
|
2322
2368
|
startedAt,
|
|
2323
2369
|
finishedAt: requestedAt
|
|
2324
2370
|
});
|
|
2325
|
-
|
|
2371
|
+
process.exit(0);
|
|
2326
2372
|
}
|
|
2327
2373
|
const runPiPrFeedbackFix = async (message) => {
|
|
2328
2374
|
appendPiStageLog({
|