@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
|
@@ -11,6 +11,18 @@ 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[];
|
|
14
26
|
/**
|
|
15
27
|
* Hands this instance the whole `SecretService` instead of one scoped to the
|
|
16
28
|
* secrets it declared. The value is the reason, recorded in the deploy
|
|
@@ -16,6 +16,10 @@ 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
|
+
: {}),
|
|
19
23
|
...(config.globalSecrets ? { globalSecrets: config.globalSecrets } : {}),
|
|
20
24
|
...(config.globalCredentials
|
|
21
25
|
? { globalCredentials: config.globalCredentials }
|
|
@@ -42,7 +42,7 @@ export const prepareVirtualUserRun = (input) => {
|
|
|
42
42
|
}
|
|
43
43
|
const scopes = personaScopes(input.persona, roleScopes);
|
|
44
44
|
// Gated by the same scopes as the RPCs, because an agent is reached rather
|
|
45
|
-
// than declared: `
|
|
45
|
+
// than declared: `CoreAgent.scopes` is checked against the session, so a
|
|
46
46
|
// persona finds the specialists its roles unlock and no others.
|
|
47
47
|
const agents = reachableAgents(input.agentsMeta ?? {}, scopes);
|
|
48
48
|
return { catalogue, intents, scopes, agents };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Which of the product's agents a persona can actually talk to.
|
|
3
3
|
*
|
|
4
4
|
* An agent is not something a persona declares. It is something a persona
|
|
5
|
-
* *reaches*, under exactly the rule an RPC is reached by: `
|
|
5
|
+
* *reaches*, under exactly the rule an RPC is reached by: `CoreAgent.scopes`
|
|
6
6
|
* is checked against the session, so a persona holding the scopes an agent
|
|
7
7
|
* requires finds it in front of them, and one that does not, does not.
|
|
8
8
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CoreWorkflow } from './workflow.types.js';
|
|
2
|
+
import type { CoreFeature, FeaturePlanEntry } from './scenario.types.js';
|
|
2
3
|
export declare const addFeature: (featureId: string, feature: CoreFeature, packageName?: string | null) => void;
|
|
3
4
|
export declare const resolveFeatureScenarios: (features: Map<string, CoreFeature>, registrations: Map<string, CoreWorkflow>) => {
|
|
4
5
|
entries: FeaturePlanEntry[];
|
|
@@ -8,21 +8,10 @@ export { deriveInvocationId, uuidv5 } from './workflow-invocation-id.js';
|
|
|
8
8
|
export { isRef } from './graph/workflow-graph.types.js';
|
|
9
9
|
export type { RefValue } from './graph/workflow-graph.types.js';
|
|
10
10
|
export { buildRunTimeline, reconstructStateAt, reconstructFinalState, } from './run-timeline.js';
|
|
11
|
-
export type { RunTimeline, ReconstructedRunState
|
|
11
|
+
export type { RunTimeline, ReconstructedRunState } from './run-timeline.js';
|
|
12
12
|
export { addWorkflow } from './dsl/workflow-runner.js';
|
|
13
|
-
export { addFeature, resolveFeatureScenarios } from './feature.js';
|
|
14
13
|
export { template, type TemplateString } from './graph/template.js';
|
|
15
14
|
export { pikkuWorkflowGraph, type PikkuWorkflowGraphConfig, type PikkuWorkflowGraphResult, } from './graph/wire-workflow-graph.js';
|
|
16
15
|
export type { WorkflowStepInput as WorkflowStepQueueInput, PikkuWorkflowOrchestratorInput, PikkuWorkflowSleeperInput, } from './workflow-queue-workers.js';
|
|
17
|
-
export type { WorkflowService, WorkflowQueueOptions, WorkflowServiceConfig, WorkflowPlannedStep, WorkflowRunWire, WorkflowStatus, WorkflowVersionStatus, StepStatus, WorkflowRun, WorkflowRunStatus, StepState, WorkflowRunService, WorkflowRunMirror, CoreWorkflow,
|
|
18
|
-
export type { WorkflowStepOptions, WorkflowWireDoRPC, WorkflowApprovalOptions, ApprovalOutcome, InputSource, OutputBinding, RpcStepMeta, Condition, BranchStepMeta, ParallelGroupStepMeta, FanoutStepMeta, ReturnStepMeta, InlineStepMeta, SleepStepMeta, CancelStepMeta, SuspendStepMeta, ApprovalStepMeta, SetStepMeta, SwitchCaseMeta, SwitchStepMeta, FilterStepMeta, ArrayPredicateStepMeta,
|
|
19
|
-
export type { ScenarioStepPhase, ScenarioStepKind, ScenarioStepOptions, PikkuScenarioStepWire, ScenarioEnvironment, ScenarioSurface, ScenarioSurfaceResolution, } from './scenario-step.types.js';
|
|
20
|
-
export { SCENARIO_SURFACES } from './scenario-step.types.js';
|
|
21
|
-
export { resolveScenarioSurfaces } from './scenario-surface.js';
|
|
22
|
-
export { requireActor, requireScenarioEnv } from './scenario-step-guards.js';
|
|
23
|
-
export { pollUntil, type PollOptions } from './scenario-poll.js';
|
|
24
|
-
export { createCookieJar } from './scenario-cookie-jar.js';
|
|
25
|
-
export type { ScenarioCookieJar } from './scenario-cookie-jar.js';
|
|
26
|
-
export type { ScenarioHttpResponse, ScenarioJsonRequest, } from '../../services/personas-service.js';
|
|
27
|
-
export type { PikkuBrowserWire, TestIdSelector, ScenarioBrowserProvider, ScenarioBrowserFailure, } from './scenario-step.types.js';
|
|
28
|
-
export { composeStepProse, renderStepTemplate } from './scenario-prose.js';
|
|
16
|
+
export type { WorkflowService, WorkflowQueueOptions, WorkflowServiceConfig, WorkflowPlannedStep, WorkflowRunWire, WorkflowStatus, WorkflowVersionStatus, StepStatus, WorkflowRun, WorkflowRunStatus, StepState, WorkflowRunService, WorkflowRunMirror, CoreWorkflow, PikkuWorkflow, ContextVariable, WorkflowContext, WorkflowsMeta, WorkflowsRuntimeMeta, } from './workflow.types.js';
|
|
17
|
+
export type { WorkflowStepOptions, WorkflowWireDoRPC, WorkflowApprovalOptions, ApprovalOutcome, InputSource, OutputBinding, RpcStepMeta, Condition, BranchStepMeta, ParallelGroupStepMeta, FanoutStepMeta, ReturnStepMeta, InlineStepMeta, SleepStepMeta, CancelStepMeta, SuspendStepMeta, ApprovalStepMeta, SetStepMeta, SwitchCaseMeta, SwitchStepMeta, FilterStepMeta, ArrayPredicateStepMeta, WorkflowStepMeta, WorkflowStepWire, PikkuWorkflowWire, } from './workflow.types.js';
|
|
@@ -7,13 +7,5 @@ export { deriveInvocationId, uuidv5 } from './workflow-invocation-id.js';
|
|
|
7
7
|
export { isRef } from './graph/workflow-graph.types.js';
|
|
8
8
|
export { buildRunTimeline, reconstructStateAt, reconstructFinalState, } from './run-timeline.js';
|
|
9
9
|
export { addWorkflow } from './dsl/workflow-runner.js';
|
|
10
|
-
export { addFeature, resolveFeatureScenarios } from './feature.js';
|
|
11
10
|
export { template } from './graph/template.js';
|
|
12
11
|
export { pikkuWorkflowGraph, } from './graph/wire-workflow-graph.js';
|
|
13
|
-
export { SCENARIO_SURFACES } from './scenario-step.types.js';
|
|
14
|
-
// Which of a step's bindings run: one for an action, every witness for a `then`
|
|
15
|
-
export { resolveScenarioSurfaces } from './scenario-surface.js';
|
|
16
|
-
export { requireActor, requireScenarioEnv } from './scenario-step-guards.js';
|
|
17
|
-
export { pollUntil } from './scenario-poll.js';
|
|
18
|
-
export { createCookieJar } from './scenario-cookie-jar.js';
|
|
19
|
-
export { composeStepProse, renderStepTemplate } from './scenario-prose.js';
|
|
@@ -5,6 +5,16 @@ import type { PikkuRawWire } from '../../types/core.types.js';
|
|
|
5
5
|
import type { ScenarioPersonas } from '../../services/personas-service.js';
|
|
6
6
|
import type { ScenarioBrowserProvider, ScenarioEnvironment, ScenarioSurface } from './scenario-step.types.js';
|
|
7
7
|
import type { PikkuWorkflowWire, WorkflowQueueOptions } from './workflow.types.js';
|
|
8
|
+
export { addFeature, resolveFeatureScenarios } from './feature.js';
|
|
9
|
+
export type * from './scenario.types.js';
|
|
10
|
+
export { SCENARIO_SURFACES } from './scenario-step.types.js';
|
|
11
|
+
export { resolveScenarioSurfaces } from './scenario-surface.js';
|
|
12
|
+
export { pollUntil, type PollOptions } from './scenario-poll.js';
|
|
13
|
+
export { createCookieJar } from './scenario-cookie-jar.js';
|
|
14
|
+
export type { ScenarioCookieJar } from './scenario-cookie-jar.js';
|
|
15
|
+
export { composeStepProse, renderStepTemplate } from './scenario-prose.js';
|
|
16
|
+
export { requireActor, requireScenarioEnv } from './scenario-step-guards.js';
|
|
17
|
+
export type { ScenarioHttpResponse, ScenarioJsonRequest, } from '../../services/personas-service.js';
|
|
8
18
|
/**
|
|
9
19
|
* A workflow service with the scenario capability attached — the two lines
|
|
10
20
|
* `pikku scenario run` needs, in one call so no caller has to remember that the
|
|
@@ -7,6 +7,15 @@ import { InMemoryWorkflowService } from '../../services/in-memory-workflow-servi
|
|
|
7
7
|
import { runScheduledTask } from '../scheduler/scheduler-runner.js';
|
|
8
8
|
import { WorkflowStepNameNotString } from './workflow-errors.js';
|
|
9
9
|
import { resolveScenarioSurfaces, witnessesAgree } from './scenario-surface.js';
|
|
10
|
+
export { addFeature, resolveFeatureScenarios } from './feature.js';
|
|
11
|
+
export { SCENARIO_SURFACES } from './scenario-step.types.js';
|
|
12
|
+
// Which of a step's bindings run: one for an action, every witness for a `then`
|
|
13
|
+
export { resolveScenarioSurfaces } from './scenario-surface.js';
|
|
14
|
+
export { pollUntil } from './scenario-poll.js';
|
|
15
|
+
export { createCookieJar } from './scenario-cookie-jar.js';
|
|
16
|
+
export { composeStepProse, renderStepTemplate } from './scenario-prose.js';
|
|
17
|
+
export { requireActor, requireScenarioEnv } from './scenario-step-guards.js';
|
|
18
|
+
// The readers themselves live on `@pikku/core/persona`
|
|
10
19
|
/**
|
|
11
20
|
* A workflow service with the scenario capability attached — the two lines
|
|
12
21
|
* `pikku scenario run` needs, in one call so no caller has to remember that the
|
|
@@ -11,7 +11,7 @@ export interface RunTimelineEvent {
|
|
|
11
11
|
error?: SerializedError;
|
|
12
12
|
}
|
|
13
13
|
export type RunTimeline = RunTimelineEvent[];
|
|
14
|
-
type HistoryEntry = StepState & {
|
|
14
|
+
export type HistoryEntry = StepState & {
|
|
15
15
|
stepName: string;
|
|
16
16
|
};
|
|
17
17
|
export declare function buildRunTimeline(history: HistoryEntry[]): RunTimeline;
|
|
@@ -35,4 +35,3 @@ export interface ReconstructedRunState {
|
|
|
35
35
|
}
|
|
36
36
|
export declare function reconstructStateAt(timeline: RunTimeline, at: number | Date): ReconstructedRunState;
|
|
37
37
|
export declare function reconstructFinalState(timeline: RunTimeline): ReconstructedRunState;
|
|
38
|
-
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CorePikkuFunctionConfig, CorePikkuFunctionHook } from '../../function/functions.types.js';
|
|
2
|
+
export type { ScenarioStepInvocation, ScenarioStepMeta, PikkuScenarioWire, } from './dsl/workflow-dsl.types.js';
|
|
3
|
+
export type { ScenarioStepPhase, ScenarioStepKind, ScenarioStepOptions, PikkuScenarioStepWire, ScenarioEnvironment, ScenarioSurface, ScenarioSurfaceResolution, PikkuBrowserWire, TestIdSelector, ScenarioBrowserProvider, ScenarioBrowserFailure, } from './scenario-step.types.js';
|
|
4
|
+
export type CoreFeatureScenario = CorePikkuFunctionConfig<any, any, any> | {
|
|
5
|
+
scenario: CorePikkuFunctionConfig<any, any, any>;
|
|
6
|
+
data: unknown;
|
|
7
|
+
};
|
|
8
|
+
export type CoreFeature = {
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
tags?: string[];
|
|
12
|
+
scenarios: readonly CoreFeatureScenario[];
|
|
13
|
+
before?: CorePikkuFunctionHook;
|
|
14
|
+
after?: CorePikkuFunctionHook;
|
|
15
|
+
};
|
|
16
|
+
export type FeatureMetaEntry = {
|
|
17
|
+
scenario: string;
|
|
18
|
+
data?: unknown;
|
|
19
|
+
};
|
|
20
|
+
export type FeatureMeta = {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
tags: string[];
|
|
25
|
+
entries: FeatureMetaEntry[];
|
|
26
|
+
unresolvedEntries: number;
|
|
27
|
+
hasBefore: boolean;
|
|
28
|
+
hasAfter: boolean;
|
|
29
|
+
};
|
|
30
|
+
export type FeaturesMeta = Record<string, FeatureMeta>;
|
|
31
|
+
export type FeaturePlanEntry = {
|
|
32
|
+
featureId: string;
|
|
33
|
+
featureName: string;
|
|
34
|
+
scenarioName: string;
|
|
35
|
+
data?: unknown;
|
|
36
|
+
tags: string[];
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { SerializedError, CommonWireMeta } from '../../types/core.types.js';
|
|
2
|
-
import type { CorePikkuFunctionConfig
|
|
2
|
+
import type { CorePikkuFunctionConfig } from '../../function/functions.types.js';
|
|
3
3
|
import type { GroupConcurrencyConfig } from '../queue/queue.types.js';
|
|
4
4
|
export type { WorkflowService } from '../../services/workflow-service.js';
|
|
5
|
-
export type { WorkflowStepOptions, WorkflowWireDoRPC, WorkflowApprovalOptions, ApprovalOutcome, InputSource, OutputBinding, RpcStepMeta, Condition, BranchStepMeta, ParallelGroupStepMeta, FanoutStepMeta, ReturnStepMeta, InlineStepMeta, SleepStepMeta, CancelStepMeta, SuspendStepMeta, ApprovalStepMeta, SetStepMeta, SwitchCaseMeta, SwitchStepMeta, FilterStepMeta, ArrayPredicateStepMeta,
|
|
6
|
-
export type { ScenarioStepPhase, ScenarioStepOptions, PikkuScenarioStepWire, PikkuBrowserWire, ScenarioBrowserProvider, } from './scenario-step.types.js';
|
|
5
|
+
export type { WorkflowStepOptions, WorkflowWireDoRPC, WorkflowApprovalOptions, ApprovalOutcome, InputSource, OutputBinding, RpcStepMeta, Condition, BranchStepMeta, ParallelGroupStepMeta, FanoutStepMeta, ReturnStepMeta, InlineStepMeta, SleepStepMeta, CancelStepMeta, SuspendStepMeta, ApprovalStepMeta, SetStepMeta, SwitchCaseMeta, SwitchStepMeta, FilterStepMeta, ArrayPredicateStepMeta, WorkflowStepMeta, WorkflowStepWire, PikkuWorkflowWire, } from './dsl/workflow-dsl.types.js';
|
|
7
6
|
import type { WorkflowStepMeta } from './dsl/workflow-dsl.types.js';
|
|
8
7
|
export interface WorkflowRunWire {
|
|
9
8
|
type: string;
|
|
@@ -141,40 +140,6 @@ export type CoreWorkflow<PikkuFunctionConfig extends CorePikkuFunctionConfig<any
|
|
|
141
140
|
middleware?: PikkuFunctionConfig['middleware'];
|
|
142
141
|
tags?: string[];
|
|
143
142
|
};
|
|
144
|
-
export type CoreFeatureScenario = CorePikkuFunctionConfig<any, any, any> | {
|
|
145
|
-
scenario: CorePikkuFunctionConfig<any, any, any>;
|
|
146
|
-
data: unknown;
|
|
147
|
-
};
|
|
148
|
-
export type CoreFeature = {
|
|
149
|
-
name: string;
|
|
150
|
-
description?: string;
|
|
151
|
-
tags?: string[];
|
|
152
|
-
scenarios: readonly CoreFeatureScenario[];
|
|
153
|
-
before?: CorePikkuFunctionHook;
|
|
154
|
-
after?: CorePikkuFunctionHook;
|
|
155
|
-
};
|
|
156
|
-
export type FeatureMetaEntry = {
|
|
157
|
-
scenario: string;
|
|
158
|
-
data?: unknown;
|
|
159
|
-
};
|
|
160
|
-
export type FeatureMeta = {
|
|
161
|
-
id: string;
|
|
162
|
-
name: string;
|
|
163
|
-
description?: string;
|
|
164
|
-
tags: string[];
|
|
165
|
-
entries: FeatureMetaEntry[];
|
|
166
|
-
unresolvedEntries: number;
|
|
167
|
-
hasBefore: boolean;
|
|
168
|
-
hasAfter: boolean;
|
|
169
|
-
};
|
|
170
|
-
export type FeaturesMeta = Record<string, FeatureMeta>;
|
|
171
|
-
export type FeaturePlanEntry = {
|
|
172
|
-
featureId: string;
|
|
173
|
-
featureName: string;
|
|
174
|
-
scenarioName: string;
|
|
175
|
-
data?: unknown;
|
|
176
|
-
tags: string[];
|
|
177
|
-
};
|
|
178
143
|
export interface PikkuWorkflow {
|
|
179
144
|
start: <I>(input: I) => Promise<{
|
|
180
145
|
runId: string;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
type: decision
|
|
3
|
-
title: A non-streaming agent run registers with
|
|
4
|
-
description: Otherwise
|
|
5
|
-
tags: core,
|
|
3
|
+
title: A non-streaming agent run registers with agentRunState on the same terms as a streaming one
|
|
4
|
+
description: Otherwise interruptAgent finds the run, passes the ownership check, then cannot stop it — and reports that as if the run were on another host
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# A non-streaming agent run registers with `
|
|
8
|
+
# A non-streaming agent run registers with `agentRunState` too
|
|
9
9
|
|
|
10
|
-
`
|
|
10
|
+
`runAgent` registers its run with `agentRunState` exactly as `streamAgent`
|
|
11
11
|
does, even though nothing is streaming and there is no channel to interrupt.
|
|
12
12
|
|
|
13
|
-
`
|
|
13
|
+
`interruptAgent` resolves a run through `agentRunState` first, checks ownership,
|
|
14
14
|
then looks for a local abort handle. A run that skipped registration is invisible
|
|
15
15
|
at the first step. A run that registered but has no handle is visible, passes the
|
|
16
16
|
ownership check, and then cannot be stopped — which the interrupt path reports as
|
package/knowledge/decisions/internals/a-resumed-agent-turn-is-as-interruptible-as-the-first.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: A resumed turn is as interruptible as the first one
|
|
4
4
|
description: It is the same person listening to the same voice, and after an approval it is where most of the reply actually gets spoken
|
|
5
|
-
tags: core,
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# A resumed turn is as interruptible as the first one
|
package/knowledge/decisions/internals/actor-flow-drives-the-target-through-a-transport-seam.md
CHANGED
|
@@ -19,6 +19,6 @@ including middleware, permissions and session handling, rather than through an
|
|
|
19
19
|
in-process call that skips all of it. It also lets the engine be unit-tested
|
|
20
20
|
against scripted targets with no server at all.
|
|
21
21
|
|
|
22
|
-
**What this rules out:** calling `
|
|
22
|
+
**What this rules out:** calling `runAgent` / `streamAgent` directly from the
|
|
23
23
|
conversation engine, and widening `TargetAgentDriver` with transport details
|
|
24
24
|
(headers, cookies, channels) that would tie the engine to HTTP.
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: The AG-UI bridge obeys the client's event-ordering contract exactly
|
|
4
4
|
description: RUN_STARTED opens lazily, RUN_FINISHED fires once on done, and step names are globally sequential — a violation makes the client drop the whole stream
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# The AG-UI bridge obeys the client's event-ordering contract exactly
|
|
9
9
|
|
|
10
|
-
`wrapChannelWithAGUI` in `packages/core/src/wirings/
|
|
10
|
+
`wrapChannelWithAGUI` in `packages/core/src/wirings/agent/agent-agui.ts`
|
|
11
11
|
translates pikku stream events into AG-UI events under three rules that
|
|
12
12
|
`@ag-ui/client`'s `verifyEvents` enforces on the browser side:
|
|
13
13
|
|
|
14
14
|
`RUN_STARTED` is emitted lazily, from the first translated event, because the
|
|
15
15
|
client rejects anything that arrives before it — and because the real
|
|
16
|
-
`
|
|
17
|
-
is why `AGUIChannelOptions.getRunId` and `
|
|
16
|
+
`AgentRunStateService` run id only exists after the channel has been wrapped, which
|
|
17
|
+
is why `AGUIChannelOptions.getRunId` and `StreamAgentOptions.onRunCreated`
|
|
18
18
|
exist as late-bound sources. `RUN_FINISHED` is terminal for the client, so it is
|
|
19
19
|
sent exactly once, on `done`, carrying usage accumulated across all steps; per-step
|
|
20
20
|
`usage` events must not finish the run, or a multi-step tool run would emit later
|
|
21
21
|
steps after the terminal event and the client would drop the whole stream.
|
|
22
22
|
Step names must be unique among active steps, and sub-agents reuse step numbers
|
|
23
23
|
on the shared channel, so each `step-start` closes the previous step and takes a
|
|
24
|
-
sequential name. `
|
|
24
|
+
sequential name. `agent-agui.test.ts` re-implements those ordering rules so
|
|
25
25
|
the bridge is checked against the same contract the browser applies.
|
|
26
26
|
|
|
27
27
|
**What this rules out:** emitting `RUN_STARTED` eagerly at wrap time; finishing
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Audio chunks are labelled with the format the provider actually returned
|
|
4
4
|
description: The configured format is only a request, so the response's own format wins with the request and pcm16 as fallbacks
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Audio chunks are labelled with the format the provider actually returned
|
|
9
9
|
|
|
10
|
-
`synthesizeAudio` in `packages/core/src/wirings/
|
|
10
|
+
`synthesizeAudio` in `packages/core/src/wirings/agent/voice-output.ts` labels
|
|
11
11
|
each `audio-delta` event with `result.audio.format` first, falling back to the
|
|
12
12
|
requested `config.format` and finally to `pcm16`.
|
|
13
13
|
|
package/knowledge/decisions/internals/agent-context-waits-for-a-tool-result-still-being-written.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Loading agent context waits for a tool result that may still be landing
|
|
4
4
|
description: An interrupted run's tool can still be writing to the thread, and in voice the next turn arrives within seconds — soon enough to load context missing what it is about to be asked about
|
|
5
|
-
tags: core,
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Loading agent context waits for a tool result that may still be landing
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: A credential-required tool result never reaches the client or the transcript
|
|
4
4
|
description: The run suspends with credential-request events instead, leaving the tool call unresulted so it can be resumed after connecting
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# A credential-required tool result never reaches the client or the transcript
|
|
9
9
|
|
|
10
10
|
When a tool returns the `__credentialRequired` marker,
|
|
11
|
-
`
|
|
11
|
+
`streamAgent` in `packages/core/src/wirings/agent/agent-stream.ts`
|
|
12
12
|
filters that `tool-result` out of the channel before it can be streamed or
|
|
13
13
|
persisted, and `handleCredentialRequests` suspends the run and emits
|
|
14
14
|
`credential-request` events carrying the `runId` instead. Those events — not the
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Delegate mode hides the parent's later text, supervise mode hides the sub-agent's
|
|
4
4
|
description: Exactly one voice reaches the client per agent-mode; approvals and tool events always flow through either way
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Delegate mode hides the parent's later text, supervise mode hides the sub-agent's
|
|
9
9
|
|
|
10
10
|
An agent with sub-agents runs in one of two modes. In `'delegate'` (the default,
|
|
11
|
-
handled in `
|
|
12
|
-
`reasoning-delta` events are suppressed
|
|
11
|
+
handled in `streamAgent` in `agent-stream.ts`) the parent's `text-delta` and
|
|
12
|
+
`reasoning-delta` events are suppressed _after_ the first sub-agent call —
|
|
13
13
|
`delegateState.delegated` is the latch — so a parent that answers directly still
|
|
14
14
|
streams normally, while a parent that hands off does not narrate over its
|
|
15
15
|
sub-agent. In `'supervise'` (handled where the sub-agent channel is built in
|
|
16
|
-
`buildToolDefs` in `
|
|
16
|
+
`buildToolDefs` in `agent-prepare.ts`) the inverse holds: the sub-agent's text
|
|
17
17
|
and reasoning are dropped and only the supervisor speaks.
|
|
18
18
|
|
|
19
19
|
Suppression is confined to text and reasoning. Approval requests, tool calls,
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Nulls are stripped from approved tool arguments before execution
|
|
4
4
|
description: LLMs emit null for optional fields where the schema layer expects undefined, so a resumed tool call is cleaned recursively first
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Nulls are stripped from approved tool arguments before execution
|
|
9
9
|
|
|
10
|
-
`
|
|
11
|
-
`packages/core/src/wirings/
|
|
10
|
+
`resumeAgentSync` in
|
|
11
|
+
`packages/core/src/wirings/agent/agent-runner.ts` runs `stripNulls` over
|
|
12
12
|
the persisted arguments of an approved tool call before invoking the tool.
|
|
13
13
|
|
|
14
14
|
Models routinely fill every property in a JSON schema, using `null` to mean "not
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Model resolution stays a single seam even though it is currently a passthrough
|
|
4
4
|
description: resolveModelConfig looks removable but is the one merge point for per-request model overrides
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Model resolution stays a single seam even though it is currently a passthrough
|
|
9
9
|
|
|
10
10
|
`resolveModelConfig` in
|
|
11
|
-
`packages/core/src/wirings/
|
|
11
|
+
`packages/core/src/wirings/agent/agent-model-config.ts` returns the
|
|
12
12
|
agent's `model`, `temperature` and `maxSteps` unchanged, and ignores its
|
|
13
13
|
`_agentName` argument. It reads as dead indirection and is not.
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ Models are declared per agent in the provider-qualified `provider/model` form
|
|
|
16
16
|
(`openai/gpt-5-mini`); there is no config-level alias map to consult, which is
|
|
17
17
|
why the current body is a copy. The function exists so that every caller —
|
|
18
18
|
`prepareAgentRun`, both resume paths, and the per-request `input.model` /
|
|
19
|
-
`input.temperature` overrides applied in `
|
|
19
|
+
`input.temperature` overrides applied in `agent-prepare.ts` — assembles the
|
|
20
20
|
effective config the same way, through one place that can grow an alias map,
|
|
21
21
|
per-tenant defaults or provider fallbacks without touching them.
|
|
22
22
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
type: decision
|
|
3
|
-
title: An
|
|
3
|
+
title: An agentMiddleware onError hook cannot change how a run fails
|
|
4
4
|
description: Hook throws are swallowed so observability code can never convert, mask, or replace the original error
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# An
|
|
8
|
+
# An agentMiddleware onError hook cannot change how a run fails
|
|
9
9
|
|
|
10
|
-
Every `onError` invocation on the agent failure paths — in `
|
|
11
|
-
`continueAfterToolResult` (`
|
|
12
|
-
`continueAfterToolResultSync` (`
|
|
10
|
+
Every `onError` invocation on the agent failure paths — in `streamAgent` and
|
|
11
|
+
`continueAfterToolResult` (`agent-stream.ts`) and in `runAgent` and
|
|
12
|
+
`continueAfterToolResultSync` (`agent-runner.ts`) — is wrapped in its own
|
|
13
13
|
`try/catch` that discards whatever the hook throws. The run is then marked
|
|
14
14
|
`failed` with the original error message, and the original error propagates.
|
|
15
15
|
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: AI runner methods must be called on the runner, never as detached references
|
|
4
4
|
description: Implementations use this internally, so grabbing transcribe or generateSpeech as a bare function loses the receiver and throws at runtime
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# AI runner methods must be called on the runner, never as detached references
|
|
9
9
|
|
|
10
10
|
The voice middlewares in `voice-input.ts` and `voice-output.ts` invoke
|
|
11
|
-
`
|
|
11
|
+
`agentRunner.transcribe(...)` and `agentRunner.generateSpeech?.(...)` as
|
|
12
12
|
method calls on the service object, and only ever test them for presence.
|
|
13
13
|
|
|
14
|
-
`
|
|
14
|
+
`AgentRunnerService` is an interface implemented by classes — the reference
|
|
15
15
|
implementation's `transcribe` calls `this.getModel(...)`. Extracting the method
|
|
16
|
-
into a local (`const { transcribe } = services.
|
|
16
|
+
into a local (`const { transcribe } = services.agentRunner`) type-checks
|
|
17
17
|
cleanly and then fails at runtime with `this` undefined. The regression is
|
|
18
18
|
pinned by a runner in `voice-input.test.ts` whose `transcribe` deliberately reads
|
|
19
19
|
instance state through `this`.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Agent speech travels as a CUSTOM AG-UI event rather than being dropped
|
|
4
4
|
description: AG-UI has no speech event, and dropping it makes a voice agent reached over HTTP silently inaudible while the provider still bills for the audio
|
|
5
|
-
tags: core,
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Agent speech travels as a CUSTOM AG-UI event
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Persisting an agent stream from send is best-effort and must never reject
|
|
4
4
|
description: The persisting channel flushes fire-and-forget because send is synchronous; a storage failure degrades the transcript instead of killing the process
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Persisting an agent stream from send is best-effort and must never reject
|
|
9
9
|
|
|
10
10
|
`createPersistingChannel` in
|
|
11
|
-
`packages/core/src/wirings/
|
|
11
|
+
`packages/core/src/wirings/agent/agent-stream.ts` accumulates step text,
|
|
12
12
|
tool calls and tool results, and writes them via `flushDetached` on the `usage`
|
|
13
|
-
and `done` events. `
|
|
13
|
+
and `done` events. `AgentStreamChannel.send` is synchronous, so it cannot await the
|
|
14
14
|
write. An unawaited rejection has nothing to propagate to and surfaces as an
|
|
15
15
|
`unhandledRejection`, which takes the whole server process down — a model
|
|
16
16
|
reusing a `toolCallId`, which is a primary key in AI storage, is enough to
|
|
@@ -18,7 +18,7 @@ trigger it. `flushDetached` therefore catches and logs, and the run carries on.
|
|
|
18
18
|
|
|
19
19
|
The awaited `flush()` on the suspend paths (`handleApprovals`,
|
|
20
20
|
`handleCredentialRequests`) is the seam that still surfaces persistence failures
|
|
21
|
-
to a caller. The regression test lives in `
|
|
21
|
+
to a caller. The regression test lives in `agent-stream.test.ts`; because the
|
|
22
22
|
floating promise settles on a later macrotask, the assertion has to wait a real
|
|
23
23
|
timer before checking that no `unhandledRejection` fired.
|
|
24
24
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: A delegated sub-agent inherits the parent run's context block
|
|
4
4
|
description: The sub-agent tool schema carries only message and session, so the parent's identifier block is forwarded rather than re-typed by the model
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# A delegated sub-agent inherits the parent run's context block
|
|
9
9
|
|
|
10
10
|
`buildSubAgentRunInput` in
|
|
11
|
-
`packages/core/src/wirings/
|
|
12
|
-
run's `
|
|
11
|
+
`packages/core/src/wirings/agent/agent-prepare.ts` forwards the parent
|
|
12
|
+
run's `AgentInput.context` — the "Current context" identifier block with
|
|
13
13
|
organization, project and stage ids — into every delegated sub-agent run, on
|
|
14
14
|
both the streaming and non-streaming paths. `buildToolDefs` threads it down as
|
|
15
15
|
`parentContext` for the same reason.
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: A tool's execute() failure is logged before the AI SDK swallows it
|
|
4
4
|
description: Every agent tool is wrapped in a logging try/catch, because a thrown tool error otherwise becomes a conversational reply and is invisible server-side
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# A tool's execute() failure is logged before the AI SDK swallows it
|
|
9
9
|
|
|
10
|
-
`buildToolDefs` in `packages/core/src/wirings/
|
|
10
|
+
`buildToolDefs` in `packages/core/src/wirings/agent/agent-prepare.ts`
|
|
11
11
|
wraps every tool it builds — RPC tools, sub-agent delegations and workflow tools
|
|
12
12
|
alike — in a `try/catch` that logs through `singletonServices.logger` and
|
|
13
13
|
rethrows.
|
|
@@ -18,7 +18,7 @@ and turns it into a conversational "tool error" reply to the model. The exceptio
|
|
|
18
18
|
never reaches pikku's own logger, so without this wrapper a consistently failing
|
|
19
19
|
tool is undiagnosable from the server side — the only symptom is an agent that
|
|
20
20
|
keeps apologising. The wrapper is applied unconditionally, not only when an
|
|
21
|
-
`
|
|
21
|
+
`agentMiddleware` `afterToolCall` hook happens to be registered.
|
|
22
22
|
|
|
23
23
|
**What this rules out:** folding the logging into the optional middleware
|
|
24
24
|
wrapper below it, and relying on the AI SDK's own error reporting for tool
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Voice input transcribes audio parts sequentially and in place
|
|
4
4
|
description: Each audio part is replaced by its text where it sat, one at a time, bounding concurrent downloads and preserving content order
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Voice input transcribes audio parts sequentially and in place
|
|
9
9
|
|
|
10
10
|
The `voiceInput` middleware in
|
|
11
|
-
`packages/core/src/wirings/
|
|
11
|
+
`packages/core/src/wirings/agent/voice-input.ts` walks the last user
|
|
12
12
|
message's content parts in order and swaps each audio part for a text part at the
|
|
13
13
|
same index, awaiting one transcription before starting the next.
|
|
14
14
|
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Working memory is persisted only when the merged value validates
|
|
4
4
|
description: A failed schema check logs and drops the update rather than saving it, because invalid state poisons every later read
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Working memory is persisted only when the merged value validates
|
|
9
9
|
|
|
10
10
|
`createWorkingMemoryMiddleware` in
|
|
11
|
-
`packages/core/src/wirings/
|
|
11
|
+
`packages/core/src/wirings/agent/agent-memory.ts` parses the model's
|
|
12
12
|
`<working_memory>` block, deep-merges it into the stored value, validates the
|
|
13
13
|
merge against the agent's working-memory schema when one is declared, and calls
|
|
14
14
|
`saveWorkingMemory` only if the merge is valid. An invalid merge is logged as a
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: An interrupt is not a failure, and the non-streaming path throws rather than returning
|
|
4
4
|
description: It skips the onError hooks and never becomes an errorMessage; with no partial reply to hand back, a typed throw is what distinguishes it from a provider outage
|
|
5
|
-
tags: core,
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# An interrupt is not a failure
|
|
@@ -14,7 +14,7 @@ that did not happen.
|
|
|
14
14
|
|
|
15
15
|
The streaming and non-streaming paths then diverge, because what they can hand
|
|
16
16
|
back differs. A stream has already delivered part of the reply, so it returns
|
|
17
|
-
that fragment. `
|
|
17
|
+
that fragment. `runAgent` has delivered nothing — there is no partial answer to
|
|
18
18
|
return — so it throws a typed error instead. A caller can tell that apart from a
|
|
19
19
|
provider outage, which returning an empty result would not allow.
|
|
20
20
|
|