dsh-mobile-plugin 0.5.125 → 0.5.127
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/README.md +1 -1
- package/config/agent-presets/standard/skills/dsh-mobile-kb/SKILL.md +2 -1
- package/config/agent-presets/standard/skills/dsh-mobile-kb/references/address-appended-port.md +29 -0
- package/config/agent-presets/standard/skills/dsh-mobile-kb/references/frp.md +3 -3
- package/config/agent-presets/standard/skills/dsh-mobile-kb/references/ipv4.md +1 -1
- package/config/agent-presets/standard/skills/dsh-mobile-kb/references/jdxb.md +1 -1
- package/config/agent-presets/standard/skills/dsh-mobile-kb/references/port-conflict.md +3 -3
- package/config/agent-presets/standard/skills/dsh-mobile-kb/references/selfhost-common.md +1 -1
- package/lib/impl.js +1 -0
- package/lib/mirror/pusher.cjs +1 -1
- package/lib/mobile/channel-proxy.js +12 -6
- package/lib/mobile/channels.js +29 -124
- package/lib/mobile/device-profile.js +7 -9
- package/lib/mobile/host-bridge/endpoints.js +1 -7
- package/lib/mobile/monitor.js +6 -1
- package/lib/mobile/push-notify.js +22 -4
- package/lib/mobile/relay-control.js +1 -1
- package/lib/mobile/workspace-id.js +40 -0
- package/lib/panel/index.html +15 -15
- package/lib/relay/config-store.js +3 -3
- package/lib/relay/core.js +2 -2
- package/lib/remote/runtime.cjs +1 -1
- package/lib/remote/store.cjs +87 -39
- package/lib/routes/control-plane.js +1 -1
- package/lib/routes/mobile-api.js +1 -7
- package/lib/tailcat/ingress.cjs +1 -1
- package/package.json +15 -15
- package/lib/mobile/credentials.js +0 -139
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// 2026-11-27:宿主凭据的四个桥接端点随移动端 Key 管理一并撤掉。
|
|
1
2
|
// 手机切换模型只写当前会话,不触发电脑全局默认保存。
|
|
2
3
|
// 本地目录浏览与宿主网关一致,保留路径中的首尾空格。
|
|
3
4
|
// rc.5 子代理 prompt 以 descriptor 识别新 wire,旧宿主继续走 parent/mode 兼容形状。
|
|
@@ -157,13 +158,6 @@ const ENDPOINTS = {
|
|
|
157
158
|
})),
|
|
158
159
|
});
|
|
159
160
|
}),
|
|
160
|
-
'credentials.describe': inv('credentials', 'describe', (p) => ({ refs: p.refs })),
|
|
161
|
-
// 取一次凭据的值:只给「把这条自建渠道交给手机」用(见 mobile/channels.js 的导出路由)。
|
|
162
|
-
// describe 回的是状态、resolve 回的才是值,两者在宿主那边是分开的两个方法。
|
|
163
|
-
'credentials.resolve': inv('credentials', 'resolve', (p) => ({ ref: p.ref })),
|
|
164
|
-
'credentials.set': inv('credentials', 'set', (p) => ({ ref: p.ref, value: p.value })),
|
|
165
|
-
'credentials.unset': inv('credentials', 'unset', (p) => ({ ref: p.ref })),
|
|
166
|
-
|
|
167
161
|
// agentTeams:会话级「启用智能体团队协作」。宿主方法签名是
|
|
168
162
|
// `setEnabled(agentId, enabled, signal)`,只收根会话,写进那份会话日志的一条
|
|
169
163
|
// `team/mode` 事件(见 @deepseek-ai/dsh-agent-team 的 src/index.ts)。参数名与
|
package/lib/mobile/monitor.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// 任务通知监控条目携带精确工作区归属,供本地与 APNs 偏好按层级解析。
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -29,6 +30,7 @@ const { pendingFailedTurns } = require('./recent-failures.js');
|
|
|
29
30
|
const { sessionPreviewFor } = require('./session-preview.js');
|
|
30
31
|
const { archivedSessionIdsForMonitor, pendingInteractionOf, pendingCardOf } = require('./session-flags.js');
|
|
31
32
|
const { withActiveParents } = require('./session-active.js');
|
|
33
|
+
const { workspaceIdOfRows, workspaceRows } = require('./workspace-id.js');
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
36
|
* 一条会话在监控视图里的那几格。
|
|
@@ -42,7 +44,7 @@ const { withActiveParents } = require('./session-active.js');
|
|
|
42
44
|
* 一字不差),只在那几条待处理的条目上带 —— 手机回前台时先问原生要它,就不必等流重新
|
|
43
45
|
* 接上才有卡(见 `session-flags.js` 的 pendingCardOf)。拿不到都不出字段。
|
|
44
46
|
*/
|
|
45
|
-
function monitorItem(summary, state, fact) {
|
|
47
|
+
function monitorItem(summary, state, fact, workspaceId = '') {
|
|
46
48
|
const running = summary.running === true;
|
|
47
49
|
// 完成/失败优先用**上一轮事实**(`session-last-turn`),不再等 `state.completed`。
|
|
48
50
|
//
|
|
@@ -59,6 +61,7 @@ function monitorItem(summary, state, fact) {
|
|
|
59
61
|
: (state ? state.completed === true : false);
|
|
60
62
|
const item = {
|
|
61
63
|
sessionId: summary.sessionId,
|
|
64
|
+
workspaceId: workspaceId || '',
|
|
62
65
|
title: listTitle(summary),
|
|
63
66
|
running,
|
|
64
67
|
completed,
|
|
@@ -171,10 +174,12 @@ async function buildMonitorState(ctx, deviceKey, extraItems = null, scopeSession
|
|
|
171
174
|
}));
|
|
172
175
|
}
|
|
173
176
|
|
|
177
|
+
const workspaceRowsSnapshot = await workspaceRows(ctx);
|
|
174
178
|
const items = live.map((summary) => monitorItem(
|
|
175
179
|
summary,
|
|
176
180
|
states.get(summary.sessionId),
|
|
177
181
|
lastTurnOf(ctx, summary.sessionId),
|
|
182
|
+
workspaceIdOfRows(workspaceRowsSnapshot, summary),
|
|
178
183
|
));
|
|
179
184
|
// 可能要提醒的那几条补一句「这一轮跑出了什么」:只在完成 / 失败 / 待回话的条目上取,
|
|
180
185
|
// 走 sessionPreviewFor 的缓存;常态(全在跑 / 全闲且已读)一条 history 都不读。
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// APNs 事件携带精确工作区归属,总控据每台手机的偏好逐设备过滤。
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -42,6 +43,18 @@ const INTERACTION_TTL_MS = 30_000;
|
|
|
42
43
|
*/
|
|
43
44
|
function createPushNotifier(deps) {
|
|
44
45
|
const controlTarget = typeof deps.controlTarget === 'function' ? deps.controlTarget : () => null;
|
|
46
|
+
const resolveWorkspaceId = typeof deps.workspaceIdOf === 'function'
|
|
47
|
+
? deps.workspaceIdOf
|
|
48
|
+
: async () => '';
|
|
49
|
+
|
|
50
|
+
async function workspaceIdOf(sessionId) {
|
|
51
|
+
try {
|
|
52
|
+
const value = await resolveWorkspaceId({ sessionId });
|
|
53
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
54
|
+
} catch {
|
|
55
|
+
return '';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
45
58
|
|
|
46
59
|
/** 已经发出去的帧:key → { at, approvalId? }。key 是 `${sessionId}:${rpcId}`(卡)或
|
|
47
60
|
* `${sessionId}:${turn}:${status}`(轮次)。同一次收尾会被事件流与列表折叠两条路各观察到
|
|
@@ -129,7 +142,7 @@ function createPushNotifier(deps) {
|
|
|
129
142
|
* 报告一轮收尾。`fact` 是 session-last-turn 的 `lastTurnOf` 形状
|
|
130
143
|
* ({ turn, endedAt, status, ... }),只有 completed / failed 两种值得推。
|
|
131
144
|
*/
|
|
132
|
-
function notifyTurnEnded(sessionId, fact, title) {
|
|
145
|
+
async function notifyTurnEnded(sessionId, fact, title) {
|
|
133
146
|
if (!sessionId || !fact || typeof fact.turn !== 'number') return;
|
|
134
147
|
if (fact.status !== 'completed' && fact.status !== 'failed') return;
|
|
135
148
|
const fingerprint = `${sessionId}:${fact.turn}:${fact.status}`;
|
|
@@ -138,12 +151,14 @@ function createPushNotifier(deps) {
|
|
|
138
151
|
// (没有通知服务扩展),而这个列表在电脑上、读它的手机可能被设成十门语言里的任一门。
|
|
139
152
|
// 所以标题是会话名(用户自己起的),正文只给「成没成」一个符号。
|
|
140
153
|
const body = fact.status === 'failed' ? '✗' : '✓';
|
|
141
|
-
|
|
142
|
-
//
|
|
154
|
+
const workspaceId = await workspaceIdOf(sessionId);
|
|
155
|
+
// 推给这台实例登记过的全部手机:总控按每台手机保存的偏好逐设备过滤。
|
|
143
156
|
void pushFrame(fingerprint, {
|
|
144
157
|
title: title || String(sessionId).slice(0, 8),
|
|
145
158
|
body,
|
|
146
159
|
sessionId,
|
|
160
|
+
workspaceId,
|
|
161
|
+
kind: fact.status === 'failed' ? 'failed' : 'completed',
|
|
147
162
|
}, { kind: fact.status === 'failed' ? 'failed' : 'completed', sessionId });
|
|
148
163
|
}
|
|
149
164
|
|
|
@@ -182,7 +197,7 @@ function createPushNotifier(deps) {
|
|
|
182
197
|
* 前两样是审批卡上的展示信息(事实行 / 那一行高亮),通知栏里得原样带上,否则手机在后台
|
|
183
198
|
* 看到的还是没长事实行的那张卡。`title` 是会话名。
|
|
184
199
|
*/
|
|
185
|
-
function notifyInteraction(sessionId, card, hints = {}) {
|
|
200
|
+
async function notifyInteraction(sessionId, card, hints = {}) {
|
|
186
201
|
if (!sessionId || !card || typeof card !== 'object') return;
|
|
187
202
|
// 第三参早先就是「标题」一个字符串;现在扩成带提示的对象,字符串按标题认。
|
|
188
203
|
const hint = typeof hints === 'string'
|
|
@@ -259,10 +274,13 @@ function createPushNotifier(deps) {
|
|
|
259
274
|
const category = kind === 'approval'
|
|
260
275
|
? 'dsh.approval'
|
|
261
276
|
: (answerable ? 'dsh.question' : 'dsh.pending');
|
|
277
|
+
const workspaceId = await workspaceIdOf(sessionId);
|
|
262
278
|
return pushFrame(fingerprint, {
|
|
263
279
|
title: hint.title || String(sessionId).slice(0, 8),
|
|
264
280
|
body: summary,
|
|
265
281
|
sessionId,
|
|
282
|
+
workspaceId,
|
|
283
|
+
kind: 'pending',
|
|
266
284
|
category,
|
|
267
285
|
interaction,
|
|
268
286
|
}, { kind, sessionId, approvalId }, upgrade);
|
|
@@ -124,7 +124,7 @@ function configView(state) {
|
|
|
124
124
|
relayUrls: relay.relayUrls,
|
|
125
125
|
name: typeof state.name === 'string' ? state.name : '',
|
|
126
126
|
lanEnabled: state.lanEnabled === true,
|
|
127
|
-
lanPort: Number.isInteger(state.lanPort) ? state.lanPort :
|
|
127
|
+
lanPort: Number.isInteger(state.lanPort) ? state.lanPort : 51887,
|
|
128
128
|
lanPortFixed: state.lanPortFixed === true,
|
|
129
129
|
pairingPolicy: pairingApproval.normalize(state.pairingPolicy),
|
|
130
130
|
// 「自动上报网络地址」(总控上报)开关。非 false 一律当开,与宿主 configOf 同一口径。
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// 任务提醒按精确证据解析会话的工作区归属:显式 workspaceId、唯一会话归属、唯一路径。
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
function normalizePath(value) {
|
|
5
|
+
return typeof value === 'string' ? value.trim().replace(/[\\/]+$/, '') : '';
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function workspaceIdOfRows(rows, summary) {
|
|
9
|
+
if (summary && typeof summary.workspaceId === 'string' && summary.workspaceId.trim()) return summary.workspaceId.trim();
|
|
10
|
+
const sessionId = summary && typeof summary.sessionId === 'string' ? summary.sessionId : '';
|
|
11
|
+
const cwd = normalizePath(summary && summary.cwd);
|
|
12
|
+
const items = Array.isArray(rows) ? rows : [];
|
|
13
|
+
const bySession = items.filter((row) => row && Array.isArray(row.sessionIds) && sessionId && row.sessionIds.includes(sessionId));
|
|
14
|
+
if (bySession.length === 1) return typeof bySession[0].workspaceId === 'string' ? bySession[0].workspaceId.trim() : '';
|
|
15
|
+
if (bySession.length > 1) return '';
|
|
16
|
+
if (!cwd) return '';
|
|
17
|
+
const byPath = items.filter((row) => normalizePath(row && (row.path || row.cwd)) === cwd);
|
|
18
|
+
if (byPath.length === 1) return typeof byPath[0].workspaceId === 'string' ? byPath[0].workspaceId.trim() : '';
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function workspaceRows(ctx, signal) {
|
|
23
|
+
const registry = ctx && ctx.get && ctx.get('workspaceRegistry');
|
|
24
|
+
if (registry && typeof registry.list === 'function') {
|
|
25
|
+
try { return registry.list().map((row) => ({ workspaceId: row.id, path: row.path, sessionIds: [...(row.sessionIds || [])] })); } catch { return []; }
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const { workspaceListViaFollow } = require('./host-bridge/shims.js');
|
|
29
|
+
const result = await workspaceListViaFollow(ctx, signal);
|
|
30
|
+
const value = result && result.value;
|
|
31
|
+
return value && Array.isArray(value.items) ? value.items : [];
|
|
32
|
+
} catch { return []; }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function workspaceIdOf(ctx, summary, signal) {
|
|
36
|
+
if (summary && typeof summary.workspaceId === 'string' && summary.workspaceId.trim()) return summary.workspaceId.trim();
|
|
37
|
+
return workspaceIdOfRows(await workspaceRows(ctx, signal), summary);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = { normalizePath, workspaceIdOfRows, workspaceRows, workspaceIdOf };
|