@quolu/lattice 0.82.0 → 0.84.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/README.ja.md +7 -6
- package/README.md +1 -1
- package/bin/lattice-bridge-supervisor.mjs +10 -0
- package/bin/lattice-dashboard.mjs +3 -18
- package/bin/lattice-mcp.mjs +6 -3
- package/bin/lattice.mjs +30 -23
- package/docs/schemas/lattice.plan_create_input.v4.schema.json +5 -11
- package/docs/schemas/lattice.plan_create_input.v5.schema.json +362 -0
- package/docs/schemas/lattice.plan_revise_input.v1.schema.json +38 -11
- package/package.json +2 -1
- package/sensor/dist/db/index.d.ts +1 -0
- package/sensor/dist/db/index.d.ts.map +1 -1
- package/sensor/dist/db/index.js +13 -0
- package/sensor/dist/db/index.js.map +1 -1
- package/sensor/dist/index.d.ts.map +1 -1
- package/sensor/dist/index.js +12 -2
- package/sensor/dist/index.js.map +1 -1
- package/sensor/dist/mcp/answer-freshness.js +1 -1
- package/sensor/dist/mcp/answer-freshness.js.map +1 -1
- package/sensor/dist/mcp/daemon-paths.d.ts +6 -0
- package/sensor/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/sensor/dist/mcp/daemon-paths.js +7 -1
- package/sensor/dist/mcp/daemon-paths.js.map +1 -1
- package/sensor/dist/mcp/engine.d.ts +11 -0
- package/sensor/dist/mcp/engine.d.ts.map +1 -1
- package/sensor/dist/mcp/engine.js +83 -4
- package/sensor/dist/mcp/engine.js.map +1 -1
- package/sensor/dist/mcp/index-repair.d.ts +7 -0
- package/sensor/dist/mcp/index-repair.d.ts.map +1 -0
- package/sensor/dist/mcp/index-repair.js +93 -0
- package/sensor/dist/mcp/index-repair.js.map +1 -0
- package/sensor/dist/mcp/index.d.ts.map +1 -1
- package/sensor/dist/mcp/index.js +12 -7
- package/sensor/dist/mcp/index.js.map +1 -1
- package/sensor/dist/mcp/tools.d.ts +4 -0
- package/sensor/dist/mcp/tools.d.ts.map +1 -1
- package/sensor/dist/mcp/tools.js +29 -9
- package/sensor/dist/mcp/tools.js.map +1 -1
- package/src/bridge-hub-server.mjs +46 -9
- package/src/cli-help.mjs +10 -8
- package/src/cli-refusal-guidance.mjs +354 -0
- package/src/dashboard-delivery.mjs +2 -1
- package/src/dashboard-lifecycle-journal.mjs +42 -20
- package/src/hooks-cli.mjs +30 -6
- package/src/plan-backchain.mjs +95 -41
- package/src/plan-revise.mjs +274 -72
- package/src/project-cli.mjs +301 -163
- package/src/project-identity.mjs +14 -0
- package/src/runtime-cli.mjs +38 -29
- package/src/runtime-control-store.mjs +22 -1
- package/src/runtime-decision-verifier.mjs +27 -8
- package/src/runtime-engine.mjs +34 -5
- package/src/runtime-hold-recompile.mjs +19 -15
- package/src/runtime-kept-worktree.mjs +136 -0
- package/src/runtime-lifecycle-lock.mjs +118 -30
- package/src/runtime-managed-supervisor.mjs +10 -10
- package/src/runtime-pull-intake.mjs +90 -44
- package/src/store-lock.mjs +142 -57
- package/src/todo-authoring-input.mjs +211 -2
- package/src/todo-cli.mjs +554 -200
- package/src/todo-contracts.mjs +22 -6
- package/src/todo-dashboard-registry.mjs +35 -6
- package/src/todo-gantt-display.mjs +259 -0
- package/src/todo-gantt-html-independence.mjs +10 -3
- package/src/todo-gantt-html-shared.mjs +16 -1
- package/src/todo-gantt-html.mjs +74 -53
- package/src/todo-gantt-layout.mjs +137 -59
- package/src/todo-gantt-live.mjs +6 -3
- package/src/todo-independence-guidance.mjs +4 -26
- package/src/todo-note-store.mjs +6 -3
- package/src/todo-readiness.mjs +83 -20
- package/src/todo-revision.mjs +156 -8
- package/src/todo-split.mjs +6 -3
- package/src/todo-status.mjs +141 -54
- package/src/todo-store-cache.mjs +1 -1
- package/src/todo-store-view.mjs +20 -2
- package/src/todo-store.mjs +562 -444
package/src/todo-status.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createTodoReadiness } from './todo-readiness.mjs';
|
|
2
|
+
import { isDecoupledPhaseTodoPlanSchema, isFinishedTodoTaskState } from './todo-store-view.mjs';
|
|
2
3
|
import {
|
|
3
4
|
AUDIT_PENDING_PHASE_STATUSES,
|
|
4
5
|
auditPendingNextCommands,
|
|
@@ -29,7 +30,10 @@ import {
|
|
|
29
30
|
* plan単位noteは工程に属する義務で、taskへ着手した人のcontextには届くが、**まだ誰も
|
|
30
31
|
* 着手していない工程の義務は、この欄が無いとどこにも出ない**。
|
|
31
32
|
*/
|
|
32
|
-
export const TODO_STATUS_SCHEMA = 'lattice.todo_status_result.
|
|
33
|
+
export const TODO_STATUS_SCHEMA = 'lattice.todo_status_result.v9';
|
|
34
|
+
/** v9 (u03 A77): `truncated: [{list, total, shown}]` records every cut of an output list. */
|
|
35
|
+
/** v8: cross_plan_findingsは件数だけ全数、本文は先頭からこの件数まで(statusを止めない)。 */
|
|
36
|
+
export const TODO_STATUS_FINDING_LIMIT = 32;
|
|
33
37
|
export const TODO_DISPATCH_FRONTIER_SCHEMA = 'lattice.todo_dispatch_frontier.v1';
|
|
34
38
|
export const TODO_STATUS_LIST_LIMIT = 2_000;
|
|
35
39
|
export const TODO_STATUS_LABEL_LIMIT = 160;
|
|
@@ -72,6 +76,24 @@ function displayText(value, fallback, limit) {
|
|
|
72
76
|
return result.length > 0 ? result : fallback;
|
|
73
77
|
}
|
|
74
78
|
|
|
79
|
+
/**
|
|
80
|
+
* 一覧が使う1工程の表示欄。`todo status`と`session-context`の`turn.own`が同じ文字列を返すための共有点。
|
|
81
|
+
* u12: done_conditionは1行・512文字までの表示用で、全文は`todo show`が返す。v7以前は欄が無くnull。
|
|
82
|
+
*/
|
|
83
|
+
export function todoStatusTaskDisplay(task) {
|
|
84
|
+
return {
|
|
85
|
+
label: displayText(task.title, task.task_id, TODO_STATUS_LABEL_LIMIT),
|
|
86
|
+
done_condition: typeof task.done_condition === 'string' && task.done_condition.trim().length > 0
|
|
87
|
+
? displayText(task.done_condition.replace(/[\u0000-\u001f\u007f]+/gu, ' ').trim(), '', TODO_STATUS_REASON_LIMIT)
|
|
88
|
+
: null,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** `todo status`のblocked欄と同じ表示のblocked理由。 */
|
|
93
|
+
export function todoStatusBlockedReason(reason) {
|
|
94
|
+
return displayText(reason, 'blocked', TODO_STATUS_REASON_LIMIT);
|
|
95
|
+
}
|
|
96
|
+
|
|
75
97
|
function taskKey(projectId, planKey, taskId) {
|
|
76
98
|
return `${projectId}\0${planKey}\0${taskId}`;
|
|
77
99
|
}
|
|
@@ -96,9 +118,10 @@ function enforceListLimit(name, value) {
|
|
|
96
118
|
}
|
|
97
119
|
|
|
98
120
|
function taskEntry(value) {
|
|
99
|
-
return exactRecord(value, ['plan_key', 'task_id', 'label'])
|
|
121
|
+
return exactRecord(value, ['plan_key', 'task_id', 'label', 'done_condition'])
|
|
100
122
|
&& isTodoIdentifier(value.plan_key) && isTodoIdentifier(value.task_id)
|
|
101
|
-
&& isTodoStatusBoundedText(value.label, TODO_STATUS_LABEL_LIMIT)
|
|
123
|
+
&& isTodoStatusBoundedText(value.label, TODO_STATUS_LABEL_LIMIT)
|
|
124
|
+
&& (value.done_condition === null || isTodoStatusBoundedText(value.done_condition, TODO_STATUS_REASON_LIMIT));
|
|
102
125
|
}
|
|
103
126
|
|
|
104
127
|
function taskRefEntry(value) {
|
|
@@ -301,14 +324,40 @@ function dispatchFrontierEntry(value, projectId, nextReady) {
|
|
|
301
324
|
&& value.frontier_digest === expected.frontier_digest;
|
|
302
325
|
}
|
|
303
326
|
|
|
304
|
-
|
|
327
|
+
function crossPlanFindingEntry(value) {
|
|
328
|
+
if (!exactRecord(value, ['owner_plan_key', 'event_digest', 'side', 'ref', 'reason'])
|
|
329
|
+
|| !isTodoIdentifier(value.owner_plan_key)
|
|
330
|
+
|| !(value.event_digest === null || isTodoDigest(value.event_digest))
|
|
331
|
+
|| !['from', 'to'].includes(value.side)
|
|
332
|
+
|| !['binding_stale', 'endpoint_missing'].includes(value.reason)) return false;
|
|
333
|
+
const { ref } = value;
|
|
334
|
+
const common = (keys) => exactRecord(ref, keys) && isTodoIdentifier(ref.project_id)
|
|
335
|
+
&& isTodoIdentifier(ref.plan_key)
|
|
336
|
+
&& (!keys.includes('expected_topology_digest') || isTodoDigest(ref.expected_topology_digest));
|
|
337
|
+
if (Object.hasOwn(ref ?? {}, 'phase_id')) {
|
|
338
|
+
return value.side === 'from' && common(['project_id', 'plan_key', 'phase_id', 'expected_topology_digest'])
|
|
339
|
+
&& isTodoIdentifier(ref.phase_id);
|
|
340
|
+
}
|
|
341
|
+
return (common(['project_id', 'plan_key', 'task_id'])
|
|
342
|
+
|| common(['project_id', 'plan_key', 'task_id', 'expected_topology_digest']))
|
|
343
|
+
&& isTodoIdentifier(ref.task_id);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function crossPlanFindings(value) {
|
|
347
|
+
return exactRecord(value, ['total', 'entries']) && isNonNegativeSafeInteger(value.total)
|
|
348
|
+
&& Array.isArray(value.entries) && value.entries.length <= TODO_STATUS_FINDING_LIMIT
|
|
349
|
+
&& value.entries.length === Math.min(value.total, TODO_STATUS_FINDING_LIMIT)
|
|
350
|
+
&& value.entries.every(crossPlanFindingEntry);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/** todo status v8 wire shapeを検証し、digestも再計算する。 */
|
|
305
354
|
export function validateTodoStatusResult(value) {
|
|
306
355
|
try {
|
|
307
356
|
return exactRecord(value, [
|
|
308
357
|
'schema', 'project_id', 'active_set', 'next_ready', 'dispatch_frontier',
|
|
309
358
|
'blocked', 'audit_pending', 'structure_finalization_pending', 'plan_notes',
|
|
310
|
-
'coordination', 'parallel_candidates',
|
|
311
|
-
'member_heads', 'result_digest',
|
|
359
|
+
'coordination', 'parallel_candidates', 'cross_plan_findings',
|
|
360
|
+
'member_heads', 'truncated', 'result_digest',
|
|
312
361
|
]) && value.schema === TODO_STATUS_SCHEMA && isTodoIdentifier(value.project_id)
|
|
313
362
|
&& boundedList(value.active_set, activeTaskEntry) && boundedList(value.next_ready, taskEntry)
|
|
314
363
|
&& dispatchFrontierEntry(value.dispatch_frontier, value.project_id, value.next_ready)
|
|
@@ -317,7 +366,11 @@ export function validateTodoStatusResult(value) {
|
|
|
317
366
|
&& boundedList(value.plan_notes, planNoteEntry)
|
|
318
367
|
&& boundedList(value.coordination, coordinationEntry)
|
|
319
368
|
&& boundedList(value.parallel_candidates, parallelCandidateEntry)
|
|
369
|
+
&& crossPlanFindings(value.cross_plan_findings)
|
|
320
370
|
&& boundedList(value.member_heads, memberHead)
|
|
371
|
+
&& Array.isArray(value.truncated) && value.truncated.every((entry) => exactRecord(entry, ['list', 'total', 'shown'])
|
|
372
|
+
&& typeof entry.list === 'string' && isNonNegativeSafeInteger(entry.total)
|
|
373
|
+
&& isNonNegativeSafeInteger(entry.shown) && entry.shown < entry.total)
|
|
321
374
|
&& isTodoDigest(value.result_digest)
|
|
322
375
|
&& value.result_digest === todoSelfDigest(value, 'result_digest');
|
|
323
376
|
} catch {
|
|
@@ -446,8 +499,9 @@ function buildTodoGraph(readModel) {
|
|
|
446
499
|
project_id: member.plan.project_id,
|
|
447
500
|
plan_key: member.plan.plan_key,
|
|
448
501
|
task_id: task.task_id,
|
|
449
|
-
|
|
502
|
+
...todoStatusTaskDisplay(task),
|
|
450
503
|
status: state.status,
|
|
504
|
+
finished: isFinishedTodoTaskState(state),
|
|
451
505
|
blocked_reason: state.blocked_reason,
|
|
452
506
|
});
|
|
453
507
|
incoming.set(key, new Set());
|
|
@@ -467,7 +521,7 @@ function buildTodoGraph(readModel) {
|
|
|
467
521
|
for (const join of member.plan.joins) {
|
|
468
522
|
for (const after of join.after) addPredecessor(after, join.before);
|
|
469
523
|
}
|
|
470
|
-
if (
|
|
524
|
+
if (isDecoupledPhaseTodoPlanSchema(member.plan.schema)) {
|
|
471
525
|
for (const edge of member.plan.phase_accept_dependencies) {
|
|
472
526
|
const target = refKey(edge.to);
|
|
473
527
|
if (!nodes.has(target)) fail('TODO_STATUS_INVALID_INPUT', 'todo_status_dependency_dangling');
|
|
@@ -505,7 +559,8 @@ export function computeReadyFrontier(readModel) {
|
|
|
505
559
|
const graph = buildTodoGraph(readModel);
|
|
506
560
|
const ready = [...graph.nodes.values()]
|
|
507
561
|
.filter((node) => isNodeReady(node, graph))
|
|
508
|
-
.map((node) => ({ plan_key: node.plan_key, task_id: node.task_id, label: node.label
|
|
562
|
+
.map((node) => ({ plan_key: node.plan_key, task_id: node.task_id, label: node.label,
|
|
563
|
+
done_condition: node.done_condition }));
|
|
509
564
|
ready.sort(compareTaskEntries);
|
|
510
565
|
enforceListLimit('next_ready', ready);
|
|
511
566
|
return ready;
|
|
@@ -552,6 +607,16 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
552
607
|
const parallelCandidates = [...options.parallelCandidates];
|
|
553
608
|
const structureFinalizations = [...(options.structureFinalizations ?? [])];
|
|
554
609
|
|
|
610
|
+
// u03 A77: output callers get a bounded result that records each cut; dispatch-only callers
|
|
611
|
+
// (never printed) keep full lists and the list limit as before.
|
|
612
|
+
const output = options !== TODO_STATUS_DISPATCH_ONLY;
|
|
613
|
+
const truncated = new Map();
|
|
614
|
+
const cut = (name, value, limit) => {
|
|
615
|
+
if (value.length <= limit) return value;
|
|
616
|
+
const entry = truncated.get(name) ?? { list: name, total: 0, shown: 0 };
|
|
617
|
+
truncated.set(name, entry);
|
|
618
|
+
return value.slice(0, limit);
|
|
619
|
+
};
|
|
555
620
|
const activeSet = [];
|
|
556
621
|
const nextReady = [];
|
|
557
622
|
const blocked = [];
|
|
@@ -559,21 +624,26 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
559
624
|
const task = { plan_key: node.plan_key, task_id: node.task_id, label: node.label };
|
|
560
625
|
if (node.status === 'in-progress') {
|
|
561
626
|
const unmetDependencies = [...incoming.get(node.key)]
|
|
562
|
-
.filter((key) => nodes.get(key).
|
|
627
|
+
.filter((key) => !nodes.get(key).finished)
|
|
563
628
|
.map((key) => {
|
|
564
629
|
const predecessor = nodes.get(key);
|
|
565
630
|
return { plan_key: predecessor.plan_key, task_id: predecessor.task_id };
|
|
566
631
|
})
|
|
567
632
|
.sort(compareTaskEntries);
|
|
568
|
-
enforceListLimit('active_set.unmet_dependencies', unmetDependencies);
|
|
569
|
-
|
|
633
|
+
if (!output) enforceListLimit('active_set.unmet_dependencies', unmetDependencies);
|
|
634
|
+
const shownDependencies = cut('active_set.unmet_dependencies', unmetDependencies, TODO_STATUS_LIST_LIMIT);
|
|
635
|
+
if (shownDependencies !== unmetDependencies) {
|
|
636
|
+
const entry = truncated.get('active_set.unmet_dependencies');
|
|
637
|
+
entry.total += unmetDependencies.length; entry.shown += shownDependencies.length;
|
|
638
|
+
}
|
|
639
|
+
activeSet.push({ ...task, unmet_dependencies: shownDependencies });
|
|
570
640
|
}
|
|
571
|
-
if (isNodeReady(node, graph)) nextReady.push(task);
|
|
641
|
+
if (isNodeReady(node, graph)) nextReady.push({ ...task, done_condition: node.done_condition });
|
|
572
642
|
if (node.status === 'blocked') {
|
|
573
643
|
blocked.push({
|
|
574
644
|
plan_key: node.plan_key,
|
|
575
645
|
task_id: node.task_id,
|
|
576
|
-
reason:
|
|
646
|
+
reason: todoStatusBlockedReason(node.blocked_reason),
|
|
577
647
|
});
|
|
578
648
|
}
|
|
579
649
|
}
|
|
@@ -581,47 +651,64 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
581
651
|
nextReady.sort(compareTaskEntries);
|
|
582
652
|
blocked.sort(compareTaskEntries);
|
|
583
653
|
memberHeads.sort((left, right) => left.plan_key < right.plan_key ? -1 : left.plan_key > right.plan_key ? 1 : 0);
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
['coordination', coordination], ['parallel_candidates', parallelCandidates],
|
|
589
|
-
['member_heads', memberHeads],
|
|
590
|
-
]) enforceListLimit(name, value);
|
|
591
|
-
|
|
592
|
-
const result = {
|
|
593
|
-
schema: TODO_STATUS_SCHEMA,
|
|
594
|
-
project_id: readModel.project_id,
|
|
595
|
-
active_set: activeSet,
|
|
596
|
-
next_ready: nextReady,
|
|
597
|
-
dispatch_frontier: dispatchFrontier(readModel.project_id, nextReady),
|
|
598
|
-
blocked,
|
|
599
|
-
// 監査待ちは`member.phases`だけから作った別の列で、dispatch(next_ready/dispatch_frontier)へは
|
|
600
|
-
// 影響しない。監査が進んでもfrontier_digestは動かない。
|
|
601
|
-
audit_pending: auditPending,
|
|
602
|
-
// 全task done後、構造finalizationが無い/古いplanだけを別列へ出す。監査状態と
|
|
603
|
-
// dispatch状態を混ぜず、terminal受理へ進めない理由と正規コマンドを同時に示す。
|
|
604
|
-
structure_finalization_pending: structureFinalizations,
|
|
605
|
-
// plan単位noteも同じく別の列である。noteの有無・件数はdispatchへ影響しないので、
|
|
606
|
-
// next_ready・dispatch_frontier・frontier_digestはnoteを書いても1バイトも動かない。
|
|
607
|
-
plan_notes: planNotes,
|
|
608
|
-
// 調整方式の宣言も同じく別の列である。宣言はdispatchを変えない——未宣言でもready
|
|
609
|
-
// frontierは通常どおり出る(ADR 0160・ob04のProtected behavior)。
|
|
610
|
-
coordination,
|
|
611
|
-
// 並列候補も別の列である。判定が進んでもdispatchは動かない——next_ready・
|
|
612
|
-
// dispatch_frontier・frontier_digestは判定状態を1バイトも含まない(ADR 0063・ob04)。
|
|
613
|
-
parallel_candidates: parallelCandidates,
|
|
614
|
-
member_heads: memberHeads,
|
|
615
|
-
result_digest: '',
|
|
654
|
+
const lists = {
|
|
655
|
+
active_set: activeSet, next_ready: nextReady, blocked, audit_pending: auditPending,
|
|
656
|
+
structure_finalization_pending: structureFinalizations, plan_notes: planNotes,
|
|
657
|
+
coordination, parallel_candidates: parallelCandidates, member_heads: memberHeads,
|
|
616
658
|
};
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
659
|
+
const totals = Object.fromEntries(Object.entries(lists).map(([name, value]) => [name, value.length]));
|
|
660
|
+
for (const [name, value] of Object.entries(lists)) {
|
|
661
|
+
if (output) lists[name] = cut(name, value, TODO_STATUS_LIST_LIMIT);
|
|
662
|
+
else enforceListLimit(name, value);
|
|
663
|
+
}
|
|
664
|
+
const findings = readModel.cross_plan_findings ?? [];
|
|
665
|
+
const build = () => {
|
|
666
|
+
for (const [name, value] of Object.entries(lists)) {
|
|
667
|
+
if (value.length < totals[name]) truncated.set(name, { list: name, total: totals[name], shown: value.length });
|
|
668
|
+
}
|
|
669
|
+
const result = {
|
|
670
|
+
schema: TODO_STATUS_SCHEMA,
|
|
671
|
+
project_id: readModel.project_id,
|
|
672
|
+
active_set: lists.active_set,
|
|
673
|
+
next_ready: lists.next_ready,
|
|
674
|
+
dispatch_frontier: dispatchFrontier(readModel.project_id, lists.next_ready),
|
|
675
|
+
blocked: lists.blocked,
|
|
676
|
+
// 監査待ちは`member.phases`だけから作った別の列で、dispatch(next_ready/dispatch_frontier)へは
|
|
677
|
+
// 影響しない。監査が進んでもfrontier_digestは動かない。
|
|
678
|
+
audit_pending: lists.audit_pending,
|
|
679
|
+
// 全task done後、構造finalizationが無い/古いplanだけを別列へ出す。監査状態と
|
|
680
|
+
// dispatch状態を混ぜず、terminal受理へ進めない理由と正規コマンドを同時に示す。
|
|
681
|
+
structure_finalization_pending: lists.structure_finalization_pending,
|
|
682
|
+
// plan単位noteも同じく別の列である。noteの有無・件数はdispatchへ影響しないので、
|
|
683
|
+
// next_ready・dispatch_frontier・frontier_digestはnoteを書いても1バイトも動かない。
|
|
684
|
+
plan_notes: lists.plan_notes,
|
|
685
|
+
// 調整方式の宣言も同じく別の列である。宣言はdispatchを変えない——未宣言でもready
|
|
686
|
+
// frontierは通常どおり出る(ADR 0160・ob04のProtected behavior)。
|
|
687
|
+
coordination: lists.coordination,
|
|
688
|
+
// 並列候補も別の列である。判定が進んでもdispatchは動かない——next_ready・
|
|
689
|
+
// dispatch_frontier・frontier_digestは判定状態を1バイトも含まない(ADR 0063・ob04)。
|
|
690
|
+
parallel_candidates: lists.parallel_candidates,
|
|
691
|
+
// u03 A24/A25b/N6: 陳腐化・消えた越境参照はStoreのfindingで、dispatchを止めない。
|
|
692
|
+
// 一覧で上限に達してもstatusを拒否しないよう、本文は先頭から切り、件数は全数を返す。
|
|
693
|
+
cross_plan_findings: {
|
|
694
|
+
total: findings.length,
|
|
695
|
+
entries: findings.slice(0, TODO_STATUS_FINDING_LIMIT),
|
|
696
|
+
},
|
|
697
|
+
member_heads: lists.member_heads,
|
|
698
|
+
truncated: [...truncated.values()].sort((left, right) => left.list.localeCompare(right.list)),
|
|
699
|
+
result_digest: '',
|
|
700
|
+
};
|
|
701
|
+
result.result_digest = todoSelfDigest(result, 'result_digest');
|
|
702
|
+
if (!validateTodoStatusResult(result)) fail('TODO_STATUS_INVALID_RESULT', 'todo_status_result_invalid');
|
|
703
|
+
return result;
|
|
704
|
+
};
|
|
705
|
+
let result = build();
|
|
706
|
+
// Output only: halve the longest list until the result fits the capture limit (never refuse).
|
|
707
|
+
while (output && Buffer.byteLength(`${JSON.stringify(result)}\n`) > TODO_STATUS_CAPTURE_LIMIT) {
|
|
708
|
+
const [name, value] = Object.entries(lists).sort((left, right) => right[1].length - left[1].length)[0];
|
|
709
|
+
if (value.length === 0) break;
|
|
710
|
+
lists[name] = value.slice(0, Math.floor(value.length / 2));
|
|
711
|
+
result = build();
|
|
625
712
|
}
|
|
626
713
|
return result;
|
|
627
714
|
}
|
package/src/todo-store-cache.mjs
CHANGED
|
@@ -28,7 +28,7 @@ export function todoStoreReadFailurePhase(error) {
|
|
|
28
28
|
if (error?.code === 'EIO') return 'store_io_failed';
|
|
29
29
|
if (error?.code === 'STORE_INCONSISTENT' && error.detail?.ref === MANIFEST_REF
|
|
30
30
|
&& ['schema_invalid', 'artifact_truncated_or_trailing_bytes', 'non_canonical_or_duplicate_key',
|
|
31
|
-
'size_limit_exceeded'
|
|
31
|
+
'size_limit_exceeded'].includes(error.detail.reason)) {
|
|
32
32
|
return 'store_manifest_invalid';
|
|
33
33
|
}
|
|
34
34
|
return 'store_read_failed';
|
package/src/todo-store-view.mjs
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
/* Pure projections shared by Store and Plan; no I/O or lifecycle mutation. */
|
|
2
2
|
import { canonicalizeTodoArtifact } from './todo-contracts.mjs';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* u03 A6: undo a Git autocrlf checkout of canonical LF bytes in memory. Only a pure
|
|
6
|
+
* conversion (every CR directly precedes LF) is undone; callers still check canonical
|
|
7
|
+
* bytes and digests on the result, so any other CR keeps failing as non-canonical.
|
|
8
|
+
*/
|
|
9
|
+
export function normalizeCheckoutEol(bytes) {
|
|
10
|
+
if (!bytes.includes(0x0d)) return bytes;
|
|
11
|
+
for (let index = bytes.indexOf(0x0d); index !== -1; index = bytes.indexOf(0x0d, index + 1)) {
|
|
12
|
+
if (bytes[index + 1] !== 0x0a) return bytes;
|
|
13
|
+
}
|
|
14
|
+
return Buffer.from(bytes.toString('latin1').replaceAll('\r\n', '\n'), 'latin1');
|
|
15
|
+
}
|
|
16
|
+
|
|
4
17
|
export function isPhaseTodoPlanSchema(schema) {
|
|
5
|
-
return ['lattice.todo_plan.v4', 'lattice.todo_plan.v5', 'lattice.todo_plan.v7'].includes(schema);
|
|
18
|
+
return ['lattice.todo_plan.v4', 'lattice.todo_plan.v5', 'lattice.todo_plan.v7', 'lattice.todo_plan.v8'].includes(schema);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** One finished-predecessor predicate for Store replay and readiness: done or retired (a13: retire deletes the task, so its edges count as gone). */
|
|
22
|
+
export function isFinishedTodoTaskState(state) {
|
|
23
|
+
return state?.status === 'done' || state?.status === 'retired';
|
|
6
24
|
}
|
|
7
25
|
|
|
8
26
|
export function isDecoupledPhaseTodoPlanSchema(schema) {
|
|
9
|
-
return ['lattice.todo_plan.v5', 'lattice.todo_plan.v7'].includes(schema);
|
|
27
|
+
return ['lattice.todo_plan.v5', 'lattice.todo_plan.v7', 'lattice.todo_plan.v8'].includes(schema);
|
|
10
28
|
}
|
|
11
29
|
|
|
12
30
|
// CLI側(migrate/plan create/最後のdone)が「終端重監査が要る」ことを通知するために
|