openclaw-openagent 1.0.13 → 1.0.14

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 (128) hide show
  1. package/dist/src/messaging/executor.d.ts +2 -3
  2. package/dist/src/messaging/executor.js +4 -31
  3. package/dist/src/plugin-ui/assets/openagent-override.js +4 -5
  4. package/dist/src/runtime/update-checker.d.ts +1 -1
  5. package/dist/src/runtime/update-checker.js +9 -46
  6. package/package.json +1 -3
  7. package/src/app/channel-tools.ts +0 -249
  8. package/src/app/discovery-tools.ts +0 -273
  9. package/src/app/download-file-tool.ts +0 -133
  10. package/src/app/hooks.ts +0 -144
  11. package/src/app/index.ts +0 -84
  12. package/src/app/messaging-tools.ts +0 -79
  13. package/src/app/ops-tools.ts +0 -155
  14. package/src/app/remote-agent-tool.ts +0 -762
  15. package/src/app/types.ts +0 -68
  16. package/src/app/upload-file-tool.ts +0 -411
  17. package/src/app/verbose-preflight.ts +0 -190
  18. package/src/auth/config.ts +0 -266
  19. package/src/auth/credential-manager.ts +0 -146
  20. package/src/auth/index.ts +0 -24
  21. package/src/auth/verify.ts +0 -99
  22. package/src/channel.ts +0 -566
  23. package/src/compat.ts +0 -94
  24. package/src/config/config-schema.ts +0 -45
  25. package/src/messaging/aggregator.ts +0 -120
  26. package/src/messaging/collector.ts +0 -89
  27. package/src/messaging/executor.ts +0 -72
  28. package/src/messaging/inbound.ts +0 -150
  29. package/src/messaging/index.ts +0 -11
  30. package/src/messaging/mention-protocol.ts +0 -94
  31. package/src/messaging/process-c2c-request.ts +0 -564
  32. package/src/messaging/process-message.ts +0 -373
  33. package/src/messaging/scheduler.ts +0 -55
  34. package/src/messaging/types.ts +0 -38
  35. package/src/plugin-ui/adapters/oc-2026-04.js +0 -103
  36. package/src/plugin-ui/adapters/oc-2026-05.js +0 -125
  37. package/src/plugin-ui/adapters/oc-2026-06.js +0 -125
  38. package/src/plugin-ui/adapters/oc-unknown.js +0 -48
  39. package/src/plugin-ui/assets/agentbook-icon.svg +0 -5
  40. package/src/plugin-ui/assets/bg.png +0 -0
  41. package/src/plugin-ui/assets/icon.png +0 -0
  42. package/src/plugin-ui/assets/magic.svg +0 -5
  43. package/src/plugin-ui/assets/openagent-override.js +0 -11263
  44. package/src/plugin-ui/build.cjs +0 -463
  45. package/src/plugin-ui/index.ts +0 -18
  46. package/src/plugin-ui/modules/agent-book/panel/agent-book.js +0 -570
  47. package/src/plugin-ui/modules/agent-book/panel/agent-card.js +0 -170
  48. package/src/plugin-ui/modules/agent-book/panel/agent-data.js +0 -643
  49. package/src/plugin-ui/modules/agent-book/panel/inject-ui.js +0 -665
  50. package/src/plugin-ui/modules/agent-book/panel/mention-state.js +0 -206
  51. package/src/plugin-ui/modules/agent-book/panel/styles.js +0 -832
  52. package/src/plugin-ui/modules/agent-book/panel/theme-adapter.js +0 -86
  53. package/src/plugin-ui/modules/agent-book/remote-agent-tool/components-core.js +0 -295
  54. package/src/plugin-ui/modules/agent-book/remote-agent-tool/thought-chain-card.js +0 -211
  55. package/src/plugin-ui/modules/agent-book/scanner.js +0 -131
  56. package/src/plugin-ui/modules/agent-book/travelcard/travel-cards.js +0 -500
  57. package/src/plugin-ui/modules/agent-book/travelcard/travel-engine.js +0 -652
  58. package/src/plugin-ui/modules/agent-book/travelcard/travel-styles.js +0 -262
  59. package/src/plugin-ui/modules/loader/bootstrap.js +0 -133
  60. package/src/plugin-ui/modules/loader/shared-state.js +0 -838
  61. package/src/plugin-ui/modules/loader/ws-intercept.js +0 -199
  62. package/src/plugin-ui/modules/remote-agent/chunk-parser.js +0 -161
  63. package/src/plugin-ui/modules/remote-agent/execution-card.js +0 -530
  64. package/src/plugin-ui/modules/remote-agent/markdown-renderer.js +0 -256
  65. package/src/plugin-ui/modules/remote-agent/media-links.js +0 -151
  66. package/src/plugin-ui/modules/remote-agent/native-style-adapter.js +0 -134
  67. package/src/plugin-ui/modules/remote-agent/output-card.js +0 -342
  68. package/src/plugin-ui/modules/remote-agent/progress-store.js +0 -363
  69. package/src/plugin-ui/modules/remote-agent/render-hooks.js +0 -1700
  70. package/src/plugin-ui/modules/remote-agent/styles.js +0 -903
  71. package/src/plugin-ui/modules/remote-agent/tool-card-model.js +0 -130
  72. package/src/plugin-ui/postinstall-deploy.cjs +0 -52
  73. package/src/plugin-ui/ui-extension-loader/backup.ts +0 -92
  74. package/src/plugin-ui/ui-extension-loader/index.ts +0 -276
  75. package/src/plugin-ui/ui-extension-loader/locator.ts +0 -152
  76. package/src/plugin-ui/ui-extension-loader/manifest.ts +0 -57
  77. package/src/plugin-ui/ui-extension-loader/registry-regex.ts +0 -944
  78. package/src/plugin-ui/ui-extension-loader/removed-extensions.ts +0 -70
  79. package/src/plugin-ui/ui-extension-loader/types.ts +0 -72
  80. package/src/proxy/auth-proxy.ts +0 -414
  81. package/src/runtime/account.ts +0 -549
  82. package/src/runtime/index.ts +0 -7
  83. package/src/runtime/plugin-runtime.ts +0 -94
  84. package/src/runtime/registry.ts +0 -71
  85. package/src/runtime/update-checker.ts +0 -286
  86. package/src/sdk/CLASS_MAP.md +0 -143
  87. package/src/sdk/index.d.ts +0 -126
  88. package/src/sdk/index.js +0 -23990
  89. package/src/sdk/modules/cloud-search-module.js +0 -1117
  90. package/src/sdk/modules/follow-module.js +0 -1069
  91. package/src/sdk/modules/group-module.js +0 -7397
  92. package/src/sdk/modules/relationship-module.js +0 -2269
  93. package/src/sdk/modules/signaling-module.js +0 -1468
  94. package/src/sdk/modules/tim-upload-plugin.js +0 -730
  95. package/src/sdk/node-env/http-request.js +0 -90
  96. package/src/sdk/node-env/index.js +0 -57
  97. package/src/sdk/node-env/storage.js +0 -114
  98. package/src/sdk/package.json +0 -10
  99. package/src/sdk/tsconfig.json +0 -16
  100. package/src/state/pending-invocation-store.ts +0 -43
  101. package/src/state/store.ts +0 -756
  102. package/src/tim/c2c.ts +0 -451
  103. package/src/tim/channels.ts +0 -364
  104. package/src/tim/client.ts +0 -330
  105. package/src/tim/index.ts +0 -18
  106. package/src/tim/messages.ts +0 -166
  107. package/src/tim/sdk-logger-init.ts +0 -50
  108. package/src/tools.ts +0 -10
  109. package/src/transport/factory.ts +0 -95
  110. package/src/transport/oasn/index.ts +0 -17
  111. package/src/transport/oasn/oasn-agent-card.ts +0 -111
  112. package/src/transport/oasn/oasn-discovery.ts +0 -108
  113. package/src/transport/oasn/oasn-files.ts +0 -210
  114. package/src/transport/oasn/oasn-http.ts +0 -529
  115. package/src/transport/oasn/oasn-invocation.ts +0 -604
  116. package/src/transport/oasn/oasn-normalize.ts +0 -133
  117. package/src/transport/oasn/oasn-register.ts +0 -33
  118. package/src/transport/oasn/oasn-transport.ts +0 -318
  119. package/src/transport/oasn/oasn-types.ts +0 -404
  120. package/src/transport/tim/index.ts +0 -8
  121. package/src/transport/tim/tim-transport.ts +0 -515
  122. package/src/transport/types.ts +0 -538
  123. package/src/types/openclaw-plugin-sdk-media-store.d.ts +0 -9
  124. package/src/types/openclaw.d.ts +0 -97
  125. package/src/types/tencentcloud-chat.d.ts +0 -15
  126. package/src/util/http.ts +0 -113
  127. package/src/util/logger.ts +0 -131
  128. package/src/util/url-resolver.ts +0 -77
package/src/util/http.ts DELETED
@@ -1,113 +0,0 @@
1
- /**
2
- * HTTP Utility — Lightweight GET/POST helpers
3
- *
4
- * Uses Node.js built-in http/https modules.
5
- * No external dependencies required.
6
- */
7
-
8
- import type { IncomingMessage, RequestOptions } from 'node:http';
9
-
10
- const DEFAULT_TIMEOUT_MS = 10_000;
11
-
12
- export interface HttpResponse<T = unknown> {
13
- statusCode: number;
14
- data: T;
15
- }
16
-
17
- /**
18
- * Perform an HTTP GET request and parse JSON response.
19
- */
20
- export async function httpGet<T = unknown>(
21
- url: string,
22
- options?: { headers?: Record<string, string>; timeoutMs?: number },
23
- ): Promise<T> {
24
- const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
25
- const isHttps = url.startsWith('https');
26
- const client = await import(isHttps ? 'node:https' : 'node:http');
27
-
28
- return new Promise<T>((resolve, reject) => {
29
- const timeout = setTimeout(() => reject(new Error(`GET timeout: ${url}`)), timeoutMs);
30
-
31
- const reqOptions: RequestOptions = {};
32
- if (options?.headers) {
33
- reqOptions.headers = options.headers;
34
- }
35
-
36
- client.get(url, reqOptions, (res: IncomingMessage) => {
37
- let data = '';
38
- res.on('data', (chunk: string) => (data += chunk));
39
- res.on('end', () => {
40
- clearTimeout(timeout);
41
- if (res.statusCode && res.statusCode >= 400) {
42
- try {
43
- const errJson = JSON.parse(data) as { error?: string };
44
- return reject(new Error(errJson.error || `HTTP ${res.statusCode}`));
45
- } catch {
46
- return reject(new Error(`HTTP ${res.statusCode}: ${data}`));
47
- }
48
- }
49
- try {
50
- resolve(JSON.parse(data) as T);
51
- } catch {
52
- reject(new Error('Failed to parse response'));
53
- }
54
- });
55
- }).on('error', (err: Error) => {
56
- clearTimeout(timeout);
57
- reject(err);
58
- });
59
- });
60
- }
61
-
62
- /**
63
- * Perform an HTTP POST request with JSON body and parse JSON response.
64
- */
65
- export async function httpPost<T = unknown>(
66
- url: string,
67
- body: unknown,
68
- timeoutMs = DEFAULT_TIMEOUT_MS,
69
- ): Promise<T> {
70
- const isHttps = url.startsWith('https');
71
- const httpModule = await import(isHttps ? 'node:https' : 'node:http');
72
-
73
- return new Promise<T>((resolve, reject) => {
74
- const timeout = setTimeout(() => reject(new Error(`POST timeout: ${url}`)), timeoutMs);
75
- const bodyStr = typeof body === 'string' ? body : JSON.stringify(body);
76
-
77
- const options: RequestOptions = {
78
- method: 'POST',
79
- headers: {
80
- 'Content-Type': 'application/json',
81
- 'Content-Length': Buffer.byteLength(bodyStr),
82
- },
83
- };
84
-
85
- const req = httpModule.request(url, options, (res: IncomingMessage) => {
86
- let data = '';
87
- res.on('data', (chunk: string) => (data += chunk));
88
- res.on('end', () => {
89
- clearTimeout(timeout);
90
- if (res.statusCode && res.statusCode >= 400) {
91
- try {
92
- const errJson = JSON.parse(data) as { error?: string };
93
- return reject(new Error(errJson.error || `HTTP ${res.statusCode}`));
94
- } catch {
95
- return reject(new Error(`HTTP ${res.statusCode}: ${data}`));
96
- }
97
- }
98
- try {
99
- resolve(JSON.parse(data) as T);
100
- } catch {
101
- reject(new Error('Failed to parse response'));
102
- }
103
- });
104
- });
105
-
106
- req.on('error', (err: Error) => {
107
- clearTimeout(timeout);
108
- reject(err);
109
- });
110
- req.write(bodyStr);
111
- req.end();
112
- });
113
- }
@@ -1,131 +0,0 @@
1
- /**
2
- * OpenAgent Plugin — Logger
3
- *
4
- * 统一日志模块,写入 OpenClaw 标准日志目录。
5
- * 禁止在 Gateway 运行时使用任何 console 输出。
6
- *
7
- * 级别控制优先级:环境变量 > 默认 DEBUG(产品发布后改为 INFO)
8
- */
9
-
10
- import fs from "node:fs";
11
- import os from "node:os";
12
- import path from "node:path";
13
-
14
- import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/infra-runtime";
15
-
16
- // ── 常量 ──
17
-
18
- const LOG_DIR: string = resolvePreferredOpenClawTmpDir();
19
-
20
- const SUBSYSTEM = "gateway/channels/openagent";
21
- const HOSTNAME: string = os.hostname() || "unknown";
22
-
23
- const LEVEL_IDS: Record<string, number> = {
24
- TRACE: 1,
25
- DEBUG: 2,
26
- INFO: 3,
27
- WARN: 4,
28
- ERROR: 5,
29
- FATAL: 6,
30
- };
31
-
32
- const DEFAULT_LEVEL = "DEBUG";
33
-
34
- // ── 级别控制 ──
35
-
36
- /**
37
- * 解析最终日志级别。
38
- * 优先级:环境变量 > 默认 DEBUG
39
- */
40
- function resolveMinLevel(): number {
41
- const env = process.env.OPENCLAW_LOG_LEVEL?.toUpperCase();
42
- if (env && env in LEVEL_IDS) return LEVEL_IDS[env];
43
-
44
- return LEVEL_IDS[DEFAULT_LEVEL];
45
- }
46
-
47
- let minLevelId: number = resolveMinLevel();
48
-
49
- /** 运行时动态修改日志级别 */
50
- export function setLogLevel(level: string): void {
51
- const upper = level.toUpperCase();
52
- if (!(upper in LEVEL_IDS)) {
53
- throw new Error(`Invalid log level: ${level}. Valid: ${Object.keys(LEVEL_IDS).join(", ")}`);
54
- }
55
- minLevelId = LEVEL_IDS[upper];
56
- }
57
-
58
- // ── 时间格式化 ──
59
-
60
- function toLocalISO(now: Date): string {
61
- const offsetMs = -now.getTimezoneOffset() * 60_000;
62
- const sign = offsetMs >= 0 ? "+" : "-";
63
- const abs = Math.abs(now.getTimezoneOffset());
64
- const hh = String(Math.floor(abs / 60)).padStart(2, "0");
65
- const mm = String(abs % 60).padStart(2, "0");
66
- return new Date(now.getTime() + offsetMs).toISOString().replace("Z", `${sign}${hh}:${mm}`);
67
- }
68
-
69
- function resolveLogPath(): string {
70
- const dateKey = toLocalISO(new Date()).slice(0, 10);
71
- return path.join(LOG_DIR, `openclaw-${dateKey}.log`);
72
- }
73
-
74
- // ── 写入 ──
75
-
76
- let logDirEnsured = false;
77
-
78
- function writeLog(level: string, message: string): void {
79
- const levelId = LEVEL_IDS[level] ?? LEVEL_IDS.INFO;
80
- if (levelId < minLevelId) return;
81
-
82
- const now = new Date();
83
- const entry = JSON.stringify({
84
- "0": SUBSYSTEM,
85
- "1": message,
86
- _meta: {
87
- runtime: "node",
88
- runtimeVersion: process.versions.node,
89
- hostname: HOSTNAME,
90
- name: SUBSYSTEM,
91
- parentNames: ["openclaw"],
92
- date: now.toISOString(),
93
- logLevelId: levelId,
94
- logLevelName: level,
95
- },
96
- time: toLocalISO(now),
97
- });
98
-
99
- try {
100
- if (!logDirEnsured) {
101
- fs.mkdirSync(LOG_DIR, { recursive: true });
102
- logDirEnsured = true;
103
- }
104
- fs.appendFileSync(resolveLogPath(), `${entry}\n`, "utf-8");
105
- } catch {
106
- // 写日志失败不应阻塞业务
107
- }
108
- }
109
-
110
- // ── 导出 ──
111
-
112
- export type Logger = {
113
- trace(message: string): void;
114
- debug(message: string): void;
115
- info(message: string): void;
116
- warn(message: string): void;
117
- error(message: string): void;
118
- fatal(message: string): void;
119
- getLogFilePath(): string;
120
- };
121
-
122
- export const logger: Logger = {
123
- trace(message: string): void { writeLog("TRACE", message); },
124
- debug(message: string): void { writeLog("DEBUG", message); },
125
- info(message: string): void { writeLog("INFO", message); },
126
- warn(message: string): void { writeLog("WARN", message); },
127
- error(message: string): void { writeLog("ERROR", message); },
128
- fatal(message: string): void { writeLog("FATAL", message); },
129
-
130
- getLogFilePath(): string { return resolveLogPath(); },
131
- };
@@ -1,77 +0,0 @@
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 resolveOasnRelativeUrl(accessApiBase, url);
14
- } catch {
15
- return url;
16
- }
17
- }
18
-
19
- /**
20
- * Resolve an OASN API/WebUI-relative path without losing env prefixes such as
21
- * `/e/limj1`. `new URL('/api/..', 'https://host/e/limj1')` resets to the
22
- * origin root, so use explicit path joining for env-scoped public bases.
23
- */
24
- export function resolveOasnRelativeUrl(accessApiBase: string, path: string): string {
25
- const base = accessApiBase.replace(/\/+$/, '');
26
- const suffix = path.startsWith('/') ? path : `/${path}`;
27
- return new URL(`${base}${suffix}`).toString();
28
- }
29
-
30
- /**
31
- * Resolve a WebUI continuation URL for user-facing browser clicks.
32
- *
33
- * WebUI auth is Owner-cookie based, so the clickable URL must use the same
34
- * public origin as the claim/login flow. API-key calls can use an internal
35
- * Access base, but browser links cannot reuse cookies across IP/domain origins.
36
- */
37
- export function resolveOasnWebuiUrl(
38
- accessApiBase: string | undefined,
39
- claimUrl: string | undefined,
40
- url: string,
41
- ): string {
42
- if (!url) return url;
43
-
44
- const claimPublicBase = publicBaseOfClaimUrl(claimUrl);
45
- if (!claimPublicBase || !isWebuiUrl(url, accessApiBase || claimPublicBase)) {
46
- return resolveOasnAccessUrl(accessApiBase, url);
47
- }
48
-
49
- try {
50
- const absolute = new URL(resolveOasnAccessUrl(accessApiBase || claimPublicBase, url));
51
- const webuiIndex = absolute.pathname.indexOf('/webui/');
52
- const path = webuiIndex >= 0 ? absolute.pathname.slice(webuiIndex) : absolute.pathname;
53
- return resolveOasnRelativeUrl(claimPublicBase, `${path}${absolute.search}${absolute.hash}`);
54
- } catch {
55
- return resolveOasnAccessUrl(accessApiBase, url);
56
- }
57
- }
58
-
59
- function publicBaseOfClaimUrl(value: string | undefined): string | undefined {
60
- if (!value) return undefined;
61
- try {
62
- const parsed = new URL(value);
63
- const claimPathIndex = parsed.pathname.indexOf('/agents/claim');
64
- if (claimPathIndex <= 0) return parsed.origin;
65
- return `${parsed.origin}${parsed.pathname.slice(0, claimPathIndex)}`;
66
- } catch {
67
- return undefined;
68
- }
69
- }
70
-
71
- function isWebuiUrl(url: string, base: string): boolean {
72
- try {
73
- return /(?:^|\/)webui\//.test(new URL(resolveOasnAccessUrl(base, url)).pathname);
74
- } catch {
75
- return false;
76
- }
77
- }