Skip to content

Commit fe5baf7

Browse files
committed
Tool display intetns
1 parent e610df6 commit fe5baf7

File tree

5 files changed

+36
-25
lines changed

5 files changed

+36
-25
lines changed

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,15 @@ function PptxPreview({
838838
const [rendering, setRendering] = useState(false)
839839
const [renderError, setRenderError] = useState<string | null>(null)
840840

841+
const shouldSuppressStreamingPptxError = (message: string): boolean => {
842+
return (
843+
message.includes('SyntaxError: Invalid or unexpected token') ||
844+
message.includes('PPTX generation cancelled') ||
845+
message.includes('Preview failed') ||
846+
message.includes('AbortError')
847+
)
848+
}
849+
841850
// Streaming preview: only re-triggers when the streaming source code or
842851
// workspace changes. Isolated from fileData/dataUpdatedAt so that file-list
843852
// refreshes don't abort the in-flight compilation request.
@@ -879,8 +888,12 @@ function PptxPreview({
879888
} catch (err) {
880889
if (!cancelled && !(err instanceof DOMException && err.name === 'AbortError')) {
881890
const msg = err instanceof Error ? err.message : 'Failed to render presentation'
882-
logger.error('PPTX render failed', { error: msg })
883-
setRenderError(msg)
891+
if (shouldSuppressStreamingPptxError(msg)) {
892+
logger.info('Suppressing transient PPTX streaming preview error', { error: msg })
893+
} else {
894+
logger.error('PPTX render failed', { error: msg })
895+
setRenderError(msg)
896+
}
884897
}
885898
} finally {
886899
if (!cancelled) setRendering(false)

apps/sim/app/workspace/[workspaceId]/home/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,12 @@ export const TOOL_UI_METADATA: Record<string, ToolUIMetadata> = {
269269
phase: 'resource',
270270
},
271271
[WorkspaceFile.id]: {
272-
title: 'Managing file',
272+
title: 'Declaring file intent',
273273
phaseLabel: 'Resource',
274274
phase: 'resource',
275275
},
276276
[EditContent.id]: {
277-
title: 'Writing content',
277+
title: 'Applying file content',
278278
phaseLabel: 'Resource',
279279
phase: 'resource',
280280
},

apps/sim/lib/copilot/generated/tool-catalog-v1.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,7 +2587,7 @@ export const WorkspaceFile: ToolCatalogEntry = {
25872587
operation: {
25882588
type: 'string',
25892589
description: 'The file operation to perform.',
2590-
enum: ['append', 'update', 'patch', 'rename', 'delete'],
2590+
enum: ['append', 'update', 'patch'],
25912591
},
25922592
target: {
25932593
type: 'object',
@@ -2613,7 +2613,7 @@ export const WorkspaceFile: ToolCatalogEntry = {
26132613
title: {
26142614
type: 'string',
26152615
description:
2616-
'Optional short UI label for create/append chunks, e.g. "Chapter 1" or "Slide 3".',
2616+
'Required short UI label for this content unit, e.g. "Chapter 1", "Slide 3", or "Fix footer spacing".',
26172617
},
26182618
contentType: {
26192619
type: 'string',
@@ -2684,12 +2684,8 @@ export const WorkspaceFile: ToolCatalogEntry = {
26842684
},
26852685
},
26862686
},
2687-
newName: {
2688-
type: 'string',
2689-
description: 'New file name for rename. Must be a plain workspace filename like "main.py".',
2690-
},
26912687
},
2692-
required: ['operation', 'target'],
2688+
required: ['operation', 'target', 'title'],
26932689
},
26942690
resultSchema: {
26952691
type: 'object',

apps/sim/lib/copilot/generated/tool-schemas-v1.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,7 +2355,7 @@ export const TOOL_RUNTIME_SCHEMAS: Record<string, ToolRuntimeSchemaEntry> = {
23552355
operation: {
23562356
type: 'string',
23572357
description: 'The file operation to perform.',
2358-
enum: ['append', 'update', 'patch', 'rename', 'delete'],
2358+
enum: ['append', 'update', 'patch'],
23592359
},
23602360
target: {
23612361
type: 'object',
@@ -2382,7 +2382,7 @@ export const TOOL_RUNTIME_SCHEMAS: Record<string, ToolRuntimeSchemaEntry> = {
23822382
title: {
23832383
type: 'string',
23842384
description:
2385-
'Optional short UI label for create/append chunks, e.g. "Chapter 1" or "Slide 3".',
2385+
'Required short UI label for this content unit, e.g. "Chapter 1", "Slide 3", or "Fix footer spacing".',
23862386
},
23872387
contentType: {
23882388
type: 'string',
@@ -2453,13 +2453,8 @@ export const TOOL_RUNTIME_SCHEMAS: Record<string, ToolRuntimeSchemaEntry> = {
24532453
},
24542454
},
24552455
},
2456-
newName: {
2457-
type: 'string',
2458-
description:
2459-
'New file name for rename. Must be a plain workspace filename like "main.py".',
2460-
},
24612456
},
2462-
required: ['operation', 'target'],
2457+
required: ['operation', 'target', 'title'],
24632458
},
24642459
resultSchema: {
24652460
type: 'object',

apps/sim/lib/copilot/tools/handlers/vfs.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ function isOversizedReadPlaceholder(content: string): boolean {
2121
)
2222
}
2323

24+
function hasImageAttachment(result: { attachment?: { type?: string } }): boolean {
25+
return result.attachment?.type === 'image'
26+
}
27+
2428
export async function executeVfsGrep(
2529
params: Record<string, unknown>,
2630
context: ExecutionContext
@@ -153,8 +157,9 @@ export async function executeVfsRead(
153157
const uploadResult = await readChatUpload(filename, context.chatId)
154158
if (uploadResult) {
155159
if (
156-
isOversizedReadPlaceholder(uploadResult.content) ||
157-
serializedResultSize(uploadResult) > TOOL_RESULT_MAX_INLINE_CHARS
160+
!hasImageAttachment(uploadResult) &&
161+
(isOversizedReadPlaceholder(uploadResult.content) ||
162+
serializedResultSize(uploadResult) > TOOL_RESULT_MAX_INLINE_CHARS)
158163
) {
159164
return {
160165
success: false,
@@ -183,8 +188,9 @@ export async function executeVfsRead(
183188
const fileContent = await vfs.readFileContent(path)
184189
if (fileContent) {
185190
if (
186-
isOversizedReadPlaceholder(fileContent.content) ||
187-
serializedResultSize(fileContent) > TOOL_RESULT_MAX_INLINE_CHARS
191+
!hasImageAttachment(fileContent) &&
192+
(isOversizedReadPlaceholder(fileContent.content) ||
193+
serializedResultSize(fileContent) > TOOL_RESULT_MAX_INLINE_CHARS)
188194
) {
189195
return {
190196
success: false,
@@ -214,8 +220,9 @@ export async function executeVfsRead(
214220
return { success: false, error: `File not found: ${path}.${hint}` }
215221
}
216222
if (
217-
isOversizedReadPlaceholder(result.content) ||
218-
serializedResultSize(result) > TOOL_RESULT_MAX_INLINE_CHARS
223+
!hasImageAttachment(result) &&
224+
(isOversizedReadPlaceholder(result.content) ||
225+
serializedResultSize(result) > TOOL_RESULT_MAX_INLINE_CHARS)
219226
) {
220227
return {
221228
success: false,

0 commit comments

Comments
 (0)