@skastr0/prism-linux-x64 0.5.0 → 0.7.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/bin/prism CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bin/prism
3
- size: 128313472 bytes
4
- sha256: c3f3b145783ed51055b3d44063d1c8760effa404360663289677544ce6e86e46
3
+ size: 128292992 bytes
4
+ sha256: 356a51f5881c6ee77ad7ecf65ab7a10736348bd226d9a3e9f5196a40054e2680
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skastr0/prism-linux-x64",
3
- "version": "0.5.0",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "description": "Prism standalone CLI binary for Linux x64.",
6
6
  "license": "MIT",
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@opencode-ai/plugin": "^1.15.13",
21
- "@skastr0/prism-sdk": "0.5.0",
22
- "effect": "^3.21.1",
21
+ "@skastr0/prism-sdk": "0.7.1",
22
+ "effect": "4.0.0-rc.115",
23
23
  "typescript": "^5.8.3",
24
24
  "zod": "4.4.3"
25
25
  },
@@ -8,105 +8,83 @@
8
8
  */
9
9
  import { Schema } from "effect";
10
10
  import type { PluginManifestError } from "../errors.js";
11
- declare const SourceParseError_base: Schema.TaggedErrorClass<SourceParseError, "SourceParseError", {
12
- readonly _tag: Schema.tag<"SourceParseError">;
13
- } & {
14
- sourcePath: typeof Schema.String;
15
- kind: Schema.Literal<["identity", "personality", "agent", "modelspace", "skillspace", "sop", "tool", "hook"]>;
16
- message: typeof Schema.String;
17
- }>;
11
+ declare const SourceParseError_base: Schema.Class<SourceParseError, Schema.TaggedStruct<"SourceParseError", {
12
+ readonly sourcePath: Schema.String;
13
+ readonly kind: Schema.Literals<readonly ["identity", "personality", "agent", "modelspace", "skillspace", "sop", "tool", "hook"]>;
14
+ readonly message: Schema.String;
15
+ }>, import("effect/Cause").YieldableError>;
18
16
  export declare class SourceParseError extends SourceParseError_base {
19
17
  }
20
- declare const UnknownReferenceError_base: Schema.TaggedErrorClass<UnknownReferenceError, "UnknownReferenceError", {
21
- readonly _tag: Schema.tag<"UnknownReferenceError">;
22
- } & {
23
- agentName: typeof Schema.String;
24
- sourcePath: typeof Schema.String;
25
- field: Schema.Literal<["identity", "personality", "model", "skill", "phase.agent"]>;
26
- referenceName: typeof Schema.String;
27
- }>;
18
+ declare const UnknownReferenceError_base: Schema.Class<UnknownReferenceError, Schema.TaggedStruct<"UnknownReferenceError", {
19
+ readonly agentName: Schema.String;
20
+ readonly sourcePath: Schema.String;
21
+ readonly field: Schema.Literals<readonly ["identity", "personality", "model", "skill", "phase.agent"]>;
22
+ readonly referenceName: Schema.String;
23
+ }>, import("effect/Cause").YieldableError>;
28
24
  export declare class UnknownReferenceError extends UnknownReferenceError_base {
29
25
  }
30
- declare const UnknownDependencyError_base: Schema.TaggedErrorClass<UnknownDependencyError, "UnknownDependencyError", {
31
- readonly _tag: Schema.tag<"UnknownDependencyError">;
32
- } & {
33
- sourcePath: typeof Schema.String;
34
- referenceName: typeof Schema.String;
35
- depPrefix: typeof Schema.String;
36
- declaredDeps: Schema.Array$<typeof Schema.String>;
37
- }>;
26
+ declare const UnknownDependencyError_base: Schema.Class<UnknownDependencyError, Schema.TaggedStruct<"UnknownDependencyError", {
27
+ readonly sourcePath: Schema.String;
28
+ readonly referenceName: Schema.String;
29
+ readonly depPrefix: Schema.String;
30
+ readonly declaredDeps: Schema.$Array<Schema.String>;
31
+ }>, import("effect/Cause").YieldableError>;
38
32
  export declare class UnknownDependencyError extends UnknownDependencyError_base {
39
33
  }
40
- declare const DependencyCycleError_base: Schema.TaggedErrorClass<DependencyCycleError, "DependencyCycleError", {
41
- readonly _tag: Schema.tag<"DependencyCycleError">;
42
- } & {
43
- cycle: Schema.Array$<typeof Schema.String>;
44
- }>;
34
+ declare const DependencyCycleError_base: Schema.Class<DependencyCycleError, Schema.TaggedStruct<"DependencyCycleError", {
35
+ readonly cycle: Schema.$Array<Schema.String>;
36
+ }>, import("effect/Cause").YieldableError>;
45
37
  export declare class DependencyCycleError extends DependencyCycleError_base {
46
38
  }
47
- declare const UnknownTargetError_base: Schema.TaggedErrorClass<UnknownTargetError, "UnknownTargetError", {
48
- readonly _tag: Schema.tag<"UnknownTargetError">;
49
- } & {
50
- target: typeof Schema.String;
51
- supportedTargets: Schema.Array$<typeof Schema.String>;
52
- }>;
39
+ declare const UnknownTargetError_base: Schema.Class<UnknownTargetError, Schema.TaggedStruct<"UnknownTargetError", {
40
+ readonly target: Schema.String;
41
+ readonly supportedTargets: Schema.$Array<Schema.String>;
42
+ }>, import("effect/Cause").YieldableError>;
53
43
  export declare class UnknownTargetError extends UnknownTargetError_base {
54
44
  }
55
- declare const InvalidTargetScopeError_base: Schema.TaggedErrorClass<InvalidTargetScopeError, "InvalidTargetScopeError", {
56
- readonly _tag: Schema.tag<"InvalidTargetScopeError">;
57
- } & {
58
- target: typeof Schema.String;
59
- scope: typeof Schema.String;
60
- message: typeof Schema.String;
61
- }>;
45
+ declare const InvalidTargetScopeError_base: Schema.Class<InvalidTargetScopeError, Schema.TaggedStruct<"InvalidTargetScopeError", {
46
+ readonly target: Schema.String;
47
+ readonly scope: Schema.String;
48
+ readonly message: Schema.String;
49
+ }>, import("effect/Cause").YieldableError>;
62
50
  export declare class InvalidTargetScopeError extends InvalidTargetScopeError_base {
63
51
  }
64
- declare const UnsupportedTargetCapabilityError_base: Schema.TaggedErrorClass<UnsupportedTargetCapabilityError, "UnsupportedTargetCapabilityError", {
65
- readonly _tag: Schema.tag<"UnsupportedTargetCapabilityError">;
66
- } & {
67
- target: typeof Schema.String;
68
- capability: Schema.Literal<["compiled-agents", "hooks"]>;
69
- message: typeof Schema.String;
70
- }>;
52
+ declare const UnsupportedTargetCapabilityError_base: Schema.Class<UnsupportedTargetCapabilityError, Schema.TaggedStruct<"UnsupportedTargetCapabilityError", {
53
+ readonly target: Schema.String;
54
+ readonly capability: Schema.Literals<readonly ["compiled-agents", "hooks"]>;
55
+ readonly message: Schema.String;
56
+ }>, import("effect/Cause").YieldableError>;
71
57
  export declare class UnsupportedTargetCapabilityError extends UnsupportedTargetCapabilityError_base {
72
58
  }
73
- declare const AgentValidationError_base: Schema.TaggedErrorClass<AgentValidationError, "AgentValidationError", {
74
- readonly _tag: Schema.tag<"AgentValidationError">;
75
- } & {
76
- sourcePath: typeof Schema.String;
77
- agentName: typeof Schema.String;
78
- field: typeof Schema.String;
79
- message: typeof Schema.String;
80
- }>;
59
+ declare const AgentValidationError_base: Schema.Class<AgentValidationError, Schema.TaggedStruct<"AgentValidationError", {
60
+ readonly sourcePath: Schema.String;
61
+ readonly agentName: Schema.String;
62
+ readonly field: Schema.String;
63
+ readonly message: Schema.String;
64
+ }>, import("effect/Cause").YieldableError>;
81
65
  export declare class AgentValidationError extends AgentValidationError_base {
82
66
  }
83
- declare const DuplicateNameError_base: Schema.TaggedErrorClass<DuplicateNameError, "DuplicateNameError", {
84
- readonly _tag: Schema.tag<"DuplicateNameError">;
85
- } & {
86
- kind: Schema.Literal<["identity", "personality", "agent", "modelspace", "skillspace", "sop", "tool", "hook"]>;
87
- name: typeof Schema.String;
88
- firstPath: typeof Schema.String;
89
- secondPath: typeof Schema.String;
90
- }>;
67
+ declare const DuplicateNameError_base: Schema.Class<DuplicateNameError, Schema.TaggedStruct<"DuplicateNameError", {
68
+ readonly kind: Schema.Literals<readonly ["identity", "personality", "agent", "modelspace", "skillspace", "sop", "tool", "hook"]>;
69
+ readonly name: Schema.String;
70
+ readonly firstPath: Schema.String;
71
+ readonly secondPath: Schema.String;
72
+ }>, import("effect/Cause").YieldableError>;
91
73
  export declare class DuplicateNameError extends DuplicateNameError_base {
92
74
  }
93
- declare const AgentNameMismatchError_base: Schema.TaggedErrorClass<AgentNameMismatchError, "AgentNameMismatchError", {
94
- readonly _tag: Schema.tag<"AgentNameMismatchError">;
95
- } & {
96
- sourcePath: typeof Schema.String;
97
- fileStem: typeof Schema.String;
98
- agentName: typeof Schema.String;
99
- }>;
75
+ declare const AgentNameMismatchError_base: Schema.Class<AgentNameMismatchError, Schema.TaggedStruct<"AgentNameMismatchError", {
76
+ readonly sourcePath: Schema.String;
77
+ readonly fileStem: Schema.String;
78
+ readonly agentName: Schema.String;
79
+ }>, import("effect/Cause").YieldableError>;
100
80
  export declare class AgentNameMismatchError extends AgentNameMismatchError_base {
101
81
  }
102
- declare const MissingTargetResolutionError_base: Schema.TaggedErrorClass<MissingTargetResolutionError, "MissingTargetResolutionError", {
103
- readonly _tag: Schema.tag<"MissingTargetResolutionError">;
104
- } & {
105
- agentName: typeof Schema.String;
106
- referenceKind: Schema.Literal<["model-profile", "skill"]>;
107
- referenceName: typeof Schema.String;
108
- target: typeof Schema.String;
109
- }>;
82
+ declare const MissingTargetResolutionError_base: Schema.Class<MissingTargetResolutionError, Schema.TaggedStruct<"MissingTargetResolutionError", {
83
+ readonly agentName: Schema.String;
84
+ readonly referenceKind: Schema.Literals<readonly ["model-profile", "skill"]>;
85
+ readonly referenceName: Schema.String;
86
+ readonly target: Schema.String;
87
+ }>, import("effect/Cause").YieldableError>;
110
88
  export declare class MissingTargetResolutionError extends MissingTargetResolutionError_base {
111
89
  }
112
90
  export type CompileError = SourceParseError | UnknownReferenceError | AgentValidationError | UnknownTargetError | InvalidTargetScopeError | UnsupportedTargetCapabilityError | DuplicateNameError | AgentNameMismatchError | MissingTargetResolutionError | UnknownDependencyError | DependencyCycleError | PluginManifestError;
@@ -5,16 +5,18 @@
5
5
  *
6
6
  * Supports the bounded schema feature set used in contracts:
7
7
  *
8
- * - StringKeyword, NumberKeyword, BooleanKeyword, UnknownKeyword
9
- * - Literal (single) and Union of Literals (enum)
10
- * - TupleType with rest (arrays)
11
- * - TypeLiteral (nested structs)
12
- * - Refinement and Transformation (unwrapped; brands preserved via description)
13
- * - optional fields
8
+ * - String, Number, Boolean, Null
9
+ * - Unknown, Any (rendered honestly as z.unknown(): any JSON value)
10
+ * - Literal (single), Union of Literals (enum), and general unions (z.union)
11
+ * - Arrays with a single rest element (arrays)
12
+ * - Objects (nested structs), including optional fields
13
+ * - Records (`Schema.Record`) including mixed struct+index objects (catchall)
14
+ * - checks (refinements) and encodings (transformations) are rendered as
15
+ * their wire shape
16
+ * - nominal brands add no runtime validation and are not emitted
14
17
  *
15
- * Annotations flow through: a field's Schema.annotations({ description }) is
16
- * emitted as .describe(...) on the tool schema node so the LLM sees the
17
- * contract's own documentation.
18
+ * A field's Schema.annotate({ description }) is emitted as .describe(...) on the
19
+ * tool schema node so the LLM sees the contract's own documentation.
18
20
  */
19
21
  import { tool } from "@opencode-ai/plugin";
20
22
  import { Schema } from "effect";
@@ -51,11 +53,12 @@ export interface ToolRuntimeContext {
51
53
  * Convert a top-level Schema.Struct to the args record opencode expects.
52
54
  * Throws at plugin load time if the top-level schema is not a struct.
53
55
  */
54
- export declare const toolArgsFromSchema: (schema: Schema.Schema.Any) => Record<string, ZodNode>;
56
+ export declare const toolArgsFromSchema: (schema: Schema.Top) => Record<string, ZodNode>;
55
57
  /**
56
58
  * Decode raw tool-call args against the contract's Input schema. Throws a
57
59
  * clear error if decoding fails; the error propagates back to the LLM as the
58
- * tool call's failure message.
60
+ * tool call's failure message. Strict on excess properties: a misspelled
61
+ * field is a typo to surface, not noise to strip.
59
62
  */
60
- export declare const decodeInput: <A, I, R>(schema: Schema.Schema<A, I, R>, raw: unknown) => A;
63
+ export declare const decodeInput: <S extends Schema.Codec<unknown, unknown, never, never>>(schema: S, raw: unknown) => S["Type"];
61
64
  export {};
package/types/errors.d.ts CHANGED
@@ -16,15 +16,13 @@
16
16
  */
17
17
  import { Schema } from "effect";
18
18
  import { type CompileError } from "./compile/errors.js";
19
- declare const PluginManifestError_base: Schema.TaggedErrorClass<PluginManifestError, "PluginManifestError", {
20
- readonly _tag: Schema.tag<"PluginManifestError">;
21
- } & {
22
- pluginPath: typeof Schema.String;
23
- manifestPath: typeof Schema.String;
24
- pluginLabel: typeof Schema.String;
25
- summary: typeof Schema.String;
26
- details: Schema.Array$<typeof Schema.String>;
27
- }>;
19
+ declare const PluginManifestError_base: Schema.Class<PluginManifestError, Schema.TaggedStruct<"PluginManifestError", {
20
+ readonly pluginPath: Schema.String;
21
+ readonly manifestPath: Schema.String;
22
+ readonly pluginLabel: Schema.String;
23
+ readonly summary: Schema.String;
24
+ readonly details: Schema.$Array<Schema.String>;
25
+ }>, import("effect/Cause").YieldableError>;
28
26
  export declare class PluginManifestError extends PluginManifestError_base {
29
27
  /**
30
28
  * Build a manifest error from just a plugin path + summary, deriving the
@@ -35,39 +33,31 @@ export declare class PluginManifestError extends PluginManifestError_base {
35
33
  }): PluginManifestError;
36
34
  get message(): string;
37
35
  }
38
- declare const PrismConfigError_base: Schema.TaggedErrorClass<PrismConfigError, "PrismConfigError", {
39
- readonly _tag: Schema.tag<"PrismConfigError">;
40
- } & {
41
- message: typeof Schema.String;
42
- }>;
36
+ declare const PrismConfigError_base: Schema.Class<PrismConfigError, Schema.TaggedStruct<"PrismConfigError", {
37
+ readonly message: Schema.String;
38
+ }>, import("effect/Cause").YieldableError>;
43
39
  export declare class PrismConfigError extends PrismConfigError_base {
44
40
  }
45
- declare const BundleBuildError_base: Schema.TaggedErrorClass<BundleBuildError, "BundleBuildError", {
46
- readonly _tag: Schema.tag<"BundleBuildError">;
47
- } & {
48
- bundleKind: typeof Schema.String;
49
- diagnostics: typeof Schema.String;
50
- }>;
41
+ declare const BundleBuildError_base: Schema.Class<BundleBuildError, Schema.TaggedStruct<"BundleBuildError", {
42
+ readonly bundleKind: Schema.String;
43
+ readonly diagnostics: Schema.String;
44
+ }>, import("effect/Cause").YieldableError>;
51
45
  export declare class BundleBuildError extends BundleBuildError_base {
52
46
  get message(): string;
53
47
  }
54
- declare const BlockedTargetError_base: Schema.TaggedErrorClass<BlockedTargetError, "BlockedTargetError", {
55
- readonly _tag: Schema.tag<"BlockedTargetError">;
56
- } & {
57
- targetPath: typeof Schema.String;
58
- plugin: typeof Schema.String;
59
- hint: typeof Schema.String;
60
- }>;
48
+ declare const BlockedTargetError_base: Schema.Class<BlockedTargetError, Schema.TaggedStruct<"BlockedTargetError", {
49
+ readonly targetPath: Schema.String;
50
+ readonly plugin: Schema.String;
51
+ readonly hint: Schema.String;
52
+ }>, import("effect/Cause").YieldableError>;
61
53
  export declare class BlockedTargetError extends BlockedTargetError_base {
62
54
  get message(): string;
63
55
  }
64
- declare const PathConflictError_base: Schema.TaggedErrorClass<PathConflictError, "PathConflictError", {
65
- readonly _tag: Schema.tag<"PathConflictError">;
66
- } & {
67
- targetPath: typeof Schema.String;
68
- firstPlugin: typeof Schema.String;
69
- secondPlugin: typeof Schema.String;
70
- }>;
56
+ declare const PathConflictError_base: Schema.Class<PathConflictError, Schema.TaggedStruct<"PathConflictError", {
57
+ readonly targetPath: Schema.String;
58
+ readonly firstPlugin: Schema.String;
59
+ readonly secondPlugin: Schema.String;
60
+ }>, import("effect/Cause").YieldableError>;
71
61
  export declare class PathConflictError extends PathConflictError_base {
72
62
  get message(): string;
73
63
  }
package/types/index.d.ts CHANGED
@@ -10,6 +10,7 @@
10
10
  *
11
11
  * These helpers are identity constructors for authoring ergonomics.
12
12
  */
13
+ export * from "./jev.js";
13
14
  export * from "./workflow-errors.js";
14
15
  export * from "./workflow-harness-detection.js";
15
16
  export * from "./workflows.js";
@@ -43,7 +44,7 @@ export interface SkillspaceRefDefinition {
43
44
  export type AgentRefInput = string | AgentRefDefinition;
44
45
  export type ModelProfileRefInput = string | ModelProfileRefDefinition;
45
46
  export type SkillRefInput = SkillRefDefinition | SkillspaceRefDefinition;
46
- export type EffectSchemaValue = import("effect").Schema.Schema.AnyNoContext;
47
+ export type EffectSchemaValue = import("effect").Schema.Top;
47
48
  export interface AgentDefinition {
48
49
  readonly name: string;
49
50
  readonly description: string;
package/types/jev.d.ts ADDED
@@ -0,0 +1,254 @@
1
+ /**
2
+ * Jev (TypeSafe System One) vocabulary for Prism: question constructors,
3
+ * request validation/normalization, and request-correlated result codecs.
4
+ *
5
+ * This module is pure: no services, no environment access, no network. The
6
+ * wire contract is verified against `@typesafe-ai/sdk` v0.6.0 (`src/types.ts`)
7
+ * — these types are readonly mirrors of that contract, not a second
8
+ * interpretation of System One.
9
+ *
10
+ * Terminology follows the SDK and docs.typesafe.ai verbatim:
11
+ * - A *state* is the content evaluated (`EntryType`): string, JSON object,
12
+ * JSON array, or null — never a bare boolean/number at the top level.
13
+ * - *Questions* are named, independent judgments over one shared state:
14
+ * `choice` (which option), `score` (which rubric level), `noul`
15
+ * (probability of yes). All questions in one request see the same state and
16
+ * are evaluated independently — batching many questions per request is the
17
+ * platform idiom (docs: 13 questions in one call = 12.2x cheaper, 10x
18
+ * faster, byte-identical answers).
19
+ * - Answers are typed per question and constrained to the supplied criteria:
20
+ * choice `{choice, confidence, probabilities}`, score `{score, confidence,
21
+ * legend, probabilities}`, noul `{noul}`. Noul has no separate confidence.
22
+ *
23
+ * The request's token budget (~32k tokens, state and questions share it) is
24
+ * enforced pre-flight by the service layer in `src/services/jev.ts`; this
25
+ * module owns the estimator so tool handlers and workflows share one oracle.
26
+ */
27
+ import { Schema } from "effect";
28
+ /** Any JSON value. Readonly because decoded workflow data is readonly. */
29
+ export type JevJson = null | boolean | number | string | readonly JevJson[] | {
30
+ readonly [key: string]: JevJson;
31
+ };
32
+ /**
33
+ * A System One entry: text, a JSON object or array, or null. Bare booleans
34
+ * and numbers are excluded at the top level, matching the SDK's `EntryType`.
35
+ */
36
+ export type JevEntry = null | string | readonly JevJson[] | {
37
+ readonly [key: string]: JevJson;
38
+ };
39
+ /** Choice labels mapped to descriptions (`null` leaves a label undescribed). */
40
+ export type JevChoiceCriteria = Readonly<Record<string, JevEntry>>;
41
+ /** An ordered rubric with at least two levels. */
42
+ export type JevScoreCriteria = readonly [JevEntry, JevEntry, ...JevEntry[]];
43
+ /** A question that selects between named alternatives. */
44
+ export interface JevChoiceQuestion<Criteria extends JevChoiceCriteria = JevChoiceCriteria> {
45
+ readonly type: "choice";
46
+ readonly instructions?: JevEntry;
47
+ readonly criteria: Criteria;
48
+ }
49
+ /** A question that assigns an ordered-rubric score. */
50
+ export interface JevScoreQuestion<Criteria extends JevScoreCriteria = JevScoreCriteria> {
51
+ readonly type: "score";
52
+ readonly instructions?: JevEntry;
53
+ readonly criteria: Criteria;
54
+ }
55
+ /** A yes/no question answered as a probability of yes. */
56
+ export interface JevNoulQuestion {
57
+ readonly type: "noul";
58
+ readonly instructions?: JevEntry;
59
+ readonly criteria?: {
60
+ readonly true?: JevEntry;
61
+ readonly false?: JevEntry;
62
+ } | null;
63
+ }
64
+ export type JevQuestion = JevChoiceQuestion | JevScoreQuestion | JevNoulQuestion;
65
+ /** Questions keyed by the author-chosen IDs identifying their answers. */
66
+ export type JevQuestions = Readonly<Record<string, JevQuestion>>;
67
+ /** Rubric index keys for a concrete score criteria tuple. */
68
+ export type JevScoreKey<C extends JevScoreCriteria> = number extends C["length"] ? number : Extract<keyof C, `${number}`>;
69
+ /** The answer type for a question, preserving its criteria keys. */
70
+ export type JevResultFor<Q extends JevQuestion> = Q extends JevChoiceQuestion<infer C> ? {
71
+ readonly type: "choice";
72
+ readonly choice: `${keyof C & (string | number)}`;
73
+ readonly confidence: number;
74
+ readonly probabilities: {
75
+ readonly [K in keyof C]: number;
76
+ };
77
+ } : Q extends JevScoreQuestion<infer C> ? {
78
+ readonly type: "score";
79
+ readonly score: number;
80
+ readonly confidence: number;
81
+ readonly legend: {
82
+ readonly [K in JevScoreKey<C>]: C[K];
83
+ };
84
+ readonly probabilities: {
85
+ readonly [K in JevScoreKey<C>]: number;
86
+ };
87
+ } : Q extends JevNoulQuestion ? {
88
+ readonly type: "noul";
89
+ readonly noul: number;
90
+ } : never;
91
+ /** Answers keyed by question ID, typed per question. */
92
+ export type JevAnswers<Q extends JevQuestions> = {
93
+ readonly [K in keyof Q]: JevResultFor<Q[K]>;
94
+ };
95
+ /** Token usage for a request. */
96
+ export interface JevUsage {
97
+ readonly input_tokens: number;
98
+ readonly output_tokens: number;
99
+ }
100
+ /** The full System One result: answers with model and usage metadata. */
101
+ export interface JevResult<Q extends JevQuestions> {
102
+ readonly model: string;
103
+ readonly answers: JevAnswers<Q>;
104
+ readonly usage: JevUsage;
105
+ }
106
+ /** State and named questions for one System One call. */
107
+ export interface JevRequest<Q extends JevQuestions = JevQuestions> {
108
+ readonly state: JevEntry;
109
+ readonly questions: Q;
110
+ readonly model?: string;
111
+ }
112
+ export declare class JevRequestValidationError extends Error {
113
+ readonly reason: string;
114
+ readonly path?: string | undefined;
115
+ readonly name = "JevRequestValidationError";
116
+ constructor(reason: string, path?: string | undefined);
117
+ }
118
+ /**
119
+ * Validate a System One entry (state, instructions, criterion description),
120
+ * returning a deep-frozen deep copy. Mirrors the SDK's `EntryType`: string,
121
+ * plain JSON object/array, or null.
122
+ */
123
+ export declare const normalizeJevEntry: (value: unknown, path?: string) => JevEntry;
124
+ /**
125
+ * Validate a questions map and return a deep-frozen deep copy with the same
126
+ * static type. At least one question is required.
127
+ */
128
+ export declare const normalizeJevQuestions: <const Q extends JevQuestions>(questions: Q) => Q;
129
+ /**
130
+ * Validate and freeze a full request (state + questions + optional model).
131
+ * Unexpected top-level fields are rejected rather than silently dropped so
132
+ * worker-task fields (prompt/worker/finish) can never leak into a Jev call.
133
+ */
134
+ export declare const normalizeJevRequest: <const Q extends JevQuestions>(request: JevRequest<Q>) => JevRequest<Q>;
135
+ /** Decode an unknown value (e.g. tool CLI input) into a normalized request. */
136
+ export declare const parseJevRequest: (input: unknown) => JevRequest<JevQuestions>;
137
+ /**
138
+ * Documented per-request token budget shared by state and questions
139
+ * (docs.typesafe.ai: "around 32,000 tokens").
140
+ */
141
+ export declare const JEV_TOKEN_BUDGET = 32000;
142
+ /**
143
+ * Soft target Prism enforces pre-flight. Below the hard budget so a request
144
+ * that passes locally still fits after SDK serialization differences.
145
+ */
146
+ export declare const JEV_TOKEN_REQUEST_TARGET = 28000;
147
+ /**
148
+ * Rough request token estimate: JSON payload characters / 4, the standard
149
+ * heuristic. Used only for pre-flight guidance, never as billing data.
150
+ */
151
+ export declare const estimateJevRequestTokens: (request: JevRequest<JevQuestions>) => number;
152
+ export declare function choice<const C extends JevChoiceCriteria>(definition: Omit<JevChoiceQuestion<C>, "type">): JevChoiceQuestion<C>;
153
+ export declare function score<const C extends JevScoreCriteria>(definition: Omit<JevScoreQuestion<C>, "type">): JevScoreQuestion<C>;
154
+ export declare function noul(definition?: Omit<JevNoulQuestion, "type">): JevNoulQuestion;
155
+ /**
156
+ * Result contract version, folded into workflow identity hashing so a change
157
+ * in these codecs invalidates cached outputs deliberately rather than
158
+ * silently.
159
+ */
160
+ export declare const JEV_RESULT_CONTRACT_VERSION: 1;
161
+ /** A service-free codec for the full request-correlated System One result. */
162
+ export type JevResultCodec<Q extends JevQuestions> = Schema.Codec<JevResult<Q>, JevResult<Q>, never, never>;
163
+ /**
164
+ * Derive the result codec for a questions map. Answer keys, choice labels,
165
+ * probability keys, and score legends all come from the request, so a
166
+ * response disagreeing with its own questions fails decode.
167
+ *
168
+ * Localized assertion: the struct is built from runtime key maps whose key
169
+ * sets provably equal `keyof Q` / the criteria keys (same construction loop
170
+ * as `normalizeJevQuestions`), but TypeScript cannot see through
171
+ * `Object.fromEntries`; the cast maps the runtime struct onto
172
+ * `JevResultCodec<Q>`. Covered by runtime decode tests and dsl-type tests.
173
+ */
174
+ export declare const jevResultSchema: <const Q extends JevQuestions>(questions: Q) => JevResultCodec<Q>;
175
+ export declare const JEV_PROBE_MODEL = "jev-probe";
176
+ /**
177
+ * A deterministic, schema-valid System One result used by workflow validation
178
+ * probes, where no live API call is made: every answer selects the first
179
+ * declared criterion (score index 0, noul 0) with a concentrated probability
180
+ * distribution, so branch-sensitive `run:` graphs walk the same stable path on
181
+ * every probe. Always decodes against `jevResultSchema(questions)`. This is a
182
+ * witness, not a simulation of what System One would answer.
183
+ */
184
+ export declare const jevProbeResult: <const Q extends JevQuestions>(questions: Q) => JevResult<Q>;
185
+ export declare const JevQuestionPresentation: Schema.Union<readonly [Schema.Struct<{
186
+ readonly type: Schema.Literal<"choice">;
187
+ readonly instructions: Schema.optionalKey<Schema.Unknown>;
188
+ readonly criteria: Schema.$Record<Schema.String, Schema.Unknown>;
189
+ }>, Schema.Struct<{
190
+ readonly type: Schema.Literal<"score">;
191
+ readonly instructions: Schema.optionalKey<Schema.Unknown>;
192
+ readonly criteria: Schema.$Array<Schema.Unknown>;
193
+ }>, Schema.Struct<{
194
+ readonly type: Schema.Literal<"noul">;
195
+ readonly instructions: Schema.optionalKey<Schema.Unknown>;
196
+ readonly criteria: Schema.optionalKey<Schema.NullOr<Schema.Struct<{
197
+ readonly true: Schema.optionalKey<Schema.Unknown>;
198
+ readonly false: Schema.optionalKey<Schema.Unknown>;
199
+ }>>>;
200
+ }>]>;
201
+ export declare const JevSystemOneInputSchema: Schema.Struct<{
202
+ readonly state: Schema.Unknown;
203
+ readonly questions: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
204
+ readonly type: Schema.Literal<"choice">;
205
+ readonly instructions: Schema.optionalKey<Schema.Unknown>;
206
+ readonly criteria: Schema.$Record<Schema.String, Schema.Unknown>;
207
+ }>, Schema.Struct<{
208
+ readonly type: Schema.Literal<"score">;
209
+ readonly instructions: Schema.optionalKey<Schema.Unknown>;
210
+ readonly criteria: Schema.$Array<Schema.Unknown>;
211
+ }>, Schema.Struct<{
212
+ readonly type: Schema.Literal<"noul">;
213
+ readonly instructions: Schema.optionalKey<Schema.Unknown>;
214
+ readonly criteria: Schema.optionalKey<Schema.NullOr<Schema.Struct<{
215
+ readonly true: Schema.optionalKey<Schema.Unknown>;
216
+ readonly false: Schema.optionalKey<Schema.Unknown>;
217
+ }>>>;
218
+ }>]>>;
219
+ readonly model: Schema.optionalKey<Schema.String>;
220
+ }>;
221
+ /**
222
+ * Jev decode boundaries fail on excess properties rather than stripping
223
+ * them: a misspelled question field (`instruction` vs `instructions`) must
224
+ * not silently vanish from the request, and an answer with extra IDs or
225
+ * probability labels is not a response to the request that was sent. The
226
+ * presentation/result schemas below describe Records partly (probability
227
+ * maps are `Record(String, Number)`), so only struct-level strictness takes
228
+ * effect — the request-correlated literal keys do the rest.
229
+ */
230
+ export declare const JEV_STRICT_PARSE_OPTIONS: {
231
+ onExcessProperty: "error";
232
+ };
233
+ export declare const JevSystemOneResultSchema: Schema.Struct<{
234
+ readonly model: Schema.String;
235
+ readonly answers: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
236
+ readonly type: Schema.Literal<"choice">;
237
+ readonly choice: Schema.String;
238
+ readonly confidence: Schema.Number;
239
+ readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
240
+ }>, Schema.Struct<{
241
+ readonly type: Schema.Literal<"score">;
242
+ readonly score: Schema.Number;
243
+ readonly confidence: Schema.Number;
244
+ readonly legend: Schema.$Record<Schema.String, Schema.Unknown>;
245
+ readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
246
+ }>, Schema.Struct<{
247
+ readonly type: Schema.Literal<"noul">;
248
+ readonly noul: Schema.Number;
249
+ }>]>>;
250
+ readonly usage: Schema.Struct<{
251
+ readonly input_tokens: Schema.Number;
252
+ readonly output_tokens: Schema.Number;
253
+ }>;
254
+ }>;