@h-rig/rig-extension 0.0.6-alpha.92 → 0.0.6-alpha.94

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.
@@ -3213,8 +3213,20 @@ function startRunProcessStallMonitor(opts) {
3213
3213
  function createRunProcessStopController(journal, stopHost, exit = (code) => {
3214
3214
  process.exitCode = code;
3215
3215
  setTimeout(() => process.exit(code), 0);
3216
- }) {
3216
+ }, deps = {}) {
3217
3217
  let stopRequested = null;
3218
+ let finished = false;
3219
+ const finishStopped = async () => {
3220
+ if (finished)
3221
+ return;
3222
+ finished = true;
3223
+ journal?.appendTimeline({ type: "stopped", stage: "stopped", status: "completed", detail: stopRequested?.reason ?? "operator requested stop" });
3224
+ journal?.appendStatus("stopped", { actor: { kind: "operator" }, reason: stopRequested?.reason ?? "operator requested stop", force: true });
3225
+ await stopHost?.("rig stop requested").catch(() => {
3226
+ return;
3227
+ });
3228
+ exit(0);
3229
+ };
3218
3230
  return {
3219
3231
  isStopRequested: () => Boolean(stopRequested),
3220
3232
  requestStop: (reason) => {
@@ -3222,15 +3234,13 @@ function createRunProcessStopController(journal, stopHost, exit = (code) => {
3222
3234
  return;
3223
3235
  stopRequested = { reason };
3224
3236
  journal?.appendTimeline({ type: "stop-requested", stage: "stopped", status: "running", detail: reason ?? "operator requested stop" });
3237
+ if (deps.isIdle?.()) {
3238
+ finishStopped();
3239
+ } else {
3240
+ deps.interrupt?.();
3241
+ }
3225
3242
  },
3226
- finishStopped: async () => {
3227
- journal?.appendTimeline({ type: "stopped", stage: "stopped", status: "completed", detail: stopRequested?.reason ?? "operator requested stop" });
3228
- journal?.appendStatus("stopped", { actor: { kind: "operator" }, reason: stopRequested?.reason ?? "operator requested stop", force: true });
3229
- await stopHost?.("rig stop requested").catch(() => {
3230
- return;
3231
- });
3232
- exit(0);
3233
- }
3243
+ finishStopped
3234
3244
  };
3235
3245
  }
3236
3246
  function createRunProcessStopHandlers(runId, stopController) {
@@ -3421,7 +3431,10 @@ async function maybeStartRunProcessAutohost(api, ctx) {
3421
3431
  runRegistry.removeRoom(runRegistryRoomId).catch(() => {});
3422
3432
  }
3423
3433
  };
3424
- const stopController = createRunProcessStopController(journal, stopHost);
3434
+ const stopController = createRunProcessStopController(journal, stopHost, undefined, {
3435
+ interrupt: () => ctx.abort(),
3436
+ isIdle: () => ctx.isIdle()
3437
+ });
3425
3438
  const stopHandlers = createRunProcessStopHandlers(runId, stopController);
3426
3439
  const stopRunStallMonitor = startRunProcessStallMonitor({
3427
3440
  journal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/rig-extension",
3
- "version": "0.0.6-alpha.92",
3
+ "version": "0.0.6-alpha.94",
4
4
  "type": "module",
5
5
  "description": "Rig package",
6
6
  "license": "UNLICENSED",
@@ -25,10 +25,10 @@
25
25
  ]
26
26
  },
27
27
  "dependencies": {
28
- "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.92",
29
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.92",
30
- "@rig/relay-registry": "npm:@h-rig/relay-registry@0.0.6-alpha.92",
31
- "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.92",
28
+ "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.94",
29
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.94",
30
+ "@rig/relay-registry": "npm:@h-rig/relay-registry@0.0.6-alpha.94",
31
+ "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.94",
32
32
  "@oh-my-pi/pi-coding-agent": "16.0.4",
33
33
  "@oh-my-pi/pi-tui": "16.0.4",
34
34
  "effect": "4.0.0-beta.78"