@linxin666/dsh-client-ui-task-board 0.4.20 → 0.4.22
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 +2 -1
- package/README.zh.md +2 -1
- package/lib/client.js +55 -63
- package/lib/client.js.map +1 -1
- package/lib/index.js +181 -45
- package/lib/types/client/board/AttachmentField.d.ts +3 -1
- package/lib/types/client/locales.d.ts +1 -0
- package/lib/types/core/extension.d.ts +25 -0
- package/lib/types/core/tasks.d.ts +23 -3
- package/lib/types/core/use-cases/task-update.d.ts +25 -17
- package/lib/types/host/agent-tools.d.ts +5 -0
- package/lib/types/host/extension-registry.d.ts +8 -0
- package/lib/types/host-service.d.ts +5 -1
- package/lib/types/protocol.d.ts +9 -0
- package/package.json +28 -28
- package/src/client/board/AttachmentField.tsx +6 -1
- package/src/client/board/EditTaskModal.tsx +4 -1
- package/src/client/board/ExecutionLog.tsx +6 -0
- package/src/client/board/TaskDetail.tsx +16 -11
- package/src/client/locales.ts +2 -0
- package/src/core/execution-summary.ts +3 -2
- package/src/core/extension.ts +21 -0
- package/src/core/store.ts +4 -0
- package/src/core/tasks.ts +27 -3
- package/src/core/use-cases/task-update.ts +29 -19
- package/src/host/agent-tools.ts +62 -15
- package/src/host/extension-registry.ts +36 -0
- package/src/host-ledger.ts +33 -10
- package/src/host-service.ts +10 -0
- package/src/protocol.ts +32 -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.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
2
|
+
import { type TaskRecord } from '../core/tasks.ts';
|
|
2
3
|
import type { TaskBoardAction, TaskBoardSnapshot } from '../protocol.ts';
|
|
3
4
|
import type { TaskBoardLaunchTrigger } from '../core/extension.ts';
|
|
4
5
|
/**
|
|
@@ -14,6 +15,10 @@ export interface TaskBoardToolHost {
|
|
|
14
15
|
* a provider's launch handler can tell an agent's run from a person's.
|
|
15
16
|
*/
|
|
16
17
|
apply(requestId: string, action: TaskBoardAction, initiator?: string, trigger?: TaskBoardLaunchTrigger): TaskBoardSnapshot | Promise<TaskBoardSnapshot>;
|
|
18
|
+
/** What running providers say about one card, keyed by extension id (optional). */
|
|
19
|
+
describeTask?(task: TaskRecord): Record<string, Record<string, unknown>> | undefined;
|
|
20
|
+
/** The run handle a provider holds for one card, keyed by extension id (optional). */
|
|
21
|
+
describeRun?(taskId: string): Record<string, Record<string, unknown>> | undefined;
|
|
17
22
|
}
|
|
18
23
|
/** Registered tool names, in registration order. */
|
|
19
24
|
export declare const TASK_BOARD_TOOL_NAMES: readonly ["task_board_list", "task_board_get", "task_board_create", "task_board_update", "task_board_set_parent", "task_board_run", "task_board_manage", "task_board_schedule"];
|
|
@@ -119,6 +119,14 @@ export declare class TaskBoardExtensionRegistry {
|
|
|
119
119
|
* @returns the first decision a running provider made, or undefined.
|
|
120
120
|
*/
|
|
121
121
|
interceptLaunch(task: TaskRecord, context: TaskBoardLaunchContext): TaskBoardLaunchDecision | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* What the running providers say about one card, keyed by extension id.
|
|
124
|
+
* Isolated per provider: a throw drops that provider's entry only.
|
|
125
|
+
*/
|
|
126
|
+
describeTask(task: TaskRecord): Record<string, Record<string, unknown>> | undefined;
|
|
127
|
+
/** The run handle a running provider holds for one card, keyed by extension id. */
|
|
128
|
+
describeRun(taskId: string): Record<string, Record<string, unknown>> | undefined;
|
|
129
|
+
private describe;
|
|
122
130
|
/** Published summaries of currently running providers, keyed by extension id. */
|
|
123
131
|
published(): Record<string, TaskBoardExtensionPayload>;
|
|
124
132
|
/** Fan a status change out to every running provider, isolated per callback. */
|
|
@@ -6,7 +6,7 @@ import { type TaskBoardAction, type TaskBoardEventPayload, type TaskBoardSnapsho
|
|
|
6
6
|
import type { CardDefaults } from './core/card-defaults.ts';
|
|
7
7
|
import { TaskBoardExtensionRegistry, type TaskBoardExtensionLogger } from './host/extension-registry.ts';
|
|
8
8
|
import type { TaskBoardExtension, TaskBoardLaunchTrigger } from './core/extension.ts';
|
|
9
|
-
import { type ScheduleMode } from './core/tasks.ts';
|
|
9
|
+
import { type ScheduleMode, type TaskRecord } from './core/tasks.ts';
|
|
10
10
|
import type { ModelCatalogView } from './core/model-catalog.ts';
|
|
11
11
|
import type { TaskPermission } from './core/handover.ts';
|
|
12
12
|
import { type ModelInfoResolver, type TaskBoardAttachmentStore } from './host/attachments.ts';
|
|
@@ -204,6 +204,10 @@ export declare class TaskBoardHostService {
|
|
|
204
204
|
* disposer releases it (its stored data stays).
|
|
205
205
|
*/
|
|
206
206
|
registerExtension(extension: TaskBoardExtension): () => void;
|
|
207
|
+
/** What running providers say about one card, for the model-facing tools. */
|
|
208
|
+
describeTask(task: TaskRecord): Record<string, Record<string, unknown>> | undefined;
|
|
209
|
+
/** The run handle a running provider holds for one card, for `task_board_run`. */
|
|
210
|
+
describeRun(taskId: string): Record<string, Record<string, unknown>> | undefined;
|
|
207
211
|
/**
|
|
208
212
|
* The host model catalog the settings card's model and reasoning-level
|
|
209
213
|
* choices come from.
|
package/lib/types/protocol.d.ts
CHANGED
|
@@ -187,7 +187,16 @@ export type TaskBoardAction = {
|
|
|
187
187
|
taskId: string;
|
|
188
188
|
result: 'succeeded' | 'failed';
|
|
189
189
|
initiatedBy: string;
|
|
190
|
+
/** Success: stored as the execution summary. Failure: stored as the error text. */
|
|
190
191
|
summary?: string;
|
|
192
|
+
/** Id the execution record takes, so a handle returned at launch stays valid. */
|
|
193
|
+
executionId?: string;
|
|
194
|
+
/** Instant the outside run started (ms epoch); the record starts there instead of at settlement. */
|
|
195
|
+
startedAt?: number;
|
|
196
|
+
/** Failure only: stable machine-readable code. */
|
|
197
|
+
errorCode?: string;
|
|
198
|
+
/** Failure only: one line on whether and how to retry. */
|
|
199
|
+
retryHint?: string;
|
|
191
200
|
} | {
|
|
192
201
|
kind: 'set-schedule';
|
|
193
202
|
taskId: string;
|
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.22",
|
|
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.2"
|
|
26
26
|
},
|
|
27
27
|
"bundle": {
|
|
28
28
|
"patch": "./cordis.patch.yml"
|
|
@@ -42,38 +42,38 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@deepseek-ai/dsh": ">=0.2.
|
|
45
|
+
"@deepseek-ai/dsh": ">=0.2.3-alpha.2",
|
|
46
46
|
"react": "^18.2.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@deepseek-ai/schemastery": "
|
|
49
|
+
"@deepseek-ai/schemastery": "~3.20.0-alpha.1",
|
|
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.1",
|
|
54
|
+
"@deepseek-ai/dsh-agent": "^0.2.3-alpha.2",
|
|
55
|
+
"@deepseek-ai/dsh-agent-preset-registry": "^0.2.3-alpha.2",
|
|
56
|
+
"@deepseek-ai/dsh-attachment": "^0.2.3-alpha.2",
|
|
57
|
+
"@deepseek-ai/dsh-api-gateway": "^0.2.3-alpha.2",
|
|
58
|
+
"@deepseek-ai/dsh-api-remotes": "^0.2.3-alpha.2",
|
|
59
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.2.3-alpha.2",
|
|
60
|
+
"@deepseek-ai/dsh-api-workspace-controller": "^0.2.3-alpha.2",
|
|
61
|
+
"@deepseek-ai/dsh-client-connection": "^0.2.3-alpha.2",
|
|
62
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.3-alpha.2",
|
|
63
|
+
"@deepseek-ai/dsh-client-store": "^0.2.3-alpha.2",
|
|
64
|
+
"@deepseek-ai/dsh-client-ui-layout": "^0.2.3-alpha.2",
|
|
65
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.3-alpha.2",
|
|
66
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.2.3-alpha.2",
|
|
67
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "^0.2.3-alpha.2",
|
|
68
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.3-alpha.2",
|
|
69
|
+
"@deepseek-ai/dsh-client-ui-workspace": "^0.2.3-alpha.2",
|
|
70
|
+
"@deepseek-ai/dsh-commands": "^0.2.3-alpha.2",
|
|
71
|
+
"@deepseek-ai/dsh-host-webserver": "^0.2.3-alpha.2",
|
|
72
|
+
"@deepseek-ai/dsh-llm": "^0.2.3-alpha.2",
|
|
73
|
+
"@deepseek-ai/dsh-settings": "^0.2.3-alpha.2",
|
|
74
|
+
"@deepseek-ai/dsh-system-prompt": "^0.2.3-alpha.2",
|
|
75
|
+
"@deepseek-ai/dsh-tools": "^0.2.3-alpha.2",
|
|
76
|
+
"@deepseek-ai/dsh-workspace": "^0.2.3-alpha.2",
|
|
77
77
|
"@types/node": "^22.20.0",
|
|
78
78
|
"@types/react": "~18.3.1",
|
|
79
79
|
"@types/react-dom": "^18.3.5",
|
|
@@ -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>}
|
|
@@ -62,7 +62,10 @@ function ExecutionRow({ execution, timeZone, onOpen }: {
|
|
|
62
62
|
// it prints verbatim, in the neutral secondary style the row's other metadata
|
|
63
63
|
// uses. A failed or cancelled one still reads as the error it is, and so does
|
|
64
64
|
// every text a Host-run execution recorded.
|
|
65
|
+
// New records keep that conclusion on `summary`; the error-field reading stays
|
|
66
|
+
// for the succeeded external records written before the two were separated.
|
|
65
67
|
const recordedConclusion = external && result === 'succeeded'
|
|
68
|
+
const conclusion = execution.summary?.text
|
|
66
69
|
return (
|
|
67
70
|
<li
|
|
68
71
|
className={css.executionRow}
|
|
@@ -101,6 +104,9 @@ function ExecutionRow({ execution, timeZone, onOpen }: {
|
|
|
101
104
|
{t('detail.execution.initiator', { session: execution.initiatedBy })}
|
|
102
105
|
</span>
|
|
103
106
|
)}
|
|
107
|
+
{conclusion !== undefined && (
|
|
108
|
+
<span className={css.executionTimes}>{conclusion}</span>
|
|
109
|
+
)}
|
|
104
110
|
{execution.error !== undefined && execution.error !== '' && (
|
|
105
111
|
<span className={recordedConclusion ? css.executionTimes : css.executionError}>
|
|
106
112
|
{recordedConclusion ? execution.error : failureText(execution.error)}
|
|
@@ -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"
|
package/src/client/locales.ts
CHANGED
|
@@ -159,6 +159,7 @@ export const zh = {
|
|
|
159
159
|
'detail.close': '关闭',
|
|
160
160
|
'edit.title': '编辑任务',
|
|
161
161
|
'edit.save': '保存',
|
|
162
|
+
'edit.attachmentsLocked': '附件已随首次执行固定:执行记录不快照附件,修改请用「复制为新任务」。',
|
|
162
163
|
'new.duplicateTitle': '新建任务(副本)',
|
|
163
164
|
'new.archiveOriginal': '创建后归档原任务',
|
|
164
165
|
'detail.prompt': '执行 Prompt',
|
|
@@ -558,6 +559,7 @@ export const en: Record<keyof typeof zh, string> = {
|
|
|
558
559
|
'detail.close': 'Close',
|
|
559
560
|
'edit.title': 'Edit Task',
|
|
560
561
|
'edit.save': 'Save',
|
|
562
|
+
'edit.attachmentsLocked': 'Attachments froze with the first run: execution records do not snapshot attachments; use Duplicate as new copy to change them.',
|
|
561
563
|
'new.duplicateTitle': 'New Task (Copy)',
|
|
562
564
|
'new.archiveOriginal': 'Archive original task upon creation',
|
|
563
565
|
'detail.prompt': 'Run Prompt',
|
|
@@ -89,8 +89,9 @@ export function executionSummaryOf(events: readonly SummaryEvent[], startedAt: n
|
|
|
89
89
|
export function normalizeExecutionSummary(value: unknown): ExecutionSummary | undefined {
|
|
90
90
|
if (typeof value !== 'object' || value === null) return undefined
|
|
91
91
|
const row = value as Record<string, unknown>
|
|
92
|
-
if (typeof row.text !== 'string'
|
|
92
|
+
if (typeof row.text !== 'string') return undefined
|
|
93
|
+
if (row.seq !== undefined && (typeof row.seq !== 'number' || !Number.isFinite(row.seq))) return undefined
|
|
93
94
|
const text = row.text.trim()
|
|
94
95
|
if (text === '') return undefined
|
|
95
|
-
return { text: truncateExecutionSummary(text), seq: row.seq }
|
|
96
|
+
return { text: truncateExecutionSummary(text), ...(row.seq === undefined ? {} : { seq: row.seq }) }
|
|
96
97
|
}
|
package/src/core/extension.ts
CHANGED
|
@@ -316,6 +316,13 @@ export type TaskBoardLaunchDecision =
|
|
|
316
316
|
* `record-external-outcome` action once its own run settles.
|
|
317
317
|
*/
|
|
318
318
|
| { kind: 'external' }
|
|
319
|
+
/**
|
|
320
|
+
* The provider refuses this run. The board opens nothing, writes nothing and
|
|
321
|
+
* answers the caller with `code: reason`, so a second run request against a
|
|
322
|
+
* card the provider already holds is an explicit refusal rather than a
|
|
323
|
+
* silent overwrite. A scheduled occurrence is skipped instead of thrown.
|
|
324
|
+
*/
|
|
325
|
+
| { kind: 'refuse'; code: string; reason: string }
|
|
319
326
|
|
|
320
327
|
/**
|
|
321
328
|
* Decide whether one launch belongs to the provider, and how it runs.
|
|
@@ -437,6 +444,20 @@ export interface TaskBoardExtension {
|
|
|
437
444
|
stop?(): void
|
|
438
445
|
/** Route one dispatched action; the returned value goes back to the dispatcher. */
|
|
439
446
|
handleAction?(request: TaskBoardExtensionActionRequest): unknown | Promise<unknown>
|
|
447
|
+
/**
|
|
448
|
+
* Model-facing summary of one card this provider owns, merged into the card
|
|
449
|
+
* the `task_board_get` / `task_board_list` tools return under `remote`. An
|
|
450
|
+
* object may carry `localPermission: false` to say the board's local session
|
|
451
|
+
* permission gate does not apply to the card, which drops `permissionPending`
|
|
452
|
+
* from the tool output. Optional: the API version stays 1.
|
|
453
|
+
*/
|
|
454
|
+
describeTask?(task: TaskRecord): Record<string, unknown> | undefined
|
|
455
|
+
/**
|
|
456
|
+
* The handle of the run the provider took over for `taskId`, read right after
|
|
457
|
+
* `task_board_run` so the caller gets identifiers instead of an empty list.
|
|
458
|
+
* Optional on the same terms as {@link TaskBoardExtension.describeTask}.
|
|
459
|
+
*/
|
|
460
|
+
describeRun?(taskId: string): Record<string, unknown> | undefined
|
|
440
461
|
}
|
|
441
462
|
|
|
442
463
|
/** Board mirror an extension's browser half observes. */
|
package/src/core/store.ts
CHANGED
|
@@ -88,6 +88,8 @@ function isTaskRecordShape(value: unknown): value is Omit<TaskRecord, 'status'>
|
|
|
88
88
|
if (entry.initiatedBy !== undefined && typeof entry.initiatedBy !== 'string') return false
|
|
89
89
|
if (entry.frozenBy !== undefined && typeof entry.frozenBy !== 'string') return false
|
|
90
90
|
if (entry.frozenAt !== undefined && typeof entry.frozenAt !== 'number') return false
|
|
91
|
+
if (entry.promptSnapshot !== undefined && typeof entry.promptSnapshot !== 'string') return false
|
|
92
|
+
if (entry.titleSnapshot !== undefined && typeof entry.titleSnapshot !== 'string') return false
|
|
91
93
|
// An external-outcome marker is optional in BOTH directions: a ledger
|
|
92
94
|
// written before the field existed carries none, and a non-boolean value
|
|
93
95
|
// is dropped by the repair below rather than trusted as provenance.
|
|
@@ -280,6 +282,8 @@ export function parseLedger(raw: string | null): TaskRecord[] {
|
|
|
280
282
|
// is what the history is for, and only its instructions are unrecoverable.
|
|
281
283
|
rework: normalizeExecutionRework(execution.rework),
|
|
282
284
|
external: execution.external === true ? true : undefined,
|
|
285
|
+
errorCode: typeof execution.errorCode === 'string' && execution.errorCode !== '' ? execution.errorCode : undefined,
|
|
286
|
+
retryHint: typeof execution.retryHint === 'string' && execution.retryHint !== '' ? execution.retryHint : undefined,
|
|
283
287
|
}))
|
|
284
288
|
// Execution targets are normalized like the schedule: blank strings
|
|
285
289
|
// clear the pin and unknown permission strings from a future version
|
package/src/core/tasks.ts
CHANGED
|
@@ -27,8 +27,11 @@ export type ExecutionOutcome = 'succeeded' | 'failed' | 'cancelled'
|
|
|
27
27
|
export interface ExecutionSummary {
|
|
28
28
|
/** Last assistant message text of the run, bounded by {@link EXECUTION_SUMMARY_LIMIT}. */
|
|
29
29
|
text: string
|
|
30
|
-
/**
|
|
31
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Seq of the session event that text came from. Absent on an external run's
|
|
32
|
+
* conclusion, which was never read out of a Host session.
|
|
33
|
+
*/
|
|
34
|
+
seq?: number
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
/**
|
|
@@ -75,8 +78,16 @@ export interface ExecutionRecord {
|
|
|
75
78
|
endedAt: number | undefined
|
|
76
79
|
/** Outcome once settled. */
|
|
77
80
|
result: ExecutionOutcome | undefined
|
|
78
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* Human failure text when the run failed (prompt rejection or agent error).
|
|
83
|
+
* Only a failure writes it: an external run's success conclusion rides
|
|
84
|
+
* {@link ExecutionRecord.summary}.
|
|
85
|
+
*/
|
|
79
86
|
error: string | undefined
|
|
87
|
+
/** Stable machine-readable failure code a provider reported with the verdict. */
|
|
88
|
+
errorCode?: string
|
|
89
|
+
/** One line telling the caller whether and how to retry a failed external run. */
|
|
90
|
+
retryHint?: string
|
|
80
91
|
/**
|
|
81
92
|
* Session id of the DSH session that issued the run/rerun action (issue #6
|
|
82
93
|
* audit origin). Client-asserted, not a trust boundary; absent when the run
|
|
@@ -109,6 +120,15 @@ export interface ExecutionRecord {
|
|
|
109
120
|
frozenAt?: number
|
|
110
121
|
/** Freeze source session captured from the card snapshot when the run opened. */
|
|
111
122
|
frozenBy?: string
|
|
123
|
+
/**
|
|
124
|
+
* The prompt this execution was opened with, captured at run start. The
|
|
125
|
+
* card's prompt stays editable between runs; this snapshot — not the live
|
|
126
|
+
* field — is the record of what actually ran. Absent on executions recorded
|
|
127
|
+
* before snapshots were introduced.
|
|
128
|
+
*/
|
|
129
|
+
promptSnapshot?: string
|
|
130
|
+
/** Title captured alongside {@link promptSnapshot} when the run opened. */
|
|
131
|
+
titleSnapshot?: string
|
|
112
132
|
/**
|
|
113
133
|
* Cascade run group shared by the parent execution and every descendant
|
|
114
134
|
* execution one run request opened. Absent on a plain single-task run.
|
|
@@ -830,6 +850,10 @@ export function startExecution(
|
|
|
830
850
|
frozenAt: task.freeze.frozenAt,
|
|
831
851
|
...(task.freeze.frozenBy === undefined ? {} : { frozenBy: task.freeze.frozenBy }),
|
|
832
852
|
}),
|
|
853
|
+
// Freeze the content this run was opened with; the card may be edited
|
|
854
|
+
// between runs, but history answers from these snapshots, not the card.
|
|
855
|
+
promptSnapshot: task.prompt,
|
|
856
|
+
titleSnapshot: task.title,
|
|
833
857
|
}
|
|
834
858
|
return {
|
|
835
859
|
task: {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* back to the runtime default); an unknown permission string is ignored so
|
|
9
9
|
* stale UI can never persist a value the execution service rejects.
|
|
10
10
|
*/
|
|
11
|
-
import { freezeOf, isTaskPermission, normalizeTags, normalizeTargetId, type TaskRecord, type TaskPermission, type TaskTag } from '../tasks.ts'
|
|
11
|
+
import { freezeOf, hasOpenExecution, isTaskPermission, normalizeTags, normalizeTargetId, type TaskRecord, type TaskPermission, type TaskTag } from '../tasks.ts'
|
|
12
12
|
import { normalizeAttachments, type TaskAttachment } from '../attachment.ts'
|
|
13
13
|
import type { FreezeSnapshot } from '../freeze-snapshot.ts'
|
|
14
14
|
import type { TaskHandoverInput } from '../handover.ts'
|
|
@@ -39,23 +39,19 @@ export type TaskUpdatePatch = Partial<Pick<TaskRecord, 'title' | 'description' |
|
|
|
39
39
|
attachments?: TaskAttachment[] | null
|
|
40
40
|
}
|
|
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 const TASK_CONTENT_FIELDS = ['title', 'description', 'prompt'] as const
|
|
48
|
-
|
|
49
42
|
/**
|
|
50
|
-
* The fields that freeze with the
|
|
51
|
-
* the attachments it carries.
|
|
43
|
+
* The fields that freeze with the first run. Split by what keeps them honest:
|
|
52
44
|
*
|
|
53
|
-
* The
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
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.
|
|
58
53
|
*/
|
|
54
|
+
export const TASK_CONTENT_FIELDS = ['title', 'description', 'prompt'] as const
|
|
59
55
|
export const TASK_FROZEN_FIELDS = [...TASK_CONTENT_FIELDS, 'attachments'] as const
|
|
60
56
|
|
|
61
57
|
/** Whether an update patch touches any task-content field. */
|
|
@@ -65,12 +61,26 @@ export function hasContentPatch(patch: TaskUpdatePatch): boolean {
|
|
|
65
61
|
|
|
66
62
|
/**
|
|
67
63
|
* Whether a task's content may still be edited: the task must be on-board
|
|
68
|
-
* (not archived) and must
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
64
|
+
* (not archived) and must not have an open execution. Settled history does
|
|
65
|
+
* NOT lock the card: new execution records carry the prompt/title snapshot
|
|
66
|
+
* they were opened with (`promptSnapshot`/`titleSnapshot`), so a
|
|
67
|
+
* post-run edit changes only the next run, never the audit trail. The run,
|
|
68
|
+
* not the column, stays the trigger: a card parked in 'running' by hand has
|
|
69
|
+
* nothing recorded yet and stays editable, and a card mid-run is locked
|
|
70
|
+
* until its execution settles.
|
|
72
71
|
*/
|
|
73
72
|
export function canEditTaskContent(task: TaskRecord): boolean {
|
|
73
|
+
return task.archivedAt === undefined && !hasOpenExecution(task)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Whether a task's attachments may still be edited: unlike the content
|
|
78
|
+
* fields, attachments are NOT captured on the execution record, so they keep
|
|
79
|
+
* the historical boundary — editable until the first run opens, frozen for
|
|
80
|
+
* every executed or archived card afterwards. The record of what ran keeps
|
|
81
|
+
* referencing exactly what ran.
|
|
82
|
+
*/
|
|
83
|
+
export function canEditTaskAttachments(task: TaskRecord): boolean {
|
|
74
84
|
return task.archivedAt === undefined && task.executions.length === 0
|
|
75
85
|
}
|
|
76
86
|
|