@tienne/gestalt 0.129.0 → 0.131.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/package.json +2 -1
  2. package/dist/plugin/.codex-plugin/plugin.json +1 -1
  3. package/dist/plugin/skills/architecture/SKILL.md +167 -139
  4. package/dist/plugin/skills/conductor/SKILL.md +51 -8
  5. package/dist/schemas/architecture-ir.schema.json +40 -4
  6. package/dist/schemas/gestalt.schema.json +16 -1
  7. package/dist/src/agent-sync/config.d.ts +4 -4
  8. package/dist/src/architecture/delta.d.ts.map +1 -1
  9. package/dist/src/architecture/delta.js +6 -0
  10. package/dist/src/architecture/delta.js.map +1 -1
  11. package/dist/src/architecture/drilldown.d.ts +6 -2
  12. package/dist/src/architecture/drilldown.d.ts.map +1 -1
  13. package/dist/src/architecture/drilldown.js +114 -3
  14. package/dist/src/architecture/drilldown.js.map +1 -1
  15. package/dist/src/architecture/html-client.d.ts +2 -0
  16. package/dist/src/architecture/html-client.d.ts.map +1 -1
  17. package/dist/src/architecture/html-client.js +10 -4
  18. package/dist/src/architecture/html-client.js.map +1 -1
  19. package/dist/src/architecture/html-renderer.d.ts +9 -0
  20. package/dist/src/architecture/html-renderer.d.ts.map +1 -1
  21. package/dist/src/architecture/html-renderer.js +213 -64
  22. package/dist/src/architecture/html-renderer.js.map +1 -1
  23. package/dist/src/architecture/html-theme.d.ts +10 -1
  24. package/dist/src/architecture/html-theme.d.ts.map +1 -1
  25. package/dist/src/architecture/html-theme.js +102 -16
  26. package/dist/src/architecture/html-theme.js.map +1 -1
  27. package/dist/src/architecture/infra-layout.d.ts +87 -0
  28. package/dist/src/architecture/infra-layout.d.ts.map +1 -0
  29. package/dist/src/architecture/infra-layout.js +424 -0
  30. package/dist/src/architecture/infra-layout.js.map +1 -0
  31. package/dist/src/architecture/infra-placement.d.ts +16 -0
  32. package/dist/src/architecture/infra-placement.d.ts.map +1 -0
  33. package/dist/src/architecture/infra-placement.js +49 -0
  34. package/dist/src/architecture/infra-placement.js.map +1 -0
  35. package/dist/src/architecture/infra-router.d.ts +41 -0
  36. package/dist/src/architecture/infra-router.d.ts.map +1 -0
  37. package/dist/src/architecture/infra-router.js +309 -0
  38. package/dist/src/architecture/infra-router.js.map +1 -0
  39. package/dist/src/architecture/ir-schema.d.ts +28 -0
  40. package/dist/src/architecture/ir-schema.d.ts.map +1 -1
  41. package/dist/src/architecture/ir-schema.js +23 -3
  42. package/dist/src/architecture/ir-schema.js.map +1 -1
  43. package/dist/src/architecture/merge.d.ts.map +1 -1
  44. package/dist/src/architecture/merge.js +6 -2
  45. package/dist/src/architecture/merge.js.map +1 -1
  46. package/dist/src/architecture/store.d.ts.map +1 -1
  47. package/dist/src/architecture/store.js +1 -0
  48. package/dist/src/architecture/store.js.map +1 -1
  49. package/dist/src/architecture/types.d.ts +24 -2
  50. package/dist/src/architecture/types.d.ts.map +1 -1
  51. package/dist/src/architecture/types.js +19 -2
  52. package/dist/src/architecture/types.js.map +1 -1
  53. package/dist/src/architecture/validator.d.ts +9 -2
  54. package/dist/src/architecture/validator.d.ts.map +1 -1
  55. package/dist/src/architecture/validator.js +44 -1
  56. package/dist/src/architecture/validator.js.map +1 -1
  57. package/dist/src/architecture/vendor-icon-cache.d.ts +31 -0
  58. package/dist/src/architecture/vendor-icon-cache.d.ts.map +1 -0
  59. package/dist/src/architecture/vendor-icon-cache.js +358 -0
  60. package/dist/src/architecture/vendor-icon-cache.js.map +1 -0
  61. package/dist/src/architecture/vendor-icon-keys.d.ts +26 -0
  62. package/dist/src/architecture/vendor-icon-keys.d.ts.map +1 -0
  63. package/dist/src/architecture/vendor-icon-keys.js +154 -0
  64. package/dist/src/architecture/vendor-icon-keys.js.map +1 -0
  65. package/dist/src/architecture/vendor-icons.d.ts +43 -0
  66. package/dist/src/architecture/vendor-icons.d.ts.map +1 -0
  67. package/dist/src/architecture/vendor-icons.js +81 -0
  68. package/dist/src/architecture/vendor-icons.js.map +1 -0
  69. package/dist/src/cli/commands/conductor.d.ts +14 -0
  70. package/dist/src/cli/commands/conductor.d.ts.map +1 -1
  71. package/dist/src/cli/commands/conductor.js +127 -6
  72. package/dist/src/cli/commands/conductor.js.map +1 -1
  73. package/dist/src/cli/index.d.ts.map +1 -1
  74. package/dist/src/cli/index.js +23 -5
  75. package/dist/src/cli/index.js.map +1 -1
  76. package/dist/src/conductor/context.d.ts +12 -0
  77. package/dist/src/conductor/context.d.ts.map +1 -0
  78. package/dist/src/conductor/context.js +25 -0
  79. package/dist/src/conductor/context.js.map +1 -0
  80. package/dist/src/conductor/engine.d.ts +11 -1
  81. package/dist/src/conductor/engine.d.ts.map +1 -1
  82. package/dist/src/conductor/engine.js +91 -8
  83. package/dist/src/conductor/engine.js.map +1 -1
  84. package/dist/src/conductor/intake.d.ts +12 -0
  85. package/dist/src/conductor/intake.d.ts.map +1 -1
  86. package/dist/src/conductor/intake.js +44 -6
  87. package/dist/src/conductor/intake.js.map +1 -1
  88. package/dist/src/conductor/launcher.d.ts +23 -2
  89. package/dist/src/conductor/launcher.d.ts.map +1 -1
  90. package/dist/src/conductor/launcher.js +157 -25
  91. package/dist/src/conductor/launcher.js.map +1 -1
  92. package/dist/src/conductor/parent-worktree.d.ts +22 -0
  93. package/dist/src/conductor/parent-worktree.d.ts.map +1 -0
  94. package/dist/src/conductor/parent-worktree.js +113 -0
  95. package/dist/src/conductor/parent-worktree.js.map +1 -0
  96. package/dist/src/conductor/result.d.ts.map +1 -1
  97. package/dist/src/conductor/result.js +20 -4
  98. package/dist/src/conductor/result.js.map +1 -1
  99. package/dist/src/conductor/store.d.ts.map +1 -1
  100. package/dist/src/conductor/store.js +6 -0
  101. package/dist/src/conductor/store.js.map +1 -1
  102. package/dist/src/conductor/types.d.ts +17 -2
  103. package/dist/src/conductor/types.d.ts.map +1 -1
  104. package/dist/src/conductor/types.js +2 -2
  105. package/dist/src/conductor/types.js.map +1 -1
  106. package/dist/src/core/config.d.ts +10 -0
  107. package/dist/src/core/config.d.ts.map +1 -1
  108. package/dist/src/core/config.js +3 -1
  109. package/dist/src/core/config.js.map +1 -1
  110. package/dist/src/core/constants.d.ts +5 -0
  111. package/dist/src/core/constants.d.ts.map +1 -1
  112. package/dist/src/core/constants.js +5 -0
  113. package/dist/src/core/constants.js.map +1 -1
  114. package/dist/src/mcp/tools/architecture-passthrough.d.ts.map +1 -1
  115. package/dist/src/mcp/tools/architecture-passthrough.js +19 -3
  116. package/dist/src/mcp/tools/architecture-passthrough.js.map +1 -1
  117. package/dist/src/research/schema.d.ts +12 -12
  118. package/dist/src/research/source-create.d.ts +2 -2
  119. package/dist/src/research/source-schema.d.ts +4 -4
  120. package/package.json +2 -1
  121. package/plugin/.codex-plugin/plugin.json +1 -1
  122. package/plugin/.mcp.json +1 -1
  123. package/plugin/mcp.json +1 -1
  124. package/plugin/skills/architecture/SKILL.md +167 -139
  125. package/plugin/skills/conductor/SKILL.md +51 -8
  126. package/schemas/architecture-ir.schema.json +40 -4
  127. package/schemas/gestalt.schema.json +16 -1
@@ -1,10 +1,12 @@
1
1
  import { BAND_LINE_X, BAND_LINE_Y, BAND_TITLE_HALF, BAND_TITLE_X, CANVAS_PAD_TOP, CANVAS_PAD_X, LANE_INSET_Y, routeCanvas, } from './canvas-geometry.js';
2
2
  import { BLUEPRINT_EMPTY_TEXT, BLUEPRINT_HEAD_W, BLUEPRINT_ROW_TEXT, BLUEPRINT_VISIBILITY_NOTE, BLUEPRINT_VISIBILITY_TEXT, blueprintStageTitle, computeBlueprintLayout, deriveBlueprint, } from './blueprint-layout.js';
3
- import { flowCountByService, ROOT_LEVEL_ID } from './drilldown.js';
3
+ import { flowCountByService, INFRA_LEVEL_ID, ROOT_LEVEL_ID, } from './drilldown.js';
4
4
  import { computeErLayout, deriveEr, erFoldText, isUnconfirmedFk, } from './er-layout.js';
5
5
  import { computeFlowLayout } from './flow-layout.js';
6
6
  import { renderClientScript, THEME_BOOT_SCRIPT } from './html-client.js';
7
- import { datastoreEngine, iconUse, PRODUCT_COLORS, renderCss, renderIconSprite, VIEW_CSS, CAPTURE_CSS, DOC_CSS, FLOW_BRANCH_CSS, LIFECYCLE_CSS, BLUEPRINT_CSS, ER_CSS, FRAME_LABEL_CSS, SEQ_VIEW_CSS, } from './html-theme.js';
7
+ import { datastoreEngine, iconUse, PRODUCT_COLORS, renderCss, renderIconSprite, VIEW_CSS, CAPTURE_CSS, DOC_CSS, FLOW_BRANCH_CSS, LIFECYCLE_CSS, BLUEPRINT_CSS, ER_CSS, FRAME_LABEL_CSS, SEQ_VIEW_CSS, INFRA_CSS, VIEW_STRIP_CSS, } from './html-theme.js';
8
+ import { INFRA_CANVAS_PAD as INFRA_CANVAS_LEFT } from './infra-layout.js';
9
+ import { ICON_CREDITS } from './vendor-icons.js';
8
10
  import { EDGE_KIND_ABOUT, LANE_ABOUT, LANE_TITLES, NODE_KIND_ABOUT, STAGE_LANE_ABOUT, flowBadgeText, MICRO_HOST_SHORT, NODE_KIND_SHORT, PLATFORM_CHIP_TEXT, PLATFORM_NAME, WEB_HOSTING_CHIP_TEXT, WEB_HOSTING_NAME, platformChipText, platformName, } from './kind-text.js';
9
11
  import { compareEnvironment, FLAT_BACKWARD_EDGE_KINDS, textUnits, } from './layout.js';
10
12
  import { indexMicroApps } from './micro-app.js';
@@ -406,18 +408,28 @@ const STRIP_GAP = 12;
406
408
  /** 제목 줄과 카드, 지도와 띄우는 여백까지 합친 높이 */
407
409
  const STRIP_H = 136;
408
410
  /** 질문별 그림이 몇 개 있는지 헤더 단추를 안 눌러도 보이게 지도 위에 카드로 깐다. 섹션을 이만큼 내리고 그 위 빈자리에 둔다 */
409
- function renderViewStrip(cards) {
411
+ function renderViewStrip(cards, infra) {
412
+ const lead = infra !== undefined ? 1 : 0;
413
+ const infraItem = infra !== undefined
414
+ ? `<a class="view-card infra-card" href="#/level/${encodeURIComponent(infra.level)}" style="left:0px;width:${STRIP_CARD_W}px">` +
415
+ `<span class="vc-shape">인프라</span><b>${escapeHtml(infra.title)}</b>` +
416
+ `<span class="vc-q">${escapeHtml(infra.vendors)}</span>` +
417
+ `<span class="vc-n">항목 ${infra.nodes}, 연결 ${infra.edges}</span></a>`
418
+ : '';
410
419
  const items = cards
411
- .map((c, i) => `<a class="view-card" href="#/level/${encodeURIComponent(c.level)}" style="left:${i * (STRIP_CARD_W + STRIP_GAP)}px;width:${STRIP_CARD_W}px">` +
420
+ .map((c, i) => `<a class="view-card" href="#/level/${encodeURIComponent(c.level)}" style="left:${(i + lead) * (STRIP_CARD_W + STRIP_GAP)}px;width:${STRIP_CARD_W}px">` +
412
421
  `<span class="vc-shape">${VIEW_SHAPE_NAME[c.projection.shape]}</span>` +
413
422
  `<b>${escapeHtml(c.projection.title)}</b>` +
414
423
  `<span class="vc-q">${escapeHtml(c.projection.question)}</span>` +
415
424
  `<span class="vc-n">${c.summary !== undefined ? escapeHtml(c.summary) : `단계 ${c.steps}${c.actors > 0 ? `, 참여 ${c.actors}` : ''}`}</span></a>`)
416
425
  .join('');
426
+ // 질문별 그림만 있으면 제목이 예전 그대로여야 옛 그림 바이트가 안 바뀐다
427
+ const heading = lead === 0 ? '질문별 그림' : cards.length === 0 ? '인프라 구성' : '다른 그림';
428
+ const count = cards.length + lead;
417
429
  return {
418
- html: `<nav class="view-strip" aria-label="질문별 그림" style="left:${CANVAS_PAD_X}px;top:-${STRIP_H}px">` +
419
- `<h3>질문별 그림 <span class="n">${cards.length}</span></h3><div class="vs-row">${items}</div></nav>`,
420
- width: CANVAS_PAD_X * 2 + cards.length * (STRIP_CARD_W + STRIP_GAP) - STRIP_GAP,
430
+ html: `<nav class="view-strip" aria-label="${heading}" style="left:${CANVAS_PAD_X}px;top:-${STRIP_H}px">` +
431
+ `<h3>${heading} <span class="n">${count}</span></h3><div class="vs-row">${infraItem}${items}</div></nav>`,
432
+ width: CANVAS_PAD_X * 2 + count * (STRIP_CARD_W + STRIP_GAP) - STRIP_GAP,
421
433
  };
422
434
  }
423
435
  /**
@@ -546,7 +558,9 @@ function renderLevelSection(spec) {
546
558
  const regionNames = layout.regions
547
559
  ? ` data-regions="${escapeHtml(JSON.stringify(layout.regions.groups.map((r) => r.name)))}"`
548
560
  : '';
549
- const strip = spec.viewStrip?.length ? renderViewStrip(spec.viewStrip) : undefined;
561
+ const strip = spec.viewStrip?.length || spec.infraCard !== undefined
562
+ ? renderViewStrip(spec.viewStrip ?? [], spec.infraCard)
563
+ : undefined;
550
564
  // 카드 줄은 섹션 위 여백에 있으므로 화면 맞추기가 그 높이와 폭까지 넣어 재게 크기를 늘려 적는다
551
565
  const size = strip
552
566
  ? `data-w="${Math.max(width, strip.width)}" data-h="${height + STRIP_H}"${regionNames} style="width:${width}px;height:${height}px;margin-top:${STRIP_H}px"`
@@ -1476,6 +1490,129 @@ function renderErSection(levelId, projection, model, layout, nodeById, questions
1476
1490
  .join('');
1477
1491
  return viewSection(levelId, projection, width, height, '', links, cards);
1478
1492
  }
1493
+ const INFRA_VENDOR_NAME = {
1494
+ aws: 'AWS',
1495
+ gcp: 'Google Cloud',
1496
+ azure: 'Azure',
1497
+ };
1498
+ // 출처 한 줄이 캔버스 아래에 들어갈 자리
1499
+ const INFRA_CREDIT_H = 28;
1500
+ /** 공식 아이콘을 하나라도 받은 벤더. 출처 줄에 이 벤더만 적는다 */
1501
+ function officialVendors(infra, icons) {
1502
+ const used = new Set();
1503
+ for (const key of infra.iconKeys) {
1504
+ if (icons?.icons[key]?.source === 'official')
1505
+ used.add(key.slice(0, key.indexOf(':')));
1506
+ }
1507
+ return ['aws', 'gcp', 'azure'].filter((v) => used.has(v));
1508
+ }
1509
+ /** 인프라 레벨의 공식 아이콘 수. html 루트 data-icons와 render 응답 iconStats가 같은 수를 쓴다 */
1510
+ export function infraIconCounts(infra, icons) {
1511
+ const official = infra.iconKeys.filter((k) => icons?.icons[k]?.source === 'official').length;
1512
+ return { official, fallback: infra.iconKeys.length - official };
1513
+ }
1514
+ function infraCardOf(level, nodeById) {
1515
+ const infra = level.infra;
1516
+ const vendors = ['aws', 'gcp', 'azure'].filter((v) => infra.boxes.some((b) => b.vendor === v) || infra.tiles.some((t) => t.vendor === v));
1517
+ return {
1518
+ level: level.id,
1519
+ title: level.title,
1520
+ vendors: vendors.length > 0 ? vendors.map((v) => INFRA_VENDOR_NAME[v]).join(', ') : '클라우드 미지정',
1521
+ nodes: level.nodeIds.filter((id) => nodeById.has(id)).length,
1522
+ edges: infra.edges.length,
1523
+ };
1524
+ }
1525
+ /**
1526
+ * 인프라 레벨. 벤더 박스를 겹겹이 두르고 그 안에 아이콘 타일을 세운 뒤 직각 선으로 잇는다(stack-diagram 꼴).
1527
+ * 타일은 `.node`, 선은 `.link`라 서랍과 검색, 강조가 다른 레벨과 같이 돈다. 박스 라벨도 IR 노드면 `.node`라 누르면 서랍이 열린다
1528
+ */
1529
+ function renderInfraSection(level, nodeById, icons, maskText) {
1530
+ const infra = level.infra;
1531
+ const name = (id) => {
1532
+ const n = nodeById.get(id);
1533
+ return n ? nodeName(n) : id;
1534
+ };
1535
+ const official = (key) => {
1536
+ const hit = key !== undefined ? icons?.icons[key] : undefined;
1537
+ return hit?.source === 'official' ? hit.dataUri : undefined;
1538
+ };
1539
+ const boxName = new Map(infra.boxes.map((b) => [b.id, b.nodeId !== undefined ? name(b.nodeId) : maskText(b.label)]));
1540
+ const boxes = infra.boxes
1541
+ .map((b) => {
1542
+ const uri = official(b.iconKey);
1543
+ const cloud = b.cls.endsWith(' cloud');
1544
+ const img = uri !== undefined ? `<img src="${uri}" alt="">` : cloud ? iconUse('u-cloud') : '';
1545
+ const label = b.nodeId !== undefined ? name(b.nodeId) : maskText(b.label);
1546
+ const n = b.nodeId !== undefined ? nodeById.get(b.nodeId) : undefined;
1547
+ const head = n !== undefined
1548
+ ? `<span class="g-label node k-${displayKindOf(n)}" data-node-id="${escapeHtml(n.id)}" role="button" tabindex="0" ` +
1549
+ `aria-label="${escapeHtml(`${label}, ${NODE_KIND_TEXT[displayKindOf(n)]}`)}" title="${escapeHtml(n.displayName === undefined ? n.label : `${n.displayName}\n${n.label}`)}">`
1550
+ : `<span class="g-label">`;
1551
+ return (`<div class="group ${b.cls}${img === '' ? ' noimg' : ''}" data-box-id="${escapeHtml(maskText(b.id))}" ` +
1552
+ `style="left:${b.x}px;top:${b.y}px;width:${b.width}px;height:${b.height}px">` +
1553
+ `${head}${img}<span>${escapeHtml(label)}</span></span></div>`);
1554
+ })
1555
+ .join('');
1556
+ const links = infra.edges
1557
+ .map((e) => {
1558
+ const kindText = EDGE_KIND_TEXT[e.kind];
1559
+ const aria = `${kindText}: ${name(e.from)} → ${name(e.to)}`;
1560
+ const cls = `edge ${e.aws ? 'aws' : 'n'}${e.lineStyle === 'dashed' ? ' dash' : ''}`;
1561
+ const { x, y, anchor } = e.labelAt;
1562
+ return (`<g class="link e-${e.kind}" data-from="${escapeHtml(e.from)}" data-to="${escapeHtml(e.to)}" data-link-id="${escapeHtml(e.id)}" ` +
1563
+ `tabindex="0" role="button" aria-label="${escapeHtml(aria)}"><title>${escapeHtml(aria)}</title>` +
1564
+ `<path class="hit" d="${e.d}" stroke-width="12"/>` +
1565
+ `<path class="${cls}" data-edge-id="${escapeHtml(e.id)}" d="${e.d}" marker-end="url(#${e.aws ? 'ia-open' : 'ia-ar'})"/>` +
1566
+ `<text class="el" x="${round2(x)}" y="${round2(y)}" text-anchor="${anchor}">${escapeHtml(kindText)}</text></g>`);
1567
+ })
1568
+ .join('');
1569
+ const tiles = infra.tiles
1570
+ .map((t) => {
1571
+ const n = nodeById.get(t.id);
1572
+ if (n === undefined)
1573
+ return '';
1574
+ const dk = displayKindOf(n);
1575
+ const uri = official(t.iconKey);
1576
+ const engine = datastoreEngine(n);
1577
+ const glyph = uri !== undefined
1578
+ ? `<img src="${uri}" alt="">`
1579
+ : engine !== undefined
1580
+ ? iconUse(`e-${engine}`, `brand b-${engine}`)
1581
+ : iconUse(`i-${dk}`);
1582
+ // AWS 서비스 아이콘은 자기 배경 사각형을 품고 있어 흰 타일 없이 그린다
1583
+ const bare = uri !== undefined && t.vendor === 'aws';
1584
+ const short = chipTextOverride(n) ?? NODE_KIND_SHORT[dk];
1585
+ const role = n.engine !== undefined ? `${short} ${n.engine}` : short;
1586
+ const label = nodeName(n);
1587
+ const home = t.boxId !== undefined ? boxName.get(t.boxId) : undefined;
1588
+ const aria = `${label}, ${chipTextOverride(n) ?? NODE_KIND_TEXT[dk]}${isGuess(n) ? `, ${INFERRED_BADGE} 이름` : ''}` +
1589
+ (home !== undefined ? `, ${home} 안` : '');
1590
+ const tooltip = n.displayName === undefined ? n.label : `${n.displayName}\n${n.label}`;
1591
+ return (`<div class="node inode k-${dk}" data-node-id="${escapeHtml(n.id)}" role="button" tabindex="0" ` +
1592
+ `aria-label="${escapeHtml(aria)}" title="${escapeHtml(tooltip)}" style="left:${t.x}px;top:${t.y}px">` +
1593
+ `<span class="tile${bare ? ' bare' : ''}">${glyph}</span>` +
1594
+ `<span class="name"><span>${escapeHtml(label)}</span></span>` +
1595
+ `<span class="role"><span>${escapeHtml(role)}</span></span></div>`);
1596
+ })
1597
+ .join('');
1598
+ const credited = officialVendors(infra, icons);
1599
+ const width = infra.width;
1600
+ const height = infra.height + (credited.length > 0 ? INFRA_CREDIT_H : 0);
1601
+ const credit = credited.length > 0
1602
+ ? `<p class="infra-credit" style="left:${INFRA_CANVAS_LEFT}px;top:${infra.height}px">` +
1603
+ `아이콘: ${credited.map((v) => ICON_CREDITS[v]).join(', ')}. 상표는 각 소유자의 것이에요.</p>`
1604
+ : '';
1605
+ return (`<section class="level infra-level" data-level-id="${escapeHtml(level.id)}" aria-label="${escapeHtml(level.title)}" ` +
1606
+ `data-w="${width}" data-h="${height}" style="width:${width}px;height:${height}px" hidden>` +
1607
+ boxes +
1608
+ `<svg class="links" xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" ` +
1609
+ `role="group" aria-label="${escapeHtml(`${level.title} 연결`)}"><defs>` +
1610
+ `<marker id="ia-ar" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse">` +
1611
+ `<path d="M0 0 L10 5 L0 10 z" fill="context-stroke"/></marker>` +
1612
+ `<marker id="ia-open" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse">` +
1613
+ `<path d="M1 1 L9 5 L1 9" fill="none" stroke="context-stroke" stroke-width="1.5"/></marker></defs>` +
1614
+ `<g class="edges">${links}</g></svg>${tiles}${credit}</section>`);
1615
+ }
1479
1616
  /** 흐름 단계와 전이마다 열린 질문 수. 카드 배지에 쓴다. 전이 질문은 출발 단계에 센다 */
1480
1617
  function flowQuestionCount(questions, flows) {
1481
1618
  const fromOf = new Map(flows.flatMap((f) => f.transitions.map((t) => [t.id, t.from])));
@@ -1685,8 +1822,8 @@ function renderBar(title, drill, generatedAt, nodeCount, edgeCount, questionCoun
1685
1822
  }
1686
1823
  const clientScripts = new Map();
1687
1824
  /** 칩 글자와 설명, 레인 제목은 IR이 쓰는 팩 것만 싣는다. 팩을 더해도 그 팩을 안 쓰는 그림의 바이트가 그대로다 */
1688
- function clientScriptFor(vocab, rootFlows, views, mixedBundles, sequences, flowBranches, captures) {
1689
- const key = `${vocab.packIds.join(',')}|${rootFlows}|${views}|${mixedBundles}|${sequences}|${flowBranches}|${captures}`;
1825
+ function clientScriptFor(vocab, rootFlows, views, mixedBundles, sequences, flowBranches, captures, infra = false) {
1826
+ const key = `${vocab.packIds.join(',')}|${rootFlows}|${views}|${mixedBundles}|${sequences}|${flowBranches}|${captures}|${infra}`;
1690
1827
  const hit = clientScripts.get(key);
1691
1828
  if (hit !== undefined)
1692
1829
  return hit;
@@ -1721,6 +1858,7 @@ function clientScriptFor(vocab, rootFlows, views, mixedBundles, sequences, flowB
1721
1858
  sequences,
1722
1859
  ...(flowBranches ? { flowBranches } : {}),
1723
1860
  ...(captures ? { captures } : {}),
1861
+ ...(infra ? { infra } : {}),
1724
1862
  docs: vocab.packIds.includes('knowledge'),
1725
1863
  });
1726
1864
  clientScripts.set(key, script);
@@ -1734,7 +1872,7 @@ function renderViewsPop(views) {
1734
1872
  .join('');
1735
1873
  return `<div id="views" class="pop" role="dialog" aria-label="질문별 그림" tabindex="-1" hidden><h3>질문별 그림</h3><ul class="flow-list view-list">${items}</ul></div>`;
1736
1874
  }
1737
- function renderPage({ ir, payload, sections, drill, flows, views, mixedBundles = false, sequences = [], lifecycles = false, blueprints = false, ers = false, frameLabels = false, }) {
1875
+ function renderPage({ ir, payload, sections, drill, flows, views, mixedBundles = false, sequences = [], lifecycles = false, blueprints = false, ers = false, frameLabels = false, infra, }) {
1738
1876
  const title = viewTitle(ir);
1739
1877
  const vocab = irVocabulary(ir);
1740
1878
  const nodeById = new Map(payload.nodes.map((n) => [n.id, n]));
@@ -1752,16 +1890,18 @@ function renderPage({ ir, payload, sections, drill, flows, views, mixedBundles =
1752
1890
  const hasCaptures = ir.nodes.some((n) => n.capture !== undefined);
1753
1891
  return [
1754
1892
  '<!doctype html>',
1755
- '<html lang="ko">',
1893
+ infra !== undefined
1894
+ ? `<html lang="ko" data-icons="official:${infra.official} fallback:${infra.fallback}">`
1895
+ : '<html lang="ko">',
1756
1896
  '<head>',
1757
1897
  '<meta charset="utf-8">',
1758
1898
  '<meta name="viewport" content="width=device-width, initial-scale=1">',
1759
1899
  `<title>${escapeHtml(title)}</title>`,
1760
1900
  `<script>${THEME_BOOT_SCRIPT}</script>`,
1761
- `<style>${renderCss(vocab)}${hasViews ? `\n${VIEW_CSS}` : ''}${hasSequences ? `\n${SEQ_VIEW_CSS}` : ''}${vocab.packIds.includes('knowledge') ? `\n${DOC_CSS}` : ''}${hasCaptures ? `\n${CAPTURE_CSS}` : ''}${flowBranches || soloActor ? `\n${FLOW_BRANCH_CSS}` : ''}${lifecycles ? `\n${LIFECYCLE_CSS}` : ''}${blueprints ? `\n${BLUEPRINT_CSS}` : ''}${ers ? `\n${ER_CSS}` : ''}${frameLabels ? `\n${FRAME_LABEL_CSS}` : ''}</style>`,
1901
+ `<style>${renderCss(vocab)}${hasViews ? `\n${VIEW_CSS}` : ''}${hasSequences ? `\n${SEQ_VIEW_CSS}` : ''}${vocab.packIds.includes('knowledge') ? `\n${DOC_CSS}` : ''}${hasCaptures ? `\n${CAPTURE_CSS}` : ''}${flowBranches || soloActor ? `\n${FLOW_BRANCH_CSS}` : ''}${lifecycles ? `\n${LIFECYCLE_CSS}` : ''}${blueprints ? `\n${BLUEPRINT_CSS}` : ''}${ers ? `\n${ER_CSS}` : ''}${frameLabels ? `\n${FRAME_LABEL_CSS}` : ''}${infra !== undefined ? `${hasViews ? '' : `\n${VIEW_STRIP_CSS}`}\n${INFRA_CSS}` : ''}</style>`,
1762
1902
  '</head>',
1763
1903
  '<body>',
1764
- renderIconSprite(vocab),
1904
+ renderIconSprite(vocab, infra !== undefined ? { infra: true } : {}),
1765
1905
  renderBar(title, drill, ir.generatedAt, payload.nodes.length, payload.edges.length, payload.unresolved.length, environmentsOf(payload.nodes), hasFlows, hasViews, docCoverageOf(payload.nodes, payload.docOverlay)),
1766
1906
  '<div class="main">',
1767
1907
  '<div id="stage" class="stage" aria-label="구조도">',
@@ -1785,7 +1925,7 @@ function renderPage({ ir, payload, sections, drill, flows, views, mixedBundles =
1785
1925
  ? '<div id="flow-pop" class="pop" role="dialog" aria-label="흐름 고르기" tabindex="-1" hidden><h3>흐름</h3><ul class="flow-list"></ul></div>'
1786
1926
  : '') + (hasViews ? `\n${renderViewsPop(views)}` : ''),
1787
1927
  `<script id="ir" type="application/json">${embedJson(stableStringify(payload))}</script>`,
1788
- `<script>${clientScriptFor(vocab, hasFlows && flows.flows.some((f) => f.service === undefined), hasViews, mixedBundles, hasSequences, flowBranches, hasCaptures)}</script>`,
1928
+ `<script>${clientScriptFor(vocab, hasFlows && flows.flows.some((f) => f.service === undefined), hasViews, mixedBundles, hasSequences, flowBranches, hasCaptures, infra !== undefined)}</script>`,
1789
1929
  '</body>',
1790
1930
  '</html>',
1791
1931
  '',
@@ -1946,56 +2086,64 @@ export function renderDrilldownHtml(validated, drilldownIn, opts) {
1946
2086
  .filter(({ flow }) => flow.service === undefined)
1947
2087
  .map(({ level, flow }) => ({ level: level.id, title: flow.title }))
1948
2088
  .concat(views.map((v) => ({ level: v.level, title: v.projection.title })));
2089
+ const infraLevel = levels.find((l) => l.kind === 'infra' && l.infra !== undefined);
1949
2090
  const sections = levels
1950
- .map((l, i) => renderLevelSection({
1951
- levelId: l.id,
1952
- svgId: `canvas-${i}`,
1953
- title: l.title,
1954
- nodes: l.nodeIds.map((id) => nodeById.get(id)).filter((n) => !!n),
1955
- edges: l.edges,
1956
- layout: l.layout,
1957
- enter: drilldown.enter,
1958
- ...(l.focusId !== undefined ? { focusId: l.focusId } : {}),
1959
- hidden: l.id !== ROOT_LEVEL_ID,
1960
- services: base.services,
1961
- microHosts: new Set(base.microHosts ?? []),
1962
- ...docCover,
1963
- flows: flowCount,
1964
- ...(l.id === ROOT_LEVEL_ID && l.nodeIds.length === 0 && rootFlowLinks.length > 0
1965
- ? { emptyLinks: rootFlowLinks }
1966
- : {}),
1967
- ...(l.id === ROOT_LEVEL_ID && views.length > 0
1968
- ? {
1969
- viewStrip: views.map((v) => {
1970
- const drawn = v.projection.messages.filter((m) => drawnMessages.has(m.id));
1971
- const life = lifecycleOf(v.projection);
1972
- const bp = blueprintOf(v.projection);
1973
- const er = erOf(v.projection);
1974
- return {
1975
- ...v,
1976
- steps: drawn.length,
1977
- actors: v.projection.participants?.length ??
1978
- new Set(drawn.flatMap((m) => [m.from, m.to])).size,
1979
- ...(life !== undefined
1980
- ? {
1981
- summary: `상태 ${life.model.states.length}, 전이 ${life.model.transitions.length}`,
1982
- }
1983
- : {}),
1984
- ...(bp !== undefined
1985
- ? {
1986
- summary: `단계 ${bp.model.columns.length}, 빈 칸 ${bp.model.columns
1987
- .flatMap((c) => Object.values(c.cells))
1988
- .filter((items) => items.length === 0).length}`,
1989
- }
1990
- : {}),
1991
- ...(er !== undefined
1992
- ? { summary: `테이블 ${er.tables.length}, 외래 키 ${er.links.length}` }
1993
- : {}),
1994
- };
1995
- }),
1996
- }
1997
- : {}),
1998
- }))
2091
+ .map((l, i) => l.id === INFRA_LEVEL_ID && l.infra !== undefined
2092
+ ? renderInfraSection(l, nodeById, opts.icons, maskText)
2093
+ : renderLevelSection({
2094
+ levelId: l.id,
2095
+ svgId: `canvas-${i}`,
2096
+ title: l.title,
2097
+ nodes: l.nodeIds
2098
+ .map((id) => nodeById.get(id))
2099
+ .filter((n) => !!n),
2100
+ edges: l.edges,
2101
+ layout: l.layout,
2102
+ enter: drilldown.enter,
2103
+ ...(l.focusId !== undefined ? { focusId: l.focusId } : {}),
2104
+ hidden: l.id !== ROOT_LEVEL_ID,
2105
+ services: base.services,
2106
+ microHosts: new Set(base.microHosts ?? []),
2107
+ ...docCover,
2108
+ flows: flowCount,
2109
+ ...(l.id === ROOT_LEVEL_ID && l.nodeIds.length === 0 && rootFlowLinks.length > 0
2110
+ ? { emptyLinks: rootFlowLinks }
2111
+ : {}),
2112
+ ...(l.id === ROOT_LEVEL_ID && infraLevel !== undefined
2113
+ ? { infraCard: infraCardOf(infraLevel, nodeById) }
2114
+ : {}),
2115
+ ...(l.id === ROOT_LEVEL_ID && views.length > 0
2116
+ ? {
2117
+ viewStrip: views.map((v) => {
2118
+ const drawn = v.projection.messages.filter((m) => drawnMessages.has(m.id));
2119
+ const life = lifecycleOf(v.projection);
2120
+ const bp = blueprintOf(v.projection);
2121
+ const er = erOf(v.projection);
2122
+ return {
2123
+ ...v,
2124
+ steps: drawn.length,
2125
+ actors: v.projection.participants?.length ??
2126
+ new Set(drawn.flatMap((m) => [m.from, m.to])).size,
2127
+ ...(life !== undefined
2128
+ ? {
2129
+ summary: `상태 ${life.model.states.length}, 전이 ${life.model.transitions.length}`,
2130
+ }
2131
+ : {}),
2132
+ ...(bp !== undefined
2133
+ ? {
2134
+ summary: `단계 ${bp.model.columns.length}, 빈 칸 ${bp.model.columns
2135
+ .flatMap((c) => Object.values(c.cells))
2136
+ .filter((items) => items.length === 0).length}`,
2137
+ }
2138
+ : {}),
2139
+ ...(er !== undefined
2140
+ ? { summary: `테이블 ${er.tables.length}, 외래 키 ${er.links.length}` }
2141
+ : {}),
2142
+ };
2143
+ }),
2144
+ }
2145
+ : {}),
2146
+ }))
1999
2147
  .concat(flowLevels.map(({ level, flow }) => renderFlowSection(level, flow, questionCount, drawableNodes, captureOf, maskText)))
2000
2148
  .concat(views.map((v) => {
2001
2149
  const p = v.projection;
@@ -2045,6 +2193,7 @@ export function renderDrilldownHtml(validated, drilldownIn, opts) {
2045
2193
  ...(levels.some((l) => l.layout.frames?.some((f) => f.label !== undefined))
2046
2194
  ? { frameLabels: true }
2047
2195
  : {}),
2196
+ ...(infraLevel !== undefined ? { infra: infraIconCounts(infraLevel.infra, opts.icons) } : {}),
2048
2197
  });
2049
2198
  }
2050
2199
  //# sourceMappingURL=html-renderer.js.map