@kinqs/brainrouter-mcp-server 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +144 -0
- package/README.md +56 -0
- package/agents/README.md +120 -0
- package/agents/code-reviewer.md +97 -0
- package/agents/security-auditor.md +101 -0
- package/agents/test-engineer.md +95 -0
- package/dist/__tests__/agent_mode.test.d.ts +1 -0
- package/dist/__tests__/api-routes.test.d.ts +1 -0
- package/dist/__tests__/api-routes.test.js +170 -0
- package/dist/__tests__/crypto.test.d.ts +1 -0
- package/dist/__tests__/crypto.test.js +28 -0
- package/dist/__tests__/host-integrations.test.d.ts +1 -0
- package/dist/__tests__/host-integrations.test.js +82 -0
- package/dist/__tests__/integration.test.d.ts +1 -0
- package/dist/__tests__/integration.test.js +50 -0
- package/dist/__tests__/loader.test.d.ts +1 -0
- package/dist/__tests__/loader.test.js +89 -0
- package/dist/__tests__/neural-spark.test.d.ts +1 -0
- package/dist/__tests__/neural-spark.test.js +112 -0
- package/dist/__tests__/pagination.test.d.ts +1 -0
- package/dist/__tests__/pagination.test.js +23 -0
- package/dist/__tests__/redaction.test.d.ts +1 -0
- package/dist/__tests__/redaction.test.js +17 -0
- package/dist/__tests__/registry.test.d.ts +1 -0
- package/dist/__tests__/registry.test.js +56 -0
- package/dist/__tests__/retry.test.d.ts +1 -0
- package/dist/__tests__/retry.test.js +30 -0
- package/dist/__tests__/skill-activation.test.d.ts +1 -0
- package/dist/__tests__/skill-activation.test.js +112 -0
- package/dist/__tests__/working-memory.test.d.ts +1 -0
- package/dist/__tests__/working-memory.test.js +200 -0
- package/dist/__tests__/workspace-paths.test.d.ts +1 -0
- package/dist/__tests__/workspace-paths.test.js +56 -0
- package/dist/__tests__/writer.test.d.ts +1 -0
- package/dist/__tests__/writer.test.js +94 -0
- package/dist/api/auth/crypto.d.ts +4 -0
- package/dist/api/auth/crypto.js +54 -0
- package/dist/api/middleware/auth.d.ts +12 -0
- package/dist/api/middleware/auth.js +90 -0
- package/dist/api/pagination.d.ts +18 -0
- package/dist/api/pagination.js +32 -0
- package/dist/api/routes/auth.d.ts +1 -0
- package/dist/api/routes/auth.js +130 -0
- package/dist/api/routes/chat-completions.d.ts +7 -0
- package/dist/api/routes/chat-completions.js +474 -0
- package/dist/api/routes/contradictions.d.ts +1 -0
- package/dist/api/routes/contradictions.js +28 -0
- package/dist/api/routes/evidence.d.ts +1 -0
- package/dist/api/routes/evidence.js +59 -0
- package/dist/api/routes/governance.d.ts +1 -0
- package/dist/api/routes/governance.js +95 -0
- package/dist/api/routes/graph.d.ts +1 -0
- package/dist/api/routes/graph.js +25 -0
- package/dist/api/routes/hooks.d.ts +1 -0
- package/dist/api/routes/hooks.js +88 -0
- package/dist/api/routes/memories.d.ts +1 -0
- package/dist/api/routes/memories.js +92 -0
- package/dist/api/routes/persona.d.ts +1 -0
- package/dist/api/routes/persona.js +9 -0
- package/dist/api/routes/scenes.d.ts +1 -0
- package/dist/api/routes/scenes.js +35 -0
- package/dist/api/routes/skills.d.ts +1 -0
- package/dist/api/routes/skills.js +14 -0
- package/dist/api/routes/stats.d.ts +1 -0
- package/dist/api/routes/stats.js +8 -0
- package/dist/api/routes/users.d.ts +1 -0
- package/dist/api/routes/users.js +82 -0
- package/dist/api/routes/working.d.ts +1 -0
- package/dist/api/routes/working.js +88 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +492 -0
- package/dist/integrations/claude-code.d.ts +12 -0
- package/dist/integrations/claude-code.js +35 -0
- package/dist/integrations/codex.d.ts +12 -0
- package/dist/integrations/codex.js +34 -0
- package/dist/integrations/generic-mcp.d.ts +52 -0
- package/dist/integrations/generic-mcp.js +118 -0
- package/dist/loader.d.ts +29 -0
- package/dist/loader.js +200 -0
- package/dist/memory/capture.d.ts +35 -0
- package/dist/memory/capture.js +230 -0
- package/dist/memory/config.d.ts +2 -0
- package/dist/memory/config.js +3 -0
- package/dist/memory/engine.d.ts +203 -0
- package/dist/memory/engine.js +626 -0
- package/dist/memory/llm-semaphore.d.ts +41 -0
- package/dist/memory/llm-semaphore.js +81 -0
- package/dist/memory/memory-type-config.d.ts +11 -0
- package/dist/memory/memory-type-config.js +65 -0
- package/dist/memory/pipeline/cognitive-contradiction.d.ts +7 -0
- package/dist/memory/pipeline/cognitive-contradiction.js +59 -0
- package/dist/memory/pipeline/cognitive-dedup.d.ts +23 -0
- package/dist/memory/pipeline/cognitive-dedup.js +38 -0
- package/dist/memory/pipeline/cognitive-extractor.d.ts +21 -0
- package/dist/memory/pipeline/cognitive-extractor.js +183 -0
- package/dist/memory/pipeline/contextual-focus-builder.d.ts +13 -0
- package/dist/memory/pipeline/contextual-focus-builder.js +135 -0
- package/dist/memory/pipeline/focus-direction-shift.d.ts +10 -0
- package/dist/memory/pipeline/focus-direction-shift.js +27 -0
- package/dist/memory/pipeline/graph-builder.d.ts +11 -0
- package/dist/memory/pipeline/graph-builder.js +88 -0
- package/dist/memory/pipeline/graph-recall.d.ts +13 -0
- package/dist/memory/pipeline/graph-recall.js +55 -0
- package/dist/memory/pipeline/identity-distiller.d.ts +15 -0
- package/dist/memory/pipeline/identity-distiller.js +40 -0
- package/dist/memory/pipeline/l1-contradiction.d.ts +7 -0
- package/dist/memory/pipeline/l1-contradiction.js +66 -0
- package/dist/memory/pipeline/l1-dedup.d.ts +23 -0
- package/dist/memory/pipeline/l1-dedup.js +39 -0
- package/dist/memory/pipeline/l1-extractor.d.ts +21 -0
- package/dist/memory/pipeline/l1-extractor.js +180 -0
- package/dist/memory/pipeline/l2-direction-shift.d.ts +10 -0
- package/dist/memory/pipeline/l2-direction-shift.js +27 -0
- package/dist/memory/pipeline/l2-scene.d.ts +15 -0
- package/dist/memory/pipeline/l2-scene.js +140 -0
- package/dist/memory/pipeline/l3-distiller.d.ts +15 -0
- package/dist/memory/pipeline/l3-distiller.js +40 -0
- package/dist/memory/pipeline/neural-spark.d.ts +27 -0
- package/dist/memory/pipeline/neural-spark.js +78 -0
- package/dist/memory/pipeline/skill-prewarm.d.ts +63 -0
- package/dist/memory/pipeline/skill-prewarm.js +127 -0
- package/dist/memory/pipeline/task-queue.d.ts +54 -0
- package/dist/memory/pipeline/task-queue.js +117 -0
- package/dist/memory/prompts/cognitive-contradiction.d.ts +1 -0
- package/dist/memory/prompts/cognitive-contradiction.js +25 -0
- package/dist/memory/prompts/cognitive-extraction.d.ts +10 -0
- package/dist/memory/prompts/cognitive-extraction.js +114 -0
- package/dist/memory/prompts/core-identity.d.ts +6 -0
- package/dist/memory/prompts/core-identity.js +60 -0
- package/dist/memory/prompts/focus-direction-shift.d.ts +5 -0
- package/dist/memory/prompts/focus-direction-shift.js +32 -0
- package/dist/memory/prompts/focus-scene-cluster.d.ts +2 -0
- package/dist/memory/prompts/focus-scene-cluster.js +33 -0
- package/dist/memory/prompts/focus-scene.d.ts +7 -0
- package/dist/memory/prompts/focus-scene.js +40 -0
- package/dist/memory/prompts/graph-extraction-batch.d.ts +14 -0
- package/dist/memory/prompts/graph-extraction-batch.js +54 -0
- package/dist/memory/prompts/graph-extraction.d.ts +2 -0
- package/dist/memory/prompts/graph-extraction.js +53 -0
- package/dist/memory/prompts/l1-contradiction-batch.d.ts +16 -0
- package/dist/memory/prompts/l1-contradiction-batch.js +47 -0
- package/dist/memory/prompts/l1-contradiction.d.ts +1 -0
- package/dist/memory/prompts/l1-contradiction.js +25 -0
- package/dist/memory/prompts/l1-extraction.d.ts +10 -0
- package/dist/memory/prompts/l1-extraction.js +114 -0
- package/dist/memory/prompts/l2-direction-shift.d.ts +5 -0
- package/dist/memory/prompts/l2-direction-shift.js +32 -0
- package/dist/memory/prompts/l2-scene-cluster.d.ts +2 -0
- package/dist/memory/prompts/l2-scene-cluster.js +33 -0
- package/dist/memory/prompts/l2-scene.d.ts +7 -0
- package/dist/memory/prompts/l2-scene.js +40 -0
- package/dist/memory/prompts/l3-persona.d.ts +6 -0
- package/dist/memory/prompts/l3-persona.js +60 -0
- package/dist/memory/recall.d.ts +47 -0
- package/dist/memory/recall.js +427 -0
- package/dist/memory/redaction.d.ts +1 -0
- package/dist/memory/redaction.js +24 -0
- package/dist/memory/retry.d.ts +13 -0
- package/dist/memory/retry.js +53 -0
- package/dist/memory/scheduler.d.ts +9 -0
- package/dist/memory/scheduler.js +16 -0
- package/dist/memory/skill-hints-loader.d.ts +30 -0
- package/dist/memory/skill-hints-loader.js +100 -0
- package/dist/memory/store/embedding.d.ts +16 -0
- package/dist/memory/store/embedding.js +68 -0
- package/dist/memory/store/reranker.d.ts +24 -0
- package/dist/memory/store/reranker.js +83 -0
- package/dist/memory/store/sqlite.d.ts +167 -0
- package/dist/memory/store/sqlite.js +1816 -0
- package/dist/memory/store/types.d.ts +101 -0
- package/dist/memory/store/types.js +1 -0
- package/dist/memory/types.d.ts +207 -0
- package/dist/memory/types.js +7 -0
- package/dist/memory/validation.d.ts +441 -0
- package/dist/memory/validation.js +129 -0
- package/dist/memory/working/canvas.d.ts +5 -0
- package/dist/memory/working/canvas.js +43 -0
- package/dist/memory/working/offload.d.ts +71 -0
- package/dist/memory/working/offload.js +211 -0
- package/dist/memory/working/step-log.d.ts +16 -0
- package/dist/memory/working/step-log.js +35 -0
- package/dist/registry.d.ts +34 -0
- package/dist/registry.js +305 -0
- package/dist/resolver.d.ts +17 -0
- package/dist/resolver.js +126 -0
- package/dist/scripts/validate-foreign-workspace-path.d.ts +1 -0
- package/dist/scripts/validate-foreign-workspace-path.js +39 -0
- package/dist/tools/agent_memory_tools.d.ts +485 -0
- package/dist/tools/agent_memory_tools.js +793 -0
- package/dist/tools/create_skill.d.ts +46 -0
- package/dist/tools/create_skill.js +46 -0
- package/dist/tools/get_doc.d.ts +21 -0
- package/dist/tools/get_doc.js +24 -0
- package/dist/tools/get_persona.d.ts +15 -0
- package/dist/tools/get_persona.js +20 -0
- package/dist/tools/get_reference.d.ts +15 -0
- package/dist/tools/get_reference.js +20 -0
- package/dist/tools/get_skill.d.ts +34 -0
- package/dist/tools/get_skill.js +65 -0
- package/dist/tools/get_template_doc.d.ts +21 -0
- package/dist/tools/get_template_doc.js +24 -0
- package/dist/tools/list_docs.d.ts +15 -0
- package/dist/tools/list_docs.js +16 -0
- package/dist/tools/list_skills.d.ts +18 -0
- package/dist/tools/list_skills.js +17 -0
- package/dist/tools/list_template_docs.d.ts +15 -0
- package/dist/tools/list_template_docs.js +16 -0
- package/dist/tools/memory-engineering.d.ts +225 -0
- package/dist/tools/memory-engineering.js +284 -0
- package/dist/tools/memory-explain.d.ts +34 -0
- package/dist/tools/memory-explain.js +109 -0
- package/dist/tools/memory-governance.d.ts +171 -0
- package/dist/tools/memory-governance.js +224 -0
- package/dist/tools/memory-hooks.d.ts +67 -0
- package/dist/tools/memory-hooks.js +102 -0
- package/dist/tools/memory-working.d.ts +98 -0
- package/dist/tools/memory-working.js +101 -0
- package/dist/tools/memory_capture_turn.d.ts +66 -0
- package/dist/tools/memory_capture_turn.js +85 -0
- package/dist/tools/memory_consolidate.d.ts +55 -0
- package/dist/tools/memory_consolidate.js +176 -0
- package/dist/tools/memory_contradictions.d.ts +53 -0
- package/dist/tools/memory_contradictions.js +52 -0
- package/dist/tools/memory_graph_query.d.ts +51 -0
- package/dist/tools/memory_graph_query.js +35 -0
- package/dist/tools/memory_mark_cited.d.ts +43 -0
- package/dist/tools/memory_mark_cited.js +63 -0
- package/dist/tools/memory_recall.d.ts +77 -0
- package/dist/tools/memory_recall.js +81 -0
- package/dist/tools/memory_register_skill_hints.d.ts +49 -0
- package/dist/tools/memory_register_skill_hints.js +55 -0
- package/dist/tools/memory_resolve_session.d.ts +24 -0
- package/dist/tools/memory_resolve_session.js +133 -0
- package/dist/tools/memory_search.d.ts +146 -0
- package/dist/tools/memory_search.js +84 -0
- package/dist/tools/search_skills.d.ts +18 -0
- package/dist/tools/search_skills.js +17 -0
- package/dist/tools/update_doc.d.ts +24 -0
- package/dist/tools/update_doc.js +35 -0
- package/dist/tools/update_skill.d.ts +30 -0
- package/dist/tools/update_skill.js +80 -0
- package/dist/types.d.ts +81 -0
- package/dist/types.js +4 -0
- package/dist/writer.d.ts +30 -0
- package/dist/writer.js +220 -0
- package/docs/TEMPLATE ONLY +1 -0
- package/docs/api/API.md +64 -0
- package/docs/api/security/SECURITY.md +58 -0
- package/docs/deployment/DockerDeployment.md +30 -0
- package/docs/design/Design.md +59 -0
- package/docs/design/themes/apple.md +101 -0
- package/docs/design/themes/dieter-grid.md +100 -0
- package/docs/design/themes/gallery-white.md +100 -0
- package/docs/design/themes/pinterest.md +101 -0
- package/docs/design/themes/realty-open-house.md +101 -0
- package/docs/design/themes/vodafone.md +101 -0
- package/docs/hooks/Hooks.md +30 -0
- package/docs/schema/Schema.md +35 -0
- package/docs/strategy/ScalingStrategy.md +19 -0
- package/package.json +88 -0
- package/references/accessibility-checklist.md +160 -0
- package/references/orchestration-patterns.md +370 -0
- package/references/performance-checklist.md +153 -0
- package/references/security-checklist.md +134 -0
- package/references/testing-patterns.md +236 -0
- package/skills/agent/adr-skill/SKILL.md +299 -0
- package/skills/agent/agentic-engineering-workflow/SKILL.md +95 -0
- package/skills/agent/bootstrap-skill/SKILL.md +103 -0
- package/skills/agent/context-engineering/SKILL.md +307 -0
- package/skills/agent/debugging-and-error-recovery/SKILL.md +308 -0
- package/skills/agent/developer-growth-analysis/SKILL.md +328 -0
- package/skills/agent/doubt-driven-skill/SKILL.md +249 -0
- package/skills/agent/handover-skill/SKILL.md +112 -0
- package/skills/agent/idea-refine-skill/SKILL.md +185 -0
- package/skills/agent/idea-refine-skill/examples.md +238 -0
- package/skills/agent/idea-refine-skill/frameworks.md +99 -0
- package/skills/agent/idea-refine-skill/refinement-criteria.md +113 -0
- package/skills/agent/interview-skill/SKILL.md +226 -0
- package/skills/agent/planning-skill/SKILL.md +270 -0
- package/skills/agent/skill-authoring/SKILL.md +189 -0
- package/skills/agent/source-driven-skill/SKILL.md +197 -0
- package/skills/agent/spec-driven-skill/SKILL.md +221 -0
- package/skills/agent/sync-skill/SKILL.md +92 -0
- package/skills/agent/using-agent-skills/SKILL.md +189 -0
- package/skills/api/a11y-skill/SKILL.md +88 -0
- package/skills/api/api-skill/SKILL.md +123 -0
- package/skills/api/auth-skill/SKILL.md +80 -0
- package/skills/api/debug-skill/SKILL.md +535 -0
- package/skills/api/performance-skill/SKILL.md +100 -0
- package/skills/api/testing-skill/SKILL.md +100 -0
- package/skills/codebase/code-review-and-quality/SKILL.md +228 -0
- package/skills/codebase/code-simplification/SKILL.md +352 -0
- package/skills/codebase/code-structure-cleanup/SKILL.md +142 -0
- package/skills/codebase/concerns-skill/SKILL.md +89 -0
- package/skills/codebase/conventions-skill/SKILL.md +95 -0
- package/skills/codebase/doc-management-skill/SKILL.md +47 -0
- package/skills/codebase/git-workflow-skill/SKILL.md +312 -0
- package/skills/communication/1-3-1-rule/SKILL.md +120 -0
- package/skills/design/brutalist-skill/SKILL.md +131 -0
- package/skills/design/concept-diagrams/SKILL.md +387 -0
- package/skills/design/concept-diagrams/examples/apartment-floor-plan-conversion.md +244 -0
- package/skills/design/concept-diagrams/examples/automated-password-reset-flow.md +276 -0
- package/skills/design/concept-diagrams/examples/autonomous-llm-research-agent-flow.md +240 -0
- package/skills/design/concept-diagrams/examples/banana-journey-tree-to-smoothie.md +161 -0
- package/skills/design/concept-diagrams/examples/commercial-aircraft-structure.md +209 -0
- package/skills/design/concept-diagrams/examples/cpu-ooo-microarchitecture.md +236 -0
- package/skills/design/concept-diagrams/examples/electricity-grid-flow.md +182 -0
- package/skills/design/concept-diagrams/examples/feature-film-production-pipeline.md +172 -0
- package/skills/design/concept-diagrams/examples/hospital-emergency-department-flow.md +165 -0
- package/skills/design/concept-diagrams/examples/ml-benchmark-grouped-bar-chart.md +114 -0
- package/skills/design/concept-diagrams/examples/place-order-uml-sequence.md +325 -0
- package/skills/design/concept-diagrams/examples/smart-city-infrastructure.md +173 -0
- package/skills/design/concept-diagrams/examples/smartphone-layer-anatomy.md +154 -0
- package/skills/design/concept-diagrams/examples/sn2-reaction-mechanism.md +247 -0
- package/skills/design/concept-diagrams/examples/wind-turbine-structure.md +338 -0
- package/skills/design/concept-diagrams/references/dashboard-patterns.md +43 -0
- package/skills/design/concept-diagrams/references/infrastructure-patterns.md +144 -0
- package/skills/design/concept-diagrams/references/physical-shape-cookbook.md +42 -0
- package/skills/design/concept-diagrams/templates/template.html +174 -0
- package/skills/design/gpt-tasteskill/SKILL.md +114 -0
- package/skills/design/minimalist-skill/SKILL.md +116 -0
- package/skills/design/output-skill/SKILL.md +87 -0
- package/skills/design/redesign-skill/SKILL.md +213 -0
- package/skills/design/soft-skill/SKILL.md +132 -0
- package/skills/design/stitch-skill/EXAMPLE.md +121 -0
- package/skills/design/stitch-skill/SKILL.md +222 -0
- package/skills/design/taste-skill/SKILL.md +269 -0
- package/skills/devops/ci-cd-skill/SKILL.md +402 -0
- package/skills/devops/docker-skill/SKILL.md +297 -0
- package/skills/devops/domain-skill/SKILL.md +234 -0
- package/skills/lifecycle/changelog-generator/SKILL.md +135 -0
- package/skills/lifecycle/incremental-skill/SKILL.md +257 -0
- package/skills/lifecycle/migration-skill/SKILL.md +218 -0
- package/skills/lifecycle/shipping-skill/SKILL.md +321 -0
- package/skills/memory/agent-memory/SKILL.md +122 -0
- package/skills/qa/browser-testing-skill/SKILL.md +314 -0
- package/skills/ux/adversarial-ux-skill/SKILL.md +168 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Hospital Emergency Department Flow
|
|
2
|
+
|
|
3
|
+
A multi-path flowchart showing patient journey through an emergency department with priority-based routing using semantic colors (red=critical, amber=urgent, green=stable).
|
|
4
|
+
|
|
5
|
+
## Key Patterns Used
|
|
6
|
+
|
|
7
|
+
- **Semantic color coding**: Red/amber/green for priority levels (not arbitrary decoration)
|
|
8
|
+
- **Stage labels**: Left-aligned faded labels marking workflow phases
|
|
9
|
+
- **Convergent paths**: Multiple entry points merging, then branching, then converging again
|
|
10
|
+
- **Nested containers**: Diagnostics grouped in a container with inner nodes
|
|
11
|
+
- **Legend**: Color key at bottom explaining priority levels
|
|
12
|
+
|
|
13
|
+
## Diagram
|
|
14
|
+
|
|
15
|
+
```xml
|
|
16
|
+
<svg width="100%" viewBox="0 0 680 620" xmlns="http://www.w3.org/2000/svg">
|
|
17
|
+
<defs>
|
|
18
|
+
<marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5"
|
|
19
|
+
markerWidth="6" markerHeight="6" orient="auto-start-reverse">
|
|
20
|
+
<path d="M2 1L8 5L2 9" fill="none" stroke="context-stroke"
|
|
21
|
+
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
22
|
+
</marker>
|
|
23
|
+
</defs>
|
|
24
|
+
|
|
25
|
+
<!-- Stage labels -->
|
|
26
|
+
<text class="ts" x="40" y="68" text-anchor="start" opacity=".5">Arrival</text>
|
|
27
|
+
<text class="ts" x="40" y="168" text-anchor="start" opacity=".5">Assessment</text>
|
|
28
|
+
<text class="ts" x="40" y="288" text-anchor="start" opacity=".5">Priority routing</text>
|
|
29
|
+
<text class="ts" x="40" y="418" text-anchor="start" opacity=".5">Diagnostics</text>
|
|
30
|
+
<text class="ts" x="40" y="518" text-anchor="start" opacity=".5">Outcome</text>
|
|
31
|
+
|
|
32
|
+
<!-- Arrival: Ambulance -->
|
|
33
|
+
<g class="node c-gray">
|
|
34
|
+
<rect x="140" y="40" width="160" height="56" rx="8" stroke-width="0.5"/>
|
|
35
|
+
<text class="th" x="220" y="60" text-anchor="middle" dominant-baseline="central">Ambulance</text>
|
|
36
|
+
<text class="ts" x="220" y="80" text-anchor="middle" dominant-baseline="central">Emergency transport</text>
|
|
37
|
+
</g>
|
|
38
|
+
|
|
39
|
+
<!-- Arrival: Walk-in -->
|
|
40
|
+
<g class="node c-gray">
|
|
41
|
+
<rect x="380" y="40" width="160" height="56" rx="8" stroke-width="0.5"/>
|
|
42
|
+
<text class="th" x="460" y="60" text-anchor="middle" dominant-baseline="central">Walk-in</text>
|
|
43
|
+
<text class="ts" x="460" y="80" text-anchor="middle" dominant-baseline="central">Self-arrival</text>
|
|
44
|
+
</g>
|
|
45
|
+
|
|
46
|
+
<!-- Arrows to Triage -->
|
|
47
|
+
<line x1="220" y1="96" x2="300" y2="140" class="arr" marker-end="url(#arrow)"/>
|
|
48
|
+
<line x1="460" y1="96" x2="380" y2="140" class="arr" marker-end="url(#arrow)"/>
|
|
49
|
+
|
|
50
|
+
<!-- Triage -->
|
|
51
|
+
<g class="node c-purple">
|
|
52
|
+
<rect x="240" y="140" width="200" height="56" rx="8" stroke-width="0.5"/>
|
|
53
|
+
<text class="th" x="340" y="160" text-anchor="middle" dominant-baseline="central">Triage</text>
|
|
54
|
+
<text class="ts" x="340" y="180" text-anchor="middle" dominant-baseline="central">Nurse assessment, vitals</text>
|
|
55
|
+
</g>
|
|
56
|
+
|
|
57
|
+
<!-- Arrows from Triage to Priority -->
|
|
58
|
+
<line x1="280" y1="196" x2="140" y2="260" class="arr" marker-end="url(#arrow)"/>
|
|
59
|
+
<line x1="340" y1="196" x2="340" y2="260" class="arr" marker-end="url(#arrow)"/>
|
|
60
|
+
<line x1="400" y1="196" x2="540" y2="260" class="arr" marker-end="url(#arrow)"/>
|
|
61
|
+
|
|
62
|
+
<!-- Priority: Red - Trauma -->
|
|
63
|
+
<g class="node c-red">
|
|
64
|
+
<rect x="60" y="260" width="160" height="56" rx="8" stroke-width="0.5"/>
|
|
65
|
+
<text class="th" x="140" y="280" text-anchor="middle" dominant-baseline="central">Trauma bay</text>
|
|
66
|
+
<text class="ts" x="140" y="300" text-anchor="middle" dominant-baseline="central">Priority: critical</text>
|
|
67
|
+
</g>
|
|
68
|
+
|
|
69
|
+
<!-- Priority: Yellow - Exam rooms -->
|
|
70
|
+
<g class="node c-amber">
|
|
71
|
+
<rect x="260" y="260" width="160" height="56" rx="8" stroke-width="0.5"/>
|
|
72
|
+
<text class="th" x="340" y="280" text-anchor="middle" dominant-baseline="central">Exam rooms</text>
|
|
73
|
+
<text class="ts" x="340" y="300" text-anchor="middle" dominant-baseline="central">Priority: urgent</text>
|
|
74
|
+
</g>
|
|
75
|
+
|
|
76
|
+
<!-- Priority: Green - Waiting -->
|
|
77
|
+
<g class="node c-green">
|
|
78
|
+
<rect x="460" y="260" width="160" height="56" rx="8" stroke-width="0.5"/>
|
|
79
|
+
<text class="th" x="540" y="280" text-anchor="middle" dominant-baseline="central">Waiting area</text>
|
|
80
|
+
<text class="ts" x="540" y="300" text-anchor="middle" dominant-baseline="central">Priority: stable</text>
|
|
81
|
+
</g>
|
|
82
|
+
|
|
83
|
+
<!-- Arrows to Diagnostics -->
|
|
84
|
+
<line x1="140" y1="316" x2="220" y2="390" class="arr" marker-end="url(#arrow)"/>
|
|
85
|
+
<line x1="340" y1="316" x2="340" y2="390" class="arr" marker-end="url(#arrow)"/>
|
|
86
|
+
<line x1="540" y1="316" x2="460" y2="390" class="arr" marker-end="url(#arrow)"/>
|
|
87
|
+
|
|
88
|
+
<!-- Diagnostics container -->
|
|
89
|
+
<g class="c-teal">
|
|
90
|
+
<rect x="140" y="390" width="400" height="56" rx="12" stroke-width="0.5"/>
|
|
91
|
+
</g>
|
|
92
|
+
|
|
93
|
+
<!-- Labs -->
|
|
94
|
+
<g class="node c-teal">
|
|
95
|
+
<rect x="160" y="400" width="110" height="36" rx="6" stroke-width="0.5"/>
|
|
96
|
+
<text class="ts" x="215" y="418" text-anchor="middle" dominant-baseline="central">Labs</text>
|
|
97
|
+
</g>
|
|
98
|
+
|
|
99
|
+
<!-- Imaging -->
|
|
100
|
+
<g class="node c-teal">
|
|
101
|
+
<rect x="285" y="400" width="110" height="36" rx="6" stroke-width="0.5"/>
|
|
102
|
+
<text class="ts" x="340" y="418" text-anchor="middle" dominant-baseline="central">Imaging</text>
|
|
103
|
+
</g>
|
|
104
|
+
|
|
105
|
+
<!-- Diagnosis -->
|
|
106
|
+
<g class="node c-teal">
|
|
107
|
+
<rect x="410" y="400" width="110" height="36" rx="6" stroke-width="0.5"/>
|
|
108
|
+
<text class="ts" x="465" y="418" text-anchor="middle" dominant-baseline="central">Diagnosis</text>
|
|
109
|
+
</g>
|
|
110
|
+
|
|
111
|
+
<!-- Arrows to Outcomes -->
|
|
112
|
+
<line x1="215" y1="446" x2="160" y2="490" class="arr" marker-end="url(#arrow)"/>
|
|
113
|
+
<line x1="340" y1="446" x2="340" y2="490" class="arr" marker-end="url(#arrow)"/>
|
|
114
|
+
<line x1="465" y1="446" x2="520" y2="490" class="arr" marker-end="url(#arrow)"/>
|
|
115
|
+
|
|
116
|
+
<!-- Outcome: Admission -->
|
|
117
|
+
<g class="node c-coral">
|
|
118
|
+
<rect x="80" y="490" width="160" height="56" rx="8" stroke-width="0.5"/>
|
|
119
|
+
<text class="th" x="160" y="510" text-anchor="middle" dominant-baseline="central">Admission</text>
|
|
120
|
+
<text class="ts" x="160" y="530" text-anchor="middle" dominant-baseline="central">Inpatient ward</text>
|
|
121
|
+
</g>
|
|
122
|
+
|
|
123
|
+
<!-- Outcome: Surgery -->
|
|
124
|
+
<g class="node c-coral">
|
|
125
|
+
<rect x="260" y="490" width="160" height="56" rx="8" stroke-width="0.5"/>
|
|
126
|
+
<text class="th" x="340" y="510" text-anchor="middle" dominant-baseline="central">Surgery</text>
|
|
127
|
+
<text class="ts" x="340" y="530" text-anchor="middle" dominant-baseline="central">Operating room</text>
|
|
128
|
+
</g>
|
|
129
|
+
|
|
130
|
+
<!-- Outcome: Discharge -->
|
|
131
|
+
<g class="node c-coral">
|
|
132
|
+
<rect x="440" y="490" width="160" height="56" rx="8" stroke-width="0.5"/>
|
|
133
|
+
<text class="th" x="520" y="510" text-anchor="middle" dominant-baseline="central">Discharge</text>
|
|
134
|
+
<text class="ts" x="520" y="530" text-anchor="middle" dominant-baseline="central">Home with instructions</text>
|
|
135
|
+
</g>
|
|
136
|
+
|
|
137
|
+
<!-- Legend -->
|
|
138
|
+
<text class="ts" x="140" y="580" opacity=".5">Priority levels</text>
|
|
139
|
+
<g class="c-red"><rect x="140" y="592" width="14" height="14" rx="3" stroke-width="0.5"/></g>
|
|
140
|
+
<text class="ts" x="162" y="604">Critical</text>
|
|
141
|
+
<g class="c-amber"><rect x="240" y="592" width="14" height="14" rx="3" stroke-width="0.5"/></g>
|
|
142
|
+
<text class="ts" x="262" y="604">Urgent</text>
|
|
143
|
+
<g class="c-green"><rect x="340" y="592" width="14" height="14" rx="3" stroke-width="0.5"/></g>
|
|
144
|
+
<text class="ts" x="362" y="604">Stable</text>
|
|
145
|
+
</svg>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Color Assignments
|
|
149
|
+
|
|
150
|
+
| Element | Color | Reason |
|
|
151
|
+
|---------|-------|--------|
|
|
152
|
+
| Entry points (Ambulance, Walk-in) | `c-gray` | Neutral starting points |
|
|
153
|
+
| Triage | `c-purple` | Processing/assessment step |
|
|
154
|
+
| Trauma bay | `c-red` | Critical priority (semantic) |
|
|
155
|
+
| Exam rooms | `c-amber` | Urgent priority (semantic) |
|
|
156
|
+
| Waiting area | `c-green` | Stable priority (semantic) |
|
|
157
|
+
| Diagnostics | `c-teal` | Clinical services category |
|
|
158
|
+
| Outcomes | `c-coral` | Final disposition category |
|
|
159
|
+
|
|
160
|
+
## Layout Notes
|
|
161
|
+
|
|
162
|
+
- **ViewBox**: 680×620 (standard width, extended height for 5 stages)
|
|
163
|
+
- **Stage spacing**: ~110-130px between stage rows
|
|
164
|
+
- **Diagonal arrows**: Connect nodes across columns naturally
|
|
165
|
+
- **Container with inner nodes**: Diagnostics uses outer `c-teal` rect with inner node rects
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# ML Benchmark Grouped Bar Chart with Dual Axis
|
|
2
|
+
|
|
3
|
+
A quantitative data visualization comparing LLM inference speed across quantization levels with dual Y-axes, threshold markers, and an inset accuracy table.
|
|
4
|
+
|
|
5
|
+
## Key Patterns Used
|
|
6
|
+
|
|
7
|
+
- **Grouped bars**: Min/max range pairs per category using semantic color pairs (lighter=min, darker=max)
|
|
8
|
+
- **Dual Y-axis**: Left axis for primary metric (tok/s), right axis for secondary metric (VRAM GB)
|
|
9
|
+
- **Overlay line graph**: `<polyline>` with labeled dots showing VRAM usage across categories
|
|
10
|
+
- **Threshold marker**: Dashed red horizontal line indicating hardware limit (24 GB GPU)
|
|
11
|
+
- **Zone annotations**: Subtle text labels above/below threshold for context
|
|
12
|
+
- **Inset data table**: Alternating row fills below chart with quantitative accuracy data
|
|
13
|
+
- **Semantic color coding**: Each quantization level gets its own color from the skill palette (red=OOM, amber=slow, teal=sweet spot, blue=fast)
|
|
14
|
+
|
|
15
|
+
## Diagram Type
|
|
16
|
+
|
|
17
|
+
This is a **quantitative data chart** with:
|
|
18
|
+
- **Grouped vertical bars**: Range bars showing min–max performance per category
|
|
19
|
+
- **Secondary axis line**: VRAM usage overlaid as a connected scatter plot
|
|
20
|
+
- **Threshold annotation**: Hardware constraint line
|
|
21
|
+
- **Inset table**: Supporting accuracy metrics
|
|
22
|
+
|
|
23
|
+
## Chart Layout Formula
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Chart area: x=90–590, y=70–410 (500px wide, 340px tall)
|
|
27
|
+
Left Y-axis: Primary metric (tok/s)
|
|
28
|
+
y = 410 − (val / max_val) × 340
|
|
29
|
+
Right Y-axis: Secondary metric (VRAM GB)
|
|
30
|
+
Same formula, different scale labels
|
|
31
|
+
Groups: Divide width by number of categories
|
|
32
|
+
Bars: Each group → min bar (34px) + 8px gap + max bar (34px)
|
|
33
|
+
Line overlay: <polyline> connecting data points across group centers
|
|
34
|
+
Threshold: Horizontal dashed line at critical value
|
|
35
|
+
Table: Below chart, alternating row fills
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Data Mapped
|
|
39
|
+
|
|
40
|
+
| Quantization | Model Size | Speed (tok/s) | VRAM (GB) | MMLU Pro | Status |
|
|
41
|
+
|-------------|-----------|---------------|-----------|----------|--------|
|
|
42
|
+
| FP16 | 62 GB | 0.5–2 | 62 | 75.2 | OOM / unusable |
|
|
43
|
+
| Q8_0 | 32 GB | 3–5 | 32 | 75.0 | Partial offload |
|
|
44
|
+
| Q4_K_M | 16.8 GB | 8–12 | 16.8 | 73.1 | Fits in VRAM ✓ |
|
|
45
|
+
| IQ3_M | 12 GB | 12–15 | 12 | 70.5 | Full GPU speed |
|
|
46
|
+
|
|
47
|
+
## Bar CSS Classes
|
|
48
|
+
|
|
49
|
+
```css
|
|
50
|
+
/* Light mode */
|
|
51
|
+
.bar-fp16-min { fill: #FCEBEB; stroke: #A32D2D; stroke-width: 0.75; }
|
|
52
|
+
.bar-fp16-max { fill: #F7C1C1; stroke: #A32D2D; stroke-width: 0.75; }
|
|
53
|
+
.bar-q8-min { fill: #FAEEDA; stroke: #854F0B; stroke-width: 0.75; }
|
|
54
|
+
.bar-q8-max { fill: #FAC775; stroke: #854F0B; stroke-width: 0.75; }
|
|
55
|
+
.bar-q4-min { fill: #E1F5EE; stroke: #0F6E56; stroke-width: 0.75; }
|
|
56
|
+
.bar-q4-max { fill: #9FE1CB; stroke: #0F6E56; stroke-width: 0.75; }
|
|
57
|
+
.bar-iq3-min { fill: #E6F1FB; stroke: #185FA5; stroke-width: 0.75; }
|
|
58
|
+
.bar-iq3-max { fill: #B5D4F4; stroke: #185FA5; stroke-width: 0.75; }
|
|
59
|
+
|
|
60
|
+
/* Dark mode */
|
|
61
|
+
@media (prefers-color-scheme: dark) {
|
|
62
|
+
.bar-fp16-min { fill: #501313; stroke: #F09595; }
|
|
63
|
+
.bar-fp16-max { fill: #791F1F; stroke: #F09595; }
|
|
64
|
+
.bar-q8-min { fill: #412402; stroke: #EF9F27; }
|
|
65
|
+
.bar-q8-max { fill: #633806; stroke: #EF9F27; }
|
|
66
|
+
.bar-q4-min { fill: #04342C; stroke: #5DCAA5; }
|
|
67
|
+
.bar-q4-max { fill: #085041; stroke: #5DCAA5; }
|
|
68
|
+
.bar-iq3-min { fill: #042C53; stroke: #85B7EB; }
|
|
69
|
+
.bar-iq3-max { fill: #0C447C; stroke: #85B7EB; }
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Overlay Line CSS
|
|
74
|
+
|
|
75
|
+
```css
|
|
76
|
+
.vram-line { stroke: #534AB7; stroke-width: 2.5; fill: none; }
|
|
77
|
+
.vram-dot { fill: #534AB7; stroke: var(--bg-primary); stroke-width: 2; }
|
|
78
|
+
.vram-label { font-family: system-ui, sans-serif; font-size: 10px; fill: #534AB7; font-weight: 500; }
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Threshold CSS
|
|
82
|
+
|
|
83
|
+
```css
|
|
84
|
+
.threshold { stroke: #A32D2D; stroke-width: 1; stroke-dasharray: 6 3; fill: none; }
|
|
85
|
+
.threshold-label { font-family: system-ui, sans-serif; font-size: 10px; fill: #A32D2D; font-weight: 500; }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Table CSS
|
|
89
|
+
|
|
90
|
+
```css
|
|
91
|
+
.tbl-header { fill: var(--bg-secondary); stroke: var(--border); stroke-width: 0.5; }
|
|
92
|
+
.tbl-row { fill: transparent; stroke: var(--border); stroke-width: 0.25; }
|
|
93
|
+
.tbl-alt { fill: var(--bg-secondary); stroke: var(--border); stroke-width: 0.25; }
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Layout Notes
|
|
97
|
+
|
|
98
|
+
- **ViewBox**: 680×660 (portrait, chart + legend + table)
|
|
99
|
+
- **Chart area**: y=70–410, x=90–590
|
|
100
|
+
- **Legend row**: y=458–470
|
|
101
|
+
- **Inset table**: y=490–620
|
|
102
|
+
- **Bar width**: 34px each, 8px gap between min/max pair
|
|
103
|
+
- **Group spacing**: 125px center-to-center
|
|
104
|
+
- **Dot halo**: White circle (r=6) behind colored dot (r=5) for legibility over bars/grid
|
|
105
|
+
|
|
106
|
+
## When to Use This Pattern
|
|
107
|
+
|
|
108
|
+
Use this diagram style for:
|
|
109
|
+
- Model benchmark comparisons across quantization levels
|
|
110
|
+
- Performance vs. resource usage tradeoff analysis
|
|
111
|
+
- Any multi-metric comparison with a hardware/software constraint
|
|
112
|
+
- GPU/TPU/accelerator benchmarking dashboards
|
|
113
|
+
- Accuracy vs. speed Pareto frontiers
|
|
114
|
+
- Hardware requirement sizing charts
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# Place Order — UML Sequence Diagram
|
|
2
|
+
|
|
3
|
+
A UML sequence diagram for the 'Place Order' use case in an e-commerce system. Six lifelines (:Customer, :ShoppingCart, :OrderController, :PaymentGateway, :InventorySystem, :EmailService) interact across 14 numbered messages. An **alt** combined fragment (amber) covers the three conditional outcomes — payment authorized, payment failed, and item unavailable. A **par** combined fragment (teal) nested inside the success branch shows concurrent email confirmation and stock-level update. Demonstrates activation bars, two distinct arrowhead types, UML pentagon fragment tags, and guard conditions.
|
|
4
|
+
|
|
5
|
+
## Key Patterns Used
|
|
6
|
+
|
|
7
|
+
- **6 lifelines at equal spacing**: Lifeline centers placed at x=90, 190, 290, 390, 490, 590 (100px apart) so the first box left-edge lands at x=40 and the last right-edge lands at x=640 — exactly filling the safe area
|
|
8
|
+
- **Two-row actor headers**: Each lifeline box shows `":"` (small, tertiary color) on one line and the class name (slightly larger, bold) on a second line, matching the UML anonymous-instance notation `:ClassName`
|
|
9
|
+
- **Two separate arrowhead markers**: `#arr-call` is a filled triangle (`<polygon>`) for synchronous calls; `#arr-ret` is an open chevron (`fill="none"`) for dashed return messages — both use `context-stroke` to inherit line color
|
|
10
|
+
- **Activation bars**: Narrow 8px-wide rectangles (`class="activation"`) layered on top of lifeline stems to show object execution periods; OrderController's bar spans the entire interaction; shorter bars mark PaymentGateway, InventorySystem, and EmailService during their active windows
|
|
11
|
+
- **Combined fragment pentagon tag**: Each `alt` / `par` frame uses a `<polygon>` dog-eared label shape in the top-left corner — points follow the pattern `(x,y) (x+w,y) (x+w+6,y+6) (x+w+6,y+18) (x,y+18)` creating the characteristic UML notch
|
|
12
|
+
- **Nested par inside alt**: The `par` rect (teal) sits inside branch 1 of the `alt` rect (amber); inner rect uses inset x/y (+15/+2) so both borders remain visible and distinguishable
|
|
13
|
+
- **Guard conditions**: Italic text in `[square brackets]` placed immediately after each alt frame divider line, or just inside the top frame for branch 1 — rendered with a dedicated `guard-lbl` class (italic, amber color)
|
|
14
|
+
- **Alt branch dividers**: Solid horizontal lines (`.frag-alt-div`) span the full alt rect width to separate the three branches; par branch separator uses a dashed line (`.frag-par-div`) per UML spec
|
|
15
|
+
- **Lifeline end caps**: Short 14px horizontal tick marks at y=590 (bottom of all lifeline stems) to formally terminate each lifeline
|
|
16
|
+
- **Message sequence annotation**: A faint counter row below the legend (①–③ / ④–⑩ / ⑪–⑫ / ⑬–⑭) explains the four message groups without adding noise to the diagram body
|
|
17
|
+
|
|
18
|
+
## Diagram
|
|
19
|
+
|
|
20
|
+
```xml
|
|
21
|
+
<svg width="100%" viewBox="0 0 680 648" xmlns="http://www.w3.org/2000/svg">
|
|
22
|
+
<defs>
|
|
23
|
+
<!-- Open chevron arrowhead — return messages -->
|
|
24
|
+
<marker id="arr-ret" viewBox="0 0 10 10" refX="8" refY="5"
|
|
25
|
+
markerWidth="6" markerHeight="6" orient="auto-start-reverse">
|
|
26
|
+
<path d="M2 1L8 5L2 9" fill="none" stroke="context-stroke"
|
|
27
|
+
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
28
|
+
</marker>
|
|
29
|
+
|
|
30
|
+
<!-- Filled triangle arrowhead — synchronous calls -->
|
|
31
|
+
<marker id="arr-call" viewBox="0 0 10 10" refX="9" refY="5"
|
|
32
|
+
markerWidth="7" markerHeight="7" orient="auto">
|
|
33
|
+
<polygon points="0,1 10,5 0,9" fill="context-stroke"/>
|
|
34
|
+
</marker>
|
|
35
|
+
</defs>
|
|
36
|
+
|
|
37
|
+
<!--
|
|
38
|
+
Lifeline centres (x):
|
|
39
|
+
L1 :Customer → 90
|
|
40
|
+
L2 :ShoppingCart → 190
|
|
41
|
+
L3 :OrderController → 290
|
|
42
|
+
L4 :PaymentGateway → 390
|
|
43
|
+
L5 :InventorySystem → 490
|
|
44
|
+
L6 :EmailService → 590
|
|
45
|
+
Actor boxes: x = cx−50, y=20, w=100, h=56, rx=6
|
|
46
|
+
Lifelines: x = cx, y1=76, y2=590
|
|
47
|
+
-->
|
|
48
|
+
|
|
49
|
+
<!-- ── 1. LIFELINE DASHED STEMS (drawn first, behind everything) ── -->
|
|
50
|
+
<line x1="90" y1="76" x2="90" y2="590" class="lifeline"/>
|
|
51
|
+
<line x1="190" y1="76" x2="190" y2="590" class="lifeline"/>
|
|
52
|
+
<line x1="290" y1="76" x2="290" y2="590" class="lifeline"/>
|
|
53
|
+
<line x1="390" y1="76" x2="390" y2="590" class="lifeline"/>
|
|
54
|
+
<line x1="490" y1="76" x2="490" y2="590" class="lifeline"/>
|
|
55
|
+
<line x1="590" y1="76" x2="590" y2="590" class="lifeline"/>
|
|
56
|
+
|
|
57
|
+
<!-- ── 2. ACTOR HEADER BOXES ── -->
|
|
58
|
+
|
|
59
|
+
<!-- :Customer -->
|
|
60
|
+
<rect x="40" y="20" width="100" height="56" rx="6" class="actor"/>
|
|
61
|
+
<text class="actor-colon" x="90" y="40" text-anchor="middle" dominant-baseline="central">:</text>
|
|
62
|
+
<text class="actor-name" x="90" y="58" text-anchor="middle" dominant-baseline="central">Customer</text>
|
|
63
|
+
|
|
64
|
+
<!-- :ShoppingCart -->
|
|
65
|
+
<rect x="140" y="20" width="100" height="56" rx="6" class="actor"/>
|
|
66
|
+
<text class="actor-colon" x="190" y="37" text-anchor="middle" dominant-baseline="central">:</text>
|
|
67
|
+
<text class="actor-name" x="190" y="55" text-anchor="middle" dominant-baseline="central">ShoppingCart</text>
|
|
68
|
+
|
|
69
|
+
<!-- :OrderController -->
|
|
70
|
+
<rect x="240" y="20" width="100" height="56" rx="6" class="actor"/>
|
|
71
|
+
<text class="actor-colon" x="290" y="37" text-anchor="middle" dominant-baseline="central">:</text>
|
|
72
|
+
<text class="actor-name" x="290" y="55" text-anchor="middle" dominant-baseline="central">OrderController</text>
|
|
73
|
+
|
|
74
|
+
<!-- :PaymentGateway -->
|
|
75
|
+
<rect x="340" y="20" width="100" height="56" rx="6" class="actor"/>
|
|
76
|
+
<text class="actor-colon" x="390" y="37" text-anchor="middle" dominant-baseline="central">:</text>
|
|
77
|
+
<text class="actor-name" x="390" y="55" text-anchor="middle" dominant-baseline="central">PaymentGateway</text>
|
|
78
|
+
|
|
79
|
+
<!-- :InventorySystem -->
|
|
80
|
+
<rect x="440" y="20" width="100" height="56" rx="6" class="actor"/>
|
|
81
|
+
<text class="actor-colon" x="490" y="37" text-anchor="middle" dominant-baseline="central">:</text>
|
|
82
|
+
<text class="actor-name" x="490" y="55" text-anchor="middle" dominant-baseline="central">InventorySystem</text>
|
|
83
|
+
|
|
84
|
+
<!-- :EmailService -->
|
|
85
|
+
<rect x="540" y="20" width="100" height="56" rx="6" class="actor"/>
|
|
86
|
+
<text class="actor-colon" x="590" y="37" text-anchor="middle" dominant-baseline="central">:</text>
|
|
87
|
+
<text class="actor-name" x="590" y="55" text-anchor="middle" dominant-baseline="central">EmailService</text>
|
|
88
|
+
|
|
89
|
+
<!-- ── 3. ACTIVATION BARS ── -->
|
|
90
|
+
<!-- ShoppingCart: active while forwarding checkout → placeOrder -->
|
|
91
|
+
<rect x="186" y="102" width="8" height="26" rx="1" class="activation"/>
|
|
92
|
+
<!-- OrderController: active throughout full sequence -->
|
|
93
|
+
<rect x="286" y="128" width="8" height="415" rx="1" class="activation"/>
|
|
94
|
+
<!-- PaymentGateway: active during auth check (happy-path branch only) -->
|
|
95
|
+
<rect x="386" y="154" width="8" height="46" rx="1" class="activation"/>
|
|
96
|
+
<!-- InventorySystem: active from reserveItems → updateStockLevels end -->
|
|
97
|
+
<rect x="486" y="225" width="8" height="128" rx="1" class="activation"/>
|
|
98
|
+
<!-- EmailService: active during confirmation send -->
|
|
99
|
+
<rect x="586" y="290" width="8" height="25" rx="1" class="activation"/>
|
|
100
|
+
|
|
101
|
+
<!-- ── 4. PRE-ALT MESSAGES ── -->
|
|
102
|
+
|
|
103
|
+
<!-- ① checkout() :Customer → :ShoppingCart -->
|
|
104
|
+
<line x1="90" y1="102" x2="186" y2="102" class="msg-call" marker-end="url(#arr-call)"/>
|
|
105
|
+
<text class="mlbl" x="140" y="97" text-anchor="middle">checkout()</text>
|
|
106
|
+
|
|
107
|
+
<!-- ② placeOrder(cartItems) :ShoppingCart → :OrderController -->
|
|
108
|
+
<line x1="194" y1="128" x2="286" y2="128" class="msg-call" marker-end="url(#arr-call)"/>
|
|
109
|
+
<text class="mlbl" x="242" y="123" text-anchor="middle">placeOrder(cartItems)</text>
|
|
110
|
+
|
|
111
|
+
<!-- ③ authorizePayment(amount) :OrderController → :PaymentGateway -->
|
|
112
|
+
<line x1="294" y1="154" x2="386" y2="154" class="msg-call" marker-end="url(#arr-call)"/>
|
|
113
|
+
<text class="mlbl" x="342" y="149" text-anchor="middle">authorizePayment(amount)</text>
|
|
114
|
+
|
|
115
|
+
<!-- ── 5. ALT COMBINED FRAGMENT y=166 → y=563 ── -->
|
|
116
|
+
|
|
117
|
+
<!-- Outer alt rectangle -->
|
|
118
|
+
<rect x="45" y="166" width="590" height="397" rx="3" class="frag-alt-bg"/>
|
|
119
|
+
|
|
120
|
+
<!-- Pentagon "alt" tag: TL corner notch shape -->
|
|
121
|
+
<polygon points="45,166 84,166 90,173 90,185 45,185" class="frag-alt-tag"/>
|
|
122
|
+
<text class="frag-alt-kw" x="67" y="178" text-anchor="middle" dominant-baseline="central">alt</text>
|
|
123
|
+
|
|
124
|
+
<!-- Guard: branch 1 -->
|
|
125
|
+
<text class="guard-lbl" x="96" y="179" dominant-baseline="central">[payment authorized]</text>
|
|
126
|
+
|
|
127
|
+
<!-- ─── Branch 1: payment authorized ─── -->
|
|
128
|
+
|
|
129
|
+
<!-- ④ « authorized » :PaymentGateway → :OrderController (dashed return) -->
|
|
130
|
+
<line x1="386" y1="200" x2="294" y2="200" class="msg-ret" marker-end="url(#arr-ret)"/>
|
|
131
|
+
<text class="rlbl" x="342" y="195" text-anchor="middle">« authorized »</text>
|
|
132
|
+
|
|
133
|
+
<!-- ⑤ reserveItems(cartItems) :OrderController → :InventorySystem -->
|
|
134
|
+
<line x1="294" y1="225" x2="486" y2="225" class="msg-call" marker-end="url(#arr-call)"/>
|
|
135
|
+
<text class="mlbl" x="392" y="220" text-anchor="middle">reserveItems(cartItems)</text>
|
|
136
|
+
|
|
137
|
+
<!-- ⑥ « itemsReserved » :InventorySystem → :OrderController (dashed return) -->
|
|
138
|
+
<line x1="486" y1="250" x2="294" y2="250" class="msg-ret" marker-end="url(#arr-ret)"/>
|
|
139
|
+
<text class="rlbl" x="392" y="245" text-anchor="middle">« itemsReserved »</text>
|
|
140
|
+
|
|
141
|
+
<!-- ── 6. PAR COMBINED FRAGMENT (nested inside alt branch 1) y=266 → y=373 ── -->
|
|
142
|
+
|
|
143
|
+
<!-- Inner par rectangle -->
|
|
144
|
+
<rect x="60" y="266" width="560" height="107" rx="3" class="frag-par-bg"/>
|
|
145
|
+
|
|
146
|
+
<!-- Pentagon "par" tag -->
|
|
147
|
+
<polygon points="60,266 97,266 102,272 102,284 60,284" class="frag-par-tag"/>
|
|
148
|
+
<text class="frag-par-kw" x="81" y="275" text-anchor="middle" dominant-baseline="central">par</text>
|
|
149
|
+
|
|
150
|
+
<!-- Par branch 1: email confirmation -->
|
|
151
|
+
|
|
152
|
+
<!-- ⑦ sendConfirmationEmail() :OrderController → :EmailService -->
|
|
153
|
+
<line x1="294" y1="295" x2="586" y2="295" class="msg-call" marker-end="url(#arr-call)"/>
|
|
154
|
+
<text class="mlbl" x="442" y="290" text-anchor="middle">sendConfirmationEmail()</text>
|
|
155
|
+
|
|
156
|
+
<!-- ⑧ « emailQueued » :EmailService → :OrderController (dashed return) -->
|
|
157
|
+
<line x1="586" y1="318" x2="294" y2="318" class="msg-ret" marker-end="url(#arr-ret)"/>
|
|
158
|
+
<text class="rlbl" x="442" y="313" text-anchor="middle">« emailQueued »</text>
|
|
159
|
+
|
|
160
|
+
<!-- Par branch divider (dashed, per UML spec) -->
|
|
161
|
+
<line x1="60" y1="336" x2="620" y2="336" class="frag-par-div"/>
|
|
162
|
+
|
|
163
|
+
<!-- Par branch 2: stock level update -->
|
|
164
|
+
|
|
165
|
+
<!-- ⑨ updateStockLevels() :OrderController → :InventorySystem -->
|
|
166
|
+
<line x1="294" y1="355" x2="486" y2="355" class="msg-call" marker-end="url(#arr-call)"/>
|
|
167
|
+
<text class="mlbl" x="392" y="350" text-anchor="middle">updateStockLevels()</text>
|
|
168
|
+
|
|
169
|
+
<!-- PAR fragment ends at y=373 -->
|
|
170
|
+
|
|
171
|
+
<!-- ⑩ « orderPlaced » :OrderController → :Customer (dashed return, after par) -->
|
|
172
|
+
<line x1="286" y1="395" x2="90" y2="395" class="msg-ret" marker-end="url(#arr-ret)"/>
|
|
173
|
+
<text class="rlbl" x="190" y="390" text-anchor="middle">« orderPlaced »</text>
|
|
174
|
+
|
|
175
|
+
<!-- ─── Alt else: [payment failed] ─── -->
|
|
176
|
+
|
|
177
|
+
<!-- Alt branch divider 1 (solid line) -->
|
|
178
|
+
<line x1="45" y1="415" x2="635" y2="415" class="frag-alt-div"/>
|
|
179
|
+
<text class="guard-lbl" x="50" y="429" dominant-baseline="central">[payment failed]</text>
|
|
180
|
+
|
|
181
|
+
<!-- ⑪ « authFailed » :PaymentGateway → :OrderController (dashed return) -->
|
|
182
|
+
<line x1="390" y1="448" x2="294" y2="448" class="msg-ret" marker-end="url(#arr-ret)"/>
|
|
183
|
+
<text class="rlbl" x="344" y="443" text-anchor="middle">« authFailed »</text>
|
|
184
|
+
|
|
185
|
+
<!-- ⑫ error(PAYMENT_FAILED) :OrderController → :Customer -->
|
|
186
|
+
<line x1="286" y1="470" x2="90" y2="470" class="msg-call" marker-end="url(#arr-call)"/>
|
|
187
|
+
<text class="mlbl" x="190" y="465" text-anchor="middle">error(PAYMENT_FAILED)</text>
|
|
188
|
+
|
|
189
|
+
<!-- ─── Alt else: [item unavailable] ─── -->
|
|
190
|
+
|
|
191
|
+
<!-- Alt branch divider 2 (solid line) -->
|
|
192
|
+
<line x1="45" y1="490" x2="635" y2="490" class="frag-alt-div"/>
|
|
193
|
+
<text class="guard-lbl" x="50" y="504" dominant-baseline="central">[item unavailable]</text>
|
|
194
|
+
|
|
195
|
+
<!-- ⑬ « unavailable » :InventorySystem → :OrderController (dashed return) -->
|
|
196
|
+
<line x1="486" y1="523" x2="294" y2="523" class="msg-ret" marker-end="url(#arr-ret)"/>
|
|
197
|
+
<text class="rlbl" x="392" y="518" text-anchor="middle">« unavailable »</text>
|
|
198
|
+
|
|
199
|
+
<!-- ⑭ error(ITEM_UNAVAILABLE) :OrderController → :Customer -->
|
|
200
|
+
<line x1="286" y1="545" x2="90" y2="545" class="msg-call" marker-end="url(#arr-call)"/>
|
|
201
|
+
<text class="mlbl" x="190" y="540" text-anchor="middle">error(ITEM_UNAVAILABLE)</text>
|
|
202
|
+
|
|
203
|
+
<!-- ALT fragment ends at y=563 -->
|
|
204
|
+
|
|
205
|
+
<!-- ── 7. LIFELINE END CAPS (short horizontal tick at y=590) ── -->
|
|
206
|
+
<line x1="83" y1="590" x2="97" y2="590" stroke="var(--text-tertiary)" stroke-width="1.5"/>
|
|
207
|
+
<line x1="183" y1="590" x2="197" y2="590" stroke="var(--text-tertiary)" stroke-width="1.5"/>
|
|
208
|
+
<line x1="283" y1="590" x2="297" y2="590" stroke="var(--text-tertiary)" stroke-width="1.5"/>
|
|
209
|
+
<line x1="383" y1="590" x2="397" y2="590" stroke="var(--text-tertiary)" stroke-width="1.5"/>
|
|
210
|
+
<line x1="483" y1="590" x2="497" y2="590" stroke="var(--text-tertiary)" stroke-width="1.5"/>
|
|
211
|
+
<line x1="583" y1="590" x2="597" y2="590" stroke="var(--text-tertiary)" stroke-width="1.5"/>
|
|
212
|
+
|
|
213
|
+
<!-- ── 8. LEGEND ── -->
|
|
214
|
+
<text class="ts" x="45" y="612" opacity=".45">Legend —</text>
|
|
215
|
+
|
|
216
|
+
<line x1="110" y1="609" x2="148" y2="609"
|
|
217
|
+
stroke="var(--text-primary)" stroke-width="1.5" marker-end="url(#arr-call)"/>
|
|
218
|
+
<text class="ts" x="154" y="613" opacity=".75">Synchronous call</text>
|
|
219
|
+
|
|
220
|
+
<line x1="288" y1="609" x2="326" y2="609"
|
|
221
|
+
stroke="var(--text-secondary)" stroke-width="1.5"
|
|
222
|
+
stroke-dasharray="5 3" marker-end="url(#arr-ret)"/>
|
|
223
|
+
<text class="ts" x="332" y="613" opacity=".75">Return message</text>
|
|
224
|
+
|
|
225
|
+
<rect x="458" y="603" width="22" height="13" rx="2"
|
|
226
|
+
fill="#FAEEDA" fill-opacity="0.5" stroke="#854F0B" stroke-width="0.75"/>
|
|
227
|
+
<text class="ts" x="484" y="613" opacity=".75">alt fragment</text>
|
|
228
|
+
|
|
229
|
+
<rect x="558" y="603" width="22" height="13" rx="2"
|
|
230
|
+
fill="#E1F5EE" fill-opacity="0.6" stroke="#0F6E56" stroke-width="0.75"/>
|
|
231
|
+
<text class="ts" x="584" y="613" opacity=".75">par fragment</text>
|
|
232
|
+
|
|
233
|
+
<!-- Message group annotation -->
|
|
234
|
+
<text class="ts" x="45" y="632" opacity=".35">
|
|
235
|
+
①–③ pre-condition · ④–⑩ happy path · ⑪–⑫ payment failure · ⑬–⑭ item unavailable
|
|
236
|
+
</text>
|
|
237
|
+
|
|
238
|
+
</svg>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Custom CSS
|
|
242
|
+
|
|
243
|
+
Add these classes to the hosting page `<style>` block (in addition to the standard skill CSS):
|
|
244
|
+
|
|
245
|
+
```css
|
|
246
|
+
/* ── Actor lifeline header boxes ── */
|
|
247
|
+
.actor { fill: var(--bg-secondary); stroke: var(--text-secondary); stroke-width: 0.5; }
|
|
248
|
+
.actor-name { font-family: system-ui, sans-serif; font-size: 11.5px; font-weight: 600;
|
|
249
|
+
fill: var(--text-primary); }
|
|
250
|
+
.actor-colon { font-family: system-ui, sans-serif; font-size: 10px; fill: var(--text-tertiary); }
|
|
251
|
+
|
|
252
|
+
/* ── Lifeline dashed stems ── */
|
|
253
|
+
.lifeline { stroke: var(--text-tertiary); stroke-width: 1; stroke-dasharray: 6 4; fill: none; }
|
|
254
|
+
|
|
255
|
+
/* ── Activation bars ── */
|
|
256
|
+
.activation { fill: var(--bg-secondary); stroke: var(--text-secondary); stroke-width: 0.75; }
|
|
257
|
+
|
|
258
|
+
/* ── Message arrows ── */
|
|
259
|
+
.msg-call { stroke: var(--text-primary); stroke-width: 1.5; fill: none; }
|
|
260
|
+
.msg-ret { stroke: var(--text-secondary); stroke-width: 1.5; fill: none; stroke-dasharray: 6 3; }
|
|
261
|
+
|
|
262
|
+
/* ── Message labels ── */
|
|
263
|
+
.mlbl { font-family: system-ui, sans-serif; font-size: 11px; fill: var(--text-primary); }
|
|
264
|
+
.rlbl { font-family: system-ui, sans-serif; font-size: 11px; fill: var(--text-secondary);
|
|
265
|
+
font-style: italic; }
|
|
266
|
+
|
|
267
|
+
/* ── Combined fragment: alt (amber) ── */
|
|
268
|
+
.frag-alt-bg { fill: #FAEEDA; fill-opacity: 0.18; stroke: #854F0B; stroke-width: 1; }
|
|
269
|
+
.frag-alt-tag { fill: #FAEEDA; stroke: #854F0B; stroke-width: 0.75; }
|
|
270
|
+
.frag-alt-kw { font-family: system-ui, sans-serif; font-size: 11px; font-weight: 700;
|
|
271
|
+
fill: #633806; }
|
|
272
|
+
.frag-alt-div { stroke: #854F0B; stroke-width: 0.75; fill: none; }
|
|
273
|
+
.guard-lbl { font-family: system-ui, sans-serif; font-size: 10.5px; font-style: italic;
|
|
274
|
+
fill: #854F0B; }
|
|
275
|
+
|
|
276
|
+
/* ── Combined fragment: par (teal) ── */
|
|
277
|
+
.frag-par-bg { fill: #E1F5EE; fill-opacity: 0.35; stroke: #0F6E56; stroke-width: 1; }
|
|
278
|
+
.frag-par-tag { fill: #E1F5EE; stroke: #0F6E56; stroke-width: 0.75; }
|
|
279
|
+
.frag-par-kw { font-family: system-ui, sans-serif; font-size: 11px; font-weight: 700;
|
|
280
|
+
fill: #085041; }
|
|
281
|
+
.frag-par-div { stroke: #0F6E56; stroke-width: 0.75; stroke-dasharray: 5 3; fill: none; }
|
|
282
|
+
|
|
283
|
+
/* ── Dark mode overrides ── */
|
|
284
|
+
@media (prefers-color-scheme: dark) {
|
|
285
|
+
.actor { fill: #2c2c2a; stroke: #b4b2a9; }
|
|
286
|
+
.actor-name { fill: #e8e6de; }
|
|
287
|
+
.actor-colon { fill: #888780; }
|
|
288
|
+
.frag-alt-bg { fill: #633806; fill-opacity: 0.25; stroke: #EF9F27; }
|
|
289
|
+
.frag-alt-tag { fill: #633806; stroke: #EF9F27; }
|
|
290
|
+
.frag-alt-kw { fill: #FAC775; }
|
|
291
|
+
.frag-alt-div { stroke: #EF9F27; }
|
|
292
|
+
.guard-lbl { fill: #EF9F27; }
|
|
293
|
+
.frag-par-bg { fill: #085041; fill-opacity: 0.35; stroke: #5DCAA5; }
|
|
294
|
+
.frag-par-tag { fill: #085041; stroke: #5DCAA5; }
|
|
295
|
+
.frag-par-kw { fill: #9FE1CB; }
|
|
296
|
+
.frag-par-div { stroke: #5DCAA5; }
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Color Assignments
|
|
301
|
+
|
|
302
|
+
| Element | Color | Reason |
|
|
303
|
+
|---------|-------|--------|
|
|
304
|
+
| Actor header boxes | Neutral (`var(--bg-secondary)`) | Structural / non-semantic — all lifelines share one style |
|
|
305
|
+
| Activation bars | Neutral (`var(--bg-secondary)`) | Show execution periods without adding semantic color |
|
|
306
|
+
| Synchronous call arrows | `var(--text-primary)` + filled triangle | High contrast for calls — the primary interaction direction |
|
|
307
|
+
| Return / dashed arrows | `var(--text-secondary)` + open chevron | Lower contrast for returns — secondary flow direction |
|
|
308
|
+
| `alt` fragment | Amber (`#FAEEDA` / `#854F0B`) | Warning / conditional — matches `c-amber` semantic meaning |
|
|
309
|
+
| Guard condition text | Amber italic | Belongs visually to the alt fragment |
|
|
310
|
+
| `par` fragment | Teal (`#E1F5EE` / `#0F6E56`) | Concurrent success path — matches `c-teal` semantic meaning |
|
|
311
|
+
| Alt branch dividers | Amber solid line | Continuity with the alt frame color |
|
|
312
|
+
| Par branch divider | Teal dashed line | UML spec: par branches separated by dashed lines |
|
|
313
|
+
|
|
314
|
+
## Layout Notes
|
|
315
|
+
|
|
316
|
+
- **ViewBox**: 680×648 (standard width; height = lifeline bottom y=590 + legend + annotation + 16px buffer)
|
|
317
|
+
- **Lifeline spacing formula**: `(safe_area_width) / (n_lifelines − 1) = 600 / 5 = 120px` — but use `spacing = 100px` starting at `x=90` so that first box left = 40 and last box right = 640 exactly
|
|
318
|
+
- **Actor box split-label trick**: Two separate `<text>` elements per box — one for `":"` (10px, tertiary color) and one for the class name (11.5px bold, primary color) — avoids the 14px font needing ~150px+ per box for long names like "OrderController"
|
|
319
|
+
- **Pentagon tag formula**: For a fragment starting at `(fx, fy)`, the tag polygon points are `(fx,fy) (fx+w,fy) (fx+w+6,fy+6) (fx+w+6,fy+18) (fx,fy+18)` where `w` = approximate text width of the keyword + 8px padding each side
|
|
320
|
+
- **Nested fragment inset**: The `par` rect uses `x = alt_x + 15` and `y = alt_y_current + 2` so both borders remain simultaneously visible — inset enough to separate visually, not so much that it wastes vertical space
|
|
321
|
+
- **Activation bar placement**: `x = lifeline_cx − 4`, `width = 8` — centered on the lifeline and narrow enough not to obscure the dashed stem behind it
|
|
322
|
+
- **Message label y-offset**: All labels are placed at `y = arrow_y − 5` to sit just above the arrow line; this applies to both left-going and right-going arrows since `text-anchor="middle"` handles horizontal centering automatically
|
|
323
|
+
- **Return arrows entering activation bars**: End `x1/x2` at lifeline center (e.g. x=294 for OrderController) rather than the bar edge (x=286) — the small overlap is intentional and clarifies the target object
|
|
324
|
+
- **Alt guard label placement**: Branch 1 guard goes at `y = frame_top + 13` to the right of the pentagon tag; subsequent branch guards go at `divider_y + 14` so they sit just inside the new branch
|
|
325
|
+
- **Lifeline end cap pattern**: `<line x1="cx−7" y1="590" x2="cx+7" y2="590" stroke-width="1.5"/>` — a simple symmetric tick, no special marker needed
|