@pikku/redis 0.12.23 → 0.12.24

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 DELETED
@@ -1,1088 +0,0 @@
1
- ## 0.12.23
2
-
3
- ### Patch Changes
4
-
5
- - a16b0ba: `RedisWorkflowService` and `MongoDBWorkflowService` now record a step's lease, so a step whose worker died is claimed again once the lease lapses, as it already was on Kysely. Both fence a step's result, error and lease renewal to the attempt that claimed it: a superseded worker's write throws `WorkflowStepSupersededError` and leaves the newer attempt's state alone. Redis does the check and the write in one Lua script. MongoDB now keeps the attempt number on the step document, advances it in the same guarded update that grants the lease, and tags every history document with the attempt it belongs to.
6
- - a16b0ba: The workflow run lease takes the app's `leaseService` (`holdLease(leaseService, 'workflow-run:<id>', …)`) in place of `pg_advisory_lock` / `GET_LOCK`, for DSL and graph runs alike. A message for a run already being orchestrated elsewhere wakes the run again a second later instead of failing, so a long pass never spends the retry budget the queue keeps for real failures. An inline run whose lease was lost after its body finished keeps the outcome it wrote. `PgWorkflowQueueOptions` and `RunLockHoldTimeoutError` are removed. `WorkflowService.withRunLock` is renamed `withRunLease`, since what it holds runs out unless renewed; a custom workflow service overriding it renames the method.
7
-
8
- Pass the lease service to the workflow service — `new PgKyselyWorkflowService(db, { leaseService })` — register the same instance as the app's `leaseService`, and migrate `pikku_lease`.
9
-
10
- A step lease is renewed by the same loop as the run lease. A graph node whose worker died is dispatched again once its lease lapses, instead of leaving the run waiting on it. A replayed step on Kysely now sees its lease, as `getStepState` does. The in-memory store refuses a superseded worker's outcome, as the database stores do. The MySQL workflow service can now record a workflow version; it used `ON CONFLICT`, which MySQL does not have.
11
-
12
- `pikku db generate` now writes the `pikku_lease` table for any project that runs workflows, not only one that reaches `leaseService`, since every persistent workflow service holds its runs and steps there.
13
-
14
- - a16b0ba: Persistent workflow services take a required `leaseService` (`WorkflowServiceOptions`) and lock runs and steps on it. The Postgres advisory and MySQL `GET_LOCK` step locks, and Redis's own `SET NX` run and step locks, are removed; `RedisWorkflowService` now takes `(connection, { leaseService, keyPrefix? })`.
15
- - Updated dependencies [a16b0ba]
16
- - Updated dependencies [21e9c3a]
17
- - Updated dependencies [a16b0ba]
18
- - Updated dependencies [a16b0ba]
19
- - @pikku/core@0.12.133
20
-
21
- ## 0.12.22
22
-
23
- ### Patch Changes
24
-
25
- - 942ebdd: Add `LeaseService`: named leases shared by every process on the same store. A lease is not a mutex: a holder that stalls past its expiry loses the key without knowing, so whatever the body writes to should check the lease's `token` and refuse an older one. `acquire` never blocks and answers `null` while someone else holds the key; a lease lapses on its own if its holder dies; and each lease carries a `token` that rises every time the key changes hands, so a stale holder cannot refresh or release its successor's lease. `holdLease` refreshes the lease while its body runs, hands the body an `AbortSignal` that fires the moment the lease is lost, and throws `LeaseLostError` once the body finishes if the lease lapsed or changed hands meanwhile, so a caller never takes that result as produced under the lease.
26
-
27
- Ships as `InMemoryLeaseService`, `PgKyselyLeaseService` (`@pikku/kysely-postgres`), `MySQLKyselyLeaseService` (`@pikku/kysely-mysql`) and `KyselyLeaseService` (SQLite), all on `pikku_lease`. The Postgres and MySQL services judge every lease by the database's clock, so a worker whose clock runs fast cannot take a live lease or stretch its own; `KyselyLeaseService` reads the process clock and is for a single-host SQLite app. `pikku db generate` writes the table for any project that reaches `leaseService`.
28
-
29
- `RedisLeaseService` (`@pikku/redis`) keeps each lease in a hash Redis expires itself, with every check-and-set in one Lua script that reads Redis's `TIME`, so it too judges leases by the server's clock; its token counter outlives release, so the next holder always gets a higher token.
30
-
31
- - Updated dependencies [d327fa5]
32
- - Updated dependencies [942ebdd]
33
- - Updated dependencies [8ac25a8]
34
- - Updated dependencies [6606777]
35
- - @pikku/core@0.12.132
36
-
37
- ## 0.12.21
38
-
39
- ### Patch Changes
40
-
41
- - 4c7a1b5: Run the monorepo's own scripts through bun instead of yarn. What moves is the
42
- package manager each package's `prepublishOnly` and build scripts invoke, plus
43
- the two manifest fixes bun needs to resolve the tree: `uWebSockets.js` is
44
- declared with an explicit `github:` specifier, and `@pikku/uws-handler` marks
45
- its `uWebSockets.js` peer optional so a bun install of a consumer that brings
46
- its own uWS app does not try to fetch it from the registry.
47
-
48
- Three published behaviours change, all of them cases where an isolated
49
- `node_modules` or bun as the runtime had been papered over by yarn's hoisting:
50
-
51
- - `@pikku/migrator-sql` turns foreign keys on when it opens a sqlite database
52
- through bun. `node:sqlite` enforces them by default and `bun:sqlite` does not,
53
- which silently turned every `ON DELETE CASCADE` into a no-op under
54
- `bunx --bun pikku`.
55
- - `@pikku/cli` resolves a deploy provider against the project being deployed
56
- rather than against wherever the CLI itself is installed, which is what its
57
- own "is not installed" error asks the user to arrange.
58
- - `@pikku/cli` treats a specifier a runtime hands straight back — bun does this
59
- for the modules it implements itself — as not resolved from the project, so
60
- it falls back rather than loading the runtime's own copy.
61
-
62
- - Updated dependencies [4c7a1b5]
63
- - @pikku/core@0.12.108
64
-
65
- ## 0.12.20
66
-
67
- ### Patch Changes
68
-
69
- - 4450b2a: Name the missing key when a secret is not found.
70
-
71
- Every `SecretService` threw a bare `Requested secret not found`. In a deployed
72
- runtime the stack is minified, so the message was the only evidence there was —
73
- and it identified neither the key nor the service. Each implementation now names
74
- the key it looked for; the better-auth middlewares that skip on an absent secret
75
- match the prefix through one shared predicate instead of the whole string.
76
-
77
- - Updated dependencies [4058c3a]
78
- - Updated dependencies [4058c3a]
79
- - Updated dependencies [4058c3a]
80
- - Updated dependencies [4058c3a]
81
- - Updated dependencies [4058c3a]
82
- - Updated dependencies [4058c3a]
83
- - Updated dependencies [114c079]
84
- - Updated dependencies [4450b2a]
85
- - Updated dependencies [4058c3a]
86
- - Updated dependencies [4058c3a]
87
- - @pikku/core@0.12.93
88
-
89
- ## 0.12.19
90
-
91
- ### Patch Changes
92
-
93
- - 266e3bc: One door per name: `@pikku/core/ecosystem/*` and the package root are gone
94
-
95
- `@pikku/core` published every module twice. `ecosystem/http` re-exported
96
- `./http`, `ecosystem/services` re-exported `./services`, and a name was
97
- reachable through either — so every addition had to be made in two places, and a
98
- consumer's import said nothing about what it actually used. The package root was
99
- the same problem at a larger scale: a single barrel of 206 names that no bundler
100
- could take apart, and the one specifier that revealed nothing at all.
101
-
102
- Both are deleted. Every name now lives on the subpath that owns it, and every
103
- import carries that subpath — `@pikku/core/http`, `@pikku/core/services`,
104
- `@pikku/core/errors`, `@pikku/core/types`.
105
-
106
- Deleting the facades meant the raw subpaths had to become a superset of them,
107
- which they were not: the facade tree had accumulated 25 names with no raw home
108
- and about 26 more filed under a different area than the module they came from.
109
- Those names moved to the area that owns them, and three areas were published as
110
- new entry points rather than left on a root that is going away — `./types` (the
111
- shared type surface, the largest single destination), `./state` and
112
- `./classification`.
113
-
114
- `./classification` is one door onto one subject: what a value is and how it must
115
- be handled. Its three halves would each have been an entry point — the brands
116
- and manifest types, the stored-form helpers (`hashToken`, `unsafeAsSealed` and
117
- friends), and `SecretValue` — split by whether a name happens to be a type or a
118
- value, which is the same defect as the facades. The duration and versioned-id
119
- helpers went to `./utils`, which already published, and `PikkuRequest` went to
120
- `./function`: it is the transport-agnostic request base, not an HTTP one — HTTP
121
- has `PikkuHTTPAbstractRequest`, and the only thing outside core that extends
122
- `PikkuRequest` is Azure's timer request.
123
-
124
- `./types` inherited the root barrel's habit before it inherited its contents, so
125
- the names with an owner elsewhere were moved off it. The middleware types and the
126
- five middleware factories — `pikkuMiddleware`, `pikkuMiddlewareFactory`,
127
- `pikkuChannelMiddleware`, `pikkuChannelMiddlewareFactory` and
128
- `pikkuAgentMiddleware`, runtime values on a types entry point — are now
129
- `@pikku/core/middleware`; the function meta types are `@pikku/core/function`;
130
- `SerializedError` is `@pikku/core/errors`; and the generic TypeScript helpers
131
- (`MakeRequired`, `PickRequired`, `PickOptional`, `RequireAtLeastOne`,
132
- `JSONPrimitive`, `JSONValue`) are `@pikku/core/utils`. What is left on `./types`
133
- is the vocabulary the wirings share, which no single module owns.
134
-
135
- `pikku` was itself a root barrel — `export * from '@pikku/core'` — and
136
- now exports only the services it bundles.
137
-
138
- One module survives at the old specifier, and only for the bootstrap:
139
- `packages/cli` is generated by the _published_ CLI pinned in its `build.sh`, and
140
- that CLI still writes a bare `@pikku/core` into the files it generates for the
141
- CLI itself. `bootstrap-compat/root.ts` carries the eight types it names, a test
142
- in core fails if that list grows, and it goes when the pin moves to a CLI
143
- released from this branch. The adapter names the pinned CLI reaches for —
144
- `pikkuState` and `CreateWireServices` — are rewritten to `@pikku/core/state` and
145
- `@pikku/core/types` by the same `build.sh` patch pass, so no second shim is
146
- needed for them.
147
-
148
- A guard test keeps the root shut: it parses imports and rejects a bare
149
- `@pikku/core` rather than grepping for it, because several tests hold a user's
150
- file as a template literal, where `import … from '@pikku/core'` is fixture text
151
- rather than an import this repo makes.
152
-
153
- An agent scaffold a project generated under an older CLI is refreshed rather
154
- than left to fail: `pikku all` already deleted one importing an entry point
155
- `@pikku/core` no longer publishes, and the `#pikku` hub joins that list.
156
- Without it a project that scaffolds the agent endpoint but
157
- declares no agents keeps the old file forever — the generator that would rewrite
158
- it only runs when agents exist, and the file being present is what stops it
159
- being regenerated as missing.
160
-
161
- `pikku new addon` also wrote a tsconfig `paths` map naming only the deleted hub.
162
- An addon's `imports` map points into `dist`, so `paths` is what resolves
163
- `#pikku/<leaf>` for the addon's own source build — it now names the two leaf
164
- patterns, in both the addon and its test harness.
165
-
166
- - 786dae5: Bump every dependency whose latest release is a major across the monorepo, and
167
- port the code the majors broke: `cookie` 2's `parseCookie`/`stringifySetCookie`
168
- API in `@pikku/core` and the three runtime HTTP adapters, and assistant-ui 0.15's
169
- store client in `@pikku/assistant-ui`.
170
- - 6eef0a0: Bump every dependency to its latest compatible minor/patch across the monorepo.
171
- - Updated dependencies [7722ceb]
172
- - Updated dependencies [375c1ff]
173
- - Updated dependencies [02a70cd]
174
- - Updated dependencies [aeef159]
175
- - Updated dependencies [a281de6]
176
- - Updated dependencies [266e3bc]
177
- - Updated dependencies [02a70cd]
178
- - Updated dependencies [786dae5]
179
- - Updated dependencies [6eef0a0]
180
- - Updated dependencies [3561d67]
181
- - Updated dependencies [a91c433]
182
- - Updated dependencies [02a70cd]
183
- - Updated dependencies [9537f74]
184
- - Updated dependencies [2b57ca8]
185
- - Updated dependencies [266e3bc]
186
- - Updated dependencies [9fce0f1]
187
- - Updated dependencies [83683a0]
188
- - Updated dependencies [456c88b]
189
- - Updated dependencies [456c88b]
190
- - Updated dependencies [c127273]
191
- - @pikku/core@0.12.85
192
-
193
- ## 0.12.18
194
-
195
- ### Patch Changes
196
-
197
- - 7406bfe: Rename the agent runtime from `AI*` to `Agent*` (#596)
198
-
199
- `AI` described the model provider, not the thing being named. Every symbol that
200
- belongs to the agent runtime now says `Agent`; the symbols that genuinely wrap a
201
- model provider — `AIEmbeddingService`, `AIProviderOptions`, `AIEmbedParams`,
202
- `AITranscriptionParams`, `AIGenerateImageParams` and their siblings, and the
203
- `@pikku/ai-vercel` / `@pikku/ai-deepinfra` / `@pikku/ai-voice` packages — keep
204
- their names.
205
-
206
- **Wiring**
207
- - `pikkuAIAgent` → `pikkuAgent`, `pikkuAIScorer` → `pikkuAgentScorer`,
208
- `pikkuAIJudge` → `pikkuAgentJudge`
209
- - `CoreAIAgent` → `CoreAgent`, `AIAgentInput` → `AgentInput`, `AIAgentStep` →
210
- `AgentStep`, `AIMessage` → `AgentMessage`, and the rest of the agent types
211
- - `AIAgentRunnerService` → `AgentRunnerService`, `AIStorageService` →
212
- `AgentStorageService`, `AIRunStateService` → `AgentRunStateService`
213
-
214
- **Entry points**
215
-
216
- `@pikku/core/agent` → `@pikku/core/agent`, `@pikku/core/agent-scorer` →
217
- `@pikku/core/agent-scorer`.
218
-
219
- **Queues**
220
-
221
- The scorer queues are now `agent-score-fast` and `agent-score-slow`. Drain the
222
- old `ai-score-fast` / `ai-score-slow` queues before deploying — jobs still
223
- sitting on them when the new workers start will never be picked up.
224
-
225
- **Scaffolds**
226
-
227
- The agent scaffold pikku wrote for your project — `<scaffold>/agent/agent.gen.ts`
228
- and its schemas file — imports `@pikku/core/ai-agent`, which no longer exists. A
229
- scaffold is normally written once and then left alone, so `pikku all` would find
230
- it present and leave the broken import in place. It now deletes an agent scaffold
231
- importing either removed entry point and regenerates it in the same run. Anything
232
- you added to that file goes with it, so move local edits out first.
233
-
234
- **Database**
235
-
236
- The agent tables are renamed: `ai_threads`, `ai_message`, `ai_tool_call`,
237
- `ai_working_memory`, `ai_run` and `ai_run_score` become `agent_threads`,
238
- `agent_message`, `agent_tool_call`, `agent_working_memory`, `agent_run` and
239
- `agent_run_score`, along with their indexes and the `ai_working_memory_pk`
240
- constraint. The same rename applies to the MongoDB collections.
241
-
242
- `ensurePikkuSchema` creates tables it cannot find, so an existing database will
243
- get empty `agent_*` tables and leave the old data stranded in `ai_*`. Rename
244
- them before the first boot on the new version:
245
-
246
- ```sql
247
- ALTER TABLE ai_threads RENAME TO agent_threads;
248
- ALTER TABLE ai_message RENAME TO agent_message;
249
- ALTER TABLE ai_tool_call RENAME TO agent_tool_call;
250
- ALTER TABLE ai_working_memory RENAME TO agent_working_memory;
251
- ALTER TABLE ai_run RENAME TO agent_run;
252
- ALTER TABLE ai_run_score RENAME TO agent_run_score;
253
- ```
254
-
255
- - 6794681: Publish the ecosystem surface as per-area sub-barrels under `@pikku/core/ecosystem/*`, and point generated code, the CLI, the inspector and the runtime adapters at them.
256
-
257
- 348 names that only generated code, the toolchain or a runtime adapter ever imports now have a second home on `@pikku/core/ecosystem/<area>` — one sub-barrel per area, matching how core already publishes its entrypoints, so no single barrel grows without bound and a consumer only pulls in the area it uses.
258
-
259
- This step is additive: every name is still exported from the entrypoint it was published from before, so nothing downstream breaks. Removing them from the app-facing barrels is a later change, and needs a release carrying `./ecosystem/*` first.
260
-
261
- - Updated dependencies [7406bfe]
262
- - Updated dependencies [6794681]
263
- - @pikku/core@0.12.84
264
-
265
- ## 0.12.17
266
-
267
- ### Patch Changes
268
-
269
- - 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.
270
- - Updated dependencies [063f43a]
271
- - Updated dependencies [ce66bf8]
272
- - Updated dependencies [d0307a8]
273
- - Updated dependencies [ce66bf8]
274
- - Updated dependencies [3ad2131]
275
- - Updated dependencies [b930dca]
276
- - Updated dependencies [b95e77d]
277
- - Updated dependencies [fd9d834]
278
- - Updated dependencies [8978fbd]
279
- - @pikku/core@0.12.82
280
-
281
- ## 0.12.16
282
-
283
- ### Patch Changes
284
-
285
- - 6dada45: fix(workflow,ai-agent): make a run's owner, entry node and step function authoritative
286
-
287
- A graph run may only start at a node the graph declared in `meta.entryNodeIds`, and
288
- the generated `POST /workflow/:workflowName/graph/:nodeId` route that let an HTTP
289
- caller pick the entry node is gone. `startNode` stays for `PikkuTriggerService`,
290
- which names a declared entry node anyway.
291
-
292
- `StepState` now records the `rpcName` the workflow dispatched a step with, and the
293
- step claim rejects a queue message naming a different function with
294
- `WorkflowStepFunctionMismatchError` before mutating any status — a step runs under
295
- the run owner's identity and without the `expose` gate, so the message must not
296
- choose what runs.
297
-
298
- `approveStep` takes the caller's session, and the generated status routes and
299
- streams assert the same `assertWorkflowRunOwner` check: a run started through a
300
- session may only be read and approved by that session's user. A run with no
301
- recorded owner (trigger, scheduler, unauthenticated route) has nobody to compare
302
- against and is still gated by the entrypoint's own `auth`/`permissions`.
303
-
304
- `AIRunStateService.resolveApproval` is now a compare-and-swap returning whether
305
- _this_ caller made the claim, and both agent resume paths run a tool only for the
306
- approvals they claimed — concurrent approvals of one tool call no longer all
307
- execute it.
308
-
309
- - Updated dependencies [41c1a95]
310
- - Updated dependencies [ce96383]
311
- - Updated dependencies [7e60867]
312
- - Updated dependencies [f8f1244]
313
- - Updated dependencies [dcf20cb]
314
- - Updated dependencies [6512384]
315
- - Updated dependencies [e3b4c14]
316
- - Updated dependencies [efd0ed1]
317
- - Updated dependencies [cba98fb]
318
- - Updated dependencies [ce96383]
319
- - Updated dependencies [f8f1244]
320
- - Updated dependencies [f8f1244]
321
- - Updated dependencies [6e93a35]
322
- - Updated dependencies [6dada45]
323
- - @pikku/core@0.12.80
324
-
325
- ## 0.12.15
326
-
327
- ### Patch Changes
328
-
329
- - 78b29f0: `SecretService` now returns a `SecretValue<T>` rather than the bare value, so a
330
- vault secret cannot reach a sink by accident.
331
-
332
- `SecretValue` is nominally typed, which means it is not assignable to `string`
333
- (or to any other concretely-typed field). Every sink with a real type — a
334
- database column, an email body, a session payload — rejects it with no lint
335
- rule involved. The sinks typed `any`, `unknown`, or a free generic — the logger,
336
- queue payloads, webhook and email inputs, and a function's own output — are
337
- guarded with `Safe<T>`, which collapses a `SecretValue` found anywhere inside
338
- `T`, however deeply nested, to `never`.
339
-
340
- Unwrap deliberately at the point the secret reaches the wire:
341
-
342
- ```ts
343
- const secret = await secrets.getSecret('BETTER_AUTH_SECRET')
344
- betterAuth({ secret: secret.reveal() })
345
- ```
346
-
347
- Two behaviours cover what types cannot see. Structured serialization redacts —
348
- `JSON.stringify` and node's inspect both yield `[secret]`, so an audit or log
349
- write stays honest without crashing the request. String coercion throws
350
- `SecretCoercionError`, because a template literal is always a leak.
351
-
352
- `AuditLog.write` is guarded the same way as the logger, since an audit event
353
- carries `input` and `metadata` as `unknown` and nominality alone cannot stop a
354
- secret landing in one.
355
-
356
- `.reveal()` is the deliberate escape hatch, and what it hands back is an
357
- ordinary string as far as every sink signature is concerned. **PKU953** closes
358
- that gap: under `pikku all --security` the inspector reports a revealed secret
359
- that flows into a logger, an audit, a queue, an email or a webhook — `console` included.
360
-
361
- This also fixed a real one: `remote-addon-auth.ts` called `String(token)` on an
362
- `unknown` and wrote the result straight into an `Authorization` header.
363
-
364
- - Updated dependencies [62ea4cc]
365
- - Updated dependencies [9dddff8]
366
- - Updated dependencies [78b29f0]
367
- - @pikku/core@0.12.76
368
-
369
- ## 0.12.14
370
-
371
- ### Patch Changes
372
-
373
- - 6a307f0: Fix four latent correctness bugs in the function, RPC and error runtimes, and
374
- remove dead code from the workflow service surface.
375
-
376
- `WorkflowService.getNodesWithoutSteps` is gone. It was declared on the abstract
377
- service and implemented by all five storage backends, and nothing ever called
378
- it — hence the non-core packages in this changeset, which only lose that method.
379
-
380
- **An RPC could execute twice.** `RPCService.invoke`, its addon path, and
381
- `rpcWithWire` each wrapped the _execution_ of a resolved function in a `try`
382
- whose `catch` treated `RPCNotFoundError` as "not found locally" and re-dispatched
383
- the call through `deploymentService`. A nested `rpc.invoke` to a missing name,
384
- raised from inside an already-running function, therefore re-ran that function on
385
- a remote instance after its local side effects had already committed. Resolution
386
- is now separated from execution on all three paths, so only a genuinely
387
- unresolvable name reaches the fallback. What escapes to callers is unchanged.
388
-
389
- **`addonNamespace` leaked between sibling calls.** The function runner's
390
- middleware path restored `rpc`, `functionId`, `audit` and `addonNamespace` after
391
- an invocation; the non-middleware path restored the first three but not the
392
- fourth. A call into an addon function with no middleware left the addon's
393
- namespace on the wire, so subsequent sibling calls resolved the wrong
394
- per-instance singletons and `credentialOverrides`.
395
-
396
- **Errors registered on a subclass never resolved.** `misc.errors` was typed
397
- `Map<PikkuError, ErrorDetails>` — instances — while `addError` stores
398
- constructors, a mismatch hidden by its `error: any` parameter. The instance
399
- lookup in `getErrorResponse` was consequently dead, and lookup fell through to a
400
- scan comparing `constructor.name`, so a subclass of a registered error got no
401
- status mapping at all. The map is now typed `Map<PikkuErrorConstructor, …>` and
402
- lookup walks the prototype chain first. Name matching is retained, deliberately,
403
- as the fallback that keeps error mapping working when two copies of
404
- `@pikku/core` are installed.
405
-
406
- **`createWeakUID` collided across instances.** The prefix was
407
- `Date.now().toString(36)` evaluated at module load, so any two instances loading
408
- the module in the same millisecond emitted identical `channelId` and `requestId`
409
- sequences — reproducibly, not just in principle. It is now seeded lazily from
410
- `crypto.randomUUID()`.
411
-
412
- Also: `pikkuState` keys its global map with `Symbol.for` rather than `Symbol`, so
413
- two copies of the package share registrations instead of silently getting
414
- disjoint state; and the local channel upgrade path no longer keys its middleware
415
- cache on the raw request path, which grew the cache without bound while the
416
- cached value never varied by path.
417
-
418
- - afef587: Close eleven security weaknesses found in a review of `@pikku/core`. Most are
419
- breaking, and two invalidate data or credentials already in the wild — read the
420
- migration notes before upgrading.
421
-
422
- **Breaking: AI agent thread ownership now fails closed.** Reading, listing,
423
- resuming or approving an existing thread or run requires a resolved session
424
- principal (`userId`, or `orgId` for `sessionScope: 'org'`), regardless of the
425
- agent's `auth` setting. Previously a request without a session had no ownership
426
- model at all: the caller-supplied `resourceId` was accepted as the ownership
427
- key, so any caller could read or resume another party's thread by naming its
428
- `resourceId`. Worse, `threadOwnerConstraint` returned `undefined` for a
429
- sessionless caller, and `undefined` means _no filter_ rather than _no rows_ —
430
- so `getAgentThreads` returned every thread in the deployment. It now returns
431
- `string[]`, empty for a sessionless caller, which every storage backend already
432
- treats as matching nothing. Sessionless agents still run one-shot conversations,
433
- each with a fresh unguessable owner; what they lose is cross-request continuity.
434
- Wire a session to restore it.
435
-
436
- **Breaking: stored secrets and credentials must be re-entered.** `deriveKey` ran
437
- a single unsalted round of SHA-256 over the passphrase and used the digest
438
- directly as the AES-GCM key — roughly one hash per brute-force guess, with one
439
- rainbow table working against every deployment. It is now PBKDF2-HMAC-SHA256 at
440
- 600,000 iterations over a random salt. There is no compatibility path: every
441
- value held by the kysely, mongodb and redis secret services and the kysely
442
- credential service becomes undecryptable. They fail loud, naming the key and
443
- `key_version`, so the app hard-fails on first secret read until each is re-set.
444
-
445
- The KEK salt is scoped to the key version and stored alongside it, rather than
446
- per secret, so a bulk read costs one derivation instead of N — `getSecrets` over
447
- 50 secrets went from ~2.3s to ~48ms, and rotation from ~4.6s to ~94ms. This adds
448
- a salt table (kysely), hash field (redis) or collection (mongodb), created
449
- automatically on first use.
450
-
451
- **Breaking: `PIKKU_REMOTE_SECRET` must be at least 32 characters.** The
452
- remote-RPC session envelope moved from PBKDF2 to HKDF, which expands
453
- high-entropy key material rather than stretching a low-entropy passphrase. That
454
- took a remote hop from ~269ms to ~0.4ms — PBKDF2 was running twice per request —
455
- but HKDF supplies no brute-force resistance, so the secret must carry the
456
- entropy itself. A shorter secret now throws `WeakKeyMaterialError` at both ends.
457
- Generate one with `openssl rand -base64 32` and roll it out to every service in
458
- the mesh together: existing bearer tokens are format-incompatible, so a partial
459
- rollout produces 401s until every instance is updated. The Cloudflare, Lambda
460
- and Azure deployment services each hand-rolled a copy of `buildRemoteHeaders`
461
- and now call the shared one, which is what keeps the two sides in step.
462
-
463
- **Breaking: previously signed content URLs stop verifying.** `LocalContent`
464
- signed only `{signedAt, expiresAt, notBefore}`, so a signature proved when a URL
465
- was issued but never what it was issued for — any valid token was a skeleton
466
- key, and swapping the pathname from a public thumbnail to a private document
467
- still verified. The signature now binds the request path. Separately, the
468
- verifier returned "valid" when no JWT service was wired, which is how
469
- `pikku serve` ran: a forged `?signedAt=0&expiresAt=99999999999999` was accepted.
470
- It now rejects with 403, `LocalContent` requires a `JWTService`, and
471
- `pikku serve`/`pikku dev` mint an ephemeral per-process signing key so local
472
- development works without shipping a fail-open path. In-flight signed URLs must
473
- be re-issued.
474
-
475
- **Request body size limits now apply to every adapter.** The `maxBodySize` cap
476
- existed only in `PikkuFetchHTTPRequest`. The real hole was uWebSockets, which
477
- drove `res.onData` itself and concatenated every chunk with no bound and nothing
478
- downstream able to intervene; it now drops chunks past the limit and replies 413
479
- before routing. Fastify delegates to its native `bodyLimit` (set only when
480
- `maxBodySize` is configured, so fastify's stricter 1 MB default is never
481
- loosened), and `PikkuExpressServer` feeds the limit into its body parsers. Two
482
- paths can only reject rather than prevent, and are documented as such:
483
- `express-middleware` mounted on your own app receives an already-parsed body, so
484
- that deployment must bound its own parser; Next server actions bottom out at
485
- `experimental.serverActions.bodySizeLimit`.
486
-
487
- **Breaking: the console addon's privileged functions are gated by default.**
488
- `wireAddon` gains a `scopes` option that applies to every function in the
489
- addon's namespace, and the console scaffold now generates
490
- `wireAddon({ name: 'console', package: '@pikku/addon-console', scopes: ['admin'] })`.
491
- Previously the console's entire privileged surface — around 54 functions
492
- including `credentialGet`, which returns a resolved OAuth token for an arbitrary
493
- `userId`, `updateFunctionBody`, and `installAddon`, which shells out to a
494
- package install — was protected only by an optional host-registered
495
- `addGlobalPermission`. `resolveGlobalPermissions` returns `[]` when none is
496
- registered and permission checking then no-ops, so an app that never registered
497
- one served those functions to anyone, and with the template's default
498
- `scaffold.rpc: "no-auth"` that meant unauthenticated. All of them now return 403
499
- `MissingScopeError` without an `admin`, `admin:*` or `*` scope. **Regenerating
500
- is required** — an app holding an old `console.gen.ts` stays open.
501
- `installAddon` and `installOpenapiAddon` additionally declare their own
502
- `auth: true, scopes: ['admin']`, and `getAgentThreads` now scopes its listing to
503
- the session's own threads unless the caller holds admin.
504
-
505
- Addon scopes are enforced in `runPikkuFunc` rather than at the RPC boundary,
506
- because a wiring can reference an addon function directly — the inspector
507
- records the addon's `packageName` on HTTP, channel, schedule, queue, CLI,
508
- trigger, gateway and MCP wirings — and those paths never call `resolveNamespace`.
509
- Enforcing at the RPC seam would have covered only the `namespace:function` form
510
- while reading as complete.
511
-
512
- **Breaking: `wireAddon`'s `auth` and `tags` now apply on direct wirings too.**
513
- Both were read only by `resolveAddonFunction`, so they had exactly the hole
514
- scopes had: `wireAddon({ name: 'console', package: '@pikku/addon-console', auth:
515
- true, tags: ['admin'] })` gated `rpc('console:credentialGet')` and gated nothing
516
- at all on an HTTP route wired straight to `credentialGet`. A consumer who
517
- reached for the documented way to lock an addon down got a control that was
518
- silently inert on every wiring except one. Both now resolve in `runPikkuFunc`.
519
- `auth` merges as an OR — `auth: false` from an addon is ignored on a direct
520
- wiring, because an addon may require a session the wiring did not but must never
521
- waive one it did. Addon tags resolve to concrete middleware against the **root**
522
- tag groups before the call rather than being folded into the function's
523
- inherited middleware: `addTagMiddleware('admin', …)` is written by the consuming
524
- app and registers under the root package, whereas `combineMiddleware` would look
525
- the tag up under the addon's own `packageName`, where it does not exist.
526
-
527
- One consequence worth naming: an addon that wires `auth: true` and also runs its
528
- own sessionless internal work — a scheduled task or queue worker inside the
529
- addon calling a sibling function — is now gated where it previously was not,
530
- because a bare `rpc('fn')` from inside the addon reaches `runPikkuFunc` with the
531
- addon's `packageName` like any other call. This reverses a decision that
532
- deliberately scoped the gate to the namespaced boundary; that reasoning held
533
- only while the boundary was real, and a direct wiring can enter an addon without
534
- crossing it, so "already inside" is not something the runtime can infer. Such an
535
- addon should carry authorization on the function via
536
- `pikkuFunc({ permissions })`, which has always been enforced on every path. A
537
- follow-up will add execution provenance so an intra-addon call can be
538
- distinguished from an external one and skip the addon-level check; that needs a
539
- marker no caller outside the process can set, which is its own design problem
540
- and does not belong in a security fix.
541
-
542
- **Codegen now warns when an exposed function has no gate (PKU574).** The
543
- generated `POST /rpc/:rpcName` dispatcher forwards to `rpc.exposed`, which
544
- refuses anything without `expose: true` — but nothing checked whether the
545
- target was gated, because a dispatcher cannot know what it dispatches to. The
546
- console shipped ~54 privileged functions through that gap and the toolchain was
547
- silent. The inspector now reports every function that is exposed, sessionless,
548
- and carries no `auth`, `scopes` or `permissions` of its own and none from a
549
- governing `wireAddon`. It is a `warn`, not a critical: `expose: true` on an
550
- ungated sessionless function is correct for a genuinely public endpoint, so it
551
- blocks a build only under `--fail-on-warn`.
552
-
553
- Two pieces of metadata were missing for this to be answerable statically, and
554
- both are now recorded. A `pikkuSessionlessFunc`'s own `auth: true` was read at
555
- runtime but never written to function meta, so a self-gated function was
556
- indistinguishable from an ungated one — `sessionless` carries the baseline, and
557
- `auth` now carries the tightening. And `wireAddon`'s `scopes`, `auth` and `tags`
558
- were not parsed at all: the inspector recorded the addon's `rpcEndpoint` and its
559
- secret, variable and credential overrides, and dropped every one of its gates.
560
- An addon whose gates are not statically knowable is treated as gated, because a
561
- false positive on a correctly-secured addon costs more than the one case it
562
- would catch.
563
-
564
- **Breaking: an application's global permissions now apply inside addons.**
565
- `resolveGlobalPermissions` read only the bucket matching the function's own
566
- package, but the generated `addGlobalPermission` wrapper takes no package
567
- argument and always registers under the root. An app-wide rule like "every
568
- request needs a signed-in user" therefore stopped at the addon boundary, and the
569
- bucket an addon's functions did read was one no host could write to — which is
570
- why the console addon's recommended `addGlobalPermission([isAdmin],
571
- '@pikku/addon-console')` was never a gate anybody could actually install. A
572
- function now resolves the root bucket and its own package's, root first.
573
- Unioning is safe in a way nothing else here would be: globals AND, so adding the
574
- root ones can only tighten. Package buckets stay one-way — a package's globals
575
- never reach root functions, or an installed addon could gate the whole
576
- application. Apps with both a root global and addon-provided functions will see
577
- those functions gated where they previously were not.
578
-
579
- **Codegen now records whether each HTTP route requires a session, and warns
580
- about inert addon tags (PKU575).** Four separate things can demand a session —
581
- the function's `sessionless`, its own `auth`, the route's (or its group's)
582
- `auth`, and the addon it belongs to — and answering "which routes are open?"
583
- meant joining all four by hand and knowing which wins. Each route's meta now
584
- carries the resolved `requiresSession` alongside the route's own `auth`. Scopes
585
- count as requiring one, since they are matched against the session's and fail
586
- closed. Anything not statically knowable resolves to `true`, matching PKU574:
587
- a route that looks stricter than it is costs less than one that looks open and
588
- isn't. Separately, `wireAddon({ tags: ['admin'] })` reads like a gate and is
589
- applied like one right up until no `addTagMiddleware('admin', …)` exists, at
590
- which point it resolves to an empty list and gates nothing; that now warns.
591
- Only addon tags are reported — a tag on a function is as likely to be
592
- organizational, and warning about those would bury the case that matters.
593
-
594
- **Object-shorthand permissions were missing from meta.** The inspector visited
595
- `ts.PropertyAssignment` but not `ts.ShorthandPropertyAssignment`, so
596
- `permissions: { canAdminOrg }` — enforced identically to the longhand form at
597
- runtime, since `verifyPermissions` has a non-array branch — was recorded as _no
598
- permissions at all_. That is the most dangerous direction for meta to be wrong
599
- in: an audit reading it sees an open door where one is shut. It cost this review
600
- a false IDOR report across ~35 billing and org functions before the source
601
- contradicted the metadata.
602
-
603
- **Functions that authorize in their own body can say so.** A webhook receiver
604
- verifying a signature, or a handler redeeming a signed invite, is genuinely
605
- closed while carrying no session, scope or permission — indistinguishable in
606
- meta from one nobody remembered to gate, and so warned about forever by PKU574.
607
- `selfAuthenticated: true` on the function config records the claim and silences
608
- the warning for that function. It is declarative only: nothing at runtime reads
609
- it and it grants nothing. Detection was rejected deliberately — inferring it
610
- from the body means a function that _looks_ like it checks something silences
611
- the warning while checking nothing, and a warning that is usually wrong stops
612
- being read.
613
-
614
- **Breaking: `scaffold.<feature>` is now `boolean | { auth?, path? }`, and `true`
615
- means authenticated.** The old `'auth' | 'no-auth' | false` read like a
616
- starter-file preference while being a live authorization decision, set three
617
- directories from the functions it governed — the shape the console incident
618
- took. A surface now becomes public only by writing `{ auth: false }`, so
619
- omitting a field can never open anything: the failure mode of a forgotten flag
620
- is a locked door. `{ path }` additionally overrides where the file is
621
- generated, which previously could only be set for all features at once via
622
- `pikkuDir`.
623
-
624
- The legacy strings are **refused, not coerced**. `resolveScaffoldFeature` throws
625
- naming the key and its replacement (`"rpc": "no-auth"` → `"rpc": { "auth":
626
- false }`), and it does so at config load, not downstream. An earlier design used
627
- a bare `string` for the output path, under which `"no-auth"` would have parsed
628
- as a file named `no-auth` and every unmigrated config would have silently
629
- produced nonsense; the object form makes any string invalid, so the failure is
630
- loud.
631
-
632
- The collapse is deliberately not uniform in effect. For `rpc` the flag was a
633
- blanket "no anonymous RPC in this app" set on a dispatcher that cannot know what
634
- it dispatches to; for `userAdmin` it was redundant, since the generated
635
- functions are already `pikkuFunc` with `scopes: ['admin:users:list']`. But for
636
- `agent`, `workflow`, `events` and `scenarios` it is the only gate — those
637
- generate real endpoints the app never authors — so `true` keeps them
638
- authenticated rather than opening them as a side effect of a config cleanup.
639
- `webhook` and `remoteRpc` have no auth dimension at all (`serialize-remote-rpc.ts`
640
- hardcodes `auth: false`), so an `{ auth }` on them is ignored. The three
641
- configs in this repo are migrated preserving their current behaviour exactly.
642
-
643
- **Queue job identities are signed.** A job carried the producer's `pikkuUserId`
644
- as a plain string and the worker resolved a session from it with no
645
- verification, so write access to the queue backend was act-as-any-user. The
646
- identity is now `pq1.<claim>.<hmac>`, HMAC-SHA256 over the claim and the
647
- canonicalized job payload, keyed by HKDF expansion of a new
648
- `PIKKU_QUEUE_IDENTITY_SECRET`. Producers opt in by wrapping their queue service
649
- with `SignedQueueService`. This fails safe rather than closed: with no secret
650
- configured the identity is dropped and jobs still process, warning once per
651
- process, so no existing deployment breaks on upgrade — it simply loses queue
652
- identity until the secret is set. The payload rather than the job id is bound
653
- because SQS, Cloudflare Queues, Azure and the in-memory service all mint ids
654
- after `add` returns.
655
-
656
- **Workflow inline state is read from the run record.** `isInline` consulted a
657
- process-local `Map`, while `WorkflowRun.inline` is durable. Any instance that
658
- did not start a run disagreed with the record, so one instance could dispatch a
659
- queued job for a workflow another was already executing in-process. It is now
660
- async and resolves through the durable identity, cached only when a context
661
- already exists so a passive reader allocates nothing. The same `Map` also leaked:
662
- `nextStepKey` fabricated replay state on every step, and `releaseContext`
663
- refused to free anything carrying it, so runs whose steps executed outside a
664
- `beginReplay` bracket — the step-worker queue path — stranded their context and
665
- step state for the process lifetime. Contexts are now released by an explicit
666
- execution counter. Step ordinals reset per execution rather than accumulating
667
- across step-worker invocations in one process, which makes step naming
668
- independent of how work was distributed.
669
-
670
- **Secret reads fail loud in every store.** `MongoDBSecretService.getSecrets`
671
- skipped rows that failed to decrypt, and the redis equivalent dropped every
672
- rejection via `Promise.allSettled`, including the "No KEK available for
673
- key_version N" configuration error. Both now throw, naming the key and its key
674
- version, matching the kysely behaviour. This matters most alongside the KEK
675
- change above: without it, an upgrade surfaces as a partial secrets map and an
676
- opaque downstream failure instead of an error naming the secret to re-enter.
677
-
678
- **A second middleware registration for a pattern no longer erases the first.**
679
- `addHTTPMiddleware`, `addTagMiddleware` and `addChannelMiddleware` groups are
680
- keyed by pattern or tag and held one source file each, so a second file's call
681
- overwrote the first's. Codegen emits its imports from what is stored, so the
682
- losing file was never imported and its middleware never registered — the
683
- runtime composes repeated registrations for a pattern happily, and only codegen
684
- dropped one. Adding an unrelated `addHTTPMiddleware('*', …)` to an app was
685
- enough to silently unregister the generated better-auth session bridge, which
686
- fails open and gives no sign until a request arrives without a session. A group
687
- now carries every registration made for it, and all of them are imported.
688
-
689
- - Updated dependencies [6a307f0]
690
- - Updated dependencies [afef587]
691
- - Updated dependencies [8075f6a]
692
- - @pikku/core@0.12.74
693
-
694
- ## 0.12.13
695
-
696
- ### Patch Changes
697
-
698
- - 8a2c993: Make the workflow service cheaper to run, and fix two ways it lost state.
699
-
700
- The SQL workflow tables had no indexes at all, so every step read, every
701
- history walk and every orchestrator tick was a sequential scan; five indexes
702
- now cover the columns the engine actually queries by. A replay used to ask for
703
- each step's row individually — O(N) reads per replay, O(N^2) over a run — and
704
- now takes one read of the run's steps and serves the walk from it. A step
705
- transition wrote the step row and its history row as two separate statements,
706
- so a crash between them left a step saying `succeeded` whose history still said
707
- `running`; both halves are now one transaction, and the history row is found by
708
- attempt number rather than by sorting on `created_at`, which two attempts can
709
- share. Resolving a dynamic workflow read and parsed every AI-generated workflow
710
- in the deployment to `.find()` one by name; it is a point lookup now.
711
-
712
- Waiting on a run no longer polls at a fixed interval. `pollIntervalMs` became a
713
- ceiling rather than a cadence: polling starts at 10ms and widens towards it, so
714
- a workflow that finishes in milliseconds is no longer held for a full second,
715
- and a long-running one is not read at full rate for its whole life.
716
-
717
- Two backend-specific defects: Redis kept a run's state as one JSON blob and
718
- read-modified-wrote it, so parallel branches setting different variables
719
- overwrote each other — state is a field per variable now, with the old blob
720
- still read underneath so runs in flight keep what they had. Mongo's
721
- `setStepScheduled` never wrote history, leaving a queued step reading as never
722
- dispatched.
723
-
724
- Also: dispatch no longer JSON round-trips every step payload before handing it
725
- to a queue that serialises it anyway — the in-process dev queue, which is the
726
- only one that was relying on it, does it itself now.
727
-
728
- Two more defects. A transition whose step had no live attempt wrote its status
729
- to the step row and silently nothing to history — the exact divergence the
730
- transaction exists to prevent — and now repairs the step and writes the
731
- missing row. And resolving a dynamic workflow was non-deterministic on all
732
- three backends: a name can hold several active versions, and none of them
733
- ordered the candidates, so which one ran could change between two calls
734
- reading identical data. The newest version wins, with the graph hash breaking
735
- a tie.
736
-
737
- The two attempt columns and the five indexes are declared in the workflow
738
- schema, so a fresh database gets them at boot. An existing one gets them from
739
- a migration — `pikku db generate` writes the declaration down — rather than
740
- from DDL issued at boot.
741
-
742
- - a261006: **Breaking:** removed dynamic workflows — runtime-defined workflow graphs stored in the database and resolved by name instead of by codegen.
743
-
744
- The feature was already half-gone. Its authoring surface (`createAgentWorkflow`, `saveAgentWorkflow`, `listAgentWorkflows`, `executeAgentWorkflow`, and the AI-agent instruction builder) was deleted in April 2026 along with its entire e2e suite, and nothing has written a dynamic workflow since. What remained could not execute one either: `executeAgentWorkflow` gated on `pikkuState('workflows', 'meta')`, which only codegen ever populates, so a graph that existed solely in the database was never findable. The two backend families had also drifted onto different `source` sentinels (`'ai-agent'` vs `'dynamic-workflow'`), and the two Redis implementations disagreed on key escaping — so at least one of them matched nothing. Rather than keep shipping plumbing for a path no caller could complete, it is removed until it can be reintroduced deliberately.
745
-
746
- Removed:
747
- - `getAIGeneratedWorkflows` from `WorkflowService` and `WorkflowRunService`, and from every backend (in-memory, Redis, MongoDB, Kysely, and the Cloudflare Durable Object service and client — the last two were already a `return []` stub and a rejection).
748
- - The database-lookup fallbacks in `startWorkflow` and `runWorkflowJob` that resolved a workflow name against stored graphs when static meta had no match.
749
- - `'dynamic-workflow'` from the `WorkflowRuntimeMeta['source']` union.
750
- - `validateWorkflowWiring` and `computeEntryNodeIds` from `@pikku/core/workflow`. These validated AI-authored graphs and had no callers in core; the inspector keeps its own private entry-node computation for static graph wiring, which is unaffected.
751
- - The `workflow-created` AI stream event and its AG-UI `pikku:workflow-created` custom event. Its only emitter went with the April deletion, so it could never fire.
752
- - The console's `console:getAIWorkflows` RPC, the `useAIWorkflows` hook, the "Dynamic" workflow filter and badge, and the trigger-schema scraper that derived an input form from a stored graph's `$ref` bindings.
753
-
754
- Kept, because static graph workflows depend on them and this is not a change to versioning:
755
- - `upsertWorkflowVersion`, `getWorkflowVersion`, `updateWorkflowVersionStatus`, and the `workflowVersions` storage in every backend. These back version-mismatch replay: when a deployed graph's hash changes, in-flight runs continue against the exact graph they started on. No schema migration is needed — the table, its columns, and its `(workflowName, graphHash)` upsert key are unchanged.
756
- - `generateMermaidDiagram`, which renders any workflow graph and is not specific to dynamic ones.
757
-
758
- Static `pikkuWorkflowGraph` and DSL workflows are entirely unaffected: they resolve from codegen'd meta, which was always the only path that worked.
759
-
760
- To revive this post-MVP, the deleted authoring code is recoverable in full — its prompt engineering (a compact tool table upfront, full schemas with flattened dotted output paths returned only after a validation failure) is worth reading before rewriting:
761
-
762
- ```
763
- git show f52f3308b^:packages/core/src/wirings/ai-agent/agent-dynamic-workflow.ts
764
- git show f52f3308b^:packages/core/src/wirings/workflow/graph/graph-validation.ts
765
- git show f52f3308b --stat # the April removal, incl. the three e2e feature files
766
- ```
767
-
768
- Note that reviving it needs more than restoring those files: the queued-step path (`executeWorkflowStep`), `onError` compensation, and sub-workflow resolution all read static meta only and would need a fallback for a graph that exists solely in the database.
769
-
770
- - Updated dependencies [8a2c993]
771
- - Updated dependencies [a261006]
772
- - Updated dependencies [09973b9]
773
- - @pikku/core@0.12.71
774
-
775
- ## 0.12.12
776
-
777
- ### Patch Changes
778
-
779
- - e3d4454: Add job groups, so one shared queue can stay fair without splitting into one
780
- queue per producer.
781
-
782
- A job may now carry `group: { id, tier }`, and a worker may cap how many jobs
783
- of any one group run at once via `groupConcurrency`. On pg-boss this maps to
784
- `localGroupConcurrency`, which excludes at-capacity groups from the fetch query
785
- itself, so a capped group costs nothing rather than being fetched and restored.
786
- BullMQ declares it unsupported (groups are a BullMQ Pro feature) — being
787
- push-based, it can simply use a queue per group at no polling cost.
788
-
789
- Workflow services accept a `queueStrategy`. The default `'per-workflow'` is
790
- unchanged: every workflow gets its own `wf-orchestrator-*` / `wf-step-*` queue,
791
- which is also what lets serverless providers deploy one unit per workflow. The
792
- new `'shared-groups'` routes every workflow through the shared
793
- orchestrator/step-worker queues and isolates them by group instead, so a
794
- monolith runs one set of pollers rather than one per workflow — on a
795
- pull-based backend with dozens of workflows that is the difference between
796
- hundreds of poll loops and twenty. It is for single-process runtimes only; a
797
- per-unit serverless deploy still needs the per-workflow queues to route to its
798
- units.
799
-
800
- - Updated dependencies [24252b8]
801
- - Updated dependencies [e3d4454]
802
- - @pikku/core@0.12.69
803
-
804
- ## 0.12.11
805
-
806
- ### Patch Changes
807
-
808
- - 4324652: Scope AI agent thread reads to the calling session.
809
-
810
- The generated thread-management functions (`getAgentThreads`,
811
- `getAgentThreadMessages`, `getAgentThreadRuns`, `deleteAgentThread`) keyed purely
812
- off a caller-supplied `threadId` and treated `resourceId` as an optional filter,
813
- so omitting it enumerated every tenant's threads.
814
- - `listThreads` gains an `owners` **authorization constraint** (distinct from the
815
- `resourceId` filter): an empty array matches nothing, and it is always derived
816
- from the session, never from input. Implemented across the Kysely, Redis and
817
- MongoDB agent run services, with LIKE/regex metacharacter escaping so an owner
818
- id containing `_` or `%` cannot match a foreign owner.
819
- - The three `threadId`-keyed functions are now guarded by an `isThreadOwner`
820
- `pikkuPermission` rather than an in-body check. A thread that does not exist is
821
- denied rather than 404'd, so it is indistinguishable from one owned by someone
822
- else.
823
- - New `@pikku/core/ai-agent` helpers: `canAccessThread`, `threadOwnerConstraint`,
824
- `sessionPrincipals`, `isOwnedByPrincipal`.
825
-
826
- Services destructured by a wired function are now non-optional inside it.
827
-
828
- The inspector already aggregated the services used by every wired `func`,
829
- `permissions` and `middleware` into `RequiredSingletonServices`, but the
830
- generated function types defaulted their service parameter to the raw `Services`
831
- — so a service declared `foo?: Foo` still arrived as possibly-undefined, forcing
832
- `if (!foo) throw new MissingServiceError(...)` guards that could never fire.
833
- Generated types now expose `WiredSingletonServices` / `WiredServices`
834
- (`RequiredSingletonServices & Services`) and default the `RequiredServices`
835
- generic of functions, permissions, middleware, auth and approval-description
836
- helpers to them. Optionality now means only what it should: "this service may
837
- not be created, because nothing uses it".
838
-
839
- - Updated dependencies [5f19016]
840
- - Updated dependencies [78e4778]
841
- - Updated dependencies [4324652]
842
- - Updated dependencies [de044f8]
843
- - Updated dependencies [cd1a811]
844
- - Updated dependencies [19fa6f0]
845
- - Updated dependencies [b501612]
846
- - Updated dependencies [eb37b1e]
847
- - @pikku/core@0.12.66
848
-
849
- ## 0.12.10
850
-
851
- ### Patch Changes
852
-
853
- - 41ce2cb: Upgrade to TypeScript 6 and raise the minimum Node.js version to 22.
854
-
855
- All packages now build against `typescript@^6.0.3` and declare `engines.node >= 22`. Internal tooling (`ts-json-schema-generator`, `zod-to-ts`) was bumped to TypeScript 6-compatible releases.
856
-
857
- - Updated dependencies [41ce2cb]
858
- - @pikku/core@0.12.44
859
-
860
- ## 0.12.9
861
-
862
- ### Patch Changes
863
-
864
- - 5c0ff0f: Fix `getRunHistory` dropping step provenance (`fromStepName`). The value was persisted on the step row and used by the graph planner, but `getRunHistory` built its rows from the per-attempt history and never carried `fromStepName` through — so run history (and any timeline reconstructed from it) reported no predecessors. Redis and Kysely `getRunHistory` now return `fromStepName`. Also adds the missing `from_step_name` column (+ backfill) to the Kysely workflow mirror's `workflow_step` schema and persists it on mirror inserts, so a mirror-side history has identical provenance.
865
- - Updated dependencies [4be205f]
866
- - Updated dependencies [061c717]
867
- - Updated dependencies [2c55e13]
868
- - Updated dependencies [c745c26]
869
- - Updated dependencies [57900b5]
870
- - Updated dependencies [72694f6]
871
- - @pikku/core@0.12.39
872
-
873
- ## 0.12.8
874
-
875
- ### Patch Changes
876
-
877
- - 92cd5b1: feat(workflow): workflow-owned step retries + stable invocationId
878
-
879
- The workflow — not the queue — now owns step retry policy, and each step
880
- invocation gets a stable idempotency key.
881
- - **Default `retries: 5` with exponential backoff.** A step with no `retries`
882
- previously inherited the queue's bare default (e.g. pg-boss `retry_limit 2`,
883
- no backoff) so retries fired instantly and couldn't outlast a transient
884
- outage. Retries now default to 5 with backoff, resolved at the workflow layer.
885
- - **`retries: 0` is honored.** Dispatch previously passed `undefined` options
886
- for `retries: 0`, letting the queue re-run a non-idempotent step up to its own
887
- default. The resolved policy now always sets `attempts` (`retries: 0` →
888
- `attempts: 1`), so the queue never second-guesses the workflow. The persisted
889
- step retries and the dispatched `attempts` are resolved together so
890
- "retries exhausted" and "no more redeliveries" are the same event.
891
- - **`workflowStep.invocationId`** — a deterministic, dependency-free
892
- `uuidv5(runId:stepName)` handed to every step. Unlike `stepId` (minted per
893
- attempt), it is identical across retries, so a step can dedupe on it
894
- (`ON CONFLICT (invocationId)`, Stripe idempotency keys, etc.).
895
- - **queue-bullmq**: `mapPikkuJobToBull` now maps `backoff` (previously dropped,
896
- so a step's backoff silently never applied on Redis), and `registerQueues`
897
- throws a clear error when no logger is available (matching queue-pg-boss).
898
- - **Dispatch failures are recoverable, not fatal.** A step is now marked
899
- `scheduled` only _after_ it is successfully handed to its transport (queue or
900
- scheduler) — a failed hand-off leaves it `pending` so a replay re-dispatches
901
- it, instead of stranding it in `scheduled` (replay would pause forever on a
902
- job that was never enqueued). A transport outage (e.g. pg-boss momentarily
903
- down) is surfaced as a new `WorkflowDispatchException`, which the orchestrator
904
- treats as transient: the run is left running and the orchestrator job is
905
- rethrown for redelivery (it replays idempotently from the snapshot) rather
906
- than the whole run being marked `failed`. The orchestrator job now also
907
- carries its own retry policy, so this holds even when the orchestrator queue
908
- is configured `retry_limit 0`. A genuine step error still fails the run.
909
- - **Same step name can be invoked multiple times in one run.** Step rows are now
910
- keyed per _invocation_: the Nth reach of a step name in a replay resolves to a
911
- physical key (`name` for the first, `name#N` for repeats), so a literal
912
- duplicate name no longer clobbers the earlier step's state. The first reach
913
- keeps the bare name, so existing rows, graph-node matching and `invocationId`s
914
- are unchanged. Ordinals are derived deterministically from DSL execution order
915
- and reset each replay.
916
- - **Step provenance (`fromStepName`) + graph cycles.** Every step now records
917
- the predecessor it was scheduled from (`fromStepName`; entry steps have none),
918
- persisted on the step row across all stores (in-memory, kysely, redis,
919
- mongodb, cloudflare DO) and carried in the queued payload. The DSL wire
920
- exposes the derived `fromInvocationId` (`uuidv5(runId:fromStepName)`) so
921
- consumers get the stable predecessor key without a second persisted id —
922
- `fromStepName` is the source of truth (it is replay-deterministic; `stepId`,
923
- minted per row, is not). This makes the walked path reconstructable even when
924
- a node is reached more than once: in `a → b → a → c` the second `a` is a
925
- distinct ordinal instance (`a#1`) whose `fromStepName` is `b`.
926
- The graph runner now supports **cycles**: a forward edge into an
927
- already-started node still collapses to a single run (joins/diamonds are
928
- unchanged), but a _back-edge_ — one whose target can reach its source — fires
929
- a fresh ordinal instance, so a node can loop back to itself. Termination is
930
- the graph's responsibility (branch routing must converge); the engine enforces
931
- no visit cap.
932
-
933
- - Updated dependencies [92cd5b1]
934
- - @pikku/core@0.12.38
935
-
936
- ## 0.12.7
937
-
938
- ### Patch Changes
939
-
940
- - 4b5c75b: feat(auth-js): wire OIDC config (issuer/tenantId) as variables, expand provider registry
941
- - Move `issuer` and `tenantId` out of the secret blob for OIDC providers (auth0, okta, azure-ad, keycloak, cognito, microsoft-entra-id) — they are public config URLs, not secrets. Now registered via `wireVariable` and loaded at runtime via `services.variables.get()`.
942
- - Expand provider registry from 13 to 31 providers: reddit, notion, instagram, zoom, figma, tiktok, threads, patreon, dropbox, bitbucket, hubspot, salesforce, atlassian, strava, keycloak, cognito, microsoft-entra-id added.
943
- - `serialize-auth-gen` emits `wireVariable({...})` declarations and `services.variables.get()` calls in the generated factory for OIDC providers.
944
- - Integration verifier exercises real `/auth/providers` endpoint with `LocalSecretService` + `LocalVariablesService`, including a spy test proving `services.variables.get('AUTH0_ISSUER')` is called at request time.
945
-
946
- - Updated dependencies [4b5c75b]
947
- - Updated dependencies [4b5c75b]
948
- - @pikku/core@0.12.27
949
-
950
- ## 0.12.6
951
-
952
- ### Patch Changes
953
-
954
- - b9ed73e: Add deterministic workflow planned-step metadata support and SSE init stream payload generation.
955
- - Persist `deterministic` and `plannedSteps` on workflow runs in core and service adapters.
956
- - Expose planned-step metadata on workflow run status responses.
957
- - Emit an initial `type: 'init'` SSE event for deterministic workflow streams before incremental updates.
958
- - Add CLI tests covering serialized stream route output for init/update/done event behavior.
959
-
960
- - Updated dependencies [b9ed73e]
961
- - @pikku/core@0.12.19
962
-
963
- ## 0.12.0
964
-
965
- ## 0.12.5
966
-
967
- ### Patch Changes
968
-
969
- - 311c0c4: Unify session persistence through SessionStore, remove session blob from ChannelStore
970
- - PikkuSessionService now persists sessions via SessionStore on set()/clear() instead of every function call
971
- - ChannelStore no longer stores session data — maps channelId to pikkuUserId only
972
- - ChannelStore API: setUserSession/getChannelAndSession replaced with setPikkuUserId/getChannel
973
- - Serverless channel runner resolves sessions from SessionStore using pikkuUserId from ChannelStore
974
-
975
- - Updated dependencies [311c0c4]
976
- - @pikku/core@0.12.18
977
-
978
- ## 0.12.4
979
-
980
- ### Patch Changes
981
-
982
- - 3e79248: Add setStepChildRunId to workflow service implementations and auto-bootstrap in pikku all
983
- - Updated dependencies [bb27710]
984
- - Updated dependencies [a31bc63]
985
- - Updated dependencies [3e79248]
986
- - Updated dependencies [b0a81cc]
987
- - Updated dependencies [6413df7]
988
- - @pikku/core@0.12.6
989
-
990
- ## 0.12.3
991
-
992
- ### Patch Changes
993
-
994
- - 32ed003: Add envelope encryption utilities and database-backed secret services with KEK rotation support
995
- - c7ff141: Add WorkflowVersionStatus type with draft→active lifecycle for AI-generated workflows, type all DB status fields with proper unions instead of plain strings
996
- - Updated dependencies [387b2ee]
997
- - Updated dependencies [32ed003]
998
- - Updated dependencies [7d369f3]
999
- - Updated dependencies [508a796]
1000
- - Updated dependencies [ffe83af]
1001
- - Updated dependencies [c7ff141]
1002
- - @pikku/core@0.12.3
1003
-
1004
- ## 0.12.2
1005
-
1006
- ### Patch Changes
1007
-
1008
- - 3e04565: chore: update dependencies to latest minor/patch versions
1009
- - Updated dependencies [cc4c9e9]
1010
- - Updated dependencies [3e04565]
1011
- - @pikku/core@0.12.2
1012
-
1013
- ## 0.12.1
1014
-
1015
- ### Patch Changes
1016
-
1017
- - e04531f: Code quality improvements: resolve oxlint warnings and apply autofixes across the codebase (unused bindings, unnecessary constructors, prefer `const` over `let`, etc.). No behaviour changes.
1018
- - Updated dependencies [62a8725]
1019
- - Updated dependencies [a3bdb0d]
1020
- - Updated dependencies [e0349ff]
1021
- - Updated dependencies [62a8725]
1022
- - Updated dependencies [e04531f]
1023
- - Updated dependencies [62a8725]
1024
- - Updated dependencies [a83efb8]
1025
- - Updated dependencies [8eed717]
1026
- - Updated dependencies [62a8725]
1027
- - Updated dependencies [62a8725]
1028
- - Updated dependencies [62a8725]
1029
- - @pikku/core@0.12.1
1030
-
1031
- ### New Features
1032
-
1033
- - `RedisDeploymentService` for Redis-based service discovery with TTL heartbeats
1034
-
1035
- ## 0.11.2
1036
-
1037
- ### Features
1038
-
1039
- - f35e89da: Add workflow graph support to RedisWorkflowService
1040
- - Add `inline` field to workflow runs
1041
- - Add `getCompletedGraphState` method for graph execution
1042
- - Add `setBranchTaken` method for graph branching
1043
-
1044
- ## 0.11.2
1045
-
1046
- ### Patch Changes
1047
-
1048
- - db9c7bf: Add workflow graph support to RedisWorkflowService
1049
- - Updated dependencies [db9c7bf]
1050
- - @pikku/core@0.11.2
1051
-
1052
- ## 0.11.2
1053
-
1054
- ### Features
1055
-
1056
- - f35e89da: Add workflow graph support to RedisWorkflowService
1057
- - Add `inline` field to workflow runs
1058
- - Add `getCompletedGraphState` method for graph execution
1059
- - Add `setBranchTaken` method for graph branching
1060
-
1061
- ## 0.11.1
1062
-
1063
- ### Patch Changes
1064
-
1065
- - 4b811db: chore: updating all dependencies
1066
- - Updated dependencies [4b811db]
1067
- - Updated dependencies [e12a00c]
1068
- - Updated dependencies [4579434]
1069
- - Updated dependencies [28aeb7f]
1070
- - Updated dependencies [ce902b1]
1071
- - Updated dependencies [06e1a31]
1072
- - @pikku/core@0.11.1
1073
-
1074
- ### Minor Changes
1075
-
1076
- - Initial release with Redis-backed channel, eventhub, and workflow stores
1077
-
1078
- # @pikku-workflows/redis
1079
-
1080
- ## 0.10.0
1081
-
1082
- ### Major Changes
1083
-
1084
- - Initial release of @pikku-workflows/redis
1085
- - Redis-based WorkflowStateService implementation
1086
- - Distributed locking with Redis SET NX
1087
- - Support for shared or owned Redis connections
1088
- - Configurable key prefixes