halfcode-compiler.xnl 0.2.7 → 0.2.9
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/application-assembly.js +1 -1
- package/dist/authoring-runtime.d.ts +163 -1
- package/dist/authoring-runtime.js +2 -2
- package/dist/{resource-core-zEONBZ_o.d.ts → effective-content-identities-CSVFi-N5.d.ts} +2 -8
- package/dist/effective-content-identities-DV5fTr5Q.js +118 -0
- package/dist/{index-X6R_4lMW.d.ts → index-B515mMkO.d.ts} +1 -1
- package/dist/{index-CEJBgfBZ.d.ts → index-CDIT65pI.d.ts} +2 -33
- package/dist/{index-DkqggaxV.d.ts → index-CF4nEkOi.d.ts} +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +6 -5
- package/dist/kind-definition.d.ts +1 -1
- package/dist/resource-core-C0Fj-VJA.d.ts +29 -0
- package/dist/resource-core.d.ts +4 -3
- package/dist/resource-core.js +91 -120
- package/dist/resource-projection.d.ts +1 -1
- package/dist/skill-capsule.d.ts +1 -1
- package/dist/skill-capsule.js +1 -1
- package/dist/src-3MZLm339.js +588 -0
- package/dist/{src-D2au7Wcj.js → src-3pnDAjBD.js} +1 -1
- package/dist/{src-BxyKIkBg.js → src-CaQ25rMj.js} +1 -1
- package/dist/{src-88_zDKZE.js → src-D3qSzGFn.js} +89 -301
- package/dist/system-skills/resource-dsl/documents.md +15 -27
- package/dist/system-skills/resource-dsl/files.md +2 -1
- package/dist/system-skills/sys-halfcode-resource-dsl.plan.js +8 -8
- package/dist/testing.js +1 -1
- package/package.json +6 -2
- package/dist/src-B87eJQat.js +0 -39
package/dist/resource-core.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as isLoadedResourceTreeAuthentic, c as sha256Digest, d as markEffectiveRegistryAuthentic, f as ResourceCompositionError, i as readonlyMap, m as digestCanonical, n as loadResourceTree, o as buildResourceDependencySnapshot, p as compareCodeUnits, r as validateResourceTree, s as createResourceContentIdentity, t as ResourceValidationError } from "./src-D3qSzGFn.js";
|
|
2
|
+
import { t as resolveEffectiveResourceContentIdentities } from "./effective-content-identities-DV5fTr5Q.js";
|
|
3
|
+
import { lstat, readFile, realpath } from "node:fs/promises";
|
|
4
|
+
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
2
5
|
//#region ../resource-core/src/layered-registry.ts
|
|
3
6
|
function composeLayeredResourceRegistry(input) {
|
|
4
7
|
const diagnostics = [];
|
|
@@ -10,11 +13,11 @@ function composeLayeredResourceRegistry(input) {
|
|
|
10
13
|
const layerId = layer.id.trim();
|
|
11
14
|
const packageId = layer.tree.manifest.resourceId;
|
|
12
15
|
if (layerId.length === 0) {
|
|
13
|
-
diagnostics.push(diagnostic
|
|
16
|
+
diagnostics.push(diagnostic("RESOURCE_LAYER_ID_EMPTY", layerLocation(layerIndex), "Resource layer id must be a non-empty explicit value."));
|
|
14
17
|
return;
|
|
15
18
|
}
|
|
16
19
|
if (layerIds.has(layerId)) {
|
|
17
|
-
diagnostics.push(diagnostic
|
|
20
|
+
diagnostics.push(diagnostic("RESOURCE_LAYER_ID_DUPLICATE", layerLocation(layerIndex, layerId), `Resource layer id '${layerId}' is declared more than once.`));
|
|
18
21
|
return;
|
|
19
22
|
}
|
|
20
23
|
layerIds.add(layerId);
|
|
@@ -27,7 +30,7 @@ function composeLayeredResourceRegistry(input) {
|
|
|
27
30
|
mergeResources(layer.tree, layerId, layerIndex, packageId, entries, diagnostics);
|
|
28
31
|
applyTombstones(layer, layerId, layerIndex, packageId, entries, diagnostics);
|
|
29
32
|
});
|
|
30
|
-
if (diagnostics.length > 0) throw new ResourceCompositionError(stableDiagnostics
|
|
33
|
+
if (diagnostics.length > 0) throw new ResourceCompositionError(stableDiagnostics(diagnostics));
|
|
31
34
|
const frozenEntries = [...entries.values()].sort((left, right) => compareCodeUnits(left.resourceId, right.resourceId)).map((entry) => freezeEntry(entry));
|
|
32
35
|
const byId = readonlyMap(frozenEntries.map((entry) => [entry.resourceId, entry]));
|
|
33
36
|
const byKindValues = /* @__PURE__ */ new Map();
|
|
@@ -73,7 +76,7 @@ function composeLayeredResourceRegistry(input) {
|
|
|
73
76
|
function mergeKindDefinitions(tree, layerId, layerIndex, packageId, definitions, diagnostics) {
|
|
74
77
|
for (const [kind, inputDefinition] of [...tree.registry.kindDefinitions.entries()].sort(([left], [right]) => compareCodeUnits(left, right))) {
|
|
75
78
|
if (!isCanonicalVfsDocumentUri(inputDefinition.documentUri)) {
|
|
76
|
-
diagnostics.push(diagnostic
|
|
79
|
+
diagnostics.push(diagnostic("RESOURCE_LAYER_PROVENANCE_INVALID", layerLocation(layerIndex, layerId, kind), `Resource kind '${kind}' must use canonical VFS document provenance.`));
|
|
77
80
|
continue;
|
|
78
81
|
}
|
|
79
82
|
const definition = cloneRegisteredKindDefinition(inputDefinition);
|
|
@@ -87,7 +90,7 @@ function mergeKindDefinitions(tree, layerId, layerIndex, packageId, definitions,
|
|
|
87
90
|
continue;
|
|
88
91
|
}
|
|
89
92
|
if (JSON.stringify(normalizedKindContract(current.definition)) !== JSON.stringify(normalizedKindContract(definition))) {
|
|
90
|
-
diagnostics.push(diagnostic
|
|
93
|
+
diagnostics.push(diagnostic("RESOURCE_LAYER_KIND_DEFINITION_CONFLICT", layerLocation(layerIndex, layerId, kind), `Resource kind '${kind}' has incompatible KindDefinition contracts across layers.`));
|
|
91
94
|
continue;
|
|
92
95
|
}
|
|
93
96
|
current.origins.push(origin);
|
|
@@ -98,12 +101,12 @@ function mergeResources(tree, layerId, layerIndex, packageId, entries, diagnosti
|
|
|
98
101
|
const seenInLayer = /* @__PURE__ */ new Set();
|
|
99
102
|
for (const resource of records) {
|
|
100
103
|
if (seenInLayer.has(resource.resourceId)) {
|
|
101
|
-
diagnostics.push(diagnostic
|
|
104
|
+
diagnostics.push(diagnostic("RESOURCE_LAYER_RESOURCE_DUPLICATE", layerLocation(layerIndex, layerId, resource.resourceId), `Resource '${resource.resourceId}' occurs more than once in layer '${layerId}'.`));
|
|
102
105
|
continue;
|
|
103
106
|
}
|
|
104
107
|
seenInLayer.add(resource.resourceId);
|
|
105
108
|
if (!isSafeLogicalPath(resource.logicalPath) || resource.documentUri !== `vfs://@/${resource.logicalPath}`) {
|
|
106
|
-
diagnostics.push(diagnostic
|
|
109
|
+
diagnostics.push(diagnostic("RESOURCE_LAYER_PROVENANCE_INVALID", layerLocation(layerIndex, layerId, resource.resourceId), `Resource '${resource.resourceId}' must use matching canonical VFS documentUri and safe logicalPath provenance.`));
|
|
107
110
|
continue;
|
|
108
111
|
}
|
|
109
112
|
const immutableResource = cloneResourceRecord(resource);
|
|
@@ -122,7 +125,7 @@ function mergeResources(tree, layerId, layerIndex, packageId, entries, diagnosti
|
|
|
122
125
|
continue;
|
|
123
126
|
}
|
|
124
127
|
if (current.kind !== resource.kind) {
|
|
125
|
-
diagnostics.push(diagnostic
|
|
128
|
+
diagnostics.push(diagnostic("RESOURCE_LAYER_IDENTITY_KIND_CONFLICT", layerLocation(layerIndex, layerId, resource.resourceId), `Resource '${resource.resourceId}' changes kind from '${current.kind}' to '${resource.kind}' across layers.`));
|
|
126
129
|
continue;
|
|
127
130
|
}
|
|
128
131
|
if (current.effectiveOrigin) current.shadowed.push(current.effectiveOrigin);
|
|
@@ -138,25 +141,25 @@ function applyTombstones(layer, layerId, layerIndex, packageId, entries, diagnos
|
|
|
138
141
|
for (const tombstone of tombstones) {
|
|
139
142
|
const resourceId = tombstone.resourceId.trim();
|
|
140
143
|
if (resourceId.length === 0) {
|
|
141
|
-
diagnostics.push(diagnostic
|
|
144
|
+
diagnostics.push(diagnostic("RESOURCE_LAYER_TOMBSTONE_ID_EMPTY", layerLocation(layerIndex, layerId), "Resource tombstone target must be a non-empty resource id."));
|
|
142
145
|
continue;
|
|
143
146
|
}
|
|
144
147
|
if (seen.has(resourceId)) {
|
|
145
|
-
diagnostics.push(diagnostic
|
|
148
|
+
diagnostics.push(diagnostic("RESOURCE_LAYER_TOMBSTONE_DUPLICATE", layerLocation(layerIndex, layerId, resourceId), `Resource '${resourceId}' has more than one tombstone in layer '${layerId}'.`));
|
|
146
149
|
continue;
|
|
147
150
|
}
|
|
148
151
|
seen.add(resourceId);
|
|
149
152
|
const current = entries.get(resourceId);
|
|
150
153
|
if (!current) {
|
|
151
|
-
diagnostics.push(diagnostic
|
|
154
|
+
diagnostics.push(diagnostic("RESOURCE_LAYER_TOMBSTONE_TARGET_MISSING", layerLocation(layerIndex, layerId, resourceId), `Tombstone target '${resourceId}' does not exist in a lower or current layer.`));
|
|
152
155
|
continue;
|
|
153
156
|
}
|
|
154
157
|
if (current.effectiveLayerId === layerId) {
|
|
155
|
-
diagnostics.push(diagnostic
|
|
158
|
+
diagnostics.push(diagnostic("RESOURCE_LAYER_TOMBSTONE_RESOURCE_CONFLICT", layerLocation(layerIndex, layerId, resourceId), `Resource '${resourceId}' cannot be both effective and tombstoned in layer '${layerId}'.`));
|
|
156
159
|
continue;
|
|
157
160
|
}
|
|
158
161
|
if (tombstone.expectedKind !== void 0 && tombstone.expectedKind !== current.kind) {
|
|
159
|
-
diagnostics.push(diagnostic
|
|
162
|
+
diagnostics.push(diagnostic("RESOURCE_LAYER_TOMBSTONE_KIND_MISMATCH", layerLocation(layerIndex, layerId, resourceId), `Tombstone for '${resourceId}' expects kind '${tombstone.expectedKind}', but the target kind is '${current.kind}'.`));
|
|
160
163
|
continue;
|
|
161
164
|
}
|
|
162
165
|
const origin = Object.freeze({
|
|
@@ -299,134 +302,102 @@ function compareOrigins(left, right) {
|
|
|
299
302
|
function compareTombstones(left, right) {
|
|
300
303
|
return left.layerIndex - right.layerIndex || compareCodeUnits(left.resourceId, right.resourceId);
|
|
301
304
|
}
|
|
302
|
-
function stableDiagnostics
|
|
305
|
+
function stableDiagnostics(diagnostics) {
|
|
303
306
|
return Object.freeze([...diagnostics].sort((left, right) => compareCodeUnits(left.location, right.location) || compareCodeUnits(left.code, right.code)));
|
|
304
307
|
}
|
|
305
|
-
function diagnostic
|
|
308
|
+
function diagnostic(code, location, message) {
|
|
306
309
|
return Object.freeze({
|
|
307
310
|
code,
|
|
308
311
|
location,
|
|
309
312
|
message
|
|
310
313
|
});
|
|
311
314
|
}
|
|
312
|
-
function layerLocation
|
|
315
|
+
function layerLocation(index, layerId, subject) {
|
|
313
316
|
return `layer:${index}:${layerId ?? "unnamed"}${subject === void 0 ? "" : `:${subject}`}`;
|
|
314
317
|
}
|
|
315
318
|
//#endregion
|
|
316
|
-
//#region ../resource-core/src/
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
for (let index = 0; index < input.registry.layers.length; index += 1) {
|
|
324
|
-
const descriptor = input.registry.layers[index];
|
|
325
|
-
const layer = input.layers[index];
|
|
326
|
-
const binding = bindings[index];
|
|
327
|
-
if (!layer) continue;
|
|
328
|
-
if (!isLoadedResourceTreeAuthentic(layer.tree)) {
|
|
329
|
-
diagnostics.push(diagnostic("RESOURCE_CONTENT_IDENTITY_LAYER_UNTRUSTED", layerLocation(index, layer.id), `Layer '${layer.id}' must use an authentic LoadedResourceTree returned by loadResourceTree().`));
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
if (layer.id !== descriptor.id || binding?.id !== descriptor.id) {
|
|
333
|
-
diagnostics.push(diagnostic("RESOURCE_CONTENT_IDENTITY_LAYER_ID_MISMATCH", layerLocation(index, layer.id), `Layer at index ${index} must retain exact id '${descriptor.id}'.`));
|
|
334
|
-
continue;
|
|
335
|
-
}
|
|
336
|
-
if (descriptor.index !== index) {
|
|
337
|
-
diagnostics.push(diagnostic("RESOURCE_CONTENT_IDENTITY_LAYER_INDEX_MISMATCH", layerLocation(index, layer.id), `Layer '${layer.id}' has inconsistent registry index ${descriptor.index}.`));
|
|
338
|
-
continue;
|
|
339
|
-
}
|
|
340
|
-
if (layer.tree.manifest.resourceId !== descriptor.packageId) {
|
|
341
|
-
diagnostics.push(diagnostic("RESOURCE_CONTENT_IDENTITY_LAYER_PACKAGE_MISMATCH", layerLocation(index, layer.id), `Layer '${layer.id}' must retain package '${descriptor.packageId}'.`));
|
|
342
|
-
continue;
|
|
343
|
-
}
|
|
344
|
-
if (binding?.tree !== layer.tree) {
|
|
345
|
-
diagnostics.push(diagnostic("RESOURCE_CONTENT_IDENTITY_LAYER_BINDING_MISMATCH", layerLocation(index, layer.id), `Layer '${layer.id}' must use the exact loaded tree composed into the registry.`));
|
|
346
|
-
continue;
|
|
347
|
-
}
|
|
348
|
-
validateLoadedIdentityCoverage(layer.tree, layer.id, diagnostics);
|
|
349
|
-
loadedById.set(layer.id, layer.tree);
|
|
350
|
-
}
|
|
351
|
-
const effectiveEntries = [...input.registry.byId.values()].filter((entry) => entry.resource !== void 0).sort((left, right) => compareCodeUnits(left.resourceId, right.resourceId));
|
|
352
|
-
const effectiveIds = new Set(effectiveEntries.map((entry) => entry.resourceId));
|
|
353
|
-
for (const resourceId of input.contributions?.keys() ?? []) if (!effectiveIds.has(resourceId)) diagnostics.push(diagnostic("RESOURCE_DIGEST_CONTRIBUTION_OWNER_UNKNOWN", contentLocation(resourceId), `Digest contributions target unknown effective resource '${resourceId}'.`));
|
|
354
|
-
const output = [];
|
|
355
|
-
for (const entry of effectiveEntries) {
|
|
356
|
-
const tree = entry.effectiveLayerId === void 0 ? void 0 : loadedById.get(entry.effectiveLayerId);
|
|
357
|
-
if (!tree || !entry.effectiveOrigin) {
|
|
358
|
-
diagnostics.push(diagnostic("RESOURCE_CONTENT_IDENTITY_EFFECTIVE_ORIGIN_MISSING", contentLocation(entry.resourceId), `Effective resource '${entry.resourceId}' has no exact loaded layer origin.`));
|
|
359
|
-
continue;
|
|
360
|
-
}
|
|
361
|
-
validateEffectiveOrigin(entry, input.registry, tree, diagnostics);
|
|
362
|
-
const authorityIdentity = tree.contentIdentities.get(entry.resourceId);
|
|
363
|
-
if (!authorityIdentity) {
|
|
364
|
-
diagnostics.push(diagnostic("RESOURCE_CONTENT_IDENTITY_MISSING", contentLocation(entry.resourceId), `Effective resource '${entry.resourceId}' is missing its loader authority identity.`));
|
|
365
|
-
continue;
|
|
366
|
-
}
|
|
367
|
-
try {
|
|
368
|
-
const identity = createResourceContentIdentity({
|
|
369
|
-
resourceId: entry.resourceId,
|
|
370
|
-
authorityDigest: authorityIdentity.authorityDigest,
|
|
371
|
-
contributions: [...authorityIdentity.contributions, ...input.contributions?.get(entry.resourceId) ?? []]
|
|
372
|
-
});
|
|
373
|
-
output.push([entry.resourceId, identity]);
|
|
374
|
-
} catch (error) {
|
|
375
|
-
if (error instanceof ResourceCompositionError) diagnostics.push(...error.diagnostics);
|
|
376
|
-
else throw error;
|
|
377
|
-
}
|
|
319
|
+
//#region ../resource-core/src/resource-material.ts
|
|
320
|
+
var ResourceMaterialError = class extends Error {
|
|
321
|
+
diagnostics;
|
|
322
|
+
constructor(diagnostics) {
|
|
323
|
+
super(`Resource material read failed with ${diagnostics.length} diagnostic(s)`);
|
|
324
|
+
this.name = "ResourceMaterialError";
|
|
325
|
+
this.diagnostics = Object.freeze([...diagnostics].sort((left, right) => compareCodeUnits(left.location, right.location) || compareCodeUnits(left.code, right.code)));
|
|
378
326
|
}
|
|
379
|
-
|
|
380
|
-
|
|
327
|
+
};
|
|
328
|
+
async function readResourceMaterial(input) {
|
|
329
|
+
if (!isLoadedResourceTreeAuthentic(input.tree)) throw materialError("RESOURCE_MATERIAL_TREE_UNTRUSTED", input.resourceId, "Resource materials require an authentic LoadedResourceTree.");
|
|
330
|
+
const record = findResource(input.tree, input.resourceId);
|
|
331
|
+
const identity = input.tree.contentIdentities.get(input.resourceId);
|
|
332
|
+
if (!record || record.sourceShape !== "directory" || !identity) throw materialError("RESOURCE_MATERIAL_RESOURCE_INVALID", input.resourceId, `Resource '${input.resourceId}' is not an authentic directory resource.`);
|
|
333
|
+
const materialPath = materialRelativePath(input.uri);
|
|
334
|
+
if (!materialPath) throw materialError("RESOURCE_MATERIAL_URI_INVALID", input.resourceId, "Resource material URI must be a non-empty lexical-safe vfs://./ reference.");
|
|
335
|
+
const requestedRoot = resolve(input.rootDir);
|
|
336
|
+
const root = await realpath(requestedRoot).catch(() => requestedRoot);
|
|
337
|
+
const authorityCandidate = resolve(root, record.logicalPath);
|
|
338
|
+
const authorityPath = await realpath(authorityCandidate).catch(() => authorityCandidate);
|
|
339
|
+
if (!contains(root, authorityPath) || record.documentUri !== documentUri(root, authorityPath) || sha256Digest(await readFile(authorityPath).catch(() => /* @__PURE__ */ new Uint8Array())) !== identity.authorityDigest) throw materialError("RESOURCE_MATERIAL_AUTHORITY_MISMATCH", input.resourceId, "Directory resource authority does not match the loaded tree provenance.");
|
|
340
|
+
const ownerDirectory = dirname(authorityPath);
|
|
341
|
+
const candidate = resolve(ownerDirectory, materialPath);
|
|
342
|
+
if (!contains(ownerDirectory, candidate)) throw materialError("RESOURCE_MATERIAL_URI_INVALID", input.resourceId, "Resource material URI escapes its owning directory resource.");
|
|
343
|
+
const before = await lstat(candidate).catch(() => void 0);
|
|
344
|
+
if (!before) throw materialError("RESOURCE_MATERIAL_MISSING", input.resourceId, `Resource material '${input.uri}' does not exist.`);
|
|
345
|
+
if (before.isSymbolicLink()) throw materialError("RESOURCE_MATERIAL_SYMLINK_UNSUPPORTED", input.resourceId, `Resource material '${input.uri}' must not be a symbolic link.`);
|
|
346
|
+
if (!before.isFile()) throw materialError("RESOURCE_MATERIAL_NOT_FILE", input.resourceId, `Resource material '${input.uri}' must be a regular file.`);
|
|
347
|
+
const canonicalPath = await realpath(candidate).catch(() => candidate);
|
|
348
|
+
if (!contains(ownerDirectory, canonicalPath)) throw materialError("RESOURCE_MATERIAL_CONTAINMENT", input.resourceId, `Resource material '${input.uri}' resolves outside its owning directory resource.`);
|
|
349
|
+
const source = await readFile(canonicalPath).catch(() => void 0);
|
|
350
|
+
const after = await lstat(candidate).catch(() => void 0);
|
|
351
|
+
const afterCanonical = await realpath(candidate).catch(() => void 0);
|
|
352
|
+
if (!source || !after || after.isSymbolicLink() || !after.isFile() || afterCanonical !== canonicalPath) throw materialError("RESOURCE_MATERIAL_CHANGED", input.resourceId, `Resource material '${input.uri}' changed while it was being read.`);
|
|
353
|
+
const bytes = new Uint8Array(source);
|
|
354
|
+
const digest = sha256Digest(bytes);
|
|
355
|
+
const sourceUri = documentUri(root, canonicalPath);
|
|
356
|
+
const contribution = Object.freeze({
|
|
357
|
+
key: `material:${input.uri}`,
|
|
358
|
+
digest,
|
|
359
|
+
sourceUri
|
|
360
|
+
});
|
|
361
|
+
return Object.freeze({
|
|
362
|
+
resourceId: input.resourceId,
|
|
363
|
+
uri: input.uri,
|
|
364
|
+
sourceUri,
|
|
365
|
+
digest,
|
|
366
|
+
contribution,
|
|
367
|
+
bytes: () => new Uint8Array(bytes)
|
|
368
|
+
});
|
|
381
369
|
}
|
|
382
|
-
function
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
391
|
-
const normalized = createResourceContentIdentity({
|
|
392
|
-
resourceId: identity.resourceId,
|
|
393
|
-
authorityDigest: identity.authorityDigest,
|
|
394
|
-
contributions: identity.contributions
|
|
395
|
-
});
|
|
396
|
-
if (identity.resourceId !== resource.resourceId || identity.contentDigest !== normalized.contentDigest) diagnostics.push(diagnostic("RESOURCE_CONTENT_IDENTITY_INVALID", layerLocation(void 0, layerId, resource.resourceId), `Loaded resource '${resource.resourceId}' has an inconsistent authority identity.`));
|
|
370
|
+
function materialRelativePath(uri) {
|
|
371
|
+
const match = /^vfs:\/\/\.\/(.+)$/u.exec(uri);
|
|
372
|
+
if (!match || /%2f|%5c/i.test(uri)) return void 0;
|
|
373
|
+
let decoded;
|
|
374
|
+
try {
|
|
375
|
+
decoded = decodeURIComponent(match[1]);
|
|
376
|
+
} catch {
|
|
377
|
+
return;
|
|
397
378
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
const origin = entry.effectiveOrigin;
|
|
402
|
-
const descriptor = registry.layers[origin.layerIndex];
|
|
403
|
-
const loadedRecord = findResource(tree, entry.resourceId);
|
|
404
|
-
if (!descriptor || descriptor.id !== origin.layerId || descriptor.packageId !== origin.packageId || tree.manifest.resourceId !== origin.packageId || !loadedRecord || loadedRecord.documentUri !== origin.documentUri || loadedRecord.logicalPath !== origin.logicalPath) diagnostics.push(diagnostic("RESOURCE_CONTENT_IDENTITY_EFFECTIVE_ORIGIN_MISMATCH", contentLocation(entry.resourceId), `Effective resource '${entry.resourceId}' does not match its exact layer/package/origin facts.`));
|
|
379
|
+
const segments = decoded.split(/[\\/]+/u);
|
|
380
|
+
if (isAbsolute(decoded) || decoded.includes("\\") || segments.some((segment) => !segment || segment === "." || segment === "..")) return void 0;
|
|
381
|
+
return segments.join(sep);
|
|
405
382
|
}
|
|
406
383
|
function findResource(tree, resourceId) {
|
|
407
384
|
for (const records of tree.registry.byKind.values()) {
|
|
408
|
-
const
|
|
409
|
-
if (
|
|
385
|
+
const record = records.find((item) => item.resourceId === resourceId);
|
|
386
|
+
if (record) return record;
|
|
410
387
|
}
|
|
411
388
|
}
|
|
412
|
-
function
|
|
413
|
-
return
|
|
389
|
+
function contains(boundary, candidate) {
|
|
390
|
+
return candidate === boundary || candidate.startsWith(`${boundary}${sep}`);
|
|
414
391
|
}
|
|
415
|
-
function
|
|
416
|
-
return
|
|
392
|
+
function documentUri(root, filePath) {
|
|
393
|
+
return `vfs://@/${relative(root, filePath).split(sep).join("/")}`;
|
|
417
394
|
}
|
|
418
|
-
function
|
|
419
|
-
return Object.freeze({
|
|
395
|
+
function materialError(code, resourceId, message) {
|
|
396
|
+
return new ResourceMaterialError([Object.freeze({
|
|
420
397
|
code,
|
|
421
|
-
location
|
|
398
|
+
location: `resource-material:${resourceId || "unknown"}`,
|
|
422
399
|
message
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
function layerLocation(index, layerId, resourceId) {
|
|
426
|
-
return `content-layer:${index ?? "unknown"}:${layerId}${resourceId === void 0 ? "" : `:${resourceId}`}`;
|
|
427
|
-
}
|
|
428
|
-
function contentLocation(resourceId) {
|
|
429
|
-
return `content:${resourceId || "unnamed"}`;
|
|
400
|
+
})]);
|
|
430
401
|
}
|
|
431
402
|
//#endregion
|
|
432
|
-
export {
|
|
403
|
+
export { ResourceCompositionError, ResourceMaterialError, ResourceValidationError, buildResourceDependencySnapshot, composeLayeredResourceRegistry, createResourceContentIdentity, loadResourceTree, readResourceMaterial, resolveEffectiveResourceContentIdentities, sha256Digest, validateResourceTree };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as resourceProjectionPackage, t as ResourceRegistry } from "./index-
|
|
1
|
+
import { n as resourceProjectionPackage, t as ResourceRegistry } from "./index-CF4nEkOi.js";
|
|
2
2
|
export { ResourceRegistry, resourceProjectionPackage };
|
package/dist/skill-capsule.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { I as SkillCapsuleDependency } from "./index-Cqh9pEBa.js";
|
|
2
|
-
import { S as skillCapsuleDistributionProjection, _ as applySkillCapsuleDistributionPlan, a as PlannedSkillCapsule, b as compilerSkillPackage, c as SkillCapsuleContentDigest, d as SkillCapsuleDistributionReceipt, f as SkillCapsuleIdentity, g as SkillReference, h as SkillDescriptor, i as PlanSkillCapsuleDistributionInput, l as SkillCapsuleDistributionError, m as SkillCapsuleProvenanceManifest, n as CompileResourceSkillCapsuleInput, o as PlannedSkillFile, p as SkillCapsulePlan, r as CompileSkillCapsuleInput, s as SkillCapsuleApplyStep, t as ApplySkillCapsuleDistributionOptions, u as SkillCapsuleDistributionPlan, v as compileResourceSkillCapsule, x as planSkillCapsuleDistribution, y as compileSkillCapsule } from "./index-
|
|
2
|
+
import { S as skillCapsuleDistributionProjection, _ as applySkillCapsuleDistributionPlan, a as PlannedSkillCapsule, b as compilerSkillPackage, c as SkillCapsuleContentDigest, d as SkillCapsuleDistributionReceipt, f as SkillCapsuleIdentity, g as SkillReference, h as SkillDescriptor, i as PlanSkillCapsuleDistributionInput, l as SkillCapsuleDistributionError, m as SkillCapsuleProvenanceManifest, n as CompileResourceSkillCapsuleInput, o as PlannedSkillFile, p as SkillCapsulePlan, r as CompileSkillCapsuleInput, s as SkillCapsuleApplyStep, t as ApplySkillCapsuleDistributionOptions, u as SkillCapsuleDistributionPlan, v as compileResourceSkillCapsule, x as planSkillCapsuleDistribution, y as compileSkillCapsule } from "./index-B515mMkO.js";
|
|
3
3
|
export { ApplySkillCapsuleDistributionOptions, CompileResourceSkillCapsuleInput, CompileSkillCapsuleInput, PlanSkillCapsuleDistributionInput, PlannedSkillCapsule, PlannedSkillFile, SkillCapsuleApplyStep, SkillCapsuleContentDigest, type SkillCapsuleDependency, SkillCapsuleDistributionError, SkillCapsuleDistributionPlan, SkillCapsuleDistributionReceipt, SkillCapsuleIdentity, SkillCapsulePlan, SkillCapsuleProvenanceManifest, SkillDescriptor, SkillReference, applySkillCapsuleDistributionPlan, compileResourceSkillCapsule, compileSkillCapsule, compilerSkillPackage, planSkillCapsuleDistribution, skillCapsuleDistributionProjection };
|
package/dist/skill-capsule.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as compilerSkillPackage, i as compileSkillCapsule, n as applySkillCapsuleDistributionPlan, o as planSkillCapsuleDistribution, r as compileResourceSkillCapsule, s as skillCapsuleDistributionProjection, t as SkillCapsuleDistributionError } from "./src-
|
|
1
|
+
import { a as compilerSkillPackage, i as compileSkillCapsule, n as applySkillCapsuleDistributionPlan, o as planSkillCapsuleDistribution, r as compileResourceSkillCapsule, s as skillCapsuleDistributionProjection, t as SkillCapsuleDistributionError } from "./src-CaQ25rMj.js";
|
|
2
2
|
export { SkillCapsuleDistributionError, applySkillCapsuleDistributionPlan, compileResourceSkillCapsule, compileSkillCapsule, compilerSkillPackage, planSkillCapsuleDistribution, skillCapsuleDistributionProjection };
|