@obversa/api 0.1.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/LICENSE +21 -0
- package/README.md +49 -0
- package/dist/accepted-result-support.d.ts +1 -0
- package/dist/accepted-result-support.js +5 -0
- package/dist/accepted-result-support.js.map +1 -0
- package/dist/action-decision.d.ts +15 -0
- package/dist/approval-support.d.ts +1 -0
- package/dist/approval-support.js +5 -0
- package/dist/approval-support.js.map +1 -0
- package/dist/artifacts/conformance.d.ts +20 -0
- package/dist/artifacts/store.d.ts +30 -0
- package/dist/budget.d.ts +36 -0
- package/dist/callback/approval.d.ts +80 -0
- package/dist/callback/client-contract.d.ts +81 -0
- package/dist/callback/gate.d.ts +49 -0
- package/dist/callback/stored-client.d.ts +22 -0
- package/dist/chunk-6NA4RDQ4.js +81 -0
- package/dist/chunk-6NA4RDQ4.js.map +1 -0
- package/dist/chunk-6NAMCSPJ.js +331 -0
- package/dist/chunk-6NAMCSPJ.js.map +1 -0
- package/dist/chunk-6ZP73HZN.js +293 -0
- package/dist/chunk-6ZP73HZN.js.map +1 -0
- package/dist/chunk-AJ353QD5.js +157 -0
- package/dist/chunk-AJ353QD5.js.map +1 -0
- package/dist/chunk-VWZKI7AG.js +552 -0
- package/dist/chunk-VWZKI7AG.js.map +1 -0
- package/dist/chunk-WGLWWKF3.js +135 -0
- package/dist/chunk-WGLWWKF3.js.map +1 -0
- package/dist/contracts.d.ts +122 -0
- package/dist/engine-conformance.d.ts +80 -0
- package/dist/environment.d.ts +53 -0
- package/dist/error.d.ts +36 -0
- package/dist/events/conformance.d.ts +20 -0
- package/dist/events/envelope.d.ts +26 -0
- package/dist/events/store.d.ts +15 -0
- package/dist/graph-commands.d.ts +23 -0
- package/dist/graph-contract.d.ts +48 -0
- package/dist/graph-executor.d.ts +61 -0
- package/dist/graph-kernel.d.ts +2 -0
- package/dist/graph-plan.d.ts +140 -0
- package/dist/graph-type.d.ts +45 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +806 -0
- package/dist/index.js.map +1 -0
- package/dist/json.d.ts +14 -0
- package/dist/memory-conformance.d.ts +17 -0
- package/dist/memory-types.d.ts +127 -0
- package/dist/model-identity.d.ts +28 -0
- package/dist/node-data-context.d.ts +11 -0
- package/dist/preflight-result.d.ts +17 -0
- package/dist/proof/acceptance.d.ts +60 -0
- package/dist/proof/artifact.d.ts +2 -0
- package/dist/proof/cache.d.ts +46 -0
- package/dist/reasoning-record-contract.d.ts +52 -0
- package/dist/result-contract.d.ts +16 -0
- package/dist/result.d.ts +30 -0
- package/dist/run-definition-support.d.ts +1 -0
- package/dist/run-definition-support.js +5 -0
- package/dist/run-definition-support.js.map +1 -0
- package/dist/run-definition.d.ts +73 -0
- package/dist/storage/error.d.ts +7 -0
- package/dist/storage/id.d.ts +2 -0
- package/dist/testing.d.ts +5 -0
- package/dist/testing.js +1745 -0
- package/dist/testing.js.map +1 -0
- package/dist/workspace/conformance.d.ts +30 -0
- package/dist/workspace/policy.d.ts +6 -0
- package/dist/workspace/provider.d.ts +132 -0
- package/package.json +68 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { ExecutionTarget } from './contracts.js';
|
|
2
|
+
export type { ExecutionTarget } from './contracts.js';
|
|
3
|
+
import { type EdgeId, type GraphId, type NodeId } from './graph-contract.js';
|
|
4
|
+
import { type JsonValue, type Sha256Digest } from './json.js';
|
|
5
|
+
export interface PermissionDescriptor {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly scope: JsonValue;
|
|
8
|
+
}
|
|
9
|
+
export interface ExecutionLaneDescription {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly requested: ExecutionTarget;
|
|
12
|
+
readonly knownSubstitutions: readonly ExecutionTarget[];
|
|
13
|
+
}
|
|
14
|
+
export interface GraphPhaseDescription {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly nodeIds: readonly NodeId[];
|
|
18
|
+
}
|
|
19
|
+
export interface GraphNodeDescription {
|
|
20
|
+
readonly id: NodeId;
|
|
21
|
+
readonly phaseId: string;
|
|
22
|
+
readonly inputContract: JsonValue;
|
|
23
|
+
readonly outputContract: JsonValue;
|
|
24
|
+
readonly laneId: string | null;
|
|
25
|
+
}
|
|
26
|
+
export interface GraphEdgeDescription {
|
|
27
|
+
readonly id: EdgeId;
|
|
28
|
+
readonly source: NodeId;
|
|
29
|
+
readonly target: NodeId;
|
|
30
|
+
}
|
|
31
|
+
export type PlanBound = {
|
|
32
|
+
readonly kind: 'known';
|
|
33
|
+
readonly value: number;
|
|
34
|
+
} | {
|
|
35
|
+
readonly kind: 'unknown';
|
|
36
|
+
readonly reason: string;
|
|
37
|
+
};
|
|
38
|
+
export interface GraphBounds {
|
|
39
|
+
readonly dispatches: {
|
|
40
|
+
readonly min: PlanBound;
|
|
41
|
+
readonly max: PlanBound;
|
|
42
|
+
};
|
|
43
|
+
readonly maxConcurrency: PlanBound;
|
|
44
|
+
readonly maxFanOut: PlanBound;
|
|
45
|
+
}
|
|
46
|
+
export interface GraphPolicyDescription {
|
|
47
|
+
readonly retry: JsonValue;
|
|
48
|
+
readonly stop: JsonValue;
|
|
49
|
+
readonly concurrency: JsonValue;
|
|
50
|
+
readonly write: JsonValue;
|
|
51
|
+
readonly budget: JsonValue;
|
|
52
|
+
readonly action: JsonValue;
|
|
53
|
+
}
|
|
54
|
+
export interface GraphRequirements {
|
|
55
|
+
readonly memory: 'required' | 'unused';
|
|
56
|
+
}
|
|
57
|
+
export interface GraphDescriptionInput {
|
|
58
|
+
readonly inputContract: JsonValue;
|
|
59
|
+
readonly outputContract: JsonValue;
|
|
60
|
+
readonly phases: readonly GraphPhaseDescription[];
|
|
61
|
+
readonly nodes: readonly GraphNodeDescription[];
|
|
62
|
+
readonly policies: GraphPolicyDescription;
|
|
63
|
+
readonly executionLanes: readonly ExecutionLaneDescription[];
|
|
64
|
+
readonly requestedPermissions: readonly PermissionDescriptor[];
|
|
65
|
+
readonly bounds: GraphBounds;
|
|
66
|
+
}
|
|
67
|
+
export interface GraphDescription extends GraphDescriptionInput {
|
|
68
|
+
readonly schemaVersion: 1;
|
|
69
|
+
readonly graph: {
|
|
70
|
+
readonly id: GraphId;
|
|
71
|
+
readonly definitionVersion: number;
|
|
72
|
+
readonly kind: string;
|
|
73
|
+
readonly typeVersion: number;
|
|
74
|
+
readonly definitionDigest: Sha256Digest;
|
|
75
|
+
};
|
|
76
|
+
readonly edges: readonly GraphEdgeDescription[];
|
|
77
|
+
readonly requirements: GraphRequirements;
|
|
78
|
+
}
|
|
79
|
+
export interface GraphPackageIdentity {
|
|
80
|
+
readonly source: string;
|
|
81
|
+
readonly version: string;
|
|
82
|
+
readonly digest: Sha256Digest;
|
|
83
|
+
}
|
|
84
|
+
export interface GraphPackageAdmission {
|
|
85
|
+
readonly package: GraphPackageIdentity;
|
|
86
|
+
readonly permissions: readonly PermissionDescriptor[];
|
|
87
|
+
}
|
|
88
|
+
export interface ExecutionLaneResolution {
|
|
89
|
+
readonly id: string;
|
|
90
|
+
readonly effective: ExecutionTarget;
|
|
91
|
+
readonly fallbacks?: readonly ExecutionTarget[];
|
|
92
|
+
}
|
|
93
|
+
export interface RunPreflightPolicy {
|
|
94
|
+
readonly timeoutMs: number;
|
|
95
|
+
readonly lanes: readonly {
|
|
96
|
+
readonly laneId: string;
|
|
97
|
+
readonly live: 'required' | 'skip';
|
|
98
|
+
readonly unsupportedStatic: 'block' | 'allow';
|
|
99
|
+
}[];
|
|
100
|
+
}
|
|
101
|
+
export interface PlanResolution {
|
|
102
|
+
readonly package: GraphPackageIdentity;
|
|
103
|
+
readonly admission: GraphPackageAdmission;
|
|
104
|
+
readonly executionLanes: readonly ExecutionLaneResolution[];
|
|
105
|
+
readonly preflight?: RunPreflightPolicy;
|
|
106
|
+
}
|
|
107
|
+
export interface ResolvedExecutionLane extends ExecutionLaneDescription {
|
|
108
|
+
readonly effective: ExecutionTarget;
|
|
109
|
+
readonly fallbacks: readonly ExecutionTarget[];
|
|
110
|
+
}
|
|
111
|
+
export interface ResolvedPlan {
|
|
112
|
+
readonly schemaVersion: 1;
|
|
113
|
+
readonly graph: GraphDescription['graph'];
|
|
114
|
+
readonly package: GraphPackageIdentity;
|
|
115
|
+
readonly inputContract: JsonValue;
|
|
116
|
+
readonly outputContract: JsonValue;
|
|
117
|
+
readonly phases: readonly GraphPhaseDescription[];
|
|
118
|
+
readonly nodes: readonly GraphNodeDescription[];
|
|
119
|
+
readonly edges: readonly GraphEdgeDescription[];
|
|
120
|
+
readonly policies: GraphPolicyDescription;
|
|
121
|
+
readonly executionLanes: readonly ResolvedExecutionLane[];
|
|
122
|
+
readonly preflight?: RunPreflightPolicy;
|
|
123
|
+
readonly permissions: {
|
|
124
|
+
readonly requested: readonly PermissionDescriptor[];
|
|
125
|
+
readonly admitted: readonly PermissionDescriptor[];
|
|
126
|
+
};
|
|
127
|
+
readonly bounds: GraphBounds;
|
|
128
|
+
readonly requirements: GraphRequirements;
|
|
129
|
+
}
|
|
130
|
+
export interface ResolvedPlanSnapshot {
|
|
131
|
+
readonly plan: ResolvedPlan;
|
|
132
|
+
readonly canonicalJson: string;
|
|
133
|
+
readonly digest: Sha256Digest;
|
|
134
|
+
}
|
|
135
|
+
/** Validate and freeze a resolved plan read from storage. */
|
|
136
|
+
export declare function validateResolvedPlan(value: unknown): ResolvedPlan;
|
|
137
|
+
/** Validate and freeze the stable data returned by a graph type. */
|
|
138
|
+
export declare function validateGraphDescription(value: unknown): GraphDescription;
|
|
139
|
+
/** Bind a pure plan description to host admission and effective engines. */
|
|
140
|
+
export declare function resolveGraphPlan(value: GraphDescription, input: PlanResolution): ResolvedPlanSnapshot;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Memory } from './memory-types.js';
|
|
2
|
+
import type { GraphCommand } from './graph-commands.js';
|
|
3
|
+
import type { CompiledGraphDefinition, GraphDefinition, GraphKernel, NodeId, GraphValidationIssue } from './graph-contract.js';
|
|
4
|
+
import type { GraphRequirements, GraphDescriptionInput, GraphDescription } from './graph-plan.js';
|
|
5
|
+
import type { JsonObject, JsonValue } from './json.js';
|
|
6
|
+
export interface GraphEvent<Type extends string = string, Payload extends JsonValue = JsonValue> {
|
|
7
|
+
readonly type: Type;
|
|
8
|
+
readonly version: number;
|
|
9
|
+
readonly payload: Payload;
|
|
10
|
+
}
|
|
11
|
+
export interface GraphEngineIdentity extends JsonObject {
|
|
12
|
+
readonly adapter: string;
|
|
13
|
+
readonly provider: string | null;
|
|
14
|
+
readonly modelFamily: string | null;
|
|
15
|
+
readonly model: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface EngineAttemptRecordedPayload extends JsonObject {
|
|
18
|
+
readonly nodeId: NodeId;
|
|
19
|
+
readonly position: string;
|
|
20
|
+
readonly sequence: number;
|
|
21
|
+
readonly requested: GraphEngineIdentity | null;
|
|
22
|
+
readonly effective: GraphEngineIdentity | null;
|
|
23
|
+
}
|
|
24
|
+
export type GraphBindings<Requirements extends GraphRequirements> = 'required' extends Requirements['memory'] ? {
|
|
25
|
+
readonly memory: Memory;
|
|
26
|
+
} : {
|
|
27
|
+
readonly memory?: never;
|
|
28
|
+
};
|
|
29
|
+
export interface GraphTypeCompilation<State extends JsonValue = JsonValue, Event extends GraphEvent = GraphEvent, Requirements extends GraphRequirements = GraphRequirements> {
|
|
30
|
+
readonly requirements: Requirements;
|
|
31
|
+
initialState(): State;
|
|
32
|
+
reduce(state: State, event: Event): State;
|
|
33
|
+
decide(state: State): readonly GraphCommand[];
|
|
34
|
+
describe(): GraphDescriptionInput;
|
|
35
|
+
validateNodeResult?(nodeId: NodeId, result: JsonValue): GraphValidationIssue | null;
|
|
36
|
+
}
|
|
37
|
+
export interface CompiledGraphType<Definition extends GraphDefinition = GraphDefinition, State extends JsonValue = JsonValue, Event extends GraphEvent = GraphEvent, Requirements extends GraphRequirements = GraphRequirements> extends Omit<GraphTypeCompilation<State, Event, Requirements>, 'describe'> {
|
|
38
|
+
readonly definition: CompiledGraphDefinition<Definition>;
|
|
39
|
+
describe(): GraphDescription;
|
|
40
|
+
}
|
|
41
|
+
export interface GraphType<Definition extends GraphDefinition = GraphDefinition, State extends JsonValue = JsonValue, Event extends GraphEvent = GraphEvent, Requirements extends GraphRequirements = GraphRequirements> {
|
|
42
|
+
readonly kind: string;
|
|
43
|
+
readonly version: number;
|
|
44
|
+
compile(definition: Definition, kernel: GraphKernel<Definition>): GraphTypeCompilation<State, Event, Requirements>;
|
|
45
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export * from './contracts.js';
|
|
2
|
+
export * from './action-decision.js';
|
|
3
|
+
export type { TokenLimitMode, TokenAllowance, AttemptBudgetPolicy, TokenBudgetSnapshot, BudgetReservation, TokenBudget, } from './budget.js';
|
|
4
|
+
export * from './error.js';
|
|
5
|
+
export type { Environment, EnvHandle, EnvironmentWorkspace } from './environment.js';
|
|
6
|
+
export * from './result.js';
|
|
7
|
+
export * from './memory-types.js';
|
|
8
|
+
export * from './graph-contract.js';
|
|
9
|
+
export * from './graph-commands.js';
|
|
10
|
+
export * from './graph-type.js';
|
|
11
|
+
export * from './result-contract.js';
|
|
12
|
+
export * from './node-data-context.js';
|
|
13
|
+
export * from './preflight-result.js';
|
|
14
|
+
export * from './graph-executor.js';
|
|
15
|
+
export { compileGraphDefinition } from './graph-kernel.js';
|
|
16
|
+
export * from './graph-plan.js';
|
|
17
|
+
export * from './json.js';
|
|
18
|
+
export * from './events/envelope.js';
|
|
19
|
+
export * from './events/store.js';
|
|
20
|
+
export * from './artifacts/store.js';
|
|
21
|
+
export * from './storage/error.js';
|
|
22
|
+
export * from './workspace/provider.js';
|
|
23
|
+
export * from './workspace/policy.js';
|
|
24
|
+
export * from './callback/gate.js';
|
|
25
|
+
export * from './callback/client-contract.js';
|
|
26
|
+
export type { NewCallbackHistoryEvent, StoredCallbackClient } from './callback/stored-client.js';
|
|
27
|
+
export { ApprovalSubjectError, approvalSubjectDigest, createApprovalCallbackGate, validateApprovalRecord, validateApprovalSubject, snapshotApprovalSubject, assertApprovalPermissionsAdmitted, type ApprovalSubmission, type ApprovalSubjectInput, type ApprovalResolutionInput, type ApprovalSubject, type ApprovalBinding, type ApprovalRecord, type ApprovalEventPayload, type NewApprovalEvent, type PrepareApprovalRecordInput, } from './callback/approval.js';
|
|
28
|
+
export type { ProofArtifactReference } from './proof/artifact.js';
|
|
29
|
+
export type { CachedProofPacket, ProofCache, ProofCacheCurrentBinding, ProofCacheOptions, ProofJob, ProofPacket, ProofPacketSource, ProofSource, } from './proof/cache.js';
|
|
30
|
+
export { acceptedResultMatches, validateAcceptedResultRecord, type AcceptedResultGraph, type AcceptedResultBindingInput, type AcceptedResultBinding, type AcceptedResultRecord, type AcceptedResultEventPayload, type NewAcceptedResultEvent, type CreateAcceptedResultRecordInput, type AcceptedResultResolution, } from './proof/acceptance.js';
|
|
31
|
+
export { validateRunDefinition, validateRunStartRecord, validateRunStoragePolicy, validateRunStorageRecord, type StorageProviderRecord, type SensitiveContentPolicy, type RunStoragePolicy, type RunStorageRecord, type RunDefinition, type RunStartedPayload, type NewRunStartedEvent, type RunStartRecord, type RunStorageBinding, } from './run-definition.js';
|
|
32
|
+
export { modelIdentity, type ModelIdentity } from './model-identity.js';
|
|
33
|
+
export type { ReasoningEvent, ReasoningMessage, ReasoningOutcome, ReasoningRecorder, } from './reasoning-record-contract.js';
|