@quolu/lattice 0.82.0 → 0.83.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/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 +1 -1
- package/docs/schemas/lattice.plan_create_input.v5.schema.json +375 -0
- package/docs/schemas/lattice.plan_revise_input.v1.schema.json +6 -3
- 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/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 +2 -2
- package/src/dashboard-lifecycle-journal.mjs +42 -20
- package/src/plan-backchain.mjs +25 -8
- package/src/plan-revise.mjs +129 -28
- package/src/project-cli.mjs +42 -18
- package/src/project-identity.mjs +14 -0
- package/src/runtime-cli.mjs +31 -18
- 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 +87 -43
- package/src/store-lock.mjs +142 -57
- package/src/todo-authoring-input.mjs +56 -2
- package/src/todo-cli.mjs +168 -42
- package/src/todo-contracts.mjs +22 -6
- package/src/todo-dashboard-registry.mjs +31 -4
- package/src/todo-gantt-display.mjs +260 -0
- package/src/todo-gantt-html-independence.mjs +8 -1
- package/src/todo-gantt-html-shared.mjs +2 -1
- package/src/todo-gantt-html.mjs +4 -2
- package/src/todo-gantt-layout.mjs +7 -36
- package/src/todo-gantt-live.mjs +6 -3
- package/src/todo-note-store.mjs +6 -3
- package/src/todo-readiness.mjs +29 -8
- package/src/todo-revision.mjs +9 -8
- package/src/todo-split.mjs +6 -3
- package/src/todo-status.mjs +53 -9
- package/src/todo-store-cache.mjs +1 -1
- package/src/todo-store-view.mjs +21 -2
- package/src/todo-store.mjs +545 -166
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,9 @@ 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.v8';
|
|
34
|
+
/** v8: cross_plan_findingsは件数だけ全数、本文は先頭からこの件数まで(statusを止めない)。 */
|
|
35
|
+
export const TODO_STATUS_FINDING_LIMIT = 32;
|
|
33
36
|
export const TODO_DISPATCH_FRONTIER_SCHEMA = 'lattice.todo_dispatch_frontier.v1';
|
|
34
37
|
export const TODO_STATUS_LIST_LIMIT = 2_000;
|
|
35
38
|
export const TODO_STATUS_LABEL_LIMIT = 160;
|
|
@@ -96,9 +99,10 @@ function enforceListLimit(name, value) {
|
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
function taskEntry(value) {
|
|
99
|
-
return exactRecord(value, ['plan_key', 'task_id', 'label'])
|
|
102
|
+
return exactRecord(value, ['plan_key', 'task_id', 'label', 'done_condition'])
|
|
100
103
|
&& isTodoIdentifier(value.plan_key) && isTodoIdentifier(value.task_id)
|
|
101
|
-
&& isTodoStatusBoundedText(value.label, TODO_STATUS_LABEL_LIMIT)
|
|
104
|
+
&& isTodoStatusBoundedText(value.label, TODO_STATUS_LABEL_LIMIT)
|
|
105
|
+
&& (value.done_condition === null || isTodoStatusBoundedText(value.done_condition, TODO_STATUS_REASON_LIMIT));
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
function taskRefEntry(value) {
|
|
@@ -301,13 +305,39 @@ function dispatchFrontierEntry(value, projectId, nextReady) {
|
|
|
301
305
|
&& value.frontier_digest === expected.frontier_digest;
|
|
302
306
|
}
|
|
303
307
|
|
|
304
|
-
|
|
308
|
+
function crossPlanFindingEntry(value) {
|
|
309
|
+
if (!exactRecord(value, ['owner_plan_key', 'event_digest', 'side', 'ref', 'reason'])
|
|
310
|
+
|| !isTodoIdentifier(value.owner_plan_key)
|
|
311
|
+
|| !(value.event_digest === null || isTodoDigest(value.event_digest))
|
|
312
|
+
|| !['from', 'to'].includes(value.side)
|
|
313
|
+
|| !['binding_stale', 'endpoint_missing'].includes(value.reason)) return false;
|
|
314
|
+
const { ref } = value;
|
|
315
|
+
const common = (keys) => exactRecord(ref, keys) && isTodoIdentifier(ref.project_id)
|
|
316
|
+
&& isTodoIdentifier(ref.plan_key)
|
|
317
|
+
&& (!keys.includes('expected_topology_digest') || isTodoDigest(ref.expected_topology_digest));
|
|
318
|
+
if (Object.hasOwn(ref ?? {}, 'phase_id')) {
|
|
319
|
+
return value.side === 'from' && common(['project_id', 'plan_key', 'phase_id', 'expected_topology_digest'])
|
|
320
|
+
&& isTodoIdentifier(ref.phase_id);
|
|
321
|
+
}
|
|
322
|
+
return (common(['project_id', 'plan_key', 'task_id'])
|
|
323
|
+
|| common(['project_id', 'plan_key', 'task_id', 'expected_topology_digest']))
|
|
324
|
+
&& isTodoIdentifier(ref.task_id);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function crossPlanFindings(value) {
|
|
328
|
+
return exactRecord(value, ['total', 'entries']) && isNonNegativeSafeInteger(value.total)
|
|
329
|
+
&& Array.isArray(value.entries) && value.entries.length <= TODO_STATUS_FINDING_LIMIT
|
|
330
|
+
&& value.entries.length === Math.min(value.total, TODO_STATUS_FINDING_LIMIT)
|
|
331
|
+
&& value.entries.every(crossPlanFindingEntry);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** todo status v8 wire shapeを検証し、digestも再計算する。 */
|
|
305
335
|
export function validateTodoStatusResult(value) {
|
|
306
336
|
try {
|
|
307
337
|
return exactRecord(value, [
|
|
308
338
|
'schema', 'project_id', 'active_set', 'next_ready', 'dispatch_frontier',
|
|
309
339
|
'blocked', 'audit_pending', 'structure_finalization_pending', 'plan_notes',
|
|
310
|
-
'coordination', 'parallel_candidates',
|
|
340
|
+
'coordination', 'parallel_candidates', 'cross_plan_findings',
|
|
311
341
|
'member_heads', 'result_digest',
|
|
312
342
|
]) && value.schema === TODO_STATUS_SCHEMA && isTodoIdentifier(value.project_id)
|
|
313
343
|
&& boundedList(value.active_set, activeTaskEntry) && boundedList(value.next_ready, taskEntry)
|
|
@@ -317,6 +347,7 @@ export function validateTodoStatusResult(value) {
|
|
|
317
347
|
&& boundedList(value.plan_notes, planNoteEntry)
|
|
318
348
|
&& boundedList(value.coordination, coordinationEntry)
|
|
319
349
|
&& boundedList(value.parallel_candidates, parallelCandidateEntry)
|
|
350
|
+
&& crossPlanFindings(value.cross_plan_findings)
|
|
320
351
|
&& boundedList(value.member_heads, memberHead)
|
|
321
352
|
&& isTodoDigest(value.result_digest)
|
|
322
353
|
&& value.result_digest === todoSelfDigest(value, 'result_digest');
|
|
@@ -447,7 +478,13 @@ function buildTodoGraph(readModel) {
|
|
|
447
478
|
plan_key: member.plan.plan_key,
|
|
448
479
|
task_id: task.task_id,
|
|
449
480
|
label: displayText(task.title, task.task_id, TODO_STATUS_LABEL_LIMIT),
|
|
481
|
+
// u12: 作成者が書いた終了条件。一覧は1行・512文字までの表示用で、全文は`todo show`が返す。
|
|
482
|
+
// v7以前は欄が無くnull。
|
|
483
|
+
done_condition: typeof task.done_condition === 'string' && task.done_condition.trim().length > 0
|
|
484
|
+
? displayText(task.done_condition.replace(/[\u0000-\u001f\u007f]+/gu, ' ').trim(), '', TODO_STATUS_REASON_LIMIT)
|
|
485
|
+
: null,
|
|
450
486
|
status: state.status,
|
|
487
|
+
finished: isFinishedTodoTaskState(state),
|
|
451
488
|
blocked_reason: state.blocked_reason,
|
|
452
489
|
});
|
|
453
490
|
incoming.set(key, new Set());
|
|
@@ -467,7 +504,7 @@ function buildTodoGraph(readModel) {
|
|
|
467
504
|
for (const join of member.plan.joins) {
|
|
468
505
|
for (const after of join.after) addPredecessor(after, join.before);
|
|
469
506
|
}
|
|
470
|
-
if (
|
|
507
|
+
if (isDecoupledPhaseTodoPlanSchema(member.plan.schema)) {
|
|
471
508
|
for (const edge of member.plan.phase_accept_dependencies) {
|
|
472
509
|
const target = refKey(edge.to);
|
|
473
510
|
if (!nodes.has(target)) fail('TODO_STATUS_INVALID_INPUT', 'todo_status_dependency_dangling');
|
|
@@ -505,7 +542,8 @@ export function computeReadyFrontier(readModel) {
|
|
|
505
542
|
const graph = buildTodoGraph(readModel);
|
|
506
543
|
const ready = [...graph.nodes.values()]
|
|
507
544
|
.filter((node) => isNodeReady(node, graph))
|
|
508
|
-
.map((node) => ({ plan_key: node.plan_key, task_id: node.task_id, label: node.label
|
|
545
|
+
.map((node) => ({ plan_key: node.plan_key, task_id: node.task_id, label: node.label,
|
|
546
|
+
done_condition: node.done_condition }));
|
|
509
547
|
ready.sort(compareTaskEntries);
|
|
510
548
|
enforceListLimit('next_ready', ready);
|
|
511
549
|
return ready;
|
|
@@ -559,7 +597,7 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
559
597
|
const task = { plan_key: node.plan_key, task_id: node.task_id, label: node.label };
|
|
560
598
|
if (node.status === 'in-progress') {
|
|
561
599
|
const unmetDependencies = [...incoming.get(node.key)]
|
|
562
|
-
.filter((key) => nodes.get(key).
|
|
600
|
+
.filter((key) => !nodes.get(key).finished)
|
|
563
601
|
.map((key) => {
|
|
564
602
|
const predecessor = nodes.get(key);
|
|
565
603
|
return { plan_key: predecessor.plan_key, task_id: predecessor.task_id };
|
|
@@ -568,7 +606,7 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
568
606
|
enforceListLimit('active_set.unmet_dependencies', unmetDependencies);
|
|
569
607
|
activeSet.push({ ...task, unmet_dependencies: unmetDependencies });
|
|
570
608
|
}
|
|
571
|
-
if (isNodeReady(node, graph)) nextReady.push(task);
|
|
609
|
+
if (isNodeReady(node, graph)) nextReady.push({ ...task, done_condition: node.done_condition });
|
|
572
610
|
if (node.status === 'blocked') {
|
|
573
611
|
blocked.push({
|
|
574
612
|
plan_key: node.plan_key,
|
|
@@ -611,6 +649,12 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
611
649
|
// 並列候補も別の列である。判定が進んでもdispatchは動かない——next_ready・
|
|
612
650
|
// dispatch_frontier・frontier_digestは判定状態を1バイトも含まない(ADR 0063・ob04)。
|
|
613
651
|
parallel_candidates: parallelCandidates,
|
|
652
|
+
// u03 A24/A25b/N6: 陳腐化・消えた越境参照はStoreのfindingで、dispatchを止めない。
|
|
653
|
+
// 一覧で上限に達してもstatusを拒否しないよう、本文は先頭から切り、件数は全数を返す。
|
|
654
|
+
cross_plan_findings: {
|
|
655
|
+
total: (readModel.cross_plan_findings ?? []).length,
|
|
656
|
+
entries: (readModel.cross_plan_findings ?? []).slice(0, TODO_STATUS_FINDING_LIMIT),
|
|
657
|
+
},
|
|
614
658
|
member_heads: memberHeads,
|
|
615
659
|
result_digest: '',
|
|
616
660
|
};
|
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,31 @@
|
|
|
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 from done (u12). */
|
|
22
|
+
export function isFinishedTodoTaskState(state) {
|
|
23
|
+
return state?.status === 'done'
|
|
24
|
+
|| (state?.status === 'retired' && (state.done_at !== null || state.imported === true));
|
|
6
25
|
}
|
|
7
26
|
|
|
8
27
|
export function isDecoupledPhaseTodoPlanSchema(schema) {
|
|
9
|
-
return ['lattice.todo_plan.v5', 'lattice.todo_plan.v7'].includes(schema);
|
|
28
|
+
return ['lattice.todo_plan.v5', 'lattice.todo_plan.v7', 'lattice.todo_plan.v8'].includes(schema);
|
|
10
29
|
}
|
|
11
30
|
|
|
12
31
|
// CLI側(migrate/plan create/最後のdone)が「終端重監査が要る」ことを通知するために
|