Merge branch 'staging' into fix/verbiage

This commit is contained in:
Vikhyath Mondreti
2026-01-18 12:39:54 -08:00
8 changed files with 186 additions and 13 deletions

View File

@@ -10,6 +10,7 @@ import {
type Resolver,
} from '@/executor/variables/resolvers/reference'
import type { SerializedBlock, SerializedWorkflow } from '@/serializer/types'
import { getTool } from '@/tools/utils'
function isPathInOutputSchema(
outputs: Record<string, any> | undefined,
@@ -168,8 +169,11 @@ export class BlockResolver implements Resolver {
}
}
const schemaFields = getSchemaFieldNames(block?.outputs)
if (schemaFields.length > 0 && !isPathInOutputSchema(block?.outputs, pathParts)) {
const toolId = block?.config?.tool
const toolConfig = toolId ? getTool(toolId) : undefined
const outputSchema = toolConfig?.outputs ?? block?.outputs
const schemaFields = getSchemaFieldNames(outputSchema)
if (schemaFields.length > 0 && !isPathInOutputSchema(outputSchema, pathParts)) {
throw new Error(
`"${pathParts.join('.')}" doesn't exist on block "${blockName}". ` +
`Available fields: ${schemaFields.join(', ')}`

View File

@@ -200,6 +200,24 @@ export const addImageTool: ToolConfig<AddImageParams, AddImageResponse> = {
metadata: {
type: 'json',
description: 'Operation metadata including presentation ID and image URL',
properties: {
presentationId: {
type: 'string',
description: 'The presentation ID',
},
pageObjectId: {
type: 'string',
description: 'The page object ID where the image was inserted',
},
imageUrl: {
type: 'string',
description: 'The source image URL',
},
url: {
type: 'string',
description: 'URL to open the presentation',
},
},
},
},
}

View File

@@ -186,6 +186,25 @@ export const addSlideTool: ToolConfig<AddSlideParams, AddSlideResponse> = {
metadata: {
type: 'json',
description: 'Operation metadata including presentation ID, layout, and URL',
properties: {
presentationId: {
type: 'string',
description: 'The presentation ID',
},
layout: {
type: 'string',
description: 'The layout used for the new slide',
},
insertionIndex: {
type: 'number',
description: 'The zero-based index where the slide was inserted',
optional: true,
},
url: {
type: 'string',
description: 'URL to open the presentation',
},
},
},
},
}

View File

@@ -153,6 +153,24 @@ export const createTool: ToolConfig<GoogleSlidesToolParams, GoogleSlidesCreateRe
metadata: {
type: 'json',
description: 'Created presentation metadata including ID, title, and URL',
properties: {
presentationId: {
type: 'string',
description: 'The presentation ID',
},
title: {
type: 'string',
description: 'The presentation title',
},
mimeType: {
type: 'string',
description: 'The mime type of the presentation',
},
url: {
type: 'string',
description: 'URL to open the presentation',
},
},
},
},
}

View File

@@ -167,6 +167,24 @@ export const getThumbnailTool: ToolConfig<GetThumbnailParams, GetThumbnailRespon
metadata: {
type: 'json',
description: 'Operation metadata including presentation ID and page object ID',
properties: {
presentationId: {
type: 'string',
description: 'The presentation ID',
},
pageObjectId: {
type: 'string',
description: 'The page object ID for the thumbnail',
},
thumbnailSize: {
type: 'string',
description: 'The requested thumbnail size',
},
mimeType: {
type: 'string',
description: 'The thumbnail MIME type',
},
},
},
},
}

View File

@@ -79,6 +79,39 @@ export const readTool: ToolConfig<GoogleSlidesToolParams, GoogleSlidesReadRespon
metadata: {
type: 'json',
description: 'Presentation metadata including ID, title, and URL',
properties: {
presentationId: {
type: 'string',
description: 'The presentation ID',
},
title: {
type: 'string',
description: 'The presentation title',
},
pageSize: {
type: 'object',
description: 'Presentation page size',
optional: true,
properties: {
width: {
type: 'json',
description: 'Page width as a Dimension object',
},
height: {
type: 'json',
description: 'Page height as a Dimension object',
},
},
},
mimeType: {
type: 'string',
description: 'The mime type of the presentation',
},
url: {
type: 'string',
description: 'URL to open the presentation',
},
},
},
},
}

View File

@@ -164,6 +164,24 @@ export const replaceAllTextTool: ToolConfig<ReplaceAllTextParams, ReplaceAllText
metadata: {
type: 'json',
description: 'Operation metadata including presentation ID and URL',
properties: {
presentationId: {
type: 'string',
description: 'The presentation ID',
},
findText: {
type: 'string',
description: 'The text that was searched for',
},
replaceText: {
type: 'string',
description: 'The text that replaced the matches',
},
url: {
type: 'string',
description: 'URL to open the presentation',
},
},
},
},
}

View File

@@ -92,11 +92,39 @@ export const writeTool: ToolConfig<GoogleSlidesToolParams, GoogleSlidesWriteResp
}
).then((res) => res.json())
const slideIndex = params.slideIndex || 0
const metadata = {
presentationId,
title: presentationData.title || 'Updated Presentation',
mimeType: 'application/vnd.google-apps.presentation',
url: `https://docs.google.com/presentation/d/${presentationId}/edit`,
}
const slideIndex =
typeof params.slideIndex === 'string'
? Number.parseInt(params.slideIndex, 10)
: (params.slideIndex ?? 0)
const slide = presentationData.slides?.[slideIndex]
if (Number.isNaN(slideIndex) || slideIndex < 0) {
return {
success: false,
error: 'Slide index must be a non-negative number',
output: {
updatedContent: false,
metadata,
},
}
}
if (!slide) {
throw new Error(`Slide at index ${slideIndex} not found`)
return {
success: false,
error: `Slide at index ${slideIndex} not found`,
output: {
updatedContent: false,
metadata,
},
}
}
// Create requests to add content to the slide
@@ -153,15 +181,14 @@ export const writeTool: ToolConfig<GoogleSlidesToolParams, GoogleSlidesWriteResp
if (!updateResponse.ok) {
const errorText = await updateResponse.text()
logger.error('Failed to update presentation:', { errorText })
throw new Error('Failed to update presentation')
}
// Create presentation metadata
const metadata = {
presentationId,
title: presentationData.title || 'Updated Presentation',
mimeType: 'application/vnd.google-apps.presentation',
url: `https://docs.google.com/presentation/d/${presentationId}/edit`,
return {
success: false,
error: 'Failed to update presentation',
output: {
updatedContent: false,
metadata,
},
}
}
return {
@@ -185,6 +212,24 @@ export const writeTool: ToolConfig<GoogleSlidesToolParams, GoogleSlidesWriteResp
metadata: {
type: 'json',
description: 'Updated presentation metadata including ID, title, and URL',
properties: {
presentationId: {
type: 'string',
description: 'The presentation ID',
},
title: {
type: 'string',
description: 'The presentation title',
},
mimeType: {
type: 'string',
description: 'The mime type of the presentation',
},
url: {
type: 'string',
description: 'URL to open the presentation',
},
},
},
},