@pikku/core 0.12.80 → 0.12.83

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 (237) hide show
  1. package/CHANGELOG.md +345 -0
  2. package/dist/errors/index.d.ts +1 -1
  3. package/dist/errors/index.js +1 -1
  4. package/dist/function/function-runner.js +2 -5
  5. package/dist/function/index.d.ts +1 -1
  6. package/dist/index.d.ts +11 -11
  7. package/dist/index.js +3 -3
  8. package/dist/pikku-state.js +4 -0
  9. package/dist/services/ai-agent-runner-service.d.ts +7 -0
  10. package/dist/services/ai-run-state-service.d.ts +10 -0
  11. package/dist/services/in-memory-ai-run-state-service.d.ts +5 -1
  12. package/dist/services/in-memory-ai-run-state-service.js +9 -0
  13. package/dist/services/index.d.ts +15 -16
  14. package/dist/services/index.js +5 -5
  15. package/dist/services/meta-service.d.ts +2 -1
  16. package/dist/services/scoped-credential-service.d.ts +21 -0
  17. package/dist/services/scoped-credential-service.js +53 -0
  18. package/dist/testing/service-tests/ai-storage-service-tests.js +76 -0
  19. package/dist/types/core.types.d.ts +2 -3
  20. package/dist/types/state.types.d.ts +19 -1
  21. package/dist/wirings/actor-flow/index.d.ts +1 -1
  22. package/dist/wirings/ai-agent/ai-agent-finalize.d.ts +58 -0
  23. package/dist/wirings/ai-agent/ai-agent-finalize.js +138 -0
  24. package/dist/wirings/ai-agent/ai-agent-interrupt.js +1 -0
  25. package/dist/wirings/ai-agent/ai-agent-memory.d.ts +2 -8
  26. package/dist/wirings/ai-agent/ai-agent-memory.js +34 -17
  27. package/dist/wirings/ai-agent/ai-agent-model-config.d.ts +7 -0
  28. package/dist/wirings/ai-agent/ai-agent-model-config.js +44 -1
  29. package/dist/wirings/ai-agent/ai-agent-prepare.js +4 -0
  30. package/dist/wirings/ai-agent/ai-agent-runner.js +61 -40
  31. package/dist/wirings/ai-agent/ai-agent-stream.js +89 -36
  32. package/dist/wirings/ai-agent/ai-agent-turn.d.ts +1 -0
  33. package/dist/wirings/ai-agent/ai-agent-turn.js +1 -0
  34. package/dist/wirings/ai-agent/ai-agent.types.d.ts +46 -1
  35. package/dist/wirings/ai-agent/index.d.ts +8 -7
  36. package/dist/wirings/ai-agent/index.js +5 -4
  37. package/dist/wirings/ai-scorer/ai-scorer-grade.d.ts +26 -0
  38. package/dist/wirings/ai-scorer/ai-scorer-grade.js +33 -0
  39. package/dist/wirings/ai-scorer/ai-scorer-judge.d.ts +17 -0
  40. package/dist/wirings/ai-scorer/ai-scorer-judge.js +92 -0
  41. package/dist/wirings/ai-scorer/ai-scorer-live.d.ts +15 -0
  42. package/dist/wirings/ai-scorer/ai-scorer-live.js +38 -0
  43. package/dist/wirings/ai-scorer/ai-scorer-registry.d.ts +18 -0
  44. package/dist/wirings/ai-scorer/ai-scorer-registry.js +46 -0
  45. package/dist/wirings/ai-scorer/ai-scorer-sampling.d.ts +8 -0
  46. package/dist/wirings/ai-scorer/ai-scorer-sampling.js +31 -0
  47. package/dist/wirings/ai-scorer/ai-scorer-snapshots.d.ts +10 -0
  48. package/dist/wirings/ai-scorer/ai-scorer-snapshots.js +40 -0
  49. package/dist/wirings/ai-scorer/ai-scorer-worker.d.ts +15 -0
  50. package/dist/wirings/ai-scorer/ai-scorer-worker.js +58 -0
  51. package/dist/wirings/ai-scorer/ai-scorer.d.ts +39 -0
  52. package/dist/wirings/ai-scorer/ai-scorer.js +40 -0
  53. package/dist/wirings/ai-scorer/ai-scorer.types.d.ts +90 -0
  54. package/dist/wirings/ai-scorer/ai-scorer.types.js +4 -0
  55. package/dist/wirings/ai-scorer/index.d.ts +6 -0
  56. package/dist/wirings/ai-scorer/index.js +5 -0
  57. package/dist/wirings/channel/index.d.ts +5 -6
  58. package/dist/wirings/channel/index.js +3 -4
  59. package/dist/wirings/channel/local/local-channel-runner.js +8 -1
  60. package/dist/wirings/cli/channel/cli-raw-channel-runner.js +9 -1
  61. package/dist/wirings/cli/channel/index.d.ts +1 -2
  62. package/dist/wirings/cli/channel/index.js +0 -1
  63. package/dist/wirings/cli/cli-runner.js +13 -1
  64. package/dist/wirings/credential/index.d.ts +1 -1
  65. package/dist/wirings/gateway/index.d.ts +1 -1
  66. package/dist/wirings/http/http-runner.js +8 -2
  67. package/dist/wirings/http/index.d.ts +1 -2
  68. package/dist/wirings/mcp/index.d.ts +1 -1
  69. package/dist/wirings/mcp/mcp-runner.d.ts +15 -0
  70. package/dist/wirings/mcp/mcp-runner.js +18 -5
  71. package/dist/wirings/persona/index.d.ts +3 -4
  72. package/dist/wirings/persona/index.js +2 -3
  73. package/dist/wirings/queue/index.d.ts +1 -3
  74. package/dist/wirings/queue/index.js +1 -3
  75. package/dist/wirings/rpc/addon-runner.d.ts +8 -0
  76. package/dist/wirings/rpc/addon-runner.js +31 -3
  77. package/dist/wirings/rpc/rpc-runner.js +4 -0
  78. package/dist/wirings/rpc/rpc-types.d.ts +8 -0
  79. package/dist/wirings/rpc/wire-addon.d.ts +25 -0
  80. package/dist/wirings/rpc/wire-addon.js +8 -0
  81. package/dist/wirings/scheduler/index.d.ts +1 -1
  82. package/dist/wirings/trigger/index.d.ts +1 -1
  83. package/dist/wirings/virtual-user/index.d.ts +5 -6
  84. package/dist/wirings/virtual-user/index.js +2 -4
  85. package/dist/wirings/workflow/dsl/workflow-dsl.types.d.ts +85 -15
  86. package/dist/wirings/workflow/feature.d.ts +2 -1
  87. package/dist/wirings/workflow/index.d.ts +5 -16
  88. package/dist/wirings/workflow/index.js +1 -9
  89. package/dist/wirings/workflow/pikku-scenario-service.d.ts +17 -7
  90. package/dist/wirings/workflow/pikku-scenario-service.js +48 -13
  91. package/dist/wirings/workflow/pikku-workflow-service.js +17 -3
  92. package/dist/wirings/workflow/scenario-step.types.d.ts +8 -0
  93. package/dist/wirings/workflow/scenario.types.d.ts +37 -0
  94. package/dist/wirings/workflow/workflow-approval-audit.d.ts +16 -0
  95. package/dist/wirings/workflow/workflow-approval-audit.js +40 -0
  96. package/dist/wirings/workflow/workflow-approval-policy.d.ts +20 -0
  97. package/dist/wirings/workflow/workflow-approval-policy.js +48 -0
  98. package/dist/wirings/workflow/workflow-approval.d.ts +29 -1
  99. package/dist/wirings/workflow/workflow-approval.js +65 -2
  100. package/dist/wirings/workflow/workflow-run-ownership.d.ts +2 -1
  101. package/dist/wirings/workflow/workflow-run-ownership.js +2 -1
  102. package/dist/wirings/workflow/workflow.types.d.ts +2 -37
  103. package/knowledge/decisions/internals/addon-pikku-meta-ships-at-the-package-root-or-under-dist.md +32 -0
  104. package/knowledge/decisions/internals/an-addon-scope-root-loses-to-a-root-the-host-already-declares.md +39 -0
  105. package/knowledge/decisions/internals/index.md +30 -3
  106. package/knowledge/decisions/internals/validate-runs-checks-by-precondition.md +115 -0
  107. package/knowledge/decisions/security/a-function-never-receives-the-secret-service.md +37 -0
  108. package/knowledge/decisions/security/a-workflow-run-is-read-and-approved-by-its-owner.md +30 -14
  109. package/knowledge/decisions/security/an-approval-answer-outlives-the-run-it-answered.md +59 -0
  110. package/knowledge/decisions/security/index.md +3 -1
  111. package/knowledge/questions/index.md +1 -1
  112. package/package.json +3 -2
  113. package/scripts/generate-api-report.mts +143 -18
  114. package/src/api-report.test.ts +2 -2
  115. package/src/errors/index.ts +1 -1
  116. package/src/function/function-runner.test.ts +52 -0
  117. package/src/function/function-runner.ts +5 -9
  118. package/src/function/index.ts +0 -2
  119. package/src/index.ts +0 -35
  120. package/src/pikku-state.ts +5 -0
  121. package/src/public-surface.json +81 -118
  122. package/src/services/ai-agent-runner-service.ts +12 -1
  123. package/src/services/ai-run-state-service.ts +11 -0
  124. package/src/services/in-memory-ai-run-state-service.ts +13 -0
  125. package/src/services/index.ts +7 -58
  126. package/src/services/meta-service.ts +2 -4
  127. package/src/services/scoped-credential-service.test.ts +86 -0
  128. package/src/services/scoped-credential-service.ts +63 -0
  129. package/src/testing/service-tests/ai-storage-service-tests.ts +93 -0
  130. package/src/types/core.types.ts +4 -7
  131. package/src/types/state.types.ts +21 -1
  132. package/src/wirings/actor-flow/index.ts +0 -3
  133. package/src/wirings/ai-agent/ai-agent-finalize.test.ts +186 -0
  134. package/src/wirings/ai-agent/ai-agent-finalize.ts +197 -0
  135. package/src/wirings/ai-agent/ai-agent-interrupt.ts +1 -0
  136. package/src/wirings/ai-agent/ai-agent-memory.ts +54 -38
  137. package/src/wirings/ai-agent/ai-agent-model-config.test.ts +72 -3
  138. package/src/wirings/ai-agent/ai-agent-model-config.ts +49 -1
  139. package/src/wirings/ai-agent/ai-agent-prepare.ts +4 -0
  140. package/src/wirings/ai-agent/ai-agent-runner.ts +71 -40
  141. package/src/wirings/ai-agent/ai-agent-stream-output-hooks.test.ts +353 -0
  142. package/src/wirings/ai-agent/ai-agent-stream.ts +116 -54
  143. package/src/wirings/ai-agent/ai-agent-turn.test.ts +67 -0
  144. package/src/wirings/ai-agent/ai-agent-turn.ts +1 -0
  145. package/src/wirings/ai-agent/ai-agent.types.ts +64 -4
  146. package/src/wirings/ai-agent/index.ts +2 -16
  147. package/src/wirings/ai-scorer/ai-scorer-grade.test.ts +106 -0
  148. package/src/wirings/ai-scorer/ai-scorer-grade.ts +55 -0
  149. package/src/wirings/ai-scorer/ai-scorer-judge.test.ts +143 -0
  150. package/src/wirings/ai-scorer/ai-scorer-judge.ts +120 -0
  151. package/src/wirings/ai-scorer/ai-scorer-live.test.ts +174 -0
  152. package/src/wirings/ai-scorer/ai-scorer-live.ts +56 -0
  153. package/src/wirings/ai-scorer/ai-scorer-registry.ts +63 -0
  154. package/src/wirings/ai-scorer/ai-scorer-sampling.test.ts +34 -0
  155. package/src/wirings/ai-scorer/ai-scorer-sampling.ts +36 -0
  156. package/src/wirings/ai-scorer/ai-scorer-snapshots.test.ts +49 -0
  157. package/src/wirings/ai-scorer/ai-scorer-snapshots.ts +46 -0
  158. package/src/wirings/ai-scorer/ai-scorer-worker.test.ts +122 -0
  159. package/src/wirings/ai-scorer/ai-scorer-worker.ts +69 -0
  160. package/src/wirings/ai-scorer/ai-scorer.ts +76 -0
  161. package/src/wirings/ai-scorer/ai-scorer.types.ts +107 -0
  162. package/src/wirings/ai-scorer/index.ts +24 -0
  163. package/src/wirings/channel/index.ts +1 -20
  164. package/src/wirings/channel/local/local-channel-runner.test.ts +68 -0
  165. package/src/wirings/channel/local/local-channel-runner.ts +8 -1
  166. package/src/wirings/cli/channel/cli-raw-channel-runner.test.ts +23 -0
  167. package/src/wirings/cli/channel/cli-raw-channel-runner.ts +12 -1
  168. package/src/wirings/cli/channel/index.ts +0 -7
  169. package/src/wirings/cli/cli-runner.test.ts +68 -0
  170. package/src/wirings/cli/cli-runner.ts +18 -1
  171. package/src/wirings/credential/index.ts +0 -1
  172. package/src/wirings/gateway/index.ts +0 -3
  173. package/src/wirings/http/http-runner.test.ts +66 -0
  174. package/src/wirings/http/http-runner.ts +10 -2
  175. package/src/wirings/http/index.ts +1 -1
  176. package/src/wirings/mcp/index.ts +0 -1
  177. package/src/wirings/mcp/mcp-runner.test.ts +181 -0
  178. package/src/wirings/mcp/mcp-runner.ts +35 -5
  179. package/src/wirings/persona/index.ts +0 -8
  180. package/src/wirings/queue/index.ts +0 -14
  181. package/src/wirings/rpc/addon-runner.ts +62 -3
  182. package/src/wirings/rpc/addon-secrets.test.ts +391 -0
  183. package/src/wirings/rpc/rpc-runner.test.ts +2 -0
  184. package/src/wirings/rpc/rpc-runner.ts +4 -0
  185. package/src/wirings/rpc/rpc-types.ts +8 -0
  186. package/src/wirings/rpc/wire-addon.ts +33 -0
  187. package/src/wirings/scheduler/index.ts +0 -1
  188. package/src/wirings/trigger/index.ts +0 -1
  189. package/src/wirings/virtual-user/index.ts +0 -16
  190. package/src/wirings/workflow/dsl/workflow-dsl.types.ts +96 -16
  191. package/src/wirings/workflow/feature.ts +2 -5
  192. package/src/wirings/workflow/graph/graph-runner.test.ts +72 -0
  193. package/src/wirings/workflow/index.ts +2 -68
  194. package/src/wirings/workflow/pikku-scenario-service.ts +81 -16
  195. package/src/wirings/workflow/pikku-workflow-service.test.ts +13 -12
  196. package/src/wirings/workflow/pikku-workflow-service.ts +28 -4
  197. package/src/wirings/workflow/scenario-expectations.test.ts +75 -0
  198. package/src/wirings/workflow/scenario-hooks.test.ts +3 -2
  199. package/src/wirings/workflow/scenario-step.types.ts +8 -0
  200. package/src/wirings/workflow/scenario.types.ts +63 -0
  201. package/src/wirings/workflow/workflow-approval-audit.ts +47 -0
  202. package/src/wirings/workflow/workflow-approval-policy.test.ts +524 -0
  203. package/src/wirings/workflow/workflow-approval-policy.ts +68 -0
  204. package/src/wirings/workflow/workflow-approval.ts +113 -9
  205. package/src/wirings/workflow/workflow-run-authority.test.ts +12 -15
  206. package/src/wirings/workflow/workflow-run-ownership.ts +2 -1
  207. package/src/wirings/workflow/workflow.types.ts +1 -63
  208. package/src/wirings-stay-decoupled.test.ts +6 -2
  209. package/tsconfig.tsbuildinfo +1 -1
  210. package/dist/internal.d.ts +0 -3
  211. package/dist/internal.js +0 -2
  212. package/dist/middleware/timeout.d.ts +0 -9
  213. package/dist/middleware/timeout.js +0 -15
  214. package/dist/pikku-response.d.ts +0 -6
  215. package/dist/pikku-response.js +0 -6
  216. package/dist/services/gopass-secrets.d.ts +0 -15
  217. package/dist/services/gopass-secrets.js +0 -76
  218. package/dist/services/http-scenario-actors.d.ts +0 -75
  219. package/dist/services/http-scenario-actors.js +0 -195
  220. package/dist/services/http-user-flow-actors.d.ts +0 -67
  221. package/dist/services/http-user-flow-actors.js +0 -193
  222. package/dist/services/scenario-actors-service.d.ts +0 -127
  223. package/dist/services/scenario-actors-service.js +0 -40
  224. package/dist/services/user-flow-actors-service.d.ts +0 -39
  225. package/dist/wirings/credential/wire-credential.d.ts +0 -48
  226. package/dist/wirings/credential/wire-credential.js +0 -47
  227. package/dist/wirings/oauth2/oauth2-client.d.ts +0 -47
  228. package/dist/wirings/oauth2/oauth2-client.js +0 -263
  229. package/dist/wirings/oauth2/oauth2-routes.d.ts +0 -35
  230. package/dist/wirings/oauth2/oauth2-routes.js +0 -146
  231. package/dist/wirings/scope/wire-scope.d.ts +0 -33
  232. package/dist/wirings/scope/wire-scope.js +0 -32
  233. package/dist/wirings/workflow/dsl/index.d.ts +0 -5
  234. package/dist/wirings/workflow/dsl/index.js +0 -4
  235. package/dist/wirings/workflow/graph/index.d.ts +0 -5
  236. package/dist/wirings/workflow/graph/index.js +0 -4
  237. /package/dist/{services/user-flow-actors-service.js → wirings/workflow/scenario.types.js} +0 -0
@@ -1,9 +1,8 @@
1
- export { wireChannel, openChannel } from './channel-runner.js';
2
- export { addChannelMiddleware, combineChannelMiddleware, wrapChannelWithMiddleware, } from './channel-middleware-runner.js';
1
+ export { wireChannel } from './channel-runner.js';
2
+ export { addChannelMiddleware, combineChannelMiddleware, } from './channel-middleware-runner.js';
3
3
  export { logChannels } from './log-channels.js';
4
4
  export { PikkuAbstractChannelHandler } from './pikku-abstract-channel-handler.js';
5
5
  export { ChannelStore } from './channel-store.js';
6
6
  export { EventHubStore } from './eventhub-store.js';
7
7
  export { defineChannelRoutes } from './define-channel-routes.js';
8
- export { CHANNEL_RPC_PENDING, CHANNEL_RPC_REQUEST, CHANNEL_RPC_RESPONSE, ChannelDeploymentService, ChannelRPCError, ChannelRPCRegistry, createChannelRPCResponder, createChannelRPCInputValidator, createChannelRPCResultValidator, isChannelRPCPending, isChannelRPCRequest, isChannelRPCResponse, resolveCapability, unsupportedChannelRemote, } from './channel-rpc.js';
9
- export { channelRemote, getChannelHostRPC, handleChannelRPCResponse, releaseChannelHostRPC, } from './channel-host-rpc.js';
8
+ export { ChannelDeploymentService, ChannelRPCError, ChannelRPCRegistry, unsupportedChannelRemote, } from './channel-rpc.js';
@@ -135,7 +135,14 @@ export const runLocalChannel = async ({ channelId, request, response, route, ski
135
135
  channelHandler.registerOnMessage(async (data) => {
136
136
  try {
137
137
  const result = await onMessage(data);
138
- await channel.send(result);
138
+ // Guarded exactly as the connect path above is. A handler with nothing
139
+ // to say is normal — a gateway websocket's generated message handler
140
+ // always returns undefined — and sending that raised `send requires a
141
+ // non-empty message`, which surfaced as a channel that accepted a
142
+ // connection and then silently delivered nothing.
143
+ if (result !== undefined) {
144
+ await channel.send(result);
145
+ }
139
146
  }
140
147
  catch (e) {
141
148
  singletonServices.logger.error(e);
@@ -1,4 +1,5 @@
1
1
  import { pikkuState } from '../../../pikku-state.js';
2
+ import { isProduction } from '../../../env.js';
2
3
  import { parseCLIArguments, generateCommandHelp } from '../command-parser.js';
3
4
  import { runCLICommand } from '../cli-runner.js';
4
5
  /**
@@ -61,6 +62,13 @@ export async function handleRawCLI({ programName, args, singletonServices, creat
61
62
  // A command can throw anything; `.message` off a string is undefined, and
62
63
  // the run would then exit 1 saying nothing at all.
63
64
  const message = e instanceof Error ? e.message : String(e);
64
- return { error: message || 'Command failed', exitCode: 1, commandId };
65
+ // The raw message can carry internals (a stack, a DB error, a path). This
66
+ // runs over a channel that may be remote, so return a generic error in
67
+ // production and keep the detail server-side. Dev keeps the message inline.
68
+ singletonServices.logger.error?.(`CLI channel command failed: ${message}`, e);
69
+ const clientError = isProduction()
70
+ ? 'Command failed'
71
+ : message || 'Command failed';
72
+ return { error: clientError, exitCode: 1, commandId };
65
73
  }
66
74
  }
@@ -2,6 +2,5 @@ export { executeCLIViaChannel } from './cli-channel-runner.js';
2
2
  export { handleRawCLI } from './cli-raw-channel-runner.js';
3
3
  export type { RawCLIFrame, RawCLIResult } from './cli-raw-channel-runner.js';
4
4
  export { executeRawCLIViaChannel } from './cli-raw-client-runner.js';
5
- export type { ClientCLIRenderServices, CorePikkuCLIClientRender, } from './cli-raw-client-runner.js';
6
- export { APPROVAL_FLAGS, approverForMode, createTerminalApprover, takeApprovalFlags, } from './cli-approval.js';
5
+ export type { CorePikkuCLIClientRender, } from './cli-raw-client-runner.js';
7
6
  export type { ApprovalMode } from './cli-approval.js';
@@ -1,4 +1,3 @@
1
1
  export { executeCLIViaChannel } from './cli-channel-runner.js';
2
2
  export { handleRawCLI } from './cli-raw-channel-runner.js';
3
3
  export { executeRawCLIViaChannel } from './cli-raw-client-runner.js';
4
- export { APPROVAL_FLAGS, approverForMode, createTerminalApprover, takeApprovalFlags, } from './cli-approval.js';
@@ -87,7 +87,19 @@ function registerCLICommands(commands, path = [], inheritedOptions = {}, program
87
87
  programs[program].commandMiddleware[commandId] = command.middleware;
88
88
  }
89
89
  }
90
- addFunction(funcName, unwrapFunc(command), currentMeta?.packageName);
90
+ // Merge the command-level auth/permissions into the registered config so
91
+ // they are actually enforced by the function runner. They were accepted by
92
+ // the types but dropped here, making a command's declared access control a
93
+ // silent no-op. Command-level wins over the handler's own, then falls back
94
+ // to it.
95
+ const unwrapped = unwrapFunc(command);
96
+ const commandAuth = typeof command === 'object' ? command.auth : undefined;
97
+ const commandPermissions = typeof command === 'object' ? command.permissions : undefined;
98
+ addFunction(funcName, {
99
+ ...unwrapped,
100
+ auth: commandAuth ?? unwrapped.auth,
101
+ permissions: commandPermissions ?? unwrapped.permissions,
102
+ }, currentMeta?.packageName);
91
103
  if (typeof command === 'object' && command.render) {
92
104
  if (programs[program]) {
93
105
  programs[program].renderers[commandId] = command.render;
@@ -1,3 +1,3 @@
1
1
  export { defineCredential } from './define-credential.js';
2
2
  export { validateAndBuildCredentialDefinitionsMeta } from './validate-credential-definitions.js';
3
- export type { CoreCredential, CredentialDefinitionMeta, CredentialDefinitionsMeta, CredentialDefinitions, } from './credential.types.js';
3
+ export type { CoreCredential, CredentialDefinitionsMeta, CredentialDefinitions, } from './credential.types.js';
@@ -1,2 +1,2 @@
1
1
  export { wireGateway, createListenerMessageHandler, resolveGatewayAdapter, } from './gateway-runner.js';
2
- export type { GatewayAdapter, GatewayAdapterFactory, GatewayAttachment, GatewayInboundMessage, GatewayOutboundMessage, GatewayMeta, GatewaysMeta, GatewayTransportType, CoreGateway, PikkuGateway, WebhookVerificationResult, } from './gateway.types.js';
2
+ export type { GatewayAdapter, GatewayAdapterFactory, GatewayInboundMessage, GatewayOutboundMessage, GatewaysMeta, GatewayTransportType, CoreGateway, WebhookVerificationResult, } from './gateway.types.js';
@@ -173,6 +173,7 @@ const executeRoute = async (services, matchedRoute, http, options) => {
173
173
  getSession: () => userSession.get(),
174
174
  hasSessionChanged: () => userSession.sessionChanged,
175
175
  };
176
+ const statusBeforeRoute = http?.response?.statusCode;
176
177
  try {
177
178
  result = await runPikkuFunc('http', `${meta.method}:${meta.route}`, meta.pikkuFuncId, {
178
179
  singletonServices,
@@ -209,17 +210,22 @@ const executeRoute = async (services, matchedRoute, http, options) => {
209
210
  http?.response?.flushHeaders?.();
210
211
  }
211
212
  else {
213
+ const statusSetByRoute = http?.response?.statusCode !== statusBeforeRoute;
212
214
  if (result instanceof Response) {
213
215
  await applyWebResponse(http.response, result);
214
216
  }
215
217
  else if (result === undefined || result === null) {
216
- http?.response?.status(204);
218
+ if (!statusSetByRoute) {
219
+ http?.response?.status(204);
220
+ }
217
221
  }
218
222
  else if (route.returnsJSON === false) {
219
223
  http?.response?.arrayBuffer(result);
220
224
  }
221
225
  else {
222
- http?.response?.status(200);
226
+ if (!statusSetByRoute) {
227
+ http?.response?.status(200);
228
+ }
223
229
  http?.response?.json(result);
224
230
  }
225
231
  }
@@ -1,8 +1,7 @@
1
1
  export { PikkuFetchHTTPRequest, DEFAULT_MAX_BODY_SIZE, } from './pikku-fetch-http-request.js';
2
- export type { PikkuFetchHTTPRequestOptions } from './pikku-fetch-http-request.js';
3
2
  export { PikkuFetchHTTPResponse } from './pikku-fetch-http-response.js';
4
3
  export { logRoutes } from './log-http-routes.js';
5
4
  export { fetch, fetchData, wireHTTP, addHTTPMiddleware } from './http-runner.js';
6
5
  export { wireHTTPRoutes, defineHTTPRoutes } from './http-routes.js';
7
6
  export { toWebRequest, applyWebResponse } from './web-request.js';
8
- export type { AssertHTTPWiringParams, CoreHTTPFunctionWiring, HTTPMethod, HTTPRouteBaseConfig, HTTPRouteContract, HTTPRouteMap, HTTPWiringsMeta, PikkuHTTPRequest, PikkuHTTPResponse, PikkuQuery, RunHTTPWiringOptions, } from './http.types.js';
7
+ export type { AssertHTTPWiringParams, CoreHTTPFunctionWiring, HTTPMethod, HTTPRouteBaseConfig, HTTPRouteContract, HTTPRouteMap, HTTPWiringsMeta, PikkuHTTP, PikkuHTTPRequest, PikkuHTTPResponse, PikkuQuery, RunHTTPWiringOptions, } from './http.types.js';
@@ -1,4 +1,4 @@
1
1
  export { MCPEndpointRegistry } from './mcp-endpoint-registry.js';
2
2
  export { MCPError, wireMCPResource, wireMCPPrompt, runMCPResource, runMCPTool, runMCPPrompt, } from './mcp-runner.js';
3
3
  export { getMCPResourcesMeta, getMCPToolsMeta, getMCPPromptsMeta, } from './mcp-runner.js';
4
- export type { AssertMCPResourceURIParams, CoreMCPPrompt, CoreMCPResource, CoreMCPTool, MCPPromptResponse, MCPResourceMeta, MCPResourceResponse, MCPToolMeta, MCPToolResponse, MCPPromptMeta, PikkuMCP, } from './mcp.types.js';
4
+ export type { AssertMCPResourceURIParams, CoreMCPPrompt, CoreMCPResource, MCPPromptResponse, MCPResourceMeta, MCPResourceResponse, MCPToolMeta, MCPToolResponse, MCPPromptMeta, PikkuMCP, } from './mcp.types.js';
@@ -1,3 +1,4 @@
1
+ import type { PikkuHTTP } from '../http/http.types.js';
1
2
  import type { CoreMCPResource, CoreMCPPrompt, JsonRpcRequest, JsonRpcResponse, JsonRpcErrorResponse, PikkuMCP } from './mcp.types.js';
2
3
  import type { CorePikkuFunctionConfig, CorePikkuFunctionSessionless } from '../../function/functions.types.js';
3
4
  export declare class MCPError extends Error {
@@ -6,6 +7,20 @@ export declare class MCPError extends Error {
6
7
  }
7
8
  export type RunMCPEndpointParams<Tools extends string = any> = {
8
9
  mcp?: PikkuMCP<Tools>;
10
+ /**
11
+ * The HTTP request the MCP call arrived on, when it arrived over HTTP.
12
+ *
13
+ * Auth middleware reads the session off `wire.http.request` — every
14
+ * implementation opens with `if (!http?.request) return` — so without this an
15
+ * MCP call reaches the function unauthenticated no matter what middleware the
16
+ * app has registered, and a tool fronting a session-requiring function can
17
+ * only ever answer 'Authentication required'.
18
+ *
19
+ * Left undefined for transports that have no request to offer, such as stdio.
20
+ * Those remain anonymous, which is a property of the transport rather than a
21
+ * default chosen here.
22
+ */
23
+ http?: PikkuHTTP;
9
24
  /** Defaults to enabled outside production. */
10
25
  exposeErrors?: boolean;
11
26
  };
@@ -48,6 +48,11 @@ export async function runMCPResource(request, params, uri) {
48
48
  let extractedParams = {};
49
49
  const metas = pikkuState(null, 'mcp', 'resourcesMeta');
50
50
  const endpoints = pikkuState(null, 'mcp', 'resources');
51
+ // The key the resource's meta (and its middleware) is stored under. For a
52
+ // templated resource this is the template, not the concrete request URI — so
53
+ // it must be carried forward, or the meta lookup downstream misses and the
54
+ // resource's declared middleware (including auth) is silently skipped.
55
+ let metaKey = uri;
51
56
  if (endpoints.has(uri)) {
52
57
  endpoint = endpoints.get(uri);
53
58
  pikkuFuncId = metas[uri]?.pikkuFuncId;
@@ -60,6 +65,7 @@ export async function runMCPResource(request, params, uri) {
60
65
  const match = uri.match(regex);
61
66
  if (match) {
62
67
  endpoint = value;
68
+ metaKey = uriTemplate;
63
69
  pikkuFuncId = metas[uriTemplate]?.pikkuFuncId;
64
70
  for (let i = 0; i < paramNames.length; i++) {
65
71
  extractedParams[paramNames[i]] = match[i + 1]; // match[0] is the full match
@@ -71,7 +77,7 @@ export async function runMCPResource(request, params, uri) {
71
77
  return await runMCPPikkuFunc({
72
78
  ...request,
73
79
  params: { ...request.params, ...extractedParams },
74
- }, 'resource', uri, endpoint, pikkuFuncId, { ...params, mcp: { ...params.mcp, uri } });
80
+ }, 'resource', uri, endpoint, pikkuFuncId, { ...params, mcp: { ...params.mcp, uri } }, metaKey);
75
81
  }
76
82
  export async function runMCPTool(request, params, name) {
77
83
  const meta = pikkuState(null, 'mcp', 'toolsMeta')[name];
@@ -82,7 +88,11 @@ export async function runMCPPrompt(request, params, name) {
82
88
  const meta = pikkuState(null, 'mcp', 'promptsMeta')[name];
83
89
  return await runMCPPikkuFunc(request, 'prompt', name, endpoint, meta?.pikkuFuncId, params);
84
90
  }
85
- async function runMCPPikkuFunc(request, type, name, mcp, pikkuFuncId, { mcp: mcpWire, exposeErrors = !isProduction() }) {
91
+ async function runMCPPikkuFunc(request, type, name, mcp, pikkuFuncId, { mcp: mcpWire, http, exposeErrors = !isProduction() },
92
+ // The key the endpoint's meta is stored under. Differs from `name` only for a
93
+ // templated resource, where `name` is the concrete URI and the meta lives
94
+ // under the template. Defaults to `name` for tools and prompts.
95
+ metaKey = name) {
86
96
  const singletonServices = getSingletonServices();
87
97
  const createWireServices = getCreateWireServices();
88
98
  try {
@@ -99,17 +109,20 @@ async function runMCPPikkuFunc(request, type, name, mcp, pikkuFuncId, { mcp: mcp
99
109
  const mcpSessionService = new PikkuSessionService(singletonServices.sessionStore);
100
110
  const wire = {
101
111
  mcp: mcpWire,
112
+ // Only when the transport supplied one. Setting `http: undefined`
113
+ // explicitly would be the same to a reader and different to a spread.
114
+ ...(http ? { http } : {}),
102
115
  ...createMiddlewareSessionWireProps(mcpSessionService),
103
116
  };
104
117
  let meta;
105
118
  if (type === 'resource') {
106
- meta = pikkuState(null, 'mcp', 'resourcesMeta')[name];
119
+ meta = pikkuState(null, 'mcp', 'resourcesMeta')[metaKey];
107
120
  }
108
121
  else if (type === 'tool') {
109
- meta = pikkuState(null, 'mcp', 'toolsMeta')[name];
122
+ meta = pikkuState(null, 'mcp', 'toolsMeta')[metaKey];
110
123
  }
111
124
  else if (type === 'prompt') {
112
- meta = pikkuState(null, 'mcp', 'promptsMeta')[name];
125
+ meta = pikkuState(null, 'mcp', 'promptsMeta')[metaKey];
113
126
  }
114
127
  let resolvedFuncName = pikkuFuncId;
115
128
  let resolvedPackageName = meta?.packageName ?? null;
@@ -1,12 +1,11 @@
1
1
  export { definePersonas } from './define-personas.js';
2
2
  export { isRunnablePersona, roleMismatchMessage, runnablePersonas, validateAndBuildPersonasMeta, verifyPersonaRoles, } from './validate-personas.js';
3
3
  export type { RoleVerification } from './validate-personas.js';
4
- export { personaEnvironmentErrors, personaEnvironmentRefusal, resolvePersonaEnvironments, } from './persona-environments.js';
4
+ export { personaEnvironmentErrors, personaEnvironmentRefusal, } from './persona-environments.js';
5
5
  export type { PersonaEnvironment, PersonaEnvironmentSubject, } from './persona-environments.js';
6
- export { personaEmail, personaEmailLabel, personaEmails, } from './persona-email.js';
7
- export { allowedLinks, applyMailboxAllowlist, isAllowedSender, } from './persona-mailbox.js';
6
+ export { personaEmail, personaEmails, } from './persona-email.js';
8
7
  export type { MailboxAllowlist, PersonaMailbox, ReceivedEmail, } from './persona-mailbox.js';
9
- export type { CorePersona, CorePersonaAccount, CorePersonas, PersonaAccountMeta, PersonaDefinitions, PersonaMeta, PersonasMeta, } from './persona.types.js';
8
+ export type { CorePersona, CorePersonas, PersonaAccountMeta, PersonaDefinitions, PersonaMeta, PersonasMeta, } from './persona.types.js';
10
9
  /**
11
10
  * Signing in as a persona and talking to a stage over HTTP.
12
11
  *
@@ -1,8 +1,7 @@
1
1
  export { definePersonas } from './define-personas.js';
2
2
  export { isRunnablePersona, roleMismatchMessage, runnablePersonas, validateAndBuildPersonasMeta, verifyPersonaRoles, } from './validate-personas.js';
3
- export { personaEnvironmentErrors, personaEnvironmentRefusal, resolvePersonaEnvironments, } from './persona-environments.js';
4
- export { personaEmail, personaEmailLabel, personaEmails, } from './persona-email.js';
5
- export { allowedLinks, applyMailboxAllowlist, isAllowedSender, } from './persona-mailbox.js';
3
+ export { personaEnvironmentErrors, personaEnvironmentRefusal, } from './persona-environments.js';
4
+ export { personaEmail, personaEmails, } from './persona-email.js';
6
5
  /**
7
6
  * Signing in as a persona and talking to a stage over HTTP.
8
7
  *
@@ -1,9 +1,7 @@
1
1
  export type { ConfigValidationResult, CoreQueueWorker, GroupConcurrencyConfig, JobGroup, JobOptions, PikkuJobConfig, PikkuWorkerConfig, PikkuQueue, QueueJob, QueueJobStatus, QueueService, QueueWorkers, QueueWorkersMeta, } from './queue.types.js';
2
- export { wireQueueWorker, runQueueJob, getQueueWorkers, removeQueueWorker, QueueJobDiscardedError, QueueJobFailedError, } from './queue-runner.js';
3
- export { QUEUE_IDENTITY_CLAIM_VERSION, QUEUE_IDENTITY_INFO, QUEUE_IDENTITY_SECRET_NAME, getQueueIdentitySecret, resolveQueueJobIdentity, signQueueIdentity, verifyQueueIdentity, } from './queue-identity.js';
2
+ export { wireQueueWorker, runQueueJob, QueueJobDiscardedError, QueueJobFailedError, } from './queue-runner.js';
4
3
  export type { QueueIdentityBinding } from './queue-identity.js';
5
4
  export { SignedQueueService } from './signed-queue-service.js';
6
- export { validateWorkerConfig } from './validate-worker-config.js';
7
5
  export type { QueueConfigMapping } from './validate-worker-config.js';
8
6
  export { registerQueueWorkers } from './register-queue-helper.js';
9
7
  export type { QueueRegistrationCallback } from './register-queue-helper.js';
@@ -1,5 +1,3 @@
1
- export { wireQueueWorker, runQueueJob, getQueueWorkers, removeQueueWorker, QueueJobDiscardedError, QueueJobFailedError, } from './queue-runner.js';
2
- export { QUEUE_IDENTITY_CLAIM_VERSION, QUEUE_IDENTITY_INFO, QUEUE_IDENTITY_SECRET_NAME, getQueueIdentitySecret, resolveQueueJobIdentity, signQueueIdentity, verifyQueueIdentity, } from './queue-identity.js';
1
+ export { wireQueueWorker, runQueueJob, QueueJobDiscardedError, QueueJobFailedError, } from './queue-runner.js';
3
2
  export { SignedQueueService } from './signed-queue-service.js';
4
- export { validateWorkerConfig } from './validate-worker-config.js';
5
3
  export { registerQueueWorkers } from './register-queue-helper.js';
@@ -4,6 +4,14 @@ export type AddonInstance = {
4
4
  secretOverrides?: Record<string, string>;
5
5
  variableOverrides?: Record<string, string>;
6
6
  credentialOverrides?: Record<string, string>;
7
+ /** Set by the consuming app: secrets it lends this instance, as the addon names them. */
8
+ secretGrants?: string[];
9
+ /** Set by the consuming app: credentials it lends this instance, as the addon names them. */
10
+ credentialGrants?: string[];
11
+ /** Set by the consuming app to opt this instance out of secret scoping. */
12
+ globalSecrets?: string;
13
+ /** Set by the consuming app to opt this instance out of credential scoping. */
14
+ globalCredentials?: string;
7
15
  };
8
16
  export declare const getOrCreatePackageSingletonServices: (packageName: string, parentServices: CoreSingletonServices, addonInstance?: AddonInstance) => Promise<CoreSingletonServices>;
9
17
  export declare const addonInstanceForNamespace: (namespace: string | undefined, expectedPackage: string) => AddonInstance | undefined;
@@ -1,4 +1,16 @@
1
1
  import { pikkuState } from '../../pikku-state.js';
2
+ import { ScopedSecretService } from '../../services/scoped-secret-service.js';
3
+ import { ScopedCredentialService } from '../../services/scoped-credential-service.js';
4
+ /**
5
+ * What the addon declared, plus what the host lent it. Scoping runs outside the
6
+ * aliaser, so every name here is the one the addon reads — which is why an
7
+ * override's *key* grants, and its value does not.
8
+ */
9
+ const allowedNames = (declared, grants, overrides) => new Set([
10
+ ...(declared ?? []),
11
+ ...(grants ?? []),
12
+ ...Object.keys(overrides ?? {}),
13
+ ]);
2
14
  const aliasSecretService = (secrets, overrides) => {
3
15
  const map = (key) => overrides[key] ?? key;
4
16
  return {
@@ -79,9 +91,6 @@ export const getOrCreatePackageSingletonServices = async (packageName, parentSer
79
91
  return cachedServices;
80
92
  }
81
93
  const factories = pikkuState(packageName, 'package', 'factories');
82
- if (!factories || !factories.createSingletonServices) {
83
- return parentServices;
84
- }
85
94
  let existingServices = parentServices;
86
95
  if (addonInstance?.secretOverrides && parentServices.secrets) {
87
96
  existingServices = {
@@ -95,6 +104,21 @@ export const getOrCreatePackageSingletonServices = async (packageName, parentSer
95
104
  variables: aliasVariablesService(parentServices.variables, addonInstance.variableOverrides),
96
105
  };
97
106
  }
107
+ if (!addonInstance?.globalSecrets && existingServices.secrets) {
108
+ existingServices = {
109
+ ...existingServices,
110
+ secrets: new ScopedSecretService(existingServices.secrets, allowedNames(pikkuState(packageName, 'package', 'declaredSecrets'), addonInstance?.secretGrants, addonInstance?.secretOverrides)),
111
+ };
112
+ }
113
+ if (!addonInstance?.globalCredentials && existingServices.credentialService) {
114
+ existingServices = {
115
+ ...existingServices,
116
+ credentialService: new ScopedCredentialService(existingServices.credentialService, allowedNames(Object.keys(pikkuState(packageName, 'package', 'credentialsMeta') ?? {}), addonInstance?.credentialGrants, addonInstance?.credentialOverrides)),
117
+ };
118
+ }
119
+ if (!factories || !factories.createSingletonServices) {
120
+ return existingServices;
121
+ }
98
122
  let config = existingServices.config;
99
123
  if (factories.createConfig) {
100
124
  config = await factories.createConfig(existingServices.variables);
@@ -118,5 +142,9 @@ export const addonInstanceForNamespace = (namespace, expectedPackage) => {
118
142
  secretOverrides: cfg.secretOverrides,
119
143
  variableOverrides: cfg.variableOverrides,
120
144
  credentialOverrides: cfg.credentialOverrides,
145
+ secretGrants: cfg.secretGrants,
146
+ credentialGrants: cfg.credentialGrants,
147
+ globalSecrets: cfg.globalSecrets,
148
+ globalCredentials: cfg.globalCredentials,
121
149
  };
122
150
  };
@@ -203,6 +203,10 @@ export class ContextAwareRPCService {
203
203
  secretOverrides: resolved.addonConfig?.secretOverrides,
204
204
  variableOverrides: resolved.addonConfig?.variableOverrides,
205
205
  credentialOverrides: resolved.addonConfig?.credentialOverrides,
206
+ secretGrants: resolved.addonConfig?.secretGrants,
207
+ credentialGrants: resolved.addonConfig?.credentialGrants,
208
+ globalSecrets: resolved.addonConfig?.globalSecrets,
209
+ globalCredentials: resolved.addonConfig?.globalCredentials,
206
210
  },
207
211
  };
208
212
  }
@@ -48,6 +48,14 @@ export interface ResolvedFunction {
48
48
  secretOverrides?: Record<string, string>;
49
49
  variableOverrides?: Record<string, string>;
50
50
  credentialOverrides?: Record<string, string>;
51
+ /** Set by the consuming app: secrets it lends this instance, as the addon names them */
52
+ secretGrants?: string[];
53
+ /** Set by the consuming app: credentials it lends this instance, as the addon names them */
54
+ credentialGrants?: string[];
55
+ /** Set by the consuming app: hand this instance the unscoped `SecretService` */
56
+ globalSecrets?: string;
57
+ /** Set by the consuming app: hand this instance the unscoped `CredentialService` */
58
+ globalCredentials?: string;
51
59
  /** Set by `wireRemoteAddon`: dispatch this namespace's RPCs over HTTP */
52
60
  remote?: boolean;
53
61
  serverUrl?: string | ((services: any) => string | Promise<string>);
@@ -11,6 +11,31 @@ export type WireAddonConfig = {
11
11
  secretOverrides?: Record<string, string>;
12
12
  variableOverrides?: Record<string, string>;
13
13
  credentialOverrides?: Record<string, string>;
14
+ /**
15
+ * Secrets this instance may read on top of the ones it declared, named as the
16
+ * addon reads them — the scope check runs before `secretOverrides` renames
17
+ * them, so an overridden secret is named here by its addon-side key. Listing
18
+ * one in `secretOverrides` grants it too.
19
+ *
20
+ * For an addon whose secret names come off its input rather than its own
21
+ * source, this is how the host lends names the addon could not declare.
22
+ */
23
+ secretGrants?: string[];
24
+ /** Credentials this instance may read on top of the ones it declared. */
25
+ credentialGrants?: string[];
26
+ /**
27
+ * Hands this instance the whole `SecretService` instead of one scoped to the
28
+ * secrets it declared. The value is the reason, recorded in the deploy
29
+ * manifest — an addon that names secrets at runtime cannot be scoped, and
30
+ * only the consuming app, never the addon, can grant it.
31
+ */
32
+ globalSecrets?: string;
33
+ /**
34
+ * Hands this instance the whole `CredentialService` instead of one narrowed
35
+ * to the credentials it declared. The value is the reason, recorded in the
36
+ * deploy manifest, and only the consuming app can grant it.
37
+ */
38
+ globalCredentials?: string;
14
39
  };
15
40
  export declare const wireAddon: (config: WireAddonConfig) => void;
16
41
  /**
@@ -16,6 +16,14 @@ export const wireAddon = (config) => {
16
16
  ...(config.credentialOverrides
17
17
  ? { credentialOverrides: config.credentialOverrides }
18
18
  : {}),
19
+ ...(config.secretGrants ? { secretGrants: config.secretGrants } : {}),
20
+ ...(config.credentialGrants
21
+ ? { credentialGrants: config.credentialGrants }
22
+ : {}),
23
+ ...(config.globalSecrets ? { globalSecrets: config.globalSecrets } : {}),
24
+ ...(config.globalCredentials
25
+ ? { globalCredentials: config.globalCredentials }
26
+ : {}),
19
27
  });
20
28
  };
21
29
  /**
@@ -1,3 +1,3 @@
1
1
  export { runScheduledTask, wireScheduler, getScheduledTasks, } from './scheduler-runner.js';
2
2
  export { logSchedulers } from './log-schedulers.js';
3
- export type { CoreScheduledTask, ScheduledTasksMeta, PikkuScheduledTask, } from './scheduler.types.js';
3
+ export type { CoreScheduledTask, ScheduledTasksMeta, } from './scheduler.types.js';
@@ -1,3 +1,3 @@
1
1
  export { wireTrigger, wireTriggerSource } from './trigger-runner.js';
2
2
  export { PikkuTriggerService } from './pikku-trigger-service.js';
3
- export type { TriggerMeta, TriggerSourceMeta, CorePikkuTriggerFunction, CorePikkuTriggerFunctionConfig, CoreTrigger, PikkuTrigger, } from './trigger.types.js';
3
+ export type { TriggerMeta, TriggerSourceMeta, CorePikkuTriggerFunction, CorePikkuTriggerFunctionConfig, CoreTrigger, } from './trigger.types.js';
@@ -16,15 +16,14 @@
16
16
  * {@link VirtualUserTarget}, which in production is an `HttpPersona`
17
17
  * signed in as a real user against staging or production.
18
18
  */
19
- export type { ApiCatalogueEntry, IntentRecord, IntentSource, IntentStatus, StepRecord, VirtualUserAction, VirtualUserBudget, VirtualUserDisposition, VirtualUserFinding, VirtualUserFindingKind, VirtualUserRunResult, VirtualUserTally, VirtualUserTarget, } from './virtual-user.types.js';
19
+ export type { ApiCatalogueEntry, IntentSource, VirtualUserDisposition, VirtualUserFinding, VirtualUserRunResult, VirtualUserTarget, } from './virtual-user.types.js';
20
20
  export { PRODUCTION_DISPOSITION } from './virtual-user.types.js';
21
- export { runVirtualUser, rememberIds, type RunVirtualUserParams, type VirtualUserCallContext, } from './run-virtual-user.js';
21
+ export { runVirtualUser, type RunVirtualUserParams, } from './run-virtual-user.js';
22
22
  export { personaScopes, prepareVirtualUserRun, type VirtualUserPreparation, } from './prepare-virtual-user-run.js';
23
23
  export type { VirtualUserRunOutcome, VirtualUserRunRecord, VirtualUserRunStart, VirtualUserRunStore, } from './virtual-user-run-store.js';
24
24
  export { DISPOSITIONS, dispositionProfile, type DispositionProfile, type VirtualUserTuning, } from './virtual-user-dispositions.js';
25
- export { catalogueClassification, catalogueIndex, catalogueLookup, describeEntry, isReadOnly, reachableCatalogue, renderCatalogue, unreachableCatalogue, } from './virtual-user-catalogue.js';
26
- export { reachableAgents, type AgentReachability, type ReachableAgent, } from './virtual-user-agents.js';
27
- export { IntentStack, intentsForPersona, type IntentMove, type ScheduledTick, } from './virtual-user-intents.js';
28
- export { createRng, type VirtualUserRng } from './virtual-user-rng.js';
25
+ export { catalogueClassification, catalogueLookup, isReadOnly, reachableCatalogue, unreachableCatalogue, } from './virtual-user-catalogue.js';
26
+ export { type AgentReachability, type ReachableAgent, } from './virtual-user-agents.js';
27
+ export { IntentStack, intentsForPersona, } from './virtual-user-intents.js';
29
28
  export { deriveCatalogue, deriveIntents, type SchemaMap, } from './virtual-user-derive.js';
30
29
  export { personaVirtualUserTarget, type PersonaTargetOptions, } from './virtual-user-target.js';
@@ -1,10 +1,8 @@
1
1
  export { PRODUCTION_DISPOSITION } from './virtual-user.types.js';
2
- export { runVirtualUser, rememberIds, } from './run-virtual-user.js';
2
+ export { runVirtualUser, } from './run-virtual-user.js';
3
3
  export { personaScopes, prepareVirtualUserRun, } from './prepare-virtual-user-run.js';
4
4
  export { DISPOSITIONS, dispositionProfile, } from './virtual-user-dispositions.js';
5
- export { catalogueClassification, catalogueIndex, catalogueLookup, describeEntry, isReadOnly, reachableCatalogue, renderCatalogue, unreachableCatalogue, } from './virtual-user-catalogue.js';
6
- export { reachableAgents, } from './virtual-user-agents.js';
5
+ export { catalogueClassification, catalogueLookup, isReadOnly, reachableCatalogue, unreachableCatalogue, } from './virtual-user-catalogue.js';
7
6
  export { IntentStack, intentsForPersona, } from './virtual-user-intents.js';
8
- export { createRng } from './virtual-user-rng.js';
9
7
  export { deriveCatalogue, deriveIntents, } from './virtual-user-derive.js';
10
8
  export { personaVirtualUserTarget, } from './virtual-user-target.js';