mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-27 19:48:48 +00:00
build: enable modern TypeScript module syntax
* build: enable modern TypeScript flags * build: drop erasable TypeScript syntax flag * build: keep legacy class field semantics
This commit is contained in:
committed by
GitHub
parent
a39a2c5acb
commit
bbc1772f4d
@@ -2,7 +2,8 @@ import fs from "node:fs/promises";
|
||||
import { stringEnum } from "openclaw/plugin-sdk/channel-actions";
|
||||
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
||||
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
||||
import { Static, Type } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import type { Static } from "typebox";
|
||||
import type { AnyAgentTool, OpenClawPluginApi, OpenClawPluginToolContext } from "../api.js";
|
||||
import { PlaywrightDiffScreenshotter, type DiffScreenshotter } from "./browser.js";
|
||||
import { resolveDiffImageRenderOptions } from "./config.js";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { DiscordGatewayHandle } from "./monitor/gateway-handle.js";
|
||||
import {
|
||||
import { DiscordGatewayLifecycleError } from "./monitor/gateway-supervisor.js";
|
||||
import type {
|
||||
DiscordGatewayEvent,
|
||||
DiscordGatewayLifecycleError,
|
||||
DiscordGatewaySupervisor,
|
||||
} from "./monitor/gateway-supervisor.js";
|
||||
|
||||
|
||||
@@ -26,10 +26,7 @@ const { undiciFetchMock, agentSpy, envHttpProxyAgentSpy, proxyAgentSpy, createMo
|
||||
("httpsProxy" in options || "httpProxy" in options)
|
||||
) {
|
||||
const proxyOptions = options as { httpsProxy?: unknown; httpProxy?: unknown };
|
||||
if (
|
||||
proxyOptions.httpsProxy === "bad-proxy" ||
|
||||
proxyOptions.httpProxy === "bad-proxy"
|
||||
) {
|
||||
if (proxyOptions.httpsProxy === "bad-proxy" || proxyOptions.httpProxy === "bad-proxy") {
|
||||
throw new Error("bad env proxy");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import {
|
||||
definePluginEntry,
|
||||
OpenClawConfig,
|
||||
type OpenClawPluginApi,
|
||||
type ProviderAuthContext,
|
||||
type ProviderAuthMethodNonInteractiveContext,
|
||||
type ProviderAuthResult,
|
||||
type ProviderRuntimeModel,
|
||||
} from "openclaw/plugin-sdk/plugin-entry";
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { CUSTOM_LOCAL_AUTH_MARKER } from "openclaw/plugin-sdk/provider-auth";
|
||||
import { lmstudioMemoryEmbeddingProviderAdapter } from "./memory-embedding-adapter.js";
|
||||
import {
|
||||
|
||||
@@ -14,6 +14,8 @@ export type MatrixLegacyCryptoInspectionResult = {
|
||||
decryptionKeyBase64: string | null;
|
||||
};
|
||||
|
||||
const MATRIX_CRYPTO_STORE_SQLITE = 0;
|
||||
|
||||
function resolveLegacyMachineStorePath(params: {
|
||||
cryptoRootDir: string;
|
||||
deviceId: string;
|
||||
@@ -56,7 +58,7 @@ export async function inspectLegacyMatrixCryptoStore(params: {
|
||||
log: params.log,
|
||||
});
|
||||
|
||||
const { DeviceId, OlmMachine, StoreType, UserId } = requireFn(
|
||||
const { DeviceId, OlmMachine, UserId } = requireFn(
|
||||
"@matrix-org/matrix-sdk-crypto-nodejs",
|
||||
) as typeof import("@matrix-org/matrix-sdk-crypto-nodejs");
|
||||
const machine = await OlmMachine.initialize(
|
||||
@@ -64,7 +66,7 @@ export async function inspectLegacyMatrixCryptoStore(params: {
|
||||
new DeviceId(params.deviceId),
|
||||
machineStorePath,
|
||||
"",
|
||||
StoreType.Sqlite,
|
||||
MATRIX_CRYPTO_STORE_SQLITE,
|
||||
);
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
ParseErrorCode,
|
||||
type ParseError,
|
||||
parseTree,
|
||||
printParseErrorCode,
|
||||
} from "jsonc-parser/lib/esm/main.js";
|
||||
import { type ParseError, parseTree, printParseErrorCode } from "jsonc-parser/lib/esm/main.js";
|
||||
import type { Diagnostic } from "../ast.js";
|
||||
import type { JsoncAst, JsoncEntry, JsoncValue } from "./ast.js";
|
||||
|
||||
@@ -24,6 +19,8 @@ export const MAX_PARSE_DEPTH = 256;
|
||||
* supported configuration.
|
||||
*/
|
||||
export const MAX_JSONC_INPUT_BYTES = 16 * 1024 * 1024;
|
||||
const JSONC_PARSE_INVALID_SYMBOL = 1;
|
||||
const JSONC_PARSE_END_OF_FILE_EXPECTED = 9;
|
||||
|
||||
export interface JsoncParseResult {
|
||||
readonly ast: JsoncAst;
|
||||
@@ -104,9 +101,10 @@ function toDiagnostic(
|
||||
tree: JsoncParserNode | undefined,
|
||||
): Diagnostic {
|
||||
const treeEnd = tree ? tree.offset + tree.length : 0;
|
||||
const errorCode: number = error.error;
|
||||
const isTrailingInput =
|
||||
error.error === ParseErrorCode.EndOfFileExpected ||
|
||||
(tree !== undefined && error.error === ParseErrorCode.InvalidSymbol && error.offset >= treeEnd);
|
||||
errorCode === JSONC_PARSE_END_OF_FILE_EXPECTED ||
|
||||
(tree !== undefined && errorCode === JSONC_PARSE_INVALID_SYMBOL && error.offset >= treeEnd);
|
||||
return {
|
||||
line: lineMap.lineForOffset(error.offset),
|
||||
message: printParseErrorCode(error.error),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { ChannelRuntimeSurface } from "openclaw/plugin-sdk/channel-contract";
|
||||
import { Mock, vi } from "vitest";
|
||||
import { vi } from "vitest";
|
||||
import type { Mock } from "vitest";
|
||||
import { clearSlackInboundDeliveryStateForTest } from "./monitor/inbound-delivery-state.js";
|
||||
|
||||
type SlackHandler = (args: unknown) => Promise<void>;
|
||||
|
||||
@@ -69,10 +69,8 @@ import type {
|
||||
TelegramMessageContextOptions,
|
||||
TelegramPromptContextEntry,
|
||||
} from "./bot-message-context.types.js";
|
||||
import {
|
||||
parseTelegramNativeCommandCallbackData,
|
||||
RegisterTelegramHandlerParams,
|
||||
} from "./bot-native-commands.js";
|
||||
import { parseTelegramNativeCommandCallbackData } from "./bot-native-commands.js";
|
||||
import type { RegisterTelegramHandlerParams } from "./bot-native-commands.js";
|
||||
import {
|
||||
MEDIA_GROUP_TIMEOUT_MS,
|
||||
type MediaGroupEntry,
|
||||
@@ -1315,8 +1313,11 @@ export const registerTelegramHandlers = ({
|
||||
};
|
||||
|
||||
class TelegramRetryableCallbackError extends Error {
|
||||
constructor(public override readonly cause: unknown) {
|
||||
public override readonly cause: unknown;
|
||||
|
||||
constructor(cause: unknown) {
|
||||
super(String(cause));
|
||||
this.cause = cause;
|
||||
this.name = "TelegramRetryableCallbackError";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ import {
|
||||
syncTelegramMenuCommands as syncTelegramMenuCommandsRuntime,
|
||||
type TelegramMenuCommand,
|
||||
} from "./bot-native-command-menu.js";
|
||||
import { TelegramUpdateKeyContext } from "./bot-updates.js";
|
||||
import type { TelegramUpdateKeyContext } from "./bot-updates.js";
|
||||
import type { TelegramBotOptions } from "./bot.types.js";
|
||||
import {
|
||||
buildTelegramRoutingTarget,
|
||||
|
||||
@@ -6,7 +6,6 @@ import { WhatsAppRetryableInboundError } from "./inbound/dedupe.js";
|
||||
import { WHATSAPP_GROUP_METADATA_CACHE_MAX_ENTRIES } from "./inbound/monitor.js";
|
||||
import {
|
||||
type InboxMonitorOptions,
|
||||
InboxOnMessage,
|
||||
buildNotifyMessageUpsert,
|
||||
failNextWhatsAppPluginStateRegisterIfAbsent,
|
||||
getAuthDir,
|
||||
@@ -17,6 +16,7 @@ import {
|
||||
startInboxMonitor,
|
||||
waitForMessageCalls,
|
||||
} from "./monitor-inbox.test-harness.js";
|
||||
import type { InboxOnMessage } from "./monitor-inbox.test-harness.js";
|
||||
|
||||
const { sleepWithAbortMock } = vi.hoisted(() => ({
|
||||
sleepWithAbortMock: vi.fn(async (_ms: number, _signal?: AbortSignal) => undefined),
|
||||
|
||||
@@ -1862,7 +1862,7 @@
|
||||
"@types/markdown-it": "14.1.2",
|
||||
"@types/node": "25.9.1",
|
||||
"@types/ws": "8.18.1",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260519.1",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260524.1",
|
||||
"@vitest/coverage-v8": "4.1.7",
|
||||
"jscpd": "4.2.3",
|
||||
"jsdom": "29.1.1",
|
||||
|
||||
76
pnpm-lock.yaml
generated
76
pnpm-lock.yaml
generated
@@ -222,8 +222,8 @@ importers:
|
||||
specifier: 8.18.1
|
||||
version: 8.18.1
|
||||
'@typescript/native-preview':
|
||||
specifier: 7.0.0-dev.20260519.1
|
||||
version: 7.0.0-dev.20260519.1
|
||||
specifier: 7.0.0-dev.20260524.1
|
||||
version: 7.0.0-dev.20260524.1
|
||||
'@vitest/coverage-v8':
|
||||
specifier: 4.1.7
|
||||
version: 4.1.7(@vitest/browser@4.1.7)(vitest@4.1.7)
|
||||
@@ -250,7 +250,7 @@ importers:
|
||||
version: 0.21.1(signal-polyfill@0.2.2)
|
||||
tsdown:
|
||||
specifier: 0.22.0
|
||||
version: 0.22.0(@typescript/native-preview@7.0.0-dev.20260519.1)(tsx@4.22.3)(typescript@6.0.3)(unrun@0.3.0)
|
||||
version: 0.22.0(@typescript/native-preview@7.0.0-dev.20260524.1)(tsx@4.22.3)(typescript@6.0.3)(unrun@0.3.0)
|
||||
tsx:
|
||||
specifier: 4.22.3
|
||||
version: 4.22.3
|
||||
@@ -4304,50 +4304,50 @@ packages:
|
||||
'@types/ws@8.18.1':
|
||||
resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==}
|
||||
|
||||
'@typescript/native-preview-darwin-arm64@7.0.0-dev.20260519.1':
|
||||
resolution: {integrity: sha512-c9zdG6sGJf25Jpz04JgE23zhYeprqFypDGuqiX94yMTvR8IWXjq3R2oMnim66YLBDon/V1nCEy6cFixeSd/4fg==}
|
||||
'@typescript/native-preview-darwin-arm64@7.0.0-dev.20260524.1':
|
||||
resolution: {integrity: sha512-dIaYmijy9/tdrxHTxlnfwzP+AC6iAycUYGChOowLR3bVSbKhz4DUJZGMaodzGCtBEWSRUwx0MK1Sa1zBpFbM5g==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@typescript/native-preview-darwin-x64@7.0.0-dev.20260519.1':
|
||||
resolution: {integrity: sha512-N16V3wiM0tsNmSSA7nZrxqXXt5OCJxBwiCVn35rnA7fr4WzJw6rJmwf9heNNhZ6Gh4ne3+Pexajf5akzuHR75Q==}
|
||||
'@typescript/native-preview-darwin-x64@7.0.0-dev.20260524.1':
|
||||
resolution: {integrity: sha512-HjfPFOSQCymn5Iu07xoySqfK5lwXthEWN1vltO5SDaFYVRasK6P3DBRe4QL0AiSGr8tRfA3x7BdRPjPVu94Epg==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@typescript/native-preview-linux-arm64@7.0.0-dev.20260519.1':
|
||||
resolution: {integrity: sha512-ltf91vAwKdbu0SlRQbFgi1h5ZrLLrBn6a4qIeN2VILGbtYrCXnARHRznLBv81yUETQ7aVr/LSQcmsWo1ejCK0w==}
|
||||
'@typescript/native-preview-linux-arm64@7.0.0-dev.20260524.1':
|
||||
resolution: {integrity: sha512-dH+zYjBs2ajcIRMmb8YkapY7TXzU/yX6HITrXhuoDov+mun7nCNfiRRmRBeqbGxl5JM8mUugBl/yyyhFWjIWdQ==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@typescript/native-preview-linux-arm@7.0.0-dev.20260519.1':
|
||||
resolution: {integrity: sha512-8v4BExeeuCTrhaSGfeIJqm3qQkTzlZix/Qd/FkPlWoz9f7d7COvXb3Z4qhbaVolL0MMnUvQ7m005Z4kYsZ645A==}
|
||||
'@typescript/native-preview-linux-arm@7.0.0-dev.20260524.1':
|
||||
resolution: {integrity: sha512-gXzD1BNpPUSAv12a9UvxLTX/+WdoC34skLw6hDLk1kv3VYbd5LecQzEIb7u+WHCsNuXVXffk79+BZP7IQNS1aw==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@typescript/native-preview-linux-x64@7.0.0-dev.20260519.1':
|
||||
resolution: {integrity: sha512-AVD0tczTtFCHNa4RQRVPvu8Hnw4P3hQ+OlUAjnz/lHowvc6o1pYB46elMqfDuaoWqIpv+EAkAPP4ipFCofJ5IA==}
|
||||
'@typescript/native-preview-linux-x64@7.0.0-dev.20260524.1':
|
||||
resolution: {integrity: sha512-Fr0A8RPBMXco9IIXel598hC25LE1A5wpB33mBhwimlIQe58MMCAeW+wDHXsmLmF2NiFVT1vr1tjMGmEMMdYdsg==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@typescript/native-preview-win32-arm64@7.0.0-dev.20260519.1':
|
||||
resolution: {integrity: sha512-TM+qatljyejqjHevCta3WIH53i0oGC7K8SoJ6t+mf4cGMTpZTyd7NhC1ts7e6/aydZnG53Bsta2iQi1SMIlQEw==}
|
||||
'@typescript/native-preview-win32-arm64@7.0.0-dev.20260524.1':
|
||||
resolution: {integrity: sha512-AhFD6bct2RWeZxONLEvaKPlu+c+/TNejj7ntztHWREaq+lrjz8Qg3tXryah2K66EEmYY0TooapfWUWXWe8i+VQ==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@typescript/native-preview-win32-x64@7.0.0-dev.20260519.1':
|
||||
resolution: {integrity: sha512-r9LEsoY7JC/82gXo8hlOmpQaUXcqmngCVOv+mUx1UeMt9f+1S6oNO0W48o75mlBqqC7jfcMHqw8YS4LfVxPRGw==}
|
||||
'@typescript/native-preview-win32-x64@7.0.0-dev.20260524.1':
|
||||
resolution: {integrity: sha512-3VE5kBH2y7vYpj83X9iqGbNR8gwnlQlTjzLKJBzuyfTJPZ9R/vM4txvpuTDRJo18JGzEq4FUjKg7yqpf9ajb2g==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@typescript/native-preview@7.0.0-dev.20260519.1':
|
||||
resolution: {integrity: sha512-VVER7vFUDdfm5k3jbH5765tVEJa7+0rTUkFeXyGYrXPxpw9BIjA0QDxdtdlRyaU8MCZV9IKZUo6doxeAQRAjPg==}
|
||||
'@typescript/native-preview@7.0.0-dev.20260524.1':
|
||||
resolution: {integrity: sha512-L4YviXl4FVYt4V9vkUKRCZW1DcsUbLRaKC4gxsYmBJQqB262mtUo8eqjKqElgZNIpKwYEAAYsBDrVmNhy6ze2w==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
hasBin: true
|
||||
|
||||
@@ -10246,36 +10246,36 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/node': 25.9.1
|
||||
|
||||
'@typescript/native-preview-darwin-arm64@7.0.0-dev.20260519.1':
|
||||
'@typescript/native-preview-darwin-arm64@7.0.0-dev.20260524.1':
|
||||
optional: true
|
||||
|
||||
'@typescript/native-preview-darwin-x64@7.0.0-dev.20260519.1':
|
||||
'@typescript/native-preview-darwin-x64@7.0.0-dev.20260524.1':
|
||||
optional: true
|
||||
|
||||
'@typescript/native-preview-linux-arm64@7.0.0-dev.20260519.1':
|
||||
'@typescript/native-preview-linux-arm64@7.0.0-dev.20260524.1':
|
||||
optional: true
|
||||
|
||||
'@typescript/native-preview-linux-arm@7.0.0-dev.20260519.1':
|
||||
'@typescript/native-preview-linux-arm@7.0.0-dev.20260524.1':
|
||||
optional: true
|
||||
|
||||
'@typescript/native-preview-linux-x64@7.0.0-dev.20260519.1':
|
||||
'@typescript/native-preview-linux-x64@7.0.0-dev.20260524.1':
|
||||
optional: true
|
||||
|
||||
'@typescript/native-preview-win32-arm64@7.0.0-dev.20260519.1':
|
||||
'@typescript/native-preview-win32-arm64@7.0.0-dev.20260524.1':
|
||||
optional: true
|
||||
|
||||
'@typescript/native-preview-win32-x64@7.0.0-dev.20260519.1':
|
||||
'@typescript/native-preview-win32-x64@7.0.0-dev.20260524.1':
|
||||
optional: true
|
||||
|
||||
'@typescript/native-preview@7.0.0-dev.20260519.1':
|
||||
'@typescript/native-preview@7.0.0-dev.20260524.1':
|
||||
optionalDependencies:
|
||||
'@typescript/native-preview-darwin-arm64': 7.0.0-dev.20260519.1
|
||||
'@typescript/native-preview-darwin-x64': 7.0.0-dev.20260519.1
|
||||
'@typescript/native-preview-linux-arm': 7.0.0-dev.20260519.1
|
||||
'@typescript/native-preview-linux-arm64': 7.0.0-dev.20260519.1
|
||||
'@typescript/native-preview-linux-x64': 7.0.0-dev.20260519.1
|
||||
'@typescript/native-preview-win32-arm64': 7.0.0-dev.20260519.1
|
||||
'@typescript/native-preview-win32-x64': 7.0.0-dev.20260519.1
|
||||
'@typescript/native-preview-darwin-arm64': 7.0.0-dev.20260524.1
|
||||
'@typescript/native-preview-darwin-x64': 7.0.0-dev.20260524.1
|
||||
'@typescript/native-preview-linux-arm': 7.0.0-dev.20260524.1
|
||||
'@typescript/native-preview-linux-arm64': 7.0.0-dev.20260524.1
|
||||
'@typescript/native-preview-linux-x64': 7.0.0-dev.20260524.1
|
||||
'@typescript/native-preview-win32-arm64': 7.0.0-dev.20260524.1
|
||||
'@typescript/native-preview-win32-x64': 7.0.0-dev.20260524.1
|
||||
|
||||
'@typespec/ts-http-runtime@0.3.5':
|
||||
dependencies:
|
||||
@@ -13017,7 +13017,7 @@ snapshots:
|
||||
|
||||
reusify@1.1.0: {}
|
||||
|
||||
rolldown-plugin-dts@0.25.1(@typescript/native-preview@7.0.0-dev.20260519.1)(rolldown@1.0.2)(typescript@6.0.3):
|
||||
rolldown-plugin-dts@0.25.1(@typescript/native-preview@7.0.0-dev.20260524.1)(rolldown@1.0.2)(typescript@6.0.3):
|
||||
dependencies:
|
||||
'@babel/generator': 8.0.0-rc.5
|
||||
'@babel/helper-validator-identifier': 8.0.0-rc.5
|
||||
@@ -13029,7 +13029,7 @@ snapshots:
|
||||
obug: 2.1.1
|
||||
rolldown: 1.0.2
|
||||
optionalDependencies:
|
||||
'@typescript/native-preview': 7.0.0-dev.20260519.1
|
||||
'@typescript/native-preview': 7.0.0-dev.20260524.1
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- oxc-resolver
|
||||
@@ -13443,7 +13443,7 @@ snapshots:
|
||||
|
||||
ts-algebra@2.0.0: {}
|
||||
|
||||
tsdown@0.22.0(@typescript/native-preview@7.0.0-dev.20260519.1)(tsx@4.22.3)(typescript@6.0.3)(unrun@0.3.0):
|
||||
tsdown@0.22.0(@typescript/native-preview@7.0.0-dev.20260524.1)(tsx@4.22.3)(typescript@6.0.3)(unrun@0.3.0):
|
||||
dependencies:
|
||||
ansis: 4.3.0
|
||||
cac: 7.0.0
|
||||
@@ -13454,7 +13454,7 @@ snapshots:
|
||||
obug: 2.1.1
|
||||
picomatch: 4.0.4
|
||||
rolldown: 1.0.2
|
||||
rolldown-plugin-dts: 0.25.1(@typescript/native-preview@7.0.0-dev.20260519.1)(rolldown@1.0.2)(typescript@6.0.3)
|
||||
rolldown-plugin-dts: 0.25.1(@typescript/native-preview@7.0.0-dev.20260524.1)(rolldown@1.0.2)(typescript@6.0.3)
|
||||
semver: 7.8.0
|
||||
tinyexec: 1.1.2
|
||||
tinyglobby: 0.2.16
|
||||
|
||||
@@ -73,7 +73,8 @@ import {
|
||||
resolveMissingMetaError,
|
||||
resolveRuntimeIdleTtlMs,
|
||||
} from "./manager.utils.js";
|
||||
import { CachedRuntimeState, RuntimeCache } from "./runtime-cache.js";
|
||||
import { RuntimeCache } from "./runtime-cache.js";
|
||||
import type { CachedRuntimeState } from "./runtime-cache.js";
|
||||
import {
|
||||
inferRuntimeOptionPatchFromConfigOption,
|
||||
mergeRuntimeOptions,
|
||||
@@ -179,8 +180,11 @@ export class AcpSessionManager {
|
||||
private readonly errorCountsByCode = new Map<string, number>();
|
||||
private evictedRuntimeCount = 0;
|
||||
private lastEvictedAt: number | undefined;
|
||||
private readonly deps: AcpSessionManagerDeps;
|
||||
|
||||
constructor(private readonly deps: AcpSessionManagerDeps = DEFAULT_DEPS) {}
|
||||
constructor(deps: AcpSessionManagerDeps = DEFAULT_DEPS) {
|
||||
this.deps = deps;
|
||||
}
|
||||
|
||||
resolveSession(params: { cfg: OpenClawConfig; sessionKey: string }): AcpSessionResolution {
|
||||
const sessionKey = canonicalizeAcpSessionKey(params);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Mock, vi } from "vitest";
|
||||
import { vi } from "vitest";
|
||||
import type { Mock } from "vitest";
|
||||
|
||||
export const runCommandWithTimeoutMock: Mock<(...args: unknown[]) => unknown> = vi.fn();
|
||||
export const scanDirectoryWithSummaryMock: Mock<(...args: unknown[]) => unknown> = vi.fn();
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
type ExtractMode,
|
||||
} from "./web-fetch-utils.js";
|
||||
import {
|
||||
CacheEntry,
|
||||
DEFAULT_CACHE_TTL_MINUTES,
|
||||
DEFAULT_TIMEOUT_SECONDS,
|
||||
normalizeCacheKey,
|
||||
@@ -34,6 +33,7 @@ import {
|
||||
resolveTimeoutSeconds,
|
||||
writeCache,
|
||||
} from "./web-shared.js";
|
||||
import type { CacheEntry } from "./web-shared.js";
|
||||
import { resolveWebFetchToolRuntimeContext } from "./web-tool-runtime-context.js";
|
||||
|
||||
const EXTRACT_MODES = ["markdown", "text"] as const;
|
||||
|
||||
@@ -4,7 +4,6 @@ import { createLazyImportLoader } from "../../shared/lazy-promise.js";
|
||||
import { normalizeLowercaseStringOrEmpty } from "../../shared/string-coerce.js";
|
||||
import { normalizeSecretInput } from "../../utils/normalize-secret-input.js";
|
||||
import {
|
||||
CacheEntry,
|
||||
DEFAULT_CACHE_TTL_MINUTES,
|
||||
DEFAULT_TIMEOUT_SECONDS,
|
||||
normalizeCacheKey,
|
||||
@@ -14,6 +13,7 @@ import {
|
||||
resolveTimeoutSeconds,
|
||||
writeCache,
|
||||
} from "./web-shared.js";
|
||||
import type { CacheEntry } from "./web-shared.js";
|
||||
|
||||
type WebGuardedFetchModule = Pick<
|
||||
typeof import("./web-guarded-fetch.js"),
|
||||
|
||||
@@ -513,9 +513,7 @@ function schemaAlternatives(
|
||||
|
||||
function schemaLooksArray(schema: JsonSchemaRecord): boolean {
|
||||
return (
|
||||
schemaTypes(schema).has("array") ||
|
||||
isSchemaRecord(schema.items) ||
|
||||
Array.isArray(schema.items)
|
||||
schemaTypes(schema).has("array") || isSchemaRecord(schema.items) || Array.isArray(schema.items)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import crypto from "node:crypto";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { Mock, vi } from "vitest";
|
||||
import { vi } from "vitest";
|
||||
import type { Mock } from "vitest";
|
||||
import type { GetReplyOptions } from "../auto-reply/get-reply-options.types.js";
|
||||
import type { ReplyPayload } from "../auto-reply/reply-payload.js";
|
||||
import type { MsgContext } from "../auto-reply/templating.js";
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"esModuleInterop": true,
|
||||
"experimentalDecorators": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"isolatedModules": true,
|
||||
"lib": ["DOM", "DOM.Iterable", "ES2023", "ScriptHost"],
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
@@ -21,6 +22,7 @@
|
||||
"target": "es2023",
|
||||
"types": ["node"],
|
||||
"useDefineForClassFields": false,
|
||||
"verbatimModuleSyntax": true,
|
||||
"paths": {
|
||||
"openclaw/extension-api": ["./src/extensionAPI.ts"],
|
||||
"openclaw/plugin-sdk": ["./src/plugin-sdk/index.ts"],
|
||||
|
||||
@@ -10,7 +10,8 @@ import {
|
||||
} from "./chat/session-controls.ts";
|
||||
import { refreshSlashCommands } from "./chat/slash-commands.ts";
|
||||
import { resolveControlUiAuthToken } from "./control-ui-auth.ts";
|
||||
import { ChatState, loadChatHistory } from "./controllers/chat.ts";
|
||||
import { loadChatHistory } from "./controllers/chat.ts";
|
||||
import type { ChatState } from "./controllers/chat.ts";
|
||||
import {
|
||||
createSessionAndRefresh,
|
||||
loadSessions,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChannelsStatusSnapshot } from "../types.ts";
|
||||
import type { ChannelsStatusSnapshot } from "../types.ts";
|
||||
import type { ChannelsState } from "./channels.types.ts";
|
||||
import {
|
||||
formatMissingOperatorReadScopeMessage,
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
} from "../../../../src/shared/usage-aggregates.js";
|
||||
import { t } from "../../i18n/index.ts";
|
||||
import { normalizeLowercaseStringOrEmpty } from "../string-coerce.ts";
|
||||
import { UsageSessionEntry, UsageTotals, UsageAggregates } from "./usageTypes.ts";
|
||||
import type { UsageSessionEntry, UsageTotals, UsageAggregates } from "./usageTypes.ts";
|
||||
|
||||
const CHARS_PER_TOKEN = 4;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { normalizeLowercaseStringOrEmpty } from "../string-coerce.ts";
|
||||
import { extractQueryTerms } from "../usage-helpers.ts";
|
||||
import { CostDailyEntry, UsageAggregates, UsageSessionEntry } from "./usageTypes.ts";
|
||||
import type { CostDailyEntry, UsageAggregates, UsageSessionEntry } from "./usageTypes.ts";
|
||||
|
||||
function downloadTextFile(filename: string, content: string, type = "text/plain") {
|
||||
const blob = new Blob([content], { type: `${type};charset=utf-8` });
|
||||
|
||||
@@ -5,7 +5,7 @@ import { normalizeLowercaseStringOrEmpty } from "../string-coerce.ts";
|
||||
import { parseToolSummary } from "../usage-helpers.ts";
|
||||
import { charsToTokens, formatCost, formatTokens } from "./usage-metrics.ts";
|
||||
import { renderInsightList } from "./usage-render-overview.ts";
|
||||
import {
|
||||
import type {
|
||||
SessionLogEntry,
|
||||
SessionLogRole,
|
||||
TimeSeriesPoint,
|
||||
|
||||
@@ -2,14 +2,9 @@ import { html, nothing } from "lit";
|
||||
import { formatDurationCompact } from "../../../../src/infra/format-time/format-duration.ts";
|
||||
import { t } from "../../i18n/index.ts";
|
||||
import { normalizeLowercaseStringOrEmpty } from "../string-coerce.ts";
|
||||
import {
|
||||
formatCost,
|
||||
formatDayLabel,
|
||||
formatFullDate,
|
||||
formatTokens,
|
||||
UsageInsightStats,
|
||||
} from "./usage-metrics.ts";
|
||||
import {
|
||||
import { formatCost, formatDayLabel, formatFullDate, formatTokens } from "./usage-metrics.ts";
|
||||
import type { UsageInsightStats } from "./usage-metrics.ts";
|
||||
import type {
|
||||
UsageAggregates,
|
||||
UsageColumnId,
|
||||
UsageSessionEntry,
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
renderSessionsCard,
|
||||
renderUsageInsights,
|
||||
} from "./usage-render-overview.ts";
|
||||
import {
|
||||
import type {
|
||||
SessionLogEntry,
|
||||
SessionLogRole,
|
||||
UsageColumnId,
|
||||
|
||||
Reference in New Issue
Block a user