@wonderwhy-er/desktop-commander 0.2.39 → 0.2.40

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 (137) hide show
  1. package/dist/server.js +1 -1
  2. package/dist/ui/file-preview/preview-runtime.js +204 -153
  3. package/dist/ui/file-preview/src/markdown/controller.d.ts +7 -1
  4. package/dist/ui/file-preview/src/markdown/controller.js +135 -16
  5. package/dist/ui/file-preview/src/markdown/editor.d.ts +97 -1
  6. package/dist/ui/file-preview/src/markdown/editor.js +814 -26
  7. package/dist/ui/file-preview/src/model.d.ts +2 -1
  8. package/dist/utils/capture.js +1 -1
  9. package/dist/utils/toolHistory.d.ts +13 -0
  10. package/dist/utils/toolHistory.js +65 -0
  11. package/dist/version.d.ts +1 -1
  12. package/dist/version.js +1 -1
  13. package/package.json +7 -1
  14. package/dist/ui/config-editor/app.js +0 -840
  15. package/dist/ui/config-editor/array-modal.d.ts +0 -19
  16. package/dist/ui/config-editor/array-modal.js +0 -185
  17. package/dist/ui/config-editor/main.d.ts +0 -1
  18. package/dist/ui/config-editor/main.js +0 -2
  19. package/dist/ui/config-editor/src/App.d.ts +0 -43
  20. package/dist/ui/config-editor/src/components/layout.d.ts +0 -4
  21. package/dist/ui/config-editor/src/components/layout.js +0 -83
  22. package/dist/ui/config-editor/src/components/toolbar.d.ts +0 -1
  23. package/dist/ui/config-editor/src/components/toolbar.js +0 -21
  24. package/dist/ui/config-editor/src/config-values.d.ts +0 -6
  25. package/dist/ui/config-editor/src/config-values.js +0 -61
  26. package/dist/ui/config-editor/src/contracts.d.ts +0 -14
  27. package/dist/ui/config-editor/src/contracts.js +0 -3
  28. package/dist/ui/config-editor/src/directory-browser.d.ts +0 -6
  29. package/dist/ui/config-editor/src/directory-browser.js +0 -71
  30. package/dist/ui/config-editor/src/layout.d.ts +0 -5
  31. package/dist/ui/config-editor/src/layout.js +0 -90
  32. package/dist/ui/config-editor/src/parsing.d.ts +0 -5
  33. package/dist/ui/config-editor/src/parsing.js +0 -50
  34. package/dist/ui/config-editor/src/toolbar.d.ts +0 -1
  35. package/dist/ui/config-editor/src/toolbar.js +0 -18
  36. package/dist/ui/config-editor/src/types.d.ts +0 -17
  37. package/dist/ui/config-editor/src/types.js +0 -3
  38. package/dist/ui/config-editor/src/utils/config-values.d.ts +0 -9
  39. package/dist/ui/config-editor/src/utils/config-values.js +0 -61
  40. package/dist/ui/config-editor/src/utils/directory-browser.d.ts +0 -31
  41. package/dist/ui/config-editor/src/utils/directory-browser.js +0 -201
  42. package/dist/ui/config-editor/src/utils/parsing.d.ts +0 -8
  43. package/dist/ui/config-editor/src/utils/parsing.js +0 -50
  44. package/dist/ui/file-preview/app.d.ts +0 -8
  45. package/dist/ui/file-preview/app.js +0 -2020
  46. package/dist/ui/file-preview/components/code-viewer.d.ts +0 -6
  47. package/dist/ui/file-preview/components/code-viewer.js +0 -73
  48. package/dist/ui/file-preview/components/highlighting.d.ts +0 -2
  49. package/dist/ui/file-preview/components/highlighting.js +0 -54
  50. package/dist/ui/file-preview/components/html-renderer.d.ts +0 -5
  51. package/dist/ui/file-preview/components/html-renderer.js +0 -47
  52. package/dist/ui/file-preview/components/markdown-renderer.d.ts +0 -1
  53. package/dist/ui/file-preview/components/markdown-renderer.js +0 -67
  54. package/dist/ui/file-preview/components/toolbar.d.ts +0 -6
  55. package/dist/ui/file-preview/components/toolbar.js +0 -75
  56. package/dist/ui/file-preview/image-preview.d.ts +0 -3
  57. package/dist/ui/file-preview/image-preview.js +0 -21
  58. package/dist/ui/file-preview/main.d.ts +0 -1
  59. package/dist/ui/file-preview/main.js +0 -5
  60. package/dist/ui/file-preview/markdown/editor.d.ts +0 -36
  61. package/dist/ui/file-preview/markdown/editor.js +0 -643
  62. package/dist/ui/file-preview/markdown/linking.d.ts +0 -9
  63. package/dist/ui/file-preview/markdown/linking.js +0 -210
  64. package/dist/ui/file-preview/markdown/outline.d.ts +0 -7
  65. package/dist/ui/file-preview/markdown/outline.js +0 -40
  66. package/dist/ui/file-preview/markdown/preview.d.ts +0 -8
  67. package/dist/ui/file-preview/markdown/preview.js +0 -33
  68. package/dist/ui/file-preview/markdown/slugify.d.ts +0 -3
  69. package/dist/ui/file-preview/markdown/slugify.js +0 -31
  70. package/dist/ui/file-preview/markdown/toc.d.ts +0 -11
  71. package/dist/ui/file-preview/markdown/toc.js +0 -75
  72. package/dist/ui/file-preview/markdown/utils.d.ts +0 -1
  73. package/dist/ui/file-preview/markdown/utils.js +0 -15
  74. package/dist/ui/file-preview/markdown/workspace-controller.d.ts +0 -25
  75. package/dist/ui/file-preview/markdown/workspace-controller.js +0 -40
  76. package/dist/ui/file-preview/src/components/CodeViewer.d.ts +0 -6
  77. package/dist/ui/file-preview/src/components/CodeViewer.js +0 -60
  78. package/dist/ui/file-preview/src/components/HtmlRenderer.d.ts +0 -8
  79. package/dist/ui/file-preview/src/components/HtmlRenderer.js +0 -45
  80. package/dist/ui/file-preview/src/components/MarkdownRenderer.d.ts +0 -1
  81. package/dist/ui/file-preview/src/components/MarkdownRenderer.js +0 -15
  82. package/dist/ui/file-preview/src/components/Toolbar.d.ts +0 -6
  83. package/dist/ui/file-preview/src/components/Toolbar.js +0 -75
  84. package/dist/ui/file-preview/src/components/editor-toolbar.d.ts +0 -15
  85. package/dist/ui/file-preview/src/components/editor-toolbar.js +0 -384
  86. package/dist/ui/file-preview/src/components/markdown-editor.d.ts +0 -29
  87. package/dist/ui/file-preview/src/components/markdown-editor.js +0 -535
  88. package/dist/ui/file-preview/src/markdown/block-merge.d.ts +0 -25
  89. package/dist/ui/file-preview/src/markdown/block-merge.js +0 -86
  90. package/dist/ui/file-preview/src/markdown/link-modal.d.ts +0 -13
  91. package/dist/ui/file-preview/src/markdown/link-modal.js +0 -213
  92. package/dist/ui/file-preview/src/markdown/raw-editor.d.ts +0 -8
  93. package/dist/ui/file-preview/src/markdown/raw-editor.js +0 -61
  94. package/dist/ui/file-preview/src/markdown/selection-toolbar.d.ts +0 -14
  95. package/dist/ui/file-preview/src/markdown/selection-toolbar.js +0 -128
  96. package/dist/ui/file-preview/src/markdown/toc.d.ts +0 -11
  97. package/dist/ui/file-preview/src/markdown/toc.js +0 -75
  98. package/dist/ui/file-preview/src/markdown-workspace/editor.d.ts +0 -36
  99. package/dist/ui/file-preview/src/markdown-workspace/editor.js +0 -643
  100. package/dist/ui/file-preview/src/markdown-workspace/linking.d.ts +0 -9
  101. package/dist/ui/file-preview/src/markdown-workspace/linking.js +0 -210
  102. package/dist/ui/file-preview/src/markdown-workspace/outline.d.ts +0 -7
  103. package/dist/ui/file-preview/src/markdown-workspace/outline.js +0 -40
  104. package/dist/ui/file-preview/src/markdown-workspace/preview.d.ts +0 -8
  105. package/dist/ui/file-preview/src/markdown-workspace/preview.js +0 -33
  106. package/dist/ui/file-preview/src/markdown-workspace/slugify.d.ts +0 -3
  107. package/dist/ui/file-preview/src/markdown-workspace/slugify.js +0 -31
  108. package/dist/ui/file-preview/src/markdown-workspace/toc.d.ts +0 -11
  109. package/dist/ui/file-preview/src/markdown-workspace/toc.js +0 -75
  110. package/dist/ui/file-preview/src/markdown-workspace/utils.d.ts +0 -1
  111. package/dist/ui/file-preview/src/markdown-workspace/utils.js +0 -15
  112. package/dist/ui/file-preview/src/markdown-workspace/workspace-controller.d.ts +0 -25
  113. package/dist/ui/file-preview/src/markdown-workspace/workspace-controller.js +0 -40
  114. package/dist/ui/file-preview/types.d.ts +0 -1
  115. package/dist/ui/file-preview/types.js +0 -1
  116. package/dist/ui/server-integration.d.ts +0 -13
  117. package/dist/ui/server-integration.js +0 -31
  118. package/dist/ui/shared/ToolHeader.d.ts +0 -9
  119. package/dist/ui/shared/ToolHeader.js +0 -29
  120. package/dist/ui/shared/app-bootstrap.d.ts +0 -9
  121. package/dist/ui/shared/app-bootstrap.js +0 -15
  122. package/dist/ui/shared/guards.d.ts +0 -1
  123. package/dist/ui/shared/guards.js +0 -3
  124. package/dist/ui/shared/host-lifecycle.d.ts +0 -17
  125. package/dist/ui/shared/host-lifecycle.js +0 -41
  126. package/dist/ui/shared/rpc-client.d.ts +0 -14
  127. package/dist/ui/shared/rpc-client.js +0 -72
  128. package/dist/ui/shared/theme-adaptation.d.ts +0 -10
  129. package/dist/ui/shared/theme-adaptation.js +0 -118
  130. package/dist/ui/shared/tool-header.d.ts +0 -9
  131. package/dist/ui/shared/tool-header.js +0 -25
  132. package/dist/utils/ui-call-context.d.ts +0 -8
  133. package/dist/utils/ui-call-context.js +0 -72
  134. /package/dist/ui/config-editor/{app.d.ts → src/app.d.ts} +0 -0
  135. /package/dist/ui/config-editor/src/{App.js → app.js} +0 -0
  136. /package/dist/ui/file-preview/src/{App.d.ts → app.d.ts} +0 -0
  137. /package/dist/ui/file-preview/src/{App.js → app.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import type { DocumentOutlineItem } from './document-outline.js';
2
2
  import type { FilePreviewStructuredContent } from '../../../types.js';
3
- import type { MarkdownEditorView } from './markdown/editor.js';
3
+ import type { MarkdownEditRange, MarkdownEditorView } from './markdown/editor.js';
4
4
  export type RenderPayload = FilePreviewStructuredContent & {
5
5
  content: string;
6
6
  };
@@ -12,6 +12,7 @@ export interface MarkdownWorkspaceState {
12
12
  outline: DocumentOutlineItem[];
13
13
  mode: 'edit';
14
14
  dirty: boolean;
15
+ dirtyLineRanges: MarkdownEditRange[];
15
16
  activeHeadingId: string | null;
16
17
  pendingAnchor: string | null;
17
18
  notice: string | null;
@@ -381,7 +381,7 @@ export const capture_call_tool = async (event, properties) => {
381
381
  const GA_NEW_URL = `https://www.google-analytics.com/mp/collect?measurement_id=${GA_NEW_ID}&api_secret=${GA_NEW_SECRET}`;
382
382
  // Route highest-volume tools to new property, rest to old
383
383
  const HIGH_VOLUME_TOOLS = ['start_process', 'track_ui_event'];
384
- const toolName = properties?.name;
384
+ const toolName = properties?.tool_name ?? properties?.name;
385
385
  const gaUrl = HIGH_VOLUME_TOOLS.includes(toolName) ? GA_NEW_URL : GA_OLD_URL;
386
386
  // Build properties once, send to GA4 + telemetry proxy in parallel
387
387
  const eventProperties = await buildEventProperties(properties);
@@ -12,6 +12,8 @@ interface FormattedToolCallRecord extends Omit<ToolCallRecord, 'timestamp'> {
12
12
  declare class ToolHistory {
13
13
  private history;
14
14
  private readonly MAX_ENTRIES;
15
+ private readonly MAX_HISTORY_FILE_SIZE_BYTES;
16
+ private readonly HISTORY_FILE_TRIM_TARGET_BYTES;
15
17
  private readonly historyFile;
16
18
  private writeQueue;
17
19
  private isWriting;
@@ -21,6 +23,17 @@ declare class ToolHistory {
21
23
  * Load history from disk (all instances share the same file)
22
24
  */
23
25
  private loadFromDisk;
26
+ /**
27
+ * Trim the on-disk history file to stay under the size cap by dropping the
28
+ * oldest entries (lines) until the kept tail fits within the trim target.
29
+ * Returns true only when the file was actually rewritten with a smaller
30
+ * tail, so callers can fall through to their normal path on failure or
31
+ * no-op rather than mutating in-memory state.
32
+ *
33
+ * Always keeps at least the most recent entry, even if a single record
34
+ * exceeds the trim target — there is no useful state below that.
35
+ */
36
+ private trimHistoryFileIfTooLarge;
24
37
  /**
25
38
  * Trim history file to prevent it from growing indefinitely
26
39
  */
@@ -18,6 +18,11 @@ class ToolHistory {
18
18
  constructor() {
19
19
  this.history = [];
20
20
  this.MAX_ENTRIES = 1000;
21
+ this.MAX_HISTORY_FILE_SIZE_BYTES = 5 * 1024 * 1024;
22
+ // When the file exceeds the cap we trim it down to this target instead of
23
+ // all the way to zero, so a single overflow doesn't cause every subsequent
24
+ // flush to re-trim.
25
+ this.HISTORY_FILE_TRIM_TARGET_BYTES = 4 * 1024 * 1024;
21
26
  this.writeQueue = [];
22
27
  this.isWriting = false;
23
28
  // Store history in same directory as config to keep everything together
@@ -41,6 +46,9 @@ class ToolHistory {
41
46
  if (!fs.existsSync(this.historyFile)) {
42
47
  return;
43
48
  }
49
+ // If the file is over the cap, trim it down before reading so we
50
+ // load a bounded amount.
51
+ this.trimHistoryFileIfTooLarge();
44
52
  const content = fs.readFileSync(this.historyFile, 'utf-8');
45
53
  const lines = content.trim().split('\n').filter(line => line.trim());
46
54
  // Parse each line as JSON
@@ -64,6 +72,58 @@ class ToolHistory {
64
72
  // Silently fail
65
73
  }
66
74
  }
75
+ /**
76
+ * Trim the on-disk history file to stay under the size cap by dropping the
77
+ * oldest entries (lines) until the kept tail fits within the trim target.
78
+ * Returns true only when the file was actually rewritten with a smaller
79
+ * tail, so callers can fall through to their normal path on failure or
80
+ * no-op rather than mutating in-memory state.
81
+ *
82
+ * Always keeps at least the most recent entry, even if a single record
83
+ * exceeds the trim target — there is no useful state below that.
84
+ */
85
+ trimHistoryFileIfTooLarge() {
86
+ let stats;
87
+ try {
88
+ if (!fs.existsSync(this.historyFile)) {
89
+ return false;
90
+ }
91
+ stats = fs.statSync(this.historyFile);
92
+ if (stats.size <= this.MAX_HISTORY_FILE_SIZE_BYTES) {
93
+ return false;
94
+ }
95
+ }
96
+ catch (error) {
97
+ return false;
98
+ }
99
+ try {
100
+ const content = fs.readFileSync(this.historyFile, 'utf-8');
101
+ const lines = content.split('\n').filter(line => line.length > 0);
102
+ if (lines.length === 0) {
103
+ return false;
104
+ }
105
+ // Walk lines from newest to oldest, accumulating bytes (line + '\n'),
106
+ // and keep as many as fit within the trim target. Always keep at
107
+ // least the last line.
108
+ const kept = [];
109
+ let bytes = 0;
110
+ for (let i = lines.length - 1; i >= 0; i--) {
111
+ const lineBytes = Buffer.byteLength(lines[i], 'utf-8') + 1; // +1 for '\n'
112
+ if (kept.length > 0 && bytes + lineBytes > this.HISTORY_FILE_TRIM_TARGET_BYTES) {
113
+ break;
114
+ }
115
+ kept.push(lines[i]);
116
+ bytes += lineBytes;
117
+ }
118
+ kept.reverse();
119
+ fs.writeFileSync(this.historyFile, kept.join('\n') + '\n', 'utf-8');
120
+ return true;
121
+ }
122
+ catch (error) {
123
+ // Trim failed; do not claim the file was changed.
124
+ return false;
125
+ }
126
+ }
67
127
  /**
68
128
  * Trim history file to prevent it from growing indefinitely
69
129
  */
@@ -101,6 +161,11 @@ class ToolHistory {
101
161
  const toWrite = [...this.writeQueue];
102
162
  this.writeQueue = [];
103
163
  try {
164
+ // If the on-disk file has grown past the cap, trim it down to the
165
+ // target size (keeping the most recent entries) before appending.
166
+ // The in-memory cache is unaffected — it is already bounded by
167
+ // MAX_ENTRIES via addCall.
168
+ this.trimHistoryFileIfTooLarge();
104
169
  // Append to file (atomic append operation)
105
170
  const lines = toWrite.map(entry => JSON.stringify(entry)).join('\n') + '\n';
106
171
  fs.appendFileSync(this.historyFile, lines, 'utf-8');
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.2.39";
1
+ export declare const VERSION = "0.2.40";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.39';
1
+ export const VERSION = '0.2.40';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderwhy-er/desktop-commander",
3
- "version": "0.2.39",
3
+ "version": "0.2.40",
4
4
  "description": "MCP server for terminal operations and file editing",
5
5
  "mcpName": "io.github.wonderwhy-er/desktop-commander",
6
6
  "license": "MIT",
@@ -53,6 +53,7 @@
53
53
  "release:dry": "node scripts/publish-release.cjs --dry-run",
54
54
  "release:mcp": "node scripts/publish-release.cjs --mcp-only",
55
55
  "release:alpha": "node scripts/publish-release.cjs --npm-only --alpha",
56
+ "release:skip-mcp": "node scripts/publish-release.cjs --skip-mcp",
56
57
  "logs:view": "npm run build && node scripts/view-fuzzy-logs.js",
57
58
  "logs:analyze": "npm run build && node scripts/analyze-fuzzy-logs.js",
58
59
  "logs:clear": "npm run build && node scripts/clear-fuzzy-logs.js",
@@ -88,6 +89,10 @@
88
89
  "@supabase/supabase-js": "^2.89.0",
89
90
  "@tiptap/core": "^3.22.3",
90
91
  "@tiptap/extension-image": "^3.22.3",
92
+ "@tiptap/extension-table": "^3.22.4",
93
+ "@tiptap/extension-table-cell": "^3.22.4",
94
+ "@tiptap/extension-table-header": "^3.22.4",
95
+ "@tiptap/extension-table-row": "^3.22.4",
91
96
  "@tiptap/pm": "^3.22.3",
92
97
  "@tiptap/starter-kit": "^3.22.3",
93
98
  "@vscode/ripgrep": "^1.15.9",
@@ -123,6 +128,7 @@
123
128
  "commander": "^13.1.0",
124
129
  "esbuild": "^0.27.2",
125
130
  "js-tiktoken": "^1.0.21",
131
+ "jsdom": "^24.1.3",
126
132
  "nexe": "^5.0.0-beta.4",
127
133
  "nodemon": "^3.0.2",
128
134
  "shx": "^0.3.4",