@resourcexjs/core 2.5.5 → 2.5.7

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 CHANGED
@@ -365,16 +365,95 @@ const files = await extract(rxr.archive);
365
365
  console.log(files.content.toString()); // "You are a helpful AI assistant."
366
366
  ```
367
367
 
368
+ ## Registry Layer
369
+
370
+ ### CASRegistry
371
+
372
+ Content-addressable storage registry for managing resources.
373
+
374
+ ```typescript
375
+ import { CASRegistry, MemoryRXAStore, MemoryRXMStore } from "@resourcexjs/core";
376
+
377
+ // Create with memory stores (for testing)
378
+ const cas = new CASRegistry(new MemoryRXAStore(), new MemoryRXMStore());
379
+
380
+ // Store a resource
381
+ await cas.put(rxr);
382
+
383
+ // Get a resource
384
+ const rxr = await cas.get(rxl);
385
+
386
+ // Check existence
387
+ const exists = await cas.has(rxl);
388
+
389
+ // Remove a resource
390
+ await cas.remove(rxl);
391
+
392
+ // List resources
393
+ const results = await cas.list({ query: "prompt", limit: 10 });
394
+
395
+ // Garbage collect orphaned blobs
396
+ await cas.gc();
397
+
398
+ // Clear cache by registry
399
+ await cas.clearCache("registry.example.com");
400
+ ```
401
+
402
+ ### Store Interfaces (SPI)
403
+
404
+ For implementing custom storage backends:
405
+
406
+ ```typescript
407
+ import type { RXAStore, RXMStore, StoredRXM } from "@resourcexjs/core";
408
+
409
+ // Blob storage interface
410
+ interface RXAStore {
411
+ get(digest: string): Promise<Buffer>;
412
+ put(data: Buffer): Promise<string>; // Returns digest
413
+ has(digest: string): Promise<boolean>;
414
+ delete(digest: string): Promise<void>;
415
+ list(): Promise<string[]>;
416
+ }
417
+
418
+ // Manifest storage interface
419
+ interface RXMStore {
420
+ get(name: string, tag: string, registry?: string): Promise<StoredRXM | null>;
421
+ put(manifest: StoredRXM): Promise<void>;
422
+ has(name: string, tag: string, registry?: string): Promise<boolean>;
423
+ delete(name: string, tag: string, registry?: string): Promise<void>;
424
+ listTags(name: string, registry?: string): Promise<string[]>;
425
+ search(options?: RXMSearchOptions): Promise<StoredRXM[]>;
426
+ deleteByRegistry(registry: string): Promise<void>;
427
+ }
428
+ ```
429
+
430
+ ### Provider Interface (SPI)
431
+
432
+ For implementing platform-specific providers:
433
+
434
+ ```typescript
435
+ import type { ResourceXProvider, ProviderConfig, ProviderStores } from "@resourcexjs/core";
436
+
437
+ interface ResourceXProvider {
438
+ readonly platform: string;
439
+ createStores(config: ProviderConfig): ProviderStores;
440
+ createLoader?(config: ProviderConfig): ResourceLoader;
441
+ }
442
+
443
+ interface ProviderStores {
444
+ rxaStore: RXAStore;
445
+ rxmStore: RXMStore;
446
+ }
447
+ ```
448
+
368
449
  ## Related Packages
369
450
 
370
- | Package | Description |
371
- | ---------------------------------------------------------------------------- | -------------------------- |
372
- | [resourcexjs](https://www.npmjs.com/package/resourcexjs) | Main package (recommended) |
373
- | [@resourcexjs/storage](https://www.npmjs.com/package/@resourcexjs/storage) | Storage layer |
374
- | [@resourcexjs/registry](https://www.npmjs.com/package/@resourcexjs/registry) | Registry layer |
375
- | [@resourcexjs/type](https://www.npmjs.com/package/@resourcexjs/type) | Type system |
376
- | [@resourcexjs/loader](https://www.npmjs.com/package/@resourcexjs/loader) | Resource loading |
377
- | [@resourcexjs/arp](https://www.npmjs.com/package/@resourcexjs/arp) | Low-level I/O |
451
+ | Package | Description |
452
+ | -------------------------------------------------------------------------------------- | ----------------------------- |
453
+ | [resourcexjs](https://www.npmjs.com/package/resourcexjs) | Main client package |
454
+ | [@resourcexjs/node-provider](https://www.npmjs.com/package/@resourcexjs/node-provider) | Node.js/Bun platform provider |
455
+ | [@resourcexjs/server](https://www.npmjs.com/package/@resourcexjs/server) | Registry server |
456
+ | [@resourcexjs/arp](https://www.npmjs.com/package/@resourcexjs/arp) | Low-level I/O protocol |
378
457
 
379
458
  ## License
380
459