codeassembly-agent-logic 0.9.0 → 0.10.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 (52) hide show
  1. package/.meta/changelog.json +57 -0
  2. package/CHANGELOG.md +14 -0
  3. package/README.md +34 -21
  4. package/dist/esm/index.d.ts +5 -1
  5. package/dist/esm/index.js +1 -0
  6. package/dist/esm/react/canvas/CanvasKey.d.ts +38 -0
  7. package/dist/esm/react/canvas/CanvasKey.js +33 -0
  8. package/dist/esm/react/hooks/document-types.d.ts +72 -0
  9. package/dist/esm/react/hooks/document-types.js +3 -0
  10. package/dist/esm/react/hooks/file-location.d.ts +10 -0
  11. package/dist/esm/react/hooks/file-location.js +19 -0
  12. package/dist/esm/react/hooks/label-source.js +2 -1
  13. package/dist/esm/react/hooks/load-messages.d.ts +2 -0
  14. package/dist/esm/react/hooks/load-messages.js +3 -0
  15. package/dist/esm/react/hooks/read-document.d.ts +48 -0
  16. package/dist/esm/react/hooks/read-document.js +88 -0
  17. package/dist/esm/react/hooks/stored-base.d.ts +7 -0
  18. package/dist/esm/react/hooks/stored-base.js +8 -0
  19. package/dist/esm/react/hooks/stored-upload.d.ts +9 -0
  20. package/dist/esm/react/hooks/stored-upload.js +16 -0
  21. package/dist/esm/react/hooks/useDocumentState.d.ts +57 -0
  22. package/dist/esm/react/hooks/useDocumentState.js +151 -0
  23. package/dist/esm/react/index.d.ts +18 -1
  24. package/dist/esm/react/index.js +13 -0
  25. package/dist/esm/react/inspector/Inspector.d.ts +13 -0
  26. package/dist/esm/react/inspector/Inspector.js +58 -0
  27. package/dist/esm/react/messages/FindingList.d.ts +18 -0
  28. package/dist/esm/react/messages/FindingList.js +15 -0
  29. package/dist/esm/react/messages/GapList.d.ts +14 -0
  30. package/dist/esm/react/messages/GapList.js +18 -0
  31. package/dist/esm/react/messages/Messages.d.ts +29 -0
  32. package/dist/esm/react/messages/Messages.js +19 -0
  33. package/dist/esm/react/messages/SectionMessage.d.ts +10 -0
  34. package/dist/esm/react/messages/SectionMessage.js +8 -0
  35. package/dist/esm/react/messages/UnconvertedPassages.d.ts +15 -0
  36. package/dist/esm/react/messages/UnconvertedPassages.js +15 -0
  37. package/dist/esm/react/messages/abbreviate.d.ts +2 -0
  38. package/dist/esm/react/messages/abbreviate.js +5 -0
  39. package/dist/esm/react/messages/icons.d.ts +9 -0
  40. package/dist/esm/react/messages/icons.js +10 -0
  41. package/dist/esm/react/slots.d.ts +28 -0
  42. package/dist/esm/react/slots.js +1 -0
  43. package/dist/esm/react/source/SourceLine.d.ts +13 -0
  44. package/dist/esm/react/source/SourceLine.js +49 -0
  45. package/dist/esm/react/source/Workspace.d.ts +32 -0
  46. package/dist/esm/react/source/Workspace.js +22 -0
  47. package/dist/esm/react/source/build-connector.d.ts +39 -0
  48. package/dist/esm/react/source/build-connector.js +23 -0
  49. package/dist/esm/react/styles.css +445 -6
  50. package/dist/esm/schema/agent-logic-file-name.d.ts +4 -0
  51. package/dist/esm/schema/agent-logic-file-name.js +4 -0
  52. package/package.json +3 -2
@@ -0,0 +1,13 @@
1
+ import { type ReactElement, type RefObject } from 'react';
2
+ export interface SourceLineProps {
3
+ /** The workspace that contains the canvas and the prompt pane, over which the line is drawn. */
4
+ containerRef: RefObject<HTMLElement | null>;
5
+ selectedPath: string | undefined;
6
+ /** Receives the function that redraws the line, for the canvas to call whenever it pans or zooms. */
7
+ redrawRef: RefObject<(() => void) | undefined>;
8
+ }
9
+ /**
10
+ * The line that joins the selected element on the canvas to its passage in the prompt, while both are in view. Its
11
+ * container is positioned, and it holds a `StatechartCanvas` and a `PromptPane`, whose data attributes locate the ends.
12
+ */
13
+ export declare function SourceLine({ containerRef, selectedPath, redrawRef }: SourceLineProps): ReactElement | undefined;
@@ -0,0 +1,49 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { buildConnector } from "./build-connector.js";
4
+ export function SourceLine({ containerRef, selectedPath, redrawRef }) {
5
+ const [line, setLine] = useState();
6
+ useEffect(() => {
7
+ const container = containerRef.current ?? undefined;
8
+ if (container === undefined)
9
+ return;
10
+ const workspace = container;
11
+ let frame = 0;
12
+ function scheduleDraw() {
13
+ cancelAnimationFrame(frame);
14
+ frame = requestAnimationFrame(() => {
15
+ setLine(selectedPath === undefined ? undefined : measureLine(workspace, selectedPath));
16
+ });
17
+ }
18
+ scheduleDraw();
19
+ redrawRef.current = scheduleDraw;
20
+ container.addEventListener('scroll', scheduleDraw, { capture: true });
21
+ const resizeObserver = new ResizeObserver(scheduleDraw);
22
+ resizeObserver.observe(container);
23
+ return () => {
24
+ redrawRef.current = undefined;
25
+ cancelAnimationFrame(frame);
26
+ container.removeEventListener('scroll', scheduleDraw, { capture: true });
27
+ resizeObserver.disconnect();
28
+ };
29
+ }, [containerRef, redrawRef, selectedPath]);
30
+ if (line === undefined)
31
+ return undefined;
32
+ return (_jsxs("svg", { "aria-hidden": "true", className: "statechart-source-line", children: [_jsx("path", { d: line.path, fill: "none", strokeWidth: 2.5 }), _jsx("circle", { cx: line.start.x, cy: line.start.y, r: 4, stroke: "none" }), _jsx("circle", { cx: line.end.x, cy: line.end.y, r: 4, stroke: "none" })] }));
33
+ }
34
+ function measureLine(container, path) {
35
+ const canvas = container.querySelector('.statechart-canvas') ?? undefined;
36
+ const element = canvas?.querySelector(`[data-path="${CSS.escape(path)}"]`) ?? undefined;
37
+ const prompt = container.querySelector('[data-prompt-text]') ?? undefined;
38
+ const passage = prompt?.querySelector(`[data-passage-for="${CSS.escape(path)}"]`)?.getClientRects()[0];
39
+ if (canvas === undefined || element === undefined || prompt === undefined || passage === undefined)
40
+ return undefined;
41
+ const origin = container.getBoundingClientRect();
42
+ return buildConnector({
43
+ start: element.getBoundingClientRect(),
44
+ startBounds: canvas.getBoundingClientRect(),
45
+ end: passage,
46
+ endBounds: prompt.getBoundingClientRect(),
47
+ origin: { x: origin.left, y: origin.top },
48
+ });
49
+ }
@@ -0,0 +1,32 @@
1
+ import { type ComponentType, type ReactElement, type ReactNode } from 'react';
2
+ import type { ConfigDescription } from '../../layout/describe-config.js';
3
+ import type { AgentLogicConfig, Span } from '../../schema/agent-logic-schema.js';
4
+ import type { ChartMark } from '../canvas/list-chart-marks.js';
5
+ import { type StatechartCanvasProps } from '../canvas/StatechartCanvas.js';
6
+ import type { ChartLayout } from '../hooks/useChartLayout.js';
7
+ import type { LinkButtonProps } from '../slots.js';
8
+ export interface WorkspaceProps {
9
+ config: AgentLogicConfig;
10
+ description: ConfigDescription;
11
+ /** The chart's layout: its elements, why it failed, or `undefined` while it runs. */
12
+ layout: ChartLayout | undefined;
13
+ selectedPath: string | undefined;
14
+ /**
15
+ * The passages that the prompt marks apart from the selection, such as an unconverted passage or a finding's
16
+ * quotes.
17
+ */
18
+ shownPassages: Span[];
19
+ onSelect: (path: string | undefined) => void;
20
+ renderKey: (marks: ReadonlySet<ChartMark>) => ReactNode;
21
+ /** The messages panel, docked at the canvas's bottom edge. */
22
+ messages?: ReactNode;
23
+ /** The app's in-page link, which the inspector renders for each state and transition that it names. */
24
+ LinkButton: ComponentType<LinkButtonProps>;
25
+ /** The canvas to render, `StatechartCanvas` unless a test replaces it. */
26
+ Canvas?: ComponentType<StatechartCanvasProps> | undefined;
27
+ }
28
+ /**
29
+ * The canvas above the messages panel, beside the source pane, which holds the inspector above the prompt, joined by
30
+ * the source line. It fills the height that its flex parent leaves, and the app sets its outer spacing.
31
+ */
32
+ export declare function Workspace({ config, description, layout, selectedPath, shownPassages, onSelect, renderKey, messages, LinkButton, Canvas, }: WorkspaceProps): ReactElement;
@@ -0,0 +1,22 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useMemo, useRef } from 'react';
3
+ import { buildPromptSegments } from "../../source/prompt-segments.js";
4
+ import { StatechartCanvas } from "../canvas/StatechartCanvas.js";
5
+ import { Inspector } from "../inspector/Inspector.js";
6
+ import { PromptPane } from "./PromptPane.js";
7
+ import { SourceLine } from "./SourceLine.js";
8
+ export function Workspace({ config, description, layout, selectedPath, shownPassages, onSelect, renderKey, messages, LinkButton, Canvas = StatechartCanvas, }) {
9
+ const workspaceRef = useRef(null);
10
+ const redrawLineRef = useRef(undefined);
11
+ const segments = useMemo(() => buildPromptSegments(config.meta.prompt, description, config.meta.unconverted, shownPassages), [config, description, shownPassages]);
12
+ const selectedElement = findElement(description, selectedPath);
13
+ const handleViewportChange = useCallback(() => {
14
+ redrawLineRef.current?.();
15
+ }, []);
16
+ return (_jsxs("div", { ref: workspaceRef, className: "statechart-workspace", children: [_jsxs("div", { className: "statechart-workspace__chart", children: [_jsxs("div", { className: "statechart-workspace__canvas", children: [layout !== undefined && 'error' in layout ? (_jsxs("p", { className: "statechart-workspace__error", children: ["The layout failed (", layout.error, ")."] })) : undefined, layout !== undefined && 'elements' in layout ? (_jsx(Canvas, { elements: layout.elements, selectedPath: selectedPath, onSelect: onSelect, onViewportChange: handleViewportChange, renderKey: renderKey }, layout.key)) : undefined] }), messages] }), _jsxs("div", { className: "statechart-workspace__source", children: [_jsx(Inspector, { element: selectedElement, description: description, onSelect: onSelect, LinkButton: LinkButton }), _jsx("div", { className: "statechart-workspace__prompt", children: _jsx(PromptPane, { segments: segments, selected: selectedElement, shownPassages: shownPassages, onSelect: onSelect }) })] }), _jsx(SourceLine, { containerRef: workspaceRef, selectedPath: selectedPath, redrawRef: redrawLineRef })] }));
17
+ }
18
+ function findElement(description, path) {
19
+ if (path === undefined)
20
+ return undefined;
21
+ return [...description.states, ...description.transitions, ...description.ambient].find((element) => element.path === path);
22
+ }
@@ -0,0 +1,39 @@
1
+ /** The edges of a box on screen, as `getBoundingClientRect` reports them. */
2
+ export interface ScreenRect {
3
+ left: number;
4
+ top: number;
5
+ right: number;
6
+ bottom: number;
7
+ }
8
+ export interface ConnectorInput {
9
+ /** The box at the line's start, in a region at the left. */
10
+ start: ScreenRect;
11
+ /** The visible part of the region that holds `start`. */
12
+ startBounds: ScreenRect;
13
+ /** The first line box at the line's end; the line ends in the gutter of `endBounds` level with it. */
14
+ end: ScreenRect;
15
+ /** The visible part of the scrolling region that holds `end`, at the right of the start's region. */
16
+ endBounds: ScreenRect;
17
+ /** The top-left corner of the overlay in which the line is drawn. */
18
+ origin: {
19
+ x: number;
20
+ y: number;
21
+ };
22
+ }
23
+ export interface Connector {
24
+ /** An SVG path in the overlay's coordinates. */
25
+ path: string;
26
+ start: {
27
+ x: number;
28
+ y: number;
29
+ };
30
+ end: {
31
+ x: number;
32
+ y: number;
33
+ };
34
+ }
35
+ /**
36
+ * Returns the curve that joins a box to a line of text in a region at its right, or `undefined` when either is out of
37
+ * view.
38
+ */
39
+ export declare function buildConnector({ start, startBounds, end, endBounds, origin }: ConnectorInput): Connector | undefined;
@@ -0,0 +1,23 @@
1
+ export function buildConnector({ start, startBounds, end, endBounds, origin }) {
2
+ const startX = Math.min(start.right, startBounds.right);
3
+ const startY = start.top + Math.min((start.bottom - start.top) / 2, MAX_ANCHOR_DROP);
4
+ const endX = endBounds.left + GUTTER_INSET;
5
+ const endY = (end.top + end.bottom) / 2;
6
+ const isStartInView = startX >= startBounds.left && start.left <= startBounds.right && isWithin(startY, startBounds);
7
+ const isEndInView = isWithin(endY, endBounds);
8
+ if (!isStartInView || !isEndInView)
9
+ return undefined;
10
+ const from = { x: startX - origin.x, y: startY - origin.y };
11
+ const to = { x: endX - origin.x, y: endY - origin.y };
12
+ const middleX = (from.x + to.x) / 2;
13
+ return {
14
+ path: `M${from.x},${from.y} C${middleX},${from.y} ${middleX},${to.y} ${to.x},${to.y}`,
15
+ start: from,
16
+ end: to,
17
+ };
18
+ }
19
+ const MAX_ANCHOR_DROP = 18;
20
+ const GUTTER_INSET = 8;
21
+ function isWithin(y, rect) {
22
+ return y >= rect.top && y <= rect.bottom;
23
+ }
@@ -1,7 +1,8 @@
1
1
  /*
2
- * Styles for the statechart canvas, the prompt pane, and the marks of their keys. The colours come in two tiers of
3
- * custom properties: the seeds, declared on :root, and the component properties, each of which derives its default from
4
- * the seeds. A consumer sets either tier on :root or on an ancestor of the components that it renders.
2
+ * Styles for the statechart canvas, its key, the prompt pane, the marks of their keys, the inspector, the source line,
3
+ * the workspace, and the messages panel. The colours come in two tiers of custom properties: the seeds, declared on
4
+ * :root, and the component properties, each of which derives its default from the seeds. A consumer sets either tier on
5
+ * :root or on an ancestor of the components that it renders.
5
6
  */
6
7
 
7
8
  @import '@xyflow/react/style.css';
@@ -19,16 +20,22 @@
19
20
 
20
21
  /*
21
22
  * Each component property resolves here, on the elements that read it, rather than on :root, so that seeds set on any
22
- * ancestor of the canvas, the pane, or a key entry reach the derivation. Every rule below reads the private property.
23
+ * ancestor of the canvas, the pane, a key, the inspector, the source line, the workspace, or the messages panel reach
24
+ * the derivation. Every rule below reads the private property.
23
25
  */
24
26
  :where(
25
27
  .statechart-canvas,
26
28
  .arrowhead-defs,
29
+ .canvas-key,
27
30
  .canvas-key__swatch,
28
31
  .canvas-key__word,
29
32
  .mark-glyph,
30
33
  .prompt-pane,
31
- .prompt-key
34
+ .prompt-key,
35
+ .statechart-inspector,
36
+ .statechart-messages,
37
+ .statechart-source-line,
38
+ .statechart-workspace
32
39
  ) {
33
40
  --_agent-logic-ambient-background: var(
34
41
  --agent-logic-ambient-background,
@@ -46,11 +53,19 @@
46
53
  --agent-logic-compound-background,
47
54
  color-mix(in srgb, var(--agent-logic-text) 5%, var(--agent-logic-surface))
48
55
  );
56
+ --_agent-logic-danger-text: var(
57
+ --agent-logic-danger-text,
58
+ color-mix(in srgb, var(--agent-logic-warning) 70%, var(--agent-logic-text))
59
+ );
49
60
  --_agent-logic-focus-ring: var(--agent-logic-focus-ring, var(--agent-logic-accent));
50
61
  --_agent-logic-hover-background: var(
51
62
  --agent-logic-hover-background,
52
63
  color-mix(in srgb, var(--agent-logic-text) 12.5%, transparent)
53
64
  );
65
+ --_agent-logic-information-background: var(
66
+ --agent-logic-information-background,
67
+ color-mix(in srgb, var(--agent-logic-accent) 9%, var(--agent-logic-surface))
68
+ );
54
69
  --_agent-logic-node-background: var(--agent-logic-node-background, var(--agent-logic-surface));
55
70
  --_agent-logic-passage-background: var(
56
71
  --agent-logic-passage-background,
@@ -61,6 +76,7 @@
61
76
  --agent-logic-selected-background,
62
77
  color-mix(in srgb, var(--agent-logic-accent) 13%, var(--agent-logic-surface))
63
78
  );
79
+ --_agent-logic-source-line: var(--agent-logic-source-line, var(--_agent-logic-selected));
64
80
  --_agent-logic-text-subtle: var(
65
81
  --agent-logic-text-subtle,
66
82
  color-mix(in srgb, var(--agent-logic-text) 78%, var(--agent-logic-surface))
@@ -75,6 +91,10 @@
75
91
  --agent-logic-unconverted,
76
92
  color-mix(in srgb, var(--agent-logic-warning) 70%, var(--agent-logic-text))
77
93
  );
94
+ --_agent-logic-warning-background: var(
95
+ --agent-logic-warning-background,
96
+ color-mix(in srgb, var(--agent-logic-warning) 11%, var(--agent-logic-surface))
97
+ );
78
98
  }
79
99
 
80
100
  .statechart-canvas {
@@ -528,7 +548,142 @@
528
548
  line-height: 18px;
529
549
  }
530
550
 
531
- /* -- Key -- */
551
+ /* -- Key: a strip below the canvas, with the marks that the chart draws and the canvas's toggles -- */
552
+
553
+ .canvas-key {
554
+ display: flex;
555
+ flex: none;
556
+ align-items: center;
557
+ border-block-start: 1px solid var(--_agent-logic-border);
558
+ background: var(--agent-logic-surface);
559
+ color: var(--agent-logic-text);
560
+ }
561
+
562
+ .canvas-key__entries {
563
+ display: flex;
564
+ flex-wrap: wrap;
565
+ gap: 4px 12px;
566
+ margin: 0;
567
+ padding: 6px 10px;
568
+ font-size: 12px;
569
+ line-height: 16px;
570
+ list-style: none;
571
+ }
572
+
573
+ .canvas-key__entry {
574
+ position: relative;
575
+ margin: 0;
576
+ }
577
+
578
+ /* An entry takes focus only so that a keyboard user reaches its gloss; it does not act on a click. */
579
+ .canvas-key__entry-label {
580
+ display: inline-flex;
581
+ align-items: center;
582
+ gap: 5px;
583
+ padding: 2px 4px;
584
+ border-radius: 3px;
585
+ white-space: nowrap;
586
+ cursor: help;
587
+ }
588
+
589
+ .canvas-key__entry-label:hover {
590
+ background: var(--_agent-logic-hover-background);
591
+ }
592
+
593
+ .canvas-key__entry-label:focus-visible {
594
+ outline: 2px solid var(--_agent-logic-focus-ring);
595
+ outline-offset: 1px;
596
+ }
597
+
598
+ .canvas-key__tooltip {
599
+ position: absolute;
600
+ inset-block-end: 100%;
601
+ inset-inline-start: 0;
602
+ z-index: 10;
603
+ display: none;
604
+ inline-size: max-content;
605
+ max-inline-size: 256px;
606
+ margin-block-end: 4px;
607
+ padding: 4px 8px;
608
+ border-radius: 2px;
609
+ background: var(--_agent-logic-tooltip-background);
610
+ color: var(--_agent-logic-tooltip-text);
611
+ font-size: 12px;
612
+ line-height: 16px;
613
+ pointer-events: none;
614
+ }
615
+
616
+ .canvas-key__entry:hover .canvas-key__tooltip,
617
+ .canvas-key__entry:focus-within .canvas-key__tooltip {
618
+ display: block;
619
+ }
620
+
621
+ .canvas-key__controls {
622
+ display: flex;
623
+ flex: none;
624
+ align-items: center;
625
+ gap: 8px;
626
+ margin-inline: auto 4px;
627
+ font-size: 14px;
628
+ line-height: 20px;
629
+ }
630
+
631
+ .canvas-key__ambient {
632
+ display: flex;
633
+ align-items: center;
634
+ gap: 6px;
635
+ padding: 2px 6px;
636
+ border-radius: 2px;
637
+ white-space: nowrap;
638
+ }
639
+
640
+ .canvas-key__ambient:hover {
641
+ background: var(--_agent-logic-hover-background);
642
+ }
643
+
644
+ .canvas-key__ambient > input,
645
+ .canvas-key__ambient > label {
646
+ cursor: pointer;
647
+ }
648
+
649
+ .canvas-key__ambient > input {
650
+ inline-size: 16px;
651
+ block-size: 16px;
652
+ margin: 0;
653
+ accent-color: var(--agent-logic-accent);
654
+ }
655
+
656
+ .canvas-key__messages {
657
+ display: flex;
658
+ align-items: center;
659
+ gap: 8px;
660
+ white-space: nowrap;
661
+ }
662
+
663
+ .canvas-key__counts {
664
+ color: var(--_agent-logic-text-subtle);
665
+ font-size: 12px;
666
+ }
667
+
668
+ /* The chevron of a disclosure, inside the app's button: right while closed, down while open. */
669
+ .statechart-chevron {
670
+ flex: none;
671
+ inline-size: 16px;
672
+ block-size: 16px;
673
+ transition: transform 150ms ease-out;
674
+ }
675
+
676
+ .statechart-chevron--open {
677
+ transform: rotate(90deg);
678
+ }
679
+
680
+ @media (prefers-reduced-motion: reduce) {
681
+ .statechart-chevron {
682
+ transition: none;
683
+ }
684
+ }
685
+
686
+ /* -- Marks of the key -- */
532
687
 
533
688
  .canvas-key__swatch {
534
689
  display: inline-block;
@@ -702,3 +857,287 @@
702
857
  .prompt-key__sample {
703
858
  font-family: var(--agent-logic-font-prose);
704
859
  }
860
+
861
+ /* -- Inspector: the selected element's facts, above the prompt -- */
862
+
863
+ .statechart-inspector {
864
+ flex: none;
865
+ max-height: 50%;
866
+ overflow-y: auto;
867
+ padding: 16px 20px;
868
+ border-bottom: 1px solid var(--_agent-logic-border);
869
+ background: var(--agent-logic-surface);
870
+ color: var(--agent-logic-text);
871
+ }
872
+
873
+ .statechart-inspector__empty {
874
+ margin: 0;
875
+ color: var(--_agent-logic-text-subtle);
876
+ }
877
+
878
+ .statechart-inspector__details {
879
+ display: flex;
880
+ flex-direction: column;
881
+ gap: 12px;
882
+ }
883
+
884
+ .statechart-inspector__heading {
885
+ margin: 0;
886
+ font-size: 16px;
887
+ font-weight: 600;
888
+ line-height: 20px;
889
+ overflow-wrap: anywhere;
890
+ }
891
+
892
+ .statechart-inspector__fact {
893
+ display: flex;
894
+ flex-direction: column;
895
+ gap: 4px;
896
+ }
897
+
898
+ /* Labels and the connecting words between links: secondary text. */
899
+ .statechart-inspector__aside {
900
+ color: var(--_agent-logic-text-subtle);
901
+ font-size: 12px;
902
+ line-height: 16px;
903
+ }
904
+
905
+ .statechart-inspector__none {
906
+ color: var(--_agent-logic-text-subtle);
907
+ }
908
+
909
+ .statechart-inspector__actions {
910
+ margin: 0;
911
+ padding-inline-start: 16px;
912
+ list-style: disc;
913
+ }
914
+
915
+ .statechart-inspector__actions > li + li,
916
+ .statechart-inspector__transitions > li + li {
917
+ margin-top: 4px;
918
+ }
919
+
920
+ .statechart-inspector__kinds {
921
+ display: flex;
922
+ flex-wrap: wrap;
923
+ gap: 4px;
924
+ margin: 0;
925
+ padding: 0;
926
+ list-style: none;
927
+ }
928
+
929
+ .statechart-inspector__kind {
930
+ padding: 0 8px;
931
+ border: 1px solid var(--_agent-logic-border-strong);
932
+ border-radius: 9999px;
933
+ font-size: 12px;
934
+ line-height: 20px;
935
+ }
936
+
937
+ .statechart-inspector__quote {
938
+ margin: 0;
939
+ font-family: var(--agent-logic-font-prose);
940
+ font-size: 16px;
941
+ line-height: 24px;
942
+ white-space: pre-wrap;
943
+ }
944
+
945
+ .statechart-inspector__row {
946
+ display: flex;
947
+ flex-wrap: wrap;
948
+ align-items: baseline;
949
+ gap: 6px;
950
+ }
951
+
952
+ .statechart-inspector__transitions {
953
+ margin: 0;
954
+ padding: 0;
955
+ list-style: none;
956
+ }
957
+
958
+ .statechart-inspector__code {
959
+ font-family: var(--agent-logic-font-code);
960
+ }
961
+
962
+ .statechart-inspector__unnamed {
963
+ font-size: 12px;
964
+ }
965
+
966
+ /* -- Messages panel: the gaps, the converter's findings, and the unconverted passages, below the canvas -- */
967
+
968
+ .statechart-messages {
969
+ display: flex;
970
+ flex: none;
971
+ flex-direction: column;
972
+ gap: 6px;
973
+ block-size: 40%;
974
+ box-sizing: border-box;
975
+ overflow-y: auto;
976
+ padding: 8px;
977
+ border-block-start: 1px solid var(--_agent-logic-border);
978
+ background: var(--agent-logic-surface);
979
+ color: var(--agent-logic-text);
980
+ font-size: 14px;
981
+ line-height: 20px;
982
+ }
983
+
984
+ /* A display set here would otherwise show a panel or a list that its `hidden` attribute hides. */
985
+ .statechart-messages[hidden],
986
+ .statechart-messages__details[hidden] {
987
+ display: none;
988
+ }
989
+
990
+ .statechart-messages__section {
991
+ display: flex;
992
+ gap: 10px;
993
+ padding: 14px 16px;
994
+ border-radius: 6px;
995
+ }
996
+
997
+ .statechart-messages__section--information {
998
+ background: var(--_agent-logic-information-background);
999
+ }
1000
+
1001
+ .statechart-messages__section--information > .statechart-messages__icon {
1002
+ color: var(--agent-logic-accent);
1003
+ }
1004
+
1005
+ .statechart-messages__section--warning {
1006
+ background: var(--_agent-logic-warning-background);
1007
+ }
1008
+
1009
+ .statechart-messages__section--warning > .statechart-messages__icon {
1010
+ color: var(--agent-logic-warning);
1011
+ }
1012
+
1013
+ .statechart-messages__icon {
1014
+ flex: none;
1015
+ inline-size: 20px;
1016
+ block-size: 20px;
1017
+ margin-block-start: 2px;
1018
+ }
1019
+
1020
+ .statechart-messages__icon-stroke {
1021
+ stroke: var(--agent-logic-surface);
1022
+ }
1023
+
1024
+ .statechart-messages__icon-fill {
1025
+ fill: var(--agent-logic-surface);
1026
+ }
1027
+
1028
+ .statechart-messages__section-body {
1029
+ display: flex;
1030
+ flex: 1;
1031
+ flex-direction: column;
1032
+ gap: 6px;
1033
+ min-inline-size: 0;
1034
+ }
1035
+
1036
+ .statechart-messages__section-title {
1037
+ margin: 0;
1038
+ font-size: 16px;
1039
+ font-weight: 600;
1040
+ line-height: 24px;
1041
+ }
1042
+
1043
+ .statechart-messages__section-body p {
1044
+ margin: 0;
1045
+ }
1046
+
1047
+ .statechart-messages__list {
1048
+ display: flex;
1049
+ flex-direction: column;
1050
+ gap: 4px;
1051
+ margin: 0;
1052
+ padding-inline-start: 20px;
1053
+ list-style: disc;
1054
+ }
1055
+
1056
+ .statechart-messages__details,
1057
+ .statechart-messages__passages {
1058
+ display: flex;
1059
+ flex-direction: column;
1060
+ gap: 6px;
1061
+ }
1062
+
1063
+ .statechart-messages__passages {
1064
+ margin: 0;
1065
+ padding: 0;
1066
+ list-style: none;
1067
+ }
1068
+
1069
+ /* A finding's kind classifies it, so it reads as a tag. */
1070
+ .statechart-messages__kind {
1071
+ display: inline-block;
1072
+ margin-inline-end: 6px;
1073
+ padding: 0 5px;
1074
+ border: 1px solid var(--_agent-logic-border);
1075
+ border-radius: 3px;
1076
+ color: var(--_agent-logic-text-subtle);
1077
+ font-size: 12px;
1078
+ font-weight: 600;
1079
+ line-height: 16px;
1080
+ white-space: nowrap;
1081
+ }
1082
+
1083
+ .statechart-messages__quote {
1084
+ font-family: var(--agent-logic-font-prose);
1085
+ }
1086
+
1087
+ /* -- Source line: drawn over the workspace from the selected element to its passage -- */
1088
+
1089
+ .statechart-source-line {
1090
+ position: absolute;
1091
+ inset: 0;
1092
+ z-index: 4;
1093
+ width: 100%;
1094
+ height: 100%;
1095
+ overflow: visible;
1096
+ pointer-events: none;
1097
+ fill: var(--_agent-logic-source-line);
1098
+ stroke: var(--_agent-logic-source-line);
1099
+ }
1100
+
1101
+ /* -- Workspace: the canvas beside the source pane, which holds the inspector above the prompt -- */
1102
+
1103
+ .statechart-workspace {
1104
+ position: relative;
1105
+ display: grid;
1106
+ flex: 1;
1107
+ grid-template-columns: minmax(0, 1fr) clamp(392px, 35vw, 500px);
1108
+ min-height: 0;
1109
+ overflow: hidden;
1110
+ border: 1px solid var(--_agent-logic-border);
1111
+ border-radius: 4px;
1112
+ }
1113
+
1114
+ .statechart-workspace__chart {
1115
+ display: flex;
1116
+ flex-direction: column;
1117
+ min-height: 0;
1118
+ }
1119
+
1120
+ .statechart-workspace__canvas {
1121
+ position: relative;
1122
+ flex: 1;
1123
+ min-height: 0;
1124
+ }
1125
+
1126
+ .statechart-workspace__error {
1127
+ margin: 0;
1128
+ padding: 16px;
1129
+ color: var(--_agent-logic-danger-text);
1130
+ }
1131
+
1132
+ .statechart-workspace__source {
1133
+ display: flex;
1134
+ flex-direction: column;
1135
+ min-height: 0;
1136
+ border-left: 1px solid var(--_agent-logic-border);
1137
+ background: var(--agent-logic-surface);
1138
+ }
1139
+
1140
+ .statechart-workspace__prompt {
1141
+ flex: 1;
1142
+ min-height: 0;
1143
+ }
@@ -0,0 +1,4 @@
1
+ /** The suffix that names an agent-logic file in a store and in a download. */
2
+ export declare const AGENT_LOGIC_SUFFIX = ".agent-logic.json";
3
+ /** Reports whether the name ends in `.agent-logic.json` after a non-empty base. */
4
+ export declare function isAgentLogicFileName(name: string): boolean;
@@ -0,0 +1,4 @@
1
+ export const AGENT_LOGIC_SUFFIX = '.agent-logic.json';
2
+ export function isAgentLogicFileName(name) {
3
+ return name.length > AGENT_LOGIC_SUFFIX.length && name.endsWith(AGENT_LOGIC_SUFFIX);
4
+ }