@resourcexjs/core 2.15.0 → 2.16.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/index.d.ts +22 -2
- package/dist/index.js +65 -4
- 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
|
@@ -14859,6 +14859,23 @@ function generateDefinition(result) {
|
|
|
14859
14859
|
input.repository = result.repository;
|
|
14860
14860
|
return define(input);
|
|
14861
14861
|
}
|
|
14862
|
+
// src/detector/PrototypeDetector.ts
|
|
14863
|
+
import { basename } from "node:path";
|
|
14864
|
+
|
|
14865
|
+
class PrototypeDetector {
|
|
14866
|
+
name = "prototype";
|
|
14867
|
+
detect(files, source) {
|
|
14868
|
+
if (!files["prototype.json"]) {
|
|
14869
|
+
return null;
|
|
14870
|
+
}
|
|
14871
|
+
const name = basename(source);
|
|
14872
|
+
return {
|
|
14873
|
+
type: "prototype",
|
|
14874
|
+
name,
|
|
14875
|
+
description: `Prototype instruction set: ${name}`
|
|
14876
|
+
};
|
|
14877
|
+
}
|
|
14878
|
+
}
|
|
14862
14879
|
// src/detector/ResourceJsonDetector.ts
|
|
14863
14880
|
class ResourceJsonDetector {
|
|
14864
14881
|
name = "resource-json";
|
|
@@ -14892,7 +14909,7 @@ class ResourceJsonDetector {
|
|
|
14892
14909
|
}
|
|
14893
14910
|
}
|
|
14894
14911
|
// src/detector/SkillDetector.ts
|
|
14895
|
-
import { basename } from "node:path";
|
|
14912
|
+
import { basename as basename2 } from "node:path";
|
|
14896
14913
|
|
|
14897
14914
|
class SkillDetector {
|
|
14898
14915
|
name = "skill";
|
|
@@ -14900,7 +14917,7 @@ class SkillDetector {
|
|
|
14900
14917
|
if (!files["SKILL.md"]) {
|
|
14901
14918
|
return null;
|
|
14902
14919
|
}
|
|
14903
|
-
const name =
|
|
14920
|
+
const name = basename2(source);
|
|
14904
14921
|
const content = files["SKILL.md"].toString("utf-8");
|
|
14905
14922
|
const description = this.extractDescription(content);
|
|
14906
14923
|
return {
|
|
@@ -14929,6 +14946,7 @@ class TypeDetectorChain {
|
|
|
14929
14946
|
const chain = new TypeDetectorChain;
|
|
14930
14947
|
chain.detectors.push(new ResourceJsonDetector);
|
|
14931
14948
|
chain.detectors.push(new SkillDetector);
|
|
14949
|
+
chain.detectors.push(new PrototypeDetector);
|
|
14932
14950
|
return chain;
|
|
14933
14951
|
}
|
|
14934
14952
|
register(detector) {
|
|
@@ -15755,7 +15773,47 @@ var skill_type_default = {
|
|
|
15755
15773
|
}
|
|
15756
15774
|
}
|
|
15757
15775
|
};
|
|
15758
|
-
var
|
|
15776
|
+
var prototypeType = {
|
|
15777
|
+
name: "prototype",
|
|
15778
|
+
description: "Instruction set for materializing roles and organizations",
|
|
15779
|
+
code: `// @resolver: prototype_type_default
|
|
15780
|
+
var prototype_type_default = {
|
|
15781
|
+
async resolve(ctx) {
|
|
15782
|
+
var protoFile = ctx.files["prototype.json"];
|
|
15783
|
+
if (!protoFile) throw new Error("Prototype resource must contain a prototype.json file");
|
|
15784
|
+
var decoder = new TextDecoder();
|
|
15785
|
+
var instructions = JSON.parse(decoder.decode(protoFile));
|
|
15786
|
+
if (!Array.isArray(instructions)) {
|
|
15787
|
+
throw new Error("prototype.json must be a JSON array of instructions");
|
|
15788
|
+
}
|
|
15789
|
+
var resolved = instructions.map(function(instr) {
|
|
15790
|
+
var resolvedArgs = {};
|
|
15791
|
+
var keys = Object.keys(instr.args || {});
|
|
15792
|
+
for (var i = 0; i < keys.length; i++) {
|
|
15793
|
+
var key = keys[i];
|
|
15794
|
+
var value = instr.args[key];
|
|
15795
|
+
if (typeof value === "string" && value.startsWith("@")) {
|
|
15796
|
+
var filename = value.slice(1);
|
|
15797
|
+
var file = ctx.files[filename];
|
|
15798
|
+
if (!file) throw new Error("Referenced file not found: " + filename);
|
|
15799
|
+
resolvedArgs[key] = decoder.decode(file);
|
|
15800
|
+
} else {
|
|
15801
|
+
resolvedArgs[key] = value;
|
|
15802
|
+
}
|
|
15803
|
+
}
|
|
15804
|
+
return { op: instr.op, args: resolvedArgs };
|
|
15805
|
+
});
|
|
15806
|
+
return { id: ctx.manifest.name, instructions: resolved };
|
|
15807
|
+
}
|
|
15808
|
+
};`
|
|
15809
|
+
};
|
|
15810
|
+
var builtinTypes = [
|
|
15811
|
+
textType,
|
|
15812
|
+
jsonType,
|
|
15813
|
+
binaryType,
|
|
15814
|
+
skillType,
|
|
15815
|
+
prototypeType
|
|
15816
|
+
];
|
|
15759
15817
|
// src/type/bundler.ts
|
|
15760
15818
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
15761
15819
|
import { isAbsolute, resolve } from "node:path";
|
|
@@ -15858,8 +15916,10 @@ export {
|
|
|
15858
15916
|
wrap,
|
|
15859
15917
|
withDomainValidation,
|
|
15860
15918
|
textType,
|
|
15919
|
+
skillType,
|
|
15861
15920
|
resource,
|
|
15862
15921
|
resolveSource,
|
|
15922
|
+
prototypeType,
|
|
15863
15923
|
parse5 as parse,
|
|
15864
15924
|
manifest,
|
|
15865
15925
|
locate,
|
|
@@ -15885,6 +15945,7 @@ export {
|
|
|
15885
15945
|
ResourceJsonDetector,
|
|
15886
15946
|
RegistryMiddleware,
|
|
15887
15947
|
RegistryError,
|
|
15948
|
+
PrototypeDetector,
|
|
15888
15949
|
MemoryRXMStore,
|
|
15889
15950
|
MemoryRXAStore,
|
|
15890
15951
|
ManifestError,
|
|
@@ -15899,4 +15960,4 @@ export {
|
|
|
15899
15960
|
CASRegistry
|
|
15900
15961
|
};
|
|
15901
15962
|
|
|
15902
|
-
//# debugId=
|
|
15963
|
+
//# debugId=0BF8A796080AFBD664756E2164756E21
|