feat: upgrade investigation and presentation runtime
This commit is contained in:
@@ -163,7 +163,7 @@ describe("OpencodeRuntimeAdapter.generateText", () => {
|
||||
}) as OpencodeRuntimeAdapter;
|
||||
try {
|
||||
expect(await runtime.generateText("recommend questions", { providerID: "test", modelID: "fast" }, controller.signal)).toBe("generated suggestions");
|
||||
expect(calls[0]).toMatchObject({ model: { providerID: "test", id: "fast" } });
|
||||
expect(calls[0]).toMatchObject({ agent: "prompt-suggestions", model: { providerID: "test", id: "fast" }, permissions: [{ action: "*", resource: "*", effect: "deny" }] });
|
||||
expect(calls[1]).toBe("catalog ready");
|
||||
expect(calls[2]).toEqual({ input: { sessionID: "temporary-generator", prompt: "recommend questions" }, signal: controller.signal });
|
||||
expect(calls[3]).toEqual({ sessionID: "temporary-generator" });
|
||||
@@ -225,7 +225,7 @@ describe("resolveEmbeddedOpencodePort", () => {
|
||||
});
|
||||
|
||||
describe("OpencodeRuntimeAdapter.warmup", () => {
|
||||
const toolIds = [...PRODUCT_MCP_TOOL_IDS, ...LOCAL_QUERY_TOOL_IDS, "websearch", "shell", "final_answer", "present_answer", "locate_features", "zoom_to_map", "show_chart", "view_history", "memory_manager", "skill_manager", "render_scada_analysis", "clear_scada_analysis", "publish_execution_plan", "publish_task_report", "publish_task_progress", "publish_task_presentation", "propose_task_action", "add_task_human_evidence", "request_task_data_access", "todowrite", "send_task_message", "reply_agent_message"];
|
||||
const toolIds = [...PRODUCT_MCP_TOOL_IDS, ...LOCAL_QUERY_TOOL_IDS, "websearch", "shell", "ask_user", "ask_task_user", "final_answer", "present_answer", "memory_manager", "skill_manager", "present_view", "publish_execution_plan", "publish_task_report", "publish_task_progress", "publish_task_presentation", "propose_task_action", "add_task_human_evidence", "request_task_data_access", "todowrite", "send_task_message", "reply_agent_message"];
|
||||
async function createWarmupRuntime(missing: string[] = [], invalidModel?: string, delayedMcp = false,
|
||||
search: { providers?: readonly string[]; selection?: false | { provider: string }; unavailable?: boolean; extraTools?: readonly string[] } = {}) {
|
||||
const root = await mkdtemp(join(tmpdir(), "warmup-workspace-test-"));
|
||||
@@ -300,8 +300,8 @@ describe("OpencodeRuntimeAdapter.warmup", () => {
|
||||
} finally { await cleanup(); }
|
||||
});
|
||||
it("fails readiness if a business tool was lost and still cleans up", async () => {
|
||||
const { runtime, calls, cleanup } = await createWarmupRuntime(["render_scada_analysis"]);
|
||||
try { await expect(runtime.warmup()).rejects.toThrow("business tools missing: render_scada_analysis");
|
||||
const { runtime, calls, cleanup } = await createWarmupRuntime(["present_view"]);
|
||||
try { await expect(runtime.warmup()).rejects.toThrow("business tools missing: present_view");
|
||||
expect(calls.at(-1)).toBe("session.remove"); } finally { await cleanup(); }
|
||||
});
|
||||
it("waits for native MCP catalog publication before reporting ready", async () => {
|
||||
@@ -313,9 +313,9 @@ describe("OpencodeRuntimeAdapter.warmup", () => {
|
||||
} finally { await cleanup(); }
|
||||
});
|
||||
it("rejects an invalid non-default model before readiness and cleans up the session", async () => {
|
||||
const { runtime, calls, cleanup } = await createWarmupRuntime([], "waternetwork/gpt-6.1-sol");
|
||||
const { runtime, calls, cleanup } = await createWarmupRuntime([], "waternetwork/gpt-5.6-sol");
|
||||
try {
|
||||
await expect(runtime.warmup()).rejects.toThrow("waternetwork/gpt-6.1-sol: not_advertised");
|
||||
await expect(runtime.warmup()).rejects.toThrow("waternetwork/gpt-5.6-sol: not_advertised");
|
||||
expect(calls).not.toContain("model.list");
|
||||
expect(calls.at(-1)).toBe("session.remove");
|
||||
} finally { await cleanup(); }
|
||||
|
||||
Reference in New Issue
Block a user