@uipath/skills 1.206.0 → 1.206.1

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 (115) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.cursor-plugin/plugin.json +1 -1
  4. package/CODEOWNERS +34 -7
  5. package/README.md +2 -2
  6. package/package.json +2 -2
  7. package/skills/uipath-genome/SKILL.md +35 -88
  8. package/skills/uipath-genome/references/build-guide.md +61 -0
  9. package/skills/uipath-genome/references/completion-report-guide.md +93 -0
  10. package/skills/uipath-genome/references/composite-interactions-guide.md +39 -0
  11. package/skills/uipath-genome/references/configuration-questions-guide.md +68 -0
  12. package/skills/uipath-genome/references/execution-guide.md +45 -166
  13. package/skills/uipath-genome/references/execution-parts-guide.md +84 -17
  14. package/skills/uipath-genome/references/genome-reading-guide.md +153 -0
  15. package/skills/uipath-genome/references/live-application-guide.md +23 -9
  16. package/skills/uipath-genome/references/offline-definition-workarounds-guide.md +4 -4
  17. package/skills/uipath-genome/references/open-items-guide.md +3 -3
  18. package/skills/uipath-genome/references/package-doc-errata-guide.md +8 -0
  19. package/skills/uipath-genome/references/refactor-guide.md +38 -39
  20. package/skills/uipath-genome/references/selector-matching-guide.md +59 -0
  21. package/skills/uipath-genome/references/selector-translation-guide.md +13 -66
  22. package/skills/uipath-genome/references/selector-translation-sap-guide.md +7 -5
  23. package/skills/uipath-genome/references/selector-translation-web-guide.md +2 -2
  24. package/skills/uipath-genome/references/source-frameworks-guide.md +21 -0
  25. package/skills/uipath-genome/references/source-migration-guide.md +48 -19
  26. package/skills/uipath-genome/references/test-execution-guide.md +8 -7
  27. package/skills/uipath-genome/references/transactional-execution-guide.md +41 -13
  28. package/skills/uipath-genome/references/ui-target-migration-guide.md +12 -49
  29. package/skills/uipath-genome/references/ui-verification-guide.md +9 -1
  30. package/skills/uipath-maestro-case/SKILL.md +7 -7
  31. package/skills/uipath-maestro-case/references/evals/evals.json +5 -5
  32. package/skills/uipath-maestro-case/references/planning.md +5 -5
  33. package/skills/uipath-maestro-case/references/plugins/conditions/task-entry-conditions/planning.md +2 -2
  34. package/skills/uipath-maestro-case/references/plugins/sla/planning.md +1 -1
  35. package/skills/uipath-maestro-case/references/registry-discovery.md +3 -3
  36. package/skills/uipath-planner/SKILL.md +80 -199
  37. package/skills/uipath-planner/assets/templates/agent-sdd-template.md +17 -17
  38. package/skills/uipath-planner/assets/templates/api-workflow-sdd-template.md +15 -13
  39. package/skills/uipath-planner/assets/templates/bpmn-sdd-template.md +19 -19
  40. package/skills/uipath-planner/assets/templates/case-sdd-task-details-template.md +173 -0
  41. package/skills/uipath-planner/assets/templates/{case/case-sdd-template.md → case-sdd-template.md} +51 -229
  42. package/skills/uipath-planner/assets/templates/coded-app-sdd-template.md +16 -14
  43. package/skills/{uipath-genome → uipath-planner}/assets/templates/component-genome-template.md +9 -5
  44. package/skills/uipath-planner/assets/templates/flow-sdd-template.md +17 -15
  45. package/skills/{uipath-genome → uipath-planner}/assets/templates/process-genome-template.md +11 -7
  46. package/skills/uipath-planner/assets/templates/rpa-sdd-template.md +50 -73
  47. package/skills/uipath-planner/references/author/author-guide.md +119 -0
  48. package/skills/uipath-planner/references/author/genome-from-sdd-guide.md +36 -0
  49. package/skills/uipath-planner/references/author/scenario-proposal-guide.md +30 -0
  50. package/skills/uipath-planner/references/decompose/decompose-guide.md +223 -0
  51. package/skills/uipath-planner/references/{asdd-crosswalk-guide.md → design/asdd-crosswalk-guide.md} +6 -4
  52. package/skills/uipath-planner/references/{business-rules-guide.md → design/business-rules-guide.md} +3 -3
  53. package/skills/uipath-planner/references/design/caller-request-guide.md +92 -0
  54. package/skills/uipath-planner/references/design/case-data-and-time-guide.md +292 -0
  55. package/skills/uipath-planner/references/design/case-product-guide.md +243 -0
  56. package/skills/uipath-planner/references/design/case-review-and-conformance-guide.md +166 -0
  57. package/skills/uipath-planner/references/design/design-guide.md +296 -0
  58. package/skills/uipath-planner/references/{package-selection-guide.md → design/package-selection-guide.md} +16 -13
  59. package/skills/uipath-planner/references/{rpa-product-guide.md → design/rpa-product-guide.md} +23 -53
  60. package/skills/uipath-planner/references/design/scope-recommendation-guide.md +134 -0
  61. package/skills/uipath-planner/references/design/sdd-writing-guide.md +235 -0
  62. package/skills/uipath-planner/references/design/solution-composition-guide.md +153 -0
  63. package/skills/uipath-planner/references/edit/edit-guide.md +66 -0
  64. package/skills/uipath-planner/references/extract/extract-guide.md +230 -0
  65. package/skills/uipath-planner/references/extract/source-frameworks-guide.md +22 -0
  66. package/skills/uipath-planner/references/extract/uipath-non-rpa-signals-guide.md +121 -0
  67. package/skills/uipath-planner/references/extract/uipath-rpa-signals-guide.md +88 -0
  68. package/skills/uipath-planner/references/extract/uipath-source-guide.md +193 -0
  69. package/skills/uipath-planner/references/shared/component-placement-guide.md +99 -0
  70. package/skills/{uipath-genome/references → uipath-planner/references/shared}/defect-verification-guide.md +4 -4
  71. package/skills/{uipath-genome/references → uipath-planner/references/shared}/extracted-genome-guide.md +15 -14
  72. package/skills/uipath-planner/references/shared/extraction-parts-guide.md +66 -0
  73. package/skills/{uipath-genome/references → uipath-planner/references/shared}/genome-format-guide.md +63 -34
  74. package/skills/uipath-planner/references/{multi-skill-patterns-guide.md → shared/multi-skill-patterns-guide.md} +28 -27
  75. package/skills/uipath-planner/references/{pdd-analysis-guide.md → shared/pdd-analysis-guide.md} +27 -72
  76. package/skills/uipath-planner/references/{plan-and-tasks-format.md → shared/plan-and-tasks-format.md} +43 -67
  77. package/skills/uipath-planner/references/{platform-availability-guide.md → shared/platform-availability-guide.md} +56 -1
  78. package/skills/uipath-planner/references/shared/product-selection-guide.md +202 -0
  79. package/skills/{uipath-genome/references → uipath-planner/references/shared}/skill-mapping-guide.md +24 -4
  80. package/skills/uipath-planner/references/{tenant-library-search-guide.md → shared/tenant-library-search-guide.md} +10 -8
  81. package/skills/{uipath-genome/references → uipath-planner/references/shared}/transactional-shape-guide.md +39 -8
  82. package/skills/uipath-planner/scripts/check-genome.mjs +801 -0
  83. package/skills/uipath-planner/scripts/sdd-fingerprint.mjs +71 -0
  84. package/skills/uipath-planner/scripts/sdd-to-docx.mjs +87 -0
  85. package/skills/uipath-test/SKILL.md +3 -3
  86. package/version-manifest.json +1 -1
  87. package/skills/uipath-genome/CLAUDE.md +0 -85
  88. package/skills/uipath-genome/assets/examples/artemis-2-mission-monitor-genome.md +0 -126
  89. package/skills/uipath-genome/assets/examples/classify-document-and-create-validation-genome.md +0 -117
  90. package/skills/uipath-genome/assets/examples/invoice-processing-genome/exception-triage-agent-genome.md +0 -96
  91. package/skills/uipath-genome/assets/examples/invoice-processing-genome/invoice-extraction-genome.md +0 -128
  92. package/skills/uipath-genome/assets/examples/invoice-processing-genome/invoice-orchestration-genome.md +0 -115
  93. package/skills/uipath-genome/assets/examples/invoice-processing-genome.md +0 -136
  94. package/skills/uipath-genome/assets/examples/purchase-requisition-entry-genome.md +0 -224
  95. package/skills/uipath-genome/assets/examples/salesforce-accounts-and-contacts-genome.md +0 -151
  96. package/skills/uipath-genome/references/authoring-guide.md +0 -98
  97. package/skills/uipath-genome/references/editing-guide.md +0 -57
  98. package/skills/uipath-genome/references/extraction-guide.md +0 -166
  99. package/skills/uipath-genome/references/extraction-parts-guide.md +0 -45
  100. package/skills/uipath-genome/references/parts-guide.md +0 -22
  101. package/skills/uipath-genome/references/uipath-source-guide.md +0 -404
  102. package/skills/uipath-genome/scripts/check-genome.py +0 -670
  103. package/skills/uipath-planner/assets/templates/case/sdd-viewer.html +0 -1530
  104. package/skills/uipath-planner/references/case/case-design-lane-guide.md +0 -327
  105. package/skills/uipath-planner/references/case/case-design-layers-guide.md +0 -503
  106. package/skills/uipath-planner/references/case/case-sdd-conformance-checklist.md +0 -123
  107. package/skills/uipath-planner/references/non-pdd-lane-guide.md +0 -196
  108. package/skills/uipath-planner/references/pdd-driven-lane-guide.md +0 -210
  109. package/skills/uipath-planner/references/product-selection-guide.md +0 -673
  110. package/skills/uipath-planner/references/sdd-generation-guide.md +0 -613
  111. package/skills/uipath-planner/scripts/docx-extract.ps1 +0 -59
  112. package/skills/uipath-planner/scripts/docx-extract.sh +0 -54
  113. package/skills/uipath-planner/scripts/sdd-to-docx.ps1 +0 -74
  114. package/skills/uipath-planner/scripts/sdd-to-docx.sh +0 -76
  115. /package/skills/uipath-planner/references/{attended-reauth-pattern-guide.md → design/attended-reauth-pattern-guide.md} +0 -0
@@ -1,1530 +0,0 @@
1
- <!doctype html>
2
- <!--
3
- SDD Viewer — interactive preview of a UiPath Case Management SDD.
4
-
5
- Generation contract (Phase 0 / Approve mode):
6
- 1. Read this file.
7
- 2. Replace the sentinel token inside the element with id="sdd-data"
8
- with a JSON object matching the schema documented in the JS section below.
9
- The token appears TWICE in this file: once as that element's content (the
10
- one to replace) and once inside the error message further down. Swap only
11
- the first — a replace-all corrupts the error text.
12
- 3. Write the populated file to ./sdd-viewer.html in the working directory.
13
- 4. Tell the user: "Generated ./sdd-viewer.html — open it in a browser to review."
14
-
15
- No external dependencies — the file is self-contained. Open via file:// URI.
16
- Edits to this template must keep CSS, HTML, and JS inline (single-file portability).
17
- -->
18
- <html lang="en">
19
- <head>
20
- <meta charset="utf-8">
21
- <meta name="viewport" content="width=device-width,initial-scale=1">
22
- <title>SDD Preview</title>
23
- <style>
24
- /* ---------- reset + base ---------- */
25
- *, *::before, *::after { box-sizing: border-box; }
26
- html, body { margin: 0; padding: 0; }
27
- body {
28
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
29
- font-size: 14px;
30
- line-height: 1.5;
31
- color: var(--text);
32
- background: var(--bg);
33
- -webkit-font-smoothing: antialiased;
34
- }
35
-
36
- :root {
37
- --bg: #f7f8fa;
38
- --surface: #ffffff;
39
- --surface-2: #fafbfc;
40
- --border: #e3e6ea;
41
- --border-strong: #cdd2d9;
42
- --text: #1a1f2e;
43
- --text-muted: #6b7280;
44
- --text-subtle: #9ca3af;
45
- --accent: #fa4616;
46
- --accent-light: #fff1ea;
47
- --accent-strong: #c93a12;
48
- --warn-bg: #fff8e1;
49
- --warn-border: #f59e0b;
50
- --warn-text: #92400e;
51
- --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
52
- --shadow-md: 0 6px 20px rgba(15, 23, 42, .08);
53
- --radius-sm: 4px;
54
- --radius-md: 8px;
55
- --radius-lg: 12px;
56
-
57
- /* Task type accents — colored left border + badge background tint */
58
- --t-action: #8b5cf6;
59
- --t-agent: #0891b2;
60
- --t-process: #2563eb;
61
- --t-rpa: #f59e0b;
62
- --t-api-workflow: #10b981;
63
- --t-function: #84cc16;
64
- --t-execute-connector-activity: #ec4899;
65
- --t-wait-for-connector: #6366f1;
66
- --t-external-agent: #d946ef;
67
- --t-external-workflow: #0ea5e9;
68
- --t-wait-for-timer: #6b7280;
69
- --t-case-management: #ef4444;
70
- }
71
-
72
- /* ---------- topbar ---------- */
73
- .topbar {
74
- position: sticky; top: 0; z-index: 30;
75
- display: grid;
76
- grid-template-columns: auto 1fr auto;
77
- gap: 16px;
78
- align-items: center;
79
- padding: 12px 24px;
80
- background: var(--surface);
81
- border-bottom: 1px solid var(--border);
82
- box-shadow: var(--shadow-sm);
83
- }
84
- .brand {
85
- display: flex; align-items: center; gap: 10px;
86
- font-weight: 600; font-size: 13px;
87
- color: var(--text-muted);
88
- text-transform: uppercase; letter-spacing: .04em;
89
- }
90
- .brand::before {
91
- content: ""; width: 8px; height: 8px; border-radius: 50%;
92
- background: var(--accent);
93
- }
94
- .case-title {
95
- font-weight: 600; font-size: 16px; color: var(--text);
96
- overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
97
- }
98
- .case-title small {
99
- font-weight: 400; font-size: 13px; color: var(--text-muted);
100
- margin-left: 8px;
101
- }
102
- .controls { display: flex; gap: 8px; align-items: center; }
103
- .controls input[type="search"] {
104
- width: 240px;
105
- padding: 7px 10px;
106
- border: 1px solid var(--border); border-radius: var(--radius-sm);
107
- font: inherit; color: var(--text);
108
- background: var(--surface);
109
- }
110
- .controls input[type="search"]:focus {
111
- outline: 2px solid var(--accent-light);
112
- border-color: var(--accent);
113
- }
114
- .controls button {
115
- padding: 7px 12px;
116
- background: var(--surface);
117
- border: 1px solid var(--border); border-radius: var(--radius-sm);
118
- font: inherit; color: var(--text);
119
- cursor: pointer;
120
- }
121
- .controls button:hover { background: var(--surface-2); border-color: var(--border-strong); }
122
- .controls button[aria-pressed="true"] {
123
- background: var(--accent); color: white; border-color: var(--accent);
124
- }
125
-
126
- /* ---------- layout ---------- */
127
- .layout {
128
- display: grid;
129
- grid-template-columns: 240px 1fr;
130
- min-height: calc(100vh - 57px);
131
- }
132
- .sidebar {
133
- position: sticky; top: 57px;
134
- align-self: start;
135
- height: calc(100vh - 57px);
136
- overflow-y: auto;
137
- padding: 20px 16px;
138
- border-right: 1px solid var(--border);
139
- background: var(--surface);
140
- }
141
- main { padding: 24px 32px 80px; max-width: 1100px; }
142
-
143
- /* ---------- toc ---------- */
144
- .toc h4 {
145
- margin: 0 0 8px;
146
- font-size: 11px; font-weight: 600; letter-spacing: .06em;
147
- color: var(--text-subtle); text-transform: uppercase;
148
- }
149
- .toc ul { list-style: none; padding: 0; margin: 0 0 16px; }
150
- .toc li { margin: 0; }
151
- .toc a {
152
- display: block;
153
- padding: 6px 8px;
154
- color: var(--text-muted);
155
- text-decoration: none;
156
- border-radius: var(--radius-sm);
157
- font-size: 13px;
158
- }
159
- .toc a:hover { color: var(--text); background: var(--surface-2); }
160
- .toc a.active { color: var(--accent); background: var(--accent-light); font-weight: 500; }
161
- .toc .toc-sub { margin-left: 12px; }
162
- .toc .toc-sub a { font-size: 12px; padding: 4px 8px; }
163
-
164
- /* ---------- sections ---------- */
165
- section { margin-bottom: 48px; scroll-margin-top: 80px; }
166
- section > h2 {
167
- margin: 0 0 16px;
168
- font-size: 20px; font-weight: 600; color: var(--text);
169
- padding-bottom: 8px;
170
- border-bottom: 2px solid var(--border);
171
- }
172
- section > h2 .count {
173
- font-size: 13px; font-weight: 400; color: var(--text-muted);
174
- margin-left: 8px;
175
- }
176
- h3 { font-size: 16px; font-weight: 600; margin: 24px 0 12px; }
177
- h4 { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 8px; }
178
-
179
- /* ---------- cards / tables ---------- */
180
- .card {
181
- background: var(--surface);
182
- border: 1px solid var(--border);
183
- border-radius: var(--radius-md);
184
- padding: 16px 20px;
185
- margin-bottom: 12px;
186
- box-shadow: var(--shadow-sm);
187
- }
188
- .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
189
- @media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
190
- .meta-row {
191
- display: flex; gap: 8px 16px; flex-wrap: wrap;
192
- font-size: 13px;
193
- }
194
- .meta-row .k { color: var(--text-muted); margin-right: 4px; }
195
- .meta-row .v { color: var(--text); font-weight: 500; }
196
-
197
- table {
198
- width: 100%;
199
- border-collapse: collapse;
200
- font-size: 13px;
201
- margin: 8px 0;
202
- }
203
- th, td {
204
- text-align: left;
205
- padding: 8px 10px;
206
- border-bottom: 1px solid var(--border);
207
- vertical-align: top;
208
- }
209
- th {
210
- font-weight: 600; color: var(--text-muted);
211
- background: var(--surface-2);
212
- font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
213
- }
214
- tr:last-child td { border-bottom: none; }
215
- td code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
216
-
217
- /* ---------- stage cards ---------- */
218
- .stage {
219
- background: var(--surface);
220
- border: 1px solid var(--border);
221
- border-radius: var(--radius-lg);
222
- margin-bottom: 16px;
223
- overflow: hidden;
224
- box-shadow: var(--shadow-sm);
225
- }
226
- .stage.collapsed .stage-body { display: none; }
227
- .stage-header {
228
- display: grid;
229
- grid-template-columns: auto 1fr auto;
230
- align-items: center;
231
- gap: 12px;
232
- padding: 14px 20px;
233
- cursor: pointer;
234
- user-select: none;
235
- background: var(--surface);
236
- }
237
- .stage-header:hover { background: var(--surface-2); }
238
- .stage-header .twirl {
239
- width: 16px; text-align: center;
240
- transition: transform .15s;
241
- color: var(--text-muted);
242
- }
243
- .stage.collapsed .twirl { transform: rotate(-90deg); }
244
- .stage-title {
245
- display: flex; align-items: baseline; gap: 8px;
246
- font-size: 16px; font-weight: 600;
247
- }
248
- .stage-title .seq {
249
- font-size: 12px; color: var(--text-subtle); font-weight: 400;
250
- font-variant-numeric: tabular-nums;
251
- }
252
- .stage-type {
253
- font-size: 11px; padding: 2px 8px; border-radius: 999px;
254
- background: var(--surface-2); color: var(--text-muted);
255
- text-transform: uppercase; letter-spacing: .03em;
256
- }
257
- .stage.exception .stage-type { background: #fef2f2; color: #b91c1c; }
258
- .stage-summary {
259
- display: flex; gap: 12px; flex-wrap: wrap;
260
- font-size: 12px; color: var(--text-muted);
261
- }
262
- .stage-summary .pill {
263
- padding: 2px 8px; border-radius: 999px;
264
- background: var(--surface-2); border: 1px solid var(--border);
265
- }
266
- .stage-body { padding: 4px 20px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
267
-
268
- /* ---------- task rows ---------- */
269
- .tasks { margin: 16px 0 0; }
270
- .task {
271
- display: grid;
272
- grid-template-columns: 28px 1fr auto;
273
- gap: 12px;
274
- align-items: center;
275
- padding: 10px 12px;
276
- background: var(--surface);
277
- border: 1px solid var(--border);
278
- border-left-width: 4px;
279
- border-radius: var(--radius-md);
280
- margin-bottom: 6px;
281
- cursor: pointer;
282
- transition: border-color .12s, transform .12s;
283
- }
284
- .task:hover { border-color: var(--border-strong); transform: translateX(2px); }
285
- .task .num {
286
- font-variant-numeric: tabular-nums;
287
- color: var(--text-subtle); font-size: 12px;
288
- text-align: right;
289
- }
290
- .task .name { font-weight: 500; }
291
- .task .meta {
292
- font-size: 12px; color: var(--text-muted);
293
- display: flex; gap: 8px; flex-wrap: wrap;
294
- }
295
- .task .badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
296
-
297
- /* per-type accent */
298
- .task[data-type="action"] { border-left-color: var(--t-action); }
299
- .task[data-type="agent"] { border-left-color: var(--t-agent); }
300
- .task[data-type="process"] { border-left-color: var(--t-process); }
301
- .task[data-type="rpa"] { border-left-color: var(--t-rpa); }
302
- .task[data-type="api-workflow"] { border-left-color: var(--t-api-workflow); }
303
- .task[data-type="function"] { border-left-color: var(--t-function); }
304
- .task[data-type="execute-connector-activity"] { border-left-color: var(--t-execute-connector-activity); }
305
- .task[data-type="external-agent"] { border-left-color: var(--t-external-agent); }
306
- .task[data-type="external-workflow"] { border-left-color: var(--t-external-workflow); }
307
- .task[data-type="wait-for-connector"] { border-left-color: var(--t-wait-for-connector); }
308
- .task[data-type="wait-for-timer"] { border-left-color: var(--t-wait-for-timer); }
309
- .task[data-type="case-management"] { border-left-color: var(--t-case-management); }
310
-
311
- /* ---------- badges ---------- */
312
- .badge {
313
- display: inline-flex; align-items: center;
314
- padding: 2px 8px; border-radius: 999px;
315
- font-size: 11px; font-weight: 500;
316
- background: var(--surface-2); color: var(--text-muted);
317
- border: 1px solid var(--border);
318
- white-space: nowrap;
319
- }
320
- .badge.type-action { background: color-mix(in srgb, var(--t-action) 12%, white); color: var(--t-action); border-color: color-mix(in srgb, var(--t-action) 25%, transparent); }
321
- .badge.type-agent { background: color-mix(in srgb, var(--t-agent) 12%, white); color: var(--t-agent); border-color: color-mix(in srgb, var(--t-agent) 25%, transparent); }
322
- .badge.type-process { background: color-mix(in srgb, var(--t-process) 12%, white); color: var(--t-process); border-color: color-mix(in srgb, var(--t-process) 25%, transparent); }
323
- .badge.type-rpa { background: color-mix(in srgb, var(--t-rpa) 12%, white); color: var(--t-rpa); border-color: color-mix(in srgb, var(--t-rpa) 25%, transparent); }
324
- .badge.type-api-workflow { background: color-mix(in srgb, var(--t-api-workflow) 12%, white); color: var(--t-api-workflow); border-color: color-mix(in srgb, var(--t-api-workflow) 25%, transparent); }
325
- .badge.type-function { background: color-mix(in srgb, var(--t-function) 12%, white); color: var(--t-function); border-color: color-mix(in srgb, var(--t-function) 25%, transparent); }
326
- .badge.type-execute-connector-activity { background: color-mix(in srgb, var(--t-execute-connector-activity) 12%, white); color: var(--t-execute-connector-activity); border-color: color-mix(in srgb, var(--t-execute-connector-activity) 25%, transparent); }
327
- .badge.type-external-agent { background: color-mix(in srgb, var(--t-external-agent) 12%, white); color: var(--t-external-agent); border-color: color-mix(in srgb, var(--t-external-agent) 25%, transparent); }
328
- .badge.type-external-workflow { background: color-mix(in srgb, var(--t-external-workflow) 12%, white); color: var(--t-external-workflow); border-color: color-mix(in srgb, var(--t-external-workflow) 25%, transparent); }
329
- .badge.type-wait-for-connector { background: color-mix(in srgb, var(--t-wait-for-connector) 12%, white); color: var(--t-wait-for-connector); border-color: color-mix(in srgb, var(--t-wait-for-connector) 25%, transparent); }
330
- .badge.type-wait-for-timer { background: color-mix(in srgb, var(--t-wait-for-timer) 15%, white); color: var(--t-wait-for-timer); border-color: color-mix(in srgb, var(--t-wait-for-timer) 30%, transparent); }
331
- .badge.type-case-management { background: color-mix(in srgb, var(--t-case-management) 12%, white); color: var(--t-case-management); border-color: color-mix(in srgb, var(--t-case-management) 25%, transparent); }
332
- .badge.unresolved {
333
- background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border);
334
- }
335
- .badge.persona { background: var(--accent-light); color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
336
- .badge.sla { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
337
- .badge.runonce { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
338
-
339
- /* filter pills (top of stages section) */
340
- .filters {
341
- display: flex; gap: 12px; flex-wrap: wrap;
342
- margin-bottom: 16px;
343
- padding: 12px 16px;
344
- background: var(--surface);
345
- border: 1px solid var(--border);
346
- border-radius: var(--radius-md);
347
- }
348
- .filter-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
349
- .filter-group .filter-label {
350
- font-size: 12px; color: var(--text-muted); font-weight: 500;
351
- text-transform: uppercase; letter-spacing: .04em;
352
- margin-right: 4px;
353
- }
354
- .filter-chip {
355
- padding: 4px 10px; border-radius: 999px;
356
- font-size: 12px;
357
- background: var(--surface-2); border: 1px solid var(--border);
358
- color: var(--text-muted);
359
- cursor: pointer; user-select: none;
360
- }
361
- .filter-chip[aria-pressed="true"] {
362
- background: var(--accent); color: white; border-color: var(--accent);
363
- }
364
- .filter-chip:hover:not([aria-pressed="true"]) { border-color: var(--border-strong); color: var(--text); }
365
-
366
- /* unresolved markers in body */
367
- .unresolved-text {
368
- background: var(--warn-bg); color: var(--warn-text);
369
- padding: 1px 5px; border-radius: var(--radius-sm);
370
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
371
- }
372
-
373
- /* schema-name tooltips */
374
- body.schema-on .schema-name {
375
- display: inline; color: var(--text-subtle);
376
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
377
- font-size: 11px;
378
- margin-left: 4px;
379
- }
380
- .schema-name { display: none; }
381
-
382
- /* warning banner */
383
- .banner-warn {
384
- background: var(--warn-bg);
385
- border: 1px solid var(--warn-border);
386
- color: var(--warn-text);
387
- padding: 12px 16px;
388
- border-radius: var(--radius-md);
389
- margin-bottom: 24px;
390
- font-size: 13px;
391
- }
392
- .banner-warn strong { font-weight: 600; }
393
-
394
- /* ---------- detail panel ---------- */
395
- .detail-panel {
396
- position: fixed; top: 0; right: 0; bottom: 0;
397
- width: 480px; max-width: 100vw;
398
- background: var(--surface);
399
- border-left: 1px solid var(--border);
400
- box-shadow: -8px 0 24px rgba(15, 23, 42, .12);
401
- transform: translateX(100%);
402
- transition: transform .2s ease-out;
403
- overflow-y: auto;
404
- z-index: 50;
405
- padding: 24px 28px 48px;
406
- }
407
- .detail-panel[data-open="true"] { transform: translateX(0); }
408
- .detail-panel .close {
409
- position: absolute; top: 12px; right: 12px;
410
- width: 32px; height: 32px;
411
- background: transparent; border: none; cursor: pointer;
412
- font-size: 22px; color: var(--text-muted);
413
- border-radius: var(--radius-sm);
414
- }
415
- .detail-panel .close:hover { background: var(--surface-2); color: var(--text); }
416
- .detail-panel h2 { font-size: 18px; margin: 0 0 4px; padding: 0; border: none; }
417
- .detail-panel .crumb { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
418
- .detail-panel .description { color: var(--text-muted); margin: 12px 0 16px; }
419
-
420
- /* ---------- flow diagram ---------- */
421
- .flow-wrap {
422
- background: var(--surface);
423
- border: 1px solid var(--border);
424
- border-radius: var(--radius-md);
425
- padding: 16px;
426
- margin-bottom: 16px;
427
- overflow-x: auto;
428
- box-shadow: var(--shadow-sm);
429
- }
430
- .flow-wrap-empty { color: var(--text-subtle); font-style: italic; padding: 8px 4px; }
431
- .flow-legend {
432
- display: flex; gap: 16px; flex-wrap: wrap;
433
- font-size: 11px; color: var(--text-muted);
434
- margin: 8px 4px 0;
435
- }
436
- .flow-legend .swatch {
437
- display: inline-block; width: 12px; height: 12px;
438
- border-radius: 3px; vertical-align: middle; margin-right: 6px;
439
- border: 1px solid var(--border-strong);
440
- }
441
- .flow-node-group { cursor: pointer; }
442
- .flow-node-group:hover .flow-node-rect { filter: brightness(0.96); }
443
- .flow-node-rect { transition: filter .12s; }
444
- .flow-node-active .flow-node-rect { stroke-width: 2.5; }
445
-
446
- /* ---------- print ---------- */
447
- @media print {
448
- .topbar, .sidebar, .detail-panel, .filters, .controls, #toggle-collapse-all { display: none !important; }
449
- .layout { grid-template-columns: 1fr; }
450
- .stage.collapsed .stage-body { display: block !important; }
451
- main { padding: 0; max-width: none; }
452
- .card, .stage, .task { break-inside: avoid; box-shadow: none; border-color: #ccc; }
453
- body { background: white; color: black; font-size: 11pt; }
454
- }
455
-
456
- /* ---------- responsive ---------- */
457
- @media (max-width: 768px) {
458
- .layout { grid-template-columns: 1fr; }
459
- .sidebar { display: none; }
460
- .controls input[type="search"] { width: 140px; }
461
- .detail-panel { width: 100vw; }
462
- }
463
- </style>
464
- </head>
465
- <body>
466
- <div class="topbar">
467
- <div class="brand">SDD Preview</div>
468
- <div class="case-title" id="case-title">—</div>
469
- <div class="controls">
470
- <input type="search" id="search" placeholder="Search stages, tasks, variables…" aria-label="Search">
471
- <button id="toggle-unresolved" aria-pressed="false" title="Show only items with unresolved markers">Unresolved only</button>
472
- <button id="toggle-schema" aria-pressed="false" title="Show schema field names">Schema view</button>
473
- <button id="toggle-collapse-all" title="Collapse or expand all stages">Collapse all</button>
474
- <button id="print" title="Print or save as PDF">Print</button>
475
- </div>
476
- </div>
477
-
478
- <div class="layout">
479
- <aside class="sidebar">
480
- <nav class="toc" id="toc" aria-label="Table of contents"></nav>
481
- </aside>
482
- <main id="main">
483
- <div id="banner-mount"></div>
484
- <section id="case-definition" data-section><h2>1. Case Definition</h2><div id="case-body"></div></section>
485
- <section id="stages-tasks" data-section><h2>2. Stages &amp; Tasks <span class="count" id="stage-count"></span></h2>
486
- <div id="flow-diagram"></div>
487
- <div class="filters" id="filters"></div>
488
- <div id="stages-body"></div>
489
- </section>
490
- <section id="personas" data-section><h2>3. Personas &amp; App Views</h2><div id="personas-body"></div></section>
491
- <section id="integrations" data-section><h2>4. Integrations</h2><div id="integrations-body"></div></section>
492
- </main>
493
- </div>
494
-
495
- <aside class="detail-panel" id="detail-panel" data-open="false" aria-hidden="true">
496
- <button class="close" id="close-detail" aria-label="Close detail panel">×</button>
497
- <div id="detail-body"></div>
498
- </aside>
499
-
500
- <!--
501
- SDD data — populated by the Phase 0 generator. Swap the sentinel token in
502
- the script tag below with a JSON object that matches this shape (fields
503
- marked optional may be omitted or set to null; unknown values render as
504
- "—" or are hidden by the renderer):
505
-
506
- {
507
- "case": {
508
- "name": string, // PascalCase
509
- "description": string,
510
- "prefix": string, // 2-4 UPPER (constant only)
511
- "identifierType": "constant" | "external",
512
- "identifierExpression": string | null, // external only: =vars.<id> or =js:`...`
513
- "sla": { "count": number, "unit": "h"|"d"|"w"|"m", "type": "Static"|"Variable" } | null,
514
- "slaEscalation": [{ "status": "At-Risk"|"Breached", "threshold": string, "action": string }],
515
- "variableSla": [{ "expression": string, "sla": number, "unit": string }],
516
- "triggers": [{ "type": string, "source": string, "config": string, "mappings": [{"from": string, "to": string}] }],
517
- "exitConditions": [{ "when": string, "if": string, "then": string, "marksComplete": "Yes"|"No", "displayName": string }],
518
- "variables": [{ "name": string, "type": string, "default": string, "description": string, "producedBy": string, "consumedBy": string[] }]
519
- },
520
- "stages": [
521
- {
522
- "name": string,
523
- "type": "Stage",
524
- "stageType": "primary" | "secondary" | null, // omit/null = primary, "secondary" = secondary/exception stage
525
- "description": string,
526
- "requiredForCompletion": boolean,
527
- "interrupting": boolean | null, // secondary stages only (stageType === "secondary")
528
- "entryConditions": [{ "when": string, "if": string, "interrupting": "Yes"|"No", "displayName": string }],
529
- "exitConditions": [{ "when": string, "if": string, "exitType": string, "marksComplete": "Yes"|"No", "displayName": string }],
530
- "sla": { "count": number, "unit": string, "atRiskPct": string, "atRiskAction": string, "breachAction": string } | null,
531
- "tasks": [
532
- {
533
- "name": string,
534
- "type": "action"|"agent"|"process"|"rpa"|"api-workflow"|"function"|"wait-for-timer"|"wait-for-connector"|"execute-connector-activity"|"external-agent"|"external-workflow"|"case-management",
535
- "required": boolean,
536
- "runOnlyOnce": boolean,
537
- "persona": string | null,
538
- "sla": { "count": number, "unit": string } | null,
539
- "description": string,
540
- "entryCondition": { "when": string, "if": string, "displayName": string },
541
- "details": { ... } // shape varies by type — see renderTaskDetail below
542
- }
543
- ]
544
- }
545
- ],
546
- "personas": [{ "name": string, "stageScope": string[]|"All", "permissions": string[], "description": string }],
547
- "appViews": [{ "app": string, "view": string, "persona": string, "purpose": string, "components": string }],
548
- "integrations": [{ "connector": string, "system": string, "authMethod": string, "operations": [{ "name": string, "method": string, "inputs": string, "outputs": string }], "usedByTasks": string[] }],
549
- "externalAgents": [{ "name": string, "serviceType": string, "endpoint": string, "usedByTasks": string[] }],
550
- "warningHeader": string | null // populated when soft-redirect was overridden
551
- }
552
- -->
553
- <script id="sdd-data" type="application/json">__SDD_DATA__</script>
554
-
555
- <script>
556
- (function () {
557
- "use strict";
558
-
559
- // ---------- data ----------
560
- let data;
561
- try {
562
- const raw = document.getElementById("sdd-data").textContent.trim();
563
- data = JSON.parse(raw);
564
- } catch (e) {
565
- document.getElementById("main").innerHTML =
566
- '<div class="banner-warn"><strong>Failed to load SDD data.</strong> ' +
567
- 'The <code>__SDD_DATA__</code> placeholder was not replaced with valid JSON. ' +
568
- 'Error: ' + (e && e.message ? e.message : String(e)) + '</div>';
569
- return;
570
- }
571
-
572
- // ---------- state ----------
573
- const state = {
574
- filters: { personas: new Set(), types: new Set() },
575
- unresolvedOnly: false,
576
- schemaOn: false,
577
- search: "",
578
- collapsedStages: new Set(),
579
- allCollapsed: false
580
- };
581
-
582
- // ---------- helpers ----------
583
- const $ = (sel, root) => (root || document).querySelector(sel);
584
- const $$ = (sel, root) => Array.from((root || document).querySelectorAll(sel));
585
- const el = (tag, attrs, children) => {
586
- const node = document.createElement(tag);
587
- if (attrs) for (const k in attrs) {
588
- if (k === "class") node.className = attrs[k];
589
- else if (k === "html") node.innerHTML = attrs[k];
590
- else if (k.startsWith("on") && typeof attrs[k] === "function") node.addEventListener(k.slice(2), attrs[k]);
591
- else if (k === "dataset" && attrs[k]) Object.assign(node.dataset, attrs[k]);
592
- else if (attrs[k] !== null && attrs[k] !== undefined) node.setAttribute(k, attrs[k]);
593
- }
594
- if (children) (Array.isArray(children) ? children : [children]).forEach(c => {
595
- if (c === null || c === undefined) return;
596
- node.appendChild(typeof c === "string" ? document.createTextNode(c) : c);
597
- });
598
- return node;
599
- };
600
- const txt = (s) => (s === null || s === undefined || s === "" ? "—" : String(s));
601
- const isUnresolved = (s) => typeof s === "string" && /<UNRESOLVED:/i.test(s);
602
- const escapeHtml = (s) => String(s).replace(/[&<>"']/g, c => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }[c]));
603
- const renderInline = (s) => {
604
- if (s === null || s === undefined || s === "") return "—";
605
- const escaped = escapeHtml(String(s));
606
- return escaped.replace(/&lt;UNRESOLVED:([^&]*?)&gt;/gi, (_, q) => `<span class="unresolved-text">&lt;UNRESOLVED:${q}&gt;</span>`);
607
- };
608
- const slug = (s) => String(s || "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
609
- const schemaTag = (name) => `<span class="schema-name">(${escapeHtml(name)})</span>`;
610
-
611
- function badge(label, cls) {
612
- return el("span", { class: "badge " + (cls || "") }, label);
613
- }
614
-
615
- function pluralize(n, single, plural) {
616
- return `${n} ${n === 1 ? single : (plural || single + "s")}`;
617
- }
618
-
619
- // ---------- title ----------
620
- function renderTitle() {
621
- const c = data.case || {};
622
- const t = $("#case-title");
623
- t.innerHTML = "";
624
- t.appendChild(document.createTextNode(c.name || "Untitled Case"));
625
- if (c.identifierType === "external" && c.identifierExpression) {
626
- const s = document.createElement("small");
627
- s.textContent = "id " + c.identifierExpression;
628
- t.appendChild(s);
629
- } else if (c.prefix) {
630
- const s = document.createElement("small");
631
- s.textContent = "prefix " + c.prefix;
632
- t.appendChild(s);
633
- }
634
- document.title = "SDD — " + (c.name || "Preview");
635
- }
636
-
637
- // ---------- warning banner ----------
638
- function renderBanner() {
639
- const mount = $("#banner-mount");
640
- mount.innerHTML = "";
641
- if (data.warningHeader) {
642
- mount.appendChild(el("div", { class: "banner-warn", html: "<strong>⚠ </strong>" + escapeHtml(data.warningHeader) }));
643
- }
644
- }
645
-
646
- // ---------- toc ----------
647
- function renderTOC() {
648
- const toc = $("#toc");
649
- toc.innerHTML = "";
650
- const groups = [
651
- { id: "case-definition", label: "1. Case Definition", subs: [] },
652
- {
653
- id: "stages-tasks", label: "2. Stages & Tasks",
654
- subs: (data.stages || []).map((s, i) => ({ id: "stage-" + slug(s.name) || "stage-" + i, label: `${i + 1}. ${s.name || "(unnamed)"}` }))
655
- },
656
- { id: "personas", label: "3. Personas & App Views", subs: [] },
657
- { id: "integrations", label: "4. Integrations", subs: [] }
658
- ];
659
- groups.forEach(g => {
660
- const sectionHeader = el("h4", null, g.label.split(". ")[0] + ". Section");
661
- if (g.id === "stages-tasks") sectionHeader.textContent = "Stages";
662
- else sectionHeader.textContent = g.label;
663
- const ul = el("ul");
664
- ul.appendChild(el("li", null, el("a", { href: "#" + g.id, "data-jump": g.id }, g.label)));
665
- if (g.subs.length) {
666
- const sub = el("ul", { class: "toc-sub" });
667
- g.subs.forEach(s => {
668
- sub.appendChild(el("li", null, el("a", { href: "#" + s.id, "data-jump": s.id }, s.label)));
669
- });
670
- ul.appendChild(sub);
671
- }
672
- toc.appendChild(ul);
673
- });
674
- // smooth scroll
675
- $$(".toc a").forEach(a => a.addEventListener("click", (e) => {
676
- const id = a.getAttribute("href").slice(1);
677
- const tgt = document.getElementById(id);
678
- if (tgt) { e.preventDefault(); tgt.scrollIntoView({ behavior: "smooth", block: "start" }); }
679
- }));
680
- }
681
-
682
- // ---------- case definition ----------
683
- function renderCase() {
684
- const c = data.case || {};
685
- const mount = $("#case-body");
686
- mount.innerHTML = "";
687
-
688
- const meta = el("div", { class: "card" });
689
- meta.appendChild(el("h3", null, "Metadata"));
690
- const rows = [
691
- ["Case Name", c.name],
692
- ["Description", c.description],
693
- ["Identifier", c.identifierType === "external"
694
- ? `${c.identifierExpression || "—"} (external)`
695
- : (c.prefix ? `${c.prefix} (${c.identifierType || "constant"})` : null)],
696
- ["Case-Level SLA", c.sla ? `${c.sla.count} ${c.sla.unit} — ${c.sla.type || "Static"}` : null]
697
- ];
698
- const tbl = el("table");
699
- rows.forEach(([k, v]) => {
700
- tbl.appendChild(el("tr", null, [el("th", { style: "width:180px" }, k), el("td", { html: renderInline(v) })]));
701
- });
702
- meta.appendChild(tbl);
703
- mount.appendChild(meta);
704
-
705
- if ((c.slaEscalation || []).length) {
706
- const card = el("div", { class: "card" });
707
- card.appendChild(el("h3", null, "SLA Escalation Rules"));
708
- const t = el("table");
709
- t.appendChild(el("tr", null, [el("th", null, "Status"), el("th", null, "Threshold"), el("th", null, "Action")]));
710
- c.slaEscalation.forEach(r => t.appendChild(el("tr", null, [el("td", { html: renderInline(r.status) }), el("td", { html: renderInline(r.threshold) }), el("td", { html: renderInline(r.action) })])));
711
- card.appendChild(t);
712
- mount.appendChild(card);
713
- }
714
-
715
- if ((c.variableSla || []).length) {
716
- const card = el("div", { class: "card" });
717
- card.appendChild(el("h3", null, "Variable SLA Rules"));
718
- const t = el("table");
719
- t.appendChild(el("tr", null, [el("th", null, "Expression"), el("th", null, "SLA"), el("th", null, "Unit")]));
720
- c.variableSla.forEach(r => t.appendChild(el("tr", null, [el("td", { html: '<code>' + escapeHtml(r.expression || "—") + '</code>' }), el("td", { html: renderInline(r.sla) }), el("td", { html: renderInline(r.unit) })])));
721
- card.appendChild(t);
722
- mount.appendChild(card);
723
- }
724
-
725
- if ((c.triggers || []).length) {
726
- const card = el("div", { class: "card" });
727
- card.appendChild(el("h3", null, "Triggers" + " " + schemaTag("triggers")));
728
- const t = el("table");
729
- t.appendChild(el("tr", null, [el("th", null, "Type"), el("th", null, "Source"), el("th", null, "Configuration"), el("th", null, "Mappings")]));
730
- c.triggers.forEach(tr => {
731
- const mapStr = (tr.mappings || []).map(m => `${m.from} → ${m.to}`).join("<br>") || "—";
732
- t.appendChild(el("tr", null, [
733
- el("td", { html: renderInline(tr.type) }),
734
- el("td", { html: renderInline(tr.source) }),
735
- el("td", { html: renderInline(tr.config) }),
736
- el("td", { html: mapStr })
737
- ]));
738
- });
739
- card.appendChild(t);
740
- mount.appendChild(card);
741
- }
742
-
743
- if ((c.exitConditions || []).length) {
744
- const card = el("div", { class: "card" });
745
- card.appendChild(el("h3", null, "Case Exit Conditions"));
746
- const t = el("table");
747
- t.appendChild(el("tr", null, [el("th", null, "WHEN"), el("th", null, "IF"), el("th", null, "THEN"), el("th", null, "Marks Case Complete" + schemaTag("markCaseComplete")), el("th", null, "Display Name")]));
748
- c.exitConditions.forEach(r => t.appendChild(el("tr", null, [
749
- el("td", { html: '<code>' + escapeHtml(r.when || "—") + '</code>' }),
750
- el("td", { html: '<code>' + escapeHtml(r.if || "—") + '</code>' }),
751
- el("td", { html: renderInline(r.then) }),
752
- el("td", { html: renderInline(r.marksComplete) }),
753
- el("td", { html: renderInline(r.displayName) })
754
- ])));
755
- card.appendChild(t);
756
- mount.appendChild(card);
757
- }
758
-
759
- if ((c.variables || []).length) {
760
- const card = el("div", { class: "card" });
761
- card.appendChild(el("h3", null, `Case Variables (${c.variables.length})`));
762
- const t = el("table");
763
- t.appendChild(el("tr", null, [el("th", null, "Variable"), el("th", null, "Type"), el("th", null, "Default"), el("th", null, "Description"), el("th", null, "Produced By"), el("th", null, "Consumed By")]));
764
- c.variables.forEach(v => t.appendChild(el("tr", null, [
765
- el("td", null, el("code", null, v.name || "—")),
766
- el("td", { html: renderInline(v.type) }),
767
- el("td", { html: renderInline(v.default) }),
768
- el("td", { html: renderInline(v.description) }),
769
- el("td", { html: renderInline(v.producedBy) }),
770
- el("td", { html: renderInline((v.consumedBy || []).join(", ") || "—") })
771
- ])));
772
- card.appendChild(t);
773
- mount.appendChild(card);
774
- }
775
- }
776
-
777
- // ---------- filters ----------
778
- function renderFilters() {
779
- const mount = $("#filters");
780
- mount.innerHTML = "";
781
-
782
- const allPersonas = new Set();
783
- const allTypes = new Set();
784
- (data.stages || []).forEach(s => (s.tasks || []).forEach(t => {
785
- if (t.persona) allPersonas.add(t.persona);
786
- if (t.type) allTypes.add(t.type);
787
- }));
788
-
789
- const personaGroup = el("div", { class: "filter-group" });
790
- personaGroup.appendChild(el("span", { class: "filter-label" }, "Persona:"));
791
- Array.from(allPersonas).sort().forEach(p => {
792
- const chip = el("span", { class: "filter-chip", "aria-pressed": "false", "data-persona": p }, p);
793
- chip.addEventListener("click", () => toggleSet(state.filters.personas, p, chip));
794
- personaGroup.appendChild(chip);
795
- });
796
- if (allPersonas.size === 0) personaGroup.appendChild(el("span", { class: "filter-chip", "aria-pressed": "false" }, "(none)"));
797
-
798
- const typeGroup = el("div", { class: "filter-group" });
799
- typeGroup.appendChild(el("span", { class: "filter-label" }, "Task type:"));
800
- Array.from(allTypes).sort().forEach(typ => {
801
- const chip = el("span", { class: "filter-chip", "aria-pressed": "false", "data-type": typ }, typ);
802
- chip.addEventListener("click", () => toggleSet(state.filters.types, typ, chip));
803
- typeGroup.appendChild(chip);
804
- });
805
-
806
- mount.appendChild(personaGroup);
807
- mount.appendChild(typeGroup);
808
- }
809
-
810
- function toggleSet(set, val, chip) {
811
- if (set.has(val)) { set.delete(val); chip.setAttribute("aria-pressed", "false"); }
812
- else { set.add(val); chip.setAttribute("aria-pressed", "true"); }
813
- applyFilters();
814
- }
815
-
816
- // ---------- flow diagram ----------
817
- function renderFlowDiagram() {
818
- const mount = $("#flow-diagram");
819
- mount.innerHTML = "";
820
- const stages = data.stages || [];
821
- const triggers = (data.case && data.case.triggers) || [];
822
- if (!stages.length) {
823
- mount.appendChild(el("div", { class: "flow-wrap flow-wrap-empty" }, "No stages to diagram."));
824
- return;
825
- }
826
-
827
- const wrap = el("div", { class: "flow-wrap" });
828
- mount.appendChild(wrap);
829
-
830
- // ----- build graph -----
831
- const triggerNodes = triggers.map((t, i) => ({
832
- id: "t-" + i, kind: "trigger",
833
- label: (t.type === "Manual" ? "Manual" : (t.source || t.type || "Trigger")),
834
- sub: t.type === "Manual" ? "manual" : (t.type || ""),
835
- level: 0
836
- }));
837
- const stageNodes = stages.map((s, i) => ({
838
- id: "s-" + i,
839
- kind: (s.stageType === "secondary" || s.type === "ExceptionStage") ? "exception" : "stage",
840
- label: s.name || "(unnamed)",
841
- sub: pluralize((s.tasks || []).length, "task") + (s.sla ? ` · SLA ${s.sla.count}${s.sla.unit}` : ""),
842
- stageIdx: i,
843
- level: -1,
844
- predecessors: []
845
- }));
846
- const allNodes = triggerNodes.concat(stageNodes);
847
- const byId = Object.create(null);
848
- allNodes.forEach(n => { byId[n.id] = n; });
849
-
850
- function findStageIdxByTaskName(taskName) {
851
- const lower = String(taskName || "").toLowerCase();
852
- for (let i = 0; i < stages.length; i++) {
853
- if ((stages[i].tasks || []).some(t => (t.name || "").toLowerCase() === lower)) return i;
854
- }
855
- return -1;
856
- }
857
- function findStageIdxByName(name) {
858
- const lower = String(name || "").toLowerCase();
859
- return stages.findIndex(s => (s.name || "").toLowerCase() === lower);
860
- }
861
-
862
- // resolve predecessors from entry conditions
863
- stageNodes.forEach((sn, i) => {
864
- const conds = stages[i].entryConditions || [];
865
- const preds = new Set();
866
- conds.forEach(c => {
867
- const when = String(c.when || "");
868
- if (/case-entered|adhoc/i.test(when)) {
869
- triggerNodes.forEach(t => preds.add(t.id));
870
- }
871
- const ms = when.match(/selected-stage-(?:completed|exited)\("([^"]+)"\)/i);
872
- if (ms) {
873
- const idx = findStageIdxByName(ms[1]);
874
- if (idx >= 0 && idx !== i) preds.add("s-" + idx);
875
- }
876
- const mt = when.match(/selected-tasks-completed\("([^"]+)"\)/i);
877
- if (mt) {
878
- const idx = findStageIdxByTaskName(mt[1]);
879
- if (idx >= 0 && idx !== i) preds.add("s-" + idx);
880
- }
881
- const mr = when.match(/required-stages-completed/i);
882
- if (mr) {
883
- stageNodes.forEach((other, oi) => {
884
- if (oi < i && other.kind !== "exception" && (stages[oi].requiredForCompletion !== false)) {
885
- preds.add(other.id);
886
- }
887
- });
888
- }
889
- });
890
- if (preds.size === 0) {
891
- if (i === 0) triggerNodes.forEach(t => preds.add(t.id));
892
- else preds.add("s-" + (i - 1));
893
- }
894
- sn.predecessors = Array.from(preds);
895
- });
896
-
897
- // compute levels — longest path from any trigger
898
- triggerNodes.forEach(t => { t.level = 0; });
899
- let changed = true, iters = 0;
900
- while (changed && iters < 100) {
901
- changed = false; iters++;
902
- stageNodes.forEach(sn => {
903
- let maxPred = -1;
904
- (sn.predecessors || []).forEach(pid => {
905
- const p = byId[pid];
906
- if (p && typeof p.level === "number" && p.level >= 0 && p.level > maxPred) maxPred = p.level;
907
- });
908
- const next = maxPred + 1;
909
- if (next !== sn.level) { sn.level = next; changed = true; }
910
- });
911
- }
912
- // any node still negative (cycle / orphan) → put at level 0
913
- allNodes.forEach(n => { if (n.level < 0) n.level = 0; });
914
-
915
- // group by level
916
- const byLevel = {};
917
- allNodes.forEach(n => { (byLevel[n.level] = byLevel[n.level] || []).push(n); });
918
- const levelKeys = Object.keys(byLevel).map(Number).sort((a, b) => a - b);
919
- // sort each level: stages before exceptions, original order otherwise
920
- levelKeys.forEach(lv => {
921
- byLevel[lv].sort((a, b) => {
922
- const ka = a.kind === "exception" ? 2 : (a.kind === "trigger" ? 0 : 1);
923
- const kb = b.kind === "exception" ? 2 : (b.kind === "trigger" ? 0 : 1);
924
- if (ka !== kb) return ka - kb;
925
- return (a.stageIdx !== undefined ? a.stageIdx : 0) - (b.stageIdx !== undefined ? b.stageIdx : 0);
926
- });
927
- });
928
-
929
- // layout constants
930
- const colW = 200, rowH = 78, nodeW = 168, nodeH = 56, padX = 24, padY = 24;
931
- const maxLevel = levelKeys[levelKeys.length - 1] || 0;
932
- const maxPerLevel = Math.max(1, ...levelKeys.map(k => byLevel[k].length));
933
- const svgW = (maxLevel + 1) * colW + padX * 2 + 20;
934
- const svgH = maxPerLevel * rowH + padY * 2 + 8;
935
-
936
- levelKeys.forEach(lv => {
937
- const col = byLevel[lv];
938
- // center the column vertically
939
- const usedH = col.length * rowH;
940
- const offset = (maxPerLevel * rowH - usedH) / 2;
941
- col.forEach((n, idx) => {
942
- n.x = padX + lv * colW;
943
- n.y = padY + offset + idx * rowH;
944
- });
945
- });
946
-
947
- const SVG_NS = "http://www.w3.org/2000/svg";
948
- const svg = document.createElementNS(SVG_NS, "svg");
949
- svg.setAttribute("viewBox", `0 0 ${svgW} ${svgH}`);
950
- svg.setAttribute("width", svgW);
951
- svg.setAttribute("height", svgH);
952
- svg.setAttribute("preserveAspectRatio", "xMidYMid meet");
953
- svg.setAttribute("role", "img");
954
- svg.setAttribute("aria-label", "Case flow diagram");
955
-
956
- // defs: arrow markers
957
- const defs = document.createElementNS(SVG_NS, "defs");
958
- defs.innerHTML =
959
- '<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto"><path d="M0,0 L10,5 L0,10 Z" fill="#9ca3af"/></marker>' +
960
- '<marker id="arrow-ex" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto"><path d="M0,0 L10,5 L0,10 Z" fill="#ef4444"/></marker>';
961
- svg.appendChild(defs);
962
-
963
- // edges
964
- const edgesGroup = document.createElementNS(SVG_NS, "g");
965
- edgesGroup.setAttribute("class", "flow-edges");
966
- stageNodes.forEach(n => {
967
- (n.predecessors || []).forEach(pid => {
968
- const p = byId[pid];
969
- if (!p) return;
970
- const x1 = p.x + nodeW;
971
- const y1 = p.y + nodeH / 2;
972
- const x2 = n.x;
973
- const y2 = n.y + nodeH / 2;
974
- const dx = Math.max(40, (x2 - x1) / 2);
975
- const path = document.createElementNS(SVG_NS, "path");
976
- const isExceptionEdge = n.kind === "exception";
977
- path.setAttribute("d", `M${x1},${y1} C${x1 + dx},${y1} ${x2 - dx},${y2} ${x2},${y2}`);
978
- path.setAttribute("fill", "none");
979
- path.setAttribute("stroke", isExceptionEdge ? "#ef4444" : "#9ca3af");
980
- path.setAttribute("stroke-width", "1.5");
981
- if (isExceptionEdge) path.setAttribute("stroke-dasharray", "5 4");
982
- path.setAttribute("marker-end", isExceptionEdge ? "url(#arrow-ex)" : "url(#arrow)");
983
- edgesGroup.appendChild(path);
984
- });
985
- });
986
- svg.appendChild(edgesGroup);
987
-
988
- // nodes
989
- allNodes.forEach(n => {
990
- const g = document.createElementNS(SVG_NS, "g");
991
- g.setAttribute("class", "flow-node-group");
992
- if (n.stageIdx !== undefined) g.setAttribute("data-stage-jump", "stage-" + slug(n.label));
993
-
994
- let fill = "#ffffff";
995
- let stroke = "#cdd2d9";
996
- if (n.kind === "trigger") { fill = "#fff1ea"; stroke = "#fa4616"; }
997
- if (n.kind === "exception") { fill = "#fef2f2"; stroke = "#ef4444"; }
998
-
999
- const rect = document.createElementNS(SVG_NS, "rect");
1000
- rect.setAttribute("class", "flow-node-rect");
1001
- rect.setAttribute("x", n.x);
1002
- rect.setAttribute("y", n.y);
1003
- rect.setAttribute("width", nodeW);
1004
- rect.setAttribute("height", nodeH);
1005
- rect.setAttribute("rx", 10);
1006
- rect.setAttribute("fill", fill);
1007
- rect.setAttribute("stroke", stroke);
1008
- rect.setAttribute("stroke-width", "1.5");
1009
- g.appendChild(rect);
1010
-
1011
- // type icon / glyph in top-left
1012
- const glyph = document.createElementNS(SVG_NS, "text");
1013
- glyph.setAttribute("x", n.x + 12);
1014
- glyph.setAttribute("y", n.y + 18);
1015
- glyph.setAttribute("font-size", "11");
1016
- glyph.setAttribute("fill", stroke);
1017
- glyph.setAttribute("font-weight", "600");
1018
- glyph.setAttribute("text-transform", "uppercase");
1019
- glyph.textContent = n.kind === "trigger" ? "TRIGGER" : (n.kind === "exception" ? "SECONDARY" : "STAGE");
1020
- g.appendChild(glyph);
1021
-
1022
- // label
1023
- const label = document.createElementNS(SVG_NS, "text");
1024
- label.setAttribute("x", n.x + 12);
1025
- label.setAttribute("y", n.y + 36);
1026
- label.setAttribute("font-size", "13");
1027
- label.setAttribute("font-weight", "600");
1028
- label.setAttribute("fill", "#1a1f2e");
1029
- label.textContent = n.label.length > 22 ? (n.label.slice(0, 21) + "…") : n.label;
1030
- g.appendChild(label);
1031
-
1032
- // sub-label
1033
- if (n.sub) {
1034
- const sub = document.createElementNS(SVG_NS, "text");
1035
- sub.setAttribute("x", n.x + 12);
1036
- sub.setAttribute("y", n.y + 50);
1037
- sub.setAttribute("font-size", "11");
1038
- sub.setAttribute("fill", "#6b7280");
1039
- sub.textContent = n.sub;
1040
- g.appendChild(sub);
1041
- }
1042
-
1043
- // tooltip
1044
- const title = document.createElementNS(SVG_NS, "title");
1045
- title.textContent = n.label + (n.sub ? " — " + n.sub : "");
1046
- g.appendChild(title);
1047
-
1048
- if (n.stageIdx !== undefined) {
1049
- g.addEventListener("click", () => {
1050
- const tgt = document.getElementById("stage-" + slug(n.label));
1051
- if (tgt) tgt.scrollIntoView({ behavior: "smooth", block: "start" });
1052
- });
1053
- }
1054
-
1055
- svg.appendChild(g);
1056
- });
1057
-
1058
- wrap.appendChild(svg);
1059
-
1060
- // legend
1061
- const legend = el("div", { class: "flow-legend" });
1062
- legend.innerHTML =
1063
- '<span><span class="swatch" style="background:#fff1ea;border-color:#fa4616"></span>Trigger</span>' +
1064
- '<span><span class="swatch" style="background:#ffffff;border-color:#cdd2d9"></span>Stage</span>' +
1065
- '<span><span class="swatch" style="background:#fef2f2;border-color:#ef4444"></span>Secondary stage</span>' +
1066
- '<span><span class="swatch" style="background:transparent;border-color:transparent;border-bottom:2px dashed #ef4444"></span>Interrupting edge</span>' +
1067
- '<span style="color:var(--text-subtle)">· Click a stage to jump to its detail card.</span>';
1068
- wrap.appendChild(legend);
1069
- }
1070
-
1071
- // ---------- stages ----------
1072
- function renderStages() {
1073
- const mount = $("#stages-body");
1074
- mount.innerHTML = "";
1075
- const stages = data.stages || [];
1076
- $("#stage-count").textContent = `(${pluralize(stages.length, "stage")})`;
1077
- stages.forEach((s, i) => mount.appendChild(renderStage(s, i)));
1078
- }
1079
-
1080
- function renderStage(stage, idx) {
1081
- const id = "stage-" + slug(stage.name) || "stage-" + idx;
1082
- const isException = stage.stageType === "secondary" || stage.type === "ExceptionStage";
1083
- const collapsed = state.collapsedStages.has(idx);
1084
- const root = el("div", {
1085
- class: "stage" + (isException ? " exception" : "") + (collapsed ? " collapsed" : ""),
1086
- id: id,
1087
- "data-stage-idx": idx
1088
- });
1089
-
1090
- const header = el("div", { class: "stage-header" });
1091
- header.appendChild(el("div", { class: "twirl" }, "▾"));
1092
-
1093
- const titleWrap = el("div");
1094
- const title = el("div", { class: "stage-title" }, [
1095
- el("span", { class: "seq" }, "Stage " + (idx + 1) + " ·"),
1096
- document.createTextNode(stage.name || "(unnamed)"),
1097
- el("span", { class: "stage-type" }, isException ? "Secondary" : "Stage")
1098
- ]);
1099
- titleWrap.appendChild(title);
1100
- const summary = el("div", { class: "stage-summary" });
1101
- summary.appendChild(el("span", { class: "pill" }, pluralize((stage.tasks || []).length, "task")));
1102
- if (stage.sla) summary.appendChild(el("span", { class: "pill" }, `SLA ${stage.sla.count}${stage.sla.unit}`));
1103
- summary.appendChild(el("span", { class: "pill" }, "Required: " + (stage.requiredForCompletion ? "Yes" : "No")));
1104
- if (stage.description) summary.appendChild(el("span", { class: "pill", style: "max-width:540px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap" }, stage.description));
1105
- titleWrap.appendChild(summary);
1106
- header.appendChild(titleWrap);
1107
-
1108
- header.appendChild(el("div", { class: "stage-toggle-spacer" }));
1109
-
1110
- header.addEventListener("click", () => {
1111
- root.classList.toggle("collapsed");
1112
- if (root.classList.contains("collapsed")) state.collapsedStages.add(idx);
1113
- else state.collapsedStages.delete(idx);
1114
- });
1115
- root.appendChild(header);
1116
-
1117
- const body = el("div", { class: "stage-body" });
1118
-
1119
- if (stage.description) body.appendChild(el("p", { html: renderInline(stage.description), style: "color:var(--text-muted);margin:8px 0 12px" }));
1120
-
1121
- if ((stage.entryConditions || []).length) {
1122
- body.appendChild(el("h4", null, "Entry"));
1123
- const t = el("table");
1124
- t.appendChild(el("tr", null, [el("th", null, "WHEN"), el("th", null, "IF"), el("th", null, "Interrupting"), el("th", null, "Display Name")]));
1125
- stage.entryConditions.forEach(c => t.appendChild(el("tr", null, [
1126
- el("td", { html: '<code>' + escapeHtml(c.when || "—") + '</code>' }),
1127
- el("td", { html: '<code>' + escapeHtml(c.if || "—") + '</code>' }),
1128
- el("td", { html: renderInline(c.interrupting) }),
1129
- el("td", { html: renderInline(c.displayName) })
1130
- ])));
1131
- body.appendChild(t);
1132
- }
1133
-
1134
- if ((stage.exitConditions || []).length) {
1135
- body.appendChild(el("h4", null, "Exit"));
1136
- const t = el("table");
1137
- t.appendChild(el("tr", null, [el("th", null, "WHEN"), el("th", null, "IF"), el("th", null, "Exit Type"), el("th", null, "Marks Stage Complete" + schemaTag("markStageComplete")), el("th", null, "Display Name")]));
1138
- stage.exitConditions.forEach(c => t.appendChild(el("tr", null, [
1139
- el("td", { html: '<code>' + escapeHtml(c.when || "—") + '</code>' }),
1140
- el("td", { html: '<code>' + escapeHtml(c.if || "—") + '</code>' }),
1141
- el("td", { html: renderInline(c.exitType) }),
1142
- el("td", { html: renderInline(c.marksComplete) }),
1143
- el("td", { html: renderInline(c.displayName) })
1144
- ])));
1145
- body.appendChild(t);
1146
- }
1147
-
1148
- if (stage.sla) {
1149
- body.appendChild(el("h4", null, "Stage SLA"));
1150
- const t = el("table");
1151
- t.appendChild(el("tr", null, [el("th", null, "SLA"), el("th", null, "Unit"), el("th", null, "At-Risk"), el("th", null, "At-Risk Action"), el("th", null, "Breach Action")]));
1152
- t.appendChild(el("tr", null, [
1153
- el("td", { html: renderInline(stage.sla.count) }),
1154
- el("td", { html: renderInline(stage.sla.unit) }),
1155
- el("td", { html: renderInline(stage.sla.atRiskPct) }),
1156
- el("td", { html: renderInline(stage.sla.atRiskAction) }),
1157
- el("td", { html: renderInline(stage.sla.breachAction) })
1158
- ]));
1159
- body.appendChild(t);
1160
- }
1161
-
1162
- body.appendChild(el("h4", null, "Tasks"));
1163
- const tasks = el("div", { class: "tasks" });
1164
- (stage.tasks || []).forEach((task, ti) => tasks.appendChild(renderTaskRow(task, idx, ti)));
1165
- if ((stage.tasks || []).length === 0) tasks.appendChild(el("div", { style: "color:var(--text-subtle);font-style:italic" }, "No tasks defined."));
1166
- body.appendChild(tasks);
1167
-
1168
- root.appendChild(body);
1169
- return root;
1170
- }
1171
-
1172
- function renderTaskRow(task, stageIdx, taskIdx) {
1173
- const hasUnresolved = isUnresolved(task.name) || isUnresolved(task.persona) || isUnresolved(JSON.stringify(task.details || {}));
1174
- const row = el("div", {
1175
- class: "task",
1176
- "data-type": task.type || "process",
1177
- "data-task-idx": taskIdx,
1178
- "data-stage-idx": stageIdx,
1179
- "data-persona": task.persona || "",
1180
- "data-unresolved": hasUnresolved ? "true" : "false",
1181
- "data-search-text": [task.name, task.type, task.persona, task.description].filter(Boolean).join(" ").toLowerCase()
1182
- });
1183
- row.appendChild(el("div", { class: "num" }, String(taskIdx + 1)));
1184
-
1185
- const middle = el("div");
1186
- middle.appendChild(el("div", { class: "name", html: renderInline(task.name) }));
1187
- const meta = el("div", { class: "meta" });
1188
- if (task.persona) meta.appendChild(el("span", null, "👤 " + task.persona));
1189
- if (task.required) meta.appendChild(el("span", null, "Required"));
1190
- if (task.runOnlyOnce) meta.appendChild(el("span", null, "Run once"));
1191
- if (task.sla) meta.appendChild(el("span", null, `SLA ${task.sla.count}${task.sla.unit}`));
1192
- middle.appendChild(meta);
1193
- row.appendChild(middle);
1194
-
1195
- const badges = el("div", { class: "badges" });
1196
- if (task.type) badges.appendChild(badge(task.type, "type-" + task.type));
1197
- if (hasUnresolved) badges.appendChild(badge("UNRESOLVED", "unresolved"));
1198
- row.appendChild(badges);
1199
-
1200
- row.addEventListener("click", () => openDetail(stageIdx, taskIdx));
1201
- return row;
1202
- }
1203
-
1204
- // ---------- personas & app views ----------
1205
- function renderPersonas() {
1206
- const mount = $("#personas-body");
1207
- mount.innerHTML = "";
1208
-
1209
- if ((data.personas || []).length) {
1210
- const card = el("div", { class: "card" });
1211
- card.appendChild(el("h3", null, "Personas"));
1212
- const t = el("table");
1213
- t.appendChild(el("tr", null, [el("th", null, "Persona"), el("th", null, "Stage Scope"), el("th", null, "Permissions"), el("th", null, "Description")]));
1214
- data.personas.forEach(p => t.appendChild(el("tr", null, [
1215
- el("td", null, el("strong", null, p.name || "—")),
1216
- el("td", { html: renderInline(Array.isArray(p.stageScope) ? p.stageScope.join(", ") : p.stageScope) }),
1217
- el("td", { html: renderInline((p.permissions || []).join(", ")) }),
1218
- el("td", { html: renderInline(p.description) })
1219
- ])));
1220
- card.appendChild(t);
1221
- mount.appendChild(card);
1222
- }
1223
-
1224
- if ((data.appViews || []).length) {
1225
- const card = el("div", { class: "card" });
1226
- card.appendChild(el("h3", null, "Process App Views"));
1227
- const t = el("table");
1228
- t.appendChild(el("tr", null, [el("th", null, "App"), el("th", null, "View"), el("th", null, "Persona"), el("th", null, "Purpose"), el("th", null, "Key Components")]));
1229
- data.appViews.forEach(v => t.appendChild(el("tr", null, [
1230
- el("td", { html: renderInline(v.app) }),
1231
- el("td", { html: renderInline(v.view) }),
1232
- el("td", { html: renderInline(v.persona) }),
1233
- el("td", { html: renderInline(v.purpose) }),
1234
- el("td", { html: renderInline(v.components) })
1235
- ])));
1236
- card.appendChild(t);
1237
- mount.appendChild(card);
1238
- }
1239
-
1240
- if (!(data.personas || []).length && !(data.appViews || []).length) {
1241
- mount.appendChild(el("div", { class: "card", style: "color:var(--text-subtle);font-style:italic" }, "No personas or app views defined."));
1242
- }
1243
- }
1244
-
1245
- // ---------- integrations ----------
1246
- function renderIntegrations() {
1247
- const mount = $("#integrations-body");
1248
- mount.innerHTML = "";
1249
-
1250
- if ((data.integrations || []).length) {
1251
- const card = el("div", { class: "card" });
1252
- card.appendChild(el("h3", null, "Integration Service Connectors"));
1253
- const t = el("table");
1254
- t.appendChild(el("tr", null, [el("th", null, "Connector"), el("th", null, "System"), el("th", null, "Auth"), el("th", null, "Operations"), el("th", null, "Used By Tasks")]));
1255
- data.integrations.forEach(intg => t.appendChild(el("tr", null, [
1256
- el("td", null, el("strong", null, intg.connector || "—")),
1257
- el("td", { html: renderInline(intg.system) }),
1258
- el("td", { html: renderInline(intg.authMethod) }),
1259
- el("td", { html: renderInline((intg.operations || []).map(o => o.name).join(", ")) }),
1260
- el("td", { html: renderInline((intg.usedByTasks || []).join(", ")) })
1261
- ])));
1262
- card.appendChild(t);
1263
- mount.appendChild(card);
1264
-
1265
- // Per-connector operation detail
1266
- data.integrations.forEach(intg => {
1267
- if (!(intg.operations || []).length) return;
1268
- const c = el("div", { class: "card" });
1269
- c.appendChild(el("h3", null, intg.connector + " — Operations"));
1270
- const tt = el("table");
1271
- tt.appendChild(el("tr", null, [el("th", null, "Operation"), el("th", null, "Method"), el("th", null, "Inputs"), el("th", null, "Outputs")]));
1272
- intg.operations.forEach(o => tt.appendChild(el("tr", null, [
1273
- el("td", { html: renderInline(o.name) }),
1274
- el("td", { html: renderInline(o.method) }),
1275
- el("td", { html: '<code>' + escapeHtml(o.inputs || "—") + '</code>' }),
1276
- el("td", { html: '<code>' + escapeHtml(o.outputs || "—") + '</code>' })
1277
- ])));
1278
- c.appendChild(tt);
1279
- mount.appendChild(c);
1280
- });
1281
- }
1282
-
1283
- if ((data.externalAgents || []).length) {
1284
- const card = el("div", { class: "card" });
1285
- card.appendChild(el("h3", null, "External Agents"));
1286
- const t = el("table");
1287
- t.appendChild(el("tr", null, [el("th", null, "Agent"), el("th", null, "Service Type"), el("th", null, "Endpoint"), el("th", null, "Used By Tasks")]));
1288
- data.externalAgents.forEach(a => t.appendChild(el("tr", null, [
1289
- el("td", null, el("strong", null, a.name || "—")),
1290
- el("td", { html: renderInline(a.serviceType) }),
1291
- el("td", { html: '<code>' + escapeHtml(a.endpoint || "—") + '</code>' }),
1292
- el("td", { html: renderInline((a.usedByTasks || []).join(", ")) })
1293
- ])));
1294
- card.appendChild(t);
1295
- mount.appendChild(card);
1296
- }
1297
-
1298
- if (!(data.integrations || []).length && !(data.externalAgents || []).length) {
1299
- mount.appendChild(el("div", { class: "card", style: "color:var(--text-subtle);font-style:italic" }, "No integrations defined."));
1300
- }
1301
- }
1302
-
1303
- // ---------- task detail panel ----------
1304
- function openDetail(stageIdx, taskIdx) {
1305
- const stage = (data.stages || [])[stageIdx];
1306
- if (!stage) return;
1307
- const task = (stage.tasks || [])[taskIdx];
1308
- if (!task) return;
1309
-
1310
- const body = $("#detail-body");
1311
- body.innerHTML = "";
1312
-
1313
- body.appendChild(el("div", { class: "crumb" }, `Stage ${stageIdx + 1} · ${stage.name || ""}`));
1314
- body.appendChild(el("h2", { html: renderInline(task.name) }));
1315
- const top = el("div", { class: "meta-row", style: "margin: 6px 0 16px" });
1316
- if (task.type) top.appendChild(badge(task.type, "type-" + task.type));
1317
- if (task.persona) top.appendChild(badge("👤 " + task.persona, "persona"));
1318
- if (task.sla) top.appendChild(badge(`SLA ${task.sla.count}${task.sla.unit}`, "sla"));
1319
- if (task.runOnlyOnce) top.appendChild(badge("Run once", "runonce"));
1320
- if (task.required === false) top.appendChild(badge("Optional"));
1321
- body.appendChild(top);
1322
-
1323
- if (task.description) body.appendChild(el("div", { class: "description", html: renderInline(task.description) }));
1324
-
1325
- if (task.entryCondition) {
1326
- body.appendChild(el("h4", null, "Entry condition"));
1327
- const t = el("table");
1328
- t.appendChild(el("tr", null, [el("th", null, "WHEN"), el("th", null, "IF"), el("th", null, "Display Name")]));
1329
- t.appendChild(el("tr", null, [
1330
- el("td", { html: '<code>' + escapeHtml(task.entryCondition.when || "—") + '</code>' }),
1331
- el("td", { html: '<code>' + escapeHtml(task.entryCondition.if || "—") + '</code>' }),
1332
- el("td", { html: renderInline(task.entryCondition.displayName) })
1333
- ]));
1334
- body.appendChild(t);
1335
- }
1336
-
1337
- renderTaskDetail(body, task);
1338
-
1339
- const panel = $("#detail-panel");
1340
- panel.setAttribute("data-open", "true");
1341
- panel.setAttribute("aria-hidden", "false");
1342
- }
1343
-
1344
- function renderTaskDetail(mount, task) {
1345
- const d = task.details || {};
1346
-
1347
- function ioTable(label, rows, withBinding) {
1348
- if (!rows || !rows.length) return;
1349
- mount.appendChild(el("h4", null, label));
1350
- const t = el("table");
1351
- const headers = withBinding === "out"
1352
- ? [el("th", null, "Field"), el("th", null, "Type"), el("th", null, "→ Binding")]
1353
- : withBinding === "in"
1354
- ? [el("th", null, "Field"), el("th", null, "Type"), el("th", null, "Binding"), el("th", null, "Required")]
1355
- : [el("th", null, "Field"), el("th", null, "Type"), el("th", null, "Binding")];
1356
- t.appendChild(el("tr", null, headers));
1357
- rows.forEach(r => {
1358
- const cells = [
1359
- el("td", { html: '<code>' + escapeHtml(r.field || r.name || "—") + '</code>' }),
1360
- el("td", { html: renderInline(r.type) }),
1361
- el("td", { html: renderInline(r.binding) })
1362
- ];
1363
- if (withBinding === "in") cells.push(el("td", { html: renderInline(r.required) }));
1364
- t.appendChild(el("tr", null, cells));
1365
- });
1366
- mount.appendChild(t);
1367
- }
1368
-
1369
- switch (task.type) {
1370
- case "action":
1371
- if (d.hitlImplementation) mount.appendChild(el("div", { class: "meta-row", style: "margin:8px 0" }, [
1372
- el("span", null, [el("span", { class: "k" }, "HITL:"), el("span", { class: "v" }, " " + d.hitlImplementation)])
1373
- ]));
1374
- ioTable("Input schema", d.inputs, "in");
1375
- ioTable("Output schema", d.outputs, "out");
1376
- if ((d.actions || []).length) {
1377
- mount.appendChild(el("h4", null, "Actions"));
1378
- const t = el("table");
1379
- t.appendChild(el("tr", null, [el("th", null, "Button"), el("th", null, "Maps To"), el("th", null, "Behavior")]));
1380
- d.actions.forEach(a => t.appendChild(el("tr", null, [
1381
- el("td", { html: renderInline(a.button) }),
1382
- el("td", { html: '<code>' + escapeHtml(a.mapsTo || "—") + '</code>' }),
1383
- el("td", { html: renderInline(a.behavior) })
1384
- ])));
1385
- mount.appendChild(t);
1386
- }
1387
- break;
1388
- case "wait-for-connector":
1389
- case "execute-connector-activity":
1390
- case "external-agent":
1391
- case "external-workflow":
1392
- mount.appendChild(el("div", { class: "meta-row", style: "margin:8px 0 12px" }, [
1393
- d.connector ? el("span", null, [el("span", { class: "k" }, "Connector:"), el("span", { class: "v" }, " " + d.connector)]) : null,
1394
- d.connection ? el("span", null, [el("span", { class: "k" }, "Connection:"), el("span", { class: "v" }, " " + d.connection)]) : null,
1395
- d.authMethod ? el("span", null, [el("span", { class: "k" }, "Auth:"), el("span", { class: "v" }, " " + d.authMethod)]) : null,
1396
- d.endpoint ? el("span", null, [el("span", { class: "k" }, "Endpoint:"), el("span", { class: "v" }, " " + d.endpoint)]) : null,
1397
- d.operation ? el("span", null, [el("span", { class: "k" }, "Operation:"), el("span", { class: "v" }, " " + d.operation)]) : null,
1398
- d.trigger ? el("span", null, [el("span", { class: "k" }, "Trigger:"), el("span", { class: "v" }, " " + d.trigger)]) : null
1399
- ].filter(Boolean)));
1400
- ioTable("Inputs", d.inputs);
1401
- ioTable("Outputs", d.outputs, "out");
1402
- break;
1403
- case "wait-for-timer":
1404
- mount.appendChild(el("div", { class: "meta-row", style: "margin:8px 0" }, [
1405
- d.timer ? el("span", null, [el("span", { class: "k" }, "Timer:"), el("span", { class: "v" }, " " + d.timer)]) : null,
1406
- d.value ? el("span", null, [el("span", { class: "k" }, "Value:"), el("span", { class: "v" }, " "), el("code", null, d.value)]) : null
1407
- ].filter(Boolean)));
1408
- break;
1409
- case "case-management":
1410
- mount.appendChild(el("div", { class: "meta-row", style: "margin:8px 0" }, [
1411
- d.childCase ? el("span", null, [el("span", { class: "k" }, "Child Case:"), el("span", { class: "v" }, " " + d.childCase)]) : null,
1412
- d.waitForCompletion !== undefined ? el("span", null, [el("span", { class: "k" }, "Wait for completion:"), el("span", { class: "v" }, " " + (d.waitForCompletion ? "Yes" : "No"))]) : null
1413
- ].filter(Boolean)));
1414
- if ((d.dataIn || []).length) {
1415
- mount.appendChild(el("h4", null, "Data passed (parent → child)"));
1416
- const t = el("table"); t.appendChild(el("tr", null, [el("th", null, "Parent variable"), el("th", null, "Child variable")]));
1417
- d.dataIn.forEach(r => t.appendChild(el("tr", null, [el("td", { html: renderInline(r.parent) }), el("td", { html: renderInline(r.child) })])));
1418
- mount.appendChild(t);
1419
- }
1420
- if ((d.dataOut || []).length) {
1421
- mount.appendChild(el("h4", null, "Data returned (child → parent)"));
1422
- const t = el("table"); t.appendChild(el("tr", null, [el("th", null, "Child variable"), el("th", null, "Parent variable")]));
1423
- d.dataOut.forEach(r => t.appendChild(el("tr", null, [el("td", { html: renderInline(r.child) }), el("td", { html: renderInline(r.parent) })])));
1424
- mount.appendChild(t);
1425
- }
1426
- break;
1427
- default:
1428
- // process / agent / rpa / api-workflow / function
1429
- ioTable("Inputs", d.inputs);
1430
- ioTable("Outputs", d.outputs, "out");
1431
- }
1432
- }
1433
-
1434
- function closeDetail() {
1435
- const panel = $("#detail-panel");
1436
- panel.setAttribute("data-open", "false");
1437
- panel.setAttribute("aria-hidden", "true");
1438
- }
1439
-
1440
- // ---------- filtering & search ----------
1441
- function applyFilters() {
1442
- const personas = state.filters.personas;
1443
- const types = state.filters.types;
1444
- const search = (state.search || "").toLowerCase().trim();
1445
- const unresolvedOnly = state.unresolvedOnly;
1446
-
1447
- $$(".stage").forEach(stageEl => {
1448
- const tasks = $$(".task", stageEl);
1449
- let visibleTasks = 0;
1450
- tasks.forEach(t => {
1451
- const taskPersona = t.getAttribute("data-persona") || "";
1452
- const taskType = t.getAttribute("data-type") || "";
1453
- const taskUnresolved = t.getAttribute("data-unresolved") === "true";
1454
- const taskText = t.getAttribute("data-search-text") || "";
1455
-
1456
- const personaOk = personas.size === 0 || personas.has(taskPersona);
1457
- const typeOk = types.size === 0 || types.has(taskType);
1458
- const unresolvedOk = !unresolvedOnly || taskUnresolved;
1459
- const searchOk = !search || taskText.includes(search);
1460
-
1461
- const ok = personaOk && typeOk && unresolvedOk && searchOk;
1462
- t.style.display = ok ? "" : "none";
1463
- if (ok) visibleTasks++;
1464
- });
1465
-
1466
- // hide stage entirely if filters + search rule out all its tasks AND stage name doesn't match search
1467
- const stageName = (stageEl.querySelector(".stage-title")?.textContent || "").toLowerCase();
1468
- const stageMatches = !search || stageName.includes(search);
1469
- stageEl.style.display = (visibleTasks > 0 || (stageMatches && !unresolvedOnly && personas.size === 0 && types.size === 0)) ? "" : "none";
1470
- });
1471
- }
1472
-
1473
- // ---------- listeners ----------
1474
- function attachListeners() {
1475
- $("#search").addEventListener("input", (e) => { state.search = e.target.value; applyFilters(); });
1476
- $("#toggle-unresolved").addEventListener("click", (e) => {
1477
- state.unresolvedOnly = !state.unresolvedOnly;
1478
- e.currentTarget.setAttribute("aria-pressed", String(state.unresolvedOnly));
1479
- applyFilters();
1480
- });
1481
- $("#toggle-schema").addEventListener("click", (e) => {
1482
- state.schemaOn = !state.schemaOn;
1483
- e.currentTarget.setAttribute("aria-pressed", String(state.schemaOn));
1484
- document.body.classList.toggle("schema-on", state.schemaOn);
1485
- });
1486
- $("#toggle-collapse-all").addEventListener("click", (e) => {
1487
- state.allCollapsed = !state.allCollapsed;
1488
- e.currentTarget.textContent = state.allCollapsed ? "Expand all" : "Collapse all";
1489
- $$(".stage").forEach((s, i) => {
1490
- if (state.allCollapsed) { s.classList.add("collapsed"); state.collapsedStages.add(i); }
1491
- else { s.classList.remove("collapsed"); state.collapsedStages.delete(i); }
1492
- });
1493
- });
1494
- $("#print").addEventListener("click", () => window.print());
1495
- $("#close-detail").addEventListener("click", closeDetail);
1496
- document.addEventListener("keydown", (e) => { if (e.key === "Escape") closeDetail(); });
1497
-
1498
- // active TOC link on scroll
1499
- const sections = $$("section[data-section]");
1500
- const tocLinks = $$(".toc a[data-jump]");
1501
- const obs = new IntersectionObserver((entries) => {
1502
- entries.forEach(en => {
1503
- if (en.isIntersecting) {
1504
- const id = en.target.id;
1505
- tocLinks.forEach(a => a.classList.toggle("active", a.getAttribute("data-jump") === id));
1506
- }
1507
- });
1508
- }, { rootMargin: "-40% 0px -55% 0px", threshold: 0 });
1509
- sections.forEach(s => obs.observe(s));
1510
- }
1511
-
1512
- // ---------- init ----------
1513
- function renderAll() {
1514
- renderTitle();
1515
- renderBanner();
1516
- renderTOC();
1517
- renderCase();
1518
- renderFlowDiagram();
1519
- renderFilters();
1520
- renderStages();
1521
- renderPersonas();
1522
- renderIntegrations();
1523
- attachListeners();
1524
- }
1525
-
1526
- renderAll();
1527
- })();
1528
- </script>
1529
- </body>
1530
- </html>