@pikku/core 0.12.80 → 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 +312 -0
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/function/function-runner.js +2 -5
- package/dist/function/index.d.ts +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +3 -3
- package/dist/pikku-state.js +4 -0
- package/dist/services/ai-agent-runner-service.d.ts +7 -0
- package/dist/services/ai-run-state-service.d.ts +10 -0
- package/dist/services/in-memory-ai-run-state-service.d.ts +5 -1
- package/dist/services/in-memory-ai-run-state-service.js +9 -0
- package/dist/services/index.d.ts +15 -15
- package/dist/services/index.js +5 -5
- package/dist/services/scoped-credential-service.d.ts +21 -0
- package/dist/services/scoped-credential-service.js +53 -0
- package/dist/testing/service-tests/ai-storage-service-tests.js +76 -0
- package/dist/types/core.types.d.ts +0 -2
- package/dist/types/state.types.d.ts +13 -0
- package/dist/wirings/actor-flow/index.d.ts +1 -1
- 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 +34 -17
- 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 +2 -0
- package/dist/wirings/ai-agent/ai-agent-runner.js +61 -40
- package/dist/wirings/ai-agent/ai-agent-stream.js +89 -36
- package/dist/wirings/ai-agent/ai-agent-turn.d.ts +1 -0
- package/dist/wirings/ai-agent/ai-agent-turn.js +1 -0
- package/dist/wirings/ai-agent/ai-agent.types.d.ts +46 -1
- package/dist/wirings/ai-agent/index.d.ts +8 -7
- package/dist/wirings/ai-agent/index.js +5 -4
- 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/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/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 +13 -1
- package/dist/wirings/credential/index.d.ts +1 -1
- package/dist/wirings/gateway/index.d.ts +1 -1
- package/dist/wirings/http/http-runner.js +8 -2
- package/dist/wirings/http/index.d.ts +1 -2
- package/dist/wirings/mcp/index.d.ts +1 -1
- package/dist/wirings/mcp/mcp-runner.d.ts +15 -0
- package/dist/wirings/mcp/mcp-runner.js +18 -5
- 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.js +2 -0
- package/dist/wirings/rpc/rpc-types.d.ts +4 -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/trigger/index.d.ts +1 -1
- package/dist/wirings/virtual-user/index.d.ts +5 -6
- package/dist/wirings/virtual-user/index.js +2 -4
- package/dist/wirings/workflow/dsl/workflow-dsl.types.d.ts +85 -15
- package/dist/wirings/workflow/index.d.ts +6 -6
- package/dist/wirings/workflow/index.js +2 -2
- package/dist/wirings/workflow/pikku-scenario-service.d.ts +7 -7
- package/dist/wirings/workflow/pikku-scenario-service.js +39 -13
- package/dist/wirings/workflow/pikku-workflow-service.js +17 -3
- 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 +29 -1
- package/dist/wirings/workflow/workflow-approval.js +65 -2
- package/dist/wirings/workflow/workflow-run-ownership.d.ts +2 -1
- package/dist/wirings/workflow/workflow-run-ownership.js +2 -1
- package/dist/wirings/workflow/workflow.types.d.ts +1 -1
- package/knowledge/decisions/internals/addon-pikku-meta-ships-at-the-package-root-or-under-dist.md +32 -0
- package/knowledge/decisions/internals/an-addon-scope-root-loses-to-a-root-the-host-already-declares.md +39 -0
- package/knowledge/decisions/internals/index.md +30 -3
- package/knowledge/decisions/internals/validate-runs-checks-by-precondition.md +115 -0
- package/knowledge/decisions/security/a-function-never-receives-the-secret-service.md +37 -0
- package/knowledge/decisions/security/a-workflow-run-is-read-and-approved-by-its-owner.md +30 -14
- package/knowledge/decisions/security/an-approval-answer-outlives-the-run-it-answered.md +59 -0
- package/knowledge/decisions/security/index.md +3 -1
- package/knowledge/questions/index.md +1 -1
- package/package.json +3 -1
- package/scripts/generate-api-report.mts +143 -18
- package/src/api-report.test.ts +2 -2
- package/src/errors/index.ts +1 -1
- package/src/function/function-runner.test.ts +52 -0
- package/src/function/function-runner.ts +5 -9
- package/src/function/index.ts +0 -2
- package/src/index.ts +0 -35
- package/src/pikku-state.ts +5 -0
- package/src/public-surface.json +70 -94
- package/src/services/ai-agent-runner-service.ts +12 -1
- package/src/services/ai-run-state-service.ts +11 -0
- package/src/services/in-memory-ai-run-state-service.ts +13 -0
- package/src/services/index.ts +3 -43
- package/src/services/scoped-credential-service.test.ts +86 -0
- package/src/services/scoped-credential-service.ts +63 -0
- package/src/testing/service-tests/ai-storage-service-tests.ts +93 -0
- package/src/types/core.types.ts +3 -6
- package/src/types/state.types.ts +16 -0
- package/src/wirings/actor-flow/index.ts +0 -3
- 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.ts +1 -0
- package/src/wirings/ai-agent/ai-agent-memory.ts +54 -38
- 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 +2 -0
- package/src/wirings/ai-agent/ai-agent-runner.ts +71 -40
- package/src/wirings/ai-agent/ai-agent-stream-output-hooks.test.ts +353 -0
- package/src/wirings/ai-agent/ai-agent-stream.ts +116 -54
- package/src/wirings/ai-agent/ai-agent-turn.test.ts +67 -0
- package/src/wirings/ai-agent/ai-agent-turn.ts +1 -0
- package/src/wirings/ai-agent/ai-agent.types.ts +64 -4
- package/src/wirings/ai-agent/index.ts +2 -16
- 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/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 +8 -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/index.ts +0 -7
- package/src/wirings/cli/cli-runner.test.ts +68 -0
- package/src/wirings/cli/cli-runner.ts +18 -1
- package/src/wirings/credential/index.ts +0 -1
- package/src/wirings/gateway/index.ts +0 -3
- package/src/wirings/http/http-runner.test.ts +66 -0
- package/src/wirings/http/http-runner.ts +10 -2
- package/src/wirings/http/index.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 +35 -5
- package/src/wirings/persona/index.ts +0 -8
- package/src/wirings/queue/index.ts +0 -14
- 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 +2 -0
- package/src/wirings/rpc/rpc-types.ts +4 -0
- package/src/wirings/rpc/wire-addon.ts +17 -0
- package/src/wirings/scheduler/index.ts +0 -1
- package/src/wirings/trigger/index.ts +0 -1
- package/src/wirings/virtual-user/index.ts +0 -16
- package/src/wirings/workflow/dsl/workflow-dsl.types.ts +96 -16
- package/src/wirings/workflow/graph/graph-runner.test.ts +72 -0
- package/src/wirings/workflow/index.ts +2 -20
- package/src/wirings/workflow/pikku-scenario-service.ts +60 -15
- package/src/wirings/workflow/pikku-workflow-service.test.ts +13 -12
- package/src/wirings/workflow/pikku-workflow-service.ts +28 -4
- package/src/wirings/workflow/scenario-expectations.test.ts +75 -0
- package/src/wirings/workflow/scenario-hooks.test.ts +3 -2
- 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 +113 -9
- package/src/wirings/workflow/workflow-run-authority.test.ts +12 -15
- package/src/wirings/workflow/workflow-run-ownership.ts +2 -1
- package/src/wirings/workflow/workflow.types.ts +0 -9
- package/src/wirings-stay-decoupled.test.ts +6 -2
- 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/services/user-flow-actors-service.js +0 -1
- 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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,315 @@
|
|
|
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
|
+
|
|
1
313
|
## 0.12.80
|
|
2
314
|
|
|
3
315
|
### Patch Changes
|
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';
|
|
@@ -84,7 +84,6 @@ export const runPikkuFunc = async (wireType, wireId, funcName, { singletonServic
|
|
|
84
84
|
throw new Error(`Function meta not found: ${funcName}`);
|
|
85
85
|
}
|
|
86
86
|
const resolvedFunctionId = funcMeta.pikkuFuncId ?? funcName;
|
|
87
|
-
const keepsSecrets = funcMeta.secretBroker === true;
|
|
88
87
|
const resolvedSingletonServices = packageName
|
|
89
88
|
? await getOrCreatePackageSingletonServices(packageName, singletonServices, addonInstance)
|
|
90
89
|
: singletonServices;
|
|
@@ -201,9 +200,7 @@ export const runPikkuFunc = async (wireType, wireId, funcName, { singletonServic
|
|
|
201
200
|
}
|
|
202
201
|
await runPermissions({
|
|
203
202
|
funcPermissions: funcConfig.permissions,
|
|
204
|
-
services:
|
|
205
|
-
? resolvedSingletonServices
|
|
206
|
-
: withoutSecrets(resolvedSingletonServices, 'a permission'),
|
|
203
|
+
services: withoutSecrets(resolvedSingletonServices, 'a permission'),
|
|
207
204
|
// knowledge: decisions/security/a-permission-gets-a-wire-it-cannot-reply-on.md
|
|
208
205
|
wire: invocationWire,
|
|
209
206
|
data: actualData,
|
|
@@ -237,7 +234,7 @@ export const runPikkuFunc = async (wireType, wireId, funcName, { singletonServic
|
|
|
237
234
|
configurable: true,
|
|
238
235
|
enumerable: true,
|
|
239
236
|
});
|
|
240
|
-
return await funcConfig.func(
|
|
237
|
+
return await funcConfig.func(withoutSecrets(services, 'a pikku function'), actualData, invocationWire);
|
|
241
238
|
}
|
|
242
239
|
finally {
|
|
243
240
|
// Flush the runner-installed audit buffer before wire services close.
|
package/dist/function/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { addFunction, getAllFunctionNames } from './function-runner.js';
|
|
2
2
|
export { pikkuAuth, pikkuPermission, pikkuPermissionFactory, pikkuApprovalDescription, } from './functions.types.js';
|
|
3
3
|
export type { CorePikkuFunction, CorePikkuFunctionSessionless, CorePikkuFunctionConfig, CorePikkuSessionlessFunctionConfig, CorePikkuAuth, CorePikkuAuthConfig, CorePikkuPermission, } from './functions.types.js';
|
|
4
|
-
export type { ListInput, ListOutput, Filter,
|
|
4
|
+
export type { ListInput, ListOutput, Filter, } from './list.types.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @pikku/core
|
|
3
3
|
*/
|
|
4
|
-
export type { AuthInstance, CommonWireMeta, CoreConfig, CorePikkuMiddleware, CorePikkuMiddlewareConfig, CorePikkuMiddlewareFactory, CorePikkuMiddlewareGroup, CoreServices, CoreSecretlessSingletonServices, CoreSingletonServices, CoreUserSession, SecretlessServices, CreateConfig, ServerLifecycle, FunctionMeta,
|
|
4
|
+
export type { AuthInstance, CommonWireMeta, CoreConfig, CorePikkuMiddleware, CorePikkuMiddlewareConfig, CorePikkuMiddlewareFactory, CorePikkuMiddlewareGroup, CoreServices, CoreSecretlessSingletonServices, CoreSingletonServices, CoreUserSession, SecretlessServices, CreateConfig, ServerLifecycle, FunctionMeta, FunctionServicesMeta, FunctionWiresMeta, FunctionsMeta, FunctionsRuntimeMeta, JSONValue, MakeRequired, MiddlewareMetadata, MiddlewarePriority, PermissionMetadata, PickOptional, PickRequired, PikkuAIMiddlewareHooks, PikkuWire, PikkuRawWire, PikkuWiringTypes, PostgresConfig, RequireAtLeastOne, SecurityAuditIssue, SecurityAuditReport, SecurityAuditSummary, SecurityAuditUpdate, SecuritySeverity, SecurityUpdateLevel, SerializedError, } from './types/core.types.js';
|
|
5
5
|
export { pikkuAIMiddleware, pikkuChannelMiddleware, pikkuChannelMiddlewareFactory, pikkuMiddleware, pikkuMiddlewareFactory, } from './types/core.types.js';
|
|
6
|
-
export type { CorePikkuAuth, CorePikkuAuthConfig, CorePikkuFunction, CorePikkuFunctionConfig,
|
|
6
|
+
export type { CorePikkuAuth, CorePikkuAuthConfig, CorePikkuFunction, CorePikkuFunctionConfig, CorePikkuPermission, CorePikkuPermissionConfig, CorePikkuPermissionFactory, CorePikkuApprovalDescription, CorePermissionGroup, } from './function/functions.types.js';
|
|
7
7
|
export { pikkuAuth, pikkuPermission, pikkuPermissionFactory, pikkuApprovalDescription, } from './function/functions.types.js';
|
|
8
8
|
export { getAllFunctionNames } from './function/index.js';
|
|
9
|
-
export type { ListInput, ListOutput, Filter,
|
|
9
|
+
export type { ListInput, ListOutput, Filter, } from './function/list.types.js';
|
|
10
10
|
export { pikkuCLIRender } from './wirings/cli/cli-runner.js';
|
|
11
11
|
export { PikkuRequest } from './pikku-request.js';
|
|
12
12
|
export { getRelativeTimeOffsetFromNow, parseDurationString, } from './time-utils.js';
|
|
13
13
|
export type { RelativeTimeInput } from './time-utils.js';
|
|
14
14
|
export { formatVersionedId, isVersionedId, parseVersionedId, } from './version.js';
|
|
15
|
-
export { AbandonedError,
|
|
15
|
+
export { AbandonedError, type AbortScope, } from './function/abort-scope.js';
|
|
16
16
|
export { fetch } from './wirings/http/http-runner.js';
|
|
17
17
|
export type { MCPToolResponse, MCPResourceResponse, MCPPromptResponse, } from './wirings/mcp/mcp.types.js';
|
|
18
18
|
export { AIProviderAuthError, AIProviderNotConfiguredError, BadGatewayError, BadRequestError, ConflictError, ExpectationFailedError, ForbiddenError, GatewayTimeoutError, GoneError, HTTPVersionNotSupportedError, InternalServerError, InvalidMiddlewareWireError, InvalidOriginError, InvalidSessionError, LengthRequiredError, LocalEnvironmentOnlyError, LockedError, MaxComputeTimeReachedError, MethodNotAllowedError, MissingCredentialError, MissingSchemaError, MissingScopeError, MissingServiceError, MissingSessionError, NotAcceptableError, NotFoundError, NotImplementedError, PayloadTooLargeError, PaymentRequiredError, PikkuMissingMetaError, PreconditionFailedError, ProxyAuthenticationRequiredError, RangeNotSatisfiableError, ReadonlySessionError, RequestTimeoutError, ServiceUnavailableError, TooManyRequestsError, URITooLongError, UnauthorizedError, UnprocessableContentError, UnsupportedMediaTypeError, } from './errors/errors.js';
|
|
@@ -20,7 +20,7 @@ export { PikkuError, isExpectedError } from './errors/error-handler.js';
|
|
|
20
20
|
export type { EventHubService } from './wirings/channel/eventhub-service.js';
|
|
21
21
|
export type { QueueService } from './wirings/queue/queue.types.js';
|
|
22
22
|
export type { JWTService } from './services/jwt-service.js';
|
|
23
|
-
export type { EmailService,
|
|
23
|
+
export type { EmailService, SendEmailInput, SendEmailResult, SendHTMLEmailInput, SendTemplateEmailInput, SendTextEmailInput, } from './services/email-service.js';
|
|
24
24
|
export type { SecretService } from './services/secret-service.js';
|
|
25
25
|
export { SecretAccessDeniedError, withoutSecrets, } from './services/secretless.js';
|
|
26
26
|
export { SecretHostNotAllowedError, assertSecretAllowedForHost, } from './services/secret-host-binding.js';
|
|
@@ -32,13 +32,13 @@ export type { GatewayService } from './services/gateway-service.js';
|
|
|
32
32
|
export type { TriggerService } from './services/trigger-service.js';
|
|
33
33
|
export type { SchemaService } from './services/schema-service.js';
|
|
34
34
|
export type { SessionService } from './services/user-session-service.js';
|
|
35
|
-
export { NoopAuditService, createInvocationAudit,
|
|
36
|
-
export type { AuditConfig, AuditDurability, AuditEvent, AuditEventBatch, AuditFacets, AuditLog,
|
|
37
|
-
export type { AIAgentRunnerService,
|
|
35
|
+
export { NoopAuditService, createInvocationAudit, } from './services/audit-service.js';
|
|
36
|
+
export type { AuditConfig, AuditDurability, AuditEvent, AuditEventBatch, AuditFacets, AuditLog, AuditQuery, AuditQueryResult, AuditService, AuditUserIdentity, ResolvedAuditConfig, } from './services/audit-service.js';
|
|
37
|
+
export type { AIAgentRunnerService, } from './services/ai-agent-runner-service.js';
|
|
38
38
|
export type { AIEmbeddingService } from './services/ai-embedding-service.js';
|
|
39
39
|
export type { AIRunStateService } from './services/ai-run-state-service.js';
|
|
40
40
|
export type { AIStorageService } from './services/ai-storage-service.js';
|
|
41
|
-
export type { EmailsMeta, EmailTemplateMeta,
|
|
41
|
+
export type { EmailsMeta, EmailTemplateMeta, MetaService, } from './services/meta-service.js';
|
|
42
42
|
export type { HTTPMethod } from './wirings/http/http.types.js';
|
|
43
43
|
export type { GraphNodeConfig } from './wirings/workflow/graph/workflow-graph.types.js';
|
|
44
44
|
export { createGraph } from './wirings/workflow/graph/graph-node.js';
|
|
@@ -54,7 +54,7 @@ export { isSerializable, stopSingletonServices, pikkuServerLifecycle, } from './
|
|
|
54
54
|
export { clearPikkuRuntimeState } from './test-utils.js';
|
|
55
55
|
export { type ScheduledTaskInfo, type ScheduledTaskSummary, } from './services/scheduler-service.js';
|
|
56
56
|
export { SchedulerService } from './services/scheduler-service.js';
|
|
57
|
-
export type { Private, Pii, Secret, Classification, AnonymizeStrategy,
|
|
58
|
-
export { hashToken,
|
|
57
|
+
export type { Private, Pii, Secret, Classification, AnonymizeStrategy, ClassificationManifest, ColumnForm, WrappedValue, SealedValue, HashedValue, } from './data-classification.js';
|
|
58
|
+
export { hashToken, } from './column-form.js';
|
|
59
59
|
export type { SecretValue, Safe } from './secret-value.js';
|
|
60
60
|
export { createSecretValue, isSecretValue, SecretCoercionError, REDACTED, } from './secret-value.js';
|
package/dist/index.js
CHANGED
|
@@ -5,13 +5,13 @@ export { pikkuCLIRender } from './wirings/cli/cli-runner.js';
|
|
|
5
5
|
export { PikkuRequest } from './pikku-request.js';
|
|
6
6
|
export { getRelativeTimeOffsetFromNow, parseDurationString, } from './time-utils.js';
|
|
7
7
|
export { formatVersionedId, isVersionedId, parseVersionedId, } from './version.js';
|
|
8
|
-
export { AbandonedError,
|
|
8
|
+
export { AbandonedError, } from './function/abort-scope.js';
|
|
9
9
|
export { fetch } from './wirings/http/http-runner.js';
|
|
10
10
|
export { AIProviderAuthError, AIProviderNotConfiguredError, BadGatewayError, BadRequestError, ConflictError, ExpectationFailedError, ForbiddenError, GatewayTimeoutError, GoneError, HTTPVersionNotSupportedError, InternalServerError, InvalidMiddlewareWireError, InvalidOriginError, InvalidSessionError, LengthRequiredError, LocalEnvironmentOnlyError, LockedError, MaxComputeTimeReachedError, MethodNotAllowedError, MissingCredentialError, MissingSchemaError, MissingScopeError, MissingServiceError, MissingSessionError, NotAcceptableError, NotFoundError, NotImplementedError, PayloadTooLargeError, PaymentRequiredError, PikkuMissingMetaError, PreconditionFailedError, ProxyAuthenticationRequiredError, RangeNotSatisfiableError, ReadonlySessionError, RequestTimeoutError, ServiceUnavailableError, TooManyRequestsError, URITooLongError, UnauthorizedError, UnprocessableContentError, UnsupportedMediaTypeError, } from './errors/errors.js';
|
|
11
11
|
export { PikkuError, isExpectedError } from './errors/error-handler.js';
|
|
12
12
|
export { SecretAccessDeniedError, withoutSecrets, } from './services/secretless.js';
|
|
13
13
|
export { SecretHostNotAllowedError, assertSecretAllowedForHost, } from './services/secret-host-binding.js';
|
|
14
|
-
export { NoopAuditService, createInvocationAudit,
|
|
14
|
+
export { NoopAuditService, createInvocationAudit, } from './services/audit-service.js';
|
|
15
15
|
export { createGraph } from './wirings/workflow/graph/graph-node.js';
|
|
16
16
|
export { wireAddon } from './wirings/rpc/wire-addon.js';
|
|
17
17
|
export { wireRemoteAddon } from './wirings/rpc/wire-remote-addon.js';
|
|
@@ -21,5 +21,5 @@ export { hasScopes, verifyScopes } from './scopes.js';
|
|
|
21
21
|
export { isSerializable, stopSingletonServices, pikkuServerLifecycle, } from './utils.js';
|
|
22
22
|
export { clearPikkuRuntimeState } from './test-utils.js';
|
|
23
23
|
export { SchedulerService } from './services/scheduler-service.js';
|
|
24
|
-
export { hashToken,
|
|
24
|
+
export { hashToken, } from './column-form.js';
|
|
25
25
|
export { createSecretValue, isSecretValue, SecretCoercionError, REDACTED, } from './secret-value.js';
|
package/dist/pikku-state.js
CHANGED
|
@@ -84,6 +84,9 @@ const createEmptyPackageState = () => ({
|
|
|
84
84
|
agent: {
|
|
85
85
|
agents: new Map(),
|
|
86
86
|
agentsMeta: {},
|
|
87
|
+
scorers: new Map(),
|
|
88
|
+
scorersMeta: {},
|
|
89
|
+
modelAliases: {},
|
|
87
90
|
},
|
|
88
91
|
gateway: {
|
|
89
92
|
gateways: new Map(),
|
|
@@ -117,6 +120,7 @@ const createEmptyPackageState = () => ({
|
|
|
117
120
|
authFactory: null,
|
|
118
121
|
credentialsMeta: null,
|
|
119
122
|
requiredParentServices: null,
|
|
123
|
+
declaredSecrets: null,
|
|
120
124
|
},
|
|
121
125
|
});
|
|
122
126
|
export const initializePikkuState = (packageName) => {
|
|
@@ -54,6 +54,13 @@ export type AIAgentStepResult = {
|
|
|
54
54
|
toolCallId: string;
|
|
55
55
|
toolName: string;
|
|
56
56
|
result: unknown;
|
|
57
|
+
/**
|
|
58
|
+
* Set when the tool threw rather than returned. Carried as its own field
|
|
59
|
+
* because `result` is a rendered string by the time anything downstream
|
|
60
|
+
* reads it, and "did this tool fail" is not answerable by looking for an
|
|
61
|
+
* `Error:` prefix in text a tool could legitimately have returned.
|
|
62
|
+
*/
|
|
63
|
+
error?: string;
|
|
57
64
|
}[];
|
|
58
65
|
usage: {
|
|
59
66
|
inputTokens: number;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { AgentRunState, PendingApproval } from '../wirings/ai-agent/ai-agent.types.js';
|
|
2
|
+
import type { AIRunScore } from '../wirings/ai-scorer/ai-scorer.types.js';
|
|
2
3
|
export type CreateRunInput = Omit<AgentRunState, 'runId'>;
|
|
4
|
+
export type SaveScoreInput = Omit<AIRunScore, 'createdAt'>;
|
|
3
5
|
export interface AIRunStateService {
|
|
4
6
|
createRun(run: CreateRunInput): Promise<string>;
|
|
5
7
|
updateRun(runId: string, updates: Partial<AgentRunState>): Promise<void>;
|
|
@@ -16,4 +18,12 @@ export interface AIRunStateService {
|
|
|
16
18
|
run: AgentRunState;
|
|
17
19
|
approval: PendingApproval;
|
|
18
20
|
} | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Record one scorer's grade of a finished run. A run accumulates one row per
|
|
23
|
+
* scorer, and a scorer may grade the same run more than once — a retried job
|
|
24
|
+
* appends rather than replaces, so a re-grade never silently overwrites the
|
|
25
|
+
* grade that was acted on.
|
|
26
|
+
*/
|
|
27
|
+
saveScore(score: SaveScoreInput): Promise<void>;
|
|
28
|
+
getScores(runId: string): Promise<AIRunScore[]>;
|
|
19
29
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { AIRunStateService, CreateRunInput } from './ai-run-state-service.js';
|
|
1
|
+
import type { AIRunStateService, CreateRunInput, SaveScoreInput } from './ai-run-state-service.js';
|
|
2
2
|
import type { AgentRunState, PendingApproval } from '../wirings/ai-agent/ai-agent.types.js';
|
|
3
|
+
import type { AIRunScore } from '../wirings/ai-scorer/ai-scorer.types.js';
|
|
3
4
|
export declare class InMemoryAIRunStateService implements AIRunStateService {
|
|
4
5
|
private runs;
|
|
6
|
+
private scores;
|
|
5
7
|
private counter;
|
|
6
8
|
createRun(run: CreateRunInput): Promise<string>;
|
|
7
9
|
updateRun(runId: string, updates: Partial<AgentRunState>): Promise<void>;
|
|
@@ -12,4 +14,6 @@ export declare class InMemoryAIRunStateService implements AIRunStateService {
|
|
|
12
14
|
run: AgentRunState;
|
|
13
15
|
approval: PendingApproval;
|
|
14
16
|
} | null>;
|
|
17
|
+
saveScore(score: SaveScoreInput): Promise<void>;
|
|
18
|
+
getScores(runId: string): Promise<AIRunScore[]>;
|
|
15
19
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export class InMemoryAIRunStateService {
|
|
2
2
|
runs = new Map();
|
|
3
|
+
scores = new Map();
|
|
3
4
|
counter = 0;
|
|
4
5
|
async createRun(run) {
|
|
5
6
|
const runId = `run-${++this.counter}-${Date.now()}`;
|
|
@@ -42,4 +43,12 @@ export class InMemoryAIRunStateService {
|
|
|
42
43
|
}
|
|
43
44
|
return null;
|
|
44
45
|
}
|
|
46
|
+
async saveScore(score) {
|
|
47
|
+
const existing = this.scores.get(score.runId) ?? [];
|
|
48
|
+
existing.push({ ...score, createdAt: new Date() });
|
|
49
|
+
this.scores.set(score.runId, existing);
|
|
50
|
+
}
|
|
51
|
+
async getScores(runId) {
|
|
52
|
+
return [...(this.scores.get(runId) ?? [])];
|
|
53
|
+
}
|
|
45
54
|
}
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { LogLevel } from './logger.js';
|
|
2
2
|
export { ScopedSecretService } from './scoped-secret-service.js';
|
|
3
|
-
export {
|
|
3
|
+
export { ScopedCredentialService } from './scoped-credential-service.js';
|
|
4
|
+
export { PikkuSessionService, createMiddlewareSessionWireProps, } from './user-session-service.js';
|
|
4
5
|
export { TypedSecretService } from './typed-secret-service.js';
|
|
5
|
-
export { PikkuCredentialWireService,
|
|
6
|
+
export { PikkuCredentialWireService, } from './credential-wire-service.js';
|
|
6
7
|
export { TypedVariablesService } from './typed-variables-service.js';
|
|
7
8
|
export { LocalSecretService } from './local-secrets.js';
|
|
8
9
|
export { LocalEmailService } from './local-email-service.js';
|
|
@@ -16,11 +17,11 @@ export { InMemoryTriggerService } from './in-memory-trigger-service.js';
|
|
|
16
17
|
export { InMemoryAIRunStateService } from './in-memory-ai-run-state-service.js';
|
|
17
18
|
export { LocalGatewayService } from './local-gateway-service.js';
|
|
18
19
|
export type { ContentService, SignContentKeyArgs, SignURLArgs, GetUploadURLArgs, UploadURLResult, BucketKeyArgs, WriteFileArgs, CopyFileArgs, } from './content-service.js';
|
|
19
|
-
export type { ScenarioPersona, ResolvedPersona,
|
|
20
|
+
export type { ScenarioPersona, ResolvedPersona, ScenarioPersonas, ScenarioHttpResponse, } from './personas-service.js';
|
|
20
21
|
export type { HttpPersonasConfig } from './http-personas.js';
|
|
21
22
|
export type { JWTService } from './jwt-service.js';
|
|
22
|
-
export type { EmailService,
|
|
23
|
-
export { DEFAULT_WEBHOOK_RETRIES,
|
|
23
|
+
export type { EmailService, SendEmailInput, SendEmailResult, SendHTMLEmailInput, SendTemplateEmailInput, SendTextEmailInput, } from './email-service.js';
|
|
24
|
+
export { DEFAULT_WEBHOOK_RETRIES, PIKKU_OUTGOING_WEBHOOK_QUEUE_NAME, WebhookService, type SendWebhookInput, type SendWebhookResult, type WebhookAttemptResult, type WebhookDeliveryRecord, type WebhookDeliveryWithAttempts, type WebhookJobData, type WebhookServiceConfig, } from './webhook-service.js';
|
|
24
25
|
export type { Logger } from './logger.js';
|
|
25
26
|
export type { SecretService, SecretValues } from './secret-service.js';
|
|
26
27
|
export type { VariablesService } from './variables-service.js';
|
|
@@ -31,23 +32,22 @@ export type { TriggerService } from './trigger-service.js';
|
|
|
31
32
|
export type { GatewayService } from './gateway-service.js';
|
|
32
33
|
export type { DeploymentService, DeploymentConfig, DeploymentInfo, DeploymentServiceConfig, } from './deployment-service.js';
|
|
33
34
|
export type { AIStorageService } from './ai-storage-service.js';
|
|
34
|
-
export type { AIAgentRunnerParams, AIAgentRunnerResult, AIAgentStepResult,
|
|
35
|
+
export type { AIAgentRunnerParams, AIAgentRunnerResult, AIAgentStepResult, AIAgentRunnerService, } from './ai-agent-runner-service.js';
|
|
35
36
|
export type { AIEmbeddingService } from './ai-embedding-service.js';
|
|
36
|
-
export type { CreateRunInput, AIRunStateService, } from './ai-run-state-service.js';
|
|
37
|
-
export type {
|
|
37
|
+
export type { CreateRunInput, SaveScoreInput, AIRunStateService, } from './ai-run-state-service.js';
|
|
38
|
+
export type { CredentialMeta, } from './typed-secret-service.js';
|
|
38
39
|
export type { CredentialService } from './credential-service.js';
|
|
39
40
|
export { TypedCredentialService } from './typed-credential-service.js';
|
|
40
|
-
export type {
|
|
41
|
-
export type {
|
|
41
|
+
export type { CredentialMetaInfo, } from './typed-credential-service.js';
|
|
42
|
+
export type { VariableMeta } from './typed-variables-service.js';
|
|
42
43
|
export type { MetaService } from './meta-service.js';
|
|
43
44
|
export type { SessionStore } from './session-store.js';
|
|
44
45
|
export type { ScopeService, Role } from './scope-service.js';
|
|
45
|
-
export { assertRoleIsMutable, assertRoleNameAvailable, roleLockReason, } from './system-role-guard.js';
|
|
46
46
|
export type { IsSystemRole } from './system-role-guard.js';
|
|
47
|
-
export { NoopAuditService, createInvocationAudit,
|
|
48
|
-
export type { AuditConfig, AuditDurability, AuditEvent, AuditEventBatch, AuditLog,
|
|
47
|
+
export { NoopAuditService, createInvocationAudit, } from './audit-service.js';
|
|
48
|
+
export type { AuditConfig, AuditDurability, AuditEvent, AuditEventBatch, AuditLog, AuditService, AuditUserIdentity, ResolvedAuditConfig, } from './audit-service.js';
|
|
49
49
|
export { InMemorySessionStore } from './in-memory-session-store.js';
|
|
50
|
-
export type { MCPMeta, RPCMetaRecord, ServiceMeta, ServicesMetaRecord, MiddlewareDefinitionMeta, MiddlewareInstanceMeta, GroupMeta, MiddlewareGroupsMeta, PermissionDefinitionMeta, PermissionsGroupsMeta, FunctionsMeta, FunctionMeta, MiddlewareMeta, PermissionMeta, AgentsMeta, AgentMeta, EmailsMeta, EmailTemplateMeta,
|
|
51
|
-
export type { CoverageService,
|
|
50
|
+
export type { MCPMeta, RPCMetaRecord, ServiceMeta, ServicesMetaRecord, MiddlewareDefinitionMeta, MiddlewareInstanceMeta, GroupMeta, MiddlewareGroupsMeta, PermissionDefinitionMeta, PermissionsGroupsMeta, FunctionsMeta, FunctionMeta, MiddlewareMeta, PermissionMeta, AgentsMeta, AgentMeta, EmailsMeta, EmailTemplateMeta, } from './meta-service.js';
|
|
51
|
+
export type { CoverageService, ScriptCoverage, FunctionCoverageEntry, FunctionCoverageReport, CoverageFunctionMeta, } from './v8-coverage-service.js';
|
|
52
52
|
export { StubTracker, createStubProxy, getStubTracker, isTestRun, stub, spy, type StubCall, } from './stub-tracker.js';
|
|
53
53
|
export { SecretHostNotAllowedError, assertSecretAllowedForHost, } from './secret-host-binding.js';
|