"""Generate the README artwork in the product website's visual language.
Outputs hero-*.svg, capabilities-*.svg, architecture-*.svg (per language and theme) and
icons/*.svg into the directory above this script. Colors and fonts follow
website-docs/shared/brand.css; line icons come from website-docs/homepage/app/ui.tsx.
The wordmark PNGs are docs/images/logo.png cropped, with the white ground turned
into alpha (dark variant recolors the navy lettering and keeps the gold).
python3 docs/images/readme/src/generate.py
"""
import base64, io, os
from PIL import Image, ImageFont
import numpy as np
HERE = os.path.dirname(os.path.abspath(__file__))
OUT = os.path.dirname(HERE)
os.makedirs(OUT, exist_ok=True)
THEMES = {
"light": dict(panel="#fdfcfa", card="#ffffff", rule="rgba(16,31,56,.12)", rule_soft="rgba(16,31,56,.07)",
ink="#101f38", soft="#40536f", mute="#6d7d94", gold="#b8863b", accent="#886025",
chip="#dfd1b9", chip_bg="#faf6ee", icon_bg="#f6f1e7"),
"dark": dict(panel="#0b1220", card="#101a2b", rule="rgba(190,208,232,.14)", rule_soft="rgba(190,208,232,.08)",
ink="#e6ecf5", soft="#a9b6c9", mute="#9aaac0", gold="#d9a94f", accent="#e8c176",
chip="#685638", chip_bg="#161f30", icon_bg="#1a2436"),
}
LATIN_SANS = "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI'"
LATIN_SERIF = "'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia"
CJK_SANS = {
"cn": "'PingFang SC', 'Hiragino Sans GB', 'Noto Sans CJK SC', 'Microsoft YaHei'",
"ja": "'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, 'Noto Sans CJK JP'",
"ko": "'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans CJK KR'",
}
CJK_SERIF = {
"cn": "'Songti SC', 'Source Han Serif SC', 'Noto Serif CJK SC', STSong",
"ja": "'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif CJK JP'",
"ko": "AppleMyungjo, 'Nanum Myeongjo', 'Noto Serif CJK KR'",
}
def sans(lang):
return f"{LATIN_SANS}, {CJK_SANS.get(lang, CJK_SANS['cn'])}, sans-serif"
def serif(lang):
return f"{LATIN_SERIF}, {CJK_SERIF.get(lang, CJK_SERIF['cn'])}, serif"
MONO = "'JetBrains Mono', SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace"
# Line icons copied from website-docs/homepage/app/ui.tsx (24x24, stroke).
ICONS = {
"search": '',
"agent": '',
"wiki": '',
"github": '',
"server": '',
"model": '',
}
try: # Only used to measure latin text for line wrapping.
LATIN = ImageFont.truetype("/System/Library/Fonts/Supplemental/Arial.ttf", 100)
except OSError:
LATIN = ImageFont.truetype("Arial.ttf", 100)
def is_wide(ch):
return ord(ch) >= 0x2E80
def breaks_anywhere(ch):
"""Han, kana and CJK punctuation can break between any two characters; Hangul breaks at spaces."""
return is_wide(ch) and not 0xAC00 <= ord(ch) <= 0xD7AF
def text_width(s, size, mono=False):
w = 0.0
for ch in s:
if 0xAC00 <= ord(ch) <= 0xD7AF: # Hangul syllables render narrower than Han
w += size * 0.9
elif is_wide(ch):
w += size
elif mono:
w += size * 0.6
else:
w += LATIN.getlength(ch) / 100 * size
return w
def wrap(s, size, width):
"""Greedy wrap: Han and kana break anywhere, latin and Hangul break at spaces."""
tokens, buf, group = [], "", ""
for ch in s:
if group or ch in "((": # keep a bracketed aside like (任意) on one line
if not group and buf:
tokens.append(buf); buf = ""
group += ch
if ch in "))":
tokens.append(group); group = ""
continue
if breaks_anywhere(ch):
if buf:
tokens.append(buf); buf = ""
tokens.append(ch)
elif ch == " ":
tokens.append(buf + " "); buf = ""
else:
buf += ch
if buf or group:
tokens.append(buf + group)
lines, cur = [], ""
for t in tokens:
if cur and text_width((cur + t).rstrip(), size) > width and t not in ",。、;:)」":
carry = ""
while cur and cur[-1] in "((「":
carry, cur = cur[-1] + carry, cur[:-1]
lines.append(cur.rstrip()); cur = carry + t.lstrip()
else:
cur += t
if cur:
lines.append(cur.rstrip())
return lines
def esc(s):
return s.replace("&", "&").replace("<", "<").replace(">", ">")
def icon(name, x, y, size, color, width=1.4):
k = size / 24
return (f'{ICONS[name]}')
def wordmark(theme):
img = Image.open(os.path.join(HERE, f"wordmark-{theme}.png"))
img = img.resize((452, 104), Image.LANCZOS)
buf = io.BytesIO(); img.save(buf, "PNG", optimize=True)
return "data:image/png;base64," + base64.b64encode(buf.getvalue()).decode()
COPY = {
"cn": dict(
eyebrow="TENCENT OPEN SOURCE · ACADEMY",
h1=["帮你找到答案,", "并将知识付诸实践。"], h1_size=88,
desc=["腾讯开源的企业级知识管理框架。", "汇集团队资料,用于知识问答、任务执行和 Wiki 整理。"],
highlights=["RAG 问答", "Agent 推理", "自动 Wiki", "本机浏览器", "技能与沙箱", "MCP Server", "长期记忆", "数据源与 IM"],
trust=[("github", "腾讯开源 · MIT License"), ("server", "支持私有化部署"), ("model", "自由选择模型与存储")],
cards=[
("search", "01 / RAG", "回答有据可查", "结合语义与关键词检索查找相关资料,回答附带来源引用,可打开原文核对。", ["混合检索", "多模态解析", "原文引用"]),
("agent", "02 / AGENT", "用知识和工具完成任务", "智能体根据任务检索知识库、搜索网页、调用 MCP 工具与技能,在沙箱中处理文件、运行脚本,还能操作你电脑上的浏览器,并跨会话记住你确认过的偏好。", ["多步推理", "技能与沙箱", "本机浏览器", "MCP 工具", "长期记忆"]),
("wiki", "03 / WIKI", "把文档整理成 Wiki", "从原始文档生成相互链接的 Wiki 页面与知识图谱,支持浏览、编辑和版本回滚。", ["自动组织", "知识图谱", "版本回滚"]),
],
),
"en": dict(
eyebrow="TENCENT OPEN SOURCE · ACADEMY",
h1=["Find the answers,", "and put knowledge to work."], h1_size=68,
desc=["Tencent's open-source knowledge management framework.", "Bring team documents together for Q&A, tasks and wikis."],
highlights=["RAG Q&A", "Agent reasoning", "Auto Wiki", "Local browser", "Skills & sandbox", "MCP Server", "Long-term memory", "Sources & IM"],
trust=[("github", "Tencent Open Source · MIT License"), ("server", "Self-hosted deployment"), ("model", "Your choice of models and storage")],
cards=[
("search", "01 / RAG", "Answers you can check", "Semantic and keyword search find the relevant material. Every answer cites its sources, and you can open the original to verify.", ["Hybrid search", "Multimodal parsing", "Citations"]),
("agent", "02 / AGENT", "Tasks done with knowledge and tools", "The agent searches knowledge bases and the web, calls MCP tools and skills, handles files and scripts in a sandbox, operates the browser on your computer, and remembers preferences you have confirmed.", ["Multi-step", "Skills & sandbox", "Local browser", "MCP tools", "Memory"]),
("wiki", "03 / WIKI", "Documents organized into a wiki", "Builds interlinked wiki pages and a knowledge graph from raw documents, with browsing, editing and version rollback.", ["Auto-organized", "Knowledge graph", "Rollback"]),
],
),
"ja": dict(
eyebrow="TENCENT OPEN SOURCE · ACADEMY",
h1=["答えを見つけ、", "知識を実践に活かす。"], h1_size=88,
desc=["Tencent が公開するオープンソースのエンタープライズ向けナレッジ管理フレームワーク。", "チームの資料を集約し、Q&A・タスク実行・Wiki 整理に活用します。"],
highlights=["RAG Q&A", "Agent 推論", "自動 Wiki", "ローカルブラウザ", "サンドボックス", "MCP Server", "長期メモリ", "データ連携 · IM"],
trust=[("github", "Tencent オープンソース · MIT License"), ("server", "プライベートデプロイ対応"), ("model", "モデルとストレージを自由に選択")],
cards=[
("search", "01 / RAG", "根拠のある回答", "セマンティック検索とキーワード検索を組み合わせて関連資料を探し、回答には出典が付きます。原文を開いて確認できます。", ["ハイブリッド検索", "マルチモーダル解析", "原文引用"]),
("agent", "02 / AGENT", "知識とツールでタスクを完了", "エージェントがナレッジベースや Web を検索し、MCP ツールやスキルを呼び出し、サンドボックスでファイル処理やスクリプト実行を行い、お使いのパソコンのブラウザも操作します。確認済みの好みはセッションをまたいで記憶します。", ["マルチステップ推論", "サンドボックス", "ローカルブラウザ", "MCP ツール", "長期メモリ"]),
("wiki", "03 / WIKI", "ドキュメントを Wiki に整理", "原文書から相互リンクされた Wiki ページとナレッジグラフを生成し、閲覧・編集・バージョンのロールバックに対応します。", ["自動整理", "ナレッジグラフ", "ロールバック"]),
],
),
"ko": dict(
eyebrow="TENCENT OPEN SOURCE · ACADEMY",
h1=["답을 찾고,", "지식을 실천으로."], h1_size=88,
desc=["Tencent가 오픈소스로 공개한 엔터프라이즈 지식 관리 프레임워크입니다.", "팀 자료를 모아 Q&A, 작업 실행, Wiki 정리에 활용합니다."],
highlights=["RAG Q&A", "Agent 추론", "자동 Wiki", "로컬 브라우저", "스킬과 샌드박스", "MCP Server", "장기 메모리", "데이터 소스와 IM"],
trust=[("github", "Tencent 오픈소스 · MIT License"), ("server", "프라이빗 배포 지원"), ("model", "모델과 스토리지 자유 선택")],
cards=[
("search", "01 / RAG", "근거 있는 답변", "시맨틱 검색과 키워드 검색으로 관련 자료를 찾고, 답변에 출처를 표시합니다. 원문을 열어 확인할 수 있습니다.", ["하이브리드 검색", "멀티모달 파싱", "원문 인용"]),
("agent", "02 / AGENT", "지식과 도구로 작업 완료", "에이전트가 작업에 맞춰 지식베이스와 웹을 검색하고 MCP 도구와 스킬을 호출하며, 샌드박스에서 파일을 처리하고 스크립트를 실행하고, 사용자 컴퓨터의 브라우저도 조작합니다. 확인한 선호는 세션을 넘어 기억합니다.", ["다단계 추론", "스킬과 샌드박스", "로컬 브라우저", "MCP 도구", "장기 메모리"]),
("wiki", "03 / WIKI", "문서를 Wiki로 정리", "원본 문서에서 상호 연결된 Wiki 페이지와 지식 그래프를 생성하고, 탐색·편집·버전 롤백을 지원합니다.", ["자동 정리", "지식 그래프", "버전 롤백"]),
],
),
}
def hero(lang, theme):
c, t = COPY[lang], THEMES[theme]
W = 1600
l2 = 208 + 2 * c["h1_size"] + 44
desc_y = l2 + 72
rule_y = desc_y + 42 * (len(c["desc"]) - 1) + 56
H = rule_y + 104
o = [f'")
return "\n".join(o)
def cards(lang, theme):
c, t = COPY[lang], THEMES[theme]
W, gap, pad = 1600, 28, 40
cw = (W - 2 * gap) / 3
tw = cw - 2 * pad
desc_size, title_size = 24, 33
layouts = []
for ic, label, title, desc, tags in c["cards"]:
tl = wrap(title, title_size, tw)
dl = wrap(desc, desc_size, tw)
# tag rows
rows, cur, cur_w = [], [], 0
for tag in tags:
w = text_width(tag, 20) + 32
if cur and cur_w + w > tw:
rows.append(cur); cur, cur_w = [], 0
cur.append((tag, w)); cur_w += w + 10
rows.append(cur)
layouts.append((ic, label, tl, dl, rows))
body_h = max(len(l[2]) * 44 + len(l[3]) * 40 for l in layouts)
tag_h = max(len(l[4]) for l in layouts) * 50
H = int(pad + 56 + 44 + body_h + 36 + tag_h + pad)
o = [f'")
return "\n".join(o)
# ---------------------------------------------------------------------------
# Architecture diagram
# ---------------------------------------------------------------------------
HERO_ICONS = ["search", "agent", "wiki", "browser", "sandbox", "plug", "memory", "sources"]
ICONS.update({
"memory": '',
"monitor": '',
"terminal": '',
"channels": '',
"code": '',
"plug": '',
"browser": '',
"file": '',
"sandbox": '',
"sources": '',
"shield": '',
"trace": '',
"db": '',
"chevron": '',
})
ARCH = {
"cn": dict(
heads=["客户端与渠道", "Academy 主服务", "运行时服务", "存储"],
access=[("monitor", "Web UI", "Vue 3 · HTTP / SSE"), ("terminal", "API · CLI · SDK", "API Key 按能力授权"),
("channels", "IM 频道", "企业微信 · 飞书 · Slack 等"), ("code", "网站嵌入", "Widget · 域名白名单"),
("plug", "MCP 客户端", "Streamable HTTP"), ("browser", "本机浏览器", "BrowserSkill · WebSocket")],
modes=[("search", "RAG 问答", ["查询理解", "混合检索", "重排序", "流式生成 · 引用"]),
("agent", "Agent 推理", ["ReAct 多步推理", "工具 · 技能 · MCP", "沙箱执行", "长期记忆"]),
("wiki", "自动 Wiki", ["页面生成与维护", "知识图谱", "人工编辑", "版本回滚"])],
shared="三种能力共享同一知识库",
pipeline_head="知识处理流水线",
pipeline=["导入", "解析", "分块", "向量化", "索引", "富化"],
pipeline_note="摘要、问题、图谱与标签由异步任务队列分阶段处理",
platform=[("shield", "空间与权限", "RBAC · 审计日志"), ("model", "模型目录", "27 家厂商"),
("server", "任务队列", "Worker 池治理"), ("trace", "可观测性", "Langfuse 追踪")],
services=[("file", "文档解析", "docreader · gRPC"), ("sandbox", "会话沙箱", "Docker · E2B · Cube"),
("model", "模型服务", "27 家厂商 · Ollama"), ("search", "联网搜索", "Bing · 博查 · SearXNG 等"),
("plug", "外部 MCP 服务", "工具 · OAuth2"), ("sources", "数据源", "飞书 · Confluence 等")],
stores=[("PostgreSQL", "业务数据 · BM25 · pgvector"), ("Redis", "任务队列 · 流 · 限流"),
("向量库", "ES · Qdrant · Milvus 等(可选)"), ("对象存储", "本地 · MinIO · COS · S3 等"),
("Neo4j", "知识图谱(可选)"), ("Langfuse", "链路追踪(可选)")],
),
"en": dict(
heads=["Clients and channels", "Academy app", "Runtime services", "Storage"],
access=[("monitor", "Web UI", "Vue 3 · HTTP / SSE"), ("terminal", "API · CLI · SDK", "Scoped API keys"),
("channels", "IM channels", "WeCom · Feishu · Slack …"), ("code", "Website embed", "Widget · domain allowlist"),
("plug", "MCP clients", "Streamable HTTP"), ("browser", "Local browser", "BrowserSkill · WebSocket")],
modes=[("search", "RAG Q&A", ["Query understanding", "Hybrid retrieval", "Reranking", "Cited answers"]),
("agent", "Agent reasoning", ["ReAct multi-step", "Tools · skills · MCP", "Sandbox execution", "Long-term memory"]),
("wiki", "Auto Wiki", ["Page generation", "Knowledge graph", "Manual edits", "Version rollback"])],
shared="All three share the same knowledge bases",
pipeline_head="Knowledge pipeline",
pipeline=["Ingest", "Parse", "Chunk", "Embed", "Index", "Enrich"],
pipeline_note="Summaries, questions, graph and tags run stage by stage on the async task queue",
platform=[("shield", "Workspaces", "RBAC · audit log"), ("model", "Model catalog", "27 vendors"),
("server", "Task queue", "Worker pools"), ("trace", "Observability", "Langfuse tracing")],
services=[("file", "Document parsing", "docreader · gRPC"), ("sandbox", "Session sandbox", "Docker · E2B · Cube"),
("model", "Model providers", "27 vendors · Ollama"), ("search", "Web search", "Bing · SearXNG …"),
("plug", "External MCP", "Tools · OAuth2"), ("sources", "Data sources", "Feishu · Confluence …")],
stores=[("PostgreSQL", "Data · BM25 · pgvector"), ("Redis", "Queue · streams · limits"),
("Vector store", "ES · Qdrant · Milvus … (optional)"), ("Object storage", "Local · MinIO · COS · S3 …"),
("Neo4j", "Knowledge graph (optional)"), ("Langfuse", "Tracing (optional)")],
),
"ja": dict(
heads=["クライアントとチャネル", "Academy アプリ", "ランタイムサービス", "ストレージ"],
access=[("monitor", "Web UI", "Vue 3 · HTTP / SSE"), ("terminal", "API · CLI · SDK", "スコープ付き API キー"),
("channels", "IM チャネル", "Feishu · Slack など"), ("code", "ウェブ埋め込み", "Widget · ドメイン許可"),
("plug", "MCP クライアント", "Streamable HTTP"), ("browser", "ローカルブラウザ", "BrowserSkill · WebSocket")],
modes=[("search", "RAG Q&A", ["クエリ理解", "ハイブリッド検索", "リランク", "引用付き回答"]),
("agent", "Agent 推論", ["ReAct 推論", "ツール · スキル", "サンドボックス実行", "長期メモリ"]),
("wiki", "自動 Wiki", ["ページ生成", "ナレッジグラフ", "手動編集", "ロールバック"])],
shared="3 つの機能は同じナレッジベースを共有",
pipeline_head="ナレッジ処理パイプライン",
pipeline=["取り込み", "解析", "チャンク", "埋め込み", "索引", "拡充"],
pipeline_note="要約・質問・グラフ・タグは非同期タスクキューで段階的に処理",
platform=[("shield", "ワークスペース", "RBAC · 監査ログ"), ("model", "モデルカタログ", "27 ベンダー"),
("server", "タスクキュー", "Worker プール"), ("trace", "可観測性", "Langfuse トレース")],
services=[("file", "文書解析", "docreader · gRPC"), ("sandbox", "サンドボックス", "Docker · E2B · Cube"),
("model", "モデル", "27 ベンダー · Ollama"), ("search", "Web 検索", "Bing · SearXNG など"),
("plug", "外部 MCP", "ツール · OAuth2"), ("sources", "データソース", "Feishu · Confluence など")],
stores=[("PostgreSQL", "業務データ · BM25 · pgvector"), ("Redis", "タスクキュー · ストリーム"),
("ベクトル DB", "ES · Qdrant · Milvus など(任意)"), ("オブジェクト ストレージ", "ローカル · MinIO · COS · S3 など"),
("Neo4j", "ナレッジグラフ(任意)"), ("Langfuse", "トレーシング(任意)")],
),
"ko": dict(
heads=["클라이언트와 채널", "Academy 앱", "런타임 서비스", "스토리지"],
access=[("monitor", "Web UI", "Vue 3 · HTTP / SSE"), ("terminal", "API · CLI · SDK", "범위 지정 API 키"),
("channels", "IM 채널", "Feishu · Slack 등"), ("code", "웹사이트 임베드", "Widget · 도메인 허용"),
("plug", "MCP 클라이언트", "Streamable HTTP"), ("browser", "로컬 브라우저", "BrowserSkill · WebSocket")],
modes=[("search", "RAG Q&A", ["질의 이해", "하이브리드 검색", "재순위", "인용 포함 답변"]),
("agent", "Agent 추론", ["ReAct 추론", "도구 · 스킬 · MCP", "샌드박스 실행", "장기 메모리"]),
("wiki", "자동 Wiki", ["페이지 생성", "지식 그래프", "수동 편집", "버전 롤백"])],
shared="세 기능은 같은 지식베이스를 공유",
pipeline_head="지식 처리 파이프라인",
pipeline=["가져오기", "파싱", "청킹", "임베딩", "인덱싱", "보강"],
pipeline_note="요약·질문·그래프·태그는 비동기 작업 큐에서 단계별로 처리",
platform=[("shield", "워크스페이스", "RBAC · 감사 로그"), ("model", "모델 카탈로그", "27개 벤더"),
("server", "작업 큐", "Worker 풀"), ("trace", "관측 가능성", "Langfuse 추적")],
services=[("file", "문서 파싱", "docreader · gRPC"), ("sandbox", "샌드박스", "Docker · E2B · Cube"),
("model", "모델", "27개 벤더 · Ollama"), ("search", "웹 검색", "Bing · SearXNG 등"),
("plug", "외부 MCP", "도구 · OAuth2"), ("sources", "데이터 소스", "Feishu · Confluence 등")],
stores=[("PostgreSQL", "업무 데이터 · BM25 · pgvector"), ("Redis", "작업 큐 · 스트림"),
("벡터 DB", "ES · Qdrant · Milvus 등(선택)"), ("오브젝트 스토리지", "로컬 · MinIO · COS · S3 등"),
("Neo4j", "지식 그래프(선택)"), ("Langfuse", "추적(선택)")],
),
}
EYEBROWS = ["01 / ACCESS", "02 / ACADEMY APP", "03 / SERVICES", "04 / STORAGE"]
def wrap_sep(s, size, width, sep=" · "):
"""Wrap at " · " separators first; fall back to wrap() for a segment that is too long on its own."""
lines, cur = [], ""
for seg in s.split(sep):
cand = seg if not cur else cur + sep + seg
if cur and text_width(cand, size) > width:
lines.append(cur + sep.rstrip())
cur = seg
else:
cur = cand
lines.append(cur)
out = []
for line in lines:
out.extend(wrap(line, size, width) if text_width(line, size) > width else [line])
return out
def fit(label, text, size, width):
if text_width(text, size) > width:
print(f" warn: {label!r} is {text_width(text, size):.0f}px, wider than {width}px")
def architecture(lang, theme):
c, t = ARCH[lang], THEMES[theme]
S, M = sans(lang), MONO
W = 1600
ax, aw = 40, 340 # access column
cx, cw = 420, 760 # core panel
sx, sw = 1220, 340 # services column
top = 40
item_h, item_gap, items_y = 88, 12, top + 118
col_h = 118 + 6 * item_h + 5 * item_gap + 26
o = []
def panel(x, y, w, h, eyebrow, head, meta=None):
o.append(f'')
o.append(f'{eyebrow}')
o.append(f'{esc(head)}')
if meta:
o.append(f'{meta}')
def item_list(x, w, rows):
centers = []
for i, (ic, name, sub) in enumerate(rows):
y = items_y + i * (item_h + item_gap)
fit(name, name, 22, w - 40 - 80 - 12)
fit(sub, sub, 17, w - 40 - 80 - 12)
o.extend([
f'',
f'',
icon(ic, x + 46, y + 30, 28, t["gold"], 1.6),
f'{esc(name)}',
f'{esc(sub)}',
])
centers.append(y + item_h / 2)
return centers
def arrowhead(x, y, direction):
d = {"right": f"M{x-9} {y-6}L{x} {y}L{x-9} {y+6}", "down": f"M{x-6} {y-9}L{x} {y}L{x+6} {y-9}",
"up": f"M{x-6} {y+9}L{x} {y}L{x+6} {y+9}"}[direction]
return f''
line = lambda d: f''
dot = lambda x, y: f''
# 01 access and 03 services
panel(ax, top, aw, col_h, EYEBROWS[0], c["heads"][0])
a_centers = item_list(ax, aw, c["access"])
panel(sx, top, sw, col_h, EYEBROWS[2], c["heads"][2])
s_centers = item_list(sx, sw, c["services"])
# 02 core panel
panel(cx, top, cw, col_h, EYEBROWS[1], c["heads"][1], meta="GO · GIN · ASYNQ")
pad, gap = 20, 16
mw = (cw - 2 * pad - 2 * gap) / 3
my = top + 118
mode_lines = [[l2 for l in lines for l2 in wrap_sep(l, 20, mw - 40)] for _, _, lines in c["modes"]]
mh = 132 + max(len(ls) for ls in mode_lines) * 30
mode_centers = []
for i, ((ic, title, _), lines) in enumerate(zip(c["modes"], mode_lines)):
x = cx + pad + i * (mw + gap)
fit(title, title, 24, mw - 40)
o.extend([
f'',
f'',
icon(ic, x + 30, my + 30, 28, t["gold"], 1.6),
f'{esc(title)}',
])
for j, l in enumerate(lines):
o.append(f'{esc(l)}')
mode_centers.append(x + mw / 2)
# knowledge pipeline, feeding all three modes
py = my + mh + 64
px, pw = cx + pad, cw - 2 * pad
ph = 158
o.append(f'')
for mx in mode_centers:
o.append(line(f"M{mx} {py}V{my+mh+4}"))
o.append(arrowhead(mx, my + mh + 4, "up"))
shared_w = text_width(c["shared"], 18) + 36
o.extend([
f'',
f'{esc(c["shared"])}',
f'{esc(c["pipeline_head"])}',
])
n, cg = len(c["pipeline"]), 26
chw = (pw - 40 - (n - 1) * cg) / n
for i, step in enumerate(c["pipeline"]):
x = px + 20 + i * (chw + cg)
fit(step, step, 20, chw - 12)
o.extend([
f'',
f'{esc(step)}',
])
if i < n - 1:
o.append(icon("chevron", x + chw + cg / 2 - 9, py + 69, 18, t["gold"], 2))
fit("note", c["pipeline_note"], 17, pw - 40)
o.append(f'{esc(c["pipeline_note"])}')
# platform capabilities, 2 x 2
ly = py + ph + 16
lg = 12
lh = (top + col_h - 20 - ly - lg) / 2
lw = (pw - lg) / 2
for i, (ic, name, sub) in enumerate(c["platform"]):
x = px + (i % 2) * (lw + lg)
y = ly + (i // 2) * (lh + lg)
nw = text_width(name, 20)
fit(name + sub, name + " " + sub, 19, lw - 70)
o.extend([
f'',
icon(ic, x + 18, y + lh / 2 - 13, 26, t["gold"], 1.6),
f'{esc(name)}',
f'{esc(sub)}',
])
# connectors: access -> core, core -> services
bus_a = ax + aw + 18
for y in a_centers:
o.append(line(f"M{ax+aw-20} {y}H{bus_a}"))
o.append(line(f"M{bus_a} {a_centers[0]}V{a_centers[-1]}"))
mid = my + mh / 2
o.append(line(f"M{bus_a} {mid}H{cx-3}"))
o.extend([arrowhead(cx - 3, mid, "right"), dot(bus_a, mid)])
bus_s = sx - 18
o.append(line(f"M{cx+cw+3} {mid}H{bus_s}"))
o.append(line(f"M{bus_s} {s_centers[0]}V{s_centers[-1]}"))
o.append(dot(bus_s, mid))
for y in s_centers:
o.append(line(f"M{bus_s} {y}H{sx+17}"))
o.append(arrowhead(sx + 17, y, "right"))
# 04 storage
gy = top + col_h + 50
tx0, tg = ax + 230, 14
tw = (W - ax - 20 - tx0 - 5 * tg) / 6
tiles = [(wrap_sep(n, 21, tw - 60, sep=" "), wrap_sep(sub, 17, tw - 36)) for n, sub in c["stores"]]
tile_h = max(38 + len(nl) * 26 + 8 + (len(sl) - 1) * 24 + 26 for nl, sl in tiles)
gh = max(176, tile_h + 40)
o.append(f'')
o.append(f'{EYEBROWS[3]}')
o.append(f'{esc(c["heads"][3])}')
for i, (name_lines, sub_lines) in enumerate(tiles):
x = tx0 + i * (tw + tg)
ty = gy + 20
o.extend([
f'',
icon("db", x + 18, ty + 18, 24, t["gold"], 1.6),
])
for j, l in enumerate(name_lines):
o.append(f'{esc(l)}')
base = ty + 38 + len(name_lines) * 26 + 8
for j, l in enumerate(sub_lines):
o.append(f'{esc(l)}')
# core -> storage
x0 = cx + cw / 2
o.append(line(f"M{x0} {top+col_h+3}V{gy+17}"))
o.append(arrowhead(x0, gy + 17, "down"))
H = gy + gh + 40
head = (f'"
for lang in ARCH:
for theme in THEMES:
print(f"architecture {lang} {theme}")
open(f"{OUT}/architecture-{lang}-{theme}.svg", "w").write(architecture(lang, theme))
for lang in COPY:
for theme in THEMES:
open(f"{OUT}/hero-{lang}-{theme}.svg", "w").write(hero(lang, theme))
open(f"{OUT}/capabilities-{lang}-{theme}.svg", "w").write(cards(lang, theme))
print("ok")
# Small gold line icons for README tables; the gold reads on both GitHub themes.
TABLE_ICONS = {
"terminal": '',
"plug": '',
"phone": '',
"skills": '',
"code": '',
"braces": '',
"server": ICONS["server"],
}
os.makedirs(f"{OUT}/icons", exist_ok=True)
for name, body in TABLE_ICONS.items():
open(f"{OUT}/icons/{name}.svg", "w").write(
f'\n')