@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.
- package/dist/commands/notes/contentEngine.js +8 -4
- package/dist/commands/schema/renderSkills.js +3 -1
- package/dist/commands/todo/contentModel.d.ts +5 -3
- package/dist/commands/todo/contentModel.js +7 -5
- package/dist/commands/todo/dryRun.d.ts +9 -7
- package/dist/commands/todo/dryRun.js +99 -86
- package/dist/commands/todo/index.js +279 -93
- package/dist/commands/todo/repo.d.ts +128 -7
- package/dist/commands/todo/repo.js +474 -130
- package/dist/commands/todo/taskModel.d.ts +20 -1
- package/dist/commands/todo/taskModel.js +153 -20
- package/dist/commands/todo/taskPatch.d.ts +119 -0
- package/dist/commands/todo/taskPatch.js +502 -0
- package/dist/commands/todo/taskText.d.ts +26 -0
- package/dist/commands/todo/taskText.js +221 -0
- package/dist/daemon/supervisor.d.ts +0 -6
- package/dist/daemon/supervisor.js +10 -2
- package/dist/dsh-plugin/lib/client.js +713 -289
- package/dist/dsh-plugin/lib/index.js +7 -2
- package/dist/dsh-plugin/package.json +1 -1
- package/dist/dsh-plugin/runtime.json +1 -1
- package/dist/editor/compat.d.ts +6 -0
- package/dist/editor/compat.js +18 -0
- package/dist/editor/daemon.js +27 -0
- package/dist/editor/mcp.js +99 -2
- package/dist/editor/service.d.ts +57 -1
- package/dist/editor/service.js +174 -7
- package/dist/editor/todos.d.ts +67 -0
- package/dist/editor/todos.js +293 -0
- package/dist/editor-ui/mcp-app.html +262 -253
- package/dist/integrations/dsh/host.js +10 -2
- package/dist/utils/tiptapMarkdown.js +15 -1
- package/dist/vendor/electron/shared/task-priority.d.ts +42 -0
- package/dist/vendor/electron/shared/task-priority.js +186 -0
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ export const ROUTE = '/dinox-editor';
|
|
|
21
21
|
const SESSION_PREFIX = 'dsh:';
|
|
22
22
|
const MAX_BODY = 8 * 1024 * 1024;
|
|
23
23
|
const MAX_WAIT_MS = 25_000;
|
|
24
|
-
const UI_METHODS = new Set(['sync', 'save', 'resolve', 'search', 'open', 'log', 'catalog', 'updateMeta']);
|
|
24
|
+
const UI_METHODS = new Set(['sync', 'save', 'resolve', 'search', 'open', 'log', 'catalog', 'updateMeta', 'todos', 'todoUpdate', 'todoAppend', 'todoRestore', 'todoSuggestion']);
|
|
25
25
|
const SESSION_META_KEY = 'dinox.ai/editorSession';
|
|
26
26
|
/** Where `dino` lives: recorded by the build / `dino editor install dsh`, else next to this plugin. */
|
|
27
27
|
export function resolveRuntime(pluginLib = path.dirname(fileURLToPath(import.meta.url)), env = process.env) {
|
|
@@ -147,10 +147,18 @@ function isAppOnly(tool) {
|
|
|
147
147
|
const visibility = tool._meta?.ui?.visibility;
|
|
148
148
|
return Array.isArray(visibility) && !visibility.includes('model');
|
|
149
149
|
}
|
|
150
|
+
/** Where a tool's panel shows in dsh; tools without one get no hint. */
|
|
151
|
+
function sidebarHint(tool) {
|
|
152
|
+
if (tool.name === 'dinox_todo_open')
|
|
153
|
+
return ' The list opens in the Dinox tab of the right sidebar.';
|
|
154
|
+
if (tool.name === 'dinox_editor_open')
|
|
155
|
+
return ' The note opens in the Dinox tab of the right sidebar.';
|
|
156
|
+
return '';
|
|
157
|
+
}
|
|
150
158
|
function dshTool(tool, client) {
|
|
151
159
|
return {
|
|
152
160
|
name: tool.name,
|
|
153
|
-
description: `${tool.description ?? ''}
|
|
161
|
+
description: `${tool.description ?? ''}${sidebarHint(tool)}`.trim(),
|
|
154
162
|
parameters: toDshSchema(tool.inputSchema),
|
|
155
163
|
timeoutMs: 45_000,
|
|
156
164
|
output: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { stripPriorityFromTaskContent } from '../vendor/electron/shared/task-priority.js';
|
|
1
2
|
import { DinoxError } from './errors.js';
|
|
2
3
|
import { generateId } from './id.js';
|
|
3
4
|
import { createAudioNodeFromLink, createFileNodeFromLink, createImageNodeWithMetadata, createVideoNodeFromLink, getDinoxMarkdownManager, } from './tiptapMarkdownSchema.js';
|
|
@@ -343,6 +344,19 @@ function extractPreviewTextFromNode(node) {
|
|
|
343
344
|
function getPreviewTextFromDocument(contentJson) {
|
|
344
345
|
return extractPreviewTextFromNode(contentJson);
|
|
345
346
|
}
|
|
347
|
+
// `- [ ] [#A] text` is the Org priority cookie the app and desktop write; lift it into
|
|
348
|
+
// taskItem.attrs.priority instead of leaving `[` + hashtag(A) + `]` in the task text.
|
|
349
|
+
function applyTaskPriorityCookies(node) {
|
|
350
|
+
if (!Array.isArray(node.content))
|
|
351
|
+
return node;
|
|
352
|
+
const children = node.content.map(applyTaskPriorityCookies);
|
|
353
|
+
if (node.type !== 'taskItem')
|
|
354
|
+
return { ...node, content: children };
|
|
355
|
+
const { priority, content } = stripPriorityFromTaskContent(children);
|
|
356
|
+
if (!priority)
|
|
357
|
+
return { ...node, content: children };
|
|
358
|
+
return { ...node, attrs: { ...(node.attrs ?? {}), priority }, content: content };
|
|
359
|
+
}
|
|
346
360
|
export function convertMarkdownToNoteContent(markdown) {
|
|
347
361
|
try {
|
|
348
362
|
const source = typeof markdown === 'string' ? markdown : String(markdown ?? '');
|
|
@@ -356,7 +370,7 @@ export function convertMarkdownToNoteContent(markdown) {
|
|
|
356
370
|
const escaped = preprocessMarkdownEscapes(preprocessed.markdown);
|
|
357
371
|
const parsed = getDinoxMarkdownManager().parse(escaped.markdown);
|
|
358
372
|
const normalized = normalizeStandaloneMarkdownLinksToMediaBlocks(parsed, preprocessed.metadataByPlaceholder);
|
|
359
|
-
const contentJson = validateAndCleanDocument(restoreMarkdownEscapes(normalized, escaped.placeholderPrefix, escaped.replacements));
|
|
373
|
+
const contentJson = applyTaskPriorityCookies(validateAndCleanDocument(restoreMarkdownEscapes(normalized, escaped.placeholderPrefix, escaped.replacements)));
|
|
360
374
|
const contentText = normalizeContentText(getPreviewTextFromDocument(contentJson));
|
|
361
375
|
return { contentJson, contentText };
|
|
362
376
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task priority for TipTap `taskItem` nodes.
|
|
3
|
+
*
|
|
4
|
+
* Canonical storage: `taskItem.attrs.priority` (`high` | `medium` | `low` | null).
|
|
5
|
+
* Markdown interchange (Org-mode style): `- [ ] [#A] …` / `[#B]` / `[#C]`.
|
|
6
|
+
* Import also accepts todo.txt `(A)` and Obsidian-style priority emoji.
|
|
7
|
+
*/
|
|
8
|
+
export declare const TASK_PRIORITY_VALUES: readonly ["high", "medium", "low"];
|
|
9
|
+
export type TaskPriority = (typeof TASK_PRIORITY_VALUES)[number];
|
|
10
|
+
export declare const TASK_PRIORITY_COOKIE_BY_VALUE: Record<TaskPriority, "A" | "B" | "C">;
|
|
11
|
+
export declare const TASK_PRIORITY_VALUE_BY_COOKIE: Record<"A" | "B" | "C", TaskPriority>;
|
|
12
|
+
export declare const TASK_PRIORITY_LABELS: Record<TaskPriority, string>;
|
|
13
|
+
/** Left accent colors for editor / list UI (light). */
|
|
14
|
+
export declare const TASK_PRIORITY_COLORS: Record<TaskPriority, string>;
|
|
15
|
+
export declare function normalizeTaskPriority(value: unknown): TaskPriority | null;
|
|
16
|
+
export declare function parseTaskPriorityMarker(text: string): {
|
|
17
|
+
priority: TaskPriority | null;
|
|
18
|
+
rest: string;
|
|
19
|
+
};
|
|
20
|
+
/** Org-mode cookie suffix after the checkbox, including trailing space when set. */
|
|
21
|
+
export declare function formatTaskPriorityCookie(priority: TaskPriority | null | undefined): string;
|
|
22
|
+
/** Sort rank: high first (0), then medium, low, unset last. */
|
|
23
|
+
export declare function taskPrioritySortRank(priority: TaskPriority | null | undefined): number;
|
|
24
|
+
export interface TaskContentNode {
|
|
25
|
+
type?: string;
|
|
26
|
+
text?: string;
|
|
27
|
+
attrs?: Record<string, unknown>;
|
|
28
|
+
content?: TaskContentNode[];
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Strip a leading priority marker from the first paragraph.
|
|
33
|
+
*
|
|
34
|
+
* Handles:
|
|
35
|
+
* 1. Plain text cookies: `[#A]`, `(A)`, `⏫`
|
|
36
|
+
* 2. Hashtag-split Org cookies: text `[` + hashtag(A/B/C) + text `] …`
|
|
37
|
+
* (our Hashtag extension consumes `#A` inside `[#A]` during markdown parse)
|
|
38
|
+
*/
|
|
39
|
+
export declare function stripPriorityFromTaskContent<T extends TaskContentNode>(content: T[]): {
|
|
40
|
+
priority: TaskPriority | null;
|
|
41
|
+
content: T[];
|
|
42
|
+
};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
// Generated by scripts/sync-electron-domain.ts from dinox-electron/packages/shared/src/task-priority/taskPriority.ts. Do not edit manually.
|
|
2
|
+
/**
|
|
3
|
+
* Task priority for TipTap `taskItem` nodes.
|
|
4
|
+
*
|
|
5
|
+
* Canonical storage: `taskItem.attrs.priority` (`high` | `medium` | `low` | null).
|
|
6
|
+
* Markdown interchange (Org-mode style): `- [ ] [#A] …` / `[#B]` / `[#C]`.
|
|
7
|
+
* Import also accepts todo.txt `(A)` and Obsidian-style priority emoji.
|
|
8
|
+
*/
|
|
9
|
+
export const TASK_PRIORITY_VALUES = ["high", "medium", "low"];
|
|
10
|
+
export const TASK_PRIORITY_COOKIE_BY_VALUE = {
|
|
11
|
+
high: "A",
|
|
12
|
+
medium: "B",
|
|
13
|
+
low: "C",
|
|
14
|
+
};
|
|
15
|
+
export const TASK_PRIORITY_VALUE_BY_COOKIE = {
|
|
16
|
+
A: "high",
|
|
17
|
+
B: "medium",
|
|
18
|
+
C: "low",
|
|
19
|
+
};
|
|
20
|
+
export const TASK_PRIORITY_LABELS = {
|
|
21
|
+
high: "高",
|
|
22
|
+
medium: "中",
|
|
23
|
+
low: "低",
|
|
24
|
+
};
|
|
25
|
+
/** Left accent colors for editor / list UI (light). */
|
|
26
|
+
export const TASK_PRIORITY_COLORS = {
|
|
27
|
+
high: "#ef4444",
|
|
28
|
+
medium: "#f59e0b",
|
|
29
|
+
low: "#3b82f6",
|
|
30
|
+
};
|
|
31
|
+
const ORG_COOKIE_RE = /^\s*\[#([ABC])\]\s*/i;
|
|
32
|
+
const TODO_TXT_RE = /^\s*\(([ABC])\)\s*/i;
|
|
33
|
+
const OBSIDIAN_EMOJI_RE = /^\s*(⏫|🔼|🔽|⏬)\s*/;
|
|
34
|
+
const EMOJI_TO_PRIORITY = {
|
|
35
|
+
"⏫": "high",
|
|
36
|
+
"🔼": "medium",
|
|
37
|
+
"🔽": "low",
|
|
38
|
+
"⏬": "low",
|
|
39
|
+
};
|
|
40
|
+
export function normalizeTaskPriority(value) {
|
|
41
|
+
if (value == null || value === "" || value === false)
|
|
42
|
+
return null;
|
|
43
|
+
if (typeof value === "string") {
|
|
44
|
+
const trimmed = value.trim().toLowerCase();
|
|
45
|
+
if (trimmed === "high" || trimmed === "a" || trimmed === "p1" || trimmed === "1")
|
|
46
|
+
return "high";
|
|
47
|
+
if (trimmed === "medium" || trimmed === "med" || trimmed === "b" || trimmed === "p2" || trimmed === "2") {
|
|
48
|
+
return "medium";
|
|
49
|
+
}
|
|
50
|
+
if (trimmed === "low" || trimmed === "c" || trimmed === "p3" || trimmed === "3")
|
|
51
|
+
return "low";
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
55
|
+
if (value === 1)
|
|
56
|
+
return "high";
|
|
57
|
+
if (value === 2)
|
|
58
|
+
return "medium";
|
|
59
|
+
if (value === 3)
|
|
60
|
+
return "low";
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
export function parseTaskPriorityMarker(text) {
|
|
65
|
+
if (!text)
|
|
66
|
+
return { priority: null, rest: text };
|
|
67
|
+
const org = text.match(ORG_COOKIE_RE);
|
|
68
|
+
if (org) {
|
|
69
|
+
const cookie = org[1].toUpperCase();
|
|
70
|
+
return {
|
|
71
|
+
priority: TASK_PRIORITY_VALUE_BY_COOKIE[cookie],
|
|
72
|
+
rest: text.slice(org[0].length),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const todoTxt = text.match(TODO_TXT_RE);
|
|
76
|
+
if (todoTxt) {
|
|
77
|
+
const cookie = todoTxt[1].toUpperCase();
|
|
78
|
+
return {
|
|
79
|
+
priority: TASK_PRIORITY_VALUE_BY_COOKIE[cookie],
|
|
80
|
+
rest: text.slice(todoTxt[0].length),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const emoji = text.match(OBSIDIAN_EMOJI_RE);
|
|
84
|
+
if (emoji) {
|
|
85
|
+
return {
|
|
86
|
+
priority: EMOJI_TO_PRIORITY[emoji[1]] ?? null,
|
|
87
|
+
rest: text.slice(emoji[0].length),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return { priority: null, rest: text };
|
|
91
|
+
}
|
|
92
|
+
/** Org-mode cookie suffix after the checkbox, including trailing space when set. */
|
|
93
|
+
export function formatTaskPriorityCookie(priority) {
|
|
94
|
+
const normalized = normalizeTaskPriority(priority);
|
|
95
|
+
if (!normalized)
|
|
96
|
+
return "";
|
|
97
|
+
return `[#${TASK_PRIORITY_COOKIE_BY_VALUE[normalized]}] `;
|
|
98
|
+
}
|
|
99
|
+
/** Sort rank: high first (0), then medium, low, unset last. */
|
|
100
|
+
export function taskPrioritySortRank(priority) {
|
|
101
|
+
const normalized = normalizeTaskPriority(priority);
|
|
102
|
+
if (normalized === "high")
|
|
103
|
+
return 0;
|
|
104
|
+
if (normalized === "medium")
|
|
105
|
+
return 1;
|
|
106
|
+
if (normalized === "low")
|
|
107
|
+
return 2;
|
|
108
|
+
return 3;
|
|
109
|
+
}
|
|
110
|
+
function priorityFromHashtagAttrs(attrs) {
|
|
111
|
+
if (!attrs)
|
|
112
|
+
return null;
|
|
113
|
+
const raw = attrs.id ?? attrs.label ?? attrs.path ?? attrs.fullPath;
|
|
114
|
+
return normalizeTaskPriority(raw);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Strip a leading priority marker from the first paragraph.
|
|
118
|
+
*
|
|
119
|
+
* Handles:
|
|
120
|
+
* 1. Plain text cookies: `[#A]`, `(A)`, `⏫`
|
|
121
|
+
* 2. Hashtag-split Org cookies: text `[` + hashtag(A/B/C) + text `] …`
|
|
122
|
+
* (our Hashtag extension consumes `#A` inside `[#A]` during markdown parse)
|
|
123
|
+
*/
|
|
124
|
+
export function stripPriorityFromTaskContent(content) {
|
|
125
|
+
if (!Array.isArray(content) || content.length === 0) {
|
|
126
|
+
return { priority: null, content };
|
|
127
|
+
}
|
|
128
|
+
const first = content[0];
|
|
129
|
+
if (!first || first.type !== "paragraph" || !Array.isArray(first.content) || first.content.length === 0) {
|
|
130
|
+
return { priority: null, content };
|
|
131
|
+
}
|
|
132
|
+
const inlines = first.content;
|
|
133
|
+
// Path 1: leading text node with a cookie / emoji / todo.txt marker
|
|
134
|
+
const firstInline = inlines.find((child) => !(child?.type === "text" && typeof child.text === "string" && child.text.length === 0));
|
|
135
|
+
if (firstInline?.type === "text" && typeof firstInline.text === "string") {
|
|
136
|
+
const { priority, rest } = parseTaskPriorityMarker(firstInline.text);
|
|
137
|
+
if (priority) {
|
|
138
|
+
const nextInline = { ...firstInline, text: rest };
|
|
139
|
+
const nextParagraphContent = inlines.map((child) => child === firstInline ? nextInline : child);
|
|
140
|
+
const nextParagraph = { ...first, content: nextParagraphContent };
|
|
141
|
+
const nextContent = content.map((child, index) => (index === 0 ? nextParagraph : child));
|
|
142
|
+
return { priority, content: nextContent };
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// Path 2: `[` + hashtag(A|B|C) + `] …` produced by Hashtag markdown parse
|
|
146
|
+
const openBracketIndex = inlines.findIndex((child) => child?.type === "text" && typeof child.text === "string" && child.text.endsWith("["));
|
|
147
|
+
if (openBracketIndex >= 0 && openBracketIndex + 2 < inlines.length) {
|
|
148
|
+
const openNode = inlines[openBracketIndex];
|
|
149
|
+
const hashNode = inlines[openBracketIndex + 1];
|
|
150
|
+
const closeNode = inlines[openBracketIndex + 2];
|
|
151
|
+
if (hashNode?.type === "hashtag" &&
|
|
152
|
+
closeNode?.type === "text" &&
|
|
153
|
+
typeof closeNode.text === "string" &&
|
|
154
|
+
closeNode.text.startsWith("]")) {
|
|
155
|
+
const priority = priorityFromHashtagAttrs(hashNode.attrs);
|
|
156
|
+
if (priority) {
|
|
157
|
+
const openText = typeof openNode.text === "string" ? openNode.text : "";
|
|
158
|
+
const openRemainder = openText.slice(0, -1);
|
|
159
|
+
const closeRemainder = closeNode.text.replace(/^\]\s*/, "");
|
|
160
|
+
const nextInlines = [];
|
|
161
|
+
for (let i = 0; i < inlines.length; i += 1) {
|
|
162
|
+
if (i === openBracketIndex) {
|
|
163
|
+
if (openRemainder)
|
|
164
|
+
nextInlines.push({ ...openNode, text: openRemainder });
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
if (i === openBracketIndex + 1)
|
|
168
|
+
continue;
|
|
169
|
+
if (i === openBracketIndex + 2) {
|
|
170
|
+
if (closeRemainder)
|
|
171
|
+
nextInlines.push({ ...closeNode, text: closeRemainder });
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
nextInlines.push(inlines[i]);
|
|
175
|
+
}
|
|
176
|
+
if (nextInlines.length === 0) {
|
|
177
|
+
nextInlines.push({ type: "text", text: "" });
|
|
178
|
+
}
|
|
179
|
+
const nextParagraph = { ...first, content: nextInlines };
|
|
180
|
+
const nextContent = content.map((child, index) => (index === 0 ? nextParagraph : child));
|
|
181
|
+
return { priority, content: nextContent };
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return { priority: null, content };
|
|
186
|
+
}
|