@skastr0/prism-linux-arm64 0.1.3 → 0.2.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/bin/prism +0 -0
- package/package.json +5 -1
- package/types/compile/generated-plugin.d.ts +1 -0
- package/types/compile/sources.d.ts +42 -42
- package/types/errors.d.ts +10 -1
- package/types/harnesses.d.ts +9 -1
- package/types/index.d.ts +1 -0
- package/types/services/prism-env.d.ts +45 -0
- package/types/types.d.ts +1 -0
- package/types/workflow-amp-worker.d.ts +20 -4
- package/types/workflow-antigravity-pty.d.ts +22 -0
- package/types/workflow-antigravity-worker.d.ts +65 -4
- package/types/workflow-claude-worker.d.ts +24 -5
- package/types/workflow-codex-worker.d.ts +16 -4
- package/types/workflow-errors.d.ts +21 -0
- package/types/workflow-grok-worker.d.ts +17 -4
- package/types/workflow-hermes-worker.d.ts +12 -4
- package/types/workflow-kimi-worker.d.ts +14 -4
- package/types/workflow-opencode-worker.d.ts +14 -4
- package/types/workflow-output-schema.d.ts +7 -0
- package/types/workflow-permissions.d.ts +10 -0
- package/types/workflow-runner.d.ts +21 -25
- package/types/workflow-session.d.ts +126 -0
- package/types/workflow-store.d.ts +78 -1
- package/types/workflow-tsconfig.d.ts +10 -2
- package/types/workflow-worker-process.d.ts +5 -0
- package/types/workflow-workers.d.ts +25 -9
- package/types/workflows.d.ts +45 -13
package/bin/prism
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skastr0/prism-linux-arm64",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Prism standalone CLI binary for Linux arm64.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"typescript": "^5.8.3",
|
|
24
24
|
"zod": "4.4.3"
|
|
25
25
|
},
|
|
26
|
+
"optionalDependencies": {
|
|
27
|
+
"@opentui/core-linux-arm64": "0.4.1",
|
|
28
|
+
"@opentui/core-linux-arm64-musl": "0.4.1"
|
|
29
|
+
},
|
|
26
30
|
"os": [
|
|
27
31
|
"linux"
|
|
28
32
|
],
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ResolvedContractBinding } from "./resolve.js";
|
|
2
|
+
export declare const GENERATED_EXTERNAL_TOOL_NAME_MAX_LENGTH = 52;
|
|
2
3
|
export declare const normalizeGeneratedPluginName: (pluginName: string) => string;
|
|
3
4
|
export declare const sanitizeGeneratedToolSegment: (value: string, fallback: string) => string;
|
|
4
5
|
export declare const generatedToolNamespace: (pluginName: string) => string;
|
|
@@ -1338,24 +1338,24 @@ declare const Trait_base: Schema.Class<Trait, {
|
|
|
1338
1338
|
skills: Schema.Array$<typeof Schema.String>;
|
|
1339
1339
|
}>;
|
|
1340
1340
|
}>, never, {
|
|
1341
|
-
readonly name: string;
|
|
1342
|
-
} & {
|
|
1343
|
-
readonly description?: string | undefined;
|
|
1344
|
-
} & {
|
|
1345
|
-
readonly sourcePath: string;
|
|
1346
|
-
} & {
|
|
1347
1341
|
readonly tools: {
|
|
1348
1342
|
readonly [x: string]: {
|
|
1349
1343
|
readonly ref: string;
|
|
1350
1344
|
};
|
|
1351
1345
|
};
|
|
1346
|
+
} & {
|
|
1347
|
+
readonly name: string;
|
|
1348
|
+
} & {
|
|
1349
|
+
readonly description?: string | undefined;
|
|
1350
|
+
} & {
|
|
1351
|
+
readonly sourcePath: string;
|
|
1352
1352
|
} & {
|
|
1353
1353
|
readonly instructions: readonly string[];
|
|
1354
1354
|
} & {
|
|
1355
1355
|
readonly access: {
|
|
1356
|
+
readonly skills: readonly string[];
|
|
1356
1357
|
readonly tools: readonly string[];
|
|
1357
1358
|
readonly toolGroups: readonly string[];
|
|
1358
|
-
readonly skills: readonly string[];
|
|
1359
1359
|
};
|
|
1360
1360
|
} & {
|
|
1361
1361
|
readonly inject: {
|
|
@@ -1363,8 +1363,8 @@ declare const Trait_base: Schema.Class<Trait, {
|
|
|
1363
1363
|
};
|
|
1364
1364
|
} & {
|
|
1365
1365
|
readonly require: {
|
|
1366
|
-
readonly tools: readonly string[];
|
|
1367
1366
|
readonly skills: readonly string[];
|
|
1367
|
+
readonly tools: readonly string[];
|
|
1368
1368
|
};
|
|
1369
1369
|
}, {}, {}>;
|
|
1370
1370
|
export declare class Trait extends Trait_base {
|
|
@@ -1711,6 +1711,25 @@ declare const Agent_base: Schema.Class<Agent, {
|
|
|
1711
1711
|
targets: Schema.Record$<typeof Schema.String, typeof Schema.Object>;
|
|
1712
1712
|
}>, never, {
|
|
1713
1713
|
readonly model?: string | undefined;
|
|
1714
|
+
} & {
|
|
1715
|
+
readonly skills: readonly string[];
|
|
1716
|
+
} & {
|
|
1717
|
+
readonly traits: readonly {
|
|
1718
|
+
readonly tools: {
|
|
1719
|
+
readonly [x: string]: {
|
|
1720
|
+
readonly slots: {
|
|
1721
|
+
readonly [x: string]: {
|
|
1722
|
+
readonly schema: unknown;
|
|
1723
|
+
readonly source: {
|
|
1724
|
+
readonly sourcePath: string;
|
|
1725
|
+
readonly exportName: string;
|
|
1726
|
+
};
|
|
1727
|
+
};
|
|
1728
|
+
};
|
|
1729
|
+
};
|
|
1730
|
+
};
|
|
1731
|
+
readonly ref: string;
|
|
1732
|
+
}[];
|
|
1714
1733
|
} & {
|
|
1715
1734
|
readonly name: string;
|
|
1716
1735
|
} & {
|
|
@@ -1723,33 +1742,14 @@ declare const Agent_base: Schema.Class<Agent, {
|
|
|
1723
1742
|
};
|
|
1724
1743
|
} & {
|
|
1725
1744
|
readonly sourcePath: string;
|
|
1726
|
-
} & {
|
|
1727
|
-
readonly skills: readonly string[];
|
|
1728
1745
|
} & {
|
|
1729
1746
|
readonly access: {
|
|
1747
|
+
readonly skills: readonly string[];
|
|
1730
1748
|
readonly tools: readonly string[];
|
|
1731
1749
|
readonly toolGroups: readonly string[];
|
|
1732
|
-
readonly skills: readonly string[];
|
|
1733
1750
|
};
|
|
1734
1751
|
} & {
|
|
1735
1752
|
readonly personality?: string | undefined;
|
|
1736
|
-
} & {
|
|
1737
|
-
readonly traits: readonly {
|
|
1738
|
-
readonly ref: string;
|
|
1739
|
-
readonly tools: {
|
|
1740
|
-
readonly [x: string]: {
|
|
1741
|
-
readonly slots: {
|
|
1742
|
-
readonly [x: string]: {
|
|
1743
|
-
readonly schema: unknown;
|
|
1744
|
-
readonly source: {
|
|
1745
|
-
readonly sourcePath: string;
|
|
1746
|
-
readonly exportName: string;
|
|
1747
|
-
};
|
|
1748
|
-
};
|
|
1749
|
-
};
|
|
1750
|
-
};
|
|
1751
|
-
};
|
|
1752
|
-
}[];
|
|
1753
1753
|
} & {
|
|
1754
1754
|
readonly color?: string | undefined;
|
|
1755
1755
|
}, {}, {}>;
|
|
@@ -1885,12 +1885,6 @@ declare const Toolspace_base: Schema.Class<Toolspace, {
|
|
|
1885
1885
|
tools: Schema.Array$<typeof Schema.String>;
|
|
1886
1886
|
}>>;
|
|
1887
1887
|
}>, never, {
|
|
1888
|
-
readonly name: string;
|
|
1889
|
-
} & {
|
|
1890
|
-
readonly description?: string | undefined;
|
|
1891
|
-
} & {
|
|
1892
|
-
readonly sourcePath: string;
|
|
1893
|
-
} & {
|
|
1894
1888
|
readonly tools: {
|
|
1895
1889
|
readonly [x: string]: {
|
|
1896
1890
|
readonly description?: string | undefined;
|
|
@@ -1899,11 +1893,17 @@ declare const Toolspace_base: Schema.Class<Toolspace, {
|
|
|
1899
1893
|
};
|
|
1900
1894
|
};
|
|
1901
1895
|
};
|
|
1896
|
+
} & {
|
|
1897
|
+
readonly name: string;
|
|
1898
|
+
} & {
|
|
1899
|
+
readonly description?: string | undefined;
|
|
1900
|
+
} & {
|
|
1901
|
+
readonly sourcePath: string;
|
|
1902
1902
|
} & {
|
|
1903
1903
|
readonly groups: {
|
|
1904
1904
|
readonly [x: string]: {
|
|
1905
|
-
readonly description?: string | undefined;
|
|
1906
1905
|
readonly tools: readonly string[];
|
|
1906
|
+
readonly description?: string | undefined;
|
|
1907
1907
|
};
|
|
1908
1908
|
};
|
|
1909
1909
|
}, {}, {}>;
|
|
@@ -2032,12 +2032,6 @@ declare const Skillspace_base: Schema.Class<Skillspace, {
|
|
|
2032
2032
|
}>>;
|
|
2033
2033
|
}>>;
|
|
2034
2034
|
}>, never, {
|
|
2035
|
-
readonly name: string;
|
|
2036
|
-
} & {
|
|
2037
|
-
readonly description?: string | undefined;
|
|
2038
|
-
} & {
|
|
2039
|
-
readonly sourcePath: string;
|
|
2040
|
-
} & {
|
|
2041
2035
|
readonly skills: {
|
|
2042
2036
|
readonly [x: string]: {
|
|
2043
2037
|
readonly description?: string | undefined;
|
|
@@ -2048,6 +2042,12 @@ declare const Skillspace_base: Schema.Class<Skillspace, {
|
|
|
2048
2042
|
};
|
|
2049
2043
|
};
|
|
2050
2044
|
};
|
|
2045
|
+
} & {
|
|
2046
|
+
readonly name: string;
|
|
2047
|
+
} & {
|
|
2048
|
+
readonly description?: string | undefined;
|
|
2049
|
+
} & {
|
|
2050
|
+
readonly sourcePath: string;
|
|
2051
2051
|
}, {}, {}>;
|
|
2052
2052
|
export declare class Skillspace extends Skillspace_base {
|
|
2053
2053
|
}
|
|
@@ -2725,6 +2725,7 @@ declare const Orbit_base: Schema.Class<Orbit, {
|
|
|
2725
2725
|
readonly finish_criteria?: readonly string[] | undefined;
|
|
2726
2726
|
readonly escalation?: string | undefined;
|
|
2727
2727
|
} | undefined;
|
|
2728
|
+
readonly agents: readonly string[];
|
|
2728
2729
|
readonly name: string;
|
|
2729
2730
|
readonly body?: string | undefined;
|
|
2730
2731
|
readonly orbit?: string | undefined;
|
|
@@ -2734,7 +2735,6 @@ declare const Orbit_base: Schema.Class<Orbit, {
|
|
|
2734
2735
|
readonly [x: string]: string;
|
|
2735
2736
|
} | undefined;
|
|
2736
2737
|
} | undefined;
|
|
2737
|
-
readonly agents: readonly string[];
|
|
2738
2738
|
readonly requires: readonly {
|
|
2739
2739
|
readonly all: readonly string[];
|
|
2740
2740
|
readonly min?: number | undefined;
|
package/types/errors.d.ts
CHANGED
|
@@ -61,6 +61,15 @@ export declare class McpBundleMissingError extends McpBundleMissingError_base {
|
|
|
61
61
|
get hint(): string;
|
|
62
62
|
get message(): string;
|
|
63
63
|
}
|
|
64
|
+
declare const McpPortConflictError_base: Schema.TaggedErrorClass<McpPortConflictError, "McpPortConflictError", {
|
|
65
|
+
readonly _tag: Schema.tag<"McpPortConflictError">;
|
|
66
|
+
} & {
|
|
67
|
+
host: typeof Schema.String;
|
|
68
|
+
port: typeof Schema.Number;
|
|
69
|
+
}>;
|
|
70
|
+
export declare class McpPortConflictError extends McpPortConflictError_base {
|
|
71
|
+
get message(): string;
|
|
72
|
+
}
|
|
64
73
|
declare const BlockedTargetError_base: Schema.TaggedErrorClass<BlockedTargetError, "BlockedTargetError", {
|
|
65
74
|
readonly _tag: Schema.tag<"BlockedTargetError">;
|
|
66
75
|
} & {
|
|
@@ -75,7 +84,7 @@ export declare class BlockedTargetError extends BlockedTargetError_base {
|
|
|
75
84
|
* Every typed error Prism may surface to a human. `CompileError` (which
|
|
76
85
|
* includes `PluginManifestError`) is defined in src/compile/errors.ts.
|
|
77
86
|
*/
|
|
78
|
-
export type PrismError = CompileError | PrismConfigError | BundleBuildError | McpBundleMissingError | BlockedTargetError;
|
|
87
|
+
export type PrismError = CompileError | PrismConfigError | BundleBuildError | McpBundleMissingError | McpPortConflictError | BlockedTargetError;
|
|
79
88
|
export declare const PRISM_ERROR_TAGS: ReadonlySet<string>;
|
|
80
89
|
export declare const isPrismError: (value: unknown) => value is PrismError;
|
|
81
90
|
export interface PrismErrorRender {
|
package/types/harnesses.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Harness registry - configurations for all supported AI coding harnesses
|
|
3
3
|
*/
|
|
4
|
+
import { Layer } from "effect";
|
|
5
|
+
import { HarnessRoots, type HarnessRootsEnv } from "./services/prism-env.js";
|
|
4
6
|
import type { HarnessConfig, HarnessId, HarnessScope } from "./types.js";
|
|
5
7
|
export declare const HARNESSES: Record<HarnessId, HarnessConfig>;
|
|
6
8
|
export declare function getHarness(id: HarnessId): HarnessConfig;
|
|
7
9
|
export declare function getAllHarnessIds(): HarnessId[];
|
|
8
10
|
export declare function isValidHarnessId(id: string): id is HarnessId;
|
|
9
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Live layer mapping each harness to its registry globalConfigPath, expanded
|
|
13
|
+
* through the current HOME. This belongs with the registry because it is the
|
|
14
|
+
* only module that owns the harness definitions.
|
|
15
|
+
*/
|
|
16
|
+
export declare const HarnessRootsLive: Layer.Layer<HarnessRoots>;
|
|
17
|
+
export declare function resolveHarnessRoot(harness: HarnessConfig, scope: HarnessScope, projectPath?: string, roots?: HarnessRootsEnv): string | null;
|
|
10
18
|
export declare function harnessSupportsProjectScope(harness: HarnessConfig): boolean;
|
package/types/index.d.ts
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PrismHome — the Effect service carrying the resolved Prism home directory
|
|
3
|
+
* (docs/overhaul-one-writer-plan.md, WS2).
|
|
4
|
+
*
|
|
5
|
+
* The env read (`PRISM_HOME`, falling back to ~/.prism) happens exactly once,
|
|
6
|
+
* at the CLI edge, when `PrismHomeLive` is built into the runtime. Library
|
|
7
|
+
* code never falls back to the environment: new code (WS3+ snapshot store,
|
|
8
|
+
* sync engine, MCP supervisor) consumes the `PrismHome` tag, so tests are
|
|
9
|
+
* structurally unable to touch real state — they provide `PrismHomeTest`.
|
|
10
|
+
*
|
|
11
|
+
* Do not add `resolvePrismHome()` default-argument fallbacks to new modules;
|
|
12
|
+
* thread this service instead.
|
|
13
|
+
*/
|
|
14
|
+
import { Context, Layer } from "effect";
|
|
15
|
+
import type { HarnessId } from "../types.js";
|
|
16
|
+
export interface PrismEnv {
|
|
17
|
+
/** Absolute path of the Prism home directory. */
|
|
18
|
+
readonly home: string;
|
|
19
|
+
}
|
|
20
|
+
declare const PrismHome_base: Context.TagClass<PrismHome, "prism/PrismHome", PrismEnv>;
|
|
21
|
+
export declare class PrismHome extends PrismHome_base {
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Live layer for the CLI edge. Reads the environment once when the layer is
|
|
25
|
+
* built; everything downstream sees one immutable value.
|
|
26
|
+
*/
|
|
27
|
+
export declare const PrismHomeLive: Layer.Layer<PrismHome>;
|
|
28
|
+
/** In-memory layer for tests — no env read, no disk. */
|
|
29
|
+
export declare const PrismHomeTest: (home: string) => Layer.Layer<PrismHome>;
|
|
30
|
+
/**
|
|
31
|
+
* HarnessRoots — the Effect service carrying the resolved base directory for
|
|
32
|
+
* each harness global root. Production resolves via the harness registry's
|
|
33
|
+
* globalConfigPath; tests provide a map of harness IDs to temp directories so
|
|
34
|
+
* refresh/compile/doctor never touch real harness configs.
|
|
35
|
+
*/
|
|
36
|
+
export interface HarnessRootsEnv {
|
|
37
|
+
/** Resolve the global root directory for a harness. */
|
|
38
|
+
readonly resolve: (harnessId: HarnessId) => string;
|
|
39
|
+
}
|
|
40
|
+
declare const HarnessRoots_base: Context.TagClass<HarnessRoots, "prism/HarnessRoots", HarnessRootsEnv>;
|
|
41
|
+
export declare class HarnessRoots extends HarnessRoots_base {
|
|
42
|
+
}
|
|
43
|
+
/** In-memory layer for tests — maps harnesses to caller-supplied roots. */
|
|
44
|
+
export declare const HarnessRootsTest: (roots: Partial<Record<HarnessId, string>>) => Layer.Layer<HarnessRoots>;
|
|
45
|
+
export {};
|
package/types/types.d.ts
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
|
-
import type { AnyWorkflowTask } from "./workflows.js";
|
|
2
|
-
import type { WorkflowTaskExecution } from "./workflow-runner.js";
|
|
3
|
-
export
|
|
1
|
+
import type { AnyWorkflowTask, WorkflowPermissionMode } from "./workflows.js";
|
|
2
|
+
import type { WorkflowTaskExecution, WorkflowTaskRepairLoopOption } from "./workflow-runner.js";
|
|
3
|
+
export type AmpWorkflowWorkerOptions = {
|
|
4
4
|
readonly cwd: string;
|
|
5
5
|
readonly bin?: string;
|
|
6
6
|
readonly model?: string;
|
|
7
|
+
readonly resolvedPermission: WorkflowPermissionMode;
|
|
8
|
+
readonly processTimeoutMs?: number;
|
|
7
9
|
readonly abortSignal?: AbortSignal;
|
|
8
|
-
}
|
|
10
|
+
} & WorkflowTaskRepairLoopOption<"amp-code">;
|
|
9
11
|
export declare class AmpWorkflowWorkerError extends Error {
|
|
10
12
|
readonly name = "AmpWorkflowWorkerError";
|
|
11
13
|
}
|
|
14
|
+
export type AmpWorkflowMode = "deep" | "rush";
|
|
15
|
+
export declare const assertAmpWorkflowMode: (mode: string | undefined) => AmpWorkflowMode | undefined;
|
|
16
|
+
export declare const buildAmpArgs: (input: {
|
|
17
|
+
readonly mode?: string;
|
|
18
|
+
readonly prompt: string;
|
|
19
|
+
readonly sessionId?: string;
|
|
20
|
+
readonly permission?: WorkflowPermissionMode;
|
|
21
|
+
/**
|
|
22
|
+
* Required for permissive/full-access. runAmpWorkflowTask supplies a temp
|
|
23
|
+
* settings file with amp.dangerouslyAllowAll enabled before invoking this.
|
|
24
|
+
*/
|
|
25
|
+
readonly settingsFile?: string;
|
|
26
|
+
}) => ReadonlyArray<string>;
|
|
27
|
+
export declare const ampSessionId: (stdout: string, stderr: string) => string | undefined;
|
|
12
28
|
export declare const runAmpWorkflowTask: (task: AnyWorkflowTask, options: AmpWorkflowWorkerOptions) => Promise<WorkflowTaskExecution>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { WorkflowWorkerProcessOptions, WorkflowWorkerProcessResult } from "./workflow-worker-process.js";
|
|
2
|
+
/**
|
|
3
|
+
* Embedded Python PTY wrapper for spawning the Antigravity CLI (`agy`) with a
|
|
4
|
+
* controlling terminal. The upstream `agy --print` mode is known to drop or
|
|
5
|
+
* stall stdout when stdin is not a TTY; allocating a PTY works around the
|
|
6
|
+
* issue and also lets us reliably terminate the whole process group.
|
|
7
|
+
*
|
|
8
|
+
* The wrapper runs on Python 3, uses only stdlib modules, and is written to
|
|
9
|
+
* be compatible with both macOS and Linux.
|
|
10
|
+
*/
|
|
11
|
+
export declare const antigravityPtyWrapperScript: () => string;
|
|
12
|
+
export interface AntigravityPtyProcessOptions extends WorkflowWorkerProcessOptions {
|
|
13
|
+
/** Go-style duration string passed to `agy --print-timeout`. */
|
|
14
|
+
readonly printTimeout: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Run a command through the Python PTY wrapper with process-group cleanup.
|
|
18
|
+
*
|
|
19
|
+
* This is intentionally lower-level than `runWorkflowWorkerProcess` so the
|
|
20
|
+
* Antigravity worker can decide when the extra weight is justified.
|
|
21
|
+
*/
|
|
22
|
+
export declare const runAntigravityPtyProcess: (options: AntigravityPtyProcessOptions) => Promise<WorkflowWorkerProcessResult>;
|
|
@@ -1,14 +1,75 @@
|
|
|
1
|
-
import type { AnyWorkflowTask } from "./workflows.js";
|
|
2
|
-
import type { WorkflowTaskExecution } from "./workflow-runner.js";
|
|
3
|
-
|
|
1
|
+
import type { AntigravityWorkflowPermissionMode, AnyWorkflowTask, WorkflowPermissionMode } from "./workflows.js";
|
|
2
|
+
import type { WorkflowTaskExecution, WorkflowTaskRepairLoopOption } from "./workflow-runner.js";
|
|
3
|
+
/**
|
|
4
|
+
* Environment-variable overrides for the Antigravity workflow worker:
|
|
5
|
+
*
|
|
6
|
+
* - PRISM_WORKFLOW_ANTIGRAVITY_BIN: path to the `agy` executable.
|
|
7
|
+
* - PRISM_WORKFLOW_ANTIGRAVITY_PRINT_TIMEOUT: value passed to `agy --print-timeout`.
|
|
8
|
+
* - PRISM_WORKFLOW_ANTIGRAVITY_PROCESS_TIMEOUT_MS: outer watchdog before Prism kills `agy`.
|
|
9
|
+
* - PRISM_WORKFLOW_ANTIGRAVITY_PTY: set to "1" or "true" to force a Python PTY wrapper.
|
|
10
|
+
* Useful when `agy --print` drops stdout because stdin is not a TTY.
|
|
11
|
+
* - PRISM_WORKFLOW_ANTIGRAVITY_PTY_PYTHON: path to a Python 3 interpreter (default: `python3` on PATH).
|
|
12
|
+
* - PRISM_WORKFLOW_ANTIGRAVITY_RETRY_MAX_ATTEMPTS: retries on sentinel/empty output (default: 3).
|
|
13
|
+
* - PRISM_WORKFLOW_ANTIGRAVITY_RETRY_BACKOFF_MS: delay between retries (default: 2000).
|
|
14
|
+
*/
|
|
15
|
+
export type AntigravityWorkflowWorkerOptions = {
|
|
4
16
|
readonly cwd: string;
|
|
5
17
|
readonly bin?: string;
|
|
6
18
|
readonly model?: string;
|
|
19
|
+
readonly resolvedPermission: AntigravityWorkflowPermissionMode;
|
|
7
20
|
readonly printTimeout?: string;
|
|
8
21
|
readonly processTimeoutMs?: number;
|
|
9
22
|
readonly abortSignal?: AbortSignal;
|
|
10
|
-
|
|
23
|
+
/** Override the default retry budget. Mostly useful in tests. */
|
|
24
|
+
readonly maxAttempts?: number;
|
|
25
|
+
/** Override the default retry backoff. Mostly useful in tests. */
|
|
26
|
+
readonly backoffMs?: number;
|
|
27
|
+
} & WorkflowTaskRepairLoopOption<"antigravity-cli">;
|
|
11
28
|
export declare class AntigravityWorkflowWorkerError extends Error {
|
|
12
29
|
readonly name = "AntigravityWorkflowWorkerError";
|
|
13
30
|
}
|
|
31
|
+
export declare const DEFAULT_ANTIGRAVITY_MODEL = "Gemini 3.5 Flash (Medium)";
|
|
32
|
+
export type AgyConversationId = string & {
|
|
33
|
+
readonly __brand: "AgyConversationId";
|
|
34
|
+
};
|
|
35
|
+
type AgyValue<Kind extends string> = string & {
|
|
36
|
+
readonly __agyValue: Kind;
|
|
37
|
+
};
|
|
38
|
+
type AgyLogFile = AgyValue<"log-file">;
|
|
39
|
+
type AgyPrintTimeout = AgyValue<"print-timeout">;
|
|
40
|
+
type AgyWorkspaceDir = AgyValue<"workspace-dir">;
|
|
41
|
+
type AgyModel = AgyValue<"model">;
|
|
42
|
+
type AgyPrompt = AgyValue<"prompt">;
|
|
43
|
+
type AgyLogFileArgs = readonly ["--log-file", AgyLogFile];
|
|
44
|
+
type AgyConversationArgs = readonly ["--conversation", AgyConversationId];
|
|
45
|
+
type AgyPermissionArgs = readonly ["--dangerously-skip-permissions", "--sandbox"];
|
|
46
|
+
type AgyTimeoutArgs = readonly ["--print-timeout", AgyPrintTimeout];
|
|
47
|
+
type AgyWorkspaceArgs = readonly ["--add-dir", AgyWorkspaceDir];
|
|
48
|
+
type AgyModelArgs = readonly ["--model", AgyModel];
|
|
49
|
+
type AgyRequiredPrintArgs = readonly [
|
|
50
|
+
...AgyPermissionArgs,
|
|
51
|
+
...AgyTimeoutArgs,
|
|
52
|
+
...AgyWorkspaceArgs,
|
|
53
|
+
...AgyModelArgs,
|
|
54
|
+
"--print",
|
|
55
|
+
AgyPrompt
|
|
56
|
+
];
|
|
57
|
+
export type AgyForbiddenWorkflowFlag = "--continue" | "-c";
|
|
58
|
+
export type AgyPrintArgs = AgyRequiredPrintArgs | readonly [...AgyLogFileArgs, ...AgyRequiredPrintArgs] | readonly [...AgyConversationArgs, ...AgyRequiredPrintArgs] | readonly [...AgyLogFileArgs, ...AgyConversationArgs, ...AgyRequiredPrintArgs];
|
|
59
|
+
export declare const AGY_FORBIDDEN_WORKFLOW_FLAGS: Set<AgyForbiddenWorkflowFlag>;
|
|
60
|
+
export declare const assertAgyPrintArgsWorkflowSafe: (args: readonly string[]) => void;
|
|
61
|
+
export declare const detectAgyPrintTimeout: (stdout: string, stderr: string) => boolean;
|
|
62
|
+
export declare const resolveAntigravityPermission: (mode: WorkflowPermissionMode) => AntigravityWorkflowPermissionMode;
|
|
63
|
+
export declare const buildAgyArgs: (input: {
|
|
64
|
+
readonly cwd: string;
|
|
65
|
+
readonly model: string;
|
|
66
|
+
readonly permission?: AntigravityWorkflowPermissionMode;
|
|
67
|
+
readonly printTimeout: string;
|
|
68
|
+
readonly prompt: string;
|
|
69
|
+
readonly conversationId?: AgyConversationId;
|
|
70
|
+
readonly logFile?: string;
|
|
71
|
+
}) => AgyPrintArgs;
|
|
72
|
+
export declare const parseAgyConversationId: (value: string | undefined) => AgyConversationId | undefined;
|
|
73
|
+
export declare const extractAgyConversationId: (logText: string) => AgyConversationId | undefined;
|
|
14
74
|
export declare const runAntigravityWorkflowTask: (task: AnyWorkflowTask, options: AntigravityWorkflowWorkerOptions) => Promise<WorkflowTaskExecution>;
|
|
75
|
+
export {};
|
|
@@ -1,13 +1,32 @@
|
|
|
1
|
-
import type { AnyWorkflowTask } from "./workflows.js";
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import type { AnyWorkflowTask, WorkflowPermissionMode } from "./workflows.js";
|
|
2
|
+
import { type WorkflowJsonSchema } from "./workflow-output-schema.js";
|
|
3
|
+
import type { WorkflowTaskExecution, WorkflowTaskRepairLoopOption } from "./workflow-runner.js";
|
|
4
|
+
export type ClaudeWorkflowWorkerOptions = {
|
|
4
5
|
readonly cwd: string;
|
|
5
6
|
readonly bin?: string;
|
|
6
7
|
readonly model?: string;
|
|
8
|
+
readonly resolvedPermission: WorkflowPermissionMode;
|
|
9
|
+
readonly restrictedTools?: readonly string[];
|
|
10
|
+
readonly processTimeoutMs?: number;
|
|
7
11
|
readonly abortSignal?: AbortSignal;
|
|
8
|
-
|
|
9
|
-
}
|
|
12
|
+
} & WorkflowTaskRepairLoopOption<"claude-code">;
|
|
10
13
|
export declare class ClaudeWorkflowWorkerError extends Error {
|
|
11
14
|
readonly name = "ClaudeWorkflowWorkerError";
|
|
12
15
|
}
|
|
16
|
+
export interface ClaudeGeneratedPluginDiscovery {
|
|
17
|
+
readonly pluginDir?: string;
|
|
18
|
+
readonly mcpConfig?: string;
|
|
19
|
+
readonly allowedTools?: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
export declare const discoverClaudeGeneratedPlugin: (task: AnyWorkflowTask) => ClaudeGeneratedPluginDiscovery;
|
|
22
|
+
export declare const buildClaudeArgs: (input: {
|
|
23
|
+
readonly agent: string;
|
|
24
|
+
readonly model?: string;
|
|
25
|
+
readonly prompt: string;
|
|
26
|
+
readonly resumeSessionId?: string;
|
|
27
|
+
readonly generatedPlugin?: ClaudeGeneratedPluginDiscovery;
|
|
28
|
+
readonly outputSchema?: WorkflowJsonSchema;
|
|
29
|
+
readonly permission?: WorkflowPermissionMode;
|
|
30
|
+
readonly restrictedTools?: readonly string[];
|
|
31
|
+
}) => ReadonlyArray<string>;
|
|
13
32
|
export declare const runClaudeWorkflowTask: (task: AnyWorkflowTask, options: ClaudeWorkflowWorkerOptions) => Promise<WorkflowTaskExecution>;
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import type { AnyWorkflowTask } from "./workflows.js";
|
|
2
|
-
import type { WorkflowTaskExecution } from "./workflow-runner.js";
|
|
3
|
-
export
|
|
1
|
+
import type { AnyWorkflowTask, WorkflowPermissionMode } from "./workflows.js";
|
|
2
|
+
import type { WorkflowTaskExecution, WorkflowTaskRepairLoopOption } from "./workflow-runner.js";
|
|
3
|
+
export type CodexWorkflowWorkerOptions = {
|
|
4
4
|
readonly cwd: string;
|
|
5
5
|
readonly bin?: string;
|
|
6
6
|
readonly model?: string;
|
|
7
|
+
readonly resolvedPermission: WorkflowPermissionMode;
|
|
8
|
+
readonly processTimeoutMs?: number;
|
|
7
9
|
readonly abortSignal?: AbortSignal;
|
|
8
|
-
}
|
|
10
|
+
} & WorkflowTaskRepairLoopOption<"codex-cli">;
|
|
9
11
|
export declare class CodexWorkflowWorkerError extends Error {
|
|
10
12
|
readonly name = "CodexWorkflowWorkerError";
|
|
11
13
|
}
|
|
14
|
+
export declare const buildCodexArgs: (input: {
|
|
15
|
+
readonly cwd: string;
|
|
16
|
+
readonly model?: string;
|
|
17
|
+
readonly outputSchemaPath?: string;
|
|
18
|
+
readonly outputPath: string;
|
|
19
|
+
readonly prompt: string;
|
|
20
|
+
readonly resumeSessionId?: string;
|
|
21
|
+
readonly permission?: WorkflowPermissionMode;
|
|
22
|
+
}) => ReadonlyArray<string>;
|
|
23
|
+
export declare const codexSessionId: (stdout: string, stderr: string) => string | undefined;
|
|
12
24
|
export declare const runCodexWorkflowTask: (task: AnyWorkflowTask, options: CodexWorkflowWorkerOptions) => Promise<WorkflowTaskExecution>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Errors surfaced by {@link WorkflowRuntime.runTask} and dynamic workflow runs. */
|
|
2
|
+
export declare class WorkflowTaskDecodeError extends Error {
|
|
3
|
+
readonly taskId: string;
|
|
4
|
+
readonly cause: unknown;
|
|
5
|
+
readonly name = "WorkflowTaskDecodeError";
|
|
6
|
+
constructor(taskId: string, cause: unknown);
|
|
7
|
+
}
|
|
8
|
+
export declare class WorkflowRunStoppedError extends Error {
|
|
9
|
+
readonly runId: string;
|
|
10
|
+
readonly name = "WorkflowRunStoppedError";
|
|
11
|
+
constructor(runId: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class WorkflowTaskEscalatedError extends Error {
|
|
14
|
+
readonly taskId: string;
|
|
15
|
+
readonly criterion: string;
|
|
16
|
+
readonly feedback?: string | undefined;
|
|
17
|
+
readonly name = "WorkflowTaskEscalatedError";
|
|
18
|
+
constructor(taskId: string, criterion: string, feedback?: string | undefined);
|
|
19
|
+
}
|
|
20
|
+
export type WorkflowRuntimeError = WorkflowTaskDecodeError | WorkflowTaskEscalatedError | WorkflowRunStoppedError | Error;
|
|
21
|
+
export declare const toWorkflowRuntimeError: (error: unknown) => WorkflowRuntimeError;
|
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
import type { AnyWorkflowTask } from "./workflows.js";
|
|
2
|
-
import type { WorkflowTaskExecution } from "./workflow-runner.js";
|
|
3
|
-
export
|
|
1
|
+
import type { AnyWorkflowTask, WorkflowPermissionMode } from "./workflows.js";
|
|
2
|
+
import type { WorkflowTaskExecution, WorkflowTaskRepairLoopOption } from "./workflow-runner.js";
|
|
3
|
+
export type GrokWorkflowWorkerOptions = {
|
|
4
4
|
readonly cwd: string;
|
|
5
5
|
readonly bin?: string;
|
|
6
6
|
readonly model?: string;
|
|
7
7
|
readonly effort?: string;
|
|
8
|
+
readonly resolvedPermission: WorkflowPermissionMode;
|
|
9
|
+
readonly processTimeoutMs?: number;
|
|
8
10
|
readonly abortSignal?: AbortSignal;
|
|
9
|
-
}
|
|
11
|
+
} & WorkflowTaskRepairLoopOption<"grok">;
|
|
10
12
|
export declare class WorkflowWorkerError extends Error {
|
|
11
13
|
readonly name = "WorkflowWorkerError";
|
|
12
14
|
}
|
|
15
|
+
export declare const isGrokAuthOutput: (output: string) => boolean;
|
|
16
|
+
export declare const buildGrokArgs: (input: {
|
|
17
|
+
readonly cwd: string;
|
|
18
|
+
readonly agent: string;
|
|
19
|
+
readonly model?: string;
|
|
20
|
+
readonly effort?: string;
|
|
21
|
+
readonly prompt: string;
|
|
22
|
+
readonly sessionId?: string;
|
|
23
|
+
readonly permission?: WorkflowPermissionMode;
|
|
24
|
+
}) => ReadonlyArray<string>;
|
|
25
|
+
export declare const grokSessionId: (stdout: string, stderr: string) => string | undefined;
|
|
13
26
|
export declare const runGrokWorkflowTask: (task: AnyWorkflowTask, options: GrokWorkflowWorkerOptions) => Promise<WorkflowTaskExecution>;
|
|
14
27
|
export { parseWorkflowWorkerJsonOutput, WorkflowOutputParseError } from "./workflow-worker-contract.js";
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import type { AnyWorkflowTask } from "./workflows.js";
|
|
2
|
-
import type { WorkflowTaskExecution } from "./workflow-runner.js";
|
|
3
|
-
export
|
|
1
|
+
import type { AnyWorkflowTask, WorkflowPermissionMode } from "./workflows.js";
|
|
2
|
+
import type { WorkflowTaskExecution, WorkflowTaskRepairLoopOption } from "./workflow-runner.js";
|
|
3
|
+
export type HermesWorkflowWorkerOptions = {
|
|
4
4
|
readonly cwd: string;
|
|
5
5
|
readonly bin?: string;
|
|
6
6
|
readonly model?: string;
|
|
7
7
|
readonly profile?: string;
|
|
8
|
+
readonly resolvedPermission: WorkflowPermissionMode;
|
|
8
9
|
readonly processTimeoutMs?: number;
|
|
9
10
|
readonly abortSignal?: AbortSignal;
|
|
10
|
-
}
|
|
11
|
+
} & WorkflowTaskRepairLoopOption<"hermes">;
|
|
11
12
|
export declare class HermesWorkflowWorkerError extends Error {
|
|
12
13
|
readonly name = "HermesWorkflowWorkerError";
|
|
13
14
|
}
|
|
15
|
+
export declare const buildHermesArgs: (input: {
|
|
16
|
+
readonly profile?: string;
|
|
17
|
+
readonly model?: string;
|
|
18
|
+
readonly prompt: string;
|
|
19
|
+
readonly resumeSessionId?: string;
|
|
20
|
+
readonly permission?: WorkflowPermissionMode;
|
|
21
|
+
}) => ReadonlyArray<string>;
|
|
14
22
|
export declare const runHermesWorkflowTask: (task: AnyWorkflowTask, options: HermesWorkflowWorkerOptions) => Promise<WorkflowTaskExecution>;
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
import type { AnyWorkflowTask } from "./workflows.js";
|
|
2
|
-
import type { WorkflowTaskExecution } from "./workflow-runner.js";
|
|
3
|
-
export
|
|
1
|
+
import type { AnyWorkflowTask, WorkflowPermissionMode } from "./workflows.js";
|
|
2
|
+
import type { WorkflowTaskExecution, WorkflowTaskRepairLoopOption } from "./workflow-runner.js";
|
|
3
|
+
export type KimiWorkflowWorkerOptions = {
|
|
4
4
|
readonly cwd: string;
|
|
5
5
|
readonly bin?: string;
|
|
6
6
|
readonly model?: string;
|
|
7
7
|
readonly kimiHome?: string;
|
|
8
|
+
readonly resolvedPermission: WorkflowPermissionMode;
|
|
8
9
|
readonly processTimeoutMs?: number;
|
|
9
10
|
readonly abortSignal?: AbortSignal;
|
|
10
|
-
}
|
|
11
|
+
} & WorkflowTaskRepairLoopOption<"kimi-code">;
|
|
11
12
|
export declare class KimiWorkflowWorkerError extends Error {
|
|
12
13
|
readonly name = "KimiWorkflowWorkerError";
|
|
13
14
|
}
|
|
15
|
+
export declare const isKimiAuthOutput: (output: string) => boolean;
|
|
16
|
+
export declare const kimiSessionIdFromStream: (stdout: string) => string | undefined;
|
|
17
|
+
export declare const buildKimiArgs: (input: {
|
|
18
|
+
readonly model?: string;
|
|
19
|
+
readonly prompt: string;
|
|
20
|
+
readonly skillsDir: string;
|
|
21
|
+
readonly sessionId?: string;
|
|
22
|
+
readonly permission?: WorkflowPermissionMode;
|
|
23
|
+
}) => ReadonlyArray<string>;
|
|
14
24
|
export declare const runKimiWorkflowTask: (task: AnyWorkflowTask, options: KimiWorkflowWorkerOptions) => Promise<WorkflowTaskExecution>;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import type { AnyWorkflowTask } from "./workflows.js";
|
|
2
|
-
import type { WorkflowTaskExecution } from "./workflow-runner.js";
|
|
3
|
-
export
|
|
1
|
+
import type { AnyWorkflowTask, WorkflowPermissionMode } from "./workflows.js";
|
|
2
|
+
import type { WorkflowTaskExecution, WorkflowTaskRepairLoopOption } from "./workflow-runner.js";
|
|
3
|
+
export type OpenCodeWorkflowWorkerOptions = {
|
|
4
4
|
readonly cwd: string;
|
|
5
5
|
readonly bin?: string;
|
|
6
6
|
readonly model?: string;
|
|
7
|
+
readonly resolvedPermission: WorkflowPermissionMode;
|
|
8
|
+
readonly processTimeoutMs?: number;
|
|
7
9
|
readonly abortSignal?: AbortSignal;
|
|
8
|
-
}
|
|
10
|
+
} & WorkflowTaskRepairLoopOption<"opencode">;
|
|
9
11
|
export declare class OpenCodeWorkflowWorkerError extends Error {
|
|
10
12
|
readonly name = "OpenCodeWorkflowWorkerError";
|
|
11
13
|
}
|
|
14
|
+
export declare const buildOpenCodeArgs: (input: {
|
|
15
|
+
readonly cwd: string;
|
|
16
|
+
readonly agent: string;
|
|
17
|
+
readonly model?: string;
|
|
18
|
+
readonly prompt: string;
|
|
19
|
+
readonly sessionId?: string;
|
|
20
|
+
readonly permission?: WorkflowPermissionMode;
|
|
21
|
+
}) => ReadonlyArray<string>;
|
|
12
22
|
export declare const runOpenCodeWorkflowTask: (task: AnyWorkflowTask, options: OpenCodeWorkflowWorkerOptions) => Promise<WorkflowTaskExecution>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export type WorkflowJsonSchema = Record<string, unknown>;
|
|
3
|
+
export declare class WorkflowOutputSchemaError extends Error {
|
|
4
|
+
readonly name = "WorkflowOutputSchemaError";
|
|
5
|
+
}
|
|
6
|
+
export declare const workflowJsonSchemaFromEffectSchema: (schema: Schema.Schema.AnyNoContext) => WorkflowJsonSchema;
|
|
7
|
+
export declare const tryWorkflowJsonSchemaFromEffectSchema: (schema: Schema.Schema.AnyNoContext) => WorkflowJsonSchema | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WorkflowPermissionMode } from "./workflows.js";
|
|
2
|
+
export declare const WORKFLOW_PERMISSION_MODES: readonly ["legacy", "permissive", "restricted", "interactive", "sandbox-read-only", "sandbox-workspace-write", "full-access"];
|
|
3
|
+
export declare const isWorkflowPermissionMode: (value: string) => value is WorkflowPermissionMode;
|
|
4
|
+
export declare const assertNeverWorkflowPermissionMode: (worker: string, mode: never) => never;
|
|
5
|
+
export declare class WorkflowPermissionError extends Error {
|
|
6
|
+
readonly worker: string;
|
|
7
|
+
readonly mode: string;
|
|
8
|
+
readonly name = "WorkflowPermissionError";
|
|
9
|
+
constructor(worker: string, mode: string, message: string);
|
|
10
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AnyWorkflowDefinition, type AnyWorkflowTask, type WorkflowRuntimeOptions } from "./workflows.js";
|
|
2
2
|
import { type WorkflowStore } from "./workflow-store.js";
|
|
3
|
+
import { type WorkflowRepairLoopContinuationWorkerId, type WorkflowStableSession } from "./workflow-session.js";
|
|
3
4
|
export interface WorkflowTaskExecution {
|
|
4
5
|
readonly output: unknown;
|
|
5
6
|
readonly metadata?: Record<string, unknown>;
|
|
@@ -20,41 +21,36 @@ export interface WorkflowRunResult {
|
|
|
20
21
|
readonly tasks: ReadonlyArray<WorkflowRunTaskResult>;
|
|
21
22
|
readonly output?: unknown;
|
|
22
23
|
}
|
|
23
|
-
export
|
|
24
|
-
readonly taskId: string;
|
|
25
|
-
readonly cause: unknown;
|
|
26
|
-
readonly name = "WorkflowTaskDecodeError";
|
|
27
|
-
constructor(taskId: string, cause: unknown);
|
|
28
|
-
}
|
|
29
|
-
export declare class WorkflowRunStoppedError extends Error {
|
|
30
|
-
readonly runId: string;
|
|
31
|
-
readonly name = "WorkflowRunStoppedError";
|
|
32
|
-
constructor(runId: string);
|
|
33
|
-
}
|
|
34
|
-
export declare class WorkflowTaskEscalatedError extends Error {
|
|
35
|
-
readonly taskId: string;
|
|
36
|
-
readonly criterion: string;
|
|
37
|
-
readonly feedback?: string | undefined;
|
|
38
|
-
readonly name = "WorkflowTaskEscalatedError";
|
|
39
|
-
constructor(taskId: string, criterion: string, feedback?: string | undefined);
|
|
40
|
-
}
|
|
24
|
+
export { WorkflowRunStoppedError, WorkflowTaskDecodeError, WorkflowTaskEscalatedError, type WorkflowRuntimeError, } from "./workflow-errors.js";
|
|
41
25
|
export type WorkflowTaskRepairMode = "native-continuation" | "fresh-executor-invocation" | "none";
|
|
42
|
-
export
|
|
26
|
+
export type WorkflowTaskRepairFallbackReason = "adapter-does-not-support-continuation" | "executor-does-not-advertise-continuation" | "missing-session-id";
|
|
27
|
+
interface WorkflowTaskRepairContextBase {
|
|
43
28
|
readonly attempt: number;
|
|
44
29
|
readonly criterion: string;
|
|
45
30
|
readonly repairPrompt: string;
|
|
46
|
-
readonly mode: Exclude<WorkflowTaskRepairMode, "none">;
|
|
47
31
|
readonly previousMetadata?: Record<string, unknown>;
|
|
48
|
-
readonly fallbackReason?: "adapter-does-not-support-continuation" | "executor-does-not-advertise-continuation" | "missing-session-id";
|
|
49
|
-
readonly continuation?: {
|
|
50
|
-
readonly adapter: string;
|
|
51
|
-
readonly sessionId: string;
|
|
52
|
-
};
|
|
53
32
|
}
|
|
33
|
+
export type WorkflowTaskRepairContext = WorkflowTaskRepairContextBase & ({
|
|
34
|
+
readonly mode: "native-continuation";
|
|
35
|
+
readonly continuation: WorkflowStableSession;
|
|
36
|
+
readonly fallbackReason?: never;
|
|
37
|
+
} | {
|
|
38
|
+
readonly mode: "fresh-executor-invocation";
|
|
39
|
+
readonly fallbackReason: WorkflowTaskRepairFallbackReason;
|
|
40
|
+
readonly continuation?: never;
|
|
41
|
+
});
|
|
54
42
|
export interface WorkflowTaskExecutionContext {
|
|
55
43
|
readonly abortSignal?: AbortSignal;
|
|
56
44
|
readonly repair?: WorkflowTaskRepairContext;
|
|
57
45
|
}
|
|
46
|
+
export interface WorkflowTaskExecutionContextWithoutRepair {
|
|
47
|
+
readonly abortSignal?: AbortSignal;
|
|
48
|
+
}
|
|
49
|
+
export type WorkflowTaskRepairLoopOption<Worker extends string> = Worker extends WorkflowRepairLoopContinuationWorkerId ? {
|
|
50
|
+
readonly repair?: WorkflowTaskRepairContext;
|
|
51
|
+
} : {
|
|
52
|
+
readonly repair?: never;
|
|
53
|
+
};
|
|
58
54
|
export type WorkflowTaskExecutor = (task: AnyWorkflowTask, context?: WorkflowTaskExecutionContext) => Promise<unknown | WorkflowTaskExecution>;
|
|
59
55
|
export declare const DEFAULT_WORKFLOW_TASK_CONCURRENCY = 8;
|
|
60
56
|
export declare const runWorkflow: (workflow: AnyWorkflowDefinition, options: {
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const WorkflowContinuationAdapterIdSchema: Schema.Literal<["amp-code", "antigravity-cli", "claude-code", "codex-cli", "grok-cli", "hermes", "kimi-code", "opencode-cli"]>;
|
|
3
|
+
export type WorkflowContinuationAdapterId = typeof WorkflowContinuationAdapterIdSchema.Type;
|
|
4
|
+
export declare const WorkflowContinuationWorkerIdSchema: Schema.Literal<["amp-code", "antigravity-cli", "claude-code", "codex-cli", "grok", "hermes", "kimi-code", "opencode"]>;
|
|
5
|
+
export type WorkflowContinuationWorkerId = typeof WorkflowContinuationWorkerIdSchema.Type;
|
|
6
|
+
export declare const StableSessionIdSchema: Schema.brand<typeof Schema.NonEmptyTrimmedString, "StableSessionId">;
|
|
7
|
+
export type StableSessionId = typeof StableSessionIdSchema.Type;
|
|
8
|
+
export declare const WorkflowStableSessionSchema: Schema.Struct<{
|
|
9
|
+
adapter: Schema.Literal<["amp-code", "antigravity-cli", "claude-code", "codex-cli", "grok-cli", "hermes", "kimi-code", "opencode-cli"]>;
|
|
10
|
+
sessionId: Schema.brand<typeof Schema.NonEmptyTrimmedString, "StableSessionId">;
|
|
11
|
+
}>;
|
|
12
|
+
export type WorkflowStableSession = typeof WorkflowStableSessionSchema.Type;
|
|
13
|
+
export declare const WorkflowHarnessContinuationSupportSchema: Schema.Union<[Schema.Struct<{
|
|
14
|
+
adapter: Schema.Literal<["amp-code", "antigravity-cli", "claude-code", "codex-cli", "grok-cli", "hermes", "kimi-code", "opencode-cli"]>;
|
|
15
|
+
workflowWorker: typeof Schema.Boolean;
|
|
16
|
+
stableSessionIds: Schema.Literal<[true]>;
|
|
17
|
+
exactSameSessionContinuation: Schema.Literal<[true]>;
|
|
18
|
+
sessionIdField: Schema.Literal<["sessionId"]>;
|
|
19
|
+
continueCommand: typeof Schema.NonEmptyTrimmedString;
|
|
20
|
+
capture: typeof Schema.NonEmptyTrimmedString;
|
|
21
|
+
}>, Schema.Struct<{
|
|
22
|
+
adapter: Schema.Literal<["amp-code", "antigravity-cli", "claude-code", "codex-cli", "grok-cli", "hermes", "kimi-code", "opencode-cli"]>;
|
|
23
|
+
workflowWorker: typeof Schema.Boolean;
|
|
24
|
+
stableSessionIds: Schema.Literal<[false]>;
|
|
25
|
+
exactSameSessionContinuation: Schema.Literal<[false]>;
|
|
26
|
+
sessionIdField: Schema.Literal<["sessionId"]>;
|
|
27
|
+
reason: typeof Schema.NonEmptyTrimmedString;
|
|
28
|
+
}>]>;
|
|
29
|
+
export type WorkflowHarnessContinuationSupport = typeof WorkflowHarnessContinuationSupportSchema.Type;
|
|
30
|
+
export declare const workflowContinuationAdapterByWorker: {
|
|
31
|
+
readonly "amp-code": "amp-code";
|
|
32
|
+
readonly "antigravity-cli": "antigravity-cli";
|
|
33
|
+
readonly "claude-code": "claude-code";
|
|
34
|
+
readonly "codex-cli": "codex-cli";
|
|
35
|
+
readonly grok: "grok-cli";
|
|
36
|
+
readonly hermes: "hermes";
|
|
37
|
+
readonly "kimi-code": "kimi-code";
|
|
38
|
+
readonly opencode: "opencode-cli";
|
|
39
|
+
};
|
|
40
|
+
export type WorkflowRepairLoopContinuationWorkerId = keyof typeof workflowContinuationAdapterByWorker;
|
|
41
|
+
export type WorkflowRepairLoopContinuationCapability = "stable-session-repair-loop" | "no-repair-loop-continuation";
|
|
42
|
+
export type WorkflowRepairLoopContinuationCapabilityForWorker<Worker extends string> = Worker extends WorkflowRepairLoopContinuationWorkerId ? "stable-session-repair-loop" : "no-repair-loop-continuation";
|
|
43
|
+
export declare const workflowHarnessContinuationSupport: {
|
|
44
|
+
readonly "amp-code": {
|
|
45
|
+
readonly adapter: "amp-code";
|
|
46
|
+
readonly workflowWorker: true;
|
|
47
|
+
readonly stableSessionIds: true;
|
|
48
|
+
readonly exactSameSessionContinuation: true;
|
|
49
|
+
readonly sessionIdField: "sessionId";
|
|
50
|
+
readonly continueCommand: "amp threads continue <sessionId> --execute <prompt>";
|
|
51
|
+
readonly capture: "stream-json session_id, local thread metadata, or threads list/search recovery";
|
|
52
|
+
};
|
|
53
|
+
readonly "antigravity-cli": {
|
|
54
|
+
readonly adapter: "antigravity-cli";
|
|
55
|
+
readonly workflowWorker: true;
|
|
56
|
+
readonly stableSessionIds: true;
|
|
57
|
+
readonly exactSameSessionContinuation: true;
|
|
58
|
+
readonly sessionIdField: "sessionId";
|
|
59
|
+
readonly continueCommand: "agy --conversation <sessionId> --print <prompt>";
|
|
60
|
+
readonly capture: "conversation id from agy print metadata, cache, database, or log recovery";
|
|
61
|
+
};
|
|
62
|
+
readonly "claude-code": {
|
|
63
|
+
readonly adapter: "claude-code";
|
|
64
|
+
readonly workflowWorker: true;
|
|
65
|
+
readonly stableSessionIds: true;
|
|
66
|
+
readonly exactSameSessionContinuation: true;
|
|
67
|
+
readonly sessionIdField: "sessionId";
|
|
68
|
+
readonly continueCommand: "claude --resume <sessionId> --print <prompt>";
|
|
69
|
+
readonly capture: "stream-json session_id";
|
|
70
|
+
};
|
|
71
|
+
readonly "codex-cli": {
|
|
72
|
+
readonly adapter: "codex-cli";
|
|
73
|
+
readonly workflowWorker: true;
|
|
74
|
+
readonly stableSessionIds: true;
|
|
75
|
+
readonly exactSameSessionContinuation: true;
|
|
76
|
+
readonly sessionIdField: "sessionId";
|
|
77
|
+
readonly continueCommand: "codex exec resume <sessionId> <prompt>";
|
|
78
|
+
readonly capture: "session_meta payload id, rollout JSONL, app-server metadata, or session index recovery";
|
|
79
|
+
};
|
|
80
|
+
readonly "grok-cli": {
|
|
81
|
+
readonly adapter: "grok-cli";
|
|
82
|
+
readonly workflowWorker: true;
|
|
83
|
+
readonly stableSessionIds: true;
|
|
84
|
+
readonly exactSameSessionContinuation: true;
|
|
85
|
+
readonly sessionIdField: "sessionId";
|
|
86
|
+
readonly continueCommand: "grok -r <sessionId> <prompt>";
|
|
87
|
+
readonly capture: "json sessionId, sessions list/search, or session export recovery";
|
|
88
|
+
};
|
|
89
|
+
readonly hermes: {
|
|
90
|
+
readonly adapter: "hermes";
|
|
91
|
+
readonly workflowWorker: true;
|
|
92
|
+
readonly stableSessionIds: true;
|
|
93
|
+
readonly exactSameSessionContinuation: true;
|
|
94
|
+
readonly sessionIdField: "sessionId";
|
|
95
|
+
readonly continueCommand: "hermes chat --resume <sessionId> --query <prompt>";
|
|
96
|
+
readonly capture: "chat stderr session_id";
|
|
97
|
+
};
|
|
98
|
+
readonly "kimi-code": {
|
|
99
|
+
readonly adapter: "kimi-code";
|
|
100
|
+
readonly workflowWorker: true;
|
|
101
|
+
readonly stableSessionIds: true;
|
|
102
|
+
readonly exactSameSessionContinuation: true;
|
|
103
|
+
readonly sessionIdField: "sessionId";
|
|
104
|
+
readonly continueCommand: "kimi --session <sessionId> --prompt <prompt>";
|
|
105
|
+
readonly capture: "stream-json session.resume_hint.session_id or session index recovery";
|
|
106
|
+
};
|
|
107
|
+
readonly "opencode-cli": {
|
|
108
|
+
readonly adapter: "opencode-cli";
|
|
109
|
+
readonly workflowWorker: true;
|
|
110
|
+
readonly stableSessionIds: true;
|
|
111
|
+
readonly exactSameSessionContinuation: true;
|
|
112
|
+
readonly sessionIdField: "sessionId";
|
|
113
|
+
readonly continueCommand: "opencode run -s <sessionId> <prompt>";
|
|
114
|
+
readonly capture: "json step_start sessionID, session list, export, database, or log recovery";
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
export declare const stableSessionIdFromUnknown: (value: unknown) => StableSessionId | undefined;
|
|
118
|
+
export declare const workflowContinuationAdapterForWorker: (worker: string) => WorkflowContinuationAdapterId | undefined;
|
|
119
|
+
export declare const workflowWorkerSupportsRepairLoopContinuation: (worker: string) => worker is WorkflowRepairLoopContinuationWorkerId;
|
|
120
|
+
export declare const workflowContinuationSupportForAdapter: (adapter: string | undefined) => WorkflowHarnessContinuationSupport | undefined;
|
|
121
|
+
export declare const workflowAdapterFromMetadata: (metadata: Record<string, unknown> | undefined) => WorkflowContinuationAdapterId | undefined;
|
|
122
|
+
export declare const workflowStableSessionFromMetadata: (metadata: Record<string, unknown> | undefined) => WorkflowStableSession | undefined;
|
|
123
|
+
export declare const normalizeWorkflowSessionMetadata: (metadata: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
|
|
124
|
+
export declare const stableSessionIdFromRecordKeys: (value: unknown, keys: ReadonlyArray<string>) => StableSessionId | undefined;
|
|
125
|
+
export declare const stableSessionIdFromJsonLines: (text: string, keys?: ReadonlyArray<string>) => StableSessionId | undefined;
|
|
126
|
+
export declare const stableSessionIdFromRegex: (text: string, patterns: ReadonlyArray<RegExp>) => StableSessionId | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Database } from "bun:sqlite";
|
|
2
|
-
import type
|
|
2
|
+
import { type AnyWorkflowTask, type WorkflowJudgeVerdict, type WorkflowRuntimeOptions } from "./workflows.js";
|
|
3
3
|
export interface WorkflowTaskIdentity {
|
|
4
4
|
readonly workflow: string;
|
|
5
5
|
readonly taskId: string;
|
|
@@ -45,6 +45,7 @@ export interface WorkflowJudgeRecord {
|
|
|
45
45
|
export type WorkflowRunTaskStatus = "completed" | "failed" | "escalated";
|
|
46
46
|
export interface WorkflowRunTaskRecord {
|
|
47
47
|
readonly runId: string;
|
|
48
|
+
readonly ordinal: number;
|
|
48
49
|
readonly taskId: string;
|
|
49
50
|
readonly cacheKey: string;
|
|
50
51
|
readonly status: WorkflowRunTaskStatus;
|
|
@@ -59,6 +60,7 @@ export interface WorkflowRunTaskRecord {
|
|
|
59
60
|
export type WorkflowRunTaskProgressStatus = "running" | "completed" | "failed" | "escalated";
|
|
60
61
|
export type WorkflowRunTaskCacheLookup = "hit" | "miss" | "skipped";
|
|
61
62
|
export interface WorkflowRunTaskProgress {
|
|
63
|
+
readonly ordinal?: number;
|
|
62
64
|
readonly taskId: string;
|
|
63
65
|
readonly status: WorkflowRunTaskProgressStatus;
|
|
64
66
|
readonly cacheKey?: string;
|
|
@@ -75,6 +77,7 @@ export interface WorkflowRunTaskProgress {
|
|
|
75
77
|
export type WorkflowRunTaskExecutionSource = "cached" | "fresh" | "unknown";
|
|
76
78
|
export type WorkflowRunTaskEvidenceSource = "this-run" | "prior-cache-record" | "run-events" | "unknown";
|
|
77
79
|
export interface WorkflowRunTaskCompactSummary {
|
|
80
|
+
readonly ordinal?: number;
|
|
78
81
|
readonly taskId: string;
|
|
79
82
|
readonly status: WorkflowRunTaskProgressStatus;
|
|
80
83
|
readonly execution: WorkflowRunTaskExecutionSource;
|
|
@@ -95,6 +98,63 @@ export interface WorkflowRunTaskCompactSummary {
|
|
|
95
98
|
readonly lastEventType?: string;
|
|
96
99
|
readonly lastEventAt?: string;
|
|
97
100
|
}
|
|
101
|
+
export interface WorkflowRunSnapshot {
|
|
102
|
+
readonly runId: string;
|
|
103
|
+
readonly workflowFile: string;
|
|
104
|
+
readonly options?: Record<string, unknown>;
|
|
105
|
+
readonly createdAt: string;
|
|
106
|
+
readonly updatedAt: string;
|
|
107
|
+
}
|
|
108
|
+
export interface WorkflowRunTaskSnapshot {
|
|
109
|
+
readonly runId: string;
|
|
110
|
+
readonly ordinal: number;
|
|
111
|
+
readonly taskId: string;
|
|
112
|
+
readonly phase?: string;
|
|
113
|
+
readonly prompt: string;
|
|
114
|
+
readonly cacheKey: string;
|
|
115
|
+
readonly promptHash: string;
|
|
116
|
+
readonly agentManifestHash: string;
|
|
117
|
+
readonly agent: {
|
|
118
|
+
readonly plugin: string;
|
|
119
|
+
readonly name: string;
|
|
120
|
+
readonly description: string;
|
|
121
|
+
readonly sourceHash: string;
|
|
122
|
+
readonly manifestHash: string;
|
|
123
|
+
};
|
|
124
|
+
readonly worker?: {
|
|
125
|
+
readonly worker?: string;
|
|
126
|
+
readonly model?: string;
|
|
127
|
+
readonly profile?: string;
|
|
128
|
+
};
|
|
129
|
+
readonly outputSchema?: unknown;
|
|
130
|
+
readonly finishCriteria: ReadonlyArray<string>;
|
|
131
|
+
readonly createdAt: string;
|
|
132
|
+
}
|
|
133
|
+
export type WorkflowCacheBadge = "hit" | "miss" | "skipped" | "cached" | "fresh" | "write" | "mock" | `repair ${number}`;
|
|
134
|
+
export interface WorkflowMonitorTask extends WorkflowRunTaskCompactSummary {
|
|
135
|
+
readonly phase?: string;
|
|
136
|
+
readonly cacheKey?: string;
|
|
137
|
+
readonly prompt?: string;
|
|
138
|
+
readonly output?: unknown;
|
|
139
|
+
readonly metadata?: Record<string, unknown>;
|
|
140
|
+
readonly badges: ReadonlyArray<WorkflowCacheBadge>;
|
|
141
|
+
readonly snapshot?: WorkflowRunTaskSnapshot;
|
|
142
|
+
}
|
|
143
|
+
export interface WorkflowMonitorRun {
|
|
144
|
+
readonly run: WorkflowRunRecord;
|
|
145
|
+
readonly snapshot?: WorkflowRunSnapshot;
|
|
146
|
+
readonly totals: WorkflowRunCompactSummary["totals"];
|
|
147
|
+
readonly cacheBadges: ReadonlyArray<WorkflowCacheBadge>;
|
|
148
|
+
}
|
|
149
|
+
export interface WorkflowMonitorRunDetail extends WorkflowMonitorRun {
|
|
150
|
+
readonly tasks: ReadonlyArray<WorkflowMonitorTask>;
|
|
151
|
+
readonly events: ReadonlyArray<WorkflowEventRecord>;
|
|
152
|
+
readonly canUpdate: boolean;
|
|
153
|
+
}
|
|
154
|
+
export interface WorkflowMonitorState {
|
|
155
|
+
readonly runs: ReadonlyArray<WorkflowMonitorRun>;
|
|
156
|
+
readonly selectedRun: WorkflowMonitorRunDetail | null;
|
|
157
|
+
}
|
|
98
158
|
export interface WorkflowRunCompactSummary {
|
|
99
159
|
readonly kind: "workflow-execution-evidence";
|
|
100
160
|
readonly semanticCorrectness: "not-evaluated";
|
|
@@ -129,6 +189,13 @@ export interface WorkflowEventRecord {
|
|
|
129
189
|
}
|
|
130
190
|
export declare const defaultWorkflowStorePath: (projectPath: string) => string;
|
|
131
191
|
export declare const workflowTaskIdentity: (workflow: string, task: AnyWorkflowTask, runtimeOptions?: WorkflowRuntimeOptions) => WorkflowTaskIdentity;
|
|
192
|
+
export declare const workflowRunTaskSnapshotForTask: (input: {
|
|
193
|
+
readonly runId: string;
|
|
194
|
+
readonly ordinal: number;
|
|
195
|
+
readonly workflow: string;
|
|
196
|
+
readonly task: AnyWorkflowTask;
|
|
197
|
+
readonly runtimeOptions?: WorkflowRuntimeOptions;
|
|
198
|
+
}) => Omit<WorkflowRunTaskSnapshot, "createdAt">;
|
|
132
199
|
export declare class WorkflowStore {
|
|
133
200
|
private readonly db;
|
|
134
201
|
constructor(db: Database);
|
|
@@ -158,6 +225,14 @@ export declare class WorkflowStore {
|
|
|
158
225
|
readonly agentManifestHash?: string;
|
|
159
226
|
}): WorkflowCacheRecord[];
|
|
160
227
|
createRun(workflow: string, runId?: string): string;
|
|
228
|
+
recordRunSnapshot(input: {
|
|
229
|
+
readonly runId: string;
|
|
230
|
+
readonly workflowFile: string;
|
|
231
|
+
readonly options?: Record<string, unknown>;
|
|
232
|
+
}): void;
|
|
233
|
+
getRunSnapshot(runId: string): WorkflowRunSnapshot | null;
|
|
234
|
+
recordRunTaskSnapshot(input: Omit<WorkflowRunTaskSnapshot, "createdAt">): void;
|
|
235
|
+
listRunTaskSnapshots(runId: string): WorkflowRunTaskSnapshot[];
|
|
161
236
|
setRunHandoffToken(runId: string, token: string): void;
|
|
162
237
|
consumeRunHandoffToken(runId: string, token: string): boolean;
|
|
163
238
|
markRunRunnerStarted(runId: string, runnerPid: number): void;
|
|
@@ -201,6 +276,8 @@ export declare class WorkflowStore {
|
|
|
201
276
|
listRunTasks(runId: string): WorkflowRunTaskRecord[];
|
|
202
277
|
summarizeRunTasks(runId: string): WorkflowRunTaskProgress[];
|
|
203
278
|
compactRunSummary(runId: string): WorkflowRunCompactSummary | null;
|
|
279
|
+
workflowMonitorState(selectedRunId?: string): WorkflowMonitorState;
|
|
280
|
+
workflowMonitorRunDetail(runId: string): WorkflowMonitorRunDetail | null;
|
|
204
281
|
recordCompleted(input: {
|
|
205
282
|
readonly identity: WorkflowTaskIdentity;
|
|
206
283
|
readonly agent: {
|
|
@@ -37,6 +37,14 @@ export interface WorkflowTypeDirs {
|
|
|
37
37
|
* when the corresponding type surface cannot be located.
|
|
38
38
|
*/
|
|
39
39
|
export declare const resolveWorkflowTypeDirs: () => WorkflowTypeDirs;
|
|
40
|
+
/** Generated workflow ref modules under ~/.prism/state/projects/<key>/generated/. */
|
|
41
|
+
export declare const WORKFLOW_REFS_MODULES: readonly ["agents", "models", "skills", "traits", "orbits", "tools"];
|
|
42
|
+
export type WorkflowRefsModule = (typeof WORKFLOW_REFS_MODULES)[number];
|
|
43
|
+
/**
|
|
44
|
+
* Build path mappings for every generated `prism/refs` module. `prism/refs`
|
|
45
|
+
* itself resolves to `agents.ts` because that is the primary import surface.
|
|
46
|
+
*/
|
|
47
|
+
export declare const buildWorkflowRefsPaths: (refsDir: string) => Record<string, string[]>;
|
|
40
48
|
/**
|
|
41
49
|
* Build the `compilerOptions.paths` map for typechecking a workflow file from
|
|
42
50
|
* the resolved type dirs and (optionally) the project-keyed generated refs.
|
|
@@ -47,8 +55,8 @@ export declare const resolveWorkflowTypeDirs: () => WorkflowTypeDirs;
|
|
|
47
55
|
*/
|
|
48
56
|
export declare const buildWorkflowPaths: (options: {
|
|
49
57
|
readonly typeDirs: WorkflowTypeDirs;
|
|
50
|
-
/** Absolute path to the generated refs
|
|
51
|
-
readonly
|
|
58
|
+
/** Absolute path to the generated refs directory (~/.../generated/). */
|
|
59
|
+
readonly refsDir?: string;
|
|
52
60
|
}) => Record<string, string[]>;
|
|
53
61
|
export interface WorkflowTsconfigOptions {
|
|
54
62
|
/**
|
|
@@ -5,6 +5,10 @@ export interface WorkflowWorkerProcessOptions {
|
|
|
5
5
|
readonly abortSignal?: AbortSignal;
|
|
6
6
|
readonly processTimeoutMs?: number;
|
|
7
7
|
readonly env?: Record<string, string>;
|
|
8
|
+
readonly earlyExitPatterns?: ReadonlyArray<{
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly pattern: RegExp;
|
|
11
|
+
}>;
|
|
8
12
|
}
|
|
9
13
|
export interface WorkflowWorkerProcessResult {
|
|
10
14
|
readonly exitCode: number | null;
|
|
@@ -13,6 +17,7 @@ export interface WorkflowWorkerProcessResult {
|
|
|
13
17
|
readonly durationMs: number;
|
|
14
18
|
readonly timedOut: boolean;
|
|
15
19
|
readonly aborted: boolean;
|
|
20
|
+
readonly earlyExit?: string;
|
|
16
21
|
}
|
|
17
22
|
export declare const parsePositiveInteger: (value: string | undefined) => number | undefined;
|
|
18
23
|
export declare const workflowWorkerProcessExcerpt: (stdout: string, stderr: string) => string;
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { WorkflowTaskExecution, WorkflowTaskExecutionContext, WorkflowTaskExecutor } from "./workflow-runner.js";
|
|
3
|
-
|
|
1
|
+
import { type AnyWorkflowTask, type WorkflowPermissionMode, type WorkflowWorkerId } from "./workflows.js";
|
|
2
|
+
import type { WorkflowTaskExecution, WorkflowTaskExecutionContext, WorkflowTaskExecutionContextWithoutRepair, WorkflowTaskExecutor } from "./workflow-runner.js";
|
|
3
|
+
import { type WorkflowRepairLoopContinuationCapability, type WorkflowRepairLoopContinuationCapabilityForWorker } from "./workflow-session.js";
|
|
4
|
+
export { WorkflowPermissionError } from "./workflow-permissions.js";
|
|
5
|
+
export interface WorkflowWorkerAdapterOptionsBase {
|
|
4
6
|
readonly cwd: string;
|
|
5
7
|
readonly model?: string;
|
|
6
8
|
readonly profile?: string;
|
|
9
|
+
readonly resolvedPermission: WorkflowPermissionMode;
|
|
10
|
+
readonly restrictedTools?: readonly string[];
|
|
11
|
+
readonly processTimeoutMs?: number;
|
|
7
12
|
readonly abortSignal?: AbortSignal;
|
|
8
|
-
readonly context?: WorkflowTaskExecutionContext;
|
|
9
13
|
}
|
|
10
|
-
export
|
|
11
|
-
readonly
|
|
12
|
-
|
|
13
|
-
readonly
|
|
14
|
+
export type WorkflowWorkerAdapterOptionsForCapability<Capability extends WorkflowRepairLoopContinuationCapability> = WorkflowWorkerAdapterOptionsBase & (Capability extends "stable-session-repair-loop" ? {
|
|
15
|
+
readonly context?: WorkflowTaskExecutionContext;
|
|
16
|
+
} : {
|
|
17
|
+
readonly context?: WorkflowTaskExecutionContextWithoutRepair;
|
|
18
|
+
});
|
|
19
|
+
export type WorkflowWorkerAdapterOptions<Worker extends WorkflowWorkerId = WorkflowWorkerId> = WorkflowWorkerAdapterOptionsForCapability<WorkflowRepairLoopContinuationCapabilityForWorker<Worker>>;
|
|
20
|
+
export interface WorkflowWorkerAdapter<Worker extends WorkflowWorkerId = WorkflowWorkerId> {
|
|
21
|
+
readonly id: Worker;
|
|
22
|
+
readonly runTask: (task: AnyWorkflowTask, options: WorkflowWorkerAdapterOptions<Worker>) => Promise<WorkflowTaskExecution>;
|
|
14
23
|
}
|
|
15
24
|
export declare class UnsupportedWorkflowWorkerError extends Error {
|
|
16
25
|
readonly worker: string;
|
|
@@ -18,10 +27,17 @@ export declare class UnsupportedWorkflowWorkerError extends Error {
|
|
|
18
27
|
readonly name = "UnsupportedWorkflowWorkerError";
|
|
19
28
|
constructor(worker: string, supportedWorkers: ReadonlyArray<string>);
|
|
20
29
|
}
|
|
30
|
+
export declare class WorkflowWorkerContinuationError extends Error {
|
|
31
|
+
readonly name = "WorkflowWorkerContinuationError";
|
|
32
|
+
}
|
|
21
33
|
export declare const supportedWorkflowWorkers: () => ReadonlyArray<string>;
|
|
22
|
-
export declare
|
|
34
|
+
export declare function getWorkflowWorkerAdapter<Worker extends WorkflowWorkerId>(worker: Worker): WorkflowWorkerAdapter<Worker>;
|
|
35
|
+
export declare function getWorkflowWorkerAdapter(worker: string): WorkflowWorkerAdapter;
|
|
36
|
+
export declare const resolveWorkflowTaskPermission: (task: AnyWorkflowTask, fallbackPermission?: WorkflowPermissionMode) => WorkflowPermissionMode;
|
|
23
37
|
export declare const createWorkflowWorkerExecutor: (input: {
|
|
24
38
|
readonly worker?: string;
|
|
25
39
|
readonly cwd: string;
|
|
26
40
|
readonly model?: string;
|
|
41
|
+
readonly fallbackPermission?: WorkflowPermissionMode;
|
|
42
|
+
readonly taskTimeoutMs?: number;
|
|
27
43
|
}) => WorkflowTaskExecutor;
|
package/types/workflows.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
+
import type { Either } from "effect/Either";
|
|
3
|
+
import type { ParseError } from "effect/ParseResult";
|
|
4
|
+
import type { WorkflowRuntimeError } from "./workflow-errors.js";
|
|
5
|
+
export type { WorkflowRuntimeError } from "./workflow-errors.js";
|
|
2
6
|
export interface WorkflowModelRef {
|
|
3
7
|
readonly modelspace?: string;
|
|
4
8
|
readonly profile?: string;
|
|
9
|
+
readonly targets?: Readonly<Record<string, WorkflowModelTarget>>;
|
|
5
10
|
}
|
|
11
|
+
export type WorkflowModelTarget = Readonly<Record<string, unknown>>;
|
|
6
12
|
export interface WorkflowModelspaceRef {
|
|
7
13
|
readonly kind: "modelspace-ref";
|
|
8
14
|
readonly plugin: string;
|
|
@@ -13,6 +19,7 @@ export interface WorkflowModelProfileRef {
|
|
|
13
19
|
readonly plugin: string;
|
|
14
20
|
readonly modelspace: string;
|
|
15
21
|
readonly profile: string;
|
|
22
|
+
readonly targets?: Readonly<Record<string, WorkflowModelTarget>>;
|
|
16
23
|
}
|
|
17
24
|
export interface WorkflowManagedSkillRef {
|
|
18
25
|
readonly kind: "managed-skill-ref";
|
|
@@ -36,12 +43,35 @@ export interface WorkflowAgentRef {
|
|
|
36
43
|
readonly installs: ReadonlyArray<string>;
|
|
37
44
|
}
|
|
38
45
|
export type WorkflowOutputSchema = Schema.Schema.AnyNoContext;
|
|
46
|
+
export type WorkflowFinishCriterionError = Error;
|
|
39
47
|
export type WorkflowWorkerId = "amp-code" | "antigravity-cli" | "claude-code" | "codex-cli" | "grok" | "hermes" | "kimi-code" | "opencode";
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
export type WorkflowPermissionMode = "legacy" | "permissive" | "restricted" | "interactive" | "sandbox-read-only" | "sandbox-workspace-write" | "full-access";
|
|
49
|
+
export type AntigravityWorkflowPermissionMode = Extract<WorkflowPermissionMode, "legacy" | "permissive" | "full-access">;
|
|
50
|
+
type WorkflowTaskWorkerOptionsBase = {
|
|
51
|
+
readonly model?: string | WorkflowModelProfileRef;
|
|
52
|
+
readonly modelResolver?: (models: WorkflowResolvedModelTarget) => string;
|
|
43
53
|
readonly profile?: string;
|
|
44
|
-
|
|
54
|
+
readonly restrictedTools?: ReadonlyArray<string>;
|
|
55
|
+
readonly processTimeoutMs?: number;
|
|
56
|
+
};
|
|
57
|
+
export type WorkflowTaskWorkerOptions = (WorkflowTaskWorkerOptionsBase & {
|
|
58
|
+
readonly worker?: Exclude<WorkflowWorkerId, "antigravity-cli">;
|
|
59
|
+
readonly permission?: WorkflowPermissionMode;
|
|
60
|
+
}) | (WorkflowTaskWorkerOptionsBase & {
|
|
61
|
+
readonly worker: "antigravity-cli";
|
|
62
|
+
readonly permission?: AntigravityWorkflowPermissionMode;
|
|
63
|
+
});
|
|
64
|
+
export type WorkflowResolvedModelEntry = Readonly<{
|
|
65
|
+
readonly model: string;
|
|
66
|
+
}>;
|
|
67
|
+
export type WorkflowResolvedModelTarget = Readonly<Record<string, WorkflowResolvedModelEntry | WorkflowResolvedModelEntry[]>>;
|
|
68
|
+
export declare class WorkflowModelResolutionError extends Error {
|
|
69
|
+
readonly name = "WorkflowModelResolutionError";
|
|
70
|
+
}
|
|
71
|
+
export declare const resolveWorkflowTaskModel: (task: AnyWorkflowTask, options?: {
|
|
72
|
+
readonly worker?: string;
|
|
73
|
+
readonly fallbackModel?: string;
|
|
74
|
+
}) => string | undefined;
|
|
45
75
|
export interface WorkflowFinishCriterionContext<Output> {
|
|
46
76
|
readonly output: Output;
|
|
47
77
|
readonly rawOutput: unknown;
|
|
@@ -50,7 +80,7 @@ export interface WorkflowFinishCriterionContext<Output> {
|
|
|
50
80
|
export interface WorkflowDeterministicFinishCriterion<Output> {
|
|
51
81
|
readonly kind?: "deterministic";
|
|
52
82
|
readonly name: string;
|
|
53
|
-
readonly check: (context: WorkflowFinishCriterionContext<Output>) => Effect.Effect<void,
|
|
83
|
+
readonly check: (context: WorkflowFinishCriterionContext<Output>) => Effect.Effect<void, WorkflowFinishCriterionError>;
|
|
54
84
|
readonly repairPrompt?: (error: unknown, context: WorkflowFinishCriterionContext<Output>) => string;
|
|
55
85
|
}
|
|
56
86
|
export type WorkflowJudgeVerdict = {
|
|
@@ -93,7 +123,7 @@ export interface WorkflowJudgeFinishCriterion<Output, Evidence = unknown> {
|
|
|
93
123
|
readonly name: string;
|
|
94
124
|
readonly goal?: string | ((context: Omit<WorkflowJudgeEvidenceSelectionContext<Output>, "goal">) => string);
|
|
95
125
|
readonly selectEvidence?: (context: WorkflowJudgeEvidenceSelectionContext<Output>) => Evidence;
|
|
96
|
-
readonly evaluate: (context: WorkflowJudgeCriterionContext<Output, Evidence>) => Effect.Effect<WorkflowJudgeVerdict,
|
|
126
|
+
readonly evaluate: (context: WorkflowJudgeCriterionContext<Output, Evidence>) => Effect.Effect<WorkflowJudgeVerdict, WorkflowFinishCriterionError>;
|
|
97
127
|
}
|
|
98
128
|
export type WorkflowFinishCriterion<Output> = WorkflowDeterministicFinishCriterion<Output> | WorkflowJudgeFinishCriterion<Output>;
|
|
99
129
|
export interface WorkflowFinishOptions<Output> {
|
|
@@ -105,6 +135,7 @@ export interface WorkflowTaskDefinition<Id extends string, Agent extends Workflo
|
|
|
105
135
|
readonly agent: Agent;
|
|
106
136
|
readonly prompt: string;
|
|
107
137
|
readonly output: Output;
|
|
138
|
+
readonly phase?: string;
|
|
108
139
|
readonly cacheKey?: string;
|
|
109
140
|
readonly worker?: WorkflowTaskWorkerOptions;
|
|
110
141
|
readonly finish?: WorkflowFinishOptions<Schema.Schema.Type<Output>>;
|
|
@@ -120,17 +151,18 @@ export interface WorkflowDefinition<Name extends string, Tasks extends ReadonlyA
|
|
|
120
151
|
readonly tasks: Tasks;
|
|
121
152
|
}
|
|
122
153
|
export interface WorkflowRuntime {
|
|
123
|
-
runTask: <Task extends AnyWorkflowTask>(task: Task) => Effect.Effect<WorkflowTaskOutput<Task>,
|
|
154
|
+
runTask: <Task extends AnyWorkflowTask>(task: Task) => Effect.Effect<WorkflowTaskOutput<Task>, WorkflowRuntimeError>;
|
|
124
155
|
}
|
|
125
156
|
export interface WorkflowRuntimeOptions {
|
|
126
157
|
readonly fallbackWorker?: string;
|
|
127
158
|
readonly fallbackModel?: string;
|
|
159
|
+
readonly fallbackPermission?: WorkflowPermissionMode;
|
|
128
160
|
}
|
|
129
|
-
export interface DynamicWorkflowDefinition<Name extends string> {
|
|
161
|
+
export interface DynamicWorkflowDefinition<Name extends string, Result = unknown, Err = WorkflowRuntimeError> {
|
|
130
162
|
readonly kind: "workflow";
|
|
131
163
|
readonly name: Name;
|
|
132
164
|
readonly tasks: readonly [];
|
|
133
|
-
readonly run: (runtime: WorkflowRuntime) => Effect.Effect<
|
|
165
|
+
readonly run: (runtime: WorkflowRuntime) => Effect.Effect<Result, Err, never>;
|
|
134
166
|
}
|
|
135
167
|
export type AnyWorkflowDefinition = WorkflowDefinition<string, ReadonlyArray<AnyWorkflowTask>> | DynamicWorkflowDefinition<string>;
|
|
136
168
|
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>;
|
|
@@ -138,8 +170,8 @@ export declare function defineWorkflow<const Name extends string, const Tasks ex
|
|
|
138
170
|
readonly name: Name;
|
|
139
171
|
readonly tasks: Tasks;
|
|
140
172
|
}): WorkflowDefinition<Name, Tasks>;
|
|
141
|
-
export declare function defineWorkflow<const Name extends string>(definition: {
|
|
173
|
+
export declare function defineWorkflow<const Name extends string, Result, Err = WorkflowRuntimeError>(definition: {
|
|
142
174
|
readonly name: Name;
|
|
143
|
-
readonly run: (runtime: WorkflowRuntime) => Effect.Effect<
|
|
144
|
-
}): DynamicWorkflowDefinition<Name>;
|
|
145
|
-
export declare const decodeTaskOutput: <Task extends AnyWorkflowTask>(task: Task, value: unknown) =>
|
|
175
|
+
readonly run: (runtime: WorkflowRuntime) => Effect.Effect<Result, Err, never>;
|
|
176
|
+
}): DynamicWorkflowDefinition<Name, Result, Err>;
|
|
177
|
+
export declare const decodeTaskOutput: <Task extends AnyWorkflowTask>(task: Task, value: unknown) => Either<Schema.Schema.Type<Task["output"]>, ParseError>;
|