@ankhorage/flow 0.0.0-stage → 0.5.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.
Files changed (164) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/LICENSE +21 -0
  3. package/README.md +19 -2
  4. package/dist/ai.d.ts +7 -0
  5. package/dist/ai.d.ts.map +1 -0
  6. package/dist/ai.js +7 -0
  7. package/dist/ai.js.map +1 -0
  8. package/dist/execution.d.ts +5 -0
  9. package/dist/execution.d.ts.map +1 -0
  10. package/dist/execution.js +5 -0
  11. package/dist/execution.js.map +1 -0
  12. package/dist/features/execution/adapters/FileFlowPersistenceAdapter.d.ts +4 -0
  13. package/dist/features/execution/adapters/FileFlowPersistenceAdapter.d.ts.map +1 -0
  14. package/dist/features/execution/adapters/FileFlowPersistenceAdapter.js +219 -0
  15. package/dist/features/execution/adapters/FileFlowPersistenceAdapter.js.map +1 -0
  16. package/dist/features/execution/application/cancelDurableRunAsync.d.ts +8 -0
  17. package/dist/features/execution/application/cancelDurableRunAsync.d.ts.map +1 -0
  18. package/dist/features/execution/application/cancelDurableRunAsync.js +22 -0
  19. package/dist/features/execution/application/cancelDurableRunAsync.js.map +1 -0
  20. package/dist/features/execution/application/createDurableRunAsync.d.ts +12 -0
  21. package/dist/features/execution/application/createDurableRunAsync.d.ts.map +1 -0
  22. package/dist/features/execution/application/createDurableRunAsync.js +8 -0
  23. package/dist/features/execution/application/createDurableRunAsync.js.map +1 -0
  24. package/dist/features/execution/application/executeFlowAsync.d.ts +4 -0
  25. package/dist/features/execution/application/executeFlowAsync.d.ts.map +1 -0
  26. package/dist/features/execution/application/executeFlowAsync.js +211 -0
  27. package/dist/features/execution/application/executeFlowAsync.js.map +1 -0
  28. package/dist/features/execution/application/runDurableWorkerAsync.d.ts +52 -0
  29. package/dist/features/execution/application/runDurableWorkerAsync.d.ts.map +1 -0
  30. package/dist/features/execution/application/runDurableWorkerAsync.js +195 -0
  31. package/dist/features/execution/application/runDurableWorkerAsync.js.map +1 -0
  32. package/dist/features/execution/domain/assertFlowGraphSchemasSupported.d.ts +5 -0
  33. package/dist/features/execution/domain/assertFlowGraphSchemasSupported.d.ts.map +1 -0
  34. package/dist/features/execution/domain/assertFlowGraphSchemasSupported.js +11 -0
  35. package/dist/features/execution/domain/assertFlowGraphSchemasSupported.js.map +1 -0
  36. package/dist/features/execution/domain/calculateRetryDueAt.d.ts +4 -0
  37. package/dist/features/execution/domain/calculateRetryDueAt.d.ts.map +1 -0
  38. package/dist/features/execution/domain/calculateRetryDueAt.js +14 -0
  39. package/dist/features/execution/domain/calculateRetryDueAt.js.map +1 -0
  40. package/dist/features/execution/domain/compileFlowGraph.d.ts +5 -0
  41. package/dist/features/execution/domain/compileFlowGraph.d.ts.map +1 -0
  42. package/dist/features/execution/domain/compileFlowGraph.js +76 -0
  43. package/dist/features/execution/domain/compileFlowGraph.js.map +1 -0
  44. package/dist/features/execution/domain/createDefaultNodeRegistry.d.ts +4 -0
  45. package/dist/features/execution/domain/createDefaultNodeRegistry.d.ts.map +1 -0
  46. package/dist/features/execution/domain/createDefaultNodeRegistry.js +15 -0
  47. package/dist/features/execution/domain/createDefaultNodeRegistry.js.map +1 -0
  48. package/dist/features/execution/domain/createDurableRun.d.ts +7 -0
  49. package/dist/features/execution/domain/createDurableRun.d.ts.map +1 -0
  50. package/dist/features/execution/domain/createDurableRun.js +10 -0
  51. package/dist/features/execution/domain/createDurableRun.js.map +1 -0
  52. package/dist/features/execution/domain/createRetryWork.d.ts +4 -0
  53. package/dist/features/execution/domain/createRetryWork.d.ts.map +1 -0
  54. package/dist/features/execution/domain/createRetryWork.js +17 -0
  55. package/dist/features/execution/domain/createRetryWork.js.map +1 -0
  56. package/dist/features/execution/domain/isCronDueAt.d.ts +7 -0
  57. package/dist/features/execution/domain/isCronDueAt.d.ts.map +1 -0
  58. package/dist/features/execution/domain/isCronDueAt.js +114 -0
  59. package/dist/features/execution/domain/isCronDueAt.js.map +1 -0
  60. package/dist/features/execution/domain/validateFlowDataSchema.d.ts +6 -0
  61. package/dist/features/execution/domain/validateFlowDataSchema.d.ts.map +1 -0
  62. package/dist/features/execution/domain/validateFlowDataSchema.js +144 -0
  63. package/dist/features/execution/domain/validateFlowDataSchema.js.map +1 -0
  64. package/dist/features/execution/ports/FlowPersistencePort.d.ts +34 -0
  65. package/dist/features/execution/ports/FlowPersistencePort.d.ts.map +1 -0
  66. package/dist/features/execution/ports/FlowPersistencePort.js +2 -0
  67. package/dist/features/execution/ports/FlowPersistencePort.js.map +1 -0
  68. package/dist/features/mcp/McpToolError.d.ts +6 -0
  69. package/dist/features/mcp/McpToolError.d.ts.map +1 -0
  70. package/dist/features/mcp/McpToolError.js +10 -0
  71. package/dist/features/mcp/McpToolError.js.map +1 -0
  72. package/dist/features/mcp/createMcpRemoteTransport.d.ts +8 -0
  73. package/dist/features/mcp/createMcpRemoteTransport.d.ts.map +1 -0
  74. package/dist/features/mcp/createMcpRemoteTransport.js +23 -0
  75. package/dist/features/mcp/createMcpRemoteTransport.js.map +1 -0
  76. package/dist/features/mcp/createMcpToolRegistry.d.ts +10 -0
  77. package/dist/features/mcp/createMcpToolRegistry.d.ts.map +1 -0
  78. package/dist/features/mcp/createMcpToolRegistry.js +185 -0
  79. package/dist/features/mcp/createMcpToolRegistry.js.map +1 -0
  80. package/dist/features/mcp/loadMcpSdkAsync.d.ts +12 -0
  81. package/dist/features/mcp/loadMcpSdkAsync.d.ts.map +1 -0
  82. package/dist/features/mcp/loadMcpSdkAsync.js +20 -0
  83. package/dist/features/mcp/loadMcpSdkAsync.js.map +1 -0
  84. package/dist/features/mcp/prepareMcpProviders.d.ts +4 -0
  85. package/dist/features/mcp/prepareMcpProviders.d.ts.map +1 -0
  86. package/dist/features/mcp/prepareMcpProviders.js +97 -0
  87. package/dist/features/mcp/prepareMcpProviders.js.map +1 -0
  88. package/dist/features/mcp/validateMcpSchema.d.ts +6 -0
  89. package/dist/features/mcp/validateMcpSchema.d.ts.map +1 -0
  90. package/dist/features/mcp/validateMcpSchema.js +220 -0
  91. package/dist/features/mcp/validateMcpSchema.js.map +1 -0
  92. package/dist/features/security/FlowSecurityError.d.ts +6 -0
  93. package/dist/features/security/FlowSecurityError.d.ts.map +1 -0
  94. package/dist/features/security/FlowSecurityError.js +10 -0
  95. package/dist/features/security/FlowSecurityError.js.map +1 -0
  96. package/dist/features/security/application/createFlowSecurityPort.d.ts +12 -0
  97. package/dist/features/security/application/createFlowSecurityPort.d.ts.map +1 -0
  98. package/dist/features/security/application/createFlowSecurityPort.js +208 -0
  99. package/dist/features/security/application/createFlowSecurityPort.js.map +1 -0
  100. package/dist/features/security/domain/validateFlowSecurityTarget.d.ts +4 -0
  101. package/dist/features/security/domain/validateFlowSecurityTarget.d.ts.map +1 -0
  102. package/dist/features/security/domain/validateFlowSecurityTarget.js +57 -0
  103. package/dist/features/security/domain/validateFlowSecurityTarget.js.map +1 -0
  104. package/dist/index.d.ts +16 -0
  105. package/dist/index.d.ts.map +1 -0
  106. package/dist/index.js +12 -0
  107. package/dist/index.js.map +1 -0
  108. package/dist/mcp.d.ts +4 -0
  109. package/dist/mcp.d.ts.map +1 -0
  110. package/dist/mcp.js +3 -0
  111. package/dist/mcp.js.map +1 -0
  112. package/dist/social.d.ts +7 -0
  113. package/dist/social.d.ts.map +1 -0
  114. package/dist/social.js +7 -0
  115. package/dist/social.js.map +1 -0
  116. package/dist/types/durableExecution.d.ts +55 -0
  117. package/dist/types/durableExecution.d.ts.map +1 -0
  118. package/dist/types/durableExecution.js +2 -0
  119. package/dist/types/durableExecution.js.map +1 -0
  120. package/dist/types/execution.d.ts +33 -0
  121. package/dist/types/execution.d.ts.map +1 -0
  122. package/dist/types/execution.js +2 -0
  123. package/dist/types/execution.js.map +1 -0
  124. package/dist/types/mcp.d.ts +61 -0
  125. package/dist/types/mcp.d.ts.map +1 -0
  126. package/dist/types/mcp.js +2 -0
  127. package/dist/types/mcp.js.map +1 -0
  128. package/dist/types/security.d.ts +123 -0
  129. package/dist/types/security.d.ts.map +1 -0
  130. package/dist/types/security.js +2 -0
  131. package/dist/types/security.js.map +1 -0
  132. package/package.json +90 -4
  133. package/src/ai.ts +6 -0
  134. package/src/execution.ts +9 -0
  135. package/src/features/execution/adapters/FileFlowPersistenceAdapter.ts +333 -0
  136. package/src/features/execution/application/cancelDurableRunAsync.ts +28 -0
  137. package/src/features/execution/application/createDurableRunAsync.ts +14 -0
  138. package/src/features/execution/application/executeFlowAsync.ts +338 -0
  139. package/src/features/execution/application/runDurableWorkerAsync.ts +337 -0
  140. package/src/features/execution/domain/assertFlowGraphSchemasSupported.ts +17 -0
  141. package/src/features/execution/domain/calculateRetryDueAt.ts +21 -0
  142. package/src/features/execution/domain/compileFlowGraph.ts +97 -0
  143. package/src/features/execution/domain/createDefaultNodeRegistry.ts +26 -0
  144. package/src/features/execution/domain/createDurableRun.ts +14 -0
  145. package/src/features/execution/domain/createRetryWork.ts +22 -0
  146. package/src/features/execution/domain/isCronDueAt.ts +131 -0
  147. package/src/features/execution/domain/validateFlowDataSchema.ts +218 -0
  148. package/src/features/execution/ports/FlowPersistencePort.ts +38 -0
  149. package/src/features/mcp/McpToolError.ts +10 -0
  150. package/src/features/mcp/createMcpRemoteTransport.ts +34 -0
  151. package/src/features/mcp/createMcpToolRegistry.ts +324 -0
  152. package/src/features/mcp/loadMcpSdkAsync.ts +32 -0
  153. package/src/features/mcp/prepareMcpProviders.ts +135 -0
  154. package/src/features/mcp/validateMcpSchema.ts +269 -0
  155. package/src/features/security/FlowSecurityError.ts +17 -0
  156. package/src/features/security/application/createFlowSecurityPort.ts +339 -0
  157. package/src/features/security/domain/validateFlowSecurityTarget.ts +73 -0
  158. package/src/index.ts +49 -0
  159. package/src/mcp.ts +11 -0
  160. package/src/social.ts +6 -0
  161. package/src/types/durableExecution.ts +61 -0
  162. package/src/types/execution.ts +41 -0
  163. package/src/types/mcp.ts +70 -0
  164. package/src/types/security.ts +148 -0
@@ -0,0 +1,57 @@
1
+ import { FlowSecurityError } from '../FlowSecurityError.js';
2
+ /*** Validates target syntax before the host transport verifies every resolved network peer. */
3
+ export const validateFlowSecurityTarget = (target) => {
4
+ if (!target)
5
+ return undefined;
6
+ let url;
7
+ try {
8
+ url = new URL(target.url);
9
+ }
10
+ catch {
11
+ throw new FlowSecurityError('invalid_target', 'External targets must be absolute HTTPS URLs.');
12
+ }
13
+ const host = url.hostname.replace(/^\[|\]$/g, '').toLowerCase();
14
+ if (url.protocol !== 'https:' ||
15
+ url.username ||
16
+ url.password ||
17
+ url.hash ||
18
+ !uniqueStrings(target.allowedHosts) ||
19
+ !target.allowedHosts.includes(host) ||
20
+ isUnsafeLiteralHost(host))
21
+ throw new FlowSecurityError('invalid_target', 'External targets must use an explicitly allowlisted public HTTPS host.');
22
+ return host;
23
+ };
24
+ /*** Rejects normalized loopback, local, private, and special-use IP literals before transport access. */
25
+ const isUnsafeLiteralHost = (host) => host === 'localhost' || host.endsWith('.localhost') || isUnsafeIpv4(host) || isUnsafeIpv6(host);
26
+ /*** Identifies IPv4 ranges that must never be an outbound target. */
27
+ const isUnsafeIpv4 = (host) => {
28
+ const parts = host.split('.').map(Number);
29
+ if (parts.length !== 4 || parts.some((part) => !Number.isInteger(part) || part < 0 || part > 255))
30
+ return false;
31
+ const [first, second] = parts;
32
+ return (first === 0 ||
33
+ first === 10 ||
34
+ first === 127 ||
35
+ first >= 224 ||
36
+ (first === 169 && second === 254) ||
37
+ (first === 172 && second >= 16 && second <= 31) ||
38
+ (first === 192 && second === 168));
39
+ };
40
+ /*** Identifies IPv6 loopback, unspecified, unique-local, link-local, and mapped literal forms. */
41
+ const isUnsafeIpv6 = (host) => {
42
+ const normalized = host.toLowerCase();
43
+ return (normalized === '::' ||
44
+ normalized === '::1' ||
45
+ normalized.startsWith('fc') ||
46
+ normalized.startsWith('fd') ||
47
+ normalized.startsWith('fe8') ||
48
+ normalized.startsWith('fe9') ||
49
+ normalized.startsWith('fea') ||
50
+ normalized.startsWith('feb') ||
51
+ normalized.startsWith('::ffff:'));
52
+ };
53
+ /*** Checks unique non-empty authority strings. */
54
+ const uniqueStrings = (values) => values.length > 0 &&
55
+ values.every((value) => value.length > 0) &&
56
+ new Set(values).size === values.length;
57
+ //# sourceMappingURL=validateFlowSecurityTarget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateFlowSecurityTarget.js","sourceRoot":"","sources":["../../../../src/features/security/domain/validateFlowSecurityTarget.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,+FAA+F;AAC/F,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,MAAsC,EAClB,EAAE;IACtB,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,iBAAiB,CAAC,gBAAgB,EAAE,+CAA+C,CAAC,CAAC;IACjG,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAChE,IACE,GAAG,CAAC,QAAQ,KAAK,QAAQ;QACzB,GAAG,CAAC,QAAQ;QACZ,GAAG,CAAC,QAAQ;QACZ,GAAG,CAAC,IAAI;QACR,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC;QACnC,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC;QACnC,mBAAmB,CAAC,IAAI,CAAC;QAEzB,MAAM,IAAI,iBAAiB,CACzB,gBAAgB,EAChB,wEAAwE,CACzE,CAAC;IACJ,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,yGAAyG;AACzG,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAW,EAAE,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UAAU,CAAC,UAAU,CAAC,KAAK,CAAC;QAC5B,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC;QAC5B,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC;QAC5B,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,CACjC,CAAC;AACJ,CAAC,CAAC;AAEF,kDAAkD;AAClD,MAAM,aAAa,GAAG,CAAC,MAAyB,EAAW,EAAE,CAC3D,MAAM,CAAC,MAAM,GAAG,CAAC;IACjB,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACzC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC","sourcesContent":["import type { FlowSecurityTarget } from '../../../types/security.js';\nimport { FlowSecurityError } from '../FlowSecurityError.js';\n\n/*** Validates target syntax before the host transport verifies every resolved network peer. */\nexport const validateFlowSecurityTarget = (\n target: FlowSecurityTarget | undefined,\n): string | undefined => {\n if (!target) return undefined;\n let url: URL;\n try {\n url = new URL(target.url);\n } catch {\n throw new FlowSecurityError('invalid_target', 'External targets must be absolute HTTPS URLs.');\n }\n const host = url.hostname.replace(/^\\[|\\]$/g, '').toLowerCase();\n if (\n url.protocol !== 'https:' ||\n url.username ||\n url.password ||\n url.hash ||\n !uniqueStrings(target.allowedHosts) ||\n !target.allowedHosts.includes(host) ||\n isUnsafeLiteralHost(host)\n )\n throw new FlowSecurityError(\n 'invalid_target',\n 'External targets must use an explicitly allowlisted public HTTPS host.',\n );\n return host;\n};\n\n/*** Rejects normalized loopback, local, private, and special-use IP literals before transport access. */\nconst isUnsafeLiteralHost = (host: string): boolean =>\n host === 'localhost' || host.endsWith('.localhost') || isUnsafeIpv4(host) || isUnsafeIpv6(host);\n\n/*** Identifies IPv4 ranges that must never be an outbound target. */\nconst isUnsafeIpv4 = (host: string): boolean => {\n const parts = host.split('.').map(Number);\n if (parts.length !== 4 || parts.some((part) => !Number.isInteger(part) || part < 0 || part > 255))\n return false;\n const [first, second] = parts as [number, number, number, number];\n return (\n first === 0 ||\n first === 10 ||\n first === 127 ||\n first >= 224 ||\n (first === 169 && second === 254) ||\n (first === 172 && second >= 16 && second <= 31) ||\n (first === 192 && second === 168)\n );\n};\n\n/*** Identifies IPv6 loopback, unspecified, unique-local, link-local, and mapped literal forms. */\nconst isUnsafeIpv6 = (host: string): boolean => {\n const normalized = host.toLowerCase();\n return (\n normalized === '::' ||\n normalized === '::1' ||\n normalized.startsWith('fc') ||\n normalized.startsWith('fd') ||\n normalized.startsWith('fe8') ||\n normalized.startsWith('fe9') ||\n normalized.startsWith('fea') ||\n normalized.startsWith('feb') ||\n normalized.startsWith('::ffff:')\n );\n};\n\n/*** Checks unique non-empty authority strings. */\nconst uniqueStrings = (values: readonly string[]): boolean =>\n values.length > 0 &&\n values.every((value) => value.length > 0) &&\n new Set(values).size === values.length;\n"]}
@@ -0,0 +1,16 @@
1
+ /*** Headless graph compilation and deterministic single-process execution. */
2
+ export { createDurableRunAsync } from './features/execution/application/createDurableRunAsync.js';
3
+ export { executeFlowAsync } from './features/execution/application/executeFlowAsync.js';
4
+ export { calculateRetryDueAt } from './features/execution/domain/calculateRetryDueAt.js';
5
+ export { compileFlowGraph } from './features/execution/domain/compileFlowGraph.js';
6
+ export { createDefaultNodeRegistry } from './features/execution/domain/createDefaultNodeRegistry.js';
7
+ export { createDurableRun } from './features/execution/domain/createDurableRun.js';
8
+ export { createRetryWork } from './features/execution/domain/createRetryWork.js';
9
+ export { isCronDueAt } from './features/execution/domain/isCronDueAt.js';
10
+ export type { FlowPersistencePort } from './features/execution/ports/FlowPersistencePort.js';
11
+ export { createFlowSecurityPort } from './features/security/application/createFlowSecurityPort.js';
12
+ export { FlowSecurityError } from './features/security/FlowSecurityError.js';
13
+ export type { FlowDefinitionRef, FlowDurableRun, FlowDurableWork, FlowOutboxRecord, FlowRetryPolicy, FlowRunCheckpoint, } from './types/durableExecution.js';
14
+ export type { FlowClock, FlowCompiledGraph, FlowExecutionResult, FlowNodeOperation, FlowNodeOperationResult, FlowNodeRegistry, FlowRunRequest, } from './types/execution.js';
15
+ export type { FlowApprovalStorePort, FlowOperationStorePort, FlowOutboundTransportPort, FlowRateLimitPort, FlowResolvedSecrets, FlowSecretCreateInput, FlowSecretMetadata, FlowSecretRevokeInput, FlowSecurityActor, FlowSecurityApproval, FlowSecurityAuditEvent, FlowSecurityAuditPort, FlowSecurityGrant, FlowSecurityOperation, FlowSecurityOperationIdentity, FlowSecurityPermit, FlowSecurityPort, FlowSecurityTarget, } from './types/security.js';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2DAA2D,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sDAAsD,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AACnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,0DAA0D,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AACzE,YAAY,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,MAAM,2DAA2D,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,6BAA6B,EAC7B,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ /*** Headless graph compilation and deterministic single-process execution. */
2
+ export { createDurableRunAsync } from './features/execution/application/createDurableRunAsync.js';
3
+ export { executeFlowAsync } from './features/execution/application/executeFlowAsync.js';
4
+ export { calculateRetryDueAt } from './features/execution/domain/calculateRetryDueAt.js';
5
+ export { compileFlowGraph } from './features/execution/domain/compileFlowGraph.js';
6
+ export { createDefaultNodeRegistry } from './features/execution/domain/createDefaultNodeRegistry.js';
7
+ export { createDurableRun } from './features/execution/domain/createDurableRun.js';
8
+ export { createRetryWork } from './features/execution/domain/createRetryWork.js';
9
+ export { isCronDueAt } from './features/execution/domain/isCronDueAt.js';
10
+ export { createFlowSecurityPort } from './features/security/application/createFlowSecurityPort.js';
11
+ export { FlowSecurityError } from './features/security/FlowSecurityError.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2DAA2D,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sDAAsD,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AACnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,0DAA0D,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAEzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2DAA2D,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC","sourcesContent":["/*** Headless graph compilation and deterministic single-process execution. */\nexport { createDurableRunAsync } from './features/execution/application/createDurableRunAsync.js';\nexport { executeFlowAsync } from './features/execution/application/executeFlowAsync.js';\nexport { calculateRetryDueAt } from './features/execution/domain/calculateRetryDueAt.js';\nexport { compileFlowGraph } from './features/execution/domain/compileFlowGraph.js';\nexport { createDefaultNodeRegistry } from './features/execution/domain/createDefaultNodeRegistry.js';\nexport { createDurableRun } from './features/execution/domain/createDurableRun.js';\nexport { createRetryWork } from './features/execution/domain/createRetryWork.js';\nexport { isCronDueAt } from './features/execution/domain/isCronDueAt.js';\nexport type { FlowPersistencePort } from './features/execution/ports/FlowPersistencePort.js';\nexport { createFlowSecurityPort } from './features/security/application/createFlowSecurityPort.js';\nexport { FlowSecurityError } from './features/security/FlowSecurityError.js';\nexport type {\n FlowDefinitionRef,\n FlowDurableRun,\n FlowDurableWork,\n FlowOutboxRecord,\n FlowRetryPolicy,\n FlowRunCheckpoint,\n} from './types/durableExecution.js';\nexport type {\n FlowClock,\n FlowCompiledGraph,\n FlowExecutionResult,\n FlowNodeOperation,\n FlowNodeOperationResult,\n FlowNodeRegistry,\n FlowRunRequest,\n} from './types/execution.js';\nexport type {\n FlowApprovalStorePort,\n FlowOperationStorePort,\n FlowOutboundTransportPort,\n FlowRateLimitPort,\n FlowResolvedSecrets,\n FlowSecretCreateInput,\n FlowSecretMetadata,\n FlowSecretRevokeInput,\n FlowSecurityActor,\n FlowSecurityApproval,\n FlowSecurityAuditEvent,\n FlowSecurityAuditPort,\n FlowSecurityGrant,\n FlowSecurityOperation,\n FlowSecurityOperationIdentity,\n FlowSecurityPermit,\n FlowSecurityPort,\n FlowSecurityTarget,\n} from './types/security.js';\n"]}
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /*** Optional, allowlist-only MCP tool discovery and invocation integration. */
2
+ export { createMcpToolRegistry } from './features/mcp/createMcpToolRegistry.js';
3
+ export type { McpProviderDefinition, McpToolInvocation, McpToolMetadata, McpToolPermission, McpToolRegistry, McpToolResult, McpTrustedStdioProvider, } from './types/mcp.js';
4
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,uBAAuB,GACxB,MAAM,gBAAgB,CAAC"}
package/dist/mcp.js ADDED
@@ -0,0 +1,3 @@
1
+ /*** Optional, allowlist-only MCP tool discovery and invocation integration. */
2
+ export { createMcpToolRegistry } from './features/mcp/createMcpToolRegistry.js';
3
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC","sourcesContent":["/*** Optional, allowlist-only MCP tool discovery and invocation integration. */\nexport { createMcpToolRegistry } from './features/mcp/createMcpToolRegistry.js';\nexport type {\n McpProviderDefinition,\n McpToolInvocation,\n McpToolMetadata,\n McpToolPermission,\n McpToolRegistry,\n McpToolResult,\n McpTrustedStdioProvider,\n} from './types/mcp.js';\n"]}
@@ -0,0 +1,7 @@
1
+ /***
2
+ * Reserved public subpath for future social-provider adapters.
3
+ *
4
+ * This bootstrap intentionally provides no social execution, configuration, or dependencies.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=social.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social.d.ts","sourceRoot":"","sources":["../src/social.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC"}
package/dist/social.js ADDED
@@ -0,0 +1,7 @@
1
+ /***
2
+ * Reserved public subpath for future social-provider adapters.
3
+ *
4
+ * This bootstrap intentionally provides no social execution, configuration, or dependencies.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=social.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social.js","sourceRoot":"","sources":["../src/social.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC","sourcesContent":["/***\n * Reserved public subpath for future social-provider adapters.\n *\n * This bootstrap intentionally provides no social execution, configuration, or dependencies.\n */\nexport {};\n"]}
@@ -0,0 +1,55 @@
1
+ import type { DataContractValue } from '@ankhorage/contracts/data';
2
+ import type { FlowSecurityOperation } from './security.js';
3
+ export interface FlowDefinitionRef {
4
+ readonly id: string;
5
+ readonly version: number;
6
+ }
7
+ export interface FlowDurableRun {
8
+ readonly checkpoint?: FlowRunCheckpoint;
9
+ readonly createdAt: string;
10
+ readonly flow: FlowDefinitionRef;
11
+ readonly id: string;
12
+ readonly revision: number;
13
+ readonly status: 'cancelled' | 'failed' | 'queued' | 'running' | 'succeeded' | 'waiting_approval';
14
+ readonly updatedAt: string;
15
+ }
16
+ export interface FlowDurableWork {
17
+ readonly attempt: number;
18
+ readonly dueAt: string;
19
+ /** Explicitly separates side-effect-free internal work from a security-protected provider effect. */
20
+ readonly effectKind: 'internal' | 'protected';
21
+ readonly flow: FlowDefinitionRef;
22
+ readonly id: string;
23
+ readonly idempotencyKey?: string;
24
+ readonly lease?: {
25
+ readonly expiresAt: string;
26
+ readonly fencingToken: number;
27
+ readonly workerId: string;
28
+ };
29
+ readonly runId: string;
30
+ readonly securityOperation?: FlowSecurityOperation;
31
+ readonly stepId?: string;
32
+ readonly status: 'cancelled' | 'claimed' | 'completed' | 'ready';
33
+ }
34
+ export interface FlowRetryPolicy {
35
+ readonly baseDelayMs: number;
36
+ readonly maxAttempts: number;
37
+ readonly maxDelayMs: number;
38
+ }
39
+ /** Persisted state for each completed or in-flight Flow step. */
40
+ export interface FlowRunCheckpoint {
41
+ readonly completedStepIds: readonly string[];
42
+ readonly data?: DataContractValue;
43
+ readonly failedStepIds: readonly string[];
44
+ }
45
+ /** A durable outbox record separates at-least-once delivery from an idempotent application effect. */
46
+ export interface FlowOutboxRecord {
47
+ readonly createdAt: string;
48
+ readonly id: string;
49
+ readonly idempotencyKey: string;
50
+ readonly payload?: DataContractValue;
51
+ readonly runId: string;
52
+ readonly status: 'delivered' | 'pending';
53
+ readonly workId: string;
54
+ }
55
+ //# sourceMappingURL=durableExecution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durableExecution.d.ts","sourceRoot":"","sources":["../../src/types/durableExecution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,M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AE,CAAC;CAC3C;AAED,sGAAsG;AACtG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=durableExecution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durableExecution.js","sourceRoot":"","sources":["../../src/types/durableExecution.ts"],"names":[],"mappings":"","sourcesContent":["import type { DataContractValue } from '@ankhorage/contracts/data';\n\nimport type { FlowSecurityOperation } from './security.js';\n\nexport interface FlowDefinitionRef {\n readonly id: string;\n readonly version: number;\n}\n\nexport interface FlowDurableRun {\n readonly checkpoint?: FlowRunCheckpoint;\n readonly createdAt: string;\n readonly flow: FlowDefinitionRef;\n readonly id: string;\n readonly revision: number;\n readonly status: 'cancelled' | 'failed' | 'queued' | 'running' | 'succeeded' | 'waiting_approval';\n readonly updatedAt: string;\n}\n\nexport interface FlowDurableWork {\n readonly attempt: number;\n readonly dueAt: string;\n /** Explicitly separates side-effect-free internal work from a security-protected provider effect. */\n readonly effectKind: 'internal' | 'protected';\n readonly flow: FlowDefinitionRef;\n readonly id: string;\n readonly idempotencyKey?: string;\n readonly lease?: {\n readonly expiresAt: string;\n readonly fencingToken: number;\n readonly workerId: string;\n };\n readonly runId: string;\n readonly securityOperation?: FlowSecurityOperation;\n readonly stepId?: string;\n readonly status: 'cancelled' | 'claimed' | 'completed' | 'ready';\n}\n\nexport interface FlowRetryPolicy {\n readonly baseDelayMs: number;\n readonly maxAttempts: number;\n readonly maxDelayMs: number;\n}\n\n/** Persisted state for each completed or in-flight Flow step. */\nexport interface FlowRunCheckpoint {\n readonly completedStepIds: readonly string[];\n readonly data?: DataContractValue;\n readonly failedStepIds: readonly string[];\n}\n\n/** A durable outbox record separates at-least-once delivery from an idempotent application effect. */\nexport interface FlowOutboxRecord {\n readonly createdAt: string;\n readonly id: string;\n readonly idempotencyKey: string;\n readonly payload?: DataContractValue;\n readonly runId: string;\n readonly status: 'delivered' | 'pending';\n readonly workId: string;\n}\n"]}
@@ -0,0 +1,33 @@
1
+ import type { DataSchemaRegistry } from '@ankhorage/contracts/data';
2
+ import type { FlowDataRef, FlowDefinition, FlowEdge, FlowNode, FlowNodeConfig, FlowPortId, FlowRunSnapshot } from '@ankhorage/contracts/flow';
3
+ export interface FlowClock {
4
+ readonly now: () => Date;
5
+ }
6
+ export interface FlowNodeOperationResult {
7
+ readonly output?: Readonly<Record<FlowPortId, FlowDataRef>>;
8
+ }
9
+ export interface FlowNodeOperation {
10
+ readonly executeAsync: (input: {
11
+ readonly config: FlowNodeConfig | undefined;
12
+ readonly input: Readonly<Record<FlowPortId, FlowDataRef>>;
13
+ readonly node: FlowNode;
14
+ readonly signal: AbortSignal;
15
+ }) => Promise<FlowNodeOperationResult>;
16
+ }
17
+ export type FlowNodeRegistry = Readonly<Record<string, FlowNodeOperation>>;
18
+ export interface FlowCompiledGraph {
19
+ readonly definition: FlowDefinition;
20
+ readonly edgesBySourceNodeId: Readonly<Record<string, readonly FlowEdge[]>>;
21
+ readonly topologicalNodeIds: readonly string[];
22
+ }
23
+ export interface FlowRunRequest {
24
+ readonly input?: Readonly<Record<FlowPortId, FlowDataRef>>;
25
+ readonly runId: string;
26
+ readonly schemaRegistry?: DataSchemaRegistry;
27
+ readonly signal?: AbortSignal;
28
+ readonly triggerId: string;
29
+ }
30
+ export interface FlowExecutionResult {
31
+ readonly run: FlowRunSnapshot;
32
+ }
33
+ //# sourceMappingURL=execution.d.ts.map
@@ -0,0 +1 @@
1
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AQ,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AACD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,GAAG,EAAE,eAAe,CAAC;CAC/B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=execution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution.js","sourceRoot":"","sources":["../../src/types/execution.ts"],"names":[],"mappings":"","sourcesContent":["import type { DataSchemaRegistry } from '@ankhorage/contracts/data';\nimport type {\n FlowDataRef,\n FlowDefinition,\n FlowEdge,\n FlowNode,\n FlowNodeConfig,\n FlowPortId,\n FlowRunSnapshot,\n} from '@ankhorage/contracts/flow';\n\nexport interface FlowClock {\n readonly now: () => Date;\n}\nexport interface FlowNodeOperationResult {\n readonly output?: Readonly<Record<FlowPortId, FlowDataRef>>;\n}\nexport interface FlowNodeOperation {\n readonly executeAsync: (input: {\n readonly config: FlowNodeConfig | undefined;\n readonly input: Readonly<Record<FlowPortId, FlowDataRef>>;\n readonly node: FlowNode;\n readonly signal: AbortSignal;\n }) => Promise<FlowNodeOperationResult>;\n}\nexport type FlowNodeRegistry = Readonly<Record<string, FlowNodeOperation>>;\nexport interface FlowCompiledGraph {\n readonly definition: FlowDefinition;\n readonly edgesBySourceNodeId: Readonly<Record<string, readonly FlowEdge[]>>;\n readonly topologicalNodeIds: readonly string[];\n}\nexport interface FlowRunRequest {\n readonly input?: Readonly<Record<FlowPortId, FlowDataRef>>;\n readonly runId: string;\n readonly schemaRegistry?: DataSchemaRegistry;\n readonly signal?: AbortSignal;\n readonly triggerId: string;\n}\nexport interface FlowExecutionResult {\n readonly run: FlowRunSnapshot;\n}\n"]}
@@ -0,0 +1,61 @@
1
+ import type { SecretRef } from '@ankhorage/contracts/secrets';
2
+ import type { FlowSecurityActor } from './security.js';
3
+ /** Public configuration and results for the optional MCP integration. */
4
+ export interface McpToolPermission {
5
+ readonly name: string;
6
+ readonly grantedScopes: readonly string[];
7
+ }
8
+ export type McpProviderDefinition = {
9
+ readonly id: string;
10
+ readonly transport: 'remote';
11
+ readonly endpoint: string;
12
+ readonly allowedHosts: readonly string[];
13
+ readonly allowedTools: readonly McpToolPermission[];
14
+ readonly grantedScopes: readonly string[];
15
+ readonly timeoutMs?: number;
16
+ } | {
17
+ readonly id: string;
18
+ readonly transport: 'stdio';
19
+ readonly allowedTools: readonly McpToolPermission[];
20
+ readonly grantedScopes: readonly string[];
21
+ readonly timeoutMs?: number;
22
+ };
23
+ /** Host-owned command configuration. It is deliberately separate from workflow provider data. */
24
+ export interface McpTrustedStdioProvider {
25
+ readonly command: string;
26
+ readonly args?: readonly string[];
27
+ }
28
+ export interface McpToolMetadata {
29
+ readonly providerId: string;
30
+ readonly name: string;
31
+ readonly title?: string;
32
+ readonly description?: string;
33
+ readonly inputSchema: Readonly<Record<string, unknown>>;
34
+ readonly schemaFingerprint: string;
35
+ readonly scopes: readonly string[];
36
+ readonly readOnly: boolean;
37
+ }
38
+ export interface McpToolInvocation {
39
+ readonly providerId: string;
40
+ readonly toolName: string;
41
+ readonly schemaFingerprint: string;
42
+ readonly arguments: Readonly<Record<string, unknown>>;
43
+ readonly scopes: readonly string[];
44
+ readonly security: {
45
+ readonly actor: FlowSecurityActor;
46
+ readonly idempotencyKey: string;
47
+ readonly operationId: string;
48
+ readonly secretRefs?: readonly SecretRef[];
49
+ };
50
+ readonly signal?: AbortSignal;
51
+ }
52
+ export interface McpToolResult {
53
+ readonly content: readonly unknown[];
54
+ readonly structuredContent?: Readonly<Record<string, unknown>>;
55
+ readonly isError: boolean;
56
+ }
57
+ export interface McpToolRegistry {
58
+ discoverAsync(signal?: AbortSignal): Promise<readonly McpToolMetadata[]>;
59
+ invokeAsync(invocation: McpToolInvocation): Promise<McpToolResult>;
60
+ }
61
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/types/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAED,MAAM,MAAM,qBAAqB,GAC7B;IACE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,YAAY,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACpD,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,GACD;IACE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACpD,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEN,iGAAiG;AACjG,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI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CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAAC;IACzE,WAAW,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACpE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/types/mcp.ts"],"names":[],"mappings":"","sourcesContent":["import type { SecretRef } from '@ankhorage/contracts/secrets';\n\nimport type { FlowSecurityActor } from './security.js';\n\n/** Public configuration and results for the optional MCP integration. */\nexport interface McpToolPermission {\n readonly name: string;\n readonly grantedScopes: readonly string[];\n}\n\nexport type McpProviderDefinition =\n | {\n readonly id: string;\n readonly transport: 'remote';\n readonly endpoint: string;\n readonly allowedHosts: readonly string[];\n readonly allowedTools: readonly McpToolPermission[];\n readonly grantedScopes: readonly string[];\n readonly timeoutMs?: number;\n }\n | {\n readonly id: string;\n readonly transport: 'stdio';\n readonly allowedTools: readonly McpToolPermission[];\n readonly grantedScopes: readonly string[];\n readonly timeoutMs?: number;\n };\n\n/** Host-owned command configuration. It is deliberately separate from workflow provider data. */\nexport interface McpTrustedStdioProvider {\n readonly command: string;\n readonly args?: readonly string[];\n}\n\nexport interface McpToolMetadata {\n readonly providerId: string;\n readonly name: string;\n readonly title?: string;\n readonly description?: string;\n readonly inputSchema: Readonly<Record<string, unknown>>;\n readonly schemaFingerprint: string;\n readonly scopes: readonly string[];\n readonly readOnly: boolean;\n}\n\nexport interface McpToolInvocation {\n readonly providerId: string;\n readonly toolName: string;\n readonly schemaFingerprint: string;\n readonly arguments: Readonly<Record<string, unknown>>;\n readonly scopes: readonly string[];\n readonly security: {\n readonly actor: FlowSecurityActor;\n readonly idempotencyKey: string;\n readonly operationId: string;\n readonly secretRefs?: readonly SecretRef[];\n };\n readonly signal?: AbortSignal;\n}\n\nexport interface McpToolResult {\n readonly content: readonly unknown[];\n readonly structuredContent?: Readonly<Record<string, unknown>>;\n readonly isError: boolean;\n}\n\nexport interface McpToolRegistry {\n discoverAsync(signal?: AbortSignal): Promise<readonly McpToolMetadata[]>;\n invokeAsync(invocation: McpToolInvocation): Promise<McpToolResult>;\n}\n"]}
@@ -0,0 +1,123 @@
1
+ import type { SecretMetadata, SecretPayload, SecretRef } from '@ankhorage/contracts/secrets';
2
+ /** Trusted execution identity supplied by the host authentication boundary. */
3
+ export interface FlowSecurityActor {
4
+ readonly id: string;
5
+ readonly tenantId: string;
6
+ readonly projectId: string;
7
+ readonly environment: string;
8
+ }
9
+ /** An exact capability grant; omitted dimensions never imply access. */
10
+ export interface FlowSecurityGrant {
11
+ readonly actorId: string;
12
+ readonly capability: string;
13
+ readonly tenantId: string;
14
+ readonly projectId: string;
15
+ readonly environment: string;
16
+ }
17
+ /** A protected external operation presented to the security boundary. */
18
+ export interface FlowSecurityOperation {
19
+ readonly actor: FlowSecurityActor;
20
+ readonly capability: string;
21
+ readonly idempotencyKey: string;
22
+ readonly operationId: string;
23
+ readonly secretRefs?: readonly SecretRef[];
24
+ readonly target?: FlowSecurityTarget;
25
+ }
26
+ /** An outbound destination and its exact host authority. */
27
+ export interface FlowSecurityTarget {
28
+ readonly allowedHosts: readonly string[];
29
+ readonly url: string;
30
+ }
31
+ /** The complete immutable identity that grants, claims, and consumes one operation. */
32
+ export interface FlowSecurityOperationIdentity {
33
+ readonly actor: FlowSecurityActor;
34
+ readonly capability: string;
35
+ readonly idempotencyKey: string;
36
+ readonly operationId: string;
37
+ readonly secretRefs: readonly SecretRef[];
38
+ readonly target?: FlowSecurityTarget;
39
+ }
40
+ /** A durable human decision bound to exactly one complete operation identity. */
41
+ export interface FlowSecurityApproval {
42
+ readonly operation: FlowSecurityOperationIdentity;
43
+ readonly status: 'approved' | 'pending' | 'rejected';
44
+ }
45
+ /** Host-owned persistence boundary for approval-gate state. */
46
+ export interface FlowApprovalStorePort {
47
+ getAsync(operation: FlowSecurityOperationIdentity): Promise<FlowSecurityApproval | undefined>;
48
+ }
49
+ /**
50
+ * Host-owned durable exactly-once boundary. Every transition must be atomic across workers and
51
+ * restarts. `releaseAsync` may only release an unconsumed claim for this exact identity.
52
+ */
53
+ export interface FlowOperationStorePort {
54
+ claimAsync(operation: FlowSecurityOperationIdentity): Promise<boolean>;
55
+ consumeAsync(operation: FlowSecurityOperationIdentity): Promise<boolean>;
56
+ releaseAsync(operation: FlowSecurityOperationIdentity): Promise<void>;
57
+ }
58
+ /**
59
+ * Host-owned network boundary that verifies every actual peer before opening a connection.
60
+ * It must enforce the supplied host allowlist, resolve immediately before every connection,
61
+ * reject private or special-use resolved addresses, and reapply that policy to redirects.
62
+ */
63
+ export interface FlowOutboundTransportPort {
64
+ fetchAsync(input: {
65
+ readonly allowedHosts: readonly string[];
66
+ readonly init?: RequestInit;
67
+ readonly url: string;
68
+ }): Promise<Response>;
69
+ }
70
+ /** Host-owned rate limiter. A denied acquisition must have no external side effect. */
71
+ export interface FlowRateLimitPort {
72
+ acquireAsync(input: {
73
+ readonly actor: FlowSecurityActor;
74
+ readonly capability: string;
75
+ readonly operationId: string;
76
+ }): Promise<boolean>;
77
+ }
78
+ /** Redaction-safe audit edge. Secret values and payloads are intentionally absent. */
79
+ export interface FlowSecurityAuditPort {
80
+ writeAsync(event: FlowSecurityAuditEvent): Promise<void>;
81
+ }
82
+ /** Immutable audit metadata for one permit or denial. */
83
+ export interface FlowSecurityAuditEvent {
84
+ readonly actorId: string;
85
+ readonly capability: string;
86
+ readonly decision: 'denied' | 'permitted';
87
+ readonly operationId: string;
88
+ readonly reason: 'approval_pending' | 'approval_rejected' | 'credential_create' | 'credential_revoke' | 'idempotency_conflict' | 'invalid_target' | 'permission_denied' | 'rate_limited' | 'secret_unavailable';
89
+ readonly secretRefs: readonly SecretRef[];
90
+ readonly targetHost?: string;
91
+ }
92
+ /** Metadata-only credential view safe for administrative or graph-facing callers. */
93
+ export type FlowSecretMetadata = SecretMetadata;
94
+ export type FlowResolvedSecrets = Readonly<Record<SecretRef, Readonly<Record<string, string>>>>;
95
+ /** Protected server-side credential creation input. Its scope is always derived from the actor. */
96
+ export interface FlowSecretCreateInput {
97
+ readonly actor: FlowSecurityActor;
98
+ readonly kind: string;
99
+ readonly payload: SecretPayload;
100
+ readonly provider?: string;
101
+ readonly ref: SecretRef;
102
+ }
103
+ /** Protected server-side credential revocation input. Its scope is always derived from the actor. */
104
+ export interface FlowSecretRevokeInput {
105
+ readonly actor: FlowSecurityActor;
106
+ readonly ref: SecretRef;
107
+ }
108
+ /** One-use authorization result. Raw secrets stay private to the returned server closure. */
109
+ export interface FlowSecurityPermit {
110
+ readonly operation: FlowSecurityOperationIdentity;
111
+ executeAsync<T>(operation: (secrets: FlowResolvedSecrets) => Promise<T>): Promise<T>;
112
+ }
113
+ /** Public server-side boundary consumed by provider, AI, MCP, and social adapters. */
114
+ export interface FlowSecurityPort {
115
+ authorizeAsync(operation: FlowSecurityOperation): Promise<FlowSecurityPermit>;
116
+ createSecretAsync(input: FlowSecretCreateInput): Promise<FlowSecretMetadata>;
117
+ getSecretMetadataAsync(input: {
118
+ readonly actor: FlowSecurityActor;
119
+ readonly ref: SecretRef;
120
+ }): Promise<FlowSecretMetadata>;
121
+ revokeSecretAsync(input: FlowSecretRevokeInput): Promise<void>;
122
+ }
123
+ //# sourceMappingURL=security.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/types/security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE7F,+EAA+E;AAC/E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE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AO,EAAE,mBAAmB,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACtF;AAED,sFAAsF;AACtF,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,SAAS,EAAE,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9E,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC7E,sBAAsB,CAAC,KAAK,EAAE;QAC5B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;QAClC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;KACzB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAChC,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=security.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.js","sourceRoot":"","sources":["../../src/types/security.ts"],"names":[],"mappings":"","sourcesContent":["import type { SecretMetadata, SecretPayload, SecretRef } from '@ankhorage/contracts/secrets';\n\n/** Trusted execution identity supplied by the host authentication boundary. */\nexport interface FlowSecurityActor {\n readonly id: string;\n readonly tenantId: string;\n readonly projectId: string;\n readonly environment: string;\n}\n\n/** An exact capability grant; omitted dimensions never imply access. */\nexport interface FlowSecurityGrant {\n readonly actorId: string;\n readonly capability: string;\n readonly tenantId: string;\n readonly projectId: string;\n readonly environment: string;\n}\n\n/** A protected external operation presented to the security boundary. */\nexport interface FlowSecurityOperation {\n readonly actor: FlowSecurityActor;\n readonly capability: string;\n readonly idempotencyKey: string;\n readonly operationId: string;\n readonly secretRefs?: readonly SecretRef[];\n readonly target?: FlowSecurityTarget;\n}\n\n/** An outbound destination and its exact host authority. */\nexport interface FlowSecurityTarget {\n readonly allowedHosts: readonly string[];\n readonly url: string;\n}\n\n/** The complete immutable identity that grants, claims, and consumes one operation. */\nexport interface FlowSecurityOperationIdentity {\n readonly actor: FlowSecurityActor;\n readonly capability: string;\n readonly idempotencyKey: string;\n readonly operationId: string;\n readonly secretRefs: readonly SecretRef[];\n readonly target?: FlowSecurityTarget;\n}\n\n/** A durable human decision bound to exactly one complete operation identity. */\nexport interface FlowSecurityApproval {\n readonly operation: FlowSecurityOperationIdentity;\n readonly status: 'approved' | 'pending' | 'rejected';\n}\n\n/** Host-owned persistence boundary for approval-gate state. */\nexport interface FlowApprovalStorePort {\n getAsync(operation: FlowSecurityOperationIdentity): Promise<FlowSecurityApproval | undefined>;\n}\n\n/**\n * Host-owned durable exactly-once boundary. Every transition must be atomic across workers and\n * restarts. `releaseAsync` may only release an unconsumed claim for this exact identity.\n */\nexport interface FlowOperationStorePort {\n claimAsync(operation: FlowSecurityOperationIdentity): Promise<boolean>;\n consumeAsync(operation: FlowSecurityOperationIdentity): Promise<boolean>;\n releaseAsync(operation: FlowSecurityOperationIdentity): Promise<void>;\n}\n\n/**\n * Host-owned network boundary that verifies every actual peer before opening a connection.\n * It must enforce the supplied host allowlist, resolve immediately before every connection,\n * reject private or special-use resolved addresses, and reapply that policy to redirects.\n */\nexport interface FlowOutboundTransportPort {\n fetchAsync(input: {\n readonly allowedHosts: readonly string[];\n readonly init?: RequestInit;\n readonly url: string;\n }): Promise<Response>;\n}\n\n/** Host-owned rate limiter. A denied acquisition must have no external side effect. */\nexport interface FlowRateLimitPort {\n acquireAsync(input: {\n readonly actor: FlowSecurityActor;\n readonly capability: string;\n readonly operationId: string;\n }): Promise<boolean>;\n}\n\n/** Redaction-safe audit edge. Secret values and payloads are intentionally absent. */\nexport interface FlowSecurityAuditPort {\n writeAsync(event: FlowSecurityAuditEvent): Promise<void>;\n}\n\n/** Immutable audit metadata for one permit or denial. */\nexport interface FlowSecurityAuditEvent {\n readonly actorId: string;\n readonly capability: string;\n readonly decision: 'denied' | 'permitted';\n readonly operationId: string;\n readonly reason:\n | 'approval_pending'\n | 'approval_rejected'\n | 'credential_create'\n | 'credential_revoke'\n | 'idempotency_conflict'\n | 'invalid_target'\n | 'permission_denied'\n | 'rate_limited'\n | 'secret_unavailable';\n readonly secretRefs: readonly SecretRef[];\n readonly targetHost?: string;\n}\n\n/** Metadata-only credential view safe for administrative or graph-facing callers. */\nexport type FlowSecretMetadata = SecretMetadata;\nexport type FlowResolvedSecrets = Readonly<Record<SecretRef, Readonly<Record<string, string>>>>;\n\n/** Protected server-side credential creation input. Its scope is always derived from the actor. */\nexport interface FlowSecretCreateInput {\n readonly actor: FlowSecurityActor;\n readonly kind: string;\n readonly payload: SecretPayload;\n readonly provider?: string;\n readonly ref: SecretRef;\n}\n\n/** Protected server-side credential revocation input. Its scope is always derived from the actor. */\nexport interface FlowSecretRevokeInput {\n readonly actor: FlowSecurityActor;\n readonly ref: SecretRef;\n}\n\n/** One-use authorization result. Raw secrets stay private to the returned server closure. */\nexport interface FlowSecurityPermit {\n readonly operation: FlowSecurityOperationIdentity;\n executeAsync<T>(operation: (secrets: FlowResolvedSecrets) => Promise<T>): Promise<T>;\n}\n\n/** Public server-side boundary consumed by provider, AI, MCP, and social adapters. */\nexport interface FlowSecurityPort {\n authorizeAsync(operation: FlowSecurityOperation): Promise<FlowSecurityPermit>;\n createSecretAsync(input: FlowSecretCreateInput): Promise<FlowSecretMetadata>;\n getSecretMetadataAsync(input: {\n readonly actor: FlowSecurityActor;\n readonly ref: SecretRef;\n }): Promise<FlowSecretMetadata>;\n revokeSecretAsync(input: FlowSecretRevokeInput): Promise<void>;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,92 @@
1
1
  {
2
2
  "name": "@ankhorage/flow",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.5.0",
4
+ "description": "Standalone workflow engine foundation for Ankhorage.",
5
+ "keywords": [
6
+ "ankhorage",
7
+ "flow",
8
+ "workflow",
9
+ "automation"
10
+ ],
11
+ "type": "module",
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "sideEffects": false,
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "./ai": {
21
+ "types": "./dist/ai.d.ts",
22
+ "default": "./dist/ai.js"
23
+ },
24
+ "./execution": {
25
+ "types": "./dist/execution.d.ts",
26
+ "default": "./dist/execution.js"
27
+ },
28
+ "./mcp": {
29
+ "types": "./dist/mcp.d.ts",
30
+ "default": "./dist/mcp.js"
31
+ },
32
+ "./social": {
33
+ "types": "./dist/social.d.ts",
34
+ "default": "./dist/social.js"
35
+ }
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "src",
40
+ "package.json",
41
+ "README.md",
42
+ "CHANGELOG.md",
43
+ "LICENSE"
44
+ ],
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/ankhorage/flow.git"
51
+ },
52
+ "bugs": {
53
+ "url": "https://github.com/ankhorage/flow/issues"
54
+ },
55
+ "homepage": "https://github.com/ankhorage/flow#readme",
56
+ "license": "MIT",
57
+ "scripts": {
58
+ "build": "rm -rf dist tsconfig.tsbuildinfo && bun x tsc -p tsconfig.json",
59
+ "changeset": "ankhorage-changeset",
60
+ "changeset:status": "ankhorage-changeset status --since=origin/main",
61
+ "docs": "paradox",
62
+ "lint": "ankhorage-eslint . --max-warnings=0",
63
+ "lint:fix": "ankhorage-eslint . --fix --max-warnings=0",
64
+ "format": "ankhorage-prettier --write .",
65
+ "format:check": "ankhorage-prettier --check .",
66
+ "knip:check": "ankhorage-knip",
67
+ "test": "bun test src test",
68
+ "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.node-esm.json && tsc --noEmit -p tsconfig.test.json",
69
+ "version-packages": "ankhorage-changeset version"
70
+ },
71
+ "devDependencies": {
72
+ "@ankhorage/devtools": "^2.4.3",
73
+ "@ankhorage/paradox": "^0.3.6",
74
+ "@ankhorage/secrets-supabase-vault": "^1.0.0",
75
+ "@modelcontextprotocol/sdk": "^1.32.2",
76
+ "@types/bun": "^1.4.2",
77
+ "@types/node": "^26.6.6",
78
+ "typescript": "^6.0.3"
79
+ },
80
+ "packageManager": "bun@1.4.2",
81
+ "dependencies": {
82
+ "@ankhorage/contracts": "^26.7.0"
83
+ },
84
+ "peerDependencies": {
85
+ "@modelcontextprotocol/sdk": "^1.32.2"
86
+ },
87
+ "peerDependenciesMeta": {
88
+ "@modelcontextprotocol/sdk": {
89
+ "optional": true
90
+ }
91
+ }
92
+ }
package/src/ai.ts ADDED
@@ -0,0 +1,6 @@
1
+ /***
2
+ * Reserved public subpath for future AI-provider adapters.
3
+ *
4
+ * This bootstrap intentionally provides no AI execution, configuration, or dependencies.
5
+ */
6
+ export {};