@dinoxx/dinox-cli 2.18.4 → 2.19.0

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 (35) hide show
  1. package/dist/commands/notes/contentEngine.js +8 -4
  2. package/dist/commands/schema/renderSkills.js +3 -1
  3. package/dist/commands/todo/contentModel.d.ts +5 -3
  4. package/dist/commands/todo/contentModel.js +7 -5
  5. package/dist/commands/todo/dryRun.d.ts +9 -7
  6. package/dist/commands/todo/dryRun.js +99 -86
  7. package/dist/commands/todo/index.js +279 -93
  8. package/dist/commands/todo/repo.d.ts +128 -7
  9. package/dist/commands/todo/repo.js +474 -130
  10. package/dist/commands/todo/taskModel.d.ts +20 -1
  11. package/dist/commands/todo/taskModel.js +153 -20
  12. package/dist/commands/todo/taskPatch.d.ts +119 -0
  13. package/dist/commands/todo/taskPatch.js +502 -0
  14. package/dist/commands/todo/taskText.d.ts +26 -0
  15. package/dist/commands/todo/taskText.js +221 -0
  16. package/dist/daemon/supervisor.d.ts +0 -6
  17. package/dist/daemon/supervisor.js +10 -2
  18. package/dist/dsh-plugin/lib/client.js +713 -289
  19. package/dist/dsh-plugin/lib/index.js +7 -2
  20. package/dist/dsh-plugin/package.json +1 -1
  21. package/dist/dsh-plugin/runtime.json +1 -1
  22. package/dist/editor/compat.d.ts +6 -0
  23. package/dist/editor/compat.js +18 -0
  24. package/dist/editor/daemon.js +27 -0
  25. package/dist/editor/mcp.js +99 -2
  26. package/dist/editor/service.d.ts +57 -1
  27. package/dist/editor/service.js +174 -7
  28. package/dist/editor/todos.d.ts +67 -0
  29. package/dist/editor/todos.js +293 -0
  30. package/dist/editor-ui/mcp-app.html +262 -253
  31. package/dist/integrations/dsh/host.js +10 -2
  32. package/dist/utils/tiptapMarkdown.js +15 -1
  33. package/dist/vendor/electron/shared/task-priority.d.ts +42 -0
  34. package/dist/vendor/electron/shared/task-priority.js +186 -0
  35. package/package.json +1 -1
@@ -1,61 +1,116 @@
1
1
  import type { AbstractPowerSyncDatabase } from '@powersync/common';
2
2
  import { parseTiptapDocFromDb } from './contentModel.js';
3
- import { type TaskDateRangeFilter, type TaskStatusFilter, type TaskTimePoint } from './taskModel.js';
3
+ import { type ApplyTaskPatchesOutcome, type CreatedTodoTask, type TaskPatch, type TaskPatchResult, type TodoDraftItem, type TodoScheduleInput } from './taskPatch.js';
4
+ import { type TaskDateRangeFilter, type TaskPriorityFilter, type TaskStatusFilter, type TaskTimePoint } from './taskModel.js';
5
+ import type { TaskPriority } from '../../vendor/electron/shared/task-priority.js';
4
6
  export type SearchTodoOptions = {
5
7
  includeDeleted: boolean;
6
8
  taskStatus: TaskStatusFilter;
7
9
  taskTagFilter: string[];
10
+ taskPriorityFilter?: TaskPriorityFilter[];
8
11
  taskDateRange?: TaskDateRangeFilter;
9
12
  limit: number;
10
13
  offset?: number;
11
14
  scanLimit: number;
15
+ /** Adds `edit_text` to each task (the editor panel's inline edit). */
16
+ includeEditText?: boolean;
12
17
  };
18
+ /**
19
+ * Where new tasks go. Without a note or parent task they go to today's (or `date`'s) daily
20
+ * todo note, created when that day has no note with tasks yet — the app's default.
21
+ */
13
22
  export type AppendTodoTasksOptions = {
14
23
  noteId?: string;
15
- taskTexts: string[];
24
+ /** Nest the new tasks under this task (as subtasks). */
25
+ parentTaskId?: string;
26
+ /** Daily target day (YYYY-MM-DD); also becomes the due date of tasks without one. */
27
+ date?: string;
28
+ taskTexts?: string[];
29
+ items?: TodoDraftItem[];
30
+ /** Required only when the daily note has to be created. */
31
+ userId?: string;
32
+ now?: Date;
16
33
  };
34
+ export type AppendTodoSource = 'explicit' | 'daily' | 'task';
17
35
  export type AppendTodoTasksResult = {
18
36
  note_id: string;
19
37
  title: string;
20
38
  appended_count: number;
21
- source: 'explicit' | 'latest_non_empty_image_detail';
39
+ source: AppendTodoSource;
40
+ /** True when the daily todo note did not exist and was created. */
41
+ created: boolean;
42
+ day_key: string | null;
43
+ parent_task_id: string | null;
44
+ tasks: CreatedTodoTask[];
22
45
  };
23
46
  export type CreateTodoNoteOptions = {
24
47
  title?: string;
25
- taskTexts: string[];
48
+ taskTexts?: string[];
49
+ items?: TodoDraftItem[];
26
50
  userId: string;
27
51
  };
28
52
  export type CreateTodoNoteResult = {
29
53
  note_id: string;
30
54
  title: string;
31
55
  created_count: number;
56
+ tasks: CreatedTodoTask[];
57
+ };
58
+ export type TodoTaskUpdate = {
59
+ taskId: string;
60
+ noteId?: string;
61
+ checked?: boolean;
62
+ /** `null` clears the priority. */
63
+ priority?: TaskPriority | null;
64
+ /** `null` clears the due time. */
65
+ schedule?: TodoScheduleInput | null;
66
+ /** New words for the task (editor inline edit); only the changed span is rewritten. */
67
+ text?: string;
32
68
  };
33
69
  export type UpdateTodoTaskStatusOptions = {
34
70
  taskId: string;
35
- checked: boolean;
71
+ checked?: boolean;
72
+ priority?: TaskPriority | null;
73
+ schedule?: TodoScheduleInput | null;
36
74
  noteId?: string;
37
75
  };
76
+ export type UpdatedTodoTask = TaskPatchResult & {
77
+ note_id: string;
78
+ note_title: string;
79
+ updated: boolean;
80
+ };
38
81
  export type UpdateTodoTaskStatusResult = {
39
82
  note_id: string;
40
83
  task_id: string;
41
84
  checked: boolean;
85
+ priority: TaskPriority | null;
86
+ due_time: TaskTimePoint | null;
42
87
  updated: boolean;
88
+ cascaded_task_ids: string[];
43
89
  title: string;
44
90
  };
91
+ export type UpdateTodoTasksResult = {
92
+ updated_count: number;
93
+ note_ids: string[];
94
+ tasks: UpdatedTodoTask[];
95
+ };
45
96
  export type SearchedTodo = {
46
97
  task_key: string;
47
98
  note_id: string;
48
99
  note_title: string;
49
100
  task_id: string;
50
101
  text: string;
102
+ /** Only with `includeEditText`: the words with `#tags` in place. */
103
+ edit_text?: string;
51
104
  checked: boolean;
52
105
  status: 'completed' | 'uncompleted';
106
+ priority: TaskPriority | null;
53
107
  created_at: string | null;
54
108
  depth: number;
55
109
  has_children: boolean;
56
110
  parent_id: string | null;
57
111
  tags: string[];
58
112
  note_tags: string[];
113
+ note_box_ids: string[];
59
114
  start_time?: TaskTimePoint;
60
115
  due_time?: TaskTimePoint;
61
116
  };
@@ -76,6 +131,7 @@ export type SearchedTodoResponse = {
76
131
  applied_filters: {
77
132
  status: TaskStatusFilter;
78
133
  tags: string[];
134
+ priority: TaskPriorityFilter[];
79
135
  include_deleted: boolean;
80
136
  date_range: {
81
137
  from: string | null;
@@ -85,17 +141,26 @@ export type SearchedTodoResponse = {
85
141
  };
86
142
  tasks: SearchedTodo[];
87
143
  };
88
- export type { TaskDateRangeFilter, TaskStatusFilter } from './taskModel.js';
144
+ export type { TaskDateRangeFilter, TaskPriorityFilter, TaskStatusFilter } from './taskModel.js';
145
+ export type { TodoDraftItem, TodoScheduleInput } from './taskPatch.js';
89
146
  export { normalizeTaskTexts } from './contentModel.js';
90
147
  type TodoMutableNoteRow = {
91
148
  id: string | null;
92
149
  title: string | null;
93
150
  content_json: string | null;
94
151
  content_md: string | null;
152
+ /** Legacy HTML body; checked states are mirrored into it. */
153
+ content?: string | null;
95
154
  is_del: number | null;
96
155
  created_at?: string | null;
97
156
  version: number | string | null;
98
157
  };
158
+ type TodoNoteWrite = {
159
+ doc: Record<string, unknown>;
160
+ contentMd: string;
161
+ /** Only set when the legacy HTML body changed. */
162
+ content?: string | null;
163
+ };
99
164
  export declare function validateTodoAppendTarget(target: TodoMutableNoteRow): {
100
165
  currentDoc: ReturnType<typeof parseTiptapDocFromDb>;
101
166
  noteId: string;
@@ -111,12 +176,14 @@ export type TodoSearchWire = {
111
176
  includeDeleted: boolean;
112
177
  taskStatus: TaskStatusFilter;
113
178
  taskTagFilter: string[];
179
+ taskPriorityFilter?: TaskPriorityFilter[];
114
180
  limit: number;
115
181
  /** Index of the first returned task among the matches (from `--cursor`). */
116
182
  offset?: number;
117
183
  scanLimit: number;
118
184
  startDate?: string;
119
185
  endDate?: string;
186
+ includeEditText?: boolean;
120
187
  };
121
188
  /** Serialize parsed todo-search options into a JSON-safe wire payload. */
122
189
  export declare function toTodoSearchWire(query: string, options: SearchTodoOptions): TodoSearchWire;
@@ -126,11 +193,65 @@ export declare function toTodoSearchWire(query: string, options: SearchTodoOptio
126
193
  */
127
194
  export declare function executeTodoSearch(db: AbstractPowerSyncDatabase, wire: TodoSearchWire): Promise<SearchedTodoResponse>;
128
195
  export declare function searchTodoTasks(db: AbstractPowerSyncDatabase, query: string, options: SearchTodoOptions): Promise<SearchedTodoResponse>;
196
+ export declare function resolveDailyDayKey(date: string | undefined, now?: Date): string;
197
+ export type TodoAppendPlan = {
198
+ kind: 'append';
199
+ source: AppendTodoSource;
200
+ target: TodoMutableNoteRow;
201
+ dayKey: string | null;
202
+ parentTaskId: string | null;
203
+ tasks: CreatedTodoTask[];
204
+ build: (row: TodoMutableNoteRow) => TodoNoteWrite & {
205
+ noteId: string;
206
+ expectedVersion: number;
207
+ };
208
+ } | {
209
+ kind: 'create_daily';
210
+ source: 'daily';
211
+ dayKey: string;
212
+ title: string;
213
+ doc: Record<string, unknown>;
214
+ tasks: CreatedTodoTask[];
215
+ };
216
+ /** Resolve the append target and build the new task block without writing anything. */
217
+ export declare function planTodoAppend(db: AbstractPowerSyncDatabase, options: AppendTodoTasksOptions): Promise<TodoAppendPlan>;
129
218
  export declare function appendTodoTasks(db: AbstractPowerSyncDatabase, options: AppendTodoTasksOptions): Promise<AppendTodoTasksResult>;
130
219
  export declare function createTodoNote(db: AbstractPowerSyncDatabase, options: CreateTodoNoteOptions): Promise<CreateTodoNoteResult>;
220
+ export declare function previewCreateTodoNote(options: Omit<CreateTodoNoteOptions, 'userId'>): {
221
+ title: string;
222
+ created_count: number;
223
+ tasks: CreatedTodoTask[];
224
+ };
225
+ type NoteUpdatePlan = {
226
+ noteId: string;
227
+ row: TodoMutableNoteRow;
228
+ patches: TaskPatch[];
229
+ outcome: ApplyTaskPatchesOutcome;
230
+ write: TodoNoteWrite | null;
231
+ };
232
+ /** Group updates per note (one write per note) and compute each note's patched content. */
233
+ export declare function planTodoUpdates(db: AbstractPowerSyncDatabase, updates: readonly TodoTaskUpdate[]): Promise<NoteUpdatePlan[]>;
234
+ /** Batch task update (checked / priority / due), one version-checked write per note. */
235
+ export declare function updateTodoTasks(db: AbstractPowerSyncDatabase, updates: readonly TodoTaskUpdate[]): Promise<UpdateTodoTasksResult>;
236
+ /**
237
+ * Puts tasks back exactly as they were (no cascade), or deletes tasks that were just added:
238
+ * how the editor panel undoes its own changes. Each entry names the task's note.
239
+ */
240
+ export type TodoTaskRestore = {
241
+ taskId: string;
242
+ noteId: string;
243
+ checked?: boolean;
244
+ priority?: TaskPriority | null;
245
+ dueAt?: TaskTimePoint | null;
246
+ remove?: boolean;
247
+ /** The task's first paragraph as it was (`paragraph_from` of a text edit). */
248
+ paragraph?: Record<string, unknown>;
249
+ };
250
+ export declare function restoreTodoTasks(db: AbstractPowerSyncDatabase, entries: readonly TodoTaskRestore[]): Promise<UpdateTodoTasksResult>;
131
251
  export declare function updateTodoTaskStatus(db: AbstractPowerSyncDatabase, options: UpdateTodoTaskStatusOptions): Promise<UpdateTodoTaskStatusResult>;
132
252
  export declare function getTodoAppendTargetById(db: AbstractPowerSyncDatabase, noteId: string): Promise<TodoMutableNoteRow | null>;
133
- export declare function getLatestTodoAppendTarget(db: AbstractPowerSyncDatabase): Promise<TodoMutableNoteRow | null>;
253
+ /** The latest live note created on `dayKey` (local time) that already holds tasks. */
254
+ export declare function getDailyTodoTarget(db: AbstractPowerSyncDatabase, dayKey: string): Promise<TodoMutableNoteRow | null>;
134
255
  export declare function loadTodoTaskCandidatesByTaskId(db: AbstractPowerSyncDatabase, taskId: string, options?: {
135
256
  noteId?: string;
136
257
  }): Promise<TodoMutableNoteRow[]>;