@ryubyte/dsh-a2a 0.1.5 → 0.2.0
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.en.md +41 -19
- package/README.md +27 -13
- package/lib/client.js +601 -443
- package/lib/index.js +185 -14
- package/lib/types/a2a-config.d.ts.map +1 -1
- package/lib/types/client/dashboard.css.d.ts +20 -0
- package/lib/types/client/dashboard.css.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +4 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/dashboard.d.ts +20 -0
- package/lib/types/dashboard.d.ts.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/server.d.ts +33 -1
- package/lib/types/server.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/a2a-config.ts +15 -2
- package/src/client/dashboard.css.ts +295 -0
- package/src/client/index.ts +669 -265
- package/src/dashboard.ts +39 -0
- package/src/index.ts +138 -17
- package/src/server.ts +67 -1
package/README.en.md
CHANGED
|
@@ -22,28 +22,40 @@ It turns a DSH instance into a full A2A peer in both directions:
|
|
|
22
22
|
|
|
23
23
|
### Connection dashboard (设置 → A2A 连接)
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
The panel is split into two tabs by **role**, and **everything is configurable in the UI — no need to hand-edit `a2a.json`**:
|
|
26
|
+
|
|
27
|
+
**"Connected agents" (this DSH as a client, outbound)**
|
|
28
|
+
|
|
29
|
+
- Lists connected remote agents (name, connection state, AgentCard URL, skill/tool counts, last activity); expand to see each skill's name/tags/description. Each agent has **Reconnect / Settings / Disable / Delete** controls (a disabled agent shows as a greyed-out placeholder card whose control becomes **Enable**).
|
|
30
|
+
- **Settings** — edit that agent's **timeout (timeoutMs)**, **skill mapping (mapSkills)**, and **Bearer token** in place; saving reconnects with the new config to apply it.
|
|
31
|
+
- **Add agent** — enter an AgentCard URL (optional Bearer token) → "Import" to preview the remote name/description/skills → "Connect". Config is written back to `a2a.json`.
|
|
32
|
+
|
|
33
|
+
**"Public service" (this DSH as an agent, inbound)**
|
|
34
|
+
|
|
35
|
+
- **Visual identity editing** — read-only view of the service name/description/version, endpoint, Agent Card URL (one-click copy) and Skills; click "Edit" to change these fields in place and **fully add/edit/remove Skills**, saving rebuilds the AgentCard immediately (no restart).
|
|
36
|
+
- **Guided setup** — on a fresh install (no `a2a.json`), this tab shows a form pre-filled with sensible defaults; tweak as needed and click "Create & go online" to publish the service — one step generates `a2a.json` and starts serving.
|
|
37
|
+
- **Online / offline** toggle; shows **who executes inbound tasks** (custom executor / this DSH's agent session / none).
|
|
38
|
+
- **Inbound auth** — set or clear the shared Bearer token that gates the endpoint (persisted to `a2a.json`, effective immediately).
|
|
26
39
|
- **Inbound peers** — who is calling this DSH (label, source address, first/last seen, task count, streaming flag), with a close control.
|
|
27
|
-
- **A2A server** — inbound server status with an online/offline toggle, endpoint and skill overview; it also shows **who executes inbound tasks** (custom executor / this DSH's agent session / none) and an **inbound auth** control to set or clear the shared Bearer token that gates the endpoint (persisted to `a2a.json`, effective immediately).
|
|
28
40
|
- The panel refreshes every 3 s; `/a2a/api` serves a JSON snapshot and control endpoints, fenced to loopback/same-origin (the token value is never returned in the snapshot — only whether one is configured).
|
|
29
41
|
|
|
30
42
|
### Runtime configuration (a2a.json)
|
|
31
43
|
|
|
32
|
-
Configuration is driven by **`a2a.json`** (per profile,
|
|
33
|
-
agents without touching the composition. The
|
|
34
|
-
profile, not the launch directory: the plugin
|
|
35
|
-
the process command line (the `dsh web` alias is
|
|
36
|
-
profile too) and reads/writes
|
|
44
|
+
Configuration is driven by **`a2a.json`** (per profile, fully manageable from the
|
|
45
|
+
UI) — manage agents and the public service without touching the composition. The
|
|
46
|
+
file is resolved from the active profile, not the launch directory: the plugin
|
|
47
|
+
parses `--profile <name>` from the process command line (the `dsh web` alias is
|
|
48
|
+
recognized as the `web` profile too) and reads/writes
|
|
49
|
+
`~/.dsh/profiles/<name>/a2a.json` — configs the UI generates on first use also
|
|
50
|
+
land in that profile directory, so they are read no matter which working
|
|
51
|
+
directory you launch from. Hand-writing `a2a.json` is still supported (below),
|
|
52
|
+
but **a new user can do everything through the UI**.
|
|
37
53
|
|
|
38
54
|
## Screenshots
|
|
39
55
|
|
|
40
|
-
|
|
|
56
|
+
| Connected agents (this DSH as a client) | Public service (this DSH as an agent) |
|
|
41
57
|
|---|---|
|
|
42
|
-
|  |  |
|
|
58
|
+
|  |  |
|
|
47
59
|
|
|
48
60
|
## Installation
|
|
49
61
|
|
|
@@ -100,9 +112,10 @@ Declare agents to connect to in the profile's `a2a.json`:
|
|
|
100
112
|
}
|
|
101
113
|
```
|
|
102
114
|
|
|
103
|
-
Alternatively, in the Web GUI go to 设置 → A2A 连接 →
|
|
104
|
-
AgentCard URL to import and connect — the config is written back
|
|
105
|
-
`a2a.json`.
|
|
115
|
+
Alternatively, in the Web GUI go to 设置 → A2A 连接 → "Connected agents" → Add
|
|
116
|
+
agent, paste an AgentCard URL to import and connect — the config is written back
|
|
117
|
+
to `a2a.json`. After connecting, the agent's "Settings" lets you adjust its
|
|
118
|
+
timeout, skill mapping, and token.
|
|
106
119
|
|
|
107
120
|
Once connected, the remote agent's skills appear as model tools:
|
|
108
121
|
`a2a__<name>__<skill>`.
|
|
@@ -113,14 +126,19 @@ different local sessions are isolated into separate conversations.
|
|
|
113
126
|
|
|
114
127
|
### 2. Expose this DSH as an A2A agent (inbound)
|
|
115
128
|
|
|
116
|
-
|
|
129
|
+
> **Recommended: use the UI.** Open 设置 → A2A 连接 → "Public service"; a fresh
|
|
130
|
+
> install shows a pre-filled form — tweak a few fields and click "Create & go
|
|
131
|
+
> online". No hand-written JSON required. The config below is the equivalent
|
|
132
|
+
> for reference or scripted deployment.
|
|
133
|
+
|
|
134
|
+
Or enable server mode manually in `a2a.json`:
|
|
117
135
|
|
|
118
136
|
```jsonc
|
|
119
137
|
{
|
|
120
138
|
"mode": "server",
|
|
121
139
|
"server": {
|
|
122
140
|
"enabled": true, // explicitly turn the inbound server on
|
|
123
|
-
// "baseUrl":
|
|
141
|
+
// "baseUrl": omit to auto-infer (see below); set only behind a proxy / public domain
|
|
124
142
|
"agentName": "My DSH Agent",
|
|
125
143
|
"agentDescription": "A DSH agent over A2A v1.0",
|
|
126
144
|
"agentVersion": "0.1.0",
|
|
@@ -131,7 +149,11 @@ Enable server mode in `a2a.json`:
|
|
|
131
149
|
}
|
|
132
150
|
```
|
|
133
151
|
|
|
134
|
-
|
|
152
|
+
When `baseUrl` is left empty (or cleared in the UI), the AgentCard auto-infers the webServer's **real listen address**, so it never advertises a stale port; set it explicitly only when this DSH sits behind a reverse proxy or public domain whose external address differs from the local listener.
|
|
153
|
+
|
|
154
|
+
> **About `mode`**: `mode` (`client` / `server` / `both`) selects which half mounts at startup, defaulting to `client`. It is **optional** — `server.enabled: true` or the presence of `agents` turns on the respective half, so an `a2a.json` generated through the UI usually **omits `mode`** and relies on those fields. Writing `mode` by hand is clearer but equivalent.
|
|
155
|
+
|
|
156
|
+
Other A2A clients discover this DSH via the auto-inferred
|
|
135
157
|
`http://<host>:<port>/.well-known/agent-card.json` and call the `/a2a` endpoint.
|
|
136
158
|
|
|
137
159
|
#### Who executes an inbound task (executor precedence)
|
package/README.md
CHANGED
|
@@ -22,24 +22,32 @@
|
|
|
22
22
|
|
|
23
23
|
### 连接面板(设置 → A2A 连接)
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
面板按**角色**分为两个 tab,**全部配置都可在 UI 里完成,无需手改 `a2a.json`**:
|
|
26
|
+
|
|
27
|
+
**「连接的 Agent」(本 DSH 作为客户端,出站)**
|
|
28
|
+
|
|
29
|
+
- 列出已连接的远程 Agent(名称、连接状态、AgentCard URL、技能/工具数、最近活动),展开可看每个 skill 的名称/标签/描述;每个 Agent 支持 **重连 / 设置 / 禁用 / 删除**(已禁用的 Agent 显示为灰化占位卡,操作按钮变为 **启用**)。
|
|
30
|
+
- **设置**:就地编辑该 Agent 的 **超时(timeoutMs)**、**技能拆分(mapSkills)**、**Bearer Token**,保存后自动以新配置重连生效。
|
|
31
|
+
- **添加 Agent**:填 AgentCard URL(可选 Bearer Token)→「导入」预览远端名称/描述/技能 →「连接」。配置写回 `a2a.json`。
|
|
32
|
+
|
|
33
|
+
**「对外服务」(本 DSH 作为 Agent 对外,入站)**
|
|
34
|
+
|
|
35
|
+
- **服务身份可视化编辑**:只读展示服务名/描述/版本、端点、Agent Card URL(一键复制)与 Skills;点「编辑」就地改这些字段并**完整增删改 Skills**,保存即时重建 AgentCard 生效(无需重启)。
|
|
36
|
+
- **引导式初始化**:全新安装(无 `a2a.json`)时,本页显示预填好合理默认值的表单,用户按需修改后点「创建并上线」即可发布服务——一步生成 `a2a.json` 并启动。
|
|
37
|
+
- **上线 / 下线** 开关;显示 **入站任务由谁执行**(自定义 executor / 本 DSH agent 会话 / 未配置)。
|
|
38
|
+
- **入站鉴权**:设置或清除保护入站端点的共享 Bearer Token(持久化到 `a2a.json`,实时生效)。
|
|
26
39
|
- **入站连接**:谁在调用本 DSH(来源、地址、首/末次连接、任务数、流式标记),支持关闭。
|
|
27
|
-
- **A2A 服务**:入站服务的运行状态,上线 / 下线开关,端点与技能一览;并显示 **入站任务由谁执行**(自定义 executor / 本 DSH agent 会话 / 未配置),以及 **入站鉴权** 开关——可设置或清除保护入站端点的共享 Bearer Token(持久化到 `a2a.json`,实时生效)。
|
|
28
40
|
- 面板每 3 秒自动刷新;`/a2a/api` 提供 JSON 快照与控制接口,受 loopback/same-origin 保护(token 值不会通过快照回传,只暴露「是否已配置」)。
|
|
29
41
|
|
|
30
42
|
### 运行时配置(a2a.json)
|
|
31
43
|
|
|
32
|
-
配置以 **`a2a.json`(按 profile
|
|
44
|
+
配置以 **`a2a.json`(按 profile 存放,可完全通过 UI 管理)为准**,无需改动组合配置即可管理 Agent 与对外服务。文件定位不依赖启动目录:插件解析进程命令行里的 `--profile <name>`(`dsh web` 别名同样识别为 `web` profile),读写 `~/.dsh/profiles/<name>/a2a.json`——UI 首次生成的配置也会写到该 profile 目录,从任意工作目录启动都能读到。手写 `a2a.json` 仍然支持(见下文),但**新用户完全靠 UI 即可完成配置与上线**。
|
|
33
45
|
|
|
34
46
|
## 截图
|
|
35
47
|
|
|
36
|
-
|
|
|
48
|
+
| 连接的 Agent(本 DSH 作为客户端) | 对外服务(本 DSH 作为 Agent) |
|
|
37
49
|
|---|---|
|
|
38
|
-
|  |  |
|
|
50
|
+
|  |  |
|
|
43
51
|
|
|
44
52
|
## 安装
|
|
45
53
|
|
|
@@ -93,7 +101,7 @@
|
|
|
93
101
|
}
|
|
94
102
|
```
|
|
95
103
|
|
|
96
|
-
也可以在 Web GUI「设置 → A2A 连接
|
|
104
|
+
也可以在 Web GUI「设置 → A2A 连接 →『连接的 Agent』→ 添加 Agent」里输入 AgentCard URL 导入并连接,配置会写回 `a2a.json`;连接后点该 Agent 的「设置」还能调整超时、技能拆分与 Token。
|
|
97
105
|
|
|
98
106
|
连接成功后,对方 Agent 的 skills 会作为模型工具出现:`a2a__<name>__<skill>`。
|
|
99
107
|
|
|
@@ -101,14 +109,16 @@
|
|
|
101
109
|
|
|
102
110
|
### 2. 对外提供 A2A 服务(入站)
|
|
103
111
|
|
|
104
|
-
|
|
112
|
+
> **推荐:直接用 UI。** 打开「设置 → A2A 连接 →『对外服务』」,全新安装会显示预填好的表单,改几个字段后点「创建并上线」即可——无需手写下面的 JSON。以下为等价的手写配置,供了解字段或脚本化部署时参考。
|
|
113
|
+
|
|
114
|
+
也可以在 `a2a.json` 里手动开启 server 模式:
|
|
105
115
|
|
|
106
116
|
```jsonc
|
|
107
117
|
{
|
|
108
118
|
"mode": "server",
|
|
109
119
|
"server": {
|
|
110
120
|
"enabled": true, // 显式开启入站服务
|
|
111
|
-
// "baseUrl":
|
|
121
|
+
// "baseUrl": 省略即自动推导(见下),仅反向代理/公网域名时才需显式设置
|
|
112
122
|
"agentName": "My DSH Agent",
|
|
113
123
|
"agentDescription": "A DSH agent over A2A v1.0",
|
|
114
124
|
"agentVersion": "0.1.0",
|
|
@@ -119,7 +129,11 @@
|
|
|
119
129
|
}
|
|
120
130
|
```
|
|
121
131
|
|
|
122
|
-
|
|
132
|
+
`baseUrl` 留空(或在 UI 里清空)时,AgentCard 会按 webServer 的**真实监听地址**自动推导,不会公布过期端口;仅当本 DSH 位于反向代理或公网域名之后、对外地址与本地监听不同时,才需要显式填写。
|
|
133
|
+
|
|
134
|
+
> **关于 `mode`**:`mode`(`client` / `server` / `both`)控制启动时挂载哪一半,缺省为 `client`。它是**可选**的——`server.enabled: true` 或存在 `agents` 就会分别启用对应半区,所以通过 UI 生成的 `a2a.json` 通常**不写 `mode`**,仅靠这些字段隐式推导行为。手写时显式写 `mode` 更直观,二者等价。
|
|
135
|
+
|
|
136
|
+
之后其他 A2A 客户端通过自动推导出的 `http://<host>:<port>/.well-known/agent-card.json` 发现本 DSH,通过 `/a2a` 端点调用。
|
|
123
137
|
|
|
124
138
|
#### 入站任务由谁执行(executor 优先级)
|
|
125
139
|
|