@bpmnkit/proxy 0.0.8 → 0.0.9
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/LICENSE +21 -0
- package/README.md +89 -0
- package/dist/index.js +0 -0
- package/dist/mcp-server.js +0 -0
- package/package.json +52 -34
- package/dist/apply-ops.js +0 -79
- package/dist/bridge.bundle.js +0 -5298
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 urbanisierung
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/bpmnkit/monorepo/main/doc/logos/logo-2-gateway.svg" width="72" height="72" alt="BPMN Kit logo">
|
|
3
|
+
<h1>@bpmnkit/proxy</h1>
|
|
4
|
+
<p>Local proxy server for BPMN Kit — AI bridge (SSE/MCP) and Camunda API proxy using stored CLI profiles</p>
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/@bpmnkit/proxy)
|
|
7
|
+
[](https://github.com/bpmnkit/monorepo/blob/main/LICENSE)
|
|
8
|
+
[](https://github.com/bpmnkit/monorepo)
|
|
9
|
+
|
|
10
|
+
[Documentation](https://docs.bpmnkit.com) · [GitHub](https://github.com/bpmnkit/monorepo) · [Changelog](https://github.com/bpmnkit/monorepo/blob/main/apps/proxy/CHANGELOG.md)
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
`@bpmnkit/proxy` is a local Node.js server that bridges the BPMN Kit editor with AI services and your Camunda cluster. It runs on port 3033 and provides:
|
|
18
|
+
|
|
19
|
+
- **AI chat bridge** — SSE streaming endpoint for AI-assisted diagram editing; connects to any OpenAI-compatible LLM API
|
|
20
|
+
- **MCP server** — Model Context Protocol server for AI agent integrations (`stdio` transport)
|
|
21
|
+
- **Camunda API proxy** — transparent HTTP proxy that injects auth from your `casen` CLI profiles
|
|
22
|
+
|
|
23
|
+
The proxy reads authentication from profiles stored by the `@bpmnkit/cli` (`~/.config/casen/config.json`), so you don't need to configure credentials separately.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm install -g @bpmnkit/proxy
|
|
29
|
+
# or run from the monorepo:
|
|
30
|
+
pnpm proxy
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
# Start the proxy server (port 3033)
|
|
37
|
+
bpmn-ai-server
|
|
38
|
+
|
|
39
|
+
# Or start the MCP server (stdio)
|
|
40
|
+
bpmn-mcp
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Endpoints
|
|
44
|
+
|
|
45
|
+
| Method | Path | Description |
|
|
46
|
+
|--------|------|-------------|
|
|
47
|
+
| `GET` | `/status` | Health check; returns server version and active profile |
|
|
48
|
+
| `POST` | `/chat` | AI chat — SSE stream; sends `data: { type, content }` events |
|
|
49
|
+
| `GET` | `/profiles` | List all configured `casen` profiles |
|
|
50
|
+
| `ALL` | `/api/*` | Transparent proxy to your Camunda cluster (adds auth header) |
|
|
51
|
+
| `GET` | `/operate/stream` | SSE stream for the `@bpmnkit/operate` monitoring frontend |
|
|
52
|
+
|
|
53
|
+
## Configuration
|
|
54
|
+
|
|
55
|
+
The proxy reads from the active `casen` CLI profile. Set an `AI_API_KEY` environment variable for the AI bridge:
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
AI_API_KEY=sk-... bpmn-ai-server
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or use the `X-Profile` request header to target a specific profile on the `/api/*` proxy:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
curl -H "X-Profile: production" http://localhost:3033/api/v2/process-definitions
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Related Packages
|
|
70
|
+
|
|
71
|
+
| Package | Description |
|
|
72
|
+
|---------|-------------|
|
|
73
|
+
| [`@bpmnkit/core`](https://www.npmjs.com/package/@bpmnkit/core) | BPMN/DMN/Form parser, builder, layout engine |
|
|
74
|
+
| [`@bpmnkit/canvas`](https://www.npmjs.com/package/@bpmnkit/canvas) | Zero-dependency SVG BPMN viewer |
|
|
75
|
+
| [`@bpmnkit/editor`](https://www.npmjs.com/package/@bpmnkit/editor) | Full-featured interactive BPMN editor |
|
|
76
|
+
| [`@bpmnkit/engine`](https://www.npmjs.com/package/@bpmnkit/engine) | Lightweight BPMN process execution engine |
|
|
77
|
+
| [`@bpmnkit/feel`](https://www.npmjs.com/package/@bpmnkit/feel) | FEEL expression language parser & evaluator |
|
|
78
|
+
| [`@bpmnkit/plugins`](https://www.npmjs.com/package/@bpmnkit/plugins) | 22 composable canvas plugins |
|
|
79
|
+
| [`@bpmnkit/api`](https://www.npmjs.com/package/@bpmnkit/api) | Camunda 8 REST API TypeScript client |
|
|
80
|
+
| [`@bpmnkit/ascii`](https://www.npmjs.com/package/@bpmnkit/ascii) | Render BPMN diagrams as Unicode ASCII art |
|
|
81
|
+
| [`@bpmnkit/ui`](https://www.npmjs.com/package/@bpmnkit/ui) | Shared design tokens and UI components |
|
|
82
|
+
| [`@bpmnkit/profiles`](https://www.npmjs.com/package/@bpmnkit/profiles) | Shared auth, profile storage, and client factories for CLI & proxy |
|
|
83
|
+
| [`@bpmnkit/operate`](https://www.npmjs.com/package/@bpmnkit/operate) | Monitoring & operations frontend for Camunda clusters |
|
|
84
|
+
| [`@bpmnkit/connector-gen`](https://www.npmjs.com/package/@bpmnkit/connector-gen) | Generate connector templates from OpenAPI specs |
|
|
85
|
+
| [`@bpmnkit/cli`](https://www.npmjs.com/package/@bpmnkit/cli) | Camunda 8 command-line interface (casen) |
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
[MIT](https://github.com/bpmnkit/monorepo/blob/main/LICENSE) © BPMN Kit
|
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/mcp-server.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,35 +1,53 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
2
|
+
"name": "@bpmnkit/proxy",
|
|
3
|
+
"version": "0.0.9",
|
|
4
|
+
"description": "Local proxy server for BPMN Kit — AI bridge (SSE/MCP) and Camunda API proxy using stored CLI profiles",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"bpmn-ai-server": "./dist/index.js",
|
|
8
|
+
"bpmn-mcp": "./dist/mcp-server.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"README.md",
|
|
12
|
+
"dist/**/*.js"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=20"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@bpmnkit/api": "0.0.9",
|
|
19
|
+
"@bpmnkit/core": "0.0.9",
|
|
20
|
+
"@bpmnkit/profiles": "0.0.6"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/bpmnkit/monorepo"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"bpmn",
|
|
31
|
+
"camunda",
|
|
32
|
+
"proxy",
|
|
33
|
+
"ai",
|
|
34
|
+
"mcp",
|
|
35
|
+
"server-sent-events",
|
|
36
|
+
"typescript",
|
|
37
|
+
"zeebe"
|
|
38
|
+
],
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"homepage": "https://bpmnkit.com",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/bpmnkit/monorepo/issues"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"start": "node dist/index.js",
|
|
46
|
+
"build": "tsc",
|
|
47
|
+
"typecheck": "tsc --noEmit",
|
|
48
|
+
"check": "biome check .",
|
|
49
|
+
"dev": "node --watch dist/index.js",
|
|
50
|
+
"bridge": "esbuild src/bridge.ts --bundle --format=iife --global-name=Bridge --platform=neutral --outfile=dist/bridge.bundle.js",
|
|
51
|
+
"bundle": "esbuild src/index.ts --bundle --platform=node --format=cjs --outfile=dist/bundle.cjs && esbuild src/mcp-server.ts --bundle --platform=node --format=cjs --outfile=dist/mcp-server.cjs && pnpm run bridge"
|
|
52
|
+
}
|
|
53
|
+
}
|
package/dist/apply-ops.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// ── Apply ops ─────────────────────────────────────────────────────────────────
|
|
2
|
-
/**
|
|
3
|
-
* Apply a list of operations to a copy of the given CompactDiagram.
|
|
4
|
-
* Returns the modified copy — the original is never mutated.
|
|
5
|
-
*/
|
|
6
|
-
export function applyOps(compact, ops) {
|
|
7
|
-
const result = JSON.parse(JSON.stringify(compact));
|
|
8
|
-
for (const op of ops) {
|
|
9
|
-
const proc = result.processes.find((p) => p.id === op.processId);
|
|
10
|
-
if (!proc)
|
|
11
|
-
continue;
|
|
12
|
-
if (op.op === "add") {
|
|
13
|
-
for (const elem of op.elements ?? []) {
|
|
14
|
-
if (!proc.elements.some((e) => e.id === elem.id)) {
|
|
15
|
-
proc.elements.push(elem);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
for (const flow of op.flows ?? []) {
|
|
19
|
-
if (!proc.flows.some((f) => f.id === flow.id)) {
|
|
20
|
-
proc.flows.push(flow);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
else if (op.op === "remove") {
|
|
25
|
-
const dropEls = new Set(op.elementIds ?? []);
|
|
26
|
-
const dropFlows = new Set(op.flowIds ?? []);
|
|
27
|
-
proc.elements = proc.elements.filter((e) => !dropEls.has(e.id));
|
|
28
|
-
proc.flows = proc.flows.filter((f) => !dropFlows.has(f.id) && !dropEls.has(f.from) && !dropEls.has(f.to));
|
|
29
|
-
}
|
|
30
|
-
else if (op.op === "update") {
|
|
31
|
-
const elem = proc.elements.find((e) => e.id === op.elementId);
|
|
32
|
-
if (elem) {
|
|
33
|
-
Object.assign(elem, op.changes);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else if (op.op === "condition") {
|
|
37
|
-
proc.flows = proc.flows.map((f) => {
|
|
38
|
-
if (f.id !== op.flowId)
|
|
39
|
-
return f;
|
|
40
|
-
if (op.condition === null) {
|
|
41
|
-
// Rebuild without condition field (noDelete rule)
|
|
42
|
-
return { id: f.id, from: f.from, to: f.to, ...(f.name ? { name: f.name } : {}) };
|
|
43
|
-
}
|
|
44
|
-
return { ...f, condition: op.condition };
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return result;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Extract either an ops patch or a full CompactDiagram from the LLM response.
|
|
52
|
-
* Returns null if no valid JSON block is found or the format is unrecognised.
|
|
53
|
-
*/
|
|
54
|
-
export function parseResponse(text, current) {
|
|
55
|
-
const match = /```json\s*\n([\s\S]*?)\n```/.exec(text);
|
|
56
|
-
if (!match?.[1])
|
|
57
|
-
return null;
|
|
58
|
-
let parsed;
|
|
59
|
-
try {
|
|
60
|
-
parsed = JSON.parse(match[1]);
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
if (typeof parsed !== "object" || parsed === null)
|
|
66
|
-
return null;
|
|
67
|
-
// Ops format: { "ops": [...] }
|
|
68
|
-
if ("ops" in parsed && Array.isArray(parsed.ops)) {
|
|
69
|
-
if (!current)
|
|
70
|
-
return null; // ops require an existing diagram to patch
|
|
71
|
-
return applyOps(current, parsed.ops);
|
|
72
|
-
}
|
|
73
|
-
// Full CompactDiagram: { "processes": [...] }
|
|
74
|
-
if ("processes" in parsed && Array.isArray(parsed.processes)) {
|
|
75
|
-
return parsed;
|
|
76
|
-
}
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=apply-ops.js.map
|