@skastr0/prism-darwin-x64 0.3.3 → 0.3.5
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 -4
- package/types/lowerer-capabilities.d.ts +45 -1
- package/types/types.d.ts +2 -1
- package/types/workflow-session.d.ts +15 -5
- package/types/workflow-store.d.ts +11 -0
- package/types/workflow-tracing.d.ts +85 -0
- package/types/workflows.d.ts +36 -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.
|
|
3
|
+
"version": "0.3.5",
|
|
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.3.
|
|
23
|
+
"@skastr0/prism-sdk": "0.3.5",
|
|
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>;
|
|
@@ -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";
|
|
@@ -577,6 +581,46 @@ export declare const LOWERER_CAPABILITIES: {
|
|
|
577
581
|
};
|
|
578
582
|
};
|
|
579
583
|
};
|
|
584
|
+
readonly devin: {
|
|
585
|
+
readonly harness: "devin";
|
|
586
|
+
readonly family: "coding-harness";
|
|
587
|
+
readonly workflowWorker: true;
|
|
588
|
+
readonly compile: {
|
|
589
|
+
readonly agents: "unsupported";
|
|
590
|
+
readonly agentModelBindings: "ignored";
|
|
591
|
+
readonly generatedCanonicalTools: "unsupported";
|
|
592
|
+
readonly hooks: "supported";
|
|
593
|
+
readonly skillPermissions: "unsupported";
|
|
594
|
+
};
|
|
595
|
+
readonly surfaces: {
|
|
596
|
+
readonly pluginBundle: LowererSurfaceCapability;
|
|
597
|
+
readonly rules: {
|
|
598
|
+
readonly kind: "direct-file";
|
|
599
|
+
readonly path: "<devin-root>/AGENTS.md";
|
|
600
|
+
readonly summary: "Install appends managed sections to the native AGENTS.md instructions file.";
|
|
601
|
+
};
|
|
602
|
+
readonly commands: LowererSurfaceCapability;
|
|
603
|
+
readonly agents: LowererSurfaceCapability;
|
|
604
|
+
readonly skills: {
|
|
605
|
+
readonly kind: "direct-file";
|
|
606
|
+
readonly path: "<devin-root>/skills/";
|
|
607
|
+
readonly summary: "Install and compile write Agent Skill folders (global and project .devin/skills).";
|
|
608
|
+
};
|
|
609
|
+
readonly generatedTools: LowererSurfaceCapability;
|
|
610
|
+
readonly hooks: {
|
|
611
|
+
readonly kind: "direct-file";
|
|
612
|
+
readonly path: "project: hooks.v1.json; global: config.json#hooks json-array-member + hooks/*.mjs";
|
|
613
|
+
readonly summary: "Project scope writes hooks.v1.json; global scope upserts Prism entries into config.json hooks without whole-file adopt. Wrappers under hooks/.";
|
|
614
|
+
};
|
|
615
|
+
readonly mcpConfig: LowererSurfaceCapability;
|
|
616
|
+
readonly agentConfig: {
|
|
617
|
+
readonly kind: "direct-file";
|
|
618
|
+
readonly path: "ephemeral --agent-config for workflow runs";
|
|
619
|
+
readonly summary: "Workflow worker writes temporary agent-config (system_instructions, allowed_tools); not a durable install surface.";
|
|
620
|
+
};
|
|
621
|
+
};
|
|
622
|
+
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."];
|
|
623
|
+
};
|
|
580
624
|
};
|
|
581
625
|
export declare const getCompileTargetCapabilities: (harness: string) => CompileTargetCapabilities;
|
|
582
626
|
/**
|
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" | "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 {
|
|
@@ -158,6 +158,7 @@ export interface UnifiedFrontmatter {
|
|
|
158
158
|
"factory-droid"?: FactoryDroidFrontmatter;
|
|
159
159
|
pi?: Record<string, unknown>;
|
|
160
160
|
grok?: Record<string, unknown>;
|
|
161
|
+
devin?: Record<string, unknown>;
|
|
161
162
|
}
|
|
162
163
|
export interface SkillFrontmatter {
|
|
163
164
|
name: string;
|
|
@@ -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"]>;
|
|
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"]>;
|
|
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"]>;
|
|
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"]>;
|
|
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"]>;
|
|
23
23
|
workflowWorker: typeof Schema.Boolean;
|
|
24
24
|
stableSessionIds: Schema.Literal<[false]>;
|
|
25
25
|
exactSameSessionContinuation: Schema.Literal<[false]>;
|
|
@@ -32,6 +32,7 @@ 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";
|
|
@@ -104,6 +105,15 @@ export declare const workflowHarnessContinuationSupport: {
|
|
|
104
105
|
readonly continueCommand: "kimi --session <sessionId> --prompt <prompt>";
|
|
105
106
|
readonly capture: "stream-json session.resume_hint.session_id or session index recovery";
|
|
106
107
|
};
|
|
108
|
+
readonly devin: {
|
|
109
|
+
readonly adapter: "devin";
|
|
110
|
+
readonly workflowWorker: true;
|
|
111
|
+
readonly stableSessionIds: true;
|
|
112
|
+
readonly exactSameSessionContinuation: true;
|
|
113
|
+
readonly sessionIdField: "sessionId";
|
|
114
|
+
readonly continueCommand: "devin -p -r <sessionId> --prompt-file <prompt>";
|
|
115
|
+
readonly capture: "ATIF export session_id via --export";
|
|
116
|
+
};
|
|
107
117
|
readonly "opencode-cli": {
|
|
108
118
|
readonly adapter: "opencode-cli";
|
|
109
119
|
readonly workflowWorker: true;
|
|
@@ -2,6 +2,7 @@ import type { WorkflowJudgeVerdict } from "./workflows.js";
|
|
|
2
2
|
import type { WorkflowJudgeIdentity, WorkflowRunTaskSnapshot, WorkflowTaskIdentity } from "./workflow-identity.js";
|
|
3
3
|
export { workflowRunTaskSnapshotForTask, workflowTaskIdentity, type WorkflowJudgeIdentity, type WorkflowRunTaskSnapshot, type WorkflowTaskIdentity } from "./workflow-identity.js";
|
|
4
4
|
import { type WorkflowDatabase } from "./workflow-runtime.js";
|
|
5
|
+
import type { WorkflowSpanRecord } from "./workflow-tracing.js";
|
|
5
6
|
export type WorkflowTaskOutputSource = "mock-output";
|
|
6
7
|
export interface CompletedWorkflowTaskRecord {
|
|
7
8
|
readonly identity: WorkflowTaskIdentity;
|
|
@@ -140,6 +141,7 @@ export interface WorkflowRunRecord {
|
|
|
140
141
|
readonly finishedAt: string | null;
|
|
141
142
|
readonly runnerPid?: number;
|
|
142
143
|
readonly heartbeatAt?: string;
|
|
144
|
+
readonly createdAt?: string;
|
|
143
145
|
}
|
|
144
146
|
export type WorkflowRunStatus = "running" | "completed" | "failed" | "escalated" | "unknown";
|
|
145
147
|
/**
|
|
@@ -220,6 +222,15 @@ export declare class WorkflowStore {
|
|
|
220
222
|
readonly type: string;
|
|
221
223
|
readonly payload: unknown;
|
|
222
224
|
}): void;
|
|
225
|
+
recordSpanStart(span: WorkflowSpanRecord): void;
|
|
226
|
+
recordSpanEnd(input: {
|
|
227
|
+
readonly spanId: string;
|
|
228
|
+
readonly endNs: bigint;
|
|
229
|
+
readonly status: "ok" | "error";
|
|
230
|
+
readonly errorMessage: string | null;
|
|
231
|
+
readonly attributes: Record<string, unknown>;
|
|
232
|
+
}): void;
|
|
233
|
+
listSpans(runId: string): WorkflowSpanRecord[];
|
|
223
234
|
listRunEvents(runId: string): WorkflowEventRecord[];
|
|
224
235
|
failDeadPidRuns(): WorkflowRunRecord[];
|
|
225
236
|
failStaleRuns(olderThanMs: number, now?: Date): WorkflowRunRecord[];
|
|
@@ -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;
|
package/types/workflows.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ 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";
|
|
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
64
|
type WorkflowTaskWorkerOptionsBase = {
|
|
@@ -177,8 +177,43 @@ export interface WorkflowDefinition<Name extends string, Tasks extends ReadonlyA
|
|
|
177
177
|
readonly name: Name;
|
|
178
178
|
readonly tasks: Tasks;
|
|
179
179
|
}
|
|
180
|
+
export interface PhaseFraming {
|
|
181
|
+
readonly telos?: string;
|
|
182
|
+
readonly when?: string;
|
|
183
|
+
readonly coordination?: string;
|
|
184
|
+
readonly escalation?: string;
|
|
185
|
+
}
|
|
186
|
+
export interface PhaseContract<Name extends string, Agents extends Readonly<Record<string, WorkflowAgentRef>>, Output extends WorkflowOutputSchema> {
|
|
187
|
+
readonly name: Name;
|
|
188
|
+
readonly orbit: string;
|
|
189
|
+
readonly plugin: string;
|
|
190
|
+
readonly agents: Agents;
|
|
191
|
+
readonly output: Output;
|
|
192
|
+
readonly criteria?: readonly string[];
|
|
193
|
+
readonly framing?: PhaseFraming;
|
|
194
|
+
}
|
|
195
|
+
export type PhaseTaskFinishOptions<Output> = WorkflowFinishOptions<Output> & {
|
|
196
|
+
readonly inherit?: boolean;
|
|
197
|
+
};
|
|
198
|
+
export type PhaseTaskDefinition<Id extends string, Agent extends WorkflowAgentRef, Output extends WorkflowOutputSchema = WorkflowOutputSchema> = Omit<WorkflowTaskDefinition<Id, Agent, Output>, "output" | "phase" | "finish"> & {
|
|
199
|
+
readonly output?: Output;
|
|
200
|
+
readonly phase?: string;
|
|
201
|
+
readonly finish?: PhaseTaskFinishOptions<Schema.Schema.Type<Output>>;
|
|
202
|
+
readonly brief?: boolean;
|
|
203
|
+
};
|
|
204
|
+
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>;
|
|
205
|
+
export interface PhaseCtx<Name extends string, Agents extends Readonly<Record<string, WorkflowAgentRef>>, DefaultOutput extends WorkflowOutputSchema> {
|
|
206
|
+
readonly name: Name;
|
|
207
|
+
readonly orbit: string;
|
|
208
|
+
readonly plugin: string;
|
|
209
|
+
readonly agents: Agents;
|
|
210
|
+
readonly phase: string;
|
|
211
|
+
readonly task: PhaseCtxTask<Agents, DefaultOutput>;
|
|
212
|
+
}
|
|
213
|
+
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
214
|
export interface WorkflowRuntime {
|
|
181
215
|
runTask: <Task extends AnyWorkflowTask>(task: Task) => Effect.Effect<WorkflowTaskOutput<Task>, WorkflowRuntimeError>;
|
|
216
|
+
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
217
|
}
|
|
183
218
|
export interface WorkflowRuntimeOptions {
|
|
184
219
|
readonly fallbackWorker?: string;
|