mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-12-05 17:39:24 +08:00
feat: 支持智能体自主编写 Tool/MCP / Guide self-authored Tools and MCP (#272)
用户要求自建可复用工具或设备协议接入时,现有指南缺少从代码到工具登记与调用的完整路径。新增双语 tool-mcp-authoring Skill,提供 AgentFS Tool 和 MCP 作者合同、依赖/权限及生命周期验证;同步内置清单和目录元数据。修正 app-developer 的正文、参考和示例,作者动作统一使用 AppAuthoring,安装生命周期保留 AppManage。 When users request reusable tools or device integrations, the existing guidance does not explain the complete code-to-registration-to-invocation path. Add bilingual Tool/MCP authoring guidance and references, and update builtin/catalog metadata. Migrate app-developer authoring instructions and examples to AppAuthoring while keeping installation lifecycle on AppManage. 验证 / Validation: market i18n and complete catalog validation pass (0 errors; existing governance warnings retained); all translation freshness checks pass. Both localized script examples pass the real Tool frontmatter Schema, execute valid input and reject invalid input. Full-tree credential-pattern and customer-neutrality checks pass. No hardware operation, model decision or full application release is claimed.
This commit is contained in:
18 files changed
+474
-51
No files matched your search
@@ -4,15 +4,15 @@
|
||||
"description": "用户要求开发、修改或发布自己的工作台应用,或把固定应用版本分发到 GitHub/Gitea 与 Registry 时使用。按所选技术栈使用的外部 Node/Docker 运行时、托管、Git 服务和数据库须有真实环境或连接及适用条款,可能另行部署或收费;缺能力时说明原因。",
|
||||
"license": "MIT",
|
||||
"compatibility": "Requires DesireCore app-authoring-v1 capability handshake. Depending on the chosen stack, Node/Docker runtimes, hosting, GitHub/Gitea and databases require actual authorized environments or connections and applicable licensing/deployment terms; separate costs may apply. Unavailable capabilities stop the affected operation.",
|
||||
"version": "1.0.1",
|
||||
"requiredClientVersion": "10.0.180",
|
||||
"version": "1.0.2",
|
||||
"requiredClientVersion": "10.0.203",
|
||||
"type": "procedural",
|
||||
"risk_level": "high",
|
||||
"status": "enabled",
|
||||
"disable-model-invocation": true,
|
||||
"provides": {
|
||||
"tools": [
|
||||
"AppManage"
|
||||
"AppAuthoring"
|
||||
]
|
||||
},
|
||||
"tags": [
|
||||
@@ -23,7 +23,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"author": "desirecore",
|
||||
"updated_at": "2026-10-28",
|
||||
"updated_at": "2026-11-09",
|
||||
"i18n": {
|
||||
"default_locale": "en-US",
|
||||
"source_locale": "zh-CN",
|
||||
@@ -36,18 +36,18 @@
|
||||
"short_desc": "开发个人工作台并发布到我的应用,按需分发固定版本",
|
||||
"description": "用户要求开发、修改或发布自己的工作台应用,或把固定应用版本分发到 GitHub/Gitea 与 Registry 时使用。按所选技术栈使用的外部 Node/Docker 运行时、托管、Git 服务和数据库须有真实环境或连接及适用条款,可能另行部署或收费;缺能力时说明原因。",
|
||||
"body": "./SKILL.zh-CN.md",
|
||||
"source_hash": "sha256:9c37c5ad344e380e",
|
||||
"source_hash": "sha256:1e03d05fc50bb017",
|
||||
"translated_by": "ai:gpt-6",
|
||||
"translated_at": "2026-10-28"
|
||||
"translated_at": "2026-11-09"
|
||||
},
|
||||
"en-US": {
|
||||
"name": "Application Development and Publishing",
|
||||
"short_desc": "Develop a personal workbench, publish it to My Apps, and distribute fixed releases on request",
|
||||
"description": "Use when the user asks to develop, modify or publish a personal workbench application, or distribute a fixed release through GitHub/Gitea and Registry. Node/Docker runtimes, hosting, Git services and databases used by the chosen stack need actual environments or connections and applicable terms; separate deployment or costs may apply. Report unavailable capabilities.",
|
||||
"body": "./SKILL.md",
|
||||
"source_hash": "sha256:9c37c5ad344e380e",
|
||||
"translated_by": "ai:claude-opus-5-5",
|
||||
"translated_at": "2026-10-28"
|
||||
"source_hash": "sha256:1e03d05fc50bb017",
|
||||
"translated_by": "ai:gpt-6",
|
||||
"translated_at": "2026-11-09"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -72,8 +72,8 @@ The Agent chooses the implementation, framework and working method. The platform
|
||||
## L1: Read Capabilities and Context
|
||||
|
||||
1. Read or create the task's single file-based Plan, preserving the actual Agent/session, device, authorized work directory and development Task. Continue within the user's existing requirements and authorization.
|
||||
2. Use the original `AppManage` action `authoring_capabilities`. Require `capabilities.protocol: app-authoring-v1` and inspect supported, authorized, available and reason independently. Its `fileRoots` are real readable roots for the current Agent, and `registryTargetIds` are registered catalog targets. These read facts grant neither upload nor filesystem write authority. `draftSource` is this conversation's draft source `{agentId,sessionId}`; copy it verbatim as the app-draft.json source. If the result carries `draftSourceUnavailable`, or an older client returns no such field, the current conversation ID is unavailable; handle it as described in L2. The minimum version is a code baseline, not proof that a shipped client supports this protocol. Authoring actions enter the original domain owners without passing platform credentials to the model.
|
||||
3. Natural-language development needs no additional handoff protocol. Installation, registration, update or uninstall continues through ApplicationManagement-v2 and the single writer. Read `app-install-manager` when available; never edit installed-entries.json directly.
|
||||
2. Use the original `AppAuthoring` action `authoring_capabilities`. Require `capabilities.protocol: app-authoring-v1` and inspect supported, authorized, available and reason independently. Its `fileRoots` are real readable roots for the current Agent, and `registryTargetIds` are registered catalog targets. These read facts grant neither upload nor filesystem write authority. `draftSource` is this conversation's draft source `{agentId,sessionId}`; copy it verbatim as the app-draft.json source. If the result carries `draftSourceUnavailable`, or an older client returns no such field, the current conversation ID is unavailable; handle it as described in L2. The minimum version is a code baseline, not proof that a shipped client supports this protocol. Authoring actions enter the original domain owners without passing platform credentials to the model.
|
||||
3. Use `AppManage` for installation switches, uninstall, recovery and data cleanup, and `AppAuthoring` for authoring. A retired AppManage action's migration error is not an executed operation. Natural-language development needs no additional handoff protocol. Installation, registration, update or uninstall continues through ApplicationManagement-v2 and the single writer. Read `app-install-manager` when available; never edit installed-entries.json directly.
|
||||
4. Read [authoring interfaces](references/authoring-api.zh-CN.md) and [distribution](references/distribution.zh-CN.md) on demand. The candidate main-repository authority is `docs/功能/市场系统/API/应用开发发布接口.md`; an external PR does not establish a shipped client or official seed. `examples/static-workbench/` and `examples/service-workbench/` are editable teaching materials, not evidence of autonomous Agent development or production acceptance.
|
||||
|
||||
## L2: Development, Preview and Personal Publication
|
||||
@@ -81,12 +81,12 @@ The Agent chooses the implementation, framework and working method. The platform
|
||||
- Establish the user's actual work, data ownership and collaboration needs. Choose suitable languages and frameworks; examples do not prescribe a stack. Reuse the actual Task, Plan and originating context.
|
||||
- Separate program material, business data and secrets. The portable `application.json` contains no sourceId, installation identity, host path, builtin route or credential. Its product identity, version and entrypoints are the single source for release and catalog views.
|
||||
- Create fixed `app-release.json` from an explicit file whitelist, actual byte hashes, entrypoint mappings, data contract and truthful platform evidence. Exclude the manifest itself from files. `scripts/create-release.mjs` builds the example manifest; the service independently verifies actual bytes.
|
||||
- Deliver `app-draft.json` with real fileRef, Plan, stable draftId and target installationId. Its source is the `draftSource` returned by `authoring_capabilities`, copied verbatim; never use a runId or make up a value. Without `draftSource` (an older client, or a result with `draftSourceUnavailable`), ask the user for the current conversation ID, or ask the user to continue in this Agent's default conversation, whose sessionId equals the agentId. Never infer it from a runId, topic title or another conversation. Its workdir points to the actual release material directory; do not guess a release/ subdirectory or fabricate a fileRef. Read the actual authorized file using `AppManage.read_draft` with `file_ref`, preserving the returned draft. When read_draft, preview_prepare or development_enroll rejects the source conversation, the error body carries this conversation's `draftSource`; correct the draft's source with it and retry. Return a clickable absolute path so the user can read and continue it in the application development workspace.
|
||||
- Call `AppManage.preview_prepare` with the original draft/mode/expectedRevision in `owner_request`, including release for snapshot. Use preview_read to read and preview_end to end it. Snapshot preview and formal installation use separate identities and data. Freeze a snapshot before publishing a live preview. Replacement uses the actual revision. Ending preview revokes its bridge and disposes only its owned temporary runtime while preserving data and development material. Closing a page does not stop a formal application or accepted Task. Never convert a temporary URL/token into a formal entrypoint.
|
||||
- Enroll a real authorized source development server using `AppManage.development_enroll` with the original prepareRef/draft/terminalId/endpoint in `owner_request` for live preview. Its development-only contract cannot become formal startup; mutable source and fixed releases remain separate. The original command must respect owner-injected PORT and APP_DATA_DIR, using shell `${VAR:-default}` only for initial defaults rather than overriding preview ports or formal data roots.
|
||||
- Use `AppManage.prepare_release` with the complete `release_request` to freeze real material. Construct materialRoot as a FileResourceRef from the returned readable roots. Inspect the candidate, then call commit_release with the complete original AppReleaseCommitRequest in `release_request`, retaining prepareRef, installationId, expectedRevision and submissionId. Do not reduce its installation material to a name or digest. Continue authorized publication without repeated per-command questions; new targets or additional data/external effects follow existing governance.
|
||||
- Saving a release and making it runnable are separate facts. Static files use fixed mappings; services use `AppManage.runtime_enroll` to bind original-owner spawn, generation and handshake. Use runtime_read/start/stop for formal operation; startupPolicy is not permanent execution authority. Docker releases declare complete registry/repository@sha256 imageRefs, then use `AppManage.docker_prepare` to receive owned CID/env paths and the actual command. Execute it through original TaskHost approval, then use docker_enroll with the original enrollmentRef/terminalId and verify daemon/CID/RepoDigest/mount/port facts. Normal create/start/stop repeats current approval; internal transient preview disposal compensates only its originally approved owned CID; candidate, formal and preview roots/nonces differ. Reconcile unknown outcomes against the original CID before another effect. Missing adapters or supported environments keep the original Agent-managed lifecycle with an honest reason. A CLI exit, format check, port, PID or historical observation does not prove availability.
|
||||
- For timeout, lost response or disconnection, preserve the original mutation/submission/clientRequest ID and body. Query publication using `AppManage.lookup_release_submission` with the original installation_id/submission_id, and read actual runtime/preview state separately. Do not blindly replay unknown writes with a new ID. Check current material and data compatibility before an update. Investigate interrupted migrations; code rollback is not data recovery.
|
||||
- Deliver `app-draft.json` with real fileRef, Plan, stable draftId and target installationId. Its source is the `draftSource` returned by `authoring_capabilities`, copied verbatim; never use a runId or make up a value. Without `draftSource` (an older client, or a result with `draftSourceUnavailable`), ask the user for the current conversation ID, or ask the user to continue in this Agent's default conversation, whose sessionId equals the agentId. Never infer it from a runId, topic title or another conversation. Its workdir points to the actual release material directory; do not guess a release/ subdirectory or fabricate a fileRef. Read the actual authorized file using `AppAuthoring.read_draft` with `file_ref`, preserving the returned draft. When read_draft, preview_prepare or development_enroll rejects the source conversation, the error body carries this conversation's `draftSource`; correct the draft's source with it and retry. Return a clickable absolute path so the user can read and continue it in the application development workspace.
|
||||
- Call `AppAuthoring.preview_prepare` with the original draft/mode/expectedRevision in `owner_request`, including release for snapshot. Use preview_read to read and preview_end to end it. Snapshot preview and formal installation use separate identities and data. Freeze a snapshot before publishing a live preview. Replacement uses the actual revision. Ending preview revokes its bridge and disposes only its owned temporary runtime while preserving data and development material. Closing a page does not stop a formal application or accepted Task. Never convert a temporary URL/token into a formal entrypoint.
|
||||
- Enroll a real authorized source development server using `AppAuthoring.development_enroll` with the original prepareRef/draft/terminalId/endpoint in `owner_request` for live preview. Its development-only contract cannot become formal startup; mutable source and fixed releases remain separate. The original command must respect owner-injected PORT and APP_DATA_DIR, using shell `${VAR:-default}` only for initial defaults rather than overriding preview ports or formal data roots.
|
||||
- Use `AppAuthoring.prepare_release` with the complete `release_request` to freeze real material. Construct materialRoot as a FileResourceRef from the returned readable roots. Inspect the candidate, then call commit_release with the complete original AppReleaseCommitRequest in `release_request`, retaining prepareRef, installationId, expectedRevision and submissionId. Do not reduce its installation material to a name or digest. Continue authorized publication without repeated per-command questions; new targets or additional data/external effects follow existing governance.
|
||||
- Saving a release and making it runnable are separate facts. Static files use fixed mappings; services use `AppAuthoring.runtime_enroll` to bind original-owner spawn, generation and handshake. Use runtime_read/start/stop for formal operation; startupPolicy is not permanent execution authority. Docker releases declare complete registry/repository@sha256 imageRefs, then use `AppAuthoring.docker_prepare` to receive owned CID/env paths and the actual command. Execute it through original TaskHost approval, then use docker_enroll with the original enrollmentRef/terminalId and verify daemon/CID/RepoDigest/mount/port facts. Normal create/start/stop repeats current approval; internal transient preview disposal compensates only its originally approved owned CID; candidate, formal and preview roots/nonces differ. Reconcile unknown outcomes against the original CID before another effect. Missing adapters or supported environments keep the original Agent-managed lifecycle with an honest reason. A CLI exit, format check, port, PID or historical observation does not prove availability.
|
||||
- For timeout, lost response or disconnection, preserve the original mutation/submission/clientRequest ID and body. Query publication using `AppAuthoring.lookup_release_submission` with the original installation_id/submission_id, and read actual runtime/preview state separately. Do not blindly replay unknown writes with a new ID. Check current material and data compatibility before an update. Investigate interrupted migrations; code rollback is not data recovery.
|
||||
|
||||
## L3: Webpage and Agent Collaboration
|
||||
|
||||
@@ -101,8 +101,8 @@ The webpage uses the finite `window.desirecoreApp.call(method,payload)` and `onE
|
||||
|
||||
## L4: Distribution and Evidence
|
||||
|
||||
Personal publication is private and local by default. When the user requests distribution, call `AppManage.export_release` with the fixed complete whitelist in `owner_request`, and review the exact files and actual target. Exclude databases, .env, credentials, chats, Task/Plan, logs, machine paths and installation identity. Environment templates can describe names without real secret values.
|
||||
Personal publication is private and local by default. When the user requests distribution, call `AppAuthoring.export_release` with the fixed complete whitelist in `owner_request`, and review the exact files and actual target. Exclude databases, .env, credentials, chats, Task/Plan, logs, machine paths and installation identity. Environment templates can describe names without real secret values.
|
||||
|
||||
To deliver ZIP bytes to an upload tool, also pass top-level `export_file_ref`, a destination FileResourceRef under the original tool's actual write authority, with exactly one of `expected_absent:true` or the original `expected_etag`. The returned `archiveFile` contains the actual fileRef/sha256/size/etag/replayed. Verify sha256 equals archiveDigest before handing the file to an already authorized GitHub/Gitea upload tool and inspecting immutable source/artifact results. For a lost response, preserve the same destination, condition and complete body; never overwrite an unknown file. Readable fileRoots do not grant write authority. Then call `AppManage.distribution_prepare` with `owner_request` containing the same exportRef, a registryTargetIds target, the actual immutable source and metadata to generate Registry manifest.json, catalog-metadata.v1.json and install.md. The draft is still neither uploaded nor submitted; report missing targets and upload channels separately. Ordinary HttpRequest does not automatically inject platform credentials; never extract instance tokens or change Origin to bypass 401. The target Provider injects catalog identity; the personal installation remains unchanged. Verify archiveDigest, releaseDigest and source-materialized descriptorDigest independently. A different payload under the same version requires a new revision, not overwriting fixed material.
|
||||
To deliver ZIP bytes to an upload tool, also pass top-level `export_file_ref`, a destination FileResourceRef under the original tool's actual write authority, with exactly one of `expected_absent:true` or the original `expected_etag`. The returned `archiveFile` contains the actual fileRef/sha256/size/etag/replayed. Verify sha256 equals archiveDigest before handing the file to an already authorized GitHub/Gitea upload tool and inspecting immutable source/artifact results. For a lost response, preserve the same destination, condition and complete body; never overwrite an unknown file. Readable fileRoots do not grant write authority. Then call `AppAuthoring.distribution_prepare` with `owner_request` containing the same exportRef, a registryTargetIds target, the actual immutable source and metadata to generate Registry manifest.json, catalog-metadata.v1.json and install.md. The draft is still neither uploaded nor submitted; report missing targets and upload channels separately. Ordinary HttpRequest does not automatically inject platform credentials; never extract instance tokens or change Origin to bypass 401. The target Provider injects catalog identity; the personal installation remains unchanged. Verify archiveDigest, releaseDigest and source-materialized descriptorDigest independently. A different payload under the same version requires a new revision, not overwriting fixed material.
|
||||
|
||||
Report code/functional verification, preview, personal saving, runtime availability, upload, catalog PR/admission and second-user installation independently. A candidate 4.3 Schema, external PR or generated ZIP does not establish official-market availability, client capability release or another device's runtime acceptance. External hosting, databases and Git services require actual connections and applicable licensing/deployment terms and can carry separate costs; when unavailable, stop the affected external operation.
|
||||
@@ -7,8 +7,8 @@ Agent 选择技术栈、构建方法与工作方式;平台核验材料、作
|
||||
## L1:先读能力与当前上下文
|
||||
|
||||
1. 读取或创建本任务唯一文件化 Plan,保存实际来源 Agent/会话、目标设备、工作目录及开发 Task。已有用户需求和授权直接沿用。
|
||||
2. 使用原 `AppManage` 的 `authoring_capabilities` 动作。返回的 `capabilities` 必须为 `protocol: app-authoring-v1`,分别看 features 的 supported、authorized、available 和 reason;`fileRoots` 是当前 Agent 可读的真实文件根,`registryTargetIds` 是已登记的目录目标;这些只读事实不授予目录上传或文件写权限。`draftSource` 是本次会话的草稿来源 `{agentId,sessionId}`,原样写入 app-draft.json 的 source;返回 `draftSourceUnavailable`,或旧客户端没有这个字段时,当前会话 ID 拿不到,按 L2 处理。10.0.180 只是代码基线,已发行的同版本客户端不因此支持新协议。作者动作直接进入原领域 owner,不把平台凭据交给模型。
|
||||
3. 普通自然语言开发不要求新的交接协议。若要登记、安装、更新或卸载,读取 `app-install-manager`;继续沿 ApplicationManagement-v2 解析和唯一 writer,不直接编辑 installed-entries.json。
|
||||
2. 使用原 `AppAuthoring` 的 `authoring_capabilities` 动作。返回的 `capabilities` 必须为 `protocol: app-authoring-v1`,分别看 features 的 supported、authorized、available 和 reason;`fileRoots` 是当前 Agent 可读的真实文件根,`registryTargetIds` 是已登记的目录目标;这些只读事实不授予目录上传或文件写权限。`draftSource` 是本次会话的草稿来源 `{agentId,sessionId}`,原样写入 app-draft.json 的 source;返回 `draftSourceUnavailable`,或旧客户端没有这个字段时,当前会话 ID 拿不到,按 L2 处理。10.0.203 只是代码基线,已发行的同版本客户端不因此支持新协议。作者动作直接进入原领域 owner,不把平台凭据交给模型。
|
||||
3. 安装开关、卸载、恢复与清理数据使用 `AppManage`,作者动作使用 `AppAuthoring`;旧 AppManage 作者动作的迁移提示不代表操作已执行。普通自然语言开发不要求新的交接协议。若要登记、安装、更新或卸载,读取 `app-install-manager`;继续沿 ApplicationManagement-v2 解析和唯一 writer,不直接编辑 installed-entries.json。
|
||||
4. 按需读 [作者接口](references/authoring-api.zh-CN.md) 和 [分发指南](references/distribution.zh-CN.md)。候选主仓正文为 `docs/功能/市场系统/API/应用开发发布接口.md`,按实际能力读取;外仓 PR 不表示客户端或官方 seed 已发行。两份示例位于 `examples/static-workbench/` 与 `examples/service-workbench/`,只是可修改的教学材料,不能代替真实 Agent 开发和业务验收。
|
||||
|
||||
## L2:开发、预览和个人发布
|
||||
@@ -16,12 +16,12 @@ Agent 选择技术栈、构建方法与工作方式;平台核验材料、作
|
||||
- 先确认要解决的工作、数据位置与必要协作。可以使用任何适合的语言/框架,示例不固定技术栈。小任务直接完成;复杂工作保留原 Task、Plan 和用户来源,不另造开发状态机。
|
||||
- 程序材料、业务数据与秘密分开。作者定义 `application.json` 不包含 sourceId、安装实例、宿主路径、builtin 路由或权限凭据。release 的产品 ID/名称/版本/入口只有这份定义。
|
||||
- 固定 `app-release.json`:按显式文件白名单、原始字节摘要、入口映射、数据合同和真实平台证据生成;清单自身不进入 files。可用 `scripts/create-release.mjs` 为示例生成清单,平台仍重新核验实际字节。
|
||||
- 向平台交付 `app-draft.json`,记录真实 fileRef、Plan、稳定 draftId 与目标 installationId。source 原样使用 `authoring_capabilities` 返回的 `draftSource`,不填 runId,也不自己编一个值。没有 `draftSource` 时(旧客户端,或返回 `draftSourceUnavailable`),请用户提供当前会话 ID,或请用户改在该 Agent 的默认会话里继续(默认会话的 sessionId 等于 agentId),不要从 runId、话题标题或别的会话推断。workdir 指向实际完成的 release 材料目录,不猜测 release/ 子目录,也不编造 fileRef。用 `AppManage.read_draft` 的 `file_ref` 读取授权根内实际文件,保留返回的 draft。read_draft、preview_prepare、development_enroll 因来源会话被拒时,错误正文会带回本次会话的 `draftSource`,按它改正草稿的 source 再重试。返回此文件的可点击绝对路径,说明可在应用开发工作区读取并继续。
|
||||
- 预览沿 `AppManage.preview_prepare` 的 `owner_request` 传原 draft/mode/expectedRevision,snapshot 另给 release;读取用 preview_read,结束用 preview_end。snapshot 预览与正式安装隔离,数据不自动转移。live 预览必须先固定 snapshot 才可发布;刷新/替换用实际 revision。结束预览撤销当前桥并回收本次 owned 临时运行资源,保留数据与开发材料;普通关页不停止正式应用或已接纳的后台 Task,不将预览临时 URL/token 保存为正式入口。
|
||||
- 原开发服务器/HMR 使用真实授权的 draft 工作目录,由 `AppManage.development_enroll` 的 `owner_request` 传原 prepareRef/draft/terminalId/endpoint 接入。它只用于 live 预览,不能成为正式 startup;可变源码与固定 release 分开。原命令须尊重 owner 注入的 PORT 和 APP_DATA_DIR,初次开发默认值用 shell 的 `${VAR:-default}`,不能写死赋值盖掉预览端口或正式数据根。
|
||||
- 个人发布由 `AppManage.prepare_release` 的 `release_request` 固定真实材料:materialRoot 使用能力返回的授权根构造 FileResourceRef。检查候选后,`commit_release` 的 `release_request` 使用完整原 AppReleaseCommitRequest,保留精确 prepareRef、installationId、expectedRevision 与原 submissionId;不能把安装 material 对象简化为产品名称或摘要。旧会话里明确授权的发布可继续,不逐命令重复确认。新目标或超出授权的数据/外部副作用沿现有治理处理。
|
||||
- 发布保存与运行可用分开。静态包通过固定映射承载;带服务应用用 `AppManage.runtime_enroll` 固定原执行 owner 的真实 spawn、代际身份和握手;正式运行用 runtime_read/start/stop,不能把 startupPolicy 当长期执行授权。Docker release 声明完整 imageRefs(注册表/repository@sha256),先用 `AppManage.docker_prepare` 获得私有短期 CID/env 文件及实际命令,沿原审批执行后以 docker_enroll 的原 enrollmentRef/terminalId 核验真实 daemon/CID/RepoDigest/挂载/端口。普通用户启动/停止沿当前审批,私有临时预览回收只补偿原批准的 owned CID;候选、正式和预览的数据根与 nonce 分开。unknown 先检查原 CID,不重复创建;缺 adapter 或支持的环境时保留原 Agent 管理并明确原因。端口响应、Docker CLI 退出、PID、历史 observation 或格式检查不能替代运行绑定;失败如实说明“版本已保存,启动待修复”。
|
||||
- 写入超时、响应丢失或断线,保留原 mutation/submission/clientRequest ID 与正文;发布用 `AppManage.lookup_release_submission` 的原 installation_id/submission_id 查询,运行和预览分别重读实际状态。unknown 时不创建新 ID 盲重放。修改候选前重读当前版本与数据兼容,迁移中断先观察;代码回退不代表业务数据恢复。
|
||||
- 向平台交付 `app-draft.json`,记录真实 fileRef、Plan、稳定 draftId 与目标 installationId。source 原样使用 `authoring_capabilities` 返回的 `draftSource`,不填 runId,也不自己编一个值。没有 `draftSource` 时(旧客户端,或返回 `draftSourceUnavailable`),请用户提供当前会话 ID,或请用户改在该 Agent 的默认会话里继续(默认会话的 sessionId 等于 agentId),不要从 runId、话题标题或别的会话推断。workdir 指向实际完成的 release 材料目录,不猜测 release/ 子目录,也不编造 fileRef。用 `AppAuthoring.read_draft` 的 `file_ref` 读取授权根内实际文件,保留返回的 draft。read_draft、preview_prepare、development_enroll 因来源会话被拒时,错误正文会带回本次会话的 `draftSource`,按它改正草稿的 source 再重试。返回此文件的可点击绝对路径,说明可在应用开发工作区读取并继续。
|
||||
- 预览沿 `AppAuthoring.preview_prepare` 的 `owner_request` 传原 draft/mode/expectedRevision,snapshot 另给 release;读取用 preview_read,结束用 preview_end。snapshot 预览与正式安装隔离,数据不自动转移。live 预览必须先固定 snapshot 才可发布;刷新/替换用实际 revision。结束预览撤销当前桥并回收本次 owned 临时运行资源,保留数据与开发材料;普通关页不停止正式应用或已接纳的后台 Task,不将预览临时 URL/token 保存为正式入口。
|
||||
- 原开发服务器/HMR 使用真实授权的 draft 工作目录,由 `AppAuthoring.development_enroll` 的 `owner_request` 传原 prepareRef/draft/terminalId/endpoint 接入。它只用于 live 预览,不能成为正式 startup;可变源码与固定 release 分开。原命令须尊重 owner 注入的 PORT 和 APP_DATA_DIR,初次开发默认值用 shell 的 `${VAR:-default}`,不能写死赋值盖掉预览端口或正式数据根。
|
||||
- 个人发布由 `AppAuthoring.prepare_release` 的 `release_request` 固定真实材料:materialRoot 使用能力返回的授权根构造 FileResourceRef。检查候选后,`commit_release` 的 `release_request` 使用完整原 AppReleaseCommitRequest,保留精确 prepareRef、installationId、expectedRevision 与原 submissionId;不能把安装 material 对象简化为产品名称或摘要。旧会话里明确授权的发布可继续,不逐命令重复确认。新目标或超出授权的数据/外部副作用沿现有治理处理。
|
||||
- 发布保存与运行可用分开。静态包通过固定映射承载;带服务应用用 `AppAuthoring.runtime_enroll` 固定原执行 owner 的真实 spawn、代际身份和握手;正式运行用 runtime_read/start/stop,不能把 startupPolicy 当长期执行授权。Docker release 声明完整 imageRefs(注册表/repository@sha256),先用 `AppAuthoring.docker_prepare` 获得私有短期 CID/env 文件及实际命令,沿原审批执行后以 docker_enroll 的原 enrollmentRef/terminalId 核验真实 daemon/CID/RepoDigest/挂载/端口。普通用户启动/停止沿当前审批,私有临时预览回收只补偿原批准的 owned CID;候选、正式和预览的数据根与 nonce 分开。unknown 先检查原 CID,不重复创建;缺 adapter 或支持的环境时保留原 Agent 管理并明确原因。端口响应、Docker CLI 退出、PID、历史 observation 或格式检查不能替代运行绑定;失败如实说明“版本已保存,启动待修复”。
|
||||
- 写入超时、响应丢失或断线,保留原 mutation/submission/clientRequest ID 与正文;发布用 `AppAuthoring.lookup_release_submission` 的原 installation_id/submission_id 查询,运行和预览分别重读实际状态。unknown 时不创建新 ID 盲重放。修改候选前重读当前版本与数据兼容,迁移中断先观察;代码回退不代表业务数据恢复。
|
||||
|
||||
## L3:网页与 Agent 协作
|
||||
|
||||
@@ -36,8 +36,8 @@ Agent 选择技术栈、构建方法与工作方式;平台核验材料、作
|
||||
|
||||
## L4:分发与交付证据
|
||||
|
||||
个人发布默认私有本机,不隐含上传。用户要求分发后,用 `AppManage.export_release` 的 `owner_request` 导出固定版本的完整白名单,审阅确切文件与目标。业务库、.env、凭据、聊天/Task/Plan、日志、机器路径和安装身份不得进入包;环境模板可以包含名称和说明,不能包含真实值。
|
||||
个人发布默认私有本机,不隐含上传。用户要求分发后,用 `AppAuthoring.export_release` 的 `owner_request` 导出固定版本的完整白名单,审阅确切文件与目标。业务库、.env、凭据、聊天/Task/Plan、日志、机器路径和安装身份不得进入包;环境模板可以包含名称和说明,不能包含真实值。
|
||||
|
||||
需要交给上传工具的 ZIP 时,export_release 另在顶层提供 `export_file_ref`(原工具真实写权限目录中的目标 FileResourceRef),并二选一给 `expected_absent:true` 或原 `expected_etag`。返回的 `archiveFile` 包含实际 fileRef/sha256/size/etag/replayed;核验 sha256 等于 archiveDigest,再交已授权的 GitHub/Gitea 上传工具并核读不可变提交/制品 SHA。响应丢失保留同一目标、条件与完整正文查询/重试,不覆盖未知文件;只有只读 fileRoots 不代表有写权限。随后用 `AppManage.distribution_prepare` 的 `owner_request`,以同一 exportRef、能力返回的 registryTargetIds 中的目标、实际固定来源和 metadata 生成 Registry `manifest.json`、`catalog-metadata.v1.json`、`install.md`。草稿仍未上传、未提交目录;缺少真实目标或上传通道时分别说明不可用。普通 HttpRequest 不自动注入平台凭据,不能读取实例 token 或变更 Origin 绕过 401。目录身份由目标 Provider 注入,个人安装仍是原实例。archiveDigest、releaseDigest、物化 descriptorDigest 分别核验;同版本异内容创建新修订,不覆盖旧固定材料。
|
||||
需要交给上传工具的 ZIP 时,export_release 另在顶层提供 `export_file_ref`(原工具真实写权限目录中的目标 FileResourceRef),并二选一给 `expected_absent:true` 或原 `expected_etag`。返回的 `archiveFile` 包含实际 fileRef/sha256/size/etag/replayed;核验 sha256 等于 archiveDigest,再交已授权的 GitHub/Gitea 上传工具并核读不可变提交/制品 SHA。响应丢失保留同一目标、条件与完整正文查询/重试,不覆盖未知文件;只有只读 fileRoots 不代表有写权限。随后用 `AppAuthoring.distribution_prepare` 的 `owner_request`,以同一 exportRef、能力返回的 registryTargetIds 中的目标、实际固定来源和 metadata 生成 Registry `manifest.json`、`catalog-metadata.v1.json`、`install.md`。草稿仍未上传、未提交目录;缺少真实目标或上传通道时分别说明不可用。普通 HttpRequest 不自动注入平台凭据,不能读取实例 token 或变更 Origin 绕过 401。目录身份由目标 Provider 注入,个人安装仍是原实例。archiveDigest、releaseDigest、物化 descriptorDigest 分别核验;同版本异内容创建新修订,不覆盖旧固定材料。
|
||||
|
||||
按真实情况分别报告:代码/业务验证、预览、个人发布、启动、来源上传、目录 PR/准入、第二用户安装。候选 4.3 Schema、外仓 PR 或 ZIP 生成都不代表官方市场已开放,也不能代替客户端能力发行或另一设备运行。外部托管/数据库/Git服务的登录、许可、部署及费用由其真实连接和条款决定,缺少时停止相应外部调用。
|
||||
@@ -29,13 +29,13 @@
|
||||
},
|
||||
"release": {
|
||||
"state": "known",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"versionScheme": "semver"
|
||||
},
|
||||
"timestamps": {
|
||||
"catalogUpdatedAt": {
|
||||
"state": "known",
|
||||
"value": "2026-10-28",
|
||||
"value": "2026-11-09",
|
||||
"precision": "day"
|
||||
},
|
||||
"releasePublishedAt": {
|
||||
@@ -67,7 +67,7 @@
|
||||
"platforms": {
|
||||
"state": "unknown"
|
||||
},
|
||||
"requiredClientVersion": "10.0.180"
|
||||
"requiredClientVersion": "10.0.203"
|
||||
},
|
||||
"spec": {
|
||||
"kind": "skill",
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
在获授权的材料目录生成 release 并 prepare 后,使用原执行工具实际启动 `PORT="${PORT:-32000}" node runtime/server.mjs`,初次默认值须替换为实际空闲端口。保留该默认表达式,不能用写死的 PORT 赋值覆盖 Harness 后续注入的预览端口。端口需固定在原接受的执行合同,不能靠网页声明任意 endpoint。身份由原 TaskHost 在受控正式 spawn 时注入:DESIRECORE_APP_RUNTIME_PROOF、DESIRECORE_APP_RELEASE_DIGEST、DESIRECORE_APP_SCOPE_ID、DESIRECORE_APP_RUNTIME_GENERATION。应用不能自报固定 PID 或伪造 proof,不能将 proof 用于其他 API 或日志。
|
||||
|
||||
通过原 `AppManage.runtime_enroll` 的 `owner_request` 给真实 prepareRef、installationId、terminalId、endpoint.port 与 identityPath `/.desirecore-app-identity`,以及用户选择的 manual/on-open。普通 HttpRequest 不自动注入平台凭据,不能读取实例 token 或改 Origin 绕过认证。纳管读取原accepted-command冻结执行合同;由原执行工具明确停掉此前命令,commit后由原owner启动正式新代际,再核读运行身份和应用功能。原先裸启动的服务在没有managed身份时会明确返回503,它只能帮助开发调试,不能证明正式可信直开。
|
||||
通过原 `AppAuthoring.runtime_enroll` 的 `owner_request` 给真实 prepareRef、installationId、terminalId、endpoint.port 与 identityPath `/.desirecore-app-identity`,以及用户选择的 manual/on-open。普通 HttpRequest 不自动注入平台凭据,不能读取实例 token 或改 Origin 绕过认证。纳管读取原accepted-command冻结执行合同;由原执行工具明确停掉此前命令,commit后由原owner启动正式新代际,再核读运行身份和应用功能。原先裸启动的服务在没有managed身份时会明确返回503,它只能帮助开发调试,不能证明正式可信直开。
|
||||
|
||||
公开执行环境不接受任意.env。若改造应用需要后端直接读写数据,须使用实际数据owner授予并注入的独立根;缺授权时不写盘,不默认使用cwd或release目录。此教学服务没有后端数据写入,因此不需要APP_DATA_DIR,不持有平台凭据。
|
||||
|
||||
停止、更新、失败恢复沿原TaskHost/Run,不重复开第二个后台进程。scope/release/generation改变后旧连接失效;重启须重新取得owner身份与审批事实。端口被占用不接管,不把HTTP200作为运行归属证明。
|
||||
|
||||
开发时若需要直接看授权源码的修改,可用当前真实 draft、原 source 目录启动的 terminalId 和已固定 prepareRef 通过 `AppManage.development_enroll` 的 `owner_request` 登记原 prepareRef/draft/terminalId/endpoint。它只承接 live 预览,正式发布须另固定 snapshot 并登记正式运行合同;普通读取静态源码的变化不等于框架 dev-server/HMR 协议已经验收。
|
||||
开发时若需要直接看授权源码的修改,可用当前真实 draft、原 source 目录启动的 terminalId 和已固定 prepareRef 通过 `AppAuthoring.development_enroll` 的 `owner_request` 登记原 prepareRef/draft/terminalId/endpoint。它只承接 live 预览,正式发布须另固定 snapshot 并登记正式运行合同;普通读取静态源码的变化不等于框架 dev-server/HMR 协议已经验收。
|
||||
|
||||
要将此服务改为 Docker release,须由作者实际选择并验证固定 Node 镜像 RepoDigest、声明全部 imageRefs,容器服务监听 `0.0.0.0` 而宿主只发布 `127.0.0.1`,并沿 AppManage.docker_prepare/docker_enroll 的实际 argv、nonce、CID 和 data mount 核验。当前文件是 native Node 教学样例,不能只改 delivery 类型就声称容器运行通过;镜像及 Docker 许可、安装与运维属于其实际外部 owner。
|
||||
要将此服务改为 Docker release,须由作者实际选择并验证固定 Node 镜像 RepoDigest、声明全部 imageRefs,容器服务监听 `0.0.0.0` 而宿主只发布 `127.0.0.1`,并沿 AppAuthoring.docker_prepare/docker_enroll 的实际 argv、nonce、CID 和 data mount 核验。当前文件是 native Node 教学样例,不能只改 delivery 类型就声称容器运行通过;镜像及 Docker 许可、安装与运维属于其实际外部 owner。
|
||||
@@ -1,6 +1,6 @@
|
||||
# 服务笔记工作台教学示例
|
||||
|
||||
这是可修改的固定网页+原生Node只读服务,不是正式市场条目。先读本Skill作者接口和runtime/运行说明.md,在真实目标环境按目标组合原 AppManage.prepare_release/runtime_enroll/commit_release 动作,纳管原执行合同、正式发布并核验。缺TaskHost owner或真实身份时保持不可用,不能重标为静态网页来绕过。
|
||||
这是可修改的固定网页+原生Node只读服务,不是正式市场条目。先读本Skill作者接口和runtime/运行说明.md,在真实目标环境按目标组合原 AppAuthoring.prepare_release/runtime_enroll/commit_release 动作,纳管原执行合同、正式发布并核验。缺TaskHost owner或真实身份时保持不可用,不能重标为静态网页来绕过。
|
||||
|
||||
笔记仍通过应用桥的notes key持久化,用户、实例和预览各有独立scope;Node端不写个人数据或固定程序目录。网页可在本源 `/api/summary?count=<当前笔记条数>` 请求只读统计;这个能力不使用平台token,也不接收任意文件路径或SQL。
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
用户可显式选择“在这台设备记住所选位置”。示例 viewStateContract 只允许 selection 键并限制 1024 字节,不保存笔记正文;需实际 saveViewState grant,设备保存保持原 mutationId、expectedRevision 和正文。能力缺失时保持业务数据与视图偏好分别报告,预览不借正式设备状态。
|
||||
|
||||
用户要求分发时,用原 AppManage.export_release 的 owner_request 显式导出全部 payload 与 app-release.json;另给原工具真实写权限内的 export_file_ref,首次 expected_absent:true,已有目标用原 expected_etag。返回 archiveFile 的实际 fileRef/sha256/size/etag,核验 sha256/size 与 export 的 archiveDigest/size 一致后交原授权上传工具。取得真实固定来源再用 distribution_prepare 的 owner_request,registryRepoId 从 authoring_capabilities.registryTargetIds 选本次实际目标,生成三文件草稿;它不上传、不提交目录,也不改变个人安装身份。普通 HTTP 不自动注入平台凭据,不能读取实例 token 或绕过认证。
|
||||
用户要求分发时,用原 AppAuthoring.export_release 的 owner_request 显式导出全部 payload 与 app-release.json;另给原工具真实写权限内的 export_file_ref,首次 expected_absent:true,已有目标用原 expected_etag。返回 archiveFile 的实际 fileRef/sha256/size/etag,核验 sha256/size 与 export 的 archiveDigest/size 一致后交原授权上传工具。取得真实固定来源再用 distribution_prepare 的 owner_request,registryRepoId 从 authoring_capabilities.registryTargetIds 选本次实际目标,生成三文件草稿;它不上传、不提交目录,也不改变个人安装身份。普通 HTTP 不自动注入平台凭据,不能读取实例 token 或绕过认证。
|
||||
@@ -1,6 +1,6 @@
|
||||
# 个人笔记工作台教学示例
|
||||
|
||||
这是可修改的最小材料,不是正式市场条目或已经完成的真实 Agent 验收。将示例复制到任务实际授权工作目录,用本 Skill 的 create-release.mjs 生成 app-release.json,再按目标组合原 AppManage.prepare_release/preview_prepare/commit_release 动作,准备固定材料、snapshot 预览与个人发布。
|
||||
这是可修改的最小材料,不是正式市场条目或已经完成的真实 Agent 验收。将示例复制到任务实际授权工作目录,用本 Skill 的 create-release.mjs 生成 app-release.json,再按目标组合原 AppAuthoring.prepare_release/preview_prepare/commit_release 动作,准备固定材料、snapshot 预览与个人发布。
|
||||
|
||||
笔记保存在声明的 notes key,由平台按用户/实例/预览分配专用数据根。预览数据不自动成为正式数据;包中没有 notes.json。裸浏览器打开可看到页面,缺少可信桥时不会假装已持久保存。Web 须有独立 app origin 和真实 parent MessagePort;同源或无来源时桥拒绝。
|
||||
|
||||
@@ -14,4 +14,4 @@
|
||||
|
||||
用户可显式选择“在这台设备记住所选位置”。示例 viewStateContract 只允许 selection 键并限制 1024 字节,不保存笔记正文;需实际 saveViewState grant,设备保存保持原 mutationId、expectedRevision 和正文。能力缺失时保持业务数据与视图偏好分别报告,预览不借正式设备状态。
|
||||
|
||||
用户要求分发时,用原 AppManage.export_release 的 owner_request 显式导出全部 payload 与 app-release.json;另给原工具真实写权限内的 export_file_ref,首次 expected_absent:true,已有目标用原 expected_etag。返回 archiveFile 的实际 fileRef/sha256/size/etag,核验 sha256/size 与 export 的 archiveDigest/size 一致后交原授权上传工具。取得真实固定来源再用 distribution_prepare 的 owner_request,registryRepoId 从 authoring_capabilities.registryTargetIds 选本次实际目标,生成三文件草稿;它不上传、不提交目录,也不改变个人安装身份。普通 HTTP 不自动注入平台凭据,不能读取实例 token 或绕过认证。
|
||||
用户要求分发时,用原 AppAuthoring.export_release 的 owner_request 显式导出全部 payload 与 app-release.json;另给原工具真实写权限内的 export_file_ref,首次 expected_absent:true,已有目标用原 expected_etag。返回 archiveFile 的实际 fileRef/sha256/size/etag,核验 sha256/size 与 export 的 archiveDigest/size 一致后交原授权上传工具。取得真实固定来源再用 distribution_prepare 的 owner_request,registryRepoId 从 authoring_capabilities.registryTargetIds 选本次实际目标,生成三文件草稿;它不上传、不提交目录,也不改变个人安装身份。普通 HTTP 不自动注入平台凭据,不能读取实例 token 或绕过认证。
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
本文是未发行候选协议的知识材料。中文权威接口正文位于主仓 `docs/功能/市场系统/API/应用开发发布接口.md`;该路径与外仓 PR 不声明在线文档、客户端或官方 seed 已更新。每次先读取实际 capability 结果和当前 Schema。
|
||||
|
||||
Agent 使用原 `AppManage` 的有限作者动作,直接进入已有 release、preview、runtime 或 Docker owner。原 ToolExecutor 调用源、真实 Run/用户/Agent/宿主、材料读取根、当前策略与审批在效果边界重新核验。参数不自报 owner,也不获得平台管理凭据。以下动作可按目标组合,表格不是固定开发步骤。
|
||||
Agent 使用原 `AppAuthoring` 的有限作者动作,直接进入已有 release、preview、runtime 或 Docker owner。原 ToolExecutor 调用源、真实 Run/用户/Agent/宿主、材料读取根、当前策略与审批在效果边界重新核验。参数不自报 owner,也不获得平台管理凭据。以下动作可按目标组合,表格不是固定开发步骤。
|
||||
|
||||
| AppManage action | 参数包络 | 返回事实 |
|
||||
| AppAuthoring action | 参数包络 | 返回事实 |
|
||||
|---|---|---|
|
||||
| `authoring_capabilities` | 无额外参数 | `capabilities` 的实际 features/policy/hostInstanceId 和当前 Agent 可读的 `fileRoots` 与已登记的 `registryTargetIds`;本次会话可用作草稿来源时给 `draftSource:{agentId,sessionId}`,否则给 `draftSourceUnavailable`(旧客户端两者都没有);不授上传或文件写权限 |
|
||||
| `read_draft` | `file_ref: FileResourceRef` | 从真实授权文件读取并核验的 `draft: AppDraftRef` |
|
||||
@@ -26,7 +26,7 @@ Agent 使用原 `AppManage` 的有限作者动作,直接进入已有 release
|
||||
| `export_release` | `owner_request: AppReleaseExportRequest`;可另给顶层 `export_file_ref` 与 `expected_absent:true` 或 `expected_etag` | exportRef、archiveDigest、releaseDigest、实际 files/size;显式导出时 archiveFile 包含真实 ZIP fileRef/sha256/size/etag/replayed,不上传 |
|
||||
| `distribution_prepare` | `owner_request: AppDistributionPrepareRequest`(exportRef、registryRepoId、source、metadata) | 从真实 export 与 capability 中的目录目标生成三文件草稿,未上传/未提交 |
|
||||
|
||||
例如能力调用为 `AppManage({action:'authoring_capabilities'})`。读草稿使用 `action:'read_draft'` 与返回的授权根对应的 `file_ref`;发布准备/提交分别使用 `release_request`,预览/运行纳管/导出使用 `owner_request`。这些包络不是互换字段,原工具及内部 owner 仍逐个严格核验完整 DTO。
|
||||
例如能力调用为 `AppAuthoring({action:'authoring_capabilities'})`。读草稿使用 `action:'read_draft'` 与返回的授权根对应的 `file_ref`;发布准备/提交分别使用 `release_request`,预览/运行纳管/导出使用 `owner_request`。这些包络不是互换字段,原工具及内部 owner 仍逐个严格核验完整 DTO。
|
||||
|
||||
`prepare_release` 的 AppReleasePrepareRequest 包含 `mutationId`、已授权 `materialRoot: FileResourceRef`、`manifestPath`、可选 expectedReleaseDigest、`target:{appId,installationId,deviceId,sourceId}`。FileResourceRef 的 schemaVersion/instanceId/agentId/rootId/path 来自真实 fileRoots 与本次材料;path 是授权根内相对路径,不能复制别的宿主/Agent/root。首次个人 sourceId 为服务约定的 `user-managed`,不能用名字冒充目录身份。
|
||||
|
||||
@@ -42,7 +42,7 @@ web-bundle.delivery.entrypoints 固定 `{entrypointId,path,spaFallback?}`;nati
|
||||
|
||||
数据合同声明 formatVersion、readableVersions、writableVersions、有限 files key/path/maxBytes/contentType 和 uninstallRetention: retain。备份/迁移/恢复说明引用必须在 payload 白名单中;说明不授权自动执行,安装历史不代表真实数据备份。
|
||||
|
||||
动态 Node 示例的 `/.desirecore-app-identity` 返回当前 TaskHost 注入的 proof/releaseDigest/scopeId/runtimeGeneration;proof 仅用于本次运行身份握手,不当应用 API token,不写日志。`AppManage.runtime_enroll` 使用已 prepare 的材料、installationId、真实 terminalId、endpoint.port/identityPath 与 startupPolicy。服务固定原执行合同后,原 Bash 显式停原命令,正式 commit 后由原 owner 启动新代际再核验。具体环境、执行审批和数据根均由实际 owner 决定。
|
||||
动态 Node 示例的 `/.desirecore-app-identity` 返回当前 TaskHost 注入的 proof/releaseDigest/scopeId/runtimeGeneration;proof 仅用于本次运行身份握手,不当应用 API token,不写日志。`AppAuthoring.runtime_enroll` 使用已 prepare 的材料、installationId、真实 terminalId、endpoint.port/identityPath 与 startupPolicy。服务固定原执行合同后,原 Bash 显式停原命令,正式 commit 后由原 owner 启动新代际再核验。具体环境、执行审批和数据根均由实际 owner 决定。
|
||||
|
||||
原执行命令的初始默认端口写成 `PORT="${PORT:-32000}" node runtime/server.mjs`,其中默认端口需实际可用。重启仍执行原真实 argv,Harness 注入的 preview PORT 不能被写死赋值盖掉。若应用后端需要数据,APP_DATA_DIR 也用已授权 seed 根作为初次默认,后续严格使用 owner 注入的独立根;不可将 seed/candidate 数据自动迁入正式实例。
|
||||
|
||||
@@ -50,7 +50,7 @@ Docker prepare 的 owner_request 为 `{prepareRef,installationId,endpoint:{port,
|
||||
|
||||
## 平台 HTTP 管理消费者
|
||||
|
||||
HTTP 接口保留给平台 UI 或具有合法管理凭据的消费者,普通 HttpRequest 不自动注入实例凭据。Agent 缺少对应原工具能力时说明不可用,不读取实例 token、不改 Origin 绕过 401,也不把凭据交网页。HTTP 返回包络与原 AppManage 结果各按实际合同读取。
|
||||
HTTP 接口保留给平台 UI 或具有合法管理凭据的消费者,普通 HttpRequest 不自动注入实例凭据。Agent 缺少对应原工具能力时说明不可用,不读取实例 token、不改 Origin 绕过 401,也不把凭据交网页。HTTP 返回包络与原 AppAuthoring 结果各按实际合同读取。
|
||||
|
||||
| 平台接口 | 用途 |
|
||||
|---|---|
|
||||
@@ -65,7 +65,7 @@ HTTP 接口保留给平台 UI 或具有合法管理凭据的消费者,普通 H
|
||||
|
||||
downloadPath 仍是平台管理下载路径,不授予网页或普通 HTTP 工具访问。Agent 需要实际 ZIP 时,在 export_release 顶层另给 export_file_ref:使用当前 Agent 原写权限内的 FileResourceRef 目标,path 为该根内相对路径;不能把服务 exports 私有目录挂成工作根。首次给 expected_absent:true,覆盖已有文件给原 expected_etag,两者不能同时提供。返回 archiveFile={fileRef,sha256,size,etag,replayed},sha256/size 必须等于 export 的 archiveDigest/size;这才是可交原授权上传工具的实际文件。只读 fileRoots 不授写权限。响应丢失保持相同目标/条件/完整正文,已有同一固定字节可重放,其他内容必须按实际 ETag 决定,不能盲覆盖。
|
||||
|
||||
目录草稿用原 AppManage.distribution_prepare,完整 AppDistributionPrepareRequest 放在 owner_request;registryRepoId 从 authoring_capabilities.registryTargetIds 选本次真实目标,不自报 sourceId 或构造连接。source 指向用户已实际上传并核验的不可变来源,sha256 等于 archiveDigest。返回 draft 三文件及 mapping/facts;upload 仍为 unverified,catalog 仍为 not-submitted,sourceAcl 仍为 source-admin-managed。写入目录仓库、提交 PR、目录准入和第二用户获取各由原工具取得实际回执;没有目标或来源连接时说明不可用。
|
||||
目录草稿用原 AppAuthoring.distribution_prepare,完整 AppDistributionPrepareRequest 放在 owner_request;registryRepoId 从 authoring_capabilities.registryTargetIds 选本次真实目标,不自报 sourceId 或构造连接。source 指向用户已实际上传并核验的不可变来源,sha256 等于 archiveDigest。返回 draft 三文件及 mapping/facts;upload 仍为 unverified,catalog 仍为 not-submitted,sourceAcl 仍为 source-admin-managed。写入目录仓库、提交 PR、目录准入和第二用户获取各由原工具取得实际回执;没有目标或来源连接时说明不可用。
|
||||
|
||||
## 网页协作合同
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
# 固定应用版本分发
|
||||
|
||||
1. 确认用户要分发的精确版本、真实目标仓库/Registry、公共或私有范围、实际登录连接和材料许可。生成文件、个人发布或已有预览都不是上传授权;既有会话中的明确分发授权直接沿用。
|
||||
2. 用原 AppManage 的 export_release 动作,从 prepareRef,或 installationId + expectedRevision 导出;完整 AppReleaseExportRequest 放在 owner_request。`paths` 必须显式覆盖全部 payload + app-release.json;不包含服务物化 descriptor、owner 标记、个人数据和秘密。需要实际 ZIP 时,另在顶层给 export_file_ref(当前 Agent 原写权限目录的目标 FileResourceRef)与 expected_absent:true 或原 expected_etag;不能同时给两个条件或覆盖未知文件。核验响应的 files/size 和 archiveFile 的实际 fileRef/sha256/size/etag/replayed,sha256/size 必须等于 export 的 archiveDigest/size。读能力返回的 fileRoots 不授写权限;响应丢失保持同一目标、条件与完整正文恢复。downloadPath 是平台管理消费者路径,普通 HttpRequest 不自动注入凭据。
|
||||
2. 用原 AppAuthoring 的 export_release 动作,从 prepareRef,或 installationId + expectedRevision 导出;完整 AppReleaseExportRequest 放在 owner_request。`paths` 必须显式覆盖全部 payload + app-release.json;不包含服务物化 descriptor、owner 标记、个人数据和秘密。需要实际 ZIP 时,另在顶层给 export_file_ref(当前 Agent 原写权限目录的目标 FileResourceRef)与 expected_absent:true 或原 expected_etag;不能同时给两个条件或覆盖未知文件。核验响应的 files/size 和 archiveFile 的实际 fileRef/sha256/size/etag/replayed,sha256/size 必须等于 export 的 archiveDigest/size。读能力返回的 fileRoots 不授写权限;响应丢失保持同一目标、条件与完整正文恢复。downloadPath 是平台管理消费者路径,普通 HttpRequest 不自动注入凭据。
|
||||
3. 将真实 archiveFile.fileRef 交原实际授权上传工具;GitHub Release 上传此 ZIP 后,核读真实下载地址、固定 commit 和原始字节摘要;Gitea 私有仓库可提交 `releases/<version>.zip`,取得完整 commit 与该路径。可变 tag/latest 只作展示,必须解析到固定引用。没有真实来源回执就报告“制品已生成,尚未上传”。
|
||||
4. 使用原 AppManage 的 distribution_prepare 动作,owner_request 为 AppDistributionPrepareRequest:`exportRef`、从 authoring_capabilities.registryTargetIds 选择的真实 registryRepoId、`source:{kind:'release'|'git',url,ref,sha256,path?}` 和实际 metadata。目录目标列表是配置事实,不授予源端上传权限;普通模型不读取实例 token 或改 Origin 绕过认证。git 必须给固定包路径,sha256 必须等于导出 archiveDigest。产品 ID/名称/版本/入口不由 metadata 另填。
|
||||
4. 使用原 AppAuthoring 的 distribution_prepare 动作,owner_request 为 AppDistributionPrepareRequest:`exportRef`、从 authoring_capabilities.registryTargetIds 选择的真实 registryRepoId、`source:{kind:'release'|'git',url,ref,sha256,path?}` 和实际 metadata。目录目标列表是配置事实,不授予源端上传权限;普通模型不读取实例 token 或改 Origin 绕过认证。git 必须给固定包路径,sha256 必须等于导出 archiveDigest。产品 ID/名称/版本/入口不由 metadata 另填。
|
||||
5. metadata 包含 author/description/tags/category/license/redistribution/availability/requiredClientVersion,以及实际维护者、品牌和复核材料。证据不足保留 listing-only;不要填不存在的审核者、认证、发布时间或平台验收。已复核的许可证路径应来自同一 release 的 license role 文件。
|
||||
6. 返回的是 `entries/<id>/manifest.json`、`catalog-metadata.v1.json`、`install.md` 内容和摘要。mapping 关联目标 sourceId、逻辑 ID、releaseDigest 与 archiveDigest,descriptor 安装时按真实来源物化。将三文件写入实际授权的目录仓库后审阅 diff,通过其原治理提交 PR;不能自动合并或说目录已开放。
|
||||
7. 查询真实目录可获取状态与目标客户端握手,再由第二用户/设备沿原 acquisition/app-install-manager 路径安装并核验。两来源同名不共享实例或数据;目录更新仅给更新候选,不改原安装快照。
|
||||
|
||||
候选 Registry 4.3 Schema 与客户端 reader 必须先分别 review;正式 Registry seed 只指已合入的受审提交。候选 reader 仅在明确受信的非官方测试来源开放,正式条目等待客户端能力发行,不能借 10.0.180 字符串跳过 app-authoring-v1。
|
||||
候选 Registry 4.3 Schema 与客户端 reader 必须先分别 review;正式 Registry seed 只指已合入的受审提交。候选 reader 仅在明确受信的非官方测试来源开放,正式条目等待客户端能力发行,不能借 10.0.203 字符串跳过 app-authoring-v1。
|
||||
|
||||
私有源使用 `access: private` 的真实 Registry 连接,只读登记端点、不转公开镜像;认证失败拒绝新获取。字段不是 ACL,GitHub/Gitea 管理员仍负责实际成员权限。平台团队成员移除不自动改变源端 ACL,不能宣称已撤销。已下载字节不能收回,本机数据不自动删除。
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 DesireCore
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,98 @@
|
||||
---
|
||||
{
|
||||
"name": "tool-mcp-authoring",
|
||||
"description": "Use when the user needs to build, package or modify a custom Tool, MCP Server or device-protocol integration. Reuse existing execution and approval contracts. Requires actual runtimes, drivers/libraries and authorized devices/services; third-party licenses, deployment and costs depend on the chosen dependencies. Report missing prerequisites.",
|
||||
"license": "MIT",
|
||||
"compatibility": "Requires DesireCore 10.0.203 or newer and actually available file/execution/configuration capabilities. Runtimes, third-party drivers/libraries, hardware and hosted services are not bundled by this Skill and require their applicable license, deployment, authorization and costs. Report unavailable prerequisites.",
|
||||
"version": "1.0.0",
|
||||
"requiredClientVersion": "10.0.203",
|
||||
"type": "procedural",
|
||||
"risk_level": "medium",
|
||||
"status": "enabled",
|
||||
"disable-model-invocation": true,
|
||||
"tags": [
|
||||
"tools",
|
||||
"mcp",
|
||||
"development",
|
||||
"devices"
|
||||
],
|
||||
"metadata": {
|
||||
"author": "desirecore",
|
||||
"updated_at": "2026-11-09",
|
||||
"i18n": {
|
||||
"default_locale": "en-US",
|
||||
"source_locale": "zh-CN",
|
||||
"locales": [
|
||||
"zh-CN",
|
||||
"en-US"
|
||||
],
|
||||
"zh-CN": {
|
||||
"name": "自建 Tool 与 MCP",
|
||||
"short_desc": "编写、登记和验证可复用工具与 MCP 服务",
|
||||
"description": "在用户需要自主编写、封装或修改自定义 Tool、MCP Server 或设备协议接入能力时使用。复用现有执行与审批合同;依赖真实可用的运行时、驱动/库及获准设备或服务,第三方许可、部署和费用按所选依赖确认,缺条件时报告。",
|
||||
"body": "./SKILL.zh-CN.md",
|
||||
"source_hash": "sha256:4a1d9c15821f8571",
|
||||
"translated_by": "ai:gpt-6",
|
||||
"translated_at": "2026-11-09"
|
||||
},
|
||||
"en-US": {
|
||||
"name": "Self-authored Tools and MCP",
|
||||
"short_desc": "Build, register and verify reusable tools and MCP services",
|
||||
"description": "Use when the user needs to build, package or modify a custom Tool, MCP Server or device-protocol integration. Reuse existing execution and approval contracts. Requires actual runtimes, drivers/libraries and authorized devices/services; third-party licenses, deployment and costs depend on the chosen dependencies. Report missing prerequisites.",
|
||||
"body": "./SKILL.md",
|
||||
"source_hash": "sha256:4a1d9c15821f8571",
|
||||
"translated_by": "ai:gpt-6",
|
||||
"translated_at": "2026-11-09"
|
||||
}
|
||||
}
|
||||
},
|
||||
"market": {
|
||||
"icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"white\" stroke-width=\"1.6\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"3\"/><path d=\"M3 8h18M8 8v13M12 13h5M12 17h5\"/></svg>",
|
||||
"category": "development",
|
||||
"maintainer": {
|
||||
"name": "DesireCore Official",
|
||||
"verified": true
|
||||
},
|
||||
"channel": "latest"
|
||||
}
|
||||
}
|
||||
---
|
||||
|
||||
# Self-authored Tools and MCP
|
||||
|
||||
## Choose the delivery
|
||||
|
||||
Implement the requested capability as verifiable code and contracts that remain usable. The Agent chooses language, libraries and approach; the platform supplies original file tools, execution, discovery, approvals and runtime facts without imposing a business workflow.
|
||||
|
||||
| User goal | Possible carrier |
|
||||
|---|---|
|
||||
| One diagnosis, read or conversion | A script in the authorized workspace |
|
||||
| Reusable atomic operation with an input schema | An AgentFS custom Tool |
|
||||
| Operations sharing a device connection or service state | A self-authored MCP Server attached to the actual Agent Service |
|
||||
| Reusable method, conventions and supporting scripts | A Skill; it does not register a function tool by itself |
|
||||
| Configuration UI, multiple devices, installable delivery | An application or plugin, optionally composing existing Tool/MCP capabilities |
|
||||
|
||||
Check existing capabilities and the user's choice. An explicit request to build can proceed directly without searching the market first. For application delivery, load the application authoring Skill from the actual directory: authoring actions use `AppAuthoring`, installation lifecycle uses `AppManage`.
|
||||
|
||||
## Use real environments and original authority
|
||||
|
||||
- Continue the current Plan, work directory and authorization. Creating a tool does not justify changing approval mode, extracting a platform token or widening a child task's authority. Another Agent's installation/configuration needs its original authorization.
|
||||
- Probe actual runtimes, libraries, drivers and devices/services. Prepare missing prerequisites through available runtime Skills or original execution tools, recording versions and location. Third-party libraries, hardware and hosted services retain their license, deployment and cost requirements; report unavailable prerequisites.
|
||||
- Keep reviewable code/configuration in permitted directories, private device settings and credentials in private configuration or original connection owners, and out of public Skills, CLI arguments, logs and examples. Registering a connector does not provide external hardware, licenses or services.
|
||||
- Derive serial ports, baud rates, addresses and endpoints from the actual device and protocol material. Provide descriptions in configuration/parameter schemas. Classify read/write risk by actual effects and test authorized read-only operations or simulated endpoints first without calling them physical-device evidence.
|
||||
|
||||
## Read the relevant authoring contract
|
||||
|
||||
- Atomic scripts, complete TOOL.md, registration and discovery: [AgentFS Tool](references/agentfs-tool.md).
|
||||
- Local/remote MCP, dependencies, connections and sharing: [MCP service](references/mcp-server.md).
|
||||
- For reusable operating methods, load Skill authoring/management guidance from the actual directory. For a shared HTTP/MCP catalog, load service-registration guidance. Attaching MCP to yourself needs no global listing.
|
||||
|
||||
## Verify results and lifecycle
|
||||
|
||||
Report separately: source/dependencies prepared, configuration saved, registration/discovery successful, actual invocation successful, device behavior observed and restart recovery verified. Earlier stages do not establish later ones.
|
||||
|
||||
After registry refresh, call actual current catalog/declaration names. Loading does not increase authority; a worker/background Run with a fixed tool ceiling cannot bypass it by creating new capabilities. Use the error and original context to choose a subsequent turn, a suitable execution Agent or a precise authorization requirement instead of blindly loading again.
|
||||
|
||||
Continuous subscriptions such as MQTT need a real process/service carrier and an explicit path through an authorized existing schedule, Webhook or other real ingress to the Agent. MCP list-change notifications are not a general device-event wakeup facility. A saved config, one background command or registered MCP does not prove listening survives an application restart. If choosing scheduling, use `ManageSchedule` rather than writing persistent schedule files directly.
|
||||
|
||||
Verify relevant device ownership, timeout, cancellation, disconnect/recovery and concurrency for the chosen delivery. Reconcile uncertain device writes before deciding to retry. Close/remove only your owned connections, processes and registrations rather than shared services. Deliver actual entrypoints, call examples and unverified limits without packaging every simple script as an application.
|
||||
@@ -0,0 +1,38 @@
|
||||
# 自建 Tool 与 MCP
|
||||
|
||||
## 选择交付方式
|
||||
|
||||
把用户需要的能力实现成可核验、可继续使用的代码和合同。Agent 选择语言、库及实现方式,平台提供原文件工具、执行、发现、审批与运行事实;不要求固定业务流程。
|
||||
|
||||
| 用户目标 | 可选承载 |
|
||||
|---|---|
|
||||
| 一次诊断、读取或转换 | 在授权工作目录写脚本并执行 |
|
||||
| 有输入 Schema 的可复用原子操作 | AgentFS 自定义 Tool |
|
||||
| 多个操作共享设备连接或服务状态 | 自编 MCP Server,接入实际目标 Agent Service |
|
||||
| 可复用的方法、约定及配套脚本 | Skill;它本身不会登记函数工具 |
|
||||
| 配置界面、多设备管理、可安装交付 | 应用或插件,可组合既有 Tool/MCP |
|
||||
|
||||
先检查已有能力及用户选择。用户明确要求自建时可直接编写,不必先查市场。涉及应用交付时按目录加载应用作者 Skill,作者动作使用 `AppAuthoring`;安装生命周期使用 `AppManage`。
|
||||
|
||||
## 使用真实环境与原授权
|
||||
|
||||
- 沿用当前任务的 Plan、工作目录及授权;不因创建工具而改审批模式、获取平台 token 或扩大子任务权限。跨 Agent 安装/改配置需要该目标的原授权。
|
||||
- 探测实际运行时、库、驱动和设备/服务。依赖不存在时按可用的运行时 Skill 或原执行工具准备,记录版本和安装位置。第三方库、设备、托管服务的许可证、部署条件及费用由所选依赖决定;缺少条件时报告具体不可用项。
|
||||
- 代码和可审阅配置放在获准目录,设备私有参数与凭据留在私有配置或原连接 owner;不写进公共 Skill、命令行、日志或示例。注册连接器不会提供外部硬件、许可证或服务。
|
||||
- 串口号、波特率、设备地址、网络端点等由实际设备及协议材料确定;配置与参数 Schema 提供 description。读状态和写设备按真实副作用分别声明风险,测试先使用获准的只读操作或模拟端点,不能冒充真机结果。
|
||||
|
||||
## 按需读取作者合同
|
||||
|
||||
- 原子脚本工具、完整 TOOL.md、登记与发现:读 [AgentFS 工具](references/agentfs-tool.zh-CN.md)。
|
||||
- 本地或远端 MCP、依赖、连接和共享:读 [MCP 服务](references/mcp-server.zh-CN.md)。
|
||||
- 保存操作方法时按目录加载 Skill 作者/管理指南;共享 HTTP/MCP 目录时按目录加载服务登记指南。接入自身 MCP 不要求先登记全局目录。
|
||||
|
||||
## 核验结果与生命周期
|
||||
|
||||
分别记录:源代码和依赖已准备、配置已保存、注册/发现成功、实际调用成功、设备行为已观测、重启恢复已验证。只完成前一项时不承诺后一项。
|
||||
|
||||
刷新注册表后按当前工具目录和实际模型声明调用。加载工具不会扩大权限;固定工具上限的子任务或后台 Run 不能靠新建能力绕过原上限。按错误和原上下文选择下一轮、适当执行 Agent 或报告需要的授权,不盲目重复加载。
|
||||
|
||||
长期 MQTT 等订阅要有真实进程/服务载体,并明确事件如何通过获准的原调度、Webhook 或其它实际入口触达 Agent。MCP 列表变化通知不是设备业务事件的通用唤醒器;保存配置、一次后台命令或注册 MCP 都不能证明应用重启后仍在监听。若选择调度,使用 `ManageSchedule`,不直接写持久调度文件。
|
||||
|
||||
按所选交付核验端口占用、超时、取消、断连/恢复与必要的并发访问;设备写入结果未知时先核实状态再决定是否重试。关闭或移除能力时只处理本次拥有的连接、进程与注册,不停止共享服务。给出实际入口、调用示例和未验证范围,不要求每个简单脚本都打包成应用。
|
||||
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"$schema": "../../schemas/catalog-metadata.v1.schema.json",
|
||||
"schemaVersion": 1,
|
||||
"identity": {
|
||||
"kind": "skill",
|
||||
"id": "tool-mcp-authoring"
|
||||
},
|
||||
"presentation": {
|
||||
"defaultLocale": "en-US",
|
||||
"i18n": {
|
||||
"zh-CN": {
|
||||
"name": "自建 Tool 与 MCP",
|
||||
"summary": "编写、登记和验证可复用工具与 MCP 服务",
|
||||
"description": "在用户需要自主编写、封装或修改自定义 Tool、MCP Server 或设备协议接入能力时使用。复用现有执行与审批合同;依赖真实可用的运行时、驱动/库及获准设备或服务,第三方许可、部署和费用按所选依赖确认,缺条件时报告。"
|
||||
},
|
||||
"en-US": {
|
||||
"name": "Self-authored Tools and MCP",
|
||||
"summary": "Build, register and verify reusable tools and MCP services",
|
||||
"description": "Use when the user needs to build, package or modify a custom Tool, MCP Server or device-protocol integration. Reuse existing execution and approval contracts. Requires actual runtimes, drivers/libraries and authorized devices/services; third-party licenses, deployment and costs depend on the chosen dependencies. Report missing prerequisites."
|
||||
}
|
||||
},
|
||||
"category": "development",
|
||||
"tags": [
|
||||
"tools",
|
||||
"mcp",
|
||||
"development",
|
||||
"devices"
|
||||
]
|
||||
},
|
||||
"release": {
|
||||
"state": "known",
|
||||
"version": "1.0.0",
|
||||
"versionScheme": "semver"
|
||||
},
|
||||
"timestamps": {
|
||||
"catalogUpdatedAt": {
|
||||
"state": "known",
|
||||
"value": "2026-11-09",
|
||||
"precision": "day"
|
||||
},
|
||||
"releasePublishedAt": {
|
||||
"state": "unknown"
|
||||
},
|
||||
"reviewedAt": {
|
||||
"state": "unknown"
|
||||
},
|
||||
"upstreamObservedAt": {
|
||||
"state": "unknown"
|
||||
}
|
||||
},
|
||||
"provenance": {},
|
||||
"governance": {
|
||||
"stewardship": "official",
|
||||
"availability": "installable",
|
||||
"license": {
|
||||
"state": "known",
|
||||
"value": "MIT",
|
||||
"evidencePath": "LICENSE"
|
||||
},
|
||||
"redistribution": "verify-package-terms",
|
||||
"listingMaintainer": {
|
||||
"name": "DesireCore Official",
|
||||
"verified": true
|
||||
}
|
||||
},
|
||||
"compatibility": {
|
||||
"platforms": {
|
||||
"state": "unknown"
|
||||
},
|
||||
"requiredClientVersion": "10.0.203"
|
||||
},
|
||||
"spec": {
|
||||
"kind": "skill",
|
||||
"riskLevel": "medium",
|
||||
"skillType": "procedural"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
# AgentFS script Tool contract
|
||||
|
||||
Use for bounded, independently callable operations. The current client's `toolFrontmatterSchema` and `scriptExecutionConfigSchema` are authoritative (`packages/schemas/src/agent/tool-frontmatter.ts` in the main repository). This example is not a replacement for the actual contract.
|
||||
|
||||
## Files and parameters
|
||||
|
||||
Place `TOOL.md` and the entry file under the actual AgentFS root's `agents/<own-id>/tools/<tool-id>/`, within current file authority. Each invocation runs in that tool directory; this does not create a filesystem sandbox. The following harmless teaching example is not an installed tool.
|
||||
|
||||
`TOOL.md` has YAML frontmatter; JSON is valid YAML:
|
||||
|
||||
```markdown
|
||||
---
|
||||
{
|
||||
"name": "ExampleEcho",
|
||||
"description": "Return the supplied text without accessing devices.",
|
||||
"risk_level": "low",
|
||||
"executor": "script",
|
||||
"status": "enabled",
|
||||
"command": "run.cjs",
|
||||
"script": { "runtime": "node", "timeout": 5000 },
|
||||
"input_schema": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"required": ["message"],
|
||||
"additionalProperties": false,
|
||||
"properties": { "message": { "type": "string", "description": "Text to return." } }
|
||||
}
|
||||
}
|
||||
---
|
||||
Return the actual input to verify the tool call chain.
|
||||
```
|
||||
|
||||
Adjacent `run.cjs`:
|
||||
|
||||
```javascript
|
||||
let input = ''
|
||||
process.stdin.setEncoding('utf8')
|
||||
process.stdin.on('data', chunk => { input += chunk })
|
||||
process.stdin.on('end', () => {
|
||||
try {
|
||||
const { message } = JSON.parse(input)
|
||||
if (typeof message !== 'string') throw new Error('message must be a string')
|
||||
process.stdout.write(JSON.stringify({ success: true, content: message }))
|
||||
} catch (error) {
|
||||
process.stderr.write(String(error))
|
||||
process.exitCode = 1
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
`script.runtime: node` uses only an already discovered managed Node, with command identifying a static entry inside the tool directory. A missing runtime fails explicitly without download or PATH fallback; establish actual managed Node availability first. For another runtime, omit runtime, set command to its real executable and pass the script path/options separately in `script.args`. Execution does not use a shell; do not place a shell program or variable user command in command.
|
||||
|
||||
Parameters arrive as stdin JSON; stdout carries results and stderr diagnostics. JSON success cannot override a nonzero exit code. Install dependencies where this entry can actually resolve them and retain locked versions; do not assume access to a development workspace's node_modules or virtual environment. The default timeout is 30000 milliseconds, at most 600000. A new process per call is not a persistent device connection.
|
||||
|
||||
## Save, refresh and call
|
||||
|
||||
Use the original Write/Edit tools to author complete material, then `RefreshAgentFS(changeTypes=["tool"])` to refresh your own registry and inspect failure diagnostics. Alternatively, when the current local API contract permits it, `POST /api/agents/<own-id>/tools` creates only a skeleton with name, description, executor, risk_level and body. Complete command/script/input_schema still require the full TOOL.md or `PUT /api/agents/<own-id>/tools/<tool-id>` with `{content: "complete TOOL.md"}`. Mediated, remote or unavailable management access does not justify finding a platform token.
|
||||
|
||||
Inspect purpose and current visibility through `ToolCatalog`. If an exact known name is undeclared, use `LoadTools(names=["actual tool name"])` (registered identity DiscoverTools); call the actual declaration on the next model request. Refresh does not widen a Run's fixed tool ceiling; changes to an already bound definition may require the next turn or a new session. For a missing name, inspect refresh diagnostics, enabled state, permissions and Run ceiling instead of inventing a result.
|
||||
|
||||
Actually invoke a harmless input, inspect output and invalid parameters plus relevant failure/timeout cases, then validate business operations on authorized hardware. Rediscover and call after restart. Tools belong to their Agent by default; copying/installing for another Agent follows that target's original authorization and is not global publication.
|
||||
@@ -0,0 +1,61 @@
|
||||
# AgentFS 脚本 Tool 合同
|
||||
|
||||
适用于有限时长、可独立调用的操作。权威字段为当前客户端的 `toolFrontmatterSchema` 和 `scriptExecutionConfigSchema`(主仓 `packages/schemas/src/agent/tool-frontmatter.ts`),不能以本例替代实际工具合同。
|
||||
|
||||
## 文件与参数
|
||||
|
||||
在实际 AgentFS 根的 `agents/<自身 id>/tools/<tool-id>/` 保存 `TOOL.md` 和入口文件,读写仍需当前目录权限。每次脚本调用的工作目录为该工具目录;脚本没有因此获得文件系统沙箱。下面是无硬件副作用的教学示例,不是已经安装的工具。
|
||||
|
||||
`TOOL.md` 使用 YAML frontmatter;JSON 也是合法 YAML:
|
||||
|
||||
```markdown
|
||||
---
|
||||
{
|
||||
"name": "ExampleEcho",
|
||||
"description": "返回传入的文本;不访问设备。",
|
||||
"risk_level": "low",
|
||||
"executor": "script",
|
||||
"status": "enabled",
|
||||
"command": "run.cjs",
|
||||
"script": { "runtime": "node", "timeout": 5000 },
|
||||
"input_schema": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"required": ["message"],
|
||||
"additionalProperties": false,
|
||||
"properties": { "message": { "type": "string", "description": "需要返回的文本。" } }
|
||||
}
|
||||
}
|
||||
---
|
||||
返回实际输入,用于验证工具调用链。
|
||||
```
|
||||
|
||||
同目录 `run.cjs`:
|
||||
|
||||
```javascript
|
||||
let input = ''
|
||||
process.stdin.setEncoding('utf8')
|
||||
process.stdin.on('data', chunk => { input += chunk })
|
||||
process.stdin.on('end', () => {
|
||||
try {
|
||||
const { message } = JSON.parse(input)
|
||||
if (typeof message !== 'string') throw new Error('message must be a string')
|
||||
process.stdout.write(JSON.stringify({ success: true, content: message }))
|
||||
} catch (error) {
|
||||
process.stderr.write(String(error))
|
||||
process.exitCode = 1
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
`script.runtime: node` 只使用已发现的受管 Node,command 必须是工具目录内静态入口;缺运行时会明确失败,不下载也不回退 PATH。先确认真实受管 Node 可用。选择其它运行时则省略 runtime,command 为实际可执行文件,脚本路径与选项用 `script.args` 独立传递。它们不经过 shell;不要把一段 shell 程序或可变用户命令塞进 command。
|
||||
|
||||
参数通过 stdin JSON 传入;stdout 返回结果,诊断写 stderr。返回 JSON 的 success 不能覆盖非零退出码。依赖应安装在真实可解析的位置并记录锁定版本,不假设工具目录能读取开发工作区的 node_modules/虚拟环境。默认 timeout 为 30000 毫秒,最大 600000;持久设备连接不要依赖每次启动的脚本进程存活。
|
||||
|
||||
## 保存、刷新和调用
|
||||
|
||||
可直接用原 Write/Edit 编写完整材料,再调用 `RefreshAgentFS(changeTypes=["tool"])` 刷新自身注册表,检查失败诊断。也可按当前可用的本机 API 合同创建:`POST /api/agents/<自身 id>/tools` 只生成名称、描述、executor、risk_level 和 body 等骨架;完整 command、script、input_schema 仍须通过完整 TOOL.md 或 `PUT /api/agents/<自身 id>/tools/<tool-id>` 的 `{content: "完整 TOOL.md"}` 补齐。受中介约束、远端或不可用的管理入口不能靠找 token 绕过。
|
||||
|
||||
用 `ToolCatalog` 检查用途和当前可见性;已知准确名称而未声明时,使用 `LoadTools(names=["实际工具名"])`(注册身份 DiscoverTools),加载后按真实声明发起下一次模型调用。刷新成功不代表当前 Run 固定上限扩大;改动已经绑定的定义可能需下一轮或新会话。名字缺失时核对刷新诊断、启用状态、权限与 Run 上限,不伪造调用结果。
|
||||
|
||||
先真实调用无副作用输入,检查输出、非法参数及必要的失败/超时;再在授权设备上验证业务。重启后重新发现并调用。工具默认属于自身 Agent;其他 Agent 的复制/安装和配置沿目标原授权,不因这里创建了目录就全局可用。
|
||||
@@ -0,0 +1,39 @@
|
||||
# Self-authored MCP connection contract
|
||||
|
||||
Use when operations share connection/state or other MCP clients need the capability. Choose the implementation language and SDK. Implement initialization, listing, parameter schemas and calls against the chosen installed SDK's actual protocol and documentation; never fabricate success receipts.
|
||||
|
||||
## Service, dependencies and host
|
||||
|
||||
Keep source, dependency manifests/locks and configuration schemas in authorized directories. Use the actual runtime path. A local stdio process writes only MCP protocol to stdout and diagnostics to stderr. Verify startup directory and module resolution rather than assuming Electron bundles your library or platform-specific native driver.
|
||||
|
||||
Identify the Agent Service host that accesses the device. A remote server's COM/USB devices are not the browser computer's hardware. External libraries, hardware and hosted services require their actual licenses, deployment and authorization; registering a connection does not provide them. Stop the affected operation and report missing prerequisites.
|
||||
|
||||
## Attach to your own Agent
|
||||
|
||||
The current McpConnectionRequest/Schema defines the accepted request. Through the current permitted local API path, optionally `POST /api/mcp/test-connection` with `{connection: <connection request>}`, then `POST /api/agents/<own-id>/mcp-servers`, for example:
|
||||
|
||||
```json
|
||||
{
|
||||
"serverId": "example-device",
|
||||
"config": {
|
||||
"transport": "stdio",
|
||||
"command": "<actual absolute Node executable on the host>",
|
||||
"args": ["<absolute installed server entry>"],
|
||||
"cwd": "<absolute authorized service directory>"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Replace angle-bracket placeholders with actual paths before execution. Keep executable/args separate. Use original connection/secret-reference facilities for sensitive values, never platform tokens/passwords in source or CLI arguments. Connection requests and persisted agent.json mcp_servers entries have different shapes: let this endpoint convert, or inspect the actual agent.json Schema before using authorized file tools to edit your own configuration followed by `RefreshAgentFS(changeTypes=["agent"])`. `ManageAgent.update` does not accept mcp_servers; its rejection is not lack of MCP support.
|
||||
|
||||
Ordinary embedded local non-governance APIs, remote/standalone and mediated modes have different access rules. Follow current prompts and actual permissions. If mediated or unavailable, use an offered original configuration capability or report the missing entry; do not extract platform credentials, forge Origin or borrow another identity. First connection can actually start a process and remains subject to the original file, execution, request and MCP-call approvals.
|
||||
|
||||
For remote connections, use the client's actual transport, endpoint and OAuth/secretRef contract. An ordinary self-authored local server needs no invented external catalog acquisition identity. Catalog-owned services retain their original acquisition/installation contract; do not impersonate provenance or replace someone else's installation.
|
||||
|
||||
## Discover, reuse and actually invoke
|
||||
|
||||
Inspect connection-test lists/diagnostics; handshake and listing do not prove a device operation succeeded. After saving, obtain the real model-facing tool name through current catalog/declarations, using `LoadTools` when needed. Do not guess it from the remote declaration or a namespace convention. A fixed worker/background tool ceiling does not expand when new MCP is registered; choose subsequent execution within original authorization and session state.
|
||||
|
||||
Actually invoke an authorized harmless tool, then validate device behavior and relevant errors, disconnect/recovery and concurrent device ownership. For a shared catalog, load a service-registration Skill from the actual directory. Attaching to yourself needs no global listing. Other Agents require their own authorized configuration; discoverable does not mean installed or authorized.
|
||||
|
||||
Persisted configuration and a live business subscription are separate facts. Current connection owners manage MCP connections and stdio processes; this is not an OS startup service. Continuous subscriptions need an explicit process lifecycle and a real ingress to the Agent. After restart, inspect configuration, rediscover and call, and separately verify business reconnection. Remove your own configuration through the original `DELETE /api/agents/<own-id>/mcp-servers/<serverId>` contract when appropriate; close only your owned resources through their runtime owner, retain user data and leave shared processes alone.
|
||||
@@ -0,0 +1,39 @@
|
||||
# 自编 MCP 的接入合同
|
||||
|
||||
适用于多个操作共享连接/状态,或需要 MCP 客户端复用的能力。服务代码由 Agent 选择语言和 SDK;以所选已安装 SDK 的真实协议和文档实现初始化、工具列表、参数 Schema 与调用,不伪造成功回执。
|
||||
|
||||
## 服务、依赖与目标宿主
|
||||
|
||||
在获准目录保存服务源、依赖清单/锁文件和配置 Schema。使用真实运行时路径;本地 stdio 程序只向 stdout 写 MCP 协议,日志写 stderr。实际启动目录和模块解析必须经过验证,不能假设 Electron 内置了作者选择的库或平台相关原生驱动。
|
||||
|
||||
明确设备连接发生在哪台 Agent Service 宿主。远端服务上的 COM/USB 不是用户浏览器所在电脑的设备。外部库、硬件和托管服务按其许可证、部署和授权条件使用,连接登记不提供这些资源;缺条件时停止受影响操作并报告。
|
||||
|
||||
## 接入自身 Agent
|
||||
|
||||
实际连接请求由当前客户端的 McpConnectionRequest/Schema 决定。通过当前获准且可用的本机 API 路径,可以先 `POST /api/mcp/test-connection`,正文 `{connection: <连接请求>}`;再 `POST /api/agents/<自身 id>/mcp-servers`,正文例如:
|
||||
|
||||
```json
|
||||
{
|
||||
"serverId": "example-device",
|
||||
"config": {
|
||||
"transport": "stdio",
|
||||
"command": "<宿主真实 Node 可执行文件绝对路径>",
|
||||
"args": ["<已安装服务入口的绝对路径>"],
|
||||
"cwd": "<已授权服务目录的绝对路径>"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
尖括号是待替换的真实路径,不可原样执行。路径/args 分开传递;敏感连接值使用原连接或秘密引用能力,不把平台 token、密码写进文件或 CLI 参数。连接请求与持久化 agent.json 的 mcp_servers 结构并非相同对象;使用该接口转换,或核对真实 agent.json Schema 后用获准文件工具编辑自身配置并 `RefreshAgentFS(changeTypes=["agent"])`。`ManageAgent.update` 不接受 mcp_servers,不能把拒绝当作 MCP 不受支持。
|
||||
|
||||
普通 embedded 本机非治理 API、remote/standalone 和 mediated 模式的访问方式不同,以当前提示词和实际权限为准。受中介约束或入口不可用时使用已提供的原配置能力,或明确报告缺少入口;不读取平台凭据、伪造 Origin 或使用其它身份绕过。首次连接可能真实启动服务进程,仍沿原文件、执行、请求与 MCP 调用审批。
|
||||
|
||||
远端连接使用客户端实际接受的传输、端点和 OAuth/secretRef 合同;无需为普通自编本地 MCP 构造外部目录来源证明。已有目录托管服务则沿其原获取/安装合同,不伪造目录身份或改装别人的安装。
|
||||
|
||||
## 发现、复用与实际调用
|
||||
|
||||
检查连接测试的工具列表与诊断;它只证明握手和列表发现,不证明设备操作成功。保存后用当前工具目录/声明取得真实模型侧工具名,必要时 `LoadTools`;不按远端声明名或命名空间习惯猜调用名。固定子任务/后台工具上限不会因登记新 MCP 自动扩大;按原授权和会话状态选择后续执行。
|
||||
|
||||
真实调用一次获准的无副作用工具,再验证设备操作及必要的异常、断连/恢复和并发占用。共享目录需求可按目录加载服务登记 Skill;只给自身接入不需要全局目录。其它 Agent 要有自己的授权配置,目录可发现不代表已安装或获准执行。
|
||||
|
||||
配置持久化和业务监听存活是不同事实。MCP 连接与 stdio 子进程由当前连接 owner 管理,不等于系统启动服务;长期订阅需明确进程生命周期及事件进入 Agent 的真实入口。重启后检查配置、再次发现和真实调用,并单独核验业务重连。卸载自身配置可按原接口 `DELETE /api/agents/<自身 id>/mcp-servers/<serverId>`;同时依原运行 owner 关闭本次拥有的资源,保留用户数据,不结束共享进程。
|
||||
Reference in new issue
Block a user