@effect-agent/platform-node 0.1.0-beta.44 → 0.1.0-beta.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,159 @@
1
+ import { Cause, Duration, Effect, Layer, Option, Schema } from "effect";
2
+ import { WorkflowDispatchError, WorkflowDispatchIntent, WorkflowDispatchScan, WorkflowDispatchStore, WorkflowRepairTrigger } from "@effect-agent/workflow/WorkflowDispatch";
3
+ import { SqlClient } from "effect/unstable/sql";
4
+ //#region src/NodeWorkflow.ts
5
+ const StoredIntent = Schema.Struct({
6
+ deployment_id: Schema.String,
7
+ workflow_name: Schema.String,
8
+ execution_id: Schema.String,
9
+ intent_json: Schema.String
10
+ });
11
+ const IntentJson = Schema.fromJsonString(WorkflowDispatchIntent);
12
+ const decodeIntent = Schema.decodeUnknownEffect(IntentJson, { onExcessProperty: "error" });
13
+ const encodeIntent = Schema.encodeEffect(IntentJson);
14
+ const dispatchError = (operation) => (cause) => Schema.is(WorkflowDispatchError)(cause) ? cause : new WorkflowDispatchError({
15
+ operation,
16
+ message: "Workflow dispatch storage failed or contains incompatible data",
17
+ cause
18
+ });
19
+ const decodeRow = Effect.fn("SqlWorkflowDispatchStore.decodeRow")(function* (value) {
20
+ const row = yield* Schema.decodeUnknownEffect(StoredIntent, { onExcessProperty: "error" })(value);
21
+ const intent = yield* decodeIntent(row.intent_json);
22
+ if (row.deployment_id !== intent.deploymentId || row.workflow_name !== intent.workflowName || row.execution_id !== intent.executionId) return yield* new WorkflowDispatchError({
23
+ operation: "decode",
24
+ message: "Stored Workflow dispatch identity disagrees with its intent"
25
+ });
26
+ return intent;
27
+ });
28
+ /**
29
+ * Durable dispatch outbox over an application-supplied SqlClient. This adapter uses
30
+ * SQLite/PostgreSQL SQL syntax and is certified with SQLite. It does not own an engine
31
+ * or a database connection. Agent admission, dispatch persistence, and native Workflow
32
+ * storage are separate commits; the registered repair trigger closes those gaps.
33
+ * Stored version or shape mismatches fail typed and require an explicit data reset.
34
+ */
35
+ var SqlWorkflowDispatchStore = class {
36
+ static layer = Layer.effect(WorkflowDispatchStore)(Effect.gen(function* () {
37
+ const sql = (yield* SqlClient.SqlClient).withoutTransforms();
38
+ yield* sql`
39
+ CREATE TABLE IF NOT EXISTS effect_agent_workflow_dispatch (
40
+ workflow_name TEXT NOT NULL,
41
+ execution_id TEXT NOT NULL,
42
+ deployment_id TEXT NOT NULL,
43
+ intent_json TEXT NOT NULL,
44
+ PRIMARY KEY (workflow_name, execution_id)
45
+ )
46
+ `;
47
+ yield* sql`
48
+ CREATE INDEX IF NOT EXISTS effect_agent_workflow_dispatch_scan
49
+ ON effect_agent_workflow_dispatch (deployment_id, workflow_name, execution_id)
50
+ `;
51
+ const put = Effect.fn("SqlWorkflowDispatchStore.put")(function* (input) {
52
+ const intent = yield* Schema.decodeUnknownEffect(WorkflowDispatchIntent)(input);
53
+ const encoded = yield* encodeIntent(intent);
54
+ yield* sql`
55
+ INSERT INTO effect_agent_workflow_dispatch
56
+ (workflow_name, execution_id, deployment_id, intent_json)
57
+ VALUES (${intent.workflowName}, ${intent.executionId}, ${intent.deploymentId}, ${encoded})
58
+ ON CONFLICT (workflow_name, execution_id) DO NOTHING
59
+ `;
60
+ const rows = yield* sql`
61
+ SELECT deployment_id, workflow_name, execution_id, intent_json
62
+ FROM effect_agent_workflow_dispatch
63
+ WHERE workflow_name = ${intent.workflowName} AND execution_id = ${intent.executionId}
64
+ `;
65
+ const existing = yield* decodeRow(rows[0]);
66
+ const merged = new WorkflowDispatchIntent({
67
+ ...intent,
68
+ ...existing.completionToken === void 0 ? {} : { completionToken: existing.completionToken }
69
+ });
70
+ if ((yield* encodeIntent(new WorkflowDispatchIntent({
71
+ ...existing,
72
+ ...merged.completionToken === void 0 ? {} : { completionToken: merged.completionToken }
73
+ }))) !== (yield* encodeIntent(merged)) || intent.completionToken !== void 0 && existing.completionToken !== void 0 && intent.completionToken !== existing.completionToken) return yield* new WorkflowDispatchError({
74
+ operation: "put",
75
+ message: "Workflow dispatch identity already belongs to a different immutable intent"
76
+ });
77
+ const retained = yield* encodeIntent(merged);
78
+ const previous = yield* encodeIntent(existing);
79
+ if (retained !== previous) {
80
+ if ((yield* sql`
81
+ UPDATE effect_agent_workflow_dispatch SET intent_json = ${retained}
82
+ WHERE workflow_name = ${intent.workflowName} AND execution_id = ${intent.executionId}
83
+ AND intent_json = ${previous}
84
+ RETURNING execution_id
85
+ `).length !== 1) return yield* new WorkflowDispatchError({
86
+ operation: "put",
87
+ message: "Dispatch intent changed while attaching its completion token"
88
+ });
89
+ }
90
+ return merged;
91
+ }, sql.withTransaction, Effect.mapError(dispatchError("put")));
92
+ const scan = Effect.fn("SqlWorkflowDispatchStore.scan")(function* (input) {
93
+ const request = yield* Schema.decodeUnknownEffect(WorkflowDispatchScan)(input);
94
+ const rows = yield* sql`
95
+ SELECT deployment_id, workflow_name, execution_id, intent_json
96
+ FROM effect_agent_workflow_dispatch
97
+ WHERE deployment_id = ${request.deploymentId}
98
+ AND workflow_name = ${request.workflowName}
99
+ AND execution_id > ${request.after ?? ""}
100
+ ORDER BY execution_id ASC
101
+ LIMIT ${request.limit}
102
+ `;
103
+ return yield* Effect.forEach(rows, decodeRow);
104
+ }, Effect.mapError(dispatchError("scan")));
105
+ const remove = Effect.fn("SqlWorkflowDispatchStore.remove")(function* (input) {
106
+ const intent = yield* Schema.decodeUnknownEffect(WorkflowDispatchIntent)(input);
107
+ const rows = yield* sql`
108
+ SELECT deployment_id, workflow_name, execution_id, intent_json
109
+ FROM effect_agent_workflow_dispatch
110
+ WHERE workflow_name = ${intent.workflowName} AND execution_id = ${intent.executionId}
111
+ `;
112
+ if (rows.length === 0) return;
113
+ const existing = yield* decodeRow(rows[0]);
114
+ if ((yield* encodeIntent(existing)) !== (yield* encodeIntent(intent))) return yield* new WorkflowDispatchError({
115
+ operation: "remove",
116
+ message: "Cannot remove a different immutable Workflow dispatch intent"
117
+ });
118
+ if ((yield* sql`
119
+ DELETE FROM effect_agent_workflow_dispatch
120
+ WHERE workflow_name = ${intent.workflowName} AND execution_id = ${intent.executionId}
121
+ AND intent_json = ${yield* encodeIntent(intent)}
122
+ RETURNING execution_id
123
+ `).length !== 1) return yield* new WorkflowDispatchError({
124
+ operation: "remove",
125
+ message: "Dispatch intent changed before cleanup"
126
+ });
127
+ }, sql.withTransaction, Effect.mapError(dispatchError("remove")));
128
+ return WorkflowDispatchStore.of({
129
+ put,
130
+ scan,
131
+ remove
132
+ });
133
+ }).pipe(Effect.mapError(dispatchError("initialize"))));
134
+ };
135
+ var NodeWorkflowRepairConfigError = class extends Schema.TaggedError()("NodeWorkflowRepairConfigError", { message: Schema.String }) {};
136
+ /** A host-scoped startup and polling trigger. No ordinary Node agent worker is started. */
137
+ var NodeWorkflowRepairTrigger = class {
138
+ static layer(options = {}) {
139
+ return Layer.effect(WorkflowRepairTrigger)(Effect.gen(function* () {
140
+ const interval = Duration.fromInput(options.interval ?? "1 second");
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
+ const delay = interval.value;
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)));
145
+ yield* attempt;
146
+ yield* Effect.gen(function* () {
147
+ while (true) {
148
+ yield* Effect.sleep(delay);
149
+ yield* attempt;
150
+ }
151
+ }).pipe(Effect.forkScoped);
152
+ }) });
153
+ }));
154
+ }
155
+ };
156
+ //#endregion
157
+ export { NodeWorkflowRepairConfigError, NodeWorkflowRepairTrigger, SqlWorkflowDispatchStore };
158
+
159
+ //# sourceMappingURL=NodeWorkflow.mjs.map
@@ -0,0 +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,O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AO,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"}
package/dist/index.d.mts CHANGED
@@ -1,283 +1,6 @@
1
- import { AbortCommand, AbortIntent, AgentRegistration, CanonicalRecordEnvelope, DurableAbortFailure, DurableAgentRuntime, DurableAwaitFailure, DurableBindingFailure, DurableExplainFailure, DurableObligationFailure, DurableObserveOptions, DurableRetryFailure, DurableRuntimeConfig, DurableRuntimeFailpointHandler, DurableSubmitAgent, DurableSubmitFailure, DurableSubmitOptions, DurableVerifyFailure, DurableWorkerFailure, EventSources, IntegrityReport, ObligationReport, ObligationThresholds, OperationDenied, PreparedInputAdmission, Receipt, RecoveryExplanation, RecoveryReport, ResolvedBinding, RetryCommand, ScheduleAuthorizer, ScheduleStore, ScheduleValidationError, ScheduleWake, ScheduledInputAdmission, Scheduling, SchedulingLimits, Settlement, SubmissionLedger, SubscriptionAuthorizer, SubscriptionError, SubscriptionInputBindings, SubscriptionIntake, SubscriptionLimits, SubscriptionStore, Subscriptions, ThreadNotMaterialized, ThreadStore, ThreadStoreError, ToolReconciler, WakeScheduler } from "@effect-agent/thread";
2
- import { Context, Crypto, Duration, Effect, Layer, Schema, Stream } from "effect";
3
- import { RunContextPreparation, RunCostEstimator, RunToolAuthorization, RunToolFailureObserver } from "@effect-agent/engine";
4
- import { SqliteStorageFailpointHandler, SqliteStorageInitializationError } from "@effect-agent/storage-sqlite";
5
- import { SubmissionId, ThreadId } from "@effect-agent/core";
6
- //#region src/layers.d.ts
7
- declare const NodePlatformConfigError_base: Schema.Class<NodePlatformConfigError, Schema.TaggedStruct<"NodePlatformConfigError", {
8
- readonly message: Schema.String;
9
- readonly cause: Schema.optionalKey<Schema.Defect>;
10
- }>, import("effect/Cause").YieldableError>;
11
- /** The supplied Node durable runtime configuration failed schema validation (DEPLOY-003). */
12
- declare class NodePlatformConfigError extends NodePlatformConfigError_base {}
13
- declare const NodeDurableRuntimeConfigValue_base: Schema.Class<NodeDurableRuntimeConfigValue, Schema.Struct<{
14
- /** SQLite database file backing BOTH the Thread Log and the Submission Ledger. */
15
- readonly filename: Schema.NonEmptyString;
16
- readonly deploymentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/DeploymentId">;
17
- readonly producerId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/ProducerId">;
18
- /** Submission ownership lease duration (D5); liveness hint only, epochs stay authoritative. */
19
- readonly ownershipLeaseDuration: Schema.Int;
20
- /** Finite bound on concurrent worker loops per host (rule 10). */
21
- readonly workerConcurrency: Schema.Int;
22
- /** Ledger-scan fallback cadence of the Node wake scheduler (deployment §3). */
23
- readonly wakeScanInterval: Schema.Int;
24
- /** `awaitSettlement` ledger re-check cadence when no wake arrives. */
25
- readonly settlementPollInterval: Schema.Int;
26
- /** Worker ownership-lease renewal cadence. */
27
- readonly leaseRenewalInterval: Schema.Int;
28
- /** Active-Run abort-intent poll cadence. */
29
- readonly abortPollInterval: Schema.Int;
30
- /** Bounded SQLITE_BUSY retry window for write-lock acquisition. */
31
- readonly busyTimeout: Schema.Int;
32
- /** Canonical observation poll cadence of the SQLite store. */
33
- readonly observationPollInterval: Schema.Int;
34
- /** Opt-in full payload/digest-chain audit while opening the store. */
35
- readonly verifyOnOpen: Schema.Boolean;
36
- }>, {}>;
37
- /**
38
- * Validated Node durable runtime configuration (deployment §4: decoded once during Layer
39
- * construction, exposed as a typed service). Every cadence is in milliseconds and every bound is
40
- * finite; `workerConcurrency` caps how many worker loops `NodeDurableHost.runWorkers` drives.
41
- */
42
- declare class NodeDurableRuntimeConfigValue extends NodeDurableRuntimeConfigValue_base {}
43
- declare const NodeDurableRuntimeConfig_base: Context.ServiceClass<NodeDurableRuntimeConfig, "@effect-agent/platform-node/NodeDurableRuntimeConfig", NodeDurableRuntimeConfigValue>;
44
- /** Explicit configuration authority for the assembled Node durable runtime. */
45
- declare class NodeDurableRuntimeConfig extends NodeDurableRuntimeConfig_base {}
46
- /**
47
- * Raw (unvalidated) construction options for `NodeDurableRuntime.layer`. Optional fields default
48
- * to the documented production values; everything is schema-decoded into
49
- * `NodeDurableRuntimeConfigValue` before any resource opens (deployment §5 gate 1).
50
- */
51
- interface NodeDurableRuntimeOptions<ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never> {
52
- readonly filename: string;
53
- readonly deploymentId: string;
54
- readonly producerId: string;
55
- /** Milliseconds; default `DEFAULT_OWNERSHIP_LEASE_DURATION` (30s, D5). */
56
- readonly ownershipLeaseDuration?: number | undefined;
57
- /** Default 1; bounded to 1..64. */
58
- readonly workerConcurrency?: number | undefined;
59
- /** Milliseconds; default 1000. */
60
- readonly wakeScanInterval?: number | undefined;
61
- /** Milliseconds; default 500. */
62
- readonly settlementPollInterval?: number | undefined;
63
- /** Milliseconds; default 10000. */
64
- readonly leaseRenewalInterval?: number | undefined;
65
- /** Milliseconds; default 500. */
66
- readonly abortPollInterval?: number | undefined;
67
- /** Deployment-owned pricing authority used by durable cost budgets and settlements. */
68
- readonly estimateCostMicrousd?: RunCostEstimator | undefined;
69
- /** Closed trusted Tool failure reporting. Omission masks ambient observers at construction. */
70
- readonly toolFailureObserver?: RunToolFailureObserver | undefined;
71
- /** Milliseconds; default 5000. */
72
- readonly busyTimeout?: number | undefined;
73
- /** Milliseconds; default 25. */
74
- readonly observationPollInterval?: number | undefined;
75
- /** Default false. */
76
- readonly verifyOnOpen?: boolean | undefined;
77
- /** SQLite adapter fault injection (`ledger:*` / `append:*` locations); default none. */
78
- readonly storageFailpoint?: SqliteStorageFailpointHandler | undefined;
79
- /** Coordinator fault injection (`submit:*` / `terminalize:*` locations); default none. */
80
- readonly runtimeFailpoint?: DurableRuntimeFailpointHandler | undefined;
81
- /**
82
- * Reconciliation policy consulted for open ordinary Tool Calls before an Unknown Outcome is
83
- * recorded (durability §10, DUR-009). Defaults to the fail-closed `ToolReconciler.uncertain`:
84
- * with no registered policy, every open call stays Unknown and routes to the authorized
85
- * DUR-017 resolution path.
86
- */
87
- readonly toolReconciler?: Layer.Layer<ToolReconciler> | undefined;
88
- /** Host prompt preparation/compaction, acquired once with the runtime; default pass-through. */
89
- readonly runContext?: Layer.Layer<RunContextPreparation, ContextError, ContextRequirements | Crypto.Crypto> | undefined;
90
- /**
91
- * Independent action-time Tool authority, acquired once with the runtime; default allow-all.
92
- * Construction errors and application dependencies remain in the assembled Layer's E and R.
93
- * The platform supplies Crypto to both extension Layers.
94
- */
95
- readonly toolAuthorization?: Layer.Layer<RunToolAuthorization, AuthorizationError, AuthorizationRequirements | Crypto.Crypto> | undefined;
96
- }
97
- /** Built-in construction failures. `layer` also preserves supplied service Layers' errors. */
98
- type NodeDurableRuntimeInitializationError = NodePlatformConfigError | SqliteStorageInitializationError;
99
- /** The services `NodeDurableRuntime.layer` provides. */
100
- type NodeDurableRuntimeServices = DurableAgentRuntime | SubmissionLedger | ThreadStore | ScheduleStore | WakeScheduler | DurableRuntimeConfig | NodeDurableRuntimeConfig;
101
- /**
102
- * Shutdown-drain decorator for a `SubmissionLedger` (deployment §6 step 6): every ownership
103
- * period granted through this Layer is tracked — claims start tracking, renewals follow token
104
- * rotation, releases and settlement finalizations stop it — and every ownership still held when
105
- * the Layer's Scope closes is released so another host can claim the lane immediately instead of
106
- * waiting for lease expiry. The drain is a liveness courtesy only; producer-epoch fencing remains
107
- * the correctness authority (DUR-006), and a forced kill simply falls back to lease expiry.
108
- */
109
- declare const ownershipDrainLayer: Layer.Layer<SubmissionLedger, never, SubmissionLedger>;
110
- /**
111
- * The DN Layer assembly (deployment §12: a Layer-assembly library, not an app entrypoint).
112
- * `layer(options)` decodes the configuration, opens ONE SQLite database serving both the
113
- * Thread Log and the Submission Ledger (so claims fence the same producer epochs), wires
114
- * the Node wake scheduler with its ledger-scan fallback, wraps the ledger with the shutdown
115
- * ownership drain, defaults the Tool reconciliation policy to the fail-closed
116
- * `ToolReconciler.uncertain` (override via `options.toolReconciler`), and provides a ready
117
- * `DurableAgentRuntime` on top. Storage compatibility is
118
- * verified during construction: an incompatible database file fails the Layer with
119
- * `SqliteStorageCompatibilityError` before anything is mutated (DEPLOY-008).
120
- */
121
- declare class NodeDurableRuntime {
122
- /** Validated configuration Layer; fails typed when the supplied options are out of bounds. */
123
- static configLayer<ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never>(options: NodeDurableRuntimeOptions<ContextError, ContextRequirements, AuthorizationError, AuthorizationRequirements>): Layer.Layer<NodeDurableRuntimeConfig, NodePlatformConfigError>;
124
- /** The full DN runtime stack over one SQLite file. */
125
- static layer<ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never>(options: NodeDurableRuntimeOptions<ContextError, ContextRequirements, AuthorizationError, AuthorizationRequirements>): Layer.Layer<NodeDurableRuntimeServices, NodeDurableRuntimeInitializationError | ContextError | AuthorizationError, Exclude<ContextRequirements | AuthorizationRequirements, Crypto.Crypto>>;
126
- }
127
- //#endregion
128
- //#region src/host.d.ts
129
- declare const AdmissionClosed_base: Schema.Class<AdmissionClosed, Schema.TaggedStruct<"AdmissionClosed", {
130
- readonly message: Schema.String;
131
- }>, import("effect/Cause").YieldableError>;
132
- /**
133
- * Admission is not open on this host: it is shutting down (deployment §6 step 1, DEPLOY-005).
134
- * Accepted work is unaffected — only NEW admissions are refused.
135
- */
136
- declare class AdmissionClosed extends AdmissionClosed_base {}
137
- declare const NodeDurableHost_base: Context.ServiceClass<NodeDurableHost, "@effect-agent/platform-node/NodeDurableHost", {
138
- /**
139
- * The recovery decisions executed (or deferred) by this host's startup reconciliation.
140
- * Reports with the `unknown` disposition identify lanes blocked on Unknown Outcomes that
141
- * only the authorized DUR-017 resolution path can release.
142
- */
143
- readonly startupRecovery: ReadonlyArray<RecoveryReport>;
144
- /** Admission-role readiness (deployment §7): true until shutdown begins. */
145
- readonly admissionOpen: Effect.Effect<boolean>;
146
- /** `DurableAgentRuntime.submit` behind the host admission gate. */
147
- readonly submit: <InputSchema extends Schema.Top>(agent: DurableSubmitAgent<InputSchema>, input: InputSchema["Type"], options: DurableSubmitOptions) => Effect.Effect<Receipt, AdmissionClosed | DurableSubmitFailure, InputSchema["EncodingServices"]>;
148
- readonly awaitSettlement: (receipt: Receipt) => Effect.Effect<Settlement, DurableAwaitFailure>;
149
- readonly observe: (receipt: Receipt, options?: DurableObserveOptions) => Stream.Stream<CanonicalRecordEnvelope, ThreadStoreError | ThreadNotMaterialized | OperationDenied>;
150
- readonly abort: (command: AbortCommand) => Effect.Effect<AbortIntent, DurableAbortFailure>;
151
- /** `DurableAgentRuntime.explain` — read-only recovery explanation of one Submission (P7). */
152
- readonly explain: (submissionId: SubmissionId) => Effect.Effect<RecoveryExplanation, DurableExplainFailure>;
153
- /** `DurableAgentRuntime.explainThread` — explain every nonterminal lane member. */
154
- readonly explainThread: (threadId: ThreadId) => Effect.Effect<ReadonlyArray<RecoveryExplanation>, DurableExplainFailure>;
155
- /** `DurableAgentRuntime.verify` — read-only integrity checks, never a repair (P7). */
156
- readonly verify: (threadId: ThreadId) => Effect.Effect<IntegrityReport, DurableVerifyFailure>;
157
- /** `DurableAgentRuntime.retry` — audited single-Submission re-drive with typed refusals. */
158
- readonly retry: (command: RetryCommand) => Effect.Effect<RecoveryReport, DurableRetryFailure>;
159
- /** `DurableAgentRuntime.wake` — the documented operator liveness nudge for one lane. */
160
- readonly wake: (threadId: ThreadId) => Effect.Effect<void, OperationDenied>;
161
- /** `DurableAgentRuntime.scanObligations` — the scan-based DUR-017/OPS-001 report. */
162
- readonly scanObligations: (thresholds: ObligationThresholds) => Effect.Effect<ObligationReport, DurableObligationFailure>;
163
- /**
164
- * Run `workerConcurrency` copies of the given worker effect (typically
165
- * `DurableAgentRuntime.runWorker(agent)`) until the caller's Scope interrupts them. The
166
- * bound is the validated finite configuration value; the host never forks daemon fibers.
167
- */
168
- readonly runWorkers: <A, E, R>(worker: Effect.Effect<A, E, R>) => Effect.Effect<void, E, R>;
169
- /**
170
- * Run `workerConcurrency` copies of `DurableAgentRuntime.runResolvedWorker` over the host's
171
- * registered Bindings (S2): every claimed head resolves its exact stored Binding before any
172
- * code runs (SUB-023), so one bounded pool serves parent and attached-child lanes.
173
- */
174
- readonly runResolvedWorkers: Effect.Effect<void, DurableWorkerFailure | DurableBindingFailure>;
175
- }>;
176
- /**
177
- * Operational host lifecycle for the DN runtime (deployment §2/§5/§6).
178
- *
179
- * Startup gates run during Layer construction, so the service existing implies readiness:
180
- * configuration was schema-decoded, the SQLite file passed the exact-version compatibility check,
181
- * and every nonterminal Submission went through one full recovery pass BEFORE admission opened.
182
- * `startupRecovery` is the auditable evidence of that reconciliation pass.
183
- *
184
- * Shutdown runs in reverse Layer order when the owning Scope closes: `submit` starts refusing
185
- * with `AdmissionClosed` first, then the runtime Layer's ownership drain releases every claim
186
- * still held so another host can take over the lanes immediately, then the SQLite resources
187
- * close. Forced termination at any point stays safe — the durability protocol, not graceful
188
- * shutdown, provides correctness (DEPLOY-006).
189
- */
190
- declare class NodeDurableHost extends NodeDurableHost_base {
191
- /**
192
- * Compile typed registrations and acquire the complete host in one Layer Scope.
193
- * Node supplies Crypto; model, tool, instruction, and schema services remain required.
194
- * Startup recovery and shutdown gates are unchanged. Workers start only when the caller
195
- * runs runResolvedWorkers; this constructor never starts a background worker.
196
- */
197
- static layerRegistered<const Entries extends ReadonlyArray<AgentRegistration>, ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never>(registrations: Entries, options: NodeDurableRuntimeOptions<ContextError, ContextRequirements, AuthorizationError, AuthorizationRequirements>): Layer.Layer<NodeDurableHost | NodeDurableRuntimeServices, AuthorizationError | ContextError | DurableWorkerFailure | NodeDurableRuntimeInitializationError, Exclude<Exclude<AuthorizationRequirements, Crypto.Crypto>, Crypto.Crypto> | Exclude<Exclude<ContextRequirements, Crypto.Crypto>, Crypto.Crypto> | Exclude<Exclude<[Entries[number]] extends [never] ? never : Entries[number] extends (infer T_2) ? T_2 extends Entries[number] ? T_2 extends {
198
- readonly attemptLayer: (context: import("@effect-agent/thread").AgentAttemptContext) => Layer.Layer<infer Provides, never, infer Requires>;
199
- } ? Requires | Exclude<T_2 extends (infer T_3) ? T_3 extends T_2 ? T_3 extends {
200
- readonly agent: infer A extends import("@effect-agent/thread").ExecutableAgentBinding;
201
- } ? import("@effect-agent/thread").DurableWorkerRequirements<A> : T_3 extends {
202
- readonly agent: infer D extends import("@effect-agent/core").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown> & {
203
- readonly instructions: import("@effect-agent/core").InstructionSource<never, unknown, unknown>;
204
- readonly inputPrompt?: import("@effect-agent/core").InputPromptSource<never, unknown, unknown> | undefined;
205
- };
206
- readonly model: infer M extends import("@effect-agent/thread").ExecutableAgentBinding["model"];
207
- } ? import("@effect-agent/thread").DurableWorkerRequirements<{
208
- readonly definition: D;
209
- readonly model: M;
210
- }> : never : never : never, Provides> : T_2 extends {
211
- readonly agent: infer A extends import("@effect-agent/thread").ExecutableAgentBinding;
212
- } ? import("@effect-agent/thread").DurableWorkerRequirements<A> : T_2 extends {
213
- readonly agent: infer D extends import("@effect-agent/core").Definition<Schema.Top, Schema.Top, unknown, import("effect/unstable/ai/Toolkit").Any, import("@effect-agent/core").RunDispositionDeclaration<never, Schema.Top> | undefined, unknown> & {
214
- readonly instructions: import("@effect-agent/core").InstructionSource<never, unknown, unknown>;
215
- readonly inputPrompt?: import("@effect-agent/core").InputPromptSource<never, unknown, unknown> | undefined;
216
- };
217
- readonly model: infer M extends import("@effect-agent/thread").ExecutableAgentBinding["model"];
218
- } ? import("@effect-agent/thread").DurableWorkerRequirements<{
219
- readonly definition: D;
220
- readonly model: M;
221
- }> : never : never : never, import("effect/Scope").Scope>, Crypto.Crypto>>;
222
- /**
223
- * Host gates over an assembled `NodeDurableRuntime` stack. Bindings must carry the exact
224
- * digests stored by submitters. Omission registers no Agents, so resolved work fails closed.
225
- */
226
- static readonly layer: (bindings?: ReadonlyArray<ResolvedBinding>) => Layer.Layer<NodeDurableHost, DurableWorkerFailure, DurableAgentRuntime | NodeDurableRuntimeConfig>;
227
- /** The complete DN host: `NodeDurableRuntime.layer(options)` plus the host lifecycle gates. */
228
- static layerStack<ContextError = never, ContextRequirements = never, AuthorizationError = never, AuthorizationRequirements = never>(options: NodeDurableRuntimeOptions<ContextError, ContextRequirements, AuthorizationError, AuthorizationRequirements> & {
229
- readonly bindings?: ReadonlyArray<ResolvedBinding>;
230
- }): Layer.Layer<NodeDurableHost | NodeDurableRuntimeServices, DurableWorkerFailure | NodeDurableRuntimeInitializationError | ContextError | AuthorizationError, Exclude<ContextRequirements | AuthorizationRequirements, Crypto.Crypto>>;
231
- }
232
- //#endregion
233
- //#region src/scheduling.d.ts
234
- /** One bounded hint slot for the single supported Node scheduler. Indexed polling repairs loss. */
235
- declare const nodeScheduleWakeLayer: Layer.Layer<ScheduleWake>;
236
- interface NodeSchedulingOptions {
237
- readonly limits?: SchedulingLimits | undefined;
238
- }
239
- /**
240
- * Optional Scope-owned Node scheduling service and driver. The caller must provide the existing
241
- * host, its SQLite ScheduleStore, and an explicit ScheduleAuthorizer.
242
- */
243
- declare class NodeScheduling {
244
- static layer(options?: NodeSchedulingOptions): Layer.Layer<Scheduling, ScheduleValidationError, NodeDurableHost | ScheduleStore | ScheduleAuthorizer>;
245
- }
246
- //#endregion
247
- //#region src/subscriptions.d.ts
248
- /** Ordinary prepared admission through the Scope-owned Node host gate. */
249
- declare const nodePreparedInputAdmissionLayer: Layer.Layer<PreparedInputAdmission, never, NodeDurableHost>;
250
- declare const nodeScheduledInputAdmissionLayer: Layer.Layer<ScheduledInputAdmission, never, NodeDurableHost>;
251
- interface NodeSubscriptionsOptions {
252
- readonly limits?: SubscriptionLimits | undefined;
253
- }
254
- /**
255
- * One Scope-owned subscription partition in the sole process owning its SQLite database.
256
- * Indexed polling repairs restart and lost wake state; closing the Scope interrupts the driver.
257
- */
258
- declare class NodeSubscriptions {
259
- static layer(options?: NodeSubscriptionsOptions): Layer.Layer<Subscriptions | SubscriptionIntake, SubscriptionError, NodeDurableHost | SubscriptionStore | SubscriptionAuthorizer | EventSources | SubscriptionInputBindings>;
260
- }
261
- //#endregion
262
- //#region src/wake-scheduler.d.ts
263
- declare const NodeWakeSchedulerConfig_base: Context.ServiceClass<NodeWakeSchedulerConfig, "@effect-agent/platform-node/NodeWakeSchedulerConfig", {
264
- /** Interval between ledger scans that re-emit every nonterminal Thread lane. */
265
- readonly scanInterval: Duration.Duration;
266
- }>;
267
- /** Cadence authority for the Node wake scheduler's ledger-scan fallback loop. */
268
- declare class NodeWakeSchedulerConfig extends NodeWakeSchedulerConfig_base {
269
- static layer(options: {
270
- readonly scanInterval: Duration.Duration;
271
- }): Layer.Layer<NodeWakeSchedulerConfig>;
272
- }
273
- /**
274
- * In-process Node `WakeScheduler`: `notify` publishes to a bounded sliding PubSub for prompt
275
- * same-process wakeups, and every `wakes` subscription additionally runs a periodic
276
- * `SubmissionLedger.scanNonterminal` fallback so a dropped, coalesced, or never-sent notification
277
- * can never strand accepted work (persistence §14). Delivery may duplicate; consumers already
278
- * treat wakes as pure liveness hints.
279
- */
280
- declare const nodeWakeSchedulerLayer: Layer.Layer<WakeScheduler, never, SubmissionLedger | NodeWakeSchedulerConfig>;
281
- //#endregion
282
- export { AdmissionClosed, NodeDurableHost, NodeDurableRuntime, NodeDurableRuntimeConfig, NodeDurableRuntimeConfigValue, NodeDurableRuntimeInitializationError, NodeDurableRuntimeOptions, NodeDurableRuntimeServices, NodePlatformConfigError, NodeScheduling, NodeSchedulingOptions, NodeSubscriptions, NodeSubscriptionsOptions, NodeWakeSchedulerConfig, nodePreparedInputAdmissionLayer, nodeScheduleWakeLayer, nodeScheduledInputAdmissionLayer, nodeWakeSchedulerLayer, ownershipDrainLayer };
283
- //# sourceMappingURL=index.d.mts.map
1
+ import { n as NodeWakeScheduler_d_exports } from "./NodeWakeScheduler-DWdHIhWA.mjs";
2
+ import { s as NodeDurableAgentRuntime_d_exports } from "./NodeDurableAgentRuntime-Ceye0Exk.mjs";
3
+ import { t as NodeDurableHost_d_exports } from "./NodeDurableHost.mjs";
4
+ import { t as NodeScheduling_d_exports } from "./NodeScheduling.mjs";
5
+ import { t as NodeSubscriptions_d_exports } from "./NodeSubscriptions.mjs";
6
+ export { NodeDurableAgentRuntime_d_exports as NodeDurableAgentRuntime, NodeDurableHost_d_exports as NodeDurableHost, NodeScheduling_d_exports as NodeScheduling, NodeSubscriptions_d_exports as NodeSubscriptions, NodeWakeScheduler_d_exports as NodeWakeScheduler };