dsh-taskboard 0.5.5 → 0.6.1

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 (42) hide show
  1. package/README.md +26 -2
  2. package/lib/client.js +2663 -767
  3. package/lib/host/execution.js +3 -0
  4. package/lib/host/execution.js.map +1 -1
  5. package/lib/host/routes.js +31 -1
  6. package/lib/host/routes.js.map +1 -1
  7. package/lib/host/session-sync.js +210 -10
  8. package/lib/host/session-sync.js.map +1 -1
  9. package/lib/host/store.js +9 -2
  10. package/lib/host/store.js.map +1 -1
  11. package/lib/index.js +100 -1
  12. package/lib/index.js.map +1 -1
  13. package/lib/shared/api.js.map +1 -1
  14. package/lib/shared/protocol.js +19 -1
  15. package/lib/shared/protocol.js.map +1 -1
  16. package/package.json +75 -75
  17. package/src/client/api.ts +8 -0
  18. package/src/client/board/AlertModal.tsx +3 -1
  19. package/src/client/board/ImportModal.tsx +26 -24
  20. package/src/client/board/SettingsModal.tsx +66 -26
  21. package/src/client/board/SlashPromptInput.tsx +340 -0
  22. package/src/client/board/TaskBoard.tsx +53 -49
  23. package/src/client/board/TaskCard.tsx +33 -21
  24. package/src/client/board/TaskDetail.tsx +169 -104
  25. package/src/client/board/TaskFormModal.tsx +254 -202
  26. package/src/client/board/TemplateManager.tsx +32 -29
  27. package/src/client/board/labels.ts +36 -27
  28. package/src/client/controller.ts +62 -2
  29. package/src/client/i18n/en.ts +455 -0
  30. package/src/client/i18n/runtime.ts +155 -0
  31. package/src/client/i18n/zh.ts +460 -0
  32. package/src/client/index.ts +182 -42
  33. package/src/client/sidebar-entry.ts +13 -3
  34. package/src/client/styles.ts +133 -0
  35. package/src/host/execution.ts +13 -0
  36. package/src/host/routes.ts +49 -1
  37. package/src/host/session-sync.ts +334 -14
  38. package/src/host/store.ts +15 -1
  39. package/src/index.ts +115 -1
  40. package/src/shared/api.ts +47 -0
  41. package/src/shared/protocol.ts +41 -0
  42. package/src/shared/version.ts +1 -1
@@ -134,6 +134,30 @@ export function effectiveIsolation(task: Pick<TaskRecord, 'isolation'>): Isolati
134
134
  return task.isolation === undefined ? DEFAULT_ISOLATION : task.isolation
135
135
  }
136
136
 
137
+ /**
138
+ * Execution permission preset (0.5.5). Matches DSH permission presets:
139
+ * - 'workspace-write': 可写入工作区 (factory default)
140
+ * - 'read-only': 仅可查看
141
+ * - 'danger-full-access': 完全权限
142
+ */
143
+ export type PermissionMode = 'workspace-write' | 'read-only' | 'danger-full-access'
144
+
145
+ /** Factory default permission preset (0.5.5). */
146
+ export const DEFAULT_PERMISSION: PermissionMode = 'workspace-write'
147
+
148
+ /** Canonical list of supported permission modes. */
149
+ export const ALL_PERMISSIONS: readonly PermissionMode[] = ['workspace-write', 'read-only', 'danger-full-access']
150
+
151
+ /** Validate and normalize a permission string into a valid {@link PermissionMode}. */
152
+ export function asPermission(raw: unknown): PermissionMode {
153
+ if (typeof raw !== 'string') return DEFAULT_PERMISSION
154
+ const normalized = raw.trim()
155
+ if (normalized === 'workspace-write' || normalized === 'workspaceWrite') return 'workspace-write'
156
+ if (normalized === 'read-only' || normalized === 'readOnly') return 'read-only'
157
+ if (normalized === 'danger-full-access' || normalized === 'fullAccess') return 'danger-full-access'
158
+ throw new Error("permission must be 'workspace-write', 'read-only', or 'danger-full-access'")
159
+ }
160
+
137
161
  /**
138
162
  * Board-level settings persisted with the ledger (0.5.0). Only fields the
139
163
  * user explicitly set are present; absent fields follow factory defaults.
@@ -143,6 +167,8 @@ export type BoardSettings = {
143
167
  defaultIsolation?: IsolationMode
144
168
  /** Automatically capture external workspace sessions into the taskboard (default: false). */
145
169
  syncExternalSessions?: boolean
170
+ /** Default permission preset applied when a NEW task is created without an explicit choice (0.5.5, default: 'workspace-write'). */
171
+ defaultPermission?: PermissionMode
146
172
  }
147
173
 
148
174
  /** Validate raw input into sanitized {@link BoardSettings} (unknown fields dropped). */
@@ -164,6 +190,9 @@ export function asBoardSettings(raw: unknown): BoardSettings {
164
190
  }
165
191
  out.syncExternalSessions = e.syncExternalSessions
166
192
  }
193
+ if (e.defaultPermission !== undefined) {
194
+ out.defaultPermission = asPermission(e.defaultPermission)
195
+ }
167
196
  return out
168
197
  }
169
198
 
@@ -177,6 +206,11 @@ export function defaultSyncExternalSessionsOf(settings?: BoardSettings): boolean
177
206
  return settings?.syncExternalSessions ?? false
178
207
  }
179
208
 
209
+ /** The effective default permission preset for NEW tasks (board setting → factory default 'workspace-write'). */
210
+ export function defaultPermissionOf(settings?: BoardSettings): PermissionMode {
211
+ return settings?.defaultPermission ?? DEFAULT_PERMISSION
212
+ }
213
+
180
214
  /** How a task may run. */
181
215
  export type ExecutionMode = 'claim' | 'scheduled'
182
216
 
@@ -419,6 +453,10 @@ export type TaskRecord = {
419
453
  * tool set. Editable any time (each run composes fresh).
420
454
  */
421
455
  presetId?: string
456
+ /**
457
+ * Execution permission preset (0.5.5; see {@link PermissionMode}).
458
+ */
459
+ permission?: PermissionMode
422
460
  /**
423
461
  * Definition-of-Done acceptance checklist (0.4.0). Agents may append items
424
462
  * and check/uncheck them (with evidence); the GUI may edit the whole list.
@@ -919,6 +957,7 @@ export function validateImportedTask(raw: unknown, now: number): { ok: true; tas
919
957
  ...(typeof e.model === 'object' && e.model !== null ? { model: normalizeModel(e.model) } : {}),
920
958
  ...(typeof e.isolation === 'string' && (e.isolation === 'worktree' || e.isolation === 'none') ? { isolation: e.isolation } : {}),
921
959
  ...(typeof e.presetId === 'string' && e.presetId.trim().length > 0 ? { presetId: e.presetId.trim() } : {}),
960
+ ...(typeof e.permission === 'string' ? { permission: asPermission(e.permission) } : {}),
922
961
  ...(Array.isArray(e.checklist) ? { checklist: normalizeChecklist(e.checklist) } : {}),
923
962
  ...(typeof e.branch === 'string' ? { branch: e.branch } : {}),
924
963
  ...(status === 'in_progress' && typeof e.claimedBy === 'string' ? { claimedBy: e.claimedBy } : {}),
@@ -1010,6 +1049,7 @@ export type TaskSummary = {
1010
1049
  executionMode: ExecutionMode
1011
1050
  nextRunAt?: number
1012
1051
  model?: TaskModel
1052
+ permission?: PermissionMode
1013
1053
  version: number
1014
1054
  claimOwner?: string
1015
1055
  commentCount: number
@@ -1036,6 +1076,7 @@ export function summarize(task: TaskRecord): TaskSummary {
1036
1076
  executionMode: task.execution.mode,
1037
1077
  nextRunAt: task.execution.nextRunAt,
1038
1078
  model: task.model,
1079
+ permission: task.permission,
1039
1080
  version: task.version,
1040
1081
  claimOwner: isClaimedBy(task),
1041
1082
  commentCount: task.comments.length,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  /** The package version (must equal package.json "version"). */
9
- export const PLUGIN_VERSION = '0.5.4'
9
+ export const PLUGIN_VERSION = '0.6.1'