@skastr0/prism-linux-x64 0.5.1 → 0.8.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.
Files changed (48) hide show
  1. package/bin/prism +2 -2
  2. package/package.json +3 -3
  3. package/types/amp-projects.d.ts +39 -0
  4. package/types/amp-runners.d.ts +71 -0
  5. package/types/ast-to-json-schema.d.ts +46 -0
  6. package/types/compile/errors.d.ts +57 -79
  7. package/types/compile/runtime/schema-bridge.d.ts +15 -12
  8. package/types/errors.d.ts +24 -34
  9. package/types/fs.d.ts +2 -2
  10. package/types/harness-types-discover.d.ts +34 -0
  11. package/types/harness-types.d.ts +12 -0
  12. package/types/index.d.ts +21 -2
  13. package/types/jev.d.ts +254 -0
  14. package/types/lowerer-capabilities.d.ts +104 -118
  15. package/types/prism-home.d.ts +3 -4
  16. package/types/services/jev.d.ts +131 -0
  17. package/types/types.d.ts +3 -13
  18. package/types/workflow-amp-remote-worker.d.ts +69 -0
  19. package/types/workflow-amp-worker.d.ts +89 -0
  20. package/types/workflow-antigravity-pty.d.ts +22 -0
  21. package/types/workflow-antigravity-worker.d.ts +84 -0
  22. package/types/workflow-bun-runtime.d.ts +2 -0
  23. package/types/workflow-claude-worker.d.ts +36 -0
  24. package/types/workflow-cli-command.d.ts +1 -0
  25. package/types/workflow-codex-worker.d.ts +36 -0
  26. package/types/workflow-cursor-worker.d.ts +24 -0
  27. package/types/workflow-devin-worker.d.ts +25 -0
  28. package/types/workflow-effort.d.ts +18 -0
  29. package/types/workflow-grok-worker.d.ts +32 -0
  30. package/types/workflow-harness-detection.d.ts +5 -8
  31. package/types/workflow-hermes-worker.d.ts +28 -0
  32. package/types/workflow-identity.d.ts +35 -6
  33. package/types/workflow-kimi-effort.d.ts +17 -0
  34. package/types/workflow-kimi-worker.d.ts +27 -0
  35. package/types/workflow-omp-worker.d.ts +49 -0
  36. package/types/workflow-opencode-worker.d.ts +26 -0
  37. package/types/workflow-output-schema.d.ts +6 -0
  38. package/types/workflow-permissions.d.ts +10 -0
  39. package/types/workflow-process-guard.d.ts +28 -0
  40. package/types/workflow-runner.d.ts +15 -1
  41. package/types/workflow-scheduler/cron.d.ts +60 -0
  42. package/types/workflow-scheduler/errors.d.ts +71 -0
  43. package/types/workflow-scheduler/schedule.d.ts +61 -0
  44. package/types/workflow-session.d.ts +46 -29
  45. package/types/workflow-store.d.ts +142 -7
  46. package/types/workflow-worker-process.d.ts +40 -0
  47. package/types/workflow-workers.d.ts +50 -0
  48. package/types/workflows.d.ts +204 -23
@@ -1,8 +1,10 @@
1
- import { Effect, Schema } from "effect";
2
- import type { Either } from "effect/Either";
3
- import type { ParseError } from "effect/ParseResult";
1
+ import { Effect, Result, Schema, type SchemaAST } from "effect";
2
+ import { type WorkflowEffortCapabilityFor, type WorkflowEffortWorkerHarnessId, type WorkflowWorkerHarnessId } from "./lowerer-capabilities.js";
4
3
  import { type WorkflowRuntimeError } from "./workflow-errors.js";
4
+ import { type WorkflowSchedule } from "./workflow-scheduler/schedule.js";
5
+ import { type JevEntry, type JevQuestions, type JevRequest, type JevResult, type JevResultCodec } from "./jev.js";
5
6
  export type { WorkflowRuntimeError } from "./workflow-errors.js";
7
+ export { WORKFLOW_SCHEDULE_MISSED_RUN_POLICIES, WORKFLOW_SCHEDULE_OVERLAP_POLICIES, isWorkflowSchedule, parseWorkflowSchedule, type WorkflowSchedule, type WorkflowScheduleMissedRuns, type WorkflowScheduleOverlap, } from "./workflow-scheduler/schedule.js";
6
8
  export interface WorkflowModelRef {
7
9
  readonly modelspace?: string;
8
10
  readonly profile?: string;
@@ -42,9 +44,21 @@ export interface WorkflowValidationSummary {
42
44
  readonly tasks: ReadonlyArray<WorkflowTaskSummary>;
43
45
  readonly dynamic: boolean;
44
46
  }
45
- export type WorkflowOutputSchema = Schema.Schema.AnyNoContext;
47
+ /**
48
+ * Constraint for a workflow task's output schema.
49
+ *
50
+ * The load-bearing part is `never, never`: a task output schema must decode and
51
+ * encode without services. `Type` stays `unknown` so the generic bound cannot
52
+ * silently turn decoded values into `any`.
53
+ *
54
+ * `WorkflowFinishOptions` consumes `Output` in contravariant callback positions,
55
+ * which makes a task invariant in its output type. A heterogeneous task tuple is
56
+ * therefore accepted only where the output type is erased, which happens at
57
+ * `AnyWorkflowTask` rather than here.
58
+ */
59
+ export type WorkflowOutputSchema = Schema.Codec<unknown, unknown, never, never>;
46
60
  export type WorkflowFinishCriterionError = Error;
47
- export type WorkflowWorkerId = "amp-code" | "antigravity-cli" | "claude-code" | "codex-cli" | "cursor" | "devin" | "grok" | "hermes" | "kimi-code" | "opencode" | "opencode2" | "omp";
61
+ export type WorkflowWorkerId = WorkflowWorkerHarnessId;
48
62
  /**
49
63
  * Per-harness model identifier map. Empty in core so `worker.model` stays
50
64
  * `string` until `prism workflow refresh-harness-types` augments keys with
@@ -60,14 +74,56 @@ export interface WorkflowHarnessModelMap {
60
74
  export interface WorkflowHarnessCatalogModelMap {
61
75
  }
62
76
  /**
63
- * Amp reasoning-effort ladders from the catalog. Empty in core; refresh
64
- * augments `"amp-code"` for `worker.effort`.
77
+ * Model-specific reasoning-effort ladders from installed CLI catalogs.
78
+ * Fixed CLI values come from `LOWERER_CAPABILITIES` and are not discovered.
79
+ * Refresh augments only catalog-backed workers.
65
80
  */
66
81
  export interface WorkflowHarnessEffortMap {
67
82
  }
83
+ /**
84
+ * Discovered Amp orb projects (`amp projects list --json`). Empty in core;
85
+ * refresh augments `"amp-orb"` so `worker.project` narrows to known projects.
86
+ */
87
+ export interface WorkflowHarnessProjectMap {
88
+ }
89
+ export type WorkflowHarnessProject<W extends WorkflowWorkerId> = W extends keyof WorkflowHarnessProjectMap ? WorkflowHarnessProjectMap[W] : string;
90
+ /**
91
+ * Discovered Amp runners (`list_runners`, captured by
92
+ * `refresh-harness-types --discover-amp-runners`). Empty in core; refresh
93
+ * augments one key per runner whose value is the union of the directories
94
+ * that runner serves.
95
+ */
96
+ export interface WorkflowHarnessRunnerDirMap {
97
+ }
98
+ /**
99
+ * The `amp-runner` target: with a runner snapshot, a discriminated union over
100
+ * the live runner ids so `runnerDir` follows the chosen id (a directory
101
+ * another runner serves is a type error); without one, both stay plain
102
+ * strings. `validate` enforces the pair again at load time.
103
+ */
104
+ export type AmpRunnerTargetOptions = keyof WorkflowHarnessRunnerDirMap extends never ? {
105
+ /** Runner id from `amp --no-tui --runner-id <id>` (`--executor runner:<id>`). */
106
+ readonly runnerId: string;
107
+ /** Absolute directory the runner serves (`--runner-dir`); defaults to the runner's start directory. */
108
+ readonly runnerDir?: string;
109
+ } : {
110
+ [R in keyof WorkflowHarnessRunnerDirMap]: {
111
+ readonly runnerId: R;
112
+ readonly runnerDir?: WorkflowHarnessRunnerDirMap[R];
113
+ };
114
+ }[keyof WorkflowHarnessRunnerDirMap];
68
115
  export type WorkflowHarnessModel<W extends WorkflowWorkerId> = (W extends keyof WorkflowHarnessModelMap ? WorkflowHarnessModelMap[W] : string) | WorkflowModelProfileRef;
69
116
  export type WorkflowHarnessCatalogModel<W extends WorkflowWorkerId> = W extends keyof WorkflowHarnessCatalogModelMap ? WorkflowHarnessCatalogModelMap[W] : string;
70
- export type WorkflowHarnessEffort<W extends WorkflowWorkerId> = W extends keyof WorkflowHarnessEffortMap ? WorkflowHarnessEffortMap[W] : string;
117
+ type WorkflowHarnessEffortForCapability<W extends WorkflowWorkerId, Capability> = Capability extends {
118
+ readonly kind: "fixed";
119
+ readonly values: readonly (infer Value extends string)[];
120
+ } ? Value : Capability extends {
121
+ readonly kind: "catalog";
122
+ } ? W extends keyof WorkflowHarnessEffortMap ? WorkflowHarnessEffortMap[W] : never : never;
123
+ type WorkflowHarnessEffortForOne<W extends WorkflowWorkerId> = WorkflowHarnessEffortForCapability<W, NonNullable<WorkflowEffortCapabilityFor<W>>>;
124
+ /** Harness-bound effort values; catalog-backed values require a refreshed type map. */
125
+ export type WorkflowHarnessEffort<W extends WorkflowWorkerId> = W extends WorkflowWorkerId ? WorkflowHarnessEffortForOne<W> : never;
126
+ export declare const workflowWorkerSupportsEffort: (worker: unknown) => worker is WorkflowEffortWorkerHarnessId;
71
127
  export type WorkflowPermissionMode = "legacy" | "permissive" | "restricted" | "interactive" | "sandbox-read-only" | "sandbox-workspace-write" | "full-access";
72
128
  /** Workers with no sandbox flag and no per-invocation allowlist. */
73
129
  export type WorkflowDialPermissionMode = Extract<WorkflowPermissionMode, "legacy" | "permissive" | "full-access">;
@@ -77,8 +133,31 @@ export type CodexWorkflowPermissionMode = Extract<WorkflowPermissionMode, "legac
77
133
  export type CursorWorkflowPermissionMode = Extract<WorkflowPermissionMode, "legacy" | "permissive" | "full-access" | "sandbox-workspace-write">;
78
134
  export type DevinWorkflowPermissionMode = Extract<WorkflowPermissionMode, "legacy" | "permissive" | "restricted" | "full-access">;
79
135
  export type OmpWorkflowPermissionMode = Extract<WorkflowPermissionMode, "legacy" | "permissive" | "restricted" | "full-access">;
80
- export type WorkflowWorkerPermissionMode<W extends WorkflowWorkerId> = W extends "claude-code" ? ClaudeWorkflowPermissionMode : W extends "codex-cli" ? CodexWorkflowPermissionMode : W extends "cursor" ? CursorWorkflowPermissionMode : W extends "devin" ? DevinWorkflowPermissionMode : W extends "omp" ? OmpWorkflowPermissionMode : WorkflowDialPermissionMode;
81
136
  export declare const WORKFLOW_SESSION_PERSISTENCE_WORKERS: readonly ["claude-code", "codex-cli", "omp"];
137
+ /** Remote Amp executors: hosted orbs and operator-declared runners. */
138
+ export type AmpRemoteWorkflowWorkerId = Extract<WorkflowWorkerId, "amp-orb" | "amp-runner">;
139
+ /**
140
+ * Workers whose full options can be built from `{ worker, model, ... }` alone.
141
+ * TypeScript's smarter union checking (TS 3.5+) decomposes a wide `worker`
142
+ * discriminant across the options union, so a helper typed against the full
143
+ * {@link WorkflowWorkerId} that cannot supply remote workers' required fields
144
+ * (`project`, `runnerId`) would silently accept remote ids as invalid tasks.
145
+ * Loose helpers must narrow to this.
146
+ */
147
+ export type WorkflowWorkerIdWithoutRequiredOptions = Exclude<WorkflowWorkerId, AmpRemoteWorkflowWorkerId>;
148
+ /**
149
+ * Remote Amp executors (orb, runner) read tool permissions from the remote
150
+ * machine's Amp settings or the ampcode.com project; Prism has no
151
+ * per-invocation override that reaches them.
152
+ */
153
+ export type AmpRemoteWorkflowPermissionMode = Extract<WorkflowPermissionMode, "legacy">;
154
+ export type WorkflowWorkerPermissionMode<W extends WorkflowWorkerId> = W extends "claude-code" ? ClaudeWorkflowPermissionMode : W extends "codex-cli" ? CodexWorkflowPermissionMode : W extends "cursor" ? CursorWorkflowPermissionMode : W extends "devin" ? DevinWorkflowPermissionMode : W extends "omp" ? OmpWorkflowPermissionMode : W extends AmpRemoteWorkflowWorkerId ? AmpRemoteWorkflowPermissionMode : WorkflowDialPermissionMode;
155
+ /** Documented orb sizes (https://ampcode.com/docs/orbs/sizes-and-costs); `a1.3xlarge` needs Gigawatt/Enterprise. */
156
+ export declare const AMP_ORB_SIZES: readonly ["a1.tiny", "a1.small", "a1.medium", "a1.large", "a1.xxlarge", "a1.3xlarge"];
157
+ export type AmpOrbSize = (typeof AMP_ORB_SIZES)[number];
158
+ /** Amp thread visibility values (`--visibility`). */
159
+ export declare const AMP_THREAD_VISIBILITIES: readonly ["private", "unlisted", "workspace", "group"];
160
+ export type AmpThreadVisibility = (typeof AMP_THREAD_VISIBILITIES)[number];
82
161
  export type WorkflowSessionPersistenceWorkerId = typeof WORKFLOW_SESSION_PERSISTENCE_WORKERS[number];
83
162
  export type WorkflowSessionPersistence = "persistent" | "ephemeral";
84
163
  /** @deprecated Use WorkflowSessionPersistence. */
@@ -105,17 +184,46 @@ type WorkflowTaskWorkerOptionsFor<W extends WorkflowWorkerId> = WorkflowTaskWork
105
184
  readonly worker: W;
106
185
  readonly permission?: WorkflowWorkerPermissionMode<W>;
107
186
  } & (W extends "amp-code" ? {
108
- readonly sessionPersistence?: never;
109
187
  readonly catalogModel?: WorkflowHarnessCatalogModel<"amp-code">;
110
- readonly effort?: WorkflowHarnessEffort<"amp-code">;
111
- } : W extends WorkflowSessionPersistenceWorkerId ? {
188
+ } : W extends "amp-runner" ? {
189
+ readonly catalogModel?: WorkflowHarnessCatalogModel<"amp-code">;
190
+ } : {
191
+ readonly catalogModel?: never;
192
+ }) & (W extends WorkflowEffortWorkerHarnessId ? {
193
+ readonly effort?: WorkflowHarnessEffort<W>;
194
+ } : {
195
+ readonly effort?: never;
196
+ }) & (W extends WorkflowSessionPersistenceWorkerId ? {
112
197
  readonly sessionPersistence?: WorkflowSessionPersistence;
113
198
  } : {
114
199
  readonly sessionPersistence?: never;
200
+ }) & (W extends AmpRemoteWorkflowWorkerId ? {
201
+ readonly labels?: ReadonlyArray<string>;
202
+ } : {
203
+ readonly labels?: never;
204
+ }) & (W extends "amp-orb" ? {
205
+ /**
206
+ * Amp project for the orb (`--project`): namespace/name, owner/repo, or repository URL.
207
+ * Narrows to discovered projects after `prism workflow refresh-harness-types`.
208
+ */
209
+ readonly project: WorkflowHarnessProject<"amp-orb">;
210
+ /** `--orb-size`; defaults to the project's size. */
211
+ readonly size?: AmpOrbSize;
212
+ /** Thread visibility; defaults to Amp's own default. Cosmetic: not part of cache identity. */
213
+ readonly visibility?: AmpThreadVisibility;
214
+ } : {
215
+ readonly project?: never;
216
+ readonly size?: never;
217
+ readonly visibility?: never;
218
+ }) & (W extends "amp-runner" ? AmpRunnerTargetOptions : {
219
+ readonly runnerId?: never;
220
+ readonly runnerDir?: never;
115
221
  });
116
222
  export type WorkflowTaskWorkerOptions = (WorkflowTaskWorkerOptionsCommon & {
117
223
  readonly worker?: undefined;
118
224
  readonly permission?: WorkflowPermissionMode;
225
+ readonly catalogModel?: never;
226
+ readonly effort?: never;
119
227
  readonly sessionPersistence?: never;
120
228
  }) | {
121
229
  [W in WorkflowWorkerId]: WorkflowTaskWorkerOptionsFor<W>;
@@ -128,8 +236,10 @@ export interface WorkflowTaskModelResolution {
128
236
  readonly model: string;
129
237
  /** Harness-side inference provider (e.g. hermes `--provider xai-oauth`), from the modelspace target or harness default. */
130
238
  readonly provider?: string;
131
- /** Harness-bound model variant, such as Codex reasoning effort. */
239
+ /** Model-selection variant, such as OpenCode's `provider/model#variant`. */
132
240
  readonly variant?: string;
241
+ /** Harness-bound reasoning effort from a modelspace target. */
242
+ readonly effort?: string;
133
243
  readonly source: WorkflowTaskModelResolutionSource;
134
244
  }
135
245
  /**
@@ -139,11 +249,16 @@ export interface WorkflowTaskModelResolution {
139
249
  * `undefined` so per-worker CLIs that tolerate an omitted --model flag
140
250
  * (e.g. opencode) keep doing so.
141
251
  */
142
- export declare const resolveWorkflowTaskModelResolution: (task: AnyWorkflowTask, options?: {
252
+ export declare const resolveWorkflowTaskModelResolution: (task: AnyWorkflowWorkerTask, options?: {
143
253
  readonly worker?: string;
144
254
  readonly fallbackModel?: string;
145
255
  }) => WorkflowTaskModelResolution | undefined;
146
- export declare const resolveWorkflowTaskModel: (task: AnyWorkflowTask, options?: {
256
+ export declare const resolveWorkflowTaskModel: (task: AnyWorkflowWorkerTask, options?: {
257
+ readonly worker?: string;
258
+ readonly fallbackModel?: string;
259
+ }) => string | undefined;
260
+ /** Task-level effort is the explicit override; modelspace effort is the fallback. */
261
+ export declare const resolveWorkflowTaskEffort: (task: AnyWorkflowWorkerTask, options?: {
147
262
  readonly worker?: string;
148
263
  readonly fallbackModel?: string;
149
264
  }) => string | undefined;
@@ -215,20 +330,66 @@ export interface WorkflowTaskDefinition<Id extends string, Output extends Workfl
215
330
  readonly phase?: string;
216
331
  readonly cacheKey?: string;
217
332
  readonly worker?: WorkflowTaskWorkerOptions;
218
- readonly finish?: WorkflowFinishOptions<Schema.Schema.Type<Output>>;
333
+ readonly finish?: WorkflowFinishOptions<Output["Type"]>;
219
334
  }
220
335
  export type WorkflowTask<Id extends string = string, Output extends WorkflowOutputSchema = WorkflowOutputSchema> = WorkflowTaskDefinition<Id, Output> & {
221
336
  readonly kind: "workflow-task";
222
337
  };
223
- export type AnyWorkflowTask = WorkflowTask<string, WorkflowOutputSchema>;
224
- export type WorkflowTaskOutput<Task extends AnyWorkflowTask> = Schema.Schema.Type<Task["output"]>;
225
- export declare const resolveWorkflowTaskSessionPersistence: (task: Pick<AnyWorkflowTask, "worker">, effectiveWorker?: string | undefined) => WorkflowSessionPersistence | undefined;
226
- export declare const assertWorkflowTaskSessionPersistence: (task: AnyWorkflowTask) => void;
338
+ /**
339
+ * A workflow task whose output type is erased.
340
+ *
341
+ * A task is invariant in its output type (`WorkflowFinishOptions` consumes it in
342
+ * callback positions), so `defineWorkflow({ tasks: [build, review] })` only
343
+ * accepts a heterogeneous tuple when the element bound erases that type. The
344
+ * erasure is deliberately local to this bound: `WorkflowOutputSchema` keeps
345
+ * `unknown` so ordinary authoring and `defineTask` inference stay precise, and
346
+ * `WorkflowTaskOutput<Task>` still reads the concrete output of a concrete task.
347
+ *
348
+ * The encoded side and the service-free requirement (`never, never`) are not
349
+ * erased. This is a deliberate loss of proof at the task-collection boundary,
350
+ * not sound existential quantification.
351
+ */
352
+ export type AnyWorkflowWorkerTask = WorkflowTask<string, Schema.Codec<any, unknown, never, never>>;
353
+ /**
354
+ * A Jev task whose question types are erased. Like the worker erasure above,
355
+ * this keeps heterogeneous `tasks: [...] tuples writable while concrete
356
+ * `jev(...)` calls keep their precise inferred output.
357
+ */
358
+ export type AnyJevTask = JevTask<string, any>;
359
+ export type AnyWorkflowTask = AnyWorkflowWorkerTask | AnyJevTask;
360
+ export type WorkflowTaskOutput<Task extends AnyWorkflowTask> = Task["output"]["Type"];
361
+ export interface JevTaskDefinition<Id extends string, Q extends JevQuestions> extends JevRequest<Q> {
362
+ readonly id: Id;
363
+ /** Per-HTTP-attempt timeout override passed to the JevClient call. */
364
+ readonly timeoutMs?: number;
365
+ readonly phase?: string;
366
+ readonly cacheKey?: string;
367
+ }
368
+ export type JevTask<Id extends string = string, Q extends JevQuestions = JevQuestions> = JevTaskDefinition<Id, Q> & {
369
+ readonly kind: "jev";
370
+ readonly output: JevResultCodec<Q>;
371
+ };
372
+ /**
373
+ * Construct a native Jev decision task. The state/questions are validated,
374
+ * deep-copied, and frozen immediately so identity hashing and execution can
375
+ * never disagree, and the output codec is derived from the questions.
376
+ */
377
+ export declare const jev: <const Id extends string, const Q extends JevQuestions>(definition: JevTaskDefinition<Id, Q>) => JevTask<Id, Q>;
378
+ export declare const resolveWorkflowTaskSessionPersistence: (task: Pick<AnyWorkflowWorkerTask, "worker">, effectiveWorker?: string | undefined) => WorkflowSessionPersistence | undefined;
379
+ export declare const assertWorkflowTaskSessionPersistence: (task: AnyWorkflowWorkerTask) => void;
380
+ export declare const isWorkflowWorkerTask: (value: unknown) => value is AnyWorkflowWorkerTask;
381
+ export declare const isJevTask: (value: unknown) => value is AnyJevTask;
227
382
  export declare const isWorkflowTask: (value: unknown) => value is AnyWorkflowTask;
228
383
  export interface WorkflowDefinition<Name extends string, Tasks extends ReadonlyArray<AnyWorkflowTask>> {
229
384
  readonly kind: "workflow";
230
385
  readonly name: Name;
231
386
  readonly tasks: Tasks;
387
+ /**
388
+ * Inert scheduling policy. Declaring it registers nothing; only
389
+ * `prism workflow schedule install` activates a schedule. See
390
+ * `workflow-scheduler/schedule.ts`.
391
+ */
392
+ readonly schedule?: WorkflowSchedule;
232
393
  }
233
394
  export interface PhaseFraming {
234
395
  readonly purpose?: string;
@@ -254,21 +415,37 @@ export type PhaseTaskFinishOptions<Output> = WorkflowFinishOptions<Output> & {
254
415
  readonly inherit?: boolean;
255
416
  };
256
417
  /** Decoded TypeScript value of a phase input contract (unknown when no contract). */
257
- export type PhaseTaskInputValue<Input extends WorkflowOutputSchema | undefined> = Input extends WorkflowOutputSchema ? Schema.Schema.Type<Input> : unknown;
418
+ export type PhaseTaskInputValue<Input extends WorkflowOutputSchema | undefined> = Input extends WorkflowOutputSchema ? Input["Type"] : unknown;
258
419
  export type PhaseTaskDefinition<Id extends string, Input extends WorkflowOutputSchema | undefined = undefined, Output extends WorkflowOutputSchema = WorkflowOutputSchema> = Omit<WorkflowTaskDefinition<Id, Output>, "output" | "phase" | "finish"> & {
259
420
  readonly input?: PhaseTaskInputValue<Input>;
260
421
  readonly output?: Output;
261
422
  readonly phase?: string;
262
- readonly finish?: PhaseTaskFinishOptions<Schema.Schema.Type<Output>>;
423
+ readonly finish?: PhaseTaskFinishOptions<Output["Type"]>;
263
424
  readonly brief?: boolean;
264
425
  };
265
426
  export type PhaseCtxTask<Input extends WorkflowOutputSchema | undefined, DefaultOutput extends WorkflowOutputSchema | undefined> = <const Id extends string, const TaskOutput extends WorkflowOutputSchema = Extract<DefaultOutput, WorkflowOutputSchema>>(def: PhaseTaskDefinition<Id, Input, TaskOutput>) => Effect.Effect<WorkflowTaskOutput<WorkflowTask<Id, TaskOutput>>, WorkflowRuntimeError>;
427
+ /**
428
+ * A `ctx.jev(...)` definition. When the phase binds an input contract, the
429
+ * Jev state is that contract's decoded value (it must still be a valid System
430
+ * One entry — schemas describing functions or class instances do not belong
431
+ * in state and will fail entry validation at run time).
432
+ */
433
+ export type PhaseJevTaskDefinition<Id extends string, Input extends WorkflowOutputSchema | undefined, Q extends JevQuestions> = Omit<JevTaskDefinition<Id, Q>, "state"> & {
434
+ readonly state: Input extends WorkflowOutputSchema ? Input["Type"] & JevEntry : JevEntry;
435
+ };
436
+ export type PhaseCtxJev<Input extends WorkflowOutputSchema | undefined> = <const Id extends string, const Q extends JevQuestions>(definition: PhaseJevTaskDefinition<Id, Input, Q>) => Effect.Effect<JevResult<Q>, WorkflowRuntimeError>;
266
437
  export interface PhaseCtx<Name extends string, Input extends WorkflowOutputSchema | undefined, DefaultOutput extends WorkflowOutputSchema | undefined> {
267
438
  readonly name: Name;
268
439
  readonly sop: string;
269
440
  readonly plugin: string;
270
441
  readonly phase: string;
271
442
  readonly task: PhaseCtxTask<Input, DefaultOutput>;
443
+ /**
444
+ * Run a native Jev decision inside this phase. Unlike `ctx.task`, no prompt
445
+ * framing, serialized-input block, finish criteria, or phase output schema
446
+ * is applied — a decision is defined by its state and questions alone.
447
+ */
448
+ readonly jev: PhaseCtxJev<Input>;
272
449
  }
273
450
  export declare const phase: <const Name extends string, const Input extends WorkflowOutputSchema | undefined, const Output extends WorkflowOutputSchema | undefined, Result, Err = WorkflowRuntimeError>(runtime: Pick<WorkflowRuntime, "runTask">, contract: PhaseContract<Name, Input, Output>, fn: (ctx: PhaseCtx<Name, Input, Output>) => Effect.Effect<Result, Err, never>) => Effect.Effect<Result, Err | WorkflowRuntimeError, never>;
274
451
  export interface WorkflowRuntime {
@@ -285,6 +462,8 @@ export interface DynamicWorkflowDefinition<Name extends string, Result = unknown
285
462
  readonly name: Name;
286
463
  readonly tasks: readonly [];
287
464
  readonly run: (runtime: WorkflowRuntime) => Effect.Effect<Result, Err, never>;
465
+ /** Inert scheduling policy; see `WorkflowDefinition.schedule`. */
466
+ readonly schedule?: WorkflowSchedule;
288
467
  }
289
468
  export type AnyWorkflowDefinition = WorkflowDefinition<string, ReadonlyArray<AnyWorkflowTask>> | DynamicWorkflowDefinition<string>;
290
469
  export declare const isWorkflowDefinition: (value: unknown) => value is AnyWorkflowDefinition;
@@ -293,9 +472,11 @@ export declare const defineTask: <const Id extends string, const Output extends
293
472
  export declare function defineWorkflow<const Name extends string, const Tasks extends ReadonlyArray<AnyWorkflowTask>>(definition: {
294
473
  readonly name: Name;
295
474
  readonly tasks: Tasks;
475
+ readonly schedule?: WorkflowSchedule;
296
476
  }): WorkflowDefinition<Name, Tasks>;
297
477
  export declare function defineWorkflow<const Name extends string, Result, Err = WorkflowRuntimeError>(definition: {
298
478
  readonly name: Name;
299
479
  readonly run: (runtime: WorkflowRuntime) => Effect.Effect<Result, Err, never>;
480
+ readonly schedule?: WorkflowSchedule;
300
481
  }): DynamicWorkflowDefinition<Name, Result, Err>;
301
- export declare const decodeTaskOutput: <Task extends AnyWorkflowTask>(task: Task, value: unknown) => Either<Schema.Schema.Type<Task["output"]>, ParseError>;
482
+ export declare const decodeTaskOutput: <Task extends AnyWorkflowTask | AnyJevTask>(task: Task, value: unknown, options?: SchemaAST.ParseOptions) => Result.Result<Task["output"]["Type"], Schema.SchemaError>;