resourcexjs 2.0.0 → 2.1.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/dist/arp.d.ts CHANGED
@@ -1 +1,93 @@
1
- export * from "@resourcexjs/arp";
1
+ import { ARP, ARPConfig } from "@resourcexjs/arp";
2
+ import { ARP as ARP2, ARPConfig as ARPConfig2 } from "@resourcexjs/arp";
3
+ import { VERSION } from "@resourcexjs/arp";
4
+ import { ARPError, ParseError, TransportError, SemanticError } from "@resourcexjs/arp";
5
+ import { TransportHandler as TransportHandler2, TransportResult as TransportResult2, TransportParams as TransportParams2, FileTransportHandler, fileTransport, HttpTransportHandler, httpsTransport, httpTransport } from "@resourcexjs/arp";
6
+ import { Resource, SemanticHandler, ResourceMeta, SemanticContext, TextResource, BinaryResource, BinaryInput, TextSemanticHandler, textSemantic, BinarySemanticHandler, binarySemantic } from "@resourcexjs/arp";
7
+ import { ARI, ARL } from "@resourcexjs/arp";
8
+ import { TransportHandler, TransportResult, TransportParams } from "@resourcexjs/arp";
9
+ /**
10
+ * Minimal registry interface required by RxrTransport.
11
+ * This allows RxrTransport to work without depending on the full Registry type.
12
+ */
13
+ interface RxrTransportRegistry {
14
+ get(locator: string): Promise<{
15
+ content: {
16
+ files(): Promise<Map<string, Buffer>>
17
+ }
18
+ }>;
19
+ }
20
+ /**
21
+ * RXR Transport - Access files inside a resource.
22
+ *
23
+ * Location format: {rxl}/{internal-path}
24
+ * Example: deepractice.ai/nuwa.role@1.0.0/thought/first-principles.md
25
+ *
26
+ * The RXL portion ends at @version, and the internal path follows.
27
+ *
28
+ * When no registry is provided, automatically creates one based on domain:
29
+ * - localhost: LocalRegistry
30
+ * - Other domains: RemoteRegistry with well-known discovery
31
+ */
32
+ declare class RxrTransport implements TransportHandler {
33
+ private registry?;
34
+ readonly name = "rxr";
35
+ constructor(registry?: RxrTransportRegistry);
36
+ /**
37
+ * Get file content from inside a resource.
38
+ */
39
+ get(location: string, _params?: TransportParams): Promise<TransportResult>;
40
+ /**
41
+ * Set is not supported - RXR transport is read-only.
42
+ */
43
+ set(_location: string, _content: Buffer, _params?: TransportParams): Promise<void>;
44
+ /**
45
+ * Check if a file exists inside a resource.
46
+ */
47
+ exists(location: string): Promise<boolean>;
48
+ /**
49
+ * Delete is not supported - RXR transport is read-only.
50
+ */
51
+ delete(_location: string): Promise<void>;
52
+ /**
53
+ * Get or create a registry for the given domain.
54
+ * - If a registry was provided in constructor, use it
55
+ * - localhost: create LocalRegistry
56
+ * - Other domains: discover endpoint via well-known and create appropriate registry
57
+ */
58
+ private getRegistry;
59
+ /**
60
+ * Check if URL is a git repository URL.
61
+ */
62
+ private isGitUrl;
63
+ /**
64
+ * Parse location into domain, RXL and internal path.
65
+ * Format: {domain}/{path}/{name}.{type}@{version}/{internal-path}
66
+ * Example: deepractice.ai/nuwa.role@1.0.0/thought/first-principles.md
67
+ */
68
+ private parseLocation;
69
+ }
70
+ /**
71
+ * Clear the registry cache. Useful for testing.
72
+ */
73
+ declare function clearRegistryCache(): void;
74
+ /**
75
+ * Create an ARP instance with ResourceX integration.
76
+ *
77
+ * This enhanced version automatically registers the RXR transport,
78
+ * which allows accessing files inside ResourceX resources.
79
+ *
80
+ * Default transports: file, http, https, rxr
81
+ * Default semantics: text, binary
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * const arp = createARP();
86
+ *
87
+ * // Use rxr transport to access resource internals
88
+ * const arl = arp.parse("arp:text:rxr://localhost/my-prompt.text@1.0.0/content");
89
+ * const resource = await arl.resolve();
90
+ * ```
91
+ */
92
+ declare function createARP(config?: ARPConfig): ARP;
93
+ export { textSemantic, httpsTransport, httpTransport, fileTransport, createARP, clearRegistryCache, binarySemantic, VERSION, TransportResult2 as TransportResult, TransportParams2 as TransportParams, TransportHandler2 as TransportHandler, TransportError, TextSemanticHandler, TextResource, SemanticHandler, SemanticError, SemanticContext, RxrTransportRegistry, RxrTransport, ResourceMeta, Resource, ParseError, HttpTransportHandler, FileTransportHandler, BinarySemanticHandler, BinaryResource, BinaryInput, ARPError, ARPConfig2 as ARPConfig, ARP2 as ARP, ARL, ARI };