@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.
Files changed (51) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +7 -6
  3. package/README.zh.md +7 -6
  4. package/lib/client.js +452 -95
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +84 -47
  7. package/lib/types/client/TaskBoardSettingsCard.d.ts +1 -1
  8. package/lib/types/client/board/AttachmentField.d.ts +3 -1
  9. package/lib/types/client/board/NewTaskModal.d.ts +4 -2
  10. package/lib/types/client/board/TaskBoard.d.ts +16 -1
  11. package/lib/types/client/board/model-options.d.ts +2 -2
  12. package/lib/types/client/index.d.ts +1 -1
  13. package/lib/types/client/locales.d.ts +4 -0
  14. package/lib/types/client/native-panel.d.ts +19 -1
  15. package/lib/types/client/session-activity.d.ts +36 -0
  16. package/lib/types/client/user-message-action.d.ts +46 -0
  17. package/lib/types/core/controller.d.ts +16 -0
  18. package/lib/types/core/model-catalog.d.ts +1 -1
  19. package/lib/types/core/tasks.d.ts +9 -0
  20. package/lib/types/core/use-cases/task-update.d.ts +25 -17
  21. package/lib/types/dsh-home.d.ts +13 -3
  22. package/lib/types/host-routes.d.ts +2 -6
  23. package/lib/types/tool-surface.d.ts +6 -2
  24. package/package.json +33 -33
  25. package/src/client/TaskBoardSettingsCard.tsx +2 -2
  26. package/src/client/board/AttachmentField.tsx +6 -1
  27. package/src/client/board/EditTaskModal.tsx +4 -1
  28. package/src/client/board/NewTaskModal.tsx +8 -6
  29. package/src/client/board/TaskBoard.tsx +59 -13
  30. package/src/client/board/TaskDetail.tsx +16 -11
  31. package/src/client/board/model-options.ts +18 -8
  32. package/src/client/board.module.css +32 -0
  33. package/src/client/index.ts +31 -19
  34. package/src/client/locales.ts +8 -0
  35. package/src/client/native-panel.tsx +85 -5
  36. package/src/client/session-activity.tsx +163 -0
  37. package/src/client/user-message-action.tsx +211 -0
  38. package/src/core/controller.ts +30 -0
  39. package/src/core/model-catalog.ts +1 -1
  40. package/src/core/store.ts +2 -0
  41. package/src/core/tasks.ts +13 -0
  42. package/src/core/use-cases/task-update.ts +29 -19
  43. package/src/dsh-home.ts +35 -12
  44. package/src/host/agent-tools.ts +8 -0
  45. package/src/host-ledger.ts +11 -5
  46. package/src/host-routes.ts +7 -16
  47. package/src/host-runner.ts +4 -4
  48. package/src/host-service.ts +6 -1
  49. package/src/index.ts +2 -3
  50. package/src/protocol.ts +4 -0
  51. package/src/tool-surface.ts +17 -2
@@ -162,6 +162,14 @@ export interface ExecutionOptionsSnapshot {
162
162
  */
163
163
  export type HostMirror = Pick<TaskBoardSnapshot, 'revision' | 'extensionsRevision' | 'scheduler' | 'power' | 'sessionDefaultPermission' | 'maxSubtaskDepth' | 'cardDefaults' | 'extensions' | 'attachmentLimits'>
164
164
 
165
+ /** Optional prefilled draft handed to the board's create-task modal (e.g. from a chat message action). */
166
+ export interface ComposeTaskDraft {
167
+ readonly title?: string
168
+ readonly description?: string
169
+ readonly prompt?: string
170
+ readonly workspaceId?: string
171
+ }
172
+
165
173
  /** Immutable controller snapshot for UI subscriptions. */
166
174
  export interface ControllerSnapshot {
167
175
  tasks: readonly TaskRecord[]
@@ -226,6 +234,7 @@ export class BoardController {
226
234
  private boardOpen = false
227
235
  private archiveView = false
228
236
  private selectedTaskId: string | undefined
237
+ private pendingComposeDraft: ComposeTaskDraft | undefined
229
238
  private executionOptions: ExecutionOptionsSnapshot = { workspaces: [], presets: [], models: [] }
230
239
  private workspaceCreator: WorkspaceCreator | undefined
231
240
  private listeners = new Set<() => void>()
@@ -388,6 +397,27 @@ export class BoardController {
388
397
  this.selectPanel(TASK_BOARD_PANEL_ID)
389
398
  }
390
399
 
400
+ /**
401
+ * Queue a prefilled draft for the create-task modal and open the board panel.
402
+ * Stored outside {@link BoardSnapshot} so existing snapshot equality holds;
403
+ * the mounted {@link TaskBoard} consumes it once on mount or update.
404
+ */
405
+ openNewTaskWithDraft(draft: ComposeTaskDraft): void {
406
+ this.pendingComposeDraft = draft
407
+ if (!this.boardOpen) {
408
+ this.openBoard()
409
+ return
410
+ }
411
+ this.notify()
412
+ }
413
+
414
+ /** Read and clear any queued create-task draft. */
415
+ consumeComposeDraft(): ComposeTaskDraft | undefined {
416
+ const draft = this.pendingComposeDraft
417
+ this.pendingComposeDraft = undefined
418
+ return draft
419
+ }
420
+
391
421
  /**
392
422
  * Return the center column to the conversation. The layout's own selection is
393
423
  * the source of truth for what the column renders, so this asks for the
@@ -59,7 +59,7 @@ export function parseModelRoute(qualified: string | undefined): { provider: stri
59
59
  }
60
60
 
61
61
  /**
62
- * Normalize the raw `session/modelCatalog` reply into the shape the board
62
+ * Normalize the raw `models/catalog` reply into the shape the board
63
63
  * reads. Everything is optional in the wire value, so every level is checked:
64
64
  * an unreadable catalog degrades to "unknown", never to a crash.
65
65
  * @param value - the raw gateway reply.
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.
package/src/core/tasks.ts CHANGED
@@ -120,6 +120,15 @@ export interface ExecutionRecord {
120
120
  frozenAt?: number
121
121
  /** Freeze source session captured from the card snapshot when the run opened. */
122
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
123
132
  /**
124
133
  * Cascade run group shared by the parent execution and every descendant
125
134
  * execution one run request opened. Absent on a plain single-task run.
@@ -841,6 +850,10 @@ export function startExecution(
841
850
  frozenAt: task.freeze.frozenAt,
842
851
  ...(task.freeze.frozenBy === undefined ? {} : { frozenBy: task.freeze.frozenBy }),
843
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,
844
857
  }
845
858
  return {
846
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 card content: the text the card says AND
51
- * the attachments it carries.
43
+ * The fields that freeze with the first run. Split by what keeps them honest:
52
44
  *
53
- * The attachments freeze with the content because they ARE part of what the
54
- * card hands to its execution: a card whose first run already consumed an
55
- * image keeps that image, and the record of what ran stays what it was. An
56
- * executed or archived card therefore refuses an attachment change exactly
57
- * as it refuses a prompt change.
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 never have started executing. Fail-closed: a task
69
- * with any execution record — running, settled, or cancelled before launch —
70
- * keeps its content fixed. The run, not the column, is the trigger: a card
71
- * parked in 'running' by hand has nothing recorded yet and stays editable.
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
 
package/src/dsh-home.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  // Generated by scripts/sync-shared.mjs from shared/host/dsh-home.ts. Do not edit this copy; edit the shared source and run "node scripts/sync-shared.mjs".
2
2
  /**
3
- * DSH_HOME resolution shared by the plugin family's Host halves: the
4
- * environment override wins, the platform home fallback follows. Mirrors
5
- * what dsh-pet and dsh-liangshen each used to implement locally.
3
+ * DSH_HOME and DSH_AGENTS_HOME resolution shared by the plugin family's Host
4
+ * halves: environment overrides win (blank values treated as unset), then the
5
+ * platform home fallbacks follow — mirroring `@deepseek-ai/dsh-home-paths`.
6
6
  */
7
7
 
8
8
  import { homedir } from 'node:os'
@@ -18,6 +18,21 @@ export function expandHome(path: string, home: string = homedir()): string {
18
18
  return path
19
19
  }
20
20
 
21
+ function resolveUserRoot(
22
+ envValue: string | undefined,
23
+ defaultDirName: string,
24
+ home: string,
25
+ ): string {
26
+ const isPosix = home.startsWith('/')
27
+ const j = isPosix ? posixJoin : join
28
+ const isAbs = isPosix ? posixIsAbsolute : isAbsolute
29
+ if (envValue !== undefined && envValue.trim() !== '') {
30
+ const expanded = expandHome(envValue.trim(), home)
31
+ return isAbs(expanded) ? expanded : j(process.cwd(), expanded)
32
+ }
33
+ return j(home, defaultDirName)
34
+ }
35
+
21
36
  /**
22
37
  * Resolve the DSH home directory.
23
38
  * @param env - process environment to read DSH_HOME from.
@@ -25,18 +40,26 @@ export function expandHome(path: string, home: string = homedir()): string {
25
40
  * @returns the absolute DSH home path.
26
41
  */
27
42
  export function resolveDshHome(env: NodeJS.ProcessEnv = process.env, home: string = homedir()): string {
28
- const isPosix = home.startsWith('/')
29
- const j = isPosix ? posixJoin : join
30
- const isAbs = isPosix ? posixIsAbsolute : isAbsolute
31
- const raw = env.DSH_HOME
32
- if (raw !== undefined && raw.trim() !== '') {
33
- const expanded = expandHome(raw.trim(), home)
34
- return isAbs(expanded) ? expanded : j(process.cwd(), expanded)
35
- }
36
- return j(home, '.dsh')
43
+ return resolveUserRoot(env.DSH_HOME, '.dsh', home)
37
44
  }
38
45
 
39
46
  /** Resolve the DSH home directory from the live environment. */
40
47
  export function dshHome(): string {
41
48
  return resolveDshHome()
42
49
  }
50
+
51
+ /**
52
+ * Resolve the shared agent configuration root (`$DSH_AGENTS_HOME`, defaulting
53
+ * to `<home>/.agents`), matching `@deepseek-ai/dsh-home-paths`'s `resolveAgentsHome`.
54
+ * @param env - process environment to read DSH_AGENTS_HOME from.
55
+ * @param home - platform home directory fallback (test seam).
56
+ * @returns the absolute shared agents home path.
57
+ */
58
+ export function resolveAgentsHome(env: NodeJS.ProcessEnv = process.env, home: string = homedir()): string {
59
+ return resolveUserRoot(env.DSH_AGENTS_HOME, '.agents', home)
60
+ }
61
+
62
+ /** Resolve the shared agent configuration root from the live environment. */
63
+ export function agentsHome(): string {
64
+ return resolveAgentsHome()
65
+ }
@@ -315,6 +315,7 @@ export function buildTaskBoardTools(host: TaskBoardToolHost): ToolDefinition[] {
315
315
  function buildSetParentTool(host: TaskBoardToolHost): ToolDefinition {
316
316
  return defineTool({
317
317
  name: 'task_board_set_parent',
318
+ environment: 'independent',
318
319
  description: [
319
320
  'Attach an existing task under a parent (making it a subtask) or detach it back to the root board by setting its parentId.',
320
321
  'Pass an empty parentId to detach.',
@@ -346,6 +347,7 @@ function buildSetParentTool(host: TaskBoardToolHost): ToolDefinition {
346
347
  function buildRunTool(host: TaskBoardToolHost): ToolDefinition {
347
348
  return defineTool({
348
349
  name: 'task_board_run',
350
+ environment: 'independent',
349
351
  description: [
350
352
  'Run a task on the board now, or re-run a settled one.',
351
353
  '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.',
@@ -405,6 +407,7 @@ function buildRunTool(host: TaskBoardToolHost): ToolDefinition {
405
407
  function buildManageTool(host: TaskBoardToolHost): ToolDefinition {
406
408
  return defineTool({
407
409
  name: 'task_board_manage',
410
+ environment: 'independent',
408
411
  description: [
409
412
  'Move, archive, restore, delete, or settle one task board card.',
410
413
  '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.',
@@ -504,6 +507,7 @@ function buildManageTool(host: TaskBoardToolHost): ToolDefinition {
504
507
  function buildScheduleTool(host: TaskBoardToolHost): ToolDefinition {
505
508
  return defineTool({
506
509
  name: 'task_board_schedule',
510
+ environment: 'independent',
507
511
  description: [
508
512
  '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.',
509
513
  '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).',
@@ -566,6 +570,7 @@ function buildScheduleTool(host: TaskBoardToolHost): ToolDefinition {
566
570
  function buildListTool(host: TaskBoardToolHost): ToolDefinition {
567
571
  return defineTool({
568
572
  name: 'task_board_list',
573
+ environment: 'independent',
569
574
  description: [
570
575
  'List tasks on the DSH task board (the Host-authoritative ledger behind the Web GUI task board).',
571
576
  'Filters: status column, parentId (direct subtasks), rootsOnly, tag, free-text query, and archived inclusion.',
@@ -613,6 +618,7 @@ function buildListTool(host: TaskBoardToolHost): ToolDefinition {
613
618
  function buildGetTool(host: TaskBoardToolHost): ToolDefinition {
614
619
  return defineTool({
615
620
  name: 'task_board_get',
621
+ environment: 'independent',
616
622
  description: [
617
623
  '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.',
618
624
  '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.',
@@ -635,6 +641,7 @@ function buildGetTool(host: TaskBoardToolHost): ToolDefinition {
635
641
  function buildCreateTool(host: TaskBoardToolHost): ToolDefinition {
636
642
  return defineTool({
637
643
  name: 'task_board_create',
644
+ environment: 'independent',
638
645
  description: [
639
646
  'Create a task on the DSH task board, or a subtask by passing parentId.',
640
647
  '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.',
@@ -727,6 +734,7 @@ function buildCreateTool(host: TaskBoardToolHost): ToolDefinition {
727
734
  function buildUpdateTool(host: TaskBoardToolHost): ToolDefinition {
728
735
  return defineTool({
729
736
  name: 'task_board_update',
737
+ environment: 'independent',
730
738
  description: [
731
739
  'Edit a task board card: title, description, prompt, labels, and the execution targets (workspace, agent preset, permission, model, reasoning effort, session reuse).',
732
740
  'Only the fields you pass change; pass an empty string to clear a target, or an empty labels array to clear the labels.',
@@ -28,7 +28,7 @@ import { applyDeleteTask } from './core/use-cases/task-delete.ts'
28
28
  import { applySetSchedule, applyScheduleProgress, applyScheduleRefund, type ScheduleProgress } from './core/use-cases/task-schedule.ts'
29
29
  import { applySetParent } from './core/use-cases/task-parent.ts'
30
30
  import { applyDeleteTag, applyRenameTag } from './core/use-cases/task-tag.ts'
31
- import { applyUpdateTask, canEditTaskContent, hasContentPatch } from './core/use-cases/task-update.ts'
31
+ import { applyUpdateTask, canEditTaskAttachments, canEditTaskContent, hasContentPatch } from './core/use-cases/task-update.ts'
32
32
  import { TASK_BOARD_MIGRATABLE_SCHEMA_VERSIONS, TASK_BOARD_SCHEMA_VERSION, TASK_BOARD_ZONE_STAMP_SCHEMA_VERSION, type TaskBoardAction, type TaskBoardSchedulerSnapshot } from './protocol.ts'
33
33
  import { DEFAULT_SESSION_PERMISSION, requiresPermissionConfirmation, type TaskPermission } from './core/handover.ts'
34
34
  import type { TaskBoardLaunchDecision, TaskBoardLaunchHandler, TaskBoardLaunchTrigger } from './core/extension.ts'
@@ -1244,10 +1244,16 @@ export class HostTaskLedger {
1244
1244
  const task = this.document.tasks.find(task => task.id === action.taskId)
1245
1245
  if (task === undefined) throw new Error('task not found')
1246
1246
  if (task.archivedAt !== undefined) throw new Error('archived task is read-only')
1247
- // The task content (title/description/prompt) is the record of what
1248
- // was planned; once an execution started it must not change under a
1249
- // running session or an executed history. Execution targets stay
1250
- // editable (they only affect future runs).
1247
+ // Attachments keep the historical boundary: they are not captured on
1248
+ // the execution record, so they freeze at the first run and stay
1249
+ // frozen for every executed or archived card afterwards.
1250
+ if ('attachments' in action.patch && !canEditTaskAttachments(task)) {
1251
+ throw new Error('task has already been executed')
1252
+ }
1253
+ // The content fields (title/description/prompt) may change between
1254
+ // runs — each execution record carries the snapshot it was opened
1255
+ // with — but never under an open execution. Execution targets stay
1256
+ // editable throughout (they only affect future runs).
1251
1257
  if (hasContentPatch(action.patch) && !canEditTaskContent(task)) {
1252
1258
  throw new Error('task has already been executed')
1253
1259
  }
@@ -39,15 +39,13 @@ export const TASK_BOARD_PROXY_TOKEN_HEADER = 'x-dsh-task-board-proxy-token'
39
39
 
40
40
  /**
41
41
  * The composition's Host connection service, narrowed to the one check the
42
- * board bridges: `requestRejection` runs the Host/Origin fence and verifies
43
- * the authority-bound `dsh-auth-*` browser session minted by the Host. It
44
- * answers `undefined` only for a request it admits and 401/403 otherwise.
42
+ * board bridges: `admit` runs the Host/Origin fence and verifies
43
+ * the authority-bound `dsh-auth-*` browser session minted by the Host.
45
44
  * Declared structurally, like the official open-in-app routes do, because the
46
45
  * service's package is a browser-side dependency this Host half does not
47
46
  * import.
48
47
  */
49
48
  export interface TaskBoardConnectionTrust {
50
- requestRejection?(request: { readonly headers: IncomingMessage['headers'] }): 401 | 403 | undefined
51
49
  admit?(request: { readonly headers: IncomingMessage['headers'] }): {
52
50
  readonly peer?: unknown
53
51
  readonly rejection?: 401 | 403
@@ -230,21 +228,15 @@ function matchesToken(candidate: string | string[] | undefined, expected: string
230
228
  */
231
229
  export function isTrustedTaskBoardRequest(req: IncomingMessage, access: ResolvedRouteAccess): boolean {
232
230
  const connection = access.connection?.()
233
- if (connection !== undefined) {
234
- // The Host connection service is a cross-cohort bridge: the npm 0.2.2-rc.3
235
- // shape answers `requestRejection`, the post-#8266 shape answers `admit`,
236
- // and `admit` reaches into `connection.authentication`, which throws when
231
+ if (connection !== undefined && typeof connection.admit === 'function') {
232
+ // `admit` reaches into `connection.authentication`, which throws when
237
233
  // the calling fiber does not inject it. A bridge that cannot answer is not
238
234
  // an admission decision: it must keep the fence below instead of escaping
239
235
  // as a handler error (the Host answers a throwing handler with a bare 400,
240
236
  // which the panel can only render as an unreadable response).
241
237
  try {
242
- if (typeof connection.admit === 'function') {
243
- const admission = connection.admit(req)
244
- if (admission.rejection === undefined && 'peer' in admission && admission.peer !== undefined) return true
245
- } else if (typeof connection.requestRejection === 'function' && connection.requestRejection(req) === undefined) {
246
- return true
247
- }
238
+ const admission = connection.admit(req)
239
+ if (admission.rejection === undefined && 'peer' in admission && admission.peer !== undefined) return true
248
240
  } catch {
249
241
  // Fall through to the pre-existing loopback / proxy fence.
250
242
  }
@@ -544,8 +536,7 @@ export function makeTaskBoardRoutes(
544
536
  }
545
537
  // Task board routes enforce their own Host/Origin, DSH connection, and
546
538
  // paired-device trust fence and must stay reachable when webServer defaults routes to auth: 'required'.
547
- type AuthAwareWebRoute = WebRoute & { readonly auth?: 'anonymous' | 'required' | 'deny' }
548
539
  return [state, action, events, parse, modelCatalog, attachmentUpload, attachmentImage].map(
549
- (route): AuthAwareWebRoute => ({ ...route, auth: 'anonymous' }),
540
+ (route): WebRoute => ({ ...route, auth: 'anonymous' }),
550
541
  )
551
542
  }
@@ -428,8 +428,8 @@ function nonCompletedTurnEnd(data: unknown): string | undefined {
428
428
  */
429
429
  function invokeWireArgs(namespace: string, method: string, request: Record<string, unknown>): Record<string, unknown> {
430
430
  if (namespace === 'agentPresets' && method === 'list') return {}
431
- // session/modelCatalog declares zero parameters, so its args must be {}.
432
- if (namespace === 'session' && method === 'modelCatalog') return {}
431
+ // models/catalog declares zero parameters, so its args must be {}.
432
+ if (namespace === 'models' && method === 'catalog') return {}
433
433
  if (namespace === 'session' && method === 'list') return { _request: request }
434
434
  return { request }
435
435
  }
@@ -839,9 +839,9 @@ export class HostExecutionRunner {
839
839
  */
840
840
  async modelCatalog(): Promise<unknown> {
841
841
  try {
842
- return await this.invoke('session', 'modelCatalog', {})
842
+ return await this.invoke('models', 'catalog', {})
843
843
  } catch (error) {
844
- console.warn('[dsh-task-board] session/modelCatalog failed; the board falls back to the pinned route', error)
844
+ console.warn('[dsh-task-board] models/catalog failed; the board falls back to the pinned route', error)
845
845
  return undefined
846
846
  }
847
847
  }
@@ -1209,7 +1209,12 @@ export class TaskBoardHostService {
1209
1209
  */
1210
1210
  private onScheduleFire(target: number): void {
1211
1211
  if (this.disposed || !this.active) return
1212
- const now = this.now()
1212
+ // The timer covers the instant it was armed for: a callback that reads the
1213
+ // wall clock a hair before its target (early timer tick, coarse clock) must
1214
+ // still deliver that occurrence. Left at this.now() alone, dueSchedules()
1215
+ // would see a not-yet-due rule and the re-arm would skip a nextRunAt that
1216
+ // is already in the past, stranding the rule for good.
1217
+ const now = Math.max(this.now(), target)
1213
1218
  this.scheduleTarget = undefined
1214
1219
  this.ledger.setScheduler({ lastTickAt: now })
1215
1220
  if (now - target > RECOVERY_TOLERANCE_MS) {
package/src/index.ts CHANGED
@@ -311,7 +311,7 @@ export function resolveConnectionTrust(ctx: Context): TaskBoardConnectionTrust |
311
311
  try {
312
312
  const connection = ctx.get('connection') as Partial<TaskBoardConnectionTrust> | undefined
313
313
  if (connection === undefined || connection === null) return undefined
314
- return typeof connection.admit === 'function' || typeof connection.requestRejection === 'function'
314
+ return typeof connection.admit === 'function'
315
315
  ? connection as TaskBoardConnectionTrust
316
316
  : undefined
317
317
  } catch {
@@ -723,8 +723,7 @@ function applyImpl(ctx: Context, config?: Config): void {
723
723
  * \"connection.authentication\" without inject", which escaped every route
724
724
  * handler as a bare 400. The scope keeps the row's own inject list unchanged
725
725
  * (the service stays optional: a deployment without it keeps the loopback
726
- * fence), and a cohort whose connection has no authentication sub-service
727
- * simply never activates this scope, leaving the `requestRejection` bridge.
726
+ * fence).
728
727
  */
729
728
  let admittedConnection: TaskBoardConnectionTrust | undefined
730
729
  const scopedInjectConnection = (ctx as { inject?: (names: readonly string[], callback: (scoped: Context) => unknown) => unknown }).inject
package/src/protocol.ts CHANGED
@@ -329,6 +329,8 @@ function validImportedKnownFields(value: Record<string, unknown>): boolean {
329
329
  if (execution.external !== undefined && typeof execution.external !== 'boolean') return false
330
330
  if (execution.frozenBy !== undefined && typeof execution.frozenBy !== 'string') return false
331
331
  if (execution.frozenAt !== undefined && typeof execution.frozenAt !== 'number') return false
332
+ if (execution.promptSnapshot !== undefined && typeof execution.promptSnapshot !== 'string') return false
333
+ if (execution.titleSnapshot !== undefined && typeof execution.titleSnapshot !== 'string') return false
332
334
  }
333
335
  }
334
336
  return true
@@ -358,6 +360,8 @@ function importedTask(value: unknown): TaskRecord | undefined {
358
360
  ...(execution.external === true ? { external: true } : {}),
359
361
  ...(execution.frozenAt === undefined ? {} : { frozenAt: execution.frozenAt }),
360
362
  ...(execution.frozenBy === undefined ? {} : { frozenBy: execution.frozenBy }),
363
+ ...(execution.promptSnapshot === undefined ? {} : { promptSnapshot: execution.promptSnapshot }),
364
+ ...(execution.titleSnapshot === undefined ? {} : { titleSnapshot: execution.titleSnapshot }),
361
365
  })),
362
366
  // The rule was already reconstructed field by field by parseLedger (which
363
367
  // is what drops an unknown or malformed field), so the import keeps that
@@ -63,11 +63,15 @@ export interface SectionScopeContext {
63
63
  }
64
64
 
65
65
  /**
66
- * Build a section provider that renders \`text\` only while at least one of
67
- * \`toolNames\` is visible to the rendering scope.
66
+ * Build a section provider that renders `text` only while at least one of
67
+ * `toolNames` is visible to the rendering scope.
68
68
  *
69
69
  * The native convention: a tool that a restriction, a preset, or a missing
70
70
  * registry removed must not leave guidance behind telling the model to call it.
71
+ * Under a 0.2.3-alpha.3+ PTC root registry (`PtcToolRegistry`), `tools.get(name,
72
+ * scope)` exposes only the `run_code` transport while binding registered tools
73
+ * inside programs; when `run_code` is active in the rendering scope, fall back
74
+ * to checking the unscoped registry so guidance does not vanish under PTC.
71
75
  * An unreadable registry renders the text unchanged — guidance that outlives a
72
76
  * momentary read failure is recoverable; guidance for a tool that is gone is
73
77
  * not.
@@ -91,6 +95,17 @@ export function visibleToolText(
91
95
  return text
92
96
  }
93
97
  }
98
+ if (context.scope !== undefined && toolNames.length > 0) {
99
+ try {
100
+ if (tools.get('run_code', context.scope) !== undefined) {
101
+ for (const name of toolNames) {
102
+ if (tools.get(name) !== undefined) return text
103
+ }
104
+ }
105
+ } catch {
106
+ return text
107
+ }
108
+ }
94
109
  return ''
95
110
  }
96
111
  }