@ai_mind/dsh-a2a 1.1.2 → 1.1.4

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
@@ -322,8 +322,11 @@ A2A 前面的 Nginx/Caddy 等反代需要保留原始 `Host` 和协议头:
322
322
  proxy_set_header Host $host;
323
323
  proxy_set_header X-Forwarded-Proto $scheme;
324
324
  proxy_set_header X-Forwarded-Host $host;
325
+ proxy_set_header X-Forwarded-Port $server_port;
325
326
  ```
326
327
 
328
+ 自定义外部端口时,代理除了 `Host` 还要传 `X-Forwarded-Port`(或让 `Host` 直接包含端口),卡片才会带上正确端口。
329
+
327
330
  并设置:
328
331
 
329
332
  ```yaml
package/client.js CHANGED
@@ -96,6 +96,7 @@ window.__ModuleLoader__.load({
96
96
  fieldServerHost: '监听地址',
97
97
  fieldServerPort: '监听端口',
98
98
  fieldServerMountPath: '挂载路径',
99
+ fieldServerTrustProxy: '信任代理头(X-Forwarded-*)',
99
100
  fieldServerStreaming: '流式 SSE',
100
101
  fieldServerPushNotifications: '推送通知',
101
102
  fieldServerExtendedCard: '扩展 Agent Card',
@@ -207,6 +208,7 @@ window.__ModuleLoader__.load({
207
208
  fieldServerHost: 'Listen host',
208
209
  fieldServerPort: 'Listen port',
209
210
  fieldServerMountPath: 'Mount path',
211
+ fieldServerTrustProxy: 'Trust proxy headers (X-Forwarded-*)',
210
212
  fieldServerStreaming: 'Streaming SSE',
211
213
  fieldServerPushNotifications: 'Push notifications',
212
214
  fieldServerExtendedCard: 'Extended Agent Card',
package/lib/panel.js CHANGED
@@ -41,6 +41,7 @@ const FIELDS = [
41
41
  placeholder: '留空 = 复用 DSH 端口',
42
42
  },
43
43
  { path: 'server.mountPath', type: 'string', group: 'server' },
44
+ { path: 'server.trustProxy', type: 'boolean', group: 'server' },
44
45
  { path: 'server.streaming', type: 'boolean', group: 'server' },
45
46
  { path: 'server.pushNotifications', type: 'boolean', group: 'server' },
46
47
  { path: 'server.extendedCard', type: 'boolean', group: 'server' },
@@ -286,7 +287,7 @@ export function createPanelRouter({ ctx, config, mountPath, logger, status, heal
286
287
  res.setHeader('Cache-Control', 'no-store')
287
288
  res.json({
288
289
  ok: true,
289
- plugin: { name: PLUGIN_NAME, version: '1.1.2' },
290
+ plugin: { name: PLUGIN_NAME, version: '1.1.4' },
290
291
  mountPath,
291
292
  ...payload,
292
293
  ...(typeof status === 'function' ? { server: status() } : {}),
@@ -383,7 +384,7 @@ export function createPanelRouter({ ctx, config, mountPath, logger, status, heal
383
384
  logger.info('[a2a] configuration updated from the settings panel')
384
385
  res.json({
385
386
  ok: true,
386
- plugin: { name: PLUGIN_NAME, version: '1.1.2' },
387
+ plugin: { name: PLUGIN_NAME, version: '1.1.4' },
387
388
  mountPath,
388
389
  ...describe(live, liveEntry, []),
389
390
  ...(typeof status === 'function' ? { server: status() } : {}),
package/lib/server.js CHANGED
@@ -94,6 +94,13 @@ function baseFromHeaders(headers, config, fallbackProtocol = 'http') {
94
94
  try {
95
95
  const url = new URL(`${protocol}://${host}`)
96
96
  if (url.protocol !== 'http:' && url.protocol !== 'https:') return null
97
+ // A proxy may expose the service on a non-standard port while forwarding
98
+ // only the hostname; X-Forwarded-Port carries the client-facing port.
99
+ if (trusted && url.port === '') {
100
+ const forwardedPort = firstHeader(headers?.['x-forwarded-port'])
101
+ const port = Number(forwardedPort?.split(',')[0].trim())
102
+ if (Number.isInteger(port) && port >= 1 && port <= 65535) url.port = String(port)
103
+ }
97
104
  return trimTrailingSlash(url.origin)
98
105
  } catch {
99
106
  return null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai_mind/dsh-a2a",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Production A2A (Agent2Agent) v1.0 server for DeepSeek Harness agents: JSON-RPC + HTTP+JSON bindings, streaming, tasks, push notifications and signed Agent Cards.",
5
5
  "type": "module",
6
6
  "license": "MIT",