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
11 changes: 11 additions & 0 deletions apps/docs/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5800,6 +5800,17 @@ export function MondayIcon(props: SVGProps<SVGSVGElement>) {
)
}

export function MonacoIcon(props: SVGProps<SVGSVGElement>) {
return (
<svg {...props} viewBox='0 0 23.8955 23.8906' fill='none' xmlns='http://www.w3.org/2000/svg'>
<path
fill='currentColor'
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'
/>
</svg>
)
}

export function ModalIcon(props: SVGProps<SVGSVGElement>) {
const id = useId()
const leftHighlight = `modal_left_highlight_${id}`
Expand Down
2 changes: 2 additions & 0 deletions apps/docs/components/ui/icon-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ import {
MintlifyIcon,
MistralIcon,
ModalIcon,
MonacoIcon,
MondayIcon,
MongoDBIcon,
MySQLIcon,
Expand Down Expand Up @@ -626,6 +627,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
mistral_parse_v2: MistralIcon,
mistral_parse_v3: MistralIcon,
modal: ModalIcon,
monaco: MonacoIcon,
monday: MondayIcon,
mongodb: MongoDBIcon,
mothership: Blimp,
Expand Down
1 change: 1 addition & 0 deletions apps/docs/content/docs/integrations/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
"mintlify",
"mistral_parse",
"modal",
"monaco",
"monday",
"monday-service-account",
"mongodb",
Expand Down
2,101 changes: 2,101 additions & 0 deletions apps/docs/content/docs/integrations/monaco.mdx

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions apps/sim/blocks/blocks/monaco.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/**
* Workflow runs hand a tool `{ ...rawInputs, ...mappedParams }`, so the mapper must clear
* values another operation left in a shared subBlock. Agent tool calls pass the operation in
* context and supply arguments under tool param names, which the mapper must keep.
*/
import { describe, expect, it } from 'vitest'
import { MonacoBlock } from '@/blocks/blocks/monaco'
import { monacoCreateTagTool } from '@/tools/monaco/create_tag'
import { monacoCreateTaskTool } from '@/tools/monaco/create_task'
import { monacoUpdateSequenceTool } from '@/tools/monaco/update_sequence'
import type { ToolConfig } from '@/tools/types'

const CREDENTIAL = { oauthCredential: 'cred-1', accessToken: 'mks_test' }

function requestBody(tool: ToolConfig, params: Record<string, unknown>) {
const body = tool.request.body
if (typeof body !== 'function') throw new Error(`${tool.id} has no request body`)
return body(params)
}

function workflowParams(inputs: Record<string, unknown>): Record<string, unknown> {
const mapped = MonacoBlock.tools.config?.params?.(inputs) ?? {}
return { ...inputs, ...mapped, accessToken: CREDENTIAL.accessToken }
}

function agentParams(operation: string, args: Record<string, unknown>): Record<string, unknown> {
const inputs = { ...CREDENTIAL, ...args }
const mapped = MonacoBlock.tools.config?.params?.(inputs, { operation }) ?? {}
return { ...inputs, ...mapped, accessToken: CREDENTIAL.accessToken }
}

describe('Monaco block parameter mapping', () => {
it('sends the task title, not a job title left in the contact Title field', () => {
const params = workflowParams({
...CREDENTIAL,
operation: 'monaco_create_task',
title: 'VP Sales',
taskTitle: 'Call Ada',
})
expect(requestBody(monacoCreateTaskTool, params)).toEqual({ title: 'Call Ada' })
})

it('drops a contact job title when the task title is empty', () => {
const params = workflowParams({
...CREDENTIAL,
operation: 'monaco_create_task',
title: 'VP Sales',
taskTitle: '',
})
expect(params.title).toBeUndefined()
})

it('keeps agent arguments named after tool params', () => {
const tag = agentParams('monaco_create_tag', {
object: 'accounts',
name: 'Hot Lead',
color: 'red',
})
expect(requestBody(monacoCreateTagTool, tag)).toEqual({
object: 'accounts',
name: 'Hot Lead',
color: 'red',
})

const sequence = agentParams('monaco_update_sequence', {
sequenceId: '0b2c7c1e-4d0a-4c8e-9a51-2f4f3e6a7b10',
action: 'pause',
})
expect(requestBody(monacoUpdateSequenceTool, sequence)).toEqual({ action: 'pause' })
})
})
Loading
Loading