mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-29 12:24:39 +00:00
feat(operations): add shared Operation layer for agent capabilities
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.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import type { AuditAction } from '@shumai/dtos'
|
||||
import type { Via } from '@shumai/operations'
|
||||
import { paginateQuery } from '@shumai/core/src/pagination'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
|
||||
@@ -11,6 +12,8 @@ export interface LogActionParams {
|
||||
agentId?: string
|
||||
projectId?: string
|
||||
itemId?: string
|
||||
/** Surface the action came through. Set by Operations; omitted elsewhere. */
|
||||
via?: Via
|
||||
}
|
||||
|
||||
export interface ListAuditLogsParams {
|
||||
@@ -34,6 +37,7 @@ export class AuditLogService {
|
||||
agentId: params.agentId,
|
||||
projectId: params.projectId,
|
||||
itemId: params.itemId,
|
||||
via: params.via,
|
||||
},
|
||||
})
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user