@aiwg/cli 2026.11.6 → 2026.11.7
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/dist/src/artifacts/browser-export.js +1 -0
- package/dist/src/artifacts/fortemi-core-query-adapter.js +2 -0
- package/dist/src/artifacts/index-builder.js +1 -0
- package/dist/src/artifacts/query-engine-discover-output.js +1 -0
- package/dist/src/artifacts/query-engine-discover.js +2 -2
- package/dist/src/artifacts/query-engine-scoring.js +7 -0
- package/dist/src/artifacts/template-output-kind.js +10 -0
- package/dist/src/artifacts/types.js +1 -1
- package/dist/src/cli/handlers/dataset.js +11 -2
- package/dist/src/cli/handlers/update.js +26 -12
- package/dist/src/cli/handlers/use.js +4 -3
- package/dist/src/cli/handlers/writing.js +7 -1
- package/dist/src/dataset/backend-selection.d.ts +3 -0
- package/dist/src/dataset/backend-selection.js +11 -0
- package/dist/src/dataset/contract-range.d.ts +7 -0
- package/dist/src/dataset/contract-range.js +55 -0
- package/dist/src/dataset/fortemi-execution-bridge.d.ts +2 -0
- package/dist/src/dataset/fortemi-execution-bridge.js +12 -1
- package/dist/src/dataset/index.d.ts +2 -0
- package/dist/src/dataset/index.js +2 -0
- package/dist/src/dataset/orchestration-service.d.ts +1 -1
- package/dist/src/dataset/orchestration-service.js +7 -8
- package/dist/src/dataset/orchestration-types.d.ts +2 -0
- package/dist/src/dataset/service-binding-checkpoints.d.ts +10 -0
- package/dist/src/dataset/service-binding-checkpoints.js +26 -0
- package/dist/src/dataset/service-binding-contract.d.ts +46 -0
- package/dist/src/dataset/service-binding-contract.js +25 -0
- package/dist/src/dataset/service-binding-registry.d.ts +12 -0
- package/dist/src/dataset/service-binding-registry.js +118 -0
- package/dist/src/extensions/manifest.js +23 -7
- package/dist/src/extensions/project-local-doctor.js +2 -1
- package/dist/src/extensions/project-quickref-discovery.js +11 -0
- package/dist/src/extensions/project-quickref.js +4 -7
- package/dist/src/mcp/tools/worker-invoke.mjs +6 -4
- package/dist/src/mcp/tools/worker-launch-ledger.mjs +33 -0
- package/dist/src/mcp/tools/worker-verify-deliver-schema.mjs +22 -6
- package/dist/src/mcp/tools/worker-verify-deliver.mjs +4 -6
- package/dist/src/providers/deployment-input-session.d.mts +2 -0
- package/dist/src/providers/deployment-input-session.mjs +38 -0
- package/dist/src/serve/worker-invocation-preparation.js +52 -33
- package/dist/src/serve/worker-invocation.js +4 -2
- package/dist/src/serve/worker-shell-prompt.d.mts +6 -0
- package/dist/src/serve/worker-shell-prompt.mjs +78 -0
- package/dist/src/writing/campaign-patterns.js +96 -0
- package/dist/src/writing/campaign-report.js +41 -0
- package/dist/src/writing/contextual-diagnostics.js +29 -5
- package/dist/src/writing/current-patterns.catalogue.json +87 -0
- package/dist/src/writing/current-patterns.js +99 -0
- package/dist/src/writing/prose-mask.js +80 -0
- package/dist/src/writing/structural-patterns.js +109 -0
- package/dist/src/writing/validation-campaign.js +19 -0
- package/dist/src/writing/validation-engine.js +17 -10
- package/dist/src/writing/validation-rules.js +4 -3
- package/package.json +1 -1
- package/schemas/dataset/service-binding.v1.schema.json +70 -0
- package/tools/agents/providers/base-models-platforms.mjs +87 -48
- package/tools/agents/providers/rule-deployment-corpus-inputs.mjs +19 -0
- package/tools/agents/providers/rule-deployment-input-session.mjs +40 -0
- package/tools/agents/providers/rule-deployment-prepare.mjs +15 -6
- package/tools/plugin/package-plugins.mjs +2 -0
- package/tools/ralph-external/lib/typed-stop-delivery.mjs +10 -1
- package/tools/ralph-external/lib/worker-delivery-guards.mjs +47 -1
- package/tools/ralph-external/lib/worker-run-directory-refusal.mjs +2 -1
- package/tools/ralph-external/lib/worker-verification-cli.mjs +1 -1
|
@@ -20,12 +20,19 @@ function destinationFor(deliverablePath, writableRoots) {
|
|
|
20
20
|
return destination;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export async function deliverTypedStop(input, { prepareRecord = prepareDeliveryRecord } = {}) {
|
|
23
|
+
export async function deliverTypedStop(input, { prepareRecord = prepareDeliveryRecord, recordedLaunches = () => 0 } = {}) {
|
|
24
24
|
const { projectDir = process.cwd(), ...request } = input;
|
|
25
25
|
const { typedStopDeliverySchema, invalidTypedStop } = await importImpl(import.meta.url, 'mcp/tools/worker-verify-deliver-schema.mjs');
|
|
26
26
|
const parsed = typedStopDeliverySchema.safeParse(request);
|
|
27
27
|
if (!parsed.success) throw invalidTypedStop(parsed.error.message);
|
|
28
28
|
const { deliverablePath, typedStop } = parsed.data;
|
|
29
|
+
const assertLaunchCount = () => {
|
|
30
|
+
const count = recordedLaunches();
|
|
31
|
+
if (typedStop.launch_count < count) throw Object.assign(new Error(
|
|
32
|
+
`TYPED_STOP_LAUNCH_MISMATCH: launch_count ${typedStop.launch_count} is below ${count} recorded worker-invoke launches. A typed stop can only be published before any worker launch in this session; after a launch, the conductor must retry the worker or publish a verified worker artifact.`),
|
|
33
|
+
{ code: 'TYPED_STOP_LAUNCH_MISMATCH' });
|
|
34
|
+
};
|
|
35
|
+
assertLaunchCount();
|
|
29
36
|
const { loadWorkerInputs } = await importImpl(import.meta.url, 'cli/handlers/models.js');
|
|
30
37
|
const inputs = await loadWorkerInputs({ cwd: projectDir, args: [], rawArgs: [],
|
|
31
38
|
frameworkRoot: fileURLToPath(new URL('../../../', import.meta.url)) });
|
|
@@ -33,9 +40,11 @@ export async function deliverTypedStop(input, { prepareRecord = prepareDeliveryR
|
|
|
33
40
|
const destination = destinationFor(deliverablePath, writableRoots);
|
|
34
41
|
const bytes = Buffer.from(JSON.stringify(Object.fromEntries(Object.entries(typedStop).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0))) + '\n');
|
|
35
42
|
const artifactDigest = `sha256:${createHash('sha256').update(bytes).digest('hex')}`;
|
|
43
|
+
assertLaunchCount();
|
|
36
44
|
const complete = await prepareRecord(projectDir, { kind: 'typed-stop', verifierId: 'typed-stop@1', artifactDigest, deliverablePath: destination });
|
|
37
45
|
// Recheck after signing, before the same-directory atomic rename.
|
|
38
46
|
destinationFor(destination, writableRoots);
|
|
47
|
+
assertLaunchCount();
|
|
39
48
|
const staging = mkdtempSync(join(dirname(destination), '.aiwg-deliver-'));
|
|
40
49
|
try {
|
|
41
50
|
const staged = join(staging, 'typed-stop');
|
|
@@ -34,6 +34,51 @@ export async function readDeliveryExit(runDir, inspect) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const probes = new Set(['test', '[', 'stat', 'ls', 'true', 'file', 'wc']);
|
|
37
|
+
const emptyPatterns = new Set(['', '.', '^', '$', '.*']);
|
|
38
|
+
const searchValueOptions = new Set(['-m', '--max-count', '-A', '--after-context', '-B', '--before-context', '-C', '--context',
|
|
39
|
+
'-g', '--glob', '--iglob', '-t', '--type', '-T', '--type-not', '--include', '--exclude', '--exclude-dir']);
|
|
40
|
+
|
|
41
|
+
function searchPatterns(args) {
|
|
42
|
+
const patterns = [];
|
|
43
|
+
const operands = [];
|
|
44
|
+
let options = true;
|
|
45
|
+
for (let i = 0; i < args.length; i++) {
|
|
46
|
+
const arg = args[i];
|
|
47
|
+
if (options && arg === '--') { options = false; continue; }
|
|
48
|
+
if (options && (arg === '-f' || arg === '--file' || /^-f.|^--file=/.test(arg))) return null;
|
|
49
|
+
if (options && (arg === '-e' || arg === '--regexp')) { patterns.push(args[++i]); continue; }
|
|
50
|
+
if (options && arg.startsWith('--regexp=')) { patterns.push(arg.slice(9)); continue; }
|
|
51
|
+
if (options && /^-[^-]*e/.test(arg)) { patterns.push(arg.slice(arg.indexOf('e') + 1) || args[++i]); continue; }
|
|
52
|
+
if (options && searchValueOptions.has(arg)) { i++; continue; }
|
|
53
|
+
if (options && arg.startsWith('-')) continue;
|
|
54
|
+
operands.push(arg);
|
|
55
|
+
}
|
|
56
|
+
return patterns.length ? patterns : operands.slice(0, 1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function knownEmptyCheck(command, args) {
|
|
60
|
+
if (command === 'grep' || command === 'rg') {
|
|
61
|
+
const patterns = searchPatterns(args);
|
|
62
|
+
return patterns?.length > 0 && patterns.every(pattern => typeof pattern === 'string' && emptyPatterns.has(pattern));
|
|
63
|
+
}
|
|
64
|
+
if (/^(?:py|python(?:\d+(?:\.\d+)*)?)$/.test(command)) {
|
|
65
|
+
return args.some((arg, i) => arg === '-mjson.tool' || arg === '-m' && args[i + 1] === 'json.tool');
|
|
66
|
+
}
|
|
67
|
+
if (command === 'node' || command === 'nodejs') {
|
|
68
|
+
for (const arg of args) {
|
|
69
|
+
// After the script operand or --, these spellings are script arguments.
|
|
70
|
+
if (arg === '--' || arg === '-' || !arg.startsWith('-')) return false;
|
|
71
|
+
if (arg === '-c' || arg === '--check') return true;
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (command === 'jq') {
|
|
76
|
+
const filter = args.find(arg => !arg.startsWith('-'));
|
|
77
|
+
const exitStatus = args.some(arg => arg === '--exit-status' || /^-[^-]*e/.test(arg));
|
|
78
|
+
return filter === 'empty' || filter === '.' && !exitStatus;
|
|
79
|
+
}
|
|
80
|
+
return command === 'wc'; // A direct wc invocation prints counts without comparing them.
|
|
81
|
+
}
|
|
37
82
|
// This is a narrow argv heuristic, not proof that a check asserts correctness.
|
|
38
83
|
// Probe binaries with only path/flag operands cannot qualify. Other checks
|
|
39
84
|
// must mention the artifact, its basename, or a containing directory in args.
|
|
@@ -41,6 +86,7 @@ export function isContentFreeCheck(check, artifactPath) {
|
|
|
41
86
|
const args = check.args ?? [];
|
|
42
87
|
let command = check.command;
|
|
43
88
|
try { command = realpathSync(command); } catch { /* The verifier refuses unavailable binaries. */ }
|
|
89
|
+
if ([basename(check.command), basename(command)].some(name => knownEmptyCheck(name, args))) return true;
|
|
44
90
|
const pathOrFlag = arg => arg.startsWith('-') || isAbsolute(arg) || arg === basename(artifactPath) || !/[;&|<>$`"'(){}]/.test(arg);
|
|
45
91
|
if ((probes.has(basename(check.command)) || probes.has(basename(command))) && args.every(pathOrFlag)) return true;
|
|
46
92
|
const references = [artifactPath, basename(artifactPath)];
|
|
@@ -84,7 +130,7 @@ export async function prepareWorkerDeliveryGuard({ worktreeRoot, artifactPath, f
|
|
|
84
130
|
refuse('ARTIFACT_CHANGED_AFTER_EXIT', 'artifact changed while checking exit evidence');
|
|
85
131
|
}
|
|
86
132
|
if (!checks.some(check => !isContentFreeCheck(check, pinned.realPath))) {
|
|
87
|
-
refuse('CHECKS_CONTENT_FREE', 'publication requires
|
|
133
|
+
refuse('CHECKS_CONTENT_FREE', 'publication requires at least one check beyond known content-free probes, referencing the artifact path, basename, or containing directory');
|
|
88
134
|
}
|
|
89
135
|
};
|
|
90
136
|
// Refuse before probing isolation, then repeat on the verifier's exact pin.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Format bounded, actionable diagnostics for a refused worker run directory.
|
|
2
2
|
export function workerRunDirectoryRefusal(entries) {
|
|
3
3
|
const reason = 'Worker run directory must be fresh, empty, private and owned';
|
|
4
|
-
|
|
4
|
+
// An empty but pre-created directory fails on mode or ownership; name the remedy (#2918 40b direct-01).
|
|
5
|
+
if (!entries.length) return `${reason}. Pass a run_dir path that does not exist yet (its parent may be missing); the launcher creates it with mode 0700, so do not pre-create it.`;
|
|
5
6
|
const names = entries.toSorted().slice(0, 5).map(name => JSON.stringify(name)).join(', ');
|
|
6
7
|
const remaining = entries.length > 5 ? ` (+${entries.length - 5} more)` : '';
|
|
7
8
|
return `${reason}. Unexpected entries: ${names}${remaining}. Keep the plan and other files outside the run dir, or pass a new run dir.`;
|
|
@@ -87,7 +87,7 @@ export function deliverVerifiedArtifact(result, { artifactPath, deliverablePath,
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export async function verifyWorkerRun(request, dependencies = {}) {
|
|
90
|
-
if (Object.hasOwn(request, 'typedStop')) return deliverTypedStop(request, { prepareRecord: dependencies.prepareRecord ?? prepareDeliveryRecord });
|
|
90
|
+
if (Object.hasOwn(request, 'typedStop')) return deliverTypedStop(request, { ...dependencies, prepareRecord: dependencies.prepareRecord ?? prepareDeliveryRecord });
|
|
91
91
|
try { return await verifyWorkerRunRequest(request, dependencies); }
|
|
92
92
|
catch (error) {
|
|
93
93
|
if (!(error instanceof WorkerDeliveryRefusal)) throw error;
|