@pikku/core 0.12.83 → 0.12.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -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 +4 -4
- package/dist/services/index.js +1 -1
- package/dist/services/meta-service.d.ts +3 -3
- 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 +10 -10
- package/dist/types/core.types.js +1 -1
- package/dist/types/state.types.d.ts +5 -5
- 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/voice-output.d.ts +1 -2
- package/dist/wirings/channel/channel-rpc.types.d.ts +2 -2
- package/dist/wirings/rpc/rpc-runner.d.ts +1 -1
- package/dist/wirings/rpc/rpc-runner.js +2 -2
- package/dist/wirings/rpc/rpc-types.d.ts +1 -1
- 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/run-timeline.d.ts +1 -2
- 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 -3
- 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 +173 -68
- 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 +9 -9
- package/src/services/meta-service.ts +3 -3
- 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 +12 -12
- package/src/types/state.types.ts +6 -9
- 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} +52 -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/rpc-runner.ts +2 -2
- package/src/wirings/rpc/rpc-types.ts +1 -1
- 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/run-timeline.ts +1 -1
- 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
|
@@ -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
|
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: An interrupt for a run owned by another instance says so, rather than returning false
|
|
4
4
|
description: A bare false is indistinguishable from "already finished", which is the one deployment shape the in-process registry cannot cover
|
|
5
|
-
tags: core,
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# An interrupt for a run owned by another instance says so
|
|
9
9
|
|
|
10
|
-
`
|
|
10
|
+
`interruptAgent` resolves a run through `agentRunState`, then tries to abort it
|
|
11
11
|
via the in-process registry. A run still marked `running` that this process has
|
|
12
12
|
no abort handle for is executing on another instance.
|
|
13
13
|
|
|
@@ -19,7 +19,7 @@ the condition instead.
|
|
|
19
19
|
|
|
20
20
|
**What this rules out:** collapsing the two outcomes into one boolean because
|
|
21
21
|
the caller "only cares whether it stopped". The caller cares a great deal about
|
|
22
|
-
the difference between
|
|
22
|
+
the difference between _stopped_ and _cannot be stopped from here_.
|
|
23
23
|
|
|
24
24
|
The fix for the underlying gap is `signalRunInterrupt`, which fans the interrupt
|
|
25
25
|
out over `eventHub` so every instance tries locally.
|
package/knowledge/decisions/internals/an-agent-stream-send-must-return-the-inner-sends-promise.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: A wrapped agent-stream send must return the inner send's promise
|
|
4
4
|
description: Middleware runs asynchronously, so dropping the returned promise turns every awaited channel.send upstream into a no-op
|
|
5
|
-
tags: core,
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# A wrapped agent-stream send must return the inner send's promise
|
|
9
9
|
|
|
10
|
-
`
|
|
10
|
+
`streamAgent` wraps the caller's channel so every event passes through the
|
|
11
11
|
stream middleware. That wrapper's `send` returns whatever the inner `send`
|
|
12
12
|
returns, and it must: the middleware chain is asynchronous, so a wrapper that
|
|
13
13
|
calls the inner `send` and returns `undefined` resolves immediately while the
|
package/knowledge/decisions/internals/an-empty-text-part-is-omitted-from-an-agent-message.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: A message with nothing to say carries no text part at all
|
|
4
4
|
description: An attachment on its own is a real turn, and providers are entitled to reject an empty text part sitting beside it
|
|
5
|
-
tags: core,
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# A message with nothing to say carries no text part
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: A transcript is recorded only when something was actually heard
|
|
4
4
|
description: Recording an empty string sends a transcript event saying the user said nothing, which renders as an empty bubble rather than a pending one
|
|
5
|
-
tags: core,
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# A transcript is recorded only when something was actually heard
|
package/knowledge/decisions/internals/speech-synthesis-picks-a-voice-per-sentence-and-warns-once.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Speech synthesis picks a voice per sentence but announces a limitation once
|
|
4
4
|
description: A bilingual reply should speak the half it can, and repeating the notice for every sentence would bury the reply itself
|
|
5
|
-
tags: core,
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Speech synthesis picks a voice per sentence, and warns once per reply
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: The agent `done` event goes through the middleware and is awaited
|
|
4
4
|
description: `done` is the only end-of-reply signal a stream hook gets, and buffering hooks flush on it — sending it raw discards work already paid for
|
|
5
|
-
tags: core,
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# The agent `done` event goes through the middleware and is awaited
|
|
@@ -24,6 +24,6 @@ same call.
|
|
|
24
24
|
|
|
25
25
|
**What this rules out:** adding a per-call `model` parameter, collapsing
|
|
26
26
|
`embedDocuments` and `embedQuery` into one `embed`, and pointing a vector store
|
|
27
|
-
at `
|
|
27
|
+
at `AgentRunnerService.embed` / `embedMany` instead — those take a per-call
|
|
28
28
|
model on purpose and drag in the whole agent-runner tool loop, and they give back
|
|
29
29
|
neither guarantee.
|
|
@@ -11,16 +11,16 @@ tags: core, rpc, performance
|
|
|
11
11
|
an object literal, and that literal declared `get agent()` so the agent facade
|
|
12
12
|
stayed lazy — most requests never touch it, and reading it builds five closures.
|
|
13
13
|
|
|
14
|
-
The laziness is right. Declaring the accessor
|
|
14
|
+
The laziness is right. Declaring the accessor _on the literal_ was not: a
|
|
15
15
|
literal containing an accessor needs a real property descriptor per instance,
|
|
16
16
|
which takes it off V8's fast object-literal construction path and slows the
|
|
17
17
|
whole object, not just the accessor.
|
|
18
18
|
|
|
19
19
|
Measured with `benchmarks/bench-profile-granular.ts`, three runs each:
|
|
20
20
|
|
|
21
|
-
| shape
|
|
22
|
-
|
|
|
23
|
-
| object literal with `get agent()`
|
|
21
|
+
| shape | per call |
|
|
22
|
+
| ----------------------------------- | ------------------------ |
|
|
23
|
+
| object literal with `get agent()` | 1.106 / 1.433 / 1.147 µs |
|
|
24
24
|
| class with `agent` on the prototype | 0.523 / 0.461 / 0.525 µs |
|
|
25
25
|
|
|
26
26
|
Roughly 2.4×, well outside the run-to-run variance, on a path every request
|
|
@@ -28,7 +28,7 @@ takes. On the same machine a full `fetchData` measures 12–19µs, so this was o
|
|
|
28
28
|
the order of a tenth of a request spent constructing one object.
|
|
29
29
|
|
|
30
30
|
The obvious alternative is worse. Making `agent` an eager property removes the
|
|
31
|
-
accessor but builds those five closures unconditionally, and measured
|
|
31
|
+
accessor but builds those five closures unconditionally, and measured _slower_
|
|
32
32
|
than the original at 1.967µs. A prototype accessor is the only shape that keeps
|
|
33
33
|
the laziness and the fast construction path.
|
|
34
34
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: A voice turn's transcript is sent before the run starts, on the raw channel
|
|
4
4
|
description: The client does not know what it said, and an answer starts streaming within a few hundred milliseconds — a question arriving after its answer reads as the wrong question
|
|
5
|
-
tags: core,
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# A voice turn's transcript is sent ahead of the run
|
|
@@ -10,7 +10,7 @@ tags: core, ai-agent
|
|
|
10
10
|
A voice client sends audio, so it does not know what it said. Until the
|
|
11
11
|
transcript reaches it, its own message renders as a blank bubble.
|
|
12
12
|
|
|
13
|
-
The event is sent
|
|
13
|
+
The event is sent _before_ the run rather than alongside it because the answer
|
|
14
14
|
begins streaming within a few hundred milliseconds. Sent concurrently, the
|
|
15
15
|
transcript routinely lands after the first tokens of its own answer — and a
|
|
16
16
|
question that appears beneath its answer reads as a question about something
|
package/knowledge/decisions/internals/thread-history-records-the-transcript-not-the-audio.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Thread history records what the model was asked, which for a spoken turn is the transcript
|
|
4
4
|
description: The wire carried a base64 audio blob; persisting it writes megabytes of unreadable data and loses the only readable record of the turn
|
|
5
|
-
tags: core,
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Thread history records the transcript, not the audio that arrived
|
|
@@ -13,7 +13,7 @@ carried a base64 audio blob, and `voiceInput` replaced it with a transcript
|
|
|
13
13
|
before the model ever saw it.
|
|
14
14
|
|
|
15
15
|
Persisting the blob would write megabytes of unreadable data into the history
|
|
16
|
-
|
|
16
|
+
_and_ discard the only readable record of what was said — the worst of both.
|
|
17
17
|
|
|
18
18
|
Both the streaming and non-streaming paths do this, and both check identity
|
|
19
19
|
rather than assuming: a middleware is free to rewrite the message list into
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Only an explicit `false` silences a spoken reply
|
|
4
4
|
description: The key being absent means no voice input is wired and nothing reported either way, so those callers keep the behaviour they had before the option existed
|
|
5
|
-
tags: core,
|
|
5
|
+
tags: core, agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Only an explicit `false` silences a spoken reply
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Only a Symbol-branded framework result can request tool approval
|
|
4
4
|
description: Approval markers are trusted from the APPROVAL_REQUIRED Symbol on a forwardsApproval tool, never from a JSON key an LLM could emit
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Only a Symbol-branded framework result can request tool approval
|
|
9
9
|
|
|
10
10
|
`checkForApprovals` in
|
|
11
|
-
`packages/core/src/wirings/
|
|
11
|
+
`packages/core/src/wirings/agent/agent-stream.ts` honours a forwarded
|
|
12
12
|
approval only when both hold: the tool declares `forwardsApproval` (set solely by
|
|
13
13
|
framework code on the sub-agent delegating tools built in
|
|
14
|
-
`
|
|
14
|
+
`agent-prepare.ts`), and its result carries the `APPROVAL_REQUIRED` unique
|
|
15
15
|
Symbol. The companion `__approvalRequired` string key exists for transport, but
|
|
16
16
|
is never what the decision reads.
|
|
17
17
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Credential requests are trusted only when Symbol-branded
|
|
4
4
|
description: The string key is a wire field; the Symbol is the capability, and only core can mint it
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Credential requests are trusted only when Symbol-branded
|
|
9
9
|
|
|
10
10
|
A tool result asking the run to suspend and prompt for a credential is honoured
|
|
11
11
|
only when it carries the `CREDENTIAL_REQUIRED` Symbol minted in
|
|
12
|
-
`
|
|
12
|
+
`agent-prepare.ts`. `checkForCredentialRequests` in `agent-stream.ts`
|
|
13
13
|
tests for that Symbol, never for the `__credentialRequired` string key that
|
|
14
14
|
travels beside it on the wire.
|
|
15
15
|
|
|
@@ -24,7 +24,7 @@ primitive inside the product's own UI. This mirrors the `APPROVAL_REQUIRED`
|
|
|
24
24
|
brand, which exists for the identical reason one function over.
|
|
25
25
|
|
|
26
26
|
The brand survives because the object is passed by reference the whole way —
|
|
27
|
-
core's `buildToolDefs` wrapper returns it, the Vercel adapter's `
|
|
27
|
+
core's `buildToolDefs` wrapper returns it, the Vercel adapter's `agentTool` hands
|
|
28
28
|
it back verbatim, and the AI SDK puts the raw value on the stream part rather
|
|
29
29
|
than the JSON form it builds separately for the model.
|
|
30
30
|
|
|
@@ -33,5 +33,5 @@ result` for convenience, or introducing any path where a credential request is
|
|
|
33
33
|
reconstructed from parsed JSON rather than passed by reference — either one
|
|
34
34
|
silently converts the gate into a formality. Note the inverse holds for the
|
|
35
35
|
`credentialFilteredChannel` suppression later in the same file: that one
|
|
36
|
-
deliberately matches the
|
|
36
|
+
deliberately matches the _string_ key, because it hides tool results from the
|
|
37
37
|
client and a broader match leaks less, not more.
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: An agent requires a session only when auth is true, but always enforces scopes and permissions
|
|
4
4
|
description: Agents follow pikkuSessionlessFunc semantics so crons and queue workers can run them; scopes are an AND gate checked before any permission I/O
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# An agent requires a session only when auth is true, but always enforces scopes and permissions
|
|
9
9
|
|
|
10
10
|
`assertAgentAuthorized` in
|
|
11
|
-
`packages/core/src/wirings/
|
|
12
|
-
session presence (only when `
|
|
11
|
+
`packages/core/src/wirings/agent/agent-prepare.ts` enforces, in order:
|
|
12
|
+
session presence (only when `CoreAgent.auth === true`), then `scopes`, then
|
|
13
13
|
`permissions`. The ordering mirrors the function runner — scopes AND together so
|
|
14
14
|
they can only narrow access, and a missing scope short-circuits before any
|
|
15
15
|
permission function does I/O. Declared `scopes` are narrowed to the generated
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: An agent ownership failure never echoes the resource it refused
|
|
4
4
|
description: assertResourceOwner throws a bare ForbiddenError so the error cannot be used as an existence oracle, at the cost of thinner debugging output
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# An agent ownership failure never echoes the resource it refused
|
|
9
9
|
|
|
10
10
|
`assertResourceOwner` in
|
|
11
|
-
`packages/core/src/wirings/
|
|
11
|
+
`packages/core/src/wirings/agent/agent-prepare.ts` compares a stored
|
|
12
12
|
thread/run `resourceId` against the caller's composed owner key and throws
|
|
13
13
|
`ForbiddenError('Not authorized to access this thread' | '… run')` on a
|
|
14
14
|
mismatch. The message deliberately carries no id.
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
type: decision
|
|
3
3
|
title: Resuming a suspended agent run re-runs the agent's authorization gate
|
|
4
4
|
description: Ownership of the run is not enough — a grant revoked while the run was suspended must block the approval
|
|
5
|
-
tags:
|
|
5
|
+
tags: agent
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Resuming a suspended agent run re-runs the agent's authorization gate
|
|
9
9
|
|
|
10
|
-
Both `
|
|
11
|
-
(`
|
|
12
|
-
ownership and before touching `
|
|
10
|
+
Both `resumeAgent` (`agent-stream.ts`) and `resumeAgentSync`
|
|
11
|
+
(`agent-runner.ts`) call `assertAgentAuthorized` after asserting run
|
|
12
|
+
ownership and before touching `agentRunState.resolveApproval`.
|
|
13
13
|
|
|
14
14
|
Ownership proves the run belongs to the caller, not that the caller may still
|
|
15
15
|
act on it: a suspension can outlive the permission that created it, and the whole
|