feat(asset): record and display agent provenance on assets and audit logs (#380)

* feat(asset): record and display agent provenance on assets and audit logs

* style(webui): apply 30% translucent frosted glass background to bot badges

* style(webui): match bot icon badge style to thumbnail media overlay (bg-black/60 text-white)

* style(webui): use "AI" text badge with pdf overlay style instead of bot icon
This commit is contained in:
Yiling-J
2026-09-04 11:27:52 +08:00
committed by GitHub
parent 52330869a2
commit dd0ea05a88
39 changed files with 1699 additions and 108 deletions
+4 -3
View File
@@ -362,11 +362,12 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
const systemTools: AgentTool[] = []
if (userId) {
const metadataSchema = await buildProjectMetadataSchema(projectId)
const agentContext = { teamId, agentId }
systemTools.push(
createListAssetsTool(userId),
createCreateFolderTool(userId),
createCreateFileTool(userId, metadataSchema),
createCreateVersionTool(userId, metadataSchema),
createCreateFolderTool(userId, agentContext),
createCreateFileTool(userId, metadataSchema, agentContext),
createCreateVersionTool(userId, metadataSchema, agentContext),
createDownloadAssetTool(userId),
)
}
@@ -3,7 +3,9 @@ import { createCreateFileTool } from './create-file'
import { fieldsToTypeBoxSchema } from '../index'
import { s3Service } from '@shumai/core/src/s3/s3'
import { assetService } from '@shumai/core/src/asset/asset'
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
import { authzService } from '@shumai/core/src/authz/authz'
import { AuditAction } from '@shumai/dtos'
import { Value } from 'typebox/value'
import * as fs from 'fs'
import * as os from 'os'
@@ -32,6 +34,12 @@ vi.mock('@shumai/core/src/asset/asset', () => ({
},
}))
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
auditLogService: {
logAction: vi.fn().mockResolvedValue(undefined),
},
}))
describe('createCreateFileTool', () => {
const createdFiles: string[] = []
@@ -338,4 +346,27 @@ describe('createCreateFileTool', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- inspecting the runtime schema shape of the dynamically-built tool
expect((tool.parameters as any).properties.metadata).toBeUndefined()
})
it('should pass agentId and record audit log when agentContext is provided', async () => {
const filePath = createTempFile('# Agent file', 'agent-file.md')
const tool = createCreateFileTool('user-1', undefined, { teamId: 'team-1', agentId: 'agent-1' })
await tool.execute('call-1', { parent: 'folder-1', path: filePath, data: null })
expect(assetService.createFile).toHaveBeenCalledWith(
expect.objectContaining({
creatorId: 'user-1',
agentId: 'agent-1',
}),
)
expect(auditLogService.logAction).toHaveBeenCalledWith({
action: AuditAction.file_create,
teamId: 'team-1',
userId: 'user-1',
agentId: 'agent-1',
projectId: undefined,
itemId: 'file-1',
})
})
})
+19 -1
View File
@@ -1,10 +1,12 @@
import { type AgentTool } from '@earendil-works/pi-agent-core'
import { assetService } from '@shumai/core/src/asset/asset'
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
import { s3Service } from '@shumai/core/src/s3/s3'
import { getFileMimeType, readFileMimeType } from '@shumai/core/src/utils/file-mime'
import { sanitizeFilename } from '@shumai/core/src/utils/filename'
import { type User } from '@shumai/db'
import { AuditAction } from '@shumai/dtos'
import { Type, type TSchema } from 'typebox'
import * as fs from 'fs'
import * as path from 'path'
@@ -26,7 +28,11 @@ function assertExactlyOneSource(params: CreateFileToolParams) {
return hasPath ? params.path! : params.data!
}
export function createCreateFileTool(userId: string, metadataSchema?: TSchema): AgentTool {
export function createCreateFileTool(
userId: string,
metadataSchema?: TSchema,
agentContext?: { teamId?: string; agentId?: string },
): AgentTool {
const createFileSchema = Type.Object(
{
parent: Type.String({
@@ -121,9 +127,21 @@ export function createCreateFileTool(userId: string, metadataSchema?: TSchema):
sizeByte: size,
contentType: mimeType,
creatorId: userId,
agentId: agentContext?.agentId,
metadata: p.metadata ?? undefined,
})
if (agentContext?.teamId) {
await auditLogService.logAction({
action: AuditAction.file_create,
teamId: agentContext.teamId,
userId,
agentId: agentContext.agentId,
projectId: asset.projectId ?? undefined,
itemId: asset.id,
})
}
const result = {
id: asset.id,
name: asset.name,
@@ -1,7 +1,9 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'
import { createCreateFolderTool } from './create-folder'
import { assetService } from '@shumai/core/src/asset/asset'
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
import { authzService } from '@shumai/core/src/authz/authz'
import { AuditAction } from '@shumai/dtos'
vi.mock('@shumai/core/src/authz/authz', () => ({
authzService: {
@@ -22,6 +24,12 @@ vi.mock('@shumai/core/src/asset/asset', () => ({
},
}))
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
auditLogService: {
logAction: vi.fn().mockResolvedValue(undefined),
},
}))
describe('createCreateFolderTool', () => {
beforeEach(() => {
vi.clearAllMocks()
@@ -43,6 +51,7 @@ describe('createCreateFolderTool', () => {
parentId: 'root-folder',
type: 'folder',
creatorId: 'user-1',
agentId: undefined,
})
expect(result.details).toEqual({})
@@ -53,4 +62,26 @@ describe('createCreateFolderTool', () => {
size: 0,
})
})
it('passes agentId and logs audit action when agentContext is provided', async () => {
const tool = createCreateFolderTool('user-1', { teamId: 'team-1', agentId: 'agent-1' })
await tool.execute('call-1', { parent: 'root-folder', name: 'New Folder' })
expect(assetService.createAsset).toHaveBeenCalledWith({
name: 'New Folder',
parentId: 'root-folder',
type: 'folder',
creatorId: 'user-1',
agentId: 'agent-1',
})
expect(auditLogService.logAction).toHaveBeenCalledWith({
action: AuditAction.folder_create,
teamId: 'team-1',
userId: 'user-1',
agentId: 'agent-1',
projectId: undefined,
itemId: 'folder-1',
})
})
})
+18 -1
View File
@@ -1,8 +1,10 @@
import { Type } from 'typebox'
import { type AgentTool } from '@earendil-works/pi-agent-core'
import { assetService } from '@shumai/core/src/asset/asset'
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
import { type User } from '@shumai/db'
import { AuditAction } from '@shumai/dtos'
const createFolderSchema = Type.Object({
parent: Type.String({
@@ -14,7 +16,10 @@ const createFolderSchema = Type.Object({
}),
})
export function createCreateFolderTool(userId: string): AgentTool<typeof createFolderSchema> {
export function createCreateFolderTool(
userId: string,
agentContext?: { teamId?: string; agentId?: string },
): AgentTool<typeof createFolderSchema> {
return {
name: 'create_folder',
label: 'Create Folder',
@@ -33,8 +38,20 @@ export function createCreateFolderTool(userId: string): AgentTool<typeof createF
parentId: params.parent,
type: 'folder',
creatorId: userId,
agentId: agentContext?.agentId,
})
if (agentContext?.teamId) {
await auditLogService.logAction({
action: AuditAction.folder_create,
teamId: agentContext.teamId,
userId,
agentId: agentContext.agentId,
projectId: newFolder.projectId ?? undefined,
itemId: newFolder.id,
})
}
const result = {
id: newFolder.id,
name: newFolder.name,
@@ -3,7 +3,9 @@ import { createCreateVersionTool } from './create-version'
import { fieldsToTypeBoxSchema } from '../index'
import { s3Service } from '@shumai/core/src/s3/s3'
import { assetService } from '@shumai/core/src/asset/asset'
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
import { authzService } from '@shumai/core/src/authz/authz'
import { AuditAction } from '@shumai/dtos'
import { Value } from 'typebox/value'
import * as fs from 'fs'
import * as os from 'os'
@@ -31,6 +33,12 @@ vi.mock('@shumai/core/src/asset/asset', () => ({
},
}))
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
auditLogService: {
logAction: vi.fn().mockResolvedValue(undefined),
},
}))
describe('createCreateVersionTool', () => {
const createdFiles: string[] = []
@@ -204,4 +212,30 @@ describe('createCreateVersionTool', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- inspecting the runtime schema shape of the dynamically-built tool
expect((tool.parameters as any).properties.metadata).toBeUndefined()
})
it('should pass agentId and record audit log when agentContext is provided', async () => {
const filePath = createTempFile('# Agent version file', 'agent-ver-file.md')
const tool = createCreateVersionTool('user-1', undefined, {
teamId: 'team-1',
agentId: 'agent-1',
})
await tool.execute('call-1', { parent: 'file-1', path: filePath })
expect(assetService.createVersion).toHaveBeenCalledWith(
expect.objectContaining({
creatorId: 'user-1',
agentId: 'agent-1',
}),
)
expect(auditLogService.logAction).toHaveBeenCalledWith({
action: AuditAction.file_create,
teamId: 'team-1',
userId: 'user-1',
agentId: 'agent-1',
projectId: undefined,
itemId: 'file-1',
})
})
})
+19 -1
View File
@@ -1,10 +1,12 @@
import { type AgentTool } from '@earendil-works/pi-agent-core'
import { assetService } from '@shumai/core/src/asset/asset'
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
import { s3Service } from '@shumai/core/src/s3/s3'
import { readFileMimeType } from '@shumai/core/src/utils/file-mime'
import { sanitizeFilename } from '@shumai/core/src/utils/filename'
import { type User } from '@shumai/db'
import { AuditAction } from '@shumai/dtos'
import { Type, type TSchema } from 'typebox'
import * as fs from 'fs'
import * as path from 'path'
@@ -16,7 +18,11 @@ interface CreateVersionToolParams {
metadata?: Record<string, unknown> | null
}
export function createCreateVersionTool(userId: string, metadataSchema?: TSchema): AgentTool {
export function createCreateVersionTool(
userId: string,
metadataSchema?: TSchema,
agentContext?: { teamId?: string; agentId?: string },
): AgentTool {
const createVersionSchema = Type.Object(
{
parent: Type.String({
@@ -70,9 +76,21 @@ export function createCreateVersionTool(userId: string, metadataSchema?: TSchema
sizeByte: fileSize,
contentType: mimeType,
creatorId: userId,
agentId: agentContext?.agentId,
metadata: p.metadata ?? undefined,
})
if (agentContext?.teamId) {
await auditLogService.logAction({
action: AuditAction.file_create,
teamId: agentContext.teamId,
userId,
agentId: agentContext.agentId,
projectId: asset.projectId ?? undefined,
itemId: asset.id,
})
}
const result = {
id: asset.id,
name: asset.name,
+2
View File
@@ -513,6 +513,8 @@ describe('team api', () => {
action: AuditAction.project_create,
teamId: 't1',
userId: 'user1',
agentId: null,
agent: null,
projectId: 'p1',
itemId: 'p1',
createdAt: new Date().toISOString(),
+1
View File
@@ -391,6 +391,7 @@ const route = new Hono<{ Variables: { user: User } }>()
teamId,
actions: query.actions,
userIds: query.userIds,
agentIds: query.agentIds,
itemId: query.itemId,
first: query.first,
after: query.after,
+136
View File
@@ -3821,6 +3821,65 @@ describe('AssetService — natural sort by name', () => {
expect(triggerSpy).toHaveBeenCalledWith(expect.anything(), fileInfo.id, team.id, project.id)
})
it('creates a file with agentId and returns agent info in toAssetInfos', async () => {
const user = await prisma.user.create({
data: { name: 'HumanUser', email: `human-${Date.now()}@example.com` },
})
const team = await prisma.team.create({ data: { name: 'AgentFileTeam' } })
const project = await prisma.project.create({
data: { name: 'AgentFileProject', teamId: team.id },
})
const rootFolder = await prisma.asset.create({
data: {
name: 'RootFolder',
type: AssetType.folder,
projectId: project.id,
status: AssetStatus.uploaded,
},
})
const agentUser = await prisma.user.create({
data: {
name: 'AssetBot',
email: `bot-${Date.now()}@example.com`,
type: 'agent',
},
})
const agent = await prisma.agent.create({
data: {
id: agentUser.id,
teamId: team.id,
type: 'chat',
config: { provider: 'test', model: 'test' },
},
})
vi.spyOn(uploadService, 'triggerPostUploadWorkflows').mockResolvedValue(undefined)
const fileInfo = await assetService.createFile({
parentId: rootFolder.id,
name: 'generated.png',
key: 'files/test/generated.png',
sizeByte: 2048,
contentType: 'image/png',
creatorId: user.id,
agentId: agent.id,
})
expect(fileInfo.id).toBeDefined()
expect(fileInfo.agentId).toBe(agent.id)
expect(fileInfo.agent).toEqual({
id: agent.id,
name: 'AssetBot',
})
const fetched = await assetService.getAsset({ assetId: fileInfo.id })
expect(fetched.agentId).toBe(agent.id)
expect(fetched.agent).toEqual({
id: agent.id,
name: 'AssetBot',
})
})
it('rejects if metadata contains invalid keys', async () => {
const user = await prisma.user.create({
data: { name: 'FileUser2', email: `fileuser2-${Date.now()}@example.com` },
@@ -4085,6 +4144,83 @@ describe('AssetService — natural sort by name', () => {
expect(rootFolderAfter?.fileCount).toBe(1)
expect(rootFolderAfter?.sizeByte).toBe(2000n)
})
it('creates a version with agentId and preserves agent provenance in version stack', async () => {
const user = await prisma.user.create({
data: { name: 'VersionUser2', email: `veruser2-${Date.now()}@example.com` },
})
const team = await prisma.team.create({ data: { name: 'VersionTeam2' } })
const project = await prisma.project.create({
data: { name: 'VersionProject2', teamId: team.id },
})
const rootFolder = await prisma.asset.create({
data: {
name: 'RootFolder',
type: AssetType.folder,
projectId: project.id,
status: AssetStatus.uploaded,
},
})
const agentUser = await prisma.user.create({
data: {
name: 'VersionBot',
email: `verbot-${Date.now()}@example.com`,
type: 'agent',
},
})
const agent = await prisma.agent.create({
data: {
id: agentUser.id,
teamId: team.id,
type: 'chat',
config: { provider: 'test', model: 'test' },
},
})
const v1 = await prisma.asset.create({
data: {
name: 'document.txt',
type: AssetType.file,
projectId: project.id,
parentId: rootFolder.id,
status: AssetStatus.uploaded,
sizeByte: 100n,
creatorId: user.id,
},
})
vi.spyOn(uploadService, 'triggerPostUploadWorkflows').mockResolvedValue(undefined)
const v2Info = await assetService.createVersion({
parentId: v1.id,
name: 'document.txt',
key: 'files/test/v2.txt',
sizeByte: 200,
contentType: 'text/plain',
creatorId: user.id,
agentId: agent.id,
})
expect(v2Info.id).toBeDefined()
expect(v2Info.agentId).toBe(agent.id)
expect(v2Info.agent).toEqual({
id: agent.id,
name: 'VersionBot',
})
const stack = await prisma.asset.findFirst({
where: { parentId: rootFolder.id, type: AssetType.version_stack },
})
expect(stack).toBeDefined()
const stackVersions = await assetService.getStackVersions(stack!.id)
expect(stackVersions).toHaveLength(2)
const v2StackVersion = stackVersions.find((v) => v.id === v2Info.id)
expect(v2StackVersion?.agent).toEqual({
id: agent.id,
name: 'VersionBot',
})
})
})
describe('listChildren type filtering', () => {
+73 -80
View File
@@ -34,20 +34,38 @@ import { uploadService } from '@shumai/core/src/upload/upload'
export const assetInclude = {
creator: true,
agent: { include: { user: true } },
metadataValues: true,
storageKey: true,
target: {
include: {
creator: true,
agent: { include: { user: true } },
metadataValues: true,
storageKey: true,
children: {
include: { creator: true, metadataValues: true, storageKey: true },
where: { isDeleted: false },
include: {
creator: true,
agent: { include: { user: true } },
metadataValues: true,
storageKey: true,
},
take: 3,
orderBy: { sortIndex: 'asc' },
},
},
},
children: {
include: { creator: true, metadataValues: true, storageKey: true },
where: { isDeleted: false },
include: {
creator: true,
agent: { include: { user: true } },
metadataValues: true,
storageKey: true,
},
take: 3,
orderBy: { sortIndex: 'asc' },
},
} as const
@@ -101,30 +119,7 @@ export class AssetService {
const assets = await this.prismaClient.asset.findMany({
where: { id: { in: ids } },
include: {
creator: true,
metadataValues: true,
storageKey: true,
target: {
include: {
creator: true,
metadataValues: true,
storageKey: true,
children: {
where: { isDeleted: false },
include: { creator: true, metadataValues: true, storageKey: true },
take: 3,
orderBy: { sortIndex: 'asc' },
},
},
},
children: {
where: { isDeleted: false },
include: { creator: true, metadataValues: true, storageKey: true },
take: 3,
orderBy: { sortIndex: 'asc' },
},
},
include: assetInclude,
})
const assetMap = new Map(assets.map((a) => [a.id, a]))
@@ -711,30 +706,7 @@ export class AssetService {
async (skip, take) => {
return this.prismaClient.asset.findMany({
where,
include: {
creator: true,
metadataValues: true,
storageKey: true,
target: {
include: {
creator: true,
metadataValues: true,
storageKey: true,
children: {
where: { isDeleted: false },
include: { creator: true, metadataValues: true, storageKey: true },
take: 3,
orderBy: { sortIndex: 'asc' },
},
},
},
children: {
where: { isDeleted: false },
include: { creator: true, metadataValues: true, storageKey: true },
take: 3,
orderBy: { sortIndex: 'asc' },
},
},
include: assetInclude,
orderBy,
skip,
take,
@@ -798,22 +770,30 @@ export class AssetService {
if (req.sizeByte) data.sizeByte = req.sizeByte
if (req.contentType) data.mediaType = req.contentType
if (req.creatorId) data.creator = { connect: { id: req.creatorId } }
if (req.agentId) data.agent = { connect: { id: req.agentId } }
const executeInTx = async (tx: Prisma.TransactionClient) => {
const createdAsset = await tx.asset.create({
data,
include: {
creator: true,
agent: { include: { user: true } },
metadataValues: true,
storageKey: true,
target: {
include: {
creator: true,
agent: { include: { user: true } },
metadataValues: true,
storageKey: true,
children: {
where: { isDeleted: false },
include: { creator: true, metadataValues: true, storageKey: true },
include: {
creator: true,
agent: { include: { user: true } },
metadataValues: true,
storageKey: true,
},
take: 3,
orderBy: { sortIndex: 'asc' },
},
@@ -821,7 +801,12 @@ export class AssetService {
},
children: {
where: { isDeleted: false },
include: { creator: true, metadataValues: true, storageKey: true },
include: {
creator: true,
agent: { include: { user: true } },
metadataValues: true,
storageKey: true,
},
take: 3,
orderBy: { sortIndex: 'asc' },
},
@@ -853,9 +838,10 @@ export class AssetService {
sizeByte: number
contentType: string
creatorId: string
agentId?: string
metadata?: Record<string, unknown>
}): Promise<AssetInfo> {
const { parentId, name, key, sizeByte, contentType, creatorId, metadata } = params
const { parentId, name, key, sizeByte, contentType, creatorId, agentId, metadata } = params
const parentAsset = await this.prismaClient.asset.findUnique({
where: { id: parentId },
@@ -884,6 +870,7 @@ export class AssetService {
sizeByte,
contentType,
creatorId,
agentId,
},
tx,
)
@@ -916,9 +903,10 @@ export class AssetService {
sizeByte: number
contentType: string
creatorId: string
agentId?: string
metadata?: Record<string, unknown>
}): Promise<AssetInfo> {
const { parentId, name, key, sizeByte, contentType, creatorId, metadata } = params
const { parentId, name, key, sizeByte, contentType, creatorId, agentId, metadata } = params
const targetAsset = await this.prismaClient.asset.findUnique({
where: { id: parentId },
@@ -961,6 +949,7 @@ export class AssetService {
sizeByte,
contentType,
creatorId,
agentId,
},
tx,
)
@@ -1006,30 +995,7 @@ export class AssetService {
async getAsset(req: GetAssetRequest): Promise<AssetInfo> {
const a = await this.prismaClient.asset.findUnique({
where: { id: req.assetId },
include: {
creator: true,
metadataValues: true,
storageKey: true,
target: {
include: {
creator: true,
metadataValues: true,
storageKey: true,
children: {
where: { isDeleted: false },
include: { creator: true, metadataValues: true, storageKey: true },
take: 3,
orderBy: { sortIndex: 'asc' },
},
},
},
children: {
where: { isDeleted: false },
include: { creator: true, metadataValues: true, storageKey: true },
take: 3,
orderBy: { sortIndex: 'asc' },
},
},
include: assetInclude,
})
if (!a) throw new Error('Asset not found')
@@ -1914,7 +1880,12 @@ export class AssetService {
if (stackIds.size > 0) {
const allVersions = await this.prismaClient.asset.findMany({
where: { parentId: { in: Array.from(stackIds) }, isDeleted: false },
include: { creator: true, metadataValues: true, storageKey: true },
include: {
creator: true,
agent: { include: { user: true } },
metadataValues: true,
storageKey: true,
},
})
for (const v of allVersions) {
const list = versionsMap.get(v.parentId!) || []
@@ -1974,6 +1945,12 @@ export class AssetService {
image: await getAvatarUrl(v.creator.image),
}
: null,
agent: v.agent
? {
id: v.agent.id,
name: v.agent.user.name,
}
: null,
}
}),
),
@@ -2026,6 +2003,13 @@ export class AssetService {
}
: null
const agent = latestVersion.agent
? {
id: latestVersion.agent.id,
name: latestVersion.agent.user.name,
}
: null
const fieldValues: FieldValueInfo[] = []
if ('metadataValues' in latestVersion && latestVersion.metadataValues) {
for (const mv of latestVersion.metadataValues) {
@@ -2101,6 +2085,8 @@ export class AssetService {
deletedAt: a.deletedAt ? a.deletedAt.toISOString() : null,
projectId: a.projectId,
creator,
agentId: latestVersion.agentId ?? null,
agent,
fieldValues,
sortIndex: a.sortIndex,
hasAgentsMd: hasAgentMdSet.has(a.id),
@@ -2119,11 +2105,12 @@ export class AssetService {
previewUrl: string | null
createdAt: string
creator: { id: string; name: string | null; image?: string | null } | null
agent?: { id: string; name: string } | null
}>
> {
const versions = await this.prismaClient.asset.findMany({
where: { parentId: stackId, isDeleted: false },
include: { creator: true },
include: { creator: true, agent: { include: { user: true } } },
})
versions.sort((x, y) => {
@@ -2147,6 +2134,12 @@ export class AssetService {
image: await getAvatarUrl(v.creator.image),
}
: null,
agent: v.agent
? {
id: v.agent.id,
name: v.agent.user.name,
}
: null,
}
}),
)
@@ -116,4 +116,57 @@ describe('AuditLogService', () => {
expect(result.nodes.map((n) => n.action)).toContain(AuditAction.kanban_task_create)
expect(result.nodes.map((n) => n.action)).toContain(AuditAction.kanban_goal_create)
})
it('records and filters agent provenance in audit logs', async () => {
const user = await prisma.user.create({
data: { name: 'Audit Human User', email: 'audit_human@example.com', password: 'password' },
})
const team = await prisma.team.create({
data: { name: 'Agent Audit Team' },
})
const agentUser = await prisma.user.create({
data: {
name: 'Creation Bot',
email: 'creation_bot@example.com',
type: 'agent',
},
})
const agent = await prisma.agent.create({
data: {
id: agentUser.id,
teamId: team.id,
type: 'chat',
config: { provider: 'test', model: 'test' },
},
})
const log = await auditLogService.logAction({
action: AuditAction.file_create,
teamId: team.id,
userId: user.id,
agentId: agent.id,
itemId: 'file-xyz',
})
expect(log).toBeDefined()
expect(log?.agentId).toBe(agent.id)
const resultWithAgent = await auditLogService.listAuditLogs({
teamId: team.id,
agentIds: [agent.id],
})
expect(resultWithAgent.total).toBe(1)
expect(resultWithAgent.nodes[0].agentId).toBe(agent.id)
expect(resultWithAgent.nodes[0].agent).toEqual({
id: agent.id,
name: 'Creation Bot',
})
const resultOtherAgent = await auditLogService.listAuditLogs({
teamId: team.id,
agentIds: ['non-existent-agent'],
})
expect(resultOtherAgent.total).toBe(0)
})
})
+10
View File
@@ -8,6 +8,7 @@ export interface LogActionParams {
action: AuditAction
teamId: string
userId?: string
agentId?: string
projectId?: string
itemId?: string
}
@@ -16,6 +17,7 @@ export interface ListAuditLogsParams {
teamId: string
actions?: AuditAction[]
userIds?: string[]
agentIds?: string[]
itemId?: string
first?: number
after?: string
@@ -29,6 +31,7 @@ export class AuditLogService {
action: params.action,
teamId: params.teamId,
userId: params.userId,
agentId: params.agentId,
projectId: params.projectId,
itemId: params.itemId,
},
@@ -52,6 +55,10 @@ export class AuditLogService {
where.userId = { in: params.userIds }
}
if (params.agentIds && params.agentIds.length > 0) {
where.agentId = { in: params.agentIds }
}
if (params.itemId && params.itemId.trim() !== '') {
where.itemId = { contains: params.itemId.trim(), mode: 'insensitive' }
}
@@ -60,6 +67,7 @@ export class AuditLogService {
(skip, take) =>
prisma.auditLog.findMany({
where,
include: { agent: { include: { user: true } } },
orderBy: { id: 'desc' },
skip,
take,
@@ -74,6 +82,8 @@ export class AuditLogService {
action: item.action,
teamId: item.teamId,
userId: item.userId,
agentId: item.agentId,
agent: item.agent ? { id: item.agent.id, name: item.agent.user.name } : null,
projectId: item.projectId,
itemId: item.itemId,
createdAt: item.createdAt.toISOString(),
@@ -0,0 +1,17 @@
-- AlterTable
ALTER TABLE "assets" ADD COLUMN "agent_id" TEXT;
-- AlterTable
ALTER TABLE "audit_logs" ADD COLUMN "agent_id" TEXT;
-- CreateIndex
CREATE INDEX "assets_agent_id_idx" ON "assets"("agent_id");
-- CreateIndex
CREATE INDEX "audit_logs_agent_id_idx" ON "audit_logs"("agent_id");
-- AddForeignKey
ALTER TABLE "assets" ADD CONSTRAINT "assets_agent_id_fkey" FOREIGN KEY ("agent_id") REFERENCES "agents"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "audit_logs" ADD CONSTRAINT "audit_logs_agent_id_fkey" FOREIGN KEY ("agent_id") REFERENCES "agents"("id") ON DELETE SET NULL ON UPDATE CASCADE;
+9
View File
@@ -546,6 +546,9 @@ model Asset {
creatorId String? @map("creator_id")
creator User? @relation("UserToAsset", fields: [creatorId], references: [id])
agentId String? @map("agent_id")
agent Agent? @relation("AgentToAsset", fields: [agentId], references: [id], onDelete: SetNull)
taskId String? @map("task_id")
task Task? @relation("TaskToAsset", fields: [taskId], references: [id])
@@ -576,6 +579,7 @@ model Asset {
@@index([sortIndex])
@@index([isDeleted])
@@index([deletedAt])
@@index([agentId])
@@index([name], name: "assets_name_idx")
@@index([nameNgram], type: Gin)
@@unique([parentId, targetId], name: "parentIdTargetId")
@@ -848,6 +852,8 @@ model Agent {
agentSessions AgentSession[]
skills AgentSkill[]
mcpServers AgentMcpServer[]
assets Asset[] @relation("AgentToAsset")
auditLogs AuditLog[] @relation("AgentToAuditLog")
@@map("agents")
}
@@ -1083,16 +1089,19 @@ model AuditLog {
action String
teamId String @map("team_id")
userId String? @map("user_id")
agentId String? @map("agent_id")
projectId String? @map("project_id")
itemId String? @map("item_id")
createdAt DateTime @default(now()) @map("created_at")
team Team @relation("TeamToAuditLog", fields: [teamId], references: [id], onDelete: Cascade)
user User? @relation("UserToAuditLog", fields: [userId], references: [id], onDelete: SetNull)
agent Agent? @relation("AgentToAuditLog", fields: [agentId], references: [id], onDelete: SetNull)
project Project? @relation("ProjectToAuditLog", fields: [projectId], references: [id], onDelete: SetNull)
@@index([teamId, id(sort: Desc)])
@@index([userId])
@@index([agentId])
@@index([action])
@@index([itemId])
@@map("audit_logs")
File diff suppressed because one or more lines are too long
@@ -4498,6 +4498,7 @@ export const AssetScalarFieldEnum = {
targetId: 'targetId',
storageKeyId: 'storageKeyId',
creatorId: 'creatorId',
agentId: 'agentId',
taskId: 'taskId',
projectId: 'projectId'
} as const
@@ -4868,6 +4869,7 @@ export const AuditLogScalarFieldEnum = {
action: 'action',
teamId: 'teamId',
userId: 'userId',
agentId: 'agentId',
projectId: 'projectId',
itemId: 'itemId',
createdAt: 'createdAt'
@@ -351,6 +351,7 @@ export const AssetScalarFieldEnum = {
targetId: 'targetId',
storageKeyId: 'storageKeyId',
creatorId: 'creatorId',
agentId: 'agentId',
taskId: 'taskId',
projectId: 'projectId'
} as const
@@ -721,6 +722,7 @@ export const AuditLogScalarFieldEnum = {
action: 'action',
teamId: 'teamId',
userId: 'userId',
agentId: 'agentId',
projectId: 'projectId',
itemId: 'itemId',
createdAt: 'createdAt'
+352
View File
@@ -235,6 +235,8 @@ export type AgentWhereInput = {
agentSessions?: Prisma.AgentSessionListRelationFilter
skills?: Prisma.AgentSkillListRelationFilter
mcpServers?: Prisma.AgentMcpServerListRelationFilter
assets?: Prisma.AssetListRelationFilter
auditLogs?: Prisma.AuditLogListRelationFilter
}
export type AgentOrderByWithRelationInput = {
@@ -256,6 +258,8 @@ export type AgentOrderByWithRelationInput = {
agentSessions?: Prisma.AgentSessionOrderByRelationAggregateInput
skills?: Prisma.AgentSkillOrderByRelationAggregateInput
mcpServers?: Prisma.AgentMcpServerOrderByRelationAggregateInput
assets?: Prisma.AssetOrderByRelationAggregateInput
auditLogs?: Prisma.AuditLogOrderByRelationAggregateInput
}
export type AgentWhereUniqueInput = Prisma.AtLeast<{
@@ -280,6 +284,8 @@ export type AgentWhereUniqueInput = Prisma.AtLeast<{
agentSessions?: Prisma.AgentSessionListRelationFilter
skills?: Prisma.AgentSkillListRelationFilter
mcpServers?: Prisma.AgentMcpServerListRelationFilter
assets?: Prisma.AssetListRelationFilter
auditLogs?: Prisma.AuditLogListRelationFilter
}, "id">
export type AgentOrderByWithAggregationInput = {
@@ -331,6 +337,8 @@ export type AgentCreateInput = {
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutAgentInput
}
export type AgentUncheckedCreateInput = {
@@ -348,6 +356,8 @@ export type AgentUncheckedCreateInput = {
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillUncheckedCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerUncheckedCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutAgentInput
}
export type AgentUpdateInput = {
@@ -365,6 +375,8 @@ export type AgentUpdateInput = {
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutAgentNestedInput
}
export type AgentUncheckedUpdateInput = {
@@ -382,6 +394,8 @@ export type AgentUncheckedUpdateInput = {
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUncheckedUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUncheckedUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUncheckedUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutAgentNestedInput
}
export type AgentCreateManyInput = {
@@ -556,6 +570,22 @@ export type AgentUncheckedUpdateManyWithoutTeamNestedInput = {
deleteMany?: Prisma.AgentScalarWhereInput | Prisma.AgentScalarWhereInput[]
}
export type AgentCreateNestedOneWithoutAssetsInput = {
create?: Prisma.XOR<Prisma.AgentCreateWithoutAssetsInput, Prisma.AgentUncheckedCreateWithoutAssetsInput>
connectOrCreate?: Prisma.AgentCreateOrConnectWithoutAssetsInput
connect?: Prisma.AgentWhereUniqueInput
}
export type AgentUpdateOneWithoutAssetsNestedInput = {
create?: Prisma.XOR<Prisma.AgentCreateWithoutAssetsInput, Prisma.AgentUncheckedCreateWithoutAssetsInput>
connectOrCreate?: Prisma.AgentCreateOrConnectWithoutAssetsInput
upsert?: Prisma.AgentUpsertWithoutAssetsInput
disconnect?: Prisma.AgentWhereInput | boolean
delete?: Prisma.AgentWhereInput | boolean
connect?: Prisma.AgentWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.AgentUpdateToOneWithWhereWithoutAssetsInput, Prisma.AgentUpdateWithoutAssetsInput>, Prisma.AgentUncheckedUpdateWithoutAssetsInput>
}
export type EnumAgentTypeFieldUpdateOperationsInput = {
set?: $Enums.AgentType
}
@@ -686,6 +716,22 @@ export type AgentUncheckedUpdateManyWithoutProviderNestedInput = {
deleteMany?: Prisma.AgentScalarWhereInput | Prisma.AgentScalarWhereInput[]
}
export type AgentCreateNestedOneWithoutAuditLogsInput = {
create?: Prisma.XOR<Prisma.AgentCreateWithoutAuditLogsInput, Prisma.AgentUncheckedCreateWithoutAuditLogsInput>
connectOrCreate?: Prisma.AgentCreateOrConnectWithoutAuditLogsInput
connect?: Prisma.AgentWhereUniqueInput
}
export type AgentUpdateOneWithoutAuditLogsNestedInput = {
create?: Prisma.XOR<Prisma.AgentCreateWithoutAuditLogsInput, Prisma.AgentUncheckedCreateWithoutAuditLogsInput>
connectOrCreate?: Prisma.AgentCreateOrConnectWithoutAuditLogsInput
upsert?: Prisma.AgentUpsertWithoutAuditLogsInput
disconnect?: Prisma.AgentWhereInput | boolean
delete?: Prisma.AgentWhereInput | boolean
connect?: Prisma.AgentWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.AgentUpdateToOneWithWhereWithoutAuditLogsInput, Prisma.AgentUpdateWithoutAuditLogsInput>, Prisma.AgentUncheckedUpdateWithoutAuditLogsInput>
}
export type AgentCreateWithoutUserInput = {
type: $Enums.AgentType
enabled?: boolean
@@ -700,6 +746,8 @@ export type AgentCreateWithoutUserInput = {
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutAgentInput
}
export type AgentUncheckedCreateWithoutUserInput = {
@@ -716,6 +764,8 @@ export type AgentUncheckedCreateWithoutUserInput = {
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillUncheckedCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerUncheckedCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutAgentInput
}
export type AgentCreateOrConnectWithoutUserInput = {
@@ -748,6 +798,8 @@ export type AgentUpdateWithoutUserInput = {
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutAgentNestedInput
}
export type AgentUncheckedUpdateWithoutUserInput = {
@@ -764,6 +816,8 @@ export type AgentUncheckedUpdateWithoutUserInput = {
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUncheckedUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUncheckedUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUncheckedUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutAgentNestedInput
}
export type AgentCreateWithoutTeamInput = {
@@ -780,6 +834,8 @@ export type AgentCreateWithoutTeamInput = {
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutAgentInput
}
export type AgentUncheckedCreateWithoutTeamInput = {
@@ -796,6 +852,8 @@ export type AgentUncheckedCreateWithoutTeamInput = {
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillUncheckedCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerUncheckedCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutAgentInput
}
export type AgentCreateOrConnectWithoutTeamInput = {
@@ -841,6 +899,94 @@ export type AgentScalarWhereInput = {
updatedAt?: Prisma.DateTimeFilter<"Agent"> | Date | string
}
export type AgentCreateWithoutAssetsInput = {
type: $Enums.AgentType
enabled?: boolean
permission?: $Enums.TeamMemberRole
soul?: string | null
config:PrismaJson.AgentConfig
createdAt?: Date | string
updatedAt?: Date | string
user: Prisma.UserCreateNestedOneWithoutAgentInput
provider?: Prisma.ProviderCreateNestedOneWithoutAgentsInput
modelRef?: Prisma.ModelCreateNestedOneWithoutAgentsInput
team: Prisma.TeamCreateNestedOneWithoutAgentsInput
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutAgentInput
}
export type AgentUncheckedCreateWithoutAssetsInput = {
id: string
type: $Enums.AgentType
enabled?: boolean
permission?: $Enums.TeamMemberRole
soul?: string | null
providerId?: string | null
modelId?: string | null
teamId: string
config:PrismaJson.AgentConfig
createdAt?: Date | string
updatedAt?: Date | string
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillUncheckedCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerUncheckedCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutAgentInput
}
export type AgentCreateOrConnectWithoutAssetsInput = {
where: Prisma.AgentWhereUniqueInput
create: Prisma.XOR<Prisma.AgentCreateWithoutAssetsInput, Prisma.AgentUncheckedCreateWithoutAssetsInput>
}
export type AgentUpsertWithoutAssetsInput = {
update: Prisma.XOR<Prisma.AgentUpdateWithoutAssetsInput, Prisma.AgentUncheckedUpdateWithoutAssetsInput>
create: Prisma.XOR<Prisma.AgentCreateWithoutAssetsInput, Prisma.AgentUncheckedCreateWithoutAssetsInput>
where?: Prisma.AgentWhereInput
}
export type AgentUpdateToOneWithWhereWithoutAssetsInput = {
where?: Prisma.AgentWhereInput
data: Prisma.XOR<Prisma.AgentUpdateWithoutAssetsInput, Prisma.AgentUncheckedUpdateWithoutAssetsInput>
}
export type AgentUpdateWithoutAssetsInput = {
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
config?:PrismaJson.AgentConfig
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
user?: Prisma.UserUpdateOneRequiredWithoutAgentNestedInput
provider?: Prisma.ProviderUpdateOneWithoutAgentsNestedInput
modelRef?: Prisma.ModelUpdateOneWithoutAgentsNestedInput
team?: Prisma.TeamUpdateOneRequiredWithoutAgentsNestedInput
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutAgentNestedInput
}
export type AgentUncheckedUpdateWithoutAssetsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
teamId?: Prisma.StringFieldUpdateOperationsInput | string
config?:PrismaJson.AgentConfig
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUncheckedUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUncheckedUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutAgentNestedInput
}
export type AgentCreateWithoutSkillsInput = {
type: $Enums.AgentType
enabled?: boolean
@@ -855,6 +1001,8 @@ export type AgentCreateWithoutSkillsInput = {
team: Prisma.TeamCreateNestedOneWithoutAgentsInput
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutAgentInput
}
export type AgentUncheckedCreateWithoutSkillsInput = {
@@ -871,6 +1019,8 @@ export type AgentUncheckedCreateWithoutSkillsInput = {
updatedAt?: Date | string
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerUncheckedCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutAgentInput
}
export type AgentCreateOrConnectWithoutSkillsInput = {
@@ -903,6 +1053,8 @@ export type AgentUpdateWithoutSkillsInput = {
team?: Prisma.TeamUpdateOneRequiredWithoutAgentsNestedInput
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutAgentNestedInput
}
export type AgentUncheckedUpdateWithoutSkillsInput = {
@@ -919,6 +1071,8 @@ export type AgentUncheckedUpdateWithoutSkillsInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUncheckedUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUncheckedUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutAgentNestedInput
}
export type AgentCreateWithoutMcpServersInput = {
@@ -935,6 +1089,8 @@ export type AgentCreateWithoutMcpServersInput = {
team: Prisma.TeamCreateNestedOneWithoutAgentsInput
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutAgentInput
}
export type AgentUncheckedCreateWithoutMcpServersInput = {
@@ -951,6 +1107,8 @@ export type AgentUncheckedCreateWithoutMcpServersInput = {
updatedAt?: Date | string
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillUncheckedCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutAgentInput
}
export type AgentCreateOrConnectWithoutMcpServersInput = {
@@ -983,6 +1141,8 @@ export type AgentUpdateWithoutMcpServersInput = {
team?: Prisma.TeamUpdateOneRequiredWithoutAgentsNestedInput
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutAgentNestedInput
}
export type AgentUncheckedUpdateWithoutMcpServersInput = {
@@ -999,6 +1159,8 @@ export type AgentUncheckedUpdateWithoutMcpServersInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUncheckedUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUncheckedUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutAgentNestedInput
}
export type AgentCreateWithoutAgentSessionsInput = {
@@ -1015,6 +1177,8 @@ export type AgentCreateWithoutAgentSessionsInput = {
team: Prisma.TeamCreateNestedOneWithoutAgentsInput
skills?: Prisma.AgentSkillCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutAgentInput
}
export type AgentUncheckedCreateWithoutAgentSessionsInput = {
@@ -1031,6 +1195,8 @@ export type AgentUncheckedCreateWithoutAgentSessionsInput = {
updatedAt?: Date | string
skills?: Prisma.AgentSkillUncheckedCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerUncheckedCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutAgentInput
}
export type AgentCreateOrConnectWithoutAgentSessionsInput = {
@@ -1063,6 +1229,8 @@ export type AgentUpdateWithoutAgentSessionsInput = {
team?: Prisma.TeamUpdateOneRequiredWithoutAgentsNestedInput
skills?: Prisma.AgentSkillUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutAgentNestedInput
}
export type AgentUncheckedUpdateWithoutAgentSessionsInput = {
@@ -1079,6 +1247,8 @@ export type AgentUncheckedUpdateWithoutAgentSessionsInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
skills?: Prisma.AgentSkillUncheckedUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUncheckedUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUncheckedUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutAgentNestedInput
}
export type AgentCreateWithoutModelRefInput = {
@@ -1095,6 +1265,8 @@ export type AgentCreateWithoutModelRefInput = {
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutAgentInput
}
export type AgentUncheckedCreateWithoutModelRefInput = {
@@ -1111,6 +1283,8 @@ export type AgentUncheckedCreateWithoutModelRefInput = {
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillUncheckedCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerUncheckedCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutAgentInput
}
export type AgentCreateOrConnectWithoutModelRefInput = {
@@ -1153,6 +1327,8 @@ export type AgentCreateWithoutProviderInput = {
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutAgentInput
}
export type AgentUncheckedCreateWithoutProviderInput = {
@@ -1169,6 +1345,8 @@ export type AgentUncheckedCreateWithoutProviderInput = {
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillUncheckedCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerUncheckedCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutAgentInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutAgentInput
}
export type AgentCreateOrConnectWithoutProviderInput = {
@@ -1197,6 +1375,94 @@ export type AgentUpdateManyWithWhereWithoutProviderInput = {
data: Prisma.XOR<Prisma.AgentUpdateManyMutationInput, Prisma.AgentUncheckedUpdateManyWithoutProviderInput>
}
export type AgentCreateWithoutAuditLogsInput = {
type: $Enums.AgentType
enabled?: boolean
permission?: $Enums.TeamMemberRole
soul?: string | null
config:PrismaJson.AgentConfig
createdAt?: Date | string
updatedAt?: Date | string
user: Prisma.UserCreateNestedOneWithoutAgentInput
provider?: Prisma.ProviderCreateNestedOneWithoutAgentsInput
modelRef?: Prisma.ModelCreateNestedOneWithoutAgentsInput
team: Prisma.TeamCreateNestedOneWithoutAgentsInput
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetCreateNestedManyWithoutAgentInput
}
export type AgentUncheckedCreateWithoutAuditLogsInput = {
id: string
type: $Enums.AgentType
enabled?: boolean
permission?: $Enums.TeamMemberRole
soul?: string | null
providerId?: string | null
modelId?: string | null
teamId: string
config:PrismaJson.AgentConfig
createdAt?: Date | string
updatedAt?: Date | string
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAgentInput
skills?: Prisma.AgentSkillUncheckedCreateNestedManyWithoutAgentInput
mcpServers?: Prisma.AgentMcpServerUncheckedCreateNestedManyWithoutAgentInput
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutAgentInput
}
export type AgentCreateOrConnectWithoutAuditLogsInput = {
where: Prisma.AgentWhereUniqueInput
create: Prisma.XOR<Prisma.AgentCreateWithoutAuditLogsInput, Prisma.AgentUncheckedCreateWithoutAuditLogsInput>
}
export type AgentUpsertWithoutAuditLogsInput = {
update: Prisma.XOR<Prisma.AgentUpdateWithoutAuditLogsInput, Prisma.AgentUncheckedUpdateWithoutAuditLogsInput>
create: Prisma.XOR<Prisma.AgentCreateWithoutAuditLogsInput, Prisma.AgentUncheckedCreateWithoutAuditLogsInput>
where?: Prisma.AgentWhereInput
}
export type AgentUpdateToOneWithWhereWithoutAuditLogsInput = {
where?: Prisma.AgentWhereInput
data: Prisma.XOR<Prisma.AgentUpdateWithoutAuditLogsInput, Prisma.AgentUncheckedUpdateWithoutAuditLogsInput>
}
export type AgentUpdateWithoutAuditLogsInput = {
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
config?:PrismaJson.AgentConfig
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
user?: Prisma.UserUpdateOneRequiredWithoutAgentNestedInput
provider?: Prisma.ProviderUpdateOneWithoutAgentsNestedInput
modelRef?: Prisma.ModelUpdateOneWithoutAgentsNestedInput
team?: Prisma.TeamUpdateOneRequiredWithoutAgentsNestedInput
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUpdateManyWithoutAgentNestedInput
}
export type AgentUncheckedUpdateWithoutAuditLogsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
teamId?: Prisma.StringFieldUpdateOperationsInput | string
config?:PrismaJson.AgentConfig
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUncheckedUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUncheckedUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUncheckedUpdateManyWithoutAgentNestedInput
}
export type AgentCreateManyTeamInput = {
id: string
type: $Enums.AgentType
@@ -1224,6 +1490,8 @@ export type AgentUpdateWithoutTeamInput = {
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutAgentNestedInput
}
export type AgentUncheckedUpdateWithoutTeamInput = {
@@ -1240,6 +1508,8 @@ export type AgentUncheckedUpdateWithoutTeamInput = {
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUncheckedUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUncheckedUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUncheckedUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutAgentNestedInput
}
export type AgentUncheckedUpdateManyWithoutTeamInput = {
@@ -1282,6 +1552,8 @@ export type AgentUpdateWithoutModelRefInput = {
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutAgentNestedInput
}
export type AgentUncheckedUpdateWithoutModelRefInput = {
@@ -1298,6 +1570,8 @@ export type AgentUncheckedUpdateWithoutModelRefInput = {
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUncheckedUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUncheckedUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUncheckedUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutAgentNestedInput
}
export type AgentUncheckedUpdateManyWithoutModelRefInput = {
@@ -1340,6 +1614,8 @@ export type AgentUpdateWithoutProviderInput = {
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutAgentNestedInput
}
export type AgentUncheckedUpdateWithoutProviderInput = {
@@ -1356,6 +1632,8 @@ export type AgentUncheckedUpdateWithoutProviderInput = {
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAgentNestedInput
skills?: Prisma.AgentSkillUncheckedUpdateManyWithoutAgentNestedInput
mcpServers?: Prisma.AgentMcpServerUncheckedUpdateManyWithoutAgentNestedInput
assets?: Prisma.AssetUncheckedUpdateManyWithoutAgentNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutAgentNestedInput
}
export type AgentUncheckedUpdateManyWithoutProviderInput = {
@@ -1380,12 +1658,16 @@ export type AgentCountOutputType = {
agentSessions: number
skills: number
mcpServers: number
assets: number
auditLogs: number
}
export type AgentCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
agentSessions?: boolean | AgentCountOutputTypeCountAgentSessionsArgs
skills?: boolean | AgentCountOutputTypeCountSkillsArgs
mcpServers?: boolean | AgentCountOutputTypeCountMcpServersArgs
assets?: boolean | AgentCountOutputTypeCountAssetsArgs
auditLogs?: boolean | AgentCountOutputTypeCountAuditLogsArgs
}
/**
@@ -1419,6 +1701,20 @@ export type AgentCountOutputTypeCountMcpServersArgs<ExtArgs extends runtime.Type
where?: Prisma.AgentMcpServerWhereInput
}
/**
* AgentCountOutputType without action
*/
export type AgentCountOutputTypeCountAssetsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.AssetWhereInput
}
/**
* AgentCountOutputType without action
*/
export type AgentCountOutputTypeCountAuditLogsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.AuditLogWhereInput
}
export type AgentSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
@@ -1439,6 +1735,8 @@ export type AgentSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs =
agentSessions?: boolean | Prisma.Agent$agentSessionsArgs<ExtArgs>
skills?: boolean | Prisma.Agent$skillsArgs<ExtArgs>
mcpServers?: boolean | Prisma.Agent$mcpServersArgs<ExtArgs>
assets?: boolean | Prisma.Agent$assetsArgs<ExtArgs>
auditLogs?: boolean | Prisma.Agent$auditLogsArgs<ExtArgs>
_count?: boolean | Prisma.AgentCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["agent"]>
@@ -1501,6 +1799,8 @@ export type AgentInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
agentSessions?: boolean | Prisma.Agent$agentSessionsArgs<ExtArgs>
skills?: boolean | Prisma.Agent$skillsArgs<ExtArgs>
mcpServers?: boolean | Prisma.Agent$mcpServersArgs<ExtArgs>
assets?: boolean | Prisma.Agent$assetsArgs<ExtArgs>
auditLogs?: boolean | Prisma.Agent$auditLogsArgs<ExtArgs>
_count?: boolean | Prisma.AgentCountOutputTypeDefaultArgs<ExtArgs>
}
export type AgentIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -1526,6 +1826,8 @@ export type $AgentPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs
agentSessions: Prisma.$AgentSessionPayload<ExtArgs>[]
skills: Prisma.$AgentSkillPayload<ExtArgs>[]
mcpServers: Prisma.$AgentMcpServerPayload<ExtArgs>[]
assets: Prisma.$AssetPayload<ExtArgs>[]
auditLogs: Prisma.$AuditLogPayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
@@ -1943,6 +2245,8 @@ export interface Prisma__AgentClient<T, Null = never, ExtArgs extends runtime.Ty
agentSessions<T extends Prisma.Agent$agentSessionsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Agent$agentSessionsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AgentSessionPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
skills<T extends Prisma.Agent$skillsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Agent$skillsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AgentSkillPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
mcpServers<T extends Prisma.Agent$mcpServersArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Agent$mcpServersArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AgentMcpServerPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
assets<T extends Prisma.Agent$assetsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Agent$assetsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AssetPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
auditLogs<T extends Prisma.Agent$auditLogsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Agent$auditLogsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AuditLogPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
@@ -2493,6 +2797,54 @@ export type Agent$mcpServersArgs<ExtArgs extends runtime.Types.Extensions.Intern
distinct?: Prisma.AgentMcpServerScalarFieldEnum | Prisma.AgentMcpServerScalarFieldEnum[]
}
/**
* Agent.assets
*/
export type Agent$assetsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the Asset
*/
select?: Prisma.AssetSelect<ExtArgs> | null
/**
* Omit specific fields from the Asset
*/
omit?: Prisma.AssetOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.AssetInclude<ExtArgs> | null
where?: Prisma.AssetWhereInput
orderBy?: Prisma.AssetOrderByWithRelationInput | Prisma.AssetOrderByWithRelationInput[]
cursor?: Prisma.AssetWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.AssetScalarFieldEnum | Prisma.AssetScalarFieldEnum[]
}
/**
* Agent.auditLogs
*/
export type Agent$auditLogsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the AuditLog
*/
select?: Prisma.AuditLogSelect<ExtArgs> | null
/**
* Omit specific fields from the AuditLog
*/
omit?: Prisma.AuditLogOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.AuditLogInclude<ExtArgs> | null
where?: Prisma.AuditLogWhereInput
orderBy?: Prisma.AuditLogOrderByWithRelationInput | Prisma.AuditLogOrderByWithRelationInput[]
cursor?: Prisma.AuditLogWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.AuditLogScalarFieldEnum | Prisma.AuditLogScalarFieldEnum[]
}
/**
* Agent without action
*/
File diff suppressed because it is too large Load Diff
+205 -1
View File
@@ -31,6 +31,7 @@ export type AuditLogMinAggregateOutputType = {
action: string | null
teamId: string | null
userId: string | null
agentId: string | null
projectId: string | null
itemId: string | null
createdAt: Date | null
@@ -41,6 +42,7 @@ export type AuditLogMaxAggregateOutputType = {
action: string | null
teamId: string | null
userId: string | null
agentId: string | null
projectId: string | null
itemId: string | null
createdAt: Date | null
@@ -51,6 +53,7 @@ export type AuditLogCountAggregateOutputType = {
action: number
teamId: number
userId: number
agentId: number
projectId: number
itemId: number
createdAt: number
@@ -63,6 +66,7 @@ export type AuditLogMinAggregateInputType = {
action?: true
teamId?: true
userId?: true
agentId?: true
projectId?: true
itemId?: true
createdAt?: true
@@ -73,6 +77,7 @@ export type AuditLogMaxAggregateInputType = {
action?: true
teamId?: true
userId?: true
agentId?: true
projectId?: true
itemId?: true
createdAt?: true
@@ -83,6 +88,7 @@ export type AuditLogCountAggregateInputType = {
action?: true
teamId?: true
userId?: true
agentId?: true
projectId?: true
itemId?: true
createdAt?: true
@@ -166,6 +172,7 @@ export type AuditLogGroupByOutputType = {
action: string
teamId: string
userId: string | null
agentId: string | null
projectId: string | null
itemId: string | null
createdAt: Date
@@ -197,11 +204,13 @@ export type AuditLogWhereInput = {
action?: Prisma.StringFilter<"AuditLog"> | string
teamId?: Prisma.StringFilter<"AuditLog"> | string
userId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
agentId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
projectId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
itemId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
createdAt?: Prisma.DateTimeFilter<"AuditLog"> | Date | string
team?: Prisma.XOR<Prisma.TeamScalarRelationFilter, Prisma.TeamWhereInput>
user?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
agent?: Prisma.XOR<Prisma.AgentNullableScalarRelationFilter, Prisma.AgentWhereInput> | null
project?: Prisma.XOR<Prisma.ProjectNullableScalarRelationFilter, Prisma.ProjectWhereInput> | null
}
@@ -210,11 +219,13 @@ export type AuditLogOrderByWithRelationInput = {
action?: Prisma.SortOrder
teamId?: Prisma.SortOrder
userId?: Prisma.SortOrderInput | Prisma.SortOrder
agentId?: Prisma.SortOrderInput | Prisma.SortOrder
projectId?: Prisma.SortOrderInput | Prisma.SortOrder
itemId?: Prisma.SortOrderInput | Prisma.SortOrder
createdAt?: Prisma.SortOrder
team?: Prisma.TeamOrderByWithRelationInput
user?: Prisma.UserOrderByWithRelationInput
agent?: Prisma.AgentOrderByWithRelationInput
project?: Prisma.ProjectOrderByWithRelationInput
}
@@ -226,11 +237,13 @@ export type AuditLogWhereUniqueInput = Prisma.AtLeast<{
action?: Prisma.StringFilter<"AuditLog"> | string
teamId?: Prisma.StringFilter<"AuditLog"> | string
userId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
agentId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
projectId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
itemId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
createdAt?: Prisma.DateTimeFilter<"AuditLog"> | Date | string
team?: Prisma.XOR<Prisma.TeamScalarRelationFilter, Prisma.TeamWhereInput>
user?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
agent?: Prisma.XOR<Prisma.AgentNullableScalarRelationFilter, Prisma.AgentWhereInput> | null
project?: Prisma.XOR<Prisma.ProjectNullableScalarRelationFilter, Prisma.ProjectWhereInput> | null
}, "id">
@@ -239,6 +252,7 @@ export type AuditLogOrderByWithAggregationInput = {
action?: Prisma.SortOrder
teamId?: Prisma.SortOrder
userId?: Prisma.SortOrderInput | Prisma.SortOrder
agentId?: Prisma.SortOrderInput | Prisma.SortOrder
projectId?: Prisma.SortOrderInput | Prisma.SortOrder
itemId?: Prisma.SortOrderInput | Prisma.SortOrder
createdAt?: Prisma.SortOrder
@@ -255,6 +269,7 @@ export type AuditLogScalarWhereWithAggregatesInput = {
action?: Prisma.StringWithAggregatesFilter<"AuditLog"> | string
teamId?: Prisma.StringWithAggregatesFilter<"AuditLog"> | string
userId?: Prisma.StringNullableWithAggregatesFilter<"AuditLog"> | string | null
agentId?: Prisma.StringNullableWithAggregatesFilter<"AuditLog"> | string | null
projectId?: Prisma.StringNullableWithAggregatesFilter<"AuditLog"> | string | null
itemId?: Prisma.StringNullableWithAggregatesFilter<"AuditLog"> | string | null
createdAt?: Prisma.DateTimeWithAggregatesFilter<"AuditLog"> | Date | string
@@ -267,6 +282,7 @@ export type AuditLogCreateInput = {
createdAt?: Date | string
team: Prisma.TeamCreateNestedOneWithoutAuditLogsInput
user?: Prisma.UserCreateNestedOneWithoutAuditLogsInput
agent?: Prisma.AgentCreateNestedOneWithoutAuditLogsInput
project?: Prisma.ProjectCreateNestedOneWithoutAuditLogsInput
}
@@ -275,6 +291,7 @@ export type AuditLogUncheckedCreateInput = {
action: string
teamId: string
userId?: string | null
agentId?: string | null
projectId?: string | null
itemId?: string | null
createdAt?: Date | string
@@ -287,6 +304,7 @@ export type AuditLogUpdateInput = {
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
team?: Prisma.TeamUpdateOneRequiredWithoutAuditLogsNestedInput
user?: Prisma.UserUpdateOneWithoutAuditLogsNestedInput
agent?: Prisma.AgentUpdateOneWithoutAuditLogsNestedInput
project?: Prisma.ProjectUpdateOneWithoutAuditLogsNestedInput
}
@@ -295,6 +313,7 @@ export type AuditLogUncheckedUpdateInput = {
action?: Prisma.StringFieldUpdateOperationsInput | string
teamId?: Prisma.StringFieldUpdateOperationsInput | string
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
agentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
@@ -305,6 +324,7 @@ export type AuditLogCreateManyInput = {
action: string
teamId: string
userId?: string | null
agentId?: string | null
projectId?: string | null
itemId?: string | null
createdAt?: Date | string
@@ -322,6 +342,7 @@ export type AuditLogUncheckedUpdateManyInput = {
action?: Prisma.StringFieldUpdateOperationsInput | string
teamId?: Prisma.StringFieldUpdateOperationsInput | string
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
agentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
@@ -342,6 +363,7 @@ export type AuditLogCountOrderByAggregateInput = {
action?: Prisma.SortOrder
teamId?: Prisma.SortOrder
userId?: Prisma.SortOrder
agentId?: Prisma.SortOrder
projectId?: Prisma.SortOrder
itemId?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
@@ -352,6 +374,7 @@ export type AuditLogMaxOrderByAggregateInput = {
action?: Prisma.SortOrder
teamId?: Prisma.SortOrder
userId?: Prisma.SortOrder
agentId?: Prisma.SortOrder
projectId?: Prisma.SortOrder
itemId?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
@@ -362,6 +385,7 @@ export type AuditLogMinOrderByAggregateInput = {
action?: Prisma.SortOrder
teamId?: Prisma.SortOrder
userId?: Prisma.SortOrder
agentId?: Prisma.SortOrder
projectId?: Prisma.SortOrder
itemId?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
@@ -493,12 +517,55 @@ export type AuditLogUncheckedUpdateManyWithoutProjectNestedInput = {
deleteMany?: Prisma.AuditLogScalarWhereInput | Prisma.AuditLogScalarWhereInput[]
}
export type AuditLogCreateNestedManyWithoutAgentInput = {
create?: Prisma.XOR<Prisma.AuditLogCreateWithoutAgentInput, Prisma.AuditLogUncheckedCreateWithoutAgentInput> | Prisma.AuditLogCreateWithoutAgentInput[] | Prisma.AuditLogUncheckedCreateWithoutAgentInput[]
connectOrCreate?: Prisma.AuditLogCreateOrConnectWithoutAgentInput | Prisma.AuditLogCreateOrConnectWithoutAgentInput[]
createMany?: Prisma.AuditLogCreateManyAgentInputEnvelope
connect?: Prisma.AuditLogWhereUniqueInput | Prisma.AuditLogWhereUniqueInput[]
}
export type AuditLogUncheckedCreateNestedManyWithoutAgentInput = {
create?: Prisma.XOR<Prisma.AuditLogCreateWithoutAgentInput, Prisma.AuditLogUncheckedCreateWithoutAgentInput> | Prisma.AuditLogCreateWithoutAgentInput[] | Prisma.AuditLogUncheckedCreateWithoutAgentInput[]
connectOrCreate?: Prisma.AuditLogCreateOrConnectWithoutAgentInput | Prisma.AuditLogCreateOrConnectWithoutAgentInput[]
createMany?: Prisma.AuditLogCreateManyAgentInputEnvelope
connect?: Prisma.AuditLogWhereUniqueInput | Prisma.AuditLogWhereUniqueInput[]
}
export type AuditLogUpdateManyWithoutAgentNestedInput = {
create?: Prisma.XOR<Prisma.AuditLogCreateWithoutAgentInput, Prisma.AuditLogUncheckedCreateWithoutAgentInput> | Prisma.AuditLogCreateWithoutAgentInput[] | Prisma.AuditLogUncheckedCreateWithoutAgentInput[]
connectOrCreate?: Prisma.AuditLogCreateOrConnectWithoutAgentInput | Prisma.AuditLogCreateOrConnectWithoutAgentInput[]
upsert?: Prisma.AuditLogUpsertWithWhereUniqueWithoutAgentInput | Prisma.AuditLogUpsertWithWhereUniqueWithoutAgentInput[]
createMany?: Prisma.AuditLogCreateManyAgentInputEnvelope
set?: Prisma.AuditLogWhereUniqueInput | Prisma.AuditLogWhereUniqueInput[]
disconnect?: Prisma.AuditLogWhereUniqueInput | Prisma.AuditLogWhereUniqueInput[]
delete?: Prisma.AuditLogWhereUniqueInput | Prisma.AuditLogWhereUniqueInput[]
connect?: Prisma.AuditLogWhereUniqueInput | Prisma.AuditLogWhereUniqueInput[]
update?: Prisma.AuditLogUpdateWithWhereUniqueWithoutAgentInput | Prisma.AuditLogUpdateWithWhereUniqueWithoutAgentInput[]
updateMany?: Prisma.AuditLogUpdateManyWithWhereWithoutAgentInput | Prisma.AuditLogUpdateManyWithWhereWithoutAgentInput[]
deleteMany?: Prisma.AuditLogScalarWhereInput | Prisma.AuditLogScalarWhereInput[]
}
export type AuditLogUncheckedUpdateManyWithoutAgentNestedInput = {
create?: Prisma.XOR<Prisma.AuditLogCreateWithoutAgentInput, Prisma.AuditLogUncheckedCreateWithoutAgentInput> | Prisma.AuditLogCreateWithoutAgentInput[] | Prisma.AuditLogUncheckedCreateWithoutAgentInput[]
connectOrCreate?: Prisma.AuditLogCreateOrConnectWithoutAgentInput | Prisma.AuditLogCreateOrConnectWithoutAgentInput[]
upsert?: Prisma.AuditLogUpsertWithWhereUniqueWithoutAgentInput | Prisma.AuditLogUpsertWithWhereUniqueWithoutAgentInput[]
createMany?: Prisma.AuditLogCreateManyAgentInputEnvelope
set?: Prisma.AuditLogWhereUniqueInput | Prisma.AuditLogWhereUniqueInput[]
disconnect?: Prisma.AuditLogWhereUniqueInput | Prisma.AuditLogWhereUniqueInput[]
delete?: Prisma.AuditLogWhereUniqueInput | Prisma.AuditLogWhereUniqueInput[]
connect?: Prisma.AuditLogWhereUniqueInput | Prisma.AuditLogWhereUniqueInput[]
update?: Prisma.AuditLogUpdateWithWhereUniqueWithoutAgentInput | Prisma.AuditLogUpdateWithWhereUniqueWithoutAgentInput[]
updateMany?: Prisma.AuditLogUpdateManyWithWhereWithoutAgentInput | Prisma.AuditLogUpdateManyWithWhereWithoutAgentInput[]
deleteMany?: Prisma.AuditLogScalarWhereInput | Prisma.AuditLogScalarWhereInput[]
}
export type AuditLogCreateWithoutUserInput = {
id?: string
action: string
itemId?: string | null
createdAt?: Date | string
team: Prisma.TeamCreateNestedOneWithoutAuditLogsInput
agent?: Prisma.AgentCreateNestedOneWithoutAuditLogsInput
project?: Prisma.ProjectCreateNestedOneWithoutAuditLogsInput
}
@@ -506,6 +573,7 @@ export type AuditLogUncheckedCreateWithoutUserInput = {
id?: string
action: string
teamId: string
agentId?: string | null
projectId?: string | null
itemId?: string | null
createdAt?: Date | string
@@ -545,6 +613,7 @@ export type AuditLogScalarWhereInput = {
action?: Prisma.StringFilter<"AuditLog"> | string
teamId?: Prisma.StringFilter<"AuditLog"> | string
userId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
agentId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
projectId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
itemId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
createdAt?: Prisma.DateTimeFilter<"AuditLog"> | Date | string
@@ -556,6 +625,7 @@ export type AuditLogCreateWithoutTeamInput = {
itemId?: string | null
createdAt?: Date | string
user?: Prisma.UserCreateNestedOneWithoutAuditLogsInput
agent?: Prisma.AgentCreateNestedOneWithoutAuditLogsInput
project?: Prisma.ProjectCreateNestedOneWithoutAuditLogsInput
}
@@ -563,6 +633,7 @@ export type AuditLogUncheckedCreateWithoutTeamInput = {
id?: string
action: string
userId?: string | null
agentId?: string | null
projectId?: string | null
itemId?: string | null
createdAt?: Date | string
@@ -601,6 +672,7 @@ export type AuditLogCreateWithoutProjectInput = {
createdAt?: Date | string
team: Prisma.TeamCreateNestedOneWithoutAuditLogsInput
user?: Prisma.UserCreateNestedOneWithoutAuditLogsInput
agent?: Prisma.AgentCreateNestedOneWithoutAuditLogsInput
}
export type AuditLogUncheckedCreateWithoutProjectInput = {
@@ -608,6 +680,7 @@ export type AuditLogUncheckedCreateWithoutProjectInput = {
action: string
teamId: string
userId?: string | null
agentId?: string | null
itemId?: string | null
createdAt?: Date | string
}
@@ -638,10 +711,57 @@ export type AuditLogUpdateManyWithWhereWithoutProjectInput = {
data: Prisma.XOR<Prisma.AuditLogUpdateManyMutationInput, Prisma.AuditLogUncheckedUpdateManyWithoutProjectInput>
}
export type AuditLogCreateWithoutAgentInput = {
id?: string
action: string
itemId?: string | null
createdAt?: Date | string
team: Prisma.TeamCreateNestedOneWithoutAuditLogsInput
user?: Prisma.UserCreateNestedOneWithoutAuditLogsInput
project?: Prisma.ProjectCreateNestedOneWithoutAuditLogsInput
}
export type AuditLogUncheckedCreateWithoutAgentInput = {
id?: string
action: string
teamId: string
userId?: string | null
projectId?: string | null
itemId?: string | null
createdAt?: Date | string
}
export type AuditLogCreateOrConnectWithoutAgentInput = {
where: Prisma.AuditLogWhereUniqueInput
create: Prisma.XOR<Prisma.AuditLogCreateWithoutAgentInput, Prisma.AuditLogUncheckedCreateWithoutAgentInput>
}
export type AuditLogCreateManyAgentInputEnvelope = {
data: Prisma.AuditLogCreateManyAgentInput | Prisma.AuditLogCreateManyAgentInput[]
skipDuplicates?: boolean
}
export type AuditLogUpsertWithWhereUniqueWithoutAgentInput = {
where: Prisma.AuditLogWhereUniqueInput
update: Prisma.XOR<Prisma.AuditLogUpdateWithoutAgentInput, Prisma.AuditLogUncheckedUpdateWithoutAgentInput>
create: Prisma.XOR<Prisma.AuditLogCreateWithoutAgentInput, Prisma.AuditLogUncheckedCreateWithoutAgentInput>
}
export type AuditLogUpdateWithWhereUniqueWithoutAgentInput = {
where: Prisma.AuditLogWhereUniqueInput
data: Prisma.XOR<Prisma.AuditLogUpdateWithoutAgentInput, Prisma.AuditLogUncheckedUpdateWithoutAgentInput>
}
export type AuditLogUpdateManyWithWhereWithoutAgentInput = {
where: Prisma.AuditLogScalarWhereInput
data: Prisma.XOR<Prisma.AuditLogUpdateManyMutationInput, Prisma.AuditLogUncheckedUpdateManyWithoutAgentInput>
}
export type AuditLogCreateManyUserInput = {
id?: string
action: string
teamId: string
agentId?: string | null
projectId?: string | null
itemId?: string | null
createdAt?: Date | string
@@ -653,6 +773,7 @@ export type AuditLogUpdateWithoutUserInput = {
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
team?: Prisma.TeamUpdateOneRequiredWithoutAuditLogsNestedInput
agent?: Prisma.AgentUpdateOneWithoutAuditLogsNestedInput
project?: Prisma.ProjectUpdateOneWithoutAuditLogsNestedInput
}
@@ -660,6 +781,7 @@ export type AuditLogUncheckedUpdateWithoutUserInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
action?: Prisma.StringFieldUpdateOperationsInput | string
teamId?: Prisma.StringFieldUpdateOperationsInput | string
agentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
@@ -669,6 +791,7 @@ export type AuditLogUncheckedUpdateManyWithoutUserInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
action?: Prisma.StringFieldUpdateOperationsInput | string
teamId?: Prisma.StringFieldUpdateOperationsInput | string
agentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
@@ -678,6 +801,7 @@ export type AuditLogCreateManyTeamInput = {
id?: string
action: string
userId?: string | null
agentId?: string | null
projectId?: string | null
itemId?: string | null
createdAt?: Date | string
@@ -689,6 +813,7 @@ export type AuditLogUpdateWithoutTeamInput = {
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
user?: Prisma.UserUpdateOneWithoutAuditLogsNestedInput
agent?: Prisma.AgentUpdateOneWithoutAuditLogsNestedInput
project?: Prisma.ProjectUpdateOneWithoutAuditLogsNestedInput
}
@@ -696,6 +821,7 @@ export type AuditLogUncheckedUpdateWithoutTeamInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
action?: Prisma.StringFieldUpdateOperationsInput | string
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
agentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
@@ -705,6 +831,7 @@ export type AuditLogUncheckedUpdateManyWithoutTeamInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
action?: Prisma.StringFieldUpdateOperationsInput | string
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
agentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
@@ -715,6 +842,7 @@ export type AuditLogCreateManyProjectInput = {
action: string
teamId: string
userId?: string | null
agentId?: string | null
itemId?: string | null
createdAt?: Date | string
}
@@ -726,6 +854,7 @@ export type AuditLogUpdateWithoutProjectInput = {
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
team?: Prisma.TeamUpdateOneRequiredWithoutAuditLogsNestedInput
user?: Prisma.UserUpdateOneWithoutAuditLogsNestedInput
agent?: Prisma.AgentUpdateOneWithoutAuditLogsNestedInput
}
export type AuditLogUncheckedUpdateWithoutProjectInput = {
@@ -733,6 +862,7 @@ export type AuditLogUncheckedUpdateWithoutProjectInput = {
action?: Prisma.StringFieldUpdateOperationsInput | string
teamId?: Prisma.StringFieldUpdateOperationsInput | string
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
agentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
}
@@ -742,6 +872,47 @@ export type AuditLogUncheckedUpdateManyWithoutProjectInput = {
action?: Prisma.StringFieldUpdateOperationsInput | string
teamId?: Prisma.StringFieldUpdateOperationsInput | string
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
agentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
}
export type AuditLogCreateManyAgentInput = {
id?: string
action: string
teamId: string
userId?: string | null
projectId?: string | null
itemId?: string | null
createdAt?: Date | string
}
export type AuditLogUpdateWithoutAgentInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
action?: Prisma.StringFieldUpdateOperationsInput | string
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
team?: Prisma.TeamUpdateOneRequiredWithoutAuditLogsNestedInput
user?: Prisma.UserUpdateOneWithoutAuditLogsNestedInput
project?: Prisma.ProjectUpdateOneWithoutAuditLogsNestedInput
}
export type AuditLogUncheckedUpdateWithoutAgentInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
action?: Prisma.StringFieldUpdateOperationsInput | string
teamId?: Prisma.StringFieldUpdateOperationsInput | string
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
}
export type AuditLogUncheckedUpdateManyWithoutAgentInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
action?: Prisma.StringFieldUpdateOperationsInput | string
teamId?: Prisma.StringFieldUpdateOperationsInput | string
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
}
@@ -753,11 +924,13 @@ export type AuditLogSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
action?: boolean
teamId?: boolean
userId?: boolean
agentId?: boolean
projectId?: boolean
itemId?: boolean
createdAt?: boolean
team?: boolean | Prisma.TeamDefaultArgs<ExtArgs>
user?: boolean | Prisma.AuditLog$userArgs<ExtArgs>
agent?: boolean | Prisma.AuditLog$agentArgs<ExtArgs>
project?: boolean | Prisma.AuditLog$projectArgs<ExtArgs>
}, ExtArgs["result"]["auditLog"]>
@@ -766,11 +939,13 @@ export type AuditLogSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Exte
action?: boolean
teamId?: boolean
userId?: boolean
agentId?: boolean
projectId?: boolean
itemId?: boolean
createdAt?: boolean
team?: boolean | Prisma.TeamDefaultArgs<ExtArgs>
user?: boolean | Prisma.AuditLog$userArgs<ExtArgs>
agent?: boolean | Prisma.AuditLog$agentArgs<ExtArgs>
project?: boolean | Prisma.AuditLog$projectArgs<ExtArgs>
}, ExtArgs["result"]["auditLog"]>
@@ -779,11 +954,13 @@ export type AuditLogSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Exte
action?: boolean
teamId?: boolean
userId?: boolean
agentId?: boolean
projectId?: boolean
itemId?: boolean
createdAt?: boolean
team?: boolean | Prisma.TeamDefaultArgs<ExtArgs>
user?: boolean | Prisma.AuditLog$userArgs<ExtArgs>
agent?: boolean | Prisma.AuditLog$agentArgs<ExtArgs>
project?: boolean | Prisma.AuditLog$projectArgs<ExtArgs>
}, ExtArgs["result"]["auditLog"]>
@@ -792,25 +969,29 @@ export type AuditLogSelectScalar = {
action?: boolean
teamId?: boolean
userId?: boolean
agentId?: boolean
projectId?: boolean
itemId?: boolean
createdAt?: boolean
}
export type AuditLogOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "action" | "teamId" | "userId" | "projectId" | "itemId" | "createdAt", ExtArgs["result"]["auditLog"]>
export type AuditLogOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "action" | "teamId" | "userId" | "agentId" | "projectId" | "itemId" | "createdAt", ExtArgs["result"]["auditLog"]>
export type AuditLogInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
team?: boolean | Prisma.TeamDefaultArgs<ExtArgs>
user?: boolean | Prisma.AuditLog$userArgs<ExtArgs>
agent?: boolean | Prisma.AuditLog$agentArgs<ExtArgs>
project?: boolean | Prisma.AuditLog$projectArgs<ExtArgs>
}
export type AuditLogIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
team?: boolean | Prisma.TeamDefaultArgs<ExtArgs>
user?: boolean | Prisma.AuditLog$userArgs<ExtArgs>
agent?: boolean | Prisma.AuditLog$agentArgs<ExtArgs>
project?: boolean | Prisma.AuditLog$projectArgs<ExtArgs>
}
export type AuditLogIncludeUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
team?: boolean | Prisma.TeamDefaultArgs<ExtArgs>
user?: boolean | Prisma.AuditLog$userArgs<ExtArgs>
agent?: boolean | Prisma.AuditLog$agentArgs<ExtArgs>
project?: boolean | Prisma.AuditLog$projectArgs<ExtArgs>
}
@@ -819,6 +1000,7 @@ export type $AuditLogPayload<ExtArgs extends runtime.Types.Extensions.InternalAr
objects: {
team: Prisma.$TeamPayload<ExtArgs>
user: Prisma.$UserPayload<ExtArgs> | null
agent: Prisma.$AgentPayload<ExtArgs> | null
project: Prisma.$ProjectPayload<ExtArgs> | null
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
@@ -826,6 +1008,7 @@ export type $AuditLogPayload<ExtArgs extends runtime.Types.Extensions.InternalAr
action: string
teamId: string
userId: string | null
agentId: string | null
projectId: string | null
itemId: string | null
createdAt: Date
@@ -1225,6 +1408,7 @@ export interface Prisma__AuditLogClient<T, Null = never, ExtArgs extends runtime
readonly [Symbol.toStringTag]: "PrismaPromise"
team<T extends Prisma.TeamDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.TeamDefaultArgs<ExtArgs>>): Prisma.Prisma__TeamClient<runtime.Types.Result.GetResult<Prisma.$TeamPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
user<T extends Prisma.AuditLog$userArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AuditLog$userArgs<ExtArgs>>): Prisma.Prisma__UserClient<runtime.Types.Result.GetResult<Prisma.$UserPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
agent<T extends Prisma.AuditLog$agentArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AuditLog$agentArgs<ExtArgs>>): Prisma.Prisma__AgentClient<runtime.Types.Result.GetResult<Prisma.$AgentPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
project<T extends Prisma.AuditLog$projectArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AuditLog$projectArgs<ExtArgs>>): Prisma.Prisma__ProjectClient<runtime.Types.Result.GetResult<Prisma.$ProjectPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
@@ -1259,6 +1443,7 @@ export interface AuditLogFieldRefs {
readonly action: Prisma.FieldRef<"AuditLog", 'String'>
readonly teamId: Prisma.FieldRef<"AuditLog", 'String'>
readonly userId: Prisma.FieldRef<"AuditLog", 'String'>
readonly agentId: Prisma.FieldRef<"AuditLog", 'String'>
readonly projectId: Prisma.FieldRef<"AuditLog", 'String'>
readonly itemId: Prisma.FieldRef<"AuditLog", 'String'>
readonly createdAt: Prisma.FieldRef<"AuditLog", 'DateTime'>
@@ -1681,6 +1866,25 @@ export type AuditLog$userArgs<ExtArgs extends runtime.Types.Extensions.InternalA
where?: Prisma.UserWhereInput
}
/**
* AuditLog.agent
*/
export type AuditLog$agentArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the Agent
*/
select?: Prisma.AgentSelect<ExtArgs> | null
/**
* Omit specific fields from the Agent
*/
omit?: Prisma.AgentOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.AgentInclude<ExtArgs> | null
where?: Prisma.AgentWhereInput
}
/**
* AuditLog.project
*/
+10
View File
@@ -31,6 +31,12 @@ export const assetUserInfoSchema = z.object({
})
export type AssetUserInfo = z.infer<typeof assetUserInfoSchema>
export const assetAgentInfoSchema = z.object({
id: z.string(),
name: z.string(),
})
export type AssetAgentInfo = z.infer<typeof assetAgentInfoSchema>
export const fieldValueInfoSchema = z.object({
fieldId: z.string(),
@@ -70,6 +76,8 @@ export const assetInfoSchema = z.object({
deletedAt: z.string().nullable().optional(),
projectId: z.string().optional().nullable(),
creator: assetUserInfoSchema.nullable().optional(),
agentId: z.string().optional().nullable(),
agent: assetAgentInfoSchema.optional().nullable(),
fieldValues: z.array(fieldValueInfoSchema).optional(),
sortIndex: z.string().optional().nullable(),
startTime: z.number().optional().nullable(),
@@ -129,6 +137,7 @@ export const assetInfoSchema = z.object({
})
.nullable()
.optional(),
agent: assetAgentInfoSchema.optional().nullable(),
}),
),
})
@@ -146,6 +155,7 @@ export const createAssetRequestSchema = z.object({
sizeByte: z.number().optional(),
contentType: z.string().optional(),
creatorId: z.string().optional(),
agentId: z.string().optional(),
})
export type CreateAssetRequest = z.infer<typeof createAssetRequestSchema>
+12
View File
@@ -70,6 +70,14 @@ export const auditLogSchema = z.object({
action: z.nativeEnum(AuditAction),
teamId: z.string(),
userId: z.string().nullable().optional(),
agentId: z.string().nullable().optional(),
agent: z
.object({
id: z.string(),
name: z.string(),
})
.nullable()
.optional(),
projectId: z.string().nullable().optional(),
itemId: z.string().nullable().optional(),
createdAt: z.string(),
@@ -88,6 +96,10 @@ export const listAuditLogsQuerySchema = z.object({
.union([z.string(), z.array(z.string())])
.transform((val) => (Array.isArray(val) ? val : [val]))
.optional(),
agentIds: z
.union([z.string(), z.array(z.string())])
.transform((val) => (Array.isArray(val) ? val : [val]))
.optional(),
itemId: z.string().optional(),
})
+7
View File
@@ -42,5 +42,12 @@ export const stackVersionInfoSchema = z.object({
})
.nullable()
.optional(),
agent: z
.object({
id: z.string(),
name: z.string(),
})
.nullable()
.optional(),
})
export type StackVersionInfo = z.infer<typeof stackVersionInfoSchema>
+15 -2
View File
@@ -92,6 +92,7 @@ interface BreadcrumbNavProps {
name?: string | null
previewUrl?: string | null
creator?: { id: string; name: string | null } | null
agent?: { id: string; name: string } | null
}>
compareMode?: boolean
canCompareVersions?: boolean
@@ -376,8 +377,20 @@ export function BreadcrumbNav({
<span className="truncate text-sm font-semibold text-foreground">
{v.name}
</span>
<span className="truncate text-xs text-muted-foreground">
{v.creator?.name || 'Unknown'}
<span className="truncate text-xs text-muted-foreground flex items-center gap-1">
{v.agent ? (
<>
<Bot className="h-3 w-3 shrink-0" />
<span className="truncate">
{m.user_via_agent({
user: v.creator?.name || m.unknown_user(),
agent: v.agent.name,
})}
</span>
</>
) : (
v.creator?.name || m.unknown_user()
)}
</span>
</div>
@@ -19,7 +19,7 @@ import { Input } from '@/ui/components/ui/input'
import { Button } from '@/ui/components/ui/button'
import { Popover, PopoverContent, PopoverTrigger } from '@/ui/components/ui/popover'
import { Checkbox } from '@/ui/components/ui/checkbox'
import { Loader2, Search, Filter, Activity, X } from 'lucide-react'
import { Loader2, Search, Filter, Activity, X, Bot } from 'lucide-react'
import { formatTimeAgo } from '@/ui/lib/time'
const ALL_AUDIT_ACTIONS = Object.values(AuditAction)
@@ -353,9 +353,17 @@ export function AuditLogsDashboard({ teamId }: AuditLogsDashboardProps) {
{userName.slice(0, 2).toUpperCase()}
</AvatarFallback>
</Avatar>
<span className="text-xs font-medium text-foreground truncate max-w-[140px]">
{userName}
<span className="text-xs font-medium text-foreground truncate max-w-[160px]">
{log.agent
? m.user_via_agent({
user: userName,
agent: log.agent.name,
})
: userName}
</span>
{log.agent && (
<Bot className="h-3.5 w-3.5 text-muted-foreground shrink-0" />
)}
</div>
</TableCell>
<TableCell className="py-3 text-xs font-mono text-muted-foreground">
@@ -110,4 +110,45 @@ describe('FileCard', () => {
expect(screen.queryByText(/Manage versions|管理版本/i)).toBeNull()
})
it('renders Bot icon badge and user via agent creator when agent created the asset', () => {
const agentCreatedItem: AssetInfo = {
...fileItem,
creator: { id: 'u1', name: 'Alice' },
agentId: 'agent-1',
agent: { id: 'agent-1', name: 'Copilot Bot' },
} as AssetInfo
renderComponent({ item: agentCreatedItem })
const agentBadge = screen.getByTestId('agent-badge')
expect(agentBadge).toBeTruthy()
expect(agentBadge.getAttribute('title')).toBe('Copilot Bot')
expect(agentBadge.textContent).toBe('AI')
// Should show user via agent in author line
expect(screen.getByText(/Alice via Copilot Bot|Alice 通过 Copilot Bot/i)).toBeTruthy()
})
it('renders both AI text badge and version badge side-by-side on version stack', () => {
const agentStackItem: AssetInfo = {
...stackItem,
creator: { id: 'u1', name: 'Alice' },
agentId: 'agent-1',
agent: { id: 'agent-1', name: 'Copilot Bot' },
versionStack: {
versions: [
{ id: 'v1', version: 1, name: 'v1' },
{ id: 'stack-123', version: 2, name: 'v2' },
],
},
} as AssetInfo
renderComponent({ item: agentStackItem })
const agentBadge = screen.getByTestId('agent-badge')
expect(agentBadge).toBeTruthy()
expect(agentBadge.textContent).toBe('AI')
expect(screen.getByText('v2')).toBeTruthy()
})
})
@@ -254,13 +254,24 @@ export function FileCard({
/>
</div>
{displayItem.versionStack && (
<Badge className="absolute right-2 top-2 z-10">
v
{displayItem.versionStack.versions.find((v) => v.id === displayItem.id)?.version ??
displayItem.versionStack.versions.length}
</Badge>
)}
<div className="absolute right-2 top-2 z-10 flex items-center gap-1.5">
{displayItem.agent && (
<span
className="select-none rounded bg-black/60 px-1 py-0.5 text-xs font-medium text-white"
title={displayItem.agent.name}
data-testid="agent-badge"
>
AI
</span>
)}
{displayItem.versionStack && (
<Badge>
v
{displayItem.versionStack.versions.find((v) => v.id === displayItem.id)?.version ??
displayItem.versionStack.versions.length}
</Badge>
)}
</div>
<div className="relative aspect-square overflow-hidden bg-muted/30">
{displayItem.status === 'uploading' ||
@@ -310,7 +321,12 @@ export function FileCard({
{displayItem.createdAt &&
m.created_by_at({
time: formatTimeAgo(displayItem.createdAt),
author: displayItem.creator?.name || m.unknown_user(),
author: displayItem.agent
? m.user_via_agent({
user: displayItem.creator?.name || m.unknown_user(),
agent: displayItem.agent.name,
})
: displayItem.creator?.name || m.unknown_user(),
})}
</p>
</div>
@@ -244,6 +244,16 @@ export function FileListItem({
</span>
)}
{displayItem.agent && (
<span
className="select-none rounded bg-black/60 px-1 py-0.5 text-xs font-medium text-white shrink-0"
title={displayItem.agent.name}
data-testid="agent-badge"
>
AI
</span>
)}
{displayItem.versionStack && (
<Badge variant="outline" className="px-1 py-0 text-xs shrink-0">
v
@@ -200,4 +200,31 @@ describe('FileViewerLeftSidebar', () => {
behavior: 'auto',
})
})
it('renders AI badge on carousel thumbnail when asset has agent', () => {
const filesWithAgent: AssetInfo[] = [
{
id: 'file-agent',
name: 'Agent File.png',
proxyType: 'image',
agentId: 'agent-1',
agent: { id: 'agent-1', name: 'DrawBot' },
} as AssetInfo,
]
const { container } = render(
<FileViewerLeftSidebar
projectId="proj-1"
currentAssetId="file-agent"
parentFolderId="folder-1"
initialFiles={filesWithAgent}
initialNextCursor={undefined}
/>,
)
const agentBadge = container.querySelector('[data-testid="carousel-agent-badge"]')
expect(agentBadge).toBeTruthy()
expect(agentBadge?.getAttribute('title')).toBe('DrawBot')
expect(agentBadge?.textContent).toBe('AI')
})
})
@@ -136,13 +136,22 @@ export const FileViewerLeftSidebar: FC<FileViewerLeftSidebarProps> = ({
params={{ projectId, fileId: file.id }}
search={{ version: undefined }}
className={cn(
'rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block',
'rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block relative',
isActive
? 'w-[62px] h-[62px] opacity-100'
: 'w-[52px] h-[52px] opacity-60 hover:opacity-100',
)}
>
<CarouselFilePreview item={file} />
{file.agent && (
<span
className="absolute top-1 right-1 z-10 pointer-events-none select-none rounded bg-black/60 px-1 py-0.5 text-[10px] font-medium leading-none text-white"
title={file.agent.name}
data-testid="carousel-agent-badge"
>
AI
</span>
)}
</Link>
</div>
)
@@ -16,7 +16,7 @@ import { isSortable, useSortable } from '@dnd-kit/react/sortable'
import type { StackVersionInfo } from '@shumai/dtos'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { format, parseISO } from 'date-fns'
import { FileIcon, GripVertical, MoreVertical, Trash2 } from 'lucide-react'
import { Bot, FileIcon, GripVertical, MoreVertical, Trash2 } from 'lucide-react'
import { useEffect, useState } from 'react'
import { toast } from 'sonner'
@@ -107,7 +107,19 @@ function SortableVersionRow({
</span>
{/* Row 2: Creator & Create Date */}
<div className="flex items-center gap-1.5 text-xs text-muted-foreground truncate">
<span>{version.creator?.name || m.unknown()}</span>
{version.agent ? (
<span className="flex items-center gap-1 truncate">
<Bot className="h-3 w-3 shrink-0" />
<span className="truncate">
{m.user_via_agent({
user: version.creator?.name || m.unknown(),
agent: version.agent.name,
})}
</span>
</span>
) : (
<span>{version.creator?.name || m.unknown()}</span>
)}
{formattedDate && (
<>
<span>•</span>
+1
View File
@@ -1013,6 +1013,7 @@
"n_items_plural": "{count} Items",
"fullscreen": "Fullscreen",
"created_by_at": "{time} by {author}",
"user_via_agent": "{user} via {agent}",
"date_format_long": "MMMM d, yyyy",
"tool_result_with_name": "Tool Result: {name}",
"reply_to_message": "reply to: {message}",
+1
View File
@@ -1013,6 +1013,7 @@
"n_items_plural": "{count} 个项目",
"fullscreen": "全屏",
"created_by_at": "{time} 由 {author} 创建",
"user_via_agent": "{user} 通过 {agent}",
"date_format_long": "yyyy年M月d日",
"tool_result_with_name": "工具结果:{name}",
"reply_to_message": "回复:{message}",
+1
View File
@@ -959,6 +959,7 @@ export * from "./n_items_singular.js";
export * from "./n_items_plural.js";
export * from "./fullscreen.js";
export * from "./created_by_at.js";
export * from "./user_via_agent.js";
export * from "./date_format_long.js";
export * from "./tool_result_with_name.js";
export * from "./reply_to_message.js";
+1
View File
@@ -961,6 +961,7 @@ export * from './n_items_singular.js'
export * from './n_items_plural.js'
export * from './fullscreen.js'
export * from './created_by_at.js'
export * from './user_via_agent.js'
export * from './date_format_long.js'
export * from './tool_result_with_name.js'
export * from './reply_to_message.js'
+19
View File
@@ -0,0 +1,19 @@
/**
* | output |
* | --- |
* | "{user} via {agent}" |
*
* @param {User_Via_AgentInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const user_via_agent: ((inputs: User_Via_AgentInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<User_Via_AgentInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type User_Via_AgentInputs = {
user: NonNullable<unknown>;
agent: NonNullable<unknown>;
};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{ user: NonNullable<unknown>, agent: NonNullable<unknown> }} User_Via_AgentInputs */
const en_user_via_agent = /** @type {(inputs: User_Via_AgentInputs) => LocalizedString} */ (i) => {
return /** @type {LocalizedString} */ (`${i?.user} via ${i?.agent}`)
};
const zh_user_via_agent = /** @type {(inputs: User_Via_AgentInputs) => LocalizedString} */ (i) => {
return /** @type {LocalizedString} */ (`${i?.user} 通过 ${i?.agent}`)
};
/**
* | output |
* | --- |
* | "{user} via {agent}" |
*
* @param {User_Via_AgentInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const user_via_agent = /** @type {((inputs: User_Via_AgentInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<User_Via_AgentInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_user_via_agent(inputs)
return zh_user_via_agent(inputs)
});
+1
View File
@@ -31,6 +31,7 @@ export interface TopNavProjectState {
name?: string | null
previewUrl?: string | null
creator?: { id: string; name: string | null } | null
agent?: { id: string; name: string } | null
}>
isPublic?: boolean
shareId?: string