yam-flow 2.5.1 → 2.6.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/CHANGELOG.md +25 -0
- package/COMMANDS.md +27 -1
- package/README.md +19 -1
- package/ROADMAP.md +38 -6
- package/dist/bin/yam.js +389 -6
- package/dist/lib/benchmark-promotion.d.ts +53 -0
- package/dist/lib/benchmark-promotion.js +204 -0
- package/dist/lib/design-production.d.ts +306 -0
- package/dist/lib/design-production.js +1341 -0
- package/dist/lib/external-updates.d.ts +23 -0
- package/dist/lib/external-updates.js +286 -30
- package/dist/lib/gate-result.d.ts +44 -0
- package/dist/lib/gate-result.js +219 -0
- package/dist/lib/trust-kernel.js +17 -1
- package/package.json +4 -2
- package/references/ueye.md +14 -0
- package/skills/ueye/SKILL.md +11 -0
- package/src/bin/yam.ts +394 -6
- package/src/lib/benchmark-promotion.ts +249 -0
- package/src/lib/design-production.ts +1441 -0
- package/src/lib/external-updates.ts +331 -28
- package/src/lib/gate-result.ts +223 -0
- package/src/lib/trust-kernel.ts +20 -1
- package/yam.manifest.json +2 -2
package/dist/bin/yam.js
CHANGED
|
@@ -10,8 +10,11 @@ import process from 'node:process';
|
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
11
|
import { TRUTH_STATUSES, buildLoopReport, buildMediaGenerationProof, buildMissionCompletionGate, buildMissionPatchEnvelope, buildMissionSubagentReceipt, buildRollbackHint, buildRuntimeBackendEvidence, buildStudyNote, buildUeyeDesignCompletionGate, buildUeyeVisualProvenance, buildUeyeRunReport, buildUeyeSurfaceContext, buildYamCompletionProof, detectDbSafetyText as detectTrustDbSafetyText, isTruthStatus } from '../lib/trust-kernel.js';
|
|
12
12
|
import { archiveUeyeRevision, inspectImageFile, upsertUeyeAsset, verifyUeyeAssetManifest, verifyUeyeRevisionHistory } from '../lib/ueye-artifacts.js';
|
|
13
|
+
import { addPlanReviewComment, closePlanReviewCanvas, createDesignRevisionState, createPlanReviewCanvas, finalizeDesignProductionPhase, readCanonicalDesignRevisionState, readPlanReviewSession, recordDesignRevisionRound, verifyFinalGalleryManifest, verifyDesignProductionPhaseReceipt, writeFinalGalleryManifest } from '../lib/design-production.js';
|
|
13
14
|
import { inspectSkillInstallation, installSkillSetTransactional, uninstallSkillSetSafely } from '../lib/skill-installation.js';
|
|
14
15
|
import { EXTERNAL_UPDATE_COMPONENTS, applyExternalUpdates, checkExternalUpdates } from '../lib/external-updates.js';
|
|
16
|
+
import { buildBoundedPromotionReport, parsePromotionSample } from '../lib/benchmark-promotion.js';
|
|
17
|
+
import { buildStrictGateResult, verifyStrictGateResult } from '../lib/gate-result.js';
|
|
15
18
|
import { BoundedInputError, GENERAL_STDIN_MAX_BYTES, HOOK_STDIN_MAX_BYTES, readBoundedStdinJson, readBoundedStdinText } from '../lib/bounded-input.js';
|
|
16
19
|
function errorMessage(error) {
|
|
17
20
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -143,6 +146,7 @@ Usage:
|
|
|
143
146
|
yam ueye report [--reference ref.png] [--actual screenshot.png] [--provider-context local] [--execution-surface in-app-browser] [--json]
|
|
144
147
|
yam ueye asset <add|verify> [options]
|
|
145
148
|
yam ueye revision <archive|verify> [options]
|
|
149
|
+
yam ueye production <canvas|revision|gallery|finalize|phase> [options]
|
|
146
150
|
yam media proof [--requested] [--attempted] [--output file] [--json]
|
|
147
151
|
yam runtime evidence [--backend terminal|in-app-browser|playwright|tmux|zellij] [--claim observed|started|stopped|cleanup-verified] [--json]
|
|
148
152
|
yam mission queue [--agent-id id] [--scope text] [--changed file] [--verification-hint text] [--json]
|
|
@@ -152,6 +156,7 @@ Usage:
|
|
|
152
156
|
yam update apply --component yam|scrapling|insane-search [--json]
|
|
153
157
|
yam update apply --all [--json]
|
|
154
158
|
yam benchmark report [--baseline n] [--current n] [--unit ms] [--target lower|higher] [--json]
|
|
159
|
+
yam benchmark report --candidate-digest sha256 --baseline-digest sha256 --sample seed:candidate:baseline --unit score --evidence-source text [--min-samples n] [--min-mean-delta n] [--min-win-rate n] [--json]
|
|
155
160
|
yam release report [--json]
|
|
156
161
|
yam safety [text...]
|
|
157
162
|
yam memory <init|add|list|summary|resolve> [dir] [options]
|
|
@@ -1306,6 +1311,7 @@ async function buildToolsDoctorReport(targetDir = process.cwd()) {
|
|
|
1306
1311
|
readinessRow('Supabase plugin', await pluginCacheHas('openai-curated/supabase') ? 'ready' : 'unknown', 'plugin cache only; no DB query performed'),
|
|
1307
1312
|
readinessRow('Vercel plugin', await pluginCacheHas('openai-curated/vercel') ? 'ready' : 'unknown', 'plugin cache only; no deployment/API call performed')
|
|
1308
1313
|
];
|
|
1314
|
+
const capabilityMatrix = buildCapabilityMatrix(rows, globalLiteHookHealth, globalStudyNoteHookHealth);
|
|
1309
1315
|
const riskNotes = [
|
|
1310
1316
|
...instructionSurfaces.issues.map((message) => ({ level: 'issue', reason: message })),
|
|
1311
1317
|
...instructionSurfaces.warnings.map((message) => ({ level: 'warning', reason: message })),
|
|
@@ -1332,6 +1338,7 @@ async function buildToolsDoctorReport(targetDir = process.cwd()) {
|
|
|
1332
1338
|
frameworkChecklist,
|
|
1333
1339
|
contextPressure,
|
|
1334
1340
|
realProbe,
|
|
1341
|
+
capabilityMatrix,
|
|
1335
1342
|
sqlScan,
|
|
1336
1343
|
riskNotes,
|
|
1337
1344
|
nextActions: nextActionDetails.map((action) => action.next_action),
|
|
@@ -1344,6 +1351,41 @@ async function buildToolsDoctorReport(targetDir = process.cwd()) {
|
|
|
1344
1351
|
}
|
|
1345
1352
|
};
|
|
1346
1353
|
}
|
|
1354
|
+
function buildCapabilityMatrix(readinessRows = [], liteHook = {}, studyNoteHook = {}) {
|
|
1355
|
+
const readiness = new Map(readinessRows.map((row) => [row.name, row.status]));
|
|
1356
|
+
const capabilities = [
|
|
1357
|
+
capabilityRow('skill_installation', 'stable', readiness.get('Yam skills') || 'unknown', 'yam status plus the transactional installation receipt', 'proves managed skill bytes only; it does not prove a route ran'),
|
|
1358
|
+
capabilityRow('external_update_check', 'stable', 'unknown', 'packaged `yam update check` command', 'this inventory does not contact registries or prove Codex/plugin/network availability'),
|
|
1359
|
+
capabilityRow('external_update_apply', 'beta', 'unknown', 'transactional component updater with rollback receipts', 'runtime readiness is checked only during an explicit run; effective yam identity currently supports POSIX symlinks while Windows npm .cmd shims fail closed as unverified'),
|
|
1360
|
+
capabilityRow('mission_receipt_gate', 'stable', 'ready', 'packaged mission receipt and aggregate gate commands', 'validates supplied real-thread evidence; it does not spawn agents'),
|
|
1361
|
+
capabilityRow('mission_real_subagents', 'instruction-only', 'unknown', 'Mission skill delegates through environment-owned subagent tools', 'CLI cannot prove host slot availability or a real thread outcome'),
|
|
1362
|
+
capabilityRow('ueye_asset_revision_integrity', 'stable', 'ready', 'hash-verified Ueye asset and revision manifests', 'integrity does not prove design quality, licensing, or browser state'),
|
|
1363
|
+
capabilityRow('plan_review_canvas_lite', 'beta', 'ready', 'local static review session artifacts', 'no remote hosting, background service, or automatic implementation start'),
|
|
1364
|
+
capabilityRow('bounded_design_revisions', 'beta', 'ready', 'maximum two reviewer-finding-backed revision rounds', 'round state does not replace Ueye artifact hash verification'),
|
|
1365
|
+
capabilityRow('final_gallery_manifest', 'beta', 'ready', 'path-confined hash-verified packaging manifest', 'gallery completeness does not prove visual or license correctness'),
|
|
1366
|
+
capabilityRow('demand_gated_design_production', 'beta', 'ready', 'pre-recorded operator trigger, Canvas, chronological bounded revisions, gallery, and digest-verifiable phase receipt', 'demand evidence is operator-asserted and overall phase truth remains partial'),
|
|
1367
|
+
capabilityRow('yam_lite_hook', 'beta', String(liteHook.state || readiness.get('yam-lite hook') || 'unknown'), 'optional hook health inspection', 'advisory only; disabled unless explicitly enabled'),
|
|
1368
|
+
capabilityRow('study_note_hook', 'beta', String(studyNoteHook.state || readiness.get('yam-study-note hook') || 'unknown'), 'optional prompt and bounded Stop check', 'does not generate the Study Note or run verification')
|
|
1369
|
+
];
|
|
1370
|
+
return {
|
|
1371
|
+
schema: 'yam.capability-matrix.v1',
|
|
1372
|
+
generated_at: new Date().toISOString(),
|
|
1373
|
+
capabilities,
|
|
1374
|
+
maturity_vocabulary: ['stable', 'beta', 'experimental', 'instruction-only'],
|
|
1375
|
+
truth_status: 'partial',
|
|
1376
|
+
note: 'support maturity and current runtime state are separate; this read-only inventory does not execute capabilities'
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
function capabilityRow(id, maturity, runtimeState, evidence, limit) {
|
|
1380
|
+
return {
|
|
1381
|
+
id,
|
|
1382
|
+
maturity,
|
|
1383
|
+
runtime_state: runtimeState,
|
|
1384
|
+
evidence,
|
|
1385
|
+
limit,
|
|
1386
|
+
truth_status: runtimeState === 'ready' ? 'partial' : 'assumed'
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1347
1389
|
function printToolsDoctorReport(data) {
|
|
1348
1390
|
console.log('yam tools doctor');
|
|
1349
1391
|
console.log(`Project: ${data.project}`);
|
|
@@ -1359,6 +1401,13 @@ function printToolsDoctorReport(data) {
|
|
|
1359
1401
|
console.log(`- ${key}: ${value || '(not found)'}`);
|
|
1360
1402
|
}
|
|
1361
1403
|
}
|
|
1404
|
+
if (data.capabilityMatrix?.capabilities?.length) {
|
|
1405
|
+
console.log('');
|
|
1406
|
+
console.log('Capability matrix:');
|
|
1407
|
+
for (const capability of data.capabilityMatrix.capabilities) {
|
|
1408
|
+
console.log(`- ${capability.id}: ${capability.maturity} / ${capability.runtime_state} (${capability.limit})`);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1362
1411
|
if (data.instructionSurfaces.found.length || data.projectSurfaces.length) {
|
|
1363
1412
|
console.log('');
|
|
1364
1413
|
console.log('Project surfaces:');
|
|
@@ -2258,8 +2307,35 @@ function runReleaseReport() {
|
|
|
2258
2307
|
const publishBlockerEvidence = publishBlockerEvidenceFromRelease(checks, tarball);
|
|
2259
2308
|
const publishReadiness = releasePublishReadiness(checks, provenance, tarball, publishBlockerEvidence);
|
|
2260
2309
|
const nextActions = releaseNextActions(checks, provenance, tarball, publishBlockerEvidence, publishReadiness);
|
|
2261
|
-
const
|
|
2262
|
-
const readinessReceipt = releaseReadinessReceipt(provenance, freshness, tarball, publishReadiness,
|
|
2310
|
+
const preliminaryOk = failed.length === 0 && publishReadiness.status === 'ready';
|
|
2311
|
+
const readinessReceipt = releaseReadinessReceipt(provenance, freshness, tarball, publishReadiness, preliminaryOk);
|
|
2312
|
+
const gateResult = buildStrictGateResult({
|
|
2313
|
+
gate_id: 'release-readiness',
|
|
2314
|
+
boundary: 'release',
|
|
2315
|
+
checks: [
|
|
2316
|
+
...checks.map((check) => ({
|
|
2317
|
+
id: `release-${String(check.id || 'unnamed').replace(/[^a-z0-9._-]/gi, '-')}`,
|
|
2318
|
+
status: check.status === 'passed' ? 'passed' : 'failed',
|
|
2319
|
+
note: check.note || check.command || check.id,
|
|
2320
|
+
required: true
|
|
2321
|
+
})),
|
|
2322
|
+
{
|
|
2323
|
+
id: 'publish-readiness',
|
|
2324
|
+
status: publishReadiness.status === 'ready' ? 'passed' : 'failed',
|
|
2325
|
+
note: publishReadiness.next_action,
|
|
2326
|
+
required: true
|
|
2327
|
+
}
|
|
2328
|
+
],
|
|
2329
|
+
blockers: publishReadiness.blockers?.map((blocker) => `${blocker.kind}: ${blocker.reason}`) || [],
|
|
2330
|
+
evidence: [
|
|
2331
|
+
`${readinessReceipt.schema}:${readinessReceipt.local_version}`,
|
|
2332
|
+
tarball.integrity ? `tarball-integrity:${tarball.integrity}` : 'tarball-integrity:not-observed',
|
|
2333
|
+
provenance.git_commit ? `git-commit:${provenance.git_commit}` : 'git-commit:not-observed'
|
|
2334
|
+
],
|
|
2335
|
+
next_action: publishReadiness.next_action
|
|
2336
|
+
});
|
|
2337
|
+
const gateContract = verifyStrictGateResult(gateResult);
|
|
2338
|
+
const ok = preliminaryOk && gateResult.status === 'passed' && gateContract.valid;
|
|
2263
2339
|
return {
|
|
2264
2340
|
schema: 'yam.release-report.v1',
|
|
2265
2341
|
generated_at: startedAt,
|
|
@@ -2274,6 +2350,8 @@ function runReleaseReport() {
|
|
|
2274
2350
|
freshness,
|
|
2275
2351
|
publish_readiness: publishReadiness,
|
|
2276
2352
|
readiness_receipt: readinessReceipt,
|
|
2353
|
+
gate_result: gateResult,
|
|
2354
|
+
gate_contract: gateContract,
|
|
2277
2355
|
study_note: releaseStudyNote(publishReadiness, publishBlockerEvidence),
|
|
2278
2356
|
publishBlockerEvidence,
|
|
2279
2357
|
next_actions: nextActions
|
|
@@ -2767,6 +2845,8 @@ async function ueye(args = []) {
|
|
|
2767
2845
|
return ueyeAsset(args.slice(1));
|
|
2768
2846
|
if (subcommand === 'revision')
|
|
2769
2847
|
return ueyeRevision(args.slice(1));
|
|
2848
|
+
if (subcommand === 'production')
|
|
2849
|
+
return ueyeProduction(args.slice(1));
|
|
2770
2850
|
console.error(`unknown ueye command: ${subcommand}`);
|
|
2771
2851
|
return ueyeUsage();
|
|
2772
2852
|
}
|
|
@@ -2784,6 +2864,11 @@ Usage:
|
|
|
2784
2864
|
yam ueye asset verify [--manifest file] [--json]
|
|
2785
2865
|
yam ueye revision archive --file image --round n [--artifact-id id] [--root dir] [--manifest file] [--json]
|
|
2786
2866
|
yam ueye revision verify [--root dir] [--manifest file] [--json]
|
|
2867
|
+
yam ueye production canvas <create|comment|close|show> [options]
|
|
2868
|
+
yam ueye production revision <init|record|show> [options]
|
|
2869
|
+
yam ueye production gallery <write|verify> [options]
|
|
2870
|
+
yam ueye production finalize [options]
|
|
2871
|
+
yam ueye production phase verify [options]
|
|
2787
2872
|
|
|
2788
2873
|
Notes:
|
|
2789
2874
|
capture uses a locally available Playwright install when present. It does not download browsers or install dependencies.
|
|
@@ -2791,6 +2876,7 @@ Notes:
|
|
|
2791
2876
|
report produces a proof-ready Ueye visual run report, design completion gate, and continuity/comparison record without requiring a new capture.
|
|
2792
2877
|
asset records local reference provenance and protection flags; it never downloads remote content.
|
|
2793
2878
|
revision copies the current local artifact into a non-overwriting round archive before the live file is edited.
|
|
2879
|
+
production is demand-gated: it writes local-only review artifacts, permits at most two finding-backed revision rounds, and keeps gallery correctness claims explicitly unverified.
|
|
2794
2880
|
`);
|
|
2795
2881
|
}
|
|
2796
2882
|
async function ueyeAsset(args = []) {
|
|
@@ -2870,6 +2956,212 @@ async function ueyeRevision(args = []) {
|
|
|
2870
2956
|
process.exitCode = 1;
|
|
2871
2957
|
}
|
|
2872
2958
|
}
|
|
2959
|
+
async function ueyeProduction(args = []) {
|
|
2960
|
+
const surface = String(args[0] || 'help');
|
|
2961
|
+
const isFinalize = surface === 'finalize';
|
|
2962
|
+
const action = isFinalize ? 'run' : String(args[1] || 'help');
|
|
2963
|
+
const flagArgs = isFinalize ? args.slice(1) : args.slice(2);
|
|
2964
|
+
if (surface === 'help' || action === 'help' || surface === '--help' || surface === '-h' || flagArgs.includes('--help') || flagArgs.includes('-h'))
|
|
2965
|
+
return ueyeProductionUsage();
|
|
2966
|
+
const flags = parseSimpleFlags(flagArgs, new Set([
|
|
2967
|
+
'root', 'session-id', 'title', 'artifact-spec', 'session-path', 'render-path',
|
|
2968
|
+
'comment-id', 'artifact-id', 'anchor-kind', 'locator', 'finding', 'requested-change', 'verdict',
|
|
2969
|
+
'state-path', 'finding-id', 'source-comment-id', 'finding-summary', 'finding-evidence', 'planned-change', 'outcome', 'revision-ref',
|
|
2970
|
+
'manifest-path', 'completion-state', 'demand-kind', 'demand-evidence', 'canvas-session-path',
|
|
2971
|
+
'revision-state-path', 'gallery-manifest-path', 'receipt-path', 'json'
|
|
2972
|
+
]));
|
|
2973
|
+
const root = path.resolve(expandHome(flags.root || process.cwd()));
|
|
2974
|
+
try {
|
|
2975
|
+
let result;
|
|
2976
|
+
if (surface === 'canvas' && action === 'create') {
|
|
2977
|
+
requireProductionFlags(flags, ['session_id', 'title', 'demand_kind', 'demand_evidence', 'artifact_spec']);
|
|
2978
|
+
result = await createPlanReviewCanvas({
|
|
2979
|
+
root,
|
|
2980
|
+
session_id: String(flags.session_id),
|
|
2981
|
+
title: String(flags.title),
|
|
2982
|
+
demand_trigger: {
|
|
2983
|
+
kind: String(flags.demand_kind),
|
|
2984
|
+
evidence: String(flags.demand_evidence)
|
|
2985
|
+
},
|
|
2986
|
+
artifacts: await readProductionSpecs(flags.artifact_spec, 'canvas artifact spec'),
|
|
2987
|
+
...(flags.session_path ? { session_path: String(flags.session_path) } : {}),
|
|
2988
|
+
...(flags.render_path ? { render_path: String(flags.render_path) } : {})
|
|
2989
|
+
});
|
|
2990
|
+
}
|
|
2991
|
+
else if (surface === 'canvas' && action === 'comment') {
|
|
2992
|
+
requireProductionFlags(flags, ['session_path', 'render_path', 'comment_id', 'artifact_id', 'anchor_kind', 'locator', 'finding', 'requested_change']);
|
|
2993
|
+
result = await addPlanReviewComment({
|
|
2994
|
+
root,
|
|
2995
|
+
session_path: String(flags.session_path),
|
|
2996
|
+
render_path: String(flags.render_path),
|
|
2997
|
+
comment: {
|
|
2998
|
+
id: String(flags.comment_id),
|
|
2999
|
+
anchor: {
|
|
3000
|
+
artifact_id: String(flags.artifact_id),
|
|
3001
|
+
kind: String(flags.anchor_kind),
|
|
3002
|
+
locator: String(flags.locator)
|
|
3003
|
+
},
|
|
3004
|
+
finding: String(flags.finding),
|
|
3005
|
+
requested_change: String(flags.requested_change)
|
|
3006
|
+
}
|
|
3007
|
+
});
|
|
3008
|
+
}
|
|
3009
|
+
else if (surface === 'canvas' && action === 'close') {
|
|
3010
|
+
requireProductionFlags(flags, ['session_path', 'render_path', 'verdict']);
|
|
3011
|
+
result = await closePlanReviewCanvas({
|
|
3012
|
+
root,
|
|
3013
|
+
session_path: String(flags.session_path),
|
|
3014
|
+
render_path: String(flags.render_path),
|
|
3015
|
+
verdict: String(flags.verdict)
|
|
3016
|
+
});
|
|
3017
|
+
}
|
|
3018
|
+
else if (surface === 'canvas' && action === 'show') {
|
|
3019
|
+
requireProductionFlags(flags, ['session_path']);
|
|
3020
|
+
const sessionPath = await existingProductionPath(root, String(flags.session_path), 'session_path');
|
|
3021
|
+
result = await readPlanReviewSession(sessionPath);
|
|
3022
|
+
}
|
|
3023
|
+
else if (surface === 'revision' && action === 'init') {
|
|
3024
|
+
requireProductionFlags(flags, ['session_id']);
|
|
3025
|
+
result = await createDesignRevisionState({
|
|
3026
|
+
root,
|
|
3027
|
+
session_id: String(flags.session_id),
|
|
3028
|
+
...(flags.state_path ? { state_path: String(flags.state_path) } : {})
|
|
3029
|
+
});
|
|
3030
|
+
}
|
|
3031
|
+
else if (surface === 'revision' && action === 'record') {
|
|
3032
|
+
requireProductionFlags(flags, ['state_path', 'finding_id', 'source_comment_id', 'finding_summary', 'finding_evidence', 'planned_change', 'outcome', 'revision_ref']);
|
|
3033
|
+
result = await recordDesignRevisionRound({
|
|
3034
|
+
root,
|
|
3035
|
+
state_path: String(flags.state_path),
|
|
3036
|
+
reviewer_finding: {
|
|
3037
|
+
id: String(flags.finding_id),
|
|
3038
|
+
source_comment_id: String(flags.source_comment_id),
|
|
3039
|
+
summary: String(flags.finding_summary),
|
|
3040
|
+
evidence: String(flags.finding_evidence)
|
|
3041
|
+
},
|
|
3042
|
+
planned_change: String(flags.planned_change),
|
|
3043
|
+
outcome: String(flags.outcome),
|
|
3044
|
+
revision_refs: await readProductionSpecs(flags.revision_ref, 'Ueye revision reference')
|
|
3045
|
+
});
|
|
3046
|
+
}
|
|
3047
|
+
else if (surface === 'revision' && action === 'show') {
|
|
3048
|
+
requireProductionFlags(flags, ['state_path']);
|
|
3049
|
+
result = await readCanonicalDesignRevisionState({ root, state_path: String(flags.state_path) });
|
|
3050
|
+
}
|
|
3051
|
+
else if (surface === 'gallery' && action === 'write') {
|
|
3052
|
+
requireProductionFlags(flags, ['manifest_path', 'session_id', 'completion_state', 'artifact_spec']);
|
|
3053
|
+
result = await writeFinalGalleryManifest({
|
|
3054
|
+
root,
|
|
3055
|
+
manifest_path: String(flags.manifest_path),
|
|
3056
|
+
session_id: String(flags.session_id),
|
|
3057
|
+
completion_state: String(flags.completion_state),
|
|
3058
|
+
artifacts: await readProductionSpecs(flags.artifact_spec, 'gallery artifact spec')
|
|
3059
|
+
});
|
|
3060
|
+
}
|
|
3061
|
+
else if (surface === 'gallery' && action === 'verify') {
|
|
3062
|
+
requireProductionFlags(flags, ['manifest_path']);
|
|
3063
|
+
result = await verifyFinalGalleryManifest({ root, manifest_path: String(flags.manifest_path) });
|
|
3064
|
+
}
|
|
3065
|
+
else if (surface === 'finalize' && action === 'run') {
|
|
3066
|
+
requireProductionFlags(flags, ['demand_kind', 'demand_evidence', 'canvas_session_path', 'gallery_manifest_path', 'receipt_path']);
|
|
3067
|
+
result = await finalizeDesignProductionPhase({
|
|
3068
|
+
root,
|
|
3069
|
+
demand_trigger: {
|
|
3070
|
+
kind: String(flags.demand_kind),
|
|
3071
|
+
evidence: String(flags.demand_evidence)
|
|
3072
|
+
},
|
|
3073
|
+
canvas_session_path: String(flags.canvas_session_path),
|
|
3074
|
+
revision_state_path: flags.revision_state_path ? String(flags.revision_state_path) : null,
|
|
3075
|
+
gallery_manifest_path: String(flags.gallery_manifest_path),
|
|
3076
|
+
receipt_path: String(flags.receipt_path)
|
|
3077
|
+
});
|
|
3078
|
+
}
|
|
3079
|
+
else if (surface === 'phase' && action === 'verify') {
|
|
3080
|
+
requireProductionFlags(flags, ['receipt_path']);
|
|
3081
|
+
result = await verifyDesignProductionPhaseReceipt({ root, receipt_path: String(flags.receipt_path) });
|
|
3082
|
+
}
|
|
3083
|
+
else {
|
|
3084
|
+
throw new Error(`unknown Ueye production command: ${surface} ${action}`);
|
|
3085
|
+
}
|
|
3086
|
+
printJsonOrHuman(result, Boolean(flags.json), 'Ueye design production');
|
|
3087
|
+
if (result.truth_status === 'blocked')
|
|
3088
|
+
process.exitCode = 1;
|
|
3089
|
+
}
|
|
3090
|
+
catch (error) {
|
|
3091
|
+
const reason = summarizeCheckOutput(errorMessage(error));
|
|
3092
|
+
const result = {
|
|
3093
|
+
schema: 'yam.design-production-error.v1',
|
|
3094
|
+
surface,
|
|
3095
|
+
action,
|
|
3096
|
+
status: 'blocked',
|
|
3097
|
+
reason,
|
|
3098
|
+
next_action: /two_round_limit|maximum (?:is )?2|maximum two/i.test(reason)
|
|
3099
|
+
? 'stop this phase at two rounds and keep unresolved gallery work draft; start a new phase only after new explicit demand authorization'
|
|
3100
|
+
: /stopped with status accepted/i.test(reason)
|
|
3101
|
+
? 'stop revising because the reviewer already accepted this phase'
|
|
3102
|
+
: 'repair the local spec, path, integrity evidence, or phase state before retrying',
|
|
3103
|
+
truth_status: 'blocked'
|
|
3104
|
+
};
|
|
3105
|
+
printJsonOrHuman(result, Boolean(flags.json), 'Ueye design production');
|
|
3106
|
+
process.exitCode = 1;
|
|
3107
|
+
}
|
|
3108
|
+
}
|
|
3109
|
+
function ueyeProductionUsage() {
|
|
3110
|
+
console.log(`yam ueye production
|
|
3111
|
+
|
|
3112
|
+
Demand-gated local design production helpers. Spec files are bounded JSON objects; repeat --artifact-spec or --revision-ref for multiple entries.
|
|
3113
|
+
|
|
3114
|
+
Usage:
|
|
3115
|
+
yam ueye production canvas create [--root dir] --session-id id --title text --demand-kind repeated_plan_review|multi_asset_production --demand-evidence text --artifact-spec file [--json]
|
|
3116
|
+
yam ueye production canvas comment [--root dir] --session-path relative --render-path relative --comment-id id --artifact-id id --anchor-kind line|region|text --locator text --finding text --requested-change text [--json]
|
|
3117
|
+
yam ueye production canvas close [--root dir] --session-path relative --render-path relative --verdict approve|request_changes [--json]
|
|
3118
|
+
yam ueye production canvas show [--root dir] --session-path relative [--json]
|
|
3119
|
+
yam ueye production revision init [--root dir] --session-id id [--state-path .yam/ueye/design-production/<session-id>/revision-state.json] [--json]
|
|
3120
|
+
yam ueye production revision record [--root dir] --state-path relative --finding-id id --source-comment-id id --finding-summary text --finding-evidence text --planned-change text --outcome accepted|changes_requested --revision-ref file [--json]
|
|
3121
|
+
yam ueye production revision show [--root dir] --state-path relative [--json]
|
|
3122
|
+
yam ueye production gallery write [--root dir] --manifest-path relative --session-id id --completion-state draft|ready_for_inspection|packaged --artifact-spec file [--json]
|
|
3123
|
+
yam ueye production gallery verify [--root dir] --manifest-path relative [--json]
|
|
3124
|
+
yam ueye production finalize [--root dir] --demand-kind repeated_plan_review|multi_asset_production --demand-evidence text --canvas-session-path relative [--revision-state-path relative] --gallery-manifest-path relative --receipt-path relative [--json]
|
|
3125
|
+
yam ueye production phase verify [--root dir] --receipt-path relative [--json]
|
|
3126
|
+
|
|
3127
|
+
Use this phase only when repeated plan review or large multi-asset production creates real coordination demand. Canvas artifacts stay static and local. Revision init requires the session's closed request_changes Canvas and fixes state to .yam/ueye/design-production/<session-id>/revision-state.json; --state-path is accepted only when it names that exact path. Record/show/finalize reject alternate state files. Gallery verification covers paths, hashes, dimensions, and revision references only. Finalize binds the explicit demand evidence, closed Canvas, terminal revision state when needed, and verified gallery into one immutable receipt.
|
|
3128
|
+
`);
|
|
3129
|
+
}
|
|
3130
|
+
function requireProductionFlags(flags, names) {
|
|
3131
|
+
const missing = names.filter((name) => flags[name] === undefined || flags[name] === '');
|
|
3132
|
+
if (missing.length)
|
|
3133
|
+
throw new Error(`missing required option(s): ${missing.map((name) => `--${name.replace(/_/g, '-')}`).join(', ')}`);
|
|
3134
|
+
}
|
|
3135
|
+
async function readProductionSpecs(value, label) {
|
|
3136
|
+
const files = arrayFlag(value);
|
|
3137
|
+
if (!files.length)
|
|
3138
|
+
throw new Error(`${label} requires at least one JSON spec file`);
|
|
3139
|
+
const specs = [];
|
|
3140
|
+
for (const file of files)
|
|
3141
|
+
specs.push(await readBoundedJsonSpec(path.resolve(expandHome(file)), label));
|
|
3142
|
+
return specs;
|
|
3143
|
+
}
|
|
3144
|
+
async function readBoundedJsonSpec(file, label) {
|
|
3145
|
+
const stat = await fsp.stat(file);
|
|
3146
|
+
if (!stat.isFile())
|
|
3147
|
+
throw new Error(`${label} must be a regular file: ${file}`);
|
|
3148
|
+
if (stat.size > 256 * 1024)
|
|
3149
|
+
throw new Error(`${label} exceeds the 256 KiB limit: ${file}`);
|
|
3150
|
+
const value = JSON.parse(await fsp.readFile(file, 'utf8'));
|
|
3151
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
3152
|
+
throw new Error(`${label} must contain one JSON object: ${file}`);
|
|
3153
|
+
return value;
|
|
3154
|
+
}
|
|
3155
|
+
async function existingProductionPath(root, value, label) {
|
|
3156
|
+
if (!value || path.isAbsolute(value) || value.includes('\0'))
|
|
3157
|
+
throw new Error(`${label} must be a non-empty project-relative path`);
|
|
3158
|
+
const realRoot = await fsp.realpath(root);
|
|
3159
|
+
const candidate = await fsp.realpath(path.resolve(realRoot, value));
|
|
3160
|
+
const relative = path.relative(realRoot, candidate);
|
|
3161
|
+
if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
|
|
3162
|
+
throw new Error(`${label} escapes the project root`);
|
|
3163
|
+
return candidate;
|
|
3164
|
+
}
|
|
2873
3165
|
async function ueyePreflight(args = []) {
|
|
2874
3166
|
if (args[0] === 'help' || args[0] === '--help' || args[0] === '-h')
|
|
2875
3167
|
return ueyeUsage();
|
|
@@ -3704,12 +3996,37 @@ async function missionGate(args = []) {
|
|
|
3704
3996
|
receipts
|
|
3705
3997
|
});
|
|
3706
3998
|
const blockers = [...gate.blockers, ...loadErrors.map((error) => `receipt_load_failed: ${error}`)];
|
|
3999
|
+
const gateResult = buildStrictGateResult({
|
|
4000
|
+
gate_id: 'mission-completion',
|
|
4001
|
+
boundary: 'mission',
|
|
4002
|
+
checks: [
|
|
4003
|
+
{
|
|
4004
|
+
id: 'receipt-inventory',
|
|
4005
|
+
status: gate.ready_to_claim_complete && loadErrors.length === 0 ? 'passed' : 'failed',
|
|
4006
|
+
note: blockers[0] || 'all expected Mission receipts are present and eligible',
|
|
4007
|
+
required: true
|
|
4008
|
+
},
|
|
4009
|
+
{
|
|
4010
|
+
id: 'read-only-boundary',
|
|
4011
|
+
status: gate.read_only_violations.length === 0 ? 'passed' : 'failed',
|
|
4012
|
+
note: gate.read_only_violations.length ? `violations: ${gate.read_only_violations.join(', ')}` : 'reviewer and doctor receipts preserve read-only access',
|
|
4013
|
+
required: true
|
|
4014
|
+
}
|
|
4015
|
+
],
|
|
4016
|
+
blockers,
|
|
4017
|
+
evidence: gate.receipts.map((receipt) => `${receipt.thread_id}:${receipt.receipt_id}:${receipt.outcome}`),
|
|
4018
|
+
next_action: blockers[0] || gate.next_action
|
|
4019
|
+
});
|
|
4020
|
+
const gateContract = verifyStrictGateResult(gateResult);
|
|
4021
|
+
const strictReady = gate.ready_to_claim_complete && loadErrors.length === 0 && gateResult.status === 'passed' && gateContract.valid;
|
|
3707
4022
|
const result = {
|
|
3708
4023
|
...gate,
|
|
3709
4024
|
blockers,
|
|
3710
|
-
ready_to_claim_complete:
|
|
4025
|
+
ready_to_claim_complete: strictReady,
|
|
3711
4026
|
next_action: blockers[0] || gate.next_action,
|
|
3712
|
-
truth_status:
|
|
4027
|
+
truth_status: strictReady ? gate.truth_status : 'blocked',
|
|
4028
|
+
gate_result: gateResult,
|
|
4029
|
+
gate_contract: gateContract,
|
|
3713
4030
|
persistence: flags.out ? 'written' : 'not-persisted',
|
|
3714
4031
|
out: flags.out ? path.resolve(expandHome(flags.out)) : ''
|
|
3715
4032
|
};
|
|
@@ -3802,15 +4119,72 @@ function benchmarkUsage() {
|
|
|
3802
4119
|
|
|
3803
4120
|
Usage:
|
|
3804
4121
|
yam benchmark report [--label text] [--baseline n] [--current n] [--unit ms] [--target lower|higher] [--next-action text] [--json]
|
|
4122
|
+
yam benchmark report --candidate-digest sha256 --baseline-digest sha256 --sample seed:candidate:baseline --unit score --evidence-source text [--sample ...] [--min-samples n] [--min-mean-delta n] [--min-win-rate n] [--json]
|
|
3805
4123
|
|
|
3806
4124
|
Notes:
|
|
3807
4125
|
Records a small optimization loop result. It does not run benchmarks by itself.
|
|
4126
|
+
Promotion mode verifies deterministic paired-sample arithmetic but treats supplied scores as operator assertions, not statistical significance.
|
|
3808
4127
|
`);
|
|
3809
4128
|
}
|
|
3810
4129
|
async function benchmarkReport(args = []) {
|
|
3811
4130
|
if (args[0] === 'help' || args[0] === '--help' || args[0] === '-h')
|
|
3812
4131
|
return benchmarkUsage();
|
|
3813
|
-
const flags = parseSimpleFlags(args, new Set(['label', 'baseline', 'current', 'unit', 'target', 'next-action', 'rollback-hint', 'intent', 'json']));
|
|
4132
|
+
const flags = parseSimpleFlags(args, new Set(['label', 'baseline', 'current', 'unit', 'target', 'next-action', 'rollback-hint', 'intent', 'candidate-digest', 'baseline-digest', 'sample', 'min-samples', 'min-mean-delta', 'min-win-rate', 'evidence-source', 'json']));
|
|
4133
|
+
const promotionRequested = Boolean(flags.candidate_digest
|
|
4134
|
+
|| flags.baseline_digest
|
|
4135
|
+
|| flags.sample
|
|
4136
|
+
|| flags.min_samples
|
|
4137
|
+
|| flags.min_mean_delta
|
|
4138
|
+
|| flags.min_win_rate
|
|
4139
|
+
|| flags.evidence_source);
|
|
4140
|
+
if (promotionRequested) {
|
|
4141
|
+
try {
|
|
4142
|
+
const promotion = buildBoundedPromotionReport({
|
|
4143
|
+
label: String(flags.label || 'unnamed'),
|
|
4144
|
+
candidate_digest: String(flags.candidate_digest || ''),
|
|
4145
|
+
baseline_digest: String(flags.baseline_digest || ''),
|
|
4146
|
+
samples: arrayFlag(flags.sample).map((sample) => parsePromotionSample(sample)),
|
|
4147
|
+
min_samples: flags.min_samples === undefined ? undefined : Number(flags.min_samples),
|
|
4148
|
+
min_mean_delta: flags.min_mean_delta === undefined ? undefined : Number(flags.min_mean_delta),
|
|
4149
|
+
min_win_rate: flags.min_win_rate === undefined ? undefined : Number(flags.min_win_rate),
|
|
4150
|
+
target: String(flags.target || 'higher').toLowerCase(),
|
|
4151
|
+
unit: String(flags.unit || ''),
|
|
4152
|
+
evidence_source: String(flags.evidence_source || '')
|
|
4153
|
+
});
|
|
4154
|
+
const gateResult = buildStrictGateResult({
|
|
4155
|
+
gate_id: 'benchmark-promotion',
|
|
4156
|
+
boundary: 'generic',
|
|
4157
|
+
checks: [
|
|
4158
|
+
{
|
|
4159
|
+
id: 'promotion-decision',
|
|
4160
|
+
status: promotion.decision === 'keep' ? 'passed' : 'failed',
|
|
4161
|
+
note: promotion.next_action,
|
|
4162
|
+
required: true
|
|
4163
|
+
}
|
|
4164
|
+
],
|
|
4165
|
+
blockers: promotion.blockers,
|
|
4166
|
+
evidence: [promotion.evidence_digest, promotion.evidence_source || 'operator-supplied paired measurements'],
|
|
4167
|
+
next_action: promotion.next_action
|
|
4168
|
+
});
|
|
4169
|
+
const result = { ...promotion, gate_result: gateResult };
|
|
4170
|
+
printJsonOrHuman(result, Boolean(flags.json), 'Bounded promotion report');
|
|
4171
|
+
if (promotion.decision !== 'keep' || gateResult.status !== 'passed')
|
|
4172
|
+
process.exitCode = 1;
|
|
4173
|
+
return;
|
|
4174
|
+
}
|
|
4175
|
+
catch (error) {
|
|
4176
|
+
const result = {
|
|
4177
|
+
schema: 'yam.bounded-promotion-error.v1',
|
|
4178
|
+
decision: 'blocked',
|
|
4179
|
+
blockers: [errorMessage(error)],
|
|
4180
|
+
next_action: 'repair the malformed paired-sample input before making a promotion decision',
|
|
4181
|
+
truth_status: 'blocked'
|
|
4182
|
+
};
|
|
4183
|
+
printJsonOrHuman(result, Boolean(flags.json), 'Bounded promotion report');
|
|
4184
|
+
process.exitCode = 1;
|
|
4185
|
+
return;
|
|
4186
|
+
}
|
|
4187
|
+
}
|
|
3814
4188
|
const baseline = numberOrNull(flags.baseline);
|
|
3815
4189
|
const current = numberOrNull(flags.current);
|
|
3816
4190
|
const target = String(flags.target || 'lower').toLowerCase() === 'higher' ? 'higher' : 'lower';
|
|
@@ -4412,7 +4786,12 @@ function formatStructuredEvidence(value) {
|
|
|
4412
4786
|
return JSON.stringify(buildMissionSubagentReceipt(data));
|
|
4413
4787
|
}
|
|
4414
4788
|
if (data.schema === 'yam.mission-completion-gate.v1' || data.expected_thread_ids || data.ready_to_claim_complete !== undefined) {
|
|
4415
|
-
|
|
4789
|
+
const completion = buildMissionCompletionGate(data);
|
|
4790
|
+
return JSON.stringify({
|
|
4791
|
+
...completion,
|
|
4792
|
+
...(data.gate_result && typeof data.gate_result === 'object' ? { gate_result: data.gate_result } : {}),
|
|
4793
|
+
...(data.gate_contract && typeof data.gate_contract === 'object' ? { gate_contract: data.gate_contract } : {})
|
|
4794
|
+
});
|
|
4416
4795
|
}
|
|
4417
4796
|
if (data.schema === 'yam.mission-patch-envelope.v1' || data.agent_id || data.assigned_scope) {
|
|
4418
4797
|
return JSON.stringify(buildMissionPatchEnvelope(data));
|
|
@@ -5386,6 +5765,10 @@ function showPath() {
|
|
|
5386
5765
|
function showRequestedHelp(args) {
|
|
5387
5766
|
if (!args.some((arg) => arg === '--help' || arg === '-h'))
|
|
5388
5767
|
return false;
|
|
5768
|
+
if (args[0] === 'ueye' && args[1] === 'production') {
|
|
5769
|
+
ueyeProductionUsage();
|
|
5770
|
+
return true;
|
|
5771
|
+
}
|
|
5389
5772
|
const commandUsage = {
|
|
5390
5773
|
context: contextUsage,
|
|
5391
5774
|
cleanup: cleanupUsage,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type BenchmarkDirection = 'higher' | 'lower';
|
|
2
|
+
export type PromotionDecision = 'keep' | 'revert' | 'insufficient-evidence' | 'blocked';
|
|
3
|
+
export interface PromotionSample {
|
|
4
|
+
seed: string;
|
|
5
|
+
candidate: number;
|
|
6
|
+
baseline: number;
|
|
7
|
+
}
|
|
8
|
+
export interface BoundedPromotionInput {
|
|
9
|
+
label?: string;
|
|
10
|
+
candidate_digest?: string;
|
|
11
|
+
baseline_digest?: string;
|
|
12
|
+
samples?: PromotionSample[];
|
|
13
|
+
min_samples?: number;
|
|
14
|
+
min_mean_delta?: number;
|
|
15
|
+
min_win_rate?: number;
|
|
16
|
+
target?: BenchmarkDirection;
|
|
17
|
+
unit?: string;
|
|
18
|
+
evidence_source?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface BoundedPromotionReport {
|
|
21
|
+
schema: 'yam.bounded-promotion-receipt.v1';
|
|
22
|
+
generated_at: string;
|
|
23
|
+
label: string;
|
|
24
|
+
candidate_digest: string;
|
|
25
|
+
baseline_digest: string;
|
|
26
|
+
target: BenchmarkDirection;
|
|
27
|
+
unit: string;
|
|
28
|
+
policy: {
|
|
29
|
+
min_samples: number;
|
|
30
|
+
min_mean_delta: number;
|
|
31
|
+
min_win_rate: number;
|
|
32
|
+
};
|
|
33
|
+
samples: Array<PromotionSample & {
|
|
34
|
+
directional_delta: number;
|
|
35
|
+
winner: 'candidate' | 'baseline' | 'tie';
|
|
36
|
+
}>;
|
|
37
|
+
sample_count: number;
|
|
38
|
+
candidate_mean: number | null;
|
|
39
|
+
baseline_mean: number | null;
|
|
40
|
+
directional_mean_delta: number | null;
|
|
41
|
+
win_rate: number | null;
|
|
42
|
+
decision: PromotionDecision;
|
|
43
|
+
failures: string[];
|
|
44
|
+
blockers: string[];
|
|
45
|
+
evidence_source: string;
|
|
46
|
+
evidence_digest: string;
|
|
47
|
+
measurement_truth: 'operator_asserted';
|
|
48
|
+
arithmetic_truth_status: 'verified' | 'blocked';
|
|
49
|
+
truth_status: 'partial' | 'blocked';
|
|
50
|
+
next_action: string;
|
|
51
|
+
}
|
|
52
|
+
export declare function parsePromotionSample(value: string): PromotionSample;
|
|
53
|
+
export declare function buildBoundedPromotionReport(input?: BoundedPromotionInput): BoundedPromotionReport;
|