@quolu/lattice 0.61.2 → 0.61.3
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quolu/lattice",
|
|
3
|
-
"version": "0.61.
|
|
3
|
+
"version": "0.61.3",
|
|
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",
|
|
@@ -23,6 +23,33 @@ const MAX_TRACKED_FILE_BYTES = 4_194_304;
|
|
|
23
23
|
const GIT_SHA1 = /^[0-9a-f]{40}$/;
|
|
24
24
|
const LINE_ID = /^[0-9A-Za-z](?:[0-9A-Za-z._-]{0,127})$/;
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* gitignore 済みのコンパイラ/ツール出力 directory 名。
|
|
28
|
+
* 観測から外すのは ignored かつこの segment を持つ path だけ。
|
|
29
|
+
* tracked な `bin/`(CLI の正本)は status code が `!!` ではないので残る。
|
|
30
|
+
* gitignore 迂回の検知(ignored なソース相当 file)は残す。
|
|
31
|
+
*/
|
|
32
|
+
export const GENERATED_OUTPUT_DIR_NAMES = Object.freeze([
|
|
33
|
+
'obj', 'bin', 'node_modules', '.vs', 'TestResults',
|
|
34
|
+
'__pycache__', '.pytest_cache', 'dist', 'coverage',
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
export function isGeneratedOutputPath(relativePath) {
|
|
38
|
+
if (typeof relativePath !== 'string' || relativePath.length === 0) return false;
|
|
39
|
+
return relativePath.replace(/\/$/u, '').split('/').some(
|
|
40
|
+
(segment) => GENERATED_OUTPUT_DIR_NAMES.includes(segment),
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function isIgnoredStatus(code) {
|
|
45
|
+
return typeof code === 'string' && code.includes('!');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function keepObservedEntry(entry) {
|
|
49
|
+
if (!isIgnoredStatus(entry.code)) return true;
|
|
50
|
+
return !isGeneratedOutputPath(entry.path);
|
|
51
|
+
}
|
|
52
|
+
|
|
26
53
|
function fail(reason) {
|
|
27
54
|
throw new TypeError(`diff observer契約違反: ${reason}`);
|
|
28
55
|
}
|
|
@@ -174,10 +201,12 @@ export async function captureWorktreeDiff(options = {}) {
|
|
|
174
201
|
}
|
|
175
202
|
// ignored fileへのwriteもwrite sensorの対象にする(gitignore経由の
|
|
176
203
|
// scope violation迂回を塞ぐ。isolation-runnerと同じ--ignored=matching)。
|
|
204
|
+
// ただし obj/bin/node_modules 等のコンパイラ出力は成果ではない。
|
|
205
|
+
// 展開すると MAX_DIFF_ENTRIES を踏み、accept が undeclared_write で hold する。
|
|
177
206
|
const statusBytes = await run('git', [
|
|
178
207
|
'status', '--porcelain=v1', '-z', '--untracked-files=all', '--ignored=matching',
|
|
179
208
|
], worktreePath);
|
|
180
|
-
const entries = statusEntries(statusBytes);
|
|
209
|
+
const entries = statusEntries(statusBytes).filter(keepObservedEntry);
|
|
181
210
|
// commit済みの変更はstatusへ出ない。base..HEADの範囲も観測へ入れないと、
|
|
182
211
|
// commitした瞬間に変更が観測から消える。
|
|
183
212
|
if (head !== baseSha) {
|
|
@@ -196,6 +225,7 @@ export async function captureWorktreeDiff(options = {}) {
|
|
|
196
225
|
// (集約のまま扱うとdirectoryをspecial file扱いで落とし、write pathを特定できない)。
|
|
197
226
|
const expanded = [];
|
|
198
227
|
for (const entry of entries) {
|
|
228
|
+
if (isIgnoredStatus(entry.code) && isGeneratedOutputPath(entry.path)) continue;
|
|
199
229
|
if (!entry.path.endsWith('/')) {
|
|
200
230
|
expanded.push(entry);
|
|
201
231
|
continue;
|
|
@@ -205,7 +235,9 @@ export async function captureWorktreeDiff(options = {}) {
|
|
|
205
235
|
], worktreePath);
|
|
206
236
|
for (const innerPath of inner.toString('utf8').split('\0')) {
|
|
207
237
|
if (innerPath.length === 0) continue;
|
|
208
|
-
|
|
238
|
+
const innerEntry = { path: innerPath, code: entry.code };
|
|
239
|
+
if (!keepObservedEntry(innerEntry)) continue;
|
|
240
|
+
expanded.push(innerEntry);
|
|
209
241
|
}
|
|
210
242
|
}
|
|
211
243
|
if (expanded.length > MAX_DIFF_ENTRIES) {
|
|
@@ -1144,7 +1144,7 @@ export async function acceptPullTask({ repoRoot, runDir, taskId, environment = p
|
|
|
1144
1144
|
done_event_digest: intake.accepted.done_event_digest };
|
|
1145
1145
|
result.result_digest = digestArtifact(result); return result;
|
|
1146
1146
|
}
|
|
1147
|
-
if (intake.intervention.state === 'hold') {
|
|
1147
|
+
if (intake.intervention.state === 'hold' && intake.intervention.reason !== 'runtime_conflict') {
|
|
1148
1148
|
fail('TASK_HELD', 'hold中taskはacceptできない', {
|
|
1149
1149
|
reason: intake.intervention.reason, next_action: intake.intervention.next_action,
|
|
1150
1150
|
});
|
|
@@ -1198,6 +1198,20 @@ export async function acceptPullTask({ repoRoot, runDir, taskId, environment = p
|
|
|
1198
1198
|
}
|
|
1199
1199
|
fail('RUNTIME_CONFLICT_HOLD', 'observed diffがruntime conflictを生成した', { findings });
|
|
1200
1200
|
}
|
|
1201
|
+
if (intake.intervention.state === 'hold' && intake.intervention.reason === 'runtime_conflict') {
|
|
1202
|
+
const released = { state: 'none', reason: null, next_action: null,
|
|
1203
|
+
lease_state: 'granted', detail: { released_by_empty_findings: true } };
|
|
1204
|
+
current = await changeIntervention(runDir, current, taskId, released);
|
|
1205
|
+
const resumed = project(current.events, current.meta).intakes
|
|
1206
|
+
.find((entry) => entry.task_id === taskId);
|
|
1207
|
+
if (resumed.worker?.stopped) {
|
|
1208
|
+
await signalAttachedWorker(resumed, 'SIGCONT');
|
|
1209
|
+
current = await appendEvent(runDir, current, buildEvent({
|
|
1210
|
+
events: current.events, meta: current.meta, kind: 'worker_resumed', taskId,
|
|
1211
|
+
payload: { released_by_empty_findings: true },
|
|
1212
|
+
}));
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1201
1215
|
current = await appendEvent(runDir, current, buildEvent({
|
|
1202
1216
|
events: current.events, meta: current.meta, kind: 'task_accepted', taskId,
|
|
1203
1217
|
payload: { done_event_digest: done.event_digest,
|