@mastra/core 1.21.0-alpha.2 → 1.22.0-alpha.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/CHANGELOG.md +84 -0
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/index.cjs +13 -13
- package/dist/agent/index.js +2 -2
- package/dist/agent/message-list/adapters/AIV5Adapter.d.ts.map +1 -1
- package/dist/agent/message-list/conversion/output-converter.d.ts.map +1 -1
- package/dist/agent/message-list/index.cjs +18 -18
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/message-list/message-list.d.ts.map +1 -1
- package/dist/{chunk-QTLGELHE.cjs → chunk-2G5U5LCK.cjs} +148 -17
- package/dist/chunk-2G5U5LCK.cjs.map +1 -0
- package/dist/{chunk-6BIGXDKX.js → chunk-2VC36BDH.js} +6 -6
- package/dist/{chunk-6BIGXDKX.js.map → chunk-2VC36BDH.js.map} +1 -1
- package/dist/{chunk-UQHC7ELQ.js → chunk-3RAYTSPI.js} +16 -9
- package/dist/chunk-3RAYTSPI.js.map +1 -0
- package/dist/{chunk-2YKXARRF.js → chunk-46DASRFB.js} +3 -3
- package/dist/{chunk-2YKXARRF.js.map → chunk-46DASRFB.js.map} +1 -1
- package/dist/{chunk-YPMF3QLA.cjs → chunk-AVRRH42W.cjs} +233 -233
- package/dist/chunk-AVRRH42W.cjs.map +1 -0
- package/dist/{chunk-ZRP4BAK4.js → chunk-B7PS7GR7.js} +147 -17
- package/dist/{chunk-ZRP4BAK4.js.map → chunk-B7PS7GR7.js.map} +1 -1
- package/dist/{chunk-PZG4R64R.cjs → chunk-BFOGUVFL.cjs} +5 -5
- package/dist/{chunk-PZG4R64R.cjs.map → chunk-BFOGUVFL.cjs.map} +1 -1
- package/dist/{chunk-UWYGTSWV.cjs → chunk-DOPULILR.cjs} +34 -30
- package/dist/chunk-DOPULILR.cjs.map +1 -0
- package/dist/{chunk-WICDXZLH.cjs → chunk-DTQCQXSX.cjs} +56 -56
- package/dist/{chunk-WICDXZLH.cjs.map → chunk-DTQCQXSX.cjs.map} +1 -1
- package/dist/{chunk-ELDEBCZS.js → chunk-EFXVHFAI.js} +12 -4
- package/dist/chunk-EFXVHFAI.js.map +1 -0
- package/dist/{chunk-7CSQG6IA.cjs → chunk-FHQY4G2O.cjs} +12 -3
- package/dist/chunk-FHQY4G2O.cjs.map +1 -0
- package/dist/{chunk-2WUDN6HI.js → chunk-FXONBE4Y.js} +4 -4
- package/dist/{chunk-2WUDN6HI.js.map → chunk-FXONBE4Y.js.map} +1 -1
- package/dist/{chunk-LOA2BVRK.js → chunk-HJBVUY76.js} +230 -230
- package/dist/chunk-HJBVUY76.js.map +1 -0
- package/dist/{chunk-ZLBAC3BN.cjs → chunk-HVE6QR4G.cjs} +6 -6
- package/dist/{chunk-ZLBAC3BN.cjs.map → chunk-HVE6QR4G.cjs.map} +1 -1
- package/dist/{chunk-DGX6FWSX.cjs → chunk-JZBAUINL.cjs} +91 -83
- package/dist/chunk-JZBAUINL.cjs.map +1 -0
- package/dist/{chunk-V2MOZKZ2.cjs → chunk-K7TAXUW5.cjs} +13 -13
- package/dist/{chunk-V2MOZKZ2.cjs.map → chunk-K7TAXUW5.cjs.map} +1 -1
- package/dist/{chunk-NHWPIKUM.js → chunk-KYIYBC6A.js} +4 -4
- package/dist/{chunk-NHWPIKUM.js.map → chunk-KYIYBC6A.js.map} +1 -1
- package/dist/{chunk-AJB745SL.js → chunk-M5PKEDYH.js} +3 -3
- package/dist/{chunk-AJB745SL.js.map → chunk-M5PKEDYH.js.map} +1 -1
- package/dist/{chunk-NRA3BO5W.js → chunk-MOVQYN2F.js} +34 -30
- package/dist/chunk-MOVQYN2F.js.map +1 -0
- package/dist/{chunk-PSGEUNAH.js → chunk-NB435LXG.js} +4 -4
- package/dist/{chunk-PSGEUNAH.js.map → chunk-NB435LXG.js.map} +1 -1
- package/dist/{chunk-67X7ZYMH.js → chunk-NHWDBHFY.js} +3 -3
- package/dist/{chunk-67X7ZYMH.js.map → chunk-NHWDBHFY.js.map} +1 -1
- package/dist/{chunk-CDO4JQEO.cjs → chunk-O2FAC2JL.cjs} +186 -185
- package/dist/{chunk-CDO4JQEO.cjs.map → chunk-O2FAC2JL.cjs.map} +1 -1
- package/dist/{chunk-L3QX2IX7.js → chunk-PBVPRLDI.js} +17 -10
- package/dist/chunk-PBVPRLDI.js.map +1 -0
- package/dist/{chunk-J2CBK7QL.cjs → chunk-PCDPQEYH.cjs} +7 -7
- package/dist/{chunk-J2CBK7QL.cjs.map → chunk-PCDPQEYH.cjs.map} +1 -1
- package/dist/{chunk-OPR6DNSN.js → chunk-PJRKKSYW.js} +29 -17
- package/dist/chunk-PJRKKSYW.js.map +1 -0
- package/dist/{chunk-DRWYPRD7.cjs → chunk-QF4KRWYU.cjs} +94 -82
- package/dist/chunk-QF4KRWYU.cjs.map +1 -0
- package/dist/{chunk-EKR6FZOG.js → chunk-RZISMMDM.js} +4 -4
- package/dist/{chunk-EKR6FZOG.js.map → chunk-RZISMMDM.js.map} +1 -1
- package/dist/{chunk-MBWY7AOA.cjs → chunk-TDTG2WDG.cjs} +7 -7
- package/dist/{chunk-MBWY7AOA.cjs.map → chunk-TDTG2WDG.cjs.map} +1 -1
- package/dist/{chunk-246GELHA.js → chunk-U63DZ6E6.js} +4 -4
- package/dist/{chunk-246GELHA.js.map → chunk-U63DZ6E6.js.map} +1 -1
- package/dist/{chunk-YF5TQNL3.cjs → chunk-WTV62NHE.cjs} +9 -9
- package/dist/{chunk-YF5TQNL3.cjs.map → chunk-WTV62NHE.cjs.map} +1 -1
- package/dist/{chunk-Q63LQZN5.cjs → chunk-YYPOSWKA.cjs} +23 -16
- package/dist/chunk-YYPOSWKA.cjs.map +1 -0
- package/dist/{chunk-OMKFSCBO.cjs → chunk-ZTC3TLFM.cjs} +3 -3
- package/dist/{chunk-OMKFSCBO.cjs.map → chunk-ZTC3TLFM.cjs.map} +1 -1
- package/dist/datasets/index.cjs +17 -17
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +263 -245
- package/dist/evals/index.cjs +5 -5
- package/dist/evals/index.js +2 -2
- package/dist/evals/scoreTraces/index.cjs +3 -3
- package/dist/evals/scoreTraces/index.js +1 -1
- package/dist/harness/index.cjs +13 -13
- package/dist/harness/index.js +7 -7
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/llm/index.cjs +36 -20
- package/dist/llm/index.d.ts +5 -4
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +5 -5
- package/dist/llm/model/gateways/base.d.ts +5 -0
- package/dist/llm/model/gateways/base.d.ts.map +1 -1
- package/dist/llm/model/gateways/constants.d.ts +1 -0
- package/dist/llm/model/gateways/constants.d.ts.map +1 -1
- package/dist/llm/model/gateways/index.d.ts +1 -0
- package/dist/llm/model/gateways/index.d.ts.map +1 -1
- package/dist/llm/model/gateways/mastra.d.ts +25 -0
- package/dist/llm/model/gateways/mastra.d.ts.map +1 -0
- package/dist/llm/model/provider-registry.d.ts.map +1 -1
- package/dist/llm/model/provider-types.generated.d.ts +1 -0
- package/dist/llm/model/registry-generator.d.ts.map +1 -1
- package/dist/llm/model/router.d.ts +4 -2
- package/dist/llm/model/router.d.ts.map +1 -1
- package/dist/loop/index.cjs +14 -14
- package/dist/loop/index.js +1 -1
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/mastra-2EQZYM7C.js +3 -0
- package/dist/mastra-2EQZYM7C.js.map +1 -0
- package/dist/mastra-XPBVZO54.cjs +12 -0
- package/dist/mastra-XPBVZO54.cjs.map +1 -0
- package/dist/memory/index.cjs +14 -14
- package/dist/memory/index.js +1 -1
- package/dist/models-dev-DA5OEOGQ.js +3 -0
- package/dist/{models-dev-PGMVTTO7.js.map → models-dev-DA5OEOGQ.js.map} +1 -1
- package/dist/models-dev-HDA3INHC.cjs +12 -0
- package/dist/{models-dev-NB7CKJAS.cjs.map → models-dev-HDA3INHC.cjs.map} +1 -1
- package/dist/netlify-6PWJPWSI.cjs +12 -0
- package/dist/{netlify-NFMAID4M.cjs.map → netlify-6PWJPWSI.cjs.map} +1 -1
- package/dist/netlify-EENUHCAW.js +3 -0
- package/dist/{netlify-3BL6W3LY.js.map → netlify-EENUHCAW.js.map} +1 -1
- package/dist/processor-provider/index.cjs +10 -10
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +44 -44
- package/dist/processors/index.js +1 -1
- package/dist/provider-registry-TQS5D74S.js +3 -0
- package/dist/{provider-registry-CHVK2YJI.js.map → provider-registry-TQS5D74S.js.map} +1 -1
- package/dist/provider-registry-VE7OCGGU.cjs +40 -0
- package/dist/{provider-registry-A6OIBOAB.cjs.map → provider-registry-VE7OCGGU.cjs.map} +1 -1
- package/dist/{registry-generator-BRPCL2LG.js → registry-generator-QMLHG25G.js} +10 -3
- package/dist/registry-generator-QMLHG25G.js.map +1 -0
- package/dist/{registry-generator-PUWKZKVW.cjs → registry-generator-VNYH6GDH.cjs} +10 -3
- package/dist/registry-generator-VNYH6GDH.cjs.map +1 -0
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/storage/index.cjs +74 -74
- package/dist/storage/index.js +1 -1
- package/dist/stream/index.cjs +11 -11
- package/dist/stream/index.js +2 -2
- package/dist/test-utils/llm-mock.cjs +4 -4
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/utils.cjs +25 -25
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +7 -7
- package/dist/vector/index.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +24 -24
- package/dist/workflows/index.js +1 -1
- package/dist/workspace/index.cjs +68 -68
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/sandbox/local-process-manager.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/llm/model/provider-types.generated.d.ts +1 -0
- package/dist/chunk-7CSQG6IA.cjs.map +0 -1
- package/dist/chunk-DGX6FWSX.cjs.map +0 -1
- package/dist/chunk-DRWYPRD7.cjs.map +0 -1
- package/dist/chunk-ELDEBCZS.js.map +0 -1
- package/dist/chunk-L3QX2IX7.js.map +0 -1
- package/dist/chunk-LOA2BVRK.js.map +0 -1
- package/dist/chunk-NRA3BO5W.js.map +0 -1
- package/dist/chunk-OPR6DNSN.js.map +0 -1
- package/dist/chunk-Q63LQZN5.cjs.map +0 -1
- package/dist/chunk-QTLGELHE.cjs.map +0 -1
- package/dist/chunk-UQHC7ELQ.js.map +0 -1
- package/dist/chunk-UWYGTSWV.cjs.map +0 -1
- package/dist/chunk-YPMF3QLA.cjs.map +0 -1
- package/dist/models-dev-NB7CKJAS.cjs +0 -12
- package/dist/models-dev-PGMVTTO7.js +0 -3
- package/dist/netlify-3BL6W3LY.js +0 -3
- package/dist/netlify-NFMAID4M.cjs +0 -12
- package/dist/provider-registry-A6OIBOAB.cjs +0 -40
- package/dist/provider-registry-CHVK2YJI.js +0 -3
- package/dist/registry-generator-BRPCL2LG.js.map +0 -1
- package/dist/registry-generator-PUWKZKVW.cjs.map +0 -1
|
@@ -100,68 +100,68 @@ var WorkspaceReadOnlyError = class extends WorkspaceError {
|
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
var FilesystemError = class extends Error {
|
|
103
|
-
constructor(message, code,
|
|
103
|
+
constructor(message, code, path9) {
|
|
104
104
|
super(message);
|
|
105
105
|
this.code = code;
|
|
106
|
-
this.path =
|
|
106
|
+
this.path = path9;
|
|
107
107
|
this.name = "FilesystemError";
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
110
|
var FileNotFoundError = class extends FilesystemError {
|
|
111
|
-
constructor(
|
|
112
|
-
super(`File not found: ${
|
|
111
|
+
constructor(path9) {
|
|
112
|
+
super(`File not found: ${path9}`, "ENOENT", path9);
|
|
113
113
|
this.name = "FileNotFoundError";
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
var DirectoryNotFoundError = class extends FilesystemError {
|
|
117
|
-
constructor(
|
|
118
|
-
super(`Directory not found: ${
|
|
117
|
+
constructor(path9) {
|
|
118
|
+
super(`Directory not found: ${path9}`, "ENOENT", path9);
|
|
119
119
|
this.name = "DirectoryNotFoundError";
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
var FileExistsError = class extends FilesystemError {
|
|
123
|
-
constructor(
|
|
124
|
-
super(`File already exists: ${
|
|
123
|
+
constructor(path9) {
|
|
124
|
+
super(`File already exists: ${path9}`, "EEXIST", path9);
|
|
125
125
|
this.name = "FileExistsError";
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
var IsDirectoryError = class extends FilesystemError {
|
|
129
|
-
constructor(
|
|
130
|
-
super(`Path is a directory: ${
|
|
129
|
+
constructor(path9) {
|
|
130
|
+
super(`Path is a directory: ${path9}`, "EISDIR", path9);
|
|
131
131
|
this.name = "IsDirectoryError";
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
var NotDirectoryError = class extends FilesystemError {
|
|
135
|
-
constructor(
|
|
136
|
-
super(`Path is not a directory: ${
|
|
135
|
+
constructor(path9) {
|
|
136
|
+
super(`Path is not a directory: ${path9}`, "ENOTDIR", path9);
|
|
137
137
|
this.name = "NotDirectoryError";
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
var DirectoryNotEmptyError = class extends FilesystemError {
|
|
141
|
-
constructor(
|
|
142
|
-
super(`Directory not empty: ${
|
|
141
|
+
constructor(path9) {
|
|
142
|
+
super(`Directory not empty: ${path9}`, "ENOTEMPTY", path9);
|
|
143
143
|
this.name = "DirectoryNotEmptyError";
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
var PermissionError = class extends FilesystemError {
|
|
147
|
-
constructor(
|
|
148
|
-
super(`Permission denied: ${operation} on ${
|
|
147
|
+
constructor(path9, operation) {
|
|
148
|
+
super(`Permission denied: ${operation} on ${path9}`, "EACCES", path9);
|
|
149
149
|
this.operation = operation;
|
|
150
150
|
this.name = "PermissionError";
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
153
|
var FileReadRequiredError = class extends FilesystemError {
|
|
154
|
-
constructor(
|
|
155
|
-
super(reason, "EREAD_REQUIRED",
|
|
154
|
+
constructor(path9, reason) {
|
|
155
|
+
super(reason, "EREAD_REQUIRED", path9);
|
|
156
156
|
this.name = "FileReadRequiredError";
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
159
|
var StaleFileError = class extends FilesystemError {
|
|
160
|
-
constructor(
|
|
160
|
+
constructor(path9, expectedMtime, actualMtime) {
|
|
161
161
|
super(
|
|
162
|
-
`File was modified externally: ${
|
|
162
|
+
`File was modified externally: ${path9} (expected mtime ${expectedMtime.toISOString()}, actual ${actualMtime.toISOString()})`,
|
|
163
163
|
"ESTALE",
|
|
164
|
-
|
|
164
|
+
path9
|
|
165
165
|
);
|
|
166
166
|
this.expectedMtime = expectedMtime;
|
|
167
167
|
this.actualMtime = actualMtime;
|
|
@@ -200,8 +200,8 @@ var CompositeFilesystem = class {
|
|
|
200
200
|
constructor(config) {
|
|
201
201
|
this.id = `cfs-${Date.now().toString(36)}`;
|
|
202
202
|
this._mounts = /* @__PURE__ */ new Map();
|
|
203
|
-
for (const [
|
|
204
|
-
const normalized = this.normalizePath(
|
|
203
|
+
for (const [path9, fs6] of Object.entries(config.mounts)) {
|
|
204
|
+
const normalized = this.normalizePath(path9);
|
|
205
205
|
this._mounts.set(normalized, fs6);
|
|
206
206
|
}
|
|
207
207
|
if (this._mounts.size === 0) {
|
|
@@ -252,37 +252,37 @@ var CompositeFilesystem = class {
|
|
|
252
252
|
* Get the underlying filesystem for a given path.
|
|
253
253
|
* Returns undefined if the path doesn't resolve to any mount.
|
|
254
254
|
*/
|
|
255
|
-
getFilesystemForPath(
|
|
256
|
-
const resolved = this.resolveMount(
|
|
255
|
+
getFilesystemForPath(path9) {
|
|
256
|
+
const resolved = this.resolveMount(path9);
|
|
257
257
|
return resolved?.fs;
|
|
258
258
|
}
|
|
259
259
|
/**
|
|
260
260
|
* Get the mount path for a given path.
|
|
261
261
|
* Returns undefined if the path doesn't resolve to any mount.
|
|
262
262
|
*/
|
|
263
|
-
getMountPathForPath(
|
|
264
|
-
const resolved = this.resolveMount(
|
|
263
|
+
getMountPathForPath(path9) {
|
|
264
|
+
const resolved = this.resolveMount(path9);
|
|
265
265
|
return resolved?.mountPath;
|
|
266
266
|
}
|
|
267
267
|
/**
|
|
268
268
|
* Resolve a workspace-relative path to an absolute disk path.
|
|
269
269
|
* Strips the mount prefix and delegates to the underlying filesystem.
|
|
270
270
|
*/
|
|
271
|
-
resolveAbsolutePath(
|
|
272
|
-
const r = this.resolveMount(
|
|
271
|
+
resolveAbsolutePath(path9) {
|
|
272
|
+
const r = this.resolveMount(path9);
|
|
273
273
|
if (!r) return void 0;
|
|
274
274
|
return r.fs.resolveAbsolutePath?.(r.fsPath);
|
|
275
275
|
}
|
|
276
|
-
normalizePath(
|
|
277
|
-
if (!
|
|
278
|
-
let n = posixPath__default.default.normalize(
|
|
276
|
+
normalizePath(path9) {
|
|
277
|
+
if (!path9 || path9 === "/" || path9 === ".") return "/";
|
|
278
|
+
let n = posixPath__default.default.normalize(path9);
|
|
279
279
|
if (n === ".") return "/";
|
|
280
280
|
if (!n.startsWith("/")) n = `/${n}`;
|
|
281
281
|
if (n.length > 1 && n.endsWith("/")) n = n.slice(0, -1);
|
|
282
282
|
return n;
|
|
283
283
|
}
|
|
284
|
-
resolveMount(
|
|
285
|
-
const normalized = this.normalizePath(
|
|
284
|
+
resolveMount(path9) {
|
|
285
|
+
const normalized = this.normalizePath(path9);
|
|
286
286
|
let best = null;
|
|
287
287
|
for (const [mountPath, fs6] of this._mounts) {
|
|
288
288
|
if (normalized === mountPath || normalized.startsWith(mountPath + "/")) {
|
|
@@ -297,8 +297,8 @@ var CompositeFilesystem = class {
|
|
|
297
297
|
else if (fsPath.startsWith("/")) fsPath = fsPath.slice(1);
|
|
298
298
|
return { fs: best.fs, fsPath, mountPath: best.mountPath };
|
|
299
299
|
}
|
|
300
|
-
getVirtualEntries(
|
|
301
|
-
const normalized = this.normalizePath(
|
|
300
|
+
getVirtualEntries(path9) {
|
|
301
|
+
const normalized = this.normalizePath(path9);
|
|
302
302
|
if (this.resolveMount(normalized)) return null;
|
|
303
303
|
const entriesMap = /* @__PURE__ */ new Map();
|
|
304
304
|
for (const [mountPath, fs6] of this._mounts.entries()) {
|
|
@@ -325,8 +325,8 @@ var CompositeFilesystem = class {
|
|
|
325
325
|
}
|
|
326
326
|
return entriesMap.size > 0 ? Array.from(entriesMap.values()) : null;
|
|
327
327
|
}
|
|
328
|
-
isVirtualPath(
|
|
329
|
-
const normalized = this.normalizePath(
|
|
328
|
+
isVirtualPath(path9) {
|
|
329
|
+
const normalized = this.normalizePath(path9);
|
|
330
330
|
if (normalized === "/" && !this._mounts.has("/")) return true;
|
|
331
331
|
for (const mountPath of this._mounts.keys()) {
|
|
332
332
|
if (mountPath.startsWith(normalized + "/")) return true;
|
|
@@ -337,9 +337,9 @@ var CompositeFilesystem = class {
|
|
|
337
337
|
* Assert that a filesystem is writable (not read-only).
|
|
338
338
|
* @throws {PermissionError} if the filesystem is read-only
|
|
339
339
|
*/
|
|
340
|
-
assertWritable(fs6,
|
|
340
|
+
assertWritable(fs6, path9, operation) {
|
|
341
341
|
if (fs6.readOnly) {
|
|
342
|
-
throw new PermissionError(
|
|
342
|
+
throw new PermissionError(path9, `${operation} (filesystem is read-only)`);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
// ===========================================================================
|
|
@@ -373,27 +373,27 @@ var CompositeFilesystem = class {
|
|
|
373
373
|
}
|
|
374
374
|
this.status = "destroyed";
|
|
375
375
|
}
|
|
376
|
-
async readFile(
|
|
377
|
-
const r = this.resolveMount(
|
|
378
|
-
if (!r) throw new Error(`No mount for path: ${
|
|
376
|
+
async readFile(path9, options) {
|
|
377
|
+
const r = this.resolveMount(path9);
|
|
378
|
+
if (!r) throw new Error(`No mount for path: ${path9}`);
|
|
379
379
|
return r.fs.readFile(r.fsPath, options);
|
|
380
380
|
}
|
|
381
|
-
async writeFile(
|
|
382
|
-
const r = this.resolveMount(
|
|
383
|
-
if (!r) throw new Error(`No mount for path: ${
|
|
384
|
-
this.assertWritable(r.fs,
|
|
381
|
+
async writeFile(path9, content, options) {
|
|
382
|
+
const r = this.resolveMount(path9);
|
|
383
|
+
if (!r) throw new Error(`No mount for path: ${path9}`);
|
|
384
|
+
this.assertWritable(r.fs, path9, "writeFile");
|
|
385
385
|
return r.fs.writeFile(r.fsPath, content, options);
|
|
386
386
|
}
|
|
387
|
-
async appendFile(
|
|
388
|
-
const r = this.resolveMount(
|
|
389
|
-
if (!r) throw new Error(`No mount for path: ${
|
|
390
|
-
this.assertWritable(r.fs,
|
|
387
|
+
async appendFile(path9, content) {
|
|
388
|
+
const r = this.resolveMount(path9);
|
|
389
|
+
if (!r) throw new Error(`No mount for path: ${path9}`);
|
|
390
|
+
this.assertWritable(r.fs, path9, "appendFile");
|
|
391
391
|
return r.fs.appendFile(r.fsPath, content);
|
|
392
392
|
}
|
|
393
|
-
async deleteFile(
|
|
394
|
-
const r = this.resolveMount(
|
|
395
|
-
if (!r) throw new Error(`No mount for path: ${
|
|
396
|
-
this.assertWritable(r.fs,
|
|
393
|
+
async deleteFile(path9, options) {
|
|
394
|
+
const r = this.resolveMount(path9);
|
|
395
|
+
if (!r) throw new Error(`No mount for path: ${path9}`);
|
|
396
|
+
this.assertWritable(r.fs, path9, "deleteFile");
|
|
397
397
|
return r.fs.deleteFile(r.fsPath, options);
|
|
398
398
|
}
|
|
399
399
|
async copyFile(src, dest, options) {
|
|
@@ -421,35 +421,35 @@ var CompositeFilesystem = class {
|
|
|
421
421
|
await this.copyFile(src, dest, options);
|
|
422
422
|
await srcR.fs.deleteFile(srcR.fsPath);
|
|
423
423
|
}
|
|
424
|
-
async readdir(
|
|
425
|
-
const virtual = this.getVirtualEntries(
|
|
424
|
+
async readdir(path9, options) {
|
|
425
|
+
const virtual = this.getVirtualEntries(path9);
|
|
426
426
|
if (virtual) return virtual;
|
|
427
|
-
const r = this.resolveMount(
|
|
428
|
-
if (!r) throw new Error(`No mount for path: ${
|
|
427
|
+
const r = this.resolveMount(path9);
|
|
428
|
+
if (!r) throw new Error(`No mount for path: ${path9}`);
|
|
429
429
|
return r.fs.readdir(r.fsPath, options);
|
|
430
430
|
}
|
|
431
|
-
async mkdir(
|
|
432
|
-
const r = this.resolveMount(
|
|
433
|
-
if (!r) throw new Error(`No mount for path: ${
|
|
434
|
-
this.assertWritable(r.fs,
|
|
431
|
+
async mkdir(path9, options) {
|
|
432
|
+
const r = this.resolveMount(path9);
|
|
433
|
+
if (!r) throw new Error(`No mount for path: ${path9}`);
|
|
434
|
+
this.assertWritable(r.fs, path9, "mkdir");
|
|
435
435
|
return r.fs.mkdir(r.fsPath, options);
|
|
436
436
|
}
|
|
437
|
-
async rmdir(
|
|
438
|
-
const r = this.resolveMount(
|
|
439
|
-
if (!r) throw new Error(`No mount for path: ${
|
|
440
|
-
this.assertWritable(r.fs,
|
|
437
|
+
async rmdir(path9, options) {
|
|
438
|
+
const r = this.resolveMount(path9);
|
|
439
|
+
if (!r) throw new Error(`No mount for path: ${path9}`);
|
|
440
|
+
this.assertWritable(r.fs, path9, "rmdir");
|
|
441
441
|
return r.fs.rmdir(r.fsPath, options);
|
|
442
442
|
}
|
|
443
|
-
async exists(
|
|
444
|
-
if (this.isVirtualPath(
|
|
445
|
-
const r = this.resolveMount(
|
|
443
|
+
async exists(path9) {
|
|
444
|
+
if (this.isVirtualPath(path9)) return true;
|
|
445
|
+
const r = this.resolveMount(path9);
|
|
446
446
|
if (!r) return false;
|
|
447
447
|
if (r.fsPath === "") return true;
|
|
448
448
|
return r.fs.exists(r.fsPath);
|
|
449
449
|
}
|
|
450
|
-
async stat(
|
|
451
|
-
const normalized = this.normalizePath(
|
|
452
|
-
if (this.isVirtualPath(
|
|
450
|
+
async stat(path9) {
|
|
451
|
+
const normalized = this.normalizePath(path9);
|
|
452
|
+
if (this.isVirtualPath(path9)) {
|
|
453
453
|
const parts = normalized.split("/").filter(Boolean);
|
|
454
454
|
const now = /* @__PURE__ */ new Date();
|
|
455
455
|
return {
|
|
@@ -461,8 +461,8 @@ var CompositeFilesystem = class {
|
|
|
461
461
|
modifiedAt: now
|
|
462
462
|
};
|
|
463
463
|
}
|
|
464
|
-
const r = this.resolveMount(
|
|
465
|
-
if (!r) throw new Error(`No mount for path: ${
|
|
464
|
+
const r = this.resolveMount(path9);
|
|
465
|
+
if (!r) throw new Error(`No mount for path: ${path9}`);
|
|
466
466
|
if (r.fsPath === "") {
|
|
467
467
|
const parts = normalized.split("/").filter(Boolean);
|
|
468
468
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -477,9 +477,9 @@ var CompositeFilesystem = class {
|
|
|
477
477
|
}
|
|
478
478
|
return r.fs.stat(r.fsPath);
|
|
479
479
|
}
|
|
480
|
-
async isFile(
|
|
481
|
-
if (this.isVirtualPath(
|
|
482
|
-
const r = this.resolveMount(
|
|
480
|
+
async isFile(path9) {
|
|
481
|
+
if (this.isVirtualPath(path9)) return false;
|
|
482
|
+
const r = this.resolveMount(path9);
|
|
483
483
|
if (!r) return false;
|
|
484
484
|
try {
|
|
485
485
|
const stat3 = await r.fs.stat(r.fsPath);
|
|
@@ -488,9 +488,9 @@ var CompositeFilesystem = class {
|
|
|
488
488
|
return false;
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
async isDirectory(
|
|
492
|
-
if (this.isVirtualPath(
|
|
493
|
-
const r = this.resolveMount(
|
|
491
|
+
async isDirectory(path9) {
|
|
492
|
+
if (this.isVirtualPath(path9)) return true;
|
|
493
|
+
const r = this.resolveMount(path9);
|
|
494
494
|
if (!r) return false;
|
|
495
495
|
if (r.fsPath === "") return true;
|
|
496
496
|
try {
|
|
@@ -1375,35 +1375,35 @@ var LocalFilesystem = class extends MastraFilesystem {
|
|
|
1375
1375
|
};
|
|
1376
1376
|
var InMemoryFileReadTracker = class {
|
|
1377
1377
|
records = /* @__PURE__ */ new Map();
|
|
1378
|
-
recordRead(
|
|
1379
|
-
const normalizedPath = this.normalizePath(
|
|
1378
|
+
recordRead(path9, modifiedAt) {
|
|
1379
|
+
const normalizedPath = this.normalizePath(path9);
|
|
1380
1380
|
this.records.set(normalizedPath, {
|
|
1381
1381
|
path: normalizedPath,
|
|
1382
1382
|
readAt: /* @__PURE__ */ new Date(),
|
|
1383
1383
|
modifiedAtRead: modifiedAt
|
|
1384
1384
|
});
|
|
1385
1385
|
}
|
|
1386
|
-
getReadRecord(
|
|
1387
|
-
return this.records.get(this.normalizePath(
|
|
1386
|
+
getReadRecord(path9) {
|
|
1387
|
+
return this.records.get(this.normalizePath(path9));
|
|
1388
1388
|
}
|
|
1389
|
-
needsReRead(
|
|
1390
|
-
const record = this.getReadRecord(
|
|
1389
|
+
needsReRead(path9, currentModifiedAt) {
|
|
1390
|
+
const record = this.getReadRecord(path9);
|
|
1391
1391
|
if (!record) {
|
|
1392
1392
|
return {
|
|
1393
1393
|
needsReRead: true,
|
|
1394
|
-
reason: `File "${
|
|
1394
|
+
reason: `File "${path9}" has not been read. You must read a file before writing to it.`
|
|
1395
1395
|
};
|
|
1396
1396
|
}
|
|
1397
1397
|
if (currentModifiedAt.getTime() > record.modifiedAtRead.getTime()) {
|
|
1398
1398
|
return {
|
|
1399
1399
|
needsReRead: true,
|
|
1400
|
-
reason: `File "${
|
|
1400
|
+
reason: `File "${path9}" was modified since last read (read at: ${record.modifiedAtRead.toISOString()}, current: ${currentModifiedAt.toISOString()}). Please re-read the file to get the latest contents.`
|
|
1401
1401
|
};
|
|
1402
1402
|
}
|
|
1403
1403
|
return { needsReRead: false };
|
|
1404
1404
|
}
|
|
1405
|
-
clearReadRecord(
|
|
1406
|
-
this.records.delete(this.normalizePath(
|
|
1405
|
+
clearReadRecord(path9) {
|
|
1406
|
+
this.records.delete(this.normalizePath(path9));
|
|
1407
1407
|
}
|
|
1408
1408
|
clear() {
|
|
1409
1409
|
this.records.clear();
|
|
@@ -1425,10 +1425,10 @@ var InMemoryFileWriteLock = class {
|
|
|
1425
1425
|
withLock(filePath, fn) {
|
|
1426
1426
|
const key = this.normalizePath(filePath);
|
|
1427
1427
|
const currentQueue = this.queues.get(key) ?? Promise.resolve();
|
|
1428
|
-
let
|
|
1428
|
+
let resolve6;
|
|
1429
1429
|
let reject;
|
|
1430
1430
|
const resultPromise = new Promise((res, rej) => {
|
|
1431
|
-
|
|
1431
|
+
resolve6 = res;
|
|
1432
1432
|
reject = rej;
|
|
1433
1433
|
});
|
|
1434
1434
|
const queuePromise = currentQueue.catch(() => {
|
|
@@ -1445,7 +1445,7 @@ var InMemoryFileWriteLock = class {
|
|
|
1445
1445
|
})
|
|
1446
1446
|
]);
|
|
1447
1447
|
clearTimeout(timeoutId);
|
|
1448
|
-
|
|
1448
|
+
resolve6(result);
|
|
1449
1449
|
} catch (error) {
|
|
1450
1450
|
clearTimeout(timeoutId);
|
|
1451
1451
|
reject(error);
|
|
@@ -1491,10 +1491,10 @@ function createGlobMatcher(patterns, options) {
|
|
|
1491
1491
|
posix: true,
|
|
1492
1492
|
dot: options?.dot ?? false
|
|
1493
1493
|
});
|
|
1494
|
-
return (
|
|
1494
|
+
return (path9) => matcher(normalizeForMatch(path9));
|
|
1495
1495
|
}
|
|
1496
|
-
function matchGlob(
|
|
1497
|
-
return createGlobMatcher(pattern, options)(
|
|
1496
|
+
function matchGlob(path9, pattern, options) {
|
|
1497
|
+
return createGlobMatcher(pattern, options)(path9);
|
|
1498
1498
|
}
|
|
1499
1499
|
async function walkAll(readdir4, dir, depth, maxDepth) {
|
|
1500
1500
|
if (depth >= maxDepth) return [];
|
|
@@ -1584,7 +1584,7 @@ function isLSPAvailable() {
|
|
|
1584
1584
|
return jsonrpcModule !== null;
|
|
1585
1585
|
}
|
|
1586
1586
|
try {
|
|
1587
|
-
const req = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
1587
|
+
const req = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-AVRRH42W.cjs', document.baseURI).href)));
|
|
1588
1588
|
req.resolve("vscode-jsonrpc/node");
|
|
1589
1589
|
req.resolve("vscode-languageserver-protocol");
|
|
1590
1590
|
return true;
|
|
@@ -1598,7 +1598,7 @@ async function loadLSPDeps() {
|
|
|
1598
1598
|
return { ...jsonrpcModule, ...lspProtocolModule };
|
|
1599
1599
|
}
|
|
1600
1600
|
try {
|
|
1601
|
-
const req = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
1601
|
+
const req = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-AVRRH42W.cjs', document.baseURI).href)));
|
|
1602
1602
|
const jsonrpc = req("vscode-jsonrpc/node");
|
|
1603
1603
|
const protocol = req("vscode-languageserver-protocol");
|
|
1604
1604
|
jsonrpcModule = {
|
|
@@ -1806,7 +1806,7 @@ var LSPClient = class {
|
|
|
1806
1806
|
if (Date.now() - emptyReceivedAt >= settleMs) return currentDiagnostics;
|
|
1807
1807
|
}
|
|
1808
1808
|
}
|
|
1809
|
-
await new Promise((
|
|
1809
|
+
await new Promise((resolve6) => setTimeout(resolve6, 100));
|
|
1810
1810
|
}
|
|
1811
1811
|
return waitForChange ? initialDiagnostics || [] : this.diagnostics.get(uri) || [];
|
|
1812
1812
|
}
|
|
@@ -2140,8 +2140,8 @@ var LSPManager = class {
|
|
|
2140
2140
|
await this.fileLocks.get(filePath);
|
|
2141
2141
|
}
|
|
2142
2142
|
let release;
|
|
2143
|
-
const lockPromise = new Promise((
|
|
2144
|
-
release =
|
|
2143
|
+
const lockPromise = new Promise((resolve6) => {
|
|
2144
|
+
release = resolve6;
|
|
2145
2145
|
});
|
|
2146
2146
|
this.fileLocks.set(filePath, lockPromise);
|
|
2147
2147
|
return () => {
|
|
@@ -2641,7 +2641,7 @@ var LocalProcessHandle = class extends ProcessHandle {
|
|
|
2641
2641
|
timedOut = true;
|
|
2642
2642
|
void killProcessTree(this._numericPid, subprocess, "SIGTERM");
|
|
2643
2643
|
}, options.timeout) : void 0;
|
|
2644
|
-
this.waitPromise = new Promise((
|
|
2644
|
+
this.waitPromise = new Promise((resolve6) => {
|
|
2645
2645
|
subprocess.on("close", (code, signal) => {
|
|
2646
2646
|
if (timeoutId) clearTimeout(timeoutId);
|
|
2647
2647
|
if (timedOut) {
|
|
@@ -2652,7 +2652,7 @@ Process timed out after ${options.timeout}ms`;
|
|
|
2652
2652
|
} else {
|
|
2653
2653
|
this.exitCode = signal && code === null ? 128 : code ?? 0;
|
|
2654
2654
|
}
|
|
2655
|
-
|
|
2655
|
+
resolve6({
|
|
2656
2656
|
success: this.exitCode === 0,
|
|
2657
2657
|
exitCode: this.exitCode,
|
|
2658
2658
|
stdout: this.stdout,
|
|
@@ -2666,7 +2666,7 @@ Process timed out after ${options.timeout}ms`;
|
|
|
2666
2666
|
if (timeoutId) clearTimeout(timeoutId);
|
|
2667
2667
|
this.emitStderr(err.message);
|
|
2668
2668
|
this.exitCode = 1;
|
|
2669
|
-
|
|
2669
|
+
resolve6({
|
|
2670
2670
|
success: false,
|
|
2671
2671
|
exitCode: 1,
|
|
2672
2672
|
stdout: this.stdout,
|
|
@@ -2697,8 +2697,8 @@ Process timed out after ${options.timeout}ms`;
|
|
|
2697
2697
|
if (!this.subprocess.stdin) {
|
|
2698
2698
|
throw new Error(`Process ${this.pid} does not have stdin available`);
|
|
2699
2699
|
}
|
|
2700
|
-
return new Promise((
|
|
2701
|
-
this.subprocess.stdin.write(data, (err) => err ? reject(err) :
|
|
2700
|
+
return new Promise((resolve6, reject) => {
|
|
2701
|
+
this.subprocess.stdin.write(data, (err) => err ? reject(err) : resolve6());
|
|
2702
2702
|
});
|
|
2703
2703
|
}
|
|
2704
2704
|
};
|
|
@@ -2720,7 +2720,7 @@ async function killProcessTree(pid, subprocess, signal) {
|
|
|
2720
2720
|
}
|
|
2721
2721
|
var LocalProcessManager = class extends SandboxProcessManager {
|
|
2722
2722
|
async spawn(command, options = {}) {
|
|
2723
|
-
const cwd = options.cwd
|
|
2723
|
+
const cwd = options.cwd ? nodePath__namespace.resolve(this.sandbox.workingDirectory, options.cwd) : this.sandbox.workingDirectory;
|
|
2724
2724
|
const env = this.sandbox.buildEnv(options.env);
|
|
2725
2725
|
const wrapped = this.sandbox.wrapCommandForIsolation(command);
|
|
2726
2726
|
const baseOptions = {
|
|
@@ -2823,14 +2823,14 @@ var MountManager = class {
|
|
|
2823
2823
|
/**
|
|
2824
2824
|
* Get a mount entry by path.
|
|
2825
2825
|
*/
|
|
2826
|
-
get(
|
|
2827
|
-
return this._entries.get(
|
|
2826
|
+
get(path9) {
|
|
2827
|
+
return this._entries.get(path9);
|
|
2828
2828
|
}
|
|
2829
2829
|
/**
|
|
2830
2830
|
* Check if a mount exists at the given path.
|
|
2831
2831
|
*/
|
|
2832
|
-
has(
|
|
2833
|
-
return this._entries.has(
|
|
2832
|
+
has(path9) {
|
|
2833
|
+
return this._entries.has(path9);
|
|
2834
2834
|
}
|
|
2835
2835
|
// ---------------------------------------------------------------------------
|
|
2836
2836
|
// Entry Modification
|
|
@@ -2842,8 +2842,8 @@ var MountManager = class {
|
|
|
2842
2842
|
add(mounts) {
|
|
2843
2843
|
const paths = Object.keys(mounts);
|
|
2844
2844
|
this.logger.debug("Adding pending mounts", { count: paths.length, paths });
|
|
2845
|
-
for (const [
|
|
2846
|
-
this._entries.set(
|
|
2845
|
+
for (const [path9, filesystem] of Object.entries(mounts)) {
|
|
2846
|
+
this._entries.set(path9, {
|
|
2847
2847
|
filesystem,
|
|
2848
2848
|
state: "pending"
|
|
2849
2849
|
});
|
|
@@ -2853,8 +2853,8 @@ var MountManager = class {
|
|
|
2853
2853
|
* Update a mount entry's state.
|
|
2854
2854
|
* Creates the entry if it doesn't exist.
|
|
2855
2855
|
*/
|
|
2856
|
-
set(
|
|
2857
|
-
const existing = this._entries.get(
|
|
2856
|
+
set(path9, updates) {
|
|
2857
|
+
const existing = this._entries.get(path9);
|
|
2858
2858
|
if (existing) {
|
|
2859
2859
|
existing.state = updates.state;
|
|
2860
2860
|
if (updates.config) {
|
|
@@ -2865,7 +2865,7 @@ var MountManager = class {
|
|
|
2865
2865
|
existing.error = updates.error;
|
|
2866
2866
|
}
|
|
2867
2867
|
} else if (updates.filesystem) {
|
|
2868
|
-
this._entries.set(
|
|
2868
|
+
this._entries.set(path9, {
|
|
2869
2869
|
filesystem: updates.filesystem,
|
|
2870
2870
|
state: updates.state,
|
|
2871
2871
|
config: updates.config,
|
|
@@ -2873,14 +2873,14 @@ var MountManager = class {
|
|
|
2873
2873
|
error: updates.error
|
|
2874
2874
|
});
|
|
2875
2875
|
} else {
|
|
2876
|
-
this.logger.debug("set() called for unknown path without filesystem", { path:
|
|
2876
|
+
this.logger.debug("set() called for unknown path without filesystem", { path: path9 });
|
|
2877
2877
|
}
|
|
2878
2878
|
}
|
|
2879
2879
|
/**
|
|
2880
2880
|
* Delete a mount entry.
|
|
2881
2881
|
*/
|
|
2882
|
-
delete(
|
|
2883
|
-
return this._entries.delete(
|
|
2882
|
+
delete(path9) {
|
|
2883
|
+
return this._entries.delete(path9);
|
|
2884
2884
|
}
|
|
2885
2885
|
/**
|
|
2886
2886
|
* Clear all mount entries.
|
|
@@ -2901,7 +2901,7 @@ var MountManager = class {
|
|
|
2901
2901
|
return;
|
|
2902
2902
|
}
|
|
2903
2903
|
this.logger.debug("Processing pending mounts", { count: pendingCount });
|
|
2904
|
-
for (const [
|
|
2904
|
+
for (const [path9, entry] of this._entries) {
|
|
2905
2905
|
if (entry.state !== "pending") {
|
|
2906
2906
|
continue;
|
|
2907
2907
|
}
|
|
@@ -2911,7 +2911,7 @@ var MountManager = class {
|
|
|
2911
2911
|
try {
|
|
2912
2912
|
const hookResult = await this._onMount({
|
|
2913
2913
|
filesystem: entry.filesystem,
|
|
2914
|
-
mountPath:
|
|
2914
|
+
mountPath: path9,
|
|
2915
2915
|
config,
|
|
2916
2916
|
sandbox: this._sandbox,
|
|
2917
2917
|
workspace: this._workspace
|
|
@@ -2919,7 +2919,7 @@ var MountManager = class {
|
|
|
2919
2919
|
if (hookResult === false) {
|
|
2920
2920
|
entry.state = "unsupported";
|
|
2921
2921
|
entry.error = "Skipped by onMount hook";
|
|
2922
|
-
this.logger.debug("Mount skipped by onMount hook", { path:
|
|
2922
|
+
this.logger.debug("Mount skipped by onMount hook", { path: path9, provider: fsProvider });
|
|
2923
2923
|
continue;
|
|
2924
2924
|
}
|
|
2925
2925
|
if (hookResult && typeof hookResult === "object") {
|
|
@@ -2927,54 +2927,54 @@ var MountManager = class {
|
|
|
2927
2927
|
entry.state = "mounted";
|
|
2928
2928
|
entry.config = config;
|
|
2929
2929
|
entry.configHash = config ? this.hashConfig(config) : void 0;
|
|
2930
|
-
this.logger.info("Mount handled by onMount hook", { path:
|
|
2930
|
+
this.logger.info("Mount handled by onMount hook", { path: path9, provider: fsProvider });
|
|
2931
2931
|
} else {
|
|
2932
2932
|
entry.state = "error";
|
|
2933
2933
|
entry.error = hookResult.error ?? "Mount hook failed";
|
|
2934
|
-
this.logger.error("Mount hook failed", { path:
|
|
2934
|
+
this.logger.error("Mount hook failed", { path: path9, provider: fsProvider, error: entry.error });
|
|
2935
2935
|
}
|
|
2936
2936
|
continue;
|
|
2937
2937
|
}
|
|
2938
2938
|
} catch (err) {
|
|
2939
2939
|
entry.state = "error";
|
|
2940
2940
|
entry.error = `Mount hook error: ${String(err)}`;
|
|
2941
|
-
this.logger.error("Mount hook threw error", { path:
|
|
2941
|
+
this.logger.error("Mount hook threw error", { path: path9, provider: fsProvider, error: entry.error });
|
|
2942
2942
|
continue;
|
|
2943
2943
|
}
|
|
2944
2944
|
}
|
|
2945
2945
|
if (!config) {
|
|
2946
2946
|
entry.state = "unsupported";
|
|
2947
2947
|
entry.error = "Filesystem does not support mounting";
|
|
2948
|
-
this.logger.debug("Filesystem does not support mounting", { path:
|
|
2948
|
+
this.logger.debug("Filesystem does not support mounting", { path: path9, provider: fsProvider });
|
|
2949
2949
|
continue;
|
|
2950
2950
|
}
|
|
2951
2951
|
entry.config = config;
|
|
2952
2952
|
entry.configHash = this.hashConfig(config);
|
|
2953
2953
|
entry.state = "mounting";
|
|
2954
|
-
this.logger.debug("Mounting filesystem", { path:
|
|
2954
|
+
this.logger.debug("Mounting filesystem", { path: path9, provider: fsProvider, type: config.type });
|
|
2955
2955
|
try {
|
|
2956
|
-
const result = await this._mountFn(entry.filesystem,
|
|
2956
|
+
const result = await this._mountFn(entry.filesystem, path9);
|
|
2957
2957
|
if (result.success) {
|
|
2958
2958
|
entry.state = "mounted";
|
|
2959
|
-
this.logger.info("Mount successful", { path:
|
|
2959
|
+
this.logger.info("Mount successful", { path: path9, provider: fsProvider });
|
|
2960
2960
|
} else if (result.unavailable) {
|
|
2961
2961
|
entry.state = "unavailable";
|
|
2962
2962
|
entry.error = result.error ?? "FUSE tool not installed";
|
|
2963
|
-
this.logger.warn("FUSE mount unavailable", { path:
|
|
2963
|
+
this.logger.warn("FUSE mount unavailable", { path: path9, provider: fsProvider, error: entry.error });
|
|
2964
2964
|
} else {
|
|
2965
2965
|
entry.state = "error";
|
|
2966
2966
|
entry.error = result.error ?? "Mount failed";
|
|
2967
|
-
this.logger.error("Mount failed", { path:
|
|
2967
|
+
this.logger.error("Mount failed", { path: path9, provider: fsProvider, error: entry.error });
|
|
2968
2968
|
}
|
|
2969
2969
|
} catch (err) {
|
|
2970
2970
|
if (err instanceof MountToolNotFoundError) {
|
|
2971
2971
|
entry.state = "unavailable";
|
|
2972
2972
|
entry.error = String(err);
|
|
2973
|
-
this.logger.warn("FUSE mount unavailable", { path:
|
|
2973
|
+
this.logger.warn("FUSE mount unavailable", { path: path9, provider: fsProvider, error: entry.error });
|
|
2974
2974
|
} else {
|
|
2975
2975
|
entry.state = "error";
|
|
2976
2976
|
entry.error = String(err);
|
|
2977
|
-
this.logger.error("Mount threw error", { path:
|
|
2977
|
+
this.logger.error("Mount threw error", { path: path9, provider: fsProvider, error: entry.error });
|
|
2978
2978
|
}
|
|
2979
2979
|
}
|
|
2980
2980
|
}
|
|
@@ -3023,10 +3023,10 @@ var MountManager = class {
|
|
|
3023
3023
|
if (separatorIndex <= 0) {
|
|
3024
3024
|
return null;
|
|
3025
3025
|
}
|
|
3026
|
-
const
|
|
3026
|
+
const path9 = content.slice(0, separatorIndex);
|
|
3027
3027
|
const configHash = content.slice(separatorIndex + 1);
|
|
3028
|
-
if (!
|
|
3029
|
-
return { path:
|
|
3028
|
+
if (!path9 || !configHash) return null;
|
|
3029
|
+
return { path: path9, configHash };
|
|
3030
3030
|
}
|
|
3031
3031
|
/**
|
|
3032
3032
|
* Check if a config hash matches the expected hash for a mount path.
|
|
@@ -3516,11 +3516,11 @@ function buildBwrapCommand(command, workspacePath, config) {
|
|
|
3516
3516
|
}
|
|
3517
3517
|
bwrapArgs.push("--proc", "/proc");
|
|
3518
3518
|
bwrapArgs.push("--tmpfs", "/tmp");
|
|
3519
|
-
for (const
|
|
3520
|
-
bwrapArgs.push("--ro-bind-try",
|
|
3519
|
+
for (const path9 of DEFAULT_READONLY_BINDS) {
|
|
3520
|
+
bwrapArgs.push("--ro-bind-try", path9, path9);
|
|
3521
3521
|
}
|
|
3522
|
-
for (const
|
|
3523
|
-
bwrapArgs.push("--ro-bind",
|
|
3522
|
+
for (const path9 of config.readOnlyPaths ?? []) {
|
|
3523
|
+
bwrapArgs.push("--ro-bind", path9, path9);
|
|
3524
3524
|
}
|
|
3525
3525
|
if (config.allowSystemBinaries !== false) {
|
|
3526
3526
|
const nodePath4 = process.execPath;
|
|
@@ -3532,8 +3532,8 @@ function buildBwrapCommand(command, workspacePath, config) {
|
|
|
3532
3532
|
bwrapArgs.push("--ro-bind-try", "/snap", "/snap");
|
|
3533
3533
|
}
|
|
3534
3534
|
bwrapArgs.push("--bind", workspacePath, workspacePath);
|
|
3535
|
-
for (const
|
|
3536
|
-
bwrapArgs.push("--bind",
|
|
3535
|
+
for (const path9 of config.readWritePaths ?? []) {
|
|
3536
|
+
bwrapArgs.push("--bind", path9, path9);
|
|
3537
3537
|
}
|
|
3538
3538
|
bwrapArgs.push("--chdir", workspacePath);
|
|
3539
3539
|
bwrapArgs.push("--die-with-parent");
|
|
@@ -4943,18 +4943,18 @@ var VersionedSkillSource = class {
|
|
|
4943
4943
|
/**
|
|
4944
4944
|
* Normalize a path by stripping leading/trailing slashes and dots.
|
|
4945
4945
|
*/
|
|
4946
|
-
#normalizePath(
|
|
4947
|
-
let normalized =
|
|
4946
|
+
#normalizePath(path9) {
|
|
4947
|
+
let normalized = path9.replace(/^[./\\]+|[/\\]+$/g, "");
|
|
4948
4948
|
if (normalized === "") return "";
|
|
4949
4949
|
return normalized;
|
|
4950
4950
|
}
|
|
4951
|
-
async exists(
|
|
4952
|
-
const normalized = this.#normalizePath(
|
|
4951
|
+
async exists(path9) {
|
|
4952
|
+
const normalized = this.#normalizePath(path9);
|
|
4953
4953
|
if (this.#tree.entries[normalized]) return true;
|
|
4954
4954
|
return this.#directories.has(normalized);
|
|
4955
4955
|
}
|
|
4956
|
-
async stat(
|
|
4957
|
-
const normalized = this.#normalizePath(
|
|
4956
|
+
async stat(path9) {
|
|
4957
|
+
const normalized = this.#normalizePath(path9);
|
|
4958
4958
|
const name = normalized.split("/").pop() || normalized || ".";
|
|
4959
4959
|
const entry = this.#tree.entries[normalized];
|
|
4960
4960
|
if (entry) {
|
|
@@ -4976,27 +4976,27 @@ var VersionedSkillSource = class {
|
|
|
4976
4976
|
modifiedAt: this.#versionCreatedAt
|
|
4977
4977
|
};
|
|
4978
4978
|
}
|
|
4979
|
-
throw new Error(`Path not found in skill version tree: ${
|
|
4979
|
+
throw new Error(`Path not found in skill version tree: ${path9}`);
|
|
4980
4980
|
}
|
|
4981
|
-
async readFile(
|
|
4982
|
-
const normalized = this.#normalizePath(
|
|
4981
|
+
async readFile(path9) {
|
|
4982
|
+
const normalized = this.#normalizePath(path9);
|
|
4983
4983
|
const entry = this.#tree.entries[normalized];
|
|
4984
4984
|
if (!entry) {
|
|
4985
|
-
throw new Error(`File not found in skill version tree: ${
|
|
4985
|
+
throw new Error(`File not found in skill version tree: ${path9}`);
|
|
4986
4986
|
}
|
|
4987
4987
|
const blob = await this.#blobStore.get(entry.blobHash);
|
|
4988
4988
|
if (!blob) {
|
|
4989
|
-
throw new Error(`Blob not found for hash ${entry.blobHash} (file: ${
|
|
4989
|
+
throw new Error(`Blob not found for hash ${entry.blobHash} (file: ${path9})`);
|
|
4990
4990
|
}
|
|
4991
4991
|
if (entry.encoding === "base64") {
|
|
4992
4992
|
return Buffer.from(blob.content, "base64");
|
|
4993
4993
|
}
|
|
4994
4994
|
return blob.content;
|
|
4995
4995
|
}
|
|
4996
|
-
async readdir(
|
|
4997
|
-
const normalized = this.#normalizePath(
|
|
4996
|
+
async readdir(path9) {
|
|
4997
|
+
const normalized = this.#normalizePath(path9);
|
|
4998
4998
|
if (!this.#directories.has(normalized)) {
|
|
4999
|
-
throw new Error(`Directory not found in skill version tree: ${
|
|
4999
|
+
throw new Error(`Directory not found in skill version tree: ${path9}`);
|
|
5000
5000
|
}
|
|
5001
5001
|
const prefix = normalized === "" ? "" : normalized + "/";
|
|
5002
5002
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -5029,15 +5029,15 @@ var CompositeVersionedSkillSource = class {
|
|
|
5029
5029
|
this.#fallback = options?.fallback;
|
|
5030
5030
|
this.#fallbackSkills = new Set(options?.fallbackSkills ?? []);
|
|
5031
5031
|
}
|
|
5032
|
-
#normalizePath(
|
|
5033
|
-
return
|
|
5032
|
+
#normalizePath(path9) {
|
|
5033
|
+
return path9.replace(/^[./\\]+|[/\\]+$/g, "");
|
|
5034
5034
|
}
|
|
5035
5035
|
/**
|
|
5036
5036
|
* Route a path to the correct source.
|
|
5037
5037
|
* Returns the source and the remaining path within that source.
|
|
5038
5038
|
*/
|
|
5039
|
-
#routePath(
|
|
5040
|
-
const normalized = this.#normalizePath(
|
|
5039
|
+
#routePath(path9) {
|
|
5040
|
+
const normalized = this.#normalizePath(path9);
|
|
5041
5041
|
if (normalized === "") return null;
|
|
5042
5042
|
const segments = normalized.split("/");
|
|
5043
5043
|
const skillDir = segments[0];
|
|
@@ -5054,15 +5054,15 @@ var CompositeVersionedSkillSource = class {
|
|
|
5054
5054
|
}
|
|
5055
5055
|
return null;
|
|
5056
5056
|
}
|
|
5057
|
-
async exists(
|
|
5058
|
-
const normalized = this.#normalizePath(
|
|
5057
|
+
async exists(path9) {
|
|
5058
|
+
const normalized = this.#normalizePath(path9);
|
|
5059
5059
|
if (normalized === "") return true;
|
|
5060
|
-
const route = this.#routePath(
|
|
5060
|
+
const route = this.#routePath(path9);
|
|
5061
5061
|
if (!route) return false;
|
|
5062
5062
|
return route.source.exists(route.subPath);
|
|
5063
5063
|
}
|
|
5064
|
-
async stat(
|
|
5065
|
-
const normalized = this.#normalizePath(
|
|
5064
|
+
async stat(path9) {
|
|
5065
|
+
const normalized = this.#normalizePath(path9);
|
|
5066
5066
|
if (normalized === "") {
|
|
5067
5067
|
return {
|
|
5068
5068
|
name: ".",
|
|
@@ -5072,21 +5072,21 @@ var CompositeVersionedSkillSource = class {
|
|
|
5072
5072
|
modifiedAt: /* @__PURE__ */ new Date()
|
|
5073
5073
|
};
|
|
5074
5074
|
}
|
|
5075
|
-
const route = this.#routePath(
|
|
5075
|
+
const route = this.#routePath(path9);
|
|
5076
5076
|
if (!route) {
|
|
5077
|
-
throw new Error(`Path not found in composite skill source: ${
|
|
5077
|
+
throw new Error(`Path not found in composite skill source: ${path9}`);
|
|
5078
5078
|
}
|
|
5079
5079
|
return route.source.stat(route.subPath);
|
|
5080
5080
|
}
|
|
5081
|
-
async readFile(
|
|
5082
|
-
const route = this.#routePath(
|
|
5081
|
+
async readFile(path9) {
|
|
5082
|
+
const route = this.#routePath(path9);
|
|
5083
5083
|
if (!route) {
|
|
5084
|
-
throw new Error(`File not found in composite skill source: ${
|
|
5084
|
+
throw new Error(`File not found in composite skill source: ${path9}`);
|
|
5085
5085
|
}
|
|
5086
5086
|
return route.source.readFile(route.subPath);
|
|
5087
5087
|
}
|
|
5088
|
-
async readdir(
|
|
5089
|
-
const normalized = this.#normalizePath(
|
|
5088
|
+
async readdir(path9) {
|
|
5089
|
+
const normalized = this.#normalizePath(path9);
|
|
5090
5090
|
if (normalized === "") {
|
|
5091
5091
|
const entries = [];
|
|
5092
5092
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -5102,9 +5102,9 @@ var CompositeVersionedSkillSource = class {
|
|
|
5102
5102
|
}
|
|
5103
5103
|
return entries;
|
|
5104
5104
|
}
|
|
5105
|
-
const route = this.#routePath(
|
|
5105
|
+
const route = this.#routePath(path9);
|
|
5106
5106
|
if (!route) {
|
|
5107
|
-
throw new Error(`Directory not found in composite skill source: ${
|
|
5107
|
+
throw new Error(`Directory not found in composite skill source: ${path9}`);
|
|
5108
5108
|
}
|
|
5109
5109
|
return route.source.readdir(route.subPath);
|
|
5110
5110
|
}
|
|
@@ -5304,7 +5304,7 @@ var WorkspaceSkillsImpl = class _WorkspaceSkillsImpl {
|
|
|
5304
5304
|
if (a.length !== b.length) return false;
|
|
5305
5305
|
const sortedA = [...a].sort();
|
|
5306
5306
|
const sortedB = [...b].sort();
|
|
5307
|
-
return sortedA.every((
|
|
5307
|
+
return sortedA.every((path9, i) => path9 === sortedB[i]);
|
|
5308
5308
|
}
|
|
5309
5309
|
// ===========================================================================
|
|
5310
5310
|
// Search
|
|
@@ -5910,9 +5910,9 @@ ${validation.errors.join("\n")}`);
|
|
|
5910
5910
|
/**
|
|
5911
5911
|
* Get parent path
|
|
5912
5912
|
*/
|
|
5913
|
-
#getParentPath(
|
|
5914
|
-
const lastSlash =
|
|
5915
|
-
return lastSlash > 0 ?
|
|
5913
|
+
#getParentPath(path9) {
|
|
5914
|
+
const lastSlash = path9.lastIndexOf("/");
|
|
5915
|
+
return lastSlash > 0 ? path9.substring(0, lastSlash) : "/";
|
|
5916
5916
|
}
|
|
5917
5917
|
};
|
|
5918
5918
|
function hashContent(content) {
|
|
@@ -6143,14 +6143,14 @@ function createSkillReadTool(skills) {
|
|
|
6143
6143
|
startLine: v4.z.number().optional().describe("Starting line number (1-indexed). If omitted, starts from the beginning."),
|
|
6144
6144
|
endLine: v4.z.number().optional().describe("Ending line number (1-indexed, inclusive). If omitted, reads to the end.")
|
|
6145
6145
|
}),
|
|
6146
|
-
execute: async ({ skillName, path:
|
|
6146
|
+
execute: async ({ skillName, path: path9, startLine, endLine }) => {
|
|
6147
6147
|
const resolved = await resolveSkill(skills, skillName);
|
|
6148
6148
|
if ("notFound" in resolved) return resolved.notFound;
|
|
6149
6149
|
const resolvedPath = resolved.skill.path;
|
|
6150
6150
|
let content = null;
|
|
6151
|
-
content = await skills.getReference(resolvedPath,
|
|
6152
|
-
if (content === null) content = await skills.getScript(resolvedPath,
|
|
6153
|
-
if (content === null) content = await skills.getAsset(resolvedPath,
|
|
6151
|
+
content = await skills.getReference(resolvedPath, path9);
|
|
6152
|
+
if (content === null) content = await skills.getScript(resolvedPath, path9);
|
|
6153
|
+
if (content === null) content = await skills.getAsset(resolvedPath, path9);
|
|
6154
6154
|
if (content === null) {
|
|
6155
6155
|
const refs = (await skills.listReferences(resolvedPath)).map((f) => `references/${f}`);
|
|
6156
6156
|
const scriptsList = (await skills.listScripts(resolvedPath)).map((f) => `scripts/${f}`);
|
|
@@ -6158,11 +6158,11 @@ function createSkillReadTool(skills) {
|
|
|
6158
6158
|
const allFiles = [...refs, ...scriptsList, ...assets];
|
|
6159
6159
|
const fileList = allFiles.length > 0 ? `
|
|
6160
6160
|
Available files: ${allFiles.join(", ")}` : "";
|
|
6161
|
-
return `File "${
|
|
6161
|
+
return `File "${path9}" not found in skill "${skillName}".${fileList}`;
|
|
6162
6162
|
}
|
|
6163
6163
|
const textContent = typeof content === "string" ? content : content.toString("utf-8");
|
|
6164
6164
|
if (textContent.slice(0, 1e3).includes("\0")) {
|
|
6165
|
-
const fullPath = `${resolved.skill.path}/${
|
|
6165
|
+
const fullPath = `${resolved.skill.path}/${path9}`;
|
|
6166
6166
|
const size = typeof content === "string" ? Buffer.byteLength(content) : content.length;
|
|
6167
6167
|
return `Binary file: ${fullPath} (${size} bytes)`;
|
|
6168
6168
|
}
|
|
@@ -6396,13 +6396,13 @@ var Workspace = class {
|
|
|
6396
6396
|
* @param options - Index options (metadata, type hints)
|
|
6397
6397
|
* @throws {SearchNotAvailableError} if search is not configured
|
|
6398
6398
|
*/
|
|
6399
|
-
async index(
|
|
6399
|
+
async index(path9, content, options) {
|
|
6400
6400
|
if (!this._searchEngine) {
|
|
6401
6401
|
throw new SearchNotAvailableError();
|
|
6402
6402
|
}
|
|
6403
6403
|
this.lastAccessedAt = /* @__PURE__ */ new Date();
|
|
6404
6404
|
const doc = {
|
|
6405
|
-
id:
|
|
6405
|
+
id: path9,
|
|
6406
6406
|
content,
|
|
6407
6407
|
metadata: {
|
|
6408
6408
|
type: options?.type,
|
|
@@ -6839,7 +6839,7 @@ function isAstGrepAvailable() {
|
|
|
6839
6839
|
return astGrepModule !== null;
|
|
6840
6840
|
}
|
|
6841
6841
|
try {
|
|
6842
|
-
const req = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
6842
|
+
const req = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-AVRRH42W.cjs', document.baseURI).href)));
|
|
6843
6843
|
req.resolve("@ast-grep/napi");
|
|
6844
6844
|
return true;
|
|
6845
6845
|
} catch {
|
|
@@ -7040,7 +7040,7 @@ Pattern replace (for everything else):
|
|
|
7040
7040
|
isDefault: v4.z.boolean().optional().describe("Whether the first name is a default import")
|
|
7041
7041
|
}).optional().describe("Required for add-import transform. Specifies the module and names to import.")
|
|
7042
7042
|
}),
|
|
7043
|
-
execute: async ({ path:
|
|
7043
|
+
execute: async ({ path: path9, pattern, replacement, transform, targetName, newName, importSpec }, context) => {
|
|
7044
7044
|
const { workspace, filesystem } = requireFilesystem(context);
|
|
7045
7045
|
await emitWorkspaceMetadata(context, WORKSPACE_TOOLS.FILESYSTEM.AST_EDIT);
|
|
7046
7046
|
if (filesystem.readOnly) {
|
|
@@ -7053,19 +7053,19 @@ Pattern replace (for everything else):
|
|
|
7053
7053
|
const { parse: parse2, Lang } = astGrep;
|
|
7054
7054
|
let content;
|
|
7055
7055
|
try {
|
|
7056
|
-
content = await filesystem.readFile(
|
|
7056
|
+
content = await filesystem.readFile(path9, { encoding: "utf-8" });
|
|
7057
7057
|
} catch (error) {
|
|
7058
7058
|
if (error instanceof FileNotFoundError) {
|
|
7059
|
-
return `File not found: ${
|
|
7059
|
+
return `File not found: ${path9}. Use the write file tool to create it first.`;
|
|
7060
7060
|
}
|
|
7061
7061
|
throw error;
|
|
7062
7062
|
}
|
|
7063
7063
|
if (typeof content !== "string") {
|
|
7064
7064
|
return `Cannot perform AST edits on binary files. Use the write file tool instead.`;
|
|
7065
7065
|
}
|
|
7066
|
-
const lang = getLanguageFromPath(
|
|
7066
|
+
const lang = getLanguageFromPath(path9, Lang);
|
|
7067
7067
|
if (!lang) {
|
|
7068
|
-
return `Unsupported file type for AST editing: ${
|
|
7068
|
+
return `Unsupported file type for AST editing: ${path9}`;
|
|
7069
7069
|
}
|
|
7070
7070
|
const ast = parse2(lang, content);
|
|
7071
7071
|
const root = ast.root();
|
|
@@ -7115,16 +7115,16 @@ Pattern replace (for everything else):
|
|
|
7115
7115
|
}
|
|
7116
7116
|
const wasModified = modifiedContent !== content;
|
|
7117
7117
|
if (wasModified) {
|
|
7118
|
-
await filesystem.writeFile(
|
|
7118
|
+
await filesystem.writeFile(path9, modifiedContent, {
|
|
7119
7119
|
overwrite: true,
|
|
7120
7120
|
expectedMtime: context?.__expectedMtime
|
|
7121
7121
|
});
|
|
7122
7122
|
}
|
|
7123
7123
|
if (!wasModified) {
|
|
7124
|
-
return `No changes made to ${
|
|
7124
|
+
return `No changes made to ${path9} (${changes.join("; ")})`;
|
|
7125
7125
|
}
|
|
7126
|
-
let output = `${
|
|
7127
|
-
output += await getEditDiagnosticsText(workspace,
|
|
7126
|
+
let output = `${path9}: ${changes.join("; ")}`;
|
|
7127
|
+
output += await getEditDiagnosticsText(workspace, path9, modifiedContent);
|
|
7128
7128
|
return output;
|
|
7129
7129
|
}
|
|
7130
7130
|
});
|
|
@@ -7135,19 +7135,19 @@ var deleteFileTool = chunkLDLHW3QN_cjs.createTool({
|
|
|
7135
7135
|
path: v4.z.string().describe("The path to the file or directory to delete"),
|
|
7136
7136
|
recursive: v4.z.boolean().optional().default(false).describe("If true, delete directories and their contents recursively. Required for non-empty directories.")
|
|
7137
7137
|
}),
|
|
7138
|
-
execute: async ({ path:
|
|
7138
|
+
execute: async ({ path: path9, recursive }, context) => {
|
|
7139
7139
|
const { filesystem } = requireFilesystem(context);
|
|
7140
7140
|
await emitWorkspaceMetadata(context, WORKSPACE_TOOLS.FILESYSTEM.DELETE);
|
|
7141
7141
|
if (filesystem.readOnly) {
|
|
7142
7142
|
throw new WorkspaceReadOnlyError("delete");
|
|
7143
7143
|
}
|
|
7144
|
-
const stat3 = await filesystem.stat(
|
|
7144
|
+
const stat3 = await filesystem.stat(path9);
|
|
7145
7145
|
if (stat3.type === "directory") {
|
|
7146
|
-
await filesystem.rmdir(
|
|
7146
|
+
await filesystem.rmdir(path9, { recursive, force: recursive });
|
|
7147
7147
|
} else {
|
|
7148
|
-
await filesystem.deleteFile(
|
|
7148
|
+
await filesystem.deleteFile(path9);
|
|
7149
7149
|
}
|
|
7150
|
-
return `Deleted ${
|
|
7150
|
+
return `Deleted ${path9}`;
|
|
7151
7151
|
}
|
|
7152
7152
|
});
|
|
7153
7153
|
var editFileTool = chunkLDLHW3QN_cjs.createTool({
|
|
@@ -7165,24 +7165,24 @@ Usage:
|
|
|
7165
7165
|
new_string: v4.z.string().describe("The text to replace old_string with"),
|
|
7166
7166
|
replace_all: v4.z.boolean().optional().default(false).describe("If true, replace all occurrences. If false (default), old_string must be unique.")
|
|
7167
7167
|
}),
|
|
7168
|
-
execute: async ({ path:
|
|
7168
|
+
execute: async ({ path: path9, old_string, new_string, replace_all }, context) => {
|
|
7169
7169
|
const { workspace, filesystem } = requireFilesystem(context);
|
|
7170
7170
|
await emitWorkspaceMetadata(context, WORKSPACE_TOOLS.FILESYSTEM.EDIT_FILE);
|
|
7171
7171
|
if (filesystem.readOnly) {
|
|
7172
7172
|
throw new WorkspaceReadOnlyError("edit_file");
|
|
7173
7173
|
}
|
|
7174
7174
|
try {
|
|
7175
|
-
const content = await filesystem.readFile(
|
|
7175
|
+
const content = await filesystem.readFile(path9, { encoding: "utf-8" });
|
|
7176
7176
|
if (typeof content !== "string") {
|
|
7177
7177
|
return `Cannot edit binary files. Use the write file tool instead.`;
|
|
7178
7178
|
}
|
|
7179
7179
|
const result = replaceString(content, old_string, new_string, replace_all);
|
|
7180
|
-
await filesystem.writeFile(
|
|
7180
|
+
await filesystem.writeFile(path9, result.content, {
|
|
7181
7181
|
overwrite: true,
|
|
7182
7182
|
expectedMtime: context?.__expectedMtime
|
|
7183
7183
|
});
|
|
7184
|
-
let output = `Replaced ${result.replacements} occurrence${result.replacements !== 1 ? "s" : ""} in ${
|
|
7185
|
-
output += await getEditDiagnosticsText(workspace,
|
|
7184
|
+
let output = `Replaced ${result.replacements} occurrence${result.replacements !== 1 ? "s" : ""} in ${path9}`;
|
|
7185
|
+
output += await getEditDiagnosticsText(workspace, path9, result.content);
|
|
7186
7186
|
return output;
|
|
7187
7187
|
} catch (error) {
|
|
7188
7188
|
if (error instanceof StringNotFoundError) {
|
|
@@ -7434,19 +7434,19 @@ var fileStatTool = chunkLDLHW3QN_cjs.createTool({
|
|
|
7434
7434
|
inputSchema: v4.z.object({
|
|
7435
7435
|
path: v4.z.string().describe("The path to check")
|
|
7436
7436
|
}),
|
|
7437
|
-
execute: async ({ path:
|
|
7437
|
+
execute: async ({ path: path9 }, context) => {
|
|
7438
7438
|
const { filesystem } = requireFilesystem(context);
|
|
7439
7439
|
await emitWorkspaceMetadata(context, WORKSPACE_TOOLS.FILESYSTEM.FILE_STAT);
|
|
7440
7440
|
try {
|
|
7441
|
-
const stat3 = await filesystem.stat(
|
|
7441
|
+
const stat3 = await filesystem.stat(path9);
|
|
7442
7442
|
const modifiedAt = stat3.modifiedAt.toISOString();
|
|
7443
|
-
const parts = [`${
|
|
7443
|
+
const parts = [`${path9}`, `Type: ${stat3.type}`];
|
|
7444
7444
|
if (stat3.size !== void 0) parts.push(`Size: ${stat3.size} bytes`);
|
|
7445
7445
|
parts.push(`Modified: ${modifiedAt}`);
|
|
7446
7446
|
return parts.join(" ");
|
|
7447
7447
|
} catch (error) {
|
|
7448
7448
|
if (error instanceof FileNotFoundError) {
|
|
7449
|
-
return `${
|
|
7449
|
+
return `${path9}: not found`;
|
|
7450
7450
|
}
|
|
7451
7451
|
throw error;
|
|
7452
7452
|
}
|
|
@@ -7712,11 +7712,11 @@ var indexContentTool = chunkLDLHW3QN_cjs.createTool({
|
|
|
7712
7712
|
content: v4.z.string().describe("The text content to index"),
|
|
7713
7713
|
metadata: v4.z.record(v4.z.string(), v4.z.unknown()).optional().describe("Optional metadata to store with the document")
|
|
7714
7714
|
}),
|
|
7715
|
-
execute: async ({ path:
|
|
7715
|
+
execute: async ({ path: path9, content, metadata }, context) => {
|
|
7716
7716
|
const workspace = requireWorkspace(context);
|
|
7717
7717
|
await emitWorkspaceMetadata(context, WORKSPACE_TOOLS.SEARCH.INDEX);
|
|
7718
|
-
await workspace.index(
|
|
7719
|
-
return `Indexed ${
|
|
7718
|
+
await workspace.index(path9, content, { metadata });
|
|
7719
|
+
return `Indexed ${path9}`;
|
|
7720
7720
|
}
|
|
7721
7721
|
});
|
|
7722
7722
|
var KILL_TAIL_LINES = 50;
|
|
@@ -7772,7 +7772,7 @@ Use this to stop a long-running background process that was started with execute
|
|
|
7772
7772
|
});
|
|
7773
7773
|
|
|
7774
7774
|
// src/workspace/tools/tree-formatter.ts
|
|
7775
|
-
async function formatAsTree(fs6,
|
|
7775
|
+
async function formatAsTree(fs6, path9, options) {
|
|
7776
7776
|
const maxDepth = options?.maxDepth ?? Infinity;
|
|
7777
7777
|
const showHidden = options?.showHidden ?? false;
|
|
7778
7778
|
const dirsOnly = options?.dirsOnly ?? false;
|
|
@@ -7784,7 +7784,7 @@ async function formatAsTree(fs6, path8, options) {
|
|
|
7784
7784
|
if (!ignoreFilter && respectGitignore) {
|
|
7785
7785
|
const rawFilter = await loadGitignore(fs6);
|
|
7786
7786
|
if (rawFilter) {
|
|
7787
|
-
const normalizedPath =
|
|
7787
|
+
const normalizedPath = path9.replace(/^\.\//, "").replace(/^\//, "").replace(/\/$/, "");
|
|
7788
7788
|
const targetIsIgnored = normalizedPath && rawFilter(normalizedPath + "/");
|
|
7789
7789
|
ignoreFilter = targetIsIgnored ? void 0 : rawFilter;
|
|
7790
7790
|
}
|
|
@@ -7846,7 +7846,7 @@ async function formatAsTree(fs6, path8, options) {
|
|
|
7846
7846
|
if (globMatcher && !dirsOnly) {
|
|
7847
7847
|
filtered = filtered.filter((e) => {
|
|
7848
7848
|
if (e.type === "directory") return true;
|
|
7849
|
-
const relativePath = getRelativePath(
|
|
7849
|
+
const relativePath = getRelativePath(path9, currentPath, e.name);
|
|
7850
7850
|
return globMatcher(relativePath);
|
|
7851
7851
|
});
|
|
7852
7852
|
}
|
|
@@ -7860,7 +7860,7 @@ async function formatAsTree(fs6, path8, options) {
|
|
|
7860
7860
|
const entry = filtered[i];
|
|
7861
7861
|
const displayName = entry.isSymlink && entry.symlinkTarget ? `${entry.name} -> ${entry.symlinkTarget}` : entry.name;
|
|
7862
7862
|
lines.push(`${indent}${displayName}`);
|
|
7863
|
-
paths.push(getRelativePath(
|
|
7863
|
+
paths.push(getRelativePath(path9, currentPath, entry.name));
|
|
7864
7864
|
if (entry.type === "directory") {
|
|
7865
7865
|
dirCount++;
|
|
7866
7866
|
if (!entry.isSymlink) {
|
|
@@ -7872,7 +7872,7 @@ async function formatAsTree(fs6, path8, options) {
|
|
|
7872
7872
|
}
|
|
7873
7873
|
}
|
|
7874
7874
|
}
|
|
7875
|
-
await buildTree(
|
|
7875
|
+
await buildTree(path9, 0);
|
|
7876
7876
|
const dirPart = dirCount === 1 ? "1 directory" : `${dirCount} directories`;
|
|
7877
7877
|
const filePart = fileCount === 1 ? "1 file" : `${fileCount} files`;
|
|
7878
7878
|
let summary = `${dirPart}, ${filePart}`;
|
|
@@ -7937,10 +7937,10 @@ To list ALL files, omit the pattern parameter \u2014 do NOT pass pattern: "*".`,
|
|
|
7937
7937
|
),
|
|
7938
7938
|
respectGitignore: v4.z.boolean().optional().default(true).describe("Respect .gitignore in the listed directory (default: true).")
|
|
7939
7939
|
}),
|
|
7940
|
-
execute: async ({ path:
|
|
7940
|
+
execute: async ({ path: path9 = ".", maxDepth = 2, showHidden, dirsOnly, exclude, extension, pattern, respectGitignore }, context) => {
|
|
7941
7941
|
const { workspace, filesystem } = requireFilesystem(context);
|
|
7942
7942
|
await emitWorkspaceMetadata(context, WORKSPACE_TOOLS.FILESYSTEM.LIST_FILES);
|
|
7943
|
-
const result = await formatAsTree(filesystem,
|
|
7943
|
+
const result = await formatAsTree(filesystem, path9, {
|
|
7944
7944
|
maxDepth,
|
|
7945
7945
|
showHidden,
|
|
7946
7946
|
dirsOnly,
|
|
@@ -8153,14 +8153,14 @@ var mkdirTool = chunkLDLHW3QN_cjs.createTool({
|
|
|
8153
8153
|
path: v4.z.string().describe("The path of the directory to create"),
|
|
8154
8154
|
recursive: v4.z.boolean().optional().default(true).describe("Whether to create parent directories if they do not exist")
|
|
8155
8155
|
}),
|
|
8156
|
-
execute: async ({ path:
|
|
8156
|
+
execute: async ({ path: path9, recursive }, context) => {
|
|
8157
8157
|
const { filesystem } = requireFilesystem(context);
|
|
8158
8158
|
await emitWorkspaceMetadata(context, WORKSPACE_TOOLS.FILESYSTEM.MKDIR);
|
|
8159
8159
|
if (filesystem.readOnly) {
|
|
8160
8160
|
throw new WorkspaceReadOnlyError("mkdir");
|
|
8161
8161
|
}
|
|
8162
|
-
await filesystem.mkdir(
|
|
8163
|
-
return `Created directory ${
|
|
8162
|
+
await filesystem.mkdir(path9, { recursive });
|
|
8163
|
+
return `Created directory ${path9}`;
|
|
8164
8164
|
}
|
|
8165
8165
|
});
|
|
8166
8166
|
var readFileTool = chunkLDLHW3QN_cjs.createTool({
|
|
@@ -8173,12 +8173,12 @@ var readFileTool = chunkLDLHW3QN_cjs.createTool({
|
|
|
8173
8173
|
limit: v4.z.number().optional().describe("Maximum number of lines to read. If omitted, reads to the end of the file."),
|
|
8174
8174
|
showLineNumbers: v4.z.boolean().optional().default(true).describe("Whether to prefix each line with its line number (default: true)")
|
|
8175
8175
|
}),
|
|
8176
|
-
execute: async ({ path:
|
|
8176
|
+
execute: async ({ path: path9, encoding, offset, limit, showLineNumbers }, context) => {
|
|
8177
8177
|
const { workspace, filesystem } = requireFilesystem(context);
|
|
8178
8178
|
await emitWorkspaceMetadata(context, WORKSPACE_TOOLS.FILESYSTEM.READ_FILE);
|
|
8179
8179
|
const effectiveEncoding = encoding ?? "utf-8";
|
|
8180
|
-
const fullContent = await filesystem.readFile(
|
|
8181
|
-
const stat3 = await filesystem.stat(
|
|
8180
|
+
const fullContent = await filesystem.readFile(path9, { encoding: effectiveEncoding });
|
|
8181
|
+
const stat3 = await filesystem.stat(path9);
|
|
8182
8182
|
const isTextEncoding = !encoding || encoding === "utf-8" || encoding === "utf8";
|
|
8183
8183
|
const tokenLimit = workspace.getToolsConfig()?.[WORKSPACE_TOOLS.FILESYSTEM.READ_FILE]?.maxOutputTokens;
|
|
8184
8184
|
if (!isTextEncoding) {
|
|
@@ -8246,19 +8246,19 @@ var writeFileTool = chunkLDLHW3QN_cjs.createTool({
|
|
|
8246
8246
|
content: v4.z.string().describe("The content to write to the file"),
|
|
8247
8247
|
overwrite: v4.z.boolean().optional().default(true).describe("Whether to overwrite the file if it already exists")
|
|
8248
8248
|
}),
|
|
8249
|
-
execute: async ({ path:
|
|
8249
|
+
execute: async ({ path: path9, content, overwrite }, context) => {
|
|
8250
8250
|
const { workspace, filesystem } = requireFilesystem(context);
|
|
8251
8251
|
await emitWorkspaceMetadata(context, WORKSPACE_TOOLS.FILESYSTEM.WRITE_FILE);
|
|
8252
8252
|
if (filesystem.readOnly) {
|
|
8253
8253
|
throw new WorkspaceReadOnlyError("write_file");
|
|
8254
8254
|
}
|
|
8255
|
-
await filesystem.writeFile(
|
|
8255
|
+
await filesystem.writeFile(path9, content, {
|
|
8256
8256
|
overwrite,
|
|
8257
8257
|
expectedMtime: context?.__expectedMtime
|
|
8258
8258
|
});
|
|
8259
8259
|
const size = Buffer.byteLength(content, "utf-8");
|
|
8260
|
-
let output = `Wrote ${size} bytes to ${
|
|
8261
|
-
output += await getEditDiagnosticsText(workspace,
|
|
8260
|
+
let output = `Wrote ${size} bytes to ${path9}`;
|
|
8261
|
+
output += await getEditDiagnosticsText(workspace, path9, content);
|
|
8262
8262
|
return output;
|
|
8263
8263
|
}
|
|
8264
8264
|
});
|
|
@@ -8486,5 +8486,5 @@ exports.requireWorkspace = requireWorkspace;
|
|
|
8486
8486
|
exports.resolveToolConfig = resolveToolConfig;
|
|
8487
8487
|
exports.searchTool = searchTool;
|
|
8488
8488
|
exports.writeFileTool = writeFileTool;
|
|
8489
|
-
//# sourceMappingURL=chunk-
|
|
8490
|
-
//# sourceMappingURL=chunk-
|
|
8489
|
+
//# sourceMappingURL=chunk-AVRRH42W.cjs.map
|
|
8490
|
+
//# sourceMappingURL=chunk-AVRRH42W.cjs.map
|