@engenty/wizards-runtime 0.11.7 → 0.11.9

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 (54) hide show
  1. package/apps/runtime/dist/app.js +25 -0
  2. package/apps/runtime/dist/db/client.js +32 -0
  3. package/apps/runtime/dist/db/control-schema.js +2 -0
  4. package/apps/runtime/dist/db/migrations/control/0012_runner_line.sql +1 -0
  5. package/apps/runtime/dist/db/migrations/control/meta/0012_snapshot.json +607 -0
  6. package/apps/runtime/dist/db/migrations/control/meta/_journal.json +7 -0
  7. package/apps/runtime/dist/engine/runner.js +37 -3
  8. package/apps/runtime/dist/env.js +10 -0
  9. package/apps/runtime/dist/files/objects.js +15 -2
  10. package/apps/runtime/dist/health.js +287 -0
  11. package/apps/runtime/dist/index.js +19 -0
  12. package/apps/runtime/dist/open-command.js +31 -0
  13. package/apps/runtime/dist/routes/internal.js +2 -0
  14. package/apps/runtime/dist/tenants/control.js +20 -0
  15. package/apps/web/dist/assets/{AboutDialog-J9rRhJTJ.js → AboutDialog-CVr7-F9d.js} +1 -1
  16. package/apps/web/dist/assets/{ChangelogDialog-D9bBSuLQ.js → ChangelogDialog-BBrbTJvy.js} +1 -1
  17. package/apps/web/dist/assets/{CodeEditor-CiRJjYpm.js → CodeEditor-ydfkafOX.js} +1 -1
  18. package/apps/web/dist/assets/{EditorPage-ChLV09jO.js → EditorPage-Dp9t6JBC.js} +1 -1
  19. package/apps/web/dist/assets/{FlowPreview-QRnLE4JM.js → FlowPreview-CPEK110v.js} +1 -1
  20. package/apps/web/dist/assets/{Harness-dM1CDgnx.js → Harness-BnU7FnhV.js} +1 -1
  21. package/apps/web/dist/assets/{Marketplace-8rU-MhWj.js → Marketplace-_IfcAgYO.js} +2 -2
  22. package/apps/web/dist/assets/{NewWizardChannels--JqgVT-t.js → NewWizardChannels-GqURod9Z.js} +1 -1
  23. package/apps/web/dist/assets/{NewWizardPage-CNv5UuBn.js → NewWizardPage-f7aCNCQz.js} +1 -1
  24. package/apps/web/dist/assets/{OnboardingPage-CDuhfBEI.js → OnboardingPage-B0z2X_4h.js} +1 -1
  25. package/apps/web/dist/assets/{PreviewPane-BsMrHW8b.js → PreviewPane-BC4zFl4u.js} +2 -2
  26. package/apps/web/dist/assets/{ProjectPage-CoVMEoB1.js → ProjectPage-B33OxA3U.js} +1 -1
  27. package/apps/web/dist/assets/PublicRunner-BvIMLJXn.js +1 -0
  28. package/apps/web/dist/assets/{ReadOnly-Ch-ss9Mh.js → ReadOnly-D8H4QIVD.js} +1 -1
  29. package/apps/web/dist/assets/{SettingsPage-CGp6G_fp.js → SettingsPage-cS2n5ThJ.js} +2 -2
  30. package/apps/web/dist/assets/{SetupPage-DgFT_646.js → SetupPage-RemLlEon.js} +1 -1
  31. package/apps/web/dist/assets/{SharePage-CEcFKE3b.js → SharePage-D4upbrdD.js} +1 -1
  32. package/apps/web/dist/assets/changelog-DicAdDi2.js +1 -0
  33. package/apps/web/dist/assets/i18n-BX8GnEZT.js +55 -0
  34. package/apps/web/dist/assets/{index-Dx7qMiM3.js → index-EkjeX2z-.js} +5 -5
  35. package/apps/web/dist/assets/{phone-De-HF0g7.js → phone-Dd7IVbpJ.js} +1 -1
  36. package/apps/web/dist/assets/{runners-UIPj9xyX.js → runners-XifDCQG3.js} +1 -1
  37. package/apps/web/dist/assets/{session-DUxZmhqy.js → session-BwtsznZF.js} +1 -1
  38. package/apps/web/dist/assets/{settings-menu-Bo1yXMGF.js → settings-menu-CS-fXrFW.js} +1 -1
  39. package/apps/web/dist/assets/{theme-CSuPPxre.js → theme-s9XywvSy.js} +2 -2
  40. package/apps/web/dist/assets/{ui-CBDsXUoA.js → ui-D719V_Yj.js} +1 -1
  41. package/apps/web/dist/assets/{upload-CZgdEF60.js → upload-CYTDCrYd.js} +1 -1
  42. package/apps/web/dist/assets/{useMutation-ZHWqRSPd.js → useMutation-CVVmJvyz.js} +1 -1
  43. package/apps/web/dist/assets/{volume-2-c641MxaU.js → volume-2-Do0dsjv2.js} +1 -1
  44. package/apps/web/dist/assets/{wrench-DCEAyYuR.js → wrench-C5syJD9J.js} +1 -1
  45. package/apps/web/dist/index.html +7 -7
  46. package/apps/web/dist/mcp/flow.html +2 -2
  47. package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +3 -1
  48. package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +2 -0
  49. package/package.json +1 -1
  50. package/plugin/.claude-plugin/plugin.json +1 -1
  51. package/plugin/plugin.json +1 -1
  52. package/apps/web/dist/assets/PublicRunner-Ckte5NnM.js +0 -1
  53. package/apps/web/dist/assets/changelog-DMhLfQmS.js +0 -1
  54. package/apps/web/dist/assets/i18n-AXoEWXfv.js +0 -55
@@ -0,0 +1,607 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "5de988ff-121e-486e-a4e0-f72edfd99e5b",
5
+ "prevId": "cd0df8b8-dd0c-4fd5-be9f-ef4b283849a9",
6
+ "tables": {
7
+ "link": {
8
+ "name": "link",
9
+ "columns": {
10
+ "token": {
11
+ "name": "token",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "tenant_id": {
18
+ "name": "tenant_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "kind": {
25
+ "name": "kind",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "ref": {
32
+ "name": "ref",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false
37
+ },
38
+ "created_at": {
39
+ "name": "created_at",
40
+ "type": "integer",
41
+ "primaryKey": false,
42
+ "notNull": true,
43
+ "autoincrement": false,
44
+ "default": "(unixepoch() * 1000)"
45
+ }
46
+ },
47
+ "indexes": {
48
+ "link_tenant": {
49
+ "name": "link_tenant",
50
+ "columns": [
51
+ "tenant_id"
52
+ ],
53
+ "isUnique": false
54
+ },
55
+ "link_ref": {
56
+ "name": "link_ref",
57
+ "columns": [
58
+ "kind",
59
+ "ref"
60
+ ],
61
+ "isUnique": false
62
+ }
63
+ },
64
+ "foreignKeys": {},
65
+ "compositePrimaryKeys": {},
66
+ "uniqueConstraints": {},
67
+ "checkConstraints": {}
68
+ },
69
+ "marketplace_cache": {
70
+ "name": "marketplace_cache",
71
+ "columns": {
72
+ "id": {
73
+ "name": "id",
74
+ "type": "text",
75
+ "primaryKey": true,
76
+ "notNull": true,
77
+ "autoincrement": false
78
+ },
79
+ "hash": {
80
+ "name": "hash",
81
+ "type": "text",
82
+ "primaryKey": false,
83
+ "notNull": true,
84
+ "autoincrement": false
85
+ },
86
+ "entry": {
87
+ "name": "entry",
88
+ "type": "text",
89
+ "primaryKey": false,
90
+ "notNull": true,
91
+ "autoincrement": false
92
+ },
93
+ "fetched_at": {
94
+ "name": "fetched_at",
95
+ "type": "integer",
96
+ "primaryKey": false,
97
+ "notNull": true,
98
+ "autoincrement": false,
99
+ "default": "(unixepoch() * 1000)"
100
+ }
101
+ },
102
+ "indexes": {},
103
+ "foreignKeys": {},
104
+ "compositePrimaryKeys": {},
105
+ "uniqueConstraints": {},
106
+ "checkConstraints": {}
107
+ },
108
+ "plugin_address": {
109
+ "name": "plugin_address",
110
+ "columns": {
111
+ "ref": {
112
+ "name": "ref",
113
+ "type": "text",
114
+ "primaryKey": true,
115
+ "notNull": true,
116
+ "autoincrement": false
117
+ },
118
+ "tenant_id": {
119
+ "name": "tenant_id",
120
+ "type": "text",
121
+ "primaryKey": false,
122
+ "notNull": true,
123
+ "autoincrement": false
124
+ },
125
+ "plugin": {
126
+ "name": "plugin",
127
+ "type": "text",
128
+ "primaryKey": false,
129
+ "notNull": true,
130
+ "autoincrement": false
131
+ },
132
+ "created_at": {
133
+ "name": "created_at",
134
+ "type": "integer",
135
+ "primaryKey": false,
136
+ "notNull": true,
137
+ "autoincrement": false,
138
+ "default": "(unixepoch() * 1000)"
139
+ }
140
+ },
141
+ "indexes": {
142
+ "plugin_address_tenant": {
143
+ "name": "plugin_address_tenant",
144
+ "columns": [
145
+ "tenant_id",
146
+ "plugin"
147
+ ],
148
+ "isUnique": true
149
+ }
150
+ },
151
+ "foreignKeys": {},
152
+ "compositePrimaryKeys": {},
153
+ "uniqueConstraints": {},
154
+ "checkConstraints": {}
155
+ },
156
+ "plugin_claim": {
157
+ "name": "plugin_claim",
158
+ "columns": {
159
+ "plugin": {
160
+ "name": "plugin",
161
+ "type": "text",
162
+ "primaryKey": false,
163
+ "notNull": true,
164
+ "autoincrement": false
165
+ },
166
+ "key": {
167
+ "name": "key",
168
+ "type": "text",
169
+ "primaryKey": false,
170
+ "notNull": true,
171
+ "autoincrement": false
172
+ },
173
+ "tenant_id": {
174
+ "name": "tenant_id",
175
+ "type": "text",
176
+ "primaryKey": false,
177
+ "notNull": true,
178
+ "autoincrement": false
179
+ },
180
+ "updated_at": {
181
+ "name": "updated_at",
182
+ "type": "integer",
183
+ "primaryKey": false,
184
+ "notNull": true,
185
+ "autoincrement": false,
186
+ "default": "(unixepoch() * 1000)"
187
+ }
188
+ },
189
+ "indexes": {
190
+ "plugin_claim_tenant": {
191
+ "name": "plugin_claim_tenant",
192
+ "columns": [
193
+ "tenant_id",
194
+ "plugin"
195
+ ],
196
+ "isUnique": false
197
+ }
198
+ },
199
+ "foreignKeys": {},
200
+ "compositePrimaryKeys": {
201
+ "plugin_claim_plugin_key_pk": {
202
+ "columns": [
203
+ "plugin",
204
+ "key"
205
+ ],
206
+ "name": "plugin_claim_plugin_key_pk"
207
+ }
208
+ },
209
+ "uniqueConstraints": {},
210
+ "checkConstraints": {}
211
+ },
212
+ "plugin_job": {
213
+ "name": "plugin_job",
214
+ "columns": {
215
+ "tenant_id": {
216
+ "name": "tenant_id",
217
+ "type": "text",
218
+ "primaryKey": false,
219
+ "notNull": true,
220
+ "autoincrement": false
221
+ },
222
+ "plugin": {
223
+ "name": "plugin",
224
+ "type": "text",
225
+ "primaryKey": false,
226
+ "notNull": true,
227
+ "autoincrement": false
228
+ },
229
+ "name": {
230
+ "name": "name",
231
+ "type": "text",
232
+ "primaryKey": false,
233
+ "notNull": true,
234
+ "autoincrement": false
235
+ },
236
+ "last_run_at": {
237
+ "name": "last_run_at",
238
+ "type": "integer",
239
+ "primaryKey": false,
240
+ "notNull": true,
241
+ "autoincrement": false
242
+ }
243
+ },
244
+ "indexes": {},
245
+ "foreignKeys": {},
246
+ "compositePrimaryKeys": {
247
+ "plugin_job_tenant_id_plugin_name_pk": {
248
+ "columns": [
249
+ "tenant_id",
250
+ "plugin",
251
+ "name"
252
+ ],
253
+ "name": "plugin_job_tenant_id_plugin_name_pk"
254
+ }
255
+ },
256
+ "uniqueConstraints": {},
257
+ "checkConstraints": {}
258
+ },
259
+ "run_index": {
260
+ "name": "run_index",
261
+ "columns": {
262
+ "run_id": {
263
+ "name": "run_id",
264
+ "type": "text",
265
+ "primaryKey": true,
266
+ "notNull": true,
267
+ "autoincrement": false
268
+ },
269
+ "tenant_id": {
270
+ "name": "tenant_id",
271
+ "type": "text",
272
+ "primaryKey": false,
273
+ "notNull": true,
274
+ "autoincrement": false
275
+ },
276
+ "visitor_id": {
277
+ "name": "visitor_id",
278
+ "type": "text",
279
+ "primaryKey": false,
280
+ "notNull": false,
281
+ "autoincrement": false
282
+ },
283
+ "ip_hash": {
284
+ "name": "ip_hash",
285
+ "type": "text",
286
+ "primaryKey": false,
287
+ "notNull": false,
288
+ "autoincrement": false
289
+ },
290
+ "active": {
291
+ "name": "active",
292
+ "type": "integer",
293
+ "primaryKey": false,
294
+ "notNull": true,
295
+ "autoincrement": false,
296
+ "default": false
297
+ },
298
+ "owner": {
299
+ "name": "owner",
300
+ "type": "text",
301
+ "primaryKey": false,
302
+ "notNull": false,
303
+ "autoincrement": false
304
+ },
305
+ "seen": {
306
+ "name": "seen",
307
+ "type": "integer",
308
+ "primaryKey": false,
309
+ "notNull": false,
310
+ "autoincrement": false
311
+ },
312
+ "push": {
313
+ "name": "push",
314
+ "type": "text",
315
+ "primaryKey": false,
316
+ "notNull": false,
317
+ "autoincrement": false
318
+ },
319
+ "created_at": {
320
+ "name": "created_at",
321
+ "type": "integer",
322
+ "primaryKey": false,
323
+ "notNull": true,
324
+ "autoincrement": false,
325
+ "default": "(unixepoch() * 1000)"
326
+ }
327
+ },
328
+ "indexes": {
329
+ "run_index_visitor": {
330
+ "name": "run_index_visitor",
331
+ "columns": [
332
+ "visitor_id",
333
+ "created_at"
334
+ ],
335
+ "isUnique": false
336
+ },
337
+ "run_index_ip": {
338
+ "name": "run_index_ip",
339
+ "columns": [
340
+ "ip_hash",
341
+ "created_at"
342
+ ],
343
+ "isUnique": false
344
+ },
345
+ "run_index_active": {
346
+ "name": "run_index_active",
347
+ "columns": [
348
+ "active",
349
+ "tenant_id"
350
+ ],
351
+ "isUnique": false
352
+ }
353
+ },
354
+ "foreignKeys": {},
355
+ "compositePrimaryKeys": {},
356
+ "uniqueConstraints": {},
357
+ "checkConstraints": {}
358
+ },
359
+ "runner": {
360
+ "name": "runner",
361
+ "columns": {
362
+ "id": {
363
+ "name": "id",
364
+ "type": "text",
365
+ "primaryKey": true,
366
+ "notNull": true,
367
+ "autoincrement": false
368
+ },
369
+ "url": {
370
+ "name": "url",
371
+ "type": "text",
372
+ "primaryKey": false,
373
+ "notNull": false,
374
+ "autoincrement": false
375
+ },
376
+ "seen": {
377
+ "name": "seen",
378
+ "type": "integer",
379
+ "primaryKey": false,
380
+ "notNull": true,
381
+ "autoincrement": false
382
+ },
383
+ "line_at": {
384
+ "name": "line_at",
385
+ "type": "integer",
386
+ "primaryKey": false,
387
+ "notNull": false,
388
+ "autoincrement": false
389
+ }
390
+ },
391
+ "indexes": {},
392
+ "foreignKeys": {},
393
+ "compositePrimaryKeys": {},
394
+ "uniqueConstraints": {},
395
+ "checkConstraints": {}
396
+ },
397
+ "session": {
398
+ "name": "session",
399
+ "columns": {
400
+ "id": {
401
+ "name": "id",
402
+ "type": "text",
403
+ "primaryKey": true,
404
+ "notNull": true,
405
+ "autoincrement": false
406
+ },
407
+ "user_id": {
408
+ "name": "user_id",
409
+ "type": "text",
410
+ "primaryKey": false,
411
+ "notNull": true,
412
+ "autoincrement": false
413
+ },
414
+ "tenant_id": {
415
+ "name": "tenant_id",
416
+ "type": "text",
417
+ "primaryKey": false,
418
+ "notNull": true,
419
+ "autoincrement": false
420
+ },
421
+ "role": {
422
+ "name": "role",
423
+ "type": "text",
424
+ "primaryKey": false,
425
+ "notNull": true,
426
+ "autoincrement": false
427
+ },
428
+ "name": {
429
+ "name": "name",
430
+ "type": "text",
431
+ "primaryKey": false,
432
+ "notNull": true,
433
+ "autoincrement": false
434
+ },
435
+ "email": {
436
+ "name": "email",
437
+ "type": "text",
438
+ "primaryKey": false,
439
+ "notNull": true,
440
+ "autoincrement": false
441
+ },
442
+ "image": {
443
+ "name": "image",
444
+ "type": "text",
445
+ "primaryKey": false,
446
+ "notNull": false,
447
+ "autoincrement": false
448
+ },
449
+ "refresh_token": {
450
+ "name": "refresh_token",
451
+ "type": "text",
452
+ "primaryKey": false,
453
+ "notNull": false,
454
+ "autoincrement": false
455
+ },
456
+ "claims_expire_at": {
457
+ "name": "claims_expire_at",
458
+ "type": "integer",
459
+ "primaryKey": false,
460
+ "notNull": true,
461
+ "autoincrement": false
462
+ },
463
+ "expires_at": {
464
+ "name": "expires_at",
465
+ "type": "integer",
466
+ "primaryKey": false,
467
+ "notNull": true,
468
+ "autoincrement": false
469
+ },
470
+ "created_at": {
471
+ "name": "created_at",
472
+ "type": "integer",
473
+ "primaryKey": false,
474
+ "notNull": true,
475
+ "autoincrement": false,
476
+ "default": "(unixepoch() * 1000)"
477
+ }
478
+ },
479
+ "indexes": {
480
+ "session_expires": {
481
+ "name": "session_expires",
482
+ "columns": [
483
+ "expires_at"
484
+ ],
485
+ "isUnique": false
486
+ }
487
+ },
488
+ "foreignKeys": {},
489
+ "compositePrimaryKeys": {},
490
+ "uniqueConstraints": {},
491
+ "checkConstraints": {}
492
+ },
493
+ "setting": {
494
+ "name": "setting",
495
+ "columns": {
496
+ "key": {
497
+ "name": "key",
498
+ "type": "text",
499
+ "primaryKey": true,
500
+ "notNull": true,
501
+ "autoincrement": false
502
+ },
503
+ "value": {
504
+ "name": "value",
505
+ "type": "text",
506
+ "primaryKey": false,
507
+ "notNull": true,
508
+ "autoincrement": false
509
+ }
510
+ },
511
+ "indexes": {},
512
+ "foreignKeys": {},
513
+ "compositePrimaryKeys": {},
514
+ "uniqueConstraints": {},
515
+ "checkConstraints": {}
516
+ },
517
+ "tenant": {
518
+ "name": "tenant",
519
+ "columns": {
520
+ "id": {
521
+ "name": "id",
522
+ "type": "text",
523
+ "primaryKey": true,
524
+ "notNull": true,
525
+ "autoincrement": false
526
+ },
527
+ "status": {
528
+ "name": "status",
529
+ "type": "text",
530
+ "primaryKey": false,
531
+ "notNull": true,
532
+ "autoincrement": false,
533
+ "default": "'active'"
534
+ },
535
+ "db_url": {
536
+ "name": "db_url",
537
+ "type": "text",
538
+ "primaryKey": false,
539
+ "notNull": false,
540
+ "autoincrement": false
541
+ },
542
+ "created_at": {
543
+ "name": "created_at",
544
+ "type": "integer",
545
+ "primaryKey": false,
546
+ "notNull": true,
547
+ "autoincrement": false,
548
+ "default": "(unixepoch() * 1000)"
549
+ }
550
+ },
551
+ "indexes": {},
552
+ "foreignKeys": {},
553
+ "compositePrimaryKeys": {},
554
+ "uniqueConstraints": {},
555
+ "checkConstraints": {}
556
+ },
557
+ "ui_translation": {
558
+ "name": "ui_translation",
559
+ "columns": {
560
+ "lang": {
561
+ "name": "lang",
562
+ "type": "text",
563
+ "primaryKey": true,
564
+ "notNull": true,
565
+ "autoincrement": false
566
+ },
567
+ "source": {
568
+ "name": "source",
569
+ "type": "text",
570
+ "primaryKey": false,
571
+ "notNull": true,
572
+ "autoincrement": false
573
+ },
574
+ "texts": {
575
+ "name": "texts",
576
+ "type": "text",
577
+ "primaryKey": false,
578
+ "notNull": true,
579
+ "autoincrement": false
580
+ },
581
+ "created_at": {
582
+ "name": "created_at",
583
+ "type": "integer",
584
+ "primaryKey": false,
585
+ "notNull": true,
586
+ "autoincrement": false,
587
+ "default": "(unixepoch() * 1000)"
588
+ }
589
+ },
590
+ "indexes": {},
591
+ "foreignKeys": {},
592
+ "compositePrimaryKeys": {},
593
+ "uniqueConstraints": {},
594
+ "checkConstraints": {}
595
+ }
596
+ },
597
+ "views": {},
598
+ "enums": {},
599
+ "_meta": {
600
+ "schemas": {},
601
+ "tables": {},
602
+ "columns": {}
603
+ },
604
+ "internal": {
605
+ "indexes": {}
606
+ }
607
+ }
@@ -85,6 +85,13 @@
85
85
  "when": 1792568617256,
86
86
  "tag": "0011_model_classes",
87
87
  "breakpoints": true
88
+ },
89
+ {
90
+ "idx": 12,
91
+ "version": "6",
92
+ "when": 1792826011855,
93
+ "tag": "0012_runner_line",
94
+ "breakpoints": true
88
95
  }
89
96
  ]
90
97
  }
@@ -25,7 +25,7 @@ import { switchedOffRunners } from "../services/runners.js";
25
25
  import { storedTranslation } from "../services/translations.js";
26
26
  import { latestShareJob } from "../sharing/state.js";
27
27
  import { listRows, listSecrets, scopeOf } from "../store/index.js";
28
- import { claimRun, disownRuns, heartbeatRuns, indexRun, restRun, waitingRuns, wakeRun, } from "../tenants/control.js";
28
+ import { claimRun, disownRuns, heartbeatRuns, indexRun, markLine, restRun, waitingRuns, wakeRun, } from "../tenants/control.js";
29
29
  import { currentTenant } from "../tenants/tenant.js";
30
30
  import { askPerson, clearStaleAsk } from "./asks.js";
31
31
  import { decide } from "./decide.js";
@@ -270,6 +270,33 @@ async function take(runId, tenant) {
270
270
  }
271
271
  let stopping = false;
272
272
  let looking = false;
273
+ let markedLine = 0;
274
+ let pinged = 0;
275
+ /** Since when this runner waits for the line's query; null while it doesn't. */
276
+ let asking = null;
277
+ /**
278
+ * The runner still looks at the line: `runner.line_at` at most every 10 s, the outside
279
+ * monitor's heartbeat at most once a minute. Driving a run takes as long as its steps, so only
280
+ * a query of the line that never returns stops both (health.ts).
281
+ */
282
+ function lineMoved() {
283
+ const now = Date.now();
284
+ if (asking !== null && now - asking > 30_000) {
285
+ return;
286
+ }
287
+ if (now - markedLine >= 10_000) {
288
+ markedLine = now;
289
+ void markLine().catch((err) => console.warn("[line] marking:", err.message));
290
+ }
291
+ if (env.runner.heartbeatUrl && now - pinged >= 60_000) {
292
+ pinged = now;
293
+ void fetch(env.runner.heartbeatUrl, { signal: AbortSignal.timeout(5000) })
294
+ .then((res) => res.body?.cancel())
295
+ .catch((err) => console.warn("[line] heartbeat:", err.message));
296
+ }
297
+ }
298
+ /** Since when the line's query hangs, when it does: this runner takes no run then (health.ts). */
299
+ export const lineAskedSince = () => asking;
273
300
  /** Takes what waits in line, run by run; each claim counts the tenant's limit by itself. */
274
301
  async function lookAtLine() {
275
302
  if (looking || stopping) {
@@ -277,7 +304,10 @@ async function lookAtLine() {
277
304
  }
278
305
  looking = true;
279
306
  try {
280
- for (const r of await waitingRuns()) {
307
+ asking = Date.now();
308
+ const waiting = await waitingRuns();
309
+ asking = null;
310
+ for (const r of waiting) {
281
311
  if (stopping) {
282
312
  return;
283
313
  }
@@ -285,6 +315,7 @@ async function lookAtLine() {
285
315
  }
286
316
  }
287
317
  catch (err) {
318
+ asking = null;
288
319
  console.error("[line]", err);
289
320
  }
290
321
  finally {
@@ -293,7 +324,10 @@ async function lookAtLine() {
293
324
  }
294
325
  /** A runner: looks at the line every POLL_MS, from now on. Runs a stopped process left behind are in it. */
295
326
  export function startRunner() {
296
- const timer = setInterval(() => void lookAtLine(), POLL_MS);
327
+ const timer = setInterval(() => {
328
+ lineMoved();
329
+ void lookAtLine();
330
+ }, POLL_MS);
297
331
  timer.unref();
298
332
  void lookAtLine();
299
333
  }