@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.
- package/README.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/api/route-generator.d.ts.map +1 -1
- package/dist/api/route-generator.js +27 -14
- package/dist/api/route-generator.js.map +1 -1
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +2 -1
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +38 -149
- package/dist/cli/commands/dev.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts +6 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +92 -4
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/event.d.ts.map +1 -1
- package/dist/cli/commands/event.js +3 -0
- package/dist/cli/commands/event.js.map +1 -1
- package/dist/cli/commands/events-ops.d.ts +4 -0
- package/dist/cli/commands/events-ops.d.ts.map +1 -0
- package/dist/cli/commands/events-ops.js +203 -0
- package/dist/cli/commands/events-ops.js.map +1 -0
- package/dist/cli/commands/flow.d.ts.map +1 -1
- package/dist/cli/commands/flow.js +49 -1
- package/dist/cli/commands/flow.js.map +1 -1
- package/dist/cli/commands/generate.d.ts +4 -0
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +94 -3
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +1 -0
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +13 -3
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/mcp.d.ts.map +1 -1
- package/dist/cli/commands/mcp.js +2 -0
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/start.d.ts +3 -6
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +71 -180
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/verify.d.ts +3 -1
- package/dist/cli/commands/verify.d.ts.map +1 -1
- package/dist/cli/commands/verify.js +17 -9
- package/dist/cli/commands/verify.js.map +1 -1
- package/dist/cli/commands/worker.d.ts +19 -0
- package/dist/cli/commands/worker.d.ts.map +1 -0
- package/dist/cli/commands/worker.js +234 -0
- package/dist/cli/commands/worker.js.map +1 -0
- package/dist/cli/mcp-serve-context.d.ts +3 -0
- package/dist/cli/mcp-serve-context.d.ts.map +1 -1
- package/dist/cli/mcp-serve-context.js +16 -1
- package/dist/cli/mcp-serve-context.js.map +1 -1
- package/dist/cli/templates/resources.d.ts.map +1 -1
- package/dist/cli/templates/resources.js +7 -2
- package/dist/cli/templates/resources.js.map +1 -1
- package/dist/cli/utils.d.ts +4 -0
- package/dist/cli/utils.d.ts.map +1 -1
- package/dist/cli/utils.js +9 -0
- package/dist/cli/utils.js.map +1 -1
- package/dist/data/drift-inspector.d.ts +2 -2
- package/dist/data/drift-inspector.d.ts.map +1 -1
- package/dist/data/drift-inspector.js +2 -1
- package/dist/data/drift-inspector.js.map +1 -1
- package/dist/data/migration.d.ts.map +1 -1
- package/dist/data/migration.js +2 -0
- package/dist/data/migration.js.map +1 -1
- package/dist/define/defineCapability.d.ts +5 -0
- package/dist/define/defineCapability.d.ts.map +1 -1
- package/dist/define/defineCapability.js +23 -0
- package/dist/define/defineCapability.js.map +1 -1
- package/dist/errors/http.d.ts.map +1 -1
- package/dist/errors/http.js +1 -0
- package/dist/errors/http.js.map +1 -1
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +1 -0
- package/dist/errors/index.js.map +1 -1
- package/dist/events/dispatcher.d.ts +4 -0
- package/dist/events/dispatcher.d.ts.map +1 -1
- package/dist/events/dispatcher.js +24 -1
- package/dist/events/dispatcher.js.map +1 -1
- package/dist/events/emitter.d.ts +2 -0
- package/dist/events/emitter.d.ts.map +1 -1
- package/dist/events/emitter.js +6 -3
- package/dist/events/emitter.js.map +1 -1
- package/dist/events/queue-adapter.d.ts +7 -0
- package/dist/events/queue-adapter.d.ts.map +1 -0
- package/dist/events/queue-adapter.js +4 -0
- package/dist/events/queue-adapter.js.map +1 -0
- package/dist/events/queue.d.ts +16 -13
- package/dist/events/queue.d.ts.map +1 -1
- package/dist/events/queue.js +79 -22
- package/dist/events/queue.js.map +1 -1
- package/dist/events/worker.d.ts +4 -0
- package/dist/events/worker.d.ts.map +1 -1
- package/dist/events/worker.js +47 -1
- package/dist/events/worker.js.map +1 -1
- package/dist/execution/canonical-name.d.ts +13 -0
- package/dist/execution/canonical-name.d.ts.map +1 -0
- package/dist/execution/canonical-name.js +17 -0
- package/dist/execution/canonical-name.js.map +1 -0
- package/dist/execution/capability-executor.d.ts +1 -1
- package/dist/execution/capability-executor.d.ts.map +1 -1
- package/dist/execution/capability-executor.js +52 -24
- package/dist/execution/capability-executor.js.map +1 -1
- package/dist/execution/capability-invocation.d.ts +34 -0
- package/dist/execution/capability-invocation.d.ts.map +1 -0
- package/dist/execution/capability-invocation.js +138 -0
- package/dist/execution/capability-invocation.js.map +1 -0
- package/dist/execution/capability-registry.d.ts +6 -4
- package/dist/execution/capability-registry.d.ts.map +1 -1
- package/dist/execution/capability-registry.js +13 -7
- package/dist/execution/capability-registry.js.map +1 -1
- package/dist/execution/context-factory.d.ts.map +1 -1
- package/dist/execution/context-factory.js +12 -1
- package/dist/execution/context-factory.js.map +1 -1
- package/dist/execution/index.d.ts +4 -0
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +2 -0
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/invocation-emit-scope.d.ts +11 -0
- package/dist/execution/invocation-emit-scope.d.ts.map +1 -0
- package/dist/execution/invocation-emit-scope.js +8 -0
- package/dist/execution/invocation-emit-scope.js.map +1 -0
- package/dist/flows/engine.d.ts +7 -1
- package/dist/flows/engine.d.ts.map +1 -1
- package/dist/flows/engine.js +73 -10
- package/dist/flows/engine.js.map +1 -1
- package/dist/flows/flow-delayed.d.ts +34 -0
- package/dist/flows/flow-delayed.d.ts.map +1 -0
- package/dist/flows/flow-delayed.js +60 -0
- package/dist/flows/flow-delayed.js.map +1 -0
- package/dist/flows/flow-queue.d.ts +10 -0
- package/dist/flows/flow-queue.d.ts.map +1 -0
- package/dist/flows/flow-queue.js +25 -0
- package/dist/flows/flow-queue.js.map +1 -0
- package/dist/flows/scheduler.d.ts +0 -12
- package/dist/flows/scheduler.d.ts.map +1 -1
- package/dist/flows/scheduler.js +15 -0
- package/dist/flows/scheduler.js.map +1 -1
- package/dist/flows/schema.d.ts +17 -0
- package/dist/flows/schema.d.ts.map +1 -1
- package/dist/flows/schema.js +2 -0
- package/dist/flows/schema.js.map +1 -1
- package/dist/flows/step-consumer.d.ts +24 -0
- package/dist/flows/step-consumer.d.ts.map +1 -0
- package/dist/flows/step-consumer.js +72 -0
- package/dist/flows/step-consumer.js.map +1 -0
- package/dist/flows/triggers.d.ts +1 -1
- package/dist/flows/triggers.d.ts.map +1 -1
- package/dist/flows/triggers.js +5 -7
- package/dist/flows/triggers.js.map +1 -1
- package/dist/governance/capability-source-scan.d.ts +7 -0
- package/dist/governance/capability-source-scan.d.ts.map +1 -0
- package/dist/governance/capability-source-scan.js +80 -0
- package/dist/governance/capability-source-scan.js.map +1 -0
- package/dist/governance/rules/architecture.d.ts.map +1 -1
- package/dist/governance/rules/architecture.js +2 -0
- package/dist/governance/rules/architecture.js.map +1 -1
- package/dist/governance/rules/capability-dependencies.d.ts +8 -0
- package/dist/governance/rules/capability-dependencies.d.ts.map +1 -0
- package/dist/governance/rules/capability-dependencies.js +195 -0
- package/dist/governance/rules/capability-dependencies.js.map +1 -0
- package/dist/governance/rules/index.d.ts +2 -0
- package/dist/governance/rules/index.d.ts.map +1 -1
- package/dist/governance/rules/index.js +2 -0
- package/dist/governance/rules/index.js.map +1 -1
- package/dist/governance/rules/worker.d.ts +9 -0
- package/dist/governance/rules/worker.d.ts.map +1 -0
- package/dist/governance/rules/worker.js +89 -0
- package/dist/governance/rules/worker.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/jobs/dispatch.d.ts +18 -0
- package/dist/jobs/dispatch.d.ts.map +1 -0
- package/dist/jobs/dispatch.js +50 -0
- package/dist/jobs/dispatch.js.map +1 -0
- package/dist/jobs/index.d.ts +9 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +8 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/routes.d.ts +10 -0
- package/dist/jobs/routes.d.ts.map +1 -0
- package/dist/jobs/routes.js +44 -0
- package/dist/jobs/routes.js.map +1 -0
- package/dist/jobs/schema.d.ts +264 -0
- package/dist/jobs/schema.d.ts.map +1 -0
- package/dist/jobs/schema.js +34 -0
- package/dist/jobs/schema.js.map +1 -0
- package/dist/jobs/service.d.ts +52 -0
- package/dist/jobs/service.d.ts.map +1 -0
- package/dist/jobs/service.js +168 -0
- package/dist/jobs/service.js.map +1 -0
- package/dist/jobs/types.d.ts +30 -0
- package/dist/jobs/types.d.ts.map +1 -0
- package/dist/jobs/types.js +4 -0
- package/dist/jobs/types.js.map +1 -0
- package/dist/mcp/manifest-generator.d.ts.map +1 -1
- package/dist/mcp/manifest-generator.js +3 -2
- package/dist/mcp/manifest-generator.js.map +1 -1
- package/dist/observability/metrics.d.ts +9 -1
- package/dist/observability/metrics.d.ts.map +1 -1
- package/dist/observability/metrics.js +28 -1
- package/dist/observability/metrics.js.map +1 -1
- package/dist/runtime/bootstrap.d.ts +51 -0
- package/dist/runtime/bootstrap.d.ts.map +1 -0
- package/dist/runtime/bootstrap.js +140 -0
- package/dist/runtime/bootstrap.js.map +1 -0
- package/dist/runtime/index.d.ts +7 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +6 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/load-extensions.d.ts +4 -0
- package/dist/runtime/load-extensions.d.ts.map +1 -0
- package/dist/runtime/load-extensions.js +41 -0
- package/dist/runtime/load-extensions.js.map +1 -0
- package/dist/runtime/queue-factory.d.ts +44 -0
- package/dist/runtime/queue-factory.d.ts.map +1 -0
- package/dist/runtime/queue-factory.js +156 -0
- package/dist/runtime/queue-factory.js.map +1 -0
- package/dist/runtime/register-consumers.d.ts +29 -0
- package/dist/runtime/register-consumers.d.ts.map +1 -0
- package/dist/runtime/register-consumers.js +233 -0
- package/dist/runtime/register-consumers.js.map +1 -0
- package/dist/runtime/start-worker-pool.d.ts +32 -0
- package/dist/runtime/start-worker-pool.d.ts.map +1 -0
- package/dist/runtime/start-worker-pool.js +91 -0
- package/dist/runtime/start-worker-pool.js.map +1 -0
- package/dist/runtime/worker-health.d.ts +19 -0
- package/dist/runtime/worker-health.d.ts.map +1 -0
- package/dist/runtime/worker-health.js +41 -0
- package/dist/runtime/worker-health.js.map +1 -0
- package/dist/server/bootstrap.d.ts +6 -0
- package/dist/server/bootstrap.d.ts.map +1 -1
- package/dist/server/bootstrap.js +18 -1
- package/dist/server/bootstrap.js.map +1 -1
- package/dist/testing/context.d.ts +3 -0
- package/dist/testing/context.d.ts.map +1 -1
- package/dist/testing/context.js +10 -0
- package/dist/testing/context.js.map +1 -1
- package/dist/testing/simulate-flow.d.ts.map +1 -1
- package/dist/testing/simulate-flow.js +10 -0
- package/dist/testing/simulate-flow.js.map +1 -1
- package/dist/types/capability.d.ts +8 -0
- package/dist/types/capability.d.ts.map +1 -1
- package/dist/types/capability.js.map +1 -1
- package/dist/types/config.d.ts +2 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/context.d.ts +34 -1
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/enums.d.ts +1 -0
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/enums.js +1 -0
- package/dist/types/enums.js.map +1 -1
- package/dist/types/errors.d.ts +1 -0
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/event.d.ts +10 -0
- package/dist/types/event.d.ts.map +1 -1
- package/dist/types/event.js +5 -1
- package/dist/types/event.js.map +1 -1
- package/dist/worker/bootstrap.d.ts +32 -1
- package/dist/worker/bootstrap.d.ts.map +1 -1
- package/dist/worker/bootstrap.js +166 -2
- package/dist/worker/bootstrap.js.map +1 -1
- package/instructions/capabilities.md +36 -1
- package/instructions/deployment.md +96 -11
- package/instructions/events.md +11 -0
- package/instructions/flows.md +12 -4
- package/instructions/governance.md +6 -0
- package/instructions/mcp.md +1 -1
- package/instructions/patterns.md +1 -0
- package/instructions/security.md +9 -0
- package/instructions/testing.md +12 -1
- package/instructions/upgrading-0.5-capabilities.md +181 -0
- package/package.json +12 -4
package/instructions/testing.md
CHANGED
|
@@ -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(
|
|
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.
|
|
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.
|
|
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/
|
|
89
|
-
"@plumbus/
|
|
96
|
+
"@plumbus/mcp": "0.5.0",
|
|
97
|
+
"@plumbus/api": "0.1.1"
|
|
90
98
|
},
|
|
91
99
|
"scripts": {
|
|
92
100
|
"build": "tsc -b",
|