@skastr0/prism-linux-x64 0.1.1 → 0.1.3
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 +0 -0
- package/package.json +2 -1
- package/types/compile/authoring-runtime.d.ts +27 -0
- package/types/compile/bundle-utils.d.ts +16 -0
- package/types/compile/cache.d.ts +49 -0
- package/types/compile/compile-manifest.d.ts +48 -0
- package/types/compile/compose.d.ts +35 -0
- package/types/compile/errors.d.ts +124 -0
- package/types/compile/generated-plugin.d.ts +9 -0
- package/types/compile/load.d.ts +52 -0
- package/types/compile/paths.d.ts +2 -0
- package/types/compile/protocol-tools.d.ts +47 -0
- package/types/compile/refs.d.ts +7 -0
- package/types/compile/registry.d.ts +32 -0
- package/types/compile/resolve.d.ts +63 -0
- package/types/compile/runtime/schema-bridge.d.ts +61 -0
- package/types/compile/runtime-deps.d.ts +6 -0
- package/types/compile/sources.d.ts +2782 -0
- package/types/content-hash.d.ts +1 -0
- package/types/errors.d.ts +107 -0
- package/types/fs.d.ts +60 -0
- package/types/harnesses.d.ts +10 -0
- package/types/index.d.ts +493 -0
- package/types/lowerer-capabilities.d.ts +559 -0
- package/types/manifest.d.ts +106 -0
- package/types/prism-home.d.ts +26 -0
- package/types/project-key.d.ts +48 -0
- package/types/source-selection.d.ts +38 -0
- package/types/state/lock.d.ts +14 -0
- package/types/types.d.ts +192 -0
- package/types/workflow-amp-worker.d.ts +12 -0
- package/types/workflow-antigravity-worker.d.ts +14 -0
- package/types/workflow-claude-worker.d.ts +13 -0
- package/types/workflow-codex-worker.d.ts +12 -0
- package/types/workflow-grok-worker.d.ts +14 -0
- package/types/workflow-hermes-worker.d.ts +14 -0
- package/types/workflow-kimi-worker.d.ts +14 -0
- package/types/workflow-loader.d.ts +64 -0
- package/types/workflow-opencode-worker.d.ts +12 -0
- package/types/workflow-runner.d.ts +69 -0
- package/types/workflow-store.d.ts +214 -0
- package/types/workflow-tsconfig.d.ts +90 -0
- package/types/workflow-worker-contract.d.ts +10 -0
- package/types/workflow-worker-metadata.d.ts +8 -0
- package/types/workflow-worker-process.d.ts +19 -0
- package/types/workflow-workers.d.ts +27 -0
- package/types/workflows.d.ts +145 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { Database } from "bun:sqlite";
|
|
2
|
+
import type { AnyWorkflowTask, WorkflowJudgeVerdict, WorkflowRuntimeOptions } from "./workflows.js";
|
|
3
|
+
export interface WorkflowTaskIdentity {
|
|
4
|
+
readonly workflow: string;
|
|
5
|
+
readonly taskId: string;
|
|
6
|
+
readonly cacheKey: string;
|
|
7
|
+
readonly promptHash: string;
|
|
8
|
+
readonly agentManifestHash: string;
|
|
9
|
+
}
|
|
10
|
+
export interface WorkflowJudgeIdentity {
|
|
11
|
+
readonly workflow: string;
|
|
12
|
+
readonly taskId: string;
|
|
13
|
+
readonly taskCacheKey: string;
|
|
14
|
+
readonly criterion: string;
|
|
15
|
+
readonly cacheKey: string;
|
|
16
|
+
}
|
|
17
|
+
export type WorkflowTaskOutputSource = "mock-output";
|
|
18
|
+
export interface CompletedWorkflowTaskRecord {
|
|
19
|
+
readonly identity: WorkflowTaskIdentity;
|
|
20
|
+
readonly agent: {
|
|
21
|
+
readonly plugin: string;
|
|
22
|
+
readonly name: string;
|
|
23
|
+
};
|
|
24
|
+
readonly output: unknown;
|
|
25
|
+
readonly metadata?: Record<string, unknown>;
|
|
26
|
+
readonly outputSource?: WorkflowTaskOutputSource;
|
|
27
|
+
}
|
|
28
|
+
export interface WorkflowCacheRecord extends CompletedWorkflowTaskRecord {
|
|
29
|
+
readonly status: string;
|
|
30
|
+
readonly outputSource?: WorkflowTaskOutputSource;
|
|
31
|
+
readonly createdAt: string;
|
|
32
|
+
readonly updatedAt: string;
|
|
33
|
+
}
|
|
34
|
+
export interface WorkflowJudgeRecord {
|
|
35
|
+
readonly identity: WorkflowJudgeIdentity;
|
|
36
|
+
readonly verdict: WorkflowJudgeVerdict["verdict"];
|
|
37
|
+
readonly feedback?: string;
|
|
38
|
+
readonly evidence: unknown;
|
|
39
|
+
readonly output: unknown;
|
|
40
|
+
readonly taskMetadata: unknown;
|
|
41
|
+
readonly metadata?: Record<string, unknown>;
|
|
42
|
+
readonly createdAt: string;
|
|
43
|
+
readonly updatedAt: string;
|
|
44
|
+
}
|
|
45
|
+
export type WorkflowRunTaskStatus = "completed" | "failed" | "escalated";
|
|
46
|
+
export interface WorkflowRunTaskRecord {
|
|
47
|
+
readonly runId: string;
|
|
48
|
+
readonly taskId: string;
|
|
49
|
+
readonly cacheKey: string;
|
|
50
|
+
readonly status: WorkflowRunTaskStatus;
|
|
51
|
+
readonly cached: boolean;
|
|
52
|
+
readonly agent: {
|
|
53
|
+
readonly plugin: string;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
};
|
|
56
|
+
readonly output: unknown;
|
|
57
|
+
readonly metadata?: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
export type WorkflowRunTaskProgressStatus = "running" | "completed" | "failed" | "escalated";
|
|
60
|
+
export type WorkflowRunTaskCacheLookup = "hit" | "miss" | "skipped";
|
|
61
|
+
export interface WorkflowRunTaskProgress {
|
|
62
|
+
readonly taskId: string;
|
|
63
|
+
readonly status: WorkflowRunTaskProgressStatus;
|
|
64
|
+
readonly cacheKey?: string;
|
|
65
|
+
readonly cached?: boolean;
|
|
66
|
+
readonly cacheLookup?: WorkflowRunTaskCacheLookup;
|
|
67
|
+
readonly repairs: number;
|
|
68
|
+
readonly agent?: {
|
|
69
|
+
readonly plugin: string;
|
|
70
|
+
readonly name: string;
|
|
71
|
+
};
|
|
72
|
+
readonly lastEventType?: string;
|
|
73
|
+
readonly lastEventAt?: string;
|
|
74
|
+
}
|
|
75
|
+
export type WorkflowRunTaskExecutionSource = "cached" | "fresh" | "unknown";
|
|
76
|
+
export type WorkflowRunTaskEvidenceSource = "this-run" | "prior-cache-record" | "run-events" | "unknown";
|
|
77
|
+
export interface WorkflowRunTaskCompactSummary {
|
|
78
|
+
readonly taskId: string;
|
|
79
|
+
readonly status: WorkflowRunTaskProgressStatus;
|
|
80
|
+
readonly execution: WorkflowRunTaskExecutionSource;
|
|
81
|
+
readonly evidenceSource: WorkflowRunTaskEvidenceSource;
|
|
82
|
+
readonly cached: boolean | null;
|
|
83
|
+
readonly cacheLookup?: WorkflowRunTaskCacheLookup;
|
|
84
|
+
readonly agent?: {
|
|
85
|
+
readonly plugin: string;
|
|
86
|
+
readonly name: string;
|
|
87
|
+
};
|
|
88
|
+
readonly workerAdapter: string | null;
|
|
89
|
+
readonly model: string | null;
|
|
90
|
+
readonly nativeAgent: string | null;
|
|
91
|
+
readonly repairCount: number;
|
|
92
|
+
readonly repairMode: string | null;
|
|
93
|
+
readonly durationMs: number | null;
|
|
94
|
+
readonly externalSessionPointer: string | null;
|
|
95
|
+
readonly lastEventType?: string;
|
|
96
|
+
readonly lastEventAt?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface WorkflowRunCompactSummary {
|
|
99
|
+
readonly kind: "workflow-execution-evidence";
|
|
100
|
+
readonly semanticCorrectness: "not-evaluated";
|
|
101
|
+
readonly disclaimer: string;
|
|
102
|
+
readonly run: WorkflowRunRecord;
|
|
103
|
+
readonly totals: {
|
|
104
|
+
readonly totalTasks: number;
|
|
105
|
+
readonly freshExecutions: number;
|
|
106
|
+
readonly cacheHits: number;
|
|
107
|
+
readonly repairs: number;
|
|
108
|
+
readonly status: WorkflowRunStatus;
|
|
109
|
+
readonly durationMs: number | null;
|
|
110
|
+
};
|
|
111
|
+
readonly tasks: WorkflowRunTaskCompactSummary[];
|
|
112
|
+
}
|
|
113
|
+
export interface WorkflowRunRecord {
|
|
114
|
+
readonly runId: string;
|
|
115
|
+
readonly workflow: string;
|
|
116
|
+
readonly status: WorkflowRunStatus;
|
|
117
|
+
readonly finishedAt: string | null;
|
|
118
|
+
readonly runnerPid?: number;
|
|
119
|
+
readonly heartbeatAt?: string;
|
|
120
|
+
}
|
|
121
|
+
export type WorkflowRunStatus = "running" | "completed" | "failed" | "escalated" | "unknown";
|
|
122
|
+
export interface WorkflowEventRecord {
|
|
123
|
+
readonly sequence: number;
|
|
124
|
+
readonly runId: string;
|
|
125
|
+
readonly taskId: string | null;
|
|
126
|
+
readonly type: string;
|
|
127
|
+
readonly payload: unknown;
|
|
128
|
+
readonly createdAt: string;
|
|
129
|
+
}
|
|
130
|
+
export declare const defaultWorkflowStorePath: (projectPath: string) => string;
|
|
131
|
+
export declare const workflowTaskIdentity: (workflow: string, task: AnyWorkflowTask, runtimeOptions?: WorkflowRuntimeOptions) => WorkflowTaskIdentity;
|
|
132
|
+
export declare class WorkflowStore {
|
|
133
|
+
private readonly db;
|
|
134
|
+
constructor(db: Database);
|
|
135
|
+
static open(path: string): Promise<WorkflowStore>;
|
|
136
|
+
close(): void;
|
|
137
|
+
getCompleted(identity: WorkflowTaskIdentity, options?: {
|
|
138
|
+
readonly allowMockSourced?: boolean;
|
|
139
|
+
}): CompletedWorkflowTaskRecord | null;
|
|
140
|
+
getJudgeRecord(identity: WorkflowJudgeIdentity): WorkflowJudgeRecord | null;
|
|
141
|
+
recordJudge(input: {
|
|
142
|
+
readonly identity: WorkflowJudgeIdentity;
|
|
143
|
+
readonly verdict: WorkflowJudgeVerdict;
|
|
144
|
+
readonly evidence: unknown;
|
|
145
|
+
readonly output: unknown;
|
|
146
|
+
readonly taskMetadata: unknown;
|
|
147
|
+
}): void;
|
|
148
|
+
listJudgeRecords(options?: {
|
|
149
|
+
readonly workflow?: string;
|
|
150
|
+
readonly taskId?: string;
|
|
151
|
+
readonly criterion?: string;
|
|
152
|
+
}): WorkflowJudgeRecord[];
|
|
153
|
+
listCompletedCache(options?: {
|
|
154
|
+
readonly workflow?: string;
|
|
155
|
+
readonly taskId?: string;
|
|
156
|
+
readonly cacheKey?: string;
|
|
157
|
+
readonly promptHash?: string;
|
|
158
|
+
readonly agentManifestHash?: string;
|
|
159
|
+
}): WorkflowCacheRecord[];
|
|
160
|
+
createRun(workflow: string, runId?: string): string;
|
|
161
|
+
setRunHandoffToken(runId: string, token: string): void;
|
|
162
|
+
consumeRunHandoffToken(runId: string, token: string): boolean;
|
|
163
|
+
markRunRunnerStarted(runId: string, runnerPid: number): void;
|
|
164
|
+
heartbeatRun(runId: string): void;
|
|
165
|
+
finishRun(runId: string, status: Exclude<WorkflowRunStatus, "running" | "unknown">): void;
|
|
166
|
+
stopRun(runId: string, reason?: string): WorkflowRunRecord | null;
|
|
167
|
+
stopRunningRun(runId: string, reason?: string): WorkflowRunRecord | null;
|
|
168
|
+
restartRunningRun(input: {
|
|
169
|
+
readonly previousRunId: string;
|
|
170
|
+
readonly nextRunId: string;
|
|
171
|
+
readonly nextWorkflow: string;
|
|
172
|
+
readonly handoffToken: string;
|
|
173
|
+
readonly reason?: string;
|
|
174
|
+
readonly mode?: string;
|
|
175
|
+
}): WorkflowRunRecord | null;
|
|
176
|
+
getRun(runId: string): WorkflowRunRecord | null;
|
|
177
|
+
recordEvent(input: {
|
|
178
|
+
readonly runId: string;
|
|
179
|
+
readonly taskId?: string;
|
|
180
|
+
readonly type: string;
|
|
181
|
+
readonly payload: unknown;
|
|
182
|
+
}): void;
|
|
183
|
+
listRunEvents(runId: string): WorkflowEventRecord[];
|
|
184
|
+
failDeadPidRuns(): WorkflowRunRecord[];
|
|
185
|
+
failStaleRuns(olderThanMs: number, now?: Date): WorkflowRunRecord[];
|
|
186
|
+
listRuns(): WorkflowRunRecord[];
|
|
187
|
+
recordRunTask(input: {
|
|
188
|
+
readonly runId: string;
|
|
189
|
+
readonly ordinal: number;
|
|
190
|
+
readonly identity: WorkflowTaskIdentity;
|
|
191
|
+
readonly agent: {
|
|
192
|
+
readonly plugin: string;
|
|
193
|
+
readonly name: string;
|
|
194
|
+
};
|
|
195
|
+
readonly status: WorkflowRunTaskStatus;
|
|
196
|
+
readonly cached: boolean;
|
|
197
|
+
readonly output: unknown;
|
|
198
|
+
readonly metadata?: Record<string, unknown>;
|
|
199
|
+
readonly finishRunStatus?: Exclude<WorkflowRunStatus, "running" | "unknown">;
|
|
200
|
+
}): void;
|
|
201
|
+
listRunTasks(runId: string): WorkflowRunTaskRecord[];
|
|
202
|
+
summarizeRunTasks(runId: string): WorkflowRunTaskProgress[];
|
|
203
|
+
compactRunSummary(runId: string): WorkflowRunCompactSummary | null;
|
|
204
|
+
recordCompleted(input: {
|
|
205
|
+
readonly identity: WorkflowTaskIdentity;
|
|
206
|
+
readonly agent: {
|
|
207
|
+
readonly plugin: string;
|
|
208
|
+
readonly name: string;
|
|
209
|
+
};
|
|
210
|
+
readonly output: unknown;
|
|
211
|
+
readonly metadata?: Record<string, unknown>;
|
|
212
|
+
readonly outputSource?: WorkflowTaskOutputSource;
|
|
213
|
+
}): void;
|
|
214
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate the Prism-owned authoring tsconfig for workflow .ts files.
|
|
3
|
+
*
|
|
4
|
+
* The generated tsconfig maps the three virtual specifiers a workflow author
|
|
5
|
+
* uses to their shipped type declarations:
|
|
6
|
+
*
|
|
7
|
+
* "prism" → <platform-package>/types/index.d.ts (the emitted prism.d.ts)
|
|
8
|
+
* "prism/refs" → ~/.prism/state/projects/<key>/generated/agents.ts (per-project refs)
|
|
9
|
+
* "effect" → <platform-package>/node_modules/effect/dist/dts/index.d.ts
|
|
10
|
+
*
|
|
11
|
+
* Resolution strategy:
|
|
12
|
+
*
|
|
13
|
+
* When the Prism binary is installed, the platform package sits beside the
|
|
14
|
+
* binary: `dirname(dirname(process.execPath))`. During development (source
|
|
15
|
+
* checkout) the shipped declarations live inside the matching
|
|
16
|
+
* packages/npm/prism-<platform>/types directory (populated by build:npm), with
|
|
17
|
+
* the repo's node_modules/effect and dist/dts-tmp/ as further fallbacks — so
|
|
18
|
+
* the type surface resolves without an install.
|
|
19
|
+
*
|
|
20
|
+
* The resolved type dirs (resolveWorkflowTypeDirs) and path builder
|
|
21
|
+
* (buildWorkflowPaths) are shared with the in-process typecheck in
|
|
22
|
+
* workflow-loader, which constructs compilerOptions in-memory rather than
|
|
23
|
+
* relying solely on the on-disk tsconfig.
|
|
24
|
+
*
|
|
25
|
+
* The generated tsconfig is written to prismHome/state/tsconfig.workflow.json.
|
|
26
|
+
* This file is Prism-owned and must never be committed to the user's project.
|
|
27
|
+
*/
|
|
28
|
+
export interface WorkflowTypeDirs {
|
|
29
|
+
/** Directory holding the shipped prism declarations (types/index.d.ts). */
|
|
30
|
+
readonly prismTypesDir: string | undefined;
|
|
31
|
+
/** Directory holding the effect declarations (dist/dts/index.d.ts). */
|
|
32
|
+
readonly effectDtsDir: string | undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the prism and effect declaration directories for the running
|
|
36
|
+
* environment (installed binary or source checkout). Either may be undefined
|
|
37
|
+
* when the corresponding type surface cannot be located.
|
|
38
|
+
*/
|
|
39
|
+
export declare const resolveWorkflowTypeDirs: () => WorkflowTypeDirs;
|
|
40
|
+
/**
|
|
41
|
+
* Build the `compilerOptions.paths` map for typechecking a workflow file from
|
|
42
|
+
* the resolved type dirs and (optionally) the project-keyed generated refs.
|
|
43
|
+
*
|
|
44
|
+
* Entries are only emitted when the underlying declaration exists, so callers
|
|
45
|
+
* can detect a missing type environment (empty/partial paths) and warn+proceed
|
|
46
|
+
* instead of pointing a specifier at a nonexistent file.
|
|
47
|
+
*/
|
|
48
|
+
export declare const buildWorkflowPaths: (options: {
|
|
49
|
+
readonly typeDirs: WorkflowTypeDirs;
|
|
50
|
+
/** Absolute path to the generated refs file (~/.../generated/agents.ts). */
|
|
51
|
+
readonly refsFile?: string;
|
|
52
|
+
}) => Record<string, string[]>;
|
|
53
|
+
export interface WorkflowTsconfigOptions {
|
|
54
|
+
/**
|
|
55
|
+
* Prism home directory. Defaults to ~/.prism via resolvePrismHome().
|
|
56
|
+
* The generated tsconfig is written to prismHome/state/tsconfig.workflow.json.
|
|
57
|
+
*/
|
|
58
|
+
readonly prismHome: string;
|
|
59
|
+
/**
|
|
60
|
+
* Absolute path to the project's generated refs directory
|
|
61
|
+
* (~/.prism/state/projects/<key>/generated/).
|
|
62
|
+
* Used to wire "prism/refs" paths.
|
|
63
|
+
* If omitted, "prism/refs" paths entry is omitted from the tsconfig.
|
|
64
|
+
*/
|
|
65
|
+
readonly refsDir?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Absolute path to the directory containing the user's workflow .ts files.
|
|
68
|
+
* Added to tsconfig `include` so the IDE and tsc pick them up automatically.
|
|
69
|
+
*/
|
|
70
|
+
readonly workflowDir?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface GeneratedWorkflowTsconfig {
|
|
73
|
+
/** Absolute path where the tsconfig was written. */
|
|
74
|
+
readonly path: string;
|
|
75
|
+
/** Absolute path to the prism types directory (types/index.d.ts). */
|
|
76
|
+
readonly prismTypesDir: string | undefined;
|
|
77
|
+
/** Absolute path to the effect dts directory (dist/dts/index.d.ts). */
|
|
78
|
+
readonly effectDtsDir: string | undefined;
|
|
79
|
+
}
|
|
80
|
+
/** The filename for the generated workflow authoring tsconfig. */
|
|
81
|
+
export declare const WORKFLOW_TSCONFIG_FILENAME = "tsconfig.workflow.json";
|
|
82
|
+
/**
|
|
83
|
+
* Generate and write the Prism workflow-authoring tsconfig.
|
|
84
|
+
*
|
|
85
|
+
* Returns the path where the tsconfig was written, plus the resolved type
|
|
86
|
+
* directories for caller inspection or further wiring.
|
|
87
|
+
*/
|
|
88
|
+
export declare const generateWorkflowTsconfig: (options: WorkflowTsconfigOptions) => Promise<GeneratedWorkflowTsconfig>;
|
|
89
|
+
/** Returns the expected tsconfig path given a prismHome directory. */
|
|
90
|
+
export declare const workflowTsconfigPath: (prismHome: string) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AnyWorkflowTask } from "./workflows.js";
|
|
2
|
+
export declare const WORKFLOW_WORKER_JSON_CONTRACT_VERSION = "v1";
|
|
3
|
+
export declare const WORKFLOW_WORKER_JSON_INSTRUCTION_SOURCE = "workflow-worker-json-instruction-v1";
|
|
4
|
+
export declare class WorkflowOutputParseError extends Error {
|
|
5
|
+
readonly name = "WorkflowOutputParseError";
|
|
6
|
+
readonly rawText?: string;
|
|
7
|
+
constructor(message: string, rawText?: string);
|
|
8
|
+
}
|
|
9
|
+
export declare const workflowWorkerJsonInstruction: (task: AnyWorkflowTask) => string;
|
|
10
|
+
export declare const parseWorkflowWorkerJsonOutput: (text: string) => unknown;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const DEFAULT_WORKFLOW_WORKER_STDERR_EXCERPT_BYTES = 4096;
|
|
2
|
+
export interface WorkflowWorkerStderrMetadata {
|
|
3
|
+
readonly stderrBytes?: number;
|
|
4
|
+
readonly stderrSha256?: string;
|
|
5
|
+
readonly stderrExcerpt?: string;
|
|
6
|
+
readonly stderrTruncated?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const summarizeWorkflowWorkerStderr: (stderr: string, maxExcerptBytes?: number) => WorkflowWorkerStderrMetadata;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface WorkflowWorkerProcessOptions {
|
|
2
|
+
readonly command: string;
|
|
3
|
+
readonly args: ReadonlyArray<string>;
|
|
4
|
+
readonly cwd: string;
|
|
5
|
+
readonly abortSignal?: AbortSignal;
|
|
6
|
+
readonly processTimeoutMs?: number;
|
|
7
|
+
readonly env?: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export interface WorkflowWorkerProcessResult {
|
|
10
|
+
readonly exitCode: number | null;
|
|
11
|
+
readonly stdout: string;
|
|
12
|
+
readonly stderr: string;
|
|
13
|
+
readonly durationMs: number;
|
|
14
|
+
readonly timedOut: boolean;
|
|
15
|
+
readonly aborted: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const parsePositiveInteger: (value: string | undefined) => number | undefined;
|
|
18
|
+
export declare const workflowWorkerProcessExcerpt: (stdout: string, stderr: string) => string;
|
|
19
|
+
export declare const runWorkflowWorkerProcess: (options: WorkflowWorkerProcessOptions) => Promise<WorkflowWorkerProcessResult>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AnyWorkflowTask } from "./workflows.js";
|
|
2
|
+
import type { WorkflowTaskExecution, WorkflowTaskExecutionContext, WorkflowTaskExecutor } from "./workflow-runner.js";
|
|
3
|
+
export interface WorkflowWorkerAdapterOptions {
|
|
4
|
+
readonly cwd: string;
|
|
5
|
+
readonly model?: string;
|
|
6
|
+
readonly profile?: string;
|
|
7
|
+
readonly abortSignal?: AbortSignal;
|
|
8
|
+
readonly context?: WorkflowTaskExecutionContext;
|
|
9
|
+
}
|
|
10
|
+
export interface WorkflowWorkerAdapter {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly runTask: (task: AnyWorkflowTask, options: WorkflowWorkerAdapterOptions) => Promise<WorkflowTaskExecution>;
|
|
13
|
+
readonly continueTask?: (task: AnyWorkflowTask, options: WorkflowWorkerAdapterOptions) => Promise<WorkflowTaskExecution>;
|
|
14
|
+
}
|
|
15
|
+
export declare class UnsupportedWorkflowWorkerError extends Error {
|
|
16
|
+
readonly worker: string;
|
|
17
|
+
readonly supportedWorkers: ReadonlyArray<string>;
|
|
18
|
+
readonly name = "UnsupportedWorkflowWorkerError";
|
|
19
|
+
constructor(worker: string, supportedWorkers: ReadonlyArray<string>);
|
|
20
|
+
}
|
|
21
|
+
export declare const supportedWorkflowWorkers: () => ReadonlyArray<string>;
|
|
22
|
+
export declare const getWorkflowWorkerAdapter: (worker: string) => WorkflowWorkerAdapter;
|
|
23
|
+
export declare const createWorkflowWorkerExecutor: (input: {
|
|
24
|
+
readonly worker?: string;
|
|
25
|
+
readonly cwd: string;
|
|
26
|
+
readonly model?: string;
|
|
27
|
+
}) => WorkflowTaskExecutor;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
export interface WorkflowModelRef {
|
|
3
|
+
readonly modelspace?: string;
|
|
4
|
+
readonly profile?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface WorkflowModelspaceRef {
|
|
7
|
+
readonly kind: "modelspace-ref";
|
|
8
|
+
readonly plugin: string;
|
|
9
|
+
readonly modelspace: string;
|
|
10
|
+
}
|
|
11
|
+
export interface WorkflowModelProfileRef {
|
|
12
|
+
readonly kind: "model-profile-ref";
|
|
13
|
+
readonly plugin: string;
|
|
14
|
+
readonly modelspace: string;
|
|
15
|
+
readonly profile: string;
|
|
16
|
+
}
|
|
17
|
+
export interface WorkflowManagedSkillRef {
|
|
18
|
+
readonly kind: "managed-skill-ref";
|
|
19
|
+
readonly plugin: string;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
}
|
|
22
|
+
export interface WorkflowSkillspaceRef {
|
|
23
|
+
readonly kind: "skillspace-ref";
|
|
24
|
+
readonly plugin: string;
|
|
25
|
+
readonly skillspace: string;
|
|
26
|
+
readonly skills: ReadonlyArray<string>;
|
|
27
|
+
}
|
|
28
|
+
export interface WorkflowAgentRef {
|
|
29
|
+
readonly kind: "agent-ref";
|
|
30
|
+
readonly plugin: string;
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly description: string;
|
|
33
|
+
readonly sourceHash: string;
|
|
34
|
+
readonly manifestHash: string;
|
|
35
|
+
readonly model?: WorkflowModelRef;
|
|
36
|
+
readonly installs: ReadonlyArray<string>;
|
|
37
|
+
}
|
|
38
|
+
export type WorkflowOutputSchema = Schema.Schema.AnyNoContext;
|
|
39
|
+
export type WorkflowWorkerId = "amp-code" | "antigravity-cli" | "claude-code" | "codex-cli" | "grok" | "hermes" | "kimi-code" | "opencode";
|
|
40
|
+
export interface WorkflowTaskWorkerOptions {
|
|
41
|
+
readonly worker?: WorkflowWorkerId;
|
|
42
|
+
readonly model?: string;
|
|
43
|
+
readonly profile?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface WorkflowFinishCriterionContext<Output> {
|
|
46
|
+
readonly output: Output;
|
|
47
|
+
readonly rawOutput: unknown;
|
|
48
|
+
readonly metadata?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
export interface WorkflowDeterministicFinishCriterion<Output> {
|
|
51
|
+
readonly kind?: "deterministic";
|
|
52
|
+
readonly name: string;
|
|
53
|
+
readonly check: (context: WorkflowFinishCriterionContext<Output>) => Effect.Effect<void, unknown>;
|
|
54
|
+
readonly repairPrompt?: (error: unknown, context: WorkflowFinishCriterionContext<Output>) => string;
|
|
55
|
+
}
|
|
56
|
+
export type WorkflowJudgeVerdict = {
|
|
57
|
+
readonly verdict: "pass";
|
|
58
|
+
readonly feedback?: string;
|
|
59
|
+
readonly metadata?: Record<string, unknown>;
|
|
60
|
+
} | {
|
|
61
|
+
readonly verdict: "continue";
|
|
62
|
+
readonly feedback: string;
|
|
63
|
+
readonly metadata?: Record<string, unknown>;
|
|
64
|
+
} | {
|
|
65
|
+
readonly verdict: "fail";
|
|
66
|
+
readonly feedback?: string;
|
|
67
|
+
readonly metadata?: Record<string, unknown>;
|
|
68
|
+
} | {
|
|
69
|
+
readonly verdict: "escalate";
|
|
70
|
+
readonly feedback?: string;
|
|
71
|
+
readonly metadata?: Record<string, unknown>;
|
|
72
|
+
};
|
|
73
|
+
export interface WorkflowJudgeTaskMetadata {
|
|
74
|
+
readonly id: string;
|
|
75
|
+
readonly agent: {
|
|
76
|
+
readonly plugin: string;
|
|
77
|
+
readonly name: string;
|
|
78
|
+
};
|
|
79
|
+
readonly cacheKey?: string;
|
|
80
|
+
readonly worker?: WorkflowTaskWorkerOptions;
|
|
81
|
+
}
|
|
82
|
+
export interface WorkflowJudgeEvidenceSelectionContext<Output> {
|
|
83
|
+
readonly goal: string;
|
|
84
|
+
readonly output: Output;
|
|
85
|
+
readonly metadata?: Record<string, unknown>;
|
|
86
|
+
readonly task: WorkflowJudgeTaskMetadata;
|
|
87
|
+
}
|
|
88
|
+
export interface WorkflowJudgeCriterionContext<Output, Evidence = unknown> extends WorkflowJudgeEvidenceSelectionContext<Output> {
|
|
89
|
+
readonly evidence: Evidence;
|
|
90
|
+
}
|
|
91
|
+
export interface WorkflowJudgeFinishCriterion<Output, Evidence = unknown> {
|
|
92
|
+
readonly kind: "judge";
|
|
93
|
+
readonly name: string;
|
|
94
|
+
readonly goal?: string | ((context: Omit<WorkflowJudgeEvidenceSelectionContext<Output>, "goal">) => string);
|
|
95
|
+
readonly selectEvidence?: (context: WorkflowJudgeEvidenceSelectionContext<Output>) => Evidence;
|
|
96
|
+
readonly evaluate: (context: WorkflowJudgeCriterionContext<Output, Evidence>) => Effect.Effect<WorkflowJudgeVerdict, unknown>;
|
|
97
|
+
}
|
|
98
|
+
export type WorkflowFinishCriterion<Output> = WorkflowDeterministicFinishCriterion<Output> | WorkflowJudgeFinishCriterion<Output>;
|
|
99
|
+
export interface WorkflowFinishOptions<Output> {
|
|
100
|
+
readonly maxRepairs?: number;
|
|
101
|
+
readonly criteria?: ReadonlyArray<WorkflowFinishCriterion<Output>>;
|
|
102
|
+
}
|
|
103
|
+
export interface WorkflowTaskDefinition<Id extends string, Agent extends WorkflowAgentRef, Output extends WorkflowOutputSchema> {
|
|
104
|
+
readonly id: Id;
|
|
105
|
+
readonly agent: Agent;
|
|
106
|
+
readonly prompt: string;
|
|
107
|
+
readonly output: Output;
|
|
108
|
+
readonly cacheKey?: string;
|
|
109
|
+
readonly worker?: WorkflowTaskWorkerOptions;
|
|
110
|
+
readonly finish?: WorkflowFinishOptions<Schema.Schema.Type<Output>>;
|
|
111
|
+
}
|
|
112
|
+
export interface WorkflowTask<Id extends string = string, Agent extends WorkflowAgentRef = WorkflowAgentRef, Output extends WorkflowOutputSchema = WorkflowOutputSchema> extends WorkflowTaskDefinition<Id, Agent, Output> {
|
|
113
|
+
readonly kind: "workflow-task";
|
|
114
|
+
}
|
|
115
|
+
export type AnyWorkflowTask = WorkflowTask<string, WorkflowAgentRef, WorkflowOutputSchema>;
|
|
116
|
+
export type WorkflowTaskOutput<Task extends AnyWorkflowTask> = Schema.Schema.Type<Task["output"]>;
|
|
117
|
+
export interface WorkflowDefinition<Name extends string, Tasks extends ReadonlyArray<AnyWorkflowTask>> {
|
|
118
|
+
readonly kind: "workflow";
|
|
119
|
+
readonly name: Name;
|
|
120
|
+
readonly tasks: Tasks;
|
|
121
|
+
}
|
|
122
|
+
export interface WorkflowRuntime {
|
|
123
|
+
runTask: <Task extends AnyWorkflowTask>(task: Task) => Effect.Effect<WorkflowTaskOutput<Task>, unknown>;
|
|
124
|
+
}
|
|
125
|
+
export interface WorkflowRuntimeOptions {
|
|
126
|
+
readonly fallbackWorker?: string;
|
|
127
|
+
readonly fallbackModel?: string;
|
|
128
|
+
}
|
|
129
|
+
export interface DynamicWorkflowDefinition<Name extends string> {
|
|
130
|
+
readonly kind: "workflow";
|
|
131
|
+
readonly name: Name;
|
|
132
|
+
readonly tasks: readonly [];
|
|
133
|
+
readonly run: (runtime: WorkflowRuntime) => Effect.Effect<unknown, unknown>;
|
|
134
|
+
}
|
|
135
|
+
export type AnyWorkflowDefinition = WorkflowDefinition<string, ReadonlyArray<AnyWorkflowTask>> | DynamicWorkflowDefinition<string>;
|
|
136
|
+
export declare const defineTask: <const Id extends string, const Agent extends WorkflowAgentRef, const Output extends WorkflowOutputSchema>(definition: WorkflowTaskDefinition<Id, Agent, Output>) => WorkflowTask<Id, Agent, Output>;
|
|
137
|
+
export declare function defineWorkflow<const Name extends string, const Tasks extends ReadonlyArray<AnyWorkflowTask>>(definition: {
|
|
138
|
+
readonly name: Name;
|
|
139
|
+
readonly tasks: Tasks;
|
|
140
|
+
}): WorkflowDefinition<Name, Tasks>;
|
|
141
|
+
export declare function defineWorkflow<const Name extends string>(definition: {
|
|
142
|
+
readonly name: Name;
|
|
143
|
+
readonly run: (runtime: WorkflowRuntime) => Effect.Effect<unknown, unknown>;
|
|
144
|
+
}): DynamicWorkflowDefinition<Name>;
|
|
145
|
+
export declare const decodeTaskOutput: <Task extends AnyWorkflowTask>(task: Task, value: unknown) => import("effect/Either").Either<any, import("effect/ParseResult").ParseError>;
|