@com55/node-red-ai-access 0.2.0-beta.6 → 0.2.0-beta.8

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/CHANGELOG.md CHANGED
@@ -6,6 +6,56 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to
7
7
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
+ ## [0.2.0-beta.8] - 2026-10-29
10
+
11
+ - Proposal review shows human conflict reasons and Base / Live / Proposed field
12
+ values, including flow environment variables. Choices have explanations,
13
+ confirmation, a visible chosen state, and persisted undo of the latest choice.
14
+ - Proposals with no net deployment change clearly say nothing changes and hide
15
+ approval and security notes.
16
+ - Consolidate review notes with a count and separate security from
17
+ configuration; omit duplicate comparisons and unchanged editor diffs. Re-check
18
+ shows progress and a result toast. Pending totals match the badge, including
19
+ conflicts.
20
+ - Improve light-theme readability, settings width, sticky navigation clearance,
21
+ sign-in footer visibility and stable sign-in button colors; errors use alerts.
22
+ - Reject invalid TTL settings with a minimum of 1; keep invalid input visible
23
+ and never report it saved. Investigate the NR4 Active link (box-only
24
+ findings).
25
+
26
+ - Merge disjoint fields on the same node and tab, including env entries by
27
+ unique name and credentials by key. Conflict choices preserve independent
28
+ changes from both sides and retain secret safeguards and warnings.
29
+ - Keep peer proposals mergeable after approval of a different field on the same
30
+ node.
31
+ - Report actual changed fields in `outbound_node_changed` warnings.
32
+ - Expose `baseRev` and rename the informational revision flag to
33
+ `baseRevChanged`; use `rebase.state` and `rebase.rev` to assess the checked
34
+ merge.
35
+ - Add `nodeId` + `choice` to MCP/REST proposal resolution and clarify that
36
+ replacement operations apply to the flow snapshot at `expectedRev`.
37
+ - Allow full admins to withdraw proposals after token loss, with recovery
38
+ authority and original ownership in the audit log. Other tokens remain
39
+ blocked.
40
+
41
+ ## [0.2.0-beta.7] - 2026-10-28
42
+
43
+ ### Fixed
44
+
45
+ - Unrelated flow changes no longer expire or reject pending proposals.
46
+
47
+ ### Added
48
+
49
+ - Automatic three-way rebasing onto live flows, with a `conflict` status that
50
+ blocks approval until resolved.
51
+ - Configurable `proposalTtlDays` (1–365 days, default 7); only TTL expiry closes
52
+ old open proposals.
53
+ - Admin conflict-choice and recheck routes, AI REST resolution, and the MCP
54
+ `resolve_proposal_conflict` tool.
55
+ - Diffs include editor changes and the merged deployment; approval requires a
56
+ `mergedHash` acknowledgement when live changes are merged.
57
+ - Recent known stale revisions are accepted at submit and rebased immediately.
58
+
9
59
  ## [0.2.0-beta.6] - 2026-10-28
10
60
 
11
61
  ### Added
package/README.md CHANGED
@@ -14,10 +14,10 @@ Temporary, owner-approved Node-RED access for AI clients. Ships as a **Node-RED
14
14
  services
15
15
 
16
16
  **Git mental model:** a proposal is like a pull request. Human approve = merge;
17
- reject = close; withdraw = the author closes their own PR. If `rev` /
18
- `expectedRev` does not match, treat it as a conflict: re-read the flow, rebase
19
- the edit, and resubmit. Every access link can see all proposals
20
- (`mine: true|false`).
17
+ reject = close; withdraw = the author closes their own PR. Revision changes
18
+ auto-rebase open proposals. A `conflict` blocks approval until resolved. Open
19
+ proposals expire after a configurable TTL (default 7 days). Every access link
20
+ can see all proposals (`mine: true|false`).
21
21
 
22
22
  Derived from
23
23
  [ziv-daniel/node-red-mcp](https://github.com/ziv-daniel/node-red-mcp).
@@ -46,8 +46,12 @@ Configuration).
46
46
  The `/ai-access` HTML shell is served without adminAuth so the page can read the
47
47
  editor token from browser `localStorage` (Node-RED does not use cookies) and
48
48
  call APIs with `Authorization: Bearer`. If no valid token is present, the page
49
- redirects to the editor login. All data and actions stay behind permission
50
- checks.
49
+ shows a sign-in card. With credentials login, it posts to
50
+ `<httpAdminRoot>/auth/token` as client `node-red-editor` using the password
51
+ grant. The token is shared with the editor, stored under the editor's
52
+ `localStorage` key (`auth-tokens` at `/`, or e.g. `auth-tokens-admin` at
53
+ `/admin`). Other login strategies open the editor to sign in. All data and
54
+ actions stay behind permission checks.
51
55
 
52
56
  The dashboard has tabs for **Overview** (status and diagnostics), **Settings**,
53
57
  **Access tokens**, **OAuth**, **Proposals** and **Audit log**. You can create
@@ -74,6 +78,9 @@ module.exports = {
74
78
  maxActiveLinks: 10,
75
79
  // Deploy type used on approve (default: "nodes"; also "flows" | "full")
76
80
  defaultDeploymentType: 'nodes',
81
+ approveQueueTimeoutMs: 60_000, // maximum time waiting to start approval
82
+ deployTimeoutMs: 60_000, // caller deadline; does not cancel deployment
83
+ deployHardCapMs: 300_000, // release the queue even if deployment never settles
77
84
  // In-memory rate limits for /mcp/api and /mcp/a (per IP + per access token)
78
85
  rateLimitWindowMs: 60000,
79
86
  rateLimitMaxPerIp: 600,
@@ -402,10 +409,83 @@ revoke the link and create a new one. After a restart every old token is
402
409
  invalid.
403
410
 
404
411
  Call `list_flows` or `get_flow` first and pass the returned `rev` as
405
- `expectedRev`. Submit checks the live rev (**409** if stale). Approve may send
406
- `deploymentType`: `nodes` (default), `flows`, or `full`. A stale `expectedRev`
407
- at approve marks the proposal **rejected** with a resubmit message; other deploy
408
- errors mark it **failed**. Reject never mutates flows.
412
+ `expectedRev`. Recent known stale revisions are accepted and auto-rebased;
413
+ unknown revisions return **409** `version_mismatch`. Human approval waits up to
414
+ 60 seconds for deployment. A timeout returns **504** `deploy_timeout`, leaves
415
+ the proposal pending with a persisted `deployPending` reason shown in the API
416
+ and dashboard, and holds the approval queue until the runtime settles or the 5
417
+ minute hard cap is reached. Before the cap, a late success marks the proposal
418
+ approved with its `resultRev`; a late failure clears `deployPending` and keeps
419
+ it pending for retry. At the cap the queue and proposal lock are released,
420
+ `deployPending.queueReleased` becomes true, and the card asks reviewers to check
421
+ the live flow before approving again. Later runtime settlement leaves this
422
+ unknown-outcome record unchanged. Every subsequent approval re-reads live flows
423
+ before rebasing and deploying, recognizing already-applied results. Queued
424
+ approvals time out after 60 seconds with **504** `approve_queue_timeout` without
425
+ deploying. Queued proposals can still be rejected or withdrawn; their approvals
426
+ then return `proposal_not_pending` when dequeued. These three deadlines are
427
+ configurable in `settings.js` under `aiAccess` (positive milliseconds; invalid
428
+ values use the defaults shown above). When choosing **proposed** during conflict
429
+ resolution, unchanged secret spans keep their live editor values. If spans
430
+ cannot be aligned safely, proposed values are retained with a
431
+ `secret_may_revert` warning on the dashboard card. Deliberately deleted secret
432
+ spans do not raise this warning. Deleting one of several identical secret lines
433
+ while their live values changed keeps the proposal in conflict; resolve that
434
+ field against the live flow or choose **live**. Changed env arrays with
435
+ duplicate names show `duplicate_env_keys`, since pairing by name is ambiguous
436
+ when entries are reordered.
437
+
438
+ Open proposals merge changes per node and tab field. Different fields on the
439
+ same node merge automatically; changes to the same field conflict even when both
440
+ values are identical. Position (`x`/`y`) edits never conflict; a proposed
441
+ position edit wins a tie. Env entries merge by unique name and then entry field;
442
+ credentials merge by key (including nested keys). Duplicate env names use an
443
+ atomic array comparison and retain the existing ambiguity warning. Deletion
444
+ versus modification, id collisions, dangling references, and unsafe redacted
445
+ placeholders still block approval.
446
+
447
+ Proposal responses and diffs expose `baseRev` (an alias of `expectedRev`).
448
+ `baseRevChanged` replaces `baseRevStale`: it only reports that the base revision
449
+ differs from live for an open proposal. It is informational, including after a
450
+ successful rebase. `rebase.rev` is the checked live revision and `rebase.state`
451
+ is `clean` (proposal applies unchanged), `merged` (live edits incorporated), or
452
+ `conflict` (approval blocked). A merged proposal still requires review of its
453
+ current `mergedHash` before approval.
454
+
455
+ MCP `resolve_proposal_conflict` and REST `POST /proposals/:id/resolve` accept
456
+ `nodeId` + `choice: "live" | "proposed"` for one current conflict. Choices
457
+ affect only overlapping fields; independent edits from both sides survive.
458
+ Existing secret preservation and ambiguity warnings also apply. Alternatively
459
+ send `expectedRev` + `payload` to replace the proposal body: node operations
460
+ apply to the **flow snapshot at expectedRev**, not to the stored proposal or
461
+ merged result, so include every intended edit. These modes cannot be mixed. Both
462
+ require the submitting token; tab conflicts use the flow id as `nodeId`.
463
+
464
+ If the submitting token is lost, a full (`*`) admin can withdraw an open
465
+ proposal through `POST /mcp/api/v1/proposals/:id/withdraw` using the dashboard's
466
+ authenticated admin session (optional JSON `reason`). Other access tokens,
467
+ including replacement tokens, cannot withdraw it. Recovery records
468
+ `proposal.withdrawn` with the admin identity, original owner id,
469
+ `withdrawalAuthority: "admin-recovery"`, proposal id, and reason. Owner-token
470
+ withdrawal records `withdrawalAuthority: "owner-token"`. Withdrawal never
471
+ deploys flows and cannot interrupt an in-flight approval.
472
+
473
+ Open proposals auto-rebase on editor changes. A `conflict` blocks approval until
474
+ resolved using REST `POST /proposals/:id/resolve`, admin
475
+ `POST /proposals/:id/resolve-conflict`, or MCP `resolve_proposal_conflict`. The
476
+ dashboard confirms conflict choices and shows the chosen side. Admins can undo
477
+ the latest choice with `POST /proposals/:id/resolve-conflict` and
478
+ `{ "nodeId": "...", "choice": "undo" }` until the next proposal edit or choice;
479
+ undo restores the proposal and rechecks current live flows without deploying.
480
+ Diffs include `conflictValues` (base/live/proposed per field, including flow
481
+ env; redacted for AI callers), `rebase`, `liveChanges` and (without conflicts)
482
+ `vsCurrent`, the merged deployment. Approval requires the reviewed `mergedHash`
483
+ when editor changes are merged. Proposals expire after `proposalTtlDays`
484
+ (integer 1–365, default 7), editable through the settings API. Approve may send
485
+ `deploymentType`: `nodes` (default), `flows`, or `full`. Approval rebases
486
+ against the current revision; conflicts leave the proposal open for resolution.
487
+ Deploy timeouts keep it **pending**; other deploy errors mark it **failed**.
488
+ Reject never mutates flows.
409
489
 
410
490
  ### Flow runtime adapter
411
491
 
package/ai-access.html CHANGED
@@ -14,7 +14,7 @@
14
14
  }
15
15
  window.__com55AiAccessSidebarLoading = true;
16
16
 
17
- var EDITOR_SIDEBAR_ASSET_VERSION = '0.2.0-beta.6';
17
+ var EDITOR_SIDEBAR_ASSET_VERSION = '0.2.0-beta.8';
18
18
  var root = (RED.settings.httpAdminRoot || '/').replace(/\/$/, '');
19
19
  var src =
20
20
  (root || '') +