@aurora-foundation/obsidian-next 0.4.7 → 0.4.9
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/CHANGELOG.md +23 -0
- package/LICENSE +628 -190
- package/README.md +23 -9
- package/dist/auditLog-6WDBDNYL.js +8 -0
- package/dist/auditLog-HGPVDSDC.js +8 -0
- package/dist/auditLog-TDIKFBM4.js +8 -0
- package/dist/auditLog-XC2KY3ZZ.js +8 -0
- package/dist/chunk-2I235WNB.js +133 -0
- package/dist/chunk-2JWDGXTR.js +42 -0
- package/dist/chunk-2NOB6W2B.js +133 -0
- package/dist/chunk-3LFKVKKL.js +7199 -0
- package/dist/chunk-3U6WHPDX.js +4695 -0
- package/dist/chunk-3UCL6RYE.js +7272 -0
- package/dist/chunk-4GN2UQLI.js +130 -0
- package/dist/chunk-4MW33MZD.js +516 -0
- package/dist/chunk-4PUJBUKZ.js +4716 -0
- package/dist/chunk-4QHK6H6O.js +130 -0
- package/dist/chunk-55CQIHCO.js +133 -0
- package/dist/chunk-5LWINFWI.js +676 -0
- package/dist/chunk-5OKGLNQW.js +439 -0
- package/dist/chunk-5T6ETZEO.js +6183 -0
- package/dist/chunk-5WGIFUVL.js +4234 -0
- package/dist/chunk-66EW47T3.js +4237 -0
- package/dist/chunk-6TXUOTT2.js +581 -0
- package/dist/chunk-6YUYSYDA.js +130 -0
- package/dist/chunk-74VPNFMX.js +133 -0
- package/dist/chunk-77CGJRGV.js +6188 -0
- package/dist/chunk-7DS3VT4C.js +7135 -0
- package/dist/chunk-7FHX3VBT.js +133 -0
- package/dist/chunk-7MHF56YU.js +6178 -0
- package/dist/chunk-ABLPMV7G.js +133 -0
- package/dist/chunk-B77K6OQZ.js +687 -0
- package/dist/chunk-BKOXH66O.js +133 -0
- package/dist/chunk-BPP76UN2.js +130 -0
- package/dist/chunk-C4D56GRC.js +5936 -0
- package/dist/chunk-CCDPY4WE.js +370 -0
- package/dist/chunk-CHNVBJN3.js +7272 -0
- package/dist/chunk-CKBZI576.js +7229 -0
- package/dist/chunk-CW5HBSJ2.js +7198 -0
- package/dist/chunk-DGHDJEY7.js +133 -0
- package/dist/chunk-DPNIQWKZ.js +439 -0
- package/dist/chunk-DU4T3V2T.js +214 -0
- package/dist/chunk-DV3WFKNB.js +4679 -0
- package/dist/chunk-DZI2OVN2.js +516 -0
- package/dist/chunk-E45VILML.js +7198 -0
- package/dist/chunk-ECEUUYXC.js +7199 -0
- package/dist/chunk-EJRRSHPW.js +685 -0
- package/dist/chunk-EMBMLZFE.js +370 -0
- package/dist/chunk-EPG5V5OO.js +285 -0
- package/dist/chunk-F2R4HXXW.js +130 -0
- package/dist/chunk-FK6N66ES.js +581 -0
- package/dist/chunk-G3CZKGYA.js +197 -0
- package/dist/chunk-GUUPG4A7.js +7111 -0
- package/dist/chunk-HBAAUGUN.js +7230 -0
- package/dist/chunk-HHFJMK2Q.js +6177 -0
- package/dist/chunk-HINRQTCZ.js +196 -0
- package/dist/chunk-HRKJ3R2U.js +288 -0
- package/dist/chunk-HWVK4CVE.js +439 -0
- package/dist/chunk-JEYSADNZ.js +581 -0
- package/dist/chunk-JNEIL7UN.js +4252 -0
- package/dist/chunk-JTWSK277.js +676 -0
- package/dist/chunk-K4CHTTCJ.js +942 -0
- package/dist/chunk-K7R5KUDS.js +4695 -0
- package/dist/chunk-KNJFOURE.js +7151 -0
- package/dist/chunk-KY22FIT3.js +7256 -0
- package/dist/chunk-L2OTIJSF.js +4228 -0
- package/dist/chunk-LEEBUHP6.js +4655 -0
- package/dist/chunk-LK7UP2T7.js +130 -0
- package/dist/chunk-LPGNO3PK.js +284 -0
- package/dist/chunk-LYQYJMWS.js +133 -0
- package/dist/chunk-MBYFJXR3.js +130 -0
- package/dist/chunk-N3WX44L3.js +130 -0
- package/dist/chunk-N6AQWES3.js +6197 -0
- package/dist/chunk-NW4XSTQZ.js +130 -0
- package/dist/chunk-NWG2XURH.js +130 -0
- package/dist/chunk-O3GF3LJD.js +6142 -0
- package/dist/chunk-OHP5LD3Y.js +6188 -0
- package/dist/chunk-P5PQSFZT.js +6182 -0
- package/dist/chunk-PAADOWNP.js +130 -0
- package/dist/chunk-PERGND7L.js +7213 -0
- package/dist/chunk-PWA7V4XX.js +179 -0
- package/dist/chunk-QGCWEP6L.js +7111 -0
- package/dist/chunk-QVT2IHNJ.js +175 -0
- package/dist/chunk-QZNGYPMS.js +6161 -0
- package/dist/chunk-R6P2E2ZQ.js +207 -0
- package/dist/chunk-ROSDMGIL.js +4679 -0
- package/dist/chunk-RQZP7IKG.js +196 -0
- package/dist/chunk-RUQSPX3U.js +133 -0
- package/dist/chunk-S3BYHP5M.js +130 -0
- package/dist/chunk-S6GNETVE.js +438 -0
- package/dist/chunk-SDT2ZE2R.js +133 -0
- package/dist/chunk-SHQBXJFC.js +6166 -0
- package/dist/chunk-TJNISYTE.js +42 -0
- package/dist/chunk-TJW74HFF.js +130 -0
- package/dist/chunk-TPP72DTK.js +7096 -0
- package/dist/chunk-UOESII6R.js +42 -0
- package/dist/chunk-UWEDGLYJ.js +6142 -0
- package/dist/chunk-V5FYNAFX.js +133 -0
- package/dist/chunk-VPURF6UT.js +7198 -0
- package/dist/chunk-VQH6LWIZ.js +6184 -0
- package/dist/chunk-VS22YVX6.js +7111 -0
- package/dist/chunk-VSF5KBW7.js +367 -0
- package/dist/chunk-VV3JMCKY.js +214 -0
- package/dist/chunk-W5L7HOE3.js +133 -0
- package/dist/chunk-WFEVQISK.js +676 -0
- package/dist/chunk-WJZPSCEP.js +516 -0
- package/dist/chunk-WLV4MKEF.js +16 -0
- package/dist/chunk-WSEVQFFI.js +5428 -0
- package/dist/chunk-X7N2RNR3.js +5428 -0
- package/dist/chunk-XKZNMRNO.js +133 -0
- package/dist/chunk-Y7BVEC36.js +130 -0
- package/dist/chunk-YG7YSNNU.js +4226 -0
- package/dist/chunk-YHM62466.js +261 -0
- package/dist/chunk-YLTYJLDZ.js +7208 -0
- package/dist/chunk-YPMJD4YE.js +56 -0
- package/dist/chunk-YTX3FU2A.js +7199 -0
- package/dist/chunk-ZEQ3EBBN.js +214 -0
- package/dist/chunk-ZIWLQSLK.js +42 -0
- package/dist/chunk-ZJELNTEO.js +516 -0
- package/dist/chunk-ZOSSVNGK.js +370 -0
- package/dist/config-EYK32F2E.js +10 -0
- package/dist/config-FJPPPYTY.js +10 -0
- package/dist/config-VAHPVILX.js +10 -0
- package/dist/context-2YGE4U75.js +10 -0
- package/dist/context-5UFVYKES.js +9 -0
- package/dist/context-ANZF4J72.js +10 -0
- package/dist/context-GLUNCUBQ.js +10 -0
- package/dist/context-M5ULPZKQ.js +10 -0
- package/dist/context-NYOIRZKV.js +10 -0
- package/dist/context-YP2REI6A.js +10 -0
- package/dist/database-MP2JBLMF.js +8 -0
- package/dist/index.js +6177 -4688
- package/dist/keyManager-P2SZONKE.js +8 -0
- package/dist/mcp/index.js +127 -47
- package/dist/memory-BPGJAL4J.js +13 -0
- package/dist/memory-FRQOUI6W.js +13 -0
- package/dist/memory-OAMK27IZ.js +13 -0
- package/dist/memory-OZ734ALL.js +13 -0
- package/dist/memory-PQ2EWRMU.js +13 -0
- package/dist/memory-PXL45M6W.js +13 -0
- package/dist/memory-QZTBTYPH.js +13 -0
- package/dist/migrations-TLJ3WRVW.js +188 -0
- package/dist/resume-2NHDK6EI.js +17 -0
- package/dist/resume-44L2PDB2.js +17 -0
- package/dist/resume-4MXIWUJO.js +7 -0
- package/dist/resume-72VJX66I.js +17 -0
- package/dist/resume-7ZW4XM3B.js +15 -0
- package/dist/resume-AZHYQ657.js +17 -0
- package/dist/resume-CNLXSYHV.js +17 -0
- package/dist/resume-DPN4Q777.js +16 -0
- package/dist/resume-DSFHVNPI.js +15 -0
- package/dist/resume-GHLQJJTO.js +17 -0
- package/dist/resume-HJ6SBWTF.js +17 -0
- package/dist/resume-HRLYHY2L.js +17 -0
- package/dist/resume-ISIQFKO6.js +17 -0
- package/dist/resume-JQDEA6PS.js +15 -0
- package/dist/resume-KP3Y3Y7P.js +17 -0
- package/dist/resume-M4KHR5OI.js +17 -0
- package/dist/resume-N62OAMBG.js +17 -0
- package/dist/resume-NNMA5POT.js +17 -0
- package/dist/resume-ODYT3J4H.js +17 -0
- package/dist/resume-PCFJXA5O.js +17 -0
- package/dist/resume-PLF4XGBD.js +15 -0
- package/dist/resume-Q2PFX57V.js +17 -0
- package/dist/resume-QB4XI2J5.js +17 -0
- package/dist/resume-R5MFTUPF.js +17 -0
- package/dist/resume-SVA7223Z.js +17 -0
- package/dist/resume-TYKKDJZI.js +17 -0
- package/dist/resume-XIS45HKV.js +17 -0
- package/dist/resume-YCSEJTU7.js +17 -0
- package/dist/resume-YD76GI2J.js +15 -0
- package/dist/resume-YDN7EL77.js +17 -0
- package/dist/resume-YE7DB4ZA.js +17 -0
- package/dist/resume-YKAKOXWV.js +15 -0
- package/dist/resume-ZHBCVFDY.js +17 -0
- package/dist/scheduler-2CK24A2Q.js +14 -0
- package/dist/scheduler-7OAF2XKX.js +14 -0
- package/dist/scheduler-AS23AAB5.js +14 -0
- package/dist/scheduler-PCOYQJA5.js +14 -0
- package/dist/scheduler-V2ECBQPK.js +14 -0
- package/dist/scheduler-VEWZ6L7V.js +13 -0
- package/dist/scheduler-W37QMGDQ.js +14 -0
- package/dist/session-2E2JKPD7.js +15 -0
- package/dist/session-2VSF257B.js +14 -0
- package/dist/session-4APFTDJU.js +14 -0
- package/dist/session-5YS5LNNL.js +16 -0
- package/dist/session-6MO5ZPOB.js +16 -0
- package/dist/session-6XMGPRTQ.js +14 -0
- package/dist/session-7DJR77R7.js +16 -0
- package/dist/session-7DQHPWTR.js +14 -0
- package/dist/session-ADKIQCR5.js +16 -0
- package/dist/session-AOGH2GGI.js +16 -0
- package/dist/session-C4W6GDYG.js +16 -0
- package/dist/session-DCGNGGMV.js +14 -0
- package/dist/session-F5JKZAN2.js +16 -0
- package/dist/session-G6F3O2FQ.js +16 -0
- package/dist/session-GFBSARRO.js +16 -0
- package/dist/session-H5IWAIUI.js +16 -0
- package/dist/session-IPFA6AHC.js +14 -0
- package/dist/session-IWG2UOAX.js +14 -0
- package/dist/session-KJ2K4Y4M.js +14 -0
- package/dist/session-KPXFBW6Q.js +14 -0
- package/dist/session-KR256UL5.js +16 -0
- package/dist/session-M72LJXPR.js +16 -0
- package/dist/session-MBK3FODN.js +14 -0
- package/dist/session-MOUFAU7G.js +16 -0
- package/dist/session-NRC6ZXFQ.js +16 -0
- package/dist/session-NRPQMV4K.js +16 -0
- package/dist/session-O5IFFJZQ.js +14 -0
- package/dist/session-OF5BGKDE.js +16 -0
- package/dist/session-OGRZMIM7.js +14 -0
- package/dist/session-OJOFAJG3.js +16 -0
- package/dist/session-OKU4N3SP.js +16 -0
- package/dist/session-P2VAOSFB.js +14 -0
- package/dist/session-PKOVZD4M.js +16 -0
- package/dist/session-POAIMUVN.js +16 -0
- package/dist/session-PSHFONFE.js +16 -0
- package/dist/session-QKYVVZFV.js +16 -0
- package/dist/session-QPWGBMUS.js +14 -0
- package/dist/session-R5UG5PZR.js +14 -0
- package/dist/session-RAY6BZRQ.js +16 -0
- package/dist/session-S3VATHMU.js +16 -0
- package/dist/session-SYTD7RHW.js +14 -0
- package/dist/session-UHMMVO4J.js +16 -0
- package/dist/session-WEX5K3ZY.js +14 -0
- package/dist/session-XFLOXGU3.js +14 -0
- package/dist/session-XV2A4HHG.js +14 -0
- package/dist/settings-3VPJYD4D.js +8 -0
- package/dist/settings-GZTJJTBK.js +8 -0
- package/dist/settings-YKJFSKMO.js +8 -0
- package/dist/shell-FM34624T.js +8 -0
- package/package.json +14 -4
package/dist/mcp/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
computer
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-B77K6OQZ.js";
|
|
5
|
+
import "../chunk-YPMJD4YE.js";
|
|
6
6
|
import {
|
|
7
7
|
config
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-G3CZKGYA.js";
|
|
9
9
|
import "../chunk-WQM6FFSD.js";
|
|
10
10
|
|
|
11
11
|
// src/mcp/server.ts
|
|
@@ -19,7 +19,14 @@ import { promisify } from "util";
|
|
|
19
19
|
var execAsync = promisify(exec);
|
|
20
20
|
var MAX_OUTPUT_LENGTH = 1e4;
|
|
21
21
|
var MAX_FILE_READ_LINES = 500;
|
|
22
|
-
var IGNORED_DIRS = [
|
|
22
|
+
var IGNORED_DIRS = [
|
|
23
|
+
"node_modules",
|
|
24
|
+
".git",
|
|
25
|
+
"dist",
|
|
26
|
+
".next",
|
|
27
|
+
"__pycache__",
|
|
28
|
+
".cache"
|
|
29
|
+
];
|
|
23
30
|
function truncateOutput(output, maxLength = MAX_OUTPUT_LENGTH) {
|
|
24
31
|
if (output.length <= maxLength) return output;
|
|
25
32
|
return `${output.slice(0, maxLength)}
|
|
@@ -53,7 +60,9 @@ function createMcpServer() {
|
|
|
53
60
|
const blocked = ["rm -rf /", "mkfs", "dd if=", ":(){:|:&};:"];
|
|
54
61
|
if (blocked.some((p) => command.includes(p))) {
|
|
55
62
|
return {
|
|
56
|
-
content: [
|
|
63
|
+
content: [
|
|
64
|
+
{ type: "text", text: "Error: Blocked dangerous command pattern" }
|
|
65
|
+
],
|
|
57
66
|
isError: true
|
|
58
67
|
};
|
|
59
68
|
}
|
|
@@ -65,7 +74,14 @@ function createMcpServer() {
|
|
|
65
74
|
maxBuffer: 1024 * 1024
|
|
66
75
|
});
|
|
67
76
|
return {
|
|
68
|
-
content: [
|
|
77
|
+
content: [
|
|
78
|
+
{
|
|
79
|
+
type: "text",
|
|
80
|
+
text: truncateOutput(
|
|
81
|
+
stdout || stderr || "Command executed successfully"
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
]
|
|
69
85
|
};
|
|
70
86
|
} catch (error) {
|
|
71
87
|
return {
|
|
@@ -101,17 +117,21 @@ function createMcpServer() {
|
|
|
101
117
|
const startLine = (offset || 1) - 1;
|
|
102
118
|
const endLine = limit ? startLine + limit : Math.min(startLine + MAX_FILE_READ_LINES, lines.length);
|
|
103
119
|
const selectedLines = lines.slice(startLine, endLine);
|
|
104
|
-
const numbered = selectedLines.map(
|
|
120
|
+
const numbered = selectedLines.map(
|
|
121
|
+
(line, i) => `${String(startLine + i + 1).padStart(4)} | ${line}`
|
|
122
|
+
).join("\n");
|
|
105
123
|
const truncationNote = lines.length > endLine ? `
|
|
106
124
|
|
|
107
125
|
... [${lines.length - endLine} more lines]` : "";
|
|
108
126
|
return {
|
|
109
|
-
content: [
|
|
110
|
-
|
|
111
|
-
|
|
127
|
+
content: [
|
|
128
|
+
{
|
|
129
|
+
type: "text",
|
|
130
|
+
text: `File: ${filePath} (${lines.length} lines)
|
|
112
131
|
${"=".repeat(60)}
|
|
113
132
|
${numbered}${truncationNote}`
|
|
114
|
-
|
|
133
|
+
}
|
|
134
|
+
]
|
|
115
135
|
};
|
|
116
136
|
} catch (error) {
|
|
117
137
|
return {
|
|
@@ -144,7 +164,12 @@ ${numbered}${truncationNote}`
|
|
|
144
164
|
try {
|
|
145
165
|
await fs.access(fullPath);
|
|
146
166
|
return {
|
|
147
|
-
content: [
|
|
167
|
+
content: [
|
|
168
|
+
{
|
|
169
|
+
type: "text",
|
|
170
|
+
text: "Error: File already exists. Use edit tool instead."
|
|
171
|
+
}
|
|
172
|
+
],
|
|
148
173
|
isError: true
|
|
149
174
|
};
|
|
150
175
|
} catch {
|
|
@@ -152,7 +177,12 @@ ${numbered}${truncationNote}`
|
|
|
152
177
|
await fs.mkdir(path.dirname(fullPath), { recursive: true });
|
|
153
178
|
await fs.writeFile(fullPath, content, "utf-8");
|
|
154
179
|
return {
|
|
155
|
-
content: [
|
|
180
|
+
content: [
|
|
181
|
+
{
|
|
182
|
+
type: "text",
|
|
183
|
+
text: `Created: ${filePath} (${content.length} bytes)`
|
|
184
|
+
}
|
|
185
|
+
]
|
|
156
186
|
};
|
|
157
187
|
} catch (error) {
|
|
158
188
|
return {
|
|
@@ -186,7 +216,9 @@ ${numbered}${truncationNote}`
|
|
|
186
216
|
const original = await fs.readFile(fullPath, "utf-8");
|
|
187
217
|
if (!original.includes(search)) {
|
|
188
218
|
return {
|
|
189
|
-
content: [
|
|
219
|
+
content: [
|
|
220
|
+
{ type: "text", text: "Error: Search string not found in file" }
|
|
221
|
+
],
|
|
190
222
|
isError: true
|
|
191
223
|
};
|
|
192
224
|
}
|
|
@@ -196,11 +228,13 @@ ${numbered}${truncationNote}`
|
|
|
196
228
|
const modifiedLines = modified.split("\n").length;
|
|
197
229
|
const delta = modifiedLines - originalLines;
|
|
198
230
|
return {
|
|
199
|
-
content: [
|
|
200
|
-
|
|
201
|
-
|
|
231
|
+
content: [
|
|
232
|
+
{
|
|
233
|
+
type: "text",
|
|
234
|
+
text: `Edited: ${filePath}
|
|
202
235
|
Lines: ${originalLines} -> ${modifiedLines} (${delta >= 0 ? "+" : ""}${delta})`
|
|
203
|
-
|
|
236
|
+
}
|
|
237
|
+
]
|
|
204
238
|
};
|
|
205
239
|
} catch (error) {
|
|
206
240
|
return {
|
|
@@ -239,8 +273,13 @@ Lines: ${originalLines} -> ${modifiedLines} (${delta >= 0 ? "+" : ""}${delta})`
|
|
|
239
273
|
|
|
240
274
|
(${hiddenCount} hidden)` : "";
|
|
241
275
|
return {
|
|
242
|
-
content: [
|
|
243
|
-
|
|
276
|
+
content: [
|
|
277
|
+
{
|
|
278
|
+
type: "text",
|
|
279
|
+
text: `Directory: ${dirPath || "."}
|
|
280
|
+
${formatted}${note}`
|
|
281
|
+
}
|
|
282
|
+
]
|
|
244
283
|
};
|
|
245
284
|
} catch (error) {
|
|
246
285
|
return {
|
|
@@ -272,21 +311,36 @@ ${formatted}${note}` }]
|
|
|
272
311
|
const regex = new RegExp(pattern, "gi");
|
|
273
312
|
for (const entry of entries) {
|
|
274
313
|
if (results.length >= maxResults) break;
|
|
275
|
-
if (entry.name.startsWith(".") || IGNORED_DIRS.includes(entry.name))
|
|
314
|
+
if (entry.name.startsWith(".") || IGNORED_DIRS.includes(entry.name))
|
|
315
|
+
continue;
|
|
276
316
|
const fullPath = path.join(dir, entry.name);
|
|
277
317
|
const relativePath = path.relative(cfg.workspaceRoot, fullPath);
|
|
278
318
|
if (entry.isDirectory()) {
|
|
279
319
|
await searchDir(fullPath, depth + 1);
|
|
280
320
|
} else if (entry.isFile()) {
|
|
281
321
|
const ext = path.extname(entry.name).toLowerCase();
|
|
282
|
-
const textExts = [
|
|
322
|
+
const textExts = [
|
|
323
|
+
".ts",
|
|
324
|
+
".tsx",
|
|
325
|
+
".js",
|
|
326
|
+
".jsx",
|
|
327
|
+
".json",
|
|
328
|
+
".md",
|
|
329
|
+
".txt",
|
|
330
|
+
".yaml",
|
|
331
|
+
".yml",
|
|
332
|
+
".css",
|
|
333
|
+
".html"
|
|
334
|
+
];
|
|
283
335
|
if (textExts.includes(ext) || ext === "") {
|
|
284
336
|
try {
|
|
285
337
|
const content = await fs.readFile(fullPath, "utf-8");
|
|
286
338
|
const lines = content.split("\n");
|
|
287
339
|
for (let i = 0; i < lines.length && results.length < maxResults; i++) {
|
|
288
340
|
if (regex.test(lines[i])) {
|
|
289
|
-
results.push(
|
|
341
|
+
results.push(
|
|
342
|
+
`${relativePath}:${i + 1}: ${lines[i].trim().slice(0, 100)}`
|
|
343
|
+
);
|
|
290
344
|
}
|
|
291
345
|
regex.lastIndex = 0;
|
|
292
346
|
}
|
|
@@ -299,14 +353,18 @@ ${formatted}${note}` }]
|
|
|
299
353
|
const startPath = path.resolve(cfg.workspaceRoot, searchPath || ".");
|
|
300
354
|
await searchDir(startPath);
|
|
301
355
|
if (results.length === 0) {
|
|
302
|
-
return {
|
|
356
|
+
return {
|
|
357
|
+
content: [{ type: "text", text: `No matches for: ${pattern}` }]
|
|
358
|
+
};
|
|
303
359
|
}
|
|
304
360
|
return {
|
|
305
|
-
content: [
|
|
306
|
-
|
|
307
|
-
|
|
361
|
+
content: [
|
|
362
|
+
{
|
|
363
|
+
type: "text",
|
|
364
|
+
text: `Found ${results.length} matches:
|
|
308
365
|
${results.join("\n")}`
|
|
309
|
-
|
|
366
|
+
}
|
|
367
|
+
]
|
|
310
368
|
};
|
|
311
369
|
} catch (error) {
|
|
312
370
|
return {
|
|
@@ -338,7 +396,8 @@ ${results.join("\n")}`
|
|
|
338
396
|
const regex = new RegExp(`^${regexPattern}$`);
|
|
339
397
|
for (const entry of entries) {
|
|
340
398
|
if (results.length >= maxResults) break;
|
|
341
|
-
if (entry.name.startsWith(".") || IGNORED_DIRS.includes(entry.name))
|
|
399
|
+
if (entry.name.startsWith(".") || IGNORED_DIRS.includes(entry.name))
|
|
400
|
+
continue;
|
|
342
401
|
const fullPath = path.join(dir, entry.name);
|
|
343
402
|
const relativePath = path.relative(cfg.workspaceRoot, fullPath);
|
|
344
403
|
if (entry.isDirectory()) {
|
|
@@ -355,11 +414,18 @@ ${results.join("\n")}`
|
|
|
355
414
|
const startPath = path.resolve(cfg.workspaceRoot, basePath || ".");
|
|
356
415
|
await globSearch(startPath);
|
|
357
416
|
if (results.length === 0) {
|
|
358
|
-
return {
|
|
417
|
+
return {
|
|
418
|
+
content: [{ type: "text", text: `No files matching: ${pattern}` }]
|
|
419
|
+
};
|
|
359
420
|
}
|
|
360
421
|
return {
|
|
361
|
-
content: [
|
|
362
|
-
|
|
422
|
+
content: [
|
|
423
|
+
{
|
|
424
|
+
type: "text",
|
|
425
|
+
text: `Found ${results.length} files:
|
|
426
|
+
${results.join("\n")}`
|
|
427
|
+
}
|
|
428
|
+
]
|
|
363
429
|
};
|
|
364
430
|
} catch (error) {
|
|
365
431
|
return {
|
|
@@ -384,7 +450,9 @@ ${results.join("\n")}` }]
|
|
|
384
450
|
const blocked = ["localhost", "127.0.0.1", "0.0.0.0"];
|
|
385
451
|
if (blocked.some((d) => urlObj.hostname.includes(d))) {
|
|
386
452
|
return {
|
|
387
|
-
content: [
|
|
453
|
+
content: [
|
|
454
|
+
{ type: "text", text: "Error: Cannot fetch from local addresses" }
|
|
455
|
+
],
|
|
388
456
|
isError: true
|
|
389
457
|
};
|
|
390
458
|
}
|
|
@@ -407,13 +475,17 @@ ${results.join("\n")}` }]
|
|
|
407
475
|
content = content.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
408
476
|
}
|
|
409
477
|
return {
|
|
410
|
-
content: [
|
|
411
|
-
|
|
412
|
-
|
|
478
|
+
content: [
|
|
479
|
+
{
|
|
480
|
+
type: "text",
|
|
481
|
+
text: truncateOutput(
|
|
482
|
+
`URL: ${url}
|
|
413
483
|
Content-Type: ${contentType}
|
|
414
484
|
${"=".repeat(60)}
|
|
415
|
-
${content}`
|
|
416
|
-
|
|
485
|
+
${content}`
|
|
486
|
+
)
|
|
487
|
+
}
|
|
488
|
+
]
|
|
417
489
|
};
|
|
418
490
|
} catch (error) {
|
|
419
491
|
return {
|
|
@@ -497,7 +569,9 @@ ${content}`)
|
|
|
497
569
|
await computer.leftClickDrag(startX, startY, x, y);
|
|
498
570
|
break;
|
|
499
571
|
default:
|
|
500
|
-
throw new Error(
|
|
572
|
+
throw new Error(
|
|
573
|
+
`Action ${action} not implemented or supported via MCP yet`
|
|
574
|
+
);
|
|
501
575
|
}
|
|
502
576
|
return {
|
|
503
577
|
content: [{ type: "text", text: result }]
|
|
@@ -519,14 +593,20 @@ ${content}`)
|
|
|
519
593
|
async () => {
|
|
520
594
|
const cfg = await config.load();
|
|
521
595
|
return {
|
|
522
|
-
contents: [
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
596
|
+
contents: [
|
|
597
|
+
{
|
|
598
|
+
uri: "obsidian://workspace",
|
|
599
|
+
mimeType: "application/json",
|
|
600
|
+
text: JSON.stringify(
|
|
601
|
+
{
|
|
602
|
+
cwd: cfg.workspaceRoot,
|
|
603
|
+
name: path.basename(cfg.workspaceRoot)
|
|
604
|
+
},
|
|
605
|
+
null,
|
|
606
|
+
2
|
|
607
|
+
)
|
|
608
|
+
}
|
|
609
|
+
]
|
|
530
610
|
};
|
|
531
611
|
}
|
|
532
612
|
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MemoryManager,
|
|
3
|
+
memory
|
|
4
|
+
} from "./chunk-ZJELNTEO.js";
|
|
5
|
+
import "./chunk-VSF5KBW7.js";
|
|
6
|
+
import "./chunk-7MMY74WO.js";
|
|
7
|
+
import "./chunk-EPG5V5OO.js";
|
|
8
|
+
import "./chunk-WQM6FFSD.js";
|
|
9
|
+
import "./chunk-FNLWB54Z.js";
|
|
10
|
+
export {
|
|
11
|
+
MemoryManager,
|
|
12
|
+
memory
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MemoryManager,
|
|
3
|
+
memory
|
|
4
|
+
} from "./chunk-JEYSADNZ.js";
|
|
5
|
+
import "./chunk-HWVK4CVE.js";
|
|
6
|
+
import "./chunk-WQM6FFSD.js";
|
|
7
|
+
import "./chunk-R6P2E2ZQ.js";
|
|
8
|
+
import "./chunk-HRKJ3R2U.js";
|
|
9
|
+
import "./chunk-G3CZKGYA.js";
|
|
10
|
+
export {
|
|
11
|
+
MemoryManager,
|
|
12
|
+
memory
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MemoryManager,
|
|
3
|
+
memory
|
|
4
|
+
} from "./chunk-6TXUOTT2.js";
|
|
5
|
+
import "./chunk-5OKGLNQW.js";
|
|
6
|
+
import "./chunk-G3CZKGYA.js";
|
|
7
|
+
import "./chunk-LPGNO3PK.js";
|
|
8
|
+
import "./chunk-WQM6FFSD.js";
|
|
9
|
+
import "./chunk-R6P2E2ZQ.js";
|
|
10
|
+
export {
|
|
11
|
+
MemoryManager,
|
|
12
|
+
memory
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MemoryManager,
|
|
3
|
+
memory
|
|
4
|
+
} from "./chunk-DZI2OVN2.js";
|
|
5
|
+
import "./chunk-EMBMLZFE.js";
|
|
6
|
+
import "./chunk-PWA7V4XX.js";
|
|
7
|
+
import "./chunk-EPG5V5OO.js";
|
|
8
|
+
import "./chunk-WQM6FFSD.js";
|
|
9
|
+
import "./chunk-FNLWB54Z.js";
|
|
10
|
+
export {
|
|
11
|
+
MemoryManager,
|
|
12
|
+
memory
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MemoryManager,
|
|
3
|
+
memory
|
|
4
|
+
} from "./chunk-WJZPSCEP.js";
|
|
5
|
+
import "./chunk-CCDPY4WE.js";
|
|
6
|
+
import "./chunk-QVT2IHNJ.js";
|
|
7
|
+
import "./chunk-EPG5V5OO.js";
|
|
8
|
+
import "./chunk-WQM6FFSD.js";
|
|
9
|
+
import "./chunk-FNLWB54Z.js";
|
|
10
|
+
export {
|
|
11
|
+
MemoryManager,
|
|
12
|
+
memory
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MemoryManager,
|
|
3
|
+
memory
|
|
4
|
+
} from "./chunk-FK6N66ES.js";
|
|
5
|
+
import "./chunk-DPNIQWKZ.js";
|
|
6
|
+
import "./chunk-G3CZKGYA.js";
|
|
7
|
+
import "./chunk-HRKJ3R2U.js";
|
|
8
|
+
import "./chunk-WQM6FFSD.js";
|
|
9
|
+
import "./chunk-R6P2E2ZQ.js";
|
|
10
|
+
export {
|
|
11
|
+
MemoryManager,
|
|
12
|
+
memory
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MemoryManager,
|
|
3
|
+
memory
|
|
4
|
+
} from "./chunk-4MW33MZD.js";
|
|
5
|
+
import "./chunk-ZOSSVNGK.js";
|
|
6
|
+
import "./chunk-7MMY74WO.js";
|
|
7
|
+
import "./chunk-EPG5V5OO.js";
|
|
8
|
+
import "./chunk-WQM6FFSD.js";
|
|
9
|
+
import "./chunk-FNLWB54Z.js";
|
|
10
|
+
export {
|
|
11
|
+
MemoryManager,
|
|
12
|
+
memory
|
|
13
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bus
|
|
3
|
+
} from "./chunk-WQM6FFSD.js";
|
|
4
|
+
|
|
5
|
+
// src/core/migrations.ts
|
|
6
|
+
var MigrationManager = class {
|
|
7
|
+
migrations = [
|
|
8
|
+
{
|
|
9
|
+
version: 1,
|
|
10
|
+
description: "Update memos table schema with id, key, and updated_at",
|
|
11
|
+
up: (db) => {
|
|
12
|
+
const tableInfo = db.prepare("PRAGMA table_info(memos)").all();
|
|
13
|
+
const hasKey = tableInfo.some((col) => col.name === "key");
|
|
14
|
+
const hasId = tableInfo.some((col) => col.name === "id");
|
|
15
|
+
if (hasKey && hasId) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
bus.emitAgent({
|
|
19
|
+
type: "thought",
|
|
20
|
+
content: "[Migration] Updating memos table schema...",
|
|
21
|
+
hidden: true
|
|
22
|
+
});
|
|
23
|
+
db.exec("ALTER TABLE memos RENAME TO memos_old");
|
|
24
|
+
db.exec(`
|
|
25
|
+
CREATE TABLE memos (
|
|
26
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
27
|
+
session_id TEXT,
|
|
28
|
+
type TEXT NOT NULL,
|
|
29
|
+
key TEXT,
|
|
30
|
+
content TEXT NOT NULL,
|
|
31
|
+
created_at INTEGER DEFAULT (strftime('%s', 'now')),
|
|
32
|
+
updated_at INTEGER DEFAULT (strftime('%s', 'now'))
|
|
33
|
+
);
|
|
34
|
+
`);
|
|
35
|
+
db.exec(`
|
|
36
|
+
INSERT INTO memos (session_id, type, content, created_at, updated_at)
|
|
37
|
+
SELECT session_id, type, content, created_at, created_at
|
|
38
|
+
FROM memos_old;
|
|
39
|
+
`);
|
|
40
|
+
db.exec("DROP TABLE memos_old");
|
|
41
|
+
db.exec(
|
|
42
|
+
"CREATE INDEX IF NOT EXISTS idx_memos_type_key ON memos(type, key);"
|
|
43
|
+
);
|
|
44
|
+
db.exec(
|
|
45
|
+
"CREATE INDEX IF NOT EXISTS idx_memos_session ON memos(session_id);"
|
|
46
|
+
);
|
|
47
|
+
bus.emitAgent({
|
|
48
|
+
type: "thought",
|
|
49
|
+
content: "[Migration] Memos table updated successfully.",
|
|
50
|
+
hidden: true
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
version: 2,
|
|
56
|
+
description: "Add cache token tracking columns to usage_stats",
|
|
57
|
+
up: (db) => {
|
|
58
|
+
const tableInfo = db.prepare("PRAGMA table_info(usage_stats)").all();
|
|
59
|
+
const hasCacheRead = tableInfo.some(
|
|
60
|
+
(col) => col.name === "cache_read_tokens"
|
|
61
|
+
);
|
|
62
|
+
const hasCacheCreation = tableInfo.some(
|
|
63
|
+
(col) => col.name === "cache_creation_tokens"
|
|
64
|
+
);
|
|
65
|
+
if (!hasCacheRead) {
|
|
66
|
+
db.exec(
|
|
67
|
+
"ALTER TABLE usage_stats ADD COLUMN cache_read_tokens INTEGER DEFAULT 0"
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
if (!hasCacheCreation) {
|
|
71
|
+
db.exec(
|
|
72
|
+
"ALTER TABLE usage_stats ADD COLUMN cache_creation_tokens INTEGER DEFAULT 0"
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
bus.emitAgent({
|
|
76
|
+
type: "thought",
|
|
77
|
+
content: "[Migration] Added cache token columns to usage_stats.",
|
|
78
|
+
hidden: true
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
version: 3,
|
|
84
|
+
description: "Add session permissions tracking table",
|
|
85
|
+
up: (db) => {
|
|
86
|
+
db.exec(`
|
|
87
|
+
CREATE TABLE IF NOT EXISTS session_permissions (
|
|
88
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
89
|
+
session_id TEXT NOT NULL,
|
|
90
|
+
permission_type TEXT NOT NULL, -- 'tool', 'path', 'command'
|
|
91
|
+
permission_key TEXT NOT NULL, -- tool name, path pattern, or command pattern
|
|
92
|
+
allowed INTEGER NOT NULL DEFAULT 1, -- 1 = allowed, 0 = denied
|
|
93
|
+
scope TEXT NOT NULL DEFAULT 'session', -- 'session' or 'persistent'
|
|
94
|
+
bypass_sandbox INTEGER DEFAULT 0,
|
|
95
|
+
created_at INTEGER DEFAULT (strftime('%s', 'now')),
|
|
96
|
+
UNIQUE(session_id, permission_type, permission_key)
|
|
97
|
+
);
|
|
98
|
+
`);
|
|
99
|
+
db.exec(
|
|
100
|
+
"CREATE INDEX IF NOT EXISTS idx_session_permissions ON session_permissions(session_id, permission_type);"
|
|
101
|
+
);
|
|
102
|
+
bus.emitAgent({
|
|
103
|
+
type: "thought",
|
|
104
|
+
content: "[Migration] Added session_permissions table.",
|
|
105
|
+
hidden: true
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
version: 4,
|
|
111
|
+
description: "Add memory graph support: relationships and temporal decay",
|
|
112
|
+
up: (db) => {
|
|
113
|
+
db.exec(`
|
|
114
|
+
CREATE TABLE IF NOT EXISTS memo_relations (
|
|
115
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
116
|
+
source_id INTEGER NOT NULL,
|
|
117
|
+
target_id INTEGER NOT NULL,
|
|
118
|
+
relation_type TEXT NOT NULL, -- 'related_to', 'derived_from', 'supersedes', 'contradicts'
|
|
119
|
+
strength REAL DEFAULT 1.0, -- relationship strength 0.0-1.0
|
|
120
|
+
created_at INTEGER DEFAULT (strftime('%s', 'now')),
|
|
121
|
+
FOREIGN KEY (source_id) REFERENCES memos(id) ON DELETE CASCADE,
|
|
122
|
+
FOREIGN KEY (target_id) REFERENCES memos(id) ON DELETE CASCADE,
|
|
123
|
+
UNIQUE(source_id, target_id, relation_type)
|
|
124
|
+
);
|
|
125
|
+
`);
|
|
126
|
+
db.exec(
|
|
127
|
+
"CREATE INDEX IF NOT EXISTS idx_memo_relations_source ON memo_relations(source_id);"
|
|
128
|
+
);
|
|
129
|
+
db.exec(
|
|
130
|
+
"CREATE INDEX IF NOT EXISTS idx_memo_relations_target ON memo_relations(target_id);"
|
|
131
|
+
);
|
|
132
|
+
const tableInfo = db.prepare("PRAGMA table_info(memos)").all();
|
|
133
|
+
const hasAccessCount = tableInfo.some(
|
|
134
|
+
(col) => col.name === "access_count"
|
|
135
|
+
);
|
|
136
|
+
const hasLastAccessed = tableInfo.some(
|
|
137
|
+
(col) => col.name === "last_accessed"
|
|
138
|
+
);
|
|
139
|
+
if (!hasAccessCount) {
|
|
140
|
+
db.exec(
|
|
141
|
+
"ALTER TABLE memos ADD COLUMN access_count INTEGER DEFAULT 0"
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
if (!hasLastAccessed) {
|
|
145
|
+
db.exec(
|
|
146
|
+
"ALTER TABLE memos ADD COLUMN last_accessed INTEGER DEFAULT NULL"
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
bus.emitAgent({
|
|
150
|
+
type: "thought",
|
|
151
|
+
content: "[Migration] Added memory graph support: relations table and temporal decay columns.",
|
|
152
|
+
hidden: true
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
];
|
|
157
|
+
async run(db) {
|
|
158
|
+
db.exec(`
|
|
159
|
+
CREATE TABLE IF NOT EXISTS _migrations (
|
|
160
|
+
version INTEGER PRIMARY KEY,
|
|
161
|
+
description TEXT,
|
|
162
|
+
applied_at INTEGER DEFAULT (strftime('%s', 'now'))
|
|
163
|
+
);
|
|
164
|
+
`);
|
|
165
|
+
const applied = db.prepare("SELECT version FROM _migrations").all();
|
|
166
|
+
const appliedVersions = new Set(applied.map((m) => m.version));
|
|
167
|
+
const pending = this.migrations.filter((m) => !appliedVersions.has(m.version)).sort((a, b) => a.version - b.version);
|
|
168
|
+
for (const migration of pending) {
|
|
169
|
+
try {
|
|
170
|
+
const transaction = db.transaction(() => {
|
|
171
|
+
migration.up(db);
|
|
172
|
+
db.prepare(
|
|
173
|
+
"INSERT INTO _migrations (version, description) VALUES (?, ?)"
|
|
174
|
+
).run(migration.version, migration.description);
|
|
175
|
+
});
|
|
176
|
+
transaction();
|
|
177
|
+
} catch (error) {
|
|
178
|
+
console.error(`Migration ${migration.version} failed:`, error);
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
var migrationManager = new MigrationManager();
|
|
185
|
+
export {
|
|
186
|
+
MigrationManager,
|
|
187
|
+
migrationManager
|
|
188
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resumeCommand
|
|
3
|
+
} from "./chunk-55CQIHCO.js";
|
|
4
|
+
import "./chunk-UWEDGLYJ.js";
|
|
5
|
+
import "./chunk-YHM62466.js";
|
|
6
|
+
import "./chunk-EJRRSHPW.js";
|
|
7
|
+
import "./chunk-DPNIQWKZ.js";
|
|
8
|
+
import "./chunk-B77K6OQZ.js";
|
|
9
|
+
import "./chunk-YPMJD4YE.js";
|
|
10
|
+
import "./chunk-G3CZKGYA.js";
|
|
11
|
+
import "./chunk-HRKJ3R2U.js";
|
|
12
|
+
import "./chunk-S6GNETVE.js";
|
|
13
|
+
import "./chunk-WQM6FFSD.js";
|
|
14
|
+
import "./chunk-R6P2E2ZQ.js";
|
|
15
|
+
export {
|
|
16
|
+
resumeCommand
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resumeCommand
|
|
3
|
+
} from "./chunk-Y7BVEC36.js";
|
|
4
|
+
import "./chunk-DV3WFKNB.js";
|
|
5
|
+
import "./chunk-HINRQTCZ.js";
|
|
6
|
+
import "./chunk-5SWSM5VM.js";
|
|
7
|
+
import "./chunk-MSDU36RT.js";
|
|
8
|
+
import "./chunk-MTJI7ZQR.js";
|
|
9
|
+
import "./chunk-RU4622CN.js";
|
|
10
|
+
import "./chunk-7MMY74WO.js";
|
|
11
|
+
import "./chunk-7RCNGBCH.js";
|
|
12
|
+
import "./chunk-57D77KRX.js";
|
|
13
|
+
import "./chunk-WQM6FFSD.js";
|
|
14
|
+
import "./chunk-FNLWB54Z.js";
|
|
15
|
+
export {
|
|
16
|
+
resumeCommand
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resumeCommand
|
|
3
|
+
} from "./chunk-LK7UP2T7.js";
|
|
4
|
+
import "./chunk-C4D56GRC.js";
|
|
5
|
+
import "./chunk-ZEQ3EBBN.js";
|
|
6
|
+
import "./chunk-WFEVQISK.js";
|
|
7
|
+
import "./chunk-EMBMLZFE.js";
|
|
8
|
+
import "./chunk-MTJI7ZQR.js";
|
|
9
|
+
import "./chunk-RU4622CN.js";
|
|
10
|
+
import "./chunk-PWA7V4XX.js";
|
|
11
|
+
import "./chunk-EPG5V5OO.js";
|
|
12
|
+
import "./chunk-57D77KRX.js";
|
|
13
|
+
import "./chunk-WQM6FFSD.js";
|
|
14
|
+
import "./chunk-FNLWB54Z.js";
|
|
15
|
+
export {
|
|
16
|
+
resumeCommand
|
|
17
|
+
};
|