mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 13:48:21 +00:00
Splits monolithic workflow workers into four decoupled workspaces under the Bun workspaces monorepo: - @shumai/workflow-core containing the core execution engine and utilities. - @shumai/agent containing agent-specific logic, workflows, and activities. - @shumai/transcode containing transcoding workflows, transcoder, and transcode activities. - @shumai/worker-db containing database activities. Introduces a dynamic workflow and activity registration pattern on LocalExecutor to eliminate circular dependencies. Updates worker bootstrapping and test suites to cleanly leverage generic workspace modules.
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import { Type } from '@sinclair/typebox'
|
|
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
|
import { executeAgentToolWorkflow } from './utils'
|
|
|
|
const createFolderSchema = Type.Object({
|
|
parent: Type.String({
|
|
description:
|
|
'The parent folder ID under which to create the new folder. This parameter is required.',
|
|
}),
|
|
name: Type.String({
|
|
description: 'The name of the new folder to create. This parameter is required.',
|
|
}),
|
|
})
|
|
|
|
export function createCreateFolderTool(userId: string): AgentTool<typeof createFolderSchema> {
|
|
return {
|
|
name: 'create_folder',
|
|
label: 'Create Folder',
|
|
description: 'Create a new folder in a specified parent folder.',
|
|
parameters: createFolderSchema,
|
|
execute: async (_toolCallId, params) => {
|
|
try {
|
|
const result = await executeAgentToolWorkflow({
|
|
toolName: 'create_folder',
|
|
args: params,
|
|
userId,
|
|
assetId: params.parent,
|
|
})
|
|
return {
|
|
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
details: result,
|
|
}
|
|
} catch (error) {
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text',
|
|
text: `Error creating folder: ${error instanceof Error ? error.message : String(error)}`,
|
|
},
|
|
],
|
|
details: {},
|
|
}
|
|
}
|
|
},
|
|
}
|
|
}
|