@voce-engine/core 0.1.0-rc.1
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/LICENSE +1 -0
- package/README.md +9 -0
- package/dist/canonical.d.ts +4 -0
- package/dist/canonical.js +30 -0
- package/dist/evidence.d.ts +31 -0
- package/dist/evidence.js +1053 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +608 -0
- package/dist/m4.d.ts +157 -0
- package/dist/m4.js +2250 -0
- package/dist/m5.d.ts +183 -0
- package/dist/m5.js +2433 -0
- package/dist/m6.d.ts +182 -0
- package/dist/m6.js +1183 -0
- package/package.json +50 -0
package/dist/m5.d.ts
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { ArtifactHandle, ArtifactReplayResult, CompilationContext, CompensationReceipt, ConstraintIR, CleanupReceipt, Evaluation, ExecutionAuthorization, ExecutionRun, ExecutionTraceProjection, HumanAcceptance, JsonObject, PipelinePlan, PipelineStep, PromptCandidateIR, PromptCompilationInput, PromptGuardInput, PromptGuardResult, PromptIR, PromptOptimizationInput, PromptOptimizer, PromptTransformation, ProviderAdapter, ProviderRenderRequest, ProviderRenderResult, ReferencePlan, RemoteCallRun, RemoteCallAuthorization, StepReceipt, VersionPin } from '@voce-engine/contracts';
|
|
2
|
+
export declare const PROMPT_COMPILER_VERSION = "voce.prompt-compiler/v1alpha1";
|
|
3
|
+
export declare const PROMPT_OPTIMIZER_VERSION = "voce.deterministic-prompt-optimizer/v1alpha1";
|
|
4
|
+
export declare const PROMPT_GUARD_VERSION = "voce.prompt-guard/v1alpha1";
|
|
5
|
+
export declare const MOCK_PROVIDER_ADAPTER_VERSION = "voce.mock-provider-adapter/v1alpha1";
|
|
6
|
+
export declare const EXECUTION_RUNTIME_VERSION = "voce.offline-execution-runtime/v1alpha1";
|
|
7
|
+
export declare const FIXED_M5_TIME = "2026-01-01T00:00:00.000Z";
|
|
8
|
+
export declare function computePromptIRHash(prompt: PromptIR): string;
|
|
9
|
+
export declare const computePromptIRSignature: typeof computePromptIRHash;
|
|
10
|
+
export declare function computePromptTransformationHash(transformation: PromptTransformation): string;
|
|
11
|
+
export declare function computePromptCandidateHash(candidate: PromptCandidateIR): string;
|
|
12
|
+
export declare function computePromptGuardResultHash(result: PromptGuardResult): string;
|
|
13
|
+
export declare class PromptCompiler {
|
|
14
|
+
compile(input: PromptCompilationInput): PromptIR;
|
|
15
|
+
}
|
|
16
|
+
export declare const DeterministicPromptCompiler: typeof PromptCompiler;
|
|
17
|
+
export declare function compilePromptIR(input: PromptCompilationInput): PromptIR;
|
|
18
|
+
export declare const compilePrompt: typeof compilePromptIR;
|
|
19
|
+
export interface PromptCandidateOptions {
|
|
20
|
+
optimizer?: VersionPin;
|
|
21
|
+
mode?: 'strict' | 'balanced' | 'creative';
|
|
22
|
+
warnings?: string[];
|
|
23
|
+
}
|
|
24
|
+
export declare function createPromptCandidateIR(prompt: PromptIR, transformations?: PromptTransformation[], options?: PromptCandidateOptions): PromptCandidateIR;
|
|
25
|
+
export declare class DeterministicPromptOptimizer implements PromptOptimizer {
|
|
26
|
+
optimize(input: PromptOptimizationInput): PromptCandidateIR;
|
|
27
|
+
}
|
|
28
|
+
export declare const BaselinePromptOptimizer: typeof DeterministicPromptOptimizer;
|
|
29
|
+
export declare const OfflinePromptOptimizer: typeof DeterministicPromptOptimizer;
|
|
30
|
+
export declare function optimizePromptIR(input: PromptOptimizationInput): PromptCandidateIR;
|
|
31
|
+
export declare function optimizePromptIRWithFallback(input: PromptOptimizationInput): PromptCandidateIR;
|
|
32
|
+
export declare const optimizePromptSafely: typeof optimizePromptIRWithFallback;
|
|
33
|
+
export declare class PromptGuard {
|
|
34
|
+
guard(input: PromptGuardInput): PromptGuardResult;
|
|
35
|
+
}
|
|
36
|
+
export declare const DeterministicPromptGuard: typeof PromptGuard;
|
|
37
|
+
export declare function guardPromptCandidate(input: PromptGuardInput): PromptGuardResult;
|
|
38
|
+
export declare const guardPrompt: typeof guardPromptCandidate;
|
|
39
|
+
export interface ProviderRenderInput {
|
|
40
|
+
promptIR: PromptIR;
|
|
41
|
+
candidate?: PromptCandidateIR;
|
|
42
|
+
guardResult?: PromptGuardResult;
|
|
43
|
+
caseId?: string;
|
|
44
|
+
caseRevision?: number;
|
|
45
|
+
contextHash?: string;
|
|
46
|
+
pipelinePlanHash?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare function computeProviderRenderRequestHash(request: ProviderRenderRequest): string;
|
|
49
|
+
export declare function createProviderRenderRequest(input: ProviderRenderInput): ProviderRenderRequest;
|
|
50
|
+
export declare const renderProviderRequest: typeof createProviderRenderRequest;
|
|
51
|
+
export declare const OFFLINE_EXECUTION_INPUT_SCHEMA_VERSION: "voce.offline-execution-input/v1alpha1";
|
|
52
|
+
export interface OfflineExecutionOptions {
|
|
53
|
+
now?: string;
|
|
54
|
+
failStepIds?: string[];
|
|
55
|
+
unknownStepIds?: string[];
|
|
56
|
+
retryableFailureStepIds?: string[];
|
|
57
|
+
cancelBeforeStepId?: string;
|
|
58
|
+
workerRestartAfterStepId?: string;
|
|
59
|
+
cleanupFailureIds?: string[];
|
|
60
|
+
compensationFailureIds?: string[];
|
|
61
|
+
maximumCleanupRetries?: number;
|
|
62
|
+
}
|
|
63
|
+
export interface OfflineExecutionInput {
|
|
64
|
+
schemaVersion: typeof OFFLINE_EXECUTION_INPUT_SCHEMA_VERSION;
|
|
65
|
+
context: CompilationContext;
|
|
66
|
+
contextHash: string;
|
|
67
|
+
constraintIR: ConstraintIR;
|
|
68
|
+
referencePlan: ReferencePlan;
|
|
69
|
+
pipelinePlan: PipelinePlan;
|
|
70
|
+
outputContract: PromptCompilationInput['outputContract'];
|
|
71
|
+
promptArtifact: PromptIR | PromptCandidateIR;
|
|
72
|
+
promptGuardResult?: PromptGuardResult;
|
|
73
|
+
executionAuthorization: ExecutionAuthorization;
|
|
74
|
+
remoteCallAuthorizations: RemoteCallAuthorization[];
|
|
75
|
+
options?: OfflineExecutionOptions;
|
|
76
|
+
}
|
|
77
|
+
export interface OfflineExecutionResult {
|
|
78
|
+
status: 'blocked' | 'completed' | 'failed' | 'submission_unknown' | 'cancelled' | 'needs_review';
|
|
79
|
+
code: string;
|
|
80
|
+
reasons: string[];
|
|
81
|
+
executionRun?: ExecutionRun;
|
|
82
|
+
run?: ExecutionRun;
|
|
83
|
+
events: import('@voce-engine/contracts').StepEvent[];
|
|
84
|
+
receipts: StepReceipt[];
|
|
85
|
+
remoteCallRuns: RemoteCallRun[];
|
|
86
|
+
cleanupReceipts: CleanupReceipt[];
|
|
87
|
+
compensationReceipts: CompensationReceipt[];
|
|
88
|
+
evaluation?: Evaluation;
|
|
89
|
+
humanAcceptance?: HumanAcceptance;
|
|
90
|
+
trace?: ExecutionTraceProjection;
|
|
91
|
+
}
|
|
92
|
+
export interface MockStepExecutionContext {
|
|
93
|
+
runId: string;
|
|
94
|
+
step: PipelineStep;
|
|
95
|
+
promptArtifactHash: string;
|
|
96
|
+
referencePlanHash: string;
|
|
97
|
+
outputContract: OfflineExecutionInput['outputContract'];
|
|
98
|
+
attempt: number;
|
|
99
|
+
options: OfflineExecutionOptions;
|
|
100
|
+
}
|
|
101
|
+
export interface MockStepExecutionResult {
|
|
102
|
+
status: 'succeeded' | 'failed' | 'submission_unknown' | 'cancelled';
|
|
103
|
+
outputArtifacts: ArtifactHandle[];
|
|
104
|
+
metadata: JsonObject;
|
|
105
|
+
providerRequestId?: string;
|
|
106
|
+
failureCode?: string;
|
|
107
|
+
actualCost?: number;
|
|
108
|
+
actualBytes?: number;
|
|
109
|
+
}
|
|
110
|
+
export interface OfflineStepAdapter {
|
|
111
|
+
id: string;
|
|
112
|
+
version: VersionPin;
|
|
113
|
+
digest: string;
|
|
114
|
+
profileDigest?: string;
|
|
115
|
+
executeStep(context: MockStepExecutionContext): MockStepExecutionResult;
|
|
116
|
+
reconcileStep?(context: MockStepExecutionContext): MockStepExecutionResult;
|
|
117
|
+
}
|
|
118
|
+
export declare function computeExecutionDataTransferDigest(plan: PipelinePlan): string;
|
|
119
|
+
export declare function computeExecutionBudgetDigest(plan: PipelinePlan): string;
|
|
120
|
+
export declare function computeExecutionStepInputHash(step: PipelineStep, contextHash: string, pipelinePlanHash: string, referencePlanHash: string, promptArtifactHashValue: string, referenceContentHashes?: string[]): string;
|
|
121
|
+
export interface MockProviderAdapterOptions {
|
|
122
|
+
failStepIds?: string[];
|
|
123
|
+
unknownStepIds?: string[];
|
|
124
|
+
retryableFailureStepIds?: string[];
|
|
125
|
+
version?: VersionPin;
|
|
126
|
+
digest?: string;
|
|
127
|
+
profileDigest?: string;
|
|
128
|
+
}
|
|
129
|
+
export declare class MockProviderAdapter implements ProviderAdapter, OfflineStepAdapter {
|
|
130
|
+
readonly id: string;
|
|
131
|
+
readonly version: VersionPin;
|
|
132
|
+
readonly digest: string;
|
|
133
|
+
readonly profileDigest?: string;
|
|
134
|
+
readonly offline = true;
|
|
135
|
+
private readonly options;
|
|
136
|
+
constructor(options?: MockProviderAdapterOptions, id?: string);
|
|
137
|
+
render(request: ProviderRenderRequest): ProviderRenderResult;
|
|
138
|
+
executeStep(context: MockStepExecutionContext): MockStepExecutionResult;
|
|
139
|
+
reconcileStep(context: MockStepExecutionContext): MockStepExecutionResult;
|
|
140
|
+
}
|
|
141
|
+
export declare class MockGeneratorAdapter extends MockProviderAdapter {
|
|
142
|
+
constructor(options?: MockProviderAdapterOptions);
|
|
143
|
+
}
|
|
144
|
+
export declare class MockPostprocessorAdapter extends MockProviderAdapter {
|
|
145
|
+
constructor(options?: MockProviderAdapterOptions);
|
|
146
|
+
}
|
|
147
|
+
export declare class MockNormalizerAdapter extends MockProviderAdapter {
|
|
148
|
+
constructor(options?: MockProviderAdapterOptions);
|
|
149
|
+
}
|
|
150
|
+
export declare class MockStructuralValidatorAdapter extends MockProviderAdapter {
|
|
151
|
+
constructor(options?: MockProviderAdapterOptions);
|
|
152
|
+
}
|
|
153
|
+
export declare function computeExecutionRunHash(run: ExecutionRun): string;
|
|
154
|
+
export declare function computeExecutionTraceHash(trace: ExecutionTraceProjection): string;
|
|
155
|
+
export declare function projectExecutionTrace(trace: ExecutionTraceProjection): ExecutionTraceProjection;
|
|
156
|
+
export declare const deterministicTraceProjection: typeof projectExecutionTrace;
|
|
157
|
+
export declare function serializeExecutionTrace(trace: ExecutionTraceProjection): string;
|
|
158
|
+
export declare const executionTraceJson: typeof serializeExecutionTrace;
|
|
159
|
+
export declare class OfflineExecutionRuntime {
|
|
160
|
+
private readonly adapters;
|
|
161
|
+
private readonly records;
|
|
162
|
+
constructor(adapter?: OfflineStepAdapter, adapters?: OfflineStepAdapter[]);
|
|
163
|
+
private executeRegisteredStep;
|
|
164
|
+
execute(input: OfflineExecutionInput): OfflineExecutionResult;
|
|
165
|
+
get(runId: string): OfflineExecutionResult | undefined;
|
|
166
|
+
run(input: OfflineExecutionInput): OfflineExecutionResult;
|
|
167
|
+
dispatch(input: OfflineExecutionInput): OfflineExecutionResult;
|
|
168
|
+
reconcile(runId: string, state: 'running' | 'validating' | 'completed' | 'failed' | 'cancelled'): OfflineExecutionResult;
|
|
169
|
+
cancel(runId: string): OfflineExecutionResult;
|
|
170
|
+
cancelRun(runId: string): OfflineExecutionResult;
|
|
171
|
+
acceptHumanAcceptance(runId: string, reviewerId?: string): OfflineExecutionResult;
|
|
172
|
+
declineHumanAcceptance(runId: string, reasonCode?: string, reviewerId?: string): OfflineExecutionResult;
|
|
173
|
+
getTrace(runId: string): ExecutionTraceProjection | undefined;
|
|
174
|
+
}
|
|
175
|
+
export declare function createOfflineExecutionRuntime(adapter?: OfflineStepAdapter, adapters?: OfflineStepAdapter[]): OfflineExecutionRuntime;
|
|
176
|
+
export declare function createMockRuntimeForPlan(plan: PipelinePlan, options?: MockProviderAdapterOptions): OfflineExecutionRuntime;
|
|
177
|
+
export declare const OfflineExecutionEngine: typeof OfflineExecutionRuntime;
|
|
178
|
+
export declare function executeOffline(input: OfflineExecutionInput, runtime?: OfflineExecutionRuntime): OfflineExecutionResult;
|
|
179
|
+
export declare const executePipeline: typeof executeOffline;
|
|
180
|
+
export declare const runOfflineExecution: typeof executeOffline;
|
|
181
|
+
export declare function replayArtifacts(artifacts: ArtifactHandle[], traceHash?: string): ArtifactReplayResult;
|
|
182
|
+
export declare function replayArtifact(artifact: ArtifactHandle, traceHash?: string): ArtifactReplayResult;
|
|
183
|
+
export declare const replayArtifactHandles: typeof replayArtifacts;
|