Comp AI CRM is an open source, CRM designed for AI agents. Agentic-first CRM.
TypeScript
fix(agent): let the assistant chat read the deal list it is told to use (CMP-77) (#139)
grime86a0fbe4076
diff --git a/apps/agent/agent/tools/list_deals.ts b/apps/agent/agent/tools/list_deals.tsindex 5f8bb3f8..1c0644f0 100644--- a/apps/agent/agent/tools/list_deals.ts+++ b/apps/agent/agent/tools/list_deals.ts@@ -1,7 +1,6 @@import { defineTool } from "eve/tools";import { z } from "zod";import { listDeals } from "../lib/lookup";-import { assertResearchPurpose } from "../lib/session-purpose";export default defineTool({description:@@ -22,8 +21,7 @@ export default defineTool({limit: z.number().int().min(1).max(100).default(50),cursor: z.string().optional(),}),- async execute(input, ctx) {- assertResearchPurpose(ctx);+ async execute(input) {return listDeals(input);},toModelOutput(output) {diff --git a/apps/agent/test/custom-agent-runtime.spec.ts b/apps/agent/test/custom-agent-runtime.spec.tsindex 4ae56168..330d2a58 100644--- a/apps/agent/test/custom-agent-runtime.spec.ts+++ b/apps/agent/test/custom-agent-runtime.spec.ts@@ -158,6 +158,15 @@ describe("session purpose boundaries", () => {expect(() => assertResearchPurpose(context("team-agent"))).toThrow();});+ it("leaves the read-only deal list open to the assistant chat that is told to use it", async () => {+ const source = await Bun.file(+ new URL("../agent/tools/list_deals.ts", import.meta.url),+ ).text();++ expect(source).not.toContain("assertResearchPurpose");+ expect(builderTaskMarkdown(null)).toContain("list_deals");+ });+it("binds specialist tools to their explicit session purpose", () => {expect(requireBuilderAttribute(