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:
yiling
2026-10-26 11:36:36 +08:00
parent 47ee794ae4
commit 028fae0286
65 changed files with 2372 additions and 1149 deletions
+20
View File
@@ -92,6 +92,26 @@ export default tseslint.config(
'@typescript-eslint/naming-convention': baseNamingConvention,
},
},
{
// Operations hold policy and orchestration only; data access belongs in core services.
files: ['packages/core/src/operations/**/*.ts'],
ignores: ['**/*.test.ts'],
rules: {
'@typescript-eslint/no-restricted-imports': [
'error',
{
paths: [
{
name: '@shumai/db',
importNames: ['prisma'],
message: 'Operations must call core services instead of the Prisma client.',
allowTypeImports: true,
},
],
},
],
},
},
{
files: ['**/*.test.ts', '**/*.test.tsx'],
rules: {