@h-rig/cli 0.0.6-alpha.54 → 0.0.6-alpha.55

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 CHANGED
@@ -6242,6 +6242,7 @@ import { readFileSync as readFileSync8 } from "fs";
6242
6242
  import { resolve as resolve20 } from "path";
6243
6243
  import {
6244
6244
  appendJsonlRecord as appendJsonlRecord2,
6245
+ appendRunLifecycleEvent,
6245
6246
  readAuthorityRun as readAuthorityRun2,
6246
6247
  resolveAuthorityRunDir as resolveAuthorityRunDir3,
6247
6248
  writeJsonFile as writeJsonFile4
@@ -6336,8 +6337,38 @@ function startRunAction(projectRoot, runId, input) {
6336
6337
  }
6337
6338
  };
6338
6339
  }
6340
+ var runEventSinkProjectRoot = null;
6341
+ function configureRunEventSink(projectRoot) {
6342
+ runEventSinkProjectRoot = projectRoot;
6343
+ }
6344
+ var lastDoorbellRangAt = 0;
6345
+ function ringServerRunDoorbell(runId) {
6346
+ const serverUrl = process.env.RIG_SERVER_URL?.trim();
6347
+ if (!serverUrl)
6348
+ return;
6349
+ const now = Date.now();
6350
+ if (now - lastDoorbellRangAt < 250)
6351
+ return;
6352
+ lastDoorbellRangAt = now;
6353
+ const token = process.env.RIG_AUTH_TOKEN || process.env.RIG_GITHUB_TOKEN || "";
6354
+ fetch(`${serverUrl.replace(/\/+$/, "")}/api/runs/doorbell`, {
6355
+ method: "POST",
6356
+ headers: {
6357
+ "content-type": "application/json",
6358
+ authorization: `Bearer ${token}`
6359
+ },
6360
+ body: JSON.stringify({ runId }),
6361
+ signal: AbortSignal.timeout(1000)
6362
+ }).catch(() => {});
6363
+ }
6339
6364
  function emitServerRunEvent(event) {
6340
6365
  console.log(`__RIG_RUN_EVENT__${JSON.stringify({ ...event, at: new Date().toISOString() })}`);
6366
+ if (runEventSinkProjectRoot) {
6367
+ try {
6368
+ appendRunLifecycleEvent(runEventSinkProjectRoot, event.runId, { ...event });
6369
+ } catch {}
6370
+ ringServerRunDoorbell(event.runId);
6371
+ }
6341
6372
  }
6342
6373
  function buildRunPrompt(input) {
6343
6374
  const initialPrompt = input.initialPrompt?.trim() || null;
@@ -10713,6 +10744,7 @@ function stringArrayField(record, key) {
10713
10744
  async function executeRigOwnedTaskRun(context, input) {
10714
10745
  process.stdout.on("error", () => {});
10715
10746
  process.stderr.on("error", () => {});
10747
+ configureRunEventSink(context.projectRoot);
10716
10748
  const runtimeTaskId = input.taskId?.trim() || `adhoc-${input.runId}`;
10717
10749
  const existingRunRecord = readAuthorityRun5(context.projectRoot, input.runId);
10718
10750
  const resumeMode = process.env.RIG_RUN_RESUME === "1";
@@ -13,6 +13,7 @@ import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
13
13
  // packages/cli/src/commands/_run-driver-helpers.ts
14
14
  import {
15
15
  appendJsonlRecord,
16
+ appendRunLifecycleEvent,
16
17
  readAuthorityRun as readAuthorityRun2,
17
18
  resolveAuthorityRunDir as resolveAuthorityRunDir2,
18
19
  writeJsonFile as writeJsonFile2
@@ -148,8 +149,38 @@ function startRunAction(projectRoot, runId, input) {
148
149
  }
149
150
  };
150
151
  }
152
+ var runEventSinkProjectRoot = null;
153
+ function configureRunEventSink(projectRoot) {
154
+ runEventSinkProjectRoot = projectRoot;
155
+ }
156
+ var lastDoorbellRangAt = 0;
157
+ function ringServerRunDoorbell(runId) {
158
+ const serverUrl = process.env.RIG_SERVER_URL?.trim();
159
+ if (!serverUrl)
160
+ return;
161
+ const now = Date.now();
162
+ if (now - lastDoorbellRangAt < 250)
163
+ return;
164
+ lastDoorbellRangAt = now;
165
+ const token = process.env.RIG_AUTH_TOKEN || process.env.RIG_GITHUB_TOKEN || "";
166
+ fetch(`${serverUrl.replace(/\/+$/, "")}/api/runs/doorbell`, {
167
+ method: "POST",
168
+ headers: {
169
+ "content-type": "application/json",
170
+ authorization: `Bearer ${token}`
171
+ },
172
+ body: JSON.stringify({ runId }),
173
+ signal: AbortSignal.timeout(1000)
174
+ }).catch(() => {});
175
+ }
151
176
  function emitServerRunEvent(event) {
152
177
  console.log(`__RIG_RUN_EVENT__${JSON.stringify({ ...event, at: new Date().toISOString() })}`);
178
+ if (runEventSinkProjectRoot) {
179
+ try {
180
+ appendRunLifecycleEvent(runEventSinkProjectRoot, event.runId, { ...event });
181
+ } catch {}
182
+ ringServerRunDoorbell(event.runId);
183
+ }
153
184
  }
154
185
  function buildRunPrompt(input) {
155
186
  const initialPrompt = input.initialPrompt?.trim() || null;
@@ -282,6 +313,7 @@ export {
282
313
  startRunAction,
283
314
  patchAuthorityRun,
284
315
  emitServerRunEvent,
316
+ configureRunEventSink,
285
317
  buildRunPrompt,
286
318
  appendRunTimeline,
287
319
  appendRunLog,
@@ -53,6 +53,7 @@ import { readFileSync } from "fs";
53
53
  import { resolve as resolve3 } from "path";
54
54
  import {
55
55
  appendJsonlRecord,
56
+ appendRunLifecycleEvent,
56
57
  readAuthorityRun as readAuthorityRun2,
57
58
  resolveAuthorityRunDir as resolveAuthorityRunDir2,
58
59
  writeJsonFile as writeJsonFile2
@@ -258,8 +259,38 @@ function startRunAction(projectRoot, runId, input) {
258
259
  }
259
260
  };
260
261
  }
262
+ var runEventSinkProjectRoot = null;
263
+ function configureRunEventSink(projectRoot) {
264
+ runEventSinkProjectRoot = projectRoot;
265
+ }
266
+ var lastDoorbellRangAt = 0;
267
+ function ringServerRunDoorbell(runId) {
268
+ const serverUrl = process.env.RIG_SERVER_URL?.trim();
269
+ if (!serverUrl)
270
+ return;
271
+ const now = Date.now();
272
+ if (now - lastDoorbellRangAt < 250)
273
+ return;
274
+ lastDoorbellRangAt = now;
275
+ const token = process.env.RIG_AUTH_TOKEN || process.env.RIG_GITHUB_TOKEN || "";
276
+ fetch(`${serverUrl.replace(/\/+$/, "")}/api/runs/doorbell`, {
277
+ method: "POST",
278
+ headers: {
279
+ "content-type": "application/json",
280
+ authorization: `Bearer ${token}`
281
+ },
282
+ body: JSON.stringify({ runId }),
283
+ signal: AbortSignal.timeout(1000)
284
+ }).catch(() => {});
285
+ }
261
286
  function emitServerRunEvent(event) {
262
287
  console.log(`__RIG_RUN_EVENT__${JSON.stringify({ ...event, at: new Date().toISOString() })}`);
288
+ if (runEventSinkProjectRoot) {
289
+ try {
290
+ appendRunLifecycleEvent(runEventSinkProjectRoot, event.runId, { ...event });
291
+ } catch {}
292
+ ringServerRunDoorbell(event.runId);
293
+ }
263
294
  }
264
295
  function buildRunPrompt(input) {
265
296
  const initialPrompt = input.initialPrompt?.trim() || null;
@@ -1495,6 +1526,7 @@ function stringArrayField(record, key) {
1495
1526
  async function executeRigOwnedTaskRun(context, input) {
1496
1527
  process.stdout.on("error", () => {});
1497
1528
  process.stderr.on("error", () => {});
1529
+ configureRunEventSink(context.projectRoot);
1498
1530
  const runtimeTaskId = input.taskId?.trim() || `adhoc-${input.runId}`;
1499
1531
  const existingRunRecord = readAuthorityRun3(context.projectRoot, input.runId);
1500
1532
  const resumeMode = process.env.RIG_RUN_RESUME === "1";
@@ -6048,6 +6048,7 @@ import { readFileSync as readFileSync8 } from "fs";
6048
6048
  import { resolve as resolve19 } from "path";
6049
6049
  import {
6050
6050
  appendJsonlRecord as appendJsonlRecord2,
6051
+ appendRunLifecycleEvent,
6051
6052
  readAuthorityRun as readAuthorityRun2,
6052
6053
  resolveAuthorityRunDir as resolveAuthorityRunDir3,
6053
6054
  writeJsonFile as writeJsonFile4
@@ -6142,8 +6143,38 @@ function startRunAction(projectRoot, runId, input) {
6142
6143
  }
6143
6144
  };
6144
6145
  }
6146
+ var runEventSinkProjectRoot = null;
6147
+ function configureRunEventSink(projectRoot) {
6148
+ runEventSinkProjectRoot = projectRoot;
6149
+ }
6150
+ var lastDoorbellRangAt = 0;
6151
+ function ringServerRunDoorbell(runId) {
6152
+ const serverUrl = process.env.RIG_SERVER_URL?.trim();
6153
+ if (!serverUrl)
6154
+ return;
6155
+ const now = Date.now();
6156
+ if (now - lastDoorbellRangAt < 250)
6157
+ return;
6158
+ lastDoorbellRangAt = now;
6159
+ const token = process.env.RIG_AUTH_TOKEN || process.env.RIG_GITHUB_TOKEN || "";
6160
+ fetch(`${serverUrl.replace(/\/+$/, "")}/api/runs/doorbell`, {
6161
+ method: "POST",
6162
+ headers: {
6163
+ "content-type": "application/json",
6164
+ authorization: `Bearer ${token}`
6165
+ },
6166
+ body: JSON.stringify({ runId }),
6167
+ signal: AbortSignal.timeout(1000)
6168
+ }).catch(() => {});
6169
+ }
6145
6170
  function emitServerRunEvent(event) {
6146
6171
  console.log(`__RIG_RUN_EVENT__${JSON.stringify({ ...event, at: new Date().toISOString() })}`);
6172
+ if (runEventSinkProjectRoot) {
6173
+ try {
6174
+ appendRunLifecycleEvent(runEventSinkProjectRoot, event.runId, { ...event });
6175
+ } catch {}
6176
+ ringServerRunDoorbell(event.runId);
6177
+ }
6147
6178
  }
6148
6179
  function buildRunPrompt(input) {
6149
6180
  const initialPrompt = input.initialPrompt?.trim() || null;
@@ -10519,6 +10550,7 @@ function stringArrayField(record, key) {
10519
10550
  async function executeRigOwnedTaskRun(context, input) {
10520
10551
  process.stdout.on("error", () => {});
10521
10552
  process.stderr.on("error", () => {});
10553
+ configureRunEventSink(context.projectRoot);
10522
10554
  const runtimeTaskId = input.taskId?.trim() || `adhoc-${input.runId}`;
10523
10555
  const existingRunRecord = readAuthorityRun5(context.projectRoot, input.runId);
10524
10556
  const resumeMode = process.env.RIG_RUN_RESUME === "1";
package/dist/src/index.js CHANGED
@@ -6238,6 +6238,7 @@ import { readFileSync as readFileSync8 } from "fs";
6238
6238
  import { resolve as resolve20 } from "path";
6239
6239
  import {
6240
6240
  appendJsonlRecord as appendJsonlRecord2,
6241
+ appendRunLifecycleEvent,
6241
6242
  readAuthorityRun as readAuthorityRun2,
6242
6243
  resolveAuthorityRunDir as resolveAuthorityRunDir3,
6243
6244
  writeJsonFile as writeJsonFile4
@@ -6332,8 +6333,38 @@ function startRunAction(projectRoot, runId, input) {
6332
6333
  }
6333
6334
  };
6334
6335
  }
6336
+ var runEventSinkProjectRoot = null;
6337
+ function configureRunEventSink(projectRoot) {
6338
+ runEventSinkProjectRoot = projectRoot;
6339
+ }
6340
+ var lastDoorbellRangAt = 0;
6341
+ function ringServerRunDoorbell(runId) {
6342
+ const serverUrl = process.env.RIG_SERVER_URL?.trim();
6343
+ if (!serverUrl)
6344
+ return;
6345
+ const now = Date.now();
6346
+ if (now - lastDoorbellRangAt < 250)
6347
+ return;
6348
+ lastDoorbellRangAt = now;
6349
+ const token = process.env.RIG_AUTH_TOKEN || process.env.RIG_GITHUB_TOKEN || "";
6350
+ fetch(`${serverUrl.replace(/\/+$/, "")}/api/runs/doorbell`, {
6351
+ method: "POST",
6352
+ headers: {
6353
+ "content-type": "application/json",
6354
+ authorization: `Bearer ${token}`
6355
+ },
6356
+ body: JSON.stringify({ runId }),
6357
+ signal: AbortSignal.timeout(1000)
6358
+ }).catch(() => {});
6359
+ }
6335
6360
  function emitServerRunEvent(event) {
6336
6361
  console.log(`__RIG_RUN_EVENT__${JSON.stringify({ ...event, at: new Date().toISOString() })}`);
6362
+ if (runEventSinkProjectRoot) {
6363
+ try {
6364
+ appendRunLifecycleEvent(runEventSinkProjectRoot, event.runId, { ...event });
6365
+ } catch {}
6366
+ ringServerRunDoorbell(event.runId);
6367
+ }
6337
6368
  }
6338
6369
  function buildRunPrompt(input) {
6339
6370
  const initialPrompt = input.initialPrompt?.trim() || null;
@@ -10709,6 +10740,7 @@ function stringArrayField(record, key) {
10709
10740
  async function executeRigOwnedTaskRun(context, input) {
10710
10741
  process.stdout.on("error", () => {});
10711
10742
  process.stderr.on("error", () => {});
10743
+ configureRunEventSink(context.projectRoot);
10712
10744
  const runtimeTaskId = input.taskId?.trim() || `adhoc-${input.runId}`;
10713
10745
  const existingRunRecord = readAuthorityRun5(context.projectRoot, input.runId);
10714
10746
  const resumeMode = process.env.RIG_RUN_RESUME === "1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/cli",
3
- "version": "0.0.6-alpha.54",
3
+ "version": "0.0.6-alpha.55",
4
4
  "type": "module",
5
5
  "description": "Rig package",
6
6
  "license": "UNLICENSED",
@@ -23,12 +23,12 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@clack/prompts": "^1.2.0",
26
- "@earendil-works/pi-coding-agent": "npm:@h-rig/pi-coding-agent@0.0.6-alpha.54",
27
- "@rig/client": "npm:@h-rig/client@0.0.6-alpha.54",
28
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.54",
29
- "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.54",
30
- "@rig/server": "npm:@h-rig/server@0.0.6-alpha.54",
31
- "@rig/standard-plugin": "npm:@h-rig/standard-plugin@0.0.6-alpha.54",
26
+ "@earendil-works/pi-coding-agent": "npm:@h-rig/pi-coding-agent@0.0.6-alpha.55",
27
+ "@rig/client": "npm:@h-rig/client@0.0.6-alpha.55",
28
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.55",
29
+ "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.55",
30
+ "@rig/server": "npm:@h-rig/server@0.0.6-alpha.55",
31
+ "@rig/standard-plugin": "npm:@h-rig/standard-plugin@0.0.6-alpha.55",
32
32
  "picocolors": "^1.1.1"
33
33
  }
34
34
  }