@capyclaw/publisher 0.0.0-stage → 0.1.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/README.md +112 -2
- package/client/client.js +717 -0
- package/cordis.patch.yml +13 -0
- package/icon.svg +6 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/node_modules/@capyclaw/foundation/README.md +51 -0
- package/node_modules/@capyclaw/foundation/abi/bridge.mjs +86 -0
- package/node_modules/@capyclaw/foundation/abi/errors.mjs +63 -0
- package/node_modules/@capyclaw/foundation/abi/index.mjs +35 -0
- package/node_modules/@capyclaw/foundation/abi/kinds.mjs +271 -0
- package/node_modules/@capyclaw/foundation/abi/loader.mjs +345 -0
- package/node_modules/@capyclaw/foundation/abi/schema.mjs +98 -0
- package/node_modules/@capyclaw/foundation/abi/spec.mjs +255 -0
- package/node_modules/@capyclaw/foundation/abi/validate.mjs +24 -0
- package/node_modules/@capyclaw/foundation/abi/version.mjs +82 -0
- package/node_modules/@capyclaw/foundation/cordis.patch.yml +5 -0
- package/node_modules/@capyclaw/foundation/kit/index.mjs +6 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/client-panel.mjs +98 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/host-event.mjs +35 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/http-router.mjs +69 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +55 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/own-server.mjs +113 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +68 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +113 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/service-provider.mjs +77 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/skill-provider.mjs +56 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/tool-provider.mjs +50 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/ui-panel.mjs +64 -0
- package/node_modules/@capyclaw/foundation/lib/ctx-service.mjs +42 -0
- package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +34 -0
- package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +85 -0
- package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +50 -0
- package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +160 -0
- package/node_modules/@capyclaw/foundation/lib/host.mjs +23 -0
- package/node_modules/@capyclaw/foundation/lib/kernel.mjs +185 -0
- package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +87 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/events.mjs +60 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/log.mjs +51 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +188 -0
- package/node_modules/@capyclaw/foundation/package.json +53 -0
- package/node_modules/@capyclaw/foundation/runtime/index.mjs +20 -0
- package/node_modules/@capyclaw/plugin-kit/INTEGRATION.md +100 -0
- package/node_modules/@capyclaw/plugin-kit/README.md +70 -0
- package/node_modules/@capyclaw/plugin-kit/bin/sync.mjs +103 -0
- package/node_modules/@capyclaw/plugin-kit/package.json +69 -0
- package/node_modules/@capyclaw/plugin-kit/src/cli.mjs +56 -0
- package/node_modules/@capyclaw/plugin-kit/src/config.mjs +142 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +129 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +139 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/shadow.mjs +219 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/transport.js +13 -0
- package/node_modules/@capyclaw/plugin-kit/src/index.mjs +13 -0
- package/node_modules/@capyclaw/plugin-kit/src/pack.mjs +230 -0
- package/node_modules/@capyclaw/plugin-kit/src/runtime/context.mjs +128 -0
- package/node_modules/@capyclaw/plugin-kit/src/self-contained.mjs +307 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/api.mjs +45 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/http.mjs +113 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/mcp-http.mjs +150 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/server.mjs +131 -0
- package/node_modules/@capyclaw/plugin-kit/src/skills/provider.mjs +82 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/blob-store.mjs +109 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/content-store.mjs +17 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/journal-store.mjs +89 -0
- package/node_modules/@capyclaw/plugin-kit/src/tools/result.mjs +57 -0
- package/node_modules/@capyclaw/plugin-kit/src/tools/validate.mjs +150 -0
- package/node_modules/@capyclaw/plugin-kit/src/tuning.mjs +82 -0
- package/node_modules/@capyclaw/plugin-kit/src/util/fs-lock.mjs +132 -0
- package/node_modules/@capyclaw/plugin-kit/src/util/http.mjs +130 -0
- package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +656 -0
- package/node_modules/@capyclaw/plugin-kit/src/zip.mjs +181 -0
- package/node_modules/@capyclaw/plugin-validator/bin/cli.mjs +49 -0
- package/node_modules/@capyclaw/plugin-validator/lib/index.mjs +303 -0
- package/node_modules/@capyclaw/plugin-validator/package.json +28 -0
- package/node_modules/@capyclaw/tool-host/README.md +56 -0
- package/node_modules/@capyclaw/tool-host/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/tool-host/dsh-suite.json +30 -0
- package/node_modules/@capyclaw/tool-host/lib/host.mjs +16 -0
- package/node_modules/@capyclaw/tool-host/package.json +59 -0
- package/node_modules/@capyclaw/tool-host/src/descriptors.mjs +166 -0
- package/node_modules/@capyclaw/tool-host/src/index.mjs +416 -0
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +680 -0
- package/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/semver/classes/index.js +7 -0
- package/node_modules/semver/classes/range.js +577 -0
- package/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/semver/functions/major.js +5 -0
- package/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/semver/index.js +93 -0
- package/node_modules/semver/internal/constants.js +67 -0
- package/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/semver/internal/re.js +223 -0
- package/node_modules/semver/internal/trim-comparator-whitespace.js +438 -0
- package/node_modules/semver/package.json +78 -0
- package/node_modules/semver/preload.js +4 -0
- package/node_modules/semver/range.bnf +17 -0
- package/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/yaml/LICENSE +13 -0
- package/node_modules/yaml/README.md +172 -0
- package/node_modules/yaml/bin.mjs +11 -0
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
- package/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
- package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +226 -0
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
- package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
- package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
- package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
- package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
- package/node_modules/yaml/browser/dist/errors.js +57 -0
- package/node_modules/yaml/browser/dist/index.js +17 -0
- package/node_modules/yaml/browser/dist/log.js +11 -0
- package/node_modules/yaml/browser/dist/nodes/Alias.js +118 -0
- package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
- package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
- package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
- package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/node_modules/yaml/browser/dist/parse/lexer.js +721 -0
- package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +975 -0
- package/node_modules/yaml/browser/dist/public-api.js +102 -0
- package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
- package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
- package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +67 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
- package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +25 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
- package/node_modules/yaml/browser/dist/util.js +11 -0
- package/node_modules/yaml/browser/dist/visit.js +233 -0
- package/node_modules/yaml/browser/index.js +5 -0
- package/node_modules/yaml/browser/package.json +3 -0
- package/node_modules/yaml/dist/cli.d.ts +8 -0
- package/node_modules/yaml/dist/cli.mjs +201 -0
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
- package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
- package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
- package/node_modules/yaml/dist/compose/compose-node.js +112 -0
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
- package/node_modules/yaml/dist/compose/composer.js +224 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +228 -0
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
- package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
- package/node_modules/yaml/dist/doc/Document.js +337 -0
- package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/yaml/dist/doc/anchors.js +76 -0
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/yaml/dist/doc/createNode.js +90 -0
- package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/node_modules/yaml/dist/doc/directives.js +178 -0
- package/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/yaml/dist/index.d.ts +25 -0
- package/node_modules/yaml/dist/index.js +50 -0
- package/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/yaml/dist/log.js +19 -0
- package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/Alias.js +120 -0
- package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
- package/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
- package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
- package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/node_modules/yaml/dist/options.d.ts +350 -0
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
- package/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/yaml/dist/parse/lexer.js +723 -0
- package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/yaml/dist/parse/parser.js +980 -0
- package/node_modules/yaml/dist/public-api.d.ts +44 -0
- package/node_modules/yaml/dist/public-api.js +107 -0
- package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
- package/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
- package/node_modules/yaml/dist/schema/tags.js +99 -0
- package/node_modules/yaml/dist/schema/types.d.ts +92 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
- package/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/yaml/dist/test-events.js +134 -0
- package/node_modules/yaml/dist/util.d.ts +16 -0
- package/node_modules/yaml/dist/util.js +28 -0
- package/node_modules/yaml/dist/visit.d.ts +102 -0
- package/node_modules/yaml/dist/visit.js +236 -0
- package/node_modules/yaml/package.json +97 -0
- package/node_modules/yaml/util.js +2 -0
- package/package.json +78 -4
- package/plugin.mjs +113 -0
- package/server/archive.mjs +255 -0
- package/server/drop.mjs +498 -0
- package/server/impl.mjs +609 -0
- package/server/routes.mjs +339 -0
- package/server/tools.mjs +111 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 压缩包处理:把拖进来的 .zip / .tgz / .tar.gz 读成条目表,再落到本机 staging 目录。
|
|
3
|
+
*
|
|
4
|
+
* 纯函数层:不碰 HTTP、不碰 Cordis。拖拽上传的字节只有在这里被解释,
|
|
5
|
+
* 发布引擎(drop.mjs)只看见「一个已经解开的普通目录」。
|
|
6
|
+
*
|
|
7
|
+
* 与 @capyclaw/plugin-drop 的 archive.js 同源(同一套手写 zip/tar 解析),
|
|
8
|
+
* 差别只有两处:storeRoot 换成 publisher 自己的 staging 区;检查包时不再要求
|
|
9
|
+
* dsh.bundle.patch(发布闸会给出更具体的错误),只要求 name + version。
|
|
10
|
+
*/
|
|
11
|
+
import path from 'node:path'
|
|
12
|
+
import os from 'node:os'
|
|
13
|
+
import { mkdir, writeFile } from 'node:fs/promises'
|
|
14
|
+
import { gunzipSync, inflateRawSync } from 'node:zlib'
|
|
15
|
+
|
|
16
|
+
const MAX_DEPTH = 3
|
|
17
|
+
|
|
18
|
+
/** 读 .zip / .tgz / .tar.gz(或裸 .tar)为一个扁平条目表。 */
|
|
19
|
+
export function unpack(buffer, filename) {
|
|
20
|
+
if (buffer.length > 2 && buffer[0] === 0x1f && buffer[1] === 0x8b) return untar(gunzipSync(buffer))
|
|
21
|
+
if (buffer.length > 4 && buffer[0] === 0x50 && buffer[1] === 0x4b && buffer[2] === 0x03 && buffer[3] === 0x04) {
|
|
22
|
+
return unzip(buffer)
|
|
23
|
+
}
|
|
24
|
+
if (/\.tar$/i.test(filename)) return untar(buffer)
|
|
25
|
+
throw new Error('无法识别的压缩格式,请用 .zip、.tgz 或 .tar.gz。')
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function untar(buffer) {
|
|
29
|
+
const entries = []
|
|
30
|
+
let offset = 0
|
|
31
|
+
let pendingPath = null
|
|
32
|
+
|
|
33
|
+
while (offset + 512 <= buffer.length) {
|
|
34
|
+
const header = buffer.subarray(offset, offset + 512)
|
|
35
|
+
if (header.every((byte) => byte === 0)) break
|
|
36
|
+
|
|
37
|
+
const name = readCString(header, 0, 100)
|
|
38
|
+
const prefix = readCString(header, 345, 155)
|
|
39
|
+
const size = readOctal(header, 124, 12)
|
|
40
|
+
const type = String.fromCharCode(header[156] || 0x30)
|
|
41
|
+
const dataStart = offset + 512
|
|
42
|
+
const data = buffer.subarray(dataStart, Math.min(dataStart + size, buffer.length))
|
|
43
|
+
offset = dataStart + Math.ceil(size / 512) * 512
|
|
44
|
+
|
|
45
|
+
if (type === 'x') {
|
|
46
|
+
const pax = parsePax(data)
|
|
47
|
+
if (pax.path) pendingPath = pax.path
|
|
48
|
+
continue
|
|
49
|
+
}
|
|
50
|
+
if (type === 'g') continue
|
|
51
|
+
if (type === 'L') {
|
|
52
|
+
pendingPath = readCString(data, 0, data.length)
|
|
53
|
+
continue
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const entryPath = pendingPath || (prefix ? `${prefix}/${name}` : name)
|
|
57
|
+
pendingPath = null
|
|
58
|
+
if (!entryPath) continue
|
|
59
|
+
|
|
60
|
+
if (type === '5' || entryPath.endsWith('/')) {
|
|
61
|
+
entries.push({ path: entryPath, dir: true })
|
|
62
|
+
continue
|
|
63
|
+
}
|
|
64
|
+
if (type === '0' || type === '7') entries.push({ path: entryPath, data: Buffer.from(data) })
|
|
65
|
+
}
|
|
66
|
+
return entries
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function parsePax(data) {
|
|
70
|
+
const result = {}
|
|
71
|
+
let cursor = 0
|
|
72
|
+
while (cursor < data.length) {
|
|
73
|
+
const space = data.indexOf(0x20, cursor)
|
|
74
|
+
if (space < 0) break
|
|
75
|
+
const length = Number.parseInt(data.subarray(cursor, space).toString('utf8'), 10)
|
|
76
|
+
if (!Number.isFinite(length) || length <= 0) break
|
|
77
|
+
const record = data.subarray(space + 1, cursor + length - 1).toString('utf8')
|
|
78
|
+
const equals = record.indexOf('=')
|
|
79
|
+
if (equals > 0) result[record.slice(0, equals)] = record.slice(equals + 1)
|
|
80
|
+
cursor += length
|
|
81
|
+
}
|
|
82
|
+
return result
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function unzip(buffer) {
|
|
86
|
+
const eocd = findEndOfCentralDirectory(buffer)
|
|
87
|
+
if (eocd < 0) throw new Error('ZIP 结构损坏:找不到目录结尾。')
|
|
88
|
+
|
|
89
|
+
const count = buffer.readUInt16LE(eocd + 10)
|
|
90
|
+
const directoryOffset = buffer.readUInt32LE(eocd + 16)
|
|
91
|
+
const entries = []
|
|
92
|
+
let cursor = directoryOffset
|
|
93
|
+
|
|
94
|
+
for (let index = 0; index < count; index += 1) {
|
|
95
|
+
if (cursor + 46 > buffer.length || buffer.readUInt32LE(cursor) !== 0x02014b50) break
|
|
96
|
+
const method = buffer.readUInt16LE(cursor + 10)
|
|
97
|
+
const compressedSize = buffer.readUInt32LE(cursor + 20)
|
|
98
|
+
const nameLength = buffer.readUInt16LE(cursor + 28)
|
|
99
|
+
const extraLength = buffer.readUInt16LE(cursor + 30)
|
|
100
|
+
const commentLength = buffer.readUInt16LE(cursor + 32)
|
|
101
|
+
const localOffset = buffer.readUInt32LE(cursor + 42)
|
|
102
|
+
const name = buffer.subarray(cursor + 46, cursor + 46 + nameLength).toString('utf8')
|
|
103
|
+
cursor += 46 + nameLength + extraLength + commentLength
|
|
104
|
+
|
|
105
|
+
if (!name) continue
|
|
106
|
+
if (name.endsWith('/')) {
|
|
107
|
+
entries.push({ path: name, dir: true })
|
|
108
|
+
continue
|
|
109
|
+
}
|
|
110
|
+
if (buffer.readUInt32LE(localOffset) !== 0x04034b50) throw new Error('ZIP 结构损坏:本地文件头无效。')
|
|
111
|
+
const localNameLength = buffer.readUInt16LE(localOffset + 26)
|
|
112
|
+
const localExtraLength = buffer.readUInt16LE(localOffset + 28)
|
|
113
|
+
const dataStart = localOffset + 30 + localNameLength + localExtraLength
|
|
114
|
+
const raw = buffer.subarray(dataStart, Math.min(dataStart + compressedSize, buffer.length))
|
|
115
|
+
|
|
116
|
+
let data
|
|
117
|
+
if (method === 0) data = Buffer.from(raw)
|
|
118
|
+
else if (method === 8) data = inflateRawSync(raw)
|
|
119
|
+
else throw new Error(`不支持的 ZIP 压缩方式(method ${method})。`)
|
|
120
|
+
|
|
121
|
+
entries.push({ path: name, data })
|
|
122
|
+
}
|
|
123
|
+
return entries
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function findEndOfCentralDirectory(buffer) {
|
|
127
|
+
const minimum = Math.max(0, buffer.length - 0xffff - 22)
|
|
128
|
+
for (let cursor = buffer.length - 22; cursor >= minimum; cursor -= 1) {
|
|
129
|
+
if (buffer.readUInt32LE(cursor) === 0x06054b50) return cursor
|
|
130
|
+
}
|
|
131
|
+
return -1
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function readCString(buffer, start, length) {
|
|
135
|
+
const slice = buffer.subarray(start, Math.min(start + length, buffer.length))
|
|
136
|
+
const end = slice.indexOf(0)
|
|
137
|
+
return (end < 0 ? slice : slice.subarray(0, end)).toString('utf8').trim()
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function readOctal(buffer, start, length) {
|
|
141
|
+
const value = Number.parseInt(readCString(buffer, start, length), 8)
|
|
142
|
+
return Number.isFinite(value) && value > 0 ? value : 0
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
// 包发现与落地
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
|
|
149
|
+
/** 归一化压缩包内路径;绝对路径、盘符、NUL、`..` 一律丢弃。 */
|
|
150
|
+
export function safeRelative(entryPath) {
|
|
151
|
+
const normalized = entryPath.replace(/\\/g, '/').replace(/^\/+/, '')
|
|
152
|
+
if (!normalized || normalized.includes('\0') || /^[a-zA-Z]:/.test(normalized)) return undefined
|
|
153
|
+
const parts = normalized.split('/').filter((part) => part.length > 0 && part !== '.')
|
|
154
|
+
if (parts.length === 0 || parts.includes('..')) return undefined
|
|
155
|
+
return parts.join('/')
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function indexEntries(entries) {
|
|
159
|
+
const files = new Map()
|
|
160
|
+
for (const entry of entries) {
|
|
161
|
+
const relative = safeRelative(entry.path)
|
|
162
|
+
if (!relative) continue
|
|
163
|
+
files.set(relative, entry)
|
|
164
|
+
}
|
|
165
|
+
return files
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* 找到包根:最浅的、带 name 的 package.json;优先声明了 dsh.bundle 的那一个。
|
|
170
|
+
* (发布闸会检查 dsh.bundle.patch 是否存在,所以这里不做硬性要求。)
|
|
171
|
+
*/
|
|
172
|
+
export function inspectArchive(entries) {
|
|
173
|
+
const files = indexEntries(entries)
|
|
174
|
+
const candidates = []
|
|
175
|
+
|
|
176
|
+
for (const [key, entry] of files) {
|
|
177
|
+
if (entry.dir || !key.endsWith('package.json')) continue
|
|
178
|
+
const parts = key.split('/')
|
|
179
|
+
const depth = parts.length - 1
|
|
180
|
+
if (depth > MAX_DEPTH) continue
|
|
181
|
+
let manifest
|
|
182
|
+
try {
|
|
183
|
+
manifest = JSON.parse(entry.data.toString('utf8'))
|
|
184
|
+
} catch {
|
|
185
|
+
continue
|
|
186
|
+
}
|
|
187
|
+
if (!manifest || typeof manifest !== 'object' || typeof manifest.name !== 'string') continue
|
|
188
|
+
candidates.push({ dir: parts.slice(0, -1).join('/'), depth, manifest })
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (candidates.length === 0) {
|
|
192
|
+
throw new Error('压缩包里没有找到带 name 的 package.json,请把包目录本身压缩后再拖进来。')
|
|
193
|
+
}
|
|
194
|
+
candidates.sort((left, right) => left.depth - right.depth)
|
|
195
|
+
const root = candidates.find((candidate) => candidate.manifest.dsh && candidate.manifest.dsh.bundle) || candidates[0]
|
|
196
|
+
const manifest = root.manifest
|
|
197
|
+
if (typeof manifest.version !== 'string' || !manifest.version.trim()) {
|
|
198
|
+
throw new Error(`${manifest.name} 的 package.json 缺少 version,无法比较 npm 上的版本。`)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return { dir: root.dir, manifest, name: manifest.name, version: manifest.version }
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** staging 根目录:每次拖拽都解到独立子目录,发布成功后由调用方回收。 */
|
|
205
|
+
export function storeRoot() {
|
|
206
|
+
const base = process.env.LOCALAPPDATA || process.env.XDG_DATA_HOME || path.join(os.homedir(), '.local', 'share')
|
|
207
|
+
return path.join(base, 'capyclaw-publisher', 'drop')
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* 新建一个 staging 目录。时间戳之外再挂随机后缀:两个请求落在同一毫秒时
|
|
212
|
+
* 不会写进同一个目录(否则后到的包会污染前一个包的文件清单)。
|
|
213
|
+
*/
|
|
214
|
+
async function createStageDir() {
|
|
215
|
+
await mkdir(storeRoot(), { recursive: true })
|
|
216
|
+
for (let attempt = 0; attempt < 5; attempt += 1) {
|
|
217
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, '-')
|
|
218
|
+
const suffix = Math.random().toString(36).slice(2, 8)
|
|
219
|
+
const candidate = path.join(storeRoot(), `${stamp}-${suffix}`)
|
|
220
|
+
try {
|
|
221
|
+
await mkdir(candidate)
|
|
222
|
+
return candidate
|
|
223
|
+
} catch (error) {
|
|
224
|
+
if (error?.code !== 'EEXIST') throw error
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
throw new Error(`无法在 ${storeRoot()} 下创建临时目录,请检查磁盘权限。`)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** 把条目表写到 staging 下的一个新目录,返回包目录的绝对路径。 */
|
|
231
|
+
export async function materialize(entries, packageDir) {
|
|
232
|
+
const base = await createStageDir()
|
|
233
|
+
|
|
234
|
+
for (const entry of entries) {
|
|
235
|
+
const relative = safeRelative(entry.path)
|
|
236
|
+
if (!relative) continue
|
|
237
|
+
const target = path.join(base, ...relative.split('/'))
|
|
238
|
+
if (!isInside(base, target)) continue
|
|
239
|
+
if (entry.dir) {
|
|
240
|
+
await mkdir(target, { recursive: true })
|
|
241
|
+
continue
|
|
242
|
+
}
|
|
243
|
+
await mkdir(path.dirname(target), { recursive: true })
|
|
244
|
+
await writeFile(target, entry.data)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const target = packageDir ? path.join(base, ...packageDir.split('/')) : base
|
|
248
|
+
await mkdir(target, { recursive: true })
|
|
249
|
+
return target
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function isInside(parent, target) {
|
|
253
|
+
const relative = path.relative(parent, target)
|
|
254
|
+
return relative !== '' && !relative.startsWith('..') && !path.isAbsolute(relative)
|
|
255
|
+
}
|