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.
- package/dist/index.d.ts +25 -0
- package/dist/index.js +105 -0
- package/dist/src/app/channel-tools.d.ts +28 -0
- package/dist/src/app/channel-tools.js +251 -0
- package/dist/src/app/discovery-tools.d.ts +35 -0
- package/dist/src/app/discovery-tools.js +243 -0
- package/dist/src/app/download-file-tool.d.ts +10 -0
- package/dist/src/app/download-file-tool.js +104 -0
- package/dist/src/app/hooks.d.ts +14 -0
- package/dist/src/app/hooks.js +118 -0
- package/dist/src/app/index.d.ts +13 -0
- package/dist/src/app/index.js +44 -0
- package/dist/src/app/messaging-tools.d.ts +11 -0
- package/dist/src/app/messaging-tools.js +79 -0
- package/dist/src/app/ops-tools.d.ts +21 -0
- package/dist/src/app/ops-tools.js +158 -0
- package/dist/src/app/remote-agent-tool.d.ts +27 -0
- package/dist/src/app/remote-agent-tool.js +461 -0
- package/dist/src/app/types.d.ts +61 -0
- package/dist/src/app/types.js +11 -0
- package/dist/src/app/upload-file-tool.d.ts +16 -0
- package/dist/src/app/upload-file-tool.js +353 -0
- package/dist/src/app/verbose-preflight.d.ts +2 -0
- package/dist/src/app/verbose-preflight.js +145 -0
- package/dist/src/auth/config.d.ts +79 -0
- package/dist/src/auth/config.js +133 -0
- package/dist/src/auth/credential-manager.d.ts +65 -0
- package/dist/src/auth/credential-manager.js +122 -0
- package/dist/src/auth/index.d.ts +6 -0
- package/dist/src/auth/index.js +6 -0
- package/dist/src/auth/verify.d.ts +42 -0
- package/dist/src/auth/verify.js +60 -0
- package/dist/src/channel.d.ts +269 -0
- package/dist/src/channel.js +488 -0
- package/dist/src/compat.d.ts +37 -0
- package/dist/src/compat.js +70 -0
- package/dist/src/config/config-schema.d.ts +56 -0
- package/dist/src/config/config-schema.js +34 -0
- package/dist/src/messaging/aggregator.d.ts +25 -0
- package/dist/src/messaging/aggregator.js +90 -0
- package/dist/src/messaging/collector.d.ts +27 -0
- package/dist/src/messaging/collector.js +76 -0
- package/dist/src/messaging/executor.d.ts +14 -0
- package/dist/src/messaging/executor.js +59 -0
- package/dist/src/messaging/inbound.d.ts +97 -0
- package/dist/src/messaging/inbound.js +63 -0
- package/dist/src/messaging/index.d.ts +10 -0
- package/dist/src/messaging/index.js +9 -0
- package/dist/src/messaging/mention-protocol.d.ts +42 -0
- package/dist/src/messaging/mention-protocol.js +74 -0
- package/dist/src/messaging/process-c2c-request.d.ts +55 -0
- package/dist/src/messaging/process-c2c-request.js +445 -0
- package/dist/src/messaging/process-message.d.ts +62 -0
- package/dist/src/messaging/process-message.js +282 -0
- package/dist/src/messaging/scheduler.d.ts +17 -0
- package/dist/src/messaging/scheduler.js +47 -0
- package/dist/src/messaging/types.d.ts +34 -0
- package/dist/src/messaging/types.js +4 -0
- package/dist/src/plugin-ui/assets/openagent-override.js +9278 -0
- package/dist/src/plugin-ui/index.d.ts +13 -0
- package/dist/src/plugin-ui/index.js +16 -0
- package/dist/src/plugin-ui/ui-extension-loader/backup.d.ts +23 -0
- package/dist/src/plugin-ui/ui-extension-loader/backup.js +82 -0
- package/dist/src/plugin-ui/ui-extension-loader/index.d.ts +28 -0
- package/dist/src/plugin-ui/ui-extension-loader/index.js +240 -0
- package/dist/src/plugin-ui/ui-extension-loader/locator.d.ts +35 -0
- package/dist/src/plugin-ui/ui-extension-loader/locator.js +129 -0
- package/dist/src/plugin-ui/ui-extension-loader/manifest.d.ts +26 -0
- package/dist/src/plugin-ui/ui-extension-loader/manifest.js +45 -0
- package/dist/src/plugin-ui/ui-extension-loader/registry-regex.d.ts +9 -0
- package/dist/src/plugin-ui/ui-extension-loader/registry-regex.js +724 -0
- package/dist/src/plugin-ui/ui-extension-loader/removed-extensions.d.ts +8 -0
- package/dist/src/plugin-ui/ui-extension-loader/removed-extensions.js +58 -0
- package/dist/src/plugin-ui/ui-extension-loader/types.d.ts +55 -0
- package/dist/src/plugin-ui/ui-extension-loader/types.js +23 -0
- package/dist/src/proxy/auth-proxy.d.ts +20 -0
- package/dist/src/proxy/auth-proxy.js +337 -0
- package/dist/src/runtime/account.d.ts +156 -0
- package/dist/src/runtime/account.js +491 -0
- package/dist/src/runtime/index.d.ts +5 -0
- package/dist/src/runtime/index.js +6 -0
- package/dist/src/runtime/plugin-runtime.d.ts +40 -0
- package/dist/src/runtime/plugin-runtime.js +72 -0
- package/dist/src/runtime/registry.d.ts +41 -0
- package/dist/src/runtime/registry.js +60 -0
- package/dist/src/sdk/CLASS_MAP.md +143 -0
- package/dist/src/sdk/index.d.ts +126 -0
- package/dist/src/sdk/index.js +23990 -0
- package/dist/src/sdk/modules/cloud-search-module.js +1117 -0
- package/dist/src/sdk/modules/follow-module.js +1069 -0
- package/dist/src/sdk/modules/group-module.js +7397 -0
- package/dist/src/sdk/modules/relationship-module.js +2269 -0
- package/dist/src/sdk/modules/signaling-module.js +1468 -0
- package/dist/src/sdk/modules/tim-upload-plugin.js +730 -0
- package/dist/src/sdk/node-env/http-request.js +90 -0
- package/dist/src/sdk/node-env/index.js +57 -0
- package/dist/src/sdk/node-env/storage.js +114 -0
- package/dist/src/sdk/package.json +10 -0
- package/dist/src/sdk/sdk/CLASS_MAP.md +143 -0
- package/dist/src/sdk/sdk/index.d.ts +126 -0
- package/dist/src/sdk/sdk/index.js +23990 -0
- package/dist/src/sdk/sdk/modules/cloud-search-module.js +1117 -0
- package/dist/src/sdk/sdk/modules/follow-module.js +1069 -0
- package/dist/src/sdk/sdk/modules/group-module.js +7397 -0
- package/dist/src/sdk/sdk/modules/relationship-module.js +2269 -0
- package/dist/src/sdk/sdk/modules/signaling-module.js +1468 -0
- package/dist/src/sdk/sdk/modules/tim-upload-plugin.js +730 -0
- package/dist/src/sdk/sdk/node-env/http-request.js +90 -0
- package/dist/src/sdk/sdk/node-env/index.js +57 -0
- package/dist/src/sdk/sdk/node-env/storage.js +114 -0
- package/dist/src/sdk/sdk/package.json +10 -0
- package/dist/src/sdk/sdk/tsconfig.json +16 -0
- package/dist/src/sdk/tsconfig.json +16 -0
- package/dist/src/state/pending-invocation-store.d.ts +26 -0
- package/dist/src/state/pending-invocation-store.js +39 -0
- package/dist/src/state/store.d.ts +165 -0
- package/dist/src/state/store.js +535 -0
- package/dist/src/tim/c2c.d.ts +83 -0
- package/dist/src/tim/c2c.js +318 -0
- package/dist/src/tim/channels.d.ts +95 -0
- package/dist/src/tim/channels.js +279 -0
- package/dist/src/tim/client.d.ts +54 -0
- package/dist/src/tim/client.js +268 -0
- package/dist/src/tim/index.d.ts +6 -0
- package/dist/src/tim/index.js +6 -0
- package/dist/src/tim/messages.d.ts +50 -0
- package/dist/src/tim/messages.js +104 -0
- package/dist/src/tim/sdk-logger-init.d.ts +13 -0
- package/dist/src/tim/sdk-logger-init.js +46 -0
- package/dist/src/tools.d.ts +9 -0
- package/dist/src/tools.js +8 -0
- package/dist/src/transport/factory.d.ts +63 -0
- package/dist/src/transport/factory.js +54 -0
- package/dist/src/transport/oasn/index.d.ts +12 -0
- package/dist/src/transport/oasn/index.js +9 -0
- package/dist/src/transport/oasn/oasn-agent-card.d.ts +38 -0
- package/dist/src/transport/oasn/oasn-agent-card.js +102 -0
- package/dist/src/transport/oasn/oasn-discovery.d.ts +33 -0
- package/dist/src/transport/oasn/oasn-discovery.js +97 -0
- package/dist/src/transport/oasn/oasn-files.d.ts +64 -0
- package/dist/src/transport/oasn/oasn-files.js +174 -0
- package/dist/src/transport/oasn/oasn-http.d.ts +98 -0
- package/dist/src/transport/oasn/oasn-http.js +362 -0
- package/dist/src/transport/oasn/oasn-invocation.d.ts +154 -0
- package/dist/src/transport/oasn/oasn-invocation.js +432 -0
- package/dist/src/transport/oasn/oasn-normalize.d.ts +6 -0
- package/dist/src/transport/oasn/oasn-normalize.js +112 -0
- package/dist/src/transport/oasn/oasn-register.d.ts +19 -0
- package/dist/src/transport/oasn/oasn-register.js +24 -0
- package/dist/src/transport/oasn/oasn-transport.d.ts +114 -0
- package/dist/src/transport/oasn/oasn-transport.js +230 -0
- package/dist/src/transport/oasn/oasn-types.d.ts +331 -0
- package/dist/src/transport/oasn/oasn-types.js +44 -0
- package/dist/src/transport/tim/index.d.ts +7 -0
- package/dist/src/transport/tim/index.js +6 -0
- package/dist/src/transport/tim/tim-transport.d.ts +122 -0
- package/dist/src/transport/tim/tim-transport.js +402 -0
- package/dist/src/transport/types.d.ts +450 -0
- package/dist/src/transport/types.js +38 -0
- package/dist/src/util/http.d.ts +21 -0
- package/dist/src/util/http.js +93 -0
- package/dist/src/util/logger.d.ts +20 -0
- package/dist/src/util/logger.js +100 -0
- package/dist/src/util/url-resolver.d.ts +7 -0
- package/dist/src/util/url-resolver.js +20 -0
- package/index.ts +11 -0
- package/openclaw.plugin.json +9 -0
- package/package.json +7 -4
- package/src/app/download-file-tool.ts +133 -0
- package/src/app/hooks.ts +89 -5
- package/src/app/index.ts +6 -0
- package/src/app/remote-agent-tool.ts +46 -0
- package/src/app/types.ts +1 -0
- package/src/app/upload-file-tool.ts +411 -0
- package/src/plugin-ui/assets/openagent-override.js +15 -66
- package/src/plugin-ui/modules/agent-book/panel/agent-book.js +0 -61
- package/src/plugin-ui/modules/agent-book/panel/agent-data.js +0 -1
- package/src/plugin-ui/modules/agent-book/panel/inject-ui.js +14 -3
- package/src/plugin-ui/ui-extension-loader/registry-regex.ts +102 -63
- package/src/runtime/account.ts +0 -23
- package/src/transport/oasn/oasn-files.ts +5 -5
- package/src/transport/oasn/oasn-invocation.ts +44 -2
- package/src/transport/oasn/oasn-normalize.ts +0 -26
- package/src/transport/oasn/oasn-register.ts +8 -81
- package/src/transport/oasn/oasn-transport.ts +9 -32
- package/src/transport/oasn/oasn-types.ts +53 -6
- package/src/transport/types.ts +33 -36
- package/src/util/url-resolver.ts +17 -0
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* 子模块组装:
|
|
9
9
|
* - OasnHttpClient HTTP 基础(Bearer 注入 / 重试 / 401 拦截)
|
|
10
|
-
* -
|
|
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 {
|
|
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
|
|
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.
|
|
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.
|
|
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
|
-
//
|
|
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.
|
|
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
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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
|
|
300
|
-
created_at
|
|
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
|
package/src/transport/types.ts
CHANGED
|
@@ -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
|
-
//
|
|
257
|
+
// Agent 状态 / Owner(OASN-only)
|
|
231
258
|
// ═══════════════════════════════════════════════════════════════
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
|
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
|
+
}
|