@linxin666/dsh-client-ui-task-board 0.2.1 → 0.2.2
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/lib/index.js
CHANGED
|
@@ -878,7 +878,7 @@ function mergeTask(a, b) {
|
|
|
878
878
|
executions: [...byId.values()].sort((x, y) => x.startedAt - y.startedAt)
|
|
879
879
|
};
|
|
880
880
|
}
|
|
881
|
-
function parseHostTasks(values
|
|
881
|
+
function parseHostTasks(values) {
|
|
882
882
|
const rawById = /* @__PURE__ */ new Map();
|
|
883
883
|
for (const value of values) {
|
|
884
884
|
if (typeof value !== "object" || value === null) continue;
|
|
@@ -1045,7 +1045,7 @@ var HostTaskLedger = class {
|
|
|
1045
1045
|
const sources = new Set(this.document.scheduler.importedSources ?? []);
|
|
1046
1046
|
if (sources.has(action.sourceId)) return { state: this.state() };
|
|
1047
1047
|
const invalidScheduleIds = action.tasks.filter((task) => task.schedule !== void 0 && !isValidCron(task.schedule.cron)).map((task) => task.id);
|
|
1048
|
-
const incoming = parseHostTasks(action.tasks
|
|
1048
|
+
const incoming = parseHostTasks(action.tasks);
|
|
1049
1049
|
const merged = new Map(this.document.tasks.map((task) => [task.id, task]));
|
|
1050
1050
|
for (const task of incoming) merged.set(task.id, merged.has(task.id) ? mergeTask(merged.get(task.id), task) : task);
|
|
1051
1051
|
this.document.tasks = [...merged.values()];
|
|
@@ -1173,7 +1173,7 @@ var HostTaskLedger = class {
|
|
|
1173
1173
|
try {
|
|
1174
1174
|
const parsed = JSON.parse(readFileSync(this.file, "utf8"));
|
|
1175
1175
|
if (parsed.schemaVersion !== 2 || !Array.isArray(parsed.tasks)) throw new Error("unsupported ledger schema");
|
|
1176
|
-
const tasks = parseHostTasks(parsed.tasks
|
|
1176
|
+
const tasks = parseHostTasks(parsed.tasks);
|
|
1177
1177
|
const invalidScheduleIds = parsed.tasks.flatMap((value) => {
|
|
1178
1178
|
if (typeof value !== "object" || value === null) return [];
|
|
1179
1179
|
const row = value;
|
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.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/types/index.d.ts",
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
"@types/react-dom": "^18.3.5",
|
|
56
56
|
"@types/node": "^22.20.0",
|
|
57
57
|
"jsdom": "^25.0.0",
|
|
58
|
-
"lightningcss": "1.32.0",
|
|
59
58
|
"react": "^18.3.1",
|
|
60
59
|
"react-dom": "^18.3.1",
|
|
61
60
|
"tsdown": "0.22.2",
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { memo, useCallback, useEffect, useState } from 'react'
|
|
7
7
|
import { selectedTaskOf, type BoardController } from '../../core/controller.ts'
|
|
8
|
-
import { COLUMNS, type TaskRecord
|
|
9
|
-
import { t
|
|
8
|
+
import { COLUMNS, type TaskRecord } from '../../core/tasks.ts'
|
|
9
|
+
import { t } from '../locales.ts'
|
|
10
10
|
import css from '../board.module.css'
|
|
11
11
|
import { NewTaskModal } from './NewTaskModal.tsx'
|
|
12
12
|
import { STATUS_KEY } from './status-key.ts'
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { useEffect, useState } from 'react'
|
|
8
8
|
import type { BoardController } from '../../core/controller.ts'
|
|
9
9
|
import { isValidCron } from '../../core/schedule.ts'
|
|
10
|
-
import { MANUAL_STATUSES, TASK_PERMISSIONS, type ExecutionRecord, type TaskPermission, type TaskRecord
|
|
10
|
+
import { MANUAL_STATUSES, TASK_PERMISSIONS, type ExecutionRecord, type TaskPermission, type TaskRecord } from '../../core/tasks.ts'
|
|
11
11
|
import { t, type TaskBoardKey } from '../locales.ts'
|
|
12
12
|
import { SCHEDULE_PRESETS } from '../schedule-presets.ts'
|
|
13
13
|
import css from '../board.module.css'
|
package/src/core/execution.ts
CHANGED
|
@@ -174,7 +174,7 @@ export class ExecutionService {
|
|
|
174
174
|
// command must run before the task's turn starts. A rejected target
|
|
175
175
|
// fails the run without sending the prompt — running the task under
|
|
176
176
|
// different settings than it declared would be worse than not running.
|
|
177
|
-
if (!await this.applyMode(
|
|
177
|
+
if (!await this.applyMode(task, sessionId, settleFailed)) return
|
|
178
178
|
if (!await this.applyPermission(driver, task, settleFailed)) return
|
|
179
179
|
// Best-effort rename so the execution is recognizable in the session list.
|
|
180
180
|
await driver.rename(task.title).catch(() => { /* rename is cosmetic */ })
|
|
@@ -200,7 +200,6 @@ export class ExecutionService {
|
|
|
200
200
|
* the wire refuses.
|
|
201
201
|
*/
|
|
202
202
|
private async applyMode(
|
|
203
|
-
driver: SessionDriver,
|
|
204
203
|
task: TaskRecord,
|
|
205
204
|
sessionId: string,
|
|
206
205
|
settleFailed: (error: string) => void,
|
package/src/host-ledger.ts
CHANGED
|
@@ -86,7 +86,7 @@ function mergeTask(a: TaskRecord, b: TaskRecord): TaskRecord {
|
|
|
86
86
|
return { ...newer, executions: [...byId.values()].sort((x, y) => x.startedAt - y.startedAt) }
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
function parseHostTasks(values: readonly unknown[]
|
|
89
|
+
function parseHostTasks(values: readonly unknown[]): TaskRecord[] {
|
|
90
90
|
const rawById = new Map<string, Record<string, unknown>>()
|
|
91
91
|
for (const value of values) {
|
|
92
92
|
if (typeof value !== 'object' || value === null) continue
|
|
@@ -262,7 +262,7 @@ export class HostTaskLedger {
|
|
|
262
262
|
const invalidScheduleIds = action.tasks
|
|
263
263
|
.filter(task => task.schedule !== undefined && !isValidCron(task.schedule.cron))
|
|
264
264
|
.map(task => task.id)
|
|
265
|
-
const incoming = parseHostTasks(action.tasks
|
|
265
|
+
const incoming = parseHostTasks(action.tasks)
|
|
266
266
|
const merged = new Map(this.document.tasks.map(task => [task.id, task]))
|
|
267
267
|
for (const task of incoming) merged.set(task.id, merged.has(task.id) ? mergeTask(merged.get(task.id)!, task) : task)
|
|
268
268
|
this.document.tasks = [...merged.values()]
|
|
@@ -381,7 +381,7 @@ export class HostTaskLedger {
|
|
|
381
381
|
try {
|
|
382
382
|
const parsed = JSON.parse(readFileSync(this.file, 'utf8')) as Partial<LedgerDocument>
|
|
383
383
|
if (parsed.schemaVersion !== TASK_BOARD_SCHEMA_VERSION || !Array.isArray(parsed.tasks)) throw new Error('unsupported ledger schema')
|
|
384
|
-
const tasks = parseHostTasks(parsed.tasks
|
|
384
|
+
const tasks = parseHostTasks(parsed.tasks)
|
|
385
385
|
const invalidScheduleIds = (parsed.tasks as unknown[]).flatMap(value => {
|
|
386
386
|
if (typeof value !== 'object' || value === null) return []
|
|
387
387
|
const row = value as { id?: unknown; schedule?: unknown }
|