openclaw-openagent 1.0.12 → 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 (132) hide show
  1. package/dist/index.js +2 -0
  2. package/dist/src/config/config-schema.d.ts +9 -0
  3. package/dist/src/config/config-schema.js +6 -0
  4. package/dist/src/messaging/executor.d.ts +2 -3
  5. package/dist/src/messaging/executor.js +4 -31
  6. package/dist/src/plugin-ui/assets/openagent-override.js +124 -18
  7. package/dist/src/proxy/auth-proxy.js +5 -0
  8. package/dist/src/runtime/update-checker.d.ts +18 -0
  9. package/dist/src/runtime/update-checker.js +216 -0
  10. package/index.ts +3 -0
  11. package/package.json +1 -3
  12. package/src/app/channel-tools.ts +0 -249
  13. package/src/app/discovery-tools.ts +0 -273
  14. package/src/app/download-file-tool.ts +0 -133
  15. package/src/app/hooks.ts +0 -144
  16. package/src/app/index.ts +0 -84
  17. package/src/app/messaging-tools.ts +0 -79
  18. package/src/app/ops-tools.ts +0 -155
  19. package/src/app/remote-agent-tool.ts +0 -762
  20. package/src/app/types.ts +0 -68
  21. package/src/app/upload-file-tool.ts +0 -411
  22. package/src/app/verbose-preflight.ts +0 -190
  23. package/src/auth/config.ts +0 -266
  24. package/src/auth/credential-manager.ts +0 -146
  25. package/src/auth/index.ts +0 -24
  26. package/src/auth/verify.ts +0 -99
  27. package/src/channel.ts +0 -566
  28. package/src/compat.ts +0 -94
  29. package/src/config/config-schema.ts +0 -39
  30. package/src/messaging/aggregator.ts +0 -120
  31. package/src/messaging/collector.ts +0 -89
  32. package/src/messaging/executor.ts +0 -72
  33. package/src/messaging/inbound.ts +0 -150
  34. package/src/messaging/index.ts +0 -11
  35. package/src/messaging/mention-protocol.ts +0 -94
  36. package/src/messaging/process-c2c-request.ts +0 -564
  37. package/src/messaging/process-message.ts +0 -373
  38. package/src/messaging/scheduler.ts +0 -55
  39. package/src/messaging/types.ts +0 -38
  40. package/src/plugin-ui/adapters/oc-2026-04.js +0 -103
  41. package/src/plugin-ui/adapters/oc-2026-05.js +0 -125
  42. package/src/plugin-ui/adapters/oc-2026-06.js +0 -125
  43. package/src/plugin-ui/adapters/oc-unknown.js +0 -48
  44. package/src/plugin-ui/assets/agentbook-icon.svg +0 -5
  45. package/src/plugin-ui/assets/bg.png +0 -0
  46. package/src/plugin-ui/assets/icon.png +0 -0
  47. package/src/plugin-ui/assets/magic.svg +0 -5
  48. package/src/plugin-ui/assets/openagent-override.js +0 -11156
  49. package/src/plugin-ui/build.cjs +0 -463
  50. package/src/plugin-ui/index.ts +0 -18
  51. package/src/plugin-ui/modules/agent-book/panel/agent-book.js +0 -570
  52. package/src/plugin-ui/modules/agent-book/panel/agent-card.js +0 -170
  53. package/src/plugin-ui/modules/agent-book/panel/agent-data.js +0 -643
  54. package/src/plugin-ui/modules/agent-book/panel/inject-ui.js +0 -665
  55. package/src/plugin-ui/modules/agent-book/panel/mention-state.js +0 -206
  56. package/src/plugin-ui/modules/agent-book/panel/styles.js +0 -833
  57. package/src/plugin-ui/modules/agent-book/panel/theme-adapter.js +0 -86
  58. package/src/plugin-ui/modules/agent-book/remote-agent-tool/components-core.js +0 -295
  59. package/src/plugin-ui/modules/agent-book/remote-agent-tool/thought-chain-card.js +0 -211
  60. package/src/plugin-ui/modules/agent-book/scanner.js +0 -131
  61. package/src/plugin-ui/modules/agent-book/travelcard/travel-cards.js +0 -500
  62. package/src/plugin-ui/modules/agent-book/travelcard/travel-engine.js +0 -652
  63. package/src/plugin-ui/modules/agent-book/travelcard/travel-styles.js +0 -256
  64. package/src/plugin-ui/modules/loader/bootstrap.js +0 -38
  65. package/src/plugin-ui/modules/loader/shared-state.js +0 -838
  66. package/src/plugin-ui/modules/loader/ws-intercept.js +0 -199
  67. package/src/plugin-ui/modules/remote-agent/chunk-parser.js +0 -161
  68. package/src/plugin-ui/modules/remote-agent/execution-card.js +0 -530
  69. package/src/plugin-ui/modules/remote-agent/markdown-renderer.js +0 -256
  70. package/src/plugin-ui/modules/remote-agent/media-links.js +0 -151
  71. package/src/plugin-ui/modules/remote-agent/native-style-adapter.js +0 -134
  72. package/src/plugin-ui/modules/remote-agent/output-card.js +0 -342
  73. package/src/plugin-ui/modules/remote-agent/progress-store.js +0 -363
  74. package/src/plugin-ui/modules/remote-agent/render-hooks.js +0 -1700
  75. package/src/plugin-ui/modules/remote-agent/styles.js +0 -896
  76. package/src/plugin-ui/modules/remote-agent/tool-card-model.js +0 -130
  77. package/src/plugin-ui/postinstall-deploy.cjs +0 -52
  78. package/src/plugin-ui/ui-extension-loader/backup.ts +0 -92
  79. package/src/plugin-ui/ui-extension-loader/index.ts +0 -276
  80. package/src/plugin-ui/ui-extension-loader/locator.ts +0 -152
  81. package/src/plugin-ui/ui-extension-loader/manifest.ts +0 -57
  82. package/src/plugin-ui/ui-extension-loader/registry-regex.ts +0 -944
  83. package/src/plugin-ui/ui-extension-loader/removed-extensions.ts +0 -70
  84. package/src/plugin-ui/ui-extension-loader/types.ts +0 -72
  85. package/src/proxy/auth-proxy.ts +0 -409
  86. package/src/runtime/account.ts +0 -549
  87. package/src/runtime/index.ts +0 -7
  88. package/src/runtime/plugin-runtime.ts +0 -94
  89. package/src/runtime/registry.ts +0 -71
  90. package/src/sdk/CLASS_MAP.md +0 -143
  91. package/src/sdk/index.d.ts +0 -126
  92. package/src/sdk/index.js +0 -23990
  93. package/src/sdk/modules/cloud-search-module.js +0 -1117
  94. package/src/sdk/modules/follow-module.js +0 -1069
  95. package/src/sdk/modules/group-module.js +0 -7397
  96. package/src/sdk/modules/relationship-module.js +0 -2269
  97. package/src/sdk/modules/signaling-module.js +0 -1468
  98. package/src/sdk/modules/tim-upload-plugin.js +0 -730
  99. package/src/sdk/node-env/http-request.js +0 -90
  100. package/src/sdk/node-env/index.js +0 -57
  101. package/src/sdk/node-env/storage.js +0 -114
  102. package/src/sdk/package.json +0 -10
  103. package/src/sdk/tsconfig.json +0 -16
  104. package/src/state/pending-invocation-store.ts +0 -43
  105. package/src/state/store.ts +0 -756
  106. package/src/tim/c2c.ts +0 -451
  107. package/src/tim/channels.ts +0 -364
  108. package/src/tim/client.ts +0 -330
  109. package/src/tim/index.ts +0 -18
  110. package/src/tim/messages.ts +0 -166
  111. package/src/tim/sdk-logger-init.ts +0 -50
  112. package/src/tools.ts +0 -10
  113. package/src/transport/factory.ts +0 -95
  114. package/src/transport/oasn/index.ts +0 -17
  115. package/src/transport/oasn/oasn-agent-card.ts +0 -111
  116. package/src/transport/oasn/oasn-discovery.ts +0 -108
  117. package/src/transport/oasn/oasn-files.ts +0 -210
  118. package/src/transport/oasn/oasn-http.ts +0 -529
  119. package/src/transport/oasn/oasn-invocation.ts +0 -604
  120. package/src/transport/oasn/oasn-normalize.ts +0 -133
  121. package/src/transport/oasn/oasn-register.ts +0 -33
  122. package/src/transport/oasn/oasn-transport.ts +0 -318
  123. package/src/transport/oasn/oasn-types.ts +0 -404
  124. package/src/transport/tim/index.ts +0 -8
  125. package/src/transport/tim/tim-transport.ts +0 -515
  126. package/src/transport/types.ts +0 -538
  127. package/src/types/openclaw-plugin-sdk-media-store.d.ts +0 -9
  128. package/src/types/openclaw.d.ts +0 -97
  129. package/src/types/tencentcloud-chat.d.ts +0 -15
  130. package/src/util/http.ts +0 -113
  131. package/src/util/logger.ts +0 -131
  132. 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
- }