@effect-agent/platform-node 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.
- package/dist/{NodeDurableAgentRuntime-CFElFzNF.d.mts → NodeDurableAgentRuntime-eTlQCxvz.d.mts} +7 -11
- package/dist/NodeDurableAgentRuntime.d.mts +1 -1
- package/dist/NodeDurableHost.d.mts +13 -21
- package/dist/NodeWorkflow.mjs +4 -4
- package/dist/NodeWorkflow.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/package.json +1 -1
- package/src/NodeWorkflow.ts +7 -7
package/dist/{NodeDurableAgentRuntime-CFElFzNF.d.mts → NodeDurableAgentRuntime-eTlQCxvz.d.mts}
RENAMED
|
@@ -143,12 +143,10 @@ declare class NodeDurableAgentRuntime {
|
|
|
143
143
|
/** The full DN runtime stack over one SQLite file. */
|
|
144
144
|
static layer<ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never, ReconcilerError = never, ReconcilerRequirements = never>(options: NodeDurableAgentRuntimeOptions<ContextError, ContextRequirements, AuthorizationError, AuthorizationRequirements, ReconcilerError, ReconcilerRequirements>): Layer.Layer<NodeDurableAgentRuntimeServices, AuthorizationError | ContextError | ReconcilerError | MessageDeliveryError | NodePlatformConfigError | SqliteStorageInitializationError, Exclude<AuthorizationRequirements, Crypto.Crypto> | Exclude<ContextRequirements, Crypto.Crypto> | Exclude<Exclude<Exclude<ReconcilerRequirements, Crypto.Crypto | SqlClientService.SqlClient | SqliteClient.SqliteClient | SqliteStorageConfig | SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, RunContextPreparation | RunToolAuthorization>>;
|
|
145
145
|
/** Own typed executable registrations for every worker using this Node runtime. */
|
|
146
|
-
static layerRegistered<const Entries extends ReadonlyArray<AgentRegistration>, ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never, ReconcilerError = never, ReconcilerRequirements = never>(registrations: Entries, options: NodeDurableAgentRuntimeOptions<ContextError, ContextRequirements, AuthorizationError, AuthorizationRequirements, ReconcilerError, ReconcilerRequirements>): Layer.Layer<NodeDurableAgentRuntimeServices, AuthorizationError | ContextError | ReconcilerError | import("@effect-agent/thread/Digest").DigestError | MessageDeliveryError | NodePlatformConfigError | SqliteStorageInitializationError, Exclude<AuthorizationRequirements, Crypto.Crypto> | Exclude<ContextRequirements, Crypto.Crypto> | Exclude<Exclude<Exclude<ReconcilerRequirements, Crypto.Crypto | SqlClientService.SqlClient | SqliteClient.SqliteClient | SqliteStorageConfig | SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, RunContextPreparation | RunToolAuthorization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<[Entries[number]] extends [never] ? never :
|
|
147
|
-
readonly attemptLayer: (context: import("@effect-agent/thread/AgentRegistration").AgentAttemptContext) => Layer.Layer<infer Provides, never, infer Requires>;
|
|
148
|
-
} ? Requires | Exclude<T_3 extends (infer T_4) ? T_4 extends T_3 ? T_4 extends {
|
|
146
|
+
static layerRegistered<const Entries extends ReadonlyArray<AgentRegistration>, ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never, ReconcilerError = never, ReconcilerRequirements = never>(registrations: Entries, options: NodeDurableAgentRuntimeOptions<ContextError, ContextRequirements, AuthorizationError, AuthorizationRequirements, ReconcilerError, ReconcilerRequirements>): Layer.Layer<NodeDurableAgentRuntimeServices, AuthorizationError | ContextError | ReconcilerError | import("@effect-agent/thread/Digest").DigestError | MessageDeliveryError | NodePlatformConfigError | SqliteStorageInitializationError, Exclude<AuthorizationRequirements, Crypto.Crypto> | Exclude<ContextRequirements, Crypto.Crypto> | Exclude<Exclude<Exclude<ReconcilerRequirements, Crypto.Crypto | SqlClientService.SqlClient | SqliteClient.SqliteClient | SqliteStorageConfig | SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, RunContextPreparation | RunToolAuthorization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<[Entries[number]] extends [never] ? never : Entries[number] extends (infer T_3) ? T_3 extends Entries[number] ? T_3 extends unknown ? (("attemptLayer" extends keyof T_3 ? T_3[keyof T_3 & "attemptLayer"] : undefined) extends (infer T_4) ? T_4 extends ("attemptLayer" extends keyof T_3 ? T_3[keyof T_3 & "attemptLayer"] : undefined) ? T_4 extends ((context: import("@effect-agent/thread/AgentRegistration").AgentAttemptContext) => Layer.Layer<infer Provides, never, infer Requires>) ? Requires | Exclude<T_3 extends {
|
|
149
147
|
readonly agent: infer A extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding;
|
|
150
|
-
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<A> :
|
|
151
|
-
readonly agent: infer D extends import("@effect-agent/core/Agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core/Agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown> & {
|
|
148
|
+
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<A> : T_3 extends {
|
|
149
|
+
readonly agent: infer D extends import("@effect-agent/core/Agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core/Agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined> & {
|
|
152
150
|
readonly instructions: import("@effect-agent/core/Agent").InstructionSource<never, unknown, unknown>;
|
|
153
151
|
readonly inputPrompt?: import("@effect-agent/core/Agent").InputPromptSource<never, unknown, unknown> | undefined;
|
|
154
152
|
};
|
|
@@ -156,10 +154,10 @@ declare class NodeDurableAgentRuntime {
|
|
|
156
154
|
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<{
|
|
157
155
|
readonly definition: D;
|
|
158
156
|
readonly model: M;
|
|
159
|
-
}> : never
|
|
157
|
+
}> : never, Provides> : T_3 extends {
|
|
160
158
|
readonly agent: infer A extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding;
|
|
161
159
|
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<A> : T_3 extends {
|
|
162
|
-
readonly agent: infer D extends import("@effect-agent/core/Agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core/Agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown> & {
|
|
160
|
+
readonly agent: infer D extends import("@effect-agent/core/Agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core/Agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined> & {
|
|
163
161
|
readonly instructions: import("@effect-agent/core/Agent").InstructionSource<never, unknown, unknown>;
|
|
164
162
|
readonly inputPrompt?: import("@effect-agent/core/Agent").InputPromptSource<never, unknown, unknown> | undefined;
|
|
165
163
|
};
|
|
@@ -167,13 +165,11 @@ declare class NodeDurableAgentRuntime {
|
|
|
167
165
|
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<{
|
|
168
166
|
readonly definition: D;
|
|
169
167
|
readonly model: M;
|
|
170
|
-
}> : never : never : never) | (
|
|
171
|
-
readonly reporting: infer Reports extends ReadonlyArray<import("@effect-agent/engine/SubagentHost").WorkerReporting<unknown, unknown>>;
|
|
172
|
-
} ? [Reports[number]] extends [never] ? never : Reports[number] extends import("@effect-agent/engine/SubagentHost").WorkerReporting<unknown, infer R> ? Exclude<R, import("effect/Scope").Scope> : never : never : never : never), import("effect/Scope").Scope>, DurableRuntimeConfig | MessageDeliveryStore | ScheduleStore | SubmissionLedger | ThreadStore | WakeScheduler>, DurableRuntimeFailpoint | NodeWakeSchedulerConfig | ToolReconciler>, Crypto.Crypto | SqlClientService.SqlClient | SqliteClient.SqliteClient | SqliteStorageConfig | SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, RunContextPreparation | RunToolAuthorization>>;
|
|
168
|
+
}> : never : never : never) | ("reporting" extends keyof T_3 ? T_3[keyof T_3 & "reporting"] extends (infer T_5) ? T_5 extends T_3[keyof T_3 & "reporting"] ? T_5 extends readonly import("@effect-agent/engine/SubagentHost").WorkerReporting<unknown, unknown>[] ? [T_5[number]] extends [never] ? never : T_5[number] extends import("@effect-agent/engine/SubagentHost").WorkerReporting<unknown, infer R> ? Exclude<R, import("effect/Scope").Scope> : never : never : never : never : never) : never : never : never, import("effect/Scope").Scope>, DurableRuntimeConfig | MessageDeliveryStore | ScheduleStore | SubmissionLedger | ThreadStore | WakeScheduler>, DurableRuntimeFailpoint | NodeWakeSchedulerConfig | ToolReconciler>, Crypto.Crypto | SqlClientService.SqlClient | SqliteClient.SqliteClient | SqliteStorageConfig | SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, RunContextPreparation | RunToolAuthorization>>;
|
|
173
169
|
/** Construct from registrations already resolved within the enclosing application Scope. */
|
|
174
170
|
static layerWithBindings<ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never, ReconcilerError = never, ReconcilerRequirements = never>(bindings: ReadonlyArray<ResolvedBinding>, options: NodeDurableAgentRuntimeOptions<ContextError, ContextRequirements, AuthorizationError, AuthorizationRequirements, ReconcilerError, ReconcilerRequirements>): Layer.Layer<NodeDurableAgentRuntimeServices, AuthorizationError | ContextError | ReconcilerError | MessageDeliveryError | NodePlatformConfigError | SqliteStorageInitializationError, Exclude<AuthorizationRequirements, Crypto.Crypto> | Exclude<ContextRequirements, Crypto.Crypto> | Exclude<Exclude<Exclude<ReconcilerRequirements, Crypto.Crypto | SqlClientService.SqlClient | SqliteClient.SqliteClient | SqliteStorageConfig | SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, RunContextPreparation | RunToolAuthorization>>;
|
|
175
171
|
private static assemble;
|
|
176
172
|
}
|
|
177
173
|
//#endregion
|
|
178
174
|
export { NodeDurableAgentRuntimeOptions as a, NodePlatformConfigError as c, NodeDurableAgentRuntimeInitializationError as i, ownershipDrainLayer as l, NodeDurableAgentRuntimeConfig as n, NodeDurableAgentRuntimeServices as o, NodeDurableAgentRuntimeConfigValue as r, NodeDurableAgentRuntime_d_exports as s, NodeDurableAgentRuntime as t };
|
|
179
|
-
//# sourceMappingURL=NodeDurableAgentRuntime-
|
|
175
|
+
//# sourceMappingURL=NodeDurableAgentRuntime-eTlQCxvz.d.mts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as NodeDurableAgentRuntimeOptions, c as NodePlatformConfigError, i as NodeDurableAgentRuntimeInitializationError, l as ownershipDrainLayer, n as NodeDurableAgentRuntimeConfig, o as NodeDurableAgentRuntimeServices, r as NodeDurableAgentRuntimeConfigValue, t as NodeDurableAgentRuntime } from "./NodeDurableAgentRuntime-
|
|
1
|
+
import { a as NodeDurableAgentRuntimeOptions, c as NodePlatformConfigError, i as NodeDurableAgentRuntimeInitializationError, l as ownershipDrainLayer, n as NodeDurableAgentRuntimeConfig, o as NodeDurableAgentRuntimeServices, r as NodeDurableAgentRuntimeConfigValue, t as NodeDurableAgentRuntime } from "./NodeDurableAgentRuntime-eTlQCxvz.mjs";
|
|
2
2
|
export { NodeDurableAgentRuntime, NodeDurableAgentRuntimeConfig, NodeDurableAgentRuntimeConfigValue, NodeDurableAgentRuntimeInitializationError, NodeDurableAgentRuntimeOptions, NodeDurableAgentRuntimeServices, NodePlatformConfigError, ownershipDrainLayer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as NodeWakeSchedulerConfig } from "./NodeWakeScheduler-4ZeXYwPu.mjs";
|
|
2
|
-
import { a as NodeDurableAgentRuntimeOptions, c as NodePlatformConfigError, n as NodeDurableAgentRuntimeConfig, o as NodeDurableAgentRuntimeServices } from "./NodeDurableAgentRuntime-
|
|
2
|
+
import { a as NodeDurableAgentRuntimeOptions, c as NodePlatformConfigError, n as NodeDurableAgentRuntimeConfig, o as NodeDurableAgentRuntimeServices } from "./NodeDurableAgentRuntime-eTlQCxvz.mjs";
|
|
3
3
|
import { SubmissionId, ThreadId } from "@effect-agent/core/Identifiers";
|
|
4
4
|
import { AgentRegistration, DurableBindingFailure, ResolvedBinding } from "@effect-agent/thread/AgentRegistration";
|
|
5
5
|
import { DurableAbortFailure, DurableAgentRuntime, DurableAwaitFailure, DurableExplainFailure, DurableObligationFailure, DurableObserveOptions, DurableRetryFailure, DurableSubmitAgent, DurableSubmitFailure, DurableSubmitOptions, DurableVerifyFailure, DurableWorkerFailure, Receipt, RecoveryReport } from "@effect-agent/thread/DurableAgentRuntime";
|
|
@@ -87,12 +87,10 @@ declare class NodeDurableHost extends NodeDurableHost_base {
|
|
|
87
87
|
* Startup recovery and shutdown gates are unchanged. Workers start only when the caller
|
|
88
88
|
* runs runResolvedWorkers; this constructor never starts a background worker.
|
|
89
89
|
*/
|
|
90
|
-
static layerRegistered<const Entries extends ReadonlyArray<AgentRegistration>, ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never, ReconcilerError = never, ReconcilerRequirements = never>(registrations: Entries, options: NodeDurableAgentRuntimeOptions<ContextError, ContextRequirements, AuthorizationError, AuthorizationRequirements, ReconcilerError, ReconcilerRequirements>): Layer.Layer<NodeDurableHost | NodeDurableAgentRuntimeServices, AuthorizationError | ContextError | ReconcilerError | MessageDeliveryError | NodePlatformConfigError | DurableWorkerFailure | import("@effect-agent/storage-sqlite/SqliteThreadStore").SqliteStorageInitializationError, Exclude<AuthorizationRequirements, import("effect/Crypto").Crypto> | Exclude<ContextRequirements, import("effect/Crypto").Crypto> | Exclude<Exclude<Exclude<ReconcilerRequirements, import("effect/Crypto").Crypto | import("effect/unstable/sql/SqlClient").SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient | import("@effect-agent/storage-sqlite/SqliteStorageConfig").SqliteStorageConfig | import("@effect-agent/storage-sqlite/SqliteStorageFailpoint").SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, import("@effect-agent/engine/RunOptions").RunContextPreparation | import("@effect-agent/engine/RunOptions").RunToolAuthorization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<[Entries[number]] extends [never] ? never :
|
|
91
|
-
readonly attemptLayer: (context: import("@effect-agent/thread/AgentRegistration").AgentAttemptContext) => Layer.Layer<infer Provides, never, infer Requires>;
|
|
92
|
-
} ? Requires | Exclude<T_3 extends (infer T_4) ? T_4 extends T_3 ? T_4 extends {
|
|
90
|
+
static layerRegistered<const Entries extends ReadonlyArray<AgentRegistration>, ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never, ReconcilerError = never, ReconcilerRequirements = never>(registrations: Entries, options: NodeDurableAgentRuntimeOptions<ContextError, ContextRequirements, AuthorizationError, AuthorizationRequirements, ReconcilerError, ReconcilerRequirements>): Layer.Layer<NodeDurableHost | NodeDurableAgentRuntimeServices, AuthorizationError | ContextError | ReconcilerError | MessageDeliveryError | NodePlatformConfigError | DurableWorkerFailure | import("@effect-agent/storage-sqlite/SqliteThreadStore").SqliteStorageInitializationError, Exclude<AuthorizationRequirements, import("effect/Crypto").Crypto> | Exclude<ContextRequirements, import("effect/Crypto").Crypto> | Exclude<Exclude<Exclude<ReconcilerRequirements, import("effect/Crypto").Crypto | import("effect/unstable/sql/SqlClient").SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient | import("@effect-agent/storage-sqlite/SqliteStorageConfig").SqliteStorageConfig | import("@effect-agent/storage-sqlite/SqliteStorageFailpoint").SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, import("@effect-agent/engine/RunOptions").RunContextPreparation | import("@effect-agent/engine/RunOptions").RunToolAuthorization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<[Entries[number]] extends [never] ? never : Entries[number] extends (infer T_3) ? T_3 extends Entries[number] ? T_3 extends unknown ? (("attemptLayer" extends keyof T_3 ? T_3[keyof T_3 & "attemptLayer"] : undefined) extends (infer T_4) ? T_4 extends ("attemptLayer" extends keyof T_3 ? T_3[keyof T_3 & "attemptLayer"] : undefined) ? T_4 extends ((context: import("@effect-agent/thread/AgentRegistration").AgentAttemptContext) => Layer.Layer<infer Provides, never, infer Requires>) ? Requires | Exclude<T_3 extends {
|
|
93
91
|
readonly agent: infer A extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding;
|
|
94
|
-
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<A> :
|
|
95
|
-
readonly agent: infer D extends import("@effect-agent/core/Agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core/Agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown> & {
|
|
92
|
+
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<A> : T_3 extends {
|
|
93
|
+
readonly agent: infer D extends import("@effect-agent/core/Agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core/Agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined> & {
|
|
96
94
|
readonly instructions: import("@effect-agent/core/Agent").InstructionSource<never, unknown, unknown>;
|
|
97
95
|
readonly inputPrompt?: import("@effect-agent/core/Agent").InputPromptSource<never, unknown, unknown> | undefined;
|
|
98
96
|
};
|
|
@@ -100,10 +98,10 @@ declare class NodeDurableHost extends NodeDurableHost_base {
|
|
|
100
98
|
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<{
|
|
101
99
|
readonly definition: D;
|
|
102
100
|
readonly model: M;
|
|
103
|
-
}> : never
|
|
101
|
+
}> : never, Provides> : T_3 extends {
|
|
104
102
|
readonly agent: infer A extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding;
|
|
105
103
|
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<A> : T_3 extends {
|
|
106
|
-
readonly agent: infer D extends import("@effect-agent/core/Agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core/Agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown> & {
|
|
104
|
+
readonly agent: infer D extends import("@effect-agent/core/Agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core/Agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined> & {
|
|
107
105
|
readonly instructions: import("@effect-agent/core/Agent").InstructionSource<never, unknown, unknown>;
|
|
108
106
|
readonly inputPrompt?: import("@effect-agent/core/Agent").InputPromptSource<never, unknown, unknown> | undefined;
|
|
109
107
|
};
|
|
@@ -111,9 +109,7 @@ declare class NodeDurableHost extends NodeDurableHost_base {
|
|
|
111
109
|
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<{
|
|
112
110
|
readonly definition: D;
|
|
113
111
|
readonly model: M;
|
|
114
|
-
}> : never : never : never) | (
|
|
115
|
-
readonly reporting: infer Reports extends ReadonlyArray<import("@effect-agent/engine/SubagentHost").WorkerReporting<unknown, unknown>>;
|
|
116
|
-
} ? [Reports[number]] extends [never] ? never : Reports[number] extends import("@effect-agent/engine/SubagentHost").WorkerReporting<unknown, infer R> ? Exclude<R, import("effect/Scope").Scope> : never : never : never : never), import("effect/Scope").Scope>, import("@effect-agent/thread/DurableAgentRuntime").DurableRuntimeConfig | MessageDeliveryStore | import("@effect-agent/thread/Schedule").ScheduleStore | import("@effect-agent/thread/SubmissionLedger").SubmissionLedger | import("@effect-agent/thread/ThreadStore").ThreadStore | import("@effect-agent/thread/WakeScheduler").WakeScheduler>, import("@effect-agent/thread/DurableFailpoint").DurableRuntimeFailpoint | NodeWakeSchedulerConfig | import("@effect-agent/thread/ToolReconciler").ToolReconciler>, import("effect/Crypto").Crypto | import("effect/unstable/sql/SqlClient").SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient | import("@effect-agent/storage-sqlite/SqliteStorageConfig").SqliteStorageConfig | import("@effect-agent/storage-sqlite/SqliteStorageFailpoint").SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, import("@effect-agent/engine/RunOptions").RunContextPreparation | import("@effect-agent/engine/RunOptions").RunToolAuthorization>>;
|
|
112
|
+
}> : never : never : never) | ("reporting" extends keyof T_3 ? T_3[keyof T_3 & "reporting"] extends (infer T_5) ? T_5 extends T_3[keyof T_3 & "reporting"] ? T_5 extends readonly import("@effect-agent/engine/SubagentHost").WorkerReporting<unknown, unknown>[] ? [T_5[number]] extends [never] ? never : T_5[number] extends import("@effect-agent/engine/SubagentHost").WorkerReporting<unknown, infer R> ? Exclude<R, import("effect/Scope").Scope> : never : never : never : never : never) : never : never : never, import("effect/Scope").Scope>, import("@effect-agent/thread/DurableAgentRuntime").DurableRuntimeConfig | MessageDeliveryStore | import("@effect-agent/thread/Schedule").ScheduleStore | import("@effect-agent/thread/SubmissionLedger").SubmissionLedger | import("@effect-agent/thread/ThreadStore").ThreadStore | import("@effect-agent/thread/WakeScheduler").WakeScheduler>, import("@effect-agent/thread/DurableFailpoint").DurableRuntimeFailpoint | NodeWakeSchedulerConfig | import("@effect-agent/thread/ToolReconciler").ToolReconciler>, import("effect/Crypto").Crypto | import("effect/unstable/sql/SqlClient").SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient | import("@effect-agent/storage-sqlite/SqliteStorageConfig").SqliteStorageConfig | import("@effect-agent/storage-sqlite/SqliteStorageFailpoint").SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, import("@effect-agent/engine/RunOptions").RunContextPreparation | import("@effect-agent/engine/RunOptions").RunToolAuthorization>>;
|
|
117
113
|
/**
|
|
118
114
|
* Host gates over an assembled `NodeDurableAgentRuntime` stack. The runtime Layer owns
|
|
119
115
|
* executable registrations; omission registers no Agents, so resolved work fails closed.
|
|
@@ -130,12 +126,10 @@ declare class NodeDurableHost extends NodeDurableHost_base {
|
|
|
130
126
|
* shares the same pool. A worker failure closes admission; observe it with `run` at the process
|
|
131
127
|
* boundary so the application exits and releases the host instead of remaining idle.
|
|
132
128
|
*/
|
|
133
|
-
declare const layer: <const Entries extends ReadonlyArray<AgentRegistration>, ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never, ReconcilerError = never, ReconcilerRequirements = never>(registrations: Entries, options: NodeDurableAgentRuntimeOptions<ContextError, ContextRequirements, AuthorizationError, AuthorizationRequirements, ReconcilerError, ReconcilerRequirements>) => Layer.Layer<NodeDurableHost | NodeDurableAgentRuntimeServices, AuthorizationError | ContextError | ReconcilerError | MessageDeliveryError | NodePlatformConfigError | DurableWorkerFailure | import("@effect-agent/storage-sqlite/SqliteThreadStore").SqliteStorageInitializationError, Exclude<AuthorizationRequirements, import("effect/Crypto").Crypto> | Exclude<ContextRequirements, import("effect/Crypto").Crypto> | Exclude<Exclude<Exclude<ReconcilerRequirements, import("effect/Crypto").Crypto | import("effect/unstable/sql/SqlClient").SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient | import("@effect-agent/storage-sqlite/SqliteStorageConfig").SqliteStorageConfig | import("@effect-agent/storage-sqlite/SqliteStorageFailpoint").SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, import("@effect-agent/engine/RunOptions").RunContextPreparation | import("@effect-agent/engine/RunOptions").RunToolAuthorization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<[Entries[number]] extends [never] ? never :
|
|
134
|
-
readonly attemptLayer: (context: import("@effect-agent/thread/AgentRegistration").AgentAttemptContext) => Layer.Layer<infer Provides, never, infer Requires>;
|
|
135
|
-
} ? Requires | Exclude<T_3 extends (infer T_4) ? T_4 extends T_3 ? T_4 extends {
|
|
129
|
+
declare const layer: <const Entries extends ReadonlyArray<AgentRegistration>, ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never, ReconcilerError = never, ReconcilerRequirements = never>(registrations: Entries, options: NodeDurableAgentRuntimeOptions<ContextError, ContextRequirements, AuthorizationError, AuthorizationRequirements, ReconcilerError, ReconcilerRequirements>) => Layer.Layer<NodeDurableHost | NodeDurableAgentRuntimeServices, AuthorizationError | ContextError | ReconcilerError | MessageDeliveryError | NodePlatformConfigError | DurableWorkerFailure | import("@effect-agent/storage-sqlite/SqliteThreadStore").SqliteStorageInitializationError, Exclude<AuthorizationRequirements, import("effect/Crypto").Crypto> | Exclude<ContextRequirements, import("effect/Crypto").Crypto> | Exclude<Exclude<Exclude<ReconcilerRequirements, import("effect/Crypto").Crypto | import("effect/unstable/sql/SqlClient").SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient | import("@effect-agent/storage-sqlite/SqliteStorageConfig").SqliteStorageConfig | import("@effect-agent/storage-sqlite/SqliteStorageFailpoint").SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, import("@effect-agent/engine/RunOptions").RunContextPreparation | import("@effect-agent/engine/RunOptions").RunToolAuthorization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<[Entries[number]] extends [never] ? never : Entries[number] extends (infer T_3) ? T_3 extends Entries[number] ? T_3 extends unknown ? (("attemptLayer" extends keyof T_3 ? T_3[keyof T_3 & "attemptLayer"] : undefined) extends (infer T_4) ? T_4 extends ("attemptLayer" extends keyof T_3 ? T_3[keyof T_3 & "attemptLayer"] : undefined) ? T_4 extends ((context: import("@effect-agent/thread/AgentRegistration").AgentAttemptContext) => Layer.Layer<infer Provides, never, infer Requires>) ? Requires | Exclude<T_3 extends {
|
|
136
130
|
readonly agent: infer A extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding;
|
|
137
|
-
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<A> :
|
|
138
|
-
readonly agent: infer D extends import("@effect-agent/core/Agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core/Agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown> & {
|
|
131
|
+
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<A> : T_3 extends {
|
|
132
|
+
readonly agent: infer D extends import("@effect-agent/core/Agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core/Agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined> & {
|
|
139
133
|
readonly instructions: import("@effect-agent/core/Agent").InstructionSource<never, unknown, unknown>;
|
|
140
134
|
readonly inputPrompt?: import("@effect-agent/core/Agent").InputPromptSource<never, unknown, unknown> | undefined;
|
|
141
135
|
};
|
|
@@ -143,10 +137,10 @@ declare const layer: <const Entries extends ReadonlyArray<AgentRegistration>, Co
|
|
|
143
137
|
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<{
|
|
144
138
|
readonly definition: D;
|
|
145
139
|
readonly model: M;
|
|
146
|
-
}> : never
|
|
140
|
+
}> : never, Provides> : T_3 extends {
|
|
147
141
|
readonly agent: infer A extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding;
|
|
148
142
|
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<A> : T_3 extends {
|
|
149
|
-
readonly agent: infer D extends import("@effect-agent/core/Agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core/Agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown> & {
|
|
143
|
+
readonly agent: infer D extends import("@effect-agent/core/Agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core/Agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined> & {
|
|
150
144
|
readonly instructions: import("@effect-agent/core/Agent").InstructionSource<never, unknown, unknown>;
|
|
151
145
|
readonly inputPrompt?: import("@effect-agent/core/Agent").InputPromptSource<never, unknown, unknown> | undefined;
|
|
152
146
|
};
|
|
@@ -154,9 +148,7 @@ declare const layer: <const Entries extends ReadonlyArray<AgentRegistration>, Co
|
|
|
154
148
|
} ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<{
|
|
155
149
|
readonly definition: D;
|
|
156
150
|
readonly model: M;
|
|
157
|
-
}> : never : never : never) | (
|
|
158
|
-
readonly reporting: infer Reports extends ReadonlyArray<import("@effect-agent/engine/SubagentHost").WorkerReporting<unknown, unknown>>;
|
|
159
|
-
} ? [Reports[number]] extends [never] ? never : Reports[number] extends import("@effect-agent/engine/SubagentHost").WorkerReporting<unknown, infer R> ? Exclude<R, import("effect/Scope").Scope> : never : never : never : never), import("effect/Scope").Scope>, import("@effect-agent/thread/DurableAgentRuntime").DurableRuntimeConfig | MessageDeliveryStore | import("@effect-agent/thread/Schedule").ScheduleStore | import("@effect-agent/thread/SubmissionLedger").SubmissionLedger | import("@effect-agent/thread/ThreadStore").ThreadStore | import("@effect-agent/thread/WakeScheduler").WakeScheduler>, import("@effect-agent/thread/DurableFailpoint").DurableRuntimeFailpoint | NodeWakeSchedulerConfig | import("@effect-agent/thread/ToolReconciler").ToolReconciler>, import("effect/Crypto").Crypto | import("effect/unstable/sql/SqlClient").SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient | import("@effect-agent/storage-sqlite/SqliteStorageConfig").SqliteStorageConfig | import("@effect-agent/storage-sqlite/SqliteStorageFailpoint").SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, import("@effect-agent/engine/RunOptions").RunContextPreparation | import("@effect-agent/engine/RunOptions").RunToolAuthorization>>;
|
|
151
|
+
}> : never : never : never) | ("reporting" extends keyof T_3 ? T_3[keyof T_3 & "reporting"] extends (infer T_5) ? T_5 extends T_3[keyof T_3 & "reporting"] ? T_5 extends readonly import("@effect-agent/engine/SubagentHost").WorkerReporting<unknown, unknown>[] ? [T_5[number]] extends [never] ? never : T_5[number] extends import("@effect-agent/engine/SubagentHost").WorkerReporting<unknown, infer R> ? Exclude<R, import("effect/Scope").Scope> : never : never : never : never : never) : never : never : never, import("effect/Scope").Scope>, import("@effect-agent/thread/DurableAgentRuntime").DurableRuntimeConfig | MessageDeliveryStore | import("@effect-agent/thread/Schedule").ScheduleStore | import("@effect-agent/thread/SubmissionLedger").SubmissionLedger | import("@effect-agent/thread/ThreadStore").ThreadStore | import("@effect-agent/thread/WakeScheduler").WakeScheduler>, import("@effect-agent/thread/DurableFailpoint").DurableRuntimeFailpoint | NodeWakeSchedulerConfig | import("@effect-agent/thread/ToolReconciler").ToolReconciler>, import("effect/Crypto").Crypto | import("effect/unstable/sql/SqlClient").SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient | import("@effect-agent/storage-sqlite/SqliteStorageConfig").SqliteStorageConfig | import("@effect-agent/storage-sqlite/SqliteStorageFailpoint").SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, import("@effect-agent/engine/RunOptions").RunContextPreparation | import("@effect-agent/engine/RunOptions").RunToolAuthorization>>;
|
|
160
152
|
/**
|
|
161
153
|
* Supervise the host's existing workers without starting another pool. Use with
|
|
162
154
|
* `Effect.provide(HostLive)` and `NodeRuntime.runMain`; race it with a server Effect when
|
package/dist/NodeWorkflow.mjs
CHANGED
|
@@ -49,7 +49,7 @@ var SqlWorkflowDispatchStore = class {
|
|
|
49
49
|
ON effect_agent_workflow_dispatch (deployment_id, workflow_name, execution_id)
|
|
50
50
|
`;
|
|
51
51
|
const put = Effect.fn("SqlWorkflowDispatchStore.put")(function* (input) {
|
|
52
|
-
const intent = yield* Schema.
|
|
52
|
+
const intent = yield* Schema.decodeEffect(WorkflowDispatchIntent)(input);
|
|
53
53
|
const encoded = yield* encodeIntent(intent);
|
|
54
54
|
yield* sql`
|
|
55
55
|
INSERT INTO effect_agent_workflow_dispatch
|
|
@@ -90,7 +90,7 @@ var SqlWorkflowDispatchStore = class {
|
|
|
90
90
|
return merged;
|
|
91
91
|
}, sql.withTransaction, Effect.mapError(dispatchError("put")));
|
|
92
92
|
const scan = Effect.fn("SqlWorkflowDispatchStore.scan")(function* (input) {
|
|
93
|
-
const request = yield* Schema.
|
|
93
|
+
const request = yield* Schema.decodeEffect(WorkflowDispatchScan)(input);
|
|
94
94
|
const rows = yield* sql`
|
|
95
95
|
SELECT deployment_id, workflow_name, execution_id, intent_json
|
|
96
96
|
FROM effect_agent_workflow_dispatch
|
|
@@ -103,7 +103,7 @@ var SqlWorkflowDispatchStore = class {
|
|
|
103
103
|
return yield* Effect.forEach(rows, decodeRow);
|
|
104
104
|
}, Effect.mapError(dispatchError("scan")));
|
|
105
105
|
const remove = Effect.fn("SqlWorkflowDispatchStore.remove")(function* (input) {
|
|
106
|
-
const intent = yield* Schema.
|
|
106
|
+
const intent = yield* Schema.decodeEffect(WorkflowDispatchIntent)(input);
|
|
107
107
|
const rows = yield* sql`
|
|
108
108
|
SELECT deployment_id, workflow_name, execution_id, intent_json
|
|
109
109
|
FROM effect_agent_workflow_dispatch
|
|
@@ -141,7 +141,7 @@ var NodeWorkflowRepairTrigger = class {
|
|
|
141
141
|
if (Option.isNone(interval) || !Duration.isFinite(interval.value) || !Duration.isPositive(interval.value)) return yield* new NodeWorkflowRepairConfigError({ message: "Workflow repair interval must be finite and greater than zero" });
|
|
142
142
|
const delay = interval.value;
|
|
143
143
|
return WorkflowRepairTrigger.of({ register: Effect.fn("NodeWorkflowRepairTrigger.register")(function* (repair) {
|
|
144
|
-
const attempt = repair.pipe(Effect.
|
|
144
|
+
const attempt = repair.pipe(Effect.catchCauseIf((cause) => !Cause.hasInterruptsOnly(cause), (cause) => Effect.logError("Workflow repair trigger failed; next poll will retry", cause)));
|
|
145
145
|
yield* attempt;
|
|
146
146
|
yield* Effect.gen(function* () {
|
|
147
147
|
while (true) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeWorkflow.mjs","names":[],"sources":["../src/NodeWorkflow.ts"],"sourcesContent":["import {\n WorkflowDispatchError,\n WorkflowDispatchIntent,\n WorkflowDispatchScan,\n WorkflowDispatchStore,\n WorkflowRepairTrigger,\n} from \"@effect-agent/workflow/WorkflowDispatch\";\nimport { Cause, Duration, Effect, Layer, Option, Schema } from \"effect\";\nimport { SqlClient } from \"effect/unstable/sql\";\n\nconst StoredIntent = Schema.Struct({\n deployment_id: Schema.String,\n workflow_name: Schema.String,\n execution_id: Schema.String,\n intent_json: Schema.String,\n});\n\nconst IntentJson = Schema.fromJsonString(WorkflowDispatchIntent);\nconst decodeIntent = Schema.decodeUnknownEffect(IntentJson, { onExcessProperty: \"error\" });\nconst encodeIntent = Schema.encodeEffect(IntentJson);\n\nconst dispatchError = (operation: string) => (cause: unknown) =>\n Schema.is(WorkflowDispatchError)(cause)\n ? cause\n : new WorkflowDispatchError({\n operation,\n message: \"Workflow dispatch storage failed or contains incompatible data\",\n cause,\n });\n\nconst decodeRow = Effect.fn(\"SqlWorkflowDispatchStore.decodeRow\")(function* (value: unknown) {\n const row = yield* Schema.decodeUnknownEffect(StoredIntent, { onExcessProperty: \"error\" })(value);\n const intent = yield* decodeIntent(row.intent_json);\n\n if (\n row.deployment_id !== intent.deploymentId ||\n row.workflow_name !== intent.workflowName ||\n row.execution_id !== intent.executionId\n ) {\n return yield* new WorkflowDispatchError({\n operation: \"decode\",\n message: \"Stored Workflow dispatch identity disagrees with its intent\",\n });\n }\n\n return intent;\n});\n\n/**\n * Durable dispatch outbox over an application-supplied SqlClient. This adapter uses\n * SQLite/PostgreSQL SQL syntax and is certified with SQLite. It does not own an engine\n * or a database connection. Agent admission, dispatch persistence, and native Workflow\n * storage are separate commits; the registered repair trigger closes those gaps.\n * Stored version or shape mismatches fail typed and require an explicit data reset.\n */\nexport class SqlWorkflowDispatchStore {\n static readonly layer: Layer.Layer<\n WorkflowDispatchStore,\n WorkflowDispatchError,\n SqlClient.SqlClient\n > = Layer.effect(WorkflowDispatchStore)(\n Effect.gen(function* () {\n const sql = (yield* SqlClient.SqlClient).withoutTransforms();\n\n yield* sql`\n CREATE TABLE IF NOT EXISTS effect_agent_workflow_dispatch (\n workflow_name TEXT NOT NULL,\n execution_id TEXT NOT NULL,\n deployment_id TEXT NOT NULL,\n intent_json TEXT NOT NULL,\n PRIMARY KEY (workflow_name, execution_id)\n )\n `;\n yield* sql`\n CREATE INDEX IF NOT EXISTS effect_agent_workflow_dispatch_scan\n ON effect_agent_workflow_dispatch (deployment_id, workflow_name, execution_id)\n `;\n\n const put = Effect.fn(\"SqlWorkflowDispatchStore.put\")(\n function* (input: WorkflowDispatchIntent) {\n const intent = yield* Schema.decodeUnknownEffect(WorkflowDispatchIntent)(input);\n const encoded = yield* encodeIntent(intent);\n\n yield* sql`\n INSERT INTO effect_agent_workflow_dispatch\n (workflow_name, execution_id, deployment_id, intent_json)\n VALUES (${intent.workflowName}, ${intent.executionId}, ${intent.deploymentId}, ${encoded})\n ON CONFLICT (workflow_name, execution_id) DO NOTHING\n `;\n\n const rows = yield* sql`\n SELECT deployment_id, workflow_name, execution_id, intent_json\n FROM effect_agent_workflow_dispatch\n WHERE workflow_name = ${intent.workflowName} AND execution_id = ${intent.executionId}\n `;\n\n const existing = yield* decodeRow(rows[0]);\n\n const merged = new WorkflowDispatchIntent({\n ...intent,\n ...(existing.completionToken === undefined\n ? {}\n : { completionToken: existing.completionToken }),\n });\n\n if (\n (yield* encodeIntent(\n new WorkflowDispatchIntent({\n ...existing,\n ...(merged.completionToken === undefined\n ? {}\n : { completionToken: merged.completionToken }),\n }),\n )) !== (yield* encodeIntent(merged)) ||\n (intent.completionToken !== undefined &&\n existing.completionToken !== undefined &&\n intent.completionToken !== existing.completionToken)\n ) {\n return yield* new WorkflowDispatchError({\n operation: \"put\",\n message: \"Workflow dispatch identity already belongs to a different immutable intent\",\n });\n }\n const retained = yield* encodeIntent(merged);\n const previous = yield* encodeIntent(existing);\n\n if (retained !== previous) {\n const updated = yield* sql`\n UPDATE effect_agent_workflow_dispatch SET intent_json = ${retained}\n WHERE workflow_name = ${intent.workflowName} AND execution_id = ${intent.executionId}\n AND intent_json = ${previous}\n RETURNING execution_id\n `;\n\n if (updated.length !== 1) {\n return yield* new WorkflowDispatchError({\n operation: \"put\",\n message: \"Dispatch intent changed while attaching its completion token\",\n });\n }\n }\n\n return merged;\n },\n sql.withTransaction,\n Effect.mapError(dispatchError(\"put\")),\n );\n\n const scan = Effect.fn(\"SqlWorkflowDispatchStore.scan\")(\n function* (input: WorkflowDispatchScan) {\n const request = yield* Schema.decodeUnknownEffect(WorkflowDispatchScan)(input);\n\n const rows = yield* sql`\n SELECT deployment_id, workflow_name, execution_id, intent_json\n FROM effect_agent_workflow_dispatch\n WHERE deployment_id = ${request.deploymentId}\n AND workflow_name = ${request.workflowName}\n AND execution_id > ${request.after ?? \"\"}\n ORDER BY execution_id ASC\n LIMIT ${request.limit}\n `;\n\n return yield* Effect.forEach(rows, decodeRow);\n },\n Effect.mapError(dispatchError(\"scan\")),\n );\n\n const remove = Effect.fn(\"SqlWorkflowDispatchStore.remove\")(\n function* (input: WorkflowDispatchIntent) {\n const intent = yield* Schema.decodeUnknownEffect(WorkflowDispatchIntent)(input);\n\n const rows = yield* sql`\n SELECT deployment_id, workflow_name, execution_id, intent_json\n FROM effect_agent_workflow_dispatch\n WHERE workflow_name = ${intent.workflowName} AND execution_id = ${intent.executionId}\n `;\n\n if (rows.length === 0) return;\n const existing = yield* decodeRow(rows[0]);\n\n if ((yield* encodeIntent(existing)) !== (yield* encodeIntent(intent))) {\n return yield* new WorkflowDispatchError({\n operation: \"remove\",\n message: \"Cannot remove a different immutable Workflow dispatch intent\",\n });\n }\n\n const removed = yield* sql`\n DELETE FROM effect_agent_workflow_dispatch\n WHERE workflow_name = ${intent.workflowName} AND execution_id = ${intent.executionId}\n AND intent_json = ${yield* encodeIntent(intent)}\n RETURNING execution_id\n `;\n\n if (removed.length !== 1) {\n return yield* new WorkflowDispatchError({\n operation: \"remove\",\n message: \"Dispatch intent changed before cleanup\",\n });\n }\n },\n sql.withTransaction,\n Effect.mapError(dispatchError(\"remove\")),\n );\n\n return WorkflowDispatchStore.of({ put, scan, remove });\n }).pipe(Effect.mapError(dispatchError(\"initialize\"))),\n );\n}\n\nexport class NodeWorkflowRepairConfigError extends Schema.TaggedError<NodeWorkflowRepairConfigError>()(\n \"NodeWorkflowRepairConfigError\",\n { message: Schema.String },\n) {}\n\n/** A host-scoped startup and polling trigger. No ordinary Node agent worker is started. */\nexport class NodeWorkflowRepairTrigger {\n static layer(\n options: { readonly interval?: Duration.Input } = {},\n ): Layer.Layer<WorkflowRepairTrigger, NodeWorkflowRepairConfigError> {\n return Layer.effect(WorkflowRepairTrigger)(\n Effect.gen(function* () {\n const interval = Duration.fromInput(options.interval ?? \"1 second\");\n\n if (\n Option.isNone(interval) ||\n !Duration.isFinite(interval.value) ||\n !Duration.isPositive(interval.value)\n ) {\n return yield* new NodeWorkflowRepairConfigError({\n message: \"Workflow repair interval must be finite and greater than zero\",\n });\n }\n const delay = interval.value;\n\n return WorkflowRepairTrigger.of({\n register: Effect.fn(\"NodeWorkflowRepairTrigger.register\")(function* (repair) {\n const attempt = repair.pipe(\n Effect.catchCause((cause) =>\n Cause.hasInterruptsOnly(cause)\n ? Effect.failCause(cause)\n : Effect.logError(\"Workflow repair trigger failed; next poll will retry\", cause),\n ),\n );\n\n yield* attempt;\n yield* Effect.gen(function* () {\n while (true) {\n yield* Effect.sleep(delay);\n yield* attempt;\n }\n }).pipe(Effect.forkScoped);\n }),\n });\n }),\n );\n }\n}\n"],"mappings":";;;;AAUA,MAAM,eAAe,OAAO,OAAO;CACjC,eAAe,OAAO;CACtB,eAAe,OAAO;CACtB,cAAc,OAAO;CACrB,aAAa,OAAO;AACtB,CAAC;AAED,MAAM,aAAa,OAAO,eAAe,sBAAsB;AAC/D,MAAM,eAAe,OAAO,oBAAoB,YAAY,EAAE,kBAAkB,QAAQ,CAAC;AACzF,MAAM,eAAe,OAAO,aAAa,UAAU;AAEnD,MAAM,iBAAiB,eAAuB,UAC5C,OAAO,GAAG,qBAAqB,CAAC,CAAC,KAAK,IAClC,QACA,IAAI,sBAAsB;CACxB;CACA,SAAS;CACT;AACF,CAAC;AAEP,MAAM,YAAY,OAAO,GAAG,oCAAoC,CAAC,CAAC,WAAW,OAAgB;CAC3F,MAAM,MAAM,OAAO,OAAO,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
{"version":3,"file":"NodeWorkflow.mjs","names":[],"sources":["../src/NodeWorkflow.ts"],"sourcesContent":["import {\n WorkflowDispatchError,\n WorkflowDispatchIntent,\n WorkflowDispatchScan,\n WorkflowDispatchStore,\n WorkflowRepairTrigger,\n} from \"@effect-agent/workflow/WorkflowDispatch\";\nimport { Cause, Duration, Effect, Layer, Option, Schema } from \"effect\";\nimport { SqlClient } from \"effect/unstable/sql\";\n\nconst StoredIntent = Schema.Struct({\n deployment_id: Schema.String,\n workflow_name: Schema.String,\n execution_id: Schema.String,\n intent_json: Schema.String,\n});\n\nconst IntentJson = Schema.fromJsonString(WorkflowDispatchIntent);\nconst decodeIntent = Schema.decodeUnknownEffect(IntentJson, { onExcessProperty: \"error\" });\nconst encodeIntent = Schema.encodeEffect(IntentJson);\n\nconst dispatchError = (operation: string) => (cause: unknown) =>\n Schema.is(WorkflowDispatchError)(cause)\n ? cause\n : new WorkflowDispatchError({\n operation,\n message: \"Workflow dispatch storage failed or contains incompatible data\",\n cause,\n });\n\nconst decodeRow = Effect.fn(\"SqlWorkflowDispatchStore.decodeRow\")(function* (value: unknown) {\n const row = yield* Schema.decodeUnknownEffect(StoredIntent, { onExcessProperty: \"error\" })(value);\n const intent = yield* decodeIntent(row.intent_json);\n\n if (\n row.deployment_id !== intent.deploymentId ||\n row.workflow_name !== intent.workflowName ||\n row.execution_id !== intent.executionId\n ) {\n return yield* new WorkflowDispatchError({\n operation: \"decode\",\n message: \"Stored Workflow dispatch identity disagrees with its intent\",\n });\n }\n\n return intent;\n});\n\n/**\n * Durable dispatch outbox over an application-supplied SqlClient. This adapter uses\n * SQLite/PostgreSQL SQL syntax and is certified with SQLite. It does not own an engine\n * or a database connection. Agent admission, dispatch persistence, and native Workflow\n * storage are separate commits; the registered repair trigger closes those gaps.\n * Stored version or shape mismatches fail typed and require an explicit data reset.\n */\nexport class SqlWorkflowDispatchStore {\n static readonly layer: Layer.Layer<\n WorkflowDispatchStore,\n WorkflowDispatchError,\n SqlClient.SqlClient\n > = Layer.effect(WorkflowDispatchStore)(\n Effect.gen(function* () {\n const sql = (yield* SqlClient.SqlClient).withoutTransforms();\n\n yield* sql`\n CREATE TABLE IF NOT EXISTS effect_agent_workflow_dispatch (\n workflow_name TEXT NOT NULL,\n execution_id TEXT NOT NULL,\n deployment_id TEXT NOT NULL,\n intent_json TEXT NOT NULL,\n PRIMARY KEY (workflow_name, execution_id)\n )\n `;\n yield* sql`\n CREATE INDEX IF NOT EXISTS effect_agent_workflow_dispatch_scan\n ON effect_agent_workflow_dispatch (deployment_id, workflow_name, execution_id)\n `;\n\n const put = Effect.fn(\"SqlWorkflowDispatchStore.put\")(\n function* (input: WorkflowDispatchIntent) {\n const intent = yield* Schema.decodeEffect(WorkflowDispatchIntent)(input);\n const encoded = yield* encodeIntent(intent);\n\n yield* sql`\n INSERT INTO effect_agent_workflow_dispatch\n (workflow_name, execution_id, deployment_id, intent_json)\n VALUES (${intent.workflowName}, ${intent.executionId}, ${intent.deploymentId}, ${encoded})\n ON CONFLICT (workflow_name, execution_id) DO NOTHING\n `;\n\n const rows = yield* sql`\n SELECT deployment_id, workflow_name, execution_id, intent_json\n FROM effect_agent_workflow_dispatch\n WHERE workflow_name = ${intent.workflowName} AND execution_id = ${intent.executionId}\n `;\n\n const existing = yield* decodeRow(rows[0]);\n\n const merged = new WorkflowDispatchIntent({\n ...intent,\n ...(existing.completionToken === undefined\n ? {}\n : { completionToken: existing.completionToken }),\n });\n\n if (\n (yield* encodeIntent(\n new WorkflowDispatchIntent({\n ...existing,\n ...(merged.completionToken === undefined\n ? {}\n : { completionToken: merged.completionToken }),\n }),\n )) !== (yield* encodeIntent(merged)) ||\n (intent.completionToken !== undefined &&\n existing.completionToken !== undefined &&\n intent.completionToken !== existing.completionToken)\n ) {\n return yield* new WorkflowDispatchError({\n operation: \"put\",\n message: \"Workflow dispatch identity already belongs to a different immutable intent\",\n });\n }\n const retained = yield* encodeIntent(merged);\n const previous = yield* encodeIntent(existing);\n\n if (retained !== previous) {\n const updated = yield* sql`\n UPDATE effect_agent_workflow_dispatch SET intent_json = ${retained}\n WHERE workflow_name = ${intent.workflowName} AND execution_id = ${intent.executionId}\n AND intent_json = ${previous}\n RETURNING execution_id\n `;\n\n if (updated.length !== 1) {\n return yield* new WorkflowDispatchError({\n operation: \"put\",\n message: \"Dispatch intent changed while attaching its completion token\",\n });\n }\n }\n\n return merged;\n },\n sql.withTransaction,\n Effect.mapError(dispatchError(\"put\")),\n );\n\n const scan = Effect.fn(\"SqlWorkflowDispatchStore.scan\")(\n function* (input: WorkflowDispatchScan) {\n const request = yield* Schema.decodeEffect(WorkflowDispatchScan)(input);\n\n const rows = yield* sql`\n SELECT deployment_id, workflow_name, execution_id, intent_json\n FROM effect_agent_workflow_dispatch\n WHERE deployment_id = ${request.deploymentId}\n AND workflow_name = ${request.workflowName}\n AND execution_id > ${request.after ?? \"\"}\n ORDER BY execution_id ASC\n LIMIT ${request.limit}\n `;\n\n return yield* Effect.forEach(rows, decodeRow);\n },\n Effect.mapError(dispatchError(\"scan\")),\n );\n\n const remove = Effect.fn(\"SqlWorkflowDispatchStore.remove\")(\n function* (input: WorkflowDispatchIntent) {\n const intent = yield* Schema.decodeEffect(WorkflowDispatchIntent)(input);\n\n const rows = yield* sql`\n SELECT deployment_id, workflow_name, execution_id, intent_json\n FROM effect_agent_workflow_dispatch\n WHERE workflow_name = ${intent.workflowName} AND execution_id = ${intent.executionId}\n `;\n\n if (rows.length === 0) return;\n const existing = yield* decodeRow(rows[0]);\n\n if ((yield* encodeIntent(existing)) !== (yield* encodeIntent(intent))) {\n return yield* new WorkflowDispatchError({\n operation: \"remove\",\n message: \"Cannot remove a different immutable Workflow dispatch intent\",\n });\n }\n\n const removed = yield* sql`\n DELETE FROM effect_agent_workflow_dispatch\n WHERE workflow_name = ${intent.workflowName} AND execution_id = ${intent.executionId}\n AND intent_json = ${yield* encodeIntent(intent)}\n RETURNING execution_id\n `;\n\n if (removed.length !== 1) {\n return yield* new WorkflowDispatchError({\n operation: \"remove\",\n message: \"Dispatch intent changed before cleanup\",\n });\n }\n },\n sql.withTransaction,\n Effect.mapError(dispatchError(\"remove\")),\n );\n\n return WorkflowDispatchStore.of({ put, scan, remove });\n }).pipe(Effect.mapError(dispatchError(\"initialize\"))),\n );\n}\n\nexport class NodeWorkflowRepairConfigError extends Schema.TaggedError<NodeWorkflowRepairConfigError>()(\n \"NodeWorkflowRepairConfigError\",\n { message: Schema.String },\n) {}\n\n/** A host-scoped startup and polling trigger. No ordinary Node agent worker is started. */\nexport class NodeWorkflowRepairTrigger {\n static layer(\n options: { readonly interval?: Duration.Input } = {},\n ): Layer.Layer<WorkflowRepairTrigger, NodeWorkflowRepairConfigError> {\n return Layer.effect(WorkflowRepairTrigger)(\n Effect.gen(function* () {\n const interval = Duration.fromInput(options.interval ?? \"1 second\");\n\n if (\n Option.isNone(interval) ||\n !Duration.isFinite(interval.value) ||\n !Duration.isPositive(interval.value)\n ) {\n return yield* new NodeWorkflowRepairConfigError({\n message: \"Workflow repair interval must be finite and greater than zero\",\n });\n }\n const delay = interval.value;\n\n return WorkflowRepairTrigger.of({\n register: Effect.fn(\"NodeWorkflowRepairTrigger.register\")(function* (repair) {\n const attempt = repair.pipe(\n Effect.catchCauseIf(\n (cause) => !Cause.hasInterruptsOnly(cause),\n (cause) =>\n Effect.logError(\"Workflow repair trigger failed; next poll will retry\", cause),\n ),\n );\n\n yield* attempt;\n yield* Effect.gen(function* () {\n while (true) {\n yield* Effect.sleep(delay);\n yield* attempt;\n }\n }).pipe(Effect.forkScoped);\n }),\n });\n }),\n );\n }\n}\n"],"mappings":";;;;AAUA,MAAM,eAAe,OAAO,OAAO;CACjC,eAAe,OAAO;CACtB,eAAe,OAAO;CACtB,cAAc,OAAO;CACrB,aAAa,OAAO;AACtB,CAAC;AAED,MAAM,aAAa,OAAO,eAAe,sBAAsB;AAC/D,MAAM,eAAe,OAAO,oBAAoB,YAAY,EAAE,kBAAkB,QAAQ,CAAC;AACzF,MAAM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AwD,KAAK,CACjF,CACF;IAEA,OAAO;IACP,OAAO,OAAO,IAAI,aAAa;KAC7B,OAAO,MAAM;MACX,OAAO,OAAO,MAAM,KAAK;MACzB,OAAO;KACT;IACF,CAAC,CAAC,CAAC,KAAK,OAAO,UAAU;GAC3B,CAAC,EACH,CAAC;EACH,CAAC,CACH;CACF;AACF"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as NodeWakeScheduler_d_exports } from "./NodeWakeScheduler-4ZeXYwPu.mjs";
|
|
2
|
-
import { s as NodeDurableAgentRuntime_d_exports } from "./NodeDurableAgentRuntime-
|
|
2
|
+
import { s as NodeDurableAgentRuntime_d_exports } from "./NodeDurableAgentRuntime-eTlQCxvz.mjs";
|
|
3
3
|
import { t as NodeDurableHost_d_exports } from "./NodeDurableHost.mjs";
|
|
4
4
|
import { t as NodeScheduling_d_exports } from "./NodeScheduling.mjs";
|
|
5
5
|
import { t as NodeSubscriptions_d_exports } from "./NodeSubscriptions.mjs";
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@effect-agent/platform-node","version":"0.1.0-beta.
|
|
1
|
+
{"name":"@effect-agent/platform-node","version":"0.1.0-beta.85","dependencies":{"@effect-agent/core":"0.1.0-beta.85","@effect-agent/engine":"0.1.0-beta.85","@effect-agent/storage-sqlite":"0.1.0-beta.85","@effect-agent/thread":"0.1.0-beta.85","@effect-agent/workflow":"0.1.0-beta.85","@effect/platform-node":"4.0.0-rc.112","@effect/sql-sqlite-node":"4.0.0-rc.112"},"devDependencies":{"@effect-agent/capabilities":"0.1.0-beta.85","@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"},"./NodeDurableAgentRuntime":{"types":"./dist/NodeDurableAgentRuntime.d.mts","default":"./dist/NodeDurableAgentRuntime.mjs"},"./NodeDurableHost":{"types":"./dist/NodeDurableHost.d.mts","default":"./dist/NodeDurableHost.mjs"},"./NodeScheduling":{"types":"./dist/NodeScheduling.d.mts","default":"./dist/NodeScheduling.mjs"},"./NodeSubscriptions":{"types":"./dist/NodeSubscriptions.d.mts","default":"./dist/NodeSubscriptions.mjs"},"./NodeWakeScheduler":{"types":"./dist/NodeWakeScheduler.d.mts","default":"./dist/NodeWakeScheduler.mjs"},"./NodeWorkflow":{"types":"./dist/NodeWorkflow.d.mts","default":"./dist/NodeWorkflow.mjs"}},"description":"Class DN layer assembly for Effect Agent: the durable Node/SQLite runtime host, wake scheduler, and ownership drain.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/danieljvdm/effect-agent.git","directory":"packages/platform-node"},"files":["dist","src"],"type":"module","sideEffects":[],"publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"tsc --noEmit -p tsconfig.json"}}
|
package/src/NodeWorkflow.ts
CHANGED
|
@@ -78,7 +78,7 @@ export class SqlWorkflowDispatchStore {
|
|
|
78
78
|
|
|
79
79
|
const put = Effect.fn("SqlWorkflowDispatchStore.put")(
|
|
80
80
|
function* (input: WorkflowDispatchIntent) {
|
|
81
|
-
const intent = yield* Schema.
|
|
81
|
+
const intent = yield* Schema.decodeEffect(WorkflowDispatchIntent)(input);
|
|
82
82
|
const encoded = yield* encodeIntent(intent);
|
|
83
83
|
|
|
84
84
|
yield* sql`
|
|
@@ -148,7 +148,7 @@ export class SqlWorkflowDispatchStore {
|
|
|
148
148
|
|
|
149
149
|
const scan = Effect.fn("SqlWorkflowDispatchStore.scan")(
|
|
150
150
|
function* (input: WorkflowDispatchScan) {
|
|
151
|
-
const request = yield* Schema.
|
|
151
|
+
const request = yield* Schema.decodeEffect(WorkflowDispatchScan)(input);
|
|
152
152
|
|
|
153
153
|
const rows = yield* sql`
|
|
154
154
|
SELECT deployment_id, workflow_name, execution_id, intent_json
|
|
@@ -167,7 +167,7 @@ export class SqlWorkflowDispatchStore {
|
|
|
167
167
|
|
|
168
168
|
const remove = Effect.fn("SqlWorkflowDispatchStore.remove")(
|
|
169
169
|
function* (input: WorkflowDispatchIntent) {
|
|
170
|
-
const intent = yield* Schema.
|
|
170
|
+
const intent = yield* Schema.decodeEffect(WorkflowDispatchIntent)(input);
|
|
171
171
|
|
|
172
172
|
const rows = yield* sql`
|
|
173
173
|
SELECT deployment_id, workflow_name, execution_id, intent_json
|
|
@@ -236,10 +236,10 @@ export class NodeWorkflowRepairTrigger {
|
|
|
236
236
|
return WorkflowRepairTrigger.of({
|
|
237
237
|
register: Effect.fn("NodeWorkflowRepairTrigger.register")(function* (repair) {
|
|
238
238
|
const attempt = repair.pipe(
|
|
239
|
-
Effect.
|
|
240
|
-
Cause.hasInterruptsOnly(cause)
|
|
241
|
-
|
|
242
|
-
|
|
239
|
+
Effect.catchCauseIf(
|
|
240
|
+
(cause) => !Cause.hasInterruptsOnly(cause),
|
|
241
|
+
(cause) =>
|
|
242
|
+
Effect.logError("Workflow repair trigger failed; next poll will retry", cause),
|
|
243
243
|
),
|
|
244
244
|
);
|
|
245
245
|
|