@proofoftech/flowsafe 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/CHANGELOG.md +307 -0
  2. package/dist/agent-runner/approval-shapes.d.ts +36 -0
  3. package/dist/agent-runner/approval-shapes.d.ts.map +1 -0
  4. package/dist/agent-runner/approval-shapes.js +101 -0
  5. package/dist/agent-runner/approval-shapes.js.map +1 -0
  6. package/dist/agent-runner/durable-agent-runner.d.ts +154 -0
  7. package/dist/agent-runner/durable-agent-runner.d.ts.map +1 -0
  8. package/dist/agent-runner/durable-agent-runner.js +291 -0
  9. package/dist/agent-runner/durable-agent-runner.js.map +1 -0
  10. package/dist/agent-runner/index.d.ts +3 -0
  11. package/dist/agent-runner/index.d.ts.map +1 -0
  12. package/dist/agent-runner/index.js +10 -0
  13. package/dist/agent-runner/index.js.map +1 -0
  14. package/dist/approval-api/d1-store.d.ts.map +1 -1
  15. package/dist/approval-api/d1-store.js +85 -17
  16. package/dist/approval-api/d1-store.js.map +1 -1
  17. package/dist/approval-api/index.d.ts +1 -1
  18. package/dist/approval-api/index.d.ts.map +1 -1
  19. package/dist/approval-api/index.js.map +1 -1
  20. package/dist/approval-api/router.d.ts +1 -1
  21. package/dist/approval-api/router.d.ts.map +1 -1
  22. package/dist/approval-api/router.js +1 -0
  23. package/dist/approval-api/router.js.map +1 -1
  24. package/dist/approval-api/service.d.ts +2 -2
  25. package/dist/approval-api/service.d.ts.map +1 -1
  26. package/dist/approval-api/service.js +15 -1
  27. package/dist/approval-api/service.js.map +1 -1
  28. package/dist/approval-api/store.d.ts +10 -6
  29. package/dist/approval-api/store.d.ts.map +1 -1
  30. package/dist/approval-api/store.js +15 -0
  31. package/dist/approval-api/store.js.map +1 -1
  32. package/dist/approval-api/tenant-context.d.ts.map +1 -1
  33. package/dist/approval-api/tenant-context.js +15 -0
  34. package/dist/approval-api/tenant-context.js.map +1 -1
  35. package/dist/approval-api/types.d.ts +8 -0
  36. package/dist/approval-api/types.d.ts.map +1 -1
  37. package/dist/approval-api/types.js.map +1 -1
  38. package/dist/background-tasks/d1-storage.d.ts +66 -0
  39. package/dist/background-tasks/d1-storage.d.ts.map +1 -0
  40. package/dist/background-tasks/d1-storage.js +196 -0
  41. package/dist/background-tasks/d1-storage.js.map +1 -0
  42. package/dist/background-tasks/host.d.ts +82 -0
  43. package/dist/background-tasks/host.d.ts.map +1 -0
  44. package/dist/background-tasks/host.js +275 -0
  45. package/dist/background-tasks/host.js.map +1 -0
  46. package/dist/background-tasks/index.d.ts +7 -0
  47. package/dist/background-tasks/index.d.ts.map +1 -0
  48. package/dist/background-tasks/index.js +10 -0
  49. package/dist/background-tasks/index.js.map +1 -0
  50. package/dist/background-tasks/routes.d.ts +15 -0
  51. package/dist/background-tasks/routes.d.ts.map +1 -0
  52. package/dist/background-tasks/routes.js +144 -0
  53. package/dist/background-tasks/routes.js.map +1 -0
  54. package/dist/do-runner/d1-storage.d.ts +343 -2
  55. package/dist/do-runner/d1-storage.d.ts.map +1 -1
  56. package/dist/do-runner/d1-storage.js +565 -12
  57. package/dist/do-runner/d1-storage.js.map +1 -1
  58. package/dist/do-runner/do-error-response.d.ts +29 -0
  59. package/dist/do-runner/do-error-response.d.ts.map +1 -0
  60. package/dist/do-runner/do-error-response.js +73 -0
  61. package/dist/do-runner/do-error-response.js.map +1 -0
  62. package/dist/do-runner/durable-object.d.ts +1 -1
  63. package/dist/do-runner/durable-object.d.ts.map +1 -1
  64. package/dist/do-runner/durable-object.js +2 -16
  65. package/dist/do-runner/durable-object.js.map +1 -1
  66. package/dist/do-runner/index.d.ts +9 -3
  67. package/dist/do-runner/index.d.ts.map +1 -1
  68. package/dist/do-runner/index.js +8 -2
  69. package/dist/do-runner/index.js.map +1 -1
  70. package/dist/do-runner/init.d.ts +20 -0
  71. package/dist/do-runner/init.d.ts.map +1 -1
  72. package/dist/do-runner/init.js +12 -1
  73. package/dist/do-runner/init.js.map +1 -1
  74. package/dist/do-runner/pubsub.d.ts +18 -0
  75. package/dist/do-runner/pubsub.d.ts.map +1 -0
  76. package/dist/do-runner/pubsub.js +42 -0
  77. package/dist/do-runner/pubsub.js.map +1 -0
  78. package/dist/do-runner/runtime.d.ts +24 -0
  79. package/dist/do-runner/runtime.d.ts.map +1 -1
  80. package/dist/do-runner/runtime.js +29 -2
  81. package/dist/do-runner/runtime.js.map +1 -1
  82. package/dist/do-runner/thread-do.d.ts +74 -0
  83. package/dist/do-runner/thread-do.d.ts.map +1 -0
  84. package/dist/do-runner/thread-do.js +156 -0
  85. package/dist/do-runner/thread-do.js.map +1 -0
  86. package/dist/do-runner/thread-header.d.ts +16 -0
  87. package/dist/do-runner/thread-header.d.ts.map +1 -0
  88. package/dist/do-runner/thread-header.js +24 -0
  89. package/dist/do-runner/thread-header.js.map +1 -0
  90. package/dist/goals/index.d.ts +2 -0
  91. package/dist/goals/index.d.ts.map +1 -0
  92. package/dist/goals/index.js +7 -0
  93. package/dist/goals/index.js.map +1 -0
  94. package/dist/goals/objective-routes.d.ts +87 -0
  95. package/dist/goals/objective-routes.d.ts.map +1 -0
  96. package/dist/goals/objective-routes.js +375 -0
  97. package/dist/goals/objective-routes.js.map +1 -0
  98. package/dist/host-kit/approval-bridge.d.ts +24 -4
  99. package/dist/host-kit/approval-bridge.d.ts.map +1 -1
  100. package/dist/host-kit/approval-bridge.js +32 -10
  101. package/dist/host-kit/approval-bridge.js.map +1 -1
  102. package/dist/host-kit/env-vars.d.ts +20 -0
  103. package/dist/host-kit/env-vars.d.ts.map +1 -1
  104. package/dist/host-kit/env-vars.js +30 -0
  105. package/dist/host-kit/env-vars.js.map +1 -1
  106. package/dist/host-kit/flowsafe-worker.d.ts +111 -4
  107. package/dist/host-kit/flowsafe-worker.d.ts.map +1 -1
  108. package/dist/host-kit/flowsafe-worker.js +253 -63
  109. package/dist/host-kit/flowsafe-worker.js.map +1 -1
  110. package/dist/host-kit/index.d.ts +3 -1
  111. package/dist/host-kit/index.d.ts.map +1 -1
  112. package/dist/host-kit/index.js +7 -0
  113. package/dist/host-kit/index.js.map +1 -1
  114. package/dist/host-kit/memory-boundary.d.ts +64 -0
  115. package/dist/host-kit/memory-boundary.d.ts.map +1 -0
  116. package/dist/host-kit/memory-boundary.js +109 -0
  117. package/dist/host-kit/memory-boundary.js.map +1 -0
  118. package/dist/host-kit/route-path.d.ts +17 -0
  119. package/dist/host-kit/route-path.d.ts.map +1 -0
  120. package/dist/host-kit/route-path.js +35 -0
  121. package/dist/host-kit/route-path.js.map +1 -0
  122. package/dist/host-kit/thread-topology.d.ts +44 -0
  123. package/dist/host-kit/thread-topology.d.ts.map +1 -0
  124. package/dist/host-kit/thread-topology.js +76 -0
  125. package/dist/host-kit/thread-topology.js.map +1 -0
  126. package/dist/index.d.ts +3 -3
  127. package/dist/index.d.ts.map +1 -1
  128. package/dist/index.js +1 -1
  129. package/dist/index.js.map +1 -1
  130. package/dist/internal-error-response.d.ts +3 -0
  131. package/dist/internal-error-response.d.ts.map +1 -0
  132. package/dist/internal-error-response.js +20 -0
  133. package/dist/internal-error-response.js.map +1 -0
  134. package/dist/numeric-config.d.ts +4 -0
  135. package/dist/numeric-config.d.ts.map +1 -0
  136. package/dist/numeric-config.js +23 -0
  137. package/dist/numeric-config.js.map +1 -0
  138. package/dist/schedules/index.d.ts +5 -0
  139. package/dist/schedules/index.d.ts.map +1 -0
  140. package/dist/schedules/index.js +13 -0
  141. package/dist/schedules/index.js.map +1 -0
  142. package/dist/schedules/router.d.ts +66 -0
  143. package/dist/schedules/router.d.ts.map +1 -0
  144. package/dist/schedules/router.js +827 -0
  145. package/dist/schedules/router.js.map +1 -0
  146. package/dist/schedules/schedules-d1.d.ts +30 -0
  147. package/dist/schedules/schedules-d1.d.ts.map +1 -0
  148. package/dist/schedules/schedules-d1.js +374 -0
  149. package/dist/schedules/schedules-d1.js.map +1 -0
  150. package/dist/schedules/storage.d.ts +11 -0
  151. package/dist/schedules/storage.d.ts.map +1 -0
  152. package/dist/schedules/storage.js +34 -0
  153. package/dist/schedules/storage.js.map +1 -0
  154. package/dist/schedules/tick.d.ts +131 -0
  155. package/dist/schedules/tick.d.ts.map +1 -0
  156. package/dist/schedules/tick.js +598 -0
  157. package/dist/schedules/tick.js.map +1 -0
  158. package/dist/signal-providers/delivery.d.ts +24 -0
  159. package/dist/signal-providers/delivery.d.ts.map +1 -0
  160. package/dist/signal-providers/delivery.js +62 -0
  161. package/dist/signal-providers/delivery.js.map +1 -0
  162. package/dist/signal-providers/github-provider.d.ts +33 -0
  163. package/dist/signal-providers/github-provider.d.ts.map +1 -0
  164. package/dist/signal-providers/github-provider.js +116 -0
  165. package/dist/signal-providers/github-provider.js.map +1 -0
  166. package/dist/signal-providers/host-do.d.ts +79 -0
  167. package/dist/signal-providers/host-do.d.ts.map +1 -0
  168. package/dist/signal-providers/host-do.js +216 -0
  169. package/dist/signal-providers/host-do.js.map +1 -0
  170. package/dist/signal-providers/index.d.ts +7 -0
  171. package/dist/signal-providers/index.d.ts.map +1 -0
  172. package/dist/signal-providers/index.js +19 -0
  173. package/dist/signal-providers/index.js.map +1 -0
  174. package/dist/signal-providers/provider.d.ts +92 -0
  175. package/dist/signal-providers/provider.d.ts.map +1 -0
  176. package/dist/signal-providers/provider.js +87 -0
  177. package/dist/signal-providers/provider.js.map +1 -0
  178. package/dist/signal-providers/subscription-d1.d.ts +88 -0
  179. package/dist/signal-providers/subscription-d1.d.ts.map +1 -0
  180. package/dist/signal-providers/subscription-d1.js +259 -0
  181. package/dist/signal-providers/subscription-d1.js.map +1 -0
  182. package/dist/signal-providers/webhook-route.d.ts +88 -0
  183. package/dist/signal-providers/webhook-route.d.ts.map +1 -0
  184. package/dist/signal-providers/webhook-route.js +391 -0
  185. package/dist/signal-providers/webhook-route.js.map +1 -0
  186. package/dist/signals/client.d.ts +72 -0
  187. package/dist/signals/client.d.ts.map +1 -0
  188. package/dist/signals/client.js +87 -0
  189. package/dist/signals/client.js.map +1 -0
  190. package/dist/signals/d1-shared.d.ts +43 -0
  191. package/dist/signals/d1-shared.d.ts.map +1 -0
  192. package/dist/signals/d1-shared.js +46 -0
  193. package/dist/signals/d1-shared.js.map +1 -0
  194. package/dist/signals/index.d.ts +9 -0
  195. package/dist/signals/index.d.ts.map +1 -0
  196. package/dist/signals/index.js +15 -0
  197. package/dist/signals/index.js.map +1 -0
  198. package/dist/signals/notification-dispatch.d.ts +52 -0
  199. package/dist/signals/notification-dispatch.d.ts.map +1 -0
  200. package/dist/signals/notification-dispatch.js +198 -0
  201. package/dist/signals/notification-dispatch.js.map +1 -0
  202. package/dist/signals/notifications-d1.d.ts +28 -0
  203. package/dist/signals/notifications-d1.d.ts.map +1 -0
  204. package/dist/signals/notifications-d1.js +704 -0
  205. package/dist/signals/notifications-d1.js.map +1 -0
  206. package/dist/signals/router.d.ts +73 -0
  207. package/dist/signals/router.d.ts.map +1 -0
  208. package/dist/signals/router.js +240 -0
  209. package/dist/signals/router.js.map +1 -0
  210. package/dist/signals/storage.d.ts +11 -0
  211. package/dist/signals/storage.d.ts.map +1 -0
  212. package/dist/signals/storage.js +27 -0
  213. package/dist/signals/storage.js.map +1 -0
  214. package/dist/signals/thread-do-routes.d.ts +82 -0
  215. package/dist/signals/thread-do-routes.d.ts.map +1 -0
  216. package/dist/signals/thread-do-routes.js +660 -0
  217. package/dist/signals/thread-do-routes.js.map +1 -0
  218. package/dist/signals/thread-state-d1.d.ts +22 -0
  219. package/dist/signals/thread-state-d1.d.ts.map +1 -0
  220. package/dist/signals/thread-state-d1.js +83 -0
  221. package/dist/signals/thread-state-d1.js.map +1 -0
  222. package/package.json +11 -2
@@ -3,10 +3,11 @@ export { bearerActorAuthenticator, parseActorTokens } from './bearer-auth.js';
3
3
  export { type DoResponseLike, doSummary } from './do-response.js';
4
4
  export { createDoRunTopology, type DoRunTopology, type RunnerNamespaceLike, type RunnerStubLike, } from './do-run-topology.js';
5
5
  export { boolVar, type NumberVarOptions, numberVar } from './env-vars.js';
6
- export type { FlowsafeWorker, FlowsafeWorkerConfig, FlowsafeWorkerContext, FlowsafeWorkerEnv, } from './flowsafe-worker.js';
6
+ export type { BackgroundTasksCleanupConfig, FlowsafeWorker, FlowsafeWorkerConfig, FlowsafeWorkerContext, FlowsafeWorkerEnv, } from './flowsafe-worker.js';
7
7
  export { createFlowsafeWorker } from './flowsafe-worker.js';
8
8
  export { type ApprovalRetentionPurgeOptions, approvalStoreFactoryFor, buildHostApprovalService, type HostApprovalServiceOptions, maintenanceActor, reconcileApprovalsOnStatusDetached, runApprovalRetentionPurge, runSlaSweepMaintenance, type SlaSweepMaintenanceOptions, } from './host-approval-service.js';
9
9
  export { createHubTopology, type HubNamespaceLike, type HubStubLike, type HubTopology, } from './hub-topology.js';
10
+ export { assertNoClientMemoryIds, requireOwnedMemoryId, TCB_ONLY_MEMORY_FIELDS, type TcbOnlyMemoryField, } from './memory-boundary.js';
10
11
  export type { WorkflowIdSource } from './registration.js';
11
12
  export { assertWorkflowsRegistered } from './registration.js';
12
13
  export { RunRouteError } from './run-route-error.js';
@@ -20,6 +21,7 @@ export type { SubdomainCrossCheckOptions } from './subdomain-check.js';
20
21
  export { withSubdomainCrossCheck } from './subdomain-check.js';
21
22
  export type { ProvisionTenantOptions, TenantRegistryDatabase, TenantRegistryStatement, } from './tenant-registry.js';
22
23
  export { provisionTenant, RESERVED_FOR_ALLOCATION, RESERVED_TENANT_IDS, TenantCollisionError, } from './tenant-registry.js';
24
+ export { createThreadTopology, type ThreadNamespaceLike, type ThreadRequestInit, type ThreadStubLike, type ThreadTopology, } from './thread-topology.js';
23
25
  export type { HmacVerifierOptions, MintHmacTokenOptions, TokenVerifier, } from './verifier.js';
24
26
  export { base64UrlEncode, hmacSign, hmacVerifier, mintHmacToken, staticTokenVerifier, toApprovalActor, } from './verifier.js';
25
27
  export type { WorkflowMeta } from './workflow-meta.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/host-kit/index.ts"],"names":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MAAM,sBAAsB,CAAC;AAC/D,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
@@ -25,6 +25,9 @@ export { createFlowsafeWorker } from './flowsafe-worker.js';
25
25
  // directly.
26
26
  export { approvalStoreFactoryFor, buildHostApprovalService, maintenanceActor, reconcileApprovalsOnStatusDetached, runApprovalRetentionPurge, runSlaSweepMaintenance, } from './host-approval-service.js';
27
27
  export { createHubTopology, } from './hub-topology.js';
28
+ // The agent-memory host boundary every memory-touching route calls
29
+ // (docs/agent-memory-tenancy.md item 5).
30
+ export { assertNoClientMemoryIds, requireOwnedMemoryId, TCB_ONLY_MEMORY_FIELDS, } from './memory-boundary.js';
28
31
  export { assertWorkflowsRegistered } from './registration.js';
29
32
  export { RunRouteError } from './run-route-error.js';
30
33
  export { createRunRouter } from './run-router.js';
@@ -35,5 +38,9 @@ export { mintStreamTicket, verifyStreamTicket } from './stream-ticket.js';
35
38
  // withSubdomainCrossCheck, and no host consumes them directly.
36
39
  export { withSubdomainCrossCheck } from './subdomain-check.js';
37
40
  export { provisionTenant, RESERVED_FOR_ALLOCATION, RESERVED_TENANT_IDS, TenantCollisionError, } from './tenant-registry.js';
41
+ // The sanctioned way to reach a thread DO: it MINTS the tenant header
42
+ // ThreadDurableObject verifies, so a route never forwards a client's own
43
+ // (see thread-topology.ts — mint and verify ship together).
44
+ export { createThreadTopology, } from './thread-topology.js';
38
45
  export { base64UrlEncode, hmacSign, hmacVerifier, mintHmacToken, staticTokenVerifier, toApprovalActor, } from './verifier.js';
39
46
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/host-kit/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,4EAA4E;AAC5E,4EAA4E;AAC5E,gFAAgF;AAChF,6EAA6E;AAC7E,+EAA+E;AAC/E,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,mFAAmF;AACnF,0EAA0E;AAC1E,iFAAiF;AACjF,wEAAwE;AACxE,4EAA4E;AAC5E,+EAA+E;AAE/E,OAAO,EACL,0BAA0B,EAE1B,4BAA4B,EAC5B,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAuB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EACL,mBAAmB,GAIpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAyB,SAAS,EAAE,MAAM,eAAe,CAAC;AAO1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,6DAA6D;AAC7D,yDAAyD;AACzD,6EAA6E;AAC7E,YAAY;AACZ,OAAO,EAEL,uBAAuB,EACvB,wBAAwB,EAExB,gBAAgB,EAChB,kCAAkC,EAClC,yBAAyB,EACzB,sBAAsB,GAEvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,iBAAiB,GAIlB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAA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EAA6E;AAC7E,YAAY;AACZ,OAAO,EAEL,uBAAuB,EACvB,wBAAwB,EAExB,gBAAgB,EAChB,kCAAkC,EAClC,yBAAyB,EACzB,sBAAsB,GAEvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,iBAAiB,GAIlB,MAAM,mBAAmB,CAAC;AAC3B,mEAAmE;AACnE,yCAAyC;AACzC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,GAEvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAOxD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,6EAA6E;AAC7E,+DAA+D;AAC/D,+DAA+D;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAM/D,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,sEAAsE;AACtE,yEAAyE;AACzE,4DAA4D;AAC5D,OAAO,EACL,oBAAoB,GAKrB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EACL,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,eAAe,GAChB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,64 @@
1
+ import type { TenantContext } from '../approval-api/index.js';
2
+ /**
3
+ * The memory-id fields no client body may name — the TCB_ONLY_CREATE_FIELDS
4
+ * doctrine applied to memory: a client that picks its own threadId/resourceId
5
+ * picks whose memory it reads, so these are minted server-side or not at all.
6
+ */
7
+ export declare const TCB_ONLY_MEMORY_FIELDS: readonly ["threadId", "resourceId"];
8
+ export type TcbOnlyMemoryField = (typeof TCB_ONLY_MEMORY_FIELDS)[number];
9
+ /**
10
+ * Refuse a request body that names a memory id ANYWHERE in it. 400 rather than
11
+ * a silent override, for the same reason the run router 400s a client runId: a
12
+ * caller pinning ids must find out, not watch its value get quietly replaced and
13
+ * conclude the field works.
14
+ *
15
+ * NESTED, not just top-level, because the shape the first real consumer sends is
16
+ * nested: an agent run starts through `POST /runs` as
17
+ * `{workflowId, inputData: {...}}`, so the natural body for a threaded run is
18
+ * `{inputData: {threadId, prompt}}` — a top-level-only check would pass exactly
19
+ * the request this guard exists to refuse. A legitimate payload never carries a
20
+ * memory id (that is the whole doctrine: they are minted server-side and travel
21
+ * through requestContext, never a body), so refusing the name at any depth costs
22
+ * nothing real and closes the shape the leak actually arrives in.
23
+ *
24
+ * `undefined` is refused along with a value — a body carrying the KEY is a
25
+ * caller that believes it may choose, and the day someone writes
26
+ * `threadId: maybeUndefined` the tolerant reading is a leak waiting on one
27
+ * truthiness bug. Non-object bodies name no field and pass; body SHAPE is each
28
+ * route's own schema business.
29
+ *
30
+ * The walk is ITERATIVE and UNBOUNDED in depth. A depth cap would be a bypass
31
+ * with a number on it — nest one level past it and the id sails through the
32
+ * check — and depth is the attacker's choice, not the route's. Recursion is what
33
+ * a hostile 10k-deep body would actually break (the stack), so the fix is to not
34
+ * recurse: an explicit worklist costs heap proportional to a body JSON.parse has
35
+ * already materialized. A `seen` set keeps a cyclic in-process object (never a
36
+ * parsed body, which cannot cycle) from looping forever.
37
+ *
38
+ * Covers what a JSON body can express. A `Map`'s entries and a non-enumerable
39
+ * property are invisible to it — neither survives JSON.parse, so no HTTP caller
40
+ * can reach them; a route handing this a hand-built in-process object is outside
41
+ * the contract.
42
+ */
43
+ export declare function assertNoClientMemoryIds(body: unknown): void;
44
+ /**
45
+ * Assert the authenticated tenant owns a memory id, returning it for use.
46
+ * 404 — never 403 — on a foreign id: the run router's rule, for the same
47
+ * reason. A 403 would confirm that another tenant's threadId EXISTS, turning
48
+ * every read path into an existence oracle over ids a caller can guess (a
49
+ * resourceId is business identity — an email, a user id — so guessing is the
50
+ * expected case, not a stretch).
51
+ *
52
+ * This is the ONLY thing between a foreign threadId and its history — nothing
53
+ * downstream re-checks. Mastra's recall filters by `resourceId` only when the
54
+ * caller passes one (`if (resourceId) query += ' AND resourceId = ?'`), and core
55
+ * ships recall sites that pass a threadId alone, so a foreign thread recalls in
56
+ * FULL past this point (pinned in do-runner/memory-recall-tenancy.test.ts). Call
57
+ * it on EVERY memory read path; there is no second line.
58
+ *
59
+ * `tenant.ownsMemoryId` is exact rather than a prefix startsWith by luck: INV-3
60
+ * excludes '_' from tenant ids, so 'acme' can never own 'acmecorp_...'
61
+ * (do-runner/path-safe-id.ts).
62
+ */
63
+ export declare function requireOwnedMemoryId(tenant: TenantContext, id: string, label?: TcbOnlyMemoryField): string;
64
+ //# sourceMappingURL=memory-boundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-boundary.d.ts","sourceRoot":"","sources":["../../src/host-kit/memory-boundary.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,qCAAsC,CAAC;AAE1E,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAsB3D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,MAAM,EACV,KAAK,GAAE,kBAA+B,GACrC,MAAM,CAKR"}
@@ -0,0 +1,109 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // The agent-memory host boundary (docs/agent-memory-tenancy.md item 5) — the
3
+ // memory analogue of createRunRouter's "runId is server-assigned" 400 and its
4
+ // ownership 404, factored out because memory ids reach the boundary through
5
+ // MANY routes (Track A's agent runs, Track C's signals, Track D's threaded
6
+ // schedule fires) where a runId reaches exactly one.
7
+ //
8
+ // Why a shared seam rather than the check inline in each router: threadId and
9
+ // resourceId are Mastra's CALLER-CHOSEN business identity (a user id, an email,
10
+ // a conversation slug), so the natural route body carries them and the natural
11
+ // handler trusts them — that is the leak, and it reads like ordinary code on
12
+ // every new route. One named, tested guard that every memory-touching route
13
+ // calls is the only version of this that survives contact with the fifth route.
14
+ //
15
+ // It lives in host-kit, not do-runner/memory-id.ts (which owns the mints and the
16
+ // pure ownership predicate), for two reasons: the guard's contract IS its HTTP
17
+ // status — RunRouteError carries the 400/404 the doctrine names, so a route
18
+ // gets the posture by calling it rather than by remembering to map an error —
19
+ // and TenantContext lives in approval-api, which already imports do-runner
20
+ // (a do-runner guard taking a TenantContext would invert that layering).
21
+ import { RunRouteError } from './run-route-error.js';
22
+ /**
23
+ * The memory-id fields no client body may name — the TCB_ONLY_CREATE_FIELDS
24
+ * doctrine applied to memory: a client that picks its own threadId/resourceId
25
+ * picks whose memory it reads, so these are minted server-side or not at all.
26
+ */
27
+ export const TCB_ONLY_MEMORY_FIELDS = ['threadId', 'resourceId'];
28
+ /**
29
+ * Refuse a request body that names a memory id ANYWHERE in it. 400 rather than
30
+ * a silent override, for the same reason the run router 400s a client runId: a
31
+ * caller pinning ids must find out, not watch its value get quietly replaced and
32
+ * conclude the field works.
33
+ *
34
+ * NESTED, not just top-level, because the shape the first real consumer sends is
35
+ * nested: an agent run starts through `POST /runs` as
36
+ * `{workflowId, inputData: {...}}`, so the natural body for a threaded run is
37
+ * `{inputData: {threadId, prompt}}` — a top-level-only check would pass exactly
38
+ * the request this guard exists to refuse. A legitimate payload never carries a
39
+ * memory id (that is the whole doctrine: they are minted server-side and travel
40
+ * through requestContext, never a body), so refusing the name at any depth costs
41
+ * nothing real and closes the shape the leak actually arrives in.
42
+ *
43
+ * `undefined` is refused along with a value — a body carrying the KEY is a
44
+ * caller that believes it may choose, and the day someone writes
45
+ * `threadId: maybeUndefined` the tolerant reading is a leak waiting on one
46
+ * truthiness bug. Non-object bodies name no field and pass; body SHAPE is each
47
+ * route's own schema business.
48
+ *
49
+ * The walk is ITERATIVE and UNBOUNDED in depth. A depth cap would be a bypass
50
+ * with a number on it — nest one level past it and the id sails through the
51
+ * check — and depth is the attacker's choice, not the route's. Recursion is what
52
+ * a hostile 10k-deep body would actually break (the stack), so the fix is to not
53
+ * recurse: an explicit worklist costs heap proportional to a body JSON.parse has
54
+ * already materialized. A `seen` set keeps a cyclic in-process object (never a
55
+ * parsed body, which cannot cycle) from looping forever.
56
+ *
57
+ * Covers what a JSON body can express. A `Map`'s entries and a non-enumerable
58
+ * property are invisible to it — neither survives JSON.parse, so no HTTP caller
59
+ * can reach them; a route handing this a hand-built in-process object is outside
60
+ * the contract.
61
+ */
62
+ export function assertNoClientMemoryIds(body) {
63
+ const worklist = [body];
64
+ const seen = new Set();
65
+ while (worklist.length > 0) {
66
+ const value = worklist.pop();
67
+ if (typeof value !== 'object' || value === null)
68
+ continue;
69
+ if (seen.has(value))
70
+ continue;
71
+ seen.add(value);
72
+ if (Array.isArray(value)) {
73
+ worklist.push(...value);
74
+ continue;
75
+ }
76
+ for (const field of TCB_ONLY_MEMORY_FIELDS) {
77
+ if (field in value) {
78
+ throw new RunRouteError(400, `${field} is server-assigned (agent-memory ids are minted from the authenticated tenant — see docs/agent-memory-tenancy.md)`);
79
+ }
80
+ }
81
+ worklist.push(...Object.values(value));
82
+ }
83
+ }
84
+ /**
85
+ * Assert the authenticated tenant owns a memory id, returning it for use.
86
+ * 404 — never 403 — on a foreign id: the run router's rule, for the same
87
+ * reason. A 403 would confirm that another tenant's threadId EXISTS, turning
88
+ * every read path into an existence oracle over ids a caller can guess (a
89
+ * resourceId is business identity — an email, a user id — so guessing is the
90
+ * expected case, not a stretch).
91
+ *
92
+ * This is the ONLY thing between a foreign threadId and its history — nothing
93
+ * downstream re-checks. Mastra's recall filters by `resourceId` only when the
94
+ * caller passes one (`if (resourceId) query += ' AND resourceId = ?'`), and core
95
+ * ships recall sites that pass a threadId alone, so a foreign thread recalls in
96
+ * FULL past this point (pinned in do-runner/memory-recall-tenancy.test.ts). Call
97
+ * it on EVERY memory read path; there is no second line.
98
+ *
99
+ * `tenant.ownsMemoryId` is exact rather than a prefix startsWith by luck: INV-3
100
+ * excludes '_' from tenant ids, so 'acme' can never own 'acmecorp_...'
101
+ * (do-runner/path-safe-id.ts).
102
+ */
103
+ export function requireOwnedMemoryId(tenant, id, label = 'threadId') {
104
+ if (typeof id !== 'string' || !tenant.ownsMemoryId(id)) {
105
+ throw new RunRouteError(404, `${label} not found`);
106
+ }
107
+ return id;
108
+ }
109
+ //# sourceMappingURL=memory-boundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-boundary.js","sourceRoot":"","sources":["../../src/host-kit/memory-boundary.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,2EAA2E;AAC3E,qDAAqD;AACrD,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,6EAA6E;AAC7E,4EAA4E;AAC5E,gFAAgF;AAChF,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,yEAAyE;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,YAAY,CAAU,CAAC;AAI1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAa;IACnD,MAAM,QAAQ,GAAc,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC;QAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;YAAE,SAAS;QAC1D,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,SAAS;QAC9B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAChB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;YACxB,SAAS;QACX,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,sBAAsB,EAAE,CAAC;YAC3C,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;gBACnB,MAAM,IAAI,aAAa,CACrB,GAAG,EACH,GAAG,KAAK,oHAAoH,CAC7H,CAAC;YACJ,CAAC;QACH,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAqB,EACrB,EAAU,EACV,QAA4B,UAAU;IAEtC,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,aAAa,CAAC,GAAG,EAAE,GAAG,KAAK,YAAY,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Decode a URL path segment, returning `undefined` on malformed percent-encoding
3
+ * (a lone `%`) instead of THROWING the way bare `decodeURIComponent` does.
4
+ *
5
+ * `new URL(...).pathname` passes an invalid `%` through unnormalized, so an
6
+ * unguarded `decodeURIComponent` inside a router would be a PRE-AUTH fault: the
7
+ * `URIError` escapes the router before authentication. This is the PRIMARY,
8
+ * source-level defense — callers treat `undefined` as "not a real route target"
9
+ * and return route-absent (`null`), byte-identical to a non-matching path, so a
10
+ * malformed id is indistinguishable from a path that was never ours (strictly
11
+ * better than surfacing a generic 500). `createFlowsafeWorker`'s fetch handler
12
+ * additionally wraps the router calls in a try/catch as defense-in-depth, so any
13
+ * future unguarded decode is still contained as a generic 500 rather than
14
+ * rejecting out of `fetch()`.
15
+ */
16
+ export declare function safeDecodeSegment(segment: string | undefined): string | undefined;
17
+ //# sourceMappingURL=route-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-path.d.ts","sourceRoot":"","sources":["../../src/host-kit/route-path.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,MAAM,GAAG,SAAS,CAOpB"}
@@ -0,0 +1,35 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // A routing primitive shared by every P6 ingestion router: decode a URL path
3
+ // segment without letting malformed percent-encoding crash the handler.
4
+ //
5
+ // A zero-dependency leaf, imported directly by the routers that need it
6
+ // (signals / goals / schedules / signal-providers / background-tasks) rather
7
+ // than re-exported from the host-kit barrel — it is internal plumbing, not a
8
+ // public host-kit API, and staying a leaf keeps it cycle-free (the same reason
9
+ // RunRouteError is a leaf).
10
+ /**
11
+ * Decode a URL path segment, returning `undefined` on malformed percent-encoding
12
+ * (a lone `%`) instead of THROWING the way bare `decodeURIComponent` does.
13
+ *
14
+ * `new URL(...).pathname` passes an invalid `%` through unnormalized, so an
15
+ * unguarded `decodeURIComponent` inside a router would be a PRE-AUTH fault: the
16
+ * `URIError` escapes the router before authentication. This is the PRIMARY,
17
+ * source-level defense — callers treat `undefined` as "not a real route target"
18
+ * and return route-absent (`null`), byte-identical to a non-matching path, so a
19
+ * malformed id is indistinguishable from a path that was never ours (strictly
20
+ * better than surfacing a generic 500). `createFlowsafeWorker`'s fetch handler
21
+ * additionally wraps the router calls in a try/catch as defense-in-depth, so any
22
+ * future unguarded decode is still contained as a generic 500 rather than
23
+ * rejecting out of `fetch()`.
24
+ */
25
+ export function safeDecodeSegment(segment) {
26
+ if (segment === undefined)
27
+ return undefined;
28
+ try {
29
+ return decodeURIComponent(segment);
30
+ }
31
+ catch {
32
+ return undefined;
33
+ }
34
+ }
35
+ //# sourceMappingURL=route-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-path.js","sourceRoot":"","sources":["../../src/host-kit/route-path.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,6EAA6E;AAC7E,wEAAwE;AACxE,EAAE;AACF,wEAAwE;AACxE,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,4BAA4B;AAE5B;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAA2B;IAE3B,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5C,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { TenantContext } from '../approval-api/index.js';
2
+ /**
3
+ * The subset of a DurableObjectStub the thread topology uses. The raw-`Request`
4
+ * overload is what lets a WebSocket UPGRADE forward through the stub unchanged;
5
+ * the string/init overload carries ordinary JSON routes.
6
+ */
7
+ export interface ThreadStubLike {
8
+ fetch(request: Request): Promise<Response>;
9
+ fetch(url: string, init?: {
10
+ method?: string;
11
+ headers?: Record<string, string>;
12
+ body?: string;
13
+ }): Promise<Response>;
14
+ }
15
+ /** The subset of a DurableObjectNamespace the thread topology uses. */
16
+ export interface ThreadNamespaceLike<Id = unknown> {
17
+ idFromName(name: string): Id;
18
+ get(id: Id): ThreadStubLike;
19
+ }
20
+ /** What `send` carries beyond the sanctioned header — a route's own payload. */
21
+ export interface ThreadRequestInit {
22
+ method?: string;
23
+ headers?: Record<string, string>;
24
+ body?: string;
25
+ }
26
+ export interface ThreadTopology {
27
+ /**
28
+ * Send an authenticated request to a thread DO. `path` is the DO-side route
29
+ * (e.g. `/messages`). Throws RunRouteError(404) when the tenant does not own
30
+ * `threadId` — before the DO is addressed, so a foreign thread is never even
31
+ * woken, and the caller surfaces the 404 its router already maps.
32
+ */
33
+ send(tenant: TenantContext, threadId: string, path: string, init?: ThreadRequestInit): Promise<Response>;
34
+ /**
35
+ * Forward a client Request (e.g. a verified WebSocket upgrade) to a thread DO,
36
+ * with the tenant header OVERWRITTEN from the authenticated context. Same
37
+ * ownership 404 as `send`. Use this instead of `stub.fetch(request)`: a
38
+ * verbatim forward carries the client's own headers, including a forged
39
+ * `x-flowsafe-tenant`.
40
+ */
41
+ forward(tenant: TenantContext, threadId: string, request: Request): Promise<Response>;
42
+ }
43
+ export declare function createThreadTopology<Id>(namespace: ThreadNamespaceLike<Id>): ThreadTopology;
44
+ //# sourceMappingURL=thread-topology.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thread-topology.d.ts","sourceRoot":"","sources":["../../src/host-kit/thread-topology.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAO9D;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3C,KAAK,CACH,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GACA,OAAO,CAAC,QAAQ,CAAC,CAAC;CACtB;AAED,uEAAuE;AACvE,MAAM,WAAW,mBAAmB,CAAC,EAAE,GAAG,OAAO;IAC/C,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,EAAE,CAAC;IAC7B,GAAG,CAAC,EAAE,EAAE,EAAE,GAAG,cAAc,CAAC;CAC7B;AAED,gFAAgF;AAChF,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,IAAI,CACF,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,iBAAiB,GACvB,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrB;;;;;;OAMG;IACH,OAAO,CACL,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,QAAQ,CAAC,CAAC;CACtB;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EACrC,SAAS,EAAE,mBAAmB,CAAC,EAAE,CAAC,GACjC,cAAc,CAmDhB"}
@@ -0,0 +1,76 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // The per-thread DO topology seam — and the MINTER for the tenant header
3
+ // ThreadDurableObject verifies (DL-002). Mint and verify ship together, the same
4
+ // posture stream-ticket.ts takes, because a verifier whose input the caller can
5
+ // write is not a check.
6
+ //
7
+ // THE TRAP THIS EXISTS TO CLOSE. The house idiom for forwarding into a DO is
8
+ // hub-topology.ts's `forwardSubscribe: (tenantId, request) => stub(tenantId)
9
+ // .fetch(request)` — the CLIENT's Request, headers and all. That is safe for the
10
+ // hub, which trusts the forwarded request for nothing (it re-asserts
11
+ // event.record.tenantId against its own id.name from server-side data). A thread
12
+ // route copying that shape would hand the client the very header the thread DO
13
+ // authenticates on: `x-flowsafe-tenant: <victim>` and the assertion passes. So
14
+ // this module, not the caller, decides the header's value — on EVERY path,
15
+ // including forwarded upgrades, where it OVERWRITES rather than defaults.
16
+ //
17
+ // Reach a thread DO through here. A route that addresses the namespace itself
18
+ // re-opens the hole, so the namespace-shaped seam is deliberately not re-exported
19
+ // for ad-hoc use: `send`/`forward` are the sanctioned surface, and both refuse a
20
+ // threadId the caller's tenant does not own BEFORE the DO is ever addressed.
21
+ //
22
+ // Structural namespace/stub types (method syntax, so a real
23
+ // DurableObjectNamespace satisfies them under TS method-parameter bivariance),
24
+ // keeping host-kit free of @cloudflare/workers-types — same convention as
25
+ // RunnerNamespaceLike / HubNamespaceLike.
26
+ import { THREAD_ACTOR_HEADER, THREAD_TENANT_HEADER, } from '../do-runner/index.js';
27
+ import { requireOwnedMemoryId } from './memory-boundary.js';
28
+ export function createThreadTopology(namespace) {
29
+ // One DO per thread: id.name IS the tenant-minted threadId, so the instance
30
+ // carries its tenant exactly like a runId carries its own (DL-002).
31
+ const stub = (threadId) => namespace.get(namespace.idFromName(threadId));
32
+ // Ownership FIRST, then address. Both barriers are load-bearing and neither
33
+ // subsumes the other: this 404 is what stops tenant B reaching tenant A's
34
+ // thread at all, and the header the DO re-asserts is what stops a routing bug
35
+ // here from being the only thing between them.
36
+ const owned = (tenant, threadId) => requireOwnedMemoryId(tenant, threadId, 'threadId');
37
+ // Both surfaces are `async` so the ownership refusal REJECTS rather than
38
+ // throwing synchronously out of a Promise-typed call: a caller writing
39
+ // `topology.send(...).catch(handle)` would never see a sync throw, and the
40
+ // 404 would escape past the very handler meant to map it.
41
+ return {
42
+ send: async (tenant, threadId, path, init = {}) => {
43
+ // Merge through Headers so the stamp wins by case-INSENSITIVE name. A
44
+ // plain-object spread keeps a caller's `X-Flowsafe-Tenant` as a SECOND
45
+ // property; Headers' fill algorithm then appends both into `globex, acme`,
46
+ // which the DO reads as claimed !== tenantId — a 403 that looks like an
47
+ // identity attack (fail-closed, but the wrong error and a false
48
+ // "spelling cannot win" story). `set` is the primitive `forward` already
49
+ // relies on; it overwrites at every spelling. The value is the RESOLVED
50
+ // tenant context (authenticate -> INV-3 -> bind), never a header or body.
51
+ const merged = new Headers(init.headers);
52
+ merged.set(THREAD_TENANT_HEADER, tenant.tenantId);
53
+ merged.set(THREAD_ACTOR_HEADER, tenant.actor.id);
54
+ const headers = {};
55
+ merged.forEach((value, key) => {
56
+ headers[key] = value;
57
+ });
58
+ return stub(owned(tenant, threadId)).fetch(`http://thread${path}`, {
59
+ ...init,
60
+ headers,
61
+ });
62
+ },
63
+ forward: async (tenant, threadId, request) => {
64
+ const addressed = owned(tenant, threadId);
65
+ // A cloned Request has MUTABLE headers where an inbound one does not, so
66
+ // this is what lets the overwrite happen at all — and `set` (not `append`)
67
+ // is what makes a forged client value vanish rather than ride along as a
68
+ // second value the DO might read.
69
+ const forwarded = new Request(request);
70
+ forwarded.headers.set(THREAD_TENANT_HEADER, tenant.tenantId);
71
+ forwarded.headers.set(THREAD_ACTOR_HEADER, tenant.actor.id);
72
+ return stub(addressed).fetch(forwarded);
73
+ },
74
+ };
75
+ }
76
+ //# sourceMappingURL=thread-topology.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thread-topology.js","sourceRoot":"","sources":["../../src/host-kit/thread-topology.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,iFAAiF;AACjF,gFAAgF;AAChF,wBAAwB;AACxB,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,iFAAiF;AACjF,qEAAqE;AACrE,iFAAiF;AACjF,+EAA+E;AAC/E,+EAA+E;AAC/E,2EAA2E;AAC3E,0EAA0E;AAC1E,EAAE;AACF,8EAA8E;AAC9E,kFAAkF;AAClF,iFAAiF;AACjF,6EAA6E;AAC7E,EAAE;AACF,4DAA4D;AAC5D,+EAA+E;AAC/E,0EAA0E;AAC1E,0CAA0C;AAG1C,OAAO,EACL,mBAAmB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AE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,IAAI,EAAE,EAAE;gBACjE,GAAG,IAAI;gBACP,OAAO;aACR,CAAC,CAAC;QACL,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;YAC3C,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAC1C,yEAAyE;YACzE,2EAA2E;YAC3E,yEAAyE;YACzE,kCAAkC;YAClC,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;YACvC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC7D,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC5D,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC1C,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export type { ApprovalActor, ApprovalAuditEvent, ApprovalAuditSink, ApprovalCursor, ApprovalDatabase, ApprovalDecision, ApprovalListFilter, ApprovalListOrder, ApprovalMetrics, ApprovalNotificationEvent, ApprovalNotificationSink, ApprovalPatch, ApprovalPreparedStatement, ApprovalPriority, ApprovalRecord, ApprovalRole, ApprovalRouter, ApprovalRouterOptions, ApprovalServiceOptions, ApprovalStatus, ApprovalStore, ApprovalStoreFactory, ApprovalStreamEvent, ApprovalStreamSink, BatchDecideItem, BatchDecideResult, CreateApprovalInput, CreateResult, CreateTenantResolverOptions, DecideResult, PurgeExpiredApprovalsOptions, ResumeOutcome, SelfDecisionPolicy, SweepSLAOptions, SystemApprovalStore, TenantBoundApprovalStore, TenantContext, TenantResolver, } from './approval-api/index.js';
1
+ export type { ApprovalActor, ApprovalAuditEvent, ApprovalAuditSink, ApprovalCursor, ApprovalDatabase, ApprovalDecision, ApprovalListFilter, ApprovalListOrder, ApprovalMetrics, ApprovalNotificationEvent, ApprovalNotificationSink, ApprovalPatch, ApprovalPreparedStatement, ApprovalPriority, ApprovalRecord, ApprovalResumeTarget, ApprovalRole, ApprovalRouter, ApprovalRouterOptions, ApprovalServiceOptions, ApprovalStatus, ApprovalStore, ApprovalStoreFactory, ApprovalStreamEvent, ApprovalStreamSink, BatchDecideItem, BatchDecideResult, CreateApprovalInput, CreateResult, CreateTenantResolverOptions, DecideResult, PurgeExpiredApprovalsOptions, ResumeOutcome, SelfDecisionPolicy, SweepSLAOptions, SystemApprovalStore, TenantBoundApprovalStore, TenantContext, TenantResolver, } from './approval-api/index.js';
2
2
  export { APPROVAL_LIST_ORDERS, APPROVAL_PRIORITIES, APPROVAL_ROLES, APPROVAL_STATUSES, ApprovalAuthzError, ApprovalConflictError, ApprovalService, approvalCursor, approvalGrantProvider, approvalGrantProviderFromFactory, approvalListOrder, approvedConnectorsForLeg, BREAKWATER_ACTOR_KEY, BREAKWATER_APPROVED_CONNECTORS_KEY, BREAKWATER_WORKFLOW_SCOPE_KEY, byReviewerOrder, CLIENT_CREATE_FIELDS, createApprovalRouter, createTenantResolver, D1ApprovalStoreFactory, DECIDER_ROLES, defaultResumeData, InMemoryApprovalStore, InMemoryApprovalStoreFactory, InvalidApprovalInputError, MAX_APPROVAL_BATCH_DECIDE, MAX_APPROVAL_LIST_LIMIT, OPEN_STATUSES, parseApprovalCursor, purgeExpiredApprovals, RUN_START_ROLES, resumeViaRuntime, selfDecisionExempts, stepKeyOf, sweepSLA, TCB_ONLY_CREATE_FIELDS, TENANT_BOUND, TERMINAL_APPROVAL_STATUSES, TenantResolutionError, UnknownApprovalError, } from './approval-api/index.js';
3
3
  export type { ArtifactBody, ArtifactBucket, ArtifactBucketListResult, ArtifactBucketObject, ArtifactBucketObjectBody, ArtifactContent, ArtifactRecord, ArtifactRef, ListArtifactsScope, PutArtifactOptions, R2ArtifactStoreOptions, } from './artifacts/index.js';
4
4
  export { InMemoryArtifactBucket, InvalidArtifactRefError, R2ArtifactStore, } from './artifacts/index.js';
5
5
  export type { AuditExportFetch, AuditExportOptions, AuditMessageBatch, AuditQueue, AuditQueueMessage, } from './audit-export/index.js';
6
6
  export { createAuditQueueConsumer, createAuditQueueHandler, queueAuditSink, } from './audit-export/index.js';
7
- export type { D1DatabaseBinding, D1StorageOptions, DORunnerEnv, DurableObjectRunnerState, InitOptions, InitResult, InitSource, PurgeExpiredRunsOptions, PurgeTenantOptions, PurgeTenantResult, RequestContextProvider, ResumeLedger, ResumeLedgerStorage, ResumeRunOptions, RunLeg, RunnerRuntimeOptions, RunSummary, SnapshotDatabase, SnapshotStatement, StartRunOptions, TenantArtifactPurger, } from './do-runner/index.js';
8
- export { createD1Storage, DurableObjectRunner, DurableStorageResumeLedger, d1Changes, ensureSnapshotRunIdIndex, InMemoryResumeLedger, InvalidRunRequestError, init, mintResourceId, mintThreadId, PATH_SAFE_ID_PATTERN, purgeExpiredWorkflowRuns, purgeTenant, RunAlreadyExistsError, RunNotSuspendedError, RunnerRuntime, TENANT_ID_PATTERN, tenantOfMemoryId, tenantOfRunId, tenantOwnsMemoryId, UnknownRunError, UnknownWorkflowError, } from './do-runner/index.js';
7
+ export type { D1DatabaseBinding, D1StorageOptions, DORunnerEnv, DurableObjectRunnerState, HostPubSub, InitOptions, InitResult, InitSource, PurgeExpiredBackgroundTasksOptions, PurgeExpiredBackgroundTasksResult, PurgeExpiredRunsOptions, PurgeExpiredThreadsOptions, PurgeExpiredThreadsResult, PurgeTenantOptions, PurgeTenantResult, RequestContextProvider, ResumeLedger, ResumeLedgerStorage, ResumeRunOptions, RunLeg, RunnerRuntimeOptions, RunSummary, SnapshotDatabase, SnapshotStatement, StartRunOptions, TenantArtifactPurger, TenantRangePurgeCounter, TenantRangePurgeTable, ThreadScope, } from './do-runner/index.js';
8
+ export { BACKGROUND_TASK_TTL_PURGE_TABLES, createD1Storage, createHostPubSub, DoStatusError, DurableObjectRunner, DurableStorageResumeLedger, d1Changes, doErrorResponse, ensureSnapshotRunIdIndex, InMemoryResumeLedger, InvalidRunRequestError, init, mintResourceId, mintThreadId, PATH_SAFE_ID_PATTERN, purgeExpiredBackgroundTasks, purgeExpiredThreads, purgeExpiredWorkflowRuns, purgeTenant, RUN_TTL_PURGE_TABLES, RunAlreadyExistsError, RunNotSuspendedError, RunnerRuntime, TENANT_ID_PATTERN, TENANT_RANGE_PURGE_TABLES, THREAD_ACTOR_HEADER, THREAD_TENANT_HEADER, THREAD_TTL_PURGE_TABLES, ThreadDurableObject, ThreadIdentityError, tenantOfMemoryId, tenantOfRunId, tenantOwnsMemoryId, UnknownRunError, UnknownWorkflowError, } from './do-runner/index.js';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,yBAAyB,EACzB,wBAAwB,EACxB,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,2BAA2B,EAC3B,YAAY,EACZ,4BAA4B,EAC5B,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,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sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,SAAS,EACT,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,wBAAwB,EACxB,WAAW,EACX,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,yBAAyB,EACzB,wBAAwB,EACxB,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,2BAA2B,EAC3B,YAAY,EACZ,4BAA4B,EAC5B,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,gCAAgC,EAChC,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,kCAAkC,EAClC,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,E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ChB,aAAa,EACb,mBAAmB,EACnB,0BAA0B,EAC1B,SAAS,EACT,eAAe,EACf,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,2BAA2B,EAC3B,mBAAmB,EACnB,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -22,5 +22,5 @@
22
22
  export { APPROVAL_LIST_ORDERS, APPROVAL_PRIORITIES, APPROVAL_ROLES, APPROVAL_STATUSES, ApprovalAuthzError, ApprovalConflictError, ApprovalService, approvalCursor, approvalGrantProvider, approvalGrantProviderFromFactory, approvalListOrder, approvedConnectorsForLeg, BREAKWATER_ACTOR_KEY, BREAKWATER_APPROVED_CONNECTORS_KEY, BREAKWATER_WORKFLOW_SCOPE_KEY, byReviewerOrder, CLIENT_CREATE_FIELDS, createApprovalRouter, createTenantResolver, D1ApprovalStoreFactory, DECIDER_ROLES, defaultResumeData, InMemoryApprovalStore, InMemoryApprovalStoreFactory, InvalidApprovalInputError, MAX_APPROVAL_BATCH_DECIDE, MAX_APPROVAL_LIST_LIMIT, OPEN_STATUSES, parseApprovalCursor, purgeExpiredApprovals, RUN_START_ROLES, resumeViaRuntime, selfDecisionExempts, stepKeyOf, sweepSLA, TCB_ONLY_CREATE_FIELDS, TENANT_BOUND, TERMINAL_APPROVAL_STATUSES, TenantResolutionError, UnknownApprovalError, } from './approval-api/index.js';
23
23
  export { InMemoryArtifactBucket, InvalidArtifactRefError, R2ArtifactStore, } from './artifacts/index.js';
24
24
  export { createAuditQueueConsumer, createAuditQueueHandler, queueAuditSink, } from './audit-export/index.js';
25
- export { createD1Storage, DurableObjectRunner, DurableStorageResumeLedger, d1Changes, ensureSnapshotRunIdIndex, InMemoryResumeLedger, InvalidRunRequestError, init, mintResourceId, mintThreadId, PATH_SAFE_ID_PATTERN, purgeExpiredWorkflowRuns, purgeTenant, RunAlreadyExistsError, RunNotSuspendedError, RunnerRuntime, TENANT_ID_PATTERN, tenantOfMemoryId, tenantOfRunId, tenantOwnsMemoryId, UnknownRunError, UnknownWorkflowError, } from './do-runner/index.js';
25
+ export { BACKGROUND_TASK_TTL_PURGE_TABLES, createD1Storage, createHostPubSub, DoStatusError, DurableObjectRunner, DurableStorageResumeLedger, d1Changes, doErrorResponse, ensureSnapshotRunIdIndex, InMemoryResumeLedger, InvalidRunRequestError, init, mintResourceId, mintThreadId, PATH_SAFE_ID_PATTERN, purgeExpiredBackgroundTasks, purgeExpiredThreads, purgeExpiredWorkflowRuns, purgeTenant, RUN_TTL_PURGE_TABLES, RunAlreadyExistsError, RunNotSuspendedError, RunnerRuntime, TENANT_ID_PATTERN, TENANT_RANGE_PURGE_TABLES, THREAD_ACTOR_HEADER, THREAD_TENANT_HEADER, THREAD_TTL_PURGE_TABLES, ThreadDurableObject, ThreadIdentityError, tenantOfMemoryId, tenantOfRunId, tenantOwnsMemoryId, UnknownRunError, UnknownWorkflowError, } from './do-runner/index.js';
26
26
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,4EAA4E;AAC5E,EAAE;AACF,wEAAwE;AACxE,8EAA8E;AAC9E,gDAAgD;AAChD,kEAAkE;AAClE,6EAA6E;AAC7E,4BAA4B;AAC5B,mFAAmF;AACnF,yEAAyE;AACzE,gCAAgC;AAChC,2EAA2E;AAC3E,iFAAiF;AACjF,+EAA+E;AAC/E,qEAAqE;AACrE,EAAE;AACF,qEAAqE;AACrE,0EAA0E;AAC1E,4EAA4E;AAC5E,gEAAgE;AA0ChE,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,gCAAgC,EAChC,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,kCAAkC,EAClC,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,4BAA4B,EAC5B,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,EACvB,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,sBAAsB,EACtB,YAAY,EACZ,0BAA0B,EAC1B,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAcjC,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAQ9B,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,cAAc,GACf,MAAM,yBAAyB,CAAC;AAwBjC,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,SAAS,EACT,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,wBAAwB,EACxB,WAAW,EACX,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,4EAA4E;AAC5E,EAAE;AACF,w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,mBAAmB,EACnB,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Package-internal catch-all for public HTTP routes. */
2
+ export declare function internalErrorResponse(route: string, error: unknown, status?: 500 | 502): Response;
3
+ //# sourceMappingURL=internal-error-response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-error-response.d.ts","sourceRoot":"","sources":["../src/internal-error-response.ts"],"names":[],"mappings":"AAMA,yDAAyD;AACzD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,EACd,MAAM,GAAE,GAAG,GAAG,GAAS,GACtB,QAAQ,CAeV"}
@@ -0,0 +1,20 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ function errorText(error) {
3
+ return error instanceof Error ? error.message : String(error);
4
+ }
5
+ /** Package-internal catch-all for public HTTP routes. */
6
+ export function internalErrorResponse(route, error, status = 500) {
7
+ console.error(JSON.stringify({
8
+ type: 'route-internal-error',
9
+ route,
10
+ error: errorText(error),
11
+ }));
12
+ return new Response(JSON.stringify({ error: 'internal error' }), {
13
+ status,
14
+ headers: {
15
+ 'content-type': 'application/json',
16
+ 'cache-control': 'no-store',
17
+ },
18
+ });
19
+ }
20
+ //# sourceMappingURL=internal-error-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-error-response.js","sourceRoot":"","sources":["../src/internal-error-response.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,qBAAqB,CACnC,KAAa,EACb,KAAc,EACd,SAAoB,GAAG;IAEvB,OAAO,CAAC,KAAK,CACX,IAAI,CAAC,SAAS,CAAC;QACb,IAAI,EAAE,sBAAsB;QAC5B,KAAK;QACL,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC;KACxB,CAAC,CACH,CAAC;IACF,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,EAAE;QAC/D,MAAM;QACN,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,eAAe,EAAE,UAAU;SAC5B;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function nonnegativeSafeInteger(value: number, name: string): number;
2
+ export declare function positiveSafeInteger(value: number, name: string): number;
3
+ export declare function finiteNonnegativeNumber(value: number, name: string): number;
4
+ //# sourceMappingURL=numeric-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"numeric-config.d.ts","sourceRoot":"","sources":["../src/numeric-config.ts"],"names":[],"mappings":"AAMA,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAK1E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKvE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAK3E"}
@@ -0,0 +1,23 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ function invalid(name, domain) {
3
+ throw new RangeError(`${name} must be ${domain}`);
4
+ }
5
+ export function nonnegativeSafeInteger(value, name) {
6
+ if (!Number.isSafeInteger(value) || value < 0) {
7
+ return invalid(name, 'a nonnegative safe integer');
8
+ }
9
+ return value;
10
+ }
11
+ export function positiveSafeInteger(value, name) {
12
+ if (!Number.isSafeInteger(value) || value <= 0) {
13
+ return invalid(name, 'a positive safe integer');
14
+ }
15
+ return value;
16
+ }
17
+ export function finiteNonnegativeNumber(value, name) {
18
+ if (!Number.isFinite(value) || value < 0) {
19
+ return invalid(name, 'a finite nonnegative number');
20
+ }
21
+ return value;
22
+ }
23
+ //# sourceMappingURL=numeric-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"numeric-config.js","sourceRoot":"","sources":["../src/numeric-config.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,SAAS,OAAO,CAAC,IAAY,EAAE,MAAc;IAC3C,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,YAAY,MAAM,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAa,EAAE,IAAY;IAChE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QAC9C,OAAO,OAAO,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,IAAY;IAC7D,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAC/C,OAAO,OAAO,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,KAAa,EAAE,IAAY;IACjE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACzC,OAAO,OAAO,CAAC,IAAI,EAAE,6BAA6B,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { createScheduleRouter, type ScheduleFacadeStore, type ScheduleOperation, type ScheduleRouteAuditEvent, type ScheduleRouteAuditSink, type ScheduleRouter, type ScheduleRouterOptions, } from './router.js';
2
+ export { D1SchedulesStorage, type Schedule, type ScheduleDatabase, type ScheduleStatement, type ScheduleTrigger, } from './schedules-d1.js';
3
+ export { createScheduleStorageDomains } from './storage.js';
4
+ export { type AgentScheduleTarget, buildScheduledLegContext, createScheduleTick, isReservedScheduleContextKey, RESERVED_SCHEDULE_CONTEXT_KEYS, type ScheduleFireOutcome, type ScheduleTickAuditEvent, type ScheduleTickAuditSink, type ScheduleTickOptions, type ScheduleTickResult, type ScheduleTickRunCap, type ScheduleTickStart, type ScheduleTickStartAgent, type ScheduleTickStartAgentInput, type ScheduleTickStore, stripReservedScheduleContext, } from './tick.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schedules/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC3B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,kBAAkB,EAClB,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EACL,KAAK,mBAAmB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,8BAA8B,EAC9B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACtB,4BAA4B,GAC7B,MAAM,WAAW,CAAC"}
@@ -0,0 +1,13 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Track D (M-006) — schedules: the D1 domain, the CAS tick, and the tenant
3
+ // facade. Subpath-only (`@proofoftech/flowsafe/schedules`), like agent-runner /
4
+ // background-tasks / signals / goals: host-side wiring a consumer opts into, not
5
+ // in the root barrel.
6
+ // The tenant facade router (CI-M-006-003).
7
+ export { createScheduleRouter, } from './router.js';
8
+ // The D1 schedules storage domain (CI-M-006-001).
9
+ export { D1SchedulesStorage, } from './schedules-d1.js';
10
+ export { createScheduleStorageDomains } from './storage.js';
11
+ // The CAS tick (CI-M-006-002).
12
+ export { buildScheduledLegContext, createScheduleTick, isReservedScheduleContextKey, RESERVED_SCHEDULE_CONTEXT_KEYS, stripReservedScheduleContext, } from './tick.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schedules/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,2EAA2E;AAC3E,gFAAgF;AAChF,iFAAiF;AACjF,sBAAsB;AAEtB,2CAA2C;AAC3C,OAAO,EACL,oBAAoB,GAOrB,MAAM,aAAa,CAAC;AACrB,kDAAkD;AAClD,OAAO,EACL,kBAAkB,GAKnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAC5D,+BAA+B;AAC/B,OAAO,EAEL,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,8BAA8B,EAW9B,4BAA4B,GAC7B,MAAM,WAAW,CAAC"}