@effect-agent/workflow 0.1.0-beta.83 → 0.1.0-beta.85

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.
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
2
  import { WorkflowDispatchError } from "./WorkflowDispatch.mjs";
3
- import { n as WorkflowAgentHost, t as WorkflowAdmissionClosed } from "./WorkflowAgentHost-DOGuS1cg.mjs";
3
+ import { n as WorkflowAgentHost, t as WorkflowAdmissionClosed } from "./WorkflowAgentHost-BwqWlnqZ.mjs";
4
4
  import { WorkflowExecutionFailure } from "./WorkflowExecution.mjs";
5
5
  import { AgentInputError, AgentOutputError } from "@effect-agent/core/AgentError";
6
6
  import { BindingUnavailable } from "@effect-agent/thread/AgentRegistration";
@@ -45,7 +45,7 @@ const nativeOperation = (operation, effect) => effect.pipe(Effect.catchDefect((c
45
45
  cause
46
46
  }))));
47
47
  const makeHost = Effect.fn("WorkflowAgentHost.make")(function* (options) {
48
- const config = yield* Schema.decodeUnknownEffect(WorkflowHostConfig)({
48
+ const config = yield* Schema.decodeEffect(WorkflowHostConfig)({
49
49
  deploymentId: options.deploymentId,
50
50
  principal: options.principal,
51
51
  workflowName: options.workflowName ?? "effect-agent/Submission/v1",
@@ -217,7 +217,7 @@ const makeHost = Effect.fn("WorkflowAgentHost.make")(function* (options) {
217
217
  reason: "engine-mismatch",
218
218
  message: "Agent host and parent workflow must share one WorkflowEngine Layer"
219
219
  });
220
- const name = yield* Schema.decodeUnknownEffect(Schema.NonEmptyString)(options.name).pipe(Effect.mapError(() => new WorkflowExecutionFailure({
220
+ const name = yield* Schema.decodeEffect(Schema.NonEmptyString)(options.name).pipe(Effect.mapError(() => new WorkflowExecutionFailure({
221
221
  reason: "invalid-name",
222
222
  message: "Workflow agent steps need a nonempty stable name"
223
223
  })));
@@ -265,7 +265,7 @@ const makeHost = Effect.fn("WorkflowAgentHost.make")(function* (options) {
265
265
  message: "Completed submission has no independent output",
266
266
  receipt
267
267
  });
268
- return yield* Schema.decodeUnknownEffect(agent.output)(record.result).pipe(Effect.mapError((cause) => new AgentOutputError({ message: `Cannot decode canonical agent output: ${cause.message}` })));
268
+ return yield* Schema.decodeEffect(agent.output)(record.result).pipe(Effect.mapError((cause) => new AgentOutputError({ message: `Cannot decode canonical agent output: ${cause.message}` })));
269
269
  });
270
270
  return WorkflowAgentHost.of({
271
271
  execute,
@@ -295,4 +295,4 @@ var WorkflowAgentHost = class WorkflowAgentHost extends Context.Service()("@effe
295
295
  //#endregion
296
296
  export { WorkflowHostConfigError as i, WorkflowAgentHost as n, WorkflowAgentHost_exports as r, WorkflowAdmissionClosed as t };
297
297
 
298
- //# sourceMappingURL=WorkflowAgentHost-DOGuS1cg.mjs.map
298
+ //# sourceMappingURL=WorkflowAgentHost-BwqWlnqZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowAgentHost-BwqWlnqZ.mjs","names":[],"sources":["../src/internal/completion.ts","../src/WorkflowAgentHost.ts"],"sourcesContent":["import { DurableDeferred } from \"effect/unstable/workflow\";\n\nimport { WorkflowSettlementReference } from \"../WorkflowDispatch.ts\";\n\n/** Native deferred results contain only canonical identities, never a second agent result. */\nexport const workflowCompletion = (name: string) =>\n DurableDeferred.make(name, { success: WorkflowSettlementReference });\n","import { AgentOutputError } from \"@effect-agent/core/AgentError\";\nimport { ThreadId } from \"@effect-agent/core/Identifiers\";\nimport { type BindingUnavailable } from \"@effect-agent/thread/AgentRegistration\";\nimport { digestJson } from \"@effect-agent/thread/Digest\";\nimport {\n DurableAgentRuntime,\n DurableRuntimeConfig,\n Receipt,\n type DurableAwaitFailure,\n type DurableSubmitAgent,\n type DurableSubmitFailure,\n type DurableSubmitOptions,\n} from \"@effect-agent/thread/DurableAgentRuntime\";\nimport { DeploymentId } from \"@effect-agent/thread/Records\";\nimport {\n IdempotencyKey,\n Principal,\n SubmissionLedger,\n SubmissionLookupById,\n} from \"@effect-agent/thread/SubmissionLedger\";\nimport {\n Cause,\n Context,\n Crypto,\n Effect,\n Exit,\n Layer,\n Option,\n RcMap,\n Ref,\n Result,\n Schema,\n Semaphore,\n Stream,\n} from \"effect\";\nimport { DurableDeferred, Workflow, WorkflowEngine } from \"effect/unstable/workflow\";\n\nimport { workflowCompletion } from \"./internal/completion.ts\";\nimport {\n WorkflowDispatchError,\n WorkflowDispatchFailpoint,\n WorkflowDispatchIntent,\n WorkflowDispatchScan,\n WorkflowDispatchStore,\n WorkflowRepairReport,\n WorkflowRepairTrigger,\n WorkflowSettlementReference,\n WorkflowSubmission,\n} from \"./WorkflowDispatch.ts\";\nimport {\n WorkflowExecutionFailure,\n type WorkflowAgent,\n type WorkflowExecuteOptions,\n} from \"./WorkflowExecution.ts\";\n\nconst WorkflowHostConfig = Schema.Struct({\n deploymentId: DeploymentId,\n principal: Principal,\n workflowName: Schema.NonEmptyString,\n executionConcurrency: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 64 })),\n repairBatchSize: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 1000 })),\n dispatchTimeoutMillis: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 300_000 })),\n});\n\nexport class WorkflowHostConfigError extends Schema.TaggedError<WorkflowHostConfigError>()(\n \"WorkflowHostConfigError\",\n { message: Schema.String },\n) {}\n\nexport class WorkflowAdmissionClosed extends Schema.TaggedError<WorkflowAdmissionClosed>()(\n \"WorkflowAdmissionClosed\",\n { message: Schema.String },\n) {}\n\nexport interface WorkflowAgentHostOptions {\n readonly deploymentId: string;\n /** Application-owned identity for submissions from AgentWorkflow.execute. */\n readonly principal: string;\n /** Stable versioned name prefix. The native name also includes deploymentId. */\n readonly workflowName?: string;\n /** Concurrent Attempts within this host Layer instance, not a fleet-wide limit. Default 1. */\n readonly executionConcurrency?: number;\n /** Maximum entries per scan per repair invocation. Default 32. */\n readonly repairBatchSize?: number;\n /** Bound each dispatch or scan, including a retrying native engine. Default 10000 ms. */\n readonly dispatchTimeoutMillis?: number;\n}\n\nexport type WorkflowRepairFailure = WorkflowDispatchError | DurableAwaitFailure;\n\nconst nativeOperation = <A, E, R>(operation: string, effect: Effect.Effect<A, E, R>) =>\n effect.pipe(\n Effect.catchDefect((cause) =>\n Effect.fail(\n new WorkflowDispatchError({\n operation,\n message: \"Workflow engine operation failed\",\n cause,\n }),\n ),\n ),\n );\n\nconst makeHost = Effect.fn(\"WorkflowAgentHost.make\")(function* (options: WorkflowAgentHostOptions) {\n const config = yield* Schema.decodeEffect(WorkflowHostConfig)({\n deploymentId: options.deploymentId,\n principal: options.principal,\n workflowName: options.workflowName ?? \"effect-agent/Submission/v1\",\n executionConcurrency: options.executionConcurrency ?? 1,\n repairBatchSize: options.repairBatchSize ?? 32,\n dispatchTimeoutMillis: options.dispatchTimeoutMillis ?? 10_000,\n }).pipe(Effect.mapError((error) => new WorkflowHostConfigError({ message: error.message })));\n\n const runtime = yield* DurableAgentRuntime;\n const crypto = yield* Crypto.Crypto;\n const runtimeConfig = yield* DurableRuntimeConfig;\n const ledger = yield* SubmissionLedger;\n const engine = yield* WorkflowEngine.WorkflowEngine;\n const dispatch = yield* WorkflowDispatchStore;\n const trigger = yield* WorkflowRepairTrigger;\n const failpoint = yield* WorkflowDispatchFailpoint;\n\n if (runtimeConfig.deploymentId !== config.deploymentId) {\n return yield* new WorkflowHostConfigError({\n message: \"Workflow and durable runtime deploymentId must match\",\n });\n }\n const permits = yield* Semaphore.make(config.executionConcurrency);\n const lanes = yield* RcMap.make({ lookup: (_threadId: ThreadId) => Semaphore.make(1) });\n const repairPermit = yield* Semaphore.make(1);\n const admission = yield* Ref.make(true);\n const nativeName = `${config.workflowName}/deployment/${config.deploymentId.length}:${config.deploymentId}`;\n\n const workflow = Workflow.make(nativeName, {\n payload: WorkflowSubmission,\n success: WorkflowSettlementReference,\n idempotencyKey: ({ deploymentId, receipt }) =>\n `v1/${deploymentId.length}:${deploymentId}/${receipt.submissionId}`,\n }).annotate(Workflow.SuspendOnFailure, true);\n\n const bounded = <A, E, R>(operation: string, effect: Effect.Effect<A, E, R>) =>\n nativeOperation(operation, effect).pipe(\n Effect.timeout(config.dispatchTimeoutMillis),\n Effect.catchTag(\"TimeoutError\", () =>\n Effect.fail(\n WorkflowDispatchError.make({\n operation,\n message: \"Workflow dispatch operation timed out; accepted work remains recoverable\",\n }),\n ),\n ),\n );\n\n const validateReceipt = Effect.fn(\"WorkflowAgentHost.validateReceipt\")(function* (\n receipt: Receipt,\n ) {\n const found = yield* ledger.lookup(\n SubmissionLookupById.make({ submissionId: receipt.submissionId }),\n );\n\n if (\n Option.isNone(found) ||\n found.value.deploymentId !== config.deploymentId ||\n found.value.threadId !== receipt.threadId ||\n found.value.receiptId !== receipt.receiptId ||\n found.value.queueSequence !== receipt.queueSequence\n ) {\n return yield* WorkflowDispatchError.make({\n operation: \"identity\",\n message: \"Workflow Receipt does not match its authoritative deployment and Submission\",\n });\n }\n });\n\n // No Activities: rerun journal recovery directly on every native resume. The upstream\n // failure annotation suspends infrastructure failures and defects instead of settling them.\n yield* engine.register(\n workflow,\n Effect.fn(\"WorkflowAgentHost.execute\")(function* (payload, executionId) {\n yield* Effect.annotateCurrentSpan({\n \"workflow.execution.id\": executionId,\n \"agent.submission.id\": payload.receipt.submissionId,\n \"agent.thread.id\": payload.receipt.threadId,\n });\n if (payload.deploymentId !== config.deploymentId) {\n return yield* Effect.die(\"Workflow payload belongs to another deployment\");\n }\n if (executionId !== (yield* workflow.executionId(payload))) {\n return yield* Effect.die(\"Workflow execution identity does not match its Submission\");\n }\n yield* validateReceipt(payload.receipt).pipe(Effect.orDie);\n const initial = yield* runtime.inspectSubmissionStatus(payload.receipt).pipe(Effect.orDie);\n\n if (initial._tag === \"settled\") {\n return new WorkflowSettlementReference({\n version: 1,\n submissionId: initial.settlement.submissionId,\n threadId: payload.receipt.threadId,\n settlementId: initial.settlement.settlementId,\n });\n }\n\n const status = yield* Effect.scoped(\n Effect.gen(function* () {\n // Serialize recovery and processing for one Thread even when a ledger allows\n // same-producer takeover. Followers wait without consuming a global permit.\n const lane = yield* RcMap.get(lanes, payload.receipt.threadId);\n\n return yield* lane.withPermit(\n permits.withPermit(\n Effect.scoped(\n Effect.gen(function* () {\n yield* runtime.recoverSubmission(payload.receipt.submissionId);\n const recovered = yield* runtime.inspectSubmissionStatus(payload.receipt);\n\n if (recovered._tag === \"settled\") return recovered;\n yield* runtime.processThreadHead(payload.receipt.threadId);\n\n return yield* runtime.inspectSubmissionStatus(payload.receipt);\n }),\n ),\n ),\n );\n }),\n ).pipe(Effect.orDie);\n\n if (status._tag === \"settled\") {\n return new WorkflowSettlementReference({\n version: 1,\n submissionId: status.settlement.submissionId,\n threadId: payload.receipt.threadId,\n settlementId: status.settlement.settlementId,\n });\n }\n // Release the permit and Attempt Scope before native suspension, whose lifetime may\n // outlast this process. Completion is never inferred from an empty processing result.\n const instance = yield* WorkflowEngine.WorkflowInstance;\n\n return yield* Workflow.suspend(instance);\n }),\n );\n\n const intentFor = Effect.fn(\"WorkflowAgentHost.intentFor\")(function* (receipt: Receipt) {\n const payload = new WorkflowSubmission({\n version: 1,\n deploymentId: config.deploymentId,\n receipt,\n });\n\n const executionId = yield* workflow.executionId(payload);\n\n return new WorkflowDispatchIntent({\n ...payload,\n workflowName: nativeName,\n executionId,\n });\n });\n\n const dispatchIntent = Effect.fn(\"WorkflowAgentHost.dispatch\")(\n function* (\n requested: WorkflowDispatchIntent,\n ): Effect.fn.Return<boolean, WorkflowRepairFailure> {\n let intent = requested;\n const expected = yield* intentFor(intent.receipt);\n\n if (\n intent.executionId !== expected.executionId ||\n intent.deploymentId !== expected.deploymentId ||\n intent.workflowName !== expected.workflowName\n ) {\n return yield* new WorkflowDispatchError({\n operation: \"dispatch\",\n message: \"Dispatch identity does not match the configured Workflow\",\n });\n }\n yield* validateReceipt(intent.receipt);\n yield* failpoint.hit(\"intent:before-persist\", intent);\n intent = yield* dispatch.put(intent);\n yield* failpoint.hit(\"intent:after-persist\", intent);\n yield* failpoint.hit(\"launch:before\", intent);\n // Submission lifetime belongs to the durable host. Strip the optional parent\n // instance so upstream child interruption cannot cancel this recovery workflow.\n yield* nativeOperation(\n \"execute\",\n engine\n .execute(workflow, {\n executionId: intent.executionId,\n payload: new WorkflowSubmission(intent),\n discard: true,\n })\n .pipe(\n Effect.updateContext((context: Context.Context<never>) =>\n Context.omit(WorkflowEngine.WorkflowInstance)(context),\n ),\n ),\n );\n yield* failpoint.hit(\"launch:after\", intent);\n // Resume before suspension may be a no-op. Keep the intent and retry on a later trigger.\n yield* nativeOperation(\"resume\", engine.resume(workflow, intent.executionId));\n yield* failpoint.hit(\"completion:before-observe\", intent);\n const result = yield* nativeOperation(\"poll\", engine.poll(workflow, intent.executionId));\n\n yield* failpoint.hit(\"completion:after-observe\", intent);\n if (Option.isNone(result) || result.value._tag !== \"Complete\") return false;\n if (Exit.isFailure(result.value.exit)) {\n return yield* new WorkflowDispatchError({\n operation: \"completion\",\n message: \"Native Workflow completed without a Settlement reference; intent retained\",\n cause: result.value.exit.cause,\n });\n }\n const status = yield* runtime.inspectSubmissionStatus(intent.receipt);\n const reference = result.value.exit.value;\n\n if (\n status._tag !== \"settled\" ||\n reference.version !== 1 ||\n reference.submissionId !== intent.receipt.submissionId ||\n reference.threadId !== intent.receipt.threadId ||\n reference.settlementId !== status.settlement.settlementId\n ) {\n return yield* new WorkflowDispatchError({\n operation: \"completion\",\n message: \"Native completion disagrees with canonical Settlement; intent retained\",\n });\n }\n if (intent.completionToken !== undefined) {\n yield* failpoint.hit(\"completion:before-notify\", intent);\n yield* nativeOperation(\n \"notify\",\n DurableDeferred.succeed(workflowCompletion(\"settlement\"), {\n token: intent.completionToken,\n value: reference,\n }).pipe(Effect.provideService(WorkflowEngine.WorkflowEngine, engine)),\n );\n yield* failpoint.hit(\"completion:after-notify\", intent);\n }\n yield* failpoint.hit(\"cleanup:before\", intent);\n yield* dispatch.remove(intent);\n yield* failpoint.hit(\"cleanup:after\", intent);\n\n return true;\n },\n (effect) => bounded(\"dispatch\", effect),\n );\n\n let submissionOffset = 0;\n let intentCursor: string | undefined;\n\n const repair = repairPermit.withPermit(\n Effect.gen(function* () {\n // Respect adapter ordering, which may differ from JavaScript string comparison.\n // Deletions may defer a row until the next wrap; restarts repeat idempotent work.\n const discovery = yield* bounded(\n \"scanSubmissions\",\n ledger.scanNonterminal.pipe(\n Stream.filter((row) => row.deploymentId === config.deploymentId),\n Stream.drop(submissionOffset),\n Stream.take(config.repairBatchSize),\n Stream.runCollect,\n ),\n ).pipe(Effect.result);\n\n const submissions = Result.isSuccess(discovery) ? discovery.success : [];\n\n if (Result.isSuccess(discovery)) {\n submissionOffset =\n submissions.length < config.repairBatchSize ? 0 : submissionOffset + submissions.length;\n }\n\n const discovered = yield* Effect.forEach(submissions, (row) =>\n Effect.flatMap(intentFor(new Receipt(row)), dispatchIntent).pipe(Effect.result),\n );\n\n const outstanding = yield* bounded(\n \"scanIntents\",\n dispatch.scan(\n new WorkflowDispatchScan({\n deploymentId: config.deploymentId,\n workflowName: nativeName,\n ...(intentCursor === undefined ? {} : { after: intentCursor }),\n limit: config.repairBatchSize,\n }),\n ),\n ).pipe(Effect.result);\n\n const intents = Result.isSuccess(outstanding) ? outstanding.success : [];\n\n if (Result.isSuccess(outstanding))\n intentCursor =\n intents.length < config.repairBatchSize\n ? undefined\n : intents[intents.length - 1]?.executionId;\n\n const inspected = yield* Effect.forEach(intents, (intent) =>\n dispatchIntent(intent).pipe(Effect.result),\n );\n\n const results = [...discovered, ...inspected];\n\n if (Result.isFailure(discovery)) return yield* discovery.failure;\n if (Result.isFailure(outstanding)) return yield* outstanding.failure;\n const failure = results.find(Result.isFailure);\n\n if (failure !== undefined) return yield* Effect.fail(failure.failure);\n\n return new WorkflowRepairReport({\n discovered: submissions.length,\n inspected: intents.length,\n completed: results.filter((result) => Result.isSuccess(result) && result.success).length,\n });\n }),\n );\n\n yield* trigger.register(\n repair.pipe(\n Effect.asVoid,\n Effect.catchCause((cause) =>\n Cause.hasInterruptsOnly(cause)\n ? Effect.interrupt\n : Effect.logError(\"Workflow dispatch repair failed; durable obligations remain\", cause),\n ),\n ),\n );\n yield* Effect.addFinalizer(() => Ref.set(admission, false));\n\n const submit = Effect.fn(\"WorkflowAgentHost.submit\")(function* <InputSchema extends Schema.Top>(\n agent: DurableSubmitAgent<InputSchema>,\n input: InputSchema[\"Type\"],\n options: DurableSubmitOptions,\n ): Effect.fn.Return<\n Receipt,\n DurableSubmitFailure | WorkflowRepairFailure | WorkflowAdmissionClosed,\n InputSchema[\"EncodingServices\"]\n > {\n if (!(yield* Ref.get(admission))) {\n return yield* new WorkflowAdmissionClosed({ message: \"The Workflow host is shutting down\" });\n }\n const receipt = yield* runtime.submit(agent, input, options);\n\n yield* dispatchIntent(yield* intentFor(receipt));\n\n return receipt;\n });\n\n const execute = Effect.fn(\"AgentWorkflow.execute\")(function* <\n Input extends Schema.Top,\n Output extends Schema.Top,\n >(agent: WorkflowAgent<Input, Output>, input: Input[\"Type\"], options: WorkflowExecuteOptions) {\n const parentEngine = yield* WorkflowEngine.WorkflowEngine;\n\n if (parentEngine !== engine) {\n return yield* new WorkflowExecutionFailure({\n reason: \"engine-mismatch\",\n message: \"Agent host and parent workflow must share one WorkflowEngine Layer\",\n });\n }\n\n const name = yield* Schema.decodeEffect(Schema.NonEmptyString)(options.name).pipe(\n Effect.mapError(\n () =>\n new WorkflowExecutionFailure({\n reason: \"invalid-name\",\n message: \"Workflow agent steps need a nonempty stable name\",\n }),\n ),\n );\n\n const completion = workflowCompletion(`effect-agent/${name}`);\n const completionToken = yield* DurableDeferred.token(completion);\n\n // Agent identity and input deliberately do not participate: changing either on replay\n // must conflict with the original admission rather than launch new external work.\n const identity = yield* digestJson([\n config.deploymentId,\n config.principal,\n completionToken,\n ]).pipe(Effect.provideService(Crypto.Crypto, crypto));\n\n if (!(yield* Ref.get(admission))) {\n return yield* new WorkflowAdmissionClosed({ message: \"The Workflow host is shutting down\" });\n }\n\n const receipt = yield* runtime.submitRegistered({ definition: agent }, input, {\n threadId: ThreadId.make(`workflow/${identity}`),\n idempotencyKey: IdempotencyKey.make(identity),\n principal: config.principal,\n });\n\n yield* Effect.annotateCurrentSpan({\n \"agent.submission.id\": receipt.submissionId,\n \"agent.workflow.step\": name,\n });\n yield* runtime.submissionStatus(receipt);\n yield* dispatchIntent(\n new WorkflowDispatchIntent({ ...(yield* intentFor(receipt)), completionToken }),\n );\n\n // The deferred stores only a reference. Always reauthorize and read canonical data,\n // including on replay after the workflow engine has cached the notification.\n const reference = yield* DurableDeferred.await(completion);\n\n const record = yield* runtime.settlementRecord(receipt);\n\n if (\n reference.submissionId !== receipt.submissionId ||\n reference.threadId !== receipt.threadId ||\n reference.settlementId !== record.settlementId\n ) {\n return yield* new WorkflowDispatchError({\n operation: \"result\",\n message: \"Workflow completion disagrees with canonical Settlement\",\n });\n }\n if (record.outcome === \"failed\") {\n return yield* new WorkflowExecutionFailure({\n reason: \"failed\",\n message: \"Agent submission failed\",\n receipt,\n failure: record.result,\n });\n }\n if (record.outcome === \"aborted\") {\n return yield* new WorkflowExecutionFailure({\n reason: \"aborted\",\n message: \"Agent submission was aborted\",\n receipt,\n });\n }\n if (record.result === undefined) {\n return yield* new WorkflowExecutionFailure({\n reason: \"missing-output\",\n message: \"Completed submission has no independent output\",\n receipt,\n });\n }\n\n return yield* Schema.decodeEffect(agent.output)(record.result).pipe(\n Effect.mapError(\n (cause) =>\n new AgentOutputError({\n message: `Cannot decode canonical agent output: ${cause.message}`,\n }),\n ),\n );\n });\n\n return WorkflowAgentHost.of({\n execute,\n submit,\n awaitSettlement: runtime.awaitSettlement,\n observe: runtime.observe,\n abort: runtime.abort,\n resolveApproval: runtime.resolveApproval,\n resolveUnknown: runtime.resolveUnknown,\n submissionStatus: runtime.submissionStatus,\n repair,\n executionId: Effect.fn(\"WorkflowAgentHost.executionId\")((receipt: Receipt) =>\n intentFor(receipt).pipe(Effect.map((intent) => intent.executionId)),\n ),\n });\n});\n\n/**\n * Optional engine-independent host. Supply the upstream WorkflowEngine, the existing\n * durable runtime and ledger, durable dispatch storage, and a host-owned repair trigger.\n * Do not also start the ordinary Node worker loop. Waiter interruption only detaches;\n * abort and resolutions retain the runtime's authorization and durable intent protocol.\n */\nexport class WorkflowAgentHost extends Context.Service<\n WorkflowAgentHost,\n {\n readonly execute: <Input extends Schema.Top, Output extends Schema.Top>(\n agent: WorkflowAgent<Input, Output>,\n input: Input[\"Type\"],\n options: WorkflowExecuteOptions,\n ) => Effect.Effect<\n Output[\"Type\"],\n | DurableSubmitFailure\n | BindingUnavailable\n | DurableAwaitFailure\n | WorkflowDispatchError\n | WorkflowAdmissionClosed\n | WorkflowExecutionFailure\n | AgentOutputError,\n | Input[\"EncodingServices\"]\n | Output[\"DecodingServices\"]\n | WorkflowEngine.WorkflowInstance\n | WorkflowEngine.WorkflowEngine\n >;\n readonly submit: <InputSchema extends Schema.Top>(\n agent: DurableSubmitAgent<InputSchema>,\n input: InputSchema[\"Type\"],\n options: DurableSubmitOptions,\n ) => Effect.Effect<\n Receipt,\n DurableSubmitFailure | WorkflowRepairFailure | WorkflowAdmissionClosed,\n InputSchema[\"EncodingServices\"]\n >;\n readonly awaitSettlement: DurableAgentRuntime[\"Service\"][\"awaitSettlement\"];\n readonly observe: DurableAgentRuntime[\"Service\"][\"observe\"];\n readonly abort: DurableAgentRuntime[\"Service\"][\"abort\"];\n readonly resolveApproval: DurableAgentRuntime[\"Service\"][\"resolveApproval\"];\n readonly resolveUnknown: DurableAgentRuntime[\"Service\"][\"resolveUnknown\"];\n readonly submissionStatus: DurableAgentRuntime[\"Service\"][\"submissionStatus\"];\n readonly repair: Effect.Effect<WorkflowRepairReport, WorkflowRepairFailure>;\n readonly executionId: (receipt: Receipt) => Effect.Effect<string>;\n }\n>()(\"@effect-agent/workflow/WorkflowAgentHost\") {\n /** Drive the injected runtime, whose Layer owns executable registrations and their services. */\n static layer(options: WorkflowAgentHostOptions) {\n return Layer.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AAyC,MAAM,UAC1D,CAAC,CACL,CACF;CACF,CAAC;CAED,OAAO,kBAAkB,GAAG;EAC1B;EACA;EACA,iBAAiB,QAAQ;EACzB,SAAS,QAAQ;EACjB,OAAO,QAAQ;EACf,iBAAiB,QAAQ;EACzB,gBAAgB,QAAQ;EACxB,kBAAkB,QAAQ;EAC1B;EACA,aAAa,OAAO,GAAG,+BAA+B,CAAC,EAAE,YACvD,UAAU,OAAO,CAAC,CAAC,KAAK,OAAO,KAAK,WAAW,OAAO,WAAW,CAAC,CACpE;CACF,CAAC;AACH,CAAC;;;;;;;AAQD,IAAa,oBAAb,MAAa,0BAA0B,QAAQ,QAuC7C,CAAC,CAAC,0CAA0C,CAAC,CAAC;;CAE9C,OAAO,MAAM,SAAmC;EAC9C,OAAO,MAAM,OAAO,iBAAiB,CAAC,CAAC,SAAS,OAAO,CAAC;CAC1D;AACF"}
@@ -1,4 +1,4 @@
1
1
  import "./WorkflowDispatch.mjs";
2
- import { i as WorkflowHostConfigError, n as WorkflowAgentHost, t as WorkflowAdmissionClosed } from "./WorkflowAgentHost-DOGuS1cg.mjs";
2
+ import { i as WorkflowHostConfigError, n as WorkflowAgentHost, t as WorkflowAdmissionClosed } from "./WorkflowAgentHost-BwqWlnqZ.mjs";
3
3
  import "./WorkflowExecution.mjs";
4
4
  export { WorkflowAdmissionClosed, WorkflowAgentHost, WorkflowHostConfigError };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as WorkflowDispatch_exports } from "./WorkflowDispatch.mjs";
2
- import { r as WorkflowAgentHost_exports } from "./WorkflowAgentHost-DOGuS1cg.mjs";
2
+ import { r as WorkflowAgentHost_exports } from "./WorkflowAgentHost-BwqWlnqZ.mjs";
3
3
  import { t as WorkflowExecution_exports } from "./WorkflowExecution.mjs";
4
4
  import { t as AgentWorkflow_exports } from "./AgentWorkflow.mjs";
5
5
  export { AgentWorkflow_exports as AgentWorkflow, WorkflowAgentHost_exports as WorkflowAgentHost, WorkflowDispatch_exports as WorkflowDispatch, WorkflowExecution_exports as WorkflowExecution };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@effect-agent/workflow","version":"0.1.0-beta.83","dependencies":{"@effect-agent/core":"0.1.0-beta.83","@effect-agent/thread":"0.1.0-beta.83"},"devDependencies":{"@effect-agent/engine":"0.1.0-beta.83","@effect-agent/storage-memory":"0.1.0-beta.83","@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"}}
1
+ {"name":"@effect-agent/workflow","version":"0.1.0-beta.85","dependencies":{"@effect-agent/core":"0.1.0-beta.85","@effect-agent/thread":"0.1.0-beta.85"},"devDependencies":{"@effect-agent/engine":"0.1.0-beta.85","@effect-agent/storage-memory":"0.1.0-beta.85","@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"}}
@@ -102,7 +102,7 @@ const nativeOperation = <A, E, R>(operation: string, effect: Effect.Effect<A, E,
102
102
  );
103
103
 
104
104
  const makeHost = Effect.fn("WorkflowAgentHost.make")(function* (options: WorkflowAgentHostOptions) {
105
- const config = yield* Schema.decodeUnknownEffect(WorkflowHostConfig)({
105
+ const config = yield* Schema.decodeEffect(WorkflowHostConfig)({
106
106
  deploymentId: options.deploymentId,
107
107
  principal: options.principal,
108
108
  workflowName: options.workflowName ?? "effect-agent/Submission/v1",
@@ -456,7 +456,7 @@ const makeHost = Effect.fn("WorkflowAgentHost.make")(function* (options: Workflo
456
456
  });
457
457
  }
458
458
 
459
- const name = yield* Schema.decodeUnknownEffect(Schema.NonEmptyString)(options.name).pipe(
459
+ const name = yield* Schema.decodeEffect(Schema.NonEmptyString)(options.name).pipe(
460
460
  Effect.mapError(
461
461
  () =>
462
462
  new WorkflowExecutionFailure({
@@ -535,7 +535,7 @@ const makeHost = Effect.fn("WorkflowAgentHost.make")(function* (options: Workflo
535
535
  });
536
536
  }
537
537
 
538
- return yield* Schema.decodeUnknownEffect(agent.output)(record.result).pipe(
538
+ return yield* Schema.decodeEffect(agent.output)(record.result).pipe(
539
539
  Effect.mapError(
540
540
  (cause) =>
541
541
  new AgentOutputError({
@@ -1 +0,0 @@
1
- {"version":3,"file":"WorkflowAgentHost-DOGuS1cg.mjs","names":[],"sources":["../src/internal/completion.ts","../src/WorkflowAgentHost.ts"],"sourcesContent":["import { DurableDeferred } from \"effect/unstable/workflow\";\n\nimport { WorkflowSettlementReference } from \"../WorkflowDispatch.ts\";\n\n/** Native deferred results contain only canonical identities, never a second agent result. */\nexport const workflowCompletion = (name: string) =>\n DurableDeferred.make(name, { success: WorkflowSettlementReference });\n","import { AgentOutputError } from \"@effect-agent/core/AgentError\";\nimport { ThreadId } from \"@effect-agent/core/Identifiers\";\nimport { type BindingUnavailable } from \"@effect-agent/thread/AgentRegistration\";\nimport { digestJson } from \"@effect-agent/thread/Digest\";\nimport {\n DurableAgentRuntime,\n DurableRuntimeConfig,\n Receipt,\n type DurableAwaitFailure,\n type DurableSubmitAgent,\n type DurableSubmitFailure,\n type DurableSubmitOptions,\n} from \"@effect-agent/thread/DurableAgentRuntime\";\nimport { DeploymentId } from \"@effect-agent/thread/Records\";\nimport {\n IdempotencyKey,\n Principal,\n SubmissionLedger,\n SubmissionLookupById,\n} from \"@effect-agent/thread/SubmissionLedger\";\nimport {\n Cause,\n Context,\n Crypto,\n Effect,\n Exit,\n Layer,\n Option,\n RcMap,\n Ref,\n Result,\n Schema,\n Semaphore,\n Stream,\n} from \"effect\";\nimport { DurableDeferred, Workflow, WorkflowEngine } from \"effect/unstable/workflow\";\n\nimport { workflowCompletion } from \"./internal/completion.ts\";\nimport {\n WorkflowDispatchError,\n WorkflowDispatchFailpoint,\n WorkflowDispatchIntent,\n WorkflowDispatchScan,\n WorkflowDispatchStore,\n WorkflowRepairReport,\n WorkflowRepairTrigger,\n WorkflowSettlementReference,\n WorkflowSubmission,\n} from \"./WorkflowDispatch.ts\";\nimport {\n WorkflowExecutionFailure,\n type WorkflowAgent,\n type WorkflowExecuteOptions,\n} from \"./WorkflowExecution.ts\";\n\nconst WorkflowHostConfig = Schema.Struct({\n deploymentId: DeploymentId,\n principal: Principal,\n workflowName: Schema.NonEmptyString,\n executionConcurrency: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 64 })),\n repairBatchSize: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 1000 })),\n dispatchTimeoutMillis: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 300_000 })),\n});\n\nexport class WorkflowHostConfigError extends Schema.TaggedError<WorkflowHostConfigError>()(\n \"WorkflowHostConfigError\",\n { message: Schema.String },\n) {}\n\nexport class WorkflowAdmissionClosed extends Schema.TaggedError<WorkflowAdmissionClosed>()(\n \"WorkflowAdmissionClosed\",\n { message: Schema.String },\n) {}\n\nexport interface WorkflowAgentHostOptions {\n readonly deploymentId: string;\n /** Application-owned identity for submissions from AgentWorkflow.execute. */\n readonly principal: string;\n /** Stable versioned name prefix. The native name also includes deploymentId. */\n readonly workflowName?: string;\n /** Concurrent Attempts within this host Layer instance, not a fleet-wide limit. Default 1. */\n readonly executionConcurrency?: number;\n /** Maximum entries per scan per repair invocation. Default 32. */\n readonly repairBatchSize?: number;\n /** Bound each dispatch or scan, including a retrying native engine. Default 10000 ms. */\n readonly dispatchTimeoutMillis?: number;\n}\n\nexport type WorkflowRepairFailure = WorkflowDispatchError | DurableAwaitFailure;\n\nconst nativeOperation = <A, E, R>(operation: string, effect: Effect.Effect<A, E, R>) =>\n effect.pipe(\n Effect.catchDefect((cause) =>\n Effect.fail(\n new WorkflowDispatchError({\n operation,\n message: \"Workflow engine operation failed\",\n cause,\n }),\n ),\n ),\n );\n\nconst makeHost = Effect.fn(\"WorkflowAgentHost.make\")(function* (options: WorkflowAgentHostOptions) {\n const config = yield* Schema.decodeUnknownEffect(WorkflowHostConfig)({\n deploymentId: options.deploymentId,\n principal: options.principal,\n workflowName: options.workflowName ?? \"effect-agent/Submission/v1\",\n executionConcurrency: options.executionConcurrency ?? 1,\n repairBatchSize: options.repairBatchSize ?? 32,\n dispatchTimeoutMillis: options.dispatchTimeoutMillis ?? 10_000,\n }).pipe(Effect.mapError((error) => new WorkflowHostConfigError({ message: error.message })));\n\n const runtime = yield* DurableAgentRuntime;\n const crypto = yield* Crypto.Crypto;\n const runtimeConfig = yield* DurableRuntimeConfig;\n const ledger = yield* SubmissionLedger;\n const engine = yield* WorkflowEngine.WorkflowEngine;\n const dispatch = yield* WorkflowDispatchStore;\n const trigger = yield* WorkflowRepairTrigger;\n const failpoint = yield* WorkflowDispatchFailpoint;\n\n if (runtimeConfig.deploymentId !== config.deploymentId) {\n return yield* new WorkflowHostConfigError({\n message: \"Workflow and durable runtime deploymentId must match\",\n });\n }\n const permits = yield* Semaphore.make(config.executionConcurrency);\n const lanes = yield* RcMap.make({ lookup: (_threadId: ThreadId) => Semaphore.make(1) });\n const repairPermit = yield* Semaphore.make(1);\n const admission = yield* Ref.make(true);\n const nativeName = `${config.workflowName}/deployment/${config.deploymentId.length}:${config.deploymentId}`;\n\n const workflow = Workflow.make(nativeName, {\n payload: WorkflowSubmission,\n success: WorkflowSettlementReference,\n idempotencyKey: ({ deploymentId, receipt }) =>\n `v1/${deploymentId.length}:${deploymentId}/${receipt.submissionId}`,\n }).annotate(Workflow.SuspendOnFailure, true);\n\n const bounded = <A, E, R>(operation: string, effect: Effect.Effect<A, E, R>) =>\n nativeOperation(operation, effect).pipe(\n Effect.timeout(config.dispatchTimeoutMillis),\n Effect.catchTag(\"TimeoutError\", () =>\n Effect.fail(\n WorkflowDispatchError.make({\n operation,\n message: \"Workflow dispatch operation timed out; accepted work remains recoverable\",\n }),\n ),\n ),\n );\n\n const validateReceipt = Effect.fn(\"WorkflowAgentHost.validateReceipt\")(function* (\n receipt: Receipt,\n ) {\n const found = yield* ledger.lookup(\n SubmissionLookupById.make({ submissionId: receipt.submissionId }),\n );\n\n if (\n Option.isNone(found) ||\n found.value.deploymentId !== config.deploymentId ||\n found.value.threadId !== receipt.threadId ||\n found.value.receiptId !== receipt.receiptId ||\n found.value.queueSequence !== receipt.queueSequence\n ) {\n return yield* WorkflowDispatchError.make({\n operation: \"identity\",\n message: \"Workflow Receipt does not match its authoritative deployment and Submission\",\n });\n }\n });\n\n // No Activities: rerun journal recovery directly on every native resume. The upstream\n // failure annotation suspends infrastructure failures and defects instead of settling them.\n yield* engine.register(\n workflow,\n Effect.fn(\"WorkflowAgentHost.execute\")(function* (payload, executionId) {\n yield* Effect.annotateCurrentSpan({\n \"workflow.execution.id\": executionId,\n \"agent.submission.id\": payload.receipt.submissionId,\n \"agent.thread.id\": payload.receipt.threadId,\n });\n if (payload.deploymentId !== config.deploymentId) {\n return yield* Effect.die(\"Workflow payload belongs to another deployment\");\n }\n if (executionId !== (yield* workflow.executionId(payload))) {\n return yield* Effect.die(\"Workflow execution identity does not match its Submission\");\n }\n yield* validateReceipt(payload.receipt).pipe(Effect.orDie);\n const initial = yield* runtime.inspectSubmissionStatus(payload.receipt).pipe(Effect.orDie);\n\n if (initial._tag === \"settled\") {\n return new WorkflowSettlementReference({\n version: 1,\n submissionId: initial.settlement.submissionId,\n threadId: payload.receipt.threadId,\n settlementId: initial.settlement.settlementId,\n });\n }\n\n const status = yield* Effect.scoped(\n Effect.gen(function* () {\n // Serialize recovery and processing for one Thread even when a ledger allows\n // same-producer takeover. Followers wait without consuming a global permit.\n const lane = yield* RcMap.get(lanes, payload.receipt.threadId);\n\n return yield* lane.withPermit(\n permits.withPermit(\n Effect.scoped(\n Effect.gen(function* () {\n yield* runtime.recoverSubmission(payload.receipt.submissionId);\n const recovered = yield* runtime.inspectSubmissionStatus(payload.receipt);\n\n if (recovered._tag === \"settled\") return recovered;\n yield* runtime.processThreadHead(payload.receipt.threadId);\n\n return yield* runtime.inspectSubmissionStatus(payload.receipt);\n }),\n ),\n ),\n );\n }),\n ).pipe(Effect.orDie);\n\n if (status._tag === \"settled\") {\n return new WorkflowSettlementReference({\n version: 1,\n submissionId: status.settlement.submissionId,\n threadId: payload.receipt.threadId,\n settlementId: status.settlement.settlementId,\n });\n }\n // Release the permit and Attempt Scope before native suspension, whose lifetime may\n // outlast this process. Completion is never inferred from an empty processing result.\n const instance = yield* WorkflowEngine.WorkflowInstance;\n\n return yield* Workflow.suspend(instance);\n }),\n );\n\n const intentFor = Effect.fn(\"WorkflowAgentHost.intentFor\")(function* (receipt: Receipt) {\n const payload = new WorkflowSubmission({\n version: 1,\n deploymentId: config.deploymentId,\n receipt,\n });\n\n const executionId = yield* workflow.executionId(payload);\n\n return new WorkflowDispatchIntent({\n ...payload,\n workflowName: nativeName,\n executionId,\n });\n });\n\n const dispatchIntent = Effect.fn(\"WorkflowAgentHost.dispatch\")(\n function* (\n requested: WorkflowDispatchIntent,\n ): Effect.fn.Return<boolean, WorkflowRepairFailure> {\n let intent = requested;\n const expected = yield* intentFor(intent.receipt);\n\n if (\n intent.executionId !== expected.executionId ||\n intent.deploymentId !== expected.deploymentId ||\n intent.workflowName !== expected.workflowName\n ) {\n return yield* new WorkflowDispatchError({\n operation: \"dispatch\",\n message: \"Dispatch identity does not match the configured Workflow\",\n });\n }\n yield* validateReceipt(intent.receipt);\n yield* failpoint.hit(\"intent:before-persist\", intent);\n intent = yield* dispatch.put(intent);\n yield* failpoint.hit(\"intent:after-persist\", intent);\n yield* failpoint.hit(\"launch:before\", intent);\n // Submission lifetime belongs to the durable host. Strip the optional parent\n // instance so upstream child interruption cannot cancel this recovery workflow.\n yield* nativeOperation(\n \"execute\",\n engine\n .execute(workflow, {\n executionId: intent.executionId,\n payload: new WorkflowSubmission(intent),\n discard: true,\n })\n .pipe(\n Effect.updateContext((context: Context.Context<never>) =>\n Context.omit(WorkflowEngine.WorkflowInstance)(context),\n ),\n ),\n );\n yield* failpoint.hit(\"launch:after\", intent);\n // Resume before suspension may be a no-op. Keep the intent and retry on a later trigger.\n yield* nativeOperation(\"resume\", engine.resume(workflow, intent.executionId));\n yield* failpoint.hit(\"completion:before-observe\", intent);\n const result = yield* nativeOperation(\"poll\", engine.poll(workflow, intent.executionId));\n\n yield* failpoint.hit(\"completion:after-observe\", intent);\n if (Option.isNone(result) || result.value._tag !== \"Complete\") return false;\n if (Exit.isFailure(result.value.exit)) {\n return yield* new WorkflowDispatchError({\n operation: \"completion\",\n message: \"Native Workflow completed without a Settlement reference; intent retained\",\n cause: result.value.exit.cause,\n });\n }\n const status = yield* runtime.inspectSubmissionStatus(intent.receipt);\n const reference = result.value.exit.value;\n\n if (\n status._tag !== \"settled\" ||\n reference.version !== 1 ||\n reference.submissionId !== intent.receipt.submissionId ||\n reference.threadId !== intent.receipt.threadId ||\n reference.settlementId !== status.settlement.settlementId\n ) {\n return yield* new WorkflowDispatchError({\n operation: \"completion\",\n message: \"Native completion disagrees with canonical Settlement; intent retained\",\n });\n }\n if (intent.completionToken !== undefined) {\n yield* failpoint.hit(\"completion:before-notify\", intent);\n yield* nativeOperation(\n \"notify\",\n DurableDeferred.succeed(workflowCompletion(\"settlement\"), {\n token: intent.completionToken,\n value: reference,\n }).pipe(Effect.provideService(WorkflowEngine.WorkflowEngine, engine)),\n );\n yield* failpoint.hit(\"completion:after-notify\", intent);\n }\n yield* failpoint.hit(\"cleanup:before\", intent);\n yield* dispatch.remove(intent);\n yield* failpoint.hit(\"cleanup:after\", intent);\n\n return true;\n },\n (effect) => bounded(\"dispatch\", effect),\n );\n\n let submissionOffset = 0;\n let intentCursor: string | undefined;\n\n const repair = repairPermit.withPermit(\n Effect.gen(function* () {\n // Respect adapter ordering, which may differ from JavaScript string comparison.\n // Deletions may defer a row until the next wrap; restarts repeat idempotent work.\n const discovery = yield* bounded(\n \"scanSubmissions\",\n ledger.scanNonterminal.pipe(\n Stream.filter((row) => row.deploymentId === config.deploymentId),\n Stream.drop(submissionOffset),\n Stream.take(config.repairBatchSize),\n Stream.runCollect,\n ),\n ).pipe(Effect.result);\n\n const submissions = Result.isSuccess(discovery) ? discovery.success : [];\n\n if (Result.isSuccess(discovery)) {\n submissionOffset =\n submissions.length < config.repairBatchSize ? 0 : submissionOffset + submissions.length;\n }\n\n const discovered = yield* Effect.forEach(submissions, (row) =>\n Effect.flatMap(intentFor(new Receipt(row)), dispatchIntent).pipe(Effect.result),\n );\n\n const outstanding = yield* bounded(\n \"scanIntents\",\n dispatch.scan(\n new WorkflowDispatchScan({\n deploymentId: config.deploymentId,\n workflowName: nativeName,\n ...(intentCursor === undefined ? {} : { after: intentCursor }),\n limit: config.repairBatchSize,\n }),\n ),\n ).pipe(Effect.result);\n\n const intents = Result.isSuccess(outstanding) ? outstanding.success : [];\n\n if (Result.isSuccess(outstanding))\n intentCursor =\n intents.length < config.repairBatchSize\n ? undefined\n : intents[intents.length - 1]?.executionId;\n\n const inspected = yield* Effect.forEach(intents, (intent) =>\n dispatchIntent(intent).pipe(Effect.result),\n );\n\n const results = [...discovered, ...inspected];\n\n if (Result.isFailure(discovery)) return yield* discovery.failure;\n if (Result.isFailure(outstanding)) return yield* outstanding.failure;\n const failure = results.find(Result.isFailure);\n\n if (failure !== undefined) return yield* Effect.fail(failure.failure);\n\n return new WorkflowRepairReport({\n discovered: submissions.length,\n inspected: intents.length,\n completed: results.filter((result) => Result.isSuccess(result) && result.success).length,\n });\n }),\n );\n\n yield* trigger.register(\n repair.pipe(\n Effect.asVoid,\n Effect.catchCause((cause) =>\n Cause.hasInterruptsOnly(cause)\n ? Effect.interrupt\n : Effect.logError(\"Workflow dispatch repair failed; durable obligations remain\", cause),\n ),\n ),\n );\n yield* Effect.addFinalizer(() => Ref.set(admission, false));\n\n const submit = Effect.fn(\"WorkflowAgentHost.submit\")(function* <InputSchema extends Schema.Top>(\n agent: DurableSubmitAgent<InputSchema>,\n input: InputSchema[\"Type\"],\n options: DurableSubmitOptions,\n ): Effect.fn.Return<\n Receipt,\n DurableSubmitFailure | WorkflowRepairFailure | WorkflowAdmissionClosed,\n InputSchema[\"EncodingServices\"]\n > {\n if (!(yield* Ref.get(admission))) {\n return yield* new WorkflowAdmissionClosed({ message: \"The Workflow host is shutting down\" });\n }\n const receipt = yield* runtime.submit(agent, input, options);\n\n yield* dispatchIntent(yield* intentFor(receipt));\n\n return receipt;\n });\n\n const execute = Effect.fn(\"AgentWorkflow.execute\")(function* <\n Input extends Schema.Top,\n Output extends Schema.Top,\n >(agent: WorkflowAgent<Input, Output>, input: Input[\"Type\"], options: WorkflowExecuteOptions) {\n const parentEngine = yield* WorkflowEngine.WorkflowEngine;\n\n if (parentEngine !== engine) {\n return yield* new WorkflowExecutionFailure({\n reason: \"engine-mismatch\",\n message: \"Agent host and parent workflow must share one WorkflowEngine Layer\",\n });\n }\n\n const name = yield* Schema.decodeUnknownEffect(Schema.NonEmptyString)(options.name).pipe(\n Effect.mapError(\n () =>\n new WorkflowExecutionFailure({\n reason: \"invalid-name\",\n message: \"Workflow agent steps need a nonempty stable name\",\n }),\n ),\n );\n\n const completion = workflowCompletion(`effect-agent/${name}`);\n const completionToken = yield* DurableDeferred.token(completion);\n\n // Agent identity and input deliberately do not participate: changing either on replay\n // must conflict with the original admission rather than launch new external work.\n const identity = yield* digestJson([\n config.deploymentId,\n config.principal,\n completionToken,\n ]).pipe(Effect.provideService(Crypto.Crypto, crypto));\n\n if (!(yield* Ref.get(admission))) {\n return yield* new WorkflowAdmissionClosed({ message: \"The Workflow host is shutting down\" });\n }\n\n const receipt = yield* runtime.submitRegistered({ definition: agent }, input, {\n threadId: ThreadId.make(`workflow/${identity}`),\n idempotencyKey: IdempotencyKey.make(identity),\n principal: config.principal,\n });\n\n yield* Effect.annotateCurrentSpan({\n \"agent.submission.id\": receipt.submissionId,\n \"agent.workflow.step\": name,\n });\n yield* runtime.submissionStatus(receipt);\n yield* dispatchIntent(\n new WorkflowDispatchIntent({ ...(yield* intentFor(receipt)), completionToken }),\n );\n\n // The deferred stores only a reference. Always reauthorize and read canonical data,\n // including on replay after the workflow engine has cached the notification.\n const reference = yield* DurableDeferred.await(completion);\n\n const record = yield* runtime.settlementRecord(receipt);\n\n if (\n reference.submissionId !== receipt.submissionId ||\n reference.threadId !== receipt.threadId ||\n reference.settlementId !== record.settlementId\n ) {\n return yield* new WorkflowDispatchError({\n operation: \"result\",\n message: \"Workflow completion disagrees with canonical Settlement\",\n });\n }\n if (record.outcome === \"failed\") {\n return yield* new WorkflowExecutionFailure({\n reason: \"failed\",\n message: \"Agent submission failed\",\n receipt,\n failure: record.result,\n });\n }\n if (record.outcome === \"aborted\") {\n return yield* new WorkflowExecutionFailure({\n reason: \"aborted\",\n message: \"Agent submission was aborted\",\n receipt,\n });\n }\n if (record.result === undefined) {\n return yield* new WorkflowExecutionFailure({\n reason: \"missing-output\",\n message: \"Completed submission has no independent output\",\n receipt,\n });\n }\n\n return yield* Schema.decodeUnknownEffect(agent.output)(record.result).pipe(\n Effect.mapError(\n (cause) =>\n new AgentOutputError({\n message: `Cannot decode canonical agent output: ${cause.message}`,\n }),\n ),\n );\n });\n\n return WorkflowAgentHost.of({\n execute,\n submit,\n awaitSettlement: runtime.awaitSettlement,\n observe: runtime.observe,\n abort: runtime.abort,\n resolveApproval: runtime.resolveApproval,\n resolveUnknown: runtime.resolveUnknown,\n submissionStatus: runtime.submissionStatus,\n repair,\n executionId: Effect.fn(\"WorkflowAgentHost.executionId\")((receipt: Receipt) =>\n intentFor(receipt).pipe(Effect.map((intent) => intent.executionId)),\n ),\n });\n});\n\n/**\n * Optional engine-independent host. Supply the upstream WorkflowEngine, the existing\n * durable runtime and ledger, durable dispatch storage, and a host-owned repair trigger.\n * Do not also start the ordinary Node worker loop. Waiter interruption only detaches;\n * abort and resolutions retain the runtime's authorization and durable intent protocol.\n */\nexport class WorkflowAgentHost extends Context.Service<\n WorkflowAgentHost,\n {\n readonly execute: <Input extends Schema.Top, Output extends Schema.Top>(\n agent: WorkflowAgent<Input, Output>,\n input: Input[\"Type\"],\n options: WorkflowExecuteOptions,\n ) => Effect.Effect<\n Output[\"Type\"],\n | DurableSubmitFailure\n | BindingUnavailable\n | DurableAwaitFailure\n | WorkflowDispatchError\n | WorkflowAdmissionClosed\n | WorkflowExecutionFailure\n | AgentOutputError,\n | Input[\"EncodingServices\"]\n | Output[\"DecodingServices\"]\n | WorkflowEngine.WorkflowInstance\n | WorkflowEngine.WorkflowEngine\n >;\n readonly submit: <InputSchema extends Schema.Top>(\n agent: DurableSubmitAgent<InputSchema>,\n input: InputSchema[\"Type\"],\n options: DurableSubmitOptions,\n ) => Effect.Effect<\n Receipt,\n DurableSubmitFailure | WorkflowRepairFailure | WorkflowAdmissionClosed,\n InputSchema[\"EncodingServices\"]\n >;\n readonly awaitSettlement: DurableAgentRuntime[\"Service\"][\"awaitSettlement\"];\n readonly observe: DurableAgentRuntime[\"Service\"][\"observe\"];\n readonly abort: DurableAgentRuntime[\"Service\"][\"abort\"];\n readonly resolveApproval: DurableAgentRuntime[\"Service\"][\"resolveApproval\"];\n readonly resolveUnknown: DurableAgentRuntime[\"Service\"][\"resolveUnknown\"];\n readonly submissionStatus: DurableAgentRuntime[\"Service\"][\"submissionStatus\"];\n readonly repair: Effect.Effect<WorkflowRepairReport, WorkflowRepairFailure>;\n readonly executionId: (receipt: Receipt) => Effect.Effect<string>;\n }\n>()(\"@effect-agent/workflow/WorkflowAgentHost\") {\n /** Drive the injected runtime, whose Layer owns executable registrations and their services. */\n static layer(options: WorkflowAgentHostOptions) {\n return Layer.effect(WorkflowAgentHost)(makeHost(options));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAKA,MAAa,sBAAsB,SACjC,gBAAgB,KAAK,MAAM,EAAE,SAAS,4BAA4B,CAAC;;;;;;;;ACiDrE,MAAM,qBAAqB,OAAO,OAAO;CACvC,cAAc;CACd,WAAW;CACX,cAAc,OAAO;CACrB,sBAAsB,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS;CAAG,CAAC,CAAC;CACpF,iBAAiB,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS;CAAK,CAAC,CAAC;CACjF,uBAAuB,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS;CAAQ,CAAC,CAAC;AAC5F,CAAC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