@bpmnkit/docspack 0.0.1
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/.llms/chunks/cli.casen.aikit-skills.md +19 -0
- package/.llms/chunks/cli.casen.bpmn-generation-pipeline.md +32 -0
- package/.llms/chunks/cli.casen.connection-profiles.md +62 -0
- package/.llms/chunks/cli.casen.generate-bpmn-files.md +28 -0
- package/.llms/chunks/cli.casen.md +80 -0
- package/.llms/chunks/cli.casen.plugins.md +56 -0
- package/.llms/chunks/cli.casen.worker-commands.md +45 -0
- package/.llms/chunks/cli.connector.all-flags.md +29 -0
- package/.llms/chunks/cli.connector.browse-the-bundled-ootb-catalog.md +32 -0
- package/.llms/chunks/cli.connector.built-in-catalog.md +41 -0
- package/.llms/chunks/cli.connector.common-workflows.md +50 -0
- package/.llms/chunks/cli.connector.generate-from-the-openapi-catalog.md +30 -0
- package/.llms/chunks/cli.connector.md +20 -0
- package/.llms/chunks/cli.connector.programmatic-usage.md +7 -0
- package/.llms/chunks/cli.connector.what-gets-generated.md +20 -0
- package/.llms/chunks/cli.generate.definition-mode-ai-scripting-path.md +89 -0
- package/.llms/chunks/cli.generate.md +52 -0
- package/.llms/chunks/cli.generate.modify-existing-mode-input.md +59 -0
- package/.llms/chunks/cli.generate.typical-ai-workflow.md +18 -0
- package/.llms/chunks/cli.plugin-authoring.md +59 -0
- package/.llms/chunks/cli.plugin-authoring.plugin-naming-conventions.md +11 -0
- package/.llms/chunks/cli.plugin-authoring.test-locally.md +41 -0
- package/.llms/chunks/cli.plugin-authoring.the-bpmnkit-cli-sdk-sdk.md +82 -0
- package/.llms/chunks/cli.plugin-authoring.what-gets-generated.md +69 -0
- package/.llms/chunks/cli.plugin-authoring.writing-commands.md +84 -0
- package/.llms/chunks/cli.plugins.bpmnkit-casen-report.md +39 -0
- package/.llms/chunks/cli.plugins.bpmnkit-casen-worker-http.md +23 -0
- package/.llms/chunks/cli.plugins.md +25 -0
- package/.llms/chunks/cli.skills.deploy.md +24 -0
- package/.llms/chunks/cli.skills.implement.md +36 -0
- package/.llms/chunks/cli.skills.md +29 -0
- package/.llms/chunks/cli.skills.no-mcp-server-required.md +6 -0
- package/.llms/chunks/cli.skills.review.md +33 -0
- package/.llms/chunks/cli.skills.test.md +33 -0
- package/.llms/chunks/cli.view.folder-support.md +31 -0
- package/.llms/chunks/cli.view.md +70 -0
- package/.llms/chunks/cli.view.tabbed-navigation.md +28 -0
- package/.llms/chunks/getting-started.concepts.ai-compact-format.md +23 -0
- package/.llms/chunks/getting-started.concepts.auto-layout.md +24 -0
- package/.llms/chunks/getting-started.concepts.parsing-and-serializing.md +26 -0
- package/.llms/chunks/getting-started.concepts.the-fluent-builder.md +41 -0
- package/.llms/chunks/getting-started.concepts.zeebe-extensions.md +25 -0
- package/.llms/chunks/getting-started.installation.md +38 -0
- package/.llms/chunks/getting-started.installation.runtime-requirements.md +13 -0
- package/.llms/chunks/getting-started.installation.svg-canvas-viewer.md +41 -0
- package/.llms/chunks/getting-started.installation.worker-client.md +40 -0
- package/.llms/chunks/getting-started.quick-start.md +31 -0
- package/.llms/chunks/getting-started.quick-start.step-2-simulate-locally.md +28 -0
- package/.llms/chunks/getting-started.quick-start.step-3-deploy-to-camunda-8.md +33 -0
- package/.llms/chunks/getting-started.quick-start.what-s-next.md +14 -0
- package/.llms/chunks/guides.ai-agents.deploy-grade-validation.md +19 -0
- package/.llms/chunks/guides.ai-agents.how-it-s-modeled.md +11 -0
- package/.llms/chunks/guides.ai-agents.md +18 -0
- package/.llms/chunks/guides.ai-agents.see-also.md +7 -0
- package/.llms/chunks/guides.ai-agents.testing-without-a-real-llm-call.md +26 -0
- package/.llms/chunks/guides.ai-agents.the-aiagent-plan-step.md +62 -0
- package/.llms/chunks/guides.ai-implement.deploying.md +49 -0
- package/.llms/chunks/guides.ai-implement.extending-an-existing-process.md +10 -0
- package/.llms/chunks/guides.ai-implement.lightweight-alternative-casen-skills-install.md +28 -0
- package/.llms/chunks/guides.ai-implement.md +32 -0
- package/.llms/chunks/guides.ai-implement.the-claude-code-plugin.md +21 -0
- package/.llms/chunks/guides.ai.claude-api-example.md +41 -0
- package/.llms/chunks/guides.ai.mcp-server.md +20 -0
- package/.llms/chunks/guides.ai.md +32 -0
- package/.llms/chunks/guides.ai.minimal-empty-diagram.md +32 -0
- package/.llms/chunks/guides.ai.openai-function-calling.md +40 -0
- package/.llms/chunks/guides.building-processes.boundary-events.md +47 -0
- package/.llms/chunks/guides.building-processes.call-activities.md +47 -0
- package/.llms/chunks/guides.building-processes.events.md +57 -0
- package/.llms/chunks/guides.building-processes.multi-instance.md +20 -0
- package/.llms/chunks/guides.building-processes.service-tasks.md +39 -0
- package/.llms/chunks/guides.building-processes.sub-processes.md +40 -0
- package/.llms/chunks/guides.building-processes.task-defaults.md +18 -0
- package/.llms/chunks/guides.claude-code-plugin.ambient-hooks.md +24 -0
- package/.llms/chunks/guides.claude-code-plugin.configuration.md +126 -0
- package/.llms/chunks/guides.claude-code-plugin.md +47 -0
- package/.llms/chunks/guides.claude-code-plugin.reference-docs.md +61 -0
- package/.llms/chunks/guides.deployment.ci-cd-deploy-on-push.md +47 -0
- package/.llms/chunks/guides.deployment.deploying-a-process.md +52 -0
- package/.llms/chunks/guides.deployment.handling-jobs.md +50 -0
- package/.llms/chunks/guides.deployment.managing-incidents.md +33 -0
- package/.llms/chunks/guides.deployment.md +49 -0
- package/.llms/chunks/guides.gateways.branching-inside-sub-processes.md +27 -0
- package/.llms/chunks/guides.gateways.exclusive-gateway-xor.md +41 -0
- package/.llms/chunks/guides.gateways.inclusive-gateway-or.md +43 -0
- package/.llms/chunks/guides.gateways.nested-branching.md +27 -0
- package/.llms/chunks/guides.gateways.parallel-gateway-and.md +26 -0
- package/.llms/chunks/guides.patterns.how-matching-works.md +17 -0
- package/.llms/chunks/guides.patterns.md +26 -0
- package/.llms/chunks/guides.patterns.pattern-schema.md +38 -0
- package/.llms/chunks/guides.patterns.see-also.md +7 -0
- package/.llms/chunks/guides.patterns.using-patterns-from-the-cli.md +30 -0
- package/.llms/chunks/guides.patterns.what-a-pattern-contains.md +18 -0
- package/.llms/chunks/guides.simulation.dmn-decision-evaluation.md +51 -0
- package/.llms/chunks/guides.simulation.instance-state.md +29 -0
- package/.llms/chunks/guides.simulation.md +51 -0
- package/.llms/chunks/guides.simulation.message-correlation.md +30 -0
- package/.llms/chunks/guides.simulation.multiple-deployments.md +14 -0
- package/.llms/chunks/guides.workers-standalone.anatomy-of-a-worker.md +42 -0
- package/.llms/chunks/guides.workers-standalone.camunda-saas.md +43 -0
- package/.llms/chunks/guides.workers-standalone.environment-variables.md +14 -0
- package/.llms/chunks/guides.workers-standalone.md +35 -0
- package/.llms/chunks/guides.workers-standalone.running-workers.md +61 -0
- package/.llms/chunks/guides.workers-standalone.see-also.md +7 -0
- package/.llms/chunks/packages.api.incident-resolution.md +31 -0
- package/.llms/chunks/packages.api.observability-events.md +13 -0
- package/.llms/chunks/packages.api.overview.md +49 -0
- package/.llms/chunks/packages.api.process-operations.md +60 -0
- package/.llms/chunks/packages.api.resource-namespaces.md +20 -0
- package/.llms/chunks/packages.canvas.events.md +56 -0
- package/.llms/chunks/packages.canvas.options.md +24 -0
- package/.llms/chunks/packages.canvas.overview.md +35 -0
- package/.llms/chunks/packages.connector-gen.body-expansion.md +18 -0
- package/.llms/chunks/packages.connector-gen.catalog-reference.md +54 -0
- package/.llms/chunks/packages.connector-gen.catalogentry-type.md +21 -0
- package/.llms/chunks/packages.connector-gen.generating-from-the-catalog.md +44 -0
- package/.llms/chunks/packages.connector-gen.installation.md +42 -0
- package/.llms/chunks/packages.connector-gen.lower-level-api.md +31 -0
- package/.llms/chunks/packages.connector-gen.overview.md +16 -0
- package/.llms/chunks/packages.connector-gen.writeoptions.md +26 -0
- package/.llms/chunks/packages.core.dmn-support.md +36 -0
- package/.llms/chunks/packages.core.installation-bpmn.creatediagram-id.md +18 -0
- package/.llms/chunks/packages.core.installation-bpmn.createprocess-id-name.md +10 -0
- package/.llms/chunks/packages.core.installation-bpmn.export-definitions.md +10 -0
- package/.llms/chunks/packages.core.installation-bpmn.makeempty-processid-processname.md +11 -0
- package/.llms/chunks/packages.core.installation-bpmn.parse-xml.md +10 -0
- package/.llms/chunks/packages.core.installation-bpmn.sample_xml.md +7 -0
- package/.llms/chunks/packages.core.installation-compactify-definitions.md +13 -0
- package/.llms/chunks/packages.core.installation-expand-compact.md +13 -0
- package/.llms/chunks/packages.core.installation-layoutprocess-process.md +15 -0
- package/.llms/chunks/packages.core.installation-processbuilder-methods.md +29 -0
- package/.llms/chunks/packages.core.installation.md +11 -0
- package/.llms/chunks/packages.core.overview.md +15 -0
- package/.llms/chunks/packages.docspack.installation.md +45 -0
- package/.llms/chunks/packages.docspack.overview.md +23 -0
- package/.llms/chunks/packages.docspack.reading-it-yourself.md +34 -0
- package/.llms/chunks/packages.docspack.trust.md +13 -0
- package/.llms/chunks/packages.docspack.using-the-index-directly.md +52 -0
- package/.llms/chunks/packages.editor.basic-setup.md +41 -0
- package/.llms/chunks/packages.editor.full-editor-with-all-plugins.md +30 -0
- package/.llms/chunks/packages.editor.hud-options.md +41 -0
- package/.llms/chunks/packages.editor.overview.md +21 -0
- package/.llms/chunks/packages.engine.installation.md +77 -0
- package/.llms/chunks/packages.engine.overview.md +19 -0
- package/.llms/chunks/packages.engine.processinstance.md +17 -0
- package/.llms/chunks/packages.engine.variable-scoping.md +27 -0
- package/.llms/chunks/packages.worker-client.client.poll-jobtype-options.md +40 -0
- package/.llms/chunks/packages.worker-client.createworkerclient-options.md +32 -0
- package/.llms/chunks/packages.worker-client.job.complete-variables.md +29 -0
- package/.llms/chunks/packages.worker-client.md +33 -0
- package/.llms/chunks/packages.worker-client.oauth2-camunda-saas.md +26 -0
- package/.llms/chunks/packages.worker-client.see-also.md +7 -0
- package/.llms/manifest.json +2083 -0
- package/LICENSE +21 -0
- package/README.md +150 -0
- package/dist/build.d.ts +29 -0
- package/dist/build.js +89 -0
- package/dist/chunk.d.ts +41 -0
- package/dist/chunk.js +242 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.js +160 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +12 -0
- package/dist/load.d.ts +27 -0
- package/dist/load.js +144 -0
- package/dist/search.d.ts +53 -0
- package/dist/search.js +104 -0
- package/dist/text.d.ts +22 -0
- package/dist/text.js +204 -0
- package/dist/types.d.ts +48 -0
- package/dist/types.js +3 -0
- package/llms.txt +174 -0
- package/package.json +76 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Pattern Library — Pattern schema
|
|
2
|
+
|
|
3
|
+
```typescript
|
|
4
|
+
interface Pattern {
|
|
5
|
+
id: string
|
|
6
|
+
name: string
|
|
7
|
+
description: string
|
|
8
|
+
keywords: string[]
|
|
9
|
+
readme: string // domain context, Markdown
|
|
10
|
+
workers: WorkerSpec[]
|
|
11
|
+
variations: string // common customizations, Markdown
|
|
12
|
+
template: PatternTemplate // compact BPMN structure — a rough reference, predates ProcessPlan
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface WorkerSpec {
|
|
16
|
+
name: string
|
|
17
|
+
jobType: string
|
|
18
|
+
description: string
|
|
19
|
+
inputs: Record<string, string>
|
|
20
|
+
outputs: Record<string, string>
|
|
21
|
+
externalApis?: string[] // e.g. ["Stripe", "Adyen", "Braintree"]
|
|
22
|
+
optional?: boolean
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Adding custom patterns
|
|
28
|
+
|
|
29
|
+
Create a new pattern file in `packages/patterns/src/patterns/` and export it from `index.ts`.
|
|
30
|
+
Follow the existing patterns as a reference — each is a single TypeScript file that exports
|
|
31
|
+
a `Pattern` object.
|
|
32
|
+
|
|
33
|
+
For private or organisation-specific patterns, add them to your project and contribute the
|
|
34
|
+
pattern object to `ALL_PATTERNS` via the `findPattern` API. Contributions to the seed library
|
|
35
|
+
are welcome via pull request.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
Source: https://docs.bpmnkit.com/guides/patterns/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Pattern Library — See also
|
|
2
|
+
|
|
3
|
+
- [Building Processes with AI](/guides/ai-implement/) — how Claude uses patterns during `/bpmnkit:implement`
|
|
4
|
+
- [`@bpmnkit/patterns` source](https://github.com/bpmnkit/monorepo/tree/main/packages/patterns)
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
Source: https://docs.bpmnkit.com/guides/patterns/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Pattern Library — Using patterns from the CLI
|
|
2
|
+
|
|
3
|
+
```sh
|
|
4
|
+
casen pattern list
|
|
5
|
+
casen pattern get invoice-approval
|
|
6
|
+
casen pattern get "employee onboarding workflow" # free-text match
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Using patterns from code
|
|
11
|
+
|
|
12
|
+
You can access the pattern library directly in TypeScript:
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { ALL_PATTERNS, findPattern } from "@bpmnkit/patterns"
|
|
16
|
+
|
|
17
|
+
// List all patterns
|
|
18
|
+
console.log(ALL_PATTERNS.map((p) => p.id))
|
|
19
|
+
|
|
20
|
+
// Find by keyword match
|
|
21
|
+
const pattern = findPattern("employee onboarding workflow")
|
|
22
|
+
console.log(pattern?.id) // "employee-onboarding"
|
|
23
|
+
|
|
24
|
+
// Find by exact ID
|
|
25
|
+
const invoice = findPattern("invoice-approval")
|
|
26
|
+
console.log(invoice?.workers.map((w) => w.jobType))
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
Source: https://docs.bpmnkit.com/guides/patterns/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Pattern Library — What a pattern contains
|
|
2
|
+
|
|
3
|
+
Each pattern has four components:
|
|
4
|
+
|
|
5
|
+
**README** — domain context, common variations, relevant regulations, and conventions.
|
|
6
|
+
Claude reads this before generating the BPMN.
|
|
7
|
+
|
|
8
|
+
**Template** — a compact BPMN template in the BPMNKit intermediate format (not raw XML).
|
|
9
|
+
Used as a starting-point structure, not a fixed output.
|
|
10
|
+
|
|
11
|
+
**Worker specs** — typical service tasks with job type, inputs, outputs, and real integration
|
|
12
|
+
options (e.g. "SAP, NetSuite, or QuickBooks" for a payment trigger).
|
|
13
|
+
|
|
14
|
+
**Variations** — common process variants (e.g. "3-way match", "auto-approve below threshold")
|
|
15
|
+
so Claude can adapt the flow to the user's specific context.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
Source: https://docs.bpmnkit.com/guides/patterns/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Simulation — DMN Decision Evaluation
|
|
2
|
+
|
|
3
|
+
Deploy decision tables alongside the process:
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
await engine.deploy({
|
|
7
|
+
bpmn: xml,
|
|
8
|
+
decisions: [dmnXml], // DMN 1.3 XML strings
|
|
9
|
+
});
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Testing with Vitest
|
|
14
|
+
|
|
15
|
+
Write deterministic unit tests for your process logic:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { describe, it, expect } from "vitest";
|
|
19
|
+
import { Engine } from "@bpmnkit/engine";
|
|
20
|
+
import { buildOrderProcess } from "./processes.js";
|
|
21
|
+
|
|
22
|
+
describe("order process", () => {
|
|
23
|
+
it("completes when payment succeeds", async () => {
|
|
24
|
+
const engine = new Engine();
|
|
25
|
+
await engine.deploy({ bpmn: buildOrderProcess() });
|
|
26
|
+
|
|
27
|
+
let completed = false;
|
|
28
|
+
|
|
29
|
+
engine.registerJobWorker("payment", async (job) => {
|
|
30
|
+
await job.complete({ success: true });
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
engine.registerJobWorker("shipping", async (job) => {
|
|
34
|
+
await job.complete({ trackingNumber: "TRK-001" });
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const instance = engine.start("order", { amount: 50 });
|
|
38
|
+
await new Promise<void>((resolve) => {
|
|
39
|
+
instance.onChange((state) => {
|
|
40
|
+
if (state === "completed") { completed = true; resolve(); }
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
expect(completed).toBe(true);
|
|
45
|
+
expect(instance.variables_snapshot.trackingNumber).toBe("TRK-001");
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
Source: https://docs.bpmnkit.com/guides/simulation/
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Simulation — Instance State
|
|
2
|
+
|
|
3
|
+
The `ProcessInstance` object tracks the running state:
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
const instance = engine.start("order");
|
|
7
|
+
|
|
8
|
+
console.log(instance.state); // "running" | "completed" | "cancelled"
|
|
9
|
+
console.log(instance.activeElements); // Set<string> — currently active element IDs
|
|
10
|
+
|
|
11
|
+
// Subscribe to state changes
|
|
12
|
+
instance.onChange((newState) => {
|
|
13
|
+
console.log("State changed to:", newState);
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Variables
|
|
19
|
+
|
|
20
|
+
Variables flow through the process via IO mappings. You can read the current snapshot:
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
const vars = instance.variables_snapshot;
|
|
24
|
+
console.log(vars.orderId); // input variable
|
|
25
|
+
console.log(vars.transactionId); // output from a task
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
Source: https://docs.bpmnkit.com/guides/simulation/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Simulation
|
|
2
|
+
|
|
3
|
+
The `@bpmnkit/engine` package is a zero-dependency BPMN simulation engine that runs in
|
|
4
|
+
browsers and Node.js. It's useful for:
|
|
5
|
+
|
|
6
|
+
- **Testing** process logic before deploying
|
|
7
|
+
- **Prototyping** without a Camunda cluster
|
|
8
|
+
- **CI pipelines** — unit-test your process definitions
|
|
9
|
+
- **Demos** — run live in a browser
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Basic Usage
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { Engine } from "@bpmnkit/engine";
|
|
16
|
+
import { Bpmn } from "@bpmnkit/core";
|
|
17
|
+
|
|
18
|
+
// Build a process
|
|
19
|
+
const xml = Bpmn.export(
|
|
20
|
+
Bpmn.createProcess("order")
|
|
21
|
+
.startEvent("start")
|
|
22
|
+
.serviceTask("charge", { taskType: "payment" })
|
|
23
|
+
.serviceTask("ship", { taskType: "shipping" })
|
|
24
|
+
.endEvent("end")
|
|
25
|
+
.build()
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
// Create engine and deploy
|
|
29
|
+
const engine = new Engine();
|
|
30
|
+
await engine.deploy({ bpmn: xml });
|
|
31
|
+
|
|
32
|
+
// Register workers
|
|
33
|
+
engine.registerJobWorker("payment", async (job) => {
|
|
34
|
+
console.log("Charging card...", job.variables);
|
|
35
|
+
await job.complete({ transactionId: "txn-123" });
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
engine.registerJobWorker("shipping", async (job) => {
|
|
39
|
+
console.log("Shipping order...", job.variables);
|
|
40
|
+
await job.complete({ trackingNumber: "1Z999AA1" });
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Start an instance
|
|
44
|
+
const instance = engine.start("order", {
|
|
45
|
+
orderId: "ord-456",
|
|
46
|
+
amount: 99.99,
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
Source: https://docs.bpmnkit.com/guides/simulation/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Simulation — Message Correlation
|
|
2
|
+
|
|
3
|
+
Deliver a message to a waiting `intermediateCatchEvent`:
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
// Process has a catch event waiting for "payment-confirmed"
|
|
7
|
+
await instance.deliverMessage("payment-confirmed", {
|
|
8
|
+
paymentMethod: "card",
|
|
9
|
+
confirmedAt: new Date().toISOString(),
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Step-by-Step Execution
|
|
15
|
+
|
|
16
|
+
Use the `beforeComplete` hook to pause execution between elements — useful for debugging
|
|
17
|
+
and building animated process runners:
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
const instance = engine.start("order", {}, {
|
|
21
|
+
beforeComplete: async (elementId) => {
|
|
22
|
+
console.log("About to complete:", elementId);
|
|
23
|
+
// Inspect state, update UI, etc.
|
|
24
|
+
// Resume by returning from this function
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
Source: https://docs.bpmnkit.com/guides/simulation/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Simulation — Multiple Deployments
|
|
2
|
+
|
|
3
|
+
The engine supports multiple deployed processes. Use `engine.getDeployedProcesses()` to list them:
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
await engine.deploy({ bpmn: processAXml });
|
|
7
|
+
await engine.deploy({ bpmn: processBXml });
|
|
8
|
+
|
|
9
|
+
const processes = engine.getDeployedProcesses();
|
|
10
|
+
// [{ id: "process-a", name: "..." }, { id: "process-b", name: "..." }]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
Source: https://docs.bpmnkit.com/guides/simulation/
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Standalone Workers — Anatomy of a worker
|
|
2
|
+
|
|
3
|
+
```typescript
|
|
4
|
+
// workers/send-invoice/index.ts
|
|
5
|
+
import { createWorkerClient } from "@bpmnkit/worker-client"
|
|
6
|
+
|
|
7
|
+
const JOB_TYPE = "com.example:send-invoice:1"
|
|
8
|
+
const WORKER_NAME = "send-invoice"
|
|
9
|
+
|
|
10
|
+
const client = createWorkerClient({ workerName: WORKER_NAME })
|
|
11
|
+
|
|
12
|
+
interface Inputs {
|
|
13
|
+
invoiceId: unknown // Invoice ID to send
|
|
14
|
+
recipientEmail: unknown // Recipient email address
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface Outputs {
|
|
18
|
+
// (no outputs defined)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function handle(variables: Inputs): Promise<Outputs> {
|
|
22
|
+
// TODO: implement send invoice logic
|
|
23
|
+
throw new Error("Not implemented")
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
console.log(`[${WORKER_NAME}] polling ${JOB_TYPE}`)
|
|
27
|
+
|
|
28
|
+
for await (const job of client.poll(JOB_TYPE)) {
|
|
29
|
+
try {
|
|
30
|
+
const outputs = await handle(job.variables as Inputs)
|
|
31
|
+
await job.complete(outputs)
|
|
32
|
+
console.log(`[${WORKER_NAME}] completed ${job.key}`)
|
|
33
|
+
} catch (err) {
|
|
34
|
+
const msg = err instanceof Error ? err.message : String(err)
|
|
35
|
+
await job.fail(msg, job.retries - 1)
|
|
36
|
+
console.error(`[${WORKER_NAME}] failed ${job.key}: ${msg}`)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
Source: https://docs.bpmnkit.com/guides/workers-standalone/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Standalone Workers — Camunda SaaS
|
|
2
|
+
|
|
3
|
+
For Camunda 8 cloud, pass OAuth2 credentials as environment variables:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
ZEEBE_ADDRESS=https://your-cluster.bru-2.zeebe.camunda.io:443 \
|
|
7
|
+
ZEEBE_CLIENT_ID=... \
|
|
8
|
+
ZEEBE_CLIENT_SECRET=... \
|
|
9
|
+
npm run start:prod
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`@bpmnkit/worker-client` handles OAuth2 token fetching and caching automatically.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Listing available workers
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
casen worker start --help
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or from Claude Code, call `worker_list` to see all built-in and scaffolded workers:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
worker_list()
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Built-in workers (provided by the proxy):
|
|
28
|
+
|
|
29
|
+
| Job type | Description |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `bpmnkit:llm:1` | Call an LLM and return the response text |
|
|
32
|
+
| `bpmnkit:cli:1` | Run a shell command |
|
|
33
|
+
| `bpmnkit:http:scrape:1` | Fetch and extract text from a URL |
|
|
34
|
+
| `bpmnkit:fs:read:1` | Read a file from the local filesystem |
|
|
35
|
+
| `bpmnkit:fs:write:1` | Write content to a file |
|
|
36
|
+
| `bpmnkit:fs:append:1` | Append content to a file |
|
|
37
|
+
| `bpmnkit:fs:list:1` | List files in a directory |
|
|
38
|
+
| `bpmnkit:js:1` | Evaluate a JavaScript expression |
|
|
39
|
+
| `bpmnkit:email:fetch:1` | Fetch email from an IMAP mailbox |
|
|
40
|
+
| `bpmnkit:email:send:1` | Send email via SMTP |
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
Source: https://docs.bpmnkit.com/guides/workers-standalone/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Standalone Workers — Environment variables
|
|
2
|
+
|
|
3
|
+
| Variable | Required | Description |
|
|
4
|
+
|---|---|---|
|
|
5
|
+
| `ZEEBE_ADDRESS` | no | Zeebe REST base URL (default: `http://localhost:26500`) |
|
|
6
|
+
| `ZEEBE_CLIENT_ID` | Camunda SaaS only | OAuth2 client ID |
|
|
7
|
+
| `ZEEBE_CLIENT_SECRET` | Camunda SaaS only | OAuth2 client secret |
|
|
8
|
+
| `ZEEBE_TOKEN_URL` | no | OAuth2 token URL (default: Camunda SaaS endpoint) |
|
|
9
|
+
| `ZEEBE_TOKEN_AUDIENCE` | no | OAuth2 audience (default: `zeebe.camunda.io`) |
|
|
10
|
+
|
|
11
|
+
For local development with reebe, only `ZEEBE_ADDRESS` matters (or leave it at the default).
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
Source: https://docs.bpmnkit.com/guides/workers-standalone/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Standalone Workers
|
|
2
|
+
|
|
3
|
+
Workers are TypeScript programs that poll Zeebe for jobs and execute business logic.
|
|
4
|
+
They depend only on `@bpmnkit/worker-client` — no BPMNKit SDK required at runtime.
|
|
5
|
+
Run them anywhere: terminal, Docker, serverless, or via `casen worker start`.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Scaffold a worker
|
|
9
|
+
|
|
10
|
+
The fastest way to get a worker is via the `/implement` skill, which scaffolds workers for
|
|
11
|
+
every service task in a generated process. You can also scaffold manually using the MCP tool:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Call worker_scaffold with jobType: "com.example:send-invoice:1"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or generate one directly from Claude Code:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
/implement a worker that sends invoices via SendGrid
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Either way, the result is a directory in `./workers/`:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
workers/
|
|
27
|
+
send-invoice/
|
|
28
|
+
index.ts ← implement handle() here
|
|
29
|
+
package.json
|
|
30
|
+
tsconfig.json
|
|
31
|
+
README.md
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
Source: https://docs.bpmnkit.com/guides/workers-standalone/
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Standalone Workers — Running workers
|
|
2
|
+
|
|
3
|
+
### Development (tsx, no build step)
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
cd workers/send-invoice
|
|
7
|
+
npm install
|
|
8
|
+
npm start # runs: tsx index.ts
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Production (compiled JS)
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
cd workers/send-invoice
|
|
15
|
+
npm install
|
|
16
|
+
npm run build # runs: tsc
|
|
17
|
+
npm run start:prod # runs: node dist/index.js
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### All workers at once
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
casen worker start
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
To start a specific worker:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
casen worker start send-invoice
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Docker
|
|
34
|
+
|
|
35
|
+
Each scaffolded worker includes a multi-stage `Dockerfile` recipe in its README:
|
|
36
|
+
|
|
37
|
+
```dockerfile
|
|
38
|
+
FROM node:22-alpine AS build
|
|
39
|
+
WORKDIR /app
|
|
40
|
+
COPY package*.json ./
|
|
41
|
+
RUN npm install
|
|
42
|
+
COPY index.ts tsconfig.json ./
|
|
43
|
+
RUN npm run build
|
|
44
|
+
|
|
45
|
+
FROM node:22-alpine
|
|
46
|
+
WORKDIR /app
|
|
47
|
+
COPY package*.json ./
|
|
48
|
+
RUN npm install --omit=dev
|
|
49
|
+
COPY --from=build /app/dist ./dist
|
|
50
|
+
CMD ["node", "dist/index.js"]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Build and run:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
docker build -t my-org/send-invoice .
|
|
57
|
+
docker run -e ZEEBE_ADDRESS=http://reebe:26500 my-org/send-invoice
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
Source: https://docs.bpmnkit.com/guides/workers-standalone/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Standalone Workers — See also
|
|
2
|
+
|
|
3
|
+
- [`@bpmnkit/worker-client`](/packages/worker-client/) — full API reference
|
|
4
|
+
- [AI-Driven Implementation](/guides/ai-implement/) — scaffold workers as part of `/implement`
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
Source: https://docs.bpmnkit.com/guides/workers-standalone/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @bpmnkit/api — Incident Resolution
|
|
2
|
+
|
|
3
|
+
```typescript
|
|
4
|
+
// Find all incidents for a process instance
|
|
5
|
+
const { items: incidents } = await client.incidents.list({
|
|
6
|
+
processInstanceKey: instance.processInstanceKey,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// Fix the problem in your code, then resolve
|
|
10
|
+
for (const incident of incidents) {
|
|
11
|
+
await client.incidents.resolve({ incidentKey: incident.key });
|
|
12
|
+
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Message Correlation
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
await client.messages.publish({
|
|
20
|
+
messageName: "payment-confirmed",
|
|
21
|
+
correlationKey: "ord-456",
|
|
22
|
+
variables: {
|
|
23
|
+
paymentMethod: "card",
|
|
24
|
+
confirmedAt: new Date().toISOString(),
|
|
25
|
+
},
|
|
26
|
+
timeToLive: 60_000, // ms — how long to wait for a matching instance
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
Source: https://docs.bpmnkit.com/packages/api/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @bpmnkit/api — Observability Events
|
|
2
|
+
|
|
3
|
+
```typescript
|
|
4
|
+
type ClientEvent = "request" | "response" | "error" | "retry" | "token-refresh";
|
|
5
|
+
|
|
6
|
+
client.on("request", (e) => logger.debug(e.method, e.url));
|
|
7
|
+
client.on("response", (e) => metrics.histogram("api.latency", e.durationMs));
|
|
8
|
+
client.on("error", (e) => logger.error(e.status, e.url, e.body));
|
|
9
|
+
client.on("retry", (e) => logger.warn(`Retrying ${e.url} (attempt ${e.attempt})`));
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
Source: https://docs.bpmnkit.com/packages/api/
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @bpmnkit/api — Overview
|
|
2
|
+
|
|
3
|
+
`@bpmnkit/api` is a complete TypeScript client for the Camunda 8 Orchestration Cluster
|
|
4
|
+
REST API:
|
|
5
|
+
|
|
6
|
+
- **180 typed methods** across 30+ resource classes
|
|
7
|
+
- **Auth**: OAuth2, Bearer token, Basic, and no-auth
|
|
8
|
+
- **LRU+TTL cache** for read-heavy operations
|
|
9
|
+
- **Exponential backoff** with configurable retry
|
|
10
|
+
- **TypedEventEmitter** for observability hooks
|
|
11
|
+
- Zero transitive runtime dependencies
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
pnpm add @bpmnkit/api
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Client Configuration
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { CamundaClient } from "@bpmnkit/api";
|
|
25
|
+
|
|
26
|
+
const client = new CamundaClient({
|
|
27
|
+
baseUrl: "https://api.cloud.camunda.io",
|
|
28
|
+
auth: {
|
|
29
|
+
type: "oauth2",
|
|
30
|
+
clientId: process.env.CAMUNDA_CLIENT_ID,
|
|
31
|
+
clientSecret: process.env.CAMUNDA_CLIENT_SECRET,
|
|
32
|
+
audience: process.env.CAMUNDA_AUDIENCE,
|
|
33
|
+
tokenUrl: process.env.CAMUNDA_TOKEN_URL,
|
|
34
|
+
},
|
|
35
|
+
// Optional:
|
|
36
|
+
cache: {
|
|
37
|
+
maxSize: 500, // LRU cache size (default: 200)
|
|
38
|
+
ttlMs: 30_000, // cache TTL in ms (default: 60_000)
|
|
39
|
+
},
|
|
40
|
+
retry: {
|
|
41
|
+
maxAttempts: 3, // default: 3
|
|
42
|
+
initialDelayMs: 200,
|
|
43
|
+
maxDelayMs: 5_000,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
Source: https://docs.bpmnkit.com/packages/api/
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @bpmnkit/api — Process Operations
|
|
2
|
+
|
|
3
|
+
```typescript
|
|
4
|
+
// Deploy
|
|
5
|
+
const deployed = await client.process.deploy({
|
|
6
|
+
resources: [{ content: bpmnXml, name: "my-flow.bpmn" }],
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// Start instance
|
|
10
|
+
const instance = await client.process.startInstance({
|
|
11
|
+
bpmnProcessId: "my-flow",
|
|
12
|
+
variables: { customerId: "cust-001" },
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// List active instances
|
|
16
|
+
const { items } = await client.process.listInstances({
|
|
17
|
+
state: "ACTIVE",
|
|
18
|
+
bpmnProcessId: "my-flow",
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Cancel instance
|
|
22
|
+
await client.process.cancel({
|
|
23
|
+
processInstanceKey: instance.processInstanceKey,
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## Job Workers
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// Activate and handle jobs in a poll loop
|
|
32
|
+
const worker = await client.jobs.activateAndProcess({
|
|
33
|
+
type: "send-email",
|
|
34
|
+
maxJobsToActivate: 10,
|
|
35
|
+
timeout: 60_000, // job lock duration in ms
|
|
36
|
+
worker: "email-worker-1",
|
|
37
|
+
|
|
38
|
+
handler: async (job) => {
|
|
39
|
+
try {
|
|
40
|
+
await sendEmail(job.variables);
|
|
41
|
+
await client.jobs.complete({
|
|
42
|
+
jobKey: job.key,
|
|
43
|
+
variables: { emailSent: true },
|
|
44
|
+
});
|
|
45
|
+
} catch (err) {
|
|
46
|
+
await client.jobs.fail({
|
|
47
|
+
jobKey: job.key,
|
|
48
|
+
errorMessage: String(err),
|
|
49
|
+
retries: job.retries - 1,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Stop polling
|
|
56
|
+
worker.close();
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
Source: https://docs.bpmnkit.com/packages/api/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# @bpmnkit/api — Resource Namespaces
|
|
2
|
+
|
|
3
|
+
All methods are grouped by resource type:
|
|
4
|
+
|
|
5
|
+
| Namespace | Methods |
|
|
6
|
+
|---|---|
|
|
7
|
+
| `client.process` | deploy, startInstance, listInstances, getInstance, cancel, migrate |
|
|
8
|
+
| `client.jobs` | activate, complete, fail, throwError, activateAndProcess |
|
|
9
|
+
| `client.incidents` | list, resolve, get |
|
|
10
|
+
| `client.variables` | list, get, update |
|
|
11
|
+
| `client.decisions` | evaluate, list, getInstance |
|
|
12
|
+
| `client.messages` | publish, correlate |
|
|
13
|
+
| `client.signals` | broadcast |
|
|
14
|
+
| `client.userTasks` | list, get, complete, assign, claim |
|
|
15
|
+
| `client.users` | list, get, create, delete |
|
|
16
|
+
| `client.groups` | list, get, create, assignMember |
|
|
17
|
+
| `client.authorizations` | list, create, delete |
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
Source: https://docs.bpmnkit.com/packages/api/
|