bareloop 0.54.1 → 0.55.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/CHANGELOG.md +75 -0
- package/bareloop.context.md +65 -6
- package/package.json +3 -3
- package/src/authorflow.js +148 -46
- package/src/authoring.js +21 -4
- package/src/authorjob.js +82 -3
- package/src/authorreadout.js +20 -3
- package/src/authorrun.js +1 -1
- package/src/authorscout.js +9 -6
- package/src/cardschedule.js +42 -0
- package/src/checkpick.js +576 -0
- package/src/checksuggest.js +28 -0
- package/src/checkwords.js +25 -0
- package/src/cli.js +1 -1
- package/src/config.js +24 -1
- package/src/declaredclose.js +1 -1
- package/src/destpoint.js +149 -0
- package/src/draftspend.js +39 -0
- package/src/factwords.js +14 -1
- package/src/job.js +81 -1
- package/src/jobblock.js +9 -0
- package/src/labelscan.js +11 -0
- package/src/launcher.js +3 -2
- package/src/mcpchecks.js +52 -0
- package/src/mcppick.js +36 -0
- package/src/mcpsources.js +77 -0
- package/src/mcpuse.js +97 -0
- package/src/natural.js +23 -0
- package/src/pagemap.js +5 -2
- package/src/panel/authorroutes.js +90 -15
- package/src/panel/authorsession.js +183 -21
- package/src/panel/index.html +686 -26
- package/src/panel/jobgrid.js +117 -0
- package/src/panel/jobplan.js +31 -15
- package/src/panel/scheduler.js +80 -13
- package/src/panel/schedules.js +189 -28
- package/src/panel/schedulestart.js +44 -13
- package/src/panel/server.js +419 -32
- package/src/panel/settingsroutes.js +133 -3
- package/src/panel/status.js +19 -1
- package/src/panel/tickets.js +44 -0
- package/src/pickrecord.js +145 -0
- package/src/plan.js +31 -2
- package/src/planrun.js +71 -15
- package/src/prcheckout.js +259 -0
- package/src/readshim.js +3 -2
- package/src/revises.js +56 -0
- package/src/rubricstep.js +62 -16
- package/src/run.js +10 -1
- package/src/runexport.js +2 -0
- package/src/runlist.js +3 -2
- package/src/schedulewords.js +46 -4
- package/src/source.js +81 -7
- package/src/stepmcp.js +86 -0
- package/src/ticket.js +113 -0
- package/src/ticketfilter.js +76 -0
- package/src/ticketlabels.js +79 -0
- package/src/ticketmcp.js +111 -0
- package/src/ticketnext.js +35 -0
- package/src/ticketrepo.js +98 -0
- package/src/ticketschedule.js +32 -0
- package/src/ticketshape.js +45 -0
- package/src/tools.js +9 -0
- package/src/trigger.js +14 -2
- package/src/triggerclock.js +7 -3
- package/src/triggerfiles.js +19 -11
- package/src/triggertickets.js +244 -0
- package/src/userrun.js +145 -9
- package/src/validate.js +3 -1
- package/src/worktree.js +43 -1
- package/types/authorflow.d.ts +128 -28
- package/types/authorjob.d.ts +16 -3
- package/types/authorreadout.d.ts +9 -2
- package/types/authorscout.d.ts +4 -2
- package/types/cardschedule.d.ts +24 -0
- package/types/checkpick.d.ts +297 -0
- package/types/checksuggest.d.ts +30 -0
- package/types/checkwords.d.ts +14 -0
- package/types/config.d.ts +7 -0
- package/types/destpoint.d.ts +87 -0
- package/types/draftspend.d.ts +16 -0
- package/types/factwords.d.ts +7 -0
- package/types/job.d.ts +13 -0
- package/types/jobblock.d.ts +9 -0
- package/types/labelscan.d.ts +7 -0
- package/types/launcher.d.ts +2 -2
- package/types/mcpchecks.d.ts +8 -0
- package/types/mcppick.d.ts +33 -0
- package/types/mcpsources.d.ts +51 -0
- package/types/mcpuse.d.ts +15 -0
- package/types/natural.d.ts +2 -0
- package/types/pagemap.d.ts +2 -1
- package/types/panel/authorroutes.d.ts +11 -2
- package/types/panel/authorsession.d.ts +58 -3
- package/types/panel/jobgrid.d.ts +405 -0
- package/types/panel/jobplan.d.ts +10 -4
- package/types/panel/scheduler.d.ts +7 -2
- package/types/panel/schedules.d.ts +124 -4
- package/types/panel/schedulestart.d.ts +21 -3
- package/types/panel/server.d.ts +427 -6
- package/types/panel/settingsroutes.d.ts +4 -2
- package/types/panel/status.d.ts +16 -2
- package/types/panel/tickets.d.ts +61 -0
- package/types/pickrecord.d.ts +88 -0
- package/types/plan.d.ts +1 -0
- package/types/prcheckout.d.ts +151 -0
- package/types/readshim.d.ts +4 -3
- package/types/revises.d.ts +23 -0
- package/types/rubricstep.d.ts +14 -5
- package/types/run.d.ts +18 -1
- package/types/runlist.d.ts +6 -3
- package/types/schedulewords.d.ts +29 -2
- package/types/source.d.ts +40 -4
- package/types/stepmcp.d.ts +40 -0
- package/types/ticket.d.ts +114 -0
- package/types/ticketfilter.d.ts +34 -0
- package/types/ticketlabels.d.ts +44 -0
- package/types/ticketmcp.d.ts +84 -0
- package/types/ticketnext.d.ts +33 -0
- package/types/ticketrepo.d.ts +118 -0
- package/types/ticketschedule.d.ts +21 -0
- package/types/ticketshape.d.ts +37 -0
- package/types/tools.d.ts +1 -0
- package/types/trigger.d.ts +9 -1
- package/types/triggerclock.d.ts +6 -2
- package/types/triggerfiles.d.ts +13 -5
- package/types/triggertickets.d.ts +110 -0
- package/types/userrun.d.ts +50 -0
- package/types/validate.d.ts +1 -0
- package/types/worktree.d.ts +19 -0
|
@@ -14,7 +14,7 @@ export function procStartMs(pid: number, read?: (path: string) => string): numbe
|
|
|
14
14
|
*/
|
|
15
15
|
export function runnerAlive(row: any, nowMs: number): boolean;
|
|
16
16
|
/**
|
|
17
|
-
* @typedef {{runid: string, outcome: string|null, spec: any, records: any[]}} JobRun
|
|
17
|
+
* @typedef {{runid: string, outcome: string|null, spec: any, records: any[], ticket?: number}} JobRun
|
|
18
18
|
* @typedef {{job: string, trigger: import('../trigger.js').Trigger, spec: any, specHash: string, workflowKey: string,
|
|
19
19
|
* originRunid: string, inputsText: string, destination?: string, signedBy: string, signedAt: string}} Schedule
|
|
20
20
|
*/
|
|
@@ -67,7 +67,7 @@ export function createScheduleDoor(deps: {
|
|
|
67
67
|
* `key|outcome|why` (read back from disk, so a restart does not repeat it). RULED 2026-10-14: a busy, monthly or refused
|
|
68
68
|
* fire consumes NOTHING, so the next tick tries again; a spawn error after `beforeSpawn` writes a `released` row (bounded).
|
|
69
69
|
* @param {string} job
|
|
70
|
-
* @param {{kind: 'clock', slot: number, catchUp: boolean, missed: number} | {kind: 'file', path: string, sha: string, size?: number}} cause
|
|
70
|
+
* @param {{kind: 'clock', slot: number, catchUp: boolean, missed: number} | {kind: 'file', path: string, sha: string, size?: number} | {kind: 'ticket', number: number, sha: string, why?: string, anyway?: boolean}} cause
|
|
71
71
|
* @param {{beforeSpawn?: () => void, busy?: boolean}} [hooks] `busy` = the scheduler's one read of the run list this tick
|
|
72
72
|
* @returns {Promise<{outcome: 'busy'|'monthly-exhausted'|'refused'|'started', why?: string, told: boolean, sessionId?: string}>}
|
|
73
73
|
*/
|
|
@@ -81,6 +81,12 @@ export function createScheduleDoor(deps: {
|
|
|
81
81
|
path: string;
|
|
82
82
|
sha: string;
|
|
83
83
|
size?: number;
|
|
84
|
+
} | {
|
|
85
|
+
kind: "ticket";
|
|
86
|
+
number: number;
|
|
87
|
+
sha: string;
|
|
88
|
+
why?: string;
|
|
89
|
+
anyway?: boolean;
|
|
84
90
|
}, hooks?: {
|
|
85
91
|
beforeSpawn?: () => void;
|
|
86
92
|
busy?: boolean;
|
|
@@ -90,7 +96,41 @@ export function createScheduleDoor(deps: {
|
|
|
90
96
|
told: boolean;
|
|
91
97
|
sessionId?: string;
|
|
92
98
|
}>;
|
|
93
|
-
|
|
99
|
+
/**
|
|
100
|
+
* R7, am3 (fwd M13 am3): "Run it anyway" on a ticket while the job's ticket schedule is still OFF (signed with the job, waiting for its first green run): start that ticket's run at
|
|
101
|
+
* once, by hand, with the job's normal cap, after the same busy / monthly / would-accept checks a fire makes. `null` = not this door's case (no ticket schedule, or it is on: the queue
|
|
102
|
+
* takes it, R8). Else `{ok, say}`; a refusal starts nothing and spends $0. It writes NO ledger row: a skipped run never arms the schedule, a green one does (`armFor`).
|
|
103
|
+
* `fromRun` (am3, no ticket schedule at all): the skipped run whose saved signed job is started instead of a schedule's.
|
|
104
|
+
* @param {{job: string, number: number, fromRun?: string}} a
|
|
105
|
+
* @returns {Promise<{ok: boolean, say: string}|null>}
|
|
106
|
+
*/
|
|
107
|
+
startAnyway({ job, number, fromRun }: {
|
|
108
|
+
job: string;
|
|
109
|
+
number: number;
|
|
110
|
+
fromRun?: string;
|
|
111
|
+
}): Promise<{
|
|
112
|
+
ok: boolean;
|
|
113
|
+
say: string;
|
|
114
|
+
} | null>;
|
|
115
|
+
/**
|
|
116
|
+
* R8 (piece 4, `POST /api/author/ticket-anyway`): the ONE door of "Run it anyway" once the person has given a reason (the route checks it). A ticket schedule that is still OFF starts that
|
|
117
|
+
* ticket's run at once ({@link startAnyway}, by hand, no row); one that is ON takes ONE `arrived` row with the reason and `anyway: true` ({@link recordAnyway}), and the queue starts it
|
|
118
|
+
* with `--anyway` under the job's normal cap. A job with NO ticket schedule (am3: for a first ticket this is the only way to run it) starts at once from the skipped run's own saved signed job
|
|
119
|
+
* (`runid`, the grid's skipped row, through the one `startFrom` and the one starter); with no readable job there, or no `runid`, it is refused in words and nothing is written.
|
|
120
|
+
* @param {{job: string, number: number, reason: string, runid?: string}} a
|
|
121
|
+
* @returns {Promise<{ok: boolean, say: string, started?: boolean}>}
|
|
122
|
+
*/
|
|
123
|
+
arriveAnyway({ job, number, reason, runid }: {
|
|
124
|
+
job: string;
|
|
125
|
+
number: number;
|
|
126
|
+
reason: string;
|
|
127
|
+
runid?: string;
|
|
128
|
+
}): Promise<{
|
|
129
|
+
ok: boolean;
|
|
130
|
+
say: string;
|
|
131
|
+
started?: boolean;
|
|
132
|
+
}>;
|
|
133
|
+
greenFor: (job: string, skip?: Set<string>) => {
|
|
94
134
|
ok: true;
|
|
95
135
|
run: JobRun;
|
|
96
136
|
key: string;
|
|
@@ -102,7 +142,8 @@ export function createScheduleDoor(deps: {
|
|
|
102
142
|
baseline?: boolean;
|
|
103
143
|
}) => {
|
|
104
144
|
armed: boolean;
|
|
105
|
-
already
|
|
145
|
+
already?: boolean;
|
|
146
|
+
waiting?: boolean;
|
|
106
147
|
};
|
|
107
148
|
readSchedule: (job: string) => Schedule | null;
|
|
108
149
|
ledgerOf: (job: string) => string;
|
|
@@ -168,6 +209,26 @@ export function createScheduleDoor(deps: {
|
|
|
168
209
|
cancelled?: undefined;
|
|
169
210
|
};
|
|
170
211
|
};
|
|
212
|
+
/**
|
|
213
|
+
* R7 (piece 9, hamr: schedule exactly like fwd): the New job card's Sign & run signs the schedule WITH the job, written OFF. It writes `schedule.json`, a `signed` row and a `waiting`
|
|
214
|
+
* row that remembers the runs the job already had (`before`): only a run that began after this turns the schedule on (`armFor`, the one turn-on), and a skipped run never does.
|
|
215
|
+
* Nothing looks or fires while it waits. $0. A refusal names why and writes nothing. The job is the one just signed, so a job that already has a schedule is refused (the two-click door edits it).
|
|
216
|
+
* @param {{spec: any, specHash: string, trigger: unknown, inputsText: string, destination?: string|null}} o `spec` = the signed spec WITH its `trigger`; `specHash` = the hash the person signed (it must be the spec's own)
|
|
217
|
+
* @returns {{ok: true, hash: string}|{ok: false, say: string}}
|
|
218
|
+
*/
|
|
219
|
+
signWithJob(o: {
|
|
220
|
+
spec: any;
|
|
221
|
+
specHash: string;
|
|
222
|
+
trigger: unknown;
|
|
223
|
+
inputsText: string;
|
|
224
|
+
destination?: string | null;
|
|
225
|
+
}): {
|
|
226
|
+
ok: true;
|
|
227
|
+
hash: string;
|
|
228
|
+
} | {
|
|
229
|
+
ok: false;
|
|
230
|
+
say: string;
|
|
231
|
+
};
|
|
171
232
|
/** Cancel a job's schedule, never refused. @param {string} job @returns {boolean} there was one */
|
|
172
233
|
cancel(job: string): boolean;
|
|
173
234
|
/** Every job with a schedule.json: `{job, dir, schedule}`. One readdir; nothing else read when there is none. */
|
|
@@ -187,10 +248,12 @@ export function createScheduleDoor(deps: {
|
|
|
187
248
|
trigger: null;
|
|
188
249
|
armed: boolean;
|
|
189
250
|
armedAt: null;
|
|
251
|
+
waiting: boolean;
|
|
190
252
|
nextSlotMs: null;
|
|
191
253
|
lastOutcome: null;
|
|
192
254
|
retryInMs: null;
|
|
193
255
|
gaveUp: null;
|
|
256
|
+
lookProblem: null;
|
|
194
257
|
job: string;
|
|
195
258
|
hasGreen: boolean;
|
|
196
259
|
refusal: string | null;
|
|
@@ -199,10 +262,15 @@ export function createScheduleDoor(deps: {
|
|
|
199
262
|
trigger: import("../trigger.js").Trigger;
|
|
200
263
|
armed: boolean;
|
|
201
264
|
armedAt: number | null | undefined;
|
|
265
|
+
waiting: boolean;
|
|
202
266
|
nextSlotMs: number | null;
|
|
203
267
|
lastOutcome: import("../triggerledger.js").LedgerRow | null;
|
|
204
268
|
retryInMs: number | null;
|
|
205
269
|
gaveUp: import("../triggerledger.js").LedgerRow | null;
|
|
270
|
+
lookProblem: {
|
|
271
|
+
at: number;
|
|
272
|
+
why: string;
|
|
273
|
+
} | null;
|
|
206
274
|
job: string;
|
|
207
275
|
hasGreen: boolean;
|
|
208
276
|
refusal: string | null;
|
|
@@ -212,20 +280,29 @@ export function createScheduleDoor(deps: {
|
|
|
212
280
|
trigger: null;
|
|
213
281
|
armed: boolean;
|
|
214
282
|
armedAt: null;
|
|
283
|
+
waiting: boolean;
|
|
215
284
|
nextSlotMs: null;
|
|
216
285
|
lastOutcome: null;
|
|
217
286
|
retryInMs: null;
|
|
218
287
|
gaveUp: null;
|
|
288
|
+
lookProblem: null;
|
|
219
289
|
} | {
|
|
220
290
|
schedule: Schedule;
|
|
221
291
|
trigger: import("../trigger.js").Trigger;
|
|
222
292
|
armed: boolean;
|
|
223
293
|
armedAt: number | null | undefined;
|
|
294
|
+
waiting: boolean;
|
|
224
295
|
nextSlotMs: number | null;
|
|
225
296
|
lastOutcome: import("../triggerledger.js").LedgerRow | null;
|
|
226
297
|
retryInMs: number | null;
|
|
227
298
|
gaveUp: import("../triggerledger.js").LedgerRow | null;
|
|
299
|
+
lookProblem: {
|
|
300
|
+
at: number;
|
|
301
|
+
why: string;
|
|
302
|
+
} | null;
|
|
228
303
|
};
|
|
304
|
+
/** is this job's schedule signed with its job and still off? (the Audit and Job tab read it) @param {string} job */
|
|
305
|
+
isWaiting(job: string): boolean;
|
|
229
306
|
userHome: string;
|
|
230
307
|
/**
|
|
231
308
|
* What the Run tab shows of a job's schedule (A.12: one read of the schedule files and the ledger; the green gate is
|
|
@@ -260,18 +337,32 @@ export function createScheduleDoor(deps: {
|
|
|
260
337
|
weekly: "Every <day> at HH:MM";
|
|
261
338
|
'file-updated': "When <file> is updated";
|
|
262
339
|
'new-file': "When a new file arrives in <folder>";
|
|
340
|
+
'new-ticket': "When a new ticket arrives in <input>";
|
|
263
341
|
}>;
|
|
264
342
|
gaveUpPill: "Check";
|
|
265
343
|
problemNext: "next: fix it in Cancel / modify schedule";
|
|
266
344
|
monthNext: "next: raise the limit in Settings, or it starts on the 1st";
|
|
267
345
|
acceptWaiting: "waiting for your Accept (the next run does not wait)";
|
|
346
|
+
waiting: "Schedule waiting for a green run";
|
|
268
347
|
scheduleGroup: "schedule";
|
|
269
348
|
notGreen: "This job has not had a good run yet. Run it by hand and get it right first; then you can set when it runs. A rubric job also needs your Accept once. Nothing was changed.";
|
|
349
|
+
card: Readonly<{
|
|
350
|
+
label: "Schedule";
|
|
351
|
+
options: Readonly<{
|
|
352
|
+
hand: "By hand";
|
|
353
|
+
'new-ticket': "When a new ticket arrives";
|
|
354
|
+
daily: "Every day at HH:MM";
|
|
355
|
+
}>;
|
|
356
|
+
hint: "off until the first green run, then turns on";
|
|
357
|
+
rubricHint: "off until the first green run is accepted, then turns on";
|
|
358
|
+
ticketHint: "the first run reads the newest ticket at the time it starts; older tickets never run";
|
|
359
|
+
}>;
|
|
270
360
|
stale: "What you were shown is not what is on the card now. Nothing was signed. Look again, then sign.";
|
|
271
361
|
}>;
|
|
272
362
|
text?: undefined;
|
|
273
363
|
next?: undefined;
|
|
274
364
|
nextRed?: undefined;
|
|
365
|
+
waiting?: undefined;
|
|
275
366
|
lastRow?: undefined;
|
|
276
367
|
problem?: undefined;
|
|
277
368
|
nextWords?: undefined;
|
|
@@ -299,19 +390,33 @@ export function createScheduleDoor(deps: {
|
|
|
299
390
|
weekly: "Every <day> at HH:MM";
|
|
300
391
|
'file-updated': "When <file> is updated";
|
|
301
392
|
'new-file': "When a new file arrives in <folder>";
|
|
393
|
+
'new-ticket': "When a new ticket arrives in <input>";
|
|
302
394
|
}>;
|
|
303
395
|
gaveUpPill: "Check";
|
|
304
396
|
problemNext: "next: fix it in Cancel / modify schedule";
|
|
305
397
|
monthNext: "next: raise the limit in Settings, or it starts on the 1st";
|
|
306
398
|
acceptWaiting: "waiting for your Accept (the next run does not wait)";
|
|
399
|
+
waiting: "Schedule waiting for a green run";
|
|
307
400
|
scheduleGroup: "schedule";
|
|
308
401
|
notGreen: "This job has not had a good run yet. Run it by hand and get it right first; then you can set when it runs. A rubric job also needs your Accept once. Nothing was changed.";
|
|
402
|
+
card: Readonly<{
|
|
403
|
+
label: "Schedule";
|
|
404
|
+
options: Readonly<{
|
|
405
|
+
hand: "By hand";
|
|
406
|
+
'new-ticket': "When a new ticket arrives";
|
|
407
|
+
daily: "Every day at HH:MM";
|
|
408
|
+
}>;
|
|
409
|
+
hint: "off until the first green run, then turns on";
|
|
410
|
+
rubricHint: "off until the first green run is accepted, then turns on";
|
|
411
|
+
ticketHint: "the first run reads the newest ticket at the time it starts; older tickets never run";
|
|
412
|
+
}>;
|
|
309
413
|
stale: "What you were shown is not what is on the card now. Nothing was signed. Look again, then sign.";
|
|
310
414
|
}>;
|
|
311
415
|
fromRunid: string;
|
|
312
416
|
text: string | null;
|
|
313
417
|
next: string;
|
|
314
418
|
nextRed: boolean;
|
|
419
|
+
waiting: boolean;
|
|
315
420
|
lastRow: import("../triggerledger.js").LedgerRow | null;
|
|
316
421
|
problem: boolean;
|
|
317
422
|
nextWords: string;
|
|
@@ -328,6 +433,7 @@ export function createScheduleDoor(deps: {
|
|
|
328
433
|
trigger: import("../trigger.js").Trigger | null;
|
|
329
434
|
now: string | null;
|
|
330
435
|
refusal: string | null;
|
|
436
|
+
ticketInputs: string[];
|
|
331
437
|
words: Readonly<{
|
|
332
438
|
byHand: "By hand";
|
|
333
439
|
cancelSchedule: "Cancel schedule";
|
|
@@ -348,13 +454,26 @@ export function createScheduleDoor(deps: {
|
|
|
348
454
|
weekly: "Every <day> at HH:MM";
|
|
349
455
|
'file-updated': "When <file> is updated";
|
|
350
456
|
'new-file': "When a new file arrives in <folder>";
|
|
457
|
+
'new-ticket': "When a new ticket arrives in <input>";
|
|
351
458
|
}>;
|
|
352
459
|
gaveUpPill: "Check";
|
|
353
460
|
problemNext: "next: fix it in Cancel / modify schedule";
|
|
354
461
|
monthNext: "next: raise the limit in Settings, or it starts on the 1st";
|
|
355
462
|
acceptWaiting: "waiting for your Accept (the next run does not wait)";
|
|
463
|
+
waiting: "Schedule waiting for a green run";
|
|
356
464
|
scheduleGroup: "schedule";
|
|
357
465
|
notGreen: "This job has not had a good run yet. Run it by hand and get it right first; then you can set when it runs. A rubric job also needs your Accept once. Nothing was changed.";
|
|
466
|
+
card: Readonly<{
|
|
467
|
+
label: "Schedule";
|
|
468
|
+
options: Readonly<{
|
|
469
|
+
hand: "By hand";
|
|
470
|
+
'new-ticket': "When a new ticket arrives";
|
|
471
|
+
daily: "Every day at HH:MM";
|
|
472
|
+
}>;
|
|
473
|
+
hint: "off until the first green run, then turns on";
|
|
474
|
+
rubricHint: "off until the first green run is accepted, then turns on";
|
|
475
|
+
ticketHint: "the first run reads the newest ticket at the time it starts; older tickets never run";
|
|
476
|
+
}>;
|
|
358
477
|
stale: "What you were shown is not what is on the card now. Nothing was signed. Look again, then sign.";
|
|
359
478
|
}>;
|
|
360
479
|
};
|
|
@@ -397,6 +516,7 @@ export type JobRun = {
|
|
|
397
516
|
outcome: string | null;
|
|
398
517
|
spec: any;
|
|
399
518
|
records: any[];
|
|
519
|
+
ticket?: number;
|
|
400
520
|
};
|
|
401
521
|
export type Schedule = {
|
|
402
522
|
job: string;
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* field must be deep-equal and the workflow key unchanged (F.4): the person signed the SCHEDULE, each fire's hash is
|
|
4
4
|
* derived by code. A clock fire's spec equals the signed spec byte for byte (same hash).
|
|
5
5
|
* @param {{spec: any, specHash: string, workflowKey: string}} schedule
|
|
6
|
-
*
|
|
6
|
+
* A TICKET fire leaves the spec UNCHANGED (hash equal, like a clock fire): the ticket number is per run, never signed, and rides on argv (`--ticket N`).
|
|
7
|
+
* @param {{kind: 'clock'}|{kind: 'file', path: string}|{kind: 'ticket'}} cause
|
|
7
8
|
* @returns {{ok: true, spec: any, hash: string}|{ok: false, why: string}}
|
|
8
9
|
*/
|
|
9
10
|
export function perFireSpec(schedule: {
|
|
@@ -15,6 +16,8 @@ export function perFireSpec(schedule: {
|
|
|
15
16
|
} | {
|
|
16
17
|
kind: "file";
|
|
17
18
|
path: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: "ticket";
|
|
18
21
|
}): {
|
|
19
22
|
ok: true;
|
|
20
23
|
spec: any;
|
|
@@ -55,7 +58,7 @@ export function createStarter(deps: {
|
|
|
55
58
|
/**
|
|
56
59
|
* Cheap, $0, no copy, no session. `{ok: true}` or `{ok: false, why}` (words).
|
|
57
60
|
* @param {string} job
|
|
58
|
-
* @param {{kind: 'clock'} | {kind: 'file', path: string, sha: string}} cause
|
|
61
|
+
* @param {{kind: 'clock'} | {kind: 'file', path: string, sha: string} | {kind: 'ticket', number: number, sha: string, byHand?: boolean, anyway?: boolean, fromRun?: string}} cause `byHand` (R7, am3) = "Run it anyway" while the schedule is still off: no good run exists yet to read the saved job from
|
|
59
62
|
* @returns {{ok: true}|{ok: false, why: string}}
|
|
60
63
|
*/
|
|
61
64
|
wouldAccept(job: string, cause: {
|
|
@@ -64,6 +67,13 @@ export function createStarter(deps: {
|
|
|
64
67
|
kind: "file";
|
|
65
68
|
path: string;
|
|
66
69
|
sha: string;
|
|
70
|
+
} | {
|
|
71
|
+
kind: "ticket";
|
|
72
|
+
number: number;
|
|
73
|
+
sha: string;
|
|
74
|
+
byHand?: boolean;
|
|
75
|
+
anyway?: boolean;
|
|
76
|
+
fromRun?: string;
|
|
67
77
|
}): {
|
|
68
78
|
ok: true;
|
|
69
79
|
} | {
|
|
@@ -73,7 +83,8 @@ export function createStarter(deps: {
|
|
|
73
83
|
/**
|
|
74
84
|
* Start the run. Never throws. `consumed` says whether `beforeSpawn` ran, so the caller knows whether a `released` row is owed.
|
|
75
85
|
* @param {string} job
|
|
76
|
-
* @param {{kind: 'clock', slot: number, catchUp: boolean, missed: number} | {kind: 'file', path: string, sha: string}} cause
|
|
86
|
+
* @param {{kind: 'clock', slot: number, catchUp: boolean, missed: number} | {kind: 'file', path: string, sha: string} | {kind: 'ticket', number: number, sha: string, byHand?: boolean, anyway?: boolean, fromRun?: string}} cause
|
|
87
|
+
* `byHand` (R7, am3): the person's own "Run it anyway" while the schedule is still off - the same path as Sign & run (no review door, no `trigger.json`, `--anyway`), the job's normal cap, no ledger row
|
|
77
88
|
* @param {{beforeSpawn?: () => void}} [hooks]
|
|
78
89
|
* @returns {Promise<{ok: true, sessionId: string, specHash: string, consumed: true}|{ok: false, why: string, consumed: boolean, installNeeded?: true}>}
|
|
79
90
|
*/
|
|
@@ -86,6 +97,13 @@ export function createStarter(deps: {
|
|
|
86
97
|
kind: "file";
|
|
87
98
|
path: string;
|
|
88
99
|
sha: string;
|
|
100
|
+
} | {
|
|
101
|
+
kind: "ticket";
|
|
102
|
+
number: number;
|
|
103
|
+
sha: string;
|
|
104
|
+
byHand?: boolean;
|
|
105
|
+
anyway?: boolean;
|
|
106
|
+
fromRun?: string;
|
|
89
107
|
}, hooks?: {
|
|
90
108
|
beforeSpawn?: () => void;
|
|
91
109
|
}): Promise<{
|