@pikku/core 0.12.143 → 0.12.145

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 (701) hide show
  1. package/dist/analytics/analytics.d.ts +14 -0
  2. package/dist/analytics/analytics.js +14 -0
  3. package/dist/analytics/analytics.types.d.ts +1 -0
  4. package/dist/analytics/anonymous-analytics-identity.d.ts +1 -0
  5. package/dist/analytics/cookie-analytics-identity.d.ts +1 -0
  6. package/dist/analytics/mint-cookie.d.ts +1 -0
  7. package/dist/{wirings/channel/channel-middleware-runner.d.ts → channel-middleware-runner.d.ts} +17 -3
  8. package/dist/{wirings/channel/channel-middleware-runner.js → channel-middleware-runner.js} +24 -8
  9. package/dist/classification/data-classification.d.ts +13 -0
  10. package/dist/classification/secret-value.d.ts +7 -0
  11. package/dist/classification/secret-value.js +7 -0
  12. package/dist/crypto-utils.d.ts +93 -0
  13. package/dist/crypto-utils.js +92 -0
  14. package/dist/dev/hot-reload.d.ts +16 -0
  15. package/dist/dev/hot-reload.js +16 -1
  16. package/dist/dev/module-runner.js +7 -3
  17. package/dist/dev/reload-meta.js +1 -1
  18. package/dist/errors/error-handler.d.ts +9 -0
  19. package/dist/errors/error-handler.js +8 -0
  20. package/dist/errors/errors.d.ts +219 -0
  21. package/dist/errors/errors.js +227 -0
  22. package/dist/errors/serialized-error.d.ts +4 -0
  23. package/dist/function/abort-scope.d.ts +5 -0
  24. package/dist/function/function-meta.types.d.ts +20 -0
  25. package/dist/function/function-runner.d.ts +41 -0
  26. package/dist/function/function-runner.js +57 -11
  27. package/dist/function/functions.types.d.ts +59 -0
  28. package/dist/function/functions.types.js +23 -0
  29. package/dist/function/list.types.d.ts +4 -0
  30. package/dist/lifecycle.d.ts +12 -1
  31. package/dist/lifecycle.js +12 -1
  32. package/dist/middleware/addon-scope-cap.d.ts +4 -0
  33. package/dist/middleware/addon-scope-cap.js +7 -3
  34. package/dist/middleware/auth-apikey.js +3 -3
  35. package/dist/middleware/auth-bearer.js +5 -13
  36. package/dist/middleware/auth-cookie.js +3 -3
  37. package/dist/middleware/middleware-factories.d.ts +17 -0
  38. package/dist/middleware/middleware-factories.js +17 -0
  39. package/dist/middleware/middleware.types.d.ts +23 -0
  40. package/dist/middleware/remote-auth.d.ts +15 -0
  41. package/dist/middleware/remote-auth.js +18 -3
  42. package/dist/middleware/remote-jobs-secret.js +2 -10
  43. package/dist/middleware-runner.d.ts +7 -0
  44. package/dist/middleware-runner.js +23 -7
  45. package/dist/permissions.d.ts +13 -0
  46. package/dist/permissions.js +13 -0
  47. package/dist/pikku-state.d.ts +49 -0
  48. package/dist/pikku-state.js +49 -0
  49. package/dist/remote.js +20 -5
  50. package/dist/schema.d.ts +36 -0
  51. package/dist/schema.js +36 -0
  52. package/dist/services/agent-run-state-service.d.ts +8 -0
  53. package/dist/services/agent-runner-service.d.ts +24 -0
  54. package/dist/services/agent-storage-service.d.ts +8 -0
  55. package/dist/services/ai-embedding-service.d.ts +4 -0
  56. package/dist/services/audit-service.d.ts +48 -0
  57. package/dist/services/audit-service.js +22 -0
  58. package/dist/services/content-service.d.ts +34 -0
  59. package/dist/services/credential-wire-service.d.ts +9 -0
  60. package/dist/services/credential-wire-service.js +9 -0
  61. package/dist/services/deployment-service.d.ts +14 -0
  62. package/dist/services/email-service.d.ts +20 -0
  63. package/dist/services/email-template.d.ts +24 -0
  64. package/dist/services/email-template.js +12 -0
  65. package/dist/services/file-scenario-run-store.d.ts +5 -0
  66. package/dist/services/file-scenario-run-store.js +4 -0
  67. package/dist/services/gateway-service.d.ts +5 -0
  68. package/dist/services/in-memory-agent-run-state-service.d.ts +5 -0
  69. package/dist/services/in-memory-agent-run-state-service.js +5 -0
  70. package/dist/services/in-memory-lease-service.d.ts +5 -0
  71. package/dist/services/in-memory-lease-service.js +5 -0
  72. package/dist/services/in-memory-session-store.d.ts +4 -0
  73. package/dist/services/in-memory-session-store.js +4 -0
  74. package/dist/services/incoming-webhook-queue.d.ts +2 -0
  75. package/dist/services/incoming-webhook-queue.js +2 -0
  76. package/dist/services/incoming-webhook-service.d.ts +9 -1
  77. package/dist/services/incoming-webhook-service.js +1 -1
  78. package/dist/services/index.d.ts +1 -5
  79. package/dist/services/index.js +1 -5
  80. package/dist/services/jwt-service.d.ts +8 -0
  81. package/dist/services/lease-service.d.ts +5 -0
  82. package/dist/services/lease-service.js +1 -0
  83. package/dist/services/local-content-request-handler.d.ts +20 -0
  84. package/dist/services/local-content-request-handler.js +11 -0
  85. package/dist/services/local-content.d.ts +45 -0
  86. package/dist/services/local-content.js +35 -0
  87. package/dist/services/local-credential-service.d.ts +5 -0
  88. package/dist/services/local-credential-service.js +5 -0
  89. package/dist/services/local-email-service.d.ts +7 -0
  90. package/dist/services/local-email-service.js +7 -0
  91. package/dist/services/local-secrets.d.ts +8 -0
  92. package/dist/services/local-secrets.js +8 -0
  93. package/dist/services/local-variables.d.ts +6 -0
  94. package/dist/services/local-variables.js +6 -0
  95. package/dist/services/logger.d.ts +4 -0
  96. package/dist/services/logger.js +4 -0
  97. package/dist/services/meta-service.d.ts +38 -0
  98. package/dist/services/meta-service.js +6 -0
  99. package/dist/services/queue-webhook-service.d.ts +19 -0
  100. package/dist/services/queue-webhook-service.js +19 -0
  101. package/dist/services/remote-jobs.d.ts +8 -13
  102. package/dist/services/remote-jobs.js +3 -54
  103. package/dist/services/scenario-cookie-jar.d.ts +4 -0
  104. package/dist/services/scheduler-service.d.ts +13 -0
  105. package/dist/services/scheduler-service.js +8 -0
  106. package/dist/services/schema-service.d.ts +9 -0
  107. package/dist/services/scope-service.d.ts +10 -0
  108. package/dist/services/scoped-secret-service.d.ts +5 -0
  109. package/dist/services/scoped-secret-service.js +5 -0
  110. package/dist/services/secret-host-binding.d.ts +5 -0
  111. package/dist/services/secret-host-binding.js +5 -0
  112. package/dist/services/secret-service.d.ts +19 -1
  113. package/dist/services/secretless.d.ts +6 -0
  114. package/dist/services/secretless.js +6 -0
  115. package/dist/services/session-store.d.ts +5 -0
  116. package/dist/services/stub-tracker.d.ts +1 -0
  117. package/dist/services/temporary-file-service.d.ts +9 -0
  118. package/dist/services/temporary-file-service.js +9 -0
  119. package/dist/services/trigger-service.d.ts +4 -0
  120. package/dist/services/trigger-source-store.d.ts +13 -0
  121. package/dist/services/trigger-source-store.js +7 -0
  122. package/dist/services/typed-credential-service.d.ts +6 -0
  123. package/dist/services/typed-credential-service.js +5 -0
  124. package/dist/services/typed-secret-service.d.ts +12 -0
  125. package/dist/services/typed-secret-service.js +11 -0
  126. package/dist/services/typed-variables-service.d.ts +1 -0
  127. package/dist/services/user-session-service.d.ts +31 -1
  128. package/dist/services/user-session-service.js +29 -3
  129. package/dist/services/v8-coverage-service.d.ts +27 -0
  130. package/dist/services/v8-coverage-service.js +5 -0
  131. package/dist/services/variables-service.d.ts +8 -0
  132. package/dist/services/virtual-user-sign-in.d.ts +1 -0
  133. package/dist/services/virtual-user-statement.d.ts +8 -0
  134. package/dist/services/virtual-user-statement.js +4 -0
  135. package/dist/services/webhook-service.d.ts +25 -0
  136. package/dist/services/webhook-service.js +15 -0
  137. package/dist/services/workflow-service.d.ts +6 -0
  138. package/dist/test-utils.js +1 -1
  139. package/dist/testing/service-tests.d.ts +4 -0
  140. package/dist/time-utils.d.ts +15 -0
  141. package/dist/time-utils.js +14 -0
  142. package/dist/types/core.types.d.ts +80 -0
  143. package/dist/types/state.types.d.ts +4 -0
  144. package/dist/utils/hmac.d.ts +3 -0
  145. package/dist/utils/safe-fetch.d.ts +14 -0
  146. package/dist/utils/safe-fetch.js +13 -0
  147. package/dist/utils/stable-stringify.d.ts +11 -0
  148. package/dist/utils/stable-stringify.js +33 -0
  149. package/dist/utils.d.ts +28 -0
  150. package/dist/utils.js +22 -0
  151. package/dist/version.d.ts +7 -0
  152. package/dist/version.js +7 -0
  153. package/dist/wirings/addon/define-screens.d.ts +2 -0
  154. package/dist/wirings/addon/remote-addon-auth.d.ts +9 -0
  155. package/dist/wirings/addon/remote-addon-auth.js +5 -0
  156. package/dist/wirings/addon/wire-addon.d.ts +4 -0
  157. package/dist/wirings/addon/wire-remote-addon.d.ts +1 -0
  158. package/dist/wirings/agent/agent-agui.d.ts +14 -5
  159. package/dist/wirings/agent/agent-agui.js +17 -6
  160. package/dist/wirings/agent/agent-helpers.d.ts +61 -1
  161. package/dist/wirings/agent/agent-helpers.js +62 -2
  162. package/dist/wirings/agent/agent-interrupt.d.ts +5 -0
  163. package/dist/wirings/agent/agent-output.d.ts +20 -0
  164. package/dist/wirings/agent/agent-output.js +69 -0
  165. package/dist/wirings/agent/agent-prepare.d.ts +41 -0
  166. package/dist/wirings/agent/agent-prepare.js +38 -2
  167. package/dist/wirings/agent/agent-registry.d.ts +8 -0
  168. package/dist/wirings/agent/agent-registry.js +10 -4
  169. package/dist/wirings/agent/agent-runner.d.ts +33 -0
  170. package/dist/wirings/agent/agent-runner.js +40 -7
  171. package/dist/wirings/agent/agent-stream.d.ts +30 -0
  172. package/dist/wirings/agent/agent-stream.js +33 -11
  173. package/dist/wirings/agent/agent.types.d.ts +43 -0
  174. package/dist/wirings/agent/voice-input.d.ts +12 -0
  175. package/dist/wirings/agent/voice-input.js +12 -0
  176. package/dist/wirings/agent/voice-output.d.ts +14 -0
  177. package/dist/wirings/agent/voice-output.js +10 -0
  178. package/dist/wirings/agent-scorer/agent-scorer-judge.js +1 -2
  179. package/dist/wirings/agent-scorer/agent-scorer-registry.d.ts +10 -0
  180. package/dist/wirings/agent-scorer/agent-scorer-registry.js +10 -0
  181. package/dist/wirings/agent-scorer/agent-scorer-snapshots.d.ts +1 -0
  182. package/dist/wirings/agent-scorer/agent-scorer-snapshots.js +1 -0
  183. package/dist/wirings/agent-scorer/agent-scorer.types.d.ts +7 -0
  184. package/dist/wirings/channel/channel-common.js +1 -1
  185. package/dist/wirings/channel/channel-rpc.types.d.ts +5 -0
  186. package/dist/wirings/channel/channel-runner.d.ts +22 -0
  187. package/dist/wirings/channel/channel-runner.js +22 -0
  188. package/dist/wirings/channel/channel-store.d.ts +8 -0
  189. package/dist/wirings/channel/channel-store.js +7 -0
  190. package/dist/wirings/channel/channel.types.d.ts +18 -0
  191. package/dist/wirings/channel/define-channel-routes.d.ts +5 -0
  192. package/dist/wirings/channel/define-channel-routes.js +5 -0
  193. package/dist/wirings/channel/eventhub-service.d.ts +9 -0
  194. package/dist/wirings/channel/eventhub-store.d.ts +1 -0
  195. package/dist/wirings/channel/eventhub-store.js +1 -0
  196. package/dist/wirings/channel/index.d.ts +1 -1
  197. package/dist/wirings/channel/index.js +1 -1
  198. package/dist/wirings/channel/local/local-channel-handler.d.ts +1 -0
  199. package/dist/wirings/channel/local/local-channel-handler.js +1 -0
  200. package/dist/wirings/channel/local/local-channel-runner.d.ts +13 -0
  201. package/dist/wirings/channel/local/local-channel-runner.js +13 -0
  202. package/dist/wirings/channel/local/local-eventhub-service.d.ts +1 -0
  203. package/dist/wirings/channel/local/local-eventhub-service.js +1 -0
  204. package/dist/wirings/channel/log-channels.d.ts +1 -0
  205. package/dist/wirings/channel/log-channels.js +1 -0
  206. package/dist/wirings/channel/pikku-abstract-channel-handler.d.ts +5 -0
  207. package/dist/wirings/channel/pikku-abstract-channel-handler.js +5 -0
  208. package/dist/wirings/channel/serverless/serverless-channel-runner.d.ts +32 -0
  209. package/dist/wirings/channel/serverless/serverless-channel-runner.js +31 -0
  210. package/dist/wirings/cli/channel/cli-channel-runner.d.ts +8 -0
  211. package/dist/wirings/cli/channel/cli-channel-runner.js +8 -0
  212. package/dist/wirings/cli/channel/cli-raw-channel-runner.d.ts +1 -0
  213. package/dist/wirings/cli/cli-runner.d.ts +43 -0
  214. package/dist/wirings/cli/cli-runner.js +43 -0
  215. package/dist/wirings/cli/cli.types.d.ts +4 -0
  216. package/dist/wirings/cli/command-parser.d.ts +13 -0
  217. package/dist/wirings/cli/command-parser.js +16 -0
  218. package/dist/wirings/credential/credential-overrides.d.ts +1 -0
  219. package/dist/wirings/credential/credential.types.d.ts +7 -0
  220. package/dist/wirings/credential/validate-credential-definitions.d.ts +7 -0
  221. package/dist/wirings/credential/validate-credential-definitions.js +7 -0
  222. package/dist/wirings/flag/cached-flag-source.d.ts +1 -0
  223. package/dist/wirings/flag/flag.types.d.ts +3 -0
  224. package/dist/wirings/gateway/gateway-runner.d.ts +23 -0
  225. package/dist/wirings/gateway/gateway-runner.js +23 -0
  226. package/dist/wirings/gateway/gateway.types.d.ts +3 -0
  227. package/dist/wirings/gateway/local-gateway-service.d.ts +10 -0
  228. package/dist/{services → wirings/gateway}/local-gateway-service.js +6 -2
  229. package/dist/wirings/http/http-routes.d.ts +21 -0
  230. package/dist/wirings/http/http-routes.js +11 -0
  231. package/dist/wirings/http/http-runner.d.ts +71 -0
  232. package/dist/wirings/http/http-runner.js +73 -5
  233. package/dist/wirings/http/http.types.d.ts +27 -0
  234. package/dist/wirings/http/index.d.ts +1 -0
  235. package/dist/wirings/http/index.js +1 -0
  236. package/dist/wirings/http/log-http-routes.d.ts +1 -0
  237. package/dist/wirings/http/log-http-routes.js +1 -0
  238. package/dist/wirings/http/merge-request-data.d.ts +12 -0
  239. package/dist/wirings/http/merge-request-data.js +42 -0
  240. package/dist/wirings/http/pikku-fetch-http-request.d.ts +1 -0
  241. package/dist/wirings/http/pikku-fetch-http-request.js +3 -32
  242. package/dist/wirings/http/pikku-fetch-http-response.d.ts +1 -0
  243. package/dist/wirings/http/pikku-fetch-http-response.js +1 -0
  244. package/dist/wirings/http/routers/http-router.d.ts +6 -0
  245. package/dist/wirings/http/routers/http-router.js +6 -0
  246. package/dist/wirings/http/web-request.d.ts +17 -0
  247. package/dist/wirings/http/web-request.js +17 -0
  248. package/dist/wirings/mcp/mcp-endpoint-registry.d.ts +7 -0
  249. package/dist/wirings/mcp/mcp-endpoint-registry.js +7 -0
  250. package/dist/wirings/mcp/mcp-runner.d.ts +63 -0
  251. package/dist/wirings/mcp/mcp-runner.js +62 -0
  252. package/dist/wirings/mcp/mcp.types.d.ts +12 -0
  253. package/dist/wirings/node/node.types.d.ts +4 -0
  254. package/dist/wirings/oauth2/oauth2.types.d.ts +2 -0
  255. package/dist/{services → wirings/queue}/in-memory-queue-service.d.ts +9 -1
  256. package/dist/{services → wirings/queue}/in-memory-queue-service.js +9 -1
  257. package/dist/wirings/queue/index.d.ts +1 -0
  258. package/dist/wirings/queue/index.js +1 -0
  259. package/dist/wirings/queue/queue-identity.js +2 -14
  260. package/dist/wirings/queue/queue-runner.d.ts +37 -0
  261. package/dist/wirings/queue/queue-runner.js +37 -0
  262. package/dist/wirings/queue/queue.types.d.ts +35 -0
  263. package/dist/wirings/queue/register-queue-helper.d.ts +12 -0
  264. package/dist/wirings/queue/register-queue-helper.js +11 -0
  265. package/dist/wirings/queue/remote-queue-job.d.ts +11 -0
  266. package/dist/wirings/queue/remote-queue-job.js +41 -0
  267. package/dist/wirings/queue/validate-worker-config.d.ts +1 -0
  268. package/dist/wirings/role/role.types.d.ts +3 -0
  269. package/dist/wirings/rpc/rpc-runner.d.ts +24 -0
  270. package/dist/wirings/rpc/rpc-runner.js +37 -2
  271. package/dist/wirings/rpc/rpc-types.d.ts +2 -0
  272. package/dist/wirings/scheduler/index.d.ts +1 -0
  273. package/dist/wirings/scheduler/index.js +1 -0
  274. package/dist/wirings/scheduler/log-schedulers.d.ts +1 -0
  275. package/dist/wirings/scheduler/log-schedulers.js +1 -0
  276. package/dist/wirings/scheduler/remote-scheduled-job.d.ts +11 -0
  277. package/dist/wirings/scheduler/remote-scheduled-job.js +20 -0
  278. package/dist/wirings/scheduler/scheduler-runner.d.ts +29 -0
  279. package/dist/wirings/scheduler/scheduler-runner.js +28 -0
  280. package/dist/wirings/scheduler/scheduler.types.d.ts +3 -0
  281. package/dist/wirings/scope/scope.types.d.ts +5 -0
  282. package/dist/wirings/secret/index.d.ts +2 -2
  283. package/dist/wirings/secret/index.js +1 -1
  284. package/dist/wirings/secret/secret.types.d.ts +26 -1
  285. package/dist/wirings/secret/secret.types.js +1 -0
  286. package/dist/wirings/secret/validate-secret-definitions.d.ts +8 -0
  287. package/dist/wirings/secret/validate-secret-definitions.js +15 -0
  288. package/dist/wirings/trigger/in-memory-trigger-service.d.ts +11 -0
  289. package/dist/{services → wirings/trigger}/in-memory-trigger-service.js +10 -3
  290. package/dist/wirings/trigger/index.d.ts +1 -1
  291. package/dist/wirings/trigger/pikku-trigger-service.d.ts +8 -3
  292. package/dist/wirings/trigger/pikku-trigger-service.js +14 -3
  293. package/dist/wirings/trigger/trigger-runner.d.ts +27 -2
  294. package/dist/wirings/trigger/trigger-runner.js +35 -2
  295. package/dist/wirings/trigger/trigger.types.d.ts +26 -4
  296. package/dist/wirings/trigger/webhook-source-runner.d.ts +24 -0
  297. package/dist/wirings/trigger/webhook-source-runner.js +19 -0
  298. package/dist/wirings/trigger/webhook-source.types.d.ts +12 -2
  299. package/dist/wirings/trigger/webhook-source.types.js +1 -1
  300. package/dist/wirings/variable/validate-variable-definitions.d.ts +7 -0
  301. package/dist/wirings/variable/validate-variable-definitions.js +7 -0
  302. package/dist/wirings/variable/variable.types.d.ts +7 -0
  303. package/dist/wirings/virtual-user/conversation/conversation.types.d.ts +5 -0
  304. package/dist/wirings/virtual-user/conversation/run-conversation.d.ts +6 -0
  305. package/dist/wirings/virtual-user/conversation/run-conversation.js +1 -1
  306. package/dist/{services → wirings/virtual-user}/http-virtual-users.d.ts +4 -3
  307. package/dist/{services → wirings/virtual-user}/http-virtual-users.js +6 -6
  308. package/dist/wirings/virtual-user/index.d.ts +1 -1
  309. package/dist/wirings/virtual-user/index.js +1 -1
  310. package/dist/wirings/virtual-user/run-virtual-user.d.ts +2 -1
  311. package/dist/wirings/virtual-user/run-virtual-user.js +1 -14
  312. package/dist/wirings/virtual-user/virtual-user-declaration.types.d.ts +4 -0
  313. package/dist/wirings/virtual-user/virtual-user-scaffold.d.ts +10 -1
  314. package/dist/wirings/virtual-user/virtual-user-scaffold.js +5 -0
  315. package/dist/wirings/virtual-user/virtual-user-schedule.d.ts +5 -0
  316. package/dist/wirings/virtual-user/virtual-user-schedule.js +1 -0
  317. package/dist/wirings/virtual-user/virtual-user-target.d.ts +1 -0
  318. package/dist/wirings/webhook/define-outgoing-webhook.d.ts +20 -0
  319. package/dist/wirings/webhook/define-outgoing-webhook.js +9 -0
  320. package/dist/wirings/workflow/dsl/workflow-dsl.types.d.ts +8 -4
  321. package/dist/wirings/workflow/dsl/workflow-runner.d.ts +7 -0
  322. package/dist/wirings/workflow/dsl/workflow-runner.js +7 -0
  323. package/dist/wirings/workflow/feature.d.ts +12 -0
  324. package/dist/wirings/workflow/feature.js +12 -0
  325. package/dist/wirings/workflow/graph/graph-node.d.ts +5 -0
  326. package/dist/wirings/workflow/graph/graph-node.js +5 -0
  327. package/dist/wirings/workflow/graph/template.d.ts +6 -0
  328. package/dist/wirings/workflow/graph/template.js +5 -0
  329. package/dist/wirings/workflow/graph/wire-workflow-graph.d.ts +12 -0
  330. package/dist/wirings/workflow/graph/wire-workflow-graph.js +10 -0
  331. package/dist/wirings/workflow/graph/workflow-graph.types.d.ts +11 -0
  332. package/dist/wirings/workflow/graph/workflow-graph.types.js +1 -0
  333. package/dist/{services → wirings/workflow}/in-memory-workflow-service.d.ts +8 -3
  334. package/dist/{services → wirings/workflow}/in-memory-workflow-service.js +9 -4
  335. package/dist/wirings/workflow/pikku-scenario-service.d.ts +1 -1
  336. package/dist/wirings/workflow/pikku-scenario-service.js +2 -2
  337. package/dist/wirings/workflow/pikku-workflow-service.d.ts +1 -0
  338. package/dist/wirings/workflow/pikku-workflow-service.js +1 -0
  339. package/dist/wirings/workflow/run-timeline.d.ts +21 -0
  340. package/dist/wirings/workflow/run-timeline.js +15 -7
  341. package/dist/wirings/workflow/scenario-coverage.d.ts +1 -0
  342. package/dist/wirings/workflow/scenario-poll.d.ts +1 -0
  343. package/dist/wirings/workflow/scenario-prose.d.ts +6 -0
  344. package/dist/wirings/workflow/scenario-prose.js +6 -0
  345. package/dist/wirings/workflow/scenario-run.types.d.ts +3 -0
  346. package/dist/wirings/workflow/scenario-step.types.d.ts +1 -0
  347. package/dist/wirings/workflow/scenario-step.types.js +1 -0
  348. package/dist/wirings/workflow/scenario-surface.js +1 -13
  349. package/dist/wirings/workflow/scenario.types.d.ts +6 -0
  350. package/dist/wirings/workflow/workflow-approval-policy.d.ts +6 -0
  351. package/dist/wirings/workflow/workflow-approval-policy.js +6 -0
  352. package/dist/wirings/workflow/workflow-constants.d.ts +7 -1
  353. package/dist/wirings/workflow/workflow-constants.js +10 -1
  354. package/dist/wirings/workflow/workflow-errors.d.ts +13 -0
  355. package/dist/wirings/workflow/workflow-errors.js +13 -0
  356. package/dist/wirings/workflow/workflow-invocation-id.d.ts +4 -0
  357. package/dist/wirings/workflow/workflow-invocation-id.js +4 -0
  358. package/dist/wirings/workflow/workflow-queue-workers.d.ts +3 -0
  359. package/dist/wirings/workflow/workflow-run-ownership.d.ts +1 -0
  360. package/dist/wirings/workflow/workflow-run-ownership.js +1 -0
  361. package/dist/wirings/workflow/workflow-status-stream.d.ts +1 -0
  362. package/dist/wirings/workflow/workflow-unwind-plan.js +2 -7
  363. package/dist/wirings/workflow/workflow.types.d.ts +40 -0
  364. package/package.json +26 -9
  365. package/CHANGELOG.md +0 -6978
  366. package/dist/services/in-memory-trigger-service.d.ts +0 -4
  367. package/dist/services/local-gateway-service.d.ts +0 -6
  368. package/dist/utils/hash.d.ts +0 -2
  369. package/dist/utils/hash.js +0 -23
  370. package/knowledge/decisions/index.md +0 -19
  371. package/knowledge/decisions/internals/a-credential-name-declared-twice-must-agree-on-schema-and-type.md +0 -29
  372. package/knowledge/decisions/internals/a-grant-can-name-a-scope-declared-without-its-addon.md +0 -29
  373. package/knowledge/decisions/internals/a-held-run-is-woken-later-not-retried.md +0 -28
  374. package/knowledge/decisions/internals/a-latency-budget-is-asserted-by-its-cause.md +0 -32
  375. package/knowledge/decisions/internals/a-non-streaming-agent-run-registers-with-agentrunstate-too.md +0 -22
  376. package/knowledge/decisions/internals/a-reset-suite-makes-the-dev-seed-the-fixture.md +0 -50
  377. package/knowledge/decisions/internals/a-resumed-agent-turn-is-as-interruptible-as-the-first.md +0 -20
  378. package/knowledge/decisions/internals/a-scenario-step-template-is-offered-unfilled.md +0 -21
  379. package/knowledge/decisions/internals/a-scheduled-task-writes-its-caller-session-before-it-runs.md +0 -22
  380. package/knowledge/decisions/internals/a-secret-set-in-memory-shadows-the-variable-of-the-same-name.md +0 -28
  381. package/knowledge/decisions/internals/a-secret-that-fails-to-decrypt-fails-the-whole-read.md +0 -49
  382. package/knowledge/decisions/internals/a-virtual-user-acts-through-invokeraw-so-a-refusal-is-data.md +0 -32
  383. package/knowledge/decisions/internals/a-virtual-user-cadence-is-a-row-not-a-timer.md +0 -66
  384. package/knowledge/decisions/internals/a-virtual-user-converse-signs-in-before-its-first-turn.md +0 -24
  385. package/knowledge/decisions/internals/a-virtual-user-decides-whether-to-trust-memory-once-per-turn.md +0 -21
  386. package/knowledge/decisions/internals/a-virtual-user-email-is-computed-with-the-run-id-as-a-sub-address.md +0 -34
  387. package/knowledge/decisions/internals/a-virtual-user-run-is-not-a-workflow-but-it-needs-a-trigger.md +0 -65
  388. package/knowledge/decisions/internals/a-wall-clock-threshold-is-a-load-test-in-disguise.md +0 -49
  389. package/knowledge/decisions/internals/a-workflow-wire-is-built-from-the-run-not-from-the-rpc-service.md +0 -45
  390. package/knowledge/decisions/internals/addon-package-roots-resolve-by-walking-node-module-search-paths.md +0 -26
  391. package/knowledge/decisions/internals/addon-pikku-meta-ships-at-the-package-root-or-under-dist.md +0 -32
  392. package/knowledge/decisions/internals/addon-singleton-services-are-cached-per-namespace-not-per-package.md +0 -33
  393. package/knowledge/decisions/internals/addon-workflow-names-are-prefixed-with-the-consumer-namespace.md +0 -28
  394. package/knowledge/decisions/internals/agent-agui-bridge-obeys-the-client-ordering-contract.md +0 -29
  395. package/knowledge/decisions/internals/agent-audio-chunks-carry-the-format-the-provider-returned.md +0 -20
  396. package/knowledge/decisions/internals/agent-context-waits-for-a-tool-result-still-being-written.md +0 -21
  397. package/knowledge/decisions/internals/agent-credential-suspensions-hide-the-tool-result.md +0 -26
  398. package/knowledge/decisions/internals/agent-delegate-and-supervise-hide-different-text.md +0 -26
  399. package/knowledge/decisions/internals/agent-llm-tool-arguments-have-nulls-stripped.md +0 -23
  400. package/knowledge/decisions/internals/agent-model-config-stays-a-single-resolution-seam.md +0 -25
  401. package/knowledge/decisions/internals/agent-onerror-hooks-cannot-change-the-failure.md +0 -22
  402. package/knowledge/decisions/internals/agent-runner-methods-must-keep-their-receiver.md +0 -22
  403. package/knowledge/decisions/internals/agent-speech-travels-as-a-custom-agui-event.md +0 -22
  404. package/knowledge/decisions/internals/agent-stream-persistence-is-best-effort.md +0 -27
  405. package/knowledge/decisions/internals/agent-sub-agents-inherit-the-parent-context-block.md +0 -26
  406. package/knowledge/decisions/internals/agent-tool-execute-failures-are-logged-unconditionally.md +0 -25
  407. package/knowledge/decisions/internals/agent-voice-input-transcribes-audio-parts-in-place.md +0 -22
  408. package/knowledge/decisions/internals/agent-working-memory-is-persisted-only-when-valid.md +0 -25
  409. package/knowledge/decisions/internals/an-addon-scope-root-loses-to-a-root-the-host-already-declares.md +0 -39
  410. package/knowledge/decisions/internals/an-agent-interrupt-is-not-a-failure.md +0 -23
  411. package/knowledge/decisions/internals/an-agent-is-offered-under-its-registry-key-and-only-within-the-virtual-users-scopes.md +0 -27
  412. package/knowledge/decisions/internals/an-agent-run-owned-by-another-instance-says-so.md +0 -25
  413. package/knowledge/decisions/internals/an-agent-stream-send-must-return-the-inner-sends-promise.md +0 -22
  414. package/knowledge/decisions/internals/an-empty-text-part-is-omitted-from-an-agent-message.md +0 -20
  415. package/knowledge/decisions/internals/an-empty-transcript-is-not-recorded.md +0 -22
  416. package/knowledge/decisions/internals/an-oauth2-credential-implies-an-optional-app-secret.md +0 -26
  417. package/knowledge/decisions/internals/an-unref-d-timer-cannot-be-awaited-under-node-test.md +0 -66
  418. package/knowledge/decisions/internals/analytics-identity-resolvers-run-in-declared-order.md +0 -22
  419. package/knowledge/decisions/internals/channel-message-handlers-accept-three-config-shapes.md +0 -30
  420. package/knowledge/decisions/internals/channel-middleware-caches-only-statically-resolved-middleware.md +0 -31
  421. package/knowledge/decisions/internals/channel-state-accessors-are-unsound-generics-that-every-implementation-asserts.md +0 -33
  422. package/knowledge/decisions/internals/channel-state-is-per-socket-session-state-is-per-user.md +0 -29
  423. package/knowledge/decisions/internals/channel-user-id-is-persisted-after-onconnect-middleware-runs.md +0 -28
  424. package/knowledge/decisions/internals/cli-option-names-are-camelcase-in-state-and-kebab-on-the-command-line.md +0 -27
  425. package/knowledge/decisions/internals/cli-parse-errors-are-routed-by-message-prefix.md +0 -28
  426. package/knowledge/decisions/internals/cli-stdout-is-reserved-for-machine-readable-output.md +0 -34
  427. package/knowledge/decisions/internals/cli-unknown-long-options-warn-instead-of-failing.md +0 -29
  428. package/knowledge/decisions/internals/core-column-form-is-an-axis-of-its-own.md +0 -84
  429. package/knowledge/decisions/internals/core-data-classification-brand-is-an-optional-property.md +0 -41
  430. package/knowledge/decisions/internals/core-function-runner-restores-the-wire-fields-it-overwrites.md +0 -44
  431. package/knowledge/decisions/internals/core-hot-reload-merges-generated-meta-never-replaces-it.md +0 -39
  432. package/knowledge/decisions/internals/core-hot-reload-owns-its-module-registry.md +0 -42
  433. package/knowledge/decisions/internals/core-middleware-order-is-scope-then-priority.md +0 -39
  434. package/knowledge/decisions/internals/core-schema-defaults-apply-on-every-transport.md +0 -43
  435. package/knowledge/decisions/internals/core-scopes-are-an-and-gate-separate-from-permissions.md +0 -38
  436. package/knowledge/decisions/internals/core-state-is-a-global-map-written-only-at-registration-time.md +0 -44
  437. package/knowledge/decisions/internals/email-meta-is-read-uncached-because-codegen-rewrites-it-mid-session.md +0 -27
  438. package/knowledge/decisions/internals/feature-flag-declarations-refuse-an-empty-anyof-and-conflicting-scopes.md +0 -22
  439. package/knowledge/decisions/internals/feature-flags-fail-open-and-never-enforce-access.md +0 -28
  440. package/knowledge/decisions/internals/flag-sync-rewrites-only-the-declared-text.md +0 -24
  441. package/knowledge/decisions/internals/gateway-adapters-resolve-lazily-and-are-promise-cached.md +0 -32
  442. package/knowledge/decisions/internals/gateway-listener-middleware-runs-without-an-rpc-on-the-wire.md +0 -43
  443. package/knowledge/decisions/internals/gateway-webhook-challenges-echo-bytes-not-json.md +0 -28
  444. package/knowledge/decisions/internals/gateway-wiring-is-a-meta-wiring-over-http-and-channels.md +0 -31
  445. package/knowledge/decisions/internals/generated-src-paths-in-pikku-meta-are-absolute.md +0 -26
  446. package/knowledge/decisions/internals/global-middleware-resolves-from-the-root-namespace-too.md +0 -32
  447. package/knowledge/decisions/internals/hot-reload-reads-the-changed-source-never-a-compiled-copy.md +0 -38
  448. package/knowledge/decisions/internals/hot-reload-writes-into-the-function-map-captured-at-startup.md +0 -26
  449. package/knowledge/decisions/internals/http-request-bodies-are-read-once-and-shared.md +0 -32
  450. package/knowledge/decisions/internals/http-route-groups-cascade-config-in-a-fixed-order.md +0 -28
  451. package/knowledge/decisions/internals/http-router-matches-normalized-paths-but-returns-registered-ones.md +0 -30
  452. package/knowledge/decisions/internals/http-runner-logs-through-a-trace-scoped-logger-functions-do-not.md +0 -26
  453. package/knowledge/decisions/internals/http-set-cookie-headers-are-appended-never-joined.md +0 -28
  454. package/knowledge/decisions/internals/http-sse-streams-flush-headers-only-after-middleware.md +0 -32
  455. package/knowledge/decisions/internals/http-wiring-without-metadata-is-skipped-not-fatal.md +0 -26
  456. package/knowledge/decisions/internals/in-a-scenario-a-4xx-is-data-not-an-exception.md +0 -25
  457. package/knowledge/decisions/internals/in-memory-workflow-history-aliases-the-live-step-object.md +0 -26
  458. package/knowledge/decisions/internals/index.md +0 -182
  459. package/knowledge/decisions/internals/istanbul-statement-counts-attach-to-the-start-line-only.md +0 -25
  460. package/knowledge/decisions/internals/local-trigger-and-gateway-services-assume-a-single-process.md +0 -26
  461. package/knowledge/decisions/internals/mcp-wire-names-are-assigned-over-the-whole-registry.md +0 -39
  462. package/knowledge/decisions/internals/node-only-builtins-are-imported-dynamically.md +0 -24
  463. package/knowledge/decisions/internals/one-project-shape-check-two-validators.md +0 -53
  464. package/knowledge/decisions/internals/only-exposed-functions-enter-a-virtual-user-catalogue.md +0 -21
  465. package/knowledge/decisions/internals/queue-group-concurrency-keeps-one-shared-queue-fair.md +0 -28
  466. package/knowledge/decisions/internals/queue-jobs-always-carry-an-explicit-attempts-count.md +0 -27
  467. package/knowledge/decisions/internals/remote-addons-dispatch-over-http-instead-of-local-meta.md +0 -31
  468. package/knowledge/decisions/internals/role-names-cannot-contain-the-scope-separator.md +0 -30
  469. package/knowledge/decisions/internals/rpc-names-resolve-through-package-scope-before-root.md +0 -32
  470. package/knowledge/decisions/internals/scenario-agent-calls-sign-in-on-401-only.md +0 -31
  471. package/knowledge/decisions/internals/scenario-given-and-when-are-sugar-but-then-is-not.md +0 -24
  472. package/knowledge/decisions/internals/scenario-meta-lives-apart-from-app-meta-but-merges-when-read-off-disk.md +0 -26
  473. package/knowledge/decisions/internals/scenario-steps-return-drained-response-records.md +0 -27
  474. package/knowledge/decisions/internals/scenarios-live-in-files-named-for-them.md +0 -48
  475. package/knowledge/decisions/internals/scope-roots-may-be-co-declared-by-an-addon-and-its-host-app.md +0 -30
  476. package/knowledge/decisions/internals/serverless-channel-disconnect-must-tolerate-a-missing-channel.md +0 -28
  477. package/knowledge/decisions/internals/side-effects-are-an-allowlist-not-a-boolean.md +0 -34
  478. package/knowledge/decisions/internals/speech-synthesis-picks-a-voice-per-sentence-and-warns-once.md +0 -24
  479. package/knowledge/decisions/internals/the-agent-done-event-goes-through-the-middleware-and-is-awaited.md +0 -26
  480. package/knowledge/decisions/internals/the-api-report-pins-members-not-just-names.md +0 -43
  481. package/knowledge/decisions/internals/the-core-scope-validator-refuses-separator-wildcard-and-empty-segments.md +0 -22
  482. package/knowledge/decisions/internals/the-dev-queue-copies-prod-timing-and-serialization-semantics.md +0 -30
  483. package/knowledge/decisions/internals/the-ecosystem-entry-point-carries-the-adapter-surface.md +0 -83
  484. package/knowledge/decisions/internals/the-embedding-model-is-pinned-per-service-and-doc-query-embedding-is-split.md +0 -29
  485. package/knowledge/decisions/internals/the-in-memory-workflow-service-is-inline-only-and-single-process.md +0 -27
  486. package/knowledge/decisions/internals/the-kek-salt-is-scoped-to-the-key-version.md +0 -40
  487. package/knowledge/decisions/internals/the-mcp-handshake-is-challenged-only-when-every-target-is-gated.md +0 -29
  488. package/knowledge/decisions/internals/the-middleware-resolution-cache-is-deliberately-unbounded.md +0 -40
  489. package/knowledge/decisions/internals/the-per-invocation-rpc-view-is-a-class.md +0 -40
  490. package/knowledge/decisions/internals/the-pikku-user-id-resolves-in-a-fixed-order.md +0 -24
  491. package/knowledge/decisions/internals/the-runner-resolves-wire-services-itself.md +0 -31
  492. package/knowledge/decisions/internals/the-schema-service-is-never-stubbed.md +0 -26
  493. package/knowledge/decisions/internals/the-transcript-event-is-sent-ahead-of-the-run.md +0 -25
  494. package/knowledge/decisions/internals/the-virtual-user-catalogue-is-the-only-gate-on-what-may-be-called.md +0 -21
  495. package/knowledge/decisions/internals/the-virtual-user-prompt-says-json-because-of-json-object-mode.md +0 -22
  496. package/knowledge/decisions/internals/the-virtual-user-runtime-is-exported-from-the-virtual-user-entry-point.md +0 -28
  497. package/knowledge/decisions/internals/the-worker-disposition-is-the-one-that-is-not-testing.md +0 -22
  498. package/knowledge/decisions/internals/thread-history-records-the-transcript-not-the-audio.md +0 -25
  499. package/knowledge/decisions/internals/trigger-declaration-is-split-from-trigger-source.md +0 -33
  500. package/knowledge/decisions/internals/typed-secret-service-caches-for-the-process-lifetime.md +0 -26
  501. package/knowledge/decisions/internals/validate-checks-virtual-users-through-a-shared-module.md +0 -43
  502. package/knowledge/decisions/internals/validate-runs-checks-by-precondition.md +0 -115
  503. package/knowledge/decisions/internals/virtual-user-conversation-drives-the-target-through-a-transport-seam.md +0 -24
  504. package/knowledge/decisions/internals/virtual-user-conversation-verdicts-are-llm-self-evaluations.md +0 -25
  505. package/knowledge/decisions/internals/virtual-user-conversations-seed-a-hidden-kickoff-message.md +0 -23
  506. package/knowledge/decisions/internals/virtual-user-step-order-comes-from-insertion-order.md +0 -21
  507. package/knowledge/decisions/internals/virtual-users-are-declared-in-one-definevirtualusers-call-per-codebase.md +0 -30
  508. package/knowledge/decisions/internals/voice-output-speaks-unless-voice-input-explicitly-says-otherwise.md +0 -24
  509. package/knowledge/decisions/internals/webhook-delivery-history-records-every-attempt-best-effort.md +0 -26
  510. package/knowledge/decisions/internals/webhook-service-collaborators-are-constructor-args-not-locator-lookups.md +0 -25
  511. package/knowledge/decisions/internals/whether-a-run-is-inline-is-read-from-the-run-record.md +0 -58
  512. package/knowledge/decisions/internals/wiring-registries-erase-the-generics-their-wire-functions-capture.md +0 -35
  513. package/knowledge/decisions/internals/workflow-approval-expiry-is-decided-from-a-recorded-deadline.md +0 -34
  514. package/knowledge/decisions/internals/workflow-core-never-imports-a-browser-driver.md +0 -42
  515. package/knowledge/decisions/internals/workflow-dsl-meta-separates-runtime-expressions-from-literals.md +0 -38
  516. package/knowledge/decisions/internals/workflow-features-resolve-scenarios-by-object-identity.md +0 -29
  517. package/knowledge/decisions/internals/workflow-graph-inline-and-queued-runs-share-one-planner.md +0 -42
  518. package/knowledge/decisions/internals/workflow-graph-node-notes-are-excluded-from-the-graph-hash.md +0 -25
  519. package/knowledge/decisions/internals/workflow-inline-runs-report-their-run-id-before-they-can-fail.md +0 -29
  520. package/knowledge/decisions/internals/workflow-invocation-id-is-the-dedupe-key-not-step-id.md +0 -43
  521. package/knowledge/decisions/internals/workflow-queued-step-dispatch-requires-an-explicit-opt-in.md +0 -29
  522. package/knowledge/decisions/internals/workflow-queues-are-per-workflow-by-default.md +0 -42
  523. package/knowledge/decisions/internals/workflow-repeated-step-names-get-an-ordinal-suffix.md +0 -33
  524. package/knowledge/decisions/internals/workflow-replay-reads-its-steps-once-and-caches-only-the-immutable-half.md +0 -32
  525. package/knowledge/decisions/internals/workflow-retries-are-owned-by-the-workflow-not-the-queue.md +0 -31
  526. package/knowledge/decisions/internals/workflow-run-capabilities-are-extensions-not-subclasses.md +0 -39
  527. package/knowledge/decisions/internals/workflow-run-mirror-is-never-a-source-of-truth.md +0 -29
  528. package/knowledge/decisions/internals/workflow-run-polling-backs-off-to-the-callers-ceiling.md +0 -33
  529. package/knowledge/decisions/internals/workflow-run-timeline-is-a-pure-fold-over-durable-history.md +0 -37
  530. package/knowledge/decisions/internals/workflow-scenario-assertions-never-retry-and-record-one-step.md +0 -54
  531. package/knowledge/decisions/internals/workflow-scenario-hooks-are-a-scenario-only-affordance.md +0 -43
  532. package/knowledge/decisions/internals/workflow-scenario-prose-is-rendered-from-typed-calls-not-parsed-from-english.md +0 -32
  533. package/knowledge/decisions/internals/workflow-scenario-quarantine-reason-lives-in-code.md +0 -18
  534. package/knowledge/decisions/internals/workflow-scenario-step-targets-are-string-literals-for-the-inspector.md +0 -34
  535. package/knowledge/decisions/internals/workflow-step-compensation-runs-as-its-own-durable-step.md +0 -29
  536. package/knowledge/decisions/internals/workflow-step-dispatch-failure-is-transient-not-a-run-failure.md +0 -33
  537. package/knowledge/decisions/internals/workflow-step-lock-is-held-only-to-claim-the-step.md +0 -34
  538. package/knowledge/decisions/internals/workflow-step-rpc-name-is-provenance-only.md +0 -34
  539. package/knowledge/decisions/internals/workflow-suspend-and-approval-reasons-are-durable-step-identities.md +0 -38
  540. package/knowledge/decisions/internals/workflow-suspended-runs-keep-their-in-process-context.md +0 -30
  541. package/knowledge/decisions/security/a-bearer-token-checked-against-a-secret-reads-it-per-request.md +0 -26
  542. package/knowledge/decisions/security/a-call-without-a-session-raises-missing-session-not-forbidden.md +0 -20
  543. package/knowledge/decisions/security/a-caller-cookie-wins-over-the-jar-for-the-same-name.md +0 -23
  544. package/knowledge/decisions/security/a-channel-lifecycle-acts-as-the-socket-upgrade-session.md +0 -16
  545. package/knowledge/decisions/security/a-channel-requires-a-session-unless-it-says-auth-false.md +0 -26
  546. package/knowledge/decisions/security/a-credential-read-path-follows-its-declared-type-not-absence.md +0 -32
  547. package/knowledge/decisions/security/a-credential-type-is-a-literal-the-inspector-checks-at-declaration.md +0 -27
  548. package/knowledge/decisions/security/a-dropped-audit-write-is-always-logged.md +0 -28
  549. package/knowledge/decisions/security/a-first-party-cookie-is-written-only-after-its-purposes-consent.md +0 -33
  550. package/knowledge/decisions/security/a-function-never-receives-the-secret-service.md +0 -37
  551. package/knowledge/decisions/security/a-graph-run-starts-at-an-entry-node-the-graph-declared.md +0 -33
  552. package/knowledge/decisions/security/a-permission-gets-a-wire-it-cannot-reply-on.md +0 -33
  553. package/knowledge/decisions/security/a-public-function-says-so-with-auth-false.md +0 -34
  554. package/knowledge/decisions/security/a-readonly-session-reaches-only-readonly-functions.md +0 -25
  555. package/knowledge/decisions/security/a-scaffold-flag-says-a-surface-exists-not-who-may-call-it.md +0 -52
  556. package/knowledge/decisions/security/a-scheduled-virtual-user-run-needs-no-admin-at-run-time.md +0 -27
  557. package/knowledge/decisions/security/a-scoped-credential-view-is-limited-to-declared-names.md +0 -26
  558. package/knowledge/decisions/security/a-scoped-secret-view-reads-only-declared-keys-and-never-writes.md +0 -25
  559. package/knowledge/decisions/security/a-secret-is-sent-only-to-the-hosts-it-declares.md +0 -29
  560. package/knowledge/decisions/security/a-step-can-name-an-identity-no-virtual-user-holds-through-per-call-headers.md +0 -25
  561. package/knowledge/decisions/security/a-step-runs-the-function-the-workflow-dispatched-it-with.md +0 -37
  562. package/knowledge/decisions/security/a-stopped-run-by-id-skips-the-ownership-check.md +0 -24
  563. package/knowledge/decisions/security/a-vault-secret-redacts-on-serialization-and-throws-on-coercion.md +0 -29
  564. package/knowledge/decisions/security/a-virtual-user-catalogue-entry-is-filtered-by-scope-and-approval-is-denied-by-default.md +0 -30
  565. package/knowledge/decisions/security/a-virtual-user-environment-fails-closed.md +0 -38
  566. package/knowledge/decisions/security/a-virtual-user-is-never-offered-a-step-that-would-forge-its-own-oracle.md +0 -27
  567. package/knowledge/decisions/security/a-virtual-user-never-runs-against-production.md +0 -23
  568. package/knowledge/decisions/security/a-virtual-user-reads-its-roles-from-the-apps-own-rpc-before-better-auth.md +0 -27
  569. package/knowledge/decisions/security/a-virtual-user-run-treats-an-unresolved-environment-as-production.md +0 -41
  570. package/knowledge/decisions/security/a-virtual-user-scopes-are-expanded-from-its-roles-once-at-run-preparation.md +0 -25
  571. package/knowledge/decisions/security/a-virtual-user-whose-roles-drift-from-the-declaration-refuses-to-run.md +0 -32
  572. package/knowledge/decisions/security/a-workflow-run-is-read-and-approved-by-its-owner.md +0 -50
  573. package/knowledge/decisions/security/addon-auth-and-tags-only-tighten.md +0 -43
  574. package/knowledge/decisions/security/addon-config-gates-apply-only-at-the-namespaced-rpc-boundary.md +0 -52
  575. package/knowledge/decisions/security/addon-scopes-are-resolved-where-the-function-runs.md +0 -46
  576. package/knowledge/decisions/security/addon-screen-scopes-hide-and-do-not-enforce.md +0 -20
  577. package/knowledge/decisions/security/agent-approval-forwarding-requires-a-symbol-brand.md +0 -27
  578. package/knowledge/decisions/security/agent-credential-requests-are-symbol-branded.md +0 -37
  579. package/knowledge/decisions/security/agent-gate-requires-a-session-only-when-auth-is-true.md +0 -31
  580. package/knowledge/decisions/security/agent-ownership-failures-never-echo-the-resource.md +0 -23
  581. package/knowledge/decisions/security/agent-resume-re-runs-the-authorization-gate.md +0 -22
  582. package/knowledge/decisions/security/agent-sessionless-deployments-have-no-thread-ownership.md +0 -39
  583. package/knowledge/decisions/security/agent-thread-ownership-composes-the-session-principal.md +0 -30
  584. package/knowledge/decisions/security/agent-tool-filtering-reads-the-live-function-config.md +0 -24
  585. package/knowledge/decisions/security/an-addon-header-can-only-narrow-the-session.md +0 -26
  586. package/knowledge/decisions/security/an-addon-instance-reads-only-the-secrets-and-credentials-it-is-named.md +0 -33
  587. package/knowledge/decisions/security/an-addon-may-reach-only-itself-and-the-addons-it-uses.md +0 -16
  588. package/knowledge/decisions/security/an-agent-approval-is-claimed-before-the-tool-runs.md +0 -33
  589. package/knowledge/decisions/security/an-api-key-is-jwt-decoded-into-the-session.md +0 -26
  590. package/knowledge/decisions/security/an-approval-answer-outlives-the-run-it-answered.md +0 -59
  591. package/knowledge/decisions/security/an-empty-owners-constraint-matches-nothing.md +0 -30
  592. package/knowledge/decisions/security/an-exposed-ungated-function-is-a-codegen-warning.md +0 -52
  593. package/knowledge/decisions/security/an-external-virtual-user-caller-presents-one-signed-statement.md +0 -38
  594. package/knowledge/decisions/security/an-inbound-webhook-source-dispatches-only-verified-requests.md +0 -31
  595. package/knowledge/decisions/security/an-mcp-call-with-no-http-request-stays-anonymous.md +0 -18
  596. package/knowledge/decisions/security/an-mcp-refusal-is-decided-before-dispatch.md +0 -48
  597. package/knowledge/decisions/security/an-oauth2-credential-is-read-by-its-account-row.md +0 -40
  598. package/knowledge/decisions/security/an-omitted-user-id-addresses-the-platform-credential.md +0 -32
  599. package/knowledge/decisions/security/an-upload-is-counted-as-it-arrives-not-buffered-then-measured.md +0 -24
  600. package/knowledge/decisions/security/analytics-identity-is-stamped-from-the-session-not-the-event.md +0 -24
  601. package/knowledge/decisions/security/app-access-is-a-scope-tree-synthesised-from-virtual-users.md +0 -26
  602. package/knowledge/decisions/security/approval-policy-decides-who-answers-a-tool-call.md +0 -27
  603. package/knowledge/decisions/security/auth-false-on-a-session-function-warns-and-still-requires-one.md +0 -25
  604. package/knowledge/decisions/security/bearer-token-hashes-are-unpeppered-sha256.md +0 -18
  605. package/knowledge/decisions/security/consent-is-read-from-a-cookie-and-a-recognised-denial-counts-as-refusal.md +0 -29
  606. package/knowledge/decisions/security/console-addon-privileged-functions-gate-themselves.md +0 -84
  607. package/knowledge/decisions/security/core-safe-fetch-blocks-ssrf-by-host-literal-not-dns.md +0 -39
  608. package/knowledge/decisions/security/core-secrets-use-a-per-secret-dek-wrapped-by-a-kek.md +0 -37
  609. package/knowledge/decisions/security/cors-defaults-to-any-origin-and-refuses-the-wildcard-with-credentials.md +0 -22
  610. package/knowledge/decisions/security/credential-backends-share-one-conformance-suite-for-per-user-isolation.md +0 -29
  611. package/knowledge/decisions/security/each-stage-has-one-virtual-user-key-pair.md +0 -27
  612. package/knowledge/decisions/security/gateway-handlers-run-through-the-function-runner-gate.md +0 -41
  613. package/knowledge/decisions/security/gateway-middleware-sessions-must-be-bridged-onto-the-wire.md +0 -30
  614. package/knowledge/decisions/security/global-permissions-and-function-permissions-are-independent-gates.md +0 -40
  615. package/knowledge/decisions/security/hmac-verification-fails-closed-on-empty-inputs.md +0 -25
  616. package/knowledge/decisions/security/http-error-detail-is-withheld-from-clients-in-production.md +0 -33
  617. package/knowledge/decisions/security/http-request-bodies-are-bounded-before-they-are-buffered.md +0 -46
  618. package/knowledge/decisions/security/index.md +0 -135
  619. package/knowledge/decisions/security/local-content-refuses-private-buckets-under-the-public-segment.md +0 -21
  620. package/knowledge/decisions/security/mail-is-allowlisted-before-a-virtual-user-run-sees-it.md +0 -38
  621. package/knowledge/decisions/security/mcp-internal-error-details-are-double-gated-on-production.md +0 -27
  622. package/knowledge/decisions/security/mcp-resources-tools-and-prompts-take-sessionless-functions.md +0 -18
  623. package/knowledge/decisions/security/origin-locked-routes-match-the-origin-exactly.md +0 -22
  624. package/knowledge/decisions/security/oss-auth-works-without-pikku-studio-cloud.md +0 -26
  625. package/knowledge/decisions/security/outbound-webhooks-use-an-allowlist-when-configured.md +0 -24
  626. package/knowledge/decisions/security/passphrases-are-stretched-key-material-is-expanded.md +0 -40
  627. package/knowledge/decisions/security/permission-auth-filtering-requires-live-permission-functions.md +0 -31
  628. package/knowledge/decisions/security/pikku-carries-virtual-user-scopes-as-data-and-the-app-grants-them.md +0 -35
  629. package/knowledge/decisions/security/queue-job-identities-are-signed-at-enqueue.md +0 -69
  630. package/knowledge/decisions/security/queue-jobs-carry-the-producers-pikku-user-id.md +0 -39
  631. package/knowledge/decisions/security/remote-addon-tokens-are-client-credentials-not-mesh-trust.md +0 -34
  632. package/knowledge/decisions/security/scaffold-features-are-authenticated-unless-opted-out.md +0 -55
  633. package/knowledge/decisions/security/scenario-step-functions-are-never-externally-invocable.md +0 -30
  634. package/knowledge/decisions/security/scope-resolution-happens-at-the-session-boundary-and-sync-never-deletes.md +0 -28
  635. package/knowledge/decisions/security/scoped-content-access-is-a-root-folder-with-longest-prefix-grants.md +0 -31
  636. package/knowledge/decisions/security/self-authentication-is-declared-not-detected.md +0 -34
  637. package/knowledge/decisions/security/services-without-secrets-get-a-throwing-secrets-accessor.md +0 -22
  638. package/knowledge/decisions/security/shared-guards-refuse-to-mutate-or-shadow-a-system-role.md +0 -34
  639. package/knowledge/decisions/security/signed-content-urls-bind-the-request-path.md +0 -37
  640. package/knowledge/decisions/security/signed-uploads-are-verified-by-the-same-check-as-signed-reads.md +0 -26
  641. package/knowledge/decisions/security/system-role-scopes-must-be-declared-with-define-scope.md +0 -24
  642. package/knowledge/decisions/security/system-roles-are-additive-and-immutable.md +0 -16
  643. package/knowledge/decisions/security/the-channel-rpc-does-not-send-the-callers-session.md +0 -21
  644. package/knowledge/decisions/security/the-remote-jobs-inbox-fails-closed-without-a-secret.md +0 -24
  645. package/knowledge/decisions/security/the-remote-rpc-gate-fails-closed-and-binds-the-token-to-its-function.md +0 -34
  646. package/knowledge/decisions/security/the-workflow-status-stream-rechecks-ownership-on-every-poll.md +0 -16
  647. package/knowledge/decisions/security/two-credentials-on-one-key-must-share-a-read-mode.md +0 -29
  648. package/knowledge/decisions/security/verified-bearer-claims-are-pass-through-data-that-core-never-fills.md +0 -23
  649. package/knowledge/decisions/security/virtual-user-catalogue-excludes-the-machinery-that-runs-virtual-users.md +0 -25
  650. package/knowledge/decisions/security/virtual-user-conversation-missing-approval-decisions-default-to-denied.md +0 -22
  651. package/knowledge/decisions/security/virtual-user-run-records-are-gated-behind-a-read-scope.md +0 -18
  652. package/knowledge/decisions/security/virtual-user-sign-in-does-not-exist-in-production.md +0 -25
  653. package/knowledge/decisions/security/virtual-user-sign-in-has-one-door.md +0 -42
  654. package/knowledge/decisions/security/virtual-user-sign-in-is-proven-by-set-cookie-not-a-non-empty-jar.md +0 -29
  655. package/knowledge/decisions/security/virtual-user-sign-in-only-works-for-virtual-user-flagged-users.md +0 -29
  656. package/knowledge/decisions/security/webhook-bodies-are-signed-before-they-are-enqueued.md +0 -25
  657. package/knowledge/decisions/security/wire-addon-expose-selects-the-rpc-surface.md +0 -51
  658. package/knowledge/decisions/security/workflow-approval-payloads-are-validated-on-replay-inside-the-workflow.md +0 -40
  659. package/knowledge/decisions/security/workflow-helper-functions-are-sessionless-by-declaration.md +0 -18
  660. package/knowledge/decisions/security/workflow-queued-steps-rehydrate-their-session-from-the-run-wire.md +0 -32
  661. package/knowledge/decisions/security/workflow-scenario-sessions-are-isolated-per-virtual-user-and-per-scenario.md +0 -32
  662. package/knowledge/decisions/security/workflow-scenario-steps-are-never-network-invocable.md +0 -31
  663. package/knowledge/decisions/security/workflow-virtual-user-steps-always-use-the-real-transport.md +0 -34
  664. package/knowledge/decisions/security/writing-a-virtual-user-schedule-is-gated-by-its-own-scope.md +0 -18
  665. package/knowledge/index.md +0 -24
  666. package/knowledge/questions/a-bearer-jwt-with-no-identity-becomes-a-session.md +0 -24
  667. package/knowledge/questions/channel-middleware-accepts-bare-factories-that-nothing-resolves.md +0 -35
  668. package/knowledge/questions/dev-quick-login-as-impersonation.md +0 -25
  669. package/knowledge/questions/does-a-delayed-rpc-run-as-the-session-it-was-scheduled-with.md +0 -26
  670. package/knowledge/questions/does-a-user-id-with-a-colon-read-another-users-credentials.md +0 -27
  671. package/knowledge/questions/does-a-wirecli-command-need-a-session-by-default.md +0 -26
  672. package/knowledge/questions/does-an-adversarial-in-scope-success-count-as-a-finding.md +0 -26
  673. package/knowledge/questions/does-approve-step-need-the-run-owners-session-or-the-gates-approvers.md +0 -34
  674. package/knowledge/questions/does-cors-origin-true-reflect-any-origin-with-credentials.md +0 -20
  675. package/knowledge/questions/does-skip-user-session-do-anything-on-a-channel.md +0 -24
  676. package/knowledge/questions/does-the-store-session-match-the-other-two.md +0 -19
  677. package/knowledge/questions/index.md +0 -41
  678. package/knowledge/questions/is-the-agent-score-worker-reachable-without-a-session.md +0 -21
  679. package/knowledge/questions/live-scheduled-tests-may-write.md +0 -19
  680. package/knowledge/questions/provision-virtual-users-has-no-caller-in-this-repo.md +0 -23
  681. package/knowledge/questions/remote-secret-refuses-requests-without-a-remote-token-on-every-path.md +0 -32
  682. package/knowledge/questions/should-a-middleware-set-session-persist-to-the-store.md +0 -25
  683. package/knowledge/questions/should-a-scoped-secret-view-throw-from-has-secret-for-a-disallowed-key.md +0 -23
  684. package/knowledge/questions/should-a-wrong-bearer-token-be-anonymous-or-refused.md +0 -35
  685. package/knowledge/questions/should-an-empty-webhook-signing-secret-send-unsigned.md +0 -23
  686. package/knowledge/questions/should-http-virtual-user-sessions-reset-between-scenarios-in-one-run.md +0 -27
  687. package/knowledge/questions/should-the-cookie-jar-scope-cookies-to-the-api-origin.md +0 -26
  688. package/knowledge/questions/should-voice-input-fetch-audio-urls-without-a-host-allowlist.md +0 -20
  689. package/knowledge/questions/staging-impersonation-rules.md +0 -27
  690. package/knowledge/questions/unauthorized-channel-replies-escape-the-declared-out-type.md +0 -44
  691. package/knowledge/questions/virtual-user-keys-on-cloud-stages-are-pikku-studios-to-build.md +0 -33
  692. package/knowledge/questions/virtual-user-statement-replay-is-per-process.md +0 -20
  693. package/knowledge/questions/what-an-impersonated-session-carries.md +0 -22
  694. package/run-tests.sh +0 -68
  695. package/scripts/generate-api-report.d.mts +0 -1
  696. package/scripts/generate-api-report.mjs +0 -96
  697. package/scripts/generate-api-report.mts +0 -333
  698. package/src/public-surface.json +0 -637
  699. package/src/public-surface.json.README +0 -43
  700. /package/dist/{function/compensation-name.d.ts → compensation-name.d.ts} +0 -0
  701. /package/dist/{function/compensation-name.js → compensation-name.js} +0 -0
@@ -1,30 +0,0 @@
1
- ---
2
- type: decision
3
- title: Virtual users are declared in exactly one defineVirtualUsers call per codebase
4
- description: defineVirtualUsers is a no-op declaration that the inspector reads statically, and a second call anywhere in the codebase fails the build
5
- tags: core, inspector, virtual-users, declaration
6
- ---
7
-
8
- # Virtual users are declared in exactly one defineVirtualUsers call per codebase
9
-
10
- `defineVirtualUsers` in `packages/core/src/wirings/virtual-user/define-virtual-users.ts`
11
- is a no-op (`define-virtual-users.ts:33`). The CLI reads the call by AST and
12
- generates a `VirtualUserId` union and `virtual-users.gen.json` from it
13
- (`define-virtual-users.ts:3-8`). The doc comment states the rule: "Exactly one
14
- `defineVirtualUsers(...)` is allowed per codebase, so there is one place to read the
15
- cast from and one place to add to. A second call — even in the same file — fails
16
- the build" (`define-virtual-users.ts:14-16`).
17
-
18
- The inspector enforces it. `addVirtualUsers` requires an inline object literal and
19
- refuses anything else (`packages/inspector/src/add/add-virtual-users.ts:163-170`),
20
- then claims the single declaration (`add-virtual-users.ts:174-181`, error
21
- `DUPLICATE_VIRTUAL_USERS_DEFINITION`). `claimSingleDeclaration` in
22
- `packages/inspector/src/utils/single-declaration.ts` refuses a second call in the
23
- same file or another one (`single-declaration.ts:44-56`). Generated `.gen.ts` files
24
- are exempt and never claim the slot (`single-declaration.ts:40-42`).
25
-
26
- **What this rules out:** a second `defineVirtualUsers` call, including in the same
27
- file, and splitting the cast across several declarations. The rule is about where a
28
- person adds a virtual user, so it applies to hand-written files only.
29
-
30
- **Related:** [scenario and virtual-user files are named for what they hold](scenarios-live-in-files-named-for-them.md)
@@ -1,24 +0,0 @@
1
- ---
2
- type: decision
3
- title: Only an explicit `false` silences a spoken reply
4
- description: The key being absent means no voice input is wired and nothing reported either way, so those callers keep the behaviour they had before the option existed
5
- tags: core, agent
6
- ---
7
-
8
- # Only an explicit `false` silences a spoken reply
9
-
10
- `voiceOutput` speaks a reply unless the turn is explicitly marked as not having
11
- arrived by voice. The distinction is between three states, not two:
12
-
13
- - `true` — `voiceInput` handled this turn and it carried speech.
14
- - `false` — `voiceInput` handled this turn and a real user really typed it.
15
- - absent — no voice input is wired at all, so nothing reported either way.
16
-
17
- Treating absent as `false` would silence every caller who wired `voiceOutput`
18
- without `voiceInput`, changing behaviour that worked before the option existed.
19
- Treating absent as `true` would speak replies to typists on any stack where the
20
- flag never gets set.
21
-
22
- **What this rules out:** normalising the flag to a boolean at any point between
23
- `voiceInput` and `voiceOutput` — that collapses absent into one of the other two
24
- and picks a wrong answer for somebody.
@@ -1,26 +0,0 @@
1
- ---
2
- type: decision
3
- title: Webhook delivery history records every attempt, best effort
4
- description: The webhook worker persists each attempt before it throws, and a failure to persist is logged rather than allowed to mask the delivery result
5
- tags: services
6
- ---
7
-
8
- # Webhook delivery history records every attempt, best effort
9
-
10
- `pikkuWebhookWorkerFunc` (`packages/core/src/services/queue-webhook-service.ts`)
11
- POSTs the delivery, then — when the job carries a `deliveryId` — calls
12
- `webhookService.recordAttempt` with the outcome _before_ throwing on a non-2xx.
13
- The throw is what makes the queue retry, so recording first is the only way the
14
- console's delivery history shows every try rather than just the final one.
15
-
16
- A `deliveryId` is only present when a store-backed implementation (e.g.
17
- `KyselyWebhookService`) enqueued the job, which is why the queue-only default's
18
- base `recordAttempt` — which throws `NotImplementedError` — is never reached.
19
- The `recordAttempt` call is wrapped in `.catch(log)`: history is bookkeeping, and
20
- a store outage must not turn a delivered webhook into a failed one, nor a failed
21
- one into an unexplained crash.
22
-
23
- **What this rules out:** awaiting `recordAttempt` without the catch, moving it
24
- after the throw, or making the worker's success depend on the store being
25
- reachable. Equally, do not delete the `.catch` as a swallowed error — the log
26
- line is the intended handling.
@@ -1,25 +0,0 @@
1
- ---
2
- type: decision
3
- title: Webhook service collaborators are constructor args, not locator lookups
4
- description: QueueWebhookService takes its queue as a constructor parameter so a project wiring webhooks without a queue fails to compile instead of at first send
5
- tags: services
6
- ---
7
-
8
- # Webhook service collaborators are constructor args, not locator lookups
9
-
10
- `QueueWebhookService` (`packages/core/src/services/queue-webhook-service.ts`)
11
- takes `queueService` as a constructor parameter, even though it reaches for
12
- `config` and `secrets` through `getSingletonServices()` inside its methods. The
13
- queue is different on purpose: it is the collaborator without which the class
14
- cannot do anything at all.
15
-
16
- A `getSingletonServices()` lookup turns a wiring mistake into a runtime failure
17
- on the first `send()` — typically in production, typically on the first webhook a
18
- customer was waiting for. A constructor parameter turns the same mistake into a
19
- type error at the point where the service is wired.
20
-
21
- **What this rules out:** "simplifying" the constructor away so the class looks
22
- like its neighbours and pulls the queue from the service locator like everything
23
- else. The inconsistency inside this class is the decision, not an oversight; if
24
- anything the pressure should run the other way, toward making `config` and
25
- `secrets` constructor args too.
@@ -1,58 +0,0 @@
1
- ---
2
- type: decision
3
- title: Whether a run is inline is read from the run record
4
- description: The runContexts map is a read-through cache over WorkflowRun.inline and a lifetime for replay ordinals, never the answer to what a run is
5
- tags: workflow, state
6
- ---
7
-
8
- # Whether a run is inline is read from the run record
9
-
10
- `PikkuWorkflowService.isInline` resolves `WorkflowRun.inline` from the store and
11
- caches it on the process-local `runContexts` entry for the duration of the
12
- execution that is running the step. `registerInlineRun` / `unregisterInlineRun`
13
- prime and evict that cache; they no longer decide anything. Both callers pass
14
- the same `shouldInline` to `createRun` that they pass to `registerInlineRun`, so
15
- the prime is only ever a saved read.
16
-
17
- `inline` decides two forks: whether a failed step retries in-process or is
18
- handed to the queue, and whether a sleep blocks here or goes to the
19
- `schedulerService`. Answering them from a `Map` that only the instance that
20
- called `startWorkflow` ever populated makes both forks instance-dependent. On
21
- Lambda, Workers, or any multi-instance container deployment, instance B reads an
22
- empty map, concludes the run is queued, and dispatches an orchestrator job for a
23
- run instance A is already driving in-process — two executors on one run. The
24
- durable field is the only thing every instance can agree on.
25
-
26
- `isInline` is therefore `async`. Its four call sites — `inlineStep` and
27
- `scheduleSleep` in core, `dispatchStep` and `scheduleSleep` in the Cloudflare
28
- Durable Object service — were already `async`, so nothing had to become
29
- asynchronous to accommodate it. Resolving it through `getRunIdentity` means a
30
- run job that already read its run pays no second read, and caching the answer on
31
- the context bounds a step worker to one read. `WorkflowRun.inline` is written
32
- once at `createRun` and never mutated, so a cached value cannot go stale.
33
-
34
- The same entry carries per-replay ordinals, the last step name, and the step
35
- snapshot. Those are genuinely process-local — they exist to give
36
- `name`, `name#1`, `name#2` to repeated reaches of one logical step within a
37
- single walk of a workflow, and to let a replay read its rows once. Their
38
- lifetime is now an explicit `activeExecutions` count incremented by
39
- `runWorkflowJob` and by `executeWorkflowStep` and decremented in their `finally`
40
- blocks; the entry is deleted when the count reaches zero, and a terminal
41
- `updateRunStatus` that arrives mid-execution defers to that. Previously
42
- `nextStepKey` lazily created a `replay` object on every step invocation while
43
- `releaseContext` refused to free any entry that had one, so any step reached
44
- outside a `beginReplay` bracket — a graph node's RPC using its workflow wire
45
- from the step-worker queue — stranded an ordinals map and a step-state snapshot
46
- for the life of the process.
47
-
48
- Resetting ordinals per execution rather than letting them accumulate across
49
- separate step-worker invocations also makes step naming independent of how the
50
- work happened to be distributed. Two step workers in one process used to see
51
- different ordinals than the same two workers on different instances.
52
-
53
- **What this rules out:** answering `isInline` from the map alone and defaulting
54
- to `false` on a miss, which is the split-brain; a synchronous `isInline` backed
55
- by a cache nothing guarantees is populated; keeping a run's entry alive because
56
- a value is cached in it, since a cache that is never evicted is a leak; and
57
- mutating `WorkflowRun.inline` after creation, which the cache is only safe
58
- because nothing does.
@@ -1,35 +0,0 @@
1
- ---
2
- type: decision
3
- title: Wiring registries erase the generics their wire* functions capture
4
- description: A registry is typed at unknown so every wiring shares one map; storing a generic config in it needs an assertion, because function parameters are contravariant
5
- tags: core
6
- ---
7
-
8
- # Wiring registries erase the generics their `wire*` functions capture
9
-
10
- Every `wire*` entry point — `wireTrigger`, `wireTriggerSource`, `wireChannel`,
11
- `wireQueueWorker`, and the rest — is generic in the shape a caller declares, so
12
- the caller gets a checked `func`. The registry each one writes to is not:
13
- `pikkuState(null, 'trigger', 'triggers')` is a
14
- `Map<string, CoreTriggerSource>` where `CoreTriggerSource` fixes input and
15
- output at `unknown`, because one map has to hold every trigger in the app.
16
-
17
- Handing `CoreTriggerSource<TInput, TOutput>` to a slot typed
18
- `CoreTriggerSource<unknown, unknown>` is not an upcast. `func` takes its input
19
- as a _parameter_, and parameters are contravariant: a function that accepts
20
- `TInput` cannot stand in for one that accepts `unknown`, since `unknown` admits
21
- values `TInput` does not. TypeScript is right to reject it, and no variance
22
- annotation makes it go away — the registry genuinely holds functions whose input
23
- types it cannot name.
24
-
25
- The runtime is nonetheless sound, because the only thing that ever invokes a
26
- registered `func` is the function runner, which validates the incoming data
27
- against that function's own generated schema before the call. The type the
28
- registry lost is re-established at the call boundary by the schema, not by the
29
- type system.
30
-
31
- **What this rules out:** deleting these assertions as if they were noise — the
32
- code does not compile without them. It equally rules out `as any` in their
33
- place: `as any` discards the target type too, so a genuinely wrong config would
34
- also slip through. Assert to the registry's own element type and let everything
35
- except the erased generic stay checked.
@@ -1,34 +0,0 @@
1
- ---
2
- type: decision
3
- title: Workflow approval expiry is decided from a recorded deadline, not from a timer firing
4
- description: The wake-up job is best-effort liveness; losing, duplicating or delaying it cannot change the gate's answer
5
- tags: workflow
6
- ---
7
-
8
- # Workflow approval expiry is decided from a recorded deadline, not from a timer firing
9
-
10
- On its first reach, `approvalStep` in `pikku-workflow-service.ts` stamps
11
- `expiresAt` into the gate's run-state record and calls `scheduleRunWake`. Every
12
- later replay decides expiry by comparing `Date.now()` against that recorded
13
- deadline. A duplicate, late, or entirely dropped timer therefore all produce the
14
- same answer, and losing the wake costs liveness — the run sits until something
15
- else resumes it — never correctness.
16
-
17
- `scheduleRunWake` deliberately enqueues a delayed _orchestrator_ pass rather
18
- than reusing `scheduleSleep`. `scheduleSleep` resolves the step it is given,
19
- which for an approval would resolve the gate itself; the wake only nudges the
20
- run to replay and re-evaluate, leaving the gate the sole judge of its own
21
- outcome. It is wrapped in a try/catch that logs and continues, because a
22
- scheduling failure must not fail the run.
23
-
24
- An approval returns an `ApprovalOutcome` union (`decided` | `expired`) rather
25
- than throwing on the deadline, so callers are forced to handle expiry and "skip
26
- it and carry on" stays trivial. `decided` means a human answered — whether the
27
- answer was yes or no rides in `data` and is the application's business.
28
-
29
- **What this rules out:** treating the timer's delivery as the expiry signal,
30
- routing the wake through `scheduleSleep` or any path that writes the gate's step
31
- result, letting a `scheduleRunWake` failure propagate, or turning expiry into a
32
- thrown error. Expiry also fires unconditionally once enqueued — a durable timer
33
- cannot be retracted — so the replay must no-op it when a decision has already
34
- landed.
@@ -1,42 +0,0 @@
1
- ---
2
- type: decision
3
- title: Core declares the scenario browser surface structurally and never imports a driver
4
- description: `@pikku/core` must stay dependency-free for edge runtimes, so playwright augments the interface instead of being imported by it
5
- tags: workflow
6
- ---
7
-
8
- # Core declares the scenario browser surface structurally and never imports a driver
9
-
10
- `PikkuBrowserWire`, `TestIdSelector`, `ScenarioBrowserProvider` and
11
- `ScenarioBrowserFailure` all live in `scenario-step.types.ts` as plain
12
- structural types. `@pikku/core` deliberately never imports playwright — it has
13
- to stay dependency-free for edge runtimes — so `@pikku/playwright` augments
14
- `PikkuBrowserWire` via `declare module`, and `wire.browser.page` becomes a fully
15
- typed Playwright `Page` only in a project that installs it. Declaring the
16
- provider contract here is also what lets the CLI depend on core alone.
17
-
18
- `reset` and `captureFailure` are optional on `ScenarioBrowserProvider` so a
19
- driver written against an earlier version keeps compiling; the runner treats a
20
- driver without them as one offering no isolation and no diagnostics.
21
- `captureFailure` must never throw — a failure to capture must not replace the
22
- failure being captured — and exists because a browser step fails with a selector
23
- timeout that says nothing about _why_ the page never rendered; the answer is
24
- almost always in the page's own console and request errors, which the driver has
25
- been collecting all along.
26
-
27
- `TestIdSelector` is richer than a bare `data-testid` because one rarely names
28
- exactly one element: `where` matches the element's own data attributes (so a
29
- step asserts a status without reading translated copy back to the app), `prefix`
30
- matches a family of ids, `containing` picks the match holding a piece of text,
31
- and `within` scopes the lookup to one row or section. Core defines the shape;
32
- the driver resolves it against a real page.
33
-
34
- The same dependency discipline applies at runtime: `resolveScenarioVirtualUsers` in
35
- `pikku-scenario-service.ts` imports the HTTP virtual user client lazily, so even a
36
- runner bundle only pays for the AI virtual user conversation loop when a scenario
37
- actually signs a virtual user in.
38
-
39
- **What this rules out:** importing playwright (or any driver) from core,
40
- tightening `reset`/`captureFailure` to required, letting `captureFailure` throw,
41
- reducing `TestIdSelector` to a plain string, or making the virtual-user-client import
42
- static.
@@ -1,38 +0,0 @@
1
- ---
2
- type: decision
3
- title: Workflow DSL meta keeps runtime expressions in their own field, apart from literal values
4
- description: A string `value` regenerates as a string literal; an `expression` regenerates as code, so the two can never share a field
5
- tags: workflow
6
- ---
7
-
8
- # Workflow DSL meta keeps runtime expressions in their own field, apart from literal values
9
-
10
- Several step metas in `dsl/workflow-dsl.types.ts` carry a literal field and a
11
- parallel `expression` field: `SetStepMeta` has `value` and `expression`
12
- (`count + 1`), `SleepStepMeta` has `duration` and `expression` (a duration known
13
- only at runtime, e.g. a loop variable). They are mutually exclusive by
14
- construction because regenerated code has to emit them differently — a string
15
- `value` becomes a string literal, an `expression` becomes raw code. Collapsing
16
- them would make every computed assignment regenerate as a quoted string.
17
-
18
- Two related shapes exist for the same "the extractor cannot see this
19
- statically" reason. `ReturnStepMeta.spread` records variables spread into a
20
- returned object (`return { ...r }`) or a sole returned variable (`return r`) by
21
- name, because their fields are not enumerable statically and cannot be expanded
22
- into `outputs`. `FeatureMeta.unresolvedEntries` counts feature entries that
23
- could not be read statically (a spread, a `.map()`), so a non-zero count marks
24
- the listing as partial rather than pretending it is complete.
25
-
26
- `FanoutStepMeta.stepName` is optional for a different structural reason: a
27
- fanout is not itself a cached step, and node ids are step names — borrowing a
28
- body step's name would give the loop and that step the same id, collapsing one
29
- onto the other.
30
-
31
- Free-text documentation (`GraphNodeConfig.notes`,
32
- `PikkuWorkflowGraphConfig.notes`) is excluded from the graph topology hash, so
33
- editing a note never marks the workflow as changed and never triggers a version
34
- mismatch on in-flight runs.
35
-
36
- **What this rules out:** merging `expression` into `value`/`duration`, expanding
37
- `spread` into concrete `outputs`, giving a fanout a required `stepName` taken
38
- from its body, and folding `notes` into `graphHash`.
@@ -1,29 +0,0 @@
1
- ---
2
- type: decision
3
- title: A feature resolves its scenarios by object identity, never by name or shape
4
- description: An unregistered scenario comes back explicitly unresolved rather than silently running as something else
5
- tags: workflow
6
- ---
7
-
8
- # A feature resolves its scenarios by object identity, never by name or shape
9
-
10
- `resolveFeatureScenarios` in `feature.ts` builds a `Map` keyed by the registered
11
- config object itself and looks each feature entry up in it. `pikkuScenario`
12
- returns its config verbatim and `addWorkflow` registers that same object, so a
13
- feature holding the imported identifier holds the very object that was
14
- registered. Nothing is matched by shape, by name, or by any other guess.
15
-
16
- That is also why a scenario built inline inside a feature — and therefore never
17
- registered — comes back in `unresolved` rather than silently running as
18
- something else. Because scenarios are referenced by imported identifier, a
19
- renamed or deleted scenario is a compile error rather than a silent skip.
20
-
21
- Entries are returned in declaration order and features in registration order,
22
- since a feature's reading order is its declaration order. A scenario's effective
23
- tags are its own unioned with the containing feature's, so a tag filter selects
24
- through the feature.
25
-
26
- **What this rules out:** falling back to name matching when identity lookup
27
- misses, structurally comparing configs, or dropping unresolved entries silently
28
- instead of reporting them — each turns "this scenario is not registered" into
29
- "some other scenario ran instead".
@@ -1,42 +0,0 @@
1
- ---
2
- type: decision
3
- title: Inline and queued workflow graph runs share one transition planner
4
- description: A second, weaker inline traversal would lose joins, cycle revisits and step provenance that the queued path has
5
- tags: workflow
6
- ---
7
-
8
- # Inline and queued workflow graph runs share one transition planner
9
-
10
- `planGraphTransitions` in `graph/graph-runner.ts` is the single place that
11
- decides which nodes fire next. `continueGraph` (queued) and
12
- `continueGraphInline` (in-process loop) both call it; they differ only in
13
- whether the planned wave is dispatched via `queueGraphNode` or executed by
14
- `executeGraphNodeInline`. Sharing the planner is what gives the inline path
15
- joins, cycle revisits and `fromStepName` provenance identical to the queue,
16
- instead of a second and weaker traversal. `executeGraphNodeInline` persists
17
- under the same physical instance key and records the same predecessor as
18
- `queueGraphNode` for the same reason.
19
-
20
- The planner distinguishes two kinds of edge. A forward edge is node-once: the
21
- target fires only if it has no instance yet, so converging edges (joins)
22
- collapse to a single run. A back-edge — one whose target can reach the source,
23
- detected by `closesCycle` — is a revisit: it fires a fresh ordinal instance
24
- (`target#1`, …) and is edge-once on `from → target` so it does not re-fire every
25
- tick. Cycles terminate when branch routing stops looping back, and every
26
- instance records the predecessor it was reached from.
27
-
28
- `remapStepNamesToNodeIds` and `remapBranchKeys` are called on the completed and
29
- branch sets even where their results are discarded: planning keys steps
30
- physically, so those calls exist only to surface an ambiguous template-node
31
- config as an error.
32
-
33
- On the queued path a node that sets no `retries` falls back to
34
- `DEFAULT_STEP_RETRIES` rather than to zero, so the persisted step's retry count
35
- matches the queue job's `attempts` (see `resolveStepJobOptions`). A step row
36
- claiming one attempt while the queue silently delivers five is the kind of
37
- disagreement that makes a retry bug unreadable from the outside.
38
-
39
- **What this rules out:** writing a separate traversal for the inline path,
40
- making forward edges fire per-edge (which breaks joins) or back-edges fire
41
- node-once (which breaks loops), dropping `fromStepName` from either path, and
42
- deleting the "unused" remap calls as dead code.
@@ -1,25 +0,0 @@
1
- ---
2
- type: decision
3
- title: Workflow graph node notes are non-semantic and excluded from the graph hash
4
- description: Documentation on a node must not count as a topology change, or editing a comment redeploys the workflow
5
- tags: workflow
6
- ---
7
-
8
- # Workflow graph node notes are non-semantic and excluded from the graph hash
9
-
10
- `GraphNodeConfig.notes` (`graph/workflow-graph.types.ts`, mirrored on the typed
11
- builder in `graph/graph-node.ts`) is free-text documentation attached to a node.
12
- It is deliberately excluded from the graph topology hash (`graphHash`), so
13
- editing a note never marks the workflow as changed. The graph-level `notes`
14
- field on `wireWorkflowGraph` (`graph/wire-workflow-graph.ts`) — which carries
15
- things like imported sticky notes — is excluded for the same reason.
16
-
17
- The hash exists to answer "is this the same workflow the running instances were
18
- started against?". Prose about a node has no bearing on that. If notes were
19
- hashed, adding a sentence of documentation would register as a topology change
20
- and the only safe habit would be to never document a node.
21
-
22
- **What this rules out:** folding `notes` into `graphHash` "for completeness",
23
- or using `notes` to carry anything semantic — a routing hint, a version marker,
24
- a flag some other code reads — since nothing that changes behaviour may live in
25
- a field the change-detection hash ignores.
@@ -1,29 +0,0 @@
1
- ---
2
- type: decision
3
- title: An inline workflow run reports its run id the moment it exists, because a failure throws instead of returning
4
- description: `onRunCreated` is the only moment guaranteed to happen whether the run passes, fails or suspends
5
- tags: workflow
6
- ---
7
-
8
- # An inline workflow run reports its run id the moment it exists, because a failure throws instead of returning
9
-
10
- `startWorkflow` in `pikku-workflow-service.ts` calls `options.onRunCreated(runId)`
11
- immediately after `createRun`, before any execution. An inline run that fails
12
- throws rather than returning `{ runId }`, so a caller wanting to read the run
13
- back — its steps, which one failed, what it was called with — would otherwise
14
- have nothing to read it by. Run creation is the only moment guaranteed to happen
15
- whether the run goes on to pass, fail or suspend.
16
-
17
- The failure path is equally deliberate. `WorkflowAsyncException`,
18
- `WorkflowCancelledException`, `WorkflowSuspendedException` and
19
- `WorkflowDispatchException` are all excluded from the "mark the run failed"
20
- branch: the first three already recorded their own status, and the fourth is
21
- transient. When a run does fail, an _expected_ error (a `PikkuError`, e.g. a
22
- build gate tripping) logs only its message — the message is the whole story, and
23
- the `expected` flag survives the step-boundary rehydration that strips the
24
- class. Anything else is logged in full so the trace is there to debug.
25
-
26
- **What this rules out:** moving `onRunCreated` to after execution or into the
27
- success path, returning a sentinel run id instead of throwing, folding the four
28
- control-flow exceptions into the generic failure branch, or dumping a stack for
29
- every expected error.
@@ -1,43 +0,0 @@
1
- ---
2
- type: decision
3
- title: `invocationId` is a workflow step's dedupe key; `stepId` is store-specific and must never be used as one
4
- description: The invocation id is a frozen UUIDv5 of runId + stepName, identical across retries on every backend
5
- tags: workflow
6
- ---
7
-
8
- # `invocationId` is a workflow step's dedupe key; `stepId` is store-specific and must never be used as one
9
-
10
- `deriveInvocationId` (`workflow-invocation-id.ts`) is `uuidv5(runId:stepName)`.
11
- Because both inputs are stable across replays, the same call yields the same
12
- UUID on every attempt and on every storage backend — so a step can
13
- `INSERT … ON CONFLICT (invocation_id)` or pass it as an external idempotency
14
- key (a Stripe key, say) and have a retry of a half-applied side effect collapse
15
- onto the first attempt.
16
-
17
- `stepId` cannot do that job. Whether it stays the same or is minted fresh per
18
- attempt is store-specific: the in-memory store mints a new one each attempt
19
- while the SQL store reuses the row. `WorkflowStepWire` documents `invocationId`
20
- as the dedupe key for exactly this reason.
21
-
22
- `PIKKU_WORKFLOW_NAMESPACE` in `workflow-invocation-id.ts` is frozen. Changing it
23
- would alter every derived invocation id and break dedupe across a deploy — steps
24
- that already ran would look new. The v5 implementation is hand-rolled (SHA-1
25
- plus the version and variant bit twiddling) rather than pulled from the `uuid`
26
- package, and `workflow-invocation-id.test.ts` pins it against the known
27
- `www.example.com`-in-DNS-namespace vector.
28
-
29
- Calling the same step name more than once in a run _is_ disambiguated. Ordinals
30
- are already in: `nextStepKey` (`pikku-workflow-service.ts`) mints a physical key
31
- per reach — `name`, then `name#1`, `name#2` — and every step entry point routes
32
- through it, so `deriveInvocationId` hashes the physical key, not the logical
33
- name. Each reach therefore gets its own row and its own invocation id. The first
34
- reach keeps the bare name, so ids minted before ordinals landed are unchanged,
35
- and the ordinal counters reset at the start of each replay, so a given call site
36
- resolves to the same key on every attempt. `workflow-step-ordinal.test.ts` pins
37
- all three properties.
38
-
39
- **What this rules out:** using `stepId` as an idempotency key, regenerating the
40
- namespace UUID, swapping in a different hash or a random id, passing the logical
41
- step name to `deriveInvocationId` instead of the physical key from
42
- `nextStepKey`, or "simplifying" the derivation to include anything that varies
43
- between replays.
@@ -1,29 +0,0 @@
1
- ---
2
- type: decision
3
- title: A workflow step goes through the queue only if its function opts in, and there is no inline fallback
4
- description: `workflowQueued: true` is the whole decision; a missing queue service is a hard error, not a silent downgrade
5
- tags: workflow
6
- ---
7
-
8
- # A workflow step goes through the queue only if its function opts in, and there is no inline fallback
9
-
10
- `dispatchStep` in `pikku-workflow-service.ts` decides queued-vs-inline purely
11
- from the step function's `workflowQueued` flag in function meta, which defaults
12
- to false. If the flag is not set the method returns false and the caller runs
13
- the step inline. If it IS set and no queue service is configured, that is a hard
14
- error naming the step and the function — never a quiet downgrade to inline
15
- execution, because a function marked `workflowQueued` was marked that way for a
16
- reason (isolation, a long tail latency, a resource limit) that inline execution
17
- does not honour.
18
-
19
- Inline execution is not merely a degraded queue path. `runInlineRetryLoop` wraps
20
- the same `running → result` / `fail → retry-attempt → backoff → retry`
21
- scaffolding around a step-specific body and stays O(K) — no suspend, no replay —
22
- which is what makes an inline run cheap. Its optional `onError` hook exists for
23
- terminal errors that must NOT retry (RPC-not-found suspends the run for
24
- redeploy); if the hook throws, the loop exits immediately without recording a
25
- step error or retrying.
26
-
27
- **What this rules out:** inferring "should queue" from the presence of a queue
28
- service, falling back to inline when the queue is missing, and reusing
29
- `runInlineRetryLoop` for anything that needs to suspend between attempts.
@@ -1,42 +0,0 @@
1
- ---
2
- type: decision
3
- title: Workflows get their own queues by default, and queue names are resolved from queue meta
4
- description: Per-workflow queues stop one slow step head-of-line-blocking every other workflow; `shared-groups` trades that for one set of pollers
5
- tags: workflow
6
- ---
7
-
8
- # Workflows get their own queues by default, and queue names are resolved from queue meta
9
-
10
- `WorkflowQueueOptions.queueStrategy` defaults to `'per-workflow'`: each workflow
11
- gets its own `wf-orchestrator-*` and `wf-step-*` queue. That gives complete
12
- isolation and is what lets serverless providers deploy one unit per workflow,
13
- at the cost of one set of pollers per queue — which adds up on pull-based
14
- backends. `'shared-groups'` puts every workflow on the shared orchestrator and
15
- step-worker queues and keeps them isolated with a per-group concurrency cap, so
16
- there is one set of pollers for the whole system. It is only for single-process
17
- runtimes; a per-unit serverless deploy needs the per-workflow queues to route to
18
- its units. The options are passed to the service constructor rather than read
19
- from `config.workflow` because the queues are wired during construction, before
20
- singleton services — and so before `config` — exist.
21
-
22
- Under `'shared-groups'`, `getJobGroup` returns a group keyed by workflow name
23
- (steps group by step function, mirroring how per-step queues split them). It
24
- returns `undefined` under `'per-workflow'`, because the queue name already
25
- isolates the workflow and a group would cap it inside its own dedicated queue.
26
- The group tier repeats the id so a workflow can be given its own limit purely
27
- from config; note tiers can only lower a limit, never raise it above `default`,
28
- because the backend applies its pre-fetch exclusion per group using `default`
29
- alone.
30
-
31
- `getOrchestratorQueueName` and `getStepWorkerQueueName` read `queue.meta`, which
32
- is always populated globally, rather than `queue.registrations`, which only
33
- covers queues this unit consumes. In a per-unit deploy the orchestrator unit
34
- produces to the per-step queues without consuming them, so registrations would
35
- miss them. `wireQueueWorkers` warns loudly when workflows exist but no
36
- `wf-orchestrator-*` queue is in meta: everything still "works" via the shared
37
- fallback, but the isolation is gone and one slow step head-of-line-blocks every
38
- other workflow — invisible until a queue starves.
39
-
40
- **What this rules out:** defaulting to `'shared-groups'`, returning a job group
41
- under `'per-workflow'`, resolving queue names from `queue.registrations`, or
42
- dropping the wiring-time warning as noise.
@@ -1,33 +0,0 @@
1
- ---
2
- type: decision
3
- title: A workflow step name repeated in one run gets an ordinal suffix, and the first reach stays bare
4
- description: `name`, `name#1`, `name#2` keys each reach separately without changing the durable key of any existing run
5
- tags: workflow
6
- ---
7
-
8
- # A workflow step name repeated in one run gets an ordinal suffix, and the first reach stays bare
9
-
10
- `nextStepKey` in `pikku-workflow-service.ts` turns a logical step name into the
11
- physical, replay-stable key for the Nth time the run reaches it: the bare name
12
- for ordinal 0, `name#N` for repeats. Keeping the first reach unsuffixed is what
13
- makes the scheme backward compatible — existing runs and their persisted step
14
- rows are untouched — while still letting the same literal step name be invoked
15
- several times (a loop, a helper called twice) without the rows clobbering each
16
- other.
17
-
18
- The counters live in the per-replay `RunContext.replay.ordinals` and are reset
19
- by `beginReplay` on every orchestrator tick. That reset is what makes the keys
20
- deterministic: given a deterministic workflow body, the second replay assigns
21
- exactly the same key to the same reach and therefore finds the cached row rather
22
- than minting `name#1` for a step that already succeeded. `nextStepKey` also
23
- records the key it just produced as `replay.lastStep`, which is how the next
24
- step learns its predecessor (`fromStepName`).
25
-
26
- Graph runs use the same convention for cycle revisits, and
27
- `stripInstanceOrdinal` / `executeWorkflowStep` map `node#N` back to the logical
28
- node id, which is not a literal key in the graph's `nodes` map.
29
-
30
- **What this rules out:** suffixing the first reach too (it re-keys every step of
31
- every existing run), advancing the ordinal counters anywhere other than a fresh
32
- replay pass, deriving step keys from a non-deterministic source, or treating a
33
- physical step key as a graph node id without stripping the ordinal.
@@ -1,32 +0,0 @@
1
- ---
2
- type: decision
3
- title: A workflow replay reads its steps once and caches only the run's immutable half
4
- description: The per-replay snapshot collapses O(N^2) step reads to one, but caching mutable run fields would make the replay read a lie
5
- tags: workflow
6
- ---
7
-
8
- # A workflow replay reads its steps once and caches only the run's immutable half
9
-
10
- A DSL replay walks the workflow body from the top, and each step it passes asks
11
- for its own row — so a run of N steps costs N reads per replay and O(N^2) over
12
- its lifetime. `beginReplay` in `pikku-workflow-service.ts` opens a pass by
13
- calling `listStepStates`, which backends able to answer in a single query
14
- override; `loadOrCreateStep` then serves every step from that snapshot. This is
15
- safe because a pass reaches each step key at most once and the steps it replays
16
- past are `succeeded`, and therefore immutable.
17
-
18
- `getRunIdentity` caches the run for the same pass, but only for its immutable
19
- half — which workflow it is, the wire it was started on, its input. Anything
20
- needing `status`, `output`, `error` or `state` must call `getRun`: those move
21
- while the run executes and a cached copy would be a lie. The `replay` half of
22
- `RunContext` is rebuilt from scratch on every orchestrator tick and torn down by
23
- `endReplay`.
24
-
25
- `loadOrCreateStep` also handles a concurrent replay creating the row after the
26
- snapshot was taken: if `create()` throws, it re-reads the step, and only if that
27
- read also fails does it rethrow the original — because in that case the insert
28
- failed for its own reasons and that error is the one worth seeing.
29
-
30
- **What this rules out:** widening the snapshot to cover mutable run fields,
31
- keeping it across orchestrator ticks, or removing the re-read fallback in
32
- `loadOrCreateStep` on the grounds that a duplicate insert "cannot happen".