@plumbus/core 0.4.2 → 0.5.0

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.
Files changed (280) hide show
  1. package/README.md +1 -1
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/api/route-generator.d.ts.map +1 -1
  4. package/dist/api/route-generator.js +27 -14
  5. package/dist/api/route-generator.js.map +1 -1
  6. package/dist/cli/cli.d.ts.map +1 -1
  7. package/dist/cli/cli.js +2 -1
  8. package/dist/cli/cli.js.map +1 -1
  9. package/dist/cli/commands/dev.d.ts.map +1 -1
  10. package/dist/cli/commands/dev.js +38 -149
  11. package/dist/cli/commands/dev.js.map +1 -1
  12. package/dist/cli/commands/doctor.d.ts +6 -0
  13. package/dist/cli/commands/doctor.d.ts.map +1 -1
  14. package/dist/cli/commands/doctor.js +92 -4
  15. package/dist/cli/commands/doctor.js.map +1 -1
  16. package/dist/cli/commands/event.d.ts.map +1 -1
  17. package/dist/cli/commands/event.js +3 -0
  18. package/dist/cli/commands/event.js.map +1 -1
  19. package/dist/cli/commands/events-ops.d.ts +4 -0
  20. package/dist/cli/commands/events-ops.d.ts.map +1 -0
  21. package/dist/cli/commands/events-ops.js +203 -0
  22. package/dist/cli/commands/events-ops.js.map +1 -0
  23. package/dist/cli/commands/flow.d.ts.map +1 -1
  24. package/dist/cli/commands/flow.js +49 -1
  25. package/dist/cli/commands/flow.js.map +1 -1
  26. package/dist/cli/commands/generate.d.ts +4 -0
  27. package/dist/cli/commands/generate.d.ts.map +1 -1
  28. package/dist/cli/commands/generate.js +94 -3
  29. package/dist/cli/commands/generate.js.map +1 -1
  30. package/dist/cli/commands/index.d.ts +1 -0
  31. package/dist/cli/commands/index.d.ts.map +1 -1
  32. package/dist/cli/commands/index.js +1 -0
  33. package/dist/cli/commands/index.js.map +1 -1
  34. package/dist/cli/commands/init.d.ts +1 -1
  35. package/dist/cli/commands/init.d.ts.map +1 -1
  36. package/dist/cli/commands/init.js +13 -3
  37. package/dist/cli/commands/init.js.map +1 -1
  38. package/dist/cli/commands/mcp.d.ts.map +1 -1
  39. package/dist/cli/commands/mcp.js +2 -0
  40. package/dist/cli/commands/mcp.js.map +1 -1
  41. package/dist/cli/commands/start.d.ts +3 -6
  42. package/dist/cli/commands/start.d.ts.map +1 -1
  43. package/dist/cli/commands/start.js +71 -180
  44. package/dist/cli/commands/start.js.map +1 -1
  45. package/dist/cli/commands/verify.d.ts +3 -1
  46. package/dist/cli/commands/verify.d.ts.map +1 -1
  47. package/dist/cli/commands/verify.js +17 -9
  48. package/dist/cli/commands/verify.js.map +1 -1
  49. package/dist/cli/commands/worker.d.ts +19 -0
  50. package/dist/cli/commands/worker.d.ts.map +1 -0
  51. package/dist/cli/commands/worker.js +234 -0
  52. package/dist/cli/commands/worker.js.map +1 -0
  53. package/dist/cli/mcp-serve-context.d.ts +3 -0
  54. package/dist/cli/mcp-serve-context.d.ts.map +1 -1
  55. package/dist/cli/mcp-serve-context.js +16 -1
  56. package/dist/cli/mcp-serve-context.js.map +1 -1
  57. package/dist/cli/templates/resources.d.ts.map +1 -1
  58. package/dist/cli/templates/resources.js +7 -2
  59. package/dist/cli/templates/resources.js.map +1 -1
  60. package/dist/cli/utils.d.ts +4 -0
  61. package/dist/cli/utils.d.ts.map +1 -1
  62. package/dist/cli/utils.js +9 -0
  63. package/dist/cli/utils.js.map +1 -1
  64. package/dist/data/drift-inspector.d.ts +2 -2
  65. package/dist/data/drift-inspector.d.ts.map +1 -1
  66. package/dist/data/drift-inspector.js +2 -1
  67. package/dist/data/drift-inspector.js.map +1 -1
  68. package/dist/data/migration.d.ts.map +1 -1
  69. package/dist/data/migration.js +2 -0
  70. package/dist/data/migration.js.map +1 -1
  71. package/dist/define/defineCapability.d.ts +5 -0
  72. package/dist/define/defineCapability.d.ts.map +1 -1
  73. package/dist/define/defineCapability.js +23 -0
  74. package/dist/define/defineCapability.js.map +1 -1
  75. package/dist/errors/http.d.ts.map +1 -1
  76. package/dist/errors/http.js +1 -0
  77. package/dist/errors/http.js.map +1 -1
  78. package/dist/errors/index.d.ts.map +1 -1
  79. package/dist/errors/index.js +1 -0
  80. package/dist/errors/index.js.map +1 -1
  81. package/dist/events/dispatcher.d.ts +4 -0
  82. package/dist/events/dispatcher.d.ts.map +1 -1
  83. package/dist/events/dispatcher.js +24 -1
  84. package/dist/events/dispatcher.js.map +1 -1
  85. package/dist/events/emitter.d.ts +2 -0
  86. package/dist/events/emitter.d.ts.map +1 -1
  87. package/dist/events/emitter.js +6 -3
  88. package/dist/events/emitter.js.map +1 -1
  89. package/dist/events/queue-adapter.d.ts +7 -0
  90. package/dist/events/queue-adapter.d.ts.map +1 -0
  91. package/dist/events/queue-adapter.js +4 -0
  92. package/dist/events/queue-adapter.js.map +1 -0
  93. package/dist/events/queue.d.ts +16 -13
  94. package/dist/events/queue.d.ts.map +1 -1
  95. package/dist/events/queue.js +79 -22
  96. package/dist/events/queue.js.map +1 -1
  97. package/dist/events/worker.d.ts +4 -0
  98. package/dist/events/worker.d.ts.map +1 -1
  99. package/dist/events/worker.js +47 -1
  100. package/dist/events/worker.js.map +1 -1
  101. package/dist/execution/canonical-name.d.ts +13 -0
  102. package/dist/execution/canonical-name.d.ts.map +1 -0
  103. package/dist/execution/canonical-name.js +17 -0
  104. package/dist/execution/canonical-name.js.map +1 -0
  105. package/dist/execution/capability-executor.d.ts +1 -1
  106. package/dist/execution/capability-executor.d.ts.map +1 -1
  107. package/dist/execution/capability-executor.js +52 -24
  108. package/dist/execution/capability-executor.js.map +1 -1
  109. package/dist/execution/capability-invocation.d.ts +34 -0
  110. package/dist/execution/capability-invocation.d.ts.map +1 -0
  111. package/dist/execution/capability-invocation.js +138 -0
  112. package/dist/execution/capability-invocation.js.map +1 -0
  113. package/dist/execution/capability-registry.d.ts +6 -4
  114. package/dist/execution/capability-registry.d.ts.map +1 -1
  115. package/dist/execution/capability-registry.js +13 -7
  116. package/dist/execution/capability-registry.js.map +1 -1
  117. package/dist/execution/context-factory.d.ts.map +1 -1
  118. package/dist/execution/context-factory.js +12 -1
  119. package/dist/execution/context-factory.js.map +1 -1
  120. package/dist/execution/index.d.ts +4 -0
  121. package/dist/execution/index.d.ts.map +1 -1
  122. package/dist/execution/index.js +2 -0
  123. package/dist/execution/index.js.map +1 -1
  124. package/dist/execution/invocation-emit-scope.d.ts +11 -0
  125. package/dist/execution/invocation-emit-scope.d.ts.map +1 -0
  126. package/dist/execution/invocation-emit-scope.js +8 -0
  127. package/dist/execution/invocation-emit-scope.js.map +1 -0
  128. package/dist/flows/engine.d.ts +7 -1
  129. package/dist/flows/engine.d.ts.map +1 -1
  130. package/dist/flows/engine.js +73 -10
  131. package/dist/flows/engine.js.map +1 -1
  132. package/dist/flows/flow-delayed.d.ts +34 -0
  133. package/dist/flows/flow-delayed.d.ts.map +1 -0
  134. package/dist/flows/flow-delayed.js +60 -0
  135. package/dist/flows/flow-delayed.js.map +1 -0
  136. package/dist/flows/flow-queue.d.ts +10 -0
  137. package/dist/flows/flow-queue.d.ts.map +1 -0
  138. package/dist/flows/flow-queue.js +25 -0
  139. package/dist/flows/flow-queue.js.map +1 -0
  140. package/dist/flows/scheduler.d.ts +0 -12
  141. package/dist/flows/scheduler.d.ts.map +1 -1
  142. package/dist/flows/scheduler.js +15 -0
  143. package/dist/flows/scheduler.js.map +1 -1
  144. package/dist/flows/schema.d.ts +17 -0
  145. package/dist/flows/schema.d.ts.map +1 -1
  146. package/dist/flows/schema.js +2 -0
  147. package/dist/flows/schema.js.map +1 -1
  148. package/dist/flows/step-consumer.d.ts +24 -0
  149. package/dist/flows/step-consumer.d.ts.map +1 -0
  150. package/dist/flows/step-consumer.js +72 -0
  151. package/dist/flows/step-consumer.js.map +1 -0
  152. package/dist/flows/triggers.d.ts +1 -1
  153. package/dist/flows/triggers.d.ts.map +1 -1
  154. package/dist/flows/triggers.js +5 -7
  155. package/dist/flows/triggers.js.map +1 -1
  156. package/dist/governance/capability-source-scan.d.ts +7 -0
  157. package/dist/governance/capability-source-scan.d.ts.map +1 -0
  158. package/dist/governance/capability-source-scan.js +80 -0
  159. package/dist/governance/capability-source-scan.js.map +1 -0
  160. package/dist/governance/rules/architecture.d.ts.map +1 -1
  161. package/dist/governance/rules/architecture.js +2 -0
  162. package/dist/governance/rules/architecture.js.map +1 -1
  163. package/dist/governance/rules/capability-dependencies.d.ts +8 -0
  164. package/dist/governance/rules/capability-dependencies.d.ts.map +1 -0
  165. package/dist/governance/rules/capability-dependencies.js +195 -0
  166. package/dist/governance/rules/capability-dependencies.js.map +1 -0
  167. package/dist/governance/rules/index.d.ts +2 -0
  168. package/dist/governance/rules/index.d.ts.map +1 -1
  169. package/dist/governance/rules/index.js +2 -0
  170. package/dist/governance/rules/index.js.map +1 -1
  171. package/dist/governance/rules/worker.d.ts +9 -0
  172. package/dist/governance/rules/worker.d.ts.map +1 -0
  173. package/dist/governance/rules/worker.js +89 -0
  174. package/dist/governance/rules/worker.js.map +1 -0
  175. package/dist/index.d.ts +6 -1
  176. package/dist/index.d.ts.map +1 -1
  177. package/dist/index.js +3 -1
  178. package/dist/index.js.map +1 -1
  179. package/dist/jobs/dispatch.d.ts +18 -0
  180. package/dist/jobs/dispatch.d.ts.map +1 -0
  181. package/dist/jobs/dispatch.js +50 -0
  182. package/dist/jobs/dispatch.js.map +1 -0
  183. package/dist/jobs/index.d.ts +9 -0
  184. package/dist/jobs/index.d.ts.map +1 -0
  185. package/dist/jobs/index.js +8 -0
  186. package/dist/jobs/index.js.map +1 -0
  187. package/dist/jobs/routes.d.ts +10 -0
  188. package/dist/jobs/routes.d.ts.map +1 -0
  189. package/dist/jobs/routes.js +44 -0
  190. package/dist/jobs/routes.js.map +1 -0
  191. package/dist/jobs/schema.d.ts +264 -0
  192. package/dist/jobs/schema.d.ts.map +1 -0
  193. package/dist/jobs/schema.js +34 -0
  194. package/dist/jobs/schema.js.map +1 -0
  195. package/dist/jobs/service.d.ts +52 -0
  196. package/dist/jobs/service.d.ts.map +1 -0
  197. package/dist/jobs/service.js +168 -0
  198. package/dist/jobs/service.js.map +1 -0
  199. package/dist/jobs/types.d.ts +30 -0
  200. package/dist/jobs/types.d.ts.map +1 -0
  201. package/dist/jobs/types.js +4 -0
  202. package/dist/jobs/types.js.map +1 -0
  203. package/dist/mcp/manifest-generator.d.ts.map +1 -1
  204. package/dist/mcp/manifest-generator.js +3 -2
  205. package/dist/mcp/manifest-generator.js.map +1 -1
  206. package/dist/observability/metrics.d.ts +9 -1
  207. package/dist/observability/metrics.d.ts.map +1 -1
  208. package/dist/observability/metrics.js +28 -1
  209. package/dist/observability/metrics.js.map +1 -1
  210. package/dist/runtime/bootstrap.d.ts +51 -0
  211. package/dist/runtime/bootstrap.d.ts.map +1 -0
  212. package/dist/runtime/bootstrap.js +140 -0
  213. package/dist/runtime/bootstrap.js.map +1 -0
  214. package/dist/runtime/index.d.ts +7 -0
  215. package/dist/runtime/index.d.ts.map +1 -0
  216. package/dist/runtime/index.js +6 -0
  217. package/dist/runtime/index.js.map +1 -0
  218. package/dist/runtime/load-extensions.d.ts +4 -0
  219. package/dist/runtime/load-extensions.d.ts.map +1 -0
  220. package/dist/runtime/load-extensions.js +41 -0
  221. package/dist/runtime/load-extensions.js.map +1 -0
  222. package/dist/runtime/queue-factory.d.ts +44 -0
  223. package/dist/runtime/queue-factory.d.ts.map +1 -0
  224. package/dist/runtime/queue-factory.js +156 -0
  225. package/dist/runtime/queue-factory.js.map +1 -0
  226. package/dist/runtime/register-consumers.d.ts +29 -0
  227. package/dist/runtime/register-consumers.d.ts.map +1 -0
  228. package/dist/runtime/register-consumers.js +233 -0
  229. package/dist/runtime/register-consumers.js.map +1 -0
  230. package/dist/runtime/start-worker-pool.d.ts +32 -0
  231. package/dist/runtime/start-worker-pool.d.ts.map +1 -0
  232. package/dist/runtime/start-worker-pool.js +91 -0
  233. package/dist/runtime/start-worker-pool.js.map +1 -0
  234. package/dist/runtime/worker-health.d.ts +19 -0
  235. package/dist/runtime/worker-health.d.ts.map +1 -0
  236. package/dist/runtime/worker-health.js +41 -0
  237. package/dist/runtime/worker-health.js.map +1 -0
  238. package/dist/server/bootstrap.d.ts +6 -0
  239. package/dist/server/bootstrap.d.ts.map +1 -1
  240. package/dist/server/bootstrap.js +18 -1
  241. package/dist/server/bootstrap.js.map +1 -1
  242. package/dist/testing/context.d.ts +3 -0
  243. package/dist/testing/context.d.ts.map +1 -1
  244. package/dist/testing/context.js +10 -0
  245. package/dist/testing/context.js.map +1 -1
  246. package/dist/testing/simulate-flow.d.ts.map +1 -1
  247. package/dist/testing/simulate-flow.js +10 -0
  248. package/dist/testing/simulate-flow.js.map +1 -1
  249. package/dist/types/capability.d.ts +8 -0
  250. package/dist/types/capability.d.ts.map +1 -1
  251. package/dist/types/capability.js.map +1 -1
  252. package/dist/types/config.d.ts +2 -0
  253. package/dist/types/config.d.ts.map +1 -1
  254. package/dist/types/context.d.ts +34 -1
  255. package/dist/types/context.d.ts.map +1 -1
  256. package/dist/types/enums.d.ts +1 -0
  257. package/dist/types/enums.d.ts.map +1 -1
  258. package/dist/types/enums.js +1 -0
  259. package/dist/types/enums.js.map +1 -1
  260. package/dist/types/errors.d.ts +1 -0
  261. package/dist/types/errors.d.ts.map +1 -1
  262. package/dist/types/event.d.ts +10 -0
  263. package/dist/types/event.d.ts.map +1 -1
  264. package/dist/types/event.js +5 -1
  265. package/dist/types/event.js.map +1 -1
  266. package/dist/worker/bootstrap.d.ts +32 -1
  267. package/dist/worker/bootstrap.d.ts.map +1 -1
  268. package/dist/worker/bootstrap.js +166 -2
  269. package/dist/worker/bootstrap.js.map +1 -1
  270. package/instructions/capabilities.md +36 -1
  271. package/instructions/deployment.md +96 -11
  272. package/instructions/events.md +11 -0
  273. package/instructions/flows.md +12 -4
  274. package/instructions/governance.md +6 -0
  275. package/instructions/mcp.md +1 -1
  276. package/instructions/patterns.md +1 -0
  277. package/instructions/security.md +9 -0
  278. package/instructions/testing.md +12 -1
  279. package/instructions/upgrading-0.5-capabilities.md +181 -0
  280. package/package.json +12 -4
@@ -15,7 +15,7 @@ import { runCapability, simulateFlow, mockAI, createTestContext } from "@plumbus
15
15
  Execute a capability in an isolated test environment:
16
16
 
17
17
  ```ts
18
- const result = await runCapability("getUser", {
18
+ const result = await runCapability(getUser, {
19
19
  input: { userId: "usr_123" },
20
20
  auth: { userId: "admin_1", roles: ["admin"], scopes: [], provider: "test" },
21
21
  data: {
@@ -69,6 +69,17 @@ const ctx = createTestContext({
69
69
  User: [{ id: "usr_1", name: "Alice" }],
70
70
  Order: [],
71
71
  },
72
+ // Register capabilities for ctx.capabilities.invoke (canonical names)
73
+ capabilities: [getInvoice, chargeCard],
74
+ });
75
+ ```
76
+
77
+ Use **canonical names** (`users.getUser`, `billing.getInvoice`) in flow `capabilityResults` keys and invoke calls. Pass `capabilities` to `simulateFlow` when you need production-like step execution (including job blocking for `kind: 'job'` steps):
78
+
79
+ ```ts
80
+ const execution = await simulateFlow(myFlow, input, {
81
+ capabilities: [validateOrder, processPayment],
82
+ auth: { roles: ["admin"], tenantId: "t-1" },
72
83
  });
73
84
  ```
74
85
 
@@ -0,0 +1,181 @@
1
+ # Upgrading to 0.5 — Capability Invocation
2
+
3
+ Use this playbook when upgrading `@plumbus/core` to **0.5.x** and fixing existing app code. For workers, queues, and job HTTP behavior, also read `node_modules/@plumbus/core/instructions/deployment.md` (Upgrading to 0.5).
4
+
5
+ ## What changed
6
+
7
+ Plumbus **0.5.0** enforces:
8
+
9
+ - **Canonical capability names** — `<domain>.<name>` everywhere except the short `name` field inside `defineCapability`.
10
+ - **Declared invoke dependencies** — `effects.capabilities` + `ctx.capabilities.invoke` (no direct handler imports).
11
+ - **Flow step auth snapshot** — user-triggered flows keep the caller's roles; no implicit `system` elevation on every step.
12
+ - **Job blocking** — `kind: 'job'` capabilities cannot run synchronously in flow steps or via `ctx.capabilities.invoke`.
13
+
14
+ The local `name` in `defineCapability` stays short (`approveRefund`). The framework derives `billing.approveRefund` from `domain: "billing"` + `name: "approveRefund"`.
15
+
16
+ ---
17
+
18
+ ## 1. Canonical capability names
19
+
20
+ Update every **reference** string (not the `name` field in `defineCapability`):
21
+
22
+ | Location | Before | After |
23
+ |----------|--------|-------|
24
+ | Flow step | `capability: "validateOrder"` | `capability: "orders.validateOrder"` |
25
+ | `effects.capabilities` | `["getInvoice"]` | `["billing.getInvoice"]` |
26
+ | `ctx.capabilities.invoke` | `"chargeCard"` | `"billing.chargeCard"` |
27
+ | Tests / mocks | short names | canonical names |
28
+ | MCP tool names (manifest) | short names | canonical names (after `plumbus generate`) |
29
+
30
+ Search the codebase for hard-coded capability strings in:
31
+
32
+ - `app/flows/**` — `step.capability`
33
+ - `app/capabilities/**` — `effects.capabilities`, `ctx.capabilities.invoke`
34
+ - Tests — registries, `simulateFlow`, `runCapability`, mocks
35
+ - Generated artifacts — refresh with `plumbus generate` (see step 5)
36
+
37
+ ---
38
+
39
+ ## 2. `effects.capabilities` + `ctx.capabilities.invoke`
40
+
41
+ Replace direct handler imports and `.handler` calls with the sanctioned invoke path:
42
+
43
+ ```ts
44
+ // Before — forbidden
45
+ import { getInvoice } from "../billing/get-invoice/index.js";
46
+ await getInvoice.handler(ctx, { invoiceId });
47
+
48
+ // After
49
+ effects: {
50
+ data: ["Invoice"],
51
+ events: [],
52
+ external: [],
53
+ capabilities: ["billing.getInvoice"],
54
+ ai: false,
55
+ },
56
+ handler: async (ctx, input) => {
57
+ const invoice = await ctx.capabilities.invoke("billing.getInvoice", {
58
+ invoiceId: input.invoiceId,
59
+ });
60
+ return { invoice };
61
+ },
62
+ ```
63
+
64
+ Rules:
65
+
66
+ - Every `ctx.capabilities.invoke` target must appear in `effects.capabilities` (canonical names).
67
+ - Undeclared calls, cycles, missing targets → runtime `dependencyViolation` (`400`).
68
+ - `plumbus verify` flags direct handler imports (`architecture.direct-capability-handler-import`).
69
+ - Handler-visible `ctx.__runtime` no longer exposes internal invokers — use `ctx.capabilities.invoke` only.
70
+ - `executeCapability` is for framework wiring and tests, not app handlers.
71
+
72
+ ---
73
+
74
+ ## 3. Flow `step.capability` format
75
+
76
+ Flow steps must use canonical names:
77
+
78
+ ```ts
79
+ steps: [
80
+ { type: "capability", name: "validate", capability: "orders.validateOrder" },
81
+ { type: "capability", name: "charge", capability: "billing.chargeCard" },
82
+ ]
83
+ ```
84
+
85
+ Flow steps are **not** subject to a parent capability's `effects.capabilities` — only handler-to-handler `invoke` requires declared dependencies.
86
+
87
+ ---
88
+
89
+ ## 4. Flow auth snapshot
90
+
91
+ **Breaking:** user-triggered flows no longer auto-inject the `system` role on every step.
92
+
93
+ When a flow starts, the framework stores the caller's full `AuthContext` in `flow_executions.auth_snapshot_json` and restores it on each step. Step capabilities must allow the **original caller's** roles/scopes (or `public`) — not rely on implicit `system` elevation.
94
+
95
+ ```ts
96
+ // Fix access policies on capabilities called from user-triggered flows
97
+ access: {
98
+ roles: ["admin", "billing"], // include roles the HTTP/API caller actually has
99
+ tenantScoped: true,
100
+ },
101
+ ```
102
+
103
+ Scheduled and worker-owned flows still run under explicit `system` auth from the scheduler/worker bootstrap.
104
+
105
+ If steps suddenly return **403** after upgrade, check `access.roles` on step targets — add the caller's roles or mark `public: true` where appropriate.
106
+
107
+ ---
108
+
109
+ ## 5. Job capabilities blocked in flows and invoke
110
+
111
+ `kind: 'job'` capabilities cannot run synchronously:
112
+
113
+ - **Flow steps** — step executor returns `dependencyViolation`.
114
+ - **`ctx.capabilities.invoke`** — same error at runtime.
115
+
116
+ Use job dispatch (`POST` → **202** + poll `GET /api/jobs/:jobId`), events, or async `eventHandler` consumers instead.
117
+
118
+ ---
119
+
120
+ ## 6. MCP tool names
121
+
122
+ After renaming references, run `plumbus generate` so `mcp-manifest.json` and skill files use canonical tool names (`billing.approveRefund`, not `approveRefund`). Update any agent configs or integration tests that assert tool names.
123
+
124
+ ---
125
+
126
+ ## Migration commands
127
+
128
+ Run from the project root in this order:
129
+
130
+ ```bash
131
+ # 1. Fix source strings (canonical names, effects, invoke, access.roles) — see checklist below
132
+
133
+ # 2. Regenerate types and manifests
134
+ plumbus generate
135
+
136
+ # 3. Verify architecture rules
137
+ plumbus verify
138
+
139
+ # 4. Database — job_executions + flow auth_snapshot_json (if upgrading from pre-0.5)
140
+ plumbus migrate generate && plumbus migrate apply
141
+ ```
142
+
143
+ Apply migrations **before** production traffic. The migration adds `auth_snapshot_json` on `flow_executions` (and `job_executions` for job queue auth). Rows created before the column exists fall back to worker auth for roles until migrated.
144
+
145
+ Refresh agent wiring after framework upgrade:
146
+
147
+ ```bash
148
+ plumbus init --patch
149
+ plumbus doctor
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Agent checklist
155
+
156
+ Work through this list when upgrading an existing Plumbus app to 0.5.x:
157
+
158
+ - [ ] **Flow steps** — every `step.capability` uses `<domain>.<name>`
159
+ - [ ] **`effects.capabilities`** — every invoke target listed with canonical names
160
+ - [ ] **Handlers** — replace direct handler imports with `ctx.capabilities.invoke`
161
+ - [ ] **Tests** — update capability name strings in fixtures, mocks, and `simulateFlow` options
162
+ - [ ] **Flow access** — step target capabilities allow caller roles (not only `system`) for user-triggered flows
163
+ - [ ] **Job flows** — remove `kind: 'job'` from flow steps; use async dispatch instead
164
+ - [ ] **MCP** — run `plumbus generate`; update tool name references if exposed via MCP
165
+ - [ ] **`plumbus generate`** — refresh `RegisteredCapabilityName`, `capability-graph.md`, MCP manifest
166
+ - [ ] **`plumbus verify`** — zero `non-canonical-capability-reference` and `direct-capability-handler-import` warnings
167
+ - [ ] **`plumbus migrate generate && apply`** — `auth_snapshot_json` on `flow_executions` (+ `job_executions`)
168
+ - [ ] **Job HTTP clients** — expect **202** + poll `GET /api/jobs/:jobId` (see `deployment.md`)
169
+ - [ ] **`plumbus init --patch`** — refresh agent wiring to pick up this playbook
170
+
171
+ ---
172
+
173
+ ## Further reading
174
+
175
+ | Topic | Location |
176
+ |-------|----------|
177
+ | Invoke policy and effects | `node_modules/@plumbus/core/instructions/capabilities.md` |
178
+ | Flow step auth and job blocking | `node_modules/@plumbus/core/instructions/flows.md` |
179
+ | Security model (auth snapshot) | `node_modules/@plumbus/core/instructions/security.md` |
180
+ | Production deploy + workers | `node_modules/@plumbus/core/instructions/deployment.md` |
181
+ | MCP exposure | `node_modules/@plumbus/core/instructions/mcp.md` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumbus/core",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Plumbus framework core — types, SDK, runtime, CLI, test utilities",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -70,7 +70,9 @@
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@plumbus/api": "0.1.x",
73
- "@plumbus/mcp": "0.4.x"
73
+ "@plumbus/mcp": "0.5.x",
74
+ "cron-parser": "^4.9.0",
75
+ "redis": "^4.7.0"
74
76
  },
75
77
  "peerDependenciesMeta": {
76
78
  "@plumbus/api": {
@@ -78,6 +80,12 @@
78
80
  },
79
81
  "@plumbus/mcp": {
80
82
  "optional": true
83
+ },
84
+ "cron-parser": {
85
+ "optional": true
86
+ },
87
+ "redis": {
88
+ "optional": true
81
89
  }
82
90
  },
83
91
  "devDependencies": {
@@ -85,8 +93,8 @@
85
93
  "@types/node": "^25.4.0",
86
94
  "@vitest/browser": "^3.0.0",
87
95
  "typescript": "^5.7.0",
88
- "@plumbus/api": "0.1.0",
89
- "@plumbus/mcp": "0.4.1"
96
+ "@plumbus/mcp": "0.5.0",
97
+ "@plumbus/api": "0.1.1"
90
98
  },
91
99
  "scripts": {
92
100
  "build": "tsc -b",