dsh-deeppilot 0.8.3 → 0.9.1
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/COMPATIBILITY.md +81 -4
- package/README.md +30 -19
- package/README.zh-CN.md +21 -14
- package/docs/DSH_RELEASE_MEMORY.md +239 -1
- package/lib/client.js +71 -3
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +15 -4
- package/lib/index.js +40 -15
- package/lib/index.js.map +1 -1
- package/package.json +17 -16
package/lib/index.d.ts
CHANGED
|
@@ -862,8 +862,11 @@ interface Config {
|
|
|
862
862
|
devicesPath?: string;
|
|
863
863
|
/** Replay ring buffer bound (frames) per deployment. */
|
|
864
864
|
historyBufferMax?: number;
|
|
865
|
-
/**
|
|
866
|
-
|
|
865
|
+
/** Testing & troubleshooting, rendered as its own settings section. */
|
|
866
|
+
diagnostics?: {
|
|
867
|
+
/** Verbose per-frame diagnostics (never prints token or message bodies). */
|
|
868
|
+
debug?: boolean;
|
|
869
|
+
};
|
|
867
870
|
/** Independent LAN transport. Never exposes the wider DSH web server. */
|
|
868
871
|
local?: {
|
|
869
872
|
enabled?: boolean;
|
|
@@ -909,7 +912,11 @@ declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
909
912
|
enabled: z<boolean, boolean, "volatile-defined">;
|
|
910
913
|
devicesPath: z<string, string, "defined">;
|
|
911
914
|
historyBufferMax: z<number, number, "defined">;
|
|
912
|
-
|
|
915
|
+
diagnostics: z<NoInfer<Schemastery.ObjectS<NoInfer<{
|
|
916
|
+
debug: z<boolean, boolean, "defined">;
|
|
917
|
+
}>>>, NoInfer<Schemastery.ObjectT<NoInfer<{
|
|
918
|
+
debug: z<boolean, boolean, "defined">;
|
|
919
|
+
}>>>, "volatile-defined">;
|
|
913
920
|
local: z<NoInfer<Schemastery.ObjectS<NoInfer<{
|
|
914
921
|
enabled: z<boolean, boolean, "defined">;
|
|
915
922
|
port: z<number, number, "defined">;
|
|
@@ -957,7 +964,11 @@ declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
957
964
|
enabled: z<boolean, boolean, "volatile-defined">;
|
|
958
965
|
devicesPath: z<string, string, "defined">;
|
|
959
966
|
historyBufferMax: z<number, number, "defined">;
|
|
960
|
-
|
|
967
|
+
diagnostics: z<NoInfer<Schemastery.ObjectS<NoInfer<{
|
|
968
|
+
debug: z<boolean, boolean, "defined">;
|
|
969
|
+
}>>>, NoInfer<Schemastery.ObjectT<NoInfer<{
|
|
970
|
+
debug: z<boolean, boolean, "defined">;
|
|
971
|
+
}>>>, "volatile-defined">;
|
|
961
972
|
local: z<NoInfer<Schemastery.ObjectS<NoInfer<{
|
|
962
973
|
enabled: z<boolean, boolean, "defined">;
|
|
963
974
|
port: z<number, number, "defined">;
|
package/lib/index.js
CHANGED
|
@@ -1491,9 +1491,15 @@ var BridgeConnection = class {
|
|
|
1491
1491
|
* Subagent sessions are host-internal workers of a parent conversation.
|
|
1492
1492
|
* They must never surface on the phone: not in the project/session list,
|
|
1493
1493
|
* and not as turn-completion pushes for a session the device cannot open.
|
|
1494
|
+
*
|
|
1495
|
+
* `parentSessionId` alone is NOT a subagent signal: a session forked from
|
|
1496
|
+
* another one (c2s.session.fork) also carries it, as fork lineage, while
|
|
1497
|
+
* being an ordinary top-level session the phone must show. Only the host's
|
|
1498
|
+
* explicit `origin` marks a worker — mirror the same rule already used for
|
|
1499
|
+
* the live mux stream (see dsh-api-proxy.ts's `isSubagent` derivation).
|
|
1494
1500
|
*/
|
|
1495
1501
|
function isSubagentRow(row) {
|
|
1496
|
-
return row.origin === "subagent"
|
|
1502
|
+
return row.origin === "subagent";
|
|
1497
1503
|
}
|
|
1498
1504
|
function unwrapStreamItem(item) {
|
|
1499
1505
|
const nested = item.payload;
|
|
@@ -4142,27 +4148,48 @@ var DshApiProxy = class {
|
|
|
4142
4148
|
session;
|
|
4143
4149
|
workspaceController;
|
|
4144
4150
|
scheduleController;
|
|
4151
|
+
scheduleApi;
|
|
4145
4152
|
directoryPicker;
|
|
4146
4153
|
interactions = /* @__PURE__ */ new Map();
|
|
4147
4154
|
shouldSurfaceInteraction;
|
|
4148
|
-
scheduleApi;
|
|
4149
4155
|
constructor(ctx, options = {}) {
|
|
4150
4156
|
this.ctx = ctx;
|
|
4151
4157
|
const session = ctx.get("sessionController");
|
|
4152
4158
|
if (session === void 0) throw new Error("DSH sessionController is unavailable");
|
|
4153
4159
|
this.session = session;
|
|
4154
4160
|
this.workspaceController = ctx.get("workspaceController");
|
|
4155
|
-
this.scheduleController = ctx.get("schedule");
|
|
4156
4161
|
if (this.workspaceController === void 0) delete this.workspace?.unarchiveSession;
|
|
4157
4162
|
this.directoryPicker = ctx.get("directoryPickerController");
|
|
4158
4163
|
this.shouldSurfaceInteraction = options.shouldSurfaceInteraction ?? (() => true);
|
|
4159
|
-
this.
|
|
4164
|
+
this.resolveSchedule();
|
|
4165
|
+
}
|
|
4166
|
+
/**
|
|
4167
|
+
* Resolve the optional Schedule service lazily, on every read.
|
|
4168
|
+
*
|
|
4169
|
+
* The bridge is built from a `ctx.inject` on sessionController / connection
|
|
4170
|
+
* / typertGateway, and `schedule` is deliberately NOT in that list: it only
|
|
4171
|
+
* exists when the user enables the optional Automation tasks bundle. On a
|
|
4172
|
+
* DSH 0.2.0 host those three services become ready well before
|
|
4173
|
+
* ScheduleService finishes its own async init, so a value captured here in
|
|
4174
|
+
* the constructor stayed `undefined` for the bridge's whole lifetime and
|
|
4175
|
+
* welcome advertised `schedules=false` even with the bundle mounted.
|
|
4176
|
+
*
|
|
4177
|
+
* Once resolved the controller is kept: services are not torn down and
|
|
4178
|
+
* rebuilt underneath a live bridge, so re-resolving per call would be pure
|
|
4179
|
+
* overhead.
|
|
4180
|
+
*/
|
|
4181
|
+
resolveSchedule() {
|
|
4182
|
+
if (this.scheduleController !== void 0) return;
|
|
4183
|
+
const controller = this.ctx.get("schedule");
|
|
4184
|
+
if (controller === void 0) return;
|
|
4185
|
+
this.scheduleController = controller;
|
|
4186
|
+
this.scheduleApi = this.createScheduleApi(controller);
|
|
4160
4187
|
}
|
|
4161
4188
|
get schedule() {
|
|
4189
|
+
this.resolveSchedule();
|
|
4162
4190
|
return this.scheduleApi;
|
|
4163
4191
|
}
|
|
4164
|
-
createScheduleApi() {
|
|
4165
|
-
const controller = this.scheduleController;
|
|
4192
|
+
createScheduleApi(controller) {
|
|
4166
4193
|
return {
|
|
4167
4194
|
list: async (request) => this.call(async () => ({
|
|
4168
4195
|
sessionId: request.payload.sessionId,
|
|
@@ -4875,7 +4902,6 @@ function parseReport(value) {
|
|
|
4875
4902
|
pairingReady: bool(s, "pairingReady", "pairingReady"),
|
|
4876
4903
|
activeConnections: int(s, "activeConnections", "activeConnections"),
|
|
4877
4904
|
historyBufferMax: int(s, "historyBufferMax", "historyBufferMax"),
|
|
4878
|
-
debug: bool(s, "debug", "debug"),
|
|
4879
4905
|
lanAddresses,
|
|
4880
4906
|
local: parseLocal(s.local),
|
|
4881
4907
|
remote: parseRemote(s.remote),
|
|
@@ -6176,7 +6202,7 @@ const Config = z.object({
|
|
|
6176
6202
|
enabled: z.boolean().default(true).volatile(),
|
|
6177
6203
|
devicesPath: z.string().default(join(bridgeDataDir(), "devices-v2.json")),
|
|
6178
6204
|
historyBufferMax: z.natural().min(100).default(2e3),
|
|
6179
|
-
debug: z.boolean().default(false).volatile(),
|
|
6205
|
+
diagnostics: z.object({ debug: z.boolean().default(false).description("打印握手、推送等诊断日志;不会打印配对令牌、APNs token 或消息内容") }).default({ debug: false }).volatile(),
|
|
6180
6206
|
local: z.object({
|
|
6181
6207
|
enabled: z.boolean().default(true),
|
|
6182
6208
|
port: z.natural().min(MIN_LOCAL_PORT).max(MAX_LOCAL_PORT).default(DEFAULT_LOCAL_PORT).description("DeepPilot 局域网独立端口(仅 TLS;默认 3098,修改后本地连接会短暂重连)")
|
|
@@ -7090,7 +7116,7 @@ function apply(ctx, options) {
|
|
|
7090
7116
|
}
|
|
7091
7117
|
const token = await new RelayClient({
|
|
7092
7118
|
url,
|
|
7093
|
-
debug: currentConfig().debug === true,
|
|
7119
|
+
debug: currentConfig().diagnostics?.debug === true,
|
|
7094
7120
|
log
|
|
7095
7121
|
}).enroll(enrollmentCell.clientId, enrollmentCell.enrollKey ?? "");
|
|
7096
7122
|
if (!token) {
|
|
@@ -7132,7 +7158,7 @@ function apply(ctx, options) {
|
|
|
7132
7158
|
const client = new RelayClient({
|
|
7133
7159
|
url: resolved.url,
|
|
7134
7160
|
token: resolved.token,
|
|
7135
|
-
debug: currentConfig().debug === true,
|
|
7161
|
+
debug: currentConfig().diagnostics?.debug === true,
|
|
7136
7162
|
log
|
|
7137
7163
|
});
|
|
7138
7164
|
cachedSender = {
|
|
@@ -7156,7 +7182,7 @@ function apply(ctx, options) {
|
|
|
7156
7182
|
keyId: resolved.keyId,
|
|
7157
7183
|
keyPath: resolved.keyPath,
|
|
7158
7184
|
bundleId: resolved.bundleId,
|
|
7159
|
-
debug: currentConfig().debug === true,
|
|
7185
|
+
debug: currentConfig().diagnostics?.debug === true,
|
|
7160
7186
|
log
|
|
7161
7187
|
});
|
|
7162
7188
|
cachedSender = {
|
|
@@ -7273,11 +7299,11 @@ function apply(ctx, options) {
|
|
|
7273
7299
|
if (!registration) return false;
|
|
7274
7300
|
if (connectedIds.has(device.deviceId)) return false;
|
|
7275
7301
|
if (!mayReceivePush(device, notification)) {
|
|
7276
|
-
if (currentConfig().debug === true) log(`push skip "${deviceDisplayName(device)}": notification permission not granted`);
|
|
7302
|
+
if (currentConfig().diagnostics?.debug === true) log(`push skip "${deviceDisplayName(device)}": notification permission not granted`);
|
|
7277
7303
|
return false;
|
|
7278
7304
|
}
|
|
7279
7305
|
if (registration.categories?.[notification.category] === false) {
|
|
7280
|
-
if (currentConfig().debug === true) log(`push skip "${deviceDisplayName(device)}": category ${notification.category} muted`);
|
|
7306
|
+
if (currentConfig().diagnostics?.debug === true) log(`push skip "${deviceDisplayName(device)}": category ${notification.category} muted`);
|
|
7281
7307
|
return false;
|
|
7282
7308
|
}
|
|
7283
7309
|
return true;
|
|
@@ -7401,7 +7427,6 @@ function apply(ctx, options) {
|
|
|
7401
7427
|
pairingReady,
|
|
7402
7428
|
activeConnections: connections.size,
|
|
7403
7429
|
historyBufferMax: currentConfig().historyBufferMax ?? 2e3,
|
|
7404
|
-
debug: currentConfig().debug === true,
|
|
7405
7430
|
lanAddresses,
|
|
7406
7431
|
local: localStatus(lanAddresses),
|
|
7407
7432
|
remote: remoteStatus(),
|
|
@@ -7614,7 +7639,7 @@ function apply(ctx, options) {
|
|
|
7614
7639
|
serverVersion: SERVER_VERSION,
|
|
7615
7640
|
audience,
|
|
7616
7641
|
log,
|
|
7617
|
-
debug: currentConfig().debug === true,
|
|
7642
|
+
debug: currentConfig().diagnostics?.debug === true,
|
|
7618
7643
|
onClosed: (closed) => connections.delete(closed),
|
|
7619
7644
|
onAuthenticationSettled: (ok) => {
|
|
7620
7645
|
admission.release();
|