@cat-factory/orchestration 0.64.0 → 0.66.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/dist/container.d.ts +4 -1
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +45 -12
- package/dist/container.js.map +1 -1
- package/dist/modules/execution/ExecutionService.d.ts +9 -1
- package/dist/modules/execution/ExecutionService.d.ts.map +1 -1
- package/dist/modules/execution/ExecutionService.js +9 -1
- package/dist/modules/execution/ExecutionService.js.map +1 -1
- package/dist/modules/execution/RunStateMachine.d.ts +7 -0
- package/dist/modules/execution/RunStateMachine.d.ts.map +1 -1
- package/dist/modules/execution/RunStateMachine.js +8 -0
- package/dist/modules/execution/RunStateMachine.js.map +1 -1
- package/dist/modules/initiative/InitiativeLoopService.d.ts +88 -0
- package/dist/modules/initiative/InitiativeLoopService.d.ts.map +1 -0
- package/dist/modules/initiative/InitiativeLoopService.js +356 -0
- package/dist/modules/initiative/InitiativeLoopService.js.map +1 -0
- package/dist/modules/initiative/InitiativeService.d.ts +31 -1
- package/dist/modules/initiative/InitiativeService.d.ts.map +1 -1
- package/dist/modules/initiative/InitiativeService.js +53 -0
- package/dist/modules/initiative/InitiativeService.js.map +1 -1
- package/dist/modules/initiative/initiative.logic.d.ts +58 -1
- package/dist/modules/initiative/initiative.logic.d.ts.map +1 -1
- package/dist/modules/initiative/initiative.logic.js +157 -0
- package/dist/modules/initiative/initiative.logic.js.map +1 -1
- package/dist/modules/recurring/RecurringPipelineService.d.ts +11 -2
- package/dist/modules/recurring/RecurringPipelineService.d.ts.map +1 -1
- package/dist/modules/recurring/RecurringPipelineService.js +87 -32
- package/dist/modules/recurring/RecurringPipelineService.js.map +1 -1
- package/package.json +10 -10
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { ConflictError, DomainError } from '@cat-factory/kernel';
|
|
2
|
+
import { commitInitiativeTracker } from '@cat-factory/agents';
|
|
3
|
+
import { activeItemCount, allItemsSettled, applyRevertClaim, applySpawnClaim, deriveCurrentPhase, effectiveMaxConcurrent, eligibleItemsToSpawn, reconcileItem, selectInitiativePipeline, } from './initiative.logic.js';
|
|
4
|
+
/**
|
|
5
|
+
* The initiative EXECUTION LOOP (slice 3): the driver that turns an approved plan into a
|
|
6
|
+
* running body of work. The cron/interval sweepers call {@link runDue}; a settling child run
|
|
7
|
+
* pokes {@link pokeForInitiativeBlock} so the loop advances immediately instead of waiting for
|
|
8
|
+
* the next sweep. Each per-initiative {@link tick}:
|
|
9
|
+
*
|
|
10
|
+
* 1. RECONCILE — batch-reads ONLY the spawned task blocks (one chunked `findByIds`, indexed —
|
|
11
|
+
* no N+1, no full-workspace scan) and folds each block's status back onto its item (done +
|
|
12
|
+
* PR link / pr_open / blocked + deviation).
|
|
13
|
+
* 2. COMPLETE — when every item is settled, flip the initiative + its anchor block `done`,
|
|
14
|
+
* re-commit the tracker, and notify.
|
|
15
|
+
* 3. SPAWN — creates task blocks for the eligible `pending` items (current phase, deps met,
|
|
16
|
+
* phase not halted by a blocked sibling) up to the concurrency cap, picking each task's
|
|
17
|
+
* pipeline from the policy rules. Spawning is CLAIM-FIRST: a CAS write records the
|
|
18
|
+
* pre-generated block id BEFORE any side effect, so a concurrent ticker that lost the CAS
|
|
19
|
+
* created nothing (single-writer by construction, exactly like the rest of the entity).
|
|
20
|
+
*
|
|
21
|
+
* Every entity write goes through {@link InitiativeService}'s rev-guarded CAS, so a lost tick is
|
|
22
|
+
* simply abandoned; the next sweep retries. A per-service task-limit `ConflictError` leaves the
|
|
23
|
+
* item `pending` for the next sweep (never `blocked`); a missing pipeline (deleted after ingest)
|
|
24
|
+
* records a deviation + notification and blocks the item — the sweep NEVER throws.
|
|
25
|
+
*/
|
|
26
|
+
export class InitiativeLoopService {
|
|
27
|
+
deps;
|
|
28
|
+
/** In-process re-entrancy guard so a cron sweep + a terminal poke don't double-tick one initiative. */
|
|
29
|
+
ticking = new Set();
|
|
30
|
+
constructor(deps) {
|
|
31
|
+
this.deps = deps;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Tick every `executing` initiative across all workspaces. The cron (Worker) / interval
|
|
35
|
+
* (Node) sweepers call this. Never throws — a per-initiative failure is isolated so one bad
|
|
36
|
+
* initiative can't stall the others. Returns aggregate counts for logging.
|
|
37
|
+
*/
|
|
38
|
+
async runDue(_now) {
|
|
39
|
+
const executing = await this.deps.initiativeRepository.listExecuting();
|
|
40
|
+
let spawned = 0;
|
|
41
|
+
let completed = 0;
|
|
42
|
+
for (const { workspaceId, initiative } of executing) {
|
|
43
|
+
try {
|
|
44
|
+
const result = await this.tick(workspaceId, initiative);
|
|
45
|
+
spawned += result.spawned;
|
|
46
|
+
if (result.completed)
|
|
47
|
+
completed++;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Isolate a bad initiative; the next sweep retries it. (Each entity write is already
|
|
51
|
+
// CAS-guarded, so a partial tick left the entity consistent.)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return { ticked: executing.length, spawned, completed };
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Best-effort single tick for one initiative, triggered when a spawned child run settles (a
|
|
58
|
+
* terminal run / a merge). Fire-and-forget from the caller; swallow errors (the sweep is the
|
|
59
|
+
* backstop). `initiativeBlockId` is the block the settled child carries in its `initiativeId`.
|
|
60
|
+
*/
|
|
61
|
+
async pokeForInitiativeBlock(workspaceId, initiativeBlockId) {
|
|
62
|
+
try {
|
|
63
|
+
const initiative = await this.deps.initiativeRepository.getByBlock(workspaceId, initiativeBlockId);
|
|
64
|
+
if (initiative && initiative.status === 'executing')
|
|
65
|
+
await this.tick(workspaceId, initiative);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// Swallow — the periodic sweep will pick the initiative up.
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async tick(workspaceId, seed) {
|
|
72
|
+
const key = seed.id;
|
|
73
|
+
if (this.ticking.has(key))
|
|
74
|
+
return { spawned: 0, completed: false };
|
|
75
|
+
this.ticking.add(key);
|
|
76
|
+
try {
|
|
77
|
+
// Re-read the freshest entity (the seed may be stale — from listExecuting or a poke).
|
|
78
|
+
let initiative = await this.deps.initiativeRepository.getByBlock(workspaceId, seed.blockId);
|
|
79
|
+
if (!initiative || initiative.status !== 'executing')
|
|
80
|
+
return { spawned: 0, completed: false };
|
|
81
|
+
const startRev = initiative.rev;
|
|
82
|
+
// 1. Reconcile spawned tasks from their blocks — a single batched point-read of ONLY the
|
|
83
|
+
// spawned task blocks (chunked `IN` via `findByIds`, not a full-workspace scan), indexed.
|
|
84
|
+
const blocksById = await this.readSpawnedBlocks(workspaceId, initiative);
|
|
85
|
+
initiative = (await this.reconcile(workspaceId, initiative, blocksById)) ?? initiative;
|
|
86
|
+
// 2. Complete when every item is settled.
|
|
87
|
+
if (allItemsSettled(initiative)) {
|
|
88
|
+
await this.complete(workspaceId, initiative);
|
|
89
|
+
return { spawned: 0, completed: true };
|
|
90
|
+
}
|
|
91
|
+
// 3. Spawn eligible items up to the effective concurrency cap.
|
|
92
|
+
const spawned = await this.spawn(workspaceId, initiative);
|
|
93
|
+
// 4. Best-effort mirror the tracker — ONLY when this tick actually mutated the entity (a
|
|
94
|
+
// reconcile folded a status, or a spawn/claim/block landed → the persisted `rev` moved).
|
|
95
|
+
// An idle tick (spawned tasks still running, nothing to fold) skips it entirely, so an
|
|
96
|
+
// executing initiative waiting on in-flight PRs doesn't hit GitHub every sweep. Never
|
|
97
|
+
// before a DB CAS wins; hash-short-circuited even when it does run.
|
|
98
|
+
await this.recommitTracker(workspaceId, initiative.blockId, startRev).catch(() => { });
|
|
99
|
+
return { spawned, completed: false };
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
this.ticking.delete(key);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Batch-read ONLY the blocks the initiative's items were spawned as (a single chunked `IN`
|
|
107
|
+
* via {@link BlockRepository.findByIds}), indexed by id for the reconcile lookup — never a
|
|
108
|
+
* full-workspace block scan. Empty when no item carries a block link yet.
|
|
109
|
+
*/
|
|
110
|
+
async readSpawnedBlocks(workspaceId, initiative) {
|
|
111
|
+
const ids = (initiative.items ?? []).map((i) => i.blockId).filter((id) => !!id);
|
|
112
|
+
if (ids.length === 0)
|
|
113
|
+
return new Map();
|
|
114
|
+
const found = await this.deps.blockRepository.findByIds(ids);
|
|
115
|
+
return new Map(found.filter((r) => r.workspaceId === workspaceId).map((r) => [r.block.id, r.block]));
|
|
116
|
+
}
|
|
117
|
+
// ---- Reconcile ----------------------------------------------------------
|
|
118
|
+
async reconcile(workspaceId, initiative, blocksById) {
|
|
119
|
+
// Nothing to reconcile unless an actively-spawned item exists.
|
|
120
|
+
const hasActive = (initiative.items ?? []).some((i) => i.blockId && (i.status === 'in_progress' || i.status === 'pr_open'));
|
|
121
|
+
if (!hasActive)
|
|
122
|
+
return null;
|
|
123
|
+
let newlyBlocked = false;
|
|
124
|
+
const updated = await this.deps.initiativeService.update(workspaceId, initiative.blockId, (current) => {
|
|
125
|
+
const items = (current.items ?? []).map((it) => it.blockId ? reconcileItem(it, blocksById.get(it.blockId)) : it);
|
|
126
|
+
const deviations = [...(current.deviations ?? [])];
|
|
127
|
+
for (let i = 0; i < items.length; i++) {
|
|
128
|
+
const before = current.items[i];
|
|
129
|
+
const after = items[i];
|
|
130
|
+
if (after.status === 'blocked' && before.status !== 'blocked') {
|
|
131
|
+
newlyBlocked = true;
|
|
132
|
+
deviations.push({
|
|
133
|
+
id: this.deps.idGenerator.next('idev'),
|
|
134
|
+
at: this.deps.clock.now(),
|
|
135
|
+
itemId: after.id,
|
|
136
|
+
description: `Task for "${after.title}" was blocked; the phase is halted until it is retried or skipped.`,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return { ...current, items, deviations };
|
|
141
|
+
});
|
|
142
|
+
if (newlyBlocked && updated)
|
|
143
|
+
await this.notify(workspaceId, updated, 'item_blocked');
|
|
144
|
+
return updated;
|
|
145
|
+
}
|
|
146
|
+
// ---- Complete -----------------------------------------------------------
|
|
147
|
+
async complete(workspaceId, initiative) {
|
|
148
|
+
const done = await this.deps.initiativeService.update(workspaceId, initiative.blockId, (current) => allItemsSettled(current) && current.status === 'executing'
|
|
149
|
+
? { ...current, status: 'done' }
|
|
150
|
+
: current);
|
|
151
|
+
if (!done || done.status !== 'done')
|
|
152
|
+
return;
|
|
153
|
+
await this.deps.blockRepository.update(workspaceId, done.blockId, {
|
|
154
|
+
status: 'done',
|
|
155
|
+
progress: 1,
|
|
156
|
+
});
|
|
157
|
+
await this.deps.events.boardChanged(workspaceId, 'initiative-complete', done.blockId);
|
|
158
|
+
await this.recommitTracker(workspaceId, done.blockId).catch(() => { });
|
|
159
|
+
await this.notify(workspaceId, done, 'complete');
|
|
160
|
+
}
|
|
161
|
+
// ---- Spawn --------------------------------------------------------------
|
|
162
|
+
async spawn(workspaceId, initiative) {
|
|
163
|
+
const phase = deriveCurrentPhase(initiative);
|
|
164
|
+
if (!phase)
|
|
165
|
+
return 0;
|
|
166
|
+
let slots = effectiveMaxConcurrent(initiative, phase) - activeItemCount(initiative);
|
|
167
|
+
if (slots <= 0)
|
|
168
|
+
return 0;
|
|
169
|
+
const eligible = eligibleItemsToSpawn(initiative);
|
|
170
|
+
if (eligible.length === 0)
|
|
171
|
+
return 0;
|
|
172
|
+
// Resolve the host frame ONCE (invariant across items): spawned tasks live under the
|
|
173
|
+
// initiative's parent service frame (structural containment), linked to the initiative via
|
|
174
|
+
// `initiativeId` (epic-style membership). No frame ⇒ nothing to host the work.
|
|
175
|
+
const anchor = await this.deps.blockRepository.get(workspaceId, initiative.blockId);
|
|
176
|
+
const frame = anchor?.parentId
|
|
177
|
+
? await this.deps.blockRepository.get(workspaceId, anchor.parentId)
|
|
178
|
+
: null;
|
|
179
|
+
if (!frame)
|
|
180
|
+
return 0;
|
|
181
|
+
const serviceId = this.deps.serviceRepository
|
|
182
|
+
? ((await this.deps.serviceRepository.getByFrameBlock(frame.id))?.id ?? null)
|
|
183
|
+
: null;
|
|
184
|
+
let spawned = 0;
|
|
185
|
+
let entity = initiative;
|
|
186
|
+
for (const item of eligible) {
|
|
187
|
+
if (slots <= 0)
|
|
188
|
+
break;
|
|
189
|
+
const result = await this.spawnItem(workspaceId, entity, item, frame, serviceId);
|
|
190
|
+
entity = result.entity;
|
|
191
|
+
if (result.outcome === 'spawned') {
|
|
192
|
+
spawned++;
|
|
193
|
+
slots--;
|
|
194
|
+
}
|
|
195
|
+
else if (result.outcome === 'conflict') {
|
|
196
|
+
// Lost a CAS, or the per-service task limit was hit — abandon the rest of this tick.
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
// 'skipped' (item no longer pending, or blocked on a config problem) — try the next item.
|
|
200
|
+
}
|
|
201
|
+
return spawned;
|
|
202
|
+
}
|
|
203
|
+
async spawnItem(workspaceId, entity, item, frame, serviceId) {
|
|
204
|
+
const policy = entity.policy;
|
|
205
|
+
if (!policy)
|
|
206
|
+
return { outcome: 'skipped', entity };
|
|
207
|
+
// Pick the pipeline first; a missing one is a config problem (a pipeline deleted after
|
|
208
|
+
// ingest) → block the item + deviation + notify, NEVER throw inside the sweep.
|
|
209
|
+
const pipelineId = selectInitiativePipeline(item, policy);
|
|
210
|
+
if (!(await this.deps.pipelineRepository.get(workspaceId, pipelineId))) {
|
|
211
|
+
const blocked = await this.blockItem(workspaceId, entity.blockId, item.id, `Pipeline "${pipelineId}" no longer exists — pick another in the initiative policy.`);
|
|
212
|
+
return { outcome: 'skipped', entity: blocked ?? entity };
|
|
213
|
+
}
|
|
214
|
+
// Claim the item BEFORE any side effect: a CAS write records the pre-generated block id, so
|
|
215
|
+
// a concurrent ticker whose CAS lost created nothing (the winner's claim short-circuits the
|
|
216
|
+
// loser's transform to a no-op).
|
|
217
|
+
const spawnedBlockId = this.deps.idGenerator.next('blk');
|
|
218
|
+
const claimed = await this.deps.initiativeService.update(workspaceId, entity.blockId, (current) => applySpawnClaim(current, item.id, spawnedBlockId));
|
|
219
|
+
if (!claimed)
|
|
220
|
+
return { outcome: 'skipped', entity };
|
|
221
|
+
const claimedItem = (claimed.items ?? []).find((i) => i.id === item.id);
|
|
222
|
+
if (!claimedItem || claimedItem.blockId !== spawnedBlockId) {
|
|
223
|
+
// Another ticker already claimed it (a different block id), or it moved on — skip.
|
|
224
|
+
return { outcome: 'skipped', entity: claimed };
|
|
225
|
+
}
|
|
226
|
+
// The claim won: insert the task block, then start its run.
|
|
227
|
+
const block = this.buildTaskBlock(spawnedBlockId, item, frame, entity.blockId);
|
|
228
|
+
try {
|
|
229
|
+
await this.deps.blockRepository.insert(workspaceId, block, serviceId);
|
|
230
|
+
await this.deps.events.boardChanged(workspaceId, 'block-added', block.id);
|
|
231
|
+
await this.deps.executionService.start(workspaceId, block.id, pipelineId);
|
|
232
|
+
return { outcome: 'spawned', entity: claimed };
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
// Roll back the block, then decide on the item. A per-service task-limit ConflictError is
|
|
236
|
+
// transient → revert the item to `pending` for the next sweep and stop spawning this tick.
|
|
237
|
+
// Any OTHER failure is (likely) a persistent config problem → block + notify so it isn't
|
|
238
|
+
// retried forever.
|
|
239
|
+
await this.deps.blockRepository.deleteMany(workspaceId, [block.id]).catch(() => { });
|
|
240
|
+
const reason = error instanceof DomainError ? error.details?.reason : undefined;
|
|
241
|
+
if (error instanceof ConflictError && reason === 'task_limit_reached') {
|
|
242
|
+
const reverted = await this.deps.initiativeService.update(workspaceId, entity.blockId, (current) => applyRevertClaim(current, item.id, spawnedBlockId));
|
|
243
|
+
return { outcome: 'conflict', entity: reverted ?? claimed };
|
|
244
|
+
}
|
|
245
|
+
const message = error instanceof Error ? error.message : 'Failed to start the task.';
|
|
246
|
+
const blocked = await this.blockItem(workspaceId, entity.blockId, item.id, `Could not start the task: ${message}`);
|
|
247
|
+
return { outcome: 'skipped', entity: blocked ?? claimed };
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/** Build the task block a spawned item runs as (item estimate stamped, `initiativeId` linked). */
|
|
251
|
+
buildTaskBlock(blockId, item, frame, initiativeBlockId) {
|
|
252
|
+
const estimate = estimateForItem(item, this.deps.clock.now());
|
|
253
|
+
return {
|
|
254
|
+
id: blockId,
|
|
255
|
+
title: item.title,
|
|
256
|
+
// Inherit the host frame's (behavioural) repo type, like BoardService.addTask.
|
|
257
|
+
type: frame.type,
|
|
258
|
+
description: item.description,
|
|
259
|
+
position: { x: 24, y: 96 },
|
|
260
|
+
status: 'planned',
|
|
261
|
+
progress: 0,
|
|
262
|
+
dependsOn: [],
|
|
263
|
+
executionId: null,
|
|
264
|
+
level: 'task',
|
|
265
|
+
parentId: frame.id,
|
|
266
|
+
// Epic-style membership so the loop reconciles from the block and the board badges it. The
|
|
267
|
+
// loop OWNS sequencing, so NEVER opt into `autoStartDependents` on a spawned block.
|
|
268
|
+
initiativeId: initiativeBlockId,
|
|
269
|
+
...(estimate ? { estimate } : {}),
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Block an item that could not be spawned (a missing pipeline / a start failure): mark it
|
|
274
|
+
* `blocked`, drop its dangling block link, record a deviation, and raise the notification.
|
|
275
|
+
* The blocked item halts its phase (see `phaseIsHalted`) until a human intervenes.
|
|
276
|
+
*/
|
|
277
|
+
async blockItem(workspaceId, initiativeBlockId, itemId, note) {
|
|
278
|
+
const updated = await this.deps.initiativeService.update(workspaceId, initiativeBlockId, (current) => {
|
|
279
|
+
const items = (current.items ?? []).map((i) => i.id === itemId ? { ...i, status: 'blocked', note, blockId: null } : i);
|
|
280
|
+
const deviations = [
|
|
281
|
+
...(current.deviations ?? []),
|
|
282
|
+
{
|
|
283
|
+
id: this.deps.idGenerator.next('idev'),
|
|
284
|
+
at: this.deps.clock.now(),
|
|
285
|
+
itemId,
|
|
286
|
+
description: note,
|
|
287
|
+
},
|
|
288
|
+
];
|
|
289
|
+
return { ...current, items, deviations };
|
|
290
|
+
});
|
|
291
|
+
if (updated)
|
|
292
|
+
await this.notify(workspaceId, updated, 'item_blocked');
|
|
293
|
+
return updated;
|
|
294
|
+
}
|
|
295
|
+
// ---- Tracker mirror + notifications -------------------------------------
|
|
296
|
+
async recommitTracker(workspaceId, initiativeBlockId, sinceRev) {
|
|
297
|
+
if (!this.deps.resolveRunRepoContext)
|
|
298
|
+
return;
|
|
299
|
+
const initiative = await this.deps.initiativeRepository.getByBlock(workspaceId, initiativeBlockId);
|
|
300
|
+
if (!initiative)
|
|
301
|
+
return;
|
|
302
|
+
// Nothing changed this tick (the persisted rev never moved) ⇒ skip the repo round-trip.
|
|
303
|
+
if (sinceRev !== undefined && initiative.rev === sinceRev)
|
|
304
|
+
return;
|
|
305
|
+
const runRepo = await this.deps.resolveRunRepoContext(workspaceId, initiativeBlockId);
|
|
306
|
+
if (!runRepo)
|
|
307
|
+
return;
|
|
308
|
+
const doc = await commitInitiativeTracker(runRepo.repo, runRepo.baseBranch, initiative, new Date(this.deps.clock.now()));
|
|
309
|
+
// Stamp the committed version/hash back (a content-unchanged tick commits nothing, so the
|
|
310
|
+
// no-change short-circuit means a replay skips this write too). `markExecuting` leaves an
|
|
311
|
+
// already-`executing` status untouched and only writes the `doc` bookkeeping.
|
|
312
|
+
if (doc)
|
|
313
|
+
await this.deps.initiativeService.markExecuting(workspaceId, initiativeBlockId, doc);
|
|
314
|
+
}
|
|
315
|
+
async notify(workspaceId, initiative, reason) {
|
|
316
|
+
if (!this.deps.notificationService)
|
|
317
|
+
return;
|
|
318
|
+
const items = initiative.items ?? [];
|
|
319
|
+
const blocked = items.filter((i) => i.status === 'blocked');
|
|
320
|
+
const input = reason === 'complete'
|
|
321
|
+
? {
|
|
322
|
+
title: `Initiative "${initiative.title}" complete`,
|
|
323
|
+
body: `Every planned task is resolved (${items.length} item${items.length === 1 ? '' : 's'}).`,
|
|
324
|
+
}
|
|
325
|
+
: {
|
|
326
|
+
title: `Initiative "${initiative.title}" needs attention`,
|
|
327
|
+
body: blocked.length === 1
|
|
328
|
+
? `A task was blocked (${blocked[0].title}). Retry or skip it to unblock the phase.`
|
|
329
|
+
: `${blocked.length} tasks are blocked. Retry or skip them to unblock the phase.`,
|
|
330
|
+
};
|
|
331
|
+
await this.deps.notificationService
|
|
332
|
+
.raise(workspaceId, {
|
|
333
|
+
type: 'initiative',
|
|
334
|
+
blockId: initiative.blockId,
|
|
335
|
+
executionId: null,
|
|
336
|
+
title: input.title,
|
|
337
|
+
body: input.body,
|
|
338
|
+
payload: { initiativeReason: reason },
|
|
339
|
+
})
|
|
340
|
+
.catch(() => { });
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
/** Build a {@link TaskEstimate} from an item's planner estimate, stamped for the spawned block. */
|
|
344
|
+
export function estimateForItem(item, now) {
|
|
345
|
+
if (!item.estimate)
|
|
346
|
+
return undefined;
|
|
347
|
+
return {
|
|
348
|
+
complexity: item.estimate.complexity,
|
|
349
|
+
risk: item.estimate.risk,
|
|
350
|
+
impact: item.estimate.impact,
|
|
351
|
+
rationale: item.estimate.rationale ?? '',
|
|
352
|
+
model: 'initiative-planner',
|
|
353
|
+
createdAt: now,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
//# sourceMappingURL=InitiativeLoopService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InitiativeLoopService.js","sourceRoot":"","sources":["../../../src/modules/initiative/InitiativeLoopService.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAI7D,OAAO,EACL,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,aAAa,EACb,wBAAwB,GACzB,MAAM,uBAAuB,CAAA;AA+B9B;;;;;;;;;;;;;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gBAAgB,EAAE,MAAM,EAAE;SACtC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IACpB,CAAC;CACF;AAED,mGAAmG;AACnG,MAAM,UAAU,eAAe,CAAC,IAAoB,EAAE,GAAW;IAC/D,IAAI,CAAC,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAA;IACpC,OAAO;QACL,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU;QACpC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;QACxB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM;QAC5B,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,IAAI,EAAE;QACxC,KAAK,EAAE,oBAAoB;QAC3B,SAAS,EAAE,GAAG;KACf,CAAA;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Block, BlockRepository, Clock, CreateInitiativeInput, ExecutionEventPublisher, IdGenerator, Initiative, InitiativeRepository, WorkspaceRepository } from '@cat-factory/kernel';
|
|
1
|
+
import type { Block, BlockRepository, Clock, CreateInitiativeInput, ExecutionEventPublisher, IdGenerator, Initiative, InitiativeRepository, PipelineRepository, WorkspaceRepository } from '@cat-factory/kernel';
|
|
2
2
|
export interface InitiativeServiceDependencies {
|
|
3
3
|
workspaceRepository: WorkspaceRepository;
|
|
4
4
|
blockRepository: BlockRepository;
|
|
@@ -6,6 +6,13 @@ export interface InitiativeServiceDependencies {
|
|
|
6
6
|
events: ExecutionEventPublisher;
|
|
7
7
|
clock: Clock;
|
|
8
8
|
idGenerator: IdGenerator;
|
|
9
|
+
/**
|
|
10
|
+
* Pipelines, used ONLY to validate the plan's `defaultPipelineId` at ingest (fail the
|
|
11
|
+
* planning run loudly on a plan that names a non-existent pipeline, rather than surfacing
|
|
12
|
+
* it later as a per-item spawn deviation). Optional so a deployment/test without pipelines
|
|
13
|
+
* wired still ingests. A pipeline deleted AFTER ingest is handled by the loop at spawn.
|
|
14
|
+
*/
|
|
15
|
+
pipelineRepository?: PipelineRepository;
|
|
9
16
|
}
|
|
10
17
|
/**
|
|
11
18
|
* The initiative entity's owner: creation (the board block + the entity in one
|
|
@@ -40,6 +47,13 @@ export declare class InitiativeService {
|
|
|
40
47
|
* initiative (nothing to ingest into).
|
|
41
48
|
*/
|
|
42
49
|
ingestPlan(workspaceId: string, blockId: string, rawDraft: unknown): Promise<Initiative | null>;
|
|
50
|
+
/**
|
|
51
|
+
* Fail a plan ingest whose policy names a pipeline that doesn't exist (the default, or a
|
|
52
|
+
* rule/item override) — a plan the loop could never execute. No-op when no pipeline
|
|
53
|
+
* repository is wired (tests/conformance). The loop still guards a pipeline deleted AFTER
|
|
54
|
+
* ingest at spawn time (a deviation + notification, never a throw inside the sweep).
|
|
55
|
+
*/
|
|
56
|
+
private assertPipelinesExist;
|
|
43
57
|
/**
|
|
44
58
|
* Flip an initiative to `executing` (the committer step ran: the plan is
|
|
45
59
|
* approved and the tracker mirror committed), stamping the repo-doc
|
|
@@ -50,6 +64,22 @@ export declare class InitiativeService {
|
|
|
50
64
|
version: number;
|
|
51
65
|
hash: string;
|
|
52
66
|
} | null): Promise<Initiative | null>;
|
|
67
|
+
/**
|
|
68
|
+
* Apply a CAS-guarded transform to the block's initiative — the execution loop's write
|
|
69
|
+
* path. A content-identical transform short-circuits to no write (replay/idempotency);
|
|
70
|
+
* a lost CAS reloads and retries a bounded number of times. Returns the persisted entity,
|
|
71
|
+
* or null when the block has no initiative.
|
|
72
|
+
*/
|
|
73
|
+
update(workspaceId: string, blockId: string, transform: (current: Initiative) => Initiative): Promise<Initiative | null>;
|
|
74
|
+
/** Pause an executing initiative (the sweep skips it; in-flight tasks finish naturally). */
|
|
75
|
+
pause(workspaceId: string, blockId: string): Promise<Initiative | null>;
|
|
76
|
+
/** Resume a paused initiative back to `executing` (the next sweep picks it up). */
|
|
77
|
+
resume(workspaceId: string, blockId: string): Promise<Initiative | null>;
|
|
78
|
+
/**
|
|
79
|
+
* Cancel an initiative: stop spawning further work. Terminal from the loop's view. In-flight
|
|
80
|
+
* spawned tasks are left to finish on their own (cascading their teardown is slice 4).
|
|
81
|
+
*/
|
|
82
|
+
cancel(workspaceId: string, blockId: string): Promise<Initiative | null>;
|
|
53
83
|
/** Append a fresh round of pending interview questions (parks the interview `awaiting`). */
|
|
54
84
|
recordInterviewQuestions(workspaceId: string, blockId: string, questions: string[]): Promise<Initiative | null>;
|
|
55
85
|
/** Record the human's answer to one pending question (no run resume; the controller does that). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitiativeService.d.ts","sourceRoot":"","sources":["../../../src/modules/initiative/InitiativeService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,KAAK,EACL,qBAAqB,EACrB,uBAAuB,EACvB,WAAW,EACX,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,qBAAqB,CAAA;AAe5B,MAAM,WAAW,6BAA6B;IAC5C,mBAAmB,EAAE,mBAAmB,CAAA;IACxC,eAAe,EAAE,eAAe,CAAA;IAChC,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,MAAM,EAAE,uBAAuB,CAAA;IAC/B,KAAK,EAAE,KAAK,CAAA;IACZ,WAAW,EAAE,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"InitiativeService.d.ts","sourceRoot":"","sources":["../../../src/modules/initiative/InitiativeService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,KAAK,EACL,qBAAqB,EACrB,uBAAuB,EACvB,WAAW,EACX,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,qBAAqB,CAAA;AAe5B,MAAM,WAAW,6BAA6B;IAC5C,mBAAmB,EAAE,mBAAmB,CAAA;IACxC,eAAe,EAAE,eAAe,CAAA;IAChC,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,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 export class InitiativeService {
|
|
|
105
105
|
async ingestPlan(workspaceId, blockId, rawDraft) {
|
|
106
106
|
const draft = parseInitiativePlanDraft(rawDraft);
|
|
107
107
|
validatePlanDraft(draft);
|
|
108
|
+
await this.assertPipelinesExist(workspaceId, draft);
|
|
108
109
|
return this.mutate(workspaceId, blockId, (current) => applyPlanDraft(current, draft, this.deps.clock.now()));
|
|
109
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Fail a plan ingest whose policy names a pipeline that doesn't exist (the default, or a
|
|
113
|
+
* rule/item override) — a plan the loop could never execute. No-op when no pipeline
|
|
114
|
+
* repository is wired (tests/conformance). The loop still guards a pipeline deleted AFTER
|
|
115
|
+
* ingest at spawn time (a deviation + notification, never a throw inside the sweep).
|
|
116
|
+
*/
|
|
117
|
+
async assertPipelinesExist(workspaceId, draft) {
|
|
118
|
+
const repo = this.deps.pipelineRepository;
|
|
119
|
+
if (!repo)
|
|
120
|
+
return;
|
|
121
|
+
const ids = new Set([draft.policy.defaultPipelineId]);
|
|
122
|
+
for (const rule of draft.policy.rules ?? [])
|
|
123
|
+
ids.add(rule.pipelineId);
|
|
124
|
+
for (const item of draft.items)
|
|
125
|
+
if (item.pipelineId)
|
|
126
|
+
ids.add(item.pipelineId);
|
|
127
|
+
for (const id of ids) {
|
|
128
|
+
if (!(await repo.get(workspaceId, id))) {
|
|
129
|
+
throw new ValidationError(`Plan references unknown pipeline '${id}'`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
110
133
|
/**
|
|
111
134
|
* Flip an initiative to `executing` (the committer step ran: the plan is
|
|
112
135
|
* approved and the tracker mirror committed), stamping the repo-doc
|
|
@@ -122,6 +145,36 @@ export class InitiativeService {
|
|
|
122
145
|
...(doc ? { doc: { ...doc, committedAt: this.deps.clock.now() } } : {}),
|
|
123
146
|
}));
|
|
124
147
|
}
|
|
148
|
+
// ---- Execution loop (slice 3) -------------------------------------------
|
|
149
|
+
// The loop drives the entity through the same CAS `mutate` path. `update` is the generic
|
|
150
|
+
// transform seam the loop passes its (pure) item-lifecycle closures to; the lifecycle
|
|
151
|
+
// transitions below are the human-driven controls (pause / resume / cancel).
|
|
152
|
+
/**
|
|
153
|
+
* Apply a CAS-guarded transform to the block's initiative — the execution loop's write
|
|
154
|
+
* path. A content-identical transform short-circuits to no write (replay/idempotency);
|
|
155
|
+
* a lost CAS reloads and retries a bounded number of times. Returns the persisted entity,
|
|
156
|
+
* or null when the block has no initiative.
|
|
157
|
+
*/
|
|
158
|
+
update(workspaceId, blockId, transform) {
|
|
159
|
+
return this.mutate(workspaceId, blockId, transform);
|
|
160
|
+
}
|
|
161
|
+
/** Pause an executing initiative (the sweep skips it; in-flight tasks finish naturally). */
|
|
162
|
+
pause(workspaceId, blockId) {
|
|
163
|
+
return this.mutate(workspaceId, blockId, (current) => current.status === 'executing' ? { ...current, status: 'paused' } : current);
|
|
164
|
+
}
|
|
165
|
+
/** Resume a paused initiative back to `executing` (the next sweep picks it up). */
|
|
166
|
+
resume(workspaceId, blockId) {
|
|
167
|
+
return this.mutate(workspaceId, blockId, (current) => current.status === 'paused' ? { ...current, status: 'executing' } : current);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Cancel an initiative: stop spawning further work. Terminal from the loop's view. In-flight
|
|
171
|
+
* spawned tasks are left to finish on their own (cascading their teardown is slice 4).
|
|
172
|
+
*/
|
|
173
|
+
cancel(workspaceId, blockId) {
|
|
174
|
+
return this.mutate(workspaceId, blockId, (current) => current.status === 'done' || current.status === 'cancelled'
|
|
175
|
+
? current
|
|
176
|
+
: { ...current, status: 'cancelled' });
|
|
177
|
+
}
|
|
125
178
|
// ---- Interactive planning interview (slice 2) ---------------------------
|
|
126
179
|
// Each write goes through the CAS `mutate` (single-writer, replay-safe) and emits the
|
|
127
180
|
// live `initiative` event so an open planning window refreshes. The interviewer LLM +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitiativeService.js","sourceRoot":"","sources":["../../../src/modules/initiative/InitiativeService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InitiativeService.js","sourceRoot":"","sources":["../../../src/modules/initiative/InitiativeService.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACnG,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,uBAAuB,CAAA;AAkB9B,0FAA0F;AAC1F,MAAM,YAAY,GAAG,CAAC,CAAA;AAEtB;;;;;;GAMG;AACH,MAAM,OAAO,iBAAiB;IACC,IAAI;IAAjC,YAA6B,IAAmC;oBAAnC,IAAI;IAAkC,CAAC;IAEpE;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACV,WAAmB,EACnB,KAA4B;QAE5B,MAAM,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAA;QAClE,MAAM,KAAK,GAAG,WAAW,CACvB,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,EAC/D,OAAO,EACP,KAAK,CAAC,OAAO,CACd,CAAA;QACD,IAAI,KAAK,CAAC,KAAK,KAAK,OAAO,EAAE,CAAC;YAC5B,MAAM,IAAI,eAAe,CAAC,yDAAyD,CAAC,CAAA;QACtF,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,WAAW,CAAC,CAAA;QAC3E,MAAM,QAAQ,GAAG,MAAM,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AO,CAAC,GAAG,GAAG,CAAC;gBACpB,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;aACjC,CAAA;YACD,IACE,MAAM,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,EACxF,CAAC;gBACD,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;gBAClE,OAAO,SAAS,CAAA;YAClB,CAAC;QACH,CAAC;QACD,MAAM,IAAI,aAAa,CAAC,2DAA2D,CAAC,CAAA;IACtF,CAAC;CACF;AAED,gFAAgF;AAChF,SAAS,WAAW,CAAC,CAAa,EAAE,CAAa;IAC/C,+EAA+E;IAC/E,oEAAoE;IACpE,OAAO,CACL,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;QACnE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,CACpE,CAAA;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Block, Initiative, InitiativePhase, InitiativePlanDraft } from '@cat-factory/kernel';
|
|
1
|
+
import type { Block, Initiative, InitiativeExecutionPolicy, InitiativeItem, InitiativePhase, InitiativePlanDraft } from '@cat-factory/kernel';
|
|
2
2
|
/** Turn a title into a stable, filesystem/URL-safe slug (the tracker folder name). */
|
|
3
3
|
export declare function initiativeSlug(title: string): string;
|
|
4
4
|
/**
|
|
@@ -89,4 +89,61 @@ export declare function applyInterviewOutcome(initiative: Initiative, outcome: {
|
|
|
89
89
|
export declare function interviewAtCap(initiative: Initiative): boolean;
|
|
90
90
|
/** Fold the analyst's codebase-analysis prose onto the entity. */
|
|
91
91
|
export declare function applyAnalysis(initiative: Initiative, summary: string): Initiative;
|
|
92
|
+
/** How many of the initiative's items currently hold a concurrency slot (a running/PR task). */
|
|
93
|
+
export declare function activeItemCount(initiative: Initiative): number;
|
|
94
|
+
/** Whether every item is settled (done/skipped) — the initiative's work is complete. */
|
|
95
|
+
export declare function allItemsSettled(initiative: Initiative): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* A phase is HALTED when it holds a `blocked` item: the loop stops spawning NEW work in
|
|
98
|
+
* it until a human retries/skips the failure (the "halt the phase, notify" policy). Since
|
|
99
|
+
* `blocked` is non-terminal, {@link deriveCurrentPhase} also keeps a halted phase current,
|
|
100
|
+
* so the initiative never advances past it either.
|
|
101
|
+
*/
|
|
102
|
+
export declare function phaseIsHalted(initiative: Initiative, phaseId: string): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* The effective concurrency cap for a phase: the phase's own tighter cap (when set) clamped
|
|
105
|
+
* by the policy-wide cap. No policy ⇒ 1 (fail-safe to serial).
|
|
106
|
+
*/
|
|
107
|
+
export declare function effectiveMaxConcurrent(initiative: Initiative, phase: InitiativePhase | null): number;
|
|
108
|
+
/**
|
|
109
|
+
* Whether all of an item's intra-initiative dependencies are settled (done/skipped). A
|
|
110
|
+
* dependency that no longer exists (a re-plan dropped it) counts as satisfied.
|
|
111
|
+
*/
|
|
112
|
+
export declare function itemDependenciesMet(initiative: Initiative, item: InitiativeItem): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* The items eligible to spawn RIGHT NOW: `pending`, in the derived current phase, that
|
|
115
|
+
* phase not halted by a blocked sibling, with every dependency met. Declared order is
|
|
116
|
+
* preserved. The caller applies the concurrency cap (this returns the full eligible set,
|
|
117
|
+
* not a cap-sliced one) so it can account for slots already taken by in-flight items.
|
|
118
|
+
*/
|
|
119
|
+
export declare function eligibleItemsToSpawn(initiative: Initiative): InitiativeItem[];
|
|
120
|
+
/**
|
|
121
|
+
* Pick the pipeline a spawned item should run: an explicit `item.pipelineId` wins; else the
|
|
122
|
+
* first policy rule whose thresholds the estimate meets (OR across axes — the
|
|
123
|
+
* `shouldRunGatedStep` semantics: risk ≥ minRisk OR impact ≥ minImpact OR complexity ≥
|
|
124
|
+
* minComplexity; a rule with no thresholds never matches); else the policy default. An item
|
|
125
|
+
* with NO estimate follows `onMissingEstimate`: `default` ⇒ `defaultPipelineId`, `strongest`
|
|
126
|
+
* ⇒ the last (weakest-first-ordered) rule's pipeline, fail-safe to thoroughness.
|
|
127
|
+
*/
|
|
128
|
+
export declare function selectInitiativePipeline(item: Pick<InitiativeItem, 'estimate' | 'pipelineId'>, policy: InitiativeExecutionPolicy): string;
|
|
129
|
+
/**
|
|
130
|
+
* Reconcile ONE item from its spawned block's current state. Only actively-spawned items
|
|
131
|
+
* (`in_progress`/`pr_open`) are touched — a settled/blocked/un-spawned item is left alone,
|
|
132
|
+
* which is what makes reconcile idempotent across durable-driver replays (the first pass
|
|
133
|
+
* already moved a finished item out of the active set). An active item whose block is GONE is
|
|
134
|
+
* an orphaned claim (a prior tick crashed between the CAS claim and the block insert, or the
|
|
135
|
+
* block was deleted out from under us): it is reverted to `pending` with its dead link dropped,
|
|
136
|
+
* so the next spawn re-materialises it. Leaving it `in_progress` would hold a concurrency slot
|
|
137
|
+
* forever and the phase/initiative could never complete.
|
|
138
|
+
*/
|
|
139
|
+
export declare function reconcileItem(item: InitiativeItem, block: Block | undefined): InitiativeItem;
|
|
140
|
+
/** Claim a `pending` item for spawning: flip it to `in_progress` with the pre-generated block id.
|
|
141
|
+
* A no-op when the item is not `pending` (already claimed/settled), so a concurrent ticker that
|
|
142
|
+
* lost the CAS observes the winner's claim and abandons. */
|
|
143
|
+
export declare function applySpawnClaim(initiative: Initiative, itemId: string, spawnedBlockId: string): Initiative;
|
|
144
|
+
/** Revert a claim we own (matched by our block id) back to `pending` — used when the run failed
|
|
145
|
+
* to start (e.g. the per-service task limit was hit; leave the item for the next sweep). */
|
|
146
|
+
export declare function applyRevertClaim(initiative: Initiative, itemId: string, spawnedBlockId: string): Initiative;
|
|
147
|
+
/** Whether an item currently holds an active concurrency slot. Exported for the loop's math. */
|
|
148
|
+
export declare function itemIsActive(item: InitiativeItem): boolean;
|
|
92
149
|
//# sourceMappingURL=initiative.logic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initiative.logic.d.ts","sourceRoot":"","sources":["../../../src/modules/initiative/initiative.logic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,UAAU,
|
|
1
|
+
{"version":3,"file":"initiative.logic.d.ts","sourceRoot":"","sources":["../../../src/modules/initiative/initiative.logic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,UAAU,EACV,yBAAyB,EACzB,cAAc,EAEd,eAAe,EACf,mBAAmB,EAEpB,MAAM,qBAAqB,CAAA;AAW5B,sFAAsF;AACtF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOpD;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAY9F;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAwClE;AAYD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,mBAAmB,EAC1B,GAAG,EAAE,MAAM,GACV,UAAU,CAkFZ;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,eAAe,GAAG,IAAI,CASjF;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAM1F;AASD,8EA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