@codeworksh/plugin 0.1.0-canary.19.1.gbef2d437 → 0.1.0-canary.21.1.gd0108197
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/{event-mKxToqmh.d.mts → event-6sTQ_4bq.d.mts} +33 -33
- package/event.d.mts +1 -1
- package/filesystem-BFCKzgND.mjs +347 -0
- package/filesystem-BFCKzgND.mjs.map +1 -0
- package/{filesystem-Cv2gjOJa.d.mts → filesystem-BYaEdL14.d.mts} +111 -3
- package/index.d.mts +1 -1
- package/{io-DhT4Y0Lw.d.mts → io-CXi2Sjg9.d.mts} +13 -4
- package/{io-5PrgzDTe.mjs → io-RvZvG-4N.mjs} +12 -6
- package/io-RvZvG-4N.mjs.map +1 -0
- package/package.json +2 -2
- package/{plugin-C8EauawX.d.mts → plugin-Bb1gRtNX.d.mts} +3 -3
- package/plugin.d.mts +1 -1
- package/sandbox/driver.d.mts +1 -1
- package/sandbox/driver.mjs +6 -2
- package/sandbox/driver.mjs.map +1 -1
- package/sandbox/errors.d.mts +1 -1
- package/sandbox/filesystem.d.mts +2 -2
- package/sandbox/filesystem.mjs +2 -148
- package/sandbox/instance.d.mts +1 -1
- package/sandbox/io.d.mts +2 -2
- package/sandbox/io.mjs +2 -2
- package/sandbox.d.mts +3 -3
- package/sandbox.mjs +3 -2
- package/sandbox.mjs.map +1 -1
- package/io-5PrgzDTe.mjs.map +0 -1
- package/sandbox/filesystem.mjs.map +0 -1
|
@@ -156,14 +156,19 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
156
156
|
type: "image";
|
|
157
157
|
data: string;
|
|
158
158
|
mimeType: string;
|
|
159
|
+
} | {
|
|
160
|
+
type: "thinking";
|
|
161
|
+
thinking: string;
|
|
162
|
+
thinkingSignature?: string;
|
|
163
|
+
redacted?: boolean;
|
|
159
164
|
} | {
|
|
160
165
|
addedToolNames?: string[];
|
|
161
166
|
arguments: Record<string, any>;
|
|
162
167
|
callID: string;
|
|
163
168
|
name: string;
|
|
164
169
|
namespace?: string;
|
|
165
|
-
|
|
166
|
-
content
|
|
170
|
+
partial?: {
|
|
171
|
+
content?: ({
|
|
167
172
|
type: "text";
|
|
168
173
|
text: string;
|
|
169
174
|
textSignature?: string;
|
|
@@ -173,9 +178,8 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
173
178
|
mimeType: string;
|
|
174
179
|
})[];
|
|
175
180
|
details?: any;
|
|
176
|
-
isError: false;
|
|
177
181
|
};
|
|
178
|
-
status: "
|
|
182
|
+
status: "running";
|
|
179
183
|
thoughtSignature?: string;
|
|
180
184
|
time: {
|
|
181
185
|
start: number;
|
|
@@ -199,9 +203,9 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
199
203
|
mimeType: string;
|
|
200
204
|
})[];
|
|
201
205
|
details?: any;
|
|
202
|
-
isError:
|
|
206
|
+
isError: false;
|
|
203
207
|
};
|
|
204
|
-
status: "
|
|
208
|
+
status: "completed";
|
|
205
209
|
thoughtSignature?: string;
|
|
206
210
|
time: {
|
|
207
211
|
start: number;
|
|
@@ -227,7 +231,7 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
227
231
|
details?: any;
|
|
228
232
|
isError: true;
|
|
229
233
|
};
|
|
230
|
-
status: "
|
|
234
|
+
status: "error";
|
|
231
235
|
thoughtSignature?: string;
|
|
232
236
|
time: {
|
|
233
237
|
start: number;
|
|
@@ -253,26 +257,21 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
253
257
|
details?: any;
|
|
254
258
|
isError: true;
|
|
255
259
|
};
|
|
256
|
-
status: "
|
|
260
|
+
status: "skipped";
|
|
257
261
|
thoughtSignature?: string;
|
|
258
262
|
time: {
|
|
259
263
|
start: number;
|
|
260
264
|
end: number;
|
|
261
265
|
};
|
|
262
266
|
type: "toolCall";
|
|
263
|
-
} | {
|
|
264
|
-
type: "thinking";
|
|
265
|
-
thinking: string;
|
|
266
|
-
thinkingSignature?: string;
|
|
267
|
-
redacted?: boolean;
|
|
268
267
|
} | {
|
|
269
268
|
addedToolNames?: string[];
|
|
270
269
|
arguments: Record<string, any>;
|
|
271
270
|
callID: string;
|
|
272
271
|
name: string;
|
|
273
272
|
namespace?: string;
|
|
274
|
-
|
|
275
|
-
content
|
|
273
|
+
result: {
|
|
274
|
+
content: ({
|
|
276
275
|
type: "text";
|
|
277
276
|
text: string;
|
|
278
277
|
textSignature?: string;
|
|
@@ -282,8 +281,9 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
282
281
|
mimeType: string;
|
|
283
282
|
})[];
|
|
284
283
|
details?: any;
|
|
284
|
+
isError: true;
|
|
285
285
|
};
|
|
286
|
-
status: "
|
|
286
|
+
status: "aborted";
|
|
287
287
|
thoughtSignature?: string;
|
|
288
288
|
time: {
|
|
289
289
|
start: number;
|
|
@@ -458,14 +458,19 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
458
458
|
type: "image";
|
|
459
459
|
data: string;
|
|
460
460
|
mimeType: string;
|
|
461
|
+
} | {
|
|
462
|
+
type: "thinking";
|
|
463
|
+
thinking: string;
|
|
464
|
+
thinkingSignature?: string;
|
|
465
|
+
redacted?: boolean;
|
|
461
466
|
} | {
|
|
462
467
|
addedToolNames?: string[];
|
|
463
468
|
arguments: Record<string, any>;
|
|
464
469
|
callID: string;
|
|
465
470
|
name: string;
|
|
466
471
|
namespace?: string;
|
|
467
|
-
|
|
468
|
-
content
|
|
472
|
+
partial?: {
|
|
473
|
+
content?: ({
|
|
469
474
|
type: "text";
|
|
470
475
|
text: string;
|
|
471
476
|
textSignature?: string;
|
|
@@ -475,9 +480,8 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
475
480
|
mimeType: string;
|
|
476
481
|
})[];
|
|
477
482
|
details?: any;
|
|
478
|
-
isError: false;
|
|
479
483
|
};
|
|
480
|
-
status: "
|
|
484
|
+
status: "running";
|
|
481
485
|
thoughtSignature?: string;
|
|
482
486
|
time: {
|
|
483
487
|
start: number;
|
|
@@ -501,9 +505,9 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
501
505
|
mimeType: string;
|
|
502
506
|
})[];
|
|
503
507
|
details?: any;
|
|
504
|
-
isError:
|
|
508
|
+
isError: false;
|
|
505
509
|
};
|
|
506
|
-
status: "
|
|
510
|
+
status: "completed";
|
|
507
511
|
thoughtSignature?: string;
|
|
508
512
|
time: {
|
|
509
513
|
start: number;
|
|
@@ -529,7 +533,7 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
529
533
|
details?: any;
|
|
530
534
|
isError: true;
|
|
531
535
|
};
|
|
532
|
-
status: "
|
|
536
|
+
status: "error";
|
|
533
537
|
thoughtSignature?: string;
|
|
534
538
|
time: {
|
|
535
539
|
start: number;
|
|
@@ -555,26 +559,21 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
555
559
|
details?: any;
|
|
556
560
|
isError: true;
|
|
557
561
|
};
|
|
558
|
-
status: "
|
|
562
|
+
status: "skipped";
|
|
559
563
|
thoughtSignature?: string;
|
|
560
564
|
time: {
|
|
561
565
|
start: number;
|
|
562
566
|
end: number;
|
|
563
567
|
};
|
|
564
568
|
type: "toolCall";
|
|
565
|
-
} | {
|
|
566
|
-
type: "thinking";
|
|
567
|
-
thinking: string;
|
|
568
|
-
thinkingSignature?: string;
|
|
569
|
-
redacted?: boolean;
|
|
570
569
|
} | {
|
|
571
570
|
addedToolNames?: string[];
|
|
572
571
|
arguments: Record<string, any>;
|
|
573
572
|
callID: string;
|
|
574
573
|
name: string;
|
|
575
574
|
namespace?: string;
|
|
576
|
-
|
|
577
|
-
content
|
|
575
|
+
result: {
|
|
576
|
+
content: ({
|
|
578
577
|
type: "text";
|
|
579
578
|
text: string;
|
|
580
579
|
textSignature?: string;
|
|
@@ -584,8 +583,9 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
584
583
|
mimeType: string;
|
|
585
584
|
})[];
|
|
586
585
|
details?: any;
|
|
586
|
+
isError: true;
|
|
587
587
|
};
|
|
588
|
-
status: "
|
|
588
|
+
status: "aborted";
|
|
589
589
|
thoughtSignature?: string;
|
|
590
590
|
time: {
|
|
591
591
|
start: number;
|
|
@@ -896,4 +896,4 @@ declare function durable<const Definitions extends ReadonlyArray<Definition>>(de
|
|
|
896
896
|
declare function latest(definitions: ReadonlyArray<Definition>): ReadonlyMap<string, Definition<string, Schema.Codec<unknown, unknown, never, never>>>;
|
|
897
897
|
//#endregion
|
|
898
898
|
export { ID as a, define as c, inventory as d, latest as f, Definition as i, durable as l, AikitToolCallTerminalPart as n, Payload as o, versionedType as p, Data as r, PublishOptions as s, AikitAssistantMessage as t, event_d_exports as u };
|
|
899
|
-
//# sourceMappingURL=event-
|
|
899
|
+
//# sourceMappingURL=event-6sTQ_4bq.d.mts.map
|
package/event.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ID, c as define, d as inventory, f as latest, i as Definition, l as durable, n as AikitToolCallTerminalPart, o as Payload, p as versionedType, r as Data, s as PublishOptions, t as AikitAssistantMessage, u as event_d_exports } from "./event-
|
|
1
|
+
import { a as ID, c as define, d as inventory, f as latest, i as Definition, l as durable, n as AikitToolCallTerminalPart, o as Payload, p as versionedType, r as Data, s as PublishOptions, t as AikitAssistantMessage, u as event_d_exports } from "./event-6sTQ_4bq.mjs";
|
|
2
2
|
export { AikitAssistantMessage, AikitToolCallTerminalPart, Data, Definition, event_d_exports as EventSchema, ID, Payload, PublishOptions, define, durable, inventory, latest, versionedType };
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { posix } from "./posix.mjs";
|
|
3
|
+
import { Context, Effect, Schema } from "effect";
|
|
4
|
+
//#region src/sandbox/scan.ts
|
|
5
|
+
var scan_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
LineScanner: () => LineScanner,
|
|
7
|
+
parse: () => parse,
|
|
8
|
+
script: () => script,
|
|
9
|
+
scriptArgs: () => scriptArgs,
|
|
10
|
+
validate: () => validate,
|
|
11
|
+
viaShell: () => viaShell
|
|
12
|
+
});
|
|
13
|
+
/** A defect, not a file error: callers derive these from already-validated input. */
|
|
14
|
+
const validate = (options) => {
|
|
15
|
+
const { startLine, endLine, maxBytes } = options;
|
|
16
|
+
if (!Number.isSafeInteger(startLine) || startLine < 0) throw new RangeError(`Invalid startLine: ${startLine}`);
|
|
17
|
+
if (endLine !== void 0 && (!Number.isSafeInteger(endLine) || endLine <= startLine)) throw new RangeError(`Invalid endLine: ${endLine}`);
|
|
18
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes <= 0) throw new RangeError(`Invalid maxBytes: ${maxBytes}`);
|
|
19
|
+
};
|
|
20
|
+
const NEWLINE = 10;
|
|
21
|
+
const BOM = [
|
|
22
|
+
239,
|
|
23
|
+
187,
|
|
24
|
+
191
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Computes a {@link LineScan} from a file's bytes fed in order, in memory
|
|
28
|
+
* bounded by `maxBytes`. Feed at most the file size observed when the read
|
|
29
|
+
* started, so a file that keeps growing cannot keep the scan going.
|
|
30
|
+
*/
|
|
31
|
+
var LineScanner = class {
|
|
32
|
+
start;
|
|
33
|
+
end;
|
|
34
|
+
maxBytes;
|
|
35
|
+
decoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
36
|
+
/** The first bytes, held until it is known whether they are a byte-order mark. */
|
|
37
|
+
head = [];
|
|
38
|
+
totalBytes = 0;
|
|
39
|
+
line = 0;
|
|
40
|
+
lineLength = 0;
|
|
41
|
+
lineOpen = false;
|
|
42
|
+
/** The current line's bytes, kept only while it is selected and could still fit. */
|
|
43
|
+
pieces = [];
|
|
44
|
+
selected = [];
|
|
45
|
+
selectedBytes = 0;
|
|
46
|
+
firstLineBytes = 0;
|
|
47
|
+
full = false;
|
|
48
|
+
constructor(options) {
|
|
49
|
+
validate(options);
|
|
50
|
+
this.start = options.startLine;
|
|
51
|
+
this.end = options.endLine ?? Number.POSITIVE_INFINITY;
|
|
52
|
+
this.maxBytes = options.maxBytes;
|
|
53
|
+
}
|
|
54
|
+
push(chunk) {
|
|
55
|
+
this.totalBytes += chunk.length;
|
|
56
|
+
if (this.head !== void 0) {
|
|
57
|
+
const take = Math.min(BOM.length - this.head.length, chunk.length);
|
|
58
|
+
this.head.push(...chunk.subarray(0, take));
|
|
59
|
+
if (this.head.length < BOM.length) return;
|
|
60
|
+
this.releaseHead();
|
|
61
|
+
chunk = chunk.subarray(take);
|
|
62
|
+
}
|
|
63
|
+
this.scan(chunk);
|
|
64
|
+
}
|
|
65
|
+
finish() {
|
|
66
|
+
if (this.head !== void 0) this.releaseHead();
|
|
67
|
+
if (this.lineOpen) this.endLine();
|
|
68
|
+
return {
|
|
69
|
+
text: this.selected.map((line) => this.decoder.decode(line)).join("\n"),
|
|
70
|
+
lines: this.selected.length,
|
|
71
|
+
totalLines: this.line,
|
|
72
|
+
totalBytes: this.totalBytes,
|
|
73
|
+
firstLineBytes: this.firstLineBytes
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
releaseHead() {
|
|
77
|
+
const head = Uint8Array.from(this.head ?? []);
|
|
78
|
+
this.head = void 0;
|
|
79
|
+
if (!(head.length === BOM.length && BOM.every((byte, index) => head[index] === byte))) this.scan(head);
|
|
80
|
+
}
|
|
81
|
+
scan(chunk) {
|
|
82
|
+
let from = 0;
|
|
83
|
+
while (from < chunk.length) {
|
|
84
|
+
const newline = chunk.indexOf(NEWLINE, from);
|
|
85
|
+
const to = newline === -1 ? chunk.length : newline;
|
|
86
|
+
this.append(chunk.subarray(from, to));
|
|
87
|
+
if (newline === -1) return;
|
|
88
|
+
this.endLine();
|
|
89
|
+
from = newline + 1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
isSelected() {
|
|
93
|
+
return !this.full && this.line >= this.start && this.line < this.end;
|
|
94
|
+
}
|
|
95
|
+
append(bytes) {
|
|
96
|
+
if (bytes.length === 0) {
|
|
97
|
+
this.lineOpen = true;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.lineOpen = true;
|
|
101
|
+
if (this.isSelected() && this.lineLength + bytes.length <= this.maxBytes) this.pieces.push(new Uint8Array(bytes));
|
|
102
|
+
this.lineLength += bytes.length;
|
|
103
|
+
}
|
|
104
|
+
endLine() {
|
|
105
|
+
if (this.isSelected()) {
|
|
106
|
+
const first = this.selected.length === 0;
|
|
107
|
+
if (first) this.firstLineBytes = this.lineLength;
|
|
108
|
+
const added = first ? this.lineLength : this.lineLength + 1;
|
|
109
|
+
if (this.selectedBytes + added > this.maxBytes) this.full = true;
|
|
110
|
+
else {
|
|
111
|
+
this.selected.push(concat(this.pieces, this.lineLength));
|
|
112
|
+
this.selectedBytes += added;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
this.pieces = [];
|
|
116
|
+
this.lineLength = 0;
|
|
117
|
+
this.lineOpen = false;
|
|
118
|
+
this.line++;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const concat = (pieces, length) => {
|
|
122
|
+
if (pieces.length === 1) return pieces[0];
|
|
123
|
+
const out = new Uint8Array(length);
|
|
124
|
+
let offset = 0;
|
|
125
|
+
for (const piece of pieces) {
|
|
126
|
+
out.set(piece, offset);
|
|
127
|
+
offset += piece.length;
|
|
128
|
+
}
|
|
129
|
+
return out;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* {@link LineScanner} as a POSIX shell script, for backends that only expose a
|
|
133
|
+
* process API. Run as `sh -c <script> _ <path> <startLine> <endLine|-1> <maxBytes>`.
|
|
134
|
+
* The whole file is read inside the sandbox; only the window is printed, after a
|
|
135
|
+
* header line `<lines> <totalLines> <totalBytes> <firstLineBytes>` and before a
|
|
136
|
+
* closing `|` — see {@link parse}.
|
|
137
|
+
* Exits 2 when the path does not exist.
|
|
138
|
+
*/
|
|
139
|
+
const script = [
|
|
140
|
+
"[ -e \"$1\" ] || exit 2",
|
|
141
|
+
"size=$(($(wc -c < \"$1\"))) || exit 1",
|
|
142
|
+
"head -c \"$size\" -- \"$1\" | LC_ALL=C awk -v s=\"$2\" -v e=\"$3\" -v m=\"$4\" -v size=\"$size\" '",
|
|
143
|
+
"NR == 1 && $0 == \"\\357\\273\\277\" && size == 3 { exit }",
|
|
144
|
+
"NR == 1 && substr($0, 1, 3) == \"\\357\\273\\277\" { $0 = substr($0, 4) }",
|
|
145
|
+
"{ total = NR }",
|
|
146
|
+
"NR > s && (e < 0 || NR <= e) && !full {",
|
|
147
|
+
" len = length($0)",
|
|
148
|
+
" added = lines == 0 ? len : len + 1",
|
|
149
|
+
" if (lines == 0 && !seen) { seen = 1; first = len }",
|
|
150
|
+
" if (bytes + added > m) { full = 1; next }",
|
|
151
|
+
" out = lines == 0 ? $0 : out \"\\n\" $0",
|
|
152
|
+
" bytes += added; lines++",
|
|
153
|
+
"}",
|
|
154
|
+
"END { printf \"%.0f %.0f %.0f %.0f\\n%s|\", lines, total, size, first, out }",
|
|
155
|
+
"'"
|
|
156
|
+
].join("\n");
|
|
157
|
+
/** Arguments for {@link script} after the path. */
|
|
158
|
+
const scriptArgs = (options) => {
|
|
159
|
+
validate(options);
|
|
160
|
+
return [
|
|
161
|
+
String(options.startLine),
|
|
162
|
+
String(options.endLine ?? -1),
|
|
163
|
+
String(options.maxBytes)
|
|
164
|
+
];
|
|
165
|
+
};
|
|
166
|
+
/** Read {@link script}'s output. */
|
|
167
|
+
const parse = (stdout) => {
|
|
168
|
+
const body = stdout.trimEnd();
|
|
169
|
+
const newline = body.indexOf("\n");
|
|
170
|
+
const header = (newline === -1 ? "" : body.slice(0, newline)).trim().split(/\s+/).map(Number);
|
|
171
|
+
const [lines, totalLines, totalBytes, firstLineBytes] = header;
|
|
172
|
+
if (!body.endsWith("|") || header.length !== 4 || header.some((value) => !Number.isSafeInteger(value))) throw new Error(`Unexpected scanLines output: ${stdout.slice(0, 200)}`);
|
|
173
|
+
return {
|
|
174
|
+
text: body.slice(newline + 1, -1),
|
|
175
|
+
lines,
|
|
176
|
+
totalLines,
|
|
177
|
+
totalBytes,
|
|
178
|
+
firstLineBytes
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* `Provider.scanLines` for a backend that runs an argument vector and collects
|
|
183
|
+
* its output: runs {@link script} in the sandbox and reads the result. A missing
|
|
184
|
+
* path rejects with `ENOENT`, the shape `isNotFoundError` recognises.
|
|
185
|
+
*/
|
|
186
|
+
const viaShell = (run) => async (path, options) => {
|
|
187
|
+
const result = await run([
|
|
188
|
+
"sh",
|
|
189
|
+
"-c",
|
|
190
|
+
script,
|
|
191
|
+
"_",
|
|
192
|
+
path,
|
|
193
|
+
...scriptArgs(options)
|
|
194
|
+
]);
|
|
195
|
+
if (result.exitCode === 2) throw Object.assign(/* @__PURE__ */ new Error(`ENOENT: no such file or directory, scanLines '${path}'`), { code: "ENOENT" });
|
|
196
|
+
if (result.exitCode !== 0) throw new Error(`scanLines failed (exit ${result.exitCode}): ${(result.stderr ?? result.stdout).trim()}`);
|
|
197
|
+
return parse(result.stdout);
|
|
198
|
+
};
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/sandbox/filesystem.ts
|
|
201
|
+
var filesystem_exports = /* @__PURE__ */ __exportAll({
|
|
202
|
+
FileSystemError: () => FileSystemError,
|
|
203
|
+
OperationUnsupportedError: () => OperationUnsupportedError,
|
|
204
|
+
SandboxFileSystem: () => filesystem_exports,
|
|
205
|
+
Scan: () => scan_exports,
|
|
206
|
+
Service: () => Service,
|
|
207
|
+
fromProvider: () => fromProvider,
|
|
208
|
+
isNotFoundError: () => isNotFoundError,
|
|
209
|
+
realpathScripts: () => realpathScripts,
|
|
210
|
+
validateRmOptions: () => validateRmOptions,
|
|
211
|
+
withCwd: () => withCwd
|
|
212
|
+
});
|
|
213
|
+
/**
|
|
214
|
+
* The runtime filesystem contract, independent of any backend.
|
|
215
|
+
*
|
|
216
|
+
* Two surfaces, deliberately:
|
|
217
|
+
* - {@link Provider} is what a backend implements — plain promises that reject,
|
|
218
|
+
* matching every SDK we wrap.
|
|
219
|
+
* - {@link Interface} is what the harness consumes — Effect with a typed error
|
|
220
|
+
* channel and tracing spans. {@link fromProvider} bridges the two exactly
|
|
221
|
+
* once, so no consumer ever writes `Effect.tryPromise` against a filesystem.
|
|
222
|
+
*
|
|
223
|
+
* Implementations:
|
|
224
|
+
* - Local:
|
|
225
|
+
* implement it over a VFS (`./local`);
|
|
226
|
+
* local filesystem use OS primitives; hence have broader filesytem capabilities.
|
|
227
|
+
*
|
|
228
|
+
* - Remote:
|
|
229
|
+
* implement it over a provider (`./remote`).
|
|
230
|
+
* remote filesytems depends on the interface provided by the remote provider; hence can have limited filesytem capabilities.
|
|
231
|
+
*
|
|
232
|
+
* `isFile`/`isDirectory` are required booleans; size, mtime, and isSymbolicLink are omitted when the
|
|
233
|
+
* backend cannot report them — never fabricated.
|
|
234
|
+
*
|
|
235
|
+
* **Paths are POSIX, and the harness is Unix-only (for now!).** Every path uses `/`
|
|
236
|
+
* separators on both the host and inside a sandbox — Windows is not supported,
|
|
237
|
+
* so no translation layer exists. Consumers must use the shared Effect POSIX
|
|
238
|
+
* path implementation, never the platform default, or a host running the harness would
|
|
239
|
+
* impose its own flavour on a remote sandbox's paths. Relative paths resolve
|
|
240
|
+
* against the backend's configured `cwd`.
|
|
241
|
+
*/
|
|
242
|
+
var OperationUnsupportedError = class extends Schema.TaggedError()("OperationUnsupportedError", {
|
|
243
|
+
operation: Schema.String,
|
|
244
|
+
message: Schema.String
|
|
245
|
+
}) {};
|
|
246
|
+
/** A backend operation failed. `cause` carries the provider's own rejection. */
|
|
247
|
+
var FileSystemError = class extends Schema.TaggedError()("SandboxFileSystemError", {
|
|
248
|
+
method: Schema.String,
|
|
249
|
+
path: Schema.String,
|
|
250
|
+
cause: Schema.optional(Schema.Defect())
|
|
251
|
+
}) {};
|
|
252
|
+
/** Whether a provider failure means the path itself is definitively absent. */
|
|
253
|
+
const isNotFoundError = (cause) => {
|
|
254
|
+
const code = cause?.code;
|
|
255
|
+
return code === "ENOENT" || code === "ENOTDIR";
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Shell forms of `realpath` for backends that only expose a process API. Run as
|
|
259
|
+
* `sh -c <script> _ <path>`, trying each in turn. `realpath -e` (coreutils)
|
|
260
|
+
* resolves every component, a symlinked file included, and fails on a missing
|
|
261
|
+
* path. Where it is absent, `pwd -P` is the portable primitive: directories
|
|
262
|
+
* resolve directly, anything else resolves its parent and keeps the final name
|
|
263
|
+
* as given — so a symlinked *file* stays unresolved there.
|
|
264
|
+
*/
|
|
265
|
+
const realpathScripts = [
|
|
266
|
+
"realpath -e -- \"$1\"",
|
|
267
|
+
"cd -- \"$1\" && pwd -P",
|
|
268
|
+
"cd -- \"$(dirname -- \"$1\")\" && printf '%s/%s' \"$(pwd -P)\" \"$(basename -- \"$1\")\""
|
|
269
|
+
];
|
|
270
|
+
/** The runtime filesystem service — the live {@link Interface} for the active sandbox. */
|
|
271
|
+
var Service = class extends Context.Service()("@codeworksh/plugin/sandbox/filesystem/Service") {};
|
|
272
|
+
/**
|
|
273
|
+
* Reject `rm` options a provider does not implement, before any mutation. Only
|
|
274
|
+
* `recursive` and `force` are part of the contract; anything else is refused
|
|
275
|
+
* loudly rather than silently ignored.
|
|
276
|
+
*/
|
|
277
|
+
const validateRmOptions = (options, operation = "rm") => Effect.suspend(() => {
|
|
278
|
+
for (const option of Object.keys(options ?? {})) {
|
|
279
|
+
if (option === "recursive" || option === "force") continue;
|
|
280
|
+
return Effect.fail(new OperationUnsupportedError({
|
|
281
|
+
operation,
|
|
282
|
+
message: `Unsupported rm option: ${option}`
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
return Effect.void;
|
|
286
|
+
});
|
|
287
|
+
/**
|
|
288
|
+
* Lift a {@link Provider} into the runtime {@link Interface}: one place that
|
|
289
|
+
* converts rejections into {@link FileSystemError}, validates `rm` options,
|
|
290
|
+
* creates missing parents on write, and names a tracing span per operation.
|
|
291
|
+
*/
|
|
292
|
+
const fromProvider = (provider) => {
|
|
293
|
+
const attempt = (method, path, run) => Effect.tryPromise({
|
|
294
|
+
try: run,
|
|
295
|
+
catch: (cause) => new FileSystemError({
|
|
296
|
+
method,
|
|
297
|
+
path,
|
|
298
|
+
cause
|
|
299
|
+
})
|
|
300
|
+
});
|
|
301
|
+
const writeCreatingParents = (path, content) => {
|
|
302
|
+
const write = attempt("writeFile", path, () => provider.writeFile(path, content));
|
|
303
|
+
const parent = posix.dirname(path);
|
|
304
|
+
return write.pipe(Effect.catch(() => attempt("mkdir", parent, () => provider.mkdir(parent, { recursive: true })).pipe(Effect.ignore, Effect.andThen(write))));
|
|
305
|
+
};
|
|
306
|
+
return {
|
|
307
|
+
readFile: Effect.fn("SandboxFileSystem.readFile")((path) => attempt("readFile", path, () => provider.readFile(path))),
|
|
308
|
+
readFileBuffer: Effect.fn("SandboxFileSystem.readFileBuffer")((path) => attempt("readFileBuffer", path, () => provider.readFileBuffer(path))),
|
|
309
|
+
writeFile: Effect.fn("SandboxFileSystem.writeFile")(writeCreatingParents),
|
|
310
|
+
stat: Effect.fn("SandboxFileSystem.stat")((path) => attempt("stat", path, () => provider.stat(path))),
|
|
311
|
+
...provider.lstat === void 0 ? {} : { lstat: Effect.fn("SandboxFileSystem.lstat")((path) => attempt("lstat", path, () => provider.lstat(path))) },
|
|
312
|
+
readdir: Effect.fn("SandboxFileSystem.readdir")((path) => attempt("readdir", path, () => provider.readdir(path))),
|
|
313
|
+
exists: Effect.fn("SandboxFileSystem.exists")((path) => attempt("exists", path, () => provider.exists(path))),
|
|
314
|
+
mkdir: Effect.fn("SandboxFileSystem.mkdir")((path, options) => attempt("mkdir", path, () => provider.mkdir(path, options))),
|
|
315
|
+
rm: Effect.fn("SandboxFileSystem.rm")((path, options) => validateRmOptions(options).pipe(Effect.andThen(attempt("rm", path, () => provider.rm(path, options))))),
|
|
316
|
+
realpath: Effect.fn("SandboxFileSystem.realpath")((path) => attempt("realpath", path, () => provider.realpath(path))),
|
|
317
|
+
scanLines: Effect.fn("SandboxFileSystem.scanLines")((path, options) => Effect.sync(() => validate(options)).pipe(Effect.andThen(attempt("scanLines", path, () => provider.scanLines(path, options)))))
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Bind a cwd-neutral filesystem to one mount's working directory.
|
|
322
|
+
*
|
|
323
|
+
* The counterpart of `Shell.withCwd`, and the reason relative paths mean the
|
|
324
|
+
* same thing to both: a shared transport stays rooted at the namespace root, so
|
|
325
|
+
* resolution happens here, per mount, rather than inside a VFS whose `chdir` is
|
|
326
|
+
* global state two mounts would fight over.
|
|
327
|
+
*/
|
|
328
|
+
const withCwd = (fs, cwd) => {
|
|
329
|
+
const at = (path) => posix.resolve(cwd, path);
|
|
330
|
+
return {
|
|
331
|
+
readFile: (path) => fs.readFile(at(path)),
|
|
332
|
+
readFileBuffer: (path) => fs.readFileBuffer(at(path)),
|
|
333
|
+
writeFile: (path, content) => fs.writeFile(at(path), content),
|
|
334
|
+
stat: (path) => fs.stat(at(path)),
|
|
335
|
+
readdir: (path) => fs.readdir(at(path)),
|
|
336
|
+
exists: (path) => fs.exists(at(path)),
|
|
337
|
+
mkdir: (path, options) => fs.mkdir(at(path), options),
|
|
338
|
+
rm: (path, options) => fs.rm(at(path), options),
|
|
339
|
+
realpath: (path) => fs.realpath(at(path)),
|
|
340
|
+
scanLines: (path, options) => fs.scanLines(at(path), options),
|
|
341
|
+
...fs.lstat === void 0 ? {} : { lstat: (path) => fs.lstat(at(path)) }
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
//#endregion
|
|
345
|
+
export { fromProvider as a, validateRmOptions as c, filesystem_exports as i, withCwd as l, OperationUnsupportedError as n, isNotFoundError as o, Service as r, realpathScripts as s, FileSystemError as t, scan_exports as u };
|
|
346
|
+
|
|
347
|
+
//# sourceMappingURL=filesystem-BFCKzgND.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem-BFCKzgND.mjs","names":["validateScan"],"sources":["../../src/sandbox/scan.ts","../../src/sandbox/filesystem.ts"],"sourcesContent":["/**\n * Bounded line reads: one pass over a file that returns a window of its lines\n * without ever holding more than that window.\n *\n * Lines are the file split on `\\n`, where a trailing newline ends the last line\n * rather than starting an empty one: `\"\"` has 0 lines, `\"a\"` and `\"a\\n\"` have 1,\n * `\"a\\n\\n\"` has 2. A UTF-8 byte-order mark at the start of the file is not part\n * of the first line. Line lengths are in bytes.\n *\n * Two implementations share these rules, and a backend uses whichever fits:\n * {@link LineScanner} over a byte stream, or {@link script} run inside the\n * sandbox so only the window crosses the network.\n */\n\nexport interface LineScanOptions {\n\t/** First selected line, 0-based. */\n\treadonly startLine: number;\n\t/** End of the selection, exclusive; absent selects to the end of the file. */\n\treadonly endLine?: number;\n\t/** Most UTF-8 bytes of selected text to return; selection stops at the last whole line that fits. */\n\treadonly maxBytes: number;\n}\n\nexport interface LineScan {\n\t/**\n\t * The selected whole lines that fit `maxBytes`, joined with `\\n`. Invalid\n\t * UTF-8 becomes U+FFFD; how many per bad sequence depends on the decoder of\n\t * the backend's transport.\n\t */\n\treadonly text: string;\n\t/** Lines in {@link text}. */\n\treadonly lines: number;\n\t/** Lines in the whole file. */\n\treadonly totalLines: number;\n\t/** Bytes in the whole file, byte-order mark included. */\n\treadonly totalBytes: number;\n\t/**\n\t * Bytes of the first selected line, 0 when nothing is selected. Larger than\n\t * `maxBytes` exactly when that line alone does not fit, and `text` is empty.\n\t */\n\treadonly firstLineBytes: number;\n}\n\n/** A defect, not a file error: callers derive these from already-validated input. */\nexport const validate = (options: LineScanOptions): void => {\n\tconst { startLine, endLine, maxBytes } = options;\n\tif (!Number.isSafeInteger(startLine) || startLine < 0) throw new RangeError(`Invalid startLine: ${startLine}`);\n\tif (endLine !== undefined && (!Number.isSafeInteger(endLine) || endLine <= startLine))\n\t\tthrow new RangeError(`Invalid endLine: ${endLine}`);\n\tif (!Number.isSafeInteger(maxBytes) || maxBytes <= 0) throw new RangeError(`Invalid maxBytes: ${maxBytes}`);\n};\n\nconst NEWLINE = 0x0a;\nconst BOM = [0xef, 0xbb, 0xbf] as const;\n\n/**\n * Computes a {@link LineScan} from a file's bytes fed in order, in memory\n * bounded by `maxBytes`. Feed at most the file size observed when the read\n * started, so a file that keeps growing cannot keep the scan going.\n */\nexport class LineScanner {\n\tprivate readonly start: number;\n\tprivate readonly end: number;\n\tprivate readonly maxBytes: number;\n\t// Only a mark at the very start of the file is dropped, and that happens on\n\t// the bytes; one starting a later line is text.\n\tprivate readonly decoder = new TextDecoder(\"utf-8\", { ignoreBOM: true });\n\n\t/** The first bytes, held until it is known whether they are a byte-order mark. */\n\tprivate head: Array<number> | undefined = [];\n\tprivate totalBytes = 0;\n\tprivate line = 0;\n\tprivate lineLength = 0;\n\tprivate lineOpen = false;\n\t/** The current line's bytes, kept only while it is selected and could still fit. */\n\tprivate pieces: Array<Uint8Array> = [];\n\tprivate selected: Array<Uint8Array> = [];\n\tprivate selectedBytes = 0;\n\tprivate firstLineBytes = 0;\n\tprivate full = false;\n\n\tconstructor(options: LineScanOptions) {\n\t\tvalidate(options);\n\t\tthis.start = options.startLine;\n\t\tthis.end = options.endLine ?? Number.POSITIVE_INFINITY;\n\t\tthis.maxBytes = options.maxBytes;\n\t}\n\n\tpush(chunk: Uint8Array): void {\n\t\tthis.totalBytes += chunk.length;\n\t\tif (this.head !== undefined) {\n\t\t\tconst take = Math.min(BOM.length - this.head.length, chunk.length);\n\t\t\tthis.head.push(...chunk.subarray(0, take));\n\t\t\tif (this.head.length < BOM.length) return;\n\t\t\tthis.releaseHead();\n\t\t\tchunk = chunk.subarray(take);\n\t\t}\n\t\tthis.scan(chunk);\n\t}\n\n\tfinish(): LineScan {\n\t\tif (this.head !== undefined) this.releaseHead();\n\t\tif (this.lineOpen) this.endLine();\n\t\tconst text = this.selected.map((line) => this.decoder.decode(line)).join(\"\\n\");\n\t\treturn {\n\t\t\ttext,\n\t\t\tlines: this.selected.length,\n\t\t\ttotalLines: this.line,\n\t\t\ttotalBytes: this.totalBytes,\n\t\t\tfirstLineBytes: this.firstLineBytes,\n\t\t};\n\t}\n\n\tprivate releaseHead(): void {\n\t\tconst head = Uint8Array.from(this.head ?? []);\n\t\tthis.head = undefined;\n\t\tconst bom = head.length === BOM.length && BOM.every((byte, index) => head[index] === byte);\n\t\tif (!bom) this.scan(head);\n\t}\n\n\tprivate scan(chunk: Uint8Array): void {\n\t\tlet from = 0;\n\t\twhile (from < chunk.length) {\n\t\t\tconst newline = chunk.indexOf(NEWLINE, from);\n\t\t\tconst to = newline === -1 ? chunk.length : newline;\n\t\t\tthis.append(chunk.subarray(from, to));\n\t\t\tif (newline === -1) return;\n\t\t\tthis.endLine();\n\t\t\tfrom = newline + 1;\n\t\t}\n\t}\n\n\tprivate isSelected(): boolean {\n\t\treturn !this.full && this.line >= this.start && this.line < this.end;\n\t}\n\n\tprivate append(bytes: Uint8Array): void {\n\t\tif (bytes.length === 0) {\n\t\t\tthis.lineOpen = true;\n\t\t\treturn;\n\t\t}\n\t\tthis.lineOpen = true;\n\t\t// Past `maxBytes` the line cannot fit, so its bytes are only counted. Copied,\n\t\t// not sliced: a Node `Buffer` slice is a view the reader may overwrite.\n\t\tif (this.isSelected() && this.lineLength + bytes.length <= this.maxBytes) this.pieces.push(new Uint8Array(bytes));\n\t\tthis.lineLength += bytes.length;\n\t}\n\n\tprivate endLine(): void {\n\t\tif (this.isSelected()) {\n\t\t\tconst first = this.selected.length === 0;\n\t\t\tif (first) this.firstLineBytes = this.lineLength;\n\t\t\tconst added = first ? this.lineLength : this.lineLength + 1;\n\t\t\tif (this.selectedBytes + added > this.maxBytes) this.full = true;\n\t\t\telse {\n\t\t\t\tthis.selected.push(concat(this.pieces, this.lineLength));\n\t\t\t\tthis.selectedBytes += added;\n\t\t\t}\n\t\t}\n\t\tthis.pieces = [];\n\t\tthis.lineLength = 0;\n\t\tthis.lineOpen = false;\n\t\tthis.line++;\n\t}\n}\n\nconst concat = (pieces: ReadonlyArray<Uint8Array>, length: number): Uint8Array => {\n\tif (pieces.length === 1) return pieces[0]!;\n\tconst out = new Uint8Array(length);\n\tlet offset = 0;\n\tfor (const piece of pieces) {\n\t\tout.set(piece, offset);\n\t\toffset += piece.length;\n\t}\n\treturn out;\n};\n\n/**\n * {@link LineScanner} as a POSIX shell script, for backends that only expose a\n * process API. Run as `sh -c <script> _ <path> <startLine> <endLine|-1> <maxBytes>`.\n * The whole file is read inside the sandbox; only the window is printed, after a\n * header line `<lines> <totalLines> <totalBytes> <firstLineBytes>` and before a\n * closing `|` — see {@link parse}.\n * Exits 2 when the path does not exist.\n */\nexport const script = [\n\t'[ -e \"$1\" ] || exit 2',\n\t// Arithmetic expansion drops the padding some `wc` builds print.\n\t'size=$(($(wc -c < \"$1\"))) || exit 1',\n\t// `C` makes awk's `length` count bytes; `head -c` bounds a file that is still growing.\n\t'head -c \"$size\" -- \"$1\" | LC_ALL=C awk -v s=\"$2\" -v e=\"$3\" -v m=\"$4\" -v size=\"$size\" \\'',\n\t// A file that is only a byte-order mark has no lines; anything after one keeps its own.\n\t'NR == 1 && $0 == \"\\\\357\\\\273\\\\277\" && size == 3 { exit }',\n\t'NR == 1 && substr($0, 1, 3) == \"\\\\357\\\\273\\\\277\" { $0 = substr($0, 4) }',\n\t\"{ total = NR }\",\n\t\"NR > s && (e < 0 || NR <= e) && !full {\",\n\t\" len = length($0)\",\n\t\" added = lines == 0 ? len : len + 1\",\n\t\" if (lines == 0 && !seen) { seen = 1; first = len }\",\n\t\" if (bytes + added > m) { full = 1; next }\",\n\t' out = lines == 0 ? $0 : out \"\\\\n\" $0',\n\t\" bytes += added; lines++\",\n\t\"}\",\n\t// The trailing `|` survives a transport that trims trailing whitespace off stdout.\n\t// `%.0f`, not `%d`: some mawk builds clamp `%d` to a 32-bit integer.\n\t'END { printf \"%.0f %.0f %.0f %.0f\\\\n%s|\", lines, total, size, first, out }',\n\t\"'\",\n].join(\"\\n\");\n\n/** Arguments for {@link script} after the path. */\nexport const scriptArgs = (options: LineScanOptions): Array<string> => {\n\tvalidate(options);\n\treturn [String(options.startLine), String(options.endLine ?? -1), String(options.maxBytes)];\n};\n\n/** Read {@link script}'s output. */\nexport const parse = (stdout: string): LineScan => {\n\tconst body = stdout.trimEnd();\n\tconst newline = body.indexOf(\"\\n\");\n\tconst header = (newline === -1 ? \"\" : body.slice(0, newline)).trim().split(/\\s+/).map(Number);\n\tconst [lines, totalLines, totalBytes, firstLineBytes] = header;\n\tif (!body.endsWith(\"|\") || header.length !== 4 || header.some((value) => !Number.isSafeInteger(value)))\n\t\tthrow new Error(`Unexpected scanLines output: ${stdout.slice(0, 200)}`);\n\treturn {\n\t\ttext: body.slice(newline + 1, -1),\n\t\tlines: lines!,\n\t\ttotalLines: totalLines!,\n\t\ttotalBytes: totalBytes!,\n\t\tfirstLineBytes: firstLineBytes!,\n\t};\n};\n\nexport interface ShellRun {\n\treadonly exitCode: number;\n\treadonly stdout: string;\n\treadonly stderr?: string;\n}\n\n/**\n * `Provider.scanLines` for a backend that runs an argument vector and collects\n * its output: runs {@link script} in the sandbox and reads the result. A missing\n * path rejects with `ENOENT`, the shape `isNotFoundError` recognises.\n */\nexport const viaShell =\n\t(run: (argv: ReadonlyArray<string>) => Promise<ShellRun>) =>\n\t// oxlint-disable-next-line effecttsgo/async-function -- the Provider contract is Promise-based\n\tasync (path: string, options: LineScanOptions): Promise<LineScan> => {\n\t\tconst result = await run([\"sh\", \"-c\", script, \"_\", path, ...scriptArgs(options)]);\n\t\tif (result.exitCode === 2)\n\t\t\tthrow Object.assign(new Error(`ENOENT: no such file or directory, scanLines '${path}'`), { code: \"ENOENT\" });\n\t\tif (result.exitCode !== 0)\n\t\t\tthrow new Error(`scanLines failed (exit ${result.exitCode}): ${(result.stderr ?? result.stdout).trim()}`);\n\t\treturn parse(result.stdout);\n\t};\n","import { Context, Effect, Schema } from \"effect\";\nimport { posix } from \"../posix.ts\";\nimport { type LineScan, type LineScanOptions, validate as validateScan } from \"./scan.ts\";\n\nexport type { LineScan, LineScanOptions } from \"./scan.ts\";\n/** The shared line-scan rules: `LineScanner` for byte streams, `script` for shell-only backends. */\nexport * as Scan from \"./scan.ts\";\n\n/**\n * The runtime filesystem contract, independent of any backend.\n *\n * Two surfaces, deliberately:\n * - {@link Provider} is what a backend implements — plain promises that reject,\n * matching every SDK we wrap.\n * - {@link Interface} is what the harness consumes — Effect with a typed error\n * channel and tracing spans. {@link fromProvider} bridges the two exactly\n * once, so no consumer ever writes `Effect.tryPromise` against a filesystem.\n *\n * Implementations:\n * - Local:\n * implement it over a VFS (`./local`);\n * local filesystem use OS primitives; hence have broader filesytem capabilities.\n *\n * - Remote:\n * implement it over a provider (`./remote`).\n * remote filesytems depends on the interface provided by the remote provider; hence can have limited filesytem capabilities.\n *\n * `isFile`/`isDirectory` are required booleans; size, mtime, and isSymbolicLink are omitted when the\n * backend cannot report them — never fabricated.\n *\n * **Paths are POSIX, and the harness is Unix-only (for now!).** Every path uses `/`\n * separators on both the host and inside a sandbox — Windows is not supported,\n * so no translation layer exists. Consumers must use the shared Effect POSIX\n * path implementation, never the platform default, or a host running the harness would\n * impose its own flavour on a remote sandbox's paths. Relative paths resolve\n * against the backend's configured `cwd`.\n */\n\nexport class OperationUnsupportedError extends Schema.TaggedError<OperationUnsupportedError>()(\n\t\"OperationUnsupportedError\",\n\t{\n\t\toperation: Schema.String,\n\t\tmessage: Schema.String,\n\t},\n) {}\n\n/** A backend operation failed. `cause` carries the provider's own rejection. */\nexport class FileSystemError extends Schema.TaggedError<FileSystemError>()(\"SandboxFileSystemError\", {\n\tmethod: Schema.String,\n\tpath: Schema.String,\n\tcause: Schema.optional(Schema.Defect()),\n}) {}\n\nexport interface FileStat {\n\treadonly isFile: boolean;\n\treadonly isDirectory: boolean;\n\treadonly isSymbolicLink?: boolean;\n\treadonly size?: number;\n\treadonly mtime?: Date;\n}\n\nexport interface RmOptions {\n\treadonly recursive?: boolean;\n\treadonly force?: boolean;\n}\n\n/** Whether a provider failure means the path itself is definitively absent. */\nexport const isNotFoundError = (cause: unknown) => {\n\tconst code = (cause as NodeJS.ErrnoException | undefined)?.code;\n\treturn code === \"ENOENT\" || code === \"ENOTDIR\";\n};\n\n/**\n * Shell forms of `realpath` for backends that only expose a process API. Run as\n * `sh -c <script> _ <path>`, trying each in turn. `realpath -e` (coreutils)\n * resolves every component, a symlinked file included, and fails on a missing\n * path. Where it is absent, `pwd -P` is the portable primitive: directories\n * resolve directly, anything else resolves its parent and keeps the final name\n * as given — so a symlinked *file* stays unresolved there.\n */\nexport const realpathScripts = [\n\t'realpath -e -- \"$1\"',\n\t'cd -- \"$1\" && pwd -P',\n\t'cd -- \"$(dirname -- \"$1\")\" && printf \\'%s/%s\\' \"$(pwd -P)\" \"$(basename -- \"$1\")\"',\n] as const;\n\n/**\n * The backend-facing contract. Backends author plain promises and let them\n * reject; {@link fromProvider} turns rejections into typed failures.\n */\nexport interface Provider {\n\treadonly readFile: (path: string) => Promise<string>;\n\treadonly readFileBuffer: (path: string) => Promise<Uint8Array>;\n\t/**\n\t * Write the file. Parents may be missing — do not create them here;\n\t * {@link fromProvider} owns that guarantee for every backend.\n\t */\n\treadonly writeFile: (path: string, content: string | Uint8Array) => Promise<void>;\n\treadonly stat: (path: string) => Promise<FileStat>;\n\treadonly readdir: (path: string) => Promise<string[]>;\n\treadonly exists: (path: string) => Promise<boolean>;\n\treadonly mkdir: (path: string, options?: { recursive?: boolean }) => Promise<void>;\n\treadonly rm: (path: string, options?: RmOptions) => Promise<void>;\n\t/** Canonical absolute path with symlinks resolved; rejects when the path does not exist. */\n\treadonly realpath: (path: string) => Promise<string>;\n\t/**\n\t * A window of the file's lines, by the rules in `Scan`. Bounded: never\n\t * returns, or holds, more than the window. A remote backend runs the scan\n\t * inside the sandbox (`Scan.script`) so only the window crosses the network.\n\t */\n\treadonly scanLines: (path: string, options: LineScanOptions) => Promise<LineScan>;\n\t/**\n\t * Metadata for the directory entry itself rather than a symlink's target.\n\t * Optional: a backend whose `stat` has mixed symlink semantics implements it\n\t * so symlink identity is asked for explicitly, never inferred.\n\t */\n\treadonly lstat?: (path: string) => Promise<FileStat>;\n}\n\n/**\n * The consumer-facing contract. `exists` distinguishes \"absent\" from \"could not\n * tell\": a backend failure is a typed failure, not `false`, so a caller acting\n * on absence never acts on a network blip. Use `SandboxFs.existsOrFalse` where\n * a best-effort answer really is wanted.\n */\nexport interface Interface {\n\treadonly readFile: (path: string) => Effect.Effect<string, FileSystemError>;\n\treadonly readFileBuffer: (path: string) => Effect.Effect<Uint8Array, FileSystemError>;\n\t/** Creates missing parent directories, on every backend. */\n\treadonly writeFile: (path: string, content: string | Uint8Array) => Effect.Effect<void, FileSystemError>;\n\treadonly stat: (path: string) => Effect.Effect<FileStat, FileSystemError>;\n\treadonly readdir: (path: string) => Effect.Effect<string[], FileSystemError>;\n\treadonly exists: (path: string) => Effect.Effect<boolean, FileSystemError>;\n\treadonly mkdir: (path: string, options?: { recursive?: boolean }) => Effect.Effect<void, FileSystemError>;\n\treadonly rm: (path: string, options?: RmOptions) => Effect.Effect<void, FileSystemError | OperationUnsupportedError>;\n\t/** Canonical absolute path with symlinks resolved; fails when the path does not exist. */\n\treadonly realpath: (path: string) => Effect.Effect<string, FileSystemError>;\n\t/** A bounded window of the file's lines; see `Scan`. Invalid options are a defect. */\n\treadonly scanLines: (path: string, options: LineScanOptions) => Effect.Effect<LineScan, FileSystemError>;\n\t// `lstat` is present only when the backend supports it; check before calling.\n\treadonly lstat?: (path: string) => Effect.Effect<FileStat, FileSystemError>;\n}\n\n/** The runtime filesystem service — the live {@link Interface} for the active sandbox. */\nexport class Service extends Context.Service<Service, Interface>()(\"@codeworksh/plugin/sandbox/filesystem/Service\") {}\n\n/**\n * Reject `rm` options a provider does not implement, before any mutation. Only\n * `recursive` and `force` are part of the contract; anything else is refused\n * loudly rather than silently ignored.\n */\nexport const validateRmOptions = (\n\toptions: RmOptions | undefined,\n\toperation = \"rm\",\n): Effect.Effect<void, OperationUnsupportedError> =>\n\tEffect.suspend(() => {\n\t\tfor (const option of Object.keys((options ?? {}) as Record<string, unknown>)) {\n\t\t\tif (option === \"recursive\" || option === \"force\") continue;\n\t\t\treturn Effect.fail(new OperationUnsupportedError({ operation, message: `Unsupported rm option: ${option}` }));\n\t\t}\n\t\treturn Effect.void;\n\t});\n\n/**\n * Lift a {@link Provider} into the runtime {@link Interface}: one place that\n * converts rejections into {@link FileSystemError}, validates `rm` options,\n * creates missing parents on write, and names a tracing span per operation.\n */\nexport const fromProvider = (provider: Provider): Interface => {\n\tconst attempt = <A>(method: string, path: string, run: () => Promise<A>) =>\n\t\tEffect.tryPromise({ try: run, catch: (cause) => new FileSystemError({ method, path, cause }) });\n\n\t// The parent-creation guarantee, installed once for every backend instead of\n\t// re-implemented per provider: anything that reaches `Interface` reaches it\n\t// through here, so a backend cannot forget it.\n\t//\n\t// Lazy by design — try the write first, so the happy path stays a single call\n\t// and no remote backend pays a round-trip per write. A failure is usually a\n\t// missing parent, so create it and retry once. The mkdir's own error is\n\t// dropped on purpose: when the write failed for some other reason (EACCES,\n\t// EROFS, a dropped connection), the retry reproduces it, and *that* is the\n\t// failure the caller must see rather than a misleading mkdir error standing\n\t// in for it.\n\tconst writeCreatingParents = (path: string, content: string | Uint8Array) => {\n\t\tconst write = attempt(\"writeFile\", path, () => provider.writeFile(path, content));\n\t\tconst parent = posix.dirname(path);\n\t\treturn write.pipe(\n\t\t\tEffect.catch(() =>\n\t\t\t\tattempt(\"mkdir\", parent, () => provider.mkdir(parent, { recursive: true })).pipe(\n\t\t\t\t\tEffect.ignore,\n\t\t\t\t\tEffect.andThen(write),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t};\n\n\treturn {\n\t\treadFile: Effect.fn(\"SandboxFileSystem.readFile\")((path: string) =>\n\t\t\tattempt(\"readFile\", path, () => provider.readFile(path)),\n\t\t),\n\t\treadFileBuffer: Effect.fn(\"SandboxFileSystem.readFileBuffer\")((path: string) =>\n\t\t\tattempt(\"readFileBuffer\", path, () => provider.readFileBuffer(path)),\n\t\t),\n\t\twriteFile: Effect.fn(\"SandboxFileSystem.writeFile\")(writeCreatingParents),\n\t\tstat: Effect.fn(\"SandboxFileSystem.stat\")((path: string) => attempt(\"stat\", path, () => provider.stat(path))),\n\t\t// carried through only when the backend actually implements it\n\t\t...(provider.lstat === undefined\n\t\t\t? {}\n\t\t\t: {\n\t\t\t\t\tlstat: Effect.fn(\"SandboxFileSystem.lstat\")((path: string) =>\n\t\t\t\t\t\tattempt(\"lstat\", path, () => provider.lstat!(path)),\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\treaddir: Effect.fn(\"SandboxFileSystem.readdir\")((path: string) =>\n\t\t\tattempt(\"readdir\", path, () => provider.readdir(path)),\n\t\t),\n\t\t// A backend that cannot answer fails; it does not report \"absent\". A\n\t\t// caller acting on absence — deleting a record, say — must not be told\n\t\t// the path is gone because a token expired or a request timed out.\n\t\texists: Effect.fn(\"SandboxFileSystem.exists\")((path: string) =>\n\t\t\tattempt(\"exists\", path, () => provider.exists(path)),\n\t\t),\n\t\tmkdir: Effect.fn(\"SandboxFileSystem.mkdir\")((path: string, options?: { recursive?: boolean }) =>\n\t\t\tattempt(\"mkdir\", path, () => provider.mkdir(path, options)),\n\t\t),\n\t\trm: Effect.fn(\"SandboxFileSystem.rm\")((path: string, options?: RmOptions) =>\n\t\t\tvalidateRmOptions(options).pipe(Effect.andThen(attempt(\"rm\", path, () => provider.rm(path, options)))),\n\t\t),\n\t\trealpath: Effect.fn(\"SandboxFileSystem.realpath\")((path: string) =>\n\t\t\tattempt(\"realpath\", path, () => provider.realpath(path)),\n\t\t),\n\t\tscanLines: Effect.fn(\"SandboxFileSystem.scanLines\")((path: string, options: LineScanOptions) =>\n\t\t\tEffect.sync(() => validateScan(options)).pipe(\n\t\t\t\tEffect.andThen(attempt(\"scanLines\", path, () => provider.scanLines(path, options))),\n\t\t\t),\n\t\t),\n\t};\n};\n\n/**\n * Bind a cwd-neutral filesystem to one mount's working directory.\n *\n * The counterpart of `Shell.withCwd`, and the reason relative paths mean the\n * same thing to both: a shared transport stays rooted at the namespace root, so\n * resolution happens here, per mount, rather than inside a VFS whose `chdir` is\n * global state two mounts would fight over.\n */\nexport const withCwd = (fs: Interface, cwd: string): Interface => {\n\tconst at = (path: string) => posix.resolve(cwd, path);\n\treturn {\n\t\treadFile: (path) => fs.readFile(at(path)),\n\t\treadFileBuffer: (path) => fs.readFileBuffer(at(path)),\n\t\twriteFile: (path, content) => fs.writeFile(at(path), content),\n\t\tstat: (path) => fs.stat(at(path)),\n\t\treaddir: (path) => fs.readdir(at(path)),\n\t\texists: (path) => fs.exists(at(path)),\n\t\tmkdir: (path, options) => fs.mkdir(at(path), options),\n\t\trm: (path, options) => fs.rm(at(path), options),\n\t\trealpath: (path) => fs.realpath(at(path)),\n\t\tscanLines: (path, options) => fs.scanLines(at(path), options),\n\t\t// carried through only when the backend implements it, so a caller can\n\t\t// still detect absence by checking the property\n\t\t...(fs.lstat === undefined ? {} : { lstat: (path: string) => fs.lstat!(at(path)) }),\n\t};\n};\n\nexport * as SandboxFileSystem from \"./filesystem.ts\";\n"],"mappings":";;;;;;;;;;;;;AA4CA,MAAa,YAAY,YAAmC;CAC3D,MAAM,EAAE,WAAW,SAAS,aAAa;CACzC,IAAI,CAAC,OAAO,cAAc,SAAS,KAAK,YAAY,GAAG,MAAM,IAAI,WAAW,sBAAsB,WAAW;CAC7G,IAAI,YAAY,KAAA,MAAc,CAAC,OAAO,cAAc,OAAO,KAAK,WAAW,YAC1E,MAAM,IAAI,WAAW,oBAAoB,SAAS;CACnD,IAAI,CAAC,OAAO,cAAc,QAAQ,KAAK,YAAY,GAAG,MAAM,IAA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