mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 18:40:21 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
normalizeAccountId,
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
} from "./accounts.js";
|
||||
import type { MoltbotConfig } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
|
||||
describe("LINE accounts", () => {
|
||||
const originalEnv = { ...process.env };
|
||||
@@ -23,7 +23,7 @@ describe("LINE accounts", () => {
|
||||
|
||||
describe("resolveLineAccount", () => {
|
||||
it("resolves account from config", () => {
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
channels: {
|
||||
line: {
|
||||
enabled: true,
|
||||
@@ -48,7 +48,7 @@ describe("LINE accounts", () => {
|
||||
process.env.LINE_CHANNEL_ACCESS_TOKEN = "env-token";
|
||||
process.env.LINE_CHANNEL_SECRET = "env-secret";
|
||||
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
channels: {
|
||||
line: {
|
||||
enabled: true,
|
||||
@@ -64,7 +64,7 @@ describe("LINE accounts", () => {
|
||||
});
|
||||
|
||||
it("resolves named account", () => {
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
channels: {
|
||||
line: {
|
||||
enabled: true,
|
||||
@@ -90,7 +90,7 @@ describe("LINE accounts", () => {
|
||||
});
|
||||
|
||||
it("returns empty token when not configured", () => {
|
||||
const cfg: MoltbotConfig = {};
|
||||
const cfg: OpenClawConfig = {};
|
||||
|
||||
const account = resolveLineAccount({ cfg });
|
||||
|
||||
@@ -102,7 +102,7 @@ describe("LINE accounts", () => {
|
||||
|
||||
describe("listLineAccountIds", () => {
|
||||
it("returns default account when configured at base level", () => {
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
channels: {
|
||||
line: {
|
||||
channelAccessToken: "test-token",
|
||||
@@ -116,7 +116,7 @@ describe("LINE accounts", () => {
|
||||
});
|
||||
|
||||
it("returns named accounts", () => {
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
channels: {
|
||||
line: {
|
||||
accounts: {
|
||||
@@ -135,7 +135,7 @@ describe("LINE accounts", () => {
|
||||
|
||||
it("returns default from env", () => {
|
||||
process.env.LINE_CHANNEL_ACCESS_TOKEN = "env-token";
|
||||
const cfg: MoltbotConfig = {};
|
||||
const cfg: OpenClawConfig = {};
|
||||
|
||||
const ids = listLineAccountIds(cfg);
|
||||
|
||||
@@ -145,7 +145,7 @@ describe("LINE accounts", () => {
|
||||
|
||||
describe("resolveDefaultLineAccountId", () => {
|
||||
it("returns default when configured", () => {
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
channels: {
|
||||
line: {
|
||||
channelAccessToken: "test-token",
|
||||
@@ -159,7 +159,7 @@ describe("LINE accounts", () => {
|
||||
});
|
||||
|
||||
it("returns first named account when default not configured", () => {
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
channels: {
|
||||
line: {
|
||||
accounts: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import fs from "node:fs";
|
||||
import type { MoltbotConfig } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import type {
|
||||
LineConfig,
|
||||
LineAccountConfig,
|
||||
@@ -95,7 +95,7 @@ function resolveSecret(params: {
|
||||
}
|
||||
|
||||
export function resolveLineAccount(params: {
|
||||
cfg: MoltbotConfig;
|
||||
cfg: OpenClawConfig;
|
||||
accountId?: string;
|
||||
}): ResolvedLineAccount {
|
||||
const { cfg, accountId = DEFAULT_ACCOUNT_ID } = params;
|
||||
@@ -138,7 +138,7 @@ export function resolveLineAccount(params: {
|
||||
};
|
||||
}
|
||||
|
||||
export function listLineAccountIds(cfg: MoltbotConfig): string[] {
|
||||
export function listLineAccountIds(cfg: OpenClawConfig): string[] {
|
||||
const lineConfig = cfg.channels?.line as LineConfig | undefined;
|
||||
const accounts = lineConfig?.accounts;
|
||||
const ids = new Set<string>();
|
||||
@@ -162,7 +162,7 @@ export function listLineAccountIds(cfg: MoltbotConfig): string[] {
|
||||
return Array.from(ids);
|
||||
}
|
||||
|
||||
export function resolveDefaultLineAccountId(cfg: MoltbotConfig): string {
|
||||
export function resolveDefaultLineAccountId(cfg: OpenClawConfig): string {
|
||||
const ids = listLineAccountIds(cfg);
|
||||
if (ids.includes(DEFAULT_ACCOUNT_ID)) {
|
||||
return DEFAULT_ACCOUNT_ID;
|
||||
|
||||
@@ -8,7 +8,7 @@ import type {
|
||||
PostbackEvent,
|
||||
EventSource,
|
||||
} from "@line/bot-sdk";
|
||||
import type { MoltbotConfig } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { danger, logVerbose } from "../globals.js";
|
||||
import { resolvePairingIdLabel } from "../pairing/pairing-labels.js";
|
||||
import { buildPairingReply } from "../pairing/pairing-messages.js";
|
||||
@@ -33,7 +33,7 @@ interface MediaRef {
|
||||
}
|
||||
|
||||
export interface LineHandlerContext {
|
||||
cfg: MoltbotConfig;
|
||||
cfg: OpenClawConfig;
|
||||
account: ResolvedLineAccount;
|
||||
runtime: RuntimeEnv;
|
||||
mediaMaxBytes: number;
|
||||
|
||||
@@ -3,14 +3,14 @@ import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import type { MessageEvent, PostbackEvent } from "@line/bot-sdk";
|
||||
import type { MoltbotConfig } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import type { ResolvedLineAccount } from "./types.js";
|
||||
import { buildLineMessageContext, buildLinePostbackContext } from "./bot-message-context.js";
|
||||
|
||||
describe("buildLineMessageContext", () => {
|
||||
let tmpDir: string;
|
||||
let storePath: string;
|
||||
let cfg: MoltbotConfig;
|
||||
let cfg: OpenClawConfig;
|
||||
const account: ResolvedLineAccount = {
|
||||
accountId: "default",
|
||||
enabled: true,
|
||||
@@ -21,7 +21,7 @@ describe("buildLineMessageContext", () => {
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-line-context-"));
|
||||
tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-line-context-"));
|
||||
storePath = path.join(tmpDir, "sessions.json");
|
||||
cfg = { session: { store: storePath } };
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import type {
|
||||
import { formatInboundEnvelope, resolveEnvelopeFormatOptions } from "../auto-reply/envelope.js";
|
||||
import { finalizeInboundContext } from "../auto-reply/reply/inbound-context.js";
|
||||
import { formatLocationText, toLocationContext } from "../channels/location.js";
|
||||
import type { MoltbotConfig } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import {
|
||||
readSessionUpdatedAt,
|
||||
recordSessionMetaFromInbound,
|
||||
@@ -29,7 +29,7 @@ interface MediaRef {
|
||||
interface BuildLineMessageContextParams {
|
||||
event: MessageEvent;
|
||||
allMedia: MediaRef[];
|
||||
cfg: MoltbotConfig;
|
||||
cfg: OpenClawConfig;
|
||||
account: ResolvedLineAccount;
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ export async function buildLineMessageContext(params: BuildLineMessageContextPar
|
||||
|
||||
export async function buildLinePostbackContext(params: {
|
||||
event: PostbackEvent;
|
||||
cfg: MoltbotConfig;
|
||||
cfg: OpenClawConfig;
|
||||
account: ResolvedLineAccount;
|
||||
}) {
|
||||
const { event, cfg, account } = params;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { WebhookRequestBody } from "@line/bot-sdk";
|
||||
import type { MoltbotConfig } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { logVerbose } from "../globals.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
@@ -14,7 +14,7 @@ export interface LineBotOptions {
|
||||
channelSecret: string;
|
||||
accountId?: string;
|
||||
runtime?: RuntimeEnv;
|
||||
config?: MoltbotConfig;
|
||||
config?: OpenClawConfig;
|
||||
mediaMaxMb?: number;
|
||||
onMessage?: (ctx: LineInboundContext) => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { WebhookRequestBody } from "@line/bot-sdk";
|
||||
import type { IncomingMessage, ServerResponse } from "node:http";
|
||||
import type { MoltbotConfig } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { danger, logVerbose } from "../globals.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import { createLineBot } from "./bot.js";
|
||||
@@ -33,7 +33,7 @@ export interface MonitorLineProviderOptions {
|
||||
channelAccessToken: string;
|
||||
channelSecret: string;
|
||||
accountId?: string;
|
||||
config: MoltbotConfig;
|
||||
config: OpenClawConfig;
|
||||
runtime: RuntimeEnv;
|
||||
abortSignal?: AbortSignal;
|
||||
webhookUrl?: string;
|
||||
|
||||
@@ -37,9 +37,9 @@ describe("probeLineBot", () => {
|
||||
|
||||
it("returns bot info when available", async () => {
|
||||
getBotInfoMock.mockResolvedValue({
|
||||
displayName: "Moltbot",
|
||||
displayName: "OpenClaw",
|
||||
userId: "U123",
|
||||
basicId: "@moltbot",
|
||||
basicId: "@openclaw",
|
||||
pictureUrl: "https://example.com/bot.png",
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user