@skastr0/prism-linux-x64 0.5.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/prism +2 -2
- package/package.json +3 -3
- package/types/amp-projects.d.ts +39 -0
- package/types/amp-runners.d.ts +71 -0
- package/types/ast-to-json-schema.d.ts +46 -0
- package/types/compile/errors.d.ts +57 -79
- package/types/compile/runtime/schema-bridge.d.ts +15 -12
- package/types/errors.d.ts +24 -34
- package/types/fs.d.ts +2 -2
- package/types/harness-types-discover.d.ts +34 -0
- package/types/harness-types.d.ts +12 -0
- package/types/index.d.ts +21 -2
- package/types/jev.d.ts +254 -0
- package/types/lowerer-capabilities.d.ts +104 -118
- package/types/prism-home.d.ts +3 -4
- package/types/services/jev.d.ts +131 -0
- package/types/types.d.ts +3 -13
- package/types/workflow-amp-remote-worker.d.ts +69 -0
- package/types/workflow-amp-worker.d.ts +89 -0
- package/types/workflow-antigravity-pty.d.ts +22 -0
- package/types/workflow-antigravity-worker.d.ts +84 -0
- package/types/workflow-bun-runtime.d.ts +2 -0
- package/types/workflow-claude-worker.d.ts +36 -0
- package/types/workflow-cli-command.d.ts +1 -0
- package/types/workflow-codex-worker.d.ts +36 -0
- package/types/workflow-cursor-worker.d.ts +24 -0
- package/types/workflow-devin-worker.d.ts +25 -0
- package/types/workflow-effort.d.ts +18 -0
- package/types/workflow-grok-worker.d.ts +32 -0
- package/types/workflow-harness-detection.d.ts +5 -8
- package/types/workflow-hermes-worker.d.ts +28 -0
- package/types/workflow-identity.d.ts +35 -6
- package/types/workflow-kimi-effort.d.ts +17 -0
- package/types/workflow-kimi-worker.d.ts +27 -0
- package/types/workflow-omp-worker.d.ts +49 -0
- package/types/workflow-opencode-worker.d.ts +26 -0
- package/types/workflow-output-schema.d.ts +6 -0
- package/types/workflow-permissions.d.ts +10 -0
- package/types/workflow-process-guard.d.ts +28 -0
- package/types/workflow-runner.d.ts +15 -1
- package/types/workflow-scheduler/cron.d.ts +60 -0
- package/types/workflow-scheduler/errors.d.ts +71 -0
- package/types/workflow-scheduler/schedule.d.ts +61 -0
- package/types/workflow-session.d.ts +46 -29
- package/types/workflow-store.d.ts +142 -7
- package/types/workflow-worker-process.d.ts +40 -0
- package/types/workflow-workers.d.ts +50 -0
- package/types/workflows.d.ts +204 -23
|
@@ -1,34 +1,43 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
export declare const WorkflowContinuationAdapterIdSchema: Schema.
|
|
2
|
+
export declare const WorkflowContinuationAdapterIdSchema: Schema.Literals<readonly ["amp-code", "amp-orb", "amp-runner", "antigravity-cli", "claude-code", "codex-cli", "cursor", "devin", "grok-cli", "hermes", "kimi-code", "opencode-cli", "omp-cli"]>;
|
|
3
3
|
export type WorkflowContinuationAdapterId = typeof WorkflowContinuationAdapterIdSchema.Type;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Workflow workers that can continue a session.
|
|
6
|
+
*
|
|
7
|
+
* Derived from the `workflowWorker` bit in lowerer-capabilities.ts — the single
|
|
8
|
+
* harness enumeration — rather than re-listed here, which is what
|
|
9
|
+
* scripts/harness-enumeration-guard.ts enforces.
|
|
10
|
+
*/
|
|
11
|
+
export declare const WorkflowContinuationWorkerIdSchema: Schema.Literals<readonly import("./lowerer-capabilities.js").WorkflowWorkerHarnessId[]>;
|
|
5
12
|
export type WorkflowContinuationWorkerId = typeof WorkflowContinuationWorkerIdSchema.Type;
|
|
6
|
-
export declare const StableSessionIdSchema: Schema.brand<
|
|
13
|
+
export declare const StableSessionIdSchema: Schema.brand<Schema.NonEmptyString, "StableSessionId">;
|
|
7
14
|
export type StableSessionId = typeof StableSessionIdSchema.Type;
|
|
8
15
|
export declare const WorkflowStableSessionSchema: Schema.Struct<{
|
|
9
|
-
adapter: Schema.
|
|
10
|
-
sessionId: Schema.brand<
|
|
16
|
+
readonly adapter: Schema.Literals<readonly ["amp-code", "amp-orb", "amp-runner", "antigravity-cli", "claude-code", "codex-cli", "cursor", "devin", "grok-cli", "hermes", "kimi-code", "opencode-cli", "omp-cli"]>;
|
|
17
|
+
readonly sessionId: Schema.brand<Schema.NonEmptyString, "StableSessionId">;
|
|
11
18
|
}>;
|
|
12
19
|
export type WorkflowStableSession = typeof WorkflowStableSessionSchema.Type;
|
|
13
|
-
export declare const WorkflowHarnessContinuationSupportSchema: Schema.Union<[Schema.Struct<{
|
|
14
|
-
adapter: Schema.
|
|
15
|
-
workflowWorker:
|
|
16
|
-
stableSessionIds: Schema.Literal<
|
|
17
|
-
exactSameSessionContinuation: Schema.Literal<
|
|
18
|
-
sessionIdField: Schema.Literal<
|
|
19
|
-
continueCommand:
|
|
20
|
-
capture:
|
|
20
|
+
export declare const WorkflowHarnessContinuationSupportSchema: Schema.Union<readonly [Schema.Struct<{
|
|
21
|
+
readonly adapter: Schema.Literals<readonly ["amp-code", "amp-orb", "amp-runner", "antigravity-cli", "claude-code", "codex-cli", "cursor", "devin", "grok-cli", "hermes", "kimi-code", "opencode-cli", "omp-cli"]>;
|
|
22
|
+
readonly workflowWorker: Schema.Boolean;
|
|
23
|
+
readonly stableSessionIds: Schema.Literal<true>;
|
|
24
|
+
readonly exactSameSessionContinuation: Schema.Literal<true>;
|
|
25
|
+
readonly sessionIdField: Schema.Literal<"sessionId">;
|
|
26
|
+
readonly continueCommand: Schema.NonEmptyString;
|
|
27
|
+
readonly capture: Schema.NonEmptyString;
|
|
21
28
|
}>, Schema.Struct<{
|
|
22
|
-
adapter: Schema.
|
|
23
|
-
workflowWorker:
|
|
24
|
-
stableSessionIds: Schema.Literal<
|
|
25
|
-
exactSameSessionContinuation: Schema.Literal<
|
|
26
|
-
sessionIdField: Schema.Literal<
|
|
27
|
-
reason:
|
|
29
|
+
readonly adapter: Schema.Literals<readonly ["amp-code", "amp-orb", "amp-runner", "antigravity-cli", "claude-code", "codex-cli", "cursor", "devin", "grok-cli", "hermes", "kimi-code", "opencode-cli", "omp-cli"]>;
|
|
30
|
+
readonly workflowWorker: Schema.Boolean;
|
|
31
|
+
readonly stableSessionIds: Schema.Literal<false>;
|
|
32
|
+
readonly exactSameSessionContinuation: Schema.Literal<false>;
|
|
33
|
+
readonly sessionIdField: Schema.Literal<"sessionId">;
|
|
34
|
+
readonly reason: Schema.NonEmptyString;
|
|
28
35
|
}>]>;
|
|
29
36
|
export type WorkflowHarnessContinuationSupport = typeof WorkflowHarnessContinuationSupportSchema.Type;
|
|
30
37
|
export declare const workflowContinuationAdapterByWorker: {
|
|
31
38
|
readonly "amp-code": "amp-code";
|
|
39
|
+
readonly "amp-orb": "amp-orb";
|
|
40
|
+
readonly "amp-runner": "amp-runner";
|
|
32
41
|
readonly "antigravity-cli": "antigravity-cli";
|
|
33
42
|
readonly "claude-code": "claude-code";
|
|
34
43
|
readonly "codex-cli": "codex-cli";
|
|
@@ -38,7 +47,6 @@ export declare const workflowContinuationAdapterByWorker: {
|
|
|
38
47
|
readonly hermes: "hermes";
|
|
39
48
|
readonly "kimi-code": "kimi-code";
|
|
40
49
|
readonly opencode: "opencode-cli";
|
|
41
|
-
readonly opencode2: "opencode2-cli";
|
|
42
50
|
readonly omp: "omp-cli";
|
|
43
51
|
};
|
|
44
52
|
export type WorkflowRepairLoopContinuationWorkerId = keyof typeof workflowContinuationAdapterByWorker;
|
|
@@ -54,6 +62,24 @@ export declare const workflowHarnessContinuationSupport: {
|
|
|
54
62
|
readonly continueCommand: "amp threads continue <sessionId> --execute <prompt>";
|
|
55
63
|
readonly capture: "stream-json session_id, local thread metadata, or threads list/search recovery";
|
|
56
64
|
};
|
|
65
|
+
readonly "amp-orb": {
|
|
66
|
+
readonly adapter: "amp-orb";
|
|
67
|
+
readonly workflowWorker: true;
|
|
68
|
+
readonly stableSessionIds: true;
|
|
69
|
+
readonly exactSameSessionContinuation: true;
|
|
70
|
+
readonly sessionIdField: "sessionId";
|
|
71
|
+
readonly continueCommand: "amp threads continue <sessionId> --orb-execute --execute <prompt> --stream-json";
|
|
72
|
+
readonly capture: "stream-json session_id (the orb thread id); never list readback";
|
|
73
|
+
};
|
|
74
|
+
readonly "amp-runner": {
|
|
75
|
+
readonly adapter: "amp-runner";
|
|
76
|
+
readonly workflowWorker: true;
|
|
77
|
+
readonly stableSessionIds: true;
|
|
78
|
+
readonly exactSameSessionContinuation: true;
|
|
79
|
+
readonly sessionIdField: "sessionId";
|
|
80
|
+
readonly continueCommand: "amp threads continue <sessionId> --orb-execute --execute <prompt> --stream-json";
|
|
81
|
+
readonly capture: "stream-json session_id (the runner thread id); never list readback";
|
|
82
|
+
};
|
|
57
83
|
readonly "antigravity-cli": {
|
|
58
84
|
readonly adapter: "antigravity-cli";
|
|
59
85
|
readonly workflowWorker: true;
|
|
@@ -135,15 +161,6 @@ export declare const workflowHarnessContinuationSupport: {
|
|
|
135
161
|
readonly continueCommand: "opencode run -s <sessionId> <prompt>";
|
|
136
162
|
readonly capture: "json step_start sessionID, session list, export, database, or log recovery";
|
|
137
163
|
};
|
|
138
|
-
readonly "opencode2-cli": {
|
|
139
|
-
readonly adapter: "opencode2-cli";
|
|
140
|
-
readonly workflowWorker: true;
|
|
141
|
-
readonly stableSessionIds: true;
|
|
142
|
-
readonly exactSameSessionContinuation: true;
|
|
143
|
-
readonly sessionIdField: "sessionId";
|
|
144
|
-
readonly continueCommand: "opencode2 run -s <sessionId> <prompt>";
|
|
145
|
-
readonly capture: "json step_start sessionID, session list, export, database, or log recovery";
|
|
146
|
-
};
|
|
147
164
|
readonly "omp-cli": {
|
|
148
165
|
readonly adapter: "omp-cli";
|
|
149
166
|
readonly workflowWorker: true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type WorkflowRetentionCleanupReport, type WorkflowRunArtifactCounts, type WorkflowRunDeletionReport } from "./workflow-data-governance.js";
|
|
2
2
|
import type { WorkflowJudgeVerdict } from "./workflows.js";
|
|
3
|
-
import type { WorkflowJudgeIdentity, WorkflowRunTaskSnapshot, WorkflowTaskIdentity } from "./workflow-identity.js";
|
|
4
|
-
export { workflowRunTaskSnapshotForTask, workflowTaskIdentity, type WorkflowJudgeIdentity, type WorkflowRunTaskSnapshot, type WorkflowTaskIdentity } from "./workflow-identity.js";
|
|
3
|
+
import type { WorkflowJudgeIdentity, WorkflowRunTaskSnapshot, WorkflowRunTaskSnapshotInput, WorkflowTaskIdentity } from "./workflow-identity.js";
|
|
4
|
+
export { workflowRunTaskSnapshotForTask, workflowTaskIdentity, type JevRunTaskSnapshot, type WorkflowJudgeIdentity, type WorkflowRunTaskSnapshot, type WorkflowRunTaskSnapshotInput, type WorkflowTaskIdentity, type WorkflowWorkerRunTaskSnapshot, } from "./workflow-identity.js";
|
|
5
5
|
import { type WorkflowDatabase } from "./workflow-runtime.js";
|
|
6
6
|
import type { WorkflowSpanRecord } from "./workflow-tracing.js";
|
|
7
7
|
import { type WorkflowUsage, type WorkflowUsageTotals } from "./workflow-usage.js";
|
|
@@ -200,11 +200,73 @@ export type WorkflowRunStatus = "running" | "completed" | "failed" | "escalated"
|
|
|
200
200
|
* A run's persisted status can read "completed" while carrying isolated task failures: the
|
|
201
201
|
* dynamic runtime's fault-isolation contract (PQ-166) lets an author's `run` program finish
|
|
202
202
|
* successfully after recovering from a task that itself failed or escalated (e.g. via
|
|
203
|
-
* `Effect.
|
|
203
|
+
* `Effect.result`). That is not a caller-visible success — a caller gating on `$?` (the CLI)
|
|
204
204
|
* must still see the partial failure. Success requires both: the run itself reached
|
|
205
205
|
* "completed", and every recorded task did too.
|
|
206
206
|
*/
|
|
207
207
|
export declare function isWorkflowRunOutcomeSuccessful(runStatus: WorkflowRunStatus, taskStatuses: ReadonlyArray<WorkflowRunTaskProgressStatus>): boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Provenance for a run the scheduler launched, rather than one a human started.
|
|
210
|
+
*
|
|
211
|
+
* Absent on a hand-run workflow. That absence is the honest answer — there was
|
|
212
|
+
* no execution and no occurrence — so it is modelled as an optional parameter
|
|
213
|
+
* and a nullable column, not as a sentinel string.
|
|
214
|
+
*/
|
|
215
|
+
export interface WorkflowRunScheduling {
|
|
216
|
+
/** The scheduler execution that launched this run. */
|
|
217
|
+
readonly executionId: string;
|
|
218
|
+
/** The installed schedule the execution belongs to. */
|
|
219
|
+
readonly scheduleId: string;
|
|
220
|
+
/** The cron occurrence this run represents, as an ISO-8601 instant. */
|
|
221
|
+
readonly scheduledFor: string | null;
|
|
222
|
+
}
|
|
223
|
+
/** The triple that identifies a runner process without relying on the pid alone. */
|
|
224
|
+
export interface WorkflowRunRunnerIdentity {
|
|
225
|
+
readonly pid: number;
|
|
226
|
+
readonly bootId: string | null;
|
|
227
|
+
readonly startId: string | null;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* The scheduler's read-only view of a run it owns.
|
|
231
|
+
*
|
|
232
|
+
* Purpose-built rather than reusing `WorkflowRunRecord`: reconciliation needs
|
|
233
|
+
* the runner identity and the launch-authorization state, which are internal to
|
|
234
|
+
* the scheduling protocol and not part of the general run surface.
|
|
235
|
+
*/
|
|
236
|
+
export interface WorkflowScheduledRunState {
|
|
237
|
+
readonly runId: string;
|
|
238
|
+
readonly workflow: string;
|
|
239
|
+
readonly status: WorkflowRunStatus;
|
|
240
|
+
readonly schedulingExecutionId: string | null;
|
|
241
|
+
readonly schedulingScheduleId: string | null;
|
|
242
|
+
readonly scheduledFor: string | null;
|
|
243
|
+
readonly runner: WorkflowRunRunnerIdentity | null;
|
|
244
|
+
/**
|
|
245
|
+
* Whether a runner consumed this run's launch authorization.
|
|
246
|
+
*
|
|
247
|
+
* Meaningful only when `schedulingExecutionId` is set. The scheduler always
|
|
248
|
+
* issues an authorization token before spawning, so for a scheduled run a
|
|
249
|
+
* present token means no runner ever consumed it, and a consumed token means
|
|
250
|
+
* a runner did. A hand-run workflow has no token to consume and no execution
|
|
251
|
+
* to reconcile, so this field is not consulted for one.
|
|
252
|
+
*/
|
|
253
|
+
readonly launchAuthorized: boolean;
|
|
254
|
+
readonly terminalCause: WorkflowRunTerminalCause | null;
|
|
255
|
+
readonly finishedAt: string | null;
|
|
256
|
+
readonly heartbeatAt: string | null;
|
|
257
|
+
}
|
|
258
|
+
/** The outcome of a runner attempting to consume its launch authorization. */
|
|
259
|
+
export type WorkflowRunLaunchAuthorization = {
|
|
260
|
+
readonly kind: "authorized";
|
|
261
|
+
} | {
|
|
262
|
+
readonly kind: "not-found";
|
|
263
|
+
} | {
|
|
264
|
+
readonly kind: "unauthorized";
|
|
265
|
+
readonly reason: string;
|
|
266
|
+
} | {
|
|
267
|
+
readonly kind: "terminal";
|
|
268
|
+
readonly status: WorkflowRunStatus;
|
|
269
|
+
};
|
|
208
270
|
export interface WorkflowEventRecord {
|
|
209
271
|
readonly sequence: number;
|
|
210
272
|
readonly runId: string;
|
|
@@ -292,7 +354,7 @@ export interface WorkflowTaskAttemptRecord {
|
|
|
292
354
|
}
|
|
293
355
|
export declare const projectWorkflowStoreDir: (prismHome: string, cwd?: string) => string;
|
|
294
356
|
export declare const defaultWorkflowStorePath: (prismHome: string, cwd?: string) => string;
|
|
295
|
-
export declare const WORKFLOW_STORE_SCHEMA_VERSION =
|
|
357
|
+
export declare const WORKFLOW_STORE_SCHEMA_VERSION = 8;
|
|
296
358
|
/**
|
|
297
359
|
* Surfaces the one-time soft-divergence direction (WFE-007): a pre-existing store opened at a
|
|
298
360
|
* schema version older than the binary's `WORKFLOW_STORE_SCHEMA_VERSION` migrates in place inside
|
|
@@ -352,17 +414,78 @@ export declare class WorkflowStore {
|
|
|
352
414
|
readonly cacheKey?: string;
|
|
353
415
|
readonly promptHash?: string;
|
|
354
416
|
}): WorkflowCacheRecord[];
|
|
355
|
-
|
|
417
|
+
/**
|
|
418
|
+
* Create a run row.
|
|
419
|
+
*
|
|
420
|
+
* `scheduling` records provenance for a run the scheduler launched. It is
|
|
421
|
+
* written in the same transaction as the row itself, because a run that
|
|
422
|
+
* exists without its provenance would be a run the scheduler cannot claim
|
|
423
|
+
* during reconciliation.
|
|
424
|
+
*/
|
|
425
|
+
createRun(workflow: string, runId?: string, scheduling?: WorkflowRunScheduling): string;
|
|
426
|
+
/**
|
|
427
|
+
* Consume a run's launch authorization and record the runner's identity.
|
|
428
|
+
*
|
|
429
|
+
* This is the linearization point of the launch protocol, and it is one
|
|
430
|
+
* transaction on purpose. "A runner was authorized" and "here is the runner's
|
|
431
|
+
* identity" must not be able to disagree, or reconciliation would face a
|
|
432
|
+
* window where a runner may have imported user code but left no identity to
|
|
433
|
+
* observe — an ambiguity with no honest resolution.
|
|
434
|
+
*
|
|
435
|
+
* The token comparison is timing-safe and the update is a compare-and-set on
|
|
436
|
+
* the token column, so two runners racing for the same authorization produce
|
|
437
|
+
* exactly one winner and one `unauthorized`.
|
|
438
|
+
*
|
|
439
|
+
* This deliberately does **not** touch `heartbeat_at`. The heartbeat is the
|
|
440
|
+
* *readiness* marker a detached launcher waits on, and readiness means "the
|
|
441
|
+
* runner is executing", not "the runner claimed the run" — so it is published
|
|
442
|
+
* by `markRunRunnerStarted` after the workflow module has loaded. Publishing it
|
|
443
|
+
* here would make a workflow whose top-level code exits look like a successful
|
|
444
|
+
* start, because authorization now happens before the import.
|
|
445
|
+
*/
|
|
446
|
+
beginScheduledRun(input: {
|
|
447
|
+
readonly runId: string;
|
|
448
|
+
readonly token: string;
|
|
449
|
+
readonly runnerPid: number;
|
|
450
|
+
readonly runnerBootId: string | null;
|
|
451
|
+
readonly runnerStartId: string | null;
|
|
452
|
+
}): WorkflowRunLaunchAuthorization;
|
|
453
|
+
/**
|
|
454
|
+
* The scheduler's reconciliation view of one run. Null when the run does not
|
|
455
|
+
* exist — which is itself meaningful, since the scheduler creates the run
|
|
456
|
+
* before it spawns anything.
|
|
457
|
+
*/
|
|
458
|
+
scheduledRunState(runId: string): WorkflowScheduledRunState | null;
|
|
459
|
+
/**
|
|
460
|
+
* Terminalize a scheduled run the scheduler has established cannot continue.
|
|
461
|
+
*
|
|
462
|
+
* Returns whether it wrote, so the caller can tell "we closed it" from "the
|
|
463
|
+
* runner claimed it first". The ledger keeps its existing status vocabulary —
|
|
464
|
+
* `crashed` for a worker that died mid-run, `stopped` for one that never
|
|
465
|
+
* received its authorization — while the scheduler's more specific knowledge
|
|
466
|
+
* lives on the execution row and in the event stream. Widening
|
|
467
|
+
* `WorkflowRunStatus` for the scheduler's benefit would put a new state in
|
|
468
|
+
* front of every consumer of run history for no gain.
|
|
469
|
+
*
|
|
470
|
+
* The update is guarded on `status = 'running'`, so it is a compare-and-set
|
|
471
|
+
* against a runner claiming the run concurrently: exactly one wins.
|
|
472
|
+
*/
|
|
473
|
+
interruptScheduledRun(input: {
|
|
474
|
+
readonly runId: string;
|
|
475
|
+
readonly kind: "interrupted" | "cancelled";
|
|
476
|
+
readonly reason: string;
|
|
477
|
+
readonly runnerPid?: number | null;
|
|
478
|
+
readonly heartbeatAt?: string | null;
|
|
479
|
+
}): boolean;
|
|
356
480
|
recordRunSnapshot(input: {
|
|
357
481
|
readonly runId: string;
|
|
358
482
|
readonly workflowFile: string;
|
|
359
483
|
readonly options?: Record<string, unknown>;
|
|
360
484
|
}): void;
|
|
361
485
|
getRunSnapshot(runId: string): WorkflowRunSnapshot | null;
|
|
362
|
-
recordRunTaskSnapshot(input:
|
|
486
|
+
recordRunTaskSnapshot(input: WorkflowRunTaskSnapshotInput): void;
|
|
363
487
|
listRunTaskSnapshots(runId: string): WorkflowRunTaskSnapshot[];
|
|
364
488
|
setRunHandoffToken(runId: string, token: string): void;
|
|
365
|
-
consumeRunHandoffToken(runId: string, token: string): boolean;
|
|
366
489
|
markRunRunnerStarted(runId: string, runnerPid: number): void;
|
|
367
490
|
heartbeatRun(runId: string): void;
|
|
368
491
|
recordTaskAttemptStarted(input: WorkflowTaskAttemptStartedInput): void;
|
|
@@ -380,6 +503,18 @@ export declare class WorkflowStore {
|
|
|
380
503
|
readonly reason?: string;
|
|
381
504
|
readonly mode?: string;
|
|
382
505
|
}): WorkflowRunRecord | null;
|
|
506
|
+
/**
|
|
507
|
+
* Read a run **without** observer reconciliation.
|
|
508
|
+
*
|
|
509
|
+
* The detached launcher polls its own run while it waits for the readiness
|
|
510
|
+
* handshake, and during startup it is the authority on that run. `getRun`
|
|
511
|
+
* runs `failDeadPidRuns` first, so a launcher polling its own child would
|
|
512
|
+
* terminalize the run as `dead-runner-pid` the instant the child died —
|
|
513
|
+
* preempting the launcher's own, more specific `runner-start-failed` cause and
|
|
514
|
+
* the stderr evidence it captured. Reconciliation is for observers, not for
|
|
515
|
+
* the process that owns the handshake.
|
|
516
|
+
*/
|
|
517
|
+
peekRun(runId: string): WorkflowRunRecord | null;
|
|
383
518
|
getRun(runId: string): WorkflowRunRecord | null;
|
|
384
519
|
recordEvent(input: {
|
|
385
520
|
readonly runId: string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { parsePositiveInteger } from "./workflow-harness-detection.js";
|
|
2
|
+
export { parsePositiveInteger };
|
|
3
|
+
export interface WorkflowWorkerProcessOptions {
|
|
4
|
+
readonly command: string;
|
|
5
|
+
readonly args: ReadonlyArray<string>;
|
|
6
|
+
readonly cwd: string;
|
|
7
|
+
readonly abortSignal?: AbortSignal;
|
|
8
|
+
readonly env?: Record<string, string>;
|
|
9
|
+
readonly onOutputActivity?: (stream: WorkflowWorkerOutputStream) => void;
|
|
10
|
+
readonly earlyExitPatterns?: ReadonlyArray<{
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly pattern: RegExp;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export type WorkflowWorkerOutputStream = "stdout" | "stderr";
|
|
16
|
+
export interface WorkflowWorkerProcessResult {
|
|
17
|
+
readonly exitCode: number | null;
|
|
18
|
+
readonly stdout: string;
|
|
19
|
+
readonly stderr: string;
|
|
20
|
+
readonly durationMs: number;
|
|
21
|
+
readonly aborted: boolean;
|
|
22
|
+
readonly earlyExit?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Worker output is captured in full, without a byte ceiling. Harness workers are
|
|
26
|
+
* long-running agents whose event streams routinely reach tens or hundreds of
|
|
27
|
+
* megabytes; a size cap turned normal agent verbosity into a task failure and
|
|
28
|
+
* forced callers to guess a number they cannot know in advance. Runaway workers
|
|
29
|
+
* are bounded by run control (`workflow runs stop`), the opt-in inactivity
|
|
30
|
+
* watchdog, and cost budgets \u2014 not by truncating their output.
|
|
31
|
+
*/
|
|
32
|
+
export declare class WorkflowWorkerOutputCapture {
|
|
33
|
+
private readonly streams;
|
|
34
|
+
private totalBytes;
|
|
35
|
+
append(source: WorkflowWorkerOutputStream, text: string, byteLength?: number): void;
|
|
36
|
+
output(source: WorkflowWorkerOutputStream): string;
|
|
37
|
+
bytes(): number;
|
|
38
|
+
}
|
|
39
|
+
export declare const workflowWorkerProcessExcerpt: (stdout: string, stderr: string) => string;
|
|
40
|
+
export declare const runWorkflowWorkerProcess: (options: WorkflowWorkerProcessOptions) => Promise<WorkflowWorkerProcessResult>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type AnyWorkflowWorkerTask, type WorkflowPermissionMode, type WorkflowWorkerId } from "./workflows.js";
|
|
2
|
+
import type { WorkflowTaskExecution, WorkflowTaskExecutionContext, WorkflowTaskExecutionContextWithoutRepair, WorkflowWorkerTaskExecutor } 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 {
|
|
6
|
+
readonly cwd: string;
|
|
7
|
+
readonly model?: string;
|
|
8
|
+
readonly profile?: string;
|
|
9
|
+
readonly resolvedPermission: WorkflowPermissionMode;
|
|
10
|
+
readonly restrictedTools?: readonly string[];
|
|
11
|
+
readonly abortSignal?: AbortSignal;
|
|
12
|
+
}
|
|
13
|
+
export type WorkflowWorkerAdapterOptionsForCapability<Capability extends WorkflowRepairLoopContinuationCapability> = WorkflowWorkerAdapterOptionsBase & (Capability extends "stable-session-repair-loop" ? {
|
|
14
|
+
readonly context?: WorkflowTaskExecutionContext;
|
|
15
|
+
} : {
|
|
16
|
+
readonly context?: WorkflowTaskExecutionContextWithoutRepair;
|
|
17
|
+
});
|
|
18
|
+
export type WorkflowWorkerAdapterOptions<Worker extends WorkflowWorkerId = WorkflowWorkerId> = WorkflowWorkerAdapterOptionsForCapability<WorkflowRepairLoopContinuationCapabilityForWorker<Worker>>;
|
|
19
|
+
export interface WorkflowWorkerAdapter<Worker extends WorkflowWorkerId = WorkflowWorkerId> {
|
|
20
|
+
readonly id: Worker;
|
|
21
|
+
readonly runTask: (task: AnyWorkflowWorkerTask, options: WorkflowWorkerAdapterOptions<Worker>) => Promise<WorkflowTaskExecution>;
|
|
22
|
+
}
|
|
23
|
+
export declare class UnsupportedWorkflowWorkerError extends Error {
|
|
24
|
+
readonly worker: string;
|
|
25
|
+
readonly supportedWorkers: ReadonlyArray<string>;
|
|
26
|
+
readonly name = "UnsupportedWorkflowWorkerError";
|
|
27
|
+
constructor(worker: string, supportedWorkers: ReadonlyArray<string>);
|
|
28
|
+
}
|
|
29
|
+
export declare class WorkflowWorkerContinuationError extends Error {
|
|
30
|
+
readonly name = "WorkflowWorkerContinuationError";
|
|
31
|
+
}
|
|
32
|
+
export declare const supportedWorkflowWorkers: () => ReadonlyArray<string>;
|
|
33
|
+
export declare function getWorkflowWorkerAdapter<Worker extends WorkflowWorkerId>(worker: Worker): WorkflowWorkerAdapter<Worker>;
|
|
34
|
+
export declare function getWorkflowWorkerAdapter(worker: string): WorkflowWorkerAdapter;
|
|
35
|
+
/**
|
|
36
|
+
* Per-worker default permission. Remote Amp executors (orb, runner) accept only
|
|
37
|
+
* `legacy` — no per-invocation override reaches the remote amp process — so an
|
|
38
|
+
* unconfigured remote task must default to `legacy`, not the local `permissive`
|
|
39
|
+
* default that dispatch would then reject.
|
|
40
|
+
*/
|
|
41
|
+
export declare const defaultWorkflowWorkerPermission: (worker?: string) => WorkflowPermissionMode;
|
|
42
|
+
export declare const resolveWorkflowTaskPermission: (task: AnyWorkflowWorkerTask, fallbackPermission?: WorkflowPermissionMode) => WorkflowPermissionMode;
|
|
43
|
+
/** Same argv interpreters run uses. Validate calls this so illegal pins fail before spend. */
|
|
44
|
+
export declare const assertWorkflowWorkerPermission: (worker: string, mode: WorkflowPermissionMode, restrictedTools?: readonly string[]) => void;
|
|
45
|
+
export declare const createWorkflowWorkerExecutor: (input: {
|
|
46
|
+
readonly worker?: string;
|
|
47
|
+
readonly cwd: string;
|
|
48
|
+
readonly model?: string;
|
|
49
|
+
readonly fallbackPermission?: WorkflowPermissionMode;
|
|
50
|
+
}) => WorkflowWorkerTaskExecutor;
|