@radicaltools/mcp 0.3.4 → 0.5.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.
Files changed (67) hide show
  1. package/README.md +18 -8
  2. package/dist/{chunk-JTRIDVBS.js → chunk-DSR2PAMW.js} +154 -48
  3. package/dist/chunk-ULUOEM3X.js +43 -0
  4. package/dist/dist-4NNGZXOU.js +219 -0
  5. package/dist/{elkLayout-ILGQJOJF.js → elkLayout-YXJWF5QP.js} +2 -1
  6. package/dist/hub-catalogue/concern/concern-api-collections.radical +24 -12
  7. package/dist/hub-catalogue/concern/concern-api-errors.radical +26 -13
  8. package/dist/hub-catalogue/concern/concern-api-evolution.radical +26 -13
  9. package/dist/hub-catalogue/concern/concern-api-idempotency.radical +28 -14
  10. package/dist/hub-catalogue/concern/concern-api-resource-design.radical +24 -12
  11. package/dist/hub-catalogue/concern/concern-api-style-guide.radical +26 -13
  12. package/dist/hub-catalogue/concern/concern-architecture-style.radical +26 -13
  13. package/dist/hub-catalogue/concern/concern-audit-trail.radical +26 -13
  14. package/dist/hub-catalogue/concern/concern-authentication.radical +18 -9
  15. package/dist/hub-catalogue/concern/concern-authorization.radical +34 -17
  16. package/dist/hub-catalogue/concern/concern-availability.radical +20 -10
  17. package/dist/hub-catalogue/concern/concern-backend-stack.radical +16 -8
  18. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +30 -15
  19. package/dist/hub-catalogue/concern/concern-caching.radical +28 -14
  20. package/dist/hub-catalogue/concern/concern-capacity.radical +18 -9
  21. package/dist/hub-catalogue/concern/concern-code-documentation.radical +32 -16
  22. package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +30 -15
  23. package/dist/hub-catalogue/concern/concern-code-review-branching.radical +32 -16
  24. package/dist/hub-catalogue/concern/concern-code-style.radical +24 -12
  25. package/dist/hub-catalogue/concern/concern-communication-style.radical +28 -14
  26. package/dist/hub-catalogue/concern/concern-data-classification.radical +20 -10
  27. package/dist/hub-catalogue/concern/concern-data-consistency.radical +20 -10
  28. package/dist/hub-catalogue/concern/concern-data-store.radical +24 -12
  29. package/dist/hub-catalogue/concern/concern-decomposition.radical +28 -14
  30. package/dist/hub-catalogue/concern/concern-definition-of-done.radical +26 -13
  31. package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +22 -11
  32. package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +28 -14
  33. package/dist/hub-catalogue/concern/concern-deployment.radical +24 -12
  34. package/dist/hub-catalogue/concern/concern-encryption.radical +28 -14
  35. package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +28 -14
  36. package/dist/hub-catalogue/concern/concern-eu-dora.radical +26 -13
  37. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +28 -14
  38. package/dist/hub-catalogue/concern/concern-incident-management.radical +26 -13
  39. package/dist/hub-catalogue/concern/concern-infrastructure.radical +34 -17
  40. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +26 -13
  41. package/dist/hub-catalogue/concern/concern-messaging.radical +18 -9
  42. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +18 -9
  43. package/dist/hub-catalogue/concern/concern-observability.radical +22 -11
  44. package/dist/hub-catalogue/concern/concern-operational-readiness.radical +28 -14
  45. package/dist/hub-catalogue/concern/concern-personal-data.radical +42 -21
  46. package/dist/hub-catalogue/concern/concern-quality-priorities.radical +24 -12
  47. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +30 -15
  48. package/dist/hub-catalogue/concern/concern-release-versioning.radical +28 -14
  49. package/dist/hub-catalogue/concern/concern-retention.radical +28 -14
  50. package/dist/hub-catalogue/concern/concern-secrets.radical +32 -16
  51. package/dist/hub-catalogue/concern/concern-secure-coding.radical +28 -14
  52. package/dist/hub-catalogue/concern/concern-secure-development.radical +26 -13
  53. package/dist/hub-catalogue/concern/concern-security-detection.radical +22 -11
  54. package/dist/hub-catalogue/concern/concern-supply-chain.radical +28 -14
  55. package/dist/hub-catalogue/concern/concern-technical-debt.radical +30 -15
  56. package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +26 -13
  57. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +26 -13
  58. package/dist/hub-catalogue/concern/concern-test-strategy.radical +26 -13
  59. package/dist/hub-catalogue/concern/concern-threat-modelling.radical +26 -13
  60. package/dist/index.js +17408 -1104
  61. package/dist/pdfjs-7X3VKNRD.js +33203 -0
  62. package/dist/tree-sitter/tree-sitter-c-sharp.wasm +0 -0
  63. package/dist/tree-sitter/tree-sitter-go.wasm +0 -0
  64. package/dist/tree-sitter/tree-sitter-java.wasm +0 -0
  65. package/dist/tree-sitter/tree-sitter.cjs +4075 -0
  66. package/dist/tree-sitter/tree-sitter.wasm +0 -0
  67. package/package.json +6 -2
package/README.md CHANGED
@@ -47,13 +47,21 @@ Launch Studio with `npm run dev:web` from the repository root, open it in Chromi
47
47
 
48
48
  The server binds to one folder at launch, then reads it afresh for every tool call. Its tools are the shared AI tool catalogue from `@radical/common/ai/tools`, the one Studio's AI chat and Radical Forge use, minus the canvas-only `set_active_view` and `focus_node` and the destructive `reset_diagram`. It provides:
49
49
 
50
- - `get_model_summary` (counts, views, sequences, milestones, presentations, the modelling rules Studio's chat and Forge follow, and the metamodel rules) and `search_model` (a small query language, including `LIST SEQUENCES` and `GET SEQUENCE`);
51
- - the `forge_*` tools: a Radical Forge run with the agent's model, ending with a Review stage over the whole model. Each stage may fill gaps in earlier stages, but only by asking: `forge_propose_refinement` checks a proposal and returns exactly what it would write, for the agent to show the user, and `forge_answer_refinement` writes it only if the user accepts (while a stage is open the server refuses direct writes to earlier stages, and every write while a proposal waits for its answer). `forge_complete_stage` lists what the stage refined, with the gaps the completeness rules still find. In a folder with no base from git, `forge_start` saves the model as it was before the run to `.state/base.json`, so Studio's Changes on branch shows the run. After every step the server writes where the run stands to `.state/forge-run.json` (next to the selection, also out of git), and marks it closed when the client goes away, so Studio open on the folder can show it on its Forge button;
52
- - `get_issues`: every rule the model breaks now, as the Validation list in Studio's metamodel editor shows it. A write is refused when it brings in a new error; the warnings it brings in (a state machine without an initial state, a reference to no node, …) come back with its result, since a model is often incomplete while it is being built;
50
+ - `get_model_summary` (counts, views, sequences, milestones, presentations, the modelling rules Studio's chat and Forge follow, and the metamodel in brief; `types` gives named types in full) and `search_model` (a small query language, including `LIST SEQUENCES` and `GET SEQUENCE`; lists and traversals answer in brief, `GET NODE` and a trailing `FULL` give everything);
51
+ - the `forge_*` tools: a Radical Forge run with the agent's model, ending with a Review stage over the whole model, which the server's instructions tell the agent to start only when the user asks for it (otherwise it keeps the model current as it works). `forge_skip_stage` leaves out stages not begun, with the reason: the later stages run without them, and `forge_finish` and Studio name them. `forge_finish` is refused while a stage is open or a proposed refinement waits for the user's answer; a finished run guards no edit.
52
+ - `review_requirements`: each requirement added or changed on the branch, its derives relations included (and each one a changed need leads to) next to the whole text of the needs it derives from, for the agent to confirm or correct before the code; it names requirements without a need and needs that hold no question asked of a person. The modelling rules ask the agent to keep each question and answer in the need word for word. Each stage may fill gaps in earlier stages, but only by asking: `forge_propose_refinement` checks a proposal and returns exactly what it would write, for the agent to show the user, and `forge_answer_refinement` writes it only if the user accepts (while a stage is open the server refuses direct writes to earlier stages, and every write while a proposal waits for its answer). `forge_complete_stage` lists what the stage refined, with the gaps the completeness rules still find. In a folder with no base from git, `forge_start` saves the model as it was before the run to `.state/base.json`, so Studio's Changes on branch shows the run. After every step the server writes where the run stands to `.state/forge-run.json` (next to the selection, also out of git), and marks it closed when the client goes away, so Studio open on the folder can show it on its Forge button;
53
+ - An Access file (.mdb, .accdb) a unit uses is read for its tables, columns and relations (with `mdb-reader`, a dependency of this package); the CLI reads none.
54
+ - A VB6 application's forms are screens of the run (`assay_facts` kind `screens`): a plan's mockups of them get a wireframe drawn from the form and `navigates-to` where its code opens another form. `assay_explore_act` takes `expect` (a text the screen shows; the path's test asserts it). A requirement may name the `processes` that meet it. A transition's evidence is marked `sets` or `quoted` in `run.json`, and a test that asserts nothing rests no scenario.
55
+ - `assay_apply` also takes `entities`, `processes` and `stateMachines`: entities written observed on the table facts they are (columns and foreign keys from SQL and ORM classes), joined only where a foreign key states it and realised by every element whose code names their table; processes and state machines written directly as inferred, each step and transition on the entry points (routes, VB6 forms and menus, jobs, handlers), paths, status values or code it rests on. A requirement's scenario may rest on the code it is drawn from (`citations`); accepted, a pending test of it is written where the unit that builds its element has a test framework, and bound in `.radical/radical.json`.
56
+ - After every `assay_*` call the server writes where the Assay run stands to `.state/assay-run.json` (the repositories read, each stage from C4 to Scenarios with its plans written and refused, the proposals waiting and answered), the stage told from the calls: a plan is of the latest stage its contents name, and a stage the run moves past with no plan is skipped. Studio open on the central model shows it on an Assay button beside the Forge button; the run is marked closed when the client goes away.
57
+ - `assay_search`: the lines of a run's repository or source that hold a text or match a regular expression, with their files and lines, to find what to read with `assay_read`.
58
+ - `assay_explore` and `assay_explore_act`: Radical Assay's Explore stage. The server opens a web application running on this machine in a browser it drives (the user's Chrome, else Playwright's Chromium: `npx playwright install chromium`; `RADICAL_ASSAY_BROWSER` picks one) and records the agent's actions as named paths, each screen with its controls and a screenshot in `.radical/assay/explore/`. Other hosts and controls that pay or delete an account are refused. A plan's `mockups` and a scenario's `paths` use them; an accepted path becomes a Playwright test in the application repository's `e2e/assay/`.
59
+ - the `assay_*` tools: a Radical Assay run, finding the model in existing code, with this folder as the central model. `assay_start` reads the facts of the code in the directories given (a directory holding repositories stands for each; a folder of code with no `.git`, or a `.zip` file of code, unpacked without its `.git` folders, is one too; a folder of code is left as it was, its facts kept in `.radical/assay/facts/`), each with its file and line, writes them to each repository's `.radical/assay/facts.json`, links their units and answers in brief (at most about 20 KB: the counts, each repository's first units, services and databases, the links counted by kind); `assay_procedure` gives the steps, stage by stage; `assay_facts` lists the facts and links a page at a time (at most 200 and about 20 KB, with where the next starts). `assay_apply` takes a plan of elements and relations, each citing the facts it rests on and marked observed or inferred: it refuses the whole plan, naming every problem, when something cites no fact or a fact the run lacks, an observed claim cites nothing that states it, or the metamodel forbids it; otherwise it writes it, maps the elements built from units in each code repository's `.radical/radical.json` (with a `"model"` entry naming the central model) and keeps the evidence in `.radical/assay/run.json`, not in the model. For a repository Assay reads no units of (VB6, COBOL, Delphi, …), an inferred item may rest on code the agent quotes instead (`citations`: repository, file, lines and the text, which the server checks is in those lines, spacing aside), and an element names the folders it is built in (`paths`); only facts back an observed claim. The plan's requirements, each with the scenarios that verify it from the tests, come back as proposals; `assay_answer` writes one only when the user accepts it (derived from a need *Found in the code*, its tests bound in `.radical/radical.json`), and `assay_finish` says what the run wrote. Documentation is a source of hypotheses: `assay_start`'s `sources` and `assay_add_sources` take folders, files, `.zip` files and public links (no credentials: a link that asks for a login is refused, to be exported by hand; links to loopback, link-local or private addresses are refused unless the server runs with `RADICAL_ASSAY_PRIVATE_LINKS=1`), kept as text in `.radical/assay/sources/` (HTML as Markdown, a PDF's text) and listed as document facts with their headings, as each repository's README, docs and ADR records are; `assay_read` returns a file's lines of the run, numbered, or lists a folder's files. A requirement from documents that no code builds names no element and is written unsatisfied; `assay_answer` can name the need a requirement derives from (`changes.need`). A plan's `needs` and `decisions` drawn from documents, and requirements with no scenarios that cite them, come back as proposals too; a document never backs an observed claim. The `assay` prompt starts a run;
60
+ - `get_issues`: every rule the model breaks now, as the Validation list in Studio's metamodel editor shows it. On a large model the open concerns run long: `concerns: "brief"` lists each in one line, `concept` gives one in full, `concerns: "none"` leaves them out. A write is refused when it brings in a new error; the warnings it brings in (a state machine without an initial state, a reference to no node, …) come back with its result, since a model is often incomplete while it is being built. So do the findings of the rules about the person's words that it brings in (a quote the need does not hold, a value a requirement drops or gives another sense, a quoted value or a person's example no scenario names, an answer no requirement quotes), except those the folder's `check.json` turns off; a finding that only names fewer values or parts than before (one of two wrong values corrected) is not brought in;
53
61
  - `get_selection`: what is selected on Studio's canvas for this folder (the view on screen, each selected node in full, selected relations), so you can say "fix the selected mockup" instead of naming it. Studio writes it to `.state/selection.json` in the model folder whenever the selection or the view changes, and clears it when you switch to another model; `.state/` carries its own `.gitignore`, and the file is not part of the model, so writing it never conflicts with model edits;
54
62
  - `get_changes`: what changed in the model since its version in git, for an agent asked to implement a change made in the model. It lists the elements and relations added, removed and changed (uncommitted edits included), each changed field with its old and new value, and each element with its place and its relations, such as the component that satisfies a requirement and the scenarios that verify it. Views, positions, sizes and folding are left out. `since` names the branch, tag or commit to compare with; by default it is the merge base with the default branch (`origin/main`), so every model change on the branch counts. `radical diff` prints the same list. Without `since` it also saves that base to `.state/base.json`, for Studio to show the same changes (Changes on branch);
55
- - `get_verification` and `set_verification`: which tests check the model's scenarios and fitness functions, in the repository's `.radical/radical.json` ("verifies"; the model names no test). `get_verification` with an `id` lists the tests bound to it; without one, every entry and the scenarios this repository must verify that have nothing checking them. `set_verification` replaces a scenario's or fitness function's tests, or takes it out with `remove: true`, as `radical verify` does; call it for each test you write. It changes no model file;
56
- - `get_implementation` and `set_implementation`: where the repository builds the model's elements, in its `.radical/radical.json` (folders from the repository's root). `get_implementation` with an `id` gives the element's folders, its own or its nearest mapped parent's; without one, every entry and the C4 elements built nowhere the file says. `set_implementation` replaces an element's folders, or takes it out with `remove: true`, as `radical implement` does; it changes no model file. The repository's sensors, `radical check` and Studio's element card read the same file;
63
+ - `get_verification` and `set_verification`: which tests check the model's scenarios and fitness functions, in the repository's `.radical/radical.json` ("verifies"; the model names no test). `get_verification` with an `id` lists the tests bound to it; without one, every entry and the scenarios this repository must verify that have nothing checking them. `set_verification` binds the `tests` it is given beside those a scenario or fitness function has, as `radical verify --test` does, unbinds those in `drop` (with `tests`, it replaces one test by another), or takes the entry out with `remove: true`; call it for each test you write. It changes no model file;
64
+ - `get_implementation` and `set_implementation`: where the repository builds the model's elements, in its `.radical/radical.json` (folders from the repository's root). `get_implementation` with an `id` gives the element's folders, its own or its nearest mapped parent's; without one, every entry and the C4 elements built nowhere the file says. `set_implementation` replaces an element's folders, or takes it out with `remove: true`, as `radical implement` does; it changes no model file. `remove: true` also takes out an entry whose element the model no longer has, and `delete_node` (any write that deletes elements) takes the deleted elements' entries out of the file and says so. The file is the one `radical check` reads, found from the model folder up to the repository's root, else a new one there (the folder `.radical/` is in, or the model folder's parent outside a repository), as the CLI and Studio write it, and every writer keeps the keys it does not know (`$schema`, an `owner`). The repository's sensors, `radical check` and Studio's element card read the same file;
57
65
  - `add_`, `update_` and `delete_` tools for nodes and relations, and `move_node` to change a node's parent (the node keeps its canvas position where it lies inside the new parent and clear of its new siblings, else it is placed beside them and what lies round the grown parent makes room; it enforces the metamodel's `allowedParents`). A reference property (a transition's `event` and `raises`) takes node ids or tempIds from the same connection and refuses a node of the wrong type;
58
66
  - `create_view`, `update_view` (name, folder in the list of views, line style, kind, linked sequence, hidden relations, elements shown open or folded, filter chain, or `viewpoint`: one of the metamodel's viewpoints, whose kind and chain the view then follows, with `subject` the element it draws for a viewpoint that draws one, such as a state machine or a system's containers; `null` keeps them for the view alone), `set_view_nodes`, `order_views` (the order of views, and so of their folders) and `delete_view`;
59
67
  - `create_sequence`, `update_sequence` and `delete_sequence`: ordered relation flows that a `dynamic` view plays;
@@ -61,10 +69,12 @@ The server binds to one folder at launch, then reads it afresh for every tool ca
61
69
  - `list_milestones`, `create_milestone`, `update_milestone`, `delete_milestone` and `compare_milestones`: named copies of the model at phases of the system ("As-is", "Target 2027"). `create_milestone` saves the current model as the latest one and `compare_milestones` lists what changed; no tool loads a milestone over the current model, which stays in Studio's timeline;
62
70
  - `upsert_viewpoint` and `delete_viewpoint`: viewpoints of the metamodel, a view type and a filter chain under a name (given as `pipeline` or copied from a view with `fromViewId`), in a `group` such as `C4` or `Requirements`, and with `subjectTypes` drawing one element of those types per view. Studio's New view offers them, and the views of a type follow its changes; a deleted type leaves its views their kind and chain. They do not copy a built-in metamodel: a model keeps its own viewpoints when Studio swaps the preset in;
63
71
  - `upsert_node_type`, `delete_node_type`, `upsert_relation_type` and `delete_relation_type`. A type takes a `description` (what it is; the wiki view shows it), a relation type also `forwardLabel` and `inverseLabel` (how it reads in a sentence from its source and from its target). A built-in metamodel is copied to a `…-custom` id on the first edit, because Studio replaces built-in metamodels with their preset on load. A type cannot be deleted while elements or relations of it remain, in the model or in a milestone, or while a viewpoint or a view's filter chain names it. After a metamodel change (from these tools or from Studio) the server re-advertises the node and relation tool schemas;
64
- - `smart_layout`, for All elements or one static view (`viewId`), which then gets its own saved positions; a dynamic view plays its sequence and, like a table or a wiki, has no canvas layout;
65
- - `align_nodes` (a row or a column, with `keepOrder` to keep the listed order), `grid_nodes` (`columns` columns, filled row by row) and `remove_alignment`, for All elements or one static view (`viewId`). Studio and `smart_layout` keep these rules in every later layout.
72
+ - `smart_layout`, for All elements or one static view (`viewId`), which then gets its own saved positions (a view never laid out is laid out from the places Studio opens it with: All elements', an element lying outside its container there placed inside it; with `around`, a pinned container and one the selection does not reach keep their place and size); a dynamic view plays its sequence and, like a table or a wiki, has no canvas layout;
73
+ - `align_nodes` (a row or a column, with `keepOrder` to keep the listed order), `grid_nodes` (`columns` columns, filled row by row) and `remove_alignment`, for All elements or one static view (`viewId`). Studio and `smart_layout` keep these rules in every later layout. A rule an agent sets is lined up when Studio shows the canvas, and `smart_layout` lines it up first too, so both lay the view out from the same canvas.
66
74
 
67
- These use Studio's shared schemas and model rules. Besides counts, `get_model_summary` returns the metamodel context message the other tool descriptions refer to: each type's property keys and enum options, allowed parents, cardinality and relation pairs. The server's MCP instructions tell clients to call it first. New nodes are placed inside their parent below its header (root nodes to the right of the existing ones), and every parent a change adds to, moves or removes from is refitted to its children. `smart_layout` runs Studio's Smart Layout over the whole model (the **All elements** arrangement) and saves the result; views with their own saved positions keep them. On a large model it can take minutes: a client that sends a progress token gets a progress notification per step, and a cancelled call (or a client that disconnects) stops at the next step without writing anything. The server exits when the client closes its end. Writes also update `defaultPositions`, which Studio restores when you switch back to **All elements**. `add_node` returns the persisted real ID, and a `tempId` can be used in later calls on the same MCP connection. Newly added nodes appear in Studio's **All elements** view until a view lists them. The server refreshes its model data per call.
75
+ A view that shows more than 1,000 elements, more than a canvas draws (what lies inside a container folded in the view does not count), is refused by `smart_layout`, `align_nodes` and `grid_nodes` with nothing written, as Studio neither draws nor lays it out: show it as a table or narrow its filter. A view per element takes its view type and filter from its group's viewpoint, so for one of those the refusal advises `upsert_viewpoint` with `kind: "table"` or a narrower filter; a write that makes views per element says which of them Smart Layout arranged and which it left as too large.
76
+
77
+ These use Studio's shared schemas and model rules. Besides counts, `get_model_summary` returns the metamodel context message the other tool descriptions refer to, in brief: each node type in one line with where it may go and its property keys (enum options when short, the type a reference points at), each relation type with its pairs, and the viewpoints by name. `get_model_summary` with `types: ["requirement", "constrains"]` returns only those types' whole definitions. `search_model` answers lists and traversals in brief, one sentence an element (a requirement's EARS sentence, an ADR's decision) and each relation once; `GET NODE <id>` gives one element whole, `FULL` at the end of a query every field of every row. In the Radical benchmark these two answers had filled a third of an agent's context. The server's MCP instructions tell clients to call it first. New nodes are placed inside their parent below its header (root nodes to the right of the existing ones), and every parent a change adds to, moves or removes from is refitted to its children. `smart_layout` runs Studio's Smart Layout over the whole model (the **All elements** arrangement) and saves the result; views with their own saved positions keep them. On a large model it can take minutes: a client that sends a progress token gets a progress notification per step, and a cancelled call (or a client that disconnects) stops at the next step without writing anything. The server exits when the client closes its end. Writes also update `defaultPositions`, which Studio restores when you switch back to **All elements**. `add_node` returns the persisted real ID, and a `tempId` can be used in later calls on the same MCP connection. Newly added nodes appear in Studio's **All elements** view until a view lists them. The server refreshes its model data per call.
68
78
 
69
79
  Writes preserve unrelated files and the existing `radical.md` text. A tool reports success only after the changed model files are written. After such a reload Studio highlights what changed for about five seconds (new and changed elements badged, removed ones as ghosts; layout alone shows nothing), so you can follow an agent at work.
70
80
 
@@ -1,39 +1,6 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __esm = (fn, res) => function __init() {
8
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
- };
10
- var __commonJS = (cb, mod) => function __require() {
11
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
-
30
- // <define:__RADICAL_BUILD__>
31
- var define_RADICAL_BUILD_default;
32
- var init_define_RADICAL_BUILD = __esm({
33
- "<define:__RADICAL_BUILD__>"() {
34
- define_RADICAL_BUILD_default = { version: "0.3.4", commit: "1a00a35", date: "2026-11-06", release: true };
35
- }
36
- });
1
+ import {
2
+ init_define_RADICAL_BUILD
3
+ } from "./chunk-ULUOEM3X.js";
37
4
 
38
5
  // ../../packages/layout/src/elkLayout.ts
39
6
  init_define_RADICAL_BUILD();
@@ -1181,7 +1148,7 @@ function builtInC4Metamodel() {
1181
1148
  person: ["group"],
1182
1149
  system: ["system", "group"],
1183
1150
  container: ["system", "group"],
1184
- component: ["container", "webapp", "group"],
1151
+ component: ["container", "webapp", "database", "group"],
1185
1152
  database: ["system", "group"],
1186
1153
  webapp: ["system", "group"],
1187
1154
  queue: ["system", "group"],
@@ -1233,6 +1200,8 @@ function builtInC4Metamodel() {
1233
1200
  { from: "person", to: "container" },
1234
1201
  { from: "person", to: "webapp" },
1235
1202
  { from: "person", to: "component" },
1203
+ // …and works in a database directly (an analyst's SQL client)
1204
+ { from: "person", to: "database" },
1236
1205
  // System-level dependencies; to a person a relation delivers (Structurizr's
1237
1206
  // delivers(): "Sends e-mails to")
1238
1207
  { from: "system", to: "person", ...DELIVERS },
@@ -1260,6 +1229,13 @@ function builtInC4Metamodel() {
1260
1229
  { from: "webapp", to: "webapp" },
1261
1230
  { from: "webapp", to: "queue" },
1262
1231
  { from: "webapp", to: "component" },
1232
+ // A database's code calls out
1233
+ { from: "database", to: "system" },
1234
+ { from: "database", to: "container" },
1235
+ { from: "database", to: "database" },
1236
+ { from: "database", to: "webapp" },
1237
+ { from: "database", to: "queue" },
1238
+ { from: "database", to: "component" },
1263
1239
  // Queues fan out to consumers
1264
1240
  { from: "queue", to: "container" },
1265
1241
  { from: "queue", to: "webapp" },
@@ -1363,7 +1339,7 @@ function builtInDddC4Metamodel() {
1363
1339
  allowedPairs: [
1364
1340
  { from: "system", to: "domain" },
1365
1341
  { from: "container", to: "domain" },
1366
- ...["system", "container", "component", "webapp"].map((from) => ({ from, to: "entity" }))
1342
+ ...["system", "container", "component", "webapp", "database"].map((from) => ({ from, to: "entity" }))
1367
1343
  ],
1368
1344
  properties: [],
1369
1345
  builtin: true
@@ -1825,6 +1801,18 @@ function builtInGovernanceMetamodel() {
1825
1801
  governance: true,
1826
1802
  builtin: true
1827
1803
  };
1804
+ const waives = {
1805
+ id: "waives",
1806
+ layout: { flow: "forward" },
1807
+ label: "Waives",
1808
+ description: "This model's decision says why a decision of a model it depends on does not apply to it.",
1809
+ inverseLabel: "Waived by",
1810
+ allowedPairs: [{ from: "adr", to: "adr" }],
1811
+ properties: [],
1812
+ color: "#f59e0b",
1813
+ governance: true,
1814
+ builtin: true
1815
+ };
1828
1816
  const implements_ = {
1829
1817
  id: "implements",
1830
1818
  layout: { flow: "side" },
@@ -1863,7 +1851,11 @@ function builtInGovernanceMetamodel() {
1863
1851
  { from: "requirement", to: "need" },
1864
1852
  { from: "need", to: "need" }
1865
1853
  ],
1866
- properties: [],
1854
+ properties: [
1855
+ // The words of the need the requirement rests on, verbatim, one fragment
1856
+ // per line (ADR Agents check requirements against the person's words).
1857
+ { key: "quote", label: "Quote", type: "textarea" }
1858
+ ],
1867
1859
  color: "#0d9488",
1868
1860
  governance: true,
1869
1861
  builtin: true
@@ -2046,7 +2038,7 @@ function builtInGovernanceMetamodel() {
2046
2038
  id: "illustrates",
2047
2039
  layout: { flow: "side" },
2048
2040
  label: "Illustrates",
2049
- description: "The screen shows the requirement being met, the step of the scenario, or what the user sees in the state.",
2041
+ description: "The screen shows the requirement being met, the step of the scenario or the process, or what the user sees in the state.",
2050
2042
  inverseLabel: "Illustrated by",
2051
2043
  allowedPairs: [
2052
2044
  { from: "mockup", to: "requirement" },
@@ -2303,16 +2295,16 @@ function builtInGovernanceMetamodel() {
2303
2295
  label: "Performed by",
2304
2296
  description: "The person or part of the architecture that does the step.",
2305
2297
  inverseLabel: "Performs",
2306
- allowedPairs: ["person", "system", "container", "component", "webapp"].map((to) => ({ from: "step", to })),
2298
+ allowedPairs: ["person", "system", "container", "component", "webapp", "database"].map((to) => ({ from: "step", to })),
2307
2299
  properties: [],
2308
2300
  color: "#0d9488",
2309
2301
  builtin: true
2310
2302
  };
2311
- implements_.allowedPairs.push(...["system", "container", "component", "webapp"].map((from) => ({ from, to: "state-machine" })));
2303
+ implements_.allowedPairs.push(...["system", "container", "component", "webapp", "database"].map((from) => ({ from, to: "state-machine" })));
2312
2304
  satisfies.allowedPairs.push({ from: "state-machine", to: "requirement" }, { from: "entity", to: "requirement" });
2313
2305
  verifies.allowedPairs.push({ from: "scenario", to: "state-machine" }, { from: "scenario", to: "process" });
2314
2306
  satisfies.allowedPairs.push({ from: "process", to: "requirement" });
2315
- illustrates.allowedPairs.push({ from: "mockup", to: "state" });
2307
+ illustrates.allowedPairs.push({ from: "mockup", to: "state" }, { from: "mockup", to: "step" });
2316
2308
  return {
2317
2309
  id: "c4-ddd-governance-builtin",
2318
2310
  name: RADICAL_METAMODEL_NAME,
@@ -2336,6 +2328,7 @@ function builtInGovernanceMetamodel() {
2336
2328
  ...base.relationTypes,
2337
2329
  constrains,
2338
2330
  supersedes,
2331
+ waives,
2339
2332
  implements: implements_,
2340
2333
  satisfies,
2341
2334
  derives,
@@ -2386,6 +2379,7 @@ var CONTAINER_TYPES = /* @__PURE__ */ new Set([
2386
2379
  "system",
2387
2380
  "container",
2388
2381
  "webapp",
2382
+ "database",
2389
2383
  "domain",
2390
2384
  "group",
2391
2385
  "blueprint",
@@ -2544,6 +2538,13 @@ function addToViewList(view, ids) {
2544
2538
  for (const id of ids) if (!view.nodeIds.includes(id)) view.nodeIds.push(id);
2545
2539
  if (view.nodeIds.length > 0) delete view.empty;
2546
2540
  }
2541
+ var PLACED_FROM = /* @__PURE__ */ new WeakMap();
2542
+ var PLACED_ROOT = /* @__PURE__ */ new WeakMap();
2543
+ function notedPlacesOnly(a, b) {
2544
+ if (a === b || PLACED_FROM.get(b) === a) return true;
2545
+ const root = PLACED_ROOT.get(b);
2546
+ return root !== void 0 && (root === a || root === PLACED_ROOT.get(a));
2547
+ }
2547
2548
 
2548
2549
  // ../../packages/layout/src/elkSpacingBase.ts
2549
2550
  init_define_RADICAL_BUILD();
@@ -2565,6 +2566,16 @@ var ELK_CHILD_SPACING = {
2565
2566
  // ../../packages/layout/src/geometry.ts
2566
2567
  init_define_RADICAL_BUILD();
2567
2568
  var placing = null;
2569
+ function childrenIndex(nodes) {
2570
+ const out = /* @__PURE__ */ new Map();
2571
+ for (const n of Object.values(nodes)) {
2572
+ const key = n.parentId ?? void 0;
2573
+ const list = out.get(key);
2574
+ if (list) list.push(n);
2575
+ else out.set(key, [n]);
2576
+ }
2577
+ return out;
2578
+ }
2568
2579
  function childrenOf(nodes, parentId) {
2569
2580
  if (placing?.nodes === nodes) return placing.children.get(parentId ?? void 0) ?? [];
2570
2581
  return Object.values(nodes).filter((n) => (n.parentId ?? void 0) === (parentId ?? void 0));
@@ -2593,7 +2604,7 @@ function isVisible(node, allNodes) {
2593
2604
  return isVisible(parent, allNodes);
2594
2605
  }
2595
2606
  function compoundPadding(type) {
2596
- const margin = type === "container" || type === "webapp" ? 20 : 30;
2607
+ const margin = type === "container" || type === "webapp" || type === "database" ? 20 : 30;
2597
2608
  return { top: 120, side: margin, bottom: margin };
2598
2609
  }
2599
2610
  function fittedParentSize(parent, children) {
@@ -2817,6 +2828,103 @@ function makeRoomAround(grownId, nodes, canvas) {
2817
2828
  }
2818
2829
  return result;
2819
2830
  }
2831
+ function strayNodeIds(nodes, positions, folded = (n) => n.collapsed, shown, frames) {
2832
+ const out = /* @__PURE__ */ new Set();
2833
+ const parents = /* @__PURE__ */ new Set();
2834
+ for (const n of Object.values(nodes)) if (n.parentId && (!shown || shown.has(n.id))) parents.add(n.parentId);
2835
+ for (const n of Object.values(nodes)) {
2836
+ const parent = n.parentId ? nodes[n.parentId] : void 0;
2837
+ if (!parent || folded(parent) || frames?.has(parent.id) || !(n.id in positions) || !(parent.id in positions)) continue;
2838
+ const fold = isContainerType(n.type) && (folded(n) || !parents.has(n.id));
2839
+ const cx = n.x + (fold ? COLLAPSED_WIDTH[n.type] : FIXED_SIZE_TYPES.has(n.type) ? NODE_SIZES[n.type].width : n.width ?? NODE_SIZES[n.type].width) / 2;
2840
+ const cy = n.y + (fold ? COLLAPSED_HEIGHT[n.type] : FIXED_SIZE_TYPES.has(n.type) ? NODE_SIZES[n.type].height : n.height ?? NODE_SIZES[n.type].height) / 2;
2841
+ if (cx < 0 || cy < 0 || cx > parent.width || cy > parent.height) out.add(n.id);
2842
+ }
2843
+ return out;
2844
+ }
2845
+ var WRAP_PAD = 30;
2846
+ var WRAP_HEADER = 40;
2847
+ function placeUnplaced(nodes, positions, shown, folded, options = {}) {
2848
+ const outer = placing;
2849
+ placing = { nodes, children: childrenIndex(nodes) };
2850
+ try {
2851
+ return placeUnplacedNow(nodes, positions, shown, folded, options);
2852
+ } finally {
2853
+ placing = outer;
2854
+ }
2855
+ }
2856
+ function placeUnplacedNow(nodes, positions, shown, folded, options = {}) {
2857
+ if (!positions || Object.keys(positions).length === 0) return [];
2858
+ const { frames } = options;
2859
+ const strays = strayNodeIds(nodes, positions, folded, shown, frames);
2860
+ const known = (id) => id in positions && !strays.has(id);
2861
+ const depth = (n) => {
2862
+ let d = 0;
2863
+ const seen = /* @__PURE__ */ new Set([n.id]);
2864
+ for (let cur = n.parentId ? nodes[n.parentId] : void 0; cur && !seen.has(cur.id); cur = cur.parentId ? nodes[cur.parentId] : void 0) {
2865
+ seen.add(cur.id);
2866
+ d++;
2867
+ }
2868
+ return d;
2869
+ };
2870
+ const fresh = Object.values(nodes).filter((n) => !known(n.id) && (!shown || shown.has(n.id))).sort((a, b) => depth(b) - depth(a) || (a.id < b.id ? -1 : 1));
2871
+ const unplaced = fresh.filter((n) => !n.parentId || !nodes[n.parentId] || known(n.parentId));
2872
+ const waiting = new Set(unplaced.map((n) => n.id));
2873
+ const drawn = modelCanvas(nodes, shown, frames);
2874
+ const canvas = { ...drawn, shown: (n) => !waiting.has(n.id) && drawn.shown(n) };
2875
+ for (const node of fresh) if (!waiting.has(node.id)) fitShown(nodes, node.id, canvas);
2876
+ const placed = [];
2877
+ for (const node of unplaced) {
2878
+ const held = options.wrap?.has(node.id) ? childrenOf(nodes, node.id).filter((c) => known(c.id) && drawn.shown(c)) : [];
2879
+ if (held.length) {
2880
+ waiting.delete(node.id);
2881
+ wrapRound(nodes, node, held, canvas, !!frames?.has(node.id));
2882
+ options.wrapped?.push(node.id);
2883
+ continue;
2884
+ }
2885
+ fitShown(nodes, node.id, canvas);
2886
+ const at = placeBesideSiblings(nodes, node.parentId, (s) => s.id !== node.id && !waiting.has(s.id) && (!shown || shown.has(s.id)));
2887
+ node.x = at.x;
2888
+ node.y = at.y;
2889
+ waiting.delete(node.id);
2890
+ placed.push(node.id);
2891
+ if (node.parentId && nodes[node.parentId]) growWithRoom(nodes, node.parentId, canvas);
2892
+ }
2893
+ return placed;
2894
+ }
2895
+ function wrapRound(nodes, node, held, canvas, frame) {
2896
+ const boxes = held.map((c) => canvas.boxOf(c));
2897
+ const left = Math.min(...boxes.map((b) => b.x));
2898
+ const top = Math.min(...boxes.map((b) => b.y));
2899
+ const right = Math.max(...boxes.map((b) => b.x + b.w));
2900
+ const bottom = Math.max(...boxes.map((b) => b.y + b.h));
2901
+ const pad = frame ? 0 : WRAP_PAD;
2902
+ const header = frame ? 0 : WRAP_HEADER;
2903
+ node.x = left - pad;
2904
+ node.y = top - pad - header;
2905
+ node.width = right - left + 2 * pad;
2906
+ node.height = bottom - top + 2 * pad + header;
2907
+ for (const c of Object.values(nodes)) {
2908
+ if (c.parentId !== node.id) continue;
2909
+ c.x -= node.x;
2910
+ c.y -= node.y;
2911
+ }
2912
+ if (frame) return;
2913
+ for (const [id, at] of Object.entries(makeRoomAround(node.id, nodes, canvas))) {
2914
+ nodes[id].x = at.x;
2915
+ nodes[id].y = at.y;
2916
+ }
2917
+ const parentId = node.parentId;
2918
+ if (!parentId || !nodes[parentId]) return;
2919
+ growFrameLeftUp(nodes, parentId, canvas.shown);
2920
+ growWithRoom(nodes, parentId, canvas, (id) => {
2921
+ const p = nodes[id];
2922
+ const was = { width: p.width, height: p.height };
2923
+ fitShown(nodes, id, canvas);
2924
+ p.width = Math.max(was.width, p.width);
2925
+ p.height = Math.max(was.height, p.height);
2926
+ });
2927
+ }
2820
2928
  function freeSpotNear(taken, size, center, gap = 60) {
2821
2929
  const fits = (x, y) => taken.every((b) => x + size.width + gap <= b.x || b.x + b.width + gap <= x || y + size.height + gap <= b.y || b.y + b.height + gap <= y);
2822
2930
  const start = { x: center.x - size.width / 2, y: center.y - size.height / 2 };
@@ -3144,10 +3252,6 @@ async function applyTreeLayout(c4Nodes, c4Relations) {
3144
3252
  }
3145
3253
 
3146
3254
  export {
3147
- __commonJS,
3148
- __toESM,
3149
- init_define_RADICAL_BUILD,
3150
- define_RADICAL_BUILD_default,
3151
3255
  isRelationAllowed,
3152
3256
  inferRelationType,
3153
3257
  isParentAllowed,
@@ -3211,6 +3315,7 @@ export {
3211
3315
  withCanvasPositions,
3212
3316
  removeFromViewList,
3213
3317
  addToViewList,
3318
+ notedPlacesOnly,
3214
3319
  effectiveWidth,
3215
3320
  effectiveHeight,
3216
3321
  drawnSize,
@@ -3224,6 +3329,7 @@ export {
3224
3329
  growFrameLeftUp,
3225
3330
  fitShown,
3226
3331
  makeRoomAround,
3332
+ placeUnplaced,
3227
3333
  createBatchPlacer,
3228
3334
  projectToVisibleGraph,
3229
3335
  ELK_ROOT_SPACING,
@@ -0,0 +1,43 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ };
10
+ var __commonJS = (cb, mod) => function __require() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+
30
+ // <define:__RADICAL_BUILD__>
31
+ var define_RADICAL_BUILD_default;
32
+ var init_define_RADICAL_BUILD = __esm({
33
+ "<define:__RADICAL_BUILD__>"() {
34
+ define_RADICAL_BUILD_default = { version: "0.5.0", commit: "166db2f", date: "2026-11-16", release: true };
35
+ }
36
+ });
37
+
38
+ export {
39
+ __commonJS,
40
+ __toESM,
41
+ init_define_RADICAL_BUILD,
42
+ define_RADICAL_BUILD_default
43
+ };