cortico-world-self-awareness 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.0
4
+
5
+ **这次把方向盘交出去了:怎么想、什么时候停,由她定。**
6
+
7
+ - **方式她自己挑**:每次把五种方式(回看/走神/打算/琢磨/综合)摆出来,插件只给一个建议——「这会儿更像走神」。
8
+ 她要在 `mode` 里写别的,就按她的来。接着上一条往下想时不摆菜单,只说「说新的一层」。
9
+ - **她可以叫停**:输出里写 `"rest": true`,就按她给的时长歇着——最短 2 小时、最长一天,没给时间默认 8 小时。
10
+ 以前间隔被夹在 15–360 分钟,等于**永远会被叫醒**,没有「这件事我想完了」的出口。
11
+ - **便签不再硬性 12 小时过期**:她说「明早再看」,原来隔 13 小时那张便签就没了。现在过期时间跟着她自己的间隔走
12
+ (最少 12 小时,最多 36 小时)。
13
+ - **想法记下当时的状态**:`mood` / `energy` / `phase`(深夜、清晨…)一起写进 `thoughts.jsonl`。
14
+ 以前心情和时段只喂给模型,回看时什么都看不到。时间线每条现在会标「深夜 · 精力 22」。
15
+ - **时间线**:叫停的那条标「她先搁着了」,右侧便笺显示「她说先搁着,X 再看」;
16
+ 便签内容改由服务端算好(过期的直接不给),不会再挂着三天前的话。
17
+ - **小修**:`carry` 只在她沿用了建议时才标;自己换了方式多半是换了件事,不该再说「接着上一条」。
18
+ - 测试 54 → 68 项。
19
+
3
20
  ## 0.6.2
4
21
 
5
22
  **时间线换了一张脸,顺便补上一个漏掉的模式。**
package/README.md CHANGED
@@ -41,6 +41,10 @@
41
41
  她每想完一件事,可以给自己留一句「下次从哪儿接着想」和一个大致间隔(15 分钟到 6 小时)。
42
42
  下次思考时,那句话会原样递回到她眼前。她没留,才按上面的密度算。
43
43
 
44
+ **她也可以说不想了。** 写一个 `rest`,就按她给的时长歇着(最短 2 小时,最长一天;没给时间默认 8 小时),
45
+ 时间线上会标一句「她先搁着了」。这不是卡住,是她自己叫停。
46
+ 留的那句话也不再硬性 12 小时过期:她留得越久,便签存得越久(最多 36 小时)。
47
+
44
48
  于是会出现这种连续:
45
49
 
46
50
  ```
@@ -55,7 +59,7 @@
55
59
 
56
60
  ---
57
61
 
58
- ## 四种模式轮换
62
+ ## 五种方式,她自己挑
59
63
 
60
64
  | 模式 | 她在干什么 |
61
65
  |---|---|
@@ -63,8 +67,10 @@
63
67
  | `wonder` | 手上没做事,脑子飘走了 |
64
68
  | `plan` | 想接下来要做什么(不是任务清单) |
65
69
  | `doubt` | 有件事一直没想明白,再想一次 |
70
+ | `synthesize` | 把两件看着不相干的事连起来看 |
66
71
 
67
- 七成按顺序轮,三成随机跳——否则会变成「四个模式轮流打卡」。
72
+ **方式不是插件派的。** 每次会把五种摆出来,插件只给一个建议(「这会儿更像走神」),
73
+ 她自己要换就在 `mode` 里写。她要接着上一条往下想时,才不摆菜单,直接让她说新的一层。
68
74
 
69
75
  ---
70
76
 
@@ -115,7 +121,7 @@
115
121
  插件会开一个只在本机的小网页(默认 `http://127.0.0.1:7802`,被占用会自动往后找)。
116
122
  在 World 页点「看她的时间线」就能打开。
117
123
 
118
- - 按时间倒序,每条标:时间、模式(回看 / 走神 / 打算 / 琢磨)、重要度点
124
+ - 按时间倒序,每条标:时间、方式(回看 / 走神 / 打算 / 琢磨 / 综合)、时段、当时的精力、重要度点
119
125
  - 接着上次想下去的会单独标出来
120
126
  - 底部是「她对自己的看法」——几条碎念攒够重要度后自动收成的一句
121
127
  - 顶部:今天几次、花了多少 token、下次什么时候、现在是**在跑 / 睡着了 / 出错 / 已关闭**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-self-awareness",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "description": "桌宠自己的内在时间线:没人说话的时候她也在想事情——想起旧事、走神、反复琢磨一件没想明白的。\n\n它只负责「想」:想到的写在本机一个文件里,不发消息,也不占对话的 token。配合「记忆核心」使用——你开口时,记忆核心会挑一条带进上下文,标明时间,并说清那不一定是你现在的想法。单独装也能跑,但那是一本她自己不会翻的日记。\n\n模型自选,OpenAI 兼容接口就行;默认一天最多 12 次,一次几分钱。\n\nQQ 交流群:745879632",
6
6
  "keywords": [
package/src/config.ts CHANGED
@@ -130,7 +130,7 @@ const RAW_GROUP: ConfigGroup = {
130
130
  'worlds.self-awareness.maxGapMin': {
131
131
  type: 'integer',
132
132
  title: '最长隔多久',
133
- description: '想到的东西多,就自动往这个上限靠;想得敷衍,就往上面那个下限靠。',
133
+ description: '想到的东西多,就自动往这个上限靠;想得敷衍,就往上面那个下限靠。她说「先搁着」时不受这里限制(可到一天)。',
134
134
  minimum: 2,
135
135
  maximum: 1440,
136
136
  default: 90,
package/src/pool.ts CHANGED
@@ -30,6 +30,12 @@ export interface Thought {
30
30
  nextIn?: number;
31
31
  /** 她给自己留的话:「明早再看看那个帖子」。下次会原样递回去。 */
32
32
  nextNote?: string;
33
+ /** 她说「先搁着」——不是按密度排的下一跳,是她自己叫停的。 */
34
+ rest?: boolean;
35
+ /** 写下这条时的状态,用来在时间线上回看「她当时是什么样子」。 */
36
+ mood?: number;
37
+ energy?: number;
38
+ phase?: string;
33
39
  }
34
40
 
35
41
  export interface Reflection {
@@ -103,6 +109,10 @@ export class ThoughtPool {
103
109
  ...(t.carry ? { carry: true } : {}),
104
110
  ...(t.nextIn ? { nextIn: t.nextIn } : {}),
105
111
  ...(t.nextNote ? { nextNote: t.nextNote } : {}),
112
+ ...(t.rest ? { rest: true } : {}),
113
+ ...(typeof t.mood === 'number' ? { mood: t.mood } : {}),
114
+ ...(typeof t.energy === 'number' ? { energy: t.energy } : {}),
115
+ ...(t.phase ? { phase: t.phase } : {}),
106
116
  };
107
117
  ensureDir(this.dir);
108
118
  // 先让 cache 落地再 append:否则 all() 会从文件里读回刚写的那条,push 之后就有了两份
@@ -183,12 +193,37 @@ export function clamp01(n: number): number {
183
193
  /** 她自己说的「多久之后再想」的允许范围。上下都留边:说 1 分钟太密,说三天就断了。 */
184
194
  export const NEXT_MIN_MINUTES = 15;
185
195
  export const NEXT_MAX_MINUTES = 360;
196
+ /** 说「先搁着」时允许拉得更长:至少两小时,最多一天。 */
197
+ export const REST_MIN_MINUTES = 120;
198
+ export const REST_MAX_MINUTES = 1440;
199
+ /** 她说了 rest 却没给间隔时的默认值:睡一觉再说。 */
200
+ export const REST_DEFAULT_MINUTES = 480;
186
201
 
187
202
  /** 把模型给的值收进合法范围;不是数字就当没写。 */
188
- export function clampNextIn(value: unknown): number | undefined {
203
+ export function clampNextIn(value: unknown, max = NEXT_MAX_MINUTES): number | undefined {
189
204
  const v = Number(value);
190
205
  if (!Number.isFinite(v) || v <= 0) return undefined;
191
- return Math.round(Math.max(NEXT_MIN_MINUTES, Math.min(NEXT_MAX_MINUTES, v)));
206
+ return Math.round(Math.max(NEXT_MIN_MINUTES, Math.min(max, v)));
207
+ }
208
+
209
+ /** 「先搁着」用的间隔:范围比平时宽。 */
210
+ export function clampRestIn(value: unknown): number | undefined {
211
+ const v = Number(value);
212
+ if (!Number.isFinite(v) || v <= 0) return undefined;
213
+ return Math.round(Math.max(REST_MIN_MINUTES, Math.min(REST_MAX_MINUTES, v)));
214
+ }
215
+
216
+ /**
217
+ * 她留的那句话能存多久。
218
+ * 以前是硬 12 小时——她说「明早再看」,隔了 13 小时那张便签就直接没了。
219
+ * 现在跟着她自己的 next 走:留的间隔越长,便签留得越久;仍留上限,免得半年前的便签被翻出来。
220
+ */
221
+ export const NOTE_TTL_MS = 12 * 3_600_000;
222
+ export const NOTE_TTL_MAX_MS = 36 * 3_600_000;
223
+
224
+ export function noteTtlMs(t: { nextIn?: number }): number {
225
+ const byHer = (Number(t.nextIn) || 0) * 60_000 + 3_600_000;
226
+ return Math.min(NOTE_TTL_MAX_MS, Math.max(NOTE_TTL_MS, byHer));
192
227
  }
193
228
 
194
229
  /** 累计重要度到这条线就该往上抽象一层了(写一条 reflection)。 */
package/src/think.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * 全部用「你就是她」的第二人称写提示词——用第三人称会写成分析报告。
6
6
  */
7
7
  import type { Thought, ThoughtMode } from './pool.ts';
8
- import { clampImportance, clampNextIn, density } from './pool.ts';
8
+ import { clampImportance, clampNextIn, clampRestIn, density } from './pool.ts';
9
9
  import { clip } from './time.ts';
10
10
 
11
11
  export interface ThinkContext {
@@ -39,21 +39,38 @@ ${persona ? `你是谁:${persona}\n` : ''}
39
39
  - 别汇报工作,别复述别人交给你做的事。独处时想的不是待办。
40
40
  - 想不通就想不通,可以停在半路。人独处时大部分念头都没有结论。
41
41
  - 不要提「用户」「对话」「模型」「AI」「记忆」「记录」「卡片」这些词。
42
- - 想完之后,留一句「下次从哪儿接着想」和大致的间隔写进 next;想完了就空着。
42
+ - 用什么方式想,你自己挑:回看 / 走神 / 打算 / 琢磨 / 综合。
43
+ - 想完之后,留一句「下次从哪儿接着想」和大致的间隔写进 next。
44
+ - 真的不想了、想搁着,就写 "rest":true,间隔可以长到一天。
43
45
 
44
46
  只输出一行 JSON,不要别的:
45
- {"thought":"你想到的那件事","importance":1,"next":{"in":60,"note":"留给自己的一句话"}}
47
+ {"thought":"你想到的那件事","importance":1,"mode":"wonder","next":{"in":60,"note":"留给自己的一句话"},"rest":false}
48
+ mode 只能填:reflect(回看以前的事)/ wonder(没缘由地走神)/ plan(打算接下来做什么)/ doubt(琢磨一件没想明白的)/ synthesize(把两件看着不相干的事连起来)。
46
49
  importance 是 1-10:这件事对你有多重要。10 = 你会一直想它。
47
- next 是你给自己留的:还会想,就定个时间(15–360 分钟)和一句「下次从哪儿接着想」。
50
+ next 是你给自己留的:还会想,就定个时间(15–360 分钟;写了 rest 可以到 1440)和一句「下次从哪儿接着想」。
48
51
  想完了、没什么可接的,就空着。`;
49
52
  }
50
53
 
54
+ const MODE_LABEL: Record<ThoughtMode, string> = {
55
+ reflect: '回看',
56
+ wonder: '走神',
57
+ plan: '打算',
58
+ doubt: '琢磨',
59
+ synthesize: '综合',
60
+ };
61
+
62
+ /** 把五种方式摆给她选,不是替她定。 */
63
+ const MODE_MENU = [
64
+ '· 回看:想起以前的一件事,回头看它',
65
+ '· 走神:手上没在做什么,脑子飘走了',
66
+ '· 打算:想自己接下来要做什么(不是待办清单)',
67
+ '· 琢磨:一件一直没想明白的事,再想一次',
68
+ '· 综合:把两件看着没关系的事连起来看',
69
+ ].join('\n');
70
+
51
71
  const MODE_ASK: Record<ThoughtMode, (ctx: ThinkContext) => string> = {
52
72
  reflect: (ctx) => {
53
73
  if (!ctx.focus) return '你想起了以前的一件事。现在回头看它,感觉和当时一样吗?';
54
- if (ctx.carry) {
55
- return `你上次想到「${ctx.focus}」,没想完。接着往下想——说新的一层,别把上次那句重说一遍。`;
56
- }
57
74
  return `你想起了这件事:「${ctx.focus}」。现在回头看它,感觉和当时一样吗?`;
58
75
  },
59
76
  wonder: () => '你手上没在做什么,脑子飘走了。飘到哪算哪,不用有理由。',
@@ -88,7 +105,17 @@ export function buildMessages(mode: ThoughtMode, ctx: ThinkContext): { role: str
88
105
  lines.push('(你最近没想过什么。)');
89
106
  }
90
107
  lines.push('');
91
- lines.push(MODE_ASK[mode](ctx));
108
+ if (ctx.carry && ctx.focus) {
109
+ // 接着上一条想:这时候别让她换题,除非她自己要换
110
+ lines.push(`上次你想到「${ctx.focus}」,没想完。接着往下想——说新的一层,别把上次那句重说一遍。`);
111
+ lines.push(`想换件事也行;换就换,mode 里写你这次想用的方式。`);
112
+ } else {
113
+ lines.push('这次没人跟你说话。想怎么想都行:');
114
+ lines.push(MODE_MENU);
115
+ if (ctx.focus) lines.push(`(手边现成的事:「${ctx.focus}」,想从这儿起头也行,不想用也行。)`);
116
+ lines.push(`这会儿更像「${MODE_LABEL[mode]}」:${MODE_ASK[mode](ctx)}`);
117
+ lines.push('你也可以换别的,mode 里写你选的。');
118
+ }
92
119
  return [
93
120
  { role: 'system', content: systemPrompt(ctx.persona) },
94
121
  { role: 'user', content: lines.join('\n') },
@@ -188,11 +215,28 @@ export interface ParsedThought {
188
215
  next?: { in?: number; note?: string };
189
216
  }
190
217
 
191
- /** 她给自己留的那句:范围收进 15–360 分钟,note 超过 40 字截断。都不合法就当没留。 */
192
- export function parseNext(value: unknown): { in?: number; note?: string } | undefined {
218
+ export interface ParsedThought {
219
+ text: string;
220
+ importance: number;
221
+ next?: { in?: number; note?: string };
222
+ /** 她自己挑的方式。没填就用插件建议的那个。 */
223
+ mode?: ThoughtMode;
224
+ /** 她说「先搁着」。 */
225
+ rest?: boolean;
226
+ }
227
+
228
+ const MODE_IDS: ThoughtMode[] = ['reflect', 'wonder', 'plan', 'doubt', 'synthesize'];
229
+
230
+ function asMode(value: unknown): ThoughtMode | undefined {
231
+ return typeof value === 'string' && (MODE_IDS as string[]).includes(value) ? (value as ThoughtMode) : undefined;
232
+ }
233
+
234
+ /** 她给自己留的那句:范围收进合法范围,note 超过 40 字截断。都不合法就当没留。 */
235
+ export function parseNext(value: unknown, rest = false): { in?: number; note?: string } | undefined {
193
236
  if (!value || typeof value !== 'object') return undefined;
194
237
  const o = value as { in?: unknown; note?: unknown };
195
- const inMin = clampNextIn(o.in);
238
+ // 说了 rest 就允许拉到一天,否则还是 15–360
239
+ const inMin = rest ? clampRestIn(o.in) : clampNextIn(o.in);
196
240
  const note = typeof o.note === 'string' && o.note.trim() ? clip(o.note.trim(), 40) : undefined;
197
241
  if (inMin === undefined && !note) return undefined;
198
242
  return { ...(inMin !== undefined ? { in: inMin } : {}), ...(note ? { note } : {}) };
@@ -203,11 +247,19 @@ export function parseThought(raw: string): ParsedThought {
203
247
 
204
248
  const tryJson = (s: string): ParsedThought | null => {
205
249
  try {
206
- const o = JSON.parse(s) as { thought?: unknown; text?: unknown; importance?: unknown; next?: unknown };
250
+ const o = JSON.parse(s) as { thought?: unknown; text?: unknown; importance?: unknown; next?: unknown; mode?: unknown; rest?: unknown };
207
251
  const text = String(o.thought ?? o.text ?? '').trim();
208
252
  if (!text) return null;
209
- const next = parseNext(o.next);
210
- return { text, importance: clampImportance(o.importance), ...(next ? { next } : {}) };
253
+ const rest = o.rest === true || o.rest === 'true';
254
+ const next = parseNext(o.next, rest);
255
+ const mode = asMode(o.mode);
256
+ return {
257
+ text,
258
+ importance: clampImportance(o.importance),
259
+ ...(next ? { next } : {}),
260
+ ...(mode ? { mode } : {}),
261
+ ...(rest ? { rest: true } : {}),
262
+ };
211
263
  } catch {
212
264
  return null;
213
265
  }
@@ -259,16 +311,19 @@ export async function thinkOnce(
259
311
  if (!res.ok || !res.text) return { ok: false, reason: res.reason ?? '调用失败' };
260
312
  const parsed = parseThought(res.text);
261
313
  if (!parsed.text) return { ok: false, reason: '解析后没有内容' };
314
+ // 她自己挑了方式就用她的;没挑就沿用插件建议的
315
+ const finalMode = parsed.mode ?? mode;
262
316
  return {
263
317
  ok: true,
264
318
  thought: {
265
- mode,
319
+ mode: finalMode,
266
320
  text: clip(parsed.text, 400),
267
321
  importance: parsed.importance,
268
322
  seeds,
269
323
  // 她自己留的那句要带出去,不然解析了也白解析
270
324
  ...(parsed.next?.in ? { nextIn: parsed.next.in } : {}),
271
325
  ...(parsed.next?.note ? { nextNote: parsed.next.note } : {}),
326
+ ...(parsed.rest ? { rest: true } : {}),
272
327
  promptTokens: res.promptTokens,
273
328
  outputTokens: res.outputTokens,
274
329
  },
package/src/world.ts CHANGED
@@ -24,6 +24,8 @@ import {
24
24
  density,
25
25
  loadBudget,
26
26
  nextGapMinutes,
27
+ noteTtlMs,
28
+ REST_DEFAULT_MINUTES,
27
29
  rollDay,
28
30
  saveBudget,
29
31
  type BudgetState,
@@ -327,7 +329,15 @@ export class SelfAwarenessWorld implements World {
327
329
 
328
330
  this.fails = 0;
329
331
  this.lastError = '';
330
- const thought = this.pool.add({ ...res.thought, carry: Boolean(carry) });
332
+ const thought = this.pool.add({
333
+ ...res.thought,
334
+ // 她还按建议往下接,才算「接着上一条」;自己换了方式,多半是换了件事
335
+ carry: Boolean(carry) && res.thought.mode === mode,
336
+ // 把「她当时是什么样子」一起存下来:时间线以后能回看,不只是知道她想了什么
337
+ ...(typeof core?.mood === 'number' ? { mood: Math.round(core.mood) } : {}),
338
+ ...(typeof core?.energy === 'number' ? { energy: Math.round(core.energy) } : {}),
339
+ phase: timeOfDay(now, this.tz()),
340
+ });
331
341
  this.lastSnapshot = { ts: thought.ts, text: thought.text, mode: thought.mode };
332
342
 
333
343
  this.budget.count += 1;
@@ -335,11 +345,13 @@ export class SelfAwarenessWorld implements World {
335
345
  this.budget.pendingImportance += thought.importance;
336
346
  this.budget.lastThoughtAt = thought.ts;
337
347
 
338
- // 下次隔多久:她自己说了就听她的,没说才按密度算
348
+ // 下次隔多久:她说「先搁着」就按她的长间隔,其余听她自己定的,没定才按密度算
339
349
  const herNext = Number(res.thought.nextIn);
340
350
  const gap = Number.isFinite(herNext) && herNext > 0
341
351
  ? herNext
342
- : nextGapMinutes(density(thought), Number(cfg.minGapMin) || 25, Number(cfg.maxGapMin) || 90);
352
+ : thought.rest
353
+ ? REST_DEFAULT_MINUTES
354
+ : nextGapMinutes(density(thought), Number(cfg.minGapMin) || 25, Number(cfg.maxGapMin) || 90);
343
355
  if (note) this.budget.lastNoteId = note.id;
344
356
  this.budget.nextDueAt = new Date(Date.now() + Math.round(gap * 60_000)).toISOString();
345
357
  saveBudget(this.dataDir, this.budget);
@@ -355,6 +367,7 @@ export class SelfAwarenessWorld implements World {
355
367
  importance: thought.importance,
356
368
  gapMin: Math.round(gap),
357
369
  byHer: Number.isFinite(herNext) && herNext > 0,
370
+ rest: Boolean(thought.rest),
358
371
  ms: Date.now() - started,
359
372
  });
360
373
  } catch {
@@ -435,12 +448,13 @@ export class SelfAwarenessWorld implements World {
435
448
  * 现在都第二天晚上了,再提就是翻旧账。用过的记在 budget.lastNoteId,不重复递。
436
449
  */
437
450
  private latestNote(now: number): { id: string; text: string } | null {
438
- const recent = this.pool.recent(6).reverse();
451
+ const recent = this.pool.recent(12).reverse();
439
452
  for (const t of recent) {
440
453
  if (!t.nextNote) continue;
441
454
  if (t.id === this.budget.lastNoteId) continue;
442
455
  const at = Date.parse(t.ts) || 0;
443
- if (!at || now - at > 12 * 3_600_000) continue;
456
+ // 便签能存多久,跟着她自己定的间隔走(以前硬 12 小时,"明早再看"会直接丢)
457
+ if (!at || now - at > noteTtlMs(t)) continue;
444
458
  return { id: t.id, text: t.nextNote };
445
459
  }
446
460
  return null;
@@ -688,6 +702,22 @@ export class SelfAwarenessWorld implements World {
688
702
  today: { count: this.budget.count, tokens: this.budget.tokens },
689
703
  limit: { count: Number(cfg.dailyLimit) || 0, tokens: Number(cfg.dailyTokenBudget) || 0 },
690
704
  nextDueAt: this.budget.nextDueAt ?? null,
705
+ // 她说「先搁着」的话,页面就别再写「等下一次思考」了——她是在歇,不是卡住了
706
+ resting: (() => {
707
+ const last = this.pool.recent(1)[0];
708
+ return last?.rest ? { at: last.ts, until: this.budget.nextDueAt ?? null } : null;
709
+ })(),
710
+ // 给页面用的「当前那张便签」:过期的不算,免得侧栏挂着三天前的话
711
+ note: (() => {
712
+ // 便签有效期现在能到 36 小时,往回多看几条,别因为条数少就漏了它
713
+ for (const t of this.pool.recent(12).reverse()) {
714
+ if (!t.nextNote) continue;
715
+ const at = Date.parse(t.ts) || 0;
716
+ if (!at || Date.now() - at > noteTtlMs(t)) continue;
717
+ return { text: t.nextNote, in: t.nextIn ?? null, at: t.ts, mode: t.mode };
718
+ }
719
+ return null;
720
+ })(),
691
721
  totalThoughts: this.pool.all().length,
692
722
  thoughts: this.pool
693
723
  .all()
@@ -702,6 +732,10 @@ export class SelfAwarenessWorld implements World {
702
732
  carry: Boolean(t.carry),
703
733
  nextNote: t.nextNote ?? null,
704
734
  nextIn: t.nextIn ?? null,
735
+ rest: Boolean(t.rest),
736
+ mood: typeof t.mood === 'number' ? t.mood : null,
737
+ energy: typeof t.energy === 'number' ? t.energy : null,
738
+ phase: t.phase ?? null,
705
739
  promptTokens: t.promptTokens ?? 0,
706
740
  outputTokens: t.outputTokens ?? 0,
707
741
  })),
package/webui/index.html CHANGED
@@ -92,6 +92,7 @@ h1 { margin: 8px 0 5px; font-size: 30px; line-height: 1.2; font-weight: 500; let
92
92
  .item.doubt .mode { color: var(--amber); }
93
93
  .item.synthesize .mode { color: var(--rose); }
94
94
  .carry { color: var(--purple); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
95
+ .rest-tag { color: var(--rose); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
95
96
  .importance { display: inline-flex; gap: 3px; align-items: center; }
96
97
  .importance i { display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--faint); opacity: .45; }
97
98
  .importance i.on { background: var(--purple); opacity: .9; }
@@ -290,8 +291,8 @@ function renderThoughts() {
290
291
  });
291
292
  document.getElementById('list').innerHTML = groups.map((g) => `
292
293
  <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>
294
+ ${g.items.map((t) => `<article class="item ${esc(t.mode)}${t.rest ? ' rest' : ''}">
295
+ <div class="meta"><span>${clock(t.ts)}</span><span class="mode">${esc(MODE_NAME[t.mode] || t.mode || '思绪')}</span>${t.phase ? `<span>${esc(t.phase)}</span>` : ''}${t.energy != null ? `<span>精力 ${t.energy}</span>` : ''}${dots(t.importance)}${t.carry ? '<span class="carry">接着上一条</span>' : ''}${t.rest ? '<span class="rest-tag">她先搁着了</span>' : ''}</div>
295
296
  <div class="text">${esc(t.text)}</div>
296
297
  ${t.nextNote ? `<div class="note-line">留给下一次:${esc(t.nextNote)}${t.nextIn ? `<span>+${esc(t.nextIn)} MIN</span>` : ''}</div>` : ''}
297
298
  </article>`).join('')}
@@ -304,7 +305,9 @@ function render(d) {
304
305
  document.getElementById('sub').textContent = `SELF-AWARENESS / ${String(model).toUpperCase()}`;
305
306
  document.getElementById('heroModel').textContent = `MODEL / ${model}`;
306
307
  document.getElementById('next').textContent = next;
307
- document.getElementById('nextHint').textContent = d.nextDueAt ? '她给未来的自己留了一点方向' : '由她下一次思考时自行决定';
308
+ document.getElementById('nextHint').textContent = d.resting
309
+ ? '她自己叫停了,不是卡住'
310
+ : d.nextDueAt ? '她给未来的自己留了一点方向' : '由她下一次思考时自行决定';
308
311
  document.getElementById('todayCount').textContent = formatNumber(d.today?.count);
309
312
  document.getElementById('todayTokens').textContent = formatNumber(d.today?.tokens);
310
313
  document.getElementById('totalThoughts').textContent = formatNumber(d.totalThoughts);
@@ -317,10 +320,12 @@ function render(d) {
317
320
  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
321
  document.getElementById('err').innerHTML = d.error ? `<div class="err">上次调用失败:${esc(d.error)}</div>` : '';
319
322
  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 / 等待下一次安排');
323
+ const note = d.note;
324
+ document.getElementById('nextNote').textContent = note?.text || '她还没有给下一次留下便笺。';
325
+ document.getElementById('nextMode').textContent = note ? (MODE_NAME[note.mode] || '思绪') : '—';
326
+ document.getElementById('nextDue').textContent = d.resting
327
+ ? (d.nextDueAt ? `RESTING / 她说先搁着,${next} 再看` : 'RESTING / 她说到这儿了')
328
+ : note?.in ? `NEXT / ${note.in} MINUTES LATER` : (d.nextDueAt ? `NEXT / ${next}` : 'WAITING / 等待下一次安排');
324
329
  const refl = d.reflections || [];
325
330
  document.getElementById('reflWrap').hidden = !refl.length;
326
331
  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('');