技能 2026-10-13 07:54 UTC
skillxv0.4.1
版本【v0.4.1】由提交人 mrgoonie 提交,主要更新类型为:功能特性新增与扩展。提交说明:feat(contracts): signed skillx.release/v1 manifest, release status and migration 0011 (#58)。为项目引入了新的能力与模块支持。
Commit提交信息原文
feat(contracts): signed skillx.release/v1 manifest, release status and migration 0011 (#58) * feat(skill-tree): add agentkit.skill-tree/v1 digest, archive readers and identity rules Add @skillx/skill-tree, a TypeScript implementation of the AgentKit skill tree contract shared with the AgentKit CLI: - canonical serialization and sha256 tree digest - path, NFC and case-fold collision rules on Unicode 15.0.0 tables generated from pinned inputs, never runtime Intl data - streaming tar/tar.gz and zip readers with exact entry, file and byte limits enforced while content streams (pull-driven inflate) - package identity, alias and directory alias rules, provenance trust and frontmatter exposure The AgentKit conformance vectors are vendored unedited with a provenance note and sha256 drift tests; every tree and identity vector passes. Negative tests cover links, special entries, sparse files, unsafe modes and names, case collisions, damaged archives and decompression bombs. Refs #54 * ci(skill-tree): typecheck and test the skill tree package on pull requests The repository has no pull request CI yet, so run the package typecheck and its conformance suite when the package, the lockfile or the test config change. Refs #54 * fix(skill-tree): align tar, zip and NFC handling with the Go reference - NFC/NFD follow x/text stream-safe processing: a run of more than 30 non-starters gets a CGJ, so such a path is non-NFC; composition ports reorderBuffer.compose; counts and differential vectors come from Go - header modes outside a safe, non-negative 7-digit octal value are rejected before the type bits are cleared - zip entries with header faults or non-regular types are unsupported without inflating their data or counting toward file and byte limits - tar reads stay within a total byte budget covering non-regular data and PAX/GNU extension chains - GNU sparse files apply GNU.sparse.name, size and realsize and validate their maps as Go does; malformed maps fail with tree.read_failed - numeric and PAX parsing match Go: NUL-cut octal, negative base-256, signed and zero-padded PAX lengths, PAX times, all header numerics - an empty GNU long name clears an earlier one; PAX records live in a prototype-free object; non-safe sizes fail the limit step - collision keys fold each path once; vector harness asserts reader coverage * fix(skill-tree): normalize tar type NUL and scope the ingest overhead guard Rewrite type NUL from the merged name before sparse handling, as Go Reader.Next does, and use that type for the data length, the sparse header-only check and the entry kind. Check the raw header size for negativity before a PAX size overrides it. The tar byte budget now counts only bytes that are not hashed file content, at maxFiles x 64 KiB, and its detail names the ingest overhead guard. Document the guard and the nodejs_compat requirement. * test(skill-tree): cover type NUL directories named by merged metadata Pin that a type NUL entry whose trailing slash comes from a PAX path or a GNU long name reads no data, and keep the vector helper from writing data for a type NUL directory. * feat(skill-tree): add a rules entry point without Node imports Export the path, collision and identity rules from @skillx/skill-tree/rules so Worker code can validate manifests without pulling node:crypto or the archive readers into its program. * feat(contracts): add the signed skillx.release/v1 manifest contract Define the release manifest that pins a package version to its agentkit.skill-tree/v1 tree digest, a strict validator, byte-exact canonical JSON for the signing payload, and WebCrypto Ed25519 signing and fail-closed verification compatible with the AgentKit registry style. Ship cross-language vectors signed with a key derived from a public seed text, plus a skill-tree test that recomputes each vector's tree digest. * feat(web): add additive migration for release tree digests Add release_digest, file_count, tree_size, signed_manifest_key and quarantined_at to package_releases, packages.visibility and publishers.state with safe defaults, and a release digest index. The generator re-emitted the registry tables missing from the 0010 snapshot; the SQL keeps only the additive delta and records rollback SQL. * feat(contracts): sign release state in a separate status document Keep the skillx.release/v1 manifest immutable per release digest and move the mutable state into skillx.release-status/v1: release digest, state, optional reason, issuedAt, a strictly increasing sequence and the signing key, under the same canonical bytes and Ed25519 rules. Verification fails closed on an unknown state, a status for another release, a bad signature, a lower sequence (rollback) and a different status with the accepted sequence (conflict). Ship cross-language status vectors, regenerate the manifest vectors without state, and record the last status sequence and issue time in migration 0011. Document that a release without source provenance must be labeled provenance unknown. * feat(contracts): bind release status to one signed manifest The same tree can be released under several identities or versions, so a status keyed only by releaseDigest would apply to every sibling release. Add a required manifestDigest: the sha256 of the manifest signing payload, the exact bytes the manifest signature covers. Verification now rejects a status for another manifest with status.manifest_mismatch, and rollback and conflict checks track the sequence per manifest digest. Vectors list the signed manifests with their digests and cover one tree under two versions and a missing or wrong manifest digest. Document that the registry stores the full signed status document, so reason needs no database column. * feat(skill-tree): expose the pure tree serializer from the rules entry Move the agentkit.skill-tree/v1 serialization (header, per-file lines, UTF-8 path ordering) into a module without Node.js imports, and export serializeTree, compareUtf8 and sortFiles from @skillx/skill-tree/rules. Worker code can now render the exact digest bytes and hash them with WebCrypto. The root entry keeps treeDigest over node:crypto. * fix(contracts): harden release manifest and status verification Manifest: - sign and verify require releaseDigest to be the tree digest of files (release.tree_digest_mismatch), hashed with WebCrypto - verifiers take the received bytes and require them to equal the canonical JSON (release.non_canonical), rejecting duplicate members, number and escape variants, whitespace, BOM and invalid UTF-8 - release versions reject build metadata and leading zeros (max 128) - signatures must use the single canonical base64 text - validators reject non-plain objects and sparse arrays without throwing Status: - required expiresAt, at most 7 days after issuedAt; verify against a caller-supplied now (status.expired) and the verified manifest - issuedAt not before the manifest createdAt, later than the previous accepted status, and transitions enforced (status.invalid_transition) - reason bounded to 512 UTF-8 bytes without control, format, bidi or separator characters; non-canonical bytes rejected Signed-release fixtures leave the package root export. Vectors become received documents with one expected code each, add expiry, lifetime, transition, non-canonical and UTF-8 path ordering cases, and the docs describe the byte rules, expiry policy and registry-signed trust mapping. * fix(web): make the release tree digest rollback re-appliable Record the d1_migrations row removal in the 0011 rollback SQL so a later apply runs the migration again, and select migrations by name in its test so a future migration does not shift the 0010 baseline. * fix(contracts): reject future-dated release statuses and pin reason classes Reject a signed release status whose issuedAt is more than 300 seconds ahead of the consumer clock with status.not_yet_valid, checked after the signature like expiry, with vectors at and beyond the skew edge. Classify reason format characters with the pinned Unicode 15.0 tables that the tree path rules use, so every runtime agrees on the verdict. Add manifest and status vectors whose signature has non-zero unused base64 bits, rejected by the signature pattern although lenient decoders return the original bytes. Document that consumers must not map these releases to publisher trust, the 24 hour re-sign cadence under the 7 day cap, the issuer obligation to advance issuedAt, and the two-step quarantine lift.