@quolu/lattice 0.103.0 → 0.104.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.md +17 -0
- package/package.json +1 -1
- package/src/cli-help.mjs +47 -8
- package/src/cli-refusal-guidance.mjs +18 -3
- package/src/project-cli.mjs +2 -1
- package/src/todo-cli.mjs +250 -25
- package/src/todo-contracts.mjs +34 -17
- package/src/todo-gantt-html-independence.mjs +2 -2
- package/src/todo-gantt-html-shared.mjs +30 -1
- package/src/todo-gantt-html-style.mjs +1 -0
- package/src/todo-gantt-html.mjs +7 -4
- package/src/todo-gantt-layout.mjs +2 -0
- package/src/todo-independence-guidance.mjs +2 -2
- package/src/todo-migration.mjs +5 -6
- package/src/todo-note-store.mjs +1 -1
- package/src/todo-notice-store.mjs +2 -2
- package/src/todo-notices.mjs +12 -1
- package/src/todo-readiness.mjs +53 -7
- package/src/todo-revision.mjs +12 -13
- package/src/todo-status.mjs +46 -7
- package/src/todo-store-view.mjs +59 -0
- package/src/todo-store.mjs +44 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DOCUMENT_STATUS, SEVERABILITY_LABEL, escapeHtmlAttribute, escapeHtmlText, foldIndex, planActivity, presentationLookup, refKey, renderPhaseProgress, renderRelationList, renderSeamProposalOverview, renderTaskIndex, statusMarkup, taskReference } from './todo-gantt-html-shared.mjs';
|
|
1
|
+
import { DOCUMENT_STATUS, SEVERABILITY_LABEL, escapeHtmlAttribute, escapeHtmlText, foldIndex, planActivity, presentationLookup, refKey, renderConnectionArea, renderPhaseProgress, renderRelationList, renderSeamProposalOverview, renderTaskIndex, statusMarkup, taskReference } from './todo-gantt-html-shared.mjs';
|
|
2
2
|
import {
|
|
3
3
|
hasTodoStructurePresentation,
|
|
4
4
|
renderTodoStructureNoscript,
|
|
@@ -254,7 +254,7 @@ export function renderRightPane(
|
|
|
254
254
|
: '<p class="fold-note">完走済みのため図には描いていません。図に出すには動的dashboardを <code>lattice todo gantt serve --port <port> --scope all</code> で起動してください。</p>';
|
|
255
255
|
const workLog = notesEnabled ? renderNoteContext(section.noteContext, hostDisplayNames) : '';
|
|
256
256
|
const designMemo = renderDesignMemo(section.task) + renderDoneCondition(section.task);
|
|
257
|
-
return `<article class="task-detail" data-detail-key="${escapeHtmlAttribute(key)}" hidden><header><span class="detail-status status-${escapeHtmlAttribute(section.state.status)}">${escapeHtmlText(status.mark)} ${escapeHtmlText(status.label)}</span><span class="detail-reference">${escapeHtmlText(taskReference(section, lookup))}</span></header><h1>${escapeHtmlText(section.task.title)}</h1><p class="detail-category"><strong>カテゴリ:</strong> ${escapeHtmlText(category)}</p>${categoryDescription}<p><strong>正規ID:</strong> <code>${escapeHtmlText(`${section.ref.plan_key}/${section.task.task_id}`)}</code></p>${blockedReason}${readiness}${independenceNote}${foldedNote}${designMemo}<section><h2>前提工程</h2>${renderRelationList(incoming.get(key), sectionByKey, lookup, '登録済みの前提工程はありません。', folds)}</section><section><h2>後続工程</h2>${renderRelationList(outgoing.get(key), sectionByKey, lookup, '登録済みの後続工程はありません。', folds)}</section>${workLog}<p class="anchor-status">${escapeHtmlText(anchorText)}</p><details class="task-diagnostics"><summary>開発者向け診断</summary><dl><dt>canonical ref</dt><dd><code>${escapeHtmlText(`${section.ref.project_id}/${section.ref.plan_key}/${section.task.task_id}`)}</code></dd><dt>anchor</dt><dd>${escapeHtmlText(section.anchorOutcome.anchored ? 'verified' : section.anchorOutcome.reason)}</dd></dl></details></article>`;
|
|
257
|
+
return `<article class="task-detail" data-detail-key="${escapeHtmlAttribute(key)}" hidden><header><span class="detail-status status-${escapeHtmlAttribute(section.state.status)}">${escapeHtmlText(status.mark)} ${escapeHtmlText(status.label)}</span><span class="detail-reference">${escapeHtmlText(taskReference(section, lookup))}</span></header><h1>${escapeHtmlText(section.task.title)}</h1><p class="detail-category"><strong>カテゴリ:</strong> ${escapeHtmlText(category)}</p>${categoryDescription}<p><strong>正規ID:</strong> <code>${escapeHtmlText(`${section.ref.plan_key}/${section.task.task_id}`)}</code></p>${blockedReason}${renderConnectionArea(section.connections)}${readiness}${independenceNote}${foldedNote}${designMemo}<section><h2>前提工程</h2>${renderRelationList(incoming.get(key), sectionByKey, lookup, '登録済みの前提工程はありません。', folds)}</section><section><h2>後続工程</h2>${renderRelationList(outgoing.get(key), sectionByKey, lookup, '登録済みの後続工程はありません。', folds)}</section>${workLog}<p class="anchor-status">${escapeHtmlText(anchorText)}</p><details class="task-diagnostics"><summary>開発者向け診断</summary><dl><dt>canonical ref</dt><dd><code>${escapeHtmlText(`${section.ref.project_id}/${section.ref.plan_key}/${section.task.task_id}`)}</code></dd><dt>anchor</dt><dd>${escapeHtmlText(section.anchorOutcome.anchored ? 'verified' : section.anchorOutcome.reason)}</dd></dl></details></article>`;
|
|
258
258
|
}).join('');
|
|
259
259
|
const taskIndex = renderTaskIndex(sections, lookup, folds, planActivity(readModel));
|
|
260
260
|
const structureButton = hasTodoStructurePresentation(structurePresentation)
|
|
@@ -44,6 +44,35 @@ export function foldIndex(layout) {
|
|
|
44
44
|
return new Set((layout?.folded ?? []).map((ref) => refKey(ref)));
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
// One 接続 area per task (Owner 2026-11-15): 他条件に接続 (task/schedule) and 優先接続 (priority) side by side, from the
|
|
48
|
+
// single `connections` list; ブロック中 is drawn where it was.
|
|
49
|
+
const CONNECTION_LABEL = Object.freeze({ task: '他条件に接続', schedule: '他条件に接続', priority: '優先接続' });
|
|
50
|
+
const CONNECTION_TARGET = Object.freeze({ task: '工程', schedule: '予定' });
|
|
51
|
+
|
|
52
|
+
function connectionLine(entry) {
|
|
53
|
+
const label = CONNECTION_LABEL[entry.kind] ?? '接続';
|
|
54
|
+
const settled = entry.state === 'settled';
|
|
55
|
+
const target = entry.kind === 'priority'
|
|
56
|
+
? `${entry.agent}(着手できるようになったら知らせを受ける)`
|
|
57
|
+
: `${CONNECTION_TARGET[entry.kind] ?? ''} <code>${escapeHtmlText(entry.ref)}</code>`;
|
|
58
|
+
const state = entry.kind === 'priority' ? '' : settled ? ' — 成立' : entry.state_reason === 'chart_not_read' ? ' — 開いている(その工程表を読めません)' : ' — 開いている';
|
|
59
|
+
const note = [entry.reason, settled ? entry.evidence : null].filter((text) => typeof text === 'string' && text.length > 0).map(escapeHtmlText).join(' / ');
|
|
60
|
+
return `<li class="connection connection-${escapeHtmlAttribute(entry.kind)}" data-state="${escapeHtmlAttribute(entry.state ?? 'open')}"><strong>${label}</strong> ${target}${state}${note === '' ? '' : ` — ${note}`}${entry.since ? ` <time>${escapeHtmlText(entry.since)}</time>` : ''}</li>`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The detail pane's 接続 area; empty when the task has no connections. */
|
|
64
|
+
export function renderConnectionArea(connections = []) {
|
|
65
|
+
return connections.length === 0 ? ''
|
|
66
|
+
: `<section class="connections" aria-label="接続"><h2>接続</h2><ul>${connections.map(connectionLine).join('')}</ul></section>`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The chip row: one chip per kind, counting the open 他条件に接続 and the 優先接続. */
|
|
70
|
+
export function renderConnectionChips(connections = []) {
|
|
71
|
+
const open = connections.filter((entry) => entry.kind !== 'priority' && entry.state !== 'settled').length;
|
|
72
|
+
const priority = connections.filter((entry) => entry.kind === 'priority').length;
|
|
73
|
+
return `${open === 0 ? '' : `<span class="connection-chip">他条件に接続 ${open}</span>`}${priority === 0 ? '' : '<span class="connection-chip">優先接続</span>'}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
47
76
|
export function renderTaskIndexEntry(section, lookup) {
|
|
48
77
|
const key = refKey(section.ref);
|
|
49
78
|
const status = DOCUMENT_STATUS[section.state.status] ?? { mark: '?', label: '状態不明' };
|
|
@@ -52,7 +81,7 @@ export function renderTaskIndexEntry(section, lookup) {
|
|
|
52
81
|
// A ToDo the diagram does not draw keeps its row here — the index is the
|
|
53
82
|
// complete list — and it selects its own detail, which exists either way.
|
|
54
83
|
const selectKey = key;
|
|
55
|
-
return `<li><button type="button" data-select-node-key="${escapeHtmlAttribute(selectKey)}"><span class="task-index-status status-${escapeHtmlAttribute(section.state.status)}" role="img" aria-label="${escapeHtmlAttribute(status.label)}">${escapeHtmlText(status.mark)}</span><span class="task-index-reference">${escapeHtmlText(taskReference(section, lookup))}</span><strong>${escapeHtmlText(section.task.title)}</strong>${blockedReason}</button></li>`;
|
|
84
|
+
return `<li><button type="button" data-select-node-key="${escapeHtmlAttribute(selectKey)}"><span class="task-index-status status-${escapeHtmlAttribute(section.state.status)}" role="img" aria-label="${escapeHtmlAttribute(status.label)}">${escapeHtmlText(status.mark)}</span><span class="task-index-reference">${escapeHtmlText(taskReference(section, lookup))}</span><strong>${escapeHtmlText(section.task.title)}</strong>${blockedReason}${renderConnectionChips(section.connections)}</button></li>`;
|
|
56
85
|
}
|
|
57
86
|
|
|
58
87
|
/** plan_key -> 最終活動時刻。journalの末尾eventが、そのplanが最後に動いた時点。 */
|
|
@@ -101,6 +101,7 @@ button.fold-chip[aria-expanded="true"]{border-color:var(--text-primary)}
|
|
|
101
101
|
.status-in-progress .status-bar{stroke:var(--accent);stroke-width:2;stroke-linecap:round}
|
|
102
102
|
.status-done .node-surface{fill:var(--surface-2);stroke:var(--border);stroke-width:1}
|
|
103
103
|
.status-done .status-mark{fill:var(--good)}
|
|
104
|
+
.connections ul{margin:4px 0 8px;padding-left:18px}.connection time{color:var(--text-secondary);font-size:12px;white-space:nowrap}.connection-chip{display:inline-block;margin-left:6px;padding:0 8px;border:1px solid var(--accent);border-radius:9999px;color:var(--accent);font-size:12px;white-space:nowrap}
|
|
104
105
|
.status-blocked .node-surface{fill:var(--surface-1);stroke:var(--critical);stroke-width:2}
|
|
105
106
|
.status-blocked .status-mark{fill:var(--critical)}
|
|
106
107
|
.next-ready-node .node-surface{stroke:var(--accent);stroke-width:2;stroke-dasharray:4 3}
|
package/src/todo-gantt-html.mjs
CHANGED
|
@@ -70,7 +70,8 @@ function digest(value) {
|
|
|
70
70
|
* still read, because anchor verification needs them, and their size is still
|
|
71
71
|
* bounded — but they are not rendered into the page.
|
|
72
72
|
*/
|
|
73
|
-
function normalizeSections(readModel, narratives, anchorOutcomes, noteContexts, omitProse = false) {
|
|
73
|
+
function normalizeSections(readModel, narratives, anchorOutcomes, noteContexts, omitProse = false, connections = []) {
|
|
74
|
+
const connected = new Map(connections.map((entry) => [refKey(entry), entry.connections]));
|
|
74
75
|
const supplied = new Map(narratives.map((entry) => [refKey(entry.ref), entry]));
|
|
75
76
|
const outcomes = new Map(anchorOutcomes.map((entry) => [refKey(entry.ref), entry]));
|
|
76
77
|
const notes = noteContexts === null ? null : new Map(noteContexts.map((entry) => [
|
|
@@ -123,6 +124,7 @@ function normalizeSections(readModel, narratives, anchorOutcomes, noteContexts,
|
|
|
123
124
|
}
|
|
124
125
|
result.push({
|
|
125
126
|
ref, task: shownTask, state: states.get(task.task_id), narrativeRef, anchorOutcome, noteContext,
|
|
127
|
+
connections: connected.get(refKey(ref)) ?? [],
|
|
126
128
|
});
|
|
127
129
|
}
|
|
128
130
|
}
|
|
@@ -216,8 +218,9 @@ const NESTED_CONTROLLER = `
|
|
|
216
218
|
export function renderTodoGanttHtml({
|
|
217
219
|
readModel, layout, narratives = [], anchorOutcomes = [], presentation = null, metadata = {},
|
|
218
220
|
expandedLayout = null, noteContexts = null, noteWarnings = [], structurePresentation = null,
|
|
219
|
-
notices = [],
|
|
221
|
+
notices = [], connections = [],
|
|
220
222
|
}) {
|
|
223
|
+
if (!Array.isArray(connections)) throw new TypeError('connections must be an array');
|
|
221
224
|
if (readModel?.schema !== 'lattice.todo_store_read.v1' || !Array.isArray(readModel.members)) {
|
|
222
225
|
throw new TypeError('readModel must be lattice.todo_store_read.v1');
|
|
223
226
|
}
|
|
@@ -262,13 +265,13 @@ export function renderTodoGanttHtml({
|
|
|
262
265
|
return html;
|
|
263
266
|
};
|
|
264
267
|
const layoutNotices = [...(layout?.notices ?? []), ...notices];
|
|
265
|
-
let normalized = normalizeSections(readModel, narratives, anchorOutcomes, noteContexts);
|
|
268
|
+
let normalized = normalizeSections(readModel, narratives, anchorOutcomes, noteContexts, false, connections);
|
|
266
269
|
let pageNotices = [...layoutNotices, ...normalized.notices];
|
|
267
270
|
let html = build(normalized, pageNotices);
|
|
268
271
|
let htmlBytes = Buffer.byteLength(html, 'utf8');
|
|
269
272
|
if (htmlBytes > TODO_GANTT_HTML_MAX_BYTES) {
|
|
270
273
|
// u03 D-gantt: draw the page without the embedded prose; if it is still over, serve it with the notice.
|
|
271
|
-
normalized = normalizeSections(readModel, narratives, anchorOutcomes, noteContexts, true);
|
|
274
|
+
normalized = normalizeSections(readModel, narratives, anchorOutcomes, noteContexts, true, connections);
|
|
272
275
|
pageNotices = [...layoutNotices, { code: 'TODO_SCALE_EXCEEDED',
|
|
273
276
|
message: 'ページ全体の大きさが上限を超えたため、設計メモ・終了条件・作業記録を省いて描いています',
|
|
274
277
|
detail: { html_bytes: htmlBytes, html_limit: TODO_GANTT_HTML_MAX_BYTES } }];
|
|
@@ -245,6 +245,8 @@ function normalizeInput(readModel) {
|
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
for (const dependency of projectTodoCrossPlanDependencies(members)) {
|
|
248
|
+
// A task on another chart is a 接続: it lives in the task's `connections`, never as a drawn edge.
|
|
249
|
+
if (dependency.from.project_id !== dependency.to.project_id) continue;
|
|
248
250
|
addEdge(dependency.from, dependency.to, 'cross_plan');
|
|
249
251
|
}
|
|
250
252
|
if (skippedEdges.length > 0) {
|
|
@@ -104,11 +104,11 @@ const CATALOG = Object.freeze({
|
|
|
104
104
|
}),
|
|
105
105
|
independence_conflict_with_active: Object.freeze({
|
|
106
106
|
message: '作業中の工程と同じ資源を書く記録がある。並行すると衝突する。',
|
|
107
|
-
next_action: 'lattice todo
|
|
107
|
+
next_action: 'lattice todo predecessor add --plan <key> --task <id> --after <plan>/<task> --reason <text>',
|
|
108
108
|
}),
|
|
109
109
|
independence_conflict_between_ready: Object.freeze({
|
|
110
110
|
message: '他のready工程と同じ資源を書く記録がある。同時に着手すると衝突する。',
|
|
111
|
-
next_action: 'lattice todo
|
|
111
|
+
next_action: 'lattice todo predecessor add --plan <key> --task <id> --after <plan>/<task> --reason <text>',
|
|
112
112
|
}),
|
|
113
113
|
independence_verdicts_absent: Object.freeze({
|
|
114
114
|
message: '判定が途中で止まっており、記録はどの組についてもverdictを持たない。自分にunknownが無いことは、他と干渉しない証拠にならない。',
|
package/src/todo-migration.mjs
CHANGED
|
@@ -124,7 +124,7 @@ function isCrossPlanEdge(edge) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
function validateEdges(value, schema) {
|
|
127
|
-
return Array.isArray(value)
|
|
127
|
+
return Array.isArray(value)
|
|
128
128
|
&& value.every((edge) => {
|
|
129
129
|
const basic = exactRecord(edge, ['from', 'to']);
|
|
130
130
|
const refsValid = nodeRef(edge?.from) && nodeRef(edge?.to);
|
|
@@ -139,10 +139,10 @@ function validateEdges(value, schema) {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
function validateJoins(value) {
|
|
142
|
-
return Array.isArray(value)
|
|
142
|
+
return Array.isArray(value)
|
|
143
143
|
&& value.every((join) => exactRecord(join, ['id', 'after', 'before'])
|
|
144
144
|
&& isTodoIdentifier(join.id) && Array.isArray(join.after) && join.after.length > 0
|
|
145
|
-
&& join.after.
|
|
145
|
+
&& join.after.every(nodeRef)
|
|
146
146
|
&& sortedStrictly(join.after, refKey) && nodeRef(join.before))
|
|
147
147
|
&& sortedStrictly(value, (join) => join.id);
|
|
148
148
|
}
|
|
@@ -230,8 +230,7 @@ export function explainTodoExtraction(value) {
|
|
|
230
230
|
if (!isTodoIdentifier(value.plan_version)) return reject('invalid_identifier', '/plan_version');
|
|
231
231
|
if (!actor(value.actor)) return reject('invalid_actor', '/actor');
|
|
232
232
|
if (!isStrictTodoTimestamp(value.recorded_at)) return reject('invalid_timestamp', '/recorded_at');
|
|
233
|
-
if (!Array.isArray(value.tasks) || value.tasks.length
|
|
234
|
-
|| (value.tasks.length === 0 && !v4)) {
|
|
233
|
+
if (!Array.isArray(value.tasks) || (value.tasks.length === 0 && !v4)) {
|
|
235
234
|
return reject('bounded_collection_violation', '/tasks');
|
|
236
235
|
}
|
|
237
236
|
const taskKeys = v2
|
|
@@ -387,7 +386,7 @@ export function validateTodoExtraction(value) {
|
|
|
387
386
|
|| !isTodoIdentifier(value.project_id)
|
|
388
387
|
|| !isTodoIdentifier(value.plan_key) || !isTodoIdentifier(value.plan_version)
|
|
389
388
|
|| !actor(value.actor) || !isStrictTodoTimestamp(value.recorded_at)
|
|
390
|
-
|| !Array.isArray(value.tasks)
|
|
389
|
+
|| !Array.isArray(value.tasks)
|
|
391
390
|
|| (value.tasks.length === 0 && schema !== TODO_EXTRACTION_SCHEMA_V4)
|
|
392
391
|
|| !value.tasks.every((task) => extractionTask(task, schema))
|
|
393
392
|
|| !sortedStrictly(value.tasks, (task) => task.task_id)
|
package/src/todo-note-store.mjs
CHANGED
|
@@ -446,7 +446,7 @@ export function projectTodoNoteContext(options = {}) {
|
|
|
446
446
|
let usedBytes = 0;
|
|
447
447
|
for (const entry of offered) {
|
|
448
448
|
// 件数もvalidatorと同じ上限で切る。byteに収まる短いnoteが溜まると、自分の出力が自分の検証で落ちる。
|
|
449
|
-
if (notes.length >= TODO_LIMITS.
|
|
449
|
+
if (notes.length >= TODO_LIMITS.noteContextEntries) break;
|
|
450
450
|
const bytes = Buffer.byteLength(entry.body, 'utf8');
|
|
451
451
|
if (usedBytes + bytes > TODO_LIMITS.noteContextBytes) continue;
|
|
452
452
|
notes.push(entry);
|
|
@@ -15,7 +15,7 @@ export { TODO_NOTICE_ACKS_SCHEMA, TODO_NOTICE_WAITS_SCHEMA };
|
|
|
15
15
|
* Per-lane ack set of startable notices and per-plan waits (dfd-done-notice.md, rows "Store: ack set",
|
|
16
16
|
* "Store: waits record", "Store: ack key"). Host-local delivery state, not a plan fact: git-ignored (its own
|
|
17
17
|
* .gitignore), one lock for both, never touching the lifecycle journals. Losing an ack means a notice is
|
|
18
|
-
* delivered again; losing a wait loses the wake mark (the notice still lists) until `todo
|
|
18
|
+
* delivered again; losing a wait loses the wake mark (the notice still lists) until `todo connect priority` runs again.
|
|
19
19
|
*/
|
|
20
20
|
export const TODO_NOTICE_ROOT_REF = '.lattice/todo/notices';
|
|
21
21
|
const ACKS_V1_SCHEMA = 'lattice.todo_notice_acks.v1';
|
|
@@ -101,7 +101,7 @@ const ACK_FILE = {
|
|
|
101
101
|
const WAIT_RECORD = {
|
|
102
102
|
family: 'todo_notice_waits', label: 'notice_waits', digest: 'waits_digest',
|
|
103
103
|
advice: 'is a host-local notice wait file, not plan data. Delete it to drop the plan\'s wake marks'
|
|
104
|
-
+ ' (re-run `lattice todo
|
|
104
|
+
+ ' (re-run `lattice todo connect priority` to restore one), or run `lattice todo connect priority` to replace it.',
|
|
105
105
|
parse(record) {
|
|
106
106
|
if (!exactRecord(record, ['schema', 'plan_key', 'waits', 'waits_digest']) || record.schema !== TODO_NOTICE_WAITS_SCHEMA
|
|
107
107
|
|| !isTodoIdentifier(record.plan_key) || !Array.isArray(record.waits) || !record.waits.every(isWait)
|
package/src/todo-notices.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Store journals. Lattice records and shows; a notice starts nothing and gates nothing.
|
|
3
3
|
|
|
4
4
|
import { digestTodoArtifact } from './todo-contracts.mjs';
|
|
5
|
-
import { todoNoticeWaitingDigest } from './todo-notice-store.mjs';
|
|
5
|
+
import { readAllTodoNoticeWaits, todoNoticeWaitingDigest } from './todo-notice-store.mjs';
|
|
6
6
|
import { createTodoReadiness } from './todo-readiness.mjs';
|
|
7
7
|
import { projectTodoStatus, TODO_STATUS_DISPATCH_ONLY } from './todo-status.mjs';
|
|
8
8
|
|
|
@@ -44,6 +44,17 @@ export function waitInEffect(store, wait) {
|
|
|
44
44
|
&& ['start', 'retire'].includes(event.kind) && event.recorded_at > wait.since);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* 優先接続: `store` plus `priority_waits`, the host-local `todo wait` marks still in effect (an unreadable file reads as
|
|
49
|
+
* none, as for notices), so every read surface draws the same `connections` list. Gates nothing.
|
|
50
|
+
*/
|
|
51
|
+
export async function withTodoPriorityWaits(store, { repoRoot }) {
|
|
52
|
+
if (store.priority_waits !== undefined) return store;
|
|
53
|
+
const stored = await readAllTodoNoticeWaits({ repoRoot });
|
|
54
|
+
return { ...store, priority_waits: stored.waits.flatMap((record) => record.waits
|
|
55
|
+
.map((wait) => ({ plan_key: record.plan_key, ...wait }))).filter((wait) => waitInEffect(store, wait)) };
|
|
56
|
+
}
|
|
57
|
+
|
|
47
58
|
function noticeSummary(planKey, task, waiting) {
|
|
48
59
|
const head = `${planKey}/${task.task_id} 「${task.title}」 can start now.`;
|
|
49
60
|
return waiting.length === 0
|
package/src/todo-readiness.mjs
CHANGED
|
@@ -2,7 +2,9 @@ import {
|
|
|
2
2
|
isDecoupledPhaseTodoPlanSchema,
|
|
3
3
|
isFinishedTodoTaskState,
|
|
4
4
|
isPhaseTodoPlanSchema,
|
|
5
|
+
projectTodoConnections,
|
|
5
6
|
projectTodoCrossPlanDependencies,
|
|
7
|
+
projectTodoScheduleConnections,
|
|
6
8
|
stepTodoReopenedPending,
|
|
7
9
|
} from './todo-store-view.mjs';
|
|
8
10
|
import { TodoStoreError, todoPhaseDefinitions } from './todo-store.mjs';
|
|
@@ -85,6 +87,19 @@ export function createTodoReadiness(store) {
|
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
for (const edge of projectTodoCrossPlanDependencies(store.members)) connect(edge.from, edge.to);
|
|
90
|
+
// 接続: schedule targets and cross-chart task targets, per task; an open one keeps the task from starting.
|
|
91
|
+
const connectionsByTask = projectTodoConnections(store.members, store.external_tasks ?? []);
|
|
92
|
+
const connections = (key) => connectionsByTask.get(key) ?? [];
|
|
93
|
+
// 優先接続: the host-local `todo wait` mark (store.priority_waits, in-effect only). It gates nothing.
|
|
94
|
+
const priorityByTask = new Map();
|
|
95
|
+
for (const wait of store.priority_waits ?? []) {
|
|
96
|
+
const key = taskKey({ project_id: store.project_id, plan_key: wait.plan_key, task_id: wait.task_id });
|
|
97
|
+
priorityByTask.set(key, [...(priorityByTask.get(key) ?? []),
|
|
98
|
+
{ kind: 'priority', agent: wait.agent, since: wait.since, reason: wait.reason ?? null }]);
|
|
99
|
+
}
|
|
100
|
+
/** The one read-contract list: 他条件に接続 entries (gating) then 優先接続 entries (never gating). */
|
|
101
|
+
const allConnections = (key) => [...connections(key),
|
|
102
|
+
...(priorityByTask.get(key) ?? []).sort((left, right) => (left.agent < right.agent ? -1 : left.agent > right.agent ? 1 : 0))];
|
|
88
103
|
|
|
89
104
|
function dependencyPhaseReady(predecessor, target) {
|
|
90
105
|
if (predecessor === undefined) return false;
|
|
@@ -100,6 +115,8 @@ export function createTodoReadiness(store) {
|
|
|
100
115
|
const predecessors = [...(incoming.get(key) ?? [])].map(predecessorNode)
|
|
101
116
|
.filter((node) => node !== undefined);
|
|
102
117
|
const unfinished = predecessors.filter((node) => node.finished !== true);
|
|
118
|
+
// 前工程 = same chart; a task on another chart is a 接続 and is named in blocking_connections instead.
|
|
119
|
+
const unfinishedHere = unfinished.filter((node) => node.project_id === undefined);
|
|
103
120
|
const unreadyPhases = predecessors.filter((node) => !dependencyPhaseReady(node, nodes.get(key)));
|
|
104
121
|
const predecessorsDone = unfinished.length === 0;
|
|
105
122
|
const predecessorPhasesReady = unreadyPhases.length === 0;
|
|
@@ -107,21 +124,33 @@ export function createTodoReadiness(store) {
|
|
|
107
124
|
const unacceptedEdges = [...(acceptanceIncoming.get(key) ?? [])]
|
|
108
125
|
.map((source) => phases.get(source)).filter((phase) => phase !== undefined && phase.status !== 'accepted');
|
|
109
126
|
const phaseAcceptReady = unacceptedEdges.length === 0;
|
|
127
|
+
const openConnections = connections(key).filter(({ state }) => state === 'open');
|
|
128
|
+
// Only a schedule 接続 is an extra gate; a task 接続 is today's cross-chart edge, already in `unfinished`.
|
|
129
|
+
const scheduleOpen = openConnections.some(({ kind }) => kind === 'schedule');
|
|
130
|
+
const connectionsOpen = scheduleOpen || unfinished.some((node) => node.project_id !== undefined);
|
|
110
131
|
const cause = !phaseAcceptReady ? 'acceptance_edge'
|
|
111
|
-
:
|
|
112
|
-
:
|
|
132
|
+
: unfinishedHere.length > 0 ? 'predecessor_unfinished'
|
|
133
|
+
: connectionsOpen ? 'connection_open'
|
|
134
|
+
: !predecessorsDone ? 'predecessor_unfinished'
|
|
135
|
+
: !predecessorPhasesReady ? 'acceptance_edge' : null;
|
|
113
136
|
const blockingPhases = !phaseAcceptReady ? unacceptedEdges
|
|
114
137
|
: unreadyPhases.map((node) => ({ plan_key: node.plan_key, phase_id: node.phase_id, status: node.phase_status }));
|
|
138
|
+
const blockingConnections = openConnections.map(blockingConnection);
|
|
115
139
|
return {
|
|
116
140
|
taskDependenciesDone,
|
|
117
141
|
phaseAcceptReady,
|
|
118
142
|
dependenciesDone: taskDependenciesDone && phaseAcceptReady,
|
|
143
|
+
// start only: a schedule 接続 never gates done, and an in-progress task keeps its state when one is added.
|
|
144
|
+
startReady: taskDependenciesDone && phaseAcceptReady && !scheduleOpen,
|
|
145
|
+
scheduleOpen,
|
|
119
146
|
cause,
|
|
120
147
|
// a12: a refusal names what blocks, not only why.
|
|
121
148
|
blocking: cause === 'predecessor_unfinished'
|
|
122
|
-
? { blocking_tasks:
|
|
123
|
-
|
|
124
|
-
|
|
149
|
+
? { blocking_tasks: unfinishedHere.map(blockingTask).sort(byRef),
|
|
150
|
+
...(blockingConnections.length === 0 ? {} : { blocking_connections: blockingConnections }) }
|
|
151
|
+
: cause === 'connection_open' ? { blocking_connections: blockingConnections }
|
|
152
|
+
: cause === 'acceptance_edge'
|
|
153
|
+
? { blocking_phases: uniqueRefs(blockingPhases).map((phase) => ({ ...phase })).sort(byRef) } : {},
|
|
125
154
|
};
|
|
126
155
|
}
|
|
127
156
|
|
|
@@ -168,8 +197,10 @@ export function createTodoReadiness(store) {
|
|
|
168
197
|
prerequisiteRefs,
|
|
169
198
|
ownPhaseReady,
|
|
170
199
|
ownPhaseStatus,
|
|
200
|
+
connections,
|
|
201
|
+
allConnections,
|
|
171
202
|
isReady: (key) => nodes.get(key)?.status === 'pending'
|
|
172
|
-
&& ownPhaseReady(key) && prerequisites(key).
|
|
203
|
+
&& ownPhaseReady(key) && prerequisites(key).startReady,
|
|
173
204
|
startedSuccessor,
|
|
174
205
|
startedSuccessors,
|
|
175
206
|
phaseHasStartedSuccessor: (member, phaseId) => member.plan.schema === 'lattice.todo_plan.v4'
|
|
@@ -193,6 +224,21 @@ function blockingTask({ project_id: projectId, plan_key, task_id, status, reason
|
|
|
193
224
|
return projectId === undefined ? { plan_key, task_id, status }
|
|
194
225
|
: { project_id: projectId, plan_key, task_id, status, reason: reason ?? null };
|
|
195
226
|
}
|
|
227
|
+
/** The refusal entry for an open 接続: what it connects to, why, and since when (+ why a task target is unread). */
|
|
228
|
+
function blockingConnection({ kind, ref, reason, since, state_reason: stateReason }) {
|
|
229
|
+
return { kind, ref, reason, since, ...(stateReason === undefined ? {} : { state_reason: stateReason }) };
|
|
230
|
+
}
|
|
231
|
+
/** The read-contract `connections` of one task (他条件に接続 open and settled, plus 優先接続 when `store.priority_waits` is loaded), for `todo show` and the CLI (call withTodoExternalTasks first). */
|
|
232
|
+
export function listTodoConnections(store, planKey, taskId, { includeRemoved = false } = {}) {
|
|
233
|
+
const member = store.members.find(({ plan }) => plan.plan_key === planKey);
|
|
234
|
+
if (member === undefined) return [];
|
|
235
|
+
const listed = createTodoReadiness(store).allConnections(`${member.plan.project_id}\0${planKey}\0${taskId}`);
|
|
236
|
+
if (!includeRemoved) return listed;
|
|
237
|
+
// A removed entry is history; a retry of remove needs it to answer `unchanged` rather than not-found.
|
|
238
|
+
const removed = projectTodoScheduleConnections(member.plan_scoped?.events).filter((entry) => entry.state === 'removed'
|
|
239
|
+
&& entry.task_id === taskId).map(({ task_id: _task, actor: _actor, provenance: _provenance, ended: _ended, ...shown }) => shown);
|
|
240
|
+
return [...listed, ...removed];
|
|
241
|
+
}
|
|
196
242
|
function byRef(left, right) {
|
|
197
243
|
return refId(left) < refId(right) ? -1 : refId(left) > refId(right) ? 1 : 0;
|
|
198
244
|
}
|
|
@@ -213,7 +259,7 @@ export function validateProspectiveEvent({ store, member, event }) {
|
|
|
213
259
|
const authoredStart = event.kind === 'start' && event.payload.start_mode !== 'historical_import'
|
|
214
260
|
&& event.payload.start_mode !== 'rebind';
|
|
215
261
|
if (authoredStart && (!prerequisites.phaseAcceptReady
|
|
216
|
-
|| (!prerequisites.taskDependenciesDone && event.payload.override_reason === null))) {
|
|
262
|
+
|| ((!prerequisites.taskDependenciesDone || prerequisites.scheduleOpen) && event.payload.override_reason === null))) {
|
|
217
263
|
return refused('invalid_start_transition', prerequisites.cause, prerequisites.blocking);
|
|
218
264
|
}
|
|
219
265
|
if (event.kind === 'done' && event.payload.done_mode === 'authored' && !prerequisites.dependenciesDone) {
|
package/src/todo-revision.mjs
CHANGED
|
@@ -139,7 +139,7 @@ function validSourceCutoverBatch(value, revision) {
|
|
|
139
139
|
if (!exactRecord(value, ['batch_id', 'archive_ref', 'operations', 'batch_digest'])
|
|
140
140
|
|| !isTodoIdentifier(value.batch_id) || !isTodoRef(value.archive_ref)
|
|
141
141
|
|| !value.archive_ref.endsWith('.md') || parseTodoSourceRef(value.archive_ref) !== null
|
|
142
|
-
|| !Array.isArray(value.operations) || value.operations.length < 1
|
|
142
|
+
|| !Array.isArray(value.operations) || value.operations.length < 1
|
|
143
143
|
|| !isTodoDigest(value.batch_digest)
|
|
144
144
|
|| value.batch_digest !== todoSelfDigest(value, 'batch_digest')) return false;
|
|
145
145
|
const sourceRefs = new Set();
|
|
@@ -183,7 +183,7 @@ function validTaskMigration(value) {
|
|
|
183
183
|
const activeTargets = Array.isArray(value)
|
|
184
184
|
? value.filter(({ to_task_id }) => to_task_id !== 'removed').map(({ to_task_id }) => to_task_id)
|
|
185
185
|
: [];
|
|
186
|
-
return Array.isArray(value) && value.length > 0
|
|
186
|
+
return Array.isArray(value) && value.length > 0
|
|
187
187
|
&& value.every((entry) => exactRecord(entry, [
|
|
188
188
|
'from_task_id', 'to_task_id', 'state_policy',
|
|
189
189
|
]) && isTodoIdentifier(entry.from_task_id)
|
|
@@ -198,7 +198,7 @@ function validTaskMigration(value) {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
function validPhaseMigration(value, desiredPlan) {
|
|
201
|
-
if (!Array.isArray(value) || value.length === 0
|
|
201
|
+
if (!Array.isArray(value) || value.length === 0
|
|
202
202
|
|| !value.every((entry) => exactRecord(entry, [
|
|
203
203
|
'from_phase_id', 'to_phase_id', 'state_policy',
|
|
204
204
|
]) && (entry.from_phase_id === null || isTodoIdentifier(entry.from_phase_id))
|
|
@@ -227,7 +227,7 @@ export function todoTaskMigrationDigest(taskMigration) {
|
|
|
227
227
|
function validRuntimeTaskMigration(value) {
|
|
228
228
|
if (!exactRecord(value, ['schema', 'entries', 'migration_digest'])
|
|
229
229
|
|| value.schema !== 'lattice.runtime_task_migration.v1'
|
|
230
|
-
|| !Array.isArray(value.entries) || value.entries.length < 1
|
|
230
|
+
|| !Array.isArray(value.entries) || value.entries.length < 1
|
|
231
231
|
|| !isTodoDigest(value.migration_digest)
|
|
232
232
|
|| value.migration_digest !== todoSelfDigest(value, 'migration_digest')) return false;
|
|
233
233
|
const targets = [];
|
|
@@ -238,7 +238,7 @@ function validRuntimeTaskMigration(value) {
|
|
|
238
238
|
'predecessor_task_id', 'disposition', 'successor_task_ids', 'reason', 'evidence_digests',
|
|
239
239
|
]) || !isTodoIdentifier(entry.predecessor_task_id)
|
|
240
240
|
|| !['carry', 'stay', 'replace', 'split', 'retire'].includes(entry.disposition)
|
|
241
|
-
|| !Array.isArray(entry.successor_task_ids)
|
|
241
|
+
|| !Array.isArray(entry.successor_task_ids)
|
|
242
242
|
|| !entry.successor_task_ids.every(isTodoIdentifier)
|
|
243
243
|
|| new Set(entry.successor_task_ids).size !== entry.successor_task_ids.length
|
|
244
244
|
|| successorTail.some((id, targetIndex) => targetIndex > 0
|
|
@@ -374,7 +374,6 @@ export function validatePhaseTodoRevision(value) {
|
|
|
374
374
|
function validSourceInventory(value, desiredPlan, { requireNarrativeRef = false } = {}) {
|
|
375
375
|
if (!exactRecord(value, ['active', 'excluded_tombstones'])
|
|
376
376
|
|| !Array.isArray(value.active) || !Array.isArray(value.excluded_tombstones)
|
|
377
|
-
|| value.active.length > 512 || value.excluded_tombstones.length > 2_048
|
|
378
377
|
|| !value.active.every((entry) => exactRecord(entry, ['task_id', 'source_ref', 'source_digest'])
|
|
379
378
|
&& isTodoIdentifier(entry.task_id) && parseTodoSourceRef(entry.source_ref) !== null
|
|
380
379
|
&& isTodoDigest(entry.source_digest))
|
|
@@ -476,7 +475,7 @@ function explainPredecessor(value, at = '/predecessor') {
|
|
|
476
475
|
* 可否を変えずに1件ずつ言い当てる。
|
|
477
476
|
*/
|
|
478
477
|
function explainTaskMigration(value, at = '/task_migration') {
|
|
479
|
-
if (!Array.isArray(value) || value.length === 0
|
|
478
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
480
479
|
return reject('bounded_collection_violation', at);
|
|
481
480
|
}
|
|
482
481
|
for (const [index, entry] of value.entries()) {
|
|
@@ -509,7 +508,7 @@ function explainTaskMigration(value, at = '/task_migration') {
|
|
|
509
508
|
}
|
|
510
509
|
|
|
511
510
|
function explainPhaseMigration(value, desiredPlan, at = '/phase_migration') {
|
|
512
|
-
if (!Array.isArray(value) || value.length === 0
|
|
511
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
513
512
|
return reject('bounded_collection_violation', at);
|
|
514
513
|
}
|
|
515
514
|
for (const [index, entry] of value.entries()) {
|
|
@@ -554,7 +553,7 @@ function explainRuntimeTaskMigration(value, taskMigration, desiredPlan, at = '/r
|
|
|
554
553
|
const keyCheck = explainKeys(value, ['schema', 'entries', 'migration_digest'], at);
|
|
555
554
|
if (!keyCheck.valid) return keyCheck;
|
|
556
555
|
if (value.schema !== 'lattice.runtime_task_migration.v1') return reject('schema_mismatch', `${at}/schema`);
|
|
557
|
-
if (!Array.isArray(value.entries) || value.entries.length === 0
|
|
556
|
+
if (!Array.isArray(value.entries) || value.entries.length === 0) {
|
|
558
557
|
return reject('bounded_collection_violation', `${at}/entries`);
|
|
559
558
|
}
|
|
560
559
|
const targets = [];
|
|
@@ -569,7 +568,7 @@ function explainRuntimeTaskMigration(value, taskMigration, desiredPlan, at = '/r
|
|
|
569
568
|
if (!['carry', 'stay', 'replace', 'split', 'retire'].includes(entry.disposition)) {
|
|
570
569
|
return reject('invalid_disposition', `${entryAt}/disposition`);
|
|
571
570
|
}
|
|
572
|
-
if (!Array.isArray(entry.successor_task_ids)
|
|
571
|
+
if (!Array.isArray(entry.successor_task_ids)
|
|
573
572
|
|| !entry.successor_task_ids.every(isTodoIdentifier)) {
|
|
574
573
|
return reject('invalid_successor_task_ids', `${entryAt}/successor_task_ids`);
|
|
575
574
|
}
|
|
@@ -631,10 +630,10 @@ function explainRuntimeTaskMigration(value, taskMigration, desiredPlan, at = '/r
|
|
|
631
630
|
function explainSourceInventory(value, desiredPlan, { requireNarrativeRef = false } = {}, at = '/source_inventory') {
|
|
632
631
|
const keyCheck = explainKeys(value, ['active', 'excluded_tombstones'], at);
|
|
633
632
|
if (!keyCheck.valid) return keyCheck;
|
|
634
|
-
if (!Array.isArray(value.active)
|
|
633
|
+
if (!Array.isArray(value.active)) {
|
|
635
634
|
return reject('bounded_collection_violation', `${at}/active`);
|
|
636
635
|
}
|
|
637
|
-
if (!Array.isArray(value.excluded_tombstones)
|
|
636
|
+
if (!Array.isArray(value.excluded_tombstones)) {
|
|
638
637
|
return reject('bounded_collection_violation', `${at}/excluded_tombstones`);
|
|
639
638
|
}
|
|
640
639
|
for (const [index, entry] of value.active.entries()) {
|
|
@@ -693,7 +692,7 @@ function explainSourceCutoverBatch(value, revision, at = '/source_cutover_batch'
|
|
|
693
692
|
|| parseTodoSourceRef(value.archive_ref) !== null) {
|
|
694
693
|
return reject('invalid_archive_ref', `${at}/archive_ref`);
|
|
695
694
|
}
|
|
696
|
-
if (!Array.isArray(value.operations) || value.operations.length === 0
|
|
695
|
+
if (!Array.isArray(value.operations) || value.operations.length === 0) {
|
|
697
696
|
return reject('bounded_collection_violation', `${at}/operations`);
|
|
698
697
|
}
|
|
699
698
|
const sourceRefs = new Set();
|
package/src/todo-status.mjs
CHANGED
|
@@ -31,7 +31,8 @@ import {
|
|
|
31
31
|
* plan単位noteは工程に属する義務で、taskへ着手した人のcontextには届くが、**まだ誰も
|
|
32
32
|
* 着手していない工程の義務は、この欄が無いとどこにも出ない**。
|
|
33
33
|
*/
|
|
34
|
-
export const TODO_STATUS_SCHEMA = 'lattice.todo_status_result.
|
|
34
|
+
export const TODO_STATUS_SCHEMA = 'lattice.todo_status_result.v10';
|
|
35
|
+
/** v10: `active_set[].connections` and `connection_pending[]` carry the one `connections` list: open 他条件に接続 and 優先接続 entries. */
|
|
35
36
|
/** v9 (u03 A77): `truncated: [{list, total, shown}]` records every cut of an output list. */
|
|
36
37
|
/** v8: cross_plan_findingsは件数だけ全数、本文は先頭からこの件数まで(statusを止めない)。 */
|
|
37
38
|
export const TODO_STATUS_FINDING_LIMIT = 32;
|
|
@@ -130,11 +131,31 @@ function taskRefEntry(value) {
|
|
|
130
131
|
&& isTodoIdentifier(value.plan_key) && isTodoIdentifier(value.task_id);
|
|
131
132
|
}
|
|
132
133
|
|
|
134
|
+
function connectionEntry(value) {
|
|
135
|
+
if (exactRecord(value, ['kind', 'agent', 'since', 'reason'])) {
|
|
136
|
+
return value.kind === 'priority' && isTodoStatusBoundedText(value.agent, TODO_STATUS_LABEL_LIMIT)
|
|
137
|
+
&& typeof value.since === 'string' && (value.reason === null || isTodoStatusBoundedText(value.reason, TODO_STATUS_REASON_LIMIT));
|
|
138
|
+
}
|
|
139
|
+
return (exactRecord(value, ['kind', 'ref', 'state', 'reason', 'since'])
|
|
140
|
+
|| exactRecord(value, ['kind', 'ref', 'state', 'reason', 'since', 'state_reason']))
|
|
141
|
+
&& ['task', 'schedule'].includes(value.kind) && value.state === 'open'
|
|
142
|
+
&& isTodoStatusBoundedText(value.ref, TODO_STATUS_REASON_LIMIT)
|
|
143
|
+
&& isTodoStatusBoundedText(value.reason, TODO_STATUS_REASON_LIMIT) && typeof value.since === 'string'
|
|
144
|
+
&& (value.state_reason === undefined || isTodoStatusBoundedText(value.state_reason, TODO_STATUS_LABEL_LIMIT));
|
|
145
|
+
}
|
|
146
|
+
|
|
133
147
|
function activeTaskEntry(value) {
|
|
134
|
-
return exactRecord(value, ['plan_key', 'task_id', 'label', 'unmet_dependencies'])
|
|
148
|
+
return exactRecord(value, ['plan_key', 'task_id', 'label', 'unmet_dependencies', 'connections'])
|
|
149
|
+
&& isTodoIdentifier(value.plan_key) && isTodoIdentifier(value.task_id)
|
|
150
|
+
&& isTodoStatusBoundedText(value.label, TODO_STATUS_LABEL_LIMIT)
|
|
151
|
+
&& boundedList(value.unmet_dependencies, taskRefEntry) && boundedList(value.connections, connectionEntry);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function connectionPendingEntry(value) {
|
|
155
|
+
return exactRecord(value, ['plan_key', 'task_id', 'label', 'connections'])
|
|
135
156
|
&& isTodoIdentifier(value.plan_key) && isTodoIdentifier(value.task_id)
|
|
136
157
|
&& isTodoStatusBoundedText(value.label, TODO_STATUS_LABEL_LIMIT)
|
|
137
|
-
&& boundedList(value.
|
|
158
|
+
&& boundedList(value.connections, connectionEntry) && value.connections.length > 0;
|
|
138
159
|
}
|
|
139
160
|
|
|
140
161
|
function blockedEntry(value) {
|
|
@@ -356,13 +377,13 @@ export function validateTodoStatusResult(value) {
|
|
|
356
377
|
try {
|
|
357
378
|
return exactRecord(value, [
|
|
358
379
|
'schema', 'project_id', 'active_set', 'next_ready', 'dispatch_frontier',
|
|
359
|
-
'blocked', 'audit_pending', 'structure_finalization_pending', 'plan_notes',
|
|
380
|
+
'blocked', 'connection_pending', 'audit_pending', 'structure_finalization_pending', 'plan_notes',
|
|
360
381
|
'coordination', 'parallel_candidates', 'cross_plan_findings',
|
|
361
382
|
'member_heads', 'truncated', 'result_digest',
|
|
362
383
|
]) && value.schema === TODO_STATUS_SCHEMA && isTodoIdentifier(value.project_id)
|
|
363
384
|
&& boundedList(value.active_set, activeTaskEntry) && boundedList(value.next_ready, taskEntry)
|
|
364
385
|
&& dispatchFrontierEntry(value.dispatch_frontier, value.project_id, value.next_ready)
|
|
365
|
-
&& boundedList(value.blocked, blockedEntry) && boundedList(value.audit_pending, auditPendingEntry)
|
|
386
|
+
&& boundedList(value.blocked, blockedEntry) && boundedList(value.connection_pending, connectionPendingEntry) && boundedList(value.audit_pending, auditPendingEntry)
|
|
366
387
|
&& boundedList(value.structure_finalization_pending, structureFinalizationPendingEntry)
|
|
367
388
|
&& boundedList(value.plan_notes, planNoteEntry)
|
|
368
389
|
&& boundedList(value.coordination, coordinationEntry)
|
|
@@ -625,8 +646,23 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
625
646
|
const activeSet = [];
|
|
626
647
|
const nextReady = [];
|
|
627
648
|
const blocked = [];
|
|
649
|
+
const connectionPending = [];
|
|
650
|
+
// One `connections` list (the Owner's one place): open 他条件に接続 entries and 優先接続 entries. Settled ones are
|
|
651
|
+
// history that `todo show` lists.
|
|
652
|
+
const openConnections = (key) => graph.readiness.allConnections(key)
|
|
653
|
+
.filter((entry) => entry.kind === 'priority' || entry.state === 'open')
|
|
654
|
+
.map((entry) => entry.kind === 'priority'
|
|
655
|
+
? { kind: 'priority', agent: displayText(entry.agent, 'unknown', TODO_STATUS_LABEL_LIMIT), since: entry.since,
|
|
656
|
+
reason: entry.reason === null ? null : displayText(entry.reason, 'priority', TODO_STATUS_REASON_LIMIT) }
|
|
657
|
+
: { kind: entry.kind, ref: entry.ref, state: 'open', reason: displayText(entry.reason, 'connection', TODO_STATUS_REASON_LIMIT),
|
|
658
|
+
since: entry.since,
|
|
659
|
+
...(entry.state_reason === undefined ? {} : { state_reason: displayText(entry.state_reason, 'chart_not_read', TODO_STATUS_LABEL_LIMIT) }) });
|
|
628
660
|
for (const node of nodes.values()) {
|
|
629
661
|
const task = { plan_key: node.plan_key, task_id: node.task_id, label: node.label };
|
|
662
|
+
if (node.status === 'pending') {
|
|
663
|
+
const connections = openConnections(node.key);
|
|
664
|
+
if (connections.length > 0) connectionPending.push({ ...task, connections });
|
|
665
|
+
}
|
|
630
666
|
if (node.status === 'in-progress') {
|
|
631
667
|
const unmetDependencies = [...incoming.get(node.key)]
|
|
632
668
|
.filter((key) => !nodes.get(key).finished)
|
|
@@ -641,7 +677,7 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
641
677
|
const entry = truncated.get('active_set.unmet_dependencies');
|
|
642
678
|
entry.total += unmetDependencies.length; entry.shown += shownDependencies.length;
|
|
643
679
|
}
|
|
644
|
-
activeSet.push({ ...task, unmet_dependencies: shownDependencies });
|
|
680
|
+
activeSet.push({ ...task, unmet_dependencies: shownDependencies, connections: openConnections(node.key) });
|
|
645
681
|
}
|
|
646
682
|
if (isNodeReady(node, graph)) nextReady.push({ ...task, done_condition: node.done_condition });
|
|
647
683
|
if (node.status === 'blocked') {
|
|
@@ -655,9 +691,11 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
655
691
|
activeSet.sort(compareTaskEntries);
|
|
656
692
|
nextReady.sort(compareTaskEntries);
|
|
657
693
|
blocked.sort(compareTaskEntries);
|
|
694
|
+
connectionPending.sort(compareTaskEntries);
|
|
658
695
|
memberHeads.sort((left, right) => left.plan_key < right.plan_key ? -1 : left.plan_key > right.plan_key ? 1 : 0);
|
|
659
696
|
const lists = {
|
|
660
|
-
active_set: activeSet, next_ready: nextReady, blocked,
|
|
697
|
+
active_set: activeSet, next_ready: nextReady, blocked, connection_pending: connectionPending,
|
|
698
|
+
audit_pending: auditPending,
|
|
661
699
|
structure_finalization_pending: structureFinalizations, plan_notes: planNotes,
|
|
662
700
|
coordination, parallel_candidates: parallelCandidates, member_heads: memberHeads,
|
|
663
701
|
};
|
|
@@ -678,6 +716,7 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
678
716
|
next_ready: lists.next_ready,
|
|
679
717
|
dispatch_frontier: dispatchFrontier(readModel.project_id, lists.next_ready),
|
|
680
718
|
blocked: lists.blocked,
|
|
719
|
+
connection_pending: lists.connection_pending,
|
|
681
720
|
// 監査待ちは`member.phases`だけから作った別の列で、dispatch(next_ready/dispatch_frontier)へは
|
|
682
721
|
// 影響しない。監査が進んでもfrontier_digestは動かない。
|
|
683
722
|
audit_pending: lists.audit_pending,
|