Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/customer-context-slack-source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@outlit/tools": patch
---

Add Slack as a supported customer-context search source type.
4 changes: 3 additions & 1 deletion packages/tools/src/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const customerSourceTypes = [
"CALENDAR_EVENT",
"SUPPORT_TICKET",
"OPPORTUNITY",
"SLACK",
] as const

export const customerSourceTypeAliases = ["CRM", "CRM_OPPORTUNITY"] as const
Expand All @@ -34,6 +35,7 @@ export const customerSourceTypeInputs = [
"CALENDAR_EVENT",
"SUPPORT_TICKET",
"OPPORTUNITY",
"SLACK",
"CRM",
"CRM_OPPORTUNITY",
] as const
Expand Down Expand Up @@ -913,7 +915,7 @@ export const workspaceUserListOrderFields = ["name", "email", "owned_customer_co
export const schemaTables = ["activity", "customers", "users", "revenue"] as const

export const customerToolContractHash =
"d704edcb21910caaceef9ce2046e7e27c395ba3c0e286206368c82c716bd1e5a" as const
"fae5d47c73e2401362019f27f85925d36d3d87485611af0753f4a3bee2b002ae" as const

export type CustomerToolName = (typeof customerToolNames)[number]
export type CustomerSourceType = (typeof customerSourceTypes)[number]
Expand Down
25 changes: 22 additions & 3 deletions packages/tools/tests/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,22 @@ describe("tool contracts", () => {
expect(properties.factCategories?.items?.enum).not.toContain("JOURNEY")
})

test("exposes opportunity as the canonical CRM source type with aliases for inputs", () => {
test("exposes canonical source types with CRM aliases for inputs", () => {
expect(customerSourceTypes).toEqual([
"EMAIL",
"CALL",
"CALENDAR_EVENT",
"SUPPORT_TICKET",
"OPPORTUNITY",
"SLACK",
])
expect(customerSourceTypeInputs).toEqual([
"EMAIL",
"CALL",
"CALENDAR_EVENT",
"SUPPORT_TICKET",
"OPPORTUNITY",
"SLACK",
"CRM",
"CRM_OPPORTUNITY",
])
Expand Down Expand Up @@ -331,7 +333,24 @@ describe("resolveCustomerContextSearchInput", () => {
})
})

test("normalizes CRM source aliases in search input", () => {
test("normalizes source types and CRM aliases in search input", () => {
expect(
resolveCustomerContextSearchInput({
query: "renewal",
sourceTypes: ["slack"],
}),
).toEqual({
ok: true,
request: {
query: "renewal",
customer: undefined,
topK: undefined,
after: undefined,
before: undefined,
sourceTypes: ["SLACK"],
},
})

expect(
resolveCustomerContextSearchInput({
query: "renewal",
Expand Down Expand Up @@ -374,7 +393,7 @@ describe("resolveCustomerContextSearchInput", () => {
).toEqual({
ok: false,
message:
"Unknown source types: ZENDESK_TICKET. Allowed: EMAIL, CALL, CALENDAR_EVENT, SUPPORT_TICKET, OPPORTUNITY, CRM, CRM_OPPORTUNITY",
"Unknown source types: ZENDESK_TICKET. Allowed: EMAIL, CALL, CALENDAR_EVENT, SUPPORT_TICKET, OPPORTUNITY, SLACK, CRM, CRM_OPPORTUNITY",
})
})
})