openclaw-openagent 1.0.1 → 1.0.3

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.
Files changed (188) hide show
  1. package/dist/index.d.ts +25 -0
  2. package/dist/index.js +105 -0
  3. package/dist/src/app/channel-tools.d.ts +28 -0
  4. package/dist/src/app/channel-tools.js +251 -0
  5. package/dist/src/app/discovery-tools.d.ts +35 -0
  6. package/dist/src/app/discovery-tools.js +243 -0
  7. package/dist/src/app/download-file-tool.d.ts +10 -0
  8. package/dist/src/app/download-file-tool.js +104 -0
  9. package/dist/src/app/hooks.d.ts +14 -0
  10. package/dist/src/app/hooks.js +118 -0
  11. package/dist/src/app/index.d.ts +13 -0
  12. package/dist/src/app/index.js +44 -0
  13. package/dist/src/app/messaging-tools.d.ts +11 -0
  14. package/dist/src/app/messaging-tools.js +79 -0
  15. package/dist/src/app/ops-tools.d.ts +21 -0
  16. package/dist/src/app/ops-tools.js +158 -0
  17. package/dist/src/app/remote-agent-tool.d.ts +27 -0
  18. package/dist/src/app/remote-agent-tool.js +461 -0
  19. package/dist/src/app/types.d.ts +61 -0
  20. package/dist/src/app/types.js +11 -0
  21. package/dist/src/app/upload-file-tool.d.ts +16 -0
  22. package/dist/src/app/upload-file-tool.js +353 -0
  23. package/dist/src/app/verbose-preflight.d.ts +2 -0
  24. package/dist/src/app/verbose-preflight.js +145 -0
  25. package/dist/src/auth/config.d.ts +79 -0
  26. package/dist/src/auth/config.js +133 -0
  27. package/dist/src/auth/credential-manager.d.ts +65 -0
  28. package/dist/src/auth/credential-manager.js +122 -0
  29. package/dist/src/auth/index.d.ts +6 -0
  30. package/dist/src/auth/index.js +6 -0
  31. package/dist/src/auth/verify.d.ts +42 -0
  32. package/dist/src/auth/verify.js +60 -0
  33. package/dist/src/channel.d.ts +269 -0
  34. package/dist/src/channel.js +488 -0
  35. package/dist/src/compat.d.ts +37 -0
  36. package/dist/src/compat.js +70 -0
  37. package/dist/src/config/config-schema.d.ts +56 -0
  38. package/dist/src/config/config-schema.js +34 -0
  39. package/dist/src/messaging/aggregator.d.ts +25 -0
  40. package/dist/src/messaging/aggregator.js +90 -0
  41. package/dist/src/messaging/collector.d.ts +27 -0
  42. package/dist/src/messaging/collector.js +76 -0
  43. package/dist/src/messaging/executor.d.ts +14 -0
  44. package/dist/src/messaging/executor.js +59 -0
  45. package/dist/src/messaging/inbound.d.ts +97 -0
  46. package/dist/src/messaging/inbound.js +63 -0
  47. package/dist/src/messaging/index.d.ts +10 -0
  48. package/dist/src/messaging/index.js +9 -0
  49. package/dist/src/messaging/mention-protocol.d.ts +42 -0
  50. package/dist/src/messaging/mention-protocol.js +74 -0
  51. package/dist/src/messaging/process-c2c-request.d.ts +55 -0
  52. package/dist/src/messaging/process-c2c-request.js +445 -0
  53. package/dist/src/messaging/process-message.d.ts +62 -0
  54. package/dist/src/messaging/process-message.js +282 -0
  55. package/dist/src/messaging/scheduler.d.ts +17 -0
  56. package/dist/src/messaging/scheduler.js +47 -0
  57. package/dist/src/messaging/types.d.ts +34 -0
  58. package/dist/src/messaging/types.js +4 -0
  59. package/dist/src/plugin-ui/assets/openagent-override.js +9278 -0
  60. package/dist/src/plugin-ui/index.d.ts +13 -0
  61. package/dist/src/plugin-ui/index.js +16 -0
  62. package/dist/src/plugin-ui/ui-extension-loader/backup.d.ts +23 -0
  63. package/dist/src/plugin-ui/ui-extension-loader/backup.js +82 -0
  64. package/dist/src/plugin-ui/ui-extension-loader/index.d.ts +28 -0
  65. package/dist/src/plugin-ui/ui-extension-loader/index.js +240 -0
  66. package/dist/src/plugin-ui/ui-extension-loader/locator.d.ts +35 -0
  67. package/dist/src/plugin-ui/ui-extension-loader/locator.js +129 -0
  68. package/dist/src/plugin-ui/ui-extension-loader/manifest.d.ts +26 -0
  69. package/dist/src/plugin-ui/ui-extension-loader/manifest.js +45 -0
  70. package/dist/src/plugin-ui/ui-extension-loader/registry-regex.d.ts +9 -0
  71. package/dist/src/plugin-ui/ui-extension-loader/registry-regex.js +724 -0
  72. package/dist/src/plugin-ui/ui-extension-loader/removed-extensions.d.ts +8 -0
  73. package/dist/src/plugin-ui/ui-extension-loader/removed-extensions.js +58 -0
  74. package/dist/src/plugin-ui/ui-extension-loader/types.d.ts +55 -0
  75. package/dist/src/plugin-ui/ui-extension-loader/types.js +23 -0
  76. package/dist/src/proxy/auth-proxy.d.ts +20 -0
  77. package/dist/src/proxy/auth-proxy.js +337 -0
  78. package/dist/src/runtime/account.d.ts +156 -0
  79. package/dist/src/runtime/account.js +491 -0
  80. package/dist/src/runtime/index.d.ts +5 -0
  81. package/dist/src/runtime/index.js +6 -0
  82. package/dist/src/runtime/plugin-runtime.d.ts +40 -0
  83. package/dist/src/runtime/plugin-runtime.js +72 -0
  84. package/dist/src/runtime/registry.d.ts +41 -0
  85. package/dist/src/runtime/registry.js +60 -0
  86. package/dist/src/sdk/CLASS_MAP.md +143 -0
  87. package/dist/src/sdk/index.d.ts +126 -0
  88. package/dist/src/sdk/index.js +23990 -0
  89. package/dist/src/sdk/modules/cloud-search-module.js +1117 -0
  90. package/dist/src/sdk/modules/follow-module.js +1069 -0
  91. package/dist/src/sdk/modules/group-module.js +7397 -0
  92. package/dist/src/sdk/modules/relationship-module.js +2269 -0
  93. package/dist/src/sdk/modules/signaling-module.js +1468 -0
  94. package/dist/src/sdk/modules/tim-upload-plugin.js +730 -0
  95. package/dist/src/sdk/node-env/http-request.js +90 -0
  96. package/dist/src/sdk/node-env/index.js +57 -0
  97. package/dist/src/sdk/node-env/storage.js +114 -0
  98. package/dist/src/sdk/package.json +10 -0
  99. package/dist/src/sdk/sdk/CLASS_MAP.md +143 -0
  100. package/dist/src/sdk/sdk/index.d.ts +126 -0
  101. package/dist/src/sdk/sdk/index.js +23990 -0
  102. package/dist/src/sdk/sdk/modules/cloud-search-module.js +1117 -0
  103. package/dist/src/sdk/sdk/modules/follow-module.js +1069 -0
  104. package/dist/src/sdk/sdk/modules/group-module.js +7397 -0
  105. package/dist/src/sdk/sdk/modules/relationship-module.js +2269 -0
  106. package/dist/src/sdk/sdk/modules/signaling-module.js +1468 -0
  107. package/dist/src/sdk/sdk/modules/tim-upload-plugin.js +730 -0
  108. package/dist/src/sdk/sdk/node-env/http-request.js +90 -0
  109. package/dist/src/sdk/sdk/node-env/index.js +57 -0
  110. package/dist/src/sdk/sdk/node-env/storage.js +114 -0
  111. package/dist/src/sdk/sdk/package.json +10 -0
  112. package/dist/src/sdk/sdk/tsconfig.json +16 -0
  113. package/dist/src/sdk/tsconfig.json +16 -0
  114. package/dist/src/state/pending-invocation-store.d.ts +26 -0
  115. package/dist/src/state/pending-invocation-store.js +39 -0
  116. package/dist/src/state/store.d.ts +165 -0
  117. package/dist/src/state/store.js +535 -0
  118. package/dist/src/tim/c2c.d.ts +83 -0
  119. package/dist/src/tim/c2c.js +318 -0
  120. package/dist/src/tim/channels.d.ts +95 -0
  121. package/dist/src/tim/channels.js +279 -0
  122. package/dist/src/tim/client.d.ts +54 -0
  123. package/dist/src/tim/client.js +268 -0
  124. package/dist/src/tim/index.d.ts +6 -0
  125. package/dist/src/tim/index.js +6 -0
  126. package/dist/src/tim/messages.d.ts +50 -0
  127. package/dist/src/tim/messages.js +104 -0
  128. package/dist/src/tim/sdk-logger-init.d.ts +13 -0
  129. package/dist/src/tim/sdk-logger-init.js +46 -0
  130. package/dist/src/tools.d.ts +9 -0
  131. package/dist/src/tools.js +8 -0
  132. package/dist/src/transport/factory.d.ts +63 -0
  133. package/dist/src/transport/factory.js +54 -0
  134. package/dist/src/transport/oasn/index.d.ts +12 -0
  135. package/dist/src/transport/oasn/index.js +9 -0
  136. package/dist/src/transport/oasn/oasn-agent-card.d.ts +38 -0
  137. package/dist/src/transport/oasn/oasn-agent-card.js +102 -0
  138. package/dist/src/transport/oasn/oasn-discovery.d.ts +33 -0
  139. package/dist/src/transport/oasn/oasn-discovery.js +97 -0
  140. package/dist/src/transport/oasn/oasn-files.d.ts +64 -0
  141. package/dist/src/transport/oasn/oasn-files.js +174 -0
  142. package/dist/src/transport/oasn/oasn-http.d.ts +98 -0
  143. package/dist/src/transport/oasn/oasn-http.js +362 -0
  144. package/dist/src/transport/oasn/oasn-invocation.d.ts +154 -0
  145. package/dist/src/transport/oasn/oasn-invocation.js +432 -0
  146. package/dist/src/transport/oasn/oasn-normalize.d.ts +6 -0
  147. package/dist/src/transport/oasn/oasn-normalize.js +112 -0
  148. package/dist/src/transport/oasn/oasn-register.d.ts +19 -0
  149. package/dist/src/transport/oasn/oasn-register.js +24 -0
  150. package/dist/src/transport/oasn/oasn-transport.d.ts +114 -0
  151. package/dist/src/transport/oasn/oasn-transport.js +230 -0
  152. package/dist/src/transport/oasn/oasn-types.d.ts +331 -0
  153. package/dist/src/transport/oasn/oasn-types.js +44 -0
  154. package/dist/src/transport/tim/index.d.ts +7 -0
  155. package/dist/src/transport/tim/index.js +6 -0
  156. package/dist/src/transport/tim/tim-transport.d.ts +122 -0
  157. package/dist/src/transport/tim/tim-transport.js +402 -0
  158. package/dist/src/transport/types.d.ts +450 -0
  159. package/dist/src/transport/types.js +38 -0
  160. package/dist/src/util/http.d.ts +21 -0
  161. package/dist/src/util/http.js +93 -0
  162. package/dist/src/util/logger.d.ts +20 -0
  163. package/dist/src/util/logger.js +100 -0
  164. package/dist/src/util/url-resolver.d.ts +7 -0
  165. package/dist/src/util/url-resolver.js +20 -0
  166. package/index.ts +11 -0
  167. package/openclaw.plugin.json +9 -0
  168. package/package.json +7 -4
  169. package/src/app/download-file-tool.ts +133 -0
  170. package/src/app/hooks.ts +89 -5
  171. package/src/app/index.ts +6 -0
  172. package/src/app/remote-agent-tool.ts +46 -0
  173. package/src/app/types.ts +1 -0
  174. package/src/app/upload-file-tool.ts +411 -0
  175. package/src/plugin-ui/assets/openagent-override.js +15 -66
  176. package/src/plugin-ui/modules/agent-book/panel/agent-book.js +0 -61
  177. package/src/plugin-ui/modules/agent-book/panel/agent-data.js +0 -1
  178. package/src/plugin-ui/modules/agent-book/panel/inject-ui.js +14 -3
  179. package/src/plugin-ui/ui-extension-loader/registry-regex.ts +102 -63
  180. package/src/runtime/account.ts +0 -23
  181. package/src/transport/oasn/oasn-files.ts +5 -5
  182. package/src/transport/oasn/oasn-invocation.ts +44 -2
  183. package/src/transport/oasn/oasn-normalize.ts +0 -26
  184. package/src/transport/oasn/oasn-register.ts +8 -81
  185. package/src/transport/oasn/oasn-transport.ts +9 -32
  186. package/src/transport/oasn/oasn-types.ts +53 -6
  187. package/src/transport/types.ts +33 -36
  188. package/src/util/url-resolver.ts +17 -0
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * 子模块组装:
9
9
  * - OasnHttpClient HTTP 基础(Bearer 注入 / 重试 / 401 拦截)
10
- * - OasnRegister register / claim
10
+ * - OasnAgentStatus agent status query (GET /api/agents/{agent_id})
11
11
  * - OasnAgentCard get / update / getCurrentOwner
12
12
  * - OasnDiscovery search / categories
13
13
  * - OasnInvocation sendTask / waitForTaskResult(核心路径)
@@ -37,14 +37,11 @@ import {
37
37
  type AgentCardPatch,
38
38
  type AgentStatusResult,
39
39
  type CategoryTree,
40
- type ClaimParams,
41
- type ClaimResult,
42
40
  type CoreTransportEvent,
43
41
  type DownloadArtifactResult,
44
42
  type OasnTransport,
45
43
  type OwnerInfo,
46
44
  type ProgressCallback,
47
- type RegisterResult,
48
45
  type SearchQuery,
49
46
  type SearchResult,
50
47
  type TaskHandle,
@@ -64,7 +61,7 @@ import {
64
61
  type CreateInvocationOptions,
65
62
  type PendingInvocationStore,
66
63
  } from './oasn-invocation.js';
67
- import { OasnRegister } from './oasn-register.js';
64
+ import { OasnAgentStatus } from './oasn-register.js';
68
65
 
69
66
  // ───────────────────────────────────────────────────────────────
70
67
  // 构造选项
@@ -102,7 +99,7 @@ export class OasnTransportImpl extends EventEmitter implements OasnTransport {
102
99
  private _accessHttp: OasnHttpClient;
103
100
  private _agentCard: OasnAgentCard;
104
101
  private _discovery: OasnDiscovery;
105
- private _register: OasnRegister;
102
+ private _agentStatus: OasnAgentStatus;
106
103
  private _invocation: OasnInvocation;
107
104
  private _files: OasnFiles;
108
105
 
@@ -131,7 +128,7 @@ export class OasnTransportImpl extends EventEmitter implements OasnTransport {
131
128
  // ── 子模块(共享 HTTP 实例) ──────────────────────────────────
132
129
  this._agentCard = new OasnAgentCard(this._http);
133
130
  this._discovery = new OasnDiscovery(this._http);
134
- this._register = new OasnRegister(this._http);
131
+ this._agentStatus = new OasnAgentStatus(this._http);
135
132
  this._invocation = new OasnInvocation(this._accessHttp, options.pendingStore);
136
133
  this._files = new OasnFiles(this._accessHttp);
137
134
  }
@@ -165,7 +162,7 @@ export class OasnTransportImpl extends EventEmitter implements OasnTransport {
165
162
 
166
163
  if (this._agentId) {
167
164
  try {
168
- const status = await this._register.getStatus(this._agentId);
165
+ const status = await this._agentStatus.getStatus(this._agentId);
169
166
  this._claimStatus = status.status;
170
167
  logger.info(
171
168
  `[transport/oasn] ready agent_id=${this._agentId} `
@@ -264,33 +261,13 @@ export class OasnTransportImpl extends EventEmitter implements OasnTransport {
264
261
  }
265
262
 
266
263
  // ═══════════════════════════════════════════════════════════════
267
- // RegistrationTransport(OASN-only)
264
+ // AgentCard / Status(OASN-only)
268
265
  // ═══════════════════════════════════════════════════════════════
269
-
270
- /**
271
- * 注册新 Agent。
272
- *
273
- * 注意:register 不要求 ready() —— 首次安装时还没有 api_key。
274
- * 但 register 成功后,调用方需立即把 api_key 持久化 + 调 ready() 进入可工作状态。
275
- */
276
- async registerAgent(
277
- platform: string,
278
- params?: { installId?: string; deviceHint?: string },
279
- ): Promise<RegisterResult> {
280
- const result = await this._register.register(platform, params);
281
- // 回填 agentId(后续 ready() 探活会用到)
282
- this._agentId = result.agent_id;
283
- return result;
284
- }
285
-
286
- async claimAgent(params: ClaimParams): Promise<ClaimResult> {
287
- const result = await this._register.claim(params);
288
- this._claimStatus = 'claim_pending';
289
- return result;
290
- }
266
+ //
267
+ // registerAgent / claimAgent 已迁移到 CLI,此处仅保留状态查询。
291
268
 
292
269
  async getAgentStatus(agentId: string): Promise<AgentStatusResult> {
293
- const result = await this._register.getStatus(agentId);
270
+ const result = await this._agentStatus.getStatus(agentId);
294
271
  this._claimStatus = result.status;
295
272
  return result;
296
273
  }
@@ -258,6 +258,40 @@ export interface ArtifactResponse {
258
258
  content_url?: string;
259
259
  }
260
260
 
261
+ /**
262
+ * OASN WebUI continuation —— 标准 run 完成后,声明了 webui 能力的 ServiceAgent
263
+ * 会在用户视图里暴露一个可继续打开 WebUI 的入口。
264
+ *
265
+ * 后端同时兼容 camelCase / snake_case,插件两侧都需要做 fallback 归一。
266
+ * launch_url 通常是相对路径(如 /webui/continuations/{continuation_id}),
267
+ * 由上层按 OASN Access base URL 解析为绝对地址。
268
+ */
269
+ export interface WebuiContinuationResponse {
270
+ continuationId?: string;
271
+ continuation_id?: string;
272
+ type?: string;
273
+ displayName?: string;
274
+ display_name?: string;
275
+ visibleState?: string;
276
+ visible_state?: string;
277
+ sessionId?: string;
278
+ session_id?: string;
279
+ launchUrl?: string;
280
+ launch_url?: string;
281
+ }
282
+
283
+ /**
284
+ * 用户视图结果 —— 后端在 sanitizeInvocationView() 后追加的结构。
285
+ * 除已声明字段外,保留 index signature 以容纳后续新增字段。
286
+ */
287
+ export interface VisibleResultResponse {
288
+ inlineResultSummary?: string;
289
+ inline_result_summary?: string;
290
+ webuiContinuation?: WebuiContinuationResponse;
291
+ webui_continuation?: WebuiContinuationResponse;
292
+ [key: string]: unknown;
293
+ }
294
+
261
295
  export interface GetInvocationResponse {
262
296
  invocationId?: string;
263
297
  invocation_id?: string;
@@ -273,6 +307,10 @@ export interface GetInvocationResponse {
273
307
  summary: string;
274
308
  [key: string]: unknown;
275
309
  };
310
+ /** 用户视图 —— 含 inline_result_summary 与 webui_continuation(camelCase) */
311
+ visibleResult?: VisibleResultResponse;
312
+ /** 用户视图 —— 含 inline_result_summary 与 webui_continuation(snake_case) */
313
+ visible_result?: VisibleResultResponse;
276
314
  artifacts?: ArtifactResponse[];
277
315
  /** 终态时为 null */
278
316
  nextPollAfterMs?: number | null;
@@ -291,13 +329,22 @@ export interface GetInvocationResponse {
291
329
  // ═══════════════════════════════════════════════════════════════
292
330
 
293
331
  export interface UploadFileResponse {
294
- file_ref: string;
295
- display_name: string;
296
- mime_type: string;
297
- size_bytes: number;
332
+ // snake_case (旧,向后兼容)
333
+ file_ref?: string;
334
+ display_name?: string;
335
+ mime_type?: string;
336
+ size_bytes?: number;
298
337
  /** ISO 8601 字符串 */
299
- expires_at: string;
300
- created_at: string;
338
+ expires_at?: string;
339
+ created_at?: string;
340
+ // camelCase (access 层实际返回,见 access-upload-download-api.md §2.2)
341
+ fileRef?: string;
342
+ displayName?: string;
343
+ mimeType?: string;
344
+ sizeBytes?: number;
345
+ /** ISO 8601 字符串 */
346
+ expiresAt?: string | null;
347
+ createdAt?: string;
301
348
  }
302
349
 
303
350
  // Artifact 下载返回二进制,没有 JSON 结构 —— 详见 oasn-files.ts
@@ -105,18 +105,45 @@ export interface ArtifactRef {
105
105
  contentUrl: string;
106
106
  }
107
107
 
108
+ /**
109
+ * WebUI continuation 引用 —— 远程 ServiceAgent 在标准 run 完成后暴露的 WebUI 入口。
110
+ *
111
+ * 不是 Artifact(不是可下载的二进制产物),也不是文件;只是一段可被用户点击打开
112
+ * 继续与 WebUI 交互的入口。launchUrl 可能是相对路径,由上层按 access base URL 解析。
113
+ *
114
+ * 仅 OASN 路径会填充此结构;TIM 路径不会出现。
115
+ */
116
+ export interface WebuiContinuationRef {
117
+ /** continuation_id(如 wcont_xxx) */
118
+ id: string;
119
+ /** 按钮/链接展示文案(后端默认 "Open WebUI") */
120
+ displayName: string;
121
+ /** 可见状态(available / pending / expired ...) */
122
+ visibleState: string;
123
+ /**
124
+ * WebUI shell 入口地址。
125
+ * - 通常是相对路径:/webui/continuations/{continuation_id}
126
+ * - 需要 Owner 登录态,直接打开无 token 会得到 WEBUI_AUTH_REQUIRED
127
+ */
128
+ launchUrl: string;
129
+ /** 关联 session(可用于续传) */
130
+ sessionId?: string;
131
+ }
132
+
108
133
  /** 任务结果 */
109
134
  export interface TaskResult {
110
135
  requestId: string;
111
136
  status: 'complete' | 'error';
112
137
  /**
113
138
  * 文本结果。
114
- * - OASN: inline_result.summary
139
+ * - OASN: inline_result.summary(fallback: visible_result.inline_result_summary)
115
140
  * - TIM: C2C `openagent_task_result.content`
116
141
  */
117
142
  content: string;
118
143
  /** 产物列表。可能为空 */
119
144
  artifacts?: ArtifactRef[];
145
+ /** WebUI 继续入口。仅 OASN 路径在声明了 webui 能力的 ServiceAgent 完成后返回 */
146
+ webuiContinuation?: WebuiContinuationRef;
120
147
  }
121
148
 
122
149
  /**
@@ -227,35 +254,11 @@ export interface SearchResult {
227
254
  }
228
255
 
229
256
  // ═══════════════════════════════════════════════════════════════
230
- // 注册 / 认领 / Owner(OASN-only)
257
+ // Agent 状态 / Owner(OASN-only)
231
258
  // ═══════════════════════════════════════════════════════════════
232
-
233
- /** `POST /api/agents/register` 响应 */
234
- export interface RegisterResult {
235
- agent_id: string;
236
- agent_type: 'client';
237
- /** 一次性明文 api_key —— 持久化后必须立即从内存清理 */
238
- api_key: string;
239
- claim_url: string;
240
- status: 'unclaimed';
241
- agent_card: AgentCard;
242
- }
243
-
244
- /** `POST /api/agents/claim` 请求 */
245
- export interface ClaimParams {
246
- agent_id?: string;
247
- /** 来自 claim_url 末段(与 agent_id+api_key 二选一) */
248
- claim_token?: string;
249
- owner_email: string;
250
- }
251
-
252
- export interface ClaimResult {
253
- agent_id: string;
254
- status: 'claim_email_sent';
255
- owner_email_masked: string;
256
- /** 邮件验证链接过期时间(ISO 8601 字符串) */
257
- expires_at: string;
258
- }
259
+ //
260
+ // register / claim 已迁移到 CLI,插件侧仅保留状态查询。RegisterResult、
261
+ // ClaimParams、ClaimResult 类型已移除。
259
262
 
260
263
  /** `GET /api/agents/{agent_id}` 响应 */
261
264
  export interface AgentStatusResult {
@@ -449,14 +452,8 @@ export interface DiscoveryTransport {
449
452
  getCategories?(params?: { agentType?: string }): Promise<CategoryTree>;
450
453
  }
451
454
 
452
- /** Agent 注册与管理 —— OASN-only */
455
+ /** Agent 状态与管理 —— OASN-only。register/claim 已迁移到 CLI */
453
456
  export interface RegistrationTransport {
454
- /** `POST /api/agents/register`。install_id 由 §11.7 防孤儿机制提供 */
455
- registerAgent(
456
- platform: string,
457
- params?: { installId?: string; deviceHint?: string },
458
- ): Promise<RegisterResult>;
459
- claimAgent(params: ClaimParams): Promise<ClaimResult>;
460
457
  getAgentStatus(agentId: string): Promise<AgentStatusResult>;
461
458
  updateAgentCard(agentId: string, patch: AgentCardPatch): Promise<AgentCard>;
462
459
  getCurrentOwner?(): Promise<OwnerInfo | null>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Shared URL resolution helper.
3
+ *
4
+ * Resolves a possibly-relative URL against an optional base URL.
5
+ * Used by remote-agent-tool (WebUI continuation) and download-file-tool (artifact download).
6
+ */
7
+
8
+ export function resolveOasnAccessUrl(accessApiBase: string | undefined, url: string): string {
9
+ if (!url) return url;
10
+ if (/^https?:\/\//i.test(url)) return url;
11
+ if (!accessApiBase) return url;
12
+ try {
13
+ return new URL(url, accessApiBase).toString();
14
+ } catch {
15
+ return url;
16
+ }
17
+ }