principles-disciple 1.6.0 → 1.7.1

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.
Files changed (75) hide show
  1. package/dist/commands/context.js +7 -3
  2. package/dist/commands/evolution-status.d.ts +4 -0
  3. package/dist/commands/evolution-status.js +134 -0
  4. package/dist/commands/export.d.ts +2 -0
  5. package/dist/commands/export.js +45 -0
  6. package/dist/commands/focus.js +9 -6
  7. package/dist/commands/pain.js +8 -0
  8. package/dist/commands/principle-rollback.d.ts +4 -0
  9. package/dist/commands/principle-rollback.js +22 -0
  10. package/dist/commands/rollback.js +9 -3
  11. package/dist/commands/samples.d.ts +2 -0
  12. package/dist/commands/samples.js +55 -0
  13. package/dist/commands/trust.js +64 -81
  14. package/dist/core/config.d.ts +5 -0
  15. package/dist/core/control-ui-db.d.ts +68 -0
  16. package/dist/core/control-ui-db.js +274 -0
  17. package/dist/core/detection-funnel.d.ts +1 -1
  18. package/dist/core/detection-funnel.js +4 -0
  19. package/dist/core/dictionary.d.ts +2 -0
  20. package/dist/core/dictionary.js +13 -0
  21. package/dist/core/event-log.d.ts +7 -1
  22. package/dist/core/event-log.js +10 -0
  23. package/dist/core/evolution-engine.d.ts +5 -5
  24. package/dist/core/evolution-engine.js +18 -18
  25. package/dist/core/evolution-migration.d.ts +5 -0
  26. package/dist/core/evolution-migration.js +65 -0
  27. package/dist/core/evolution-reducer.d.ts +69 -0
  28. package/dist/core/evolution-reducer.js +369 -0
  29. package/dist/core/evolution-types.d.ts +103 -0
  30. package/dist/core/path-resolver.js +75 -36
  31. package/dist/core/paths.d.ts +7 -8
  32. package/dist/core/paths.js +48 -40
  33. package/dist/core/profile.js +1 -1
  34. package/dist/core/session-tracker.d.ts +14 -2
  35. package/dist/core/session-tracker.js +75 -9
  36. package/dist/core/thinking-models.d.ts +38 -0
  37. package/dist/core/thinking-models.js +170 -0
  38. package/dist/core/trajectory.d.ts +184 -0
  39. package/dist/core/trajectory.js +817 -0
  40. package/dist/core/trust-engine.d.ts +6 -0
  41. package/dist/core/trust-engine.js +50 -29
  42. package/dist/core/workspace-context.d.ts +13 -0
  43. package/dist/core/workspace-context.js +50 -7
  44. package/dist/hooks/gate.js +171 -87
  45. package/dist/hooks/llm.js +119 -71
  46. package/dist/hooks/pain.js +105 -5
  47. package/dist/hooks/prompt.d.ts +11 -14
  48. package/dist/hooks/prompt.js +283 -57
  49. package/dist/hooks/subagent.js +69 -28
  50. package/dist/hooks/trajectory-collector.d.ts +32 -0
  51. package/dist/hooks/trajectory-collector.js +256 -0
  52. package/dist/http/principles-console-route.d.ts +2 -0
  53. package/dist/http/principles-console-route.js +257 -0
  54. package/dist/i18n/commands.js +16 -0
  55. package/dist/index.js +105 -4
  56. package/dist/service/control-ui-query-service.d.ts +217 -0
  57. package/dist/service/control-ui-query-service.js +537 -0
  58. package/dist/service/empathy-observer-manager.d.ts +2 -0
  59. package/dist/service/empathy-observer-manager.js +43 -1
  60. package/dist/service/evolution-worker.d.ts +27 -0
  61. package/dist/service/evolution-worker.js +256 -41
  62. package/dist/service/runtime-summary-service.d.ts +79 -0
  63. package/dist/service/runtime-summary-service.js +319 -0
  64. package/dist/service/trajectory-service.d.ts +2 -0
  65. package/dist/service/trajectory-service.js +15 -0
  66. package/dist/tools/agent-spawn.d.ts +27 -6
  67. package/dist/tools/agent-spawn.js +339 -87
  68. package/dist/tools/deep-reflect.d.ts +27 -7
  69. package/dist/tools/deep-reflect.js +210 -121
  70. package/dist/types/event-types.d.ts +10 -2
  71. package/dist/types.d.ts +10 -0
  72. package/dist/types.js +5 -0
  73. package/openclaw.plugin.json +43 -11
  74. package/package.json +14 -4
  75. package/templates/langs/zh/skills/pd-daily/SKILL.md +97 -13
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pd-daily
3
- description: 配置并发送每日进化日报(支持邮件/即时通讯/语音通知)
3
+ description: 配置并发送每日进化日报(支持邮件/即时通讯/飞书/语音通知)
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
@@ -30,9 +30,10 @@ disable-model-invocation: true
30
30
  通过会话对话依次询问:
31
31
 
32
32
  1. **是否启用进化日报?**
33
- 2. **发送时间?**(默认每天 9:00)
34
- 3. **时区?**(默认 Asia/Shanghai
33
+ 2. **发送时间?**(默认每天 23:00 UTC
34
+ 3. **时区?**(默认 UTC
35
35
  4. **发送渠道?**
36
+ - 📱 **飞书** → 需用户 open_id(推荐,格式:ou_xxx)
36
37
  - 邮件 → 需邮箱地址
37
38
  - WhatsApp/Telegram → 需手机号/用户ID
38
39
  - Discord/Slack → 需频道ID
@@ -52,13 +53,13 @@ disable-model-invocation: true
52
53
  - 创建时间: {date}
53
54
 
54
55
  ## 发送设置
55
- - 发送时间: 09:00
56
- - 时区: Asia/Shanghai
57
- - Cron 表达式: 0 9 * * *
56
+ - 发送时间: 23:00
57
+ - 时区: UTC
58
+ - Cron 表达式: 0 23 * * *
58
59
 
59
60
  ## 发送渠道
60
- - 渠道: whatsapp
61
- - 目标: +8613800138000
61
+ - 渠道: feishu
62
+ - 目标: ou_cf5c98aada743ab12c65c7c6764b5a49
62
63
 
63
64
  ## 报告风格
64
65
  - 风格: standard
@@ -83,13 +84,13 @@ disable-model-invocation: true
83
84
  "action": "add",
84
85
  "job": {
85
86
  "name": "evolution-daily-report",
86
- "schedule": { "kind": "cron", "expr": "0 9 * * *", "tz": "Asia/Shanghai" },
87
+ "schedule": { "kind": "cron", "expr": "0 23 * * *", "tz": "UTC" },
87
88
  "sessionTarget": "isolated",
88
89
  "payload": {
89
90
  "kind": "agentTurn",
90
91
  "message": "执行进化日报技能:读取日志数据,生成日报并发送"
91
92
  },
92
- "delivery": { "mode": "announce", "channel": "whatsapp", "to": "+8613800138000" }
93
+ "delivery": { "mode": "announce", "channel": "feishu", "to": "ou_cf5c98aada743ab12c65c7c6764b5a49" }
93
94
  }
94
95
  }
95
96
  ```
@@ -97,12 +98,73 @@ disable-model-invocation: true
97
98
  ### Step 5: 日报生成(定时触发或手动触发)
98
99
 
99
100
  1. **读取定量数据**:获取 `daily-stats.json` 和 `pain_dictionary.json` 中的指标。
100
- 2. **提取定性记忆(关键防遗忘步骤)**:因为你可能经历了漫长的上下文,**必须使用文件读取工具**去扫描以下核心进化文件,提取“今天”新增的内容:
101
+ 2. **提取定性记忆(关键防遗忘步骤)**:因为你可能经历了漫长的上下文,**必须使用文件读取工具**去扫描以下核心进化文件,提取"今天"新增的内容:
101
102
  - `memory/ISSUE_LOG.md`:寻找今天发生的具体错误与复盘。
102
103
  - `memory/DECISIONS.md`:寻找今天定下的新架构规则。
103
104
  - `memory/logs/SYSTEM.log`:寻找今天触发的门禁拦截或子代理孵化事件。
104
105
  3. **合成与生成**:结合定量指标和定性记忆,生成深度洞察,按用户风格生成 Markdown。绝不要凭空捏造洞察。
105
- 4. **发送日报**:通过 OpenClaw 渠道或打印到屏幕。
106
+ 4. **发送飞书推送**:调用飞书 API 发送(见下方"飞书推送实施规范")。
107
+
108
+ ---
109
+
110
+ ## 飞书消息格式
111
+
112
+ 当发送渠道为飞书时,使用以下格式发送消息:
113
+
114
+ ```json
115
+ {
116
+ "action": "send",
117
+ "channel": "feishu",
118
+ "target": "user:ou_cf5c98aada743ab12c65c7c6764b5a49",
119
+ "message": "📊 Principles 进化日报 - {date}\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n🛡️ Trust Score: {trust_score}/100 (Stage {trust_stage})\n😴 GFI: {gfi_peak}\n⚡ Pain: {pain_count} pts\n\n📈 7 日趋势:\n{7day_trend}\n\n📋 进化队列:待处理 {pending} 项\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n详情: 输入 /pd-evolution-status"
120
+ }
121
+ ```
122
+
123
+ ## 飞书推送实施规范
124
+
125
+ ### 推送流程
126
+
127
+ 1. **组装消息**:根据上方"飞书消息格式"生成完整消息内容
128
+ 2. **执行推送**:使用 `message` 工具发送到飞书
129
+ 3. **记录状态**:将推送结果写入 `memory/logs/daily-push-log.md`
130
+
131
+ ### 重试机制
132
+
133
+ 推送失败时自动重试,最多 3 次:
134
+
135
+ ```
136
+ 尝试 1 → 失败 → 等待 30 秒 → 尝试 2 → 失败 → 等待 60 秒 → 尝试 3
137
+ ```
138
+
139
+ - 每次尝试都要记录到日志
140
+ - 3 次全失败后,降级为控制台输出(print 到会话)
141
+
142
+ ### 状态日志格式
143
+
144
+ 每次推送(成功或失败)都追加到 `memory/logs/daily-push-log.md`:
145
+
146
+ ```markdown
147
+ ## {date} 推送记录
148
+
149
+ - **时间**: {timestamp} UTC
150
+ - **接收人**: ou_cf5c98aada743ab12c65c7c6764b5a49
151
+ - **尝试次数**: {attempts}
152
+ - **状态**: success / failed
153
+ - **失败原因**(如有): {error_message}
154
+ ```
155
+
156
+ ### 幂等检查
157
+
158
+ 推送前先检查当日是否已推送成功(读取日志文件):
159
+ - **已推送成功** → 跳过本次推送,记录"已存在,跳过"
160
+ - **未推送或失败** → 执行推送
161
+
162
+ ### 错误处理
163
+
164
+ - **API 错误**:记录错误信息到日志,继续重试
165
+ - **token 过期**:返回明确错误提示,停止重试
166
+ - **数据读取失败**:使用默认值,继续生成日报
167
+ ```
106
168
 
107
169
  ---
108
170
 
@@ -116,6 +178,8 @@ disable-model-invocation: true
116
178
  | 架构决策 | `memory/DECISIONS.md` | **(重要)** 记录了今天固化的系统级原则 |
117
179
  | Pain 规则 | `{stateDir}/pain_dictionary.json` | 规则数量 |
118
180
  | 用户配置 | `{stateDir}/daily-report.md` | 偏好设置 |
181
+ | Trust Score | `{stateDir}/AGENT_SCORECARD` | Trust Engine 数据 |
182
+ | Evolution Queue | `{stateDir}/evolution_queue.json` | 进化队列状态 |
119
183
 
120
184
  ---
121
185
 
@@ -196,4 +260,24 @@ disable-model-invocation: true
196
260
 
197
261
  ## 手动触发
198
262
 
199
- 用户可随时运行 `/evolution-daily` 手动生成并发送当日日报。
263
+ 用户可随时运行 `/pd-evolution-status` 查看当前进化状态。
264
+
265
+ ---
266
+
267
+ ## 故障处理
268
+
269
+ ### 飞书推送失败
270
+ 1. 记录错误到 `memory/logs/daily-push-log.md`
271
+ 2. 执行重试(最多 3 次,间隔 30s/60s)
272
+ 3. 3 次全失败后降级为控制台输出
273
+ 4. 下次执行时自动检查幂等(不重复推送)
274
+
275
+ ### 数据读取失败
276
+ 1. 使用默认值(0 或 "无")
277
+ 2. 继续生成日报,不阻塞
278
+ 3. 在日报中标注"部分数据不可用"
279
+
280
+ ### 数据读取失败
281
+ 1. 使用默认值(0 或 "无")
282
+ 2. 继续生成日报,不阻塞
283
+ 3. 在日报中标注"部分数据不可用"