{"version":3,"file":"context-integration.test.d.ts","sourceRoot":"","sources":["../../../src/core/web-research/context-integration.test.ts"],"names":[],"mappings":"","sourcesContent":["import { buildCacheStableContext } from \"@apholdings/jensen-agent-core\";\nimport type { Message, ToolResultMessage } from \"@apholdings/jensen-ai\";\nimport { describe, expect, it } from \"vitest\";\nimport { createDeepResearchTool } from \"../tools/deep-research.js\";\nimport { createWebFetchTool } from \"../tools/web-fetch.js\";\nimport { createWebSearchTool } from \"../tools/web-search.js\";\n\ndescribe(\"web research context-engine integration\", () => {\n\tit(\"keeps deterministic tool schemas stable while web results remain dynamic\", async () => {\n\t\tconst tools = [createWebSearchTool(), createWebFetchTool(), createDeepResearchTool()];\n\t\tconst firstMessages: Message[] = [{ role: \"user\", content: \"first query\", timestamp: 1 }];\n\t\tconst webResult: ToolResultMessage = {\n\t\t\trole: \"toolResult\",\n\t\t\ttoolCallId: \"web-1\",\n\t\t\ttoolName: \"web_fetch\",\n\t\t\tcontent: [{ type: \"text\", text: \"untrusted evidence reference web-abc\" }],\n\t\t\tdetails: { evidenceId: \"web-abc\", completeContent: \"large durable page\".repeat(100) },\n\t\t\tisError: false,\n\t\t\ttimestamp: 2,\n\t\t};\n\t\tconst secondMessages: Message[] = [{ role: \"user\", content: \"second query\", timestamp: 3 }, webResult];\n\t\tconst first = await buildCacheStableContext({\n\t\t\tsystemPrompt: \"stable\",\n\t\t\tmessages: firstMessages,\n\t\t\ttools,\n\t\t\tprovider: \"test\",\n\t\t\tmodel: \"test\",\n\t\t});\n\t\tconst second = await buildCacheStableContext({\n\t\t\tsystemPrompt: \"stable\",\n\t\t\tmessages: secondMessages,\n\t\t\ttools: [...tools].reverse(),\n\t\t\tprovider: \"test\",\n\t\t\tmodel: \"test\",\n\t\t});\n\t\texpect(first.snapshot.prefixFingerprint).toBe(second.snapshot.prefixFingerprint);\n\t\texpect(first.snapshot.dynamicSuffixBytes).not.toBe(second.snapshot.dynamicSuffixBytes);\n\t\texpect(second.stablePrefix.systemPrompt).not.toContain(\"large durable page\");\n\t});\n});\n"]}