@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 CHANGED
@@ -242,6 +242,23 @@ still starts and reports it in `advisory.guidance`. `independence compile` fails
242
242
  lattice todo start --plan <key> --task <id>
243
243
  ```
244
244
 
245
+ ### What a task waits for: four words, four commands
246
+
247
+ Each word names one thing; none stands in for another (`docs/architecture/dfd-connect.md` in the repository).
248
+
249
+ | Word | Means | Command |
250
+ |---|---|---|
251
+ | 前工程 | a task on **this** chart that must finish first; its done notice wakes the lane | `lattice todo predecessor add\|remove --plan <key> --task <id> --after <plan>/<task> --reason <text>` |
252
+ | 他条件に接続 (接続) | a condition **outside** this chart: a task on another chart, or a BellTeam schedule (a check, a time, CI, a publication) | `lattice todo connect condition add\|remove --plan <key> --task <id> --to task:<project>/<plan>/<task>\|schedule:<id> --reason <text>`; a schedule settles with `connect condition resolve --to schedule:<id> --message <evidence>` |
253
+ | 優先接続 | "tell me the moment this task can start", interrupting my work; gates nothing | `lattice todo connect priority --plan <key> --task <id> [--reason <text>] \| --cancel` |
254
+ | ブロック | last resort: something stops an in-progress task, nothing can be connected, no AI can operate it | `lattice todo block\|unblock` |
255
+
256
+ `predecessor` refuses a task on another chart or a schedule (`predecessor_target_not_same_chart`, next_action
257
+ `connect condition add`); `connect condition` refuses a task on this chart (`condition_target_same_chart`, next_action
258
+ `predecessor add`). A task with an open 接続 cannot start. Every `connect condition` write is idempotent:
259
+ a repeat answers `unchanged: true`. `todo dependency connect|disconnect` and `todo wait` still work for one minor
260
+ version and print the command that replaces them.
261
+
245
262
  Full CLI surface: `lattice --help`, then
246
263
  `lattice <plan|run|event|todo|sensor|factory-diagnostics|runtime-errors|bridge|hooks> --help`.
247
264
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quolu/lattice",
3
- "version": "0.103.0",
3
+ "version": "0.104.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
@@ -94,7 +94,7 @@ Read commands:
94
94
  show --plan <key> --task <id> --json # 個別ToDoと最新bounded note contextを追加操作なしで返す
95
95
  note list --plan <key> [--task <id>] --json # note全履歴の診断面(通常read/startでは不要)
96
96
  notice list [--lane <lane>] [--include-acked] [--json] # 着手できるようになった工程の知らせ(既定は未ackだけ。lane省略で全lane)
97
- blockers [--json] # 止めのある工程を全部返す(題・担当・理由の全文・止めた時刻と者・外すコマンド。読むだけ。外すのは誰でも todo unblock)
97
+ blockers [--json] # ブロック中の工程を全部返す(題・担当・理由の全文・ブロックした時刻と者・外すコマンド。読むだけ。外すのは誰でも todo unblock)
98
98
  bindings [--plan <key>] [--json] # compile_binding付きTaskをTODO identityつきで投影する
99
99
  display read [--json] # host表示用の工程表読取(lattice.todo_display_read_result.v1)。不整合でも断らずstateで返す
100
100
  display source [--json] # 安い変更検知(lattice.todo_store_display_source.v1)。変わった時だけreadする
@@ -110,7 +110,6 @@ Read commands:
110
110
 
111
111
  Write commands:
112
112
  notice ack --lane <lane> --notice <id>[,<id>...] [--json] # 届けた知らせに印を付ける(閉じた知らせはclosedで返す)
113
- wait --plan <key> --task <id> [--reason <text>] | --cancel [--json] # 手を止めてこの工程を待つ印。着手できたら知らせにwaitingが載る(記録だけで、何も止めない)
114
113
  repair-eol --json # Git checkoutでCRLF化された既存storeをcanonical LFへ戻し、EOL保護を追加する
115
114
  dashboard adopt --json # 衝突したproject_idの配信元rootを現在repoへ明示的に移す
116
115
  dashboard ensure --json # daemon生存保証の冪等入口(launchd等の周期実行向け)
@@ -130,6 +129,8 @@ Write commands:
130
129
  # 自分の席が記録したstartを取り消してpendingへ戻す。reopenやimportで開いた工程には
131
130
  # 取り消すstartが無いので、doneで閉じる
132
131
  block --plan <key> --task <id> --reason <text>
132
+ # ブロックは最後の手段。待っているものが自分の工程表の工程なら predecessor add(前工程)、
133
+ # それ以外で名指しや確認ができるもの(別の工程表の工程、予定表の確認)は connect condition add(他条件に接続)を使う
133
134
  unblock --plan <key> --task <id>
134
135
  retire --plan <key> --task <id> --reason <text>
135
136
  # 1件を閉じる。planは書き直さず、他のtaskの状態とjournalはそのまま
@@ -145,10 +146,26 @@ Write commands:
145
146
  evidence anchor [--json] # 既存の証拠をgcから守る印(refs/lattice/evidence/<oid>)を付ける。commit済みにはならない
146
147
  # done状態と完了時刻を維持し、最新doneへ追記eventで証拠を再束縛する
147
148
  start --plan <key> --task <id> --rebind --reason <text> # 改訂でcarryされたin-progressへ現版のstart束縛を積み直す(ADR 0191)
149
+ predecessor add --plan <key> --task <id> --after <plan>/<task> --reason <text>
150
+ predecessor remove --plan <key> --task <id> --after <plan>/<task> --reason <text>
151
+ # 前工程: 自分の工程表の工程で、先に終わっていなければこの工程に着手できないもの。同じ工程表の工程だけを取る
152
+ # (別の工程表の工程や予定表は predecessor_target_not_same_chart で断り、connect condition を案内する)。
153
+ # 同一plan内の辺はplan本体を軽い改訂で書き換え(plan_versionが変わる)、plan跨ぎは台帳に積む。依存の自動推定は行わない
154
+ connect condition add --plan <key> --task <id> --to task:<project>/<plan>/<task>|schedule:<id> --reason <text>
155
+ connect condition remove --plan <key> --task <id> --to task:<project>/<plan>/<task>|schedule:<id> --reason <text>
156
+ connect condition resolve --plan <key> --task <id> --to schedule:<id> --message <evidence>
157
+ connect priority --plan <key> --task <id> [--reason <text>] | --cancel [--json]
158
+ # 接続は2つ。他条件に接続(condition): 自分の工程表の外の条件が成り立つまで、この工程に着手できない。接続先は別の工程表の工程か、BellTeamの予定。
159
+ # 同じ工程表の工程は condition_target_same_chart で断り、predecessor add を案内する。
160
+ # task: は LATTICE_CHARTS_ROOT/<project_id>/.lattice を読むだけで書かない。その工程が done/retire で成立し、読めない間は接続は開いたまま。
161
+ # schedule: はBellTeamが成立させる(予定のcommandが0で終わったら resolve)。resolve は schedule: だけ。
162
+ # 優先接続(priority): この工程に着手できるようになったら、いまの作業に割り込んででも知らせてほしい、という印(旧 todo wait)。
163
+ # 知らせにwaitingが載る。記録だけで、何も止めない(着手を止めるのは接続と前工程)
148
164
  dependency connect [--from-project <id>] --from-plan <key> --from-task <id> --to-plan <key> --to-task <id> --reason <text>
149
165
  dependency disconnect [--from-project <id>] --from-plan <key> --from-task <id> --to-plan <key> --to-task <id> --reason <text>
150
- # 開発中に発見した依存を明示接続する。同一plan内の辺はplan本体を軽い改訂で書き換え(plan_versionが変わる)、plan跨ぎは台帳に積む。依存の自動推定は行わない
151
- # --from-project = 別の工程表(別プロジェクト)の工程を前工程にする。LATTICE_CHARTS_ROOT/<project_id>/.lattice を読むだけで書かない。読めない間は待ちのまま
166
+ # 廃止予定(次のminorまで別名)。実行のたびに、使う命令を stderr に出す:
167
+ # 同じ工程表なら predecessor add|remove、--from-project なら connect condition add|remove
168
+ wait --plan <key> --task <id> [--reason <text>] | --cancel [--json] # 廃止予定(次のminorまで別名): connect priority
152
169
  independence mode --plan <key> --set <witness|conversation|enforced> --reason <text>
153
170
  # enforced = witness+未宣言・古い宣言・衝突・参照なしdone・heavy段階の監査なし閉じを止める(ADR 0200)
154
171
  # このplanの調整方式(witness検証で並列するか、会話で調整するか)を記録する
@@ -315,7 +332,7 @@ const SUBCOMMAND_USAGE = Object.freeze({
315
332
  'todo notice list': 'todo notice list [--lane <lane>] [--include-acked] [--json] # lattice.todo_notice_list_result.v1',
316
333
  'todo notice ack': 'todo notice ack --lane <lane> --notice <id>[,<id>...] [--json] # lattice.todo_notice_ack_result.v1 {acked, already, closed}',
317
334
  'todo blockers': 'todo blockers [--json] # lattice.todo_blockers_result.v1 {blockers: [{plan_key, task_id, title, lane, reason, blocked_at, blocked_by, unblock_action}]}',
318
- 'todo wait': 'todo wait --plan <key> --task <id> [--reason <text>] | --cancel [--json] # lattice.todo_wait_result.v1 {state: waiting|startable_now|not_pending|cancelled}',
335
+ 'todo wait': 'todo wait --plan <key> --task <id> [--reason <text>] | --cancel [--json] # 廃止予定の別名: todo connect priority',
319
336
  'todo bindings': 'todo bindings [--plan <key>] [--json]',
320
337
  'todo display': 'todo display read [--json] | source [--json] # host表示用の読取。不整合でも断らずstateで返す',
321
338
  charts: 'charts list [--json] | source [--project <id>]... [--json] # LATTICE_CHARTS_ROOT配下の全工程表を1プロセスで読む',
@@ -356,7 +373,8 @@ const SUBCOMMAND_USAGE = Object.freeze({
356
373
  'todo phase baseline': 'todo phase baseline --reason <text> [--except <plan_key>]...',
357
374
  'todo start': 'todo start --plan <key> --task <id> [--parallel-frontier|--override-reason <text>]',
358
375
  'todo retract': 'todo retract --plan <key> --task <id> --reason <text>',
359
- 'todo block': 'todo block --plan <key> --task <id> --reason <text>',
376
+ 'todo block': 'todo block --plan <key> --task <id> --reason <text>'
377
+ + ' # ブロックは最後の手段。待っているものが自分の工程表の工程なら todo predecessor add(前工程)、それ以外で名指しや確認ができるものは todo connect condition add(他条件に接続)を使う',
360
378
  'todo unblock': 'todo unblock --plan <key> --task <id>',
361
379
  'todo retire': 'todo retire --plan <key> --task <id> --reason <text>',
362
380
  'todo add': 'todo add --plan <key> --task <id> --title <text> [--phase <id>] [--lane <lane>] [--done-condition <text>]'
@@ -366,12 +384,33 @@ const SUBCOMMAND_USAGE = Object.freeze({
366
384
  'todo evidence': 'todo evidence promote --plan <key> --task <id> --evidence <file> | anchor [--json]',
367
385
  'todo evidence anchor': 'todo evidence anchor [--json] # lattice.todo_evidence_anchor_result.v1 {anchored, already, missing}; no Store yet: lattice.todo_evidence_anchor_uninitialized.v1',
368
386
  'todo evidence promote': 'todo evidence promote --plan <key> --task <id> --evidence <file>',
387
+ 'todo predecessor': [
388
+ 'todo predecessor add --plan <key> --task <id> --after <plan>/<task> --reason <text>',
389
+ 'todo predecessor remove --plan <key> --task <id> --after <plan>/<task> --reason <text>',
390
+ ].join('\n lattice '),
391
+ 'todo predecessor add': 'todo predecessor add --plan <key> --task <id> --after <plan>/<task> --reason <text> # 前工程(同じ工程表の工程だけ)',
392
+ 'todo predecessor remove': 'todo predecessor remove --plan <key> --task <id> --after <plan>/<task> --reason <text>',
393
+ 'todo connect': [
394
+ 'todo connect condition add --plan <key> --task <id> --to task:<project>/<plan>/<task>|schedule:<id> --reason <text>',
395
+ 'todo connect condition remove --plan <key> --task <id> --to task:<project>/<plan>/<task>|schedule:<id> --reason <text>',
396
+ 'todo connect condition resolve --plan <key> --task <id> --to schedule:<id> --message <evidence>',
397
+ 'todo connect priority --plan <key> --task <id> [--reason <text>] | --cancel [--json]',
398
+ ].join('\n lattice '),
399
+ 'todo connect condition': [
400
+ 'todo connect condition add --plan <key> --task <id> --to task:<project>/<plan>/<task>|schedule:<id> --reason <text>',
401
+ 'todo connect condition remove --plan <key> --task <id> --to task:<project>/<plan>/<task>|schedule:<id> --reason <text>',
402
+ 'todo connect condition resolve --plan <key> --task <id> --to schedule:<id> --message <evidence>',
403
+ ].join('\n lattice '),
404
+ 'todo connect condition add': 'todo connect condition add --plan <key> --task <id> --to task:<project>/<plan>/<task>|schedule:<id> --reason <text> # 他条件に接続(自分の工程表の外だけ)',
405
+ 'todo connect condition remove': 'todo connect condition remove --plan <key> --task <id> --to task:<project>/<plan>/<task>|schedule:<id> --reason <text>',
406
+ 'todo connect condition resolve': 'todo connect condition resolve --plan <key> --task <id> --to schedule:<id> --message <evidence> # schedule: の接続だけ',
407
+ 'todo connect priority': 'todo connect priority --plan <key> --task <id> [--reason <text>] | --cancel [--json] # 優先接続(旧 todo wait)。lattice.todo_connect_priority_result.v1 {state: prioritized|startable_now|not_pending|cancelled}',
369
408
  'todo dependency': [
370
409
  'todo dependency connect [--from-project <id>] --from-plan <key> --from-task <id> --to-plan <key> --to-task <id> --reason <text>',
371
410
  'todo dependency disconnect [--from-project <id>] --from-plan <key> --from-task <id> --to-plan <key> --to-task <id> --reason <text>',
372
411
  ].join('\n lattice '),
373
- 'todo dependency connect': 'todo dependency connect [--from-project <id>] --from-plan <key> --from-task <id> --to-plan <key> --to-task <id> --reason <text>',
374
- 'todo dependency disconnect': 'todo dependency disconnect [--from-project <id>] --from-plan <key> --from-task <id> --to-plan <key> --to-task <id> --reason <text>',
412
+ 'todo dependency connect': 'todo dependency connect [--from-project <id>] --from-plan <key> --from-task <id> --to-plan <key> --to-task <id> --reason <text> # 廃止予定の別名: predecessor add / connect condition add',
413
+ 'todo dependency disconnect': 'todo dependency disconnect [--from-project <id>] --from-plan <key> --from-task <id> --to-plan <key> --to-task <id> --reason <text> # 廃止予定の別名: predecessor remove / connect condition remove',
375
414
  'todo split': 'todo split --plan <key> --input <file>',
376
415
  'todo revise': 'todo revise --plan <key> --input <file> | --schema --json',
377
416
  'todo revise-phase': 'todo revise-phase --plan <key> --input <file> | --schema --json',
@@ -42,6 +42,19 @@ const unfinishedFirst = (detail, ctx) => {
42
42
  blocked: `Unblock ${name} with \`lattice todo unblock ${on}\`, then record done on it`,
43
43
  })[first.status] ?? `Record done on ${name} first with \`${doneCommand(first.plan_key, first.task_id, ctx, ' --message <text>')}\` (see \`lattice todo show ${on} --json\`)`;
44
44
  };
45
+ // 接続: an open 他条件に接続 is not a 前工程; name how it settles and how to remove it (Store: blocking_connections).
46
+ const openConnections = (detail) => (Array.isArray(detail.blocking_connections) ? detail.blocking_connections.filter(record) : []);
47
+ const connectionsFirst = (detail, ctx) => {
48
+ const [first] = openConnections(detail);
49
+ const on = `--plan ${planOf(detail, ctx)} --task ${taskOf(detail, ctx)}`;
50
+ if (first === undefined) return `It has an open 接続; see \`${showTask(detail, ctx)}\` (prerequisites.connections)`;
51
+ const to = first.kind === 'task' ? `task:${first.ref}` : `schedule:${first.ref}`;
52
+ const settles = first.kind === 'task'
53
+ ? `Finish ${first.ref} on its chart (the 接続 settles when that task is done or retired)`
54
+ : `Schedule ${first.ref} has not settled the 接続 yet (its command exits 0 when the awaited condition holds)`;
55
+ return `${settles}, or remove the 接続 with \`lattice todo connect condition remove ${on} --to ${to} --reason <text>\``;
56
+ };
57
+ const withConnections = (detail, ctx, text) => (openConnections(detail).length === 0 ? text : `${text} Also open: ${connectionsFirst(detail, ctx)}.`);
45
58
  // a36: a start without LATTICE_SEAT_ID is recorded under the OS user; after the seat sets its id that
46
59
  // start looks like another seat's. Say so and give the seat contract's one-time fix.
47
60
  const inProgressHolder = (detail, ctx, on) => {
@@ -82,7 +95,7 @@ const edgeName = (detail) => (record(detail.from) && record(detail.to)
82
95
  const dependencyCycle = {
83
96
  repair: (detail) => {
84
97
  const path = cyclePath(detail);
85
- return `${edgeName(detail)} would close a cycle${path === null ? '' : ` (${path})`}: leave it out, or disconnect one edge of that path with \`lattice todo dependency disconnect\`.`;
98
+ return `${edgeName(detail)} would close a cycle${path === null ? '' : ` (${path})`}: leave it out, or remove one edge of that path: \`lattice todo predecessor remove\` for a 前工程 on this chart, \`lattice todo connect condition remove\` for a 接続 to another chart.`;
86
99
  },
87
100
  };
88
101
  // a23: dependency refusals name the edge or the task and a command that lists valid ones.
@@ -200,14 +213,16 @@ const REGISTRY = {
200
213
 
201
214
  invalid_done_transition: {
202
215
  repair: (detail, ctx) => ({
203
- predecessor_unfinished: `${unfinishedFirst(detail, ctx)}.`,
216
+ predecessor_unfinished: withConnections(detail, ctx, `${unfinishedFirst(detail, ctx)}.`),
217
+ connection_open: `${connectionsFirst(detail, ctx)}.`,
204
218
  acceptance_edge: phaseAcceptFirst(detail, ctx),
205
219
  task_state: doneState(detail, ctx),
206
220
  })[detail.cause] ?? `Check the task state with \`${showTask(detail, ctx)}\`, then rerun.`,
207
221
  },
208
222
  invalid_start_transition: {
209
223
  repair: (detail, ctx) => ({
210
- predecessor_unfinished: `${unfinishedFirst(detail, ctx)}, or start with --override-reason <text>.`,
224
+ predecessor_unfinished: withConnections(detail, ctx, `${unfinishedFirst(detail, ctx)}, or start with --override-reason <text>.`),
225
+ connection_open: `${connectionsFirst(detail, ctx)}, or start with --override-reason <text>.`,
211
226
  acceptance_edge: phaseAcceptFirst(detail, ctx),
212
227
  task_state: startState(detail, ctx),
213
228
  phase_state: 'Its phase is not active; check the phase status with `lattice todo status --json`.',
@@ -1,4 +1,5 @@
1
1
  import { withTodoExternalTasks } from './todo-external.mjs';
2
+ import { withTodoPriorityWaits } from './todo-notices.mjs';
2
3
  import { gitSync } from './git-process.mjs';
3
4
  import { constants as fsConstants } from 'node:fs';
4
5
  import { lstat, open } from 'node:fs/promises';
@@ -292,7 +293,7 @@ async function resolveProjectState({ cwd, cliVersion, diagnoseStructureArtifacts
292
293
  }
293
294
  try {
294
295
  // xchart: predecessors on other charts count for next_ready here too.
295
- const store = await withTodoExternalTasks(await readTodoStore({ repoRoot }), env);
296
+ const store = await withTodoPriorityWaits(await withTodoExternalTasks(await readTodoStore({ repoRoot }), env), { repoRoot });
296
297
  if (diagnoseStructureArtifacts) {
297
298
  const diagnostics = await readTodoStructureArtifactDiagnostics({ repoRoot, store });
298
299
  if (diagnostics.length > 0) {