feat(agent): use deepseek flash for complete SCADA investigations
Generic Container CI/CD / test-build-publish (push) Successful in 1m39s
Agent CI/CD / build-test-publish-and-deploy (push) Successful in 1m39s

This commit is contained in:
2026-11-07 21:15:01 +08:00
parent e1ca2f56f9
commit d8eb29466a
6 changed files with 45 additions and 16 deletions
+9 -7
View File
@@ -156,19 +156,21 @@ describe("agent model config", () => {
});
it("exposes only the two configured gateway models with their roles, icons and context limits", () => {
expect(supportedModels).toEqual(["waternetwork/gpt-5.6-terra", "waternetwork/gpt-5.6-sol"]);
expect(supportedModels).toEqual(["waternetwork/deepseek-flash", "waternetwork/gpt-6.1-sol"]);
expect(agentModelOptions.map(({ id, label, icon }) => ({ id, label, icon }))).toEqual([
{ id: "waternetwork/gpt-5.6-terra", label: "快速", icon: "bolt" },
{ id: "waternetwork/gpt-5.6-sol", label: "专家", icon: "sparkle" },
{ id: "waternetwork/deepseek-flash", label: "快速", icon: "bolt" },
{ id: "waternetwork/gpt-6.1-sol", label: "专家", icon: "sparkle" },
]);
expect(isSupportedModel("deepseek/deepseek-flash")).toBe(false);
expect(isSupportedModel("waternetwork/deepseek-flash")).toBe(false);
expect(isSupportedModel("waternetwork/deepseek-flash")).toBe(true);
expect(isSupportedModel("waternetwork/gpt-5.6-terra")).toBe(false);
expect(isSupportedModel("waternetwork/gpt-5.6-sol")).toBe(false);
expect(isSupportedModel("waternetwork/gpt-image-2.5")).toBe(false);
expect(isSupportedModel("waternetwork/codex-auto-review")).toBe(false);
const native = serviceOpencodeConfig({});
expect(Object.keys(native.providers)).toEqual(["waternetwork"]);
expect(native.model).toBe("waternetwork/gpt-5.6-terra");
expect(native.providers.waternetwork.models["gpt-5.6-terra"].limit?.context).toBe(272000);
expect(native.providers.waternetwork.models["gpt-5.6-sol"].limit?.context).toBe(475000);
expect(native.model).toBe("waternetwork/deepseek-flash");
expect(native.providers.waternetwork.models["deepseek-flash"].limit?.context).toBe(272000);
expect(native.providers.waternetwork.models["gpt-6.1-sol"].limit?.context).toBe(475000);
});
});
+24
View File
@@ -17,6 +17,30 @@ afterEach(async () => {
});
const productTool: Tool = { name: "get_task_context", description: "Bound task", inputSchema: { type: "object", properties: { report_revision: { type: "integer", minimum: 1 } }, additionalProperties: false } };
it("delivers complete SCADA metadata and observations through native MCP without narrowing device scope", async () => {
const data = {
devices: Array.from({ length: 168 }, (_, index) => ({ device_id: `D${index}`, node_id: `J${index}`, description: "x".repeat(100) })),
readings: Array.from({ length: 2184 }, (_, index) => ({ device_id: `D${index % 168}`, monitored_value: index, cleaned_value: null })),
coverage: { mode: "all_scada", query_complete: true, queried_device_count: 168, reading_count: 2184 },
};
const upstream = { content: [{ type: "text" as const, text: JSON.stringify(data) }], structuredContent: {
source: "query_scada_readings", evidence_id: "mcp:all-scada", data, truncated: false,
} };
const query = mock(async () => upstream);
const tool: Tool = { name: "query_scada_readings", inputSchema: { type: "object", properties: {
start: { type: "string" }, end: { type: "string" },
device_ids: { type: "array", items: { type: "string" }, maxItems: 20 },
}, required: ["start", "end"], additionalProperties: false } };
const { call } = await setup({ productTools: [tool], productClient: { query } });
setRuntimeSessionContext({ ...owner, purpose: "task_execution", taskId: "scada-task" });
const args = { start: "2026-07-16T05:00:00+08:00", end: "2026-07-16T08:00:00+08:00" };
const result = await call("query_scada_readings", args);
expect(result.isError).not.toBeTrue();
expect((query.mock.calls[0] as unknown as unknown[])[3]).toEqual(args);
expect(result.structuredContent).toEqual(upstream.structuredContent);
expect(JSON.stringify(result.structuredContent).length).toBeGreaterThan(12000);
});
it("hides HTTP budgets from models and fixes the native connection ceiling", async () => {
const simulation: Tool = { name: "run_simulation", inputSchema: { type: "object", properties: {
timeout_seconds: { type: "integer", minimum: 1, maximum: 240, default: 120 },
+2 -2
View File
@@ -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-5.6-sol");
const { runtime, calls, cleanup } = await createWarmupRuntime([], "waternetwork/gpt-6.1-sol");
try {
await expect(runtime.warmup()).rejects.toThrow("waternetwork/gpt-5.6-sol: not_advertised");
await expect(runtime.warmup()).rejects.toThrow("waternetwork/gpt-6.1-sol: not_advertised");
expect(calls).not.toContain("model.list");
expect(calls.at(-1)).toBe("session.remove");
} finally { await cleanup(); }