Skip to content

Commit db39bbb

Browse files
authored
feat(monaco): add Monaco CRM integration (#10009)
* feat(monaco): add Monaco CRM integration Adds 46 Monaco tools (contacts, accounts, opportunities, pipelines, tasks, meetings, messages, conversations, tags, users, field schemas, sequences, audiences, campaigns), a Monaco block, and a saved Monaco API key credential verified against GET /v1/me. * fix(monaco): use toRecordOrNull and type the block mapper test helpers * fix(monaco): allow clearing tags on update and reject empty audience filter groups at any depth
1 parent 30f6b8e commit db39bbb

75 files changed

Lines changed: 11899 additions & 6 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/docs/components/icons.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5800,6 +5800,17 @@ export function MondayIcon(props: SVGProps<SVGSVGElement>) {
58005800
)
58015801
}
58025802

5803+
export function MonacoIcon(props: SVGProps<SVGSVGElement>) {
5804+
return (
5805+
<svg {...props} viewBox='0 0 23.8955 23.8906' fill='none' xmlns='http://www.w3.org/2000/svg'>
5806+
<path
5807+
fill='currentColor'
5808+
d='M17.728 7.956C18.612 7.85 21.884 7.823 22.629 8.089C23.283 8.323 23.755 8.986 23.816 9.668C23.923 10.866 23.922 13.203 23.816 14.402C23.756 15.08 23.18 15.822 22.497 15.938C21.059 16.179 18.106 15.598 16.944 16.181C16.694 16.306 16.35 16.633 16.212 16.877C15.599 17.961 16.182 21.091 15.943 22.493C15.815 23.24 15.134 23.745 14.406 23.811C13.211 23.917 10.867 23.918 9.672 23.811C8.978 23.748 8.311 23.301 8.095 22.624C7.851 21.856 7.824 17.956 8.049 17.187C8.148 16.849 8.5 16.426 8.798 16.241C9.784 15.631 13.141 16.105 14.492 15.96C15.158 15.889 15.864 15.236 15.955 14.569C16.146 13.166 15.595 9.761 16.282 8.741C16.626 8.23 17.131 8.028 17.727 7.957L17.728 7.956ZM9.446 0.081C10.54 -0.041 13.425 -0.013 14.314 0.087C15.51 0.222 15.893 1.209 15.967 2.268C16.03 3.174 16.076 6.177 15.778 6.901C15.688 7.119 15.349 7.486 15.155 7.617C14.136 8.304 10.728 7.753 9.327 7.943C8.661 8.034 8.008 8.741 7.937 9.406C7.792 10.758 8.265 14.116 7.655 15.101C7.269 15.722 6.63 15.912 5.934 15.966C5.006 16.039 1.971 16.073 1.212 15.775C0.683 15.568 0.174 14.959 0.096 14.394C-0.048 13.343 -0.011 10.591 0.085 9.493C0.145 8.816 0.72 8.072 1.403 7.957C2.84 7.715 5.794 8.297 6.956 7.714C7.206 7.588 7.549 7.263 7.688 7.019C8.331 5.883 7.672 2.765 7.976 1.331C8.097 0.759 8.673 0.207 9.251 0.108L9.446 0.081Z'
5809+
/>
5810+
</svg>
5811+
)
5812+
}
5813+
58035814
export function ModalIcon(props: SVGProps<SVGSVGElement>) {
58045815
const id = useId()
58055816
const leftHighlight = `modal_left_highlight_${id}`

‎apps/docs/components/ui/icon-mapping.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ import {
195195
MintlifyIcon,
196196
MistralIcon,
197197
ModalIcon,
198+
MonacoIcon,
198199
MondayIcon,
199200
MongoDBIcon,
200201
MySQLIcon,
@@ -626,6 +627,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
626627
mistral_parse_v2: MistralIcon,
627628
mistral_parse_v3: MistralIcon,
628629
modal: ModalIcon,
630+
monaco: MonacoIcon,
629631
monday: MondayIcon,
630632
mongodb: MongoDBIcon,
631633
mothership: Blimp,

‎apps/docs/content/docs/integrations/meta.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
"mintlify",
186186
"mistral_parse",
187187
"modal",
188+
"monaco",
188189
"monday",
189190
"monday-service-account",
190191
"mongodb",

‎apps/docs/content/docs/integrations/monaco.mdx‎

Lines changed: 2101 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/**
2+
* Workflow runs hand a tool `{ ...rawInputs, ...mappedParams }`, so the mapper must clear
3+
* values another operation left in a shared subBlock. Agent tool calls pass the operation in
4+
* context and supply arguments under tool param names, which the mapper must keep.
5+
*/
6+
import { describe, expect, it } from 'vitest'
7+
import { MonacoBlock } from '@/blocks/blocks/monaco'
8+
import { monacoCreateTagTool } from '@/tools/monaco/create_tag'
9+
import { monacoCreateTaskTool } from '@/tools/monaco/create_task'
10+
import { monacoUpdateSequenceTool } from '@/tools/monaco/update_sequence'
11+
import type { ToolConfig } from '@/tools/types'
12+
13+
const CREDENTIAL = { oauthCredential: 'cred-1', accessToken: 'mks_test' }
14+
15+
function requestBody(tool: ToolConfig, params: Record<string, unknown>) {
16+
const body = tool.request.body
17+
if (typeof body !== 'function') throw new Error(`${tool.id} has no request body`)
18+
return body(params)
19+
}
20+
21+
function workflowParams(inputs: Record<string, unknown>): Record<string, unknown> {
22+
const mapped = MonacoBlock.tools.config?.params?.(inputs) ?? {}
23+
return { ...inputs, ...mapped, accessToken: CREDENTIAL.accessToken }
24+
}
25+
26+
function agentParams(operation: string, args: Record<string, unknown>): Record<string, unknown> {
27+
const inputs = { ...CREDENTIAL, ...args }
28+
const mapped = MonacoBlock.tools.config?.params?.(inputs, { operation }) ?? {}
29+
return { ...inputs, ...mapped, accessToken: CREDENTIAL.accessToken }
30+
}
31+
32+
describe('Monaco block parameter mapping', () => {
33+
it('sends the task title, not a job title left in the contact Title field', () => {
34+
const params = workflowParams({
35+
...CREDENTIAL,
36+
operation: 'monaco_create_task',
37+
title: 'VP Sales',
38+
taskTitle: 'Call Ada',
39+
})
40+
expect(requestBody(monacoCreateTaskTool, params)).toEqual({ title: 'Call Ada' })
41+
})
42+
43+
it('drops a contact job title when the task title is empty', () => {
44+
const params = workflowParams({
45+
...CREDENTIAL,
46+
operation: 'monaco_create_task',
47+
title: 'VP Sales',
48+
taskTitle: '',
49+
})
50+
expect(params.title).toBeUndefined()
51+
})
52+
53+
it('keeps agent arguments named after tool params', () => {
54+
const tag = agentParams('monaco_create_tag', {
55+
object: 'accounts',
56+
name: 'Hot Lead',
57+
color: 'red',
58+
})
59+
expect(requestBody(monacoCreateTagTool, tag)).toEqual({
60+
object: 'accounts',
61+
name: 'Hot Lead',
62+
color: 'red',
63+
})
64+
65+
const sequence = agentParams('monaco_update_sequence', {
66+
sequenceId: '0b2c7c1e-4d0a-4c8e-9a51-2f4f3e6a7b10',
67+
action: 'pause',
68+
})
69+
expect(requestBody(monacoUpdateSequenceTool, sequence)).toEqual({ action: 'pause' })
70+
})
71+
})

0 commit comments

Comments
 (0)