@effect-agent/workflow 0.1.0-beta.46

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.
@@ -0,0 +1,91 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Context, Effect, Schema } from "effect";
3
+ import { SettlementId } from "@effect-agent/core/Identifiers";
4
+ import { Receipt } from "@effect-agent/thread/DurableAgentRuntime";
5
+ import { DeploymentId } from "@effect-agent/thread/Records";
6
+ import { DurableDeferred } from "effect/unstable/workflow";
7
+ //#region src/WorkflowDispatch.ts
8
+ var WorkflowDispatch_exports = /* @__PURE__ */ __exportAll({
9
+ WorkflowDispatchError: () => WorkflowDispatchError,
10
+ WorkflowDispatchFailpoint: () => WorkflowDispatchFailpoint,
11
+ WorkflowDispatchFailpointLocation: () => WorkflowDispatchFailpointLocation,
12
+ WorkflowDispatchIntent: () => WorkflowDispatchIntent,
13
+ WorkflowDispatchScan: () => WorkflowDispatchScan,
14
+ WorkflowDispatchStore: () => WorkflowDispatchStore,
15
+ WorkflowRepairReport: () => WorkflowRepairReport,
16
+ WorkflowRepairTrigger: () => WorkflowRepairTrigger,
17
+ WorkflowSettlementReference: () => WorkflowSettlementReference,
18
+ WorkflowSubmission: () => WorkflowSubmission
19
+ });
20
+ /** Only identities cross the Workflow boundary; the agent journal owns the outcome. */
21
+ var WorkflowSubmission = class extends Schema.Class("@effect-agent/workflow/WorkflowSubmission")({
22
+ version: Schema.Literal(1),
23
+ deploymentId: DeploymentId,
24
+ receipt: Receipt
25
+ }) {};
26
+ var WorkflowSettlementReference = class extends Schema.Class("@effect-agent/workflow/WorkflowSettlementReference")({
27
+ version: Schema.Literal(1),
28
+ submissionId: Receipt.fields.submissionId,
29
+ threadId: Receipt.fields.threadId,
30
+ settlementId: SettlementId
31
+ }) {};
32
+ /** Retained until native success has been checked against the canonical Settlement. */
33
+ var WorkflowDispatchIntent = class extends Schema.Class("@effect-agent/workflow/WorkflowDispatchIntent")({
34
+ ...WorkflowSubmission.fields,
35
+ workflowName: Schema.NonEmptyString,
36
+ executionId: Schema.NonEmptyString,
37
+ /** One workflow step owns this submission. Repair must notify it before removing the intent. */
38
+ completionToken: Schema.optionalKey(DurableDeferred.Token)
39
+ }) {};
40
+ var WorkflowDispatchError = class extends Schema.TaggedError()("WorkflowDispatchError", {
41
+ operation: Schema.String,
42
+ message: Schema.String,
43
+ cause: Schema.optionalKey(Schema.Defect())
44
+ }) {};
45
+ var WorkflowDispatchScan = class extends Schema.Class("@effect-agent/workflow/WorkflowDispatchScan")({
46
+ deploymentId: DeploymentId,
47
+ workflowName: Schema.NonEmptyString,
48
+ after: Schema.optionalKey(Schema.String),
49
+ limit: Schema.Int.check(Schema.isBetween({
50
+ minimum: 1,
51
+ maximum: 1e3
52
+ }))
53
+ }) {};
54
+ /**
55
+ * Adapter-private outbox. `put` returns the stored intent, preserving an existing completion
56
+ * token when omitted and allowing its one-time attachment. Different identities or tokens
57
+ * conflict. `remove` must compare the entire intent, so a concurrent token attachment cannot
58
+ * be lost. `scan` returns at most limit rows in executionId order, after
59
+ * the exclusive cursor, filtered by deployment and workflow. All writes are durable
60
+ * before returning. No transcript, outcome, or native engine storage belongs here.
61
+ */
62
+ var WorkflowDispatchStore = class extends Context.Service()("@effect-agent/workflow/WorkflowDispatchStore") {};
63
+ /**
64
+ * Host-owned durable repair trigger. Register before admission opens. The host must
65
+ * invoke repair at startup and repeatedly after lost hints or process loss. A Node
66
+ * deployment may use a scoped poller; other hosts may use alarms or durable jobs.
67
+ * Stop invoking the callback when this Scope closes. The shared driver starts no loop.
68
+ */
69
+ var WorkflowRepairTrigger = class extends Context.Service()("@effect-agent/workflow/WorkflowRepairTrigger") {};
70
+ const WorkflowDispatchFailpointLocation = Schema.Literals([
71
+ "intent:before-persist",
72
+ "intent:after-persist",
73
+ "launch:before",
74
+ "launch:after",
75
+ "completion:before-observe",
76
+ "completion:after-observe",
77
+ "completion:before-notify",
78
+ "completion:after-notify",
79
+ "cleanup:before",
80
+ "cleanup:after"
81
+ ]);
82
+ const WorkflowDispatchFailpoint = Context.Reference("@effect-agent/workflow/WorkflowDispatchFailpoint", { defaultValue: () => ({ hit: () => Effect.void }) });
83
+ var WorkflowRepairReport = class extends Schema.Class("@effect-agent/workflow/WorkflowRepairReport")({
84
+ discovered: Schema.Int,
85
+ inspected: Schema.Int,
86
+ completed: Schema.Int
87
+ }) {};
88
+ //#endregion
89
+ export { WorkflowDispatchError, WorkflowDispatchFailpoint, WorkflowDispatchFailpointLocation, WorkflowDispatchIntent, WorkflowDispatchScan, WorkflowDispatchStore, WorkflowRepairReport, WorkflowRepairTrigger, WorkflowSettlementReference, WorkflowSubmission, WorkflowDispatch_exports as t };
90
+
91
+ //# sourceMappingURL=WorkflowDispatch.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowDispatch.mjs","names":[],"sources":["../src/WorkflowDispatch.ts"],"sourcesContent":["import { SettlementId } from \"@effect-agent/core/Identifiers\";\nimport { Receipt } from \"@effect-agent/thread/DurableAgentRuntime\";\nimport { DeploymentId } from \"@effect-agent/thread/Records\";\nimport { Context, Effect, Schema, type Scope } from \"effect\";\nimport { DurableDeferred } from \"effect/unstable/workflow\";\n\n/** Only identities cross the Workflow boundary; the agent journal owns the outcome. */\nexport class WorkflowSubmission extends Schema.Class<WorkflowSubmission>(\n \"@effect-agent/workflow/WorkflowSubmission\",\n)({\n version: Schema.Literal(1),\n deploymentId: DeploymentId,\n receipt: Receipt,\n}) {}\n\nexport class WorkflowSettlementReference extends Schema.Class<WorkflowSettlementReference>(\n \"@effect-agent/workflow/WorkflowSettlementReference\",\n)({\n version: Schema.Literal(1),\n submissionId: Receipt.fields.submissionId,\n threadId: Receipt.fields.threadId,\n settlementId: SettlementId,\n}) {}\n\n/** Retained until native success has been checked against the canonical Settlement. */\nexport class WorkflowDispatchIntent extends Schema.Class<WorkflowDispatchIntent>(\n \"@effect-agent/workflow/WorkflowDispatchIntent\",\n)({\n ...WorkflowSubmission.fields,\n workflowName: Schema.NonEmptyString,\n executionId: Schema.NonEmptyString,\n /** One workflow step owns this submission. Repair must notify it before removing the intent. */\n completionToken: Schema.optionalKey(DurableDeferred.Token),\n}) {}\n\nexport class WorkflowDispatchError extends Schema.TaggedError<WorkflowDispatchError>()(\n \"WorkflowDispatchError\",\n {\n operation: Schema.String,\n message: Schema.String,\n cause: Schema.optionalKey(Schema.Defect()),\n },\n) {}\n\nexport class WorkflowDispatchScan extends Schema.Class<WorkflowDispatchScan>(\n \"@effect-agent/workflow/WorkflowDispatchScan\",\n)({\n deploymentId: DeploymentId,\n workflowName: Schema.NonEmptyString,\n after: Schema.optionalKey(Schema.String),\n limit: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 1000 })),\n}) {}\n\n/**\n * Adapter-private outbox. `put` returns the stored intent, preserving an existing completion\n * token when omitted and allowing its one-time attachment. Different identities or tokens\n * conflict. `remove` must compare the entire intent, so a concurrent token attachment cannot\n * be lost. `scan` returns at most limit rows in executionId order, after\n * the exclusive cursor, filtered by deployment and workflow. All writes are durable\n * before returning. No transcript, outcome, or native engine storage belongs here.\n */\nexport class WorkflowDispatchStore extends Context.Service<\n WorkflowDispatchStore,\n {\n readonly put: (\n intent: WorkflowDispatchIntent,\n ) => Effect.Effect<WorkflowDispatchIntent, WorkflowDispatchError>;\n readonly scan: (\n request: WorkflowDispatchScan,\n ) => Effect.Effect<ReadonlyArray<WorkflowDispatchIntent>, WorkflowDispatchError>;\n readonly remove: (intent: WorkflowDispatchIntent) => Effect.Effect<void, WorkflowDispatchError>;\n }\n>()(\"@effect-agent/workflow/WorkflowDispatchStore\") {}\n\n/**\n * Host-owned durable repair trigger. Register before admission opens. The host must\n * invoke repair at startup and repeatedly after lost hints or process loss. A Node\n * deployment may use a scoped poller; other hosts may use alarms or durable jobs.\n * Stop invoking the callback when this Scope closes. The shared driver starts no loop.\n */\nexport class WorkflowRepairTrigger extends Context.Service<\n WorkflowRepairTrigger,\n {\n readonly register: (repair: Effect.Effect<void>) => Effect.Effect<void, never, Scope.Scope>;\n }\n>()(\"@effect-agent/workflow/WorkflowRepairTrigger\") {}\n\nexport const WorkflowDispatchFailpointLocation = Schema.Literals([\n \"intent:before-persist\",\n \"intent:after-persist\",\n \"launch:before\",\n \"launch:after\",\n \"completion:before-observe\",\n \"completion:after-observe\",\n \"completion:before-notify\",\n \"completion:after-notify\",\n \"cleanup:before\",\n \"cleanup:after\",\n]);\n\nexport type WorkflowDispatchFailpointLocation = typeof WorkflowDispatchFailpointLocation.Type;\n\nexport const WorkflowDispatchFailpoint = Context.Reference<{\n readonly hit: (\n location: WorkflowDispatchFailpointLocation,\n intent: WorkflowDispatchIntent,\n ) => Effect.Effect<void, WorkflowDispatchError>;\n}>(\"@effect-agent/workflow/WorkflowDispatchFailpoint\", {\n defaultValue: () => ({ hit: () => Effect.void }),\n});\n\nexport class WorkflowRepairReport extends Schema.Class<WorkflowRepairReport>(\n \"@effect-agent/workflow/WorkflowRepairReport\",\n)({\n discovered: Schema.Int,\n inspected: Schema.Int,\n completed: Schema.Int,\n}) {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAOA,IAAa,qBAAb,cAAwC,OAAO,MAC7C,2CACF,CAAC,CAAC;CACA,SAAS,OAAO,QAAQ,CAAC;CACzB,cAAc;CACd,SAAS;AACX,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,8BAAb,cAAiD,OAAO,MACtD,oDACF,CAAC,CAAC;CACA,SAAS,OAAO,QAAQ,CAAC;CACzB,cAAc,QAAQ,OAAO;CAC7B,UAAU,QAAQ,OAAO;CACzB,cAAc;AAChB,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,yBAAb,cAA4C,OAAO,MACjD,+CACF,CAAC,CAAC;CACA,GAAG,mBAAmB;CACtB,cAAc,OAAO;CACrB,aAAa,OAAO;;CAEpB,iBAAiB,OAAO,YAAY,gBAAgB,KAAK;AAC3D,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,wBAAb,cAA2C,OAAO,YAAmC,CAAC,CACpF,yBACA;CACE,WAAW,OAAO;CAClB,SAAS,OAAO;CAChB,OAAO,OAAO,YAAY,OAAO,OAAO,CAAC;AAC3C,CACF,CAAC,CAAC,CAAC;AAEH,IAAa,uBAAb,cAA0C,OAAO,MAC/C,6CACF,CAAC,CAAC;CACA,cAAc;CACd,cAAc,OAAO;CACrB,OAAO,OAAO,YAAY,OAAO,MAAM;CACvC,OAAO,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS;CAAK,CAAC,CAAC;AACzE,CAAC,CAAC,CAAC,CAAC;;;;;;;;;AAUJ,IAAa,wBAAb,cAA2C,QAAQ,QAWjD,CAAC,CAAC,8CAA8C,CAAC,CAAC,CAAC;;;;;;;AAQrD,IAAa,wBAAb,cAA2C,QAAQ,QAKjD,CAAC,CAAC,8CAA8C,CAAC,CAAC,CAAC;AAErD,MAAa,oCAAoC,OAAO,SAAS;CAC/D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAID,MAAa,4BAA4B,QAAQ,UAK9C,oDAAoD,EACrD,qBAAqB,EAAE,WAAW,OAAO,KAAK,GAChD,CAAC;AAED,IAAa,uBAAb,cAA0C,OAAO,MAC/C,6CACF,CAAC,CAAC;CACA,YAAY,OAAO;CACnB,WAAW,OAAO;CAClB,WAAW,OAAO;AACpB,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { Schema } from "effect";
2
+ import { AgentId } from "@effect-agent/core/Identifiers";
3
+ import { Receipt } from "@effect-agent/thread/DurableAgentRuntime";
4
+ declare namespace WorkflowExecution_d_exports {
5
+ export { WorkflowAgent, WorkflowExecuteOptions, WorkflowExecutionFailure };
6
+ }
7
+ /** Must be the exact registered Definition instance; its model and tool services belong to registration. */
8
+ interface WorkflowAgent<Input extends Schema.Top, Output extends Schema.Top> {
9
+ readonly id: typeof AgentId.Type;
10
+ readonly input: Input;
11
+ readonly output: Output;
12
+ }
13
+ interface WorkflowExecuteOptions {
14
+ /** Stable, nonempty step name, unique within one parent execution. Use item IDs in loops. */
15
+ readonly name: string;
16
+ }
17
+ declare const WorkflowExecutionFailure_base: Schema.Class<WorkflowExecutionFailure, Schema.TaggedStruct<"WorkflowExecutionFailure", {
18
+ readonly reason: Schema.Literals<readonly ["invalid-name", "engine-mismatch", "failed", "aborted", "missing-output"]>;
19
+ readonly message: Schema.String;
20
+ readonly receipt: Schema.optionalKey<typeof Receipt>;
21
+ readonly failure: Schema.optionalKey<Schema.Struct<{
22
+ readonly errorTag: Schema.NonEmptyString;
23
+ readonly message: Schema.String;
24
+ }>>;
25
+ }>, import("effect/Cause").YieldableError>;
26
+ /** A terminal agent outcome or invalid invocation, distinct from retriable infrastructure errors. */
27
+ declare class WorkflowExecutionFailure extends WorkflowExecutionFailure_base {}
28
+ //#endregion
29
+ export { WorkflowAgent, WorkflowExecuteOptions, WorkflowExecutionFailure, WorkflowExecution_d_exports as t };
30
+ //# sourceMappingURL=WorkflowExecution.d.mts.map
@@ -0,0 +1,23 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Schema } from "effect";
3
+ import { Receipt } from "@effect-agent/thread/DurableAgentRuntime";
4
+ import { SettlementFailureDiagnostic } from "@effect-agent/thread/Records";
5
+ //#region src/WorkflowExecution.ts
6
+ var WorkflowExecution_exports = /* @__PURE__ */ __exportAll({ WorkflowExecutionFailure: () => WorkflowExecutionFailure });
7
+ /** A terminal agent outcome or invalid invocation, distinct from retriable infrastructure errors. */
8
+ var WorkflowExecutionFailure = class extends Schema.TaggedError()("WorkflowExecutionFailure", {
9
+ reason: Schema.Literals([
10
+ "invalid-name",
11
+ "engine-mismatch",
12
+ "failed",
13
+ "aborted",
14
+ "missing-output"
15
+ ]),
16
+ message: Schema.String,
17
+ receipt: Schema.optionalKey(Receipt),
18
+ failure: Schema.optionalKey(SettlementFailureDiagnostic)
19
+ }) {};
20
+ //#endregion
21
+ export { WorkflowExecutionFailure, WorkflowExecution_exports as t };
22
+
23
+ //# sourceMappingURL=WorkflowExecution.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowExecution.mjs","names":[],"sources":["../src/WorkflowExecution.ts"],"sourcesContent":["import type { AgentId } from \"@effect-agent/core/Identifiers\";\nimport { Receipt } from \"@effect-agent/thread/DurableAgentRuntime\";\nimport { SettlementFailureDiagnostic } from \"@effect-agent/thread/Records\";\nimport { Schema } from \"effect\";\n\n/** Must be the exact registered Definition instance; its model and tool services belong to registration. */\nexport interface WorkflowAgent<Input extends Schema.Top, Output extends Schema.Top> {\n readonly id: typeof AgentId.Type;\n readonly input: Input;\n readonly output: Output;\n}\n\nexport interface WorkflowExecuteOptions {\n /** Stable, nonempty step name, unique within one parent execution. Use item IDs in loops. */\n readonly name: string;\n}\n\n/** A terminal agent outcome or invalid invocation, distinct from retriable infrastructure errors. */\nexport class WorkflowExecutionFailure extends Schema.TaggedError<WorkflowExecutionFailure>()(\n \"WorkflowExecutionFailure\",\n {\n reason: Schema.Literals([\n \"invalid-name\",\n \"engine-mismatch\",\n \"failed\",\n \"aborted\",\n \"missing-output\",\n ]),\n message: Schema.String,\n receipt: Schema.optionalKey(Receipt),\n failure: Schema.optionalKey(SettlementFailureDiagnostic),\n },\n) {}\n"],"mappings":";;;;;;;AAkBA,IAAa,2BAAb,cAA8C,OAAO,YAAsC,CAAC,CAC1F,4BACA;CACE,QAAQ,OAAO,SAAS;EACtB;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,SAAS,OAAO;CAChB,SAAS,OAAO,YAAY,OAAO;CACnC,SAAS,OAAO,YAAY,2BAA2B;AACzD,CACF,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { t as WorkflowDispatch_d_exports } from "./WorkflowDispatch.mjs";
2
+ import { t as WorkflowExecution_d_exports } from "./WorkflowExecution.mjs";
3
+ import { t as WorkflowAgentHost_d_exports } from "./WorkflowAgentHost.mjs";
4
+ import { t as AgentWorkflow_d_exports } from "./AgentWorkflow.mjs";
5
+ export { AgentWorkflow_d_exports as AgentWorkflow, WorkflowAgentHost_d_exports as WorkflowAgentHost, WorkflowDispatch_d_exports as WorkflowDispatch, WorkflowExecution_d_exports as WorkflowExecution };
package/dist/index.mjs ADDED
@@ -0,0 +1,5 @@
1
+ import { t as WorkflowDispatch_exports } from "./WorkflowDispatch.mjs";
2
+ import { r as WorkflowAgentHost_exports } from "./WorkflowAgentHost-DOGuS1cg.mjs";
3
+ import { t as WorkflowExecution_exports } from "./WorkflowExecution.mjs";
4
+ import { t as AgentWorkflow_exports } from "./AgentWorkflow.mjs";
5
+ export { AgentWorkflow_exports as AgentWorkflow, WorkflowAgentHost_exports as WorkflowAgentHost, WorkflowDispatch_exports as WorkflowDispatch, WorkflowExecution_exports as WorkflowExecution };
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };
package/package.json ADDED
@@ -0,0 +1 @@
1
+ {"name":"@effect-agent/workflow","version":"0.1.0-beta.46","dependencies":{"@effect-agent/core":"0.1.0-beta.46","@effect-agent/thread":"0.1.0-beta.46"},"devDependencies":{"@effect-agent/engine":"0.1.0-beta.46","@effect-agent/storage-memory":"0.1.0-beta.46","@effect/platform-node":"4.0.0-rc.112","@effect/vitest":"4.0.0-rc.112","effect":"4.0.0-rc.112","typescript":"7.0.2","vite-plus":"0.3.0"},"peerDependencies":{"effect":"^4.0.0-rc.112"},"exports":{".":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"./AgentWorkflow":{"types":"./dist/AgentWorkflow.d.mts","default":"./dist/AgentWorkflow.mjs"},"./WorkflowAgentHost":{"types":"./dist/WorkflowAgentHost.d.mts","default":"./dist/WorkflowAgentHost.mjs"},"./WorkflowDispatch":{"types":"./dist/WorkflowDispatch.d.mts","default":"./dist/WorkflowDispatch.mjs"},"./WorkflowExecution":{"types":"./dist/WorkflowExecution.d.mts","default":"./dist/WorkflowExecution.mjs"}},"description":"Effect Workflow execution for the existing durable Agent runtime.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/danieljvdm/effect-agent.git","directory":"packages/workflow"},"files":["dist","src"],"type":"module","sideEffects":[],"publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"tsc --noEmit -p tsconfig.json","test":"vp test --passWithNoTests"}}
@@ -0,0 +1,65 @@
1
+ import { AgentInputError, AgentOutputError } from "@effect-agent/core/AgentError";
2
+ import { BindingUnavailable } from "@effect-agent/thread/AgentRegistration";
3
+ import { DigestError } from "@effect-agent/thread/Digest";
4
+ import { DurableRuntimeFailpointError } from "@effect-agent/thread/DurableFailpoint";
5
+ import { OperationDenied } from "@effect-agent/thread/OperationAuthorizer";
6
+ import {
7
+ AdmissionConflict,
8
+ LedgerError,
9
+ SettlementConflict,
10
+ } from "@effect-agent/thread/SubmissionLedger";
11
+ import {
12
+ AppendConflict,
13
+ FenceRejected,
14
+ ThreadNotMaterialized,
15
+ ThreadStoreError,
16
+ } from "@effect-agent/thread/ThreadStore";
17
+ import { Effect, Schema } from "effect";
18
+
19
+ import { WorkflowAdmissionClosed, WorkflowAgentHost } from "./WorkflowAgentHost.ts";
20
+ import { WorkflowDispatchError } from "./WorkflowDispatch.ts";
21
+ import {
22
+ WorkflowExecutionFailure,
23
+ type WorkflowAgent,
24
+ type WorkflowExecuteOptions,
25
+ } from "./WorkflowExecution.ts";
26
+
27
+ /** Schema for the exact typed failure channel of execute, suitable for Workflow.make({ error }). */
28
+ export const Error = Schema.Union([
29
+ AgentInputError,
30
+ AgentOutputError,
31
+ AdmissionConflict,
32
+ AppendConflict,
33
+ BindingUnavailable,
34
+ DigestError,
35
+ DurableRuntimeFailpointError,
36
+ FenceRejected,
37
+ LedgerError,
38
+ OperationDenied,
39
+ SettlementConflict,
40
+ ThreadNotMaterialized,
41
+ ThreadStoreError,
42
+ WorkflowDispatchError,
43
+ WorkflowAdmissionClosed,
44
+ WorkflowExecutionFailure,
45
+ ]);
46
+
47
+ export type Error = typeof Error.Type;
48
+
49
+ /**
50
+ * Run a registered agent inside a native Workflow.toLayer handler. One stable name identifies
51
+ * one submission in that parent execution. Replays verify admission identity and decode the
52
+ * canonical output again. Pending work suspends through Effect DurableDeferred; neither
53
+ * suspension nor parent interruption aborts accepted agent work. Use the host's authorized abort.
54
+ * Provide WorkflowAgentHost at the application boundary, sharing the parent's WorkflowEngine.
55
+ * Pass the exact Agent Definition instance used in runtime registration; a same-ID copy fails
56
+ * with BindingUnavailable before input encoding or admission.
57
+ */
58
+ export const execute = Effect.fn("AgentWorkflow.execute")(function* <
59
+ Input extends Schema.Top,
60
+ Output extends Schema.Top,
61
+ >(agent: WorkflowAgent<Input, Output>, input: Input["Type"], options: WorkflowExecuteOptions) {
62
+ const host = yield* WorkflowAgentHost;
63
+
64
+ return yield* host.execute(agent, input, options);
65
+ });