@inupedia/spotlight-client 0.2.14 → 0.2.16

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.
Files changed (55) hide show
  1. package/dist/node/capabilities/skillFileValidator.d.ts +0 -8
  2. package/dist/node/capabilities/skillFileValidator.d.ts.map +1 -1
  3. package/dist/node/capabilities/skillFileValidator.js +26 -46
  4. package/dist/node/index.d.ts +0 -7
  5. package/dist/node/index.d.ts.map +1 -1
  6. package/dist/node/index.js +0 -6
  7. package/dist/vite/index.d.ts +0 -4
  8. package/dist/vite/index.d.ts.map +1 -1
  9. package/dist/vite/index.js +0 -3
  10. package/package.json +6 -8
  11. package/dist/node/capabilities/canonicalJson.d.ts +0 -7
  12. package/dist/node/capabilities/canonicalJson.d.ts.map +0 -1
  13. package/dist/node/capabilities/canonicalJson.js +0 -122
  14. package/dist/node/capabilities/capabilityArtifact.d.ts +0 -13
  15. package/dist/node/capabilities/capabilityArtifact.d.ts.map +0 -1
  16. package/dist/node/capabilities/capabilityArtifact.js +0 -31
  17. package/dist/node/capabilities/capabilityArtifactError.d.ts +0 -7
  18. package/dist/node/capabilities/capabilityArtifactError.d.ts.map +0 -1
  19. package/dist/node/capabilities/capabilityArtifactError.js +0 -19
  20. package/dist/node/capabilities/capabilityArtifactTypes.d.ts +0 -32
  21. package/dist/node/capabilities/capabilityArtifactTypes.d.ts.map +0 -1
  22. package/dist/node/capabilities/capabilityArtifactTypes.js +0 -1
  23. package/dist/node/capabilities/capabilityFileMap.d.ts +0 -17
  24. package/dist/node/capabilities/capabilityFileMap.d.ts.map +0 -1
  25. package/dist/node/capabilities/capabilityFileMap.js +0 -235
  26. package/dist/node/capabilities/deterministicGzip.d.ts +0 -2
  27. package/dist/node/capabilities/deterministicGzip.d.ts.map +0 -1
  28. package/dist/node/capabilities/deterministicGzip.js +0 -51
  29. package/dist/node/capabilities/deterministicTar.d.ts +0 -6
  30. package/dist/node/capabilities/deterministicTar.d.ts.map +0 -1
  31. package/dist/node/capabilities/deterministicTar.js +0 -137
  32. package/dist/node/capabilities/skillDirectoryLoader.d.ts +0 -24
  33. package/dist/node/capabilities/skillDirectoryLoader.d.ts.map +0 -1
  34. package/dist/node/capabilities/skillDirectoryLoader.js +0 -308
  35. package/dist/node/capabilities/toolManifest.d.ts +0 -12
  36. package/dist/node/capabilities/toolManifest.d.ts.map +0 -1
  37. package/dist/node/capabilities/toolManifest.js +0 -111
  38. package/dist/vite/capabilityBuild.d.ts +0 -9
  39. package/dist/vite/capabilityBuild.d.ts.map +0 -1
  40. package/dist/vite/capabilityBuild.js +0 -141
  41. package/dist/vite/capabilityBuildTypes.d.ts +0 -29
  42. package/dist/vite/capabilityBuildTypes.d.ts.map +0 -1
  43. package/dist/vite/capabilityBuildTypes.js +0 -1
  44. package/dist/vite/capabilityDevMiddleware.d.ts +0 -5
  45. package/dist/vite/capabilityDevMiddleware.d.ts.map +0 -1
  46. package/dist/vite/capabilityDevMiddleware.js +0 -40
  47. package/dist/vite/capabilityVirtualModule.d.ts +0 -11
  48. package/dist/vite/capabilityVirtualModule.d.ts.map +0 -1
  49. package/dist/vite/capabilityVirtualModule.js +0 -43
  50. package/dist/vite/capabilityVirtualModuleTypes.d.ts +0 -12
  51. package/dist/vite/capabilityVirtualModuleTypes.d.ts.map +0 -1
  52. package/dist/vite/capabilityVirtualModuleTypes.js +0 -1
  53. package/dist/vite/spotlightCapabilities.d.ts +0 -4
  54. package/dist/vite/spotlightCapabilities.d.ts.map +0 -1
  55. package/dist/vite/spotlightCapabilities.js +0 -165
@@ -5,13 +5,5 @@ export type ValidateScannedSkillInput = {
5
5
  skill: ScannedSkill;
6
6
  mode?: "strict" | "compat";
7
7
  };
8
- export type ValidateSkillContentInput = {
9
- skill: ScannedSkill;
10
- markdown: string;
11
- mode?: "strict" | "compat";
12
- skillRoot: string;
13
- readReference: (relativePath: string) => Promise<Uint8Array | undefined>;
14
- };
15
- export declare function validateSkillContent(input: ValidateSkillContentInput): Promise<AgentSkillValidationResult>;
16
8
  export declare function validateScannedSkill(input: ValidateScannedSkillInput): Promise<AgentSkillValidationResult>;
17
9
  //# sourceMappingURL=skillFileValidator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"skillFileValidator.d.ts","sourceRoot":"","sources":["../../../src/node/capabilities/skillFileValidator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,qBAAqB,CAAC;AAO7B,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,CACb,YAAY,EAAE,MAAM,KACjB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;CACtC,CAAC;AA2FF,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,0BAA0B,CAAC,CAiCrC;AAED,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,0BAA0B,CAAC,CA+BrC"}
1
+ {"version":3,"file":"skillFileValidator.d.ts","sourceRoot":"","sources":["../../../src/node/capabilities/skillFileValidator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,qBAAqB,CAAC;AAO7B,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC5B,CAAC;AAiGF,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,0BAA0B,CAAC,CAmCrC"}
@@ -28,37 +28,48 @@ function isWithin(root, candidate) {
28
28
  return (relativePath === "" ||
29
29
  (!relativePath.startsWith("..") && !isAbsolute(relativePath)));
30
30
  }
31
- function warning(skill, code, message) {
31
+ function warning(input, code, message) {
32
32
  return {
33
33
  code,
34
34
  severity: "warning",
35
35
  message,
36
- skillFile: skill.skillFile,
36
+ skillFile: input.skill.skillFile,
37
37
  };
38
38
  }
39
- async function referenceWarnings(input, markdown) {
40
- const skillRoot = resolve(input.skillRoot);
39
+ async function referenceWarnings(input, markdown, skillPath) {
40
+ const skillRoot = dirname(skillPath);
41
41
  const diagnostics = [];
42
42
  for (const link of extractRelativeMarkdownLinks(markdown)) {
43
43
  const target = resolve(skillRoot, link);
44
44
  if (!isWithin(skillRoot, target)) {
45
- diagnostics.push(warning(input.skill, "SKILL_REFERENCE_OUTSIDE_ROOT", `Markdown reference "${link}" resolves outside the Skill root.`));
45
+ diagnostics.push(warning(input, "SKILL_REFERENCE_OUTSIDE_ROOT", `Markdown reference "${link}" resolves outside the Skill root.`));
46
46
  continue;
47
47
  }
48
- const referencedBytes = await input.readReference(relative(skillRoot, target));
49
- if (referencedBytes === undefined ||
50
- referencedBytes.byteLength > MAX_REFERENCE_BYTES) {
48
+ let stats;
49
+ try {
50
+ stats = await lstat(target);
51
+ }
52
+ catch (error) {
53
+ if (error.code === "ENOENT")
54
+ continue;
55
+ throw error;
56
+ }
57
+ if (!stats.isFile() ||
58
+ stats.isSymbolicLink() ||
59
+ stats.size > MAX_REFERENCE_BYTES) {
51
60
  continue;
52
61
  }
53
- const referencedMarkdown = Buffer.from(referencedBytes).toString("utf8");
62
+ const referencedMarkdown = await readFile(target, "utf8");
54
63
  if (extractRelativeMarkdownLinks(referencedMarkdown).length > 0) {
55
- diagnostics.push(warning(input.skill, "SKILL_REFERENCE_CHAIN_DEEP", `Markdown reference "${link}" links to another Markdown reference.`));
64
+ diagnostics.push(warning(input, "SKILL_REFERENCE_CHAIN_DEEP", `Markdown reference "${link}" links to another Markdown reference.`));
56
65
  }
57
66
  }
58
67
  return diagnostics;
59
68
  }
60
- export async function validateSkillContent(input) {
61
- const markdown = input.markdown.replace(/\r\n?/g, "\n");
69
+ export async function validateScannedSkill(input) {
70
+ const projectRoot = resolve(input.projectRoot);
71
+ const skillPath = resolve(projectRoot, input.skill.skillFile);
72
+ const markdown = (await readFile(skillPath, "utf8")).replace(/\r\n?/g, "\n");
62
73
  const result = validateAgentSkillMarkdown({
63
74
  directoryName: input.skill.name,
64
75
  skillFile: input.skill.skillFile,
@@ -69,42 +80,11 @@ export async function validateSkillContent(input) {
69
80
  const lineCount = markdown.split("\n").length;
70
81
  const estimatedTokens = Math.ceil(markdown.length / 4);
71
82
  if (lineCount > 500) {
72
- diagnostics.push(warning(input.skill, "SKILL_RECOMMENDATION_LINES", `SKILL.md contains ${lineCount} lines; the Agent Skills recommendation is at most 500.`));
83
+ diagnostics.push(warning(input, "SKILL_RECOMMENDATION_LINES", `SKILL.md contains ${lineCount} lines; the Agent Skills recommendation is at most 500.`));
73
84
  }
74
85
  if (estimatedTokens > 5_000) {
75
- diagnostics.push(warning(input.skill, "SKILL_RECOMMENDATION_TOKENS", `SKILL.md has a deterministic estimate of ${estimatedTokens} tokens; the recommendation is at most 5000.`));
86
+ diagnostics.push(warning(input, "SKILL_RECOMMENDATION_TOKENS", `SKILL.md has a deterministic estimate of ${estimatedTokens} tokens; the recommendation is at most 5000.`));
76
87
  }
77
- diagnostics.push(...(await referenceWarnings(input, markdown)));
88
+ diagnostics.push(...(await referenceWarnings(input, markdown, skillPath)));
78
89
  return { ...result, diagnostics };
79
90
  }
80
- export async function validateScannedSkill(input) {
81
- const projectRoot = resolve(input.projectRoot);
82
- const skillPath = resolve(projectRoot, input.skill.skillFile);
83
- const skillRoot = dirname(skillPath);
84
- const markdown = await readFile(skillPath, "utf8");
85
- return validateSkillContent({
86
- skill: input.skill,
87
- markdown,
88
- mode: input.mode,
89
- skillRoot,
90
- async readReference(relativePath) {
91
- const target = resolve(skillRoot, relativePath);
92
- let stats;
93
- try {
94
- stats = await lstat(target);
95
- }
96
- catch (error) {
97
- if (error.code === "ENOENT") {
98
- return undefined;
99
- }
100
- throw error;
101
- }
102
- if (!stats.isFile() ||
103
- stats.isSymbolicLink() ||
104
- stats.size > MAX_REFERENCE_BYTES) {
105
- return undefined;
106
- }
107
- return readFile(target);
108
- },
109
- });
110
- }
@@ -1,13 +1,6 @@
1
1
  export { joinSkillScriptPath, type SkillScriptRunResult, } from "../skillScriptPath.js";
2
2
  export { createNodeSkillScriptRunner } from "./skillScriptRunner.js";
3
3
  export { DEFAULT_SKILL_ROOTS, scanProjectSkills, type ScanProjectSkillsOptions, type ScannedSkill, type SkillRootInput, type SkillScanDiagnostic, type SkillScanMode, type SkillScanResult, } from "./capabilities/skillScanner.js";
4
- export { CAPABILITY_SKILL_LIMITS_V1, CapabilitySkillLoadErrorV1, loadCanonicalSkillsV1, type CapabilitySkillLoadErrorCodeV1, type LoadCanonicalSkillsInputV1, type LoadedCanonicalSkillsV1, } from "./capabilities/skillDirectoryLoader.js";
5
4
  export { validateAgentSkillMarkdown, type AgentSkillDiagnostic, type AgentSkillDiagnosticCode, type AgentSkillDiagnosticSeverity, type AgentSkillValidationResult, type ValidatedAgentSkill, type ValidateAgentSkillMarkdownInput, } from "./capabilities/skillValidator.js";
6
5
  export { validateScannedSkill, type ValidateScannedSkillInput, } from "./capabilities/skillFileValidator.js";
7
- export { buildCapabilityArtifactV1, type CapabilityArtifactBuildV1, } from "./capabilities/capabilityArtifact.js";
8
- export { buildCapabilityFileMapV1, computeArtifactDigestV1, type BuiltCapabilityFileMapV1, } from "./capabilities/capabilityFileMap.js";
9
- export { CAPABILITY_ARTIFACT_ERROR_CODES, CapabilityArtifactError, type CapabilityArtifactErrorCode, } from "./capabilities/capabilityArtifactError.js";
10
- export type { CanonicalSkillFileInputV1, CanonicalSkillInputV1, CapabilityArtifactInputV1, CapabilityFileManifestEntryV1, CapabilityFileManifestV1, CapabilityPayloadFileV1, } from "./capabilities/capabilityArtifactTypes.js";
11
- export { canonicalizeJson, compareUtf16, type CanonicalJsonValue, } from "./capabilities/canonicalJson.js";
12
- export { buildToolManifestV1, type BuiltToolManifestV1, type ToolManifestV1, } from "./capabilities/toolManifest.js";
13
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,qBAAqB,EACrB,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,+BAA+B,GACrC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,GAC/B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,yBAAyB,EACzB,KAAK,yBAAyB,GAC/B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,+BAA+B,EAC/B,uBAAuB,EACvB,KAAK,2BAA2B,GACjC,MAAM,2CAA2C,CAAC;AACnD,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,EAC7B,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,KAAK,kBAAkB,GACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,cAAc,GACpB,MAAM,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,+BAA+B,GACrC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,GAC/B,MAAM,sCAAsC,CAAC"}
@@ -1,11 +1,5 @@
1
1
  export { joinSkillScriptPath, } from "../skillScriptPath.js";
2
2
  export { createNodeSkillScriptRunner } from "./skillScriptRunner.js";
3
3
  export { DEFAULT_SKILL_ROOTS, scanProjectSkills, } from "./capabilities/skillScanner.js";
4
- export { CAPABILITY_SKILL_LIMITS_V1, CapabilitySkillLoadErrorV1, loadCanonicalSkillsV1, } from "./capabilities/skillDirectoryLoader.js";
5
4
  export { validateAgentSkillMarkdown, } from "./capabilities/skillValidator.js";
6
5
  export { validateScannedSkill, } from "./capabilities/skillFileValidator.js";
7
- export { buildCapabilityArtifactV1, } from "./capabilities/capabilityArtifact.js";
8
- export { buildCapabilityFileMapV1, computeArtifactDigestV1, } from "./capabilities/capabilityFileMap.js";
9
- export { CAPABILITY_ARTIFACT_ERROR_CODES, CapabilityArtifactError, } from "./capabilities/capabilityArtifactError.js";
10
- export { canonicalizeJson, compareUtf16, } from "./capabilities/canonicalJson.js";
11
- export { buildToolManifestV1, } from "./capabilities/toolManifest.js";
@@ -1,8 +1,4 @@
1
1
  import type { SpotlightAgentIocOptions } from "./spotlightAgentIoc.js";
2
- import "./capabilityVirtualModuleTypes.js";
3
2
  export type { SpotlightAgentIocOptions };
4
- export { spotlightCapabilities } from "./spotlightCapabilities.js";
5
- export type { CapabilityBuildInfoV1, CapabilityPluginBuildResultV1, SpotlightCapabilitiesOptionsV1, SpotlightCapabilityProjectBuildV1, } from "./capabilityBuildTypes.js";
6
- export { RESOLVED_SPOTLIGHT_CAPABILITIES_MODULE_ID, SPOTLIGHT_CAPABILITIES_MODULE_ID, } from "./capabilityVirtualModule.js";
7
3
  export { transformSpotlightAgentIoc, default, } from "./spotlightAgentIoc.js";
8
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,mCAAmC,CAAC;AAE3C,YAAY,EAAE,wBAAwB,EAAE,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EACV,qBAAqB,EACrB,6BAA6B,EAC7B,8BAA8B,EAC9B,iCAAiC,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yCAAyC,EACzC,gCAAgC,GACjC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,0BAA0B,EAC1B,OAAO,GACR,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,YAAY,EAAE,wBAAwB,EAAE,CAAC;AAEzC,OAAO,EACL,0BAA0B,EAC1B,OAAO,GACR,MAAM,wBAAwB,CAAC"}
@@ -1,4 +1 @@
1
- import "./capabilityVirtualModuleTypes.js";
2
- export { spotlightCapabilities } from "./spotlightCapabilities.js";
3
- export { RESOLVED_SPOTLIGHT_CAPABILITIES_MODULE_ID, SPOTLIGHT_CAPABILITIES_MODULE_ID, } from "./capabilityVirtualModule.js";
4
1
  export { transformSpotlightAgentIoc, default, } from "./spotlightAgentIoc.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inupedia/spotlight-client",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "description": "HTTP/SSE helpers and host tool bridge for Inupedia Spotlight (monorepo workspace package)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -11,8 +11,8 @@
11
11
  "import": "./dist/index.js"
12
12
  },
13
13
  "./vite": {
14
- "types": "./dist/vite/index.d.ts",
15
- "import": "./dist/vite/index.js"
14
+ "types": "./dist/vite/spotlightAgentIoc.d.ts",
15
+ "import": "./dist/vite/spotlightAgentIoc.js"
16
16
  },
17
17
  "./node": {
18
18
  "types": "./dist/node/index.d.ts",
@@ -39,11 +39,9 @@
39
39
  "@babel/parser": "^7.28.5",
40
40
  "@babel/traverse": "^7.28.5",
41
41
  "@babel/types": "^7.28.5",
42
- "canonicalize": "3.0.0",
43
- "fflate": "0.8.3",
44
42
  "magic-string": "^0.30.21",
45
43
  "yaml": "^2.8.4",
46
- "@inupedia/spotlight-protocol": "0.2.14"
44
+ "@inupedia/spotlight-protocol": "0.2.16"
47
45
  },
48
46
  "peerDependencies": {
49
47
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
@@ -57,8 +55,8 @@
57
55
  "@types/babel__traverse": "^7.28.0",
58
56
  "@types/node": "^24.10.1",
59
57
  "typescript": "^5.9.3",
60
- "vite": "^7.3.1",
61
- "vitest": "^4.0.18"
58
+ "vitest": "^4.0.18",
59
+ "vite": "^7.3.1"
62
60
  },
63
61
  "scripts": {
64
62
  "clean": "rm -rf dist",
@@ -1,7 +0,0 @@
1
- export type CanonicalJsonValue = null | boolean | number | string | CanonicalJsonValue[] | {
2
- [key: string]: CanonicalJsonValue;
3
- };
4
- export declare function compareUtf16(left: string, right: string): number;
5
- export declare function containsLoneSurrogate(value: string): boolean;
6
- export declare function canonicalizeJson(value: unknown): Uint8Array;
7
- //# sourceMappingURL=canonicalJson.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"canonicalJson.d.ts","sourceRoot":"","sources":["../../../src/node/capabilities/canonicalJson.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,kBAAkB,GAC1B,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,kBAAkB,EAAE,GACpB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAA;CAAE,CAAC;AAI1C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAa5D;AAkJD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAW3D"}
@@ -1,122 +0,0 @@
1
- import canonicalize from "canonicalize";
2
- import { isProxy } from "node:util/types";
3
- import { CapabilityArtifactError } from "./capabilityArtifactError.js";
4
- const textEncoder = new TextEncoder();
5
- export function compareUtf16(left, right) {
6
- if (left === right)
7
- return 0;
8
- return left < right ? -1 : 1;
9
- }
10
- export function containsLoneSurrogate(value) {
11
- for (let index = 0; index < value.length; index += 1) {
12
- const code = value.charCodeAt(index);
13
- if (code >= 0xd800 && code <= 0xdbff) {
14
- if (index + 1 >= value.length)
15
- return true;
16
- const next = value.charCodeAt(index + 1);
17
- if (next < 0xdc00 || next > 0xdfff)
18
- return true;
19
- index += 1;
20
- continue;
21
- }
22
- if (code >= 0xdc00 && code <= 0xdfff)
23
- return true;
24
- }
25
- return false;
26
- }
27
- function fail(code, path, reason) {
28
- throw new CapabilityArtifactError(code, `${path}: ${reason}`);
29
- }
30
- function validateString(value, path) {
31
- if (containsLoneSurrogate(value)) {
32
- fail("ARTIFACT_JSON_NOT_IJSON", path, "contains a lone surrogate");
33
- }
34
- }
35
- function validateArray(value, path, stack) {
36
- const ownKeys = Reflect.ownKeys(value);
37
- const indexedKeys = [];
38
- for (const key of ownKeys) {
39
- if (key === "length")
40
- continue;
41
- const index = typeof key === "string" ? Number(key) : Number.NaN;
42
- if (typeof key !== "string" ||
43
- !/^(?:0|[1-9]\d*)$/.test(key) ||
44
- !Number.isInteger(index) ||
45
- index < 0 ||
46
- index > 0xfffffffe ||
47
- String(index) !== key) {
48
- fail("ARTIFACT_JSON_UNSUPPORTED_VALUE", path, "array contains a non-index property");
49
- }
50
- indexedKeys.push(key);
51
- }
52
- if (indexedKeys.length !== value.length) {
53
- fail("ARTIFACT_JSON_UNSUPPORTED_VALUE", path, "sparse array entries are not supported");
54
- }
55
- for (const key of indexedKeys) {
56
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
57
- if (!descriptor?.enumerable || !("value" in descriptor)) {
58
- fail("ARTIFACT_JSON_UNSUPPORTED_VALUE", `${path}[${key}]`, "accessor and non-enumerable array entries are not supported");
59
- }
60
- validateJsonValue(descriptor.value, `${path}[${key}]`, stack);
61
- }
62
- }
63
- function validateObject(value, path, stack) {
64
- const prototype = Object.getPrototypeOf(value);
65
- if (prototype !== Object.prototype && prototype !== null) {
66
- fail("ARTIFACT_JSON_UNSUPPORTED_VALUE", path, "only plain JSON objects are supported");
67
- }
68
- for (const key of Reflect.ownKeys(value)) {
69
- if (typeof key !== "string") {
70
- fail("ARTIFACT_JSON_UNSUPPORTED_VALUE", path, "symbol-keyed properties are not supported");
71
- }
72
- validateString(key, `${path} property name`);
73
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
74
- if (!descriptor?.enumerable || !("value" in descriptor)) {
75
- fail("ARTIFACT_JSON_UNSUPPORTED_VALUE", `${path}.${key}`, "accessor and non-enumerable properties are not supported");
76
- }
77
- validateJsonValue(descriptor.value, `${path}.${key}`, stack);
78
- }
79
- }
80
- function validateJsonValue(value, path, stack) {
81
- if (value === null || typeof value === "boolean")
82
- return;
83
- if (typeof value === "string") {
84
- validateString(value, path);
85
- return;
86
- }
87
- if (typeof value === "number") {
88
- if (!Number.isFinite(value)) {
89
- fail("ARTIFACT_JSON_NOT_IJSON", path, "number must be finite");
90
- }
91
- return;
92
- }
93
- if (typeof value !== "object") {
94
- fail("ARTIFACT_JSON_UNSUPPORTED_VALUE", path, `unsupported value type ${typeof value}`);
95
- }
96
- if (isProxy(value)) {
97
- fail("ARTIFACT_JSON_UNSUPPORTED_VALUE", path, "Proxy values are not supported");
98
- }
99
- if (stack.has(value)) {
100
- fail("ARTIFACT_JSON_UNSUPPORTED_VALUE", path, "cyclic value graph");
101
- }
102
- stack.add(value);
103
- try {
104
- if (Array.isArray(value)) {
105
- validateArray(value, path, stack);
106
- }
107
- else {
108
- validateObject(value, path, stack);
109
- }
110
- }
111
- finally {
112
- stack.delete(value);
113
- }
114
- }
115
- export function canonicalizeJson(value) {
116
- validateJsonValue(value, "$", new WeakSet());
117
- const serialized = canonicalize(value);
118
- if (serialized === undefined) {
119
- fail("ARTIFACT_JSON_UNSUPPORTED_VALUE", "$", "canonicalizer returned no JSON output");
120
- }
121
- return textEncoder.encode(serialized);
122
- }
@@ -1,13 +0,0 @@
1
- import type { CapabilityArtifactInputV1 } from "./capabilityArtifactTypes.js";
2
- export interface CapabilityArtifactBuildV1 {
3
- artifactVersion: "spotlight.capability-artifact/1";
4
- artifactDigest: string;
5
- manifestDigest: string;
6
- toolManifestDigest: string;
7
- byteLength: number;
8
- archive: Uint8Array;
9
- manifestBytes: Uint8Array;
10
- toolManifestBytes: Uint8Array;
11
- }
12
- export declare function buildCapabilityArtifactV1(input: CapabilityArtifactInputV1): CapabilityArtifactBuildV1;
13
- //# sourceMappingURL=capabilityArtifact.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"capabilityArtifact.d.ts","sourceRoot":"","sources":["../../../src/node/capabilities/capabilityArtifact.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAK9E,MAAM,WAAW,yBAAyB;IACxC,eAAe,EAAE,iCAAiC,CAAC;IACnD,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,UAAU,CAAC;IACpB,aAAa,EAAE,UAAU,CAAC;IAC1B,iBAAiB,EAAE,UAAU,CAAC;CAC/B;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,yBAAyB,GAC/B,yBAAyB,CA2B3B"}
@@ -1,31 +0,0 @@
1
- import { buildCapabilityFileMapV1, computeArtifactDigestV1, } from "./capabilityFileMap.js";
2
- import { encodeDeterministicGzipV1 } from "./deterministicGzip.js";
3
- import { encodeDeterministicUstarV1 } from "./deterministicTar.js";
4
- import { buildToolManifestV1 } from "./toolManifest.js";
5
- export function buildCapabilityArtifactV1(input) {
6
- const toolManifest = buildToolManifestV1(input.tools);
7
- const fileMap = buildCapabilityFileMapV1({
8
- skills: input.skills,
9
- toolManifestBytes: toolManifest.bytes,
10
- });
11
- const artifactDigest = computeArtifactDigestV1({
12
- manifestDigest: fileMap.manifestDigest,
13
- toolManifestDigest: toolManifest.digest,
14
- payloads: fileMap.payloads,
15
- });
16
- const tar = encodeDeterministicUstarV1([
17
- { path: "manifest.json", bytes: fileMap.manifestBytes },
18
- ...fileMap.payloads.map(({ path, bytes }) => ({ path, bytes })),
19
- ]);
20
- const archive = encodeDeterministicGzipV1(tar);
21
- return {
22
- artifactVersion: "spotlight.capability-artifact/1",
23
- artifactDigest,
24
- manifestDigest: fileMap.manifestDigest,
25
- toolManifestDigest: toolManifest.digest,
26
- byteLength: archive.byteLength,
27
- archive,
28
- manifestBytes: Uint8Array.from(fileMap.manifestBytes),
29
- toolManifestBytes: Uint8Array.from(toolManifest.bytes),
30
- };
31
- }
@@ -1,7 +0,0 @@
1
- export declare const CAPABILITY_ARTIFACT_ERROR_CODES: readonly ["ARTIFACT_JSON_NOT_IJSON", "ARTIFACT_JSON_UNSUPPORTED_VALUE", "ARTIFACT_INPUT_INVALID", "ARTIFACT_TOOL_DUPLICATE", "ARTIFACT_TOOL_INVALID", "ARTIFACT_PATH_INVALID", "ARTIFACT_PATH_DUPLICATE", "ARTIFACT_PATH_USTAR_UNREPRESENTABLE", "ARTIFACT_SIZE_OVERFLOW"];
2
- export type CapabilityArtifactErrorCode = (typeof CAPABILITY_ARTIFACT_ERROR_CODES)[number];
3
- export declare class CapabilityArtifactError extends Error {
4
- readonly code: CapabilityArtifactErrorCode;
5
- constructor(code: CapabilityArtifactErrorCode, message: string);
6
- }
7
- //# sourceMappingURL=capabilityArtifactError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"capabilityArtifactError.d.ts","sourceRoot":"","sources":["../../../src/node/capabilities/capabilityArtifactError.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,+BAA+B,4QAUlC,CAAC;AAEX,MAAM,MAAM,2BAA2B,GACrC,CAAC,OAAO,+BAA+B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,EAAE,2BAA2B,CAAC;gBAE/B,IAAI,EAAE,2BAA2B,EAAE,OAAO,EAAE,MAAM;CAK/D"}
@@ -1,19 +0,0 @@
1
- export const CAPABILITY_ARTIFACT_ERROR_CODES = [
2
- "ARTIFACT_JSON_NOT_IJSON",
3
- "ARTIFACT_JSON_UNSUPPORTED_VALUE",
4
- "ARTIFACT_INPUT_INVALID",
5
- "ARTIFACT_TOOL_DUPLICATE",
6
- "ARTIFACT_TOOL_INVALID",
7
- "ARTIFACT_PATH_INVALID",
8
- "ARTIFACT_PATH_DUPLICATE",
9
- "ARTIFACT_PATH_USTAR_UNREPRESENTABLE",
10
- "ARTIFACT_SIZE_OVERFLOW",
11
- ];
12
- export class CapabilityArtifactError extends Error {
13
- code;
14
- constructor(code, message) {
15
- super(message);
16
- this.name = "CapabilityArtifactError";
17
- this.code = code;
18
- }
19
- }
@@ -1,32 +0,0 @@
1
- import type { FrontendToolDescriptorV1 } from "@inupedia/spotlight-protocol";
2
- export interface CanonicalSkillFileInputV1 {
3
- relativePath: string;
4
- bytes: Uint8Array;
5
- mediaType?: string;
6
- }
7
- export interface CanonicalSkillInputV1 {
8
- name: string;
9
- files: CanonicalSkillFileInputV1[];
10
- }
11
- export interface CapabilityArtifactInputV1 {
12
- skills: CanonicalSkillInputV1[];
13
- tools: FrontendToolDescriptorV1[];
14
- }
15
- export interface CapabilityPayloadFileV1 {
16
- path: string;
17
- bytes: Uint8Array;
18
- sha256: string;
19
- byteLength: number;
20
- mediaType: string;
21
- }
22
- export interface CapabilityFileManifestEntryV1 {
23
- path: string;
24
- sha256: string;
25
- byteLength: number;
26
- mediaType: string;
27
- }
28
- export interface CapabilityFileManifestV1 {
29
- schemaVersion: "spotlight.capability-manifest/1";
30
- files: CapabilityFileManifestEntryV1[];
31
- }
32
- //# sourceMappingURL=capabilityArtifactTypes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"capabilityArtifactTypes.d.ts","sourceRoot":"","sources":["../../../src/node/capabilities/capabilityArtifactTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAE7E,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,yBAAyB,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAChC,KAAK,EAAE,wBAAwB,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,iCAAiC,CAAC;IACjD,KAAK,EAAE,6BAA6B,EAAE,CAAC;CACxC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,17 +0,0 @@
1
- import type { CanonicalSkillInputV1, CapabilityFileManifestV1, CapabilityPayloadFileV1 } from "./capabilityArtifactTypes.js";
2
- export interface BuiltCapabilityFileMapV1 {
3
- payloads: CapabilityPayloadFileV1[];
4
- manifest: CapabilityFileManifestV1;
5
- manifestBytes: Uint8Array;
6
- manifestDigest: string;
7
- }
8
- export declare function buildCapabilityFileMapV1(input: {
9
- skills: CanonicalSkillInputV1[];
10
- toolManifestBytes: Uint8Array;
11
- }): BuiltCapabilityFileMapV1;
12
- export declare function computeArtifactDigestV1(input: {
13
- manifestDigest: string;
14
- toolManifestDigest: string;
15
- payloads: Array<Pick<CapabilityPayloadFileV1, "path" | "sha256">>;
16
- }): string;
17
- //# sourceMappingURL=capabilityFileMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"capabilityFileMap.d.ts","sourceRoot":"","sources":["../../../src/node/capabilities/capabilityFileMap.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,8BAA8B,CAAC;AA+BtC,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,uBAAuB,EAAE,CAAC;IACpC,QAAQ,EAAE,wBAAwB,CAAC;IACnC,aAAa,EAAE,UAAU,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB;AAoLD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAChC,iBAAiB,EAAE,UAAU,CAAC;CAC/B,GAAG,wBAAwB,CAqF3B;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,uBAAuB,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC;CACnE,GAAG,MAAM,CA2BT"}