@nyte-ai/core 0.0.18 → 0.0.21

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 (186) hide show
  1. package/README.md +1 -1
  2. package/THIRD-PARTY-NOTICES.md +66 -0
  3. package/dist/chunks/{compose-yk3y0jap.js → compose-0m65m83c.js} +7 -7
  4. package/dist/chunks/{compose-r12cnkpc.js → compose-12jnd50a.js} +11 -11
  5. package/dist/chunks/{compose-q1n2dgrs.js → compose-1knxqqm1.js} +4 -4
  6. package/dist/chunks/{compose-xtkavyrw.js → compose-1r0wr5dc.js} +17 -9
  7. package/dist/chunks/{compose-9tqm6g18.js → compose-2rha31fc.js} +4 -4
  8. package/dist/chunks/{compose-0bpspysf.js → compose-4ppmas7g.js} +5 -5
  9. package/dist/chunks/compose-5rg7askh.js +52 -0
  10. package/dist/chunks/{compose-mryw0674.js → compose-5z835ej2.js} +6 -1
  11. package/dist/chunks/{compose-7k6nsmtq.js → compose-6gt28900.js} +11 -14
  12. package/dist/chunks/{compose-2eg8w67t.js → compose-6r5ymwyr.js} +15 -4
  13. package/dist/chunks/{compose-xd0kdp3t.js → compose-753gc057.js} +8 -8
  14. package/dist/chunks/{compose-q1ts0v6k.js → compose-767bb340.js} +1 -1
  15. package/dist/chunks/{compose-rpq9n0nz.js → compose-8mkfr84d.js} +89 -32
  16. package/dist/chunks/{compose-5w5bbakh.js → compose-8pp3vtv0.js} +5 -5
  17. package/dist/chunks/{compose-gaps3heh.js → compose-9hy3p236.js} +9 -9
  18. package/dist/chunks/{compose-pgeemk2b.js → compose-a7k9h27z.js} +6 -5
  19. package/dist/chunks/{compose-dc2ns6gd.js → compose-a8ddt55n.js} +10 -10
  20. package/dist/chunks/{compose-7b8ajk7a.js → compose-ad80nkkn.js} +8 -8
  21. package/dist/chunks/{compose-064y3n82.js → compose-ae5t6v5b.js} +5 -5
  22. package/dist/chunks/{compose-amr0k1m1.js → compose-b2bf1jvy.js} +122 -41
  23. package/dist/chunks/{compose-xpfr4wt3.js → compose-bbhk8vnr.js} +7 -4
  24. package/dist/chunks/compose-bd8c5n7k.js +32 -0
  25. package/dist/chunks/{compose-rehp8epe.js → compose-byse0eqj.js} +7 -7
  26. package/dist/chunks/{compose-ef936rsa.js → compose-bz70g01d.js} +27 -11
  27. package/dist/chunks/compose-c4238qkb.js +105 -0
  28. package/dist/chunks/{compose-q1b0tppc.js → compose-c9wxgbjp.js} +4 -4
  29. package/dist/chunks/{compose-h272znxk.js → compose-cdj05t7x.js} +7 -7
  30. package/dist/chunks/{compose-kb22bkpt.js → compose-cqpjcx2t.js} +12 -1
  31. package/dist/chunks/{compose-dbx6ftbm.js → compose-csh5vv2t.js} +42 -4
  32. package/dist/chunks/{compose-eqr5qwp1.js → compose-d1m94kzq.js} +62 -22
  33. package/dist/chunks/{compose-drdej9yt.js → compose-d95fwwvw.js} +4 -4
  34. package/dist/chunks/{compose-jc22rsz4.js → compose-dbsn3bsy.js} +2 -2
  35. package/dist/chunks/{compose-s2aew2c9.js → compose-e2fyz3xc.js} +5 -5
  36. package/dist/chunks/{compose-gg8b9b21.js → compose-e9f6nrwp.js} +23 -18
  37. package/dist/chunks/{compose-52afaf3v.js → compose-fnncnk81.js} +7 -7
  38. package/dist/chunks/{compose-bjx8s01m.js → compose-fqsqjbrf.js} +1 -1
  39. package/dist/chunks/{compose-1gd9vkye.js → compose-gj2ypr7q.js} +3 -3
  40. package/dist/chunks/compose-gvm49f4b.js +155 -0
  41. package/dist/chunks/{compose-1jz2j92f.js → compose-gxjc6vz9.js} +30 -2
  42. package/dist/chunks/{compose-cq1zx4gp.js → compose-h14pmqv3.js} +1 -1
  43. package/dist/chunks/{compose-d2s80zg2.js → compose-hfrjm4a1.js} +5 -5
  44. package/dist/chunks/{compose-kmzr06mw.js → compose-hfsn6pnt.js} +8 -5
  45. package/dist/chunks/{compose-jjchxce6.js → compose-j42p9wfs.js} +1 -1
  46. package/dist/chunks/{compose-4b1zf3p0.js → compose-jd4bsnqh.js} +63 -47
  47. package/dist/chunks/{compose-2g3enfv5.js → compose-jeemzja1.js} +4 -4
  48. package/dist/chunks/{compose-y478gv6x.js → compose-jmmyw9hd.js} +4 -4
  49. package/dist/chunks/{compose-5tkyrzr0.js → compose-jwy1gba9.js} +4 -4
  50. package/dist/chunks/{compose-k35b75k9.js → compose-kwkna3cg.js} +2 -4
  51. package/dist/chunks/{compose-t53j8yxv.js → compose-m01wspwf.js} +1 -1
  52. package/dist/chunks/{compose-n93897b0.js → compose-m91ffwss.js} +1 -1
  53. package/dist/chunks/{compose-madtxnp1.js → compose-matk94se.js} +7 -7
  54. package/dist/chunks/{compose-aa73dbe8.js → compose-mcz93154.js} +117 -58
  55. package/dist/chunks/{compose-r7dx7rpz.js → compose-mdwr0er9.js} +72 -15
  56. package/dist/chunks/{compose-j12n448k.js → compose-nj4nj5n9.js} +36 -3
  57. package/dist/chunks/{compose-yn2et568.js → compose-nkxwrphm.js} +141 -15
  58. package/dist/chunks/{compose-k8aghhv2.js → compose-pkprmn5b.js} +16 -16
  59. package/dist/chunks/{compose-1z7q169s.js → compose-q2zxbg41.js} +69 -41
  60. package/dist/chunks/{compose-b5xz0dj7.js → compose-qwbe95qs.js} +2 -2
  61. package/dist/chunks/{compose-vmhv4e00.js → compose-qxfq6dn9.js} +13 -12
  62. package/dist/chunks/{compose-wgphshsn.js → compose-r8tz1xfj.js} +8 -8
  63. package/dist/chunks/{compose-ffk8dnbh.js → compose-smsafpqe.js} +3 -3
  64. package/dist/chunks/{compose-djq2bt61.js → compose-sprfv38c.js} +6 -6
  65. package/dist/chunks/{compose-cdy4q5mv.js → compose-t9fcqtby.js} +17 -16
  66. package/dist/chunks/{compose-p3q14yt1.js → compose-tppkp915.js} +5 -5
  67. package/dist/chunks/{compose-dckpgtks.js → compose-ts08bth2.js} +3 -3
  68. package/dist/chunks/{compose-n10w4nkk.js → compose-vn7b7fdj.js} +12 -3
  69. package/dist/chunks/{compose-9m19b27b.js → compose-w6zb11k1.js} +7 -7
  70. package/dist/chunks/{compose-j3tkz0tb.js → compose-wvzzf8n2.js} +6 -6
  71. package/dist/chunks/{compose-6vf6dkk2.js → compose-xhtgytrh.js} +2 -2
  72. package/dist/chunks/{compose-4tb2vn84.js → compose-y6xgbg2h.js} +1 -1
  73. package/dist/chunks/compose-yfcb6w2h.js +58 -0
  74. package/dist/chunks/{compose-0rx7ygxq.js → compose-zaanjpb7.js} +1 -1
  75. package/dist/chunks/{compose-7pc3p5ex.js → compose-zjj072km.js} +8 -8
  76. package/dist/src/agent/compaction.js +41 -39
  77. package/dist/src/agent/images.d.ts +7 -0
  78. package/dist/src/agent/images.js +8 -0
  79. package/dist/src/agent/request.js +30 -30
  80. package/dist/src/agent/tool-runner.d.ts +3 -7
  81. package/dist/src/agent/tool-runner.js +34 -30
  82. package/dist/src/agent/transcript.d.ts +0 -1
  83. package/dist/src/agent/transcript.js +37 -35
  84. package/dist/src/agent/turn.js +46 -43
  85. package/dist/src/api/connection.js +60 -56
  86. package/dist/src/api/head.js +42 -41
  87. package/dist/src/api/part.js +22 -22
  88. package/dist/src/api/server.js +48 -44
  89. package/dist/src/api/session.js +48 -47
  90. package/dist/src/builtins/delegation.js +2 -2
  91. package/dist/src/builtins/environment.js +1 -2
  92. package/dist/src/compose.d.ts +6 -7
  93. package/dist/src/compose.js +72 -67
  94. package/dist/src/contract/fold.d.ts +1 -3
  95. package/dist/src/contract/host.d.ts +30 -1
  96. package/dist/src/contract/host.js +4 -2
  97. package/dist/src/contract/kernel.d.ts +6 -35
  98. package/dist/src/contract/parts.d.ts +4 -0
  99. package/dist/src/contract/parts.js +1 -1
  100. package/dist/src/contract/records.d.ts +69 -3
  101. package/dist/src/contract/records.js +5 -1
  102. package/dist/src/contract/session.d.ts +2 -1
  103. package/dist/src/contract/tools.d.ts +10 -1
  104. package/dist/src/contract/workspace.d.ts +7 -3
  105. package/dist/src/drive/execution.js +46 -42
  106. package/dist/src/drive/interruptions.d.ts +7 -0
  107. package/dist/src/drive/interruptions.js +17 -0
  108. package/dist/src/engine/admission.js +24 -24
  109. package/dist/src/engine/batches.js +22 -22
  110. package/dist/src/engine/branch-summary.js +21 -21
  111. package/dist/src/engine/durable.d.ts +0 -2
  112. package/dist/src/engine/durable.js +20 -20
  113. package/dist/src/engine/fence.js +20 -20
  114. package/dist/src/engine/jobs.d.ts +2 -0
  115. package/dist/src/engine/jobs.js +31 -27
  116. package/dist/src/engine/move.js +23 -23
  117. package/dist/src/engine/part-definitions.js +2 -2
  118. package/dist/src/engine/presence.d.ts +39 -0
  119. package/dist/src/engine/presence.js +16 -0
  120. package/dist/src/engine/principals.js +17 -17
  121. package/dist/src/engine/receipts.js +21 -21
  122. package/dist/src/engine/runs.d.ts +1 -1
  123. package/dist/src/engine/runs.js +25 -25
  124. package/dist/src/engine/start.js +36 -35
  125. package/dist/src/engine/surface.d.ts +4 -0
  126. package/dist/src/engine/surface.js +13 -0
  127. package/dist/src/engine/waits.d.ts +5 -15
  128. package/dist/src/engine/waits.js +23 -19
  129. package/dist/src/env/browser.js +27 -27
  130. package/dist/src/env/environment.js +29 -29
  131. package/dist/src/env/mcp.js +31 -31
  132. package/dist/src/env/session-changes.d.ts +10 -0
  133. package/dist/src/env/session-changes.js +15 -0
  134. package/dist/src/env/trust.js +30 -30
  135. package/dist/src/env/workspaces.js +34 -33
  136. package/dist/src/env/worktrees.js +35 -34
  137. package/dist/src/extend/activation.js +35 -34
  138. package/dist/src/extend/hooks.js +22 -22
  139. package/dist/src/extend/models.d.ts +2 -1
  140. package/dist/src/extend/models.js +32 -30
  141. package/dist/src/extend/plugin-api.js +18 -18
  142. package/dist/src/extend/plugin-runtime.js +42 -41
  143. package/dist/src/extend/registry.js +27 -27
  144. package/dist/src/extend/resources.js +31 -31
  145. package/dist/src/extend/setting-layers.js +4 -4
  146. package/dist/src/extend/settings.js +38 -37
  147. package/dist/src/extend/workspace-commands.js +43 -42
  148. package/dist/src/fold/calls.js +5 -5
  149. package/dist/src/fold/checkpoint.js +11 -11
  150. package/dist/src/fold/code.d.ts +1 -2
  151. package/dist/src/fold/code.js +1 -1
  152. package/dist/src/fold/commit.d.ts +0 -4
  153. package/dist/src/fold/commit.js +16 -16
  154. package/dist/src/fold/draft.js +4 -4
  155. package/dist/src/fold/fold.js +7 -7
  156. package/dist/src/fold/paths.js +5 -5
  157. package/dist/src/fold/project.d.ts +3 -1
  158. package/dist/src/fold/project.js +8 -6
  159. package/dist/src/fold/reads.js +5 -5
  160. package/dist/src/fold/seen.js +19 -19
  161. package/dist/src/fold/view.d.ts +1 -1
  162. package/dist/src/fold/view.js +20 -20
  163. package/dist/src/fold/watch.js +15 -15
  164. package/dist/src/harness.d.ts +3 -1
  165. package/dist/src/harness.js +75 -70
  166. package/dist/src/index.d.ts +3 -3
  167. package/dist/src/index.js +5 -3
  168. package/dist/src/server.js +70 -65
  169. package/dist/src/store/inspect.js +4 -4
  170. package/dist/src/store/log.d.ts +0 -2
  171. package/dist/src/store/log.js +2 -2
  172. package/dist/src/store/memory-store.js +5 -5
  173. package/dist/src/store/migrations.js +3 -3
  174. package/dist/src/store/model-state.d.ts +6 -1
  175. package/dist/src/store/model-state.js +14 -4
  176. package/dist/src/store/parts.js +5 -5
  177. package/dist/src/store/refs.d.ts +6 -5
  178. package/dist/src/store/refs.js +11 -1
  179. package/dist/src/store/session-index.js +2 -2
  180. package/dist/src/store/session.d.ts +3 -1
  181. package/dist/src/store/session.js +5 -3
  182. package/dist/src/store.d.ts +1 -1
  183. package/dist/src/store.js +11 -7
  184. package/dist/src/testing.d.ts +2 -0
  185. package/dist/src/testing.js +83 -70
  186. package/package.json +4 -4
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  PARTICIPANT_AUTHORITY2
3
- } from "./compose-mryw0674.js";
3
+ } from "./compose-5z835ej2.js";
4
4
  import {
5
5
  decodeRunRecord2,
6
6
  decodeLease2
7
- } from "./compose-1jz2j92f.js";
7
+ } from "./compose-gxjc6vz9.js";
8
+ import {
9
+ dev2
10
+ } from "./compose-n116fnmp.js";
8
11
  import {
9
12
  objectId2
10
13
  } from "./compose-q6c7wswc.js";
11
14
  import {
12
15
  runRef2,
13
16
  leaseRef2
14
- } from "./compose-kb22bkpt.js";
15
- import {
16
- dev2
17
- } from "./compose-n116fnmp.js";
17
+ } from "./compose-cqpjcx2t.js";
18
18
  import {
19
19
  load2,
20
20
  readSession2,
@@ -24,46 +24,57 @@ import {
24
24
  covers2,
25
25
  coveredSessions2,
26
26
  coveredHere2
27
- } from "./compose-n10w4nkk.js";
27
+ } from "./compose-vn7b7fdj.js";
28
28
  import {
29
29
  commit2
30
- } from "./compose-xpfr4wt3.js";
30
+ } from "./compose-bbhk8vnr.js";
31
31
  import {
32
32
  holdLease2
33
33
  } from "./compose-vzvm76dn.js";
34
34
  import {
35
35
  withFold2
36
- } from "./compose-6vf6dkk2.js";
36
+ } from "./compose-xhtgytrh.js";
37
37
  import {
38
38
  loadWaits2,
39
39
  earliestWake2
40
- } from "./compose-ef936rsa.js";
40
+ } from "./compose-bz70g01d.js";
41
41
  import {
42
42
  LEASE_MS2
43
- } from "./compose-rehp8epe.js";
43
+ } from "./compose-byse0eqj.js";
44
44
  import {
45
45
  stopRequested2
46
- } from "./compose-9m19b27b.js";
46
+ } from "./compose-w6zb11k1.js";
47
47
  import {
48
48
  selectRunStart2,
49
49
  landing2
50
- } from "./compose-cdy4q5mv.js";
50
+ } from "./compose-t9fcqtby.js";
51
+ import {
52
+ reapJobs2
53
+ } from "./compose-nkxwrphm.js";
51
54
  import {
52
55
  newRun2,
53
56
  begin2,
54
57
  endRun2
55
- } from "./compose-vmhv4e00.js";
58
+ } from "./compose-qxfq6dn9.js";
56
59
  import {
57
60
  executeCall2,
58
61
  owedCalls2,
59
62
  readToolInput2
60
- } from "./compose-aa73dbe8.js";
63
+ } from "./compose-mcz93154.js";
61
64
  import {
62
65
  recoverMoves2
63
- } from "./compose-madtxnp1.js";
66
+ } from "./compose-matk94se.js";
67
+ import {
68
+ BEAT_MS2
69
+ } from "./compose-gvm49f4b.js";
64
70
  import {
65
71
  recoverStarts2
66
- } from "./compose-dc2ns6gd.js";
72
+ } from "./compose-a8ddt55n.js";
73
+ import {
74
+ crashLooping2,
75
+ parkedFailure2,
76
+ interruption2
77
+ } from "./compose-5rg7askh.js";
67
78
 
68
79
  // src/drive/execution.ts
69
80
  import { asId, SdkError } from "@nyte-ai/schema";
@@ -79,6 +90,7 @@ function createExecutionState2() {
79
90
  driving: new Map,
80
91
  covers: new Map,
81
92
  advancing: new Set,
93
+ undrained: new Set,
82
94
  leaseQueue: keyedSerial(),
83
95
  pending: new Map,
84
96
  summaries: new Set,
@@ -103,11 +115,11 @@ async function cover2(kernel, coverage) {
103
115
  }
104
116
  const released = [];
105
117
  for (const [name, entry] of state.held) {
106
- if (!entry.owners.delete(handle) || entry.owners.size > 0 || state.advancing.has(name))
118
+ if (!entry.owners.delete(handle) || entry.owners.size > 0 || state.advancing.has(name) || state.undrained.has(name))
107
119
  continue;
108
120
  released.push(release(kernel, entry.session, entry.head));
109
121
  }
110
- await Promise.all(released);
122
+ await Promise.allSettled(released);
111
123
  })();
112
124
  return closing;
113
125
  };
@@ -154,7 +166,7 @@ async function advance2(kernel, input) {
154
166
  return report;
155
167
  } finally {
156
168
  state.advancing.delete(name);
157
- if (claimed && (report?.kind !== "continue" || (state.held.get(name)?.owners.size ?? 0) === 0)) {
169
+ if (claimed && !state.undrained.has(name) && (report?.kind !== "continue" || (state.held.get(name)?.owners.size ?? 0) === 0)) {
158
170
  await release(kernel, session, head);
159
171
  if (report?.kind === "idle" && await owed(kernel, session, head))
160
172
  kernel.wakes.notify(session, head);
@@ -169,7 +181,7 @@ async function step(kernel, session, head) {
169
181
  const due = await dueInputs(kernel, session, head);
170
182
  if (due === null)
171
183
  return { kind: "idle" };
172
- const run = await newRun2(kernel.store, session, head, due.origin, due.input.configuration);
184
+ const run = await newRun2(kernel.store, session, head, due.origin, due.input.configuration, due.input.requires ?? kernel.presence?.member.capabilities ?? []);
173
185
  if ((await landing2(kernel, session, head, due.ids, run.view.id, run.updates)).length === 0)
174
186
  return next(kernel, session, head);
175
187
  begin2(kernel, session, run.view);
@@ -183,7 +195,10 @@ async function failStep(kernel, session, head, cause) {
183
195
  await endRun2(kernel, session, live.record.view.id, failed(cause));
184
196
  return next(kernel, session, head);
185
197
  }
186
- async function repair2(kernel, input) {
198
+ function repair2(kernel, input) {
199
+ return owedPage(kernel, input, true);
200
+ }
201
+ async function owedPage(kernel, input, operations) {
187
202
  if (input.cursor !== undefined && !input.cursor.startsWith("work:"))
188
203
  throw new SdkError("invalid", `${input.cursor} is not a recovery cursor`);
189
204
  const limit = Math.max(1, input.limit);
@@ -197,7 +212,7 @@ async function repair2(kernel, input) {
197
212
  for (const session of sessions) {
198
213
  const found = await readSession2(kernel.store, session);
199
214
  if (found !== null)
200
- for (const head of await recover(kernel, session, found.record.heads))
215
+ for (const head of await recover(kernel, session, found.record.heads, operations))
201
216
  runnable.push({ session, head });
202
217
  }
203
218
  for (const entry of runnable)
@@ -209,9 +224,11 @@ async function repair2(kernel, input) {
209
224
  next: refs.length > limit && last !== undefined ? asId(`work:${last}`) : null
210
225
  };
211
226
  }
212
- async function recover(kernel, session, heads) {
213
- await recoverMoves2(kernel, session);
214
- await recoverStarts2(kernel, session);
227
+ async function recover(kernel, session, heads, operations = true) {
228
+ if (operations) {
229
+ await recoverMoves2(kernel, session);
230
+ await recoverStarts2(kernel, session);
231
+ }
215
232
  const runnable = [];
216
233
  for (const head of heads)
217
234
  if (await owed(kernel, session, head.name))
@@ -299,6 +316,29 @@ function driveInProcess2(kernel, coverage) {
299
316
  retries.add(retry);
300
317
  };
301
318
  const dispose = kernel.wakes.subscribe(step);
319
+ let sweeping = false;
320
+ const sweep = async () => {
321
+ if (sweeping || closed)
322
+ return;
323
+ sweeping = true;
324
+ try {
325
+ await covering;
326
+ await kernel.presence?.sweep();
327
+ await kernel.waits.tick(Date.now());
328
+ await reapJobs2(kernel);
329
+ if (coverage.kind === "all") {
330
+ let cursor;
331
+ do {
332
+ cursor = (await owedPage(kernel, { cursor, limit: PAGE }, false)).next ?? undefined;
333
+ } while (cursor !== undefined && !closed);
334
+ }
335
+ } catch (error) {
336
+ dev2("execution", "sweep failed", { error: formatError(error) });
337
+ } finally {
338
+ sweeping = false;
339
+ }
340
+ };
341
+ const sweeper = kernel.presence === null ? null : setInterval(() => void sweep(), BEAT_MS2);
302
342
  if (coverage.kind === "all")
303
343
  (async () => {
304
344
  await covering;
@@ -312,16 +352,17 @@ function driveInProcess2(kernel, coverage) {
312
352
  closing ??= (async () => {
313
353
  closed = true;
314
354
  dispose();
355
+ if (sweeper !== null)
356
+ clearInterval(sweeper);
315
357
  if (timer !== null)
316
358
  clearTimeout(timer);
317
359
  for (const retry of retries)
318
360
  clearTimeout(retry);
319
361
  retries.clear();
320
362
  const state = kernel.executionState;
321
- const aborted = state.closing;
322
- state.closing = new AbortController;
323
- aborted.abort();
363
+ state.closing.abort();
324
364
  await Promise.all(inflight.values());
365
+ state.closing = new AbortController;
325
366
  await covering.then((owned) => owned.close(), () => {
326
367
  return;
327
368
  });
@@ -355,14 +396,20 @@ async function claimNow(kernel, session, head) {
355
396
  }
356
397
  const lease = ref?.target ? decodeLease2(await kernel.store.objects.get(ref.target)) : null;
357
398
  const now = Date.now();
358
- if (mine === undefined && lease !== null && (lease.holder !== kernel.hostId || lease.instance !== kernel.instance) && lease.expiresAt > now)
399
+ const foreign = mine === undefined && lease !== null && (lease.holder !== kernel.hostId || lease.instance !== kernel.instance);
400
+ const holder = !foreign || kernel.presence === null ? null : await kernel.presence.holder(lease.instance);
401
+ if (foreign && (holder === null || holder.kind === "absent") && lease.expiresAt > now)
359
402
  return { kind: "busy", until: lease.expiresAt };
403
+ if (holder?.kind === "alive")
404
+ return { kind: "busy", until: holder.until };
360
405
  const outcome = await commit2(kernel, [
361
406
  {
362
407
  name,
363
408
  target: await put2(kernel.store, "lease", { holder: kernel.hostId, instance: kernel.instance, expiresAt: now + LEASE_MS2 }, now),
364
409
  expect: ref === null ? "absent" : ref.revision
365
- }
410
+ },
411
+ ...holder?.kind === "dead" ? [{ name: holder.name, target: null, expect: holder.expect }] : [],
412
+ ...foreign ? await interruption2(kernel, session, head) : []
366
413
  ]);
367
414
  dev2("execution", "claim", { session, head, outcome: outcome.kind });
368
415
  if (outcome.kind !== "set") {
@@ -392,6 +439,10 @@ async function settleLive(kernel, session, head, live) {
392
439
  const run = live.record.view.id;
393
440
  if (kernel.executionState.driving.has(run))
394
441
  return await holding(kernel.store, session, live.record) ?? { kind: "idle" };
442
+ if (crashLooping2(live.record)) {
443
+ await endRun2(kernel, session, run, { kind: "failed", failure: parkedFailure2(live.record) });
444
+ return null;
445
+ }
395
446
  if (live.record.stopping) {
396
447
  kernel.runs.start(session, run).abort();
397
448
  await kernel.waits.runStopped(session, run);
@@ -427,7 +478,11 @@ async function holding(store, session, record) {
427
478
  }
428
479
  async function resume(kernel, session, head, run) {
429
480
  const renewal = holdHead(kernel, session, head);
430
- const signal = AbortSignal.any([kernel.runs.start(session, run).signal, renewal.lease.signal]);
481
+ const signal = AbortSignal.any([
482
+ kernel.runs.start(session, run).signal,
483
+ renewal.lease.signal,
484
+ kernel.executionState.closing.signal
485
+ ]);
431
486
  const runtime = kernel.plugins.runtime(session);
432
487
  const release = runtime.hold();
433
488
  const unreadable = [];
@@ -511,6 +566,8 @@ async function drive(kernel, session, head, run) {
511
566
  closing.addEventListener("abort", () => resolve(null), { once: true });
512
567
  });
513
568
  const ended = await Promise.race([turned, closed]);
569
+ if (ended === null && kernel.presence !== null)
570
+ kernel.executionState.undrained.add(leaseRef2(session, head));
514
571
  const stopping = await stopRequested2(kernel.store, session, run.id);
515
572
  const refused = renewal.refused();
516
573
  if (refused !== null) {
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  decodeTrustRecord2
3
- } from "./compose-1jz2j92f.js";
3
+ } from "./compose-gxjc6vz9.js";
4
4
  import {
5
5
  trustRef2,
6
6
  trustTarget2,
7
7
  kvRef2
8
- } from "./compose-kb22bkpt.js";
8
+ } from "./compose-cqpjcx2t.js";
9
9
  import {
10
10
  load2,
11
11
  put2,
12
12
  readKv2
13
- } from "./compose-n10w4nkk.js";
13
+ } from "./compose-vn7b7fdj.js";
14
14
  import {
15
15
  commit2
16
- } from "./compose-xpfr4wt3.js";
16
+ } from "./compose-bbhk8vnr.js";
17
17
  import {
18
18
  workspaceRecords2
19
- } from "./compose-0bpspysf.js";
19
+ } from "./compose-4ppmas7g.js";
20
20
 
21
21
  // src/env/trust.ts
22
22
  import { Value } from "typebox/value";
@@ -1,46 +1,46 @@
1
1
  import {
2
2
  LOCAL2,
3
3
  CORE_CONTEXT2
4
- } from "./compose-mryw0674.js";
4
+ } from "./compose-5z835ej2.js";
5
5
  import {
6
6
  convertJsonSchema2
7
7
  } from "./compose-bj54tkph.js";
8
8
  import {
9
9
  RESERVED_PART_KINDS2
10
- } from "./compose-0rx7ygxq.js";
10
+ } from "./compose-zaanjpb7.js";
11
11
  import {
12
12
  dev2
13
13
  } from "./compose-n116fnmp.js";
14
14
  import {
15
15
  requireSession2,
16
16
  coveredHere2
17
- } from "./compose-n10w4nkk.js";
17
+ } from "./compose-vn7b7fdj.js";
18
18
  import {
19
19
  callable2
20
20
  } from "./compose-ry29956g.js";
21
21
  import {
22
22
  scanResources2
23
- } from "./compose-y478gv6x.js";
23
+ } from "./compose-jmmyw9hd.js";
24
24
  import {
25
25
  activateSession2
26
- } from "./compose-q1n2dgrs.js";
26
+ } from "./compose-1knxqqm1.js";
27
27
  import {
28
28
  corePluginApi2,
29
29
  build2
30
- } from "./compose-q1b0tppc.js";
30
+ } from "./compose-c9wxgbjp.js";
31
31
  import {
32
32
  createHookDispatch2,
33
33
  namesCoreHook2
34
- } from "./compose-2g3enfv5.js";
34
+ } from "./compose-jeemzja1.js";
35
35
  import {
36
36
  createRegistrySet2,
37
37
  publishCatalog2,
38
38
  bumpGeneration2
39
- } from "./compose-064y3n82.js";
39
+ } from "./compose-ae5t6v5b.js";
40
40
  import {
41
41
  settingHandle2,
42
42
  publishSettings2
43
- } from "./compose-xd0kdp3t.js";
43
+ } from "./compose-753gc057.js";
44
44
 
45
45
  // src/extend/plugin-runtime.ts
46
46
  import { SdkError } from "@nyte-ai/schema";
@@ -3,22 +3,22 @@ import {
3
3
  } from "./compose-1c6w12g1.js";
4
4
  import {
5
5
  STORED_RECORD_TYPES2
6
- } from "./compose-1jz2j92f.js";
6
+ } from "./compose-gxjc6vz9.js";
7
7
  import {
8
8
  decodeObject2
9
- } from "./compose-k35b75k9.js";
9
+ } from "./compose-kwkna3cg.js";
10
10
  import {
11
11
  STORE_VERSION2
12
- } from "./compose-j12n448k.js";
12
+ } from "./compose-nj4nj5n9.js";
13
13
  import {
14
14
  dev2
15
15
  } from "./compose-n116fnmp.js";
16
16
  import {
17
17
  FOLD_CODE2
18
- } from "./compose-q1ts0v6k.js";
18
+ } from "./compose-767bb340.js";
19
19
  import {
20
20
  EMPTY_CATALOG2
21
- } from "./compose-7k6nsmtq.js";
21
+ } from "./compose-6gt28900.js";
22
22
 
23
23
  // src/fold/checkpoint.ts
24
24
  import {
@@ -92,6 +92,7 @@ var FoldCheckpointType = Type.Object({
92
92
  covered: Type.Boolean(),
93
93
  configuration: typed()(ConfigurationType),
94
94
  replaced: nullable(Type.Object({ previous: message, stopped: nullable(idSchema()) })),
95
+ requires: nullable(list(Type.String())),
95
96
  landed: nullable(Type.Object({ commit: idSchema(), run: nullable(idSchema()) }))
96
97
  }))),
97
98
  parts: list(entry(idSchema(), typed()(STORED_RECORD_TYPES2.part))),
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  CORE_CONTEXT2,
3
3
  PARTICIPANT_AUTHORITY2
4
- } from "./compose-mryw0674.js";
4
+ } from "./compose-5z835ej2.js";
5
5
  import {
6
6
  sessionRef2,
7
7
  inboxRef2
8
- } from "./compose-kb22bkpt.js";
8
+ } from "./compose-cqpjcx2t.js";
9
9
  import {
10
10
  dev2
11
11
  } from "./compose-n116fnmp.js";
@@ -17,28 +17,28 @@ import {
17
17
  readInbox2,
18
18
  attempt2,
19
19
  sessionEvent2
20
- } from "./compose-n10w4nkk.js";
20
+ } from "./compose-vn7b7fdj.js";
21
21
  import {
22
22
  releaseParts2
23
- } from "./compose-drdej9yt.js";
23
+ } from "./compose-d95fwwvw.js";
24
24
  import {
25
25
  commit2
26
- } from "./compose-xpfr4wt3.js";
26
+ } from "./compose-bbhk8vnr.js";
27
27
  import {
28
28
  withFold2
29
- } from "./compose-6vf6dkk2.js";
29
+ } from "./compose-xhtgytrh.js";
30
30
  import {
31
31
  listSessionWaits2
32
- } from "./compose-ef936rsa.js";
32
+ } from "./compose-bz70g01d.js";
33
33
  import {
34
34
  readmitDeciding2
35
- } from "./compose-cdy4q5mv.js";
35
+ } from "./compose-t9fcqtby.js";
36
36
  import {
37
37
  dropScans2
38
- } from "./compose-y478gv6x.js";
38
+ } from "./compose-jmmyw9hd.js";
39
39
  import {
40
40
  releaseWorktree2
41
- } from "./compose-s2aew2c9.js";
41
+ } from "./compose-e2fyz3xc.js";
42
42
 
43
43
  // src/engine/start.ts
44
44
  import { SdkError } from "@nyte-ai/schema";
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  decodeRunRecord2
3
- } from "./compose-1jz2j92f.js";
3
+ } from "./compose-gxjc6vz9.js";
4
4
  import {
5
5
  parseHeadRef2,
6
6
  headRef2,
7
7
  runRef2
8
- } from "./compose-kb22bkpt.js";
8
+ } from "./compose-cqpjcx2t.js";
9
9
  import {
10
10
  dev2
11
11
  } from "./compose-n116fnmp.js";
12
12
  import {
13
13
  EMPTY_REVISION2,
14
14
  load2
15
- } from "./compose-n10w4nkk.js";
15
+ } from "./compose-vn7b7fdj.js";
16
16
  import {
17
17
  settleAnswersFrom2
18
- } from "./compose-drdej9yt.js";
18
+ } from "./compose-d95fwwvw.js";
19
19
  import {
20
20
  collectSessionEvents2
21
- } from "./compose-k35b75k9.js";
21
+ } from "./compose-kwkna3cg.js";
22
22
  import {
23
23
  tracing2,
24
24
  startSpan2,
@@ -27,13 +27,13 @@ import {
27
27
  import {
28
28
  emptyFold2,
29
29
  fold2
30
- } from "./compose-7k6nsmtq.js";
30
+ } from "./compose-6gt28900.js";
31
31
  import {
32
32
  foldCheckpointing2
33
- } from "./compose-pgeemk2b.js";
33
+ } from "./compose-a7k9h27z.js";
34
34
  import {
35
35
  withPair2
36
- } from "./compose-2eg8w67t.js";
36
+ } from "./compose-6r5ymwyr.js";
37
37
 
38
38
  // src/fold/watch.ts
39
39
  import { asId, asSeq, isJsonObject } from "@nyte-ai/schema";
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  CORE_CONTEXT2
3
- } from "./compose-mryw0674.js";
3
+ } from "./compose-5z835ej2.js";
4
4
  import {
5
5
  MAIN2
6
- } from "./compose-n10w4nkk.js";
6
+ } from "./compose-vn7b7fdj.js";
7
7
  import {
8
8
  convertJsonSchema2
9
9
  } from "./compose-bj54tkph.js";
10
10
  import {
11
11
  sendNow2
12
- } from "./compose-cdy4q5mv.js";
12
+ } from "./compose-t9fcqtby.js";
13
13
  import {
14
14
  callable2
15
15
  } from "./compose-ry29956g.js";
16
16
  import {
17
17
  stepPluginApi2
18
- } from "./compose-q1b0tppc.js";
18
+ } from "./compose-c9wxgbjp.js";
19
19
  import {
20
20
  settingInfos2
21
- } from "./compose-b5xz0dj7.js";
21
+ } from "./compose-qwbe95qs.js";
22
22
 
23
23
  // src/extend/registry.ts
24
24
  import { asId, CLIENT_COMMAND_NAMES, COMMAND_NAME, SdkError } from "@nyte-ai/schema";