mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:00:42 +00:00
test: route extension tests through sdk subpaths
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import type { HarnessContextEngine as ContextEngine } from "openclaw/plugin-sdk/agent-harness-runtime";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { ContextEngine } from "../../../../src/context-engine/types.js";
|
||||
import type { CodexAppServerClient } from "./client.js";
|
||||
import { maybeCompactCodexAppServerSession, __testing } from "./compact.js";
|
||||
import type { CodexServerNotification } from "./protocol.js";
|
||||
|
||||
@@ -3,8 +3,8 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { SessionManager } from "@mariozechner/pi-coding-agent";
|
||||
import type { EmbeddedRunAttemptParams } from "openclaw/plugin-sdk/agent-harness";
|
||||
import { isSilentReplyPayloadText } from "openclaw/plugin-sdk/reply-chunking";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { isSilentReplyPayloadText } from "../../../../src/auto-reply/tokens.js";
|
||||
import { DELIVERY_NO_REPLY_RUNTIME_CONTRACT } from "../../../../test/helpers/agents/delivery-no-reply-runtime-contract.js";
|
||||
import { CodexAppServerEventProjector } from "./event-projector.js";
|
||||
import { createCodexTestModel } from "./test-support.js";
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import type { AgentToolResult } from "@mariozechner/pi-agent-core";
|
||||
import type { AnyAgentTool } from "openclaw/plugin-sdk/agent-harness";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { wrapToolWithBeforeToolCallHook } from "../../../../src/agents/pi-tools.before-tool-call.js";
|
||||
import { wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
||||
import {
|
||||
initializeGlobalHookRunner,
|
||||
resetGlobalHookRunner,
|
||||
} from "../../../../src/plugins/hook-runner-global.js";
|
||||
import { createMockPluginRegistry } from "../../../../src/plugins/hooks.test-helpers.js";
|
||||
import { createEmptyPluginRegistry } from "../../../../src/plugins/registry.js";
|
||||
import { setActivePluginRegistry } from "../../../../src/plugins/runtime.js";
|
||||
} from "openclaw/plugin-sdk/hook-runtime";
|
||||
import {
|
||||
createEmptyPluginRegistry,
|
||||
createMockPluginRegistry,
|
||||
setActivePluginRegistry,
|
||||
} from "openclaw/plugin-sdk/testing";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { createCodexDynamicToolBridge } from "./dynamic-tools.js";
|
||||
import type { JsonValue } from "./protocol.js";
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { SessionManager } from "@mariozechner/pi-coding-agent";
|
||||
import type { EmbeddedRunAttemptParams } from "openclaw/plugin-sdk/agent-harness";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { resetAgentEventsForTest } from "../../../../src/infra/agent-events.js";
|
||||
import { resetAgentEventsForTest } from "openclaw/plugin-sdk/agent-harness-runtime";
|
||||
import {
|
||||
initializeGlobalHookRunner,
|
||||
resetGlobalHookRunner,
|
||||
} from "../../../../src/plugins/hook-runner-global.js";
|
||||
import { createMockPluginRegistry } from "../../../../src/plugins/hooks.test-helpers.js";
|
||||
} from "openclaw/plugin-sdk/hook-runtime";
|
||||
import { createMockPluginRegistry } from "openclaw/plugin-sdk/testing";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
CodexAppServerEventProjector,
|
||||
type CodexAppServerToolTelemetry,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AnyAgentTool } from "openclaw/plugin-sdk/agent-harness";
|
||||
import { wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { wrapToolWithBeforeToolCallHook } from "../../../../src/agents/pi-tools.before-tool-call.js";
|
||||
import {
|
||||
installCodexToolResultMiddleware,
|
||||
installOpenClawOwnedToolHooks,
|
||||
|
||||
@@ -3,8 +3,8 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { SessionManager } from "@mariozechner/pi-coding-agent";
|
||||
import type { EmbeddedRunAttemptParams } from "openclaw/plugin-sdk/agent-harness";
|
||||
import { classifyEmbeddedPiRunResultForModelFallback } from "openclaw/plugin-sdk/agent-harness-runtime";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { classifyEmbeddedPiRunResultForModelFallback } from "../../../../src/agents/pi-embedded-runner/result-fallback-classifier.js";
|
||||
import {
|
||||
createContractRunResult,
|
||||
OUTCOME_FALLBACK_RUNTIME_CONTRACT,
|
||||
|
||||
@@ -4,9 +4,11 @@ import path from "node:path";
|
||||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import { SessionManager } from "@mariozechner/pi-coding-agent";
|
||||
import type { EmbeddedRunAttemptParams } from "openclaw/plugin-sdk/agent-harness";
|
||||
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
||||
import {
|
||||
embeddedAgentLog,
|
||||
type HarnessContextEngine as ContextEngine,
|
||||
} from "openclaw/plugin-sdk/agent-harness-runtime";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { ContextEngine } from "../../../../src/context-engine/types.js";
|
||||
import type { CodexServerNotification } from "./protocol.js";
|
||||
import { runCodexAppServerAttempt, __testing } from "./run-attempt.js";
|
||||
import { createCodexTestModel } from "./test-support.js";
|
||||
@@ -168,16 +170,7 @@ function createStartedThreadHarness(
|
||||
};
|
||||
}
|
||||
|
||||
type MockContextEngine = ContextEngine & {
|
||||
bootstrap: ReturnType<typeof vi.fn>;
|
||||
assemble: ReturnType<typeof vi.fn>;
|
||||
maintain: ReturnType<typeof vi.fn>;
|
||||
afterTurn?: ReturnType<typeof vi.fn>;
|
||||
ingestBatch?: ReturnType<typeof vi.fn>;
|
||||
ingest?: ReturnType<typeof vi.fn>;
|
||||
};
|
||||
|
||||
function createContextEngine(overrides: Partial<ContextEngine> = {}): MockContextEngine {
|
||||
function createContextEngine(overrides: Partial<ContextEngine> = {}): ContextEngine {
|
||||
const engine: ContextEngine = {
|
||||
info: {
|
||||
id: "lossless-claw",
|
||||
@@ -199,7 +192,7 @@ function createContextEngine(overrides: Partial<ContextEngine> = {}): MockContex
|
||||
})),
|
||||
...overrides,
|
||||
};
|
||||
return engine as MockContextEngine;
|
||||
return engine;
|
||||
}
|
||||
|
||||
describe("runCodexAppServerAttempt context-engine lifecycle", () => {
|
||||
|
||||
@@ -7,19 +7,19 @@ import {
|
||||
queueAgentHarnessMessage,
|
||||
type EmbeddedRunAttemptParams,
|
||||
} from "openclaw/plugin-sdk/agent-harness";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { __testing as nativeHookRelayTesting } from "../../../../src/agents/harness/native-hook-relay.js";
|
||||
import { buildAgentRuntimePlan } from "../../../../src/agents/runtime-plan/build.js";
|
||||
import {
|
||||
buildAgentRuntimePlan,
|
||||
nativeHookRelayTesting,
|
||||
onAgentEvent,
|
||||
resetAgentEventsForTest,
|
||||
type AgentEventPayload,
|
||||
} from "../../../../src/infra/agent-events.js";
|
||||
} from "openclaw/plugin-sdk/agent-harness-runtime";
|
||||
import {
|
||||
initializeGlobalHookRunner,
|
||||
resetGlobalHookRunner,
|
||||
} from "../../../../src/plugins/hook-runner-global.js";
|
||||
import { createMockPluginRegistry } from "../../../../src/plugins/hooks.test-helpers.js";
|
||||
} from "openclaw/plugin-sdk/hook-runtime";
|
||||
import { createMockPluginRegistry } from "openclaw/plugin-sdk/testing";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { CODEX_GPT5_BEHAVIOR_CONTRACT } from "../../prompt-overlay.js";
|
||||
import * as elicitationBridge from "./elicitation-bridge.js";
|
||||
import type { CodexServerNotification } from "./protocol.js";
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import {
|
||||
castAgentMessage,
|
||||
makeAgentAssistantMessage,
|
||||
makeAgentUserMessage,
|
||||
} from "../../../../src/agents/test-helpers/agent-message-fixtures.js";
|
||||
import {
|
||||
initializeGlobalHookRunner,
|
||||
resetGlobalHookRunner,
|
||||
} from "../../../../src/plugins/hook-runner-global.js";
|
||||
import { createMockPluginRegistry } from "../../../../src/plugins/hooks.test-helpers.js";
|
||||
} from "openclaw/plugin-sdk/hook-runtime";
|
||||
import {
|
||||
castAgentMessage,
|
||||
createMockPluginRegistry,
|
||||
makeAgentAssistantMessage,
|
||||
makeAgentUserMessage,
|
||||
} from "openclaw/plugin-sdk/testing";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { mirrorCodexAppServerTranscript } from "./transcript-mirror.js";
|
||||
|
||||
const tempDirs: string[] = [];
|
||||
|
||||
Reference in New Issue
Block a user