@pikku/core 0.12.82 → 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.
- package/CHANGELOG.md +101 -0
- package/README.md +1 -1
- package/dist/ecosystem/agent-scorer.d.ts +12 -0
- package/dist/ecosystem/agent-scorer.js +5 -0
- package/dist/ecosystem/agent.d.ts +18 -0
- package/dist/ecosystem/agent.js +6 -0
- package/dist/ecosystem/ai-agent.d.ts +18 -0
- package/dist/ecosystem/ai-agent.js +6 -0
- package/dist/ecosystem/ai-scorer.d.ts +12 -0
- package/dist/ecosystem/ai-scorer.js +5 -0
- package/dist/ecosystem/channel/local.d.ts +1 -0
- package/dist/ecosystem/channel/local.js +1 -0
- package/dist/ecosystem/channel.d.ts +12 -0
- package/dist/ecosystem/channel.js +4 -0
- package/dist/ecosystem/cli/channel.d.ts +16 -0
- package/dist/ecosystem/cli/channel.js +2 -0
- package/dist/ecosystem/cli.d.ts +9 -0
- package/dist/ecosystem/cli.js +2 -0
- package/dist/ecosystem/credential.d.ts +9 -0
- package/dist/ecosystem/credential.js +1 -0
- package/dist/ecosystem/dev.d.ts +8 -0
- package/dist/ecosystem/dev.js +1 -0
- package/dist/ecosystem/function.d.ts +13 -0
- package/dist/ecosystem/function.js +2 -0
- package/dist/ecosystem/gateway.d.ts +1 -0
- package/dist/ecosystem/gateway.js +1 -0
- package/dist/ecosystem/hmac.d.ts +1 -0
- package/dist/ecosystem/hmac.js +1 -0
- package/dist/ecosystem/http.d.ts +11 -0
- package/dist/ecosystem/http.js +3 -0
- package/dist/ecosystem/mcp.d.ts +3 -0
- package/dist/ecosystem/mcp.js +2 -0
- package/dist/ecosystem/middleware.d.ts +17 -0
- package/dist/ecosystem/middleware.js +6 -0
- package/dist/ecosystem/node-host-resolver.d.ts +1 -0
- package/dist/ecosystem/node-host-resolver.js +1 -0
- package/dist/ecosystem/node.d.ts +1 -0
- package/dist/ecosystem/node.js +1 -0
- package/dist/ecosystem/oauth2.d.ts +1 -0
- package/dist/ecosystem/oauth2.js +1 -0
- package/dist/ecosystem/persona.d.ts +15 -0
- package/dist/ecosystem/persona.js +4 -0
- package/dist/ecosystem/queue.d.ts +11 -0
- package/dist/ecosystem/queue.js +2 -0
- package/dist/ecosystem/remote.d.ts +8 -0
- package/dist/ecosystem/remote.js +1 -0
- package/dist/ecosystem/role.d.ts +3 -0
- package/dist/ecosystem/role.js +2 -0
- package/dist/ecosystem/rpc.d.ts +4 -0
- package/dist/ecosystem/rpc.js +2 -0
- package/dist/ecosystem/safe-fetch.d.ts +7 -0
- package/dist/ecosystem/safe-fetch.js +1 -0
- package/dist/ecosystem/scenario.d.ts +15 -0
- package/dist/ecosystem/scenario.js +4 -0
- package/dist/ecosystem/scheduler.d.ts +2 -0
- package/dist/ecosystem/scheduler.js +1 -0
- package/dist/ecosystem/schema.d.ts +1 -0
- package/dist/ecosystem/schema.js +1 -0
- package/dist/ecosystem/scope.d.ts +3 -0
- package/dist/ecosystem/scope.js +2 -0
- package/dist/ecosystem/secret.d.ts +9 -0
- package/dist/ecosystem/secret.js +1 -0
- package/dist/ecosystem/services/istanbul-coverage.d.ts +1 -0
- package/dist/ecosystem/services/istanbul-coverage.js +1 -0
- package/dist/ecosystem/services/local-content-request-handler.d.ts +9 -0
- package/dist/ecosystem/services/local-content-request-handler.js +1 -0
- package/dist/ecosystem/services/local-content.d.ts +1 -0
- package/dist/ecosystem/services/local-content.js +1 -0
- package/dist/ecosystem/services/v8-coverage.d.ts +1 -0
- package/dist/ecosystem/services/v8-coverage.js +1 -0
- package/dist/ecosystem/services.d.ts +28 -0
- package/dist/ecosystem/services.js +6 -0
- package/dist/ecosystem/testing.d.ts +7 -0
- package/dist/ecosystem/testing.js +1 -0
- package/dist/ecosystem/trigger.d.ts +1 -0
- package/dist/ecosystem/trigger.js +1 -0
- package/dist/ecosystem/types.d.ts +9 -0
- package/dist/ecosystem/types.js +5 -0
- package/dist/ecosystem/variable.d.ts +8 -0
- package/dist/ecosystem/variable.js +1 -0
- package/dist/ecosystem/virtual-user.d.ts +21 -0
- package/dist/ecosystem/virtual-user.js +5 -0
- package/dist/ecosystem/workflow.d.ts +18 -0
- package/dist/ecosystem/workflow.js +4 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +3 -3
- package/dist/middleware/auth-apikey.d.ts +1 -1
- package/dist/middleware/auth-bearer.d.ts +1 -1
- package/dist/middleware/auth-cookie.d.ts +1 -1
- package/dist/middleware/cors.d.ts +1 -1
- package/dist/middleware/remote-auth.d.ts +1 -1
- package/dist/middleware/telemetry.d.ts +2 -2
- package/dist/services/agent-run-state-service.d.ts +29 -0
- package/dist/services/agent-run-state-service.js +1 -0
- package/dist/services/agent-runner-service.d.ts +220 -0
- package/dist/services/agent-runner-service.js +1 -0
- package/dist/services/agent-storage-service.d.ts +18 -0
- package/dist/services/agent-storage-service.js +1 -0
- package/dist/services/http-personas.d.ts +1 -1
- package/dist/services/http-personas.js +3 -3
- package/dist/services/in-memory-agent-run-state-service.d.ts +19 -0
- package/dist/services/in-memory-agent-run-state-service.js +54 -0
- package/dist/services/index.d.ts +9 -10
- package/dist/services/index.js +3 -3
- package/dist/services/meta-service.d.ts +5 -4
- package/dist/testing/service-tests/agent-run-service-tests.d.ts +1 -1
- package/dist/testing/service-tests/agent-run-service-tests.js +3 -3
- package/dist/testing/service-tests/agent-storage-service-tests.d.ts +3 -0
- package/dist/testing/service-tests/agent-storage-service-tests.js +302 -0
- package/dist/testing/service-tests.d.ts +4 -4
- package/dist/testing/service-tests.js +4 -4
- package/dist/types/core.types.d.ts +12 -11
- package/dist/types/core.types.js +1 -1
- package/dist/types/state.types.d.ts +11 -6
- package/dist/wirings/actor-flow/run-conversation.d.ts +2 -2
- package/dist/wirings/agent/agent-agui.d.ts +79 -0
- package/dist/wirings/agent/agent-agui.js +327 -0
- package/dist/wirings/agent/agent-finalize.d.ts +58 -0
- package/dist/wirings/agent/agent-finalize.js +138 -0
- package/dist/wirings/agent/agent-helpers.d.ts +35 -0
- package/dist/wirings/agent/agent-helpers.js +47 -0
- package/dist/wirings/agent/agent-interrupt.d.ts +153 -0
- package/dist/wirings/agent/agent-interrupt.js +257 -0
- package/dist/wirings/agent/agent-memory.d.ts +42 -0
- package/dist/wirings/agent/agent-memory.js +333 -0
- package/dist/wirings/agent/agent-model-config.d.ts +16 -0
- package/dist/wirings/agent/agent-model-config.js +51 -0
- package/dist/wirings/agent/agent-prepare.d.ts +117 -0
- package/dist/wirings/agent/agent-prepare.js +728 -0
- package/dist/wirings/agent/agent-registry.d.ts +16 -0
- package/dist/wirings/agent/agent-registry.js +51 -0
- package/dist/wirings/agent/agent-rpc.d.ts +15 -0
- package/dist/wirings/agent/agent-rpc.js +53 -0
- package/dist/wirings/agent/agent-runner.d.ts +7 -0
- package/dist/wirings/agent/agent-runner.js +580 -0
- package/dist/wirings/agent/agent-stream.d.ts +41 -0
- package/dist/wirings/agent/agent-stream.js +1029 -0
- package/dist/wirings/agent/agent-turn.d.ts +57 -0
- package/dist/wirings/agent/agent-turn.js +82 -0
- package/dist/wirings/agent/agent-utils.d.ts +1 -0
- package/dist/wirings/agent/agent-utils.js +1 -0
- package/dist/wirings/agent/agent.types.d.ts +625 -0
- package/dist/wirings/agent/agent.types.js +1 -0
- package/dist/wirings/agent/index.d.ts +12 -0
- package/dist/wirings/agent/index.js +10 -0
- package/dist/wirings/agent/voice-input.d.ts +69 -0
- package/dist/wirings/agent/voice-input.js +150 -0
- package/dist/wirings/agent/voice-output.d.ts +85 -0
- package/dist/wirings/agent/voice-output.js +196 -0
- package/dist/wirings/agent-scorer/agent-scorer-grade.d.ts +26 -0
- package/dist/wirings/agent-scorer/agent-scorer-grade.js +33 -0
- package/dist/wirings/agent-scorer/agent-scorer-judge.d.ts +17 -0
- package/dist/wirings/agent-scorer/agent-scorer-judge.js +92 -0
- package/dist/wirings/agent-scorer/agent-scorer-live.d.ts +15 -0
- package/dist/wirings/agent-scorer/agent-scorer-live.js +38 -0
- package/dist/wirings/agent-scorer/agent-scorer-registry.d.ts +18 -0
- package/dist/wirings/agent-scorer/agent-scorer-registry.js +46 -0
- package/dist/wirings/agent-scorer/agent-scorer-sampling.d.ts +8 -0
- package/dist/wirings/agent-scorer/agent-scorer-sampling.js +31 -0
- package/dist/wirings/agent-scorer/agent-scorer-snapshots.d.ts +10 -0
- package/dist/wirings/agent-scorer/agent-scorer-snapshots.js +40 -0
- package/dist/wirings/agent-scorer/agent-scorer-worker.d.ts +15 -0
- package/dist/wirings/agent-scorer/agent-scorer-worker.js +60 -0
- package/dist/wirings/agent-scorer/agent-scorer.d.ts +39 -0
- package/dist/wirings/agent-scorer/agent-scorer.js +40 -0
- package/dist/wirings/agent-scorer/agent-scorer.types.d.ts +90 -0
- package/dist/wirings/agent-scorer/agent-scorer.types.js +4 -0
- package/dist/wirings/agent-scorer/index.d.ts +6 -0
- package/dist/wirings/agent-scorer/index.js +5 -0
- package/dist/wirings/ai-agent/ai-agent-prepare.js +2 -0
- package/dist/wirings/ai-agent/voice-output.d.ts +1 -2
- package/dist/wirings/channel/channel-rpc.types.d.ts +2 -2
- package/dist/wirings/rpc/addon-runner.d.ts +4 -0
- package/dist/wirings/rpc/addon-runner.js +14 -2
- package/dist/wirings/rpc/rpc-runner.d.ts +1 -1
- package/dist/wirings/rpc/rpc-runner.js +4 -2
- package/dist/wirings/rpc/rpc-types.d.ts +5 -1
- package/dist/wirings/rpc/wire-addon.d.ts +12 -0
- package/dist/wirings/rpc/wire-addon.js +4 -0
- package/dist/wirings/virtual-user/prepare-virtual-user-run.js +1 -1
- package/dist/wirings/virtual-user/virtual-user-agents.d.ts +1 -1
- package/dist/wirings/workflow/feature.d.ts +2 -1
- package/dist/wirings/workflow/index.d.ts +3 -14
- package/dist/wirings/workflow/index.js +0 -8
- package/dist/wirings/workflow/pikku-scenario-service.d.ts +10 -0
- package/dist/wirings/workflow/pikku-scenario-service.js +9 -0
- package/dist/wirings/workflow/run-timeline.d.ts +1 -2
- package/dist/wirings/workflow/scenario.types.d.ts +37 -0
- package/dist/wirings/workflow/scenario.types.js +1 -0
- package/dist/wirings/workflow/workflow.types.d.ts +2 -37
- 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
- package/knowledge/decisions/internals/a-resumed-agent-turn-is-as-interruptible-as-the-first.md +1 -1
- package/knowledge/decisions/internals/actor-flow-drives-the-target-through-a-transport-seam.md +1 -1
- 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
- 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
- package/knowledge/decisions/internals/agent-context-waits-for-a-tool-result-still-being-written.md +1 -1
- package/knowledge/decisions/internals/{ai-agent-credential-suspensions-hide-the-tool-result.md → agent-credential-suspensions-hide-the-tool-result.md} +2 -2
- package/knowledge/decisions/internals/{ai-agent-delegate-and-supervise-hide-different-text.md → agent-delegate-and-supervise-hide-different-text.md} +4 -4
- package/knowledge/decisions/internals/{ai-agent-llm-tool-arguments-have-nulls-stripped.md → agent-llm-tool-arguments-have-nulls-stripped.md} +3 -3
- 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
- package/knowledge/decisions/internals/{ai-agent-onerror-hooks-cannot-change-the-failure.md → agent-onerror-hooks-cannot-change-the-failure.md} +6 -6
- package/knowledge/decisions/internals/{ai-agent-runner-methods-must-keep-their-receiver.md → agent-runner-methods-must-keep-their-receiver.md} +4 -4
- package/knowledge/decisions/internals/agent-speech-travels-as-a-custom-agui-event.md +1 -1
- package/knowledge/decisions/internals/{ai-agent-stream-persistence-is-best-effort.md → agent-stream-persistence-is-best-effort.md} +4 -4
- 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
- package/knowledge/decisions/internals/{ai-agent-tool-execute-failures-are-logged-unconditionally.md → agent-tool-execute-failures-are-logged-unconditionally.md} +3 -3
- 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
- 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
- package/knowledge/decisions/internals/an-agent-interrupt-is-not-a-failure.md +2 -2
- package/knowledge/decisions/internals/an-agent-run-owned-by-another-instance-says-so.md +3 -3
- package/knowledge/decisions/internals/an-agent-stream-send-must-return-the-inner-sends-promise.md +2 -2
- package/knowledge/decisions/internals/an-empty-text-part-is-omitted-from-an-agent-message.md +1 -1
- package/knowledge/decisions/internals/an-empty-transcript-is-not-recorded.md +1 -1
- package/knowledge/decisions/internals/speech-synthesis-picks-a-voice-per-sentence-and-warns-once.md +1 -1
- package/knowledge/decisions/internals/the-agent-done-event-goes-through-the-middleware-and-is-awaited.md +1 -1
- package/knowledge/decisions/internals/the-embedding-model-is-pinned-per-service-and-doc-query-embedding-is-split.md +1 -1
- package/knowledge/decisions/internals/the-per-invocation-rpc-view-is-a-class.md +5 -5
- package/knowledge/decisions/internals/the-transcript-event-is-sent-ahead-of-the-run.md +2 -2
- package/knowledge/decisions/internals/thread-history-records-the-transcript-not-the-audio.md +2 -2
- package/knowledge/decisions/internals/voice-output-speaks-unless-voice-input-explicitly-says-otherwise.md +1 -1
- package/knowledge/decisions/security/{ai-agent-approval-forwarding-requires-a-symbol-brand.md → agent-approval-forwarding-requires-a-symbol-brand.md} +3 -3
- package/knowledge/decisions/security/{ai-agent-credential-requests-are-symbol-branded.md → agent-credential-requests-are-symbol-branded.md} +4 -4
- 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
- package/knowledge/decisions/security/{ai-agent-ownership-failures-never-echo-the-resource.md → agent-ownership-failures-never-echo-the-resource.md} +2 -2
- package/knowledge/decisions/security/{ai-agent-resume-re-runs-the-authorization-gate.md → agent-resume-re-runs-the-authorization-gate.md} +4 -4
- package/knowledge/decisions/security/{ai-agent-sessionless-deployments-have-no-thread-ownership.md → agent-sessionless-deployments-have-no-thread-ownership.md} +5 -5
- package/knowledge/decisions/security/{ai-agent-thread-ownership-composes-the-session-principal.md → agent-thread-ownership-composes-the-session-principal.md} +2 -2
- 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
- package/knowledge/decisions/security/an-agent-approval-is-claimed-before-the-tool-runs.md +3 -3
- package/knowledge/decisions/security/an-empty-owners-constraint-matches-nothing.md +3 -3
- package/knowledge/decisions/security/console-addon-privileged-functions-gate-themselves.md +20 -13
- package/knowledge/decisions/security/index.md +1 -2
- package/package.json +4 -4
- package/scripts/generate-api-report.mts +32 -8
- package/src/agent-naming.test.ts +68 -0
- package/src/ecosystem/agent-scorer.ts +24 -0
- package/src/ecosystem/agent.ts +42 -0
- package/src/ecosystem/channel/local.ts +1 -0
- package/src/ecosystem/channel.ts +22 -0
- package/src/ecosystem/cli/channel.ts +25 -0
- package/src/ecosystem/cli.ts +21 -0
- package/src/ecosystem/credential.ts +10 -0
- package/src/ecosystem/dev.ts +12 -0
- package/src/ecosystem/function.ts +28 -0
- package/src/ecosystem/gateway.ts +4 -0
- package/src/ecosystem/hmac.ts +1 -0
- package/src/ecosystem/http.ts +22 -0
- package/src/ecosystem/mcp.ts +17 -0
- package/src/ecosystem/middleware.ts +27 -0
- package/src/ecosystem/node-host-resolver.ts +1 -0
- package/src/ecosystem/node.ts +5 -0
- package/src/ecosystem/oauth2.ts +4 -0
- package/src/ecosystem/persona.ts +30 -0
- package/src/ecosystem/queue.ts +23 -0
- package/src/ecosystem/remote.ts +9 -0
- package/src/ecosystem/role.ts +13 -0
- package/src/ecosystem/rpc.ts +7 -0
- package/src/ecosystem/safe-fetch.ts +8 -0
- package/src/ecosystem/scenario.ts +32 -0
- package/src/ecosystem/scheduler.ts +5 -0
- package/src/ecosystem/schema.ts +1 -0
- package/src/ecosystem/scope.ts +14 -0
- package/src/ecosystem/secret.ts +15 -0
- package/src/ecosystem/services/istanbul-coverage.ts +1 -0
- package/src/ecosystem/services/local-content-request-handler.ts +16 -0
- package/src/ecosystem/services/local-content.ts +1 -0
- package/src/ecosystem/services/v8-coverage.ts +1 -0
- package/src/ecosystem/services.ts +82 -0
- package/src/ecosystem/testing.ts +8 -0
- package/src/ecosystem/trigger.ts +7 -0
- package/src/ecosystem/types.ts +34 -0
- package/src/ecosystem/variable.ts +14 -0
- package/src/ecosystem/virtual-user.ts +48 -0
- package/src/ecosystem/workflow.ts +68 -0
- package/src/index.ts +8 -19
- package/src/pikku-state.ts +3 -3
- package/src/public-surface.json +183 -91
- package/src/public-surface.json.README +20 -2
- package/src/public-surface.test.ts +31 -3
- package/src/services/{ai-run-state-service.ts → agent-run-state-service.ts} +5 -5
- package/src/services/{ai-agent-runner-service.ts → agent-runner-service.ts} +18 -18
- package/src/services/{ai-storage-service.ts → agent-storage-service.ts} +7 -7
- package/src/services/http-personas-converse.test.ts +3 -3
- package/src/services/http-personas.ts +4 -4
- package/src/services/{in-memory-ai-run-state-service.ts → in-memory-agent-run-state-service.ts} +7 -7
- package/src/services/index.ts +13 -24
- package/src/services/meta-service.ts +5 -7
- package/src/testing/service-tests/agent-run-service-tests.ts +4 -4
- package/src/testing/service-tests/{ai-storage-service-tests.ts → agent-storage-service-tests.ts} +8 -8
- package/src/testing/service-tests.ts +10 -8
- package/src/types/core.types.ts +13 -13
- package/src/types/state.types.ts +11 -10
- package/src/wirings/actor-flow/run-conversation.test.ts +2 -2
- package/src/wirings/actor-flow/run-conversation.ts +7 -9
- package/src/wirings/{ai-agent/ai-agent-agui.test.ts → agent/agent-agui.test.ts} +126 -105
- package/src/wirings/{ai-agent/ai-agent-agui.ts → agent/agent-agui.ts} +7 -7
- package/src/wirings/{ai-agent/ai-agent-authorization.test.ts → agent/agent-authorization.test.ts} +6 -6
- package/src/wirings/{ai-agent/ai-agent-finalize.test.ts → agent/agent-finalize.test.ts} +17 -16
- package/src/wirings/{ai-agent/ai-agent-finalize.ts → agent/agent-finalize.ts} +22 -22
- package/src/wirings/{ai-agent/ai-agent-helpers.test.ts → agent/agent-helpers.test.ts} +1 -1
- package/src/wirings/{ai-agent/ai-agent-helpers.ts → agent/agent-helpers.ts} +1 -1
- package/src/wirings/{ai-agent/ai-agent-interrupt.test.ts → agent/agent-interrupt.test.ts} +67 -77
- package/src/wirings/{ai-agent/ai-agent-interrupt.ts → agent/agent-interrupt.ts} +5 -5
- package/src/wirings/{ai-agent/ai-agent-memory.test.ts → agent/agent-memory.test.ts} +12 -12
- package/src/wirings/{ai-agent/ai-agent-memory.ts → agent/agent-memory.ts} +36 -36
- package/src/wirings/{ai-agent/ai-agent-model-config.test.ts → agent/agent-model-config.test.ts} +2 -5
- package/src/wirings/{ai-agent/ai-agent-model-config.ts → agent/agent-model-config.ts} +1 -1
- package/src/wirings/{ai-agent/ai-agent-prepare.test.ts → agent/agent-prepare.test.ts} +18 -18
- package/src/wirings/{ai-agent/ai-agent-prepare.ts → agent/agent-prepare.ts} +54 -51
- package/src/wirings/{ai-agent/ai-agent-registry.test.ts → agent/agent-registry.test.ts} +49 -43
- package/src/wirings/{ai-agent/ai-agent-registry.ts → agent/agent-registry.ts} +14 -14
- package/src/wirings/{ai-agent/ai-agent-resume-authorization.test.ts → agent/agent-resume-authorization.test.ts} +18 -18
- package/src/wirings/{ai-agent → agent}/agent-rpc.ts +16 -20
- package/src/wirings/{ai-agent/ai-agent-runner.test.ts → agent/agent-runner.test.ts} +105 -106
- package/src/wirings/{ai-agent/ai-agent-runner.ts → agent/agent-runner.ts} +90 -80
- package/src/wirings/{ai-agent/ai-agent-stream-output-hooks.test.ts → agent/agent-stream-output-hooks.test.ts} +25 -25
- package/src/wirings/{ai-agent/ai-agent-stream.test.ts → agent/agent-stream.test.ts} +147 -143
- package/src/wirings/{ai-agent/ai-agent-stream.ts → agent/agent-stream.ts} +147 -146
- package/src/wirings/{ai-agent/ai-agent-thread-ownership.test.ts → agent/agent-thread-ownership.test.ts} +24 -28
- package/src/wirings/{ai-agent/ai-agent-turn.test.ts → agent/agent-turn.test.ts} +3 -5
- package/src/wirings/{ai-agent/ai-agent-turn.ts → agent/agent-turn.ts} +7 -7
- package/src/wirings/{ai-agent/ai-agent.types.ts → agent/agent.types.ts} +51 -48
- package/src/wirings/agent/index.ts +56 -0
- package/src/wirings/{ai-agent → agent}/voice-input.test.ts +15 -15
- package/src/wirings/{ai-agent → agent}/voice-input.ts +11 -11
- package/src/wirings/{ai-agent → agent}/voice-output.test.ts +23 -23
- package/src/wirings/{ai-agent → agent}/voice-output.ts +11 -11
- package/src/wirings/{ai-scorer/ai-scorer-grade.test.ts → agent-scorer/agent-scorer-grade.test.ts} +8 -8
- package/src/wirings/{ai-scorer/ai-scorer-grade.ts → agent-scorer/agent-scorer-grade.ts} +9 -9
- package/src/wirings/{ai-scorer/ai-scorer-judge.test.ts → agent-scorer/agent-scorer-judge.test.ts} +11 -14
- package/src/wirings/{ai-scorer/ai-scorer-judge.ts → agent-scorer/agent-scorer-judge.ts} +11 -11
- package/src/wirings/{ai-scorer/ai-scorer-live.test.ts → agent-scorer/agent-scorer-live.test.ts} +11 -11
- package/src/wirings/{ai-scorer/ai-scorer-live.ts → agent-scorer/agent-scorer-live.ts} +3 -3
- package/src/wirings/{ai-scorer/ai-scorer-registry.ts → agent-scorer/agent-scorer-registry.ts} +11 -8
- package/src/wirings/{ai-scorer/ai-scorer-sampling.test.ts → agent-scorer/agent-scorer-sampling.test.ts} +1 -1
- package/src/wirings/{ai-scorer/ai-scorer-snapshots.test.ts → agent-scorer/agent-scorer-snapshots.test.ts} +2 -2
- package/src/wirings/{ai-scorer/ai-scorer-snapshots.ts → agent-scorer/agent-scorer-snapshots.ts} +1 -1
- package/src/wirings/{ai-scorer/ai-scorer-worker.test.ts → agent-scorer/agent-scorer-worker.test.ts} +15 -15
- package/src/wirings/{ai-scorer/ai-scorer-worker.ts → agent-scorer/agent-scorer-worker.ts} +9 -7
- package/src/wirings/{ai-scorer/ai-scorer.ts → agent-scorer/agent-scorer.ts} +7 -7
- package/src/wirings/{ai-scorer/ai-scorer.types.ts → agent-scorer/agent-scorer.types.ts} +6 -6
- package/src/wirings/agent-scorer/index.ts +22 -0
- package/src/wirings/channel/channel-rpc.types.ts +2 -2
- package/src/wirings/rpc/addon-runner.ts +31 -3
- package/src/wirings/rpc/addon-secrets.test.ts +130 -0
- package/src/wirings/rpc/rpc-runner.ts +4 -2
- package/src/wirings/rpc/rpc-types.ts +5 -1
- package/src/wirings/rpc/wire-addon.ts +16 -0
- package/src/wirings/virtual-user/prepare-virtual-user-run.ts +1 -1
- package/src/wirings/virtual-user/run-virtual-user.test.ts +2 -2
- package/src/wirings/virtual-user/run-virtual-user.ts +3 -3
- package/src/wirings/virtual-user/virtual-user-agents.ts +1 -1
- package/src/wirings/workflow/feature.ts +2 -5
- package/src/wirings/workflow/index.ts +1 -49
- package/src/wirings/workflow/pikku-scenario-service.ts +21 -1
- package/src/wirings/workflow/run-timeline.ts +1 -1
- package/src/wirings/workflow/scenario.types.ts +63 -0
- package/src/wirings/workflow/workflow.types.ts +1 -54
- package/src/wirings-stay-decoupled.test.ts +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/src/wirings/ai-agent/index.ts +0 -65
- package/src/wirings/ai-scorer/index.ts +0 -24
- /package/src/wirings/{ai-agent/ai-agent-utils.ts → agent/agent-utils.ts} +0 -0
- /package/src/wirings/{ai-scorer/ai-scorer-sampling.ts → agent-scorer/agent-scorer-sampling.ts} +0 -0
|
@@ -43,7 +43,7 @@ export interface HttpPersonasConfig {
|
|
|
43
43
|
/**
|
|
44
44
|
* Default model a persona thinks with when `converse(...)` is called without
|
|
45
45
|
* an explicit `model`. Its own turns/approvals/evaluation run in-process via
|
|
46
|
-
* the configured `
|
|
46
|
+
* the configured `agentRunner`.
|
|
47
47
|
*/
|
|
48
48
|
model?: string
|
|
49
49
|
}
|
|
@@ -107,8 +107,8 @@ export class HttpPersona implements ScenarioPersona {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
async converse(options: ConverseOptions): Promise<ActorFlowVerdict> {
|
|
110
|
-
const {
|
|
111
|
-
if (!
|
|
110
|
+
const { agentRunner } = getSingletonServices()
|
|
111
|
+
if (!agentRunner) {
|
|
112
112
|
throw new AIProviderNotConfiguredError()
|
|
113
113
|
}
|
|
114
114
|
const model = options.model ?? this.config.model
|
|
@@ -129,7 +129,7 @@ export class HttpPersona implements ScenarioPersona {
|
|
|
129
129
|
approvals: options.approvals,
|
|
130
130
|
model,
|
|
131
131
|
maxTurns: options.maxTurns,
|
|
132
|
-
llm: (params) =>
|
|
132
|
+
llm: (params) => agentRunner.run(params),
|
|
133
133
|
target: {
|
|
134
134
|
run: (message) =>
|
|
135
135
|
this.agentRun(options.agent, message, threadId, resourceId),
|
package/src/services/{in-memory-ai-run-state-service.ts → in-memory-agent-run-state-service.ts}
RENAMED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
AgentRunStateService,
|
|
3
3
|
CreateRunInput,
|
|
4
4
|
SaveScoreInput,
|
|
5
|
-
} from './
|
|
5
|
+
} from './agent-run-state-service.js'
|
|
6
6
|
import type {
|
|
7
7
|
AgentRunState,
|
|
8
8
|
PendingApproval,
|
|
9
|
-
} from '../wirings/
|
|
10
|
-
import type {
|
|
9
|
+
} from '../wirings/agent/agent.types.js'
|
|
10
|
+
import type { AgentRunScore } from '../wirings/agent-scorer/agent-scorer.types.js'
|
|
11
11
|
|
|
12
|
-
export class
|
|
12
|
+
export class InMemoryAgentRunStateService implements AgentRunStateService {
|
|
13
13
|
private runs = new Map<string, AgentRunState>()
|
|
14
|
-
private scores = new Map<string,
|
|
14
|
+
private scores = new Map<string, AgentRunScore[]>()
|
|
15
15
|
private counter = 0
|
|
16
16
|
|
|
17
17
|
async createRun(run: CreateRunInput): Promise<string> {
|
|
@@ -81,7 +81,7 @@ export class InMemoryAIRunStateService implements AIRunStateService {
|
|
|
81
81
|
this.scores.set(score.runId, existing)
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
async getScores(runId: string): Promise<
|
|
84
|
+
async getScores(runId: string): Promise<AgentRunScore[]> {
|
|
85
85
|
return [...(this.scores.get(runId) ?? [])]
|
|
86
86
|
}
|
|
87
87
|
}
|
package/src/services/index.ts
CHANGED
|
@@ -6,9 +6,7 @@ export {
|
|
|
6
6
|
createMiddlewareSessionWireProps,
|
|
7
7
|
} from './user-session-service.js'
|
|
8
8
|
export { TypedSecretService } from './typed-secret-service.js'
|
|
9
|
-
export {
|
|
10
|
-
PikkuCredentialWireService,
|
|
11
|
-
} from './credential-wire-service.js'
|
|
9
|
+
export { PikkuCredentialWireService } from './credential-wire-service.js'
|
|
12
10
|
export { TypedVariablesService } from './typed-variables-service.js'
|
|
13
11
|
export { LocalSecretService } from './local-secrets.js'
|
|
14
12
|
export { LocalEmailService } from './local-email-service.js'
|
|
@@ -22,7 +20,7 @@ export {
|
|
|
22
20
|
} from './queue-webhook-service.js'
|
|
23
21
|
export { InMemoryQueueService } from './in-memory-queue-service.js'
|
|
24
22
|
export { InMemoryTriggerService } from './in-memory-trigger-service.js'
|
|
25
|
-
export {
|
|
23
|
+
export { InMemoryAgentRunStateService } from './in-memory-agent-run-state-service.js'
|
|
26
24
|
export { LocalGatewayService } from './local-gateway-service.js'
|
|
27
25
|
export type {
|
|
28
26
|
ContentService,
|
|
@@ -38,10 +36,8 @@ export type {
|
|
|
38
36
|
ScenarioPersona,
|
|
39
37
|
ResolvedPersona,
|
|
40
38
|
ScenarioPersonas,
|
|
41
|
-
ScenarioHttpResponse,
|
|
42
39
|
} from './personas-service.js'
|
|
43
40
|
// knowledge: decisions/internals/the-persona-runtime-is-exported-from-the-persona-entry-point.md
|
|
44
|
-
export type { HttpPersonasConfig } from './http-personas.js'
|
|
45
41
|
export type { JWTService } from './jwt-service.js'
|
|
46
42
|
export type {
|
|
47
43
|
EmailService,
|
|
@@ -81,36 +77,29 @@ export type {
|
|
|
81
77
|
DeploymentInfo,
|
|
82
78
|
DeploymentServiceConfig,
|
|
83
79
|
} from './deployment-service.js'
|
|
84
|
-
export type {
|
|
80
|
+
export type { AgentStorageService } from './agent-storage-service.js'
|
|
85
81
|
export type {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
} from './
|
|
82
|
+
AgentRunnerParams,
|
|
83
|
+
AgentRunnerResult,
|
|
84
|
+
AgentStepResult,
|
|
85
|
+
AgentRunnerService,
|
|
86
|
+
} from './agent-runner-service.js'
|
|
91
87
|
export type { AIEmbeddingService } from './ai-embedding-service.js'
|
|
92
88
|
export type {
|
|
93
89
|
CreateRunInput,
|
|
94
90
|
SaveScoreInput,
|
|
95
|
-
|
|
96
|
-
} from './
|
|
97
|
-
export type {
|
|
98
|
-
CredentialMeta,
|
|
99
|
-
} from './typed-secret-service.js'
|
|
91
|
+
AgentRunStateService,
|
|
92
|
+
} from './agent-run-state-service.js'
|
|
93
|
+
export type { CredentialMeta } from './typed-secret-service.js'
|
|
100
94
|
export type { CredentialService } from './credential-service.js'
|
|
101
95
|
export { TypedCredentialService } from './typed-credential-service.js'
|
|
102
|
-
export type {
|
|
103
|
-
CredentialMetaInfo,
|
|
104
|
-
} from './typed-credential-service.js'
|
|
96
|
+
export type { CredentialMetaInfo } from './typed-credential-service.js'
|
|
105
97
|
export type { VariableMeta } from './typed-variables-service.js'
|
|
106
98
|
export type { MetaService } from './meta-service.js'
|
|
107
99
|
export type { SessionStore } from './session-store.js'
|
|
108
100
|
export type { ScopeService, Role } from './scope-service.js'
|
|
109
101
|
export type { IsSystemRole } from './system-role-guard.js'
|
|
110
|
-
export {
|
|
111
|
-
NoopAuditService,
|
|
112
|
-
createInvocationAudit,
|
|
113
|
-
} from './audit-service.js'
|
|
102
|
+
export { NoopAuditService, createInvocationAudit } from './audit-service.js'
|
|
114
103
|
export type {
|
|
115
104
|
AuditConfig,
|
|
116
105
|
AuditDurability,
|
|
@@ -13,10 +13,8 @@ import type {
|
|
|
13
13
|
MCPToolMeta,
|
|
14
14
|
MCPPromptMeta,
|
|
15
15
|
} from '../wirings/mcp/mcp.types.js'
|
|
16
|
-
import type {
|
|
17
|
-
|
|
18
|
-
WorkflowsMeta,
|
|
19
|
-
} from '../wirings/workflow/workflow.types.js'
|
|
16
|
+
import type { WorkflowsMeta } from '../wirings/workflow/workflow.types.js'
|
|
17
|
+
import type { FeaturesMeta } from '../wirings/workflow/scenario.types.js'
|
|
20
18
|
import type { ResolvedPersona } from './personas-service.js'
|
|
21
19
|
import type { SystemRoleDefinitionsMeta } from '../wirings/role/role.types.js'
|
|
22
20
|
import type {
|
|
@@ -32,7 +30,7 @@ import type {
|
|
|
32
30
|
MiddlewareMetadata,
|
|
33
31
|
PermissionMetadata,
|
|
34
32
|
} from '../types/core.types.js'
|
|
35
|
-
import type {
|
|
33
|
+
import type { AgentsMeta } from '../wirings/agent/agent.types.js'
|
|
36
34
|
import type { GatewaysMeta } from '../wirings/gateway/gateway.types.js'
|
|
37
35
|
|
|
38
36
|
export type {
|
|
@@ -41,8 +39,8 @@ export type {
|
|
|
41
39
|
MiddlewareMetadata as MiddlewareMeta,
|
|
42
40
|
PermissionMetadata as PermissionMeta,
|
|
43
41
|
}
|
|
44
|
-
export type AgentsMeta
|
|
45
|
-
export type AgentMeta =
|
|
42
|
+
export type { AgentsMeta }
|
|
43
|
+
export type AgentMeta = AgentsMeta[string]
|
|
46
44
|
|
|
47
45
|
export interface MCPMeta {
|
|
48
46
|
resources: MCPResourceMeta
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, test, before } from 'node:test'
|
|
2
2
|
import assert from 'node:assert/strict'
|
|
3
3
|
|
|
4
|
-
import type { AgentRunService } from '../../wirings/
|
|
4
|
+
import type { AgentRunService } from '../../wirings/agent/agent.types.js'
|
|
5
5
|
import type { ServiceTestConfig } from '../service-tests.js'
|
|
6
6
|
|
|
7
7
|
/** Conformance suite for `agentRunService`. Runs only when a backend supplies one. */
|
|
@@ -16,7 +16,7 @@ export const defineAgentRunServiceTests = (
|
|
|
16
16
|
* only runs when a backend supplies both. Passed explicitly rather than
|
|
17
17
|
* closed over, so the dependency is visible in the signature.
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
agentStorageService?: ServiceTestConfig['services']['agentStorageService']
|
|
20
20
|
): void => {
|
|
21
21
|
const factory = agentRunService
|
|
22
22
|
describe(`AgentRunService [${name}]`, () => {
|
|
@@ -31,8 +31,8 @@ export const defineAgentRunServiceTests = (
|
|
|
31
31
|
assert.ok(Array.isArray(threads))
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
if (
|
|
35
|
-
const storageFactory =
|
|
34
|
+
if (agentStorageService) {
|
|
35
|
+
const storageFactory = agentStorageService
|
|
36
36
|
|
|
37
37
|
// The `owners` constraint is what keeps the generated thread-management
|
|
38
38
|
// functions from leaking across tenants: a caller may only list threads
|
package/src/testing/service-tests/{ai-storage-service-tests.ts → agent-storage-service-tests.ts}
RENAMED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { describe, test, before } from 'node:test'
|
|
2
2
|
import assert from 'node:assert/strict'
|
|
3
3
|
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
4
|
+
import type { AgentStorageService } from '../../services/agent-storage-service.js'
|
|
5
|
+
import type { AgentRunStateService } from '../../services/agent-run-state-service.js'
|
|
6
6
|
import type { ServiceTestConfig } from '../service-tests.js'
|
|
7
7
|
|
|
8
|
-
/** Conformance suite for `
|
|
8
|
+
/** Conformance suite for `agentStorageService`. Runs only when a backend supplies one. */
|
|
9
9
|
export const defineAiStorageServiceTests = (
|
|
10
10
|
name: string,
|
|
11
|
-
|
|
12
|
-
ServiceTestConfig['services']['
|
|
11
|
+
agentStorageService: NonNullable<
|
|
12
|
+
ServiceTestConfig['services']['agentStorageService']
|
|
13
13
|
>
|
|
14
14
|
): void => {
|
|
15
|
-
const factory =
|
|
16
|
-
describe(`
|
|
17
|
-
let storage:
|
|
15
|
+
const factory = agentStorageService
|
|
16
|
+
describe(`AgentStorageService [${name}]`, () => {
|
|
17
|
+
let storage: AgentStorageService & AgentRunStateService
|
|
18
18
|
|
|
19
19
|
before(async () => {
|
|
20
20
|
storage = await factory()
|
|
@@ -3,11 +3,11 @@ import type { EventHubStore } from '../wirings/channel/eventhub-store.js'
|
|
|
3
3
|
import type { PikkuWorkflowService } from '../wirings/workflow/pikku-workflow-service.js'
|
|
4
4
|
import type { WorkflowRunService } from '../wirings/workflow/workflow.types.js'
|
|
5
5
|
import type { DeploymentService } from '../services/deployment-service.js'
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
6
|
+
import type { AgentStorageService } from '../services/agent-storage-service.js'
|
|
7
|
+
import type { AgentRunStateService } from '../services/agent-run-state-service.js'
|
|
8
8
|
import type { SecretService } from '../services/secret-service.js'
|
|
9
9
|
import type { CredentialService } from '../services/credential-service.js'
|
|
10
|
-
import type { AgentRunService } from '../wirings/
|
|
10
|
+
import type { AgentRunService } from '../wirings/agent/agent.types.js'
|
|
11
11
|
import type { SessionStore } from '../services/session-store.js'
|
|
12
12
|
|
|
13
13
|
export interface ServiceTestConfig {
|
|
@@ -20,7 +20,9 @@ export interface ServiceTestConfig {
|
|
|
20
20
|
deploymentService?: () => Promise<
|
|
21
21
|
DeploymentService & { stop(): Promise<void> }
|
|
22
22
|
>
|
|
23
|
-
|
|
23
|
+
agentStorageService?: () => Promise<
|
|
24
|
+
AgentStorageService & AgentRunStateService
|
|
25
|
+
>
|
|
24
26
|
agentRunService?: () => Promise<AgentRunService>
|
|
25
27
|
secretService?: (config: {
|
|
26
28
|
key: string
|
|
@@ -40,7 +42,7 @@ import { defineChannelStoreTests } from './service-tests/channel-store-tests.js'
|
|
|
40
42
|
import { defineEventHubStoreTests } from './service-tests/event-hub-store-tests.js'
|
|
41
43
|
import { defineWorkflowServiceTests } from './service-tests/workflow-service-tests.js'
|
|
42
44
|
import { defineWorkflowRunServiceTests } from './service-tests/workflow-run-service-tests.js'
|
|
43
|
-
import { defineAiStorageServiceTests } from './service-tests/
|
|
45
|
+
import { defineAiStorageServiceTests } from './service-tests/agent-storage-service-tests.js'
|
|
44
46
|
import { defineDeploymentServiceTests } from './service-tests/deployment-service-tests.js'
|
|
45
47
|
import { defineSecretServiceTests } from './service-tests/secret-service-tests.js'
|
|
46
48
|
import { defineCredentialServiceTests } from './service-tests/credential-service-tests.js'
|
|
@@ -68,8 +70,8 @@ export function defineServiceTests(config: ServiceTestConfig): void {
|
|
|
68
70
|
if (services.workflowRunService) {
|
|
69
71
|
defineWorkflowRunServiceTests(name, services.workflowRunService)
|
|
70
72
|
}
|
|
71
|
-
if (services.
|
|
72
|
-
defineAiStorageServiceTests(name, services.
|
|
73
|
+
if (services.agentStorageService) {
|
|
74
|
+
defineAiStorageServiceTests(name, services.agentStorageService)
|
|
73
75
|
}
|
|
74
76
|
if (services.deploymentService) {
|
|
75
77
|
defineDeploymentServiceTests(name, services.deploymentService)
|
|
@@ -84,7 +86,7 @@ export function defineServiceTests(config: ServiceTestConfig): void {
|
|
|
84
86
|
defineAgentRunServiceTests(
|
|
85
87
|
name,
|
|
86
88
|
services.agentRunService,
|
|
87
|
-
services.
|
|
89
|
+
services.agentStorageService
|
|
88
90
|
)
|
|
89
91
|
}
|
|
90
92
|
if (services.sessionStore) {
|
package/src/types/core.types.ts
CHANGED
|
@@ -17,11 +17,11 @@ import type { PikkuQueue, QueueService } from '../wirings/queue/queue.types.js'
|
|
|
17
17
|
import type { PikkuCLI } from '../wirings/cli/cli.types.js'
|
|
18
18
|
import type {
|
|
19
19
|
PikkuWorkflowWire,
|
|
20
|
-
PikkuScenarioWire,
|
|
21
20
|
WorkflowService,
|
|
22
21
|
WorkflowServiceConfig,
|
|
23
22
|
WorkflowStepWire,
|
|
24
23
|
} from '../wirings/workflow/workflow.types.js'
|
|
24
|
+
import type { PikkuScenarioWire } from '../wirings/workflow/scenario.types.js'
|
|
25
25
|
import type {
|
|
26
26
|
PikkuBrowserWire,
|
|
27
27
|
PikkuScenarioStepWire,
|
|
@@ -33,19 +33,19 @@ import type { PikkuTrigger } from '../wirings/trigger/trigger.types.js'
|
|
|
33
33
|
import type { PikkuGateway } from '../wirings/gateway/gateway.types.js'
|
|
34
34
|
import type { SchedulerService } from '../services/scheduler-service.js'
|
|
35
35
|
import type { DeploymentService } from '../services/deployment-service.js'
|
|
36
|
-
import type {
|
|
36
|
+
import type { AgentStorageService } from '../services/agent-storage-service.js'
|
|
37
37
|
|
|
38
38
|
import type { ContentService } from '../services/content-service.js'
|
|
39
39
|
import type {
|
|
40
40
|
ScenarioPersonaOf,
|
|
41
41
|
ScenarioPersonas,
|
|
42
42
|
} from '../services/personas-service.js'
|
|
43
|
-
import type {
|
|
43
|
+
import type { AgentRunnerService } from '../services/agent-runner-service.js'
|
|
44
44
|
import type { AIEmbeddingService } from '../services/ai-embedding-service.js'
|
|
45
|
-
import type {
|
|
46
|
-
import type { AgentRunService } from '../wirings/
|
|
45
|
+
import type { AgentRunStateService } from '../services/agent-run-state-service.js'
|
|
46
|
+
import type { AgentRunService } from '../wirings/agent/agent.types.js'
|
|
47
47
|
import type { VirtualUserRunStore } from '../wirings/virtual-user/virtual-user-run-store.js'
|
|
48
|
-
import type {
|
|
48
|
+
import type { PikkuAgentMiddlewareHooks } from '../wirings/agent/agent.types.js'
|
|
49
49
|
import type { WorkflowRunService } from '../wirings/workflow/workflow.types.js'
|
|
50
50
|
import type { CredentialService } from '../services/credential-service.js'
|
|
51
51
|
import type { EmailService } from '../services/email-service.js'
|
|
@@ -325,12 +325,12 @@ export interface CoreSingletonServices<Config extends CoreConfig = CoreConfig> {
|
|
|
325
325
|
eventHub?: EventHubService<Record<string, any>>
|
|
326
326
|
schedulerService?: SchedulerService
|
|
327
327
|
deploymentService?: DeploymentService
|
|
328
|
-
|
|
328
|
+
agentStorage?: AgentStorageService
|
|
329
329
|
|
|
330
330
|
content?: ContentService
|
|
331
|
-
|
|
331
|
+
agentRunner?: AgentRunnerService
|
|
332
332
|
aiEmbedding?: AIEmbeddingService
|
|
333
|
-
|
|
333
|
+
agentRunState?: AgentRunStateService
|
|
334
334
|
agentRunService?: AgentRunService
|
|
335
335
|
workflowRunService?: WorkflowRunService
|
|
336
336
|
credentialService?: CredentialService
|
|
@@ -547,14 +547,14 @@ export const pikkuChannelMiddlewareFactory = <In = any>(
|
|
|
547
547
|
return factory
|
|
548
548
|
}
|
|
549
549
|
|
|
550
|
-
export type {
|
|
550
|
+
export type { PikkuAgentMiddlewareHooks } from '../wirings/agent/agent.types.js'
|
|
551
551
|
|
|
552
|
-
export const
|
|
552
|
+
export const pikkuAgentMiddleware = <
|
|
553
553
|
State extends Record<string, unknown> = Record<string, unknown>,
|
|
554
554
|
SingletonServices extends CoreSingletonServices = CoreSingletonServices,
|
|
555
555
|
>(
|
|
556
|
-
hooks:
|
|
557
|
-
):
|
|
556
|
+
hooks: PikkuAgentMiddlewareHooks<State, SingletonServices>
|
|
557
|
+
): PikkuAgentMiddlewareHooks<State, SingletonServices> => hooks
|
|
558
558
|
|
|
559
559
|
export type CoreServices<SingletonServices = CoreSingletonServices> =
|
|
560
560
|
SingletonServices
|
package/src/types/state.types.ts
CHANGED
|
@@ -25,14 +25,11 @@ import type {
|
|
|
25
25
|
CoreMCPPrompt,
|
|
26
26
|
MCPPromptMeta,
|
|
27
27
|
} from '../wirings/mcp/mcp.types.js'
|
|
28
|
+
import type { CoreAgent, AgentsMeta } from '../wirings/agent/agent.types.js'
|
|
28
29
|
import type {
|
|
29
|
-
|
|
30
|
-
AIAgentMeta,
|
|
31
|
-
} from '../wirings/ai-agent/ai-agent.types.js'
|
|
32
|
-
import type {
|
|
33
|
-
PikkuAIScorer,
|
|
30
|
+
PikkuAgentScorer,
|
|
34
31
|
ScorerMeta,
|
|
35
|
-
} from '../wirings/
|
|
32
|
+
} from '../wirings/agent-scorer/agent-scorer.types.js'
|
|
36
33
|
import type {
|
|
37
34
|
CoreGateway,
|
|
38
35
|
GatewaysMeta,
|
|
@@ -47,9 +44,9 @@ import type {
|
|
|
47
44
|
} from '../wirings/scheduler/scheduler.types.js'
|
|
48
45
|
import type {
|
|
49
46
|
CoreWorkflow,
|
|
50
|
-
CoreFeature,
|
|
51
47
|
WorkflowsRuntimeMeta,
|
|
52
48
|
} from '../wirings/workflow/workflow.types.js'
|
|
49
|
+
import type { CoreFeature } from '../wirings/workflow/scenario.types.js'
|
|
53
50
|
import type {
|
|
54
51
|
CoreTrigger,
|
|
55
52
|
CoreTriggerSource,
|
|
@@ -102,6 +99,10 @@ export interface PikkuPackageState {
|
|
|
102
99
|
variableOverrides?: Record<string, string>
|
|
103
100
|
/** Per-instance name-aliases: logical name the addon reads -> actual project credential name */
|
|
104
101
|
credentialOverrides?: Record<string, string>
|
|
102
|
+
/** Secrets the host lends this instance, named as the addon reads them */
|
|
103
|
+
secretGrants?: string[]
|
|
104
|
+
/** Credentials the host lends this instance, named as the addon reads them */
|
|
105
|
+
credentialGrants?: string[]
|
|
105
106
|
/** Why this instance gets the whole `SecretService` rather than one scoped to its declared secrets */
|
|
106
107
|
globalSecrets?: string
|
|
107
108
|
/** Why this instance gets the whole `CredentialService` rather than one scoped to its declared credentials */
|
|
@@ -159,9 +160,9 @@ export interface PikkuPackageState {
|
|
|
159
160
|
promptsMeta: MCPPromptMeta
|
|
160
161
|
}
|
|
161
162
|
agent: {
|
|
162
|
-
agents: Map<string,
|
|
163
|
-
agentsMeta:
|
|
164
|
-
scorers: Map<string,
|
|
163
|
+
agents: Map<string, CoreAgent>
|
|
164
|
+
agentsMeta: AgentsMeta
|
|
165
|
+
scorers: Map<string, PikkuAgentScorer>
|
|
165
166
|
scorersMeta: ScorerMeta
|
|
166
167
|
/** Alias -> `provider/model`, from the `models` table in pikku.config.json. */
|
|
167
168
|
modelAliases: Record<string, string>
|
|
@@ -7,9 +7,9 @@ import type {
|
|
|
7
7
|
TargetAgentReply,
|
|
8
8
|
ActorFlowApprovalPolicy,
|
|
9
9
|
} from './actor-flow.types.js'
|
|
10
|
-
import type {
|
|
10
|
+
import type { AgentStepResult } from '../../services/agent-runner-service.js'
|
|
11
11
|
|
|
12
|
-
const stepResult = (object: unknown):
|
|
12
|
+
const stepResult = (object: unknown): AgentStepResult => ({
|
|
13
13
|
text: '',
|
|
14
14
|
object,
|
|
15
15
|
toolCalls: [],
|
|
@@ -5,11 +5,11 @@ import type {
|
|
|
5
5
|
TargetPendingApproval,
|
|
6
6
|
} from './actor-flow.types.js'
|
|
7
7
|
import type { ResolvedPersona } from '../../services/personas-service.js'
|
|
8
|
-
import type {
|
|
8
|
+
import type { AgentMessage } from '../agent/agent.types.js'
|
|
9
9
|
import type {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from '../../services/
|
|
10
|
+
AgentRunnerParams,
|
|
11
|
+
AgentStepResult,
|
|
12
|
+
} from '../../services/agent-runner-service.js'
|
|
13
13
|
|
|
14
14
|
/** One turn the actor takes: the message to send and whether it's finished. */
|
|
15
15
|
const ACTOR_TURN_SCHEMA = {
|
|
@@ -56,9 +56,7 @@ const DEFAULT_MAX_TURNS = 12
|
|
|
56
56
|
const DEFAULT_MAX_APPROVAL_ROUNDS = 16
|
|
57
57
|
|
|
58
58
|
/** The LLM call the actor uses for its own turns/decisions/evaluation. */
|
|
59
|
-
export type ActorLLM = (
|
|
60
|
-
params: AIAgentRunnerParams
|
|
61
|
-
) => Promise<AIAgentStepResult>
|
|
59
|
+
export type ActorLLM = (params: AgentRunnerParams) => Promise<AgentStepResult>
|
|
62
60
|
|
|
63
61
|
export interface RunConversationParams {
|
|
64
62
|
/** The person being played — name, job title, personality. */
|
|
@@ -85,7 +83,7 @@ export interface RunConversationParams {
|
|
|
85
83
|
agentName: string
|
|
86
84
|
}
|
|
87
85
|
|
|
88
|
-
function msg(role:
|
|
86
|
+
function msg(role: AgentMessage['role'], content: string): AgentMessage {
|
|
89
87
|
return {
|
|
90
88
|
id: globalThis.crypto.randomUUID(),
|
|
91
89
|
role,
|
|
@@ -221,7 +219,7 @@ export async function runConversation(
|
|
|
221
219
|
// Seed a kickoff so the very first actor turn has a non-empty message list
|
|
222
220
|
// (providers reject an empty prompt). It's an instruction TO the actor, so
|
|
223
221
|
// it never appears in the transcript.
|
|
224
|
-
const actorMessages:
|
|
222
|
+
const actorMessages: AgentMessage[] = [
|
|
225
223
|
msg(
|
|
226
224
|
'user',
|
|
227
225
|
'Begin the conversation now — send your first message to the assistant to work towards your goal.'
|