@forgeax/game 0.3.6 → 0.3.8
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 +16 -130
- package/assets/extensions/asset3d/cli.mjs +2090 -0
- package/assets/extensions/asset3d/extension.json +7 -0
- package/assets/extensions/asset3d/skills/art-3d-asset-library/SKILL.md +28 -0
- package/assets/licenses/fflate.txt +21 -0
- package/assets/skills/forgeax-game/SKILL.md +4 -7
- package/dist/main.js +582 -2460
- package/docs/asset3d.md +43 -193
- package/docs/plugin-integration-standard.md +196 -0
- package/package.json +3 -9
- package/assets/asset3d/adapter/SKILL.md +0 -56
- package/assets/asset3d/provider/asset3d-search-provider-a274238712c1dced99e4aa3148a0d15904ce2a90-darwin-arm64.tar.gz +0 -0
- package/assets/asset3d/provider/asset3d-search-provider-a274238712c1dced99e4aa3148a0d15904ce2a90-linux-x64.tar.gz +0 -0
- package/assets/asset3d/schemas/receipt-1.0.0.json +0 -29
- package/assets/asset3d/schemas/result-1.0.0.json +0 -361
- package/assets/asset3d/vibegame-art-3d-asset-library-2.0.0.tgz +0 -0
- package/assets/asset3d/vibegame-art-3d-asset-library-2.0.0.tgz.sha256 +0 -1
- package/docs/release-0.3.0.md +0 -100
- package/docs/release-0.3.1.md +0 -107
- package/docs/release-0.3.2.md +0 -90
- package/docs/release-0.3.3.md +0 -73
- package/docs/release-0.3.4.md +0 -66
- package/docs/release-0.3.5.md +0 -32
package/docs/asset3d.md
CHANGED
|
@@ -1,207 +1,57 @@
|
|
|
1
|
-
# Asset3D
|
|
1
|
+
# Asset3D:Skill + CLI
|
|
2
2
|
|
|
3
|
-
Asset3D
|
|
4
|
-
|
|
5
|
-
package, and the released ForgeaX Engine SDK. `@forgeax/game` owns installation,
|
|
6
|
-
configuration, quarantine validation, transaction state, and the handoff to the
|
|
7
|
-
Engine CLI. It does not call an asset service directly and does not implement a
|
|
8
|
-
second importer or Preview server.
|
|
3
|
+
Asset3D 默认关闭。插件内的 TypeScript CLI 直接调用 AW/EA HybridSearch,下载原生
|
|
4
|
+
Pack 或 GLB,再交给固定版本 Engine 导入。没有 Python Provider、Asset3D MCP 或转换服务。
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
> Asset3D is disabled by default. `install` and ordinary `init` neither contact the
|
|
12
|
-
> internal catalog nor write Asset3D project state. The user must run `asset3d enable`
|
|
13
|
-
> inside an already initialized Engine game.
|
|
6
|
+
## 使用
|
|
14
7
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
> real service-path evidence.
|
|
24
|
-
|
|
25
|
-
## Trust and data flow
|
|
26
|
-
|
|
27
|
-
```mermaid
|
|
28
|
-
flowchart LR
|
|
29
|
-
U["Hidden key input or automation secret"] --> CRED["Private user credential file"]
|
|
30
|
-
B["Provider archive bundled in npm"] --> C["Managed digest cache"]
|
|
31
|
-
PKG["Exact K0 workflow TGZ"] --> S["Nine project Skill mounts"]
|
|
32
|
-
C --> M["Project-local stdio MCP"]
|
|
33
|
-
CRED --> M
|
|
34
|
-
M --> H["AW HybridSearch access check"]
|
|
35
|
-
H --> D["Exact signed-download origins"]
|
|
36
|
-
M --> Q["Private transaction quarantine"]
|
|
37
|
-
Q --> V["Checked result and file manifest"]
|
|
38
|
-
V --> A["Atomic asset-directory publication"]
|
|
39
|
-
A --> E["Exact Engine semantic-only asset add"]
|
|
40
|
-
E --> R["Engine verify, list, and inspect"]
|
|
41
|
-
R --> P["Per-file provenance and terminal result"]
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
The provider is the only network adapter. `asset3d enable` invokes its bounded
|
|
45
|
-
`--check-aw-access` mode before publishing project configuration. That mode calls AW
|
|
46
|
-
`HybridSearch` with the documented `X-Sandbox-Key` header and required 3D search
|
|
47
|
-
fields, then emits only `authentication=sandbox-key` plus the canonical origins of
|
|
48
|
-
returned short-lived `res_url` values. Asset IDs, candidates, signed URLs, request
|
|
49
|
-
bodies, and the key are never returned by the access check.
|
|
50
|
-
|
|
51
|
-
Installed download authorities are
|
|
52
|
-
lexically exact `http://host:port` or `https://host:port` values: explicit port,
|
|
53
|
-
no path (including `/`), no query, fragment, userinfo, or wildcard. The canonical
|
|
54
|
-
one-to-eight member set is sorted and encoded as compact JSON in
|
|
55
|
-
`AW_DOWNLOAD_ORIGINS`; `.forgeax/asset3d-install.json` records only its SHA-256
|
|
56
|
-
digest. The provider is responsible for enforcing that set on both initial and
|
|
57
|
-
redirect requests.
|
|
58
|
-
|
|
59
|
-
Normal installation writes the selected service root to `AW_API_BASE_URL`, the
|
|
60
|
-
matching `AW_API_DEPOT_NAME=aw|ea`, and an absolute user credential-file path to
|
|
61
|
-
`AW_API_CREDENTIAL_FILE`. The `AW_API_*` names are the packaged Provider's legacy
|
|
62
|
-
environment contract. Installation never writes `AW_API_SANDBOX_KEY` into project
|
|
63
|
-
MCP configuration. `--catalog-base-url` remains a
|
|
64
|
-
maintainer-only compatibility adapter for the retired directory service; when used,
|
|
65
|
-
its authority must also appear in `--download-origin`.
|
|
66
|
-
|
|
67
|
-
## Installation ownership
|
|
68
|
-
|
|
69
|
-
`asset3d enable` keeps the public AW depot by default. `--library ea` selects the EA
|
|
70
|
-
depot and its office-network local gateway; `FORGEAX_ASSET_LIBRARY=ea` is the
|
|
71
|
-
deployment equivalent. Gateway selection precedence is explicit `--base-url`, then
|
|
72
|
-
`FORGEAX_ASSET_LIBRARY_BASE_URL`, then the selected library's built-in service.
|
|
73
|
-
Gateway overrides never change the selected depot. The first interactive run asks
|
|
74
|
-
for the Sandbox Key with terminal echo
|
|
75
|
-
disabled. Automation can supply `FORGEAX_ASSET3D_AW_SANDBOX_KEY` from a secret store;
|
|
76
|
-
command-line key arguments are deliberately unsupported.
|
|
77
|
-
|
|
78
|
-
The credential is stored outside the project at
|
|
79
|
-
`~/.forgeax/credentials/asset3d-aw.json` by default. The directory is `0700`; the
|
|
80
|
-
file must be regular, owned by the current user, non-symlink, at most 4 KiB, and
|
|
81
|
-
`0600`. The Provider accepts only the versioned AW credential schema. A failed access
|
|
82
|
-
check or downstream installation rolls back a newly written value. An existing valid
|
|
83
|
-
credential makes repeat enablement idempotent. The plugin never treats Anthropic or
|
|
84
|
-
another model-provider credential as an Asset3D key.
|
|
85
|
-
|
|
86
|
-
The command reuses an exact verified cache when present. Otherwise it opens the
|
|
87
|
-
platform archive carried by the installed `@forgeax/game` package and verifies the
|
|
88
|
-
pinned SHA-256 before any provisioning. No Provider download or source-repository
|
|
89
|
-
authentication occurs during `asset3d enable`. Bundle schema, provider commit,
|
|
90
|
-
platform, Python range, and checked result/receipt schema digests are then verified
|
|
91
|
-
before invoking the offline bundle verifier. Provisioning uses system
|
|
92
|
-
Python 3.11 or 3.12 and the Provider's hash-locked `--provision` flow. The published
|
|
93
|
-
cache is keyed by archive digest under `~/.forgeax/providers/asset3d-search/`.
|
|
94
|
-
|
|
95
|
-
The low-level `asset3d install --provider-bundle ...` command remains a maintainer
|
|
96
|
-
surface for bundle production and controlled evidence; users enable the pinned
|
|
97
|
-
archive carried by their installed Game Plugin rather than selecting an arbitrary
|
|
98
|
-
archive.
|
|
99
|
-
|
|
100
|
-
The installer merges, rather than replaces, the complete `.forgeax/mcp.json` object.
|
|
101
|
-
Unrelated top-level keys and servers survive. The owned entries are local stdio only:
|
|
102
|
-
|
|
103
|
-
| Server | Tool timeout | Operation bound |
|
|
104
|
-
|:--|--:|--:|
|
|
105
|
-
| `asset3d-search` / `search_asset` | 195,000 ms | provider work 180,000 ms plus cleanup and bridge margin |
|
|
106
|
-
| `forgeax` / `forgeax_run_current_game` | 165,000 ms | Game Plugin build/readiness 150,000 ms plus cleanup and bridge margin |
|
|
107
|
-
| either server, unknown tool | 30,000 ms | project-MCP default |
|
|
108
|
-
|
|
109
|
-
A conflicting server is not overwritten. `--replace-owned` is accepted only when the
|
|
110
|
-
current entry still matches the prior ownership digest. Configuration, manifests,
|
|
111
|
-
journals, locks, and provenance are private; file publication uses same-directory
|
|
112
|
-
temporary files, file and directory fsync, and atomic rename. Reinstall is byte
|
|
113
|
-
idempotent. Uninstall removes only entries and Skill files that still match owned
|
|
114
|
-
digests, leaving user-modified or unrelated content in place and reporting the
|
|
115
|
-
collision.
|
|
116
|
-
|
|
117
|
-
For user-scoped MCP hosts such as Codex, Cursor, and Claude, `enable` additionally
|
|
118
|
-
registers a non-secret `asset3d-search` bridge command. The bridge resolves
|
|
119
|
-
`.forgeax/asset3d-install.json` and the owned `.forgeax/mcp.json` entry from the host
|
|
120
|
-
process working directory, rather than pinning a user config to one project. A
|
|
121
|
-
project without an Asset3D installation receives a healthy MCP handshake with an
|
|
122
|
-
empty tool list. Start a new Agent session after enabling so `search_asset` appears.
|
|
123
|
-
|
|
124
|
-
The workflow package is projected beneath `art-3d-asset-library/` in exactly these
|
|
125
|
-
mounts unless `--ide` selects a subset:
|
|
126
|
-
|
|
127
|
-
```text
|
|
128
|
-
.agents/skills .claude/skills
|
|
129
|
-
.cursor/skills .trae/skills
|
|
130
|
-
.codebuddy/skills .codeium/windsurf/skills
|
|
131
|
-
.vscode/skills .zcode/skills
|
|
132
|
-
.config/opencode/skills
|
|
8
|
+
```bash
|
|
9
|
+
npx -y @forgeax/game@0.3.8 install --ide codex
|
|
10
|
+
# 在空目录
|
|
11
|
+
npx -y @forgeax/game@0.3.8 init
|
|
12
|
+
npx -y @forgeax/game@0.3.8 asset3d enable --ide codex
|
|
13
|
+
npx -y @forgeax/game@0.3.8 asset3d candidates --query "wooden crate" --json
|
|
14
|
+
# 阅读候选后选择 ID
|
|
15
|
+
npx -y @forgeax/game@0.3.8 asset3d import --query "wooden crate" --asset-id "<返回的ID>" --json
|
|
133
16
|
```
|
|
134
17
|
|
|
135
|
-
|
|
136
|
-
|
|
18
|
+
以上版本为当前本地候选,发布前不能通过 npm 获取;本地验证使用已安装候选的
|
|
19
|
+
`node "/absolute/consumer/node_modules/@forgeax/game/dist/main.js"` 替代 npx 前缀。
|
|
20
|
+
本地候选启用时加 `--local`;安装后的 Skill 自动包含匹配的命令。
|
|
137
21
|
|
|
138
|
-
|
|
22
|
+
默认库为 AW;EA 需要 `--library ea --base-url "<获授权的网关>"`,
|
|
23
|
+
也可设置 `FORGEAX_ASSET_LIBRARY_BASE_URL`。显式 URL 不会在失败后回退。
|
|
24
|
+
当前服务采用 `X-Sandbox-Key`,首次 enable 隐藏输入并执行真实搜索探测。
|
|
25
|
+
自动化使用 `FORGEAX_ASSET3D_AW_SANDBOX_KEY`;`--json` 缺凭证不会等待输入。
|
|
139
26
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
and `output_format: "asset"`. The Provider checks that the ID still belongs to the
|
|
145
|
-
live query results; an invented or stale ID fails instead of selecting another
|
|
146
|
-
asset. A GLB result does not prove native Pack support.
|
|
27
|
+
凭证保存在项目外的私有文件;项目 `.forgeax/extensions/asset3d/config.json` 只保存服务地址、
|
|
28
|
+
库、凭证文件引用、允许的下载来源和版本。Skill 归属由统一的 install.json 记录。
|
|
29
|
+
只挂载所选 Host 的一个 SKILL.md。
|
|
30
|
+
`install/update` 会移除可确认由旧插件创建的 Asset3D MCP 注册;自定义注册保留并提示。
|
|
147
31
|
|
|
148
|
-
|
|
149
|
-
provider identity, exact Engine identity, requested count, and the only allowed
|
|
150
|
-
quarantine root.
|
|
151
|
-
2. `search_asset` accepts that execution UUID instead of an output path. The Game
|
|
152
|
-
Plugin bridge verifies the exact queries and injects the transaction-owned
|
|
153
|
-
provider directory beneath its private `workspace/` root.
|
|
154
|
-
3. The configured provider writes beneath that directory and returns one checked
|
|
155
|
-
`forgeax.asset3d-search-result/1.0.0` TextContent JSON object. The bridge stores
|
|
156
|
-
those exact bytes against the execution; the agent does not copy the object.
|
|
157
|
-
4. `asset3d commit --execution <uuid>` reads the stored result (at most 1 MiB),
|
|
158
|
-
validates exact fields/counts/roles/digests/sorted relative paths, and ignores
|
|
159
|
-
`downloaded_to`.
|
|
160
|
-
5. The transaction rejects symlinks, special files, undeclared files, realpath escape,
|
|
161
|
-
byte mismatch, or digest mismatch before a project asset write.
|
|
162
|
-
6. A 30-second per-asset lock serializes publication at
|
|
163
|
-
`assets/3d/ea-3d/<safeAssetId>`. The complete prior directory is preserved as the
|
|
164
|
-
refresh/rollback snapshot.
|
|
165
|
-
7. With the game root as `cwd`, Game Plugin runs the exact released Engine CLI.
|
|
166
|
-
For GLB imports:
|
|
32
|
+
## 命令和结果
|
|
167
33
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
34
|
+
| 命令 | 语义 |
|
|
35
|
+
|:--|:--|
|
|
36
|
+
| enable | 探测服务,保存配置和 Skill |
|
|
37
|
+
| doctor --json | 本地配置、Engine 与 CLI 身份;可恢复中断的提交,不代表远端可访问 |
|
|
38
|
+
| candidates --query … --json | 返回候选 ID、名称、格式;不暴露签名下载 URL |
|
|
39
|
+
| import --query … --asset-id … --json | 重新确认候选,下载、完整性校验、Engine 导入和身份读回 |
|
|
40
|
+
| disable --json | 撤销 Skill、配置和临时数据;修改过的 Skill 移到非发现目录备份,保留资产和共享凭证 |
|
|
174
41
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
Native Pack sources instead use the Engine build and verified build catalog;
|
|
179
|
-
the plugin preserves the complete source closure and reads cooked scene/mesh
|
|
180
|
-
GUIDs back. It does not run `asset add` on `.pack.ts` or `.pack.json`.
|
|
181
|
-
8. Only after Engine readback succeeds does `.forgeax-asset.json` publish the provider
|
|
182
|
-
commit, origin-set digest, exact Engine version/commit, per-file role/digest/bytes,
|
|
183
|
-
Engine rows, and catalog readback. An Engine failure restores the whole previous
|
|
184
|
-
asset directory.
|
|
42
|
+
原生 `.pack.ts/.pack.json` 及其辅助文件保留完整;不伪装成 GLB。
|
|
43
|
+
导入源位于 `assets/3d/ea-3d/<assetId>`,结果返回 `deliveredFormat` 与 Engine GUID。
|
|
44
|
+
同摘要资产校验后可复用;已有内容发生变化时失败,不静默覆盖。
|
|
185
45
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
restores a stale `committing` snapshot and never reports the interrupted operation as
|
|
190
|
-
successful; `asset3d abort` removes only its transaction quarantine.
|
|
46
|
+
请求不跟随重定向,下载只允许 enable 确认的来源,不带 API Key;
|
|
47
|
+
ZIP 解压限制路径、文件数、单文件和总大小。下载器不执行源码,
|
|
48
|
+
但 Engine 构建 Pack 会执行其中代码,因此资产库必须受信。
|
|
191
49
|
|
|
192
|
-
##
|
|
50
|
+
## 验收边界
|
|
193
51
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
Provider archive for every supported target. It does not embed a provisioned Python
|
|
197
|
-
environment, managed Provider cache, Engine payload, source checkout, credentials, or
|
|
198
|
-
workspace links. A disabled installation neither extracts an archive nor contacts a
|
|
199
|
-
network service. The package artifact gate recomputes every embedded predecessor
|
|
200
|
-
digest.
|
|
52
|
+
导入成功不是游戏完成。用返回 GUID 接入游戏,启动 Engine-owned Preview,再验证
|
|
53
|
+
可见资产和操作。分别报告服务探测、真实搜索、导入、构建和可玩验证。
|
|
201
54
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
process cleanup. Its status is `PASS_SUPPORTING`. Real provider network results,
|
|
206
|
-
Studio project-MCP discovery, supported-host permission behavior, RuntimeInstance UI,
|
|
207
|
-
visible Play, and final independent acceptance remain outside this repository unit.
|
|
55
|
+
本次是破坏式精简:旧 begin/search/commit、Provider install 和 asset3d mcp 不再公开。
|
|
56
|
+
旧项目资产不会改动;建议全新目录验证。旧 Skill 若有冲突,先人工保存/移走旧目录后 enable,
|
|
57
|
+
不要强制覆盖用户修改。Windows 未经真实验证;macOS/Linux 以本轮测试证据为准。
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# 扩展接入规范:一个目录,Skill + CLI
|
|
2
|
+
|
|
3
|
+
适用范围:统一目录扩展实现 `d3fd8d7d`,本地 `@forgeax/game 0.3.8` 候选,尚未发布。本文是扩展作者和集成同学的交付契约,不是已发布版本的功能承诺。
|
|
4
|
+
|
|
5
|
+
扩展作者交付自包含目录,放入 `extensions/`。不修改主 CLI 分发或安装器,不注册 MCP、全局命令或后台服务。扩展是随包审核发布的可信代码,不是沙箱代码。
|
|
6
|
+
|
|
7
|
+
## 谁负责什么
|
|
8
|
+
|
|
9
|
+
| 角色 | 交付与职责 | 不需要做 |
|
|
10
|
+
|:--|:--|:--|
|
|
11
|
+
| 扩展作者 | 一个目录:清单、Skill、CLI 业务模块,以及业务测试/配置说明 | 修改主 CLI、操作 Agent 配置、实现 enable/disable 安装逻辑 |
|
|
12
|
+
| 主插件维护者 | 审核目录与依赖,构建打包,执行接入验收,随主包发布 | 为每个扩展添加命令分支 |
|
|
13
|
+
| 最终用户 | 安装主插件、初始化项目、显式启用需要的扩展 | 全局安装每个扩展的 CLI、配置资产 MCP |
|
|
14
|
+
|
|
15
|
+
当前只支持随主包交付的内置扩展。把目录放进游戏项目不会自动加载;也没有 `install <第三方目录或URL>` 命令。作者把目录交给主插件维护者或提交到主仓的 `extensions/`。
|
|
16
|
+
|
|
17
|
+
## 目录契约
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
extensions/example/
|
|
21
|
+
extension.json
|
|
22
|
+
cli.mjs
|
|
23
|
+
skills/example-use/SKILL.md
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{"schemaVersion":1,"id":"example","version":"1.0.0","skills":["skills/example-use"],"cli":"cli.mjs"}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
CLI 为 Node ESM 模块。仓内可用 `cli.ts` 编写,打包器自动编译成 `cli.mjs` 并收拢依赖;交付目录可直接提供 `cli.mjs`。清单路径不得越界或通过软链接逃逸。第一版 Skill 只交付 `SKILL.md`。
|
|
31
|
+
|
|
32
|
+
| 字段 | 当前约束 |
|
|
33
|
+
|:--|:--|
|
|
34
|
+
| `schemaVersion` | 固定数字 `1` |
|
|
35
|
+
| `id` | 与目录名一致;小写字母开头,后接小写字母、数字或连字符,总长不超过 64 |
|
|
36
|
+
| `version` | `数字.数字.数字`,如 `1.0.0`;当前不接受预发布后缀 |
|
|
37
|
+
| `skills` | 至少一个 `skills/<名称>`;名称使用小写字母开头及小写字母、数字、连字符 |
|
|
38
|
+
| `cli` | 构建契约固定为 `cli.mjs`;源文件二选一 `cli.mjs` 或 `cli.ts`,不要同时提交过期 JS 和新 TS |
|
|
39
|
+
|
|
40
|
+
ID 不得占用主命令:`install/init/uninstall/update/use/doctor/preview/devkit/agents/help/version`。
|
|
41
|
+
Skill 名应带能力前缀并保持唯一,避免不同扩展占用同一个 Agent 目录。
|
|
42
|
+
可以有 `src/` 辅助模块,通过静态 import 收入 CLI 构建产物;当前不自动复制扩展的任意资源目录、额外 Skill 文件或独立 `node_modules`。
|
|
43
|
+
新增第三方依赖须由维护者加入主仓依赖并审核许可;不要求用户在游戏里为扩展运行 npm install。
|
|
44
|
+
|
|
45
|
+
## CLI 契约
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
export async function check(context, args) {
|
|
49
|
+
// 校验启用参数、服务和认证。失败抛错,不写 Agent 配置。
|
|
50
|
+
return { endpoint: "https://example.com" }; // 仅非秘密配置
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export async function run(context, args) {
|
|
54
|
+
// 实现领域操作;返回可 JSON 序列化的结果,失败抛 Error。
|
|
55
|
+
return { items: [] };
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`context` 提供 `projectRoot`、`stateDir`、`packageVersion`。读取 `stateDir/config.json` 获取 check 返回的配置;临时业务状态只能放 `stateDir/data/`。用户明确要求导入的成果写入项目资产目录,不属于卸载垃圾。
|
|
60
|
+
|
|
61
|
+
| 字段 | 含义 |
|
|
62
|
+
|:--|:--|
|
|
63
|
+
| `projectRoot` | 当前游戏的根目录 |
|
|
64
|
+
| `stateDir` | 当前扩展的受管目录:`.forgeax/extensions/<id>` |
|
|
65
|
+
| `packageVersion` | 正在运行的主插件版本,不是扩展清单版本 |
|
|
66
|
+
|
|
67
|
+
这里的 CLI 是由 `forgeax-game <id> ...` 加载的业务模块,不是要求用户直接执行 `node cli.mjs`。模块顶层不得启动业务、读写项目或等待输入;行为放在导出的函数内。当前在主进程内加载,没有隔离沙箱。
|
|
68
|
+
|
|
69
|
+
- `check(context, args)`:接收移除 `--ide` 和 `--local` 后的 enable 参数;`--json` 仍会传入。返回非秘密 JSON 配置,不自行创建 `install.json` 或挂载 Skill。不能要求已有 stateDir,因为发布在检查成功后发生。
|
|
70
|
+
- `run(context, args)`:接收业务操作名及剩余参数,如 `["query", "--json"]`。所有领域参数由扩展自己校验。`doctor` 不是自动生成的,确有需要时由扩展实现。
|
|
71
|
+
- 返回值必须能 JSON 序列化;不要返回 `undefined`、BigInt、循环对象或完整秘密请求。失败抛出 `Error("稳定错误码: 安全说明")`,不要把含 Key 的原始错误直接上抛。
|
|
72
|
+
- 交互认证提示只用于交互终端;`--json` 缺凭证时立即失败,不无限等待。当前没有公共凭证存储 API,扩展自行使用受控私有文件/环境变量;不要声称安装器会自动管理任意凭证。
|
|
73
|
+
|
|
74
|
+
主入口统一处理 `enable/disable`、选定 Agent、版本固定、Skill 发布、失败回滚、文件所有权和项目登记。`run` 只收到业务操作;未启用时主入口拒绝调用。业务实现不能输出额外 stdout,诊断用 stderr;主入口输出 JSON envelope 和退出码。
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{"schemaVersion":"1.0.0","command":"example.query","ok":true,"value":{"items":[]}}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{"schemaVersion":"1.0.0","command":"example.query","ok":false,"error":{"code":"example_access_denied","message":"example_access_denied: access rejected"}}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
正常完成退出 0,失败非 0。顶层 `failed` 是批处理失败计数字段;当前主入口看到 `failed > 0` 会报告失败,普通业务不要用这个字段表达其他含义。合法空列表与服务失败要分开。
|
|
85
|
+
|
|
86
|
+
| 操作 | 约定 |
|
|
87
|
+
|:--|:--|
|
|
88
|
+
| `forgeax-game example enable --ide codex` | check 成功后发布配置、Skills 和安装记录 |
|
|
89
|
+
| `forgeax-game example query --json` | 通用路由调用 run,业务名由扩展决定 |
|
|
90
|
+
| `forgeax-game example disable` | 离线撤销 Skills、启用记录、配置和临时数据;重复调用安全 |
|
|
91
|
+
| `forgeax-game uninstall` | 当前项目级联停用所有扩展,再清理主插件注册 |
|
|
92
|
+
| `forgeax-game uninstall --all-projects` | 清理已登记项目;不可访问项目报错,不能声称完全卸载 |
|
|
93
|
+
|
|
94
|
+
`npm uninstall` 只删除 npm 安装,不替代产品的卸载命令。项目登记位于用户 `.forgeax/extension-projects.json`;不扫描磁盘。可用 `FORGEAX_USER_STATE_DIR` 隔离管理状态。
|
|
95
|
+
|
|
96
|
+
**作用域注意**:扩展 Skill/启用记录属于项目;主 `forgeax` MCP 的作用域由 Agent 决定,Codex 是用户级。主插件 `uninstall` 不只是当前目录文件清理,也会移除所选 Agent 的主注册。只想停用当前项目的某项能力,使用 `<id> disable`。
|
|
97
|
+
|
|
98
|
+
`enable --ide` 是增量挂载:再次选择其他 Agent 会保留此前登记的挂载;`disable` 一次回收该扩展的所有已登记挂载,不支持按 Agent 单独停用。主插件或扩展版本改变后要重新 enable;`update` 当前不会自动重新检查并启用各扩展。
|
|
99
|
+
|
|
100
|
+
受管目录只记录由新安装器登记的项目。`--all-projects` 不是旧版本目录或用户手工配置的全盘清理工具。npm 包内的扩展代码是共享分发内容,disable 撤销的是运行资格与项目注册,不删除共享包文件。
|
|
101
|
+
|
|
102
|
+
## Skill 契约
|
|
103
|
+
|
|
104
|
+
````markdown
|
|
105
|
+
---
|
|
106
|
+
name: example-use
|
|
107
|
+
description: Query the example service when the user requests its data.
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
从项目目录执行 `{{CLI}} query --json`,根据返回结果继续操作。
|
|
111
|
+
失败时说明阻塞,不伪造结果。
|
|
112
|
+
````
|
|
113
|
+
|
|
114
|
+
安装器把 `{{CLI}}` 替换为固定版本 npx 命令或本地候选的绝对入口。无需全局 CLI,不添加每个 Skill 的转发脚本。Skill 不拼 curl,不读取密钥,不规定固定候选或游戏风格。
|
|
115
|
+
|
|
116
|
+
## 作者与维护者的接入步骤
|
|
117
|
+
|
|
118
|
+
1. 作者交付上述目录,并说明外部服务、网络前提、凭证环境变量、业务命令、返回结构和写入位置。没有外部服务的扩展不增加认证步骤。
|
|
119
|
+
2. 维护者把目录放入主仓 `extensions/<id>`,审核所有权、依赖和安全边界;不要在主 `src/cli/dispatch.ts` 添加领域分支。
|
|
120
|
+
3. 在主仓执行以下检查并打候选包。源码单测不能替代已安装包验证。
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
bun run typecheck
|
|
124
|
+
bun test test/*.test.ts
|
|
125
|
+
npm pack --pack-destination /absolute/path/to/artifacts
|
|
126
|
+
bun run release:check -- /absolute/path/to/artifacts/forgeax-game-<版本>.tgz
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
4. 安装候选到独立 consumer,创建空项目,在项目目录使用该候选的绝对 CLI。下列路径为示例,须替换;`install --ide codex --local` 会更新本机 Codex 注册,测试前应明确这是预期操作。
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npm install --prefix /absolute/path/to/consumer /absolute/path/to/artifacts/forgeax-game-<版本>.tgz
|
|
133
|
+
mkdir /absolute/path/to/new-game
|
|
134
|
+
cd /absolute/path/to/new-game
|
|
135
|
+
node /absolute/path/to/consumer/node_modules/@forgeax/game/dist/main.js install --ide codex --local
|
|
136
|
+
node /absolute/path/to/consumer/node_modules/@forgeax/game/dist/main.js init
|
|
137
|
+
node /absolute/path/to/consumer/node_modules/@forgeax/game/dist/main.js example enable --ide codex --local --json
|
|
138
|
+
node /absolute/path/to/consumer/node_modules/@forgeax/game/dist/main.js example query --json
|
|
139
|
+
node /absolute/path/to/consumer/node_modules/@forgeax/game/dist/main.js example disable --json
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`query` 是业务示例,作者须提供对应实现。发布到 npm 前不要让使用者执行指向未发布版本的 npx 命令。Skill 会写入当前候选的绝对 CLI;不要移动或删除该 consumer。
|
|
143
|
+
|
|
144
|
+
5. 验证停用后的调用失败、重新启用及主插件卸载。涉及远端服务必须补真实业务证据;维护者 review 后才发布主包。
|
|
145
|
+
|
|
146
|
+
## 发布后的用户操作
|
|
147
|
+
|
|
148
|
+
下列 `<已发布版本>` 必须替换为实际已发布版本,不能直接照抄占位符。用户不必全局安装 `forgeax-game`。
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
npx -y @forgeax/game@<已发布版本> install --ide codex
|
|
152
|
+
# 进入一个空白项目目录
|
|
153
|
+
npx -y @forgeax/game@<已发布版本> init
|
|
154
|
+
npx -y @forgeax/game@<已发布版本> example enable --ide codex
|
|
155
|
+
# 新开 Agent 会话,让模型按项目 Skill 使用能力
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
停用某项能力用 `... example disable`;卸载主插件用 `... uninstall`,需要清理登记项目时加 `--all-projects`。部分 Agent 需要新会话或重启才能更新 Skill/MCP 列表。Asset3D 的服务参数和认证见 [资产库使用说明](asset3d.md)。
|
|
159
|
+
|
|
160
|
+
## 清理和安全边界
|
|
161
|
+
|
|
162
|
+
- 安装器维护 `.forgeax/extensions/<id>/install.json` 中的路径和摘要;扩展不自行挂载或删除 Skill。
|
|
163
|
+
- 停用时,修改过的受管 Skill 移入 `.forgeax/extension-backups/`,退出 Agent 发现目录。其他用户文件保留。
|
|
164
|
+
- 已导入资产和游戏成果保留。项目外用户提供的共享凭证保留,卸载不销毁其他项目仍在使用的 Key。
|
|
165
|
+
- 凭证仅从专属环境变量或私有文件读取,不写 Skill、命令参数、日志、config.json 或包产物。扩展有责任验证认证并在失败时终止。
|
|
166
|
+
- 网络操作限时限量;下载解压检查来源、路径和体积。Pack 源码交给 Engine 构建会执行代码,只接入受信服务。
|
|
167
|
+
- 只支持可信 Node CLI 目录;不引入市场、任意运行时、常驻服务或扩展依赖管理。
|
|
168
|
+
- 同一项目的扩展操作串行互斥;遇到 `extension_busy` 先确认是否仍有操作运行。进程异常终止可能留下锁,不把盲删锁写进 Skill 的自动恢复流程。
|
|
169
|
+
|
|
170
|
+
## 接入验收
|
|
171
|
+
|
|
172
|
+
- [ ] 新增目录,不修改主源码,打包后能启用和调用。
|
|
173
|
+
- [ ] check 失败不留下可发现 Skill 或启用记录。
|
|
174
|
+
- [ ] 重复 enable/disable 可执行;自定义文件不被覆盖或误删。
|
|
175
|
+
- [ ] disable 后 Skill 不被发现,业务操作报未启用。
|
|
176
|
+
- [ ] 主插件卸载级联回收,保留用户资产;不可访问项目明确报错。
|
|
177
|
+
- [ ] 真实业务路径通过;搜索、导入、可玩 Preview 分别记录,不互相替代。
|
|
178
|
+
- [ ] 发布包不含凭证、开发者路径、旧 Provider、维护脚本。
|
|
179
|
+
|
|
180
|
+
参考目录:[Asset3D](../extensions/asset3d/);统一安装器:[manager.ts](../src/extensions/manager.ts)。
|
|
181
|
+
|
|
182
|
+
## 源码 review 索引
|
|
183
|
+
|
|
184
|
+
| 想看什么 | 文件 |
|
|
185
|
+
|:--|:--|
|
|
186
|
+
| 作者交付清单 | [extensions/asset3d/extension.json](../extensions/asset3d/extension.json) |
|
|
187
|
+
| 模型实际读取的指令 | [资产 Skill](../extensions/asset3d/skills/art-3d-asset-library/SKILL.md) |
|
|
188
|
+
| check/run 业务入口 | [extensions/asset3d/cli.ts](../extensions/asset3d/cli.ts) |
|
|
189
|
+
| HTTP 搜索、下载导入 | [aw-access.ts](../extensions/asset3d/src/aw-access.ts)、[library.ts](../extensions/asset3d/src/library.ts) |
|
|
190
|
+
| Engine 事务、Pack 身份读回 | [transaction.ts](../extensions/asset3d/src/transaction.ts)、[pack-readback.ts](../extensions/asset3d/src/pack-readback.ts) |
|
|
191
|
+
| 统一生命周期与接口 | [manager.ts](../src/extensions/manager.ts)、[contract.ts](../src/extensions/contract.ts) |
|
|
192
|
+
| 命令分发与主插件级联卸载 | [dispatch.ts](../src/cli/dispatch.ts) |
|
|
193
|
+
| 自动发现和打包扩展 | [build.mjs](../build.mjs) |
|
|
194
|
+
| 生命周期测试 | [extensions.test.ts](../test/extensions.test.ts)、[真实已安装包验收脚本](../scripts/accept-extension-lifecycle.mjs) |
|
|
195
|
+
|
|
196
|
+
Asset3D 是复杂业务示例,不要求其他作者照搬其事务、下载解压或文件数量。最小扩展只需清单、一个 Skill 和一个 check/run 模块。
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageManager": "bun@1.4.0",
|
|
3
3
|
"name": "@forgeax/game",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.8",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"description": "@forgeax/game — an MCP/CLI connector for exact released ForgeaX Engine games and Engine-owned Preview.",
|
|
@@ -21,20 +21,13 @@
|
|
|
21
21
|
"dist",
|
|
22
22
|
"assets",
|
|
23
23
|
"docs/asset3d.md",
|
|
24
|
-
"docs/
|
|
25
|
-
"docs/release-0.3.1.md",
|
|
26
|
-
"docs/release-0.3.2.md",
|
|
27
|
-
"docs/release-0.3.3.md",
|
|
28
|
-
"docs/release-0.3.4.md",
|
|
29
|
-
"docs/release-0.3.5.md",
|
|
24
|
+
"docs/plugin-integration-standard.md",
|
|
30
25
|
"README.md"
|
|
31
26
|
],
|
|
32
27
|
"scripts": {
|
|
33
28
|
"build": "bun build.mjs",
|
|
34
29
|
"release:check": "bun scripts/check-package-artifact.ts",
|
|
35
30
|
"acceptance": "bun scripts/accept-packed-consumer.ts",
|
|
36
|
-
"acceptance:asset3d": "bun scripts/accept-asset3d-packed-consumer.ts",
|
|
37
|
-
"verify:asset3d-linux": "bun scripts/verify-linux-asset3d-provider.ts",
|
|
38
31
|
"release:publish": "bun scripts/publish-package.ts",
|
|
39
32
|
"prepack": "bun build.mjs",
|
|
40
33
|
"typecheck": "tsc --noEmit",
|
|
@@ -56,6 +49,7 @@
|
|
|
56
49
|
"pnpm": "11.7.0"
|
|
57
50
|
},
|
|
58
51
|
"devDependencies": {
|
|
52
|
+
"fflate": "0.8.2",
|
|
59
53
|
"@types/bun": "^1.2.0",
|
|
60
54
|
"typescript": "^5.9.2"
|
|
61
55
|
},
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: art-3d-asset-library
|
|
3
|
-
description: Search and import reusable EA/AW assets, including native Pack sources, through the installed ForgeaX game plugin. Use when making games with existing library assets.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Asset library: Game Plugin adapter
|
|
7
|
-
|
|
8
|
-
This entry is owned by `@forgeax/game` and matches its pinned Provider. The original
|
|
9
|
-
`@vibegame/art-3d-asset-library@2.0.0` documents remain under `legacy/` for provenance;
|
|
10
|
-
their GLB-only transport and asset-add-only instructions are not this version's contract.
|
|
11
|
-
|
|
12
|
-
## Search and import
|
|
13
|
-
|
|
14
|
-
1. Check the project has Asset3D enabled and the current session exposes
|
|
15
|
-
`asset3d-search/list_asset_candidates` and `search_asset`. Missing tools are a configuration blocker, not
|
|
16
|
-
an empty library. Do not substitute generated geometry or handwritten HTTP.
|
|
17
|
-
2. Use the same installed `forgeax-game` CLI as the project's `forgeax` MCP server.
|
|
18
|
-
For a local candidate, use its installed absolute CLI path, not npm's older release.
|
|
19
|
-
`pnpm exec` can resolve a global CLI when no project dependency exists; verify
|
|
20
|
-
that executable matches the MCP launcher before starting a transaction.
|
|
21
|
-
Call `list_asset_candidates` with English queries. Choose a suitable returned
|
|
22
|
-
`assetId` using its name and format; do not invent an ID or silently take the
|
|
23
|
-
first candidate. If none fits, refine the query or report no suitable result.
|
|
24
|
-
Run `forgeax-game asset3d begin --query "<same English query>" --json`.
|
|
25
|
-
3. Call `search_asset` with `queries: [{content: "<same English query>", assetId: "<selected ID>"}]`, returned `execution`, and
|
|
26
|
-
`output_format: "asset"` to preserve native `.pack.ts` / `.pack.json` when returned.
|
|
27
|
-
`asset` is the request enum, not `pack.json`. Explicit `glb` requests retain the
|
|
28
|
-
GLB conversion route. The tool schema must advertise `asset`; otherwise report
|
|
29
|
-
a Provider version mismatch. Never supply an output directory. Explicit selection
|
|
30
|
-
uses the calling Agent's judgment and does not need a separate LLM service.
|
|
31
|
-
4. Run `forgeax-game asset3d commit --execution <execution> --json`.
|
|
32
|
-
The MCP bridge already stores the checked receipt. Inspect per-item failures,
|
|
33
|
-
`deliveredFormat` in the search result, and the actual returned Engine identities.
|
|
34
|
-
A successful GLB result is not evidence of a Pack result. If Pack is required but
|
|
35
|
-
none is returned, report that mismatch rather than renaming or converting source.
|
|
36
|
-
|
|
37
|
-
## Use the returned assets
|
|
38
|
-
|
|
39
|
-
- Pack: commit uses the exact Engine build and verified build catalog; use its
|
|
40
|
-
returned scene/mesh GUIDs. Do not run `asset add` on native Pack source or infer
|
|
41
|
-
failure solely from a source-only `asset list/inspect` result.
|
|
42
|
-
- GLB: commit uses Engine asset add and catalog readback.
|
|
43
|
-
- Keep the full declared source/helper/texture closure, material parameters and
|
|
44
|
-
stable identities. Runtime loads cooked assets by GUID. Do not execute downloaded
|
|
45
|
-
helpers directly. Executable Pack build requires a trusted source; Engine is not
|
|
46
|
-
itself a security sandbox.
|
|
47
|
-
- Integrate the selected asset into the requested game's normal scene/plugin path,
|
|
48
|
-
using the installed Engine skills. Choose gameplay, camera and composition to suit
|
|
49
|
-
the user rather than following a fixed sample game.
|
|
50
|
-
- Call `forgeax_run_current_game`, then verify visible assets and requested input in
|
|
51
|
-
its verified Preview URL. Search, import, build, and visible gameplay are separate
|
|
52
|
-
results. Preserve failures, attribution/license gaps and unverified stages.
|
|
53
|
-
|
|
54
|
-
Asset3D is opt-in. Configure EA using `forgeax-game asset3d enable --library ea
|
|
55
|
-
--ide codex` (choose the requested host). Missing credentials require user setup;
|
|
56
|
-
do not read or expose keys in prompts. Use doctor for diagnosis, not proof of search.
|
|
Binary file
|
|
Binary file
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "forgeax.asset3d-search-receipt/1.0.0",
|
|
4
|
-
"title": "ForgeaX Asset3D Search Receipt",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"additionalProperties": false,
|
|
7
|
-
"required": [
|
|
8
|
-
"schemaVersion",
|
|
9
|
-
"provider",
|
|
10
|
-
"providerCommit",
|
|
11
|
-
"originSetDigest"
|
|
12
|
-
],
|
|
13
|
-
"properties": {
|
|
14
|
-
"schemaVersion": {
|
|
15
|
-
"const": "forgeax.asset3d-search-receipt/1.0.0"
|
|
16
|
-
},
|
|
17
|
-
"provider": {
|
|
18
|
-
"const": "ea-3d"
|
|
19
|
-
},
|
|
20
|
-
"providerCommit": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"pattern": "^[0-9a-f]{40}$"
|
|
23
|
-
},
|
|
24
|
-
"originSetDigest": {
|
|
25
|
-
"type": "string",
|
|
26
|
-
"pattern": "^[0-9a-f]{64}$"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|