@shgroup/dsh-serenity-hooks 1.27.2 → 1.27.4
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/dsh.plugin.json +1 -1
- package/experiments/{autotrajectory → autopilot-trajectory}/SKILL.md +24 -23
- package/experiments/{autotrajectory/scripts/autotrajectory-exp.ts → autopilot-trajectory/scripts/autopilot-trajectory.ts} +46 -46
- package/lib/autopilot-trajectory.d.ts +226 -0
- package/lib/ccc.d.ts +15 -10
- package/lib/client.js +273 -195
- package/lib/index.js +310 -146
- package/lib/{skiff-debug-vLsdk7wV.js → skiff-debug-BRlc17GU.js} +27 -0
- package/lib/tools/{autotrajectory-exp.d.ts → autopilot-trajectory.d.ts} +9 -8
- package/lib/{weixin-api-b8HLmcPE.js → weixin-api-DAugVJ-f.js} +126 -3
- package/lib/weixin-api.d.ts +91 -4
- package/lib/weixin-bridge.d.ts +13 -10
- package/lib/{weixin-route-CvAWARN3.js → weixin-route-EVu56Ytp.js} +51 -6
- package/lib/weixin-route.d.ts +28 -2
- package/package.json +3 -3
- package/lib/autotrajectory.d.ts +0 -193
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-serenity-hooks",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.4",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"description": "宁静号 ACC harness(Native Cordis 插件):真实 DSH 工具 cc_fs/session/acc_msm/eap/neat/cce/handyman/session_rebuild/skiff_admin + 拦截缝机械约束(safe-mode/路径守卫)+ 高级设定面板(双端口网关/账号管理)+ Skiff 认知子集角色(实验性)。适配 DSH 公开版(0.1.0-rc,deepseek-ai/deepseek-harness)。",
|
|
6
6
|
"engines": {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description:
|
|
2
|
+
name: autopilot-trajectory-experiment
|
|
3
|
+
description: Autopilot Trajectory(自动巡航轨迹,正式版;前身自主轨迹实验)参与 skill。本 skill 让 CCC 完整理解机制背景(人类 waiting 是 trajectory 速度瓶颈)、目的(验证"无人等待的 trajectory"能否加速认知推进)、方式(时钟唤起 + 先验偏见 + 轨迹焦点 + 前台运行 + 多 CCC 独立),并提供一站式管理 MSM(autopilot-trajectory:无参全报告 / init 初始化 / random 验证偏见内容 / diag 诊断)。任何希望参与的 CCC 复制本目录到 .opencode/skills/ 即可开始。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Skill:
|
|
6
|
+
# Skill: autopilot-trajectory-experiment
|
|
7
7
|
|
|
8
|
-
> 本 skill
|
|
9
|
-
> 实验管理:`acc_msm exec
|
|
8
|
+
> 本 skill 是 Autopilot Trajectory(自动巡航轨迹)的 **CCC 参与入口**——加载本 skill 即完整理解机制的**背景、目的、方式**。
|
|
9
|
+
> 实验管理:`acc_msm exec autopilot-trajectory <doc|check|status|guide>`
|
|
10
10
|
> 理论依据:serenity-acc-specs `docs/self-sustaining-trajectory-hypothesis.md`(v0.1 猜想)
|
|
11
11
|
|
|
12
12
|
## 触发条件/何时加载
|
|
@@ -37,18 +37,19 @@ description: 自主轨迹实验(Self-Sustaining Trajectory Experiment)参与
|
|
|
37
37
|
|
|
38
38
|
## 3. 参与方式(CCC 侧四步——第一步可一键 init)
|
|
39
39
|
|
|
40
|
-
### ① 初始化(一键):`acc_msm exec
|
|
40
|
+
### ① 初始化(一键):`acc_msm exec autopilot-trajectory init`
|
|
41
41
|
|
|
42
|
-
自动完成:写配置(`.opencode/serenity.json`
|
|
42
|
+
自动完成:写配置(`.opencode/serenity.json` autopilotTrajectory 段)+ 生成偏见提供者脚本模板(CCC 根 `autopilot-bias.ts`)。
|
|
43
43
|
|
|
44
44
|
```jsonc
|
|
45
45
|
// 写入的配置(init 后可在 .opencode/serenity.json 查看/调整)
|
|
46
46
|
{
|
|
47
|
-
"
|
|
47
|
+
"autopilotTrajectory": {
|
|
48
48
|
"enabled": true, // 总开关(缺省 false,默认关零资源占用)
|
|
49
49
|
"intervalHours": 12, // 无人类活动 N 小时后唤起(缺省 12)
|
|
50
|
-
"biasProvider": "
|
|
51
|
-
"topPrompt": "本轨迹的核心焦点:<CCC 填写>", //
|
|
50
|
+
"biasProvider": "autopilot-bias.ts", // 偏见内容提供者脚本(CCC 根下)
|
|
51
|
+
"topPrompt": "本轨迹的核心焦点:<CCC 填写>", // 轨迹焦点:CCC 定义,每次唤起最先注入
|
|
52
|
+
"session": "S###", // 必填:目标会话(不配置绝不唤起)
|
|
52
53
|
"avoidWakeHours": { "start": 8, "end": 18 } // 可选:避开北京高峰(缺省 8~18 省钱)
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -56,11 +57,11 @@ description: 自主轨迹实验(Self-Sustaining Trajectory Experiment)参与
|
|
|
56
57
|
|
|
57
58
|
### ② 定义轨迹焦点(topPrompt——CCC 自己填写)
|
|
58
59
|
|
|
59
|
-
**CCC 定义
|
|
60
|
+
**CCC 定义 autopilotTrajectory 时同时定义本轨迹的顶层提示词**(`topPrompt`):核心目标/纪律/质量要求(示例:"持续深化某领域认知,产出可重建的结论与决策记录")。它会在**每次唤起时最先注入**(`[轨迹焦点]` 段,位于身份锚定之前,影响力最大),作为**稳定焦点锚定 trajectory**——**实验观察:无焦点锚定时,多轮自主唤起中轨迹腐化严重(焦点丢失)**。与偏见内容的分工:**焦点=稳定锚(每轮不变),偏见=随机探索方向(每轮不同),互补**。init 生成占位,CCC 按自己轨迹目标改写(勿留空——留空 = 唤起无焦点锚定,轨迹易漂移)。
|
|
60
61
|
|
|
61
|
-
### ③ 实现偏见内容提供者(`
|
|
62
|
+
### ③ 实现偏见内容提供者(`autopilot-bias.ts`)
|
|
62
63
|
|
|
63
|
-
CCC 根目录下一个脚本,**stdout 输出本轮唤起注入的偏见内容**(反事实问题/探索方向/任何让轨迹偏离既有路径的输入)。**偏见内容归 CCC**——用本 CCC 自己的反馈信息来源保证"足够随机"。`acc_msm exec
|
|
64
|
+
CCC 根目录下一个脚本,**stdout 输出本轮唤起注入的偏见内容**(反事实问题/探索方向/任何让轨迹偏离既有路径的输入)。**偏见内容归 CCC**——用本 CCC 自己的反馈信息来源保证"足够随机"。`acc_msm exec autopilot-trajectory random` 可验证输出。
|
|
64
65
|
|
|
65
66
|
### ④ 标记目标会话(可选自生动机段)
|
|
66
67
|
|
|
@@ -82,21 +83,21 @@ CCC 根目录下一个脚本,**stdout 输出本轮唤起注入的偏见内容*
|
|
|
82
83
|
|
|
83
84
|
**人类角色**:不触发、不中断;回复/评价天然并入(同一前台会话);轨迹不等人类。
|
|
84
85
|
|
|
85
|
-
## 5. 实验管理(
|
|
86
|
+
## 5. 实验管理(autopilot-trajectory MSM)——一站式
|
|
86
87
|
|
|
87
88
|
| 用法 | 功能 |
|
|
88
89
|
|------|------|
|
|
89
|
-
| `acc_msm exec
|
|
90
|
-
| `acc_msm exec
|
|
91
|
-
| `acc_msm exec
|
|
92
|
-
| `acc_msm exec
|
|
93
|
-
| `acc_msm exec
|
|
94
|
-
| `acc_msm exec
|
|
95
|
-
| `acc_msm exec
|
|
90
|
+
| `acc_msm exec autopilot-trajectory`(**推荐,无参**) | **一站式全报告**:背景摘要 + 就绪度检查 + 当前状态 + 下一步指引 + 步骤——CCC agent 看一次即完整理解并知道怎么开始 |
|
|
91
|
+
| `acc_msm exec autopilot-trajectory init` | **一键初始化**:写配置 + 生成偏见提供者脚本模板(CCC 根 autopilot-bias.ts) |
|
|
92
|
+
| `acc_msm exec autopilot-trajectory random` | 运行偏见提供者脚本,输出当前偏见内容(验证) |
|
|
93
|
+
| `acc_msm exec autopilot-trajectory doc` | 机制定义说明全文(本 SKILL.md) |
|
|
94
|
+
| `acc_msm exec autopilot-trajectory check` | 仅就绪度检查(配置/轨迹焦点 topPrompt/偏见提供者/--auto 标志/动机段) |
|
|
95
|
+
| `acc_msm exec autopilot-trajectory status` | 仅当前状态(配置快照/目标会话/距上次活动/唤起窗口/可唤起性) |
|
|
96
|
+
| `acc_msm exec autopilot-trajectory guide` | 仅步骤指引 |
|
|
96
97
|
|
|
97
98
|
## 6. 观察与验证
|
|
98
99
|
|
|
99
|
-
- **观察**:无人类活动满 intervalHours 且非高峰 → 前台会话自动出现 `[
|
|
100
|
+
- **观察**:无人类活动满 intervalHours 且非高峰 → 前台会话自动出现 `[Autopilot Trajectory 唤起]` 消息(可见可介入)
|
|
100
101
|
- **验证阶段**:A 机制可行性(3~5 轮)→ B 速度对比(72h 有/无等待)→ C 质量与熵(人类评审 + H_op)→ D 长期(数周,检验自我确认/熵增)
|
|
101
102
|
- **成功判据**:自主轮产出有意义的比例 ≥ 阈值,且 H_op 维持可运转
|
|
102
103
|
|
|
@@ -108,5 +109,5 @@ CCC 根目录下一个脚本,**stdout 输出本轮唤起注入的偏见内容*
|
|
|
108
109
|
## 相关
|
|
109
110
|
|
|
110
111
|
- 猜想全文:serenity-acc-specs `docs/self-sustaining-trajectory-hypothesis.md`
|
|
111
|
-
- 机制定义:dsh-serenity-plugin `docs/
|
|
112
|
+
- 机制定义:dsh-serenity-plugin `docs/autopilot-trajectory.md`
|
|
112
113
|
- 标准理论:serenity-acc-specs README §0
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* autopilot-trajectory.ts — 自主轨迹实验管理 MSM(Mech,纯 TS 零 LLM 决策)——一站式
|
|
4
4
|
*
|
|
5
5
|
* 一个 tool 整合实验全部所需:
|
|
6
|
-
* acc_msm exec
|
|
7
|
-
* acc_msm exec
|
|
8
|
-
* acc_msm exec
|
|
9
|
-
* acc_msm exec
|
|
10
|
-
* acc_msm exec
|
|
11
|
-
* acc_msm exec
|
|
12
|
-
* acc_msm exec
|
|
13
|
-
* acc_msm exec
|
|
6
|
+
* acc_msm exec autopilot-trajectory → 一站式全报告(背景 + 就绪 + 状态 + 下一步)
|
|
7
|
+
* acc_msm exec autopilot-trajectory init → 初始化实验(写配置 + 生成偏见提供者脚本模板)
|
|
8
|
+
* acc_msm exec autopilot-trajectory random → 运行偏见提供者脚本,输出当前偏见内容(验证)
|
|
9
|
+
* acc_msm exec autopilot-trajectory diag → 唤起条件链诊断(--ccc <path> 指定;无参递归扫描 /home/yh 两层)
|
|
10
|
+
* acc_msm exec autopilot-trajectory doc → 实验定义说明全文(SKILL.md)
|
|
11
|
+
* acc_msm exec autopilot-trajectory check → 仅就绪度检查
|
|
12
|
+
* acc_msm exec autopilot-trajectory status → 仅当前状态
|
|
13
|
+
* acc_msm exec autopilot-trajectory guide → 仅步骤指引
|
|
14
14
|
*
|
|
15
15
|
* 概念(用户拍板命名):偏见内容提供者(bias provider)——CCC 根目录下一个脚本,
|
|
16
16
|
* stdout 输出本轮唤起要注入的偏见内容(反事实方向/探索动机等)。tool 直接运行它;
|
|
17
17
|
* 脚本缺失 → 报错要求实现(不再经 mech-registry 注册 MSM)。
|
|
18
18
|
*
|
|
19
|
-
* 状态查看:WebUI 设置面板「自主轨迹」区块(GET /serenity/
|
|
20
|
-
* (POST /serenity/
|
|
19
|
+
* 状态查看:WebUI 设置面板「自主轨迹」区块(GET /serenity/autopilot-trajectory)+「立即唤起」按钮
|
|
20
|
+
* (POST /serenity/autopilot-trajectory {action:'wake'},调试语义跳过窗口/间隔)——由插件提供,脚本不重复。
|
|
21
21
|
*
|
|
22
22
|
* 零 DSH 依赖,任何 CCC 可运行。环境:SERENITY_ROOT(acc_msm exec 注入)或 cwd 上溯 .serenity。
|
|
23
23
|
*/
|
|
@@ -26,7 +26,7 @@ import { existsSync, readFileSync, statSync, readdirSync, writeFileSync, mkdirSy
|
|
|
26
26
|
import { join, resolve, basename, dirname } from 'node:path'
|
|
27
27
|
import { spawnSync } from 'node:child_process'
|
|
28
28
|
|
|
29
|
-
const DEFAULT_BIAS_PROVIDER = '
|
|
29
|
+
const DEFAULT_BIAS_PROVIDER = 'autopilot-bias.ts'
|
|
30
30
|
const AUTO_SUFFIX = '--auto'
|
|
31
31
|
const MOTIVATION_MARKER = '下一轮动机'
|
|
32
32
|
const CONFIG_PATHS = ['.opencode/serenity.json', '.dsh/serenity.json']
|
|
@@ -34,7 +34,7 @@ const CONFIG_PATHS = ['.opencode/serenity.json', '.dsh/serenity.json']
|
|
|
34
34
|
/** 偏见内容提供者脚本脚手架模板(init 生成;CCC 按自己的反馈信息来源改写) */
|
|
35
35
|
const BIAS_TEMPLATE = `#!/usr/bin/env bun
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* autopilot-bias.ts — 自主轨迹偏见内容提供者(CCC 实现)
|
|
38
38
|
*
|
|
39
39
|
* stdout 输出一行/一段文本 = 本轮唤起注入的偏见内容(反事实问题 / 探索方向 /
|
|
40
40
|
* 任何让轨迹偏离既有路径的输入)。偏见内容归 CCC——用本 CCC 自己的反馈信息来源
|
|
@@ -96,8 +96,8 @@ function loadConfig(root: string): AutoConfig | null {
|
|
|
96
96
|
const p = join(root, rel)
|
|
97
97
|
if (!existsSync(p)) continue
|
|
98
98
|
try {
|
|
99
|
-
const cfg = JSON.parse(readUtf8(p)) as {
|
|
100
|
-
return cfg.
|
|
99
|
+
const cfg = JSON.parse(readUtf8(p)) as { autopilotTrajectory?: AutoConfig }
|
|
100
|
+
return cfg.autopilotTrajectory ?? null
|
|
101
101
|
} catch {
|
|
102
102
|
return null
|
|
103
103
|
}
|
|
@@ -124,7 +124,7 @@ function runBiasProvider(root: string, providerRel: string): { text: string | nu
|
|
|
124
124
|
return { text: null, error: String((e as Error).message) }
|
|
125
125
|
}
|
|
126
126
|
if (!existsSync(scriptAbs)) {
|
|
127
|
-
return { text: null, error: `请在 CCC 根目录实现偏见内容提供者脚本: ${providerRel}(acc_msm exec
|
|
127
|
+
return { text: null, error: `请在 CCC 根目录实现偏见内容提供者脚本: ${providerRel}(acc_msm exec autopilot-trajectory init 可生成模板)` }
|
|
128
128
|
}
|
|
129
129
|
for (const cmd of ['bun', process.execPath]) {
|
|
130
130
|
try {
|
|
@@ -179,14 +179,14 @@ function doc(root: string): string {
|
|
|
179
179
|
|
|
180
180
|
function check(root: string): string {
|
|
181
181
|
const cfg = loadConfig(root)
|
|
182
|
-
const lines: string[] = [`[
|
|
182
|
+
const lines: string[] = [`[autopilot-trajectory] 实验就绪度检查(CCC: ${basename(root)})`, '']
|
|
183
183
|
const fail: string[] = []
|
|
184
184
|
|
|
185
185
|
if (!cfg) {
|
|
186
|
-
lines.push('✗ 未配置
|
|
186
|
+
lines.push('✗ 未配置 autopilotTrajectory(.opencode/serenity.json 缺段)——acc_msm exec autopilot-trajectory init 一键初始化')
|
|
187
187
|
fail.push('config')
|
|
188
188
|
} else if (!cfg.enabled) {
|
|
189
|
-
lines.push('✗
|
|
189
|
+
lines.push('✗ autopilotTrajectory.enabled = false(未开启)')
|
|
190
190
|
fail.push('enabled')
|
|
191
191
|
} else {
|
|
192
192
|
lines.push(`✓ enabled = true`)
|
|
@@ -195,7 +195,7 @@ function check(root: string): string {
|
|
|
195
195
|
if (cfg.topPrompt?.trim()) {
|
|
196
196
|
lines.push(`✓ topPrompt(轨迹焦点)已定义: ${cfg.topPrompt.trim().slice(0, 60)}${cfg.topPrompt.trim().length > 60 ? '…' : ''}(每次唤起最先注入,锚定防漂移)`)
|
|
197
197
|
} else {
|
|
198
|
-
lines.push(`⚠ topPrompt(轨迹焦点)未定义——建议 CCC 定义
|
|
198
|
+
lines.push(`⚠ topPrompt(轨迹焦点)未定义——建议 CCC 定义 autopilotTrajectory 时填写本轨迹核心焦点(实验观察:无焦点锚定,多轮唤起轨迹易漂移腐化)`)
|
|
199
199
|
}
|
|
200
200
|
if (cfg.session) lines.push(` session = ${cfg.session}`)
|
|
201
201
|
const avoid = cfg.avoidWakeHours
|
|
@@ -243,9 +243,9 @@ function check(root: string): string {
|
|
|
243
243
|
function status(root: string): string {
|
|
244
244
|
const cfg = loadConfig(root)
|
|
245
245
|
const now = Date.now()
|
|
246
|
-
const lines: string[] = [`[
|
|
246
|
+
const lines: string[] = [`[autopilot-trajectory] 实验状态(CCC: ${basename(root)},北京 ${beijingHour(now)} 点)`, '']
|
|
247
247
|
if (!cfg?.enabled) {
|
|
248
|
-
lines.push('
|
|
248
|
+
lines.push('autopilotTrajectory 未启用(enabled=false 或未配置)——零资源占用')
|
|
249
249
|
return lines.join('\n')
|
|
250
250
|
}
|
|
251
251
|
lines.push(`配置: intervalHours=${cfg.intervalHours ?? 12} | biasProvider=${cfg.biasProvider?.trim() || DEFAULT_BIAS_PROVIDER}${cfg.session ? ` | session=${cfg.session}` : ''}${cfg.topPrompt?.trim() ? ' | topPrompt ✓' : ''}`)
|
|
@@ -267,30 +267,30 @@ function status(root: string): string {
|
|
|
267
267
|
|
|
268
268
|
function guide(): string {
|
|
269
269
|
return [
|
|
270
|
-
'[
|
|
270
|
+
'[autopilot-trajectory] 实验步骤指引',
|
|
271
271
|
'',
|
|
272
|
-
'① 初始化(一键):acc_msm exec
|
|
273
|
-
' ——写配置(.opencode/serenity.json
|
|
272
|
+
'① 初始化(一键):acc_msm exec autopilot-trajectory init',
|
|
273
|
+
' ——写配置(.opencode/serenity.json autopilotTrajectory 段)+ 生成偏见提供者脚本模板(CCC 根 autopilot-bias.ts)',
|
|
274
274
|
'② **定义轨迹焦点(topPrompt)**:编辑配置中的 topPrompt——**CCC 自己填写**本轨迹的核心',
|
|
275
275
|
' 目标/纪律/质量要求(示例:"持续深化某领域认知,产出可重建的结论与决策记录")。',
|
|
276
276
|
' 它会在每次唤起时最先注入([轨迹焦点] 段),作为稳定焦点锚定 trajectory 防漂移——',
|
|
277
277
|
' **实验观察:无焦点锚定时多轮唤起轨迹腐化严重(焦点丢失)**。勿留空。',
|
|
278
|
-
'③ 实现偏见内容提供者:编辑
|
|
279
|
-
' 用本 CCC 自己的信息来源保证"足够随机");acc_msm exec
|
|
278
|
+
'③ 实现偏见内容提供者:编辑 autopilot-bias.ts,stdout 输出偏见内容(反事实方向/探索动机,',
|
|
279
|
+
' 用本 CCC 自己的信息来源保证"足够随机");acc_msm exec autopilot-trajectory random 验证',
|
|
280
280
|
'④ 标记目标会话:目录名加 --auto 后缀 AGENT_SESSIONS/<date>--<desc>--auto/',
|
|
281
281
|
' (可选)该 SESSION.md 写「下一轮动机」段作自生偏见',
|
|
282
|
-
'⑤ 验证就绪:acc_msm exec
|
|
282
|
+
'⑤ 验证就绪:acc_msm exec autopilot-trajectory(一站式报告应为 ✅;topPrompt 未定义会 ⚠ 提示)',
|
|
283
283
|
'⑥ 观察:无人类活动满 intervalHours 且北京非高峰 → 前台会话自动出现 [自主轨迹唤起]',
|
|
284
284
|
' 产出落 SESSION.md「自主探索日志」+ 预写「下一轮动机」',
|
|
285
285
|
'',
|
|
286
286
|
'分工:焦点(topPrompt)= 稳定锚,每轮不变;偏见(biasProvider)= 随机探索方向,每轮不同——两者都由 CCC 定义。',
|
|
287
|
-
'完整定义见 SKILL.md(acc_msm exec
|
|
287
|
+
'完整定义见 SKILL.md(acc_msm exec autopilot-trajectory doc)',
|
|
288
288
|
].join('\n')
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
/** 初始化:合并写配置(不覆盖其他段)+ 生成偏见提供者脚本模板(已存在则跳过) */
|
|
292
292
|
function init(root: string): string {
|
|
293
|
-
const out: string[] = ['[
|
|
293
|
+
const out: string[] = ['[autopilot-trajectory] 初始化实验', '']
|
|
294
294
|
|
|
295
295
|
// ① 写配置
|
|
296
296
|
let cfgPath = join(root, CONFIG_PATHS[0]!)
|
|
@@ -307,8 +307,8 @@ function init(root: string): string {
|
|
|
307
307
|
/* 损坏则重建 */
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
|
-
const at = (merged.
|
|
311
|
-
merged.
|
|
310
|
+
const at = (merged.autopilotTrajectory as Record<string, unknown> | undefined) ?? {}
|
|
311
|
+
merged.autopilotTrajectory = {
|
|
312
312
|
enabled: true,
|
|
313
313
|
intervalHours: 12,
|
|
314
314
|
biasProvider: DEFAULT_BIAS_PROVIDER,
|
|
@@ -320,7 +320,7 @@ function init(root: string): string {
|
|
|
320
320
|
}
|
|
321
321
|
writeFileSync(cfgPath, `${JSON.stringify(merged, null, 2)}\n`)
|
|
322
322
|
out.push(`✓ 配置写入: ${cfgPath}`)
|
|
323
|
-
out.push(`
|
|
323
|
+
out.push(` autopilotTrajectory = ${JSON.stringify(merged.autopilotTrajectory)}`)
|
|
324
324
|
out.push(` ⚠ 请编辑 topPrompt 为**本 CCC 的轨迹焦点**(现为占位——每次唤起最先注入,防轨迹漂移,勿留空)`)
|
|
325
325
|
|
|
326
326
|
// ② 生成偏见提供者脚本模板
|
|
@@ -332,7 +332,7 @@ function init(root: string): string {
|
|
|
332
332
|
out.push(`✓ 已生成偏见提供者脚本模板: ${DEFAULT_BIAS_PROVIDER}(编辑它,stdout 输出偏见内容)`)
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
-
out.push('', '下一步:② 编辑配置 topPrompt(轨迹焦点——CCC 自己填写本轨迹核心目标,勿留空)→ ③ 标记目标会话 --auto 后缀 → ⑤ acc_msm exec
|
|
335
|
+
out.push('', '下一步:② 编辑配置 topPrompt(轨迹焦点——CCC 自己填写本轨迹核心目标,勿留空)→ ③ 标记目标会话 --auto 后缀 → ⑤ acc_msm exec autopilot-trajectory 验证就绪')
|
|
336
336
|
return out.join('\n')
|
|
337
337
|
}
|
|
338
338
|
|
|
@@ -341,8 +341,8 @@ function random(root: string): string {
|
|
|
341
341
|
const cfg = loadConfig(root)
|
|
342
342
|
const provider = cfg?.biasProvider?.trim() || DEFAULT_BIAS_PROVIDER
|
|
343
343
|
const bias = runBiasProvider(root, provider)
|
|
344
|
-
if (bias.error) return `[
|
|
345
|
-
return `[
|
|
344
|
+
if (bias.error) return `[autopilot-trajectory] ✗ ${bias.error}`
|
|
345
|
+
return `[autopilot-trajectory] 当前偏见内容(${provider}):\n${bias.text ?? '(空输出)'}`
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
/** 一站式全报告:背景 + 就绪检查 + 状态 + 下一步 + 指引(CCC agent 看一次即懂并知道下一步) */
|
|
@@ -352,14 +352,14 @@ function all(root: string): string {
|
|
|
352
352
|
const stat = status(root)
|
|
353
353
|
const next: string[] = ['═══ 下一步 ═══']
|
|
354
354
|
if (!cfg) {
|
|
355
|
-
next.push('→ 本 CCC 尚未配置
|
|
355
|
+
next.push('→ 本 CCC 尚未配置 autopilotTrajectory。开始实验:acc_msm exec autopilot-trajectory init 一键初始化。')
|
|
356
356
|
} else if (!cfg.enabled) {
|
|
357
|
-
next.push('→
|
|
357
|
+
next.push('→ autopilotTrajectory.enabled 为 false——置 true 开启实验(或 init 重新初始化)。')
|
|
358
358
|
} else if (ready.includes('✗')) {
|
|
359
359
|
next.push('→ 存在未就绪项(见上)。补齐后重跑本命令确认 ✅。')
|
|
360
360
|
} else {
|
|
361
361
|
next.push('→ 已就绪 ✅。保持会话空闲满 intervalHours 且北京非高峰 → 自动唤起(前台可见)。')
|
|
362
|
-
next.push('→ 之后可随时 acc_msm exec
|
|
362
|
+
next.push('→ 之后可随时 acc_msm exec autopilot-trajectory status 查看距下次唤起的进度。')
|
|
363
363
|
}
|
|
364
364
|
return [BACKGROUND, ready, '', stat, '', next.join('\n'), '', guide()].join('\n')
|
|
365
365
|
}
|
|
@@ -374,8 +374,8 @@ function diagCcc(root: string): string {
|
|
|
374
374
|
|
|
375
375
|
// ① enabled(定时器是否启动)
|
|
376
376
|
if (!cfg) {
|
|
377
|
-
blocks.push('✗
|
|
378
|
-
suggest.push('配置:.opencode/serenity.json 加
|
|
377
|
+
blocks.push('✗ autopilotTrajectory 未配置(定时器不启动)')
|
|
378
|
+
suggest.push('配置:.opencode/serenity.json 加 autopilotTrajectory 段(autopilot-trajectory init 可生成)')
|
|
379
379
|
} else if (!cfg.enabled) {
|
|
380
380
|
blocks.push('✗ enabled = false(定时器不启动)')
|
|
381
381
|
suggest.push('置 enabled: true')
|
|
@@ -431,7 +431,7 @@ function diagCcc(root: string): string {
|
|
|
431
431
|
const bias = runBiasProvider(root, provider)
|
|
432
432
|
if (bias.error) {
|
|
433
433
|
blocks.push(`✗ 偏见脚本: ${bias.error}`)
|
|
434
|
-
suggest.push('实现偏见脚本(
|
|
434
|
+
suggest.push('实现偏见脚本(autopilot-trajectory init 生成模板后编辑)')
|
|
435
435
|
} else {
|
|
436
436
|
blocks.push(`✓ 偏见脚本可运行(输出: ${bias.text ?? '(空)'})`)
|
|
437
437
|
}
|
|
@@ -449,7 +449,7 @@ function diagCcc(root: string): string {
|
|
|
449
449
|
return lines.join('\n')
|
|
450
450
|
}
|
|
451
451
|
|
|
452
|
-
/** diag:--ccc <path> 指定目标 CCC;无参扫描常见 CCC 根(配置了
|
|
452
|
+
/** diag:--ccc <path> 指定目标 CCC;无参扫描常见 CCC 根(配置了 autopilotTrajectory 的优先) */
|
|
453
453
|
function diag(): string {
|
|
454
454
|
const argIdx = process.argv.indexOf('--ccc')
|
|
455
455
|
if (argIdx >= 0 && process.argv[argIdx + 1]) {
|
|
@@ -463,7 +463,7 @@ function diag(): string {
|
|
|
463
463
|
collectCccs(base, 0, roots, 2)
|
|
464
464
|
}
|
|
465
465
|
const list = [...roots]
|
|
466
|
-
if (list.length === 0) return '[
|
|
466
|
+
if (list.length === 0) return '[autopilot-trajectory diag] 未发现 CCC(用 --ccc <path> 指定目标)'
|
|
467
467
|
const ordered = [...list.filter((r) => loadConfig(r)?.enabled), ...list.filter((r) => !loadConfig(r)?.enabled)]
|
|
468
468
|
return ordered.map(diagCcc).join('\n\n')
|
|
469
469
|
}
|
|
@@ -483,7 +483,7 @@ function main(): void {
|
|
|
483
483
|
const cmd = process.argv[2] ?? 'all'
|
|
484
484
|
const root = findRoot()
|
|
485
485
|
if (!root) {
|
|
486
|
-
console.error('[
|
|
486
|
+
console.error('[autopilot-trajectory] ✗ 未找到 CCC 根(无 .serenity;acc_msm exec 会自动注入 SERENITY_ROOT)')
|
|
487
487
|
process.exit(1)
|
|
488
488
|
}
|
|
489
489
|
switch (cmd) {
|
|
@@ -512,7 +512,7 @@ function main(): void {
|
|
|
512
512
|
console.log(guide())
|
|
513
513
|
break
|
|
514
514
|
default:
|
|
515
|
-
console.error(`[
|
|
515
|
+
console.error(`[autopilot-trajectory] 未知子命令: ${cmd}(可用: 无参一站式 / init / random / diag / doc / check / status / guide)`)
|
|
516
516
|
process.exit(2)
|
|
517
517
|
}
|
|
518
518
|
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* autopilot-trajectory.ts — Autopilot Trajectory(自动巡航轨迹,正式版 v1.27.4)
|
|
3
|
+
*
|
|
4
|
+
* 前身:autotrajectory(v1.26.12~17 实验验证机制)。用户拍板正式化:
|
|
5
|
+
* 命名 = Autopilot Trajectory(autotrajectory 是技术代号——"auto" 弱前缀 + "trajectory"
|
|
6
|
+
* 内部术语;Autopilot 契合宁静号 Ship 隐喻:设定目标 → 自主巡航 → 驾驶舱可见 → 人类可接管,
|
|
7
|
+
* 加 Trajectory 明确对象)。成熟度分级:L1 时钟唤起 → L2 焦点+偏见 → **L3 质量反馈环(下一轮)**。
|
|
8
|
+
*
|
|
9
|
+
* 依据:serenity-acc-specs/docs/self-sustaining-trajectory-hypothesis.md(v0.1 实验提案;
|
|
10
|
+
* S142 2026-08-30 用户提出猜想 + 三项裁决:① 时钟驱动 ② 先验偏见自生+随机(随机充分引入)
|
|
11
|
+
* ③ 人类=反馈来源(不直接参与))。
|
|
12
|
+
*
|
|
13
|
+
* 形态(用户拍板 v0.5 + 正式化 v1.27.4):
|
|
14
|
+
* · **前台运行**:时钟唤起 = 向活跃会话注入唤起消息(agent.steer,v1.22.5 自动继续同款
|
|
15
|
+
* 通道)→ 模型自动继续 → 用户全程可见、随时可介入(人类反馈天然并入——同会话)。
|
|
16
|
+
* · **偏见内容提供者 = CCC 根目录下脚本**(biasProvider;缺省 autopilot-bias.ts,
|
|
17
|
+
* 旧默认 autotrajectory-bias.ts 回退——pangu 等已配置 CCC 兼容):tool 直接运行取
|
|
18
|
+
* stdout 作为偏见内容;脚本缺失 → **报错要求实现**(偏见内容归 CCC)。
|
|
19
|
+
* · **会话标志 = 目录名后缀 --auto**:AGENT_SESSIONS/<date>--<desc>--auto/ → 自主形态。
|
|
20
|
+
* · **轨迹焦点 topPrompt = CCC 定义**:每次唤起最先注入的顶层提示词(稳定焦点锚定防漂移)。
|
|
21
|
+
* · **唤起窗口避开北京时间 8~18 点**(用量峰谷省钱)——avoidWakeHours 可覆盖。
|
|
22
|
+
* · **多 CCC 独立(v1.27.4,用户"4个CCC能各自有autotrajectory吗")**:配置层本就 CCC 级
|
|
23
|
+
* (enabled/intervalHours/session/biasProvider/topPrompt/窗口);正式版时钟遍历所有
|
|
24
|
+
* live+enabled CCC 各自评估唤起(collectAutopilotCccs),running 守卫 per-CCC + 全局
|
|
25
|
+
* 串行化(防模型并发挤兑)。
|
|
26
|
+
* · **默认关**:serenity.json autopilotTrajectory.enabled=false → 定时器不启动,零资源占用。
|
|
27
|
+
*/
|
|
28
|
+
import type { Context } from 'cordis';
|
|
29
|
+
import { type AutopilotTrajectorySettings } from './ccc.js';
|
|
30
|
+
/** 偏见内容提供者脚本缺省名(CCC 根目录下;正式版 autopilot-bias.ts) */
|
|
31
|
+
export declare const DEFAULT_BIAS_PROVIDER = "autopilot-bias.ts";
|
|
32
|
+
/** 旧默认偏见脚本名(autotrajectory 时代;未显式配置时回退——pangu 等已配置 CCC 零迁移) */
|
|
33
|
+
export declare const LEGACY_BIAS_PROVIDER = "autotrajectory-bias.ts";
|
|
34
|
+
/** 自主轨迹会话目录后缀标志(--auto 保留——简短且历史会话 S060--auto 已存在) */
|
|
35
|
+
export declare const AUTO_DIR_SUFFIX = "--auto";
|
|
36
|
+
/** 调度 tick 周期(10min——验证形态"一个就够") */
|
|
37
|
+
export declare const TICK_MS: number;
|
|
38
|
+
/** SESSION.md 内「下一轮动机」段标记(自生偏见载体——轨迹预设自己的未来) */
|
|
39
|
+
export declare const MOTIVATION_MARKER = "\u4E0B\u4E00\u8F6E\u52A8\u673A";
|
|
40
|
+
/** 缺省避开的高峰时段(北京时间 [start, end) 不唤起——用量峰谷省钱) */
|
|
41
|
+
export declare const DEFAULT_AVOID_HOURS: {
|
|
42
|
+
start: number;
|
|
43
|
+
end: number;
|
|
44
|
+
};
|
|
45
|
+
/** 偏见脚本输出上限(沙箱:截断防失控——正式版 v1.27.4) */
|
|
46
|
+
export declare const BIAS_OUTPUT_MAX: number;
|
|
47
|
+
/** 偏见脚本执行超时(正式版沙箱;原 600s 过长阻塞 tick) */
|
|
48
|
+
export declare const BIAS_RUN_TIMEOUT_MS = 60000;
|
|
49
|
+
/** 每日唤起预算缺省上限(轮次预算——正式版 v1.27.4;防失控 + 控成本) */
|
|
50
|
+
export declare const DEFAULT_MAX_DAILY_WAKES = 24;
|
|
51
|
+
/** 审计历史 ring 上限(每 CCC 保留最近 N 条唤起记录) */
|
|
52
|
+
export declare const AUDIT_HISTORY_MAX = 50;
|
|
53
|
+
/** 读配置:新键 autopilotTrajectory 优先,旧键 autotrajectory 回退(正式化兼容) */
|
|
54
|
+
export declare function readAutopilotSettings(root: string): AutopilotTrajectorySettings | null;
|
|
55
|
+
/**
|
|
56
|
+
* 北京时间(UTC+8)当前小时——不依赖服务器时区(服务器可能 UTC/本地任意)。
|
|
57
|
+
*/
|
|
58
|
+
export declare function beijingHour(nowMs: number): number;
|
|
59
|
+
/** 当日已用唤起次数(按北京时间日;轮次预算 maxDailyWakes 判定) */
|
|
60
|
+
export declare function dailyWakeCount(history: readonly WakeRecord[], nowMs: number): number;
|
|
61
|
+
/**
|
|
62
|
+
* 唤起窗口判定:北京时间 [avoidStart, avoidEnd) 内不唤起(缺省 8~18)。
|
|
63
|
+
* 单段避开(start<=end):窗口 = [0,start) ∪ [end,24);跨零点避开(start>end):窗口 = [end,start)。
|
|
64
|
+
*/
|
|
65
|
+
export declare function inAllowedWakeWindow(nowMs: number, avoid?: {
|
|
66
|
+
start?: number;
|
|
67
|
+
end?: number;
|
|
68
|
+
}): boolean;
|
|
69
|
+
/** 标志位判定:SESSION.md 所在目录名以 --auto 结尾 → 自主轨迹形态 */
|
|
70
|
+
export declare function isAutopilotSession(mdPath: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* 目标会话定位:**必须配置 cfg.session**(S###/目录名)——CCC 日常有多条 trajectory 在跑,
|
|
73
|
+
* 绝不默认唤起(缺省最近活跃会误伤其他正在运行的轨迹;用户拍板:必须配置才生效)。
|
|
74
|
+
* 未配置 session 或未命中 → null(不唤起)。
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveTargetMd(root: string, cfg: AutopilotTrajectorySettings): string | null;
|
|
77
|
+
/**
|
|
78
|
+
* 唤起条件(纯逻辑,可测):enabled + 未在运行 + 目录标志 + mtime 超间隔 + 窗口允许 + 预算未超。
|
|
79
|
+
*/
|
|
80
|
+
export declare function shouldWake(settings: AutopilotTrajectorySettings, mdPath: string | null, nowMs: number, running: boolean, history?: readonly WakeRecord[]): boolean;
|
|
81
|
+
/** 自生动机读取:SESSION.md「下一轮动机」段内容(到下一个二级标题或文件尾;无 → null) */
|
|
82
|
+
export declare function readSelfGeneratedMotivation(mdPath: string): string | null;
|
|
83
|
+
/**
|
|
84
|
+
* 偏见内容:直接运行 CCC 根目录下偏见提供者脚本(biasProvider,缺省 autopilot-bias.ts;
|
|
85
|
+
* 未显式配置且新默认缺失 → 回退旧默认 autotrajectory-bias.ts——pangu 兼容)→ stdout。
|
|
86
|
+
* 脚本缺失 → 返回 { text: null, error: 提示实现 }(唤起侧报错要求实现,不静默跳过)。
|
|
87
|
+
* 路径逃逸校验(resolveInside);bun 优先,node 兜底;**60s 超时 + 8KB 输出截断(沙箱)**。
|
|
88
|
+
*/
|
|
89
|
+
export declare function fetchBiasContent(root: string, providerRel: string): Promise<{
|
|
90
|
+
text: string | null;
|
|
91
|
+
error: string | null;
|
|
92
|
+
}>;
|
|
93
|
+
/** 唤起消息(四段式:轨迹焦点[CCC 定义,稳定] / 身份锚定 / 先验偏见[自生动机+偏见内容] / 任务)——注入前台会话,用户可见 */
|
|
94
|
+
export declare function buildWakeMessage(opts: {
|
|
95
|
+
sessionName: string;
|
|
96
|
+
mdPath: string;
|
|
97
|
+
intervalHours: number;
|
|
98
|
+
topPrompt: string | null;
|
|
99
|
+
motivation: string | null;
|
|
100
|
+
biasContent: string | null;
|
|
101
|
+
}): string;
|
|
102
|
+
/** 唤起结果(tick 日志 / 面板显示 / 审计记录共用) */
|
|
103
|
+
export interface WakeResult {
|
|
104
|
+
ok: boolean;
|
|
105
|
+
detail: string;
|
|
106
|
+
}
|
|
107
|
+
/** 审计记录(每 CCC ring buffer——正式版 v1.27.4:可回看、可分析) */
|
|
108
|
+
export interface WakeRecord {
|
|
109
|
+
time: number;
|
|
110
|
+
ok: boolean;
|
|
111
|
+
detail: string;
|
|
112
|
+
}
|
|
113
|
+
/** 追加审计记录(ring 截断) */
|
|
114
|
+
export declare function recordWake(root: string, rec: WakeRecord): void;
|
|
115
|
+
/** 读审计历史(root 的最近记录;无 → []) */
|
|
116
|
+
export declare function wakeHistoryFor(root: string): WakeRecord[];
|
|
117
|
+
/** 测试辅助:清空审计(生产零调用) */
|
|
118
|
+
export declare function resetWakeHistory(): void;
|
|
119
|
+
/**
|
|
120
|
+
* 执行一次唤起(时钟 tick 与面板「立即唤起」共用):
|
|
121
|
+
* - force=false(时钟):完整校验——enabled / 目标命中 / --auto 标志 / 窗口 / 间隔 / 预算 / 偏见脚本
|
|
122
|
+
* - force=true(手动调试,用户在场):跳过窗口/间隔/预算,仍校验 enabled / 目标命中 / --auto / 偏见脚本
|
|
123
|
+
* 成功 → 注入前台会话(agent.steer,用户可见);返回结果供调用方(tick 打日志 / 面板显示 / 审计)。
|
|
124
|
+
*/
|
|
125
|
+
export declare function performAutopilotWake(ctx: Context, root: string, settings: AutopilotTrajectorySettings, opts?: {
|
|
126
|
+
force?: boolean;
|
|
127
|
+
}): Promise<WakeResult>;
|
|
128
|
+
/**
|
|
129
|
+
* 装配(index.ts apply 调用)。时钟唤起(v1.26.14 修复 + v1.27.4 多 CCC 独立):
|
|
130
|
+
*
|
|
131
|
+
* v1.26.14 根因:旧实现启动时一次性解析 root——web 进程启动时 live 会话往往为空 → 定时器不启动。
|
|
132
|
+
* 修复:① 每次 tick 动态解析 root+settings ② 监听 session/created 启动定时器 ③ 优先实验 CCC。
|
|
133
|
+
*
|
|
134
|
+
* **v1.27.4 多 CCC 独立(用户"4个CCC能各自有autotrajectory吗")**:
|
|
135
|
+
* - 单定时器保留(TICK_MS 10min),每次 tick **遍历所有 live+enabled CCC**(collectAutopilotCccs)
|
|
136
|
+
* 各自评估 shouldWake + 各自唤起——每 CCC 的 interval/session/bias/topPrompt/窗口独立
|
|
137
|
+
* - `running` 守卫 **per-CCC**(不同 CCC 唤起互不阻塞)
|
|
138
|
+
* - **全局串行化**(wakeChain:同 tick 多 CCC 到点 → 依次唤起,防模型并发挤兑)
|
|
139
|
+
*
|
|
140
|
+
* 零资源占用语义保留:无 enabled CCC → tick 内直接 return(定时器存在但每 10min 一次空检查,
|
|
141
|
+
* unref 不阻塞进程退出)。
|
|
142
|
+
*/
|
|
143
|
+
export declare function registerAutopilot(ctx: Context): void;
|
|
144
|
+
/**
|
|
145
|
+
* 面板状态(GET /serenity/autopilot-trajectory 数据源;纯逻辑,可单测)——
|
|
146
|
+
* WebUI 设置面板「Autopilot Trajectory」只读区块展示的完整状态:配置摘要 + 目标会话
|
|
147
|
+
* 命中/标志/空闲时长 + 当前窗口/可唤起判定 + 审计(最近唤起)。
|
|
148
|
+
* 不运行偏见脚本(只报脚本是否就绪——运行验证走 autopilot-trajectory random)。
|
|
149
|
+
*/
|
|
150
|
+
export interface AutopilotTrajectoryStatus {
|
|
151
|
+
/** 是否配置了 autopilotTrajectory 段(.opencode/serenity.json;含旧键回退) */
|
|
152
|
+
configured: boolean;
|
|
153
|
+
/** 总开关(缺省 false——未开零资源占用) */
|
|
154
|
+
enabled: boolean;
|
|
155
|
+
/** 无人类活动 N 小时后自动唤起(缺省 12) */
|
|
156
|
+
intervalHours: number;
|
|
157
|
+
/** 每日唤起预算上限(缺省 24) */
|
|
158
|
+
maxDailyWakes: number;
|
|
159
|
+
/** 偏见内容提供者脚本(相对 CCC 根;缺省 autopilot-bias.ts) */
|
|
160
|
+
biasProvider: string;
|
|
161
|
+
/** 顶层提示词(每次唤起最先注入的稳定指令;未配置 → null) */
|
|
162
|
+
topPrompt: string | null;
|
|
163
|
+
/** 目标会话(S###/目录名;未配置 = 不唤起) */
|
|
164
|
+
session: string | null;
|
|
165
|
+
/** 避开唤起的高峰时段(北京时间) */
|
|
166
|
+
avoidWakeHours: {
|
|
167
|
+
start: number;
|
|
168
|
+
end: number;
|
|
169
|
+
};
|
|
170
|
+
/** 目标会话状态(未配置/未命中 → null) */
|
|
171
|
+
target: {
|
|
172
|
+
/** 目录名(含 --auto 后缀时为自主形态) */
|
|
173
|
+
dirName: string;
|
|
174
|
+
/** 目录名是否带 --auto 标志 */
|
|
175
|
+
autoFlag: boolean;
|
|
176
|
+
/** 距上次轨迹活动(小时) */
|
|
177
|
+
idleHours: number;
|
|
178
|
+
/** 当前时刻是否满足唤起条件(标志+间隔+窗口+预算,未运行中) */
|
|
179
|
+
wakeable: boolean;
|
|
180
|
+
} | null;
|
|
181
|
+
/** 当前北京时间小时 */
|
|
182
|
+
beijingHour: number;
|
|
183
|
+
/** 当前是否在唤起窗口内(避开高峰之外) */
|
|
184
|
+
windowAllowed: boolean;
|
|
185
|
+
/** 审计:最近唤起记录(最多 10 条展示;正式版 v1.27.4) */
|
|
186
|
+
recentWakes: WakeRecord[];
|
|
187
|
+
}
|
|
188
|
+
export declare function getAutopilotStatus(root: string): AutopilotTrajectoryStatus;
|
|
189
|
+
/** live 会话条目(诊断/面板解析用;标题从 events 读) */
|
|
190
|
+
export interface LiveSessionEntry {
|
|
191
|
+
id: string;
|
|
192
|
+
cwd: string | null;
|
|
193
|
+
cccRoot: string | null;
|
|
194
|
+
title: string | null;
|
|
195
|
+
}
|
|
196
|
+
/** 遍历 live 会话(sessions.list())+ 补标题(events session/title latest-wins)+ ccc 归属 */
|
|
197
|
+
export declare function listLiveSessions(ctx: Context): LiveSessionEntry[];
|
|
198
|
+
/**
|
|
199
|
+
* 收集所有「配置了 Autopilot Trajectory 的 live CCC」——**v1.27.4 多 CCC 独立**:
|
|
200
|
+
* 返回 enabled 的 CCC 列表(时钟 tick 遍历目标);无 enabled → []。
|
|
201
|
+
* (原 resolveAutoTrajectoryCcc 单目标语义被 collect 取代——面板/诊断用 enableOnly=false 取全量)
|
|
202
|
+
*/
|
|
203
|
+
export declare function collectAutopilotCccs(ctx: Context, opts?: {
|
|
204
|
+
includeDisabled?: boolean;
|
|
205
|
+
}): string[];
|
|
206
|
+
/**
|
|
207
|
+
* 进程内诊断(autopilot-trajectory diag-live 数据源;用户"排查访问不到 pangu 写个 msm")——
|
|
208
|
+
* 输出当前实例 live 会话清单(id/cwd/ccc/标题)+ 每个配置了 Autopilot 的 CCC
|
|
209
|
+
* 状态(配置摘要/目标命中/可唤起)+ 目标 agent 定位结果。脚本 diag 看不到运行时,
|
|
210
|
+
* 本函数在插件进程内运行(能读 sessions/agents)。
|
|
211
|
+
*/
|
|
212
|
+
export interface DiagLiveReport {
|
|
213
|
+
processCwd: string;
|
|
214
|
+
processCcc: string | null;
|
|
215
|
+
liveSessions: LiveSessionEntry[];
|
|
216
|
+
autopilotCccs: Array<{
|
|
217
|
+
root: string;
|
|
218
|
+
enabled: boolean;
|
|
219
|
+
session: string | null;
|
|
220
|
+
target: AutopilotTrajectoryStatus['target'];
|
|
221
|
+
agentResolved: boolean;
|
|
222
|
+
agentDiagnosis: string | null;
|
|
223
|
+
}>;
|
|
224
|
+
panelResolved: string | null;
|
|
225
|
+
}
|
|
226
|
+
export declare function diagLive(ctx: Context): DiagLiveReport;
|