@toon-protocol/rig 4.3.0 → 4.4.0

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/README.md CHANGED
@@ -9,7 +9,7 @@ lives in NIP-34 Nostr events and the objects live on Arweave.
9
9
  - **Writes are paid** — pushing objects and publishing events spends from a
10
10
  payment channel funded by your wallet. Writes are permanent and non-refundable.
11
11
  - **One node URL is the whole network configuration** — `rig` embeds its own
12
- payment client (`@toon-protocol/client` 2.x) built from your seed phrase and
12
+ payment client (`@toon-protocol/client` 3.x) built from your seed phrase and
13
13
  pays the TOON connector you name with `rig entry <url>`. The node describes
14
14
  itself on `GET /ilp`; there is nothing to discover (see
15
15
  [Pointing at a node](#pointing-at-a-node)).
@@ -377,7 +377,13 @@ can read rig's events.
377
377
  the repo owner or a declared maintainer (`rig maintainers`).
378
378
  - **Triggers**: a push (a new kind:30618 whose refs moved), a pull request or PR
379
379
  update (kinds 1617/1618/1619 — rig's own `rig pr create` patches included),
380
- or a Manual Trigger (9840) from a maintainer.
380
+ or a Manual Trigger (9840) from a maintainer. A pull request runs the
381
+ workflows with `on: pull_request`; its events carry NIP-22 tags back to the PR
382
+ (`E`/`K`/`P` root, `e`/`k`/`p` for the update that supplied the commit) and
383
+ no git ref. A PR update supersedes the previous tip: the earlier run for that
384
+ PR, queued or in progress, concludes `cancelled` before the new one starts.
385
+ `rig ci status` shows a PR run's PR event id and whether its author is the
386
+ repo owner or a declared maintainer (`pr.authorIsMaintainer` in `--json`).
381
387
  - The **Runner** is behind one interface. The first implementation is act on the
382
388
  host's Docker; a TOON-lease runner is a later class behind the same seam.
383
389
 
@@ -409,13 +415,15 @@ triggers) and gives a third-party pull request an **empty** secret set, so a
409
415
  contributor cannot exfiltrate them. Values are never echoed by rig, in any mode.
410
416
 
411
417
  `rig ci status <commit>` is the merge gate: one line per run (conclusion,
412
- workflow, trigger reason, coordinator, trust level) and a summary; with `--json`
413
- exactly one document (`ok`, `runs[]` with per-job conclusions, log and artifact
414
- URLs, `summary`). It exits **0** only when at least one run counted and every
415
- counted run concluded green (`success`/`neutral`/`skipped`); **1** when a run is
416
- red, still queued/in progress, or nothing was found. `--require-ci-trust <level>`
417
- drops runs below that level before counting, so a passing run from an unknown
418
- coordinator does not count as green.
418
+ workflow, trigger reason, coordinator, trust level, wall-clock time once
419
+ concluded), one indented line per job (conclusion, exit code, duration) and a
420
+ summary; with `--json` exactly one document (`ok`, `runs[]` with each run's and
421
+ job's event id, conclusion, timings — `queuedAt`/`startedAt`/`concludedAt` —
422
+ log and artifact URLs, `summary`). It exits **0** only when at least one run
423
+ counted and every counted run concluded green (`success`/`neutral`/`skipped`);
424
+ **1** when a run is red, still queued/in progress, or nothing was found.
425
+ `--require-ci-trust <level>` drops runs below that level before counting, so a
426
+ passing run from an unknown coordinator does not count as green.
419
427
 
420
428
  **Trust levels** are derived client-side from Service Requests and the repo's
421
429
  declared maintainers, strongest first:
@@ -452,6 +460,7 @@ rig ci serve --relay wss://<relay> --repo <owner-npub>/<repo-id> [--repo …]
452
460
  | `--act-bin <path>` | `act` on PATH (or `RIG_ACT_BIN`) | the act binary |
453
461
  | `--platform <label>=<image>` | `ubuntu-latest=catthehacker/ubuntu:act-latest` | `runs-on` label → Docker image (repeatable) |
454
462
  | `--workdir <dir>` | `<state-dir>/work` | where commits are materialized |
463
+ | `--once` | | stop after the first run concludes (its 9842 and final 39842 are on the relay) — one `rig ci trigger` answered by one bounded serve; ignored or refused triggers do not count |
455
464
  | `--json` | | one JSON document with the coordinator, relay, repos and state dir on start |
456
465
 
457
466
  On start the coordinator publishes an **Advertisement** (19843: runner family
@@ -764,7 +773,7 @@ it — that stays behind the `Publisher` seam:
764
773
  split, and `JobDeliveryPort` is the injected seam for the per-increment
765
774
  encrypt/pay leg. The concrete port and the buyer-side payment helpers that
766
775
  rode the 0.x client's serve-side job API were removed with the move to
767
- `@toon-protocol/client` 2.x; the protocol pieces stay so a port can be
768
- written against the 2.x client.
776
+ `@toon-protocol/client` 2.x (now 3.x); the protocol pieces stay so a port can be
777
+ written against the current client.
769
778
 
770
779
  [epic #246](https://github.com/toon-protocol/toon-client/issues/246).
@@ -47,7 +47,7 @@ import {
47
47
  updateRef,
48
48
  writeGitObjects,
49
49
  writeToonConfig
50
- } from "./chunk-3RWM7PBM.js";
50
+ } from "./chunk-RL5XUWR4.js";
51
51
  import {
52
52
  ARWEAVE_GATEWAYS,
53
53
  COMMENT_KIND,
@@ -299,7 +299,7 @@ function loadPaidSession(deps, relayUrl) {
299
299
  });
300
300
  }
301
301
  var defaultLoadStandalone = async (options) => {
302
- const mod = await import("./standalone-mode-JIEECDTI.js");
302
+ const mod = await import("./standalone-mode-R3HH2ALP.js");
303
303
  return mod.createStandaloneContext(options);
304
304
  };
305
305
  function identityReport(ctx) {
@@ -2373,7 +2373,7 @@ async function runCi(args, deps) {
2373
2373
  case "status":
2374
2374
  return runCiStatus(rest, deps);
2375
2375
  case "serve":
2376
- return (await import("./ci-serve-ZVJBZ3W3.js")).runCiServe(rest, deps);
2376
+ return (await import("./ci-serve-P4HOLAMP.js")).runCiServe(rest, deps);
2377
2377
  case "--help":
2378
2378
  case "-h":
2379
2379
  case "help":
@@ -7665,4 +7665,4 @@ export {
7665
7665
  rigVersion,
7666
7666
  dispatch
7667
7667
  };
7668
- //# sourceMappingURL=chunk-5HFOPKAB.js.map
7668
+ //# sourceMappingURL=chunk-CTRP2UAQ.js.map
@@ -3326,7 +3326,9 @@ function assembleCiStatus(opts) {
3326
3326
  ...j.logsUrl !== void 0 ? { logsUrl: j.logsUrl } : {},
3327
3327
  artifacts: j.artifacts,
3328
3328
  ...j.exitCode !== void 0 ? { exitCode: j.exitCode } : {},
3329
+ ...j.queuedAt !== void 0 ? { queuedAt: j.queuedAt } : {},
3329
3330
  ...j.startedAt !== void 0 ? { startedAt: j.startedAt } : {},
3331
+ concludedAt: j.createdAt,
3330
3332
  eventId: j.eventId,
3331
3333
  publisher: j.pubkey
3332
3334
  }));
@@ -3354,6 +3356,14 @@ function assembleCiStatus(opts) {
3354
3356
  ...startedAt !== void 0 ? { startedAt } : {},
3355
3357
  ...queuedAt !== void 0 ? { queuedAt } : {},
3356
3358
  ...provenance ? { provenance } : {},
3359
+ ...base.trigger.pr ? {
3360
+ pr: {
3361
+ ...base.trigger.pr,
3362
+ authorIsMaintainer: opts.authorized.has(
3363
+ base.trigger.pr.prAuthor.toLowerCase()
3364
+ )
3365
+ }
3366
+ } : {},
3357
3367
  jobs: runJobs,
3358
3368
  eventId: base.eventId
3359
3369
  });
@@ -3549,6 +3559,11 @@ function glyph(run) {
3549
3559
  if (run.status !== "concluded" || run.conclusion === void 0) return "\u2026";
3550
3560
  return GREEN.has(run.conclusion) ? "\u2713" : "\u2717";
3551
3561
  }
3562
+ function pullRequestLine(pr) {
3563
+ const who = pr.authorIsMaintainer ? "author is a maintainer" : "author is not a maintainer";
3564
+ const via = pr.sourceEventId !== pr.prEventId ? ` via update ${pr.sourceEventId}` : "";
3565
+ return ` pull request ${pr.prEventId} by ${shortNpub(pr.prAuthor)} (${who})${via}`;
3566
+ }
3552
3567
  function shortNpub(hex) {
3553
3568
  try {
3554
3569
  const npub = hexToNpub(hex);
@@ -3557,6 +3572,10 @@ function shortNpub(hex) {
3557
3572
  return `${hex.slice(0, 12)}\u2026`;
3558
3573
  }
3559
3574
  }
3575
+ function tookSuffix(startedAt, endedAt) {
3576
+ if (startedAt === void 0) return "";
3577
+ return ` took ${Math.max(0, endedAt - startedAt)}s`;
3578
+ }
3560
3579
  function renderStatus(report) {
3561
3580
  const lines = [];
3562
3581
  lines.push(
@@ -3567,15 +3586,17 @@ function renderStatus(report) {
3567
3586
  }
3568
3587
  for (const run of report.runs) {
3569
3588
  const state = run.status === "concluded" ? run.conclusion ?? "concluded" : run.status;
3589
+ const took = run.status === "concluded" ? tookSuffix(run.startedAt, run.createdAt) : "";
3570
3590
  lines.push(
3571
- `${glyph(run)} ${state.padEnd(15)} ${run.workflow.path} ${run.reason} coordinator ${shortNpub(run.coordinator)} trust ${run.trust}`
3591
+ `${glyph(run)} ${state.padEnd(15)} ${run.workflow.path} ${run.reason} coordinator ${shortNpub(run.coordinator)} trust ${run.trust}${took}`
3572
3592
  );
3573
3593
  for (const job of run.jobs) {
3574
3594
  const extra = job.exitCode !== void 0 ? ` (exit ${job.exitCode})` : "";
3575
3595
  lines.push(
3576
- ` ${job.conclusion.padEnd(15)} ${job.name ?? job.jobId}${extra}`
3596
+ ` ${job.conclusion.padEnd(15)} ${job.name ?? job.jobId}${extra}` + tookSuffix(job.startedAt, job.concludedAt)
3577
3597
  );
3578
3598
  }
3599
+ if (run.pr) lines.push(pullRequestLine(run.pr));
3579
3600
  }
3580
3601
  const s = report.summary;
3581
3602
  const verdict = report.ok ? "GREEN" : `NOT GREEN \u2014 ${report.reason ?? "see runs"}`;
@@ -3702,4 +3723,4 @@ export {
3702
3723
  assembleCiStatus,
3703
3724
  runCiStatus
3704
3725
  };
3705
- //# sourceMappingURL=chunk-3RWM7PBM.js.map
3726
+ //# sourceMappingURL=chunk-RL5XUWR4.js.map