dsh-mobile-plugin 0.5.51 → 0.5.53
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 +10 -0
- package/dsh-mobile-credentials/lib/credentials.js +34 -2
- package/lib/client.js +203 -11
- package/lib/impl.js +5 -0
- package/lib/mobile/channels.js +18 -21
- package/lib/mobile/directory-listing.js +3 -1
- package/lib/mobile/events.js +2 -0
- package/lib/mobile/host-bridge/endpoints.js +2 -1
- package/lib/mobile/host-bridge/event-synthesis.js +48 -39
- package/lib/mobile/host-web.js +2 -2
- package/lib/mobile/model-caps.js +15 -5
- package/lib/mobile/model-meta-table.cjs +5 -4
- package/lib/mobile/model-meta.js +5 -3
- package/lib/mobile/permissions.js +1 -3
- package/lib/mobile/stream.js +2 -0
- package/lib/mobile/workspaces.js +6 -5
- package/lib/panel/index.html +15 -15
- package/lib/relay/lan-proxy.js +15 -8
- package/lib/remote/browser-notice.cjs +118 -0
- package/lib/remote/controller.cjs +212 -0
- package/lib/remote/crypto.cjs +197 -0
- package/lib/remote/host-control.cjs +59 -0
- package/lib/remote/host.cjs +226 -0
- package/lib/remote/local-headers.cjs +102 -0
- package/lib/remote/local-upstream.cjs +144 -0
- package/lib/remote/local.cjs +144 -0
- package/lib/remote/network.cjs +42 -0
- package/lib/remote/router.cjs +194 -0
- package/lib/remote/routes.cjs +73 -0
- package/lib/remote/runtime.cjs +36 -0
- package/lib/remote/store.cjs +60 -0
- package/lib/remote/transport.cjs +184 -0
- package/lib/remote/tunnel-helper.cjs +167 -0
- package/lib/remote/tunnels.cjs +190 -0
- package/lib/routes/mobile-api.js +7 -2
- package/lib/shared/route-order.cjs +202 -0
- package/lib/tailcat/session.cjs +31 -36
- package/package.json +7 -6
- package/lib/mobile/perf-trace.js +0 -142
package/lib/mobile/model-meta.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// 公开参数保留宿主支持的全部推理档位。
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -24,8 +25,8 @@
|
|
|
24
25
|
|
|
25
26
|
const { REV, ROWS } = require('./model-meta-table.cjs');
|
|
26
27
|
|
|
27
|
-
/**
|
|
28
|
-
const MODEL_LEVELS = ['low', 'medium', 'high', 'max'];
|
|
28
|
+
/** 与宿主 pi-ai 的可选档位一致,保留 off / minimal / xhigh 的独立含义。 */
|
|
29
|
+
const MODEL_LEVELS = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
29
30
|
|
|
30
31
|
/** 折叠:小写、只留字母与数字。必须与生成脚本的 `foldKey` 逐字一致。 */
|
|
31
32
|
function foldKey(value) {
|
|
@@ -67,8 +68,9 @@ function metaOf(key, row) {
|
|
|
67
68
|
if (typeof row.n === 'string' && row.n !== '') meta.name = row.n;
|
|
68
69
|
if (Number.isInteger(row.c) && row.c > 0) meta.contextWindow = row.c;
|
|
69
70
|
if (Number.isInteger(row.m) && row.m > 0) meta.maxTokens = row.m;
|
|
70
|
-
if (row.i === 1) meta.vision =
|
|
71
|
+
if (row.i === 1 || row.i === 0) meta.vision = row.i === 1;
|
|
71
72
|
if (Array.isArray(row.r)) meta.reasoning = row.r.filter((level) => MODEL_LEVELS.includes(level));
|
|
73
|
+
if (row.w && typeof row.w === 'object') meta.reasoningWires = row.w;
|
|
72
74
|
return meta;
|
|
73
75
|
}
|
|
74
76
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
+
* 操作记录回传接口下线,不再保留对应权限映射。
|
|
4
5
|
* 按设备发放的权限子集:权限位、档位、以及「移动路由 → 所需权限位」的分类表。
|
|
5
6
|
*
|
|
6
7
|
* 这是本次安全边界收紧的**唯一真源**:路由守卫按这里判位,配对档位按这里展开成权限数组,
|
|
@@ -300,9 +301,6 @@ const MAP = Object.freeze({
|
|
|
300
301
|
'/api/mobile/v1/directory/create': V.FILES_WRITE,
|
|
301
302
|
// 把这一轮回答落成文件:带正文写盘,落点与 file/create 同一份允许区,归 files.write。
|
|
302
303
|
'/api/mobile/v1/session/write-body': V.FILES_WRITE,
|
|
303
|
-
// 操作记录回传:本质是往宿主磁盘写文件(`mobile-traces/`),与文件写入同档;以前误挂在
|
|
304
|
-
// BASE 上,等于任何已鉴权设备都能不限量写盘。
|
|
305
|
-
'/api/mobile/v1/perf-trace': V.FILES_WRITE,
|
|
306
304
|
// 项目写入队列的暂停 / 恢复:只切插件自己的队列开关,**一个文件都不写**,所以 POST 也算
|
|
307
305
|
// view(给 files.write 会把只读设备挡在一件它本来就做不了的事之外,没有收益)。
|
|
308
306
|
'/api/mobile/v1/project/writes': { GET: V.VIEW, POST: V.VIEW },
|
package/lib/mobile/stream.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
+
* 响应声明心跳周期,首帧尚未到达也能按约定检测失活。
|
|
4
5
|
* dsh-mobile 流式:SSE 转发目标会话的增量事件。
|
|
5
6
|
*
|
|
6
7
|
* 订阅宿主事件流,只转发目标会话的 session/event 帧,每 15s 发一行注释加一帧
|
|
@@ -420,6 +421,7 @@ async function handleStream(ctx, req, res) {
|
|
|
420
421
|
if (frameBatch) res.__dshFrameBatch = true;
|
|
421
422
|
const head = {
|
|
422
423
|
'content-type': 'text/event-stream; charset=utf-8',
|
|
424
|
+
'x-dsh-heartbeat-ms': String(HEARTBEAT_MS),
|
|
423
425
|
'cache-control': 'no-cache',
|
|
424
426
|
connection: 'keep-alive',
|
|
425
427
|
'x-accel-buffering': 'no',
|
package/lib/mobile/workspaces.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// 浏览、创建和工作区登记透传真实路径,保留目录名称末尾的空格。
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -159,7 +160,7 @@ async function handleWorkspaces(ctx, req, res) {
|
|
|
159
160
|
async function handleListDirectory(ctx, req, res) {
|
|
160
161
|
const url = new URL(req.url, 'http://x');
|
|
161
162
|
const path = url.searchParams.get('path');
|
|
162
|
-
const payload = path && path.trim() ? { path
|
|
163
|
+
const payload = path && path.trim() ? { path } : {};
|
|
163
164
|
const { value, error } = unwrap(await callHost(ctx, 'listDirectory', payload));
|
|
164
165
|
if (error) return sendJson(res, 400, { ok: false, error });
|
|
165
166
|
sendJson(res, 200, { ok: true, listing: value });
|
|
@@ -185,9 +186,9 @@ async function handleDirectoryRoots(_ctx, _req, res) {
|
|
|
185
186
|
*/
|
|
186
187
|
async function handleCreateDirectory(ctx, req, res) {
|
|
187
188
|
const body = await readJsonBody(req, 64 * 1024);
|
|
188
|
-
const path = body && typeof body.path === 'string' ? body.path
|
|
189
|
+
const path = body && typeof body.path === 'string' ? body.path : '';
|
|
189
190
|
const name = body && typeof body.name === 'string' ? body.name.trim() : '';
|
|
190
|
-
if (!path || !name) return sendJson(res, 400, { ok: false, error: { code: 'bad-request', message: '缺少 path 或 name' } });
|
|
191
|
+
if (!path.trim() || !name) return sendJson(res, 400, { ok: false, error: { code: 'bad-request', message: '缺少 path 或 name' } });
|
|
191
192
|
const { value, error } = unwrap(await callHost(ctx, 'createDirectory', { path, name }));
|
|
192
193
|
if (error) return sendJson(res, 400, { ok: false, error });
|
|
193
194
|
sendJson(res, 200, { ok: true, path: value && value.path });
|
|
@@ -200,8 +201,8 @@ async function handleCreateDirectory(ctx, req, res) {
|
|
|
200
201
|
*/
|
|
201
202
|
async function handleCreateWorkspace(ctx, req, res) {
|
|
202
203
|
const body = await readJsonBody(req, 64 * 1024);
|
|
203
|
-
const path = body && typeof body.path === 'string' ? body.path
|
|
204
|
-
if (!path) return sendJson(res, 400, { ok: false, error: { code: 'bad-request', message: '缺少 path' } });
|
|
204
|
+
const path = body && typeof body.path === 'string' ? body.path : '';
|
|
205
|
+
if (!path.trim()) return sendJson(res, 400, { ok: false, error: { code: 'bad-request', message: '缺少 path' } });
|
|
205
206
|
const { value, error } = unwrap(await callWorkspace(ctx, 'create', { path }));
|
|
206
207
|
if (error) return sendJson(res, 400, { ok: false, error });
|
|
207
208
|
sendJson(res, 200, { ok: true, workspace: value && value.workspace, created: !!(value && value.created) });
|