@linxin666/dsh-client-ui-task-board 0.4.21 → 0.4.23
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 +7 -6
- package/README.zh.md +7 -6
- package/lib/client.js +452 -95
- package/lib/client.js.map +1 -1
- package/lib/index.js +84 -47
- package/lib/types/client/TaskBoardSettingsCard.d.ts +1 -1
- package/lib/types/client/board/AttachmentField.d.ts +3 -1
- package/lib/types/client/board/NewTaskModal.d.ts +4 -2
- package/lib/types/client/board/TaskBoard.d.ts +16 -1
- package/lib/types/client/board/model-options.d.ts +2 -2
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/locales.d.ts +4 -0
- package/lib/types/client/native-panel.d.ts +19 -1
- package/lib/types/client/session-activity.d.ts +36 -0
- package/lib/types/client/user-message-action.d.ts +46 -0
- package/lib/types/core/controller.d.ts +16 -0
- package/lib/types/core/model-catalog.d.ts +1 -1
- package/lib/types/core/tasks.d.ts +9 -0
- package/lib/types/core/use-cases/task-update.d.ts +25 -17
- package/lib/types/dsh-home.d.ts +13 -3
- package/lib/types/host-routes.d.ts +2 -6
- package/lib/types/tool-surface.d.ts +6 -2
- package/package.json +33 -33
- package/src/client/TaskBoardSettingsCard.tsx +2 -2
- package/src/client/board/AttachmentField.tsx +6 -1
- package/src/client/board/EditTaskModal.tsx +4 -1
- package/src/client/board/NewTaskModal.tsx +8 -6
- package/src/client/board/TaskBoard.tsx +59 -13
- package/src/client/board/TaskDetail.tsx +16 -11
- package/src/client/board/model-options.ts +18 -8
- package/src/client/board.module.css +32 -0
- package/src/client/index.ts +31 -19
- package/src/client/locales.ts +8 -0
- package/src/client/native-panel.tsx +85 -5
- package/src/client/session-activity.tsx +163 -0
- package/src/client/user-message-action.tsx +211 -0
- package/src/core/controller.ts +30 -0
- package/src/core/model-catalog.ts +1 -1
- package/src/core/store.ts +2 -0
- package/src/core/tasks.ts +13 -0
- package/src/core/use-cases/task-update.ts +29 -19
- package/src/dsh-home.ts +35 -12
- package/src/host/agent-tools.ts +8 -0
- package/src/host-ledger.ts +11 -5
- package/src/host-routes.ts +7 -16
- package/src/host-runner.ts +4 -4
- package/src/host-service.ts +6 -1
- package/src/index.ts +2 -3
- package/src/protocol.ts +4 -0
- package/src/tool-surface.ts +17 -2
|
@@ -39,33 +39,41 @@ export type TaskUpdatePatch = Partial<Pick<TaskRecord, 'title' | 'description' |
|
|
|
39
39
|
*/
|
|
40
40
|
attachments?: TaskAttachment[] | null;
|
|
41
41
|
};
|
|
42
|
-
/** The fields that edit the task's content (what the user reads and what the
|
|
43
|
-
* next execution sends). Unlike the execution targets they stay editable only
|
|
44
|
-
* while the task has never started executing — after the first run the
|
|
45
|
-
* recorded prompt is the record of what actually ran, so it becomes read-only.
|
|
46
|
-
*/
|
|
47
|
-
export declare const TASK_CONTENT_FIELDS: readonly ["title", "description", "prompt"];
|
|
48
42
|
/**
|
|
49
|
-
* The fields that freeze with the
|
|
50
|
-
* the attachments it carries.
|
|
43
|
+
* The fields that freeze with the first run. Split by what keeps them honest:
|
|
51
44
|
*
|
|
52
|
-
* The
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
45
|
+
* - The CONTENT fields stay editable between runs because every execution
|
|
46
|
+
* record captures the prompt/title snapshot it was opened with (see
|
|
47
|
+
* `startExecution`), so a post-run edit changes only the next run, never
|
|
48
|
+
* the audit trail.
|
|
49
|
+
* - The ATTACHMENTS freeze at the first run and stay frozen: they are binary
|
|
50
|
+
* references the record does not snapshot, and a card whose first run
|
|
51
|
+
* already consumed an image keeps that image — the record of what ran
|
|
52
|
+
* stays what it was. `canEditTaskAttachments` owns that boundary.
|
|
57
53
|
*/
|
|
54
|
+
export declare const TASK_CONTENT_FIELDS: readonly ["title", "description", "prompt"];
|
|
58
55
|
export declare const TASK_FROZEN_FIELDS: readonly ["title", "description", "prompt", "attachments"];
|
|
59
56
|
/** Whether an update patch touches any task-content field. */
|
|
60
57
|
export declare function hasContentPatch(patch: TaskUpdatePatch): boolean;
|
|
61
58
|
/**
|
|
62
59
|
* Whether a task's content may still be edited: the task must be on-board
|
|
63
|
-
* (not archived) and must
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
60
|
+
* (not archived) and must not have an open execution. Settled history does
|
|
61
|
+
* NOT lock the card: new execution records carry the prompt/title snapshot
|
|
62
|
+
* they were opened with (`promptSnapshot`/`titleSnapshot`), so a
|
|
63
|
+
* post-run edit changes only the next run, never the audit trail. The run,
|
|
64
|
+
* not the column, stays the trigger: a card parked in 'running' by hand has
|
|
65
|
+
* nothing recorded yet and stays editable, and a card mid-run is locked
|
|
66
|
+
* until its execution settles.
|
|
67
67
|
*/
|
|
68
68
|
export declare function canEditTaskContent(task: TaskRecord): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether a task's attachments may still be edited: unlike the content
|
|
71
|
+
* fields, attachments are NOT captured on the execution record, so they keep
|
|
72
|
+
* the historical boundary — editable until the first run opens, frozen for
|
|
73
|
+
* every executed or archived card afterwards. The record of what ran keeps
|
|
74
|
+
* referencing exactly what ran.
|
|
75
|
+
*/
|
|
76
|
+
export declare function canEditTaskAttachments(task: TaskRecord): boolean;
|
|
69
77
|
/**
|
|
70
78
|
* Apply an update across the ledger. Tasks that do not match the id are left
|
|
71
79
|
* untouched; the matched task receives the patch plus a fresh updatedAt.
|
package/lib/types/dsh-home.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* DSH_HOME resolution shared by the plugin family's Host
|
|
3
|
-
* environment
|
|
4
|
-
*
|
|
2
|
+
* DSH_HOME and DSH_AGENTS_HOME resolution shared by the plugin family's Host
|
|
3
|
+
* halves: environment overrides win (blank values treated as unset), then the
|
|
4
|
+
* platform home fallbacks follow — mirroring `@deepseek-ai/dsh-home-paths`.
|
|
5
5
|
*/
|
|
6
6
|
/** Expand a leading ~ (or ~user) in a path, platform-style. */
|
|
7
7
|
export declare function expandHome(path: string, home?: string): string;
|
|
@@ -14,3 +14,13 @@ export declare function expandHome(path: string, home?: string): string;
|
|
|
14
14
|
export declare function resolveDshHome(env?: NodeJS.ProcessEnv, home?: string): string;
|
|
15
15
|
/** Resolve the DSH home directory from the live environment. */
|
|
16
16
|
export declare function dshHome(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve the shared agent configuration root (`$DSH_AGENTS_HOME`, defaulting
|
|
19
|
+
* to `<home>/.agents`), matching `@deepseek-ai/dsh-home-paths`'s `resolveAgentsHome`.
|
|
20
|
+
* @param env - process environment to read DSH_AGENTS_HOME from.
|
|
21
|
+
* @param home - platform home directory fallback (test seam).
|
|
22
|
+
* @returns the absolute shared agents home path.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveAgentsHome(env?: NodeJS.ProcessEnv, home?: string): string;
|
|
25
|
+
/** Resolve the shared agent configuration root from the live environment. */
|
|
26
|
+
export declare function agentsHome(): string;
|
|
@@ -13,17 +13,13 @@ export declare const HEARTBEAT_MS = 15000;
|
|
|
13
13
|
export declare const TASK_BOARD_PROXY_TOKEN_HEADER = "x-dsh-task-board-proxy-token";
|
|
14
14
|
/**
|
|
15
15
|
* The composition's Host connection service, narrowed to the one check the
|
|
16
|
-
* board bridges: `
|
|
17
|
-
* the authority-bound `dsh-auth-*` browser session minted by the Host.
|
|
18
|
-
* answers `undefined` only for a request it admits and 401/403 otherwise.
|
|
16
|
+
* board bridges: `admit` runs the Host/Origin fence and verifies
|
|
17
|
+
* the authority-bound `dsh-auth-*` browser session minted by the Host.
|
|
19
18
|
* Declared structurally, like the official open-in-app routes do, because the
|
|
20
19
|
* service's package is a browser-side dependency this Host half does not
|
|
21
20
|
* import.
|
|
22
21
|
*/
|
|
23
22
|
export interface TaskBoardConnectionTrust {
|
|
24
|
-
requestRejection?(request: {
|
|
25
|
-
readonly headers: IncomingMessage['headers'];
|
|
26
|
-
}): 401 | 403 | undefined;
|
|
27
23
|
admit?(request: {
|
|
28
24
|
readonly headers: IncomingMessage['headers'];
|
|
29
25
|
}): {
|
|
@@ -56,11 +56,15 @@ export interface SectionScopeContext {
|
|
|
56
56
|
scope?: unknown;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* Build a section provider that renders
|
|
60
|
-
*
|
|
59
|
+
* Build a section provider that renders `text` only while at least one of
|
|
60
|
+
* `toolNames` is visible to the rendering scope.
|
|
61
61
|
*
|
|
62
62
|
* The native convention: a tool that a restriction, a preset, or a missing
|
|
63
63
|
* registry removed must not leave guidance behind telling the model to call it.
|
|
64
|
+
* Under a 0.2.3-alpha.3+ PTC root registry (`PtcToolRegistry`), `tools.get(name,
|
|
65
|
+
* scope)` exposes only the `run_code` transport while binding registered tools
|
|
66
|
+
* inside programs; when `run_code` is active in the rendering scope, fall back
|
|
67
|
+
* to checking the unscoped registry so guidance does not vanish under PTC.
|
|
64
68
|
* An unreadable registry renders the text unchanged — guidance that outlives a
|
|
65
69
|
* momentary read failure is recoverable; guidance for a tool that is gone is
|
|
66
70
|
* not.
|
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.23",
|
|
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.
|
|
25
|
+
"dsh": ">=0.2.3-alpha.4"
|
|
26
26
|
},
|
|
27
27
|
"bundle": {
|
|
28
28
|
"patch": "./cordis.patch.yml"
|
|
@@ -42,45 +42,45 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@deepseek-ai/dsh": ">=0.2.
|
|
46
|
-
"react": "^
|
|
45
|
+
"@deepseek-ai/dsh": ">=0.2.3-alpha.4",
|
|
46
|
+
"react": "^19.3.1"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@deepseek-ai/schemastery": "
|
|
49
|
+
"@deepseek-ai/schemastery": "~3.20.0-alpha.3",
|
|
50
50
|
"marked": "^18.0.14"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@deepseek-ai/cordis": "
|
|
54
|
-
"@deepseek-ai/dsh-agent": "^0.2.
|
|
55
|
-
"@deepseek-ai/dsh-agent-preset-registry": "^0.2.
|
|
56
|
-
"@deepseek-ai/dsh-attachment": "^0.2.
|
|
57
|
-
"@deepseek-ai/dsh-api-gateway": "^0.2.
|
|
58
|
-
"@deepseek-ai/dsh-api-remotes": "^0.2.
|
|
59
|
-
"@deepseek-ai/dsh-api-session-controller": "^0.2.
|
|
60
|
-
"@deepseek-ai/dsh-api-workspace-controller": "^0.2.
|
|
61
|
-
"@deepseek-ai/dsh-client-connection": "^0.2.
|
|
62
|
-
"@deepseek-ai/dsh-client-locale": "^0.2.
|
|
63
|
-
"@deepseek-ai/dsh-client-store": "^0.2.
|
|
64
|
-
"@deepseek-ai/dsh-client-ui-layout": "^0.2.
|
|
65
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.
|
|
66
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.2.
|
|
67
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "^0.2.
|
|
68
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.2.
|
|
69
|
-
"@deepseek-ai/dsh-client-ui-workspace": "^0.2.
|
|
70
|
-
"@deepseek-ai/dsh-commands": "^0.2.
|
|
71
|
-
"@deepseek-ai/dsh-host-webserver": "^0.2.
|
|
72
|
-
"@deepseek-ai/dsh-llm": "^0.2.
|
|
73
|
-
"@deepseek-ai/dsh-settings": "^0.2.
|
|
74
|
-
"@deepseek-ai/dsh-system-prompt": "^0.2.
|
|
75
|
-
"@deepseek-ai/dsh-tools": "^0.2.
|
|
76
|
-
"@deepseek-ai/dsh-workspace": "^0.2.
|
|
53
|
+
"@deepseek-ai/cordis": "~4.2.0-alpha.3",
|
|
54
|
+
"@deepseek-ai/dsh-agent": "^0.2.3-alpha.4",
|
|
55
|
+
"@deepseek-ai/dsh-agent-preset-registry": "^0.2.3-alpha.4",
|
|
56
|
+
"@deepseek-ai/dsh-attachment": "^0.2.3-alpha.4",
|
|
57
|
+
"@deepseek-ai/dsh-api-gateway": "^0.2.3-alpha.4",
|
|
58
|
+
"@deepseek-ai/dsh-api-remotes": "^0.2.3-alpha.4",
|
|
59
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.2.3-alpha.4",
|
|
60
|
+
"@deepseek-ai/dsh-api-workspace-controller": "^0.2.3-alpha.4",
|
|
61
|
+
"@deepseek-ai/dsh-client-connection": "^0.2.3-alpha.4",
|
|
62
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.3-alpha.4",
|
|
63
|
+
"@deepseek-ai/dsh-client-store": "^0.2.3-alpha.4",
|
|
64
|
+
"@deepseek-ai/dsh-client-ui-layout": "^0.2.3-alpha.4",
|
|
65
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.3-alpha.4",
|
|
66
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.2.3-alpha.4",
|
|
67
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "^0.2.3-alpha.4",
|
|
68
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.3-alpha.4",
|
|
69
|
+
"@deepseek-ai/dsh-client-ui-workspace": "^0.2.3-alpha.4",
|
|
70
|
+
"@deepseek-ai/dsh-commands": "^0.2.3-alpha.4",
|
|
71
|
+
"@deepseek-ai/dsh-host-webserver": "^0.2.3-alpha.4",
|
|
72
|
+
"@deepseek-ai/dsh-llm": "^0.2.3-alpha.4",
|
|
73
|
+
"@deepseek-ai/dsh-settings": "^0.2.3-alpha.4",
|
|
74
|
+
"@deepseek-ai/dsh-system-prompt": "^0.2.3-alpha.4",
|
|
75
|
+
"@deepseek-ai/dsh-tools": "^0.2.3-alpha.4",
|
|
76
|
+
"@deepseek-ai/dsh-workspace": "^0.2.3-alpha.4",
|
|
77
77
|
"@types/node": "^22.20.0",
|
|
78
|
-
"@types/react": "~
|
|
79
|
-
"@types/react-dom": "
|
|
78
|
+
"@types/react": "~19.3.2",
|
|
79
|
+
"@types/react-dom": "~19.3.0",
|
|
80
80
|
"@vitest/coverage-v8": "^4.1.11",
|
|
81
81
|
"jsdom": "^25.0.0",
|
|
82
|
-
"react": "^
|
|
83
|
-
"react-dom": "^
|
|
82
|
+
"react": "^19.3.1",
|
|
83
|
+
"react-dom": "^19.3.1",
|
|
84
84
|
"tsdown": "0.22.2",
|
|
85
85
|
"typescript": "~5.7.2",
|
|
86
86
|
"vitest": "^4.1.11"
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* the Web UI plugin group renders, bound to the `task-board` namespace.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
|
|
7
|
+
import type { InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
8
8
|
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store'
|
|
9
9
|
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
10
10
|
import { useEffect, useState } from 'react'
|
|
@@ -374,7 +374,7 @@ export function TaskBoardSettingsCard(props: TaskBoardSettingsCardProps) {
|
|
|
374
374
|
invalidLabel: t('settings.invalidNumber'),
|
|
375
375
|
disabled,
|
|
376
376
|
}
|
|
377
|
-
// The new-card-defaults topic reads the SAME catalog the create dialog reads (
|
|
377
|
+
// The new-card-defaults topic reads the SAME catalog the create dialog reads (models/catalog, served here through the
|
|
378
378
|
// model-catalog payload), normalized once into the roster the reasoning
|
|
379
379
|
// helpers below consume, so the default level can only offer levels the
|
|
380
380
|
// chosen default model really declares.
|
|
@@ -156,6 +156,7 @@ export function AttachmentField({
|
|
|
156
156
|
onChange,
|
|
157
157
|
limits,
|
|
158
158
|
disabled = false,
|
|
159
|
+
lockedHint,
|
|
159
160
|
onError,
|
|
160
161
|
}: {
|
|
161
162
|
/** What the card currently carries and what is staged on top of it. */
|
|
@@ -166,6 +167,8 @@ export function AttachmentField({
|
|
|
166
167
|
limits?: AttachmentLimits
|
|
167
168
|
/** Whether the field refuses new input. */
|
|
168
169
|
disabled?: boolean
|
|
170
|
+
/** Replaces the inviting upload hint when the caller locks the field. */
|
|
171
|
+
lockedHint?: string
|
|
169
172
|
/** Receives the reason a selection was refused. */
|
|
170
173
|
onError?: (message: string) => void
|
|
171
174
|
}) {
|
|
@@ -275,7 +278,9 @@ export function AttachmentField({
|
|
|
275
278
|
return (
|
|
276
279
|
<div className={css.field} data-dsh-part="form-section">
|
|
277
280
|
<span className={css.fieldLabel}>{t('new.attachments')}</span>
|
|
278
|
-
|
|
281
|
+
{/* When the caller locks the field (an executed card), the inviting
|
|
282
|
+
upload hint is replaced by why the field refuses input. */}
|
|
283
|
+
<span className={css.fieldHint}>{lockedHint ?? t('new.attachmentsHint')}</span>
|
|
279
284
|
<div
|
|
280
285
|
className={css.attachmentDrop}
|
|
281
286
|
// A disabled field is not styled as a drop target: the drag state is
|
|
@@ -113,7 +113,10 @@ export function EditTaskModal({ controller, task, onClose, phase }: { controller
|
|
|
113
113
|
selection={attachments}
|
|
114
114
|
onChange={setAttachments}
|
|
115
115
|
limits={controller.getSnapshot().host?.attachmentLimits}
|
|
116
|
-
|
|
116
|
+
// Attachments freeze at the first run (they are not snapshotted on
|
|
117
|
+
// the execution record); an executed card edits its content only.
|
|
118
|
+
disabled={pending || task.executions.length > 0}
|
|
119
|
+
lockedHint={task.executions.length > 0 ? t('edit.attachmentsLocked') : undefined}
|
|
117
120
|
onError={message => { setAttachmentError(message) }}
|
|
118
121
|
/>
|
|
119
122
|
{attachmentError !== undefined && <p className={css.formError}>{attachmentError}</p>}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Creates through the Host and closes only after the Host confirms it.
|
|
4
4
|
*/
|
|
5
5
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
6
|
-
import type { BoardController } from '../../core/controller.ts'
|
|
6
|
+
import type { BoardController, ComposeTaskDraft } from '../../core/controller.ts'
|
|
7
7
|
import { isTaskBoardExtensionPayload, type TaskBoardComposeDraftOptions, type TaskBoardExtensionPayload } from '../../core/extension.ts'
|
|
8
8
|
import { resolveCardTargets, type CardTargetSource } from '../../core/card-defaults.ts'
|
|
9
9
|
import { isValidCron, nextRunAtMs } from '../../core/schedule.ts'
|
|
@@ -30,6 +30,8 @@ export interface NewTaskModalProps {
|
|
|
30
30
|
onClose: () => void
|
|
31
31
|
/** Optional task template to clone/duplicate from. */
|
|
32
32
|
initialTask?: TaskRecord
|
|
33
|
+
/** Optional prefilled draft (creates a fresh card, not a duplicate). */
|
|
34
|
+
initialDraft?: ComposeTaskDraft
|
|
33
35
|
/**
|
|
34
36
|
* Workspace the board's project filter has selected (#1536): a task created
|
|
35
37
|
* while a project is open belongs to that project unless the user changes it.
|
|
@@ -62,11 +64,11 @@ function markStaged(
|
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
/** New-task form overlay. */
|
|
65
|
-
export function NewTaskModal({ controller, onClose, initialTask, defaultWorkspaceId, onDuplicateSuccess, parentTask, phase }: NewTaskModalProps) {
|
|
67
|
+
export function NewTaskModal({ controller, onClose, initialTask, initialDraft, defaultWorkspaceId, onDuplicateSuccess, parentTask, phase }: NewTaskModalProps) {
|
|
66
68
|
const isDuplicate = initialTask !== undefined
|
|
67
|
-
const [title, setTitle] = useState(initialTask?.title ?? '')
|
|
68
|
-
const [description, setDescription] = useState(initialTask?.description ?? '')
|
|
69
|
-
const [prompt, setPrompt] = useState(initialTask?.prompt ?? '')
|
|
69
|
+
const [title, setTitle] = useState(initialTask?.title ?? initialDraft?.title ?? '')
|
|
70
|
+
const [description, setDescription] = useState(initialTask?.description ?? initialDraft?.description ?? '')
|
|
71
|
+
const [prompt, setPrompt] = useState(initialTask?.prompt ?? initialDraft?.prompt ?? '')
|
|
70
72
|
// The four execution targets this dialog opens on, resolved by the one rule
|
|
71
73
|
// the Host create path also uses (core/card-defaults.ts): what the card is
|
|
72
74
|
// created from (a duplicate's source, a subtask's parent) first, the board's
|
|
@@ -85,7 +87,7 @@ export function NewTaskModal({ controller, onClose, initialTask, defaultWorkspac
|
|
|
85
87
|
// what makes the Host inherit the parent's binding together with its human
|
|
86
88
|
// confirmation, while picking a value pins this card's own binding and
|
|
87
89
|
// re-arms the gate. A parent's permission never travels here at all.
|
|
88
|
-
const [workspaceId, setWorkspaceId] = useState(initialTask?.workspaceId ?? parentTask?.workspaceId ?? defaultWorkspaceId ?? '')
|
|
90
|
+
const [workspaceId, setWorkspaceId] = useState(initialTask?.workspaceId ?? parentTask?.workspaceId ?? initialDraft?.workspaceId ?? defaultWorkspaceId ?? '')
|
|
89
91
|
const [mode, setMode] = useState(seed.mode)
|
|
90
92
|
const [permission, setPermission] = useState(seed.permission)
|
|
91
93
|
const [model, setModel] = useState(seed.model)
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* active. Cards open the task detail (never execute directly); the header
|
|
4
4
|
* offers filter, new-task, and a back-to-chat escape.
|
|
5
5
|
*/
|
|
6
|
-
import { memo, useCallback, useEffect, useRef, useState } from 'react'
|
|
7
|
-
import { selectedTaskOf, type BoardController } from '../../core/controller.ts'
|
|
6
|
+
import { memo, useCallback, useEffect, useRef, useState, type ReactNode } from 'react'
|
|
7
|
+
import { selectedTaskOf, type BoardController, type ComposeTaskDraft } from '../../core/controller.ts'
|
|
8
8
|
import { COLUMNS, MANUAL_STATUSES, canMoveTask, collectKnownTags, hasOpenExecution, tagTone, type TaskRecord, type TaskStatus } from '../../core/tasks.ts'
|
|
9
9
|
import { t } from '../locales.ts'
|
|
10
10
|
import css from '../board.module.css'
|
|
@@ -124,8 +124,20 @@ export const COLUMN_FOLD_THRESHOLD = 30
|
|
|
124
124
|
/** Column key of the archive view in the fold-open set. */
|
|
125
125
|
const ARCHIVE_COLUMN = 'archived'
|
|
126
126
|
|
|
127
|
+
/** Props accepted by the optional `directory.browser.dialog` slot factory wrapper. */
|
|
128
|
+
export interface ProjectDirectoryDialogProps {
|
|
129
|
+
readonly open: boolean
|
|
130
|
+
readonly busy: boolean
|
|
131
|
+
readonly onOpen: (path: string) => void
|
|
132
|
+
readonly onClose: () => void
|
|
133
|
+
}
|
|
134
|
+
|
|
127
135
|
/** Board component; subscribes to the controller snapshot. */
|
|
128
|
-
export function TaskBoard({ controller }: {
|
|
136
|
+
export function TaskBoard({ controller, renderDirectoryDialog }: {
|
|
137
|
+
controller: BoardController
|
|
138
|
+
/** Optional shell `directory.browser.dialog` factory renderer for choosing a project folder. */
|
|
139
|
+
renderDirectoryDialog?: (props: ProjectDirectoryDialogProps) => ReactNode
|
|
140
|
+
}) {
|
|
129
141
|
const [snapshot, setSnapshot] = useState(controller.getSnapshot())
|
|
130
142
|
useEffect(
|
|
131
143
|
() => controller.subscribe(() => setSnapshot(controller.getSnapshot())),
|
|
@@ -146,14 +158,24 @@ export function TaskBoard({ controller }: { controller: BoardController }) {
|
|
|
146
158
|
// Grouped columns whose folded "earlier" group the user expanded this visit.
|
|
147
159
|
const [unfolded, setUnfolded] = useState<string[]>([])
|
|
148
160
|
const [showNew, setShowNew] = useState(false)
|
|
161
|
+
const [newTaskDraft, setNewTaskDraft] = useState<ComposeTaskDraft | undefined>(undefined)
|
|
162
|
+
const [newTaskDraftSeq, setNewTaskDraftSeq] = useState(0)
|
|
149
163
|
const [showTagManager, setShowTagManager] = useState(false)
|
|
150
164
|
// Project partition (#1536): '' means "all projects". A selected project
|
|
151
165
|
// narrows the board and becomes the new-task form's default workspace.
|
|
152
166
|
const [projectId, setProjectId] = useState('')
|
|
153
167
|
const [showNewProject, setShowNewProject] = useState(false)
|
|
168
|
+
const [browseProjectOpen, setBrowseProjectOpen] = useState(false)
|
|
154
169
|
const [newProjectPath, setNewProjectPath] = useState('')
|
|
155
170
|
const [newProjectError, setNewProjectError] = useState<string | undefined>(undefined)
|
|
156
171
|
const [newProjectPending, setNewProjectPending] = useState(false)
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
const draft = controller.consumeComposeDraft?.()
|
|
174
|
+
if (draft === undefined) return
|
|
175
|
+
setNewTaskDraft(draft)
|
|
176
|
+
setNewTaskDraftSeq(seq => seq + 1)
|
|
177
|
+
setShowNew(true)
|
|
178
|
+
}, [controller, snapshot])
|
|
157
179
|
const selected = selectedTaskOf(snapshot)
|
|
158
180
|
const archiveView = snapshot.archiveView
|
|
159
181
|
// Overlay lifecycle: both the detail view and the create dialog keep the
|
|
@@ -413,7 +435,7 @@ export function TaskBoard({ controller }: { controller: BoardController }) {
|
|
|
413
435
|
<button
|
|
414
436
|
type="button"
|
|
415
437
|
className={css.primaryButton}
|
|
416
|
-
onClick={() => { setShowNew(true) }}
|
|
438
|
+
onClick={() => { setNewTaskDraft(undefined); setNewTaskDraftSeq(seq => seq + 1); setShowNew(true) }}
|
|
417
439
|
>
|
|
418
440
|
<IconPlus size={15} />
|
|
419
441
|
{t('board.new')}
|
|
@@ -425,20 +447,32 @@ export function TaskBoard({ controller }: { controller: BoardController }) {
|
|
|
425
447
|
<div className={css.projectDialog} data-dsh-part="project-dialog">
|
|
426
448
|
<label className={css.field}>
|
|
427
449
|
<span className={css.fieldLabel}>{t('board.projectNewPath')}</span>
|
|
428
|
-
<
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
450
|
+
<div className={css.projectPathRow}>
|
|
451
|
+
<input
|
|
452
|
+
className={css.input}
|
|
453
|
+
value={newProjectPath}
|
|
454
|
+
placeholder={t('board.projectNewPathPlaceholder')}
|
|
455
|
+
spellCheck={false}
|
|
456
|
+
onChange={event => { setNewProjectPath(event.target.value); setNewProjectError(undefined) }}
|
|
457
|
+
/>
|
|
458
|
+
{renderDirectoryDialog !== undefined && (
|
|
459
|
+
<button
|
|
460
|
+
type="button"
|
|
461
|
+
className={css.ghostButton}
|
|
462
|
+
disabled={newProjectPending}
|
|
463
|
+
onClick={() => { setBrowseProjectOpen(true) }}
|
|
464
|
+
>
|
|
465
|
+
{t('board.projectBrowse')}
|
|
466
|
+
</button>
|
|
467
|
+
)}
|
|
468
|
+
</div>
|
|
435
469
|
</label>
|
|
436
470
|
{newProjectError !== undefined && <p className={css.formError}>{t('board.projectCreateFailed', { error: newProjectError })}</p>}
|
|
437
471
|
<div className={css.projectDialogActions}>
|
|
438
472
|
<button
|
|
439
473
|
type="button"
|
|
440
474
|
className={css.ghostButton}
|
|
441
|
-
onClick={() => { setShowNewProject(false); setNewProjectError(undefined) }}
|
|
475
|
+
onClick={() => { setBrowseProjectOpen(false); setShowNewProject(false); setNewProjectError(undefined) }}
|
|
442
476
|
>
|
|
443
477
|
{t('new.cancel')}
|
|
444
478
|
</button>
|
|
@@ -451,6 +485,16 @@ export function TaskBoard({ controller }: { controller: BoardController }) {
|
|
|
451
485
|
{t('board.projectCreate')}
|
|
452
486
|
</button>
|
|
453
487
|
</div>
|
|
488
|
+
{browseProjectOpen && renderDirectoryDialog !== undefined && renderDirectoryDialog({
|
|
489
|
+
open: true,
|
|
490
|
+
busy: newProjectPending,
|
|
491
|
+
onOpen: (picked) => {
|
|
492
|
+
setNewProjectPath(picked)
|
|
493
|
+
setNewProjectError(undefined)
|
|
494
|
+
setBrowseProjectOpen(false)
|
|
495
|
+
},
|
|
496
|
+
onClose: () => { setBrowseProjectOpen(false) },
|
|
497
|
+
})}
|
|
454
498
|
</div>
|
|
455
499
|
)}
|
|
456
500
|
|
|
@@ -577,9 +621,11 @@ export function TaskBoard({ controller }: { controller: BoardController }) {
|
|
|
577
621
|
)}
|
|
578
622
|
{newTaskPresence.mounted && (
|
|
579
623
|
<NewTaskModal
|
|
624
|
+
key={newTaskDraftSeq}
|
|
580
625
|
controller={controller}
|
|
626
|
+
{...(newTaskDraft === undefined ? {} : { initialDraft: newTaskDraft })}
|
|
581
627
|
{...(projectId === '' ? {} : { defaultWorkspaceId: projectId })}
|
|
582
|
-
onClose={() => { setShowNew(false) }}
|
|
628
|
+
onClose={() => { setShowNew(false); setNewTaskDraft(undefined) }}
|
|
583
629
|
phase={newTaskPresence.phase}
|
|
584
630
|
/>
|
|
585
631
|
)}
|
|
@@ -842,10 +842,25 @@ export function TaskDetail({ controller, task, phase = 'open' }: { controller: B
|
|
|
842
842
|
if (!archived) {
|
|
843
843
|
headerActions.push({
|
|
844
844
|
key: 'duplicate',
|
|
845
|
-
|
|
845
|
+
// Label keys on execution history, not editability: an executed card
|
|
846
|
+
// keeps the「duplicate-and-edit」wording even though its content is now
|
|
847
|
+
// directly editable between runs.
|
|
848
|
+
label: current.executions.length === 0 ? t('detail.duplicate') : t('detail.duplicateAndEdit'),
|
|
846
849
|
disabled: pending,
|
|
847
850
|
onSelect: () => { setShowDuplicate(true) },
|
|
848
851
|
})
|
|
852
|
+
// Tags stay directly editable on executed cards (they shape the next
|
|
853
|
+
// run, not the record of what ran); the full edit modal covers them too,
|
|
854
|
+
// this header entry is the shortcut. Keys on execution history so it
|
|
855
|
+
// survives content-edit unlocking instead of turning into dead code.
|
|
856
|
+
if (current.executions.length > 0 && !busy) {
|
|
857
|
+
headerActions.push({
|
|
858
|
+
key: 'editTags',
|
|
859
|
+
label: t('detail.editTags'),
|
|
860
|
+
disabled: pending,
|
|
861
|
+
onSelect: () => { setShowEditTags(true) },
|
|
862
|
+
})
|
|
863
|
+
}
|
|
849
864
|
if (current.status === 'done' || current.status === 'failed') {
|
|
850
865
|
headerActions.push({
|
|
851
866
|
key: 'archive',
|
|
@@ -1073,16 +1088,6 @@ export function TaskDetail({ controller, task, phase = 'open' }: { controller: B
|
|
|
1073
1088
|
{t('detail.edit')}
|
|
1074
1089
|
</button>
|
|
1075
1090
|
)}
|
|
1076
|
-
{!archived && !canEditTaskContent(current) && !busy && (
|
|
1077
|
-
<button
|
|
1078
|
-
type="button"
|
|
1079
|
-
className={css.ghostButton}
|
|
1080
|
-
disabled={pending}
|
|
1081
|
-
onClick={() => { setShowEditTags(true) }}
|
|
1082
|
-
>
|
|
1083
|
-
{t('detail.editTags')}
|
|
1084
|
-
</button>
|
|
1085
|
-
)}
|
|
1086
1091
|
{!archived && (
|
|
1087
1092
|
<button
|
|
1088
1093
|
type="button"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Execution model options: the picker rows built from the official
|
|
3
|
-
* `
|
|
3
|
+
* `models/catalog` reply, and the reasoning-effort derivation both
|
|
4
4
|
* execution-target editors read off them (the create dialog and the detail
|
|
5
5
|
* page share one contract here, so they cannot promise different levels).
|
|
6
6
|
*
|
|
@@ -22,6 +22,12 @@ import type { TaskBoardKey } from '../locales.ts'
|
|
|
22
22
|
/** One model's declared reasoning capability, as a picker row carries it. */
|
|
23
23
|
type ModelReasoning = NonNullable<ExecutionModelOption['reasoning']>
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Providers whose own routes still accept `off` in requests but hide it from
|
|
27
|
+
* pickers unless the model declares `off` as its default effort (DSH #9860).
|
|
28
|
+
*/
|
|
29
|
+
const OFF_HIDDEN_PROVIDERS: ReadonlySet<string> = new Set(['deepseek-account', 'deepseek-official'])
|
|
30
|
+
|
|
25
31
|
/** A plain JSON object, or undefined for anything else (including arrays). */
|
|
26
32
|
function record(value: unknown): Record<string, unknown> | undefined {
|
|
27
33
|
return typeof value === 'object' && value !== null && !Array.isArray(value) ? value as Record<string, unknown> : undefined
|
|
@@ -32,12 +38,16 @@ function text(value: unknown): string | undefined {
|
|
|
32
38
|
return typeof value === 'string' && value !== '' ? value : undefined
|
|
33
39
|
}
|
|
34
40
|
|
|
35
|
-
/** The effort ids an adapter published for one model, in catalog order. */
|
|
36
|
-
function effortIdsOf(reasoning: Record<string, unknown
|
|
41
|
+
/** The effort ids an adapter published for one model, filtered for picker display in catalog order. */
|
|
42
|
+
function effortIdsOf(reasoning: Record<string, unknown>, provider: string | undefined): string[] {
|
|
43
|
+
const hidesOff = provider !== undefined && OFF_HIDDEN_PROVIDERS.has(provider)
|
|
44
|
+
const defaultEffort = text(reasoning.defaultEffort)
|
|
37
45
|
const efforts: string[] = []
|
|
38
46
|
for (const entry of Array.isArray(reasoning.efforts) ? reasoning.efforts : []) {
|
|
39
47
|
const id = text(record(entry)?.id)
|
|
40
|
-
if (id
|
|
48
|
+
if (id === undefined || efforts.includes(id)) continue
|
|
49
|
+
if (hidesOff && id === 'off' && id !== defaultEffort) continue
|
|
50
|
+
efforts.push(id)
|
|
41
51
|
}
|
|
42
52
|
return efforts
|
|
43
53
|
}
|
|
@@ -48,10 +58,10 @@ function effortIdsOf(reasoning: Record<string, unknown>): string[] {
|
|
|
48
58
|
* without one is declared to have none. A model the reply never described at
|
|
49
59
|
* all is a different state, expressed by the row carrying no capability.
|
|
50
60
|
*/
|
|
51
|
-
function reasoningOf(model: Record<string, unknown
|
|
61
|
+
function reasoningOf(model: Record<string, unknown>, provider: string | undefined): ModelReasoning {
|
|
52
62
|
const reasoning = record(model.reasoning)
|
|
53
63
|
if (reasoning === undefined) return { supported: false }
|
|
54
|
-
const efforts = effortIdsOf(reasoning)
|
|
64
|
+
const efforts = effortIdsOf(reasoning, provider)
|
|
55
65
|
return { supported: true, ...(efforts.length === 0 ? {} : { efforts }) }
|
|
56
66
|
}
|
|
57
67
|
|
|
@@ -63,7 +73,7 @@ function reasoningOf(model: Record<string, unknown>): ModelReasoning {
|
|
|
63
73
|
function rowOf(model: Record<string, unknown>, provider: string | undefined, withCapability: boolean): ExecutionModelOption | undefined {
|
|
64
74
|
const id = text(model.id)
|
|
65
75
|
if (id === undefined) return undefined
|
|
66
|
-
const reasoning = withCapability ? reasoningOf(model) : undefined
|
|
76
|
+
const reasoning = withCapability ? reasoningOf(model, provider) : undefined
|
|
67
77
|
return {
|
|
68
78
|
id: provider === undefined ? id : `${provider}/${id}`,
|
|
69
79
|
name: text(model.name) ?? id,
|
|
@@ -73,7 +83,7 @@ function rowOf(model: Record<string, unknown>, provider: string | undefined, wit
|
|
|
73
83
|
}
|
|
74
84
|
|
|
75
85
|
/**
|
|
76
|
-
* Normalize a `
|
|
86
|
+
* Normalize a `models/catalog` reply into picker rows: one row per model
|
|
77
87
|
* of every provider group, keyed by the qualified route an execution pins.
|
|
78
88
|
* @param value - the raw catalog reply.
|
|
79
89
|
* @returns the rows, empty when the reply is unreadable.
|
|
@@ -2606,12 +2606,44 @@
|
|
|
2606
2606
|
border-radius: 10px;
|
|
2607
2607
|
}
|
|
2608
2608
|
|
|
2609
|
+
.projectPathRow {
|
|
2610
|
+
display: flex;
|
|
2611
|
+
align-items: center;
|
|
2612
|
+
gap: 6px;
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
.projectPathRow .input {
|
|
2616
|
+
flex: 1;
|
|
2617
|
+
min-width: 0;
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2609
2620
|
.projectDialogActions {
|
|
2610
2621
|
display: flex;
|
|
2611
2622
|
justify-content: flex-end;
|
|
2612
2623
|
gap: 8px;
|
|
2613
2624
|
}
|
|
2614
2625
|
|
|
2626
|
+
.chatUserAction {
|
|
2627
|
+
display: inline-flex;
|
|
2628
|
+
align-items: center;
|
|
2629
|
+
justify-content: center;
|
|
2630
|
+
width: calc(28px + var(--dsh-content-font-delta, 0px));
|
|
2631
|
+
height: calc(28px + var(--dsh-content-font-delta, 0px));
|
|
2632
|
+
padding: 6px;
|
|
2633
|
+
border: none;
|
|
2634
|
+
border-radius: var(--dsw-radius-sm, 6px);
|
|
2635
|
+
background: transparent;
|
|
2636
|
+
color: var(--dsw-alias-label-tertiary);
|
|
2637
|
+
cursor: pointer;
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
@media (hover: hover) {
|
|
2641
|
+
.chatUserAction:hover {
|
|
2642
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
2643
|
+
color: var(--dsw-alias-label-secondary);
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
|
|
2615
2647
|
/* --- AI parse of pasted text (#1540) ------------------------------------------ */
|
|
2616
2648
|
|
|
2617
2649
|
.aiParse {
|