@resourcexjs/core 2.15.0 → 2.16.1
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/index.d.ts +22 -2
- package/dist/index.js +70 -5
- package/dist/index.js.map +6 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -298,6 +298,17 @@ interface TypeDetector {
|
|
|
298
298
|
*/
|
|
299
299
|
declare function generateDefinition(result: TypeDetectionResult): RXD;
|
|
300
300
|
/**
|
|
301
|
+
* PrototypeDetector - Detects prototype resources from prototype.json.
|
|
302
|
+
*
|
|
303
|
+
* Pattern:
|
|
304
|
+
* - Required: prototype.json file
|
|
305
|
+
* - Optional: *.feature files (referenced via @filename)
|
|
306
|
+
*/
|
|
307
|
+
declare class PrototypeDetector implements TypeDetector {
|
|
308
|
+
readonly name = "prototype";
|
|
309
|
+
detect(files: Record<string, Buffer>, source: string): TypeDetectionResult | null;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
301
312
|
* ResourceJsonDetector - Detects resources with an explicit resource.json.
|
|
302
313
|
*
|
|
303
314
|
* Highest-priority detector. When resource.json exists,
|
|
@@ -335,7 +346,8 @@ declare class SkillDetector implements TypeDetector {
|
|
|
335
346
|
* Detection order:
|
|
336
347
|
* 1. ResourceJsonDetector (explicit resource.json always wins)
|
|
337
348
|
* 2. SkillDetector (SKILL.md pattern)
|
|
338
|
-
* 3.
|
|
349
|
+
* 3. PrototypeDetector (prototype.json pattern)
|
|
350
|
+
* 4. Custom detectors (registered in order)
|
|
339
351
|
*/
|
|
340
352
|
declare class TypeDetectorChain {
|
|
341
353
|
private readonly detectors;
|
|
@@ -1219,6 +1231,14 @@ declare const jsonType: BundledType;
|
|
|
1219
1231
|
*/
|
|
1220
1232
|
declare const binaryType: BundledType;
|
|
1221
1233
|
/**
|
|
1234
|
+
* Skill content (SKILL.md + optional references)
|
|
1235
|
+
*/
|
|
1236
|
+
declare const skillType: BundledType;
|
|
1237
|
+
/**
|
|
1238
|
+
* Prototype instruction set (prototype.json + @filename references)
|
|
1239
|
+
*/
|
|
1240
|
+
declare const prototypeType: BundledType;
|
|
1241
|
+
/**
|
|
1222
1242
|
* All built-in types as an array.
|
|
1223
1243
|
*/
|
|
1224
1244
|
declare const builtinTypes: BundledType[];
|
|
@@ -1291,4 +1311,4 @@ declare class TypeHandlerChain {
|
|
|
1291
1311
|
*/
|
|
1292
1312
|
clear(): void;
|
|
1293
1313
|
}
|
|
1294
|
-
export { wrap, withDomainValidation, textType, resource, resolveSource, parse, manifest, locate, loadResource, jsonType, isValidDigest, generateDefinition, format, extract, discoverRegistry, define, computeDigest, bundleResourceType, builtinTypes, binaryType, archive, WellKnownResponse, TypeHandlerChain, TypeDetectorChain, TypeDetector, TypeDetectionResult, StoredRXM, SourceLoaderChain, SourceLoader, SkillDetector, SearchOptions, ResourceXProvider, ResourceXError, ResourceTypeError, ResourceType, ResourceResolver, ResourceLoader, ResourceJsonDetector, ResolvedResource, ResolveSourceConfig, ResolveContext, RegistryMiddleware, RegistryError, RegistryEntry, Registry, RXS, RXR, RXMStore, RXMSource, RXMSearchOptions, RXMDefinition, RXMArchive, RXM, RXL, RXI, RXD, RXAStore, RXA, ProviderStores, ProviderDefaults, ProviderConfig, MemoryRXMStore, MemoryRXAStore, ManifestError, LocatorError, LoadResourceConfig, LinkedRegistry, JSONSchemaProperty, JSONSchema, IsolatorType, GitHubSourceLoader, FolderSourceLoader, FolderLoader, FileTree, FileEntry, DomainValidation, DiscoveryResult, DefinitionError, ContentError, CASRegistry, BundledType };
|
|
1314
|
+
export { wrap, withDomainValidation, textType, skillType, resource, resolveSource, prototypeType, parse, manifest, locate, loadResource, jsonType, isValidDigest, generateDefinition, format, extract, discoverRegistry, define, computeDigest, bundleResourceType, builtinTypes, binaryType, archive, WellKnownResponse, TypeHandlerChain, TypeDetectorChain, TypeDetector, TypeDetectionResult, StoredRXM, SourceLoaderChain, SourceLoader, SkillDetector, SearchOptions, ResourceXProvider, ResourceXError, ResourceTypeError, ResourceType, ResourceResolver, ResourceLoader, ResourceJsonDetector, ResolvedResource, ResolveSourceConfig, ResolveContext, RegistryMiddleware, RegistryError, RegistryEntry, Registry, RXS, RXR, RXMStore, RXMSource, RXMSearchOptions, RXMDefinition, RXMArchive, RXM, RXL, RXI, RXD, RXAStore, RXA, ProviderStores, ProviderDefaults, ProviderConfig, PrototypeDetector, MemoryRXMStore, MemoryRXAStore, ManifestError, LocatorError, LoadResourceConfig, LinkedRegistry, JSONSchemaProperty, JSONSchema, IsolatorType, GitHubSourceLoader, FolderSourceLoader, FolderLoader, FileTree, FileEntry, DomainValidation, DiscoveryResult, DefinitionError, ContentError, CASRegistry, BundledType };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __returnValue = (v) => v;
|
|
3
|
+
function __exportSetter(name, newValue) {
|
|
4
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
+
}
|
|
2
6
|
var __export = (target, all) => {
|
|
3
7
|
for (var name in all)
|
|
4
8
|
__defProp(target, name, {
|
|
5
9
|
get: all[name],
|
|
6
10
|
enumerable: true,
|
|
7
11
|
configurable: true,
|
|
8
|
-
set: (
|
|
12
|
+
set: __exportSetter.bind(all, name)
|
|
9
13
|
});
|
|
10
14
|
};
|
|
11
15
|
|
|
@@ -14859,6 +14863,23 @@ function generateDefinition(result) {
|
|
|
14859
14863
|
input.repository = result.repository;
|
|
14860
14864
|
return define(input);
|
|
14861
14865
|
}
|
|
14866
|
+
// src/detector/PrototypeDetector.ts
|
|
14867
|
+
import { basename } from "node:path";
|
|
14868
|
+
|
|
14869
|
+
class PrototypeDetector {
|
|
14870
|
+
name = "prototype";
|
|
14871
|
+
detect(files, source) {
|
|
14872
|
+
if (!files["prototype.json"]) {
|
|
14873
|
+
return null;
|
|
14874
|
+
}
|
|
14875
|
+
const name = basename(source);
|
|
14876
|
+
return {
|
|
14877
|
+
type: "prototype",
|
|
14878
|
+
name,
|
|
14879
|
+
description: `Prototype instruction set: ${name}`
|
|
14880
|
+
};
|
|
14881
|
+
}
|
|
14882
|
+
}
|
|
14862
14883
|
// src/detector/ResourceJsonDetector.ts
|
|
14863
14884
|
class ResourceJsonDetector {
|
|
14864
14885
|
name = "resource-json";
|
|
@@ -14892,7 +14913,7 @@ class ResourceJsonDetector {
|
|
|
14892
14913
|
}
|
|
14893
14914
|
}
|
|
14894
14915
|
// src/detector/SkillDetector.ts
|
|
14895
|
-
import { basename } from "node:path";
|
|
14916
|
+
import { basename as basename2 } from "node:path";
|
|
14896
14917
|
|
|
14897
14918
|
class SkillDetector {
|
|
14898
14919
|
name = "skill";
|
|
@@ -14900,7 +14921,7 @@ class SkillDetector {
|
|
|
14900
14921
|
if (!files["SKILL.md"]) {
|
|
14901
14922
|
return null;
|
|
14902
14923
|
}
|
|
14903
|
-
const name =
|
|
14924
|
+
const name = basename2(source);
|
|
14904
14925
|
const content = files["SKILL.md"].toString("utf-8");
|
|
14905
14926
|
const description = this.extractDescription(content);
|
|
14906
14927
|
return {
|
|
@@ -14929,6 +14950,7 @@ class TypeDetectorChain {
|
|
|
14929
14950
|
const chain = new TypeDetectorChain;
|
|
14930
14951
|
chain.detectors.push(new ResourceJsonDetector);
|
|
14931
14952
|
chain.detectors.push(new SkillDetector);
|
|
14953
|
+
chain.detectors.push(new PrototypeDetector);
|
|
14932
14954
|
return chain;
|
|
14933
14955
|
}
|
|
14934
14956
|
register(detector) {
|
|
@@ -15755,7 +15777,47 @@ var skill_type_default = {
|
|
|
15755
15777
|
}
|
|
15756
15778
|
}
|
|
15757
15779
|
};
|
|
15758
|
-
var
|
|
15780
|
+
var prototypeType = {
|
|
15781
|
+
name: "prototype",
|
|
15782
|
+
description: "Instruction set for materializing roles and organizations",
|
|
15783
|
+
code: `// @resolver: prototype_type_default
|
|
15784
|
+
var prototype_type_default = {
|
|
15785
|
+
async resolve(ctx) {
|
|
15786
|
+
var protoFile = ctx.files["prototype.json"];
|
|
15787
|
+
if (!protoFile) throw new Error("Prototype resource must contain a prototype.json file");
|
|
15788
|
+
var decoder = new TextDecoder();
|
|
15789
|
+
var instructions = JSON.parse(decoder.decode(protoFile));
|
|
15790
|
+
if (!Array.isArray(instructions)) {
|
|
15791
|
+
throw new Error("prototype.json must be a JSON array of instructions");
|
|
15792
|
+
}
|
|
15793
|
+
var resolved = instructions.map(function(instr) {
|
|
15794
|
+
var resolvedArgs = {};
|
|
15795
|
+
var keys = Object.keys(instr.args || {});
|
|
15796
|
+
for (var i = 0; i < keys.length; i++) {
|
|
15797
|
+
var key = keys[i];
|
|
15798
|
+
var value = instr.args[key];
|
|
15799
|
+
if (typeof value === "string" && value.startsWith("@")) {
|
|
15800
|
+
var filename = value.slice(1);
|
|
15801
|
+
var file = ctx.files[filename];
|
|
15802
|
+
if (!file) throw new Error("Referenced file not found: " + filename);
|
|
15803
|
+
resolvedArgs[key] = decoder.decode(file);
|
|
15804
|
+
} else {
|
|
15805
|
+
resolvedArgs[key] = value;
|
|
15806
|
+
}
|
|
15807
|
+
}
|
|
15808
|
+
return { op: instr.op, args: resolvedArgs };
|
|
15809
|
+
});
|
|
15810
|
+
return { id: ctx.manifest.name, instructions: resolved };
|
|
15811
|
+
}
|
|
15812
|
+
};`
|
|
15813
|
+
};
|
|
15814
|
+
var builtinTypes = [
|
|
15815
|
+
textType,
|
|
15816
|
+
jsonType,
|
|
15817
|
+
binaryType,
|
|
15818
|
+
skillType,
|
|
15819
|
+
prototypeType
|
|
15820
|
+
];
|
|
15759
15821
|
// src/type/bundler.ts
|
|
15760
15822
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
15761
15823
|
import { isAbsolute, resolve } from "node:path";
|
|
@@ -15858,8 +15920,10 @@ export {
|
|
|
15858
15920
|
wrap,
|
|
15859
15921
|
withDomainValidation,
|
|
15860
15922
|
textType,
|
|
15923
|
+
skillType,
|
|
15861
15924
|
resource,
|
|
15862
15925
|
resolveSource,
|
|
15926
|
+
prototypeType,
|
|
15863
15927
|
parse5 as parse,
|
|
15864
15928
|
manifest,
|
|
15865
15929
|
locate,
|
|
@@ -15885,6 +15949,7 @@ export {
|
|
|
15885
15949
|
ResourceJsonDetector,
|
|
15886
15950
|
RegistryMiddleware,
|
|
15887
15951
|
RegistryError,
|
|
15952
|
+
PrototypeDetector,
|
|
15888
15953
|
MemoryRXMStore,
|
|
15889
15954
|
MemoryRXAStore,
|
|
15890
15955
|
ManifestError,
|
|
@@ -15899,4 +15964,4 @@ export {
|
|
|
15899
15964
|
CASRegistry
|
|
15900
15965
|
};
|
|
15901
15966
|
|
|
15902
|
-
//# debugId=
|
|
15967
|
+
//# debugId=00B289BE17187B1064756E2164756E21
|