@linxin666/dsh-client-ui-task-board 0.4.17 → 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 +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +7 -7
- package/lib/client.js.map +1 -1
- package/lib/index.js +44 -13
- package/lib/types/client/settings-entry-form.d.ts +1 -1
- package/lib/types/host-routes.d.ts +7 -1
- package/package.json +26 -26
- package/src/client/TaskBoardSettingsCard.tsx +0 -1
- package/src/client/board/TaskBoard.tsx +2 -2
- package/src/client/index.ts +1 -1
- package/src/client/settings-entry-form.ts +1 -1
- package/src/core/attachment.ts +1 -0
- package/src/core/freeze-snapshot.ts +3 -3
- package/src/host/extension-registry.ts +2 -2
- package/src/host-ledger.ts +2 -3
- package/src/host-routes.ts +30 -3
- package/src/host-runner.ts +1 -1
- package/src/index.ts +28 -2
- package/src/protocol.ts +1 -1
package/lib/index.js
CHANGED
|
@@ -1639,7 +1639,7 @@ const SECTION_NAMES = {
|
|
|
1639
1639
|
*/
|
|
1640
1640
|
const SENSITIVE_PATTERNS = [
|
|
1641
1641
|
/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,
|
|
1642
|
-
/Bearer\s+[A-Za-z0-9._
|
|
1642
|
+
/Bearer\s+[A-Za-z0-9._~+/=:-]{8,}/gi,
|
|
1643
1643
|
/sk-[A-Za-z0-9_-]{8,}/g,
|
|
1644
1644
|
/ghp_[A-Za-z0-9]{20,}/g,
|
|
1645
1645
|
/glpat-[A-Za-z0-9_-]{15,}/g,
|
|
@@ -1693,13 +1693,13 @@ function sanitizeFreezeSnapshot(value, extraKeys = []) {
|
|
|
1693
1693
|
});
|
|
1694
1694
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return bad("invalid-freeze", "冻结快照必须是 goal/progress/next 字符串对象");
|
|
1695
1695
|
const record = value;
|
|
1696
|
-
const allowed = [
|
|
1696
|
+
const allowed = /* @__PURE__ */ new Set([
|
|
1697
1697
|
"goal",
|
|
1698
1698
|
"progress",
|
|
1699
1699
|
"next",
|
|
1700
1700
|
...extraKeys
|
|
1701
|
-
];
|
|
1702
|
-
if (!Object.keys(record).every((key) => allowed.
|
|
1701
|
+
]);
|
|
1702
|
+
if (!Object.keys(record).every((key) => allowed.has(key))) return bad("invalid-freeze", "冻结快照包含未知字段");
|
|
1703
1703
|
for (const key of SECTION_ORDER$1) if (typeof record[key] !== "string") return bad("invalid-freeze", "冻结快照字段 " + SECTION_NAMES[key] + " 必须是字符串");
|
|
1704
1704
|
for (const key of SECTION_ORDER$1) if (hasSlashCommandLines(record[key])) return bad("dsh-command-line", "冻结文本的" + SECTION_NAMES[key] + "包含以 / 开头的命令行,整体拒绝");
|
|
1705
1705
|
let redacted = false;
|
|
@@ -4670,7 +4670,7 @@ var HostTaskLedger = class {
|
|
|
4670
4670
|
if (typeof parsed.schemaVersion === "number" && TASK_BOARD_MIGRATABLE_SCHEMA_VERSIONS.includes(parsed.schemaVersion)) try {
|
|
4671
4671
|
return this.migrateLegacyDocument(parsed);
|
|
4672
4672
|
} catch (error) {
|
|
4673
|
-
throw new Error(`ledger v${String(parsed.schemaVersion)} to v7 migration failed; original file kept at ${this.file}: ${error instanceof Error ? error.message : String(error)}
|
|
4673
|
+
throw new Error(`ledger v${String(parsed.schemaVersion)} to v7 migration failed; original file kept at ${this.file}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
4674
4674
|
}
|
|
4675
4675
|
try {
|
|
4676
4676
|
if (parsed.schemaVersion !== 7 || !Array.isArray(parsed.tasks)) throw new Error("unsupported ledger schema");
|
|
@@ -4866,7 +4866,7 @@ var HostTaskLedger = class {
|
|
|
4866
4866
|
}
|
|
4867
4867
|
})()))) {
|
|
4868
4868
|
const hint = ownerStartedAt !== void 0 && actualStartedAt !== void 0 && !startTimeMismatch(ownerStartedAt, actualStartedAt, ownerExact) ? "" : `; if this PID was reused after a crash and no other DSH host is running, remove ${this.lockFile} manually and retry`;
|
|
4869
|
-
throw new Error(`task-board ledger is already owned by process ${pid}${hint}
|
|
4869
|
+
throw new Error(`task-board ledger is already owned by process ${pid}${hint}`, { cause: error });
|
|
4870
4870
|
}
|
|
4871
4871
|
}
|
|
4872
4872
|
try {
|
|
@@ -5864,7 +5864,7 @@ var HostExecutionRunner = class HostExecutionRunner {
|
|
|
5864
5864
|
...decision.effort === void 0 ? {} : { reasoningEffort: decision.effort }
|
|
5865
5865
|
});
|
|
5866
5866
|
} catch (modelError) {
|
|
5867
|
-
if (decision.effort !== void 0) throw new Error(`session ${sessionId} refused the model selection "${provider === void 0 ? modelId : provider + "/" + modelId}" with reasoning effort "${decision.effort}": ` + (modelError instanceof Error ? modelError.message : String(modelError)));
|
|
5867
|
+
if (decision.effort !== void 0) throw new Error(`session ${sessionId} refused the model selection "${provider === void 0 ? modelId : provider + "/" + modelId}" with reasoning effort "${decision.effort}": ` + (modelError instanceof Error ? modelError.message : String(modelError)), { cause: modelError });
|
|
5868
5868
|
console.warn(`[dsh-task-board] failed to select model "${provider === void 0 ? modelId : provider + "/" + modelId}" for session ${sessionId}, falling back to default:`, modelError);
|
|
5869
5869
|
}
|
|
5870
5870
|
}
|
|
@@ -6500,7 +6500,7 @@ function emptySubscriptions() {
|
|
|
6500
6500
|
* undefined so a provider can remove a field without replacing the entry.
|
|
6501
6501
|
*/
|
|
6502
6502
|
function mergePayload(current, patch) {
|
|
6503
|
-
const next = { ...current
|
|
6503
|
+
const next = { ...current };
|
|
6504
6504
|
for (const [key, value] of Object.entries(patch)) if (value === void 0) delete next[key];
|
|
6505
6505
|
else next[key] = value;
|
|
6506
6506
|
return next;
|
|
@@ -6926,7 +6926,7 @@ var TaskBoardExtensionRegistry = class {
|
|
|
6926
6926
|
...task,
|
|
6927
6927
|
updatedAt: this.now(),
|
|
6928
6928
|
integrations: {
|
|
6929
|
-
...task.integrations
|
|
6929
|
+
...task.integrations,
|
|
6930
6930
|
[id]: next
|
|
6931
6931
|
}
|
|
6932
6932
|
});
|
|
@@ -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
|
|
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
|
-
|
|
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) => {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*/
|
|
29
29
|
import type { ConfigForm, ConfigForms } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
30
30
|
/** Options of {@link createServedEntryForm}. */
|
|
31
|
-
export interface ServedEntryFormOptions<
|
|
31
|
+
export interface ServedEntryFormOptions<_T> {
|
|
32
32
|
/** The shared configuration forms service (`ctx.configForms`). */
|
|
33
33
|
forms: ConfigForms;
|
|
34
34
|
/**
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
55
|
-
"@deepseek-ai/dsh-agent-preset-registry": "^0.2.2-rc.
|
|
56
|
-
"@deepseek-ai/dsh-attachment": "^0.2.2-rc.
|
|
57
|
-
"@deepseek-ai/dsh-api-gateway": "^0.2.2-rc.
|
|
58
|
-
"@deepseek-ai/dsh-api-remotes": "^0.2.2-rc.
|
|
59
|
-
"@deepseek-ai/dsh-api-session-controller": "^0.2.2-rc.
|
|
60
|
-
"@deepseek-ai/dsh-api-workspace-controller": "^0.2.2-rc.
|
|
61
|
-
"@deepseek-ai/dsh-client-connection": "^0.2.2-rc.
|
|
62
|
-
"@deepseek-ai/dsh-client-locale": "^0.2.2-rc.
|
|
63
|
-
"@deepseek-ai/dsh-client-store": "^0.2.2-rc.
|
|
64
|
-
"@deepseek-ai/dsh-client-ui-layout": "^0.2.2-rc.
|
|
65
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.
|
|
66
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.
|
|
67
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "^0.2.2-rc.
|
|
68
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.
|
|
69
|
-
"@deepseek-ai/dsh-client-ui-workspace": "^0.2.2-rc.
|
|
70
|
-
"@deepseek-ai/dsh-commands": "^0.2.2-rc.
|
|
71
|
-
"@deepseek-ai/dsh-host-webserver": "^0.2.2-rc.
|
|
72
|
-
"@deepseek-ai/dsh-llm": "^0.2.2-rc.
|
|
73
|
-
"@deepseek-ai/dsh-settings": "^0.2.2-rc.
|
|
74
|
-
"@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.
|
|
75
|
-
"@deepseek-ai/dsh-tools": "^0.2.2-rc.
|
|
76
|
-
"@deepseek-ai/dsh-workspace": "^0.2.2-rc.
|
|
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",
|
|
@@ -17,7 +17,6 @@ import { CardDefaultPresetField } from './CardDefaultPresetField.tsx'
|
|
|
17
17
|
import { PluginSettingsCard, BooleanField, ChoiceField, ValueField } from './PluginSettingsCard.tsx'
|
|
18
18
|
import {
|
|
19
19
|
modelChoiceRows,
|
|
20
|
-
modelDisplayLabel,
|
|
21
20
|
modelOptionsFromCatalog,
|
|
22
21
|
reasoningEffortsFor,
|
|
23
22
|
reasoningHintKey,
|
|
@@ -116,7 +116,7 @@ const MemoTaskCard = memo(function MemoTaskCard({ task, pending, timeZone, onOpe
|
|
|
116
116
|
})
|
|
117
117
|
|
|
118
118
|
/** Settled columns whose cards group by recency and fold the oldest group. */
|
|
119
|
-
const GROUPED_COLUMNS:
|
|
119
|
+
const GROUPED_COLUMNS: ReadonlySet<TaskStatus> = new Set(['done', 'failed'])
|
|
120
120
|
|
|
121
121
|
/** Cards a grouped column renders before the oldest group folds. */
|
|
122
122
|
export const COLUMN_FOLD_THRESHOLD = 30
|
|
@@ -289,7 +289,7 @@ export function TaskBoard({ controller }: { controller: BoardController }) {
|
|
|
289
289
|
|
|
290
290
|
/** Every column and the archive first split by provider-owned source. */
|
|
291
291
|
const renderSourceGroups = (view: SourceGroupView, tasks: TaskRecord[], compact: boolean, archived: boolean) => {
|
|
292
|
-
const recency = archived || GROUPED_COLUMNS.
|
|
292
|
+
const recency = archived || GROUPED_COLUMNS.has(view as TaskStatus)
|
|
293
293
|
return groupTasksBySource(tasks, snapshot.grouping ?? []).map(bucket => {
|
|
294
294
|
const foldKey = sourceGroupFoldKey(view, bucket.id)
|
|
295
295
|
const folded = isSourceGroupFolded(sourceFolds, view, bucket.id, searchActive)
|
package/src/client/index.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* plugin must not take the GUI down.
|
|
10
10
|
*/
|
|
11
11
|
import type { Context as ClientContext } from '@deepseek-ai/cordis'
|
|
12
|
-
import type { ClientRemote
|
|
12
|
+
import type { ClientRemote } from '@deepseek-ai/dsh-api-remotes/client'
|
|
13
13
|
import type { ISessions } from '@deepseek-ai/dsh-api-session-controller/client'
|
|
14
14
|
import type { IWorkspaces } from '@deepseek-ai/dsh-api-workspace-controller/client'
|
|
15
15
|
import type { ConfigForm, ConfigForms } from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
import type { ConfigForm, ConfigFormSnapshot, ConfigForms } from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
32
32
|
|
|
33
33
|
/** Options of {@link createServedEntryForm}. */
|
|
34
|
-
export interface ServedEntryFormOptions<
|
|
34
|
+
export interface ServedEntryFormOptions<_T> {
|
|
35
35
|
/** The shared configuration forms service (`ctx.configForms`). */
|
|
36
36
|
forms: ConfigForms
|
|
37
37
|
/**
|
package/src/core/attachment.ts
CHANGED
|
@@ -97,6 +97,7 @@ export function canonicalAttachmentName(value: unknown): string {
|
|
|
97
97
|
const raw = typeof value === 'string' ? value : ''
|
|
98
98
|
const leaf = raw.split(/[\\/]/).pop() ?? ''
|
|
99
99
|
const cleaned = leaf
|
|
100
|
+
// oxlint-disable-next-line no-control-regex -- folding control characters into spaces IS the normalization.
|
|
100
101
|
.replace(/[\u0000-\u001f\u007f]/g, ' ')
|
|
101
102
|
.replace(/\s+/g, ' ')
|
|
102
103
|
.trim()
|
|
@@ -53,7 +53,7 @@ const SECTION_NAMES: Record<SectionKey, string> = {
|
|
|
53
53
|
*/
|
|
54
54
|
const SENSITIVE_PATTERNS: RegExp[] = [
|
|
55
55
|
/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,
|
|
56
|
-
/Bearer\s+[A-Za-z0-9._
|
|
56
|
+
/Bearer\s+[A-Za-z0-9._~+/=:-]{8,}/gi,
|
|
57
57
|
/sk-[A-Za-z0-9_-]{8,}/g,
|
|
58
58
|
/ghp_[A-Za-z0-9]{20,}/g,
|
|
59
59
|
/glpat-[A-Za-z0-9_-]{15,}/g,
|
|
@@ -111,8 +111,8 @@ export function sanitizeFreezeSnapshot(
|
|
|
111
111
|
return bad('invalid-freeze', '冻结快照必须是 goal/progress/next 字符串对象')
|
|
112
112
|
}
|
|
113
113
|
const record = value as Record<string, unknown>
|
|
114
|
-
const allowed = ['goal', 'progress', 'next', ...extraKeys]
|
|
115
|
-
if (!Object.keys(record).every(key => allowed.
|
|
114
|
+
const allowed = new Set(['goal', 'progress', 'next', ...extraKeys])
|
|
115
|
+
if (!Object.keys(record).every(key => allowed.has(key))) {
|
|
116
116
|
return bad('invalid-freeze', '冻结快照包含未知字段')
|
|
117
117
|
}
|
|
118
118
|
for (const key of SECTION_ORDER) {
|
|
@@ -143,7 +143,7 @@ function mergePayload(
|
|
|
143
143
|
current: TaskBoardExtensionPayload | undefined,
|
|
144
144
|
patch: TaskBoardExtensionPayload,
|
|
145
145
|
): TaskBoardExtensionPayload {
|
|
146
|
-
const next: TaskBoardExtensionPayload = { ...
|
|
146
|
+
const next: TaskBoardExtensionPayload = { ...current }
|
|
147
147
|
for (const [key, value] of Object.entries(patch)) {
|
|
148
148
|
if (value === undefined) delete next[key]
|
|
149
149
|
else next[key] = value
|
|
@@ -624,7 +624,7 @@ export class TaskBoardExtensionRegistry {
|
|
|
624
624
|
this.ledger.saveTaskRecord({
|
|
625
625
|
...task,
|
|
626
626
|
updatedAt: this.now(),
|
|
627
|
-
integrations: { ...
|
|
627
|
+
integrations: { ...task.integrations, [id]: next },
|
|
628
628
|
})
|
|
629
629
|
}
|
|
630
630
|
|
package/src/host-ledger.ts
CHANGED
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
cascadeTargets,
|
|
15
15
|
combineCascadeOutcome,
|
|
16
16
|
hasOutstandingDescendants,
|
|
17
|
-
isOutstanding,
|
|
18
17
|
normalizeSubtaskDepth,
|
|
19
18
|
openGroupExecution,
|
|
20
19
|
outstandingDescendants as lineageOutstandingDescendants,
|
|
@@ -1648,7 +1647,7 @@ export class HostTaskLedger {
|
|
|
1648
1647
|
} catch (error) {
|
|
1649
1648
|
// Migration failure is explicit: the original file stays in place
|
|
1650
1649
|
// for manual recovery and the ledger refuses to start (fail closed).
|
|
1651
|
-
throw new Error(`ledger v${String(parsed.schemaVersion)} to v${TASK_BOARD_SCHEMA_VERSION} migration failed; original file kept at ${this.file}: ${error instanceof Error ? error.message : String(error)}
|
|
1650
|
+
throw new Error(`ledger v${String(parsed.schemaVersion)} to v${TASK_BOARD_SCHEMA_VERSION} migration failed; original file kept at ${this.file}: ${error instanceof Error ? error.message : String(error)}`, { cause: error })
|
|
1652
1651
|
}
|
|
1653
1652
|
}
|
|
1654
1653
|
try {
|
|
@@ -1859,7 +1858,7 @@ export class HostTaskLedger {
|
|
|
1859
1858
|
const hint = confirmedOwner
|
|
1860
1859
|
? ''
|
|
1861
1860
|
: `; if this PID was reused after a crash and no other DSH host is running, remove ${this.lockFile} manually and retry`
|
|
1862
|
-
throw new Error(`task-board ledger is already owned by process ${pid}${hint}
|
|
1861
|
+
throw new Error(`task-board ledger is already owned by process ${pid}${hint}`, { cause: error })
|
|
1863
1862
|
}
|
|
1864
1863
|
}
|
|
1865
1864
|
try { unlinkSync(this.lockFile) } catch (unlinkError) {
|
package/src/host-routes.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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/host-runner.ts
CHANGED
|
@@ -753,7 +753,7 @@ export class HostExecutionRunner {
|
|
|
753
753
|
// keeps the best-effort behavior: the card was asked to run, and losing
|
|
754
754
|
// the work over a model switch this run never promised is worse.
|
|
755
755
|
if (decision.effort !== undefined) {
|
|
756
|
-
throw new Error(`session ${sessionId} refused the model selection "${provider === undefined ? modelId : provider + '/' + modelId}" with reasoning effort "${decision.effort}": ` + (modelError instanceof Error ? modelError.message : String(modelError)))
|
|
756
|
+
throw new Error(`session ${sessionId} refused the model selection "${provider === undefined ? modelId : provider + '/' + modelId}" with reasoning effort "${decision.effort}": ` + (modelError instanceof Error ? modelError.message : String(modelError)), { cause: modelError })
|
|
757
757
|
}
|
|
758
758
|
console.warn(`[dsh-task-board] failed to select model "${provider === undefined ? modelId : provider + '/' + modelId}" for session ${sessionId}, falling back to default:`, modelError)
|
|
759
759
|
}
|
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
|
-
|
|
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) => {
|
package/src/protocol.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { sanitizeFreezeSnapshot, type FreezeSnapshot } from './core/freeze-snaps
|
|
|
7
7
|
import { sanitizeHandover, type TaskHandoverInput } from './core/handover.ts'
|
|
8
8
|
import { TASK_BOARD_MESSAGE_MAX_LENGTH, isTaskBoardExtensionPayload, normalizeTaskIntegrations, type TaskBoardExtensionPayload } from './core/extension.ts'
|
|
9
9
|
import type { ModelCatalogView } from './core/model-catalog.ts'
|
|
10
|
-
import { isTaskAttachmentList
|
|
10
|
+
import { isTaskAttachmentList } from './core/attachment.ts'
|
|
11
11
|
|
|
12
12
|
/** Freeze payload carried by create/update actions after the gate (redacted in place). */
|
|
13
13
|
type FreezePayload = FreezeSnapshot & { redacted?: boolean; frozenBy?: string }
|