@decaf-ts/as-graph 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +167 -5
- package/dist/as-graph.cjs +1 -1
- package/dist/as-graph.cjs.map +1 -1
- package/dist/as-graph.js +1 -1
- package/dist/as-graph.js.map +1 -1
- package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs +102 -11
- package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs.map +1 -1
- package/lib/cjs/dagster/DagsterGraphQLClient.cjs +738 -0
- package/lib/cjs/dagster/DagsterGraphQLClient.cjs.map +1 -0
- package/lib/cjs/dagster/index.cjs +1 -0
- package/lib/cjs/dagster/index.cjs.map +1 -1
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs +7 -0
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs.map +1 -1
- package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs +39 -0
- package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs.map +1 -1
- package/lib/cjs/engine/index.cjs +1 -0
- package/lib/cjs/engine/index.cjs.map +1 -1
- package/lib/cjs/engine/services/GraphNodeModelService.cjs +129 -0
- package/lib/cjs/engine/services/GraphNodeModelService.cjs.map +1 -0
- package/lib/cjs/engine/services/GraphWorkflowService.cjs +33 -0
- package/lib/cjs/engine/services/GraphWorkflowService.cjs.map +1 -1
- package/lib/cjs/mastra/MastraDefaultStepHandlers.cjs +217 -0
- package/lib/cjs/mastra/MastraDefaultStepHandlers.cjs.map +1 -0
- package/lib/cjs/mastra/MastraEventBridge.cjs +10 -3
- package/lib/cjs/mastra/MastraEventBridge.cjs.map +1 -1
- package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs +111 -13
- package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs.map +1 -1
- package/lib/cjs/mastra/MastraWorkflowCompiler.cjs +3 -3
- package/lib/cjs/mastra/MastraWorkflowCompiler.cjs.map +1 -1
- package/lib/cjs/mastra/index.cjs +1 -0
- package/lib/cjs/mastra/index.cjs.map +1 -1
- package/lib/cjs/mastra/types.cjs +5 -1
- package/lib/cjs/mastra/types.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphBackendHost.cjs +232 -0
- package/lib/cjs/nest/graph/GraphBackendHost.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs +38 -1
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs.map +1 -1
- package/lib/cjs/nest/graph/index.cjs +1 -0
- package/lib/cjs/nest/graph/index.cjs.map +1 -1
- package/lib/cjs/nest/graph/main.cjs +112 -12
- package/lib/cjs/nest/graph/main.cjs.map +1 -1
- package/lib/cjs/ram/GraphNodeRepository.cjs +40 -0
- package/lib/cjs/ram/GraphNodeRepository.cjs.map +1 -0
- package/lib/cjs/ram/index.cjs +1 -0
- package/lib/cjs/ram/index.cjs.map +1 -1
- package/lib/cjs/shared/graph/GraphNodeConverters.cjs +43 -0
- package/lib/cjs/shared/graph/GraphNodeConverters.cjs.map +1 -0
- package/lib/cjs/shared/graph/GraphNodeModel.cjs +74 -0
- package/lib/cjs/shared/graph/GraphNodeModel.cjs.map +1 -0
- package/lib/cjs/shared/graph/index.cjs +2 -0
- package/lib/cjs/shared/graph/index.cjs.map +1 -1
- package/lib/esm/dagster/DagsterGraphExecutionBackend.js +102 -11
- package/lib/esm/dagster/DagsterGraphExecutionBackend.js.map +1 -1
- package/lib/esm/dagster/DagsterGraphQLClient.js +733 -0
- package/lib/esm/dagster/DagsterGraphQLClient.js.map +1 -0
- package/lib/esm/dagster/index.js +1 -0
- package/lib/esm/dagster/index.js.map +1 -1
- package/lib/esm/engine/execution/GraphExecutionBackend.js.map +1 -1
- package/lib/esm/engine/execution/GraphExecutionEngine.js +7 -0
- package/lib/esm/engine/execution/GraphExecutionEngine.js.map +1 -1
- package/lib/esm/engine/execution/LocalGraphExecutionBackend.js +39 -0
- package/lib/esm/engine/execution/LocalGraphExecutionBackend.js.map +1 -1
- package/lib/esm/engine/index.js +1 -0
- package/lib/esm/engine/index.js.map +1 -1
- package/lib/esm/engine/services/GraphNodeModelService.js +120 -0
- package/lib/esm/engine/services/GraphNodeModelService.js.map +1 -0
- package/lib/esm/engine/services/GraphWorkflowService.js +34 -1
- package/lib/esm/engine/services/GraphWorkflowService.js.map +1 -1
- package/lib/esm/mastra/MastraCapabilities.js.map +1 -1
- package/lib/esm/mastra/MastraDefaultStepHandlers.js +212 -0
- package/lib/esm/mastra/MastraDefaultStepHandlers.js.map +1 -0
- package/lib/esm/mastra/MastraEventBridge.js +10 -3
- package/lib/esm/mastra/MastraEventBridge.js.map +1 -1
- package/lib/esm/mastra/MastraGraphExecutionBackend.js +112 -14
- package/lib/esm/mastra/MastraGraphExecutionBackend.js.map +1 -1
- package/lib/esm/mastra/MastraWorkflowCompiler.js +3 -3
- package/lib/esm/mastra/MastraWorkflowCompiler.js.map +1 -1
- package/lib/esm/mastra/index.js +1 -0
- package/lib/esm/mastra/index.js.map +1 -1
- package/lib/esm/mastra/types.js +4 -0
- package/lib/esm/mastra/types.js.map +1 -1
- package/lib/esm/nest/graph/GraphBackendHost.js +189 -0
- package/lib/esm/nest/graph/GraphBackendHost.js.map +1 -0
- package/lib/esm/nest/graph/GraphExecutionModule.js +39 -2
- package/lib/esm/nest/graph/GraphExecutionModule.js.map +1 -1
- package/lib/esm/nest/graph/index.js +1 -0
- package/lib/esm/nest/graph/index.js.map +1 -1
- package/lib/esm/nest/graph/main.js +79 -12
- package/lib/esm/nest/graph/main.js.map +1 -1
- package/lib/esm/ram/GraphNodeRepository.js +31 -0
- package/lib/esm/ram/GraphNodeRepository.js.map +1 -0
- package/lib/esm/ram/index.js +1 -0
- package/lib/esm/ram/index.js.map +1 -1
- package/lib/esm/shared/graph/GraphNodeConverters.js +38 -0
- package/lib/esm/shared/graph/GraphNodeConverters.js.map +1 -0
- package/lib/esm/shared/graph/GraphNodeModel.js +65 -0
- package/lib/esm/shared/graph/GraphNodeModel.js.map +1 -0
- package/lib/esm/shared/graph/index.js +2 -0
- package/lib/esm/shared/graph/index.js.map +1 -1
- package/lib/types/dagster/DagsterGraphExecutionBackend.d.cts +40 -4
- package/lib/types/dagster/DagsterGraphExecutionBackend.d.mts +40 -4
- package/lib/types/dagster/DagsterGraphQLClient.d.cts +231 -0
- package/lib/types/dagster/DagsterGraphQLClient.d.mts +231 -0
- package/lib/types/dagster/index.d.cts +1 -0
- package/lib/types/dagster/index.d.mts +1 -0
- package/lib/types/engine/execution/GraphExecutionBackend.d.cts +27 -0
- package/lib/types/engine/execution/GraphExecutionBackend.d.mts +27 -0
- package/lib/types/engine/execution/GraphExecutionEngine.d.cts +9 -0
- package/lib/types/engine/execution/GraphExecutionEngine.d.mts +9 -0
- package/lib/types/engine/execution/LocalGraphExecutionBackend.d.cts +14 -0
- package/lib/types/engine/execution/LocalGraphExecutionBackend.d.mts +14 -0
- package/lib/types/engine/index.d.cts +1 -0
- package/lib/types/engine/index.d.mts +1 -0
- package/lib/types/engine/services/GraphNodeModelService.d.cts +54 -0
- package/lib/types/engine/services/GraphNodeModelService.d.mts +54 -0
- package/lib/types/engine/services/GraphWorkflowService.d.cts +21 -0
- package/lib/types/engine/services/GraphWorkflowService.d.mts +21 -0
- package/lib/types/mastra/MastraCapabilities.d.cts +0 -5
- package/lib/types/mastra/MastraCapabilities.d.mts +0 -5
- package/lib/types/mastra/MastraDefaultStepHandlers.d.cts +74 -0
- package/lib/types/mastra/MastraDefaultStepHandlers.d.mts +74 -0
- package/lib/types/mastra/MastraGraphExecutionBackend.d.cts +29 -0
- package/lib/types/mastra/MastraGraphExecutionBackend.d.mts +29 -0
- package/lib/types/mastra/MastraWorkflowCompiler.d.cts +3 -3
- package/lib/types/mastra/MastraWorkflowCompiler.d.mts +3 -3
- package/lib/types/mastra/index.d.cts +1 -0
- package/lib/types/mastra/index.d.mts +1 -0
- package/lib/types/mastra/types.d.cts +12 -0
- package/lib/types/mastra/types.d.mts +12 -0
- package/lib/types/nest/graph/GraphBackendHost.d.cts +152 -0
- package/lib/types/nest/graph/GraphBackendHost.d.mts +152 -0
- package/lib/types/nest/graph/GraphExecutionModule.d.cts +23 -0
- package/lib/types/nest/graph/GraphExecutionModule.d.mts +23 -0
- package/lib/types/nest/graph/index.d.cts +1 -0
- package/lib/types/nest/graph/index.d.mts +1 -0
- package/lib/types/ram/GraphNodeRepository.d.cts +13 -0
- package/lib/types/ram/GraphNodeRepository.d.mts +13 -0
- package/lib/types/ram/index.d.cts +1 -0
- package/lib/types/ram/index.d.mts +1 -0
- package/lib/types/shared/graph/GraphNodeConverters.d.cts +15 -0
- package/lib/types/shared/graph/GraphNodeConverters.d.mts +15 -0
- package/lib/types/shared/graph/GraphNodeModel.d.cts +24 -0
- package/lib/types/shared/graph/GraphNodeModel.d.mts +24 -0
- package/lib/types/shared/graph/index.d.cts +2 -0
- package/lib/types/shared/graph/index.d.mts +2 -0
- package/package.json +15 -3
|
@@ -83,6 +83,22 @@ export interface GraphBackendWorkflowStore {
|
|
|
83
83
|
listWorkflows(...args: MaybeContextualArg<Context>): Promise<GraphBackendWorkflowRecord[]>;
|
|
84
84
|
/** Reads a single canonical workflow document. */
|
|
85
85
|
getDocument(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowDocument>;
|
|
86
|
+
/**
|
|
87
|
+
* Persists a canonical workflow document (the seed surface). Optional: a
|
|
88
|
+
* read-only store omits it, and the backend's `seedWorkflows` then fails
|
|
89
|
+
* closed instead of silently dropping the seeds. `GraphWorkflowService`
|
|
90
|
+
* structurally satisfies it.
|
|
91
|
+
*/
|
|
92
|
+
saveDocument?(workflowId: string, document: GraphWorkflowDocument, ...args: MaybeContextualArg<Context>): Promise<unknown>;
|
|
93
|
+
/**
|
|
94
|
+
* Boot-seed surface: persists a canonical workflow document, treating an
|
|
95
|
+
* existing foreign-owned row as a skip rather than a hard failure (F2
|
|
96
|
+
* availability fix). Optional; when present the local backend prefers it over
|
|
97
|
+
* {@link saveDocument} for its host-boot seed so a fixture id a durable store
|
|
98
|
+
* already holds as a user-owned row cannot fail host bootstrap. Request-path
|
|
99
|
+
* writes never use it — they stay fail-closed through `saveDocument`.
|
|
100
|
+
*/
|
|
101
|
+
seedDocument?(workflowId: string, document: GraphWorkflowDocument, ...args: MaybeContextualArg<Context>): Promise<unknown>;
|
|
86
102
|
}
|
|
87
103
|
/**
|
|
88
104
|
* Facade-owned event sink handed to a backend. The facade owns event
|
|
@@ -204,6 +220,17 @@ export interface GraphExecutionBackend<CONFIG extends Record<string, unknown> =
|
|
|
204
220
|
* without a catalogue omit this method (or declare `not_supported`).
|
|
205
221
|
*/
|
|
206
222
|
getWorkflow?(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowDocument>;
|
|
223
|
+
/**
|
|
224
|
+
* Seeds canonical workflow documents into this backend's own catalogue so
|
|
225
|
+
* they are served by {@link listWorkflows}/{@link getWorkflow}. The host
|
|
226
|
+
* supplies its fixture registry at boot and the backend registers the
|
|
227
|
+
* documents through its own engine-dependent store (persistence for the local
|
|
228
|
+
* backend, translated catalogue for Mastra, the read-only catalogue for
|
|
229
|
+
* Dagster). Returns the seeded summaries. A backend without a writable
|
|
230
|
+
* catalogue omits this method; the facade fails closed rather than silently
|
|
231
|
+
* dropping the seeds.
|
|
232
|
+
*/
|
|
233
|
+
seedWorkflows?(documents: readonly GraphWorkflowDocument[], ...args: MaybeContextualArg<Context>): Promise<GraphBackendWorkflowSummary[]>;
|
|
207
234
|
/**
|
|
208
235
|
* Executes a validated/resolved workflow.
|
|
209
236
|
*
|
|
@@ -83,6 +83,22 @@ export interface GraphBackendWorkflowStore {
|
|
|
83
83
|
listWorkflows(...args: MaybeContextualArg<Context>): Promise<GraphBackendWorkflowRecord[]>;
|
|
84
84
|
/** Reads a single canonical workflow document. */
|
|
85
85
|
getDocument(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowDocument>;
|
|
86
|
+
/**
|
|
87
|
+
* Persists a canonical workflow document (the seed surface). Optional: a
|
|
88
|
+
* read-only store omits it, and the backend's `seedWorkflows` then fails
|
|
89
|
+
* closed instead of silently dropping the seeds. `GraphWorkflowService`
|
|
90
|
+
* structurally satisfies it.
|
|
91
|
+
*/
|
|
92
|
+
saveDocument?(workflowId: string, document: GraphWorkflowDocument, ...args: MaybeContextualArg<Context>): Promise<unknown>;
|
|
93
|
+
/**
|
|
94
|
+
* Boot-seed surface: persists a canonical workflow document, treating an
|
|
95
|
+
* existing foreign-owned row as a skip rather than a hard failure (F2
|
|
96
|
+
* availability fix). Optional; when present the local backend prefers it over
|
|
97
|
+
* {@link saveDocument} for its host-boot seed so a fixture id a durable store
|
|
98
|
+
* already holds as a user-owned row cannot fail host bootstrap. Request-path
|
|
99
|
+
* writes never use it — they stay fail-closed through `saveDocument`.
|
|
100
|
+
*/
|
|
101
|
+
seedDocument?(workflowId: string, document: GraphWorkflowDocument, ...args: MaybeContextualArg<Context>): Promise<unknown>;
|
|
86
102
|
}
|
|
87
103
|
/**
|
|
88
104
|
* Facade-owned event sink handed to a backend. The facade owns event
|
|
@@ -204,6 +220,17 @@ export interface GraphExecutionBackend<CONFIG extends Record<string, unknown> =
|
|
|
204
220
|
* without a catalogue omit this method (or declare `not_supported`).
|
|
205
221
|
*/
|
|
206
222
|
getWorkflow?(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowDocument>;
|
|
223
|
+
/**
|
|
224
|
+
* Seeds canonical workflow documents into this backend's own catalogue so
|
|
225
|
+
* they are served by {@link listWorkflows}/{@link getWorkflow}. The host
|
|
226
|
+
* supplies its fixture registry at boot and the backend registers the
|
|
227
|
+
* documents through its own engine-dependent store (persistence for the local
|
|
228
|
+
* backend, translated catalogue for Mastra, the read-only catalogue for
|
|
229
|
+
* Dagster). Returns the seeded summaries. A backend without a writable
|
|
230
|
+
* catalogue omits this method; the facade fails closed rather than silently
|
|
231
|
+
* dropping the seeds.
|
|
232
|
+
*/
|
|
233
|
+
seedWorkflows?(documents: readonly GraphWorkflowDocument[], ...args: MaybeContextualArg<Context>): Promise<GraphBackendWorkflowSummary[]>;
|
|
207
234
|
/**
|
|
208
235
|
* Executes a validated/resolved workflow.
|
|
209
236
|
*
|
|
@@ -87,6 +87,15 @@ export interface GraphExecutionEngineConfig {
|
|
|
87
87
|
* ignore this port.
|
|
88
88
|
*/
|
|
89
89
|
workflowStore?: GraphBackendWorkflowStore;
|
|
90
|
+
/**
|
|
91
|
+
* Canonical workflow documents to seed into the active backend's own
|
|
92
|
+
* catalogue at boot (the host's fixture registry). Each backend registers
|
|
93
|
+
* them through its engine-dependent store so the per-engine catalogue
|
|
94
|
+
* (`graph/engines/{engineId}/workflows`) serves them. The engine fails closed
|
|
95
|
+
* with `GRAPH_BACKEND_SEED_NOT_SUPPORTED` when seeds are supplied but the
|
|
96
|
+
* backend exposes no seed surface, so a host never silently loses its seeds.
|
|
97
|
+
*/
|
|
98
|
+
seedWorkflows?: readonly GraphWorkflowDocument[];
|
|
90
99
|
/**
|
|
91
100
|
* Decaf adapter backing cached/pinned value persistence. Defaults to the
|
|
92
101
|
* globally configured adapter (`Adapter.current`); tests pass a `RamAdapter`
|
|
@@ -87,6 +87,15 @@ export interface GraphExecutionEngineConfig {
|
|
|
87
87
|
* ignore this port.
|
|
88
88
|
*/
|
|
89
89
|
workflowStore?: GraphBackendWorkflowStore;
|
|
90
|
+
/**
|
|
91
|
+
* Canonical workflow documents to seed into the active backend's own
|
|
92
|
+
* catalogue at boot (the host's fixture registry). Each backend registers
|
|
93
|
+
* them through its engine-dependent store so the per-engine catalogue
|
|
94
|
+
* (`graph/engines/{engineId}/workflows`) serves them. The engine fails closed
|
|
95
|
+
* with `GRAPH_BACKEND_SEED_NOT_SUPPORTED` when seeds are supplied but the
|
|
96
|
+
* backend exposes no seed surface, so a host never silently loses its seeds.
|
|
97
|
+
*/
|
|
98
|
+
seedWorkflows?: readonly GraphWorkflowDocument[];
|
|
90
99
|
/**
|
|
91
100
|
* Decaf adapter backing cached/pinned value persistence. Defaults to the
|
|
92
101
|
* globally configured adapter (`Adapter.current`); tests pass a `RamAdapter`
|
|
@@ -84,6 +84,20 @@ export declare class LocalGraphExecutionBackend implements GraphExecutionBackend
|
|
|
84
84
|
* @throws {GraphExecutionError} when no workflow store is wired in.
|
|
85
85
|
*/
|
|
86
86
|
getWorkflow(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowDocument>;
|
|
87
|
+
/**
|
|
88
|
+
* Seeds canonical workflow documents into the wired `GraphWorkflowStore`
|
|
89
|
+
* port so the local reference backend's catalogue serves them. Each document
|
|
90
|
+
* is persisted through the store's own write path (`saveDocument`), so the
|
|
91
|
+
* seed honours the same boundary validation and ownership rules as any other
|
|
92
|
+
* write — never a bypass. The port must expose `saveDocument`; a read-only
|
|
93
|
+
* store fails closed.
|
|
94
|
+
*
|
|
95
|
+
* @param documents - The canonical documents to persist.
|
|
96
|
+
* @param args - Optional decaf contextual arguments forwarded to the store.
|
|
97
|
+
* @returns The seeded workflow summaries.
|
|
98
|
+
* @throws {GraphExecutionError} when no writable workflow store is wired in.
|
|
99
|
+
*/
|
|
100
|
+
seedWorkflows(documents: readonly GraphWorkflowDocument[], ...args: MaybeContextualArg<Context>): Promise<GraphBackendWorkflowSummary[]>;
|
|
87
101
|
/**
|
|
88
102
|
* Executes a validated/resolved workflow's plan against the facade-owned
|
|
89
103
|
* frame carried by the request's event sink.
|
|
@@ -84,6 +84,20 @@ export declare class LocalGraphExecutionBackend implements GraphExecutionBackend
|
|
|
84
84
|
* @throws {GraphExecutionError} when no workflow store is wired in.
|
|
85
85
|
*/
|
|
86
86
|
getWorkflow(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowDocument>;
|
|
87
|
+
/**
|
|
88
|
+
* Seeds canonical workflow documents into the wired `GraphWorkflowStore`
|
|
89
|
+
* port so the local reference backend's catalogue serves them. Each document
|
|
90
|
+
* is persisted through the store's own write path (`saveDocument`), so the
|
|
91
|
+
* seed honours the same boundary validation and ownership rules as any other
|
|
92
|
+
* write — never a bypass. The port must expose `saveDocument`; a read-only
|
|
93
|
+
* store fails closed.
|
|
94
|
+
*
|
|
95
|
+
* @param documents - The canonical documents to persist.
|
|
96
|
+
* @param args - Optional decaf contextual arguments forwarded to the store.
|
|
97
|
+
* @returns The seeded workflow summaries.
|
|
98
|
+
* @throws {GraphExecutionError} when no writable workflow store is wired in.
|
|
99
|
+
*/
|
|
100
|
+
seedWorkflows(documents: readonly GraphWorkflowDocument[], ...args: MaybeContextualArg<Context>): Promise<GraphBackendWorkflowSummary[]>;
|
|
87
101
|
/**
|
|
88
102
|
* Executes a validated/resolved workflow's plan against the facade-owned
|
|
89
103
|
* frame carried by the request's event sink.
|
|
@@ -62,4 +62,5 @@ export * from "./runs/index.d.cts";
|
|
|
62
62
|
export * from "./services/GraphEnvironment.d.cts";
|
|
63
63
|
export * from "./services/GraphWorkflowService.d.cts";
|
|
64
64
|
export * from "./services/GraphRunModelService.d.cts";
|
|
65
|
+
export * from "./services/GraphNodeModelService.d.cts";
|
|
65
66
|
export * from "./snapshots/GraphExecutionSnapshotMapper.d.cts";
|
|
@@ -62,4 +62,5 @@ export * from "./runs/index.d.mts";
|
|
|
62
62
|
export * from "./services/GraphEnvironment.d.mts";
|
|
63
63
|
export * from "./services/GraphWorkflowService.d.mts";
|
|
64
64
|
export * from "./services/GraphRunModelService.d.mts";
|
|
65
|
+
export * from "./services/GraphNodeModelService.d.mts";
|
|
65
66
|
export * from "./snapshots/GraphExecutionSnapshotMapper.d.mts";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ModelService, type Context, type MaybeContextualArg } from "@decaf-ts/core";
|
|
2
|
+
import { GraphNodeModel } from "../../shared/graph/index.d.cts";
|
|
3
|
+
import type { GraphNodeManifest } from "../../shared/graph/index.d.cts";
|
|
4
|
+
import type { GraphNodeCatalogue } from "../catalog/GraphNodeCatalogue.d.cts";
|
|
5
|
+
/**
|
|
6
|
+
* Model-backed node catalogue: persists {@link GraphNodeManifest} rows as
|
|
7
|
+
* {@link GraphNodeModel} via the Decaf {@link ModelService}.
|
|
8
|
+
*/
|
|
9
|
+
export declare class GraphNodeModelService extends ModelService<GraphNodeModel> {
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Upserts a single node-kind manifest as a {@link GraphNodeModel} row,
|
|
13
|
+
* updating the mirror columns and manifest when the row already exists.
|
|
14
|
+
*
|
|
15
|
+
* @param {GraphNodeManifest} manifest - Node-kind manifest to persist.
|
|
16
|
+
* @param args - An optional decaf `Context` forwarded to the model service.
|
|
17
|
+
* @return {Promise<GraphNodeModel>} The persisted row.
|
|
18
|
+
*/
|
|
19
|
+
upsertManifest(manifest: GraphNodeManifest, ...args: MaybeContextualArg<Context>): Promise<GraphNodeModel>;
|
|
20
|
+
/**
|
|
21
|
+
* Synchronises the whole catalogue into persistence, upserting every listed
|
|
22
|
+
* manifest so listing/CRUD works out of the box for the engine driver.
|
|
23
|
+
*
|
|
24
|
+
* @param {GraphNodeCatalogue} catalogue - Catalogue to mirror into persistence.
|
|
25
|
+
* @param args - An optional decaf `Context` forwarded to the model service.
|
|
26
|
+
* @return {Promise<GraphNodeModel[]>} The persisted rows, in catalogue order.
|
|
27
|
+
*/
|
|
28
|
+
syncFromCatalogue(catalogue: GraphNodeCatalogue, ...args: MaybeContextualArg<Context>): Promise<GraphNodeModel[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Lists every persisted node-kind row, ordered by kind.
|
|
31
|
+
*
|
|
32
|
+
* A store failure propagates instead of being swallowed as `[]` (SAA-93 F4).
|
|
33
|
+
*
|
|
34
|
+
* @param args - An optional decaf `Context` forwarded to the model service.
|
|
35
|
+
* @return {Promise<GraphNodeModel[]>} The persisted rows.
|
|
36
|
+
*/
|
|
37
|
+
listNodes(...args: MaybeContextualArg<Context>): Promise<GraphNodeModel[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Lists every persisted node-kind manifest, ordered by kind.
|
|
40
|
+
*
|
|
41
|
+
* @param args - An optional decaf `Context` forwarded to the model service.
|
|
42
|
+
* @return {Promise<GraphNodeManifest[]>} The persisted manifests.
|
|
43
|
+
*/
|
|
44
|
+
listManifests(...args: MaybeContextualArg<Context>): Promise<GraphNodeManifest[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Reads the persisted row for a node kind.
|
|
47
|
+
*
|
|
48
|
+
* @param {string} kind - Registered node kind to read.
|
|
49
|
+
* @param args - An optional decaf `Context` forwarded to the model service.
|
|
50
|
+
* @return {Promise<GraphNodeModel>} The persisted row.
|
|
51
|
+
* @throws {NotFoundError} When no row exists for `kind`.
|
|
52
|
+
*/
|
|
53
|
+
getNode(kind: string, ...args: MaybeContextualArg<Context>): Promise<GraphNodeModel>;
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ModelService, type Context, type MaybeContextualArg } from "@decaf-ts/core";
|
|
2
|
+
import { GraphNodeModel } from "../../shared/graph/index.d.mts";
|
|
3
|
+
import type { GraphNodeManifest } from "../../shared/graph/index.d.mts";
|
|
4
|
+
import type { GraphNodeCatalogue } from "../catalog/GraphNodeCatalogue.d.mts";
|
|
5
|
+
/**
|
|
6
|
+
* Model-backed node catalogue: persists {@link GraphNodeManifest} rows as
|
|
7
|
+
* {@link GraphNodeModel} via the Decaf {@link ModelService}.
|
|
8
|
+
*/
|
|
9
|
+
export declare class GraphNodeModelService extends ModelService<GraphNodeModel> {
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Upserts a single node-kind manifest as a {@link GraphNodeModel} row,
|
|
13
|
+
* updating the mirror columns and manifest when the row already exists.
|
|
14
|
+
*
|
|
15
|
+
* @param {GraphNodeManifest} manifest - Node-kind manifest to persist.
|
|
16
|
+
* @param args - An optional decaf `Context` forwarded to the model service.
|
|
17
|
+
* @return {Promise<GraphNodeModel>} The persisted row.
|
|
18
|
+
*/
|
|
19
|
+
upsertManifest(manifest: GraphNodeManifest, ...args: MaybeContextualArg<Context>): Promise<GraphNodeModel>;
|
|
20
|
+
/**
|
|
21
|
+
* Synchronises the whole catalogue into persistence, upserting every listed
|
|
22
|
+
* manifest so listing/CRUD works out of the box for the engine driver.
|
|
23
|
+
*
|
|
24
|
+
* @param {GraphNodeCatalogue} catalogue - Catalogue to mirror into persistence.
|
|
25
|
+
* @param args - An optional decaf `Context` forwarded to the model service.
|
|
26
|
+
* @return {Promise<GraphNodeModel[]>} The persisted rows, in catalogue order.
|
|
27
|
+
*/
|
|
28
|
+
syncFromCatalogue(catalogue: GraphNodeCatalogue, ...args: MaybeContextualArg<Context>): Promise<GraphNodeModel[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Lists every persisted node-kind row, ordered by kind.
|
|
31
|
+
*
|
|
32
|
+
* A store failure propagates instead of being swallowed as `[]` (SAA-93 F4).
|
|
33
|
+
*
|
|
34
|
+
* @param args - An optional decaf `Context` forwarded to the model service.
|
|
35
|
+
* @return {Promise<GraphNodeModel[]>} The persisted rows.
|
|
36
|
+
*/
|
|
37
|
+
listNodes(...args: MaybeContextualArg<Context>): Promise<GraphNodeModel[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Lists every persisted node-kind manifest, ordered by kind.
|
|
40
|
+
*
|
|
41
|
+
* @param args - An optional decaf `Context` forwarded to the model service.
|
|
42
|
+
* @return {Promise<GraphNodeManifest[]>} The persisted manifests.
|
|
43
|
+
*/
|
|
44
|
+
listManifests(...args: MaybeContextualArg<Context>): Promise<GraphNodeManifest[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Reads the persisted row for a node kind.
|
|
47
|
+
*
|
|
48
|
+
* @param {string} kind - Registered node kind to read.
|
|
49
|
+
* @param args - An optional decaf `Context` forwarded to the model service.
|
|
50
|
+
* @return {Promise<GraphNodeModel>} The persisted row.
|
|
51
|
+
* @throws {NotFoundError} When no row exists for `kind`.
|
|
52
|
+
*/
|
|
53
|
+
getNode(kind: string, ...args: MaybeContextualArg<Context>): Promise<GraphNodeModel>;
|
|
54
|
+
}
|
|
@@ -69,6 +69,27 @@ export declare class GraphWorkflowService extends ModelService<GraphWorkflowMode
|
|
|
69
69
|
* @throws {GraphWorkflowDocumentRejectedError} When boundary validation fails.
|
|
70
70
|
*/
|
|
71
71
|
saveDocument(workflowId: string, document: GraphWorkflowDocument, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowModel>;
|
|
72
|
+
/**
|
|
73
|
+
* Boot-seed write of a canonical workflow document (F2 availability fix):
|
|
74
|
+
* behaves exactly like {@link saveDocument} except that an ownership conflict
|
|
75
|
+
* on an existing foreign-owned row is treated as a skip-and-log instead of a
|
|
76
|
+
* hard failure. A durable store that already holds a user-owned row for a
|
|
77
|
+
* fixture id therefore cannot fail host bootstrap, while the security posture
|
|
78
|
+
* is unchanged: the foreign-owned row is never overwritten and the engine's own
|
|
79
|
+
* catalogue seed still serves the fixture.
|
|
80
|
+
*
|
|
81
|
+
* This is the boot seeding surface only. Request-path writes MUST keep using
|
|
82
|
+
* {@link saveDocument} / {@link saveSnapshot}, which stay fail-closed on a
|
|
83
|
+
* foreign-owned overwrite (SAA-105 R3).
|
|
84
|
+
*
|
|
85
|
+
* @param {string} workflowId - Workflow id from the fixture registry.
|
|
86
|
+
* @param {GraphWorkflowDocument} document - Canonical document to seed (its `id` must equal `workflowId`).
|
|
87
|
+
* @param args - An optional decaf `Context` carrying the owning principal.
|
|
88
|
+
* @return {Promise<GraphWorkflowModel | null>} The persisted row, or `null` when the seed was skipped because the existing row is owned by another user.
|
|
89
|
+
* @throws {ValidationError} When the payload shape or the document/path id match is invalid.
|
|
90
|
+
* @throws {GraphWorkflowDocumentRejectedError} When boundary validation fails.
|
|
91
|
+
*/
|
|
92
|
+
seedDocument(workflowId: string, document: GraphWorkflowDocument, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowModel | null>;
|
|
72
93
|
/**
|
|
73
94
|
* Reads a workflow's canonical document, enforcing the DECAF-48 ownership
|
|
74
95
|
* tuple. Legacy definition/state snapshots are no longer served.
|
|
@@ -69,6 +69,27 @@ export declare class GraphWorkflowService extends ModelService<GraphWorkflowMode
|
|
|
69
69
|
* @throws {GraphWorkflowDocumentRejectedError} When boundary validation fails.
|
|
70
70
|
*/
|
|
71
71
|
saveDocument(workflowId: string, document: GraphWorkflowDocument, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowModel>;
|
|
72
|
+
/**
|
|
73
|
+
* Boot-seed write of a canonical workflow document (F2 availability fix):
|
|
74
|
+
* behaves exactly like {@link saveDocument} except that an ownership conflict
|
|
75
|
+
* on an existing foreign-owned row is treated as a skip-and-log instead of a
|
|
76
|
+
* hard failure. A durable store that already holds a user-owned row for a
|
|
77
|
+
* fixture id therefore cannot fail host bootstrap, while the security posture
|
|
78
|
+
* is unchanged: the foreign-owned row is never overwritten and the engine's own
|
|
79
|
+
* catalogue seed still serves the fixture.
|
|
80
|
+
*
|
|
81
|
+
* This is the boot seeding surface only. Request-path writes MUST keep using
|
|
82
|
+
* {@link saveDocument} / {@link saveSnapshot}, which stay fail-closed on a
|
|
83
|
+
* foreign-owned overwrite (SAA-105 R3).
|
|
84
|
+
*
|
|
85
|
+
* @param {string} workflowId - Workflow id from the fixture registry.
|
|
86
|
+
* @param {GraphWorkflowDocument} document - Canonical document to seed (its `id` must equal `workflowId`).
|
|
87
|
+
* @param args - An optional decaf `Context` carrying the owning principal.
|
|
88
|
+
* @return {Promise<GraphWorkflowModel | null>} The persisted row, or `null` when the seed was skipped because the existing row is owned by another user.
|
|
89
|
+
* @throws {ValidationError} When the payload shape or the document/path id match is invalid.
|
|
90
|
+
* @throws {GraphWorkflowDocumentRejectedError} When boundary validation fails.
|
|
91
|
+
*/
|
|
92
|
+
seedDocument(workflowId: string, document: GraphWorkflowDocument, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowModel | null>;
|
|
72
93
|
/**
|
|
73
94
|
* Reads a workflow's canonical document, enforcing the DECAF-48 ownership
|
|
74
95
|
* tuple. Legacy definition/state snapshots are no longer served.
|
|
@@ -56,11 +56,6 @@ export interface MastraWorkflowManagementCapabilities {
|
|
|
56
56
|
/** Native workflow versioning support. */
|
|
57
57
|
version: MastraWorkflowCapabilityStatus;
|
|
58
58
|
}
|
|
59
|
-
/**
|
|
60
|
-
* The full Mastra backend capability projection: the engine-agnostic
|
|
61
|
-
* {@link GraphBackendCapabilities} plus the Mastra-specific workflow-management
|
|
62
|
-
* statuses.
|
|
63
|
-
*/
|
|
64
59
|
export interface MastraBackendCapabilities extends GraphBackendCapabilities {
|
|
65
60
|
/** Workflow list/lookup plus the management statuses. */
|
|
66
61
|
workflows: GraphBackendCapabilities["workflows"] & MastraWorkflowManagementCapabilities;
|
|
@@ -56,11 +56,6 @@ export interface MastraWorkflowManagementCapabilities {
|
|
|
56
56
|
/** Native workflow versioning support. */
|
|
57
57
|
version: MastraWorkflowCapabilityStatus;
|
|
58
58
|
}
|
|
59
|
-
/**
|
|
60
|
-
* The full Mastra backend capability projection: the engine-agnostic
|
|
61
|
-
* {@link GraphBackendCapabilities} plus the Mastra-specific workflow-management
|
|
62
|
-
* statuses.
|
|
63
|
-
*/
|
|
64
59
|
export interface MastraBackendCapabilities extends GraphBackendCapabilities {
|
|
65
60
|
/** Workflow list/lookup plus the management statuses. */
|
|
66
61
|
workflows: GraphBackendCapabilities["workflows"] & MastraWorkflowManagementCapabilities;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type MastraNodeStepHandler } from "./types.d.cts";
|
|
2
|
+
/**
|
|
3
|
+
* The built-in leaf node kinds covered by the default handler set: the
|
|
4
|
+
* plain-data, flow-utility, trigger, and utility kinds that compile as opaque
|
|
5
|
+
* steps. Structural kinds (`core.flow.if`/`core.flow.switch`, the
|
|
6
|
+
* `core.loop.*` loops, and `core.flow.humanApproval`) are translated by the
|
|
7
|
+
* compiler itself and are deliberately absent.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MASTRA_DEFAULT_STEP_HANDLER_KINDS: readonly ["value", "result", "core.agent", "core.flow.break", "core.flow.delay", "core.flow.errorBoundary", "core.flow.log", "core.trigger.chat", "core.trigger.event", "core.trigger.form", "core.trigger.manual", "core.trigger.schedule", "core.trigger.webhook", "core.utility.code", "core.utility.log", "core.utility.map"];
|
|
10
|
+
/** Any built-in leaf node kind covered by {@link MASTRA_DEFAULT_STEP_HANDLER_KINDS}. */
|
|
11
|
+
export type MastraDefaultStepHandlerKind = (typeof MASTRA_DEFAULT_STEP_HANDLER_KINDS)[number];
|
|
12
|
+
/**
|
|
13
|
+
* Largest delay `setTimeout` accepts before Node overflows and collapses the
|
|
14
|
+
* wait to ~1ms (`2^31 - 1`). {@link createMastraDefaultStepHandlers} clamps a
|
|
15
|
+
* delay node's `timeoutMs` to this value *before* scheduling, so a hostile or
|
|
16
|
+
* oversized declared delay can never hit the overflow degenerate path.
|
|
17
|
+
*/
|
|
18
|
+
export declare const MASTRA_MAX_SET_TIMEOUT_MS = 2147483647;
|
|
19
|
+
/**
|
|
20
|
+
* Default host-configurable ceiling, in milliseconds, for a `core.flow.delay`
|
|
21
|
+
* node's `timeoutMs` (60s). The declared value is clamped to this ceiling, never
|
|
22
|
+
* rejected, so an oversized document cannot pin a run slot for up to
|
|
23
|
+
* `MASTRA_MAX_SET_TIMEOUT_MS` (~24.8 days) per node.
|
|
24
|
+
*/
|
|
25
|
+
export declare const DEFAULT_MASTRA_DELAY_MAX_MS = 60000;
|
|
26
|
+
/**
|
|
27
|
+
* Reserved key under which a default-handler result records that the node was
|
|
28
|
+
* not fully executed. `core.agent` returns its forwarded input plus this key so
|
|
29
|
+
* a caller can tell a declared-but-inert agent step apart from a real one; the
|
|
30
|
+
* key never collides with a canonical data port.
|
|
31
|
+
*/
|
|
32
|
+
export declare const MASTRA_DEGRADED_OUTPUT_KEY = "__mastraDegraded";
|
|
33
|
+
/** Details recorded under {@link MASTRA_DEGRADED_OUTPUT_KEY}. */
|
|
34
|
+
export interface MastraDegradedOutput {
|
|
35
|
+
/** The node kind whose declared capability was not executed. */
|
|
36
|
+
kind: string;
|
|
37
|
+
/** The node id the degraded result belongs to. */
|
|
38
|
+
nodeId: string;
|
|
39
|
+
/** Human-readable reason the node degraded to a pass-through. */
|
|
40
|
+
reason: string;
|
|
41
|
+
}
|
|
42
|
+
/** Options {@link createMastraDefaultStepHandlers} is created with. */
|
|
43
|
+
export interface MastraDefaultStepHandlerOptions {
|
|
44
|
+
/**
|
|
45
|
+
* Optional sink for the log kinds' messages (the default is silent).
|
|
46
|
+
*
|
|
47
|
+
* The sink receives **untrusted** data: `message` is the document's
|
|
48
|
+
* `node.parameters.message` verbatim and `meta` carries in-flight node data. A
|
|
49
|
+
* logger implementation must treat both arguments as untrusted, JSON-serialize
|
|
50
|
+
* `meta`, and never interpolate either into a line-oriented log (the pattern
|
|
51
|
+
* `nest/graph/servingErrors.ts` already mandates) — otherwise a crafted
|
|
52
|
+
* document enables log forging or CRLF injection.
|
|
53
|
+
*/
|
|
54
|
+
logger?: (message: string, meta?: Record<string, unknown>) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Host-configurable ceiling, in milliseconds, for a `core.flow.delay` node's
|
|
57
|
+
* `timeoutMs`. The declared value is clamped to this ceiling (never rejected)
|
|
58
|
+
* and additionally bounded by {@link MASTRA_MAX_SET_TIMEOUT_MS}; defaults to
|
|
59
|
+
* {@link DEFAULT_MASTRA_DELAY_MAX_MS}.
|
|
60
|
+
*/
|
|
61
|
+
maxDelayMs?: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Builds the default {@link MastraNodeStepHandler} set: one handler per
|
|
65
|
+
* {@link MastraDefaultStepHandlerKind}. Each handler creates a
|
|
66
|
+
* schema-agnostic Mastra step (`z.any()` input and output schemas) whose
|
|
67
|
+
* execution coerces the runtime's input data to a record and delegates to the
|
|
68
|
+
* kind's executor, so untyped document parameters never break the runtime.
|
|
69
|
+
*
|
|
70
|
+
* @param options - Optional handler-set options (logger and delay ceiling).
|
|
71
|
+
* @returns One {@link MastraNodeStepHandler} per entry of
|
|
72
|
+
* {@link MASTRA_DEFAULT_STEP_HANDLER_KINDS}.
|
|
73
|
+
*/
|
|
74
|
+
export declare function createMastraDefaultStepHandlers(options?: MastraDefaultStepHandlerOptions): MastraNodeStepHandler[];
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type MastraNodeStepHandler } from "./types.d.mts";
|
|
2
|
+
/**
|
|
3
|
+
* The built-in leaf node kinds covered by the default handler set: the
|
|
4
|
+
* plain-data, flow-utility, trigger, and utility kinds that compile as opaque
|
|
5
|
+
* steps. Structural kinds (`core.flow.if`/`core.flow.switch`, the
|
|
6
|
+
* `core.loop.*` loops, and `core.flow.humanApproval`) are translated by the
|
|
7
|
+
* compiler itself and are deliberately absent.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MASTRA_DEFAULT_STEP_HANDLER_KINDS: readonly ["value", "result", "core.agent", "core.flow.break", "core.flow.delay", "core.flow.errorBoundary", "core.flow.log", "core.trigger.chat", "core.trigger.event", "core.trigger.form", "core.trigger.manual", "core.trigger.schedule", "core.trigger.webhook", "core.utility.code", "core.utility.log", "core.utility.map"];
|
|
10
|
+
/** Any built-in leaf node kind covered by {@link MASTRA_DEFAULT_STEP_HANDLER_KINDS}. */
|
|
11
|
+
export type MastraDefaultStepHandlerKind = (typeof MASTRA_DEFAULT_STEP_HANDLER_KINDS)[number];
|
|
12
|
+
/**
|
|
13
|
+
* Largest delay `setTimeout` accepts before Node overflows and collapses the
|
|
14
|
+
* wait to ~1ms (`2^31 - 1`). {@link createMastraDefaultStepHandlers} clamps a
|
|
15
|
+
* delay node's `timeoutMs` to this value *before* scheduling, so a hostile or
|
|
16
|
+
* oversized declared delay can never hit the overflow degenerate path.
|
|
17
|
+
*/
|
|
18
|
+
export declare const MASTRA_MAX_SET_TIMEOUT_MS = 2147483647;
|
|
19
|
+
/**
|
|
20
|
+
* Default host-configurable ceiling, in milliseconds, for a `core.flow.delay`
|
|
21
|
+
* node's `timeoutMs` (60s). The declared value is clamped to this ceiling, never
|
|
22
|
+
* rejected, so an oversized document cannot pin a run slot for up to
|
|
23
|
+
* `MASTRA_MAX_SET_TIMEOUT_MS` (~24.8 days) per node.
|
|
24
|
+
*/
|
|
25
|
+
export declare const DEFAULT_MASTRA_DELAY_MAX_MS = 60000;
|
|
26
|
+
/**
|
|
27
|
+
* Reserved key under which a default-handler result records that the node was
|
|
28
|
+
* not fully executed. `core.agent` returns its forwarded input plus this key so
|
|
29
|
+
* a caller can tell a declared-but-inert agent step apart from a real one; the
|
|
30
|
+
* key never collides with a canonical data port.
|
|
31
|
+
*/
|
|
32
|
+
export declare const MASTRA_DEGRADED_OUTPUT_KEY = "__mastraDegraded";
|
|
33
|
+
/** Details recorded under {@link MASTRA_DEGRADED_OUTPUT_KEY}. */
|
|
34
|
+
export interface MastraDegradedOutput {
|
|
35
|
+
/** The node kind whose declared capability was not executed. */
|
|
36
|
+
kind: string;
|
|
37
|
+
/** The node id the degraded result belongs to. */
|
|
38
|
+
nodeId: string;
|
|
39
|
+
/** Human-readable reason the node degraded to a pass-through. */
|
|
40
|
+
reason: string;
|
|
41
|
+
}
|
|
42
|
+
/** Options {@link createMastraDefaultStepHandlers} is created with. */
|
|
43
|
+
export interface MastraDefaultStepHandlerOptions {
|
|
44
|
+
/**
|
|
45
|
+
* Optional sink for the log kinds' messages (the default is silent).
|
|
46
|
+
*
|
|
47
|
+
* The sink receives **untrusted** data: `message` is the document's
|
|
48
|
+
* `node.parameters.message` verbatim and `meta` carries in-flight node data. A
|
|
49
|
+
* logger implementation must treat both arguments as untrusted, JSON-serialize
|
|
50
|
+
* `meta`, and never interpolate either into a line-oriented log (the pattern
|
|
51
|
+
* `nest/graph/servingErrors.ts` already mandates) — otherwise a crafted
|
|
52
|
+
* document enables log forging or CRLF injection.
|
|
53
|
+
*/
|
|
54
|
+
logger?: (message: string, meta?: Record<string, unknown>) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Host-configurable ceiling, in milliseconds, for a `core.flow.delay` node's
|
|
57
|
+
* `timeoutMs`. The declared value is clamped to this ceiling (never rejected)
|
|
58
|
+
* and additionally bounded by {@link MASTRA_MAX_SET_TIMEOUT_MS}; defaults to
|
|
59
|
+
* {@link DEFAULT_MASTRA_DELAY_MAX_MS}.
|
|
60
|
+
*/
|
|
61
|
+
maxDelayMs?: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Builds the default {@link MastraNodeStepHandler} set: one handler per
|
|
65
|
+
* {@link MastraDefaultStepHandlerKind}. Each handler creates a
|
|
66
|
+
* schema-agnostic Mastra step (`z.any()` input and output schemas) whose
|
|
67
|
+
* execution coerces the runtime's input data to a record and delegates to the
|
|
68
|
+
* kind's executor, so untyped document parameters never break the runtime.
|
|
69
|
+
*
|
|
70
|
+
* @param options - Optional handler-set options (logger and delay ceiling).
|
|
71
|
+
* @returns One {@link MastraNodeStepHandler} per entry of
|
|
72
|
+
* {@link MASTRA_DEFAULT_STEP_HANDLER_KINDS}.
|
|
73
|
+
*/
|
|
74
|
+
export declare function createMastraDefaultStepHandlers(options?: MastraDefaultStepHandlerOptions): MastraNodeStepHandler[];
|
|
@@ -34,6 +34,7 @@ export declare class MastraGraphExecutionBackend implements GraphExecutionBacken
|
|
|
34
34
|
private managementManager?;
|
|
35
35
|
private suspendStateReader?;
|
|
36
36
|
private maxResumeBytes;
|
|
37
|
+
private terminalTimeoutMs;
|
|
37
38
|
private initialized;
|
|
38
39
|
private _config?;
|
|
39
40
|
constructor();
|
|
@@ -75,7 +76,35 @@ export declare class MastraGraphExecutionBackend implements GraphExecutionBacken
|
|
|
75
76
|
* @throws {NotFoundError} when the workflow is owned by another user.
|
|
76
77
|
*/
|
|
77
78
|
getWorkflow(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowDocument>;
|
|
79
|
+
/**
|
|
80
|
+
* Seeds canonical workflow documents into the translated-workflow catalogue so
|
|
81
|
+
* they are served by {@link listWorkflows}/{@link getWorkflow} exactly like a
|
|
82
|
+
* document recorded by {@link execute}. Seeded entries are owner-less, so the
|
|
83
|
+
* C23 filter keeps them visible to every caller (the owner-less visibility
|
|
84
|
+
* rule). Fails closed when the backend has not been initialized.
|
|
85
|
+
*
|
|
86
|
+
* @param documents - The canonical documents to register.
|
|
87
|
+
* @returns The seeded workflow summaries.
|
|
88
|
+
* @throws {GraphExecutionError} when the backend is not initialized.
|
|
89
|
+
*/
|
|
90
|
+
seedWorkflows(documents: readonly GraphWorkflowDocument[]): Promise<GraphBackendWorkflowSummary[]>;
|
|
78
91
|
execute(request: GraphBackendExecutionRequest, ...args: MaybeContextualArg<Context>): Promise<GraphExecutionResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Bounds the translated run's terminal wait by the backend's run-level
|
|
94
|
+
* `terminalTimeoutMs` and the caller's cancellation signal, mirroring the
|
|
95
|
+
* Dagster observation bound. Exceeding the timeout fails closed with
|
|
96
|
+
* {@link GRAPH_MASTRA_EXECUTE_TIMEOUT}; an abort fails closed with
|
|
97
|
+
* {@link GRAPH_MASTRA_EXECUTE_ABORTED}. The underlying run is not force-killed
|
|
98
|
+
* (Mastra owns run lifecycle), but the backend stops awaiting it so the run
|
|
99
|
+
* slot and event bridge are released and the run cannot pin the process.
|
|
100
|
+
*
|
|
101
|
+
* @param execution - The in-flight run/stream/result promise.
|
|
102
|
+
* @param signal - The caller's cancellation signal, when supplied.
|
|
103
|
+
* @param workflowId - The workflow id the run belongs to (for error details).
|
|
104
|
+
* @returns Resolves once the run terminates normally.
|
|
105
|
+
* @throws {GraphExecutionError} on timeout or abort.
|
|
106
|
+
*/
|
|
107
|
+
private awaitTerminal;
|
|
79
108
|
/**
|
|
80
109
|
* Resumes a suspended Mastra run after enforcing the SAA-193 resume guard
|
|
81
110
|
* (C13/C15/C16/C17/C18). The Mastra run snapshot is authoritative for the
|
|
@@ -34,6 +34,7 @@ export declare class MastraGraphExecutionBackend implements GraphExecutionBacken
|
|
|
34
34
|
private managementManager?;
|
|
35
35
|
private suspendStateReader?;
|
|
36
36
|
private maxResumeBytes;
|
|
37
|
+
private terminalTimeoutMs;
|
|
37
38
|
private initialized;
|
|
38
39
|
private _config?;
|
|
39
40
|
constructor();
|
|
@@ -75,7 +76,35 @@ export declare class MastraGraphExecutionBackend implements GraphExecutionBacken
|
|
|
75
76
|
* @throws {NotFoundError} when the workflow is owned by another user.
|
|
76
77
|
*/
|
|
77
78
|
getWorkflow(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowDocument>;
|
|
79
|
+
/**
|
|
80
|
+
* Seeds canonical workflow documents into the translated-workflow catalogue so
|
|
81
|
+
* they are served by {@link listWorkflows}/{@link getWorkflow} exactly like a
|
|
82
|
+
* document recorded by {@link execute}. Seeded entries are owner-less, so the
|
|
83
|
+
* C23 filter keeps them visible to every caller (the owner-less visibility
|
|
84
|
+
* rule). Fails closed when the backend has not been initialized.
|
|
85
|
+
*
|
|
86
|
+
* @param documents - The canonical documents to register.
|
|
87
|
+
* @returns The seeded workflow summaries.
|
|
88
|
+
* @throws {GraphExecutionError} when the backend is not initialized.
|
|
89
|
+
*/
|
|
90
|
+
seedWorkflows(documents: readonly GraphWorkflowDocument[]): Promise<GraphBackendWorkflowSummary[]>;
|
|
78
91
|
execute(request: GraphBackendExecutionRequest, ...args: MaybeContextualArg<Context>): Promise<GraphExecutionResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Bounds the translated run's terminal wait by the backend's run-level
|
|
94
|
+
* `terminalTimeoutMs` and the caller's cancellation signal, mirroring the
|
|
95
|
+
* Dagster observation bound. Exceeding the timeout fails closed with
|
|
96
|
+
* {@link GRAPH_MASTRA_EXECUTE_TIMEOUT}; an abort fails closed with
|
|
97
|
+
* {@link GRAPH_MASTRA_EXECUTE_ABORTED}. The underlying run is not force-killed
|
|
98
|
+
* (Mastra owns run lifecycle), but the backend stops awaiting it so the run
|
|
99
|
+
* slot and event bridge are released and the run cannot pin the process.
|
|
100
|
+
*
|
|
101
|
+
* @param execution - The in-flight run/stream/result promise.
|
|
102
|
+
* @param signal - The caller's cancellation signal, when supplied.
|
|
103
|
+
* @param workflowId - The workflow id the run belongs to (for error details).
|
|
104
|
+
* @returns Resolves once the run terminates normally.
|
|
105
|
+
* @throws {GraphExecutionError} on timeout or abort.
|
|
106
|
+
*/
|
|
107
|
+
private awaitTerminal;
|
|
79
108
|
/**
|
|
80
109
|
* Resumes a suspended Mastra run after enforcing the SAA-193 resume guard
|
|
81
110
|
* (C13/C15/C16/C17/C18). The Mastra run snapshot is authoritative for the
|
|
@@ -18,11 +18,11 @@ export declare const GRAPH_MASTRA_IF_KIND = "core.flow.if";
|
|
|
18
18
|
/** Document kind translated into a Mastra `switch` branch set. */
|
|
19
19
|
export declare const GRAPH_MASTRA_SWITCH_KIND = "core.flow.switch";
|
|
20
20
|
/** Document kind translated into a Mastra `foreach` loop. */
|
|
21
|
-
export declare const GRAPH_MASTRA_FOREACH_KIND = "
|
|
21
|
+
export declare const GRAPH_MASTRA_FOREACH_KIND = "core.loop.foreach";
|
|
22
22
|
/** Document kind translated into a Mastra `do-while` loop. */
|
|
23
|
-
export declare const GRAPH_MASTRA_WHILE_KIND = "
|
|
23
|
+
export declare const GRAPH_MASTRA_WHILE_KIND = "core.loop.while";
|
|
24
24
|
/** Document kind translated into a Mastra `do-until` loop. */
|
|
25
|
-
export declare const GRAPH_MASTRA_UNTIL_KIND = "
|
|
25
|
+
export declare const GRAPH_MASTRA_UNTIL_KIND = "core.loop.until";
|
|
26
26
|
/** Document kind translated into a Mastra suspending approval step. */
|
|
27
27
|
export declare const GRAPH_MASTRA_HUMAN_APPROVAL_KIND = "core.flow.humanApproval";
|
|
28
28
|
/**
|
|
@@ -18,11 +18,11 @@ export declare const GRAPH_MASTRA_IF_KIND = "core.flow.if";
|
|
|
18
18
|
/** Document kind translated into a Mastra `switch` branch set. */
|
|
19
19
|
export declare const GRAPH_MASTRA_SWITCH_KIND = "core.flow.switch";
|
|
20
20
|
/** Document kind translated into a Mastra `foreach` loop. */
|
|
21
|
-
export declare const GRAPH_MASTRA_FOREACH_KIND = "
|
|
21
|
+
export declare const GRAPH_MASTRA_FOREACH_KIND = "core.loop.foreach";
|
|
22
22
|
/** Document kind translated into a Mastra `do-while` loop. */
|
|
23
|
-
export declare const GRAPH_MASTRA_WHILE_KIND = "
|
|
23
|
+
export declare const GRAPH_MASTRA_WHILE_KIND = "core.loop.while";
|
|
24
24
|
/** Document kind translated into a Mastra `do-until` loop. */
|
|
25
|
-
export declare const GRAPH_MASTRA_UNTIL_KIND = "
|
|
25
|
+
export declare const GRAPH_MASTRA_UNTIL_KIND = "core.loop.until";
|
|
26
26
|
/** Document kind translated into a Mastra suspending approval step. */
|
|
27
27
|
export declare const GRAPH_MASTRA_HUMAN_APPROVAL_KIND = "core.flow.humanApproval";
|
|
28
28
|
/**
|