@voce-engine/cli 0.1.0-rc.3 → 0.1.0-rc.5
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/README.md +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +40 -10
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
The `voce` command is the offline-first, explicit-path CLI for VOCE v0.1. It does not load lifecycle scripts, discover global packages, inspect credentials, or call a Provider unless the command explicitly selects the built-in `mock` provider.
|
|
4
4
|
|
|
5
|
-
> `0.1.0-rc.
|
|
5
|
+
> `0.1.0-rc.5` is a release candidate, not production-ready. CLI behavior may change before `0.1.0`.
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install --global @voce-engine/cli@0.1.0-rc.
|
|
8
|
+
npm install --global @voce-engine/cli@0.1.0-rc.5
|
|
9
9
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.1.0-rc.
|
|
1
|
+
export declare const CLI_VERSION = "0.1.0-rc.5";
|
|
2
2
|
export declare function runCli(argv?: string[]): Promise<number>;
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,13 @@ import { createHash, randomUUID } from 'node:crypto';
|
|
|
2
2
|
import { lstat, mkdir, readdir, readFile, realpath, rename, writeFile } from 'node:fs/promises';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import * as process from 'node:process';
|
|
5
|
-
import { MOCK_IMAGE_PROFILE, MOCK_JPEG_PROFILE, MOCK_LIMITED_REFERENCE_PROFILE, compileEvaluationReport, computeExecutionRunHash, computeCompilationContextHash, computeOntologyInstanceHash, computeSemanticReviewRequestHash, createConstraintWaiver, createHumanAcceptanceDecision, compileConstraints, compilePromptIR, createReferenceCandidate, planPipeline, planReferences, createScenarioPackRegistry, executeOffline, executeSemanticReview, FixtureReferenceInterpreter, FixtureSemanticReviewer, guardPromptCandidate, renderStaticTraceReport, sha256, traceModelFromExecution, validateStructuralImage, canonicalize, } from '@voce-engine/core';
|
|
5
|
+
import { MOCK_IMAGE_PROFILE, MOCK_JPEG_PROFILE, MOCK_LIMITED_REFERENCE_PROFILE, compileEvaluationReport, computeExecutionRunHash, computeCompilationContextHash, computeOntologyInstanceHash, computeSemanticReviewRequestHash, createConstraintWaiver, createHumanAcceptanceDecision, compileConstraints, compilePromptIR, createReferenceCandidate, planPipeline, planReferences, createScenarioPackRegistry, executeOffline, executeSemanticReview, FixtureReferenceInterpreter, FixtureSemanticReviewer, guardPromptCandidate, renderStaticTraceReport, sha256, traceModelFromExecution, validateStructuralImage, canonicalize, VISUAL_COMPOSITION_CATALOG, computeVisualCompositionCatalogHash, expandVisualCompositionPreset, } from '@voce-engine/core';
|
|
6
6
|
import { FIXTURE_M6_OPAQUE_PNG, fixtureChangeIntent, fixtureM4ConstraintInput, fixtureM5Candidate, fixtureM5ExecutionInput, fixtureM5GuardInput, fixtureM5PromptIR, fixtureM6Artifact, fixtureM6Authorization, fixtureScopePlan, } from '@voce-engine/testkit';
|
|
7
7
|
import { BUNDLE_MANIFEST_SCHEMA_VERSION } from '@voce-engine/contracts';
|
|
8
|
-
export const CLI_VERSION = '0.1.0-rc.
|
|
8
|
+
export const CLI_VERSION = '0.1.0-rc.5';
|
|
9
9
|
const TOOL_ID = '@voce-engine/cli';
|
|
10
|
-
const CONTRACTS_VERSION = '0.1.0-rc.
|
|
11
|
-
const CORE_VERSION = '0.1.0-rc.
|
|
10
|
+
const CONTRACTS_VERSION = '0.1.0-rc.5';
|
|
11
|
+
const CORE_VERSION = '0.1.0-rc.5';
|
|
12
12
|
const SOURCE_SCHEMA = 'voce.scenario-pack-source/v1alpha1';
|
|
13
13
|
const PACK_SCHEMA = 'voce.scenario-pack/v1alpha1';
|
|
14
14
|
const HASH = /^sha256:[0-9a-f]{64}$/;
|
|
@@ -351,7 +351,10 @@ function referenceProbeCandidates(probe, ir) {
|
|
|
351
351
|
});
|
|
352
352
|
}
|
|
353
353
|
function coreProbeEvidence(probe, resolution, caseSpec, profile) {
|
|
354
|
-
const
|
|
354
|
+
const baseInput = probeInput(probe, resolution, caseSpec);
|
|
355
|
+
const ir = compileConstraints(baseInput);
|
|
356
|
+
const presetInput = { ...baseInput, changeIntents: [...baseInput.changeIntents, ...expandVisualCompositionPreset('rule-of-thirds')] };
|
|
357
|
+
const presetIr = compileConstraints(presetInput);
|
|
355
358
|
const evidence = {
|
|
356
359
|
status: ir.status, constraintHash: ir.deterministicSignature, blockingConflictCount: ir.conflicts.filter((item) => item.blocking).length,
|
|
357
360
|
conflictCodes: ir.conflicts.map((item) => item.code).sort(compare), reviewRequirementCount: ir.reviewRequirements.length,
|
|
@@ -359,18 +362,25 @@ function coreProbeEvidence(probe, resolution, caseSpec, profile) {
|
|
|
359
362
|
degradationCount: ir.degradedPreferences.length, personIntentCount: (probe.intents ?? []).filter((item) => item.targetPath.startsWith('person.')).length,
|
|
360
363
|
constraintTargetPaths: ir.constraints.flatMap((item) => item.targetPaths).sort(compare),
|
|
361
364
|
constraintSourceIds: [...new Set(ir.constraints.flatMap((item) => item.sourceIds))].sort(compare),
|
|
365
|
+
presetId: 'rule-of-thirds', presetConstraintStatus: presetIr.status, presetConstraintHashBefore: ir.deterministicSignature, presetConstraintHashAfter: presetIr.deterministicSignature,
|
|
362
366
|
};
|
|
363
|
-
if (!probe.references?.length)
|
|
364
|
-
return evidence;
|
|
365
367
|
const candidates = referenceProbeCandidates(probe, ir);
|
|
368
|
+
const presetCandidates = referenceProbeCandidates(probe, presetIr);
|
|
366
369
|
const maximumReferenceCount = probe.maximumReferenceCount ?? profile.maximumReferenceCount;
|
|
367
370
|
const plan = planReferences({ schemaVersion: 'voce.reference-planning-input/v1alpha1', caseId: caseSpec.id, caseRevision: caseSpec.revision, contextHash: ir.contextHash, constraintIR: ir, candidates, dependencies: [], profile, budget: { maximumReferenceCount, usedReferenceCount: 0, byteLengthKnown: true, unknownByteLengthAssetIds: [] } });
|
|
371
|
+
const presetPlan = planReferences({ schemaVersion: 'voce.reference-planning-input/v1alpha1', caseId: caseSpec.id, caseRevision: caseSpec.revision, contextHash: presetIr.contextHash, constraintIR: presetIr, candidates: presetCandidates, dependencies: [], profile, budget: { maximumReferenceCount, usedReferenceCount: 0, byteLengthKnown: true, unknownByteLengthAssetIds: [] } });
|
|
368
372
|
evidence.referenceStatus = plan.status;
|
|
369
373
|
evidence.referencePlanHash = plan.planHash;
|
|
370
374
|
evidence.selectedRoles = plan.ordered.map((item) => item.role).sort(compare);
|
|
371
375
|
evidence.omittedRoles = plan.omitted.map((item) => candidates.find((candidate) => candidate.id === item.candidateId)?.role ?? item.candidateId).sort(compare);
|
|
372
376
|
evidence.blockedRoles = plan.blockedReferences.map((item) => candidates.find((candidate) => candidate.id === item.candidateId)?.role ?? item.candidateId).sort(compare);
|
|
373
377
|
evidence.selectedSourceBindingIds = [...new Set(plan.ordered.flatMap((item) => item.sourceBindingIds))].sort(compare);
|
|
378
|
+
evidence.presetReferenceCountBefore = plan.ordered.length;
|
|
379
|
+
evidence.presetReferenceCountAfter = presetPlan.ordered.length;
|
|
380
|
+
evidence.presetReferencePlanHashBefore = plan.planHash;
|
|
381
|
+
evidence.presetReferencePlanHashAfter = presetPlan.planHash;
|
|
382
|
+
if (!probe.references?.length)
|
|
383
|
+
return evidence;
|
|
374
384
|
if (ir.status !== 'ok' || plan.status !== 'ok') {
|
|
375
385
|
evidence.promptStatus = 'blocked';
|
|
376
386
|
return evidence;
|
|
@@ -381,7 +391,7 @@ function coreProbeEvidence(probe, resolution, caseSpec, profile) {
|
|
|
381
391
|
return evidence;
|
|
382
392
|
}
|
|
383
393
|
const outputContract = probeInput(probe, resolution, caseSpec).outputContract;
|
|
384
|
-
const prompt = compilePromptIR({ schemaVersion: 'voce.prompt-compilation-input/
|
|
394
|
+
const prompt = compilePromptIR({ schemaVersion: 'voce.prompt-compilation-input/v1alpha2', caseId: caseSpec.id, caseRevision: caseSpec.revision, context: probeInput(probe, resolution, caseSpec).context, contextHash: ir.contextHash, constraintIR: ir, referencePlan: plan, pipelinePlan: pipelineResult.pipelinePlan, outputContract, targetAdapter: { id: profile.adapterId, version: profile.version, digest: profile.adapterDigest }, targetCapabilityProfile: { id: profile.id, version: profile.version, digest: profile.profileHash }, effectiveScenario: resolution.effectiveScenario });
|
|
385
395
|
evidence.promptStatus = 'ok';
|
|
386
396
|
evidence.promptHash = prompt.deterministicSignature;
|
|
387
397
|
evidence.promptTargetPaths = ir.constraints.filter((constraint) => prompt.constraintCoverage.some((coverage) => coverage.constraintId === constraint.id && (coverage.sectionIds.length > 0 || coverage.referenceMappingIds.length > 0 || coverage.parameterIds.length > 0))).flatMap((constraint) => constraint.targetPaths).sort(compare);
|
|
@@ -416,12 +426,16 @@ function scenarioEvidence(scenario) {
|
|
|
416
426
|
const ontology = contributionArray(scenarioContributions(scenario, 'ontologyVocabulary'), 'paths');
|
|
417
427
|
const scopes = scenarioContributions(scenario, 'interpretationScopes');
|
|
418
428
|
const bindings = contributionArray(scopes, 'bindings');
|
|
419
|
-
const
|
|
429
|
+
const promptDefinitions = contributionArray(scenarioContributions(scenario, 'promptSections'), 'sections');
|
|
430
|
+
const promptPaths = promptDefinitions.flatMap((definition) => Array.isArray(definition.requiredPaths) ? definition.requiredPaths.filter((item) => typeof item === 'string') : []);
|
|
431
|
+
const promptSectionOrder = promptDefinitions.map((definition) => ({ id: String(definition.id ?? ''), order: typeof definition.order === 'number' ? definition.order : 0 })).filter((item) => item.id).sort((left, right) => left.order - right.order || compare(left.id, right.id)).map((item) => item.id);
|
|
420
432
|
const criteria = semanticCriteriaForScenario(scenario);
|
|
421
433
|
return {
|
|
422
434
|
ontologyPaths: ontology.map((item) => String(item.path ?? '')).filter(Boolean).sort(compare),
|
|
423
435
|
bindingPolicies: bindings.map((item) => `${String(item.assetRole ?? '')}|${String(item.relation ?? '')}|${String(item.targetPath ?? '')}|${String(item.priority ?? '')}`).sort(compare),
|
|
424
436
|
promptTargetPaths: [...new Set(promptPaths)].sort(compare),
|
|
437
|
+
promptSectionOrder,
|
|
438
|
+
visualComposition: { catalogId: VISUAL_COMPOSITION_CATALOG.id, catalogHash: computeVisualCompositionCatalogHash(), pathCount: VISUAL_COMPOSITION_CATALOG.paths.length, presetCount: VISUAL_COMPOSITION_CATALOG.presets.length, fullShotChanges: expandVisualCompositionPreset('full-shot').map((item) => ({ targetPath: item.targetPath, ...(item.requestedValue === undefined ? {} : { requestedValue: item.requestedValue }) })) },
|
|
425
439
|
reviewCriterionIds: criteria.map((item) => item.id).sort(compare),
|
|
426
440
|
reviewTargetPaths: criteria.map((item) => item.targetPath).filter((item) => typeof item === 'string').sort(compare),
|
|
427
441
|
};
|
|
@@ -733,7 +747,23 @@ async function packTestCommand(source) {
|
|
|
733
747
|
const failed = results.some((item) => item.status === 'failed');
|
|
734
748
|
return { status: failed ? 'failed' : 'passed', packId: loaded.descriptor.manifest.packId, resolutionHash: resolution.report.reportHash, lockHash: resolution.lock.lockHash, effectiveScenarioHash: resolution.effectiveScenario.effectiveScenarioHash, fixtureCount: results.length, results };
|
|
735
749
|
}
|
|
736
|
-
async function doctorCommand() {
|
|
750
|
+
async function doctorCommand() {
|
|
751
|
+
const major = Number(process.versions.node.split('.')[0]);
|
|
752
|
+
return {
|
|
753
|
+
status: major >= 20 ? 'ok' : 'blocked',
|
|
754
|
+
node: { version: process.versions.node, supported: major >= 20 },
|
|
755
|
+
contracts: { schemaVersion: BUNDLE_MANIFEST_SCHEMA_VERSION, packageVersion: CONTRACTS_VERSION },
|
|
756
|
+
paths: { explicitOnly: true },
|
|
757
|
+
providers: { default: 'disabled', mock: 'offline', networkProbe: false },
|
|
758
|
+
authProbe: { inspected: false },
|
|
759
|
+
visualComposition: {
|
|
760
|
+
catalogId: VISUAL_COMPOSITION_CATALOG.id,
|
|
761
|
+
catalogHash: computeVisualCompositionCatalogHash(),
|
|
762
|
+
pathCount: VISUAL_COMPOSITION_CATALOG.paths.length,
|
|
763
|
+
presetCount: VISUAL_COMPOSITION_CATALOG.presets.length,
|
|
764
|
+
},
|
|
765
|
+
};
|
|
766
|
+
}
|
|
737
767
|
function required(args, key) { if (!args[key])
|
|
738
768
|
throw new CliError('ARGUMENT_MISSING', `Missing --${key}.`, EXIT.usage); return args[key]; }
|
|
739
769
|
function help() { return `voce ${CLI_VERSION}\n\nOffline-first explicit-path CLI.\n\nCommands:\n voce pack inspect --source <path> [--json]\n voce pack validate --source <path> [--json]\n voce pack test --source <path> [--json]\n voce case compile --case <file> --scenario <path> --profile <file> --out <dir> [--json]\n voce case run --bundle <dir> --provider mock --out <dir> [--json]\n voce trace render --bundle <dir> --out <html> [--json]\n voce compare --before <dir> --after <dir> [--out <file>] [--json]\n voce doctor [--json]\n\nExit codes: 0 success, 2 usage, 3 input, 4 contract/hash, 5 offline/provider, 6 output, 7 internal.`; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voce-engine/cli",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.5",
|
|
4
4
|
"description": "Offline-first command line tools for the VOCE v0.1 release candidate.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"tag": "next"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@voce-engine/contracts": "0.1.0-rc.
|
|
40
|
-
"@voce-engine/core": "0.1.0-rc.
|
|
41
|
-
"@voce-engine/testkit": "0.1.0-rc.
|
|
39
|
+
"@voce-engine/contracts": "0.1.0-rc.5",
|
|
40
|
+
"@voce-engine/core": "0.1.0-rc.5",
|
|
41
|
+
"@voce-engine/testkit": "0.1.0-rc.5"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsc -b"
|