@linxin666/dsh-client-ui-task-board 0.4.18 → 0.4.19

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.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # node scripts/verify-docs.mjs --write <dir>
5
- README.md: 24524734f0ae12aa61494934941b1acbc52ec251
6
- README.zh.md: a556dbb5c33c3b7ada78f9da0007338990aac4b4
5
+ README.md: 0d4ca3e4c68aa190534ef528b7d5091440348d8a
6
+ README.zh.md: 57eda01abdd79a46a29cd8943e3c1a8cceb33011
package/README.md CHANGED
@@ -5,7 +5,7 @@ English | [中文](README.zh.md)
5
5
  <p align="center">
6
6
  <img src="https://img.shields.io/npm/v/@linxin666/dsh-task-board?style=flat-square" alt="Version">
7
7
  &nbsp;
8
- <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.2-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
8
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.3-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
9
9
  &nbsp;
10
10
  <img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
11
11
  </p>
package/README.zh.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <p align="center">
6
6
  <img src="https://img.shields.io/npm/v/@linxin666/dsh-task-board?style=flat-square" alt="Version">
7
7
  &nbsp;
8
- <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.2-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
8
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.3-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
9
9
  &nbsp;
10
10
  <img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
11
11
  </p>
package/lib/client.js CHANGED
@@ -14024,7 +14024,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
14024
14024
  /** The building package's version, when the bundle carries it. */
14025
14025
  function bakedVersion() {
14026
14026
  try {
14027
- return "0.4.18";
14027
+ return "0.4.19";
14028
14028
  } catch {
14029
14029
  return;
14030
14030
  }
package/lib/index.js CHANGED
@@ -9279,7 +9279,12 @@ function matchesToken(candidate, expected) {
9279
9279
  */
9280
9280
  function isTrustedTaskBoardRequest(req, access) {
9281
9281
  const connection = access.connection?.();
9282
- if (connection !== void 0 && connection.requestRejection(req) === void 0) return true;
9282
+ if (connection !== void 0) try {
9283
+ if (typeof connection.admit === "function") {
9284
+ const admission = connection.admit(req);
9285
+ if (admission.rejection === void 0 && "peer" in admission && admission.peer !== void 0) return true;
9286
+ } else if (typeof connection.requestRejection === "function" && connection.requestRejection(req) === void 0) return true;
9287
+ } catch {}
9283
9288
  if (!browserSameOriginMarker(req)) return false;
9284
9289
  if (isLoopbackRequest(req)) return true;
9285
9290
  if (access.trustForwardedProxy() && req.headers["sec-fetch-site"] !== "cross-site" && isForwardedLoopbackRequest(req)) return true;
@@ -9605,7 +9610,10 @@ function makeTaskBoardRoutes(service, access = {}, options = {}) {
9605
9610
  }
9606
9611
  }
9607
9612
  }
9608
- ];
9613
+ ].map((route) => ({
9614
+ ...route,
9615
+ auth: "anonymous"
9616
+ }));
9609
9617
  }
9610
9618
  //#endregion
9611
9619
  //#region src/mount-once.ts
@@ -9888,7 +9896,8 @@ const DEFAULT_TRUST_FORWARDED_PROXY = false;
9888
9896
  function resolveConnectionTrust(ctx) {
9889
9897
  try {
9890
9898
  const connection = ctx.get("connection");
9891
- return connection !== void 0 && typeof connection.requestRejection === "function" ? connection : void 0;
9899
+ if (connection === void 0 || connection === null) return void 0;
9900
+ return typeof connection.admit === "function" || typeof connection.requestRejection === "function" ? connection : void 0;
9892
9901
  } catch {
9893
9902
  return;
9894
9903
  }
@@ -10192,12 +10201,34 @@ function applyImpl(ctx, config) {
10192
10201
  disposeTools = void 0;
10193
10202
  };
10194
10203
  });
10204
+ /**
10205
+ * The connection service captured in a scope that injects BOTH `connection`
10206
+ * and `connection.authentication`. Post-#8266 hosts answer the peer-auth
10207
+ * fence through `connection.admit(request)`, and that method reads
10208
+ * `connection.authentication` through the CALLING context: a bare
10209
+ * `ctx.get('connection')` from this row throws "cannot get property
10210
+ * \"connection.authentication\" without inject", which escaped every route
10211
+ * handler as a bare 400. The scope keeps the row's own inject list unchanged
10212
+ * (the service stays optional: a deployment without it keeps the loopback
10213
+ * fence), and a cohort whose connection has no authentication sub-service
10214
+ * simply never activates this scope, leaving the `requestRejection` bridge.
10215
+ */
10216
+ let admittedConnection;
10217
+ const scopedInjectConnection = ctx.inject;
10218
+ if (typeof scopedInjectConnection === "function") scopedInjectConnection.call(ctx, ["connection", "connection.authentication"], (scoped) => {
10219
+ scoped.effect(() => {
10220
+ admittedConnection = resolveConnectionTrust(scoped);
10221
+ return () => {
10222
+ admittedConnection = void 0;
10223
+ };
10224
+ }, "task-board: connection trust");
10225
+ });
10195
10226
  ctx.effect(() => {
10196
10227
  const disposers = [];
10197
10228
  try {
10198
10229
  const routes = makeTaskBoardRoutes(host, {
10199
10230
  ...resolveProxyAccess(config),
10200
- connection: () => resolveConnectionTrust(ctx)
10231
+ connection: () => admittedConnection ?? resolveConnectionTrust(ctx)
10201
10232
  }, {
10202
10233
  attachments: () => resolveAttachmentStore(ctx),
10203
10234
  parseTask: async (request, signal) => {
@@ -21,9 +21,15 @@ export declare const TASK_BOARD_PROXY_TOKEN_HEADER = "x-dsh-task-board-proxy-tok
21
21
  * import.
22
22
  */
23
23
  export interface TaskBoardConnectionTrust {
24
- requestRejection(request: {
24
+ requestRejection?(request: {
25
25
  readonly headers: IncomingMessage['headers'];
26
26
  }): 401 | 403 | undefined;
27
+ admit?(request: {
28
+ readonly headers: IncomingMessage['headers'];
29
+ }): {
30
+ readonly peer?: unknown;
31
+ readonly rejection?: 401 | 403;
32
+ };
27
33
  }
28
34
  /** Optional authenticated reverse-proxy access layered over the loopback default. */
29
35
  export interface TaskBoardRouteAccess {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linxin666/dsh-client-ui-task-board",
3
3
  "description": "Host-authoritative task board for the DSH Web GUI with real session execution, Host cron scheduling, and optional cross-platform idle-sleep protection; mounted without DSH source changes.",
4
- "version": "0.4.18",
4
+ "version": "0.4.19",
5
5
  "icon": "icon.svg",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dsh": {
24
24
  "engines": {
25
- "dsh": ">=0.2.2-rc.2"
25
+ "dsh": ">=0.2.2-rc.3"
26
26
  },
27
27
  "bundle": {
28
28
  "patch": "./cordis.patch.yml"
@@ -42,7 +42,7 @@
42
42
  }
43
43
  },
44
44
  "peerDependencies": {
45
- "@deepseek-ai/dsh": ">=0.2.2-rc.2",
45
+ "@deepseek-ai/dsh": ">=0.2.2-rc.3",
46
46
  "react": "^18.2.0"
47
47
  },
48
48
  "dependencies": {
@@ -51,29 +51,29 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@deepseek-ai/cordis": "^4.1.0",
54
- "@deepseek-ai/dsh-agent": "^0.2.2-rc.2",
55
- "@deepseek-ai/dsh-agent-preset-registry": "^0.2.2-rc.2",
56
- "@deepseek-ai/dsh-attachment": "^0.2.2-rc.2",
57
- "@deepseek-ai/dsh-api-gateway": "^0.2.2-rc.2",
58
- "@deepseek-ai/dsh-api-remotes": "^0.2.2-rc.2",
59
- "@deepseek-ai/dsh-api-session-controller": "^0.2.2-rc.2",
60
- "@deepseek-ai/dsh-api-workspace-controller": "^0.2.2-rc.2",
61
- "@deepseek-ai/dsh-client-connection": "^0.2.2-rc.2",
62
- "@deepseek-ai/dsh-client-locale": "^0.2.2-rc.2",
63
- "@deepseek-ai/dsh-client-store": "^0.2.2-rc.2",
64
- "@deepseek-ai/dsh-client-ui-layout": "^0.2.2-rc.2",
65
- "@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.2",
66
- "@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.2",
67
- "@deepseek-ai/dsh-client-ui-sidebar": "^0.2.2-rc.2",
68
- "@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.2",
69
- "@deepseek-ai/dsh-client-ui-workspace": "^0.2.2-rc.2",
70
- "@deepseek-ai/dsh-commands": "^0.2.2-rc.2",
71
- "@deepseek-ai/dsh-host-webserver": "^0.2.2-rc.2",
72
- "@deepseek-ai/dsh-llm": "^0.2.2-rc.2",
73
- "@deepseek-ai/dsh-settings": "^0.2.2-rc.2",
74
- "@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.2",
75
- "@deepseek-ai/dsh-tools": "^0.2.2-rc.2",
76
- "@deepseek-ai/dsh-workspace": "^0.2.2-rc.2",
54
+ "@deepseek-ai/dsh-agent": "^0.2.2-rc.3",
55
+ "@deepseek-ai/dsh-agent-preset-registry": "^0.2.2-rc.3",
56
+ "@deepseek-ai/dsh-attachment": "^0.2.2-rc.3",
57
+ "@deepseek-ai/dsh-api-gateway": "^0.2.2-rc.3",
58
+ "@deepseek-ai/dsh-api-remotes": "^0.2.2-rc.3",
59
+ "@deepseek-ai/dsh-api-session-controller": "^0.2.2-rc.3",
60
+ "@deepseek-ai/dsh-api-workspace-controller": "^0.2.2-rc.3",
61
+ "@deepseek-ai/dsh-client-connection": "^0.2.2-rc.3",
62
+ "@deepseek-ai/dsh-client-locale": "^0.2.2-rc.3",
63
+ "@deepseek-ai/dsh-client-store": "^0.2.2-rc.3",
64
+ "@deepseek-ai/dsh-client-ui-layout": "^0.2.2-rc.3",
65
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.3",
66
+ "@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.3",
67
+ "@deepseek-ai/dsh-client-ui-sidebar": "^0.2.2-rc.3",
68
+ "@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.3",
69
+ "@deepseek-ai/dsh-client-ui-workspace": "^0.2.2-rc.3",
70
+ "@deepseek-ai/dsh-commands": "^0.2.2-rc.3",
71
+ "@deepseek-ai/dsh-host-webserver": "^0.2.2-rc.3",
72
+ "@deepseek-ai/dsh-llm": "^0.2.2-rc.3",
73
+ "@deepseek-ai/dsh-settings": "^0.2.2-rc.3",
74
+ "@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.3",
75
+ "@deepseek-ai/dsh-tools": "^0.2.2-rc.3",
76
+ "@deepseek-ai/dsh-workspace": "^0.2.2-rc.3",
77
77
  "@types/node": "^22.20.0",
78
78
  "@types/react": "~18.3.1",
79
79
  "@types/react-dom": "^18.3.5",
@@ -47,7 +47,11 @@ export const TASK_BOARD_PROXY_TOKEN_HEADER = 'x-dsh-task-board-proxy-token'
47
47
  * import.
48
48
  */
49
49
  export interface TaskBoardConnectionTrust {
50
- requestRejection(request: { readonly headers: IncomingMessage['headers'] }): 401 | 403 | undefined
50
+ requestRejection?(request: { readonly headers: IncomingMessage['headers'] }): 401 | 403 | undefined
51
+ admit?(request: { readonly headers: IncomingMessage['headers'] }): {
52
+ readonly peer?: unknown
53
+ readonly rejection?: 401 | 403
54
+ }
51
55
  }
52
56
 
53
57
  /** Optional authenticated reverse-proxy access layered over the loopback default. */
@@ -226,7 +230,25 @@ function matchesToken(candidate: string | string[] | undefined, expected: string
226
230
  */
227
231
  export function isTrustedTaskBoardRequest(req: IncomingMessage, access: ResolvedRouteAccess): boolean {
228
232
  const connection = access.connection?.()
229
- if (connection !== undefined && connection.requestRejection(req) === undefined) return true
233
+ if (connection !== undefined) {
234
+ // The Host connection service is a cross-cohort bridge: the npm 0.2.2-rc.3
235
+ // shape answers `requestRejection`, the post-#8266 shape answers `admit`,
236
+ // and `admit` reaches into `connection.authentication`, which throws when
237
+ // the calling fiber does not inject it. A bridge that cannot answer is not
238
+ // an admission decision: it must keep the fence below instead of escaping
239
+ // as a handler error (the Host answers a throwing handler with a bare 400,
240
+ // which the panel can only render as an unreadable response).
241
+ try {
242
+ if (typeof connection.admit === 'function') {
243
+ const admission = connection.admit(req)
244
+ if (admission.rejection === undefined && 'peer' in admission && admission.peer !== undefined) return true
245
+ } else if (typeof connection.requestRejection === 'function' && connection.requestRejection(req) === undefined) {
246
+ return true
247
+ }
248
+ } catch {
249
+ // Fall through to the pre-existing loopback / proxy fence.
250
+ }
251
+ }
230
252
  if (!browserSameOriginMarker(req)) return false
231
253
  if (isLoopbackRequest(req)) return true
232
254
  // The tunnel makes the socket and the Host describe the proxy, so the
@@ -520,5 +542,10 @@ export function makeTaskBoardRoutes(
520
542
  }
521
543
  },
522
544
  }
523
- return [state, action, events, parse, modelCatalog, attachmentUpload, attachmentImage]
545
+ // Task board routes enforce their own Host/Origin, DSH connection, and
546
+ // paired-device trust fence and must stay reachable when webServer defaults routes to auth: 'required'.
547
+ type AuthAwareWebRoute = WebRoute & { readonly auth?: 'anonymous' | 'required' | 'deny' }
548
+ return [state, action, events, parse, modelCatalog, attachmentUpload, attachmentImage].map(
549
+ (route): AuthAwareWebRoute => ({ ...route, auth: 'anonymous' }),
550
+ )
524
551
  }
package/src/index.ts CHANGED
@@ -310,7 +310,8 @@ export const DEFAULT_TRUST_FORWARDED_PROXY = false
310
310
  export function resolveConnectionTrust(ctx: Context): TaskBoardConnectionTrust | undefined {
311
311
  try {
312
312
  const connection = ctx.get('connection') as Partial<TaskBoardConnectionTrust> | undefined
313
- return connection !== undefined && typeof connection.requestRejection === 'function'
313
+ if (connection === undefined || connection === null) return undefined
314
+ return typeof connection.admit === 'function' || typeof connection.requestRejection === 'function'
314
315
  ? connection as TaskBoardConnectionTrust
315
316
  : undefined
316
317
  } catch {
@@ -713,12 +714,37 @@ function applyImpl(ctx: Context, config?: Config): void {
713
714
  })
714
715
  }
715
716
 
717
+ /**
718
+ * The connection service captured in a scope that injects BOTH `connection`
719
+ * and `connection.authentication`. Post-#8266 hosts answer the peer-auth
720
+ * fence through `connection.admit(request)`, and that method reads
721
+ * `connection.authentication` through the CALLING context: a bare
722
+ * `ctx.get('connection')` from this row throws "cannot get property
723
+ * \"connection.authentication\" without inject", which escaped every route
724
+ * handler as a bare 400. The scope keeps the row's own inject list unchanged
725
+ * (the service stays optional: a deployment without it keeps the loopback
726
+ * fence), and a cohort whose connection has no authentication sub-service
727
+ * simply never activates this scope, leaving the `requestRejection` bridge.
728
+ */
729
+ let admittedConnection: TaskBoardConnectionTrust | undefined
730
+ const scopedInjectConnection = (ctx as { inject?: (names: readonly string[], callback: (scoped: Context) => unknown) => unknown }).inject
731
+ if (typeof scopedInjectConnection === 'function') {
732
+ scopedInjectConnection.call(ctx, ['connection', 'connection.authentication'], (scoped: Context) => {
733
+ scoped.effect(() => {
734
+ admittedConnection = resolveConnectionTrust(scoped)
735
+ return () => {
736
+ admittedConnection = undefined
737
+ }
738
+ }, 'task-board: connection trust')
739
+ })
740
+ }
741
+
716
742
  ctx.effect(() => {
717
743
  const disposers: Array<() => void> = []
718
744
  try {
719
745
  const routes = makeTaskBoardRoutes(host, {
720
746
  ...resolveProxyAccess(config),
721
- connection: () => resolveConnectionTrust(ctx),
747
+ connection: () => admittedConnection ?? resolveConnectionTrust(ctx),
722
748
  }, {
723
749
  attachments: () => resolveAttachmentStore(ctx),
724
750
  parseTask: async (request, signal) => {