@codeworksh/plugin 0.1.0-dev.20261007133154 → 0.2.0-canary.8.1.g763b062a
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-BnLveFBB.d.mts → event-6sTQ_4bq.d.mts} +53 -49
- package/event.d.mts +1 -1
- package/filesystem-CuGE9poU.d.mts +268 -0
- package/filesystem-omtKo08x.mjs +381 -0
- package/filesystem-omtKo08x.mjs.map +1 -0
- package/index.d.mts +2 -2
- package/io-Dgh8U41k.mjs +188 -0
- package/io-Dgh8U41k.mjs.map +1 -0
- package/{io-BYs7hbiY.d.mts → io-nhvNKC33.d.mts} +51 -8
- package/package.json +2 -2
- package/plugin/tool.d.mts +1 -1
- package/{plugin-CLuLZhKa.d.mts → plugin-Deb2QWIP.d.mts} +24 -7
- package/plugin-XaYYRsX-.mjs.map +1 -1
- package/plugin.d.mts +3 -3
- 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 -142
- package/sandbox/instance.d.mts +1 -1
- package/sandbox/io.d.mts +2 -2
- package/sandbox/io.mjs +3 -127
- package/sandbox.d.mts +3 -3
- package/sandbox.mjs +8 -5
- package/sandbox.mjs.map +1 -1
- package/{settings-B6-grSTA.d.mts → settings-47Mzxhl0.d.mts} +7 -1
- package/settings.d.mts +1 -1
- package/settings.mjs +2 -0
- package/settings.mjs.map +1 -1
- package/tool/progress.d.mts +1 -1
- package/{tool-BoVqkYvL.d.mts → tool-D4_I_rzy.d.mts} +2 -2
- package/{tool-DuYBgiJf.d.mts → tool-_ajVYIY5.d.mts} +20 -1
- package/tool.d.mts +1 -1
- package/tool.mjs +2 -1
- package/tool.mjs.map +1 -1
- package/filesystem-Cp-KapCE.d.mts +0 -142
- package/sandbox/filesystem.mjs.map +0 -1
- package/sandbox/io.mjs.map +0 -1
|
@@ -18,6 +18,8 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
18
18
|
options?: Record<string, any>;
|
|
19
19
|
};
|
|
20
20
|
model: string;
|
|
21
|
+
thinkingLevel: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
22
|
+
providerThinkingLevel?: string;
|
|
21
23
|
usage: {
|
|
22
24
|
input: number;
|
|
23
25
|
output: number;
|
|
@@ -147,13 +149,26 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
147
149
|
completed: number;
|
|
148
150
|
};
|
|
149
151
|
parts: ({
|
|
152
|
+
type: "text";
|
|
153
|
+
text: string;
|
|
154
|
+
textSignature?: string;
|
|
155
|
+
} | {
|
|
156
|
+
type: "image";
|
|
157
|
+
data: string;
|
|
158
|
+
mimeType: string;
|
|
159
|
+
} | {
|
|
160
|
+
type: "thinking";
|
|
161
|
+
thinking: string;
|
|
162
|
+
thinkingSignature?: string;
|
|
163
|
+
redacted?: boolean;
|
|
164
|
+
} | {
|
|
150
165
|
addedToolNames?: string[];
|
|
151
166
|
arguments: Record<string, any>;
|
|
152
167
|
callID: string;
|
|
153
168
|
name: string;
|
|
154
169
|
namespace?: string;
|
|
155
|
-
|
|
156
|
-
content
|
|
170
|
+
partial?: {
|
|
171
|
+
content?: ({
|
|
157
172
|
type: "text";
|
|
158
173
|
text: string;
|
|
159
174
|
textSignature?: string;
|
|
@@ -163,9 +178,8 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
163
178
|
mimeType: string;
|
|
164
179
|
})[];
|
|
165
180
|
details?: any;
|
|
166
|
-
isError: false;
|
|
167
181
|
};
|
|
168
|
-
status: "
|
|
182
|
+
status: "running";
|
|
169
183
|
thoughtSignature?: string;
|
|
170
184
|
time: {
|
|
171
185
|
start: number;
|
|
@@ -189,9 +203,9 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
189
203
|
mimeType: string;
|
|
190
204
|
})[];
|
|
191
205
|
details?: any;
|
|
192
|
-
isError:
|
|
206
|
+
isError: false;
|
|
193
207
|
};
|
|
194
|
-
status: "
|
|
208
|
+
status: "completed";
|
|
195
209
|
thoughtSignature?: string;
|
|
196
210
|
time: {
|
|
197
211
|
start: number;
|
|
@@ -217,7 +231,7 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
217
231
|
details?: any;
|
|
218
232
|
isError: true;
|
|
219
233
|
};
|
|
220
|
-
status: "
|
|
234
|
+
status: "error";
|
|
221
235
|
thoughtSignature?: string;
|
|
222
236
|
time: {
|
|
223
237
|
start: number;
|
|
@@ -243,34 +257,21 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
243
257
|
details?: any;
|
|
244
258
|
isError: true;
|
|
245
259
|
};
|
|
246
|
-
status: "
|
|
260
|
+
status: "skipped";
|
|
247
261
|
thoughtSignature?: string;
|
|
248
262
|
time: {
|
|
249
263
|
start: number;
|
|
250
264
|
end: number;
|
|
251
265
|
};
|
|
252
266
|
type: "toolCall";
|
|
253
|
-
} | {
|
|
254
|
-
type: "text";
|
|
255
|
-
text: string;
|
|
256
|
-
textSignature?: string;
|
|
257
|
-
} | {
|
|
258
|
-
type: "image";
|
|
259
|
-
data: string;
|
|
260
|
-
mimeType: string;
|
|
261
|
-
} | {
|
|
262
|
-
type: "thinking";
|
|
263
|
-
thinking: string;
|
|
264
|
-
thinkingSignature?: string;
|
|
265
|
-
redacted?: boolean;
|
|
266
267
|
} | {
|
|
267
268
|
addedToolNames?: string[];
|
|
268
269
|
arguments: Record<string, any>;
|
|
269
270
|
callID: string;
|
|
270
271
|
name: string;
|
|
271
272
|
namespace?: string;
|
|
272
|
-
|
|
273
|
-
content
|
|
273
|
+
result: {
|
|
274
|
+
content: ({
|
|
274
275
|
type: "text";
|
|
275
276
|
text: string;
|
|
276
277
|
textSignature?: string;
|
|
@@ -280,8 +281,9 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
280
281
|
mimeType: string;
|
|
281
282
|
})[];
|
|
282
283
|
details?: any;
|
|
284
|
+
isError: true;
|
|
283
285
|
};
|
|
284
|
-
status: "
|
|
286
|
+
status: "aborted";
|
|
285
287
|
thoughtSignature?: string;
|
|
286
288
|
time: {
|
|
287
289
|
start: number;
|
|
@@ -318,6 +320,8 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
318
320
|
options?: Record<string, any>;
|
|
319
321
|
};
|
|
320
322
|
model: string;
|
|
323
|
+
thinkingLevel: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
324
|
+
providerThinkingLevel?: string;
|
|
321
325
|
usage: {
|
|
322
326
|
input: number;
|
|
323
327
|
output: number;
|
|
@@ -447,13 +451,26 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
447
451
|
completed: number;
|
|
448
452
|
};
|
|
449
453
|
parts: ({
|
|
454
|
+
type: "text";
|
|
455
|
+
text: string;
|
|
456
|
+
textSignature?: string;
|
|
457
|
+
} | {
|
|
458
|
+
type: "image";
|
|
459
|
+
data: string;
|
|
460
|
+
mimeType: string;
|
|
461
|
+
} | {
|
|
462
|
+
type: "thinking";
|
|
463
|
+
thinking: string;
|
|
464
|
+
thinkingSignature?: string;
|
|
465
|
+
redacted?: boolean;
|
|
466
|
+
} | {
|
|
450
467
|
addedToolNames?: string[];
|
|
451
468
|
arguments: Record<string, any>;
|
|
452
469
|
callID: string;
|
|
453
470
|
name: string;
|
|
454
471
|
namespace?: string;
|
|
455
|
-
|
|
456
|
-
content
|
|
472
|
+
partial?: {
|
|
473
|
+
content?: ({
|
|
457
474
|
type: "text";
|
|
458
475
|
text: string;
|
|
459
476
|
textSignature?: string;
|
|
@@ -463,9 +480,8 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
463
480
|
mimeType: string;
|
|
464
481
|
})[];
|
|
465
482
|
details?: any;
|
|
466
|
-
isError: false;
|
|
467
483
|
};
|
|
468
|
-
status: "
|
|
484
|
+
status: "running";
|
|
469
485
|
thoughtSignature?: string;
|
|
470
486
|
time: {
|
|
471
487
|
start: number;
|
|
@@ -489,9 +505,9 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
489
505
|
mimeType: string;
|
|
490
506
|
})[];
|
|
491
507
|
details?: any;
|
|
492
|
-
isError:
|
|
508
|
+
isError: false;
|
|
493
509
|
};
|
|
494
|
-
status: "
|
|
510
|
+
status: "completed";
|
|
495
511
|
thoughtSignature?: string;
|
|
496
512
|
time: {
|
|
497
513
|
start: number;
|
|
@@ -517,7 +533,7 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
517
533
|
details?: any;
|
|
518
534
|
isError: true;
|
|
519
535
|
};
|
|
520
|
-
status: "
|
|
536
|
+
status: "error";
|
|
521
537
|
thoughtSignature?: string;
|
|
522
538
|
time: {
|
|
523
539
|
start: number;
|
|
@@ -543,34 +559,21 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
543
559
|
details?: any;
|
|
544
560
|
isError: true;
|
|
545
561
|
};
|
|
546
|
-
status: "
|
|
562
|
+
status: "skipped";
|
|
547
563
|
thoughtSignature?: string;
|
|
548
564
|
time: {
|
|
549
565
|
start: number;
|
|
550
566
|
end: number;
|
|
551
567
|
};
|
|
552
568
|
type: "toolCall";
|
|
553
|
-
} | {
|
|
554
|
-
type: "text";
|
|
555
|
-
text: string;
|
|
556
|
-
textSignature?: string;
|
|
557
|
-
} | {
|
|
558
|
-
type: "image";
|
|
559
|
-
data: string;
|
|
560
|
-
mimeType: string;
|
|
561
|
-
} | {
|
|
562
|
-
type: "thinking";
|
|
563
|
-
thinking: string;
|
|
564
|
-
thinkingSignature?: string;
|
|
565
|
-
redacted?: boolean;
|
|
566
569
|
} | {
|
|
567
570
|
addedToolNames?: string[];
|
|
568
571
|
arguments: Record<string, any>;
|
|
569
572
|
callID: string;
|
|
570
573
|
name: string;
|
|
571
574
|
namespace?: string;
|
|
572
|
-
|
|
573
|
-
content
|
|
575
|
+
result: {
|
|
576
|
+
content: ({
|
|
574
577
|
type: "text";
|
|
575
578
|
text: string;
|
|
576
579
|
textSignature?: string;
|
|
@@ -580,8 +583,9 @@ declare const AikitAssistantMessage: Schema.decodeTo<Schema.declare<{
|
|
|
580
583
|
mimeType: string;
|
|
581
584
|
})[];
|
|
582
585
|
details?: any;
|
|
586
|
+
isError: true;
|
|
583
587
|
};
|
|
584
|
-
status: "
|
|
588
|
+
status: "aborted";
|
|
585
589
|
thoughtSignature?: string;
|
|
586
590
|
time: {
|
|
587
591
|
start: number;
|
|
@@ -892,4 +896,4 @@ declare function durable<const Definitions extends ReadonlyArray<Definition>>(de
|
|
|
892
896
|
declare function latest(definitions: ReadonlyArray<Definition>): ReadonlyMap<string, Definition<string, Schema.Codec<unknown, unknown, never, never>>>;
|
|
893
897
|
//#endregion
|
|
894
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 };
|
|
895
|
-
//# 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,268 @@
|
|
|
1
|
+
import { Context, Effect, Schema } from "effect";
|
|
2
|
+
declare namespace scan_d_exports {
|
|
3
|
+
export { LineScan, LineScanOptions, LineScanner, ShellRun, parse, script, scriptArgs, validate, viaShell };
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Bounded line reads: one pass over a file that returns a window of its lines
|
|
7
|
+
* without ever holding more than that window.
|
|
8
|
+
*
|
|
9
|
+
* Lines are the file split on `\n`, where a trailing newline ends the last line
|
|
10
|
+
* rather than starting an empty one: `""` has 0 lines, `"a"` and `"a\n"` have 1,
|
|
11
|
+
* `"a\n\n"` has 2. A UTF-8 byte-order mark at the start of the file is not part
|
|
12
|
+
* of the first line. Line lengths are in bytes.
|
|
13
|
+
*
|
|
14
|
+
* Two implementations share these rules, and a backend uses whichever fits:
|
|
15
|
+
* {@link LineScanner} over a byte stream, or {@link script} run inside the
|
|
16
|
+
* sandbox so only the window crosses the network.
|
|
17
|
+
*/
|
|
18
|
+
interface LineScanOptions {
|
|
19
|
+
/** First selected line, 0-based. */
|
|
20
|
+
readonly startLine: number;
|
|
21
|
+
/** End of the selection, exclusive; absent selects to the end of the file. */
|
|
22
|
+
readonly endLine?: number;
|
|
23
|
+
/** Most UTF-8 bytes of selected text to return; selection stops at the last whole line that fits. */
|
|
24
|
+
readonly maxBytes: number;
|
|
25
|
+
}
|
|
26
|
+
interface LineScan {
|
|
27
|
+
/**
|
|
28
|
+
* The selected whole lines that fit `maxBytes`, joined with `\n`. Invalid
|
|
29
|
+
* UTF-8 becomes U+FFFD; how many per bad sequence depends on the decoder of
|
|
30
|
+
* the backend's transport.
|
|
31
|
+
*/
|
|
32
|
+
readonly text: string;
|
|
33
|
+
/** Lines in {@link text}. */
|
|
34
|
+
readonly lines: number;
|
|
35
|
+
/** Lines in the whole file. */
|
|
36
|
+
readonly totalLines: number;
|
|
37
|
+
/** Bytes in the whole file, byte-order mark included. */
|
|
38
|
+
readonly totalBytes: number;
|
|
39
|
+
/**
|
|
40
|
+
* Bytes of the first selected line, 0 when nothing is selected. Larger than
|
|
41
|
+
* `maxBytes` exactly when that line alone does not fit, and `text` is empty.
|
|
42
|
+
*/
|
|
43
|
+
readonly firstLineBytes: number;
|
|
44
|
+
}
|
|
45
|
+
/** A defect, not a file error: callers derive these from already-validated input. */
|
|
46
|
+
declare const validate: (options: LineScanOptions) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Computes a {@link LineScan} from a file's bytes fed in order, in memory
|
|
49
|
+
* bounded by `maxBytes`. Feed at most the file size observed when the read
|
|
50
|
+
* started, so a file that keeps growing cannot keep the scan going.
|
|
51
|
+
*/
|
|
52
|
+
declare class LineScanner {
|
|
53
|
+
private readonly start;
|
|
54
|
+
private readonly end;
|
|
55
|
+
private readonly maxBytes;
|
|
56
|
+
private readonly decoder;
|
|
57
|
+
/** The first bytes, held until it is known whether they are a byte-order mark. */
|
|
58
|
+
private head;
|
|
59
|
+
private totalBytes;
|
|
60
|
+
private line;
|
|
61
|
+
private lineLength;
|
|
62
|
+
private lineOpen;
|
|
63
|
+
/** The current line's bytes, kept only while it is selected and could still fit. */
|
|
64
|
+
private pieces;
|
|
65
|
+
private selected;
|
|
66
|
+
private selectedBytes;
|
|
67
|
+
private firstLineBytes;
|
|
68
|
+
private full;
|
|
69
|
+
constructor(options: LineScanOptions);
|
|
70
|
+
push(chunk: Uint8Array): void;
|
|
71
|
+
finish(): LineScan;
|
|
72
|
+
private releaseHead;
|
|
73
|
+
private scan;
|
|
74
|
+
private isSelected;
|
|
75
|
+
private append;
|
|
76
|
+
private endLine;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* {@link LineScanner} as a POSIX shell script, for backends that only expose a
|
|
80
|
+
* process API. Run as `sh -c <script> _ <path> <startLine> <endLine|-1> <maxBytes>`.
|
|
81
|
+
* The whole file is read inside the sandbox; only the window is printed, after a
|
|
82
|
+
* header line `<lines> <totalLines> <totalBytes> <firstLineBytes>` and before a
|
|
83
|
+
* closing `|` — see {@link parse}.
|
|
84
|
+
* Exits 2 when the path does not exist.
|
|
85
|
+
*/
|
|
86
|
+
declare const script: string;
|
|
87
|
+
/** Arguments for {@link script} after the path. */
|
|
88
|
+
declare const scriptArgs: (options: LineScanOptions) => Array<string>;
|
|
89
|
+
/** Read {@link script}'s output. */
|
|
90
|
+
declare const parse: (stdout: string) => LineScan;
|
|
91
|
+
interface ShellRun {
|
|
92
|
+
readonly exitCode: number;
|
|
93
|
+
readonly stdout: string;
|
|
94
|
+
readonly stderr?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* `Provider.scanLines` for a backend that runs an argument vector and collects
|
|
98
|
+
* its output: runs {@link script} in the sandbox and reads the result. A missing
|
|
99
|
+
* path rejects with `ENOENT`, the shape `isNotFoundError` recognises.
|
|
100
|
+
*/
|
|
101
|
+
declare const viaShell: (run: (argv: ReadonlyArray<string>) => Promise<ShellRun>) => (path: string, options: LineScanOptions) => Promise<LineScan>;
|
|
102
|
+
declare namespace filesystem_d_exports {
|
|
103
|
+
export { FileStat, FileSystemError, Interface, LineScan, LineScanOptions, OperationUnsupportedError, Provider, RmOptions, filesystem_d_exports as SandboxFileSystem, scan_d_exports as Scan, Service, fromProvider, isNotFoundError, readBytesScript, readBytesViaShell, realpathScripts, validateRmOptions, withCwd };
|
|
104
|
+
}
|
|
105
|
+
declare const OperationUnsupportedError_base: Schema.Class<OperationUnsupportedError, Schema.TaggedStruct<"OperationUnsupportedError", {
|
|
106
|
+
readonly operation: Schema.String;
|
|
107
|
+
readonly message: Schema.String;
|
|
108
|
+
}>, import("effect/Cause").YieldableError>;
|
|
109
|
+
/**
|
|
110
|
+
* The runtime filesystem contract, independent of any backend.
|
|
111
|
+
*
|
|
112
|
+
* Two surfaces, deliberately:
|
|
113
|
+
* - {@link Provider} is what a backend implements — plain promises that reject,
|
|
114
|
+
* matching every SDK we wrap.
|
|
115
|
+
* - {@link Interface} is what the harness consumes — Effect with a typed error
|
|
116
|
+
* channel and tracing spans. {@link fromProvider} bridges the two exactly
|
|
117
|
+
* once, so no consumer ever writes `Effect.tryPromise` against a filesystem.
|
|
118
|
+
*
|
|
119
|
+
* Implementations:
|
|
120
|
+
* - Local:
|
|
121
|
+
* implement it over a VFS (`./local`);
|
|
122
|
+
* local filesystem use OS primitives; hence have broader filesytem capabilities.
|
|
123
|
+
*
|
|
124
|
+
* - Remote:
|
|
125
|
+
* implement it over a provider (`./remote`).
|
|
126
|
+
* remote filesytems depends on the interface provided by the remote provider; hence can have limited filesytem capabilities.
|
|
127
|
+
*
|
|
128
|
+
* `isFile`/`isDirectory` are required booleans; size, mtime, and isSymbolicLink are omitted when the
|
|
129
|
+
* backend cannot report them — never fabricated.
|
|
130
|
+
*
|
|
131
|
+
* **Paths are POSIX, and the harness is Unix-only (for now!).** Every path uses `/`
|
|
132
|
+
* separators on both the host and inside a sandbox — Windows is not supported,
|
|
133
|
+
* so no translation layer exists. Consumers must use the shared Effect POSIX
|
|
134
|
+
* path implementation, never the platform default, or a host running the harness would
|
|
135
|
+
* impose its own flavour on a remote sandbox's paths. Relative paths resolve
|
|
136
|
+
* against the backend's configured `cwd`.
|
|
137
|
+
*/
|
|
138
|
+
declare class OperationUnsupportedError extends OperationUnsupportedError_base {}
|
|
139
|
+
declare const FileSystemError_base: Schema.Class<FileSystemError, Schema.TaggedStruct<"SandboxFileSystemError", {
|
|
140
|
+
readonly method: Schema.String;
|
|
141
|
+
readonly path: Schema.String;
|
|
142
|
+
readonly cause: Schema.optional<Schema.Defect>;
|
|
143
|
+
}>, import("effect/Cause").YieldableError>;
|
|
144
|
+
/** A backend operation failed. `cause` carries the provider's own rejection. */
|
|
145
|
+
declare class FileSystemError extends FileSystemError_base {}
|
|
146
|
+
interface FileStat {
|
|
147
|
+
readonly isFile: boolean;
|
|
148
|
+
readonly isDirectory: boolean;
|
|
149
|
+
readonly isSymbolicLink?: boolean;
|
|
150
|
+
readonly size?: number;
|
|
151
|
+
readonly mtime?: Date;
|
|
152
|
+
}
|
|
153
|
+
interface RmOptions {
|
|
154
|
+
readonly recursive?: boolean;
|
|
155
|
+
readonly force?: boolean;
|
|
156
|
+
}
|
|
157
|
+
/** Whether a provider failure means the path itself is definitively absent. */
|
|
158
|
+
declare const isNotFoundError: (cause: unknown) => boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Shell forms of `realpath` for backends that only expose a process API. Run as
|
|
161
|
+
* `sh -c <script> _ <path>`, trying each in turn. `realpath -e` (coreutils)
|
|
162
|
+
* resolves every component, a symlinked file included, and fails on a missing
|
|
163
|
+
* path. Where it is absent, `pwd -P` is the portable primitive: directories
|
|
164
|
+
* resolve directly, anything else resolves its parent and keeps the final name
|
|
165
|
+
* as given — so a symlinked *file* stays unresolved there.
|
|
166
|
+
*/
|
|
167
|
+
declare const realpathScripts: readonly ['realpath -e -- "$1"', 'cd -- "$1" && pwd -P', 'cd -- "$(dirname -- "$1")" && printf \'%s/%s\' "$(pwd -P)" "$(basename -- "$1")"'];
|
|
168
|
+
/**
|
|
169
|
+
* Shell form of `readBytes` for backends that only expose a process API. Run as
|
|
170
|
+
* `sh -c <script> _ <path> <offset + 1> <length>`; prints the bytes as base64,
|
|
171
|
+
* so binary content survives a transport that decodes stdout as text. Exits 2
|
|
172
|
+
* when the path does not exist, 3 when it cannot be opened.
|
|
173
|
+
*/
|
|
174
|
+
declare const readBytesScript: string;
|
|
175
|
+
/**
|
|
176
|
+
* `Provider.readBytes` for a backend that runs an argument vector and collects
|
|
177
|
+
* its output. A missing path rejects with `ENOENT`, the shape `isNotFoundError` recognises.
|
|
178
|
+
*/
|
|
179
|
+
declare const readBytesViaShell: (run: (argv: ReadonlyArray<string>) => Promise<ShellRun>) => (path: string, offset: number, length: number) => Promise<Uint8Array>;
|
|
180
|
+
/**
|
|
181
|
+
* The backend-facing contract. Backends author plain promises and let them
|
|
182
|
+
* reject; {@link fromProvider} turns rejections into typed failures.
|
|
183
|
+
*/
|
|
184
|
+
interface Provider {
|
|
185
|
+
readonly readFile: (path: string) => Promise<string>;
|
|
186
|
+
readonly readFileBuffer: (path: string) => Promise<Uint8Array>;
|
|
187
|
+
/** Up to `length` bytes from `offset`; fewer at the end of the file. */
|
|
188
|
+
readonly readBytes: (path: string, offset: number, length: number) => Promise<Uint8Array>;
|
|
189
|
+
/**
|
|
190
|
+
* Write the file. Parents may be missing — do not create them here;
|
|
191
|
+
* {@link fromProvider} owns that guarantee for every backend.
|
|
192
|
+
*/
|
|
193
|
+
readonly writeFile: (path: string, content: string | Uint8Array) => Promise<void>;
|
|
194
|
+
readonly stat: (path: string) => Promise<FileStat>;
|
|
195
|
+
readonly readdir: (path: string) => Promise<string[]>;
|
|
196
|
+
readonly exists: (path: string) => Promise<boolean>;
|
|
197
|
+
readonly mkdir: (path: string, options?: {
|
|
198
|
+
recursive?: boolean;
|
|
199
|
+
}) => Promise<void>;
|
|
200
|
+
readonly rm: (path: string, options?: RmOptions) => Promise<void>;
|
|
201
|
+
/** Canonical absolute path with symlinks resolved; rejects when the path does not exist. */
|
|
202
|
+
readonly realpath: (path: string) => Promise<string>;
|
|
203
|
+
/**
|
|
204
|
+
* A window of the file's lines, by the rules in `Scan`. Bounded: never
|
|
205
|
+
* returns, or holds, more than the window. A remote backend runs the scan
|
|
206
|
+
* inside the sandbox (`Scan.script`) so only the window crosses the network.
|
|
207
|
+
*/
|
|
208
|
+
readonly scanLines: (path: string, options: LineScanOptions) => Promise<LineScan>;
|
|
209
|
+
/**
|
|
210
|
+
* Metadata for the directory entry itself rather than a symlink's target.
|
|
211
|
+
* Optional: a backend whose `stat` has mixed symlink semantics implements it
|
|
212
|
+
* so symlink identity is asked for explicitly, never inferred.
|
|
213
|
+
*/
|
|
214
|
+
readonly lstat?: (path: string) => Promise<FileStat>;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The consumer-facing contract. `exists` distinguishes "absent" from "could not
|
|
218
|
+
* tell": a backend failure is a typed failure, not `false`, so a caller acting
|
|
219
|
+
* on absence never acts on a network blip. Use `SandboxFs.existsOrFalse` where
|
|
220
|
+
* a best-effort answer really is wanted.
|
|
221
|
+
*/
|
|
222
|
+
interface Interface {
|
|
223
|
+
readonly readFile: (path: string) => Effect.Effect<string, FileSystemError>;
|
|
224
|
+
readonly readFileBuffer: (path: string) => Effect.Effect<Uint8Array, FileSystemError>;
|
|
225
|
+
/** Up to `length` bytes from `offset`; fewer at the end of the file. */
|
|
226
|
+
readonly readBytes: (path: string, offset: number, length: number) => Effect.Effect<Uint8Array, FileSystemError>;
|
|
227
|
+
/** Creates missing parent directories, on every backend. */
|
|
228
|
+
readonly writeFile: (path: string, content: string | Uint8Array) => Effect.Effect<void, FileSystemError>;
|
|
229
|
+
readonly stat: (path: string) => Effect.Effect<FileStat, FileSystemError>;
|
|
230
|
+
readonly readdir: (path: string) => Effect.Effect<string[], FileSystemError>;
|
|
231
|
+
readonly exists: (path: string) => Effect.Effect<boolean, FileSystemError>;
|
|
232
|
+
readonly mkdir: (path: string, options?: {
|
|
233
|
+
recursive?: boolean;
|
|
234
|
+
}) => Effect.Effect<void, FileSystemError>;
|
|
235
|
+
readonly rm: (path: string, options?: RmOptions) => Effect.Effect<void, FileSystemError | OperationUnsupportedError>;
|
|
236
|
+
/** Canonical absolute path with symlinks resolved; fails when the path does not exist. */
|
|
237
|
+
readonly realpath: (path: string) => Effect.Effect<string, FileSystemError>;
|
|
238
|
+
/** A bounded window of the file's lines; see `Scan`. Invalid options are a defect. */
|
|
239
|
+
readonly scanLines: (path: string, options: LineScanOptions) => Effect.Effect<LineScan, FileSystemError>;
|
|
240
|
+
readonly lstat?: (path: string) => Effect.Effect<FileStat, FileSystemError>;
|
|
241
|
+
}
|
|
242
|
+
declare const Service_base: Context.ServiceClass<Service, "@codeworksh/plugin/sandbox/filesystem/Service", Interface>;
|
|
243
|
+
/** The runtime filesystem service — the live {@link Interface} for the active sandbox. */
|
|
244
|
+
declare class Service extends Service_base {}
|
|
245
|
+
/**
|
|
246
|
+
* Reject `rm` options a provider does not implement, before any mutation. Only
|
|
247
|
+
* `recursive` and `force` are part of the contract; anything else is refused
|
|
248
|
+
* loudly rather than silently ignored.
|
|
249
|
+
*/
|
|
250
|
+
declare const validateRmOptions: (options: RmOptions | undefined, operation?: string) => Effect.Effect<void, OperationUnsupportedError>;
|
|
251
|
+
/**
|
|
252
|
+
* Lift a {@link Provider} into the runtime {@link Interface}: one place that
|
|
253
|
+
* converts rejections into {@link FileSystemError}, validates `rm` options,
|
|
254
|
+
* creates missing parents on write, and names a tracing span per operation.
|
|
255
|
+
*/
|
|
256
|
+
declare const fromProvider: (provider: Provider) => Interface;
|
|
257
|
+
/**
|
|
258
|
+
* Bind a cwd-neutral filesystem to one mount's working directory.
|
|
259
|
+
*
|
|
260
|
+
* The counterpart of `Shell.withCwd`, and the reason relative paths mean the
|
|
261
|
+
* same thing to both: a shared transport stays rooted at the namespace root, so
|
|
262
|
+
* resolution happens here, per mount, rather than inside a VFS whose `chdir` is
|
|
263
|
+
* global state two mounts would fight over.
|
|
264
|
+
*/
|
|
265
|
+
declare const withCwd: (fs: Interface, cwd: string) => Interface;
|
|
266
|
+
//#endregion
|
|
267
|
+
export { LineScanOptions as _, Provider as a, filesystem_d_exports as c, readBytesScript as d, readBytesViaShell as f, LineScan as g, withCwd as h, OperationUnsupportedError as i, fromProvider as l, validateRmOptions as m, FileSystemError as n, RmOptions as o, realpathScripts as p, Interface as r, Service as s, FileStat as t, isNotFoundError as u, scan_d_exports as v };
|
|
268
|
+
//# sourceMappingURL=filesystem-CuGE9poU.d.mts.map
|