@quolu/lattice 0.81.0 → 0.83.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/bin/lattice-bridge-supervisor.mjs +18 -3
- package/bin/lattice-dashboard.mjs +3 -18
- package/bin/lattice-mcp.mjs +6 -3
- package/bin/lattice.mjs +29 -1
- package/docs/schemas/lattice.plan_create_input.v5.schema.json +375 -0
- package/docs/schemas/lattice.plan_revise_input.v1.schema.json +35 -0
- package/package.json +4 -2
- package/sensor/dist/db/index.d.ts +1 -0
- package/sensor/dist/db/index.d.ts.map +1 -1
- package/sensor/dist/db/index.js +13 -0
- package/sensor/dist/db/index.js.map +1 -1
- package/sensor/dist/index.d.ts.map +1 -1
- package/sensor/dist/index.js +12 -2
- package/sensor/dist/index.js.map +1 -1
- package/sensor/dist/mcp/answer-freshness.js +1 -1
- package/sensor/dist/mcp/answer-freshness.js.map +1 -1
- package/sensor/dist/mcp/engine.d.ts +11 -0
- package/sensor/dist/mcp/engine.d.ts.map +1 -1
- package/sensor/dist/mcp/engine.js +83 -4
- package/sensor/dist/mcp/engine.js.map +1 -1
- package/sensor/dist/mcp/index-repair.d.ts +7 -0
- package/sensor/dist/mcp/index-repair.d.ts.map +1 -0
- package/sensor/dist/mcp/index-repair.js +93 -0
- package/sensor/dist/mcp/index-repair.js.map +1 -0
- package/sensor/dist/mcp/index.d.ts.map +1 -1
- package/sensor/dist/mcp/index.js +12 -7
- package/sensor/dist/mcp/index.js.map +1 -1
- package/sensor/dist/mcp/tools.d.ts +4 -0
- package/sensor/dist/mcp/tools.d.ts.map +1 -1
- package/sensor/dist/mcp/tools.js +29 -9
- package/sensor/dist/mcp/tools.js.map +1 -1
- package/src/bridge-cli.mjs +16 -4
- package/src/bridge-detached-supervisor.mjs +204 -0
- package/src/bridge-hub-server.mjs +46 -9
- package/src/bridge-startup-folder.mjs +7 -4
- package/src/cli-help.mjs +5 -2
- package/src/dashboard-lifecycle-journal.mjs +42 -20
- package/src/plan-backchain.mjs +31 -12
- package/src/plan-binding-carry.mjs +60 -0
- package/src/plan-revise.mjs +276 -0
- package/src/project-cli.mjs +50 -22
- package/src/project-identity.mjs +14 -0
- package/src/runtime-cli.mjs +31 -18
- package/src/runtime-control-store.mjs +22 -1
- package/src/runtime-decision-verifier.mjs +27 -8
- package/src/runtime-engine.mjs +34 -5
- package/src/runtime-hold-recompile.mjs +19 -15
- package/src/runtime-kept-worktree.mjs +136 -0
- package/src/runtime-lifecycle-lock.mjs +118 -30
- package/src/runtime-managed-supervisor.mjs +10 -10
- package/src/runtime-os-observation.mjs +39 -1
- package/src/runtime-pull-intake.mjs +87 -43
- package/src/store-lock.mjs +146 -59
- package/src/todo-authoring-input.mjs +57 -2
- package/src/todo-cli.mjs +173 -45
- package/src/todo-contracts.mjs +22 -6
- package/src/todo-dashboard-registry.mjs +31 -4
- package/src/todo-gantt-display.mjs +260 -0
- package/src/todo-gantt-html-independence.mjs +8 -1
- package/src/todo-gantt-html-shared.mjs +2 -1
- package/src/todo-gantt-html.mjs +4 -2
- package/src/todo-gantt-layout.mjs +7 -36
- package/src/todo-gantt-live.mjs +6 -3
- package/src/todo-note-store.mjs +13 -5
- package/src/todo-readiness.mjs +29 -8
- package/src/todo-revision.mjs +9 -8
- package/src/todo-split.mjs +6 -3
- package/src/todo-status.mjs +53 -9
- package/src/todo-store-cache.mjs +1 -1
- package/src/todo-store-view.mjs +21 -2
- package/src/todo-store.mjs +642 -172
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Windows bridge supervisor (bh6 prep). Startup-folder items only run once at
|
|
3
|
+
* Windows/Linux bridge supervisor (bh6 prep). Startup-folder items only run once at
|
|
4
4
|
* logon — nothing like launchd's KeepAlive exists to restart a crashed
|
|
5
5
|
* process. This script is that supervision, written in JS instead of a batch
|
|
6
6
|
* GOTO loop because a loop's own process (and therefore its killability) is
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* The descriptor supplies the environment `lattice-bridge.mjs` needs (it is
|
|
11
11
|
* never inherited from the Startup-folder launch context) and the path to
|
|
12
12
|
* write this supervisor's own pid to, so `bridge-startup-folder.mjs` can find
|
|
13
|
-
* and stop the whole tree later via `taskkill /T /F`.
|
|
13
|
+
* and stop the whole tree later via `taskkill /T /F`. Linux records process
|
|
14
|
+
* birth alongside the PID so its detached adapter can reject PID reuse.
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
17
|
import { spawn } from 'node:child_process';
|
|
@@ -18,6 +19,8 @@ import { writeFile } from 'node:fs/promises';
|
|
|
18
19
|
import { readFileSync } from 'node:fs';
|
|
19
20
|
import path from 'node:path';
|
|
20
21
|
|
|
22
|
+
import { observeDashboardProcess } from '../src/dashboard-process-control.mjs';
|
|
23
|
+
|
|
21
24
|
const RESTART_DELAY_MS = 3_000;
|
|
22
25
|
|
|
23
26
|
const descriptorPath = process.argv[2];
|
|
@@ -33,7 +36,9 @@ if (descriptor?.schema !== 'lattice.bridge_supervisor_descriptor.v1'
|
|
|
33
36
|
process.exit(2);
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
|
|
39
|
+
const identity = process.platform === 'win32' ? String(process.pid)
|
|
40
|
+
: JSON.stringify(await observeDashboardProcess(process.pid) ?? { pid: process.pid, birth: null });
|
|
41
|
+
await writeFile(descriptor.pidPath, identity, { encoding: 'utf8', flag: 'w', mode: 0o600 });
|
|
37
42
|
|
|
38
43
|
let stopping = false;
|
|
39
44
|
let child = null;
|
|
@@ -44,6 +49,15 @@ const stop = () => {
|
|
|
44
49
|
process.once('SIGINT', stop);
|
|
45
50
|
process.once('SIGTERM', stop);
|
|
46
51
|
|
|
52
|
+
// Self-exit for a duplicate launch on the same descriptor: the pidfile names the one
|
|
53
|
+
// supervisor that owns it; one that finds another identity there was superseded and leaves
|
|
54
|
+
// (otherwise it respawns a bridge that cannot bind, forever). A missing pidfile changes nothing.
|
|
55
|
+
const supersededCheck = setInterval(() => {
|
|
56
|
+
let recorded;
|
|
57
|
+
try { recorded = readFileSync(descriptor.pidPath, 'utf8'); } catch { return; }
|
|
58
|
+
if (recorded !== identity) stop();
|
|
59
|
+
}, RESTART_DELAY_MS);
|
|
60
|
+
|
|
47
61
|
const bridgePath = path.resolve(descriptor.bridgePath);
|
|
48
62
|
while (!stopping) {
|
|
49
63
|
child = spawn(process.execPath, [bridgePath], {
|
|
@@ -56,3 +70,4 @@ while (!stopping) {
|
|
|
56
70
|
if (stopping) break;
|
|
57
71
|
await new Promise((resolve) => setTimeout(resolve, RESTART_DELAY_MS));
|
|
58
72
|
}
|
|
73
|
+
clearInterval(supersededCheck);
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { TODO_STATUS_DISPATCH_ONLY, projectTodoStatus } from '../src/todo-status.mjs';
|
|
4
4
|
import { createTodoStoreCache, todoStoreReadFailurePhase } from '../src/todo-store-cache.mjs';
|
|
5
|
-
import {
|
|
6
|
-
import { readProjectExternalPane } from '../src/project-identity.mjs';
|
|
5
|
+
import { createTodoGanttDisplayServing } from '../src/todo-cli.mjs';
|
|
7
6
|
import {
|
|
8
7
|
forgetTodoDashboardDaemonRecord,
|
|
9
8
|
readVisibleTodoDashboardProjects,
|
|
@@ -80,22 +79,8 @@ async function synchronize() {
|
|
|
80
79
|
registry.register({
|
|
81
80
|
projectId: entry.project_id,
|
|
82
81
|
displayName: entry.display_name,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const result = await renderTodoGanttForProject({ repoRoot: entry.repo_root,
|
|
86
|
-
stable: true, displayName, readModel: store });
|
|
87
|
-
return {
|
|
88
|
-
html: result.rendered.html,
|
|
89
|
-
head_digest: await ganttLiveHeadDigest({ repoRoot: entry.repo_root, store }),
|
|
90
|
-
// 配信のたびに読む。外部ペインを差した/外した側にdaemon再起動を要求しない。
|
|
91
|
-
external_pane: await readProjectExternalPane({
|
|
92
|
-
repoRoot: entry.repo_root, projectId: entry.project_id,
|
|
93
|
-
}),
|
|
94
|
-
};
|
|
95
|
-
},
|
|
96
|
-
readHead: async () => ganttLiveHeadDigest({
|
|
97
|
-
repoRoot: entry.repo_root, store: await readCachedStore(entry.repo_root),
|
|
98
|
-
}),
|
|
82
|
+
// 描画とheadは型付きの表示結果を読む(不整合でも500にせず、状態として出す)。
|
|
83
|
+
...createTodoGanttDisplayServing({ repoRoot: entry.repo_root, projectId: entry.project_id }),
|
|
99
84
|
});
|
|
100
85
|
roots.set(entry.project_id, binding);
|
|
101
86
|
}
|
package/bin/lattice-mcp.mjs
CHANGED
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
* `lattice-mcp`), rejecting that re-invoke would leave the daemon
|
|
22
22
|
* unable to ever start, silently pinning every session to direct mode
|
|
23
23
|
* (the exact silent-degradation trap the ADR calls out).
|
|
24
|
-
* ③ Exit semantics: usage violation before startup
|
|
24
|
+
* ③ Exit semantics: usage violation before startup (a known option without
|
|
25
|
+
* its value) = exit 2; unknown argv tokens are ignored with a warning; startup
|
|
25
26
|
* scrutiny failure = exit 1 + one `lattice.cli_error.v2` line on
|
|
26
27
|
* stderr; normal session end = exit 0 (delegated entirely to
|
|
27
28
|
* MCPServer, which calls process.exit on every one of its lifecycle
|
|
@@ -69,7 +70,9 @@ function startupFailure(code, message) {
|
|
|
69
70
|
* - `-p <path>` / `--path <path>` — explicit project root. The daemon
|
|
70
71
|
* re-invoke form always supplies this; a direct MCP-host launch may
|
|
71
72
|
* omit it and rely on `rootUri` reported by the client at `initialize`.
|
|
72
|
-
* Any other token is
|
|
73
|
+
* Any other token is ignored with one stderr warning naming it (u03 sweep F2);
|
|
74
|
+
* it protects nothing, so it never stops startup. A known option missing its
|
|
75
|
+
* value stays a usage violation (exit 2).
|
|
73
76
|
*/
|
|
74
77
|
function parseArgs(argv) {
|
|
75
78
|
let path;
|
|
@@ -89,7 +92,7 @@ function parseArgs(argv) {
|
|
|
89
92
|
unknown.push(arg);
|
|
90
93
|
}
|
|
91
94
|
if (unknown.length > 0) {
|
|
92
|
-
|
|
95
|
+
process.stderr.write(`lattice-mcp: ignoring unsupported argument(s): ${unknown.join(' ')}\n`);
|
|
93
96
|
}
|
|
94
97
|
return { path };
|
|
95
98
|
}
|
package/bin/lattice.mjs
CHANGED
|
@@ -77,7 +77,7 @@ if (help !== null) {
|
|
|
77
77
|
process.exitCode = projectCliFailure(process.stderr, error);
|
|
78
78
|
}
|
|
79
79
|
} else if (args.length === 5 && args[0] === 'plan' && args[1] === 'create'
|
|
80
|
-
&& args[2] === '--schema-version' && ['1', '2', '3', '4'].includes(args[3]) && args[4] === '--json') {
|
|
80
|
+
&& args[2] === '--schema-version' && ['1', '2', '3', '4', '5'].includes(args[3]) && args[4] === '--json') {
|
|
81
81
|
const { projectCliFailure, runPlanCreateSchema } = await import('../src/project-cli.mjs');
|
|
82
82
|
try {
|
|
83
83
|
process.exitCode = await runPlanCreateSchema({ stdout: process.stdout, version: Number(args[3]) });
|
|
@@ -112,6 +112,34 @@ if (help !== null) {
|
|
|
112
112
|
} catch (error) {
|
|
113
113
|
process.exitCode = projectCliFailure(process.stderr, error);
|
|
114
114
|
}
|
|
115
|
+
} else if (args.length === 4 && args[0] === 'plan' && args[1] === 'revise'
|
|
116
|
+
&& args[2] === '--schema' && args[3] === '--json') {
|
|
117
|
+
const { planReviseSchema } = await import('../src/plan-revise.mjs');
|
|
118
|
+
const { projectCliFailure } = await import('../src/project-cli.mjs');
|
|
119
|
+
try {
|
|
120
|
+
process.stdout.write(`${JSON.stringify(await planReviseSchema())}\n`);
|
|
121
|
+
process.exitCode = 0;
|
|
122
|
+
} catch (error) {
|
|
123
|
+
process.exitCode = projectCliFailure(process.stderr, error);
|
|
124
|
+
}
|
|
125
|
+
} else if (args[0] === 'plan' && args[1] === 'revise') {
|
|
126
|
+
const { matchFlagCommand } = await import('../src/todo-authoring-input.mjs');
|
|
127
|
+
const flags = matchFlagCommand(args, ['plan', 'revise'], {
|
|
128
|
+
known: ['input', 'dry-run', 'json'], required: ['input'], booleans: ['dry-run', 'json'],
|
|
129
|
+
});
|
|
130
|
+
if (flags === null || flags.json !== true) {
|
|
131
|
+
process.stderr.write(`lattice: unsupported command or arguments: ${args.join(' ')}\n`);
|
|
132
|
+
process.exitCode = 2;
|
|
133
|
+
} else {
|
|
134
|
+
const { runPlanRevise } = await import('../src/plan-revise.mjs');
|
|
135
|
+
const { projectCliFailure } = await import('../src/project-cli.mjs');
|
|
136
|
+
try {
|
|
137
|
+
process.exitCode = await runPlanRevise({ cwd: process.cwd(), inputRef: flags.input,
|
|
138
|
+
dryRun: flags['dry-run'] === true, stdout: process.stdout, env: process.env });
|
|
139
|
+
} catch (error) {
|
|
140
|
+
process.exitCode = projectCliFailure(process.stderr, error);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
115
143
|
} else if (args.length === 4 && args[0] === 'plan' && args[1] === 'backchain'
|
|
116
144
|
&& args[2] === '--schema' && args[3] === '--json') {
|
|
117
145
|
const { backchainSchema } = await import('../src/plan-backchain.mjs');
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/kitepon/Lattice/blob/main/docs/schemas/lattice.plan_create_input.v5.schema.json",
|
|
4
|
+
"title": "lattice.plan_create_input.v5",
|
|
5
|
+
"description": "Canonical initial authoring input for a phase-audited plan. Every task requires a design memo. After the complete plan is written, run `lattice plan scope-review` and confirm that every task preserves an owner-supplied work specification without adding a product purpose. あなたがこのToDoに対して、何も考えていないならば、設計メモに `NO_PLAN` と書いてください v5 adds the per-task authored `done_condition`: plain text (or null when the author states none) that Lattice records and shows but never evaluates, never assigns and never records as done. Builds lattice.todo_plan.v8.",
|
|
6
|
+
"$comment": "Runtime validation additionally enforces canonical JSON+LF bytes, sorted identifiers and edges, unique ids, combined task/phase acyclicity, byte bounds, non-empty design_memo, and input_digest. v5 additionally accepts hard_dependencies, joins, each joins[].after, phase_accept_dependencies, phases, phases[].predecessor_phase_ids and phases[].required_evidence_slots in any order or with exact duplicates: they are sorted into canonical order and de-duplicated before validation. tasks are never reordered. Entries with the same key but different content are still refused.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"required": [
|
|
10
|
+
"schema",
|
|
11
|
+
"project_id",
|
|
12
|
+
"plan_key",
|
|
13
|
+
"plan_version",
|
|
14
|
+
"actor",
|
|
15
|
+
"recorded_at",
|
|
16
|
+
"tasks",
|
|
17
|
+
"phases",
|
|
18
|
+
"hard_dependencies",
|
|
19
|
+
"joins",
|
|
20
|
+
"phase_accept_dependencies",
|
|
21
|
+
"input_digest"
|
|
22
|
+
],
|
|
23
|
+
"properties": {
|
|
24
|
+
"schema": {
|
|
25
|
+
"const": "lattice.plan_create_input.v5"
|
|
26
|
+
},
|
|
27
|
+
"project_id": {
|
|
28
|
+
"$ref": "#/$defs/identifier"
|
|
29
|
+
},
|
|
30
|
+
"plan_key": {
|
|
31
|
+
"$ref": "#/$defs/identifier"
|
|
32
|
+
},
|
|
33
|
+
"plan_version": {
|
|
34
|
+
"$ref": "#/$defs/identifier"
|
|
35
|
+
},
|
|
36
|
+
"actor": {
|
|
37
|
+
"$ref": "#/$defs/actor"
|
|
38
|
+
},
|
|
39
|
+
"recorded_at": {
|
|
40
|
+
"$ref": "#/$defs/strictTimestamp"
|
|
41
|
+
},
|
|
42
|
+
"tasks": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"minItems": 1,
|
|
45
|
+
"maxItems": 512,
|
|
46
|
+
"items": {
|
|
47
|
+
"$ref": "#/$defs/task"
|
|
48
|
+
},
|
|
49
|
+
"description": "task_idの昇順・重複なしで並べる。整列はJSON Schemaでは表現できないがCLIは拒否する。"
|
|
50
|
+
},
|
|
51
|
+
"phases": {
|
|
52
|
+
"type": "array",
|
|
53
|
+
"minItems": 1,
|
|
54
|
+
"maxItems": 512,
|
|
55
|
+
"items": {
|
|
56
|
+
"$ref": "#/$defs/phase"
|
|
57
|
+
},
|
|
58
|
+
"description": "phase_idの昇順・重複なしを正準形とする。入力順は問わず、機械が整列し完全一致の重複を除く。同じphase_idで内容が違う場合は拒否する。全taskのphase_idはここに存在しなければならない。"
|
|
59
|
+
},
|
|
60
|
+
"hard_dependencies": {
|
|
61
|
+
"type": "array",
|
|
62
|
+
"maxItems": 2048,
|
|
63
|
+
"items": {
|
|
64
|
+
"$ref": "#/$defs/edge"
|
|
65
|
+
},
|
|
66
|
+
"description": "入力順は問わず、機械が正準順(from、toを(project_id, plan_key, task_id)の辞書順)へ整列し完全一致の重複を除く。"
|
|
67
|
+
},
|
|
68
|
+
"joins": {
|
|
69
|
+
"type": "array",
|
|
70
|
+
"maxItems": 128,
|
|
71
|
+
"items": {
|
|
72
|
+
"$ref": "#/$defs/join"
|
|
73
|
+
},
|
|
74
|
+
"description": "入力順は問わず、機械がidの昇順へ整列する。同じidで内容が違うjoinは拒否する。各afterも同様に整列し重複を除く。"
|
|
75
|
+
},
|
|
76
|
+
"phase_accept_dependencies": {
|
|
77
|
+
"type": "array",
|
|
78
|
+
"maxItems": 2048,
|
|
79
|
+
"items": {
|
|
80
|
+
"$ref": "#/$defs/phaseAcceptDependency"
|
|
81
|
+
},
|
|
82
|
+
"description": "入力順は問わず、機械が正準順へ整列し完全一致の重複を除く。"
|
|
83
|
+
},
|
|
84
|
+
"input_digest": {
|
|
85
|
+
"$ref": "#/$defs/authoringDigest"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"$defs": {
|
|
89
|
+
"identifier": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"pattern": "^[0-9A-Za-z](?:[0-9A-Za-z._-]{0,127})$"
|
|
92
|
+
},
|
|
93
|
+
"digest": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"pattern": "^[0-9a-f]{64}$"
|
|
96
|
+
},
|
|
97
|
+
"repoRef": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"minLength": 1,
|
|
100
|
+
"maxLength": 1024
|
|
101
|
+
},
|
|
102
|
+
"strictTimestamp": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
|
|
105
|
+
},
|
|
106
|
+
"nullableRepoRef": {
|
|
107
|
+
"oneOf": [
|
|
108
|
+
{
|
|
109
|
+
"type": "null"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"$ref": "#/$defs/repoRef"
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"nullableIdentifier": {
|
|
117
|
+
"oneOf": [
|
|
118
|
+
{
|
|
119
|
+
"type": "null"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"$ref": "#/$defs/identifier"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"actor": {
|
|
127
|
+
"type": "object",
|
|
128
|
+
"additionalProperties": false,
|
|
129
|
+
"required": [
|
|
130
|
+
"host",
|
|
131
|
+
"session",
|
|
132
|
+
"agent"
|
|
133
|
+
],
|
|
134
|
+
"properties": {
|
|
135
|
+
"host": {
|
|
136
|
+
"$ref": "#/$defs/identifier"
|
|
137
|
+
},
|
|
138
|
+
"session": {
|
|
139
|
+
"$ref": "#/$defs/identifier"
|
|
140
|
+
},
|
|
141
|
+
"agent": {
|
|
142
|
+
"$ref": "#/$defs/identifier"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"task": {
|
|
147
|
+
"type": "object",
|
|
148
|
+
"additionalProperties": false,
|
|
149
|
+
"required": [
|
|
150
|
+
"task_id",
|
|
151
|
+
"title",
|
|
152
|
+
"lane",
|
|
153
|
+
"design_memo",
|
|
154
|
+
"narrative_ref",
|
|
155
|
+
"narrative_anchor",
|
|
156
|
+
"compile_binding",
|
|
157
|
+
"parent_task_id",
|
|
158
|
+
"phase_id",
|
|
159
|
+
"done_condition"
|
|
160
|
+
],
|
|
161
|
+
"properties": {
|
|
162
|
+
"task_id": {
|
|
163
|
+
"$ref": "#/$defs/identifier"
|
|
164
|
+
},
|
|
165
|
+
"title": {
|
|
166
|
+
"oneOf": [
|
|
167
|
+
{
|
|
168
|
+
"type": "null"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"type": "string",
|
|
172
|
+
"minLength": 1,
|
|
173
|
+
"maxLength": 16384
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
"lane": {
|
|
178
|
+
"$ref": "#/$defs/identifier"
|
|
179
|
+
},
|
|
180
|
+
"design_memo": {
|
|
181
|
+
"type": "string",
|
|
182
|
+
"minLength": 1,
|
|
183
|
+
"maxLength": 16384,
|
|
184
|
+
"description": "Markdown design memo. あなたがこのToDoに対して、何も考えていないならば、設計メモに `NO_PLAN` と書いてください"
|
|
185
|
+
},
|
|
186
|
+
"done_condition": {
|
|
187
|
+
"oneOf": [
|
|
188
|
+
{
|
|
189
|
+
"type": "null"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"type": "string",
|
|
193
|
+
"minLength": 1,
|
|
194
|
+
"maxLength": 16384
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"description": "作成者が書くこのtask固有の終了条件(プレーンテキスト、設計メモと同じ本文規則)。nullは「書かない」。Latticeは記録して表示するだけで、評価せず、作業を割り当てず、doneも記録しない。"
|
|
198
|
+
},
|
|
199
|
+
"narrative_ref": {
|
|
200
|
+
"$ref": "#/$defs/nullableRepoRef"
|
|
201
|
+
},
|
|
202
|
+
"narrative_anchor": {
|
|
203
|
+
"type": "null"
|
|
204
|
+
},
|
|
205
|
+
"compile_binding": {
|
|
206
|
+
"type": "null"
|
|
207
|
+
},
|
|
208
|
+
"parent_task_id": {
|
|
209
|
+
"$ref": "#/$defs/nullableIdentifier"
|
|
210
|
+
},
|
|
211
|
+
"phase_id": {
|
|
212
|
+
"$ref": "#/$defs/identifier"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"phase": {
|
|
217
|
+
"type": "object",
|
|
218
|
+
"additionalProperties": false,
|
|
219
|
+
"required": [
|
|
220
|
+
"phase_id",
|
|
221
|
+
"title",
|
|
222
|
+
"gate_policy",
|
|
223
|
+
"predecessor_phase_ids",
|
|
224
|
+
"required_evidence_slots"
|
|
225
|
+
],
|
|
226
|
+
"properties": {
|
|
227
|
+
"phase_id": {
|
|
228
|
+
"$ref": "#/$defs/identifier"
|
|
229
|
+
},
|
|
230
|
+
"title": {
|
|
231
|
+
"oneOf": [
|
|
232
|
+
{
|
|
233
|
+
"type": "null"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"type": "string",
|
|
237
|
+
"minLength": 1,
|
|
238
|
+
"maxLength": 16384
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
},
|
|
242
|
+
"gate_policy": {
|
|
243
|
+
"$ref": "#/$defs/identifier",
|
|
244
|
+
"description": "Phase gateの呼び名。製品はこの値で分岐しないので統制語彙は無く、identifierなら何でもよい。表示に使う。慣用は 'heavy'(重監査)と 'terminal-audit'(暗黙の終端Phaseが使う)。"
|
|
245
|
+
},
|
|
246
|
+
"predecessor_phase_ids": {
|
|
247
|
+
"type": "array",
|
|
248
|
+
"items": {
|
|
249
|
+
"$ref": "#/$defs/identifier"
|
|
250
|
+
},
|
|
251
|
+
"uniqueItems": true,
|
|
252
|
+
"description": "先行Phase。入力順は問わず、機械がidentifierの昇順へ整列し重複を除く。"
|
|
253
|
+
},
|
|
254
|
+
"required_evidence_slots": {
|
|
255
|
+
"type": "array",
|
|
256
|
+
"minItems": 1,
|
|
257
|
+
"items": {
|
|
258
|
+
"$ref": "#/$defs/identifier"
|
|
259
|
+
},
|
|
260
|
+
"uniqueItems": true,
|
|
261
|
+
"description": "Phase gateが要求する証跡slot。1つ以上必須。入力順は問わず、機械が昇順へ整列し重複を除く。"
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
"nodeRef": {
|
|
266
|
+
"type": "object",
|
|
267
|
+
"additionalProperties": false,
|
|
268
|
+
"required": [
|
|
269
|
+
"project_id",
|
|
270
|
+
"plan_key",
|
|
271
|
+
"task_id"
|
|
272
|
+
],
|
|
273
|
+
"properties": {
|
|
274
|
+
"project_id": {
|
|
275
|
+
"$ref": "#/$defs/identifier"
|
|
276
|
+
},
|
|
277
|
+
"plan_key": {
|
|
278
|
+
"$ref": "#/$defs/identifier"
|
|
279
|
+
},
|
|
280
|
+
"task_id": {
|
|
281
|
+
"$ref": "#/$defs/identifier"
|
|
282
|
+
},
|
|
283
|
+
"expected_topology_digest": {
|
|
284
|
+
"$ref": "#/$defs/digest"
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
"phaseRef": {
|
|
289
|
+
"type": "object",
|
|
290
|
+
"additionalProperties": false,
|
|
291
|
+
"required": [
|
|
292
|
+
"project_id",
|
|
293
|
+
"plan_key",
|
|
294
|
+
"phase_id"
|
|
295
|
+
],
|
|
296
|
+
"properties": {
|
|
297
|
+
"project_id": {
|
|
298
|
+
"$ref": "#/$defs/identifier"
|
|
299
|
+
},
|
|
300
|
+
"plan_key": {
|
|
301
|
+
"$ref": "#/$defs/identifier"
|
|
302
|
+
},
|
|
303
|
+
"phase_id": {
|
|
304
|
+
"$ref": "#/$defs/identifier"
|
|
305
|
+
},
|
|
306
|
+
"expected_topology_digest": {
|
|
307
|
+
"$ref": "#/$defs/digest"
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
"edge": {
|
|
312
|
+
"type": "object",
|
|
313
|
+
"additionalProperties": false,
|
|
314
|
+
"required": [
|
|
315
|
+
"from",
|
|
316
|
+
"to"
|
|
317
|
+
],
|
|
318
|
+
"properties": {
|
|
319
|
+
"from": {
|
|
320
|
+
"$ref": "#/$defs/nodeRef"
|
|
321
|
+
},
|
|
322
|
+
"to": {
|
|
323
|
+
"$ref": "#/$defs/nodeRef"
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
"phaseAcceptDependency": {
|
|
328
|
+
"type": "object",
|
|
329
|
+
"additionalProperties": false,
|
|
330
|
+
"required": [
|
|
331
|
+
"from",
|
|
332
|
+
"to"
|
|
333
|
+
],
|
|
334
|
+
"properties": {
|
|
335
|
+
"from": {
|
|
336
|
+
"$ref": "#/$defs/phaseRef"
|
|
337
|
+
},
|
|
338
|
+
"to": {
|
|
339
|
+
"$ref": "#/$defs/nodeRef"
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
"join": {
|
|
344
|
+
"type": "object",
|
|
345
|
+
"additionalProperties": false,
|
|
346
|
+
"required": [
|
|
347
|
+
"id",
|
|
348
|
+
"after",
|
|
349
|
+
"before"
|
|
350
|
+
],
|
|
351
|
+
"properties": {
|
|
352
|
+
"id": {
|
|
353
|
+
"$ref": "#/$defs/identifier"
|
|
354
|
+
},
|
|
355
|
+
"after": {
|
|
356
|
+
"type": "array",
|
|
357
|
+
"minItems": 1,
|
|
358
|
+
"maxItems": 512,
|
|
359
|
+
"items": {
|
|
360
|
+
"$ref": "#/$defs/nodeRef"
|
|
361
|
+
},
|
|
362
|
+
"description": "参照の順序は問わず、機械が(project_id, plan_key, task_id)の辞書順へ整列し完全一致の重複を除く。"
|
|
363
|
+
},
|
|
364
|
+
"before": {
|
|
365
|
+
"$ref": "#/$defs/nodeRef"
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
"authoringDigest": {
|
|
370
|
+
"type": "string",
|
|
371
|
+
"pattern": "^(|[0-9a-f]{64})$",
|
|
372
|
+
"description": "canonical入力から算出される自己digest。CLIが読み込み時に必ず再計算して埋めるので、authorは空文字 \"\" を置けばよい。手で計算する必要はない。"
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/kitepon/Lattice/blob/main/docs/schemas/lattice.plan_revise_input.v1.schema.json",
|
|
4
|
+
"title": "lattice.plan_revise_input.v1",
|
|
5
|
+
"description": "工程全体のdesired stateと、全ての旧taskの明示的な状態移行。predecessor/CAS/digest/後継versionは機械が算出する。旧版は保持し、作業の意味が同じかを暗黙に推定しない。",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["schema", "desired", "continuity"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"schema": { "const": "lattice.plan_revise_input.v1" },
|
|
11
|
+
"desired": {
|
|
12
|
+
"oneOf": [
|
|
13
|
+
{ "$ref": "lattice.plan_create_input.v4.schema.json" },
|
|
14
|
+
{ "$ref": "lattice.plan_create_input.v5.schema.json" }
|
|
15
|
+
],
|
|
16
|
+
"description": "同じproject_idとplan_keyのcreate-v4またはv5入力。input_digestは通常のauthoring正規化で補う。v5は終了条件done_conditionを持ち、集合の並びを機械が正準化する(plan v8を作る)。v4でも先行planがv8なら、書かない終了条件は先行planの値を引き継ぐ。plan_versionは入力形を保つために記載し、後継versionは機械算出値に置き換える。新taskはpending。消すtaskへの参照も明示的に取り除く。"
|
|
17
|
+
},
|
|
18
|
+
"continuity": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"minItems": 1,
|
|
21
|
+
"maxItems": 512,
|
|
22
|
+
"description": "旧task全件をtask_idごとに一度ずつ選ぶ。新taskへのentryは書かない。配列の順序は問わない。carryはtaskの状態(進行中・完了を含む)を保ったまま、文面・終了条件・依存・joinの改訂を受け付け(改訂後の手順は以後そのまま実行時に守られ、履歴noteに残る)、resetはpendingへ戻し、retireはdesiredに存在しないtaskだけに使う。各判断の理由をreasonに記録する。",
|
|
23
|
+
"items": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"required": ["task_id", "policy", "reason"],
|
|
27
|
+
"properties": {
|
|
28
|
+
"task_id": { "type": "string", "pattern": "^[0-9A-Za-z](?:[0-9A-Za-z._-]{0,127})$" },
|
|
29
|
+
"policy": { "enum": ["carry", "reset", "retire"] },
|
|
30
|
+
"reason": { "type": "string", "minLength": 1, "pattern": "\\S" }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quolu/lattice",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.83.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",
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
"docs/schemas/lattice.plan_create_input.v2.schema.json",
|
|
30
30
|
"docs/schemas/lattice.plan_create_input.v3.schema.json",
|
|
31
31
|
"docs/schemas/lattice.plan_create_input.v4.schema.json",
|
|
32
|
+
"docs/schemas/lattice.plan_create_input.v5.schema.json",
|
|
33
|
+
"docs/schemas/lattice.plan_revise_input.v1.schema.json",
|
|
32
34
|
"docs/schemas/lattice.plan_scope_review.v1.schema.json",
|
|
33
35
|
"docs/schemas/lattice.plan_backchain.v1.schema.json",
|
|
34
36
|
"docs/schemas/lattice.todo_revision.v2.schema.json",
|
|
@@ -84,7 +86,7 @@
|
|
|
84
86
|
"test:profile": "npm --prefix sensor ci && npm --prefix sensor run build && node scripts/run-product-tests.mjs",
|
|
85
87
|
"test:sensor": "npm --prefix sensor test",
|
|
86
88
|
"check": "node scripts/check-syntax.mjs",
|
|
87
|
-
"ci": "
|
|
89
|
+
"ci": "node scripts/run-ci.mjs",
|
|
88
90
|
"verify:todo-store": "node bin/lattice.mjs todo verify --json",
|
|
89
91
|
"check:cli-surface": "node scripts/verify-cli-surface.mjs",
|
|
90
92
|
"check:open-questions": "node scripts/verify-open-questions.mjs",
|
|
@@ -53,6 +53,7 @@ export declare class DatabaseConnection {
|
|
|
53
53
|
static open(dbPath: string, options?: {
|
|
54
54
|
readOnly?: boolean;
|
|
55
55
|
}): DatabaseConnection;
|
|
56
|
+
private static finishOpen;
|
|
56
57
|
/**
|
|
57
58
|
* FTS maintenance triggers dropped/recreated around a bulk load.
|
|
58
59
|
* Names must match schema.sql.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAkB,MAAM,kBAAkB,CAAC;AAGjF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAiCjE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,QAA8D,CAAC;AAEpG,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAMtE;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAoB2E,QAAQ,CAAC,QAAQ;IAnBzH,OAAO,CAAC,EAAE,CAAiB;IAC3B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAgB;IAC/B;;;;;;;OAOG;IACH,OAAO,CAAC,WAAW,CAAgB;IAEnC;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAEhC,OAAO;IAQP;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB;IA2DrD;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,kBAAkB;
|
|
1
|
+
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|
}
|
|
190
190
|
const { db, backend } = (0, sqlite_adapter_1.createDatabase)(dbPath, options);
|
|
191
|
+
// u03 E15: a damaged file throws below; close it so Windows can move it aside.
|
|
192
|
+
try {
|
|
193
|
+
return DatabaseConnection.finishOpen(db, dbPath, backend, options);
|
|
194
|
+
}
|
|
195
|
+
catch (err) {
|
|
196
|
+
try {
|
|
197
|
+
db.close();
|
|
198
|
+
}
|
|
199
|
+
catch { /* already unusable */ }
|
|
200
|
+
throw err;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
static finishOpen(db, dbPath, backend, options) {
|
|
191
204
|
configureConnection(db, options.readOnly);
|
|
192
205
|
// Detect FTS5 availability for search fallback (#1532)
|
|
193
206
|
let fts5Available = true;
|