@quolu/lattice 0.36.0 → 0.37.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.
@@ -0,0 +1,220 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/kitepon-rgb/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": { "$ref": "#/$defs/desiredPlanV3" },
19
+ "task_migration": {
20
+ "type": "array", "minItems": 1, "maxItems": 512,
21
+ "items": { "$ref": "#/$defs/taskMigrationEntry" }
22
+ },
23
+ "source_inventory": { "$ref": "#/$defs/sourceInventory" },
24
+ "reconciliation": {
25
+ "type": "object", "additionalProperties": false,
26
+ "required": ["predecessor_reconciliation_digest", "source_inventory_digest", "reconciliation_digest"],
27
+ "properties": {
28
+ "predecessor_reconciliation_digest": { "$ref": "#/$defs/digest" },
29
+ "source_inventory_digest": { "$ref": "#/$defs/digest" },
30
+ "reconciliation_digest": { "$ref": "#/$defs/digest" }
31
+ }
32
+ },
33
+ "source_cutover_batch": { "$ref": "#/$defs/sourceCutoverBatch" },
34
+ "revision_digest": { "$ref": "#/$defs/digest" }
35
+ },
36
+ "$defs": {
37
+ "identifier": { "type": "string", "pattern": "^[0-9A-Za-z](?:[0-9A-Za-z._-]{0,127})$" },
38
+ "digest": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
39
+ "nullableDigest": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/digest" }] },
40
+ "gitSha": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
41
+ "repoRef": {
42
+ "type": "string",
43
+ "minLength": 1,
44
+ "maxLength": 1024,
45
+ "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\\\)(?!.*[\\u0000-\\u001f\\u007f])[^/]+(?:/[^/]+)*$"
46
+ },
47
+ "sourceLineRef": {
48
+ "type": "string",
49
+ "minLength": 1,
50
+ "maxLength": 1024,
51
+ "$comment": "repoRefと同じ形に加え#L<line>を必須にする。実際の判定はparseTodoSourceRef(src/todo-revision.mjs)。",
52
+ "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\\\)(?!.*[\\u0000-\\u001f\\u007f])[^/]+(?:/[^/]+)*#L[1-9][0-9]*$"
53
+ },
54
+ "nullableRepoRef": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/repoRef" }] },
55
+ "text": { "type": "string", "minLength": 1, "maxLength": 16384 },
56
+ "nullableText": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/text" }] },
57
+ "nodeRef": {
58
+ "type": "object", "additionalProperties": false,
59
+ "required": ["project_id", "plan_key", "task_id"],
60
+ "properties": {
61
+ "project_id": { "$ref": "#/$defs/identifier" },
62
+ "plan_key": { "$ref": "#/$defs/identifier" },
63
+ "task_id": { "$ref": "#/$defs/identifier" },
64
+ "expected_topology_digest": { "$ref": "#/$defs/digest" }
65
+ }
66
+ },
67
+ "edge": {
68
+ "type": "object", "additionalProperties": false, "required": ["from", "to"],
69
+ "properties": { "from": { "$ref": "#/$defs/nodeRef" }, "to": { "$ref": "#/$defs/nodeRef" } }
70
+ },
71
+ "join": {
72
+ "type": "object", "additionalProperties": false, "required": ["id", "after", "before"],
73
+ "properties": {
74
+ "id": { "$ref": "#/$defs/identifier" },
75
+ "after": { "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/nodeRef" } },
76
+ "before": { "$ref": "#/$defs/nodeRef" }
77
+ }
78
+ },
79
+ "narrativeAnchor": {
80
+ "type": "object", "additionalProperties": false,
81
+ "required": ["origin_plan_ref", "origin_line", "source_commit", "source_line_digest"],
82
+ "properties": {
83
+ "origin_plan_ref": { "$ref": "#/$defs/repoRef" },
84
+ "origin_line": { "type": "integer", "minimum": 1 },
85
+ "source_commit": { "type": "string", "pattern": "^(?:[0-9a-f]{40}|[0-9a-f]{64})$" },
86
+ "source_line_digest": { "$ref": "#/$defs/digest" }
87
+ }
88
+ },
89
+ "compileBinding": {
90
+ "oneOf": [
91
+ { "type": "null" },
92
+ {
93
+ "type": "object", "additionalProperties": false,
94
+ "required": ["boundary_manifest_digest", "compiled_plan_digest", "topology_digest", "base_sha"],
95
+ "properties": {
96
+ "boundary_manifest_digest": { "$ref": "#/$defs/digest" },
97
+ "compiled_plan_digest": { "$ref": "#/$defs/digest" },
98
+ "topology_digest": { "$ref": "#/$defs/digest" },
99
+ "base_sha": { "$ref": "#/$defs/gitSha" }
100
+ }
101
+ }
102
+ ]
103
+ },
104
+ "predecessor": {
105
+ "type": "object", "additionalProperties": false,
106
+ "required": ["plan_digest", "journal_head_digest", "plan_version"],
107
+ "properties": {
108
+ "plan_digest": { "$ref": "#/$defs/digest" },
109
+ "journal_head_digest": { "$ref": "#/$defs/digest" },
110
+ "plan_version": { "$ref": "#/$defs/identifier" }
111
+ }
112
+ },
113
+ "taskV3": {
114
+ "type": "object", "additionalProperties": false,
115
+ "required": [
116
+ "task_id", "title", "lane", "narrative_ref", "narrative_anchor", "compile_binding", "parent_task_id"
117
+ ],
118
+ "properties": {
119
+ "task_id": { "$ref": "#/$defs/identifier" },
120
+ "title": { "$ref": "#/$defs/nullableText" },
121
+ "lane": { "$ref": "#/$defs/identifier" },
122
+ "narrative_ref": { "$ref": "#/$defs/nullableRepoRef" },
123
+ "narrative_anchor": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/narrativeAnchor" }] },
124
+ "compile_binding": { "$ref": "#/$defs/compileBinding" },
125
+ "parent_task_id": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/identifier" }] }
126
+ }
127
+ },
128
+ "desiredPlanV3": {
129
+ "type": "object", "additionalProperties": false,
130
+ "required": [
131
+ "schema", "project_id", "plan_key", "plan_version", "predecessor_plan_digest",
132
+ "tasks", "hard_dependencies", "joins", "topology_digest", "plan_digest"
133
+ ],
134
+ "properties": {
135
+ "schema": { "const": "lattice.todo_plan.v3" },
136
+ "project_id": { "$ref": "#/$defs/identifier" },
137
+ "plan_key": { "$ref": "#/$defs/identifier" },
138
+ "plan_version": { "$ref": "#/$defs/identifier" },
139
+ "predecessor_plan_digest": { "$ref": "#/$defs/nullableDigest" },
140
+ "tasks": { "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/taskV3" } },
141
+ "hard_dependencies": { "type": "array", "maxItems": 2048, "items": { "$ref": "#/$defs/edge" } },
142
+ "joins": { "type": "array", "maxItems": 128, "items": { "$ref": "#/$defs/join" } },
143
+ "topology_digest": { "$ref": "#/$defs/digest" },
144
+ "plan_digest": { "$ref": "#/$defs/digest" }
145
+ }
146
+ },
147
+ "taskMigrationEntry": {
148
+ "type": "object", "additionalProperties": false,
149
+ "required": ["from_task_id", "to_task_id", "state_policy"],
150
+ "properties": {
151
+ "from_task_id": { "$ref": "#/$defs/identifier" },
152
+ "to_task_id": { "oneOf": [{ "const": "removed" }, { "$ref": "#/$defs/identifier" }] },
153
+ "state_policy": {
154
+ "enum": ["carry", "carry_reconciled_metadata", "reset_pending", "removed"],
155
+ "$comment": "'removed'はto_task_id==='removed'の時だけ、他の3値はto_task_idがidentifierの時だけ許される(runtime cross-check)。"
156
+ }
157
+ }
158
+ },
159
+ "sourceInventoryActiveEntry": {
160
+ "type": "object", "additionalProperties": false,
161
+ "required": ["task_id", "source_ref", "source_digest"],
162
+ "properties": {
163
+ "task_id": { "$ref": "#/$defs/identifier" },
164
+ "source_ref": { "$ref": "#/$defs/sourceLineRef" },
165
+ "source_digest": { "$ref": "#/$defs/digest" }
166
+ }
167
+ },
168
+ "sourceInventoryTombstone": {
169
+ "type": "object", "additionalProperties": false,
170
+ "required": ["source_ref", "source_digest", "exclusion_reason"],
171
+ "properties": {
172
+ "source_ref": { "$ref": "#/$defs/sourceLineRef" },
173
+ "source_digest": { "$ref": "#/$defs/digest" },
174
+ "exclusion_reason": { "$ref": "#/$defs/text" }
175
+ }
176
+ },
177
+ "sourceInventory": {
178
+ "type": "object", "additionalProperties": false,
179
+ "required": ["active", "excluded_tombstones"],
180
+ "$comment": "activeはdesired_plan.tasksと同じ順序・同じtask_id集合でなければならない(runtime cross-check)。",
181
+ "properties": {
182
+ "active": {
183
+ "type": "array", "maxItems": 512, "items": { "$ref": "#/$defs/sourceInventoryActiveEntry" }
184
+ },
185
+ "excluded_tombstones": {
186
+ "type": "array", "maxItems": 2048, "items": { "$ref": "#/$defs/sourceInventoryTombstone" }
187
+ }
188
+ }
189
+ },
190
+ "sourceCutoverOperation": {
191
+ "type": "object", "additionalProperties": false,
192
+ "required": ["task_id", "disposition", "source_ref", "source_digest", "live_replacement"],
193
+ "properties": {
194
+ "task_id": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/identifier" }] },
195
+ "disposition": { "enum": ["active", "excluded"] },
196
+ "source_ref": { "$ref": "#/$defs/sourceLineRef" },
197
+ "source_digest": { "$ref": "#/$defs/digest" },
198
+ "live_replacement": {
199
+ "type": "string", "minLength": 1, "maxLength": 4096,
200
+ "$comment": "改行・制御文字禁止に加え、Markdownチェックボックス行に見える文字列は拒否される(validLiveReplacement)。"
201
+ }
202
+ }
203
+ },
204
+ "sourceCutoverBatch": {
205
+ "type": "object", "additionalProperties": false,
206
+ "required": ["batch_id", "archive_ref", "operations", "batch_digest"],
207
+ "properties": {
208
+ "batch_id": { "$ref": "#/$defs/identifier" },
209
+ "archive_ref": {
210
+ "allOf": [{ "$ref": "#/$defs/repoRef" }, { "pattern": "\\.md$" }],
211
+ "$comment": "#L<line>付きのsourceLineRef形にはなり得ない(runtime cross-check)。"
212
+ },
213
+ "operations": {
214
+ "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/sourceCutoverOperation" }
215
+ },
216
+ "batch_digest": { "$ref": "#/$defs/digest" }
217
+ }
218
+ }
219
+ }
220
+ }
@@ -0,0 +1,363 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/kitepon-rgb/Lattice/blob/main/docs/schemas/lattice.todo_revision_set.v3.schema.json",
4
+ "title": "lattice.todo_revision_set.v3",
5
+ "description": "`lattice todo revise-set`が受理する最新契約。複数planへ跨がるrevisionを1つのatomic書込みへ束ねる。v3のmemberは`lattice.todo_revision.v1/v2`(非phase plan)と`lattice.phase_todo_revision.v1/v2`(phase-audited plan)のいずれかであり、`lattice.phase_todo_revision.v3`はmemberとして受理されない——v3固有のruntime_task_migration/source_cutover_batchはrevise-setの外で単独revise-phaseとして扱う契約になっている。",
6
+ "$comment": "Runtime validation (src/todo-revision.mjs validateTodoRevisionSet) additionally enforces: canonical JSON+LF bytes; revisions.length in [2, 64]; each member's own digest chain (validateTodoRevision / validatePhaseTodoRevision); every member.project_id === project_id; v3はrevisions内に最低1つphase_todo_revision memberを含む必要がある; revisionsが厳密にplan_key昇順でソートされている(重複plan_key禁止); revision_set_digestは他の全top-level fieldへの正準self-digest。",
7
+ "type": "object",
8
+ "additionalProperties": false,
9
+ "required": ["schema", "project_id", "revisions", "revision_set_digest"],
10
+ "properties": {
11
+ "schema": { "const": "lattice.todo_revision_set.v3" },
12
+ "project_id": { "$ref": "#/$defs/identifier" },
13
+ "revisions": {
14
+ "type": "array", "minItems": 2, "maxItems": 64,
15
+ "items": {
16
+ "oneOf": [
17
+ { "$ref": "#/$defs/todoRevisionMember" },
18
+ { "$ref": "#/$defs/phaseTodoRevisionMember" }
19
+ ]
20
+ }
21
+ },
22
+ "revision_set_digest": { "$ref": "#/$defs/digest" }
23
+ },
24
+ "$defs": {
25
+ "identifier": { "type": "string", "pattern": "^[0-9A-Za-z](?:[0-9A-Za-z._-]{0,127})$" },
26
+ "digest": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
27
+ "nullableDigest": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/digest" }] },
28
+ "gitSha": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
29
+ "repoRef": {
30
+ "type": "string",
31
+ "minLength": 1,
32
+ "maxLength": 1024,
33
+ "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\\\)(?!.*[\\u0000-\\u001f\\u007f])[^/]+(?:/[^/]+)*$"
34
+ },
35
+ "sourceLineRef": {
36
+ "type": "string",
37
+ "minLength": 1,
38
+ "maxLength": 1024,
39
+ "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\\\)(?!.*[\\u0000-\\u001f\\u007f])[^/]+(?:/[^/]+)*#L[1-9][0-9]*$"
40
+ },
41
+ "nullableRepoRef": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/repoRef" }] },
42
+ "text": { "type": "string", "minLength": 1, "maxLength": 16384 },
43
+ "nullableText": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/text" }] },
44
+ "nodeRef": {
45
+ "type": "object", "additionalProperties": false,
46
+ "required": ["project_id", "plan_key", "task_id"],
47
+ "properties": {
48
+ "project_id": { "$ref": "#/$defs/identifier" },
49
+ "plan_key": { "$ref": "#/$defs/identifier" },
50
+ "task_id": { "$ref": "#/$defs/identifier" },
51
+ "expected_topology_digest": { "$ref": "#/$defs/digest" }
52
+ }
53
+ },
54
+ "phaseRef": {
55
+ "type": "object", "additionalProperties": false,
56
+ "required": ["project_id", "plan_key", "phase_id"],
57
+ "properties": {
58
+ "project_id": { "$ref": "#/$defs/identifier" },
59
+ "plan_key": { "$ref": "#/$defs/identifier" },
60
+ "phase_id": { "$ref": "#/$defs/identifier" },
61
+ "expected_topology_digest": { "$ref": "#/$defs/digest" }
62
+ }
63
+ },
64
+ "edge": {
65
+ "type": "object", "additionalProperties": false, "required": ["from", "to"],
66
+ "properties": { "from": { "$ref": "#/$defs/nodeRef" }, "to": { "$ref": "#/$defs/nodeRef" } }
67
+ },
68
+ "phaseAcceptDependency": {
69
+ "type": "object", "additionalProperties": false, "required": ["from", "to"],
70
+ "properties": { "from": { "$ref": "#/$defs/phaseRef" }, "to": { "$ref": "#/$defs/nodeRef" } }
71
+ },
72
+ "join": {
73
+ "type": "object", "additionalProperties": false, "required": ["id", "after", "before"],
74
+ "properties": {
75
+ "id": { "$ref": "#/$defs/identifier" },
76
+ "after": { "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/nodeRef" } },
77
+ "before": { "$ref": "#/$defs/nodeRef" }
78
+ }
79
+ },
80
+ "narrativeAnchor": {
81
+ "type": "object", "additionalProperties": false,
82
+ "required": ["origin_plan_ref", "origin_line", "source_commit", "source_line_digest"],
83
+ "properties": {
84
+ "origin_plan_ref": { "$ref": "#/$defs/repoRef" },
85
+ "origin_line": { "type": "integer", "minimum": 1 },
86
+ "source_commit": { "type": "string", "pattern": "^(?:[0-9a-f]{40}|[0-9a-f]{64})$" },
87
+ "source_line_digest": { "$ref": "#/$defs/digest" }
88
+ }
89
+ },
90
+ "compileBinding": {
91
+ "oneOf": [
92
+ { "type": "null" },
93
+ {
94
+ "type": "object", "additionalProperties": false,
95
+ "required": ["boundary_manifest_digest", "compiled_plan_digest", "topology_digest", "base_sha"],
96
+ "properties": {
97
+ "boundary_manifest_digest": { "$ref": "#/$defs/digest" },
98
+ "compiled_plan_digest": { "$ref": "#/$defs/digest" },
99
+ "topology_digest": { "$ref": "#/$defs/digest" },
100
+ "base_sha": { "$ref": "#/$defs/gitSha" }
101
+ }
102
+ }
103
+ ]
104
+ },
105
+ "predecessor": {
106
+ "type": "object", "additionalProperties": false,
107
+ "required": ["plan_digest", "journal_head_digest", "plan_version"],
108
+ "properties": {
109
+ "plan_digest": { "$ref": "#/$defs/digest" },
110
+ "journal_head_digest": { "$ref": "#/$defs/digest" },
111
+ "plan_version": { "$ref": "#/$defs/identifier" }
112
+ }
113
+ },
114
+ "taskV3": {
115
+ "type": "object", "additionalProperties": false,
116
+ "required": [
117
+ "task_id", "title", "lane", "narrative_ref", "narrative_anchor", "compile_binding", "parent_task_id"
118
+ ],
119
+ "properties": {
120
+ "task_id": { "$ref": "#/$defs/identifier" },
121
+ "title": { "$ref": "#/$defs/nullableText" },
122
+ "lane": { "$ref": "#/$defs/identifier" },
123
+ "narrative_ref": { "$ref": "#/$defs/nullableRepoRef" },
124
+ "narrative_anchor": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/narrativeAnchor" }] },
125
+ "compile_binding": { "$ref": "#/$defs/compileBinding" },
126
+ "parent_task_id": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/identifier" }] }
127
+ }
128
+ },
129
+ "taskV4": {
130
+ "type": "object", "additionalProperties": false,
131
+ "required": [
132
+ "task_id", "title", "lane", "narrative_ref", "narrative_anchor", "compile_binding",
133
+ "parent_task_id", "phase_id"
134
+ ],
135
+ "properties": {
136
+ "task_id": { "$ref": "#/$defs/identifier" },
137
+ "title": { "$ref": "#/$defs/nullableText" },
138
+ "lane": { "$ref": "#/$defs/identifier" },
139
+ "narrative_ref": { "$ref": "#/$defs/nullableRepoRef" },
140
+ "narrative_anchor": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/narrativeAnchor" }] },
141
+ "compile_binding": { "$ref": "#/$defs/compileBinding" },
142
+ "parent_task_id": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/identifier" }] },
143
+ "phase_id": { "$ref": "#/$defs/identifier" }
144
+ }
145
+ },
146
+ "phase": {
147
+ "type": "object", "additionalProperties": false,
148
+ "required": ["phase_id", "title", "gate_policy", "predecessor_phase_ids", "required_evidence_slots"],
149
+ "properties": {
150
+ "phase_id": { "$ref": "#/$defs/identifier" },
151
+ "title": { "$ref": "#/$defs/nullableText" },
152
+ "gate_policy": { "$ref": "#/$defs/identifier" },
153
+ "predecessor_phase_ids": {
154
+ "type": "array", "items": { "$ref": "#/$defs/identifier" }, "uniqueItems": true
155
+ },
156
+ "required_evidence_slots": {
157
+ "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/identifier" }, "uniqueItems": true
158
+ }
159
+ }
160
+ },
161
+ "desiredPlanV3": {
162
+ "type": "object", "additionalProperties": false,
163
+ "required": [
164
+ "schema", "project_id", "plan_key", "plan_version", "predecessor_plan_digest",
165
+ "tasks", "hard_dependencies", "joins", "topology_digest", "plan_digest"
166
+ ],
167
+ "properties": {
168
+ "schema": { "const": "lattice.todo_plan.v3" },
169
+ "project_id": { "$ref": "#/$defs/identifier" },
170
+ "plan_key": { "$ref": "#/$defs/identifier" },
171
+ "plan_version": { "$ref": "#/$defs/identifier" },
172
+ "predecessor_plan_digest": { "$ref": "#/$defs/nullableDigest" },
173
+ "tasks": { "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/taskV3" } },
174
+ "hard_dependencies": { "type": "array", "maxItems": 2048, "items": { "$ref": "#/$defs/edge" } },
175
+ "joins": { "type": "array", "maxItems": 128, "items": { "$ref": "#/$defs/join" } },
176
+ "topology_digest": { "$ref": "#/$defs/digest" },
177
+ "plan_digest": { "$ref": "#/$defs/digest" }
178
+ }
179
+ },
180
+ "desiredPlanV4orV5": {
181
+ "type": "object", "additionalProperties": false,
182
+ "required": [
183
+ "schema", "project_id", "plan_key", "plan_version", "predecessor_plan_digest",
184
+ "tasks", "hard_dependencies", "joins", "phases", "topology_digest", "plan_digest"
185
+ ],
186
+ "$comment": "schemaがv5の時だけphase_accept_dependenciesも必須keyに加わる(runtime-only cross-check、oneOfでは表現しない)。",
187
+ "properties": {
188
+ "schema": { "enum": ["lattice.todo_plan.v4", "lattice.todo_plan.v5"] },
189
+ "project_id": { "$ref": "#/$defs/identifier" },
190
+ "plan_key": { "$ref": "#/$defs/identifier" },
191
+ "plan_version": { "$ref": "#/$defs/identifier" },
192
+ "predecessor_plan_digest": { "$ref": "#/$defs/nullableDigest" },
193
+ "tasks": { "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/taskV4" } },
194
+ "hard_dependencies": { "type": "array", "maxItems": 2048, "items": { "$ref": "#/$defs/edge" } },
195
+ "joins": { "type": "array", "maxItems": 128, "items": { "$ref": "#/$defs/join" } },
196
+ "phases": { "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/phase" } },
197
+ "phase_accept_dependencies": {
198
+ "type": "array", "maxItems": 2048, "items": { "$ref": "#/$defs/phaseAcceptDependency" }
199
+ },
200
+ "topology_digest": { "$ref": "#/$defs/digest" },
201
+ "plan_digest": { "$ref": "#/$defs/digest" }
202
+ },
203
+ "if": { "properties": { "schema": { "const": "lattice.todo_plan.v5" } }, "required": ["schema"] },
204
+ "then": { "required": ["phase_accept_dependencies"] }
205
+ },
206
+ "taskMigrationEntry": {
207
+ "type": "object", "additionalProperties": false,
208
+ "required": ["from_task_id", "to_task_id", "state_policy"],
209
+ "properties": {
210
+ "from_task_id": { "$ref": "#/$defs/identifier" },
211
+ "to_task_id": { "oneOf": [{ "const": "removed" }, { "$ref": "#/$defs/identifier" }] },
212
+ "state_policy": { "enum": ["carry", "carry_reconciled_metadata", "reset_pending", "removed"] }
213
+ }
214
+ },
215
+ "phaseMigrationEntry": {
216
+ "type": "object", "additionalProperties": false,
217
+ "required": ["from_phase_id", "to_phase_id", "state_policy"],
218
+ "properties": {
219
+ "from_phase_id": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/identifier" }] },
220
+ "to_phase_id": { "oneOf": [{ "const": "removed" }, { "$ref": "#/$defs/identifier" }] },
221
+ "state_policy": { "enum": ["carry", "reset", "removed"] }
222
+ }
223
+ },
224
+ "sourceInventoryActiveEntry": {
225
+ "type": "object", "additionalProperties": false,
226
+ "required": ["task_id", "source_ref", "source_digest"],
227
+ "properties": {
228
+ "task_id": { "$ref": "#/$defs/identifier" },
229
+ "source_ref": { "$ref": "#/$defs/sourceLineRef" },
230
+ "source_digest": { "$ref": "#/$defs/digest" }
231
+ }
232
+ },
233
+ "sourceInventoryTombstone": {
234
+ "type": "object", "additionalProperties": false,
235
+ "required": ["source_ref", "source_digest", "exclusion_reason"],
236
+ "properties": {
237
+ "source_ref": { "$ref": "#/$defs/sourceLineRef" },
238
+ "source_digest": { "$ref": "#/$defs/digest" },
239
+ "exclusion_reason": { "$ref": "#/$defs/text" }
240
+ }
241
+ },
242
+ "sourceInventory": {
243
+ "type": "object", "additionalProperties": false,
244
+ "required": ["active", "excluded_tombstones"],
245
+ "properties": {
246
+ "active": {
247
+ "type": "array", "maxItems": 512, "items": { "$ref": "#/$defs/sourceInventoryActiveEntry" }
248
+ },
249
+ "excluded_tombstones": {
250
+ "type": "array", "maxItems": 2048, "items": { "$ref": "#/$defs/sourceInventoryTombstone" }
251
+ }
252
+ }
253
+ },
254
+ "sourceCutoverOperation": {
255
+ "type": "object", "additionalProperties": false,
256
+ "required": ["task_id", "disposition", "source_ref", "source_digest", "live_replacement"],
257
+ "properties": {
258
+ "task_id": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/identifier" }] },
259
+ "disposition": { "enum": ["active", "excluded"] },
260
+ "source_ref": { "$ref": "#/$defs/sourceLineRef" },
261
+ "source_digest": { "$ref": "#/$defs/digest" },
262
+ "live_replacement": { "type": "string", "minLength": 1, "maxLength": 4096 }
263
+ }
264
+ },
265
+ "sourceCutoverBatch": {
266
+ "type": "object", "additionalProperties": false,
267
+ "required": ["batch_id", "archive_ref", "operations", "batch_digest"],
268
+ "properties": {
269
+ "batch_id": { "$ref": "#/$defs/identifier" },
270
+ "archive_ref": { "allOf": [{ "$ref": "#/$defs/repoRef" }, { "pattern": "\\.md$" }] },
271
+ "operations": {
272
+ "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/sourceCutoverOperation" }
273
+ },
274
+ "batch_digest": { "$ref": "#/$defs/digest" }
275
+ }
276
+ },
277
+ "todoRevisionMember": {
278
+ "description": "非phase planのrevision member。'lattice.todo_revision.v1'(source_cutover_batchなし)と'lattice.todo_revision.v2'(source_cutover_batchあり)のいずれか。",
279
+ "type": "object",
280
+ "if": { "properties": { "schema": { "const": "lattice.todo_revision.v2" } }, "required": ["schema"] },
281
+ "then": {
282
+ "additionalProperties": false,
283
+ "required": [
284
+ "schema", "project_id", "plan_key", "predecessor", "desired_plan", "task_migration",
285
+ "source_inventory", "reconciliation", "source_cutover_batch", "revision_digest"
286
+ ],
287
+ "properties": {
288
+ "schema": { "const": "lattice.todo_revision.v2" },
289
+ "project_id": { "$ref": "#/$defs/identifier" },
290
+ "plan_key": { "$ref": "#/$defs/identifier" },
291
+ "predecessor": { "$ref": "#/$defs/predecessor" },
292
+ "desired_plan": { "$ref": "#/$defs/desiredPlanV3" },
293
+ "task_migration": {
294
+ "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/taskMigrationEntry" }
295
+ },
296
+ "source_inventory": { "$ref": "#/$defs/sourceInventory" },
297
+ "reconciliation": {
298
+ "type": "object", "additionalProperties": false,
299
+ "required": ["predecessor_reconciliation_digest", "source_inventory_digest", "reconciliation_digest"],
300
+ "properties": {
301
+ "predecessor_reconciliation_digest": { "$ref": "#/$defs/digest" },
302
+ "source_inventory_digest": { "$ref": "#/$defs/digest" },
303
+ "reconciliation_digest": { "$ref": "#/$defs/digest" }
304
+ }
305
+ },
306
+ "source_cutover_batch": { "$ref": "#/$defs/sourceCutoverBatch" },
307
+ "revision_digest": { "$ref": "#/$defs/digest" }
308
+ }
309
+ },
310
+ "else": {
311
+ "additionalProperties": false,
312
+ "required": [
313
+ "schema", "project_id", "plan_key", "predecessor", "desired_plan", "task_migration",
314
+ "source_inventory", "reconciliation", "revision_digest"
315
+ ],
316
+ "properties": {
317
+ "schema": { "const": "lattice.todo_revision.v1" },
318
+ "project_id": { "$ref": "#/$defs/identifier" },
319
+ "plan_key": { "$ref": "#/$defs/identifier" },
320
+ "predecessor": { "$ref": "#/$defs/predecessor" },
321
+ "desired_plan": { "$ref": "#/$defs/desiredPlanV3" },
322
+ "task_migration": {
323
+ "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/taskMigrationEntry" }
324
+ },
325
+ "source_inventory": { "$ref": "#/$defs/sourceInventory" },
326
+ "reconciliation": {
327
+ "type": "object", "additionalProperties": false,
328
+ "required": ["predecessor_reconciliation_digest", "source_inventory_digest", "reconciliation_digest"],
329
+ "properties": {
330
+ "predecessor_reconciliation_digest": { "$ref": "#/$defs/digest" },
331
+ "source_inventory_digest": { "$ref": "#/$defs/digest" },
332
+ "reconciliation_digest": { "$ref": "#/$defs/digest" }
333
+ }
334
+ },
335
+ "revision_digest": { "$ref": "#/$defs/digest" }
336
+ }
337
+ }
338
+ },
339
+ "phaseTodoRevisionMember": {
340
+ "description": "phase-audited planのrevision member。'lattice.phase_todo_revision.v1'(desired_planはv4)と'v2'(desired_planはv5)のいずれかだけを受理する——'v3'(runtime_task_migration・source_cutover_batch付き)はrevise-set memberとしては受理されない。",
341
+ "type": "object", "additionalProperties": false,
342
+ "required": [
343
+ "schema", "project_id", "plan_key", "predecessor", "desired_plan",
344
+ "task_migration", "phase_migration", "revision_digest"
345
+ ],
346
+ "properties": {
347
+ "schema": { "enum": ["lattice.phase_todo_revision.v1", "lattice.phase_todo_revision.v2"] },
348
+ "project_id": { "$ref": "#/$defs/identifier" },
349
+ "plan_key": { "$ref": "#/$defs/identifier" },
350
+ "predecessor": { "$ref": "#/$defs/predecessor" },
351
+ "desired_plan": { "$ref": "#/$defs/desiredPlanV4orV5" },
352
+ "task_migration": {
353
+ "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/taskMigrationEntry" }
354
+ },
355
+ "phase_migration": {
356
+ "type": "array", "minItems": 1, "maxItems": 512, "items": { "$ref": "#/$defs/phaseMigrationEntry" }
357
+ },
358
+ "revision_digest": { "$ref": "#/$defs/digest" }
359
+ },
360
+ "$comment": "schemaが'lattice.phase_todo_revision.v1'ならdesired_plan.schemaは'lattice.todo_plan.v4'、'v2'なら'lattice.todo_plan.v5'(runtime cross-check)。"
361
+ }
362
+ }
363
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quolu/lattice",
3
- "version": "0.36.0",
3
+ "version": "0.37.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",
@@ -27,6 +27,10 @@
27
27
  "docs/schemas/lattice.plan_create_input.v1.schema.json",
28
28
  "docs/schemas/lattice.plan_create_input.v2.schema.json",
29
29
  "docs/schemas/lattice.plan_create_input.v3.schema.json",
30
+ "docs/schemas/lattice.todo_revision.v2.schema.json",
31
+ "docs/schemas/lattice.todo_revision_set.v3.schema.json",
32
+ "docs/schemas/lattice.phase_todo_revision.v3.schema.json",
33
+ "docs/schemas/lattice.todo_extraction.v2.schema.json",
30
34
  "docs/schemas/lattice.run_request.v1.schema.json",
31
35
  "docs/schemas/lattice.executor_packet.v1.schema.json",
32
36
  "docs/schemas/lattice.executor_receipt.v1.schema.json",
package/src/cli-help.mjs CHANGED
@@ -98,6 +98,12 @@ Write commands:
98
98
  phase review --plan <key> --phase <id> --reason <text>
99
99
  phase <accept|reject> --plan <key> --phase <id> --input <file>
100
100
  phase reopen --plan <key> --phase <id> --reason <text> [--override-reason <text>]
101
+ phase close-unaudited --plan <key> --phase <id> --reason <text>
102
+ # 監査せず「監査なしで閉じた」として明示的に閉じる(ADR 0148)。前提はgate_readyで、
103
+ # acceptedへは化けない(phase_accept_dependenciesを解錠しない)
104
+ phase baseline --reason <text> [--except <plan_key>]...
105
+ # 現在gate_readyかつphase eventを1つも持たないPhaseを一括でclosed_unauditedへ宣言する。
106
+ # 自動実行はしない(明示コマンドのみ)。--exceptで指定したplanは対象から除外する
101
107
 
102
108
  Write commands require LATTICE_TODO_ACTOR_HOST, LATTICE_TODO_ACTOR_SESSION,
103
109
  and LATTICE_TODO_ACTOR_AGENT.
@@ -169,12 +175,15 @@ const SUBCOMMAND_USAGE = Object.freeze({
169
175
  'todo verify': 'todo verify [--plan <key>] [--json]',
170
176
  'todo snapshot': 'todo snapshot --rebuild --plan <key>',
171
177
  'todo gantt': 'todo gantt [--out <file>] [--scope live|all] | status [--out <file>] | serve --port <port> [--scope live|all]',
172
- 'todo phase': 'todo phase <status|review|accept|reject|reopen> --plan <key> [options]',
178
+ 'todo phase': 'todo phase <status|review|accept|reject|reopen|close-unaudited> --plan <key> [options]'
179
+ + ' | baseline --reason <text> [--except <plan_key>]...',
173
180
  'todo phase status': 'todo phase status --plan <key>',
174
181
  'todo phase review': 'todo phase review --plan <key> --phase <id> --reason <text>',
175
182
  'todo phase accept': 'todo phase accept --plan <key> --phase <id> --input <file>',
176
183
  'todo phase reject': 'todo phase reject --plan <key> --phase <id> --input <file>',
177
184
  'todo phase reopen': 'todo phase reopen --plan <key> --phase <id> --reason <text> [--override-reason <text>]',
185
+ 'todo phase close-unaudited': 'todo phase close-unaudited --plan <key> --phase <id> --reason <text>',
186
+ 'todo phase baseline': 'todo phase baseline --reason <text> [--except <plan_key>]...',
178
187
  'todo start': 'todo start --plan <key> --task <id> [--parallel-frontier|--override-reason <text>]',
179
188
  'todo block': 'todo block --plan <key> --task <id> --reason <text>',
180
189
  'todo unblock': 'todo unblock --plan <key> --task <id>',