@north-light/cli 0.3.699 → 0.3.700

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.
Files changed (82) hide show
  1. package/dist/api/client.d.ts +4 -0
  2. package/dist/api/client.js +1 -1
  3. package/dist/api/contract.d.ts +1 -1
  4. package/dist/api/contract.js +1 -1
  5. package/dist/api/dto/nodes.d.ts +2 -0
  6. package/dist/api/routes.d.ts +1 -0
  7. package/dist/api/routes.js +1 -1
  8. package/dist/clients/attach/viewer.js +4 -4
  9. package/dist/commands/node/inspect.js +6 -6
  10. package/dist/commands/node-lifecycle-revive.d.ts +2 -10
  11. package/dist/commands/node-lifecycle-revive.js +1 -1
  12. package/dist/core/canvas/status-glyph.d.ts +9 -0
  13. package/dist/core/canvas/status-glyph.js +1 -1
  14. package/dist/core/command-plugins/compose.js +1 -1
  15. package/dist/core/command.js +8 -8
  16. package/dist/core/graph/names.d.ts +1 -1
  17. package/dist/core/graph/names.js +10 -10
  18. package/dist/core/help.js +2 -2
  19. package/dist/core/permissions/ceiling.d.ts +1 -1
  20. package/dist/core/permissions/evaluator.d.ts +4 -6
  21. package/dist/core/permissions/evaluator.js +2 -2
  22. package/dist/core/runtime/broker/client-registry.d.ts +2 -2
  23. package/dist/core/runtime/broker/client-registry.js +1 -1
  24. package/dist/core/runtime/broker-protocol.d.ts +8 -10
  25. package/dist/core/runtime/broker-protocol.js +3 -3
  26. package/dist/core/runtime/broker-wedge.d.ts +20 -0
  27. package/dist/core/runtime/broker-wedge.js +2 -0
  28. package/dist/core/runtime/broker.js +1 -1
  29. package/dist/core/runtime/host.js +3 -3
  30. package/dist/core/runtime/runner/machine/call.js +1 -1
  31. package/dist/core/runtime/runner/machine/executor.js +1 -1
  32. package/dist/core/runtime/runner/machine/machine-executor.test.js +2 -2
  33. package/dist/core/runtime/runner/machine/ops.d.ts +1 -14
  34. package/dist/core/runtime/runner/machine/ops.js +1 -1
  35. package/dist/core/substrate/delivery/corpus.js +2 -2
  36. package/dist/daemon/api/handlers/nodes.js +1 -1
  37. package/dist/daemon/api/handlers/objects.js +3 -3
  38. package/dist/daemon/api/map.js +2 -2
  39. package/dist/daemon/api/operations.js +1 -1
  40. package/dist/daemon/machine-daemon.js +1 -1
  41. package/dist/daemon/machine-link/client.d.ts +14 -2
  42. package/dist/daemon/machine-link/client.js +1 -1
  43. package/dist/daemon/machine-link/frames.d.ts +38 -0
  44. package/dist/daemon/machine-link/frames.js +1 -1
  45. package/dist/daemon/machine-link/holder.d.ts +8 -0
  46. package/dist/daemon/machine-link/holder.js +5 -4
  47. package/dist/daemon/machine-supervision.d.ts +17 -0
  48. package/dist/daemon/machine-supervision.js +1 -0
  49. package/dist/daemon/reconcilers/broker-supervision.d.ts +11 -14
  50. package/dist/daemon/reconcilers/broker-supervision.js +3 -4
  51. package/dist/daemon/reconcilers/node-lifecycle/tick.js +1 -1
  52. package/package.json +3 -3
  53. package/packages/crouter-api/dist/api/client.js +4 -0
  54. package/packages/crouter-api/dist/api/contract.js +1 -1
  55. package/packages/crouter-api/dist/api/routes.js +1 -0
  56. package/packages/crouter-api/dist/clients/attach/viewer.js +1 -1
  57. package/packages/crouter-api/dist/commands/node/inspect.js +2 -1
  58. package/packages/crouter-api/dist/commands/node-lifecycle-revive.js +14 -16
  59. package/packages/crouter-api/dist/core/canvas/status-glyph.js +15 -0
  60. package/packages/crouter-api/dist/core/command-plugins/compose.js +5 -0
  61. package/packages/crouter-api/dist/core/command.js +13 -1
  62. package/packages/crouter-api/dist/core/graph/names.js +7 -8
  63. package/packages/crouter-api/dist/core/help.js +1 -1
  64. package/packages/crouter-api/dist/core/permissions/ceiling.js +1 -1
  65. package/packages/crouter-api/dist/core/permissions/evaluator.js +20 -12
  66. package/packages/crouter-api/dist/core/runtime/broker-protocol.js +26 -12
  67. package/packages/crouter-api/dist/core/runtime/broker-wedge.js +99 -0
  68. package/packages/crouter-api/dist/core/runtime/host.js +10 -3
  69. package/packages/crouter-api/dist/core/runtime/runner/machine/call.js +1 -1
  70. package/packages/crouter-api/dist/core/runtime/runner/machine/ops.js +1 -1
  71. package/packages/crouter-api/dist/core/substrate/delivery/corpus.js +3 -3
  72. package/packages/crouter-api/dist/daemon/api/map.js +2 -0
  73. package/packages/crouter-api/dist/daemon/api/operations.js +1 -0
  74. package/packages/crouter-api/dist/daemon/machine-link/frames.js +4 -0
  75. package/packages/crouter-api/dist/daemon/machine-link/holder.js +63 -1
  76. package/packages/crouter-api/dist/daemon/reconcilers/broker-supervision.js +61 -163
  77. package/packages/crouter-api/package.json +1 -1
  78. package/packages/crouter-identity/package.json +1 -1
  79. package/packages/crouter-plugin/package.json +3 -3
  80. package/runtime.lock.json +14 -14
  81. package/dist/daemon/reconcilers/node-lifecycle/machine-sweep.d.ts +0 -5
  82. package/dist/daemon/reconcilers/node-lifecycle/machine-sweep.js +0 -4
@@ -35,12 +35,13 @@ import { applyParkEvent, noticeUnfinishedIdle, parkVerdict } from './live-obliga
35
35
  import { readGoal } from '../../core/runtime/kickoff.js';
36
36
  import { memoryDeniedRecently } from '../../core/runtime/memory-admission.js';
37
37
  import { envNoDaemonAutostart, envTestUnattendedParkMs, parkSummaryGraceMs, envUnattendedParkMs, } from '../../shared/env.js';
38
+ import { KILL_ESCALATE_MS, sampleBrokerTree, wedgeVerdict, WEDGE_QUIET_MS, YIELD_STALL_GRACE_MS, yieldStallVerdict } from '../../core/runtime/broker-wedge.js';
38
39
  const execFileAsync = promisify(execFile);
39
40
  /** A node born with a prompt whose first turn has not opened. The prompt rides the launch argv, so nothing in the mail or the turn rows marks the broker busy. */
40
41
  async function awaitsBirthTurn(nodeId) {
41
42
  return !(await hasAdmittedTurn(nodeId)) && ((await readGoal(nodeId))?.trim() ?? '') !== '';
42
43
  }
43
- /** The node's live execution when its broker runs on a runner this daemon holds no process for (Blaxel). */
44
+ /** The node's live execution when its broker runs on a runner this daemon holds no process for (Blaxel, a Mac). */
44
45
  async function remoteExecutionOf(nodeId) {
45
46
  const execution = await liveExecutionForNode(nodeId);
46
47
  return execution !== null && execution.runner !== 'process' && execution.state === 'running' ? execution : null;
@@ -66,10 +67,6 @@ async function busySinceForIncarnation(row) {
66
67
  return null;
67
68
  return since;
68
69
  }
69
- export const YIELD_STALL_GRACE_MS = 3 * 60_000;
70
- const KILL_ESCALATE_MS = 20_000;
71
- export const WEDGE_QUIET_MS = 20 * 60_000;
72
- export const WEDGE_CPU_MAX_PERCENT = 2;
73
70
  const OVER_CAP_WARN_THROTTLE_MS = 5 * 60_000;
74
71
  /** Whether a fatal provider fault ends the node: a parentless terminal node's run has failed,
75
72
  * and an app run's root (resident, `run_id` = its own id) settles once a model call is finally refused
@@ -97,76 +94,61 @@ export function unattendedParkMsForDaemon() {
97
94
  export function parkSummaryGraceMsForDaemon() {
98
95
  return parkSummaryGraceMs();
99
96
  }
100
- export function yieldStallVerdict(piPidAlive, intent, busy, stalledFor) {
101
- if (piPidAlive !== true)
102
- return 'leave';
103
- if (intent !== 'refresh')
104
- return 'leave';
105
- if (busy)
106
- return 'leave';
107
- if (stalledFor === null || stalledFor < YIELD_STALL_GRACE_MS)
108
- return 'pending';
109
- return 'kill';
97
+ /** The notice for a stuck turn: what the supervisor saw and what it did about it. */
98
+ export function wedgeLabel(who, minutes, hasDescendants, unproven, kicked) {
99
+ const head = `Child wedged — ${who} is alive and mid-turn but has shown NO engine progress for ${minutes}+ minutes and `;
100
+ if (hasDescendants)
101
+ return head + 'its process is near-idle. It will NOT recover on its own — read `crtr canvas read wedged-child-on-runaway-bash` and kill the runaway SUBPROCESS (not this node) so its turn can resume with no lost context.';
102
+ const stalled = 'it has no subprocess to kill (the engine itself stalled). ';
103
+ if (unproven)
104
+ return head + stalled + 'The daemon did not SIGTERM the broker because its PID identity cannot be confirmed alive.';
105
+ if (kicked)
106
+ return head + stalled + 'The daemon sent SIGTERM to the broker and will resume a cleanly aborted session with a continuation, or start a recovery cycle if the abort cannot settle.';
107
+ return head + stalled + 'The daemon attempted SIGTERM to the broker, but the signal call failed.';
110
108
  }
111
- export function wedgeVerdict(input) {
112
- if (!input.busy)
113
- return 'leave';
114
- if (input.quietForMs === null || input.quietForMs < WEDGE_QUIET_MS)
115
- return 'leave';
116
- if (input.cpuPercent === null)
117
- return 'pending';
118
- if (input.hasDescendants !== false && input.cpuPercent > WEDGE_CPU_MAX_PERCENT)
119
- return 'pending';
120
- return 'wedged';
121
- }
122
- function parsePsTree(psOutput) {
123
- const byPid = new Map();
124
- const childrenOf = new Map();
125
- for (const line of psOutput.split('\n')) {
126
- const trimmed = line.trim();
127
- if (trimmed === '')
128
- continue;
129
- const parts = trimmed.split(/\s+/);
130
- if (parts.length < 3)
131
- continue;
132
- const pid = Number(parts[0]);
133
- const ppid = Number(parts[1]);
134
- const pcpu = Number(parts[2]);
135
- if (!Number.isFinite(pid) || !Number.isFinite(ppid) || !Number.isFinite(pcpu))
136
- continue;
137
- byPid.set(pid, pcpu);
138
- const siblings = childrenOf.get(ppid);
139
- if (siblings === undefined)
140
- childrenOf.set(ppid, [pid]);
141
- else
142
- siblings.push(pid);
109
+ /** Record and announce a wedged broker: the event, the fault, and the notice to its managers. */
110
+ export async function reportWedge(id, r) {
111
+ emitEvent({
112
+ level: 'error',
113
+ event: 'broker.wedge.detected',
114
+ ...(isSafeNodeId(id) ? { node_id: id } : {}),
115
+ fields: {
116
+ ...(isSafeNodeId(id) ? {} : { affected_node_id: id }),
117
+ pid: r.pid,
118
+ quiet_ms: r.quietForMs,
119
+ cpu_percent: r.cpuPercent,
120
+ has_descendants: r.hasDescendants,
121
+ kick_attempted: r.kickAttempted,
122
+ kicked: r.kicked,
123
+ ...(r.kickSuppressionReason === null ? {} : { kick_suppression_reason: r.kickSuppressionReason }),
124
+ },
125
+ });
126
+ try {
127
+ await recordFault(id, {
128
+ link: 'daemon→node',
129
+ op: 'engine wedge',
130
+ kind: 'wedged',
131
+ retry: { disposition: 'manual' },
132
+ message: r.label,
133
+ });
143
134
  }
144
- return { byPid, childrenOf };
145
- }
146
- export function sumTreeCpu(psOutput, rootPid) {
147
- const { byPid, childrenOf } = parsePsTree(psOutput);
148
- if (!byPid.has(rootPid))
149
- return null;
150
- let total = 0;
151
- const stack = [rootPid];
152
- const seen = new Set();
153
- while (stack.length > 0) {
154
- const pid = stack.pop();
155
- if (seen.has(pid))
156
- continue;
157
- seen.add(pid);
158
- total += byPid.get(pid) ?? 0;
159
- const kids = childrenOf.get(pid);
160
- if (kids !== undefined)
161
- stack.push(...kids);
135
+ catch (err) {
136
+ emitEvent({
137
+ level: 'error',
138
+ event: 'broker.wedge.fault_record_failed',
139
+ ...(isSafeNodeId(id) ? { node_id: id } : { fields: { affected_node_id: id } }),
140
+ error: err,
141
+ });
162
142
  }
163
- return total;
164
- }
165
- export function treeHasDescendants(psOutput, rootPid) {
166
- const { byPid, childrenOf } = parsePsTree(psOutput);
167
- if (!byPid.has(rootPid))
168
- return null;
169
- return (childrenOf.get(rootPid) ?? []).length > 0;
143
+ await publishNotice(id, 'notice.crash', r.label, {
144
+ reason: 'child-wedged',
145
+ child: id,
146
+ quiet_ms: r.quietForMs,
147
+ cpu_percent: r.cpuPercent,
148
+ kick_attempted: r.kickAttempted,
149
+ kicked: r.kicked,
150
+ ...(r.kickSuppressionReason === null ? {} : { kick_suppression_reason: r.kickSuppressionReason }),
151
+ });
170
152
  }
171
153
  export class BrokerSupervisionReconciler {
172
154
  /** SIGTERM times of yield-stalled brokers this process signalled; the stall's start is `nodes.stall_noticed_at`. */
@@ -175,7 +157,7 @@ export class BrokerSupervisionReconciler {
175
157
  signal;
176
158
  lastOverCapWarnAt = Number.NEGATIVE_INFINITY;
177
159
  constructor(options = {}) {
178
- this.sampleTree = options.readTreeSample ?? ((pid) => this.readTreeSample(pid));
160
+ this.sampleTree = options.readTreeSample ?? sampleBrokerTree;
179
161
  this.signal = options.signal ?? ((pid, signal) => {
180
162
  if (process.platform === 'linux' && existsSync(LAUNCHER_SOCKET)) {
181
163
  if (signal !== 'SIGTERM' && signal !== 'SIGKILL')
@@ -239,7 +221,8 @@ export class BrokerSupervisionReconciler {
239
221
  await this.handleYieldStall(row, entry, ctx.fleet, now);
240
222
  await this.handleWedgeDetection(row, entry, ctx.fleet, now);
241
223
  }
242
- else {
224
+ else if (remote.runner === 'blaxel') {
225
+ // A Mac checks its own brokers' turns (`machine-supervision.ts`).
243
226
  await this.handleRemoteYieldStall(row, remote, now);
244
227
  await this.handleRemoteWedge(row, remote, now);
245
228
  }
@@ -532,7 +515,7 @@ export class BrokerSupervisionReconciler {
532
515
  return;
533
516
  await writeSupervisionMark(id, 'wedge_noticed_at', since);
534
517
  const minutes = Math.round(quietForMs / 60_000);
535
- await this.reportWedge(id, {
518
+ await reportWedge(id, {
536
519
  quietForMs, cpuPercent: null, hasDescendants: null, kickAttempted: false, kicked: false, kickSuppressionReason: 'remote_no_process_evidence', pid: execution.pid,
537
520
  label: `Child wedged — ${fullName(current)} (${id}) runs in a sandbox and is mid-turn but has shown NO engine progress for ${minutes}+ minutes. ` +
538
521
  `The daemon cannot see its processes there, so it did not stop the broker; if it is not running a long command, interrupt or close it.`,
@@ -610,24 +593,6 @@ export class BrokerSupervisionReconciler {
610
593
  return false;
611
594
  }
612
595
  }
613
- async readTreeSample(pid) {
614
- try {
615
- const { stdout } = await execFileAsync('ps', ['-ax', '-o', 'pid=,ppid=,pcpu='], {
616
- encoding: 'utf8',
617
- timeout: 2000,
618
- });
619
- if (typeof stdout !== 'string')
620
- return null;
621
- const cpuPercent = sumTreeCpu(stdout, pid);
622
- const hasDescendants = treeHasDescendants(stdout, pid);
623
- if (cpuPercent === null || hasDescendants === null)
624
- return null;
625
- return { cpuPercent, hasDescendants };
626
- }
627
- catch {
628
- return null;
629
- }
630
- }
631
596
  async handleWedgeDetection(row, entry, fleet, now) {
632
597
  const id = row.node_id;
633
598
  const incarnation = incarnationOf(entry.pid, row.pi_pid_identity);
@@ -657,31 +622,11 @@ export class BrokerSupervisionReconciler {
657
622
  : null;
658
623
  let kickAttempted = false;
659
624
  let kicked = false;
660
- let label;
661
- if (hasDescendants) {
662
- label =
663
- `Child wedged — ${name} (${id}) is alive and mid-turn but has shown NO engine progress for ` +
664
- `${minutes}+ minutes and its process is near-idle. It will NOT recover on its own — read ` +
665
- `\`crtr canvas read wedged-child-on-runaway-bash\` and kill the runaway SUBPROCESS (not this ` +
666
- `node) so its turn can resume with no lost context.`;
667
- }
668
- else if (kickSuppressionReason !== null) {
669
- label =
670
- `Child wedged — ${name} (${id}) is alive and mid-turn but has shown NO engine progress for ` +
671
- `${minutes}+ minutes and it has no subprocess to kill (the engine itself stalled). The daemon did ` +
672
- `not SIGTERM the broker because its PID identity cannot be ` +
673
- `confirmed alive.`;
674
- }
675
- else {
625
+ if (!hasDescendants && kickSuppressionReason === null) {
676
626
  kickAttempted = true;
677
627
  try {
678
628
  await this.signal(entry.pid, 'SIGTERM');
679
629
  kicked = true;
680
- label =
681
- `Child wedged — ${name} (${id}) is alive and mid-turn but has shown NO engine progress for ` +
682
- `${minutes}+ minutes and it has no subprocess to kill (the engine itself stalled). The daemon sent ` +
683
- `SIGTERM to the broker and will resume a cleanly aborted session with a continuation, or start a ` +
684
- `recovery cycle if the abort cannot settle.`;
685
630
  }
686
631
  catch (err) {
687
632
  emitEvent({
@@ -695,60 +640,13 @@ export class BrokerSupervisionReconciler {
695
640
  signal: 'SIGTERM',
696
641
  },
697
642
  });
698
- label =
699
- `Child wedged — ${name} (${id}) is alive and mid-turn but has shown NO engine progress for ` +
700
- `${minutes}+ minutes and it has no subprocess to kill (the engine itself stalled). The daemon ` +
701
- `attempted SIGTERM to the broker, but the signal call failed.`;
702
643
  }
703
644
  }
704
- await this.reportWedge(id, {
645
+ const label = wedgeLabel(`${name} (${id})`, minutes, hasDescendants, kickSuppressionReason !== null, kicked);
646
+ await reportWedge(id, {
705
647
  quietForMs, cpuPercent, hasDescendants, kickAttempted, kicked, kickSuppressionReason, pid: entry.pid, label,
706
648
  });
707
649
  }
708
- /** Record and announce a wedged broker: the event, the fault, and the notice to its managers. */
709
- async reportWedge(id, r) {
710
- emitEvent({
711
- level: 'error',
712
- event: 'broker.wedge.detected',
713
- ...(isSafeNodeId(id) ? { node_id: id } : {}),
714
- fields: {
715
- ...(isSafeNodeId(id) ? {} : { affected_node_id: id }),
716
- pid: r.pid,
717
- quiet_ms: r.quietForMs,
718
- cpu_percent: r.cpuPercent,
719
- has_descendants: r.hasDescendants,
720
- kick_attempted: r.kickAttempted,
721
- kicked: r.kicked,
722
- ...(r.kickSuppressionReason === null ? {} : { kick_suppression_reason: r.kickSuppressionReason }),
723
- },
724
- });
725
- try {
726
- await recordFault(id, {
727
- link: 'daemon→node',
728
- op: 'engine wedge',
729
- kind: 'wedged',
730
- retry: { disposition: 'manual' },
731
- message: r.label,
732
- });
733
- }
734
- catch (err) {
735
- emitEvent({
736
- level: 'error',
737
- event: 'broker.wedge.fault_record_failed',
738
- ...(isSafeNodeId(id) ? { node_id: id } : { fields: { affected_node_id: id } }),
739
- error: err,
740
- });
741
- }
742
- await publishNotice(id, 'notice.crash', r.label, {
743
- reason: 'child-wedged',
744
- child: id,
745
- quiet_ms: r.quietForMs,
746
- cpu_percent: r.cpuPercent,
747
- kick_attempted: r.kickAttempted,
748
- kicked: r.kicked,
749
- ...(r.kickSuppressionReason === null ? {} : { kick_suppression_reason: r.kickSuppressionReason }),
750
- });
751
- }
752
650
  /** Publish a fatal provider fault's notice once per episode and, for a node that settles on it, end the node.
753
651
  * The notices, the `notified_since` mark and the terminal transition commit in one write, so a daemon exit
754
652
  * leaves the fault either fully announced or fully unannounced. The daemon registers this as the announcer
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/api",
3
- "version": "0.3.699",
3
+ "version": "0.3.700",
4
4
  "description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "main": "./dist/api/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/identity",
3
- "version": "0.3.699",
3
+ "version": "0.3.700",
4
4
  "description": "Northlight access-token verification and scope rules",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/plugin",
3
- "version": "0.3.699",
3
+ "version": "0.3.700",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -27,8 +27,8 @@
27
27
  "postpack": "node ../../scripts/pack-minify.mjs postpack packages/crouter-plugin"
28
28
  },
29
29
  "dependencies": {
30
- "@north-light/api": "0.3.699",
31
- "@north-light/identity": "0.3.699"
30
+ "@north-light/api": "0.3.700",
31
+ "@north-light/identity": "0.3.700"
32
32
  },
33
33
  "license": "UNLICENSED",
34
34
  "publishConfig": {
package/runtime.lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@north-light/cli",
3
- "version": "0.3.699",
3
+ "version": "0.3.700",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/cli",
9
- "version": "0.3.699",
9
+ "version": "0.3.700",
10
10
  "hasInstallScript": true,
11
11
  "license": "UNLICENSED",
12
12
  "workspaces": [
@@ -28,8 +28,8 @@
28
28
  "@milkdown/preset-gfm": "^7.22.3",
29
29
  "@milkdown/prose": "^7.22.3",
30
30
  "@milkdown/utils": "^7.22.3",
31
- "@north-light/identity": "0.3.699",
32
- "@north-light/plugin": "0.3.699",
31
+ "@north-light/identity": "0.3.700",
32
+ "@north-light/plugin": "0.3.700",
33
33
  "cron-parser": "^5.6.0",
34
34
  "esbuild": "0.28.2",
35
35
  "jose": "^6.2.12",
@@ -10667,17 +10667,17 @@
10667
10667
  },
10668
10668
  "packages/crouter-api": {
10669
10669
  "name": "@north-light/api",
10670
- "version": "0.3.699",
10670
+ "version": "0.3.700",
10671
10671
  "license": "UNLICENSED"
10672
10672
  },
10673
10673
  "packages/crouter-env-docker": {
10674
10674
  "name": "@north-light/env-docker",
10675
- "version": "0.3.699",
10675
+ "version": "0.3.700",
10676
10676
  "license": "UNLICENSED"
10677
10677
  },
10678
10678
  "packages/crouter-identity": {
10679
10679
  "name": "@north-light/identity",
10680
- "version": "0.3.699",
10680
+ "version": "0.3.700",
10681
10681
  "license": "UNLICENSED",
10682
10682
  "dependencies": {
10683
10683
  "jose": "^6.2.1"
@@ -10685,21 +10685,21 @@
10685
10685
  },
10686
10686
  "packages/crouter-plugin": {
10687
10687
  "name": "@north-light/plugin",
10688
- "version": "0.3.699",
10688
+ "version": "0.3.700",
10689
10689
  "license": "UNLICENSED",
10690
10690
  "dependencies": {
10691
- "@north-light/api": "0.3.699",
10692
- "@north-light/identity": "0.3.699"
10691
+ "@north-light/api": "0.3.700",
10692
+ "@north-light/identity": "0.3.700"
10693
10693
  }
10694
10694
  },
10695
10695
  "packages/crouter-sdk": {
10696
10696
  "name": "@north-light/sdk",
10697
- "version": "0.3.699",
10697
+ "version": "0.3.700",
10698
10698
  "license": "UNLICENSED",
10699
10699
  "dependencies": {
10700
- "@north-light/api": "0.3.699",
10701
- "@north-light/identity": "0.3.699",
10702
- "@north-light/plugin": "0.3.699",
10700
+ "@north-light/api": "0.3.700",
10701
+ "@north-light/identity": "0.3.700",
10702
+ "@north-light/plugin": "0.3.700",
10703
10703
  "jose": "^6.2.1"
10704
10704
  },
10705
10705
  "bin": {
@@ -1,5 +0,0 @@
1
- /** Ends each `running` machine execution whose machine reports no broker for it. The rows are read before the call, so a broker that
2
- * started after the scan is never judged by it (its execution was not yet `running`). An environment whose call fails (offline, lost)
3
- * is left as it is. A node held by an
4
- * import is left to the import. Returns the nodes whose execution this call ended, so the caller can re-read their rows. */
5
- export declare function endGoneMachineExecutions(): Promise<ReadonlySet<string>>;
@@ -1,4 +0,0 @@
1
- var s=Object.defineProperty;var a=(n,o)=>s(n,"name",{value:o,configurable:!0});import{openDb as l}from"../../../core/canvas/db.js";import{endExecution as m}from"../../../core/canvas/executions.js";import{emitEvent as c}from"../../../core/events/emit.js";import{callMachine as f}from"../../../core/runtime/runner/machine/call.js";import{MachineOfflineError as u}from"../../../core/runtime/runner/machine/ops.js";import{importedNodesHeld as p}from"../live-obligation.js";async function y(){const n=new Set;let o,t;try{t=await p(),o=await(await l()).prepare(`SELECT x.execution_id, x.node_id, e.object AS environment
2
- FROM executions x JOIN nodes n ON n.node_id = x.node_id JOIN profiles p ON p.id = n.profile_id
3
- JOIN environments e ON e.object = p.environment_id AND e.kind = 'machine'
4
- WHERE x.state = 'running' AND x.runner = 'machine'`).all()}catch(e){return c({level:"error",event:"execution.machine_check_failed",error:e}),n}const i=new Map;for(const e of o)t.has(e.node_id)||i.set(e.environment,[...i.get(e.environment)??[],e]);return await Promise.all([...i].map(async([e,r])=>{try{await x(e,r,n)}catch(d){c({level:d instanceof u?"debug":"warn",event:"execution.machine_check_failed",fields:{environment:e},error:d})}})),n}a(y,"endGoneMachineExecutions");async function x(n,o,t){const i=new Set((await f(n,"status.all",{})).running.map(e=>e.execution));for(const{execution_id:e,node_id:r}of o)i.has(e)||await m(e,{reason:"lost"})&&(t.add(r),c({level:"warn",event:"execution.lost",node_id:r}))}a(x,"endGoneOn");export{y as endGoneMachineExecutions};