@pikku/core 0.12.142 → 0.12.144

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 (703) 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 +11 -1
  77. package/dist/services/incoming-webhook-service.js +5 -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 +16 -0
  105. package/dist/services/scheduler-service.js +12 -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/command-parser.d.ts +13 -0
  216. package/dist/wirings/cli/command-parser.js +12 -0
  217. package/dist/wirings/credential/credential-overrides.d.ts +1 -0
  218. package/dist/wirings/credential/credential.types.d.ts +7 -0
  219. package/dist/wirings/credential/validate-credential-definitions.d.ts +7 -0
  220. package/dist/wirings/credential/validate-credential-definitions.js +7 -0
  221. package/dist/wirings/flag/cached-flag-source.d.ts +1 -0
  222. package/dist/wirings/flag/flag.types.d.ts +3 -0
  223. package/dist/wirings/gateway/gateway-runner.d.ts +23 -0
  224. package/dist/wirings/gateway/gateway-runner.js +23 -0
  225. package/dist/wirings/gateway/gateway.types.d.ts +3 -0
  226. package/dist/wirings/gateway/local-gateway-service.d.ts +10 -0
  227. package/dist/{services → wirings/gateway}/local-gateway-service.js +6 -2
  228. package/dist/wirings/http/http-routes.d.ts +21 -0
  229. package/dist/wirings/http/http-routes.js +11 -0
  230. package/dist/wirings/http/http-runner.d.ts +71 -0
  231. package/dist/wirings/http/http-runner.js +73 -5
  232. package/dist/wirings/http/http.types.d.ts +27 -0
  233. package/dist/wirings/http/index.d.ts +1 -0
  234. package/dist/wirings/http/index.js +1 -0
  235. package/dist/wirings/http/log-http-routes.d.ts +1 -0
  236. package/dist/wirings/http/log-http-routes.js +1 -0
  237. package/dist/wirings/http/merge-request-data.d.ts +12 -0
  238. package/dist/wirings/http/merge-request-data.js +42 -0
  239. package/dist/wirings/http/pikku-fetch-http-request.d.ts +1 -0
  240. package/dist/wirings/http/pikku-fetch-http-request.js +3 -32
  241. package/dist/wirings/http/pikku-fetch-http-response.d.ts +1 -0
  242. package/dist/wirings/http/pikku-fetch-http-response.js +1 -0
  243. package/dist/wirings/http/routers/http-router.d.ts +6 -0
  244. package/dist/wirings/http/routers/http-router.js +6 -0
  245. package/dist/wirings/http/web-request.d.ts +17 -0
  246. package/dist/wirings/http/web-request.js +17 -0
  247. package/dist/wirings/mcp/mcp-endpoint-registry.d.ts +7 -0
  248. package/dist/wirings/mcp/mcp-endpoint-registry.js +7 -0
  249. package/dist/wirings/mcp/mcp-runner.d.ts +63 -0
  250. package/dist/wirings/mcp/mcp-runner.js +62 -0
  251. package/dist/wirings/mcp/mcp.types.d.ts +12 -0
  252. package/dist/wirings/node/node.types.d.ts +4 -0
  253. package/dist/wirings/oauth2/oauth2.types.d.ts +2 -0
  254. package/dist/wirings/queue/in-memory-queue-service.d.ts +23 -0
  255. package/dist/wirings/queue/in-memory-queue-service.js +129 -0
  256. package/dist/wirings/queue/index.d.ts +2 -1
  257. package/dist/wirings/queue/index.js +1 -0
  258. package/dist/wirings/queue/queue-identity.js +2 -14
  259. package/dist/wirings/queue/queue-runner.d.ts +37 -0
  260. package/dist/wirings/queue/queue-runner.js +37 -0
  261. package/dist/wirings/queue/queue.types.d.ts +56 -0
  262. package/dist/wirings/queue/register-queue-helper.d.ts +12 -0
  263. package/dist/wirings/queue/register-queue-helper.js +11 -0
  264. package/dist/wirings/queue/remote-queue-job.d.ts +11 -0
  265. package/dist/wirings/queue/remote-queue-job.js +41 -0
  266. package/dist/wirings/queue/signed-queue-service.d.ts +4 -1
  267. package/dist/wirings/queue/signed-queue-service.js +3 -0
  268. package/dist/wirings/queue/validate-worker-config.d.ts +1 -0
  269. package/dist/wirings/role/role.types.d.ts +3 -0
  270. package/dist/wirings/rpc/rpc-runner.d.ts +24 -0
  271. package/dist/wirings/rpc/rpc-runner.js +37 -2
  272. package/dist/wirings/rpc/rpc-types.d.ts +2 -0
  273. package/dist/wirings/scheduler/index.d.ts +2 -1
  274. package/dist/wirings/scheduler/index.js +1 -0
  275. package/dist/wirings/scheduler/log-schedulers.d.ts +1 -0
  276. package/dist/wirings/scheduler/log-schedulers.js +1 -0
  277. package/dist/wirings/scheduler/remote-scheduled-job.d.ts +11 -0
  278. package/dist/wirings/scheduler/remote-scheduled-job.js +20 -0
  279. package/dist/wirings/scheduler/scheduler-runner.d.ts +29 -0
  280. package/dist/wirings/scheduler/scheduler-runner.js +28 -0
  281. package/dist/wirings/scheduler/scheduler.types.d.ts +15 -0
  282. package/dist/wirings/scope/scope.types.d.ts +5 -0
  283. package/dist/wirings/secret/index.d.ts +2 -2
  284. package/dist/wirings/secret/index.js +1 -1
  285. package/dist/wirings/secret/secret.types.d.ts +26 -1
  286. package/dist/wirings/secret/secret.types.js +1 -0
  287. package/dist/wirings/secret/validate-secret-definitions.d.ts +8 -0
  288. package/dist/wirings/secret/validate-secret-definitions.js +15 -0
  289. package/dist/wirings/trigger/in-memory-trigger-service.d.ts +11 -0
  290. package/dist/{services → wirings/trigger}/in-memory-trigger-service.js +10 -3
  291. package/dist/wirings/trigger/index.d.ts +1 -1
  292. package/dist/wirings/trigger/pikku-trigger-service.d.ts +8 -3
  293. package/dist/wirings/trigger/pikku-trigger-service.js +14 -3
  294. package/dist/wirings/trigger/trigger-runner.d.ts +27 -2
  295. package/dist/wirings/trigger/trigger-runner.js +35 -2
  296. package/dist/wirings/trigger/trigger.types.d.ts +26 -4
  297. package/dist/wirings/trigger/webhook-source-runner.d.ts +24 -0
  298. package/dist/wirings/trigger/webhook-source-runner.js +19 -0
  299. package/dist/wirings/trigger/webhook-source.types.d.ts +12 -2
  300. package/dist/wirings/trigger/webhook-source.types.js +1 -1
  301. package/dist/wirings/variable/validate-variable-definitions.d.ts +7 -0
  302. package/dist/wirings/variable/validate-variable-definitions.js +7 -0
  303. package/dist/wirings/variable/variable.types.d.ts +7 -0
  304. package/dist/wirings/virtual-user/conversation/conversation.types.d.ts +5 -0
  305. package/dist/wirings/virtual-user/conversation/run-conversation.d.ts +6 -0
  306. package/dist/wirings/virtual-user/conversation/run-conversation.js +1 -1
  307. package/dist/{services → wirings/virtual-user}/http-virtual-users.d.ts +4 -3
  308. package/dist/{services → wirings/virtual-user}/http-virtual-users.js +6 -6
  309. package/dist/wirings/virtual-user/index.d.ts +1 -1
  310. package/dist/wirings/virtual-user/index.js +1 -1
  311. package/dist/wirings/virtual-user/run-virtual-user.d.ts +2 -1
  312. package/dist/wirings/virtual-user/run-virtual-user.js +1 -14
  313. package/dist/wirings/virtual-user/virtual-user-declaration.types.d.ts +4 -0
  314. package/dist/wirings/virtual-user/virtual-user-scaffold.d.ts +10 -1
  315. package/dist/wirings/virtual-user/virtual-user-scaffold.js +5 -0
  316. package/dist/wirings/virtual-user/virtual-user-schedule.d.ts +5 -0
  317. package/dist/wirings/virtual-user/virtual-user-schedule.js +1 -0
  318. package/dist/wirings/virtual-user/virtual-user-target.d.ts +1 -0
  319. package/dist/wirings/webhook/define-outgoing-webhook.d.ts +20 -0
  320. package/dist/wirings/webhook/define-outgoing-webhook.js +9 -0
  321. package/dist/wirings/workflow/dsl/workflow-dsl.types.d.ts +8 -4
  322. package/dist/wirings/workflow/dsl/workflow-runner.d.ts +7 -0
  323. package/dist/wirings/workflow/dsl/workflow-runner.js +7 -0
  324. package/dist/wirings/workflow/feature.d.ts +12 -0
  325. package/dist/wirings/workflow/feature.js +12 -0
  326. package/dist/wirings/workflow/graph/graph-node.d.ts +5 -0
  327. package/dist/wirings/workflow/graph/graph-node.js +5 -0
  328. package/dist/wirings/workflow/graph/template.d.ts +6 -0
  329. package/dist/wirings/workflow/graph/template.js +5 -0
  330. package/dist/wirings/workflow/graph/wire-workflow-graph.d.ts +12 -0
  331. package/dist/wirings/workflow/graph/wire-workflow-graph.js +10 -0
  332. package/dist/wirings/workflow/graph/workflow-graph.types.d.ts +11 -0
  333. package/dist/wirings/workflow/graph/workflow-graph.types.js +1 -0
  334. package/dist/{services → wirings/workflow}/in-memory-workflow-service.d.ts +8 -3
  335. package/dist/{services → wirings/workflow}/in-memory-workflow-service.js +9 -4
  336. package/dist/wirings/workflow/pikku-scenario-service.d.ts +1 -1
  337. package/dist/wirings/workflow/pikku-scenario-service.js +2 -2
  338. package/dist/wirings/workflow/pikku-workflow-service.d.ts +1 -0
  339. package/dist/wirings/workflow/pikku-workflow-service.js +1 -0
  340. package/dist/wirings/workflow/run-timeline.d.ts +21 -0
  341. package/dist/wirings/workflow/run-timeline.js +15 -7
  342. package/dist/wirings/workflow/scenario-coverage.d.ts +1 -0
  343. package/dist/wirings/workflow/scenario-poll.d.ts +1 -0
  344. package/dist/wirings/workflow/scenario-prose.d.ts +6 -0
  345. package/dist/wirings/workflow/scenario-prose.js +6 -0
  346. package/dist/wirings/workflow/scenario-run.types.d.ts +3 -0
  347. package/dist/wirings/workflow/scenario-step.types.d.ts +1 -0
  348. package/dist/wirings/workflow/scenario-step.types.js +1 -0
  349. package/dist/wirings/workflow/scenario-surface.js +1 -13
  350. package/dist/wirings/workflow/scenario.types.d.ts +6 -0
  351. package/dist/wirings/workflow/workflow-approval-policy.d.ts +6 -0
  352. package/dist/wirings/workflow/workflow-approval-policy.js +6 -0
  353. package/dist/wirings/workflow/workflow-constants.d.ts +7 -1
  354. package/dist/wirings/workflow/workflow-constants.js +10 -1
  355. package/dist/wirings/workflow/workflow-errors.d.ts +13 -0
  356. package/dist/wirings/workflow/workflow-errors.js +13 -0
  357. package/dist/wirings/workflow/workflow-invocation-id.d.ts +4 -0
  358. package/dist/wirings/workflow/workflow-invocation-id.js +4 -0
  359. package/dist/wirings/workflow/workflow-queue-workers.d.ts +3 -0
  360. package/dist/wirings/workflow/workflow-run-ownership.d.ts +1 -0
  361. package/dist/wirings/workflow/workflow-run-ownership.js +1 -0
  362. package/dist/wirings/workflow/workflow-status-stream.d.ts +1 -0
  363. package/dist/wirings/workflow/workflow-unwind-plan.js +2 -7
  364. package/dist/wirings/workflow/workflow.types.d.ts +40 -0
  365. package/package.json +26 -9
  366. package/CHANGELOG.md +0 -6961
  367. package/dist/services/in-memory-queue-service.d.ts +0 -8
  368. package/dist/services/in-memory-queue-service.js +0 -54
  369. package/dist/services/in-memory-trigger-service.d.ts +0 -4
  370. package/dist/services/local-gateway-service.d.ts +0 -6
  371. package/dist/utils/hash.d.ts +0 -2
  372. package/dist/utils/hash.js +0 -23
  373. package/knowledge/decisions/index.md +0 -19
  374. package/knowledge/decisions/internals/a-credential-name-declared-twice-must-agree-on-schema-and-type.md +0 -29
  375. package/knowledge/decisions/internals/a-grant-can-name-a-scope-declared-without-its-addon.md +0 -29
  376. package/knowledge/decisions/internals/a-held-run-is-woken-later-not-retried.md +0 -28
  377. package/knowledge/decisions/internals/a-non-streaming-agent-run-registers-with-agentrunstate-too.md +0 -22
  378. package/knowledge/decisions/internals/a-reset-suite-makes-the-dev-seed-the-fixture.md +0 -50
  379. package/knowledge/decisions/internals/a-resumed-agent-turn-is-as-interruptible-as-the-first.md +0 -20
  380. package/knowledge/decisions/internals/a-scenario-step-template-is-offered-unfilled.md +0 -21
  381. package/knowledge/decisions/internals/a-scheduled-task-writes-its-caller-session-before-it-runs.md +0 -22
  382. package/knowledge/decisions/internals/a-secret-set-in-memory-shadows-the-variable-of-the-same-name.md +0 -28
  383. package/knowledge/decisions/internals/a-secret-that-fails-to-decrypt-fails-the-whole-read.md +0 -49
  384. package/knowledge/decisions/internals/a-virtual-user-acts-through-invokeraw-so-a-refusal-is-data.md +0 -32
  385. package/knowledge/decisions/internals/a-virtual-user-cadence-is-a-row-not-a-timer.md +0 -66
  386. package/knowledge/decisions/internals/a-virtual-user-converse-signs-in-before-its-first-turn.md +0 -24
  387. package/knowledge/decisions/internals/a-virtual-user-decides-whether-to-trust-memory-once-per-turn.md +0 -21
  388. package/knowledge/decisions/internals/a-virtual-user-email-is-computed-with-the-run-id-as-a-sub-address.md +0 -34
  389. package/knowledge/decisions/internals/a-virtual-user-run-is-not-a-workflow-but-it-needs-a-trigger.md +0 -65
  390. package/knowledge/decisions/internals/a-wall-clock-threshold-is-a-load-test-in-disguise.md +0 -46
  391. package/knowledge/decisions/internals/a-workflow-wire-is-built-from-the-run-not-from-the-rpc-service.md +0 -45
  392. package/knowledge/decisions/internals/addon-package-roots-resolve-by-walking-node-module-search-paths.md +0 -26
  393. package/knowledge/decisions/internals/addon-pikku-meta-ships-at-the-package-root-or-under-dist.md +0 -32
  394. package/knowledge/decisions/internals/addon-singleton-services-are-cached-per-namespace-not-per-package.md +0 -33
  395. package/knowledge/decisions/internals/addon-workflow-names-are-prefixed-with-the-consumer-namespace.md +0 -28
  396. package/knowledge/decisions/internals/agent-agui-bridge-obeys-the-client-ordering-contract.md +0 -29
  397. package/knowledge/decisions/internals/agent-audio-chunks-carry-the-format-the-provider-returned.md +0 -20
  398. package/knowledge/decisions/internals/agent-context-waits-for-a-tool-result-still-being-written.md +0 -21
  399. package/knowledge/decisions/internals/agent-credential-suspensions-hide-the-tool-result.md +0 -26
  400. package/knowledge/decisions/internals/agent-delegate-and-supervise-hide-different-text.md +0 -26
  401. package/knowledge/decisions/internals/agent-llm-tool-arguments-have-nulls-stripped.md +0 -23
  402. package/knowledge/decisions/internals/agent-model-config-stays-a-single-resolution-seam.md +0 -25
  403. package/knowledge/decisions/internals/agent-onerror-hooks-cannot-change-the-failure.md +0 -22
  404. package/knowledge/decisions/internals/agent-runner-methods-must-keep-their-receiver.md +0 -22
  405. package/knowledge/decisions/internals/agent-speech-travels-as-a-custom-agui-event.md +0 -22
  406. package/knowledge/decisions/internals/agent-stream-persistence-is-best-effort.md +0 -27
  407. package/knowledge/decisions/internals/agent-sub-agents-inherit-the-parent-context-block.md +0 -26
  408. package/knowledge/decisions/internals/agent-tool-execute-failures-are-logged-unconditionally.md +0 -25
  409. package/knowledge/decisions/internals/agent-voice-input-transcribes-audio-parts-in-place.md +0 -22
  410. package/knowledge/decisions/internals/agent-working-memory-is-persisted-only-when-valid.md +0 -25
  411. package/knowledge/decisions/internals/an-addon-scope-root-loses-to-a-root-the-host-already-declares.md +0 -39
  412. package/knowledge/decisions/internals/an-agent-interrupt-is-not-a-failure.md +0 -23
  413. package/knowledge/decisions/internals/an-agent-is-offered-under-its-registry-key-and-only-within-the-virtual-users-scopes.md +0 -27
  414. package/knowledge/decisions/internals/an-agent-run-owned-by-another-instance-says-so.md +0 -25
  415. package/knowledge/decisions/internals/an-agent-stream-send-must-return-the-inner-sends-promise.md +0 -22
  416. package/knowledge/decisions/internals/an-empty-text-part-is-omitted-from-an-agent-message.md +0 -20
  417. package/knowledge/decisions/internals/an-empty-transcript-is-not-recorded.md +0 -22
  418. package/knowledge/decisions/internals/an-oauth2-credential-implies-an-optional-app-secret.md +0 -26
  419. package/knowledge/decisions/internals/an-unref-d-timer-cannot-be-awaited-under-node-test.md +0 -66
  420. package/knowledge/decisions/internals/analytics-identity-resolvers-run-in-declared-order.md +0 -22
  421. package/knowledge/decisions/internals/channel-message-handlers-accept-three-config-shapes.md +0 -30
  422. package/knowledge/decisions/internals/channel-middleware-caches-only-statically-resolved-middleware.md +0 -31
  423. package/knowledge/decisions/internals/channel-state-accessors-are-unsound-generics-that-every-implementation-asserts.md +0 -33
  424. package/knowledge/decisions/internals/channel-state-is-per-socket-session-state-is-per-user.md +0 -29
  425. package/knowledge/decisions/internals/channel-user-id-is-persisted-after-onconnect-middleware-runs.md +0 -28
  426. package/knowledge/decisions/internals/cli-option-names-are-camelcase-in-state-and-kebab-on-the-command-line.md +0 -27
  427. package/knowledge/decisions/internals/cli-parse-errors-are-routed-by-message-prefix.md +0 -28
  428. package/knowledge/decisions/internals/cli-stdout-is-reserved-for-machine-readable-output.md +0 -34
  429. package/knowledge/decisions/internals/cli-unknown-long-options-warn-instead-of-failing.md +0 -29
  430. package/knowledge/decisions/internals/core-column-form-is-an-axis-of-its-own.md +0 -84
  431. package/knowledge/decisions/internals/core-data-classification-brand-is-an-optional-property.md +0 -41
  432. package/knowledge/decisions/internals/core-function-runner-restores-the-wire-fields-it-overwrites.md +0 -44
  433. package/knowledge/decisions/internals/core-hot-reload-merges-generated-meta-never-replaces-it.md +0 -39
  434. package/knowledge/decisions/internals/core-hot-reload-owns-its-module-registry.md +0 -42
  435. package/knowledge/decisions/internals/core-middleware-order-is-scope-then-priority.md +0 -39
  436. package/knowledge/decisions/internals/core-schema-defaults-apply-on-every-transport.md +0 -43
  437. package/knowledge/decisions/internals/core-scopes-are-an-and-gate-separate-from-permissions.md +0 -38
  438. package/knowledge/decisions/internals/core-state-is-a-global-map-written-only-at-registration-time.md +0 -44
  439. package/knowledge/decisions/internals/email-meta-is-read-uncached-because-codegen-rewrites-it-mid-session.md +0 -27
  440. package/knowledge/decisions/internals/feature-flag-declarations-refuse-an-empty-anyof-and-conflicting-scopes.md +0 -22
  441. package/knowledge/decisions/internals/feature-flags-fail-open-and-never-enforce-access.md +0 -28
  442. package/knowledge/decisions/internals/flag-sync-rewrites-only-the-declared-text.md +0 -24
  443. package/knowledge/decisions/internals/gateway-adapters-resolve-lazily-and-are-promise-cached.md +0 -32
  444. package/knowledge/decisions/internals/gateway-listener-middleware-runs-without-an-rpc-on-the-wire.md +0 -43
  445. package/knowledge/decisions/internals/gateway-webhook-challenges-echo-bytes-not-json.md +0 -28
  446. package/knowledge/decisions/internals/gateway-wiring-is-a-meta-wiring-over-http-and-channels.md +0 -31
  447. package/knowledge/decisions/internals/generated-src-paths-in-pikku-meta-are-absolute.md +0 -26
  448. package/knowledge/decisions/internals/global-middleware-resolves-from-the-root-namespace-too.md +0 -32
  449. package/knowledge/decisions/internals/hot-reload-reads-the-changed-source-never-a-compiled-copy.md +0 -38
  450. package/knowledge/decisions/internals/hot-reload-writes-into-the-function-map-captured-at-startup.md +0 -26
  451. package/knowledge/decisions/internals/http-request-bodies-are-read-once-and-shared.md +0 -32
  452. package/knowledge/decisions/internals/http-route-groups-cascade-config-in-a-fixed-order.md +0 -28
  453. package/knowledge/decisions/internals/http-router-matches-normalized-paths-but-returns-registered-ones.md +0 -30
  454. package/knowledge/decisions/internals/http-runner-logs-through-a-trace-scoped-logger-functions-do-not.md +0 -26
  455. package/knowledge/decisions/internals/http-set-cookie-headers-are-appended-never-joined.md +0 -28
  456. package/knowledge/decisions/internals/http-sse-streams-flush-headers-only-after-middleware.md +0 -32
  457. package/knowledge/decisions/internals/http-wiring-without-metadata-is-skipped-not-fatal.md +0 -26
  458. package/knowledge/decisions/internals/in-a-scenario-a-4xx-is-data-not-an-exception.md +0 -25
  459. package/knowledge/decisions/internals/in-memory-workflow-history-aliases-the-live-step-object.md +0 -26
  460. package/knowledge/decisions/internals/index.md +0 -181
  461. package/knowledge/decisions/internals/istanbul-statement-counts-attach-to-the-start-line-only.md +0 -25
  462. package/knowledge/decisions/internals/local-trigger-and-gateway-services-assume-a-single-process.md +0 -26
  463. package/knowledge/decisions/internals/mcp-wire-names-are-assigned-over-the-whole-registry.md +0 -39
  464. package/knowledge/decisions/internals/node-only-builtins-are-imported-dynamically.md +0 -24
  465. package/knowledge/decisions/internals/one-project-shape-check-two-validators.md +0 -53
  466. package/knowledge/decisions/internals/only-exposed-functions-enter-a-virtual-user-catalogue.md +0 -21
  467. package/knowledge/decisions/internals/queue-group-concurrency-keeps-one-shared-queue-fair.md +0 -28
  468. package/knowledge/decisions/internals/queue-jobs-always-carry-an-explicit-attempts-count.md +0 -27
  469. package/knowledge/decisions/internals/remote-addons-dispatch-over-http-instead-of-local-meta.md +0 -31
  470. package/knowledge/decisions/internals/role-names-cannot-contain-the-scope-separator.md +0 -30
  471. package/knowledge/decisions/internals/rpc-names-resolve-through-package-scope-before-root.md +0 -32
  472. package/knowledge/decisions/internals/scenario-agent-calls-sign-in-on-401-only.md +0 -31
  473. package/knowledge/decisions/internals/scenario-given-and-when-are-sugar-but-then-is-not.md +0 -24
  474. package/knowledge/decisions/internals/scenario-meta-lives-apart-from-app-meta-but-merges-when-read-off-disk.md +0 -26
  475. package/knowledge/decisions/internals/scenario-steps-return-drained-response-records.md +0 -27
  476. package/knowledge/decisions/internals/scenarios-live-in-files-named-for-them.md +0 -48
  477. package/knowledge/decisions/internals/scope-roots-may-be-co-declared-by-an-addon-and-its-host-app.md +0 -30
  478. package/knowledge/decisions/internals/serverless-channel-disconnect-must-tolerate-a-missing-channel.md +0 -28
  479. package/knowledge/decisions/internals/side-effects-are-an-allowlist-not-a-boolean.md +0 -34
  480. package/knowledge/decisions/internals/speech-synthesis-picks-a-voice-per-sentence-and-warns-once.md +0 -24
  481. package/knowledge/decisions/internals/the-agent-done-event-goes-through-the-middleware-and-is-awaited.md +0 -26
  482. package/knowledge/decisions/internals/the-api-report-pins-members-not-just-names.md +0 -43
  483. package/knowledge/decisions/internals/the-core-scope-validator-refuses-separator-wildcard-and-empty-segments.md +0 -22
  484. package/knowledge/decisions/internals/the-dev-queue-copies-prod-timing-and-serialization-semantics.md +0 -30
  485. package/knowledge/decisions/internals/the-ecosystem-entry-point-carries-the-adapter-surface.md +0 -83
  486. package/knowledge/decisions/internals/the-embedding-model-is-pinned-per-service-and-doc-query-embedding-is-split.md +0 -29
  487. package/knowledge/decisions/internals/the-in-memory-workflow-service-is-inline-only-and-single-process.md +0 -27
  488. package/knowledge/decisions/internals/the-kek-salt-is-scoped-to-the-key-version.md +0 -40
  489. package/knowledge/decisions/internals/the-mcp-handshake-is-challenged-only-when-every-target-is-gated.md +0 -29
  490. package/knowledge/decisions/internals/the-middleware-resolution-cache-is-deliberately-unbounded.md +0 -40
  491. package/knowledge/decisions/internals/the-per-invocation-rpc-view-is-a-class.md +0 -40
  492. package/knowledge/decisions/internals/the-pikku-user-id-resolves-in-a-fixed-order.md +0 -24
  493. package/knowledge/decisions/internals/the-runner-resolves-wire-services-itself.md +0 -31
  494. package/knowledge/decisions/internals/the-schema-service-is-never-stubbed.md +0 -26
  495. package/knowledge/decisions/internals/the-transcript-event-is-sent-ahead-of-the-run.md +0 -25
  496. package/knowledge/decisions/internals/the-virtual-user-catalogue-is-the-only-gate-on-what-may-be-called.md +0 -21
  497. package/knowledge/decisions/internals/the-virtual-user-prompt-says-json-because-of-json-object-mode.md +0 -22
  498. package/knowledge/decisions/internals/the-virtual-user-runtime-is-exported-from-the-virtual-user-entry-point.md +0 -28
  499. package/knowledge/decisions/internals/the-worker-disposition-is-the-one-that-is-not-testing.md +0 -22
  500. package/knowledge/decisions/internals/thread-history-records-the-transcript-not-the-audio.md +0 -25
  501. package/knowledge/decisions/internals/trigger-declaration-is-split-from-trigger-source.md +0 -33
  502. package/knowledge/decisions/internals/typed-secret-service-caches-for-the-process-lifetime.md +0 -26
  503. package/knowledge/decisions/internals/validate-checks-virtual-users-through-a-shared-module.md +0 -43
  504. package/knowledge/decisions/internals/validate-runs-checks-by-precondition.md +0 -115
  505. package/knowledge/decisions/internals/virtual-user-conversation-drives-the-target-through-a-transport-seam.md +0 -24
  506. package/knowledge/decisions/internals/virtual-user-conversation-verdicts-are-llm-self-evaluations.md +0 -25
  507. package/knowledge/decisions/internals/virtual-user-conversations-seed-a-hidden-kickoff-message.md +0 -23
  508. package/knowledge/decisions/internals/virtual-user-step-order-comes-from-insertion-order.md +0 -21
  509. package/knowledge/decisions/internals/virtual-users-are-declared-in-one-definevirtualusers-call-per-codebase.md +0 -30
  510. package/knowledge/decisions/internals/voice-output-speaks-unless-voice-input-explicitly-says-otherwise.md +0 -24
  511. package/knowledge/decisions/internals/webhook-delivery-history-records-every-attempt-best-effort.md +0 -26
  512. package/knowledge/decisions/internals/webhook-service-collaborators-are-constructor-args-not-locator-lookups.md +0 -25
  513. package/knowledge/decisions/internals/whether-a-run-is-inline-is-read-from-the-run-record.md +0 -58
  514. package/knowledge/decisions/internals/wiring-registries-erase-the-generics-their-wire-functions-capture.md +0 -35
  515. package/knowledge/decisions/internals/workflow-approval-expiry-is-decided-from-a-recorded-deadline.md +0 -34
  516. package/knowledge/decisions/internals/workflow-core-never-imports-a-browser-driver.md +0 -42
  517. package/knowledge/decisions/internals/workflow-dsl-meta-separates-runtime-expressions-from-literals.md +0 -38
  518. package/knowledge/decisions/internals/workflow-features-resolve-scenarios-by-object-identity.md +0 -29
  519. package/knowledge/decisions/internals/workflow-graph-inline-and-queued-runs-share-one-planner.md +0 -42
  520. package/knowledge/decisions/internals/workflow-graph-node-notes-are-excluded-from-the-graph-hash.md +0 -25
  521. package/knowledge/decisions/internals/workflow-inline-runs-report-their-run-id-before-they-can-fail.md +0 -29
  522. package/knowledge/decisions/internals/workflow-invocation-id-is-the-dedupe-key-not-step-id.md +0 -43
  523. package/knowledge/decisions/internals/workflow-queued-step-dispatch-requires-an-explicit-opt-in.md +0 -29
  524. package/knowledge/decisions/internals/workflow-queues-are-per-workflow-by-default.md +0 -42
  525. package/knowledge/decisions/internals/workflow-repeated-step-names-get-an-ordinal-suffix.md +0 -33
  526. package/knowledge/decisions/internals/workflow-replay-reads-its-steps-once-and-caches-only-the-immutable-half.md +0 -32
  527. package/knowledge/decisions/internals/workflow-retries-are-owned-by-the-workflow-not-the-queue.md +0 -31
  528. package/knowledge/decisions/internals/workflow-run-capabilities-are-extensions-not-subclasses.md +0 -39
  529. package/knowledge/decisions/internals/workflow-run-mirror-is-never-a-source-of-truth.md +0 -29
  530. package/knowledge/decisions/internals/workflow-run-polling-backs-off-to-the-callers-ceiling.md +0 -33
  531. package/knowledge/decisions/internals/workflow-run-timeline-is-a-pure-fold-over-durable-history.md +0 -37
  532. package/knowledge/decisions/internals/workflow-scenario-assertions-never-retry-and-record-one-step.md +0 -54
  533. package/knowledge/decisions/internals/workflow-scenario-hooks-are-a-scenario-only-affordance.md +0 -43
  534. package/knowledge/decisions/internals/workflow-scenario-prose-is-rendered-from-typed-calls-not-parsed-from-english.md +0 -32
  535. package/knowledge/decisions/internals/workflow-scenario-quarantine-reason-lives-in-code.md +0 -18
  536. package/knowledge/decisions/internals/workflow-scenario-step-targets-are-string-literals-for-the-inspector.md +0 -34
  537. package/knowledge/decisions/internals/workflow-step-compensation-runs-as-its-own-durable-step.md +0 -29
  538. package/knowledge/decisions/internals/workflow-step-dispatch-failure-is-transient-not-a-run-failure.md +0 -33
  539. package/knowledge/decisions/internals/workflow-step-lock-is-held-only-to-claim-the-step.md +0 -34
  540. package/knowledge/decisions/internals/workflow-step-rpc-name-is-provenance-only.md +0 -34
  541. package/knowledge/decisions/internals/workflow-suspend-and-approval-reasons-are-durable-step-identities.md +0 -38
  542. package/knowledge/decisions/internals/workflow-suspended-runs-keep-their-in-process-context.md +0 -30
  543. package/knowledge/decisions/security/a-bearer-token-checked-against-a-secret-reads-it-per-request.md +0 -26
  544. package/knowledge/decisions/security/a-call-without-a-session-raises-missing-session-not-forbidden.md +0 -20
  545. package/knowledge/decisions/security/a-caller-cookie-wins-over-the-jar-for-the-same-name.md +0 -23
  546. package/knowledge/decisions/security/a-channel-lifecycle-acts-as-the-socket-upgrade-session.md +0 -16
  547. package/knowledge/decisions/security/a-channel-requires-a-session-unless-it-says-auth-false.md +0 -26
  548. package/knowledge/decisions/security/a-credential-read-path-follows-its-declared-type-not-absence.md +0 -32
  549. package/knowledge/decisions/security/a-credential-type-is-a-literal-the-inspector-checks-at-declaration.md +0 -27
  550. package/knowledge/decisions/security/a-dropped-audit-write-is-always-logged.md +0 -28
  551. package/knowledge/decisions/security/a-first-party-cookie-is-written-only-after-its-purposes-consent.md +0 -33
  552. package/knowledge/decisions/security/a-function-never-receives-the-secret-service.md +0 -37
  553. package/knowledge/decisions/security/a-graph-run-starts-at-an-entry-node-the-graph-declared.md +0 -33
  554. package/knowledge/decisions/security/a-permission-gets-a-wire-it-cannot-reply-on.md +0 -33
  555. package/knowledge/decisions/security/a-public-function-says-so-with-auth-false.md +0 -34
  556. package/knowledge/decisions/security/a-readonly-session-reaches-only-readonly-functions.md +0 -25
  557. package/knowledge/decisions/security/a-scaffold-flag-says-a-surface-exists-not-who-may-call-it.md +0 -52
  558. package/knowledge/decisions/security/a-scheduled-virtual-user-run-needs-no-admin-at-run-time.md +0 -27
  559. package/knowledge/decisions/security/a-scoped-credential-view-is-limited-to-declared-names.md +0 -26
  560. package/knowledge/decisions/security/a-scoped-secret-view-reads-only-declared-keys-and-never-writes.md +0 -25
  561. package/knowledge/decisions/security/a-secret-is-sent-only-to-the-hosts-it-declares.md +0 -29
  562. package/knowledge/decisions/security/a-step-can-name-an-identity-no-virtual-user-holds-through-per-call-headers.md +0 -25
  563. package/knowledge/decisions/security/a-step-runs-the-function-the-workflow-dispatched-it-with.md +0 -37
  564. package/knowledge/decisions/security/a-stopped-run-by-id-skips-the-ownership-check.md +0 -24
  565. package/knowledge/decisions/security/a-vault-secret-redacts-on-serialization-and-throws-on-coercion.md +0 -29
  566. package/knowledge/decisions/security/a-virtual-user-catalogue-entry-is-filtered-by-scope-and-approval-is-denied-by-default.md +0 -30
  567. package/knowledge/decisions/security/a-virtual-user-environment-fails-closed.md +0 -38
  568. package/knowledge/decisions/security/a-virtual-user-is-never-offered-a-step-that-would-forge-its-own-oracle.md +0 -27
  569. package/knowledge/decisions/security/a-virtual-user-never-runs-against-production.md +0 -23
  570. package/knowledge/decisions/security/a-virtual-user-reads-its-roles-from-the-apps-own-rpc-before-better-auth.md +0 -27
  571. package/knowledge/decisions/security/a-virtual-user-run-treats-an-unresolved-environment-as-production.md +0 -41
  572. package/knowledge/decisions/security/a-virtual-user-scopes-are-expanded-from-its-roles-once-at-run-preparation.md +0 -25
  573. package/knowledge/decisions/security/a-virtual-user-whose-roles-drift-from-the-declaration-refuses-to-run.md +0 -32
  574. package/knowledge/decisions/security/a-workflow-run-is-read-and-approved-by-its-owner.md +0 -50
  575. package/knowledge/decisions/security/addon-auth-and-tags-only-tighten.md +0 -43
  576. package/knowledge/decisions/security/addon-config-gates-apply-only-at-the-namespaced-rpc-boundary.md +0 -52
  577. package/knowledge/decisions/security/addon-scopes-are-resolved-where-the-function-runs.md +0 -46
  578. package/knowledge/decisions/security/addon-screen-scopes-hide-and-do-not-enforce.md +0 -20
  579. package/knowledge/decisions/security/agent-approval-forwarding-requires-a-symbol-brand.md +0 -27
  580. package/knowledge/decisions/security/agent-credential-requests-are-symbol-branded.md +0 -37
  581. package/knowledge/decisions/security/agent-gate-requires-a-session-only-when-auth-is-true.md +0 -31
  582. package/knowledge/decisions/security/agent-ownership-failures-never-echo-the-resource.md +0 -23
  583. package/knowledge/decisions/security/agent-resume-re-runs-the-authorization-gate.md +0 -22
  584. package/knowledge/decisions/security/agent-sessionless-deployments-have-no-thread-ownership.md +0 -39
  585. package/knowledge/decisions/security/agent-thread-ownership-composes-the-session-principal.md +0 -30
  586. package/knowledge/decisions/security/agent-tool-filtering-reads-the-live-function-config.md +0 -24
  587. package/knowledge/decisions/security/an-addon-header-can-only-narrow-the-session.md +0 -26
  588. package/knowledge/decisions/security/an-addon-instance-reads-only-the-secrets-and-credentials-it-is-named.md +0 -33
  589. package/knowledge/decisions/security/an-addon-may-reach-only-itself-and-the-addons-it-uses.md +0 -16
  590. package/knowledge/decisions/security/an-agent-approval-is-claimed-before-the-tool-runs.md +0 -33
  591. package/knowledge/decisions/security/an-api-key-is-jwt-decoded-into-the-session.md +0 -26
  592. package/knowledge/decisions/security/an-approval-answer-outlives-the-run-it-answered.md +0 -59
  593. package/knowledge/decisions/security/an-empty-owners-constraint-matches-nothing.md +0 -30
  594. package/knowledge/decisions/security/an-exposed-ungated-function-is-a-codegen-warning.md +0 -52
  595. package/knowledge/decisions/security/an-external-virtual-user-caller-presents-one-signed-statement.md +0 -38
  596. package/knowledge/decisions/security/an-inbound-webhook-source-dispatches-only-verified-requests.md +0 -31
  597. package/knowledge/decisions/security/an-mcp-call-with-no-http-request-stays-anonymous.md +0 -18
  598. package/knowledge/decisions/security/an-mcp-refusal-is-decided-before-dispatch.md +0 -48
  599. package/knowledge/decisions/security/an-oauth2-credential-is-read-by-its-account-row.md +0 -40
  600. package/knowledge/decisions/security/an-omitted-user-id-addresses-the-platform-credential.md +0 -32
  601. package/knowledge/decisions/security/an-upload-is-counted-as-it-arrives-not-buffered-then-measured.md +0 -24
  602. package/knowledge/decisions/security/analytics-identity-is-stamped-from-the-session-not-the-event.md +0 -24
  603. package/knowledge/decisions/security/app-access-is-a-scope-tree-synthesised-from-virtual-users.md +0 -26
  604. package/knowledge/decisions/security/approval-policy-decides-who-answers-a-tool-call.md +0 -27
  605. package/knowledge/decisions/security/auth-false-on-a-session-function-warns-and-still-requires-one.md +0 -25
  606. package/knowledge/decisions/security/bearer-token-hashes-are-unpeppered-sha256.md +0 -18
  607. package/knowledge/decisions/security/consent-is-read-from-a-cookie-and-a-recognised-denial-counts-as-refusal.md +0 -29
  608. package/knowledge/decisions/security/console-addon-privileged-functions-gate-themselves.md +0 -84
  609. package/knowledge/decisions/security/core-safe-fetch-blocks-ssrf-by-host-literal-not-dns.md +0 -39
  610. package/knowledge/decisions/security/core-secrets-use-a-per-secret-dek-wrapped-by-a-kek.md +0 -37
  611. package/knowledge/decisions/security/cors-defaults-to-any-origin-and-refuses-the-wildcard-with-credentials.md +0 -22
  612. package/knowledge/decisions/security/credential-backends-share-one-conformance-suite-for-per-user-isolation.md +0 -29
  613. package/knowledge/decisions/security/each-stage-has-one-virtual-user-key-pair.md +0 -27
  614. package/knowledge/decisions/security/gateway-handlers-run-through-the-function-runner-gate.md +0 -41
  615. package/knowledge/decisions/security/gateway-middleware-sessions-must-be-bridged-onto-the-wire.md +0 -30
  616. package/knowledge/decisions/security/global-permissions-and-function-permissions-are-independent-gates.md +0 -40
  617. package/knowledge/decisions/security/hmac-verification-fails-closed-on-empty-inputs.md +0 -25
  618. package/knowledge/decisions/security/http-error-detail-is-withheld-from-clients-in-production.md +0 -33
  619. package/knowledge/decisions/security/http-request-bodies-are-bounded-before-they-are-buffered.md +0 -46
  620. package/knowledge/decisions/security/index.md +0 -135
  621. package/knowledge/decisions/security/local-content-refuses-private-buckets-under-the-public-segment.md +0 -21
  622. package/knowledge/decisions/security/mail-is-allowlisted-before-a-virtual-user-run-sees-it.md +0 -38
  623. package/knowledge/decisions/security/mcp-internal-error-details-are-double-gated-on-production.md +0 -27
  624. package/knowledge/decisions/security/mcp-resources-tools-and-prompts-take-sessionless-functions.md +0 -18
  625. package/knowledge/decisions/security/origin-locked-routes-match-the-origin-exactly.md +0 -22
  626. package/knowledge/decisions/security/oss-auth-works-without-pikku-studio-cloud.md +0 -26
  627. package/knowledge/decisions/security/outbound-webhooks-use-an-allowlist-when-configured.md +0 -24
  628. package/knowledge/decisions/security/passphrases-are-stretched-key-material-is-expanded.md +0 -40
  629. package/knowledge/decisions/security/permission-auth-filtering-requires-live-permission-functions.md +0 -31
  630. package/knowledge/decisions/security/pikku-carries-virtual-user-scopes-as-data-and-the-app-grants-them.md +0 -35
  631. package/knowledge/decisions/security/queue-job-identities-are-signed-at-enqueue.md +0 -69
  632. package/knowledge/decisions/security/queue-jobs-carry-the-producers-pikku-user-id.md +0 -39
  633. package/knowledge/decisions/security/remote-addon-tokens-are-client-credentials-not-mesh-trust.md +0 -34
  634. package/knowledge/decisions/security/scaffold-features-are-authenticated-unless-opted-out.md +0 -55
  635. package/knowledge/decisions/security/scenario-step-functions-are-never-externally-invocable.md +0 -30
  636. package/knowledge/decisions/security/scope-resolution-happens-at-the-session-boundary-and-sync-never-deletes.md +0 -28
  637. package/knowledge/decisions/security/scoped-content-access-is-a-root-folder-with-longest-prefix-grants.md +0 -31
  638. package/knowledge/decisions/security/self-authentication-is-declared-not-detected.md +0 -34
  639. package/knowledge/decisions/security/services-without-secrets-get-a-throwing-secrets-accessor.md +0 -22
  640. package/knowledge/decisions/security/shared-guards-refuse-to-mutate-or-shadow-a-system-role.md +0 -34
  641. package/knowledge/decisions/security/signed-content-urls-bind-the-request-path.md +0 -37
  642. package/knowledge/decisions/security/signed-uploads-are-verified-by-the-same-check-as-signed-reads.md +0 -26
  643. package/knowledge/decisions/security/system-role-scopes-must-be-declared-with-define-scope.md +0 -24
  644. package/knowledge/decisions/security/system-roles-are-additive-and-immutable.md +0 -16
  645. package/knowledge/decisions/security/the-channel-rpc-does-not-send-the-callers-session.md +0 -21
  646. package/knowledge/decisions/security/the-remote-jobs-inbox-fails-closed-without-a-secret.md +0 -24
  647. package/knowledge/decisions/security/the-remote-rpc-gate-fails-closed-and-binds-the-token-to-its-function.md +0 -34
  648. package/knowledge/decisions/security/the-workflow-status-stream-rechecks-ownership-on-every-poll.md +0 -16
  649. package/knowledge/decisions/security/two-credentials-on-one-key-must-share-a-read-mode.md +0 -29
  650. package/knowledge/decisions/security/verified-bearer-claims-are-pass-through-data-that-core-never-fills.md +0 -23
  651. package/knowledge/decisions/security/virtual-user-catalogue-excludes-the-machinery-that-runs-virtual-users.md +0 -25
  652. package/knowledge/decisions/security/virtual-user-conversation-missing-approval-decisions-default-to-denied.md +0 -22
  653. package/knowledge/decisions/security/virtual-user-run-records-are-gated-behind-a-read-scope.md +0 -18
  654. package/knowledge/decisions/security/virtual-user-sign-in-does-not-exist-in-production.md +0 -25
  655. package/knowledge/decisions/security/virtual-user-sign-in-has-one-door.md +0 -42
  656. package/knowledge/decisions/security/virtual-user-sign-in-is-proven-by-set-cookie-not-a-non-empty-jar.md +0 -29
  657. package/knowledge/decisions/security/virtual-user-sign-in-only-works-for-virtual-user-flagged-users.md +0 -29
  658. package/knowledge/decisions/security/webhook-bodies-are-signed-before-they-are-enqueued.md +0 -25
  659. package/knowledge/decisions/security/wire-addon-expose-selects-the-rpc-surface.md +0 -51
  660. package/knowledge/decisions/security/workflow-approval-payloads-are-validated-on-replay-inside-the-workflow.md +0 -40
  661. package/knowledge/decisions/security/workflow-helper-functions-are-sessionless-by-declaration.md +0 -18
  662. package/knowledge/decisions/security/workflow-queued-steps-rehydrate-their-session-from-the-run-wire.md +0 -32
  663. package/knowledge/decisions/security/workflow-scenario-sessions-are-isolated-per-virtual-user-and-per-scenario.md +0 -32
  664. package/knowledge/decisions/security/workflow-scenario-steps-are-never-network-invocable.md +0 -31
  665. package/knowledge/decisions/security/workflow-virtual-user-steps-always-use-the-real-transport.md +0 -34
  666. package/knowledge/decisions/security/writing-a-virtual-user-schedule-is-gated-by-its-own-scope.md +0 -18
  667. package/knowledge/index.md +0 -24
  668. package/knowledge/questions/a-bearer-jwt-with-no-identity-becomes-a-session.md +0 -24
  669. package/knowledge/questions/channel-middleware-accepts-bare-factories-that-nothing-resolves.md +0 -35
  670. package/knowledge/questions/dev-quick-login-as-impersonation.md +0 -25
  671. package/knowledge/questions/does-a-delayed-rpc-run-as-the-session-it-was-scheduled-with.md +0 -26
  672. package/knowledge/questions/does-a-user-id-with-a-colon-read-another-users-credentials.md +0 -27
  673. package/knowledge/questions/does-a-wirecli-command-need-a-session-by-default.md +0 -26
  674. package/knowledge/questions/does-an-adversarial-in-scope-success-count-as-a-finding.md +0 -26
  675. package/knowledge/questions/does-approve-step-need-the-run-owners-session-or-the-gates-approvers.md +0 -34
  676. package/knowledge/questions/does-cors-origin-true-reflect-any-origin-with-credentials.md +0 -20
  677. package/knowledge/questions/does-skip-user-session-do-anything-on-a-channel.md +0 -24
  678. package/knowledge/questions/does-the-store-session-match-the-other-two.md +0 -19
  679. package/knowledge/questions/index.md +0 -41
  680. package/knowledge/questions/is-the-agent-score-worker-reachable-without-a-session.md +0 -21
  681. package/knowledge/questions/live-scheduled-tests-may-write.md +0 -19
  682. package/knowledge/questions/provision-virtual-users-has-no-caller-in-this-repo.md +0 -23
  683. package/knowledge/questions/remote-secret-refuses-requests-without-a-remote-token-on-every-path.md +0 -32
  684. package/knowledge/questions/should-a-middleware-set-session-persist-to-the-store.md +0 -25
  685. package/knowledge/questions/should-a-scoped-secret-view-throw-from-has-secret-for-a-disallowed-key.md +0 -23
  686. package/knowledge/questions/should-a-wrong-bearer-token-be-anonymous-or-refused.md +0 -35
  687. package/knowledge/questions/should-an-empty-webhook-signing-secret-send-unsigned.md +0 -23
  688. package/knowledge/questions/should-http-virtual-user-sessions-reset-between-scenarios-in-one-run.md +0 -27
  689. package/knowledge/questions/should-the-cookie-jar-scope-cookies-to-the-api-origin.md +0 -26
  690. package/knowledge/questions/should-voice-input-fetch-audio-urls-without-a-host-allowlist.md +0 -20
  691. package/knowledge/questions/staging-impersonation-rules.md +0 -27
  692. package/knowledge/questions/unauthorized-channel-replies-escape-the-declared-out-type.md +0 -44
  693. package/knowledge/questions/virtual-user-keys-on-cloud-stages-are-pikku-studios-to-build.md +0 -34
  694. package/knowledge/questions/virtual-user-statement-replay-is-per-process.md +0 -20
  695. package/knowledge/questions/what-an-impersonated-session-carries.md +0 -22
  696. package/run-tests.sh +0 -68
  697. package/scripts/generate-api-report.d.mts +0 -1
  698. package/scripts/generate-api-report.mjs +0 -96
  699. package/scripts/generate-api-report.mts +0 -333
  700. package/src/public-surface.json +0 -637
  701. package/src/public-surface.json.README +0 -43
  702. /package/dist/{function/compensation-name.d.ts → compensation-name.d.ts} +0 -0
  703. /package/dist/{function/compensation-name.js → compensation-name.js} +0 -0
@@ -1,8 +0,0 @@
1
- import type { QueueService, JobOptions } from '../wirings/queue/queue.types.js';
2
- export declare class InMemoryQueueService implements QueueService {
3
- readonly supportsResults = false;
4
- private jobCounter;
5
- add<T>(queueName: string, data: T, options?: JobOptions): Promise<string>;
6
- private backoffDelay;
7
- getJob(): Promise<null>;
8
- }
@@ -1,54 +0,0 @@
1
- import { runQueueJob } from '../wirings/queue/queue-runner.js';
2
- // knowledge: decisions/internals/the-dev-queue-copies-prod-timing-and-serialization-semantics.md
3
- export class InMemoryQueueService {
4
- supportsResults = false;
5
- jobCounter = 0;
6
- async add(queueName, data, options) {
7
- const jobId = `inmem-${++this.jobCounter}`;
8
- const maxAttempts = Math.max(1, options?.attempts ?? 1);
9
- let attemptsMade = 0;
10
- const createdAt = new Date();
11
- const payload = data === undefined ? data : JSON.parse(JSON.stringify(data));
12
- const runAttempt = async () => {
13
- attemptsMade++;
14
- const job = {
15
- id: jobId,
16
- queueName,
17
- data: payload,
18
- status: () => 'active',
19
- metadata: () => ({ attemptsMade, maxAttempts, createdAt }),
20
- pikkuUserId: options?.pikkuUserId,
21
- };
22
- try {
23
- await runQueueJob({ job });
24
- }
25
- catch (e) {
26
- if (attemptsMade < maxAttempts) {
27
- // Fire-and-forget retry: runAttempt catches every error itself.
28
- setTimeout(() => void runAttempt(), this.backoffDelay(options?.backoff, attemptsMade));
29
- }
30
- else {
31
- console.error(`[InMemoryQueue] Job ${jobId} on ${queueName} failed after ${attemptsMade} attempt(s):`, e.message);
32
- }
33
- }
34
- };
35
- const delay = options?.delay ?? 100 + Math.floor(Math.random() * 201);
36
- // Fire-and-forget: runAttempt catches every error itself.
37
- setTimeout(() => void runAttempt(), delay);
38
- return jobId;
39
- }
40
- backoffDelay(backoff, attemptsMade) {
41
- const baseDelay = typeof backoff === 'object' ? (backoff.delay ?? 50) : 50;
42
- if (backoff === 'exponential' ||
43
- (typeof backoff === 'object' && backoff?.type === 'exponential')) {
44
- return Math.min(2 ** (attemptsMade - 1) * baseDelay, 2000);
45
- }
46
- if (typeof backoff === 'object' && backoff?.type === 'fixed') {
47
- return backoff.delay ?? 50;
48
- }
49
- return 50;
50
- }
51
- async getJob() {
52
- return null;
53
- }
54
- }
@@ -1,4 +0,0 @@
1
- import { PikkuTriggerService } from '../wirings/trigger/pikku-trigger-service.js';
2
- export declare class InMemoryTriggerService extends PikkuTriggerService {
3
- start(): Promise<void>;
4
- }
@@ -1,6 +0,0 @@
1
- import type { GatewayService } from './gateway-service.js';
2
- export declare class LocalGatewayService implements GatewayService {
3
- private activeAdapters;
4
- start(): Promise<void>;
5
- stop(): Promise<void>;
6
- }
@@ -1,2 +0,0 @@
1
- export declare function canonicalJSON(obj: unknown): string;
2
- export declare function hashString(input: string, length?: number): string;
@@ -1,23 +0,0 @@
1
- import { createHash } from 'node:crypto';
2
- export function canonicalJSON(obj) {
3
- return JSON.stringify(sortDeep(obj));
4
- }
5
- function sortDeep(value) {
6
- if (value === null || value === undefined) {
7
- return value;
8
- }
9
- if (Array.isArray(value)) {
10
- return value.map(sortDeep);
11
- }
12
- if (typeof value === 'object') {
13
- const sorted = {};
14
- for (const key of Object.keys(value).sort()) {
15
- sorted[key] = sortDeep(value[key]);
16
- }
17
- return sorted;
18
- }
19
- return value;
20
- }
21
- export function hashString(input, length = 16) {
22
- return createHash('sha256').update(input).digest('hex').slice(0, length);
23
- }
@@ -1,19 +0,0 @@
1
- ---
2
- type: overview
3
- title: Decisions
4
- description: Rules chosen in @pikku/core, and what each one rules out
5
- ---
6
-
7
- # Decisions
8
-
9
- A rule that was chosen, and what it rules out.
10
-
11
- Each note here replaces a comment that was carrying reasoning inside the source.
12
- If you are about to "clean up" something in core that looks pointless, search
13
- here first — several of these exist because the obvious simplification was tried
14
- and broke something.
15
-
16
- <!-- pikku:knowledge-index -->
17
- - [internals](internals/index.md) — a rule about how it works under the hood, and why
18
- - [security](security/index.md) — a rule about who may do what
19
- <!-- /pikku:knowledge-index -->
@@ -1,29 +0,0 @@
1
- ---
2
- type: decision
3
- title: A credential name declared twice must agree on its schema and its type
4
- description: validateAndBuildCredentialDefinitionsMeta throws when two declarations of one credential name differ in schema or in type, and otherwise keeps the first declaration
5
- tags: core, credentials, validation
6
- ---
7
-
8
- # A credential name declared twice must agree on its schema and its type
9
-
10
- `packages/core/src/wirings/credential/validate-credential-definitions.ts` builds
11
- the credential metadata, keyed by name.
12
-
13
- When a name repeats, the schema is compared first, but only if both declarations
14
- resolve to a schema reference (`validate-credential-definitions.ts:19-23`). Two
15
- references differ when their variable name or source file differs
16
- (`validate-credential-definitions.ts:24-27`). A difference throws, and the message
17
- says "Credentials sharing a name must use the same schema"
18
- (`validate-credential-definitions.ts:28-33`).
19
-
20
- The `type` field is then compared (`validate-credential-definitions.ts:38-45`).
21
- The type is `'singleton' | 'wire'` (`credential.types.ts:26`). A different type
22
- throws with the message "Credentials sharing a name must use the same type"
23
- (`validate-credential-definitions.ts:43`).
24
-
25
- When both checks pass, the repeat is skipped and the first declaration stays
26
- (`validate-credential-definitions.ts:47`).
27
-
28
- **What this rules out:** two addons declaring the same credential name with
29
- different schemas or read modes, and a silent choice between them.
@@ -1,29 +0,0 @@
1
- ---
2
- type: decision
3
- title: declareScopes lets an app grant a scope whose addon it does not wire
4
- description: defineScope is a no-op read by the CLI, and declareScopes declares scope ids so a grant is valid without wiring the addon that owns the scope tree
5
- tags: core, scopes, addons, codegen
6
- ---
7
-
8
- # declareScopes lets an app grant a scope whose addon it does not wire
9
-
10
- `packages/core/src/wirings/scope/define-scope.ts` has two declaration functions,
11
- both with empty bodies.
12
-
13
- `defineScope` is a no-op that "tree-shakes away". The CLI reads the call by AST and
14
- generates a `ScopeId` union, so a function that names an undeclared scope fails to
15
- build (`define-scope.ts:3-6`, `33`).
16
-
17
- `declareScopes` takes a list of ids (`define-scope.ts:53`). Its doc comment says it
18
- exists so that an app can grant a scope, in a system role or a function's
19
- `scopes`, whose tree belongs to an addon the app has not wired
20
- (`define-scope.ts:36-42`). Each id declares that node and its ancestors
21
- (`define-scope.ts:44`). When the addon is wired, its own description wins, and the
22
- two calls "never conflict, unlike a second `defineScope` for the same root"
23
- (`define-scope.ts:44-46`).
24
-
25
- The example is `declareScopes(['pikku:console'])` (`define-scope.ts:49-51`).
26
-
27
- **What this rules out:** declaring the same scope root with `defineScope` in two
28
- places, which the doc says conflicts, and making a grant valid only by wiring the
29
- addon that owns it.
@@ -1,28 +0,0 @@
1
- ---
2
- type: decision
3
- title: A held run is woken later, not retried
4
- description: An orchestrator message that finds its run held enqueues a fresh wake-up a second later instead of failing, because the queue's retry budget is for real failures and a long pass outlasts it
5
- tags: [workflows, leases, queues]
6
- ---
7
-
8
- # A held run is woken later, not retried
9
-
10
- Every message on the orchestrator queue carries news the run has to see — a step
11
- finished, a child ended — so a message that finds the run held by another pass
12
- cannot simply be dropped. Throwing it back to the queue looks equivalent and is
13
- not: it spends the retries the queue keeps for genuine failures. pg-boss gives an
14
- orchestrator message six attempts on an exponential backoff, the last about 55
15
- seconds in; a pass that holds the run longer than that leaves the message dead
16
- and the run `running` forever.
17
-
18
- So a `LeaseTakenError` or `LeaseLostError` enqueues a new orchestrator message
19
- with a one-second delay (`RUN_LEASE_RETRY_MS`) and the current message succeeds.
20
- `verifiers/workflows/src/runners/run-lease.runner.ts` holds a run's lease for 90
21
- seconds and checks the run still completes.
22
-
23
- The same errors never fail an inline run: its body already wrote its outcome,
24
- and losing the lease afterwards says only that the outcome was not produced
25
- alone — the run keeps the status it wrote.
26
-
27
- **What this rules out:** treating a taken run lease as a queue failure, and
28
- marking a run failed because its lease was lost.
@@ -1,22 +0,0 @@
1
- ---
2
- type: decision
3
- title: A non-streaming agent run registers with agentRunState on the same terms as a streaming one
4
- description: Otherwise interruptAgent finds the run, passes the ownership check, then cannot stop it — and reports that as if the run were on another host
5
- tags: core, agent
6
- ---
7
-
8
- # A non-streaming agent run registers with `agentRunState` too
9
-
10
- `runAgent` registers its run with `agentRunState` exactly as `streamAgent`
11
- does, even though nothing is streaming and there is no channel to interrupt.
12
-
13
- `interruptAgent` resolves a run through `agentRunState` first, checks ownership,
14
- then looks for a local abort handle. A run that skipped registration is invisible
15
- at the first step. A run that registered but has no handle is visible, passes the
16
- ownership check, and then cannot be stopped — which the interrupt path reports as
17
- "running on another instance". That message would be wrong and actively
18
- misleading: the run is right here, and the deployment is single-instance.
19
-
20
- **What this rules out:** treating registration as a streaming concern. It is an
21
- addressability concern, and the two paths have to be addressable the same way for
22
- the interrupt path's diagnosis to mean anything.
@@ -1,50 +0,0 @@
1
- ---
2
- type: decision
3
- title: With scenarios.reset on, the dev seed is the fixture every assertion is written against
4
- description: The rollback restores the database as the suite found it, so seed rows are the shared baseline — which makes an absolute date in the seed a test that expires
5
- tags: cli, scenarios
6
- ---
7
-
8
- # A reset suite makes the dev seed the fixture
9
-
10
- `scenarios.reset` takes a copy of every table when the suite starts and restores
11
- that copy between scenarios. It is a snapshot-and-restore, not a
12
- truncate-and-reseed: nothing replays the seed file, and nothing regenerates its
13
- rows.
14
-
15
- Two things follow, and both are easy to get wrong.
16
-
17
- **The seed is the fixture.** Before a reset was available, a project usually had
18
- a hand-rolled reset RPC that wiped and re-created the handful of rows its
19
- scenarios touched. That RPC was the fixture and the seed was scenery. With the
20
- rollback on, the whole seed is in scope — every booking, invoice and event a
21
- developer put there for their own convenience is now a row some scenario can
22
- count. Assertions written as counts against the old narrow fixture go wrong the
23
- moment the baseline widens.
24
-
25
- **A date literal in the seed expires.** A seed is applied once, and from then on
26
- the restore keeps handing back the same rows. Write `'2026-03-14'` and the
27
- fixture is correct on the day it was written and quietly wrong a month later —
28
- the booking that was supposed to be upcoming is in the past, and the scenario
29
- that asserts on it fails for a reason that has nothing to do with the code. Seed
30
- dates belong relative to the moment the seed is applied:
31
-
32
- ```sql
33
- INSERT INTO booking (id, starts_at, ends_at) VALUES
34
- ('b_upcoming', date('now', '+200 days'), date('now', '+207 days')),
35
- ('b_ended', date('now', '-8 days'), date('now', '-1 days'));
36
- ```
37
-
38
- `date('now', ...)` in sqlite, `now() + interval '200 days'` in postgres. Pick the
39
- offsets so each row sits unambiguously on the side of whatever boundary the
40
- scenarios test, rather than a day away from it.
41
-
42
- There is a third limit worth stating plainly: the baseline is the database _as
43
- the suite starts_, so it is not a pristine seed. Run N+1 inherits whatever run N
44
- left behind. A value that must be unique in the database — an invoice number, a
45
- reference code — has to be scoped to the run, not hard-coded, or the second run
46
- collides with the first.
47
-
48
- **What this rules out:** treating the reset as "the suite starts from the seed
49
- every time". It starts from wherever the database was, and keeps returning
50
- there.
@@ -1,20 +0,0 @@
1
- ---
2
- type: decision
3
- title: A resumed turn is as interruptible as the first one
4
- description: It is the same person listening to the same voice, and after an approval it is where most of the reply actually gets spoken
5
- tags: core, agent
6
- ---
7
-
8
- # A resumed turn is as interruptible as the first one
9
-
10
- Resuming after an approval registers for interruption on the same terms as the
11
- original turn.
12
-
13
- It is the same person listening to the same voice, so the reason to allow
14
- interruption has not changed. And after an approval is precisely where most of
15
- the reply gets spoken: an approved delete is followed by the agent describing
16
- what it did, which is a normal thing for a listener to talk over.
17
-
18
- **What this rules out:** treating the resume as a short continuation not worth
19
- wiring for interruption. By volume of speech it is usually the larger half of
20
- the exchange.
@@ -1,21 +0,0 @@
1
- ---
2
- type: decision
3
- title: A scenario step's prose template is offered to a virtual user unfilled
4
- description: A reporter fills placeholders from a run that happened; there is no run yet, and the filled form would answer the question the user is there to answer
5
- tags: core, virtual-user
6
- ---
7
-
8
- # A scenario step's prose template is offered unfilled
9
-
10
- When a scenario step becomes a catalogue entry, its prose template goes in with
11
- its placeholders intact — braces and all.
12
-
13
- A reporter fills those placeholders from a run that already happened. There is
14
- no run yet at derivation time, so there is nothing to fill them from. More
15
- importantly, filling them would answer the wrong question: "invites {email}"
16
- tells the user to choose someone, where "invites ada@example.com" tells it whom
17
- — and _whom_ is the scenario author's answer, not something the virtual user
18
- worked out.
19
-
20
- **What this rules out:** substituting example or fixture values to make the
21
- catalogue read more naturally. It reads better and tests less.
@@ -1,22 +0,0 @@
1
- ---
2
- type: decision
3
- title: A scheduled task writes its caller's session to the session store before it runs
4
- description: runScheduledTask stores the session it is passed, or nothing, before it looks up the task, so the run uses only a session its caller supplied
5
- tags: core, scheduler, sessions
6
- ---
7
-
8
- # A scheduled task writes its caller's session to the session store before it runs
9
-
10
- `runScheduledTask` in `packages/core/src/wirings/scheduler/scheduler-runner.ts:70-87`
11
- takes an optional `session`. It builds a `PikkuSessionService` on the session store
12
- (`:84`), and when a session was passed it calls `userSession.set(session)` (`:85-87`).
13
- Nothing else in the function sets a session. The task and its meta are looked up
14
- afterwards (`:89-96`), so a missing task still leaves the session written.
15
-
16
- The in-repo caller of this path, `packages/schedule/src/in-memory-scheduler-service.ts:163`,
17
- passes only `{ name }`, so a cron run has no session.
18
-
19
- **What this rules out:** a scheduled run taking a session from anywhere other than
20
- its caller, and any default system session being set by this function.
21
- `questions/does-a-delayed-rpc-run-as-the-session-it-was-scheduled-with.md` records a
22
- related gap in the delayed-RPC path.
@@ -1,28 +0,0 @@
1
- ---
2
- type: decision
3
- title: A secret set in memory shadows the variable of the same name
4
- description: LocalSecretService reads its in-memory map before the variables service, stores a SecretValue unwrapped, and treats an empty string as absent
5
- tags: core, secrets, local-dev
6
- ---
7
-
8
- # A secret set in memory shadows the variable of the same name
9
-
10
- `packages/core/src/services/local-secrets.ts` keeps an in-memory map of secrets.
11
- `getSecret` checks that map first (`local-secrets.ts:25-29`). Only when the key is
12
- missing or empty does it fall back to the variables service
13
- (`local-secrets.ts:31-34`), and it throws if neither has the key
14
- (`local-secrets.ts:35`). `hasSecret` follows the same order (`local-secrets.ts:49-52`).
15
-
16
- Values are parsed as JSON when possible and kept as the raw string otherwise
17
- (`local-secrets.ts:13-19`).
18
-
19
- `setSecret` unwraps a `SecretValue` before storing it (`local-secrets.ts:38-45`).
20
- The comment gives the reason: storing the wrapper "would serialize it to
21
- '[secret]'" (`local-secrets.ts:39`).
22
-
23
- `deleteSecret` removes only the in-memory entry (`local-secrets.ts:56-58`), so a
24
- variable of the same name becomes visible again after a delete.
25
-
26
- **What this rules out:** a secret written through `setSecret` being replaced by
27
- the value of a variable with the same name, and storing a redacted wrapper in
28
- place of the secret.
@@ -1,49 +0,0 @@
1
- ---
2
- type: decision
3
- title: A secret that fails to decrypt fails the whole read
4
- description: getSecrets throws naming the key and its key_version rather than omitting the row, because a silent omission surfaces as an unrelated failure much later
5
- tags: crypto, storage
6
- ---
7
-
8
- # A secret that fails to decrypt fails the whole read
9
-
10
- Every store's bulk read — `getSecrets` in the kysely, mongodb and redis secret
11
- services — wraps the `getKEK` + `envelopeDecrypt` pair in a try/catch that
12
- rethrows:
13
-
14
- ```
15
- Failed to decrypt secret "<key>" (key_version <n>): the configured KEK does not
16
- match the key it was wrapped under
17
- ```
18
-
19
- with the original crypto error as `cause`. A key that has no row at all is still
20
- simply absent from the returned object; only a row that exists and will not
21
- decrypt is fatal.
22
-
23
- Those two cases look similar and are not. A missing key is an ordinary, callable
24
- state — the caller asked for something that was never stored, and the typed
25
- secret layer above already decides what to do about an absent value. A stored
26
- row that will not decrypt means the service is holding ciphertext it cannot
27
- read: a `PIKKU_SECRET_KEK` that does not match what the value was wrapped under,
28
- a `previousKey` missing for an older `keyVersion`, or a change to the derivation
29
- itself. Nothing the caller can do downstream makes that better.
30
-
31
- Dropping the row instead hands back a partial map, and the failure re-emerges
32
- somewhere with no connection to secrets — an auth middleware reading an
33
- undefined signing key and answering "server configuration error", a provider
34
- client constructed with `undefined` credentials and 401-ing. The name of the
35
- secret and the `key_version` it was wrapped under are precisely the two facts
36
- that turn that into a one-line fix, and they are known at the catch site and
37
- nowhere after it.
38
-
39
- This matters most at exactly the moment it is least convenient: a change to
40
- `deriveKEK` makes _every_ previously stored secret undecryptable at once. Loud
41
- failure names the first one; silence produces an empty map and a support ticket.
42
-
43
- **What this rules out:** a `getSecrets` that skips unreadable rows; returning
44
- `undefined` for a row that exists; collecting failures and returning them
45
- alongside the successes, which just moves the ignoring one level up; and
46
- treating a missing key as an error, which would break callers that legitimately
47
- probe for optional secrets.
48
-
49
- See [[the-kek-salt-is-scoped-to-the-key-version]].
@@ -1,32 +0,0 @@
1
- ---
2
- type: decision
3
- title: A virtual user acts through invokeRaw, so a refusal is data it can act on
4
- description: virtualUserTarget calls virtualUser.invokeRaw, which signs the virtual user in when needed, retries once after a 401, and returns the status instead of throwing
5
- tags: core, virtual-users
6
- ---
7
-
8
- # A virtual user acts through invokeRaw, so a refusal is data it can act on
9
-
10
- `virtualUserTarget` in `packages/core/src/wirings/virtual-user/virtual-user-target.ts`
11
- is "the only place the engine meets the network" (`virtual-user-target.ts:14`). It
12
- drives a signed-in virtual user. The doc comment says the virtual user keeps its
13
- cookies, re-logs in when a session expires mid-run, and reports status as data
14
- rather than throwing (`virtual-user-target.ts:14-17`).
15
-
16
- The call goes through `virtualUser.invokeRaw(rpcName, args)` (`virtual-user-target.ts:27`).
17
- The comment gives the reason: "to a virtual user a 403 is not an error, it is the
18
- system saying no, which is information it should be allowed to act on"
19
- (`virtual-user-target.ts:19-22`).
20
-
21
- In `HttpVirtualUser.invokeRaw`, the virtual user signs in first if it is not signed
22
- in (`packages/core/src/services/http-virtual-users.ts:117-119`). On a 401 it signs
23
- in again and retries once (`http-virtual-users.ts:121-126`). The method returns the
24
- response for every status.
25
-
26
- The virtual user's target passes no per-call options, so it cannot add a header
27
- (`virtual-user-target.ts:27`). That is covered in
28
- [a scenario step can name an identity no virtual user holds, through per-call headers](../security/a-step-can-name-an-identity-no-virtual-user-holds-through-per-call-headers.md).
29
-
30
- **What this rules out:** a virtual user calling `invoke`, which throws on error, and
31
- a virtual user being given per-call headers. For why `invokeRaw` returns status rather
32
- than throwing, see [in a scenario a 4xx is data, not an exception](in-a-scenario-a-4xx-is-data-not-an-exception.md).
@@ -1,66 +0,0 @@
1
- ---
2
- type: decision
3
- title: A virtual user cadence is a row, not a timer
4
- description: How often a virtual user runs is stored as a due time per virtual user and acted on by a tick the project schedules — pikku never starts a timer, and a run never reschedules itself
5
- tags: virtual-user, storage, scheduling
6
- ---
7
-
8
- # A virtual user cadence is a row, not a timer
9
-
10
- A run has a budget; a virtual user has a cadence. The two get confused because both
11
- answer "how often", and neither answers the other's question: a budget caps one
12
- outing, and raising it only buys a more tired user. What tells you about a
13
- product is the same person coming back over a fortnight.
14
-
15
- That cadence is one row per virtual user in `virtualUserSchedule`, holding
16
- `nextRunAt`. `tickVirtualUserSchedules` acts on whichever rows are due. There is
17
- no timer, no interval, and no in-memory loop.
18
-
19
- **Not a timer**, because a process holding the next run in its own heap forgets
20
- it on the next deploy, and the virtual user silently stops — with nothing anywhere
21
- saying it used to run. The row survives restarts, and any instance can act on
22
- it.
23
-
24
- **Not reschedule-on-completion**, which is the tempting shape: finish a run,
25
- draw a delay, schedule the next. It has exactly one failure mode and it is
26
- fatal — a crash between the two ends the virtual user forever, and the evidence is an
27
- absence. A due time written down before the run starts cannot be lost by the run
28
- failing.
29
-
30
- **Not a scaffolded cron.** The tick is generated as an ordinary function and
31
- wired by nobody. A `wireScheduler` emitted by codegen would start spending an
32
- application's model budget the moment somebody ran `pikku all`, on a host that
33
- may not even run schedulers. One line in the project turns it on:
34
-
35
- ```ts
36
- wireScheduler({ name: 'virtualUsers', schedule: '0 * * * *', func: tickVirtualUserSchedules })
37
- ```
38
-
39
- Tick resolution bounds how *late* a due virtual user is, never how often it runs — a
40
- virtual user due at 09:07 under an hourly tick starts at 10:00. Running the tick more
41
- often costs one indexed query and changes no cadence.
42
-
43
- Three rules make a tick safe to run at any resolution, from any number of
44
- instances:
45
-
46
- - **The due time is written before the run is dispatched**, so a tick that dies
47
- halfway cannot leave the row due for the next one to pick up again. A dispatch
48
- that throws therefore waits a full interval, which is the right way round: a
49
- virtual user failing to start should not be retried every minute for a week.
50
- - **A virtual user whose previous run is still `running` is skipped, not queued.**
51
- Two copies of the same user acting at once is not a heavier test, it is a
52
- different one, and every finding it produces is unreproducible.
53
- - **A run still `running` after `STALE_RUN_AFTER_MS` is failed and the virtual user
54
- runs again.** This is where the stranded-record cost of
55
- [a virtual user run not being a workflow](a-virtual-user-run-is-not-a-workflow-but-it-needs-a-trigger.md)
56
- gets paid: without it, one restart mid-run would block that virtual user's schedule
57
- permanently.
58
-
59
- The interval is a range (`minIntervalMs`, `maxIntervalMs`), drawn per run. A
60
- user who arrives at exactly 09:00 every day exercises one cache state and one
61
- cron neighbourhood; a real one does not keep an appointment.
62
-
63
- **What this rules out:** a `setTimeout` or interval anywhere in the run path;
64
- the engine scheduling its own next run; a scaffolded scheduled task; a queue
65
- holding the next run; and a cadence that lives only in a config file, which
66
- cannot record when the virtual user last actually went.
@@ -1,24 +0,0 @@
1
- ---
2
- type: decision
3
- title: A virtual user's converse signs in before its first turn
4
- description: HttpVirtualUser.converse calls login() before a run when it holds no session, because a public agent route never triggers the 401 retry that would sign the virtual user in
5
- tags: services, virtual-users, agents
6
- ---
7
-
8
- # A virtual user's converse signs in before its first turn
9
-
10
- `HttpVirtualUser.converse` (`packages/core/src/services/http-virtual-users.ts`)
11
- calls `this.login()` when `signedIn` is false, before it starts the run. Only
12
- then does it send the agent request.
13
-
14
- The code comment gives the reason. A public agent route never returns 401, so
15
- the 401 retry in `sendAgent` never runs and would never sign the virtual user
16
- in. An agent thread is also minted under a fresh anonymous id per request when
17
- no one owns it, so turn one could succeed and turn two be refused as somebody
18
- else's. A virtual user is a real account with real credentials, so conversing as
19
- nobody is not the intent.
20
-
21
- **What this rules out:** relying on the 401 retry for `converse`, and running a
22
- virtual user's conversation unauthenticated when it was meant to sign in.
23
- Compare [the 401-only retry](scenario-agent-calls-sign-in-on-401-only.md), which is
24
- how the other agent calls behave.
@@ -1,21 +0,0 @@
1
- ---
2
- type: decision
3
- title: A virtual user decides whether to trust its notes once per turn, by one roll
4
- description: The difference between the stale, newcomer and auditor dispositions is expressed as a single probability rather than as prose in each prompt
5
- tags: core, virtual-user
6
- ---
7
-
8
- # A virtual user decides whether to trust its notes once per turn
9
-
10
- Each turn the run makes one weighted decision: does this user act on what it
11
- already recorded, or go and look again.
12
-
13
- That single roll is where the dispositions differ. `stale` almost always trusts
14
- its notes — that is what makes it stale. A `newcomer` has none to trust. An
15
- `auditor` re-checks nearly everything, which is the entire point of an auditor.
16
- Expressing it as one probability keeps the difference between those runs in one
17
- readable place instead of spread through three prompts as English that drifts.
18
-
19
- **What this rules out:** encoding "you are suspicious of your own notes" into
20
- each disposition's prompt text, where the behaviour becomes a property of how
21
- the model reads prose rather than something the run controls and can report.
@@ -1,34 +0,0 @@
1
- ---
2
- type: decision
3
- title: A virtual user's email is computed from its id, with the run id as a sub-address
4
- description: virtualUserEmail derives the address from the virtual user id and a real domain, appends the run id so concurrent runs get separate inboxes and accounts, and refuses colliding addresses
5
- tags: core, virtual-users, email, runs
6
- ---
7
-
8
- # A virtual user's email is computed from its id, with the run id as a sub-address
9
-
10
- `packages/core/src/wirings/virtual-user/virtual-user-email.ts` computes the address a virtual user
11
- reads mail at. Nothing is declared by hand.
12
-
13
- The label is the virtual user id, lower-cased, with runs of non-alphanumerics turned
14
- into `-` and leading or trailing dashes removed (`virtual-user-email.ts:19-30`). A
15
- virtual user id with no letters or digits left throws (`virtual-user-email.ts:24-28`).
16
-
17
- The domain must contain a dot and no `@` (`virtual-user-email.ts:49-54`). The error
18
- asks for "a domain the stage actually receives mail on" (`virtual-user-email.ts:52`).
19
-
20
- With a `runId`, the address is `label+runIdLabel@domain` (`virtual-user-email.ts:55-56`).
21
- The doc comment says that without the suffix, two concurrent runs share "an inbox
22
- _and_ a user row, and run B reads run A's magic link" (`virtual-user-email.ts:35-37`).
23
- Without a `runId`, the bare form is returned (`virtual-user-email.ts:40-41`).
24
-
25
- `virtualUserEmails` throws when two virtual users compute the same address
26
- (`virtual-user-email.ts:76-82`). The comment says they "would share a user row and read
27
- each other's email" (`virtual-user-email.ts:79-80`).
28
-
29
- All of one virtual user's logins share one address (`virtual-user-email.ts:62-66`). The
30
- comment gives the reason: better-auth keeps `email` on the `user` and defaults
31
- `allowDifferentEmails` to false.
32
-
33
- **What this rules out:** two concurrent runs sharing an inbox, and two virtual users
34
- mapping to one account.