@pikku/core 0.12.83 → 0.12.84

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 (343) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +1 -1
  3. package/dist/ecosystem/agent-scorer.d.ts +12 -0
  4. package/dist/ecosystem/agent-scorer.js +5 -0
  5. package/dist/ecosystem/agent.d.ts +18 -0
  6. package/dist/ecosystem/agent.js +6 -0
  7. package/dist/ecosystem/ai-agent.d.ts +18 -0
  8. package/dist/ecosystem/ai-agent.js +6 -0
  9. package/dist/ecosystem/ai-scorer.d.ts +12 -0
  10. package/dist/ecosystem/ai-scorer.js +5 -0
  11. package/dist/ecosystem/channel/local.d.ts +1 -0
  12. package/dist/ecosystem/channel/local.js +1 -0
  13. package/dist/ecosystem/channel.d.ts +12 -0
  14. package/dist/ecosystem/channel.js +4 -0
  15. package/dist/ecosystem/cli/channel.d.ts +16 -0
  16. package/dist/ecosystem/cli/channel.js +2 -0
  17. package/dist/ecosystem/cli.d.ts +9 -0
  18. package/dist/ecosystem/cli.js +2 -0
  19. package/dist/ecosystem/credential.d.ts +9 -0
  20. package/dist/ecosystem/credential.js +1 -0
  21. package/dist/ecosystem/dev.d.ts +8 -0
  22. package/dist/ecosystem/dev.js +1 -0
  23. package/dist/ecosystem/function.d.ts +13 -0
  24. package/dist/ecosystem/function.js +2 -0
  25. package/dist/ecosystem/gateway.d.ts +1 -0
  26. package/dist/ecosystem/gateway.js +1 -0
  27. package/dist/ecosystem/hmac.d.ts +1 -0
  28. package/dist/ecosystem/hmac.js +1 -0
  29. package/dist/ecosystem/http.d.ts +11 -0
  30. package/dist/ecosystem/http.js +3 -0
  31. package/dist/ecosystem/mcp.d.ts +3 -0
  32. package/dist/ecosystem/mcp.js +2 -0
  33. package/dist/ecosystem/middleware.d.ts +17 -0
  34. package/dist/ecosystem/middleware.js +6 -0
  35. package/dist/ecosystem/node-host-resolver.d.ts +1 -0
  36. package/dist/ecosystem/node-host-resolver.js +1 -0
  37. package/dist/ecosystem/node.d.ts +1 -0
  38. package/dist/ecosystem/node.js +1 -0
  39. package/dist/ecosystem/oauth2.d.ts +1 -0
  40. package/dist/ecosystem/oauth2.js +1 -0
  41. package/dist/ecosystem/persona.d.ts +15 -0
  42. package/dist/ecosystem/persona.js +4 -0
  43. package/dist/ecosystem/queue.d.ts +11 -0
  44. package/dist/ecosystem/queue.js +2 -0
  45. package/dist/ecosystem/remote.d.ts +8 -0
  46. package/dist/ecosystem/remote.js +1 -0
  47. package/dist/ecosystem/role.d.ts +3 -0
  48. package/dist/ecosystem/role.js +2 -0
  49. package/dist/ecosystem/rpc.d.ts +4 -0
  50. package/dist/ecosystem/rpc.js +2 -0
  51. package/dist/ecosystem/safe-fetch.d.ts +7 -0
  52. package/dist/ecosystem/safe-fetch.js +1 -0
  53. package/dist/ecosystem/scenario.d.ts +15 -0
  54. package/dist/ecosystem/scenario.js +4 -0
  55. package/dist/ecosystem/scheduler.d.ts +2 -0
  56. package/dist/ecosystem/scheduler.js +1 -0
  57. package/dist/ecosystem/schema.d.ts +1 -0
  58. package/dist/ecosystem/schema.js +1 -0
  59. package/dist/ecosystem/scope.d.ts +3 -0
  60. package/dist/ecosystem/scope.js +2 -0
  61. package/dist/ecosystem/secret.d.ts +9 -0
  62. package/dist/ecosystem/secret.js +1 -0
  63. package/dist/ecosystem/services/istanbul-coverage.d.ts +1 -0
  64. package/dist/ecosystem/services/istanbul-coverage.js +1 -0
  65. package/dist/ecosystem/services/local-content-request-handler.d.ts +9 -0
  66. package/dist/ecosystem/services/local-content-request-handler.js +1 -0
  67. package/dist/ecosystem/services/local-content.d.ts +1 -0
  68. package/dist/ecosystem/services/local-content.js +1 -0
  69. package/dist/ecosystem/services/v8-coverage.d.ts +1 -0
  70. package/dist/ecosystem/services/v8-coverage.js +1 -0
  71. package/dist/ecosystem/services.d.ts +28 -0
  72. package/dist/ecosystem/services.js +6 -0
  73. package/dist/ecosystem/testing.d.ts +7 -0
  74. package/dist/ecosystem/testing.js +1 -0
  75. package/dist/ecosystem/trigger.d.ts +1 -0
  76. package/dist/ecosystem/trigger.js +1 -0
  77. package/dist/ecosystem/types.d.ts +9 -0
  78. package/dist/ecosystem/types.js +5 -0
  79. package/dist/ecosystem/variable.d.ts +8 -0
  80. package/dist/ecosystem/variable.js +1 -0
  81. package/dist/ecosystem/virtual-user.d.ts +21 -0
  82. package/dist/ecosystem/virtual-user.js +5 -0
  83. package/dist/ecosystem/workflow.d.ts +18 -0
  84. package/dist/ecosystem/workflow.js +4 -0
  85. package/dist/index.d.ts +8 -8
  86. package/dist/index.js +3 -3
  87. package/dist/middleware/auth-apikey.d.ts +1 -1
  88. package/dist/middleware/auth-bearer.d.ts +1 -1
  89. package/dist/middleware/auth-cookie.d.ts +1 -1
  90. package/dist/middleware/cors.d.ts +1 -1
  91. package/dist/middleware/remote-auth.d.ts +1 -1
  92. package/dist/middleware/telemetry.d.ts +2 -2
  93. package/dist/services/agent-run-state-service.d.ts +29 -0
  94. package/dist/services/agent-run-state-service.js +1 -0
  95. package/dist/services/agent-runner-service.d.ts +220 -0
  96. package/dist/services/agent-runner-service.js +1 -0
  97. package/dist/services/agent-storage-service.d.ts +18 -0
  98. package/dist/services/agent-storage-service.js +1 -0
  99. package/dist/services/http-personas.d.ts +1 -1
  100. package/dist/services/http-personas.js +3 -3
  101. package/dist/services/in-memory-agent-run-state-service.d.ts +19 -0
  102. package/dist/services/in-memory-agent-run-state-service.js +54 -0
  103. package/dist/services/index.d.ts +4 -4
  104. package/dist/services/index.js +1 -1
  105. package/dist/services/meta-service.d.ts +3 -3
  106. package/dist/testing/service-tests/agent-run-service-tests.d.ts +1 -1
  107. package/dist/testing/service-tests/agent-run-service-tests.js +3 -3
  108. package/dist/testing/service-tests/agent-storage-service-tests.d.ts +3 -0
  109. package/dist/testing/service-tests/agent-storage-service-tests.js +302 -0
  110. package/dist/testing/service-tests.d.ts +4 -4
  111. package/dist/testing/service-tests.js +4 -4
  112. package/dist/types/core.types.d.ts +10 -10
  113. package/dist/types/core.types.js +1 -1
  114. package/dist/types/state.types.d.ts +5 -5
  115. package/dist/wirings/actor-flow/run-conversation.d.ts +2 -2
  116. package/dist/wirings/agent/agent-agui.d.ts +79 -0
  117. package/dist/wirings/agent/agent-agui.js +327 -0
  118. package/dist/wirings/agent/agent-finalize.d.ts +58 -0
  119. package/dist/wirings/agent/agent-finalize.js +138 -0
  120. package/dist/wirings/agent/agent-helpers.d.ts +35 -0
  121. package/dist/wirings/agent/agent-helpers.js +47 -0
  122. package/dist/wirings/agent/agent-interrupt.d.ts +153 -0
  123. package/dist/wirings/agent/agent-interrupt.js +257 -0
  124. package/dist/wirings/agent/agent-memory.d.ts +42 -0
  125. package/dist/wirings/agent/agent-memory.js +333 -0
  126. package/dist/wirings/agent/agent-model-config.d.ts +16 -0
  127. package/dist/wirings/agent/agent-model-config.js +51 -0
  128. package/dist/wirings/agent/agent-prepare.d.ts +117 -0
  129. package/dist/wirings/agent/agent-prepare.js +728 -0
  130. package/dist/wirings/agent/agent-registry.d.ts +16 -0
  131. package/dist/wirings/agent/agent-registry.js +51 -0
  132. package/dist/wirings/agent/agent-rpc.d.ts +15 -0
  133. package/dist/wirings/agent/agent-rpc.js +53 -0
  134. package/dist/wirings/agent/agent-runner.d.ts +7 -0
  135. package/dist/wirings/agent/agent-runner.js +580 -0
  136. package/dist/wirings/agent/agent-stream.d.ts +41 -0
  137. package/dist/wirings/agent/agent-stream.js +1029 -0
  138. package/dist/wirings/agent/agent-turn.d.ts +57 -0
  139. package/dist/wirings/agent/agent-turn.js +82 -0
  140. package/dist/wirings/agent/agent-utils.d.ts +1 -0
  141. package/dist/wirings/agent/agent-utils.js +1 -0
  142. package/dist/wirings/agent/agent.types.d.ts +625 -0
  143. package/dist/wirings/agent/agent.types.js +1 -0
  144. package/dist/wirings/agent/index.d.ts +12 -0
  145. package/dist/wirings/agent/index.js +10 -0
  146. package/dist/wirings/agent/voice-input.d.ts +69 -0
  147. package/dist/wirings/agent/voice-input.js +150 -0
  148. package/dist/wirings/agent/voice-output.d.ts +85 -0
  149. package/dist/wirings/agent/voice-output.js +196 -0
  150. package/dist/wirings/agent-scorer/agent-scorer-grade.d.ts +26 -0
  151. package/dist/wirings/agent-scorer/agent-scorer-grade.js +33 -0
  152. package/dist/wirings/agent-scorer/agent-scorer-judge.d.ts +17 -0
  153. package/dist/wirings/agent-scorer/agent-scorer-judge.js +92 -0
  154. package/dist/wirings/agent-scorer/agent-scorer-live.d.ts +15 -0
  155. package/dist/wirings/agent-scorer/agent-scorer-live.js +38 -0
  156. package/dist/wirings/agent-scorer/agent-scorer-registry.d.ts +18 -0
  157. package/dist/wirings/agent-scorer/agent-scorer-registry.js +46 -0
  158. package/dist/wirings/agent-scorer/agent-scorer-sampling.d.ts +8 -0
  159. package/dist/wirings/agent-scorer/agent-scorer-sampling.js +31 -0
  160. package/dist/wirings/agent-scorer/agent-scorer-snapshots.d.ts +10 -0
  161. package/dist/wirings/agent-scorer/agent-scorer-snapshots.js +40 -0
  162. package/dist/wirings/agent-scorer/agent-scorer-worker.d.ts +15 -0
  163. package/dist/wirings/agent-scorer/agent-scorer-worker.js +60 -0
  164. package/dist/wirings/agent-scorer/agent-scorer.d.ts +39 -0
  165. package/dist/wirings/agent-scorer/agent-scorer.js +40 -0
  166. package/dist/wirings/agent-scorer/agent-scorer.types.d.ts +90 -0
  167. package/dist/wirings/agent-scorer/agent-scorer.types.js +4 -0
  168. package/dist/wirings/agent-scorer/index.d.ts +6 -0
  169. package/dist/wirings/agent-scorer/index.js +5 -0
  170. package/dist/wirings/ai-agent/voice-output.d.ts +1 -2
  171. package/dist/wirings/channel/channel-rpc.types.d.ts +2 -2
  172. package/dist/wirings/rpc/rpc-runner.d.ts +1 -1
  173. package/dist/wirings/rpc/rpc-runner.js +2 -2
  174. package/dist/wirings/rpc/rpc-types.d.ts +1 -1
  175. package/dist/wirings/virtual-user/prepare-virtual-user-run.js +1 -1
  176. package/dist/wirings/virtual-user/virtual-user-agents.d.ts +1 -1
  177. package/dist/wirings/workflow/run-timeline.d.ts +1 -2
  178. 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
  179. package/knowledge/decisions/internals/a-resumed-agent-turn-is-as-interruptible-as-the-first.md +1 -1
  180. package/knowledge/decisions/internals/actor-flow-drives-the-target-through-a-transport-seam.md +1 -1
  181. 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
  182. 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
  183. package/knowledge/decisions/internals/agent-context-waits-for-a-tool-result-still-being-written.md +1 -1
  184. package/knowledge/decisions/internals/{ai-agent-credential-suspensions-hide-the-tool-result.md → agent-credential-suspensions-hide-the-tool-result.md} +2 -2
  185. package/knowledge/decisions/internals/{ai-agent-delegate-and-supervise-hide-different-text.md → agent-delegate-and-supervise-hide-different-text.md} +4 -4
  186. package/knowledge/decisions/internals/{ai-agent-llm-tool-arguments-have-nulls-stripped.md → agent-llm-tool-arguments-have-nulls-stripped.md} +3 -3
  187. 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
  188. package/knowledge/decisions/internals/{ai-agent-onerror-hooks-cannot-change-the-failure.md → agent-onerror-hooks-cannot-change-the-failure.md} +6 -6
  189. package/knowledge/decisions/internals/{ai-agent-runner-methods-must-keep-their-receiver.md → agent-runner-methods-must-keep-their-receiver.md} +4 -4
  190. package/knowledge/decisions/internals/agent-speech-travels-as-a-custom-agui-event.md +1 -1
  191. package/knowledge/decisions/internals/{ai-agent-stream-persistence-is-best-effort.md → agent-stream-persistence-is-best-effort.md} +4 -4
  192. 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
  193. package/knowledge/decisions/internals/{ai-agent-tool-execute-failures-are-logged-unconditionally.md → agent-tool-execute-failures-are-logged-unconditionally.md} +3 -3
  194. 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
  195. 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
  196. package/knowledge/decisions/internals/an-agent-interrupt-is-not-a-failure.md +2 -2
  197. package/knowledge/decisions/internals/an-agent-run-owned-by-another-instance-says-so.md +3 -3
  198. package/knowledge/decisions/internals/an-agent-stream-send-must-return-the-inner-sends-promise.md +2 -2
  199. package/knowledge/decisions/internals/an-empty-text-part-is-omitted-from-an-agent-message.md +1 -1
  200. package/knowledge/decisions/internals/an-empty-transcript-is-not-recorded.md +1 -1
  201. package/knowledge/decisions/internals/speech-synthesis-picks-a-voice-per-sentence-and-warns-once.md +1 -1
  202. package/knowledge/decisions/internals/the-agent-done-event-goes-through-the-middleware-and-is-awaited.md +1 -1
  203. package/knowledge/decisions/internals/the-embedding-model-is-pinned-per-service-and-doc-query-embedding-is-split.md +1 -1
  204. package/knowledge/decisions/internals/the-per-invocation-rpc-view-is-a-class.md +5 -5
  205. package/knowledge/decisions/internals/the-transcript-event-is-sent-ahead-of-the-run.md +2 -2
  206. package/knowledge/decisions/internals/thread-history-records-the-transcript-not-the-audio.md +2 -2
  207. package/knowledge/decisions/internals/voice-output-speaks-unless-voice-input-explicitly-says-otherwise.md +1 -1
  208. package/knowledge/decisions/security/{ai-agent-approval-forwarding-requires-a-symbol-brand.md → agent-approval-forwarding-requires-a-symbol-brand.md} +3 -3
  209. package/knowledge/decisions/security/{ai-agent-credential-requests-are-symbol-branded.md → agent-credential-requests-are-symbol-branded.md} +4 -4
  210. 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} +3 -3
  211. package/knowledge/decisions/security/{ai-agent-ownership-failures-never-echo-the-resource.md → agent-ownership-failures-never-echo-the-resource.md} +2 -2
  212. package/knowledge/decisions/security/{ai-agent-resume-re-runs-the-authorization-gate.md → agent-resume-re-runs-the-authorization-gate.md} +4 -4
  213. package/knowledge/decisions/security/{ai-agent-sessionless-deployments-have-no-thread-ownership.md → agent-sessionless-deployments-have-no-thread-ownership.md} +5 -5
  214. package/knowledge/decisions/security/{ai-agent-thread-ownership-composes-the-session-principal.md → agent-thread-ownership-composes-the-session-principal.md} +2 -2
  215. 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
  216. package/knowledge/decisions/security/an-agent-approval-is-claimed-before-the-tool-runs.md +3 -3
  217. package/knowledge/decisions/security/an-empty-owners-constraint-matches-nothing.md +3 -3
  218. package/knowledge/decisions/security/console-addon-privileged-functions-gate-themselves.md +20 -13
  219. package/knowledge/decisions/security/index.md +1 -2
  220. package/package.json +4 -3
  221. package/scripts/generate-api-report.mts +32 -8
  222. package/src/agent-naming.test.ts +68 -0
  223. package/src/ecosystem/agent-scorer.ts +24 -0
  224. package/src/ecosystem/agent.ts +42 -0
  225. package/src/ecosystem/channel/local.ts +1 -0
  226. package/src/ecosystem/channel.ts +22 -0
  227. package/src/ecosystem/cli/channel.ts +25 -0
  228. package/src/ecosystem/cli.ts +21 -0
  229. package/src/ecosystem/credential.ts +10 -0
  230. package/src/ecosystem/dev.ts +12 -0
  231. package/src/ecosystem/function.ts +28 -0
  232. package/src/ecosystem/gateway.ts +4 -0
  233. package/src/ecosystem/hmac.ts +1 -0
  234. package/src/ecosystem/http.ts +22 -0
  235. package/src/ecosystem/mcp.ts +17 -0
  236. package/src/ecosystem/middleware.ts +27 -0
  237. package/src/ecosystem/node-host-resolver.ts +1 -0
  238. package/src/ecosystem/node.ts +5 -0
  239. package/src/ecosystem/oauth2.ts +4 -0
  240. package/src/ecosystem/persona.ts +30 -0
  241. package/src/ecosystem/queue.ts +23 -0
  242. package/src/ecosystem/remote.ts +9 -0
  243. package/src/ecosystem/role.ts +13 -0
  244. package/src/ecosystem/rpc.ts +7 -0
  245. package/src/ecosystem/safe-fetch.ts +8 -0
  246. package/src/ecosystem/scenario.ts +32 -0
  247. package/src/ecosystem/scheduler.ts +5 -0
  248. package/src/ecosystem/schema.ts +1 -0
  249. package/src/ecosystem/scope.ts +14 -0
  250. package/src/ecosystem/secret.ts +15 -0
  251. package/src/ecosystem/services/istanbul-coverage.ts +1 -0
  252. package/src/ecosystem/services/local-content-request-handler.ts +16 -0
  253. package/src/ecosystem/services/local-content.ts +1 -0
  254. package/src/ecosystem/services/v8-coverage.ts +1 -0
  255. package/src/ecosystem/services.ts +82 -0
  256. package/src/ecosystem/testing.ts +8 -0
  257. package/src/ecosystem/trigger.ts +7 -0
  258. package/src/ecosystem/types.ts +34 -0
  259. package/src/ecosystem/variable.ts +14 -0
  260. package/src/ecosystem/virtual-user.ts +48 -0
  261. package/src/ecosystem/workflow.ts +68 -0
  262. package/src/index.ts +8 -19
  263. package/src/pikku-state.ts +3 -3
  264. package/src/public-surface.json +173 -68
  265. package/src/public-surface.json.README +20 -2
  266. package/src/public-surface.test.ts +31 -3
  267. package/src/services/{ai-run-state-service.ts → agent-run-state-service.ts} +5 -5
  268. package/src/services/{ai-agent-runner-service.ts → agent-runner-service.ts} +18 -18
  269. package/src/services/{ai-storage-service.ts → agent-storage-service.ts} +7 -7
  270. package/src/services/http-personas-converse.test.ts +3 -3
  271. package/src/services/http-personas.ts +4 -4
  272. package/src/services/{in-memory-ai-run-state-service.ts → in-memory-agent-run-state-service.ts} +7 -7
  273. package/src/services/index.ts +9 -9
  274. package/src/services/meta-service.ts +3 -3
  275. package/src/testing/service-tests/agent-run-service-tests.ts +4 -4
  276. package/src/testing/service-tests/{ai-storage-service-tests.ts → agent-storage-service-tests.ts} +8 -8
  277. package/src/testing/service-tests.ts +10 -8
  278. package/src/types/core.types.ts +12 -12
  279. package/src/types/state.types.ts +6 -9
  280. package/src/wirings/actor-flow/run-conversation.test.ts +2 -2
  281. package/src/wirings/actor-flow/run-conversation.ts +7 -9
  282. package/src/wirings/{ai-agent/ai-agent-agui.test.ts → agent/agent-agui.test.ts} +126 -105
  283. package/src/wirings/{ai-agent/ai-agent-agui.ts → agent/agent-agui.ts} +7 -7
  284. package/src/wirings/{ai-agent/ai-agent-authorization.test.ts → agent/agent-authorization.test.ts} +6 -6
  285. package/src/wirings/{ai-agent/ai-agent-finalize.test.ts → agent/agent-finalize.test.ts} +17 -16
  286. package/src/wirings/{ai-agent/ai-agent-finalize.ts → agent/agent-finalize.ts} +22 -22
  287. package/src/wirings/{ai-agent/ai-agent-helpers.test.ts → agent/agent-helpers.test.ts} +1 -1
  288. package/src/wirings/{ai-agent/ai-agent-helpers.ts → agent/agent-helpers.ts} +1 -1
  289. package/src/wirings/{ai-agent/ai-agent-interrupt.test.ts → agent/agent-interrupt.test.ts} +67 -77
  290. package/src/wirings/{ai-agent/ai-agent-interrupt.ts → agent/agent-interrupt.ts} +5 -5
  291. package/src/wirings/{ai-agent/ai-agent-memory.test.ts → agent/agent-memory.test.ts} +12 -12
  292. package/src/wirings/{ai-agent/ai-agent-memory.ts → agent/agent-memory.ts} +36 -36
  293. package/src/wirings/{ai-agent/ai-agent-model-config.test.ts → agent/agent-model-config.test.ts} +2 -5
  294. package/src/wirings/{ai-agent/ai-agent-model-config.ts → agent/agent-model-config.ts} +1 -1
  295. package/src/wirings/{ai-agent/ai-agent-prepare.test.ts → agent/agent-prepare.test.ts} +18 -18
  296. package/src/wirings/{ai-agent/ai-agent-prepare.ts → agent/agent-prepare.ts} +52 -51
  297. package/src/wirings/{ai-agent/ai-agent-registry.test.ts → agent/agent-registry.test.ts} +49 -43
  298. package/src/wirings/{ai-agent/ai-agent-registry.ts → agent/agent-registry.ts} +14 -14
  299. package/src/wirings/{ai-agent/ai-agent-resume-authorization.test.ts → agent/agent-resume-authorization.test.ts} +18 -18
  300. package/src/wirings/{ai-agent → agent}/agent-rpc.ts +16 -20
  301. package/src/wirings/{ai-agent/ai-agent-runner.test.ts → agent/agent-runner.test.ts} +105 -106
  302. package/src/wirings/{ai-agent/ai-agent-runner.ts → agent/agent-runner.ts} +90 -80
  303. package/src/wirings/{ai-agent/ai-agent-stream-output-hooks.test.ts → agent/agent-stream-output-hooks.test.ts} +25 -25
  304. package/src/wirings/{ai-agent/ai-agent-stream.test.ts → agent/agent-stream.test.ts} +147 -143
  305. package/src/wirings/{ai-agent/ai-agent-stream.ts → agent/agent-stream.ts} +147 -146
  306. package/src/wirings/{ai-agent/ai-agent-thread-ownership.test.ts → agent/agent-thread-ownership.test.ts} +24 -28
  307. package/src/wirings/{ai-agent/ai-agent-turn.test.ts → agent/agent-turn.test.ts} +3 -5
  308. package/src/wirings/{ai-agent/ai-agent-turn.ts → agent/agent-turn.ts} +7 -7
  309. package/src/wirings/{ai-agent/ai-agent.types.ts → agent/agent.types.ts} +51 -48
  310. package/src/wirings/agent/index.ts +56 -0
  311. package/src/wirings/{ai-agent → agent}/voice-input.test.ts +15 -15
  312. package/src/wirings/{ai-agent → agent}/voice-input.ts +11 -11
  313. package/src/wirings/{ai-agent → agent}/voice-output.test.ts +23 -23
  314. package/src/wirings/{ai-agent → agent}/voice-output.ts +11 -11
  315. package/src/wirings/{ai-scorer/ai-scorer-grade.test.ts → agent-scorer/agent-scorer-grade.test.ts} +8 -8
  316. package/src/wirings/{ai-scorer/ai-scorer-grade.ts → agent-scorer/agent-scorer-grade.ts} +9 -9
  317. package/src/wirings/{ai-scorer/ai-scorer-judge.test.ts → agent-scorer/agent-scorer-judge.test.ts} +11 -14
  318. package/src/wirings/{ai-scorer/ai-scorer-judge.ts → agent-scorer/agent-scorer-judge.ts} +11 -11
  319. package/src/wirings/{ai-scorer/ai-scorer-live.test.ts → agent-scorer/agent-scorer-live.test.ts} +11 -11
  320. package/src/wirings/{ai-scorer/ai-scorer-live.ts → agent-scorer/agent-scorer-live.ts} +3 -3
  321. package/src/wirings/{ai-scorer/ai-scorer-registry.ts → agent-scorer/agent-scorer-registry.ts} +11 -8
  322. package/src/wirings/{ai-scorer/ai-scorer-sampling.test.ts → agent-scorer/agent-scorer-sampling.test.ts} +1 -1
  323. package/src/wirings/{ai-scorer/ai-scorer-snapshots.test.ts → agent-scorer/agent-scorer-snapshots.test.ts} +2 -2
  324. package/src/wirings/{ai-scorer/ai-scorer-snapshots.ts → agent-scorer/agent-scorer-snapshots.ts} +1 -1
  325. package/src/wirings/{ai-scorer/ai-scorer-worker.test.ts → agent-scorer/agent-scorer-worker.test.ts} +15 -15
  326. package/src/wirings/{ai-scorer/ai-scorer-worker.ts → agent-scorer/agent-scorer-worker.ts} +9 -7
  327. package/src/wirings/{ai-scorer/ai-scorer.ts → agent-scorer/agent-scorer.ts} +7 -7
  328. package/src/wirings/{ai-scorer/ai-scorer.types.ts → agent-scorer/agent-scorer.types.ts} +6 -6
  329. package/src/wirings/agent-scorer/index.ts +22 -0
  330. package/src/wirings/channel/channel-rpc.types.ts +2 -2
  331. package/src/wirings/rpc/rpc-runner.ts +2 -2
  332. package/src/wirings/rpc/rpc-types.ts +1 -1
  333. package/src/wirings/virtual-user/prepare-virtual-user-run.ts +1 -1
  334. package/src/wirings/virtual-user/run-virtual-user.test.ts +2 -2
  335. package/src/wirings/virtual-user/run-virtual-user.ts +3 -3
  336. package/src/wirings/virtual-user/virtual-user-agents.ts +1 -1
  337. package/src/wirings/workflow/run-timeline.ts +1 -1
  338. package/src/wirings-stay-decoupled.test.ts +3 -3
  339. package/tsconfig.tsbuildinfo +1 -1
  340. package/src/wirings/ai-agent/index.ts +0 -65
  341. package/src/wirings/ai-scorer/index.ts +0 -24
  342. /package/src/wirings/{ai-agent/ai-agent-utils.ts → agent/agent-utils.ts} +0 -0
  343. /package/src/wirings/{ai-scorer/ai-scorer-sampling.ts → agent-scorer/agent-scorer-sampling.ts} +0 -0
@@ -0,0 +1,28 @@
1
+ export type { AuditDurability, AuditEvent, AuditEventBatch, } from '../services/audit-service.js';
2
+ export type { DeploymentConfig, DeploymentService, DeploymentServiceConfig, } from '../services/deployment-service.js';
3
+ export { InMemoryAgentRunStateService } from '../services/in-memory-agent-run-state-service.js';
4
+ export type { AgentMeta, AgentsMeta, EmailTemplateMeta, EmailsMeta, GroupMeta, MCPMeta, MetaService, MiddlewareDefinitionMeta, MiddlewareGroupsMeta, MiddlewareInstanceMeta, PermissionDefinitionMeta, PermissionsGroupsMeta, RPCMetaRecord, ServiceMeta, ServicesMetaRecord, } from '../services/meta-service.js';
5
+ export type { ResolvedPersona, ScenarioPersonas, } from '../services/personas-service.js';
6
+ export { pikkuWebhookWorkerFunc } from '../services/queue-webhook-service.js';
7
+ export type { ScheduledTaskInfo, ScheduledTaskSummary, } from '../services/scheduler-service.js';
8
+ export type { Role } from '../services/scope-service.js';
9
+ export { getStubTracker, spy } from '../services/stub-tracker.js';
10
+ export type { CredentialMetaInfo } from '../services/typed-credential-service.js';
11
+ export type { CredentialMeta } from '../services/typed-secret-service.js';
12
+ export { TypedVariablesService } from '../services/typed-variables-service.js';
13
+ export type { VariableMeta } from '../services/typed-variables-service.js';
14
+ export { PikkuSessionService, createMiddlewareSessionWireProps, } from '../services/user-session-service.js';
15
+ export type { CoverageFunctionMeta, CoverageService, FunctionCoverageEntry, FunctionCoverageReport, ScriptCoverage, } from '../services/v8-coverage-service.js';
16
+ export { PIKKU_OUTGOING_WEBHOOK_QUEUE_NAME } from '../services/webhook-service.js';
17
+ export type { SendWebhookInput, SendWebhookResult, WebhookAttemptResult, WebhookDeliveryRecord, WebhookDeliveryWithAttempts, } from '../services/webhook-service.js';
18
+ export type { FunctionMeta, FunctionsMeta, MiddlewareMetadata as MiddlewareMeta, PermissionMetadata as PermissionMeta, } from '../types/core.types.js';
19
+ /**
20
+ * Types the exports above mention but do not themselves export. Without
21
+ * them a consumer's declaration emit has no name for the type it infers,
22
+ * and fails with TS2883 rather than reaching for the original entry point.
23
+ */
24
+ export type { Logger } from '../services/logger.js';
25
+ export type { StubTracker } from '../services/stub-tracker.js';
26
+ export type { SessionService } from '../services/user-session-service.js';
27
+ export type { WebhookJobData, WebhookService, } from '../services/webhook-service.js';
28
+ export type { CoreUserSession } from '../types/core.types.js';
@@ -0,0 +1,6 @@
1
+ export { InMemoryAgentRunStateService } from '../services/in-memory-agent-run-state-service.js';
2
+ export { pikkuWebhookWorkerFunc } from '../services/queue-webhook-service.js';
3
+ export { getStubTracker, spy } from '../services/stub-tracker.js';
4
+ export { TypedVariablesService } from '../services/typed-variables-service.js';
5
+ export { PikkuSessionService, createMiddlewareSessionWireProps, } from '../services/user-session-service.js';
6
+ export { PIKKU_OUTGOING_WEBHOOK_QUEUE_NAME } from '../services/webhook-service.js';
@@ -0,0 +1,7 @@
1
+ export { defineServiceTests } from '../testing/service-tests.js';
2
+ /**
3
+ * Types the exports above mention but do not themselves export. Without
4
+ * them a consumer's declaration emit has no name for the type it infers,
5
+ * and fails with TS2883 rather than reaching for the original entry point.
6
+ */
7
+ export type { ServiceTestConfig } from '../testing/service-tests.js';
@@ -0,0 +1 @@
1
+ export { defineServiceTests } from '../testing/service-tests.js';
@@ -0,0 +1 @@
1
+ export type { CorePikkuTriggerFunction, CorePikkuTriggerFunctionConfig, CoreTrigger, TriggerMeta, TriggerSourceMeta, } from '../wirings/trigger/trigger.types.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ export { isExpectedError } from '../errors/error-handler.js';
2
+ export type { CorePermissionGroup } from '../function/functions.types.js';
3
+ export { PikkuRequest } from '../pikku-request.js';
4
+ export type { AuditFacets, AuditQuery, AuditQueryResult, } from '../services/audit-service.js';
5
+ export { parseDurationString } from '../time-utils.js';
6
+ export type { RelativeTimeInput } from '../time-utils.js';
7
+ export type { AuthInstance, FunctionServicesMeta, FunctionWiresMeta, JSONValue, MiddlewareMetadata, PermissionMetadata, PikkuWire, PikkuWiringTypes, PostgresConfig, SecretlessServices, SecurityAuditIssue, SecurityAuditReport, SecurityAuditUpdate, SecuritySeverity, SecurityUpdateLevel, SerializedError, } from '../types/core.types.js';
8
+ export { isSerializable } from '../utils.js';
9
+ export { formatVersionedId, isVersionedId, parseVersionedId, } from '../version.js';
@@ -0,0 +1,5 @@
1
+ export { isExpectedError } from '../errors/error-handler.js';
2
+ export { PikkuRequest } from '../pikku-request.js';
3
+ export { parseDurationString } from '../time-utils.js';
4
+ export { isSerializable } from '../utils.js';
5
+ export { formatVersionedId, isVersionedId, parseVersionedId, } from '../version.js';
@@ -0,0 +1,8 @@
1
+ export { validateAndBuildVariableDefinitionsMeta } from '../wirings/variable/validate-variable-definitions.js';
2
+ export type { CoreVariable, VariableDefinitionMeta, VariableDefinitions, VariableDefinitionsMeta, } from '../wirings/variable/variable.types.js';
3
+ /**
4
+ * Types the exports above mention but do not themselves export. Without
5
+ * them a consumer's declaration emit has no name for the type it infers,
6
+ * and fails with TS2883 rather than reaching for the original entry point.
7
+ */
8
+ export type { SchemaRefLike } from '../types/core.types.js';
@@ -0,0 +1 @@
1
+ export { validateAndBuildVariableDefinitionsMeta } from '../wirings/variable/validate-variable-definitions.js';
@@ -0,0 +1,21 @@
1
+ export { personaScopes, prepareVirtualUserRun, } from '../wirings/virtual-user/prepare-virtual-user-run.js';
2
+ export { catalogueClassification, isReadOnly, reachableCatalogue, unreachableCatalogue, } from '../wirings/virtual-user/virtual-user-catalogue.js';
3
+ export { DISPOSITIONS, dispositionProfile, } from '../wirings/virtual-user/virtual-user-dispositions.js';
4
+ export type { DispositionProfile } from '../wirings/virtual-user/virtual-user-dispositions.js';
5
+ export { intentsForPersona } from '../wirings/virtual-user/virtual-user-intents.js';
6
+ export type { VirtualUserRunOutcome, VirtualUserRunRecord, VirtualUserRunStart, VirtualUserRunStore, } from '../wirings/virtual-user/virtual-user-run-store.js';
7
+ export { PRODUCTION_DISPOSITION } from '../wirings/virtual-user/virtual-user.types.js';
8
+ export type { IntentSource, VirtualUserFinding, VirtualUserRunResult, } from '../wirings/virtual-user/virtual-user.types.js';
9
+ /**
10
+ * Types the exports above mention but do not themselves export. Without
11
+ * them a consumer's declaration emit has no name for the type it infers,
12
+ * and fails with TS2883 rather than reaching for the original entry point.
13
+ */
14
+ export type { FunctionsMeta } from '../types/core.types.js';
15
+ export type { SystemRoleDefinitions, SystemRoleDefinitionsMeta, } from '../wirings/role/role.types.js';
16
+ export type { VirtualUserPreparation } from '../wirings/virtual-user/prepare-virtual-user-run.js';
17
+ export type { AgentReachability } from '../wirings/virtual-user/virtual-user-agents.js';
18
+ export type { SchemaMap } from '../wirings/virtual-user/virtual-user-derive.js';
19
+ export type { VirtualUserTuning } from '../wirings/virtual-user/virtual-user-dispositions.js';
20
+ export type { ApiCatalogueEntry, VirtualUserDisposition, } from '../wirings/virtual-user/virtual-user.types.js';
21
+ export type { WorkflowsMeta } from '../wirings/workflow/workflow.types.js';
@@ -0,0 +1,5 @@
1
+ export { personaScopes, prepareVirtualUserRun, } from '../wirings/virtual-user/prepare-virtual-user-run.js';
2
+ export { catalogueClassification, isReadOnly, reachableCatalogue, unreachableCatalogue, } from '../wirings/virtual-user/virtual-user-catalogue.js';
3
+ export { DISPOSITIONS, dispositionProfile, } from '../wirings/virtual-user/virtual-user-dispositions.js';
4
+ export { intentsForPersona } from '../wirings/virtual-user/virtual-user-intents.js';
5
+ export { PRODUCTION_DISPOSITION } from '../wirings/virtual-user/virtual-user.types.js';
@@ -0,0 +1,18 @@
1
+ export type { WorkflowService } from '../services/workflow-service.js';
2
+ export type { ApprovalStepMeta, ArrayPredicateStepMeta, BranchStepMeta, CancelStepMeta, Condition, FanoutStepMeta, FilterStepMeta, InlineStepMeta, InputSource, OutputBinding, ParallelGroupStepMeta, PikkuWorkflowWire, RpcStepMeta, SetStepMeta, SleepStepMeta, SuspendStepMeta, SwitchCaseMeta, SwitchStepMeta, WorkflowStepMeta, WorkflowStepOptions, WorkflowWireDoRPC, } from '../wirings/workflow/dsl/workflow-dsl.types.js';
3
+ export { template } from '../wirings/workflow/graph/template.js';
4
+ export type { PikkuWorkflowGraphConfig, PikkuWorkflowGraphResult, } from '../wirings/workflow/graph/wire-workflow-graph.js';
5
+ export { isRef } from '../wirings/workflow/graph/workflow-graph.types.js';
6
+ export { buildRunTimeline, reconstructFinalState, reconstructStateAt, } from '../wirings/workflow/run-timeline.js';
7
+ export type { ReconstructedRunState, RunTimeline, } from '../wirings/workflow/run-timeline.js';
8
+ export { assertWorkflowRunOwner } from '../wirings/workflow/workflow-run-ownership.js';
9
+ export type { ContextVariable, CoreWorkflow, StepState, StepStatus, WorkflowContext, WorkflowPlannedStep, WorkflowQueueOptions, WorkflowRun, WorkflowRunMirror, WorkflowRunService, WorkflowRunStatus, WorkflowRunWire, WorkflowStatus, WorkflowVersionStatus, WorkflowsMeta, WorkflowsRuntimeMeta, } from '../wirings/workflow/workflow.types.js';
10
+ /**
11
+ * Types the exports above mention but do not themselves export. Without
12
+ * them a consumer's declaration emit has no name for the type it infers,
13
+ * and fails with TS2883 rather than reaching for the original entry point.
14
+ */
15
+ export type { CoreUserSession } from '../types/core.types.js';
16
+ export type { TemplateString } from '../wirings/workflow/graph/template.js';
17
+ export type { RefValue } from '../wirings/workflow/graph/workflow-graph.types.js';
18
+ export type { HistoryEntry } from '../wirings/workflow/run-timeline.js';
@@ -0,0 +1,4 @@
1
+ export { template } from '../wirings/workflow/graph/template.js';
2
+ export { isRef } from '../wirings/workflow/graph/workflow-graph.types.js';
3
+ export { buildRunTimeline, reconstructFinalState, reconstructStateAt, } from '../wirings/workflow/run-timeline.js';
4
+ export { assertWorkflowRunOwner } from '../wirings/workflow/workflow-run-ownership.js';
package/dist/index.d.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  /**
2
2
  * @module @pikku/core
3
3
  */
4
- export type { AuthInstance, CommonWireMeta, CoreConfig, CorePikkuMiddleware, CorePikkuMiddlewareConfig, CorePikkuMiddlewareFactory, CorePikkuMiddlewareGroup, CoreServices, CoreSecretlessSingletonServices, CoreSingletonServices, CoreUserSession, SecretlessServices, CreateConfig, ServerLifecycle, FunctionMeta, FunctionServicesMeta, FunctionWiresMeta, FunctionsMeta, FunctionsRuntimeMeta, JSONValue, MakeRequired, MiddlewareMetadata, MiddlewarePriority, PermissionMetadata, PickOptional, PickRequired, PikkuAIMiddlewareHooks, PikkuWire, PikkuRawWire, PikkuWiringTypes, PostgresConfig, RequireAtLeastOne, SecurityAuditIssue, SecurityAuditReport, SecurityAuditSummary, SecurityAuditUpdate, SecuritySeverity, SecurityUpdateLevel, SerializedError, } from './types/core.types.js';
5
- export { pikkuAIMiddleware, pikkuChannelMiddleware, pikkuChannelMiddlewareFactory, pikkuMiddleware, pikkuMiddlewareFactory, } from './types/core.types.js';
4
+ export type { AuthInstance, CommonWireMeta, CoreConfig, CorePikkuMiddleware, CorePikkuMiddlewareConfig, CorePikkuMiddlewareFactory, CorePikkuMiddlewareGroup, CoreServices, CoreSecretlessSingletonServices, CoreSingletonServices, CoreUserSession, SecretlessServices, CreateConfig, ServerLifecycle, FunctionMeta, FunctionServicesMeta, FunctionWiresMeta, FunctionsMeta, FunctionsRuntimeMeta, JSONValue, MakeRequired, MiddlewareMetadata, MiddlewarePriority, PermissionMetadata, PickOptional, PickRequired, PikkuAgentMiddlewareHooks, PikkuWire, PikkuRawWire, PikkuWiringTypes, PostgresConfig, RequireAtLeastOne, SecurityAuditIssue, SecurityAuditReport, SecurityAuditSummary, SecurityAuditUpdate, SecuritySeverity, SecurityUpdateLevel, SerializedError, } from './types/core.types.js';
5
+ export { pikkuAgentMiddleware, pikkuChannelMiddleware, pikkuChannelMiddlewareFactory, pikkuMiddleware, pikkuMiddlewareFactory, } from './types/core.types.js';
6
6
  export type { CorePikkuAuth, CorePikkuAuthConfig, CorePikkuFunction, CorePikkuFunctionConfig, CorePikkuPermission, CorePikkuPermissionConfig, CorePikkuPermissionFactory, CorePikkuApprovalDescription, CorePermissionGroup, } from './function/functions.types.js';
7
7
  export { pikkuAuth, pikkuPermission, pikkuPermissionFactory, pikkuApprovalDescription, } from './function/functions.types.js';
8
8
  export { getAllFunctionNames } from './function/index.js';
9
- export type { ListInput, ListOutput, Filter, } from './function/list.types.js';
9
+ export type { ListInput, ListOutput, Filter } from './function/list.types.js';
10
10
  export { pikkuCLIRender } from './wirings/cli/cli-runner.js';
11
11
  export { PikkuRequest } from './pikku-request.js';
12
12
  export { getRelativeTimeOffsetFromNow, parseDurationString, } from './time-utils.js';
13
13
  export type { RelativeTimeInput } from './time-utils.js';
14
14
  export { formatVersionedId, isVersionedId, parseVersionedId, } from './version.js';
15
- export { AbandonedError, type AbortScope, } from './function/abort-scope.js';
15
+ export { AbandonedError, type AbortScope } from './function/abort-scope.js';
16
16
  export { fetch } from './wirings/http/http-runner.js';
17
17
  export type { MCPToolResponse, MCPResourceResponse, MCPPromptResponse, } from './wirings/mcp/mcp.types.js';
18
18
  export { AIProviderAuthError, AIProviderNotConfiguredError, BadGatewayError, BadRequestError, ConflictError, ExpectationFailedError, ForbiddenError, GatewayTimeoutError, GoneError, HTTPVersionNotSupportedError, InternalServerError, InvalidMiddlewareWireError, InvalidOriginError, InvalidSessionError, LengthRequiredError, LocalEnvironmentOnlyError, LockedError, MaxComputeTimeReachedError, MethodNotAllowedError, MissingCredentialError, MissingSchemaError, MissingScopeError, MissingServiceError, MissingSessionError, NotAcceptableError, NotFoundError, NotImplementedError, PayloadTooLargeError, PaymentRequiredError, PikkuMissingMetaError, PreconditionFailedError, ProxyAuthenticationRequiredError, RangeNotSatisfiableError, ReadonlySessionError, RequestTimeoutError, ServiceUnavailableError, TooManyRequestsError, URITooLongError, UnauthorizedError, UnprocessableContentError, UnsupportedMediaTypeError, } from './errors/errors.js';
@@ -34,10 +34,10 @@ export type { SchemaService } from './services/schema-service.js';
34
34
  export type { SessionService } from './services/user-session-service.js';
35
35
  export { NoopAuditService, createInvocationAudit, } from './services/audit-service.js';
36
36
  export type { AuditConfig, AuditDurability, AuditEvent, AuditEventBatch, AuditFacets, AuditLog, AuditQuery, AuditQueryResult, AuditService, AuditUserIdentity, ResolvedAuditConfig, } from './services/audit-service.js';
37
- export type { AIAgentRunnerService, } from './services/ai-agent-runner-service.js';
37
+ export type { AgentRunnerService } from './services/agent-runner-service.js';
38
38
  export type { AIEmbeddingService } from './services/ai-embedding-service.js';
39
- export type { AIRunStateService } from './services/ai-run-state-service.js';
40
- export type { AIStorageService } from './services/ai-storage-service.js';
39
+ export type { AgentRunStateService } from './services/agent-run-state-service.js';
40
+ export type { AgentStorageService } from './services/agent-storage-service.js';
41
41
  export type { EmailsMeta, EmailTemplateMeta, MetaService, } from './services/meta-service.js';
42
42
  export type { HTTPMethod } from './wirings/http/http.types.js';
43
43
  export type { GraphNodeConfig } from './wirings/workflow/graph/workflow-graph.types.js';
@@ -55,6 +55,6 @@ export { clearPikkuRuntimeState } from './test-utils.js';
55
55
  export { type ScheduledTaskInfo, type ScheduledTaskSummary, } from './services/scheduler-service.js';
56
56
  export { SchedulerService } from './services/scheduler-service.js';
57
57
  export type { Private, Pii, Secret, Classification, AnonymizeStrategy, ClassificationManifest, ColumnForm, WrappedValue, SealedValue, HashedValue, } from './data-classification.js';
58
- export { hashToken, } from './column-form.js';
58
+ export { hashToken } from './column-form.js';
59
59
  export type { SecretValue, Safe } from './secret-value.js';
60
60
  export { createSecretValue, isSecretValue, SecretCoercionError, REDACTED, } from './secret-value.js';
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- export { pikkuAIMiddleware, pikkuChannelMiddleware, pikkuChannelMiddlewareFactory, pikkuMiddleware, pikkuMiddlewareFactory, } from './types/core.types.js';
1
+ export { pikkuAgentMiddleware, pikkuChannelMiddleware, pikkuChannelMiddlewareFactory, pikkuMiddleware, pikkuMiddlewareFactory, } from './types/core.types.js';
2
2
  export { pikkuAuth, pikkuPermission, pikkuPermissionFactory, pikkuApprovalDescription, } from './function/functions.types.js';
3
3
  export { getAllFunctionNames } from './function/index.js';
4
4
  export { pikkuCLIRender } from './wirings/cli/cli-runner.js';
5
5
  export { PikkuRequest } from './pikku-request.js';
6
6
  export { getRelativeTimeOffsetFromNow, parseDurationString, } from './time-utils.js';
7
7
  export { formatVersionedId, isVersionedId, parseVersionedId, } from './version.js';
8
- export { AbandonedError, } from './function/abort-scope.js';
8
+ export { AbandonedError } from './function/abort-scope.js';
9
9
  export { fetch } from './wirings/http/http-runner.js';
10
10
  export { AIProviderAuthError, AIProviderNotConfiguredError, BadGatewayError, BadRequestError, ConflictError, ExpectationFailedError, ForbiddenError, GatewayTimeoutError, GoneError, HTTPVersionNotSupportedError, InternalServerError, InvalidMiddlewareWireError, InvalidOriginError, InvalidSessionError, LengthRequiredError, LocalEnvironmentOnlyError, LockedError, MaxComputeTimeReachedError, MethodNotAllowedError, MissingCredentialError, MissingSchemaError, MissingScopeError, MissingServiceError, MissingSessionError, NotAcceptableError, NotFoundError, NotImplementedError, PayloadTooLargeError, PaymentRequiredError, PikkuMissingMetaError, PreconditionFailedError, ProxyAuthenticationRequiredError, RangeNotSatisfiableError, ReadonlySessionError, RequestTimeoutError, ServiceUnavailableError, TooManyRequestsError, URITooLongError, UnauthorizedError, UnprocessableContentError, UnsupportedMediaTypeError, } from './errors/errors.js';
11
11
  export { PikkuError, isExpectedError } from './errors/error-handler.js';
@@ -21,5 +21,5 @@ export { hasScopes, verifyScopes } from './scopes.js';
21
21
  export { isSerializable, stopSingletonServices, pikkuServerLifecycle, } from './utils.js';
22
22
  export { clearPikkuRuntimeState } from './test-utils.js';
23
23
  export { SchedulerService } from './services/scheduler-service.js';
24
- export { hashToken, } from './column-form.js';
24
+ export { hashToken } from './column-form.js';
25
25
  export { createSecretValue, isSecretValue, SecretCoercionError, REDACTED, } from './secret-value.js';
@@ -5,7 +5,7 @@ export declare const authAPIKey: import("../types/core.types.js").CorePikkuMiddl
5
5
  secrets?: {
6
6
  requireAllowedHosts?: boolean;
7
7
  };
8
- workflow?: import("../wirings/workflow/workflow.types.js").WorkflowServiceConfig;
8
+ workflow?: import("../ecosystem/agent.js").WorkflowServiceConfig;
9
9
  webhook?: import("../services/webhook-service.js").WebhookServiceConfig;
10
10
  postgres?: import("../types/core.types.js").PostgresConfig;
11
11
  }>, import("../types/core.types.js").CoreUserSession>;
@@ -17,7 +17,7 @@ export declare const authBearer: import("../types/core.types.js").CorePikkuMiddl
17
17
  secrets?: {
18
18
  requireAllowedHosts?: boolean;
19
19
  };
20
- workflow?: import("../wirings/workflow/workflow.types.js").WorkflowServiceConfig;
20
+ workflow?: import("../ecosystem/agent.js").WorkflowServiceConfig;
21
21
  webhook?: import("../services/webhook-service.js").WebhookServiceConfig;
22
22
  postgres?: import("../types/core.types.js").PostgresConfig;
23
23
  }>, CoreUserSession>;
@@ -9,7 +9,7 @@ export declare const authCookie: import("../types/core.types.js").CorePikkuMiddl
9
9
  secrets?: {
10
10
  requireAllowedHosts?: boolean;
11
11
  };
12
- workflow?: import("../wirings/workflow/workflow.types.js").WorkflowServiceConfig;
12
+ workflow?: import("../ecosystem/agent.js").WorkflowServiceConfig;
13
13
  webhook?: import("../services/webhook-service.js").WebhookServiceConfig;
14
14
  postgres?: import("../types/core.types.js").PostgresConfig;
15
15
  }>, import("../types/core.types.js").CoreUserSession>;
@@ -15,7 +15,7 @@ export declare const cors: import("../types/core.types.js").CorePikkuMiddlewareF
15
15
  secrets?: {
16
16
  requireAllowedHosts?: boolean;
17
17
  };
18
- workflow?: import("../wirings/workflow/workflow.types.js").WorkflowServiceConfig;
18
+ workflow?: import("../ecosystem/agent.js").WorkflowServiceConfig;
19
19
  webhook?: import("../services/webhook-service.js").WebhookServiceConfig;
20
20
  postgres?: import("../types/core.types.js").PostgresConfig;
21
21
  }>, import("../types/core.types.js").CoreUserSession>;
@@ -3,7 +3,7 @@ export declare const pikkuRemoteAuthMiddleware: import("../types/core.types.js")
3
3
  secrets?: {
4
4
  requireAllowedHosts?: boolean;
5
5
  };
6
- workflow?: import("../wirings/workflow/workflow.types.js").WorkflowServiceConfig;
6
+ workflow?: import("../ecosystem/agent.js").WorkflowServiceConfig;
7
7
  webhook?: import("../services/webhook-service.js").WebhookServiceConfig;
8
8
  postgres?: import("../types/core.types.js").PostgresConfig;
9
9
  }>, import("../types/core.types.js").CoreUserSession>;
@@ -7,7 +7,7 @@ export declare const telemetryOuter: import("../types/core.types.js").CorePikkuM
7
7
  secrets?: {
8
8
  requireAllowedHosts?: boolean;
9
9
  };
10
- workflow?: import("../wirings/workflow/workflow.types.js").WorkflowServiceConfig;
10
+ workflow?: import("../ecosystem/agent.js").WorkflowServiceConfig;
11
11
  webhook?: import("../services/webhook-service.js").WebhookServiceConfig;
12
12
  postgres?: import("../types/core.types.js").PostgresConfig;
13
13
  }>, import("../types/core.types.js").CoreUserSession>;
@@ -20,7 +20,7 @@ export declare const telemetryInner: import("../types/core.types.js").CorePikkuM
20
20
  secrets?: {
21
21
  requireAllowedHosts?: boolean;
22
22
  };
23
- workflow?: import("../wirings/workflow/workflow.types.js").WorkflowServiceConfig;
23
+ workflow?: import("../ecosystem/agent.js").WorkflowServiceConfig;
24
24
  webhook?: import("../services/webhook-service.js").WebhookServiceConfig;
25
25
  postgres?: import("../types/core.types.js").PostgresConfig;
26
26
  }>, import("../types/core.types.js").CoreUserSession>;
@@ -0,0 +1,29 @@
1
+ import type { AgentRunState, PendingApproval } from '../wirings/agent/agent.types.js';
2
+ import type { AgentRunScore } from '../wirings/agent-scorer/agent-scorer.types.js';
3
+ export type CreateRunInput = Omit<AgentRunState, 'runId'>;
4
+ export type SaveScoreInput = Omit<AgentRunScore, 'createdAt'>;
5
+ export interface AgentRunStateService {
6
+ createRun(run: CreateRunInput): Promise<string>;
7
+ updateRun(runId: string, updates: Partial<AgentRunState>): Promise<void>;
8
+ getRun(runId: string): Promise<AgentRunState | null>;
9
+ getRunsByThread(threadId: string): Promise<AgentRunState[]>;
10
+ /**
11
+ * Claims an approval: removes it from the run's pending list and records the
12
+ * decision, as one atomic step. Returns whether THIS caller made the claim —
13
+ * concurrent approvals of the same tool call produce exactly one `true`, and
14
+ * only that caller may run the tool.
15
+ */
16
+ resolveApproval(toolCallId: string, status: 'approved' | 'denied'): Promise<boolean>;
17
+ findRunByToolCallId(toolCallId: string): Promise<{
18
+ run: AgentRunState;
19
+ approval: PendingApproval;
20
+ } | null>;
21
+ /**
22
+ * Record one scorer's grade of a finished run. A run accumulates one row per
23
+ * scorer, and a scorer may grade the same run more than once — a retried job
24
+ * appends rather than replaces, so a re-grade never silently overwrites the
25
+ * grade that was acted on.
26
+ */
27
+ saveScore(score: SaveScoreInput): Promise<void>;
28
+ getScores(runId: string): Promise<AgentRunScore[]>;
29
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,220 @@
1
+ import type { AgentMessage, AgentStep, AgentToolDef, AgentStreamChannel } from '../wirings/agent/agent.types.js';
2
+ export type AIProviderOptions = Record<string, Record<string, unknown>>;
3
+ export type AgentRunnerParams = {
4
+ model: string;
5
+ temperature?: number;
6
+ instructions: string;
7
+ messages: AgentMessage[];
8
+ tools: AgentToolDef[];
9
+ maxSteps: number;
10
+ toolChoice: 'auto' | 'required' | 'none';
11
+ outputSchema?: Record<string, unknown>;
12
+ /** Pikku agent function name — forwarded to the LLM proxy (LiteLLM) as
13
+ * request-level metadata so usage can be broken down per agent. */
14
+ agentId?: string;
15
+ /**
16
+ * Cancels the model call itself, not just delivery of its output. Set by
17
+ * `streamAgent` from the run's interrupt handle so a voice barge-in stops
18
+ * generation upstream rather than leaving tokens being billed into a stream
19
+ * nobody reads. A runner that ignores it degrades to "the caller stops
20
+ * listening", which is the behaviour before this field existed.
21
+ */
22
+ abortSignal?: AbortSignal;
23
+ /**
24
+ * Per-provider settings passed to the model untouched — the escape hatch for
25
+ * anything the shared params above cannot express because only one vendor
26
+ * has it.
27
+ *
28
+ * The setting that motivated it is `reasoningEffort`. A voice turn is heard
29
+ * rather than read, so the wait before the first word is most of the
30
+ * experience: `{ openai: { reasoningEffort: 'minimal' } }` on gpt-5-mini
31
+ * measured 0.9s to first token against 2.5s at the default, and 1.6s of
32
+ * silence is a long time to sit through having just finished speaking.
33
+ */
34
+ providerOptions?: AIProviderOptions;
35
+ };
36
+ export type AgentRunnerResult = {
37
+ text: string;
38
+ object?: unknown;
39
+ steps: AgentStep[];
40
+ usage: {
41
+ inputTokens: number;
42
+ outputTokens: number;
43
+ };
44
+ };
45
+ export type AgentStepResult = {
46
+ text: string;
47
+ object?: unknown;
48
+ toolCalls: {
49
+ toolCallId: string;
50
+ toolName: string;
51
+ args: unknown;
52
+ }[];
53
+ toolResults: {
54
+ toolCallId: string;
55
+ toolName: string;
56
+ result: unknown;
57
+ /**
58
+ * Set when the tool threw rather than returned. Carried as its own field
59
+ * because `result` is a rendered string by the time anything downstream
60
+ * reads it, and "did this tool fail" is not answerable by looking for an
61
+ * `Error:` prefix in text a tool could legitimately have returned.
62
+ */
63
+ error?: string;
64
+ }[];
65
+ usage: {
66
+ inputTokens: number;
67
+ outputTokens: number;
68
+ };
69
+ finishReason: 'stop' | 'tool-calls' | 'length' | 'error' | 'unknown';
70
+ reasoningContent?: string;
71
+ };
72
+ export type AITranscriptionParams = {
73
+ model: string;
74
+ audio: Uint8Array;
75
+ providerOptions?: AIProviderOptions;
76
+ maxRetries?: number;
77
+ abortSignal?: AbortSignal;
78
+ headers?: Record<string, string>;
79
+ };
80
+ export type AITranscriptionResult = {
81
+ text: string;
82
+ segments?: Array<{
83
+ text: string;
84
+ startSecond: number;
85
+ endSecond: number;
86
+ }>;
87
+ language?: string;
88
+ durationInSeconds?: number;
89
+ warnings?: unknown[];
90
+ providerMetadata?: Record<string, unknown>;
91
+ responses?: unknown[];
92
+ };
93
+ export type AIGenerateSpeechParams = {
94
+ model: string;
95
+ text: string;
96
+ voice?: string;
97
+ outputFormat?: string;
98
+ instructions?: string;
99
+ speed?: number;
100
+ language?: string;
101
+ providerOptions?: AIProviderOptions;
102
+ maxRetries?: number;
103
+ abortSignal?: AbortSignal;
104
+ headers?: Record<string, string>;
105
+ };
106
+ export type AIGenerateSpeechResult = {
107
+ audio: {
108
+ uint8Array: Uint8Array;
109
+ base64: string;
110
+ mediaType: string;
111
+ format: string;
112
+ };
113
+ warnings?: unknown[];
114
+ providerMetadata?: Record<string, unknown>;
115
+ responses?: unknown[];
116
+ };
117
+ export type AIGenerateImagePrompt = string | {
118
+ images: Array<Uint8Array | ArrayBuffer | string>;
119
+ text?: string;
120
+ mask?: Uint8Array | ArrayBuffer | string;
121
+ };
122
+ export type AIGenerateImageParams = {
123
+ model: string;
124
+ prompt: AIGenerateImagePrompt;
125
+ n?: number;
126
+ maxImagesPerCall?: number;
127
+ size?: `${number}x${number}`;
128
+ aspectRatio?: `${number}:${number}`;
129
+ seed?: number;
130
+ providerOptions?: AIProviderOptions;
131
+ maxRetries?: number;
132
+ abortSignal?: AbortSignal;
133
+ headers?: Record<string, string>;
134
+ };
135
+ export type AIGenerateImageResult = {
136
+ images: Array<{
137
+ uint8Array: Uint8Array;
138
+ base64: string;
139
+ mediaType: string;
140
+ }>;
141
+ warnings?: unknown[];
142
+ providerMetadata?: Record<string, unknown>;
143
+ responses?: unknown[];
144
+ usage?: {
145
+ inputTokens?: number;
146
+ outputTokens?: number;
147
+ totalTokens?: number;
148
+ };
149
+ };
150
+ export type AIEmbedParams = {
151
+ model: string;
152
+ value: string;
153
+ providerOptions?: AIProviderOptions;
154
+ maxRetries?: number;
155
+ abortSignal?: AbortSignal;
156
+ headers?: Record<string, string>;
157
+ };
158
+ export type AIEmbedResult = {
159
+ value: string;
160
+ embedding: number[];
161
+ usage?: {
162
+ tokens?: number;
163
+ };
164
+ warnings?: unknown[];
165
+ providerMetadata?: Record<string, unknown>;
166
+ response?: unknown;
167
+ };
168
+ export type AIEmbedManyParams = {
169
+ model: string;
170
+ values: string[];
171
+ providerOptions?: AIProviderOptions;
172
+ maxRetries?: number;
173
+ abortSignal?: AbortSignal;
174
+ headers?: Record<string, string>;
175
+ maxParallelCalls?: number;
176
+ };
177
+ export type AIEmbedManyResult = {
178
+ values: string[];
179
+ embeddings: number[][];
180
+ usage?: {
181
+ tokens?: number;
182
+ };
183
+ warnings?: unknown[];
184
+ providerMetadata?: Record<string, unknown>;
185
+ responses?: unknown[];
186
+ };
187
+ export type AIRerankParams<VALUE extends string | Record<string, unknown>> = {
188
+ model: string;
189
+ query: string;
190
+ documents: VALUE[];
191
+ topK?: number;
192
+ providerOptions?: AIProviderOptions;
193
+ maxRetries?: number;
194
+ abortSignal?: AbortSignal;
195
+ headers?: Record<string, string>;
196
+ };
197
+ export type AIRerankResult<VALUE extends string | Record<string, unknown>> = {
198
+ ranking: Array<{
199
+ index: number;
200
+ document: VALUE;
201
+ score: number;
202
+ }>;
203
+ rerankedDocuments: VALUE[];
204
+ originalDocuments: VALUE[];
205
+ providerMetadata?: Record<string, unknown>;
206
+ response?: unknown;
207
+ };
208
+ export interface AgentRunnerService {
209
+ stream(params: AgentRunnerParams, channel: AgentStreamChannel): Promise<AgentStepResult>;
210
+ run(params: AgentRunnerParams): Promise<AgentStepResult>;
211
+ transcribe?(params: AITranscriptionParams): Promise<AITranscriptionResult>;
212
+ generateSpeech?(params: AIGenerateSpeechParams): Promise<AIGenerateSpeechResult>;
213
+ generateImage?(params: AIGenerateImageParams): Promise<AIGenerateImageResult>;
214
+ embed?(params: AIEmbedParams): Promise<AIEmbedResult>;
215
+ embedMany?(params: AIEmbedManyParams): Promise<AIEmbedManyResult>;
216
+ rerank?<VALUE extends string | Record<string, unknown>>(params: AIRerankParams<VALUE>): Promise<AIRerankResult<VALUE>>;
217
+ /** Return a new runner that uses the given API key for every LLM call.
218
+ * Optional — runners that don't support per-key scoping leave this undefined. */
219
+ withApiKey?(apiKey: string): AgentRunnerService;
220
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import type { AgentThread, AgentMessage } from '../wirings/agent/agent.types.js';
2
+ export interface AgentStorageService {
3
+ createThread(resourceId: string, options?: {
4
+ threadId?: string;
5
+ title?: string;
6
+ metadata?: Record<string, unknown>;
7
+ }): Promise<AgentThread>;
8
+ getThread(threadId: string): Promise<AgentThread>;
9
+ getThreads(resourceId: string): Promise<AgentThread[]>;
10
+ deleteThread(threadId: string): Promise<void>;
11
+ getMessages(threadId: string, options?: {
12
+ lastN?: number;
13
+ cursor?: string;
14
+ }): Promise<AgentMessage[]>;
15
+ saveMessages(threadId: string, messages: AgentMessage[]): Promise<void>;
16
+ getWorkingMemory(id: string, scope: 'resource' | 'thread'): Promise<Record<string, unknown> | null>;
17
+ saveWorkingMemory(id: string, scope: 'resource' | 'thread', data: Record<string, unknown>): Promise<void>;
18
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -24,7 +24,7 @@ export interface HttpPersonasConfig {
24
24
  /**
25
25
  * Default model a persona thinks with when `converse(...)` is called without
26
26
  * an explicit `model`. Its own turns/approvals/evaluation run in-process via
27
- * the configured `aiAgentRunner`.
27
+ * the configured `agentRunner`.
28
28
  */
29
29
  model?: string;
30
30
  }
@@ -53,8 +53,8 @@ export class HttpPersona {
53
53
  return readScenarioHttpResponse(res);
54
54
  }
55
55
  async converse(options) {
56
- const { aiAgentRunner } = getSingletonServices();
57
- if (!aiAgentRunner) {
56
+ const { agentRunner } = getSingletonServices();
57
+ if (!agentRunner) {
58
58
  throw new AIProviderNotConfiguredError();
59
59
  }
60
60
  const model = options.model ?? this.config.model;
@@ -72,7 +72,7 @@ export class HttpPersona {
72
72
  approvals: options.approvals,
73
73
  model,
74
74
  maxTurns: options.maxTurns,
75
- llm: (params) => aiAgentRunner.run(params),
75
+ llm: (params) => agentRunner.run(params),
76
76
  target: {
77
77
  run: (message) => this.agentRun(options.agent, message, threadId, resourceId),
78
78
  approve: (runId, decisions) => this.agentApprove(options.agent, runId, decisions),
@@ -0,0 +1,19 @@
1
+ import type { AgentRunStateService, CreateRunInput, SaveScoreInput } from './agent-run-state-service.js';
2
+ import type { AgentRunState, PendingApproval } from '../wirings/agent/agent.types.js';
3
+ import type { AgentRunScore } from '../wirings/agent-scorer/agent-scorer.types.js';
4
+ export declare class InMemoryAgentRunStateService implements AgentRunStateService {
5
+ private runs;
6
+ private scores;
7
+ private counter;
8
+ createRun(run: CreateRunInput): Promise<string>;
9
+ updateRun(runId: string, updates: Partial<AgentRunState>): Promise<void>;
10
+ getRun(runId: string): Promise<AgentRunState | null>;
11
+ getRunsByThread(threadId: string): Promise<AgentRunState[]>;
12
+ resolveApproval(toolCallId: string, status: 'approved' | 'denied'): Promise<boolean>;
13
+ findRunByToolCallId(toolCallId: string): Promise<{
14
+ run: AgentRunState;
15
+ approval: PendingApproval;
16
+ } | null>;
17
+ saveScore(score: SaveScoreInput): Promise<void>;
18
+ getScores(runId: string): Promise<AgentRunScore[]>;
19
+ }