@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 +0 -0
- package/package.json +2 -1
- package/types/compile/authoring-runtime.d.ts +27 -0
- package/types/compile/generated-plugin.d.ts +2 -0
- package/types/compile/load.d.ts +29 -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 -1
- 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 +15 -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 +6 -0
- package/types/workflow-workers.d.ts +25 -9
- package/types/workflows.d.ts +45 -13
|
@@ -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,13 +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
|
+
readonly kimiHome?: string;
|
|
8
|
+
readonly resolvedPermission: WorkflowPermissionMode;
|
|
7
9
|
readonly processTimeoutMs?: number;
|
|
8
10
|
readonly abortSignal?: AbortSignal;
|
|
9
|
-
}
|
|
11
|
+
} & WorkflowTaskRepairLoopOption<"kimi-code">;
|
|
10
12
|
export declare class KimiWorkflowWorkerError extends Error {
|
|
11
13
|
readonly name = "KimiWorkflowWorkerError";
|
|
12
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>;
|
|
13
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
|
/**
|
|
@@ -4,6 +4,11 @@ export interface WorkflowWorkerProcessOptions {
|
|
|
4
4
|
readonly cwd: string;
|
|
5
5
|
readonly abortSignal?: AbortSignal;
|
|
6
6
|
readonly processTimeoutMs?: number;
|
|
7
|
+
readonly env?: Record<string, string>;
|
|
8
|
+
readonly earlyExitPatterns?: ReadonlyArray<{
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly pattern: RegExp;
|
|
11
|
+
}>;
|
|
7
12
|
}
|
|
8
13
|
export interface WorkflowWorkerProcessResult {
|
|
9
14
|
readonly exitCode: number | null;
|
|
@@ -12,6 +17,7 @@ export interface WorkflowWorkerProcessResult {
|
|
|
12
17
|
readonly durationMs: number;
|
|
13
18
|
readonly timedOut: boolean;
|
|
14
19
|
readonly aborted: boolean;
|
|
20
|
+
readonly earlyExit?: string;
|
|
15
21
|
}
|
|
16
22
|
export declare const parsePositiveInteger: (value: string | undefined) => number | undefined;
|
|
17
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;
|