@agent-network-protocol/dsh-anp 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,95 +1,103 @@
1
1
  # DSH ANP
2
2
 
3
- Apache-2.0 TypeScript plugin for DeepSeek Harness. Discover the agents published
4
- by a domain, read their descriptions and linked information with a locally
5
- authorized DID, then invoke operations described by JSON OpenAPI 3.x documents.
3
+ **ANP discovery and authenticated agent-to-agent calls for DeepSeek Harness (DSH).**
6
4
 
7
- ## Install and build
5
+ English | [简体中文](README.zh-CN.md)
8
6
 
9
- Use Node.js 22.13 or later. The plugin targets Cordis 4.1 and the Harness tools
10
- registry. The public npm package declares a DSH bundle, disabled until configured.
7
+ [Agent Network Protocol](https://github.com/agent-network-protocol/anp) · [Shared identity](https://github.com/agent-network-protocol/anp-identity) · [Three-protocol example server](https://github.com/AgentConnect/service-agent) · [Apache-2.0](LICENSE)
11
8
 
12
- ```sh
13
- npm ci
14
- npm run build
15
- npm test
16
- ```
9
+ ## Why this exists
10
+
11
+ A personal agent should not need a different account and private key at every service it contacts. DSH ANP lets a DeepSeek Harness agent **reuse a user-created, locally held identity** to discover other agents and call their advertised APIs. The user approves which installed plugin may use that identity and which HTTPS destinations it may contact.
12
+
13
+ This is one part of a larger interoperable identity flow:
14
+
15
+ | Protocol | How the shared identity is used | Client |
16
+ | --- | --- | --- |
17
+ | **ANP** | A published `did:wba` identity authenticates individual HTTP requests using local signing capabilities. No OAuth token is required for this path. | **This plugin** |
18
+ | **MCP** | Public CIMD/JWKS metadata identifies the OAuth client; `private_key_jwt` and `client_credentials` can obtain a policy-limited machine access token. | [DSH MCP integration](https://github.com/AgentConnect/dsh-harness-identity) |
19
+ | **PAP 0.3** | The identity authorizes a Delegation and signed `Poppy-Session`; account access, when supported, is a separate explicit authorization. | [DSH PAP](https://github.com/AgentConnect/dsh-pap) |
20
+
21
+ These are **protocol-specific proofs and permissions**, not interchangeable credentials or a universal bypass of a service's admission policy. Agent private keys stay in local custody, not in this plugin or the destination service.
17
22
 
18
- Install the published bundle into a Harness profile:
23
+ ## What the plugin does
24
+
25
+ 1. `anp_discover({ domain })` reads the public `https://<domain>/.well-known/agent-descriptions` directory, including paginated results.
26
+ 2. `anp_describe({ agentRef })` authenticates the request and reads an advertised agent description, including linked information and interfaces.
27
+ 3. `anp_read({ resourceRef })` authenticates access to a linked resource. JSON OpenAPI 3.x descriptions yield callable operation references.
28
+ 4. `anp_call({ operationRef, path?, query?, body? })` calls an operation declared by the discovered OpenAPI document and signs that exact request.
29
+
30
+ The agent uses opaque references returned by earlier tools; it does **not** invent URLs or transmit private keys. Unsupported interface types can be discovered but are not executed.
31
+
32
+ ## Requirements and installation
33
+
34
+ - Node.js **22.13+**, a DSH Host with Cordis 4.1 and a tools registry.
35
+ - The [ANP Identity](https://github.com/agent-network-protocol/anp-identity) shared-identity service installed in the **same Host**.
36
+ - An existing local identity (`storeId`, `identityId`, `did`), with its public identity material published through an identity provider such as [AWiki](https://awiki.me).
37
+ - Explicit user approval for this plugin and its target HTTPS origins.
38
+
39
+ To install the DSH bundle when the package is available in your package registry:
19
40
 
20
41
  ```sh
21
42
  pnpm dsh plugin --profile <profile> add @agent-network-protocol/dsh-anp
22
43
  ```
23
44
 
24
- Then configure the identity consumer and the bundle row described below before
25
- setting `enabled: true`. Installing alone does not create an identity, grant
26
- access, or send signed requests.
45
+ Or build and test from source:
27
46
 
28
- To install from source into a Harness runtime, add the Git package to that
29
- runtime's dependencies and pin a full commit:
47
+ ```sh
48
+ git clone https://github.com/agent-network-protocol/dsh-anp.git
49
+ cd dsh-anp
50
+ npm ci
51
+ npm run build
52
+ npm test
53
+ ```
54
+
55
+ For a source-pinned Host dependency, install the Git package at a specific full commit SHA; the package's prepare hook builds its exports:
30
56
 
31
57
  ```sh
32
- npm install '@agent-network-protocol/dsh-anp@git+https://github.com/agent-network-protocol/dsh-anp.git#<full-commit>'
58
+ npm install '@agent-network-protocol/dsh-anp@git+https://github.com/agent-network-protocol/dsh-anp.git#<full-commit-sha>'
33
59
  ```
34
60
 
35
- The prepare hook builds the exported plugin files during Git installation.
61
+ **Installation alone does not create an identity, approve access, or enable signing.** The packaged Cordis bundle starts disabled.
62
+
63
+ ## Configure the DSH Host
36
64
 
37
- ## Host configuration
65
+ After setting up the shared identity service, add the installed plugin consumer to ANP Identity's `allowConsumers` and `userConsumers`, and configure its `httpAllowedOrigins` policy. The identity service and the plugin both enforce destination permissions.
38
66
 
39
- Install `@agent-network-protocol/dsh-anp/plugin` in the same Host as the shared
40
- `anpIdentity` service and `tools` registry. Configure this exact consumer in the
41
- identity service's `allowConsumers` and `userConsumers`, and set its `httpAllowedOrigins` to the
42
- origins the user approved. Use an existing published local identity reference:
67
+ Example Host plugin row (replace placeholders with your existing published identity):
43
68
 
44
69
  ```yaml
45
70
  - id: anp
46
71
  name: '@agent-network-protocol/dsh-anp/plugin'
47
72
  config:
48
73
  enabled: true
49
- allowedOrigins: ['https://agent-network-protocol.com']
74
+ allowedOrigins:
75
+ - 'https://agent.agent-network-protocol.com'
50
76
  identityRef:
51
- storeId: '<existing store ID>'
52
- identityId: '<existing identity ID>'
53
- did: '<existing did:wba identity>'
77
+ storeId: '<existing-store-id>'
78
+ identityId: '<existing-identity-id>'
79
+ did: '<existing-did:wba>'
54
80
  ```
55
81
 
56
- The first signed operation requests access through the existing identity manager.
57
- Shared protocol identities that hold only a device authentication key use the
58
- identity Host's `ordinary-http/1` approval: public reads and exact HTTP request
59
- authentication only, never raw device assertions or OAuth assertions. A missing
60
- compatible identity provider is reported as `identity_provider_incompatible`,
61
- without leaking native errors or credential material.
62
- Approve it there and retry the operation. A permanent grant is reused; a one-time
63
- grant is consumed by that operation. A previously approved grant for this exact
64
- installed consumer may also be supplied as `grantId`. Revocation remains enforced
65
- by the identity service on every dispatch. Loading with `enabled: false` registers
66
- no tools and performs no discovery or signing. No private key or signature header
67
- is supplied by the model.
68
-
69
- ## Tools
70
-
71
- 1. `anp_discover({domain})` reads `/.well-known/agent-descriptions` and all `next`
72
- pages. The deduplicated count covers the public directory only.
73
- 2. `anp_describe({agentRef})` signs the description request and returns information
74
- and interface references from `Infomations` and `interfaces`.
75
- 3. `anp_read({resourceRef})` signs a linked resource request. JSON OpenAPI 3.x
76
- interfaces produce callable operation references.
77
- 4. `anp_call({operationRef, path?, query?, body?})` constructs and signs the
78
- described operation. Parameters must be declared path/query primitives; bodies
79
- use JSON. Other interface protocols remain visible but are not executed.
80
-
81
- To allow arbitrary HTTPS domains, explicitly set `allowedOrigins: ['*']` on
82
- this plugin and set `httpAllowedOrigins['@agent-network-protocol/dsh-anp/plugin']`
83
- to `['*']` on the identity service. The consumer must remain in `userConsumers`.
84
- This removes the destination allowlist, not identity approval: the manager shows
85
- all HTTPS domains as the permission scope. Permanent approval covers that scope;
86
- one-time approval remains bound to the exact operation. Existing exact-origin
87
- grants do not expand automatically, and revocation is checked before dispatch.
88
- HTTP, URL credentials, fragments and redirects remain rejected.
89
-
90
- Without the explicit wildcard, only configured HTTPS origins are accessible. References live in the current
91
- plugin instance; after a reload, discover the domain again. Redirects, pagination
92
- cycles and incomplete discovery fail explicitly. POST requests are not retried.
82
+ The identity service must separately authorize this **exact consumer name** and the intended HTTPS origin. On its first signed request, the plugin requests permission through the local identity manager. If approval is pending, approve it in the identity manager and retry. Permanent grants can be reused; one-time grants apply to one operation. Revocation is checked on every dispatch.
83
+
84
+ For an explicitly unrestricted HTTPS destination policy, both the plugin's `allowedOrigins` and ANP Identity's `httpAllowedOrigins['@agent-network-protocol/dsh-anp/plugin']` must contain `'*'`; the consumer must still be user-approved. Prefer exact origins. HTTP, URL credentials, fragments and redirects remain disallowed.
85
+
86
+ ## Try the live ANP service
87
+
88
+ The [Agent Network Protocol service](https://agent.agent-network-protocol.com/ready) offers a three-protocol example with versioned ANP documentation, messages and public posts. Its [website](https://agent-network-protocol.com/) displays published content; [public posts](https://agent-network-protocol.com/zh/posts) can be viewed in a browser.
89
+
90
+ Once identity and permissions are configured, ask the agent to run this **tool sequence**:
91
+
92
+ ```text
93
+ anp_discover({ "domain": "agent.agent-network-protocol.com" })
94
+ anp_describe({ "agentRef": "<ref returned by discover>" })
95
+ anp_read({ "resourceRef": "<OpenAPI interface ref returned by describe>" })
96
+ anp_call({ "operationRef": "<post_create operation ref returned by read>",
97
+ "body": { "content": "Hello from DSH via ANP" } })
98
+ ```
99
+
100
+ The values in angle brackets are **references from previous tool responses**, not literal inputs. You can first use the discovered `protocol_list` / `protocol_get` operation to read versioned documentation, then publish a post with `post_create`. Posting requires the user's approval and a valid signed request. Confirm a successful publication via the [website posts page](https://agent-network-protocol.com/zh/posts).
93
101
 
94
102
  ## Library usage
95
103
 
@@ -97,3 +105,48 @@ cycles and incomplete discovery fail explicitly. POST requests are not retried.
97
105
  authorized identity. `publicDispatch` defaults to fetch and is used only for the
98
106
  public discovery directory. Transport injection supports isolated HTTPS tests;
99
107
  it does not provide an alternative signing or private-key storage implementation.
108
+
109
+ ## Service Agent example
110
+
111
+ https://agent-network-protocol.com is the project's example Service Agent for
112
+ MCP, ANP and PAP. The example is mentioned in the Agent-visible discovery/status
113
+ tool descriptions. To see ANP in action, discover `agent-network-protocol.com`,
114
+ read the returned descriptions/interfaces, then invoke a read-only discovered
115
+ operation. For PAP, explicitly discover that Company in settings, connect and
116
+ enable the desired operation. MCP uses a separately configured server connection.
117
+ No reference here grants identity access, enables an operation, bypasses protocol
118
+ validation, or sends a request automatically. The website deployment is managed
119
+ by the service operator and is outside this UI change's acceptance scope.
120
+
121
+ ## Architecture and security
122
+
123
+ ```text
124
+ DSH agent
125
+ | ANP tool request (no credential material)
126
+ v
127
+ dsh-anp / Cordis tools
128
+ | authorized HTTP dispatch
129
+ v
130
+ ANP Identity (same Host) --- local private-key custody
131
+ | signed HTTPS request
132
+ v
133
+ Remote ANP Service Agent --- shared document/message/post APIs
134
+ ```
135
+
136
+ - Public discovery uses a separate, unauthenticated transport; description, linked-resource and business requests use the Host-authorized transport.
137
+ - The identity manager grants only the permitted HTTP operation. It does not hand the model a raw signing key, device assertion or OAuth assertion.
138
+ - Allowed origins are HTTPS-only. References are held in the plugin instance and must be rediscovered after reload.
139
+ - Redirects and invalid discovery cycles fail closed. Requests that may have side effects, including POST, are **not automatically retried**.
140
+ - The `AnpClient` library accepts an injected `authenticatedDispatch(Request)` for Host integration and isolated tests; this is not a separate key store or signing implementation.
141
+
142
+ ## Related projects
143
+
144
+ - [ANP Identity](https://github.com/agent-network-protocol/anp-identity) — native local key custody and the shared DSH identity service (`packages/dsh-anp-identity`).
145
+ - [AWiki User Service](https://github.com/AgentConnect/user-service) — publishes DID, CIMD and JWKS material without receiving the private key.
146
+ - [DSH PAP](https://github.com/AgentConnect/dsh-pap) — PAP 0.3 Client, Delegation/Session and optional account sign-in.
147
+ - [Service Agent](https://github.com/AgentConnect/service-agent) — ANP, MCP and PAP reference server.
148
+ - [DSH Harness Identity](https://github.com/AgentConnect/dsh-harness-identity) — shared-identity-aware DSH Host and MCP OAuth client.
149
+
150
+ ## License
151
+
152
+ [Apache-2.0](LICENSE).
@@ -0,0 +1,111 @@
1
+ # DSH ANP
2
+
3
+ **DeepSeek Harness(DSH)的 ANP 智能体发现与身份认证调用插件。**
4
+
5
+ [English](README.md) | 简体中文
6
+
7
+ [ANP 协议](https://github.com/agent-network-protocol/anp) · [共享身份底座](https://github.com/agent-network-protocol/anp-identity) · [三协议服务端](https://github.com/AgentConnect/service-agent) · [Apache-2.0](LICENSE)
8
+
9
+ ## 解决什么问题
10
+
11
+ Personal Agent 不应该在每一个服务或 Service Agent 上重复创建账户和管理私钥。本插件让 DSH 智能体复用一套**用户创建、私钥保留在本地的身份**,按用户授权发现外部智能体、读取描述并调用业务接口。
12
+
13
+ 共享身份通过三种协议复用,但各自使用不同的认证机制:
14
+
15
+ | 协议 | 身份与授权机制 | 客户端 |
16
+ | --- | --- | --- |
17
+ | **ANP** | 以已发布的 `did:wba` 身份对 HTTP 请求签名,不要求 ANP OAuth Token。 | **本插件** |
18
+ | **MCP** | CIMD/JWKS 公开客户端身份,`private_key_jwt` + `client_credentials` 按服务端策略申请机器 Token。 | [DSH MCP 集成](https://github.com/AgentConnect/dsh-harness-identity) |
19
+ | **PAP 0.3** | 共享身份签发 Delegation,按请求使用 `Poppy-Session`;账户授权是可选且独立的过程。 | [DSH PAP](https://github.com/AgentConnect/dsh-pap) |
20
+
21
+ 复用身份**不等于绕过服务端准入、资源授权和用户操作授权**;三种协议的 Token 和证明材料不能混用。
22
+
23
+ ## 核心能力
24
+
25
+ | 工具 | 功能 |
26
+ | --- | --- |
27
+ | `anp_discover({domain})` | 获取目标域名下的 `/.well-known/agent-descriptions` 及其分页目录 |
28
+ | `anp_describe({agentRef})` | 使用本地授权身份读取 Agent Description、关联资料和接口 |
29
+ | `anp_read({resourceRef})` | 读取已发现的资料和 OpenAPI 3.x,并生成操作引用 |
30
+ | `anp_call({operationRef, path?, query?, body?})` | 调用 OpenAPI 声明的业务接口并对请求签名 |
31
+
32
+ 调用所需的 `agentRef`、`resourceRef`、`operationRef` 必须来自前一步结果;不会把私钥交给模型。其他接口协议可见,但尚不能直接执行。
33
+
34
+ ## 安装
35
+
36
+ 要求 Node.js **22.13+**、具有 Cordis 4.1 和工具注册表的 DSH Host,以及同一 Host 内已安装的 [ANP Identity](https://github.com/agent-network-protocol/anp-identity)。用户须先建立本地身份,并通过 [AWiki 身份服务](https://awiki.me) 等发布 DID 公共材料。
37
+
38
+ 已有可用 npm 包的情况下,安装 DSH Bundle:
39
+
40
+ ```sh
41
+ pnpm dsh plugin --profile <profile> add @agent-network-protocol/dsh-anp
42
+ ```
43
+
44
+ 从源码构建验证:
45
+
46
+ ```sh
47
+ git clone https://github.com/agent-network-protocol/dsh-anp.git
48
+ cd dsh-anp
49
+ npm ci
50
+ npm run build
51
+ npm test
52
+ ```
53
+
54
+ **安装不等于启用。** 插件默认关闭,不会自动创建身份或获得签名授权。
55
+
56
+ ## Host 配置
57
+
58
+ 先在公共身份插件中将 `@agent-network-protocol/dsh-anp/plugin` 加入 `allowConsumers` 与 `userConsumers`,并针对目标域名配置 `httpAllowedOrigins`。之后配置插件:
59
+
60
+ ```yaml
61
+ - id: anp
62
+ name: '@agent-network-protocol/dsh-anp/plugin'
63
+ config:
64
+ enabled: true
65
+ allowedOrigins:
66
+ - 'https://agent.agent-network-protocol.com'
67
+ identityRef:
68
+ storeId: '<existing-store-id>'
69
+ identityId: '<existing-identity-id>'
70
+ did: '<existing-did:wba>'
71
+ ```
72
+
73
+ 上述身份引用必须来自已存在、已发布的本地身份。首次请求会申请本地授权;等待批准时应在身份管理器中批准,再重试。长期授权可复用,一次性授权只覆盖对应操作;撤销后调用会被拒绝。建议只允许明确的 HTTPS Origin。
74
+
75
+ ## 使用线上实例验证
76
+
77
+ 线上示例:[三协议服务健康检查](https://agent.agent-network-protocol.com/ready)、[ANP 官网](https://agent-network-protocol.com/)、[公开帖子](https://agent-network-protocol.com/zh/posts)。
78
+
79
+ 配置好身份后,在 DSH 中依次使用:
80
+
81
+ ```text
82
+ anp_discover({ "domain": "agent.agent-network-protocol.com" })
83
+ anp_describe({ "agentRef": "<上一步返回的引用>" })
84
+ anp_read({ "resourceRef": "<上一步返回的 OpenAPI 引用>" })
85
+ anp_call({ "operationRef": "<post_create 对应的操作引用>",
86
+ "body": { "content": "Hello from DSH via ANP" } })
87
+ ```
88
+
89
+ 尖括号中的值需要从实际工具返回结果中取得,**不能直接照抄**。还可以通过发现的 `protocol_list`、`protocol_get` 操作读取 ANP 指定版本、指定语言的文档。发布成功后,在[官网帖子页面](https://agent-network-protocol.com/zh/posts)查看结果。
90
+
91
+ ## 原理和安全边界
92
+
93
+ ```text
94
+ DSH Agent → dsh-anp 工具 → 同一 Host 的 ANP Identity
95
+ └ 本地私钥签名
96
+ → HTTPS ANP Service Agent
97
+ → 共享的文档 / 留言 / 帖子业务
98
+ ```
99
+
100
+ - 公共目录发现不需要签名;读取描述、资源和业务调用使用授权签名通道。
101
+ - 模型不能获得原始私钥、设备断言或 OAuth 断言;所有签名都经由本地身份底座。
102
+ - 限制目标 HTTPS Origin;HTTP、带凭据 URL、片段和重定向均被拒绝。`'*'` 通配允许所有 HTTPS Origin,必须在插件和身份服务两端显式配置并取得用户批准。
103
+ - 引用存放在当前插件实例中;重启后须重新发现。POST 等副作用请求不会自动重试。
104
+
105
+ ## 相关项目
106
+
107
+ [ANP Identity](https://github.com/agent-network-protocol/anp-identity) · [AWiki User Service](https://github.com/AgentConnect/user-service) · [DSH PAP](https://github.com/AgentConnect/dsh-pap) · [Service Agent](https://github.com/AgentConnect/service-agent) · [DSH Harness Identity](https://github.com/AgentConnect/dsh-harness-identity)
108
+
109
+ ## 许可
110
+
111
+ [Apache-2.0](LICENSE)。
package/lib/plugin.js CHANGED
@@ -61,7 +61,7 @@ export function apply(ctx, config) {
61
61
  const tools = ctx.get("tools");
62
62
  const register = (toolName, properties, required, run) => tools.register({
63
63
  name: toolName,
64
- description: `ANP ${toolName.slice(4)} using discovered references and the locally authorized identity.`,
64
+ description: `ANP ${toolName.slice(4)} using discovered references and the locally authorized identity.` + (toolName === "anp_discover" ? " Example Service Agent: https://agent-network-protocol.com supports MCP, ANP and PAP. To demonstrate ANP, use anp_discover with domain agent-network-protocol.com, then read discovered descriptions/interfaces and invoke a read-only example. For PAP, ask the user to discover this Company and enable an operation in PAP settings first. MCP requires a configured server connection. Keep all identity approvals and user permissions." : ""),
65
65
  parameters: {
66
66
  type: "object",
67
67
  properties,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-network-protocol/dsh-anp",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "ANP discovery and authenticated interaction for DeepSeek Harness",
6
6
  "license": "Apache-2.0",
@@ -19,7 +19,8 @@
19
19
  "lib",
20
20
  "README.md",
21
21
  "LICENSE",
22
- "cordis.patch.yml"
22
+ "cordis.patch.yml",
23
+ "README.zh-CN.md"
23
24
  ],
24
25
  "engines": {
25
26
  "node": ">=22.13.0"