@rolealpha/n8n-nodes-rolealpha 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,6 +45,9 @@ next run follows. You don't edit code and you don't republish anything.
45
45
  - **Teams of agents on one step.** Several roles share a step. Each agent does its own part,
46
46
  waits for what it needs and is woken when it arrives. Agents that hang are escalated to
47
47
  the role that leads their circle.
48
+ - **Workflows that follow the organisation.** When a step, role or agent is created, changed
49
+ or removed in roleALPHA, a model proposes what that means for the n8n workflows. The
50
+ proposal becomes an inactive draft, and only a person filling the deciding role can apply it.
48
51
  - **Limits you can change without republishing.** Retries, wait times, run time and tool
49
52
  calls come from a settings table and are clamped to fixed bounds.
50
53
 
@@ -125,6 +128,54 @@ bound to the account does not run. There is no fallback to the view of the accou
125
128
  Approval gates follow this order: **Get Decider → Check Approver → Approval Seal: Sign**. The
126
129
  workflow that sends runs **Approval Seal: Verify** first and stops if the content changed.
127
130
 
131
+ ## Workflows that follow the organisation
132
+
133
+ Most changes in roleALPHA need no workflow change at all: the runner reads roles, duties and
134
+ deciders on every run. What roleALPHA cannot know is technology: a new step needs a trigger, a
135
+ schedule or a mapping of (collection, status) to its custom ID. The **roleALPHA Workflow
136
+ Builder** closes that gap without letting a model change production on its own.
137
+
138
+ ```
139
+ Scheduler (every 15 min)
140
+ └ Data table: snapshot rows
141
+ └ Workflow Builder: Detect Changes new / changed / removed steps, roles, agents
142
+ ├ store and remove snapshot rows
143
+ └ per change: Workflow Builder: Propose ← chat model
144
+ └ Create Draft inactive, tagged rolealpha-draft
145
+ └ roleALPHA: Get Decider (governing step) → e-mail to each person
146
+
147
+ Approval link (behind single sign-on)
148
+ └ roleALPHA: Check Approver (governing step, fail-closed)
149
+ ├ approve → Workflow Builder: Apply Draft only with the hash that was sent out
150
+ └ reject → Workflow Builder: Discard Draft
151
+ ```
152
+
153
+ **Detect** compares a fingerprint of every watched entity (name, custom ID, attributes and
154
+ edges) with the rows stored last time. The first run only stores the snapshot. An entity that
155
+ cannot be read is neither changed nor removed; removals count only when the complete index was
156
+ read.
157
+
158
+ **Propose** gives the model the change, the entity as roleALPHA shows it now (a step with its
159
+ roles, never persons), the managed workflows and the credentials they use. Its answer is
160
+ checked, and a failed check goes back to the model once more with the problems:
161
+
162
+ - only node types from the allow list (no Code node by default),
163
+ - no e-mail address and no UUID in any parameter: those are read from roleALPHA at run time,
164
+ - only credentials already used by managed workflows; a node that stays keeps its own
165
+ credentials, IDs and webhook IDs,
166
+ - updates and deactivations only of managed workflows, connections only between existing nodes.
167
+
168
+ **Drafts** carry everything Apply needs in a sticky note named `roleALPHA binding`: the action,
169
+ the target, the target's version and the content hash. **Apply** refuses when the draft no
170
+ longer has the approved hash or the target changed after the draft was made. A managed workflow
171
+ is one with that note and the tag `rolealpha-managed`; nothing else is ever touched.
172
+
173
+ Two ready workflows are in [`examples/`](examples): import
174
+ `workflows-follow-the-organisation.json` and `approve-workflow-drafts.json`, create a data table
175
+ `rolealpha_snapshot` with the text columns `uuid, entity_type, name, custom_id, fingerprint,
176
+ fields, edges, seen_at`, fill in **Settings** and the credentials, and give a step in roleALPHA
177
+ (the governing step, e.g. `automation:workflow-changes`) a deciding role.
178
+
128
179
  ## Nodes
129
180
 
130
181
  ### roleALPHA (`roleAlpha`)
@@ -153,6 +204,17 @@ workflow that sends runs **Approval Seal: Verify** first and stops if the conten
153
204
  | Settings | Resolve | Runner limits from defaults and a settings table (`scope, target, key, value`): default < global < step < agent. Every value is clamped to fixed bounds; unknown keys and unusable values are reported in `settingProblems` and never applied. | – |
154
205
  | Schedule | Is Due | Decides from the step `frequency` (and `termin` / due date) whether a run is due in the current period. | – |
155
206
 
207
+ ### roleALPHA Workflow Builder (`roleAlphaWorkflowBuilder`)
208
+
209
+ | Operation | What it does | Credential |
210
+ |---|---|---|
211
+ | Detect Changes | Compares the watched entity types (default: process, role, agent) with the stored snapshot rows. Returns `changes` (`created`, `changed` with `changedFields`, `edgesAdded`, `edgesRemoved`, `removed`), the rows to `upsert` and `remove`, and `unreadable`. | MCP OAuth2 |
212
+ | List Workflows | The managed workflows with their bound entities and the credentials they use. | n8n API |
213
+ | Propose | Needs a chat model on its **Model** input. Returns `ok`, `action` (`create`, `update`, `deactivate`, `none`), `reason`, `workflow`, `contentHash`, `problems` and `notes`. | MCP OAuth2, n8n API |
214
+ | Create Draft | Stores a proposal with `ok = true` as an inactive draft. Returns `draftId` and `contentHash`. | n8n API |
215
+ | Apply Draft | Applies a draft given the approved hash. Optionally activates a new workflow. | n8n API |
216
+ | Discard Draft | Deletes a draft; refuses any workflow that is not a draft. | n8n API |
217
+
156
218
  ### Approval Seal (`approvalSeal`)
157
219
 
158
220
  `Sign` seals exactly the approved content together with the approver. Use it after **Check
@@ -177,6 +239,7 @@ under the agent → *Context & Access*.
177
239
  | **MCP OAuth2** (n8n built-in) | Access to the roleALPHA MCP endpoint for one organisation. Used for agents (default source) and for every traversal. The `agent` view needs admin rights on the tenant. For **Connect As: Agent** it must be a roleALPHA function account (grant type Client Credentials) whose role has `agent:run` and that may run the agent ("May run these agents"). |
178
240
  | **roleALPHA Agent Keys API** | Optional, for the `Agent Keys` source. `baseUrl` of the data node, and `keys`: `{"<agent uuid>": "agt_…"}`, or a list of `{agentUuid, key, label}`. An agent key reads only its own agent, so it cannot traverse. |
179
241
  | **roleALPHA Webhook API** | One signing secret, a JSON list of secrets, or a map from agent UUID to secret. |
242
+ | **n8n API** (n8n built-in) | API key and base URL (`https://<host>/api/v1`) of the n8n instance the Workflow Builder manages. |
180
243
  | **Approval Seal API** | `key` (sign and verify) and optionally `legacyKey` (verify v2 only). |
181
244
 
182
245
  Agent keys and webhook secrets are issued in the roleALPHA interface and shown only once.
@@ -216,6 +279,9 @@ record_keys, event, run_id, attempts, progress, at`.
216
279
  - The prompt marks trigger payloads as data. Guardrails take precedence over event content.
217
280
  - Keep `requireActive` and `requireGuardrails` on in production.
218
281
  - Settings are clamped to fixed bounds.
282
+ - The Workflow Builder never activates or changes a workflow by itself. A proposal is an
283
+ inactive draft; Apply needs the hash that was sent to the approver and a target that did not
284
+ change since. Approval runs through Check Approver, so the webhook needs a signed-in address.
219
285
  - Duplicate runs are blocked by leases, and wake-ups are claimed before they fire.
220
286
  - No credentials are kept in wait, settings or cache rows. The share cache key holds no
221
287
  record content, and a cached answer is checked again like a fresh one.
@@ -314,6 +380,10 @@ not caught by the graph.
314
380
  | `MCP initialize failed with HTTP 429` | Many runs started at once and roleALPHA turned some away. The client repeats a call turned away with 429 or 503 up to four times (Retry-After, else 1, 2, 4, 8 s). If it still fails, start fewer runs at once. |
315
381
  | `Empty MCP response` | The server answered with no body. Reading calls are repeated; a writing tool is not, so it cannot run twice. |
316
382
  | `Cannot access "arguments" due to security concerns` | n8n blocks the name `arguments` in expressions and in `$fromAI`. Name the tool input `toolArgs` or `args`. |
383
+ | Propose returns `ok: false` | The model's answer failed the check twice; `problems` says why. Often a node type outside the allow list or a hard-coded address. Add what the model needs to **Extra Rules**. |
384
+ | `The draft changed after it was proposed or approved` | Somebody edited the draft, or the link carries another hash. Discard it; the next change proposes again. |
385
+ | `Workflow … changed after the draft was made` | The target was edited after the draft. Discard the draft and let the builder propose again. |
386
+ | Detect fails with `more than Max Entities` | Every watched entity costs two reads per run. Watch fewer types or raise the limit. |
317
387
  | Webhook answers `401` | The `X-RA-Signature` does not match. Check the secret in **roleALPHA Webhook API**. |
318
388
 
319
389
  ## Licence
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Change detection in the roleALPHA graph. roleALPHA sends no event when a step, role or
3
+ * agent is created or changed, so a scheduler takes a snapshot and compares it with the
4
+ * rows it stored the last time.
5
+ *
6
+ * Fail-closed: an entity that could not be read is neither new nor changed nor removed;
7
+ * its old row stays. Removals are reported only when the complete index was read.
8
+ */
9
+ import type { GraphSource, Relationship } from './graph';
10
+ import type { McpClient } from './mcp';
11
+ /** Entity types of the lean index (list_entities). */
12
+ export declare const ENTITY_TYPES: readonly ["process", "role", "agent", "policy", "organigramm", "project", "okr", "person"];
13
+ export interface IndexEntry {
14
+ uuid: string;
15
+ name: string;
16
+ entityType: string;
17
+ }
18
+ export interface EntitySnapshot {
19
+ uuid: string;
20
+ name: string;
21
+ /** Type of the lean index (process, role, agent, …). */
22
+ entityType: string;
23
+ customId: string | null;
24
+ /** Short hash per attribute, so a change names the attributes that changed. */
25
+ fields: Record<string, string>;
26
+ /** `TYPE>uuid` (outgoing) and `TYPE<uuid` (incoming), sorted. */
27
+ edges: string[];
28
+ fingerprint: string;
29
+ }
30
+ /** A stored snapshot row. `fields` and `edges` are JSON strings so any table can hold them. */
31
+ export interface SnapshotRow {
32
+ uuid: string;
33
+ entity_type: string;
34
+ name: string;
35
+ custom_id: string | null;
36
+ fingerprint: string;
37
+ fields: string;
38
+ edges: string;
39
+ seen_at: string;
40
+ }
41
+ export type ChangeKind = 'created' | 'changed' | 'removed';
42
+ export interface EntityChange {
43
+ change: ChangeKind;
44
+ uuid: string;
45
+ name: string;
46
+ entityType: string;
47
+ customId: string | null;
48
+ previousName: string | null;
49
+ changedFields: string[];
50
+ edgesAdded: string[];
51
+ edgesRemoved: string[];
52
+ }
53
+ export interface DetectResult {
54
+ /** No stored rows yet: the snapshot is stored and nothing is reported. */
55
+ baseline: boolean;
56
+ /** Whether the complete index was read; only then are removals reported. */
57
+ complete: boolean;
58
+ changes: EntityChange[];
59
+ /** Rows to insert or replace (by uuid). */
60
+ upsert: SnapshotRow[];
61
+ /** UUIDs whose rows are deleted. */
62
+ remove: string[];
63
+ /** Entities that could not be read this time; their rows stay as they are. */
64
+ unreadable: Array<{
65
+ uuid: string;
66
+ name: string;
67
+ error: string;
68
+ }>;
69
+ }
70
+ export declare function snapshotOf(entry: IndexEntry, details: {
71
+ name: string;
72
+ customId: string | null;
73
+ data: Record<string, unknown>;
74
+ }, rels: Relationship[]): EntitySnapshot;
75
+ export declare function toRow(s: EntitySnapshot, seenAt: string): SnapshotRow;
76
+ /** Rows as they come back from a table: drops rows without uuid or fingerprint. */
77
+ export declare function normalizeRows(raw: unknown): SnapshotRow[];
78
+ export declare function detectChanges(previousRaw: unknown, current: EntitySnapshot[], opts: {
79
+ complete: boolean;
80
+ types: string[];
81
+ unreadable?: DetectResult['unreadable'];
82
+ now?: Date;
83
+ reportBaseline?: boolean;
84
+ }): DetectResult;
85
+ /** Reads the complete lean index of one type, page by page. */
86
+ export declare function listIndex(client: McpClient, organisation: string, entityType: string, maxPages?: number): Promise<IndexEntry[]>;
87
+ export interface SnapshotRead {
88
+ snapshots: EntitySnapshot[];
89
+ unreadable: DetectResult['unreadable'];
90
+ }
91
+ /** Reads details and relationships of every index entry. A failed read marks the entity unreadable. */
92
+ export declare function readSnapshots(src: GraphSource, entries: IndexEntry[], concurrency?: number): Promise<SnapshotRead>;
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ /**
3
+ * Change detection in the roleALPHA graph. roleALPHA sends no event when a step, role or
4
+ * agent is created or changed, so a scheduler takes a snapshot and compares it with the
5
+ * rows it stored the last time.
6
+ *
7
+ * Fail-closed: an entity that could not be read is neither new nor changed nor removed;
8
+ * its old row stays. Removals are reported only when the complete index was read.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.ENTITY_TYPES = void 0;
12
+ exports.snapshotOf = snapshotOf;
13
+ exports.toRow = toRow;
14
+ exports.normalizeRows = normalizeRows;
15
+ exports.detectChanges = detectChanges;
16
+ exports.listIndex = listIndex;
17
+ exports.readSnapshots = readSnapshots;
18
+ const crypto_1 = require("crypto");
19
+ const seal_1 = require("./seal");
20
+ /** Entity types of the lean index (list_entities). */
21
+ exports.ENTITY_TYPES = ['process', 'role', 'agent', 'policy', 'organigramm', 'project', 'okr', 'person'];
22
+ function hash(value, length = 16) {
23
+ return (0, crypto_1.createHash)('sha256').update((0, seal_1.canonicalJson)(value), 'utf8').digest('hex').slice(0, length);
24
+ }
25
+ /** Attributes that change without the entity changing in substance. */
26
+ const VOLATILE = /^(updated_?at|updatedAt|modified_?at|last_?(seen|run|login)(_?at)?|version_?count|views?)$/i;
27
+ function snapshotOf(entry, details, rels) {
28
+ const fields = {};
29
+ for (const [key, value] of Object.entries(details.data ?? {})) {
30
+ if (value === undefined || VOLATILE.test(key))
31
+ continue;
32
+ fields[key] = hash(value, 12);
33
+ }
34
+ const edges = [...new Set(rels.map((r) => `${r.type}${r.direction === 'outgoing' ? '>' : '<'}${r.uuid}`))].sort();
35
+ const name = details.name || entry.name;
36
+ return {
37
+ uuid: entry.uuid,
38
+ name,
39
+ entityType: entry.entityType,
40
+ customId: details.customId,
41
+ fields,
42
+ edges,
43
+ fingerprint: hash({ name, customId: details.customId, fields, edges }),
44
+ };
45
+ }
46
+ function toRow(s, seenAt) {
47
+ return {
48
+ uuid: s.uuid,
49
+ entity_type: s.entityType,
50
+ name: s.name,
51
+ custom_id: s.customId,
52
+ fingerprint: s.fingerprint,
53
+ fields: JSON.stringify(s.fields),
54
+ edges: JSON.stringify(s.edges),
55
+ seen_at: seenAt,
56
+ };
57
+ }
58
+ function parseJson(value, fallback) {
59
+ if (value && typeof value === 'object')
60
+ return value;
61
+ if (typeof value !== 'string' || value.trim() === '')
62
+ return fallback;
63
+ try {
64
+ return JSON.parse(value);
65
+ }
66
+ catch {
67
+ return fallback;
68
+ }
69
+ }
70
+ /** Rows as they come back from a table: drops rows without uuid or fingerprint. */
71
+ function normalizeRows(raw) {
72
+ return (Array.isArray(raw) ? raw : [])
73
+ .filter((r) => !!r && typeof r === 'object')
74
+ .filter((r) => typeof r.uuid === 'string' && r.uuid !== '' && typeof r.fingerprint === 'string')
75
+ .map((r) => ({
76
+ uuid: String(r.uuid).toLowerCase(),
77
+ entity_type: String(r.entity_type ?? ''),
78
+ name: String(r.name ?? ''),
79
+ custom_id: typeof r.custom_id === 'string' && r.custom_id !== '' ? r.custom_id : null,
80
+ fingerprint: String(r.fingerprint),
81
+ fields: typeof r.fields === 'string' ? r.fields : JSON.stringify(r.fields ?? {}),
82
+ edges: typeof r.edges === 'string' ? r.edges : JSON.stringify(r.edges ?? []),
83
+ seen_at: String(r.seen_at ?? ''),
84
+ }));
85
+ }
86
+ function detectChanges(previousRaw, current, opts) {
87
+ const now = (opts.now ?? new Date()).toISOString();
88
+ const types = new Set(opts.types);
89
+ // Rows of other types belong to another detector with another type filter; leave them alone.
90
+ const previous = normalizeRows(previousRaw).filter((r) => types.has(r.entity_type));
91
+ const unreadable = opts.unreadable ?? [];
92
+ const baseline = previous.length === 0 && !opts.reportBaseline;
93
+ const before = new Map(previous.map((r) => [r.uuid, r]));
94
+ const seen = new Set([...current.map((c) => c.uuid), ...unreadable.map((u) => u.uuid.toLowerCase())]);
95
+ const changes = [];
96
+ const upsert = [];
97
+ for (const snap of current) {
98
+ const old = before.get(snap.uuid);
99
+ if (old && old.fingerprint === snap.fingerprint)
100
+ continue;
101
+ upsert.push(toRow(snap, now));
102
+ if (baseline)
103
+ continue;
104
+ if (!old) {
105
+ changes.push({ change: 'created', uuid: snap.uuid, name: snap.name, entityType: snap.entityType, customId: snap.customId, previousName: null, changedFields: [], edgesAdded: snap.edges, edgesRemoved: [] });
106
+ continue;
107
+ }
108
+ const oldFields = parseJson(old.fields, {});
109
+ const oldEdges = new Set(parseJson(old.edges, []));
110
+ const newEdges = new Set(snap.edges);
111
+ const changedFields = [...new Set([...Object.keys(oldFields), ...Object.keys(snap.fields)])].filter((k) => oldFields[k] !== snap.fields[k]).sort();
112
+ if (old.name !== snap.name)
113
+ changedFields.unshift('name');
114
+ if ((old.custom_id ?? null) !== snap.customId)
115
+ changedFields.unshift('customId');
116
+ changes.push({
117
+ change: 'changed',
118
+ uuid: snap.uuid,
119
+ name: snap.name,
120
+ entityType: snap.entityType,
121
+ customId: snap.customId,
122
+ previousName: old.name !== snap.name ? old.name : null,
123
+ changedFields,
124
+ edgesAdded: snap.edges.filter((e) => !oldEdges.has(e)),
125
+ edgesRemoved: [...oldEdges].filter((e) => !newEdges.has(e)).sort(),
126
+ });
127
+ }
128
+ const remove = [];
129
+ if (opts.complete) {
130
+ for (const old of previous) {
131
+ if (seen.has(old.uuid))
132
+ continue;
133
+ remove.push(old.uuid);
134
+ if (!baseline) {
135
+ changes.push({ change: 'removed', uuid: old.uuid, name: old.name, entityType: old.entity_type, customId: old.custom_id, previousName: null, changedFields: [], edgesAdded: [], edgesRemoved: parseJson(old.edges, []) });
136
+ }
137
+ }
138
+ }
139
+ return { baseline, complete: opts.complete, changes, upsert, remove, unreadable };
140
+ }
141
+ // ---------------------------------------------------------------- reading
142
+ function obj(value) {
143
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
144
+ }
145
+ /** Reads the complete lean index of one type, page by page. */
146
+ async function listIndex(client, organisation, entityType, maxPages = 20) {
147
+ const out = [];
148
+ let offset = 0;
149
+ for (let page = 0; page < maxPages; page++) {
150
+ const res = obj(await client.callTool('list_entities', { organisation, entityType, offset }));
151
+ const rows = Array.isArray(res.entities) ? res.entities : [];
152
+ for (const raw of rows.map(obj)) {
153
+ const uuid = typeof raw.uuid === 'string' ? raw.uuid.toLowerCase() : '';
154
+ if (uuid)
155
+ out.push({ uuid, name: String(raw.name ?? ''), entityType });
156
+ }
157
+ if (res.hasMore !== true || rows.length === 0)
158
+ return out;
159
+ offset = typeof res.nextOffset === 'number' ? res.nextOffset : offset + rows.length;
160
+ }
161
+ throw new Error(`The index of "${entityType}" has more than ${maxPages} pages; narrow the entity types`);
162
+ }
163
+ /** Runs `fn` over `items` with at most `limit` calls at a time. */
164
+ async function pool(items, limit, fn) {
165
+ const out = new Array(items.length);
166
+ let next = 0;
167
+ const workers = Array.from({ length: Math.max(1, Math.min(limit, items.length)) }, async () => {
168
+ while (next < items.length) {
169
+ const i = next++;
170
+ out[i] = await fn(items[i]);
171
+ }
172
+ });
173
+ await Promise.all(workers);
174
+ return out;
175
+ }
176
+ /** Reads details and relationships of every index entry. A failed read marks the entity unreadable. */
177
+ async function readSnapshots(src, entries, concurrency = 4) {
178
+ const snapshots = [];
179
+ const unreadable = [];
180
+ await pool(entries, concurrency, async (entry) => {
181
+ try {
182
+ const [details, rels] = await Promise.all([src.details(entry.uuid), src.relationships(entry.uuid)]);
183
+ snapshots.push(snapshotOf(entry, details, rels));
184
+ }
185
+ catch (error) {
186
+ unreadable.push({ uuid: entry.uuid, name: entry.name, error: String(error.message ?? error).slice(0, 300) });
187
+ }
188
+ });
189
+ snapshots.sort((a, b) => a.uuid.localeCompare(b.uuid));
190
+ return { snapshots, unreadable };
191
+ }
192
+ //# sourceMappingURL=changes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changes.js","sourceRoot":"","sources":["../../lib/changes.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AA4EH,gCAqBC;AAED,sBAWC;AAaD,sCAcC;AAED,sCAuDC;AASD,8BAcC;AAsBD,sCAaC;AA1PD,mCAAoC;AACpC,iCAAuC;AAIvC,sDAAsD;AACzC,QAAA,YAAY,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAU,CAAC;AA6DvH,SAAS,IAAI,CAAC,KAAc,EAAE,MAAM,GAAG,EAAE;IACxC,OAAO,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAA,oBAAa,EAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACjG,CAAC;AAED,uEAAuE;AACvE,MAAM,QAAQ,GAAG,6FAA6F,CAAC;AAE/G,SAAgB,UAAU,CACzB,KAAiB,EACjB,OAAiF,EACjF,IAAoB;IAEpB,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC;QAC/D,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AK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAE,KAAe,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QACzH,CAAC;IACF,CAAC,CAAC,CAAC;IACH,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AAClC,CAAC"}
package/dist/lib/mcp.js CHANGED
@@ -108,7 +108,7 @@ class McpClient {
108
108
  nextId = 1;
109
109
  ready;
110
110
  renewing = false;
111
- constructor(transport, clientName = 'n8n-nodes-rolealpha', sleep = sleepFor) {
111
+ constructor(transport, clientName = '@rolealpha/n8n-nodes-rolealpha', sleep = sleepFor) {
112
112
  this.transport = transport;
113
113
  this.clientName = clientName;
114
114
  this.sleep = sleep;
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../lib/mcp.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAuCH,oCAyBC;AAUD,4CAqBC;AAYD,gCAKC;AAtGD,MAAa,QAAS,SAAQ,KAAK;IAGxB;IAFV,YACC,OAAe,EACN,IAAa;QAEtB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFN,SAAI,GAAJ,IAAI,CAAS;QAGtB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACxB,CAAC;CACD;AARD,4BAQC;AASD,SAAS,MAAM,CAAC,OAA6B,EAAE,IAAY;IAC1D,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAClC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,IAAI,GAAG,CAAC,WAAW,E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AAC;QACvE,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;CACD;AA3FD,8BA2FC"}
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Workflows that follow the organisation. When a step, role or agent is created or changed
3
+ * in roleALPHA, a model proposes to create, update or deactivate an n8n workflow. The
4
+ * proposal never goes live by itself: it becomes an inactive draft, a person filling the
5
+ * deciding role approves it, and only then is it applied.
6
+ *
7
+ * The model call stays outside: buildPlanInput prepares it, checkPlan checks the answer.
8
+ * The model can neither pick node types outside the allow list, nor bring in credentials
9
+ * it has not seen, nor bake persons, addresses or UUIDs into a workflow, nor touch a
10
+ * workflow that is not managed.
11
+ */
12
+ import type { EntityChange } from './changes';
13
+ import { type GraphSource } from './graph';
14
+ export declare const MANAGED_TAG = "rolealpha-managed";
15
+ export declare const DRAFT_TAG = "rolealpha-draft";
16
+ export declare const MARKER_NAME = "roleALPHA binding";
17
+ export declare const DRAFT_PREFIX = "Draft: ";
18
+ export declare const DEFAULT_NODE_TYPES: string[];
19
+ export interface N8nNode {
20
+ id?: string;
21
+ name: string;
22
+ type: string;
23
+ typeVersion: number;
24
+ position: [number, number];
25
+ parameters: Record<string, unknown>;
26
+ credentials?: Record<string, {
27
+ id: string;
28
+ name: string;
29
+ }>;
30
+ webhookId?: string;
31
+ disabled?: boolean;
32
+ }
33
+ export type N8nConnections = Record<string, Record<string, Array<Array<{
34
+ node: string;
35
+ type: string;
36
+ index: number;
37
+ }>>>>;
38
+ export interface N8nWorkflow {
39
+ id?: string;
40
+ name: string;
41
+ active?: boolean;
42
+ nodes: N8nNode[];
43
+ connections: N8nConnections;
44
+ settings?: Record<string, unknown>;
45
+ tags?: Array<{
46
+ id?: string;
47
+ name: string;
48
+ }>;
49
+ versionId?: string;
50
+ updatedAt?: string;
51
+ }
52
+ /** What a draft carries about itself, so Apply needs nothing but the draft. */
53
+ export interface DraftInfo {
54
+ action: 'create' | 'update' | 'deactivate';
55
+ targetWorkflowId: string | null;
56
+ /** versionId (or updatedAt) of the target when the draft was made; Apply refuses if it moved on. */
57
+ targetVersion: string | null;
58
+ entityUuid: string;
59
+ change: string;
60
+ contentHash: string;
61
+ reason: string;
62
+ }
63
+ export interface Binding {
64
+ managed: true;
65
+ entities: string[];
66
+ draft?: DraftInfo;
67
+ }
68
+ export interface KnownCredential {
69
+ id: string;
70
+ name: string;
71
+ type: string;
72
+ }
73
+ export interface ManagedWorkflow {
74
+ id: string;
75
+ name: string;
76
+ active: boolean;
77
+ entities: string[];
78
+ isDraft: boolean;
79
+ versionId: string | null;
80
+ nodes: Array<{
81
+ name: string;
82
+ type: string;
83
+ parameters: string;
84
+ credentials: string[];
85
+ }>;
86
+ connections: string[];
87
+ }
88
+ export declare function readBinding(wf: Pick<N8nWorkflow, 'nodes'>): Binding | null;
89
+ export declare function markerNode(binding: Binding, position?: [number, number]): N8nNode;
90
+ /** Hash of exactly what runs: names, types, versions, parameters, credentials and connections. */
91
+ export declare function contentHash(wf: Pick<N8nWorkflow, 'nodes' | 'connections'>): string;
92
+ export declare function summarizeWorkflows(raw: unknown[]): {
93
+ workflows: ManagedWorkflow[];
94
+ credentials: KnownCredential[];
95
+ };
96
+ export interface PlanContext {
97
+ change: EntityChange;
98
+ /** What roleALPHA says about the entity now: details, step, relationships. Never persons. */
99
+ entity: unknown;
100
+ workflows: ManagedWorkflow[];
101
+ credentials: KnownCredential[];
102
+ nodeTypes: string[];
103
+ extraRules?: string[];
104
+ }
105
+ export interface PlanInput {
106
+ systemMessage: string;
107
+ prompt: string;
108
+ schema: Record<string, unknown>;
109
+ }
110
+ export declare const PLAN_SCHEMA: Record<string, unknown>;
111
+ export declare function buildPlanInput(ctx: PlanContext): PlanInput;
112
+ /** Takes the JSON object out of a model answer (plain, fenced, or with text around it). */
113
+ export declare function parseAnswer(answer: unknown): unknown;
114
+ export interface PlanCheck {
115
+ ok: boolean;
116
+ action: 'create' | 'update' | 'deactivate' | 'none';
117
+ reason: string;
118
+ targetWorkflowId: string | null;
119
+ targetVersion: string | null;
120
+ entityUuid: string;
121
+ /** Blocking: the proposal is not used. */
122
+ problems: string[];
123
+ /** Not blocking, for the person who approves (e.g. a credential to set). */
124
+ notes: string[];
125
+ workflow: N8nWorkflow | null;
126
+ contentHash: string | null;
127
+ }
128
+ export declare function checkPlan(ctx: PlanContext, answerRaw: unknown, existing?: N8nWorkflow | null): PlanCheck;
129
+ export declare function draftWorkflow(plan: PlanCheck, change: EntityChange, target?: N8nWorkflow | null): N8nWorkflow;
130
+ /** The hash a draft stands for: its content, or for a deactivation the target and its version. */
131
+ export declare function draftHash(draft: N8nWorkflow): {
132
+ info: DraftInfo;
133
+ hash: string;
134
+ };
135
+ export type N8nRequest = (method: 'GET' | 'POST' | 'PUT' | 'DELETE', path: string, body?: unknown, qs?: Record<string, string | number>) => Promise<unknown>;
136
+ export declare class N8nApi {
137
+ private readonly request;
138
+ constructor(request: N8nRequest);
139
+ listWorkflows(tag: string): Promise<N8nWorkflow[]>;
140
+ get(id: string): Promise<N8nWorkflow>;
141
+ create(wf: N8nWorkflow): Promise<N8nWorkflow>;
142
+ update(id: string, wf: N8nWorkflow): Promise<N8nWorkflow>;
143
+ remove(id: string): Promise<void>;
144
+ activate(id: string): Promise<void>;
145
+ deactivate(id: string): Promise<void>;
146
+ /** Sets the tags of a workflow by name, creating tags that do not exist yet. */
147
+ setTags(id: string, names: string[]): Promise<void>;
148
+ }
149
+ export interface ApplyResult {
150
+ applied: boolean;
151
+ action: DraftInfo['action'];
152
+ workflowId: string;
153
+ draftId: string;
154
+ activated: boolean;
155
+ reason: string;
156
+ }
157
+ /**
158
+ * Applies an approved draft. Fail-closed: the draft must still hash to what was approved,
159
+ * and the target must still be the version the draft was made from.
160
+ */
161
+ export declare function applyDraft(api: N8nApi, draftId: string, approvedHash: string, opts?: {
162
+ activate?: boolean;
163
+ }): Promise<ApplyResult>;
164
+ /** Deletes a rejected draft. Refuses anything that is not a draft. */
165
+ export declare function discardDraft(api: N8nApi, draftId: string): Promise<{
166
+ discarded: boolean;
167
+ draftId: string;
168
+ }>;
169
+ /** The entity as roleALPHA shows it now, without persons: a step with its roles, anything else with its edges. */
170
+ export declare function entityContext(src: GraphSource, change: EntityChange): Promise<unknown>;