@pikku/core 0.12.79 → 0.12.82
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 +473 -0
- package/dist/dev/hot-reload.js +1 -6
- package/dist/ecosystem.d.ts +27 -0
- package/dist/ecosystem.js +26 -0
- package/dist/errors/error-handler.js +4 -2
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/function/function-runner.js +22 -47
- package/dist/function/functions.types.d.ts +9 -5
- package/dist/function/index.d.ts +1 -1
- package/dist/index.d.ts +14 -19
- package/dist/index.js +6 -11
- package/dist/middleware/auth-cookie.d.ts +0 -4
- package/dist/middleware/auth-cookie.js +38 -2
- package/dist/middleware/cors.js +1 -0
- package/dist/middleware/index.d.ts +1 -1
- package/dist/middleware/index.js +1 -1
- package/dist/middleware/remote-auth.js +14 -3
- package/dist/permissions.d.ts +8 -10
- package/dist/permissions.js +0 -11
- package/dist/pikku-state.js +16 -5
- package/dist/schema.js +35 -1
- package/dist/services/ai-agent-runner-service.d.ts +7 -0
- package/dist/services/ai-run-state-service.d.ts +17 -1
- package/dist/services/in-memory-ai-run-state-service.d.ts +6 -2
- package/dist/services/in-memory-ai-run-state-service.js +11 -1
- package/dist/services/in-memory-workflow-service.js +2 -0
- package/dist/services/index.d.ts +15 -15
- package/dist/services/index.js +5 -5
- package/dist/services/local-content-request-handler.d.ts +21 -0
- package/dist/services/local-content-request-handler.js +72 -53
- package/dist/services/local-content.d.ts +6 -0
- package/dist/services/local-content.js +14 -1
- package/dist/services/scoped-credential-service.d.ts +21 -0
- package/dist/services/scoped-credential-service.js +53 -0
- package/dist/services/workflow-service.d.ts +4 -2
- package/dist/testing/service-tests/agent-run-service-tests.d.ts +10 -0
- package/dist/testing/service-tests/agent-run-service-tests.js +72 -0
- package/dist/testing/service-tests/ai-storage-service-tests.d.ts +3 -0
- package/dist/testing/service-tests/ai-storage-service-tests.js +302 -0
- package/dist/testing/service-tests/channel-store-tests.d.ts +3 -0
- package/dist/testing/service-tests/channel-store-tests.js +72 -0
- package/dist/testing/service-tests/credential-service-tests.d.ts +3 -0
- package/dist/testing/service-tests/credential-service-tests.js +109 -0
- package/dist/testing/service-tests/deployment-service-tests.d.ts +3 -0
- package/dist/testing/service-tests/deployment-service-tests.js +21 -0
- package/dist/testing/service-tests/event-hub-store-tests.d.ts +3 -0
- package/dist/testing/service-tests/event-hub-store-tests.js +34 -0
- package/dist/testing/service-tests/secret-service-tests.d.ts +3 -0
- package/dist/testing/service-tests/secret-service-tests.js +80 -0
- package/dist/testing/service-tests/session-store-tests.d.ts +3 -0
- package/dist/testing/service-tests/session-store-tests.js +43 -0
- package/dist/testing/service-tests/workflow-run-service-tests.d.ts +3 -0
- package/dist/testing/service-tests/workflow-run-service-tests.js +42 -0
- package/dist/testing/service-tests/workflow-service-tests.d.ts +3 -0
- package/dist/testing/service-tests/workflow-service-tests.js +150 -0
- package/dist/testing/service-tests.d.ts +6 -0
- package/dist/testing/service-tests.js +26 -791
- package/dist/types/core.types.d.ts +11 -3
- package/dist/types/state.types.d.ts +14 -1
- package/dist/wirings/actor-flow/index.d.ts +1 -1
- package/dist/wirings/actor-flow/run-conversation.js +1 -6
- package/dist/wirings/ai-agent/agent-rpc.d.ts +15 -0
- package/dist/wirings/ai-agent/agent-rpc.js +53 -0
- package/dist/wirings/ai-agent/ai-agent-agui.js +1 -5
- package/dist/wirings/ai-agent/ai-agent-finalize.d.ts +58 -0
- package/dist/wirings/ai-agent/ai-agent-finalize.js +138 -0
- package/dist/wirings/ai-agent/ai-agent-interrupt.js +1 -0
- package/dist/wirings/ai-agent/ai-agent-memory.d.ts +2 -8
- package/dist/wirings/ai-agent/ai-agent-memory.js +37 -18
- package/dist/wirings/ai-agent/ai-agent-model-config.d.ts +7 -0
- package/dist/wirings/ai-agent/ai-agent-model-config.js +44 -1
- package/dist/wirings/ai-agent/ai-agent-prepare.js +5 -9
- package/dist/wirings/ai-agent/ai-agent-runner.js +89 -147
- package/dist/wirings/ai-agent/ai-agent-stream.js +109 -97
- package/dist/wirings/ai-agent/ai-agent-turn.d.ts +57 -0
- package/dist/wirings/ai-agent/ai-agent-turn.js +82 -0
- package/dist/wirings/ai-agent/ai-agent.types.d.ts +47 -2
- package/dist/wirings/ai-agent/index.d.ts +8 -7
- package/dist/wirings/ai-agent/index.js +5 -4
- package/dist/wirings/ai-agent/voice-input.js +1 -6
- package/dist/wirings/ai-agent/voice-output.js +2 -12
- package/dist/wirings/ai-scorer/ai-scorer-grade.d.ts +26 -0
- package/dist/wirings/ai-scorer/ai-scorer-grade.js +33 -0
- package/dist/wirings/ai-scorer/ai-scorer-judge.d.ts +17 -0
- package/dist/wirings/ai-scorer/ai-scorer-judge.js +92 -0
- package/dist/wirings/ai-scorer/ai-scorer-live.d.ts +15 -0
- package/dist/wirings/ai-scorer/ai-scorer-live.js +38 -0
- package/dist/wirings/ai-scorer/ai-scorer-registry.d.ts +18 -0
- package/dist/wirings/ai-scorer/ai-scorer-registry.js +46 -0
- package/dist/wirings/ai-scorer/ai-scorer-sampling.d.ts +8 -0
- package/dist/wirings/ai-scorer/ai-scorer-sampling.js +31 -0
- package/dist/wirings/ai-scorer/ai-scorer-snapshots.d.ts +10 -0
- package/dist/wirings/ai-scorer/ai-scorer-snapshots.js +40 -0
- package/dist/wirings/ai-scorer/ai-scorer-worker.d.ts +15 -0
- package/dist/wirings/ai-scorer/ai-scorer-worker.js +58 -0
- package/dist/wirings/ai-scorer/ai-scorer.d.ts +39 -0
- package/dist/wirings/ai-scorer/ai-scorer.js +40 -0
- package/dist/wirings/ai-scorer/ai-scorer.types.d.ts +90 -0
- package/dist/wirings/ai-scorer/ai-scorer.types.js +4 -0
- package/dist/wirings/ai-scorer/index.d.ts +6 -0
- package/dist/wirings/ai-scorer/index.js +5 -0
- package/dist/wirings/channel/channel-common.js +1 -0
- package/dist/wirings/channel/channel-handler.js +3 -5
- package/dist/wirings/channel/channel-rpc-service.d.ts +0 -6
- package/dist/wirings/channel/channel-rpc-service.js +0 -8
- package/dist/wirings/channel/channel-rpc.types.d.ts +6 -0
- package/dist/wirings/channel/channel-rpc.types.js +8 -0
- package/dist/wirings/channel/channel-runner.d.ts +1 -3
- package/dist/wirings/channel/channel-runner.js +16 -8
- package/dist/wirings/channel/channel.types.d.ts +2 -0
- package/dist/wirings/channel/index.d.ts +5 -6
- package/dist/wirings/channel/index.js +3 -4
- package/dist/wirings/channel/local/local-channel-runner.js +8 -1
- package/dist/wirings/channel/pikku-abstract-channel-handler.js +1 -0
- package/dist/wirings/channel/serverless/serverless-channel-runner.js +3 -0
- package/dist/wirings/cli/channel/cli-channel-runner.js +2 -0
- package/dist/wirings/cli/channel/cli-raw-channel-runner.js +9 -1
- package/dist/wirings/cli/channel/index.d.ts +1 -2
- package/dist/wirings/cli/channel/index.js +0 -1
- package/dist/wirings/cli/cli-runner.js +17 -3
- package/dist/wirings/cli/cli.types.d.ts +0 -8
- package/dist/wirings/cli/command-parser.js +13 -0
- package/dist/wirings/credential/index.d.ts +1 -1
- package/dist/wirings/gateway/gateway-runner.js +9 -2
- package/dist/wirings/gateway/index.d.ts +1 -1
- package/dist/wirings/http/http-routes.js +2 -0
- package/dist/wirings/http/http-runner.d.ts +0 -10
- package/dist/wirings/http/http-runner.js +14 -15
- package/dist/wirings/http/http.types.d.ts +0 -10
- package/dist/wirings/http/index.d.ts +2 -3
- package/dist/wirings/http/index.js +1 -1
- package/dist/wirings/mcp/index.d.ts +1 -1
- package/dist/wirings/mcp/mcp-runner.d.ts +15 -7
- package/dist/wirings/mcp/mcp-runner.js +18 -11
- package/dist/wirings/persona/index.d.ts +3 -4
- package/dist/wirings/persona/index.js +2 -3
- package/dist/wirings/queue/index.d.ts +1 -3
- package/dist/wirings/queue/index.js +1 -3
- package/dist/wirings/rpc/addon-runner.d.ts +4 -0
- package/dist/wirings/rpc/addon-runner.js +19 -3
- package/dist/wirings/rpc/rpc-runner.d.ts +8 -51
- package/dist/wirings/rpc/rpc-runner.js +55 -86
- package/dist/wirings/rpc/rpc-types.d.ts +7 -0
- package/dist/wirings/rpc/wire-addon.d.ts +13 -0
- package/dist/wirings/rpc/wire-addon.js +4 -0
- package/dist/wirings/scheduler/index.d.ts +1 -1
- package/dist/wirings/secret/validate-secret-definitions.js +2 -2
- package/dist/wirings/trigger/index.d.ts +1 -1
- package/dist/wirings/trigger/pikku-trigger-service.d.ts +0 -4
- package/dist/wirings/trigger/trigger-runner.js +1 -0
- package/dist/wirings/virtual-user/index.d.ts +5 -6
- package/dist/wirings/virtual-user/index.js +2 -4
- package/dist/wirings/virtual-user/run-virtual-user.js +11 -11
- package/dist/wirings/virtual-user/virtual-user-derive.js +4 -25
- package/dist/wirings/virtual-user/virtual-user-dispositions.js +1 -4
- package/dist/wirings/workflow/dsl/workflow-dsl.types.d.ts +100 -3
- package/dist/wirings/workflow/feature.js +7 -4
- package/dist/wirings/workflow/graph/graph-runner.d.ts +1 -2
- package/dist/wirings/workflow/graph/graph-runner.js +8 -7
- package/dist/wirings/workflow/graph/workflow-graph.types.d.ts +0 -4
- package/dist/wirings/workflow/index.d.ts +12 -7
- package/dist/wirings/workflow/index.js +7 -3
- package/dist/wirings/workflow/pikku-scenario-service.d.ts +17 -3
- package/dist/wirings/workflow/pikku-scenario-service.js +64 -10
- package/dist/wirings/workflow/pikku-workflow-service.d.ts +28 -147
- package/dist/wirings/workflow/pikku-workflow-service.js +85 -493
- package/dist/wirings/workflow/scenario-step.types.d.ts +8 -0
- package/dist/wirings/workflow/workflow-approval-audit.d.ts +16 -0
- package/dist/wirings/workflow/workflow-approval-audit.js +40 -0
- package/dist/wirings/workflow/workflow-approval-policy.d.ts +20 -0
- package/dist/wirings/workflow/workflow-approval-policy.js +48 -0
- package/dist/wirings/workflow/workflow-approval.d.ts +67 -0
- package/dist/wirings/workflow/workflow-approval.js +177 -0
- package/dist/wirings/workflow/workflow-constants.d.ts +26 -0
- package/dist/wirings/workflow/workflow-constants.js +35 -0
- package/dist/wirings/workflow/workflow-errors.d.ts +58 -0
- package/dist/wirings/workflow/workflow-errors.js +112 -0
- package/dist/wirings/workflow/workflow-meta-resolver.d.ts +11 -0
- package/dist/wirings/workflow/workflow-meta-resolver.js +31 -0
- package/dist/wirings/workflow/workflow-queue-routing.d.ts +8 -0
- package/dist/wirings/workflow/workflow-queue-routing.js +38 -0
- package/dist/wirings/workflow/workflow-queue-wiring.d.ts +20 -0
- package/dist/wirings/workflow/workflow-queue-wiring.js +79 -0
- package/dist/wirings/workflow/workflow-recovery.d.ts +68 -0
- package/dist/wirings/workflow/workflow-recovery.js +101 -0
- package/dist/wirings/workflow/workflow-run-engine.types.d.ts +54 -0
- package/dist/wirings/workflow/workflow-run-ownership.d.ts +17 -0
- package/dist/wirings/workflow/workflow-run-ownership.js +30 -0
- package/dist/wirings/workflow/workflow-suspend.d.ts +12 -0
- package/dist/wirings/workflow/workflow-suspend.js +33 -0
- package/dist/wirings/workflow/workflow.types.d.ts +8 -1
- package/knowledge/decisions/internals/a-non-streaming-agent-run-registers-with-airunstate-too.md +22 -0
- package/knowledge/decisions/internals/a-resumed-agent-turn-is-as-interruptible-as-the-first.md +20 -0
- package/knowledge/decisions/internals/a-scenario-step-template-is-offered-unfilled.md +21 -0
- package/knowledge/decisions/internals/a-virtual-user-decides-whether-to-trust-memory-once-per-turn.md +21 -0
- package/knowledge/decisions/internals/a-wall-clock-threshold-is-a-load-test-in-disguise.md +46 -0
- package/knowledge/decisions/internals/a-workflow-wire-is-built-from-the-run-not-from-the-rpc-service.md +45 -0
- package/knowledge/decisions/internals/addon-pikku-meta-ships-at-the-package-root-or-under-dist.md +32 -0
- package/knowledge/decisions/internals/agent-context-waits-for-a-tool-result-still-being-written.md +21 -0
- package/knowledge/decisions/internals/agent-speech-travels-as-a-custom-agui-event.md +22 -0
- package/knowledge/decisions/internals/an-addon-scope-root-loses-to-a-root-the-host-already-declares.md +39 -0
- package/knowledge/decisions/internals/an-agent-interrupt-is-not-a-failure.md +23 -0
- package/knowledge/decisions/internals/an-agent-run-owned-by-another-instance-says-so.md +25 -0
- package/knowledge/decisions/internals/an-agent-stream-send-must-return-the-inner-sends-promise.md +22 -0
- package/knowledge/decisions/internals/an-empty-text-part-is-omitted-from-an-agent-message.md +20 -0
- package/knowledge/decisions/internals/an-empty-transcript-is-not-recorded.md +22 -0
- package/knowledge/decisions/internals/an-unref-d-timer-cannot-be-awaited-under-node-test.md +66 -0
- package/knowledge/decisions/internals/channel-state-accessors-are-unsound-generics-that-every-implementation-asserts.md +33 -0
- package/knowledge/decisions/internals/gateway-listener-middleware-runs-without-an-rpc-on-the-wire.md +43 -0
- package/knowledge/decisions/internals/hot-reload-writes-into-the-function-map-captured-at-startup.md +26 -0
- package/knowledge/decisions/internals/index.md +42 -3
- package/knowledge/decisions/internals/only-exposed-functions-enter-a-virtual-user-catalogue.md +21 -0
- package/knowledge/decisions/internals/scenario-given-and-when-are-sugar-but-then-is-not.md +24 -0
- package/knowledge/decisions/internals/side-effects-are-an-allowlist-not-a-boolean.md +34 -0
- package/knowledge/decisions/internals/speech-synthesis-picks-a-voice-per-sentence-and-warns-once.md +24 -0
- package/knowledge/decisions/internals/the-actor-prompt-says-json-because-of-json-object-mode.md +22 -0
- package/knowledge/decisions/internals/the-agent-done-event-goes-through-the-middleware-and-is-awaited.md +26 -0
- package/knowledge/decisions/internals/the-api-report-pins-members-not-just-names.md +43 -0
- package/knowledge/decisions/internals/the-ecosystem-entry-point-carries-the-adapter-surface.md +58 -0
- package/knowledge/decisions/internals/the-middleware-resolution-cache-is-deliberately-unbounded.md +40 -0
- package/knowledge/decisions/internals/the-per-invocation-rpc-view-is-a-class.md +40 -0
- package/knowledge/decisions/internals/the-persona-runtime-is-exported-from-the-persona-entry-point.md +28 -0
- package/knowledge/decisions/internals/the-transcript-event-is-sent-ahead-of-the-run.md +25 -0
- package/knowledge/decisions/internals/the-virtual-user-catalogue-is-the-only-gate-on-what-may-be-called.md +21 -0
- package/knowledge/decisions/internals/the-worker-disposition-is-the-one-that-is-not-testing.md +22 -0
- package/knowledge/decisions/internals/thread-history-records-the-transcript-not-the-audio.md +25 -0
- package/knowledge/decisions/internals/validate-runs-checks-by-precondition.md +115 -0
- package/knowledge/decisions/internals/virtual-user-step-order-comes-from-insertion-order.md +21 -0
- package/knowledge/decisions/internals/voice-output-speaks-unless-voice-input-explicitly-says-otherwise.md +24 -0
- package/knowledge/decisions/internals/wiring-registries-erase-the-generics-their-wire-functions-capture.md +35 -0
- package/knowledge/decisions/security/a-dropped-audit-write-is-always-logged.md +4 -2
- package/knowledge/decisions/security/a-function-never-receives-the-secret-service.md +37 -0
- package/knowledge/decisions/security/a-graph-run-starts-at-an-entry-node-the-graph-declared.md +33 -0
- package/knowledge/decisions/security/a-permission-gets-a-wire-it-cannot-reply-on.md +33 -0
- package/knowledge/decisions/security/a-step-runs-the-function-the-workflow-dispatched-it-with.md +37 -0
- package/knowledge/decisions/security/a-virtual-user-is-never-offered-a-step-that-would-forge-its-own-oracle.md +28 -0
- package/knowledge/decisions/security/a-workflow-run-is-read-and-approved-by-its-owner.md +50 -0
- package/knowledge/decisions/security/an-agent-approval-is-claimed-before-the-tool-runs.md +33 -0
- package/knowledge/decisions/security/an-approval-answer-outlives-the-run-it-answered.md +59 -0
- package/knowledge/decisions/security/an-upload-is-counted-as-it-arrives-not-buffered-then-measured.md +24 -0
- package/knowledge/decisions/security/index.md +9 -0
- package/knowledge/questions/channel-middleware-accepts-bare-factories-that-nothing-resolves.md +35 -0
- package/knowledge/questions/index.md +2 -1
- package/knowledge/questions/unauthorized-channel-replies-escape-the-declared-out-type.md +44 -0
- package/package.json +15 -3
- package/scripts/generate-api-report.d.mts +1 -0
- package/scripts/generate-api-report.mjs +89 -0
- package/scripts/generate-api-report.mts +343 -0
- package/src/api-report.test.ts +69 -0
- package/src/column-form.ts +1 -4
- package/src/crypto-utils.test.ts +15 -2
- package/src/dev/hot-reload.ts +2 -7
- package/src/ecosystem.ts +40 -0
- package/src/errors/error-handler.ts +5 -3
- package/src/errors/error.test.ts +4 -1
- package/src/errors/index.ts +1 -1
- package/src/function/function-runner.test.ts +53 -1
- package/src/function/function-runner.ts +33 -48
- package/src/function/functions.types.ts +15 -9
- package/src/function/index.ts +0 -2
- package/src/handle-error.ts +1 -1
- package/src/index.ts +3 -57
- package/src/middleware/auth-cookie.test.ts +50 -0
- package/src/middleware/auth-cookie.ts +38 -2
- package/src/middleware/cors.ts +2 -1
- package/src/middleware/index.ts +1 -1
- package/src/middleware/remote-auth.test.ts +43 -0
- package/src/middleware/remote-auth.ts +17 -3
- package/src/middleware-runner.ts +4 -2
- package/src/no-any-casts.test.ts +57 -0
- package/src/permissions.test.ts +3 -1
- package/src/permissions.ts +22 -24
- package/src/pikku-state.ts +22 -6
- package/src/public-surface.json +554 -0
- package/src/public-surface.json.README +25 -0
- package/src/public-surface.test.ts +105 -0
- package/src/removed-legacy-exports.test.ts +62 -0
- package/src/schema.test.ts +78 -0
- package/src/schema.ts +36 -1
- package/src/services/ai-agent-runner-service.ts +12 -1
- package/src/services/ai-run-state-service.ts +18 -1
- package/src/services/audit-service.ts +2 -2
- package/src/services/in-memory-ai-run-state-service.ts +16 -2
- package/src/services/in-memory-workflow-service.ts +2 -0
- package/src/services/index.ts +4 -47
- package/src/services/local-content-request-handler.test.ts +43 -5
- package/src/services/local-content-request-handler.ts +103 -74
- package/src/services/local-content.ts +15 -1
- package/src/services/local-email-service.ts +5 -1
- package/src/services/scoped-credential-service.test.ts +86 -0
- package/src/services/scoped-credential-service.ts +63 -0
- package/src/services/system-role-guard.test.ts +4 -1
- package/src/services/workflow-service.ts +9 -2
- package/src/side-effects-are-declared.test.ts +84 -0
- package/src/source-files-stay-composable.test.ts +41 -0
- package/src/testing/service-tests/agent-run-service-tests.ts +98 -0
- package/src/testing/service-tests/ai-storage-service-tests.ts +379 -0
- package/src/testing/service-tests/channel-store-tests.ts +98 -0
- package/src/testing/service-tests/credential-service-tests.ts +143 -0
- package/src/testing/service-tests/deployment-service-tests.ts +33 -0
- package/src/testing/service-tests/event-hub-store-tests.ts +48 -0
- package/src/testing/service-tests/secret-service-tests.ts +105 -0
- package/src/testing/service-tests/session-store-tests.ts +62 -0
- package/src/testing/service-tests/workflow-run-service-tests.ts +59 -0
- package/src/testing/service-tests/workflow-service-tests.ts +308 -0
- package/src/testing/service-tests.ts +31 -1111
- package/src/types/core.types.ts +14 -3
- package/src/types/state.types.ts +17 -1
- package/src/wirings/actor-flow/index.ts +0 -3
- package/src/wirings/actor-flow/run-conversation.ts +1 -6
- package/src/wirings/ai-agent/agent-rpc.ts +120 -0
- package/src/wirings/ai-agent/ai-agent-agui.ts +1 -5
- package/src/wirings/ai-agent/ai-agent-finalize.test.ts +186 -0
- package/src/wirings/ai-agent/ai-agent-finalize.ts +197 -0
- package/src/wirings/ai-agent/ai-agent-interrupt.test.ts +2 -1
- package/src/wirings/ai-agent/ai-agent-interrupt.ts +1 -0
- package/src/wirings/ai-agent/ai-agent-memory.ts +62 -39
- package/src/wirings/ai-agent/ai-agent-model-config.test.ts +72 -3
- package/src/wirings/ai-agent/ai-agent-model-config.ts +49 -1
- package/src/wirings/ai-agent/ai-agent-prepare.ts +12 -12
- package/src/wirings/ai-agent/ai-agent-resume-authorization.test.ts +1 -0
- package/src/wirings/ai-agent/ai-agent-runner.test.ts +82 -2
- package/src/wirings/ai-agent/ai-agent-runner.ts +120 -160
- package/src/wirings/ai-agent/ai-agent-stream-output-hooks.test.ts +353 -0
- package/src/wirings/ai-agent/ai-agent-stream.test.ts +2 -0
- package/src/wirings/ai-agent/ai-agent-stream.ts +152 -117
- package/src/wirings/ai-agent/ai-agent-thread-ownership.test.ts +1 -1
- package/src/wirings/ai-agent/ai-agent-turn.test.ts +67 -0
- package/src/wirings/ai-agent/ai-agent-turn.ts +122 -0
- package/src/wirings/ai-agent/ai-agent.types.ts +65 -5
- package/src/wirings/ai-agent/index.ts +2 -16
- package/src/wirings/ai-agent/voice-input.ts +1 -6
- package/src/wirings/ai-agent/voice-output.ts +2 -12
- package/src/wirings/ai-scorer/ai-scorer-grade.test.ts +106 -0
- package/src/wirings/ai-scorer/ai-scorer-grade.ts +55 -0
- package/src/wirings/ai-scorer/ai-scorer-judge.test.ts +143 -0
- package/src/wirings/ai-scorer/ai-scorer-judge.ts +120 -0
- package/src/wirings/ai-scorer/ai-scorer-live.test.ts +174 -0
- package/src/wirings/ai-scorer/ai-scorer-live.ts +56 -0
- package/src/wirings/ai-scorer/ai-scorer-registry.ts +63 -0
- package/src/wirings/ai-scorer/ai-scorer-sampling.test.ts +34 -0
- package/src/wirings/ai-scorer/ai-scorer-sampling.ts +36 -0
- package/src/wirings/ai-scorer/ai-scorer-snapshots.test.ts +49 -0
- package/src/wirings/ai-scorer/ai-scorer-snapshots.ts +46 -0
- package/src/wirings/ai-scorer/ai-scorer-worker.test.ts +122 -0
- package/src/wirings/ai-scorer/ai-scorer-worker.ts +69 -0
- package/src/wirings/ai-scorer/ai-scorer.ts +76 -0
- package/src/wirings/ai-scorer/ai-scorer.types.ts +107 -0
- package/src/wirings/ai-scorer/index.ts +24 -0
- package/src/wirings/channel/channel-common.ts +5 -2
- package/src/wirings/channel/channel-handler-shapes.test.ts +72 -0
- package/src/wirings/channel/channel-handler.ts +7 -7
- package/src/wirings/channel/channel-rpc-service.ts +0 -14
- package/src/wirings/channel/channel-rpc.test.ts +25 -4
- package/src/wirings/channel/channel-rpc.types.ts +14 -0
- package/src/wirings/channel/channel-runner.ts +33 -20
- package/src/wirings/channel/channel.types.ts +2 -0
- package/src/wirings/channel/index.ts +1 -20
- package/src/wirings/channel/local/local-channel-runner.test.ts +68 -0
- package/src/wirings/channel/local/local-channel-runner.ts +9 -2
- package/src/wirings/channel/pikku-abstract-channel-handler.ts +2 -1
- package/src/wirings/channel/serverless/serverless-channel-runner.ts +6 -3
- package/src/wirings/cli/channel/cli-channel-runner.ts +3 -1
- package/src/wirings/cli/channel/cli-raw-channel-runner.test.ts +23 -0
- package/src/wirings/cli/channel/cli-raw-channel-runner.ts +12 -1
- package/src/wirings/cli/channel/cli-raw-client-runner.ts +4 -1
- package/src/wirings/cli/channel/index.ts +0 -7
- package/src/wirings/cli/cli-runner.test.ts +68 -0
- package/src/wirings/cli/cli-runner.ts +25 -5
- package/src/wirings/cli/cli.types.ts +0 -39
- package/src/wirings/cli/command-parser.test.ts +19 -0
- package/src/wirings/cli/command-parser.ts +17 -1
- package/src/wirings/credential/index.ts +0 -1
- package/src/wirings/gateway/gateway-channel-meta.test.ts +44 -0
- package/src/wirings/gateway/gateway-runner.ts +27 -19
- package/src/wirings/gateway/index.ts +0 -3
- package/src/wirings/http/http-routes.ts +4 -1
- package/src/wirings/http/http-runner.test.ts +66 -0
- package/src/wirings/http/http-runner.ts +21 -28
- package/src/wirings/http/http.types.ts +0 -15
- package/src/wirings/http/index.ts +2 -8
- package/src/wirings/http/pikku-fetch-http-request.ts +2 -2
- package/src/wirings/http/web-request.ts +1 -1
- package/src/wirings/mcp/index.ts +0 -1
- package/src/wirings/mcp/mcp-runner.test.ts +181 -0
- package/src/wirings/mcp/mcp-runner.ts +37 -21
- package/src/wirings/persona/index.ts +0 -8
- package/src/wirings/persona/persona-environments.test.ts +14 -3
- package/src/wirings/persona/persona.test.ts +13 -3
- package/src/wirings/persona/validate-personas.ts +5 -1
- package/src/wirings/queue/index.ts +0 -14
- package/src/wirings/queue/queue-runner.ts +1 -1
- package/src/wirings/rpc/addon-auth-tags.test.ts +1 -5
- package/src/wirings/rpc/addon-runner.ts +34 -3
- package/src/wirings/rpc/addon-secrets.test.ts +261 -0
- package/src/wirings/rpc/rpc-runner.test.ts +2 -0
- package/src/wirings/rpc/rpc-runner.ts +60 -136
- package/src/wirings/rpc/rpc-types.ts +11 -0
- package/src/wirings/rpc/wire-addon.ts +20 -1
- package/src/wirings/scheduler/index.ts +0 -1
- package/src/wirings/secret/validate-secret-definitions.test.ts +22 -0
- package/src/wirings/secret/validate-secret-definitions.ts +2 -2
- package/src/wirings/trigger/index.ts +0 -1
- package/src/wirings/trigger/pikku-trigger-service.ts +0 -5
- package/src/wirings/trigger/trigger-runner.ts +7 -5
- package/src/wirings/virtual-user/index.ts +0 -16
- package/src/wirings/virtual-user/run-virtual-user.test.ts +18 -9
- package/src/wirings/virtual-user/run-virtual-user.ts +28 -15
- package/src/wirings/virtual-user/virtual-user-agents.test.ts +4 -1
- package/src/wirings/virtual-user/virtual-user-derive.ts +4 -25
- package/src/wirings/virtual-user/virtual-user-dispositions.test.ts +7 -2
- package/src/wirings/virtual-user/virtual-user-dispositions.ts +1 -4
- package/src/wirings/virtual-user/virtual-user-intents.test.ts +13 -3
- package/src/wirings/workflow/dsl/workflow-dsl.types.ts +117 -4
- package/src/wirings/workflow/feature.ts +7 -4
- package/src/wirings/workflow/graph/graph-node.ts +1 -1
- package/src/wirings/workflow/graph/graph-runner.test.ts +76 -2
- package/src/wirings/workflow/graph/graph-runner.ts +13 -16
- package/src/wirings/workflow/graph/workflow-graph.types.ts +0 -5
- package/src/wirings/workflow/index.ts +14 -24
- package/src/wirings/workflow/pikku-scenario-service.ts +101 -27
- package/src/wirings/workflow/pikku-workflow-service.test.ts +15 -14
- package/src/wirings/workflow/pikku-workflow-service.ts +214 -743
- package/src/wirings/workflow/scenario-expectations.test.ts +75 -0
- package/src/wirings/workflow/scenario-hooks.test.ts +52 -0
- package/src/wirings/workflow/scenario-step.types.ts +8 -0
- package/src/wirings/workflow/workflow-approval-audit.ts +47 -0
- package/src/wirings/workflow/workflow-approval-policy.test.ts +524 -0
- package/src/wirings/workflow/workflow-approval-policy.ts +68 -0
- package/src/wirings/workflow/workflow-approval.ts +289 -0
- package/src/wirings/workflow/workflow-child-run-session.test.ts +89 -0
- package/src/wirings/workflow/workflow-constants.ts +47 -0
- package/src/wirings/workflow/workflow-dispatch-durability.test.ts +1 -1
- package/src/wirings/workflow/workflow-errors.ts +128 -0
- package/src/wirings/workflow/workflow-inline-authority.test.ts +12 -6
- package/src/wirings/workflow/workflow-meta-resolver.ts +45 -0
- package/src/wirings/workflow/workflow-missing-meta.test.ts +92 -0
- package/src/wirings/workflow/workflow-queue-routing.ts +85 -0
- package/src/wirings/workflow/workflow-queue-wiring.ts +149 -0
- package/src/wirings/workflow/workflow-recovery.ts +162 -0
- package/src/wirings/workflow/workflow-retry-policy.test.ts +1 -1
- package/src/wirings/workflow/workflow-run-authority.test.ts +212 -0
- package/src/wirings/workflow/workflow-run-engine.types.ts +91 -0
- package/src/wirings/workflow/workflow-run-ownership.ts +37 -0
- package/src/wirings/workflow/workflow-suspend.ts +61 -0
- package/src/wirings/workflow/workflow.types.ts +7 -9
- package/src/wirings-stay-decoupled.test.ts +127 -0
- package/tsconfig.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/internal.d.ts +0 -3
- package/dist/internal.js +0 -2
- package/dist/middleware/timeout.d.ts +0 -9
- package/dist/middleware/timeout.js +0 -15
- package/dist/pikku-response.d.ts +0 -6
- package/dist/pikku-response.js +0 -6
- package/dist/services/gopass-secrets.d.ts +0 -15
- package/dist/services/gopass-secrets.js +0 -76
- package/dist/services/http-scenario-actors.d.ts +0 -75
- package/dist/services/http-scenario-actors.js +0 -195
- package/dist/services/http-user-flow-actors.d.ts +0 -67
- package/dist/services/http-user-flow-actors.js +0 -193
- package/dist/services/scenario-actors-service.d.ts +0 -127
- package/dist/services/scenario-actors-service.js +0 -40
- package/dist/services/user-flow-actors-service.d.ts +0 -39
- package/dist/wirings/credential/wire-credential.d.ts +0 -48
- package/dist/wirings/credential/wire-credential.js +0 -47
- package/dist/wirings/oauth2/oauth2-client.d.ts +0 -47
- package/dist/wirings/oauth2/oauth2-client.js +0 -263
- package/dist/wirings/oauth2/oauth2-routes.d.ts +0 -35
- package/dist/wirings/oauth2/oauth2-routes.js +0 -146
- package/dist/wirings/scope/wire-scope.d.ts +0 -33
- package/dist/wirings/scope/wire-scope.js +0 -32
- package/dist/wirings/workflow/dsl/index.d.ts +0 -5
- package/dist/wirings/workflow/dsl/index.js +0 -4
- package/dist/wirings/workflow/graph/index.d.ts +0 -5
- package/dist/wirings/workflow/graph/index.js +0 -4
- package/src/internal.ts +0 -10
- /package/dist/{services/user-flow-actors-service.js → wirings/workflow/workflow-run-engine.types.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,476 @@
|
|
|
1
|
+
## 0.12.82
|
|
2
|
+
|
|
3
|
+
### Patch Changes
|
|
4
|
+
|
|
5
|
+
- 063f43a: api-report.md reports public signatures, one member per line
|
|
6
|
+
|
|
7
|
+
The report was built from `declaration.getText()`, so a class arrived as its own
|
|
8
|
+
source — private fields and method bodies included — flattened onto a single
|
|
9
|
+
line. `PikkuWorkflowService` was 40,603 characters of one line.
|
|
10
|
+
|
|
11
|
+
That made the file unmergeable. One line is one conflict hunk, so two branches
|
|
12
|
+
touching different methods of the same class conflicted on a line neither had
|
|
13
|
+
meaningfully changed, and the repo paid for it every rebase.
|
|
14
|
+
|
|
15
|
+
Now each member is its own line and stops at its signature, with private members
|
|
16
|
+
dropped and inferred return types filled in from the checker. The file is a
|
|
17
|
+
quarter smaller, and every declaration in it parses as TypeScript — 42 of its 50
|
|
18
|
+
code fences previously did not, because collapsing a multi-line object type threw
|
|
19
|
+
away the newline that was serving as the member separator.
|
|
20
|
+
|
|
21
|
+
Also adds the report to `.prettierignore`: prettier pads the summary tables to
|
|
22
|
+
their widest cell, so one changed count rewrote all fifty rows, and it reflowed a
|
|
23
|
+
file that `api-report.test.ts` compares byte-for-byte.
|
|
24
|
+
|
|
25
|
+
- ce66bf8: A channel message handler that returns nothing no longer tries to send it.
|
|
26
|
+
|
|
27
|
+
`local-channel-runner` sent the message handler's result unconditionally, so a
|
|
28
|
+
handler with nothing to say produced `send requires a non-empty message` on every
|
|
29
|
+
inbound message. The connect path directly above it has always guarded this; the
|
|
30
|
+
message path did not.
|
|
31
|
+
|
|
32
|
+
Gateway websockets hit it every time — `wireGateway` generates a message handler
|
|
33
|
+
that returns `undefined` by design — which showed up as a chat gateway accepting
|
|
34
|
+
a connection and then erroring on each message rather than delivering it.
|
|
35
|
+
|
|
36
|
+
Found while testing a webchat gateway in a template. Note that fixing this is
|
|
37
|
+
necessary but not sufficient for that case: codegen does not emit the channel a
|
|
38
|
+
websocket gateway registers, so route resolution finds no handler and falls back
|
|
39
|
+
to the empty inline `onMessage` the gateway wires as a placeholder. That gap is
|
|
40
|
+
still open.
|
|
41
|
+
|
|
42
|
+
- d0307a8: Stop the runner overwriting a status the route set
|
|
43
|
+
|
|
44
|
+
A function that calls `response.redirect()` has nothing left to return, so it
|
|
45
|
+
returns `undefined` — and the HTTP runner read that as "no content" and
|
|
46
|
+
overwrote the 3xx with a 204. The `Location` header survived, but a browser
|
|
47
|
+
does not follow `Location` on a 204, so the redirect silently became a dead
|
|
48
|
+
end: the user sits on the page that sent them, waiting for a hop that never
|
|
49
|
+
comes. This is the whole OAuth/app-install callback shape, where the redirect
|
|
50
|
+
back to the app is the last step of the flow.
|
|
51
|
+
|
|
52
|
+
The same clobber applied to a body: a route that set `201` and returned a
|
|
53
|
+
value was answered `200`.
|
|
54
|
+
|
|
55
|
+
The runner's 204 and 200 are now defaults rather than overrides — they apply
|
|
56
|
+
only when the route left the status alone.
|
|
57
|
+
|
|
58
|
+
- ce66bf8: MCP calls now carry the caller's HTTP request, so an MCP tool can require a session.
|
|
59
|
+
|
|
60
|
+
Every auth middleware opens with `if (!http?.request) return`. The MCP runner
|
|
61
|
+
never put an `http` on the wire, so all of them bailed on their first line and
|
|
62
|
+
an MCP call reached the function with no session — no cookie, no bearer token,
|
|
63
|
+
no API key, whatever the app had registered. A tool fronting a session-requiring
|
|
64
|
+
`pikkuFunc` could therefore only ever answer `Authentication required`, and a
|
|
65
|
+
tool fronting a sessionless one was callable by anyone who could reach the mount.
|
|
66
|
+
|
|
67
|
+
Almost nothing was missing. Global middleware already ran for MCP wirings, and
|
|
68
|
+
the runner already built a `PikkuSessionService` and the middleware session wire
|
|
69
|
+
props. Only the request was being dropped — twice: `RunMCPEndpointParams` had
|
|
70
|
+
nowhere to put one, and `createFetchHandler` received the caller's `Request` and
|
|
71
|
+
discarded it.
|
|
72
|
+
|
|
73
|
+
`RunMCPEndpointParams` gains an optional `http`, which the runner places on the
|
|
74
|
+
wire, and the fetch handler wraps the incoming `Request` in a
|
|
75
|
+
`PikkuFetchHTTPRequest` and threads it through tools, resources and prompts. The
|
|
76
|
+
request is cloned before wrapping, because the MCP transport reads the body and
|
|
77
|
+
both would otherwise compete for one single-use stream; only headers and cookies
|
|
78
|
+
are wanted, since a tool's input arrives in the JSON-RPC params.
|
|
79
|
+
|
|
80
|
+
Transports with no request to offer — stdio, and the long-lived stdio/SSE server
|
|
81
|
+
paths — pass nothing and stay anonymous. That is a property of those transports
|
|
82
|
+
rather than a default chosen here, and it is now visible in the type.
|
|
83
|
+
|
|
84
|
+
The generated auth middleware moves from `addHTTPMiddleware('*')` to
|
|
85
|
+
`addGlobalMiddleware`. Carrying the request is necessary but not sufficient:
|
|
86
|
+
session middleware registered as HTTP middleware runs for HTTP wirings only, so
|
|
87
|
+
an MCP call still met no middleware and still had no session. Both entries —
|
|
88
|
+
the Better Auth session and the console bearer token — resolve a session from
|
|
89
|
+
whatever request the call arrived on, which is not an HTTP routing concern.
|
|
90
|
+
Wirings with no request are unaffected, since each middleware returns
|
|
91
|
+
immediately without one.
|
|
92
|
+
|
|
93
|
+
That move also retires a hazard the old shape carried: the two entries had to
|
|
94
|
+
share a single `addHTTPMiddleware('*')` call because the inspector keys
|
|
95
|
+
route-middleware groups by pattern, so a second `'*'` registration from another
|
|
96
|
+
file would silently displace the first. Global middleware is an append-only
|
|
97
|
+
list.
|
|
98
|
+
|
|
99
|
+
**Regenerate the auth scaffold after upgrading** — an app still carrying the
|
|
100
|
+
`addHTTPMiddleware('*')` form keeps anonymous MCP calls.
|
|
101
|
+
|
|
102
|
+
Two consequences worth planning for:
|
|
103
|
+
- **A tool fronting a session-requiring function starts working.** It previously
|
|
104
|
+
could not run at all.
|
|
105
|
+
- **A tool fronting a sessionless function is unchanged and still anonymous.**
|
|
106
|
+
Scopes and permissions now apply to MCP calls exactly as they do elsewhere, so
|
|
107
|
+
audit any tool that mutates state and give it the scope its HTTP sibling has.
|
|
108
|
+
|
|
109
|
+
`PikkuHTTP` is now exported from `@pikku/core/http`; it is part of this contract
|
|
110
|
+
and was previously only reachable as a type on other exported shapes.
|
|
111
|
+
|
|
112
|
+
- 3ad2131: Name models by what they are for, and switch them all in one place
|
|
113
|
+
|
|
114
|
+
A `models` table in pikku.config.json maps an alias to a provider-qualified
|
|
115
|
+
model, so a declaration can say `model: 'cheap'` and the project repoints every
|
|
116
|
+
use of that tier at once instead of editing each agent. A model containing `/`
|
|
117
|
+
is still concrete and used exactly as written, which is how an agent that needs
|
|
118
|
+
one specific model pins it — aliases are opt-in.
|
|
119
|
+
|
|
120
|
+
The table is baked into codegen rather than read at runtime, so it applies to
|
|
121
|
+
deployed units and not just local runs, and `pikku dev`/`pikku serve` take
|
|
122
|
+
`--model cheap:openai/gpt-5-nano` to repoint a tier for one run without editing
|
|
123
|
+
the config.
|
|
124
|
+
|
|
125
|
+
Because the inspector already holds every agent's model literal, a bare name
|
|
126
|
+
with no matching alias now fails the build (PKU146) naming the aliases that do
|
|
127
|
+
exist, rather than reaching a provider as an unknown model.
|
|
128
|
+
|
|
129
|
+
Aliases resolve for every modality, not just agents: image, speech,
|
|
130
|
+
transcription, embedding and reranking all reach a provider through the same
|
|
131
|
+
point in the Vercel runner.
|
|
132
|
+
|
|
133
|
+
- b930dca: Remove the `secretBroker` escape hatch and scope addon secrets and credentials
|
|
134
|
+
|
|
135
|
+
`secretBroker` let three named console functions receive the real `SecretService`,
|
|
136
|
+
against the rule that a function never sees one. It is gone: the inspector allowlist,
|
|
137
|
+
the `FunctionRuntimeMeta` flag, the runner branches, and the `WiredSecretBrokerServices`
|
|
138
|
+
type. Console secret administration moved into the console addon, where a
|
|
139
|
+
`SecretAdminService` holds the `SecretService` and the functions hold none.
|
|
140
|
+
|
|
141
|
+
Addons are now scoped rather than trusted. The CLI emits each package's declared secret
|
|
142
|
+
keys, and the host wraps the `SecretService` in a `ScopedSecretService` and the
|
|
143
|
+
`CredentialService` in a new `ScopedCredentialService` before the addon's service factory
|
|
144
|
+
runs — so an addon reads only what it declared, cannot write secrets, and cannot enumerate
|
|
145
|
+
the app's users. `wireAddon({ globalSecrets, globalCredentials })` waives this, taking the
|
|
146
|
+
reason as its value; only the consuming app can grant it, and the deploy manifest reports
|
|
147
|
+
every grant under `unscopedSecretAddons` / `unscopedCredentialAddons`.
|
|
148
|
+
|
|
149
|
+
- b95e77d: fix(core): persist working memory on streamed agent runs
|
|
150
|
+
|
|
151
|
+
Working memory was never persisted when an agent streamed. The working memory
|
|
152
|
+
middleware strips the `<working_memory>` block from the outgoing deltas, and the
|
|
153
|
+
channel that accumulates the reply sits downstream of that strip — so the text
|
|
154
|
+
later handed to `modifyOutput`, the only place that calls `saveWorkingMemory`,
|
|
155
|
+
had already had the block removed. It now persists from the stream hook, at the
|
|
156
|
+
step's `usage` (or `done`) event, where the raw text is still reachable.
|
|
157
|
+
|
|
158
|
+
With that dependency gone, `modifyOutput` no longer runs at all on a streamed
|
|
159
|
+
run: nothing on that path could act on what it returned, since the text has
|
|
160
|
+
already reached the client and each step is flushed to storage as it goes. A
|
|
161
|
+
middleware that rewrites in `modifyOutput` without a `modifyOutputStream` — a
|
|
162
|
+
redaction hook, typically — was silently ineffective while streaming, and is now
|
|
163
|
+
warned about once per agent.
|
|
164
|
+
|
|
165
|
+
- fd9d834: Stop publishing internals that only their own package or file used. The declarations stay; only the entrypoint re-export is removed, so nothing that imported a name from where it is declared is affected.
|
|
166
|
+
- 8978fbd: feat(workflow): let an approval gate declare who may answer it
|
|
167
|
+
|
|
168
|
+
`workflow.approval()` gains `approvers` (`'any' | 'owner' | 'not-initiator'`)
|
|
169
|
+
and `approverScope`, so a gate can require four-eyes sign-off, restrict itself
|
|
170
|
+
to the run's initiator, or require the decider to hold a named scope.
|
|
171
|
+
|
|
172
|
+
Both are enforced when the workflow replays the gate — the same place, and for
|
|
173
|
+
the same reason, the decision payload is validated: the policy is a value on
|
|
174
|
+
the workflow, and a decision can be recorded before the run has ever reached
|
|
175
|
+
the gate. A decision that fails the policy is discarded and the gate stays
|
|
176
|
+
closed. Where the run has already published its policy, the check also runs at
|
|
177
|
+
submission time so the caller gets a 403 rather than silence.
|
|
178
|
+
|
|
179
|
+
An answer is now recorded where it can be answered for later. The settled
|
|
180
|
+
decision carries `decidedBy` and `decidedAt` in its `ApprovalOutcome`, so who
|
|
181
|
+
signed reaches `workflowStep.result` and `workflowStepHistory` rather than
|
|
182
|
+
living only in mutable run state. Every answer — accepted, refused at the door,
|
|
183
|
+
or cleared on replay — is also written to the audit sink as
|
|
184
|
+
`workflow.approval.decided`, which outlives the run: `deleteRun` cascades to
|
|
185
|
+
steps and history, and a refused attempt never reaches a step at all. Projects
|
|
186
|
+
with no audit service wired are unaffected.
|
|
187
|
+
|
|
188
|
+
**This loosens the default.** `approveStep` previously refused anyone but the
|
|
189
|
+
run's initiator, unconditionally. A gate that declares no `approvers` now
|
|
190
|
+
accepts a decision from anyone the approve entrypoint admits — restore the old
|
|
191
|
+
behaviour per-gate with `approvers: 'owner'`, or gate the approve route with
|
|
192
|
+
`auth`/`permissions`. Ownership still governs _reads_ of a run unchanged.
|
|
193
|
+
|
|
194
|
+
## 0.12.81
|
|
195
|
+
|
|
196
|
+
### Patch Changes
|
|
197
|
+
|
|
198
|
+
- e110c55: Give a finished agent run one finalization seam, and make a failed tool call
|
|
199
|
+
distinguishable from a tool that returned text saying "Error:".
|
|
200
|
+
- Tool results carry `error` as its own field, from the runner through the
|
|
201
|
+
stream event and the run's step record into persisted messages.
|
|
202
|
+
- `modifyOutput` receives the run's tool calls and may return a rewritten list,
|
|
203
|
+
which is redistributed back onto the steps it came from.
|
|
204
|
+
- Streamed runs accumulate their tool calls across steps, and every completion
|
|
205
|
+
path — streamed, non-streamed, and resumed after a tool approval — now
|
|
206
|
+
finalizes through `finalizeAgentRun`. A tool that fails after being approved
|
|
207
|
+
leaves a record on the run instead of vanishing.
|
|
208
|
+
|
|
209
|
+
- e110c55: Add `scenario.expectScore` — grade a finished agent run with a declared scorer and assert on it.
|
|
210
|
+
|
|
211
|
+
An agent's answer cannot be matched against a fixed string, so a scenario grades
|
|
212
|
+
it instead. `expectScore(step, runId, scorer, { atLeast, atMost, reference })`
|
|
213
|
+
runs one declared scorer against the run the scenario just triggered and fails
|
|
214
|
+
with the reason the judge gave. The default bound is `atLeast: 0.5`, so an
|
|
215
|
+
unqualified assertion still fails a run graded zero.
|
|
216
|
+
|
|
217
|
+
Grading goes over the new `pikkuScenarioGradeRun` instrumentation RPC, which the
|
|
218
|
+
dev server registers alongside the coverage and stub RPCs — so it exists only in
|
|
219
|
+
processes that should have it, and never in a deployed bundle. It grades from
|
|
220
|
+
the snapshot the runtime already took when the run finished, which is what makes
|
|
221
|
+
a scenario's grade the same measurement production's sampler makes rather than
|
|
222
|
+
an approximation of it: a run's prompt, answer and tool calls are spread across
|
|
223
|
+
a thread's messages, where the boundary of one run is not recoverable.
|
|
224
|
+
|
|
225
|
+
Two things differ deliberately from live scoring. The sample rate is ignored — a
|
|
226
|
+
scorer grading 1% of traffic still grades every scenario run — and the grade is
|
|
227
|
+
returned rather than recorded, so a test's score never lands among the
|
|
228
|
+
production figures. `reference` supplies the answer key a `requiresReference`
|
|
229
|
+
judge grades against, which is the only way such a judge is reachable at all.
|
|
230
|
+
|
|
231
|
+
- e110c55: Add runtime scoring for AI agents: `pikkuAIScorer` for heuristic grades and
|
|
232
|
+
`pikkuAIJudge` for LLM-judged ones, graded off the request path on two queue
|
|
233
|
+
lanes so a slow judge cannot starve the cheap checks. Grades are sampled
|
|
234
|
+
deterministically per `(run, scorer)` and persisted to `ai_run_score`.
|
|
235
|
+
- acc8077: Enforce a CLI command's declared `auth`/`permissions`, and mask CLI channel
|
|
236
|
+
errors in production.
|
|
237
|
+
|
|
238
|
+
A command's declared `auth`/`permissions` were accepted by the types but dropped
|
|
239
|
+
in `registerCLICommands`: when the command wrapped a function-config object,
|
|
240
|
+
`unwrapFunc` kept only the inner func's fields, so a command-level access-control
|
|
241
|
+
declaration was a silent no-op. They are now merged into the config passed to
|
|
242
|
+
`addFunction` — command-level winning, falling back to the handler's — so the
|
|
243
|
+
function runner enforces them.
|
|
244
|
+
|
|
245
|
+
The CLI raw channel runner returned the raw exception message to the remote
|
|
246
|
+
client. It can carry internals (a stack, a DB error, a path), so it is now logged
|
|
247
|
+
server-side and replaced with a generic `Command failed` in production; dev keeps
|
|
248
|
+
the message inline.
|
|
249
|
+
|
|
250
|
+
CWE-862 / CWE-209.
|
|
251
|
+
|
|
252
|
+
- 905f737: Restrict a graph workflow's `startNode` to its declared entry nodes.
|
|
253
|
+
|
|
254
|
+
The scaffolded public route `POST /workflow/:name/graph/:nodeId` passes `:nodeId`
|
|
255
|
+
straight through as `startNode`, and `validateGraphReferences` only checked that
|
|
256
|
+
the node exists. A caller could name any dependency-free node — one whose input
|
|
257
|
+
reads only `trigger` — and fire its RPC directly with chosen data, skipping every
|
|
258
|
+
upstream eligibility, validation or approval node. These node RPCs are internal,
|
|
259
|
+
so the public `/rpc` endpoint refuses them; this route was the only outside path
|
|
260
|
+
to them.
|
|
261
|
+
|
|
262
|
+
`startWorkflow` — the boundary the public route and triggers enter through — now
|
|
263
|
+
rejects a `startNode` that is not in the graph's `entryNodeIds`. Internal
|
|
264
|
+
resume/replay drives `runWorkflowGraph` directly and keeps full node targeting,
|
|
265
|
+
so the check sits at the trust boundary rather than in the low-level runner.
|
|
266
|
+
|
|
267
|
+
CWE-20 / CWE-863.
|
|
268
|
+
|
|
269
|
+
- 3cc6428: Run a templated MCP resource's middleware for concrete request URIs.
|
|
270
|
+
|
|
271
|
+
`runMCPResource` resolves a templated resource's `pikkuFuncId` via the template
|
|
272
|
+
key, but `runMCPPikkuFunc` then re-looked-up the resource meta by the concrete
|
|
273
|
+
request URI (`resource://users/123`), which no meta is stored under — so meta was
|
|
274
|
+
`undefined` and the resource's merged middleware, including any tag-derived auth
|
|
275
|
+
gate, was silently dropped. A templated MCP resource was reachable with its gate
|
|
276
|
+
skipped.
|
|
277
|
+
|
|
278
|
+
The meta key — the template for a templated match, the URI otherwise — is now
|
|
279
|
+
carried through to the meta lookup, so the declared middleware runs.
|
|
280
|
+
|
|
281
|
+
CWE-863 / CWE-306.
|
|
282
|
+
|
|
283
|
+
- c524adf: fix(cli,core): make scenario captures reachable, filed per scenario, and findable
|
|
284
|
+
|
|
285
|
+
`--screenshots` and `--video` were read by `scenario run` but never declared as
|
|
286
|
+
options, so both flags were rejected as unknown and silently ignored — capture
|
|
287
|
+
could not be switched on from the command line at all.
|
|
288
|
+
|
|
289
|
+
A provider's `beginScenario` was never called, so every capture in a run was
|
|
290
|
+
filed under one shared label instead of the scenario that produced it. It is now
|
|
291
|
+
part of `ScenarioBrowserProvider` and called after the per-scenario reset, once
|
|
292
|
+
the previous scenario's context is closed and its video finalised.
|
|
293
|
+
|
|
294
|
+
The run also never said where it wrote anything. It now reports `Captures → …`
|
|
295
|
+
after the browser closes, which is the point at which a video exists.
|
|
296
|
+
|
|
297
|
+
- e110c55: fix(core): persist working memory on streamed agent runs
|
|
298
|
+
|
|
299
|
+
Working memory was never persisted when an agent streamed. The working memory
|
|
300
|
+
middleware strips the `<working_memory>` block from the outgoing deltas, and the
|
|
301
|
+
channel that accumulates the reply sits downstream of that strip — so the text
|
|
302
|
+
later handed to `modifyOutput`, the only place that calls `saveWorkingMemory`,
|
|
303
|
+
had already had the block removed. It now persists from the stream hook, at the
|
|
304
|
+
step's `usage` (or `done`) event, where the raw text is still reachable.
|
|
305
|
+
|
|
306
|
+
With that dependency gone, `modifyOutput` no longer runs at all on a streamed
|
|
307
|
+
run: nothing on that path could act on what it returned, since the text has
|
|
308
|
+
already reached the client and each step is flushed to storage as it goes. A
|
|
309
|
+
middleware that rewrites in `modifyOutput` without a `modifyOutputStream` — a
|
|
310
|
+
redaction hook, typically — was silently ineffective while streaming, and is now
|
|
311
|
+
warned about once per agent.
|
|
312
|
+
|
|
313
|
+
## 0.12.80
|
|
314
|
+
|
|
315
|
+
### Patch Changes
|
|
316
|
+
|
|
317
|
+
- 41c1a95: Move the adapter surface to `@pikku/core/ecosystem` so the root can promise stability
|
|
318
|
+
|
|
319
|
+
The types and helpers a runtime adapter, a service package, the code generator and the CLI implement against sat on the package root, mixed in with the API application code uses. That made the root impossible to commit to: `runPikkuFunc` was reshaped repeatedly over the last year while every field on `PikkuWire` survived untouched, and promising stability on both would mean promising the weaker of the two.
|
|
320
|
+
|
|
321
|
+
They now live on `@pikku/core/ecosystem`. The root is what 0.13's compatibility promise covers.
|
|
322
|
+
|
|
323
|
+
Not `/internal`: generated bootstrap files import from here, so the specifier lands in the user's own `.pikku` directory — telling someone they are touching internals when the code generator put it there is both wrong and self-defeating. Not `/runtime` either: that reads as runtime-versus-compile-time, `packages/runtimes/*` already claims the word, and the CLI is the largest consumer.
|
|
324
|
+
|
|
325
|
+
`./internal` remains as an alias to the same module, because the pinned bootstrap CLI still emits it.
|
|
326
|
+
|
|
327
|
+
Breaking for adapter authors; appropriate pre-0.13.
|
|
328
|
+
|
|
329
|
+
- ce96383: A child workflow now inherits the `pikkuUserId` its parent was running as
|
|
330
|
+
|
|
331
|
+
`PikkuWorkflowService` filled parts of the wire it builds for a workflow body and for a child run from the RPC service it had been handed — `rpcService.wire?.session`, `rpcService.wire?.rpc`, `rpcService.wire?.pikkuUserId`. `PikkuRPC` has no `wire`, and neither does the object the RPC service actually returns, so every one of those reads was `undefined`; the `rpcService: any` parameter type is what kept it quiet. The visible consequence was that a child workflow started from a step ran as nobody.
|
|
332
|
+
|
|
333
|
+
Those reads now come from the run record, which is durable and survives the process boundary a queued step crosses. `session` and `rpc` are not copied at all: `runPikkuFunc` attaches `rpc` lazily per invocation and resolves the session from the session store, so both were overwritten moments later regardless. The wires these paths build are typed `PikkuRawWire`, which is what they have always been.
|
|
334
|
+
|
|
335
|
+
`PikkuRPC` also now declares `rpcWithWire`, which the RPC service has always returned and the workflow service has always called.
|
|
336
|
+
|
|
337
|
+
- 7e60867: Delete exports nothing references
|
|
338
|
+
|
|
339
|
+
A sweep of the `@pikku/core` surface for exports with no consumer anywhere in the repo — no package, template, verifier or e2e project imports them: `ExtractFunctionOutput`, `CLICommandDefinition`, `RequestHeaders`, `HTTPFunctionsMeta`, `HTTPWiringMiddleware`, `JsonRpcError`, `TriggerSourceInfo`, `getMCPResources`, `getMCPPrompts`, `onGraphNodeComplete` and `InputRef`.
|
|
340
|
+
|
|
341
|
+
Every one was a compatibility promise with nothing on the other end of it. Removing them narrows what 0.13 has to keep stable.
|
|
342
|
+
|
|
343
|
+
`isRef` looked like the twelfth, and isn't. It is the type guard that reads what `createRef` writes — the `__isRef` brand marking a graph node input as "substitute another node's output here". Nothing imported it because neither it nor `RefValue` was reachable from any entry point, so the one consumer that needed it, the inspector's graph serializer, had reimplemented the same four conditions privately as `isRefValue` along with its own structural copy of `RefValue`. Deleting `isRef` would have made that duplicate permanent, with the brand's shape asserted in two places free to drift apart.
|
|
344
|
+
|
|
345
|
+
So `isRef` and `RefValue` are exported from `@pikku/core/workflow` instead, and the inspector imports them rather than keeping its own copy.
|
|
346
|
+
|
|
347
|
+
- f8f1244: Fix `onConnect`/`onDisconnect` wrapper handlers, and correct `wireChannel`'s generic arguments
|
|
348
|
+
|
|
349
|
+
`CoreChannel` accepts three shapes for a handler: a function config, a simple wrapper (`{ func, middleware }`), and a wrapper around a function config (`{ func: { func }, middleware }`). `wireChannel` unwrapped the third shape for `onMessage` and `onMessageWiring`, but registered `onConnect` and `onDisconnect` as-is — so the registered config's `func` was an object, and the function runner threw when it tried to call it. All three shapes now register a callable config on every handler.
|
|
350
|
+
|
|
351
|
+
`wireChannel`'s type arguments were also misaligned with `CoreChannel`'s parameter list: `PikkuPermission` was being passed into the `ChannelConnect` slot and `PikkuMiddleware` into `ChannelDisconnect`, which made `wireChannel({ onConnect: { func } })` fail to typecheck with "not assignable to `CorePikkuPermission`". End users did not see this — the CLI's generated `wireChannel` wrapper casts before calling core — but anyone importing `wireChannel` from `@pikku/core/channel` directly did. The signature is now `wireChannel<In, Channel>(channel: CoreChannel<In, Channel>)`; the three surplus type parameters were never used for anything correct and are gone.
|
|
352
|
+
|
|
353
|
+
- dcf20cb: Pin the public API, and declare which modules have import-time side effects
|
|
354
|
+
|
|
355
|
+
Nothing caught a change to what `@pikku/core` publishes. An export could appear, vanish, or have a member's signature change, and the only signal was a downstream break after release.
|
|
356
|
+
|
|
357
|
+
`public-surface.json` now pins every runtime export reachable through a `package.json` `exports` subpath, and `api-report.md` pins the API at **member** level — a method added to an interface is the change that breaks a consumer's build, and an export list cannot see it. Both regenerate from the code and are asserted against it, so widening the API is a visible diff rather than a side effect of an `export *`.
|
|
358
|
+
|
|
359
|
+
The report is written to state what the API _is_ rather than merely list identifiers, so the diff is readable by a reviewer.
|
|
360
|
+
|
|
361
|
+
`sideEffects` is declared as an allowlist rather than `false`: core genuinely has some. The error registry is built by `addError` calls that run on import, so claiming `sideEffects: false` would let a bundler drop it and leave `getErrorResponse` unable to find any error. A test detects the modules that actually have side effects and fails if the allowlist disagrees.
|
|
362
|
+
|
|
363
|
+
- 6512384: feat: give scenarios a `scenario.context` their `before`/`after` hooks can read
|
|
364
|
+
|
|
365
|
+
A hook only ever received the run's _input_, so teardown could not reach an id
|
|
366
|
+
the scenario body minted — which is exactly what a failing run needs to clean
|
|
367
|
+
up. `wire.scenario.context` is a per-run scratch object shared by `before`, the
|
|
368
|
+
body and `after`. It is typed as a `Partial` of the scenario's output, because a
|
|
369
|
+
run that failed early has none of it.
|
|
370
|
+
|
|
371
|
+
```ts
|
|
372
|
+
pikkuScenario<void, { projectId: string }>({
|
|
373
|
+
func: async (_services, _data, { scenario }) => {
|
|
374
|
+
const { projectId } = await scenario.when('creates a project', 'createsProject', …)
|
|
375
|
+
scenario.context.projectId = projectId
|
|
376
|
+
…
|
|
377
|
+
},
|
|
378
|
+
after: pikkuScenarioHook<void, { projectId: string }>(
|
|
379
|
+
async (_services, _data, { scenario, actors }) => {
|
|
380
|
+
if (scenario.context.projectId) {
|
|
381
|
+
await actors.admin.invoke('deleteProject', { projectId: scenario.context.projectId })
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
),
|
|
385
|
+
})
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
Deliberately not a world: it is scoped to a single run, and scenario _steps_
|
|
389
|
+
cannot reach it — state still flows between steps as return values.
|
|
390
|
+
|
|
391
|
+
Feature-level `before`/`after` get the same member, scoped to their feature, so
|
|
392
|
+
group setup can hand group teardown what it created. It is a separate object
|
|
393
|
+
from the scenarios' contexts: one bag shared across a group is the invisible
|
|
394
|
+
coupling a Cucumber world had.
|
|
395
|
+
|
|
396
|
+
- e3b4c14: Remove the `addTagPermission`, `addHTTPPermission` and `ZodLike` compatibility stubs
|
|
397
|
+
|
|
398
|
+
Tag- and HTTP-route-level permissions were removed in #972; `addTagPermission` and `addHTTPPermission` survived only as throwing stubs so the pinned bootstrap CLI could resolve their imports at build time. `@pikku/cli@0.12.96` — the currently pinned bootstrap version — emits neither name, so the stubs and the `packages/cli/build.sh` rewrite rules that fed them are gone.
|
|
399
|
+
|
|
400
|
+
Declare permissions on the function instead: `pikkuFunc({ permissions })`, or app-wide with `addGlobalPermission`.
|
|
401
|
+
|
|
402
|
+
`ZodLike` was an alias for `StandardSchemaV1<T, T>` kept for generated code that no longer references it. Import `StandardSchemaV1` from `@standard-schema/spec` directly.
|
|
403
|
+
|
|
404
|
+
- efd0ed1: **An explicitly-`undefined` property no longer kills a step.** JSON Schema
|
|
405
|
+
cannot describe such a property, so the validator rejected the whole instance
|
|
406
|
+
rather than the field — `{ a: undefined }` threw
|
|
407
|
+
`Instances of "undefined" type are not supported`. Whether a payload could
|
|
408
|
+
contain one depended on how the call travelled: `JSON.stringify` drops those
|
|
409
|
+
keys over HTTP, while an in-process dispatch hands the object over intact, so
|
|
410
|
+
`workflow.do('step', 'rpc', { retries: data.maybeRetries })` failed only when
|
|
411
|
+
the step ran inline. `validateSchema` now strips them first, and an
|
|
412
|
+
explicitly-undefined _required_ field reports as the missing property it is.
|
|
413
|
+
- cba98fb: Security hardening sweep
|
|
414
|
+
- **Content uploads require a signature**, matching reads. `handleUpload` previously validated the path and the size limit and then wrote the file, so an unauthenticated `PUT` to the upload prefix landed on disk. The express server, which verified nothing at all, now verifies both uploads and reads.
|
|
415
|
+
- **The remote-RPC prefix is matched case-insensitively.** The router matches routes case-insensitively, so `/Remote/RPC/fn` reached the same handler while a case-sensitive `startsWith('/remote/rpc/')` let it past the mesh trust gate and the token's `fn` binding.
|
|
416
|
+
- **Dev quick-login refuses proxied requests.** The gate checked the hostname only, so a request forwarded with `Host: localhost` was auto-provisioned a root-admin session. Proxy markers (`forwarded`, `x-forwarded-*`) now refuse regardless of what they claim, and dev login is inert in production.
|
|
417
|
+
- **Logout clears the session cookie** instead of re-signing an absent session into a fresh, unexpired one.
|
|
418
|
+
- **Short-flag cluster parsing is bounded**, closing a CLI-over-channel denial of service.
|
|
419
|
+
- `allowedHosts` is carried into secret definition meta.
|
|
420
|
+
|
|
421
|
+
- ce96383: Split `pikku-workflow-service.ts` into composable modules and report missing workflow metadata as such
|
|
422
|
+
|
|
423
|
+
`PikkuWorkflowService`'s module carried its error catalog, run-engine interfaces, queue routing and queue wiring alongside the class. Those now live in `workflow-errors.ts`, `workflow-run-engine.types.ts`, `workflow-constants.ts`, `workflow-meta-resolver.ts`, `workflow-queue-routing.ts` and `workflow-queue-wiring.ts`, with the approval and recovery paths in `workflow-approval.ts` and `workflow-recovery.ts`. The `@pikku/core/workflow` entry point exports the same names as before.
|
|
424
|
+
|
|
425
|
+
Typing the workflow meta resolver surfaced a crash: a run whose workflow had no generated metadata threw `TypeError: Cannot read properties of undefined` from deep inside the runner, or `WorkflowNotFoundError` — neither of which points at the actual cause. It now throws `PikkuMissingMetaError`, matching how the queue and trigger runners already report the same condition.
|
|
426
|
+
|
|
427
|
+
- f8f1244: Tighten several public types that `as any` was masking
|
|
428
|
+
- `AIStreamEvent`'s `approval-request` variant now declares `runId: string` rather than `runId?: string`. Every emitter already set it, and `AIAgentResult['pendingApprovals']` has always required it — the optional let `undefined` reach a field consumers rely on to resume a suspended run.
|
|
429
|
+
- `PikkuWire` gains an optional `logger`. The no-op audit service already read `wire.logger` before falling back to the singleton, but nothing declared it, so a host had no typed way to attach an invocation-scoped logger.
|
|
430
|
+
- `pikkuAuth`'s marker is now the exported `AuthBranded` type instead of an untyped property, so the brand that agent tool filtering depends on is visible to the type system at both the site that sets it and the sites that read it.
|
|
431
|
+
|
|
432
|
+
Internally this takes core's non-test modules from 108 `as any` casts to none. Each is replaced by an assertion to the type actually wanted, or by a change to the surrounding types that makes the assertion unnecessary. A test holds the count at zero.
|
|
433
|
+
|
|
434
|
+
- f8f1244: Declare `CoreUserSession.readonly` and `ChannelMeta.gateway`, which the runtime already used
|
|
435
|
+
|
|
436
|
+
The function runner throws `ReadonlySessionError` when a session is marked `readonly` and the function is not, but `CoreUserSession` never declared the field — so there was no typed way to build a readonly session, and even core's own test had to cast. Likewise `wireGateway` writes `gateway: true` onto a websocket channel's meta, which `ChannelMeta` did not admit. Both are now declared.
|
|
437
|
+
|
|
438
|
+
The gateway websocket path also wrote channel meta without `input`, `disconnect` or `messageWirings`, all of which `ChannelMeta` requires and `channel-handler` indexes without a guard. It now writes a complete record.
|
|
439
|
+
|
|
440
|
+
- 6e93a35: Give each wire an explicit set of crossovers
|
|
441
|
+
|
|
442
|
+
`wire.rpc.agent` was implemented inline in `rpc-runner.ts`, which put the agent turn logic — run, stream, resume, interrupt, approve — inside the RPC primitive. It moves to `ai-agent/agent-rpc.ts`, next to the runner and stream code it delegates to; `rpc-runner` imports it and the getter stays, so a request that never touches an agent never builds the facade.
|
|
443
|
+
|
|
444
|
+
The wires (`http`, `channel`, `queue`, `scheduler`, `cli`, `rpc`, `ai-agent`, `workflow`) previously imported each other ad hoc, so an accidental edge was indistinguishable from a designed one. Each wire now declares the crossovers it is allowed, and a test walks the import graph to hold it — failing both on an undeclared edge and on a declared crossover that no longer exists, so the declaration cannot rot into a rubber stamp.
|
|
445
|
+
|
|
446
|
+
`unsupportedChannelRemote` moves from `channel-rpc-service.ts` to `channel-rpc.types.ts`, alongside the error it throws.
|
|
447
|
+
|
|
448
|
+
The shared storage conformance suite splits from one 1216-line module into one module per service, so a backend author can read the contract for the service they implement. `defineServiceTests` is unchanged for callers.
|
|
449
|
+
|
|
450
|
+
- 6dada45: fix(workflow,ai-agent): make a run's owner, entry node and step function authoritative
|
|
451
|
+
|
|
452
|
+
A graph run may only start at a node the graph declared in `meta.entryNodeIds`, and
|
|
453
|
+
the generated `POST /workflow/:workflowName/graph/:nodeId` route that let an HTTP
|
|
454
|
+
caller pick the entry node is gone. `startNode` stays for `PikkuTriggerService`,
|
|
455
|
+
which names a declared entry node anyway.
|
|
456
|
+
|
|
457
|
+
`StepState` now records the `rpcName` the workflow dispatched a step with, and the
|
|
458
|
+
step claim rejects a queue message naming a different function with
|
|
459
|
+
`WorkflowStepFunctionMismatchError` before mutating any status — a step runs under
|
|
460
|
+
the run owner's identity and without the `expose` gate, so the message must not
|
|
461
|
+
choose what runs.
|
|
462
|
+
|
|
463
|
+
`approveStep` takes the caller's session, and the generated status routes and
|
|
464
|
+
streams assert the same `assertWorkflowRunOwner` check: a run started through a
|
|
465
|
+
session may only be read and approved by that session's user. A run with no
|
|
466
|
+
recorded owner (trigger, scheduler, unauthenticated route) has nobody to compare
|
|
467
|
+
against and is still gated by the entrypoint's own `auth`/`permissions`.
|
|
468
|
+
|
|
469
|
+
`AIRunStateService.resolveApproval` is now a compare-and-swap returning whether
|
|
470
|
+
_this_ caller made the claim, and both agent resume paths run a tool only for the
|
|
471
|
+
approvals they claimed — concurrent approvals of one tool call no longer all
|
|
472
|
+
execute it.
|
|
473
|
+
|
|
1
474
|
## 0.12.79
|
|
2
475
|
|
|
3
476
|
### Patch Changes
|
package/dist/dev/hot-reload.js
CHANGED
|
@@ -61,12 +61,7 @@ export async function pikkuDevReloader(options) {
|
|
|
61
61
|
logger.error(`Failed to import: ${relative(process.cwd(), importPath)} (keeping old code)`);
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
//
|
|
65
|
-
// adding new ones. Write into the map captured at startup, NOT pikkuState's
|
|
66
|
-
// current one: a dev-server watcher may have temporarily swapped in a
|
|
67
|
-
// codegen-scoped map, whose writes are discarded when it restores.
|
|
68
|
-
// Schemas are NOT touched here: `input`/`output` hold raw zod schemas while
|
|
69
|
-
// the schema map carries codegen JSON schemas; mixing them crashed reloads.
|
|
64
|
+
// knowledge: decisions/internals/hot-reload-writes-into-the-function-map-captured-at-startup.md
|
|
70
65
|
for (const [exportName, exportValue] of Object.entries(mod)) {
|
|
71
66
|
if (!isFunctionConfig(exportValue))
|
|
72
67
|
continue;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The surface a package in the Pikku ecosystem reaches for — a runtime adapter,
|
|
3
|
+
* a service, the code generator's output, the CLI — and application code does
|
|
4
|
+
* not.
|
|
5
|
+
*
|
|
6
|
+
* Split out from the package root so 1.0's compatibility promise covers what
|
|
7
|
+
* applications actually import. These signatures move when the runtime needs
|
|
8
|
+
* them to — `runPikkuFunc` was reshaped over the last year while every field on
|
|
9
|
+
* `PikkuWire` survived — and promising stability on both would mean promising
|
|
10
|
+
* the weaker of the two.
|
|
11
|
+
*
|
|
12
|
+
* Not `/internal`: generated bootstrap files import from here, so the specifier
|
|
13
|
+
* lands in the user's own `.pikku` directory, and telling someone they are
|
|
14
|
+
* touching internals when the code generator put it there is both wrong and
|
|
15
|
+
* self-defeating — it could never be broken anyway. Not `/runtime` either: that
|
|
16
|
+
* reads as runtime-versus-compile-time, i.e. the real API, and `packages/runtimes/*`
|
|
17
|
+
* already claims the word while the CLI is the largest consumer here.
|
|
18
|
+
*
|
|
19
|
+
* `/internal` stays as an alias because the pinned bootstrap CLI still emits it.
|
|
20
|
+
*
|
|
21
|
+
* knowledge: decisions/internals/the-ecosystem-entry-point-carries-the-adapter-surface.md
|
|
22
|
+
*/
|
|
23
|
+
export { pikkuState, resetPikkuState, getAllPackageStates, getSingletonServices, getCreateWireServices, setSingletonServices, } from './pikku-state.js';
|
|
24
|
+
export { runPikkuFunc, addFunction } from './function/function-runner.js';
|
|
25
|
+
export { addGlobalMiddleware, addTagMiddleware as addMiddleware, } from './middleware-runner.js';
|
|
26
|
+
export { httpRouter } from './wirings/http/routers/http-router.js';
|
|
27
|
+
export type { CreateSingletonServices, CreateWireServices, } from './types/core.types.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The surface a package in the Pikku ecosystem reaches for — a runtime adapter,
|
|
3
|
+
* a service, the code generator's output, the CLI — and application code does
|
|
4
|
+
* not.
|
|
5
|
+
*
|
|
6
|
+
* Split out from the package root so 1.0's compatibility promise covers what
|
|
7
|
+
* applications actually import. These signatures move when the runtime needs
|
|
8
|
+
* them to — `runPikkuFunc` was reshaped over the last year while every field on
|
|
9
|
+
* `PikkuWire` survived — and promising stability on both would mean promising
|
|
10
|
+
* the weaker of the two.
|
|
11
|
+
*
|
|
12
|
+
* Not `/internal`: generated bootstrap files import from here, so the specifier
|
|
13
|
+
* lands in the user's own `.pikku` directory, and telling someone they are
|
|
14
|
+
* touching internals when the code generator put it there is both wrong and
|
|
15
|
+
* self-defeating — it could never be broken anyway. Not `/runtime` either: that
|
|
16
|
+
* reads as runtime-versus-compile-time, i.e. the real API, and `packages/runtimes/*`
|
|
17
|
+
* already claims the word while the CLI is the largest consumer here.
|
|
18
|
+
*
|
|
19
|
+
* `/internal` stays as an alias because the pinned bootstrap CLI still emits it.
|
|
20
|
+
*
|
|
21
|
+
* knowledge: decisions/internals/the-ecosystem-entry-point-carries-the-adapter-surface.md
|
|
22
|
+
*/
|
|
23
|
+
export { pikkuState, resetPikkuState, getAllPackageStates, getSingletonServices, getCreateWireServices, setSingletonServices, } from './pikku-state.js';
|
|
24
|
+
export { runPikkuFunc, addFunction } from './function/function-runner.js';
|
|
25
|
+
export { addGlobalMiddleware, addTagMiddleware as addMiddleware, } from './middleware-runner.js';
|
|
26
|
+
export { httpRouter } from './wirings/http/routers/http-router.js';
|
|
@@ -12,7 +12,8 @@ export class PikkuError extends Error {
|
|
|
12
12
|
* plain `Error`. Callers log the message alone for these, the full stack for
|
|
13
13
|
* everything else.
|
|
14
14
|
*/
|
|
15
|
-
export const isExpectedError = (error) => error instanceof PikkuError ||
|
|
15
|
+
export const isExpectedError = (error) => error instanceof PikkuError ||
|
|
16
|
+
error?.expected === true;
|
|
16
17
|
export const addError = (error, { status, message, mcpCode }) => {
|
|
17
18
|
pikkuState(null, 'misc', 'errors').set(error, mcpCode === undefined ? { status, message } : { status, message, mcpCode });
|
|
18
19
|
};
|
|
@@ -31,7 +32,8 @@ export const getErrorResponse = (error) => {
|
|
|
31
32
|
}
|
|
32
33
|
ctor = Object.getPrototypeOf(ctor);
|
|
33
34
|
}
|
|
34
|
-
const name = error
|
|
35
|
+
const name = error
|
|
36
|
+
?.constructor?.name;
|
|
35
37
|
return name
|
|
36
38
|
? Array.from(errors.entries()).find(([e]) => e.name === name)?.[1]
|
|
37
39
|
: undefined;
|
package/dist/errors/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './errors.js';
|
|
2
|
-
export { PikkuError, addError
|
|
2
|
+
export { PikkuError, addError } from './error-handler.js';
|
package/dist/errors/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './errors.js';
|
|
2
|
-
export { PikkuError, addError
|
|
2
|
+
export { PikkuError, addError } from './error-handler.js';
|