@h-rig/run-worker 0.0.6-alpha.155 → 0.0.6-alpha.156
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/src/autohost.js +10 -10
- package/dist/src/extension.js +10 -10
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +108 -33
- package/dist/src/notifications.js +1 -1
- package/dist/src/panel-plugin.d.ts +4 -5
- package/dist/src/panel-plugin.js +2 -2
- package/dist/src/plugin.d.ts +14 -0
- package/dist/src/plugin.js +851 -0
- package/dist/src/runs/control.d.ts +24 -0
- package/dist/src/runs/control.js +398 -0
- package/dist/src/runs/diagnostics.d.ts +10 -0
- package/dist/src/runs/diagnostics.js +53 -0
- package/dist/src/runs/guard.d.ts +4 -0
- package/dist/src/runs/guard.js +26 -0
- package/dist/src/runs/inbox.d.ts +44 -0
- package/dist/src/runs/inbox.js +499 -0
- package/dist/src/runs/index.d.ts +9 -0
- package/dist/src/runs/index.js +990 -0
- package/dist/src/runs/inspect.d.ts +27 -0
- package/dist/src/runs/inspect.js +459 -0
- package/dist/src/runs/projection.d.ts +24 -0
- package/dist/src/runs/projection.js +356 -0
- package/dist/src/runs/run-status.d.ts +20 -0
- package/dist/src/runs/run-status.js +181 -0
- package/dist/src/runs/stats.d.ts +13 -0
- package/dist/src/runs/stats.js +485 -0
- package/package.json +13 -8
package/dist/src/autohost.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/run-worker/src/autohost.ts
|
|
3
|
-
import { runPipelineCloseout } from "@rig/
|
|
4
|
-
import { adoptPlacementKernel } from "@rig/
|
|
5
|
-
import { latestTimelineEntriesFromCustomEntries, parseInboxResolutionSentinel, parsePauseSentinel, parseResumeSentinel, parseStopSentinel, sessionIdFromSessionFile } from "@rig/contracts";
|
|
3
|
+
import { runPipelineCloseout } from "@rig/bundle-default-lifecycle/pipeline-closeout";
|
|
4
|
+
import { adoptPlacementKernel } from "@rig/kernel/kernel-entrypoint";
|
|
5
|
+
import { latestTimelineEntriesFromCustomEntries, parseInboxResolutionSentinel, parsePauseSentinel, parseResumeSentinel, parseStopSentinel, RIG_RUN_STOP_PANEL_ACTION as RIG_RUN_STOP_PANEL_ACTION2, RIG_SUPERVISOR_PANEL_ID as RIG_SUPERVISOR_PANEL_ID2, sessionIdFromSessionFile } from "@rig/contracts";
|
|
6
6
|
import { Duration, Effect, Fiber, Stream } from "effect";
|
|
7
|
-
import { createEnvCloseoutRunners } from "@rig/
|
|
8
|
-
import { CloseoutValidationError } from "@rig/
|
|
7
|
+
import { createEnvCloseoutRunners } from "@rig/bundle-default-lifecycle/native/closeout-runners";
|
|
8
|
+
import { CloseoutValidationError } from "@rig/bundle-default-lifecycle/native/in-process-closeout";
|
|
9
9
|
import { projectRunFromSession } from "@rig/runtime/control-plane/run-session-projection";
|
|
10
10
|
import { localRunChanges } from "@rig/runtime/control-plane/run-discovery-stream";
|
|
11
11
|
import { updateRunTaskSourceLifecycle } from "@rig/runtime/control-plane/tasks/source-lifecycle";
|
|
@@ -44,7 +44,7 @@ async function createRunJournal(sessionManager, runId) {
|
|
|
44
44
|
|
|
45
45
|
// packages/run-worker/src/notifications.ts
|
|
46
46
|
import { resolve } from "path";
|
|
47
|
-
import { dispatchEventToTargets, loadNotificationConfig } from "@rig/
|
|
47
|
+
import { dispatchEventToTargets, loadNotificationConfig } from "@rig/notifications-plugin/notifications";
|
|
48
48
|
async function dispatchRunNotifications(projectRoot, runId, taskId, outcome, detail) {
|
|
49
49
|
try {
|
|
50
50
|
const config = await loadNotificationConfig(resolve(projectRoot, ".rig", "notifications.json"));
|
|
@@ -109,8 +109,8 @@ function startRunProcessStallMonitor(opts) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
// packages/run-worker/src/panel-plugin.ts
|
|
112
|
-
import { createProjectPluginHost, projectPluginResolutionWarningMessages } from "@rig/
|
|
113
|
-
import { RIG_CAPABILITY_PANEL_SLOT, RIG_RUN_STOP_PANEL_ACTION, RIG_SUPERVISOR_PANEL_ID } from "@rig/
|
|
112
|
+
import { createProjectPluginHost, projectPluginResolutionWarningMessages } from "@rig/core/project-plugins";
|
|
113
|
+
import { RIG_CAPABILITY_PANEL_SLOT, RIG_RUN_STOP_PANEL_ACTION, RIG_SUPERVISOR_PANEL_ID } from "@rig/contracts";
|
|
114
114
|
var RIG_PANELS_CUSTOM_MESSAGE_TYPE = "rig-panels";
|
|
115
115
|
var PANEL_PRODUCER_TIMEOUT_MS = 2000;
|
|
116
116
|
async function produceWorkerPanelPayload(producer, context) {
|
|
@@ -368,7 +368,7 @@ async function maybeStartRunProcessAutohost(api, ctx) {
|
|
|
368
368
|
badge: panel.badge,
|
|
369
369
|
disabled: panel.disabled
|
|
370
370
|
}));
|
|
371
|
-
const activePanel = registrations.find((panel) => panel.id ===
|
|
371
|
+
const activePanel = registrations.find((panel) => panel.id === RIG_SUPERVISOR_PANEL_ID2)?.id ?? registrations.find((panel) => !panel.disabled)?.id ?? registrations[0]?.id ?? null;
|
|
372
372
|
const frameBody = {
|
|
373
373
|
kind: "snapshot",
|
|
374
374
|
activePanel,
|
|
@@ -497,7 +497,7 @@ async function maybeStartRunProcessAutohost(api, ctx) {
|
|
|
497
497
|
process.once("uncaughtException", publishFatalTerminal);
|
|
498
498
|
process.once("unhandledRejection", publishFatalTerminal);
|
|
499
499
|
const handlePanelAction = async (input) => {
|
|
500
|
-
if (input.actionId !==
|
|
500
|
+
if (input.actionId !== RIG_RUN_STOP_PANEL_ACTION2 && input.actionId !== "stop-supervisor") {
|
|
501
501
|
throw new Error(`Unsupported Rig panel action: ${input.actionId}`);
|
|
502
502
|
}
|
|
503
503
|
pendingStopReason = `operator ${input.from.name} requested stop`;
|
package/dist/src/extension.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/run-worker/src/autohost.ts
|
|
3
|
-
import { runPipelineCloseout } from "@rig/
|
|
4
|
-
import { adoptPlacementKernel } from "@rig/
|
|
5
|
-
import { latestTimelineEntriesFromCustomEntries, parseInboxResolutionSentinel, parsePauseSentinel, parseResumeSentinel, parseStopSentinel, sessionIdFromSessionFile } from "@rig/contracts";
|
|
3
|
+
import { runPipelineCloseout } from "@rig/bundle-default-lifecycle/pipeline-closeout";
|
|
4
|
+
import { adoptPlacementKernel } from "@rig/kernel/kernel-entrypoint";
|
|
5
|
+
import { latestTimelineEntriesFromCustomEntries, parseInboxResolutionSentinel, parsePauseSentinel, parseResumeSentinel, parseStopSentinel, RIG_RUN_STOP_PANEL_ACTION as RIG_RUN_STOP_PANEL_ACTION2, RIG_SUPERVISOR_PANEL_ID as RIG_SUPERVISOR_PANEL_ID2, sessionIdFromSessionFile } from "@rig/contracts";
|
|
6
6
|
import { Duration, Effect, Fiber, Stream } from "effect";
|
|
7
|
-
import { createEnvCloseoutRunners } from "@rig/
|
|
8
|
-
import { CloseoutValidationError } from "@rig/
|
|
7
|
+
import { createEnvCloseoutRunners } from "@rig/bundle-default-lifecycle/native/closeout-runners";
|
|
8
|
+
import { CloseoutValidationError } from "@rig/bundle-default-lifecycle/native/in-process-closeout";
|
|
9
9
|
import { projectRunFromSession } from "@rig/runtime/control-plane/run-session-projection";
|
|
10
10
|
import { localRunChanges } from "@rig/runtime/control-plane/run-discovery-stream";
|
|
11
11
|
import { updateRunTaskSourceLifecycle } from "@rig/runtime/control-plane/tasks/source-lifecycle";
|
|
@@ -44,7 +44,7 @@ async function createRunJournal(sessionManager, runId) {
|
|
|
44
44
|
|
|
45
45
|
// packages/run-worker/src/notifications.ts
|
|
46
46
|
import { resolve } from "path";
|
|
47
|
-
import { dispatchEventToTargets, loadNotificationConfig } from "@rig/
|
|
47
|
+
import { dispatchEventToTargets, loadNotificationConfig } from "@rig/notifications-plugin/notifications";
|
|
48
48
|
async function dispatchRunNotifications(projectRoot, runId, taskId, outcome, detail) {
|
|
49
49
|
try {
|
|
50
50
|
const config = await loadNotificationConfig(resolve(projectRoot, ".rig", "notifications.json"));
|
|
@@ -109,8 +109,8 @@ function startRunProcessStallMonitor(opts) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
// packages/run-worker/src/panel-plugin.ts
|
|
112
|
-
import { createProjectPluginHost, projectPluginResolutionWarningMessages } from "@rig/
|
|
113
|
-
import { RIG_CAPABILITY_PANEL_SLOT, RIG_RUN_STOP_PANEL_ACTION, RIG_SUPERVISOR_PANEL_ID } from "@rig/
|
|
112
|
+
import { createProjectPluginHost, projectPluginResolutionWarningMessages } from "@rig/core/project-plugins";
|
|
113
|
+
import { RIG_CAPABILITY_PANEL_SLOT, RIG_RUN_STOP_PANEL_ACTION, RIG_SUPERVISOR_PANEL_ID } from "@rig/contracts";
|
|
114
114
|
var RIG_PANELS_CUSTOM_MESSAGE_TYPE = "rig-panels";
|
|
115
115
|
var PANEL_PRODUCER_TIMEOUT_MS = 2000;
|
|
116
116
|
async function produceWorkerPanelPayload(producer, context) {
|
|
@@ -368,7 +368,7 @@ async function maybeStartRunProcessAutohost(api, ctx) {
|
|
|
368
368
|
badge: panel.badge,
|
|
369
369
|
disabled: panel.disabled
|
|
370
370
|
}));
|
|
371
|
-
const activePanel = registrations.find((panel) => panel.id ===
|
|
371
|
+
const activePanel = registrations.find((panel) => panel.id === RIG_SUPERVISOR_PANEL_ID2)?.id ?? registrations.find((panel) => !panel.disabled)?.id ?? registrations[0]?.id ?? null;
|
|
372
372
|
const frameBody = {
|
|
373
373
|
kind: "snapshot",
|
|
374
374
|
activePanel,
|
|
@@ -497,7 +497,7 @@ async function maybeStartRunProcessAutohost(api, ctx) {
|
|
|
497
497
|
process.once("uncaughtException", publishFatalTerminal);
|
|
498
498
|
process.once("unhandledRejection", publishFatalTerminal);
|
|
499
499
|
const handlePanelAction = async (input) => {
|
|
500
|
-
if (input.actionId !==
|
|
500
|
+
if (input.actionId !== RIG_RUN_STOP_PANEL_ACTION2 && input.actionId !== "stop-supervisor") {
|
|
501
501
|
throw new Error(`Unsupported Rig panel action: ${input.actionId}`);
|
|
502
502
|
}
|
|
503
503
|
pendingStopReason = `operator ${input.from.name} requested stop`;
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
16
17
|
|
|
17
18
|
// packages/run-worker/src/journal.ts
|
|
18
19
|
import { createJournalSessionProvider } from "@rig/kernel/journal-session-provider";
|
|
@@ -41,10 +42,11 @@ async function createRunJournal(sessionManager, runId) {
|
|
|
41
42
|
return null;
|
|
42
43
|
}
|
|
43
44
|
}
|
|
45
|
+
var init_journal = () => {};
|
|
44
46
|
|
|
45
47
|
// packages/run-worker/src/notifications.ts
|
|
46
48
|
import { resolve } from "path";
|
|
47
|
-
import { dispatchEventToTargets, loadNotificationConfig } from "@rig/
|
|
49
|
+
import { dispatchEventToTargets, loadNotificationConfig } from "@rig/notifications-plugin/notifications";
|
|
48
50
|
async function dispatchRunNotifications(projectRoot, runId, taskId, outcome, detail) {
|
|
49
51
|
try {
|
|
50
52
|
const config = await loadNotificationConfig(resolve(projectRoot, ".rig", "notifications.json"));
|
|
@@ -57,12 +59,15 @@ async function dispatchRunNotifications(projectRoot, runId, taskId, outcome, det
|
|
|
57
59
|
]);
|
|
58
60
|
} catch {}
|
|
59
61
|
}
|
|
62
|
+
var init_notifications = () => {};
|
|
60
63
|
|
|
61
64
|
// packages/run-worker/src/constants.ts
|
|
62
|
-
var RUN_PROCESS_STEER_TIMEOUT_MS =
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
var RUN_PROCESS_STEER_TIMEOUT_MS, TRACKED_RUN_STALL_MS, RUN_PROCESS_STALL_SWEEP_MS, RUN_PROCESS_STALL_DETAIL = "Run process made no OMP session progress for 20+ minutes; recording a stall so recovery can requeue or resume the session.";
|
|
66
|
+
var init_constants = __esm(() => {
|
|
67
|
+
RUN_PROCESS_STEER_TIMEOUT_MS = 10 * 60 * 1000;
|
|
68
|
+
TRACKED_RUN_STALL_MS = 20 * 60 * 1000;
|
|
69
|
+
RUN_PROCESS_STALL_SWEEP_MS = 60 * 1000;
|
|
70
|
+
});
|
|
66
71
|
|
|
67
72
|
// packages/run-worker/src/stall.ts
|
|
68
73
|
function timestampMs(value) {
|
|
@@ -107,12 +112,13 @@ function startRunProcessStallMonitor(opts) {
|
|
|
107
112
|
timer.unref();
|
|
108
113
|
return () => clearInterval(timer);
|
|
109
114
|
}
|
|
115
|
+
var init_stall = __esm(() => {
|
|
116
|
+
init_constants();
|
|
117
|
+
});
|
|
110
118
|
|
|
111
119
|
// packages/run-worker/src/panel-plugin.ts
|
|
112
|
-
import { createProjectPluginHost, projectPluginResolutionWarningMessages } from "@rig/
|
|
113
|
-
import { RIG_CAPABILITY_PANEL_SLOT, RIG_RUN_STOP_PANEL_ACTION, RIG_SUPERVISOR_PANEL_ID } from "@rig/
|
|
114
|
-
var RIG_PANELS_CUSTOM_MESSAGE_TYPE = "rig-panels";
|
|
115
|
-
var PANEL_PRODUCER_TIMEOUT_MS = 2000;
|
|
120
|
+
import { createProjectPluginHost, projectPluginResolutionWarningMessages } from "@rig/core/project-plugins";
|
|
121
|
+
import { RIG_CAPABILITY_PANEL_SLOT, RIG_RUN_STOP_PANEL_ACTION, RIG_SUPERVISOR_PANEL_ID } from "@rig/contracts";
|
|
116
122
|
async function produceWorkerPanelPayload(producer, context) {
|
|
117
123
|
if (!producer.produce)
|
|
118
124
|
return;
|
|
@@ -141,6 +147,8 @@ async function loadWorkerPanelRegistry(projectRoot) {
|
|
|
141
147
|
producers: host.listExecutablePanels().filter((registration) => registration.slot === RIG_CAPABILITY_PANEL_SLOT)
|
|
142
148
|
};
|
|
143
149
|
}
|
|
150
|
+
var RIG_PANELS_CUSTOM_MESSAGE_TYPE = "rig-panels", PANEL_PRODUCER_TIMEOUT_MS = 2000;
|
|
151
|
+
var init_panel_plugin = () => {};
|
|
144
152
|
|
|
145
153
|
// packages/run-worker/src/utils.ts
|
|
146
154
|
import { createWorkflowStatusChanged, RIG_WORKFLOW_STATUS_CHANGED } from "@rig/contracts";
|
|
@@ -162,8 +170,22 @@ function registryBaseUrl() {
|
|
|
162
170
|
function rigRelayUrl() {
|
|
163
171
|
return resolveRelayUrl();
|
|
164
172
|
}
|
|
173
|
+
var init_utils = () => {};
|
|
165
174
|
|
|
166
175
|
// packages/run-worker/src/autohost.ts
|
|
176
|
+
import { runPipelineCloseout } from "@rig/bundle-default-lifecycle/pipeline-closeout";
|
|
177
|
+
import { adoptPlacementKernel } from "@rig/kernel/kernel-entrypoint";
|
|
178
|
+
import { latestTimelineEntriesFromCustomEntries, parseInboxResolutionSentinel, parsePauseSentinel, parseResumeSentinel, parseStopSentinel, RIG_RUN_STOP_PANEL_ACTION as RIG_RUN_STOP_PANEL_ACTION2, RIG_SUPERVISOR_PANEL_ID as RIG_SUPERVISOR_PANEL_ID2, sessionIdFromSessionFile } from "@rig/contracts";
|
|
179
|
+
import { Duration, Effect, Fiber, Stream } from "effect";
|
|
180
|
+
import { createEnvCloseoutRunners } from "@rig/bundle-default-lifecycle/native/closeout-runners";
|
|
181
|
+
import { CloseoutValidationError } from "@rig/bundle-default-lifecycle/native/in-process-closeout";
|
|
182
|
+
import { projectRunFromSession } from "@rig/runtime/control-plane/run-session-projection";
|
|
183
|
+
import { localRunChanges } from "@rig/runtime/control-plane/run-discovery-stream";
|
|
184
|
+
import { updateRunTaskSourceLifecycle } from "@rig/runtime/control-plane/tasks/source-lifecycle";
|
|
185
|
+
import { resolveOwnerNamespaceKey } from "@rig/runtime/control-plane/remote-config";
|
|
186
|
+
import { resolveRigIdentity } from "@rig/runtime/control-plane/identity";
|
|
187
|
+
import { connectWorkerProjection, createRegistryClient } from "@rig/relay-registry";
|
|
188
|
+
import { coerceRegistryStatus } from "@rig/relay-registry/schema";
|
|
167
189
|
function syntheticRegistryOwner(namespaceKey) {
|
|
168
190
|
const githubUserId = namespaceKey.startsWith("gh:") ? namespaceKey.slice(3) : namespaceKey;
|
|
169
191
|
return {
|
|
@@ -172,7 +194,6 @@ function syntheticRegistryOwner(namespaceKey) {
|
|
|
172
194
|
namespaceKey
|
|
173
195
|
};
|
|
174
196
|
}
|
|
175
|
-
var REGISTRY_PROJECTION_TIMELINE_LIMIT = 100;
|
|
176
197
|
async function reflectStoppedRunTaskSource(input) {
|
|
177
198
|
const taskId = input.taskId?.trim();
|
|
178
199
|
if (!taskId)
|
|
@@ -216,7 +237,6 @@ function registryRunProjection(input) {
|
|
|
216
237
|
timeline: [...timeline]
|
|
217
238
|
};
|
|
218
239
|
}
|
|
219
|
-
var OPERATOR_ACTOR = { kind: "operator" };
|
|
220
240
|
function textFromContent(content) {
|
|
221
241
|
if (typeof content === "string")
|
|
222
242
|
return content;
|
|
@@ -368,7 +388,7 @@ async function maybeStartRunProcessAutohost(api, ctx) {
|
|
|
368
388
|
badge: panel.badge,
|
|
369
389
|
disabled: panel.disabled
|
|
370
390
|
}));
|
|
371
|
-
const activePanel = registrations.find((panel) => panel.id ===
|
|
391
|
+
const activePanel = registrations.find((panel) => panel.id === RIG_SUPERVISOR_PANEL_ID2)?.id ?? registrations.find((panel) => !panel.disabled)?.id ?? registrations[0]?.id ?? null;
|
|
372
392
|
const frameBody = {
|
|
373
393
|
kind: "snapshot",
|
|
374
394
|
activePanel,
|
|
@@ -497,7 +517,7 @@ async function maybeStartRunProcessAutohost(api, ctx) {
|
|
|
497
517
|
process.once("uncaughtException", publishFatalTerminal);
|
|
498
518
|
process.once("unhandledRejection", publishFatalTerminal);
|
|
499
519
|
const handlePanelAction = async (input) => {
|
|
500
|
-
if (input.actionId !==
|
|
520
|
+
if (input.actionId !== RIG_RUN_STOP_PANEL_ACTION2 && input.actionId !== "stop-supervisor") {
|
|
501
521
|
throw new Error(`Unsupported Rig panel action: ${input.actionId}`);
|
|
502
522
|
}
|
|
503
523
|
pendingStopReason = `operator ${input.from.name} requested stop`;
|
|
@@ -759,14 +779,23 @@ async function maybeStartSpikeAutohost(ctx) {
|
|
|
759
779
|
...identity?.selectedRepo ? { selectedRepo: identity.selectedRepo } : {}
|
|
760
780
|
});
|
|
761
781
|
}
|
|
782
|
+
var REGISTRY_PROJECTION_TIMELINE_LIMIT = 100, OPERATOR_ACTOR;
|
|
783
|
+
var init_autohost = __esm(() => {
|
|
784
|
+
init_journal();
|
|
785
|
+
init_notifications();
|
|
786
|
+
init_stall();
|
|
787
|
+
init_panel_plugin();
|
|
788
|
+
init_utils();
|
|
789
|
+
OPERATOR_ACTOR = { kind: "operator" };
|
|
790
|
+
});
|
|
762
791
|
|
|
763
792
|
// packages/run-worker/src/extension.ts
|
|
764
|
-
var
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
793
|
+
var exports_extension = {};
|
|
794
|
+
__export(exports_extension, {
|
|
795
|
+
default: () => rigWorkerExtension,
|
|
796
|
+
__rigRunWorkerTest: () => __rigRunWorkerTest,
|
|
797
|
+
__rigExtensionTest: () => __rigExtensionTest
|
|
798
|
+
});
|
|
770
799
|
function rigWorkerExtension(api) {
|
|
771
800
|
let hooks = null;
|
|
772
801
|
api.on("session_start", async (_event, ctx) => {
|
|
@@ -783,9 +812,54 @@ function rigWorkerExtension(api) {
|
|
|
783
812
|
await hooks?.agentEnd(event);
|
|
784
813
|
});
|
|
785
814
|
}
|
|
815
|
+
var __rigRunWorkerTest, __rigExtensionTest;
|
|
816
|
+
var init_extension = __esm(() => {
|
|
817
|
+
init_autohost();
|
|
818
|
+
init_stall();
|
|
819
|
+
__rigRunWorkerTest = {
|
|
820
|
+
computeRunStall,
|
|
821
|
+
appendRunStallDetected,
|
|
822
|
+
detectRunControlText
|
|
823
|
+
};
|
|
824
|
+
__rigExtensionTest = __rigRunWorkerTest;
|
|
825
|
+
});
|
|
826
|
+
|
|
827
|
+
// packages/run-worker/src/index.ts
|
|
828
|
+
init_extension();
|
|
829
|
+
|
|
830
|
+
// packages/run-worker/src/plugin.ts
|
|
831
|
+
import { definePlugin } from "@rig/core/config";
|
|
832
|
+
var runWorkerPlugin = definePlugin({
|
|
833
|
+
name: "@rig/run-worker",
|
|
834
|
+
version: "0.0.0-alpha.1",
|
|
835
|
+
contributes: {
|
|
836
|
+
sessionExtensions: [
|
|
837
|
+
{
|
|
838
|
+
id: "rig:run-worker",
|
|
839
|
+
description: "Rig run lifecycle worker (plan\u2192implement\u2192validate\u2192commit\u2192PR\u2192merge\u2192closeout).",
|
|
840
|
+
install: async (api) => {
|
|
841
|
+
const { default: rigWorkerExtension2 } = await Promise.resolve().then(() => (init_extension(), exports_extension));
|
|
842
|
+
rigWorkerExtension2(api);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
]
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
function createRunWorkerPlugin() {
|
|
849
|
+
return runWorkerPlugin;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
// packages/run-worker/src/index.ts
|
|
853
|
+
init_autohost();
|
|
854
|
+
init_constants();
|
|
855
|
+
init_journal();
|
|
856
|
+
init_panel_plugin();
|
|
857
|
+
init_notifications();
|
|
858
|
+
init_stall();
|
|
786
859
|
export {
|
|
787
860
|
timestampMs,
|
|
788
861
|
startRunProcessStallMonitor,
|
|
862
|
+
runWorkerPlugin,
|
|
789
863
|
registryRunProjection,
|
|
790
864
|
reflectStoppedRunTaskSource,
|
|
791
865
|
produceWorkerPanelPayload,
|
|
@@ -795,6 +869,7 @@ export {
|
|
|
795
869
|
dispatchRunNotifications,
|
|
796
870
|
detectRunControlText,
|
|
797
871
|
rigWorkerExtension as default,
|
|
872
|
+
createRunWorkerPlugin,
|
|
798
873
|
createRunJournal,
|
|
799
874
|
computeRunStall,
|
|
800
875
|
appendRunStallDetected,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/run-worker/src/notifications.ts
|
|
3
3
|
import { resolve } from "path";
|
|
4
|
-
import { dispatchEventToTargets, loadNotificationConfig } from "@rig/
|
|
4
|
+
import { dispatchEventToTargets, loadNotificationConfig } from "@rig/notifications-plugin/notifications";
|
|
5
5
|
async function dispatchRunNotifications(projectRoot, runId, taskId, outcome, detail) {
|
|
6
6
|
try {
|
|
7
7
|
const config = await loadNotificationConfig(resolve(projectRoot, ".rig", "notifications.json"));
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
3
|
-
import { RIG_RUN_STOP_PANEL_ACTION, RIG_SUPERVISOR_PANEL_ID, type WorkerPanelProducerContext } from "@rig/standard-plugin/run-worker-panels";
|
|
1
|
+
import { RIG_RUN_STOP_PANEL_ACTION, RIG_SUPERVISOR_PANEL_ID, type PanelRegistration, type WorkerPanelProducerContext } from "@rig/contracts";
|
|
2
|
+
import type { Panel } from "@rig/core";
|
|
4
3
|
export { RIG_RUN_STOP_PANEL_ACTION, RIG_SUPERVISOR_PANEL_ID };
|
|
5
4
|
export type { WorkerPanelProducerContext };
|
|
6
5
|
export declare const RIG_PANELS_CUSTOM_MESSAGE_TYPE = "rig-panels";
|
|
7
6
|
export interface WorkerPanelRegistrySnapshot {
|
|
8
7
|
readonly registrations: readonly PanelRegistration[];
|
|
9
|
-
readonly producers: readonly
|
|
8
|
+
readonly producers: readonly Panel[];
|
|
10
9
|
}
|
|
11
|
-
export declare function produceWorkerPanelPayload(producer:
|
|
10
|
+
export declare function produceWorkerPanelPayload(producer: Panel, context: WorkerPanelProducerContext): Promise<unknown>;
|
|
12
11
|
export declare function loadWorkerPanelRegistry(projectRoot: string): Promise<WorkerPanelRegistrySnapshot>;
|
package/dist/src/panel-plugin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/run-worker/src/panel-plugin.ts
|
|
3
|
-
import { createProjectPluginHost, projectPluginResolutionWarningMessages } from "@rig/
|
|
4
|
-
import { RIG_CAPABILITY_PANEL_SLOT, RIG_RUN_STOP_PANEL_ACTION, RIG_SUPERVISOR_PANEL_ID } from "@rig/
|
|
3
|
+
import { createProjectPluginHost, projectPluginResolutionWarningMessages } from "@rig/core/project-plugins";
|
|
4
|
+
import { RIG_CAPABILITY_PANEL_SLOT, RIG_RUN_STOP_PANEL_ACTION, RIG_SUPERVISOR_PANEL_ID } from "@rig/contracts";
|
|
5
5
|
var RIG_PANELS_CUSTOM_MESSAGE_TYPE = "rig-panels";
|
|
6
6
|
var PANEL_PRODUCER_TIMEOUT_MS = 2000;
|
|
7
7
|
async function produceWorkerPanelPayload(producer, context) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type RigPlugin } from "@rig/core/config";
|
|
2
|
+
/**
|
|
3
|
+
* The run lifecycle is a real plugin contribution: it installs the run-worker
|
|
4
|
+
* session extension (plan→implement→validate→commit→PR→merge→closeout) into
|
|
5
|
+
* an agent session.
|
|
6
|
+
*
|
|
7
|
+
* CRITICAL: `install` lazily `await import("./extension")` rather than a
|
|
8
|
+
* top-level import so that config-time evaluation of this plugin does NOT drag
|
|
9
|
+
* the heavy autohost execution stack into every plugin-host load (architecture
|
|
10
|
+
* §8). The heavy module is only pulled in when an agent session actually
|
|
11
|
+
* installs the extension.
|
|
12
|
+
*/
|
|
13
|
+
export declare const runWorkerPlugin: RigPlugin;
|
|
14
|
+
export declare function createRunWorkerPlugin(): RigPlugin;
|