@quolu/lattice 0.111.5 → 0.112.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/package.json +1 -1
- package/src/cli-help.mjs +3 -3
- package/src/todo-cli.mjs +9 -4
- package/src/todo-store-view.mjs +35 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quolu/lattice",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.112.0",
|
|
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",
|
package/src/cli-help.mjs
CHANGED
|
@@ -96,7 +96,7 @@ Read commands:
|
|
|
96
96
|
notice list [--lane <lane>] [--include-acked] [--json] # 着手できるようになった工程の知らせ(既定は未ackだけ。lane省略で全lane)
|
|
97
97
|
blockers [--json] # ブロック中の工程を全部返す(題・担当・理由の全文・ブロックした時刻と者・外すコマンド。読むだけ。外すのは誰でも todo unblock)
|
|
98
98
|
bindings [--plan <key>] [--json] # compile_binding付きTaskをTODO identityつきで投影する
|
|
99
|
-
display read [--json] # host表示用の工程表読取(lattice.todo_display_read_result.v1)。不整合でも断らずstate
|
|
99
|
+
display read [--json] [--compact] # host表示用の工程表読取(lattice.todo_display_read_result.v1)。不整合でも断らずstateで返す。--compact は journal を activity、plan_scoped を cross_plan_dependencies に絞った lattice.todo_display_compact_result.v1(大きさは task と生きた線に比例)
|
|
100
100
|
display source [--json] # 安い変更検知(lattice.todo_store_display_source.v1)。変わった時だけreadする
|
|
101
101
|
independence [--plan <key>] [--json] # readyを検証済み並列・要直列・未検査へ分けて投影する
|
|
102
102
|
structure --schema --json # plan定義後に入力する論理dataflow契約をstore非依存で返す
|
|
@@ -347,7 +347,7 @@ const SUBCOMMAND_USAGE = Object.freeze({
|
|
|
347
347
|
'todo blockers': 'todo blockers [--json] # lattice.todo_blockers_result.v1 {blockers: [{plan_key, task_id, title, lane, reason, blocked_at, blocked_by, unblock_action}]}',
|
|
348
348
|
'todo wait': 'todo wait --plan <key> --task <id> [--reason <text>] | --cancel [--json] # 廃止予定の別名: todo connect priority',
|
|
349
349
|
'todo bindings': 'todo bindings [--plan <key>] [--json]',
|
|
350
|
-
'todo display': 'todo display read [--json] | source [--json] # host表示用の読取。不整合でも断らずstateで返す',
|
|
350
|
+
'todo display': 'todo display read [--json] [--compact] | source [--json] # host表示用の読取。不整合でも断らずstateで返す',
|
|
351
351
|
charts: 'charts list [--json] | source [--project <id>]... [--json] # LATTICE_CHARTS_ROOT配下の全工程表を1プロセスで読む',
|
|
352
352
|
'charts list': 'charts list [--json] # lattice.charts_list_result.v1 {charts_root, charts:[{project_id, name, created_by, created_at, source}], findings}',
|
|
353
353
|
'charts source': 'charts source [--project <id>]... [--json] # lattice.charts_source_result.v1 {charts:{<id>: <source>|null}}(--project無し=全工程表)',
|
|
@@ -356,7 +356,7 @@ const SUBCOMMAND_USAGE = Object.freeze({
|
|
|
356
356
|
'chart repo': 'chart repo bind --url <url> --branch <branch> [--json] | sync [--json] # lattice.chart_repo_result.v1',
|
|
357
357
|
'chart repo bind': 'chart repo bind --url <url> --branch <branch> [--json] # コード工程表のrepoを記録する',
|
|
358
358
|
'chart repo sync': 'chart repo sync [--json] # depth-1 fetch、accepted_tipからだけ前進(reset/forceしない)、その後sensor。status current|synced|dirty|diverged|failed',
|
|
359
|
-
'todo display read': 'todo display read [--json] # lattice.todo_display_read_result.v1(state: verified|unverified|last_verified|unavailable)',
|
|
359
|
+
'todo display read': 'todo display read [--json] [--compact] # lattice.todo_display_read_result.v1(state: verified|unverified|last_verified|unavailable)。--compact: lattice.todo_display_compact_result.v1(journal→activity、plan_scoped→cross_plan_dependencies)',
|
|
360
360
|
'todo display source': 'todo display source [--json] # lattice.todo_store_display_source.v1(安い変更検知。変わった時だけreadする)',
|
|
361
361
|
'todo independence': 'todo independence [--plan <key>] [--json] | mode --plan <key> --set <witness|conversation|enforced> --reason <text>'
|
|
362
362
|
+ ' | compile --plan <key> --input <file> | compile --schema --json | witness migrate --plan <key>'
|
package/src/todo-cli.mjs
CHANGED
|
@@ -173,6 +173,7 @@ import {
|
|
|
173
173
|
externalCycle, readTodoExternalChart, readTodoExternalTasks, withTodoExternalTasks,
|
|
174
174
|
} from './todo-external.mjs';
|
|
175
175
|
import { projectTodoTrees } from './todo-trees.mjs';
|
|
176
|
+
import { compactDisplayStore } from './todo-store-view.mjs';
|
|
176
177
|
import { projectTodoBlockers, todoBlockerKey } from './todo-blockers.mjs';
|
|
177
178
|
import {
|
|
178
179
|
ackTodoNotices, cancelTodoNoticeWait, readAllTodoNoticeAcks, readAllTodoNoticeWaits, readTodoNoticeAcks, writeTodoNoticeWait,
|
|
@@ -1280,13 +1281,15 @@ async function startAdvisory({ repoRoot, store, projection, planKey, taskId }) {
|
|
|
1280
1281
|
* xchart: the display envelope plus `external_tasks`, so a host computing readiness from it sees other charts too;
|
|
1281
1282
|
* a100: plus `trees`, each task tree and its size, so the host never computes the graph.
|
|
1282
1283
|
*/
|
|
1283
|
-
async function displayRead(repoRoot, env) {
|
|
1284
|
+
async function displayRead(repoRoot, env, { compact = false } = {}) {
|
|
1284
1285
|
const display = await readTodoStoreForDisplay({ repoRoot });
|
|
1285
1286
|
const externalTasks = display.store ? (await readTodoExternalTasks(display.store, env)).external_tasks : [];
|
|
1286
|
-
|
|
1287
|
+
const result = { schema: 'lattice.todo_display_read_result.v1', ...display, external_tasks: externalTasks,
|
|
1287
1288
|
trees: display.store ? projectTodoTrees(display.store) : [],
|
|
1288
1289
|
...(display.store && splitLabels(display.store).length > 0 ? { labels: splitLabels(display.store) } : {}),
|
|
1289
1290
|
connections: display.store ? await displayConnections(repoRoot, { ...display.store, external_tasks: externalTasks }) : [] };
|
|
1291
|
+
// trees, labels and connections are read from the full view above; only the shipped store is compacted
|
|
1292
|
+
return compact ? { ...result, schema: 'lattice.todo_display_compact_result.v1', store: result.store && compactDisplayStore(result.store) } : result;
|
|
1290
1293
|
}
|
|
1291
1294
|
|
|
1292
1295
|
/** 接続: `[{plan_key, task_id, connections}]` for every task that has any (the one list: 他条件に接続 and 優先接続). */
|
|
@@ -5460,10 +5463,12 @@ export async function runTodoCli({ argv, cwd, stdout, stderr, env = process.env,
|
|
|
5460
5463
|
&& (argv.length === 3 || argv[3] === '--json')) {
|
|
5461
5464
|
action = (repoRoot) => bindings({ repoRoot, requestedPlanKey: argv[2] });
|
|
5462
5465
|
} else if (argv[0] === 'display' && (argv[1] === 'read' || argv[1] === 'source')
|
|
5463
|
-
&& (argv.length === 2 || (argv.length === 3 && argv[2] === '--json')
|
|
5466
|
+
&& (argv.length === 2 || (argv.length === 3 && argv[2] === '--json')
|
|
5467
|
+
|| (argv[1] === 'read' && argv.slice(2).every((flag) => flag === '--json' || flag === '--compact')
|
|
5468
|
+
&& new Set(argv.slice(2)).size === argv.length - 2))) {
|
|
5464
5469
|
// Host display read (BellTeam module): a typed inconsistency is a state, never a refusal.
|
|
5465
5470
|
action = argv[1] === 'read'
|
|
5466
|
-
? async (repoRoot) => displayRead(repoRoot, env)
|
|
5471
|
+
? async (repoRoot) => displayRead(repoRoot, env, { compact: argv.includes('--compact') })
|
|
5467
5472
|
: (repoRoot) => readTodoStoreDisplaySource({ repoRoot });
|
|
5468
5473
|
} else if (argv[0] === 'note' && argv[1] !== 'list') {
|
|
5469
5474
|
const flags = matchFlagCommand(argv, ['note'], NOTE_FLAG_SPEC);
|
package/src/todo-store-view.mjs
CHANGED
|
@@ -76,6 +76,41 @@ export function projectTodoCrossPlanDependencies(members) {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Compact display read (host surface, `todo display read --compact`): each member's `journal` and `plan_scoped` are replaced by
|
|
81
|
+
* what a chart host uses, so the size grows with tasks and live edges, never with notes, evidence or repeated events.
|
|
82
|
+
* `activity` = `{first: {at, agent}|null, last_at, tasks: [{task_id, changed_at, started: {at, agent}|null}]}` (journal events
|
|
83
|
+
* only; `started` = the last `start`; only tasks with an event). `cross_plan_dependencies` = the live
|
|
84
|
+
* `[{event_digest, from, to}]` of the member's plan-scoped chain (a removal in any member's chain drops it).
|
|
85
|
+
* A member with neither (the unverified raw read) is returned as it is.
|
|
86
|
+
*/
|
|
87
|
+
export function compactDisplayStore(store) {
|
|
88
|
+
const removed = new Set(store.members.flatMap((member) => (member.plan_scoped?.events ?? [])
|
|
89
|
+
.filter((event) => event.kind === 'cross_plan_dependency_removed').map((event) => event.payload.target_event_digest)));
|
|
90
|
+
return { ...store, members: store.members.map(({ journal, plan_scoped: planScoped, ...member }) => {
|
|
91
|
+
if (journal === undefined && planScoped === undefined) return member;
|
|
92
|
+
const events = journal?.events ?? [];
|
|
93
|
+
const tasks = new Map();
|
|
94
|
+
let first = null;
|
|
95
|
+
let last = null;
|
|
96
|
+
for (const event of events) {
|
|
97
|
+
if (first === null || event.recorded_at < first.recorded_at) first = event;
|
|
98
|
+
if (last === null || event.recorded_at > last) last = event.recorded_at;
|
|
99
|
+
if (event.task_id === undefined || event.task_id === null) continue;
|
|
100
|
+
const entry = tasks.get(event.task_id) ?? { task_id: event.task_id, changed_at: event.recorded_at, started: null };
|
|
101
|
+
if (event.recorded_at > entry.changed_at) entry.changed_at = event.recorded_at;
|
|
102
|
+
if (event.kind === 'start') entry.started = { at: event.recorded_at, agent: event.actor?.agent ?? null };
|
|
103
|
+
tasks.set(event.task_id, entry);
|
|
104
|
+
}
|
|
105
|
+
return { ...member,
|
|
106
|
+
activity: { first: first === null ? null : { at: first.recorded_at, agent: first.actor?.agent ?? null },
|
|
107
|
+
last_at: last, tasks: [...tasks.values()] },
|
|
108
|
+
cross_plan_dependencies: (planScoped?.events ?? [])
|
|
109
|
+
.filter((event) => event.kind === 'cross_plan_dependency' && !removed.has(event.event_digest))
|
|
110
|
+
.map((event) => ({ event_digest: event.event_digest, from: event.payload.from, to: event.payload.to })) };
|
|
111
|
+
}) };
|
|
112
|
+
}
|
|
113
|
+
|
|
79
114
|
/**
|
|
80
115
|
* 接続 (schedule): one plan chain's connection_added events with how each ended. `ended` is 'removed' or
|
|
81
116
|
* 'resolved' (an add has at most one end, which Store append enforces); a state of 'removed' is not shown.
|