@skastr0/prism-darwin-x64 0.1.2 → 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 CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skastr0/prism-darwin-x64",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Prism standalone CLI binary for macOS x64.",
6
6
  "license": "MIT",
@@ -19,6 +19,7 @@
19
19
  "dependencies": {
20
20
  "@modelcontextprotocol/sdk": "1.29.0",
21
21
  "@opencode-ai/plugin": "^1.15.13",
22
+ "@opentui/core-darwin-x64": "0.4.1",
22
23
  "effect": "^3.21.1",
23
24
  "typescript": "^5.8.3",
24
25
  "zod": "4.4.3"
@@ -0,0 +1,27 @@
1
+ import { Effect } from "effect";
2
+ /**
3
+ * Minimal in-memory authoring runtime that stubs the `prism` module for
4
+ * plugin source files. It provides the typed-ref helpers and definition
5
+ * builders used by `.agent.ts`, `.orbit.ts`, `.trait.ts`, `.tool.ts`,
6
+ * `.toolspace.ts`, `.modelspace.ts`, `.skillspace.ts`, and `.hook.ts` files.
7
+ *
8
+ * The real semantic validation happens later in the compiler; this runtime
9
+ * only needs to return plain data structures so that source modules can be
10
+ * imported/bundled without resolving the full `prism` package.
11
+ */
12
+ export declare const AUTHORING_RUNTIME_JS = "\nconst withNamedRef = (kind, first, second) =>\n second === undefined ? { kind, name: first } : { kind, plugin: first, name: second };\n\nexport const traitRef = (first, second) => withNamedRef(\"trait-ref\", first, second);\nexport const agentRef = (first, second) => withNamedRef(\"agent-ref\", first, second);\nexport const orbitRef = (first, second) => withNamedRef(\"orbit-ref\", first, second);\n\nexport const toolRef = (first, second, third) =>\n third === undefined\n ? { kind: \"tool-ref\", toolspace: first, name: second }\n : { kind: \"tool-ref\", plugin: first, toolspace: second, name: third };\n\nexport const toolGroupRef = (first, second, third) =>\n third === undefined\n ? { kind: \"tool-group-ref\", toolspace: first, name: second }\n : { kind: \"tool-group-ref\", plugin: first, toolspace: second, name: third };\n\nexport const modelProfileRef = (first, second, third) =>\n third === undefined\n ? { kind: \"model-profile-ref\", modelspace: first, name: second }\n : { kind: \"model-profile-ref\", plugin: first, modelspace: second, name: third };\n\nexport const skillRef = (first, second) => withNamedRef(\"skill-ref\", first, second);\n\nexport const skillspaceRef = (first, second, third) =>\n third === undefined\n ? { kind: \"skillspace-ref\", skillspace: first, name: second }\n : { kind: \"skillspace-ref\", plugin: first, skillspace: second, name: third };\n\nexport const schemaSlot = (options = {}) => ({ kind: \"schema\", ...options });\nexport const bindTrait = (trait, options = {}) => ({\n kind: \"trait-binding\",\n trait,\n ...(options.tools ? { tools: options.tools } : {}),\n});\n\nexport const defineAgent = (agent) => agent;\nexport const defineTrait = (trait) => trait;\nexport const defineOrbit = (orbit) => orbit;\nexport const defineTool = (tool) => tool;\nexport const defineToolspace = (toolspace) => toolspace;\nexport const defineModelspace = (modelspace) => modelspace;\nexport const defineSkillspace = (skillspace) => skillspace;\nexport const defineHook = (hook) => hook;\n\nexport const hookEvent = {\n toolBefore: \"tool.before\",\n toolAfter: \"tool.after\",\n promptSubmit: \"prompt.submit\",\n permissionRequest: \"permission.request\",\n sessionStart: \"session.start\",\n sessionEnd: \"session.end\",\n};\n\nexport const hookTool = {\n any: () => ({ kind: \"hook-any-tool\" }),\n tool: (tool) => ({ kind: \"hook-toolspace-tool\", tool }),\n group: (group) => ({ kind: \"hook-toolspace-group\", group }),\n canonical: (ref) => ({ kind: \"hook-canonical-tool\", ref }),\n};\n\nexport const hookMatcher = {\n tool: hookTool,\n};\n";
13
+ declare class AuthoringRuntimeWriteError {
14
+ readonly cause: unknown;
15
+ readonly _tag = "AuthoringRuntimeWriteError";
16
+ constructor(cause: unknown);
17
+ }
18
+ /**
19
+ * Return a file path to a persisted copy of the authoring runtime. The file
20
+ * is written once per process and reused across plugin compiles.
21
+ */
22
+ export declare const getAuthoringRuntimePath: () => Effect.Effect<string, AuthoringRuntimeWriteError, never>;
23
+ /**
24
+ * For tests that need to clean up the machine-global temp runtime file.
25
+ */
26
+ export declare const getAuthoringRuntimeDir: () => string | undefined;
27
+ export {};
@@ -1,8 +1,10 @@
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;
5
6
  export declare const generatedOwnerToolName: (toolPluginName: string, toolName: string) => string;
6
7
  export declare const generatedSyntheticToolName: (sourcePluginName: string, contractName: string) => string;
8
+ export declare const generatedPluginIdForOwner: (ownerPluginName: string) => string;
7
9
  export declare const generatedToolNameForBinding: (sourcePluginName: string, binding: ResolvedContractBinding) => string;
8
10
  export declare const sourceIsInside: (sourcePath: string, root: string) => boolean;
@@ -18,6 +18,35 @@ export interface PrepareImportWrapperOptions {
18
18
  }
19
19
  export declare const prepareImportWrapper: (sourcePath: string, options?: PrepareImportWrapperOptions) => Promise<{
20
20
  readonly specifier: string;
21
+ readonly transformedPath: string;
22
+ readonly cleanup: () => Promise<void>;
23
+ }>;
24
+ /**
25
+ * Prepare a plugin source file for bundling by `bun build`.
26
+ *
27
+ * Unlike `prepareImportWrapper`, which produces `file:///` specifiers suitable
28
+ * for runtime `import()`, this helper produces absolute POSIX paths so the
29
+ * bundler can resolve `prism`/`effect` imports without relying on ambient
30
+ * `node_modules`. The transformed plugin root is cached and cleaned up the
31
+ * same way as `prepareImportWrapper`.
32
+ */
33
+ export declare const prepareBundleSource: (sourcePath: string) => Promise<{
34
+ readonly transformedPath: string;
35
+ readonly cleanup: () => Promise<void>;
36
+ }>;
37
+ /**
38
+ * Prepare a plugin source file for bundling into an executable hook wrapper.
39
+ *
40
+ * Unlike `prepareBundleSource`, which rewrites `prism` to the compile-time
41
+ * authoring runtime stub, this helper rewrites `prism` to the real Prism source
42
+ * entry so the bundled hook can execute. `effect` is rewritten to the same
43
+ * runtime Effect module used by the wrapper, preventing duplicate Effect
44
+ * instances. Absolute imports that point back at the local Prism source entry
45
+ * (common in test fixtures and local helper files) are normalized to bare
46
+ * `prism` first.
47
+ */
48
+ export declare const prepareHookBundleSource: (sourcePath: string) => Promise<{
49
+ readonly transformedPath: string;
21
50
  readonly cleanup: () => Promise<void>;
22
51
  }>;
23
52
  export declare const loadPlugin: (pluginPath: string) => Effect.Effect<PluginRegistry, CompileError>;
@@ -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 {
@@ -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
- export declare function resolveHarnessRoot(harness: HarnessConfig, scope: HarnessScope, projectPath?: string): string | null;
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
@@ -12,6 +12,7 @@
12
12
  *
13
13
  * These helpers are identity constructors for authoring ergonomics.
14
14
  */
15
+ export * from "./workflow-errors.js";
15
16
  export * from "./workflows.js";
16
17
  export * from "./workflow-tsconfig.js";
17
18
  export * from "./workflow-antigravity-worker.js";
@@ -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
@@ -38,7 +38,6 @@ export interface PluginRuntimeMcpHarnessConfig {
38
38
  transport?: PrismMcpTransport;
39
39
  host?: string;
40
40
  port?: number;
41
- tokenEnv?: string;
42
41
  connectTimeoutMs?: number;
43
42
  toolTimeoutMs?: number;
44
43
  }
@@ -53,6 +52,7 @@ export interface PluginManifest {
53
52
  deps?: Record<string, string>;
54
53
  runtime?: PluginRuntimeConfig;
55
54
  projects?: Record<string, ProjectConfig>;
55
+ inlineSkills?: string[];
56
56
  }
57
57
  export interface ProjectConfig {
58
58
  pattern?: string;
@@ -1,12 +1,28 @@
1
- import type { AnyWorkflowTask } from "./workflows.js";
2
- import type { WorkflowTaskExecution } from "./workflow-runner.js";
3
- export interface AmpWorkflowWorkerOptions {
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
- export interface AntigravityWorkflowWorkerOptions {
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 type { WorkflowTaskExecution, WorkflowTaskRepairContext } from "./workflow-runner.js";
3
- export interface ClaudeWorkflowWorkerOptions {
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
- readonly repair?: WorkflowTaskRepairContext;
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 interface CodexWorkflowWorkerOptions {
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 interface GrokWorkflowWorkerOptions {
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";