@pikku/core 0.12.83 → 0.12.86

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 (661) hide show
  1. package/CHANGELOG.md +492 -0
  2. package/README.md +1 -1
  3. package/dist/bootstrap-compat/root.d.ts +20 -0
  4. package/dist/classification/column-form.d.ts +32 -0
  5. package/dist/classification/column-form.js +42 -0
  6. package/dist/classification/data-classification.d.ts +64 -0
  7. package/dist/classification/index.d.ts +13 -0
  8. package/dist/classification/index.js +2 -0
  9. package/dist/classification/secret-value.d.ts +56 -0
  10. package/dist/classification/secret-value.js +46 -0
  11. package/dist/crypto-utils.d.ts +1 -1
  12. package/dist/ecosystem/agent-scorer.d.ts +12 -0
  13. package/dist/ecosystem/agent-scorer.js +5 -0
  14. package/dist/ecosystem/agent.d.ts +21 -0
  15. package/dist/ecosystem/agent.js +6 -0
  16. package/dist/ecosystem/channel/local.d.ts +3 -0
  17. package/dist/ecosystem/channel/local.js +3 -0
  18. package/dist/ecosystem/channel/serverless.d.ts +9 -0
  19. package/dist/ecosystem/channel/serverless.js +1 -0
  20. package/dist/ecosystem/channel.d.ts +15 -0
  21. package/dist/ecosystem/channel.js +5 -0
  22. package/dist/ecosystem/cli/channel.d.ts +16 -0
  23. package/dist/ecosystem/cli/channel.js +2 -0
  24. package/dist/ecosystem/cli.d.ts +9 -0
  25. package/dist/ecosystem/cli.js +2 -0
  26. package/dist/ecosystem/credential.d.ts +10 -0
  27. package/dist/ecosystem/credential.js +1 -0
  28. package/dist/ecosystem/crypto-utils.d.ts +8 -0
  29. package/dist/ecosystem/crypto-utils.js +1 -0
  30. package/dist/ecosystem/dev.d.ts +9 -0
  31. package/dist/ecosystem/dev.js +2 -0
  32. package/dist/ecosystem/errors.d.ts +8 -0
  33. package/dist/ecosystem/errors.js +2 -0
  34. package/dist/ecosystem/function.d.ts +13 -0
  35. package/dist/ecosystem/function.js +2 -0
  36. package/dist/ecosystem/gateway.d.ts +1 -0
  37. package/dist/ecosystem/hmac.d.ts +1 -0
  38. package/dist/ecosystem/hmac.js +1 -0
  39. package/dist/ecosystem/http.d.ts +13 -0
  40. package/dist/ecosystem/http.js +5 -0
  41. package/dist/ecosystem/mcp.d.ts +3 -0
  42. package/dist/ecosystem/mcp.js +2 -0
  43. package/dist/ecosystem/middleware.d.ts +18 -0
  44. package/dist/ecosystem/middleware.js +7 -0
  45. package/dist/ecosystem/node-host-resolver.d.ts +1 -0
  46. package/dist/ecosystem/node-host-resolver.js +1 -0
  47. package/dist/ecosystem/node.d.ts +1 -0
  48. package/dist/ecosystem/oauth2.d.ts +1 -0
  49. package/dist/ecosystem/oauth2.js +1 -0
  50. package/dist/ecosystem/persona.d.ts +17 -0
  51. package/dist/ecosystem/persona.js +5 -0
  52. package/dist/ecosystem/queue.d.ts +13 -0
  53. package/dist/ecosystem/queue.js +4 -0
  54. package/dist/ecosystem/remote.d.ts +8 -0
  55. package/dist/ecosystem/remote.js +1 -0
  56. package/dist/ecosystem/role.d.ts +4 -0
  57. package/dist/ecosystem/role.js +2 -0
  58. package/dist/ecosystem/rpc.d.ts +6 -0
  59. package/dist/ecosystem/rpc.js +3 -0
  60. package/dist/ecosystem/safe-fetch.d.ts +7 -0
  61. package/dist/ecosystem/safe-fetch.js +1 -0
  62. package/dist/ecosystem/scenario.d.ts +21 -0
  63. package/dist/ecosystem/scenario.js +8 -0
  64. package/dist/ecosystem/scheduler.d.ts +3 -0
  65. package/dist/ecosystem/scheduler.js +2 -0
  66. package/dist/ecosystem/schema.d.ts +2 -0
  67. package/dist/ecosystem/schema.js +1 -0
  68. package/dist/ecosystem/scope.d.ts +5 -0
  69. package/dist/ecosystem/scope.js +3 -0
  70. package/dist/ecosystem/secret.d.ts +11 -0
  71. package/dist/ecosystem/secret.js +2 -0
  72. package/dist/ecosystem/services/istanbul-coverage.d.ts +1 -0
  73. package/dist/ecosystem/services/istanbul-coverage.js +1 -0
  74. package/dist/ecosystem/services/local-content-request-handler.d.ts +9 -0
  75. package/dist/ecosystem/services/local-content-request-handler.js +1 -0
  76. package/dist/ecosystem/services/local-content.d.ts +2 -0
  77. package/dist/ecosystem/services/local-content.js +1 -0
  78. package/dist/ecosystem/services/local-meta.d.ts +1 -0
  79. package/dist/ecosystem/services/local-meta.js +1 -0
  80. package/dist/ecosystem/services/v8-coverage.d.ts +1 -0
  81. package/dist/ecosystem/services/v8-coverage.js +1 -0
  82. package/dist/ecosystem/services.d.ts +36 -0
  83. package/dist/ecosystem/services.js +12 -0
  84. package/dist/ecosystem/testing.d.ts +7 -0
  85. package/dist/ecosystem/testing.js +1 -0
  86. package/dist/ecosystem/trigger.d.ts +2 -0
  87. package/dist/ecosystem/trigger.js +1 -0
  88. package/dist/ecosystem/types.d.ts +12 -0
  89. package/dist/ecosystem/types.js +6 -0
  90. package/dist/ecosystem/variable.d.ts +9 -0
  91. package/dist/ecosystem/variable.js +1 -0
  92. package/dist/ecosystem/virtual-user.d.ts +24 -0
  93. package/dist/ecosystem/virtual-user.js +8 -0
  94. package/dist/ecosystem/workflow.d.ts +20 -0
  95. package/dist/ecosystem/workflow.js +6 -0
  96. package/dist/errors/index.d.ts +8 -0
  97. package/dist/errors/index.js +1 -0
  98. package/dist/errors/serialized-error.d.ts +7 -0
  99. package/dist/errors/serialized-error.js +1 -0
  100. package/dist/function/function-meta.types.d.ts +139 -0
  101. package/dist/function/function-meta.types.js +1 -0
  102. package/dist/function/function-runner.d.ts +3 -2
  103. package/dist/function/function-runner.js +31 -11
  104. package/dist/function/functions.types.d.ts +10 -2
  105. package/dist/function/index.d.ts +8 -2
  106. package/dist/function/index.js +4 -1
  107. package/dist/function/pikku-request.d.ts +8 -0
  108. package/dist/function/pikku-request.js +15 -0
  109. package/dist/index.d.ts +8 -8
  110. package/dist/index.js +3 -3
  111. package/dist/middleware/auth-apikey.d.ts +2 -10
  112. package/dist/middleware/auth-apikey.js +1 -1
  113. package/dist/middleware/auth-bearer.d.ts +2 -10
  114. package/dist/middleware/auth-bearer.js +1 -1
  115. package/dist/middleware/auth-cookie.d.ts +2 -10
  116. package/dist/middleware/auth-cookie.js +1 -1
  117. package/dist/middleware/cors.d.ts +5 -11
  118. package/dist/middleware/cors.js +13 -6
  119. package/dist/middleware/index.d.ts +3 -0
  120. package/dist/middleware/index.js +1 -0
  121. package/dist/middleware/middleware-factories.d.ts +9 -0
  122. package/dist/middleware/middleware-factories.js +19 -0
  123. package/dist/middleware/middleware.types.d.ts +27 -0
  124. package/dist/middleware/middleware.types.js +1 -0
  125. package/dist/middleware/remote-auth.d.ts +1 -1
  126. package/dist/middleware/remote-auth.js +1 -1
  127. package/dist/middleware/telemetry.d.ts +4 -20
  128. package/dist/middleware/telemetry.js +1 -1
  129. package/dist/middleware-runner.d.ts +2 -1
  130. package/dist/pikku-state.d.ts +2 -1
  131. package/dist/services/{ai-run-state-service.d.ts → agent-run-state-service.d.ts} +5 -5
  132. package/dist/services/agent-run-state-service.js +1 -0
  133. package/dist/services/{ai-agent-runner-service.d.ts → agent-runner-service.d.ts} +12 -12
  134. package/dist/services/agent-runner-service.js +1 -0
  135. package/dist/services/{ai-storage-service.d.ts → agent-storage-service.d.ts} +7 -7
  136. package/dist/services/agent-storage-service.js +1 -0
  137. package/dist/services/audit-service.d.ts +1 -1
  138. package/dist/services/credential-wire-service.js +1 -1
  139. package/dist/services/email-service.d.ts +1 -1
  140. package/dist/services/file-scenario-run-store.d.ts +58 -0
  141. package/dist/services/file-scenario-run-store.js +214 -0
  142. package/dist/services/http-personas.d.ts +1 -1
  143. package/dist/services/http-personas.js +3 -3
  144. package/dist/services/{in-memory-ai-run-state-service.d.ts → in-memory-agent-run-state-service.d.ts} +5 -5
  145. package/dist/services/{in-memory-ai-run-state-service.js → in-memory-agent-run-state-service.js} +1 -1
  146. package/dist/services/in-memory-workflow-service.d.ts +1 -1
  147. package/dist/services/index.d.ts +9 -5
  148. package/dist/services/index.js +4 -1
  149. package/dist/services/local-secrets.d.ts +1 -1
  150. package/dist/services/local-secrets.js +1 -1
  151. package/dist/services/logger.d.ts +7 -7
  152. package/dist/services/meta-service.d.ts +5 -4
  153. package/dist/services/scoped-secret-service.d.ts +1 -1
  154. package/dist/services/secret-service.d.ts +1 -1
  155. package/dist/services/typed-secret-service.d.ts +16 -2
  156. package/dist/services/typed-secret-service.js +5 -0
  157. package/dist/services/webhook-service.d.ts +1 -1
  158. package/dist/services/workflow-service.d.ts +2 -1
  159. package/dist/testing/index.d.ts +1 -0
  160. package/dist/testing/index.js +1 -0
  161. package/dist/testing/service-tests/agent-run-service-tests.d.ts +1 -1
  162. package/dist/testing/service-tests/agent-run-service-tests.js +3 -3
  163. package/dist/testing/service-tests/agent-storage-service-tests.d.ts +3 -0
  164. package/dist/testing/service-tests/{ai-storage-service-tests.js → agent-storage-service-tests.js} +4 -4
  165. package/dist/testing/service-tests.d.ts +4 -4
  166. package/dist/testing/service-tests.js +4 -4
  167. package/dist/types/core.types.d.ts +37 -187
  168. package/dist/types/core.types.js +1 -19
  169. package/dist/types/index.d.ts +2 -0
  170. package/dist/types/index.js +1 -0
  171. package/dist/types/state.types.d.ts +8 -6
  172. package/dist/utils.d.ts +13 -0
  173. package/dist/utils.js +2 -0
  174. package/dist/wirings/actor-flow/run-conversation.d.ts +2 -2
  175. package/dist/wirings/addon/addon-runner.d.ts +17 -0
  176. package/dist/wirings/addon/addon-runner.js +150 -0
  177. package/dist/wirings/addon/index.d.ts +6 -0
  178. package/dist/wirings/addon/index.js +3 -0
  179. package/dist/wirings/addon/remote-addon-auth.d.ts +16 -0
  180. package/dist/wirings/addon/remote-addon-auth.js +39 -0
  181. package/dist/wirings/addon/wire-addon.d.ts +80 -0
  182. package/dist/wirings/addon/wire-addon.js +120 -0
  183. package/dist/wirings/addon/wire-remote-addon.d.ts +22 -0
  184. package/dist/wirings/addon/wire-remote-addon.js +11 -0
  185. package/dist/wirings/{ai-agent/ai-agent-agui.d.ts → agent/agent-agui.d.ts} +2 -2
  186. package/dist/wirings/{ai-agent/ai-agent-agui.js → agent/agent-agui.js} +1 -1
  187. package/dist/wirings/{ai-agent/ai-agent-finalize.d.ts → agent/agent-finalize.d.ts} +10 -10
  188. package/dist/wirings/{ai-agent/ai-agent-finalize.js → agent/agent-finalize.js} +7 -7
  189. package/dist/wirings/{ai-agent/ai-agent-helpers.d.ts → agent/agent-helpers.d.ts} +1 -1
  190. package/dist/wirings/{ai-agent/ai-agent-interrupt.d.ts → agent/agent-interrupt.d.ts} +4 -4
  191. package/dist/wirings/{ai-agent/ai-agent-interrupt.js → agent/agent-interrupt.js} +2 -2
  192. package/dist/wirings/{ai-agent/ai-agent-memory.d.ts → agent/agent-memory.d.ts} +14 -14
  193. package/dist/wirings/{ai-agent/ai-agent-memory.js → agent/agent-memory.js} +1 -1
  194. package/dist/wirings/{ai-agent/ai-agent-model-config.js → agent/agent-model-config.js} +1 -1
  195. package/dist/wirings/{ai-agent/ai-agent-prepare.d.ts → agent/agent-prepare.d.ts} +24 -24
  196. package/dist/wirings/{ai-agent/ai-agent-prepare.js → agent/agent-prepare.js} +17 -17
  197. package/dist/wirings/agent/agent-registry.d.ts +16 -0
  198. package/dist/wirings/{ai-agent/ai-agent-registry.js → agent/agent-registry.js} +9 -9
  199. package/dist/wirings/{ai-agent → agent}/agent-rpc.js +8 -8
  200. package/dist/wirings/agent/agent-runner.d.ts +7 -0
  201. package/dist/wirings/{ai-agent/ai-agent-runner.js → agent/agent-runner.js} +49 -50
  202. package/dist/wirings/{ai-agent/ai-agent-stream.d.ts → agent/agent-stream.d.ts} +15 -15
  203. package/dist/wirings/{ai-agent/ai-agent-stream.js → agent/agent-stream.js} +78 -78
  204. package/dist/wirings/{ai-agent/ai-agent-turn.d.ts → agent/agent-turn.d.ts} +5 -5
  205. package/dist/wirings/{ai-agent/ai-agent-turn.js → agent/agent-turn.js} +4 -4
  206. package/dist/wirings/agent/agent-utils.d.ts +14 -0
  207. package/dist/wirings/agent/agent-utils.js +17 -0
  208. package/dist/wirings/{ai-agent/ai-agent.types.d.ts → agent/agent.types.d.ts} +47 -46
  209. package/dist/wirings/agent/agent.types.js +1 -0
  210. package/dist/wirings/agent/index.d.ts +12 -0
  211. package/dist/wirings/agent/index.js +10 -0
  212. package/dist/wirings/{ai-agent → agent}/voice-input.d.ts +1 -1
  213. package/dist/wirings/{ai-agent → agent}/voice-input.js +5 -5
  214. package/dist/wirings/{ai-agent → agent}/voice-output.d.ts +2 -3
  215. package/dist/wirings/{ai-agent → agent}/voice-output.js +8 -8
  216. package/dist/wirings/{ai-scorer/ai-scorer-grade.d.ts → agent-scorer/agent-scorer-grade.d.ts} +3 -3
  217. package/dist/wirings/{ai-scorer/ai-scorer-grade.js → agent-scorer/agent-scorer-grade.js} +6 -6
  218. package/dist/wirings/agent-scorer/agent-scorer-judge.d.ts +30 -0
  219. package/dist/wirings/{ai-scorer/ai-scorer-judge.js → agent-scorer/agent-scorer-judge.js} +57 -5
  220. package/dist/wirings/{ai-scorer/ai-scorer-live.d.ts → agent-scorer/agent-scorer-live.d.ts} +1 -1
  221. package/dist/wirings/{ai-scorer/ai-scorer-live.js → agent-scorer/agent-scorer-live.js} +3 -3
  222. package/dist/wirings/{ai-scorer/ai-scorer-registry.d.ts → agent-scorer/agent-scorer-registry.d.ts} +6 -6
  223. package/dist/wirings/{ai-scorer/ai-scorer-registry.js → agent-scorer/agent-scorer-registry.js} +4 -4
  224. package/dist/wirings/{ai-scorer/ai-scorer-snapshots.d.ts → agent-scorer/agent-scorer-snapshots.d.ts} +1 -1
  225. package/dist/wirings/{ai-scorer/ai-scorer-worker.d.ts → agent-scorer/agent-scorer-worker.d.ts} +3 -3
  226. package/dist/wirings/{ai-scorer/ai-scorer-worker.js → agent-scorer/agent-scorer-worker.js} +9 -7
  227. package/dist/wirings/{ai-scorer/ai-scorer.d.ts → agent-scorer/agent-scorer.d.ts} +12 -6
  228. package/dist/wirings/{ai-scorer/ai-scorer.js → agent-scorer/agent-scorer.js} +4 -3
  229. package/dist/wirings/{ai-scorer/ai-scorer.types.d.ts → agent-scorer/agent-scorer.types.d.ts} +24 -4
  230. package/dist/wirings/agent-scorer/agent-scorer.types.js +4 -0
  231. package/dist/wirings/agent-scorer/index.d.ts +6 -0
  232. package/dist/wirings/agent-scorer/index.js +5 -0
  233. package/dist/wirings/channel/channel-common.d.ts +2 -1
  234. package/dist/wirings/channel/channel-middleware-runner.d.ts +2 -1
  235. package/dist/wirings/channel/channel-rpc.types.d.ts +2 -2
  236. package/dist/wirings/channel/channel.types.d.ts +1 -1
  237. package/dist/wirings/channel/serverless/index.d.ts +1 -0
  238. package/dist/wirings/cli/channel/index.d.ts +1 -1
  239. package/dist/wirings/cli/cli-runner.d.ts +2 -1
  240. package/dist/wirings/cli/cli-runner.js +4 -1
  241. package/dist/wirings/cli/cli.types.d.ts +21 -2
  242. package/dist/wirings/cli/command-parser.js +157 -23
  243. package/dist/wirings/gateway/gateway.types.d.ts +2 -1
  244. package/dist/wirings/http/http-runner.d.ts +1 -1
  245. package/dist/wirings/http/http-runner.js +1 -1
  246. package/dist/wirings/http/http.types.d.ts +2 -2
  247. package/dist/wirings/http/index.d.ts +1 -0
  248. package/dist/wirings/http/index.js +1 -0
  249. package/dist/wirings/http/pikku-fetch-http-request.js +1 -1
  250. package/dist/wirings/http/pikku-fetch-http-response.js +2 -2
  251. package/dist/wirings/mcp/mcp.types.d.ts +1 -1
  252. package/dist/wirings/persona/index.d.ts +1 -1
  253. package/dist/wirings/persona/index.js +1 -1
  254. package/dist/wirings/persona/persona.types.d.ts +14 -0
  255. package/dist/wirings/queue/queue.types.d.ts +1 -1
  256. package/dist/wirings/queue/signed-queue-service.d.ts +1 -1
  257. package/dist/wirings/rpc/index.d.ts +0 -6
  258. package/dist/wirings/rpc/index.js +0 -3
  259. package/dist/wirings/rpc/remote-addon-auth.d.ts +1 -1
  260. package/dist/wirings/rpc/remote-addon-auth.js +1 -1
  261. package/dist/wirings/rpc/rpc-runner.d.ts +1 -1
  262. package/dist/wirings/rpc/rpc-runner.js +4 -4
  263. package/dist/wirings/rpc/rpc-types.d.ts +1 -1
  264. package/dist/wirings/rpc/wire-addon.d.ts +1 -1
  265. package/dist/wirings/scheduler/scheduler.types.d.ts +2 -1
  266. package/dist/wirings/scope/index.d.ts +1 -0
  267. package/dist/wirings/scope/index.js +1 -0
  268. package/dist/wirings/secret/secret.types.d.ts +10 -0
  269. package/dist/wirings/secret/validate-secret-definitions.js +2 -0
  270. package/dist/wirings/variable/validate-variable-definitions.js +2 -0
  271. package/dist/wirings/variable/variable.types.d.ts +9 -0
  272. package/dist/wirings/virtual-user/index.d.ts +1 -1
  273. package/dist/wirings/virtual-user/index.js +1 -1
  274. package/dist/wirings/virtual-user/prepare-virtual-user-run.d.ts +1 -1
  275. package/dist/wirings/virtual-user/prepare-virtual-user-run.js +1 -1
  276. package/dist/wirings/virtual-user/virtual-user-agents.d.ts +1 -1
  277. package/dist/wirings/virtual-user/virtual-user-derive.d.ts +1 -1
  278. package/dist/wirings/workflow/graph/graph-node.d.ts +9 -2
  279. package/dist/wirings/workflow/graph/graph-node.js +2 -0
  280. package/dist/wirings/workflow/graph/graph-runner.d.ts +1 -0
  281. package/dist/wirings/workflow/graph/graph-runner.js +283 -31
  282. package/dist/wirings/workflow/graph/workflow-graph.types.d.ts +16 -1
  283. package/dist/wirings/workflow/index.d.ts +2 -0
  284. package/dist/wirings/workflow/index.js +1 -0
  285. package/dist/wirings/workflow/pikku-scenario-service.d.ts +14 -4
  286. package/dist/wirings/workflow/pikku-scenario-service.js +44 -16
  287. package/dist/wirings/workflow/pikku-workflow-service.d.ts +2 -1
  288. package/dist/wirings/workflow/pikku-workflow-service.js +3 -4
  289. package/dist/wirings/workflow/run-timeline.d.ts +2 -3
  290. package/dist/wirings/workflow/scenario-run.types.d.ts +171 -0
  291. package/dist/wirings/workflow/scenario-run.types.js +1 -0
  292. package/dist/wirings/workflow/scenario-step-guards.d.ts +1 -2
  293. package/dist/wirings/workflow/scenario-step-guards.js +0 -8
  294. package/dist/wirings/workflow/scenario-step.types.d.ts +27 -12
  295. package/dist/wirings/workflow/workflow-approval.js +2 -1
  296. package/dist/wirings/workflow/workflow-run-engine.types.d.ts +2 -1
  297. package/dist/wirings/workflow/workflow.types.d.ts +2 -1
  298. package/knowledge/decisions/index.md +2 -0
  299. package/knowledge/decisions/internals/{a-non-streaming-agent-run-registers-with-airunstate-too.md → a-non-streaming-agent-run-registers-with-agentrunstate-too.md} +6 -6
  300. package/knowledge/decisions/internals/a-resumed-agent-turn-is-as-interruptible-as-the-first.md +1 -1
  301. package/knowledge/decisions/internals/a-scenario-step-template-is-offered-unfilled.md +1 -1
  302. package/knowledge/decisions/internals/a-secret-that-fails-to-decrypt-fails-the-whole-read.md +1 -1
  303. package/knowledge/decisions/internals/a-virtual-user-run-is-not-a-workflow-and-not-a-queued-job.md +2 -2
  304. package/knowledge/decisions/internals/a-wall-clock-threshold-is-a-load-test-in-disguise.md +6 -6
  305. package/knowledge/decisions/internals/a-workflow-wire-is-built-from-the-run-not-from-the-rpc-service.md +1 -1
  306. package/knowledge/decisions/internals/actor-flow-drives-the-target-through-a-transport-seam.md +1 -1
  307. package/knowledge/decisions/internals/addon-singleton-services-are-cached-per-namespace-not-per-package.md +1 -1
  308. package/knowledge/decisions/internals/addon-workflow-names-are-prefixed-with-the-consumer-namespace.md +1 -1
  309. package/knowledge/decisions/internals/{ai-agent-agui-bridge-obeys-the-client-ordering-contract.md → agent-agui-bridge-obeys-the-client-ordering-contract.md} +5 -5
  310. package/knowledge/decisions/internals/{ai-agent-audio-chunks-carry-the-format-the-provider-returned.md → agent-audio-chunks-carry-the-format-the-provider-returned.md} +2 -2
  311. package/knowledge/decisions/internals/agent-context-waits-for-a-tool-result-still-being-written.md +1 -1
  312. package/knowledge/decisions/internals/{ai-agent-credential-suspensions-hide-the-tool-result.md → agent-credential-suspensions-hide-the-tool-result.md} +2 -2
  313. package/knowledge/decisions/internals/{ai-agent-delegate-and-supervise-hide-different-text.md → agent-delegate-and-supervise-hide-different-text.md} +4 -4
  314. package/knowledge/decisions/internals/{ai-agent-llm-tool-arguments-have-nulls-stripped.md → agent-llm-tool-arguments-have-nulls-stripped.md} +3 -3
  315. package/knowledge/decisions/internals/{ai-agent-model-config-stays-a-single-resolution-seam.md → agent-model-config-stays-a-single-resolution-seam.md} +3 -3
  316. package/knowledge/decisions/internals/{ai-agent-onerror-hooks-cannot-change-the-failure.md → agent-onerror-hooks-cannot-change-the-failure.md} +6 -6
  317. package/knowledge/decisions/internals/{ai-agent-runner-methods-must-keep-their-receiver.md → agent-runner-methods-must-keep-their-receiver.md} +4 -4
  318. package/knowledge/decisions/internals/agent-speech-travels-as-a-custom-agui-event.md +1 -1
  319. package/knowledge/decisions/internals/{ai-agent-stream-persistence-is-best-effort.md → agent-stream-persistence-is-best-effort.md} +4 -4
  320. package/knowledge/decisions/internals/{ai-agent-sub-agents-inherit-the-parent-context-block.md → agent-sub-agents-inherit-the-parent-context-block.md} +3 -3
  321. package/knowledge/decisions/internals/{ai-agent-tool-execute-failures-are-logged-unconditionally.md → agent-tool-execute-failures-are-logged-unconditionally.md} +3 -3
  322. package/knowledge/decisions/internals/{ai-agent-voice-input-transcribes-audio-parts-in-place.md → agent-voice-input-transcribes-audio-parts-in-place.md} +2 -2
  323. package/knowledge/decisions/internals/{ai-agent-working-memory-is-persisted-only-when-valid.md → agent-working-memory-is-persisted-only-when-valid.md} +2 -2
  324. package/knowledge/decisions/internals/an-addon-scope-root-loses-to-a-root-the-host-already-declares.md +1 -1
  325. package/knowledge/decisions/internals/an-agent-interrupt-is-not-a-failure.md +2 -2
  326. package/knowledge/decisions/internals/an-agent-run-owned-by-another-instance-says-so.md +3 -3
  327. package/knowledge/decisions/internals/an-agent-stream-send-must-return-the-inner-sends-promise.md +2 -2
  328. package/knowledge/decisions/internals/an-empty-text-part-is-omitted-from-an-agent-message.md +1 -1
  329. package/knowledge/decisions/internals/an-empty-transcript-is-not-recorded.md +1 -1
  330. package/knowledge/decisions/internals/channel-message-handlers-accept-three-config-shapes.md +1 -1
  331. package/knowledge/decisions/internals/channel-middleware-caches-only-statically-resolved-middleware.md +1 -1
  332. package/knowledge/decisions/internals/channel-user-id-is-persisted-after-onconnect-middleware-runs.md +1 -1
  333. package/knowledge/decisions/internals/cli-option-names-are-camelcase-in-state-and-kebab-on-the-command-line.md +1 -1
  334. package/knowledge/decisions/internals/cli-parse-errors-are-routed-by-message-prefix.md +1 -1
  335. package/knowledge/decisions/internals/cli-unknown-long-options-warn-instead-of-failing.md +1 -1
  336. package/knowledge/decisions/internals/core-column-form-is-an-axis-of-its-own.md +4 -4
  337. package/knowledge/decisions/internals/core-data-classification-brand-is-an-optional-property.md +1 -1
  338. package/knowledge/decisions/internals/core-function-runner-restores-the-wire-fields-it-overwrites.md +3 -3
  339. package/knowledge/decisions/internals/core-hot-reload-merges-generated-meta-never-replaces-it.md +2 -2
  340. package/knowledge/decisions/internals/core-hot-reload-owns-its-module-registry.md +2 -2
  341. package/knowledge/decisions/internals/core-middleware-order-is-scope-then-priority.md +1 -1
  342. package/knowledge/decisions/internals/core-schema-defaults-apply-on-every-transport.md +1 -1
  343. package/knowledge/decisions/internals/core-scopes-are-an-and-gate-separate-from-permissions.md +3 -3
  344. package/knowledge/decisions/internals/gateway-adapters-resolve-lazily-and-are-promise-cached.md +1 -1
  345. package/knowledge/decisions/internals/gateway-listener-middleware-runs-without-an-rpc-on-the-wire.md +4 -4
  346. package/knowledge/decisions/internals/gateway-wiring-is-a-meta-wiring-over-http-and-channels.md +1 -1
  347. package/knowledge/decisions/internals/http-router-matches-normalized-paths-but-returns-registered-ones.md +1 -1
  348. package/knowledge/decisions/internals/in-a-scenario-a-4xx-is-data-not-an-exception.md +1 -1
  349. package/knowledge/decisions/internals/in-memory-workflow-history-aliases-the-live-step-object.md +1 -1
  350. package/knowledge/decisions/internals/index.md +4 -2
  351. package/knowledge/decisions/internals/istanbul-statement-counts-attach-to-the-start-line-only.md +1 -1
  352. package/knowledge/decisions/internals/one-project-shape-check-two-validators.md +1 -1
  353. package/knowledge/decisions/internals/queue-jobs-always-carry-an-explicit-attempts-count.md +1 -1
  354. package/knowledge/decisions/internals/remote-addons-dispatch-over-http-instead-of-local-meta.md +1 -1
  355. package/knowledge/decisions/internals/rpc-names-resolve-through-package-scope-before-root.md +1 -1
  356. package/knowledge/decisions/internals/scenario-given-and-when-are-sugar-but-then-is-not.md +2 -2
  357. package/knowledge/decisions/internals/scenarios-live-in-files-named-for-them.md +5 -5
  358. package/knowledge/decisions/internals/speech-synthesis-picks-a-voice-per-sentence-and-warns-once.md +1 -1
  359. package/knowledge/decisions/internals/the-actor-prompt-says-json-because-of-json-object-mode.md +1 -1
  360. package/knowledge/decisions/internals/the-agent-done-event-goes-through-the-middleware-and-is-awaited.md +1 -1
  361. package/knowledge/decisions/internals/the-api-report-pins-members-not-just-names.md +1 -1
  362. package/knowledge/decisions/internals/the-ecosystem-entry-point-carries-the-adapter-surface.md +43 -19
  363. package/knowledge/decisions/internals/the-embedding-model-is-pinned-per-service-and-doc-query-embedding-is-split.md +1 -1
  364. package/knowledge/decisions/internals/the-per-invocation-rpc-view-is-a-class.md +5 -5
  365. package/knowledge/decisions/internals/the-persona-runtime-is-exported-from-the-persona-entry-point.md +1 -1
  366. package/knowledge/decisions/internals/the-transcript-event-is-sent-ahead-of-the-run.md +2 -2
  367. package/knowledge/decisions/internals/the-worker-disposition-is-the-one-that-is-not-testing.md +1 -1
  368. package/knowledge/decisions/internals/thread-history-records-the-transcript-not-the-audio.md +2 -2
  369. package/knowledge/decisions/internals/validate-runs-checks-by-precondition.md +3 -3
  370. package/knowledge/decisions/internals/virtual-user-step-order-comes-from-insertion-order.md +1 -1
  371. package/knowledge/decisions/internals/voice-output-speaks-unless-voice-input-explicitly-says-otherwise.md +1 -1
  372. package/knowledge/decisions/internals/webhook-delivery-history-records-every-attempt-best-effort.md +1 -1
  373. package/knowledge/decisions/internals/wiring-registries-erase-the-generics-their-wire-functions-capture.md +1 -1
  374. package/knowledge/decisions/internals/workflow-approval-expiry-is-decided-from-a-recorded-deadline.md +1 -1
  375. package/knowledge/decisions/internals/workflow-core-never-imports-a-browser-driver.md +1 -1
  376. package/knowledge/decisions/internals/workflow-inline-runs-report-their-run-id-before-they-can-fail.md +1 -1
  377. package/knowledge/decisions/internals/workflow-invocation-id-is-the-dedupe-key-not-step-id.md +1 -1
  378. package/knowledge/decisions/internals/workflow-run-capabilities-are-extensions-not-subclasses.md +1 -1
  379. package/knowledge/decisions/internals/workflow-run-timeline-is-a-pure-fold-over-durable-history.md +1 -1
  380. package/knowledge/decisions/internals/workflow-scenario-assertions-never-retry-and-record-one-step.md +9 -5
  381. package/knowledge/decisions/internals/workflow-scenario-hooks-are-a-scenario-only-affordance.md +1 -1
  382. package/knowledge/decisions/internals/workflow-step-rpc-name-is-provenance-only.md +2 -2
  383. package/knowledge/decisions/internals/workflow-suspend-and-approval-reasons-are-durable-step-identities.md +1 -1
  384. package/knowledge/decisions/security/a-function-never-receives-the-secret-service.md +1 -1
  385. package/knowledge/decisions/security/a-step-runs-the-function-the-workflow-dispatched-it-with.md +1 -1
  386. package/knowledge/decisions/security/a-virtual-user-is-never-offered-a-step-that-would-forge-its-own-oracle.md +2 -3
  387. package/knowledge/decisions/security/actor-sign-in-is-proven-by-set-cookie-not-a-non-empty-jar.md +1 -1
  388. package/knowledge/decisions/security/addon-auth-and-tags-only-tighten.md +1 -1
  389. package/knowledge/decisions/security/{ai-agent-approval-forwarding-requires-a-symbol-brand.md → agent-approval-forwarding-requires-a-symbol-brand.md} +3 -3
  390. package/knowledge/decisions/security/{ai-agent-credential-requests-are-symbol-branded.md → agent-credential-requests-are-symbol-branded.md} +4 -4
  391. package/knowledge/decisions/security/{ai-agent-gate-requires-a-session-only-when-auth-is-true.md → agent-gate-requires-a-session-only-when-auth-is-true.md} +4 -4
  392. package/knowledge/decisions/security/{ai-agent-ownership-failures-never-echo-the-resource.md → agent-ownership-failures-never-echo-the-resource.md} +2 -2
  393. package/knowledge/decisions/security/{ai-agent-resume-re-runs-the-authorization-gate.md → agent-resume-re-runs-the-authorization-gate.md} +4 -4
  394. package/knowledge/decisions/security/{ai-agent-sessionless-deployments-have-no-thread-ownership.md → agent-sessionless-deployments-have-no-thread-ownership.md} +5 -5
  395. package/knowledge/decisions/security/{ai-agent-thread-ownership-composes-the-session-principal.md → agent-thread-ownership-composes-the-session-principal.md} +2 -2
  396. package/knowledge/decisions/security/{ai-agent-tool-filtering-reads-the-live-function-config.md → agent-tool-filtering-reads-the-live-function-config.md} +2 -2
  397. package/knowledge/decisions/security/an-agent-approval-is-claimed-before-the-tool-runs.md +3 -3
  398. package/knowledge/decisions/security/an-approval-answer-outlives-the-run-it-answered.md +3 -3
  399. package/knowledge/decisions/security/an-empty-owners-constraint-matches-nothing.md +3 -3
  400. package/knowledge/decisions/security/console-addon-privileged-functions-gate-themselves.md +21 -13
  401. package/knowledge/decisions/security/core-safe-fetch-blocks-ssrf-by-host-literal-not-dns.md +1 -1
  402. package/knowledge/decisions/security/gateway-middleware-sessions-must-be-bridged-onto-the-wire.md +2 -2
  403. package/knowledge/decisions/security/global-permissions-and-function-permissions-are-independent-gates.md +1 -1
  404. package/knowledge/decisions/security/http-request-bodies-are-bounded-before-they-are-buffered.md +2 -2
  405. package/knowledge/decisions/security/index.md +3 -2
  406. package/knowledge/decisions/security/mcp-internal-error-details-are-double-gated-on-production.md +1 -1
  407. package/knowledge/decisions/security/queue-jobs-carry-the-producers-pikku-user-id.md +3 -3
  408. package/knowledge/decisions/security/remote-addon-tokens-are-client-credentials-not-mesh-trust.md +1 -1
  409. package/knowledge/decisions/security/scaffold-features-are-authenticated-unless-opted-out.md +2 -2
  410. package/knowledge/decisions/security/self-authentication-is-declared-not-detected.md +1 -1
  411. package/knowledge/decisions/security/signed-content-urls-bind-the-request-path.md +2 -2
  412. package/knowledge/index.md +3 -1
  413. package/knowledge/questions/channel-middleware-accepts-bare-factories-that-nothing-resolves.md +1 -1
  414. package/knowledge/questions/index.md +2 -0
  415. package/package.json +16 -14
  416. package/run-tests.sh +0 -0
  417. package/scripts/generate-api-report.d.mts +1 -1
  418. package/scripts/generate-api-report.mjs +67 -60
  419. package/scripts/generate-api-report.mts +37 -47
  420. package/src/agent-naming.test.ts +68 -0
  421. package/src/api-report.test.ts +70 -1
  422. package/src/app-alias-surface.test.ts +179 -0
  423. package/src/app-leaf-surface.test.ts +217 -0
  424. package/src/bootstrap-compat/root.ts +20 -0
  425. package/src/{column-form.test.ts → classification/column-form.test.ts} +2 -2
  426. package/src/{data-classification.ts → classification/data-classification.ts} +1 -5
  427. package/src/classification/index.ts +38 -0
  428. package/src/{secret-value.test.ts → classification/secret-value.test.ts} +2 -2
  429. package/src/{secret-value.ts → classification/secret-value.ts} +1 -6
  430. package/src/crypto-utils.ts +1 -1
  431. package/src/dev/reload-meta.test.ts +1 -1
  432. package/src/errors/index.ts +9 -0
  433. package/src/errors/serialized-error.ts +9 -0
  434. package/src/factory-functions.test.ts +4 -2
  435. package/src/function/function-meta.types.ts +151 -0
  436. package/src/function/function-runner.test.ts +4 -2
  437. package/src/function/function-runner.ts +47 -14
  438. package/src/function/functions.types.ts +11 -7
  439. package/src/function/index.ts +24 -5
  440. package/src/function/list.types.ts +1 -3
  441. package/src/middleware/auth-apikey.ts +4 -2
  442. package/src/middleware/auth-bearer.test.ts +1 -1
  443. package/src/middleware/auth-bearer.ts +4 -2
  444. package/src/middleware/auth-cookie.ts +4 -1
  445. package/src/middleware/cors.test.ts +126 -5
  446. package/src/middleware/cors.ts +19 -8
  447. package/src/middleware/index.ts +16 -0
  448. package/src/middleware/middleware-factories.ts +62 -0
  449. package/src/middleware/middleware.types.ts +61 -0
  450. package/src/middleware/remote-auth.test.ts +1 -1
  451. package/src/middleware/remote-auth.ts +1 -1
  452. package/src/middleware/telemetry.ts +4 -2
  453. package/src/middleware-runner.test.ts +2 -3
  454. package/src/middleware-runner.ts +2 -2
  455. package/src/no-root-barrel.test.ts +114 -0
  456. package/src/permissions.ts +2 -4
  457. package/src/pikku-state.ts +6 -4
  458. package/src/public-surface.json +90 -170
  459. package/src/public-surface.json.README +20 -2
  460. package/src/public-surface.test.ts +31 -3
  461. package/src/remote.test.ts +1 -1
  462. package/src/removed-legacy-exports.test.ts +5 -1
  463. package/src/services/{ai-run-state-service.ts → agent-run-state-service.ts} +5 -5
  464. package/src/services/{ai-agent-runner-service.ts → agent-runner-service.ts} +18 -18
  465. package/src/services/{ai-storage-service.ts → agent-storage-service.ts} +7 -7
  466. package/src/services/audit-service.ts +1 -1
  467. package/src/services/credential-wire-service.ts +1 -1
  468. package/src/services/email-service.ts +2 -4
  469. package/src/services/file-scenario-run-store.test.ts +349 -0
  470. package/src/services/file-scenario-run-store.ts +282 -0
  471. package/src/services/http-personas-converse.test.ts +3 -3
  472. package/src/services/http-personas.ts +4 -4
  473. package/src/services/{in-memory-ai-run-state-service.ts → in-memory-agent-run-state-service.ts} +7 -7
  474. package/src/services/in-memory-workflow-service.ts +1 -1
  475. package/src/services/index.ts +22 -10
  476. package/src/services/local-content-request-handler.ts +1 -2
  477. package/src/services/local-secrets.ts +1 -1
  478. package/src/services/logger.ts +7 -7
  479. package/src/services/meta-service.ts +5 -5
  480. package/src/services/queue-webhook-service.test.ts +1 -1
  481. package/src/services/scoped-secret-service.ts +1 -1
  482. package/src/services/secret-service.ts +1 -1
  483. package/src/services/typed-secret-service.test.ts +52 -0
  484. package/src/services/typed-secret-service.ts +26 -2
  485. package/src/services/webhook-service.ts +1 -1
  486. package/src/services/workflow-service.ts +2 -1
  487. package/src/template-alias-surface.test.ts +240 -0
  488. package/src/testing/index.ts +1 -0
  489. package/src/testing/service-tests/agent-run-service-tests.ts +4 -4
  490. package/src/testing/service-tests/{ai-storage-service-tests.ts → agent-storage-service-tests.ts} +8 -8
  491. package/src/testing/service-tests.ts +10 -8
  492. package/src/types/core.types.ts +40 -292
  493. package/src/types/index.ts +2 -0
  494. package/src/types/state.types.ts +12 -14
  495. package/src/types/typed-credentials.test.ts +72 -0
  496. package/src/utils.ts +34 -0
  497. package/src/wirings/actor-flow/run-conversation.test.ts +2 -2
  498. package/src/wirings/actor-flow/run-conversation.ts +7 -9
  499. package/src/wirings/{rpc → addon}/addon-scopes.test.ts +1 -1
  500. package/src/wirings/addon/index.ts +12 -0
  501. package/src/wirings/{rpc → addon}/remote-addon-auth.ts +4 -1
  502. package/src/wirings/{rpc → addon}/wire-addon.ts +37 -2
  503. package/src/wirings/{ai-agent/ai-agent-agui.test.ts → agent/agent-agui.test.ts} +126 -105
  504. package/src/wirings/{ai-agent/ai-agent-agui.ts → agent/agent-agui.ts} +7 -7
  505. package/src/wirings/{ai-agent/ai-agent-authorization.test.ts → agent/agent-authorization.test.ts} +6 -6
  506. package/src/wirings/{ai-agent/ai-agent-finalize.test.ts → agent/agent-finalize.test.ts} +17 -16
  507. package/src/wirings/{ai-agent/ai-agent-finalize.ts → agent/agent-finalize.ts} +22 -22
  508. package/src/wirings/{ai-agent/ai-agent-helpers.test.ts → agent/agent-helpers.test.ts} +1 -1
  509. package/src/wirings/{ai-agent/ai-agent-helpers.ts → agent/agent-helpers.ts} +1 -1
  510. package/src/wirings/{ai-agent/ai-agent-interrupt.test.ts → agent/agent-interrupt.test.ts} +67 -77
  511. package/src/wirings/{ai-agent/ai-agent-interrupt.ts → agent/agent-interrupt.ts} +5 -5
  512. package/src/wirings/{ai-agent/ai-agent-memory.test.ts → agent/agent-memory.test.ts} +12 -12
  513. package/src/wirings/{ai-agent/ai-agent-memory.ts → agent/agent-memory.ts} +36 -36
  514. package/src/wirings/{ai-agent/ai-agent-model-config.test.ts → agent/agent-model-config.test.ts} +2 -5
  515. package/src/wirings/{ai-agent/ai-agent-model-config.ts → agent/agent-model-config.ts} +1 -1
  516. package/src/wirings/{ai-agent/ai-agent-prepare.test.ts → agent/agent-prepare.test.ts} +18 -18
  517. package/src/wirings/{ai-agent/ai-agent-prepare.ts → agent/agent-prepare.ts} +60 -56
  518. package/src/wirings/{ai-agent/ai-agent-registry.test.ts → agent/agent-registry.test.ts} +49 -43
  519. package/src/wirings/{ai-agent/ai-agent-registry.ts → agent/agent-registry.ts} +14 -14
  520. package/src/wirings/{ai-agent/ai-agent-resume-authorization.test.ts → agent/agent-resume-authorization.test.ts} +18 -18
  521. package/src/wirings/{ai-agent → agent}/agent-rpc.ts +16 -20
  522. package/src/wirings/{ai-agent/ai-agent-runner.test.ts → agent/agent-runner.test.ts} +105 -106
  523. package/src/wirings/{ai-agent/ai-agent-runner.ts → agent/agent-runner.ts} +91 -82
  524. package/src/wirings/{ai-agent/ai-agent-stream-output-hooks.test.ts → agent/agent-stream-output-hooks.test.ts} +25 -25
  525. package/src/wirings/{ai-agent/ai-agent-stream.test.ts → agent/agent-stream.test.ts} +147 -143
  526. package/src/wirings/{ai-agent/ai-agent-stream.ts → agent/agent-stream.ts} +148 -148
  527. package/src/wirings/{ai-agent/ai-agent-thread-ownership.test.ts → agent/agent-thread-ownership.test.ts} +24 -28
  528. package/src/wirings/{ai-agent/ai-agent-turn.test.ts → agent/agent-turn.test.ts} +3 -5
  529. package/src/wirings/{ai-agent/ai-agent-turn.ts → agent/agent-turn.ts} +7 -7
  530. package/src/wirings/agent/agent-utils.ts +20 -0
  531. package/src/wirings/{ai-agent/ai-agent.types.ts → agent/agent.types.ts} +54 -51
  532. package/src/wirings/agent/index.ts +57 -0
  533. package/src/wirings/{ai-agent → agent}/voice-input.test.ts +15 -15
  534. package/src/wirings/{ai-agent → agent}/voice-input.ts +11 -11
  535. package/src/wirings/{ai-agent → agent}/voice-output.test.ts +25 -27
  536. package/src/wirings/{ai-agent → agent}/voice-output.ts +11 -11
  537. package/src/wirings/{ai-scorer/ai-scorer-grade.test.ts → agent-scorer/agent-scorer-grade.test.ts} +8 -8
  538. package/src/wirings/{ai-scorer/ai-scorer-grade.ts → agent-scorer/agent-scorer-grade.ts} +9 -9
  539. package/src/wirings/agent-scorer/agent-scorer-judge.test.ts +285 -0
  540. package/src/wirings/agent-scorer/agent-scorer-judge.ts +180 -0
  541. package/src/wirings/{ai-scorer/ai-scorer-live.test.ts → agent-scorer/agent-scorer-live.test.ts} +11 -11
  542. package/src/wirings/{ai-scorer/ai-scorer-live.ts → agent-scorer/agent-scorer-live.ts} +3 -3
  543. package/src/wirings/{ai-scorer/ai-scorer-registry.ts → agent-scorer/agent-scorer-registry.ts} +11 -8
  544. package/src/wirings/{ai-scorer/ai-scorer-sampling.test.ts → agent-scorer/agent-scorer-sampling.test.ts} +1 -1
  545. package/src/wirings/{ai-scorer/ai-scorer-snapshots.test.ts → agent-scorer/agent-scorer-snapshots.test.ts} +2 -2
  546. package/src/wirings/{ai-scorer/ai-scorer-snapshots.ts → agent-scorer/agent-scorer-snapshots.ts} +1 -1
  547. package/src/wirings/{ai-scorer/ai-scorer-worker.test.ts → agent-scorer/agent-scorer-worker.test.ts} +15 -15
  548. package/src/wirings/{ai-scorer/ai-scorer-worker.ts → agent-scorer/agent-scorer-worker.ts} +9 -7
  549. package/src/wirings/{ai-scorer/ai-scorer.ts → agent-scorer/agent-scorer.ts} +15 -7
  550. package/src/wirings/{ai-scorer/ai-scorer.types.ts → agent-scorer/agent-scorer.types.ts} +27 -6
  551. package/src/wirings/agent-scorer/index.ts +23 -0
  552. package/src/wirings/channel/channel-common.ts +4 -2
  553. package/src/wirings/channel/channel-handler.ts +2 -5
  554. package/src/wirings/channel/channel-middleware-runner.ts +1 -1
  555. package/src/wirings/channel/channel-rpc.types.ts +3 -7
  556. package/src/wirings/channel/channel.types.ts +1 -2
  557. package/src/wirings/channel/local/local-channel-runner.test.ts +1 -2
  558. package/src/wirings/channel/serverless/index.ts +1 -0
  559. package/src/wirings/cli/channel/cli-raw-channel-runner.ts +2 -2
  560. package/src/wirings/cli/channel/index.ts +1 -3
  561. package/src/wirings/cli/cli-runner.test.ts +1 -1
  562. package/src/wirings/cli/cli-runner.ts +11 -7
  563. package/src/wirings/cli/cli.types.ts +24 -3
  564. package/src/wirings/cli/command-parser.test.ts +388 -1
  565. package/src/wirings/cli/command-parser.ts +189 -29
  566. package/src/wirings/gateway/gateway-runner.test.ts +1 -2
  567. package/src/wirings/gateway/gateway-runner.ts +3 -6
  568. package/src/wirings/gateway/gateway.types.ts +5 -4
  569. package/src/wirings/http/http-routes.test.ts +1 -2
  570. package/src/wirings/http/http-runner-addon-ref.test.ts +238 -0
  571. package/src/wirings/http/http-runner.test.ts +3 -8
  572. package/src/wirings/http/http-runner.ts +9 -3
  573. package/src/wirings/http/http.types.ts +3 -12
  574. package/src/wirings/http/index.ts +1 -0
  575. package/src/wirings/http/pikku-fetch-http-request.ts +1 -1
  576. package/src/wirings/http/pikku-fetch-http-response.ts +3 -2
  577. package/src/wirings/mcp/mcp-runner.test.ts +1 -1
  578. package/src/wirings/mcp/mcp.types.ts +1 -2
  579. package/src/wirings/persona/index.ts +1 -4
  580. package/src/wirings/persona/persona.types.ts +14 -0
  581. package/src/wirings/queue/queue-identity.test.ts +1 -1
  582. package/src/wirings/queue/queue.types.ts +2 -6
  583. package/src/wirings/queue/signed-queue-service.ts +1 -1
  584. package/src/wirings/rpc/index.ts +0 -12
  585. package/src/wirings/rpc/rpc-runner.test.ts +4 -4
  586. package/src/wirings/rpc/rpc-runner.ts +5 -5
  587. package/src/wirings/rpc/rpc-types.ts +1 -1
  588. package/src/wirings/scheduler/scheduler.types.ts +2 -5
  589. package/src/wirings/scope/index.ts +1 -0
  590. package/src/wirings/secret/secret.types.ts +10 -0
  591. package/src/wirings/secret/validate-secret-definitions.test.ts +23 -0
  592. package/src/wirings/secret/validate-secret-definitions.ts +2 -0
  593. package/src/wirings/variable/validate-variable-definitions.test.ts +23 -0
  594. package/src/wirings/variable/validate-variable-definitions.ts +2 -0
  595. package/src/wirings/variable/variable.types.ts +9 -0
  596. package/src/wirings/virtual-user/index.ts +1 -4
  597. package/src/wirings/virtual-user/prepare-virtual-user-run.ts +2 -2
  598. package/src/wirings/virtual-user/run-virtual-user.test.ts +2 -2
  599. package/src/wirings/virtual-user/run-virtual-user.ts +3 -3
  600. package/src/wirings/virtual-user/virtual-user-agents.ts +1 -1
  601. package/src/wirings/virtual-user/virtual-user-derive.test.ts +1 -1
  602. package/src/wirings/virtual-user/virtual-user-derive.ts +1 -1
  603. package/src/wirings/virtual-user/virtual-user.types.ts +1 -5
  604. package/src/wirings/workflow/graph/graph-foreach-queued.test.ts +569 -0
  605. package/src/wirings/workflow/graph/graph-foreach.test.ts +626 -0
  606. package/src/wirings/workflow/graph/graph-node.ts +16 -1
  607. package/src/wirings/workflow/graph/graph-runner.ts +387 -61
  608. package/src/wirings/workflow/graph/workflow-graph.types.ts +28 -3
  609. package/src/wirings/workflow/index.ts +8 -0
  610. package/src/wirings/workflow/pikku-scenario-service.ts +59 -19
  611. package/src/wirings/workflow/pikku-workflow-service.ts +6 -8
  612. package/src/wirings/workflow/run-timeline.ts +2 -2
  613. package/src/wirings/workflow/scenario-expectations.test.ts +28 -13
  614. package/src/wirings/workflow/scenario-run.types.ts +186 -0
  615. package/src/wirings/workflow/scenario-step-guards.ts +1 -14
  616. package/src/wirings/workflow/scenario-step.test.ts +32 -7
  617. package/src/wirings/workflow/scenario-step.types.ts +27 -12
  618. package/src/wirings/workflow/workflow-approval-policy.test.ts +117 -47
  619. package/src/wirings/workflow/workflow-approval.ts +2 -1
  620. package/src/wirings/workflow/workflow-run-engine.types.ts +2 -1
  621. package/src/wirings/workflow/workflow.types.ts +4 -12
  622. package/src/wirings-stay-decoupled.test.ts +7 -4
  623. package/tsconfig.tsbuildinfo +1 -1
  624. package/tsconfig.type-tests.json +3 -2
  625. package/dist/testing/service-tests/ai-storage-service-tests.d.ts +0 -3
  626. package/dist/wirings/ai-agent/ai-agent-registry.d.ts +0 -16
  627. package/dist/wirings/ai-agent/ai-agent-runner.d.ts +0 -7
  628. package/dist/wirings/ai-agent/ai-agent-utils.d.ts +0 -1
  629. package/dist/wirings/ai-agent/ai-agent-utils.js +0 -1
  630. package/dist/wirings/ai-agent/index.d.ts +0 -12
  631. package/dist/wirings/ai-agent/index.js +0 -10
  632. package/dist/wirings/ai-scorer/ai-scorer-judge.d.ts +0 -17
  633. package/dist/wirings/ai-scorer/ai-scorer.types.js +0 -4
  634. package/dist/wirings/ai-scorer/index.d.ts +0 -6
  635. package/dist/wirings/ai-scorer/index.js +0 -5
  636. package/src/ecosystem.ts +0 -40
  637. package/src/index.ts +0 -255
  638. package/src/wirings/ai-agent/ai-agent-utils.ts +0 -1
  639. package/src/wirings/ai-agent/index.ts +0 -65
  640. package/src/wirings/ai-scorer/ai-scorer-judge.test.ts +0 -143
  641. package/src/wirings/ai-scorer/ai-scorer-judge.ts +0 -120
  642. package/src/wirings/ai-scorer/index.ts +0 -24
  643. /package/dist/{services/ai-agent-runner-service.js → bootstrap-compat/root.js} +0 -0
  644. /package/dist/{services/ai-run-state-service.js → classification/data-classification.js} +0 -0
  645. /package/dist/{services/ai-storage-service.js → ecosystem/gateway.js} +0 -0
  646. /package/dist/{wirings/ai-agent/ai-agent.types.js → ecosystem/node.js} +0 -0
  647. /package/dist/wirings/{ai-agent/ai-agent-helpers.js → agent/agent-helpers.js} +0 -0
  648. /package/dist/wirings/{ai-agent/ai-agent-model-config.d.ts → agent/agent-model-config.d.ts} +0 -0
  649. /package/dist/wirings/{ai-agent → agent}/agent-rpc.d.ts +0 -0
  650. /package/dist/wirings/{ai-scorer/ai-scorer-sampling.d.ts → agent-scorer/agent-scorer-sampling.d.ts} +0 -0
  651. /package/dist/wirings/{ai-scorer/ai-scorer-sampling.js → agent-scorer/agent-scorer-sampling.js} +0 -0
  652. /package/dist/wirings/{ai-scorer/ai-scorer-snapshots.js → agent-scorer/agent-scorer-snapshots.js} +0 -0
  653. /package/src/{column-form.ts → classification/column-form.ts} +0 -0
  654. /package/src/{pikku-request.test.ts → function/pikku-request.test.ts} +0 -0
  655. /package/src/{pikku-request.ts → function/pikku-request.ts} +0 -0
  656. /package/src/wirings/{rpc → addon}/addon-auth-tags.test.ts +0 -0
  657. /package/src/wirings/{rpc → addon}/addon-runner.ts +0 -0
  658. /package/src/wirings/{rpc → addon}/addon-secrets.test.ts +0 -0
  659. /package/src/wirings/{rpc → addon}/wire-addon.test.ts +0 -0
  660. /package/src/wirings/{rpc → addon}/wire-remote-addon.ts +0 -0
  661. /package/src/wirings/{ai-scorer/ai-scorer-sampling.ts → agent-scorer/agent-scorer-sampling.ts} +0 -0
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  type: decision
3
- title: An aiMiddleware onError hook cannot change how a run fails
3
+ title: An agentMiddleware onError hook cannot change how a run fails
4
4
  description: Hook throws are swallowed so observability code can never convert, mask, or replace the original error
5
- tags: ai-agent
5
+ tags: agent
6
6
  ---
7
7
 
8
- # An aiMiddleware onError hook cannot change how a run fails
8
+ # An agentMiddleware onError hook cannot change how a run fails
9
9
 
10
- Every `onError` invocation on the agent failure paths — in `streamAIAgent` and
11
- `continueAfterToolResult` (`ai-agent-stream.ts`) and in `runAIAgent` and
12
- `continueAfterToolResultSync` (`ai-agent-runner.ts`) — is wrapped in its own
10
+ Every `onError` invocation on the agent failure paths — in `streamAgent` and
11
+ `continueAfterToolResult` (`agent-stream.ts`) and in `runAgent` and
12
+ `continueAfterToolResultSync` (`agent-runner.ts`) — is wrapped in its own
13
13
  `try/catch` that discards whatever the hook throws. The run is then marked
14
14
  `failed` with the original error message, and the original error propagates.
15
15
 
@@ -2,18 +2,18 @@
2
2
  type: decision
3
3
  title: AI runner methods must be called on the runner, never as detached references
4
4
  description: Implementations use this internally, so grabbing transcribe or generateSpeech as a bare function loses the receiver and throws at runtime
5
- tags: ai-agent
5
+ tags: agent
6
6
  ---
7
7
 
8
8
  # AI runner methods must be called on the runner, never as detached references
9
9
 
10
10
  The voice middlewares in `voice-input.ts` and `voice-output.ts` invoke
11
- `aiAgentRunner.transcribe(...)` and `aiAgentRunner.generateSpeech?.(...)` as
11
+ `agentRunner.transcribe(...)` and `agentRunner.generateSpeech?.(...)` as
12
12
  method calls on the service object, and only ever test them for presence.
13
13
 
14
- `AIAgentRunnerService` is an interface implemented by classes — the reference
14
+ `AgentRunnerService` is an interface implemented by classes — the reference
15
15
  implementation's `transcribe` calls `this.getModel(...)`. Extracting the method
16
- into a local (`const { transcribe } = services.aiAgentRunner`) type-checks
16
+ into a local (`const { transcribe } = services.agentRunner`) type-checks
17
17
  cleanly and then fails at runtime with `this` undefined. The regression is
18
18
  pinned by a runner in `voice-input.test.ts` whose `transcribe` deliberately reads
19
19
  instance state through `this`.
@@ -2,7 +2,7 @@
2
2
  type: decision
3
3
  title: Agent speech travels as a CUSTOM AG-UI event rather than being dropped
4
4
  description: AG-UI has no speech event, and dropping it makes a voice agent reached over HTTP silently inaudible while the provider still bills for the audio
5
- tags: core, ai-agent
5
+ tags: core, agent
6
6
  ---
7
7
 
8
8
  # Agent speech travels as a CUSTOM AG-UI event
@@ -2,15 +2,15 @@
2
2
  type: decision
3
3
  title: Persisting an agent stream from send is best-effort and must never reject
4
4
  description: The persisting channel flushes fire-and-forget because send is synchronous; a storage failure degrades the transcript instead of killing the process
5
- tags: ai-agent
5
+ tags: agent
6
6
  ---
7
7
 
8
8
  # Persisting an agent stream from send is best-effort and must never reject
9
9
 
10
10
  `createPersistingChannel` in
11
- `packages/core/src/wirings/ai-agent/ai-agent-stream.ts` accumulates step text,
11
+ `packages/core/src/wirings/agent/agent-stream.ts` accumulates step text,
12
12
  tool calls and tool results, and writes them via `flushDetached` on the `usage`
13
- and `done` events. `AIStreamChannel.send` is synchronous, so it cannot await the
13
+ and `done` events. `AgentStreamChannel.send` is synchronous, so it cannot await the
14
14
  write. An unawaited rejection has nothing to propagate to and surfaces as an
15
15
  `unhandledRejection`, which takes the whole server process down — a model
16
16
  reusing a `toolCallId`, which is a primary key in AI storage, is enough to
@@ -18,7 +18,7 @@ trigger it. `flushDetached` therefore catches and logs, and the run carries on.
18
18
 
19
19
  The awaited `flush()` on the suspend paths (`handleApprovals`,
20
20
  `handleCredentialRequests`) is the seam that still surfaces persistence failures
21
- to a caller. The regression test lives in `ai-agent-stream.test.ts`; because the
21
+ to a caller. The regression test lives in `agent-stream.test.ts`; because the
22
22
  floating promise settles on a later macrotask, the assertion has to wait a real
23
23
  timer before checking that no `unhandledRejection` fired.
24
24
 
@@ -2,14 +2,14 @@
2
2
  type: decision
3
3
  title: A delegated sub-agent inherits the parent run's context block
4
4
  description: The sub-agent tool schema carries only message and session, so the parent's identifier block is forwarded rather than re-typed by the model
5
- tags: ai-agent
5
+ tags: agent
6
6
  ---
7
7
 
8
8
  # A delegated sub-agent inherits the parent run's context block
9
9
 
10
10
  `buildSubAgentRunInput` in
11
- `packages/core/src/wirings/ai-agent/ai-agent-prepare.ts` forwards the parent
12
- run's `AIAgentInput.context` — the "Current context" identifier block with
11
+ `packages/core/src/wirings/agent/agent-prepare.ts` forwards the parent
12
+ run's `AgentInput.context` — the "Current context" identifier block with
13
13
  organization, project and stage ids — into every delegated sub-agent run, on
14
14
  both the streaming and non-streaming paths. `buildToolDefs` threads it down as
15
15
  `parentContext` for the same reason.
@@ -2,12 +2,12 @@
2
2
  type: decision
3
3
  title: A tool's execute() failure is logged before the AI SDK swallows it
4
4
  description: Every agent tool is wrapped in a logging try/catch, because a thrown tool error otherwise becomes a conversational reply and is invisible server-side
5
- tags: ai-agent
5
+ tags: agent
6
6
  ---
7
7
 
8
8
  # A tool's execute() failure is logged before the AI SDK swallows it
9
9
 
10
- `buildToolDefs` in `packages/core/src/wirings/ai-agent/ai-agent-prepare.ts`
10
+ `buildToolDefs` in `packages/core/src/wirings/agent/agent-prepare.ts`
11
11
  wraps every tool it builds — RPC tools, sub-agent delegations and workflow tools
12
12
  alike — in a `try/catch` that logs through `singletonServices.logger` and
13
13
  rethrows.
@@ -18,7 +18,7 @@ and turns it into a conversational "tool error" reply to the model. The exceptio
18
18
  never reaches pikku's own logger, so without this wrapper a consistently failing
19
19
  tool is undiagnosable from the server side — the only symptom is an agent that
20
20
  keeps apologising. The wrapper is applied unconditionally, not only when an
21
- `aiMiddleware` `afterToolCall` hook happens to be registered.
21
+ `agentMiddleware` `afterToolCall` hook happens to be registered.
22
22
 
23
23
  **What this rules out:** folding the logging into the optional middleware
24
24
  wrapper below it, and relying on the AI SDK's own error reporting for tool
@@ -2,13 +2,13 @@
2
2
  type: decision
3
3
  title: Voice input transcribes audio parts sequentially and in place
4
4
  description: Each audio part is replaced by its text where it sat, one at a time, bounding concurrent downloads and preserving content order
5
- tags: ai-agent
5
+ tags: agent
6
6
  ---
7
7
 
8
8
  # Voice input transcribes audio parts sequentially and in place
9
9
 
10
10
  The `voiceInput` middleware in
11
- `packages/core/src/wirings/ai-agent/voice-input.ts` walks the last user
11
+ `packages/core/src/wirings/agent/voice-input.ts` walks the last user
12
12
  message's content parts in order and swaps each audio part for a text part at the
13
13
  same index, awaiting one transcription before starting the next.
14
14
 
@@ -2,13 +2,13 @@
2
2
  type: decision
3
3
  title: Working memory is persisted only when the merged value validates
4
4
  description: A failed schema check logs and drops the update rather than saving it, because invalid state poisons every later read
5
- tags: ai-agent
5
+ tags: agent
6
6
  ---
7
7
 
8
8
  # Working memory is persisted only when the merged value validates
9
9
 
10
10
  `createWorkingMemoryMiddleware` in
11
- `packages/core/src/wirings/ai-agent/ai-agent-memory.ts` parses the model's
11
+ `packages/core/src/wirings/agent/agent-memory.ts` parses the model's
12
12
  `<working_memory>` block, deep-merges it into the stored value, validates the
13
13
  merge against the agent's working-memory schema when one is declared, and calls
14
14
  `saveWorkingMemory` only if the merge is valid. An invalid merge is logged as a
@@ -24,7 +24,7 @@ permissions bug rather than a merge that dropped.
24
24
  This is a different rule from
25
25
  [scope roots may be co-declared by an addon and its host
26
26
  app](scope-roots-may-be-co-declared-by-an-addon-and-its-host-app.md): that one
27
- is about `flattenScopeDefinitions` deduping ids *within* a build where both
27
+ is about `flattenScopeDefinitions` deduping ids _within_ a build where both
28
28
  declarations are present and identical. This one is about the addon's copy never
29
29
  arriving. The consequence for addon authors is the same either way — own a root
30
30
  outright, named for the package or vendor, and nest everything under it. It is
@@ -2,7 +2,7 @@
2
2
  type: decision
3
3
  title: An interrupt is not a failure, and the non-streaming path throws rather than returning
4
4
  description: It skips the onError hooks and never becomes an errorMessage; with no partial reply to hand back, a typed throw is what distinguishes it from a provider outage
5
- tags: core, ai-agent
5
+ tags: core, agent
6
6
  ---
7
7
 
8
8
  # An interrupt is not a failure
@@ -14,7 +14,7 @@ that did not happen.
14
14
 
15
15
  The streaming and non-streaming paths then diverge, because what they can hand
16
16
  back differs. A stream has already delivered part of the reply, so it returns
17
- that fragment. `runAIAgent` has delivered nothing — there is no partial answer to
17
+ that fragment. `runAgent` has delivered nothing — there is no partial answer to
18
18
  return — so it throws a typed error instead. A caller can tell that apart from a
19
19
  provider outage, which returning an empty result would not allow.
20
20
 
@@ -2,12 +2,12 @@
2
2
  type: decision
3
3
  title: An interrupt for a run owned by another instance says so, rather than returning false
4
4
  description: A bare false is indistinguishable from "already finished", which is the one deployment shape the in-process registry cannot cover
5
- tags: core, ai-agent
5
+ tags: core, agent
6
6
  ---
7
7
 
8
8
  # An interrupt for a run owned by another instance says so
9
9
 
10
- `interruptAIAgent` resolves a run through `aiRunState`, then tries to abort it
10
+ `interruptAgent` resolves a run through `agentRunState`, then tries to abort it
11
11
  via the in-process registry. A run still marked `running` that this process has
12
12
  no abort handle for is executing on another instance.
13
13
 
@@ -19,7 +19,7 @@ the condition instead.
19
19
 
20
20
  **What this rules out:** collapsing the two outcomes into one boolean because
21
21
  the caller "only cares whether it stopped". The caller cares a great deal about
22
- the difference between *stopped* and *cannot be stopped from here*.
22
+ the difference between _stopped_ and _cannot be stopped from here_.
23
23
 
24
24
  The fix for the underlying gap is `signalRunInterrupt`, which fans the interrupt
25
25
  out over `eventHub` so every instance tries locally.
@@ -2,12 +2,12 @@
2
2
  type: decision
3
3
  title: A wrapped agent-stream send must return the inner send's promise
4
4
  description: Middleware runs asynchronously, so dropping the returned promise turns every awaited channel.send upstream into a no-op
5
- tags: core, ai-agent
5
+ tags: core, agent
6
6
  ---
7
7
 
8
8
  # A wrapped agent-stream send must return the inner send's promise
9
9
 
10
- `streamAIAgent` wraps the caller's channel so every event passes through the
10
+ `streamAgent` wraps the caller's channel so every event passes through the
11
11
  stream middleware. That wrapper's `send` returns whatever the inner `send`
12
12
  returns, and it must: the middleware chain is asynchronous, so a wrapper that
13
13
  calls the inner `send` and returns `undefined` resolves immediately while the
@@ -2,7 +2,7 @@
2
2
  type: decision
3
3
  title: A message with nothing to say carries no text part at all
4
4
  description: An attachment on its own is a real turn, and providers are entitled to reject an empty text part sitting beside it
5
- tags: core, ai-agent
5
+ tags: core, agent
6
6
  ---
7
7
 
8
8
  # A message with nothing to say carries no text part
@@ -2,7 +2,7 @@
2
2
  type: decision
3
3
  title: A transcript is recorded only when something was actually heard
4
4
  description: Recording an empty string sends a transcript event saying the user said nothing, which renders as an empty bubble rather than a pending one
5
- tags: core, ai-agent
5
+ tags: core, agent
6
6
  ---
7
7
 
8
8
  # A transcript is recorded only when something was actually heard
@@ -14,7 +14,7 @@ things a caller may put on `onMessage` or inside `onMessageWiring`:
14
14
  - a direct function config, where `onMessage.func` is a plain `Function`;
15
15
  - a wrapper, where `onMessage.func` is itself a `CorePikkuFunctionConfig` and so
16
16
  has its own nested `.func`;
17
- - a simple wrapper, which carries a plain `Function` under `func` *and* a
17
+ - a simple wrapper, which carries a plain `Function` under `func` _and_ a
18
18
  sibling `middleware` array.
19
19
 
20
20
  The `isWrapper` check tests exactly that: an object with `func`, where either
@@ -19,7 +19,7 @@ user's stream and growing memory run over run. It is therefore appended fresh on
19
19
  every call, after the cached inherited slice.
20
20
 
21
21
  The `uid` matters as much as the cache split. `processMessageHandlers` in
22
- `channel-handler.ts` builds it from the channel name *plus* the routing property
22
+ `channel-handler.ts` builds it from the channel name _plus_ the routing property
23
23
  and router value (`${name}:${routingProperty}:${routerValue}`, or
24
24
  `${name}:default`), because several message routes on one channel may point at
25
25
  the same function — a key based on the function alone would serve one route's
@@ -10,7 +10,7 @@ tags: channel
10
10
  `runChannelConnect` in
11
11
  `packages/core/src/wirings/channel/serverless/serverless-channel-runner.ts`
12
12
  reads `userSession.getPikkuUserId()` and calls `channelStore.setPikkuUserId`
13
- *after* `runChannelLifecycleWithMiddleware` has executed the `onConnect`
13
+ _after_ `runChannelLifecycleWithMiddleware` has executed the `onConnect`
14
14
  lifecycle, not before.
15
15
 
16
16
  Auth middleware runs as part of that lifecycle — it is what inspects the upgrade
@@ -19,7 +19,7 @@ the conversion happens. The parser normalises every incoming `--from-plan` to
19
19
  `fromPlan` on the way in, and both `formatOptions` (help text) and the
20
20
  "Missing required option" / "Invalid value for" errors render back to kebab on
21
21
  the way out. `suggestOption` deliberately compares the typed string against
22
- *both* forms, so `--autoApply` and `--auto-apply` both find `autoApply`.
22
+ _both_ forms, so `--autoApply` and `--auto-apply` both find `autoApply`.
23
23
 
24
24
  **What this rules out:** storing option keys kebab-cased anywhere in CLI state or
25
25
  metadata — the schema pluck would then match nothing and every option would be
@@ -18,7 +18,7 @@ mistake (show the help text) or a value mistake (print the errors) by
18
18
  This is why the parser pushes `Missing subcommand: <path>` for a group command
19
19
  that has subcommands but no `pikkuFuncId` of its own, rather than simply
20
20
  returning the command meta and letting the runner discover it is unrunnable. The
21
- message *is* the routing signal. Rewording any of those three strings, or
21
+ message _is_ the routing signal. Rewording any of those three strings, or
22
22
  localising them, silently turns "show me the subcommands" into a raw error dump.
23
23
 
24
24
  **What this rules out:** editing those error message prefixes without updating
@@ -18,7 +18,7 @@ The reason is forward compatibility: a script or wrapper written against a newer
18
18
  command version may pass options an older installed binary does not know, and
19
19
  failing hard there turns a harmless extra flag into a broken pipeline.
20
20
  `RESERVED_OPTIONS` exempts flags the runner handles itself (`help`) from the
21
- warning. Unknown *short* flags are treated differently — they go to
21
+ warning. Unknown _short_ flags are treated differently — they go to
22
22
  `result.errors` and do fail — because a bundled short-flag cluster like `-abc`
23
23
  cannot be reliably attributed, and a typo'd short flag is far more likely than a
24
24
  version skew.
@@ -15,13 +15,13 @@ value leave the process?".
15
15
  The two axes were one field before this, with `security: 'encrypted'` sitting
16
16
  alongside `secret` as though they were alternatives. They are not, and the
17
17
  conflation made the field unanswerable: a token hash and a live bearer token are
18
- both `secret`, one must never be encrypted — the digest *is* the lookup key —
18
+ both `secret`, one must never be encrypted — the digest _is_ the lookup key —
19
19
  and the other must always be. Nothing in a single enum could tell them apart, so
20
20
  nothing could check either.
21
21
 
22
22
  ## Why `wrapped` and `sealed` rather than `encrypted`
23
23
 
24
- Sealed values *are* encrypted, so an `encrypted` member sitting beside `sealed`
24
+ Sealed values _are_ encrypted, so an `encrypted` member sitting beside `sealed`
25
25
  would be a supertype posing as a sibling, and every new column would be an
26
26
  even-odds guess. What actually separates them is who can read the value back:
27
27
  `wrapped` is symmetric and the application holds the key; `sealed` is asymmetric
@@ -64,7 +64,7 @@ it would buy nothing — feeding in the wrong string already fails at the AEAD t
64
64
  — while forcing a cast into every path that reads ciphertext out of a row or off
65
65
  the wire, which is where casts are least reviewable.
66
66
 
67
- The brand proves *provenance*, not correctness. It cannot know a value was
67
+ The brand proves _provenance_, not correctness. It cannot know a value was
68
68
  wrapped under the right key, and making it know would mean phantom-typing key
69
69
  ids per scope, which the multi-recipient path would fight constantly.
70
70
 
@@ -75,7 +75,7 @@ error. Every project predating the axis has such columns, and failing their next
75
75
  `db migrate` would be a breaking change for a diagnosis they have not had a
76
76
  chance to act on. `pikku db --fail-on-warn` is how a project opts into the
77
77
  ratchet. An explicit `form: 'plain'` silences it — that is the acknowledgement
78
- that reading the row is *meant* to yield a usable credential.
78
+ that reading the row is _meant_ to yield a usable credential.
79
79
 
80
80
  **What this rules out:** collapsing `wrapped` and `sealed` back into one
81
81
  `encrypted`; making the form brands optional (they would enforce nothing);
@@ -16,7 +16,7 @@ A required property would make a plain value unassignable to a branded column: a
16
16
  `string` could no longer be passed where `Private<string>` is expected, which
17
17
  breaks every ordinary Kysely query operand — `where('email', '=', someString)`,
18
18
  inserts, and `.set(...)`. Making it optional keeps the brand structurally present
19
- so static analysis still sees it, while letting plain values flow *in*. The
19
+ so static analysis still sees it, while letting plain values flow _in_. The
20
20
  asymmetry is the point: the brand constrains what comes out of a query, not what
21
21
  goes into one.
22
22
 
@@ -9,7 +9,7 @@ tags: core
9
9
 
10
10
  `runPikkuFunc` in `packages/core/src/function/function-runner.ts` does not build a
11
11
  fresh wire per call. Nested invocations — an RPC from inside a function, an addon
12
- sibling call, a workflow step — reuse the *same* wire object the outer transport
12
+ sibling call, a workflow step — reuse the _same_ wire object the outer transport
13
13
  created. So before it runs, the runner captures `functionId`, `audit`,
14
14
  `addonNamespace` and the property descriptor for `rpc`, overwrites them for the
15
15
  duration of this function, and restores or `delete`s them in a `finally`. Both
@@ -18,7 +18,7 @@ inner call would leave its identity on the wire and every subsequent outer step
18
18
  would be attributed to the wrong function.
19
19
 
20
20
  The same reuse is why the audit binding is re-gated inside `executeFunction`
21
- rather than trusted from `createWireServices`. The audit *gate* is per-function
21
+ rather than trusted from `createWireServices`. The audit _gate_ is per-function
22
22
  but the `auditLog` wire service is created per-transport-invocation. A nested or
23
23
  exposed-RPC call would otherwise inherit an `auditLog` built while the outer
24
24
  wire's audit config was unset (the generated `rpcCaller` declares none), and
@@ -32,7 +32,7 @@ then the auth/readonly checks, then `verifyScopes` — all of which depend only
32
32
  the session — and only then `await data()`, schema defaults, coercion, validation
33
33
  and `runPermissions`. A request denied by scope never pays to parse or validate
34
34
  its body. `rpc` is installed as a lazily-evaluating accessor that replaces itself
35
- with the resolved value on first read, capturing the *caller's* package name in
35
+ with the resolved value on first read, capturing the _caller's_ package name in
36
36
  the closure so an addon's RPCs resolve in its own namespace.
37
37
 
38
38
  **What this rules out:** dropping the save/restore blocks as duplicated
@@ -22,7 +22,7 @@ workflow job fails with `Function meta not found: pikkuWorkflowOrchestrator`.
22
22
  `dev/reload-meta.test.ts` pins this. Meta maps that only codegen ever writes
23
23
  (`http`, `rpc`, `agent`) are assigned outright.
24
24
 
25
- Two limits are inherent rather than incidental. Routes registered by a *new*
25
+ Two limits are inherent rather than incidental. Routes registered by a _new_
26
26
  `wireHTTP` file are not picked up here — those modules were never imported — which
27
27
  is why `hot-reload.ts` keeps a `postCodegenQueue` and exposes `reimportPending()`
28
28
  for the dev server to drain after codegen, so registrations that were skipped for
@@ -35,5 +35,5 @@ entry stranded until a restart.
35
35
  `pikkuState(null, 'function', 'meta', functionsMeta)` assignments on the grounds
36
36
  that codegen output is authoritative — it is authoritative only for what codegen
37
37
  emits. It also rules out folding `reimportPending()` back into the debounced
38
- reload (the whole point is that it runs *after* codegen), and dropping
38
+ reload (the whole point is that it runs _after_ codegen), and dropping
39
39
  `reconcileAddonRegistry` as dead code.
@@ -23,7 +23,7 @@ edits, and eventually OOMs a long editing session. `dev/module-runner.test.ts`
23
23
  asserts both the single-slot guarantee and bounded heap growth.
24
24
 
25
25
  Two details keep the mechanism honest. `import`s inside the user file are
26
- delegated to `createRequire`, whose resolution matches the native loader *and*
26
+ delegated to `createRequire`, whose resolution matches the native loader _and_
27
27
  returns the same live singletons (Node and Bun share the require/import cache) —
28
28
  that is what lets a reloaded file's top-level `wireHTTP` side effects mutate the
29
29
  services the running server is already using. And esbuild is invoked with no
@@ -37,6 +37,6 @@ code.
37
37
  import(url + '?t=' + Date.now())` or any fresh-URL variant, and turning
38
38
  sourcemaps back on for nicer stack traces (`filename` already anchors traces to
39
39
  the user file). It also rules out swapping `createRequire` for a fresh `import()`
40
- inside the compiled module — resolution would produce a *distinct* copy of every
40
+ inside the compiled module — resolution would produce a _distinct_ copy of every
41
41
  dependency, and the reloaded file would then wire itself into services nobody is
42
42
  serving from.
@@ -19,7 +19,7 @@ finally passed through `freezeDedupe` and cached in `middlewareCache` keyed by
19
19
  wire type and wire id.
20
20
 
21
21
  Two properties fall out of that and both are load-bearing. Because the sort is
22
- stable, priority is a coarse band and registration order breaks ties *within* a
22
+ stable, priority is a coarse band and registration order breaks ties _within_ a
23
23
  band, so declaration order still means something. And because the result is
24
24
  deduped by function identity, a middleware reachable through both a tag group and
25
25
  a direct wire registration runs exactly once — a fact several tests assert
@@ -21,7 +21,7 @@ generated TypeScript type declares as present — the worst shape a mismatch can
21
21
  take: validation permits the omission, the type promises the value, the body
22
22
  reads `undefined`.
23
23
 
24
- It is deliberately *not* gated on the `coerceDataFromSchema` flag that guards
24
+ It is deliberately _not_ gated on the `coerceDataFromSchema` flag that guards
25
25
  `coerceTopLevelDataFromSchema`. That flag is about decoding transport-encoded
26
26
  values — a query string's `"1,2"` into an array, an ISO string into a `Date` —
27
27
  and is set only by transports that need it. Defaults are a property of the
@@ -14,8 +14,8 @@ closed: a session without a `scopes` field, or no session at all, satisfies
14
14
  nothing. An empty `required` is the only thing anything satisfies.
15
15
 
16
16
  This is deliberately the opposite composition from `permissions`, whose groups OR
17
- together. Because permissions OR, adding a permission group can only *widen*
18
- access; because scopes AND, adding a scope can only *narrow* it. That is the
17
+ together. Because permissions OR, adding a permission group can only _widen_
18
+ access; because scopes AND, adding a scope can only _narrow_ it. That is the
19
19
  whole reason the two are separate mechanisms and separate code paths rather than
20
20
  one merged authorization step, and it is why a passing global or function
21
21
  permission must never be allowed to satisfy a scope.
@@ -24,7 +24,7 @@ Satisfaction itself is hierarchical, computed by `satisfyingGrants`: a grant
24
24
  matches when it is the scope itself, a plain ancestor (`admin` covers
25
25
  `admin:invoices:create`), a wildcard at or above it (`admin:*`, or the bare `*`),
26
26
  or a wildcard directly beneath it. Narrower never satisfies broader —
27
- `admin:invoices` does not grant `admin`. Core only ever *reads*
27
+ `admin:invoices` does not grant `admin`. Core only ever _reads_
28
28
  `session.scopes`; whoever builds the session populates it (better-auth's
29
29
  `mapSession` resolving through a `ScopeService`, for instance), and the runner
30
30
  never fetches. `hasScopes` is the non-throwing counterpart of `verifyScopes`, for
@@ -13,7 +13,7 @@ platform adapters (WhatsApp Cloud API, Slack, …) need both, so
13
13
  `resolveGatewayAdapter` in
14
14
  `packages/core/src/wirings/gateway/gateway-runner.ts` invokes the factory on the
15
15
  first inbound request (webhook/websocket) or on gateway start (listener). The
16
- `resolvedAdapters` WeakMap caches the *promise*, not the resolved adapter, so
16
+ `resolvedAdapters` WeakMap caches the _promise_, not the resolved adapter, so
17
17
  concurrent first requests share one construction instead of racing to build two
18
18
  adapters — which for a stateful adapter would mean two platform connections.
19
19
 
@@ -10,8 +10,8 @@ tags: core, gateway
10
10
  `runPikkuFunc` in `packages/core/src/function/function-runner.ts` attaches `rpc`
11
11
  to the invocation wire with `Object.defineProperty`, as a lazy getter that
12
12
  replaces itself on first read — and restores the previous descriptor in its
13
- `finally`. `rpc` therefore exists on a wire *only for the duration of a function
14
- invocation*. That is why `PikkuRawWire` is `Omit<PikkuWire, 'rpc'>`: it is the
13
+ `finally`. `rpc` therefore exists on a wire _only for the duration of a function
14
+ invocation_. That is why `PikkuRawWire` is `Omit<PikkuWire, 'rpc'>`: it is the
15
15
  wire as a runner constructs it, before the function runner adds `rpc`.
16
16
 
17
17
  The three gateway transports reach middleware differently:
@@ -22,7 +22,7 @@ The three gateway transports reach middleware differently:
22
22
  same invocation — `wire.rpc` is live.
23
23
  - **listener** has no such wrapper. `createListenerMessageHandler` is handed
24
24
  straight to `adapter.init()` by the `GatewayService`, builds
25
- `const wire: PikkuRawWire = {}` itself, and runs `config.middleware` *before*
25
+ `const wire: PikkuRawWire = {}` itself, and runs `config.middleware` _before_
26
26
  `invoke()` reaches `runPikkuFunc`. There is no invocation in progress, so
27
27
  `wire.rpc` is `undefined`.
28
28
 
@@ -34,7 +34,7 @@ off `CorePikkuMiddleware`, whose wire parameter is `PikkuWire`.
34
34
  **What this rules out:** treating the assertion at that call as noise to be
35
35
  deleted. It is naming a real gap. It also rules out "just widen
36
36
  `CorePikkuMiddleware` to accept `PikkuRawWire`" as a free fix — that would make
37
- `rpc` optional for *every* middleware in the framework, pushing the problem onto
37
+ `rpc` optional for _every_ middleware in the framework, pushing the problem onto
38
38
  every consumer to satisfy one transport.
39
39
 
40
40
  **Still open:** whether the listener path should wrap its handler in a
@@ -18,7 +18,7 @@ followed by `httpRouter.reset()` because the router caches its match table.
18
18
  The wrapper functions and routes created here look like they are missing their
19
19
  metadata. They are not: the inspector projects a `wireGateway` call into the
20
20
  generated HTTP and function meta at build time, so only the handler
21
- *implementations* register at runtime — the same split every other wire uses.
21
+ _implementations_ register at runtime — the same split every other wire uses.
22
22
  This is why `wireWebhookGateway` writes route entries but no `CommonWireMeta`,
23
23
  and why the websocket path sets `channels.set(name, …)` with empty
24
24
  `onConnect`/`onMessage` stubs while the real handlers live under the
@@ -11,7 +11,7 @@ tags: http
11
11
  normalizes every route and every incoming path to a leading `/` before matching,
12
12
  so a route registered as `'todos'` still answers a request for `/todos`. The
13
13
  `route` field it stores alongside each matcher and static entry is the
14
- *un-normalized* original, and that is what `MatchResult.route` returns.
14
+ _un-normalized_ original, and that is what `MatchResult.route` returns.
15
15
 
16
16
  That asymmetry is load-bearing. `getMatchingRoute` in `http-runner.ts` takes the
17
17
  returned route and uses it as a key into `pikkuState(null, 'http', 'routes')` and
@@ -12,7 +12,7 @@ tags: services
12
12
  `invoke` throws, and it throws with a truncated body — which is why a scenario
13
13
  asserting on a refusal must use `invokeRaw`.
14
14
 
15
- A permissions or scopes scenario *expects* the 403. The status is the assertion,
15
+ A permissions or scopes scenario _expects_ the 403. The status is the assertion,
16
16
  and the body usually names the scope that was missing, so both have to survive as
17
17
  data rather than being reduced to a thrown `Error`. These helpers also exist
18
18
  because every scenario reaching past an actor was hand-writing the same
@@ -9,7 +9,7 @@ tags: services
9
9
 
10
10
  `InMemoryWorkflowService` (`packages/core/src/services/in-memory-workflow-service.ts`)
11
11
  stores each step twice: in `steps`, keyed `${runId}:${stepName}`, and appended to
12
- `stepHistory` for the run. Both hold the *same object*. `createStepImpl` and
12
+ `stepHistory` for the run. Both hold the _same object_. `createStepImpl` and
13
13
  `createRetryAttemptImpl` push the reference they just put into `steps`, not a
14
14
  copy.
15
15
 
@@ -10,6 +10,7 @@ A rule about how core behaves: what runs where, in what order, and what a
10
10
  caller is entitled to assume.
11
11
 
12
12
  <!-- pikku:knowledge-index -->
13
+
13
14
  - [A non-streaming agent run registers with aiRunState on the same terms as a streaming one](a-non-streaming-agent-run-registers-with-airunstate-too.md) — Otherwise interruptAIAgent finds the run, passes the ownership check, then cannot stop it — and reports that as if the run were on another host
14
15
  - [A resumed turn is as interruptible as the first one](a-resumed-agent-turn-is-as-interruptible-as-the-first.md) — It is the same person listening to the same voice, and after an approval it is where most of the reply actually gets spoken
15
16
  - [A scenario step's prose template is offered to a virtual user unfilled](a-scenario-step-template-is-offered-unfilled.md) — 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
@@ -57,7 +58,7 @@ caller is entitled to assume.
57
58
  - [CLI stdout is reserved for machine-readable output](cli-stdout-is-reserved-for-machine-readable-output.md) — The default renderer emits single-line NDJSON, diagnostics go to stderr, and --json only hijacks rendering for commands that declared a renderer
58
59
  - [CLI unknown long options warn instead of failing](cli-unknown-long-options-warn-instead-of-failing.md) — Unrecognised --long options are accepted, warned about and dropped so older binaries tolerate newer invocations, while unknown short flags stay hard errors
59
60
  - [A column's at-rest form is an axis of its own](core-column-form-is-an-axis-of-its-own.md) — How a value is stored is independent of how sensitive it is, so form carries a required nominal brand on writes while classification stays optional on reads
60
- - [The data-classification brand is an optional property](core-data-classification-brand-is-an-optional-property.md) — Making __classification__ required would break ordinary Kysely operands, so the brand only constrains values flowing out
61
+ - [The data-classification brand is an optional property](core-data-classification-brand-is-an-optional-property.md) — Making **classification** required would break ordinary Kysely operands, so the brand only constrains values flowing out
61
62
  - [The function runner restores the wire fields it overwrites](core-function-runner-restores-the-wire-fields-it-overwrites.md) — One wire object is reused across nested calls, so functionId, audit, addonNamespace and rpc are saved and put back in a finally
62
63
  - [Hot reload merges generated meta and never replaces it](core-hot-reload-merges-generated-meta-never-replaces-it.md) — Reloading codegen output must preserve runtime-registered meta, which no generated JSON contains
63
64
  - [Hot reload owns its module registry instead of re-importing](core-hot-reload-owns-its-module-registry.md) — Dev reload transpiles to CJS and runs modules through vm.compileFunction, because the native ESM loader map cannot be evicted
@@ -103,7 +104,7 @@ caller is entitled to assume.
103
104
  - [The agent `done` event goes through the middleware and is awaited](the-agent-done-event-goes-through-the-middleware-and-is-awaited.md) — `done` is the only end-of-reply signal a stream hook gets, and buffering hooks flush on it — sending it raw discards work already paid for
104
105
  - [The API report pins members, because the export list only pins names](the-api-report-pins-members-not-just-names.md) — public-surface.json catches an export appearing or vanishing; it cannot see a method added to an interface, which is the change that breaks a consumer's build
105
106
  - [The dev queue copies prod timing and serialization semantics](the-dev-queue-copies-prod-timing-and-serialization-semantics.md) — InMemoryQueueService dispatches via setTimeout, retries with backoff, and JSON round-trips every payload so dev behaviour matches a real backend
106
- - [The ecosystem entry point carries the adapter surface, so the root can promise stability](the-ecosystem-entry-point-carries-the-adapter-surface.md) — runPikkuFunc and the singleton-service accessors are what a runtime adapter reaches for; their signatures move, and the package root should not promise otherwise
107
+ - [One door per name the ecosystem tier and the package root are both gone](the-ecosystem-entry-point-carries-the-adapter-surface.md) — the adapter surface was split onto @pikku/core/ecosystem to keep a stability promise at the root; publishing every module twice cost more than the promise was worth, so both the facades and the root barrel were deleted
107
108
  - [The embedding model is pinned per service and doc/query embedding is split](the-embedding-model-is-pinned-per-service-and-doc-query-embedding-is-split.md) — AIEmbeddingService fixes its model at construction so index and query share a vector space, and separates embedDocuments from embedQuery for asymmetric models
108
109
  - [The in-memory workflow service is inline-only and single-process](the-in-memory-workflow-service-is-inline-only-and-single-process.md) — InMemoryWorkflowService wires no queues and implements withRunLock/withStepLock as pass-throughs, because inline execution has no second holder to exclude
109
110
  - [The KEK salt is scoped to the key version, not the secret](the-kek-salt-is-scoped-to-the-key-version.md) — One stored salt per key version means N secrets cost one derivation, which is the point of envelope encryption
@@ -153,4 +154,5 @@ caller is entitled to assume.
153
154
  - [A workflow step's recorded `rpcName` is provenance only — nothing dispatches off it](workflow-step-rpc-name-is-provenance-only.md) — It exists so a reader can join a runtime step row back to the declaration that produced it, especially when the durable name was built in a loop
154
155
  - [A suspend or approval `reason` is the step's durable identity, not just a message](workflow-suspend-and-approval-reasons-are-durable-step-identities.md) — The reason is namespaced and used raw as the step key, so it must be derived deterministically across replays
155
156
  - [A suspended workflow run keeps its in-process context; only terminal runs release it](workflow-suspended-runs-keep-their-in-process-context.md) — `suspended` is absent from the terminal set on purpose, and a context is dropped only when nothing is holding it open
157
+
156
158
  <!-- /pikku:knowledge-index -->
@@ -9,7 +9,7 @@ tags: services
9
9
 
10
10
  `IstanbulCoverageService` (`packages/core/src/services/istanbul-coverage-service.ts`)
11
11
  reads instrumented counters off the `__coverage__` global and, when turning
12
- statement maps into line hits, credits each statement's count to its *start* line
12
+ statement maps into line hits, credits each statement's count to its _start_ line
13
13
  and no other line it spans.
14
14
 
15
15
  This is istanbul's own semantics, and the reason matters: statements nest. An
@@ -29,7 +29,7 @@ Two of workspace validate's own checks were not merely absent from fabric — th
29
29
  had never run anywhere:
30
30
 
31
31
  - the auth checks were gated on a middleware instance with `definitionId ===
32
- 'betterAuthSession'`, but the CLI wires `betterAuthStatelessSession` whenever
32
+ 'betterAuthSession'`, but the CLI wires `betterAuthStatelessSession` whenever
33
33
  `session.cookieCache` is on, which is the configuration Fabric asks for. So
34
34
  they skipped precisely the apps most likely to have auth.
35
35
  - they looked for migrations in `packages/functions/db/`, and for tables named