@effect-agent/platform-node 0.1.0-beta.84 → 0.1.0-beta.86

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.
Files changed (33) hide show
  1. package/dist/{NodeDurableAgentRuntime-CFElFzNF.d.mts → NodeDurableAgentRuntime-Cs_E9W_9.d.mts} +32 -36
  2. package/dist/NodeDurableAgentRuntime.d.mts +1 -1
  3. package/dist/NodeDurableAgentRuntime.mjs +18 -18
  4. package/dist/NodeDurableAgentRuntime.mjs.map +1 -1
  5. package/dist/{NodeDurableHost-BMSajuQn.mjs → NodeDurableHost-CG2xAhfb.mjs} +12 -12
  6. package/dist/NodeDurableHost-CG2xAhfb.mjs.map +1 -0
  7. package/dist/NodeDurableHost.d.mts +46 -54
  8. package/dist/NodeDurableHost.mjs +1 -1
  9. package/dist/NodeScheduling.d.mts +2 -2
  10. package/dist/NodeScheduling.mjs +2 -2
  11. package/dist/NodeScheduling.mjs.map +1 -1
  12. package/dist/NodeSubscriptions.d.mts +6 -6
  13. package/dist/NodeSubscriptions.mjs +7 -7
  14. package/dist/NodeSubscriptions.mjs.map +1 -1
  15. package/dist/{NodeWakeScheduler-4ZeXYwPu.d.mts → NodeWakeScheduler-CCgm1t-G.d.mts} +3 -3
  16. package/dist/NodeWakeScheduler.d.mts +1 -1
  17. package/dist/NodeWakeScheduler.mjs +3 -3
  18. package/dist/NodeWakeScheduler.mjs.map +1 -1
  19. package/dist/NodeWorkflow.d.mts +1 -1
  20. package/dist/NodeWorkflow.mjs +5 -5
  21. package/dist/NodeWorkflow.mjs.map +1 -1
  22. package/dist/index.d.mts +2 -2
  23. package/dist/index.mjs +1 -1
  24. package/package.json +1 -1
  25. package/src/NodeDurableAgentRuntime.ts +29 -35
  26. package/src/NodeDurableHost.ts +12 -15
  27. package/src/NodeScheduling.ts +4 -8
  28. package/src/NodeSubscriptions.ts +8 -12
  29. package/src/NodeWakeScheduler.ts +3 -3
  30. package/src/NodeWorkflow.ts +8 -8
  31. package/src/internal/message-delivery.ts +2 -2
  32. package/src/internal/prepared-admission.ts +6 -6
  33. package/dist/NodeDurableHost-BMSajuQn.mjs.map +0 -1
@@ -1,15 +1,15 @@
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-CFElFzNF.mjs";
3
- import { SubmissionId, ThreadId } from "@effect-agent/core/Identifiers";
4
- import { AgentRegistration, DurableBindingFailure, ResolvedBinding } from "@effect-agent/thread/AgentRegistration";
5
- import { DurableAbortFailure, DurableAgentRuntime, DurableAwaitFailure, DurableExplainFailure, DurableObligationFailure, DurableObserveOptions, DurableRetryFailure, DurableSubmitAgent, DurableSubmitFailure, DurableSubmitOptions, DurableVerifyFailure, DurableWorkerFailure, Receipt, RecoveryReport } from "@effect-agent/thread/DurableAgentRuntime";
6
- import { MessageDeliveryError, MessageDeliveryStore } from "@effect-agent/thread/MessageDelivery";
7
- import { CanonicalRecordEnvelope } from "@effect-agent/thread/Records";
8
- import { AbortCommand, AbortIntent, Settlement } from "@effect-agent/thread/SubmissionLedger";
9
- import { ThreadNotMaterialized, ThreadStoreError } from "@effect-agent/thread/ThreadStore";
1
+ import { t as NodeWakeSchedulerConfig } from "./NodeWakeScheduler-CCgm1t-G.mjs";
2
+ import { a as NodeDurableAgentRuntimeOptions, c as NodePlatformConfigError, n as NodeDurableAgentRuntimeConfig, o as NodeDurableAgentRuntimeServices } from "./NodeDurableAgentRuntime-Cs_E9W_9.mjs";
10
3
  import { Context, Effect, Layer, Schema, Stream } from "effect";
11
- import { IntegrityReport, ObligationReport, ObligationThresholds, RecoveryExplanation, RetryCommand } from "@effect-agent/thread/Admin";
12
- import { OperationDenied } from "@effect-agent/thread/OperationAuthorizer";
4
+ import { AgentRegistration, DurableBindingFailure, ResolvedBinding } from "effect-agent/agent-registration";
5
+ import { DurableAbortFailure, DurableAgentRuntime, DurableAwaitFailure, DurableExplainFailure, DurableObligationFailure, DurableObserveOptions, DurableRetryFailure, DurableSubmitAgent, DurableSubmitFailure, DurableSubmitOptions, DurableVerifyFailure, DurableWorkerFailure, Receipt, RecoveryReport } from "effect-agent/durable-agent-runtime";
6
+ import { SubmissionId, ThreadId } from "effect-agent/identifiers";
7
+ import { MessageDeliveryError, MessageDeliveryStore } from "effect-agent/message-delivery";
8
+ import { CanonicalRecordEnvelope } from "effect-agent/records";
9
+ import { AbortCommand, AbortIntent, Settlement } from "effect-agent/submission-ledger";
10
+ import { ThreadNotMaterialized, ThreadStoreError } from "effect-agent/thread-store";
11
+ import { IntegrityReport, ObligationReport, ObligationThresholds, RecoveryExplanation, RetryCommand } from "effect-agent/admin";
12
+ import { OperationDenied } from "effect-agent/operation-authorizer";
13
13
  declare namespace NodeDurableHost_d_exports {
14
14
  export { AdmissionClosed, NodeDurableHost, layer, run };
15
15
  }
@@ -87,33 +87,29 @@ 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 : (Entries[number] extends (infer T_3) ? T_3 extends Entries[number] ? T_3 extends {
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 {
93
- readonly agent: infer A extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding;
94
- } ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<A> : T_4 extends {
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> & {
96
- readonly instructions: import("@effect-agent/core/Agent").InstructionSource<never, unknown, unknown>;
97
- readonly inputPrompt?: import("@effect-agent/core/Agent").InputPromptSource<never, unknown, unknown> | undefined;
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/sqlite-thread-store").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/sqlite-storage-config").SqliteStorageConfig | import("@effect-agent/storage-sqlite/sqlite-storage-failpoint").SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, import("effect-agent/run-options").RunContextPreparation | import("effect-agent/run-options").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/agent-registration").AgentAttemptContext) => Layer.Layer<infer Provides, never, infer Requires>) ? Requires | Exclude<T_3 extends {
91
+ readonly agent: infer A extends import("effect-agent/agent-registration").ExecutableAgentBinding;
92
+ } ? import("effect-agent/durable-agent-runtime").DurableWorkerRequirements<A> : T_3 extends {
93
+ readonly agent: infer D extends import("effect-agent/agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("effect-agent/agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined> & {
94
+ readonly instructions: import("effect-agent/agent").InstructionSource<never, unknown, unknown>;
95
+ readonly inputPrompt?: import("effect-agent/agent").InputPromptSource<never, unknown, unknown> | undefined;
98
96
  };
99
- readonly model: infer M extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding["model"];
100
- } ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<{
97
+ readonly model: infer M extends import("effect-agent/agent-registration").ExecutableAgentBinding["model"];
98
+ } ? import("effect-agent/durable-agent-runtime").DurableWorkerRequirements<{
101
99
  readonly definition: D;
102
100
  readonly model: M;
103
- }> : never : never : never, Provides> : T_3 extends {
104
- readonly agent: infer A extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding;
105
- } ? 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> & {
107
- readonly instructions: import("@effect-agent/core/Agent").InstructionSource<never, unknown, unknown>;
108
- readonly inputPrompt?: import("@effect-agent/core/Agent").InputPromptSource<never, unknown, unknown> | undefined;
101
+ }> : never, Provides> : T_3 extends {
102
+ readonly agent: infer A extends import("effect-agent/agent-registration").ExecutableAgentBinding;
103
+ } ? import("effect-agent/durable-agent-runtime").DurableWorkerRequirements<A> : T_3 extends {
104
+ readonly agent: infer D extends import("effect-agent/agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("effect-agent/agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined> & {
105
+ readonly instructions: import("effect-agent/agent").InstructionSource<never, unknown, unknown>;
106
+ readonly inputPrompt?: import("effect-agent/agent").InputPromptSource<never, unknown, unknown> | undefined;
109
107
  };
110
- readonly model: infer M extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding["model"];
111
- } ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<{
108
+ readonly model: infer M extends import("effect-agent/agent-registration").ExecutableAgentBinding["model"];
109
+ } ? import("effect-agent/durable-agent-runtime").DurableWorkerRequirements<{
112
110
  readonly definition: D;
113
111
  readonly model: M;
114
- }> : never : never : never) | (Entries[number] extends (infer T_5) ? T_5 extends Entries[number] ? T_5 extends {
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/subagent-host").WorkerReporting<unknown, unknown>[] ? [T_5[number]] extends [never] ? never : T_5[number] extends import("effect-agent/subagent-host").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/durable-agent-runtime").DurableRuntimeConfig | MessageDeliveryStore | import("effect-agent/schedule").ScheduleStore | import("effect-agent/submission-ledger").SubmissionLedger | import("effect-agent/thread-store").ThreadStore | import("effect-agent/wake-scheduler").WakeScheduler>, import("effect-agent/durable-failpoint").DurableRuntimeFailpoint | NodeWakeSchedulerConfig | import("effect-agent/tool-reconciler").ToolReconciler>, import("effect/Crypto").Crypto | import("effect/unstable/sql/SqlClient").SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient | import("@effect-agent/storage-sqlite/sqlite-storage-config").SqliteStorageConfig | import("@effect-agent/storage-sqlite/sqlite-storage-failpoint").SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, import("effect-agent/run-options").RunContextPreparation | import("effect-agent/run-options").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.
@@ -122,7 +118,7 @@ declare class NodeDurableHost extends NodeDurableHost_base {
122
118
  /** The complete DN host: `NodeDurableAgentRuntime.layer(options)` plus the host lifecycle gates. */
123
119
  static layerStack<ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never, ReconcilerError = never, ReconcilerRequirements = never>(options: NodeDurableAgentRuntimeOptions<ContextError, ContextRequirements, AuthorizationError, AuthorizationRequirements, ReconcilerError, ReconcilerRequirements> & {
124
120
  readonly bindings?: ReadonlyArray<ResolvedBinding>;
125
- }): 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>>;
121
+ }): Layer.Layer<NodeDurableHost | NodeDurableAgentRuntimeServices, AuthorizationError | ContextError | ReconcilerError | MessageDeliveryError | NodePlatformConfigError | DurableWorkerFailure | import("@effect-agent/storage-sqlite/sqlite-thread-store").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/sqlite-storage-config").SqliteStorageConfig | import("@effect-agent/storage-sqlite/sqlite-storage-failpoint").SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, import("effect-agent/run-options").RunContextPreparation | import("effect-agent/run-options").RunToolAuthorization>>;
126
122
  }
127
123
  /**
128
124
  * Acquire a complete Node host and start one bounded, scoped worker pool after recovery.
@@ -130,33 +126,29 @@ 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 : (Entries[number] extends (infer T_3) ? T_3 extends Entries[number] ? T_3 extends {
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 {
136
- readonly agent: infer A extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding;
137
- } ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<A> : T_4 extends {
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> & {
139
- readonly instructions: import("@effect-agent/core/Agent").InstructionSource<never, unknown, unknown>;
140
- readonly inputPrompt?: import("@effect-agent/core/Agent").InputPromptSource<never, unknown, unknown> | undefined;
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/sqlite-thread-store").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/sqlite-storage-config").SqliteStorageConfig | import("@effect-agent/storage-sqlite/sqlite-storage-failpoint").SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, import("effect-agent/run-options").RunContextPreparation | import("effect-agent/run-options").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/agent-registration").AgentAttemptContext) => Layer.Layer<infer Provides, never, infer Requires>) ? Requires | Exclude<T_3 extends {
130
+ readonly agent: infer A extends import("effect-agent/agent-registration").ExecutableAgentBinding;
131
+ } ? import("effect-agent/durable-agent-runtime").DurableWorkerRequirements<A> : T_3 extends {
132
+ readonly agent: infer D extends import("effect-agent/agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("effect-agent/agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined> & {
133
+ readonly instructions: import("effect-agent/agent").InstructionSource<never, unknown, unknown>;
134
+ readonly inputPrompt?: import("effect-agent/agent").InputPromptSource<never, unknown, unknown> | undefined;
141
135
  };
142
- readonly model: infer M extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding["model"];
143
- } ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<{
136
+ readonly model: infer M extends import("effect-agent/agent-registration").ExecutableAgentBinding["model"];
137
+ } ? import("effect-agent/durable-agent-runtime").DurableWorkerRequirements<{
144
138
  readonly definition: D;
145
139
  readonly model: M;
146
- }> : never : never : never, Provides> : T_3 extends {
147
- readonly agent: infer A extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding;
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> & {
150
- readonly instructions: import("@effect-agent/core/Agent").InstructionSource<never, unknown, unknown>;
151
- readonly inputPrompt?: import("@effect-agent/core/Agent").InputPromptSource<never, unknown, unknown> | undefined;
140
+ }> : never, Provides> : T_3 extends {
141
+ readonly agent: infer A extends import("effect-agent/agent-registration").ExecutableAgentBinding;
142
+ } ? import("effect-agent/durable-agent-runtime").DurableWorkerRequirements<A> : T_3 extends {
143
+ readonly agent: infer D extends import("effect-agent/agent").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("effect-agent/agent").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown, Schema.Top | undefined> & {
144
+ readonly instructions: import("effect-agent/agent").InstructionSource<never, unknown, unknown>;
145
+ readonly inputPrompt?: import("effect-agent/agent").InputPromptSource<never, unknown, unknown> | undefined;
152
146
  };
153
- readonly model: infer M extends import("@effect-agent/thread/AgentRegistration").ExecutableAgentBinding["model"];
154
- } ? import("@effect-agent/thread/DurableAgentRuntime").DurableWorkerRequirements<{
147
+ readonly model: infer M extends import("effect-agent/agent-registration").ExecutableAgentBinding["model"];
148
+ } ? import("effect-agent/durable-agent-runtime").DurableWorkerRequirements<{
155
149
  readonly definition: D;
156
150
  readonly model: M;
157
- }> : never : never : never) | (Entries[number] extends (infer T_5) ? T_5 extends Entries[number] ? T_5 extends {
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/subagent-host").WorkerReporting<unknown, unknown>[] ? [T_5[number]] extends [never] ? never : T_5[number] extends import("effect-agent/subagent-host").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/durable-agent-runtime").DurableRuntimeConfig | MessageDeliveryStore | import("effect-agent/schedule").ScheduleStore | import("effect-agent/submission-ledger").SubmissionLedger | import("effect-agent/thread-store").ThreadStore | import("effect-agent/wake-scheduler").WakeScheduler>, import("effect-agent/durable-failpoint").DurableRuntimeFailpoint | NodeWakeSchedulerConfig | import("effect-agent/tool-reconciler").ToolReconciler>, import("effect/Crypto").Crypto | import("effect/unstable/sql/SqlClient").SqlClient | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient | import("@effect-agent/storage-sqlite/sqlite-storage-config").SqliteStorageConfig | import("@effect-agent/storage-sqlite/sqlite-storage-failpoint").SqliteStorageFailpoint>, NodeDurableAgentRuntimeConfig>, import("effect-agent/run-options").RunContextPreparation | import("effect-agent/run-options").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
@@ -1,2 +1,2 @@
1
- import { a as run, i as layer, n as NodeDurableHost, t as AdmissionClosed } from "./NodeDurableHost-BMSajuQn.mjs";
1
+ import { a as run, i as layer, n as NodeDurableHost, t as AdmissionClosed } from "./NodeDurableHost-CG2xAhfb.mjs";
2
2
  export { AdmissionClosed, NodeDurableHost, layer, run };
@@ -1,7 +1,7 @@
1
1
  import { NodeDurableHost } from "./NodeDurableHost.mjs";
2
- import { ScheduleAuthorizer, ScheduleStore, ScheduleValidationError, ScheduleWake, SchedulingLimits } from "@effect-agent/thread/Schedule";
3
2
  import { Layer } from "effect";
4
- import { Scheduling } from "@effect-agent/thread/Scheduling";
3
+ import { ScheduleAuthorizer, ScheduleStore, ScheduleValidationError, ScheduleWake, SchedulingLimits } from "effect-agent/schedule";
4
+ import { Scheduling } from "effect-agent/scheduling";
5
5
  declare namespace NodeScheduling_d_exports {
6
6
  export { NodeScheduling, NodeSchedulingOptions, nodeScheduleWakeLayer };
7
7
  }
@@ -1,9 +1,9 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
2
  import { nodeScheduledInputAdmissionLayer } from "./NodeSubscriptions.mjs";
3
- import { ScheduleStorageError, ScheduleStore, ScheduleWake, defaultSchedulingLimits } from "@effect-agent/thread/Schedule";
4
3
  import { NodeCrypto } from "@effect/platform-node";
5
4
  import { Cause, Duration, Effect, Layer, Option, PubSub, Result } from "effect";
6
- import { ScheduleDriver, Scheduling } from "@effect-agent/thread/Scheduling";
5
+ import { ScheduleStorageError, ScheduleStore, ScheduleWake, defaultSchedulingLimits } from "effect-agent/schedule";
6
+ import { ScheduleDriver, Scheduling } from "effect-agent/scheduling";
7
7
  //#region src/NodeScheduling.ts
8
8
  var NodeScheduling_exports = /* @__PURE__ */ __exportAll({
9
9
  NodeScheduling: () => NodeScheduling,
@@ -1 +1 @@
1
- {"version":3,"file":"NodeScheduling.mjs","names":[],"sources":["../src/NodeScheduling.ts"],"sourcesContent":["import {\n type ScheduleAuthorizer,\n type SchedulingLimits,\n ScheduleStorageError,\n ScheduleStore,\n type ScheduleValidationError,\n ScheduleWake,\n defaultSchedulingLimits,\n} from \"@effect-agent/thread/Schedule\";\nimport {\n type ScheduleProcessFailure,\n Scheduling,\n ScheduleDriver,\n} from \"@effect-agent/thread/Scheduling\";\nimport { NodeCrypto } from \"@effect/platform-node\";\nimport { Cause, Duration, Effect, Layer, Option, PubSub, Result } from \"effect\";\n\nimport type { NodeDurableHost } from \"./NodeDurableHost.ts\";\nimport { nodeScheduledInputAdmissionLayer } from \"./NodeSubscriptions.ts\";\n\n/** One bounded hint slot for the single supported Node scheduler. Indexed polling repairs loss. */\nexport const nodeScheduleWakeLayer: Layer.Layer<ScheduleWake> = Layer.effect(\n ScheduleWake,\n Effect.gen(function* () {\n const hints = yield* PubSub.sliding<void>(1);\n const subscription = yield* PubSub.subscribe(hints);\n\n yield* Effect.addFinalizer(() => PubSub.shutdown(hints));\n\n return ScheduleWake.of({\n notify: PubSub.publish(hints, undefined).pipe(Effect.asVoid),\n await: PubSub.take(subscription),\n });\n }),\n);\n\nconst reportPassFailure = (cause: Cause.Cause<ScheduleProcessFailure>): Effect.Effect<boolean> =>\n Cause.hasInterruptsOnly(cause)\n ? Effect.interrupt\n : Effect.logWarning(\"Node scheduling pass failed\").pipe(\n Effect.annotateLogs({\n failureTag: Option.match(Cause.findErrorOption(cause), {\n onNone: () => \"Defect\",\n onSome: (error) => error._tag,\n }),\n }),\n Effect.as(false),\n );\n\nconst nodeSchedulingDriverLayer = (\n limits: SchedulingLimits,\n): Layer.Layer<never, never, ScheduleDriver | ScheduleStore | ScheduleWake> =>\n Layer.effectDiscard(\n Effect.gen(function* () {\n const scheduling = yield* ScheduleDriver;\n const store = yield* ScheduleStore;\n const wake = yield* ScheduleWake;\n\n const run = Effect.gen(function* () {\n while (true) {\n const passSucceeded = yield* scheduling.runDue().pipe(\n Effect.map((pass) => pass.failed === 0),\n Effect.catchCause(reportPassFailure),\n );\n\n const deadlineResult = passSucceeded\n ? yield* store.nextDeadline().pipe(Effect.result)\n : Result.fail(\n ScheduleStorageError.make({ operation: \"driver pass\", reason: \"unavailable\" }),\n );\n\n if (Result.isFailure(deadlineResult) && passSucceeded) {\n yield* Effect.logWarning(\"Node scheduling deadline query failed\");\n }\n const nowMillis = yield* Effect.clockWith((clock) => clock.currentTimeMillis);\n\n const deadlineDelay =\n Result.isSuccess(deadlineResult) && deadlineResult.success !== null\n ? Math.max(0, deadlineResult.success - nowMillis)\n : limits.recoveryPollMillis;\n\n const delay = Math.min(deadlineDelay, limits.recoveryPollMillis);\n\n yield* Effect.raceFirst(wake.await, Effect.sleep(Duration.millis(delay)));\n }\n });\n\n yield* Effect.forkScoped(run);\n }),\n );\n\nexport interface NodeSchedulingOptions {\n readonly limits?: SchedulingLimits | undefined;\n}\n\n/**\n * Optional Scope-owned Node scheduling service and driver. The caller must provide the existing\n * host, its SQLite ScheduleStore, and an explicit ScheduleAuthorizer.\n */\nexport class NodeScheduling {\n static layer(\n options: NodeSchedulingOptions = {},\n ): Layer.Layer<\n Scheduling,\n ScheduleValidationError,\n NodeDurableHost | ScheduleStore | ScheduleAuthorizer\n > {\n const limits = options.limits ?? defaultSchedulingLimits;\n\n const schedulingWithDriver = nodeSchedulingDriverLayer(limits).pipe(\n Layer.provide(ScheduleDriver.layer(limits)),\n Layer.merge(Scheduling.layer(limits)),\n );\n\n return schedulingWithDriver.pipe(\n Layer.provide(\n Layer.mergeAll(nodeScheduledInputAdmissionLayer, nodeScheduleWakeLayer, NodeCrypto.layer),\n ),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAqBA,MAAa,wBAAmD,MAAM,OACpE,cACA,OAAO,IAAI,aAAa;CACtB,MAAM,QAAQ,OAAO,OAAO,QAAc,CAAC;CAC3C,MAAM,eAAe,OAAO,OAAO,UAAU,KAAK;CAElD,OAAO,OAAO,mBAAmB,OAAO,SAAS,KAAK,CAAC;CAEvD,OAAO,aAAa,GAAG;EACrB,QAAQ,OAAO,QAAQ,OAAO,KAAA,CAAS,CAAC,CAAC,KAAK,OAAO,MAAM;EAC3D,OAAO,OAAO,KAAK,YAAY;CACjC,CAAC;AACH,CAAC,CACH;AAEA,MAAM,qBAAqB,UACzB,MAAM,kBAAkB,KAAK,IACzB,OAAO,YACP,OAAO,WAAW,6BAA6B,CAAC,CAAC,KAC/C,OAAO,aAAa,EAClB,YAAY,OAAO,MAAM,MAAM,gBAAgB,KAAK,GAAG;CACrD,cAAc;CACd,SAAS,UAAU,MAAM;AAC3B,CAAC,EACH,CAAC,GACD,OAAO,GAAG,KAAK,CACjB;AAEN,MAAM,6BACJ,WAEA,MAAM,cACJ,OAAO,IAAI,aAAa;CACtB,MAAM,aAAa,OAAO;CAC1B,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,OAAO;CAEpB,MAAM,MAAM,OAAO,IAAI,aAAa;EAClC,OAAO,MAAM;GACX,MAAM,gBAAgB,OAAO,WAAW,OAAO,CAAC,CAAC,KAC/C,OAAO,KAAK,SAAS,KAAK,WAAW,CAAC,GACtC,OAAO,WAAW,iBAAiB,CACrC;GAEA,MAAM,iBAAiB,gBACnB,OAAO,MAAM,aAAa,CAAC,CAAC,KAAK,OAAO,MAAM,IAC9C,OAAO,KACL,qBAAqB,KAAK;IAAE,WAAW;IAAe,QAAQ;GAAc,CAAC,CAC/E;GAEJ,IAAI,OAAO,UAAU,cAAc,KAAK,eACtC,OAAO,OAAO,WAAW,uCAAuC;GAElE,MAAM,YAAY,OAAO,OAAO,WAAW,UAAU,MAAM,iBAAiB;GAE5E,MAAM,gBACJ,OAAO,UAAU,cAAc,KAAK,eAAe,YAAY,OAC3D,KAAK,IAAI,GAAG,eAAe,UAAU,SAAS,IAC9C,OAAO;GAEb,MAAM,QAAQ,KAAK,IAAI,eAAe,OAAO,kBAAkB;GAE/D,OAAO,OAAO,UAAU,KAAK,OAAO,OAAO,MAAM,SAAS,OAAO,KAAK,CAAC,CAAC;EAC1E;CACF,CAAC;CAED,OAAO,OAAO,WAAW,GAAG;AAC9B,CAAC,CACH;;;;;AAUF,IAAa,iBAAb,MAA4B;CAC1B,OAAO,MACL,UAAiC,CAAC,GAKlC;EACA,MAAM,SAAS,QAAQ,UAAU;EAOjC,OAL6B,0BAA0B,MAAM,CAAC,CAAC,KAC7D,MAAM,QAAQ,eAAe,MAAM,MAAM,CAAC,GAC1C,MAAM,MAAM,WAAW,MAAM,MAAM,CAAC,CAGZ,CAAC,CAAC,KAC1B,MAAM,QACJ,MAAM,SAAS,kCAAkC,uBAAuB,WAAW,KAAK,CAC1F,CACF;CACF;AACF"}
1
+ {"version":3,"file":"NodeScheduling.mjs","names":[],"sources":["../src/NodeScheduling.ts"],"sourcesContent":["import { NodeCrypto } from \"@effect/platform-node\";\nimport { Cause, Duration, Effect, Layer, Option, PubSub, Result } from \"effect\";\nimport {\n type ScheduleAuthorizer,\n type SchedulingLimits,\n ScheduleStorageError,\n ScheduleStore,\n type ScheduleValidationError,\n ScheduleWake,\n defaultSchedulingLimits,\n} from \"effect-agent/schedule\";\nimport { type ScheduleProcessFailure, Scheduling, ScheduleDriver } from \"effect-agent/scheduling\";\n\nimport type { NodeDurableHost } from \"./NodeDurableHost.ts\";\nimport { nodeScheduledInputAdmissionLayer } from \"./NodeSubscriptions.ts\";\n\n/** One bounded hint slot for the single supported Node scheduler. Indexed polling repairs loss. */\nexport const nodeScheduleWakeLayer: Layer.Layer<ScheduleWake> = Layer.effect(\n ScheduleWake,\n Effect.gen(function* () {\n const hints = yield* PubSub.sliding<void>(1);\n const subscription = yield* PubSub.subscribe(hints);\n\n yield* Effect.addFinalizer(() => PubSub.shutdown(hints));\n\n return ScheduleWake.of({\n notify: PubSub.publish(hints, undefined).pipe(Effect.asVoid),\n await: PubSub.take(subscription),\n });\n }),\n);\n\nconst reportPassFailure = (cause: Cause.Cause<ScheduleProcessFailure>): Effect.Effect<boolean> =>\n Cause.hasInterruptsOnly(cause)\n ? Effect.interrupt\n : Effect.logWarning(\"Node scheduling pass failed\").pipe(\n Effect.annotateLogs({\n failureTag: Option.match(Cause.findErrorOption(cause), {\n onNone: () => \"Defect\",\n onSome: (error) => error._tag,\n }),\n }),\n Effect.as(false),\n );\n\nconst nodeSchedulingDriverLayer = (\n limits: SchedulingLimits,\n): Layer.Layer<never, never, ScheduleDriver | ScheduleStore | ScheduleWake> =>\n Layer.effectDiscard(\n Effect.gen(function* () {\n const scheduling = yield* ScheduleDriver;\n const store = yield* ScheduleStore;\n const wake = yield* ScheduleWake;\n\n const run = Effect.gen(function* () {\n while (true) {\n const passSucceeded = yield* scheduling.runDue().pipe(\n Effect.map((pass) => pass.failed === 0),\n Effect.catchCause(reportPassFailure),\n );\n\n const deadlineResult = passSucceeded\n ? yield* store.nextDeadline().pipe(Effect.result)\n : Result.fail(\n ScheduleStorageError.make({ operation: \"driver pass\", reason: \"unavailable\" }),\n );\n\n if (Result.isFailure(deadlineResult) && passSucceeded) {\n yield* Effect.logWarning(\"Node scheduling deadline query failed\");\n }\n const nowMillis = yield* Effect.clockWith((clock) => clock.currentTimeMillis);\n\n const deadlineDelay =\n Result.isSuccess(deadlineResult) && deadlineResult.success !== null\n ? Math.max(0, deadlineResult.success - nowMillis)\n : limits.recoveryPollMillis;\n\n const delay = Math.min(deadlineDelay, limits.recoveryPollMillis);\n\n yield* Effect.raceFirst(wake.await, Effect.sleep(Duration.millis(delay)));\n }\n });\n\n yield* Effect.forkScoped(run);\n }),\n );\n\nexport interface NodeSchedulingOptions {\n readonly limits?: SchedulingLimits | undefined;\n}\n\n/**\n * Optional Scope-owned Node scheduling service and driver. The caller must provide the existing\n * host, its SQLite ScheduleStore, and an explicit ScheduleAuthorizer.\n */\nexport class NodeScheduling {\n static layer(\n options: NodeSchedulingOptions = {},\n ): Layer.Layer<\n Scheduling,\n ScheduleValidationError,\n NodeDurableHost | ScheduleStore | ScheduleAuthorizer\n > {\n const limits = options.limits ?? defaultSchedulingLimits;\n\n const schedulingWithDriver = nodeSchedulingDriverLayer(limits).pipe(\n Layer.provide(ScheduleDriver.layer(limits)),\n Layer.merge(Scheduling.layer(limits)),\n );\n\n return schedulingWithDriver.pipe(\n Layer.provide(\n Layer.mergeAll(nodeScheduledInputAdmissionLayer, nodeScheduleWakeLayer, NodeCrypto.layer),\n ),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAa,wBAAmD,MAAM,OACpE,cACA,OAAO,IAAI,aAAa;CACtB,MAAM,QAAQ,OAAO,OAAO,QAAc,CAAC;CAC3C,MAAM,eAAe,OAAO,OAAO,UAAU,KAAK;CAElD,OAAO,OAAO,mBAAmB,OAAO,SAAS,KAAK,CAAC;CAEvD,OAAO,aAAa,GAAG;EACrB,QAAQ,OAAO,QAAQ,OAAO,KAAA,CAAS,CAAC,CAAC,KAAK,OAAO,MAAM;EAC3D,OAAO,OAAO,KAAK,YAAY;CACjC,CAAC;AACH,CAAC,CACH;AAEA,MAAM,qBAAqB,UACzB,MAAM,kBAAkB,KAAK,IACzB,OAAO,YACP,OAAO,WAAW,6BAA6B,CAAC,CAAC,KAC/C,OAAO,aAAa,EAClB,YAAY,OAAO,MAAM,MAAM,gBAAgB,KAAK,GAAG;CACrD,cAAc;CACd,SAAS,UAAU,MAAM;AAC3B,CAAC,EACH,C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W,KAAK,CAC1F,CACF;CACF;AACF"}
@@ -1,11 +1,11 @@
1
1
  import { NodeDurableHost } from "./NodeDurableHost.mjs";
2
- import { ScheduledInputAdmission } from "@effect-agent/thread/Schedule";
3
2
  import { Layer } from "effect";
4
- import { PreparedInputAdmission } from "@effect-agent/thread/PreparedInputAdmission";
5
- import { EventSources } from "@effect-agent/thread/EventSource";
6
- import { SubscriptionAuthorizer, SubscriptionError, SubscriptionLimits, SubscriptionStore } from "@effect-agent/thread/Subscription";
7
- import { SubscriptionInputBindings } from "@effect-agent/thread/SubscriptionInput";
8
- import { SubscriptionIntake, Subscriptions } from "@effect-agent/thread/Subscriptions";
3
+ import { ScheduledInputAdmission } from "effect-agent/schedule";
4
+ import { PreparedInputAdmission } from "effect-agent/prepared-input-admission";
5
+ import { EventSources } from "effect-agent/event-source";
6
+ import { SubscriptionAuthorizer, SubscriptionError, SubscriptionLimits, SubscriptionStore } from "effect-agent/subscription";
7
+ import { SubscriptionInputBindings } from "effect-agent/subscription-input";
8
+ import { SubscriptionIntake, Subscriptions } from "effect-agent/subscriptions";
9
9
  declare namespace NodeSubscriptions_d_exports {
10
10
  export { NodeSubscriptions, NodeSubscriptionsOptions, nodePreparedInputAdmissionLayer, nodeScheduledInputAdmissionLayer };
11
11
  }
@@ -1,13 +1,13 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { n as NodeDurableHost, o as NodeAdmission, s as makeNodePreparedInputAdmission } from "./NodeDurableHost-BMSajuQn.mjs";
3
- import { ScheduledInputAdmission } from "@effect-agent/thread/Schedule";
2
+ import { n as NodeDurableHost, o as NodeAdmission, s as makeNodePreparedInputAdmission } from "./NodeDurableHost-CG2xAhfb.mjs";
4
3
  import { NodeCrypto } from "@effect/platform-node";
5
4
  import { Cause, Duration, Effect, Exit, Layer, Option } from "effect";
6
- import { PreparedInputAdmission } from "@effect-agent/thread/PreparedInputAdmission";
7
- import "@effect-agent/thread/EventSource";
8
- import { SubscriptionStore, defaultSubscriptionLimits } from "@effect-agent/thread/Subscription";
9
- import "@effect-agent/thread/SubscriptionInput";
10
- import { SubscriptionDriver, SubscriptionIntake, Subscriptions } from "@effect-agent/thread/Subscriptions";
5
+ import { ScheduledInputAdmission } from "effect-agent/schedule";
6
+ import { PreparedInputAdmission } from "effect-agent/prepared-input-admission";
7
+ import "effect-agent/event-source";
8
+ import { SubscriptionStore, defaultSubscriptionLimits } from "effect-agent/subscription";
9
+ import "effect-agent/subscription-input";
10
+ import { SubscriptionDriver, SubscriptionIntake, Subscriptions } from "effect-agent/subscriptions";
11
11
  //#region src/NodeSubscriptions.ts
12
12
  var NodeSubscriptions_exports = /* @__PURE__ */ __exportAll({
13
13
  NodeSubscriptions: () => NodeSubscriptions,
@@ -1 +1 @@
1
- {"version":3,"file":"NodeSubscriptions.mjs","names":[],"sources":["../src/NodeSubscriptions.ts"],"sourcesContent":["import { type EventSources } from \"@effect-agent/thread/EventSource\";\nimport { PreparedInputAdmission } from \"@effect-agent/thread/PreparedInputAdmission\";\nimport { type ScheduledEnvelope, ScheduledInputAdmission } from \"@effect-agent/thread/Schedule\";\nimport {\n type PreparedInput,\n type SubscriptionAuthorizer,\n type SubscriptionError,\n type SubscriptionLimits,\n type SubscriptionStoreFailure,\n SubscriptionStore,\n defaultSubscriptionLimits,\n} from \"@effect-agent/thread/Subscription\";\nimport { type SubscriptionInputBindings } from \"@effect-agent/thread/SubscriptionInput\";\nimport {\n SubscriptionDriver,\n SubscriptionIntake,\n Subscriptions,\n} from \"@effect-agent/thread/Subscriptions\";\nimport { NodeCrypto } from \"@effect/platform-node\";\nimport { Cause, Duration, Effect, Exit, Layer, Option } from \"effect\";\n\nimport { makeNodePreparedInputAdmission, NodeAdmission } from \"./internal/prepared-admission.ts\";\nimport { NodeDurableHost } from \"./NodeDurableHost.ts\";\n\n/** Ordinary prepared admission through the Scope-owned Node host gate. */\nexport const nodePreparedInputAdmissionLayer: Layer.Layer<\n PreparedInputAdmission,\n never,\n NodeDurableHost\n> = Layer.effect(PreparedInputAdmission, makeNodePreparedInputAdmission).pipe(\n Layer.provide(Layer.effect(NodeAdmission, NodeDurableHost)),\n);\n\nconst preparedFromSchedule = (envelope: ScheduledEnvelope): PreparedInput => ({\n schemaVersion: 1,\n threadId: envelope.threadId,\n deliveryPrincipal: envelope.deliveryPrincipal,\n ...(envelope.admissionGroup === undefined ? {} : { admissionGroup: envelope.admissionGroup }),\n ...(envelope.admissionFence === undefined ? {} : { admissionFence: envelope.admissionFence }),\n agentId: envelope.agentId,\n definitions: envelope.definitions,\n input: envelope.input,\n inputDigest: envelope.inputDigest,\n admissionKey: envelope.admissionKey,\n authorization: envelope.authorization,\n});\n\n/** Compatibility adapter retaining the public scheduling admission port. */\nconst nodeScheduledInputAdmissionFromPreparedLayer: Layer.Layer<\n ScheduledInputAdmission,\n never,\n PreparedInputAdmission\n> = Layer.effect(\n ScheduledInputAdmission,\n Effect.map(PreparedInputAdmission, (admission) =>\n ScheduledInputAdmission.of({\n submit: (envelope) => admission.submit(preparedFromSchedule(envelope)),\n }),\n ),\n);\n\nexport const nodeScheduledInputAdmissionLayer: Layer.Layer<\n ScheduledInputAdmission,\n never,\n NodeDurableHost\n> = nodeScheduledInputAdmissionFromPreparedLayer.pipe(\n Layer.provide(nodePreparedInputAdmissionLayer),\n);\n\nconst reportPassFailure = (cause: Cause.Cause<SubscriptionStoreFailure>): Effect.Effect<boolean> =>\n Cause.hasInterruptsOnly(cause)\n ? Effect.interrupt\n : Effect.logWarning(\"Node subscription pass failed\").pipe(\n Effect.annotateLogs({\n failureTag: Option.match(Cause.findErrorOption(cause), {\n onNone: () => \"Defect\",\n onSome: (error) => error._tag,\n }),\n }),\n Effect.as(false),\n );\n\nconst nodeSubscriptionDriverLayer = (\n limits: SubscriptionLimits,\n): Layer.Layer<never, never, SubscriptionDriver | SubscriptionStore> =>\n Layer.effectDiscard(\n Effect.gen(function* () {\n const driver = yield* SubscriptionDriver;\n const store = yield* SubscriptionStore;\n\n const run = Effect.gen(function* () {\n while (true) {\n const passSucceeded = yield* driver.runDue.pipe(\n Effect.map((pass) => pass.failed === 0),\n Effect.catchCause(reportPassFailure),\n );\n\n if (!passSucceeded) {\n yield* Effect.sleep(Duration.millis(limits.retryMillis));\n continue;\n }\n\n const deadline = yield* store.nextDeadline.pipe(Effect.exit);\n\n if (Exit.isFailure(deadline)) {\n yield* reportPassFailure(deadline.cause);\n yield* Effect.sleep(Duration.millis(limits.retryMillis));\n continue;\n }\n\n const nowMillis = yield* Effect.clockWith((clock) => clock.currentTimeMillis);\n\n const delay =\n deadline.value === null\n ? limits.retryMillis\n : Math.max(1, Math.min(deadline.value - nowMillis, limits.retryMillis));\n\n yield* Effect.sleep(Duration.millis(delay));\n }\n });\n\n yield* Effect.forkScoped(run);\n }),\n );\n\nexport interface NodeSubscriptionsOptions {\n readonly limits?: SubscriptionLimits | undefined;\n}\n\n/**\n * One Scope-owned subscription partition in the sole process owning its SQLite database.\n * Indexed polling repairs restart and lost wake state; closing the Scope interrupts the driver.\n */\nexport class NodeSubscriptions {\n static layer(\n options: NodeSubscriptionsOptions = {},\n ): Layer.Layer<\n Subscriptions | SubscriptionIntake,\n SubscriptionError,\n | NodeDurableHost\n | SubscriptionStore\n | SubscriptionAuthorizer\n | EventSources\n | SubscriptionInputBindings\n > {\n const limits = options.limits ?? defaultSubscriptionLimits;\n\n const publicServices = Layer.merge(\n Subscriptions.layer(limits),\n SubscriptionIntake.layer(limits),\n );\n\n const driver = nodeSubscriptionDriverLayer(limits).pipe(\n Layer.provide(SubscriptionDriver.layer(limits)),\n );\n\n return Layer.merge(publicServices, driver).pipe(\n Layer.provide(nodePreparedInputAdmissionLayer),\n Layer.provide(NodeCrypto.layer),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,MAAa,kCAIT,MAAM,OAAO,wBAAwB,8BAA8B,CAAC,CAAC,KACvE,MAAM,QAAQ,MAAM,OAAO,eAAe,eAAe,CAAC,CAC5D;AAEA,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;IAC5B,OAAO,kBAAkB,SAAS,KAAK;IACvC,OAAO,OAAO,MAAM,SAAS,OAAO,OAAO,WAAW,CAAC;IACvD;GACF;GAEA,MAAM,YAAY,OAAO,OAAO,WAAW,UAAU,MAAM,iBAAiB;GAE5E,MAAM,QACJ,SAAS,UAAU,OACf,OAAO,cACP,KAAK,IAAI,GAAG,KAAK,IAAI,SAAS,QAAQ,WAAW,OAAO,WAAW,CAAC;GAE1E,OAAO,OAAO,MAAM,SAAS,OAAO,KAAK,CAAC;EAC5C;CACF,CAAC;CAED,OAAO,OAAO,WAAW,GAAG;AAC9B,CAAC,CACH;;;;;AAUF,IAAa,oBAAb,MAA+B;CAC7B,OAAO,MACL,UAAoC,CAAC,GASrC;EACA,MAAM,SAAS,QAAQ,UAAU;EAEjC,MAAM,iBAAiB,MAAM,MAC3B,cAAc,MAAM,MAAM,GAC1B,mBAAmB,MAAM,MAAM,CACjC;EAEA,MAAM,SAAS,4BAA4B,MAAM,CAAC,CAAC,KACjD,MAAM,QAAQ,mBAAmB,MAAM,MAAM,CAAC,CAChD;EAEA,OAAO,MAAM,MAAM,gBAAgB,MAAM,CAAC,CAAC,KACzC,MAAM,QAAQ,+BAA+B,GAC7C,MAAM,QAAQ,WAAW,KAAK,CAChC;CACF;AACF"}
1
+ {"version":3,"file":"NodeSubscriptions.mjs","names":[],"sources":["../src/NodeSubscriptions.ts"],"sourcesContent":["import { NodeCrypto } from \"@effect/platform-node\";\nimport { Cause, Duration, Effect, Exit, Layer, Option } from \"effect\";\nimport { type EventSources } from \"effect-agent/event-source\";\nimport { PreparedInputAdmission } from \"effect-agent/prepared-input-admission\";\nimport { type ScheduledEnvelope, ScheduledInputAdmission } from \"effect-agent/schedule\";\nimport {\n type PreparedInput,\n type SubscriptionAuthorizer,\n type SubscriptionError,\n type SubscriptionLimits,\n type SubscriptionStoreFailure,\n SubscriptionStore,\n defaultSubscriptionLimits,\n} from \"effect-agent/subscription\";\nimport { type SubscriptionInputBindings } from \"effect-agent/subscription-input\";\nimport { SubscriptionDriver, SubscriptionIntake, Subscriptions } from \"effect-agent/subscriptions\";\n\nimport { makeNodePreparedInputAdmission, NodeAdmission } from \"./internal/prepared-admission.ts\";\nimport { NodeDurableHost } from \"./NodeDurableHost.ts\";\n\n/** Ordinary prepared admission through the Scope-owned Node host gate. */\nexport const nodePreparedInputAdmissionLayer: Layer.Layer<\n PreparedInputAdmission,\n never,\n NodeDurableHost\n> = Layer.effect(PreparedInputAdmission, makeNodePreparedInputAdmission).pipe(\n Layer.provide(Layer.effect(NodeAdmission, NodeDurableHost)),\n);\n\nconst preparedFromSchedule = (envelope: ScheduledEnvelope): PreparedInput => ({\n schemaVersion: 1,\n threadId: envelope.threadId,\n deliveryPrincipal: envelope.deliveryPrincipal,\n ...(envelope.admissionGroup === undefined ? {} : { admissionGroup: envelope.admissionGroup }),\n ...(envelope.admissionFence === undefined ? {} : { admissionFence: envelope.admissionFence }),\n agentId: envelope.agentId,\n definitions: envelope.definitions,\n input: envelope.input,\n inputDigest: envelope.inputDigest,\n admissionKey: envelope.admissionKey,\n authorization: envelope.authorization,\n});\n\n/** Compatibility adapter retaining the public scheduling admission port. */\nconst nodeScheduledInputAdmissionFromPreparedLayer: Layer.Layer<\n ScheduledInputAdmission,\n never,\n PreparedInputAdmission\n> = Layer.effect(\n ScheduledInputAdmission,\n Effect.map(PreparedInputAdmission, (admission) =>\n ScheduledInputAdmission.of({\n submit: (envelope) => admission.submit(preparedFromSchedule(envelope)),\n }),\n ),\n);\n\nexport const nodeScheduledInputAdmissionLayer: Layer.Layer<\n ScheduledInputAdmission,\n never,\n NodeDurableHost\n> = nodeScheduledInputAdmissionFromPreparedLayer.pipe(\n Layer.provide(nodePreparedInputAdmissionLayer),\n);\n\nconst reportPassFailure = (cause: Cause.Cause<SubscriptionStoreFailure>): Effect.Effect<boolean> =>\n Cause.hasInterruptsOnly(cause)\n ? Effect.interrupt\n : Effect.logWarning(\"Node subscription pass failed\").pipe(\n Effect.annotateLogs({\n failureTag: Option.match(Cause.findErrorOption(cause), {\n onNone: () => \"Defect\",\n onSome: (error) => error._tag,\n }),\n }),\n Effect.as(false),\n );\n\nconst nodeSubscriptionDriverLayer = (\n limits: SubscriptionLimits,\n): Layer.Layer<never, never, SubscriptionDriver | SubscriptionStore> =>\n Layer.effectDiscard(\n Effect.gen(function* () {\n const driver = yield* SubscriptionDriver;\n const store = yield* SubscriptionStore;\n\n const run = Effect.gen(function* () {\n while (true) {\n const passSucceeded = yield* driver.runDue.pipe(\n Effect.map((pass) => pass.failed === 0),\n Effect.catchCause(reportPassFailure),\n );\n\n if (!passSucceeded) {\n yield* Effect.sleep(Duration.millis(limits.retryMillis));\n continue;\n }\n\n const deadline = yield* store.nextDeadline.pipe(Effect.exit);\n\n if (Exit.isFailure(deadline)) {\n yield* reportPassFailure(deadline.cause);\n yield* Effect.sleep(Duration.millis(limits.retryMillis));\n continue;\n }\n\n const nowMillis = yield* Effect.clockWith((clock) => clock.currentTimeMillis);\n\n const delay =\n deadline.value === null\n ? limits.retryMillis\n : Math.max(1, Math.min(deadline.value - nowMillis, limits.retryMillis));\n\n yield* Effect.sleep(Duration.millis(delay));\n }\n });\n\n yield* Effect.forkScoped(run);\n }),\n );\n\nexport interface NodeSubscriptionsOptions {\n readonly limits?: SubscriptionLimits | undefined;\n}\n\n/**\n * One Scope-owned subscription partition in the sole process owning its SQLite database.\n * Indexed polling repairs restart and lost wake state; closing the Scope interrupts the driver.\n */\nexport class NodeSubscriptions {\n static layer(\n options: NodeSubscriptionsOptions = {},\n ): Layer.Layer<\n Subscriptions | SubscriptionIntake,\n SubscriptionError,\n | NodeDurableHost\n | SubscriptionStore\n | SubscriptionAuthorizer\n | EventSources\n | SubscriptionInputBindings\n > {\n const limits = options.limits ?? defaultSubscriptionLimits;\n\n const publicServices = Layer.merge(\n Subscriptions.layer(limits),\n SubscriptionIntake.layer(limits),\n );\n\n const driver = nodeSubscriptionDriverLayer(limits).pipe(\n Layer.provide(SubscriptionDriver.layer(limits)),\n );\n\n return Layer.merge(publicServices, driver).pipe(\n Layer.provide(nodePreparedInputAdmissionLayer),\n Layer.provide(NodeCrypto.layer),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAqBA,MAAa,kCAIT,MAAM,OAAO,wBAAwB,8BAA8B,CAAC,CAAC,KACvE,MAAM,QAAQ,MAAM,OAAO,eAAe,eAAe,CAAC,CAC5D;AAEA,MAAM,wBAAwB,cAAgD;CAC5E,eAAe;CACf,UAAU,SAAS;CACnB,mBAAmB,SAAS;CAC5B,GAAI,SAAS,mBAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,gBAAgB,SAAS,eAAe;CAC3F,GAAI,SAAS,mBAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,gBAAgB,SAAS,eAAe;CAC3F,SAAS,SAAS;CAClB,aAAa,SAAS;CACtB,OAAO,SAAS;CAChB,aAAa,SAAS;CACtB,cAAc,SAAS;CACvB,eAAe,SAAS;AAC1B;AAgBA,MAAa,mCATT,MAAM,OACR,yBACA,OAAO,IAAI,yBAAyB,cAClC,wBAAwB,GAAG,EACzB,SAAS,aAAa,UAAU,OAAO,qBAAqB,QAAQ,CAAC,EACvE,CAAC,CACH,CAOE,CAAA,CAA6C,KAC/C,MAAM,QAAQ,+BAA+B,CAC/C;AAEA,MAAM,qBAAqB,UACzB,MAAM,kBAAkB,KAAK,IACzB,OAAO,YACP,OAAO,WAAW,+BAA+B,CAAC,CAAC,KACjD,OAAO,aAAa,EAClB,YAAY,OAAO,MAAM,MAAM,gBAAgB,KAAK,GAAG;CACrD,cAAc;CACd,SAAS,UAAU,MAAM;AAC3B,CAAC,EACH,CAAC,GACD,OAAO,GAAG,KAAK,CACjB;AAEN,MAAM,+BACJ,WAEA,MAAM,cACJ,OAAO,IAAI,aAAa;CACtB,MAAM,SAAS,OAAO;CACtB,MAAM,QAAQ,OAAO;CAErB,MAAM,MAAM,OAAO,IAAI,aAAa;EAClC,OAAO,MAAM;GAMX,IAAI,EAAC,OALwB,OAAO,OAAO,KACzC,OAAO,KAAK,SAAS,KAAK,WAAW,CAAC,GACtC,OAAO,WAAW,iBAAiB,CACrC,IAEoB;IAClB,OAAO,OAAO,MAAM,SAAS,OAAO,OAAO,WAAW,CAAC;IACvD;GACF;GAEA,MAAM,WAAW,OAAO,MAAM,aAAa,KAAK,OAAO,IAAI;GAE3D,IAAI,KAAK,UAAU,QAAQ,GAAG;IAC5B,OAAO,kBAAkB,SAAS,KAAK;IACvC,OAAO,OAAO,MAAM,SAAS,OAAO,OAAO,WAAW,CAAC;IACvD;GACF;GAEA,MAAM,YAAY,OAAO,OAAO,WAAW,UAAU,MAAM,iBAAiB;GAE5E,MAAM,QACJ,SAAS,UAAU,OACf,OAAO,cACP,KAAK,IAAI,GAAG,KAAK,IAAI,SAAS,QAAQ,WAAW,OAAO,WAAW,CAAC;GAE1E,OAAO,OAAO,MAAM,SAAS,OAAO,KAAK,CAAC;EAC5C;CACF,CAAC;CAED,OAAO,OAAO,WAAW,GAAG;AAC9B,CAAC,CACH;;;;;AAUF,IAAa,oBAAb,MAA+B;CAC7B,OAAO,MACL,UAAoC,CAAC,GASrC;EACA,MAAM,SAAS,QAAQ,UAAU;EAEjC,MAAM,iBAAiB,MAAM,MAC3B,cAAc,MAAM,MAAM,GAC1B,mBAAmB,MAAM,MAAM,CACjC;EAEA,MAAM,SAAS,4BAA4B,MAAM,CAAC,CAAC,KACjD,MAAM,QAAQ,mBAAmB,MAAM,MAAM,CAAC,CAChD;EAEA,OAAO,MAAM,MAAM,gBAAgB,MAAM,CAAC,CAAC,KACzC,MAAM,QAAQ,+BAA+B,GAC7C,MAAM,QAAQ,WAAW,KAAK,CAChC;CACF;AACF"}
@@ -1,6 +1,6 @@
1
- import { SubmissionLedger } from "@effect-agent/thread/SubmissionLedger";
2
- import { WakeScheduler } from "@effect-agent/thread/WakeScheduler";
3
1
  import { Context, Duration, Layer } from "effect";
2
+ import { SubmissionLedger } from "effect-agent/submission-ledger";
3
+ import { WakeScheduler } from "effect-agent/wake-scheduler";
4
4
  declare namespace NodeWakeScheduler_d_exports {
5
5
  export { NodeWakeSchedulerConfig, nodeWakeSchedulerLayer };
6
6
  }
@@ -24,4 +24,4 @@ declare class NodeWakeSchedulerConfig extends NodeWakeSchedulerConfig_base {
24
24
  declare const nodeWakeSchedulerLayer: Layer.Layer<WakeScheduler, never, SubmissionLedger | NodeWakeSchedulerConfig>;
25
25
  //#endregion
26
26
  export { NodeWakeScheduler_d_exports as n, nodeWakeSchedulerLayer as r, NodeWakeSchedulerConfig as t };
27
- //# sourceMappingURL=NodeWakeScheduler-4ZeXYwPu.d.mts.map
27
+ //# sourceMappingURL=NodeWakeScheduler-CCgm1t-G.d.mts.map
@@ -1,2 +1,2 @@
1
- import { r as nodeWakeSchedulerLayer, t as NodeWakeSchedulerConfig } from "./NodeWakeScheduler-4ZeXYwPu.mjs";
1
+ import { r as nodeWakeSchedulerLayer, t as NodeWakeSchedulerConfig } from "./NodeWakeScheduler-CCgm1t-G.mjs";
2
2
  export { NodeWakeSchedulerConfig, nodeWakeSchedulerLayer };
@@ -1,8 +1,8 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import "@effect-agent/core/Identifiers";
3
- import { SubmissionLedger } from "@effect-agent/thread/SubmissionLedger";
4
- import { WakeScheduler, makeWakeSubscriptionHub } from "@effect-agent/thread/WakeScheduler";
5
2
  import { Context, Effect, Layer, PubSub, Stream } from "effect";
3
+ import "effect-agent/identifiers";
4
+ import { SubmissionLedger } from "effect-agent/submission-ledger";
5
+ import { WakeScheduler, makeWakeSubscriptionHub } from "effect-agent/wake-scheduler";
6
6
  //#region src/NodeWakeScheduler.ts
7
7
  var NodeWakeScheduler_exports = /* @__PURE__ */ __exportAll({
8
8
  NodeWakeSchedulerConfig: () => NodeWakeSchedulerConfig,
@@ -1 +1 @@
1
- {"version":3,"file":"NodeWakeScheduler.mjs","names":[],"sources":["../src/NodeWakeScheduler.ts"],"sourcesContent":["import { type ThreadId } from \"@effect-agent/core/Identifiers\";\nimport { SubmissionLedger } from \"@effect-agent/thread/SubmissionLedger\";\nimport { makeWakeSubscriptionHub, WakeScheduler } from \"@effect-agent/thread/WakeScheduler\";\nimport type { Duration } from \"effect\";\nimport { Context, Effect, Layer, PubSub, Stream } from \"effect\";\n\n/**\n * Bounded in-process wake buffer. Wake hints are droppable by contract (the ledger-scan fallback\n * keeps liveness), so a full buffer slides out the oldest hint instead of growing without bound.\n */\nconst WAKE_BUFFER_CAPACITY = 1_024;\n\n/** Cadence authority for the Node wake scheduler's ledger-scan fallback loop. */\nexport class NodeWakeSchedulerConfig extends Context.Service<\n NodeWakeSchedulerConfig,\n {\n /** Interval between ledger scans that re-emit every nonterminal Thread lane. */\n readonly scanInterval: Duration.Duration;\n }\n>()(\"@effect-agent/platform-node/NodeWakeSchedulerConfig\") {\n static layer(options: {\n readonly scanInterval: Duration.Duration;\n }): Layer.Layer<NodeWakeSchedulerConfig> {\n return Layer.succeed(NodeWakeSchedulerConfig)({ scanInterval: options.scanInterval });\n }\n}\n\nconst makeWakeScheduler = Effect.gen(function* () {\n const ledger = yield* SubmissionLedger;\n const config = yield* NodeWakeSchedulerConfig;\n const hints = yield* PubSub.sliding<ThreadId>(WAKE_BUFFER_CAPACITY);\n const progress = yield* makeWakeSubscriptionHub;\n\n yield* Effect.addFinalizer(() => PubSub.shutdown(hints));\n\n /**\n * One fallback scan: every Thread lane with nonterminal work, deduplicated. A scan\n * failure degrades to \"no hints this round\" — the wake channel has no error contract and the\n * next round retries — but is logged so a persistently failing ledger stays visible.\n */\n const scanOnce: Effect.Effect<ReadonlyArray<ThreadId>> = Stream.runCollect(\n ledger.scanNonterminal,\n ).pipe(\n Effect.map((snapshots) => {\n const lanes = new Set<ThreadId>();\n\n for (const snapshot of snapshots) {\n lanes.add(snapshot.threadId);\n }\n\n return [...lanes];\n }),\n Effect.catch((error) =>\n Effect.logWarning(\"NodeWakeScheduler fallback scan failed\", error).pipe(\n Effect.as([] as ReadonlyArray<ThreadId>),\n ),\n ),\n );\n\n /**\n * Deployment §3: correctness must not depend on in-memory notifications, so every `wakes` run\n * merges its PubSub subscription with shared Clock-driven ledger scans. Share whole snapshots:\n * sliding individual lanes would strand the beginning of scans larger than the hint buffer.\n * The scan starts with the first subscriber and stops when the last subscriber leaves.\n */\n const fallbackScans = yield* Stream.share(\n Stream.fromEffectRepeat(Effect.sleep(config.scanInterval).pipe(Effect.andThen(scanOnce))),\n { capacity: 1, strategy: \"sliding\" },\n );\n\n return WakeScheduler.of({\n notify: (threadId) =>\n progress\n .notify(threadId)\n .pipe(Effect.andThen(PubSub.publish(hints, threadId)), Effect.asVoid),\n subscribe: progress.subscribe,\n wakes: Stream.merge(\n Stream.fromPubSub(hints),\n fallbackScans.pipe(Stream.flatMap(Stream.fromIterable)),\n ),\n });\n});\n\n/**\n * In-process Node `WakeScheduler`: `notify` publishes to a bounded sliding PubSub for prompt\n * same-process wakeups, and active `wakes` subscriptions share one periodic\n * `SubmissionLedger.scanNonterminal` fallback so a dropped, coalesced, or never-sent notification\n * can never strand accepted work (persistence §14). Delivery may duplicate; consumers already\n * treat wakes as pure liveness hints.\n */\nexport const nodeWakeSchedulerLayer: Layer.Layer<\n WakeScheduler,\n never,\n SubmissionLedger | NodeWakeSchedulerConfig\n> = Layer.effect(WakeScheduler)(makeWakeScheduler);\n"],"mappings":";;;;;;;;;;;;;;AAUA,MAAM,uBAAuB;;AAG7B,IAAa,0BAAb,MAAa,gCAAgC,QAAQ,QAMnD,CAAC,CAAC,qDAAqD,CAAC,CAAC;CACzD,OAAO,MAAM,SAE4B;EACvC,OAAO,MAAM,QAAQ,uBAAuB,CAAC,CAAC,EAAE,cAAc,QAAQ,aAAa,CAAC;CACtF;AACF;AAEA,MAAM,oBAAoB,OAAO,IAAI,aAAa;CAChD,MAAM,SAAS,OAAO;CACtB,MAAM,SAAS,OAAO;CACtB,MAAM,QAAQ,OAAO,OAAO,QAAkB,oBAAoB;CAClE,MAAM,WAAW,OAAO;CAExB,OAAO,OAAO,mBAAmB,OAAO,SAAS,KAAK,CAAC;;;;;;CAOvD,MAAM,WAAmD,OAAO,WAC9D,OAAO,eACT,CAAC,CAAC,KACA,OAAO,KAAK,cAAc;EACxB,MAAM,wBAAQ,IAAI,IAAc;EAEhC,KAAK,MAAM,YAAY,WACrB,MAAM,IAAI,SAAS,QAAQ;EAG7B,OAAO,CAAC,GAAG,KAAK;CAClB,CAAC,GACD,OAAO,OAAO,UACZ,OAAO,WAAW,0CAA0C,KAAK,CAAC,CAAC,KACjE,OAAO,GAAG,CAAC,CAA4B,CACzC,CACF,CACF;;;;;;;CAQA,MAAM,gBAAgB,OAAO,OAAO,MAClC,OAAO,iBAAiB,OAAO,MAAM,OAAO,YAAY,CAAC,CAAC,KAAK,OAAO,QAAQ,QAAQ,CAAC,CAAC,GACxF;EAAE,UAAU;EAAG,UAAU;CAAU,CACrC;CAEA,OAAO,cAAc,GAAG;EACtB,SAAS,aACP,SACG,OAAO,QAAQ,CAAC,CAChB,KAAK,OAAO,QAAQ,OAAO,QAAQ,OAAO,QAAQ,CAAC,GAAG,OAAO,MAAM;EACxE,WAAW,SAAS;EACpB,OAAO,OAAO,MACZ,OAAO,WAAW,KAAK,GACvB,cAAc,KAAK,OAAO,QAAQ,OAAO,YAAY,CAAC,CACxD;CACF,CAAC;AACH,CAAC;;;;;;;;AASD,MAAa,yBAIT,MAAM,OAAO,aAAa,CAAC,CAAC,iBAAiB"}
1
+ {"version":3,"file":"NodeWakeScheduler.mjs","names":[],"sources":["../src/NodeWakeScheduler.ts"],"sourcesContent":["import type { Duration } from \"effect\";\nimport { Context, Effect, Layer, PubSub, Stream } from \"effect\";\nimport { type ThreadId } from \"effect-agent/identifiers\";\nimport { SubmissionLedger } from \"effect-agent/submission-ledger\";\nimport { makeWakeSubscriptionHub, WakeScheduler } from \"effect-agent/wake-scheduler\";\n\n/**\n * Bounded in-process wake buffer. Wake hints are droppable by contract (the ledger-scan fallback\n * keeps liveness), so a full buffer slides out the oldest hint instead of growing without bound.\n */\nconst WAKE_BUFFER_CAPACITY = 1_024;\n\n/** Cadence authority for the Node wake scheduler's ledger-scan fallback loop. */\nexport class NodeWakeSchedulerConfig extends Context.Service<\n NodeWakeSchedulerConfig,\n {\n /** Interval between ledger scans that re-emit every nonterminal Thread lane. */\n readonly scanInterval: Duration.Duration;\n }\n>()(\"@effect-agent/platform-node/NodeWakeSchedulerConfig\") {\n static layer(options: {\n readonly scanInterval: Duration.Duration;\n }): Layer.Layer<NodeWakeSchedulerConfig> {\n return Layer.succeed(NodeWakeSchedulerConfig)({ scanInterval: options.scanInterval });\n }\n}\n\nconst makeWakeScheduler = Effect.gen(function* () {\n const ledger = yield* SubmissionLedger;\n const config = yield* NodeWakeSchedulerConfig;\n const hints = yield* PubSub.sliding<ThreadId>(WAKE_BUFFER_CAPACITY);\n const progress = yield* makeWakeSubscriptionHub;\n\n yield* Effect.addFinalizer(() => PubSub.shutdown(hints));\n\n /**\n * One fallback scan: every Thread lane with nonterminal work, deduplicated. A scan\n * failure degrades to \"no hints this round\" — the wake channel has no error contract and the\n * next round retries — but is logged so a persistently failing ledger stays visible.\n */\n const scanOnce: Effect.Effect<ReadonlyArray<ThreadId>> = Stream.runCollect(\n ledger.scanNonterminal,\n ).pipe(\n Effect.map((snapshots) => {\n const lanes = new Set<ThreadId>();\n\n for (const snapshot of snapshots) {\n lanes.add(snapshot.threadId);\n }\n\n return [...lanes];\n }),\n Effect.catch((error) =>\n Effect.logWarning(\"NodeWakeScheduler fallback scan failed\", error).pipe(\n Effect.as([] as ReadonlyArray<ThreadId>),\n ),\n ),\n );\n\n /**\n * Deployment §3: correctness must not depend on in-memory notifications, so every `wakes` run\n * merges its PubSub subscription with shared Clock-driven ledger scans. Share whole snapshots:\n * sliding individual lanes would strand the beginning of scans larger than the hint buffer.\n * The scan starts with the first subscriber and stops when the last subscriber leaves.\n */\n const fallbackScans = yield* Stream.share(\n Stream.fromEffectRepeat(Effect.sleep(config.scanInterval).pipe(Effect.andThen(scanOnce))),\n { capacity: 1, strategy: \"sliding\" },\n );\n\n return WakeScheduler.of({\n notify: (threadId) =>\n progress\n .notify(threadId)\n .pipe(Effect.andThen(PubSub.publish(hints, threadId)), Effect.asVoid),\n subscribe: progress.subscribe,\n wakes: Stream.merge(\n Stream.fromPubSub(hints),\n fallbackScans.pipe(Stream.flatMap(Stream.fromIterable)),\n ),\n });\n});\n\n/**\n * In-process Node `WakeScheduler`: `notify` publishes to a bounded sliding PubSub for prompt\n * same-process wakeups, and active `wakes` subscriptions share one periodic\n * `SubmissionLedger.scanNonterminal` fallback so a dropped, coalesced, or never-sent notification\n * can never strand accepted work (persistence §14). Delivery may duplicate; consumers already\n * treat wakes as pure liveness hints.\n */\nexport const nodeWakeSchedulerLayer: Layer.Layer<\n WakeScheduler,\n never,\n SubmissionLedger | NodeWakeSchedulerConfig\n> = Layer.effect(WakeScheduler)(makeWakeScheduler);\n"],"mappings":";;;;;;;;;;;;;;AAUA,MAAM,uBAAuB;;AAG7B,IAAa,0BAAb,MAAa,gCAAgC,QAAQ,QAMnD,CAAC,CAAC,qDAAqD,CAAC,CAAC;CACzD,OAAO,MAAM,SAE4B;EACvC,OAAO,MAAM,QAAQ,uBAAuB,CAAC,CAAC,EAAE,cAAc,QAAQ,aAAa,CAAC;CACtF;AACF;AAEA,MAAM,oBAAoB,OAAO,IAAI,aAAa;CAChD,MAAM,SAAS,OAAO;CACtB,MAAM,SAAS,OAAO;CACtB,MAAM,QAAQ,OAAO,OAAO,QAAkB,oBAAoB;CAClE,MAAM,WAAW,OAAO;CAExB,OAAO,OAAO,mBAAmB,OAAO,SAAS,KAAK,CAAC;;;;;;CAOvD,MAAM,WAAmD,OAAO,WAC9D,OAAO,eACT,CAAC,CAAC,KACA,OAAO,KAAK,cAAc;EACxB,MAAM,wBAAQ,IAAI,IAAc;EAEhC,KAAK,MAAM,YAAY,WACrB,MAAM,IAAI,SAAS,QAAQ;EAG7B,OAAO,CAAC,GAAG,KAAK;CAClB,CAAC,GACD,OAAO,OAAO,UACZ,OAAO,WAAW,0CAA0C,KAAK,CAAC,CAAC,KACjE,OAAO,GAAG,CAAC,CAA4B,CACzC,CACF,CACF;;;;;;;CAQA,MAAM,gBAAgB,OAAO,OAAO,MAClC,OAAO,iBAAiB,OAAO,MAAM,OAAO,YAAY,CAAC,CAAC,KAAK,OAAO,QAAQ,QAAQ,CAAC,CAAC,GACxF;EAAE,UAAU;EAAG,UAAU;CAAU,CACrC;CAEA,OAAO,cAAc,GAAG;EACtB,SAAS,aACP,SACG,OAAO,QAAQ,CAAC,CAChB,KAAK,OAAO,QAAQ,OAAO,QAAQ,OAAO,QAAQ,CAAC,GAAG,OAAO,MAAM;EACxE,WAAW,SAAS;EACpB,OAAO,OAAO,MACZ,OAAO,WAAW,KAAK,GACvB,cAAc,KAAK,OAAO,QAAQ,OAAO,YAAY,CAAC,CACxD;CACF,CAAC;AACH,CAAC;;;;;;;;AASD,MAAa,yBAIT,MAAM,OAAO,aAAa,CAAC,CAAC,iBAAiB"}
@@ -1,5 +1,5 @@
1
1
  import { Cause, Duration, Layer, Schema } from "effect";
2
- import { WorkflowDispatchError, WorkflowDispatchStore, WorkflowRepairTrigger } from "@effect-agent/workflow/WorkflowDispatch";
2
+ import { WorkflowDispatchError, WorkflowDispatchStore, WorkflowRepairTrigger } from "@effect-agent/workflow/workflow-dispatch";
3
3
  import { SqlClient } from "effect/unstable/sql";
4
4
  //#region src/NodeWorkflow.d.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { Cause, Duration, Effect, Layer, Option, Schema } from "effect";
2
- import { WorkflowDispatchError, WorkflowDispatchIntent, WorkflowDispatchScan, WorkflowDispatchStore, WorkflowRepairTrigger } from "@effect-agent/workflow/WorkflowDispatch";
2
+ import { WorkflowDispatchError, WorkflowDispatchIntent, WorkflowDispatchScan, WorkflowDispatchStore, WorkflowRepairTrigger } from "@effect-agent/workflow/workflow-dispatch";
3
3
  import { SqlClient } from "effect/unstable/sql";
4
4
  //#region src/NodeWorkflow.ts
5
5
  const StoredIntent = Schema.Struct({
@@ -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.decodeUnknownEffect(WorkflowDispatchIntent)(input);
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.decodeUnknownEffect(WorkflowDispatchScan)(input);
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.decodeUnknownEffect(WorkflowDispatchIntent)(input);
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.catchCause((cause) => Cause.hasInterruptsOnly(cause) ? Effect.failCause(cause) : Effect.logError("Workflow repair trigger failed; next poll will retry", cause)));
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,oBAAoB,cAAc,EAAE,kBAAkB,QAAQ,CAAC,CAAC,CAAC,KAAK;CAChG,MAAM,SAAS,OAAO,aAAa,IAAI,WAAW;CAElD,IACE,IAAI,kBAAkB,OAAO,gBAC7B,IAAI,kBAAkB,OAAO,gBAC7B,IAAI,iBAAiB,OAAO,aAE5B,OAAO,OAAO,IAAI,sBAAsB;EACtC,WAAW;EACX,SAAS;CACX,CAAC;CAGH,OAAO;AACT,CAAC;;;;;;;;AASD,IAAa,2BAAb,MAAsC;CACpC,OAAgB,QAIZ,MAAM,OAAO,qBAAqB,CAAC,CACrC,OAAO,IAAI,aAAa;EACtB,MAAM,OAAO,OAAO,UAAU,UAAA,CAAW,kBAAkB;EAE3D,OAAO,GAAG;;;;;;;;;EASV,OAAO,GAAG;;;;EAKV,MAAM,MAAM,OAAO,GAAG,8BAA8B,CAAC,CACnD,WAAW,OAA+B;GACxC,MAAM,SAAS,OAAO,OAAO,oBAAoB,sBAAsB,CAAC,CAAC,KAA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GAElE,IACE,OAAO,OAAO,QAAQ,KACtB,CAAC,SAAS,SAAS,SAAS,KAAK,KACjC,CAAC,SAAS,WAAW,SAAS,KAAK,GAEnC,OAAO,OAAO,IAAI,8BAA8B,EAC9C,SAAS,gEACX,CAAC;GAEH,MAAM,QAAQ,SAAS;GAEvB,OAAO,sBAAsB,GAAG,EAC9B,UAAU,OAAO,GAAG,oCAAoC,CAAC,CAAC,WAAW,QAAQ;IAC3E,MAAM,UAAU,OAAO,KACrB,OAAO,YAAY,UACjB,MAAM,kBAAkB,KAAK,IACzB,OAAO,UAAU,KAAK,IACtB,OAAO,SAAS,wDAAwD,KAAK,CACnF,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"}
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/workflow-dispatch\";\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,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,oBAAoB,cAAc,EAAE,kBAAkB,QAAQ,CAAC,CAAC,CAAC,KAAK;CAChG,MAAM,SAAS,OAAO,aAAa,IAAI,WAAW;CAElD,IACE,IAAI,kBAAkB,OAAO,gBAC7B,IAAI,kBAAkB,OAAO,gBAC7B,IAAI,iBAAiB,OAAO,aAE5B,OAAO,OAAO,IAAI,sBAAsB;EACtC,WAAW;EACX,SAAS;CACX,CAAC;CAGH,OAAO;AACT,CAAC;;;;;;;;AASD,IAAa,2BAAb,MAAsC;CACpC,OAAgB,QAIZ,MAAM,OAAO,qBAAqB,CAAC,CACrC,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ACpG,iCACA,EAAE,SAAS,OAAO,OAAO,CAC3B,CAAC,CAAC,CAAC;;AAGH,IAAa,4BAAb,MAAuC;CACrC,OAAO,MACL,UAAkD,CAAC,GACgB;EACnE,OAAO,MAAM,OAAO,qBAAqB,CAAC,CACxC,OAAO,IAAI,aAAa;GACtB,MAAM,WAAW,SAAS,UAAU,QAAQ,YAAY,UAAU;GAElE,IACE,OAAO,OAAO,QAAQ,KACtB,CAAC,SAAS,SAAS,SAAS,KAAK,KACjC,CAAC,SAAS,WAAW,SAAS,KAAK,GAEnC,OAAO,OAAO,IAAI,8BAA8B,EAC9C,SAAS,gEACX,CAAC;GAEH,MAAM,QAAQ,SAAS;GAEvB,OAAO,sBAAsB,GAAG,EAC9B,UAAU,OAAO,GAAG,oCAAoC,CAAC,CAAC,WAAW,QAAQ;IAC3E,MAAM,UAAU,OAAO,KACrB,OAAO,cACJ,UAAU,CAAC,MAAM,kBAAkB,KAAK,IACxC,UACC,OAAO,SAAS,wDAAwD,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
- import { n as NodeWakeScheduler_d_exports } from "./NodeWakeScheduler-4ZeXYwPu.mjs";
2
- import { s as NodeDurableAgentRuntime_d_exports } from "./NodeDurableAgentRuntime-CFElFzNF.mjs";
1
+ import { n as NodeWakeScheduler_d_exports } from "./NodeWakeScheduler-CCgm1t-G.mjs";
2
+ import { s as NodeDurableAgentRuntime_d_exports } from "./NodeDurableAgentRuntime-Cs_E9W_9.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/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as NodeWakeScheduler_exports } from "./NodeWakeScheduler.mjs";
2
2
  import { t as NodeDurableAgentRuntime_exports } from "./NodeDurableAgentRuntime.mjs";
3
- import { r as NodeDurableHost_exports } from "./NodeDurableHost-BMSajuQn.mjs";
3
+ import { r as NodeDurableHost_exports } from "./NodeDurableHost-CG2xAhfb.mjs";
4
4
  import { t as NodeSubscriptions_exports } from "./NodeSubscriptions.mjs";
5
5
  import { t as NodeScheduling_exports } from "./NodeScheduling.mjs";
6
6
  export { NodeDurableAgentRuntime_exports as NodeDurableAgentRuntime, NodeDurableHost_exports as NodeDurableHost, NodeScheduling_exports as NodeScheduling, NodeSubscriptions_exports as NodeSubscriptions, NodeWakeScheduler_exports as NodeWakeScheduler };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@effect-agent/platform-node","version":"0.1.0-beta.84","dependencies":{"@effect-agent/core":"0.1.0-beta.84","@effect-agent/engine":"0.1.0-beta.84","@effect-agent/storage-sqlite":"0.1.0-beta.84","@effect-agent/thread":"0.1.0-beta.84","@effect-agent/workflow":"0.1.0-beta.84","@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.84","@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"}}
1
+ {"name":"@effect-agent/platform-node","version":"0.1.0-beta.86","dependencies":{"@effect-agent/storage-sqlite":"0.1.0-beta.86","@effect-agent/workflow":"0.1.0-beta.86","@effect/platform-node":"4.0.0-rc.112","@effect/sql-sqlite-node":"4.0.0-rc.112","effect-agent":"0.1.0-beta.86"},"devDependencies":{"@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"},"./node-durable-agent-runtime":{"types":"./dist/NodeDurableAgentRuntime.d.mts","default":"./dist/NodeDurableAgentRuntime.mjs"},"./node-durable-host":{"types":"./dist/NodeDurableHost.d.mts","default":"./dist/NodeDurableHost.mjs"},"./node-scheduling":{"types":"./dist/NodeScheduling.d.mts","default":"./dist/NodeScheduling.mjs"},"./node-subscriptions":{"types":"./dist/NodeSubscriptions.d.mts","default":"./dist/NodeSubscriptions.mjs"},"./node-wake-scheduler":{"types":"./dist/NodeWakeScheduler.d.mts","default":"./dist/NodeWakeScheduler.mjs"},"./node-workflow":{"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"}}