cortico-world-self-awareness 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.2
4
+
5
+ **时间线换了一张脸,顺便补上一个漏掉的模式。**
6
+
7
+ - **页面重做**:从原来的一列灰字,改成「深空意识舱」——深空蓝黑底、紫色思绪、青色状态,左边是思绪流,右边是留给下一次的便笺和接口诊断。
8
+ 思绪按今天/昨天/日期分组,可筛选;正文放大到 15px、行高 1.9,长时间看不再费眼。
9
+ - **补 `synthesize`(综合)**:0.4.0 加了第五种模式,但页面上的模式表只认四个——综合模式会原样显示英文 `synthesize`,筛选栏里也没有它。
10
+ 现在有中文名、有颜色、能筛选。
11
+ - **五种模式有说明了**:筛选栏下面加一行图例,写明「回看/走神/打算/琢磨/综合」各自在做什么,不用再翻文档猜。
12
+ - 接口检测仍放在右侧「系统信号」卡片里;10 秒限流单独显示「等一下」,不冒充故障。
13
+ - 测试 54 项不变,全部通过。
14
+
3
15
  ## 0.6.1
4
16
 
5
17
  把「测接口」做得能看见了。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-self-awareness",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "description": "桌宠自己的内在时间线:没人说话的时候她也在想事情——想起旧事、走神、反复琢磨一件没想明白的。\n\n它只负责「想」:想到的写在本机一个文件里,不发消息,也不占对话的 token。配合「记忆核心」使用——你开口时,记忆核心会挑一条带进上下文,标明时间,并说清那不一定是你现在的想法。单独装也能跑,但那是一本她自己不会翻的日记。\n\n模型自选,OpenAI 兼容接口就行;默认一天最多 12 次,一次几分钱。\n\nQQ 交流群:745879632",
6
6
  "keywords": [
package/webui/index.html CHANGED
@@ -5,267 +5,351 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <title>她的时间线 · 自我意识</title>
7
7
  <style>
8
- :root {
9
- --bg: #060911;
10
- --panel: rgba(120, 220, 214, 0.045);
11
- --line: rgba(120, 220, 214, 0.14);
12
- --text: #d9e6f2;
13
- --dim: rgba(150, 172, 200, 0.55);
14
- --faint: rgba(150, 172, 200, 0.32);
15
- --accent: #7fe3d4;
16
- --reflect: #7fe3d4;
17
- --wonder: #b9a7ff;
18
- --plan: #8cc4ff;
19
- --doubt: #ffc27f;
20
- }
21
- * { box-sizing: border-box; }
22
- body {
23
- margin: 0; background: var(--bg); color: var(--text);
24
- font: 14px/1.65 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
25
- padding: 28px 20px 64px;
26
- }
27
- .wrap { max-width: 760px; margin: 0 auto; }
28
- header { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
29
- h1 { font-size: 17px; font-weight: 500; margin: 0; letter-spacing: .02em; }
30
- h1::before {
31
- content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
32
- background: var(--accent); box-shadow: 0 0 12px var(--accent); margin-right: 9px; vertical-align: 3px;
33
- }
34
- .sub { color: var(--faint); font-size: 12px; letter-spacing: .04em; }
35
- .stats {
36
- display: flex; gap: 22px; flex-wrap: wrap; margin: 18px 0 26px;
37
- padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
38
- }
39
- .stat { min-width: 78px; }
40
- .stat b { display: block; font-size: 19px; font-weight: 500; font-variant-numeric: tabular-nums; }
41
- .stat span { color: var(--dim); font-size: 11.5px; }
42
- .warn { color: #ffb3a7; }
43
- .topline { display: flex; align-items: stretch; gap: 12px; margin: 18px 0 10px; }
44
- .topline .stats { flex: 1; margin: 0; min-width: 0; }
45
- .probe-card {
46
- flex: none; width: 102px; display: flex; flex-direction: column;
47
- align-items: center; justify-content: center; gap: 9px;
48
- background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
49
- color: var(--dim); font: inherit; font-size: 12.5px; letter-spacing: .05em;
50
- cursor: pointer; padding: 0; transition: color .18s, border-color .18s, background .18s;
51
- }
52
- .probe-card:hover:not(:disabled) {
53
- color: var(--accent); border-color: rgba(127, 227, 212, .45); background: rgba(127, 227, 212, .06);
54
- }
55
- .probe-card:disabled { cursor: default; }
56
- .probe-card svg { width: 24px; height: 24px; display: block; }
57
- .probe-card.testing { color: var(--accent); border-color: rgba(127, 227, 212, .4); }
58
- .probe-card.testing svg { animation: pulse 1.1s ease-in-out infinite; }
59
- .probe-card.ok { color: var(--accent); border-color: rgba(127, 227, 212, .5); background: rgba(127, 227, 212, .07); }
60
- .probe-card.bad { color: #ffb3a7; border-color: rgba(255, 120, 100, .45); background: rgba(255, 90, 70, .06); }
61
- @keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.06); } }
62
- .probe-msg {
63
- margin: 0 0 22px; padding: 9px 14px; border-radius: 8px; font-size: 12.5px;
64
- border: 1px solid var(--line); color: var(--dim); background: var(--panel);
65
- animation: fadein .25s ease-out;
66
- }
67
- .probe-msg.ok { color: var(--accent); border-color: rgba(127, 227, 212, .3); background: rgba(127, 227, 212, .05); }
68
- .probe-msg.bad { color: #ffb3a7; border-color: rgba(255, 120, 100, .3); background: rgba(255, 90, 70, .06); }
69
- @keyframes fadein { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
70
- .err {
71
- margin: 0 0 20px; padding: 10px 14px; border-radius: 8px;
72
- border: 1px solid rgba(255, 120, 100, 0.3); background: rgba(255, 90, 70, 0.07);
73
- color: #ffb3a7; font-size: 12.5px;
74
- }
75
- h2 {
76
- font-size: 12px; font-weight: 500; color: var(--faint); letter-spacing: .16em;
77
- text-transform: none; margin: 30px 0 14px;
78
- }
79
- .list { position: relative; padding-left: 20px; min-height: 60px; }
80
- .list::before {
81
- content: ''; position: absolute; left: 4px; top: 6px; bottom: 0; width: 1px;
82
- background: linear-gradient(180deg, var(--line) 0%, var(--line) 70%, transparent);
83
- }
84
- .item { position: relative; padding: 0 0 20px; }
85
- .item::before {
86
- content: ''; position: absolute; left: -19px; top: 8px; width: 5px; height: 5px;
87
- border-radius: 50%; background: var(--accent); opacity: .75;
88
- }
89
- .item.reflect::before { background: var(--reflect); }
90
- .item.wonder::before { background: var(--wonder); }
91
- .item.plan::before { background: var(--plan); }
92
- .item.doubt::before { background: var(--doubt); }
93
- .meta { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--faint); margin-bottom: 5px; }
94
- .mode { letter-spacing: .06em; }
95
- .item.reflect .mode { color: var(--reflect); }
96
- .item.wonder .mode { color: var(--wonder); }
97
- .item.plan .mode { color: var(--plan); }
98
- .item.doubt .mode { color: var(--doubt); }
99
- .dots { display: inline-flex; gap: 2px; }
100
- .dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(150, 172, 200, 0.18); }
101
- .dots i.on { background: currentColor; opacity: .85; }
102
- .text { white-space: pre-wrap; word-break: break-word; }
103
- .carry { color: var(--faint); font-size: 11px; margin-left: 4px; }
104
- .empty { color: var(--faint); padding: 26px 0; }
105
- .note-line {
106
- margin-top: 6px; padding-left: 10px; border-left: 1px solid rgba(201, 162, 255, 0.35);
107
- color: rgba(201, 162, 255, 0.75); font-size: 12px;
108
- }
109
- .refl { padding: 12px 16px; border-left: 2px solid var(--accent); background: var(--panel); border-radius: 0 8px 8px 0; margin-bottom: 12px; }
110
- .refl .meta { margin-bottom: 6px; }
111
- footer { margin-top: 40px; color: var(--faint); font-size: 11.5px; letter-spacing: .03em; }
112
- code { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; color: var(--dim); }
8
+ :root {
9
+ --bg: #080c14;
10
+ --bg-deep: #060910;
11
+ --surface: #0e1622;
12
+ --surface-2: #121d2c;
13
+ --surface-3: #172337;
14
+ --line: rgba(143, 183, 221, .18);
15
+ --line-soft: rgba(143, 183, 221, .1);
16
+ --text: #e7edf7;
17
+ --muted: #8b9ab0;
18
+ --faint: #56657b;
19
+ --cyan: #66e3d3;
20
+ --cyan-soft: rgba(102, 227, 211, .12);
21
+ --purple: #c9a2ff;
22
+ --purple-soft: rgba(201, 162, 255, .12);
23
+ --blue: #8cc4ff;
24
+ --amber: #f4c47c;
25
+ --rose: #f2a6c9;
26
+ --red: #ff9f9b;
27
+ --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
28
+ }
29
+ * { box-sizing: border-box; }
30
+ html { background: var(--bg); }
31
+ body {
32
+ margin: 0; min-width: 320px; color: var(--text); background:
33
+ linear-gradient(rgba(102, 227, 211, .025) 1px, transparent 1px),
34
+ linear-gradient(90deg, rgba(102, 227, 211, .025) 1px, transparent 1px),
35
+ radial-gradient(circle at 75% 0%, rgba(108, 77, 170, .14), transparent 34rem),
36
+ var(--bg);
37
+ background-size: 48px 48px, 48px 48px, auto, auto;
38
+ font: 14px/1.7 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
39
+ padding: 30px 24px 72px;
40
+ }
41
+ button { font: inherit; }
42
+ .wrap { max-width: 1120px; margin: 0 auto; }
43
+ .topbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 3px 0 22px; border-bottom: 1px solid var(--line-soft); }
44
+ .brand { display: flex; align-items: center; gap: 11px; }
45
+ .brand-mark { width: 10px; height: 10px; border: 1px solid var(--cyan); border-radius: 50%; box-shadow: 0 0 0 4px rgba(102, 227, 211, .08); }
46
+ .brand-title { font-size: 18px; font-weight: 500; letter-spacing: .03em; }
47
+ .brand-sub { margin-left: 10px; color: var(--faint); font: 11px var(--mono); letter-spacing: .03em; }
48
+ .live { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
49
+ .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px rgba(102, 227, 211, .75); }
50
+ .live-dot.offline { background: var(--faint); box-shadow: none; }
51
+ .live-dot.error { background: var(--red); box-shadow: 0 0 10px rgba(255, 159, 155, .55); }
52
+ .hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; padding: 34px 0 25px; }
53
+ .eyebrow { color: var(--cyan); font: 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; }
54
+ h1 { margin: 8px 0 5px; font-size: 30px; line-height: 1.2; font-weight: 500; letter-spacing: .02em; }
55
+ .hero-copy { color: var(--muted); max-width: 630px; }
56
+ .hero-id { color: var(--faint); font: 11px var(--mono); text-align: right; line-height: 1.8; }
57
+ .signal-bar { display: grid; grid-template-columns: 1.35fr repeat(3, minmax(110px, .55fr)); gap: 1px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 30px; }
58
+ .signal, .next-signal { background: rgba(14, 22, 34, .94); min-height: 92px; padding: 17px 19px; }
59
+ .signal-label { color: var(--faint); font-size: 11px; letter-spacing: .08em; }
60
+ .signal-value { margin-top: 5px; font-size: 22px; line-height: 1.25; font-weight: 500; font-variant-numeric: tabular-nums; }
61
+ .signal-value.small { font-size: 15px; }
62
+ .signal-note { color: var(--muted); font-size: 11px; margin-top: 4px; }
63
+ .next-signal { position: relative; background: linear-gradient(115deg, rgba(201, 162, 255, .13), rgba(14, 22, 34, .95) 60%); }
64
+ .next-signal::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 2px; background: var(--purple); }
65
+ .next-signal .signal-label, .next-signal .signal-value { padding-left: 3px; }
66
+ .layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 30px; align-items: start; }
67
+ .section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 17px; }
68
+ .section-title { margin: 0; font-size: 13px; font-weight: 500; letter-spacing: .13em; color: var(--muted); }
69
+ .section-count { color: var(--faint); font: 11px var(--mono); }
70
+ .filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 23px; }
71
+ .filter { color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 5px; padding: 5px 10px; cursor: pointer; font-size: 12px; transition: .18s ease; }
72
+ .filter:hover, .filter.active { color: var(--cyan); border-color: rgba(102, 227, 211, .55); background: var(--cyan-soft); }
73
+ .mode-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -10px 0 22px; color: var(--faint); font-size: 11px; line-height: 1.7; }
74
+ .mode-legend span { display: inline-flex; align-items: center; gap: 6px; }
75
+ .mode-legend i { width: 5px; height: 5px; border-radius: 50%; flex: none; }
76
+ .mode-legend b { color: var(--muted); font-weight: 400; }
77
+ .day { margin: 0 0 26px; }
78
+ .day-label { display: flex; align-items: center; gap: 10px; margin: 0 0 15px 22px; color: var(--faint); font: 11px var(--mono); letter-spacing: .1em; }
79
+ .day-label::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); }
80
+ .timeline { position: relative; padding-left: 23px; }
81
+ .timeline::before { content: ''; position: absolute; left: 4px; top: 8px; bottom: 13px; width: 1px; background: linear-gradient(var(--line), rgba(143, 183, 221, 0)); }
82
+ .item { position: relative; padding: 0 0 24px; }
83
+ .item::before { content: ''; position: absolute; left: -22px; top: 8px; width: 7px; height: 7px; border: 2px solid var(--bg); border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 1px rgba(102, 227, 211, .6); }
84
+ .item.wonder::before { background: var(--purple); box-shadow: 0 0 0 1px rgba(201, 162, 255, .55); }
85
+ .item.plan::before { background: var(--blue); box-shadow: 0 0 0 1px rgba(140, 196, 255, .55); }
86
+ .item.doubt::before { background: var(--amber); box-shadow: 0 0 0 1px rgba(244, 196, 124, .55); }
87
+ .item.synthesize::before { background: var(--rose); box-shadow: 0 0 0 1px rgba(242, 166, 201, .55); }
88
+ .meta { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; color: var(--faint); font: 11px var(--mono); margin-bottom: 7px; }
89
+ .mode { color: var(--cyan); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 12px; }
90
+ .item.wonder .mode { color: var(--purple); }
91
+ .item.plan .mode { color: var(--blue); }
92
+ .item.doubt .mode { color: var(--amber); }
93
+ .item.synthesize .mode { color: var(--rose); }
94
+ .carry { color: var(--purple); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
95
+ .importance { display: inline-flex; gap: 3px; align-items: center; }
96
+ .importance i { display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--faint); opacity: .45; }
97
+ .importance i.on { background: var(--purple); opacity: .9; }
98
+ .text { color: var(--text); font-size: 15px; line-height: 1.9; white-space: pre-wrap; word-break: break-word; }
99
+ .item:hover .text { color: #f3f7fd; }
100
+ .note-line { margin-top: 11px; padding: 8px 12px; color: var(--purple); background: var(--purple-soft); border-left: 2px solid var(--purple); border-radius: 0 6px 6px 0; font-size: 12px; }
101
+ .note-line span { color: rgba(201, 162, 255, .65); margin-left: 5px; font-family: var(--mono); }
102
+ .empty { color: var(--muted); padding: 26px 0; border-top: 1px dashed var(--line); }
103
+ .aside { display: flex; flex-direction: column; gap: 12px; }
104
+ .card { position: relative; background: rgba(14, 22, 34, .92); border: 1px solid var(--line); border-radius: 11px; padding: 17px; }
105
+ .card-title { display: flex; justify-content: space-between; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
106
+ .card-title b { color: var(--text); font-weight: 500; letter-spacing: 0; }
107
+ .next-card { border-color: rgba(201, 162, 255, .34); background: linear-gradient(145deg, rgba(201, 162, 255, .11), rgba(14, 22, 34, .96) 55%); }
108
+ .next-card .card-title { color: var(--purple); }
109
+ .next-text { margin: 15px 0 12px; color: var(--text); line-height: 1.8; }
110
+ .next-time { color: var(--muted); font: 11px var(--mono); }
111
+ .disclaimer { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line-soft); color: var(--faint); font-size: 11px; line-height: 1.6; }
112
+ .health { display: flex; align-items: center; gap: 7px; color: var(--cyan); font-size: 12px; }
113
+ .health.error { color: var(--red); }
114
+ .health.offline { color: var(--muted); }
115
+ .health-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
116
+ .details { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
117
+ .detail { padding: 9px 10px; background: rgba(86, 101, 123, .1); border-radius: 6px; }
118
+ .detail span { display: block; color: var(--faint); font-size: 10px; }
119
+ .detail b { display: block; margin-top: 2px; font: 12px var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
120
+ .probe { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line-soft); }
121
+ .probe button { color: var(--cyan); background: transparent; border: 1px solid rgba(102, 227, 211, .38); border-radius: 5px; padding: 5px 9px; cursor: pointer; font-size: 11px; transition: .18s ease; }
122
+ .probe button:hover:not(:disabled) { background: var(--cyan-soft); border-color: var(--cyan); }
123
+ .probe button:disabled { color: var(--faint); cursor: default; }
124
+ .probe-result { color: var(--muted); font: 10px var(--mono); }
125
+ .probe-result.ok { color: var(--cyan); }
126
+ .probe-result.bad { color: var(--red); }
127
+ .probe-result.wait { color: var(--amber); }
128
+ .err { color: var(--red); border: 1px solid rgba(255, 159, 155, .27); background: rgba(255, 159, 155, .07); border-radius: 7px; padding: 9px 12px; margin-bottom: 18px; font-size: 12px; }
129
+ .reflections { margin-top: 20px; padding-top: 24px; border-top: 1px solid var(--line-soft); }
130
+ .refl { margin-bottom: 10px; padding: 13px 15px; background: rgba(102, 227, 211, .06); border-left: 2px solid var(--cyan); border-radius: 0 7px 7px 0; }
131
+ .refl .meta { margin-bottom: 5px; }
132
+ footer { margin-top: 38px; color: var(--faint); font-size: 11px; }
133
+ code { color: var(--muted); font: 11px var(--mono); }
134
+ @media (max-width: 780px) {
135
+ body { padding: 22px 16px 55px; }
136
+ .hero { display: block; padding-top: 27px; }
137
+ .hero-id { margin-top: 13px; text-align: left; }
138
+ .signal-bar { grid-template-columns: 1fr 1fr; }
139
+ .next-signal { grid-column: span 2; }
140
+ .layout { grid-template-columns: 1fr; }
141
+ .aside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
142
+ .aside .next-card { grid-column: span 2; }
143
+ }
144
+ @media (max-width: 520px) {
145
+ .topbar { align-items: flex-start; }
146
+ .brand { align-items: flex-start; }
147
+ .brand-sub { display: block; margin: 3px 0 0; }
148
+ .live { white-space: nowrap; }
149
+ h1 { font-size: 25px; }
150
+ .signal-bar { grid-template-columns: 1fr 1fr; }
151
+ .signal, .next-signal { min-height: 78px; padding: 13px 14px; }
152
+ .signal-value { font-size: 18px; }
153
+ .aside { display: flex; }
154
+ .text { font-size: 14px; }
155
+ }
113
156
  </style>
114
157
  </head>
115
158
  <body>
116
159
  <div class="wrap">
117
- <header>
118
- <h1>她的时间线</h1>
119
- <span class="sub" id="sub">读取中…</span>
160
+ <header class="topbar">
161
+ <div class="brand">
162
+ <span class="brand-mark" aria-hidden="true"></span>
163
+ <div><span class="brand-title">她的时间线</span><span class="brand-sub" id="sub">SELF-AWARENESS / LOADING</span></div>
164
+ </div>
165
+ <div class="live"><span class="live-dot" id="liveDot"></span><span id="liveText">正在读取状态</span></div>
120
166
  </header>
121
167
 
122
- <div class="topline">
123
- <div class="stats" id="stats"></div>
124
- <button class="probe-card" id="probe" title="发一句「在吗」,看模型通不通">
125
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
126
- <path d="M2 12h4l2.5-6 4 13 2.5-7h7"/>
127
- </svg>
128
- <span id="probeLabel">测接口</span>
129
- </button>
130
- </div>
131
- <div class="probe-msg" id="probeMsg" hidden></div>
132
- <div id="err"></div>
168
+ <section class="hero">
169
+ <div>
170
+ <div class="eyebrow">Private thought archive / 01</div>
171
+ <h1>那些没有说出口的片刻</h1>
172
+ <div class="hero-copy">她在安静时留下的思绪轨迹。这里记录的是模型生成的内在笔记,不代表持续存在的主观体验。</div>
173
+ </div>
174
+ <div class="hero-id">LOCAL NODE<br><span id="heroModel">MODEL / --</span></div>
175
+ </section>
176
+
177
+ <section class="signal-bar" aria-label="运行概览">
178
+ <div class="next-signal">
179
+ <div class="signal-label">NEXT THOUGHT / 下一次</div>
180
+ <div class="signal-value small" id="next">未安排</div>
181
+ <div class="signal-note" id="nextHint">由她上一次留下的安排决定</div>
182
+ </div>
183
+ <div class="signal"><div class="signal-label">TODAY / 今日</div><div class="signal-value" id="todayCount">0</div><div class="signal-note">次思考</div></div>
184
+ <div class="signal"><div class="signal-label">TOKENS / 消耗</div><div class="signal-value" id="todayTokens">0</div><div class="signal-note">本地统计</div></div>
185
+ <div class="signal"><div class="signal-label">ARCHIVE / 记录</div><div class="signal-value" id="totalThoughts">0</div><div class="signal-note">条思绪</div></div>
186
+ </section>
133
187
 
134
- <h2>想过的事</h2>
135
- <div id="list" class="list"><div class="empty">还没有想法。<br>她每 25–90 分钟想一次,第一条通常要等几分钟。</div></div>
188
+ <div id="err"></div>
189
+ <div class="layout">
190
+ <main>
191
+ <div class="section-head"><h2 class="section-title">THOUGHT STREAM / 思绪流</h2><span class="section-count" id="sectionCount">0 EVENTS</span></div>
192
+ <div class="filters" role="tablist" aria-label="筛选思绪类型">
193
+ <button class="filter active" data-filter="all">全部</button>
194
+ <button class="filter" data-filter="reflect">回看</button>
195
+ <button class="filter" data-filter="wonder">走神</button>
196
+ <button class="filter" data-filter="plan">打算</button>
197
+ <button class="filter" data-filter="doubt">琢磨</button>
198
+ <button class="filter" data-filter="synthesize">综合</button>
199
+ </div>
200
+ <div class="mode-legend">
201
+ <span><i style="background:var(--cyan)"></i><b>回看</b>想起以前的事</span>
202
+ <span><i style="background:var(--purple)"></i><b>走神</b>没缘由地飘走</span>
203
+ <span><i style="background:var(--blue)"></i><b>打算</b>接下来想做什么</span>
204
+ <span><i style="background:var(--amber)"></i><b>琢磨</b>一件没想明白的</span>
205
+ <span><i style="background:var(--rose)"></i><b>综合</b>两件不相干的事找共同点</span>
206
+ </div>
207
+ <div id="list"><div class="empty">还没有想法。<br>她会在安静时留下下一条思绪,第一条通常要等几分钟。</div></div>
208
+ <section class="reflections" id="reflWrap" hidden>
209
+ <div class="section-head"><h2 class="section-title">SELF REVIEW / 她对自己的看法</h2></div>
210
+ <div id="refl"></div>
211
+ </section>
212
+ </main>
136
213
 
137
- <div id="reflWrap" hidden>
138
- <h2>她对自己的看法</h2>
139
- <div id="refl"></div>
214
+ <aside class="aside">
215
+ <section class="card next-card">
216
+ <div class="card-title"><span>NEXT NOTE / 留给下一次</span><b id="nextMode">—</b></div>
217
+ <div class="next-text" id="nextNote">她还没有给下一次留下便笺。</div>
218
+ <div class="next-time" id="nextDue">WAITING / 等待下一次安排</div>
219
+ <div class="disclaimer">时间来自上一次生成的自我安排。睡眠、对话或接口状态可能让它推迟。</div>
220
+ </section>
221
+ <section class="card">
222
+ <div class="card-title"><span>SYSTEM SIGNAL / 系统信号</span><span class="health" id="health"><i class="health-dot"></i><span>读取中</span></span></div>
223
+ <div class="details">
224
+ <div class="detail"><span>MODEL</span><b id="model">--</b></div>
225
+ <div class="detail"><span>MODE</span><b id="enabled">--</b></div>
226
+ <div class="detail"><span>DAILY LIMIT</span><b id="dailyLimit">--</b></div>
227
+ <div class="detail"><span>LAST ERROR</span><b id="lastError">NONE</b></div>
228
+ </div>
229
+ <div class="probe"><span class="probe-result" id="probeMsg">接口检测不会写入思绪</span><button id="probe" title="发送一次最小请求来测试接口">测接口</button></div>
230
+ </section>
231
+ <section class="card">
232
+ <div class="card-title"><span>ABOUT THIS SPACE / 关于这里</span></div>
233
+ <div style="color:var(--muted);font-size:12px;line-height:1.8;margin-top:10px">这是她自己的本地思绪档案。记忆核心会在合适的时候挑选其中的内容带回对话,并明确标记来源与时间。</div>
234
+ </section>
235
+ </aside>
140
236
  </div>
141
237
 
142
- <footer>
143
- 数据来自 <code>self-awareness/thoughts.jsonl</code>,只存在这台机器上。每 30 秒自动刷新。
144
- </footer>
238
+ <footer>DATA SOURCE · <code>self-awareness/thoughts.jsonl</code> · 只存在这台机器上 · 每 30 秒自动刷新</footer>
145
239
  </div>
146
-
147
240
  <script>
148
- const MODE_NAME = { reflect: '回看', wonder: '走神', plan: '打算', doubt: '琢磨' };
241
+ const MODE_NAME = { reflect: '回看', wonder: '走神', plan: '打算', doubt: '琢磨', synthesize: '综合' };
242
+ let allThoughts = [];
243
+ let activeFilter = 'all';
149
244
 
150
245
  function esc(s) {
151
- return String(s ?? '').replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
246
+ return String(s ?? '').replace(/[&<>\"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '\"': '&quot;' }[c]));
152
247
  }
153
-
248
+ function dateObj(iso) { const d = new Date(iso); return Number.isNaN(d.getTime()) ? null : d; }
154
249
  function clock(iso) {
155
- const d = new Date(iso);
156
- if (Number.isNaN(d.getTime())) return '';
250
+ const d = dateObj(iso); if (!d) return '';
157
251
  const p = (n) => String(n).padStart(2, '0');
158
- return `${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
252
+ return `${p(d.getHours())}:${p(d.getMinutes())}`;
159
253
  }
160
-
254
+ function dateKey(iso) { const d = dateObj(iso); return d ? `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}` : 'unknown'; }
255
+ function dateLabel(iso) {
256
+ const d = dateObj(iso); if (!d) return 'UNKNOWN DATE';
257
+ const now = new Date();
258
+ if (dateKey(iso) === dateKey(now.toISOString())) return 'TODAY / 今天';
259
+ const yesterday = new Date(now); yesterday.setDate(now.getDate() - 1);
260
+ if (dateKey(iso) === dateKey(yesterday.toISOString())) return 'YESTERDAY / 昨天';
261
+ return `${String(d.getMonth() + 1).padStart(2, '0')}.${String(d.getDate()).padStart(2, '0')} / ${d.getFullYear()}`;
262
+ }
263
+ function nextClock(iso) { const d = dateObj(iso); return d ? `${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')} ${clock(iso)}` : '未安排'; }
161
264
  function dots(n) {
162
- let out = '<span class="dots">';
163
- for (let i = 1; i <= 10; i += 1) out += `<i class="${i <= n ? 'on' : ''}"></i>`;
265
+ const value = Math.max(0, Math.min(10, Number(n) || 0));
266
+ let out = '<span class="importance" title="重要度 ' + value + ' / 10">';
267
+ for (let i = 1; i <= 10; i += 1) out += `<i class="${i <= value ? 'on' : ''}"></i>`;
164
268
  return out + '</span>';
165
269
  }
166
-
167
- function render(d) {
168
- document.getElementById('sub').textContent = d.model ? `模型 ${d.model}` : '还没配模型';
169
-
170
- const next = d.nextDueAt ? clock(d.nextDueAt) : '未安排';
171
- const limit = d.limit?.count || 0;
172
- document.getElementById('stats').innerHTML = [
173
- `<div class="stat"><b>${d.today?.count ?? 0}${limit ? `<span style="font-size:12px;color:var(--faint)">/${limit}</span>` : ''}</b><span>今天想过</span></div>`,
174
- `<div class="stat"><b>${(d.today?.tokens ?? 0).toLocaleString()}</b><span>今天用了 token</span></div>`,
175
- `<div class="stat"><b>${d.totalThoughts ?? 0}</b><span>一共想过</span></div>`,
176
- `<div class="stat"><b style="font-size:15px">${next}</b><span>下次</span></div>`,
177
- `<div class="stat"><b style="font-size:15px" class="${d.enabled ? '' : 'warn'}">${d.enabled ? '在跑' : '已关'}</b><span>状态</span></div>`,
178
- ].join('');
179
-
180
- document.getElementById('err').innerHTML = d.error
181
- ? `<div class="err">上次调用失败:${esc(d.error)}</div>`
182
- : '';
183
-
184
- const list = d.thoughts || [];
185
- document.getElementById('list').innerHTML = list.length
186
- ? list.map((t) => `
187
- <div class="item ${esc(t.mode)}">
188
- <div class="meta">
189
- <span>${clock(t.ts)}</span>
190
- <span class="mode">${MODE_NAME[t.mode] || t.mode}</span>
191
- ${dots(t.importance)}
192
- ${t.carry ? '<span class="carry">接着上次</span>' : ''}
193
- </div>
270
+ function formatNumber(n) { return Number(n || 0).toLocaleString('zh-CN'); }
271
+ function statusInfo(d) {
272
+ if (d.error) return { kind: 'error', text: '上次调用有错误' };
273
+ if (!d.enabled) return { kind: 'offline', text: '已暂停' };
274
+ return { kind: 'online', text: '自我意识运行中' };
275
+ }
276
+ function renderThoughts() {
277
+ const list = allThoughts.filter((t) => activeFilter === 'all' || t.mode === activeFilter);
278
+ const count = document.getElementById('sectionCount');
279
+ count.textContent = `${list.length} EVENT${list.length === 1 ? '' : 'S'}`;
280
+ if (!list.length) {
281
+ document.getElementById('list').innerHTML = '<div class="empty">这个筛选下还没有思绪。</div>';
282
+ return;
283
+ }
284
+ const groups = [];
285
+ const map = new Map();
286
+ list.forEach((t) => {
287
+ const key = dateKey(t.ts);
288
+ if (!map.has(key)) { const group = { key, ts: t.ts, items: [] }; map.set(key, group); groups.push(group); }
289
+ map.get(key).items.push(t);
290
+ });
291
+ document.getElementById('list').innerHTML = groups.map((g) => `
292
+ <section class="day"><div class="day-label">${dateLabel(g.ts)}</div><div class="timeline">
293
+ ${g.items.map((t) => `<article class="item ${esc(t.mode)}">
294
+ <div class="meta"><span>${clock(t.ts)}</span><span class="mode">${esc(MODE_NAME[t.mode] || t.mode || '思绪')}</span>${dots(t.importance)}${t.carry ? '<span class="carry">接着上一条</span>' : ''}</div>
194
295
  <div class="text">${esc(t.text)}</div>
195
- ${t.nextNote ? `<div class="note-line">留给自己:${esc(t.nextNote)}${t.nextIn ? `(${t.nextIn} 分钟后)` : ''}</div>` : ''}
196
- </div>`).join('')
197
- : '<div class="empty">还没有想法。<br>她每 25–90 分钟想一次,第一条通常要等几分钟。</div>';
198
-
296
+ ${t.nextNote ? `<div class="note-line">留给下一次:${esc(t.nextNote)}${t.nextIn ? `<span>+${esc(t.nextIn)} MIN</span>` : ''}</div>` : ''}
297
+ </article>`).join('')}
298
+ </div></section>`).join('');
299
+ }
300
+ function render(d) {
301
+ const status = statusInfo(d);
302
+ const model = d.model || '未配置';
303
+ const next = d.nextDueAt ? nextClock(d.nextDueAt) : '未安排';
304
+ document.getElementById('sub').textContent = `SELF-AWARENESS / ${String(model).toUpperCase()}`;
305
+ document.getElementById('heroModel').textContent = `MODEL / ${model}`;
306
+ document.getElementById('next').textContent = next;
307
+ document.getElementById('nextHint').textContent = d.nextDueAt ? '她给未来的自己留了一点方向' : '由她下一次思考时自行决定';
308
+ document.getElementById('todayCount').textContent = formatNumber(d.today?.count);
309
+ document.getElementById('todayTokens').textContent = formatNumber(d.today?.tokens);
310
+ document.getElementById('totalThoughts').textContent = formatNumber(d.totalThoughts);
311
+ document.getElementById('model').textContent = model;
312
+ document.getElementById('enabled').textContent = d.enabled ? 'RUNNING' : 'PAUSED';
313
+ document.getElementById('dailyLimit').textContent = d.limit?.count ? `${d.limit.count} / DAY` : 'NO LIMIT';
314
+ document.getElementById('lastError').textContent = d.error ? 'DETECTED' : 'NONE';
315
+ const liveDot = document.getElementById('liveDot'); liveDot.className = `live-dot ${status.kind === 'online' ? '' : status.kind}`;
316
+ document.getElementById('liveText').textContent = status.text;
317
+ const health = document.getElementById('health'); health.className = `health ${status.kind === 'online' ? '' : status.kind}`; health.innerHTML = `<i class="health-dot"></i><span>${status.kind === 'online' ? 'ONLINE' : status.kind === 'error' ? 'ERROR' : 'OFFLINE'}</span>`;
318
+ document.getElementById('err').innerHTML = d.error ? `<div class="err">上次调用失败:${esc(d.error)}</div>` : '';
319
+ allThoughts = d.thoughts || [];
320
+ const latestNote = allThoughts.find((t) => t.nextNote);
321
+ document.getElementById('nextNote').textContent = latestNote?.nextNote || '她还没有给下一次留下便笺。';
322
+ document.getElementById('nextMode').textContent = latestNote ? (MODE_NAME[latestNote.mode] || '思绪') : '—';
323
+ document.getElementById('nextDue').textContent = latestNote?.nextIn ? `NEXT / ${latestNote.nextIn} MINUTES LATER` : (d.nextDueAt ? `NEXT / ${next}` : 'WAITING / 等待下一次安排');
199
324
  const refl = d.reflections || [];
200
325
  document.getElementById('reflWrap').hidden = !refl.length;
201
- document.getElementById('refl').innerHTML = refl.map((r) => `
202
- <div class="refl">
203
- <div class="meta"><span>${clock(r.ts)}</span><span>由 ${r.fromCount} 条想法收成</span></div>
204
- <div class="text">${esc(r.text)}</div>
205
- </div>`).join('');
326
+ document.getElementById('refl').innerHTML = refl.map((r) => `<div class="refl"><div class="meta"><span>${clock(r.ts)}</span><span>由 ${r.fromCount} 条想法收成</span></div><div class="text">${esc(r.text)}</div></div>`).join('');
327
+ renderThoughts();
206
328
  }
207
-
208
329
  async function load() {
209
- try {
210
- const rsp = await fetch('/api/data', { cache: 'no-store' });
211
- render(await rsp.json());
212
- } catch (e) {
213
- document.getElementById('sub').textContent = '读不到数据';
214
- }
330
+ try { const rsp = await fetch('/api/data', { cache: 'no-store' }); render(await rsp.json()); }
331
+ catch (e) { document.getElementById('sub').textContent = 'SELF-AWARENESS / UNAVAILABLE'; document.getElementById('liveText').textContent = '读不到时间线服务'; document.getElementById('liveDot').className = 'live-dot error'; }
215
332
  }
216
-
217
- load();
218
- setInterval(load, 30000);
219
-
220
- const probeBtn = document.getElementById('probe');
221
- const probeLabel = document.getElementById('probeLabel');
333
+ document.querySelectorAll('.filter').forEach((button) => button.addEventListener('click', () => {
334
+ activeFilter = button.dataset.filter;
335
+ document.querySelectorAll('.filter').forEach((b) => b.classList.toggle('active', b === button));
336
+ renderThoughts();
337
+ }));
338
+ const probeButton = document.getElementById('probe');
222
339
  const probeMsg = document.getElementById('probeMsg');
223
-
224
- probeBtn.addEventListener('click', async () => {
225
- probeBtn.disabled = true;
226
- probeBtn.className = 'probe-card testing';
227
- probeLabel.textContent = '测中';
228
- probeMsg.hidden = false;
229
- probeMsg.className = 'probe-msg';
230
- probeMsg.textContent = '正在发一句「在吗」…';
340
+ probeButton.addEventListener('click', async () => {
341
+ probeButton.disabled = true; probeButton.textContent = '检测中'; probeMsg.className = 'probe-result'; probeMsg.textContent = '发送最小请求…';
231
342
  try {
232
- const rsp = await fetch('/api/probe', { method: 'POST' });
233
- const r = await rsp.json();
234
- const ok = Boolean(r.ok);
235
- if (r.throttled) {
236
- // 刚测过,不是接口问题
237
- probeBtn.className = 'probe-card';
238
- probeLabel.textContent = '等一下';
239
- probeMsg.className = 'probe-msg';
240
- probeMsg.textContent = '刚才测过,隔十秒再点一次';
241
- } else {
242
- probeBtn.className = 'probe-card ' + (ok ? 'ok' : 'bad');
243
- probeLabel.textContent = ok ? `通了 ${r.ms}ms` : '没通';
244
- probeMsg.className = 'probe-msg ' + (ok ? 'ok' : 'bad');
245
- probeMsg.textContent = ok
246
- ? `接口正常 · ${r.model} · 往返 ${r.ms}ms`
247
- : `接口不通 · ${r.error}`;
248
- }
249
- } catch (e) {
250
- probeBtn.className = 'probe-card bad';
251
- probeLabel.textContent = '没通';
252
- probeMsg.className = 'probe-msg bad';
253
- probeMsg.textContent = '请求发不出去,时间线服务可能已经停了';
254
- } finally {
255
- setTimeout(() => {
256
- probeBtn.disabled = false;
257
- probeBtn.className = 'probe-card';
258
- probeLabel.textContent = '测接口';
259
- probeMsg.hidden = true;
260
- }, 8000);
261
- }
343
+ const rsp = await fetch('/api/probe', { method: 'POST' }); const r = await rsp.json();
344
+ if (r.throttled) { probeMsg.className = 'probe-result wait'; probeMsg.textContent = '刚测过,请稍等'; }
345
+ else if (r.ok) { probeMsg.className = 'probe-result ok'; probeMsg.textContent = `通了 · ${r.ms}ms`; }
346
+ else { probeMsg.className = 'probe-result bad'; probeMsg.textContent = '没通 · 查看错误'; }
347
+ } catch (e) { probeMsg.className = 'probe-result bad'; probeMsg.textContent = '服务不可达'; }
348
+ setTimeout(() => { probeButton.disabled = false; probeButton.textContent = '测接口'; }, 8000);
262
349
  });
263
-
264
- // 带 #probe 打开就自动测一次:省得每次都要点(也方便截图看状态)
265
- if (location.hash === '#probe') probeBtn.click();
266
-
267
- // 带 #probe 打开就自动测一次:省得每次都要点(也方便截图看状态)
268
- if (location.hash === '#probe') probeBtn.click();
350
+ load();
351
+ setInterval(load, 30000);
352
+ if (location.hash === '#probe') probeButton.click();
269
353
  </script>
270
354
  </body>
271
355
  </html>