@capyclaw/ppt-suite 2.5.69 → 2.5.71
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/composition.lock.json +27 -27
- package/contract/ppt-contract.json +27 -1
- package/dsh-suite.json +27 -17
- package/node_modules/@capyclaw/asset-service/dsh-suite.json +1 -1
- package/node_modules/@capyclaw/asset-service/package.json +1 -1
- package/node_modules/@capyclaw/asset-service/src/index.mjs +4 -3
- package/node_modules/@capyclaw/document-workbench/package.json +6 -3
- package/node_modules/@capyclaw/document-workbench/src/client/index.mjs +56 -3
- package/node_modules/@capyclaw/document-workbench/src/client/visibility.mjs +112 -0
- package/node_modules/@capyclaw/document-workbench/src/model/manifest.mjs +6 -4
- package/node_modules/@capyclaw/document-workbench/src/model/ops.mjs +7 -2
- package/node_modules/@capyclaw/document-workbench/src/session/index.mjs +8 -0
- package/node_modules/@capyclaw/document-workbench/src/store/file-backend.mjs +17 -10
- package/node_modules/@capyclaw/document-workbench/src/store/projection.mjs +39 -0
- package/node_modules/@capyclaw/document-workbench/src/testing/index.mjs +14 -11
- package/node_modules/@capyclaw/editor-host/dsh-suite.json +1 -1
- package/node_modules/@capyclaw/editor-host/package.json +1 -1
- package/node_modules/@capyclaw/editor-host/src/index.mjs +12 -21
- package/node_modules/@capyclaw/foundation/abi/assets.mjs +26 -0
- package/node_modules/@capyclaw/foundation/abi/bridge.mjs +3 -1
- package/node_modules/@capyclaw/foundation/abi/index.mjs +15 -0
- package/node_modules/@capyclaw/foundation/abi/visibility.mjs +90 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +21 -4
- package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +5 -1
- package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +5 -2
- package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +4 -0
- package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +29 -2
- package/node_modules/@capyclaw/foundation/lib/kernel.mjs +13 -3
- package/node_modules/@capyclaw/foundation/package.json +1 -1
- package/node_modules/@capyclaw/plugin-kit/package.json +3 -1
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +5 -2
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat.mjs +26 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +3 -1
- package/node_modules/@capyclaw/plugin-kit/src/service/static.mjs +79 -0
- package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +13 -5
- package/node_modules/@capyclaw/portal/package.json +1 -1
- package/node_modules/@capyclaw/ppt-editor/app.js +458 -10
- package/node_modules/@capyclaw/ppt-editor/contract/ppt-contract.json +27 -1
- package/node_modules/@capyclaw/ppt-editor/heartbeat-worker.js +5 -2
- package/node_modules/@capyclaw/ppt-editor/index.html +4 -0
- package/node_modules/@capyclaw/ppt-editor/package.json +2 -2
- package/node_modules/@capyclaw/ppt-skill-api/contract/ppt-contract.json +27 -1
- package/node_modules/@capyclaw/ppt-skill-api/package.json +1 -1
- package/node_modules/@capyclaw/ppt-skill-api/skills/pptist-api/references/tool-contract.md +1 -1
- package/node_modules/@capyclaw/ppt-skill-proposal/contract/ppt-contract.json +27 -1
- package/node_modules/@capyclaw/ppt-skill-proposal/package.json +1 -1
- package/node_modules/@capyclaw/ppt-workbench/contract/ppt-contract.json +27 -1
- package/node_modules/@capyclaw/ppt-workbench/core/deck-layout.js +3 -1
- package/node_modules/@capyclaw/ppt-workbench/core/ops/slide.js +9 -3
- package/node_modules/@capyclaw/ppt-workbench/core/text.js +14 -2
- package/node_modules/@capyclaw/ppt-workbench/package.json +10 -8
- package/node_modules/@capyclaw/ppt-workbench/plugin.mjs +13 -1
- package/node_modules/@capyclaw/ppt-workbench/server/contract.mjs +1 -1
- package/node_modules/@capyclaw/ppt-workbench/server/embedded-host.mjs +201 -20
- package/node_modules/@capyclaw/ppt-workbench/server/relay.mjs +10 -7
- package/node_modules/@capyclaw/ppt-workbench/server/shared/SHARED_MANIFEST.json +4 -4
- package/node_modules/@capyclaw/ppt-workbench/server/store/backends/file-backend.mjs +3 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store/checkpoints.mjs +4 -1
- package/node_modules/@capyclaw/ppt-workbench/server/store/index.mjs +4 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store/sessions.mjs +139 -4
- package/node_modules/@capyclaw/ppt-workbench/server/store/shape.mjs +37 -0
- package/node_modules/@capyclaw/ppt-workbench/server/workbench-framework.mjs +34 -0
- package/node_modules/@capyclaw/service-broker/README.md +1 -1
- package/node_modules/@capyclaw/service-broker/lib/control.mjs +23 -7
- package/node_modules/@capyclaw/service-broker/lib/engine.mjs +60 -6
- package/node_modules/@capyclaw/service-broker/lib/host.mjs +11 -6
- package/node_modules/@capyclaw/service-broker/lib/skills-client.mjs +30 -10
- package/node_modules/@capyclaw/service-broker/package.json +1 -1
- package/node_modules/@capyclaw/service-host/dsh-suite.json +1 -1
- package/node_modules/@capyclaw/service-host/package.json +1 -1
- package/node_modules/@capyclaw/service-host/src/index.mjs +13 -22
- package/node_modules/@capyclaw/skills-service/README.md +42 -10
- package/node_modules/@capyclaw/skills-service/package.json +6 -3
- package/node_modules/@capyclaw/skills-service/server.mjs +129 -51
- package/node_modules/@capyclaw/suite-kit/README.md +289 -0
- package/node_modules/@capyclaw/suite-kit/bin/dsh-domain.mjs +98 -0
- package/node_modules/@capyclaw/suite-kit/bin/dsh-suite.mjs +174 -0
- package/node_modules/@capyclaw/suite-kit/client/embed.js +35 -0
- package/node_modules/@capyclaw/suite-kit/domain.schema.json +129 -0
- package/node_modules/@capyclaw/suite-kit/package.json +58 -0
- package/node_modules/@capyclaw/suite-kit/src/activation-registry.mjs +184 -0
- package/node_modules/@capyclaw/suite-kit/src/artifacts.mjs +131 -0
- package/node_modules/@capyclaw/suite-kit/src/capability.mjs +181 -0
- package/node_modules/@capyclaw/suite-kit/src/compose.mjs +201 -0
- package/node_modules/@capyclaw/suite-kit/src/domain.mjs +138 -0
- package/node_modules/@capyclaw/suite-kit/src/embed.mjs +81 -0
- package/node_modules/@capyclaw/suite-kit/src/host.mjs +230 -0
- package/node_modules/@capyclaw/suite-kit/src/index.mjs +24 -0
- package/node_modules/@capyclaw/suite-kit/src/manifest.mjs +263 -0
- package/node_modules/@capyclaw/suite-kit/src/orchestration.mjs +100 -0
- package/node_modules/@capyclaw/suite-kit/src/profile.mjs +584 -0
- package/node_modules/@capyclaw/suite-kit/src/surface.mjs +28 -0
- package/node_modules/@capyclaw/suite-kit/suite.schema.json +128 -0
- package/node_modules/@capyclaw/tool-host/dsh-suite.json +2 -2
- package/node_modules/@capyclaw/tool-host/lib/host.mjs +34 -4
- package/node_modules/@capyclaw/tool-host/package.json +1 -1
- package/node_modules/@capyclaw/tool-host/src/admit-images.mjs +80 -0
- package/node_modules/@capyclaw/tool-host/src/caller-session.mjs +25 -0
- package/node_modules/@capyclaw/tool-host/src/index.mjs +59 -14
- package/node_modules/@capyclaw/tool-host/src/mode-gate.mjs +272 -0
- package/node_modules/@capyclaw/work-store/README.md +83 -0
- package/node_modules/@capyclaw/work-store/STANDARD.md +263 -0
- package/node_modules/@capyclaw/work-store/cordis.patch.yml +3 -0
- package/node_modules/@capyclaw/work-store/dsh-suite.json +33 -0
- package/node_modules/@capyclaw/work-store/icon.svg +7 -0
- package/node_modules/@capyclaw/work-store/lib/host.mjs +21 -0
- package/node_modules/@capyclaw/work-store/package.json +68 -0
- package/node_modules/@capyclaw/work-store/src/backend.mjs +90 -0
- package/node_modules/@capyclaw/work-store/src/db.mjs +199 -0
- package/node_modules/@capyclaw/work-store/src/envelope.mjs +132 -0
- package/node_modules/@capyclaw/work-store/src/index.mjs +571 -0
- package/node_modules/@capyclaw/work-store/src/interop.mjs +70 -0
- package/node_modules/@capyclaw/work-store/src/refs.mjs +99 -0
- package/node_modules/@capyclaw/work-store/src/routes.mjs +135 -0
- package/node_modules/playwright-core/LICENSE +202 -0
- package/node_modules/playwright-core/NOTICE +5 -0
- package/node_modules/playwright-core/README.md +3 -0
- package/node_modules/playwright-core/ThirdPartyNotices.txt +13 -0
- package/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
- package/node_modules/playwright-core/bin/install_webkit_wsl.ps1 +33 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/node_modules/playwright-core/browsers.json +52 -0
- package/node_modules/playwright-core/cli.js +22 -0
- package/node_modules/playwright-core/index.d.ts +17 -0
- package/node_modules/playwright-core/index.js +17 -0
- package/node_modules/playwright-core/index.mjs +28 -0
- package/node_modules/playwright-core/lib/bootstrap.js +149 -0
- package/node_modules/playwright-core/lib/coreBundle.js +78041 -0
- package/node_modules/playwright-core/lib/entry/cliDaemon.js +5 -0
- package/node_modules/playwright-core/lib/entry/dashboardApp.js +3 -0
- package/node_modules/playwright-core/lib/entry/mcp.js +10 -0
- package/node_modules/playwright-core/lib/entry/oopBrowserDownload.js +3 -0
- package/node_modules/playwright-core/lib/package.js +50 -0
- package/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
- package/node_modules/playwright-core/lib/server/electron/loader.js +123 -0
- package/node_modules/playwright-core/lib/serverRegistry.js +1939 -0
- package/node_modules/playwright-core/lib/serverRegistry.js.LICENSE +65 -0
- package/node_modules/playwright-core/lib/tools/cli-client/channelSessions.js +141 -0
- package/node_modules/playwright-core/lib/tools/cli-client/cli.js +7 -0
- package/node_modules/playwright-core/lib/tools/cli-client/help.json +808 -0
- package/node_modules/playwright-core/lib/tools/cli-client/minimist.js +128 -0
- package/node_modules/playwright-core/lib/tools/cli-client/output.js +352 -0
- package/node_modules/playwright-core/lib/tools/cli-client/program.js +422 -0
- package/node_modules/playwright-core/lib/tools/cli-client/registry.js +180 -0
- package/node_modules/playwright-core/lib/tools/cli-client/session.js +261 -0
- package/node_modules/playwright-core/lib/tools/dashboard/appIcon.png +0 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/SKILL.md +493 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/pr-attachments.md +60 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/running-code.md +245 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/session-management.md +227 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/video-recording.md +216 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/SKILL.md +136 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/migration.md +89 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/react.md +69 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/typing.md +173 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/vue.md +77 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-trace/SKILL.md +174 -0
- package/node_modules/playwright-core/lib/tools/utils/extension.js +112 -0
- package/node_modules/playwright-core/lib/tools/utils/socketConnection.js +108 -0
- package/node_modules/playwright-core/lib/utilsBundle.js +86078 -0
- package/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +1890 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +32 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/index.html +29 -0
- package/node_modules/playwright-core/lib/vite/dashboard/playwright-logo.svg +24 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/index.html +16 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/report.css +2 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/report.js +32 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DK72OMRi.js +32 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-Cn0mmDuv.js +129 -0
- package/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
- package/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-BEB2e8M3.js +32 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-D-g2vrvf.js +184 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-B794rD2Z.js +7 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.html +44 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.oNry3Hjv.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +10 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +4 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CYwC_gH1.js +5 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +18 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
- package/node_modules/playwright-core/lib/webp_codec.LICENSE +173 -0
- package/node_modules/playwright-core/lib/webp_codec.wasm +0 -0
- package/node_modules/playwright-core/lib/xdg-open +1267 -0
- package/node_modules/playwright-core/package.json +34 -0
- package/node_modules/playwright-core/types/protocol.d.ts +24776 -0
- package/node_modules/playwright-core/types/structs.d.ts +52 -0
- package/node_modules/playwright-core/types/types.d.ts +27167 -0
- package/package.json +17 -15
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://dsh.local/schemas/domain.schema.json",
|
|
4
|
+
"title": "DSH Domain Pack Manifest",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["name", "version", "components"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": { "type": "string" },
|
|
10
|
+
"name": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" },
|
|
11
|
+
"version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$" },
|
|
12
|
+
"title": { "type": "string" },
|
|
13
|
+
"description": { "type": "string" },
|
|
14
|
+
"baseBundles": { "type": "array", "items": { "type": "string" } },
|
|
15
|
+
"components": { "type": "array", "minItems": 1, "items": { "type": "string" } },
|
|
16
|
+
"profile": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"additionalProperties": true,
|
|
19
|
+
"properties": {
|
|
20
|
+
"name": { "type": "string" },
|
|
21
|
+
"port": { "type": "integer" }
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"runtime": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": true,
|
|
27
|
+
"properties": {
|
|
28
|
+
"driver": { "type": "string", "enum": ["node", "jobobject", "docker", "wsl"] },
|
|
29
|
+
"workId": { "type": "string" },
|
|
30
|
+
"ttlSec": { "type": "integer", "minimum": 0 },
|
|
31
|
+
"env": { "type": "object", "additionalProperties": true },
|
|
32
|
+
"bindings": {
|
|
33
|
+
"type": "array",
|
|
34
|
+
"items": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"additionalProperties": false,
|
|
37
|
+
"properties": {
|
|
38
|
+
"row": { "type": "string" },
|
|
39
|
+
"package": { "type": "string" },
|
|
40
|
+
"port": { "type": "string" },
|
|
41
|
+
"config": { "type": "object" }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"urlPort": { "type": "string" },
|
|
46
|
+
"model": {
|
|
47
|
+
"oneOf": [
|
|
48
|
+
{ "type": "boolean" },
|
|
49
|
+
{
|
|
50
|
+
"type": "object",
|
|
51
|
+
"additionalProperties": true,
|
|
52
|
+
"properties": {
|
|
53
|
+
"id": { "type": "string" },
|
|
54
|
+
"plugin": { "type": "string" },
|
|
55
|
+
"apiKeyEnv": { "type": "string" },
|
|
56
|
+
"baseUrlEnv": { "type": "string" },
|
|
57
|
+
"baseURL": { "type": "string" }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"workspaceController": {
|
|
63
|
+
"oneOf": [
|
|
64
|
+
{ "type": "boolean" },
|
|
65
|
+
{ "type": "object", "additionalProperties": true }
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"requires": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"additionalProperties": true,
|
|
71
|
+
"properties": {
|
|
72
|
+
"tools": { "type": "array", "items": { "type": "string" } },
|
|
73
|
+
"services": { "type": "array", "items": { "type": "string" } },
|
|
74
|
+
"capabilities": { "type": "array", "items": { "type": "string" } }
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"scope": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"additionalProperties": true,
|
|
80
|
+
"properties": {
|
|
81
|
+
"sessions": { "type": "object" },
|
|
82
|
+
"files": {
|
|
83
|
+
"type": "array",
|
|
84
|
+
"items": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"required": ["path"],
|
|
87
|
+
"properties": {
|
|
88
|
+
"id": { "type": "string" },
|
|
89
|
+
"kind": { "type": "string" },
|
|
90
|
+
"path": { "type": "string" },
|
|
91
|
+
"patterns": { "type": "array", "items": { "type": "string" } }
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"workspace": { "type": "object" },
|
|
96
|
+
"network": { "type": "object" },
|
|
97
|
+
"processes": { "type": "object" }
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"ports": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"additionalProperties": true,
|
|
103
|
+
"properties": {
|
|
104
|
+
"harness": { "oneOf": [{ "type": "integer" }, { "type": "object" }] },
|
|
105
|
+
"dsh": { "oneOf": [{ "type": "integer" }, { "type": "object" }] },
|
|
106
|
+
"content": { "oneOf": [{ "type": "integer" }, { "type": "object" }] },
|
|
107
|
+
"services": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"additionalProperties": { "oneOf": [{ "type": "integer" }, { "type": "object" }] }
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"removeRows": { "type": "array", "items": { "type": "string" } },
|
|
116
|
+
"removeDependencies": { "type": "array", "items": { "type": "string" } },
|
|
117
|
+
"rowOverrides": {
|
|
118
|
+
"type": "object",
|
|
119
|
+
"additionalProperties": {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"additionalProperties": false,
|
|
122
|
+
"properties": {
|
|
123
|
+
"config": { "type": "object" },
|
|
124
|
+
"disabled": { "type": "boolean" }
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@capyclaw/suite-kit",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "DSH suite/domain 标准件(双重身份:构建期库 + 运行时库,暂不拆包,见 README「双重身份」)。构建期:manifest 校验、compose、profile 生成、domain 解析、artifact 打包;运行时:统一能力描述符、编排闸/授权、嵌入握手与 surface 挂载。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.mjs",
|
|
9
|
+
"./domain": "./src/domain.mjs",
|
|
10
|
+
"./compose": "./src/compose.mjs",
|
|
11
|
+
"./manifest": "./src/manifest.mjs",
|
|
12
|
+
"./capability": "./src/capability.mjs",
|
|
13
|
+
"./orchestration": "./src/orchestration.mjs",
|
|
14
|
+
"./embed": "./src/embed.mjs",
|
|
15
|
+
"./surface": "./src/surface.mjs",
|
|
16
|
+
"./host": "./src/host.mjs",
|
|
17
|
+
"./client/embed.js": "./client/embed.js",
|
|
18
|
+
"./profile": "./src/profile.mjs",
|
|
19
|
+
"./artifacts": "./src/artifacts.mjs",
|
|
20
|
+
"./schema": "./suite.schema.json",
|
|
21
|
+
"./package.json": "./package.json",
|
|
22
|
+
"./domain-schema": "./domain.schema.json"
|
|
23
|
+
},
|
|
24
|
+
"bin": {
|
|
25
|
+
"dsh-suite": "./bin/dsh-suite.mjs",
|
|
26
|
+
"dsh-domain": "./bin/dsh-domain.mjs"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"test": "node --test test/*.test.mjs"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"README.md",
|
|
33
|
+
"bin/",
|
|
34
|
+
"client/",
|
|
35
|
+
"domain.schema.json",
|
|
36
|
+
"src/",
|
|
37
|
+
"suite.schema.json"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=18"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@capyclaw/plugin-kit": "^0.2.6"
|
|
44
|
+
},
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/Maple496/capyclaw.git",
|
|
52
|
+
"directory": "C/packages/capyclaw-suite-kit"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/Maple496/capyclaw/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/Maple496/capyclaw/tree/main/C/packages/capyclaw-suite-kit#readme"
|
|
58
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 从 suite 组合结果编译 launch-engine 的 capability 注册表。
|
|
3
|
+
*
|
|
4
|
+
* 「实现一个功能要注册哪些组件」的唯一事实来源是 dsh-suite.json;
|
|
5
|
+
* 这里把它编译成运行期激活面(@capyclaw/launch-engine)直接消费的注册表,
|
|
6
|
+
* 不再手写第二种「要求 → 组件」映射。映射规则:
|
|
7
|
+
*
|
|
8
|
+
* - 每个包 = 一个激活 capability(name = 包名),条件是它有 row、拥有服务进程、
|
|
9
|
+
* 或是组合内其他包 required capability 的提供方(纯 support 依赖不单独成能力)
|
|
10
|
+
* entries = 该包的 rows(entryId = include:<rowId>)
|
|
11
|
+
* requires = 包 requires.capabilities 解析到的提供方包(组合内)
|
|
12
|
+
* services = 套件 services.json 里 cmd 指向该包 node_modules/<pkg>/ 的条目
|
|
13
|
+
* - 每个套件 = 一个聚合 capability(name = 套件名;bundle 级开关)
|
|
14
|
+
* bundles = [{ name: 套件名 }](installSuites 把套件名写进 dsh.profile.bundles)
|
|
15
|
+
* requires = 该套件下所有已注册的包 capability
|
|
16
|
+
* entries/services = 无法归属到具体包的行与服务
|
|
17
|
+
*
|
|
18
|
+
* services 编译时展开 ${PACKAGE_DIR}(注册表落在 profile 目录,不能依赖
|
|
19
|
+
* broker 清单装载期的展开基准),剥掉 portFrom/dirFrom(那是 runtime
|
|
20
|
+
* 物化期的分配提示,不是激活语义);${PORT} 原样留给 broker 仲裁。
|
|
21
|
+
*/
|
|
22
|
+
import fs from 'node:fs'
|
|
23
|
+
import path from 'node:path'
|
|
24
|
+
|
|
25
|
+
export const ACTIVATION_REGISTRY_FILENAME = 'launch-engine.registry.json'
|
|
26
|
+
const ENTRY_PREFIX = 'include:'
|
|
27
|
+
|
|
28
|
+
function readSuiteServices(suiteDir) {
|
|
29
|
+
const file = path.join(suiteDir, 'services.json')
|
|
30
|
+
if (!fs.existsSync(file)) return []
|
|
31
|
+
try {
|
|
32
|
+
const raw = JSON.parse(fs.readFileSync(file, 'utf8'))
|
|
33
|
+
return Array.isArray(raw?.services) ? raw.services : []
|
|
34
|
+
} catch {
|
|
35
|
+
return []
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function serviceOwnerPackage(service, packageNames) {
|
|
40
|
+
const cmd = Array.isArray(service?.cmd) ? service.cmd.join(' ') : ''
|
|
41
|
+
for (const name of packageNames) {
|
|
42
|
+
const needle = `node_modules/${name}/`
|
|
43
|
+
if (cmd.includes(needle)) return name
|
|
44
|
+
}
|
|
45
|
+
return null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** 展开 services.json 的 ${PACKAGE_DIR}。两种规格:
|
|
49
|
+
* - 新代:cmd 形如 ${PACKAGE_DIR}/node_modules/<pkg>/…——${PACKAGE_DIR} 指
|
|
50
|
+
* 持有 node_modules 的套件根(services.json 所在目录),不是 owner 包自身目录;
|
|
51
|
+
* - 旧代:cmd 形如 ${PACKAGE_DIR}/server/relay.mjs——${PACKAGE_DIR} 指 owner 包目录。 */
|
|
52
|
+
function toActivationService(service, { packageDir, suiteDir }) {
|
|
53
|
+
const joined = (service.cmd || []).join(' ')
|
|
54
|
+
const base = joined.includes('node_modules/') ? suiteDir : packageDir
|
|
55
|
+
const cmd = (service.cmd || []).map((part) => String(part).replaceAll('${PACKAGE_DIR}', base))
|
|
56
|
+
const next = { ...service, cmd }
|
|
57
|
+
delete next.portFrom
|
|
58
|
+
delete next.dirFrom
|
|
59
|
+
return next
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function packageDirOf(pkg) {
|
|
63
|
+
if (!pkg?.dir || !pkg?.entry?.path) return null
|
|
64
|
+
return path.resolve(pkg.dir, pkg.entry.path).replace(/\\/g, '/')
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @param {{suites: {dir:string, manifest:object}[], composed: object, requiredCapabilities?: string[]}} input
|
|
69
|
+
* suites 已加载(components 已展开)的套件;composed = composeSuites 输出
|
|
70
|
+
* requiredCapabilities 额外的能力名(如 domain runtime.requires.capabilities),
|
|
71
|
+
* 其提供方也应进入注册表
|
|
72
|
+
* @returns {{registry: {version:1, capabilities:object}, warnings: string[]}}
|
|
73
|
+
*/
|
|
74
|
+
export function buildActivationRegistry({ suites, composed, requiredCapabilities = [] }) {
|
|
75
|
+
const warnings = []
|
|
76
|
+
const capabilities = {}
|
|
77
|
+
const packages = composed?.packages || []
|
|
78
|
+
const packageNames = packages.map((pkg) => pkg.name)
|
|
79
|
+
const capProvider = new Map((composed?.capabilities || []).map((item) => [item.capability, item.package]))
|
|
80
|
+
|
|
81
|
+
/* 组合内被别人 required 的能力的提供方:即使没有 row(纯服务进程形态,
|
|
82
|
+
* 如 capyclaw-ppt-workbench)也必须成为 capability,否则依赖图断链。 */
|
|
83
|
+
const demandedProviders = new Set()
|
|
84
|
+
for (const pkg of packages) {
|
|
85
|
+
for (const capability of Object.keys(pkg.entry.requires?.capabilities || {})) {
|
|
86
|
+
const provider = capProvider.get(capability)
|
|
87
|
+
if (provider) demandedProviders.add(provider)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
for (const capability of requiredCapabilities) {
|
|
91
|
+
const provider = capProvider.get(String(capability).split('@')[0])
|
|
92
|
+
if (provider) demandedProviders.add(provider)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const rowsByPackage = new Map()
|
|
96
|
+
const orphanRowsBySuite = new Map()
|
|
97
|
+
for (const row of composed?.rows || []) {
|
|
98
|
+
if (row.disabled) continue
|
|
99
|
+
if (packageNames.includes(row.name)) {
|
|
100
|
+
rowsByPackage.set(row.name, [...(rowsByPackage.get(row.name) || []), row])
|
|
101
|
+
} else {
|
|
102
|
+
const suite = row._suite || ''
|
|
103
|
+
orphanRowsBySuite.set(suite, [...(orphanRowsBySuite.get(suite) || []), row])
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const packageServices = new Map()
|
|
108
|
+
for (const suite of suites || []) {
|
|
109
|
+
for (const service of readSuiteServices(suite.dir)) {
|
|
110
|
+
const owner = serviceOwnerPackage(service, packageNames)
|
|
111
|
+
if (owner) packageServices.set(owner, [...(packageServices.get(owner) || []), { service, suiteDir: (suite.dir || '').replace(/\\/g, '/') }])
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
for (const pkg of packages) {
|
|
116
|
+
const rows = rowsByPackage.get(pkg.name) || []
|
|
117
|
+
const services = packageServices.get(pkg.name) || []
|
|
118
|
+
if (!rows.length && !services.length && !demandedProviders.has(pkg.name)) continue
|
|
119
|
+
const requires = []
|
|
120
|
+
for (const capability of Object.keys(pkg.entry.requires?.capabilities || {})) {
|
|
121
|
+
const provider = capProvider.get(capability)
|
|
122
|
+
if (!provider || provider === pkg.name || requires.includes(provider)) continue
|
|
123
|
+
if (!packageNames.includes(provider)) continue
|
|
124
|
+
requires.push(provider)
|
|
125
|
+
}
|
|
126
|
+
capabilities[pkg.name] = {
|
|
127
|
+
name: pkg.name,
|
|
128
|
+
title: pkg.name,
|
|
129
|
+
requires,
|
|
130
|
+
bundles: [],
|
|
131
|
+
entries: rows.map((row) => ({ entryId: ENTRY_PREFIX + row.id, enabled: true })),
|
|
132
|
+
services: services.map(({ service, suiteDir }) => toActivationService(service, {
|
|
133
|
+
packageDir: packageDirOf(pkg) || suiteDir,
|
|
134
|
+
suiteDir,
|
|
135
|
+
})),
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
for (const suite of suites || []) {
|
|
140
|
+
const name = suite.manifest.name
|
|
141
|
+
const dir = (suite.dir || '').replace(/\\/g, '/')
|
|
142
|
+
if (capabilities[name]) {
|
|
143
|
+
warnings.push(`capability 名冲突: 套件 ${name} 与已有包能力重名,聚合能力改用 suite:<name>`)
|
|
144
|
+
}
|
|
145
|
+
const aggregateName = capabilities[name] ? `suite:${name}` : name
|
|
146
|
+
const unmatched = []
|
|
147
|
+
|
|
148
|
+
for (const service of readSuiteServices(suite.dir)) {
|
|
149
|
+
const owner = serviceOwnerPackage(service, packageNames)
|
|
150
|
+
/* 已在包能力里挂载的服务不重复;只有无主或主人未成能力的才归套件聚合。 */
|
|
151
|
+
if (owner && capabilities[owner]) continue
|
|
152
|
+
unmatched.push(toActivationService(service, { packageDir: dir, suiteDir: dir }))
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const requires = []
|
|
156
|
+
for (const pkg of packages) {
|
|
157
|
+
if (pkg.suite !== name) continue
|
|
158
|
+
if (capabilities[pkg.name] && !requires.includes(pkg.name)) requires.push(pkg.name)
|
|
159
|
+
}
|
|
160
|
+
const orphanRows = orphanRowsBySuite.get(name) || []
|
|
161
|
+
if (orphanRows.length) {
|
|
162
|
+
warnings.push(`${name}: 行 [${orphanRows.map((row) => row.id).join(', ')}] 引用的包不在组合里(外部已安装),归入套件聚合能力`)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
capabilities[aggregateName] = {
|
|
166
|
+
name: aggregateName,
|
|
167
|
+
title: suite.manifest.title || name,
|
|
168
|
+
requires,
|
|
169
|
+
bundles: [{ name, enabled: true }],
|
|
170
|
+
entries: orphanRows.map((row) => ({ entryId: ENTRY_PREFIX + row.id, enabled: true })),
|
|
171
|
+
services: unmatched,
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return { registry: { version: 1, capabilities }, warnings }
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** 安装期落盘:<profile>/launch-engine.registry.json。 */
|
|
179
|
+
export function writeActivationRegistry(profileDir, { suites, composed }) {
|
|
180
|
+
const { registry, warnings } = buildActivationRegistry({ suites, composed })
|
|
181
|
+
const file = path.join(profileDir, ACTIVATION_REGISTRY_FILENAME)
|
|
182
|
+
fs.writeFileSync(file, JSON.stringify(registry, null, 2) + '\n')
|
|
183
|
+
return { file, registry, warnings, capabilities: Object.keys(registry.capabilities) }
|
|
184
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 公共插件版本化 artifact store。
|
|
3
|
+
*
|
|
4
|
+
* 目录:
|
|
5
|
+
* <root>/index.json
|
|
6
|
+
* <root>/<safeName>/<version>/package/...
|
|
7
|
+
*
|
|
8
|
+
* 版本化安装:installSuites({ packageSpecs: ['@capyclaw/asset-service@0.1.3'] })
|
|
9
|
+
* 回滚:installSuites({ rollbackTo: '<profile>/dsh-composition.lock.json.bak-...' })
|
|
10
|
+
*/
|
|
11
|
+
import crypto from 'node:crypto'
|
|
12
|
+
import fs from 'node:fs'
|
|
13
|
+
import os from 'node:os'
|
|
14
|
+
import path from 'node:path'
|
|
15
|
+
|
|
16
|
+
export function defaultArtifactRoot() {
|
|
17
|
+
return process.env.DSH_ARTIFACT_STORE || path.join(os.homedir(), '.dsh-store', 'artifacts')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function safeName(name) {
|
|
21
|
+
return String(name).replace(/[@/\\]/g, '__')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function readJsonSafe(file) {
|
|
25
|
+
try { return JSON.parse(fs.readFileSync(file, 'utf8')) } catch { return null }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function walk(dir, base = dir) {
|
|
29
|
+
const out = []
|
|
30
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
31
|
+
const full = path.join(dir, entry.name)
|
|
32
|
+
if (entry.isDirectory()) out.push(...walk(full, base))
|
|
33
|
+
else out.push(path.relative(base, full).split('\\').join('/'))
|
|
34
|
+
}
|
|
35
|
+
return out.sort()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function treeHash(dir) {
|
|
39
|
+
const hash = crypto.createHash('sha256')
|
|
40
|
+
for (const rel of walk(dir)) {
|
|
41
|
+
hash.update(rel)
|
|
42
|
+
hash.update(fs.readFileSync(path.join(dir, rel)))
|
|
43
|
+
}
|
|
44
|
+
return hash.digest('hex')
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function copyPackageDir(src, dest) {
|
|
48
|
+
fs.mkdirSync(dest, { recursive: true })
|
|
49
|
+
for (const rel of walk(src)) {
|
|
50
|
+
if (rel === 'node_modules' || rel.startsWith('node_modules/')) continue
|
|
51
|
+
if (rel === '.git' || rel.startsWith('.git/')) continue
|
|
52
|
+
if (rel === 'test' || rel.startsWith('test/')) continue
|
|
53
|
+
if (rel === 'coverage' || rel.startsWith('coverage/')) continue
|
|
54
|
+
const to = path.join(dest, rel)
|
|
55
|
+
fs.mkdirSync(path.dirname(to), { recursive: true })
|
|
56
|
+
fs.copyFileSync(path.join(src, rel), to)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function artifactIndexPath(root = defaultArtifactRoot()) {
|
|
61
|
+
return path.join(root, 'index.json')
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function readArtifactIndex(root = defaultArtifactRoot()) {
|
|
65
|
+
return readJsonSafe(artifactIndexPath(root)) || { version: 1, packages: {} }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function writeArtifactIndex(root, index) {
|
|
69
|
+
fs.mkdirSync(root, { recursive: true })
|
|
70
|
+
fs.writeFileSync(artifactIndexPath(root), JSON.stringify(index, null, 2) + '\n')
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 打包一个包目录到 artifact store。
|
|
75
|
+
* @param {string} packageDir
|
|
76
|
+
* @param {{ root?: string, force?: boolean }} options
|
|
77
|
+
*/
|
|
78
|
+
export function packPackage(packageDir, { root = defaultArtifactRoot(), force = false } = {}) {
|
|
79
|
+
const manifest = readJsonSafe(path.join(packageDir, 'package.json'))
|
|
80
|
+
if (!manifest?.name || !manifest?.version) throw new Error(`artifact pack: ${packageDir} 缺少 package.json name/version`)
|
|
81
|
+
const dest = path.join(root, safeName(manifest.name), manifest.version, 'package')
|
|
82
|
+
if (fs.existsSync(dest) && !force) throw new Error(`artifact 已存在: ${manifest.name}@${manifest.version}(加 --force 覆盖)`)
|
|
83
|
+
fs.rmSync(dest, { recursive: true, force: true })
|
|
84
|
+
copyPackageDir(packageDir, dest)
|
|
85
|
+
const meta = {
|
|
86
|
+
name: manifest.name,
|
|
87
|
+
version: manifest.version,
|
|
88
|
+
apiVersion: manifest.dsh?.apiVersion || null,
|
|
89
|
+
dependencies: manifest.dependencies || {},
|
|
90
|
+
dir: dest,
|
|
91
|
+
sha256: treeHash(dest),
|
|
92
|
+
packedAt: new Date().toISOString(),
|
|
93
|
+
}
|
|
94
|
+
const index = readArtifactIndex(root)
|
|
95
|
+
index.packages[manifest.name] ||= {}
|
|
96
|
+
index.packages[manifest.name][manifest.version] = meta
|
|
97
|
+
writeArtifactIndex(root, index)
|
|
98
|
+
return meta
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @param {string} spec name 或 name@version
|
|
103
|
+
* @param {{ root?: string }} options
|
|
104
|
+
*/
|
|
105
|
+
export function resolvePackageSpec(spec, { root = defaultArtifactRoot() } = {}) {
|
|
106
|
+
if (!spec || typeof spec !== 'string') throw new Error('artifact resolve: spec 必填')
|
|
107
|
+
const at = spec.lastIndexOf('@')
|
|
108
|
+
const name = at > 0 ? spec.slice(0, at) : spec
|
|
109
|
+
const version = at > 0 ? spec.slice(at + 1) : ''
|
|
110
|
+
const index = readArtifactIndex(root)
|
|
111
|
+
const versions = index.packages[name]
|
|
112
|
+
if (!versions) throw new Error(`artifact 不存在: ${name}(root=${root})`)
|
|
113
|
+
if (version) {
|
|
114
|
+
const hit = versions[version]
|
|
115
|
+
if (!hit) throw new Error(`artifact 版本不存在: ${spec};可用: ${Object.keys(versions).sort().join(', ')}`)
|
|
116
|
+
return hit
|
|
117
|
+
}
|
|
118
|
+
const latest = Object.keys(versions).sort((a, b) => a.localeCompare(b, undefined, { numeric: true })).at(-1)
|
|
119
|
+
return versions[latest]
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function listArtifacts({ root = defaultArtifactRoot() } = {}) {
|
|
123
|
+
const index = readArtifactIndex(root)
|
|
124
|
+
return Object.entries(index.packages).flatMap(([name, versions]) =>
|
|
125
|
+
Object.values(versions).map((meta) => ({ name, version: meta.version, apiVersion: meta.apiVersion, sha256: meta.sha256, dir: meta.dir })))
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function recordFromLock(lock, { root = defaultArtifactRoot() } = {}) {
|
|
129
|
+
if (!lock?.packages) throw new Error('artifact recordFromLock: lock 缺 packages')
|
|
130
|
+
return Object.entries(lock.packages).map(([name, meta]) => resolvePackageSpec(`${name}@${meta.version}`, { root }))
|
|
131
|
+
}
|