@linxin666/dsh-client-ui-task-board 0.4.22 → 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.
Files changed (40) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +6 -6
  3. package/README.zh.md +6 -6
  4. package/lib/client.js +410 -37
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +45 -27
  7. package/lib/types/client/TaskBoardSettingsCard.d.ts +1 -1
  8. package/lib/types/client/board/NewTaskModal.d.ts +4 -2
  9. package/lib/types/client/board/TaskBoard.d.ts +16 -1
  10. package/lib/types/client/board/model-options.d.ts +2 -2
  11. package/lib/types/client/index.d.ts +1 -1
  12. package/lib/types/client/locales.d.ts +3 -0
  13. package/lib/types/client/native-panel.d.ts +19 -1
  14. package/lib/types/client/session-activity.d.ts +36 -0
  15. package/lib/types/client/user-message-action.d.ts +46 -0
  16. package/lib/types/core/controller.d.ts +16 -0
  17. package/lib/types/core/model-catalog.d.ts +1 -1
  18. package/lib/types/dsh-home.d.ts +13 -3
  19. package/lib/types/host-routes.d.ts +2 -6
  20. package/lib/types/tool-surface.d.ts +6 -2
  21. package/package.json +33 -33
  22. package/src/client/TaskBoardSettingsCard.tsx +2 -2
  23. package/src/client/board/NewTaskModal.tsx +8 -6
  24. package/src/client/board/TaskBoard.tsx +59 -13
  25. package/src/client/board/model-options.ts +18 -8
  26. package/src/client/board.module.css +32 -0
  27. package/src/client/index.ts +31 -19
  28. package/src/client/locales.ts +6 -0
  29. package/src/client/native-panel.tsx +85 -5
  30. package/src/client/session-activity.tsx +163 -0
  31. package/src/client/user-message-action.tsx +211 -0
  32. package/src/core/controller.ts +30 -0
  33. package/src/core/model-catalog.ts +1 -1
  34. package/src/dsh-home.ts +35 -12
  35. package/src/host/agent-tools.ts +8 -0
  36. package/src/host-routes.ts +7 -16
  37. package/src/host-runner.ts +4 -4
  38. package/src/host-service.ts +6 -1
  39. package/src/index.ts +2 -3
  40. package/src/tool-surface.ts +17 -2
package/lib/index.js CHANGED
@@ -43,9 +43,9 @@ function spendCapMessage(usedTokens, cap) {
43
43
  //#endregion
44
44
  //#region src/dsh-home.ts
45
45
  /**
46
- * DSH_HOME resolution shared by the plugin family's Host halves: the
47
- * environment override wins, the platform home fallback follows. Mirrors
48
- * what dsh-pet and dsh-liangshen each used to implement locally.
46
+ * DSH_HOME and DSH_AGENTS_HOME resolution shared by the plugin family's Host
47
+ * halves: environment overrides win (blank values treated as unset), then the
48
+ * platform home fallbacks follow — mirroring `@deepseek-ai/dsh-home-paths`.
49
49
  */
50
50
  /** Expand a leading ~ (or ~user) in a path, platform-style. */
51
51
  function expandHome(path, home = homedir()) {
@@ -54,6 +54,16 @@ function expandHome(path, home = homedir()) {
54
54
  if (path.startsWith("~/") || path.startsWith("~\\")) return j(home, path.slice(2));
55
55
  return path;
56
56
  }
57
+ function resolveUserRoot(envValue, defaultDirName, home) {
58
+ const isPosix = home.startsWith("/");
59
+ const j = isPosix ? join$1 : join;
60
+ const isAbs = isPosix ? isAbsolute$1 : isAbsolute;
61
+ if (envValue !== void 0 && envValue.trim() !== "") {
62
+ const expanded = expandHome(envValue.trim(), home);
63
+ return isAbs(expanded) ? expanded : j(process.cwd(), expanded);
64
+ }
65
+ return j(home, defaultDirName);
66
+ }
57
67
  /**
58
68
  * Resolve the DSH home directory.
59
69
  * @param env - process environment to read DSH_HOME from.
@@ -61,15 +71,7 @@ function expandHome(path, home = homedir()) {
61
71
  * @returns the absolute DSH home path.
62
72
  */
63
73
  function resolveDshHome(env = process.env, home = homedir()) {
64
- const isPosix = home.startsWith("/");
65
- const j = isPosix ? join$1 : join;
66
- const isAbs = isPosix ? isAbsolute$1 : isAbsolute;
67
- const raw = env.DSH_HOME;
68
- if (raw !== void 0 && raw.trim() !== "") {
69
- const expanded = expandHome(raw.trim(), home);
70
- return isAbs(expanded) ? expanded : j(process.cwd(), expanded);
71
- }
72
- return j(home, ".dsh");
74
+ return resolveUserRoot(env.DSH_HOME, ".dsh", home);
73
75
  }
74
76
  /** Resolve the DSH home directory from the live environment. */
75
77
  function dshHome() {
@@ -5865,7 +5867,7 @@ function nonCompletedTurnEnd(data) {
5865
5867
  */
5866
5868
  function invokeWireArgs(namespace, method, request) {
5867
5869
  if (namespace === "agentPresets" && method === "list") return {};
5868
- if (namespace === "session" && method === "modelCatalog") return {};
5870
+ if (namespace === "models" && method === "catalog") return {};
5869
5871
  if (namespace === "session" && method === "list") return { _request: request };
5870
5872
  return { request };
5871
5873
  }
@@ -6151,9 +6153,9 @@ var HostExecutionRunner = class HostExecutionRunner {
6151
6153
  */
6152
6154
  async modelCatalog() {
6153
6155
  try {
6154
- return await this.invoke("session", "modelCatalog", {});
6156
+ return await this.invoke("models", "catalog", {});
6155
6157
  } catch (error) {
6156
- console.warn("[dsh-task-board] session/modelCatalog failed; the board falls back to the pinned route", error);
6158
+ console.warn("[dsh-task-board] models/catalog failed; the board falls back to the pinned route", error);
6157
6159
  return;
6158
6160
  }
6159
6161
  }
@@ -8181,7 +8183,7 @@ var TaskBoardHostService = class {
8181
8183
  */
8182
8184
  onScheduleFire(target) {
8183
8185
  if (this.disposed || !this.active) return;
8184
- const now = this.now();
8186
+ const now = Math.max(this.now(), target);
8185
8187
  this.scheduleTarget = void 0;
8186
8188
  this.ledger.setScheduler({ lastTickAt: now });
8187
8189
  if (now - target > RECOVERY_TOLERANCE_MS) {
@@ -8800,6 +8802,7 @@ function buildTaskBoardTools(host) {
8800
8802
  function buildSetParentTool(host) {
8801
8803
  return defineTool({
8802
8804
  name: "task_board_set_parent",
8805
+ environment: "independent",
8803
8806
  description: [
8804
8807
  "Attach an existing task under a parent (making it a subtask) or detach it back to the root board by setting its parentId.",
8805
8808
  "Pass an empty parentId to detach.",
@@ -8844,6 +8847,7 @@ function buildSetParentTool(host) {
8844
8847
  function buildRunTool(host) {
8845
8848
  return defineTool({
8846
8849
  name: "task_board_run",
8850
+ environment: "independent",
8847
8851
  description: [
8848
8852
  "Run a task on the board now, or re-run a settled one.",
8849
8853
  "Running a card opens ONE session for that card: no session is opened for its subtasks, and the card agent dispatches them itself with subagent. A card whose subtasks are still unfinished runs under the liangshen agent preset and is told which cards to pick up.",
@@ -8908,6 +8912,7 @@ function buildRunTool(host) {
8908
8912
  function buildManageTool(host) {
8909
8913
  return defineTool({
8910
8914
  name: "task_board_manage",
8915
+ environment: "independent",
8911
8916
  description: [
8912
8917
  "Move, archive, restore, delete, or settle one task board card.",
8913
8918
  "move-backlog, move-todo, move-running, move-done and move-failed are the manual column moves and cover every column; a card the runner is executing (one with an open execution) cannot be moved.",
@@ -9053,6 +9058,7 @@ function buildManageTool(host) {
9053
9058
  function buildScheduleTool(host) {
9054
9059
  return defineTool({
9055
9060
  name: "task_board_schedule",
9061
+ environment: "independent",
9056
9062
  description: [
9057
9063
  "Arm, change, or disarm a task scheduled runs. Two kinds of plan exist: a recurring 5-field cron rule (day-of-month and day-of-week follow Vixie semantics: both restricted means OR, otherwise AND), and a one-shot that runs once at a future instant.",
9058
9064
  "For a one-shot pass mode \"once\" with at (the planned instant, ms since epoch UTC). For a recurring rule pass mode \"cron\" (or omit mode) with a cron expression, optionally capped by maxRuns (a positive whole number of scheduled executions; omit for unlimited, pass 0 to clear a cap).",
@@ -9130,6 +9136,7 @@ function buildScheduleTool(host) {
9130
9136
  function buildListTool(host) {
9131
9137
  return defineTool({
9132
9138
  name: "task_board_list",
9139
+ environment: "independent",
9133
9140
  description: [
9134
9141
  "List tasks on the DSH task board (the Host-authoritative ledger behind the Web GUI task board).",
9135
9142
  "Filters: status column, parentId (direct subtasks), rootsOnly, tag, free-text query, and archived inclusion.",
@@ -9211,6 +9218,7 @@ function buildListTool(host) {
9211
9218
  function buildGetTool(host) {
9212
9219
  return defineTool({
9213
9220
  name: "task_board_get",
9221
+ environment: "independent",
9214
9222
  description: [
9215
9223
  "Read one task board card in full: prompt, description, labels, column, parent link, direct subtasks, execution targets, schedule, permission gate state, and the last ten execution attempts with their session ids and outcomes.",
9216
9224
  "Use it before running or editing a card, after a run to read the settled outcome, and to read each subtask card before dispatching it with subagent.",
@@ -9240,6 +9248,7 @@ function buildGetTool(host) {
9240
9248
  function buildCreateTool(host) {
9241
9249
  return defineTool({
9242
9250
  name: "task_board_create",
9251
+ environment: "independent",
9243
9252
  description: [
9244
9253
  "Create a task on the DSH task board, or a subtask by passing parentId.",
9245
9254
  "A subtask inherits every execution target it does not override (workspace, agent preset, permission, model, reasoning effort) from its parent, and inherits the parent human permission confirmation together with an inherited binding.",
@@ -9391,6 +9400,7 @@ function buildCreateTool(host) {
9391
9400
  function buildUpdateTool(host) {
9392
9401
  return defineTool({
9393
9402
  name: "task_board_update",
9403
+ environment: "independent",
9394
9404
  description: [
9395
9405
  "Edit a task board card: title, description, prompt, labels, and the execution targets (workspace, agent preset, permission, model, reasoning effort, session reuse).",
9396
9406
  "Only the fields you pass change; pass an empty string to clear a target, or an empty labels array to clear the labels.",
@@ -9543,11 +9553,15 @@ const PLUGIN_TOOL_SECTION_ORDERS = {
9543
9553
  agents: 220
9544
9554
  };
9545
9555
  /**
9546
- * Build a section provider that renders \`text\` only while at least one of
9547
- * \`toolNames\` is visible to the rendering scope.
9556
+ * Build a section provider that renders `text` only while at least one of
9557
+ * `toolNames` is visible to the rendering scope.
9548
9558
  *
9549
9559
  * The native convention: a tool that a restriction, a preset, or a missing
9550
9560
  * registry removed must not leave guidance behind telling the model to call it.
9561
+ * Under a 0.2.3-alpha.3+ PTC root registry (`PtcToolRegistry`), `tools.get(name,
9562
+ * scope)` exposes only the `run_code` transport while binding registered tools
9563
+ * inside programs; when `run_code` is active in the rendering scope, fall back
9564
+ * to checking the unscoped registry so guidance does not vanish under PTC.
9551
9565
  * An unreadable registry renders the text unchanged — guidance that outlives a
9552
9566
  * momentary read failure is recoverable; guidance for a tool that is gone is
9553
9567
  * not.
@@ -9564,6 +9578,13 @@ function visibleToolText(tools, toolNames, text) {
9564
9578
  } catch {
9565
9579
  return text;
9566
9580
  }
9581
+ if (context.scope !== void 0 && toolNames.length > 0) try {
9582
+ if (tools.get("run_code", context.scope) !== void 0) {
9583
+ for (const name of toolNames) if (tools.get(name) !== void 0) return text;
9584
+ }
9585
+ } catch {
9586
+ return text;
9587
+ }
9567
9588
  return "";
9568
9589
  };
9569
9590
  }
@@ -9802,11 +9823,9 @@ function matchesToken(candidate, expected) {
9802
9823
  */
9803
9824
  function isTrustedTaskBoardRequest(req, access) {
9804
9825
  const connection = access.connection?.();
9805
- if (connection !== void 0) try {
9806
- if (typeof connection.admit === "function") {
9807
- const admission = connection.admit(req);
9808
- if (admission.rejection === void 0 && "peer" in admission && admission.peer !== void 0) return true;
9809
- } else if (typeof connection.requestRejection === "function" && connection.requestRejection(req) === void 0) return true;
9826
+ if (connection !== void 0 && typeof connection.admit === "function") try {
9827
+ const admission = connection.admit(req);
9828
+ if (admission.rejection === void 0 && "peer" in admission && admission.peer !== void 0) return true;
9810
9829
  } catch {}
9811
9830
  if (!browserSameOriginMarker(req)) return false;
9812
9831
  if (isLoopbackRequest(req)) return true;
@@ -10255,7 +10274,7 @@ function mountOnce(packageName, fn) {
10255
10274
  //#endregion
10256
10275
  //#region src/core/model-catalog.ts
10257
10276
  /**
10258
- * Normalize the raw `session/modelCatalog` reply into the shape the board
10277
+ * Normalize the raw `models/catalog` reply into the shape the board
10259
10278
  * reads. Everything is optional in the wire value, so every level is checked:
10260
10279
  * an unreadable catalog degrades to "unknown", never to a crash.
10261
10280
  * @param value - the raw gateway reply.
@@ -10420,7 +10439,7 @@ function resolveConnectionTrust(ctx) {
10420
10439
  try {
10421
10440
  const connection = ctx.get("connection");
10422
10441
  if (connection === void 0 || connection === null) return void 0;
10423
- return typeof connection.admit === "function" || typeof connection.requestRejection === "function" ? connection : void 0;
10442
+ return typeof connection.admit === "function" ? connection : void 0;
10424
10443
  } catch {
10425
10444
  return;
10426
10445
  }
@@ -10733,8 +10752,7 @@ function applyImpl(ctx, config) {
10733
10752
  * \"connection.authentication\" without inject", which escaped every route
10734
10753
  * handler as a bare 400. The scope keeps the row's own inject list unchanged
10735
10754
  * (the service stays optional: a deployment without it keeps the loopback
10736
- * fence), and a cohort whose connection has no authentication sub-service
10737
- * simply never activates this scope, leaving the `requestRejection` bridge.
10755
+ * fence).
10738
10756
  */
10739
10757
  let admittedConnection;
10740
10758
  const scopedInjectConnection = ctx.inject;
@@ -3,7 +3,7 @@
3
3
  * idle-sleep protection. Registers into the `web-ui.plugin.item` child slot
4
4
  * the Web UI plugin group renders, bound to the `task-board` namespace.
5
5
  */
6
- import type { InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
6
+ import type { InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots/client';
7
7
  import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
8
8
  import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
9
9
  import type { TaskBoardExtensionDispatch } from '../core/extension.ts';
@@ -1,4 +1,4 @@
1
- import type { BoardController } from '../../core/controller.ts';
1
+ import type { BoardController, ComposeTaskDraft } from '../../core/controller.ts';
2
2
  import { type TaskRecord } from '../../core/tasks.ts';
3
3
  import type { OverlayPhase } from './overlay.tsx';
4
4
  export interface NewTaskModalProps {
@@ -6,6 +6,8 @@ export interface NewTaskModalProps {
6
6
  onClose: () => void;
7
7
  /** Optional task template to clone/duplicate from. */
8
8
  initialTask?: TaskRecord;
9
+ /** Optional prefilled draft (creates a fresh card, not a duplicate). */
10
+ initialDraft?: ComposeTaskDraft;
9
11
  /**
10
12
  * Workspace the board's project filter has selected (#1536): a task created
11
13
  * while a project is open belongs to that project unless the user changes it.
@@ -23,4 +25,4 @@ export interface NewTaskModalProps {
23
25
  phase?: OverlayPhase;
24
26
  }
25
27
  /** New-task form overlay. */
26
- export declare function NewTaskModal({ controller, onClose, initialTask, defaultWorkspaceId, onDuplicateSuccess, parentTask, phase }: NewTaskModalProps): import("react").JSX.Element;
28
+ export declare function NewTaskModal({ controller, onClose, initialTask, initialDraft, defaultWorkspaceId, onDuplicateSuccess, parentTask, phase }: NewTaskModalProps): import("react").JSX.Element;
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Board view: the multi-column kanban that replaces the middle column while
3
+ * active. Cards open the task detail (never execute directly); the header
4
+ * offers filter, new-task, and a back-to-chat escape.
5
+ */
6
+ import { type ReactNode } from 'react';
1
7
  import { type BoardController } from '../../core/controller.ts';
2
8
  import { type TaskRecord } from '../../core/tasks.ts';
3
9
  /** Sentinel option value of the project row's "register a new project" entry. */
@@ -20,7 +26,16 @@ export declare function matchesFilter(task: TaskRecord, filter: string): boolean
20
26
  export declare function matchesTagFilter(task: TaskRecord, selected: readonly string[]): boolean;
21
27
  /** Cards a grouped column renders before the oldest group folds. */
22
28
  export declare const COLUMN_FOLD_THRESHOLD = 30;
29
+ /** Props accepted by the optional `directory.browser.dialog` slot factory wrapper. */
30
+ export interface ProjectDirectoryDialogProps {
31
+ readonly open: boolean;
32
+ readonly busy: boolean;
33
+ readonly onOpen: (path: string) => void;
34
+ readonly onClose: () => void;
35
+ }
23
36
  /** Board component; subscribes to the controller snapshot. */
24
- export declare function TaskBoard({ controller }: {
37
+ export declare function TaskBoard({ controller, renderDirectoryDialog }: {
25
38
  controller: BoardController;
39
+ /** Optional shell `directory.browser.dialog` factory renderer for choosing a project folder. */
40
+ renderDirectoryDialog?: (props: ProjectDirectoryDialogProps) => ReactNode;
26
41
  }): import("react").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Execution model options: the picker rows built from the official
3
- * `session/modelCatalog` reply, and the reasoning-effort derivation both
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
  *
@@ -19,7 +19,7 @@
19
19
  import type { ExecutionModelOption } from '../../core/controller.ts';
20
20
  import type { TaskBoardKey } from '../locales.ts';
21
21
  /**
22
- * Normalize a `session/modelCatalog` reply into picker rows: one row per model
22
+ * Normalize a `models/catalog` reply into picker rows: one row per model
23
23
  * of every provider group, keyed by the qualified route an execution pins.
24
24
  * @param value - the raw catalog reply.
25
25
  * @returns the rows, empty when the reply is unreadable.
@@ -34,7 +34,7 @@ export interface SettingsFormBinder {
34
34
  /** Bind one family settings namespace. */
35
35
  bind<T>(spec: SettingsFormSpec<T>): ConfigForm<T>;
36
36
  }
37
- declare module '@deepseek-ai/dsh-client-ui-slots' {
37
+ declare module '@deepseek-ai/dsh-client-ui-slots/client' {
38
38
  interface LocaleNamespaceMap {
39
39
  /** Task-board surface copy. */
40
40
  'task-board': TaskBoardKey;
@@ -7,6 +7,7 @@
7
7
  /** zh dictionary (key-set source of truth). */
8
8
  export declare const zh: {
9
9
  'entry.label': string;
10
+ 'activity.title': string;
10
11
  'board.title': string;
11
12
  'board.close': string;
12
13
  'board.new': string;
@@ -41,8 +42,10 @@ export declare const zh: {
41
42
  'board.projectNew': string;
42
43
  'board.projectNewPath': string;
43
44
  'board.projectNewPathPlaceholder': string;
45
+ 'board.projectBrowse': string;
44
46
  'board.projectCreate': string;
45
47
  'board.projectCreateFailed': string;
48
+ 'chat.turnIntoTask': string;
46
49
  'new.aiParse': string;
47
50
  'new.aiParseHint': string;
48
51
  'new.aiParsePlaceholder': string;
@@ -20,6 +20,18 @@ export declare function TaskBoardPanelIcon({ size }: {
20
20
  size: number;
21
21
  active: boolean;
22
22
  }): React.ReactElement;
23
+ /** Slot factory name owned by `@deepseek-ai/dsh-client-ui-directory-picker-browse`. */
24
+ export declare const DIRECTORY_BROWSER_DIALOG_FACTORY = "directory.browser.dialog";
25
+ type RenderFactorySlotFn = (name: string, props: Record<string, unknown>, options?: {
26
+ readonly fallback?: ReactNode;
27
+ }) => ReactNode;
28
+ /** Minimal slice of `ctx.uiWorkspace` needed to drive `directory.browser.dialog`. */
29
+ export interface WorkspaceDirectorySource {
30
+ readonly listDirectory: (path?: string, signal?: AbortSignal) => Promise<unknown>;
31
+ readonly createDirectory?: (path: string, name: string) => Promise<string>;
32
+ }
33
+ /** Whether the host slot registry currently exposes the reusable `directory.browser.dialog` factory. */
34
+ export declare function hasDirectoryBrowserFactory(slots: unknown): boolean;
23
35
  /**
24
36
  * The main-slot page. The layout mounts it only while the board is the selected
25
37
  * panel, so the conversation keeps the center column untouched the rest of the
@@ -29,10 +41,16 @@ export declare function TaskBoardPanelIcon({ size }: {
29
41
  * @param props - the framework main-slot share plus this entry's injected face.
30
42
  * @returns the board page.
31
43
  */
32
- export declare function TaskBoardPanel({ controller, renderSlot }: {
44
+ export declare function TaskBoardPanel({ controller, renderSlot, renderFactorySlot, directorySource, hasDirectoryDialog }: {
33
45
  controller: BoardController;
34
46
  /** Child-slot renderer the registration declares (detail, card decoration, new-card section). */
35
47
  renderSlot?: SlotRenderBinding;
48
+ /** Factory-slot renderer supplied automatically by the shell slot renderer. */
49
+ renderFactorySlot?: RenderFactorySlotFn;
50
+ /** Optional host directory listing/creation calls from `ctx.uiWorkspace`. */
51
+ directorySource?: WorkspaceDirectorySource;
52
+ /** Live check for whether `directory.browser.dialog` is registered in `ctx.slots`. */
53
+ hasDirectoryDialog?: () => boolean;
36
54
  }): ReactNode;
37
55
  /**
38
56
  * Register the board's sidebar row and center-column page.
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Session island activity source for `dsh-task-board`.
3
+ *
4
+ * Reports ongoing task-board executions tied to a Session (either the Session
5
+ * executing a card or the Session that initiated that card's execution) to the
6
+ * official `sessionActivities` service and contributes a matching 16px glyph
7
+ * to `conversation.session.panel.activity.icon`. Reads exclusively from the
8
+ * live {@link BoardController} mirror so observing a Session costs zero extra
9
+ * network traffic.
10
+ */
11
+ import { type ReactNode } from 'react';
12
+ import type { Context as ClientContext } from '@deepseek-ai/cordis';
13
+ import type { BoardController } from '../core/controller.ts';
14
+ import type { TaskRecord } from '../core/tasks.ts';
15
+ /** Stable source id shared with the keyed `conversation.session.panel.activity.icon` entry. */
16
+ export declare const TASK_BOARD_ACTIVITY_ID = "dsh-task-board";
17
+ /** Official `SessionActivityStatus` subset reported to `sessionActivities`. */
18
+ export type TaskBoardActivityStatus = 'queued' | 'running' | 'stopping' | 'done' | 'failed' | 'inactive';
19
+ /** One reported activity unit matching `@deepseek-ai/dsh-client-ui-session-panel`. */
20
+ export interface TaskBoardSessionActivity {
21
+ readonly id: string;
22
+ readonly status: TaskBoardActivityStatus;
23
+ }
24
+ /**
25
+ * Derive the ongoing task activities linked to one Session id.
26
+ * A card counts when it has an unsettled execution (`endedAt === undefined`)
27
+ * whose own `sessionId` or `initiatedBy` matches `sessionId`.
28
+ */
29
+ export declare function taskActivitiesForSession(tasks: readonly TaskRecord[], sessionId: string): readonly TaskBoardSessionActivity[];
30
+ /** 16px task-board glyph rendered in the Session island header toggle. */
31
+ export declare function TaskBoardActivityIcon(): ReactNode;
32
+ /**
33
+ * Register the optional `sessionActivities` source and matching island icon.
34
+ * Returns a disposer releasing both when the board UI unmounts or disables.
35
+ */
36
+ export declare function registerTaskBoardSessionActivity(ctx: ClientContext, controller: Pick<BoardController, 'getSnapshot' | 'subscribe'>): () => void;
@@ -0,0 +1,46 @@
1
+ import type { Context as ClientContext } from '@deepseek-ai/cordis';
2
+ import type { BoardController, ComposeTaskDraft } from '../core/controller.ts';
3
+ /** Stable slot entry id inside `conversation.chat.user-actions`. */
4
+ export declare const USER_ACTION_CREATE_TASK_ID = "task-board-create-card";
5
+ interface ChatUserNodeLike {
6
+ readonly kind?: string;
7
+ readonly data?: {
8
+ readonly messageId?: unknown;
9
+ readonly content?: unknown;
10
+ };
11
+ readonly messageId?: unknown;
12
+ readonly content?: unknown;
13
+ }
14
+ /** Structural slice of the official `ChatSnapshot` exposed through `useChat`. */
15
+ export interface ChatSnapshotLike {
16
+ readonly nodes?: {
17
+ values?(): readonly ChatUserNodeLike[];
18
+ };
19
+ readonly legacy?: {
20
+ readonly nodes?: readonly ChatUserNodeLike[];
21
+ };
22
+ }
23
+ /** Standard props passed by the shell renderer to a `conversation.chat.user-actions` entry. */
24
+ export interface UserMessageTaskActionProps {
25
+ readonly messageId: unknown;
26
+ readonly sessionId?: unknown;
27
+ readonly useChat?: <T>(selector: (snapshot: ChatSnapshotLike) => T) => T;
28
+ }
29
+ /** Optional resolver mapping a session id to its owning task-board workspace id. */
30
+ export type WorkspaceIdResolver = (sessionId: string) => string | undefined;
31
+ /**
32
+ * Extract the plain text of a durable user message identified by `messageId`
33
+ * from an official `ChatSnapshot`. Returns an empty string when absent.
34
+ */
35
+ export declare function extractUserMessageText(snapshot: ChatSnapshotLike | undefined, messageId: unknown): string;
36
+ /**
37
+ * Build a prefilled {@link ComposeTaskDraft} from a durable user message's text
38
+ * and optional owning workspace id.
39
+ */
40
+ export declare function draftFromUserMessage(text: string, workspaceId?: string): ComposeTaskDraft;
41
+ /**
42
+ * Register the "Turn into task card" icon action into `conversation.chat.user-actions`.
43
+ * When the shell does not declare that slot, nothing registers and nothing fails.
44
+ */
45
+ export declare function registerUserMessageTaskAction(ctx: ClientContext, controller: Pick<BoardController, 'openNewTaskWithDraft'>, resolveWorkspaceId?: WorkspaceIdResolver): () => void;
46
+ export {};
@@ -131,6 +131,13 @@ export interface ExecutionOptionsSnapshot {
131
131
  * constants the UI reads (session default permission, subtask depth).
132
132
  */
133
133
  export type HostMirror = Pick<TaskBoardSnapshot, 'revision' | 'extensionsRevision' | 'scheduler' | 'power' | 'sessionDefaultPermission' | 'maxSubtaskDepth' | 'cardDefaults' | 'extensions' | 'attachmentLimits'>;
134
+ /** Optional prefilled draft handed to the board's create-task modal (e.g. from a chat message action). */
135
+ export interface ComposeTaskDraft {
136
+ readonly title?: string;
137
+ readonly description?: string;
138
+ readonly prompt?: string;
139
+ readonly workspaceId?: string;
140
+ }
134
141
  /** Immutable controller snapshot for UI subscriptions. */
135
142
  export interface ControllerSnapshot {
136
143
  tasks: readonly TaskRecord[];
@@ -171,6 +178,7 @@ export declare class BoardController {
171
178
  private boardOpen;
172
179
  private archiveView;
173
180
  private selectedTaskId;
181
+ private pendingComposeDraft;
174
182
  private executionOptions;
175
183
  private workspaceCreator;
176
184
  private listeners;
@@ -234,6 +242,14 @@ export declare class BoardController {
234
242
  * shows the conversation.
235
243
  */
236
244
  openBoard(): void;
245
+ /**
246
+ * Queue a prefilled draft for the create-task modal and open the board panel.
247
+ * Stored outside {@link BoardSnapshot} so existing snapshot equality holds;
248
+ * the mounted {@link TaskBoard} consumes it once on mount or update.
249
+ */
250
+ openNewTaskWithDraft(draft: ComposeTaskDraft): void;
251
+ /** Read and clear any queued create-task draft. */
252
+ consumeComposeDraft(): ComposeTaskDraft | undefined;
237
253
  /**
238
254
  * Return the center column to the conversation. The layout's own selection is
239
255
  * the source of truth for what the column renders, so this asks for the
@@ -49,7 +49,7 @@ export declare function parseModelRoute(qualified: string | undefined): {
49
49
  model: string;
50
50
  } | undefined;
51
51
  /**
52
- * Normalize the raw `session/modelCatalog` reply into the shape the board
52
+ * Normalize the raw `models/catalog` reply into the shape the board
53
53
  * reads. Everything is optional in the wire value, so every level is checked:
54
54
  * an unreadable catalog degrades to "unknown", never to a crash.
55
55
  * @param value - the raw gateway reply.
@@ -1,7 +1,7 @@
1
1
  /**
2
- * DSH_HOME resolution shared by the plugin family's Host halves: the
3
- * environment override wins, the platform home fallback follows. Mirrors
4
- * what dsh-pet and dsh-liangshen each used to implement locally.
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: `requestRejection` runs the Host/Origin fence and verifies
17
- * the authority-bound `dsh-auth-*` browser session minted by the Host. It
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 \`text\` only while at least one of
60
- * \`toolNames\` is visible to the rendering scope.
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.