dsh-mobile-plugin 0.5.33 → 0.5.35
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 +17 -2
- package/dsh-mobile-credentials/lib/credentials.js +49 -2
- package/extensions/README.md +25 -21
- package/host.js +16 -1
- package/lib/git/pr.js +375 -0
- package/lib/git/read.js +1 -0
- package/lib/host-capabilities.cjs +67 -0
- package/lib/http/routing.js +25 -0
- package/lib/impl.js +34 -26
- package/lib/mirror/history-blob.cjs +184 -0
- package/lib/mirror/pusher.cjs +276 -1
- package/lib/mobile/approval-facts.js +439 -0
- package/lib/mobile/approval-memory.js +199 -0
- package/lib/mobile/approvals.js +596 -30
- package/lib/mobile/auto-review-log.js +160 -0
- package/lib/mobile/auto-review.js +172 -0
- package/lib/mobile/credential-upgrade.js +14 -0
- package/lib/mobile/device-permissions.js +86 -0
- package/lib/mobile/directory-browse.js +23 -8
- package/lib/mobile/events.js +9 -1
- package/lib/mobile/extension-catalog.js +106 -44
- package/lib/mobile/extension-data.js +6 -0
- package/lib/mobile/file-ops.js +89 -76
- package/lib/mobile/git.js +108 -2
- package/lib/mobile/live-steps.js +107 -4
- package/lib/mobile/mail.js +621 -0
- package/lib/mobile/monitor.js +6 -0
- package/lib/mobile/notification-prefs.js +205 -0
- package/lib/mobile/pairing.js +15 -2
- package/lib/mobile/permissions.js +433 -0
- package/lib/mobile/project-write-queue.js +115 -0
- package/lib/mobile/project-writes.js +61 -0
- package/lib/mobile/push-notify.js +293 -13
- package/lib/mobile/questions.js +20 -3
- package/lib/mobile/recent-failures.js +48 -0
- package/lib/mobile/relay-control.js +5 -0
- package/lib/mobile/session-cache.js +50 -0
- package/lib/mobile/session-last-turn.js +24 -22
- package/lib/mobile/session-new.js +205 -0
- package/lib/mobile/session-send.js +0 -1
- package/lib/mobile/sessions.js +12 -84
- package/lib/mobile/skill-write.js +549 -0
- package/lib/mobile/stats-collect.cjs +33 -3
- package/lib/mobile/stats-ledger.cjs +39 -2
- package/lib/mobile/stream.js +24 -3
- package/lib/mobile/supervisor-broadcast.js +58 -11
- package/lib/mobile/supervisor-tools.js +1 -1
- package/lib/mobile/third-party-extensions.js +158 -0
- package/lib/mobile/uploads.js +30 -14
- package/lib/mobile/worktree-isolation.js +479 -0
- package/lib/mobile/worktree-lifecycle.js +79 -0
- package/lib/p2p/wiring.cjs +41 -16
- package/lib/panel/index.html +15 -15
- package/lib/read-receipt.cjs +89 -5
- package/lib/relay/core.js +25 -1
- package/lib/relay/lan-proxy.js +6 -1
- package/lib/relay/preview.js +21 -1
- package/lib/relay/protocol.js +1 -0
- package/lib/relay/status.js +6 -0
- package/lib/relay/tunnel-forwarder.cjs +178 -0
- package/lib/routes/control-plane.js +35 -1
- package/lib/routes/mobile-api.js +105 -52
- package/lib/shared/via-header.js +15 -2
- package/lib/sidecar-facade-worker.cjs +15 -2
- package/lib/sidecar-facade.cjs +5 -0
- package/lib/tailcat/host-process.cjs +1 -1
- package/lib/tailcat/ingress.cjs +2 -2
- package/lib/tailcat/wiring.cjs +34 -13
- package/package.json +11 -3
- package/assets/pets/README.md +0 -9
- package/assets/pets/deepy-whale/attention.gif +0 -0
- package/assets/pets/deepy-whale/done.gif +0 -0
- package/assets/pets/deepy-whale/error.gif +0 -0
- package/assets/pets/deepy-whale/idle.gif +0 -0
- package/assets/pets/deepy-whale/pack.json +0 -54
- package/assets/pets/deepy-whale/sleeping.gif +0 -0
- package/assets/pets/deepy-whale/working-3.gif +0 -0
- package/assets/pets/deepy-whale/working.gif +0 -0
- package/knowledge/apps/alipay.md +0 -30
- package/knowledge/apps/android-settings.md +0 -30
- package/knowledge/apps/baijiahao.md +0 -30
- package/knowledge/apps/bilibili.md +0 -31
- package/knowledge/apps/boss-zhipin.md +0 -32
- package/knowledge/apps/dedao.md +0 -33
- package/knowledge/apps/douyin.md +0 -32
- package/knowledge/apps/feishu.md +0 -35
- package/knowledge/apps/gmail.md +0 -33
- package/knowledge/apps/jike.md +0 -31
- package/knowledge/apps/kuaishou.md +0 -34
- package/knowledge/apps/linkedin.md +0 -33
- package/knowledge/apps/qqmail.md +0 -30
- package/knowledge/apps/taobao.md +0 -33
- package/knowledge/apps/telegram.md +0 -27
- package/knowledge/apps/toutiao.md +0 -32
- package/knowledge/apps/uber-eats.md +0 -26
- package/knowledge/apps/uber.md +0 -27
- package/knowledge/apps/wechat.md +0 -33
- package/knowledge/apps/weibo.md +0 -31
- package/knowledge/apps/whatsapp.md +0 -27
- package/knowledge/apps/x.md +0 -32
- package/knowledge/apps/xiaohongshu.md +0 -30
- package/knowledge/apps/zhihu.md +0 -31
- package/knowledge/sites/bilibili.com/SITE.md +0 -50
- package/knowledge/sites/bilibili.com/references/view-fields.md +0 -17
- package/knowledge/sites/github.com/SITE.md +0 -51
- package/knowledge/sites/github.com/references/repo-fields.md +0 -13
- package/knowledge/sites/x.com/SITE.md +0 -47
- package/knowledge/sites/xiaohongshu.com/SITE.md +0 -48
- package/knowledge/sites/xiaohongshu.com/references/note-fields.md +0 -18
- package/knowledge/sites/youtube.com/SITE.md +0 -49
- package/knowledge/sites/youtube.com/references/innertube-fields.md +0 -14
- package/knowledge/sites/zhihu.com/SITE.md +0 -47
- package/knowledge/sites/zhihu.com/references/api-fields.md +0 -21
- package/lib/mobile/pet-tools.js +0 -261
- package/lib/mobile/pets.js +0 -755
- package/lib/mobile/phone/access.js +0 -85
- package/lib/mobile/phone/binding.js +0 -247
- package/lib/mobile/phone/confirm.js +0 -189
- package/lib/mobile/phone/evidence.js +0 -228
- package/lib/mobile/phone/gate.js +0 -290
- package/lib/mobile/phone/grounding.js +0 -314
- package/lib/mobile/phone/guard.js +0 -465
- package/lib/mobile/phone/index.js +0 -83
- package/lib/mobile/phone/irreversible.js +0 -226
- package/lib/mobile/phone/knowledge-tools.js +0 -665
- package/lib/mobile/phone/learn.js +0 -329
- package/lib/mobile/phone/pacing.js +0 -173
- package/lib/mobile/phone/redact.js +0 -237
- package/lib/mobile/phone/risk.js +0 -95
- package/lib/mobile/phone/route-hint.js +0 -164
- package/lib/mobile/phone/routes-memory.js +0 -133
- package/lib/mobile/phone/routes.js +0 -279
- package/lib/mobile/phone/service.js +0 -500
- package/lib/mobile/phone/site-commands.js +0 -271
- package/lib/mobile/phone/step-summary.js +0 -201
- package/lib/mobile/phone/stop-summary.js +0 -235
- package/lib/mobile/phone/tool-groups.js +0 -125
- package/lib/mobile/phone/tools.js +0 -2282
- package/lib/mobile/phone/untrusted.js +0 -65
- package/lib/mobile/phone-knowledge.js +0 -317
- package/lib/mobile/wechat-tools.js +0 -257
- package/lib/mobile/wechat.js +0 -514
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 通知按事件类型分级:每类可设「响铃 / 静默 / 关闭」。
|
|
5
|
+
*
|
|
6
|
+
* ## 为什么落在宿主侧、还按设备分桶
|
|
7
|
+
*
|
|
8
|
+
* 这张表决定的是「这台手机上,哪一类通知该响、哪一类只挂通知栏、哪一类干脆不发」。
|
|
9
|
+
* 声音与通知栏是手机的机身行为,跟会话无关,也跟电脑无关;同一枚 token 可能配过不止一台
|
|
10
|
+
* 手机(换机、平板 + 手机),各人手里的偏好不该互相覆盖,所以按 `deviceId` 各存一份。
|
|
11
|
+
*
|
|
12
|
+
* 桶键取**可信凭据记录**里的 `deviceId`(`req.__dshRecord.deviceId`),不认请求头:
|
|
13
|
+
* 请求头谁都能写,凭据记录是这一条请求已经查库验过的那一份(见 `lib/http/routing.js`
|
|
14
|
+
* 里 `createGuarded` 把记录挂到 `req` 的写法)。
|
|
15
|
+
*
|
|
16
|
+
* ## 两条边界
|
|
17
|
+
*
|
|
18
|
+
* - **读坏不 404**:文件缺失、读一半、结构不对、缺键,一律逐键并到默认表,绝不 404。
|
|
19
|
+
* 这张表的缺省就是「能用」,把它读成故障等于让通知系统凭空瘫掉。
|
|
20
|
+
* - **写整表替换**:PUT 收的是完整 `events`,逐键 clamp 到三档枚举、未知键丢弃,再原子
|
|
21
|
+
* 落盘(照 `task-ledger.js` 的 mkdir + 临时文件 + rename + 0o600)。写不进去如实回失败。
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const fs = require('node:fs');
|
|
25
|
+
const path = require('node:path');
|
|
26
|
+
|
|
27
|
+
const { dshHome } = require('../shared/paths');
|
|
28
|
+
const { sendJson, readJsonBody } = require('../shared/http-util');
|
|
29
|
+
|
|
30
|
+
/** 存储格式版本:将来改形状时据此决定丢弃还是迁移。 */
|
|
31
|
+
const VERSION = 1;
|
|
32
|
+
|
|
33
|
+
/** 五类事件(三端逐字一致,见共享契约)。 */
|
|
34
|
+
const EVENT_TYPES = Object.freeze(['done', 'failed', 'approval', 'question', 'planReview']);
|
|
35
|
+
|
|
36
|
+
/** 三档级别:响铃(通知 + 声音)/ 静默(通知栏不响)/ 关闭(不通知)。 */
|
|
37
|
+
const LEVELS = Object.freeze(['ring', 'silent', 'off']);
|
|
38
|
+
|
|
39
|
+
/** 缺省档:等你动手才响、完成类静默。 */
|
|
40
|
+
const DEFAULT_EVENT_LEVELS = Object.freeze({
|
|
41
|
+
done: 'silent',
|
|
42
|
+
failed: 'ring',
|
|
43
|
+
approval: 'ring',
|
|
44
|
+
question: 'ring',
|
|
45
|
+
planReview: 'ring',
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
/** 拿不到凭据记录时的兜底桶键:正常请求永远带 `deviceId`,这条只防裸调(测试 / 老调用方)。 */
|
|
49
|
+
const FALLBACK_DEVICE_ID = 'unknown-device';
|
|
50
|
+
|
|
51
|
+
/** 通知偏好文件。路径每次调用时按 `DSH_HOME` 解析,测试可注入。 */
|
|
52
|
+
function prefsFile() {
|
|
53
|
+
return path.join(dshHome(), 'storages', 'mobile-plugin', 'notification-prefs.json');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function isRecord(value) {
|
|
57
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** 请求的桶键:优先可信凭据记录里的 `deviceId`。 */
|
|
61
|
+
function deviceIdOf(req) {
|
|
62
|
+
const record = req && req.__dshRecord;
|
|
63
|
+
if (record && typeof record.deviceId === 'string' && record.deviceId.trim()) {
|
|
64
|
+
return record.deviceId.trim();
|
|
65
|
+
}
|
|
66
|
+
return FALLBACK_DEVICE_ID;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** 一份干净的默认表(每次新对象,调用方改了也不污染常量)。 */
|
|
70
|
+
function defaultEvents() {
|
|
71
|
+
return { ...DEFAULT_EVENT_LEVELS };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** 单键 clamp:枚举内的原样返回,否则 null(调用方据此回退默认)。 */
|
|
75
|
+
function clampLevel(value) {
|
|
76
|
+
return typeof value === 'string' && LEVELS.includes(value) ? value : null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 归一化一张 events 表:**以默认表打底,逐键覆盖**。合法的用值、非法/缺失的用默认、
|
|
81
|
+
* 未知键直接丢。这是「读」与「写」共用的同一套收窄口径。
|
|
82
|
+
*/
|
|
83
|
+
function normalizeEvents(input) {
|
|
84
|
+
const out = defaultEvents();
|
|
85
|
+
if (!isRecord(input)) return out;
|
|
86
|
+
for (const key of EVENT_TYPES) {
|
|
87
|
+
const level = clampLevel(input[key]);
|
|
88
|
+
if (level) out[key] = level;
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** 读整个文件;缺失 / 坏 / 结构不对 → 空的 devices(读坏就当还没有任何偏好)。 */
|
|
94
|
+
function loadStore() {
|
|
95
|
+
let raw;
|
|
96
|
+
try {
|
|
97
|
+
raw = JSON.parse(fs.readFileSync(prefsFile(), 'utf8'));
|
|
98
|
+
} catch {
|
|
99
|
+
return { version: VERSION, updatedAt: 0, devices: {} };
|
|
100
|
+
}
|
|
101
|
+
if (!isRecord(raw)) return { version: VERSION, updatedAt: 0, devices: {} };
|
|
102
|
+
const devices = isRecord(raw.devices) ? raw.devices : {};
|
|
103
|
+
return {
|
|
104
|
+
version: VERSION,
|
|
105
|
+
updatedAt: typeof raw.updatedAt === 'number' ? raw.updatedAt : 0,
|
|
106
|
+
devices,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 读这台设备的偏好。缺文件 / 坏文件 / 缺键都逐键并到默认,不 404。
|
|
112
|
+
* @returns {{ version:number, updatedAt:number, events:object }}
|
|
113
|
+
*/
|
|
114
|
+
function readEvents(deviceId) {
|
|
115
|
+
const store = loadStore();
|
|
116
|
+
const entry = isRecord(store.devices[deviceId]) ? store.devices[deviceId] : null;
|
|
117
|
+
return {
|
|
118
|
+
version: store.version,
|
|
119
|
+
updatedAt: entry && typeof entry.updatedAt === 'number' ? entry.updatedAt : 0,
|
|
120
|
+
events: normalizeEvents(entry ? entry.events : null),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 原子写整份文件(照 task-ledger:mkdir + 临时文件 + rename + 0o600)。
|
|
126
|
+
* 写失败安静返回 false,让调用方如实回 500,不抛。
|
|
127
|
+
*/
|
|
128
|
+
function saveStore(store) {
|
|
129
|
+
const file = prefsFile();
|
|
130
|
+
const next = { ...store, version: VERSION, updatedAt: Date.now() };
|
|
131
|
+
try {
|
|
132
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
133
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
134
|
+
fs.writeFileSync(tmp, `${JSON.stringify(next, null, 2)}\n`, { mode: 0o600 });
|
|
135
|
+
fs.renameSync(tmp, file);
|
|
136
|
+
return true;
|
|
137
|
+
} catch {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* 写这台设备的偏好:整表替换,逐键 clamp、未知键丢弃。
|
|
144
|
+
* @returns {{ ok:boolean, updatedAt:number, events:object }}
|
|
145
|
+
*/
|
|
146
|
+
function writeEvents(deviceId, inputEvents) {
|
|
147
|
+
const events = normalizeEvents(inputEvents);
|
|
148
|
+
const store = loadStore();
|
|
149
|
+
const updatedAt = Date.now();
|
|
150
|
+
const devices = isRecord(store.devices) ? { ...store.devices } : {};
|
|
151
|
+
devices[deviceId] = { updatedAt, events };
|
|
152
|
+
const ok = saveStore({ version: VERSION, updatedAt, devices });
|
|
153
|
+
return { ok, updatedAt, events };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* GET /api/mobile/v1/notification-prefs —— 回 `{ ok, version, updatedAt, events }`。
|
|
158
|
+
* PUT /api/mobile/v1/notification-prefs —— body `{ events }`,整表替换,回 `{ ok, updatedAt, events }`。
|
|
159
|
+
*
|
|
160
|
+
* 两条收在同一路径上由 `req.method` 分派(宿主注册器不按方法分派,与 `/narration` 同一条路)。
|
|
161
|
+
*/
|
|
162
|
+
async function handleNotificationPrefs(_ctx, req, res) {
|
|
163
|
+
const deviceId = deviceIdOf(req);
|
|
164
|
+
|
|
165
|
+
if (req && req.method === 'PUT') {
|
|
166
|
+
const body = await readJsonBody(req);
|
|
167
|
+
if (!body || !isRecord(body.events)) {
|
|
168
|
+
sendJson(res, 400, { ok: false, error: { code: 'bad-request', message: 'events 必须是对象' } });
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const result = writeEvents(deviceId, body.events);
|
|
172
|
+
if (!result.ok) {
|
|
173
|
+
sendJson(res, 500, {
|
|
174
|
+
ok: false,
|
|
175
|
+
error: { code: 'write-failed', message: '通知偏好没写进去' },
|
|
176
|
+
});
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
sendJson(res, 200, { ok: true, updatedAt: result.updatedAt, events: result.events });
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const current = readEvents(deviceId);
|
|
184
|
+
sendJson(res, 200, {
|
|
185
|
+
ok: true,
|
|
186
|
+
version: current.version,
|
|
187
|
+
updatedAt: current.updatedAt,
|
|
188
|
+
events: current.events,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
module.exports = {
|
|
193
|
+
VERSION,
|
|
194
|
+
EVENT_TYPES,
|
|
195
|
+
LEVELS,
|
|
196
|
+
DEFAULT_EVENT_LEVELS,
|
|
197
|
+
defaultEvents,
|
|
198
|
+
clampLevel,
|
|
199
|
+
normalizeEvents,
|
|
200
|
+
deviceIdOf,
|
|
201
|
+
prefsFile,
|
|
202
|
+
readEvents,
|
|
203
|
+
writeEvents,
|
|
204
|
+
handleNotificationPrefs,
|
|
205
|
+
};
|
package/lib/mobile/pairing.js
CHANGED
|
@@ -23,6 +23,9 @@ const { sendJson } = require('../shared/http-util');
|
|
|
23
23
|
const { safeEqual } = require('../shared/dshtoken');
|
|
24
24
|
const { createPairThrottle, PAIR_RATE_NORMAL } = require('../shared/pair-throttle');
|
|
25
25
|
const { openSealedPairRequest, sealPairResponse } = require('../shared/e2ee-pair');
|
|
26
|
+
// 档位 → 权限位(唯一真源)。配对时电脑侧选定的档位落在 state.pairingTier,这里展开成数组
|
|
27
|
+
// 交给凭据库;缺省 full = 与今天单 token 全给一字不差。
|
|
28
|
+
const permissions = require('./permissions.js');
|
|
26
29
|
|
|
27
30
|
/**
|
|
28
31
|
* 一条入口一份闸门(见 `shared/pair-throttle.js` 头部的取舍说明)。
|
|
@@ -112,7 +115,7 @@ function readBody(req) {
|
|
|
112
115
|
* @param {(message: string) => void} deps.log
|
|
113
116
|
*/
|
|
114
117
|
function createPairHandler(deps) {
|
|
115
|
-
const { state, core, credentials, pairingApproval, lanCandidates, ipv6Candidates, lanPort, transferTickets, log } = deps;
|
|
118
|
+
const { state, core, credentials, pairingApproval, lanCandidates, ipv6Candidates, lanPort, transferTickets, log, getHistoryKey } = deps;
|
|
116
119
|
/**
|
|
117
120
|
* 配对成功之后换掉配对码与票据(§5.1)。
|
|
118
121
|
*
|
|
@@ -249,7 +252,10 @@ function createPairHandler(deps) {
|
|
|
249
252
|
|
|
250
253
|
let issued;
|
|
251
254
|
try {
|
|
252
|
-
|
|
255
|
+
// 把电脑侧选定的档位展开成权限位,随凭据一起落库。`issuedExtra` 里本来可能有
|
|
256
|
+
// 协议 v2 的密钥材料(sealed 那条路),这里合并进去,不覆盖。
|
|
257
|
+
const grantedPermissions = permissions.permissionsForTier(state.pairingTier);
|
|
258
|
+
issued = credentials.issue(instanceId, device, '', undefined, { ...(issuedExtra || {}), permissions: grantedPermissions });
|
|
253
259
|
} catch (error) {
|
|
254
260
|
log('pair issue failed:', error && error.message);
|
|
255
261
|
sendJson(res, 500, { ok: false, error: 'internal error' });
|
|
@@ -295,17 +301,24 @@ function createPairHandler(deps) {
|
|
|
295
301
|
const v6Candidates = state.lanEnabled && typeof ipv6Candidates === 'function'
|
|
296
302
|
? ipv6Candidates(port).map((candidate) => candidate.url).filter(Boolean)
|
|
297
303
|
: []
|
|
304
|
+
// 历史 blob 的实例密钥(HK):只在封包(协议 v2)这条路上产生与下发。明文老路没有
|
|
305
|
+
// 消费者,也不该把它露出去。取值器会惰性生成并落盘(见 relay/core.js)。
|
|
306
|
+
const historyKey = isSealedShape && typeof getHistoryKey === 'function' ? (getHistoryKey() || '') : '';
|
|
298
307
|
const payload = {
|
|
299
308
|
ok: true,
|
|
300
309
|
// 协议版本回给手机:它据此把 `MobileSession.proto` 落盘,之后每条请求按它决定发不发
|
|
301
310
|
// 信封。**握手时定死**,不逐请求协商(协商就等于给中转一个降级开关)。
|
|
302
311
|
proto: isSealedShape ? 2 : 1,
|
|
312
|
+
// 手机存进 Keychain,宿主离线时用它解开中转上的密文 blob。
|
|
313
|
+
...(historyKey ? { historyKey } : {}),
|
|
303
314
|
instanceId,
|
|
304
315
|
token,
|
|
305
316
|
// cookie 同时放进 body:RN 的 fetch 读不到 Set-Cookie,App 得自己带上。
|
|
306
317
|
cookie: `dsh_lan=${cookieValue}`,
|
|
307
318
|
deviceId: issued.deviceId,
|
|
308
319
|
deviceCredential: issued.credential,
|
|
320
|
+
// 这台设备被授予的权限位(电脑侧档位展开)。App 落进会话记录,设备页据此显示当前档。
|
|
321
|
+
permissions: Array.isArray(issued.permissions) ? issued.permissions : permissions.permissionsForTier(state.pairingTier),
|
|
309
322
|
credentialExpiresAt: issued.expiresAt,
|
|
310
323
|
// 手机拿它对一次时钟(§8.3(7)):时钟偏太多会被当成重放,而用户完全不知道
|
|
311
324
|
// 「这个 App 连不上」的原因是手机时间不准。
|