@bpmnkit/docspack 0.0.5 → 1.0.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/.llms/chunks/getting-started.stability.deprecation.md +15 -0
- package/.llms/chunks/getting-started.stability.support-window.md +49 -0
- package/.llms/chunks/getting-started.stability.versions-are-per-package-not-per-repo.md +17 -0
- package/.llms/chunks/getting-started.stability.what-counts-as-public-api.md +33 -0
- package/.llms/chunks/getting-started.stability.what-is-a-breaking-change.md +70 -0
- package/.llms/chunks/getting-started.stability.what-is-not-a-breaking-change.md +25 -0
- package/.llms/chunks/getting-started.stability.what-this-page-is-for.md +21 -0
- package/.llms/chunks/guides.ai.minimal-empty-diagram.md +1 -0
- package/.llms/chunks/guides.ai.previewing-while-the-model-writes.md +57 -0
- package/.llms/chunks/guides.using-bpmnkit-with-ai.asking.md +47 -0
- package/.llms/chunks/guides.using-bpmnkit-with-ai.from-the-library-instead-of-the-cli-the-other-route-docspack-index.md +56 -0
- package/.llms/chunks/guides.using-bpmnkit-with-ai.from-the-library-instead-of-the-cli.md +86 -0
- package/.llms/chunks/guides.using-bpmnkit-with-ai.md +17 -0
- package/.llms/chunks/guides.using-bpmnkit-with-ai.runnable-examples.md +31 -0
- package/.llms/chunks/guides.using-bpmnkit-with-ai.telling-an-agent-they-exist.md +23 -0
- package/.llms/chunks/guides.using-bpmnkit-with-ai.the-two-packs-bpmn-kit-ships.md +20 -0
- package/.llms/chunks/guides.using-bpmnkit-with-ai.the-whole-loop-five-markdown-files-to-a-bpmn-diagram.md +64 -0
- package/.llms/chunks/guides.using-bpmnkit-with-ai.where-to-go-next.md +13 -0
- package/.llms/chunks/packages.ascii.from-the-command-line.md +23 -0
- package/.llms/chunks/packages.ascii.installation.md +34 -0
- package/.llms/chunks/packages.ascii.overview.md +15 -0
- package/.llms/chunks/packages.ascii.rendering-a-decision-table.md +29 -0
- package/.llms/chunks/packages.ascii.rendering-a-form.md +39 -0
- package/.llms/chunks/packages.camunda-docspack.a-note-on-the-pack-s-name.md +15 -0
- package/.llms/chunks/packages.camunda-docspack.installation.md +41 -0
- package/.llms/chunks/packages.camunda-docspack.overview.md +28 -0
- package/.llms/chunks/packages.camunda-docspack.rebuilding-it.md +27 -0
- package/.llms/chunks/packages.camunda-docspack.what-makes-this-corpus-different.md +16 -0
- package/.llms/chunks/packages.connectors.api-reference.md +22 -0
- package/.llms/chunks/packages.connectors.applying-a-template.md +64 -0
- package/.llms/chunks/packages.connectors.installation.md +45 -0
- package/.llms/chunks/packages.connectors.overview.md +16 -0
- package/.llms/chunks/packages.connectors.stability.md +16 -0
- package/.llms/chunks/packages.connectors.validating-a-template.md +27 -0
- package/.llms/chunks/packages.connectors.workspace-templates.md +20 -0
- package/.llms/chunks/packages.core.installation-compactify-definitions.md +8 -0
- package/.llms/chunks/packages.core.installation-createcompactstream-options.md +41 -0
- package/.llms/chunks/packages.core.installation-joins-inferred-by-default-or-declared.md +3 -3
- package/.llms/chunks/{packages.docspack.installation.md → packages.docspack.giving-an-agent-access.md} +5 -10
- package/.llms/chunks/packages.docspack.reading-it-yourself.md +6 -0
- package/.llms/chunks/packages.docspack.the-other-pack.md +24 -0
- package/.llms/chunks/packages.feel.api-reference.md +34 -0
- package/.llms/chunks/packages.feel.formatting-and-highlighting.md +24 -0
- package/.llms/chunks/packages.feel.installation.md +45 -0
- package/.llms/chunks/packages.feel.overview.md +15 -0
- package/.llms/chunks/packages.feel.stability.md +7 -0
- package/.llms/chunks/packages.feel.unary-tests.md +46 -0
- package/.llms/chunks/packages.plugins.installation.md +28 -0
- package/.llms/chunks/packages.plugins.overview.md +18 -0
- package/.llms/chunks/packages.plugins.styles.md +26 -0
- package/.llms/chunks/packages.plugins.what-is-available.md +68 -0
- package/.llms/manifest.json +763 -10
- package/README.md +11 -4
- package/dist/cli.js +11 -1
- package/dist/load.d.ts +10 -2
- package/dist/load.js +15 -3
- package/dist/search.d.ts +5 -1
- package/dist/search.js +12 -1
- package/llms.txt +52 -6
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Stability and Versioning — Deprecation
|
|
2
|
+
|
|
3
|
+
Nothing that is public API disappears without warning.
|
|
4
|
+
|
|
5
|
+
1. It is marked `@deprecated` in the type declarations, naming what to use instead. Your editor
|
|
6
|
+
and your build show it; nothing breaks.
|
|
7
|
+
2. It keeps working for **at least one minor release**, and is listed in the changelog entry
|
|
8
|
+
that deprecated it.
|
|
9
|
+
3. It is removed only in a major, and the major's release notes list every removal.
|
|
10
|
+
|
|
11
|
+
An alias kept purely for compatibility is documented as such — `ProcessBuilder`'s `strict`
|
|
12
|
+
option is the existing example, a deprecated alias for `explicitJoins`.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
Source: https://bpmnkit.com/docs/getting-started/stability
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Stability and Versioning — Support window
|
|
2
|
+
|
|
3
|
+
Fixes land on the **latest minor of the current major**. When a new major ships, the previous
|
|
4
|
+
major gets security fixes for **six months**; other fixes require an upgrade.
|
|
5
|
+
|
|
6
|
+
Security issues should be reported through
|
|
7
|
+
[GitHub](https://github.com/bpmnkit/monorepo/issues) rather than in a public pull request.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Which packages this covers
|
|
11
|
+
|
|
12
|
+
A package is covered by this page once it is at **1.0.0 or above**, and not before. The
|
|
13
|
+
distinction is deliberate: several packages are published, useful, and not yet ready to freeze
|
|
14
|
+
an API — shipping them as 1.0 to make the list tidy would be a promise the project could not
|
|
15
|
+
keep. Joining later costs nothing, because going from 0.x to 1.0 breaks no one, so the bar is
|
|
16
|
+
applied strictly rather than generously.
|
|
17
|
+
|
|
18
|
+
Three conditions, all of which must hold:
|
|
19
|
+
|
|
20
|
+
1. **A test suite that would catch its own breakage.**
|
|
21
|
+
2. **A documentation page** on this site.
|
|
22
|
+
3. **An API worth defending for a year.**
|
|
23
|
+
|
|
24
|
+
**Twelve packages** meet them today and carry the promise:
|
|
25
|
+
|
|
26
|
+
| | |
|
|
27
|
+
|---|---|
|
|
28
|
+
| [`@bpmnkit/core`](/docs/packages/core) | [`@bpmnkit/feel`](/docs/packages/feel) |
|
|
29
|
+
| [`@bpmnkit/canvas`](/docs/packages/canvas) | [`@bpmnkit/editor`](/docs/packages/editor) |
|
|
30
|
+
| [`@bpmnkit/engine`](/docs/packages/engine) | [`@bpmnkit/plugins`](/docs/packages/plugins) |
|
|
31
|
+
| [`@bpmnkit/api`](/docs/packages/api) | [`@bpmnkit/ascii`](/docs/packages/ascii) |
|
|
32
|
+
| [`@bpmnkit/connectors`](/docs/packages/connectors) | [`@bpmnkit/connector-gen`](/docs/packages/connector-gen) |
|
|
33
|
+
| [`@bpmnkit/docspack`](/docs/packages/docspack) | [`@bpmnkit/cli`](/docs/cli/casen) |
|
|
34
|
+
|
|
35
|
+
The other fourteen published packages stay on 0.x on purpose, and make no promise. Most are
|
|
36
|
+
short of the first two conditions; the rest are worked examples, scaffolders, or generated
|
|
37
|
+
builds with no API of their own to freeze.
|
|
38
|
+
|
|
39
|
+
The membership is not only prose. It lives in `STABLE` in
|
|
40
|
+
[`scripts/published-packages.mjs`](https://github.com/bpmnkit/monorepo/blob/main/scripts/published-packages.mjs),
|
|
41
|
+
and the repo's own checks enforce both directions of it: nothing on the list may lack tests or
|
|
42
|
+
a documentation page, and nothing at 1.0.0 or above may be missing from the list. A major
|
|
43
|
+
version cannot arrive by accident.
|
|
44
|
+
|
|
45
|
+
Whatever this page says, a package's current version on
|
|
46
|
+
[npm](https://www.npmjs.com/org/bpmnkit) is the authoritative answer.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
Source: https://bpmnkit.com/docs/getting-started/stability
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Stability and Versioning — Versions are per package, not per repo
|
|
2
|
+
|
|
3
|
+
Packages version independently. `@bpmnkit/core` reaching 2.0.0 does not make
|
|
4
|
+
`@bpmnkit/canvas` 2.0.0, and the two can sit many majors apart.
|
|
5
|
+
|
|
6
|
+
Sibling dependencies are declared as carets, so `@bpmnkit/plugins` depending on
|
|
7
|
+
`^1.2.0` of `@bpmnkit/core` resolves to one shared copy alongside your own `^1.4.0`.
|
|
8
|
+
Two copies of `@bpmnkit/core` in one tree is not a duplicate of one copy — class identity,
|
|
9
|
+
`instanceof` and module-level registries all stop matching across the seam — so keep BPMN Kit
|
|
10
|
+
packages within one major of each other.
|
|
11
|
+
|
|
12
|
+
Releases are cut by [Changesets](https://github.com/changesets/changesets). Every change that
|
|
13
|
+
reaches npm has a changeset naming its packages and its bump, and lands in that package's
|
|
14
|
+
`CHANGELOG.md`.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
Source: https://bpmnkit.com/docs/getting-started/stability
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Stability and Versioning — What counts as public API
|
|
2
|
+
|
|
3
|
+
**The public API of a package is what its `exports` entry points export, minus anything
|
|
4
|
+
marked `@internal`.** Nothing else.
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Bpmn } from "@bpmnkit/core" // ✅ API
|
|
8
|
+
import { minimap } from "@bpmnkit/plugins/minimap" // ✅ API — a declared subpath
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
These are **not** API, and may change in any release:
|
|
12
|
+
|
|
13
|
+
| Not API | Why |
|
|
14
|
+
|---|---|
|
|
15
|
+
| Deep paths into `dist/` | An implementation layout, not an entry point |
|
|
16
|
+
| Members marked `/** @internal */` | Reachable from the `.d.ts` because TypeScript has no other way to say "not yours" — `ProcessBuilder` carries several |
|
|
17
|
+
| Anything reachable only by structural inference | If you cannot import it by name from an entry point, it is not named in the contract |
|
|
18
|
+
| `src/` in the repo | The published package is the artifact; the repository is not |
|
|
19
|
+
|
|
20
|
+
Each package's entry points are listed in its `exports` map. `@bpmnkit/plugins` is the one to
|
|
21
|
+
watch: it has **no root export**, only 34 subpaths, one per plugin.
|
|
22
|
+
|
|
23
|
+
**For a package whose product is a command**, `exports` says nothing — `@bpmnkit/cli` has none
|
|
24
|
+
at all. Its public API is instead its **documented commands**: the command and flag names, the
|
|
25
|
+
meaning of its exit codes, and the shape of any `--format json` output. Prose written to a
|
|
26
|
+
terminal for a human to read is not API, and neither is the exact wording of an error.
|
|
27
|
+
|
|
28
|
+
For a package that renders UI, the **rendered DOM and its class names are not API** either.
|
|
29
|
+
Style through the documented CSS custom properties; a panel's internal markup can change in a
|
|
30
|
+
minor.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
Source: https://bpmnkit.com/docs/getting-started/stability
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Stability and Versioning — What is a breaking change
|
|
2
|
+
|
|
3
|
+
### Runtime behaviour
|
|
4
|
+
|
|
5
|
+
Breaking: removing or renaming an export or an entry point; removing a function parameter or
|
|
6
|
+
making an optional one required; throwing where a value used to be returned; changing a
|
|
7
|
+
documented default.
|
|
8
|
+
|
|
9
|
+
### Types
|
|
10
|
+
|
|
11
|
+
Type-level breakage is real breakage: a build that no longer compiles is a broken build. The
|
|
12
|
+
direction matters, and it is the opposite for things we hand you and things you hand us.
|
|
13
|
+
|
|
14
|
+
| Change | Verdict |
|
|
15
|
+
|---|---|
|
|
16
|
+
| Adding an export, or a new entry point | minor |
|
|
17
|
+
| Adding an **optional** property to an options object | minor |
|
|
18
|
+
| Adding a member to a union we **accept** | minor |
|
|
19
|
+
| Adding a member to a union we **return** | **major** — your exhaustive `switch` stops compiling |
|
|
20
|
+
| Adding a **required** property to anything you construct | **major** |
|
|
21
|
+
| Making a returned property optional | **major** — you now have to narrow it |
|
|
22
|
+
| Narrowing a return type | **major** |
|
|
23
|
+
| Widening a parameter type | minor |
|
|
24
|
+
| Renaming an exported type | **major**, even when the shape is identical |
|
|
25
|
+
|
|
26
|
+
### Generated BPMN, DMN and Form documents
|
|
27
|
+
|
|
28
|
+
This is the promise that matters most here, and the one a general semver policy has nothing
|
|
29
|
+
to say about. The rule is:
|
|
30
|
+
|
|
31
|
+
> **A change is breaking if it moves `semanticHash` for the same input. A change to the bytes
|
|
32
|
+
> alone is not.**
|
|
33
|
+
|
|
34
|
+
`semanticHash` is BPMN Kit's canonical, presentation-free projection of a model, and it is
|
|
35
|
+
exported for exactly this purpose. Verified against the current build:
|
|
36
|
+
|
|
37
|
+
| Property | Holds |
|
|
38
|
+
|---|---|
|
|
39
|
+
| The same input rebuilt produces the same hash | ✅ |
|
|
40
|
+
| `applyAutoLayout` does not move it | ✅ |
|
|
41
|
+
| Renaming an element moves it | ✅ |
|
|
42
|
+
| Changing an element **id** moves it | ✅ |
|
|
43
|
+
|
|
44
|
+
So, concretely:
|
|
45
|
+
|
|
46
|
+
- **Major** — different element ids, a changed document structure, a different default
|
|
47
|
+
attribute on an emitted element, a changed FEEL expression. Anyone diffing generated files
|
|
48
|
+
in review, or deploying them by id, sees these.
|
|
49
|
+
- **Minor or patch** — different layout coordinates, different attribute order, different
|
|
50
|
+
whitespace, a nicer waypoint route. The picture moved; the model did not.
|
|
51
|
+
|
|
52
|
+
For the avoidance of doubt about precedent: `@bpmnkit/core` 0.4.0 derived element ids from the
|
|
53
|
+
model instead of generating them randomly. That moved `semanticHash` for every document, and
|
|
54
|
+
shipped as a *minor*. Under this policy it is a major, and 0.x is the only reason it was not.
|
|
55
|
+
|
|
56
|
+
### Formats outside the package
|
|
57
|
+
|
|
58
|
+
These are contracts even though no TypeScript signature describes them, and the same rule
|
|
59
|
+
applies — a change that makes an existing file, store or caller stop working is major:
|
|
60
|
+
|
|
61
|
+
- The **`.bpmn.tests.json` sidecar** read by `casen test` and the runner's Tests tab.
|
|
62
|
+
- **Profile storage on disk** — `~/.config/casen` on Linux, `~/Library/Application Support/casen`
|
|
63
|
+
on macOS, `%APPDATA%\casen` on Windows. A format change must migrate existing profiles, not
|
|
64
|
+
invalidate them.
|
|
65
|
+
- The **`@bpmnkit/proxy` HTTP surface**, for the routes the documentation names.
|
|
66
|
+
- **Element template validation** — a template that validates today does not start failing in
|
|
67
|
+
a minor.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
Source: https://bpmnkit.com/docs/getting-started/stability
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Stability and Versioning — What is not a breaking change
|
|
2
|
+
|
|
3
|
+
- Adding a feature, an export, an entry point, or an optional parameter.
|
|
4
|
+
- Fixing a bug so behaviour matches its documentation. If you relied on the bug, this can
|
|
5
|
+
still move under you; it is a patch, and the changelog will say what changed.
|
|
6
|
+
- Performance, internal structure, dependency versions inside a compatible range.
|
|
7
|
+
- Anything about layout, formatting or diagram interchange that leaves `semanticHash` alone.
|
|
8
|
+
- Documentation, READMEs, or the contents of `@bpmnkit/docspack`.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Runtime support
|
|
12
|
+
|
|
13
|
+
The supported runtimes are listed under
|
|
14
|
+
[Runtime Requirements](/docs/getting-started/installation#runtime-requirements): Node.js 20
|
|
15
|
+
LTS and newer, Deno 1.40+, Bun 1.0+, and browsers supporting ES2022. Every package is
|
|
16
|
+
**ESM-only** — there is no CommonJS build, and there will not be one.
|
|
17
|
+
|
|
18
|
+
Raising the floor follows the runtime's own lifecycle:
|
|
19
|
+
|
|
20
|
+
- Dropping a Node.js major that is **still in LTS** is a **major**.
|
|
21
|
+
- Dropping one that has reached **end of life** is a **minor**, called out in the release notes.
|
|
22
|
+
- Raising the browser baseline past ES2022 is a **major**.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
Source: https://bpmnkit.com/docs/getting-started/stability
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Stability and Versioning — What this page is for
|
|
2
|
+
|
|
3
|
+
A version number is a promise about breakage. This page says exactly which promise BPMN Kit
|
|
4
|
+
makes, so you can decide what to write in your `package.json` and know what an upgrade can
|
|
5
|
+
do to you.
|
|
6
|
+
|
|
7
|
+
Every package follows [Semantic Versioning 2.0.0](https://semver.org). The rest of this page
|
|
8
|
+
is the part semver leaves open: what counts as *the API* in a toolkit that also emits XML
|
|
9
|
+
files, writes state to disk and speaks HTTP.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## What is covered today
|
|
13
|
+
|
|
14
|
+
The promises below take effect for a given package **when it reaches 1.0.0**. Twelve packages
|
|
15
|
+
do — they are listed at the end of this page. A package still on 0.x is **not** covered by
|
|
16
|
+
them, even though other packages in the workspace are: under semver, 0.x makes no
|
|
17
|
+
compatibility promise at all. Releases of those have been additive in practice, but *in
|
|
18
|
+
practice* is not a contract, so pin an exact version if one of them matters to you.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
Source: https://bpmnkit.com/docs/getting-started/stability
|
|
@@ -24,6 +24,7 @@ Rules:
|
|
|
24
24
|
- Use camelCase IDs
|
|
25
25
|
- Every service task needs a taskType string (the Zeebe worker subscription)
|
|
26
26
|
- Use FEEL expressions for gateway conditions (start with "= ")
|
|
27
|
+
- Every exclusive gateway needs one branch with no condition and `isDefault: true`
|
|
27
28
|
- Always include a start event and at least one end event
|
|
28
29
|
- Do not add fields that are not part of the CompactDiagram schema
|
|
29
30
|
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# AI Integration — Previewing While the Model Writes
|
|
2
|
+
|
|
3
|
+
A diagram is visual, and a model takes seconds to write one. Waiting for the last token to
|
|
4
|
+
show anything means the user watches prose scroll past while the only interesting part of the
|
|
5
|
+
answer is already most of the way written.
|
|
6
|
+
|
|
7
|
+
Nothing downstream can use a half-written document, though — `JSON.parse` wants the closing
|
|
8
|
+
brace, and the outermost one is the very last character a tool call sends.
|
|
9
|
+
`createCompactStream` sidesteps that by not parsing the document at all. It takes complete
|
|
10
|
+
`{…}` literals as they close and keeps the ones shaped like an element or a flow, which are
|
|
11
|
+
the innermost objects and so the first to finish:
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { createCompactStream } from "@bpmnkit/core";
|
|
15
|
+
|
|
16
|
+
const stream = createCompactStream({ base: currentDiagram });
|
|
17
|
+
|
|
18
|
+
for await (const chunk of tokens) {
|
|
19
|
+
const frame = stream.push(chunk); // null until the frame changes
|
|
20
|
+
if (frame) canvas.loadDefinitions(frame, { keepViewport: true });
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Pass `base` when the model is editing something. It streams only what it is adding, so without
|
|
25
|
+
the diagram it started from a frame is a disconnected fragment rather than the process with the
|
|
26
|
+
fragment in it.
|
|
27
|
+
|
|
28
|
+
`keepViewport` matters as much as the frames do: without it the canvas re-frames the diagram on
|
|
29
|
+
every update and pulls the view out from under whoever is watching. With it, the process grows
|
|
30
|
+
in place — the layout is stable enough for that, because appending to a diagram does not move
|
|
31
|
+
what is already placed.
|
|
32
|
+
|
|
33
|
+
### Frames are advisory
|
|
34
|
+
|
|
35
|
+
Every frame is a guess at an unfinished document. `push` never throws, drops what it cannot
|
|
36
|
+
place, and strips a flow's `isDefault` rather than failing when the gateway it claims has not
|
|
37
|
+
arrived. That is the whole bargain: a frame that guesses wrong costs one render, so the
|
|
38
|
+
authoritative result is whatever the model finishes with, and that is what you save or deploy.
|
|
39
|
+
|
|
40
|
+
### Where the frames come from
|
|
41
|
+
|
|
42
|
+
The local proxy (`bpmn-ai-server`) sends them on `/chat` as `preview` events, from two places:
|
|
43
|
+
|
|
44
|
+
- **The tool call being written** — argument fragments as they stream, which is the only thing
|
|
45
|
+
that covers a process the model composes in a single call.
|
|
46
|
+
- **The MCP server's own state** — one frame per mutating tool call, once anything has been
|
|
47
|
+
written. These take over as soon as they exist; they are the model's own state rather than a
|
|
48
|
+
guess at an unfinished document.
|
|
49
|
+
|
|
50
|
+
A client renders `preview` as it likes and treats the `xml` event at the end of the stream as
|
|
51
|
+
the result. The editor's AI panel does this, and additionally outlines the elements the diagram
|
|
52
|
+
being edited does not have — so an edit reads as an edit rather than a rewrite. It marks
|
|
53
|
+
nothing when the diagram has no sequence flows yet: a process built from scratch is new all the
|
|
54
|
+
way through, and marking everything says no more than marking none of it.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
Source: https://bpmnkit.com/docs/guides/ai
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Using BPMN Kit with AI — Asking
|
|
2
|
+
|
|
3
|
+
```sh
|
|
4
|
+
npx bpmnkit-docs ask "what does compactify drop from a diagram"
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
## @bpmnkit/docspack@0.0.5/packages.core.installation-compactify-definitions
|
|
9
|
+
|
|
10
|
+
Projects a `BpmnDefinitions` object onto a `CompactDiagram` — a small JSON
|
|
11
|
+
object suitable for LLM prompts. **Lossy:** it keeps topology, names …
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
cost: 204 tokens, capped at 3,000
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Every answer names the pack, the version and the chunk, and closes with what it
|
|
18
|
+
cost — so an agent can quote the chunk id back when a passage turns out to be
|
|
19
|
+
wrong.
|
|
20
|
+
|
|
21
|
+
Ask the engine's documentation with `--pack`:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npx bpmnkit-docs ask "what happens when no exclusive gateway condition is true" \
|
|
25
|
+
--pack @bpmnkit/camunda-docspack
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`--pack` is worth using even when you are not disambiguating. Building the index
|
|
29
|
+
reads every chunk off disk, so narrowing to one pack is the difference between
|
|
30
|
+
roughly 150ms and 650ms per question. A name that is not installed is an error
|
|
31
|
+
listing what is, never an empty answer — an empty answer would read as "the
|
|
32
|
+
documentation does not cover this", which is a different claim.
|
|
33
|
+
|
|
34
|
+
`search` ranks without printing the content, and `list` shows what was found:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npx bpmnkit-docs search "exclusive gateway condition"
|
|
38
|
+
npx bpmnkit-docs list
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
@bpmnkit/camunda-docspack@0.1.1 1054 chunks
|
|
43
|
+
@bpmnkit/docspack@0.0.5 206 chunks
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Using BPMN Kit with AI — From the library instead of the CLI — The other route: `docspack index`
|
|
2
|
+
|
|
3
|
+
Upstream [docspack](https://docspack.dev) 1.1.0 added
|
|
4
|
+
[a second way to do this](https://docspack.dev/docs/your-own-corpus/). Rather than
|
|
5
|
+
building a pack, it keeps an SQLite index of loose sources, and answers from it
|
|
6
|
+
with `recall` instead of `ask`:
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm i -D docspack
|
|
10
|
+
|
|
11
|
+
npx docspack index --from ./flow-docs
|
|
12
|
+
npx docspack recall "when does an order need manager approval"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
indexing @local/flow-docs
|
|
17
|
+
+ @local/flow-docs 10 chunks ~527 tokens
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Pick it over `bpmnkit-docs build` when the corpus is not a folder of Markdown.
|
|
21
|
+
Anything that emits JSON can be indexed without a database driver:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
sqlite3 -json shop.db 'select id, title, body as text from orders' | npx docspack index --from-json -
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
It also tracks each source's size, mtime and hash, so a re-run does nothing when
|
|
28
|
+
nothing changed, and `recall` leads with a warning rather than quoting a passage
|
|
29
|
+
that has since been edited:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
NOTE: the corpus is out of date. 1 indexed source has changed since it was
|
|
33
|
+
built: flow-docs/04-shipping.md. The passages below may be superseded — run
|
|
34
|
+
`docspack index` again before relying on them.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`recall` is deliberately not `ask`: your notes are never an installed version, so
|
|
38
|
+
a corpus cannot reach an answer about a dependency and a dependency cannot reach
|
|
39
|
+
an answer about your notes. The index lands in `.docspack/local.db` as plaintext
|
|
40
|
+
and the tool writes a `.gitignore` beside it.
|
|
41
|
+
|
|
42
|
+
The two routes do not merge. `bpmnkit-docs` searches your corpus and the
|
|
43
|
+
installed packs together because a pack directory is just a directory; upstream
|
|
44
|
+
keeps them in separate query paths on purpose. Build a pack when you want one
|
|
45
|
+
answer drawn from both; use `docspack index` when the corpus is a database, or
|
|
46
|
+
when you want the staleness check.
|
|
47
|
+
|
|
48
|
+
> **Use `docspack@1.2.0` or newer for the Camunda pack.** Earlier versions named
|
|
49
|
+
> one pack per npm scope, so `docspack sync` read `@bpmnkit/camunda-docspack` as
|
|
50
|
+
> an ordinary dependency and indexed its type declarations — `0 chunks
|
|
51
|
+
> (declarations)` — leaving a Camunda question to be answered out of the wrong
|
|
52
|
+
> pack. 1.2.0 discovers `@<vendor>/<name>-docspack` and indexes all 1,054 chunks.
|
|
53
|
+
> `bpmnkit-docs` has read the suffix from the start and needs no version floor.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Using BPMN Kit with AI — From the library instead of the CLI
|
|
2
|
+
|
|
3
|
+
A long-lived agent, an editor extension or an MCP server should index once and
|
|
4
|
+
ask many times, rather than paying for the index on every question:
|
|
5
|
+
|
|
6
|
+
```typescript
|
|
7
|
+
import { answer, discoverPacks, indexPacks } from "@bpmnkit/docspack";
|
|
8
|
+
|
|
9
|
+
const index = indexPacks(discoverPacks());
|
|
10
|
+
|
|
11
|
+
const { hits, tokens } = answer(index, "verify a worker's job type", {
|
|
12
|
+
packs: ["@bpmnkit/docspack"],
|
|
13
|
+
limit: 3,
|
|
14
|
+
maxTokens: 3000,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
for (const hit of hits) console.log(hit.chunkId, hit.content);
|
|
18
|
+
console.log(`${tokens} tokens`);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Indexing your own corpus
|
|
23
|
+
|
|
24
|
+
The packs above answer for BPMN Kit and for Camunda. Nothing answers for *your*
|
|
25
|
+
process — the five Markdown files somebody wrote describing how orders are
|
|
26
|
+
fulfilled. Handed the folder, an agent reads the wrong file or spends its whole
|
|
27
|
+
context on all of them; a corpus larger than the context window cannot be read
|
|
28
|
+
into it at all.
|
|
29
|
+
|
|
30
|
+
Index it, and it becomes something the agent asks questions of. The same builder
|
|
31
|
+
behind `bpmnkit-docs build` takes any folder of Markdown:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
mkdir -p flow-corpus
|
|
35
|
+
cat > flow-corpus/package.json <<'JSON'
|
|
36
|
+
{
|
|
37
|
+
"name": "order-fulfilment-corpus",
|
|
38
|
+
"version": "1.0.0",
|
|
39
|
+
"private": true,
|
|
40
|
+
"docspack": { "source": "../flow-docs", "minTokens": 60, "maxTokens": 800 }
|
|
41
|
+
}
|
|
42
|
+
JSON
|
|
43
|
+
|
|
44
|
+
npx bpmnkit-docs build --cwd flow-corpus
|
|
45
|
+
npx bpmnkit-docs ask "when does an order need manager approval" --cwd flow-corpus
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
Built 5 chunks from 5 documents (421 tokens).
|
|
50
|
+
|
|
51
|
+
## order-fulfilment-corpus@1.0.0/02-approval.when-approval-is-needed
|
|
52
|
+
|
|
53
|
+
# Approval — When approval is needed
|
|
54
|
+
|
|
55
|
+
An order over 10000 EUR needs a regional manager to approve it before anything
|
|
56
|
+
is picked. At or under that figure the order goes straight to fulfilment.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Indexing runs no model, so building the corpus costs no tokens — five documents
|
|
60
|
+
take about 9ms.
|
|
61
|
+
|
|
62
|
+
A few things decide whether the result is any good:
|
|
63
|
+
|
|
64
|
+
- **Split at headings that answer something.** A chunk is a `##` section.
|
|
65
|
+
`minTokens` merges a section too short to answer anything into the one before
|
|
66
|
+
it, so a two-line heading does not become a chunk of its own.
|
|
67
|
+
- **`--cwd` points at the pack, not at the sources.** A directory holding a
|
|
68
|
+
`package.json` and a `.llms/` payload *is* a pack, so `bpmnkit-docs` reads it
|
|
69
|
+
without it ever being published.
|
|
70
|
+
- **Your corpus and the installed packs are searched together.** Discovery walks
|
|
71
|
+
`node_modules` up from `--cwd`, so a corpus inside your project sees
|
|
72
|
+
`@bpmnkit/docspack` too, and `--pack` narrows to whichever you want.
|
|
73
|
+
- **Keep it out of git, and re-index after editing.** The chunks are a copy of
|
|
74
|
+
your files. Edit a source and the index is stale until you build again —
|
|
75
|
+
`bpmnkit-docs build` is cheap enough to run on every change.
|
|
76
|
+
- **Tags weigh 3× prose.** Front matter, the slug and the heading's own words
|
|
77
|
+
become tags automatically; steer them from the document itself when the words
|
|
78
|
+
a reader would search for are not the words on the page:
|
|
79
|
+
|
|
80
|
+
```md
|
|
81
|
+
## Escalation
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Using BPMN Kit with AI
|
|
2
|
+
|
|
3
|
+
An agent asked to turn a folder of specs into a deployable process needs three
|
|
4
|
+
different kinds of knowledge, and only one of them is in its weights:
|
|
5
|
+
|
|
6
|
+
| It needs to know | Where that lives | How it asks |
|
|
7
|
+
| --- | --- | --- |
|
|
8
|
+
| How to drive this library | `@bpmnkit/docspack` | `bpmnkit-docs ask "…"` |
|
|
9
|
+
| How the engine behaves | `@bpmnkit/camunda-docspack` | `bpmnkit-docs ask "…" --pack @bpmnkit/camunda-docspack` |
|
|
10
|
+
| What the process actually does | your own Markdown | index it yourself, below |
|
|
11
|
+
|
|
12
|
+
All three are offline retrieval. Nothing here calls a model, starts a server or
|
|
13
|
+
touches the network, so a question costs milliseconds and no tokens. The model
|
|
14
|
+
is only spent on the last step — turning what it found into a diagram.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Using BPMN Kit with AI — Runnable examples
|
|
2
|
+
|
|
3
|
+
Three scripts in [`apps/examples/src/ai`](https://github.com/bpmnkit/monorepo/tree/main/apps/examples/src/ai)
|
|
4
|
+
do exactly the above. They need no API key and no network — the whole set runs
|
|
5
|
+
in about three seconds:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm --filter @bpmnkit/examples ai:ask # ask both packs, from the library
|
|
9
|
+
pnpm --filter @bpmnkit/examples ai:index # 5 Markdown files → an askable corpus
|
|
10
|
+
pnpm --filter @bpmnkit/examples ai:bpmn # corpus → CompactDiagram → .bpmn
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`ai:bpmn` writes `output/order-fulfilment.bpmn`: 18 elements, 20 sequence flows,
|
|
14
|
+
laid out, with the gateway defaults set.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Keeping it fast
|
|
18
|
+
|
|
19
|
+
| What | Cost | Why |
|
|
20
|
+
| --- | --- | --- |
|
|
21
|
+
| `ask` scoped with `--pack @bpmnkit/docspack` | ~150ms | indexes one pack |
|
|
22
|
+
| `ask` across both packs | ~650ms | indexes both, 1,200+ chunks |
|
|
23
|
+
| `indexPacks` once, then `answer` per question | ~0ms per question | the index is the expensive part |
|
|
24
|
+
| Building a 5-document corpus | ~9ms | no model, no network |
|
|
25
|
+
|
|
26
|
+
Reading chunks off disk dominates, and a fresh `npx bpmnkit-docs ask` pays it on
|
|
27
|
+
every question. Scope with `--pack` when you know which pack answers; use the
|
|
28
|
+
library and hold the index when you are asking more than a handful of questions.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Using BPMN Kit with AI — Telling an agent they exist
|
|
2
|
+
|
|
3
|
+
An agent that does not know a pack is installed will answer from memory instead,
|
|
4
|
+
and its memory describes an older release. One paragraph in `AGENTS.md`,
|
|
5
|
+
`CLAUDE.md` or `.cursor/rules` is the whole setup — **name both packs**, because
|
|
6
|
+
an agent told only about the first will never think to ask the second:
|
|
7
|
+
|
|
8
|
+
```md
|
|
9
|
+
Documentation is installed locally. Ask it before answering from memory.
|
|
10
|
+
|
|
11
|
+
- BPMN Kit's own APIs, CLI and guides:
|
|
12
|
+
`npx bpmnkit-docs ask "<question>"`
|
|
13
|
+
- Camunda 8 — BPMN semantics, FEEL, engine behaviour, the REST API:
|
|
14
|
+
`npx bpmnkit-docs ask "<question>" --pack @bpmnkit/camunda-docspack`
|
|
15
|
+
|
|
16
|
+
A returned chunk beats recalled knowledge: it describes the version this project
|
|
17
|
+
installed. If the two disagree, the chunk is right — do not blend them.
|
|
18
|
+
Answers cap at 3 chunks / 3,000 tokens, so ask several narrow questions rather
|
|
19
|
+
than one broad one.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Using BPMN Kit with AI — The two packs BPMN Kit ships
|
|
2
|
+
|
|
3
|
+
```sh
|
|
4
|
+
npm i -D @bpmnkit/docspack @bpmnkit/camunda-docspack
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
**[`@bpmnkit/docspack`](/docs/packages/docspack)** carries the documentation you
|
|
8
|
+
are reading — the builder API, the CLI, the guides — pinned to the version this
|
|
9
|
+
project installed.
|
|
10
|
+
|
|
11
|
+
**[`@bpmnkit/camunda-docspack`](/docs/packages/camunda-docspack)** carries the
|
|
12
|
+
Camunda 8 documentation: BPMN and FEEL references, engine concepts, the
|
|
13
|
+
best-practice pages with their diagrams rendered as text, and one digest per
|
|
14
|
+
Orchestration Cluster API operation. It is Camunda's work, redistributed under
|
|
15
|
+
CC BY-SA 3.0, not documentation BPMN Kit wrote.
|
|
16
|
+
|
|
17
|
+
One `bpmnkit-docs` command reads both.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Using BPMN Kit with AI — The whole loop: five Markdown files to a BPMN diagram
|
|
2
|
+
|
|
3
|
+
Put the three together and the agent's job is narrow enough to be reliable:
|
|
4
|
+
|
|
5
|
+
1. **Index the team's prose** and ask it what the flow actually does — where the
|
|
6
|
+
thresholds are, what runs in parallel, what happens on the unhappy path.
|
|
7
|
+
2. **Ask `@bpmnkit/docspack`** how to express that with this library.
|
|
8
|
+
3. **Ask `@bpmnkit/camunda-docspack`** whatever the engine, not the library,
|
|
9
|
+
decides — gateway semantics, FEEL syntax, job types.
|
|
10
|
+
4. **Return a `CompactDiagram`**, not XML. About 40 lines of JSON for a diagram
|
|
11
|
+
that is 200 lines of BPMN, and a model that has never written valid BPMN XML
|
|
12
|
+
can still produce a valid diagram.
|
|
13
|
+
5. **`expand` it**, which is deterministic — layout included.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { Bpmn, expand } from "@bpmnkit/core";
|
|
17
|
+
import type { CompactDiagram } from "@bpmnkit/core";
|
|
18
|
+
import { answer, buildPack, indexPacks, loadPack } from "@bpmnkit/docspack";
|
|
19
|
+
|
|
20
|
+
// 1. The team's own files, indexed.
|
|
21
|
+
buildPack({
|
|
22
|
+
source: "flow-docs",
|
|
23
|
+
packDir: "flow-corpus",
|
|
24
|
+
name: "order-fulfilment-corpus",
|
|
25
|
+
version: "1.0.0",
|
|
26
|
+
documents: ["order-fulfilment-corpus"],
|
|
27
|
+
minTokens: 60,
|
|
28
|
+
});
|
|
29
|
+
const corpus = indexPacks([loadPack("flow-corpus")]);
|
|
30
|
+
|
|
31
|
+
const facts = ["when does an order need manager approval", "what runs in parallel"]
|
|
32
|
+
.flatMap((q) => answer(corpus, q, { limit: 1, maxTokens: 600 }).hits)
|
|
33
|
+
.map((hit) => hit.content);
|
|
34
|
+
|
|
35
|
+
// 2–4. The model reads `facts` and returns this. Nothing here is XML.
|
|
36
|
+
const compact: CompactDiagram = await writeDiagram(facts);
|
|
37
|
+
|
|
38
|
+
// 5. Deterministic from here on: topology, Zeebe bindings and layout.
|
|
39
|
+
const definitions = expand(compact);
|
|
40
|
+
const xml = Bpmn.export(definitions);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Mark every gateway's fallthrough branch.** An exclusive gateway whose
|
|
44
|
+
conditions are all false and which has no default deadlocks at runtime, so the
|
|
45
|
+
branch without a condition carries `isDefault` instead:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
flows: [
|
|
49
|
+
{ id: "f5", from: "needsApproval", to: "approveOrder", condition: "= total > 10000" },
|
|
50
|
+
{ id: "f6", from: "needsApproval", to: "splitWork", name: "at or under", isDefault: true },
|
|
51
|
+
]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`expand` turns it into the gateway's `bpmn:default` attribute, `compactify` reads
|
|
55
|
+
it back, and `reconcileCompact` sets it on a file somebody else authored. A flow
|
|
56
|
+
marked `isDefault` that does not leave an exclusive, inclusive or complex
|
|
57
|
+
gateway, or a gateway with two of them, throws rather than being dropped.
|
|
58
|
+
|
|
59
|
+
> `CompactDiagram` still does not model everything. See
|
|
60
|
+
> [AI Integration](/docs/guides/ai) for what it drops, and use `reconcileCompact`
|
|
61
|
+
> rather than `expand` when you are editing a file you need to keep.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
|