termdock 1.4.301 → 1.4.302
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.
|
@@ -220,7 +220,7 @@ function replayFlags(agent, argv) {
|
|
|
220
220
|
* the only durable source available for a future recovery.
|
|
221
221
|
*/
|
|
222
222
|
export function inferResumeSessionId(agent, argv) {
|
|
223
|
-
const safeId = (value) => value && /^[A-Za-z0-9._-]+$/.test(value) ? value : null;
|
|
223
|
+
const safeId = (value) => value && !value.startsWith('-') && /^[A-Za-z0-9._-]+$/.test(value) ? value : null;
|
|
224
224
|
let named = -1;
|
|
225
225
|
for (let index = 0; index < argv.length; index += 1) {
|
|
226
226
|
if (tokenNamesAgent(argv[index], agent)) {
|
|
@@ -231,6 +231,36 @@ export function inferResumeSessionId(agent, argv) {
|
|
|
231
231
|
if (named < 0)
|
|
232
232
|
return null;
|
|
233
233
|
const tail = argv.slice(named + 1);
|
|
234
|
+
if (agent.isPlugin) {
|
|
235
|
+
const template = getPluginResumeConfig(agent.slug)?.command.trim().split(/\s+/);
|
|
236
|
+
if (!template || !tokenNamesAgent(template[0], agent))
|
|
237
|
+
return null;
|
|
238
|
+
const pattern = template.slice(1);
|
|
239
|
+
if (pattern.join(' ').split('{sessionId}').length !== 2)
|
|
240
|
+
return null;
|
|
241
|
+
const matches = new Set();
|
|
242
|
+
// A positional resume command must start the argument tail. Flag-based
|
|
243
|
+
// templates may follow other launch flags, as for built-in --resume.
|
|
244
|
+
const starts = pattern[0]?.startsWith('-') ? tail.map((_, index) => index) : [0];
|
|
245
|
+
for (const start of starts) {
|
|
246
|
+
let id = null;
|
|
247
|
+
const matched = pattern.every((token, index) => {
|
|
248
|
+
const value = tail[start + index];
|
|
249
|
+
if (value === undefined)
|
|
250
|
+
return false;
|
|
251
|
+
if (!token.includes('{sessionId}'))
|
|
252
|
+
return token === value;
|
|
253
|
+
const [prefix, suffix] = token.split('{sessionId}');
|
|
254
|
+
if (!value.startsWith(prefix) || !value.endsWith(suffix))
|
|
255
|
+
return false;
|
|
256
|
+
id = safeId(value.slice(prefix.length, suffix ? -suffix.length : undefined));
|
|
257
|
+
return !!id;
|
|
258
|
+
});
|
|
259
|
+
if (matched && id)
|
|
260
|
+
matches.add(id);
|
|
261
|
+
}
|
|
262
|
+
return matches.size === 1 ? [...matches][0] : null;
|
|
263
|
+
}
|
|
234
264
|
if (agent.slug === 'codex') {
|
|
235
265
|
const resume = tail.indexOf('resume');
|
|
236
266
|
return resume >= 0 ? safeId(tail[resume + 1]) : null;
|
|
@@ -1596,7 +1596,9 @@ async function inspectCollaborationTmux(binding, requestedPane, allowPlainPane =
|
|
|
1596
1596
|
if (!Number.isInteger(serverPid) || serverPid <= 0)
|
|
1597
1597
|
throw new Error('TMUX_SERVER_IDENTITY_UNAVAILABLE');
|
|
1598
1598
|
const panes = await Promise.all(layout.windows.flatMap((window) => window.panes).map(async (pane) => {
|
|
1599
|
-
|
|
1599
|
+
// Native identity needs the foreground argv even for a named binary;
|
|
1600
|
+
// pane_current_command alone cannot prove an exact resumed conversation.
|
|
1601
|
+
const program = await resolveTmuxPaneProgram(pane, true);
|
|
1600
1602
|
const agent = detectAgentFromCommand(program?.rawArgs ?? program?.command ?? '', agentCustomCommands());
|
|
1601
1603
|
const nativeSessionId = agent && program?.rawArgs ? inferResumeSessionId(agent, splitCommandToArgv(program.rawArgs)) : null;
|
|
1602
1604
|
return { serverPid, sessionId: layout.sessionId, paneId: pane.id, panePid: pane.pid,
|
|
@@ -3844,14 +3846,14 @@ async function getProcessSnapshot() {
|
|
|
3844
3846
|
});
|
|
3845
3847
|
return processSnapshotPromise;
|
|
3846
3848
|
}
|
|
3847
|
-
async function resolveTmuxPaneProgram(pane) {
|
|
3849
|
+
async function resolveTmuxPaneProgram(pane, requireArgs = false) {
|
|
3848
3850
|
// If pane command is a known shell, try to find a child foreground process
|
|
3849
3851
|
const command = normalizeProgramName(pane.command);
|
|
3850
3852
|
const commandKey = command?.toLowerCase() ?? null;
|
|
3851
3853
|
const isShell = commandKey ? shellNamesBackend.has(commandKey) : false;
|
|
3852
3854
|
// If pane command is NOT a shell but also too generic (e.g. "node"), also try
|
|
3853
3855
|
const isGeneric = commandKey ? genericProgramNames.has(commandKey) : false;
|
|
3854
|
-
if (!isShell && !isGeneric) {
|
|
3856
|
+
if (!isShell && !isGeneric && !requireArgs) {
|
|
3855
3857
|
// Non-shell, non-generic command — pane_current_command is good enough
|
|
3856
3858
|
return { command, source: 'tmux-pane', rawArgs: null };
|
|
3857
3859
|
}
|
package/docs/integrations.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
最低 CLI / 运行服务版本:**termdock 1.4.300**,两者都必须升级并重启服务。
|
|
4
4
|
启动输入条件与保留凭据的策略更新要求 **CLI / 实际运行服务均至少 1.4.301**;协议仍为 1。
|
|
5
|
+
插件原生 ID 的前台 argv 回读及服务重启后的运行中 restore 核验修复要求
|
|
6
|
+
**实际运行服务至少 1.4.302**;建议 CLI 与服务同步安装 1.4.302(CLI 最低仍为 1.4.301)。
|
|
5
7
|
现有 `--session`、消息投递、任务报告与自动协作入口继续兼容;旧的
|
|
6
8
|
`task create --integration` 仍表示代码集成子任务,新身份使用 `--principal`。
|
|
7
9
|
|
|
@@ -79,13 +81,16 @@ CLI 使用当前运行服务的端口,默认 9834。每个端口的身份、
|
|
|
79
81
|
|
|
80
82
|
```json
|
|
81
83
|
"startupInput": {
|
|
82
|
-
"allOf": ["
|
|
84
|
+
"allOf": ["GPT-5.5 (MAX) xhigh", "❯"],
|
|
83
85
|
"noneOf": ["model: loading"],
|
|
84
86
|
"stableMs": 1000,
|
|
85
87
|
"timeoutMs": 120000
|
|
86
88
|
}
|
|
87
89
|
```
|
|
88
90
|
|
|
91
|
+
TraeX 的恢复画面可能仅在 footer 显示模型,没有 `model:` 标题;因此示例不要求
|
|
92
|
+
该前缀。管理员须同时核对冷启动和恢复画面,条件不匹配时保持待投递。
|
|
93
|
+
|
|
89
94
|
`allOf` 的每个字面文本都须出现,`noneOf` 的每个文本都须缺席;区分大小写,
|
|
90
95
|
连续横向空白折叠为一个空格,不使用正则或终端历史。每组最多 16 项,每项
|
|
91
96
|
1–256 字符,禁止控制字符;`allOf` 不能为空。`stableMs` 默认 1000,允许
|
|
@@ -280,6 +285,13 @@ session 事件;get 也会现场核验。120 秒内未形成绑定返回 `SESSI
|
|
|
280
285
|
显式精确恢复可以重建承载终端;这本身不证明 Agent 原生会话恢复成功。新参数/profile
|
|
281
286
|
不能覆盖原启动快照,尚未确定结果的恢复拒绝另一次恢复,防止重复 Agent。
|
|
282
287
|
|
|
288
|
+
1.4.302 起,绑定核验会读取原 pane 的实际前台进程 argv,即使
|
|
289
|
+
`pane_current_command` 已显示具体 Agent 程序名也不省略 argv。插件按已登记的
|
|
290
|
+
`resume.command` 模板回读精确 ID,支持位置参数及独立/内联 ID 标志;不使用
|
|
291
|
+
`--last`、缓存的 UUID 或画面内容替代进程证明。声明模板本身不证明恢复成功。
|
|
292
|
+
服务重启后,原 pane 中精确 UUID 已在运行时 get 应回读 ready,restore 返回原
|
|
293
|
+
operation/pane,不启动第二个 Agent;进程携带不同 UUID 时继续拒绝。
|
|
294
|
+
|
|
283
295
|
常见失败码(每项都是完整字符串):
|
|
284
296
|
|
|
285
297
|
- 配置/权限:`LAUNCH_PROFILE_DENIED`, `LAUNCHER_UNAVAILABLE`, `COLLAB_AGENT_UNAVAILABLE`, `SESSION_CWD_MISSING`, `SESSION_CWD_DENIED`, `INTEGRATION_SESSION_NOT_FOUND`, `INTEGRATION_SESSION_LIMIT`。
|
|
@@ -296,8 +308,11 @@ session 事件;get 也会现场核验。120 秒内未形成绑定返回 `SESSI
|
|
|
296
308
|
维护机未安装 TraeX;已用真实 tmux/终端程序复现加载期间丢弃输入,并验证配置条件
|
|
297
309
|
阻止早投、仅写一次,以及无原生 UUID 时仍可放行;这不冒充真实 TraeX 启动验收。
|
|
298
310
|
使用方已报告 1.4.300 开发机真实 TraeX UUID 捕获与精确恢复通过,原对话记忆、
|
|
299
|
-
原 UUID、TD ID、attempt 和 artifact
|
|
300
|
-
|
|
311
|
+
原 UUID、TD ID、attempt 和 artifact 保持一致。使用方已报告 1.4.301 冷启动首条
|
|
312
|
+
仅写一次并收到明确 complete,超时保持 pending/0 次写入,策略更新保持凭据。
|
|
313
|
+
维护机另外用真实 tmux/native fixture 验证插件 argv 回读、记录重载后运行中恢复
|
|
314
|
+
不重复启动、不同 UUID 拒绝;**1.4.302 的真实 TraeX 服务重启回读/精确恢复
|
|
315
|
+
仍须使用方升级实际运行服务后实机复验**,维护机没有代替完成该项。
|
|
301
316
|
回读 capabilities 后,应核对原 TD ID、真实 TraeX UUID 与原 argv/cwd/包装器快照,
|
|
302
317
|
并验证 Agent 真正加载原对话。
|
|
303
318
|
先完成测试环境的创建→追问→关联答复,再验重复键、追加咨询、断线重投和精确恢复。
|
package/package.json
CHANGED
package/runtime-manifest.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"packageName": "termdock",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.302",
|
|
5
5
|
"runtimeProtocolVersion": 1,
|
|
6
6
|
"minimumDesktopVersion": "1.4.46",
|
|
7
7
|
"nodeMajor": 22,
|
|
8
8
|
"dependencyHash": "sha256-E9GDa4nrCXADRXdyPKufusZt6IcCr4m2mGdx5h34KMQ=",
|
|
9
|
-
"serverBundleHash": "sha256-
|
|
9
|
+
"serverBundleHash": "sha256-rfW/aLzCmUQ9yrcKgstqe1a3KYd/sfH9yKP5jUXWiHk=",
|
|
10
10
|
"clientBundleHash": "sha256-HOoNMOYhnph9XwUhSYE5W2CdI9Vb4g0c64ubW49LnXE=",
|
|
11
11
|
"entrypoint": "dist/server/cli.js",
|
|
12
12
|
"clientEntrypoint": "dist/client/index.html"
|