codeassembly-agent-logic 0.0.0 → 0.1.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 (168) hide show
  1. package/.meta/changelog.json +77 -0
  2. package/CHANGELOG.md +28 -0
  3. package/LICENSE +7 -0
  4. package/README.md +86 -1
  5. package/bin/agent-logic.js +26 -0
  6. package/dist/esm/cli/check-coverage-command.d.ts +3 -0
  7. package/dist/esm/cli/check-coverage-command.js +99 -0
  8. package/dist/esm/cli/convert-command.d.ts +3 -0
  9. package/dist/esm/cli/convert-command.js +116 -0
  10. package/dist/esm/cli/find-package-root.d.ts +7 -0
  11. package/dist/esm/cli/find-package-root.js +31 -0
  12. package/dist/esm/cli/index.d.ts +1 -0
  13. package/dist/esm/cli/index.js +11 -0
  14. package/dist/esm/cli/run.d.ts +8 -0
  15. package/dist/esm/cli/run.js +62 -0
  16. package/dist/esm/contract/built-in-harnesses.d.ts +22 -0
  17. package/dist/esm/contract/built-in-harnesses.js +30 -0
  18. package/dist/esm/contract/conversion-job.d.ts +36 -0
  19. package/dist/esm/contract/conversion-job.js +17 -0
  20. package/dist/esm/contract/index.d.ts +4 -0
  21. package/dist/esm/contract/index.js +3 -0
  22. package/dist/esm/contract/viewer-contract.d.ts +804 -0
  23. package/dist/esm/contract/viewer-contract.js +38 -0
  24. package/dist/esm/convert/convert-prompt.d.ts +21 -0
  25. package/dist/esm/convert/convert-prompt.js +60 -0
  26. package/dist/esm/convert/draft-schema.d.ts +308 -0
  27. package/dist/esm/convert/draft-schema.js +57 -0
  28. package/dist/esm/convert/find-gate-spans.d.ts +6 -0
  29. package/dist/esm/convert/find-gate-spans.js +18 -0
  30. package/dist/esm/convert/format-state-name.d.ts +6 -0
  31. package/dist/esm/convert/format-state-name.js +6 -0
  32. package/dist/esm/convert/normalize-config.d.ts +11 -0
  33. package/dist/esm/convert/normalize-config.js +164 -0
  34. package/dist/esm/convert/resolve-quotes.d.ts +18 -0
  35. package/dist/esm/convert/resolve-quotes.js +169 -0
  36. package/dist/esm/convert/sanitize-name.d.ts +5 -0
  37. package/dist/esm/convert/sanitize-name.js +8 -0
  38. package/dist/esm/coverage-map/check-coverage.d.ts +20 -0
  39. package/dist/esm/coverage-map/check-coverage.js +21 -0
  40. package/dist/esm/coverage-map/coverage-map-schema.d.ts +11 -0
  41. package/dist/esm/coverage-map/coverage-map-schema.js +2 -0
  42. package/dist/esm/coverage-map/find-prompt-blocks.d.ts +15 -0
  43. package/dist/esm/coverage-map/find-prompt-blocks.js +140 -0
  44. package/dist/esm/examples/change-approval.d.ts +2 -0
  45. package/dist/esm/examples/change-approval.js +438 -0
  46. package/dist/esm/examples/examples.d.ts +9 -0
  47. package/dist/esm/examples/examples.js +8 -0
  48. package/dist/esm/examples/password-reset.d.ts +2 -0
  49. package/dist/esm/examples/password-reset.js +235 -0
  50. package/dist/esm/examples/refund-request.d.ts +2 -0
  51. package/dist/esm/examples/refund-request.js +233 -0
  52. package/dist/esm/index.d.ts +13 -0
  53. package/dist/esm/index.js +12 -0
  54. package/dist/esm/layout/build-elk-graph.d.ts +18 -0
  55. package/dist/esm/layout/build-elk-graph.js +96 -0
  56. package/dist/esm/layout/card-limits.d.ts +8 -0
  57. package/dist/esm/layout/card-limits.js +4 -0
  58. package/dist/esm/layout/describe-config.d.ts +118 -0
  59. package/dist/esm/layout/describe-config.js +199 -0
  60. package/dist/esm/layout/layout-config.d.ts +5 -0
  61. package/dist/esm/layout/layout-config.js +73 -0
  62. package/dist/esm/layout/layout-metrics.d.ts +6 -0
  63. package/dist/esm/layout/layout-metrics.js +6 -0
  64. package/dist/esm/layout/pack-preamble.d.ts +20 -0
  65. package/dist/esm/layout/pack-preamble.js +66 -0
  66. package/dist/esm/layout/to-flow-elements.d.ts +46 -0
  67. package/dist/esm/layout/to-flow-elements.js +83 -0
  68. package/dist/esm/react/canvas/AmbientSelectionContext.d.ts +7 -0
  69. package/dist/esm/react/canvas/AmbientSelectionContext.js +5 -0
  70. package/dist/esm/react/canvas/DetailLevelContext.d.ts +3 -0
  71. package/dist/esm/react/canvas/DetailLevelContext.js +2 -0
  72. package/dist/esm/react/canvas/FocusNavigation.d.ts +8 -0
  73. package/dist/esm/react/canvas/FocusNavigation.js +92 -0
  74. package/dist/esm/react/canvas/StateNode.d.ts +5 -0
  75. package/dist/esm/react/canvas/StateNode.js +91 -0
  76. package/dist/esm/react/canvas/StatechartCanvas.d.ts +16 -0
  77. package/dist/esm/react/canvas/StatechartCanvas.js +184 -0
  78. package/dist/esm/react/canvas/TransitionEdge.d.ts +5 -0
  79. package/dist/esm/react/canvas/TransitionEdge.js +22 -0
  80. package/dist/esm/react/canvas/canvas-key-entries.d.ts +14 -0
  81. package/dist/esm/react/canvas/canvas-key-entries.js +51 -0
  82. package/dist/esm/react/canvas/find-element-box.d.ts +8 -0
  83. package/dist/esm/react/canvas/find-element-box.js +25 -0
  84. package/dist/esm/react/canvas/find-view-centre.d.ts +15 -0
  85. package/dist/esm/react/canvas/find-view-centre.js +16 -0
  86. package/dist/esm/react/canvas/list-chart-marks.d.ts +5 -0
  87. package/dist/esm/react/canvas/list-chart-marks.js +37 -0
  88. package/dist/esm/react/canvas/marks.d.ts +19 -0
  89. package/dist/esm/react/canvas/marks.js +24 -0
  90. package/dist/esm/react/canvas/useNewLayout.d.ts +17 -0
  91. package/dist/esm/react/canvas/useNewLayout.js +44 -0
  92. package/dist/esm/react/canvas/zoom-levels.d.ts +28 -0
  93. package/dist/esm/react/canvas/zoom-levels.js +54 -0
  94. package/dist/esm/react/hooks/conversion-client.d.ts +77 -0
  95. package/dist/esm/react/hooks/conversion-client.js +132 -0
  96. package/dist/esm/react/hooks/describe-agent-selection.d.ts +6 -0
  97. package/dist/esm/react/hooks/describe-agent-selection.js +18 -0
  98. package/dist/esm/react/hooks/describe-load-outcome.d.ts +13 -0
  99. package/dist/esm/react/hooks/describe-load-outcome.js +30 -0
  100. package/dist/esm/react/hooks/download-config.d.ts +6 -0
  101. package/dist/esm/react/hooks/download-config.js +11 -0
  102. package/dist/esm/react/hooks/example-location.d.ts +7 -0
  103. package/dist/esm/react/hooks/example-location.js +14 -0
  104. package/dist/esm/react/hooks/label-source.d.ts +21 -0
  105. package/dist/esm/react/hooks/label-source.js +19 -0
  106. package/dist/esm/react/hooks/parse-config-text.d.ts +16 -0
  107. package/dist/esm/react/hooks/parse-config-text.js +38 -0
  108. package/dist/esm/react/hooks/useAgentBridge.d.ts +28 -0
  109. package/dist/esm/react/hooks/useAgentBridge.js +52 -0
  110. package/dist/esm/react/hooks/useAgentSync.d.ts +29 -0
  111. package/dist/esm/react/hooks/useAgentSync.js +75 -0
  112. package/dist/esm/react/hooks/useChartLayout.d.ts +25 -0
  113. package/dist/esm/react/hooks/useChartLayout.js +29 -0
  114. package/dist/esm/react/hooks/useConversion.d.ts +31 -0
  115. package/dist/esm/react/hooks/useConversion.js +177 -0
  116. package/dist/esm/react/hooks/useConvertDraft.d.ts +18 -0
  117. package/dist/esm/react/hooks/useConvertDraft.js +11 -0
  118. package/dist/esm/react/hooks/useDocumentTitle.d.ts +2 -0
  119. package/dist/esm/react/hooks/useDocumentTitle.js +7 -0
  120. package/dist/esm/react/hooks/useEscapeToClear.d.ts +2 -0
  121. package/dist/esm/react/hooks/useEscapeToClear.js +16 -0
  122. package/dist/esm/react/hooks/useHarnessList.d.ts +26 -0
  123. package/dist/esm/react/hooks/useHarnessList.js +24 -0
  124. package/dist/esm/react/hooks/usePromptDirectory.d.ts +27 -0
  125. package/dist/esm/react/hooks/usePromptDirectory.js +34 -0
  126. package/dist/esm/react/hooks/useSelection.d.ts +17 -0
  127. package/dist/esm/react/hooks/useSelection.js +21 -0
  128. package/dist/esm/react/hooks/useShowAmbient.d.ts +7 -0
  129. package/dist/esm/react/hooks/useShowAmbient.js +22 -0
  130. package/dist/esm/react/hooks/useUnknownExample.d.ts +7 -0
  131. package/dist/esm/react/hooks/useUnknownExample.js +26 -0
  132. package/dist/esm/react/index.d.ts +24 -0
  133. package/dist/esm/react/index.js +23 -0
  134. package/dist/esm/react/styles.css +482 -0
  135. package/dist/esm/schema/agent-logic-schema.d.ts +439 -0
  136. package/dist/esm/schema/agent-logic-schema.js +100 -0
  137. package/dist/esm/schema/config-traversal.d.ts +19 -0
  138. package/dist/esm/schema/config-traversal.js +32 -0
  139. package/dist/esm/schema/validate-config.d.ts +17 -0
  140. package/dist/esm/schema/validate-config.js +205 -0
  141. package/dist/esm/schema/write-json-schema.d.ts +4 -0
  142. package/dist/esm/schema/write-json-schema.js +12 -0
  143. package/dist/esm/server/conversion-job-implementation.d.ts +11 -0
  144. package/dist/esm/server/conversion-job-implementation.js +84 -0
  145. package/dist/esm/server/create-prompts-app.d.ts +26 -0
  146. package/dist/esm/server/create-prompts-app.js +41 -0
  147. package/dist/esm/server/create-viewer-server-plugins.d.ts +15 -0
  148. package/dist/esm/server/create-viewer-server-plugins.js +76 -0
  149. package/dist/esm/server/index.d.ts +7 -0
  150. package/dist/esm/server/index.js +6 -0
  151. package/dist/esm/server/prompt-directory-schemas.d.ts +30 -0
  152. package/dist/esm/server/prompt-directory-schemas.js +11 -0
  153. package/dist/esm/server/prompt-directory.d.ts +40 -0
  154. package/dist/esm/server/prompt-directory.js +86 -0
  155. package/dist/esm/server/viewer-contract-implementation.d.ts +12 -0
  156. package/dist/esm/server/viewer-contract-implementation.js +85 -0
  157. package/dist/esm/source/fence.d.ts +16 -0
  158. package/dist/esm/source/fence.js +15 -0
  159. package/dist/esm/source/find-comment-spans.d.ts +6 -0
  160. package/dist/esm/source/find-comment-spans.js +60 -0
  161. package/dist/esm/source/find-occurrences.d.ts +2 -0
  162. package/dist/esm/source/find-occurrences.js +7 -0
  163. package/dist/esm/source/prompt-segments.d.ts +21 -0
  164. package/dist/esm/source/prompt-segments.js +65 -0
  165. package/docs/conversion-agreement.md +37 -0
  166. package/docs/extraction-rules.md +123 -0
  167. package/package.json +106 -2
  168. package/schema/agent-logic.schema.json +475 -0
@@ -0,0 +1,23 @@
1
+ export * from "./canvas/canvas-key-entries.js";
2
+ export * from "./canvas/list-chart-marks.js";
3
+ export * from "./canvas/marks.js";
4
+ export * from "./canvas/StatechartCanvas.js";
5
+ export * from "./hooks/conversion-client.js";
6
+ export * from "./hooks/describe-agent-selection.js";
7
+ export * from "./hooks/describe-load-outcome.js";
8
+ export * from "./hooks/download-config.js";
9
+ export * from "./hooks/example-location.js";
10
+ export * from "./hooks/label-source.js";
11
+ export * from "./hooks/parse-config-text.js";
12
+ export * from "./hooks/useAgentBridge.js";
13
+ export * from "./hooks/useAgentSync.js";
14
+ export * from "./hooks/useChartLayout.js";
15
+ export * from "./hooks/useConversion.js";
16
+ export * from "./hooks/useConvertDraft.js";
17
+ export * from "./hooks/useDocumentTitle.js";
18
+ export * from "./hooks/useEscapeToClear.js";
19
+ export * from "./hooks/useHarnessList.js";
20
+ export * from "./hooks/usePromptDirectory.js";
21
+ export * from "./hooks/useSelection.js";
22
+ export * from "./hooks/useShowAmbient.js";
23
+ export * from "./hooks/useUnknownExample.js";
@@ -0,0 +1,482 @@
1
+ /*
2
+ * Styles for the statechart canvas and the marks of its key. Colours and the code font are custom properties, each with
3
+ * a default here; a consumer overrides any of them on :root or on an ancestor of the canvas.
4
+ */
5
+
6
+ @import '@xyflow/react/dist/style.css';
7
+
8
+ :where(:root) {
9
+ --agent-logic-ambient-background: #091e420f;
10
+ --agent-logic-border: #0b120e24;
11
+ --agent-logic-border-strong: #758195;
12
+ --agent-logic-compound-background: #f7f8f9;
13
+ --agent-logic-focus-ring: #2684ff;
14
+ --agent-logic-font-code: ui-monospace, monospace;
15
+ --agent-logic-global: #8270db;
16
+ --agent-logic-hover-background: #091e420f;
17
+ --agent-logic-node-background: #fff;
18
+ --agent-logic-selected: #0c66e4;
19
+ --agent-logic-selected-background: #e9f2ff;
20
+ --agent-logic-surface: #fff;
21
+ --agent-logic-text: #172b4d;
22
+ --agent-logic-text-subtle: #44546f;
23
+ --agent-logic-tooltip-background: #44546f;
24
+ --agent-logic-tooltip-text: #fff;
25
+ --agent-logic-waiting: #1d7afc;
26
+ --agent-logic-warning: #e06c00;
27
+ }
28
+
29
+ .statechart-canvas {
30
+ display: flex;
31
+ flex-direction: column;
32
+ block-size: 100%;
33
+ inline-size: 100%;
34
+ /* A drag that starts on text pans the chart instead of selecting the text. */
35
+ user-select: none;
36
+ }
37
+
38
+ /* The chart takes the height that the key below it leaves. */
39
+ .statechart-canvas > .react-flow {
40
+ flex: 1;
41
+ min-block-size: 0;
42
+ block-size: auto;
43
+ }
44
+
45
+ /* Keep the library's attribution at the page's 12px text floor. */
46
+ .statechart-canvas .react-flow__attribution {
47
+ font-size: 12px;
48
+ }
49
+
50
+ /* -- Interaction states, shared by every node and edge -- */
51
+
52
+ .statechart-canvas .react-flow__node,
53
+ .statechart-canvas .react-flow__edge {
54
+ cursor: pointer;
55
+ }
56
+
57
+ .statechart-canvas .react-flow__node:focus-visible {
58
+ outline: 2px solid var(--agent-logic-focus-ring);
59
+ outline-offset: 2px;
60
+ }
61
+
62
+ /* A flow's node passes pointer events through, which `toFlowElements` sets, so its name is what selects it. */
63
+ .statechart-canvas .state-node__flow-name {
64
+ cursor: pointer;
65
+ pointer-events: auto;
66
+ }
67
+
68
+ .statechart-canvas .state-node__flow-name:hover {
69
+ text-decoration: underline;
70
+ }
71
+
72
+ /*
73
+ * A name that cannot start over its own flow at this zoom would name nothing, so it becomes a band along the inside of
74
+ * the flow's top edge, 6px tall on screen, which selects the flow and names it in the flow's tooltip.
75
+ */
76
+ .statechart-canvas .state-node__flow-name--hidden {
77
+ inset-block: 0 auto;
78
+ inset-inline: 0;
79
+ block-size: calc(6px / var(--canvas-zoom, 1));
80
+ max-inline-size: none;
81
+ padding: 0;
82
+ overflow: hidden;
83
+ background-color: var(--agent-logic-border-strong);
84
+ color: transparent;
85
+ font-size: 0;
86
+ transform: none;
87
+ }
88
+
89
+ .statechart-canvas .state-node__flow-name--hidden:hover {
90
+ background-color: var(--agent-logic-selected);
91
+ }
92
+
93
+ /* A final state's outline is its mark, so pointing at or selecting it adds only the ring. */
94
+ .statechart-canvas .react-flow__node:hover > .state-node:not(.state-node--final),
95
+ .statechart-canvas .react-flow__node.selected > .state-node:not(.state-node--final) {
96
+ border-color: var(--agent-logic-border-strong);
97
+ }
98
+
99
+ .statechart-canvas .react-flow__node.selected > .state-node {
100
+ box-shadow: 0 0 0 1px var(--agent-logic-selected);
101
+ }
102
+
103
+ .statechart-canvas .react-flow__edge:hover .transition-edge__path,
104
+ .statechart-canvas .react-flow__edge.selected .transition-edge__path {
105
+ stroke: var(--agent-logic-selected);
106
+ stroke-width: 2.5;
107
+ marker-end: url('#arrowhead-selected');
108
+ }
109
+
110
+ .statechart-canvas .react-flow__edge:focus-visible .transition-edge__label,
111
+ .statechart-canvas .react-flow__edge.selected .transition-edge__label {
112
+ /* Inset, because the label's foreignObject clips anything outside it. */
113
+ outline: 2px solid var(--agent-logic-focus-ring);
114
+ outline-offset: -2px;
115
+ }
116
+
117
+ .statechart-canvas .react-flow__edge:focus-visible {
118
+ outline: none;
119
+ }
120
+
121
+ /* The lower levels of detail hide the label, so the route shows focus too. */
122
+ .statechart-canvas .react-flow__edge:focus-visible .transition-edge__path {
123
+ stroke: var(--agent-logic-focus-ring);
124
+ stroke-width: 3;
125
+ marker-end: url('#arrowhead-selected');
126
+ }
127
+
128
+ /* -- Level of detail: the classes and their thresholds are set from `zoom-levels.ts` -- */
129
+
130
+ .statechart-canvas__flow--large-text .state-node__inferred,
131
+ .statechart-canvas__flow--large-text .state-node__actions-heading,
132
+ .statechart-canvas__flow--large-text .state-node__more,
133
+ .statechart-canvas__flow--large-text .transition-edge__label,
134
+ .statechart-canvas__flow--shapes .state-node > :not(.state-node__flow-name, .state-node__preamble),
135
+ .statechart-canvas__flow--shapes .transition-edge__label {
136
+ visibility: hidden;
137
+ }
138
+
139
+ /* A box keeps its kind's marks while its text is hidden. */
140
+ .statechart-canvas__flow--shapes .state-node .state-node__glyphs,
141
+ .statechart-canvas__flow--shapes .state-node .state-node__initial-mark {
142
+ visibility: visible;
143
+ }
144
+
145
+ /* A preamble keeps a bar for each ambient instruction while its text is hidden, so that a selected one stays marked. */
146
+ .statechart-canvas__flow--shapes .state-node__preamble-heading {
147
+ visibility: hidden;
148
+ }
149
+
150
+ .statechart-canvas__flow--shapes .state-node__ambient {
151
+ background: var(--agent-logic-ambient-background);
152
+ color: transparent;
153
+ }
154
+
155
+ /* -- States -- */
156
+
157
+ .state-node {
158
+ block-size: 100%;
159
+ box-sizing: border-box;
160
+ padding: 8px 12px;
161
+ border: 1px solid var(--agent-logic-border);
162
+ border-radius: 8px;
163
+ background: var(--agent-logic-node-background);
164
+ color: var(--agent-logic-text);
165
+ font-size: 14px;
166
+ line-height: 18px;
167
+ position: relative;
168
+ }
169
+
170
+ .state-node--compound {
171
+ background: var(--agent-logic-compound-background);
172
+ }
173
+
174
+ /* A thicker border takes its width from the padding, so the content keeps its place. */
175
+ .state-node--final {
176
+ padding: 7px 11px;
177
+ border: 2px solid var(--agent-logic-text);
178
+ }
179
+
180
+ .state-node--inferred {
181
+ padding: 7px 11px;
182
+ border: 2px dashed var(--agent-logic-text-subtle);
183
+ }
184
+
185
+ /* An inferred final state keeps its dash and takes the final outline's colour. */
186
+ .state-node--final.state-node--inferred {
187
+ border-color: var(--agent-logic-text);
188
+ }
189
+
190
+ .state-node--waiting::before {
191
+ position: absolute;
192
+ inset-block: 0;
193
+ inset-inline-start: 0;
194
+ inline-size: 5px;
195
+ border-start-start-radius: 7px;
196
+ border-end-start-radius: 7px;
197
+ background: var(--agent-logic-waiting);
198
+ content: '';
199
+ }
200
+
201
+ .state-node__initial-mark {
202
+ position: absolute;
203
+ inset-block-start: 12px;
204
+ inset-inline-end: 100%;
205
+ color: var(--agent-logic-text);
206
+ }
207
+
208
+ .state-node__title-row {
209
+ display: flex;
210
+ gap: 4px;
211
+ align-items: flex-start;
212
+ }
213
+
214
+ .state-node__title-row .state-node__title {
215
+ flex: 1;
216
+ min-inline-size: 0;
217
+ }
218
+
219
+ .state-node__glyphs {
220
+ display: flex;
221
+ flex: none;
222
+ gap: 4px;
223
+ padding-block-start: 2px;
224
+ }
225
+
226
+ .mark-glyph {
227
+ display: block;
228
+ block-size: 16px;
229
+ inline-size: 16px;
230
+ }
231
+
232
+ .mark-glyph--wait {
233
+ color: var(--agent-logic-waiting);
234
+ }
235
+
236
+ .mark-glyph--final {
237
+ color: var(--agent-logic-text);
238
+ }
239
+
240
+ .mark-glyph--no-exit,
241
+ .mark-glyph--unreachable {
242
+ color: var(--agent-logic-warning);
243
+ }
244
+
245
+ .mark-glyph__cutout {
246
+ fill: var(--agent-logic-node-background);
247
+ }
248
+
249
+ .state-node__inferred {
250
+ color: var(--agent-logic-text-subtle);
251
+ font-size: 12px;
252
+ font-style: italic;
253
+ }
254
+
255
+ .state-node__gate {
256
+ color: var(--agent-logic-text-subtle);
257
+ font-size: 12px;
258
+ }
259
+
260
+ .state-node__handle {
261
+ visibility: hidden;
262
+ }
263
+
264
+ /* -- A flow's preamble: its ambient instructions in the prompt's serif. Sizes match `pack-preamble.ts`. -- */
265
+
266
+ /* `StateNode` sets the custom properties from the layout. */
267
+ .state-node__preamble {
268
+ inline-size: calc(
269
+ var(--preamble-columns) * var(--preamble-column-width) + (var(--preamble-columns) - 1) * var(--preamble-column-gap)
270
+ );
271
+ max-inline-size: 100%;
272
+ margin-block-end: 8px;
273
+ }
274
+
275
+ .state-node__preamble-heading {
276
+ color: var(--agent-logic-text-subtle);
277
+ font-size: 12px;
278
+ line-height: 16px;
279
+ }
280
+
281
+ /* Fill each column down to the layout's height before the next, so that the preamble fits the room reserved for it. */
282
+ .state-node__preamble ul {
283
+ display: flex;
284
+ flex-flow: column wrap;
285
+ align-content: flex-start;
286
+ gap: 4px var(--preamble-column-gap);
287
+ block-size: var(--preamble-column-height, auto);
288
+ margin: 0;
289
+ padding: 0;
290
+ list-style: none;
291
+ }
292
+
293
+ /* The reset's `li + li` margin would add to the list's gap. */
294
+ .state-node__preamble li {
295
+ inline-size: var(--preamble-column-width);
296
+ max-inline-size: 100%;
297
+ margin: 0;
298
+ }
299
+
300
+ /* `StateNode` sets the line count from `card-limits.ts`. */
301
+ .state-node__ambient {
302
+ display: -webkit-box;
303
+ overflow: hidden;
304
+ -webkit-box-orient: vertical;
305
+ /* Bleed the hover background past the text, which keeps the preamble's edge. */
306
+ inline-size: calc(100% + 8px);
307
+ margin: 0 -4px;
308
+ padding: 0 4px;
309
+ border: 0;
310
+ border-radius: 3px;
311
+ background: none;
312
+ color: var(--agent-logic-text);
313
+ cursor: pointer;
314
+ /* The serif face in which an app's prompt pane quotes the prompt. */
315
+ font-family: 'Iowan Old Style', Charter, 'Source Serif 4', Georgia, ui-serif, serif;
316
+ font-size: 14px;
317
+ line-height: 20px;
318
+ text-align: start;
319
+ }
320
+
321
+ .state-node__ambient:hover {
322
+ background: var(--agent-logic-hover-background);
323
+ }
324
+
325
+ .state-node__ambient:focus-visible {
326
+ outline: 2px solid var(--agent-logic-focus-ring);
327
+ outline-offset: 1px;
328
+ }
329
+
330
+ .state-node__ambient--selected,
331
+ .state-node__ambient--selected:hover {
332
+ background: var(--agent-logic-selected-background);
333
+ box-shadow: inset 2px 0 0 var(--agent-logic-selected);
334
+ }
335
+
336
+ .state-node__title {
337
+ font-weight: 600;
338
+ line-height: 20px;
339
+ overflow-wrap: anywhere;
340
+ }
341
+
342
+ .state-node__actions {
343
+ margin-block-start: 4px;
344
+ }
345
+
346
+ .state-node__actions-heading {
347
+ color: var(--agent-logic-text-subtle);
348
+ font-size: 12px;
349
+ }
350
+
351
+ .state-node__actions ul {
352
+ margin: 0;
353
+ padding-inline-start: 18px;
354
+ }
355
+
356
+ /* `StateNode` sets the line count from `card-limits.ts`; the list item's marker is drawn as a pseudo-element because a
357
+ clamped box does not draw it. */
358
+ .state-node__action {
359
+ display: -webkit-box;
360
+ position: relative;
361
+ overflow: hidden;
362
+ -webkit-box-orient: vertical;
363
+ }
364
+
365
+ .state-node__action::before {
366
+ content: '•';
367
+ position: absolute;
368
+ inset-inline-start: -12px;
369
+ }
370
+
371
+ .state-node__more {
372
+ color: var(--agent-logic-text-subtle);
373
+ font-size: 12px;
374
+ }
375
+
376
+ /* Kept at 14px on screen by scaling against the zoom, which `StatechartCanvas` sets as `--canvas-zoom`. */
377
+ .state-node__flow-name {
378
+ position: absolute;
379
+ inset-block-end: 100%;
380
+ inset-inline-start: 0;
381
+ max-inline-size: 360px;
382
+ padding-block-end: 4px;
383
+ overflow: hidden;
384
+ font-weight: 600;
385
+ line-height: 20px;
386
+ text-overflow: ellipsis;
387
+ transform: scale(calc(1 / var(--canvas-zoom, 1)));
388
+ transform-origin: bottom left;
389
+ white-space: nowrap;
390
+ }
391
+
392
+ /* A state drawn as a box names itself here, at a fixed screen size. */
393
+ .state-node__tooltip {
394
+ max-inline-size: 240px;
395
+ padding: 2px 6px;
396
+ border-radius: 3px;
397
+ background: var(--agent-logic-tooltip-background);
398
+ color: var(--agent-logic-tooltip-text);
399
+ font-size: 12px;
400
+ line-height: 16px;
401
+ overflow-wrap: anywhere;
402
+ }
403
+
404
+ /* -- Transitions -- */
405
+
406
+ /* An event name has no spaces at which to wrap, and the label's box clips what overflows it. */
407
+ .transition-edge__trigger {
408
+ font-family: var(--agent-logic-font-code);
409
+ font-weight: 600;
410
+ overflow-wrap: anywhere;
411
+ }
412
+
413
+ .transition-edge__word {
414
+ color: var(--agent-logic-text-subtle);
415
+ font-style: italic;
416
+ }
417
+
418
+ .transition-edge__path {
419
+ stroke: var(--agent-logic-border-strong);
420
+ stroke-width: 1.5;
421
+ marker-end: url('#arrowhead-ordinary');
422
+ }
423
+
424
+ .transition-edge__path--global {
425
+ stroke: var(--agent-logic-global);
426
+ stroke-width: 2.5;
427
+ marker-end: url('#arrowhead-global');
428
+ }
429
+
430
+ /* -- Arrowheads: each fills with the colour of the edges that end in it -- */
431
+
432
+ .arrowhead-defs {
433
+ position: absolute;
434
+ }
435
+
436
+ .arrowhead--arrowhead-ordinary {
437
+ fill: var(--agent-logic-border-strong);
438
+ }
439
+
440
+ .arrowhead--arrowhead-global {
441
+ fill: var(--agent-logic-global);
442
+ }
443
+
444
+ .arrowhead--arrowhead-selected {
445
+ fill: var(--agent-logic-selected);
446
+ }
447
+
448
+ .transition-edge__path--inferred {
449
+ stroke-dasharray: 6 4;
450
+ }
451
+
452
+ .transition-edge__label {
453
+ box-sizing: border-box;
454
+ padding: 2px 6px;
455
+ border-radius: 4px;
456
+ background: var(--agent-logic-surface);
457
+ color: var(--agent-logic-text);
458
+ font-size: 12px;
459
+ line-height: 18px;
460
+ }
461
+
462
+ /* -- Key -- */
463
+
464
+ .canvas-key__swatch {
465
+ display: inline-block;
466
+ box-sizing: border-box;
467
+ inline-size: 18px;
468
+ }
469
+
470
+ .canvas-key__swatch--global {
471
+ border-block-start: 2.5px solid var(--agent-logic-global);
472
+ }
473
+
474
+ .canvas-key__swatch--inferred {
475
+ block-size: 12px;
476
+ border: 2px dashed var(--agent-logic-text-subtle);
477
+ border-radius: 2px;
478
+ }
479
+
480
+ .canvas-key__word {
481
+ color: var(--agent-logic-text-subtle);
482
+ }