@quolu/lattice 0.86.0 → 0.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cli-help.mjs +6 -3
- package/src/todo-cli.mjs +70 -8
- package/src/todo-parallel-candidates.mjs +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quolu/lattice",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.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
|
@@ -98,7 +98,7 @@ Read commands:
|
|
|
98
98
|
verify [--plan <key>] [--json]
|
|
99
99
|
snapshot --rebuild --plan <key>
|
|
100
100
|
gantt serve --port <port> [--scope live|all] # 動的表示。opt-in済みplanは工程図と別の構造検査面を持つ
|
|
101
|
-
phase status --plan <key>
|
|
101
|
+
phase status --plan <key> [--json]
|
|
102
102
|
|
|
103
103
|
Write commands:
|
|
104
104
|
repair-eol --json # Git checkoutでCRLF化された既存storeをcanonical LFへ戻し、EOL保護を追加する
|
|
@@ -145,6 +145,8 @@ Write commands:
|
|
|
145
145
|
independence witness scaffold --template --plan <key> [--json] # 未完の工程を並べた下書きのひな形を出す
|
|
146
146
|
independence witness scaffold --schema --json # 下書き(lattice.todo_witness_draft.v2)のJSON Schema
|
|
147
147
|
independence witness scaffold --plan <key> --input <draft> # 下書きとfresh観測から宣言を書き出す
|
|
148
|
+
independence witness declare --plan <key> --task <id> [--owns <path>[,<path>...]] [--reads ...] [--writes ...]
|
|
149
|
+
# 1件のtaskの行だけを宣言する(a40)。readyが全部宣言済みならcompileまで行い、未宣言はwaiting_forに返す
|
|
148
150
|
structure input --plan <key> --input <file> --dry-run --json
|
|
149
151
|
# plan identity・topology・unfinished task coverage・baseline祖先を無変更で検査する
|
|
150
152
|
structure input --plan <key> --input <file>
|
|
@@ -302,7 +304,8 @@ const SUBCOMMAND_USAGE = Object.freeze({
|
|
|
302
304
|
'todo display source': 'todo display source [--json] # lattice.todo_store_display_source.v1(安い変更検知。変わった時だけreadする)',
|
|
303
305
|
'todo independence': 'todo independence [--plan <key>] [--json] | mode --plan <key> --set <witness|conversation> --reason <text>'
|
|
304
306
|
+ ' | compile --plan <key> --input <file> | compile --schema --json | witness migrate --plan <key>'
|
|
305
|
-
+ ' | witness scaffold --template --plan <key> [--json] | witness scaffold --schema --json | witness scaffold --plan <key> --input <draft>'
|
|
307
|
+
+ ' | witness scaffold --template --plan <key> [--json] | witness scaffold --schema --json | witness scaffold --plan <key> --input <draft>'
|
|
308
|
+
+ ' | witness declare --plan <key> --task <id> [--owns <path>[,<path>...]] [--reads ...] [--writes ...]',
|
|
306
309
|
'todo independence mode': 'todo independence mode --plan <key> --set <witness|conversation> --reason <text>',
|
|
307
310
|
'todo structure': 'todo structure --schema --json | [--plan <key>] --json | input --plan <key> --input <file> [--dry-run --json] | compile --plan <key> --input <file> | realize --plan <key> --task <id> (--planned|--realized <actual-structure.json>) [--commit <HEAD|sha>]... | realize --plan <key> --task <id> --input <full-realization.json> | finalize --plan <key> --json',
|
|
308
311
|
'todo seam-profile': 'todo seam-profile --plan <key> --file <path> [--json]',
|
|
@@ -318,7 +321,7 @@ const SUBCOMMAND_USAGE = Object.freeze({
|
|
|
318
321
|
'todo dashboard remove': 'todo dashboard remove <project_id> --json # 登録簿から1件外す(対象repo不在でも可)',
|
|
319
322
|
'todo phase': 'todo phase <status|review|accept|reject|reopen|close-unaudited> --plan <key> [options]'
|
|
320
323
|
+ ' | baseline --reason <text> [--except <plan_key>]...',
|
|
321
|
-
'todo phase status': 'todo phase status --plan <key>',
|
|
324
|
+
'todo phase status': 'todo phase status --plan <key> [--json]',
|
|
322
325
|
'todo phase review': 'todo phase review --plan <key> --phase <id> --reason <text>',
|
|
323
326
|
'todo phase accept': 'todo phase accept --plan <key> --phase <id> --evidence <file> | --input <file>',
|
|
324
327
|
'todo phase reject': 'todo phase reject --plan <key> --phase <id> --reason <text> --evidence <file> | --input <file>',
|
package/src/todo-cli.mjs
CHANGED
|
@@ -173,7 +173,7 @@ import { applySeamProposal } from './seam-apply.mjs';
|
|
|
173
173
|
import { todoPlanPrecedences } from './seam-verification.mjs';
|
|
174
174
|
import {
|
|
175
175
|
WITNESS_DRAFT_SCHEMA, buildWitnessObservationQuerySet, buildWitnessSet, explainWitnessDraft, serializeWitnessSet,
|
|
176
|
-
witnessDraftTemplate,
|
|
176
|
+
validateWitnessDraft, witnessDraftTemplate,
|
|
177
177
|
} from './witness-scaffold.mjs';
|
|
178
178
|
import {
|
|
179
179
|
completePhaseTodoRevision, explainPhaseTodoRevision, explainTodoRevision, explainTodoRevisionSet,
|
|
@@ -348,8 +348,11 @@ const TODO_FLAG_SPECS = Object.freeze({
|
|
|
348
348
|
'independence compile': Object.freeze({ known: ['plan', 'input'], required: ['plan', 'input'] }),
|
|
349
349
|
'independence mode': Object.freeze({ known: ['plan', 'set', 'reason'], required: ['plan', 'set', 'reason'] }),
|
|
350
350
|
'independence witness scaffold': Object.freeze({ known: ['plan', 'input'], required: ['plan', 'input'] }),
|
|
351
|
+
'independence witness declare': Object.freeze({
|
|
352
|
+
known: ['plan', 'task', 'owns', 'reads', 'writes'], required: ['plan', 'task'] }),
|
|
351
353
|
show: Object.freeze({ known: ['plan', 'task', 'json'], required: ['plan', 'task'], booleans: ['json'] }),
|
|
352
354
|
'note list': Object.freeze({ known: ['plan', 'task', 'json'], required: ['plan'], booleans: ['json'] }),
|
|
355
|
+
'phase status': Object.freeze({ known: ['plan', 'json'], required: ['plan'], booleans: ['json'] }),
|
|
353
356
|
structure: Object.freeze({ known: ['plan', 'json'], required: [], booleans: ['json'] }),
|
|
354
357
|
status: Object.freeze({ known: ['json'], required: [], booleans: ['json'] }),
|
|
355
358
|
});
|
|
@@ -521,12 +524,12 @@ function supportsAtomicStoreCommit(argv) {
|
|
|
521
524
|
if (command === 'note') return argv[1] !== 'list';
|
|
522
525
|
if (command === 'independence') {
|
|
523
526
|
return argv[1] === 'mode'
|
|
524
|
-
|| (argv[1] === 'witness' && ['migrate', 'scaffold'].includes(argv[2]) && !argv.includes('--template'));
|
|
527
|
+
|| (argv[1] === 'witness' && ['migrate', 'scaffold', 'declare'].includes(argv[2]) && !argv.includes('--template'));
|
|
525
528
|
}
|
|
526
529
|
if (command === 'snapshot') return argv[1] === '--rebuild';
|
|
527
530
|
if (command === 'migrate') return !argv.includes('--dry-run') && !argv.includes('--schema');
|
|
528
531
|
if (['revise', 'split', 'revise-set', 'revise-phase', 'start', 'retract', 'block',
|
|
529
|
-
'unblock', 'retire', 'done', 'reopen'].includes(command)) return true;
|
|
532
|
+
'unblock', 'retire', 'done', 'reopen', 'add'].includes(command)) return true;
|
|
530
533
|
if (command === 'evidence') return argv[1] === 'promote';
|
|
531
534
|
if (command === 'phase') return argv[1] !== 'status';
|
|
532
535
|
return false;
|
|
@@ -3658,6 +3661,11 @@ async function witnessScaffold({ repoRoot, planKey, inputRef }) {
|
|
|
3658
3661
|
draft_plan_key: draft.plan_key, plan_key: planKey,
|
|
3659
3662
|
});
|
|
3660
3663
|
}
|
|
3664
|
+
return scaffoldWitnessDraft({ repoRoot, planKey, draft });
|
|
3665
|
+
}
|
|
3666
|
+
|
|
3667
|
+
/** The scaffold itself: fresh observation, wiring and digest for a checked draft, then the write. */
|
|
3668
|
+
async function scaffoldWitnessDraft({ repoRoot, planKey, draft }) {
|
|
3661
3669
|
const { queries, paths } = buildWitnessObservationQuerySet(draft);
|
|
3662
3670
|
const collected = await collectSensorEvidence({ cwd: repoRoot, querySet: { queries } });
|
|
3663
3671
|
const observationByPath = {};
|
|
@@ -3697,6 +3705,53 @@ async function witnessScaffold({ repoRoot, planKey, inputRef }) {
|
|
|
3697
3705
|
};
|
|
3698
3706
|
}
|
|
3699
3707
|
|
|
3708
|
+
/**
|
|
3709
|
+
* a40: one task's witness row, declared by its member. Rows nobody declared stay out (an empty row
|
|
3710
|
+
* would claim "touches nothing"); compile runs once every ready task is declared.
|
|
3711
|
+
*/
|
|
3712
|
+
async function witnessDeclare({ repoRoot, planKey, flags }) {
|
|
3713
|
+
const store = await readTodoStore({ repoRoot });
|
|
3714
|
+
const member = store.members.find(({ descriptor }) => descriptor.plan_key === planKey);
|
|
3715
|
+
if (member === undefined) throw new TodoStoreError('STORE_INCONSISTENT', 'plan_not_active', undefined, { plan_key: planKey });
|
|
3716
|
+
const taskId = flags.task;
|
|
3717
|
+
const state = member.tasks.find(({ task_id: id }) => id === taskId);
|
|
3718
|
+
if (state === undefined) {
|
|
3719
|
+
throw new TodoStoreError('TASK_NOT_FOUND', 'task_not_found', undefined, { requested_task_id: taskId });
|
|
3720
|
+
}
|
|
3721
|
+
if (['done', 'retired'].includes(state.status)) {
|
|
3722
|
+
throw new TodoStoreError('INPUT_INVALID', 'witness_declare_task_finished', undefined, {
|
|
3723
|
+
plan_key: planKey, task_id: taskId, status: state.status,
|
|
3724
|
+
next_action: `${planKey}/${taskId} is ${state.status}; only unfinished tasks are declared (see \`lattice todo status --json\`).`,
|
|
3725
|
+
});
|
|
3726
|
+
}
|
|
3727
|
+
const recorded = await readTodoWitnessSet({ repoRoot, planKey }).catch(() => null);
|
|
3728
|
+
const template = await witnessDraftTemplateFor({ repoRoot, planKey });
|
|
3729
|
+
const keep = new Set([...Object.keys(recorded?.plan_key === planKey ? recorded.manual_witness : {}), taskId]);
|
|
3730
|
+
const list = (value) => (typeof value === 'string' ? value.split(',').map((item) => item.trim()).filter(Boolean) : []);
|
|
3731
|
+
const row = { owns: list(flags.owns), reads: list(flags.reads), writes: list(flags.writes) };
|
|
3732
|
+
const draft = { ...template, tasks: Object.fromEntries(Object.entries(template.tasks)
|
|
3733
|
+
.filter(([id]) => keep.has(id)).map(([id, task]) => [id, id === taskId ? row : task])) };
|
|
3734
|
+
if (!validateWitnessDraft(draft)) {
|
|
3735
|
+
const { valid: _valid, reason, path: at, ...keys } = explainWitnessDraft(draft);
|
|
3736
|
+
throw new TodoStoreError('WITNESS_DRAFT_INVALID', reason, undefined, {
|
|
3737
|
+
pointer: at, ...keys, next_action: witnessRoute(planKey) });
|
|
3738
|
+
}
|
|
3739
|
+
const scaffolded = await scaffoldWitnessDraft({ repoRoot, planKey, draft });
|
|
3740
|
+
const waitingFor = projectTodoStatus(await readTodoStore({ repoRoot }), TODO_STATUS_DISPATCH_ONLY).next_ready
|
|
3741
|
+
.filter((task) => task.plan_key === planKey && !keep.has(task.task_id))
|
|
3742
|
+
.map(({ task_id: id }) => id).sort();
|
|
3743
|
+
const compile = waitingFor.length === 0
|
|
3744
|
+
? await independenceCompile({ repoRoot, planKey, inputRef: scaffolded.witness_ref }) : null;
|
|
3745
|
+
const result = {
|
|
3746
|
+
schema: 'lattice.todo_witness_declare_result.v1', project_id: member.plan.project_id, plan_key: planKey,
|
|
3747
|
+
task_id: taskId, ...row, witness_ref: scaffolded.witness_ref,
|
|
3748
|
+
witness_set_digest: scaffolded.witness_set_digest, compiled: compile !== null, waiting_for: waitingFor,
|
|
3749
|
+
compile, result_digest: '',
|
|
3750
|
+
};
|
|
3751
|
+
result.result_digest = todoSelfDigest(result, 'result_digest');
|
|
3752
|
+
return result;
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3700
3755
|
/**
|
|
3701
3756
|
* 着地時に使うsurface名。提案が出すhash由来の仮名を、人が読む名前へ置き換える。
|
|
3702
3757
|
*
|
|
@@ -4395,7 +4450,7 @@ function writesTodoStore(argv) {
|
|
|
4395
4450
|
case 'migrate': return !argv.includes('--dry-run');
|
|
4396
4451
|
case 'snapshot': return argv.includes('--rebuild');
|
|
4397
4452
|
case 'independence': return second === 'compile' || second === 'mode'
|
|
4398
|
-
|| (second === 'witness' && ['migrate', 'scaffold'].includes(third) && !argv.includes('--template'));
|
|
4453
|
+
|| (second === 'witness' && ['migrate', 'scaffold', 'declare'].includes(third) && !argv.includes('--template'));
|
|
4399
4454
|
case 'structure': return ['compile', 'realize', 'finalize'].includes(second)
|
|
4400
4455
|
|| (second === 'input' && !argv.includes('--dry-run'));
|
|
4401
4456
|
case 'seam-proposal': return ['compile', 'apply', 'land'].includes(second);
|
|
@@ -4403,7 +4458,7 @@ function writesTodoStore(argv) {
|
|
|
4403
4458
|
case 'dependency': return ['connect', 'disconnect'].includes(second);
|
|
4404
4459
|
case 'phase': return second !== 'status';
|
|
4405
4460
|
case 'start': case 'retract': case 'block': case 'unblock': case 'retire': case 'done':
|
|
4406
|
-
case 'reopen': case 'split': case 'revise': case 'revise-phase': case 'revise-set':
|
|
4461
|
+
case 'reopen': case 'split': case 'revise': case 'revise-phase': case 'revise-set': case 'add':
|
|
4407
4462
|
return true;
|
|
4408
4463
|
default: return false;
|
|
4409
4464
|
}
|
|
@@ -4808,6 +4863,12 @@ export async function runTodoCli({ argv, cwd, stdout, stderr, env = process.env,
|
|
|
4808
4863
|
if (flags !== null && isTodoIdentifier(flags.plan)) {
|
|
4809
4864
|
action = (repoRoot) => witnessDraftTemplateFor({ repoRoot, planKey: flags.plan });
|
|
4810
4865
|
}
|
|
4866
|
+
} else if (argv[0] === 'independence' && argv[1] === 'witness' && argv[2] === 'declare') {
|
|
4867
|
+
const flags = matchFlagCommand(argv, ['independence', 'witness', 'declare'],
|
|
4868
|
+
TODO_FLAG_SPECS['independence witness declare']);
|
|
4869
|
+
if (flags !== null && isTodoIdentifier(flags.plan) && isTodoIdentifier(flags.task)) {
|
|
4870
|
+
action = (repoRoot) => witnessDeclare({ repoRoot, planKey: flags.plan, flags });
|
|
4871
|
+
}
|
|
4811
4872
|
} else if (argv[0] === 'independence' && argv[1] === 'witness' && argv[2] === 'scaffold') {
|
|
4812
4873
|
const flags = matchFlagCommand(argv, ['independence', 'witness', 'scaffold'],
|
|
4813
4874
|
TODO_FLAG_SPECS['independence witness scaffold']);
|
|
@@ -4905,9 +4966,10 @@ export async function runTodoCli({ argv, cwd, stdout, stderr, env = process.env,
|
|
|
4905
4966
|
if (flags !== null && isTodoIdentifier(flags.plan) && isAuthoringPathToken(flags.input)) {
|
|
4906
4967
|
action = (repoRoot) => revisePhase({ repoRoot, env, planKey: flags.plan, inputRef: flags.input });
|
|
4907
4968
|
}
|
|
4908
|
-
} else if (argv
|
|
4909
|
-
|
|
4910
|
-
|
|
4969
|
+
} else if (argv[0] === 'phase' && argv[1] === 'status' && readFlags(argv, ['phase', 'status']) !== null) {
|
|
4970
|
+
// a28: a read's --json is optional; its output is JSON either way.
|
|
4971
|
+
const flags = readFlags(argv, ['phase', 'status']);
|
|
4972
|
+
action = (repoRoot) => phaseStatus({ repoRoot, planKey: flags.plan });
|
|
4911
4973
|
} else if (argv[0] === 'phase' && argv[1] === 'review'
|
|
4912
4974
|
&& phaseReasonFlags(argv) !== null) {
|
|
4913
4975
|
const flags = phaseReasonFlags(argv);
|
|
@@ -31,6 +31,8 @@ export async function readTodoParallelCandidatesForStatus(options = {}) {
|
|
|
31
31
|
const candidates = [];
|
|
32
32
|
for (const member of store.members) {
|
|
33
33
|
const planKey = member.plan.plan_key;
|
|
34
|
+
// ADR 0160 §2: a plan that chose conversation gets no witness prompt (BellTeam 0.85.5 report).
|
|
35
|
+
if (member.coordination?.mode === 'conversation') continue;
|
|
34
36
|
const readyTaskIds = frontier.filter((task) => task.plan_key === planKey)
|
|
35
37
|
.map(({ task_id: taskId }) => taskId);
|
|
36
38
|
let artifact = null;
|