mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 01:17:58 +00:00
Introduce @shumai/operations (pure definitions: Zod schemas, metadata, CLI hints) and @shumai/core/src/operations (implementOperation and the runOperation pipeline: validate, authorize, prepare, execute, validate output, audit). Migrate list_assets, create_folder, rename_asset, move_assets and delete_asset to Operations, and add list_projects. The agent now builds these tools from the registry, and the folder create/rename, file rename and reparent routes call the same Operations. Audit logs gain a nullable via column recording the surface. A lint rule keeps the Prisma client out of Operation implementations.
26 lines
807 B
TypeScript
26 lines
807 B
TypeScript
import { z } from 'zod'
|
|
import { defineOperation } from '../define'
|
|
import { assetSummarySchema } from '../schemas'
|
|
|
|
export const createFolder = defineOperation({
|
|
name: 'create_folder',
|
|
title: 'Create Folder',
|
|
description: 'Create a new folder in a specified parent folder.',
|
|
input: z.object({
|
|
parent: z
|
|
.string()
|
|
.min(1)
|
|
.describe('The parent folder ID under which to create the new folder.'),
|
|
name: z.string().min(1).describe('The name of the new folder to create.'),
|
|
}),
|
|
output: assetSummarySchema,
|
|
surfaces: ['agent', 'mcp', 'cli'],
|
|
annotations: { readOnly: false, destructive: false },
|
|
cli: {
|
|
command: ['mkdir'],
|
|
positional: ['name'],
|
|
flags: { parent: ['-p', '--parent'] },
|
|
format: (output) => `Created folder with ID: ${output.id}`,
|
|
},
|
|
})
|