@dot-skill/core 0.4.2 → 0.4.3
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/mint.js +13 -2
- package/package.json +2 -2
package/dist/mint.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
1
2
|
import { isValidAgentHost } from "@dot-skill/protocol";
|
|
2
3
|
import { canonicalize, sha256Digest } from "./hash.js";
|
|
3
4
|
import { packSkill, unpackSkill } from "./pack.js";
|
|
4
5
|
import { validatePackageBytes } from "./validate.js";
|
|
6
|
+
function loadCoreIdentity() {
|
|
7
|
+
const metadata = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
8
|
+
if (typeof metadata.name !== "string" || typeof metadata.version !== "string") {
|
|
9
|
+
throw new Error("Invalid @dot-skill/core package metadata");
|
|
10
|
+
}
|
|
11
|
+
return { name: metadata.name, version: metadata.version };
|
|
12
|
+
}
|
|
13
|
+
const CORE_IDENTITY = loadCoreIdentity();
|
|
5
14
|
/**
|
|
6
15
|
* Seal a draft package as minted.
|
|
7
16
|
* Content under signatures/ may change; package_digest (content) stays fixed after finalize.
|
|
@@ -39,6 +48,8 @@ export function mintSkillPackage(pkg, opts) {
|
|
|
39
48
|
});
|
|
40
49
|
const unpacked = unpackSkill(draftBytes);
|
|
41
50
|
const package_digest = unpacked.manifest.package_digest;
|
|
51
|
+
const agentRuntime = opts.agent_runtime ?? CORE_IDENTITY.name;
|
|
52
|
+
const agentVersion = opts.agent_version ?? (agentRuntime === CORE_IDENTITY.name ? CORE_IDENTITY.version : "unknown");
|
|
42
53
|
const attestation = {
|
|
43
54
|
kind: "creation_attestation",
|
|
44
55
|
package_digest,
|
|
@@ -46,8 +57,8 @@ export function mintSkillPackage(pkg, opts) {
|
|
|
46
57
|
skill_version: pkg.manifest.version,
|
|
47
58
|
minted_at: new Date().toISOString(),
|
|
48
59
|
agent: {
|
|
49
|
-
runtime:
|
|
50
|
-
version:
|
|
60
|
+
runtime: agentRuntime,
|
|
61
|
+
version: agentVersion,
|
|
51
62
|
key_id: opts.key_id ?? "dot-skill-dev-mint-key",
|
|
52
63
|
},
|
|
53
64
|
host: opts.host,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dot-skill/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Open .skill Protocol — pack, validate, compile, mint",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"clean": "rm -rf dist"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@dot-skill/protocol": "^0.4.
|
|
36
|
+
"@dot-skill/protocol": "^0.4.3",
|
|
37
37
|
"fflate": "^0.8.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|