@resourcexjs/arp 1.1.0 → 1.3.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/README.md +80 -17
- package/dist/index.d.ts +132 -62
- package/dist/index.js +168 -123
- package/dist/index.js.map +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -119,10 +119,14 @@ const arl = arp.parse("arp:text:file://./data.txt");
|
|
|
119
119
|
|
|
120
120
|
### ARL Operations
|
|
121
121
|
|
|
122
|
-
#### `resolve(): Promise<Resource>`
|
|
122
|
+
#### `resolve(params?): Promise<Resource>`
|
|
123
123
|
|
|
124
124
|
Read resource from location.
|
|
125
125
|
|
|
126
|
+
**Parameters:**
|
|
127
|
+
|
|
128
|
+
- `params?: TransportParams` - Optional parameters passed to transport
|
|
129
|
+
|
|
126
130
|
**Returns**: `Promise<Resource>`
|
|
127
131
|
|
|
128
132
|
- `{ content: string }` for text semantic
|
|
@@ -133,15 +137,19 @@ Read resource from location.
|
|
|
133
137
|
```typescript
|
|
134
138
|
const resource = await arl.resolve();
|
|
135
139
|
console.log(resource.content);
|
|
140
|
+
|
|
141
|
+
// With params (e.g., directory listing)
|
|
142
|
+
const dirResource = await arl.resolve({ recursive: "true", pattern: "*.json" });
|
|
136
143
|
```
|
|
137
144
|
|
|
138
|
-
#### `deposit(data:
|
|
145
|
+
#### `deposit(data: unknown, params?): Promise<void>`
|
|
139
146
|
|
|
140
147
|
Write resource to location.
|
|
141
148
|
|
|
142
149
|
**Parameters:**
|
|
143
150
|
|
|
144
|
-
- `data:
|
|
151
|
+
- `data: unknown` - Content to write (string, Buffer, Uint8Array, ArrayBuffer, number[])
|
|
152
|
+
- `params?: TransportParams` - Optional parameters passed to transport
|
|
145
153
|
|
|
146
154
|
**Throws**: `TransportError` if operation fails
|
|
147
155
|
|
|
@@ -202,6 +210,29 @@ const { content } = await arl.resolve(); // Buffer
|
|
|
202
210
|
|
|
203
211
|
## Transport Handlers
|
|
204
212
|
|
|
213
|
+
Transport handlers implement a unified interface:
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
interface TransportHandler {
|
|
217
|
+
readonly name: string;
|
|
218
|
+
get(location: string, params?: TransportParams): Promise<TransportResult>;
|
|
219
|
+
set(location: string, content: Buffer, params?: TransportParams): Promise<void>;
|
|
220
|
+
exists(location: string): Promise<boolean>;
|
|
221
|
+
delete(location: string): Promise<void>;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
type TransportParams = Record<string, string>;
|
|
225
|
+
|
|
226
|
+
interface TransportResult {
|
|
227
|
+
content: Buffer;
|
|
228
|
+
metadata?: {
|
|
229
|
+
type?: "file" | "directory";
|
|
230
|
+
size?: number;
|
|
231
|
+
modifiedAt?: Date;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
205
236
|
### File Transport (`file`)
|
|
206
237
|
|
|
207
238
|
Local filesystem operations.
|
|
@@ -219,11 +250,20 @@ arp.parse("arp:text:file://~/file.txt");
|
|
|
219
250
|
|
|
220
251
|
**Operations:**
|
|
221
252
|
|
|
222
|
-
- ✅
|
|
223
|
-
- ✅
|
|
253
|
+
- ✅ get (read file or directory listing)
|
|
254
|
+
- ✅ set (write)
|
|
224
255
|
- ✅ exists
|
|
225
256
|
- ✅ delete
|
|
226
257
|
|
|
258
|
+
**Params for directory listing:**
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
// List directory with params
|
|
262
|
+
const arl = arp.parse("arp:text:file://./data");
|
|
263
|
+
const result = await arl.resolve({ recursive: "true", pattern: "*.json" });
|
|
264
|
+
// Returns JSON array of matching file paths
|
|
265
|
+
```
|
|
266
|
+
|
|
227
267
|
### HTTP/HTTPS Transport
|
|
228
268
|
|
|
229
269
|
Network resource operations (read-only).
|
|
@@ -235,10 +275,19 @@ arp.parse("arp:binary:https://example.com/image.png");
|
|
|
235
275
|
|
|
236
276
|
**Operations:**
|
|
237
277
|
|
|
238
|
-
- ✅
|
|
239
|
-
- ❌
|
|
278
|
+
- ✅ get (read)
|
|
279
|
+
- ❌ set (read-only, throws error)
|
|
240
280
|
- ❌ exists (not supported)
|
|
241
|
-
- ❌ delete (
|
|
281
|
+
- ❌ delete (read-only, throws error)
|
|
282
|
+
|
|
283
|
+
**Params handling:**
|
|
284
|
+
|
|
285
|
+
```typescript
|
|
286
|
+
// URL params are merged with runtime params
|
|
287
|
+
const arl = arp.parse("arp:text:https://api.example.com/data?format=json");
|
|
288
|
+
const result = await arl.resolve({ lang: "en" });
|
|
289
|
+
// Fetches: https://api.example.com/data?format=json&lang=en
|
|
290
|
+
```
|
|
242
291
|
|
|
243
292
|
### AgentVM Transport (`agentvm`)
|
|
244
293
|
|
|
@@ -251,8 +300,8 @@ arp.parse("arp:text:agentvm://sandbox/config.json");
|
|
|
251
300
|
|
|
252
301
|
**Operations:**
|
|
253
302
|
|
|
254
|
-
- ✅
|
|
255
|
-
- ✅
|
|
303
|
+
- ✅ get (read)
|
|
304
|
+
- ✅ set (write)
|
|
256
305
|
- ✅ exists
|
|
257
306
|
- ✅ delete
|
|
258
307
|
|
|
@@ -326,23 +375,37 @@ if (!(await arl.exists())) {
|
|
|
326
375
|
### Custom Transport
|
|
327
376
|
|
|
328
377
|
```typescript
|
|
329
|
-
import type { TransportHandler } from "@resourcexjs/arp";
|
|
378
|
+
import type { TransportHandler, TransportParams, TransportResult } from "@resourcexjs/arp";
|
|
330
379
|
|
|
331
380
|
class S3Transport implements TransportHandler {
|
|
332
|
-
|
|
381
|
+
readonly name = "s3";
|
|
333
382
|
|
|
334
|
-
async
|
|
383
|
+
async get(location: string, params?: TransportParams): Promise<TransportResult> {
|
|
335
384
|
// Fetch from S3
|
|
336
385
|
const data = await s3.getObject({ Bucket: "...", Key: location });
|
|
337
|
-
return
|
|
386
|
+
return {
|
|
387
|
+
content: data.Body as Buffer,
|
|
388
|
+
metadata: { type: "file", size: data.ContentLength },
|
|
389
|
+
};
|
|
338
390
|
}
|
|
339
391
|
|
|
340
|
-
async
|
|
392
|
+
async set(location: string, content: Buffer, params?: TransportParams): Promise<void> {
|
|
341
393
|
// Upload to S3
|
|
342
|
-
await s3.putObject({ Bucket: "...", Key: location, Body:
|
|
394
|
+
await s3.putObject({ Bucket: "...", Key: location, Body: content });
|
|
343
395
|
}
|
|
344
396
|
|
|
345
|
-
|
|
397
|
+
async exists(location: string): Promise<boolean> {
|
|
398
|
+
try {
|
|
399
|
+
await s3.headObject({ Bucket: "...", Key: location });
|
|
400
|
+
return true;
|
|
401
|
+
} catch {
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
async delete(location: string): Promise<void> {
|
|
407
|
+
await s3.deleteObject({ Bucket: "...", Key: location });
|
|
408
|
+
}
|
|
346
409
|
}
|
|
347
410
|
|
|
348
411
|
// Register
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,53 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Transport Handler Interface
|
|
3
|
-
* Responsible for I/O primitives -
|
|
3
|
+
* Responsible for I/O primitives - get, set, exists, delete
|
|
4
4
|
* Transport only handles WHERE and HOW to access bytes, not WHAT they mean
|
|
5
|
+
*
|
|
6
|
+
* Each transport defines its own location format and supported parameters.
|
|
5
7
|
*/
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
9
|
+
* Runtime parameters passed to transport operations
|
|
10
|
+
* Each transport defines which parameters it supports
|
|
8
11
|
*/
|
|
9
|
-
|
|
10
|
-
readonly canRead: boolean;
|
|
11
|
-
readonly canWrite: boolean;
|
|
12
|
-
readonly canList: boolean;
|
|
13
|
-
readonly canDelete: boolean;
|
|
14
|
-
readonly canStat: boolean;
|
|
15
|
-
}
|
|
12
|
+
type TransportParams = Record<string, string>;
|
|
16
13
|
/**
|
|
17
|
-
*
|
|
14
|
+
* Result from transport get operation
|
|
18
15
|
*/
|
|
19
|
-
interface
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
interface TransportResult {
|
|
17
|
+
/**
|
|
18
|
+
* Raw content as Buffer
|
|
19
|
+
*/
|
|
20
|
+
content: Buffer;
|
|
21
|
+
/**
|
|
22
|
+
* Optional metadata about the resource
|
|
23
|
+
*/
|
|
24
|
+
metadata?: {
|
|
25
|
+
/**
|
|
26
|
+
* Resource type: 'file' or 'directory'
|
|
27
|
+
*/
|
|
28
|
+
type?: "file" | "directory"
|
|
29
|
+
/**
|
|
30
|
+
* File size in bytes
|
|
31
|
+
*/
|
|
32
|
+
size?: number
|
|
33
|
+
/**
|
|
34
|
+
* Last modified time
|
|
35
|
+
*/
|
|
36
|
+
modifiedAt?: Date
|
|
37
|
+
/**
|
|
38
|
+
* Additional transport-specific metadata
|
|
39
|
+
*/
|
|
40
|
+
[key: string]: unknown
|
|
41
|
+
};
|
|
23
42
|
}
|
|
24
43
|
/**
|
|
25
44
|
* Transport Handler - provides I/O primitives
|
|
45
|
+
*
|
|
46
|
+
* Four core operations:
|
|
47
|
+
* - get: Retrieve content (file content or directory listing)
|
|
48
|
+
* - set: Store content
|
|
49
|
+
* - exists: Check existence
|
|
50
|
+
* - delete: Remove resource
|
|
26
51
|
*/
|
|
27
52
|
interface TransportHandler {
|
|
28
53
|
/**
|
|
@@ -30,47 +55,37 @@ interface TransportHandler {
|
|
|
30
55
|
*/
|
|
31
56
|
readonly name: string;
|
|
32
57
|
/**
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @
|
|
58
|
+
* Get content from location
|
|
59
|
+
*
|
|
60
|
+
* For file-like transports:
|
|
61
|
+
* - If location points to a file, returns file content
|
|
62
|
+
* - If location points to a directory, returns directory listing as JSON
|
|
63
|
+
*
|
|
64
|
+
* @param location - The location string (format depends on transport)
|
|
65
|
+
* @param params - Optional runtime parameters (transport-specific)
|
|
66
|
+
* @returns Content and optional metadata
|
|
40
67
|
*/
|
|
41
|
-
|
|
68
|
+
get(location: string, params?: TransportParams): Promise<TransportResult>;
|
|
42
69
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
70
|
+
* Set content at location
|
|
71
|
+
*
|
|
72
|
+
* @param location - The location string (format depends on transport)
|
|
45
73
|
* @param content - Content to write
|
|
74
|
+
* @param params - Optional runtime parameters (transport-specific)
|
|
46
75
|
*/
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* List entries at location (for directory-like transports)
|
|
50
|
-
* @param location - The location string after ://
|
|
51
|
-
* @returns Array of entry names
|
|
52
|
-
*/
|
|
53
|
-
list?(location: string): Promise<string[]>;
|
|
54
|
-
/**
|
|
55
|
-
* Create directory at location
|
|
56
|
-
* @param location - The location string after ://
|
|
57
|
-
*/
|
|
58
|
-
mkdir?(location: string): Promise<void>;
|
|
76
|
+
set(location: string, content: Buffer, params?: TransportParams): Promise<void>;
|
|
59
77
|
/**
|
|
60
78
|
* Check if resource exists at location
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
exists?(location: string): Promise<boolean>;
|
|
64
|
-
/**
|
|
65
|
-
* Get resource stat information
|
|
66
|
-
* @param location - The location string after ://
|
|
79
|
+
*
|
|
80
|
+
* @param location - The location string (format depends on transport)
|
|
67
81
|
*/
|
|
68
|
-
|
|
82
|
+
exists(location: string): Promise<boolean>;
|
|
69
83
|
/**
|
|
70
84
|
* Delete resource at location
|
|
71
|
-
*
|
|
85
|
+
*
|
|
86
|
+
* @param location - The location string (format depends on transport)
|
|
72
87
|
*/
|
|
73
|
-
delete
|
|
88
|
+
delete(location: string): Promise<void>;
|
|
74
89
|
}
|
|
75
90
|
/**
|
|
76
91
|
* Resource metadata
|
|
@@ -84,6 +99,10 @@ interface ResourceMeta {
|
|
|
84
99
|
encoding?: string;
|
|
85
100
|
mimeType?: string;
|
|
86
101
|
resolvedAt: string;
|
|
102
|
+
/**
|
|
103
|
+
* Resource type: 'file' or 'directory'
|
|
104
|
+
*/
|
|
105
|
+
type?: "file" | "directory";
|
|
87
106
|
}
|
|
88
107
|
/**
|
|
89
108
|
* Context passed to semantic handler
|
|
@@ -94,6 +113,10 @@ interface SemanticContext {
|
|
|
94
113
|
transport: string;
|
|
95
114
|
location: string;
|
|
96
115
|
timestamp: Date;
|
|
116
|
+
/**
|
|
117
|
+
* Runtime parameters passed to operations
|
|
118
|
+
*/
|
|
119
|
+
params?: TransportParams;
|
|
97
120
|
}
|
|
98
121
|
/**
|
|
99
122
|
* Base resource interface
|
|
@@ -118,7 +141,7 @@ interface SemanticHandler<T = unknown> {
|
|
|
118
141
|
*
|
|
119
142
|
* @param transport - Transport handler for I/O operations
|
|
120
143
|
* @param location - Resource location
|
|
121
|
-
* @param context - Semantic context
|
|
144
|
+
* @param context - Semantic context (includes params)
|
|
122
145
|
*/
|
|
123
146
|
resolve(transport: TransportHandler, location: string, context: SemanticContext): Promise<Resource<T>>;
|
|
124
147
|
/**
|
|
@@ -128,7 +151,7 @@ interface SemanticHandler<T = unknown> {
|
|
|
128
151
|
* @param transport - Transport handler for I/O operations
|
|
129
152
|
* @param location - Resource location
|
|
130
153
|
* @param data - Data to deposit
|
|
131
|
-
* @param context - Semantic context
|
|
154
|
+
* @param context - Semantic context (includes params)
|
|
132
155
|
*/
|
|
133
156
|
deposit?(transport: TransportHandler, location: string, data: T, context: SemanticContext): Promise<void>;
|
|
134
157
|
/**
|
|
@@ -164,12 +187,15 @@ interface ARL extends ARI {
|
|
|
164
187
|
readonly location: string;
|
|
165
188
|
/**
|
|
166
189
|
* Resolve the resource
|
|
190
|
+
* @param params - Optional runtime parameters passed to transport/semantic
|
|
167
191
|
*/
|
|
168
|
-
resolve(): Promise<Resource>;
|
|
192
|
+
resolve(params?: TransportParams): Promise<Resource>;
|
|
169
193
|
/**
|
|
170
194
|
* Deposit data to the resource
|
|
195
|
+
* @param data - Data to deposit
|
|
196
|
+
* @param params - Optional runtime parameters passed to transport/semantic
|
|
171
197
|
*/
|
|
172
|
-
deposit(data: unknown): Promise<void>;
|
|
198
|
+
deposit(data: unknown, params?: TransportParams): Promise<void>;
|
|
173
199
|
/**
|
|
174
200
|
* Check if resource exists
|
|
175
201
|
*/
|
|
@@ -206,11 +232,11 @@ declare class ARL2 implements ARL {
|
|
|
206
232
|
/**
|
|
207
233
|
* Resolve the resource
|
|
208
234
|
*/
|
|
209
|
-
resolve(): Promise<Resource>;
|
|
235
|
+
resolve(params?: TransportParams): Promise<Resource>;
|
|
210
236
|
/**
|
|
211
237
|
* Deposit data to the resource
|
|
212
238
|
*/
|
|
213
|
-
deposit(data: unknown): Promise<void>;
|
|
239
|
+
deposit(data: unknown, params?: TransportParams): Promise<void>;
|
|
214
240
|
/**
|
|
215
241
|
* Check if resource exists
|
|
216
242
|
*/
|
|
@@ -318,23 +344,67 @@ declare class SemanticError extends ARPError {
|
|
|
318
344
|
}
|
|
319
345
|
declare class FileTransportHandler implements TransportHandler {
|
|
320
346
|
readonly name = "file";
|
|
321
|
-
readonly capabilities: TransportCapabilities;
|
|
322
347
|
private resolvePath;
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
348
|
+
/**
|
|
349
|
+
* Get content from file or directory listing
|
|
350
|
+
*/
|
|
351
|
+
get(location: string, params?: TransportParams): Promise<TransportResult>;
|
|
352
|
+
/**
|
|
353
|
+
* Get file content
|
|
354
|
+
*/
|
|
355
|
+
private getFile;
|
|
356
|
+
/**
|
|
357
|
+
* Get directory listing
|
|
358
|
+
*/
|
|
359
|
+
private getDirectory;
|
|
360
|
+
/**
|
|
361
|
+
* List directory recursively
|
|
362
|
+
*/
|
|
363
|
+
private listRecursive;
|
|
364
|
+
/**
|
|
365
|
+
* Filter entries by glob-like pattern
|
|
366
|
+
* Supports simple patterns: *.json, *.txt, etc.
|
|
367
|
+
*/
|
|
368
|
+
private filterByPattern;
|
|
369
|
+
/**
|
|
370
|
+
* Set content to file
|
|
371
|
+
*/
|
|
372
|
+
set(location: string, content: Buffer, _params?: TransportParams): Promise<void>;
|
|
373
|
+
/**
|
|
374
|
+
* Check if file or directory exists
|
|
375
|
+
*/
|
|
327
376
|
exists(location: string): Promise<boolean>;
|
|
328
|
-
|
|
377
|
+
/**
|
|
378
|
+
* Delete file or directory
|
|
379
|
+
*/
|
|
329
380
|
delete(location: string): Promise<void>;
|
|
330
381
|
}
|
|
331
382
|
declare const fileTransport: FileTransportHandler;
|
|
332
383
|
declare class HttpTransportHandler implements TransportHandler {
|
|
333
384
|
readonly name: string;
|
|
334
385
|
private readonly protocol;
|
|
335
|
-
readonly capabilities: TransportCapabilities;
|
|
336
386
|
constructor(protocol?: "http" | "https");
|
|
337
|
-
|
|
387
|
+
/**
|
|
388
|
+
* Get content from HTTP URL
|
|
389
|
+
* Merges runtime params with URL query params
|
|
390
|
+
*/
|
|
391
|
+
get(location: string, params?: TransportParams): Promise<TransportResult>;
|
|
392
|
+
/**
|
|
393
|
+
* Build URL with merged params
|
|
394
|
+
*/
|
|
395
|
+
private buildUrl;
|
|
396
|
+
/**
|
|
397
|
+
* HTTP transport is read-only, set is not supported
|
|
398
|
+
*/
|
|
399
|
+
set(_location: string, _content: Buffer, _params?: TransportParams): Promise<void>;
|
|
400
|
+
/**
|
|
401
|
+
* Check if HTTP resource exists (HEAD request)
|
|
402
|
+
*/
|
|
403
|
+
exists(location: string): Promise<boolean>;
|
|
404
|
+
/**
|
|
405
|
+
* HTTP transport is read-only, delete is not supported
|
|
406
|
+
*/
|
|
407
|
+
delete(_location: string): Promise<void>;
|
|
338
408
|
}
|
|
339
409
|
declare const httpsTransport: HttpTransportHandler;
|
|
340
410
|
declare const httpTransport: HttpTransportHandler;
|
|
@@ -345,7 +415,7 @@ interface TextResource extends Resource<string> {
|
|
|
345
415
|
declare class TextSemanticHandler implements SemanticHandler<string> {
|
|
346
416
|
readonly name = "text";
|
|
347
417
|
resolve(transport: TransportHandler, location: string, context: SemanticContext): Promise<TextResource>;
|
|
348
|
-
deposit(transport: TransportHandler, location: string, data: string,
|
|
418
|
+
deposit(transport: TransportHandler, location: string, data: string, context: SemanticContext): Promise<void>;
|
|
349
419
|
exists(transport: TransportHandler, location: string, _context: SemanticContext): Promise<boolean>;
|
|
350
420
|
delete(transport: TransportHandler, location: string, _context: SemanticContext): Promise<void>;
|
|
351
421
|
}
|
|
@@ -361,10 +431,10 @@ type BinaryInput = Buffer | Uint8Array | ArrayBuffer | number[];
|
|
|
361
431
|
declare class BinarySemanticHandler implements SemanticHandler<Buffer> {
|
|
362
432
|
readonly name = "binary";
|
|
363
433
|
resolve(transport: TransportHandler, location: string, context: SemanticContext): Promise<BinaryResource>;
|
|
364
|
-
deposit(transport: TransportHandler, location: string, data: BinaryInput,
|
|
434
|
+
deposit(transport: TransportHandler, location: string, data: BinaryInput, context: SemanticContext): Promise<void>;
|
|
365
435
|
exists(transport: TransportHandler, location: string, _context: SemanticContext): Promise<boolean>;
|
|
366
436
|
delete(transport: TransportHandler, location: string, _context: SemanticContext): Promise<void>;
|
|
367
437
|
}
|
|
368
438
|
declare const binarySemantic: BinarySemanticHandler;
|
|
369
439
|
declare const VERSION: string;
|
|
370
|
-
export { textSemantic, httpsTransport, httpTransport, fileTransport, createARP, binarySemantic, VERSION, TransportHandler, TransportError,
|
|
440
|
+
export { textSemantic, httpsTransport, httpTransport, fileTransport, createARP, binarySemantic, VERSION, TransportResult, TransportParams, TransportHandler, TransportError, TextSemanticHandler, TextResource, SemanticHandler, SemanticError, SemanticContext, ResourceMeta, Resource, ParseError, HttpTransportHandler, FileTransportHandler, BinarySemanticHandler, BinaryResource, BinaryInput, ARPError, ARPConfig, ARP, ARL, ARI };
|
package/dist/index.js
CHANGED
|
@@ -45,25 +45,26 @@ class ARL {
|
|
|
45
45
|
this.location = location;
|
|
46
46
|
this.resolver = resolver;
|
|
47
47
|
}
|
|
48
|
-
createContext() {
|
|
48
|
+
createContext(params) {
|
|
49
49
|
return {
|
|
50
50
|
url: this.toString(),
|
|
51
51
|
semantic: this.semantic,
|
|
52
52
|
transport: this.transport,
|
|
53
53
|
location: this.location,
|
|
54
|
-
timestamp: new Date
|
|
54
|
+
timestamp: new Date,
|
|
55
|
+
params
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
|
-
async resolve() {
|
|
58
|
+
async resolve(params) {
|
|
58
59
|
const transport = this.resolver.getTransportHandler(this.transport);
|
|
59
60
|
const semantic = this.resolver.getSemanticHandler(this.semantic);
|
|
60
|
-
const context = this.createContext();
|
|
61
|
+
const context = this.createContext(params);
|
|
61
62
|
return semantic.resolve(transport, this.location, context);
|
|
62
63
|
}
|
|
63
|
-
async deposit(data) {
|
|
64
|
+
async deposit(data, params) {
|
|
64
65
|
const transport = this.resolver.getTransportHandler(this.transport);
|
|
65
66
|
const semantic = this.resolver.getSemanticHandler(this.semantic);
|
|
66
|
-
const context = this.createContext();
|
|
67
|
+
const context = this.createContext(params);
|
|
67
68
|
if (!semantic.deposit) {
|
|
68
69
|
throw new SemanticError(`Semantic "${semantic.name}" does not support deposit operation`, this.semantic);
|
|
69
70
|
}
|
|
@@ -76,15 +77,7 @@ class ARL {
|
|
|
76
77
|
if (semantic.exists) {
|
|
77
78
|
return semantic.exists(transport, this.location, context);
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
-
return transport.exists(this.location);
|
|
81
|
-
}
|
|
82
|
-
try {
|
|
83
|
-
await transport.read(this.location);
|
|
84
|
-
return true;
|
|
85
|
-
} catch {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
80
|
+
return transport.exists(this.location);
|
|
88
81
|
}
|
|
89
82
|
async delete() {
|
|
90
83
|
const transport = this.resolver.getTransportHandler(this.transport);
|
|
@@ -93,9 +86,6 @@ class ARL {
|
|
|
93
86
|
if (semantic.delete) {
|
|
94
87
|
return semantic.delete(transport, this.location, context);
|
|
95
88
|
}
|
|
96
|
-
if (!transport.delete) {
|
|
97
|
-
throw new SemanticError(`Neither semantic "${semantic.name}" nor transport "${transport.name}" supports delete operation`, this.semantic);
|
|
98
|
-
}
|
|
99
89
|
await transport.delete(this.location);
|
|
100
90
|
}
|
|
101
91
|
toString() {
|
|
@@ -104,61 +94,92 @@ class ARL {
|
|
|
104
94
|
}
|
|
105
95
|
|
|
106
96
|
// src/transport/file.ts
|
|
107
|
-
import { readFile, writeFile, readdir, mkdir, rm, access, stat
|
|
108
|
-
import { resolve, dirname } from "node:path";
|
|
97
|
+
import { readFile, writeFile, readdir, mkdir, rm, access, stat } from "node:fs/promises";
|
|
98
|
+
import { resolve, dirname, join } from "node:path";
|
|
109
99
|
class FileTransportHandler {
|
|
110
100
|
name = "file";
|
|
111
|
-
capabilities = {
|
|
112
|
-
canRead: true,
|
|
113
|
-
canWrite: true,
|
|
114
|
-
canList: true,
|
|
115
|
-
canDelete: true,
|
|
116
|
-
canStat: true
|
|
117
|
-
};
|
|
118
101
|
resolvePath(location) {
|
|
119
102
|
return resolve(process.cwd(), location);
|
|
120
103
|
}
|
|
121
|
-
async
|
|
104
|
+
async get(location, params) {
|
|
122
105
|
const filePath = this.resolvePath(location);
|
|
123
106
|
try {
|
|
124
|
-
|
|
107
|
+
const stats = await stat(filePath);
|
|
108
|
+
if (stats.isDirectory()) {
|
|
109
|
+
return this.getDirectory(filePath, stats, params);
|
|
110
|
+
} else {
|
|
111
|
+
return this.getFile(filePath, stats);
|
|
112
|
+
}
|
|
125
113
|
} catch (error) {
|
|
126
114
|
const err = error;
|
|
127
|
-
throw new TransportError(`File
|
|
115
|
+
throw new TransportError(`File get error: ${err.code} - ${filePath}`, this.name, {
|
|
128
116
|
cause: err
|
|
129
117
|
});
|
|
130
118
|
}
|
|
131
119
|
}
|
|
132
|
-
async
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
120
|
+
async getFile(filePath, stats) {
|
|
121
|
+
const content = await readFile(filePath);
|
|
122
|
+
return {
|
|
123
|
+
content,
|
|
124
|
+
metadata: {
|
|
125
|
+
type: "file",
|
|
126
|
+
size: Number(stats.size),
|
|
127
|
+
modifiedAt: stats.mtime
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
async getDirectory(dirPath, stats, params) {
|
|
132
|
+
const recursive = params?.recursive === "true";
|
|
133
|
+
const pattern = params?.pattern;
|
|
134
|
+
let entries;
|
|
135
|
+
if (recursive) {
|
|
136
|
+
entries = await this.listRecursive(dirPath, dirPath);
|
|
137
|
+
} else {
|
|
138
|
+
entries = await readdir(dirPath);
|
|
139
|
+
}
|
|
140
|
+
if (pattern) {
|
|
141
|
+
entries = this.filterByPattern(entries, pattern);
|
|
142
142
|
}
|
|
143
|
+
const content = Buffer.from(JSON.stringify(entries));
|
|
144
|
+
return {
|
|
145
|
+
content,
|
|
146
|
+
metadata: {
|
|
147
|
+
type: "directory",
|
|
148
|
+
modifiedAt: stats.mtime
|
|
149
|
+
}
|
|
150
|
+
};
|
|
143
151
|
}
|
|
144
|
-
async
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
async listRecursive(basePath, currentPath) {
|
|
153
|
+
const entries = await readdir(currentPath, { withFileTypes: true });
|
|
154
|
+
const results = [];
|
|
155
|
+
for (const entry of entries) {
|
|
156
|
+
const fullPath = join(currentPath, entry.name);
|
|
157
|
+
const relativePath = fullPath.substring(basePath.length + 1);
|
|
158
|
+
if (entry.isDirectory()) {
|
|
159
|
+
const subEntries = await this.listRecursive(basePath, fullPath);
|
|
160
|
+
results.push(...subEntries);
|
|
161
|
+
} else {
|
|
162
|
+
results.push(relativePath);
|
|
163
|
+
}
|
|
153
164
|
}
|
|
165
|
+
return results;
|
|
154
166
|
}
|
|
155
|
-
|
|
156
|
-
const
|
|
167
|
+
filterByPattern(entries, pattern) {
|
|
168
|
+
const regexPattern = pattern.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\?/g, ".");
|
|
169
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
170
|
+
return entries.filter((entry) => {
|
|
171
|
+
const filename = entry.split("/").pop() || entry;
|
|
172
|
+
return regex.test(filename);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
async set(location, content, _params) {
|
|
176
|
+
const filePath = this.resolvePath(location);
|
|
157
177
|
try {
|
|
158
|
-
await mkdir(
|
|
178
|
+
await mkdir(dirname(filePath), { recursive: true });
|
|
179
|
+
await writeFile(filePath, content);
|
|
159
180
|
} catch (error) {
|
|
160
181
|
const err = error;
|
|
161
|
-
throw new TransportError(`
|
|
182
|
+
throw new TransportError(`File set error: ${err.code} - ${filePath}`, this.name, {
|
|
162
183
|
cause: err
|
|
163
184
|
});
|
|
164
185
|
}
|
|
@@ -172,28 +193,15 @@ class FileTransportHandler {
|
|
|
172
193
|
return false;
|
|
173
194
|
}
|
|
174
195
|
}
|
|
175
|
-
async stat(location) {
|
|
176
|
-
const filePath = this.resolvePath(location);
|
|
177
|
-
try {
|
|
178
|
-
const stats = await fsStat(filePath);
|
|
179
|
-
return {
|
|
180
|
-
size: stats.size,
|
|
181
|
-
modifiedAt: stats.mtime,
|
|
182
|
-
isDirectory: stats.isDirectory()
|
|
183
|
-
};
|
|
184
|
-
} catch (error) {
|
|
185
|
-
const err = error;
|
|
186
|
-
throw new TransportError(`File stat error: ${err.code} - ${filePath}`, this.name, {
|
|
187
|
-
cause: err
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
196
|
async delete(location) {
|
|
192
197
|
const filePath = this.resolvePath(location);
|
|
193
198
|
try {
|
|
194
199
|
await rm(filePath, { recursive: true });
|
|
195
200
|
} catch (error) {
|
|
196
201
|
const err = error;
|
|
202
|
+
if (err.code === "ENOENT") {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
197
205
|
throw new TransportError(`File delete error: ${err.code} - ${filePath}`, this.name, {
|
|
198
206
|
cause: err
|
|
199
207
|
});
|
|
@@ -205,26 +213,31 @@ var fileTransport = new FileTransportHandler;
|
|
|
205
213
|
class HttpTransportHandler {
|
|
206
214
|
name;
|
|
207
215
|
protocol;
|
|
208
|
-
capabilities = {
|
|
209
|
-
canRead: true,
|
|
210
|
-
canWrite: false,
|
|
211
|
-
canList: false,
|
|
212
|
-
canDelete: false,
|
|
213
|
-
canStat: false
|
|
214
|
-
};
|
|
215
216
|
constructor(protocol = "https") {
|
|
216
217
|
this.protocol = protocol;
|
|
217
218
|
this.name = protocol;
|
|
218
219
|
}
|
|
219
|
-
async
|
|
220
|
-
const url =
|
|
220
|
+
async get(location, params) {
|
|
221
|
+
const url = this.buildUrl(location, params);
|
|
221
222
|
try {
|
|
222
223
|
const response = await fetch(url);
|
|
223
224
|
if (!response.ok) {
|
|
224
225
|
throw new TransportError(`HTTP ${response.status}: ${response.statusText} - ${url}`, this.name);
|
|
225
226
|
}
|
|
226
227
|
const arrayBuffer = await response.arrayBuffer();
|
|
227
|
-
|
|
228
|
+
const content = Buffer.from(arrayBuffer);
|
|
229
|
+
const contentType = response.headers.get("content-type");
|
|
230
|
+
const contentLength = response.headers.get("content-length");
|
|
231
|
+
const lastModified = response.headers.get("last-modified");
|
|
232
|
+
return {
|
|
233
|
+
content,
|
|
234
|
+
metadata: {
|
|
235
|
+
type: "file",
|
|
236
|
+
size: contentLength ? parseInt(contentLength, 10) : content.length,
|
|
237
|
+
modifiedAt: lastModified ? new Date(lastModified) : undefined,
|
|
238
|
+
contentType
|
|
239
|
+
}
|
|
240
|
+
};
|
|
228
241
|
} catch (error) {
|
|
229
242
|
if (error instanceof TransportError) {
|
|
230
243
|
throw error;
|
|
@@ -234,6 +247,30 @@ class HttpTransportHandler {
|
|
|
234
247
|
});
|
|
235
248
|
}
|
|
236
249
|
}
|
|
250
|
+
buildUrl(location, params) {
|
|
251
|
+
const url = new URL(`${this.protocol}://${location}`);
|
|
252
|
+
if (params) {
|
|
253
|
+
for (const [key, value] of Object.entries(params)) {
|
|
254
|
+
url.searchParams.set(key, value);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return url.toString();
|
|
258
|
+
}
|
|
259
|
+
async set(_location, _content, _params) {
|
|
260
|
+
throw new TransportError("HTTP transport is read-only, set not supported", this.name);
|
|
261
|
+
}
|
|
262
|
+
async exists(location) {
|
|
263
|
+
const url = `${this.protocol}://${location}`;
|
|
264
|
+
try {
|
|
265
|
+
const response = await fetch(url, { method: "HEAD" });
|
|
266
|
+
return response.ok;
|
|
267
|
+
} catch {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
async delete(_location) {
|
|
272
|
+
throw new TransportError("HTTP transport is read-only, delete not supported", this.name);
|
|
273
|
+
}
|
|
237
274
|
}
|
|
238
275
|
var httpsTransport = new HttpTransportHandler("https");
|
|
239
276
|
var httpTransport = new HttpTransportHandler("http");
|
|
@@ -241,17 +278,36 @@ var httpTransport = new HttpTransportHandler("http");
|
|
|
241
278
|
class TextSemanticHandler {
|
|
242
279
|
name = "text";
|
|
243
280
|
async resolve(transport, location, context) {
|
|
244
|
-
const
|
|
245
|
-
|
|
281
|
+
const result = await transport.get(location, context.params);
|
|
282
|
+
if (result.metadata?.type === "directory") {
|
|
283
|
+
const meta2 = {
|
|
284
|
+
url: context.url,
|
|
285
|
+
semantic: context.semantic,
|
|
286
|
+
transport: context.transport,
|
|
287
|
+
location: context.location,
|
|
288
|
+
size: result.content.length,
|
|
289
|
+
encoding: "utf-8",
|
|
290
|
+
mimeType: "application/json",
|
|
291
|
+
resolvedAt: context.timestamp.toISOString(),
|
|
292
|
+
type: "directory"
|
|
293
|
+
};
|
|
294
|
+
return {
|
|
295
|
+
type: "text",
|
|
296
|
+
content: result.content.toString("utf-8"),
|
|
297
|
+
meta: meta2
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
const text = result.content.toString("utf-8");
|
|
246
301
|
const meta = {
|
|
247
302
|
url: context.url,
|
|
248
303
|
semantic: context.semantic,
|
|
249
304
|
transport: context.transport,
|
|
250
305
|
location: context.location,
|
|
251
|
-
size:
|
|
306
|
+
size: result.metadata?.size ?? result.content.length,
|
|
252
307
|
encoding: "utf-8",
|
|
253
308
|
mimeType: "text/plain",
|
|
254
|
-
resolvedAt: context.timestamp.toISOString()
|
|
309
|
+
resolvedAt: context.timestamp.toISOString(),
|
|
310
|
+
type: "file"
|
|
255
311
|
};
|
|
256
312
|
return {
|
|
257
313
|
type: "text",
|
|
@@ -259,29 +315,23 @@ class TextSemanticHandler {
|
|
|
259
315
|
meta
|
|
260
316
|
};
|
|
261
317
|
}
|
|
262
|
-
async deposit(transport, location, data,
|
|
263
|
-
if (!transport.write) {
|
|
264
|
-
throw new SemanticError(`Transport "${transport.name}" does not support write operation`, this.name);
|
|
265
|
-
}
|
|
318
|
+
async deposit(transport, location, data, context) {
|
|
266
319
|
const buffer = Buffer.from(data, "utf-8");
|
|
267
|
-
await transport.write(location, buffer);
|
|
268
|
-
}
|
|
269
|
-
async exists(transport, location, _context) {
|
|
270
|
-
if (transport.exists) {
|
|
271
|
-
return transport.exists(location);
|
|
272
|
-
}
|
|
273
320
|
try {
|
|
274
|
-
await transport.
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
return false;
|
|
321
|
+
await transport.set(location, buffer, context.params);
|
|
322
|
+
} catch (error) {
|
|
323
|
+
throw new SemanticError(`Failed to deposit text to "${location}": ${error.message}`, this.name, { cause: error });
|
|
278
324
|
}
|
|
279
325
|
}
|
|
326
|
+
async exists(transport, location, _context) {
|
|
327
|
+
return transport.exists(location);
|
|
328
|
+
}
|
|
280
329
|
async delete(transport, location, _context) {
|
|
281
|
-
|
|
282
|
-
|
|
330
|
+
try {
|
|
331
|
+
await transport.delete(location);
|
|
332
|
+
} catch (error) {
|
|
333
|
+
throw new SemanticError(`Failed to delete "${location}": ${error.message}`, this.name, { cause: error });
|
|
283
334
|
}
|
|
284
|
-
await transport.delete(location);
|
|
285
335
|
}
|
|
286
336
|
}
|
|
287
337
|
var textSemantic = new TextSemanticHandler;
|
|
@@ -305,44 +355,39 @@ function toBuffer(data) {
|
|
|
305
355
|
class BinarySemanticHandler {
|
|
306
356
|
name = "binary";
|
|
307
357
|
async resolve(transport, location, context) {
|
|
308
|
-
const
|
|
358
|
+
const result = await transport.get(location, context.params);
|
|
309
359
|
const meta = {
|
|
310
360
|
url: context.url,
|
|
311
361
|
semantic: context.semantic,
|
|
312
362
|
transport: context.transport,
|
|
313
363
|
location: context.location,
|
|
314
|
-
size:
|
|
315
|
-
resolvedAt: context.timestamp.toISOString()
|
|
364
|
+
size: result.metadata?.size ?? result.content.length,
|
|
365
|
+
resolvedAt: context.timestamp.toISOString(),
|
|
366
|
+
type: result.metadata?.type
|
|
316
367
|
};
|
|
317
368
|
return {
|
|
318
369
|
type: "binary",
|
|
319
|
-
content:
|
|
370
|
+
content: result.content,
|
|
320
371
|
meta
|
|
321
372
|
};
|
|
322
373
|
}
|
|
323
|
-
async deposit(transport, location, data,
|
|
324
|
-
if (!transport.write) {
|
|
325
|
-
throw new SemanticError(`Transport "${transport.name}" does not support write operation`, this.name);
|
|
326
|
-
}
|
|
374
|
+
async deposit(transport, location, data, context) {
|
|
327
375
|
const buffer = toBuffer(data);
|
|
328
|
-
await transport.write(location, buffer);
|
|
329
|
-
}
|
|
330
|
-
async exists(transport, location, _context) {
|
|
331
|
-
if (transport.exists) {
|
|
332
|
-
return transport.exists(location);
|
|
333
|
-
}
|
|
334
376
|
try {
|
|
335
|
-
await transport.
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
return false;
|
|
377
|
+
await transport.set(location, buffer, context.params);
|
|
378
|
+
} catch (error) {
|
|
379
|
+
throw new SemanticError(`Failed to deposit binary to "${location}": ${error.message}`, this.name, { cause: error });
|
|
339
380
|
}
|
|
340
381
|
}
|
|
382
|
+
async exists(transport, location, _context) {
|
|
383
|
+
return transport.exists(location);
|
|
384
|
+
}
|
|
341
385
|
async delete(transport, location, _context) {
|
|
342
|
-
|
|
343
|
-
|
|
386
|
+
try {
|
|
387
|
+
await transport.delete(location);
|
|
388
|
+
} catch (error) {
|
|
389
|
+
throw new SemanticError(`Failed to delete "${location}": ${error.message}`, this.name, { cause: error });
|
|
344
390
|
}
|
|
345
|
-
await transport.delete(location);
|
|
346
391
|
}
|
|
347
392
|
}
|
|
348
393
|
var binarySemantic = new BinarySemanticHandler;
|
|
@@ -428,7 +473,7 @@ function createARP(config) {
|
|
|
428
473
|
}
|
|
429
474
|
|
|
430
475
|
// src/index.ts
|
|
431
|
-
var VERSION = "1.
|
|
476
|
+
var VERSION = "1.3.0";
|
|
432
477
|
export {
|
|
433
478
|
textSemantic,
|
|
434
479
|
httpsTransport,
|
|
@@ -448,4 +493,4 @@ export {
|
|
|
448
493
|
ARP
|
|
449
494
|
};
|
|
450
495
|
|
|
451
|
-
//# debugId=
|
|
496
|
+
//# debugId=632508D18522AB2D64756E2164756E21
|
package/dist/index.js.map
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
"sources": ["../src/errors.ts", "../src/ARL.ts", "../src/transport/file.ts", "../src/transport/http.ts", "../src/semantic/text.ts", "../src/semantic/binary.ts", "../src/ARP.ts", "../src/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * ARP Error Types\n */\n\n/**\n * Base error class for all ARP errors\n */\nexport class ARPError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ARPError\";\n }\n}\n\n/**\n * Error thrown when ARP URL parsing fails\n */\nexport class ParseError extends ARPError {\n constructor(\n message: string,\n public readonly url?: string\n ) {\n super(message);\n this.name = \"ParseError\";\n }\n}\n\n/**\n * Error thrown when transport layer fails\n */\nexport class TransportError extends ARPError {\n constructor(\n message: string,\n public readonly transport?: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = \"TransportError\";\n }\n}\n\n/**\n * Error thrown when semantic layer fails\n */\nexport class SemanticError extends ARPError {\n constructor(\n message: string,\n public readonly semantic?: string,\n options?: ErrorOptions\n ) {\n super(message, options);\n this.name = \"SemanticError\";\n }\n}\n",
|
|
6
|
-
"/**\n * ARL - Agent Resource Locator Implementation\n */\n\nimport type { ARL as IARL } from \"./types.js\";\nimport type { Resource, SemanticContext, SemanticHandler } from \"./semantic/types.js\";\nimport type { TransportHandler } from \"./transport/types.js\";\nimport { SemanticError } from \"./errors.js\";\n\n/**\n * Handler resolver interface (implemented by ARP instance)\n */\nexport interface HandlerResolver {\n getTransportHandler(name: string): TransportHandler;\n getSemanticHandler(name: string): SemanticHandler;\n}\n\n/**\n * ARL Implementation\n */\nexport class ARL implements IARL {\n readonly semantic: string;\n readonly transport: string;\n readonly location: string;\n\n private readonly resolver: HandlerResolver;\n\n constructor(semantic: string, transport: string, location: string, resolver: HandlerResolver) {\n this.semantic = semantic;\n this.transport = transport;\n this.location = location;\n this.resolver = resolver;\n }\n\n /**\n * Create semantic context\n */\n private createContext(): SemanticContext {\n return {\n url: this.toString(),\n semantic: this.semantic,\n transport: this.transport,\n location: this.location,\n timestamp: new Date(),\n };\n }\n\n /**\n * Resolve the resource\n */\n async resolve(): Promise<Resource> {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext();\n\n return semantic.resolve(transport, this.location, context);\n }\n\n /**\n * Deposit data to the resource\n */\n async deposit(data: unknown): Promise<void> {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext();\n\n if (!semantic.deposit) {\n throw new SemanticError(\n `Semantic \"${semantic.name}\" does not support deposit operation`,\n this.semantic\n );\n }\n\n await semantic.deposit(transport, this.location, data, context);\n }\n\n /**\n * Check if resource exists\n */\n async exists(): Promise<boolean> {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext();\n\n if (semantic.exists) {\n return semantic.exists(transport, this.location, context);\n }\n\n // Fallback to transport exists\n
|
|
7
|
-
"/**\n * File Transport Handler\n * Provides I/O primitives for local filesystem\n */\n\nimport { readFile, writeFile, readdir, mkdir, rm, access, stat
|
|
8
|
-
"/**\n * HTTP/HTTPS Transport Handler\n * Provides read-only I/O primitives for HTTP resources\n */\n\nimport { TransportError } from \"../errors.js\";\nimport type { TransportHandler,
|
|
9
|
-
"/**\n * Text Semantic Handler\n * Handles plain text resources\n */\n\nimport { SemanticError } from \"../errors.js\";\nimport type { TransportHandler } from \"../transport/types.js\";\nimport type { Resource, SemanticHandler, SemanticContext, ResourceMeta } from \"./types.js\";\n\nexport interface TextResource extends Resource<string> {\n type: \"text\";\n content: string;\n}\n\nexport class TextSemanticHandler implements SemanticHandler<string> {\n readonly name = \"text\";\n\n async resolve(\n transport: TransportHandler,\n location: string,\n context: SemanticContext\n ): Promise<TextResource> {\n const
|
|
10
|
-
"/**\n * Binary Semantic Handler\n * Handles raw binary resources without any transformation\n */\n\nimport { SemanticError } from \"../errors.js\";\nimport type { TransportHandler } from \"../transport/types.js\";\nimport type { Resource, SemanticHandler, SemanticContext, ResourceMeta } from \"./types.js\";\n\nexport interface BinaryResource extends Resource<Buffer> {\n type: \"binary\";\n content: Buffer;\n}\n\n/**\n * Supported binary input types for deposit\n */\nexport type BinaryInput = Buffer | Uint8Array | ArrayBuffer | number[];\n\n/**\n * Convert various binary input types to Buffer\n */\nfunction toBuffer(data: BinaryInput): Buffer {\n if (Buffer.isBuffer(data)) {\n return data;\n }\n if (data instanceof Uint8Array) {\n return Buffer.from(data);\n }\n if (data instanceof ArrayBuffer) {\n return Buffer.from(data);\n }\n if (Array.isArray(data)) {\n return Buffer.from(data);\n }\n throw new SemanticError(`Unsupported binary input type`, \"binary\");\n}\n\nexport class BinarySemanticHandler implements SemanticHandler<Buffer> {\n readonly name = \"binary\";\n\n async resolve(\n transport: TransportHandler,\n location: string,\n context: SemanticContext\n ): Promise<BinaryResource> {\n const
|
|
6
|
+
"/**\n * ARL - Agent Resource Locator Implementation\n */\n\nimport type { ARL as IARL } from \"./types.js\";\nimport type { Resource, SemanticContext, SemanticHandler } from \"./semantic/types.js\";\nimport type { TransportHandler, TransportParams } from \"./transport/types.js\";\nimport { SemanticError } from \"./errors.js\";\n\n/**\n * Handler resolver interface (implemented by ARP instance)\n */\nexport interface HandlerResolver {\n getTransportHandler(name: string): TransportHandler;\n getSemanticHandler(name: string): SemanticHandler;\n}\n\n/**\n * ARL Implementation\n */\nexport class ARL implements IARL {\n readonly semantic: string;\n readonly transport: string;\n readonly location: string;\n\n private readonly resolver: HandlerResolver;\n\n constructor(semantic: string, transport: string, location: string, resolver: HandlerResolver) {\n this.semantic = semantic;\n this.transport = transport;\n this.location = location;\n this.resolver = resolver;\n }\n\n /**\n * Create semantic context\n */\n private createContext(params?: TransportParams): SemanticContext {\n return {\n url: this.toString(),\n semantic: this.semantic,\n transport: this.transport,\n location: this.location,\n timestamp: new Date(),\n params,\n };\n }\n\n /**\n * Resolve the resource\n */\n async resolve(params?: TransportParams): Promise<Resource> {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext(params);\n\n return semantic.resolve(transport, this.location, context);\n }\n\n /**\n * Deposit data to the resource\n */\n async deposit(data: unknown, params?: TransportParams): Promise<void> {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext(params);\n\n if (!semantic.deposit) {\n throw new SemanticError(\n `Semantic \"${semantic.name}\" does not support deposit operation`,\n this.semantic\n );\n }\n\n await semantic.deposit(transport, this.location, data, context);\n }\n\n /**\n * Check if resource exists\n */\n async exists(): Promise<boolean> {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext();\n\n if (semantic.exists) {\n return semantic.exists(transport, this.location, context);\n }\n\n // Fallback to transport exists\n return transport.exists(this.location);\n }\n\n /**\n * Delete the resource\n */\n async delete(): Promise<void> {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext();\n\n if (semantic.delete) {\n return semantic.delete(transport, this.location, context);\n }\n\n // Fallback to transport delete\n await transport.delete(this.location);\n }\n\n /**\n * Convert to ARP URL string\n */\n toString(): string {\n return `arp:${this.semantic}:${this.transport}://${this.location}`;\n }\n}\n",
|
|
7
|
+
"/**\n * File Transport Handler\n * Provides I/O primitives for local filesystem\n *\n * Supported params:\n * - recursive: \"true\" - list directories recursively\n * - pattern: glob pattern - filter files by pattern (e.g., \"*.json\")\n */\n\nimport { readFile, writeFile, readdir, mkdir, rm, access, stat } from \"node:fs/promises\";\nimport { resolve, dirname, join } from \"node:path\";\nimport { TransportError } from \"../errors.js\";\nimport type { TransportHandler, TransportResult, TransportParams } from \"./types.js\";\n\nexport class FileTransportHandler implements TransportHandler {\n readonly name = \"file\";\n\n private resolvePath(location: string): string {\n return resolve(process.cwd(), location);\n }\n\n /**\n * Get content from file or directory listing\n */\n async get(location: string, params?: TransportParams): Promise<TransportResult> {\n const filePath = this.resolvePath(location);\n\n try {\n const stats = await stat(filePath);\n\n if (stats.isDirectory()) {\n return this.getDirectory(filePath, stats, params);\n } else {\n return this.getFile(filePath, stats);\n }\n } catch (error) {\n const err = error as Error & { code?: string };\n throw new TransportError(`File get error: ${err.code} - ${filePath}`, this.name, {\n cause: err,\n });\n }\n }\n\n /**\n * Get file content\n */\n private async getFile(\n filePath: string,\n stats: Awaited<ReturnType<typeof stat>>\n ): Promise<TransportResult> {\n const content = await readFile(filePath);\n return {\n content,\n metadata: {\n type: \"file\",\n size: Number(stats.size),\n modifiedAt: stats.mtime,\n },\n };\n }\n\n /**\n * Get directory listing\n */\n private async getDirectory(\n dirPath: string,\n stats: Awaited<ReturnType<typeof stat>>,\n params?: TransportParams\n ): Promise<TransportResult> {\n const recursive = params?.recursive === \"true\";\n const pattern = params?.pattern;\n\n let entries: string[];\n\n if (recursive) {\n entries = await this.listRecursive(dirPath, dirPath);\n } else {\n entries = await readdir(dirPath);\n }\n\n // Filter by pattern if provided\n if (pattern) {\n entries = this.filterByPattern(entries, pattern);\n }\n\n // Return as JSON array\n const content = Buffer.from(JSON.stringify(entries));\n return {\n content,\n metadata: {\n type: \"directory\",\n modifiedAt: stats.mtime,\n },\n };\n }\n\n /**\n * List directory recursively\n */\n private async listRecursive(basePath: string, currentPath: string): Promise<string[]> {\n const entries = await readdir(currentPath, { withFileTypes: true });\n const results: string[] = [];\n\n for (const entry of entries) {\n const fullPath = join(currentPath, entry.name);\n const relativePath = fullPath.substring(basePath.length + 1);\n\n if (entry.isDirectory()) {\n const subEntries = await this.listRecursive(basePath, fullPath);\n results.push(...subEntries);\n } else {\n results.push(relativePath);\n }\n }\n\n return results;\n }\n\n /**\n * Filter entries by glob-like pattern\n * Supports simple patterns: *.json, *.txt, etc.\n */\n private filterByPattern(entries: string[], pattern: string): string[] {\n // Convert simple glob to regex\n const regexPattern = pattern.replace(/\\./g, \"\\\\.\").replace(/\\*/g, \".*\").replace(/\\?/g, \".\");\n const regex = new RegExp(`^${regexPattern}$`);\n\n return entries.filter((entry) => {\n // Match against filename only (last part of path)\n const filename = entry.split(\"/\").pop() || entry;\n return regex.test(filename);\n });\n }\n\n /**\n * Set content to file\n */\n async set(location: string, content: Buffer, _params?: TransportParams): Promise<void> {\n const filePath = this.resolvePath(location);\n\n try {\n // Ensure directory exists\n await mkdir(dirname(filePath), { recursive: true });\n await writeFile(filePath, content);\n } catch (error) {\n const err = error as Error & { code?: string };\n throw new TransportError(`File set error: ${err.code} - ${filePath}`, this.name, {\n cause: err,\n });\n }\n }\n\n /**\n * Check if file or directory exists\n */\n async exists(location: string): Promise<boolean> {\n const filePath = this.resolvePath(location);\n\n try {\n await access(filePath);\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Delete file or directory\n */\n async delete(location: string): Promise<void> {\n const filePath = this.resolvePath(location);\n\n try {\n await rm(filePath, { recursive: true });\n } catch (error) {\n const err = error as Error & { code?: string };\n // Ignore if already deleted\n if (err.code === \"ENOENT\") {\n return;\n }\n throw new TransportError(`File delete error: ${err.code} - ${filePath}`, this.name, {\n cause: err,\n });\n }\n }\n}\n\nexport const fileTransport: FileTransportHandler = new FileTransportHandler();\n",
|
|
8
|
+
"/**\n * HTTP/HTTPS Transport Handler\n * Provides read-only I/O primitives for HTTP resources\n *\n * Location format: hostname/path?query\n * Runtime params are merged with URL query params (runtime params override)\n */\n\nimport { TransportError } from \"../errors.js\";\nimport type { TransportHandler, TransportResult, TransportParams } from \"./types.js\";\n\nexport class HttpTransportHandler implements TransportHandler {\n readonly name: string;\n private readonly protocol: \"http\" | \"https\";\n\n constructor(protocol: \"http\" | \"https\" = \"https\") {\n this.protocol = protocol;\n this.name = protocol;\n }\n\n /**\n * Get content from HTTP URL\n * Merges runtime params with URL query params\n */\n async get(location: string, params?: TransportParams): Promise<TransportResult> {\n const url = this.buildUrl(location, params);\n\n try {\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new TransportError(\n `HTTP ${response.status}: ${response.statusText} - ${url}`,\n this.name\n );\n }\n\n const arrayBuffer = await response.arrayBuffer();\n const content = Buffer.from(arrayBuffer);\n\n // Extract metadata from headers\n const contentType = response.headers.get(\"content-type\");\n const contentLength = response.headers.get(\"content-length\");\n const lastModified = response.headers.get(\"last-modified\");\n\n return {\n content,\n metadata: {\n type: \"file\",\n size: contentLength ? parseInt(contentLength, 10) : content.length,\n modifiedAt: lastModified ? new Date(lastModified) : undefined,\n contentType,\n },\n };\n } catch (error) {\n if (error instanceof TransportError) {\n throw error;\n }\n throw new TransportError(`Network error: ${url}`, this.name, {\n cause: error as Error,\n });\n }\n }\n\n /**\n * Build URL with merged params\n */\n private buildUrl(location: string, params?: TransportParams): string {\n const url = new URL(`${this.protocol}://${location}`);\n\n // Merge runtime params (override existing)\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n url.searchParams.set(key, value);\n }\n }\n\n return url.toString();\n }\n\n /**\n * HTTP transport is read-only, set is not supported\n */\n async set(_location: string, _content: Buffer, _params?: TransportParams): Promise<void> {\n throw new TransportError(\"HTTP transport is read-only, set not supported\", this.name);\n }\n\n /**\n * Check if HTTP resource exists (HEAD request)\n */\n async exists(location: string): Promise<boolean> {\n const url = `${this.protocol}://${location}`;\n\n try {\n const response = await fetch(url, { method: \"HEAD\" });\n return response.ok;\n } catch {\n return false;\n }\n }\n\n /**\n * HTTP transport is read-only, delete is not supported\n */\n async delete(_location: string): Promise<void> {\n throw new TransportError(\"HTTP transport is read-only, delete not supported\", this.name);\n }\n}\n\nexport const httpsTransport: HttpTransportHandler = new HttpTransportHandler(\"https\");\nexport const httpTransport: HttpTransportHandler = new HttpTransportHandler(\"http\");\n",
|
|
9
|
+
"/**\n * Text Semantic Handler\n * Handles plain text resources\n */\n\nimport { SemanticError } from \"../errors.js\";\nimport type { TransportHandler } from \"../transport/types.js\";\nimport type { Resource, SemanticHandler, SemanticContext, ResourceMeta } from \"./types.js\";\n\nexport interface TextResource extends Resource<string> {\n type: \"text\";\n content: string;\n}\n\nexport class TextSemanticHandler implements SemanticHandler<string> {\n readonly name = \"text\";\n\n async resolve(\n transport: TransportHandler,\n location: string,\n context: SemanticContext\n ): Promise<TextResource> {\n const result = await transport.get(location, context.params);\n\n // Handle directory listing\n if (result.metadata?.type === \"directory\") {\n // Return as JSON string for text semantic\n const meta: ResourceMeta = {\n url: context.url,\n semantic: context.semantic,\n transport: context.transport,\n location: context.location,\n size: result.content.length,\n encoding: \"utf-8\",\n mimeType: \"application/json\",\n resolvedAt: context.timestamp.toISOString(),\n type: \"directory\",\n };\n\n return {\n type: \"text\",\n content: result.content.toString(\"utf-8\"),\n meta,\n };\n }\n\n // Handle file content\n const text = result.content.toString(\"utf-8\");\n const meta: ResourceMeta = {\n url: context.url,\n semantic: context.semantic,\n transport: context.transport,\n location: context.location,\n size: result.metadata?.size ?? result.content.length,\n encoding: \"utf-8\",\n mimeType: \"text/plain\",\n resolvedAt: context.timestamp.toISOString(),\n type: \"file\",\n };\n\n return {\n type: \"text\",\n content: text,\n meta,\n };\n }\n\n async deposit(\n transport: TransportHandler,\n location: string,\n data: string,\n context: SemanticContext\n ): Promise<void> {\n const buffer = Buffer.from(data, \"utf-8\");\n\n try {\n await transport.set(location, buffer, context.params);\n } catch (error) {\n throw new SemanticError(\n `Failed to deposit text to \"${location}\": ${(error as Error).message}`,\n this.name,\n { cause: error as Error }\n );\n }\n }\n\n async exists(\n transport: TransportHandler,\n location: string,\n _context: SemanticContext\n ): Promise<boolean> {\n return transport.exists(location);\n }\n\n async delete(\n transport: TransportHandler,\n location: string,\n _context: SemanticContext\n ): Promise<void> {\n try {\n await transport.delete(location);\n } catch (error) {\n throw new SemanticError(\n `Failed to delete \"${location}\": ${(error as Error).message}`,\n this.name,\n { cause: error as Error }\n );\n }\n }\n}\n\nexport const textSemantic: TextSemanticHandler = new TextSemanticHandler();\n",
|
|
10
|
+
"/**\n * Binary Semantic Handler\n * Handles raw binary resources without any transformation\n */\n\nimport { SemanticError } from \"../errors.js\";\nimport type { TransportHandler } from \"../transport/types.js\";\nimport type { Resource, SemanticHandler, SemanticContext, ResourceMeta } from \"./types.js\";\n\nexport interface BinaryResource extends Resource<Buffer> {\n type: \"binary\";\n content: Buffer;\n}\n\n/**\n * Supported binary input types for deposit\n */\nexport type BinaryInput = Buffer | Uint8Array | ArrayBuffer | number[];\n\n/**\n * Convert various binary input types to Buffer\n */\nfunction toBuffer(data: BinaryInput): Buffer {\n if (Buffer.isBuffer(data)) {\n return data;\n }\n if (data instanceof Uint8Array) {\n return Buffer.from(data);\n }\n if (data instanceof ArrayBuffer) {\n return Buffer.from(data);\n }\n if (Array.isArray(data)) {\n return Buffer.from(data);\n }\n throw new SemanticError(`Unsupported binary input type`, \"binary\");\n}\n\nexport class BinarySemanticHandler implements SemanticHandler<Buffer> {\n readonly name = \"binary\";\n\n async resolve(\n transport: TransportHandler,\n location: string,\n context: SemanticContext\n ): Promise<BinaryResource> {\n const result = await transport.get(location, context.params);\n\n const meta: ResourceMeta = {\n url: context.url,\n semantic: context.semantic,\n transport: context.transport,\n location: context.location,\n size: result.metadata?.size ?? result.content.length,\n resolvedAt: context.timestamp.toISOString(),\n type: result.metadata?.type,\n };\n\n return {\n type: \"binary\",\n content: result.content,\n meta,\n };\n }\n\n async deposit(\n transport: TransportHandler,\n location: string,\n data: BinaryInput,\n context: SemanticContext\n ): Promise<void> {\n const buffer = toBuffer(data);\n\n try {\n await transport.set(location, buffer, context.params);\n } catch (error) {\n throw new SemanticError(\n `Failed to deposit binary to \"${location}\": ${(error as Error).message}`,\n this.name,\n { cause: error as Error }\n );\n }\n }\n\n async exists(\n transport: TransportHandler,\n location: string,\n _context: SemanticContext\n ): Promise<boolean> {\n return transport.exists(location);\n }\n\n async delete(\n transport: TransportHandler,\n location: string,\n _context: SemanticContext\n ): Promise<void> {\n try {\n await transport.delete(location);\n } catch (error) {\n throw new SemanticError(\n `Failed to delete \"${location}\": ${(error as Error).message}`,\n this.name,\n { cause: error as Error }\n );\n }\n }\n}\n\nexport const binarySemantic: BinarySemanticHandler = new BinarySemanticHandler();\n",
|
|
11
11
|
"/**\n * ARP - Agent Resource Protocol\n * Factory and instance for parsing ARP URLs\n */\n\nimport { ARL, type HandlerResolver } from \"./ARL.js\";\nimport { ParseError, TransportError, SemanticError } from \"./errors.js\";\nimport type { TransportHandler } from \"./transport/types.js\";\nimport type { SemanticHandler } from \"./semantic/types.js\";\nimport { fileTransport, httpTransport, httpsTransport } from \"./transport/index.js\";\nimport { textSemantic, binarySemantic } from \"./semantic/index.js\";\n\n/**\n * ARP Configuration\n */\nexport interface ARPConfig {\n /**\n * Custom transport handlers\n */\n transports?: TransportHandler[];\n\n /**\n * Custom semantic handlers\n */\n semantics?: SemanticHandler[];\n}\n\n/**\n * ARP Instance\n */\nexport class ARP implements HandlerResolver {\n private readonly transports: Map<string, TransportHandler>;\n private readonly semantics: Map<string, SemanticHandler>;\n\n constructor(config: ARPConfig = {}) {\n this.transports = new Map();\n this.semantics = new Map();\n\n // Register default handlers\n const defaultTransports = [fileTransport, httpTransport, httpsTransport];\n const defaultSemantics = [textSemantic, binarySemantic];\n\n for (const handler of defaultTransports) {\n this.transports.set(handler.name, handler);\n }\n for (const handler of defaultSemantics) {\n this.semantics.set(handler.name, handler);\n }\n\n // Register custom handlers (override defaults if same name)\n if (config.transports) {\n for (const handler of config.transports) {\n this.transports.set(handler.name, handler);\n }\n }\n\n if (config.semantics) {\n for (const handler of config.semantics) {\n this.semantics.set(handler.name, handler);\n }\n }\n }\n\n /**\n * Register a transport handler\n */\n registerTransport(handler: TransportHandler): void {\n this.transports.set(handler.name, handler);\n }\n\n /**\n * Register a semantic handler\n */\n registerSemantic(handler: SemanticHandler): void {\n this.semantics.set(handler.name, handler);\n }\n\n /**\n * Get transport handler by name\n */\n getTransportHandler(name: string): TransportHandler {\n const handler = this.transports.get(name);\n if (!handler) {\n throw new TransportError(`Unsupported transport type: ${name}`, name);\n }\n return handler;\n }\n\n /**\n * Get semantic handler by name\n */\n getSemanticHandler(name: string): SemanticHandler {\n const handler = this.semantics.get(name);\n if (!handler) {\n throw new SemanticError(`Unsupported semantic type: ${name}`, name);\n }\n return handler;\n }\n\n /**\n * Parse an ARP URL into an ARL object\n *\n * @example\n * const arl = arp.parse(\"arp:text:file:///path/to/file.txt\");\n * arl.semantic // \"text\"\n * arl.transport // \"file\"\n * arl.location // \"/path/to/file.txt\"\n */\n parse(url: string): ARL {\n // 1. Check protocol prefix\n if (!url.startsWith(\"arp:\")) {\n throw new ParseError(`Invalid ARP URL: must start with \"arp:\"`, url);\n }\n\n const content = url.substring(4); // Remove \"arp:\"\n\n // 2. Find :// separator\n const separatorIndex = content.indexOf(\"://\");\n if (separatorIndex === -1) {\n throw new ParseError(`Invalid ARP URL: missing \"://\"`, url);\n }\n\n const typePart = content.substring(0, separatorIndex);\n const location = content.substring(separatorIndex + 3);\n\n // 3. Split type part by :\n const colonIndex = typePart.indexOf(\":\");\n if (colonIndex === -1) {\n throw new ParseError(`Invalid ARP URL: must have exactly 2 types (semantic:transport)`, url);\n }\n\n const semantic = typePart.substring(0, colonIndex);\n const transport = typePart.substring(colonIndex + 1);\n\n // 4. Validate non-empty\n if (!semantic) {\n throw new ParseError(`Invalid ARP URL: semantic type cannot be empty`, url);\n }\n if (!transport) {\n throw new ParseError(`Invalid ARP URL: transport type cannot be empty`, url);\n }\n if (!location) {\n throw new ParseError(`Invalid ARP URL: location cannot be empty`, url);\n }\n\n // 5. Validate handlers exist\n this.getTransportHandler(transport);\n this.getSemanticHandler(semantic);\n\n return new ARL(semantic, transport, location, this);\n }\n}\n\n/**\n * Create a new ARP instance\n *\n * @example\n * import { createARP, fileTransport, textSemantic } from \"arpjs\";\n *\n * const arp = createARP({\n * transports: [fileTransport],\n * semantics: [textSemantic],\n * });\n *\n * const arl = arp.parse(\"arp:text:file:///path/to/file.txt\");\n * const resource = await arl.resolve();\n */\nexport function createARP(config?: ARPConfig): ARP {\n return new ARP(config);\n}\n",
|
|
12
|
-
"/**\n * arpjs - Agent Resource Protocol\n *\n * A URL protocol for AI agents to access resources\n * Format: arp:{semantic}:{transport}://{location}\n */\n\ndeclare const __VERSION__: string | undefined;\nexport const VERSION: string = typeof __VERSION__ !== \"undefined\" ? __VERSION__ : \"0.0.0-dev\";\n\n// Core types\nexport type { ARI, ARL } from \"./types.js\";\n\n// ARP factory and class\nexport { ARP, createARP, type ARPConfig } from \"./ARP.js\";\n\n// Errors\nexport { ARPError, ParseError, TransportError, SemanticError } from \"./errors.js\";\n\n// Transport\nexport {\n type TransportHandler,\n type
|
|
12
|
+
"/**\n * arpjs - Agent Resource Protocol\n *\n * A URL protocol for AI agents to access resources\n * Format: arp:{semantic}:{transport}://{location}\n */\n\ndeclare const __VERSION__: string | undefined;\nexport const VERSION: string = typeof __VERSION__ !== \"undefined\" ? __VERSION__ : \"0.0.0-dev\";\n\n// Core types\nexport type { ARI, ARL } from \"./types.js\";\n\n// ARP factory and class\nexport { ARP, createARP, type ARPConfig } from \"./ARP.js\";\n\n// Errors\nexport { ARPError, ParseError, TransportError, SemanticError } from \"./errors.js\";\n\n// Transport\nexport {\n type TransportHandler,\n type TransportResult,\n type TransportParams,\n FileTransportHandler,\n fileTransport,\n HttpTransportHandler,\n httpsTransport,\n httpTransport,\n} from \"./transport/index.js\";\n\n// Semantic\nexport {\n type Resource,\n type SemanticHandler,\n type ResourceMeta,\n type SemanticContext,\n type TextResource,\n type BinaryResource,\n type BinaryInput,\n TextSemanticHandler,\n textSemantic,\n BinarySemanticHandler,\n binarySemantic,\n} from \"./semantic/index.js\";\n"
|
|
13
13
|
],
|
|
14
|
-
"mappings": ";AAOO,MAAM,iBAAiB,MAAM;AAAA,EAClC,WAAW,CAAC,SAAiB,SAAwB;AAAA,IACnD,MAAM,SAAS,OAAO;AAAA,IACtB,KAAK,OAAO;AAAA;AAEhB;AAAA;AAKO,MAAM,mBAAmB,SAAS;AAAA,EAGrB;AAAA,EAFlB,WAAW,CACT,SACgB,KAChB;AAAA,IACA,MAAM,OAAO;AAAA,IAFG;AAAA,IAGhB,KAAK,OAAO;AAAA;AAEhB;AAAA;AAKO,MAAM,uBAAuB,SAAS;AAAA,EAGzB;AAAA,EAFlB,WAAW,CACT,SACgB,WAChB,SACA;AAAA,IACA,MAAM,SAAS,OAAO;AAAA,IAHN;AAAA,IAIhB,KAAK,OAAO;AAAA;AAEhB;AAAA;AAKO,MAAM,sBAAsB,SAAS;AAAA,EAGxB;AAAA,EAFlB,WAAW,CACT,SACgB,UAChB,SACA;AAAA,IACA,MAAM,SAAS,OAAO;AAAA,IAHN;AAAA,IAIhB,KAAK,OAAO;AAAA;AAEhB;;;ACjCO,MAAM,IAAoB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EAEQ;AAAA,EAEjB,WAAW,CAAC,UAAkB,WAAmB,UAAkB,UAA2B;AAAA,IAC5F,KAAK,WAAW;AAAA,IAChB,KAAK,YAAY;AAAA,IACjB,KAAK,WAAW;AAAA,IAChB,KAAK,WAAW;AAAA;AAAA,EAMV,aAAa,GAAoB;AAAA,IACvC,OAAO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