@bpmnkit/proxy 0.0.8 → 0.0.10

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 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
+ [![npm](https://img.shields.io/npm/v/@bpmnkit/proxy?style=flat-square&color=6244d7)](https://www.npmjs.com/package/@bpmnkit/proxy)
7
+ [![license](https://img.shields.io/npm/l/@bpmnkit/proxy?style=flat-square)](https://github.com/bpmnkit/monorepo/blob/main/LICENSE)
8
+ [![typescript](https://img.shields.io/badge/TypeScript-strict-6244d7?style=flat-square&logo=typescript&logoColor=white)](https://github.com/bpmnkit/monorepo)
9
+
10
+ [Website](https://bpmnkit.com) · [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 — made by [u11g](https://u11g.com)
package/dist/index.js CHANGED
File without changes
File without changes
package/package.json CHANGED
@@ -1,35 +1,54 @@
1
1
  {
2
- "name": "@bpmnkit/proxy",
3
- "version": "0.0.8",
4
- "description": "Local proxy server for @bpmn-sdk — 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": ["dist/**/*.js"],
11
- "engines": {
12
- "node": ">=20"
13
- },
14
- "dependencies": {
15
- "@bpmnkit/api": "workspace:*",
16
- "@bpmnkit/core": "workspace:*",
17
- "@bpmnkit/profiles": "workspace:*"
18
- },
19
- "scripts": {
20
- "start": "node dist/index.js",
21
- "build": "tsc",
22
- "typecheck": "tsc --noEmit",
23
- "check": "biome check .",
24
- "dev": "node --watch dist/index.js",
25
- "bridge": "esbuild src/bridge.ts --bundle --format=iife --global-name=Bridge --platform=neutral --outfile=dist/bridge.bundle.js",
26
- "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"
27
- },
28
- "publishConfig": {
29
- "access": "public"
30
- },
31
- "repository": {
32
- "type": "git",
33
- "url": "https://github.com/bpmnkit/monorepo"
34
- }
35
- }
2
+ "name": "@bpmnkit/proxy",
3
+ "version": "0.0.10",
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
+ "LICENSE",
12
+ "README.md",
13
+ "dist/**/*.js"
14
+ ],
15
+ "engines": {
16
+ "node": ">=20"
17
+ },
18
+ "dependencies": {
19
+ "@bpmnkit/api": "0.0.10",
20
+ "@bpmnkit/core": "0.0.10",
21
+ "@bpmnkit/profiles": "0.0.7"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/bpmnkit/monorepo"
29
+ },
30
+ "keywords": [
31
+ "bpmn",
32
+ "camunda",
33
+ "proxy",
34
+ "ai",
35
+ "mcp",
36
+ "server-sent-events",
37
+ "typescript",
38
+ "zeebe"
39
+ ],
40
+ "license": "MIT",
41
+ "homepage": "https://bpmnkit.com",
42
+ "bugs": {
43
+ "url": "https://github.com/bpmnkit/monorepo/issues"
44
+ },
45
+ "scripts": {
46
+ "start": "node dist/index.js",
47
+ "build": "tsc",
48
+ "typecheck": "tsc --noEmit",
49
+ "check": "biome check .",
50
+ "dev": "node --watch dist/index.js",
51
+ "bridge": "esbuild src/bridge.ts --bundle --format=iife --global-name=Bridge --platform=neutral --outfile=dist/bridge.bundle.js",
52
+ "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"
53
+ }
54
+ }
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