@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { PikkuFetchHTTPRequest, DEFAULT_MAX_BODY_SIZE, } from './pikku-fetch-http-request.js';
|
|
2
2
|
export { PikkuFetchHTTPResponse } from './pikku-fetch-http-response.js';
|
|
3
3
|
export { logRoutes } from './log-http-routes.js';
|
|
4
|
-
export { fetch, fetchData, wireHTTP, addHTTPMiddleware
|
|
4
|
+
export { fetch, fetchData, wireHTTP, addHTTPMiddleware } from './http-runner.js';
|
|
5
5
|
export { wireHTTPRoutes, defineHTTPRoutes } from './http-routes.js';
|
|
6
6
|
export { toWebRequest, applyWebResponse } from './web-request.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { MCPEndpointRegistry } from './mcp-endpoint-registry.js';
|
|
2
2
|
export { MCPError, wireMCPResource, wireMCPPrompt, runMCPResource, runMCPTool, runMCPPrompt, } from './mcp-runner.js';
|
|
3
3
|
export { getMCPResourcesMeta, getMCPToolsMeta, getMCPPromptsMeta, } from './mcp-runner.js';
|
|
4
|
-
export type { AssertMCPResourceURIParams, CoreMCPPrompt, CoreMCPResource,
|
|
4
|
+
export type { AssertMCPResourceURIParams, CoreMCPPrompt, CoreMCPResource, MCPPromptResponse, MCPResourceMeta, MCPResourceResponse, MCPToolMeta, MCPToolResponse, MCPPromptMeta, PikkuMCP, } from './mcp.types.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PikkuHTTP } from '../http/http.types.js';
|
|
1
2
|
import type { CoreMCPResource, CoreMCPPrompt, JsonRpcRequest, JsonRpcResponse, JsonRpcErrorResponse, PikkuMCP } from './mcp.types.js';
|
|
2
3
|
import type { CorePikkuFunctionConfig, CorePikkuFunctionSessionless } from '../../function/functions.types.js';
|
|
3
4
|
export declare class MCPError extends Error {
|
|
@@ -6,21 +7,28 @@ export declare class MCPError extends Error {
|
|
|
6
7
|
}
|
|
7
8
|
export type RunMCPEndpointParams<Tools extends string = any> = {
|
|
8
9
|
mcp?: PikkuMCP<Tools>;
|
|
10
|
+
/**
|
|
11
|
+
* The HTTP request the MCP call arrived on, when it arrived over HTTP.
|
|
12
|
+
*
|
|
13
|
+
* Auth middleware reads the session off `wire.http.request` — every
|
|
14
|
+
* implementation opens with `if (!http?.request) return` — so without this an
|
|
15
|
+
* MCP call reaches the function unauthenticated no matter what middleware the
|
|
16
|
+
* app has registered, and a tool fronting a session-requiring function can
|
|
17
|
+
* only ever answer 'Authentication required'.
|
|
18
|
+
*
|
|
19
|
+
* Left undefined for transports that have no request to offer, such as stdio.
|
|
20
|
+
* Those remain anonymous, which is a property of the transport rather than a
|
|
21
|
+
* default chosen here.
|
|
22
|
+
*/
|
|
23
|
+
http?: PikkuHTTP;
|
|
9
24
|
/** Defaults to enabled outside production. */
|
|
10
25
|
exposeErrors?: boolean;
|
|
11
26
|
};
|
|
12
|
-
export type JsonRpcError = {
|
|
13
|
-
code: number;
|
|
14
|
-
message: string;
|
|
15
|
-
data?: any;
|
|
16
|
-
};
|
|
17
27
|
export declare const wireMCPResource: <PikkuFunctionConfig extends CorePikkuFunctionConfig<CorePikkuFunctionSessionless<any, any>> = CorePikkuFunctionConfig<CorePikkuFunctionSessionless<any, any>>>(mcpResource: CoreMCPResource<PikkuFunctionConfig>) => void;
|
|
18
28
|
export declare const wireMCPPrompt: <PikkuFunctionConfig extends CorePikkuFunctionConfig<CorePikkuFunctionSessionless<any, any>> = CorePikkuFunctionConfig<CorePikkuFunctionSessionless<any, any>>>(mcpPrompt: CoreMCPPrompt<PikkuFunctionConfig>) => void;
|
|
19
29
|
export declare function runMCPResource(request: JsonRpcRequest, params: RunMCPEndpointParams, uri: string): Promise<JsonRpcResponse>;
|
|
20
30
|
export declare function runMCPTool(request: JsonRpcRequest, params: RunMCPEndpointParams, name: string): Promise<JsonRpcResponse>;
|
|
21
31
|
export declare function runMCPPrompt(request: JsonRpcRequest, params: RunMCPEndpointParams, name: string): Promise<JsonRpcResponse>;
|
|
22
|
-
export declare const getMCPResources: () => Map<string, CoreMCPResource>;
|
|
23
32
|
export declare const getMCPResourcesMeta: () => import("./mcp.types.js").MCPResourceMeta;
|
|
24
33
|
export declare const getMCPToolsMeta: () => import("./mcp.types.js").MCPToolMeta;
|
|
25
|
-
export declare const getMCPPrompts: () => Map<string, CoreMCPPrompt>;
|
|
26
34
|
export declare const getMCPPromptsMeta: () => import("./mcp.types.js").MCPPromptMeta;
|
|
@@ -48,6 +48,11 @@ export async function runMCPResource(request, params, uri) {
|
|
|
48
48
|
let extractedParams = {};
|
|
49
49
|
const metas = pikkuState(null, 'mcp', 'resourcesMeta');
|
|
50
50
|
const endpoints = pikkuState(null, 'mcp', 'resources');
|
|
51
|
+
// The key the resource's meta (and its middleware) is stored under. For a
|
|
52
|
+
// templated resource this is the template, not the concrete request URI — so
|
|
53
|
+
// it must be carried forward, or the meta lookup downstream misses and the
|
|
54
|
+
// resource's declared middleware (including auth) is silently skipped.
|
|
55
|
+
let metaKey = uri;
|
|
51
56
|
if (endpoints.has(uri)) {
|
|
52
57
|
endpoint = endpoints.get(uri);
|
|
53
58
|
pikkuFuncId = metas[uri]?.pikkuFuncId;
|
|
@@ -60,6 +65,7 @@ export async function runMCPResource(request, params, uri) {
|
|
|
60
65
|
const match = uri.match(regex);
|
|
61
66
|
if (match) {
|
|
62
67
|
endpoint = value;
|
|
68
|
+
metaKey = uriTemplate;
|
|
63
69
|
pikkuFuncId = metas[uriTemplate]?.pikkuFuncId;
|
|
64
70
|
for (let i = 0; i < paramNames.length; i++) {
|
|
65
71
|
extractedParams[paramNames[i]] = match[i + 1]; // match[0] is the full match
|
|
@@ -71,7 +77,7 @@ export async function runMCPResource(request, params, uri) {
|
|
|
71
77
|
return await runMCPPikkuFunc({
|
|
72
78
|
...request,
|
|
73
79
|
params: { ...request.params, ...extractedParams },
|
|
74
|
-
}, 'resource', uri, endpoint, pikkuFuncId, { ...params, mcp: { ...params.mcp, uri } });
|
|
80
|
+
}, 'resource', uri, endpoint, pikkuFuncId, { ...params, mcp: { ...params.mcp, uri } }, metaKey);
|
|
75
81
|
}
|
|
76
82
|
export async function runMCPTool(request, params, name) {
|
|
77
83
|
const meta = pikkuState(null, 'mcp', 'toolsMeta')[name];
|
|
@@ -82,7 +88,11 @@ export async function runMCPPrompt(request, params, name) {
|
|
|
82
88
|
const meta = pikkuState(null, 'mcp', 'promptsMeta')[name];
|
|
83
89
|
return await runMCPPikkuFunc(request, 'prompt', name, endpoint, meta?.pikkuFuncId, params);
|
|
84
90
|
}
|
|
85
|
-
async function runMCPPikkuFunc(request, type, name, mcp, pikkuFuncId, { mcp: mcpWire, exposeErrors = !isProduction() }
|
|
91
|
+
async function runMCPPikkuFunc(request, type, name, mcp, pikkuFuncId, { mcp: mcpWire, http, exposeErrors = !isProduction() },
|
|
92
|
+
// The key the endpoint's meta is stored under. Differs from `name` only for a
|
|
93
|
+
// templated resource, where `name` is the concrete URI and the meta lives
|
|
94
|
+
// under the template. Defaults to `name` for tools and prompts.
|
|
95
|
+
metaKey = name) {
|
|
86
96
|
const singletonServices = getSingletonServices();
|
|
87
97
|
const createWireServices = getCreateWireServices();
|
|
88
98
|
try {
|
|
@@ -99,17 +109,20 @@ async function runMCPPikkuFunc(request, type, name, mcp, pikkuFuncId, { mcp: mcp
|
|
|
99
109
|
const mcpSessionService = new PikkuSessionService(singletonServices.sessionStore);
|
|
100
110
|
const wire = {
|
|
101
111
|
mcp: mcpWire,
|
|
112
|
+
// Only when the transport supplied one. Setting `http: undefined`
|
|
113
|
+
// explicitly would be the same to a reader and different to a spread.
|
|
114
|
+
...(http ? { http } : {}),
|
|
102
115
|
...createMiddlewareSessionWireProps(mcpSessionService),
|
|
103
116
|
};
|
|
104
117
|
let meta;
|
|
105
118
|
if (type === 'resource') {
|
|
106
|
-
meta = pikkuState(null, 'mcp', 'resourcesMeta')[
|
|
119
|
+
meta = pikkuState(null, 'mcp', 'resourcesMeta')[metaKey];
|
|
107
120
|
}
|
|
108
121
|
else if (type === 'tool') {
|
|
109
|
-
meta = pikkuState(null, 'mcp', 'toolsMeta')[
|
|
122
|
+
meta = pikkuState(null, 'mcp', 'toolsMeta')[metaKey];
|
|
110
123
|
}
|
|
111
124
|
else if (type === 'prompt') {
|
|
112
|
-
meta = pikkuState(null, 'mcp', 'promptsMeta')[
|
|
125
|
+
meta = pikkuState(null, 'mcp', 'promptsMeta')[metaKey];
|
|
113
126
|
}
|
|
114
127
|
let resolvedFuncName = pikkuFuncId;
|
|
115
128
|
let resolvedPackageName = meta?.packageName ?? null;
|
|
@@ -165,18 +178,12 @@ async function runMCPPikkuFunc(request, type, name, mcp, pikkuFuncId, { mcp: mcp
|
|
|
165
178
|
}
|
|
166
179
|
}
|
|
167
180
|
}
|
|
168
|
-
export const getMCPResources = () => {
|
|
169
|
-
return pikkuState(null, 'mcp', 'resources');
|
|
170
|
-
};
|
|
171
181
|
export const getMCPResourcesMeta = () => {
|
|
172
182
|
return pikkuState(null, 'mcp', 'resourcesMeta');
|
|
173
183
|
};
|
|
174
184
|
export const getMCPToolsMeta = () => {
|
|
175
185
|
return pikkuState(null, 'mcp', 'toolsMeta');
|
|
176
186
|
};
|
|
177
|
-
export const getMCPPrompts = () => {
|
|
178
|
-
return pikkuState(null, 'mcp', 'prompts');
|
|
179
|
-
};
|
|
180
187
|
export const getMCPPromptsMeta = () => {
|
|
181
188
|
return pikkuState(null, 'mcp', 'promptsMeta');
|
|
182
189
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export { definePersonas } from './define-personas.js';
|
|
2
2
|
export { isRunnablePersona, roleMismatchMessage, runnablePersonas, validateAndBuildPersonasMeta, verifyPersonaRoles, } from './validate-personas.js';
|
|
3
3
|
export type { RoleVerification } from './validate-personas.js';
|
|
4
|
-
export { personaEnvironmentErrors, personaEnvironmentRefusal,
|
|
4
|
+
export { personaEnvironmentErrors, personaEnvironmentRefusal, } from './persona-environments.js';
|
|
5
5
|
export type { PersonaEnvironment, PersonaEnvironmentSubject, } from './persona-environments.js';
|
|
6
|
-
export { personaEmail,
|
|
7
|
-
export { allowedLinks, applyMailboxAllowlist, isAllowedSender, } from './persona-mailbox.js';
|
|
6
|
+
export { personaEmail, personaEmails, } from './persona-email.js';
|
|
8
7
|
export type { MailboxAllowlist, PersonaMailbox, ReceivedEmail, } from './persona-mailbox.js';
|
|
9
|
-
export type { CorePersona,
|
|
8
|
+
export type { CorePersona, CorePersonas, PersonaAccountMeta, PersonaDefinitions, PersonaMeta, PersonasMeta, } from './persona.types.js';
|
|
10
9
|
/**
|
|
11
10
|
* Signing in as a persona and talking to a stage over HTTP.
|
|
12
11
|
*
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export { definePersonas } from './define-personas.js';
|
|
2
2
|
export { isRunnablePersona, roleMismatchMessage, runnablePersonas, validateAndBuildPersonasMeta, verifyPersonaRoles, } from './validate-personas.js';
|
|
3
|
-
export { personaEnvironmentErrors, personaEnvironmentRefusal,
|
|
4
|
-
export { personaEmail,
|
|
5
|
-
export { allowedLinks, applyMailboxAllowlist, isAllowedSender, } from './persona-mailbox.js';
|
|
3
|
+
export { personaEnvironmentErrors, personaEnvironmentRefusal, } from './persona-environments.js';
|
|
4
|
+
export { personaEmail, personaEmails, } from './persona-email.js';
|
|
6
5
|
/**
|
|
7
6
|
* Signing in as a persona and talking to a stage over HTTP.
|
|
8
7
|
*
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export type { ConfigValidationResult, CoreQueueWorker, GroupConcurrencyConfig, JobGroup, JobOptions, PikkuJobConfig, PikkuWorkerConfig, PikkuQueue, QueueJob, QueueJobStatus, QueueService, QueueWorkers, QueueWorkersMeta, } from './queue.types.js';
|
|
2
|
-
export { wireQueueWorker, runQueueJob,
|
|
3
|
-
export { QUEUE_IDENTITY_CLAIM_VERSION, QUEUE_IDENTITY_INFO, QUEUE_IDENTITY_SECRET_NAME, getQueueIdentitySecret, resolveQueueJobIdentity, signQueueIdentity, verifyQueueIdentity, } from './queue-identity.js';
|
|
2
|
+
export { wireQueueWorker, runQueueJob, QueueJobDiscardedError, QueueJobFailedError, } from './queue-runner.js';
|
|
4
3
|
export type { QueueIdentityBinding } from './queue-identity.js';
|
|
5
4
|
export { SignedQueueService } from './signed-queue-service.js';
|
|
6
|
-
export { validateWorkerConfig } from './validate-worker-config.js';
|
|
7
5
|
export type { QueueConfigMapping } from './validate-worker-config.js';
|
|
8
6
|
export { registerQueueWorkers } from './register-queue-helper.js';
|
|
9
7
|
export type { QueueRegistrationCallback } from './register-queue-helper.js';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export { wireQueueWorker, runQueueJob,
|
|
2
|
-
export { QUEUE_IDENTITY_CLAIM_VERSION, QUEUE_IDENTITY_INFO, QUEUE_IDENTITY_SECRET_NAME, getQueueIdentitySecret, resolveQueueJobIdentity, signQueueIdentity, verifyQueueIdentity, } from './queue-identity.js';
|
|
1
|
+
export { wireQueueWorker, runQueueJob, QueueJobDiscardedError, QueueJobFailedError, } from './queue-runner.js';
|
|
3
2
|
export { SignedQueueService } from './signed-queue-service.js';
|
|
4
|
-
export { validateWorkerConfig } from './validate-worker-config.js';
|
|
5
3
|
export { registerQueueWorkers } from './register-queue-helper.js';
|
|
@@ -4,6 +4,10 @@ export type AddonInstance = {
|
|
|
4
4
|
secretOverrides?: Record<string, string>;
|
|
5
5
|
variableOverrides?: Record<string, string>;
|
|
6
6
|
credentialOverrides?: Record<string, string>;
|
|
7
|
+
/** Set by the consuming app to opt this instance out of secret scoping. */
|
|
8
|
+
globalSecrets?: string;
|
|
9
|
+
/** Set by the consuming app to opt this instance out of credential scoping. */
|
|
10
|
+
globalCredentials?: string;
|
|
7
11
|
};
|
|
8
12
|
export declare const getOrCreatePackageSingletonServices: (packageName: string, parentServices: CoreSingletonServices, addonInstance?: AddonInstance) => Promise<CoreSingletonServices>;
|
|
9
13
|
export declare const addonInstanceForNamespace: (namespace: string | undefined, expectedPackage: string) => AddonInstance | undefined;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { pikkuState } from '../../pikku-state.js';
|
|
2
|
+
import { ScopedSecretService } from '../../services/scoped-secret-service.js';
|
|
3
|
+
import { ScopedCredentialService } from '../../services/scoped-credential-service.js';
|
|
2
4
|
const aliasSecretService = (secrets, overrides) => {
|
|
3
5
|
const map = (key) => overrides[key] ?? key;
|
|
4
6
|
return {
|
|
@@ -79,9 +81,6 @@ export const getOrCreatePackageSingletonServices = async (packageName, parentSer
|
|
|
79
81
|
return cachedServices;
|
|
80
82
|
}
|
|
81
83
|
const factories = pikkuState(packageName, 'package', 'factories');
|
|
82
|
-
if (!factories || !factories.createSingletonServices) {
|
|
83
|
-
return parentServices;
|
|
84
|
-
}
|
|
85
84
|
let existingServices = parentServices;
|
|
86
85
|
if (addonInstance?.secretOverrides && parentServices.secrets) {
|
|
87
86
|
existingServices = {
|
|
@@ -95,6 +94,21 @@ export const getOrCreatePackageSingletonServices = async (packageName, parentSer
|
|
|
95
94
|
variables: aliasVariablesService(parentServices.variables, addonInstance.variableOverrides),
|
|
96
95
|
};
|
|
97
96
|
}
|
|
97
|
+
if (!addonInstance?.globalSecrets && existingServices.secrets) {
|
|
98
|
+
existingServices = {
|
|
99
|
+
...existingServices,
|
|
100
|
+
secrets: new ScopedSecretService(existingServices.secrets, new Set(pikkuState(packageName, 'package', 'declaredSecrets') ?? [])),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (!addonInstance?.globalCredentials && existingServices.credentialService) {
|
|
104
|
+
existingServices = {
|
|
105
|
+
...existingServices,
|
|
106
|
+
credentialService: new ScopedCredentialService(existingServices.credentialService, new Set(Object.keys(pikkuState(packageName, 'package', 'credentialsMeta') ?? {}))),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (!factories || !factories.createSingletonServices) {
|
|
110
|
+
return existingServices;
|
|
111
|
+
}
|
|
98
112
|
let config = existingServices.config;
|
|
99
113
|
if (factories.createConfig) {
|
|
100
114
|
config = await factories.createConfig(existingServices.variables);
|
|
@@ -118,5 +132,7 @@ export const addonInstanceForNamespace = (namespace, expectedPackage) => {
|
|
|
118
132
|
secretOverrides: cfg.secretOverrides,
|
|
119
133
|
variableOverrides: cfg.variableOverrides,
|
|
120
134
|
credentialOverrides: cfg.credentialOverrides,
|
|
135
|
+
globalSecrets: cfg.globalSecrets,
|
|
136
|
+
globalCredentials: cfg.globalCredentials,
|
|
121
137
|
};
|
|
122
138
|
};
|
|
@@ -14,8 +14,6 @@ export declare class RemoteAddonRequestError extends PikkuError {
|
|
|
14
14
|
readonly httpStatus: number;
|
|
15
15
|
constructor(namespace: string, fnName: string, status: number, detail: string);
|
|
16
16
|
}
|
|
17
|
-
import type { AIAgentInput } from '../ai-agent/ai-agent.types.js';
|
|
18
|
-
import type { StreamAIAgentOptions } from '../ai-agent/ai-agent-prepare.js';
|
|
19
17
|
export declare const resolveNamespace: (namespacedFunction: string) => ResolvedFunction | null;
|
|
20
18
|
export declare class ContextAwareRPCService {
|
|
21
19
|
private services;
|
|
@@ -51,55 +49,14 @@ export declare class ContextAwareRPCService {
|
|
|
51
49
|
}): Promise<{
|
|
52
50
|
runId: string;
|
|
53
51
|
}>;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
runId: string;
|
|
63
|
-
}[] | undefined;
|
|
64
|
-
runId: string;
|
|
65
|
-
result: {};
|
|
66
|
-
usage: {
|
|
67
|
-
inputTokens: number;
|
|
68
|
-
outputTokens: number;
|
|
69
|
-
};
|
|
70
|
-
}>;
|
|
71
|
-
stream: (agentName: string, input: {
|
|
72
|
-
message: string;
|
|
73
|
-
threadId: string;
|
|
74
|
-
resourceId: string;
|
|
75
|
-
model?: string;
|
|
76
|
-
temperature?: number;
|
|
77
|
-
}, options?: StreamAIAgentOptions) => Promise<void>;
|
|
78
|
-
resume: (runId: string, input: {
|
|
79
|
-
toolCallId: string;
|
|
80
|
-
approved: boolean;
|
|
81
|
-
}, options?: StreamAIAgentOptions) => Promise<void>;
|
|
82
|
-
interrupt: (runId: string, reason?: "speech" | "user" | "timeout") => Promise<import("../ai-agent/ai-agent-interrupt.js").AgentInterruptResult>;
|
|
83
|
-
approve: (runId: string, approvals: {
|
|
84
|
-
toolCallId: string;
|
|
85
|
-
approved: boolean;
|
|
86
|
-
}[], expectedAgentName?: string) => Promise<{
|
|
87
|
-
status?: "suspended" | undefined;
|
|
88
|
-
pendingApprovals?: {
|
|
89
|
-
toolCallId: string;
|
|
90
|
-
toolName: string;
|
|
91
|
-
args: unknown;
|
|
92
|
-
reason?: string;
|
|
93
|
-
runId: string;
|
|
94
|
-
}[] | undefined;
|
|
95
|
-
runId: string;
|
|
96
|
-
result: {};
|
|
97
|
-
usage: {
|
|
98
|
-
inputTokens: number;
|
|
99
|
-
outputTokens: number;
|
|
100
|
-
};
|
|
101
|
-
}>;
|
|
102
|
-
};
|
|
52
|
+
/**
|
|
53
|
+
* The agent facade, built on access.
|
|
54
|
+
*
|
|
55
|
+
* The implementation lives in `ai-agent/agent-rpc.ts` so the agent surface is
|
|
56
|
+
* one file rather than a wing of this one; a getter rather than a field so a
|
|
57
|
+
* request that never touches an agent never builds it.
|
|
58
|
+
*/
|
|
59
|
+
get agent(): PikkuRPC['agent'];
|
|
103
60
|
remote<In = any, Out = any>(funcName: string, data: In): Promise<Out>;
|
|
104
61
|
}
|
|
105
62
|
export declare class PikkuRPCService<Services extends CoreServices, TypedRPC = PikkuRPC> {
|
|
@@ -4,6 +4,12 @@ import { pikkuState } from '../../pikku-state.js';
|
|
|
4
4
|
import { PikkuError, addError } from '../../errors/error-handler.js';
|
|
5
5
|
import { parseVersionedId } from '../../version.js';
|
|
6
6
|
import { resolveRemoteAddonToken } from './remote-addon-auth.js';
|
|
7
|
+
import { createAgentRPC } from '../ai-agent/agent-rpc.js';
|
|
8
|
+
/**
|
|
9
|
+
* The session for a wire: read through `getSession` when a runner attached one,
|
|
10
|
+
* otherwise whatever was placed on the wire directly.
|
|
11
|
+
*/
|
|
12
|
+
const resolveWireSession = async (wire) => typeof wire.getSession === 'function' ? await wire.getSession() : wire.session;
|
|
7
13
|
export class RPCNotFoundError extends PikkuError {
|
|
8
14
|
rpcName;
|
|
9
15
|
constructor(rpcName) {
|
|
@@ -36,9 +42,6 @@ addError(RemoteAddonRequestError, {
|
|
|
36
42
|
status: 502,
|
|
37
43
|
message: 'Remote addon request failed.',
|
|
38
44
|
});
|
|
39
|
-
import { runAIAgent, resumeAIAgentSync } from '../ai-agent/ai-agent-runner.js';
|
|
40
|
-
import { streamAIAgent, resumeAIAgent, interruptAIAgent, } from '../ai-agent/ai-agent-stream.js';
|
|
41
|
-
import { wrapChannelWithAGUI } from '../ai-agent/ai-agent-agui.js';
|
|
42
45
|
export const resolveNamespace = (namespacedFunction) => {
|
|
43
46
|
const colonIndex = namespacedFunction.indexOf(':');
|
|
44
47
|
if (colonIndex === -1) {
|
|
@@ -142,9 +145,7 @@ export class ContextAwareRPCService {
|
|
|
142
145
|
catch (e) {
|
|
143
146
|
if (e instanceof RPCNotFoundError) {
|
|
144
147
|
if (this.services.deploymentService) {
|
|
145
|
-
const session =
|
|
146
|
-
? await this.wire.getSession()
|
|
147
|
-
: this.wire.session;
|
|
148
|
+
const session = await resolveWireSession(this.wire);
|
|
148
149
|
return this.services.deploymentService.invoke(funcName, data, session, this.wire.traceId);
|
|
149
150
|
}
|
|
150
151
|
}
|
|
@@ -202,6 +203,8 @@ export class ContextAwareRPCService {
|
|
|
202
203
|
secretOverrides: resolved.addonConfig?.secretOverrides,
|
|
203
204
|
variableOverrides: resolved.addonConfig?.variableOverrides,
|
|
204
205
|
credentialOverrides: resolved.addonConfig?.credentialOverrides,
|
|
206
|
+
globalSecrets: resolved.addonConfig?.globalSecrets,
|
|
207
|
+
globalCredentials: resolved.addonConfig?.globalCredentials,
|
|
205
208
|
},
|
|
206
209
|
};
|
|
207
210
|
}
|
|
@@ -276,9 +279,7 @@ export class ContextAwareRPCService {
|
|
|
276
279
|
}
|
|
277
280
|
catch (e) {
|
|
278
281
|
if (e instanceof RPCNotFoundError && this.services.deploymentService) {
|
|
279
|
-
const session =
|
|
280
|
-
? await this.wire.getSession()
|
|
281
|
-
: this.wire.session;
|
|
282
|
+
const session = await resolveWireSession(this.wire);
|
|
282
283
|
return this.services.deploymentService.invoke(rpcName, data, session, this.wire.traceId);
|
|
283
284
|
}
|
|
284
285
|
throw e;
|
|
@@ -308,78 +309,22 @@ export class ContextAwareRPCService {
|
|
|
308
309
|
};
|
|
309
310
|
return this.services.workflowService.startWorkflow(workflowName, input, wire, this, options);
|
|
310
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* The agent facade, built on access.
|
|
314
|
+
*
|
|
315
|
+
* The implementation lives in `ai-agent/agent-rpc.ts` so the agent surface is
|
|
316
|
+
* one file rather than a wing of this one; a getter rather than a field so a
|
|
317
|
+
* request that never touches an agent never builds it.
|
|
318
|
+
*/
|
|
311
319
|
get agent() {
|
|
312
|
-
return
|
|
313
|
-
run: async (agentName, input) => {
|
|
314
|
-
const result = await runAIAgent(agentName, input, {
|
|
315
|
-
sessionService: this.options.sessionService,
|
|
316
|
-
getCredential: this.wire.getCredential?.bind(this.wire),
|
|
317
|
-
});
|
|
318
|
-
return {
|
|
319
|
-
runId: result.runId,
|
|
320
|
-
result: result.object ?? result.text,
|
|
321
|
-
usage: result.usage,
|
|
322
|
-
...(result.status === 'suspended' && {
|
|
323
|
-
status: 'suspended',
|
|
324
|
-
pendingApprovals: result.pendingApprovals,
|
|
325
|
-
}),
|
|
326
|
-
};
|
|
327
|
-
},
|
|
328
|
-
stream: async (agentName, input, options) => {
|
|
329
|
-
const channel = this.wire.channel;
|
|
330
|
-
if (!channel)
|
|
331
|
-
throw new Error('No channel available for streaming');
|
|
332
|
-
let currentRunId;
|
|
333
|
-
await streamAIAgent(agentName, input, wrapChannelWithAGUI(channel, {
|
|
334
|
-
threadId: input.threadId,
|
|
335
|
-
getRunId: () => currentRunId,
|
|
336
|
-
}), {
|
|
337
|
-
sessionService: this.options.sessionService,
|
|
338
|
-
getCredential: this.wire.getCredential?.bind(this.wire),
|
|
339
|
-
}, undefined, {
|
|
340
|
-
...options,
|
|
341
|
-
onRunCreated: (runId) => {
|
|
342
|
-
currentRunId = runId;
|
|
343
|
-
options?.onRunCreated?.(runId);
|
|
344
|
-
},
|
|
345
|
-
});
|
|
346
|
-
},
|
|
347
|
-
resume: async (runId, input, options) => {
|
|
348
|
-
const channel = this.wire.channel;
|
|
349
|
-
if (!channel)
|
|
350
|
-
throw new Error('No channel available for streaming');
|
|
351
|
-
await resumeAIAgent({ runId, ...input }, wrapChannelWithAGUI(channel, { runId }), {
|
|
352
|
-
sessionService: this.options.sessionService,
|
|
353
|
-
getCredential: this.wire.getCredential?.bind(this.wire),
|
|
354
|
-
}, options);
|
|
355
|
-
},
|
|
356
|
-
interrupt: async (runId, reason) => {
|
|
357
|
-
return interruptAIAgent({ runId, ...(reason ? { reason } : {}) }, { sessionService: this.options.sessionService });
|
|
358
|
-
},
|
|
359
|
-
approve: async (runId, approvals, expectedAgentName) => {
|
|
360
|
-
const result = await resumeAIAgentSync(runId, approvals, {
|
|
361
|
-
sessionService: this.options.sessionService,
|
|
362
|
-
}, expectedAgentName);
|
|
363
|
-
return {
|
|
364
|
-
runId: result.runId,
|
|
365
|
-
result: result.object ?? result.text,
|
|
366
|
-
usage: result.usage,
|
|
367
|
-
...(result.status === 'suspended' && {
|
|
368
|
-
status: 'suspended',
|
|
369
|
-
pendingApprovals: result.pendingApprovals,
|
|
370
|
-
}),
|
|
371
|
-
};
|
|
372
|
-
},
|
|
373
|
-
};
|
|
320
|
+
return createAgentRPC(this.wire, this.options);
|
|
374
321
|
}
|
|
375
322
|
async remote(funcName, data) {
|
|
376
323
|
if (!this.services.deploymentService) {
|
|
377
324
|
throw new Error(`No DeploymentService configured for remote RPC: ${funcName}. ` +
|
|
378
325
|
`Set up a DeploymentService to enable remote function calls.`);
|
|
379
326
|
}
|
|
380
|
-
const session =
|
|
381
|
-
? await this.wire.getSession()
|
|
382
|
-
: this.wire.session;
|
|
327
|
+
const session = await resolveWireSession(this.wire);
|
|
383
328
|
return this.services.deploymentService.invoke(funcName, data, session, this.wire.traceId);
|
|
384
329
|
}
|
|
385
330
|
}
|
|
@@ -390,18 +335,42 @@ export class PikkuRPCService {
|
|
|
390
335
|
? requiresAuthOrOptions
|
|
391
336
|
: { requiresAuth: requiresAuthOrOptions };
|
|
392
337
|
const serviceRPC = new ContextAwareRPCService(services, wire, options, packageName);
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
338
|
+
// `TypedRPC` is named by the caller from its generated RPC map. Nothing
|
|
339
|
+
// concrete can satisfy a type the caller has not chosen yet.
|
|
340
|
+
return new ContextRPCView(serviceRPC, depth);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* The per-invocation `wire.rpc`.
|
|
345
|
+
*
|
|
346
|
+
* A class rather than an object literal because `agent` has to stay lazy — most
|
|
347
|
+
* requests never touch it — and an accessor declared on an object literal is
|
|
348
|
+
* defined per instance, which drops the literal off V8's fast construction
|
|
349
|
+
* path. Measured at ~1.15µs per request as a literal against ~0.47µs here, on
|
|
350
|
+
* the hot path every request takes.
|
|
351
|
+
*
|
|
352
|
+
* knowledge: decisions/internals/the-per-invocation-rpc-view-is-a-class.md
|
|
353
|
+
*/
|
|
354
|
+
class ContextRPCView {
|
|
355
|
+
serviceRPC;
|
|
356
|
+
depth;
|
|
357
|
+
global = false;
|
|
358
|
+
invoke;
|
|
359
|
+
remote;
|
|
360
|
+
exposed;
|
|
361
|
+
startWorkflow;
|
|
362
|
+
rpcWithWire;
|
|
363
|
+
constructor(serviceRPC, depth) {
|
|
364
|
+
this.serviceRPC = serviceRPC;
|
|
365
|
+
this.depth = depth;
|
|
366
|
+
this.invoke = serviceRPC.rpc.bind(serviceRPC);
|
|
367
|
+
this.remote = serviceRPC.remote.bind(serviceRPC);
|
|
368
|
+
this.exposed = serviceRPC.rpcExposed.bind(serviceRPC);
|
|
369
|
+
this.startWorkflow = serviceRPC.startWorkflow.bind(serviceRPC);
|
|
370
|
+
this.rpcWithWire = serviceRPC.rpcWithWire.bind(serviceRPC);
|
|
371
|
+
}
|
|
372
|
+
get agent() {
|
|
373
|
+
return this.serviceRPC.agent;
|
|
405
374
|
}
|
|
406
375
|
}
|
|
407
376
|
export const rpcService = new PikkuRPCService();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PikkuRawWire } from '../../types/core.types.js';
|
|
1
2
|
import type { AgentInterruptResult } from '../ai-agent/ai-agent-interrupt.js';
|
|
2
3
|
export type PikkuRPC<Invoke extends (...args: any[]) => any = (...args: any[]) => any, Remote extends (...args: any[]) => any = (...args: any[]) => any, startWorkflow extends (...args: any[]) => any = (...args: any[]) => any, AgentRun extends (...args: any[]) => any = (...args: any[]) => any, AgentStream extends (...args: any[]) => any = (...args: any[]) => any> = {
|
|
3
4
|
depth: number;
|
|
@@ -5,6 +6,8 @@ export type PikkuRPC<Invoke extends (...args: any[]) => any = (...args: any[]) =
|
|
|
5
6
|
invoke: Invoke;
|
|
6
7
|
remote: Remote;
|
|
7
8
|
exposed: (name: string, data: any) => Promise<any>;
|
|
9
|
+
/** Invoke an RPC with explicit wire fields merged over the caller's. */
|
|
10
|
+
rpcWithWire: <In = any, Out = any>(rpcName: string, data: In, wire: PikkuRawWire) => Promise<Out>;
|
|
8
11
|
startWorkflow: startWorkflow;
|
|
9
12
|
agent: {
|
|
10
13
|
run: AgentRun;
|
|
@@ -45,6 +48,10 @@ export interface ResolvedFunction {
|
|
|
45
48
|
secretOverrides?: Record<string, string>;
|
|
46
49
|
variableOverrides?: Record<string, string>;
|
|
47
50
|
credentialOverrides?: Record<string, string>;
|
|
51
|
+
/** Set by the consuming app: hand this instance the unscoped `SecretService` */
|
|
52
|
+
globalSecrets?: string;
|
|
53
|
+
/** Set by the consuming app: hand this instance the unscoped `CredentialService` */
|
|
54
|
+
globalCredentials?: string;
|
|
48
55
|
/** Set by `wireRemoteAddon`: dispatch this namespace's RPCs over HTTP */
|
|
49
56
|
remote?: boolean;
|
|
50
57
|
serverUrl?: string | ((services: any) => string | Promise<string>);
|
|
@@ -11,6 +11,19 @@ export type WireAddonConfig = {
|
|
|
11
11
|
secretOverrides?: Record<string, string>;
|
|
12
12
|
variableOverrides?: Record<string, string>;
|
|
13
13
|
credentialOverrides?: Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* Hands this instance the whole `SecretService` instead of one scoped to the
|
|
16
|
+
* secrets it declared. The value is the reason, recorded in the deploy
|
|
17
|
+
* manifest — an addon that names secrets at runtime cannot be scoped, and
|
|
18
|
+
* only the consuming app, never the addon, can grant it.
|
|
19
|
+
*/
|
|
20
|
+
globalSecrets?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Hands this instance the whole `CredentialService` instead of one narrowed
|
|
23
|
+
* to the credentials it declared. The value is the reason, recorded in the
|
|
24
|
+
* deploy manifest, and only the consuming app can grant it.
|
|
25
|
+
*/
|
|
26
|
+
globalCredentials?: string;
|
|
14
27
|
};
|
|
15
28
|
export declare const wireAddon: (config: WireAddonConfig) => void;
|
|
16
29
|
/**
|
|
@@ -16,6 +16,10 @@ export const wireAddon = (config) => {
|
|
|
16
16
|
...(config.credentialOverrides
|
|
17
17
|
? { credentialOverrides: config.credentialOverrides }
|
|
18
18
|
: {}),
|
|
19
|
+
...(config.globalSecrets ? { globalSecrets: config.globalSecrets } : {}),
|
|
20
|
+
...(config.globalCredentials
|
|
21
|
+
? { globalCredentials: config.globalCredentials }
|
|
22
|
+
: {}),
|
|
19
23
|
});
|
|
20
24
|
};
|
|
21
25
|
/**
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { runScheduledTask, wireScheduler, getScheduledTasks, } from './scheduler-runner.js';
|
|
2
2
|
export { logSchedulers } from './log-schedulers.js';
|
|
3
|
-
export type { CoreScheduledTask, ScheduledTasksMeta,
|
|
3
|
+
export type { CoreScheduledTask, ScheduledTasksMeta, } from './scheduler.types.js';
|
|
@@ -34,8 +34,8 @@ export function validateAndBuildSecretDefinitionsMeta(definitions, schemaLookup)
|
|
|
34
34
|
schema: def.schema,
|
|
35
35
|
oauth2: def.oauth2,
|
|
36
36
|
rotationPeriod: def.rotationPeriod,
|
|
37
|
-
docsUrl: def.docsUrl,
|
|
38
37
|
allowedHosts: def.allowedHosts,
|
|
38
|
+
docsUrl: def.docsUrl,
|
|
39
39
|
sourceFile: def.sourceFile,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
@@ -51,8 +51,8 @@ export function validateAndBuildSecretDefinitionsMeta(definitions, schemaLookup)
|
|
|
51
51
|
schema: def.schema,
|
|
52
52
|
oauth2: def.oauth2,
|
|
53
53
|
rotationPeriod: def.rotationPeriod,
|
|
54
|
-
docsUrl: def.docsUrl,
|
|
55
54
|
allowedHosts: def.allowedHosts,
|
|
55
|
+
docsUrl: def.docsUrl,
|
|
56
56
|
sourceFile: def.sourceFile,
|
|
57
57
|
};
|
|
58
58
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { wireTrigger, wireTriggerSource } from './trigger-runner.js';
|
|
2
2
|
export { PikkuTriggerService } from './pikku-trigger-service.js';
|
|
3
|
-
export type { TriggerMeta, TriggerSourceMeta, CorePikkuTriggerFunction, CorePikkuTriggerFunctionConfig, CoreTrigger,
|
|
3
|
+
export type { TriggerMeta, TriggerSourceMeta, CorePikkuTriggerFunction, CorePikkuTriggerFunctionConfig, CoreTrigger, } from './trigger.types.js';
|
|
@@ -5,10 +5,6 @@ export type TriggerTarget = {
|
|
|
5
5
|
targetName: string;
|
|
6
6
|
startNode?: string;
|
|
7
7
|
};
|
|
8
|
-
export type TriggerSourceInfo = {
|
|
9
|
-
name: string;
|
|
10
|
-
input: unknown;
|
|
11
|
-
};
|
|
12
8
|
export declare abstract class PikkuTriggerService implements TriggerService {
|
|
13
9
|
protected activeTriggers: Map<string, TriggerInstance>;
|
|
14
10
|
abstract start(): Promise<void>;
|
|
@@ -24,6 +24,7 @@ export const wireTriggerSource = (source) => {
|
|
|
24
24
|
if (triggerSources.has(source.name)) {
|
|
25
25
|
throw new Error(`Trigger source already exists: ${source.name}`);
|
|
26
26
|
}
|
|
27
|
+
// knowledge: decisions/internals/wiring-registries-erase-the-generics-their-wire-functions-capture.md
|
|
27
28
|
triggerSources.set(source.name, source);
|
|
28
29
|
addFunction(triggerSourceMeta.pikkuFuncId, source.func, triggerSourceMeta.packageName);
|
|
29
30
|
};
|