@capyclaw/wall-suite 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +20 -2
- package/composition.lock.json +48 -0
- package/contract/wall-contract.json +8 -0
- package/cordis.patch.yml +6 -0
- package/dsh-suite.json +128 -0
- package/lib/index.mjs +6 -0
- package/node_modules/@capyclaw/asset-service/README.md +48 -0
- package/node_modules/@capyclaw/asset-service/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/asset-service/dsh-suite.json +29 -0
- package/node_modules/@capyclaw/asset-service/lib/host.mjs +14 -0
- package/node_modules/@capyclaw/asset-service/package.json +59 -0
- package/node_modules/@capyclaw/asset-service/src/index.mjs +310 -0
- package/node_modules/@capyclaw/foundation/README.md +51 -0
- package/node_modules/@capyclaw/foundation/abi/assets.mjs +26 -0
- package/node_modules/@capyclaw/foundation/abi/bridge.mjs +88 -0
- package/node_modules/@capyclaw/foundation/abi/errors.mjs +63 -0
- package/node_modules/@capyclaw/foundation/abi/index.mjs +50 -0
- package/node_modules/@capyclaw/foundation/abi/kinds.mjs +271 -0
- package/node_modules/@capyclaw/foundation/abi/loader.mjs +352 -0
- package/node_modules/@capyclaw/foundation/abi/schema.mjs +98 -0
- package/node_modules/@capyclaw/foundation/abi/spec.mjs +258 -0
- package/node_modules/@capyclaw/foundation/abi/validate.mjs +24 -0
- package/node_modules/@capyclaw/foundation/abi/version.mjs +140 -0
- package/node_modules/@capyclaw/foundation/abi/visibility.mjs +90 -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 +72 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/own-server.mjs +113 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +69 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +120 -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 +38 -0
- package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +88 -0
- package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +54 -0
- package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +187 -0
- package/node_modules/@capyclaw/foundation/lib/host.mjs +23 -0
- package/node_modules/@capyclaw/foundation/lib/kernel.mjs +195 -0
- package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +115 -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 +198 -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 +71 -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 +132 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat.mjs +26 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +60 -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/service/static.mjs +79 -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 +664 -0
- package/node_modules/@capyclaw/plugin-kit/src/zip.mjs +181 -0
- package/node_modules/@capyclaw/portal/README.md +70 -0
- package/node_modules/@capyclaw/portal/lib/index.mjs +387 -0
- package/node_modules/@capyclaw/portal/lib/ledger.mjs +194 -0
- package/node_modules/@capyclaw/portal/lib/portal-agent.ps1 +811 -0
- package/node_modules/@capyclaw/portal/lib/portal-darwin.mjs +183 -0
- package/node_modules/@capyclaw/portal/package.json +40 -0
- package/node_modules/@capyclaw/service-broker/README.md +104 -0
- package/node_modules/@capyclaw/service-broker/cordis.patch.yml +8 -0
- package/node_modules/@capyclaw/service-broker/dsh-suite.json +21 -0
- package/node_modules/@capyclaw/service-broker/lib/control.mjs +209 -0
- package/node_modules/@capyclaw/service-broker/lib/discovery.mjs +109 -0
- package/node_modules/@capyclaw/service-broker/lib/engine.mjs +1290 -0
- package/node_modules/@capyclaw/service-broker/lib/host.mjs +187 -0
- package/node_modules/@capyclaw/service-broker/lib/manifest.mjs +262 -0
- package/node_modules/@capyclaw/service-broker/lib/recovery.mjs +275 -0
- package/node_modules/@capyclaw/service-broker/lib/skills-client.mjs +48 -0
- package/node_modules/@capyclaw/service-broker/lib/spec.mjs +78 -0
- package/node_modules/@capyclaw/service-broker/package.json +65 -0
- package/node_modules/@capyclaw/service-broker/server.mjs +81 -0
- package/node_modules/@capyclaw/service-broker/service.schema.json +62 -0
- package/node_modules/@capyclaw/service-broker/services.json +3 -0
- package/node_modules/@capyclaw/service-host/README.md +86 -0
- package/node_modules/@capyclaw/service-host/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/service-host/dsh-suite.json +29 -0
- package/node_modules/@capyclaw/service-host/lib/host.mjs +22 -0
- package/node_modules/@capyclaw/service-host/package.json +60 -0
- package/node_modules/@capyclaw/service-host/src/index.mjs +570 -0
- package/node_modules/@capyclaw/service-host/src/tuning.mjs +63 -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 +46 -0
- package/node_modules/@capyclaw/tool-host/package.json +59 -0
- 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/descriptors.mjs +166 -0
- package/node_modules/@capyclaw/tool-host/src/index.mjs +461 -0
- package/node_modules/@capyclaw/tool-host/src/mode-gate.mjs +272 -0
- package/node_modules/@capyclaw/wall-workbench/README.md +58 -0
- package/node_modules/@capyclaw/wall-workbench/contract/wall-contract.json +8 -0
- package/node_modules/@capyclaw/wall-workbench/lib/host.mjs +1 -0
- package/node_modules/@capyclaw/wall-workbench/package.json +63 -0
- package/node_modules/@capyclaw/wall-workbench/plugin.mjs +13 -0
- package/node_modules/@capyclaw/wall-workbench/server/activate-log.mjs +66 -0
- package/node_modules/@capyclaw/wall-workbench/server/constants.mjs +12 -0
- package/node_modules/@capyclaw/wall-workbench/server/contract.mjs +12 -0
- package/node_modules/@capyclaw/wall-workbench/server/embedded-host.mjs +162 -0
- package/node_modules/@capyclaw/wall-workbench/server/infra/http.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/infra/tuning.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/relay.mjs +68 -0
- package/node_modules/@capyclaw/wall-workbench/server/routes/claim.mjs +46 -0
- package/node_modules/@capyclaw/wall-workbench/server/routes/workbench.mjs +29 -0
- package/node_modules/@capyclaw/wall-workbench/server/shared/SHARED_MANIFEST.json +70 -0
- package/node_modules/@capyclaw/wall-workbench/server/shared/asset-service.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/shared/editor-host.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/shared/kit/editor/lease.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/shared/kit/service/api.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/shared/kit/service/http.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/shared/kit/service/mcp-http.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/shared/kit/tools/validate.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/shared/kit/tuning.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/shared/kit/util/fs-lock.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/shared/service-host.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/shared/tool-host.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/shared/tuning.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/tools/capabilities/index.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/tools/index.mjs +12 -0
- package/node_modules/@capyclaw/wall-workbench/server/tools.mjs +2 -0
- package/node_modules/@capyclaw/wall-workbench/server/workbench-framework.mjs +339 -0
- package/node_modules/@capyclaw/wall-workbench/ui/app.js +225 -0
- package/node_modules/@capyclaw/wall-workbench/ui/index.html +20 -0
- package/node_modules/@capyclaw/wall-workbench/ui/style.css +77 -0
- package/package.json +72 -4
- package/services.json +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CapyClaw
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @capyclaw/wall-suite
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
展示墙工作台套件:主区空态选择器。会话未绑定工作台模式时,主区舞台摆出选择器,列出已注册的工作台类型,点选即显式认领会话模式(`explicit`,豁免内容闸,全新会话也能立刻摆出真实工作台)。
|
|
4
|
+
|
|
5
|
+
## 组成
|
|
6
|
+
|
|
7
|
+
- `@capyclaw/wall-workbench`(runtime)— 选择器页 + `/claim` 认领端点;零工具零技能。注册行带 `config.idleDefault: true`(空态兜底标记,portal-hud 单一真源)。
|
|
8
|
+
- components:`capyclaw-service-host` / `capyclaw-tool-host` / `capyclaw-asset-service`(能力图:`host.http` / `tools.registry` / `assets.store`)。
|
|
9
|
+
- support:`@capyclaw/plugin-kit`、`@capyclaw/foundation`、`@capyclaw/service-broker`。
|
|
10
|
+
|
|
11
|
+
公共基建(os / toolHost / serviceHost / assets / serviceBroker)由 `@capyclaw/core` 统一提供,本套件只依赖不重复声明行;需同一 profile 启用 core。
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
dsh plugin --profile web add @capyclaw/wall-suite
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 许可证
|
|
20
|
+
|
|
21
|
+
MIT
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"suite": "capyclaw-wall-suite",
|
|
3
|
+
"suiteVersion": "0.1.1",
|
|
4
|
+
"packages": {
|
|
5
|
+
"@capyclaw/asset-service": {
|
|
6
|
+
"version": "0.1.6",
|
|
7
|
+
"apiVersion": "1.0.0",
|
|
8
|
+
"path": "..\\..\\..\\..\\..\\..\\C\\packages\\capyclaw-asset-service",
|
|
9
|
+
"sha256": "f776c6f40bb3ffb8511e7c471d53779e81efb29a4aa40c14172ea153d4071a9f"
|
|
10
|
+
},
|
|
11
|
+
"@capyclaw/foundation": {
|
|
12
|
+
"version": "0.1.11",
|
|
13
|
+
"apiVersion": "1.0.0",
|
|
14
|
+
"path": "../../../../../../C/packages/capyclaw-foundation",
|
|
15
|
+
"sha256": "2b1860bd9081f8ebeade500255bf908fe5d62740d2394c7d0b0f65149a2c82b5"
|
|
16
|
+
},
|
|
17
|
+
"@capyclaw/plugin-kit": {
|
|
18
|
+
"version": "0.2.8",
|
|
19
|
+
"apiVersion": null,
|
|
20
|
+
"path": "../../../../../../C/packages/capyclaw-plugin-kit",
|
|
21
|
+
"sha256": "5b9dd6bdadee6ecb32efcb59b59e7d6bbcd770fdb7762fc8f5aa90eedfee6186"
|
|
22
|
+
},
|
|
23
|
+
"@capyclaw/service-broker": {
|
|
24
|
+
"version": "0.2.27",
|
|
25
|
+
"apiVersion": "1.0.0",
|
|
26
|
+
"path": "../../../../../../C/packages/capyclaw-service-broker",
|
|
27
|
+
"sha256": "75df80d0e2f8df30138937fb601607a2ddade449c64f12e08a45e48cff1712e1"
|
|
28
|
+
},
|
|
29
|
+
"@capyclaw/service-host": {
|
|
30
|
+
"version": "0.1.7",
|
|
31
|
+
"apiVersion": "1.0.0",
|
|
32
|
+
"path": "..\\..\\..\\..\\..\\..\\C\\packages\\capyclaw-service-host",
|
|
33
|
+
"sha256": "be173a38c0087fa6fdb06a10e57356a02afe836ac9994b905eb00abe6516ce45"
|
|
34
|
+
},
|
|
35
|
+
"@capyclaw/tool-host": {
|
|
36
|
+
"version": "0.3.2",
|
|
37
|
+
"apiVersion": "1.1.0",
|
|
38
|
+
"path": "..\\..\\..\\..\\..\\..\\C\\packages\\capyclaw-tool-host",
|
|
39
|
+
"sha256": "2e4927e7281457602a57eadff33ae25ea4b5d60539d319d9819d86c0db92aadd"
|
|
40
|
+
},
|
|
41
|
+
"@capyclaw/wall-workbench": {
|
|
42
|
+
"version": "0.1.2",
|
|
43
|
+
"apiVersion": null,
|
|
44
|
+
"path": "../capyclaw-wall-workbench",
|
|
45
|
+
"sha256": "d6a93b79d0d0b92b35a0c597261a3dd3eab2ed694c9acda74f436a7886d1daca"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
package/cordis.patch.yml
ADDED
package/dsh-suite.json
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../../../../C/packages/capyclaw-suite-kit/suite.schema.json",
|
|
3
|
+
"name": "capyclaw-wall-suite",
|
|
4
|
+
"version": "0.1.1",
|
|
5
|
+
"title": "展示墙工作台套件",
|
|
6
|
+
"description": "主区空态选择器(挂在 dsh 的 /capyclaw/wall,路由与端口由基建决定):会话未绑定模式时列出已注册的工作台类型,点选即显式认领会话模式;零工具零技能。公共基建(os / toolHost / serviceHost / assets / serviceBroker)由 @capyclaw/core 统一提供,需同一 profile 启用它。",
|
|
7
|
+
"packages": {
|
|
8
|
+
"@capyclaw/foundation": {
|
|
9
|
+
"role": "runtime",
|
|
10
|
+
"version": "^0.1.11",
|
|
11
|
+
"path": "./node_modules/@capyclaw/foundation"
|
|
12
|
+
},
|
|
13
|
+
"@capyclaw/plugin-kit": {
|
|
14
|
+
"role": "support",
|
|
15
|
+
"version": "^0.2.8",
|
|
16
|
+
"path": "./node_modules/@capyclaw/plugin-kit"
|
|
17
|
+
},
|
|
18
|
+
"@capyclaw/service-broker": {
|
|
19
|
+
"role": "runtime",
|
|
20
|
+
"version": "^0.2.27",
|
|
21
|
+
"path": "./node_modules/@capyclaw/service-broker",
|
|
22
|
+
"provides": {
|
|
23
|
+
"services": [
|
|
24
|
+
"serviceBroker"
|
|
25
|
+
],
|
|
26
|
+
"capabilities": {
|
|
27
|
+
"service.broker": "1.0.0"
|
|
28
|
+
},
|
|
29
|
+
"ports": []
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"@capyclaw/wall-workbench": {
|
|
33
|
+
"role": "runtime",
|
|
34
|
+
"version": "^0.1.2",
|
|
35
|
+
"path": "./node_modules/@capyclaw/wall-workbench",
|
|
36
|
+
"requires": {
|
|
37
|
+
"capabilities": {
|
|
38
|
+
"host.http": "^1.0.0",
|
|
39
|
+
"tools.registry": "^1.0.0",
|
|
40
|
+
"assets.store": "^1.0.0"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"provides": {
|
|
44
|
+
"tools": [
|
|
45
|
+
"wall_*"
|
|
46
|
+
],
|
|
47
|
+
"capabilities": {
|
|
48
|
+
"editor.bridge": "1.0.0",
|
|
49
|
+
"wall.runtime": "1.0.0",
|
|
50
|
+
"wall.tools": "1.0.0",
|
|
51
|
+
"wall.surfaceLifecycle": "1.0.0"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"surfaceLifecycle": {
|
|
55
|
+
"hooks": [
|
|
56
|
+
"onVisibility",
|
|
57
|
+
"suspendRender",
|
|
58
|
+
"resumeRender",
|
|
59
|
+
"rehydrate"
|
|
60
|
+
],
|
|
61
|
+
"headlessObservation": true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"@capyclaw/service-host": {
|
|
65
|
+
"role": "provider",
|
|
66
|
+
"version": "^0.1.7",
|
|
67
|
+
"path": "./node_modules/@capyclaw/service-host",
|
|
68
|
+
"provides": {
|
|
69
|
+
"services": [
|
|
70
|
+
"serviceHost"
|
|
71
|
+
],
|
|
72
|
+
"capabilities": {
|
|
73
|
+
"host.http": "1.0.0"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"@capyclaw/tool-host": {
|
|
78
|
+
"role": "provider",
|
|
79
|
+
"version": "^0.3.2",
|
|
80
|
+
"path": "./node_modules/@capyclaw/tool-host",
|
|
81
|
+
"provides": {
|
|
82
|
+
"services": [
|
|
83
|
+
"toolHost"
|
|
84
|
+
],
|
|
85
|
+
"capabilities": {
|
|
86
|
+
"tools.registry": "1.0.0",
|
|
87
|
+
"tools.descriptors": "1.1.0"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"@capyclaw/asset-service": {
|
|
92
|
+
"role": "provider",
|
|
93
|
+
"version": "^0.1.6",
|
|
94
|
+
"path": "./node_modules/@capyclaw/asset-service",
|
|
95
|
+
"provides": {
|
|
96
|
+
"services": [
|
|
97
|
+
"assets"
|
|
98
|
+
],
|
|
99
|
+
"capabilities": {
|
|
100
|
+
"assets.store": "1.0.0"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"rows": [
|
|
106
|
+
{
|
|
107
|
+
"id": "service-host",
|
|
108
|
+
"name": "@capyclaw/service-host"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"id": "tool-host",
|
|
112
|
+
"name": "@capyclaw/tool-host"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"id": "asset-service",
|
|
116
|
+
"name": "@capyclaw/asset-service"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "wall-workbench",
|
|
120
|
+
"name": "@capyclaw/wall-workbench",
|
|
121
|
+
"config": {
|
|
122
|
+
"mountPath": "/capyclaw/wall",
|
|
123
|
+
"idleDefault": true
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"checks": []
|
|
128
|
+
}
|
package/lib/index.mjs
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @capyclaw/asset-service
|
|
2
|
+
|
|
3
|
+
DSH 公共资产插件。功能插件通过 `ctx.assets` 获得统一的 sha256 对象仓库和 `/assets` 路由。
|
|
4
|
+
|
|
5
|
+
## 使用
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
export const inject = ['assets']
|
|
9
|
+
|
|
10
|
+
export function apply(ctx) {
|
|
11
|
+
const app = ctx.serviceHost.createApp({ id: 'my-plugin' })
|
|
12
|
+
app.use(ctx.assets.routes())
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// 或在插件内部写入
|
|
16
|
+
const asset = await ctx.assets.put(buffer, 'image/png')
|
|
17
|
+
// { id, key, url: '/assets/<sha256>', size, contentType }
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
独立运行或测试:
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import { createFileAssetStore, createAssetRoutes } from '@capyclaw/asset-service/src'
|
|
24
|
+
const store = createFileAssetStore({ dir: './assets' })
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 路由归属
|
|
28
|
+
|
|
29
|
+
多个插件共用一个 service-host app 时,用 `ctx.assets.mount(app)` 只挂一次 `/assets`:
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
ctx.assets.mount(app, { store: assetStore })
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
重复 mount 会被忽略;不要再手写 `app.use(ctx.assets.routes())`。
|
|
36
|
+
|
|
37
|
+
## 提供什么
|
|
38
|
+
|
|
39
|
+
- `createWorkspaceAssetStore({ storeClient, workId })`:资产归当前 work
|
|
40
|
+
- `createFileAssetStore({ dir })`:本地目录后端
|
|
41
|
+
- `createAssetRoutes({ assetStore, basePath })`:GET/HEAD `/assets/<id>`、POST `<basePath>/assets`
|
|
42
|
+
- `ctx.assets.put/get`:默认 store 快捷方法
|
|
43
|
+
|
|
44
|
+
## 契约
|
|
45
|
+
|
|
46
|
+
- 资产按 sha256 去重,不可变
|
|
47
|
+
- url 固定为 `/assets/<id>`,可长期缓存
|
|
48
|
+
- 内容类型由上传方声明,读取时原样返回
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../capyclaw-suite-kit/suite.schema.json",
|
|
3
|
+
"name": "dsh-asset-service-suite",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"title": "Asset Service",
|
|
6
|
+
"description": "通用对象资产:sha256 仓库、/assets 路由、上传。",
|
|
7
|
+
"packages": {
|
|
8
|
+
"@capyclaw/asset-service": {
|
|
9
|
+
"role": "provider",
|
|
10
|
+
"version": "^0.1.6",
|
|
11
|
+
"path": ".",
|
|
12
|
+
"provides": {
|
|
13
|
+
"services": [
|
|
14
|
+
"assets"
|
|
15
|
+
],
|
|
16
|
+
"capabilities": {
|
|
17
|
+
"assets.store": "1.0.0"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"rows": [
|
|
23
|
+
{
|
|
24
|
+
"id": "asset-service",
|
|
25
|
+
"name": "@capyclaw/asset-service"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"checks": []
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** @capyclaw/asset-service 插件:向同进程插件提供 ctx.assets。 */
|
|
2
|
+
import { defineDriver } from '@capyclaw/foundation/abi'
|
|
3
|
+
import { createAssetHost } from '../src/index.mjs'
|
|
4
|
+
|
|
5
|
+
export const { name, inject, apply } = defineDriver({
|
|
6
|
+
name: 'asset-service',
|
|
7
|
+
service: 'assets',
|
|
8
|
+
apply(ctx, config = {}) {
|
|
9
|
+
const service = createAssetHost(config)
|
|
10
|
+
const dispose = ctx.provide('assets', service)
|
|
11
|
+
console.log('[asset-service] ready')
|
|
12
|
+
return () => { if (typeof dispose === 'function') dispose() }
|
|
13
|
+
},
|
|
14
|
+
})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@capyclaw/asset-service",
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "DSH 公共资产插件:sha256 对象仓库、/assets 路由、base64 上传与 content-type,向插件提供 ctx.assets。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./lib/host.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/host.mjs",
|
|
9
|
+
"./src": "./src/index.mjs",
|
|
10
|
+
"./package.json": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=18",
|
|
14
|
+
"dsh": "^0.2.0-rc.2"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"dsh": {
|
|
20
|
+
"bundle": {
|
|
21
|
+
"patch": "./cordis.patch.yml"
|
|
22
|
+
},
|
|
23
|
+
"suite": "./dsh-suite.json",
|
|
24
|
+
"apiVersion": "1.0.0",
|
|
25
|
+
"category": "service",
|
|
26
|
+
"platform": "both",
|
|
27
|
+
"driver": {
|
|
28
|
+
"service": "assets"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"meta": {
|
|
32
|
+
"title": "公共资产服务",
|
|
33
|
+
"description": "sha256 对象仓库、/assets 路由、base64 上传与 content-type,向插件提供 ctx.assets"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"lib/",
|
|
37
|
+
"src/",
|
|
38
|
+
"cordis.patch.yml",
|
|
39
|
+
"dsh-suite.json",
|
|
40
|
+
"README.md"
|
|
41
|
+
],
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"scripts": {
|
|
44
|
+
"test": "node --test test/*.test.mjs"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@capyclaw/plugin-kit": "^0.2.0",
|
|
48
|
+
"@capyclaw/foundation": "^0.1.1"
|
|
49
|
+
},
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/Maple496/capyclaw.git",
|
|
53
|
+
"directory": "C/packages/capyclaw-asset-service"
|
|
54
|
+
},
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/Maple496/capyclaw/issues"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://github.com/Maple496/capyclaw/tree/main/C/packages/capyclaw-asset-service#readme"
|
|
59
|
+
}
|