@quolu/lattice 0.61.1 → 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/README.md +9 -0
- package/package.json +1 -1
- package/src/runtime-diff-observer.mjs +34 -2
- package/src/runtime-pull-intake.mjs +17 -3
- package/src/runtime-windows-process.mjs +10 -0
package/README.md
CHANGED
|
@@ -189,6 +189,15 @@ lattice todo seam-proposal apply --plan <key> # isolated worktre
|
|
|
189
189
|
lattice todo seam-proposal land --plan <key> --names names.json
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
+
`lattice todo status --json` exposes `dispatch_frontier`: every ready task is the default
|
|
193
|
+
parallel set. Starting one of them does not require `--parallel-frontier` or
|
|
194
|
+
`--override-reason`. Those flags record intent; they are not gates.
|
|
195
|
+
`--serial-confirmed` and `--serialization-reviewed` are accepted only for compatibility.
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
lattice todo start --plan <key> --task <id>
|
|
199
|
+
```
|
|
200
|
+
|
|
192
201
|
Full CLI surface: `lattice --help`, then
|
|
193
202
|
`lattice <plan|run|event|todo|sensor|factory-diagnostics|runtime-errors|bridge|hooks> --help`.
|
|
194
203
|
|
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) {
|
|
@@ -13,7 +13,7 @@ import { classifyObservedDiff } from './runtime-decision-verifier.mjs';
|
|
|
13
13
|
import { captureWorktreeDiff, detectCheckpointFindings } from './runtime-diff-observer.mjs';
|
|
14
14
|
import { acquireRuntimeLifecycleLock } from './runtime-lifecycle-lock.mjs';
|
|
15
15
|
import { observeManagedProcessStartIdentity } from './runtime-managed-supervisor.mjs';
|
|
16
|
-
import { observeWindowsWorkerProcess } from './runtime-windows-process.mjs';
|
|
16
|
+
import { deliverWorkerSignal, observeWindowsWorkerProcess } from './runtime-windows-process.mjs';
|
|
17
17
|
import { ensureScriptedWorktree } from './runtime-scripted-worktree.mjs';
|
|
18
18
|
import {
|
|
19
19
|
BOUNDARY_MANIFEST_SCHEMA, selfDigest, validateRuntimeBoundaryManifest, validateRuntimePlan,
|
|
@@ -948,7 +948,7 @@ async function signalAttachedWorker(intake, signal) {
|
|
|
948
948
|
|| observed.process_group_id !== intake.worker.process_group_id) {
|
|
949
949
|
fail('WORKER_IDENTITY_MISMATCH', 'signal前のlstart/argv/pgidがattach bindingと一致しない');
|
|
950
950
|
}
|
|
951
|
-
try {
|
|
951
|
+
try { deliverWorkerSignal(intake.worker.pid, signal); }
|
|
952
952
|
catch { fail('WORKER_SIGNAL_FAILED', `workerへ${signal}を送れない`); }
|
|
953
953
|
return true;
|
|
954
954
|
}
|
|
@@ -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,
|
|
@@ -21,6 +21,16 @@ export function parseWindowsCreationDate(value) {
|
|
|
21
21
|
return parsed.toISOString();
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
export function deliverWorkerSignal(pid, signal) {
|
|
25
|
+
if (!Number.isSafeInteger(pid) || pid < 1) throw new Error('pidが正整数でない');
|
|
26
|
+
const jobControl = signal === 'SIGSTOP' || signal === 'SIGCONT';
|
|
27
|
+
if (process.platform === 'win32' && jobControl) {
|
|
28
|
+
return { delivered: false, recorded: true };
|
|
29
|
+
}
|
|
30
|
+
process.kill(pid, signal);
|
|
31
|
+
return { delivered: true, recorded: true };
|
|
32
|
+
}
|
|
33
|
+
|
|
24
34
|
export async function observeWindowsWorkerProcess(pid) {
|
|
25
35
|
if (!Number.isSafeInteger(pid) || pid < 1) {
|
|
26
36
|
throw new Error('pidが正整数でない');
|