mayura 1.2.0 → 1.2.1

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 (225) hide show
  1. package/docs/README.md +1 -0
  2. package/docs/concepts/workflows.md +60 -1
  3. package/docs/guides/durable-workflows.md +1 -1
  4. package/docs/guides/rag-production.md +29 -0
  5. package/docs/guides/rag.md +12 -2
  6. package/docs/guides/release-readiness.md +8 -22
  7. package/docs/guides/workflow-composition.md +1 -1
  8. package/docs/integrations/vector-pinecone.md +1 -1
  9. package/lib/adapter-code-docker/image/Dockerfile +1 -1
  10. package/lib/adapter-code-docker/package.json +1 -1
  11. package/lib/adapter-code-quickjs/package.json +1 -1
  12. package/lib/adapter-mcp/package.json +1 -1
  13. package/lib/ag-ui/package.json +1 -1
  14. package/lib/artifacts/package.json +1 -1
  15. package/lib/auth/package.json +1 -1
  16. package/lib/authz/package.json +1 -1
  17. package/lib/browser/package.json +1 -1
  18. package/lib/cli/dist/operations.d.ts +1 -0
  19. package/lib/cli/dist/operations.d.ts.map +1 -1
  20. package/lib/cli/dist/operations.js +13 -5
  21. package/lib/cli/dist/operations.js.map +1 -1
  22. package/lib/cli/package.json +1 -1
  23. package/lib/cli/src/operations.ts +9 -5
  24. package/lib/client/dist/index.d.ts.map +1 -1
  25. package/lib/client/dist/index.js +12 -4
  26. package/lib/client/dist/index.js.map +1 -1
  27. package/lib/client/dist/workflow-limits.d.ts +6 -0
  28. package/lib/client/dist/workflow-limits.d.ts.map +1 -0
  29. package/lib/client/dist/workflow-limits.js +15 -0
  30. package/lib/client/dist/workflow-limits.js.map +1 -0
  31. package/lib/client/dist/workflows.d.ts +3 -0
  32. package/lib/client/dist/workflows.d.ts.map +1 -1
  33. package/lib/client/dist/workflows.js +15 -7
  34. package/lib/client/dist/workflows.js.map +1 -1
  35. package/lib/client/package.json +1 -1
  36. package/lib/client/src/index.ts +7 -4
  37. package/lib/client/src/workflow-limits.ts +12 -0
  38. package/lib/client/src/workflows.ts +12 -6
  39. package/lib/client-react/package.json +1 -1
  40. package/lib/code-mode/package.json +1 -1
  41. package/lib/code-mode-workflows/package.json +1 -1
  42. package/lib/context/package.json +1 -1
  43. package/lib/core/dist/host.d.ts +1 -0
  44. package/lib/core/dist/host.d.ts.map +1 -1
  45. package/lib/core/dist/host.js +1 -0
  46. package/lib/core/dist/host.js.map +1 -1
  47. package/lib/core/dist/index.d.ts +1 -0
  48. package/lib/core/dist/index.d.ts.map +1 -1
  49. package/lib/core/dist/index.js +1 -0
  50. package/lib/core/dist/index.js.map +1 -1
  51. package/lib/core/dist/workflow-environment.d.ts +9 -0
  52. package/lib/core/dist/workflow-environment.d.ts.map +1 -0
  53. package/lib/core/dist/workflow-environment.js +15 -0
  54. package/lib/core/dist/workflow-environment.js.map +1 -0
  55. package/lib/core/dist/workflow-limits.d.ts +7 -0
  56. package/lib/core/dist/workflow-limits.d.ts.map +1 -0
  57. package/lib/core/dist/workflow-limits.js +17 -0
  58. package/lib/core/dist/workflow-limits.js.map +1 -0
  59. package/lib/core/package.json +1 -1
  60. package/lib/core/src/host.ts +1 -0
  61. package/lib/core/src/index.ts +1 -0
  62. package/lib/core/src/workflow-environment.ts +15 -0
  63. package/lib/core/src/workflow-limits.ts +16 -0
  64. package/lib/exporter-otlp/dist/otlp-http-json.js +1 -1
  65. package/lib/exporter-otlp/dist/otlp-http-json.js.map +1 -1
  66. package/lib/exporter-otlp/dist/signals.js +2 -2
  67. package/lib/exporter-otlp/dist/signals.js.map +1 -1
  68. package/lib/exporter-otlp/package.json +1 -1
  69. package/lib/exporter-otlp/src/otlp-http-json.ts +1 -1
  70. package/lib/exporter-otlp/src/signals.ts +2 -2
  71. package/lib/files/package.json +1 -1
  72. package/lib/guardrails/package.json +1 -1
  73. package/lib/helpers/package.json +1 -1
  74. package/lib/keys/package.json +1 -1
  75. package/lib/memory/package.json +1 -1
  76. package/lib/memory-remote/package.json +1 -1
  77. package/lib/observability/package.json +1 -1
  78. package/lib/provider-anthropic/package.json +1 -1
  79. package/lib/provider-openai/package.json +1 -1
  80. package/lib/rag/dist/bm25.d.ts +13 -0
  81. package/lib/rag/dist/bm25.d.ts.map +1 -0
  82. package/lib/rag/dist/bm25.js +76 -0
  83. package/lib/rag/dist/bm25.js.map +1 -0
  84. package/lib/rag/dist/document-lexical.d.ts +7 -0
  85. package/lib/rag/dist/document-lexical.d.ts.map +1 -0
  86. package/lib/rag/dist/document-lexical.js +33 -0
  87. package/lib/rag/dist/document-lexical.js.map +1 -0
  88. package/lib/rag/dist/evidence-window.d.ts +15 -0
  89. package/lib/rag/dist/evidence-window.d.ts.map +1 -0
  90. package/lib/rag/dist/evidence-window.js +52 -0
  91. package/lib/rag/dist/evidence-window.js.map +1 -0
  92. package/lib/rag/dist/retrieval.d.ts +6 -0
  93. package/lib/rag/dist/retrieval.d.ts.map +1 -1
  94. package/lib/rag/dist/retrieval.js +60 -6
  95. package/lib/rag/dist/retrieval.js.map +1 -1
  96. package/lib/rag/dist/vectors.d.ts +8 -0
  97. package/lib/rag/dist/vectors.d.ts.map +1 -1
  98. package/lib/rag/dist/vectors.js +121 -4
  99. package/lib/rag/dist/vectors.js.map +1 -1
  100. package/lib/rag/package.json +1 -1
  101. package/lib/rag/src/bm25.ts +35 -0
  102. package/lib/rag/src/document-lexical.ts +17 -0
  103. package/lib/rag/src/evidence-window.ts +41 -0
  104. package/lib/rag/src/retrieval.ts +56 -7
  105. package/lib/rag/src/vectors.ts +62 -4
  106. package/lib/runtime/package.json +1 -1
  107. package/lib/sandbox/package.json +1 -1
  108. package/lib/sdk/package.json +1 -1
  109. package/lib/server/dist/index.d.ts +2 -0
  110. package/lib/server/dist/index.d.ts.map +1 -1
  111. package/lib/server/dist/index.js +12 -4
  112. package/lib/server/dist/index.js.map +1 -1
  113. package/lib/server/dist/inspector-bundle.d.ts +1 -1
  114. package/lib/server/dist/inspector-bundle.d.ts.map +1 -1
  115. package/lib/server/dist/inspector-bundle.js +4 -4
  116. package/lib/server/dist/inspector-bundle.js.map +1 -1
  117. package/lib/server/package.json +1 -1
  118. package/lib/server/src/index.ts +9 -4
  119. package/lib/server/src/inspector-bundle.ts +4 -4
  120. package/lib/server-node/package.json +1 -1
  121. package/lib/skills/package.json +1 -1
  122. package/lib/storage/package.json +1 -1
  123. package/lib/storage-contracts/dist/scheduled-workflow-contracts.d.ts +2 -0
  124. package/lib/storage-contracts/dist/scheduled-workflow-contracts.d.ts.map +1 -1
  125. package/lib/storage-contracts/dist/scheduled-workflow-contracts.js.map +1 -1
  126. package/lib/storage-contracts/dist/workflow-format2.d.ts +2 -0
  127. package/lib/storage-contracts/dist/workflow-format2.d.ts.map +1 -1
  128. package/lib/storage-contracts/dist/workflow-format2.js +8 -7
  129. package/lib/storage-contracts/dist/workflow-format2.js.map +1 -1
  130. package/lib/storage-contracts/dist/workflow-format3.d.ts.map +1 -1
  131. package/lib/storage-contracts/dist/workflow-format3.js +9 -7
  132. package/lib/storage-contracts/dist/workflow-format3.js.map +1 -1
  133. package/lib/storage-contracts/dist/workflow-format4.d.ts +2 -0
  134. package/lib/storage-contracts/dist/workflow-format4.d.ts.map +1 -1
  135. package/lib/storage-contracts/dist/workflow-format4.js +9 -8
  136. package/lib/storage-contracts/dist/workflow-format4.js.map +1 -1
  137. package/lib/storage-contracts/dist/workflow-format5.d.ts +4 -0
  138. package/lib/storage-contracts/dist/workflow-format5.d.ts.map +1 -1
  139. package/lib/storage-contracts/dist/workflow-format5.js +9 -8
  140. package/lib/storage-contracts/dist/workflow-format5.js.map +1 -1
  141. package/lib/storage-contracts/dist/workflow-graph-contracts.d.ts +2 -0
  142. package/lib/storage-contracts/dist/workflow-graph-contracts.d.ts.map +1 -1
  143. package/lib/storage-contracts/dist/workflow-graph-contracts.js.map +1 -1
  144. package/lib/storage-contracts/dist/workflow-tree-contracts.d.ts +2 -0
  145. package/lib/storage-contracts/dist/workflow-tree-contracts.d.ts.map +1 -1
  146. package/lib/storage-contracts/dist/workflow-tree-contracts.js +5 -3
  147. package/lib/storage-contracts/dist/workflow-tree-contracts.js.map +1 -1
  148. package/lib/storage-contracts/package.json +1 -1
  149. package/lib/storage-contracts/src/scheduled-workflow-contracts.ts +2 -0
  150. package/lib/storage-contracts/src/workflow-format2.ts +10 -7
  151. package/lib/storage-contracts/src/workflow-format3.ts +9 -7
  152. package/lib/storage-contracts/src/workflow-format4.ts +11 -8
  153. package/lib/storage-contracts/src/workflow-format5.ts +13 -8
  154. package/lib/storage-contracts/src/workflow-graph-contracts.ts +2 -0
  155. package/lib/storage-contracts/src/workflow-tree-contracts.ts +7 -3
  156. package/lib/storage-postgres/package.json +1 -1
  157. package/lib/storage-sql/dist/scheduled-database.js +1 -1
  158. package/lib/storage-sql/dist/scheduled-database.js.map +1 -1
  159. package/lib/storage-sql/dist/workflow-tree-database.d.ts.map +1 -1
  160. package/lib/storage-sql/dist/workflow-tree-database.js +37 -1
  161. package/lib/storage-sql/dist/workflow-tree-database.js.map +1 -1
  162. package/lib/storage-sql/package.json +1 -1
  163. package/lib/storage-sql/src/scheduled-database.ts +1 -1
  164. package/lib/storage-sql/src/workflow-tree-database.ts +15 -1
  165. package/lib/storage-sqlite/package.json +1 -1
  166. package/lib/terminal/package.json +1 -1
  167. package/lib/testing/package.json +1 -1
  168. package/lib/threads/package.json +1 -1
  169. package/lib/tools/package.json +1 -1
  170. package/lib/voice/package.json +1 -1
  171. package/lib/workflows/dist/children-definition.d.ts +5 -1
  172. package/lib/workflows/dist/children-definition.d.ts.map +1 -1
  173. package/lib/workflows/dist/children-definition.js +6 -2
  174. package/lib/workflows/dist/children-definition.js.map +1 -1
  175. package/lib/workflows/dist/children-runtime.d.ts.map +1 -1
  176. package/lib/workflows/dist/children-runtime.js +4 -3
  177. package/lib/workflows/dist/children-runtime.js.map +1 -1
  178. package/lib/workflows/dist/definition.d.ts +4 -0
  179. package/lib/workflows/dist/definition.d.ts.map +1 -1
  180. package/lib/workflows/dist/definition.js +6 -3
  181. package/lib/workflows/dist/definition.js.map +1 -1
  182. package/lib/workflows/dist/graph-definition.d.ts +5 -1
  183. package/lib/workflows/dist/graph-definition.d.ts.map +1 -1
  184. package/lib/workflows/dist/graph-definition.js +8 -4
  185. package/lib/workflows/dist/graph-definition.js.map +1 -1
  186. package/lib/workflows/dist/lifecycle-definition.d.ts +5 -1
  187. package/lib/workflows/dist/lifecycle-definition.d.ts.map +1 -1
  188. package/lib/workflows/dist/lifecycle-definition.js +5 -2
  189. package/lib/workflows/dist/lifecycle-definition.js.map +1 -1
  190. package/lib/workflows/dist/lifecycle-runtime.d.ts.map +1 -1
  191. package/lib/workflows/dist/lifecycle-runtime.js +4 -5
  192. package/lib/workflows/dist/lifecycle-runtime.js.map +1 -1
  193. package/lib/workflows/dist/node-batches.d.ts +9 -0
  194. package/lib/workflows/dist/node-batches.d.ts.map +1 -0
  195. package/lib/workflows/dist/node-batches.js +19 -0
  196. package/lib/workflows/dist/node-batches.js.map +1 -0
  197. package/lib/workflows/dist/operator-transports.d.ts +1 -0
  198. package/lib/workflows/dist/operator-transports.d.ts.map +1 -1
  199. package/lib/workflows/dist/operator-transports.js +1 -0
  200. package/lib/workflows/dist/operator-transports.js.map +1 -1
  201. package/lib/workflows/dist/runtime.d.ts.map +1 -1
  202. package/lib/workflows/dist/runtime.js +6 -7
  203. package/lib/workflows/dist/runtime.js.map +1 -1
  204. package/lib/workflows/dist/scheduled-helpers.d.ts.map +1 -1
  205. package/lib/workflows/dist/scheduled-helpers.js +3 -2
  206. package/lib/workflows/dist/scheduled-helpers.js.map +1 -1
  207. package/lib/workflows/dist/scheduled.d.ts.map +1 -1
  208. package/lib/workflows/dist/scheduled.js +2 -1
  209. package/lib/workflows/dist/scheduled.js.map +1 -1
  210. package/lib/workflows/package.json +1 -1
  211. package/lib/workflows/src/children-definition.ts +10 -3
  212. package/lib/workflows/src/children-runtime.ts +3 -2
  213. package/lib/workflows/src/definition.ts +9 -2
  214. package/lib/workflows/src/graph-definition.ts +10 -3
  215. package/lib/workflows/src/lifecycle-definition.ts +10 -3
  216. package/lib/workflows/src/lifecycle-runtime.ts +4 -4
  217. package/lib/workflows/src/node-batches.ts +21 -0
  218. package/lib/workflows/src/operator-transports.ts +3 -1
  219. package/lib/workflows/src/runtime.ts +6 -6
  220. package/lib/workflows/src/scheduled-helpers.ts +3 -2
  221. package/lib/workflows/src/scheduled.ts +2 -1
  222. package/lib/workstream/package.json +1 -1
  223. package/llms-full.txt +116 -28
  224. package/llms.txt +1 -0
  225. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { workflowNodeLimit } from '@mayura/core';
1
2
  import { assertSchema, freezeJson, jsonValue, MayuraError, type InferInput, type InferOutput, type JsonObject, type JsonValue, type Schema } from '@mayura/core';
2
3
  import { assertTool, type AnyTool } from '@mayura/tools';
3
4
  import { workflowHashMaterial } from '@mayura/storage-contracts';
@@ -11,10 +12,14 @@ export type WorkflowNode =
11
12
  | { readonly kind: 'tool'; readonly id: string; readonly tool: AnyTool; readonly input: Binding; readonly dependsOn?: readonly string[]; readonly approval?: boolean }
12
13
  | { readonly kind: 'join'; readonly id: string; readonly dependsOn: readonly string[] };
13
14
  export interface WorkflowOptions<I extends Schema, O extends Schema> {
15
+ /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
16
+ readonly maxNodes?: number | false;
14
17
  readonly id: string; readonly version: string; readonly input: I; readonly output: O;
15
18
  readonly nodes: readonly WorkflowNode[]; readonly result: Binding;
16
19
  }
17
20
  export interface WorkflowDefinition<I extends Schema = Schema, O extends Schema = Schema> {
21
+ /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
22
+ readonly maxNodes?: number | false;
18
23
  readonly id: string; readonly version: string; readonly digest: string;
19
24
  readonly input: Schema<InferInput<I>, InferOutput<I>>;
20
25
  readonly output: Schema<InferInput<O>, InferOutput<O>>;
@@ -52,7 +57,9 @@ function checkedBinding(binding: Binding, ids: Set<string>): Binding {
52
57
  export function defineWorkflow<I extends Schema, O extends Schema>(options: WorkflowOptions<I, O>): WorkflowDefinition<I, O> {
53
58
  if (!options || !identifier.test(options.id) || typeof options.version !== 'string' || !options.version.length || options.version.length > 128) throw new MayuraError('INVALID_CONFIG', 'Workflow id/version must be bounded identifiers.');
54
59
  assertSchema(options.input); assertSchema(options.output);
55
- if (!Array.isArray(options.nodes) || options.nodes.length === 0 || options.nodes.length > 128) throw new MayuraError('INVALID_CONFIG', 'A workflow requires 1–128 nodes.');
60
+ if (!Array.isArray(options.nodes) || options.nodes.length === 0 || options.nodes.length > workflowNodeLimit(options.maxNodes)) throw new MayuraError('INVALID_CONFIG', 'A workflow requires nodes within its configured maxNodes bound.');
61
+ workflowNodeLimit(options.maxNodes);
62
+ const nodeLimit = options.maxNodes === undefined ? {} : { maxNodes: options.maxNodes };
56
63
  const ids = new Set(options.nodes.map(node => node.id));
57
64
  if (ids.size !== options.nodes.length || [...ids].some(id => !identifier.test(id) || ['constructor', 'prototype', '__proto__'].includes(id))) throw new MayuraError('INVALID_CONFIG', 'Step identifiers must be unique and bounded.');
58
65
  const nodes = options.nodes.map(node => {
@@ -86,7 +93,7 @@ export function defineWorkflow<I extends Schema, O extends Schema>(options: Work
86
93
  const standard = schema['~standard'];
87
94
  return Object.freeze({ '~standard': Object.freeze({ version: 1 as const, vendor: standard.vendor, validate: standard.validate.bind(standard) }) }) as Schema<InferInput<S>, InferOutput<S>>;
88
95
  };
89
- const definition = Object.freeze({ id: options.id, version: options.version, digest: digest('mayura:workflow:v1', { id: options.id, version: options.version, graph, result }), input: snapshot(options.input), output: snapshot(options.output), nodes: Object.freeze(nodes), result });
96
+ const definition = Object.freeze({ ...nodeLimit, id: options.id, version: options.version, digest: digest('mayura:workflow:v1', { id: options.id, version: options.version, ...nodeLimit, graph, result }), input: snapshot(options.input), output: snapshot(options.output), nodes: Object.freeze(nodes), result });
90
97
  definitions.add(definition);
91
98
  return definition;
92
99
  }
@@ -1,3 +1,4 @@
1
+ import { workflowNodeLimit } from '@mayura/core';
1
2
  import { assertSchema, MayuraError, type InferInput, type InferOutput, type Schema } from '@mayura/core';
2
3
  import { assertTool, type AnyTool } from '@mayura/tools';
3
4
  import { workflowGraphManifest, type WorkflowGraphManifest, type WorkflowGraphTargetBinding } from '@mayura/storage-contracts';
@@ -10,11 +11,15 @@ export type WorkflowGraphNode = WorkflowNode | {
10
11
  readonly targets: WorkflowGraphTargetBinding;
11
12
  };
12
13
  export interface WorkflowGraphOptions<I extends Schema, O extends Schema> {
14
+ /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
15
+ readonly maxNodes?: number | false;
13
16
  readonly id: string; readonly version: string; readonly input: I; readonly output: O;
14
17
  readonly nodes: readonly WorkflowGraphNode[]; readonly result: Binding;
15
18
  }
16
19
  declare const graphDefinitionBrand: unique symbol;
17
20
  export interface WorkflowGraphDefinition<I extends Schema = Schema, O extends Schema = Schema> {
21
+ /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
22
+ readonly maxNodes?: number | false;
18
23
  readonly [graphDefinitionBrand]: true;
19
24
  readonly format: 3; readonly id: string; readonly version: string; readonly digest: string;
20
25
  readonly input: Schema<InferInput<I>, InferOutput<I>>;
@@ -31,9 +36,10 @@ export function assertWorkflowGraph(definition: AnyWorkflowGraph): void {
31
36
  }
32
37
 
33
38
  /** Build the exact versioned, data-only material admitted by the storage contract. */
34
- export function graphManifest(definition: Pick<AnyWorkflowGraph, 'id' | 'version' | 'nodes' | 'result'>): WorkflowGraphManifest {
39
+ export function graphManifest(definition: Pick<AnyWorkflowGraph, 'id' | 'version' | 'nodes' | 'result' | 'maxNodes'>): WorkflowGraphManifest {
35
40
  try {
36
41
  return workflowGraphManifest({ format: 3, id: definition.id, version: definition.version,
42
+ ...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }),
37
43
  graph: definition.nodes.map(node => node.kind === 'tool'
38
44
  ? { id: node.id, kind: node.kind, dependsOn: node.dependsOn ?? [], tool: node.tool.id,
39
45
  toolVersion: node.tool.version, effects: node.tool.effects, capabilities: node.tool.capabilities,
@@ -47,7 +53,7 @@ export function graphManifest(definition: Pick<AnyWorkflowGraph, 'id' | 'version
47
53
 
48
54
  /** Define a finite format-3 graph; existing format-2 factories retain their exact contract. */
49
55
  export function defineWorkflowGraph<I extends Schema, O extends Schema>(options: WorkflowGraphOptions<I, O>): WorkflowGraphDefinition<I, O> {
50
- if (!options || !Array.isArray(options.nodes) || options.nodes.length < 1 || options.nodes.length > 128) throw new MayuraError('INVALID_CONFIG', 'A workflow graph requires 1–128 nodes.');
56
+ if (!options || !Array.isArray(options.nodes) || options.nodes.length < 1 || options.nodes.length > workflowNodeLimit(options.maxNodes)) throw new MayuraError('INVALID_CONFIG', 'A workflow graph requires nodes within its configured maxNodes bound.');
51
57
  assertSchema(options.input); assertSchema(options.output);
52
58
  const tools = new Map<string, AnyTool>();
53
59
  for (const node of options.nodes) {
@@ -63,7 +69,8 @@ export function defineWorkflowGraph<I extends Schema, O extends Schema>(options:
63
69
  const standard = schema['~standard'];
64
70
  return Object.freeze({ '~standard': Object.freeze({ version: 1 as const, vendor: standard.vendor, validate: standard.validate.bind(standard) }) }) as Schema<InferInput<S>, InferOutput<S>>;
65
71
  };
66
- const definition = Object.freeze({ format: 3 as const, id: manifest.id, version: manifest.version,
72
+ const definition = Object.freeze({
73
+ ...(manifest.maxNodes === undefined ? {} : { maxNodes: manifest.maxNodes }), format: 3 as const, id: manifest.id, version: manifest.version,
67
74
  digest: digest('mayura:workflow:v2', manifest), input: snapshot(options.input), output: snapshot(options.output), nodes,
68
75
  result: manifest.result }) as WorkflowGraphDefinition<I, O>;
69
76
  definitions.add(definition); return definition;
@@ -1,3 +1,4 @@
1
+ import { workflowNodeLimit } from '@mayura/core';
1
2
  import { assertSchema, MayuraError, type InferInput, type InferOutput, type Schema } from '@mayura/core';
2
3
  import { schemaDigest, workflowLifecycleManifest, type WorkflowLifecycleHumanKind, type WorkflowLifecycleManifest } from '@mayura/storage-contracts';
3
4
  import { assertTool, type AnyTool } from '@mayura/tools';
@@ -61,6 +62,8 @@ export type WorkflowLifecycleNode = (WorkflowNode & { readonly when?: Binding })
61
62
  | WorkflowLifecycleSignalNode;
62
63
 
63
64
  export interface WorkflowLifecycleOptions<I extends Schema, O extends Schema> {
65
+ /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
66
+ readonly maxNodes?: number | false;
64
67
  readonly id: string;
65
68
  readonly version: string;
66
69
  readonly input: I;
@@ -71,6 +74,8 @@ export interface WorkflowLifecycleOptions<I extends Schema, O extends Schema> {
71
74
 
72
75
  declare const lifecycleDefinitionBrand: unique symbol;
73
76
  export interface WorkflowLifecycleDefinition<I extends Schema = Schema, O extends Schema = Schema> {
77
+ /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
78
+ readonly maxNodes?: number | false;
74
79
  readonly [lifecycleDefinitionBrand]: true;
75
80
  readonly format: 5;
76
81
  readonly id: string;
@@ -111,12 +116,13 @@ function derivedDigest(node: WorkflowLifecycleHumanNode): string {
111
116
 
112
117
  /** Build the strict data-only format-5 material; response and payload validators are never persisted. */
113
118
  export function lifecycleManifest(
114
- definition: Pick<AnyWorkflowLifecycle, 'id' | 'version' | 'nodes' | 'result'>,
119
+ definition: Pick<AnyWorkflowLifecycle, 'id' | 'version' | 'nodes' | 'result' | 'maxNodes'>,
115
120
  ): WorkflowLifecycleManifest {
116
121
  try {
117
122
  return workflowLifecycleManifest({
118
123
  format: 5,
119
124
  id: definition.id,
125
+ ...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }),
120
126
  version: definition.version,
121
127
  graph: definition.nodes.map(node => {
122
128
  // Present only when declared, so a definition without conditions keeps its digest.
@@ -150,8 +156,8 @@ export function lifecycleManifest(
150
156
  export function defineWorkflowLifecycle<I extends Schema, O extends Schema>(
151
157
  options: WorkflowLifecycleOptions<I, O>,
152
158
  ): WorkflowLifecycleDefinition<I, O> {
153
- if (!options || !Array.isArray(options.nodes) || options.nodes.length < 1 || options.nodes.length > 128) {
154
- throw new MayuraError('INVALID_CONFIG', 'A workflow lifecycle requires 1–128 nodes.');
159
+ if (!options || !Array.isArray(options.nodes) || options.nodes.length < 1 || options.nodes.length > workflowNodeLimit(options.maxNodes)) {
160
+ throw new MayuraError('INVALID_CONFIG', 'A workflow lifecycle requires nodes within its configured maxNodes bound.');
155
161
  }
156
162
  assertSchema(options.input); assertSchema(options.output);
157
163
  const tools = new Map<string, Extract<WorkflowLifecycleNode, { readonly kind: 'tool' }>['tool']>();
@@ -189,6 +195,7 @@ export function defineWorkflowLifecycle<I extends Schema, O extends Schema>(
189
195
  });
190
196
  })) as readonly WorkflowLifecycleNode[];
191
197
  const definition = Object.freeze({
198
+ ...(manifest.maxNodes === undefined ? {} : { maxNodes: manifest.maxNodes }),
192
199
  format: 5 as const,
193
200
  id: manifest.id,
194
201
  version: manifest.version,
@@ -1,4 +1,6 @@
1
1
  import { workflowAuthorization } from './authorization.js';
2
+ import { workflowNodeLimit } from '@mayura/core';
3
+ import { advanceWorkflowNodes } from './node-batches.js';
2
4
  import type { Authorizer } from '@mayura/core';
3
5
  import { Budget, MayuraError, assertPositiveInteger, freezeJson, jsonValue, validate,
4
6
  type ExecutionReceipt, type JsonObject, type JsonValue, type Permissions, type Scope } from '@mayura/core';
@@ -751,9 +753,7 @@ export function createWorkflowLifecycleRuntime(options: WorkflowLifecycleRuntime
751
753
  // Each wave holds one drain admission until its effects and receipts settle.
752
754
  const release = gate.enter(); if (!release) return checkedSnapshot(before);
753
755
  try {
754
- const results = await Promise.allSettled(definition.nodes.map(node => executeNode(id, definition, node)));
755
- const failure = results.find(result => result.status === 'rejected');
756
- if (failure?.status === 'rejected') throw failure.reason;
756
+ await advanceWorkflowNodes(definition.nodes.filter(node => !terminalStepStatuses.has(state.steps[node.id]!.status)), node => executeNode(id, definition, node));
757
757
  } finally { release(); }
758
758
  let after = await load(id); const next = stateFrom(after); const run = verifyDefinition(definition, after, next);
759
759
  const steps = Object.values(next.steps);
@@ -885,7 +885,7 @@ export function createWorkflowLifecycleRuntime(options: WorkflowLifecycleRuntime
885
885
  steps[entry.target] = entry.action === 'keep' || entry.action === 'accept'
886
886
  || (entry.action === 'update' && source?.kind === 'signal' && fresh.steps[entry.target]!.kind === 'signal') ? source! : fresh.steps[entry.target]!;
887
887
  }
888
- const next: State = { ...state, definition: migration.to.digest, policy, maxCostMicros,
888
+ const next: State = { ...state, maxNodes: migration.to.maxNodes === false ? false : workflowNodeLimit(migration.to.maxNodes), definition: migration.to.digest, policy, maxCostMicros,
889
889
  steps: Object.fromEntries(migration.to.nodes.map(node => [node.id, steps[node.id]!])) };
890
890
  // Released holds: only carried tool steps keep reserved cost.
891
891
  next.reservedMicros = Object.values(next.steps).reduce((sum, step) => sum + (step.kind === 'tool' ? step.costReserved : 0), 0);
@@ -0,0 +1,21 @@
1
+ import { DEFAULT_WORKFLOW_MAX_NODES } from '@mayura/core';
2
+
3
+ /**
4
+ * A larger graph does not grant more concurrent storage requests. Retain the legacy
5
+ * wave width for existing graphs; wider graphs use small batches to bound CAS
6
+ * contention as well as queue occupancy. Settle each batch before advancing.
7
+ */
8
+ export async function advanceWorkflowNodes<T extends { readonly kind: string }>(
9
+ nodes: readonly T[],
10
+ execute: (node: T) => Promise<void>,
11
+ ): Promise<void> {
12
+ const large = nodes.length > DEFAULT_WORKFLOW_MAX_NODES;
13
+ for (let offset = 0; offset < nodes.length;) {
14
+ // Join transitions contend on the same aggregate; concurrent CAS adds work without parallel effects.
15
+ const width = large ? (nodes[offset]!.kind === 'join' ? 1 : 8) : DEFAULT_WORKFLOW_MAX_NODES;
16
+ const results = await Promise.allSettled(nodes.slice(offset, offset + width).map(execute));
17
+ const failure = results.find((result) => result.status === 'rejected');
18
+ if (failure?.status === 'rejected') throw failure.reason;
19
+ offset += width;
20
+ }
21
+ }
@@ -118,6 +118,7 @@ export type WorkflowOperatorStatus = 'running' | 'waiting' | 'paused' | 'succeed
118
118
  export type WorkflowOperatorNodeKind = 'tool' | 'join' | 'wait' | 'child' | 'human' | 'timer' | 'signal';
119
119
  export type WorkflowOperatorStepStatus = 'pending' | 'waiting' | 'approved' | 'dispatching' | 'succeeded' | 'failed' | 'blocked' | 'unknown' | 'skipped' | 'timed_out';
120
120
  export interface WorkflowOperatorView {
121
+ readonly maxNodes?: number | false;
121
122
  readonly format: 3 | 4 | 5; readonly definitionId: string; readonly definitionVersion: string; readonly runId: string; readonly revision: number;
122
123
  readonly status: WorkflowOperatorStatus;
123
124
  readonly nodes: readonly { readonly id: string; readonly kind: WorkflowOperatorNodeKind; readonly dependsOn: readonly string[] }[];
@@ -162,7 +163,7 @@ export interface WorkflowOperatorTarget {
162
163
  }
163
164
  /** A signal as the operator API delivers it: the verified operator is its sender. */
164
165
  export interface WorkflowOperatorSignal { readonly signalName: string; readonly signalId: string; readonly value: JsonValue; readonly actorId: string }
165
- interface Registered { readonly id: string; readonly version: string; readonly digest: string; readonly nodes: readonly { readonly id: string; readonly kind: string; readonly dependsOn?: readonly string[] }[] }
166
+ interface Registered { readonly maxNodes?: number | false; readonly id: string; readonly version: string; readonly digest: string; readonly nodes: readonly { readonly id: string; readonly kind: string; readonly dependsOn?: readonly string[] }[] }
166
167
  /** Maps the authenticated operator to the credential the runtime's `verifyHuman` accepts; without it approvals are unavailable. */
167
168
  export type WorkflowApprovalCredential = (actorId: string) => unknown;
168
169
 
@@ -174,6 +175,7 @@ type Subjects = ReadonlyMap<string, NonNullable<WorkflowOperatorApproval['subjec
174
175
  const project = (format: 3 | 4 | 5, definition: Registered, snapshot: { readonly id: string; readonly version: number; readonly status: string;
175
176
  readonly steps: Readonly<Record<string, { readonly status: string; readonly child?: { readonly runId: string } | null;
176
177
  readonly approval?: unknown }>> }, subjects: Subjects = new Map()): WorkflowOperatorView => Object.freeze({
178
+ ...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }),
177
179
  format, definitionId: definition.id, definitionVersion: definition.version, runId: snapshot.id, revision: snapshot.version, status: snapshot.status as WorkflowOperatorStatus,
178
180
  nodes: definition.nodes.map(node => ({ id: node.id, kind: node.kind as WorkflowOperatorNodeKind, dependsOn: [...(node.dependsOn ?? [])] })),
179
181
  steps: definition.nodes.map(node => { const step = snapshot.steps[node.id]!;
@@ -1,4 +1,6 @@
1
1
  import { workflowAuthorization } from './authorization.js';
2
+ import { advanceWorkflowNodes } from './node-batches.js';
3
+ import { workflowNodeLimit } from '@mayura/core';
2
4
  import type { Authorizer } from '@mayura/core';
3
5
  import { Budget, MayuraError, assertPositiveInteger, freezeJson, jsonValue, validate, type ExecutionReceipt, type JsonObject, type JsonValue, type Permissions, type Scope } from '@mayura/core';
4
6
  import { invokeTool } from '@mayura/tools';
@@ -67,7 +69,7 @@ function outputs(state: State): Record<string, JsonValue> {
67
69
  catch { throw new MayuraError('CONFLICT', 'Stored workflow output failed integrity validation.'); }
68
70
  }
69
71
  function initialState(definition: AnyWorkflow, input: JsonValue, policy: string, maxCostMicros: number): State {
70
- return { format: 2, definition: definition.digest, policy, input, status: 'running', maxCostMicros, spentMicros: 0, reservedMicros: 0, output: null,
72
+ return { format: 2, ...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }), definition: definition.digest, policy, input, status: 'running', maxCostMicros, spentMicros: 0, reservedMicros: 0, output: null,
71
73
  steps: Object.fromEntries(definition.nodes.map(node => [node.id, { kind: node.kind, status: 'pending', callId: `step:${node.id}`, output: null, receipt: null, approval: null, costReserved: 0, candidateHash: null }])) };
72
74
  }
73
75
 
@@ -257,7 +259,7 @@ export function createWorkflowRuntime(options: WorkflowRuntimeOptions) {
257
259
  await auth.execute(definition.digest, id);
258
260
  const before = await load(id); const state = stateFrom(before);
259
261
  if (state.definition !== definition.digest || before.definitionHash !== definition.digest || state.policy !== policy || state.maxCostMicros !== maxCostMicros) throw new MayuraError('CONFLICT', 'Definition or policy changed; explicit migration/review is required.');
260
- if (Object.keys(state.steps).length !== definition.nodes.length || definition.nodes.some(node => !Object.hasOwn(state.steps, node.id))) throw new MayuraError('CONFLICT', 'Stored steps do not match the pinned definition.');
262
+ if (workflowNodeLimit(state.maxNodes) !== workflowNodeLimit(definition.maxNodes) || Object.keys(state.steps).length !== definition.nodes.length || definition.nodes.some(node => !Object.hasOwn(state.steps, node.id))) throw new MayuraError('CONFLICT', 'Stored steps do not match the pinned definition.');
261
263
  for (const node of definition.nodes) {
262
264
  const step = state.steps[node.id]!;
263
265
  if (step.kind !== node.kind || (node.kind === 'tool' && step.receipt && step.receipt.toolId !== node.tool.id) || (step.status === 'succeeded' && (node.dependsOn ?? []).some(dependency => state.steps[dependency]?.status !== 'succeeded'))) throw new MayuraError('CONFLICT', 'Stored step evidence does not match the pinned graph.');
@@ -266,9 +268,7 @@ export function createWorkflowRuntime(options: WorkflowRuntimeOptions) {
266
268
  // Each wave holds one drain admission until its effects and receipts settle.
267
269
  const release = gate.enter(); if (!release) return checkedSnapshot(before);
268
270
  try {
269
- const results = await Promise.allSettled(definition.nodes.map(node => executeNode(id, node)));
270
- const failure = results.find(result => result.status === 'rejected');
271
- if (failure?.status === 'rejected') throw failure.reason;
271
+ await advanceWorkflowNodes(definition.nodes.filter(node => !terminalSteps.has(state.steps[node.id]!.status)), node => executeNode(id, node));
272
272
  } finally { release(); }
273
273
  let after = await load(id); const next = stateFrom(after); const steps = Object.values(next.steps);
274
274
  if (next.status === 'paused' || next.status === 'cancelled') return checkedSnapshot(after);
@@ -347,7 +347,7 @@ export function createWorkflowRuntime(options: WorkflowRuntimeOptions) {
347
347
  const fresh = initialState(migration.to, state.input, policy, maxCostMicros);
348
348
  const carried: Record<string, Step> = {};
349
349
  for (const entry of plan.entries) if (entry.target) carried[entry.target] = entry.action === 'keep' || entry.action === 'accept' ? state.steps[entry.source!]! : fresh.steps[entry.target]!;
350
- const next: State = { ...state, definition: migration.to.digest, steps: Object.fromEntries(migration.to.nodes.map(node => [node.id, carried[node.id]!])) };
350
+ const next: State = { ...state, maxNodes: migration.to.maxNodes === false ? false : workflowNodeLimit(migration.to.maxNodes), definition: migration.to.digest, steps: Object.fromEntries(migration.to.nodes.map(node => [node.id, carried[node.id]!])) };
351
351
  next.reservedMicros = Object.values(next.steps).reduce((sum, step) => sum + step.costReserved, 0);
352
352
  try { assertWorkflowStateMatchesManifest(workflowState({ id, state: jsonValue(next) as JsonObject }), scheduledManifest(migration.to)); }
353
353
  catch { throw new MayuraError('CONFLICT', 'Migration refused: the migrated state does not satisfy the new definition.'); }
@@ -1,3 +1,4 @@
1
+ import { workflowNodeLimit } from '@mayura/core';
1
2
  import { freezeJson, jsonValue, MayuraError, type JsonValue } from '@mayura/core';
2
3
  import {
3
4
  StorageError, workflowManifest, workflowState, workflowGraphState,
@@ -72,7 +73,7 @@ export async function scheduledCallback<T>(operation: () => T | PromiseLike<T>,
72
73
 
73
74
  /** Construct the original data-only definition material without changing its version hash. */
74
75
  export function scheduledManifest(definition: AnyWorkflow): WorkflowManifest {
75
- return workflowManifest({ id: definition.id, version: definition.version,
76
+ return workflowManifest({ id: definition.id, version: definition.version, ...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }),
76
77
  graph: definition.nodes.map(node => node.kind === 'join'
77
78
  ? { id: node.id, kind: node.kind, dependsOn: node.dependsOn }
78
79
  : { id: node.id, kind: node.kind, dependsOn: node.dependsOn ?? [], tool: node.tool.id,
@@ -111,7 +112,7 @@ function checkOwnedView(view: ScheduledStoredSnapshot, scope: string, id: string
111
112
  // checks and decoding need happen only once for this exact owned snapshot.
112
113
  if (ownedViews.has(view)) return view;
113
114
  if (!Array.isArray(view.jobs)
114
- || view.jobs.length > 128 || !Number.isSafeInteger(view.record.version) || view.record.version < 1
115
+ || view.jobs.length > workflowNodeLimit(view.record.state['maxNodes']) || !Number.isSafeInteger(view.record.version) || view.record.version < 1
115
116
  || !/^[a-f0-9]{64}$/.test(view.manifestHash) || !/^[a-f0-9]{64}$/.test(view.resourceHash)
116
117
  || view.record.definitionHash !== view.manifestHash) throw new Error();
117
118
  const state = scheduledState(view.record, profile);
@@ -1,4 +1,5 @@
1
1
  import { workflowAuthorization } from './authorization.js';
2
+ import { workflowNodeLimit } from '@mayura/core';
2
3
  import { Budget, MayuraError, assertPositiveInteger, freezeJson, jsonValue, validate, type ExecutionReceipt, type ExecutionSettlement, type JsonObject, type JsonValue, type Schema, type InferInput, type Scope } from '@mayura/core';
3
4
  import { invokeTool } from '@mayura/tools';
4
5
  import { bindToolApproval } from '@mayura/tools/host';
@@ -696,7 +697,7 @@ export function createScheduledDriver(options: ScheduledWorkflowRuntimeOptions |
696
697
  carried[entry.target] = entry.action === 'keep' || entry.action === 'accept' ? state.steps[entry.source!] : fresh.steps[entry.target];
697
698
  }
698
699
  const steps = Object.fromEntries((to.manifest as WorkflowManifest | WorkflowGraphManifest).graph.map(node => [node.id, carried[node.id]]));
699
- const next = { ...state, definition: migration.to.digest, steps,
700
+ const next = { ...state, maxNodes: migration.to.maxNodes === false ? false : workflowNodeLimit(migration.to.maxNodes), definition: migration.to.digest, steps,
700
701
  reservedMicros: Object.values(steps).reduce<number>((sum, step) => sum + (step as { costReserved: number }).costReserved, 0) };
701
702
  // One attempt at the planned version: a concurrent change needs a fresh review, and a storage refusal keeps its reason.
702
703
  let result: ScheduledStoredSnapshot;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "private": true
5
5
  }
package/llms-full.txt CHANGED
@@ -396,13 +396,9 @@ Source: docs/guides/release-readiness.md
396
396
 
397
397
  Completed local and CI qualification, experimental surfaces and the checks still required before releasing Mayura V1.2.
398
398
 
399
- Stable V1.2 is prepared for review and is not yet published. The implementation and full-release safeguards are
400
- merged into `main`, whose full qualification passed on **2026-10-23** at
401
- `a9b5c565167170e4b35b5f42cf7df58a64b485e8`. The coordinated **1.2.0** version PR needs its own qualification and
402
- green main checks after merging. The reviewed 22-package set was previously published as
403
- **1.2.0-rc.1 under `next`**, through trusted publishing, with all existing `latest` tags unchanged. The local and
404
- earlier release-branch snapshots below remain historical evidence; none establishes interoperability with
405
- unqualified real external services.
399
+ **1.2.0 was published** for all 106 packages through trusted publishing. The [V1.2.1 release candidate](#release-preparation)
400
+ adds configurable workflow graph limits and marks the [Modal + Pinecone Loki v28 RAG profile](rag-production.md#qualified-production-profile)
401
+ stable for its tested scope. Other RAG profiles remain experimental. The earlier snapshots below record the 1.2.0 qualification.
406
402
 
407
403
  ## Completed CI qualification
408
404
 
@@ -497,7 +493,7 @@ concurrent builds and unit-suite load. The subsequent complete CI pass is record
497
493
  - **Authorization:** OpenFGA, Cedar, Permit.io and Oso passed offline tests and package checks. Real provider/native
498
494
  engine interoperability, deployed policies and revision consistency remain host responsibilities and unqualified
499
495
  here. Amazon Verified Permissions is outside the implemented Cedar adapter.
500
- - **RAG:** the [experimental RAG surface](rag.md) passed offline tests, including fake vector transports/SQL executors
496
+ - **RAG:** the [RAG surface](rag.md) as shipped in 1.2.0 passed offline tests, including fake vector transports/SQL executors
501
497
  and local SQLite native-memory checks. This does not establish real vector/reranker service compatibility, SQL
502
498
  query plans, deployment limits or read-after-write visibility on eventually consistent services.
503
499
  - **AG-UI:** the [experimental bounded profile](ag-ui.md) passed adapter and native server tests. The opt-in reference
@@ -515,20 +511,10 @@ sufficient evidence for that claim.
515
511
 
516
512
  ## Release preparation
517
513
 
518
- 1. Full-release publisher/recovery changes are merged and qualified on main; review these updated release records.
519
- 2. Review the prepared coordinated **1.2.0** version/changelog PR, committed without `[skip ci]`, merge through normal branch
520
- protection and require the pushed main commit's complete qualification to pass. The publisher does not write main.
521
- 3. Verify trusted publishing for all 106 packages, the protected `release` environment, tag creation permission and
522
- publishing enablement. Preserve the experimental labels and limitations above.
523
- 4. Rehearse **1.2.0** with `package_set=all` and `dry_run=true`, regenerating archives, checksums, SBOM and notes from
524
- the final source. Dry runs do not validate unexercised package trust.
525
- 5. Approve publication from that qualified main commit with `dry_run=false`. Verify all 106 versions, `latest` tags,
526
- provenance and the source-bound tag/GitHub Release. Recover partial publication from the original run's saved
527
- archives and receipt, without replaying accepted or uncertain uploads.
528
-
529
- This version PR sets source manifests and version references to **1.2.0** and prepares the changelog. It does not
530
- publish to npm, change distribution tags, create `v1.2.0` or create a stable GitHub Release. Stable publication and
531
- deployment remain outstanding; RC1 availability is not evidence of live-service or rendered browser qualification.
514
+ V1.2.1 is prepared as a coordinated patch release for `mayura` and all 105 extensions. Before publication,
515
+ require the PR and its resulting main commit to pass the full Qualification gate. Then rehearse the same main
516
+ commit with `package_set=all`, `version=1.2.1` and `dry_run=true`. Review the archives, checksums, SBOM and release
517
+ notes before approving the protected trusted-publishing job. Publish to `latest` while preserving existing `next` tags.
532
518
 
533
519
  ---
534
520
 
@@ -2000,10 +1986,69 @@ The pieces:
2000
1986
  are done run together.
2001
1987
  - **`result`** is a binding that picks the workflow's output, checked against the `output` schema.
2002
1988
 
2003
- The graph is fixed when you define it: at most 128 nodes, no cycles, and no code runs between steps. Logic lives in the
1989
+ The graph is fixed when you define it: 128 nodes by default, no cycles, and no code runs between steps. Logic lives in the
2004
1990
  tools. For work whose width depends on data, a durable workflow can declare up to a fixed number of parallel slots
2005
1991
  (`fanOut`) and skip steps with a condition (`when`). See [Durable workflows](../guides/durable-workflows.md).
2006
1992
 
1993
+ ## Configuring graph size
1994
+
1995
+ Starting in V1.2.1, `defineWorkflow`, `defineWorkflowLifecycle`, `defineWorkflowGraph` and `defineWorkflowTree` accept
1996
+ an optional `maxNodes`: `false` or an integer from 1 through 512. Omission retains the 128-node admission limit. Set the bound
1997
+ explicitly when defining a larger graph; it does not automatically increase to match the supplied nodes.
1998
+
1999
+ ```ts
2000
+ import { z } from 'mayura';
2001
+ import { defineWorkflowLifecycle } from 'mayura/workflows/lifecycle';
2002
+
2003
+ const workflow = defineWorkflowLifecycle({
2004
+ id: 'wide-review', version: '1', input: z.null(), output: z.null(), maxNodes: 256,
2005
+ nodes: Array.from({ length: 256 }, (_, index) => ({
2006
+ kind: 'join' as const, id: `step${index}`, dependsOn: [],
2007
+ })),
2008
+ result: { kind: 'input', path: [] },
2009
+ });
2010
+ void workflow;
2011
+ ```
2012
+
2013
+ To disable the per-graph node-count constraint through environment configuration, set
2014
+ `MAYURA_WORKFLOW_DISABLE_MAX_NODES=true` (or `1`) and explicitly wire the host helper into each definition:
2015
+
2016
+ ```ts
2017
+ import { z } from 'mayura';
2018
+ import { workflowNodeLimitsFromEnv } from 'mayura/core/host';
2019
+ import { defineWorkflowLifecycle } from 'mayura/workflows/lifecycle';
2020
+
2021
+ const workflow = defineWorkflowLifecycle({
2022
+ id: 'unbounded-graph', version: '1', input: z.null(), output: z.null(),
2023
+ ...workflowNodeLimitsFromEnv(process.env),
2024
+ nodes: [{ kind: 'join', id: 'ready', dependsOn: [] }],
2025
+ result: { kind: 'input', path: [] },
2026
+ });
2027
+ void workflow;
2028
+ ```
2029
+
2030
+ The helper accepts a host-owned environment map without reading ambient globals. Unset, empty, `false` and `0`
2031
+ return no override; other values are rejected. Its opt-in becomes the JSON-safe `maxNodes: false`, included in
2032
+ the definition identity and stored state. Changing the environment never changes an already-pinned run. Browser
2033
+ and edge hosts may pass their own configuration map, or set `maxNodes: false` explicitly. To override a numeric
2034
+ setting, spread the helper **after** that setting. Roll out matching workers and readers before submitting runs.
2035
+
2036
+ The explicit bound becomes part of the definition digest and persisted state. Restarted workers validate the same
2037
+ bound; changing it for an existing run requires the normal reviewed migration process. Definitions that omit it keep
2038
+ their existing hashes and stored representation. Deploy readers, workers and clients from V1.2.1 together before
2039
+ submitting larger graphs: V1.2.0 readers reject the additional metadata.
2040
+
2041
+ Increasing `maxNodes` does not increase spending, tool calls, output sizes, human/timer/signal counts or concurrency.
2042
+ The server and client graph views allow at most four dependency edges per configured node in total (per actual node
2043
+ when `maxNodes` is `false`); a node may depend
2044
+ on at most `maxNodes - 1` other nodes. Existing JSON byte limits still apply, so a dense graph or large accumulated
2045
+ outputs may reach a byte limit before reaching the node ceiling. Larger in-process and lifecycle graphs execute in
2046
+ small batches to bound storage queues and contention.
2047
+
2048
+ Workflow trees still allow at most 16 children, 256 total nodes across root and children, and 128 tool nodes. A
2049
+ root's `maxNodes` does not raise these tree-wide limits, and each leaf declares its own per-graph bound. Saga step
2050
+ counts, loop iteration counts and graph wait-target limits are separate and retain their existing bounds.
2051
+
2007
2052
  ## In-process or durable
2008
2053
 
2009
2054
  Mayura runs workflows in two ways.
@@ -2181,8 +2226,18 @@ Scoped retrieval tools, durable content-addressed ingestion, vector adapters, ci
2181
2226
 
2182
2227
  `mayura/rag` adds retrieval without giving a model a database connection or letting it choose a principal, project,
2183
2228
  index or filter. Host code loads documents, stages embeddings and publishes a revision. A retrieval tool returns
2184
- only authorized evidence and exact citation identities. This is an experimental 1.2 surface; source, examples and
2185
- regression cases pass local offline validation, including builds, documentation and package checks. Real service qualification remains outstanding; see [release validation status](release-readiness.md).
2229
+ only authorized evidence and exact citation identities. The [qualified Modal + Pinecone Loki v28
2230
+ profile](rag-production.md#qualified-production-profile) is stable within its tested scope. Other RAG profiles
2231
+ remain experimental. See [release validation status](release-readiness.md) for the limits of the available evidence.
2232
+
2233
+ ## Retrieval configuration
2234
+
2235
+ Chunk-level fusion remains the default. Use `fusionLevel: 'document'` to combine ranks by document and
2236
+ return a real passage as the citation witness. Use `distinctDocuments: true` to return at most one
2237
+ passage per document. Parent context still depends on published, authorized evidence.
2238
+
2239
+ The in-memory vector store supports optional BM25, document-level lexical and semantic candidates,
2240
+ and max or mean aggregation of document cosine scores. The default stays chunk-level.
2186
2241
 
2187
2242
  ## Architecture
2188
2243
 
@@ -2357,6 +2412,39 @@ Remote indexes may acknowledge writes before making them searchable. Publication
2357
2412
 
2358
2413
  ---
2359
2414
 
2415
+ # RAG production qualification
2416
+
2417
+ Source: docs/guides/rag-production.md
2418
+
2419
+ Production qualification evidence and deployment boundaries for the Modal and Pinecone Loki v28 profile.
2420
+
2421
+ ## Qualified production profile
2422
+
2423
+ **The Modal + Pinecone profile for Loki v28 is stable for production within its tested scope.**
2424
+ The result covers the registered software-operations workload and its pinned configuration.
2425
+ Other RAG profiles remain experimental. See the [RAG API guide](rag.md) for framework usage.
2426
+
2427
+ | Gate | Verified result |
2428
+ | --- | --- |
2429
+ | Document preparation | Verified embeddings reused from the registered checkpoint |
2430
+ | Semantic quality and latency | All 40 Loki cases passed the source-reviewed release gate. Acquisition and ranking p95 upper bound was 4.725 s against the 5 s limit |
2431
+ | Nomic acquisition load | 120/120 queries on the registered Loki catalog, 417.127 ms acquisition p95 |
2432
+ | Pinecone native load | 600/600 timed queries, 45.095 ms p95, complete original request archive recovered |
2433
+ | Recovery and scope security | Seven production recovery checkpoints passed, maximum 25.428 s. Scope security passed |
2434
+ | Campaign cleanup | Provider evidence covers 14 owned apps and 23 sandboxes. No owned Pinecone indexes remained. The pre-existing Modal app was verified by exact ID |
2435
+
2436
+ The revised cleanup verifier uses retained provider observations for current owners and original
2437
+ shutdown receipts for historical owners. Missing records alone provide no cleanup credit. The
2438
+ original incomplete audit remains in the evidence, including its completed archive verification.
2439
+ The offline release check made no provider calls and reran no queries. The original quality,
2440
+ latency, recovery, security and 600-query gates still apply.
2441
+
2442
+ The release receipt is `compatibility/rag-modal-pinecone-loki-production-v1.json` in the
2443
+ repository. The registered workload does not establish capacity, latency, or semantic quality
2444
+ for other corpora, providers, models, or deployments.
2445
+
2446
+ ---
2447
+
2360
2448
  # Model providers
2361
2449
 
2362
2450
  Source: docs/guides/model-providers.md
@@ -4666,7 +4754,7 @@ earlier steps; `runtime.inspect(run)` lists what executed. Cancelling does not u
4666
4754
  ## Good to know
4667
4755
 
4668
4756
  - A graph with an `approval: true` step is refused. Approvals need a durable workflow.
4669
- - The graph has at most 128 nodes and no cycles. For data-dependent branching, let an agent decide.
4757
+ - The graph has at most 128 nodes by default and no cycles. V1.2.1 adds an explicit `maxNodes` up to 512; see [graph size](../concepts/workflows.md#configuring-graph-size). For data-dependent branching, let an agent decide.
4670
4758
  - The same `defineWorkflow` graph can also run durably through the earlier runtimes in `mayura/workflows`, but new
4671
4759
  durable work should use `defineWorkflowLifecycle`; see [Durable workflows](durable-workflows.md).
4672
4760
 
@@ -5135,7 +5223,7 @@ const runtime = createWorkflowLifecycleFleetRuntime({
5135
5223
  - **Errors.** Every error the runtimes and stores throw is a `MayuraError` with a stable `code`. Reusing an
5136
5224
  idempotency key with other input, another definition version or other runtime settings is `CONFLICT`; resubmit the
5137
5225
  identical request to get the existing run. See [Storage](storage.md#errors).
5138
- - **Limits.** At most 128 steps, 32 human steps, 64 timers and 64 signal steps per definition; prompts up to 1 KiB.
5226
+ - **Limits.** 128 steps by default; V1.2.1 adds an explicit `maxNodes` up to 512 (see [graph size](../concepts/workflows.md#configuring-graph-size)). At most 32 human steps, 64 timers and 64 signal steps per definition; prompts up to 1 KiB.
5139
5227
  - `runUntilSettled` runs steps in the calling process. A plain runtime starts no background timers; waiting runs move
5140
5228
  only when something calls it again.
5141
5229
 
@@ -14085,7 +14173,7 @@ Scoped native vector storage for pinecone.
14085
14173
 
14086
14174
  `@mayurajs/vector-pinecone` implements the [RAG contracts](../guides/rag.md). Install it alongside `mayura`.
14087
14175
  Construction performs no I/O, credential discovery, provisioning or background work. All operations require an
14088
- explicit host permission and a nonnegative `costMicros` ceiling. Offline tests and package checks passed locally. Real service behavior remains unqualified; see [release validation status](../guides/release-readiness.md).
14176
+ explicit host permission and a nonnegative `costMicros` ceiling. Offline tests and package checks passed locally. The [Modal + Pinecone Loki v28 profile](../guides/rag-production.md#qualified-production-profile) is stable for its registered workload and configuration.
14089
14177
 
14090
14178
  `pineconeVectorStore` accepts `endpoint`, `headers`, `collection`, `dimensions`, `costMicros`, `permissions`,
14091
14179
  `timeoutMs`, `maxConcurrent` and optional test `fetch`. Grant `rag:transport:pinecone`. Credentials go in host-owned
package/llms.txt CHANGED
@@ -31,6 +31,7 @@ Rules that matter when writing Mayura code:
31
31
  - [Workflows](docs/concepts/workflows.md): What a Mayura workflow is, when to use one instead of a single agent run, and which workflow entry point to start with.
32
32
  - [Framework starters](docs/guides/framework-starters.md): Generate Next.js, Hono, React Router, TanStack Start, SvelteKit or Nuxt notebooks with scoped threads and in-run approvals.
33
33
  - [Retrieval augmented generation](docs/guides/rag.md): Scoped retrieval tools, durable content-addressed ingestion, vector adapters, citations and bounded reranking.
34
+ - [RAG production qualification](docs/guides/rag-production.md): Production qualification evidence and deployment boundaries for the Modal and Pinecone Loki v28 profile.
34
35
 
35
36
  ## Agents and models
36
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mayura",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A TypeScript framework for agents, typed tools and durable workflows.",
5
5
  "keywords": [
6
6
  "agents",