dsh-working-activity 0.3.0 → 0.3.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/lib/client.js +3 -3
- package/lib/types/config.d.ts +68 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +141 -0
- package/lib/types/frames.d.ts +37 -0
- package/lib/types/frames.d.ts.map +1 -0
- package/lib/types/frames.js +126 -0
- package/lib/types/index.d.ts +13 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +24 -2
- package/lib/types/lang.d.ts +10 -0
- package/lib/types/lang.d.ts.map +1 -1
- package/lib/types/lang.js +4 -0
- package/lib/types/phrases.d.ts +86 -1
- package/lib/types/phrases.d.ts.map +1 -1
- package/lib/types/phrases.js +247 -16
- package/lib/types/status.d.ts +62 -0
- package/lib/types/status.d.ts.map +1 -1
- package/lib/types/status.js +183 -13
- package/package.json +127 -119
- package/src/config.ts +174 -0
- package/src/frames.ts +138 -0
- package/src/index.ts +43 -2
- package/src/lang.ts +4 -0
- package/src/phrases.ts +294 -16
- package/src/status.ts +209 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phrases.d.ts","sourceRoot":"","sources":["../../src/phrases.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,gCAAgC;AAChC,MAAM,MAAM,UAAU,GAAG,SAAS,MAAM,EAAE,CAAA;AAE1C,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CASzE;AAID,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAiB7C,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,cAAc,EAAE,SAAS;IACpC,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CACjC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AAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7C;AAOD,6DAA6D;AAC7D,wBAAgB,WAAW,IAAI,SAAS,MAAM,EAAE,CAE/C;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,UAAQ,EAAE,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAkBrH;AAED,oDAAoD;AACpD,wBAAgB,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,yDAAyD;AACzD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,4DAA4D;AAC5D,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,GAAG,MAAM,CAUxG;AAED,4FAA4F;AAC5F,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAO7F;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAS9C"}
|
package/lib/types/phrases.js
CHANGED
|
@@ -38,13 +38,13 @@ export const THINKING_PHRASES = [
|
|
|
38
38
|
'等下,我闪个思路', '脑子在蹦迪', '嗯…', '让我想想', '盘一下', '啾', 'lol', 'hm', 'oh',
|
|
39
39
|
'ok', 'um', 'heh', 'uh', 'nah', 'mm', 'wow', 'nice', 'rgrg', 'okk', 'hhh', 'emm', 'emmm',
|
|
40
40
|
'CPU烧了', '让我打个log看看', '先跑一下试试', '定位一下', '排查一下', '看看日志',
|
|
41
|
-
'loading 99%', '让我捋一下逻辑',
|
|
41
|
+
'抓个包看看', 'loading 99%', '让我捋一下逻辑', '嗯…让我偷想一下',
|
|
42
42
|
];
|
|
43
43
|
/** Tiered phrases when thinking runs long (elapsed >= threshold). */
|
|
44
44
|
export const THINKING_TIERS = [
|
|
45
45
|
{ atMs: 30_000, pool: ['嗯,让我细想想', '30秒了,还在盘', '等下,快好了', '别急,就快出结果了', '让我再捋一捋', '嗯…思路没断', '30秒,快了', '等等,有眉目了', '有点久…', '转圈圈…', '马上马上', '快了快了', '别走,就快好了', '在盘了呢', '还在定位', '快复现了'] },
|
|
46
46
|
{ atMs: 60_000, pool: ['1分钟,还在想', '这题有点东西', '让我再钻研下', '嗯…问题不简单', '1分钟,别走开', '盘得有点深', '脑细胞在燃烧', '等等,快盘清了', '还在努力…', '这个有点绕…', '烧脑中…', '别走,快了', '一分钟了,再等等', '这题值得盘', '还在排查', '这个有点复杂'] },
|
|
47
|
-
{ atMs: 300_000, pool: ['5分钟,大工程', '这把我得认真', '确实有点绕', '等等,我在修仙', '快好了,真的', '盘了一大圈', '别慌,在收尾', '给我一首歌的时间', '还没放弃…', '这题真的硬…', '我给跪了…', '憋大招中', '5分钟了,等值了', '快了,真快了', '这个需求很简单', '能跑就别动'] },
|
|
47
|
+
{ atMs: 300_000, pool: ['5分钟,大工程', '这把我得认真', '确实有点绕', '等等,我在修仙', '快好了,真的', '盘了一大圈', '别慌,在收尾', '给我一首歌的时间', '还没放弃…', '这题真的硬…', '我给跪了…', '憋大招中', '5分钟了,等值了', '快了,真快了', '这个需求很简单', '能跑就别动', 'PM说这个很急', '先上线再说'] },
|
|
48
48
|
];
|
|
49
49
|
/** Phrases shown while waiting for the first streamed token. */
|
|
50
50
|
export const WAITING_PHRASES = [
|
|
@@ -58,22 +58,27 @@ export const WAITING_PHRASES = [
|
|
|
58
58
|
];
|
|
59
59
|
/** Tool-name patterns mapped to playful action verbs. */
|
|
60
60
|
export const ACTION_MAP = [
|
|
61
|
-
{ test: /^(read|read_file|cat)$/i, actions: ['翻翻文档', '让我康康', '读一下', '看一眼', '翻阅中', '读读看', '翻翻', '看看', '瞄一眼', '康康', '翻一页'] },
|
|
62
|
-
{ test: /^(write|write_file|create_file)$/i, actions: ['写写写', '下笔中', '码字呢', '写一段', '记录一下', '写一下', '记下来', '落笔', '开写', '存个文件'] },
|
|
63
|
-
{ test: /^(edit|edit_file|str_replace|apply_patch|search_replace)$/i, actions: ['改改', '修修补补', '润色一下', '编辑中', '调整调整', '改一改', '修一下', '改两行', '调一下', '补一刀'] },
|
|
64
|
-
{ test: /^(bash|shell|run|exec|powershell|cmd)$/i, actions: ['跑个命令', 'bash一下', '敲敲指令', '命令行走起', '执行一下', '敲回车', '跑一下', '敲个命令', '跑命令', '使唤终端'] },
|
|
65
|
-
{ test: /^(grep|rg|search|search_in_files)$/i, actions: ['搜搜东西', 'grep 一下', '找找匹配', '关键词走你', '过滤中', '搜搜看', '
|
|
66
|
-
{ test: /^(find|glob)$/i, actions: ['找找文件', '找一下', '寻宝中', '找啊找', '文件在哪', '查找中', '搜搜目录'] },
|
|
61
|
+
{ test: /^(read|read_file|cat)$/i, actions: ['翻翻文档', '让我康康', '读一下', '看一眼', '翻阅中', '读读看', '翻翻', '看看', '瞄一眼', '康康', '翻一页', '翻翻看'] },
|
|
62
|
+
{ test: /^(write|write_file|create_file)$/i, actions: ['写写写', '下笔中', '码字呢', '写一段', '记录一下', '改改再写', '写一下', '记下来', '落笔', '开写', '存个文件'] },
|
|
63
|
+
{ test: /^(edit|edit_file|str_replace|apply_patch|search_replace)$/i, actions: ['改改', '修修补补', '润色一下', '编辑中', '调整调整', '改一改', '修一下', '改两行', '调一下', '补一刀', '动动手指'] },
|
|
64
|
+
{ test: /^(bash|shell|run|exec|powershell|cmd)$/i, actions: ['跑个命令', 'bash一下', '敲敲指令', '命令行走起', '执行一下', '敲回车', '跑一下', '敲个命令', '跑命令', '使唤终端', '跑个腿'] },
|
|
65
|
+
{ test: /^(grep|rg|search|search_in_files|ffgrep)$/i, actions: ['搜搜东西', 'grep 一下', '找找匹配', '关键词走你', '过滤中', '搜搜看', '搜搜', '找找', '搜一下', '扫一眼', '挖一挖'] },
|
|
66
|
+
{ test: /^(find|glob|fffind)$/i, actions: ['找找文件', '找一下', '寻宝中', '找啊找', '文件在哪', '查找中', '摸一下', '搜搜目录'] },
|
|
67
67
|
{ test: /^(ls|list_dir|list)$/i, actions: ['列个清单', '看看目录', 'ls 看一眼', '瞄一下文件', '目录走起', '列出来', '列一下', '瞟一眼', '翻翻'] },
|
|
68
|
-
{ test: /^(web_search|search_web|brave|tavily|exa)$/i, actions: ['网上搜搜', '搜一下', '网络冲浪', '查找资料', '上网瞄瞄', '上网搜搜', '查查', '搜一圈', '打听一下'] },
|
|
69
|
-
{ test: /^(web_fetch|fetch|fetch_content)$/i, actions: ['抓个页面', '拉取一下', 'fetch 中', '扒拉网页', '取点内容', '抓取资料', '扒一下', '打开看看'] },
|
|
70
|
-
{ test: /^(mcp)/i, actions: ['mcp 连一下', '调个服务', '接个工具', 'mcp 走你', '调接口', '连一下', '喊外援', '接一下'] },
|
|
68
|
+
{ test: /^(web_search|search_web|brave|tavily|exa|search-layer)$/i, actions: ['网上搜搜', '搜一下', '网络冲浪', '查找资料', '上网瞄瞄', '上网搜搜', '查查', '搜一圈', '打听一下'] },
|
|
69
|
+
{ test: /^(web_fetch|fetch|fetch_content|get_search_content|batch_web_fetch)$/i, actions: ['抓个页面', '拉取一下', 'fetch 中', '扒拉网页', '取点内容', '抓取资料', '扒一下', '拉一下', '打开看看'] },
|
|
70
|
+
{ test: /^(mcp)/i, actions: ['mcp 连一下', '调个服务', '接个工具', 'mcp 走你', '调接口', '连一下', '调个工具', '喊外援', '接一下', '问问插件'] },
|
|
71
|
+
{ test: /^(recall)$/i, actions: ['回想一下', '回忆中', '提取记忆', '想起啥了', '记起来', '翻翻记忆', '想想之前'] },
|
|
71
72
|
{ test: /^(subagent|agent|task)$/i, actions: ['派个小弟', '小助手出动', '支个 agent', '让小弟跑腿', '代理干活', '子任务起飞', '分个任务', '交给小弟', '派出去'] },
|
|
72
|
-
{ test: /^(todo|manage_todo_list)$/i, actions: ['列个待办', '写个清单', 'todo 安排', '记一下', '待办走起', '清单一下', '记个待办', '打个勾'] },
|
|
73
|
-
{ test: /^(browser|chrome|playwright)/i, actions: ['开个浏览器', '浏览器跑腿', '网页操作', '浏览器干活', '开网页', '点点页面'] },
|
|
73
|
+
{ test: /^(todo|manage_todo_list)$/i, actions: ['列个待办', '写个清单', 'todo 安排', '记一下', '待办走起', '清单一下', '记个待办', '划个清单', '打个勾'] },
|
|
74
|
+
{ test: /^(browser|chrome|playwright|agent_browser|chrome_devtools)/i, actions: ['开个浏览器', '浏览器跑腿', '网页操作', '浏览器干活', '开网页', '开浏览器', '点点页面', '开个页面'] },
|
|
74
75
|
{ test: /^(git|gh|github)/i, actions: ['git 操作', '提交一下', '版本控制', 'git 走你', '提交代码', '管个仓库', 'git 一下'] },
|
|
75
|
-
{ test: /^(
|
|
76
|
-
{ test: /^(
|
|
76
|
+
{ test: /^(notebook|jupyter)/i, actions: ['笔记本记下', '写个笔记', '记个笔记', '本子写写', '记录东西', '跑个 cell'] },
|
|
77
|
+
{ test: /^(ctx_execute|ctx_execute_file|ctx_batch_execute)$/i, actions: ['上下文执行', '跑上下文', 'ctx 执行', '执行一下', '上下文操作', '运行中', '跑段代码', '算一下', '后台跑一下'] },
|
|
78
|
+
{ test: /^(ctx_search|ctx_index|ctx_fetch_and_index)$/i, actions: ['搜上下文', '上下文搜搜', 'ctx 查找', '找找上下文', '搜一下历史', '找找记录', '翻知识库', '查索引', '搜一下笔记'] },
|
|
79
|
+
{ test: /^(ctx_stats|ctx_doctor|ctx_upgrade|ctx_purge|ctx_insight)$/i, actions: ['统计一下', '上下文统计', 'ctx 状态', '看个状态', '统计中', '看看数目', '看看状态', '诊断一下', '查一下'] },
|
|
80
|
+
{ test: /^(ask_user_question|ask)$/i, actions: ['提问中', '问一个问题', 'ask 一下', '请教一下', '问问看', '问一问', '问你个事', '确认一下', '问问你'] },
|
|
81
|
+
{ test: /^(goal_complete|goal_blocked)$/i, actions: ['定个目标', '设定目标', 'goal 设置', '目标走起', '规划一下', '目标确认', '标记目标', '更新进度', '打个勾'] },
|
|
77
82
|
{ test: /^(todo_write)$/i, actions: ['记个待办', '划个清单', '打个勾'] },
|
|
78
83
|
];
|
|
79
84
|
/** Fallback verbs for unknown tools. */
|
|
@@ -85,6 +90,7 @@ export const FAIL_PHRASES = [
|
|
|
85
90
|
'我本地能跑啊', '昨天还能跑', '重启试试', '清一下缓存', '删了重装', '你刷新一下', '环境问题',
|
|
86
91
|
'少了个分号', '拼错了', '没保存', '又不是不能用', '绷不住了', '难绷', '卒', '裂开',
|
|
87
92
|
'血压上来了', '缓存害我', '再给我一次机会', '这波大意了', '手滑', '回滚重来', '换个姿势',
|
|
93
|
+
'重试一次',
|
|
88
94
|
];
|
|
89
95
|
/** Turn-completion phrases. */
|
|
90
96
|
export const DONE_PHRASES = [
|
|
@@ -93,6 +99,7 @@ export const DONE_PHRASES = [
|
|
|
93
99
|
'搞定收工', '收!', '完事!', '下一题', '能跑!', '没报错', '过了', '上线!', '稳了', '6',
|
|
94
100
|
'完工!', '完美收场', '这波不亏', '一次过', '收工摸鱼', '漂亮', '全绿', '干净利落',
|
|
95
101
|
'手到擒来', '水到渠成', '下班!', '歇口气', '交接完成', '工单关闭', '收尾完毕',
|
|
102
|
+
'在我机器上能跑',
|
|
96
103
|
];
|
|
97
104
|
/** Night-owl phrases mixed in between 00:00 and 06:00 local time. */
|
|
98
105
|
export const NIGHT_PHRASES = [
|
|
@@ -141,10 +148,15 @@ export const EN_ACTION_MAP = [
|
|
|
141
148
|
{ test: /^(web_search|search_web|brave|tavily|exa)$/i, actions: ['Searching the web', 'Googling', 'Researching', 'Web diving (the safe kind)', 'Looking it up'] },
|
|
142
149
|
{ test: /^(web_fetch|fetch|fetch_content)$/i, actions: ['Fetching a page', 'Grabbing content', 'Pulling the page', 'Downloading knowledge'] },
|
|
143
150
|
{ test: /^(mcp)/i, actions: ['Calling MCP', 'Hitting a service', 'MCP time', 'Talking to a server'] },
|
|
151
|
+
{ test: /^(recall)$/i, actions: ['Recalling', 'Digging through memory', 'Remembering things', 'Checking the archives'] },
|
|
144
152
|
{ test: /^(subagent|agent|task)$/i, actions: ['Delegating', 'Sending a subagent', 'Calling a helper', 'Outsourcing', 'Drafting a minion'] },
|
|
145
153
|
{ test: /^(todo|manage_todo_list)$/i, actions: ['Updating todos', 'Checking the list', 'Todo time', 'Adding a checkbox'] },
|
|
146
154
|
{ test: /^(browser|chrome|playwright)/i, actions: ['Driving the browser', 'Clicking around', 'Browsing', 'Puppeteering a browser'] },
|
|
147
155
|
{ test: /^(git|gh|github)/i, actions: ['Git-ing', 'Committing', 'Version control dance', 'Git things', 'Saving the timeline'] },
|
|
156
|
+
{ test: /^(notebook|jupyter)/i, actions: ['Writing a notebook', 'Running a cell', 'Notebook time', 'Jotting it down'] },
|
|
157
|
+
{ test: /^(ctx_execute|ctx_execute_file|ctx_batch_execute)$/i, actions: ['Running context', 'Executing in context', 'Context ops', 'Running a snippet'] },
|
|
158
|
+
{ test: /^(ctx_search|ctx_index|ctx_fetch_and_index)$/i, actions: ['Searching context', 'Looking through history', 'Indexing notes', 'Digging the knowledge base'] },
|
|
159
|
+
{ test: /^(ctx_stats|ctx_doctor|ctx_upgrade|ctx_purge|ctx_insight)$/i, actions: ['Context stats', 'Checking status', 'Diagnosing', 'Looking at numbers'] },
|
|
148
160
|
{ test: /^(ask_user_question|ask)$/i, actions: ['Asking you', 'Checking with you', 'Quick question', 'Pinging the human'] },
|
|
149
161
|
{ test: /^(goal_complete|goal_blocked)$/i, actions: ['Updating goals', 'Tracking progress', 'Checking the objective'] },
|
|
150
162
|
{ test: /^(todo_write)$/i, actions: ['Writing todos', 'Making a list', 'Adding a checkbox'] },
|
|
@@ -175,6 +187,219 @@ export const EN_NIGHT_PHRASES = [
|
|
|
175
187
|
'Night grind', 'Up late', 'Almost dawn', '2AM thoughts', 'Red-eye shift',
|
|
176
188
|
'Who needs sleep anyway?', 'The stars are my witness',
|
|
177
189
|
];
|
|
190
|
+
// ── 彩蛋池 (easter eggs, pi extension parity) ────────────────────────────
|
|
191
|
+
/** Rare easter-egg phrases (1/150 draw, pi `RARE_PHRASES`). */
|
|
192
|
+
export const RARE_PHRASES = [
|
|
193
|
+
'SSR!稀有彩蛋', 'UR 掉落', '金色传说!', '爆装备了', 'ssr 彩蛋出现', 'lol 中奖了', '这把 ez',
|
|
194
|
+
'GG!闪耀', '稀有掉落确认', 'wow,出橙了', '彩蛋砸脸', '我承认,被帅到了', '天选时刻',
|
|
195
|
+
'五星好评掉落', '你发现了隐藏款', '触发隐藏对话', '稀有帧', '恭喜,这是稀有货', 'lol 你赚了',
|
|
196
|
+
'gg ez 彩蛋', '欧气爆棚', '这把不亏', '真·金色传说', '彩蛋蹦出来了', 'sssr 隐藏', '你解锁了稀有',
|
|
197
|
+
'SSR!', 'UR!', '金色传说', 'gg', 'ez', '暴击了', 'wink ~', '你发现我了', '欧皇降临',
|
|
198
|
+
'隐藏款!', '稀有度 MAX', '一次过!', '没bug', '完美运行', '测试全绿', '这波在大气层',
|
|
199
|
+
];
|
|
200
|
+
/** English rare easter-egg phrases. */
|
|
201
|
+
export const EN_RARE_PHRASES = [
|
|
202
|
+
'SSR! Rare egg', 'Legendary drop!', 'Golden loot', 'You found the hidden one',
|
|
203
|
+
'Secret phrase unlocked', 'Rarity MAX', 'Wink ~', 'You caught me', 'GG, shiny!',
|
|
204
|
+
'This is the easter egg', 'Five-star drop', 'Ez win', 'Gacha gods smiled on you',
|
|
205
|
+
];
|
|
206
|
+
/** Chance of drawing a rare phrase per thinking rotation. */
|
|
207
|
+
export const RARE_CHANCE = 1 / 150;
|
|
208
|
+
/** Weekend-greeting phrases (once per turn on Sat/Sun). */
|
|
209
|
+
export const WEEKEND_PHRASES = [
|
|
210
|
+
'周末摸鱼中', '周末也在!', '放假也陪你', '周末不关机', '周末偷着盘', '周末也在卷?', '卷王你好',
|
|
211
|
+
'还在加班…', '周末限定皮肤', '周六也营业', '周日也接单', '周末不放假', '摸鱼限定版', '周末模式 ON',
|
|
212
|
+
'周末hotfix', '周末在修bug', '周末上线',
|
|
213
|
+
];
|
|
214
|
+
/** English weekend greetings. */
|
|
215
|
+
export const EN_WEEKEND_PHRASES = [
|
|
216
|
+
'Weekend mode ON', 'Working on a weekend?', 'Saturday shift', 'Sunday grind',
|
|
217
|
+
'The weekend never sleeps', 'Casual Saturday', 'Weekend warrior', 'Still here, it\'s the weekend',
|
|
218
|
+
];
|
|
219
|
+
/** Whether `date` falls on a weekend. */
|
|
220
|
+
export function isWeekend(date) {
|
|
221
|
+
const day = date.getDay();
|
|
222
|
+
return day === 0 || day === 6;
|
|
223
|
+
}
|
|
224
|
+
/** Holiday copy keyed by `MM-DD` (zh). */
|
|
225
|
+
export const HOLIDAY_PHRASES = {
|
|
226
|
+
'01-01': ['新年快乐!', '元旦快乐', '新的一年,新的 bug', '新年第一盘', '开工大吉', '新年第一行代码'],
|
|
227
|
+
'02-14': ['情人节也在敲代码', '代码才是真爱', '今天不约会?', 'bug 也是 love', '键盘就是玫瑰'],
|
|
228
|
+
'04-01': ['愚人节快乐', '这个 bug 是假的吧', '小心假报错', '今天谁骗我', '❌ 骗你的,没报错'],
|
|
229
|
+
'05-01': ['劳动节还在卷', '劳动最光荣', '打工人打工魂', '卷王放假了?'],
|
|
230
|
+
'06-01': ['儿童节快乐', '谁还不是个宝宝', '今天代码要写得可爱', '🍭 宝宝模式'],
|
|
231
|
+
'10-31': ['万圣节快乐', '不给糖就捣蛋', '🎃 南瓜来了', '👻 代码也会吓人'],
|
|
232
|
+
'12-24': ['平安夜快乐', '圣诞老人来了', '🎄 今晚写代码有礼物', '平安夜也在盘'],
|
|
233
|
+
'12-25': ['圣诞快乐', 'Merry Christmas', '🎅 圣诞也陪你', '圣诞限定彩蛋', '🎄 麋鹿送代码'],
|
|
234
|
+
'12-31': ['跨年夜', '新年倒计时', '今年最后一盘', '🍾 准备跨年', '明年见!'],
|
|
235
|
+
};
|
|
236
|
+
/** English holiday copy keyed by `MM-DD`. */
|
|
237
|
+
export const EN_HOLIDAY_PHRASES = {
|
|
238
|
+
'01-01': ['Happy New Year!', 'New year, new bugs', 'First grind of the year'],
|
|
239
|
+
'02-14': ['Valentine\'s at the keyboard', 'Code is my true love', 'No date tonight?'],
|
|
240
|
+
'04-01': ['April Fools!', 'That bug is fake, right?', 'Careful of fake errors'],
|
|
241
|
+
'05-01': ['Labor Day grind', 'Workers of the world', 'Still shipping on a holiday'],
|
|
242
|
+
'06-01': ['Happy Children\'s Day', 'We\'re all babies inside', 'Write cute code today'],
|
|
243
|
+
'10-31': ['Happy Halloween', 'Trick or treat', '🎃 Pumpkins and code'],
|
|
244
|
+
'12-24': ['Merry Christmas Eve', 'Santa\'s coming', '🎄 Gifts for coders too'],
|
|
245
|
+
'12-25': ['Merry Christmas', '🎅 Santa grinds too', 'Christmas egg unlocked', '🎄 Code under the tree'],
|
|
246
|
+
'12-31': ['New Year\'s Eve', 'Countdown time', 'Last grind of the year', '🍾 See you next year!'],
|
|
247
|
+
};
|
|
248
|
+
/** Lunar New Year copy (approximated by Gregorian dates, extended yearly). */
|
|
249
|
+
export const LUNAR_NEW_YEAR_PHRASES = [
|
|
250
|
+
'🧧 春节快乐!', '过年还在写代码', '红包拿来', '新春快乐', '拜年了', '过年好', '代码也拜个年',
|
|
251
|
+
'🐉 龙年大吉', '年夜饭写代码', '年味盘起来',
|
|
252
|
+
];
|
|
253
|
+
/** English Lunar New Year copy. */
|
|
254
|
+
export const EN_LUNAR_NEW_YEAR_PHRASES = [
|
|
255
|
+
'🧧 Happy Lunar New Year!', 'Coding through the New Year', 'Red packets please',
|
|
256
|
+
'Gong Xi Fa Cai', 'New Year grind',
|
|
257
|
+
];
|
|
258
|
+
/** Gregorian dates marked as Lunar New Year (2025–2027, extend yearly). */
|
|
259
|
+
export const LUNAR_NEW_YEAR_DAYS = {
|
|
260
|
+
'2025-01-29': true, '2025-01-30': true, '2025-01-31': true, '2025-02-01': true, '2025-02-02': true, '2025-02-03': true, '2025-02-04': true,
|
|
261
|
+
'2026-02-17': true, '2026-02-18': true, '2026-02-19': true, '2026-02-20': true, '2026-02-21': true, '2026-02-22': true, '2026-02-23': true,
|
|
262
|
+
'2027-02-06': true, '2027-02-07': true, '2027-02-08': true, '2027-02-09': true, '2027-02-10': true, '2027-02-11': true, '2027-02-12': true,
|
|
263
|
+
};
|
|
264
|
+
/** Phrases shown after the user interrupts and the model resumes. */
|
|
265
|
+
export const CONTINUE_PHRASES = [
|
|
266
|
+
'再来,again!', '接着盘', '继续整', 'again!走起', '接着刚才的', '续上,继续', '再续一秒',
|
|
267
|
+
'继续继续', '继续…', '好,接着来…', 'again', '没断片', '在修了在修了', '马上好', '还差一点', '快好了',
|
|
268
|
+
];
|
|
269
|
+
/** English post-interruption phrases. */
|
|
270
|
+
export const EN_CONTINUE_PHRASES = [
|
|
271
|
+
'Again! Round two', 'Back at it', 'Continuing where we left off', 'Resuming…', 'One more time',
|
|
272
|
+
'No memory loss here', 'Fixing it, fixing it', 'Almost there', 'Round two: electric boogaloo',
|
|
273
|
+
];
|
|
274
|
+
/** Phrases after a successful context compaction. */
|
|
275
|
+
export const COMPACT_PHRASES = [
|
|
276
|
+
'压缩了一下', '瘦了个身', '腾出地方了', '整理了下记忆', '减负成功', '释放了一波', '清爽多了',
|
|
277
|
+
'瘦身完毕', '好多了', '整理好了', '清了一下缓存', '重启了一下', 'GC了一下', '释放了一波内存',
|
|
278
|
+
];
|
|
279
|
+
/** English post-compaction phrases. */
|
|
280
|
+
export const EN_COMPACT_PHRASES = [
|
|
281
|
+
'Compacted', 'Slimmed down', 'Made room', 'Memory tidied', 'Lighter now', 'All tidy',
|
|
282
|
+
'Cleared the cache', 'GC\'d', 'Fresh and clean',
|
|
283
|
+
];
|
|
284
|
+
/** Urgent phrases when compaction is forced by overflow. */
|
|
285
|
+
export const OVERFLOW_PHRASES = [
|
|
286
|
+
'装不下了', '太长了', '超载了', '爆了', '兜不住了',
|
|
287
|
+
];
|
|
288
|
+
/** English overflow phrases. */
|
|
289
|
+
export const EN_OVERFLOW_PHRASES = [
|
|
290
|
+
"It's full", 'Too long', 'Overloaded', 'Overflow!', "Can't hold it all",
|
|
291
|
+
];
|
|
292
|
+
/** Phrases when retrying after a forced compaction. */
|
|
293
|
+
export const COMPACT_RETRY_PHRASES = [
|
|
294
|
+
'马上重试', '继续盘', '接着来', '再来', '续上',
|
|
295
|
+
];
|
|
296
|
+
/** English compact-retry phrases. */
|
|
297
|
+
export const EN_COMPACT_RETRY_PHRASES = [
|
|
298
|
+
'Retrying now', 'Carrying on', 'Round three', 'Again', 'Picking it back up',
|
|
299
|
+
];
|
|
300
|
+
/** Model-switch quips keyed by a lowercase substring of the model id. */
|
|
301
|
+
export const MODEL_QUIPS = {
|
|
302
|
+
claude: ['Claude 来了', '换 Claude 了', '让 Claude 试试', 'Claude 出战', '克劳德上线'],
|
|
303
|
+
gpt: ['GPT 来了', '换个 GPT', 'GPT 出战', 'GPT 值班', 'GPT 上班'],
|
|
304
|
+
grok: ['Grok 来了', 'Grok 出战', 'Grok 硬核', 'Grok 上班', '火星选手'],
|
|
305
|
+
gemini: ['Gemini 来了', 'Gemini 出战', 'Google 选手', '双子星', 'G 家选手'],
|
|
306
|
+
deepseek: ['DeepSeek 来了', 'DeepSeek 出战', '国产选手', '深度求索', 'DS 上班'],
|
|
307
|
+
haiku: ['Haiku 快枪手', 'Haiku 来了', '短平快模式', '俳句选手', 'Haiku 轻快'],
|
|
308
|
+
sonnet: ['Sonnet 来了', 'Sonnet 出战', '文采担当', '十四行诗', 'Sonnet 文豪'],
|
|
309
|
+
opus: ['Opus 来了', 'Opus 出战', '放大招', '巨作登场', 'Opus 主力'],
|
|
310
|
+
flash: ['Flash 来了', '闪电模式', '快快快', '快就完事了', '光速模式'],
|
|
311
|
+
pro: ['Pro 来了', 'Pro 出战', '专业模式', '满血版', 'Pro 拉满'],
|
|
312
|
+
mini: ['Mini 来了', 'Mini 轻装上阵', '小模型也够用', '迷你选手', 'Mini 省流'],
|
|
313
|
+
};
|
|
314
|
+
/** English model-switch quips. */
|
|
315
|
+
export const EN_MODEL_QUIPS = {
|
|
316
|
+
claude: ['Claude is in', 'Switching to Claude', 'Claude takes the wheel', 'Claude reporting'],
|
|
317
|
+
gpt: ['GPT is in', 'Switching to GPT', 'GPT on duty', 'GPT reporting'],
|
|
318
|
+
grok: ['Grok is in', 'Grok takes over', 'Mars pilot on deck', 'Grok reporting'],
|
|
319
|
+
gemini: ['Gemini is in', 'Google\'s finest', 'Gemini takes the wheel', 'Gemini reporting'],
|
|
320
|
+
deepseek: ['DeepSeek is in', 'Homegrown champ', 'DeepSeek reporting', 'DS on duty'],
|
|
321
|
+
haiku: ['Haiku in the fast lane', 'Haiku reporting', 'Short and snappy mode'],
|
|
322
|
+
sonnet: ['Sonnet is in', 'The wordsmith', 'Sonnet reporting', 'Fourteen lines of glory'],
|
|
323
|
+
opus: ['Opus is in', 'The big guns', 'Opus reporting', 'Full power mode'],
|
|
324
|
+
flash: ['Flash is in', 'Lightning mode', 'Zoom zoom', 'Flash reporting'],
|
|
325
|
+
pro: ['Pro is in', 'Pro mode', 'Maxed out', 'Pro reporting'],
|
|
326
|
+
mini: ['Mini is in', 'Small but mighty', 'Lite mode', 'Mini reporting'],
|
|
327
|
+
};
|
|
328
|
+
/** Detect a holiday for `date`, Lunar New Year first. */
|
|
329
|
+
export function holidayPhrase(date) {
|
|
330
|
+
const mmdd = `${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
|
|
331
|
+
const ymd = `${date.getFullYear()}-${mmdd}`;
|
|
332
|
+
const en = langNow() === 'en';
|
|
333
|
+
if (LUNAR_NEW_YEAR_DAYS[ymd] === true) {
|
|
334
|
+
return pickPhrase(en ? EN_LUNAR_NEW_YEAR_PHRASES : LUNAR_NEW_YEAR_PHRASES);
|
|
335
|
+
}
|
|
336
|
+
const pool = en ? EN_HOLIDAY_PHRASES[mmdd] : HOLIDAY_PHRASES[mmdd];
|
|
337
|
+
if (pool !== undefined)
|
|
338
|
+
return pickPhrase(pool);
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
/** Pick a rare easter-egg phrase in the active language. */
|
|
342
|
+
export function rarePhrase(previous) {
|
|
343
|
+
return pickPhrase(langNow() === 'en' ? EN_RARE_PHRASES : RARE_PHRASES, previous);
|
|
344
|
+
}
|
|
345
|
+
/** Pick a weekend greeting in the active language. */
|
|
346
|
+
export function weekendPhrase(previous) {
|
|
347
|
+
return pickPhrase(langNow() === 'en' ? EN_WEEKEND_PHRASES : WEEKEND_PHRASES, previous);
|
|
348
|
+
}
|
|
349
|
+
/** Pick a post-interruption phrase in the active language. */
|
|
350
|
+
export function continuePhrase() {
|
|
351
|
+
return pickPhrase(langNow() === 'en' ? EN_CONTINUE_PHRASES : CONTINUE_PHRASES);
|
|
352
|
+
}
|
|
353
|
+
/** Pick a post-compaction phrase in the active language. */
|
|
354
|
+
export function compactPhrase() {
|
|
355
|
+
return pickPhrase(langNow() === 'en' ? EN_COMPACT_PHRASES : COMPACT_PHRASES);
|
|
356
|
+
}
|
|
357
|
+
/** Pick an overflow phrase in the active language. */
|
|
358
|
+
export function overflowPhrase() {
|
|
359
|
+
return pickPhrase(langNow() === 'en' ? EN_OVERFLOW_PHRASES : OVERFLOW_PHRASES);
|
|
360
|
+
}
|
|
361
|
+
/** Pick a compact-retry phrase in the active language. */
|
|
362
|
+
export function compactRetryPhrase() {
|
|
363
|
+
return pickPhrase(langNow() === 'en' ? EN_COMPACT_RETRY_PHRASES : COMPACT_RETRY_PHRASES);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Quip for a model id (substring match), or null when no pool matches.
|
|
367
|
+
* @param modelId - Model id, e.g. `deepseek-chat` or `gpt-4o`.
|
|
368
|
+
*/
|
|
369
|
+
export function modelQuip(modelId) {
|
|
370
|
+
const lower = modelId.toLowerCase();
|
|
371
|
+
const quips = langNow() === 'en' ? EN_MODEL_QUIPS : MODEL_QUIPS;
|
|
372
|
+
for (const [key, pool] of Object.entries(quips)) {
|
|
373
|
+
if (lower.includes(key))
|
|
374
|
+
return pickPhrase(pool);
|
|
375
|
+
}
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Pick a thinking phrase with the pi extension's egg order: holiday first,
|
|
380
|
+
* then rare (1/150), then weekend, then the elapsed-time tiers with night
|
|
381
|
+
* mixing. Every egg is gated by `features` (defaults all on).
|
|
382
|
+
* @param elapsedMs - Milliseconds spent thinking in the current phase.
|
|
383
|
+
* @param previous - Previously shown phrase, to avoid repeats.
|
|
384
|
+
* @param night - Whether the night window is active (mixes night copy).
|
|
385
|
+
* @param now - Current wall-clock time (injectable for tests).
|
|
386
|
+
* @param features - Feature toggles; absent flags default to on.
|
|
387
|
+
* @param extra - User custom phrases appended to the base thinking pool.
|
|
388
|
+
*/
|
|
389
|
+
export function livelyThinkingPhrase(elapsedMs, previous, night = false, now = new Date(), features = {}, extra) {
|
|
390
|
+
if (features.holidays !== false) {
|
|
391
|
+
const holiday = holidayPhrase(now);
|
|
392
|
+
if (holiday !== null)
|
|
393
|
+
return holiday;
|
|
394
|
+
}
|
|
395
|
+
if (features.rareEggs !== false && Math.random() < RARE_CHANCE) {
|
|
396
|
+
return rarePhrase(previous);
|
|
397
|
+
}
|
|
398
|
+
if (features.weekend !== false && isWeekend(now)) {
|
|
399
|
+
return weekendPhrase(previous);
|
|
400
|
+
}
|
|
401
|
+
return thinkingPhrase(elapsedMs, previous, features.nightPhrases !== false && night, extra);
|
|
402
|
+
}
|
|
178
403
|
/** Common git tool names / bash commands containing `git `. */
|
|
179
404
|
export const GIT_TOOL_RE = /^(?:git|git_diff|git_commit|git_push|git_pull|git_checkout|git_branch|git_merge|git_rebase|github|gh)$/i;
|
|
180
405
|
/** Detect the 00:00–06:00 night window (local time). */
|
|
@@ -195,8 +420,9 @@ export function waitingPool() {
|
|
|
195
420
|
* @param elapsedMs - Milliseconds spent thinking in the current phase.
|
|
196
421
|
* @param previous - Previously shown phrase, to avoid repeats.
|
|
197
422
|
* @param night - Mix night-owl copy into the pool.
|
|
423
|
+
* @param extra - User custom phrases appended to the base (non-tier) pool.
|
|
198
424
|
*/
|
|
199
|
-
export function thinkingPhrase(elapsedMs, previous, night = false) {
|
|
425
|
+
export function thinkingPhrase(elapsedMs, previous, night = false, extra) {
|
|
200
426
|
let pool = langNow() === 'en' ? EN_THINKING_PHRASES : THINKING_PHRASES;
|
|
201
427
|
for (const tier of thinkingPools()) {
|
|
202
428
|
if (elapsedMs >= tier.atMs) {
|
|
@@ -204,6 +430,11 @@ export function thinkingPhrase(elapsedMs, previous, night = false) {
|
|
|
204
430
|
break;
|
|
205
431
|
}
|
|
206
432
|
}
|
|
433
|
+
// Custom phrases ride every candidate pool (base and tiers alike), so user
|
|
434
|
+
// copy keeps showing up on long thinking too.
|
|
435
|
+
if (extra !== undefined && extra.length > 0) {
|
|
436
|
+
pool = [...pool, ...extra];
|
|
437
|
+
}
|
|
207
438
|
if (night && pool === (langNow() === 'en' ? EN_THINKING_PHRASES : THINKING_PHRASES)) {
|
|
208
439
|
const nightPool = langNow() === 'en' ? EN_NIGHT_PHRASES : NIGHT_PHRASES;
|
|
209
440
|
return pickPhrase([...pool, ...nightPool], previous);
|
package/lib/types/status.d.ts
CHANGED
|
@@ -36,6 +36,17 @@ export interface TurnStats {
|
|
|
36
36
|
/** Tools completed in the turn. */
|
|
37
37
|
readonly toolCount: number;
|
|
38
38
|
}
|
|
39
|
+
/** Easter-egg toggles for the thinking phrase (pi extension parity). */
|
|
40
|
+
export interface TrackerFeatures {
|
|
41
|
+
/** Rare 1/150 easter eggs. */
|
|
42
|
+
readonly rareEggs?: boolean;
|
|
43
|
+
/** Weekend greetings on Sat/Sun. */
|
|
44
|
+
readonly weekend?: boolean;
|
|
45
|
+
/** Date-matched holiday / Lunar New Year copy. */
|
|
46
|
+
readonly holidays?: boolean;
|
|
47
|
+
/** Night-owl copy between 00:00 and 06:00. */
|
|
48
|
+
readonly nightPhrases?: boolean;
|
|
49
|
+
}
|
|
39
50
|
/** Configuration knobs for the state machine (subset of plugin Config). */
|
|
40
51
|
export interface TrackerConfig {
|
|
41
52
|
/** Playful copy pool on/off; false renders plain functional labels. */
|
|
@@ -44,6 +55,14 @@ export interface TrackerConfig {
|
|
|
44
55
|
readonly detailLimit: number;
|
|
45
56
|
/** Hide the status line while idle. */
|
|
46
57
|
readonly showIdle: boolean;
|
|
58
|
+
/** Easter-egg toggles; absent flags default to on. */
|
|
59
|
+
readonly features?: TrackerFeatures;
|
|
60
|
+
/** User custom phrases appended to the base thinking pool. */
|
|
61
|
+
readonly customPhrases?: readonly string[];
|
|
62
|
+
/** Show an estimated tokens/s prefix while streaming (pi parity). */
|
|
63
|
+
readonly showTokPerSec?: boolean;
|
|
64
|
+
/** Work reminder after this many turn-hours (0 = off). */
|
|
65
|
+
readonly workRemindAt?: number;
|
|
47
66
|
}
|
|
48
67
|
/**
|
|
49
68
|
* Extract a displayable detail fragment from a tool call's parsed arguments.
|
|
@@ -83,6 +102,27 @@ export declare class ActivityTracker {
|
|
|
83
102
|
private turnTokens;
|
|
84
103
|
/** Completion prefix drawn ONCE at turn end so the done line stays stable. */
|
|
85
104
|
private donePrefix;
|
|
105
|
+
/** Easter eggs shown once per turn (holiday / rare / weekend). */
|
|
106
|
+
private holidayShown;
|
|
107
|
+
private rareShown;
|
|
108
|
+
private weekendShown;
|
|
109
|
+
/** One-off copy pinned by an external event (interrupt / model switch /
|
|
110
|
+
* compaction / work reminder), shown until it expires. */
|
|
111
|
+
private pendingPhrase;
|
|
112
|
+
private pendingUntil;
|
|
113
|
+
/** Git branch of the session cwd (fed by the host, best-effort). */
|
|
114
|
+
private gitBranch;
|
|
115
|
+
/** Consecutive fast tool streak (combo). */
|
|
116
|
+
private streak;
|
|
117
|
+
private lastToolEndAt;
|
|
118
|
+
private maxStreak;
|
|
119
|
+
/** Subagent (agent/task) calls in the current turn. */
|
|
120
|
+
private subagentCount;
|
|
121
|
+
/** Work-reminder fired once per turn. */
|
|
122
|
+
private reminded;
|
|
123
|
+
/** Streaming token estimate for the tps prefix. */
|
|
124
|
+
private tokBuf;
|
|
125
|
+
private tokWindowStart;
|
|
86
126
|
/**
|
|
87
127
|
* @param config - Behavioral knobs.
|
|
88
128
|
* @param now - Wall-clock supplier (injectable for tests).
|
|
@@ -91,6 +131,14 @@ export declare class ActivityTracker {
|
|
|
91
131
|
constructor(config: TrackerConfig, now?: () => number, customActions?: Readonly<Record<string, readonly string[]>> | undefined);
|
|
92
132
|
/** Agent transitioned to running/idle. */
|
|
93
133
|
onAgentStatus(status: 'idle' | 'running'): void;
|
|
134
|
+
/** The user interrupted the running turn: show a comeback quip next. */
|
|
135
|
+
onInterrupted(): void;
|
|
136
|
+
/** The model was switched: quip for the new model id. */
|
|
137
|
+
onModelSwitch(modelId: string): void;
|
|
138
|
+
/** A context compaction finished (or overflowed): quip about it. */
|
|
139
|
+
onCompact(kind: 'done' | 'overflow'): void;
|
|
140
|
+
/** Feed the session cwd's git branch (best-effort, host-resolved). */
|
|
141
|
+
onGitBranch(branch: string | undefined): void;
|
|
94
142
|
/** Consume one durable session event (turn/step/tool/stream). */
|
|
95
143
|
onSessionEvent(event: SessionEvent): void;
|
|
96
144
|
/** Render the current status snapshot at a wall-clock instant. */
|
|
@@ -98,6 +146,20 @@ export declare class ActivityTracker {
|
|
|
98
146
|
/** Per-turn thinking/tooling split for stats consumers. */
|
|
99
147
|
stats(): TurnStats;
|
|
100
148
|
private renderThinking;
|
|
149
|
+
/**
|
|
150
|
+
* Pick the next thinking phrase with the pi extension's egg order:
|
|
151
|
+
* holiday (once per turn) → rare 1/150 (once per turn) → weekend greeting
|
|
152
|
+
* (once per turn) → elapsed-time tiers with night mixing. Every egg is
|
|
153
|
+
* gated by `config.features` (absent flags default to on).
|
|
154
|
+
*/
|
|
155
|
+
private livelyPhrase;
|
|
156
|
+
/** The pending one-off quip (interrupt / model / compact / work reminder)
|
|
157
|
+
* while it is still fresh; expired pending is cleared here. */
|
|
158
|
+
private pendingPhraseAt;
|
|
159
|
+
/** Whether a phrase comes from the rare pool (longer display window). */
|
|
160
|
+
private isRarePhrase;
|
|
161
|
+
/** Estimated tokens/s while the stream is fresh (pi parity, opt-in). */
|
|
162
|
+
private tpsPrefix;
|
|
101
163
|
private doneSummary;
|
|
102
164
|
/** The fresh self-narration line, or null once the stream has been quiet. */
|
|
103
165
|
private freshNarration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/status.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/status.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAQ5D,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;AAE7E,kEAAkE;AAClE,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;IAC7B,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,wEAAwE;IACxE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,mEAAmE;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,2CAA2C;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,4EAA4E;IAC5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