diff --git a/packages/agent/src/activities/agent.ts b/packages/agent/src/activities/agent.ts index ea9701a9..da2770d5 100644 --- a/packages/agent/src/activities/agent.ts +++ b/packages/agent/src/activities/agent.ts @@ -96,7 +96,7 @@ shumai has its own cloud file system. If a user asks you to perform file system If you need to create files in the local filesystem (for example, a temporary file for uploading), only the '.pi' folder in the current directory has write permissions. Do NOT attempt to create files in any other directories. -When creating a file or version, first use 'list_autofill_fields' to inspect the project's AI-autofillable metadata fields. If relevant metadata depends on information unavailable from the file content (for example, the AI model or tool used to generate it), include a brief context hint (maximum 50 words) in the 'context' parameter.` +When creating a file or version, first use 'list_autofill_fields' to inspect the project's AI-autofillable metadata fields. If relevant metadata depends on information unavailable from the file content (for example, the AI model or tool used to generate it), include a brief context hint (maximum 50 words) in the 'context' field of 'create_file' or 'create_version' tool.` if (agent.soul) { systemPrompt = `${systemPrompt}\n\nAgent Personality and Core Instructions:\n${agent.soul}` diff --git a/packages/agent/src/tools/create-file.ts b/packages/agent/src/tools/create-file.ts index 9a59e28e..1ce5ae91 100644 --- a/packages/agent/src/tools/create-file.ts +++ b/packages/agent/src/tools/create-file.ts @@ -1,12 +1,12 @@ -import { Type } from '@sinclair/typebox' import { type AgentTool } from '@earendil-works/pi-agent-core' -import { executeAgentToolWorkflow } from './utils' -import * as fs from 'fs' -import * as path from 'path' import { s3Service } from '@shumai/core/src/s3/s3' import { getFileMimeType, readFileMimeType } from '@shumai/core/src/utils/file-mime' -import { ulid } from 'ulid' import { sanitizeFilename } from '@shumai/core/src/utils/filename' +import { Type } from '@sinclair/typebox' +import * as fs from 'fs' +import * as path from 'path' +import { ulid } from 'ulid' +import { executeAgentToolWorkflow } from './utils' const createFileSchema = Type.Object({ parent: Type.String({ @@ -57,7 +57,10 @@ export function createCreateFileTool(userId: string): AgentTool { const source = assertExactlyOneSource(params)