mirror of
http://192.168.0.88:13333/lywsvip/openclaw-zero-token.git
synced 2026-05-09 00:34:04 +08:00
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
import { setActivePluginRegistry } from "../plugins/runtime.js";
|
|
import {
|
|
createBindingResolverTestPlugin,
|
|
createTestRegistry,
|
|
} from "../test-utils/channel-plugins.js";
|
|
import {
|
|
loadFreshAgentsCommandModuleForTest,
|
|
readConfigFileSnapshotMock,
|
|
resetAgentsBindTestHarness,
|
|
runtime,
|
|
writeConfigFileMock,
|
|
} from "./agents.bind.test-support.js";
|
|
import { setDefaultChannelPluginRegistryForTests } from "./channel-test-helpers.js";
|
|
import { baseConfigSnapshot } from "./test-runtime-config-helpers.js";
|
|
|
|
const matrixBindingPlugin = createBindingResolverTestPlugin({
|
|
id: "matrix",
|
|
resolveBindingAccountId: ({ accountId, agentId }) => {
|
|
const explicit = accountId?.trim();
|
|
if (explicit) {
|
|
return explicit;
|
|
}
|
|
const agent = agentId?.trim();
|
|
return agent || "default";
|
|
},
|
|
});
|
|
|
|
let agentsBindCommand: typeof import("./agents.js").agentsBindCommand;
|
|
|
|
describe("agents bind matrix integration", () => {
|
|
beforeEach(async () => {
|
|
({ agentsBindCommand } = await loadFreshAgentsCommandModuleForTest());
|
|
resetAgentsBindTestHarness();
|
|
|
|
setActivePluginRegistry(
|
|
createTestRegistry([{ pluginId: "matrix", plugin: matrixBindingPlugin, source: "test" }]),
|
|
);
|
|
});
|
|
|
|
afterEach(() => {
|
|
setDefaultChannelPluginRegistryForTests();
|
|
});
|
|
|
|
it("uses matrix plugin binding resolver when accountId is omitted", async () => {
|
|
readConfigFileSnapshotMock.mockResolvedValue({
|
|
...baseConfigSnapshot,
|
|
config: {},
|
|
});
|
|
|
|
await agentsBindCommand({ agent: "main", bind: ["matrix"] }, runtime);
|
|
|
|
expect(writeConfigFileMock).toHaveBeenCalledWith(
|
|
expect.objectContaining({
|
|
bindings: [
|
|
{ type: "route", agentId: "main", match: { channel: "matrix", accountId: "main" } },
|
|
],
|
|
}),
|
|
);
|
|
expect(runtime.exit).not.toHaveBeenCalled();
|
|
});
|
|
});
|