@artemis-studio/plugin-sdk 2026.9.51 → 2026.9.53

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artemis-studio/plugin-sdk",
3
- "version": "2026.9.51",
3
+ "version": "2026.9.53",
4
4
  "description": "Build the UI of an Artemis Studio plugin: typings for the Studio APIs a plugin may use, and a Vite preset.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,7 +20,7 @@ export { gateFor, type GateVerdict } from '../ui/capabilityGate.ts';
20
20
  export { useMe } from '../kernel/auth/api.ts';
21
21
  export { CodeEditor, type CodeDiagnostic, type CodeEditorProps } from '../ui/CodeEditor.tsx';
22
22
  export { ConfirmByTyping } from '../ui/ConfirmByTyping.tsx';
23
- export { DiagramView, type DiagramEdge, type DiagramNode, type DiagramViewProps } from '../ui/DiagramView.tsx';
23
+ export { DiagramView, type DiagramAction, type DiagramChoice, type DiagramEdge, type DiagramNode, type DiagramViewProps } from '../ui/DiagramView.tsx';
24
24
  export { NodeOutcomeSummary, OutcomeSummary, type OutcomeRow } from '../ui/NodeOutcomeSummary.tsx';
25
25
  export { Pager } from '../ui/Pager.tsx';
26
26
  export { VirtualTable, type GridColumn } from '../ui/VirtualTable.tsx';
@@ -1,5 +1,5 @@
1
- import { type DiagramEdge, type DiagramNode } from './diagram.ts';
2
- export type { DiagramEdge, DiagramNode };
1
+ import { type DiagramAction, type DiagramChoice, type DiagramEdge, type DiagramNode } from './diagram.ts';
2
+ export type { DiagramAction, DiagramChoice, DiagramEdge, DiagramNode };
3
3
  export interface DiagramViewProps {
4
4
  nodes: DiagramNode[];
5
5
  edges: DiagramEdge[];
@@ -7,19 +7,29 @@ export interface DiagramViewProps {
7
7
  onSelect?: (id: string) => void;
8
8
  /** Which way the arrows run. Default: down. */
9
9
  direction?: 'DOWN' | 'RIGHT';
10
- /** The frame's height in pixels. Default 480. */
11
- height?: number;
10
+ /** The frame's height: pixels, or any CSS length such as '100%' to fill a sized parent. Default 480. */
11
+ height?: number | string;
12
12
  /** Names the diagram for screen readers. */
13
13
  'aria-label': string;
14
+ /** What can be inserted on an arrow marked `insertable`. With `onInsert`, each such arrow offers them. */
15
+ insertChoices?: DiagramChoice[];
16
+ /** A choice was made on an arrow. The diagram changes nothing itself. */
17
+ onInsert?: (edgeId: string, value: string) => void;
18
+ /** The actions a box offers in its menu. With `onNodeAction`, every box that has some offers them. */
19
+ nodeActions?: (node: DiagramNode) => DiagramAction[];
20
+ /** An action was chosen on a box. The diagram changes nothing itself. */
21
+ onNodeAction?: (nodeId: string, actionId: string) => void;
14
22
  }
15
23
  /**
16
- * A read-only diagram of boxes and arrows, laid out automatically (ELK layered, in a worker) and
17
- * drawn in Studio's theme (ADR-0117). Nothing is dragged, connected or deleted: it shows a
18
- * structure and reports which box was chosen.
24
+ * A diagram of boxes and arrows, laid out automatically (ELK layered, in a worker) and drawn in
25
+ * Studio's theme (ADR-0117). Nothing is dragged, connected or deleted: it shows a structure and
26
+ * reports which box was chosen. A caller may offer things to insert on arrows and actions on boxes
27
+ * (ADR-0120); the diagram reports the choice and the caller changes the nodes.
19
28
  *
20
29
  * <p>The diagram is one tab stop. Arrow keys move between boxes in reading order, Enter or Space
21
30
  * selects one, and the selection is announced. A box with a problem says so in words, on the box
22
31
  * and in its accessible name, so colour is never the only signal. Positions change only when the
23
- * boxes or arrows do, never when a label does.
32
+ * boxes or arrows do, never when a label does. A box's actions open from its "⋯", a right-click,
33
+ * or Shift+F10; Insert on a box offers what can go on the arrows into it.
24
34
  */
25
- export declare function DiagramView({ nodes, edges, selectedId, onSelect, direction, height, 'aria-label': ariaLabel, }: DiagramViewProps): import("react").JSX.Element;
35
+ export declare function DiagramView({ nodes, edges, selectedId, onSelect, direction, height, 'aria-label': ariaLabel, insertChoices, onInsert, nodeActions, onNodeAction, }: DiagramViewProps): import("react").JSX.Element;
@@ -21,6 +21,24 @@ export interface DiagramEdge {
21
21
  label?: string;
22
22
  /** Drawn dashed: a secondary path. Its meaning belongs in its label. */
23
23
  dashed?: boolean;
24
+ /** Something can be inserted on this arrow: it offers the diagram's `insertChoices`. */
25
+ insertable?: boolean;
26
+ }
27
+ /** One thing a `DiagramView` offers to insert on an arrow ("Call a service"). */
28
+ export interface DiagramChoice {
29
+ value: string;
30
+ label: string;
31
+ /** A heading the choice is listed under. */
32
+ group?: string;
33
+ }
34
+ /** One action in a box's menu. The diagram only reports it: the caller changes the nodes. */
35
+ export interface DiagramAction {
36
+ id: string;
37
+ label: string;
38
+ /** Why it cannot be taken here. It stays listed, with the reason, rather than disappearing. */
39
+ disabledReason?: string;
40
+ /** Destroys something: shown in the danger colour. The label still says so in words. */
41
+ danger?: boolean;
24
42
  }
25
43
  /** What positions depend on: which nodes exist and how they connect. A new label moves nothing. */
26
44
  export declare function layoutSignature(nodes: DiagramNode[], edges: DiagramEdge[], direction: string): string;