@quolu/lattice 0.62.1 → 0.62.2
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/package.json +1 -1
- package/src/runtime-pull-intake.mjs +33 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quolu/lattice",
|
|
3
|
-
"version": "0.62.
|
|
3
|
+
"version": "0.62.2",
|
|
4
4
|
"description": "Schedulability compiler for multi-agent development: observe real code boundaries, refactor the conflicting seam, recompile the plan for parallel execution",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Quo / クオ at kitepon.dev",
|
|
@@ -1082,6 +1082,11 @@ export async function detachPullWorker({ runDir, taskId, environment = process.e
|
|
|
1082
1082
|
} finally { await lock.release(); }
|
|
1083
1083
|
}
|
|
1084
1084
|
|
|
1085
|
+
export function remainingRuntimeConflictFindings(findings, acceptedTaskId) {
|
|
1086
|
+
if (!Array.isArray(findings)) return [];
|
|
1087
|
+
return findings.filter((finding) => !(finding.todo_ids ?? []).includes(acceptedTaskId));
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1085
1090
|
export function observationIntakes(state, includeTaskId = null) {
|
|
1086
1091
|
return state.intakes.filter((entry) => {
|
|
1087
1092
|
if (entry.accepted !== null) return false;
|
|
@@ -1247,6 +1252,34 @@ export async function acceptPullTask({ repoRoot, runDir, taskId, environment = p
|
|
|
1247
1252
|
}));
|
|
1248
1253
|
}
|
|
1249
1254
|
}
|
|
1255
|
+
state = project(current.events, current.meta);
|
|
1256
|
+
for (const waiting of state.intakes.filter((entry) => (
|
|
1257
|
+
entry.accepted === null && entry.intervention.reason === 'runtime_conflict'
|
|
1258
|
+
))) {
|
|
1259
|
+
const remaining = remainingRuntimeConflictFindings(
|
|
1260
|
+
waiting.intervention.detail?.findings, taskId,
|
|
1261
|
+
);
|
|
1262
|
+
if (remaining.length > 0) {
|
|
1263
|
+
if (remaining.length === (waiting.intervention.detail?.findings ?? []).length) continue;
|
|
1264
|
+
current = await changeIntervention(runDir, current, waiting.task_id, {
|
|
1265
|
+
...waiting.intervention,
|
|
1266
|
+
detail: { ...waiting.intervention.detail, findings: remaining },
|
|
1267
|
+
});
|
|
1268
|
+
continue;
|
|
1269
|
+
}
|
|
1270
|
+
const intervention = { state: 'none', reason: null, next_action: null,
|
|
1271
|
+
lease_state: 'granted', detail: { released_by_accepted_task: taskId } };
|
|
1272
|
+
current = await changeIntervention(runDir, current, waiting.task_id, intervention);
|
|
1273
|
+
const resumed = project(current.events, current.meta).intakes
|
|
1274
|
+
.find((entry) => entry.task_id === waiting.task_id);
|
|
1275
|
+
if (resumed.worker?.stopped) {
|
|
1276
|
+
await signalAttachedWorker(resumed, 'SIGCONT');
|
|
1277
|
+
current = await appendEvent(runDir, current, buildEvent({
|
|
1278
|
+
events: current.events, meta: current.meta, kind: 'worker_resumed', taskId: waiting.task_id,
|
|
1279
|
+
payload: { released_by_accepted_task: taskId },
|
|
1280
|
+
}));
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1250
1283
|
const result = { schema: 'lattice.pull_accept_result.v1', outcome: 'accepted',
|
|
1251
1284
|
already_accepted: false, task_id: taskId, head_sha: checkpoint.diff.head_sha,
|
|
1252
1285
|
done_event_digest: done.event_digest, checkpoint_digest: checkpoint.checkpoint_digest };
|