@skastr0/prism-darwin-x64 0.3.4 → 0.4.1
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 -2
- package/types/index.d.ts +99 -20
- package/types/lowerer-capabilities.d.ts +95 -1
- package/types/types.d.ts +4 -1
- package/types/workflow-bun-runtime.d.ts +21 -3
- package/types/workflow-data-governance.d.ts +43 -0
- package/types/workflow-data-policy.d.ts +39 -0
- package/types/workflow-errors.d.ts +36 -1
- package/types/workflow-harness-detection.d.ts +2 -0
- package/types/workflow-identity.d.ts +12 -0
- package/types/workflow-runner-log.d.ts +34 -0
- package/types/workflow-runner.d.ts +11 -2
- package/types/workflow-runtime.d.ts +11 -2
- package/types/workflow-session.d.ts +25 -5
- package/types/workflow-store.d.ts +202 -7
- package/types/workflow-tracing.d.ts +85 -0
- package/types/workflow-usage.d.ts +21 -0
- package/types/workflow-worker-metadata.d.ts +16 -0
- package/types/workflows.d.ts +57 -1
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.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Prism standalone CLI binary for macOS x64.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
21
21
|
"@opencode-ai/plugin": "^1.15.13",
|
|
22
22
|
"@opentui/core-darwin-x64": "0.4.1",
|
|
23
|
-
"@skastr0/prism-sdk": "0.
|
|
23
|
+
"@skastr0/prism-sdk": "0.4.1",
|
|
24
24
|
"effect": "^3.21.1",
|
|
25
25
|
"typescript": "^5.8.3",
|
|
26
26
|
"zod": "4.4.3"
|
package/types/index.d.ts
CHANGED
|
@@ -182,6 +182,15 @@ export interface OrbitPhaseDefinition {
|
|
|
182
182
|
* into generated orbit skills, but does not attach runtime semantics to it.
|
|
183
183
|
*/
|
|
184
184
|
readonly workflow?: OrbitPhaseWorkflowDefinition;
|
|
185
|
+
/**
|
|
186
|
+
* Typed workflow I/O contract for this phase. Serialized to JSON Schema in
|
|
187
|
+
* the compile manifest for workflow runtimes; unsupported schema constructs
|
|
188
|
+
* fail the compile.
|
|
189
|
+
*/
|
|
190
|
+
readonly contract?: {
|
|
191
|
+
readonly input?: import("effect/Schema").Schema.AnyNoContext;
|
|
192
|
+
readonly output?: import("effect/Schema").Schema.AnyNoContext;
|
|
193
|
+
};
|
|
185
194
|
/**
|
|
186
195
|
* Long-form markdown for this phase. When present, lowerers write it to
|
|
187
196
|
* `references/<phase-name>.md` next to the orbit SKILL.md. Treat this as
|
|
@@ -313,6 +322,13 @@ export declare const hookEvent: {
|
|
|
313
322
|
readonly permissionRequest: "permission.request";
|
|
314
323
|
readonly sessionStart: "session.start";
|
|
315
324
|
readonly sessionEnd: "session.end";
|
|
325
|
+
readonly toolFailure: "tool.failure";
|
|
326
|
+
readonly stop: "stop";
|
|
327
|
+
readonly subagentStart: "subagent.start";
|
|
328
|
+
readonly subagentStop: "subagent.stop";
|
|
329
|
+
readonly compactBefore: "compact.before";
|
|
330
|
+
readonly compactAfter: "compact.after";
|
|
331
|
+
readonly notification: "notification";
|
|
316
332
|
};
|
|
317
333
|
export type HookEvent = (typeof hookEvent)[keyof typeof hookEvent];
|
|
318
334
|
export interface HookTargetContextDefinition {
|
|
@@ -378,7 +394,70 @@ export interface SessionEndHookEventDefinition {
|
|
|
378
394
|
readonly reason?: string;
|
|
379
395
|
readonly native?: Record<string, unknown>;
|
|
380
396
|
}
|
|
381
|
-
export
|
|
397
|
+
export interface ToolFailureHookEventDefinition {
|
|
398
|
+
readonly event: typeof hookEvent.toolFailure;
|
|
399
|
+
readonly target: HookTargetContextDefinition;
|
|
400
|
+
readonly tool: HookToolContextDefinition & {
|
|
401
|
+
readonly error: unknown;
|
|
402
|
+
};
|
|
403
|
+
readonly cwd?: string;
|
|
404
|
+
readonly session?: HookSessionContextDefinition;
|
|
405
|
+
readonly native?: Record<string, unknown>;
|
|
406
|
+
}
|
|
407
|
+
export interface StopHookEventDefinition {
|
|
408
|
+
readonly event: typeof hookEvent.stop;
|
|
409
|
+
readonly target: HookTargetContextDefinition;
|
|
410
|
+
readonly cwd?: string;
|
|
411
|
+
readonly session?: HookSessionContextDefinition;
|
|
412
|
+
readonly stopHookActive?: boolean;
|
|
413
|
+
readonly native?: Record<string, unknown>;
|
|
414
|
+
}
|
|
415
|
+
export interface SubagentContextDefinition {
|
|
416
|
+
readonly id?: string;
|
|
417
|
+
readonly type?: string;
|
|
418
|
+
}
|
|
419
|
+
export interface SubagentStartHookEventDefinition {
|
|
420
|
+
readonly event: typeof hookEvent.subagentStart;
|
|
421
|
+
readonly target: HookTargetContextDefinition;
|
|
422
|
+
readonly cwd?: string;
|
|
423
|
+
readonly session?: HookSessionContextDefinition;
|
|
424
|
+
readonly subagent?: SubagentContextDefinition;
|
|
425
|
+
readonly native?: Record<string, unknown>;
|
|
426
|
+
}
|
|
427
|
+
export interface SubagentStopHookEventDefinition {
|
|
428
|
+
readonly event: typeof hookEvent.subagentStop;
|
|
429
|
+
readonly target: HookTargetContextDefinition;
|
|
430
|
+
readonly cwd?: string;
|
|
431
|
+
readonly session?: HookSessionContextDefinition;
|
|
432
|
+
readonly subagent?: SubagentContextDefinition;
|
|
433
|
+
readonly native?: Record<string, unknown>;
|
|
434
|
+
}
|
|
435
|
+
export interface CompactBeforeHookEventDefinition {
|
|
436
|
+
readonly event: typeof hookEvent.compactBefore;
|
|
437
|
+
readonly target: HookTargetContextDefinition;
|
|
438
|
+
readonly cwd?: string;
|
|
439
|
+
readonly session?: HookSessionContextDefinition;
|
|
440
|
+
readonly trigger?: string;
|
|
441
|
+
readonly native?: Record<string, unknown>;
|
|
442
|
+
}
|
|
443
|
+
export interface CompactAfterHookEventDefinition {
|
|
444
|
+
readonly event: typeof hookEvent.compactAfter;
|
|
445
|
+
readonly target: HookTargetContextDefinition;
|
|
446
|
+
readonly cwd?: string;
|
|
447
|
+
readonly session?: HookSessionContextDefinition;
|
|
448
|
+
readonly trigger?: string;
|
|
449
|
+
readonly native?: Record<string, unknown>;
|
|
450
|
+
}
|
|
451
|
+
export interface NotificationHookEventDefinition {
|
|
452
|
+
readonly event: typeof hookEvent.notification;
|
|
453
|
+
readonly target: HookTargetContextDefinition;
|
|
454
|
+
readonly cwd?: string;
|
|
455
|
+
readonly session?: HookSessionContextDefinition;
|
|
456
|
+
readonly message?: string;
|
|
457
|
+
readonly kind?: string;
|
|
458
|
+
readonly native?: Record<string, unknown>;
|
|
459
|
+
}
|
|
460
|
+
export type HookEventPayloadDefinition = ToolBeforeHookEventDefinition | ToolAfterHookEventDefinition | PromptSubmitHookEventDefinition | PermissionRequestHookEventDefinition | SessionStartHookEventDefinition | SessionEndHookEventDefinition | ToolFailureHookEventDefinition | StopHookEventDefinition | SubagentStartHookEventDefinition | SubagentStopHookEventDefinition | CompactBeforeHookEventDefinition | CompactAfterHookEventDefinition | NotificationHookEventDefinition;
|
|
382
461
|
export type HookEventPayloadFor<E extends HookEvent> = Extract<HookEventPayloadDefinition, {
|
|
383
462
|
readonly event: E;
|
|
384
463
|
}>;
|
|
@@ -386,18 +465,30 @@ export interface ContinueHookResultDefinition {
|
|
|
386
465
|
readonly decision: "continue";
|
|
387
466
|
readonly systemMessage?: string;
|
|
388
467
|
readonly additionalContext?: string;
|
|
468
|
+
/** tool.before: replace the tool arguments before execution. */
|
|
469
|
+
readonly updatedInput?: unknown;
|
|
470
|
+
/** tool.after: replace the tool result before the model sees it. */
|
|
471
|
+
readonly updatedOutput?: unknown;
|
|
389
472
|
}
|
|
390
473
|
export interface BlockHookResultDefinition {
|
|
391
474
|
readonly decision: "block";
|
|
392
475
|
readonly message: string;
|
|
476
|
+
readonly systemMessage?: string;
|
|
393
477
|
}
|
|
394
478
|
export interface AllowHookResultDefinition {
|
|
395
479
|
readonly decision: "allow";
|
|
396
480
|
readonly systemMessage?: string;
|
|
481
|
+
readonly updatedInput?: unknown;
|
|
482
|
+
}
|
|
483
|
+
export interface AskHookResultDefinition {
|
|
484
|
+
readonly decision: "ask";
|
|
485
|
+
readonly systemMessage?: string;
|
|
397
486
|
}
|
|
398
487
|
export type ToolBeforeHookResultDefinition = ContinueHookResultDefinition | BlockHookResultDefinition;
|
|
399
|
-
export type PermissionRequestHookResultDefinition = ContinueHookResultDefinition | AllowHookResultDefinition | BlockHookResultDefinition;
|
|
400
|
-
|
|
488
|
+
export type PermissionRequestHookResultDefinition = ContinueHookResultDefinition | AllowHookResultDefinition | AskHookResultDefinition | BlockHookResultDefinition;
|
|
489
|
+
/** prompt.submit, stop, subagent.stop, compact.before — continue or block. */
|
|
490
|
+
export type BlockableHookResultDefinition = ContinueHookResultDefinition | BlockHookResultDefinition;
|
|
491
|
+
export type HookResultFor<E extends HookEvent> = E extends typeof hookEvent.toolBefore ? ToolBeforeHookResultDefinition : E extends typeof hookEvent.permissionRequest ? PermissionRequestHookResultDefinition : E extends typeof hookEvent.promptSubmit | typeof hookEvent.stop | typeof hookEvent.subagentStop | typeof hookEvent.compactBefore ? BlockableHookResultDefinition : ContinueHookResultDefinition;
|
|
401
492
|
export type HookHandlerDefinition<E extends HookEvent> = (event: HookEventPayloadFor<E>) => import("effect").Effect.Effect<HookResultFor<E>, unknown, never>;
|
|
402
493
|
export interface HookAnyToolMatcherDefinition {
|
|
403
494
|
readonly kind: "hook-any-tool";
|
|
@@ -418,13 +509,17 @@ export type HookToolMatcherDefinition = HookAnyToolMatcherDefinition | HookTools
|
|
|
418
509
|
export interface ToolHookMatchDefinition {
|
|
419
510
|
readonly tool?: HookToolMatcherDefinition;
|
|
420
511
|
}
|
|
421
|
-
export type HookMatchDefinition<E extends HookEvent> = E extends typeof hookEvent.toolBefore | typeof hookEvent.toolAfter | typeof hookEvent.permissionRequest ? ToolHookMatchDefinition : never;
|
|
512
|
+
export type HookMatchDefinition<E extends HookEvent> = E extends typeof hookEvent.toolBefore | typeof hookEvent.toolAfter | typeof hookEvent.toolFailure | typeof hookEvent.permissionRequest ? ToolHookMatchDefinition : never;
|
|
422
513
|
export interface HookDefinition<E extends HookEvent = HookEvent> {
|
|
423
514
|
readonly name: string;
|
|
424
515
|
readonly description?: string;
|
|
425
516
|
readonly event: E;
|
|
426
517
|
readonly targets?: readonly string[];
|
|
427
518
|
readonly match?: HookMatchDefinition<E>;
|
|
519
|
+
/** How to lower this hook on a target that cannot deliver every control it
|
|
520
|
+
* declares: "degrade" (default) omits with a fidelity note, "skip" omits
|
|
521
|
+
* silently, "fail" makes it a compile error. */
|
|
522
|
+
readonly onDegraded?: "fail" | "degrade" | "skip";
|
|
428
523
|
readonly handle: HookHandlerDefinition<E>;
|
|
429
524
|
}
|
|
430
525
|
export type HookSource<E extends HookEvent = HookEvent> = HookDefinition<E>;
|
|
@@ -467,20 +562,4 @@ export declare const hookMatcher: {
|
|
|
467
562
|
readonly canonical: (ref: string) => HookCanonicalToolMatcherDefinition;
|
|
468
563
|
};
|
|
469
564
|
};
|
|
470
|
-
/** Transitional identity wrapper. The canonical public source type is `AgentSource`. */
|
|
471
|
-
export declare const defineAgent: <T extends AgentSource>(agent: T) => T;
|
|
472
|
-
/** Transitional identity wrapper. The canonical public source type is `TraitSource`. */
|
|
473
|
-
export declare const defineTrait: <T extends TraitSource>(trait: T) => T;
|
|
474
|
-
/** Transitional identity wrapper. The canonical public source type is `OrbitSource`. */
|
|
475
|
-
export declare const defineOrbit: <T extends OrbitSource>(orbit: T) => T;
|
|
476
|
-
/** Transitional identity wrapper. The canonical public source type is `ToolSource`. */
|
|
477
|
-
export declare const defineTool: <T extends ToolSource>(tool: T) => T;
|
|
478
|
-
/** Transitional identity wrapper. The canonical public source type is `ToolspaceSource`. */
|
|
479
|
-
export declare const defineToolspace: <T extends ToolspaceSource>(toolspace: T) => T;
|
|
480
|
-
/** Transitional identity wrapper. The canonical public source type is `ModelspaceSource`. */
|
|
481
|
-
export declare const defineModelspace: <T extends ModelspaceSource>(modelspace: T) => T;
|
|
482
|
-
/** Transitional identity wrapper. The canonical public source type is `SkillspaceSource`. */
|
|
483
|
-
export declare const defineSkillspace: <T extends SkillspaceSource>(skillspace: T) => T;
|
|
484
|
-
/** Transitional identity wrapper. The canonical public source type is `HookSource`. */
|
|
485
|
-
export declare const defineHook: <E extends HookEvent, T extends HookSource<E>>(hook: T) => T;
|
|
486
565
|
export type { ToolRuntimeContext, ToolRuntimeCost } from "./compile/runtime/schema-bridge";
|
|
@@ -176,7 +176,11 @@ export declare const LOWERER_CAPABILITIES: {
|
|
|
176
176
|
readonly path: "<prism-home>/runtime/mcp/<plugin>/server.mjs";
|
|
177
177
|
readonly summary: "Canonical tools lower to the canonical PRISM_HOME union MCP server referenced from config.yaml.";
|
|
178
178
|
};
|
|
179
|
-
readonly hooks:
|
|
179
|
+
readonly hooks: {
|
|
180
|
+
readonly kind: "config-patch";
|
|
181
|
+
readonly path: "<hermes-root>/config.yaml#hooks";
|
|
182
|
+
readonly summary: "Compile patches managed Hermes hook entries and wrapper files.";
|
|
183
|
+
};
|
|
180
184
|
readonly mcpConfig: {
|
|
181
185
|
readonly kind: "config-patch";
|
|
182
186
|
readonly path: "<hermes-root>/config.yaml#mcp_servers";
|
|
@@ -528,6 +532,56 @@ export declare const LOWERER_CAPABILITIES: {
|
|
|
528
532
|
};
|
|
529
533
|
readonly notes: readonly ["Pi packages are referenced from settings.json#packages; project scope uses .pi/settings.json.", "Compiled Pi agents use pi-agents markdown discovery: ~/.pi/agents globally and nearest .pi/agents in project scope."];
|
|
530
534
|
};
|
|
535
|
+
readonly omp: {
|
|
536
|
+
readonly harness: "omp";
|
|
537
|
+
readonly family: "coding-harness";
|
|
538
|
+
readonly workflowWorker: true;
|
|
539
|
+
readonly compile: CompileTargetCapabilities;
|
|
540
|
+
readonly surfaces: {
|
|
541
|
+
readonly pluginBundle: {
|
|
542
|
+
readonly kind: "native-plugin-bundle";
|
|
543
|
+
readonly path: "<omp-root>/extensions/prism-generated-<plugin>/";
|
|
544
|
+
readonly summary: "Compile emits OMP native extensions under the extensions surface.";
|
|
545
|
+
};
|
|
546
|
+
readonly rules: {
|
|
547
|
+
readonly kind: "direct-file";
|
|
548
|
+
readonly path: "<omp-root>/rules/";
|
|
549
|
+
readonly summary: "Compile writes OMP native rule files.";
|
|
550
|
+
};
|
|
551
|
+
readonly commands: {
|
|
552
|
+
readonly kind: "direct-file";
|
|
553
|
+
readonly path: "<omp-root>/commands/";
|
|
554
|
+
readonly summary: "Compile writes OMP native command files.";
|
|
555
|
+
};
|
|
556
|
+
readonly agents: {
|
|
557
|
+
readonly kind: "direct-file";
|
|
558
|
+
readonly path: "<omp-root>/agents/";
|
|
559
|
+
readonly summary: "Compile writes OMP native agent files.";
|
|
560
|
+
};
|
|
561
|
+
readonly skills: {
|
|
562
|
+
readonly kind: "direct-file";
|
|
563
|
+
readonly path: "<omp-root>/skills/";
|
|
564
|
+
readonly summary: "Compile writes OMP native skill folders.";
|
|
565
|
+
};
|
|
566
|
+
readonly generatedTools: {
|
|
567
|
+
readonly kind: "native-plugin-api";
|
|
568
|
+
readonly path: "<omp-root>/extensions/prism-generated-<plugin>/";
|
|
569
|
+
readonly summary: "Canonical tools lower through OMP's native extension API.";
|
|
570
|
+
};
|
|
571
|
+
readonly hooks: {
|
|
572
|
+
readonly kind: "native-plugin-api";
|
|
573
|
+
readonly path: "<omp-root>/extensions/prism-generated-<plugin>/";
|
|
574
|
+
readonly summary: "Hooks lower through OMP's native extension API.";
|
|
575
|
+
};
|
|
576
|
+
readonly mcpConfig: LowererSurfaceCapability;
|
|
577
|
+
readonly agentConfig: {
|
|
578
|
+
readonly kind: "direct-file";
|
|
579
|
+
readonly path: "<omp-root>/agents/";
|
|
580
|
+
readonly summary: "OMP agent model bindings and settings live in generated agent files.";
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
readonly notes: readonly ["OMP is a distinct harness from Pi and uses ~/.omp/agent globally or .omp project-local.", "OMP does not expose a verified per-agent skill permission surface; permission-only skill access fails closed."];
|
|
584
|
+
};
|
|
531
585
|
readonly grok: {
|
|
532
586
|
readonly harness: "grok";
|
|
533
587
|
readonly family: "coding-harness";
|
|
@@ -577,6 +631,46 @@ export declare const LOWERER_CAPABILITIES: {
|
|
|
577
631
|
};
|
|
578
632
|
};
|
|
579
633
|
};
|
|
634
|
+
readonly devin: {
|
|
635
|
+
readonly harness: "devin";
|
|
636
|
+
readonly family: "coding-harness";
|
|
637
|
+
readonly workflowWorker: true;
|
|
638
|
+
readonly compile: {
|
|
639
|
+
readonly agents: "unsupported";
|
|
640
|
+
readonly agentModelBindings: "ignored";
|
|
641
|
+
readonly generatedCanonicalTools: "unsupported";
|
|
642
|
+
readonly hooks: "supported";
|
|
643
|
+
readonly skillPermissions: "unsupported";
|
|
644
|
+
};
|
|
645
|
+
readonly surfaces: {
|
|
646
|
+
readonly pluginBundle: LowererSurfaceCapability;
|
|
647
|
+
readonly rules: {
|
|
648
|
+
readonly kind: "direct-file";
|
|
649
|
+
readonly path: "<devin-root>/AGENTS.md";
|
|
650
|
+
readonly summary: "Install appends managed sections to the native AGENTS.md instructions file.";
|
|
651
|
+
};
|
|
652
|
+
readonly commands: LowererSurfaceCapability;
|
|
653
|
+
readonly agents: LowererSurfaceCapability;
|
|
654
|
+
readonly skills: {
|
|
655
|
+
readonly kind: "direct-file";
|
|
656
|
+
readonly path: "<devin-root>/skills/";
|
|
657
|
+
readonly summary: "Install and compile write Agent Skill folders (global and project .devin/skills).";
|
|
658
|
+
};
|
|
659
|
+
readonly generatedTools: LowererSurfaceCapability;
|
|
660
|
+
readonly hooks: {
|
|
661
|
+
readonly kind: "direct-file";
|
|
662
|
+
readonly path: "project: hooks.v1.json; global: config.json#hooks json-array-member + hooks/*.mjs";
|
|
663
|
+
readonly summary: "Project scope writes hooks.v1.json; global scope upserts Prism entries into config.json hooks without whole-file adopt. Wrappers under hooks/.";
|
|
664
|
+
};
|
|
665
|
+
readonly mcpConfig: LowererSurfaceCapability;
|
|
666
|
+
readonly agentConfig: {
|
|
667
|
+
readonly kind: "direct-file";
|
|
668
|
+
readonly path: "ephemeral --agent-config for workflow runs";
|
|
669
|
+
readonly summary: "Workflow worker writes temporary agent-config (system_instructions, allowed_tools); not a durable install surface.";
|
|
670
|
+
};
|
|
671
|
+
};
|
|
672
|
+
readonly notes: readonly ["Never whole-file adopt ~/.config/devin/config.json — herdr hooks and user prefs live there.", "Workflow default model is swe-1-7; headless via `devin -p` + ATIF --export session resume via -r."];
|
|
673
|
+
};
|
|
580
674
|
};
|
|
581
675
|
export declare const getCompileTargetCapabilities: (harness: string) => CompileTargetCapabilities;
|
|
582
676
|
/**
|
package/types/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core types for prism - the unified plugin distribution system
|
|
3
3
|
*/
|
|
4
|
-
export type HarnessId = "claude-code" | "opencode" | "openclaw" | "hermes" | "codex-cli" | "antigravity-cli" | "kimi-code" | "amp-code" | "cursor" | "factory-droid" | "pi" | "grok";
|
|
4
|
+
export type HarnessId = "claude-code" | "opencode" | "openclaw" | "hermes" | "codex-cli" | "antigravity-cli" | "kimi-code" | "amp-code" | "cursor" | "factory-droid" | "pi" | "omp" | "grok" | "devin";
|
|
5
5
|
export declare const HARNESS_SCOPES: readonly ["global", "project"];
|
|
6
6
|
export type HarnessScope = (typeof HARNESS_SCOPES)[number];
|
|
7
7
|
export interface HarnessConfig {
|
|
@@ -15,6 +15,7 @@ export interface HarnessConfig {
|
|
|
15
15
|
agentsDir: string | null;
|
|
16
16
|
toolsDir: string | null;
|
|
17
17
|
skillsDir: string | null;
|
|
18
|
+
extensionsDir?: string | null;
|
|
18
19
|
configFile: string | null;
|
|
19
20
|
configFormat: "json" | "yaml" | "toml" | "markdown" | "mdc";
|
|
20
21
|
supportsTools: boolean;
|
|
@@ -157,7 +158,9 @@ export interface UnifiedFrontmatter {
|
|
|
157
158
|
cursor?: CursorFrontmatter;
|
|
158
159
|
"factory-droid"?: FactoryDroidFrontmatter;
|
|
159
160
|
pi?: Record<string, unknown>;
|
|
161
|
+
omp?: Record<string, unknown>;
|
|
160
162
|
grok?: Record<string, unknown>;
|
|
163
|
+
devin?: Record<string, unknown>;
|
|
161
164
|
}
|
|
162
165
|
export interface SkillFrontmatter {
|
|
163
166
|
name: string;
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
interface WorkflowBunSpawnBaseOptions {
|
|
2
2
|
readonly cmd: ReadonlyArray<string>;
|
|
3
3
|
readonly cwd?: string;
|
|
4
4
|
readonly env?: Record<string, string | undefined>;
|
|
5
|
+
readonly detached?: boolean;
|
|
6
|
+
/** A `number` redirects to that open file descriptor (e.g. a log file opened before spawn). */
|
|
7
|
+
readonly stdout: "ignore" | "pipe" | number;
|
|
8
|
+
readonly stderr: "ignore" | "pipe" | number;
|
|
9
|
+
}
|
|
10
|
+
export interface WorkflowBunSpawnOptions extends WorkflowBunSpawnBaseOptions {
|
|
5
11
|
readonly stdin: "ignore";
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
}
|
|
13
|
+
export interface WorkflowBunPipedSpawnOptions extends WorkflowBunSpawnBaseOptions {
|
|
14
|
+
readonly stdin: "pipe";
|
|
15
|
+
readonly stdout: "pipe";
|
|
16
|
+
readonly stderr: "pipe";
|
|
17
|
+
}
|
|
18
|
+
export interface WorkflowBunWritableStdin {
|
|
19
|
+
end(error?: Error): number | Promise<number>;
|
|
8
20
|
}
|
|
9
21
|
export interface WorkflowBunSpawnedProcess {
|
|
10
22
|
readonly pid?: number;
|
|
@@ -14,8 +26,14 @@ export interface WorkflowBunSpawnedProcess {
|
|
|
14
26
|
kill(signal?: NodeJS.Signals | number): void;
|
|
15
27
|
unref?(): void;
|
|
16
28
|
}
|
|
29
|
+
export interface WorkflowBunPipedSpawnedProcess extends WorkflowBunSpawnedProcess {
|
|
30
|
+
readonly stdin: WorkflowBunWritableStdin;
|
|
31
|
+
readonly stdout: ReadableStream<Uint8Array>;
|
|
32
|
+
}
|
|
17
33
|
export interface WorkflowBunRuntime {
|
|
18
34
|
which(name: string): string | null;
|
|
19
35
|
spawn(options: WorkflowBunSpawnOptions): WorkflowBunSpawnedProcess;
|
|
36
|
+
spawn(options: WorkflowBunPipedSpawnOptions): WorkflowBunPipedSpawnedProcess;
|
|
20
37
|
}
|
|
21
38
|
export declare const workflowBunRuntime: (capability: string) => WorkflowBunRuntime;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { WorkflowRunnerLogRemoval } from "./workflow-runner-log.js";
|
|
2
|
+
export declare const DEFAULT_WORKFLOW_RETENTION_DAYS = 30;
|
|
3
|
+
export declare const DEFAULT_WORKFLOW_RETENTION_MS: number;
|
|
4
|
+
export declare const DEFAULT_WORKFLOW_RETENTION_AGE = "30d";
|
|
5
|
+
export declare const parseWorkflowRetentionAge: (input: string) => number;
|
|
6
|
+
export interface WorkflowRunArtifactCounts {
|
|
7
|
+
readonly runs: number;
|
|
8
|
+
readonly tasks: number;
|
|
9
|
+
readonly attempts: number;
|
|
10
|
+
readonly events: number;
|
|
11
|
+
readonly spans: number;
|
|
12
|
+
readonly runSnapshots: number;
|
|
13
|
+
readonly taskSnapshots: number;
|
|
14
|
+
}
|
|
15
|
+
export interface WorkflowCacheArtifactCounts {
|
|
16
|
+
readonly taskCache: number;
|
|
17
|
+
readonly judgeCache: number;
|
|
18
|
+
}
|
|
19
|
+
export interface WorkflowRunDeletionReport {
|
|
20
|
+
readonly runId: string;
|
|
21
|
+
readonly status: "deleted" | "missing";
|
|
22
|
+
readonly rows: WorkflowRunArtifactCounts;
|
|
23
|
+
readonly runnerLog: WorkflowRunnerLogRemoval;
|
|
24
|
+
}
|
|
25
|
+
export interface WorkflowRetentionCleanupReport {
|
|
26
|
+
readonly policy: "workflow-ledger-retention-v1";
|
|
27
|
+
readonly olderThanMs: number;
|
|
28
|
+
readonly cutoff: string;
|
|
29
|
+
readonly runs: {
|
|
30
|
+
readonly matched: number;
|
|
31
|
+
readonly deleted: number;
|
|
32
|
+
readonly rows: WorkflowRunArtifactCounts;
|
|
33
|
+
};
|
|
34
|
+
readonly caches: WorkflowCacheArtifactCounts;
|
|
35
|
+
readonly runnerLogs: {
|
|
36
|
+
readonly deleted: number;
|
|
37
|
+
readonly missing: number;
|
|
38
|
+
readonly skippedUnsafeRunId: number;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export declare const emptyWorkflowRunArtifactCounts: () => WorkflowRunArtifactCounts;
|
|
42
|
+
export declare const addWorkflowRunArtifactCounts: (left: WorkflowRunArtifactCounts, right: WorkflowRunArtifactCounts) => WorkflowRunArtifactCounts;
|
|
43
|
+
export declare const workflowRetentionCutoff: (olderThanMs: number, now?: Date) => Date;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central workflow-ledger data policy.
|
|
3
|
+
*
|
|
4
|
+
* All durable workflow evidence and telemetry exports pass through this module.
|
|
5
|
+
* Exact-continuation identifiers and execution provenance are deliberately
|
|
6
|
+
* preserved: they are operational routing data, not authentication secrets.
|
|
7
|
+
* Cache payloads are never mutated. Callers must skip a cache write when
|
|
8
|
+
* `workflowCachePersistenceDecision` rejects it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const WORKFLOW_DATA_POLICY_VERSION = 1;
|
|
11
|
+
export declare const WORKFLOW_REDACTION_MARKER = "[REDACTED]";
|
|
12
|
+
export declare const WORKFLOW_SECRET_DIGEST_PREFIX = "sha256:";
|
|
13
|
+
export type WorkflowSensitiveDataReason = "sensitive-key" | "bearer-credential" | "provider-token" | "credential-assignment" | "private-key" | "url-password";
|
|
14
|
+
export interface WorkflowSensitiveDataFinding {
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly reason: WorkflowSensitiveDataReason;
|
|
17
|
+
}
|
|
18
|
+
export interface WorkflowDataPolicyResult<Value> {
|
|
19
|
+
readonly value: Value;
|
|
20
|
+
readonly findings: ReadonlyArray<WorkflowSensitiveDataFinding>;
|
|
21
|
+
}
|
|
22
|
+
export type WorkflowCachePersistenceDecision = {
|
|
23
|
+
readonly safe: true;
|
|
24
|
+
} | {
|
|
25
|
+
readonly safe: false;
|
|
26
|
+
readonly reason: "sensitive-data";
|
|
27
|
+
readonly findings: ReadonlyArray<WorkflowSensitiveDataFinding>;
|
|
28
|
+
};
|
|
29
|
+
export declare const applyWorkflowDataPolicy: <Value>(input: Value) => WorkflowDataPolicyResult<Value>;
|
|
30
|
+
export declare const inspectWorkflowSensitiveData: (input: unknown) => ReadonlyArray<WorkflowSensitiveDataFinding>;
|
|
31
|
+
export declare const redactWorkflowData: <Value>(input: Value) => Value;
|
|
32
|
+
export declare const redactWorkflowText: (input: string) => string;
|
|
33
|
+
export declare const digestWorkflowSecret: (input: string) => string;
|
|
34
|
+
export declare const workflowCachePersistenceDecision: (input: {
|
|
35
|
+
readonly output: unknown;
|
|
36
|
+
readonly metadata?: Record<string, unknown>;
|
|
37
|
+
readonly identity?: unknown;
|
|
38
|
+
readonly agent?: unknown;
|
|
39
|
+
}) => WorkflowCachePersistenceDecision;
|
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
export declare class WorkflowRunTimeoutError extends Error {
|
|
2
|
+
readonly limitMs: number;
|
|
3
|
+
readonly name = "WorkflowRunTimeoutError";
|
|
4
|
+
constructor(limitMs: number);
|
|
5
|
+
}
|
|
6
|
+
export declare class WorkflowTaskNoProgressError extends Error {
|
|
7
|
+
readonly taskId: string;
|
|
8
|
+
readonly limitMs: number;
|
|
9
|
+
readonly name = "WorkflowTaskNoProgressError";
|
|
10
|
+
constructor(taskId: string, limitMs: number);
|
|
11
|
+
}
|
|
12
|
+
export declare class WorkflowFanoutExceededError extends Error {
|
|
13
|
+
readonly limit: number;
|
|
14
|
+
readonly observed: number;
|
|
15
|
+
readonly name = "WorkflowFanoutExceededError";
|
|
16
|
+
constructor(limit: number, observed: number);
|
|
17
|
+
}
|
|
18
|
+
export declare class WorkflowCostExceededError extends Error {
|
|
19
|
+
readonly limitUsd: number;
|
|
20
|
+
readonly observedUsd: number;
|
|
21
|
+
readonly name = "WorkflowCostExceededError";
|
|
22
|
+
constructor(limitUsd: number, observedUsd: number);
|
|
23
|
+
}
|
|
24
|
+
export declare class WorkflowCostUnavailableError extends Error {
|
|
25
|
+
readonly limitUsd: number;
|
|
26
|
+
readonly name = "WorkflowCostUnavailableError";
|
|
27
|
+
constructor(limitUsd: number);
|
|
28
|
+
}
|
|
29
|
+
export declare class WorkflowPromptLimitError extends Error {
|
|
30
|
+
readonly taskId: string;
|
|
31
|
+
readonly limitBytes: number;
|
|
32
|
+
readonly observedBytes: number;
|
|
33
|
+
readonly name = "WorkflowPromptLimitError";
|
|
34
|
+
constructor(taskId: string, limitBytes: number, observedBytes: number);
|
|
35
|
+
}
|
|
1
36
|
/** Errors surfaced by {@link WorkflowRuntime.runTask} and dynamic workflow runs. */
|
|
2
37
|
export declare class WorkflowTaskDecodeError extends Error {
|
|
3
38
|
readonly taskId: string;
|
|
@@ -25,4 +60,4 @@ export declare class WorkflowUnsupportedHarnessError extends Error {
|
|
|
25
60
|
readonly name = "WorkflowUnsupportedHarnessError";
|
|
26
61
|
constructor(harness: string, validHarnesses: ReadonlyArray<string>);
|
|
27
62
|
}
|
|
28
|
-
export type WorkflowRuntimeError = WorkflowBunRuntimeUnavailableError | WorkflowUnsupportedHarnessError | WorkflowTaskDecodeError | WorkflowTaskEscalatedError | WorkflowRunStoppedError | Error;
|
|
63
|
+
export type WorkflowRuntimeError = WorkflowBunRuntimeUnavailableError | WorkflowUnsupportedHarnessError | WorkflowTaskDecodeError | WorkflowTaskEscalatedError | WorkflowRunStoppedError | WorkflowRunTimeoutError | WorkflowTaskNoProgressError | WorkflowFanoutExceededError | WorkflowCostExceededError | WorkflowCostUnavailableError | WorkflowPromptLimitError | Error;
|
|
@@ -10,6 +10,8 @@ import type { HarnessId } from "./types.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const WORKFLOW_HARNESS_IDS: ReadonlyArray<WorkflowWorkerHarnessId>;
|
|
12
12
|
export type WorkflowHarnessId = WorkflowWorkerHarnessId;
|
|
13
|
+
/** Shared env/CLI integer parser kept off the worker-process module so the public SDK graph stays free of spawn runtime. */
|
|
14
|
+
export declare const parsePositiveInteger: (value: string | undefined) => number | undefined;
|
|
13
15
|
export type WorkflowHarnessDetectionStatus = "available" | "missing" | "broken";
|
|
14
16
|
export type WorkflowHarnessDetectionReasonCode = "executable-found" | "executable-missing" | "probe-succeeded" | "probe-exited-nonzero" | "probe-timed-out" | "probe-failed";
|
|
15
17
|
export interface WorkflowHarnessDetectionReason {
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { type AnyWorkflowTask, type WorkflowRuntimeOptions } from "./workflows.js";
|
|
2
|
+
/**
|
|
3
|
+
* `cacheKey` and `promptHash` AND together in the cache primary key
|
|
4
|
+
* (workflow-store.ts) — `cacheKey` never substitutes for `promptHash`, and
|
|
5
|
+
* there is no override/terminal-marker mechanism to make a stale prompt hash
|
|
6
|
+
* replay anyway. `promptHash` hashes the literal rendered `task.prompt`
|
|
7
|
+
* string, so interpolating volatile upstream text (judge prose, logs, whole
|
|
8
|
+
* objects) into a downstream prompt guarantees resume misses by construction.
|
|
9
|
+
* Authoring discipline: interpolate only narrow, stable upstream fields —
|
|
10
|
+
* ids, hashes, short enums (e.g. `build.commitSha`) — never freeform upstream
|
|
11
|
+
* text. There is no `--no-cache` bypass (removed; cache is mandatory) — the
|
|
12
|
+
* sanctioned no-reuse path is a fresh `--store`.
|
|
13
|
+
*/
|
|
2
14
|
export interface WorkflowTaskIdentity {
|
|
3
15
|
readonly workflow: string;
|
|
4
16
|
readonly taskId: string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const WORKFLOW_RUNNER_LOG_FILE_MODE = 384;
|
|
2
|
+
export declare const WORKFLOW_RUNNER_LOG_DIRECTORY_MODE = 448;
|
|
3
|
+
export type WorkflowRunnerLogRemoval = {
|
|
4
|
+
readonly status: "deleted";
|
|
5
|
+
readonly path: string;
|
|
6
|
+
} | {
|
|
7
|
+
readonly status: "missing";
|
|
8
|
+
readonly path: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly status: "skipped-unsafe-run-id";
|
|
11
|
+
};
|
|
12
|
+
export type WorkflowRunnerLogRedaction = {
|
|
13
|
+
readonly status: "redacted" | "unchanged";
|
|
14
|
+
readonly path: string;
|
|
15
|
+
} | {
|
|
16
|
+
readonly status: "missing";
|
|
17
|
+
readonly path: string;
|
|
18
|
+
} | {
|
|
19
|
+
readonly status: "skipped-unsafe-run-id" | "skipped-non-file";
|
|
20
|
+
};
|
|
21
|
+
export declare const workflowRunnerLogDir: (storePath: string) => string;
|
|
22
|
+
export declare const workflowRunnerLogPath: (storePath: string, runId: string) => string;
|
|
23
|
+
export declare const workflowRunnerLogPathIfPresent: (storePath: string, run: {
|
|
24
|
+
readonly runId: string;
|
|
25
|
+
readonly runnerPid?: number;
|
|
26
|
+
}) => string | undefined;
|
|
27
|
+
export declare const secureWorkflowRunnerLog: (path: string) => Promise<void>;
|
|
28
|
+
export declare const readRedactedWorkflowRunnerLog: (storePath: string, runId: string) => Promise<{
|
|
29
|
+
readonly path: string;
|
|
30
|
+
readonly bytes: number;
|
|
31
|
+
readonly content: string;
|
|
32
|
+
} | null>;
|
|
33
|
+
export declare const redactWorkflowRunnerLogInPlace: (storePath: string, runId: string) => Promise<WorkflowRunnerLogRedaction>;
|
|
34
|
+
export declare const removeWorkflowRunnerLog: (storePath: string, runId: string) => Promise<WorkflowRunnerLogRemoval>;
|
|
@@ -24,8 +24,10 @@ export interface WorkflowRunResult {
|
|
|
24
24
|
readonly tasks: ReadonlyArray<WorkflowRunTaskResult>;
|
|
25
25
|
readonly output?: unknown;
|
|
26
26
|
}
|
|
27
|
-
export { WorkflowRunStoppedError, WorkflowTaskDecodeError, WorkflowTaskEscalatedError, type WorkflowRuntimeError, } from "./workflow-errors.js";
|
|
27
|
+
export { WorkflowRunStoppedError, WorkflowTaskDecodeError, WorkflowTaskEscalatedError, WorkflowRunTimeoutError, WorkflowTaskNoProgressError, WorkflowFanoutExceededError, WorkflowCostExceededError, WorkflowCostUnavailableError, WorkflowPromptLimitError, type WorkflowRuntimeError, } from "./workflow-errors.js";
|
|
28
28
|
export type WorkflowTaskRepairMode = "native-continuation" | "fresh-executor-invocation" | "none";
|
|
29
|
+
export type WorkflowTaskProgressSource = "executor" | "worker-stdout" | "worker-stderr";
|
|
30
|
+
export type WorkflowTaskProgressReporter = (source?: WorkflowTaskProgressSource) => void;
|
|
29
31
|
export type WorkflowTaskRepairFallbackReason = "adapter-does-not-support-continuation" | "executor-does-not-advertise-continuation" | "missing-session-id";
|
|
30
32
|
interface WorkflowTaskRepairContextBase {
|
|
31
33
|
readonly attempt: number;
|
|
@@ -44,10 +46,12 @@ export type WorkflowTaskRepairContext = WorkflowTaskRepairContextBase & ({
|
|
|
44
46
|
});
|
|
45
47
|
export interface WorkflowTaskExecutionContext {
|
|
46
48
|
readonly abortSignal?: AbortSignal;
|
|
49
|
+
readonly reportProgress?: WorkflowTaskProgressReporter;
|
|
47
50
|
readonly repair?: WorkflowTaskRepairContext;
|
|
48
51
|
}
|
|
49
52
|
export interface WorkflowTaskExecutionContextWithoutRepair {
|
|
50
53
|
readonly abortSignal?: AbortSignal;
|
|
54
|
+
readonly reportProgress?: WorkflowTaskProgressReporter;
|
|
51
55
|
}
|
|
52
56
|
export type WorkflowTaskRepairLoopOption<Worker extends string> = Worker extends WorkflowRepairLoopContinuationWorkerId ? {
|
|
53
57
|
readonly repair?: WorkflowTaskRepairContext;
|
|
@@ -56,12 +60,17 @@ export type WorkflowTaskRepairLoopOption<Worker extends string> = Worker extends
|
|
|
56
60
|
};
|
|
57
61
|
export type WorkflowTaskExecutor = (task: AnyWorkflowTask, context?: WorkflowTaskExecutionContext) => Promise<unknown | WorkflowTaskExecution>;
|
|
58
62
|
export declare const DEFAULT_WORKFLOW_TASK_CONCURRENCY = 8;
|
|
63
|
+
export declare const DEFAULT_WORKFLOW_MAX_PROMPT_BYTES: number;
|
|
59
64
|
export declare const runWorkflow: (workflow: AnyWorkflowDefinition, options: {
|
|
60
65
|
readonly executeTask: WorkflowTaskExecutor;
|
|
61
66
|
readonly store?: WorkflowStore;
|
|
62
|
-
readonly cache?: boolean;
|
|
63
67
|
readonly mockOutput?: boolean;
|
|
64
68
|
readonly maxConcurrentTasks?: number;
|
|
69
|
+
readonly maxWallMs?: number;
|
|
70
|
+
readonly taskNoProgressMs?: number;
|
|
71
|
+
readonly maxTasks?: number;
|
|
72
|
+
readonly maxCostUsd?: number;
|
|
73
|
+
readonly maxPromptBytes?: number;
|
|
65
74
|
readonly runId?: string;
|
|
66
75
|
readonly runtimeOptions?: WorkflowRuntimeOptions;
|
|
67
76
|
readonly abortSignal?: AbortSignal;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type WorkflowBunSpawnedProcess, type WorkflowBunSpawnOptions } from "./workflow-bun-runtime.js";
|
|
1
|
+
import { type WorkflowBunPipedSpawnOptions, type WorkflowBunPipedSpawnedProcess, type WorkflowBunSpawnedProcess, type WorkflowBunSpawnOptions } from "./workflow-bun-runtime.js";
|
|
2
2
|
export interface WorkflowDatabaseQuery<Row, Params extends ReadonlyArray<unknown>> {
|
|
3
3
|
get(...params: Params): Row | null;
|
|
4
4
|
all(...params: Params): Row[];
|
|
@@ -13,12 +13,21 @@ export interface WorkflowDatabase {
|
|
|
13
13
|
export interface WorkflowSpawnOptions extends WorkflowBunSpawnOptions {
|
|
14
14
|
readonly cwd: string;
|
|
15
15
|
}
|
|
16
|
+
export interface WorkflowPipedSpawnOptions extends WorkflowBunPipedSpawnOptions {
|
|
17
|
+
readonly cwd: string;
|
|
18
|
+
}
|
|
16
19
|
export interface WorkflowSpawnedProcess extends WorkflowBunSpawnedProcess {
|
|
17
20
|
readonly pid: number;
|
|
18
21
|
readonly stdout: ReadableStream<Uint8Array>;
|
|
19
22
|
readonly stderr: ReadableStream<Uint8Array>;
|
|
20
23
|
unref(): void;
|
|
21
24
|
}
|
|
25
|
+
export interface WorkflowPipedSpawnedProcess extends WorkflowBunPipedSpawnedProcess {
|
|
26
|
+
readonly pid: number;
|
|
27
|
+
readonly stderr: ReadableStream<Uint8Array>;
|
|
28
|
+
unref(): void;
|
|
29
|
+
}
|
|
22
30
|
export declare const openWorkflowDatabase: (path: string) => WorkflowDatabase;
|
|
23
|
-
export declare
|
|
31
|
+
export declare function spawnWorkflowProcess(options: WorkflowPipedSpawnOptions): WorkflowPipedSpawnedProcess;
|
|
32
|
+
export declare function spawnWorkflowProcess(options: WorkflowSpawnOptions): WorkflowSpawnedProcess;
|
|
24
33
|
export declare const findWorkflowExecutable: (name: string) => string | undefined;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
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"]>;
|
|
2
|
+
export declare const WorkflowContinuationAdapterIdSchema: Schema.Literal<["amp-code", "antigravity-cli", "claude-code", "codex-cli", "devin", "grok-cli", "hermes", "kimi-code", "opencode-cli", "omp-cli"]>;
|
|
3
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"]>;
|
|
4
|
+
export declare const WorkflowContinuationWorkerIdSchema: Schema.Literal<["amp-code", "antigravity-cli", "claude-code", "codex-cli", "devin", "grok", "hermes", "kimi-code", "opencode", "omp"]>;
|
|
5
5
|
export type WorkflowContinuationWorkerId = typeof WorkflowContinuationWorkerIdSchema.Type;
|
|
6
6
|
export declare const StableSessionIdSchema: Schema.brand<typeof Schema.NonEmptyTrimmedString, "StableSessionId">;
|
|
7
7
|
export type StableSessionId = typeof StableSessionIdSchema.Type;
|
|
8
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"]>;
|
|
9
|
+
adapter: Schema.Literal<["amp-code", "antigravity-cli", "claude-code", "codex-cli", "devin", "grok-cli", "hermes", "kimi-code", "opencode-cli", "omp-cli"]>;
|
|
10
10
|
sessionId: Schema.brand<typeof Schema.NonEmptyTrimmedString, "StableSessionId">;
|
|
11
11
|
}>;
|
|
12
12
|
export type WorkflowStableSession = typeof WorkflowStableSessionSchema.Type;
|
|
13
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"]>;
|
|
14
|
+
adapter: Schema.Literal<["amp-code", "antigravity-cli", "claude-code", "codex-cli", "devin", "grok-cli", "hermes", "kimi-code", "opencode-cli", "omp-cli"]>;
|
|
15
15
|
workflowWorker: typeof Schema.Boolean;
|
|
16
16
|
stableSessionIds: Schema.Literal<[true]>;
|
|
17
17
|
exactSameSessionContinuation: Schema.Literal<[true]>;
|
|
@@ -19,7 +19,7 @@ export declare const WorkflowHarnessContinuationSupportSchema: Schema.Union<[Sch
|
|
|
19
19
|
continueCommand: typeof Schema.NonEmptyTrimmedString;
|
|
20
20
|
capture: typeof Schema.NonEmptyTrimmedString;
|
|
21
21
|
}>, Schema.Struct<{
|
|
22
|
-
adapter: Schema.Literal<["amp-code", "antigravity-cli", "claude-code", "codex-cli", "grok-cli", "hermes", "kimi-code", "opencode-cli"]>;
|
|
22
|
+
adapter: Schema.Literal<["amp-code", "antigravity-cli", "claude-code", "codex-cli", "devin", "grok-cli", "hermes", "kimi-code", "opencode-cli", "omp-cli"]>;
|
|
23
23
|
workflowWorker: typeof Schema.Boolean;
|
|
24
24
|
stableSessionIds: Schema.Literal<[false]>;
|
|
25
25
|
exactSameSessionContinuation: Schema.Literal<[false]>;
|
|
@@ -32,10 +32,12 @@ export declare const workflowContinuationAdapterByWorker: {
|
|
|
32
32
|
readonly "antigravity-cli": "antigravity-cli";
|
|
33
33
|
readonly "claude-code": "claude-code";
|
|
34
34
|
readonly "codex-cli": "codex-cli";
|
|
35
|
+
readonly devin: "devin";
|
|
35
36
|
readonly grok: "grok-cli";
|
|
36
37
|
readonly hermes: "hermes";
|
|
37
38
|
readonly "kimi-code": "kimi-code";
|
|
38
39
|
readonly opencode: "opencode-cli";
|
|
40
|
+
readonly omp: "omp-cli";
|
|
39
41
|
};
|
|
40
42
|
export type WorkflowRepairLoopContinuationWorkerId = keyof typeof workflowContinuationAdapterByWorker;
|
|
41
43
|
export type WorkflowRepairLoopContinuationCapability = "stable-session-repair-loop" | "no-repair-loop-continuation";
|
|
@@ -104,6 +106,15 @@ export declare const workflowHarnessContinuationSupport: {
|
|
|
104
106
|
readonly continueCommand: "kimi --session <sessionId> --prompt <prompt>";
|
|
105
107
|
readonly capture: "stream-json session.resume_hint.session_id or session index recovery";
|
|
106
108
|
};
|
|
109
|
+
readonly devin: {
|
|
110
|
+
readonly adapter: "devin";
|
|
111
|
+
readonly workflowWorker: true;
|
|
112
|
+
readonly stableSessionIds: true;
|
|
113
|
+
readonly exactSameSessionContinuation: true;
|
|
114
|
+
readonly sessionIdField: "sessionId";
|
|
115
|
+
readonly continueCommand: "devin -p -r <sessionId> --prompt-file <prompt>";
|
|
116
|
+
readonly capture: "ATIF export session_id via --export";
|
|
117
|
+
};
|
|
107
118
|
readonly "opencode-cli": {
|
|
108
119
|
readonly adapter: "opencode-cli";
|
|
109
120
|
readonly workflowWorker: true;
|
|
@@ -113,6 +124,15 @@ export declare const workflowHarnessContinuationSupport: {
|
|
|
113
124
|
readonly continueCommand: "opencode run -s <sessionId> <prompt>";
|
|
114
125
|
readonly capture: "json step_start sessionID, session list, export, database, or log recovery";
|
|
115
126
|
};
|
|
127
|
+
readonly "omp-cli": {
|
|
128
|
+
readonly adapter: "omp-cli";
|
|
129
|
+
readonly workflowWorker: true;
|
|
130
|
+
readonly stableSessionIds: true;
|
|
131
|
+
readonly exactSameSessionContinuation: true;
|
|
132
|
+
readonly sessionIdField: "sessionId";
|
|
133
|
+
readonly continueCommand: "omp --mode json --resume <sessionId> -- <prompt>";
|
|
134
|
+
readonly capture: "json session event id";
|
|
135
|
+
};
|
|
116
136
|
};
|
|
117
137
|
export declare const stableSessionIdFromUnknown: (value: unknown) => StableSessionId | undefined;
|
|
118
138
|
export declare const workflowContinuationAdapterForWorker: (worker: string) => WorkflowContinuationAdapterId | undefined;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { type WorkflowRetentionCleanupReport, type WorkflowRunArtifactCounts, type WorkflowRunDeletionReport } from "./workflow-data-governance.js";
|
|
1
2
|
import type { WorkflowJudgeVerdict } from "./workflows.js";
|
|
2
3
|
import type { WorkflowJudgeIdentity, WorkflowRunTaskSnapshot, WorkflowTaskIdentity } from "./workflow-identity.js";
|
|
3
4
|
export { workflowRunTaskSnapshotForTask, workflowTaskIdentity, type WorkflowJudgeIdentity, type WorkflowRunTaskSnapshot, type WorkflowTaskIdentity } from "./workflow-identity.js";
|
|
4
5
|
import { type WorkflowDatabase } from "./workflow-runtime.js";
|
|
6
|
+
import type { WorkflowSpanRecord } from "./workflow-tracing.js";
|
|
7
|
+
import { type WorkflowUsage, type WorkflowUsageTotals } from "./workflow-usage.js";
|
|
5
8
|
export type WorkflowTaskOutputSource = "mock-output";
|
|
6
9
|
export interface CompletedWorkflowTaskRecord {
|
|
7
10
|
readonly identity: WorkflowTaskIdentity;
|
|
@@ -30,6 +33,14 @@ export interface WorkflowJudgeRecord {
|
|
|
30
33
|
readonly createdAt: string;
|
|
31
34
|
readonly updatedAt: string;
|
|
32
35
|
}
|
|
36
|
+
export type WorkflowCacheWriteResult = {
|
|
37
|
+
readonly stored: true;
|
|
38
|
+
} | {
|
|
39
|
+
readonly stored: false;
|
|
40
|
+
readonly reason: "sensitive-data";
|
|
41
|
+
readonly findingCount: number;
|
|
42
|
+
readonly findingPaths: ReadonlyArray<string>;
|
|
43
|
+
};
|
|
33
44
|
export type WorkflowRunTaskStatus = "completed" | "failed" | "escalated";
|
|
34
45
|
export interface WorkflowRunTaskRecord {
|
|
35
46
|
readonly runId: string;
|
|
@@ -45,7 +56,7 @@ export interface WorkflowRunTaskRecord {
|
|
|
45
56
|
readonly output: unknown;
|
|
46
57
|
readonly metadata?: Record<string, unknown>;
|
|
47
58
|
}
|
|
48
|
-
export type WorkflowRunTaskProgressStatus = "running" | "completed" | "failed" | "escalated";
|
|
59
|
+
export type WorkflowRunTaskProgressStatus = "running" | "completed" | "failed" | "escalated" | "stopped" | "crashed";
|
|
49
60
|
export type WorkflowRunTaskCacheLookup = "hit" | "miss" | "skipped";
|
|
50
61
|
export interface WorkflowRunTaskProgress {
|
|
51
62
|
readonly ordinal?: number;
|
|
@@ -85,6 +96,7 @@ export interface WorkflowRunTaskCompactSummary {
|
|
|
85
96
|
readonly externalSessionPointer: string | null;
|
|
86
97
|
readonly lastEventType?: string;
|
|
87
98
|
readonly lastEventAt?: string;
|
|
99
|
+
readonly attempts: ReadonlyArray<WorkflowTaskAttemptRecord>;
|
|
88
100
|
}
|
|
89
101
|
export interface WorkflowRunSnapshot {
|
|
90
102
|
readonly runId: string;
|
|
@@ -130,18 +142,77 @@ export interface WorkflowRunCompactSummary {
|
|
|
130
142
|
readonly repairs: number;
|
|
131
143
|
readonly status: WorkflowRunStatus;
|
|
132
144
|
readonly durationMs: number | null;
|
|
145
|
+
readonly usage: WorkflowUsageTotals;
|
|
133
146
|
};
|
|
134
147
|
readonly tasks: WorkflowRunTaskCompactSummary[];
|
|
135
148
|
}
|
|
149
|
+
export type WorkflowRunCompletedCause = {
|
|
150
|
+
readonly kind: "completed";
|
|
151
|
+
};
|
|
152
|
+
export type WorkflowRunTaskFailureCause = {
|
|
153
|
+
readonly kind: "task-failed" | "task-escalated";
|
|
154
|
+
readonly taskId: string;
|
|
155
|
+
readonly ordinal: number;
|
|
156
|
+
readonly attempt: number;
|
|
157
|
+
readonly errorName: string;
|
|
158
|
+
readonly message: string;
|
|
159
|
+
};
|
|
160
|
+
export type WorkflowRunFailureCause = {
|
|
161
|
+
readonly kind: "workflow-failed";
|
|
162
|
+
readonly errorName: string;
|
|
163
|
+
readonly message: string;
|
|
164
|
+
};
|
|
165
|
+
export type WorkflowRunStoppedCause = {
|
|
166
|
+
readonly kind: "stopped";
|
|
167
|
+
readonly reason: string;
|
|
168
|
+
readonly signal?: string;
|
|
169
|
+
};
|
|
170
|
+
export type WorkflowRunCrashedCause = {
|
|
171
|
+
readonly kind: "crashed";
|
|
172
|
+
readonly reason: string;
|
|
173
|
+
readonly runnerPid?: number;
|
|
174
|
+
readonly heartbeatAt?: string;
|
|
175
|
+
};
|
|
176
|
+
export type WorkflowRunTimeoutCause = {
|
|
177
|
+
readonly kind: "workflow-timeout";
|
|
178
|
+
readonly limitMs: number;
|
|
179
|
+
};
|
|
180
|
+
export type WorkflowRunFanoutExceededCause = {
|
|
181
|
+
readonly kind: "workflow-fanout-exceeded";
|
|
182
|
+
readonly limit: number;
|
|
183
|
+
readonly observed: number;
|
|
184
|
+
};
|
|
185
|
+
export type WorkflowRunCostExceededCause = {
|
|
186
|
+
readonly kind: "workflow-cost-exceeded";
|
|
187
|
+
readonly limitUsd: number;
|
|
188
|
+
readonly observedUsd: number;
|
|
189
|
+
};
|
|
190
|
+
export type WorkflowRunCostUnavailableCause = {
|
|
191
|
+
readonly kind: "workflow-cost-unavailable";
|
|
192
|
+
readonly limitUsd: number;
|
|
193
|
+
};
|
|
194
|
+
export type WorkflowRunPromptLimitCause = {
|
|
195
|
+
readonly kind: "workflow-prompt-limit-exceeded";
|
|
196
|
+
readonly taskId: string;
|
|
197
|
+
readonly limitBytes: number;
|
|
198
|
+
readonly observedBytes: number;
|
|
199
|
+
};
|
|
200
|
+
export type WorkflowRunTerminalCause = WorkflowRunCompletedCause | WorkflowRunTaskFailureCause | WorkflowRunFailureCause | WorkflowRunStoppedCause | WorkflowRunCrashedCause | WorkflowRunTimeoutCause | WorkflowRunFanoutExceededCause | WorkflowRunCostExceededCause | WorkflowRunCostUnavailableCause | WorkflowRunPromptLimitCause;
|
|
136
201
|
export interface WorkflowRunRecord {
|
|
137
202
|
readonly runId: string;
|
|
138
203
|
readonly workflow: string;
|
|
139
204
|
readonly status: WorkflowRunStatus;
|
|
205
|
+
readonly terminalCause: WorkflowRunTerminalCause | null;
|
|
140
206
|
readonly finishedAt: string | null;
|
|
141
207
|
readonly runnerPid?: number;
|
|
142
208
|
readonly heartbeatAt?: string;
|
|
209
|
+
readonly liveness: WorkflowRunLiveness;
|
|
210
|
+
readonly createdAt?: string;
|
|
211
|
+
readonly usage: WorkflowUsageTotals;
|
|
143
212
|
}
|
|
144
|
-
export type
|
|
213
|
+
export type WorkflowRunLiveness = "alive" | "stale" | "unknown";
|
|
214
|
+
export declare const WORKFLOW_RUN_LIVENESS_STALE_AFTER_MS = 10000;
|
|
215
|
+
export type WorkflowRunStatus = "running" | "completed" | "failed" | "escalated" | "stopped" | "crashed" | "unknown";
|
|
145
216
|
/**
|
|
146
217
|
* A run's persisted status can read "completed" while carrying isolated task failures: the
|
|
147
218
|
* dynamic runtime's fault-isolation contract (PQ-166) lets an author's `run` program finish
|
|
@@ -159,13 +230,124 @@ export interface WorkflowEventRecord {
|
|
|
159
230
|
readonly payload: unknown;
|
|
160
231
|
readonly createdAt: string;
|
|
161
232
|
}
|
|
233
|
+
export interface WorkflowRunInspection {
|
|
234
|
+
readonly schema: "prism.workflow-run-inspection.v1";
|
|
235
|
+
readonly dataPolicyVersion: number;
|
|
236
|
+
readonly store: {
|
|
237
|
+
readonly path: string;
|
|
238
|
+
readonly schemaVersion: number;
|
|
239
|
+
readonly files: ReadonlyArray<{
|
|
240
|
+
readonly path: string;
|
|
241
|
+
readonly present: boolean;
|
|
242
|
+
readonly mode: number | null;
|
|
243
|
+
readonly bytes: number | null;
|
|
244
|
+
}>;
|
|
245
|
+
};
|
|
246
|
+
readonly run: WorkflowRunRecord;
|
|
247
|
+
readonly rows: WorkflowRunArtifactCounts;
|
|
248
|
+
readonly runnerLog: {
|
|
249
|
+
readonly path: string | null;
|
|
250
|
+
readonly present: boolean;
|
|
251
|
+
readonly bytes: number | null;
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
export interface WorkflowRunExport {
|
|
255
|
+
readonly schema: "prism.workflow-run-export.v1";
|
|
256
|
+
readonly dataPolicyVersion: number;
|
|
257
|
+
readonly exportedAt: string;
|
|
258
|
+
readonly run: WorkflowRunRecord;
|
|
259
|
+
readonly snapshot: WorkflowRunSnapshot | null;
|
|
260
|
+
readonly tasks: ReadonlyArray<WorkflowRunTaskRecord>;
|
|
261
|
+
readonly taskSnapshots: ReadonlyArray<WorkflowRunTaskSnapshot>;
|
|
262
|
+
readonly attempts: ReadonlyArray<WorkflowTaskAttemptRecord>;
|
|
263
|
+
readonly events: ReadonlyArray<WorkflowEventRecord>;
|
|
264
|
+
readonly spans: ReadonlyArray<Omit<WorkflowSpanRecord, "startNs" | "endNs"> & {
|
|
265
|
+
readonly startNs: string;
|
|
266
|
+
readonly endNs: string | null;
|
|
267
|
+
}>;
|
|
268
|
+
readonly runnerLog: {
|
|
269
|
+
readonly path: string;
|
|
270
|
+
readonly bytes: number;
|
|
271
|
+
readonly content: string;
|
|
272
|
+
} | null;
|
|
273
|
+
}
|
|
274
|
+
export type WorkflowTaskAttemptStatus = "running" | "completed" | "failed" | "stopped" | "crashed";
|
|
275
|
+
export type WorkflowTaskAttemptFailureKind = "executor" | "decode" | "finish" | "stopped" | "crashed";
|
|
276
|
+
export interface WorkflowTaskAttemptFailure {
|
|
277
|
+
readonly kind: WorkflowTaskAttemptFailureKind;
|
|
278
|
+
readonly message: string;
|
|
279
|
+
}
|
|
280
|
+
export interface WorkflowTaskAttemptStartedInput {
|
|
281
|
+
readonly runId: string;
|
|
282
|
+
readonly ordinal: number;
|
|
283
|
+
readonly attempt: number;
|
|
284
|
+
readonly taskId: string;
|
|
285
|
+
readonly metadata?: Record<string, unknown>;
|
|
286
|
+
}
|
|
287
|
+
export interface WorkflowTaskAttemptFinishedInput {
|
|
288
|
+
readonly runId: string;
|
|
289
|
+
readonly ordinal: number;
|
|
290
|
+
readonly attempt: number;
|
|
291
|
+
readonly status: Exclude<WorkflowTaskAttemptStatus, "running">;
|
|
292
|
+
readonly metadata?: Record<string, unknown>;
|
|
293
|
+
readonly failure?: WorkflowTaskAttemptFailure;
|
|
294
|
+
}
|
|
295
|
+
export interface WorkflowTaskAttemptRecord {
|
|
296
|
+
readonly runId: string;
|
|
297
|
+
readonly ordinal: number;
|
|
298
|
+
readonly attempt: number;
|
|
299
|
+
readonly taskId: string;
|
|
300
|
+
readonly status: WorkflowTaskAttemptStatus;
|
|
301
|
+
readonly startedAt: string;
|
|
302
|
+
readonly finishedAt: string | null;
|
|
303
|
+
readonly adapter?: string;
|
|
304
|
+
readonly model?: string;
|
|
305
|
+
readonly nativeAgent?: string;
|
|
306
|
+
readonly sessionId?: string;
|
|
307
|
+
readonly failure?: WorkflowTaskAttemptFailure;
|
|
308
|
+
readonly usage?: WorkflowUsage;
|
|
309
|
+
readonly metadata?: Record<string, unknown>;
|
|
310
|
+
}
|
|
162
311
|
export declare const projectWorkflowStoreDir: (prismHome: string, cwd?: string) => string;
|
|
163
312
|
export declare const defaultWorkflowStorePath: (prismHome: string, cwd?: string) => string;
|
|
313
|
+
export declare const WORKFLOW_STORE_SCHEMA_VERSION = 5;
|
|
314
|
+
/**
|
|
315
|
+
* Surfaces the one-time soft-divergence direction (WFE-007): a pre-existing store opened at a
|
|
316
|
+
* schema version older than the binary's `WORKFLOW_STORE_SCHEMA_VERSION` migrates in place inside
|
|
317
|
+
* `WorkflowStore.open`, silently by design, but callers reporting on the store (`runs list`,
|
|
318
|
+
* `runs show`) surface that a migration just ran. The other direction — a store newer than this
|
|
319
|
+
* binary supports — is not migratable and is already a hard error in `open`. Never populated for
|
|
320
|
+
* a brand-new store (nothing to diverge from).
|
|
321
|
+
*/
|
|
322
|
+
export interface WorkflowStoreSchemaNotice {
|
|
323
|
+
readonly severity: "info";
|
|
324
|
+
readonly openedVersion: number;
|
|
325
|
+
readonly currentVersion: number;
|
|
326
|
+
readonly message: string;
|
|
327
|
+
}
|
|
328
|
+
export declare const workflowRunLiveness: (run: Pick<WorkflowRunRecord, "status" | "runnerPid" | "heartbeatAt">, nowMs?: number) => WorkflowRunLiveness;
|
|
164
329
|
export declare class WorkflowStore {
|
|
165
330
|
private readonly db;
|
|
166
|
-
|
|
167
|
-
|
|
331
|
+
readonly path: string;
|
|
332
|
+
readonly schemaNotice: WorkflowStoreSchemaNotice | null;
|
|
333
|
+
initialRetentionCleanup: WorkflowRetentionCleanupReport | null;
|
|
334
|
+
constructor(db: WorkflowDatabase, path: string, schemaNotice?: WorkflowStoreSchemaNotice | null);
|
|
335
|
+
private updateRunUsageInCurrentTransaction;
|
|
336
|
+
static open(path: string, options?: {
|
|
337
|
+
readonly applyDefaultRetention?: boolean;
|
|
338
|
+
}): Promise<WorkflowStore>;
|
|
168
339
|
close(): void;
|
|
340
|
+
private countRunArtifacts;
|
|
341
|
+
private deleteRunRowsInCurrentTransaction;
|
|
342
|
+
private removeQueuedRunnerLog;
|
|
343
|
+
private flushQueuedRunnerLogCleanup;
|
|
344
|
+
inspectRun(runId: string): Promise<WorkflowRunInspection>;
|
|
345
|
+
exportRun(runId: string): Promise<WorkflowRunExport>;
|
|
346
|
+
deleteRun(runId: string): Promise<WorkflowRunDeletionReport>;
|
|
347
|
+
pruneByAge(options?: {
|
|
348
|
+
readonly olderThanMs?: number;
|
|
349
|
+
readonly now?: Date;
|
|
350
|
+
}): Promise<WorkflowRetentionCleanupReport>;
|
|
169
351
|
getCompleted(identity: WorkflowTaskIdentity, options?: {
|
|
170
352
|
readonly allowMockSourced?: boolean;
|
|
171
353
|
}): CompletedWorkflowTaskRecord | null;
|
|
@@ -176,7 +358,7 @@ export declare class WorkflowStore {
|
|
|
176
358
|
readonly evidence: unknown;
|
|
177
359
|
readonly output: unknown;
|
|
178
360
|
readonly taskMetadata: unknown;
|
|
179
|
-
}):
|
|
361
|
+
}): WorkflowCacheWriteResult;
|
|
180
362
|
listJudgeRecords(options?: {
|
|
181
363
|
readonly workflow?: string;
|
|
182
364
|
readonly taskId?: string;
|
|
@@ -202,7 +384,11 @@ export declare class WorkflowStore {
|
|
|
202
384
|
consumeRunHandoffToken(runId: string, token: string): boolean;
|
|
203
385
|
markRunRunnerStarted(runId: string, runnerPid: number): void;
|
|
204
386
|
heartbeatRun(runId: string): void;
|
|
205
|
-
|
|
387
|
+
recordTaskAttemptStarted(input: WorkflowTaskAttemptStartedInput): void;
|
|
388
|
+
recordTaskAttemptFinished(input: WorkflowTaskAttemptFinishedInput): void;
|
|
389
|
+
listRunTaskAttempts(runId: string): WorkflowTaskAttemptRecord[];
|
|
390
|
+
private finishRunInCurrentTransaction;
|
|
391
|
+
finishRun(runId: string, status: Exclude<WorkflowRunStatus, "running" | "unknown">, terminalCause?: WorkflowRunTerminalCause): void;
|
|
206
392
|
stopRun(runId: string, reason?: string): WorkflowRunRecord | null;
|
|
207
393
|
stopRunningRun(runId: string, reason?: string): WorkflowRunRecord | null;
|
|
208
394
|
restartRunningRun(input: {
|
|
@@ -220,6 +406,15 @@ export declare class WorkflowStore {
|
|
|
220
406
|
readonly type: string;
|
|
221
407
|
readonly payload: unknown;
|
|
222
408
|
}): void;
|
|
409
|
+
recordSpanStart(span: WorkflowSpanRecord): void;
|
|
410
|
+
recordSpanEnd(input: {
|
|
411
|
+
readonly spanId: string;
|
|
412
|
+
readonly endNs: bigint;
|
|
413
|
+
readonly status: "ok" | "error";
|
|
414
|
+
readonly errorMessage: string | null;
|
|
415
|
+
readonly attributes: Record<string, unknown>;
|
|
416
|
+
}): void;
|
|
417
|
+
listSpans(runId: string): WorkflowSpanRecord[];
|
|
223
418
|
listRunEvents(runId: string): WorkflowEventRecord[];
|
|
224
419
|
failDeadPidRuns(): WorkflowRunRecord[];
|
|
225
420
|
failStaleRuns(olderThanMs: number, now?: Date): WorkflowRunRecord[];
|
|
@@ -252,5 +447,5 @@ export declare class WorkflowStore {
|
|
|
252
447
|
readonly output: unknown;
|
|
253
448
|
readonly metadata?: Record<string, unknown>;
|
|
254
449
|
readonly outputSource?: WorkflowTaskOutputSource;
|
|
255
|
-
}):
|
|
450
|
+
}): WorkflowCacheWriteResult;
|
|
256
451
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Tracer } from "effect";
|
|
2
|
+
import type { WorkflowStore } from "./workflow-store.js";
|
|
3
|
+
export type WorkflowSpanStatus = "ok" | "error" | "unset";
|
|
4
|
+
/** One row in `workflow_spans` — the sqlite-native span shape shared by the engine, the Effect tracer bridge, and the CLI trace renderer. */
|
|
5
|
+
export interface WorkflowSpanRecord {
|
|
6
|
+
readonly runId: string;
|
|
7
|
+
readonly traceId: string;
|
|
8
|
+
readonly spanId: string;
|
|
9
|
+
readonly parentSpanId: string | null;
|
|
10
|
+
readonly taskId: string | null;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly kind: string;
|
|
13
|
+
readonly startNs: bigint;
|
|
14
|
+
readonly endNs: bigint | null;
|
|
15
|
+
readonly status: WorkflowSpanStatus;
|
|
16
|
+
readonly errorMessage: string | null;
|
|
17
|
+
readonly attributes: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
export declare const generateWorkflowTraceId: () => string;
|
|
20
|
+
export declare const generateWorkflowSpanId: () => string;
|
|
21
|
+
export declare const currentTimeNanos: () => bigint;
|
|
22
|
+
export interface WorkflowSpanStartInput {
|
|
23
|
+
readonly traceId: string;
|
|
24
|
+
readonly spanId: string;
|
|
25
|
+
readonly parentSpanId: string | null;
|
|
26
|
+
readonly taskId: string | null;
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly kind: string;
|
|
29
|
+
readonly startNs: bigint;
|
|
30
|
+
}
|
|
31
|
+
export interface WorkflowSpanEndInput {
|
|
32
|
+
readonly spanId: string;
|
|
33
|
+
readonly endNs: bigint;
|
|
34
|
+
readonly status: Exclude<WorkflowSpanStatus, "unset">;
|
|
35
|
+
readonly errorMessage: string | null;
|
|
36
|
+
readonly attributes: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
export interface WorkflowSpanHandle {
|
|
39
|
+
readonly spanId: string;
|
|
40
|
+
readonly traceId: string;
|
|
41
|
+
annotate(key: string, value: unknown): void;
|
|
42
|
+
end(status: Exclude<WorkflowSpanStatus, "unset">, error?: unknown): void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The per-run span sink. Spans are written to the run's own sqlite store
|
|
46
|
+
* (start row on open, end update on close) so a killed run still shows its
|
|
47
|
+
* partial trace, and a running run is traceable live. When the run is not
|
|
48
|
+
* persisted (no store / null runId) every operation is a no-op.
|
|
49
|
+
*/
|
|
50
|
+
export interface WorkflowTraceRecorder {
|
|
51
|
+
readonly enabled: boolean;
|
|
52
|
+
readonly traceId: string;
|
|
53
|
+
recordSpanStart(input: WorkflowSpanStartInput): void;
|
|
54
|
+
recordSpanEnd(input: WorkflowSpanEndInput): void;
|
|
55
|
+
startSpan(name: string, options?: {
|
|
56
|
+
readonly parentSpanId?: string | null;
|
|
57
|
+
readonly taskId?: string | null;
|
|
58
|
+
readonly attributes?: Record<string, unknown>;
|
|
59
|
+
}): WorkflowSpanHandle;
|
|
60
|
+
}
|
|
61
|
+
export declare const createWorkflowTraceRecorder: (input: {
|
|
62
|
+
readonly store?: WorkflowStore;
|
|
63
|
+
readonly runId: string | null;
|
|
64
|
+
readonly traceId?: string;
|
|
65
|
+
}) => WorkflowTraceRecorder;
|
|
66
|
+
export declare const makeWorkflowEffectTracer: (recorder: WorkflowTraceRecorder, options?: {
|
|
67
|
+
readonly defaultParentSpanId?: string;
|
|
68
|
+
}) => Tracer.Tracer;
|
|
69
|
+
export interface WorkflowSpanTreeNode {
|
|
70
|
+
readonly span: WorkflowSpanRecord;
|
|
71
|
+
readonly children: ReadonlyArray<WorkflowSpanTreeNode>;
|
|
72
|
+
}
|
|
73
|
+
/** Spans whose parent is unknown (or absent) become roots; children stay in start order. */
|
|
74
|
+
export declare const buildWorkflowSpanTree: (spans: ReadonlyArray<WorkflowSpanRecord>) => ReadonlyArray<WorkflowSpanTreeNode>;
|
|
75
|
+
export declare const renderWorkflowTraceHuman: (spans: ReadonlyArray<WorkflowSpanRecord>, options?: {
|
|
76
|
+
readonly minDurationMs?: number;
|
|
77
|
+
}) => string;
|
|
78
|
+
/**
|
|
79
|
+
* Serialize span records as an OTLP/HTTP JSON `ExportTraceServiceRequest`,
|
|
80
|
+
* POSTable to any collector's `/v1/traces` endpoint.
|
|
81
|
+
*/
|
|
82
|
+
export declare const workflowSpansToOtlpJson: (spans: ReadonlyArray<WorkflowSpanRecord>, resource: {
|
|
83
|
+
readonly serviceName: string;
|
|
84
|
+
readonly attributes?: Record<string, unknown>;
|
|
85
|
+
}) => unknown;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type WorkflowCostReporting = "full" | "tokens" | "none";
|
|
2
|
+
export interface WorkflowUsage {
|
|
3
|
+
readonly tokensIn?: number;
|
|
4
|
+
readonly tokensOut?: number;
|
|
5
|
+
readonly costUsd?: number;
|
|
6
|
+
readonly durationMs?: number;
|
|
7
|
+
readonly costReporting: WorkflowCostReporting;
|
|
8
|
+
}
|
|
9
|
+
export interface WorkflowUsageTotals {
|
|
10
|
+
readonly agentRuns: number;
|
|
11
|
+
readonly reused: number;
|
|
12
|
+
readonly tokensIn: number;
|
|
13
|
+
readonly tokensOut: number;
|
|
14
|
+
readonly costUsd: number;
|
|
15
|
+
readonly durationMs: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const emptyWorkflowUsageTotals: () => WorkflowUsageTotals;
|
|
18
|
+
/** Normalize provider-specific task metadata into Prism's durable usage contract. */
|
|
19
|
+
export declare const workflowUsageFromMetadata: (metadata: Record<string, unknown> | undefined) => WorkflowUsage;
|
|
20
|
+
export declare const addWorkflowUsage: (totals: WorkflowUsageTotals, usage: WorkflowUsage) => WorkflowUsageTotals;
|
|
21
|
+
export declare const addWorkflowReuse: (totals: WorkflowUsageTotals) => WorkflowUsageTotals;
|
|
@@ -6,3 +6,19 @@ export interface WorkflowWorkerStderrMetadata {
|
|
|
6
6
|
readonly stderrTruncated?: boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare const summarizeWorkflowWorkerStderr: (stderr: string, maxExcerptBytes?: number) => WorkflowWorkerStderrMetadata;
|
|
9
|
+
/**
|
|
10
|
+
* Forensics attached to a worker adapter's thrown error on the failure path (OBS-006).
|
|
11
|
+
* On success, every adapter already returns `{ adapter, ..., sessionId, ...stderr summary }`
|
|
12
|
+
* as its `WorkflowTaskExecution.metadata`. On failure, that same shape was previously
|
|
13
|
+
* discarded entirely — the runner persisted only `{contractVersion, instructionSource}` —
|
|
14
|
+
* so a failed task could not be joined to its harness session or its stderr tail. Adapters
|
|
15
|
+
* attach this to their custom Error's `metadata` property at each failure throw site; the
|
|
16
|
+
* runner merges `error.metadata` into both the `task.executor.failed` event and the
|
|
17
|
+
* persisted task record.
|
|
18
|
+
*/
|
|
19
|
+
export declare const workflowWorkerFailureMetadata: (input: {
|
|
20
|
+
readonly adapter: string;
|
|
21
|
+
readonly stderr: string;
|
|
22
|
+
readonly sessionId?: string;
|
|
23
|
+
readonly maxExcerptBytes?: number;
|
|
24
|
+
}) => Record<string, unknown>;
|
package/types/workflows.d.ts
CHANGED
|
@@ -58,15 +58,27 @@ export interface WorkflowValidationSummary {
|
|
|
58
58
|
}
|
|
59
59
|
export type WorkflowOutputSchema = Schema.Schema.AnyNoContext;
|
|
60
60
|
export type WorkflowFinishCriterionError = Error;
|
|
61
|
-
export type WorkflowWorkerId = "amp-code" | "antigravity-cli" | "claude-code" | "codex-cli" | "grok" | "hermes" | "kimi-code" | "opencode";
|
|
61
|
+
export type WorkflowWorkerId = "amp-code" | "antigravity-cli" | "claude-code" | "codex-cli" | "devin" | "grok" | "hermes" | "kimi-code" | "opencode" | "omp";
|
|
62
62
|
export type WorkflowPermissionMode = "legacy" | "permissive" | "restricted" | "interactive" | "sandbox-read-only" | "sandbox-workspace-write" | "full-access";
|
|
63
63
|
export type AntigravityWorkflowPermissionMode = Extract<WorkflowPermissionMode, "legacy" | "permissive" | "full-access">;
|
|
64
|
+
/**
|
|
65
|
+
* Per-task override for the executor-level transient-failure retry (WFE-009). Only
|
|
66
|
+
* classified-transient executor failures (process/idle timeout, unclassified non-zero
|
|
67
|
+
* exit) are retried; config/load errors and cancellation-barrier outcomes never are.
|
|
68
|
+
* `maxAttempts` counts total attempts (default 2, i.e. one retry) — the same convention
|
|
69
|
+
* as the shipped `agy` adapter's own `maxAttempts` option.
|
|
70
|
+
*/
|
|
71
|
+
export interface WorkflowTaskWorkerRetryOptions {
|
|
72
|
+
readonly maxAttempts?: number;
|
|
73
|
+
readonly backoffMs?: number;
|
|
74
|
+
}
|
|
64
75
|
type WorkflowTaskWorkerOptionsBase = {
|
|
65
76
|
readonly model?: string | WorkflowModelProfileRef;
|
|
66
77
|
readonly modelResolver?: (models: WorkflowResolvedModelTarget) => string;
|
|
67
78
|
readonly profile?: string;
|
|
68
79
|
readonly restrictedTools?: ReadonlyArray<string>;
|
|
69
80
|
readonly processTimeoutMs?: number;
|
|
81
|
+
readonly retry?: WorkflowTaskWorkerRetryOptions;
|
|
70
82
|
};
|
|
71
83
|
export type WorkflowTaskWorkerOptions = (WorkflowTaskWorkerOptionsBase & {
|
|
72
84
|
readonly worker?: Exclude<WorkflowWorkerId, "antigravity-cli">;
|
|
@@ -87,6 +99,8 @@ export interface WorkflowTaskModelResolution {
|
|
|
87
99
|
readonly model: string;
|
|
88
100
|
/** Harness-side inference provider (e.g. hermes `--provider xai-oauth`), from the modelspace target or harness default. */
|
|
89
101
|
readonly provider?: string;
|
|
102
|
+
/** Harness-bound model variant, such as Codex reasoning effort. */
|
|
103
|
+
readonly variant?: string;
|
|
90
104
|
readonly source: WorkflowTaskModelResolutionSource;
|
|
91
105
|
}
|
|
92
106
|
export declare const resolveWorkflowTaskModelResolution: (task: AnyWorkflowTask, options?: {
|
|
@@ -151,8 +165,15 @@ export interface WorkflowJudgeFinishCriterion<Output, Evidence = unknown> {
|
|
|
151
165
|
readonly evaluate: (context: WorkflowJudgeCriterionContext<Output, Evidence>) => Effect.Effect<WorkflowJudgeVerdict, WorkflowFinishCriterionError>;
|
|
152
166
|
}
|
|
153
167
|
export type WorkflowFinishCriterion<Output> = WorkflowDeterministicFinishCriterion<Output> | WorkflowJudgeFinishCriterion<Output>;
|
|
168
|
+
export declare const DEFAULT_WORKFLOW_DECODE_REPAIRS = 2;
|
|
154
169
|
export interface WorkflowFinishOptions<Output> {
|
|
170
|
+
/** Maximum repairs requested by deterministic or judge finish criteria. Defaults to zero. */
|
|
155
171
|
readonly maxRepairs?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Maximum repairs after JSON parse or output schema decode failures.
|
|
174
|
+
* Defaults to DEFAULT_WORKFLOW_DECODE_REPAIRS.
|
|
175
|
+
*/
|
|
176
|
+
readonly maxDecodeRepairs?: number;
|
|
156
177
|
readonly criteria?: ReadonlyArray<WorkflowFinishCriterion<Output>>;
|
|
157
178
|
}
|
|
158
179
|
export interface WorkflowTaskDefinition<Id extends string, Agent extends WorkflowAgentRef, Output extends WorkflowOutputSchema> {
|
|
@@ -177,8 +198,43 @@ export interface WorkflowDefinition<Name extends string, Tasks extends ReadonlyA
|
|
|
177
198
|
readonly name: Name;
|
|
178
199
|
readonly tasks: Tasks;
|
|
179
200
|
}
|
|
201
|
+
export interface PhaseFraming {
|
|
202
|
+
readonly telos?: string;
|
|
203
|
+
readonly when?: string;
|
|
204
|
+
readonly coordination?: string;
|
|
205
|
+
readonly escalation?: string;
|
|
206
|
+
}
|
|
207
|
+
export interface PhaseContract<Name extends string, Agents extends Readonly<Record<string, WorkflowAgentRef>>, Output extends WorkflowOutputSchema> {
|
|
208
|
+
readonly name: Name;
|
|
209
|
+
readonly orbit: string;
|
|
210
|
+
readonly plugin: string;
|
|
211
|
+
readonly agents: Agents;
|
|
212
|
+
readonly output: Output;
|
|
213
|
+
readonly criteria?: readonly string[];
|
|
214
|
+
readonly framing?: PhaseFraming;
|
|
215
|
+
}
|
|
216
|
+
export type PhaseTaskFinishOptions<Output> = WorkflowFinishOptions<Output> & {
|
|
217
|
+
readonly inherit?: boolean;
|
|
218
|
+
};
|
|
219
|
+
export type PhaseTaskDefinition<Id extends string, Agent extends WorkflowAgentRef, Output extends WorkflowOutputSchema = WorkflowOutputSchema> = Omit<WorkflowTaskDefinition<Id, Agent, Output>, "output" | "phase" | "finish"> & {
|
|
220
|
+
readonly output?: Output;
|
|
221
|
+
readonly phase?: string;
|
|
222
|
+
readonly finish?: PhaseTaskFinishOptions<Schema.Schema.Type<Output>>;
|
|
223
|
+
readonly brief?: boolean;
|
|
224
|
+
};
|
|
225
|
+
export type PhaseCtxTask<Agents extends Readonly<Record<string, WorkflowAgentRef>>, DefaultOutput extends WorkflowOutputSchema> = <const Id extends string, const Agent extends Agents[keyof Agents], const TaskOutput extends WorkflowOutputSchema = DefaultOutput>(def: PhaseTaskDefinition<Id, Agent, TaskOutput>) => Effect.Effect<WorkflowTaskOutput<WorkflowTask<Id, Agent, TaskOutput>>, WorkflowRuntimeError>;
|
|
226
|
+
export interface PhaseCtx<Name extends string, Agents extends Readonly<Record<string, WorkflowAgentRef>>, DefaultOutput extends WorkflowOutputSchema> {
|
|
227
|
+
readonly name: Name;
|
|
228
|
+
readonly orbit: string;
|
|
229
|
+
readonly plugin: string;
|
|
230
|
+
readonly agents: Agents;
|
|
231
|
+
readonly phase: string;
|
|
232
|
+
readonly task: PhaseCtxTask<Agents, DefaultOutput>;
|
|
233
|
+
}
|
|
234
|
+
export declare const phase: <const Name extends string, const Agents extends Readonly<Record<string, WorkflowAgentRef>>, const Output extends WorkflowOutputSchema, Result, Err = WorkflowRuntimeError>(runtime: Pick<WorkflowRuntime, "runTask">, contract: PhaseContract<Name, Agents, Output>, fn: (ctx: PhaseCtx<Name, Agents, Output>) => Effect.Effect<Result, Err, never>) => Effect.Effect<Result, Err | WorkflowRuntimeError, never>;
|
|
180
235
|
export interface WorkflowRuntime {
|
|
181
236
|
runTask: <Task extends AnyWorkflowTask>(task: Task) => Effect.Effect<WorkflowTaskOutput<Task>, WorkflowRuntimeError>;
|
|
237
|
+
phase: <const Name extends string, const Agents extends Readonly<Record<string, WorkflowAgentRef>>, const Output extends WorkflowOutputSchema, Result, Err = WorkflowRuntimeError>(contract: PhaseContract<Name, Agents, Output>, fn: (ctx: PhaseCtx<Name, Agents, Output>) => Effect.Effect<Result, Err, never>) => Effect.Effect<Result, Err | WorkflowRuntimeError, never>;
|
|
182
238
|
}
|
|
183
239
|
export interface WorkflowRuntimeOptions {
|
|
184
240
|
readonly fallbackWorker?: string;
|