- write-notes-like-deepseek 从三个子仓库的重复副本改为 meta 唯一副本 - 新增 .agents/scripts/verify-notes.ts,从 meta 视角一次校验四个笔记根 - workspace-layout 补「共有技能单一来源」的落位与理由 - .rgignore 排除 archived 历史快照
1779 lines
73 KiB
HTML
1779 lines
73 KiB
HTML
<!doctype html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="generator" content="agent-notes-board">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>工程决策看板</title>
|
||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;0,700;1,400&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap" rel="stylesheet">
|
||
<style>
|
||
:root {
|
||
--bg-base: #F8FAFC;
|
||
--bg-surface: #FFFFFF;
|
||
--bg-surface-raised: #FFFFFF;
|
||
--bg-surface-subtle: #F1F5F9;
|
||
--border-subtle: #F1F5F9;
|
||
--border-normal: #E2E8F0;
|
||
--border-focus: #1D4ED8;
|
||
|
||
--text-pure: #0A0E1A;
|
||
--text-primary: #0F172A;
|
||
--text-secondary: #475569;
|
||
--text-tertiary: #94A3B8;
|
||
--text-mono-faint: #CBD5E1;
|
||
|
||
--brand-blue: #1D4ED8;
|
||
--brand-blue-hover: #2563EB;
|
||
--brand-blue-glow: rgba(29, 78, 216, 0.12);
|
||
--alert-ruby: #DC2626;
|
||
--alert-ruby-subtle: #FEF2F2;
|
||
--amber-core: #D97706;
|
||
--emerald-live: #059669;
|
||
--purple-meta: #7C3AED;
|
||
--teal-prune: #0D9488;
|
||
|
||
--font-display: "Space Grotesk", -apple-system, sans-serif;
|
||
--font-body: "Plus Jakarta Sans", -apple-system, "PingFang SC", sans-serif;
|
||
--font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
|
||
|
||
--radius-sm: 4px;
|
||
--radius-md: 8px;
|
||
--radius-lg: 12px;
|
||
}
|
||
|
||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||
|
||
/* 瑞士工程图纸微网格背景 */
|
||
body {
|
||
background-color: var(--bg-base);
|
||
background-image:
|
||
linear-gradient(to right, rgba(15, 23, 42, 0.035) 1px, transparent 1px),
|
||
linear-gradient(to bottom, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
|
||
background-size: 28px 28px;
|
||
color: var(--text-primary);
|
||
font: 14px/1.6 var(--font-body);
|
||
-webkit-font-smoothing: antialiased;
|
||
min-height: 100vh;
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow-x: hidden;
|
||
}
|
||
|
||
/* 顶栏 HUD(磨砂象牙白) */
|
||
header.hud-topbar {
|
||
position: sticky; top: 0; z-index: 50;
|
||
height: 64px; background: rgba(255, 255, 255, 0.88);
|
||
backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
|
||
border-bottom: 1px solid var(--border-normal);
|
||
padding: 0 32px; display: flex; align-items: center; gap: 24px;
|
||
box-shadow: 0 1px 4px rgba(15, 23, 42, 0.03);
|
||
}
|
||
|
||
.brand-group { display: flex; align-items: center; gap: 12px; }
|
||
.brand-logo {
|
||
width: 32px; height: 32px; border-radius: 6px;
|
||
background: #0F172A; border: 1px solid #0F172A;
|
||
display: flex; align-items: center; justify-content: center;
|
||
position: relative; box-shadow: 0 2px 6px rgba(15,23,42,0.15);
|
||
}
|
||
.brand-logo::before {
|
||
content: ''; position: absolute; width: 8px; height: 8px;
|
||
background: #60A5FA; border-radius: 50%;
|
||
}
|
||
.brand-text {
|
||
font-family: var(--font-display); font-size: 16px; font-weight: 700;
|
||
color: #0F172A; letter-spacing: -0.3px; display: flex; align-items: center; gap: 8px;
|
||
}
|
||
.telemetry-chip {
|
||
font-family: var(--font-mono); font-size: 11px; padding: 2px 8px;
|
||
background: #F1F5F9; border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-sm); color: var(--text-secondary); font-weight: 600;
|
||
}
|
||
|
||
/* 导航控制器 Deck Tabs */
|
||
nav.deck-tabs {
|
||
display: flex; gap: 4px; background: #F1F5F9;
|
||
padding: 3px; border-radius: var(--radius-md); border: 1px solid var(--border-normal);
|
||
}
|
||
.deck-tab {
|
||
border: 0; background: transparent; color: var(--text-secondary);
|
||
font-family: var(--font-display); font-size: 13px; font-weight: 600;
|
||
padding: 6px 16px; border-radius: var(--radius-sm); cursor: pointer;
|
||
transition: all .18s cubic-bezier(0.16, 1, 0.3, 1);
|
||
display: flex; align-items: center; gap: 8px; position: relative;
|
||
}
|
||
.deck-tab:hover { color: #0F172A; background: rgba(255,255,255,0.6); }
|
||
.deck-tab.active {
|
||
color: #0F172A; background: #FFFFFF;
|
||
box-shadow: 0 1px 3px rgba(15,23,42,0.08);
|
||
}
|
||
.deck-tab.active::after {
|
||
content: ''; position: absolute; bottom: -1px; left: 20%; right: 20%;
|
||
height: 2px; background: var(--brand-blue);
|
||
}
|
||
|
||
.hud-grow { flex: 1; }
|
||
|
||
/* 战术全局搜索框 */
|
||
.hud-search { position: relative; width: 260px; }
|
||
.hud-search input {
|
||
width: 100%; height: 36px; background: #FFFFFF;
|
||
border: 1px solid var(--border-normal); border-radius: var(--radius-sm);
|
||
color: #0F172A; font-family: var(--font-mono); font-size: 12.5px;
|
||
padding: 0 34px 0 34px; outline: none; transition: all .2s;
|
||
}
|
||
.hud-search input:focus {
|
||
width: 320px; border-color: var(--brand-blue); background: #FFFFFF;
|
||
box-shadow: 0 0 0 3px var(--brand-blue-glow);
|
||
}
|
||
.hud-search .search-ico {
|
||
position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
|
||
color: var(--text-tertiary); pointer-events: none;
|
||
}
|
||
.hud-search .shortcut-key {
|
||
position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
|
||
font-family: var(--font-mono); font-size: 10px; color: var(--text-tertiary);
|
||
background: #F1F5F9; padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border-normal);
|
||
}
|
||
|
||
/* 即时搜索下拉浮窗 */
|
||
.search-popover {
|
||
position: absolute; top: calc(100% + 8px); left: 0; width: 440px;
|
||
background: #FFFFFF; border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-md); box-shadow: 0 12px 36px rgba(15,23,42,0.14);
|
||
max-height: 420px; overflow-y: auto; z-index: 100; display: none;
|
||
flex-direction: column; padding: 4px 0;
|
||
}
|
||
.search-popover.open { display: flex; animation: viewIn .15s ease-out; }
|
||
.popover-item {
|
||
padding: 10px 14px; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
|
||
gap: 12px; transition: background .12s; border-bottom: 1px solid #F8FAFC;
|
||
}
|
||
.popover-item:hover, .popover-item.selected { background: #EFF6FF; }
|
||
.popover-item-main { flex: 1; min-width: 0; }
|
||
.popover-title {
|
||
font-size: 13px; font-weight: 600; color: #0F172A;
|
||
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px;
|
||
}
|
||
.popover-sub {
|
||
font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary);
|
||
display: flex; align-items: center; gap: 8px;
|
||
}
|
||
.popover-empty {
|
||
padding: 24px; text-align: center; color: var(--text-tertiary);
|
||
font-family: var(--font-mono); font-size: 12px;
|
||
}
|
||
.popover-footer {
|
||
padding: 8px 14px; font-family: var(--font-mono); font-size: 11px;
|
||
color: var(--text-tertiary); background: #F8FAFC; border-top: 1px solid var(--border-normal);
|
||
display: flex; justify-content: space-between; align-items: center;
|
||
}
|
||
|
||
/* 本地雷达自动同步指示器 */
|
||
.sync-beacon {
|
||
display: flex; align-items: center; gap: 10px;
|
||
background: #FFFFFF; border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-sm); padding: 6px 14px; font-size: 12px;
|
||
font-family: var(--font-mono); color: var(--text-secondary); cursor: pointer;
|
||
transition: all .2s; user-select: none; box-shadow: 0 1px 2px rgba(15,23,42,0.04);
|
||
}
|
||
.sync-beacon:hover { border-color: var(--brand-blue); color: #0F172A; box-shadow: 0 0 0 3px var(--brand-blue-glow); }
|
||
.radar-dot {
|
||
width: 8px; height: 8px; border-radius: 50%; background: #94A3B8; position: relative;
|
||
}
|
||
.radar-dot.active { background: var(--emerald-live); }
|
||
.radar-dot.active::after {
|
||
content: ''; position: absolute; inset: -4px; border-radius: 50%;
|
||
border: 1px solid var(--emerald-live); animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
|
||
}
|
||
.radar-dot.syncing { background: var(--amber-core); }
|
||
@keyframes ping { 75%, 100% { transform: scale(2.2); opacity: 0; } }
|
||
|
||
/* 主视口布局 */
|
||
main.mission-canvas {
|
||
max-width: 1440px; width: 100%; margin: 0 auto; padding: 28px 36px 80px;
|
||
flex: 1; display: flex; flex-direction: column; gap: 28px;
|
||
}
|
||
|
||
.canvas-view { display: none; }
|
||
.canvas-view.active { display: block; animation: viewIn .25s ease-out; }
|
||
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
|
||
|
||
/* 实体白皮书面板 */
|
||
.hud-panel {
|
||
background: var(--bg-surface); border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-md); padding: 24px 28px; position: relative;
|
||
box-shadow: 0 1px 3px rgba(15,23,42,0.04), 0 6px 16px rgba(15,23,42,0.03);
|
||
overflow: hidden;
|
||
}
|
||
.panel-masthead {
|
||
display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px;
|
||
}
|
||
.panel-headline {
|
||
font-family: var(--font-display); font-size: 16px; font-weight: 700;
|
||
color: #0F172A; letter-spacing: -0.2px; display: flex; align-items: center; gap: 10px;
|
||
}
|
||
.panel-annotation {
|
||
font-family: var(--font-mono); font-size: 11.5px; color: var(--text-tertiary);
|
||
}
|
||
|
||
/* KPI 战术度量仪表阵列 */
|
||
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
|
||
@media (max-width: 960px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
|
||
.kpi-instrument {
|
||
background: var(--bg-surface); border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-md); padding: 20px 24px; cursor: pointer;
|
||
transition: all .2s; position: relative; overflow: hidden;
|
||
box-shadow: 0 1px 3px rgba(15,23,42,0.04), 0 4px 12px rgba(15,23,42,0.02);
|
||
}
|
||
.kpi-instrument:hover {
|
||
border-color: var(--brand-blue); transform: translateY(-2px);
|
||
box-shadow: 0 6px 20px rgba(15,23,42,0.08);
|
||
}
|
||
.kpi-tag {
|
||
font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary);
|
||
display: flex; align-items: center; justify-content: space-between; font-weight: 600;
|
||
}
|
||
.kpi-num {
|
||
font-family: var(--font-display); font-size: 38px; font-weight: 700;
|
||
color: #0F172A; line-height: 1.1; margin: 10px 0 6px; letter-spacing: -1px;
|
||
}
|
||
.kpi-caption { font-size: 12.5px; color: var(--text-tertiary); }
|
||
.kpi-accent-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; }
|
||
|
||
/* 核心承重墙网格(Structural Pillars) */
|
||
.pillars-vault { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin-bottom: 28px; }
|
||
.pillar-specimen {
|
||
background: #FFFFFF; border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-sm); padding: 18px; cursor: pointer;
|
||
transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
|
||
display: flex; flex-direction: column; justify-content: space-between; position: relative;
|
||
box-shadow: 0 1px 2px rgba(15,23,42,0.04);
|
||
}
|
||
.pillar-specimen:hover {
|
||
border-color: var(--brand-blue); transform: translateY(-2px);
|
||
box-shadow: 0 8px 24px rgba(29, 78, 216, 0.08);
|
||
}
|
||
.pillar-specimen::after {
|
||
content: ''; position: absolute; right: 12px; top: 12px;
|
||
width: 6px; height: 6px; border-radius: 50%; background: var(--amber-core);
|
||
}
|
||
.pillar-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
|
||
.pillar-core-title {
|
||
font-family: var(--font-display); font-size: 15px; font-weight: 700;
|
||
color: #0F172A; line-height: 1.35; margin-bottom: 10px;
|
||
}
|
||
.pillar-abstract {
|
||
font-size: 13px; color: var(--text-secondary); line-height: 1.6;
|
||
margin-bottom: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
|
||
}
|
||
.pillar-telemetry {
|
||
display: flex; align-items: center; justify-content: space-between;
|
||
font-family: var(--font-mono); font-size: 11.5px; color: var(--text-tertiary);
|
||
border-top: 1px solid var(--border-subtle); padding-top: 10px; margin-top: auto;
|
||
}
|
||
.weight-gauge {
|
||
color: var(--brand-blue); font-weight: 700; background: #EFF6FF;
|
||
border: 1px solid #BFDBFE; border-radius: 3px; padding: 2px 7px;
|
||
}
|
||
|
||
/* 领域分类矩阵(Domain Matrix) */
|
||
.matrix-chambers {
|
||
display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
|
||
gap: 18px; width: 100%;
|
||
}
|
||
@media (max-width: 1200px) { .matrix-chambers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
||
@media (max-width: 768px) { .matrix-chambers { grid-template-columns: minmax(0, 1fr); } }
|
||
.chamber-pod {
|
||
background: #F8FAFC; border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-sm); padding: 16px; min-width: 0; overflow: hidden;
|
||
}
|
||
.chamber-header {
|
||
display: flex; align-items: center; justify-content: space-between;
|
||
padding-bottom: 10px; border-bottom: 1px solid var(--border-normal); margin-bottom: 12px;
|
||
}
|
||
.chamber-name {
|
||
font-family: var(--font-display); font-size: 13.5px; font-weight: 700;
|
||
color: #0F172A; display: flex; align-items: center; gap: 8px;
|
||
}
|
||
.chamber-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); font-weight: 600; }
|
||
.chamber-stream {
|
||
display: flex; flex-direction: column; gap: 8px; max-height: 420px;
|
||
overflow-y: auto; min-width: 0; width: 100%; padding-right: 4px;
|
||
}
|
||
.chamber-stream::-webkit-scrollbar { width: 4px; }
|
||
.chamber-stream::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
|
||
.chamber-stream::-webkit-scrollbar-track { background: transparent; }
|
||
|
||
.specimen-row {
|
||
flex-shrink: 0; /* 绝对禁止压扁 */
|
||
min-height: 54px; display: flex; flex-direction: column; justify-content: center;
|
||
background: #FFFFFF; border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; transition: all .15s;
|
||
box-shadow: 0 1px 2px rgba(15,23,42,0.02); min-width: 0; width: 100%; box-sizing: border-box;
|
||
}
|
||
.specimen-row:hover {
|
||
border-color: var(--brand-blue); transform: translateX(2px);
|
||
box-shadow: 0 2px 8px rgba(15,23,42,0.06);
|
||
}
|
||
.specimen-title {
|
||
font-size: 13px; font-weight: 600; color: #0F172A; line-height: 1.4; margin-bottom: 4px;
|
||
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%;
|
||
}
|
||
.specimen-info {
|
||
font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); line-height: 1.2;
|
||
display: flex; align-items: center; justify-content: space-between; width: 100%;
|
||
}
|
||
|
||
/* 时间线筛选工具栏 */
|
||
.timeline-toolbar {
|
||
display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px;
|
||
background: #F8FAFC; border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-sm); padding: 14px 18px;
|
||
}
|
||
.filter-row {
|
||
display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: 100%;
|
||
}
|
||
.filter-group-label {
|
||
font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary);
|
||
font-weight: 700; display: flex; align-items: center; gap: 6px; flex-shrink: 0; min-width: 76px;
|
||
}
|
||
.month-pills, .class-pills {
|
||
display: flex; gap: 6px; overflow-x: auto; max-width: calc(100% - 90px); padding-bottom: 2px;
|
||
}
|
||
.month-pill, .class-pill {
|
||
border: 1px solid var(--border-normal); background: #FFFFFF;
|
||
color: var(--text-secondary); font-family: var(--font-mono); font-size: 11px;
|
||
font-weight: 600; padding: 3px 9px; border-radius: 4px; cursor: pointer;
|
||
transition: all .15s; white-space: nowrap;
|
||
}
|
||
.month-pill:hover, .class-pill:hover { border-color: var(--brand-blue); color: var(--brand-blue); }
|
||
.month-pill.active {
|
||
background: var(--brand-blue); border-color: var(--brand-blue);
|
||
color: #FFFFFF; box-shadow: 0 1px 4px rgba(29,78,216,0.25);
|
||
}
|
||
.class-pill.active {
|
||
background: #0F172A; border-color: #0F172A;
|
||
color: #FFFFFF; box-shadow: 0 1px 4px rgba(15,23,42,0.2);
|
||
}
|
||
.filter-summary-bar {
|
||
display: flex; align-items: center; justify-content: space-between;
|
||
border-top: 1px solid var(--border-subtle); padding-top: 8px; margin-top: 2px;
|
||
font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary);
|
||
}
|
||
|
||
/* 时间线 Chrono-Track */
|
||
.chrono-track { position: relative; padding-left: 36px; }
|
||
.chrono-track::before {
|
||
content: ''; position: absolute; left: 11px; top: 12px; bottom: 12px; width: 2px;
|
||
background: linear-gradient(180deg, var(--brand-blue) 0%, rgba(15, 23, 42, 0.1) 100%);
|
||
}
|
||
.chrono-node-epoch { margin-bottom: 36px; position: relative; }
|
||
.chrono-epoch-badge {
|
||
font-family: var(--font-mono); font-size: 12px; font-weight: 700;
|
||
background: #FFFFFF; border: 1px solid var(--border-normal); color: var(--brand-blue);
|
||
padding: 4px 14px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; gap: 8px;
|
||
margin-left: -36px; margin-bottom: 16px; box-shadow: 0 2px 6px rgba(15,23,42,0.06);
|
||
}
|
||
.chrono-cards { display: flex; flex-direction: column; gap: 14px; }
|
||
.chrono-card {
|
||
background: #FFFFFF; border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-sm); padding: 18px 22px; cursor: pointer;
|
||
transition: all .2s; position: relative; box-shadow: 0 1px 3px rgba(15,23,42,0.03);
|
||
}
|
||
.chrono-card:hover {
|
||
border-color: var(--brand-blue); transform: translateX(4px);
|
||
box-shadow: 0 6px 20px rgba(15,23,42,0.06);
|
||
}
|
||
.chrono-pulse {
|
||
position: absolute; left: -31px; top: 24px; width: 10px; height: 10px;
|
||
border-radius: 50%; background: #FFFFFF; border: 2px solid var(--brand-blue);
|
||
}
|
||
.chrono-date-badge {
|
||
font-family: var(--font-mono); font-size: 11.5px; font-weight: 700;
|
||
color: #1D4ED8; background: #EFF6FF; border: 1px solid #BFDBFE;
|
||
padding: 2px 8px; border-radius: 4px; display: inline-flex; align-items: center; gap: 4px;
|
||
flex-shrink: 0;
|
||
}
|
||
.chrono-meta-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
|
||
.chrono-date { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-tertiary); }
|
||
.chrono-heading { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: #0F172A; }
|
||
.chrono-body { font-size: 13.5px; color: var(--text-secondary); line-height: 1.6; }
|
||
|
||
/* 避坑与反思智库(Pitfalls Vault) */
|
||
.alt-controls { display: flex; gap: 14px; margin-bottom: 24px; align-items: center; flex-wrap: wrap; }
|
||
.alt-search-input {
|
||
flex: 1; min-width: 280px; height: 40px; background: #FFFFFF;
|
||
border: 1px solid var(--border-normal); border-radius: var(--radius-sm);
|
||
color: #0F172A; font-family: var(--font-mono); font-size: 13px; padding: 0 16px; outline: none;
|
||
box-shadow: 0 1px 2px rgba(15,23,42,0.03);
|
||
}
|
||
.alt-search-input:focus { border-color: var(--alert-ruby); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12); }
|
||
|
||
.pitfalls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 18px; }
|
||
.pitfall-dossier {
|
||
background: #FFFFFF; border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-sm); padding: 22px; display: flex; flex-direction: column;
|
||
justify-content: space-between; gap: 14px; cursor: pointer; transition: all .2s;
|
||
box-shadow: 0 1px 3px rgba(15,23,42,0.03);
|
||
}
|
||
.pitfall-dossier:hover {
|
||
border-color: var(--alert-ruby); transform: translateY(-2px);
|
||
box-shadow: 0 8px 24px rgba(220, 38, 38, 0.08);
|
||
}
|
||
.hazard-banner {
|
||
background: var(--alert-ruby-subtle); border-left: 3px solid var(--alert-ruby);
|
||
padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: #991B1B;
|
||
}
|
||
.crux-evidence { font-size: 13px; color: var(--text-secondary); line-height: 1.65; }
|
||
.triumphant-verdict {
|
||
background: #ECFDF5; border: 1px solid #A7F3D0;
|
||
border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12px; color: #065F46;
|
||
display: flex; align-items: center; gap: 8px; font-weight: 600;
|
||
}
|
||
|
||
/* 决策档案目录(Directory Matrix) */
|
||
.matrix-toolbar {
|
||
display: flex; align-items: center; gap: 12px; background: #FFFFFF;
|
||
border: 1px solid var(--border-normal); border-radius: var(--radius-sm); padding: 12px 18px; margin-bottom: 16px;
|
||
box-shadow: 0 1px 2px rgba(15,23,42,0.03);
|
||
}
|
||
.matrix-toolbar select {
|
||
height: 34px; background: #F8FAFC; border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-sm); color: #0F172A; font-family: var(--font-mono); font-size: 12px;
|
||
padding: 0 12px; outline: none; cursor: pointer; font-weight: 500;
|
||
}
|
||
.matrix-board {
|
||
background: #FFFFFF; border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-md); overflow: hidden;
|
||
box-shadow: 0 1px 3px rgba(15,23,42,0.04), 0 4px 12px rgba(15,23,42,0.02);
|
||
}
|
||
.matrix-row-head, .matrix-row-cell {
|
||
display: grid; grid-template-columns: 80px 110px 1fr 110px 120px 70px;
|
||
gap: 14px; align-items: center; padding: 0 24px;
|
||
}
|
||
.matrix-row-head {
|
||
height: 42px; background: #F8FAFC; font-family: var(--font-mono);
|
||
font-size: 11.5px; color: var(--text-secondary); border-bottom: 1px solid var(--border-normal);
|
||
font-weight: 600;
|
||
}
|
||
.matrix-row-cell {
|
||
min-height: 52px; border-bottom: 1px solid #F1F5F9;
|
||
cursor: pointer; transition: all .15s; font-size: 13.5px;
|
||
}
|
||
.matrix-row-cell:hover { background: #F8FAFC; }
|
||
.cell-index { font-family: var(--font-mono); font-size: 12px; color: var(--text-tertiary); font-weight: 500; }
|
||
.cell-title { font-weight: 600; color: #0F172A; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||
.cell-date { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
|
||
.cell-cites { font-family: var(--font-mono); font-size: 12px; color: var(--brand-blue); text-align: right; font-weight: 700; }
|
||
|
||
/* 状态与分类战术徽章(瑞士精密标贴风格) */
|
||
.status-badge {
|
||
display: inline-flex; align-items: center; gap: 6px;
|
||
font-family: var(--font-mono); font-size: 11px; font-weight: 600;
|
||
padding: 2px 8px; border-radius: 3px; width: max-content;
|
||
}
|
||
.status-badge.st-implemented { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
|
||
.status-badge.st-proposed { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
|
||
.status-badge.st-rejected { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
|
||
.status-badge.st-archived { background: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; }
|
||
|
||
.class-badge {
|
||
font-family: var(--font-mono); font-size: 10.5px; padding: 2px 7px;
|
||
border-radius: 3px; font-weight: 600; width: max-content;
|
||
}
|
||
.cls-architecture { background: #FFF7ED; color: #C2410C; border: 1px solid #FED7AA; }
|
||
.cls-feature { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
|
||
.cls-bug-fix { background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0; }
|
||
.cls-simplification { background: #F0FDFA; color: #0F766E; border: 1px solid #99F6E4; }
|
||
.cls-process { background: #FAF5FF; color: #7E22CE; border: 1px solid #E9D5FF; }
|
||
.cls-testing { background: #FDF2F8; color: #BE185D; border: 1px solid #FBCFE8; }
|
||
|
||
/* 结构化白皮书控制台抽屉(Dossier Drawer) */
|
||
#drawer-curtain {
|
||
position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
|
||
backdrop-filter: blur(4px); z-index: 60; display: none;
|
||
}
|
||
#drawer-curtain.open { display: block; }
|
||
#drawer-console {
|
||
position: fixed; top: 0; right: 0; bottom: 0; width: 70vw; max-width: 860px; min-width: 520px;
|
||
background: #FFFFFF; border-left: 1px solid var(--border-normal); z-index: 61;
|
||
transform: translateX(105%); transition: transform .28s cubic-bezier(0.16, 1, 0.3, 1);
|
||
display: flex; flex-direction: column; box-shadow: -16px 0 48px rgba(15, 23, 42, 0.15);
|
||
}
|
||
#drawer-console.open { transform: none; }
|
||
|
||
.console-header {
|
||
height: 64px; padding: 0 28px; border-bottom: 1px solid var(--border-normal);
|
||
display: flex; align-items: center; justify-content: space-between; gap: 14px;
|
||
background: #F8FAFC;
|
||
}
|
||
.console-exit {
|
||
background: #FFFFFF; border: 1px solid var(--border-normal); color: var(--text-secondary);
|
||
font-size: 16px; cursor: pointer; padding: 6px 10px; border-radius: var(--radius-sm);
|
||
display: flex; align-items: center; justify-content: center;
|
||
}
|
||
.console-exit:hover { color: #0F172A; border-color: #94A3B8; }
|
||
|
||
.console-body { flex: 1; overflow-y: auto; padding: 36px 44px 80px; }
|
||
|
||
/* 抽屉打开时锁住背景滚动,避免内外双层滚动条 */
|
||
body:has(#drawer-console.open),
|
||
html:has(#drawer-console.open) { overflow: hidden; }
|
||
|
||
/* 代码反向注释定位板 */
|
||
.anchor-terminal {
|
||
background: #F8FAFC; border: 1px dashed #BFDBFE;
|
||
border-radius: var(--radius-sm); padding: 12px 18px; margin-bottom: 28px;
|
||
display: flex; align-items: center; justify-content: space-between; gap: 16px;
|
||
}
|
||
.anchor-code {
|
||
font-family: var(--font-mono); font-size: 12.5px; color: #1D4ED8; font-weight: 500;
|
||
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
||
}
|
||
.btn-anchor-copy {
|
||
background: #EFF6FF; border: 1px solid var(--brand-blue);
|
||
color: var(--brand-blue); font-family: var(--font-mono); font-size: 11px; padding: 5px 12px;
|
||
border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; transition: all .15s;
|
||
font-weight: 600;
|
||
}
|
||
.btn-anchor-copy:hover { background: var(--brand-blue); color: #FFFFFF; box-shadow: 0 2px 6px rgba(29, 78, 216, 0.2); }
|
||
|
||
.console-headline {
|
||
font-family: var(--font-display); font-size: 24px; font-weight: 700;
|
||
color: #0F172A; line-height: 1.35; margin-bottom: 16px; letter-spacing: -0.3px;
|
||
}
|
||
.console-timestamp {
|
||
font-family: var(--font-mono); font-size: 12px; color: var(--text-tertiary);
|
||
display: flex; align-items: center; gap: 10px; margin-bottom: 28px;
|
||
}
|
||
|
||
.quad-section { margin-bottom: 32px; }
|
||
.quad-title {
|
||
font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.8px;
|
||
color: var(--text-secondary); margin-bottom: 12px; display: flex; align-items: center; gap: 10px;
|
||
text-transform: uppercase;
|
||
}
|
||
.quad-title::after { content: ''; flex: 1; height: 1px; background: var(--border-normal); }
|
||
.quad-content { font-size: 14.5px; line-height: 1.8; color: #334155; }
|
||
.quad-content code { font-family: var(--font-mono); font-size: 13px; background: #F1F5F9; padding: 2px 6px; border-radius: 3px; color: #1D4ED8; }
|
||
.quad-content pre { background: #0F172A; border: 1px solid #1E293B; border-radius: var(--radius-sm); padding: 16px; overflow-x: auto; margin: 14px 0; }
|
||
.quad-content pre code { background: transparent; padding: 0; color: #F8FAFC; }
|
||
|
||
.lineage-nodes { display: flex; flex-direction: column; gap: 12px; }
|
||
.lineage-group-title { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; }
|
||
.lineage-chips { display: flex; flex-wrap: wrap; gap: 8px; }
|
||
.lineage-chip {
|
||
background: #F8FAFC; border: 1px solid var(--border-normal);
|
||
border-radius: var(--radius-sm); padding: 6px 12px; font-size: 12.5px; color: #0F172A;
|
||
cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 6px;
|
||
font-weight: 500;
|
||
}
|
||
.lineage-chip:hover { color: var(--brand-blue); border-color: var(--brand-blue); background: #EFF6FF; }
|
||
|
||
/* 引导开场台 */
|
||
.onboarding-deck {
|
||
background: #FFFFFF; border: 1px dashed var(--border-normal);
|
||
border-radius: var(--radius-md); padding: 56px 40px; text-align: center;
|
||
display: flex; flex-direction: column; align-items: center; gap: 20px;
|
||
box-shadow: 0 4px 20px rgba(15,23,42,0.05);
|
||
}
|
||
.onboarding-deck h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: #0F172A; }
|
||
.onboarding-deck p { color: var(--text-secondary); max-width: 620px; font-size: 14.5px; line-height: 1.7; }
|
||
.action-btn-primary {
|
||
background: var(--brand-blue); color: #FFFFFF; border: 0; border-radius: var(--radius-sm);
|
||
padding: 12px 24px; font-family: var(--font-display); font-size: 14px; font-weight: 700;
|
||
cursor: pointer; box-shadow: 0 2px 8px rgba(29, 78, 216, 0.25); transition: all .2s;
|
||
display: inline-flex; align-items: center; gap: 10px;
|
||
}
|
||
.action-btn-primary:hover { background: var(--brand-blue-hover); }
|
||
.action-btn-secondary {
|
||
background: #FFFFFF; border: 1px solid var(--border-normal); color: var(--text-secondary);
|
||
font-family: var(--font-mono); font-size: 13px; padding: 10px 18px; border-radius: var(--radius-sm);
|
||
cursor: pointer; transition: all .15s; font-weight: 600;
|
||
}
|
||
.action-btn-secondary:hover { color: #0F172A; border-color: #94A3B8; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
|
||
<!-- 顶栏 HUD -->
|
||
<header class="hud-topbar">
|
||
<div class="brand-group">
|
||
<div class="brand-logo"></div>
|
||
<div class="brand-text">
|
||
<span id="brand-project-title">工程决策看板</span>
|
||
<span class="telemetry-chip" id="chip-total-count">0 项</span>
|
||
</div>
|
||
</div>
|
||
|
||
<nav class="deck-tabs">
|
||
<button class="deck-tab active" data-view="baseline">🏛️ 架构基线</button>
|
||
<button class="deck-tab" data-view="timeline">⏱️ 演进时间线</button>
|
||
<button class="deck-tab" data-view="alternatives">🛡️ 避坑智库</button>
|
||
<button class="deck-tab" data-view="directory">📋 决策清单</button>
|
||
</nav>
|
||
|
||
<div class="hud-grow"></div>
|
||
|
||
<div class="hud-search">
|
||
<svg class="search-ico" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
|
||
<input id="global-query" type="text" placeholder="快速搜索决策与避坑...">
|
||
<span class="shortcut-key">/</span>
|
||
<div class="search-popover" id="search-popover"></div>
|
||
</div>
|
||
|
||
<div class="sync-beacon" id="beacon-sync" title="点击选择本地 .agents/notes 目录开启纯本地热同步">
|
||
<span class="radar-dot" id="radar-indicator"></span>
|
||
<span id="beacon-status">连接本地目录</span>
|
||
</div>
|
||
</header>
|
||
|
||
<main class="mission-canvas">
|
||
|
||
<!-- 未装载引导 -->
|
||
<div class="onboarding-deck" id="deck-onboarding" style="display:none;">
|
||
<h2>工程决策看板</h2>
|
||
<p>当前尚未挂载笔记数据。本看板支持浏览器端直接授权读取本地 <code>.agents/notes</code> 目录,无需任何后端服务器与 Git 提交,本地新建或修改笔记切回浏览器即刻自动热更新。</p>
|
||
<div style="display:flex; gap:14px; margin-top:8px;">
|
||
<button class="action-btn-primary" id="btn-authorize-dir">
|
||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg>
|
||
选择本地 .agents/notes 文件夹
|
||
</button>
|
||
<button class="action-btn-secondary" id="btn-mount-demo">载入标准样例演示数据</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 1. 架构基线视图 -->
|
||
<section class="canvas-view active" id="view-baseline">
|
||
<div class="kpi-row" id="kpi-row"></div>
|
||
|
||
<div class="hud-panel" style="margin-bottom: 28px;">
|
||
<div class="panel-masthead">
|
||
<span class="panel-headline">
|
||
<span>🏛️</span>
|
||
<span>系统承重墙</span>
|
||
</span>
|
||
<span class="panel-annotation">基于交叉引用入度权重萃取的系统关键协议</span>
|
||
</div>
|
||
<div class="pillars-vault" id="pillars-vault"></div>
|
||
</div>
|
||
|
||
<div class="hud-panel">
|
||
<div class="panel-masthead">
|
||
<span class="panel-headline">
|
||
<span>🧩</span>
|
||
<span>领域架构分类阵列</span>
|
||
</span>
|
||
<span class="panel-annotation">现行生效的生产事实全景清单</span>
|
||
</div>
|
||
<div class="matrix-chambers" id="matrix-chambers"></div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- 2. 演进时间线视图 -->
|
||
<section class="canvas-view" id="view-timeline">
|
||
<div class="hud-panel">
|
||
<div class="panel-masthead">
|
||
<span class="panel-headline">
|
||
<span>⏱️</span>
|
||
<span>技术演进时间线</span>
|
||
</span>
|
||
<span class="panel-annotation">记录架构突破与代码裁撤里程碑</span>
|
||
</div>
|
||
|
||
<div class="timeline-toolbar">
|
||
<div class="filter-row">
|
||
<span class="filter-group-label">📅 月份切片:</span>
|
||
<div class="month-pills" id="timeline-month-pills"></div>
|
||
</div>
|
||
<div class="filter-row">
|
||
<span class="filter-group-label">🏷️ 分类切片:</span>
|
||
<div class="class-pills" id="timeline-class-pills"></div>
|
||
</div>
|
||
<div class="filter-summary-bar">
|
||
<span id="timeline-filter-info"></span>
|
||
<button id="btn-reset-timeline-filter" style="background:none;border:0;color:var(--brand-blue);font-family:var(--font-mono);font-size:11px;cursor:pointer;font-weight:600;">重置时间线筛选</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="chrono-track" id="chrono-track"></div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- 3. 避坑智库视图 -->
|
||
<section class="canvas-view" id="view-alternatives">
|
||
<div class="hud-panel">
|
||
<div class="panel-masthead">
|
||
<span class="panel-headline">
|
||
<span>🛡️</span>
|
||
<span>避坑与反思智库</span>
|
||
</span>
|
||
<span class="panel-annotation">记录「为什么放弃了方案 B」与被否决的提案,防止重复踩坑</span>
|
||
</div>
|
||
<div class="alt-controls">
|
||
<input type="text" class="alt-search-input" id="alt-query-input" placeholder="检索被否决方案关键字(如:SQLite、多进程、Redis...)">
|
||
</div>
|
||
<div class="pitfalls-grid" id="pitfalls-grid"></div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- 4. 决策清单视图 -->
|
||
<section class="canvas-view" id="view-directory">
|
||
<div class="matrix-toolbar">
|
||
<select id="select-status"><option value="">状态:全部</option></select>
|
||
<select id="select-class"><option value="">分类:全部</option></select>
|
||
<select id="select-sort">
|
||
<option value="new">排序:最新优先</option>
|
||
<option value="old">排序:最早优先</option>
|
||
<option value="cites">排序:引用最多</option>
|
||
</select>
|
||
<button id="btn-reset-matrix-filter" style="background:none;border:0;color:var(--brand-blue);font-family:var(--font-mono);font-size:11px;cursor:pointer;font-weight:600;" title="清空全部筛选条件">重置筛选</button>
|
||
<span style="font-family:var(--font-mono); font-size:11px; color:var(--text-tertiary); margin-left:auto;" id="matrix-matched-count"></span>
|
||
</div>
|
||
|
||
<div class="matrix-board">
|
||
<div class="matrix-row-head">
|
||
<span>编号</span>
|
||
<span>分类</span>
|
||
<span>标题</span>
|
||
<span>状态</span>
|
||
<span>日期</span>
|
||
<span style="text-align:right;">引用</span>
|
||
</div>
|
||
<div id="matrix-rows-stream"></div>
|
||
</div>
|
||
</section>
|
||
|
||
<footer style="margin-top: 24px; padding: 20px 0; border-top: 1px solid var(--border-normal); display: flex; align-items: center; justify-content: space-between; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-tertiary); flex-wrap: wrap; gap: 12px;">
|
||
<div>Agent Notes · 工程决策看板 · 遵循 MIT 协议开源</div>
|
||
<div style="display: flex; gap: 16px; align-items: center;">
|
||
<span>友情链接:</span>
|
||
<a href="https://linux.do" target="_blank" rel="noopener noreferrer" style="color: var(--brand-blue); text-decoration: none; font-weight: 600;">LinuxDo</a>
|
||
</div>
|
||
</footer>
|
||
|
||
</main>
|
||
|
||
<!-- 结构化控制台抽屉 -->
|
||
<div id="drawer-curtain"></div>
|
||
<aside id="drawer-console">
|
||
<div class="console-header">
|
||
<span class="status-badge" id="dr-status-badge"></span>
|
||
<span class="class-badge" id="dr-class-badge"></span>
|
||
<div style="flex:1;"></div>
|
||
<button class="console-exit" id="btn-console-close" title="退出 (Esc)">✕</button>
|
||
</div>
|
||
<div class="console-body">
|
||
<div class="anchor-terminal">
|
||
<span class="anchor-code" id="dr-anchor-code">// Note: 见 .agents/notes/...</span>
|
||
<button class="btn-anchor-copy" id="btn-anchor-copy">复制反向代码注释</button>
|
||
</div>
|
||
|
||
<h1 class="console-headline" id="dr-headline"></h1>
|
||
<div class="console-timestamp" id="dr-timestamp-bar"></div>
|
||
|
||
<div class="quad-section" id="quad-sec-problem">
|
||
<div class="quad-title">🎯 01. 背景与痛点</div>
|
||
<div class="quad-content" id="dr-body-problem"></div>
|
||
</div>
|
||
|
||
<div class="quad-section" id="quad-sec-decision">
|
||
<div class="quad-title">⚡ 02. 落地裁定事实</div>
|
||
<div class="quad-content" id="dr-body-decision"></div>
|
||
</div>
|
||
|
||
<div class="quad-section" id="quad-sec-alt">
|
||
<div class="quad-title">🚫 03. 审慎考虑并放弃的备选</div>
|
||
<div class="quad-content" id="dr-body-alt"></div>
|
||
</div>
|
||
|
||
<div class="quad-section" id="quad-sec-consequences">
|
||
<div class="quad-title">⚖️ 04. 收益与工程代价</div>
|
||
<div class="quad-content" id="dr-body-consequences"></div>
|
||
</div>
|
||
|
||
<div class="quad-section">
|
||
<div class="quad-title">🔗 05. 因果与血缘依赖链路</div>
|
||
<div class="lineage-nodes" id="dr-lineage-stream"></div>
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
|
||
<!-- 内联数据插槽 -->
|
||
<script id="embedded-data">
|
||
window.__INLINE_DATA__ = null;
|
||
</script>
|
||
|
||
<script>
|
||
'use strict';
|
||
|
||
const LIFECYCLES = ['implemented', 'proposed', 'rejected', 'archived'];
|
||
const STATUS_LABELS = { implemented: '已落地', proposed: '待评审', rejected: '已否决', archived: '已归档' };
|
||
|
||
const CLASSES = ['architecture', 'feature', 'bug-fix', 'simplification', 'process', 'testing'];
|
||
const CLASS_LABELS = {
|
||
architecture: '架构设计',
|
||
feature: '功能特性',
|
||
'bug-fix': '缺陷修复',
|
||
simplification: '化简裁撤',
|
||
process: '流程规范',
|
||
testing: '测试基建'
|
||
};
|
||
|
||
const DB_NAME = 'AgentNotesBoardDB';
|
||
const STORE_NAME = 'handles';
|
||
|
||
const Core = {
|
||
nodes: [],
|
||
byId: new Map(),
|
||
inCount: new Map(),
|
||
outMap: new Map(),
|
||
activeTab: 'baseline',
|
||
dirHandle: null,
|
||
lastSyncTime: 0,
|
||
filterQuery: '',
|
||
stFilter: '',
|
||
clsFilter: '',
|
||
sortMode: 'new',
|
||
altQuery: '',
|
||
timelineMonth: '',
|
||
timelineClass: '',
|
||
drawerId: null,
|
||
};
|
||
|
||
// 全序日期比较器:date 相同时以唯一 id 兜底,保证任意刷新顺序一致
|
||
const byDateDesc = (a, b) => (b.date || '').localeCompare(a.date || '') || a.id.localeCompare(b.id);
|
||
const byDateAsc = (a, b) => (a.date || '').localeCompare(b.date || '') || a.id.localeCompare(b.id);
|
||
|
||
function getDB() {
|
||
return new Promise((resolve, reject) => {
|
||
const req = indexedDB.open(DB_NAME, 1);
|
||
req.onupgradeneeded = () => req.result.createObjectStore(STORE_NAME);
|
||
req.onsuccess = () => resolve(req.result);
|
||
req.onerror = () => reject(req.error);
|
||
});
|
||
}
|
||
|
||
async function saveDirHandle(handle) {
|
||
try {
|
||
const db = await getDB();
|
||
const tx = db.transaction(STORE_NAME, 'readwrite');
|
||
tx.objectStore(STORE_NAME).put(handle, 'notesDirHandle');
|
||
await new Promise(r => tx.oncomplete = r);
|
||
} catch (e) { console.warn('Cannot persist dir handle', e); }
|
||
}
|
||
|
||
async function loadSavedDirHandle() {
|
||
try {
|
||
const db = await getDB();
|
||
const tx = db.transaction(STORE_NAME, 'readonly');
|
||
const req = tx.objectStore(STORE_NAME).get('notesDirHandle');
|
||
return new Promise(resolve => {
|
||
req.onsuccess = () => resolve(req.result || null);
|
||
req.onerror = () => resolve(null);
|
||
});
|
||
} catch { return null; }
|
||
}
|
||
|
||
function escapeHtml(str) {
|
||
if (!str) return '';
|
||
return String(str)
|
||
.replace(/&/g, '&')
|
||
.replace(/</g, '<')
|
||
.replace(/>/g, '>')
|
||
.replace(/"/g, '"')
|
||
.replace(/'/g, ''');
|
||
}
|
||
|
||
function parseMarkdown(text) {
|
||
if (!text) return '';
|
||
let s = text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||
s = s.replace(/```([\s\S]*?)```/g, (m, c) => `<pre><code>${c.trim()}</code></pre>`);
|
||
s = s.replace(/`([^`\n]+)`/g, '<code>$1</code>');
|
||
s = s.replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>');
|
||
s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (match, linkText, href) => {
|
||
const cleanHref = href.trim();
|
||
if (/^(?:javascript|data|vbscript):/i.test(cleanHref)) {
|
||
return linkText;
|
||
}
|
||
const safeHref = escapeHtml(cleanHref);
|
||
return `<a href="javascript:void(0)" class="md-deep-link" data-deep-link="${safeHref}" style="color:var(--brand-cyan);text-decoration:underline;">${linkText}</a>`;
|
||
});
|
||
s = s.replace(/^- (.*)$/gm, '• $1');
|
||
return s.split(/\n{2,}/).map(p => {
|
||
p = p.trim();
|
||
if (!p) return '';
|
||
if (p.startsWith('<pre>')) return p;
|
||
return `<p style="margin-bottom:10px;">${p.replace(/\n/g, '<br>')}</p>`;
|
||
}).join('');
|
||
}
|
||
|
||
function parseNote(raw, relPath, slugToId = new Map()) {
|
||
const slug = relPath.split('/').pop().replace(/\.md$/, '');
|
||
const parts = relPath.split('/');
|
||
const lifecycle = parts[0];
|
||
const cls = parts[1] || 'architecture';
|
||
|
||
let title = slug;
|
||
let status = lifecycle;
|
||
let date = '';
|
||
|
||
const dMatch = /^(\d{4}-\d{2}-\d{2})/.exec(slug);
|
||
if (dMatch) date = dMatch[1];
|
||
|
||
const h1Match = /^# Agent Note[^::]*[::]\s*(.*)$/m.exec(raw);
|
||
if (h1Match) title = h1Match[1].trim();
|
||
|
||
function extractSection(pattern) {
|
||
const re = new RegExp(`^## (?:${pattern})\\s*\\n+([\\s\\S]*?)(?=^## |\\s*$)`, 'm');
|
||
const m = re.exec(raw);
|
||
return m ? m[1].trim() : '';
|
||
}
|
||
|
||
const problem = extractSection('Problem|问题');
|
||
const decision = extractSection('Decision|Proposal|决策|提案');
|
||
const alternatives = extractSection('Alternatives considered|曾考虑的替代方案|曾考虑的备选');
|
||
const consequences = extractSection('Consequences|后果');
|
||
|
||
const links = [];
|
||
for (const m of raw.matchAll(/\]\(([^)]+\.md)\)/g)) {
|
||
let targetHref = m[1].split('#')[0].trim();
|
||
if (targetHref.includes('://')) continue;
|
||
targetHref = targetHref.replace(/\.zh\.md$/, '.md');
|
||
const segs = `${lifecycle}/${cls}/${targetHref}`.split('/');
|
||
const resolved = [];
|
||
for (const s of segs) {
|
||
if (!s || s === '.') continue;
|
||
if (s === '..') resolved.pop();
|
||
else resolved.push(s);
|
||
}
|
||
const cleanTarget = resolved.join('/');
|
||
|
||
let finalTarget = '';
|
||
if (slugToId.has(cleanTarget)) {
|
||
finalTarget = slugToId.get(cleanTarget);
|
||
} else {
|
||
const targetSlug = targetHref.split('/').pop().replace(/\.md$/, '');
|
||
if (slugToId.has(targetSlug)) {
|
||
finalTarget = slugToId.get(targetSlug);
|
||
}
|
||
}
|
||
if (finalTarget && finalTarget !== relPath) {
|
||
links.push(finalTarget);
|
||
}
|
||
}
|
||
|
||
return {
|
||
id: relPath,
|
||
slug,
|
||
lifecycle,
|
||
cls,
|
||
date,
|
||
title,
|
||
status,
|
||
problem,
|
||
decision,
|
||
alternatives,
|
||
consequences,
|
||
outLinks: [...new Set(links)],
|
||
rawBody: raw,
|
||
};
|
||
}
|
||
|
||
async function scanDirectory(rootHandle) {
|
||
const notesMap = new Map();
|
||
async function walk(dirHandle, currentPath = '') {
|
||
for await (const entry of dirHandle.values()) {
|
||
if (entry.name.startsWith('.')) continue;
|
||
const subPath = currentPath ? `${currentPath}/${entry.name}` : entry.name;
|
||
if (entry.kind === 'directory') {
|
||
await walk(entry, subPath);
|
||
} else if (entry.kind === 'file' && entry.name.endsWith('.md')) {
|
||
const isZh = entry.name.endsWith('.zh.md');
|
||
const cleanRel = isZh ? subPath.replace(/\.zh\.md$/, '.md') : subPath;
|
||
const parts = cleanRel.split('/');
|
||
if (parts.length >= 3 && LIFECYCLES.includes(parts[0])) {
|
||
try {
|
||
const file = await entry.getFile();
|
||
const text = await file.text();
|
||
if (!notesMap.has(cleanRel) || isZh) {
|
||
notesMap.set(cleanRel, text);
|
||
}
|
||
} catch (err) {
|
||
console.warn('Read note error:', subPath, err);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
let targetHandle = rootHandle;
|
||
try {
|
||
const agentsDir = await rootHandle.getDirectoryHandle('.agents');
|
||
targetHandle = await agentsDir.getDirectoryHandle('notes');
|
||
} catch {}
|
||
|
||
await walk(targetHandle);
|
||
|
||
const slugToId = new Map();
|
||
for (const rel of notesMap.keys()) {
|
||
const slug = rel.split('/').pop().replace(/\.md$/, '');
|
||
slugToId.set(slug, rel);
|
||
slugToId.set(rel, rel);
|
||
}
|
||
|
||
const notes = [];
|
||
for (const [cleanRel, text] of notesMap.entries()) {
|
||
notes.push(parseNote(text, cleanRel, slugToId));
|
||
}
|
||
return notes;
|
||
}
|
||
|
||
function ingestDataset(notes) {
|
||
Core.nodes = notes;
|
||
Core.byId.clear();
|
||
Core.inCount.clear();
|
||
Core.outMap.clear();
|
||
|
||
notes.forEach(n => {
|
||
Core.byId.set(n.id, n);
|
||
Core.outMap.set(n.id, n.outLinks);
|
||
});
|
||
|
||
notes.forEach(n => {
|
||
n.outLinks.forEach(target => {
|
||
if (Core.byId.has(target)) {
|
||
Core.inCount.set(target, (Core.inCount.get(target) || 0) + 1);
|
||
}
|
||
});
|
||
});
|
||
|
||
Core.nodes.sort(byDateDesc);
|
||
|
||
document.getElementById('chip-total-count').textContent = `${notes.length} 项`;
|
||
document.getElementById('deck-onboarding').style.display = notes.length ? 'none' : 'flex';
|
||
|
||
renderInterface();
|
||
}
|
||
|
||
function renderInterface() {
|
||
renderBaseline();
|
||
renderTimeline();
|
||
renderAlternatives();
|
||
renderDirectory();
|
||
}
|
||
|
||
function renderBaseline() {
|
||
const nodes = Core.nodes;
|
||
const implemented = nodes.filter(n => n.lifecycle === 'implemented');
|
||
const proposed = nodes.filter(n => n.lifecycle === 'proposed');
|
||
const rejected = nodes.filter(n => n.lifecycle === 'rejected');
|
||
const simplifications = nodes.filter(n => n.cls === 'simplification');
|
||
|
||
const kpis = [
|
||
{ label: '现行落地', count: implemented.length, desc: '生产已交付生效', color: '#10B981', filter: 'implemented' },
|
||
{ label: '待评审提案', count: proposed.length, desc: '待团队确认', color: '#F59E0B', filter: 'proposed' },
|
||
{ label: '避坑否决', count: rejected.length, desc: '防重犯事实存档', color: '#FF3366', filter: 'rejected' },
|
||
{ label: '化简裁撤', count: simplifications.length, desc: '代码只减不增', color: '#14B8A6', filter: 'simplification' },
|
||
];
|
||
|
||
document.getElementById('kpi-row').innerHTML = kpis.map(k => `
|
||
<div class="kpi-instrument" onclick="routeToListFilter('${escapeHtml(k.filter)}')">
|
||
<div class="kpi-tag">
|
||
<span>${escapeHtml(k.label)}</span>
|
||
<span style="width:6px;height:6px;border-radius:50%;background:${k.color}"></span>
|
||
</div>
|
||
<div class="kpi-num">${k.count}</div>
|
||
<div class="kpi-caption">${escapeHtml(k.desc)}</div>
|
||
<div class="kpi-accent-bar" style="background:${k.color}"></div>
|
||
</div>
|
||
`).join('');
|
||
|
||
const pillars = [...nodes]
|
||
.filter(n => n.lifecycle === 'implemented')
|
||
.sort((a, b) => (Core.inCount.get(b.id) || 0) - (Core.inCount.get(a.id) || 0))
|
||
.slice(0, 6);
|
||
|
||
document.getElementById('pillars-vault').innerHTML = pillars.map(n => {
|
||
const cites = Core.inCount.get(n.id) || 0;
|
||
const title = escapeHtml(n.title);
|
||
const plain = (n.decision || n.problem || '系统核心架构协议')
|
||
.replace(/<[^>]+>/g, '')
|
||
.replace(/^#{1,6}\s+/gm, '')
|
||
.replace(/\[(.*?)\]\([^)]*\)/g, '$1')
|
||
.replace(/[*`>]/g, '')
|
||
.replace(/\s+/g, ' ')
|
||
.trim();
|
||
const desc = escapeHtml(plain);
|
||
const safeCls = escapeHtml(n.cls);
|
||
const clsLabel = escapeHtml(CLASS_LABELS[n.cls] || n.cls);
|
||
const safeDate = escapeHtml(n.date || '进行中');
|
||
const safeSlug = escapeHtml(n.slug);
|
||
const safeId = escapeHtml(n.id);
|
||
return `
|
||
<div class="pillar-specimen" data-node-id="${safeId}">
|
||
<div>
|
||
<div class="pillar-meta">
|
||
<span class="class-badge cls-${safeCls}">${clsLabel}</span>
|
||
<span class="weight-gauge">被引用 × ${cites}</span>
|
||
</div>
|
||
<div class="pillar-core-title">${title}</div>
|
||
<div class="pillar-abstract">${desc}</div>
|
||
</div>
|
||
<div class="pillar-telemetry">
|
||
<span>${safeDate}</span>
|
||
<span>#${safeSlug}</span>
|
||
</div>
|
||
</div>
|
||
`;
|
||
}).join('');
|
||
|
||
const activeNodes = nodes.filter(n => n.lifecycle === 'implemented' || n.lifecycle === 'proposed');
|
||
document.getElementById('matrix-chambers').innerHTML = CLASSES.map(c => {
|
||
const colNodes = activeNodes.filter(n => n.cls === c);
|
||
const clsLabel = escapeHtml(CLASS_LABELS[c] || c);
|
||
return `
|
||
<div class="chamber-pod">
|
||
<div class="chamber-header">
|
||
<span class="chamber-name">
|
||
<span style="width:6px;height:6px;background:var(--brand-cyan);border-radius:1px;"></span>
|
||
${clsLabel}
|
||
</span>
|
||
<span class="chamber-count">${colNodes.length}</span>
|
||
</div>
|
||
<div class="chamber-stream">
|
||
${colNodes.length ? colNodes.map(n => `
|
||
<div class="specimen-row" data-node-id="${escapeHtml(n.id)}">
|
||
<div class="specimen-title">${escapeHtml(n.title)}</div>
|
||
<div class="specimen-info">
|
||
<span>${escapeHtml(n.date || '—')}</span>
|
||
${(Core.inCount.get(n.id) || 0) ? `<span style="color:var(--brand-blue)">↗${Core.inCount.get(n.id)}</span>` : ''}
|
||
</div>
|
||
</div>
|
||
`).join('') : '<div style="color:var(--text-tertiary);font-family:var(--font-mono);font-size:11px;padding:8px;">// 暂无该类活跃决策</div>'}
|
||
</div>
|
||
</div>
|
||
`;
|
||
}).join('');
|
||
}
|
||
|
||
function renderTimeline() {
|
||
const allDatedNodes = [...Core.nodes].filter(n => n.date).sort(byDateDesc);
|
||
|
||
// 1. 统计全部月份
|
||
const monthsMap = new Map();
|
||
allDatedNodes.forEach(n => {
|
||
const mo = n.date.slice(0, 7);
|
||
if (!monthsMap.has(mo)) monthsMap.set(mo, []);
|
||
monthsMap.get(mo).push(n);
|
||
});
|
||
|
||
// 2. 渲染月份筛选胶囊
|
||
const monthPillsContainer = document.getElementById('timeline-month-pills');
|
||
if (monthPillsContainer) {
|
||
const allPill = `<button class="month-pill ${!Core.timelineMonth ? 'active' : ''}" data-mo="">全部 (${allDatedNodes.length})</button>`;
|
||
const moPills = [...monthsMap.entries()].map(([mo, items]) => `
|
||
<button class="month-pill ${Core.timelineMonth === mo ? 'active' : ''}" data-mo="${mo}">${mo} (${items.length})</button>
|
||
`).join('');
|
||
monthPillsContainer.innerHTML = allPill + moPills;
|
||
|
||
monthPillsContainer.querySelectorAll('.month-pill').forEach(btn => {
|
||
btn.addEventListener('click', () => {
|
||
Core.timelineMonth = btn.dataset.mo;
|
||
renderTimeline();
|
||
});
|
||
});
|
||
}
|
||
|
||
// 3. 渲染大类分类筛选胶囊
|
||
const classPillsContainer = document.getElementById('timeline-class-pills');
|
||
if (classPillsContainer) {
|
||
const allClsPill = `<button class="class-pill ${!Core.timelineClass ? 'active' : ''}" data-cls="">全部分类 (${allDatedNodes.length})</button>`;
|
||
const clsPills = CLASSES.map(c => {
|
||
const cnt = allDatedNodes.filter(n => n.cls === c).length;
|
||
return `<button class="class-pill ${Core.timelineClass === c ? 'active' : ''}" data-cls="${c}">${CLASS_LABELS[c]} (${cnt})</button>`;
|
||
}).join('');
|
||
classPillsContainer.innerHTML = allClsPill + clsPills;
|
||
|
||
classPillsContainer.querySelectorAll('.class-pill').forEach(btn => {
|
||
btn.addEventListener('click', () => {
|
||
Core.timelineClass = btn.dataset.cls;
|
||
renderTimeline();
|
||
});
|
||
});
|
||
}
|
||
|
||
// 4. 重置筛选按钮
|
||
const btnReset = document.getElementById('btn-reset-timeline-filter');
|
||
if (btnReset) {
|
||
btnReset.onclick = () => {
|
||
Core.timelineMonth = '';
|
||
Core.timelineClass = '';
|
||
renderTimeline();
|
||
};
|
||
}
|
||
|
||
// 5. 正交组合过滤
|
||
let filteredNodes = allDatedNodes;
|
||
if (Core.timelineMonth) {
|
||
filteredNodes = filteredNodes.filter(n => n.date.startsWith(Core.timelineMonth));
|
||
}
|
||
if (Core.timelineClass) {
|
||
filteredNodes = filteredNodes.filter(n => n.cls === Core.timelineClass);
|
||
}
|
||
|
||
// 6. 更新信息条
|
||
const infoEl = document.getElementById('timeline-filter-info');
|
||
if (infoEl) {
|
||
const parts = [];
|
||
if (Core.timelineMonth) parts.push(Core.timelineMonth);
|
||
if (Core.timelineClass) parts.push(CLASS_LABELS[Core.timelineClass] || Core.timelineClass);
|
||
infoEl.textContent = parts.length
|
||
? `已切片 [${parts.join(' · ')}] 对应 ${filteredNodes.length} 条记录`
|
||
: `全周期全分类共 ${filteredNodes.length} 条演化记录`;
|
||
}
|
||
|
||
// 7. 按月份分组展示
|
||
const filteredMonthsMap = new Map();
|
||
filteredNodes.forEach(n => {
|
||
const mo = n.date.slice(0, 7);
|
||
if (!filteredMonthsMap.has(mo)) filteredMonthsMap.set(mo, []);
|
||
filteredMonthsMap.get(mo).push(n);
|
||
});
|
||
|
||
let html = '';
|
||
for (const [mo, items] of filteredMonthsMap.entries()) {
|
||
html += `
|
||
<div class="chrono-node-epoch">
|
||
<div class="chrono-epoch-badge">${escapeHtml(mo)} · ${items.length} 条</div>
|
||
<div class="chrono-cards">
|
||
${items.map(n => `
|
||
<div class="chrono-card" data-node-id="${escapeHtml(n.id)}">
|
||
<div class="chrono-pulse"></div>
|
||
<div class="chrono-meta-row">
|
||
<span class="chrono-date-badge">📅 ${escapeHtml(n.date || '进行中')}</span>
|
||
<span class="class-badge cls-${escapeHtml(n.cls)}">${escapeHtml(CLASS_LABELS[n.cls] || n.cls)}</span>
|
||
<span class="status-badge st-${escapeHtml(n.lifecycle)}">${escapeHtml(STATUS_LABELS[n.lifecycle] || n.lifecycle)}</span>
|
||
<span class="chrono-heading">${escapeHtml(n.title)}</span>
|
||
</div>
|
||
<div class="chrono-body">${escapeHtml((n.problem || n.decision || '').slice(0, 180))}...</div>
|
||
</div>
|
||
`).join('')}
|
||
</div>
|
||
</div>
|
||
`;
|
||
}
|
||
document.getElementById('chrono-track').innerHTML = html || '<div style="color:var(--text-tertiary);padding:36px;font-family:var(--font-mono);text-align:center;">// 未找到符合此切片组合的演化记录</div>';
|
||
}
|
||
|
||
function renderAlternatives() {
|
||
const q = (Core.altQuery || '').toLowerCase();
|
||
const altItems = [];
|
||
|
||
Core.nodes.forEach(n => {
|
||
const title = n.title;
|
||
const altContent = n.alternatives;
|
||
|
||
if (n.lifecycle === 'rejected') {
|
||
const crux = (n.rawBody || '').split('\n')[2]?.replace(/Status:\s*rejected\s*[—–-]/, '').trim() || n.problem || '审慎否决,防止重犯。';
|
||
altItems.push({
|
||
nodeId: n.id,
|
||
title,
|
||
cls: n.cls,
|
||
discarded: `[已否决提案] ${title}`,
|
||
crux,
|
||
winner: '提案直接否决'
|
||
});
|
||
}
|
||
if (altContent) {
|
||
const parts = altContent.split(/\n(?=###? |- )/);
|
||
parts.forEach(p => {
|
||
const clean = p.replace(/^[-#* ]+/, '').trim()
|
||
.replace(/\*\*([^*]+)\*\*/g, '$1')
|
||
.replace(/\*\*/g, '')
|
||
.replace(/__([^_]+)__/g, '$1')
|
||
.replace(/`([^`]*)`/g, '$1')
|
||
.replace(/\[(.*?)\]\([^)]*\)/g, '$1');
|
||
if (clean.length > 5) {
|
||
const colonIdx = clean.indexOf(':') > -1 ? clean.indexOf(':') : clean.indexOf(':');
|
||
let heading = clean.slice(0, 45);
|
||
let reason = clean;
|
||
if (colonIdx > 0 && colonIdx < 35) {
|
||
heading = clean.slice(0, colonIdx);
|
||
reason = clean.slice(colonIdx + 1);
|
||
}
|
||
altItems.push({
|
||
nodeId: n.id,
|
||
title,
|
||
cls: n.cls,
|
||
discarded: heading,
|
||
crux: reason,
|
||
winner: `采纳决策: ${title}`
|
||
});
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
const filtered = altItems.filter(item => {
|
||
if (!q) return true;
|
||
return item.discarded.toLowerCase().includes(q) || item.crux.toLowerCase().includes(q) || item.title.toLowerCase().includes(q);
|
||
});
|
||
|
||
document.getElementById('pitfalls-grid').innerHTML = filtered.length ? filtered.map(item => `
|
||
<div class="pitfall-dossier" data-node-id="${escapeHtml(item.nodeId)}">
|
||
<div>
|
||
<div style="display:flex; justify-content:space-between; margin-bottom:10px;">
|
||
<span class="class-badge cls-${escapeHtml(item.cls)}">${escapeHtml(CLASS_LABELS[item.cls] || item.cls)}</span>
|
||
<span style="font-family:var(--font-mono);font-size:11px;color:var(--text-tertiary);">#${escapeHtml(item.nodeId.split('/').pop().replace('.md',''))}</span>
|
||
</div>
|
||
<div class="hazard-banner">🚫 放弃备选:${escapeHtml(item.discarded)}</div>
|
||
<div class="crux-evidence" style="margin-top:12px;">💡 权衡依据:${escapeHtml(item.crux)}</div>
|
||
</div>
|
||
<div class="triumphant-verdict">✅ ${escapeHtml(item.winner)}</div>
|
||
</div>
|
||
`).join('') : `<div style="grid-column:1/-1;color:var(--text-tertiary);text-align:center;padding:48px;font-family:var(--font-mono);">// 未检索到相关避坑记录</div>`;
|
||
}
|
||
|
||
function renderDirectory() {
|
||
const q = (Core.filterQuery || '').toLowerCase();
|
||
const st = Core.stFilter;
|
||
const cls = Core.clsFilter;
|
||
|
||
let list = Core.nodes.filter(n => {
|
||
if (st && n.lifecycle !== st) return false;
|
||
if (cls && n.cls !== cls) return false;
|
||
if (q) {
|
||
const hay = `${n.title} ${n.slug} ${n.problem || ''} ${n.decision || ''}`.toLowerCase();
|
||
if (!hay.includes(q)) return false;
|
||
}
|
||
return true;
|
||
});
|
||
|
||
if (Core.sortMode === 'new') list.sort(byDateDesc);
|
||
else if (Core.sortMode === 'old') list.sort(byDateAsc);
|
||
else if (Core.sortMode === 'cites') list.sort((a, b) => (Core.inCount.get(b.id) || 0) - (Core.inCount.get(a.id) || 0));
|
||
|
||
document.getElementById('matrix-matched-count').textContent = `匹配 ${list.length} 条`;
|
||
|
||
document.getElementById('matrix-rows-stream').innerHTML = list.length ? list.map((n, idx) => {
|
||
const cites = Core.inCount.get(n.id) || 0;
|
||
return `
|
||
<div class="matrix-row-cell" data-node-id="${escapeHtml(n.id)}">
|
||
<span class="cell-index">#${String(idx + 1).padStart(3, '0')}</span>
|
||
<span><span class="class-badge cls-${escapeHtml(n.cls)}">${escapeHtml(CLASS_LABELS[n.cls] || n.cls)}</span></span>
|
||
<span class="cell-title">${escapeHtml(n.title)}</span>
|
||
<span><span class="status-badge st-${escapeHtml(n.lifecycle)}">${escapeHtml(STATUS_LABELS[n.lifecycle] || n.lifecycle)}</span></span>
|
||
<span class="cell-date">${escapeHtml(n.date || '—')}</span>
|
||
<span class="cell-cites">${cites ? `↗ ${cites}` : ''}</span>
|
||
</div>
|
||
`;
|
||
}).join('') : '<div style="padding:40px;text-align:center;color:var(--text-tertiary);font-family:var(--font-mono);">// 没有匹配的决策记录</div>';
|
||
}
|
||
|
||
function openConsole(id) {
|
||
const n = Core.byId.get(id);
|
||
if (!n) return;
|
||
|
||
Core.drawerId = id;
|
||
|
||
const stBadge = document.getElementById('dr-status-badge');
|
||
stBadge.className = `status-badge st-${n.lifecycle}`;
|
||
stBadge.textContent = STATUS_LABELS[n.lifecycle] || n.lifecycle;
|
||
|
||
const clsBadge = document.getElementById('dr-class-badge');
|
||
clsBadge.className = `class-badge cls-${n.cls}`;
|
||
clsBadge.textContent = CLASS_LABELS[n.cls] || n.cls;
|
||
|
||
const anchor = `// Note: 见 .agents/notes/${n.id}`;
|
||
document.getElementById('dr-anchor-code').textContent = anchor;
|
||
document.getElementById('btn-anchor-copy').onclick = () => {
|
||
navigator.clipboard.writeText(anchor);
|
||
const btn = document.getElementById('btn-anchor-copy');
|
||
const old = btn.textContent;
|
||
btn.textContent = '已复制';
|
||
setTimeout(() => btn.textContent = old, 1500);
|
||
};
|
||
|
||
document.getElementById('dr-headline').textContent = n.title;
|
||
document.getElementById('dr-timestamp-bar').innerHTML = `
|
||
<span>${escapeHtml(n.date || '无日期')}</span>
|
||
<span>·</span>
|
||
<span>${escapeHtml(n.slug)}</span>
|
||
${(Core.inCount.get(n.id) || 0) ? `<span>·</span><span style="color:var(--brand-blue);font-weight:700;">被引用 ${Core.inCount.get(n.id)} 次</span>` : ''}
|
||
`;
|
||
|
||
document.getElementById('dr-body-problem').innerHTML = parseMarkdown(n.problem) || '<span style="color:var(--text-tertiary);">(未独立分节说明问题)</span>';
|
||
document.getElementById('dr-body-decision').innerHTML = parseMarkdown(n.decision) || '<span style="color:var(--text-tertiary);">(未记录具体裁定事实)</span>';
|
||
document.getElementById('dr-body-alt').innerHTML = parseMarkdown(n.alternatives) || '<span style="color:var(--text-tertiary);">(无曾考虑的备选对比)</span>';
|
||
document.getElementById('dr-body-consequences').innerHTML = parseMarkdown(n.consequences) || '<span style="color:var(--text-tertiary);">(未详述工程后果)</span>';
|
||
|
||
const incoming = Core.nodes.filter(x => x.outLinks.includes(n.id));
|
||
const outgoing = n.outLinks.map(t => Core.byId.get(t)).filter(Boolean);
|
||
|
||
let lineageHtml = '';
|
||
if (outgoing.length) {
|
||
lineageHtml += `
|
||
<div>
|
||
<div class="lineage-group-title">前置先决依据:</div>
|
||
<div class="lineage-chips">
|
||
${outgoing.map(o => `<div class="lineage-chip" data-node-id="${escapeHtml(o.id)}">↖ ${escapeHtml(o.title)}</div>`).join('')}
|
||
</div>
|
||
</div>
|
||
`;
|
||
}
|
||
if (incoming.length) {
|
||
lineageHtml += `
|
||
<div style="margin-top:10px;">
|
||
<div class="lineage-group-title">派生制约影响:</div>
|
||
<div class="lineage-chips">
|
||
${incoming.map(i => `<div class="lineage-chip" data-node-id="${escapeHtml(i.id)}">↘ ${escapeHtml(i.title)}</div>`).join('')}
|
||
</div>
|
||
</div>
|
||
`;
|
||
}
|
||
if (!incoming.length && !outgoing.length) {
|
||
lineageHtml = '<span style="font-family:var(--font-mono);font-size:11px;color:var(--text-tertiary);">独立节点,暂无交叉引用</span>';
|
||
}
|
||
document.getElementById('dr-lineage-stream').innerHTML = lineageHtml;
|
||
|
||
// 打开新笔记前重置滚动位置,避免从上一篇的底部开始显示
|
||
document.querySelector('#drawer-console .console-body').scrollTop = 0;
|
||
|
||
document.getElementById('drawer-curtain').classList.add('open');
|
||
document.getElementById('drawer-console').classList.add('open');
|
||
history.replaceState(null, '', '#note=' + encodeURIComponent(id));
|
||
}
|
||
|
||
function closeConsole() {
|
||
document.getElementById('drawer-curtain').classList.remove('open');
|
||
document.getElementById('drawer-console').classList.remove('open');
|
||
history.replaceState(null, '', '#' + Core.activeTab);
|
||
}
|
||
|
||
function handleDeepLink(link) {
|
||
for (const n of Core.nodes) {
|
||
if (link.includes(n.slug)) {
|
||
openConsole(n.id);
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
function routeToListFilter(filterVal) {
|
||
switchDeckTab('directory');
|
||
// 彻底清空可能残留的旧筛选项与搜索词,确保列表与点击的卡片完全对应
|
||
Core.stFilter = '';
|
||
Core.clsFilter = '';
|
||
Core.filterQuery = '';
|
||
const gq = document.getElementById('global-query');
|
||
if (gq) gq.value = '';
|
||
document.getElementById('select-status').value = '';
|
||
document.getElementById('select-class').value = '';
|
||
|
||
if (['implemented', 'proposed', 'rejected', 'archived'].includes(filterVal)) {
|
||
Core.stFilter = filterVal;
|
||
document.getElementById('select-status').value = filterVal;
|
||
} else if (CLASSES.includes(filterVal)) {
|
||
Core.clsFilter = filterVal;
|
||
document.getElementById('select-class').value = filterVal;
|
||
}
|
||
renderDirectory();
|
||
}
|
||
|
||
function switchDeckTab(viewId) {
|
||
if (viewId.startsWith('note=')) {
|
||
const id = decodeURIComponent(viewId.slice('note='.length));
|
||
openConsole(id);
|
||
return;
|
||
}
|
||
if (!['baseline', 'timeline', 'alternatives', 'directory'].includes(viewId)) viewId = 'baseline';
|
||
Core.activeTab = viewId;
|
||
document.querySelectorAll('.deck-tab').forEach(t => t.classList.toggle('active', t.dataset.view === viewId));
|
||
document.querySelectorAll('.canvas-view').forEach(p => p.classList.toggle('active', p.id === `view-${viewId}`));
|
||
if (location.hash.slice(1) !== viewId && !location.hash.includes('note=')) {
|
||
history.replaceState(null, '', '#' + viewId);
|
||
}
|
||
}
|
||
|
||
async function triggerLiveSync(silent = false) {
|
||
if (!Core.dirHandle) return;
|
||
const radar = document.getElementById('radar-indicator');
|
||
const beaconText = document.getElementById('beacon-status');
|
||
radar.className = 'radar-dot syncing';
|
||
beaconText.textContent = '正在同步…';
|
||
|
||
try {
|
||
const notes = await scanDirectory(Core.dirHandle);
|
||
ingestDataset(notes);
|
||
radar.className = 'radar-dot active';
|
||
beaconText.textContent = `已连接本地目录(${notes.length} 篇)`;
|
||
Core.lastSyncTime = Date.now();
|
||
} catch (err) {
|
||
console.error('Directory sync fault:', err);
|
||
radar.className = 'radar-dot';
|
||
beaconText.textContent = '重新授权目录';
|
||
}
|
||
}
|
||
|
||
async function startMission() {
|
||
document.querySelectorAll('.deck-tab').forEach(tab => {
|
||
tab.addEventListener('click', () => switchDeckTab(tab.dataset.view));
|
||
});
|
||
|
||
window.addEventListener('hashchange', () => {
|
||
const h = location.hash.slice(1);
|
||
if (h) switchDeckTab(h);
|
||
});
|
||
|
||
const queryInput = document.getElementById('global-query');
|
||
const searchPopover = document.getElementById('search-popover');
|
||
let selectedSearchIdx = -1;
|
||
|
||
function renderSearchPopover(q) {
|
||
if (!q) {
|
||
searchPopover.classList.remove('open');
|
||
searchPopover.innerHTML = '';
|
||
selectedSearchIdx = -1;
|
||
return;
|
||
}
|
||
|
||
const matches = [];
|
||
for (const n of Core.nodes) {
|
||
const hay = `${n.title} ${n.titleZh || ''} ${n.slug} ${n.problem || ''} ${n.problemZh || ''} ${n.decision || ''} ${n.decisionZh || ''}`.toLowerCase();
|
||
if (hay.includes(q)) matches.push(n);
|
||
}
|
||
|
||
const topMatches = matches.slice(0, 7);
|
||
selectedSearchIdx = -1;
|
||
|
||
if (!topMatches.length) {
|
||
searchPopover.innerHTML = `<div class="popover-empty">// 未找到与 "${escapeHtml(q)}" 匹配的决策记录</div>`;
|
||
} else {
|
||
searchPopover.innerHTML = topMatches.map((n, idx) => {
|
||
const title = escapeHtml(n.title);
|
||
const cites = Core.inCount.get(n.id) || 0;
|
||
return `
|
||
<div class="popover-item" data-id="${escapeHtml(n.id)}" data-idx="${idx}">
|
||
<div class="popover-item-main">
|
||
<div class="popover-title">${title}</div>
|
||
<div class="popover-sub">
|
||
<span class="class-badge cls-${escapeHtml(n.cls)}">${escapeHtml(CLASS_LABELS[n.cls] || n.cls)}</span>
|
||
<span>${escapeHtml(n.date || '进行中')}</span>
|
||
<span>#${escapeHtml(n.slug)}</span>
|
||
</div>
|
||
</div>
|
||
${cites ? `<span class="weight-gauge">↗${cites}</span>` : ''}
|
||
</div>
|
||
`;
|
||
}).join('') + `
|
||
<div class="popover-footer">
|
||
<span>共找到 <b>${matches.length}</b> 项决策</span>
|
||
<span>按 ↵ 回车在全量清单中查看全部</span>
|
||
</div>
|
||
`;
|
||
|
||
searchPopover.querySelectorAll('.popover-item').forEach(item => {
|
||
item.addEventListener('click', () => {
|
||
openConsole(item.dataset.id);
|
||
searchPopover.classList.remove('open');
|
||
});
|
||
});
|
||
}
|
||
|
||
searchPopover.classList.add('open');
|
||
}
|
||
|
||
queryInput.addEventListener('input', e => {
|
||
const q = e.target.value.trim().toLowerCase();
|
||
Core.filterQuery = q;
|
||
Core.altQuery = q;
|
||
renderDirectory();
|
||
renderAlternatives();
|
||
renderSearchPopover(q);
|
||
});
|
||
|
||
queryInput.addEventListener('keydown', e => {
|
||
const items = searchPopover.querySelectorAll('.popover-item');
|
||
if (e.key === 'ArrowDown') {
|
||
e.preventDefault();
|
||
if (!items.length) return;
|
||
selectedSearchIdx = (selectedSearchIdx + 1) % items.length;
|
||
items.forEach((it, i) => it.classList.toggle('selected', i === selectedSearchIdx));
|
||
items[selectedSearchIdx]?.scrollIntoView({ block: 'nearest' });
|
||
} else if (e.key === 'ArrowUp') {
|
||
e.preventDefault();
|
||
if (!items.length) return;
|
||
selectedSearchIdx = (selectedSearchIdx - 1 + items.length) % items.length;
|
||
items.forEach((it, i) => it.classList.toggle('selected', i === selectedSearchIdx));
|
||
items[selectedSearchIdx]?.scrollIntoView({ block: 'nearest' });
|
||
} else if (e.key === 'Enter') {
|
||
e.preventDefault();
|
||
if (selectedSearchIdx >= 0 && items[selectedSearchIdx]) {
|
||
openConsole(items[selectedSearchIdx].dataset.id);
|
||
searchPopover.classList.remove('open');
|
||
} else {
|
||
switchDeckTab('directory');
|
||
searchPopover.classList.remove('open');
|
||
}
|
||
} else if (e.key === 'Escape') {
|
||
searchPopover.classList.remove('open');
|
||
}
|
||
});
|
||
|
||
document.addEventListener('click', e => {
|
||
const nodeTrigger = e.target.closest('[data-node-id]');
|
||
if (nodeTrigger) {
|
||
const id = nodeTrigger.getAttribute('data-node-id');
|
||
if (id) {
|
||
openConsole(id);
|
||
return;
|
||
}
|
||
}
|
||
const deepLink = e.target.closest('.md-deep-link');
|
||
if (deepLink) {
|
||
e.preventDefault();
|
||
const target = deepLink.getAttribute('data-deep-link');
|
||
if (target) handleDeepLink(target);
|
||
return;
|
||
}
|
||
if (!e.target.closest('.hud-search')) {
|
||
searchPopover.classList.remove('open');
|
||
}
|
||
});
|
||
|
||
window.addEventListener('keydown', e => {
|
||
if (e.key === '/' && document.activeElement !== queryInput) {
|
||
e.preventDefault();
|
||
queryInput.focus();
|
||
}
|
||
if (e.key === 'Escape') closeConsole();
|
||
});
|
||
|
||
document.getElementById('alt-query-input').addEventListener('input', e => {
|
||
Core.altQuery = e.target.value;
|
||
renderAlternatives();
|
||
});
|
||
|
||
const selSt = document.getElementById('select-status');
|
||
LIFECYCLES.forEach(s => selSt.innerHTML += `<option value="${s}">状态:${STATUS_LABELS[s]}</option>`);
|
||
selSt.addEventListener('change', e => { Core.stFilter = e.target.value; renderDirectory(); });
|
||
|
||
const selCls = document.getElementById('select-class');
|
||
CLASSES.forEach(c => selCls.innerHTML += `<option value="${c}">分类:${CLASS_LABELS[c]}</option>`);
|
||
selCls.addEventListener('change', e => { Core.clsFilter = e.target.value; renderDirectory(); });
|
||
|
||
document.getElementById('select-sort').addEventListener('change', e => { Core.sortMode = e.target.value; renderDirectory(); });
|
||
|
||
const btnResetMatrix = document.getElementById('btn-reset-matrix-filter');
|
||
if (btnResetMatrix) {
|
||
btnResetMatrix.addEventListener('click', () => {
|
||
Core.stFilter = '';
|
||
Core.clsFilter = '';
|
||
Core.filterQuery = '';
|
||
const gq = document.getElementById('global-query');
|
||
if (gq) gq.value = '';
|
||
document.getElementById('select-status').value = '';
|
||
document.getElementById('select-class').value = '';
|
||
renderDirectory();
|
||
});
|
||
}
|
||
|
||
document.getElementById('btn-console-close').addEventListener('click', closeConsole);
|
||
document.getElementById('drawer-curtain').addEventListener('click', closeConsole);
|
||
|
||
async function requestDirectoryAccess() {
|
||
if (!('showDirectoryPicker' in window)) {
|
||
alert('请使用 Chrome / Edge 浏览器体验 File System Access 本地无感同步。');
|
||
return;
|
||
}
|
||
try {
|
||
const handle = await window.showDirectoryPicker({ mode: 'read' });
|
||
Core.dirHandle = handle;
|
||
await saveDirHandle(handle);
|
||
await triggerLiveSync();
|
||
} catch (err) {
|
||
if (err.name !== 'AbortError') console.error('Directory request fault:', err);
|
||
}
|
||
}
|
||
|
||
document.getElementById('beacon-sync').addEventListener('click', requestDirectoryAccess);
|
||
document.getElementById('btn-authorize-dir').addEventListener('click', requestDirectoryAccess);
|
||
document.getElementById('btn-mount-demo').addEventListener('click', () => loadSampleDataset());
|
||
|
||
if (window.__INLINE_DATA__ && window.__INLINE_DATA__.length) {
|
||
ingestDataset(window.__INLINE_DATA__);
|
||
} else {
|
||
const saved = await loadSavedDirHandle();
|
||
if (saved) {
|
||
Core.dirHandle = saved;
|
||
try {
|
||
if ((await saved.queryPermission({ mode: 'read' })) === 'granted') {
|
||
await triggerLiveSync();
|
||
} else {
|
||
document.getElementById('beacon-status').textContent = '点击确认授权';
|
||
}
|
||
} catch {
|
||
document.getElementById('deck-onboarding').style.display = 'flex';
|
||
}
|
||
} else {
|
||
document.getElementById('deck-onboarding').style.display = 'flex';
|
||
}
|
||
}
|
||
|
||
window.addEventListener('focus', () => {
|
||
if (Core.dirHandle && Date.now() - Core.lastSyncTime > 2500) {
|
||
triggerLiveSync(true);
|
||
}
|
||
});
|
||
|
||
setInterval(() => {
|
||
if (Core.dirHandle && document.hasFocus() && Date.now() - Core.lastSyncTime > 4000) {
|
||
triggerLiveSync(true);
|
||
}
|
||
}, 5000);
|
||
|
||
if (location.hash.slice(1)) {
|
||
switchDeckTab(location.hash.slice(1));
|
||
}
|
||
}
|
||
|
||
function loadSampleDataset() {
|
||
const sample = [
|
||
{
|
||
id: 'implemented/architecture/2026-06-13-capability-seams.md',
|
||
slug: '2026-06-13-capability-seams',
|
||
lifecycle: 'implemented',
|
||
cls: 'architecture',
|
||
date: '2026-06-13',
|
||
title: '能力 Seam:Service Definition / Provider / Consumer 三权分立',
|
||
problem: '各项能力关注点以不同速率变化。把实现与面向模型的工具契约绑在一起,会导致换沙箱实现时工具 Schema 频发破坏性变更。',
|
||
decision: '拆分为 Service Definition(Cordis 抽象服务声明)、Service Provider(本地或沙箱实现插件)与 Consumer(面向模型的 Schema 工具),实现三者独立演进。',
|
||
alternatives: '### 始终合并各角色\n否决,重新耦合了独立变化的关注点。\n### @cordisjs/plugin-capability\n这是权限安全服务,并非实现替换机制。',
|
||
consequences: '增加包数量与胶水样板;换来沙箱后端替换时彻底零破坏面向模型的工具约定。',
|
||
outLinks: [],
|
||
},
|
||
{
|
||
id: 'implemented/architecture/2026-07-20-canonical-tool-output-contract.md',
|
||
slug: '2026-07-20-canonical-tool-output-contract',
|
||
lifecycle: 'implemented',
|
||
cls: 'architecture',
|
||
date: '2026-07-20',
|
||
title: '规范化工具输出契约 (Canonical Output Contract)',
|
||
problem: '工具直接产出 model-facing 的 ContentBlock 文本,导致编程式工具调用(PTC)无法拿到稳定的强类型领域对象。',
|
||
decision: '每个工具声明强制的 Canonical Output:执行期输出强类型 DTO,并通过纯函数式 render() 投影成持久化和模型可读文本。',
|
||
alternatives: '### 双轨制返回值\n否决,维护双重契约增加心智负担。',
|
||
consequences: '执行期拥有强类型无损数据;PTC 模式无需反向解析字符串。',
|
||
outLinks: ['implemented/architecture/2026-06-13-capability-seams.md'],
|
||
}
|
||
];
|
||
ingestDataset(sample);
|
||
}
|
||
|
||
document.addEventListener('DOMContentLoaded', startMission);
|
||
</script>
|
||
</body>
|
||
</html> |