@quolu/lattice 0.63.0 → 0.63.2

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.
Files changed (60) hide show
  1. package/LICENSE +147 -147
  2. package/README.ja.md +378 -378
  3. package/README.md +303 -303
  4. package/bin/lattice-mcp.mjs +0 -0
  5. package/bin/lattice-scripted-adapter.mjs +0 -0
  6. package/bin/lattice-scripted-worker.mjs +0 -0
  7. package/bin/lattice-work-order-adapter.mjs +0 -0
  8. package/bin/lattice.mjs +3 -1
  9. package/docs/bridge-setup.md +248 -248
  10. package/docs/schemas/lattice.executor_packet.v1.schema.json +57 -57
  11. package/docs/schemas/lattice.executor_receipt.v1.schema.json +66 -66
  12. package/docs/schemas/lattice.phase_todo_revision.v3.schema.json +360 -360
  13. package/docs/schemas/lattice.plan_create_input.v1.schema.json +56 -56
  14. package/docs/schemas/lattice.plan_create_input.v2.schema.json +72 -72
  15. package/docs/schemas/lattice.plan_create_input.v3.schema.json +81 -81
  16. package/docs/schemas/lattice.plan_create_input.v4.schema.json +357 -85
  17. package/docs/schemas/lattice.plan_scope_review.v1.schema.json +55 -55
  18. package/docs/schemas/lattice.run_request.v1.schema.json +238 -238
  19. package/docs/schemas/lattice.runtime_adapter_capabilities.v2.schema.json +55 -55
  20. package/docs/schemas/lattice.runtime_adapter_registration_input.v1.schema.json +78 -78
  21. package/docs/schemas/lattice.runtime_adapter_registration_input.v2.schema.json +86 -86
  22. package/docs/schemas/lattice.todo_extraction.v2.schema.json +298 -298
  23. package/docs/schemas/lattice.todo_extraction.v3.schema.json +150 -150
  24. package/docs/schemas/lattice.todo_extraction.v4.schema.json +161 -161
  25. package/docs/schemas/lattice.todo_revision.v2.schema.json +260 -260
  26. package/docs/schemas/lattice.todo_revision_set.v3.schema.json +363 -363
  27. package/docs/schemas/lattice.todo_structure_binding.v1.schema.json +47 -47
  28. package/docs/schemas/lattice.todo_structure_realization.v1.schema.json +55 -55
  29. package/docs/schemas/lattice.todo_structure_set.v1.schema.json +264 -264
  30. package/package.json +109 -109
  31. package/sensor/LICENSE +21 -21
  32. package/sensor/NOTICE +19 -19
  33. package/sensor/dist/bin/lattice-sensor.js +9 -9
  34. package/sensor/dist/db/index.js +24 -24
  35. package/sensor/dist/db/migrations.js +41 -41
  36. package/sensor/dist/db/queries.js +164 -164
  37. package/sensor/dist/db/schema.sql +205 -205
  38. package/sensor/dist/directory.js +5 -5
  39. package/sensor/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  40. package/sensor/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
  41. package/sensor/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
  42. package/sensor/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
  43. package/sensor/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
  44. package/sensor/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
  45. package/sensor/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  46. package/sensor/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  47. package/sensor/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  48. package/sensor/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
  49. package/sensor/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  50. package/sensor/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  51. package/sensor/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  52. package/sensor/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  53. package/sensor/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  54. package/sensor/dist/mcp/liveness-watchdog.js +53 -53
  55. package/sensor/dist/mcp/server-instructions.js +95 -95
  56. package/sensor/package.json +56 -56
  57. package/src/project-cli.mjs +164 -24
  58. package/src/todo-authoring-input.mjs +35 -5
  59. package/src/todo-cli.mjs +2 -2
  60. package/src/todo-store.mjs +52 -21
@@ -1,260 +1,260 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://github.com/kitepon/Lattice/blob/main/docs/schemas/lattice.todo_revision.v2.schema.json",
4
- "title": "lattice.todo_revision.v2",
5
- "description": "`lattice todo revise`が受理する最新契約。v1のdesired state・source inventory・reconciliationへ、per-ToDoのsource cutover batch(Markdown置換の証跡)を加える。",
6
- "$comment": "Runtime validation (src/todo-revision.mjs validateTodoRevision) additionally enforces: canonical JSON+LF bytes; strict sort order on task_migration (by from_task_id) and source_inventory.excluded_tombstones/source_cutover_batch.operations (by source_ref); uniqueness of from_task_id/to_task_id/source_ref across those collections; desired_plan.plan_version === todoRevisionPlanVersion(...); reconciliation.reconciliation_digest === todoReconciliationDigest(...); revision_digest as the canonical self-digest over every other top-level field; and that every task_migration.to_task_id (other than 'removed') resolves to a desired_plan task.",
7
- "type": "object",
8
- "additionalProperties": false,
9
- "required": [
10
- "schema", "project_id", "plan_key", "predecessor", "desired_plan", "task_migration",
11
- "source_inventory", "reconciliation", "source_cutover_batch", "revision_digest"
12
- ],
13
- "properties": {
14
- "schema": { "const": "lattice.todo_revision.v2" },
15
- "project_id": { "$ref": "#/$defs/identifier" },
16
- "plan_key": { "$ref": "#/$defs/identifier" },
17
- "predecessor": { "$ref": "#/$defs/predecessor" },
18
- "desired_plan": {
19
- "oneOf": [
20
- { "$ref": "#/$defs/desiredPlanV3" },
21
- { "$ref": "#/$defs/desiredPlanV6" }
22
- ]
23
- },
24
- "task_migration": {
25
- "type": "array", "minItems": 1, "maxItems": 512,
26
- "items": { "$ref": "#/$defs/taskMigrationEntry" }
27
- },
28
- "source_inventory": { "$ref": "#/$defs/sourceInventory" },
29
- "reconciliation": {
30
- "type": "object", "additionalProperties": false,
31
- "required": ["predecessor_reconciliation_digest", "source_inventory_digest", "reconciliation_digest"],
32
- "properties": {
33
- "predecessor_reconciliation_digest": { "$ref": "#/$defs/digest" },
34
- "source_inventory_digest": { "$ref": "#/$defs/digest" },
35
- "reconciliation_digest": { "$ref": "#/$defs/digest" }
36
- }
37
- },
38
- "source_cutover_batch": { "$ref": "#/$defs/sourceCutoverBatch" },
39
- "revision_digest": { "$ref": "#/$defs/digest" }
40
- },
41
- "$defs": {
42
- "identifier": { "type": "string", "pattern": "^[0-9A-Za-z](?:[0-9A-Za-z._-]{0,127})$" },
43
- "digest": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
44
- "nullableDigest": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/digest" }] },
45
- "gitSha": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
46
- "repoRef": {
47
- "type": "string",
48
- "minLength": 1,
49
- "maxLength": 1024,
50
- "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\\\)(?!.*[\\u0000-\\u001f\\u007f])[^/]+(?:/[^/]+)*$"
51
- },
52
- "sourceLineRef": {
53
- "type": "string",
54
- "minLength": 1,
55
- "maxLength": 1024,
56
- "$comment": "repoRefと同じ形に加え#L<line>を必須にする。実際の判定はparseTodoSourceRef(src/todo-revision.mjs)。",
57
- "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\\\)(?!.*[\\u0000-\\u001f\\u007f])[^/]+(?:/[^/]+)*#L[1-9][0-9]*$"
58
- },
59
- "nullableRepoRef": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/repoRef" }] },
60
- "text": { "type": "string", "minLength": 1, "maxLength": 16384 },
61
- "nullableText": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/text" }] },
62
- "nodeRef": {
63
- "type": "object", "additionalProperties": false,
64
- "required": ["project_id", "plan_key", "task_id"],
65
- "properties": {
66
- "project_id": { "$ref": "#/$defs/identifier" },
67
- "plan_key": { "$ref": "#/$defs/identifier" },
68
- "task_id": { "$ref": "#/$defs/identifier" },
69
- "expected_topology_digest": { "$ref": "#/$defs/digest" }
70
- }
71
- },
72
- "edge": {
73
- "type": "object", "additionalProperties": false, "required": ["from", "to"],
74
- "properties": { "from": { "$ref": "#/$defs/nodeRef" }, "to": { "$ref": "#/$defs/nodeRef" } }
75
- },
76
- "join": {
77
- "type": "object", "additionalProperties": false, "required": ["id", "after", "before"],
78
- "properties": {
79
- "id": { "$ref": "#/$defs/identifier" },
80
- "after": { "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/nodeRef" } },
81
- "before": { "$ref": "#/$defs/nodeRef" }
82
- }
83
- },
84
- "narrativeAnchor": {
85
- "type": "object", "additionalProperties": false,
86
- "required": ["origin_plan_ref", "origin_line", "source_commit", "source_line_digest"],
87
- "properties": {
88
- "origin_plan_ref": { "$ref": "#/$defs/repoRef" },
89
- "origin_line": { "type": "integer", "minimum": 1 },
90
- "source_commit": { "type": "string", "pattern": "^(?:[0-9a-f]{40}|[0-9a-f]{64})$" },
91
- "source_line_digest": { "$ref": "#/$defs/digest" }
92
- }
93
- },
94
- "compileBinding": {
95
- "oneOf": [
96
- { "type": "null" },
97
- {
98
- "type": "object", "additionalProperties": false,
99
- "required": ["boundary_manifest_digest", "compiled_plan_digest", "topology_digest", "base_sha"],
100
- "properties": {
101
- "boundary_manifest_digest": { "$ref": "#/$defs/digest" },
102
- "compiled_plan_digest": { "$ref": "#/$defs/digest" },
103
- "topology_digest": { "$ref": "#/$defs/digest" },
104
- "base_sha": { "$ref": "#/$defs/gitSha" }
105
- }
106
- }
107
- ]
108
- },
109
- "predecessor": {
110
- "type": "object", "additionalProperties": false,
111
- "required": ["plan_digest", "journal_head_digest", "plan_version"],
112
- "properties": {
113
- "plan_digest": { "$ref": "#/$defs/digest" },
114
- "journal_head_digest": { "$ref": "#/$defs/digest" },
115
- "plan_version": { "$ref": "#/$defs/identifier" }
116
- }
117
- },
118
- "taskV3": {
119
- "type": "object", "additionalProperties": false,
120
- "required": [
121
- "task_id", "title", "lane", "narrative_ref", "narrative_anchor", "compile_binding", "parent_task_id"
122
- ],
123
- "properties": {
124
- "task_id": { "$ref": "#/$defs/identifier" },
125
- "title": { "$ref": "#/$defs/nullableText" },
126
- "lane": { "$ref": "#/$defs/identifier" },
127
- "narrative_ref": { "$ref": "#/$defs/nullableRepoRef" },
128
- "narrative_anchor": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/narrativeAnchor" }] },
129
- "compile_binding": { "$ref": "#/$defs/compileBinding" },
130
- "parent_task_id": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/identifier" }] }
131
- }
132
- },
133
- "desiredPlanV3": {
134
- "type": "object", "additionalProperties": false,
135
- "required": [
136
- "schema", "project_id", "plan_key", "plan_version", "predecessor_plan_digest",
137
- "tasks", "hard_dependencies", "joins", "topology_digest", "plan_digest"
138
- ],
139
- "properties": {
140
- "schema": { "const": "lattice.todo_plan.v3" },
141
- "project_id": { "$ref": "#/$defs/identifier" },
142
- "plan_key": { "$ref": "#/$defs/identifier" },
143
- "plan_version": { "$ref": "#/$defs/identifier" },
144
- "predecessor_plan_digest": { "$ref": "#/$defs/nullableDigest" },
145
- "tasks": { "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/taskV3" } },
146
- "hard_dependencies": { "type": "array", "maxItems": 2048, "items": { "$ref": "#/$defs/edge" } },
147
- "joins": { "type": "array", "maxItems": 128, "items": { "$ref": "#/$defs/join" } },
148
- "topology_digest": { "$ref": "#/$defs/digest" },
149
- "plan_digest": { "$ref": "#/$defs/digest" }
150
- }
151
- },
152
- "taskV6": {
153
- "type": "object", "additionalProperties": false,
154
- "required": [
155
- "task_id", "title", "lane", "design_memo", "narrative_ref", "narrative_anchor", "compile_binding", "parent_task_id"
156
- ],
157
- "properties": {
158
- "task_id": { "$ref": "#/$defs/identifier" },
159
- "title": { "$ref": "#/$defs/nullableText" },
160
- "lane": { "$ref": "#/$defs/identifier" },
161
- "design_memo": { "type": "string", "minLength": 1, "maxLength": 16384, "pattern": "\\S" },
162
- "narrative_ref": { "$ref": "#/$defs/nullableRepoRef" },
163
- "narrative_anchor": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/narrativeAnchor" }] },
164
- "compile_binding": { "$ref": "#/$defs/compileBinding" },
165
- "parent_task_id": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/identifier" }] }
166
- }
167
- },
168
- "desiredPlanV6": {
169
- "type": "object", "additionalProperties": false,
170
- "required": [
171
- "schema", "project_id", "plan_key", "plan_version", "predecessor_plan_digest",
172
- "tasks", "hard_dependencies", "joins", "topology_digest", "plan_digest"
173
- ],
174
- "properties": {
175
- "schema": { "const": "lattice.todo_plan.v6" },
176
- "project_id": { "$ref": "#/$defs/identifier" },
177
- "plan_key": { "$ref": "#/$defs/identifier" },
178
- "plan_version": { "$ref": "#/$defs/identifier" },
179
- "predecessor_plan_digest": { "$ref": "#/$defs/nullableDigest" },
180
- "tasks": { "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/taskV6" } },
181
- "hard_dependencies": { "type": "array", "maxItems": 2048, "items": { "$ref": "#/$defs/edge" } },
182
- "joins": { "type": "array", "maxItems": 128, "items": { "$ref": "#/$defs/join" } },
183
- "topology_digest": { "$ref": "#/$defs/digest" },
184
- "plan_digest": { "$ref": "#/$defs/digest" }
185
- }
186
- },
187
- "taskMigrationEntry": {
188
- "type": "object", "additionalProperties": false,
189
- "required": ["from_task_id", "to_task_id", "state_policy"],
190
- "properties": {
191
- "from_task_id": { "$ref": "#/$defs/identifier" },
192
- "to_task_id": { "oneOf": [{ "const": "removed" }, { "$ref": "#/$defs/identifier" }] },
193
- "state_policy": {
194
- "enum": ["carry", "carry_reconciled_metadata", "acquire_phase", "reset_pending", "removed"],
195
- "$comment": "'removed'はto_task_id==='removed'の時だけ、他の4値はto_task_idがidentifierの時だけ許される(runtime cross-check)。"
196
- }
197
- }
198
- },
199
- "sourceInventoryActiveEntry": {
200
- "type": "object", "additionalProperties": false,
201
- "required": ["task_id", "source_ref", "source_digest"],
202
- "properties": {
203
- "task_id": { "$ref": "#/$defs/identifier" },
204
- "source_ref": { "$ref": "#/$defs/sourceLineRef" },
205
- "source_digest": { "$ref": "#/$defs/digest" }
206
- }
207
- },
208
- "sourceInventoryTombstone": {
209
- "type": "object", "additionalProperties": false,
210
- "required": ["source_ref", "source_digest", "exclusion_reason"],
211
- "properties": {
212
- "source_ref": { "$ref": "#/$defs/sourceLineRef" },
213
- "source_digest": { "$ref": "#/$defs/digest" },
214
- "exclusion_reason": { "$ref": "#/$defs/text" }
215
- }
216
- },
217
- "sourceInventory": {
218
- "type": "object", "additionalProperties": false,
219
- "required": ["active", "excluded_tombstones"],
220
- "$comment": "activeはdesired_plan.tasksと同じ順序・同じtask_id集合でなければならない(runtime cross-check)。",
221
- "properties": {
222
- "active": {
223
- "type": "array", "maxItems": 512, "items": { "$ref": "#/$defs/sourceInventoryActiveEntry" }
224
- },
225
- "excluded_tombstones": {
226
- "type": "array", "maxItems": 2048, "items": { "$ref": "#/$defs/sourceInventoryTombstone" }
227
- }
228
- }
229
- },
230
- "sourceCutoverOperation": {
231
- "type": "object", "additionalProperties": false,
232
- "required": ["task_id", "disposition", "source_ref", "source_digest", "live_replacement"],
233
- "properties": {
234
- "task_id": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/identifier" }] },
235
- "disposition": { "enum": ["active", "excluded"] },
236
- "source_ref": { "$ref": "#/$defs/sourceLineRef" },
237
- "source_digest": { "$ref": "#/$defs/digest" },
238
- "live_replacement": {
239
- "type": "string", "minLength": 1, "maxLength": 4096,
240
- "$comment": "改行・制御文字禁止に加え、Markdownチェックボックス行に見える文字列は拒否される(validLiveReplacement)。"
241
- }
242
- }
243
- },
244
- "sourceCutoverBatch": {
245
- "type": "object", "additionalProperties": false,
246
- "required": ["batch_id", "archive_ref", "operations", "batch_digest"],
247
- "properties": {
248
- "batch_id": { "$ref": "#/$defs/identifier" },
249
- "archive_ref": {
250
- "allOf": [{ "$ref": "#/$defs/repoRef" }, { "pattern": "\\.md$" }],
251
- "$comment": "#L<line>付きのsourceLineRef形にはなり得ない(runtime cross-check)。"
252
- },
253
- "operations": {
254
- "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/sourceCutoverOperation" }
255
- },
256
- "batch_digest": { "$ref": "#/$defs/digest" }
257
- }
258
- }
259
- }
260
- }
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/kitepon/Lattice/blob/main/docs/schemas/lattice.todo_revision.v2.schema.json",
4
+ "title": "lattice.todo_revision.v2",
5
+ "description": "`lattice todo revise`が受理する最新契約。v1のdesired state・source inventory・reconciliationへ、per-ToDoのsource cutover batch(Markdown置換の証跡)を加える。",
6
+ "$comment": "Runtime validation (src/todo-revision.mjs validateTodoRevision) additionally enforces: canonical JSON+LF bytes; strict sort order on task_migration (by from_task_id) and source_inventory.excluded_tombstones/source_cutover_batch.operations (by source_ref); uniqueness of from_task_id/to_task_id/source_ref across those collections; desired_plan.plan_version === todoRevisionPlanVersion(...); reconciliation.reconciliation_digest === todoReconciliationDigest(...); revision_digest as the canonical self-digest over every other top-level field; and that every task_migration.to_task_id (other than 'removed') resolves to a desired_plan task.",
7
+ "type": "object",
8
+ "additionalProperties": false,
9
+ "required": [
10
+ "schema", "project_id", "plan_key", "predecessor", "desired_plan", "task_migration",
11
+ "source_inventory", "reconciliation", "source_cutover_batch", "revision_digest"
12
+ ],
13
+ "properties": {
14
+ "schema": { "const": "lattice.todo_revision.v2" },
15
+ "project_id": { "$ref": "#/$defs/identifier" },
16
+ "plan_key": { "$ref": "#/$defs/identifier" },
17
+ "predecessor": { "$ref": "#/$defs/predecessor" },
18
+ "desired_plan": {
19
+ "oneOf": [
20
+ { "$ref": "#/$defs/desiredPlanV3" },
21
+ { "$ref": "#/$defs/desiredPlanV6" }
22
+ ]
23
+ },
24
+ "task_migration": {
25
+ "type": "array", "minItems": 1, "maxItems": 512,
26
+ "items": { "$ref": "#/$defs/taskMigrationEntry" }
27
+ },
28
+ "source_inventory": { "$ref": "#/$defs/sourceInventory" },
29
+ "reconciliation": {
30
+ "type": "object", "additionalProperties": false,
31
+ "required": ["predecessor_reconciliation_digest", "source_inventory_digest", "reconciliation_digest"],
32
+ "properties": {
33
+ "predecessor_reconciliation_digest": { "$ref": "#/$defs/digest" },
34
+ "source_inventory_digest": { "$ref": "#/$defs/digest" },
35
+ "reconciliation_digest": { "$ref": "#/$defs/digest" }
36
+ }
37
+ },
38
+ "source_cutover_batch": { "$ref": "#/$defs/sourceCutoverBatch" },
39
+ "revision_digest": { "$ref": "#/$defs/digest" }
40
+ },
41
+ "$defs": {
42
+ "identifier": { "type": "string", "pattern": "^[0-9A-Za-z](?:[0-9A-Za-z._-]{0,127})$" },
43
+ "digest": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
44
+ "nullableDigest": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/digest" }] },
45
+ "gitSha": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
46
+ "repoRef": {
47
+ "type": "string",
48
+ "minLength": 1,
49
+ "maxLength": 1024,
50
+ "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\\\)(?!.*[\\u0000-\\u001f\\u007f])[^/]+(?:/[^/]+)*$"
51
+ },
52
+ "sourceLineRef": {
53
+ "type": "string",
54
+ "minLength": 1,
55
+ "maxLength": 1024,
56
+ "$comment": "repoRefと同じ形に加え#L<line>を必須にする。実際の判定はparseTodoSourceRef(src/todo-revision.mjs)。",
57
+ "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\\\)(?!.*[\\u0000-\\u001f\\u007f])[^/]+(?:/[^/]+)*#L[1-9][0-9]*$"
58
+ },
59
+ "nullableRepoRef": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/repoRef" }] },
60
+ "text": { "type": "string", "minLength": 1, "maxLength": 16384 },
61
+ "nullableText": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/text" }] },
62
+ "nodeRef": {
63
+ "type": "object", "additionalProperties": false,
64
+ "required": ["project_id", "plan_key", "task_id"],
65
+ "properties": {
66
+ "project_id": { "$ref": "#/$defs/identifier" },
67
+ "plan_key": { "$ref": "#/$defs/identifier" },
68
+ "task_id": { "$ref": "#/$defs/identifier" },
69
+ "expected_topology_digest": { "$ref": "#/$defs/digest" }
70
+ }
71
+ },
72
+ "edge": {
73
+ "type": "object", "additionalProperties": false, "required": ["from", "to"],
74
+ "properties": { "from": { "$ref": "#/$defs/nodeRef" }, "to": { "$ref": "#/$defs/nodeRef" } }
75
+ },
76
+ "join": {
77
+ "type": "object", "additionalProperties": false, "required": ["id", "after", "before"],
78
+ "properties": {
79
+ "id": { "$ref": "#/$defs/identifier" },
80
+ "after": { "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/nodeRef" } },
81
+ "before": { "$ref": "#/$defs/nodeRef" }
82
+ }
83
+ },
84
+ "narrativeAnchor": {
85
+ "type": "object", "additionalProperties": false,
86
+ "required": ["origin_plan_ref", "origin_line", "source_commit", "source_line_digest"],
87
+ "properties": {
88
+ "origin_plan_ref": { "$ref": "#/$defs/repoRef" },
89
+ "origin_line": { "type": "integer", "minimum": 1 },
90
+ "source_commit": { "type": "string", "pattern": "^(?:[0-9a-f]{40}|[0-9a-f]{64})$" },
91
+ "source_line_digest": { "$ref": "#/$defs/digest" }
92
+ }
93
+ },
94
+ "compileBinding": {
95
+ "oneOf": [
96
+ { "type": "null" },
97
+ {
98
+ "type": "object", "additionalProperties": false,
99
+ "required": ["boundary_manifest_digest", "compiled_plan_digest", "topology_digest", "base_sha"],
100
+ "properties": {
101
+ "boundary_manifest_digest": { "$ref": "#/$defs/digest" },
102
+ "compiled_plan_digest": { "$ref": "#/$defs/digest" },
103
+ "topology_digest": { "$ref": "#/$defs/digest" },
104
+ "base_sha": { "$ref": "#/$defs/gitSha" }
105
+ }
106
+ }
107
+ ]
108
+ },
109
+ "predecessor": {
110
+ "type": "object", "additionalProperties": false,
111
+ "required": ["plan_digest", "journal_head_digest", "plan_version"],
112
+ "properties": {
113
+ "plan_digest": { "$ref": "#/$defs/digest" },
114
+ "journal_head_digest": { "$ref": "#/$defs/digest" },
115
+ "plan_version": { "$ref": "#/$defs/identifier" }
116
+ }
117
+ },
118
+ "taskV3": {
119
+ "type": "object", "additionalProperties": false,
120
+ "required": [
121
+ "task_id", "title", "lane", "narrative_ref", "narrative_anchor", "compile_binding", "parent_task_id"
122
+ ],
123
+ "properties": {
124
+ "task_id": { "$ref": "#/$defs/identifier" },
125
+ "title": { "$ref": "#/$defs/nullableText" },
126
+ "lane": { "$ref": "#/$defs/identifier" },
127
+ "narrative_ref": { "$ref": "#/$defs/nullableRepoRef" },
128
+ "narrative_anchor": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/narrativeAnchor" }] },
129
+ "compile_binding": { "$ref": "#/$defs/compileBinding" },
130
+ "parent_task_id": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/identifier" }] }
131
+ }
132
+ },
133
+ "desiredPlanV3": {
134
+ "type": "object", "additionalProperties": false,
135
+ "required": [
136
+ "schema", "project_id", "plan_key", "plan_version", "predecessor_plan_digest",
137
+ "tasks", "hard_dependencies", "joins", "topology_digest", "plan_digest"
138
+ ],
139
+ "properties": {
140
+ "schema": { "const": "lattice.todo_plan.v3" },
141
+ "project_id": { "$ref": "#/$defs/identifier" },
142
+ "plan_key": { "$ref": "#/$defs/identifier" },
143
+ "plan_version": { "$ref": "#/$defs/identifier" },
144
+ "predecessor_plan_digest": { "$ref": "#/$defs/nullableDigest" },
145
+ "tasks": { "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/taskV3" } },
146
+ "hard_dependencies": { "type": "array", "maxItems": 2048, "items": { "$ref": "#/$defs/edge" } },
147
+ "joins": { "type": "array", "maxItems": 128, "items": { "$ref": "#/$defs/join" } },
148
+ "topology_digest": { "$ref": "#/$defs/digest" },
149
+ "plan_digest": { "$ref": "#/$defs/digest" }
150
+ }
151
+ },
152
+ "taskV6": {
153
+ "type": "object", "additionalProperties": false,
154
+ "required": [
155
+ "task_id", "title", "lane", "design_memo", "narrative_ref", "narrative_anchor", "compile_binding", "parent_task_id"
156
+ ],
157
+ "properties": {
158
+ "task_id": { "$ref": "#/$defs/identifier" },
159
+ "title": { "$ref": "#/$defs/nullableText" },
160
+ "lane": { "$ref": "#/$defs/identifier" },
161
+ "design_memo": { "type": "string", "minLength": 1, "maxLength": 16384, "pattern": "\\S" },
162
+ "narrative_ref": { "$ref": "#/$defs/nullableRepoRef" },
163
+ "narrative_anchor": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/narrativeAnchor" }] },
164
+ "compile_binding": { "$ref": "#/$defs/compileBinding" },
165
+ "parent_task_id": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/identifier" }] }
166
+ }
167
+ },
168
+ "desiredPlanV6": {
169
+ "type": "object", "additionalProperties": false,
170
+ "required": [
171
+ "schema", "project_id", "plan_key", "plan_version", "predecessor_plan_digest",
172
+ "tasks", "hard_dependencies", "joins", "topology_digest", "plan_digest"
173
+ ],
174
+ "properties": {
175
+ "schema": { "const": "lattice.todo_plan.v6" },
176
+ "project_id": { "$ref": "#/$defs/identifier" },
177
+ "plan_key": { "$ref": "#/$defs/identifier" },
178
+ "plan_version": { "$ref": "#/$defs/identifier" },
179
+ "predecessor_plan_digest": { "$ref": "#/$defs/nullableDigest" },
180
+ "tasks": { "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/taskV6" } },
181
+ "hard_dependencies": { "type": "array", "maxItems": 2048, "items": { "$ref": "#/$defs/edge" } },
182
+ "joins": { "type": "array", "maxItems": 128, "items": { "$ref": "#/$defs/join" } },
183
+ "topology_digest": { "$ref": "#/$defs/digest" },
184
+ "plan_digest": { "$ref": "#/$defs/digest" }
185
+ }
186
+ },
187
+ "taskMigrationEntry": {
188
+ "type": "object", "additionalProperties": false,
189
+ "required": ["from_task_id", "to_task_id", "state_policy"],
190
+ "properties": {
191
+ "from_task_id": { "$ref": "#/$defs/identifier" },
192
+ "to_task_id": { "oneOf": [{ "const": "removed" }, { "$ref": "#/$defs/identifier" }] },
193
+ "state_policy": {
194
+ "enum": ["carry", "carry_reconciled_metadata", "acquire_phase", "reset_pending", "removed"],
195
+ "$comment": "'removed'はto_task_id==='removed'の時だけ、他の4値はto_task_idがidentifierの時だけ許される(runtime cross-check)。"
196
+ }
197
+ }
198
+ },
199
+ "sourceInventoryActiveEntry": {
200
+ "type": "object", "additionalProperties": false,
201
+ "required": ["task_id", "source_ref", "source_digest"],
202
+ "properties": {
203
+ "task_id": { "$ref": "#/$defs/identifier" },
204
+ "source_ref": { "$ref": "#/$defs/sourceLineRef" },
205
+ "source_digest": { "$ref": "#/$defs/digest" }
206
+ }
207
+ },
208
+ "sourceInventoryTombstone": {
209
+ "type": "object", "additionalProperties": false,
210
+ "required": ["source_ref", "source_digest", "exclusion_reason"],
211
+ "properties": {
212
+ "source_ref": { "$ref": "#/$defs/sourceLineRef" },
213
+ "source_digest": { "$ref": "#/$defs/digest" },
214
+ "exclusion_reason": { "$ref": "#/$defs/text" }
215
+ }
216
+ },
217
+ "sourceInventory": {
218
+ "type": "object", "additionalProperties": false,
219
+ "required": ["active", "excluded_tombstones"],
220
+ "$comment": "activeはdesired_plan.tasksと同じ順序・同じtask_id集合でなければならない(runtime cross-check)。",
221
+ "properties": {
222
+ "active": {
223
+ "type": "array", "maxItems": 512, "items": { "$ref": "#/$defs/sourceInventoryActiveEntry" }
224
+ },
225
+ "excluded_tombstones": {
226
+ "type": "array", "maxItems": 2048, "items": { "$ref": "#/$defs/sourceInventoryTombstone" }
227
+ }
228
+ }
229
+ },
230
+ "sourceCutoverOperation": {
231
+ "type": "object", "additionalProperties": false,
232
+ "required": ["task_id", "disposition", "source_ref", "source_digest", "live_replacement"],
233
+ "properties": {
234
+ "task_id": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/identifier" }] },
235
+ "disposition": { "enum": ["active", "excluded"] },
236
+ "source_ref": { "$ref": "#/$defs/sourceLineRef" },
237
+ "source_digest": { "$ref": "#/$defs/digest" },
238
+ "live_replacement": {
239
+ "type": "string", "minLength": 1, "maxLength": 4096,
240
+ "$comment": "改行・制御文字禁止に加え、Markdownチェックボックス行に見える文字列は拒否される(validLiveReplacement)。"
241
+ }
242
+ }
243
+ },
244
+ "sourceCutoverBatch": {
245
+ "type": "object", "additionalProperties": false,
246
+ "required": ["batch_id", "archive_ref", "operations", "batch_digest"],
247
+ "properties": {
248
+ "batch_id": { "$ref": "#/$defs/identifier" },
249
+ "archive_ref": {
250
+ "allOf": [{ "$ref": "#/$defs/repoRef" }, { "pattern": "\\.md$" }],
251
+ "$comment": "#L<line>付きのsourceLineRef形にはなり得ない(runtime cross-check)。"
252
+ },
253
+ "operations": {
254
+ "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/sourceCutoverOperation" }
255
+ },
256
+ "batch_digest": { "$ref": "#/$defs/digest" }
257
+ }
258
+ }
259
+ }
260
+ }