mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 21:17:42 +00:00
Merge pull request #65 from shumaiOne/feat/improve-agent-chat-workflow
feat(agent): improve agent chat workflow and add media tools
This commit is contained in:
@@ -169,6 +169,7 @@
|
||||
"@temporalio/worker": "^1.16.1",
|
||||
"@temporalio/workflow": "^1.16.1",
|
||||
"sharp": "^0.34.5",
|
||||
"ulid": "^2.3.0",
|
||||
},
|
||||
},
|
||||
"packages/webui": {
|
||||
@@ -2907,6 +2908,8 @@
|
||||
|
||||
"@reduxjs/toolkit/immer": ["immer@11.1.8", "", {}, "sha512-/tbkHMW7y10Lx6i1crLjD4/OhNkRG+Fo7byZHtah0547nIeXYcpIXaUh0IAQY6gO5459qpGGYapcEOHtFXkIuA=="],
|
||||
|
||||
"@shumai/transcode/ulid": ["ulid@2.4.0", "", { "bin": { "ulid": "bin/cli.js" } }, "sha512-fIRiVTJNcSRmXKPZtGzFQv9WRrZ3M9eoptl/teFJvjOzmpU+/K/JH6HZ8deBfb5vMEpicJcLn7JmvdknlMq7Zg=="],
|
||||
|
||||
"@shumai/webui/better-auth": ["better-auth@1.6.13", "", { "dependencies": { "@better-auth/core": "1.6.13", "@better-auth/drizzle-adapter": "1.6.13", "@better-auth/kysely-adapter": "1.6.13", "@better-auth/memory-adapter": "1.6.13", "@better-auth/mongo-adapter": "1.6.13", "@better-auth/prisma-adapter": "1.6.13", "@better-auth/telemetry": "1.6.13", "@better-auth/utils": "0.4.1", "@better-fetch/fetch": "1.1.21", "@noble/ciphers": "^2.1.1", "@noble/hashes": "^2.0.1", "better-call": "1.3.5", "defu": "^6.1.4", "jose": "^6.1.3", "kysely": "^0.28.17 || ^0.29.0", "nanostores": "^1.1.1", "zod": "^4.3.6" }, "peerDependencies": { "@lynx-js/react": "*", "@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0", "@sveltejs/kit": "^2.0.0", "@tanstack/react-start": "^1.0.0", "@tanstack/solid-start": "^1.0.0", "better-sqlite3": "^12.0.0", "drizzle-kit": ">=0.31.4", "drizzle-orm": "^0.45.2", "mongodb": "^6.0.0 || ^7.0.0", "mysql2": "^3.0.0", "next": "^14.0.0 || ^15.0.0 || ^16.0.0", "pg": "^8.0.0", "prisma": "^5.0.0 || ^6.0.0 || ^7.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0", "solid-js": "^1.0.0", "svelte": "^4.0.0 || ^5.0.0", "vitest": "^2.0.0 || ^3.0.0 || ^4.0.0", "vue": "^3.0.0" }, "optionalPeers": ["@lynx-js/react", "@prisma/client", "@sveltejs/kit", "@tanstack/react-start", "@tanstack/solid-start", "better-sqlite3", "drizzle-kit", "drizzle-orm", "mongodb", "mysql2", "next", "pg", "prisma", "react", "react-dom", "solid-js", "svelte", "vitest", "vue"] }, "sha512-jn8ATnGWDzMwpO4a/3iyW1/RayOF/aoPQOfAeqyCVnQCdqkaONVas9CjbY6PovMsTMa/MG+GRABySfzqtj5J/g=="],
|
||||
|
||||
"@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.10.0", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.1", "tslib": "^2.4.0" }, "bundled": true }, "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw=="],
|
||||
|
||||
@@ -55,6 +55,7 @@ async function executeAgentPrompt(params: {
|
||||
agentsInstruction: string
|
||||
sessionId?: string
|
||||
userId?: string
|
||||
userCommentId?: string | null
|
||||
tools?: AgentTool[]
|
||||
context: AgentExecutionContext
|
||||
}): Promise<{ text: string; usage: Usage; sessionId: string }> {
|
||||
@@ -109,6 +110,7 @@ If you need to create files in the local filesystem (for example, a temporary fi
|
||||
allowedDomains,
|
||||
sessionId: params.sessionId,
|
||||
userId: params.userId,
|
||||
userCommentId: params.userCommentId,
|
||||
customTools: params.tools || [],
|
||||
providers: dbProviders.map((p) => ({
|
||||
name: p.name,
|
||||
@@ -197,6 +199,7 @@ export interface AgentChatParams {
|
||||
agentsInstruction?: string
|
||||
sessionId: string
|
||||
userId?: string
|
||||
userCommentId?: string | null
|
||||
explicitMention?: boolean
|
||||
context: AgentExecutionContext
|
||||
}
|
||||
@@ -213,6 +216,7 @@ export async function agentChatActivity(params: AgentChatParams) {
|
||||
agentsInstruction: params.agentsInstruction || '',
|
||||
sessionId,
|
||||
userId: params.userId,
|
||||
userCommentId: params.userCommentId,
|
||||
context: params.context,
|
||||
})
|
||||
}
|
||||
@@ -303,12 +307,19 @@ export async function initializeAgentSessionActivity(params: {
|
||||
})
|
||||
}
|
||||
|
||||
const userComment = await prisma.assetComment.findUnique({
|
||||
where: { id: params.userCommentId },
|
||||
include: { creator: true },
|
||||
})
|
||||
|
||||
// Create a new AgentSession
|
||||
const newSession = await prisma.agentSession.create({
|
||||
data: {
|
||||
agentId,
|
||||
userId: params.userId || null,
|
||||
cwd: process.cwd(),
|
||||
assetId: userComment ? userComment.assetId : null,
|
||||
userCommentId: params.userCommentId,
|
||||
},
|
||||
})
|
||||
const sessionId = newSession.id
|
||||
@@ -323,11 +334,6 @@ export async function initializeAgentSessionActivity(params: {
|
||||
sessionId: string | null
|
||||
}> = []
|
||||
|
||||
const userComment = await prisma.assetComment.findUnique({
|
||||
where: { id: params.userCommentId },
|
||||
include: { creator: true },
|
||||
})
|
||||
|
||||
if (userComment) {
|
||||
if (!userComment.replyToId) {
|
||||
// Rule 1: outside of a reply, add all other comments on that asset
|
||||
|
||||
@@ -46,19 +46,19 @@ vi.mock('@shumai/transcode', () => ({
|
||||
|
||||
vi.mock('child_process', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mock functions dynamically return varying types based on test command calls
|
||||
const execMock: any = vi.fn((cmd: any, cb: any) => {
|
||||
const execFileMock: any = vi.fn((file: any, args: any, cb: any) => {
|
||||
cb(null, '120.0\n', '')
|
||||
})
|
||||
// Setup custom promisify behavior to return { stdout, stderr }
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mock functions dynamically return varying types based on test command calls
|
||||
execMock[Symbol.for('nodejs.util.promisify.custom')] = vi.fn(async (cmd: any) => {
|
||||
if (cmd.includes('ffprobe')) {
|
||||
execFileMock[Symbol.for('nodejs.util.promisify.custom')] = vi.fn(async (file: any) => {
|
||||
if (file === 'ffprobe') {
|
||||
return { stdout: '120.0\n', stderr: '' }
|
||||
}
|
||||
return { stdout: '', stderr: '' }
|
||||
})
|
||||
return {
|
||||
exec: execMock,
|
||||
execFile: execFileMock,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GoogleGenAI } from '@google/genai'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { transcodeService } from '@shumai/transcode'
|
||||
import { exec } from 'child_process'
|
||||
import { execFile } from 'child_process'
|
||||
import * as fs from 'fs'
|
||||
import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
@@ -9,7 +9,7 @@ import { promisify } from 'util'
|
||||
import { ApplicationFailure } from '@temporalio/activity'
|
||||
import { prisma } from '@shumai/db'
|
||||
|
||||
const execAsync = promisify(exec)
|
||||
const execFileAsync = promisify(execFile)
|
||||
|
||||
export interface Usage {
|
||||
inputTokens: number
|
||||
@@ -115,9 +115,15 @@ export async function generateEmbeddingActivity(params: GenerateEmbeddingParams)
|
||||
fs.writeFileSync(tmpFile, data)
|
||||
|
||||
try {
|
||||
const { stdout } = await execAsync(
|
||||
`ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "${tmpFile}"`,
|
||||
)
|
||||
const { stdout } = await execFileAsync('ffprobe', [
|
||||
'-v',
|
||||
'error',
|
||||
'-show_entries',
|
||||
'format=duration',
|
||||
'-of',
|
||||
'default=noprint_wrappers=1:nokey=1',
|
||||
tmpFile,
|
||||
])
|
||||
const duration = parseFloat(stdout.trim())
|
||||
if (isNaN(duration)) {
|
||||
throw ApplicationFailure.create({
|
||||
@@ -132,9 +138,18 @@ export async function generateEmbeddingActivity(params: GenerateEmbeddingParams)
|
||||
if (end > duration) end = duration
|
||||
|
||||
const chunkTmp = path.join(os.tmpdir(), `video-chunk-${Date.now()}.mp4`)
|
||||
await execAsync(
|
||||
`ffmpeg -y -i "${tmpFile}" -ss ${start} -t ${end - start} -c copy "${chunkTmp}"`,
|
||||
)
|
||||
await execFileAsync('ffmpeg', [
|
||||
'-y',
|
||||
'-i',
|
||||
tmpFile,
|
||||
'-ss',
|
||||
start.toString(),
|
||||
'-t',
|
||||
(end - start).toString(),
|
||||
'-c',
|
||||
'copy',
|
||||
chunkTmp,
|
||||
])
|
||||
|
||||
const chunkData = fs.readFileSync(chunkTmp)
|
||||
fs.unlinkSync(chunkTmp)
|
||||
|
||||
@@ -7,6 +7,8 @@ import { DatabaseSessionStorage } from './database-session-storage'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
import { createAgentSession } from './index'
|
||||
import * as sandboxedBashModule from './tools/sandboxed-bash'
|
||||
import * as analyzeImageModule from './tools/analyze-image'
|
||||
import * as screenshotModule from './tools/screenshot'
|
||||
|
||||
describe('DatabaseSessionStorage', () => {
|
||||
setupTestDbHooks()
|
||||
@@ -387,4 +389,55 @@ describe('DatabaseSessionStorage', () => {
|
||||
expect(entries[1].id).toBe('01B')
|
||||
expect(entries[2].id).toBe('01C')
|
||||
})
|
||||
|
||||
it('should use the current comment ID for media tools in subsequent turns', async () => {
|
||||
const { agent, user, team } = await setupTestData()
|
||||
|
||||
// Create a project and asset to satisfy FK constraints
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'Test Project', teamId: team.id },
|
||||
})
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
id: 'asset-123',
|
||||
name: 'test.png',
|
||||
type: 'file',
|
||||
mediaType: 'image/png',
|
||||
projectId: project.id,
|
||||
status: 'uploaded',
|
||||
},
|
||||
})
|
||||
|
||||
// 1. Create a session with an original comment ID and an asset ID using the storage class
|
||||
const initialStorage = await DatabaseSessionStorage.create({
|
||||
agentId: agent.id,
|
||||
userId: user.id,
|
||||
cwd: '/test/cwd',
|
||||
assetId: asset.id,
|
||||
userCommentId: 'original-comment-123',
|
||||
})
|
||||
const sessionId = initialStorage.sessionId
|
||||
|
||||
// 2. Spy on media tools constructors
|
||||
const createAnalyzeImageToolSpy = vi.spyOn(analyzeImageModule, 'createAnalyzeImageTool')
|
||||
const createScreenshotToolSpy = vi.spyOn(screenshotModule, 'createScreenshotTool')
|
||||
|
||||
// 3. Resume the session via createAgentSession with a NEW comment ID
|
||||
await createAgentSession({
|
||||
agentId: agent.id,
|
||||
providerName: 'test-provider',
|
||||
modelId: 'test-model',
|
||||
systemPrompt: 'Test prompt',
|
||||
teamSkills: [],
|
||||
allowedDomains: [],
|
||||
sessionId: sessionId,
|
||||
userId: user.id,
|
||||
userCommentId: 'new-comment-456',
|
||||
providers: [],
|
||||
})
|
||||
|
||||
// 4. Assert that the tools were instantiated using the new comment ID, not the original one
|
||||
expect(createAnalyzeImageToolSpy).toHaveBeenCalledWith(asset.id, 'new-comment-456')
|
||||
expect(createScreenshotToolSpy).toHaveBeenCalledWith(asset.id, 'new-comment-456')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -14,6 +14,8 @@ export interface DatabaseSessionMetadata extends SessionMetadata {
|
||||
agentId: string
|
||||
userId?: string
|
||||
cwd: string
|
||||
assetId?: string
|
||||
userCommentId?: string
|
||||
}
|
||||
|
||||
export class DatabaseSessionStorage implements SessionStorage<DatabaseSessionMetadata> {
|
||||
@@ -30,6 +32,8 @@ export class DatabaseSessionStorage implements SessionStorage<DatabaseSessionMet
|
||||
agentId: session.agentId,
|
||||
userId: session.userId || undefined,
|
||||
cwd: session.cwd,
|
||||
assetId: session.assetId || undefined,
|
||||
userCommentId: session.userCommentId || undefined,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,6 +257,8 @@ export class DatabaseSessionStorage implements SessionStorage<DatabaseSessionMet
|
||||
userId?: string
|
||||
sessionId?: string
|
||||
cwd?: string
|
||||
assetId?: string
|
||||
userCommentId?: string
|
||||
}): Promise<DatabaseSessionStorage> {
|
||||
if (params.sessionId) {
|
||||
return new DatabaseSessionStorage(params.sessionId)
|
||||
@@ -262,6 +268,8 @@ export class DatabaseSessionStorage implements SessionStorage<DatabaseSessionMet
|
||||
agentId: params.agentId,
|
||||
userId: params.userId,
|
||||
cwd: params.cwd || process.cwd(),
|
||||
assetId: params.assetId || null,
|
||||
userCommentId: params.userCommentId || null,
|
||||
},
|
||||
})
|
||||
return new DatabaseSessionStorage(session.id)
|
||||
|
||||
@@ -7,7 +7,8 @@ import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
import { DatabaseSessionStorage } from './database-session-storage'
|
||||
import { analyzeAssetMediaTool } from './tools/analyze-asset-media'
|
||||
import { createAnalyzeImageTool } from './tools/analyze-image'
|
||||
import { createScreenshotTool } from './tools/screenshot'
|
||||
import { createCreateFileTool } from './tools/create-file'
|
||||
import { createCreateFolderTool } from './tools/create-folder'
|
||||
import { createCreateVersionTool } from './tools/create-version'
|
||||
@@ -24,6 +25,7 @@ export interface CreateAgentSessionParams {
|
||||
allowedDomains: string[]
|
||||
sessionId?: string
|
||||
userId?: string
|
||||
userCommentId?: string | null
|
||||
customTools?: AgentTool[]
|
||||
providers: Array<{
|
||||
name: string
|
||||
@@ -46,6 +48,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
||||
allowedDomains,
|
||||
sessionId,
|
||||
userId,
|
||||
userCommentId: passedUserCommentId,
|
||||
customTools = [],
|
||||
} = params
|
||||
|
||||
@@ -153,6 +156,19 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
||||
}
|
||||
}
|
||||
|
||||
const metadata = await storage.getMetadata()
|
||||
const assetId = metadata.assetId
|
||||
const userCommentId =
|
||||
passedUserCommentId !== undefined ? passedUserCommentId : metadata.userCommentId
|
||||
|
||||
const mediaTools: AgentTool[] = []
|
||||
if (assetId) {
|
||||
mediaTools.push(
|
||||
createAnalyzeImageTool(assetId, userCommentId),
|
||||
createScreenshotTool(assetId, userCommentId),
|
||||
)
|
||||
}
|
||||
|
||||
const sandboxedBash = createSandboxedBashTool(process.cwd(), skillEnvs)
|
||||
const readSkill = createReadSkillTool(onEnvsAdded)
|
||||
|
||||
@@ -202,7 +218,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
||||
|
||||
return undefined
|
||||
},
|
||||
tools: [analyzeAssetMediaTool, readSkill, sandboxedBash, ...systemTools, ...customTools],
|
||||
tools: [...mediaTools, readSkill, sandboxedBash, ...systemTools, ...customTools],
|
||||
})
|
||||
|
||||
return { session, harness }
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { analyzeAssetMediaTool } from './analyze-asset-media'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
|
||||
vi.mock('@shumai/core/src/s3/s3')
|
||||
|
||||
describe('analyzeAssetMediaTool', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
it('should analyze media by S3 key and return image content', async () => {
|
||||
// Mock S3 with WEBP magic bytes
|
||||
const buffer = Buffer.from([
|
||||
0x52, 0x49, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x57, 0x45, 0x42, 0x50,
|
||||
])
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({ buffer, contentType: 'image/webp' })
|
||||
|
||||
const result = await analyzeAssetMediaTool.execute(
|
||||
'1',
|
||||
{ key: 'assets/test.webp' },
|
||||
undefined,
|
||||
undefined,
|
||||
)
|
||||
|
||||
expect(result.content[0].type).toBe('image')
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
expect((result.content[0] as any).mimeType).toBe('image/webp')
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
expect((result.details as any).sourceKey).toBe('assets/test.webp')
|
||||
})
|
||||
|
||||
it('should infer mimeType from content if S3 response has generic mimeType', async () => {
|
||||
// Mock S3 with MP4 magic bytes
|
||||
const buffer = Buffer.from([
|
||||
0x00, 0x00, 0x00, 0x18, 0x66, 0x74, 0x79, 0x70, 0x69, 0x73, 0x6f, 0x6d,
|
||||
])
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer,
|
||||
contentType: 'application/octet-stream',
|
||||
})
|
||||
|
||||
const result = await analyzeAssetMediaTool.execute(
|
||||
'1',
|
||||
{ key: 'assets/no-extension-but-mp4' },
|
||||
undefined,
|
||||
undefined,
|
||||
)
|
||||
|
||||
expect(result.content[0].type).toBe('image') // Wrapped as image type for base64
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
expect((result.content[0] as any).mimeType).toBe('video/mp4')
|
||||
})
|
||||
|
||||
it('should return error if S3 getObject fails', async () => {
|
||||
// Mock S3 failure
|
||||
vi.mocked(s3Service.getObject).mockRejectedValue(new Error('S3 error'))
|
||||
|
||||
const result = await analyzeAssetMediaTool.execute(
|
||||
'1',
|
||||
{ key: 'assets/non-existent' },
|
||||
undefined,
|
||||
undefined,
|
||||
)
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const textContent = (result.content[0] as any).text
|
||||
expect(textContent).toContain('Error analyzing media: S3 error')
|
||||
})
|
||||
})
|
||||
@@ -1,74 +0,0 @@
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { Type } from '@sinclair/typebox'
|
||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||
import { type ImageContent, type TextContent } from '@earendil-works/pi-ai'
|
||||
import { detectSupportedMimeType } from '@shumai/core/src/utils/mime'
|
||||
|
||||
const analyzeAssetMediaSchema = Type.Object({
|
||||
key: Type.String({
|
||||
description:
|
||||
'The S3 key of the media file to analyze. This MUST be a key obtained from the asset media info.',
|
||||
}),
|
||||
})
|
||||
|
||||
export interface MediaAnalysisDetails {
|
||||
sourceKey: string
|
||||
}
|
||||
|
||||
export const analyzeAssetMediaTool: AgentTool<
|
||||
typeof analyzeAssetMediaSchema,
|
||||
MediaAnalysisDetails
|
||||
> = {
|
||||
name: 'analyze_asset_media',
|
||||
label: 'Analyze Asset Media',
|
||||
description:
|
||||
'Retrieves and views the media content (images/video) by its S3 key. The key must be obtained from the asset media info provided in the context.',
|
||||
parameters: analyzeAssetMediaSchema,
|
||||
execute: async (_toolCallId, params) => {
|
||||
try {
|
||||
const { key } = params
|
||||
if (!key) {
|
||||
return {
|
||||
content: [{ type: 'text', text: 'S3 key is required.' }],
|
||||
details: { sourceKey: '' },
|
||||
}
|
||||
}
|
||||
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
const { buffer, contentType } = await s3Service.getObject(bucket, key)
|
||||
const uint8Array = new Uint8Array(buffer)
|
||||
let mimeType = contentType
|
||||
|
||||
if (mimeType === 'application/octet-stream') {
|
||||
mimeType = detectSupportedMimeType(uint8Array) || 'application/octet-stream'
|
||||
}
|
||||
|
||||
const content: (TextContent | ImageContent)[] = [
|
||||
{
|
||||
type: 'image',
|
||||
data: buffer.toString('base64'),
|
||||
mimeType,
|
||||
},
|
||||
]
|
||||
|
||||
return {
|
||||
content,
|
||||
details: {
|
||||
sourceKey: key,
|
||||
},
|
||||
}
|
||||
} catch (error) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: `Error analyzing media: ${
|
||||
error instanceof Error ? error.message : String(error)
|
||||
}`,
|
||||
},
|
||||
],
|
||||
details: { sourceKey: params.key || '' },
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { createAnalyzeImageTool } from './analyze-image'
|
||||
import {
|
||||
prisma,
|
||||
WorkflowTaskStatus,
|
||||
type Asset,
|
||||
type AssetComment,
|
||||
type WorkflowTask,
|
||||
} from '@shumai/db'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { workflowService } from '@shumai/workflow-core'
|
||||
|
||||
vi.mock('@shumai/db', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('@shumai/db')>()
|
||||
return {
|
||||
...actual,
|
||||
prisma: {
|
||||
asset: {
|
||||
findUnique: vi.fn(),
|
||||
},
|
||||
assetComment: {
|
||||
findUnique: vi.fn(),
|
||||
},
|
||||
workflowTask: {
|
||||
create: vi.fn(),
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('@shumai/core/src/s3/s3', () => ({
|
||||
s3Service: {
|
||||
getObject: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/workflow-core', () => ({
|
||||
workflowService: {
|
||||
executeWait: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
describe('analyzeImageTool', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
it('should fetch the image from S3 when comment has no annotations', async () => {
|
||||
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
|
||||
id: 'asset-1',
|
||||
projectId: 'project-1',
|
||||
storageKey: { key: 'raw-image.png' },
|
||||
media: null,
|
||||
} as unknown as Asset)
|
||||
|
||||
vi.mocked(prisma.assetComment.findUnique).mockResolvedValue({
|
||||
id: 'comment-1',
|
||||
annotation: null,
|
||||
} as unknown as AssetComment)
|
||||
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: Buffer.from('fake-image-bytes'),
|
||||
contentType: 'image/png',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
const tool = createAnalyzeImageTool('asset-1', 'comment-1')
|
||||
const result = await tool.execute('call-1', {})
|
||||
|
||||
expect(result.content[0].type).toBe('image')
|
||||
expect((result.content[0] as unknown as { data: string }).data).toBe(
|
||||
Buffer.from('fake-image-bytes').toString('base64'),
|
||||
)
|
||||
expect(result.details.sourceKeys).toEqual(['raw-image.png'])
|
||||
|
||||
expect(prisma.workflowTask.create).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should trigger overlay transcode workflow when comment has annotations', async () => {
|
||||
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
|
||||
id: 'asset-1',
|
||||
projectId: 'project-1',
|
||||
storageKey: { key: 'raw-image.png' },
|
||||
media: {
|
||||
imageTranscodes: [{ key: 'transcoded-image.webp' }],
|
||||
},
|
||||
} as unknown as Asset)
|
||||
|
||||
vi.mocked(prisma.assetComment.findUnique).mockResolvedValue({
|
||||
id: 'comment-1',
|
||||
annotation: [
|
||||
{
|
||||
type: 'box',
|
||||
color: '#ff0000',
|
||||
points: [
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
],
|
||||
},
|
||||
],
|
||||
} as unknown as AssetComment)
|
||||
|
||||
vi.mocked(prisma.workflowTask.create).mockResolvedValue({
|
||||
id: 'task-1',
|
||||
} as unknown as WorkflowTask)
|
||||
|
||||
vi.mocked(workflowService.executeWait).mockResolvedValue({
|
||||
id: 'task-1',
|
||||
status: WorkflowTaskStatus.completed,
|
||||
output: { key: 'annotated-image.webp' },
|
||||
} as unknown as WorkflowTask)
|
||||
|
||||
vi.mocked(s3Service.getObject).mockResolvedValue({
|
||||
buffer: Buffer.from('fake-annotated-image-bytes'),
|
||||
contentType: 'image/webp',
|
||||
} as unknown as { buffer: Buffer; contentType: string })
|
||||
|
||||
const tool = createAnalyzeImageTool('asset-1', 'comment-1')
|
||||
const result = await tool.execute('call-1', {})
|
||||
|
||||
expect(prisma.workflowTask.create).toHaveBeenCalledWith({
|
||||
data: {
|
||||
assetId: 'asset-1',
|
||||
projectId: 'project-1',
|
||||
type: 'transcode',
|
||||
status: 'pending',
|
||||
payload: {
|
||||
projectId: 'project-1',
|
||||
imageAnnotation: {
|
||||
annotations: [
|
||||
{
|
||||
type: 'box',
|
||||
color: '#ff0000',
|
||||
points: [
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
expect(result.content[0].type).toBe('image')
|
||||
expect((result.content[0] as unknown as { data: string }).data).toBe(
|
||||
Buffer.from('fake-annotated-image-bytes').toString('base64'),
|
||||
)
|
||||
expect(result.details.sourceKeys).toEqual(['annotated-image.webp'])
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,127 @@
|
||||
import { Type } from '@sinclair/typebox'
|
||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||
import { type ImageContent } from '@earendil-works/pi-ai'
|
||||
import { prisma, WorkflowTaskType, WorkflowTaskStatus } from '@shumai/db'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { workflowService } from '@shumai/workflow-core'
|
||||
|
||||
const analyzeImageSchema = Type.Object({})
|
||||
|
||||
export function createAnalyzeImageTool(
|
||||
assetId: string,
|
||||
userCommentId?: string | null,
|
||||
): AgentTool<typeof analyzeImageSchema> {
|
||||
return {
|
||||
name: 'analyze_image',
|
||||
label: 'Analyze Image',
|
||||
description:
|
||||
'Retrieves and views the image content. Call this tool if you need to analyze the image.',
|
||||
parameters: analyzeImageSchema,
|
||||
execute: async () => {
|
||||
try {
|
||||
const asset = await prisma.asset.findUnique({
|
||||
where: { id: assetId },
|
||||
include: { storageKey: true },
|
||||
})
|
||||
|
||||
if (!asset) {
|
||||
return {
|
||||
content: [{ type: 'text', text: `Asset with ID ${assetId} not found.` }],
|
||||
details: {},
|
||||
}
|
||||
}
|
||||
|
||||
// Get default media key
|
||||
let mediaKey = asset.storageKey?.key
|
||||
if (asset.media) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const mediaInfo = asset.media as any
|
||||
if (mediaInfo.imageTranscodes && mediaInfo.imageTranscodes.length > 0) {
|
||||
mediaKey = mediaInfo.imageTranscodes[0].key || mediaKey
|
||||
}
|
||||
}
|
||||
|
||||
if (!mediaKey) {
|
||||
return {
|
||||
content: [{ type: 'text', text: 'No media content found for this asset.' }],
|
||||
details: {},
|
||||
}
|
||||
}
|
||||
|
||||
// Check if trigger comment has draw annotations
|
||||
let annotations: unknown = null
|
||||
if (userCommentId) {
|
||||
const comment = await prisma.assetComment.findUnique({
|
||||
where: { id: userCommentId },
|
||||
})
|
||||
if (comment?.annotation) {
|
||||
const list = comment.annotation
|
||||
if (Array.isArray(list) && list.length > 0) {
|
||||
annotations = list
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let keyToUse = mediaKey
|
||||
|
||||
if (annotations) {
|
||||
// Trigger transcode workflow to draw annotation
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
assetId,
|
||||
projectId: asset.projectId || 'none',
|
||||
type: WorkflowTaskType.transcode,
|
||||
status: WorkflowTaskStatus.pending,
|
||||
payload: {
|
||||
projectId: asset.projectId || 'none',
|
||||
imageAnnotation: {
|
||||
annotations: annotations as PrismaJson.AnnotationList,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const completedTask = await workflowService.executeWait(task)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const output = completedTask.output as any
|
||||
if (output?.key) {
|
||||
keyToUse = output.key
|
||||
} else {
|
||||
throw new Error('Image annotation transcode workflow failed to output S3 key.')
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve the image content from S3
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
const { buffer, contentType } = await s3Service.getObject(bucket, keyToUse)
|
||||
|
||||
const content: ImageContent[] = [
|
||||
{
|
||||
type: 'image',
|
||||
data: buffer.toString('base64'),
|
||||
mimeType: contentType || 'image/webp',
|
||||
},
|
||||
]
|
||||
|
||||
return {
|
||||
content,
|
||||
details: {
|
||||
sourceKeys: [keyToUse],
|
||||
},
|
||||
}
|
||||
} catch (error) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: `Error analyzing image: ${
|
||||
error instanceof Error ? error.message : String(error)
|
||||
}`,
|
||||
},
|
||||
],
|
||||
details: {},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { createScreenshotTool } from './screenshot'
|
||||
import {
|
||||
prisma,
|
||||
WorkflowTaskStatus,
|
||||
type Asset,
|
||||
type AssetComment,
|
||||
type WorkflowTask,
|
||||
} from '@shumai/db'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { workflowService } from '@shumai/workflow-core'
|
||||
|
||||
vi.mock('@shumai/db', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('@shumai/db')>()
|
||||
return {
|
||||
...actual,
|
||||
prisma: {
|
||||
asset: {
|
||||
findUnique: vi.fn(),
|
||||
},
|
||||
assetComment: {
|
||||
findUnique: vi.fn(),
|
||||
},
|
||||
workflowTask: {
|
||||
create: vi.fn(),
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('@shumai/core/src/s3/s3', () => ({
|
||||
s3Service: {
|
||||
getObject: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/workflow-core', () => ({
|
||||
workflowService: {
|
||||
executeWait: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
describe('screenshotTool', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
it('should trigger screenshot transcode workflow and return image outputs', async () => {
|
||||
vi.mocked(prisma.asset.findUnique).mockResolvedValue({
|
||||
id: 'asset-1',
|
||||
projectId: 'project-1',
|
||||
} as unknown as Asset)
|
||||
|
||||
vi.mocked(prisma.assetComment.findUnique).mockResolvedValue({
|
||||
id: 'comment-1',
|
||||
second: 5.0,
|
||||
annotation: [
|
||||
{
|
||||
type: 'line',
|
||||
color: '#00ff00',
|
||||
points: [
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
],
|
||||
},
|
||||
],
|
||||
} as unknown as AssetComment)
|
||||
|
||||
vi.mocked(prisma.workflowTask.create).mockResolvedValue({
|
||||
id: 'task-1',
|
||||
} as unknown as WorkflowTask)
|
||||
|
||||
vi.mocked(workflowService.executeWait).mockResolvedValue({
|
||||
id: 'task-1',
|
||||
status: WorkflowTaskStatus.completed,
|
||||
output: {
|
||||
screenshots: [
|
||||
{ key: 'screenshots/shot1.webp', timestamp: 0.0 },
|
||||
{ key: 'screenshots/shot2.webp', timestamp: 5.0 },
|
||||
],
|
||||
},
|
||||
} as unknown as WorkflowTask)
|
||||
|
||||
vi.mocked(s3Service.getObject).mockImplementation(async (_bucket: string, key: string) => {
|
||||
return {
|
||||
buffer: Buffer.from(`fake-bytes-for-${key}`),
|
||||
contentType: 'image/webp',
|
||||
} as unknown as { buffer: Buffer; contentType: string }
|
||||
})
|
||||
|
||||
const tool = createScreenshotTool('asset-1', 'comment-1')
|
||||
const result = await tool.execute('call-1', { start: 0, end: 10, count: 2 })
|
||||
|
||||
expect(prisma.workflowTask.create).toHaveBeenCalledWith({
|
||||
data: {
|
||||
assetId: 'asset-1',
|
||||
projectId: 'project-1',
|
||||
type: 'transcode',
|
||||
status: 'pending',
|
||||
payload: {
|
||||
projectId: 'project-1',
|
||||
screenshot: {
|
||||
start: 0,
|
||||
end: 10,
|
||||
count: 2,
|
||||
commentTimestamp: 5.0,
|
||||
annotations: [
|
||||
{
|
||||
type: 'line',
|
||||
color: '#00ff00',
|
||||
points: [
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
expect(result.content.length).toBe(2)
|
||||
expect(result.content[0].type).toBe('image')
|
||||
expect((result.content[0] as unknown as { data: string }).data).toBe(
|
||||
Buffer.from('fake-bytes-for-screenshots/shot1.webp').toString('base64'),
|
||||
)
|
||||
expect((result.content[1] as unknown as { data: string }).data).toBe(
|
||||
Buffer.from('fake-bytes-for-screenshots/shot2.webp').toString('base64'),
|
||||
)
|
||||
expect(result.details.sourceKeys).toEqual(['screenshots/shot1.webp', 'screenshots/shot2.webp'])
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,124 @@
|
||||
import { Type } from '@sinclair/typebox'
|
||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||
import { type ImageContent } from '@earendil-works/pi-ai'
|
||||
import { prisma, WorkflowTaskType, WorkflowTaskStatus } from '@shumai/db'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { workflowService } from '@shumai/workflow-core'
|
||||
|
||||
const screenshotSchema = Type.Object({
|
||||
start: Type.Number({ description: 'Start time in seconds' }),
|
||||
end: Type.Number({ description: 'End time in seconds' }),
|
||||
count: Type.Number({ description: 'Number of screenshots to take' }),
|
||||
})
|
||||
|
||||
export function createScreenshotTool(
|
||||
assetId: string,
|
||||
userCommentId?: string | null,
|
||||
): AgentTool<typeof screenshotSchema> {
|
||||
return {
|
||||
name: 'screenshot',
|
||||
label: 'Take Video Screenshots',
|
||||
description:
|
||||
'Takes screenshots for a video at specified interval. It returns the images to the agent context.',
|
||||
parameters: screenshotSchema,
|
||||
execute: async (_toolCallId, params) => {
|
||||
try {
|
||||
const asset = await prisma.asset.findUnique({
|
||||
where: { id: assetId },
|
||||
})
|
||||
|
||||
if (!asset) {
|
||||
return {
|
||||
content: [{ type: 'text', text: `Asset with ID ${assetId} not found.` }],
|
||||
details: {},
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch trigger comment details for timestamp and annotations
|
||||
let commentTimestamp: number | null = null
|
||||
let annotations: unknown = null
|
||||
if (userCommentId) {
|
||||
const comment = await prisma.assetComment.findUnique({
|
||||
where: { id: userCommentId },
|
||||
})
|
||||
if (comment) {
|
||||
commentTimestamp = comment.second !== null ? comment.second : null
|
||||
if (comment.annotation) {
|
||||
const list = comment.annotation
|
||||
if (Array.isArray(list) && list.length > 0) {
|
||||
annotations = list
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Trigger transcode workflow to take screenshots
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
assetId,
|
||||
projectId: asset.projectId || 'none',
|
||||
type: WorkflowTaskType.transcode,
|
||||
status: WorkflowTaskStatus.pending,
|
||||
payload: {
|
||||
projectId: asset.projectId || 'none',
|
||||
screenshot: {
|
||||
start: params.start,
|
||||
end: params.end,
|
||||
count: params.count,
|
||||
commentTimestamp,
|
||||
annotations: annotations as PrismaJson.AnnotationList,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const completedTask = await workflowService.executeWait(task)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const output = completedTask.output as any
|
||||
const screenshots = output?.screenshots as
|
||||
| Array<{ key: string; timestamp: number }>
|
||||
| undefined
|
||||
|
||||
if (!screenshots || screenshots.length === 0) {
|
||||
return {
|
||||
content: [{ type: 'text', text: 'No screenshots were generated.' }],
|
||||
details: {},
|
||||
}
|
||||
}
|
||||
|
||||
const content: ImageContent[] = []
|
||||
const sourceKeys: string[] = []
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
|
||||
for (const shot of screenshots) {
|
||||
const { buffer, contentType } = await s3Service.getObject(bucket, shot.key)
|
||||
content.push({
|
||||
type: 'image',
|
||||
data: buffer.toString('base64'),
|
||||
mimeType: contentType || 'image/webp',
|
||||
})
|
||||
sourceKeys.push(shot.key)
|
||||
}
|
||||
|
||||
return {
|
||||
content,
|
||||
details: {
|
||||
sourceKeys,
|
||||
},
|
||||
}
|
||||
} catch (error) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: `Error taking screenshots: ${
|
||||
error instanceof Error ? error.message : String(error)
|
||||
}`,
|
||||
},
|
||||
],
|
||||
details: {},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,77 +1,76 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import {
|
||||
AgentChatPromptBuilder,
|
||||
PROMPT_ASSET_BASE,
|
||||
PROMPT_PATH_CONTEXT,
|
||||
PROMPT_MEDIA_INFO,
|
||||
PROMPT_MEDIA_TOOL_INSTRUCTION,
|
||||
PROMPT_EXPLICIT_MENTION,
|
||||
PROMPT_IMPLICIT_MENTION,
|
||||
} from './agent-chat-prompt-builder'
|
||||
import { AgentChatPromptBuilder } from './agent-chat-prompt-builder'
|
||||
|
||||
describe('AgentChatPromptBuilder', () => {
|
||||
it('should build prompt with baseline configurations (implicit mention)', () => {
|
||||
it('should build prompt with baseline configurations (implicit mention, other asset type)', () => {
|
||||
const builder = new AgentChatPromptBuilder('a1')
|
||||
const result = builder.build()
|
||||
|
||||
const expected =
|
||||
PROMPT_ASSET_BASE('a1') + PROMPT_MEDIA_TOOL_INSTRUCTION + PROMPT_IMPLICIT_MENTION
|
||||
|
||||
expect(result).toBe(expected)
|
||||
expect(result).toContain('The user is discussing an asset with ID: a1.')
|
||||
expect(result).toContain('The user did not explicitly mention you')
|
||||
})
|
||||
|
||||
it('should build prompt with explicit mention', () => {
|
||||
const builder = new AgentChatPromptBuilder('a1').withExplicitMention(true)
|
||||
const result = builder.build()
|
||||
|
||||
const expected =
|
||||
PROMPT_ASSET_BASE('a1') + PROMPT_MEDIA_TOOL_INSTRUCTION + PROMPT_EXPLICIT_MENTION
|
||||
|
||||
expect(result).toBe(expected)
|
||||
expect(result).toContain('The user explicitly mentioned you')
|
||||
})
|
||||
|
||||
it('should build prompt with path context', () => {
|
||||
const builder = new AgentChatPromptBuilder('a1').withPathContext('folder/sub/file.png')
|
||||
const result = builder.build()
|
||||
|
||||
const expected =
|
||||
PROMPT_ASSET_BASE('a1') +
|
||||
PROMPT_PATH_CONTEXT('folder/sub/file.png') +
|
||||
PROMPT_MEDIA_TOOL_INSTRUCTION +
|
||||
PROMPT_IMPLICIT_MENTION
|
||||
|
||||
expect(result).toBe(expected)
|
||||
expect(result).toContain('Asset Path Context:\nfolder/sub/file.png')
|
||||
})
|
||||
|
||||
it('should build prompt with media info', () => {
|
||||
const media = { duration: 10, format: 'mp4' }
|
||||
const builder = new AgentChatPromptBuilder('a1').withMediaInfo(media)
|
||||
it('should build prompt with image asset details', () => {
|
||||
const builder = new AgentChatPromptBuilder('a1').withAssetDetails('test.png', 'image/png')
|
||||
const result = builder.build()
|
||||
|
||||
const expected =
|
||||
PROMPT_ASSET_BASE('a1') +
|
||||
PROMPT_MEDIA_INFO(JSON.stringify(media, null, 2)) +
|
||||
PROMPT_MEDIA_TOOL_INSTRUCTION +
|
||||
PROMPT_IMPLICIT_MENTION
|
||||
expect(result).toContain('File Name: test.png')
|
||||
expect(result).toContain('File Type: image')
|
||||
expect(result).toContain("call the 'analyze_image' tool")
|
||||
expect(result).not.toContain("call the 'screenshot' tool")
|
||||
})
|
||||
|
||||
expect(result).toBe(expected)
|
||||
it('should build prompt with video asset details and duration', () => {
|
||||
const builder = new AgentChatPromptBuilder('a1').withAssetDetails(
|
||||
'movie.mp4',
|
||||
'video/mp4',
|
||||
12.34,
|
||||
)
|
||||
const result = builder.build()
|
||||
|
||||
expect(result).toContain('File Name: movie.mp4')
|
||||
expect(result).toContain('File Type: video')
|
||||
expect(result).toContain('Video Length: 12.34 seconds')
|
||||
expect(result).toContain("call the 'screenshot' tool")
|
||||
expect(result).not.toContain("call the 'analyze_image' tool")
|
||||
})
|
||||
|
||||
it('should build prompt with comment timestamp', () => {
|
||||
const builder = new AgentChatPromptBuilder('a1').withCommentTimestamp(5.5)
|
||||
const result = builder.build()
|
||||
|
||||
expect(result).toContain('Comment Timestamp: 5.50 seconds')
|
||||
})
|
||||
|
||||
it('should build prompt with all fields combined', () => {
|
||||
const media = { width: 1920, height: 1080 }
|
||||
const builder = new AgentChatPromptBuilder('a1')
|
||||
.withExplicitMention(true)
|
||||
.withPathContext('src/main.ts')
|
||||
.withMediaInfo(media)
|
||||
.withAssetDetails('movie.mp4', 'video/mp4', 12.34)
|
||||
.withCommentTimestamp(8.2)
|
||||
const result = builder.build()
|
||||
|
||||
const expected =
|
||||
PROMPT_ASSET_BASE('a1') +
|
||||
PROMPT_PATH_CONTEXT('src/main.ts') +
|
||||
PROMPT_MEDIA_INFO(JSON.stringify(media, null, 2)) +
|
||||
PROMPT_MEDIA_TOOL_INSTRUCTION +
|
||||
PROMPT_EXPLICIT_MENTION
|
||||
|
||||
expect(result).toBe(expected)
|
||||
expect(result).toContain('The user is discussing an asset with ID: a1.')
|
||||
expect(result).toContain('File Name: movie.mp4')
|
||||
expect(result).toContain('File Type: video')
|
||||
expect(result).toContain('Video Length: 12.34 seconds')
|
||||
expect(result).toContain('Comment Timestamp: 8.20 seconds')
|
||||
expect(result).toContain('Asset Path Context:\nsrc/main.ts')
|
||||
expect(result).toContain("call the 'screenshot' tool")
|
||||
expect(result).toContain('The user explicitly mentioned you')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
export const PROMPT_ASSET_BASE = (assetId: string) =>
|
||||
`The user is discussing an asset with ID: ${assetId}.`
|
||||
|
||||
export const PROMPT_PATH_CONTEXT = (pathContext: string) =>
|
||||
`\n\nAsset Path Context:\n${pathContext}`
|
||||
|
||||
export const PROMPT_MEDIA_INFO = (mediaJson: string) => `\n\nAsset Media Info:\n${mediaJson}`
|
||||
|
||||
export const PROMPT_MEDIA_TOOL_INSTRUCTION = `\n\nIf you need to view the asset's media content (frames/images/video), call the 'analyze_asset_media' tool by passing the appropriate 'key' from the Asset Media Info above. Choose the most suitable format based on your capabilities and the user's request (e.g., use a poster or sprite for quick visual checks, or a transcode/raw file for detailed analysis).`
|
||||
|
||||
export const PROMPT_EXPLICIT_MENTION = `\n\nThe user explicitly mentioned you in their message. You MUST reply to this message.`
|
||||
|
||||
export const PROMPT_IMPLICIT_MENTION = `\n\nThe user did not explicitly mention you, but is replying in a thread where you are the participant. Let's decide if you should reply or not. If the user is not directly addressing you or doesn't need a response from you, you may choose to not reply. To choose not to reply, respond with exactly and only the text: __NO_REPLY__.`
|
||||
export function getSimpleMediaType(mediaType?: string): 'image' | 'video' | 'other' {
|
||||
if (!mediaType) return 'other'
|
||||
const lower = mediaType.toLowerCase()
|
||||
if (
|
||||
lower.startsWith('image/') ||
|
||||
lower === 'application/x-photoshop' ||
|
||||
lower === 'image/vnd.adobe.photoshop'
|
||||
) {
|
||||
return 'image'
|
||||
}
|
||||
if (lower.startsWith('video/')) {
|
||||
return 'video'
|
||||
}
|
||||
return 'other'
|
||||
}
|
||||
|
||||
export class AgentChatPromptBuilder {
|
||||
private assetId: string
|
||||
private assetName?: string
|
||||
private mediaType?: string
|
||||
private videoDuration?: number
|
||||
private commentTimestamp?: number
|
||||
private pathContext?: string
|
||||
private mediaInfo?: unknown
|
||||
private explicitMention = false
|
||||
|
||||
constructor(assetId: string) {
|
||||
@@ -27,8 +32,17 @@ export class AgentChatPromptBuilder {
|
||||
return this
|
||||
}
|
||||
|
||||
withMediaInfo(mediaInfo?: unknown): this {
|
||||
this.mediaInfo = mediaInfo
|
||||
withAssetDetails(name: string, mediaType: string | null, duration?: number): this {
|
||||
this.assetName = name
|
||||
this.mediaType = mediaType || undefined
|
||||
this.videoDuration = duration
|
||||
return this
|
||||
}
|
||||
|
||||
withCommentTimestamp(second?: number | null): this {
|
||||
if (second !== undefined && second !== null) {
|
||||
this.commentTimestamp = second
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -38,19 +52,39 @@ export class AgentChatPromptBuilder {
|
||||
}
|
||||
|
||||
build(): string {
|
||||
let instruction = PROMPT_ASSET_BASE(this.assetId)
|
||||
let instruction = `The user is discussing an asset with ID: ${this.assetId}.`
|
||||
if (this.assetName) {
|
||||
instruction += `\nFile Name: ${this.assetName}`
|
||||
}
|
||||
if (this.mediaType) {
|
||||
const type = getSimpleMediaType(this.mediaType)
|
||||
instruction += `\nFile Type: ${type}`
|
||||
if (type === 'video' && this.videoDuration !== undefined) {
|
||||
instruction += `\nVideo Length: ${this.videoDuration.toFixed(2)} seconds`
|
||||
}
|
||||
}
|
||||
if (this.commentTimestamp !== undefined) {
|
||||
instruction += `\nComment Timestamp: ${this.commentTimestamp.toFixed(2)} seconds`
|
||||
}
|
||||
if (this.pathContext) {
|
||||
instruction += PROMPT_PATH_CONTEXT(this.pathContext)
|
||||
instruction += `\n\nAsset Path Context:\n${this.pathContext}`
|
||||
}
|
||||
if (this.mediaInfo) {
|
||||
instruction += PROMPT_MEDIA_INFO(JSON.stringify(this.mediaInfo, null, 2))
|
||||
|
||||
if (this.mediaType) {
|
||||
const type = getSimpleMediaType(this.mediaType)
|
||||
if (type === 'image') {
|
||||
instruction += `\n\nIf you need to view the image data, call the 'analyze_image' tool. It does not require any parameters.`
|
||||
} else if (type === 'video') {
|
||||
instruction += `\n\nIf you need to view visual frames or take screenshots of the video, call the 'screenshot' tool. You must specify the 'start' (seconds), 'end' (seconds), and 'count' (number of screenshots) parameters.`
|
||||
}
|
||||
}
|
||||
instruction += PROMPT_MEDIA_TOOL_INSTRUCTION
|
||||
|
||||
if (this.explicitMention) {
|
||||
instruction += PROMPT_EXPLICIT_MENTION
|
||||
instruction += `\n\nThe user explicitly mentioned you in their message. You MUST reply to this message.`
|
||||
} else {
|
||||
instruction += PROMPT_IMPLICIT_MENTION
|
||||
instruction += `\n\nThe user did not explicitly mention you, but is replying in a thread where you are the participant. Let's decide if you should reply or not. If the user is not directly addressing you or doesn't need a response from you, you may choose to not reply. To choose not to reply, respond with exactly and only the text: __NO_REPLY__.`
|
||||
}
|
||||
|
||||
return instruction
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,8 @@ describe('Agent Chat Workflow', () => {
|
||||
id: 'a1',
|
||||
project: { teamId: 't1' },
|
||||
type: 'file',
|
||||
name: 'test-file.png',
|
||||
mediaType: 'image/png',
|
||||
parentId: 'parent-folder-id',
|
||||
})
|
||||
mockActivities.getCommentActivity.mockResolvedValue({
|
||||
@@ -127,6 +129,8 @@ describe('Agent Chat Workflow', () => {
|
||||
// Verify agent instruction composition
|
||||
const expectedInstruction1 = new AgentChatPromptBuilder('a1')
|
||||
.withPathContext('Path: folder/subfolder/file.png')
|
||||
.withAssetDetails('test-file.png', 'image/png', undefined)
|
||||
.withCommentTimestamp(null)
|
||||
.withExplicitMention(true)
|
||||
.build()
|
||||
|
||||
@@ -182,6 +186,8 @@ describe('Agent Chat Workflow', () => {
|
||||
expect(mockActivities.initializeAgentSessionActivity).not.toHaveBeenCalled()
|
||||
const expectedInstruction2 = new AgentChatPromptBuilder('a1')
|
||||
.withPathContext('Path: folder/subfolder/file.png')
|
||||
.withAssetDetails('test-file.png', 'image/png', undefined)
|
||||
.withCommentTimestamp(null)
|
||||
.withExplicitMention(false)
|
||||
.build()
|
||||
|
||||
@@ -216,6 +222,8 @@ describe('Agent Chat Workflow', () => {
|
||||
// Verify instruction contains not explicitly mentioned instructions
|
||||
const expectedInstruction3 = new AgentChatPromptBuilder('a1')
|
||||
.withPathContext('Path: folder/subfolder/file.png')
|
||||
.withAssetDetails('test-file.png', 'image/png', undefined)
|
||||
.withCommentTimestamp(null)
|
||||
.withExplicitMention(false)
|
||||
.build()
|
||||
|
||||
@@ -280,6 +288,8 @@ describe('Agent Chat Workflow', () => {
|
||||
|
||||
const expectedInstruction4 = new AgentChatPromptBuilder('a1')
|
||||
.withPathContext('Path: folder/subfolder/file.png')
|
||||
.withAssetDetails('test-file.png', 'image/png', undefined)
|
||||
.withCommentTimestamp(null)
|
||||
.withExplicitMention(false)
|
||||
.build()
|
||||
|
||||
@@ -296,6 +306,8 @@ describe('Agent Chat Workflow', () => {
|
||||
id: 'a1',
|
||||
project: { teamId: 't1' },
|
||||
type: 'file',
|
||||
name: 'test-asset',
|
||||
mediaType: 'video/mp4',
|
||||
media: {
|
||||
duration: 10,
|
||||
height: 1080,
|
||||
@@ -319,11 +331,8 @@ describe('Agent Chat Workflow', () => {
|
||||
|
||||
const expectedInstruction5 = new AgentChatPromptBuilder('a1')
|
||||
.withPathContext('Path: folder/subfolder/file.png')
|
||||
.withMediaInfo({
|
||||
duration: 10,
|
||||
height: 1080,
|
||||
width: 1920,
|
||||
})
|
||||
.withAssetDetails('test-asset', 'video/mp4', 10)
|
||||
.withCommentTimestamp(null)
|
||||
.withExplicitMention(false)
|
||||
.build()
|
||||
|
||||
|
||||
@@ -106,9 +106,14 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
task.assetId,
|
||||
)
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const mediaInfo = asset.media as any
|
||||
const duration = mediaInfo?.duration
|
||||
|
||||
const instruction = new AgentChatPromptBuilder(asset.id)
|
||||
.withPathContext(pathContext)
|
||||
.withMediaInfo(asset.media)
|
||||
.withAssetDetails(asset.name, asset.mediaType, duration)
|
||||
.withCommentTimestamp(userComment.second)
|
||||
.withExplicitMention(payload.agent?.explicitMention)
|
||||
.build()
|
||||
|
||||
@@ -130,6 +135,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
agentsInstruction: instruction,
|
||||
sessionId,
|
||||
userId: payload.agent?.userId,
|
||||
userCommentId,
|
||||
explicitMention: payload.agent?.explicitMention,
|
||||
context,
|
||||
})
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "agent_sessions" ADD COLUMN "asset_id" TEXT,
|
||||
ADD COLUMN "user_comment_id" TEXT;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "agent_sessions" ADD CONSTRAINT "agent_sessions_asset_id_fkey" FOREIGN KEY ("asset_id") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -398,6 +398,7 @@ model Asset {
|
||||
projectRootFolder Project? @relation("ProjectToRootFolder")
|
||||
projectShareRoot Project? @relation("ProjectToShareRoot")
|
||||
shareLinkRootFolder ShareLink? @relation("ShareLinkToRootFolder")
|
||||
agentSessions AgentSession[] @relation("AssetToAgentSession")
|
||||
|
||||
@@map("assets")
|
||||
@@index([type])
|
||||
@@ -669,17 +670,20 @@ model AgentSkill {
|
||||
}
|
||||
|
||||
model AgentSession {
|
||||
id String @id @default(ulid())
|
||||
agentId String @map("agent_id")
|
||||
agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
|
||||
userId String? @map("user_id")
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
||||
cwd String
|
||||
leafId String? @map("leaf_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
entries AgentSessionEntry[]
|
||||
comments AssetComment[]
|
||||
id String @id @default(ulid())
|
||||
agentId String @map("agent_id")
|
||||
agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
|
||||
userId String? @map("user_id")
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
||||
cwd String
|
||||
leafId String? @map("leaf_id")
|
||||
assetId String? @map("asset_id")
|
||||
asset Asset? @relation("AssetToAgentSession", fields: [assetId], references: [id], onDelete: Cascade)
|
||||
userCommentId String? @map("user_comment_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
entries AgentSessionEntry[]
|
||||
comments AssetComment[]
|
||||
|
||||
@@map("agent_sessions")
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -77,12 +77,12 @@ export type PrismaVersion = {
|
||||
}
|
||||
|
||||
/**
|
||||
* Prisma Client JS version: 7.7.0
|
||||
* Query Engine version: 75cbdc1eb7150937890ad5465d861175c6624711
|
||||
* Prisma Client JS version: 7.8.0
|
||||
* Query Engine version: 3c6e192761c0362d496ed980de936e2f3cebcd3a
|
||||
*/
|
||||
export const prismaVersion: PrismaVersion = {
|
||||
client: '7.7.0',
|
||||
engine: '75cbdc1eb7150937890ad5465d861175c6624711',
|
||||
client: '7.8.0',
|
||||
engine: '3c6e192761c0362d496ed980de936e2f3cebcd3a',
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3261,6 +3261,8 @@ export const AgentSessionScalarFieldEnum = {
|
||||
userId: 'userId',
|
||||
cwd: 'cwd',
|
||||
leafId: 'leafId',
|
||||
assetId: 'assetId',
|
||||
userCommentId: 'userCommentId',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
} as const
|
||||
@@ -3758,6 +3760,21 @@ export type PrismaClientOptions = (
|
||||
* ```
|
||||
*/
|
||||
comments?: runtime.SqlCommenterPlugin[]
|
||||
/**
|
||||
* Optional maximum size for the query plan cache. If not provided, a default size will be used.
|
||||
* A value of `0` can be used to disable the cache entirely. A higher cache size can improve
|
||||
* performance for applications that execute a large number of unique queries, while a smaller
|
||||
* cache size can reduce memory usage.
|
||||
*
|
||||
* @example
|
||||
* ```
|
||||
* const prisma = new PrismaClient({
|
||||
* adapter,
|
||||
* queryPlanCacheMaxSize: 100,
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
queryPlanCacheMaxSize?: number
|
||||
}
|
||||
export type GlobalOmitConfig = {
|
||||
user?: Prisma.UserOmit
|
||||
|
||||
@@ -476,6 +476,8 @@ export const AgentSessionScalarFieldEnum = {
|
||||
userId: 'userId',
|
||||
cwd: 'cwd',
|
||||
leafId: 'leafId',
|
||||
assetId: 'assetId',
|
||||
userCommentId: 'userCommentId',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
} as const
|
||||
|
||||
@@ -31,6 +31,8 @@ export type AgentSessionMinAggregateOutputType = {
|
||||
userId: string | null
|
||||
cwd: string | null
|
||||
leafId: string | null
|
||||
assetId: string | null
|
||||
userCommentId: string | null
|
||||
createdAt: Date | null
|
||||
updatedAt: Date | null
|
||||
}
|
||||
@@ -41,6 +43,8 @@ export type AgentSessionMaxAggregateOutputType = {
|
||||
userId: string | null
|
||||
cwd: string | null
|
||||
leafId: string | null
|
||||
assetId: string | null
|
||||
userCommentId: string | null
|
||||
createdAt: Date | null
|
||||
updatedAt: Date | null
|
||||
}
|
||||
@@ -51,6 +55,8 @@ export type AgentSessionCountAggregateOutputType = {
|
||||
userId: number
|
||||
cwd: number
|
||||
leafId: number
|
||||
assetId: number
|
||||
userCommentId: number
|
||||
createdAt: number
|
||||
updatedAt: number
|
||||
_all: number
|
||||
@@ -62,6 +68,8 @@ export type AgentSessionMinAggregateInputType = {
|
||||
userId?: true
|
||||
cwd?: true
|
||||
leafId?: true
|
||||
assetId?: true
|
||||
userCommentId?: true
|
||||
createdAt?: true
|
||||
updatedAt?: true
|
||||
}
|
||||
@@ -72,6 +80,8 @@ export type AgentSessionMaxAggregateInputType = {
|
||||
userId?: true
|
||||
cwd?: true
|
||||
leafId?: true
|
||||
assetId?: true
|
||||
userCommentId?: true
|
||||
createdAt?: true
|
||||
updatedAt?: true
|
||||
}
|
||||
@@ -82,6 +92,8 @@ export type AgentSessionCountAggregateInputType = {
|
||||
userId?: true
|
||||
cwd?: true
|
||||
leafId?: true
|
||||
assetId?: true
|
||||
userCommentId?: true
|
||||
createdAt?: true
|
||||
updatedAt?: true
|
||||
_all?: true
|
||||
@@ -170,6 +182,8 @@ export type AgentSessionGroupByOutputType = {
|
||||
userId: string | null
|
||||
cwd: string
|
||||
leafId: string | null
|
||||
assetId: string | null
|
||||
userCommentId: string | null
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
_count: AgentSessionCountAggregateOutputType | null
|
||||
@@ -198,10 +212,13 @@ export type AgentSessionWhereInput = {
|
||||
userId?: Prisma.StringNullableFilter<'AgentSession'> | string | null
|
||||
cwd?: Prisma.StringFilter<'AgentSession'> | string
|
||||
leafId?: Prisma.StringNullableFilter<'AgentSession'> | string | null
|
||||
assetId?: Prisma.StringNullableFilter<'AgentSession'> | string | null
|
||||
userCommentId?: Prisma.StringNullableFilter<'AgentSession'> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<'AgentSession'> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<'AgentSession'> | Date | string
|
||||
agent?: Prisma.XOR<Prisma.AgentScalarRelationFilter, Prisma.AgentWhereInput>
|
||||
user?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
|
||||
asset?: Prisma.XOR<Prisma.AssetNullableScalarRelationFilter, Prisma.AssetWhereInput> | null
|
||||
entries?: Prisma.AgentSessionEntryListRelationFilter
|
||||
comments?: Prisma.AssetCommentListRelationFilter
|
||||
}
|
||||
@@ -212,10 +229,13 @@ export type AgentSessionOrderByWithRelationInput = {
|
||||
userId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
cwd?: Prisma.SortOrder
|
||||
leafId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
userCommentId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
agent?: Prisma.AgentOrderByWithRelationInput
|
||||
user?: Prisma.UserOrderByWithRelationInput
|
||||
asset?: Prisma.AssetOrderByWithRelationInput
|
||||
entries?: Prisma.AgentSessionEntryOrderByRelationAggregateInput
|
||||
comments?: Prisma.AssetCommentOrderByRelationAggregateInput
|
||||
}
|
||||
@@ -230,10 +250,13 @@ export type AgentSessionWhereUniqueInput = Prisma.AtLeast<
|
||||
userId?: Prisma.StringNullableFilter<'AgentSession'> | string | null
|
||||
cwd?: Prisma.StringFilter<'AgentSession'> | string
|
||||
leafId?: Prisma.StringNullableFilter<'AgentSession'> | string | null
|
||||
assetId?: Prisma.StringNullableFilter<'AgentSession'> | string | null
|
||||
userCommentId?: Prisma.StringNullableFilter<'AgentSession'> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<'AgentSession'> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<'AgentSession'> | Date | string
|
||||
agent?: Prisma.XOR<Prisma.AgentScalarRelationFilter, Prisma.AgentWhereInput>
|
||||
user?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
|
||||
asset?: Prisma.XOR<Prisma.AssetNullableScalarRelationFilter, Prisma.AssetWhereInput> | null
|
||||
entries?: Prisma.AgentSessionEntryListRelationFilter
|
||||
comments?: Prisma.AssetCommentListRelationFilter
|
||||
},
|
||||
@@ -246,6 +269,8 @@ export type AgentSessionOrderByWithAggregationInput = {
|
||||
userId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
cwd?: Prisma.SortOrder
|
||||
leafId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
userCommentId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
_count?: Prisma.AgentSessionCountOrderByAggregateInput
|
||||
@@ -266,6 +291,8 @@ export type AgentSessionScalarWhereWithAggregatesInput = {
|
||||
userId?: Prisma.StringNullableWithAggregatesFilter<'AgentSession'> | string | null
|
||||
cwd?: Prisma.StringWithAggregatesFilter<'AgentSession'> | string
|
||||
leafId?: Prisma.StringNullableWithAggregatesFilter<'AgentSession'> | string | null
|
||||
assetId?: Prisma.StringNullableWithAggregatesFilter<'AgentSession'> | string | null
|
||||
userCommentId?: Prisma.StringNullableWithAggregatesFilter<'AgentSession'> | string | null
|
||||
createdAt?: Prisma.DateTimeWithAggregatesFilter<'AgentSession'> | Date | string
|
||||
updatedAt?: Prisma.DateTimeWithAggregatesFilter<'AgentSession'> | Date | string
|
||||
}
|
||||
@@ -274,10 +301,12 @@ export type AgentSessionCreateInput = {
|
||||
id?: string
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
agent: Prisma.AgentCreateNestedOneWithoutAgentSessionsInput
|
||||
user?: Prisma.UserCreateNestedOneWithoutAgentSessionsInput
|
||||
asset?: Prisma.AssetCreateNestedOneWithoutAgentSessionsInput
|
||||
entries?: Prisma.AgentSessionEntryCreateNestedManyWithoutSessionInput
|
||||
comments?: Prisma.AssetCommentCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
@@ -288,6 +317,8 @@ export type AgentSessionUncheckedCreateInput = {
|
||||
userId?: string | null
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedCreateNestedManyWithoutSessionInput
|
||||
@@ -298,10 +329,12 @@ export type AgentSessionUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
agent?: Prisma.AgentUpdateOneRequiredWithoutAgentSessionsNestedInput
|
||||
user?: Prisma.UserUpdateOneWithoutAgentSessionsNestedInput
|
||||
asset?: Prisma.AssetUpdateOneWithoutAgentSessionsNestedInput
|
||||
entries?: Prisma.AgentSessionEntryUpdateManyWithoutSessionNestedInput
|
||||
comments?: Prisma.AssetCommentUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
@@ -312,6 +345,8 @@ export type AgentSessionUncheckedUpdateInput = {
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedUpdateManyWithoutSessionNestedInput
|
||||
@@ -324,6 +359,8 @@ export type AgentSessionCreateManyInput = {
|
||||
userId?: string | null
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
}
|
||||
@@ -332,6 +369,7 @@ export type AgentSessionUpdateManyMutationInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
@@ -342,6 +380,8 @@ export type AgentSessionUncheckedUpdateManyInput = {
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
@@ -367,6 +407,8 @@ export type AgentSessionCountOrderByAggregateInput = {
|
||||
userId?: Prisma.SortOrder
|
||||
cwd?: Prisma.SortOrder
|
||||
leafId?: Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrder
|
||||
userCommentId?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
}
|
||||
@@ -377,6 +419,8 @@ export type AgentSessionMaxOrderByAggregateInput = {
|
||||
userId?: Prisma.SortOrder
|
||||
cwd?: Prisma.SortOrder
|
||||
leafId?: Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrder
|
||||
userCommentId?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
}
|
||||
@@ -387,6 +431,8 @@ export type AgentSessionMinOrderByAggregateInput = {
|
||||
userId?: Prisma.SortOrder
|
||||
cwd?: Prisma.SortOrder
|
||||
leafId?: Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrder
|
||||
userCommentId?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
}
|
||||
@@ -482,6 +528,92 @@ export type AgentSessionUncheckedUpdateManyWithoutUserNestedInput = {
|
||||
deleteMany?: Prisma.AgentSessionScalarWhereInput | Prisma.AgentSessionScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type AgentSessionCreateNestedManyWithoutAssetInput = {
|
||||
create?:
|
||||
| Prisma.XOR<
|
||||
Prisma.AgentSessionCreateWithoutAssetInput,
|
||||
Prisma.AgentSessionUncheckedCreateWithoutAssetInput
|
||||
>
|
||||
| Prisma.AgentSessionCreateWithoutAssetInput[]
|
||||
| Prisma.AgentSessionUncheckedCreateWithoutAssetInput[]
|
||||
connectOrCreate?:
|
||||
| Prisma.AgentSessionCreateOrConnectWithoutAssetInput
|
||||
| Prisma.AgentSessionCreateOrConnectWithoutAssetInput[]
|
||||
createMany?: Prisma.AgentSessionCreateManyAssetInputEnvelope
|
||||
connect?: Prisma.AgentSessionWhereUniqueInput | Prisma.AgentSessionWhereUniqueInput[]
|
||||
}
|
||||
|
||||
export type AgentSessionUncheckedCreateNestedManyWithoutAssetInput = {
|
||||
create?:
|
||||
| Prisma.XOR<
|
||||
Prisma.AgentSessionCreateWithoutAssetInput,
|
||||
Prisma.AgentSessionUncheckedCreateWithoutAssetInput
|
||||
>
|
||||
| Prisma.AgentSessionCreateWithoutAssetInput[]
|
||||
| Prisma.AgentSessionUncheckedCreateWithoutAssetInput[]
|
||||
connectOrCreate?:
|
||||
| Prisma.AgentSessionCreateOrConnectWithoutAssetInput
|
||||
| Prisma.AgentSessionCreateOrConnectWithoutAssetInput[]
|
||||
createMany?: Prisma.AgentSessionCreateManyAssetInputEnvelope
|
||||
connect?: Prisma.AgentSessionWhereUniqueInput | Prisma.AgentSessionWhereUniqueInput[]
|
||||
}
|
||||
|
||||
export type AgentSessionUpdateManyWithoutAssetNestedInput = {
|
||||
create?:
|
||||
| Prisma.XOR<
|
||||
Prisma.AgentSessionCreateWithoutAssetInput,
|
||||
Prisma.AgentSessionUncheckedCreateWithoutAssetInput
|
||||
>
|
||||
| Prisma.AgentSessionCreateWithoutAssetInput[]
|
||||
| Prisma.AgentSessionUncheckedCreateWithoutAssetInput[]
|
||||
connectOrCreate?:
|
||||
| Prisma.AgentSessionCreateOrConnectWithoutAssetInput
|
||||
| Prisma.AgentSessionCreateOrConnectWithoutAssetInput[]
|
||||
upsert?:
|
||||
| Prisma.AgentSessionUpsertWithWhereUniqueWithoutAssetInput
|
||||
| Prisma.AgentSessionUpsertWithWhereUniqueWithoutAssetInput[]
|
||||
createMany?: Prisma.AgentSessionCreateManyAssetInputEnvelope
|
||||
set?: Prisma.AgentSessionWhereUniqueInput | Prisma.AgentSessionWhereUniqueInput[]
|
||||
disconnect?: Prisma.AgentSessionWhereUniqueInput | Prisma.AgentSessionWhereUniqueInput[]
|
||||
delete?: Prisma.AgentSessionWhereUniqueInput | Prisma.AgentSessionWhereUniqueInput[]
|
||||
connect?: Prisma.AgentSessionWhereUniqueInput | Prisma.AgentSessionWhereUniqueInput[]
|
||||
update?:
|
||||
| Prisma.AgentSessionUpdateWithWhereUniqueWithoutAssetInput
|
||||
| Prisma.AgentSessionUpdateWithWhereUniqueWithoutAssetInput[]
|
||||
updateMany?:
|
||||
| Prisma.AgentSessionUpdateManyWithWhereWithoutAssetInput
|
||||
| Prisma.AgentSessionUpdateManyWithWhereWithoutAssetInput[]
|
||||
deleteMany?: Prisma.AgentSessionScalarWhereInput | Prisma.AgentSessionScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type AgentSessionUncheckedUpdateManyWithoutAssetNestedInput = {
|
||||
create?:
|
||||
| Prisma.XOR<
|
||||
Prisma.AgentSessionCreateWithoutAssetInput,
|
||||
Prisma.AgentSessionUncheckedCreateWithoutAssetInput
|
||||
>
|
||||
| Prisma.AgentSessionCreateWithoutAssetInput[]
|
||||
| Prisma.AgentSessionUncheckedCreateWithoutAssetInput[]
|
||||
connectOrCreate?:
|
||||
| Prisma.AgentSessionCreateOrConnectWithoutAssetInput
|
||||
| Prisma.AgentSessionCreateOrConnectWithoutAssetInput[]
|
||||
upsert?:
|
||||
| Prisma.AgentSessionUpsertWithWhereUniqueWithoutAssetInput
|
||||
| Prisma.AgentSessionUpsertWithWhereUniqueWithoutAssetInput[]
|
||||
createMany?: Prisma.AgentSessionCreateManyAssetInputEnvelope
|
||||
set?: Prisma.AgentSessionWhereUniqueInput | Prisma.AgentSessionWhereUniqueInput[]
|
||||
disconnect?: Prisma.AgentSessionWhereUniqueInput | Prisma.AgentSessionWhereUniqueInput[]
|
||||
delete?: Prisma.AgentSessionWhereUniqueInput | Prisma.AgentSessionWhereUniqueInput[]
|
||||
connect?: Prisma.AgentSessionWhereUniqueInput | Prisma.AgentSessionWhereUniqueInput[]
|
||||
update?:
|
||||
| Prisma.AgentSessionUpdateWithWhereUniqueWithoutAssetInput
|
||||
| Prisma.AgentSessionUpdateWithWhereUniqueWithoutAssetInput[]
|
||||
updateMany?:
|
||||
| Prisma.AgentSessionUpdateManyWithWhereWithoutAssetInput
|
||||
| Prisma.AgentSessionUpdateManyWithWhereWithoutAssetInput[]
|
||||
deleteMany?: Prisma.AgentSessionScalarWhereInput | Prisma.AgentSessionScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type AgentSessionCreateNestedOneWithoutCommentsInput = {
|
||||
create?: Prisma.XOR<
|
||||
Prisma.AgentSessionCreateWithoutCommentsInput,
|
||||
@@ -626,9 +758,11 @@ export type AgentSessionCreateWithoutUserInput = {
|
||||
id?: string
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
agent: Prisma.AgentCreateNestedOneWithoutAgentSessionsInput
|
||||
asset?: Prisma.AssetCreateNestedOneWithoutAgentSessionsInput
|
||||
entries?: Prisma.AgentSessionEntryCreateNestedManyWithoutSessionInput
|
||||
comments?: Prisma.AssetCommentCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
@@ -638,6 +772,8 @@ export type AgentSessionUncheckedCreateWithoutUserInput = {
|
||||
agentId: string
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedCreateNestedManyWithoutSessionInput
|
||||
@@ -694,18 +830,89 @@ export type AgentSessionScalarWhereInput = {
|
||||
userId?: Prisma.StringNullableFilter<'AgentSession'> | string | null
|
||||
cwd?: Prisma.StringFilter<'AgentSession'> | string
|
||||
leafId?: Prisma.StringNullableFilter<'AgentSession'> | string | null
|
||||
assetId?: Prisma.StringNullableFilter<'AgentSession'> | string | null
|
||||
userCommentId?: Prisma.StringNullableFilter<'AgentSession'> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<'AgentSession'> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<'AgentSession'> | Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionCreateWithoutAssetInput = {
|
||||
id?: string
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
agent: Prisma.AgentCreateNestedOneWithoutAgentSessionsInput
|
||||
user?: Prisma.UserCreateNestedOneWithoutAgentSessionsInput
|
||||
entries?: Prisma.AgentSessionEntryCreateNestedManyWithoutSessionInput
|
||||
comments?: Prisma.AssetCommentCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
|
||||
export type AgentSessionUncheckedCreateWithoutAssetInput = {
|
||||
id?: string
|
||||
agentId: string
|
||||
userId?: string | null
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedCreateNestedManyWithoutSessionInput
|
||||
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
|
||||
export type AgentSessionCreateOrConnectWithoutAssetInput = {
|
||||
where: Prisma.AgentSessionWhereUniqueInput
|
||||
create: Prisma.XOR<
|
||||
Prisma.AgentSessionCreateWithoutAssetInput,
|
||||
Prisma.AgentSessionUncheckedCreateWithoutAssetInput
|
||||
>
|
||||
}
|
||||
|
||||
export type AgentSessionCreateManyAssetInputEnvelope = {
|
||||
data: Prisma.AgentSessionCreateManyAssetInput | Prisma.AgentSessionCreateManyAssetInput[]
|
||||
skipDuplicates?: boolean
|
||||
}
|
||||
|
||||
export type AgentSessionUpsertWithWhereUniqueWithoutAssetInput = {
|
||||
where: Prisma.AgentSessionWhereUniqueInput
|
||||
update: Prisma.XOR<
|
||||
Prisma.AgentSessionUpdateWithoutAssetInput,
|
||||
Prisma.AgentSessionUncheckedUpdateWithoutAssetInput
|
||||
>
|
||||
create: Prisma.XOR<
|
||||
Prisma.AgentSessionCreateWithoutAssetInput,
|
||||
Prisma.AgentSessionUncheckedCreateWithoutAssetInput
|
||||
>
|
||||
}
|
||||
|
||||
export type AgentSessionUpdateWithWhereUniqueWithoutAssetInput = {
|
||||
where: Prisma.AgentSessionWhereUniqueInput
|
||||
data: Prisma.XOR<
|
||||
Prisma.AgentSessionUpdateWithoutAssetInput,
|
||||
Prisma.AgentSessionUncheckedUpdateWithoutAssetInput
|
||||
>
|
||||
}
|
||||
|
||||
export type AgentSessionUpdateManyWithWhereWithoutAssetInput = {
|
||||
where: Prisma.AgentSessionScalarWhereInput
|
||||
data: Prisma.XOR<
|
||||
Prisma.AgentSessionUpdateManyMutationInput,
|
||||
Prisma.AgentSessionUncheckedUpdateManyWithoutAssetInput
|
||||
>
|
||||
}
|
||||
|
||||
export type AgentSessionCreateWithoutCommentsInput = {
|
||||
id?: string
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
agent: Prisma.AgentCreateNestedOneWithoutAgentSessionsInput
|
||||
user?: Prisma.UserCreateNestedOneWithoutAgentSessionsInput
|
||||
asset?: Prisma.AssetCreateNestedOneWithoutAgentSessionsInput
|
||||
entries?: Prisma.AgentSessionEntryCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
|
||||
@@ -715,6 +922,8 @@ export type AgentSessionUncheckedCreateWithoutCommentsInput = {
|
||||
userId?: string | null
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedCreateNestedManyWithoutSessionInput
|
||||
@@ -752,10 +961,12 @@ export type AgentSessionUpdateWithoutCommentsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
agent?: Prisma.AgentUpdateOneRequiredWithoutAgentSessionsNestedInput
|
||||
user?: Prisma.UserUpdateOneWithoutAgentSessionsNestedInput
|
||||
asset?: Prisma.AssetUpdateOneWithoutAgentSessionsNestedInput
|
||||
entries?: Prisma.AgentSessionEntryUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
|
||||
@@ -765,6 +976,8 @@ export type AgentSessionUncheckedUpdateWithoutCommentsInput = {
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedUpdateManyWithoutSessionNestedInput
|
||||
@@ -774,9 +987,11 @@ export type AgentSessionCreateWithoutAgentInput = {
|
||||
id?: string
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
user?: Prisma.UserCreateNestedOneWithoutAgentSessionsInput
|
||||
asset?: Prisma.AssetCreateNestedOneWithoutAgentSessionsInput
|
||||
entries?: Prisma.AgentSessionEntryCreateNestedManyWithoutSessionInput
|
||||
comments?: Prisma.AssetCommentCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
@@ -786,6 +1001,8 @@ export type AgentSessionUncheckedCreateWithoutAgentInput = {
|
||||
userId?: string | null
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedCreateNestedManyWithoutSessionInput
|
||||
@@ -837,10 +1054,12 @@ export type AgentSessionCreateWithoutEntriesInput = {
|
||||
id?: string
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
agent: Prisma.AgentCreateNestedOneWithoutAgentSessionsInput
|
||||
user?: Prisma.UserCreateNestedOneWithoutAgentSessionsInput
|
||||
asset?: Prisma.AssetCreateNestedOneWithoutAgentSessionsInput
|
||||
comments?: Prisma.AssetCommentCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
|
||||
@@ -850,6 +1069,8 @@ export type AgentSessionUncheckedCreateWithoutEntriesInput = {
|
||||
userId?: string | null
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutSessionInput
|
||||
@@ -887,10 +1108,12 @@ export type AgentSessionUpdateWithoutEntriesInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
agent?: Prisma.AgentUpdateOneRequiredWithoutAgentSessionsNestedInput
|
||||
user?: Prisma.UserUpdateOneWithoutAgentSessionsNestedInput
|
||||
asset?: Prisma.AssetUpdateOneWithoutAgentSessionsNestedInput
|
||||
comments?: Prisma.AssetCommentUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
|
||||
@@ -900,6 +1123,8 @@ export type AgentSessionUncheckedUpdateWithoutEntriesInput = {
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutSessionNestedInput
|
||||
@@ -910,6 +1135,8 @@ export type AgentSessionCreateManyUserInput = {
|
||||
agentId: string
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
}
|
||||
@@ -918,9 +1145,11 @@ export type AgentSessionUpdateWithoutUserInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
agent?: Prisma.AgentUpdateOneRequiredWithoutAgentSessionsNestedInput
|
||||
asset?: Prisma.AssetUpdateOneWithoutAgentSessionsNestedInput
|
||||
entries?: Prisma.AgentSessionEntryUpdateManyWithoutSessionNestedInput
|
||||
comments?: Prisma.AssetCommentUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
@@ -930,6 +1159,8 @@ export type AgentSessionUncheckedUpdateWithoutUserInput = {
|
||||
agentId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedUpdateManyWithoutSessionNestedInput
|
||||
@@ -941,6 +1172,56 @@ export type AgentSessionUncheckedUpdateManyWithoutUserInput = {
|
||||
agentId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionCreateManyAssetInput = {
|
||||
id?: string
|
||||
agentId: string
|
||||
userId?: string | null
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
}
|
||||
|
||||
export type AgentSessionUpdateWithoutAssetInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
agent?: Prisma.AgentUpdateOneRequiredWithoutAgentSessionsNestedInput
|
||||
user?: Prisma.UserUpdateOneWithoutAgentSessionsNestedInput
|
||||
entries?: Prisma.AgentSessionEntryUpdateManyWithoutSessionNestedInput
|
||||
comments?: Prisma.AssetCommentUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
|
||||
export type AgentSessionUncheckedUpdateWithoutAssetInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
agentId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedUpdateManyWithoutSessionNestedInput
|
||||
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
|
||||
export type AgentSessionUncheckedUpdateManyWithoutAssetInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
agentId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
@@ -950,6 +1231,8 @@ export type AgentSessionCreateManyAgentInput = {
|
||||
userId?: string | null
|
||||
cwd: string
|
||||
leafId?: string | null
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
}
|
||||
@@ -958,9 +1241,11 @@ export type AgentSessionUpdateWithoutAgentInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
user?: Prisma.UserUpdateOneWithoutAgentSessionsNestedInput
|
||||
asset?: Prisma.AssetUpdateOneWithoutAgentSessionsNestedInput
|
||||
entries?: Prisma.AgentSessionEntryUpdateManyWithoutSessionNestedInput
|
||||
comments?: Prisma.AssetCommentUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
@@ -970,6 +1255,8 @@ export type AgentSessionUncheckedUpdateWithoutAgentInput = {
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedUpdateManyWithoutSessionNestedInput
|
||||
@@ -981,6 +1268,8 @@ export type AgentSessionUncheckedUpdateManyWithoutAgentInput = {
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
cwd?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
@@ -1040,10 +1329,13 @@ export type AgentSessionSelect<
|
||||
userId?: boolean
|
||||
cwd?: boolean
|
||||
leafId?: boolean
|
||||
assetId?: boolean
|
||||
userCommentId?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
agent?: boolean | Prisma.AgentDefaultArgs<ExtArgs>
|
||||
user?: boolean | Prisma.AgentSession$userArgs<ExtArgs>
|
||||
asset?: boolean | Prisma.AgentSession$assetArgs<ExtArgs>
|
||||
entries?: boolean | Prisma.AgentSession$entriesArgs<ExtArgs>
|
||||
comments?: boolean | Prisma.AgentSession$commentsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.AgentSessionCountOutputTypeDefaultArgs<ExtArgs>
|
||||
@@ -1060,10 +1352,13 @@ export type AgentSessionSelectCreateManyAndReturn<
|
||||
userId?: boolean
|
||||
cwd?: boolean
|
||||
leafId?: boolean
|
||||
assetId?: boolean
|
||||
userCommentId?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
agent?: boolean | Prisma.AgentDefaultArgs<ExtArgs>
|
||||
user?: boolean | Prisma.AgentSession$userArgs<ExtArgs>
|
||||
asset?: boolean | Prisma.AgentSession$assetArgs<ExtArgs>
|
||||
},
|
||||
ExtArgs['result']['agentSession']
|
||||
>
|
||||
@@ -1077,10 +1372,13 @@ export type AgentSessionSelectUpdateManyAndReturn<
|
||||
userId?: boolean
|
||||
cwd?: boolean
|
||||
leafId?: boolean
|
||||
assetId?: boolean
|
||||
userCommentId?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
agent?: boolean | Prisma.AgentDefaultArgs<ExtArgs>
|
||||
user?: boolean | Prisma.AgentSession$userArgs<ExtArgs>
|
||||
asset?: boolean | Prisma.AgentSession$assetArgs<ExtArgs>
|
||||
},
|
||||
ExtArgs['result']['agentSession']
|
||||
>
|
||||
@@ -1091,6 +1389,8 @@ export type AgentSessionSelectScalar = {
|
||||
userId?: boolean
|
||||
cwd?: boolean
|
||||
leafId?: boolean
|
||||
assetId?: boolean
|
||||
userCommentId?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
}
|
||||
@@ -1098,7 +1398,15 @@ export type AgentSessionSelectScalar = {
|
||||
export type AgentSessionOmit<
|
||||
ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs,
|
||||
> = runtime.Types.Extensions.GetOmit<
|
||||
'id' | 'agentId' | 'userId' | 'cwd' | 'leafId' | 'createdAt' | 'updatedAt',
|
||||
| 'id'
|
||||
| 'agentId'
|
||||
| 'userId'
|
||||
| 'cwd'
|
||||
| 'leafId'
|
||||
| 'assetId'
|
||||
| 'userCommentId'
|
||||
| 'createdAt'
|
||||
| 'updatedAt',
|
||||
ExtArgs['result']['agentSession']
|
||||
>
|
||||
export type AgentSessionInclude<
|
||||
@@ -1106,6 +1414,7 @@ export type AgentSessionInclude<
|
||||
> = {
|
||||
agent?: boolean | Prisma.AgentDefaultArgs<ExtArgs>
|
||||
user?: boolean | Prisma.AgentSession$userArgs<ExtArgs>
|
||||
asset?: boolean | Prisma.AgentSession$assetArgs<ExtArgs>
|
||||
entries?: boolean | Prisma.AgentSession$entriesArgs<ExtArgs>
|
||||
comments?: boolean | Prisma.AgentSession$commentsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.AgentSessionCountOutputTypeDefaultArgs<ExtArgs>
|
||||
@@ -1115,12 +1424,14 @@ export type AgentSessionIncludeCreateManyAndReturn<
|
||||
> = {
|
||||
agent?: boolean | Prisma.AgentDefaultArgs<ExtArgs>
|
||||
user?: boolean | Prisma.AgentSession$userArgs<ExtArgs>
|
||||
asset?: boolean | Prisma.AgentSession$assetArgs<ExtArgs>
|
||||
}
|
||||
export type AgentSessionIncludeUpdateManyAndReturn<
|
||||
ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs,
|
||||
> = {
|
||||
agent?: boolean | Prisma.AgentDefaultArgs<ExtArgs>
|
||||
user?: boolean | Prisma.AgentSession$userArgs<ExtArgs>
|
||||
asset?: boolean | Prisma.AgentSession$assetArgs<ExtArgs>
|
||||
}
|
||||
|
||||
export type $AgentSessionPayload<
|
||||
@@ -1130,6 +1441,7 @@ export type $AgentSessionPayload<
|
||||
objects: {
|
||||
agent: Prisma.$AgentPayload<ExtArgs>
|
||||
user: Prisma.$UserPayload<ExtArgs> | null
|
||||
asset: Prisma.$AssetPayload<ExtArgs> | null
|
||||
entries: Prisma.$AgentSessionEntryPayload<ExtArgs>[]
|
||||
comments: Prisma.$AssetCommentPayload<ExtArgs>[]
|
||||
}
|
||||
@@ -1140,6 +1452,8 @@ export type $AgentSessionPayload<
|
||||
userId: string | null
|
||||
cwd: string
|
||||
leafId: string | null
|
||||
assetId: string | null
|
||||
userCommentId: string | null
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
},
|
||||
@@ -1707,6 +2021,19 @@ export interface Prisma__AgentSessionClient<
|
||||
ExtArgs,
|
||||
GlobalOmitOptions
|
||||
>
|
||||
asset<T extends Prisma.AgentSession$assetArgs<ExtArgs> = {}>(
|
||||
args?: Prisma.Subset<T, Prisma.AgentSession$assetArgs<ExtArgs>>,
|
||||
): Prisma.Prisma__AssetClient<
|
||||
runtime.Types.Result.GetResult<
|
||||
Prisma.$AssetPayload<ExtArgs>,
|
||||
T,
|
||||
'findUniqueOrThrow',
|
||||
GlobalOmitOptions
|
||||
> | null,
|
||||
null,
|
||||
ExtArgs,
|
||||
GlobalOmitOptions
|
||||
>
|
||||
entries<T extends Prisma.AgentSession$entriesArgs<ExtArgs> = {}>(
|
||||
args?: Prisma.Subset<T, Prisma.AgentSession$entriesArgs<ExtArgs>>,
|
||||
): Prisma.PrismaPromise<
|
||||
@@ -1765,6 +2092,8 @@ export interface AgentSessionFieldRefs {
|
||||
readonly userId: Prisma.FieldRef<'AgentSession', 'String'>
|
||||
readonly cwd: Prisma.FieldRef<'AgentSession', 'String'>
|
||||
readonly leafId: Prisma.FieldRef<'AgentSession', 'String'>
|
||||
readonly assetId: Prisma.FieldRef<'AgentSession', 'String'>
|
||||
readonly userCommentId: Prisma.FieldRef<'AgentSession', 'String'>
|
||||
readonly createdAt: Prisma.FieldRef<'AgentSession', 'DateTime'>
|
||||
readonly updatedAt: Prisma.FieldRef<'AgentSession', 'DateTime'>
|
||||
}
|
||||
@@ -2227,6 +2556,27 @@ export type AgentSession$userArgs<
|
||||
where?: Prisma.UserWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* AgentSession.asset
|
||||
*/
|
||||
export type AgentSession$assetArgs<
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
* AgentSession.entries
|
||||
*/
|
||||
|
||||
@@ -367,6 +367,7 @@ export type AssetWhereInput = {
|
||||
Prisma.ShareLinkNullableScalarRelationFilter,
|
||||
Prisma.ShareLinkWhereInput
|
||||
> | null
|
||||
agentSessions?: Prisma.AgentSessionListRelationFilter
|
||||
}
|
||||
|
||||
export type AssetOrderByWithRelationInput = {
|
||||
@@ -408,6 +409,7 @@ export type AssetOrderByWithRelationInput = {
|
||||
projectRootFolder?: Prisma.ProjectOrderByWithRelationInput
|
||||
projectShareRoot?: Prisma.ProjectOrderByWithRelationInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkOrderByWithRelationInput
|
||||
agentSessions?: Prisma.AgentSessionOrderByRelationAggregateInput
|
||||
}
|
||||
|
||||
export type AssetWhereUniqueInput = Prisma.AtLeast<
|
||||
@@ -472,6 +474,7 @@ export type AssetWhereUniqueInput = Prisma.AtLeast<
|
||||
Prisma.ShareLinkNullableScalarRelationFilter,
|
||||
Prisma.ShareLinkWhereInput
|
||||
> | null
|
||||
agentSessions?: Prisma.AgentSessionListRelationFilter
|
||||
},
|
||||
'id' | 'parentIdTargetId'
|
||||
>
|
||||
@@ -565,6 +568,7 @@ export type AssetCreateInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateInput = {
|
||||
@@ -600,6 +604,7 @@ export type AssetUncheckedCreateInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUpdateInput = {
|
||||
@@ -635,6 +640,7 @@ export type AssetUpdateInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateInput = {
|
||||
@@ -670,6 +676,7 @@ export type AssetUncheckedUpdateInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetCreateManyInput = {
|
||||
@@ -1668,6 +1675,34 @@ export type AssetUncheckedUpdateManyWithoutTaskNestedInput = {
|
||||
deleteMany?: Prisma.AssetScalarWhereInput | Prisma.AssetScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type AssetCreateNestedOneWithoutAgentSessionsInput = {
|
||||
create?: Prisma.XOR<
|
||||
Prisma.AssetCreateWithoutAgentSessionsInput,
|
||||
Prisma.AssetUncheckedCreateWithoutAgentSessionsInput
|
||||
>
|
||||
connectOrCreate?: Prisma.AssetCreateOrConnectWithoutAgentSessionsInput
|
||||
connect?: Prisma.AssetWhereUniqueInput
|
||||
}
|
||||
|
||||
export type AssetUpdateOneWithoutAgentSessionsNestedInput = {
|
||||
create?: Prisma.XOR<
|
||||
Prisma.AssetCreateWithoutAgentSessionsInput,
|
||||
Prisma.AssetUncheckedCreateWithoutAgentSessionsInput
|
||||
>
|
||||
connectOrCreate?: Prisma.AssetCreateOrConnectWithoutAgentSessionsInput
|
||||
upsert?: Prisma.AssetUpsertWithoutAgentSessionsInput
|
||||
disconnect?: Prisma.AssetWhereInput | boolean
|
||||
delete?: Prisma.AssetWhereInput | boolean
|
||||
connect?: Prisma.AssetWhereUniqueInput
|
||||
update?: Prisma.XOR<
|
||||
Prisma.XOR<
|
||||
Prisma.AssetUpdateToOneWithWhereWithoutAgentSessionsInput,
|
||||
Prisma.AssetUpdateWithoutAgentSessionsInput
|
||||
>,
|
||||
Prisma.AssetUncheckedUpdateWithoutAgentSessionsInput
|
||||
>
|
||||
}
|
||||
|
||||
export type AssetCreateWithoutCreatorInput = {
|
||||
id?: string
|
||||
name?: string
|
||||
@@ -1700,6 +1735,7 @@ export type AssetCreateWithoutCreatorInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutCreatorInput = {
|
||||
@@ -1734,6 +1770,7 @@ export type AssetUncheckedCreateWithoutCreatorInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutCreatorInput = {
|
||||
@@ -1836,6 +1873,7 @@ export type AssetCreateWithoutTeamRootFolderInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutTeamRootFolderInput = {
|
||||
@@ -1870,6 +1908,7 @@ export type AssetUncheckedCreateWithoutTeamRootFolderInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutTeamRootFolderInput = {
|
||||
@@ -1932,6 +1971,7 @@ export type AssetUpdateWithoutTeamRootFolderInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutTeamRootFolderInput = {
|
||||
@@ -1966,6 +2006,7 @@ export type AssetUncheckedUpdateWithoutTeamRootFolderInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetCreateWithoutProjectRootFolderInput = {
|
||||
@@ -2000,6 +2041,7 @@ export type AssetCreateWithoutProjectRootFolderInput = {
|
||||
teamRootFolder?: Prisma.TeamCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutProjectRootFolderInput = {
|
||||
@@ -2034,6 +2076,7 @@ export type AssetUncheckedCreateWithoutProjectRootFolderInput = {
|
||||
teamRootFolder?: Prisma.TeamUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutProjectRootFolderInput = {
|
||||
@@ -2076,6 +2119,7 @@ export type AssetCreateWithoutProjectShareRootInput = {
|
||||
teamRootFolder?: Prisma.TeamCreateNestedOneWithoutRootFolderInput
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutProjectShareRootInput = {
|
||||
@@ -2110,6 +2154,7 @@ export type AssetUncheckedCreateWithoutProjectShareRootInput = {
|
||||
teamRootFolder?: Prisma.TeamUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutProjectShareRootInput = {
|
||||
@@ -2152,6 +2197,7 @@ export type AssetCreateWithoutProjectInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutProjectInput = {
|
||||
@@ -2186,6 +2232,7 @@ export type AssetUncheckedCreateWithoutProjectInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutProjectInput = {
|
||||
@@ -2253,6 +2300,7 @@ export type AssetUpdateWithoutProjectRootFolderInput = {
|
||||
teamRootFolder?: Prisma.TeamUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutProjectRootFolderInput = {
|
||||
@@ -2287,6 +2335,7 @@ export type AssetUncheckedUpdateWithoutProjectRootFolderInput = {
|
||||
teamRootFolder?: Prisma.TeamUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUpsertWithoutProjectShareRootInput = {
|
||||
@@ -2341,6 +2390,7 @@ export type AssetUpdateWithoutProjectShareRootInput = {
|
||||
teamRootFolder?: Prisma.TeamUpdateOneWithoutRootFolderNestedInput
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutProjectShareRootInput = {
|
||||
@@ -2375,6 +2425,7 @@ export type AssetUncheckedUpdateWithoutProjectShareRootInput = {
|
||||
teamRootFolder?: Prisma.TeamUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUpsertWithWhereUniqueWithoutProjectInput = {
|
||||
@@ -2437,6 +2488,7 @@ export type AssetCreateWithoutShareLinkRootFolderInput = {
|
||||
teamRootFolder?: Prisma.TeamCreateNestedOneWithoutRootFolderInput
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutShareLinkRootFolderInput = {
|
||||
@@ -2471,6 +2523,7 @@ export type AssetUncheckedCreateWithoutShareLinkRootFolderInput = {
|
||||
teamRootFolder?: Prisma.TeamUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutShareLinkRootFolderInput = {
|
||||
@@ -2533,6 +2586,7 @@ export type AssetUpdateWithoutShareLinkRootFolderInput = {
|
||||
teamRootFolder?: Prisma.TeamUpdateOneWithoutRootFolderNestedInput
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutShareLinkRootFolderInput = {
|
||||
@@ -2567,6 +2621,7 @@ export type AssetUncheckedUpdateWithoutShareLinkRootFolderInput = {
|
||||
teamRootFolder?: Prisma.TeamUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetCreateWithoutChildrenInput = {
|
||||
@@ -2601,6 +2656,7 @@ export type AssetCreateWithoutChildrenInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutChildrenInput = {
|
||||
@@ -2635,6 +2691,7 @@ export type AssetUncheckedCreateWithoutChildrenInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutChildrenInput = {
|
||||
@@ -2677,6 +2734,7 @@ export type AssetCreateWithoutParentInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutParentInput = {
|
||||
@@ -2711,6 +2769,7 @@ export type AssetUncheckedCreateWithoutParentInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutParentInput = {
|
||||
@@ -2758,6 +2817,7 @@ export type AssetCreateWithoutSymlinksInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutSymlinksInput = {
|
||||
@@ -2792,6 +2852,7 @@ export type AssetUncheckedCreateWithoutSymlinksInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutSymlinksInput = {
|
||||
@@ -2834,6 +2895,7 @@ export type AssetCreateWithoutTargetInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutTargetInput = {
|
||||
@@ -2868,6 +2930,7 @@ export type AssetUncheckedCreateWithoutTargetInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutTargetInput = {
|
||||
@@ -2935,6 +2998,7 @@ export type AssetUpdateWithoutChildrenInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutChildrenInput = {
|
||||
@@ -2969,6 +3033,7 @@ export type AssetUncheckedUpdateWithoutChildrenInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUpsertWithWhereUniqueWithoutParentInput = {
|
||||
@@ -3051,6 +3116,7 @@ export type AssetUpdateWithoutSymlinksInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutSymlinksInput = {
|
||||
@@ -3085,6 +3151,7 @@ export type AssetUncheckedUpdateWithoutSymlinksInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUpsertWithWhereUniqueWithoutTargetInput = {
|
||||
@@ -3147,6 +3214,7 @@ export type AssetCreateWithoutStorageKeyInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutStorageKeyInput = {
|
||||
@@ -3181,6 +3249,7 @@ export type AssetUncheckedCreateWithoutStorageKeyInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutStorageKeyInput = {
|
||||
@@ -3256,6 +3325,7 @@ export type AssetCreateWithoutMetadataValuesInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutMetadataValuesInput = {
|
||||
@@ -3290,6 +3360,7 @@ export type AssetUncheckedCreateWithoutMetadataValuesInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutMetadataValuesInput = {
|
||||
@@ -3352,6 +3423,7 @@ export type AssetUpdateWithoutMetadataValuesInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutMetadataValuesInput = {
|
||||
@@ -3386,6 +3458,7 @@ export type AssetUncheckedUpdateWithoutMetadataValuesInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetCreateWithoutCommentsInput = {
|
||||
@@ -3420,6 +3493,7 @@ export type AssetCreateWithoutCommentsInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutCommentsInput = {
|
||||
@@ -3454,6 +3528,7 @@ export type AssetUncheckedCreateWithoutCommentsInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutCommentsInput = {
|
||||
@@ -3516,6 +3591,7 @@ export type AssetUpdateWithoutCommentsInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutCommentsInput = {
|
||||
@@ -3550,6 +3626,7 @@ export type AssetUncheckedUpdateWithoutCommentsInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetCreateWithoutCommentAttachmentsInput = {
|
||||
@@ -3584,6 +3661,7 @@ export type AssetCreateWithoutCommentAttachmentsInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutCommentAttachmentsInput = {
|
||||
@@ -3618,6 +3696,7 @@ export type AssetUncheckedCreateWithoutCommentAttachmentsInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutCommentAttachmentsInput = {
|
||||
@@ -3680,6 +3759,7 @@ export type AssetUpdateWithoutCommentAttachmentsInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutCommentAttachmentsInput = {
|
||||
@@ -3714,6 +3794,7 @@ export type AssetUncheckedUpdateWithoutCommentAttachmentsInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetCreateWithoutEmbeddingsInput = {
|
||||
@@ -3748,6 +3829,7 @@ export type AssetCreateWithoutEmbeddingsInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutEmbeddingsInput = {
|
||||
@@ -3782,6 +3864,7 @@ export type AssetUncheckedCreateWithoutEmbeddingsInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutEmbeddingsInput = {
|
||||
@@ -3844,6 +3927,7 @@ export type AssetUpdateWithoutEmbeddingsInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutEmbeddingsInput = {
|
||||
@@ -3878,6 +3962,7 @@ export type AssetUncheckedUpdateWithoutEmbeddingsInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetCreateWithoutNotificationsInput = {
|
||||
@@ -3912,6 +3997,7 @@ export type AssetCreateWithoutNotificationsInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutNotificationsInput = {
|
||||
@@ -3946,6 +4032,7 @@ export type AssetUncheckedCreateWithoutNotificationsInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutNotificationsInput = {
|
||||
@@ -4008,6 +4095,7 @@ export type AssetUpdateWithoutNotificationsInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutNotificationsInput = {
|
||||
@@ -4042,6 +4130,7 @@ export type AssetUncheckedUpdateWithoutNotificationsInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetCreateWithoutTaskInput = {
|
||||
@@ -4076,6 +4165,7 @@ export type AssetCreateWithoutTaskInput = {
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutTaskInput = {
|
||||
@@ -4110,6 +4200,7 @@ export type AssetUncheckedCreateWithoutTaskInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutTaskInput = {
|
||||
@@ -4150,6 +4241,174 @@ export type AssetUpdateManyWithWhereWithoutTaskInput = {
|
||||
>
|
||||
}
|
||||
|
||||
export type AssetCreateWithoutAgentSessionsInput = {
|
||||
id?: string
|
||||
name?: string
|
||||
nameNgram?: Prisma.AssetCreatenameNgramInput | string[]
|
||||
type: $Enums.AssetType
|
||||
mediaType?: string | null
|
||||
fileCount?: number
|
||||
sizeByte?: number
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?: PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
parent?: Prisma.AssetCreateNestedOneWithoutChildrenInput
|
||||
children?: Prisma.AssetCreateNestedManyWithoutParentInput
|
||||
target?: Prisma.AssetCreateNestedOneWithoutSymlinksInput
|
||||
symlinks?: Prisma.AssetCreateNestedManyWithoutTargetInput
|
||||
storageKey?: Prisma.StorageKeyCreateNestedOneWithoutAssetsInput
|
||||
metadataValues?: Prisma.AssetMetadataValueCreateNestedManyWithoutAssetInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutAssetsInput
|
||||
task?: Prisma.TaskCreateNestedOneWithoutAssetsInput
|
||||
project?: Prisma.ProjectCreateNestedOneWithoutAssetsInput
|
||||
comments?: Prisma.AssetCommentCreateNestedManyWithoutAssetInput
|
||||
commentAttachments?: Prisma.AssetCommentAttachmentCreateNestedManyWithoutAssetInput
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutAssetInput
|
||||
embeddings?: Prisma.AssetEmbeddingCreateNestedManyWithoutAssetInput
|
||||
teamRootFolder?: Prisma.TeamCreateNestedOneWithoutRootFolderInput
|
||||
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedCreateWithoutAgentSessionsInput = {
|
||||
id?: string
|
||||
name?: string
|
||||
nameNgram?: Prisma.AssetCreatenameNgramInput | string[]
|
||||
type: $Enums.AssetType
|
||||
mediaType?: string | null
|
||||
fileCount?: number
|
||||
sizeByte?: number
|
||||
status: $Enums.AssetStatus
|
||||
transcodeTaskId?: string | null
|
||||
media?: PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
isDeleted?: boolean
|
||||
deletedAt?: Date | string | null
|
||||
sortIndex?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
parentId?: string | null
|
||||
targetId?: string | null
|
||||
storageKeyId?: string | null
|
||||
creatorId?: string | null
|
||||
taskId?: string | null
|
||||
projectId?: string | null
|
||||
children?: Prisma.AssetUncheckedCreateNestedManyWithoutParentInput
|
||||
symlinks?: Prisma.AssetUncheckedCreateNestedManyWithoutTargetInput
|
||||
metadataValues?: Prisma.AssetMetadataValueUncheckedCreateNestedManyWithoutAssetInput
|
||||
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutAssetInput
|
||||
commentAttachments?: Prisma.AssetCommentAttachmentUncheckedCreateNestedManyWithoutAssetInput
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutAssetInput
|
||||
embeddings?: Prisma.AssetEmbeddingUncheckedCreateNestedManyWithoutAssetInput
|
||||
teamRootFolder?: Prisma.TeamUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||
}
|
||||
|
||||
export type AssetCreateOrConnectWithoutAgentSessionsInput = {
|
||||
where: Prisma.AssetWhereUniqueInput
|
||||
create: Prisma.XOR<
|
||||
Prisma.AssetCreateWithoutAgentSessionsInput,
|
||||
Prisma.AssetUncheckedCreateWithoutAgentSessionsInput
|
||||
>
|
||||
}
|
||||
|
||||
export type AssetUpsertWithoutAgentSessionsInput = {
|
||||
update: Prisma.XOR<
|
||||
Prisma.AssetUpdateWithoutAgentSessionsInput,
|
||||
Prisma.AssetUncheckedUpdateWithoutAgentSessionsInput
|
||||
>
|
||||
create: Prisma.XOR<
|
||||
Prisma.AssetCreateWithoutAgentSessionsInput,
|
||||
Prisma.AssetUncheckedCreateWithoutAgentSessionsInput
|
||||
>
|
||||
where?: Prisma.AssetWhereInput
|
||||
}
|
||||
|
||||
export type AssetUpdateToOneWithWhereWithoutAgentSessionsInput = {
|
||||
where?: Prisma.AssetWhereInput
|
||||
data: Prisma.XOR<
|
||||
Prisma.AssetUpdateWithoutAgentSessionsInput,
|
||||
Prisma.AssetUncheckedUpdateWithoutAgentSessionsInput
|
||||
>
|
||||
}
|
||||
|
||||
export type AssetUpdateWithoutAgentSessionsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
nameNgram?: Prisma.AssetUpdatenameNgramInput | string[]
|
||||
type?: Prisma.EnumAssetTypeFieldUpdateOperationsInput | $Enums.AssetType
|
||||
mediaType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fileCount?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
sizeByte?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?: PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
parent?: Prisma.AssetUpdateOneWithoutChildrenNestedInput
|
||||
children?: Prisma.AssetUpdateManyWithoutParentNestedInput
|
||||
target?: Prisma.AssetUpdateOneWithoutSymlinksNestedInput
|
||||
symlinks?: Prisma.AssetUpdateManyWithoutTargetNestedInput
|
||||
storageKey?: Prisma.StorageKeyUpdateOneWithoutAssetsNestedInput
|
||||
metadataValues?: Prisma.AssetMetadataValueUpdateManyWithoutAssetNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutAssetsNestedInput
|
||||
task?: Prisma.TaskUpdateOneWithoutAssetsNestedInput
|
||||
project?: Prisma.ProjectUpdateOneWithoutAssetsNestedInput
|
||||
comments?: Prisma.AssetCommentUpdateManyWithoutAssetNestedInput
|
||||
commentAttachments?: Prisma.AssetCommentAttachmentUpdateManyWithoutAssetNestedInput
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutAssetNestedInput
|
||||
embeddings?: Prisma.AssetEmbeddingUpdateManyWithoutAssetNestedInput
|
||||
teamRootFolder?: Prisma.TeamUpdateOneWithoutRootFolderNestedInput
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutAgentSessionsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
nameNgram?: Prisma.AssetUpdatenameNgramInput | string[]
|
||||
type?: Prisma.EnumAssetTypeFieldUpdateOperationsInput | $Enums.AssetType
|
||||
mediaType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fileCount?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
sizeByte?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
media?: PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
parentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
targetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
storageKeyId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
taskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
children?: Prisma.AssetUncheckedUpdateManyWithoutParentNestedInput
|
||||
symlinks?: Prisma.AssetUncheckedUpdateManyWithoutTargetNestedInput
|
||||
metadataValues?: Prisma.AssetMetadataValueUncheckedUpdateManyWithoutAssetNestedInput
|
||||
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutAssetNestedInput
|
||||
commentAttachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutAssetNestedInput
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutAssetNestedInput
|
||||
embeddings?: Prisma.AssetEmbeddingUncheckedUpdateManyWithoutAssetNestedInput
|
||||
teamRootFolder?: Prisma.TeamUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
}
|
||||
|
||||
export type AssetCreateManyCreatorInput = {
|
||||
id?: string
|
||||
name?: string
|
||||
@@ -4205,6 +4464,7 @@ export type AssetUpdateWithoutCreatorInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutCreatorInput = {
|
||||
@@ -4239,6 +4499,7 @@ export type AssetUncheckedUpdateWithoutCreatorInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateManyWithoutCreatorInput = {
|
||||
@@ -4319,6 +4580,7 @@ export type AssetUpdateWithoutProjectInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutProjectInput = {
|
||||
@@ -4353,6 +4615,7 @@ export type AssetUncheckedUpdateWithoutProjectInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateManyWithoutProjectInput = {
|
||||
@@ -4456,6 +4719,7 @@ export type AssetUpdateWithoutParentInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutParentInput = {
|
||||
@@ -4490,6 +4754,7 @@ export type AssetUncheckedUpdateWithoutParentInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateManyWithoutParentInput = {
|
||||
@@ -4547,6 +4812,7 @@ export type AssetUpdateWithoutTargetInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutTargetInput = {
|
||||
@@ -4581,6 +4847,7 @@ export type AssetUncheckedUpdateWithoutTargetInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateManyWithoutTargetInput = {
|
||||
@@ -4661,6 +4928,7 @@ export type AssetUpdateWithoutStorageKeyInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutStorageKeyInput = {
|
||||
@@ -4695,6 +4963,7 @@ export type AssetUncheckedUpdateWithoutStorageKeyInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateManyWithoutStorageKeyInput = {
|
||||
@@ -4775,6 +5044,7 @@ export type AssetUpdateWithoutTaskInput = {
|
||||
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateWithoutTaskInput = {
|
||||
@@ -4809,6 +5079,7 @@ export type AssetUncheckedUpdateWithoutTaskInput = {
|
||||
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||
}
|
||||
|
||||
export type AssetUncheckedUpdateManyWithoutTaskInput = {
|
||||
@@ -4846,6 +5117,7 @@ export type AssetCountOutputType = {
|
||||
commentAttachments: number
|
||||
notifications: number
|
||||
embeddings: number
|
||||
agentSessions: number
|
||||
}
|
||||
|
||||
export type AssetCountOutputTypeSelect<
|
||||
@@ -4858,6 +5130,7 @@ export type AssetCountOutputTypeSelect<
|
||||
commentAttachments?: boolean | AssetCountOutputTypeCountCommentAttachmentsArgs
|
||||
notifications?: boolean | AssetCountOutputTypeCountNotificationsArgs
|
||||
embeddings?: boolean | AssetCountOutputTypeCountEmbeddingsArgs
|
||||
agentSessions?: boolean | AssetCountOutputTypeCountAgentSessionsArgs
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4935,6 +5208,15 @@ export type AssetCountOutputTypeCountEmbeddingsArgs<
|
||||
where?: Prisma.AssetEmbeddingWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* AssetCountOutputType without action
|
||||
*/
|
||||
export type AssetCountOutputTypeCountAgentSessionsArgs<
|
||||
ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs,
|
||||
> = {
|
||||
where?: Prisma.AgentSessionWhereInput
|
||||
}
|
||||
|
||||
export type AssetSelect<
|
||||
ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs,
|
||||
> = runtime.Types.Extensions.GetSelect<
|
||||
@@ -4977,6 +5259,7 @@ export type AssetSelect<
|
||||
projectRootFolder?: boolean | Prisma.Asset$projectRootFolderArgs<ExtArgs>
|
||||
projectShareRoot?: boolean | Prisma.Asset$projectShareRootArgs<ExtArgs>
|
||||
shareLinkRootFolder?: boolean | Prisma.Asset$shareLinkRootFolderArgs<ExtArgs>
|
||||
agentSessions?: boolean | Prisma.Asset$agentSessionsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.AssetCountOutputTypeDefaultArgs<ExtArgs>
|
||||
},
|
||||
ExtArgs['result']['asset']
|
||||
@@ -5122,6 +5405,7 @@ export type AssetInclude<
|
||||
projectRootFolder?: boolean | Prisma.Asset$projectRootFolderArgs<ExtArgs>
|
||||
projectShareRoot?: boolean | Prisma.Asset$projectShareRootArgs<ExtArgs>
|
||||
shareLinkRootFolder?: boolean | Prisma.Asset$shareLinkRootFolderArgs<ExtArgs>
|
||||
agentSessions?: boolean | Prisma.Asset$agentSessionsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.AssetCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
export type AssetIncludeCreateManyAndReturn<
|
||||
@@ -5167,6 +5451,7 @@ export type $AssetPayload<
|
||||
projectRootFolder: Prisma.$ProjectPayload<ExtArgs> | null
|
||||
projectShareRoot: Prisma.$ProjectPayload<ExtArgs> | null
|
||||
shareLinkRootFolder: Prisma.$ShareLinkPayload<ExtArgs> | null
|
||||
agentSessions: Prisma.$AgentSessionPayload<ExtArgs>[]
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<
|
||||
{
|
||||
@@ -5911,6 +6196,17 @@ export interface Prisma__AssetClient<
|
||||
ExtArgs,
|
||||
GlobalOmitOptions
|
||||
>
|
||||
agentSessions<T extends Prisma.Asset$agentSessionsArgs<ExtArgs> = {}>(
|
||||
args?: Prisma.Subset<T, Prisma.Asset$agentSessionsArgs<ExtArgs>>,
|
||||
): Prisma.PrismaPromise<
|
||||
| runtime.Types.Result.GetResult<
|
||||
Prisma.$AgentSessionPayload<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.
|
||||
@@ -6794,6 +7090,34 @@ export type Asset$shareLinkRootFolderArgs<
|
||||
where?: Prisma.ShareLinkWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* Asset.agentSessions
|
||||
*/
|
||||
export type Asset$agentSessionsArgs<
|
||||
ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs,
|
||||
> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the AgentSession
|
||||
*/
|
||||
select?: Prisma.AgentSessionSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the AgentSession
|
||||
*/
|
||||
omit?: Prisma.AgentSessionOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.AgentSessionInclude<ExtArgs> | null
|
||||
where?: Prisma.AgentSessionWhereInput
|
||||
orderBy?:
|
||||
| Prisma.AgentSessionOrderByWithRelationInput
|
||||
| Prisma.AgentSessionOrderByWithRelationInput[]
|
||||
cursor?: Prisma.AgentSessionWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.AgentSessionScalarFieldEnum | Prisma.AgentSessionScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Asset without action
|
||||
*/
|
||||
|
||||
@@ -234,9 +234,18 @@ declare global {
|
||||
>
|
||||
export type ProviderConfig = import('@shumai/dtos').ProviderConfigSerializable
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Workflow Task Payload
|
||||
// ----------------------------------------------------------------------
|
||||
export interface ScreenshotSpec {
|
||||
start: number
|
||||
end: number
|
||||
count: number
|
||||
commentTimestamp?: number | null
|
||||
annotations?: AnnotationList | null
|
||||
}
|
||||
|
||||
export interface ImageAnnotationSpec {
|
||||
annotations?: AnnotationList | null
|
||||
}
|
||||
|
||||
export interface WorkflowTaskPayload {
|
||||
projectId: string
|
||||
transcode?: TaskSpec
|
||||
@@ -245,6 +254,8 @@ declare global {
|
||||
text: string
|
||||
}
|
||||
agentToolCall?: AgentToolCallPayload
|
||||
screenshot?: ScreenshotSpec
|
||||
imageAnnotation?: ImageAnnotationSpec
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"@temporalio/activity": "^1.16.1",
|
||||
"@temporalio/worker": "^1.16.1",
|
||||
"@temporalio/workflow": "^1.16.1",
|
||||
"sharp": "^0.34.5"
|
||||
"sharp": "^0.34.5",
|
||||
"ulid": "^2.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { getMediaInfoActivity, transcodeVideoActivity, updateAssetMediaActivity } from './transcode'
|
||||
import {
|
||||
getMediaInfoActivity,
|
||||
transcodeVideoActivity,
|
||||
updateAssetMediaActivity,
|
||||
takeScreenshotsActivity,
|
||||
overlayAnnotationsActivity,
|
||||
} from './transcode'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { transcodeService } from '../transcode'
|
||||
|
||||
@@ -21,6 +27,8 @@ vi.mock('../transcode', () => ({
|
||||
transcodeVideo: vi.fn(),
|
||||
createTempDir: vi.fn().mockReturnValue('/tmp'),
|
||||
removeDir: vi.fn(),
|
||||
takeScreenshots: vi.fn(),
|
||||
overlayAnnotations: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
@@ -118,7 +126,6 @@ describe('Transcode Activities', () => {
|
||||
expect((updated?.media as any).duration).toBe(123)
|
||||
expect(s3Service.putObject).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should call transcodeService.transcodeVideo', async () => {
|
||||
vi.mocked(s3Service.headObject).mockRejectedValue(new Error('Not found'))
|
||||
|
||||
@@ -132,4 +139,48 @@ describe('Transcode Activities', () => {
|
||||
|
||||
expect(transcodeService.transcodeVideo).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should call transcodeService.takeScreenshots', async () => {
|
||||
vi.mocked(transcodeService.takeScreenshots).mockResolvedValue([
|
||||
{ key: 'screenshots/shot1.webp', timestamp: 1.0 },
|
||||
])
|
||||
|
||||
const result = await takeScreenshotsActivity({
|
||||
assetKey: 'v.mp4',
|
||||
assetId: 'asset-1',
|
||||
start: 0,
|
||||
end: 10,
|
||||
count: 1,
|
||||
commentTimestamp: 1.0,
|
||||
annotations: [],
|
||||
})
|
||||
|
||||
expect(transcodeService.takeScreenshots).toHaveBeenCalledWith({
|
||||
assetKey: 'v.mp4',
|
||||
assetId: 'asset-1',
|
||||
start: 0,
|
||||
end: 10,
|
||||
count: 1,
|
||||
commentTimestamp: 1.0,
|
||||
annotations: [],
|
||||
})
|
||||
expect(result).toEqual([{ key: 'screenshots/shot1.webp', timestamp: 1.0 }])
|
||||
})
|
||||
|
||||
it('should call transcodeService.overlayAnnotations', async () => {
|
||||
vi.mocked(transcodeService.overlayAnnotations).mockResolvedValue('annotations/ann.webp')
|
||||
|
||||
const result = await overlayAnnotationsActivity({
|
||||
assetKey: 'i.png',
|
||||
assetId: 'asset-2',
|
||||
annotations: [],
|
||||
})
|
||||
|
||||
expect(transcodeService.overlayAnnotations).toHaveBeenCalledWith({
|
||||
assetKey: 'i.png',
|
||||
assetId: 'asset-2',
|
||||
annotations: [],
|
||||
})
|
||||
expect(result).toBe('annotations/ann.webp')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -297,3 +297,23 @@ export async function updateAssetMediaActivity(params: UpdateAssetMediaActivityP
|
||||
data: { media: params.mediaInfo as any },
|
||||
})
|
||||
}
|
||||
|
||||
export async function takeScreenshotsActivity(params: {
|
||||
assetKey: string
|
||||
assetId: string
|
||||
start: number
|
||||
end: number
|
||||
count: number
|
||||
commentTimestamp?: number | null
|
||||
annotations?: PrismaJson.AnnotationList | null
|
||||
}): Promise<Array<{ key: string; timestamp: number }>> {
|
||||
return transcodeService.takeScreenshots(params)
|
||||
}
|
||||
|
||||
export async function overlayAnnotationsActivity(params: {
|
||||
assetKey: string
|
||||
assetId: string
|
||||
annotations: PrismaJson.AnnotationList
|
||||
}): Promise<string> {
|
||||
return transcodeService.overlayAnnotations(params)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import sharp from 'sharp'
|
||||
|
||||
// Mock child_process
|
||||
vi.mock('child_process', () => ({
|
||||
exec: vi.fn(),
|
||||
execFile: vi.fn(),
|
||||
}))
|
||||
|
||||
// Mock sharp
|
||||
@@ -66,7 +66,7 @@ describe('TranscodeService', () => {
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
;(child_process.exec as any).mockImplementation((cmd: string, cb: any) => {
|
||||
;(child_process.execFile as any).mockImplementation((file: string, args: string[], cb: any) => {
|
||||
cb(null, { stdout: mockOutput, stderr: '' })
|
||||
})
|
||||
|
||||
@@ -83,8 +83,9 @@ describe('TranscodeService', () => {
|
||||
expect(info.audioSampleRate).toBe(48000)
|
||||
expect(info.audioBitDepth).toBe(16)
|
||||
|
||||
expect(child_process.exec).toHaveBeenCalledWith(
|
||||
expect.stringContaining('ffprobe'),
|
||||
expect(child_process.execFile).toHaveBeenCalledWith(
|
||||
'ffprobe',
|
||||
expect.any(Array),
|
||||
expect.any(Function),
|
||||
)
|
||||
})
|
||||
@@ -110,7 +111,7 @@ describe('TranscodeService', () => {
|
||||
|
||||
it('should construct correct ffmpeg arguments for video transcoding', async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
;(child_process.exec as any).mockImplementation((cmd: string, cb: any) => {
|
||||
;(child_process.execFile as any).mockImplementation((file: string, args: string[], cb: any) => {
|
||||
cb(null, { stdout: '', stderr: '' })
|
||||
})
|
||||
|
||||
@@ -124,17 +125,20 @@ describe('TranscodeService', () => {
|
||||
disableAudio: true,
|
||||
})
|
||||
|
||||
expect(child_process.exec).toHaveBeenCalledWith(
|
||||
expect.stringContaining('scale=w=1280:h=720'),
|
||||
expect(child_process.execFile).toHaveBeenCalledWith(
|
||||
'ffmpeg',
|
||||
expect.arrayContaining(['-filter_complex', expect.stringContaining('scale=w=1280:h=720')]),
|
||||
expect.any(Function),
|
||||
)
|
||||
expect(child_process.exec).toHaveBeenCalledWith(
|
||||
expect.stringContaining('fps=24'),
|
||||
expect(child_process.execFile).toHaveBeenCalledWith(
|
||||
'ffmpeg',
|
||||
expect.arrayContaining(['-filter_complex', expect.stringContaining('fps=24')]),
|
||||
expect.any(Function),
|
||||
)
|
||||
// Should NOT have audio maps if disabled
|
||||
expect(child_process.exec).not.toHaveBeenCalledWith(
|
||||
expect.stringContaining('-map 0:a?'),
|
||||
expect(child_process.execFile).not.toHaveBeenCalledWith(
|
||||
'ffmpeg',
|
||||
expect.arrayContaining(['-map', '0:a?']),
|
||||
expect.any(Function),
|
||||
)
|
||||
})
|
||||
@@ -197,7 +201,7 @@ describe('TranscodeService', () => {
|
||||
mimeType: 'video/mp4',
|
||||
})
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
;(child_process.exec as any).mockImplementation((cmd: string, cb: any) => {
|
||||
;(child_process.execFile as any).mockImplementation((file: string, args: string[], cb: any) => {
|
||||
cb(null, { stdout: '', stderr: '' })
|
||||
})
|
||||
|
||||
@@ -209,8 +213,9 @@ describe('TranscodeService', () => {
|
||||
isImage: false,
|
||||
})
|
||||
|
||||
expect(child_process.exec).toHaveBeenCalledWith(
|
||||
expect.stringContaining('-c:v libwebp'),
|
||||
expect(child_process.execFile).toHaveBeenCalledWith(
|
||||
'ffmpeg',
|
||||
expect.arrayContaining(['-c:v', 'libwebp']),
|
||||
expect.any(Function),
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import { WorkflowTaskStatus, WorkflowTaskType } from '@shumai/db'
|
||||
import '@shumai/db/src/prisma-json-types'
|
||||
import { exec } from 'child_process'
|
||||
import { execFile } from 'child_process'
|
||||
import * as fs from 'fs'
|
||||
import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
import sharp from 'sharp'
|
||||
import { promisify } from 'util'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { ulid } from 'ulid'
|
||||
|
||||
const execAsync = promisify(exec)
|
||||
const execFileAsync = promisify(execFile)
|
||||
|
||||
const dataFormatNames: Record<string, string> = {
|
||||
// additional codecs
|
||||
@@ -185,9 +187,15 @@ export class TranscodeService {
|
||||
}
|
||||
|
||||
async getVideoInfo(inputFile: string): Promise<MediaMetadata> {
|
||||
const { stdout } = await execAsync(
|
||||
`ffprobe -v quiet -print_format json -show_format -show_streams "${inputFile}"`,
|
||||
)
|
||||
const { stdout } = await execFileAsync('ffprobe', [
|
||||
'-v',
|
||||
'quiet',
|
||||
'-print_format',
|
||||
'json',
|
||||
'-show_format',
|
||||
'-show_streams',
|
||||
inputFile,
|
||||
])
|
||||
const info = JSON.parse(stdout)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const videoStream = info.streams.find((s: any) => s.codec_type === 'video')
|
||||
@@ -248,14 +256,7 @@ export class TranscodeService {
|
||||
}
|
||||
filterComplex += '[vout]'
|
||||
|
||||
const args = [
|
||||
'-i',
|
||||
`"${params.inputFile}"`,
|
||||
'-filter_complex',
|
||||
`"${filterComplex}"`,
|
||||
'-map',
|
||||
'[vout]',
|
||||
]
|
||||
const args = ['-i', params.inputFile, '-filter_complex', filterComplex, '-map', '[vout]']
|
||||
|
||||
if (!params.disableAudio) {
|
||||
args.push('-map', '0:a?')
|
||||
@@ -267,9 +268,9 @@ export class TranscodeService {
|
||||
args.push('-c:a', 'aac', '-b:a', '128k')
|
||||
}
|
||||
|
||||
args.push('-movflags', '+faststart', '-max_muxing_queue_size', '1024', `"${params.outputFile}"`)
|
||||
args.push('-movflags', '+faststart', '-max_muxing_queue_size', '1024', params.outputFile)
|
||||
|
||||
await execAsync(`ffmpeg -y ${args.join(' ')}`)
|
||||
await execFileAsync('ffmpeg', ['-y', ...args])
|
||||
}
|
||||
|
||||
async transcodeImage(
|
||||
@@ -314,9 +315,9 @@ export class TranscodeService {
|
||||
|
||||
const args = [
|
||||
'-i',
|
||||
`"${inputFile}"`,
|
||||
inputFile,
|
||||
'-filter_complex',
|
||||
`"${filterComplex}"`,
|
||||
filterComplex,
|
||||
'-map',
|
||||
'[sprite_out]',
|
||||
'-frames:v',
|
||||
@@ -325,7 +326,7 @@ export class TranscodeService {
|
||||
'libwebp',
|
||||
'-q:v',
|
||||
'75',
|
||||
`"${outputSprite}"`,
|
||||
outputSprite,
|
||||
'-map',
|
||||
'[thumb_out]',
|
||||
'-c:v',
|
||||
@@ -336,23 +337,14 @@ export class TranscodeService {
|
||||
'1',
|
||||
'-max_muxing_queue_size',
|
||||
'1024',
|
||||
`"${outputPoster}"`,
|
||||
outputPoster,
|
||||
]
|
||||
await execAsync(`ffmpeg -y ${args.join(' ')}`)
|
||||
await execFileAsync('ffmpeg', ['-y', ...args])
|
||||
}
|
||||
|
||||
async extractAudio(inputFile: string, outputFile: string, bitrate: string): Promise<void> {
|
||||
const args = [
|
||||
'-i',
|
||||
`"${inputFile}"`,
|
||||
'-vn',
|
||||
'-acodec',
|
||||
'libmp3lame',
|
||||
'-b:a',
|
||||
bitrate,
|
||||
`"${outputFile}"`,
|
||||
]
|
||||
await execAsync(`ffmpeg -y ${args.join(' ')}`)
|
||||
const args = ['-i', inputFile, '-vn', '-acodec', 'libmp3lame', '-b:a', bitrate, outputFile]
|
||||
await execFileAsync('ffmpeg', ['-y', ...args])
|
||||
}
|
||||
|
||||
async extractVideoFrames(params: ExtractVideoFramesParams): Promise<string[]> {
|
||||
@@ -368,16 +360,16 @@ export class TranscodeService {
|
||||
|
||||
const args = [
|
||||
'-i',
|
||||
`"${params.inputFile}"`,
|
||||
params.inputFile,
|
||||
'-vf',
|
||||
`fps=${fps},scale=-2:${params.frameHeight}`,
|
||||
'-c:v',
|
||||
'libwebp',
|
||||
'-q:v',
|
||||
'80',
|
||||
`"${outputPattern}"`,
|
||||
outputPattern,
|
||||
]
|
||||
await execAsync(`ffmpeg -y ${args.join(' ')}`)
|
||||
await execFileAsync('ffmpeg', ['-y', ...args])
|
||||
|
||||
const files = fs.readdirSync(params.outputDir)
|
||||
return files
|
||||
@@ -429,6 +421,219 @@ export class TranscodeService {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
async takeScreenshots(params: {
|
||||
assetKey: string
|
||||
assetId: string
|
||||
start: number
|
||||
end: number
|
||||
count: number
|
||||
commentTimestamp?: number | null
|
||||
annotations?: PrismaJson.AnnotationList | null
|
||||
}): Promise<Array<{ key: string; timestamp: number }>> {
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
const tmpDir = this.createTempDir('screenshot-')
|
||||
const videoPath = path.join(tmpDir, path.basename(params.assetKey))
|
||||
|
||||
try {
|
||||
// 1. Download video
|
||||
await s3Service.downloadToFile(bucket, params.assetKey, videoPath)
|
||||
|
||||
// 2. Generate timestamps
|
||||
let timestamps: number[] = []
|
||||
if (params.count <= 1) {
|
||||
timestamps = [params.start]
|
||||
} else {
|
||||
const step = (params.end - params.start) / params.count
|
||||
timestamps = Array.from({ length: params.count }, (_, i) => params.start + i * step)
|
||||
}
|
||||
|
||||
// 3. Snap closest timestamp to commentTimestamp if within range
|
||||
const commentTimestamp = params.commentTimestamp
|
||||
if (commentTimestamp !== undefined && commentTimestamp !== null) {
|
||||
if (commentTimestamp >= params.start && commentTimestamp <= params.end) {
|
||||
let closestIdx = 0
|
||||
let minDiff = Math.abs(timestamps[0] - commentTimestamp)
|
||||
for (let i = 1; i < timestamps.length; i++) {
|
||||
const diff = Math.abs(timestamps[i] - commentTimestamp)
|
||||
if (diff < minDiff) {
|
||||
minDiff = diff
|
||||
closestIdx = i
|
||||
}
|
||||
}
|
||||
timestamps[closestIdx] = commentTimestamp
|
||||
}
|
||||
}
|
||||
|
||||
const results: Array<{ key: string; timestamp: number }> = []
|
||||
|
||||
// 4. Extract each screenshot
|
||||
for (const t of timestamps) {
|
||||
const outName = `shot-${t.toFixed(3)}-${ulid()}.webp`
|
||||
const localShotPath = path.join(tmpDir, outName)
|
||||
|
||||
const args = [
|
||||
'-ss',
|
||||
t.toFixed(3),
|
||||
'-i',
|
||||
videoPath,
|
||||
'-vframes',
|
||||
'1',
|
||||
'-vf',
|
||||
'scale=-2:720',
|
||||
'-c:v',
|
||||
'libwebp',
|
||||
'-q:v',
|
||||
'80',
|
||||
localShotPath,
|
||||
]
|
||||
await execFileAsync('ffmpeg', ['-y', ...args])
|
||||
|
||||
// 5. Overlay annotations if timestamp matches commentTimestamp exactly
|
||||
if (
|
||||
commentTimestamp !== undefined &&
|
||||
commentTimestamp !== null &&
|
||||
t === commentTimestamp &&
|
||||
params.annotations &&
|
||||
params.annotations.length > 0
|
||||
) {
|
||||
const meta = await sharp(localShotPath).metadata()
|
||||
const width = meta.width || 1280
|
||||
const height = meta.height || 720
|
||||
|
||||
const svgStr = renderAnnotationsToSvg(width, height, params.annotations)
|
||||
const tempCompositedPath = path.join(tmpDir, `composite-${outName}`)
|
||||
|
||||
await sharp(localShotPath)
|
||||
.composite([{ input: Buffer.from(svgStr), top: 0, left: 0 }])
|
||||
.toFile(tempCompositedPath)
|
||||
|
||||
fs.renameSync(tempCompositedPath, localShotPath)
|
||||
}
|
||||
|
||||
// 6. Upload to S3
|
||||
const s3Key = `file/${params.assetId}/screenshots/${outName}`
|
||||
const fileBuffer = fs.readFileSync(localShotPath)
|
||||
await s3Service.putObject(bucket, s3Key, fileBuffer, fileBuffer.length, 'image/webp')
|
||||
|
||||
results.push({ key: s3Key, timestamp: t })
|
||||
}
|
||||
|
||||
return results
|
||||
} finally {
|
||||
this.removeDir(tmpDir)
|
||||
}
|
||||
}
|
||||
|
||||
async overlayAnnotations(params: {
|
||||
assetKey: string
|
||||
assetId: string
|
||||
annotations: PrismaJson.AnnotationList
|
||||
}): Promise<string> {
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
const tmpDir = this.createTempDir('annotation-')
|
||||
const imgPath = path.join(tmpDir, path.basename(params.assetKey))
|
||||
|
||||
try {
|
||||
// 1. Download image
|
||||
await s3Service.downloadToFile(bucket, params.assetKey, imgPath)
|
||||
|
||||
// 2. Read dimensions
|
||||
const meta = await sharp(imgPath).metadata()
|
||||
const width = meta.width || 1920
|
||||
const height = meta.height || 1080
|
||||
|
||||
// 3. Render SVG
|
||||
const svgStr = renderAnnotationsToSvg(width, height, params.annotations)
|
||||
|
||||
// 4. Composite
|
||||
const outName = `annotation-${ulid()}.webp`
|
||||
const localOutPath = path.join(tmpDir, outName)
|
||||
|
||||
await sharp(imgPath)
|
||||
.composite([{ input: Buffer.from(svgStr), top: 0, left: 0 }])
|
||||
.webp({ quality: 90 })
|
||||
.toFile(localOutPath)
|
||||
|
||||
// 5. Upload to S3
|
||||
const s3Key = `file/${params.assetId}/annotations/${outName}`
|
||||
const fileBuffer = fs.readFileSync(localOutPath)
|
||||
await s3Service.putObject(bucket, s3Key, fileBuffer, fileBuffer.length, 'image/webp')
|
||||
|
||||
return s3Key
|
||||
} finally {
|
||||
this.removeDir(tmpDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderAnnotationsToSvg(
|
||||
width: number,
|
||||
height: number,
|
||||
annotations: PrismaJson.AnnotationList,
|
||||
): string {
|
||||
const strokeWidth = Math.max(2, Math.round(Math.max(width, height) * 0.004))
|
||||
const svgElements: string[] = []
|
||||
|
||||
for (const ann of annotations) {
|
||||
const color = ann.color || '#ff0000'
|
||||
const type = ann.type
|
||||
|
||||
switch (type) {
|
||||
case 'box': {
|
||||
if (ann.points.length < 2) continue
|
||||
const [start, end] = ann.points
|
||||
const x = Math.min(start[0], end[0]) * width
|
||||
const y = Math.min(start[1], end[1]) * height
|
||||
const boxWidth = Math.abs(end[0] - start[0]) * width
|
||||
const boxHeight = Math.abs(end[1] - start[1]) * height
|
||||
|
||||
svgElements.push(
|
||||
`<rect x="${x}" y="${y}" width="${boxWidth}" height="${boxHeight}" stroke="${color}" stroke-width="${strokeWidth}" fill="none" />`,
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'line':
|
||||
case 'freehand': {
|
||||
if (ann.points.length < 2) continue
|
||||
const pointsStr = ann.points.map(([px, py]) => `${px * width},${py * height}`).join(' ')
|
||||
svgElements.push(
|
||||
`<polyline points="${pointsStr}" stroke="${color}" stroke-width="${strokeWidth}" stroke-linecap="round" stroke-linejoin="round" fill="none" />`,
|
||||
)
|
||||
break
|
||||
}
|
||||
case 'arrow': {
|
||||
if (ann.points.length < 2) continue
|
||||
const pts = ann.points.map(([px, py]) => [px * width, py * height])
|
||||
const pointsStr = pts.map(([x, y]) => `${x},${y}`).join(' ')
|
||||
|
||||
svgElements.push(
|
||||
`<polyline points="${pointsStr}" stroke="${color}" stroke-width="${strokeWidth}" stroke-linecap="round" stroke-linejoin="round" fill="none" />`,
|
||||
)
|
||||
|
||||
const endPt = pts[pts.length - 1]
|
||||
const prevPt = pts[pts.length - 2]
|
||||
const dx = endPt[0] - prevPt[0]
|
||||
const dy = endPt[1] - prevPt[1]
|
||||
const angle = Math.atan2(dy, dx)
|
||||
|
||||
const pointerLength = Math.max(12, Math.max(width, height) * 0.015)
|
||||
const x1 = endPt[0] - pointerLength * Math.cos(angle - Math.PI / 6)
|
||||
const y1 = endPt[1] - pointerLength * Math.sin(angle - Math.PI / 6)
|
||||
const x2 = endPt[0] - pointerLength * Math.cos(angle + Math.PI / 6)
|
||||
const y2 = endPt[1] - pointerLength * Math.sin(angle + Math.PI / 6)
|
||||
|
||||
svgElements.push(
|
||||
`<polygon points="${endPt[0]},${endPt[1]} ${x1},${y1} ${x2},${y2}" fill="${color}" />`,
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return `<svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" xmlns="http://www.w3.org/2000/svg">${svgElements.join(
|
||||
'\n',
|
||||
)}</svg>`
|
||||
}
|
||||
|
||||
export const transcodeService = new TranscodeService()
|
||||
|
||||
@@ -37,6 +37,10 @@ describe('Transcode Workflow', () => {
|
||||
_activityName: 'downloadMediaToTmpActivity',
|
||||
}),
|
||||
cleanupTmpDirActivity: Object.assign(vi.fn(), { _activityName: 'cleanupTmpDirActivity' }),
|
||||
takeScreenshotsActivity: Object.assign(vi.fn(), { _activityName: 'takeScreenshotsActivity' }),
|
||||
overlayAnnotationsActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'overlayAnnotationsActivity',
|
||||
}),
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -234,4 +238,119 @@ describe('Transcode Workflow', () => {
|
||||
output: { error: 'FFmpeg failed' },
|
||||
})
|
||||
})
|
||||
|
||||
it('should run screenshot workflow successfully', async () => {
|
||||
const task: WorkflowTask = {
|
||||
id: 'task-screenshot',
|
||||
assetId: 'asset-video',
|
||||
type: WorkflowTaskType.transcode,
|
||||
status: WorkflowTaskStatus.pending,
|
||||
output: null,
|
||||
payload: {
|
||||
projectId: 'proj-1',
|
||||
screenshot: {
|
||||
start: 0,
|
||||
end: 10,
|
||||
count: 2,
|
||||
commentTimestamp: 5.0,
|
||||
annotations: [],
|
||||
},
|
||||
},
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
heartbeat: null,
|
||||
teamId: 'team-1',
|
||||
projectId: 'proj-1',
|
||||
uid: 'task-uid',
|
||||
model: null,
|
||||
inputTokens: 0,
|
||||
outputTokens: 0,
|
||||
}
|
||||
|
||||
mockActivities.getAssetActivity.mockResolvedValue({
|
||||
id: 'asset-video',
|
||||
storageKey: { key: 'video.mp4' },
|
||||
mediaType: 'video/mp4',
|
||||
})
|
||||
|
||||
mockActivities.takeScreenshotsActivity.mockResolvedValue([
|
||||
{ key: 'file/asset-video/screenshots/shot1.webp', timestamp: 0.0 },
|
||||
{ key: 'file/asset-video/screenshots/shot2.webp', timestamp: 5.0 },
|
||||
])
|
||||
|
||||
await transcodeMedia(task)
|
||||
|
||||
expect(mockActivities.takeScreenshotsActivity).toHaveBeenCalledWith({
|
||||
assetKey: 'video.mp4',
|
||||
assetId: 'asset-video',
|
||||
start: 0,
|
||||
end: 10,
|
||||
count: 2,
|
||||
commentTimestamp: 5.0,
|
||||
annotations: [],
|
||||
})
|
||||
|
||||
expect(mockActivities.updateTaskStatusActivity).toHaveBeenCalledWith({
|
||||
taskId: 'task-screenshot',
|
||||
status: WorkflowTaskStatus.completed,
|
||||
output: {
|
||||
screenshots: [
|
||||
{ key: 'file/asset-video/screenshots/shot1.webp', timestamp: 0.0 },
|
||||
{ key: 'file/asset-video/screenshots/shot2.webp', timestamp: 5.0 },
|
||||
],
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
it('should run image annotation overlay workflow successfully', async () => {
|
||||
const task: WorkflowTask = {
|
||||
id: 'task-image-ann',
|
||||
assetId: 'asset-image',
|
||||
type: WorkflowTaskType.transcode,
|
||||
status: WorkflowTaskStatus.pending,
|
||||
output: null,
|
||||
payload: {
|
||||
projectId: 'proj-1',
|
||||
imageAnnotation: {
|
||||
annotations: [{ type: 'box', color: '#ff0000', points: [] }],
|
||||
},
|
||||
},
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
heartbeat: null,
|
||||
teamId: 'team-1',
|
||||
projectId: 'proj-1',
|
||||
uid: 'task-uid',
|
||||
model: null,
|
||||
inputTokens: 0,
|
||||
outputTokens: 0,
|
||||
}
|
||||
|
||||
mockActivities.getAssetActivity.mockResolvedValue({
|
||||
id: 'asset-image',
|
||||
storageKey: { key: 'image.png' },
|
||||
mediaType: 'image/png',
|
||||
media: {
|
||||
imageTranscodes: [{ key: 'image-transcoded.webp' }],
|
||||
},
|
||||
})
|
||||
|
||||
mockActivities.overlayAnnotationsActivity.mockResolvedValue(
|
||||
'file/asset-image/annotations/ann1.webp',
|
||||
)
|
||||
|
||||
await transcodeMedia(task)
|
||||
|
||||
expect(mockActivities.overlayAnnotationsActivity).toHaveBeenCalledWith({
|
||||
assetKey: 'image-transcoded.webp',
|
||||
assetId: 'asset-image',
|
||||
annotations: [{ type: 'box', color: '#ff0000', points: [] }],
|
||||
})
|
||||
|
||||
expect(mockActivities.updateTaskStatusActivity).toHaveBeenCalledWith({
|
||||
taskId: 'task-image-ann',
|
||||
status: WorkflowTaskStatus.completed,
|
||||
output: { key: 'file/asset-image/annotations/ann1.webp' },
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -16,6 +16,8 @@ export async function transcodeMedia(task: WorkflowTask): Promise<void> {
|
||||
getTranscodeWorkerQueueActivity,
|
||||
downloadMediaToTmpActivity,
|
||||
cleanupTmpDirActivity,
|
||||
takeScreenshotsActivity,
|
||||
overlayAnnotationsActivity,
|
||||
} = getActivities()
|
||||
|
||||
let tmpDir: string | undefined
|
||||
@@ -31,6 +33,69 @@ export async function transcodeMedia(task: WorkflowTask): Promise<void> {
|
||||
status: 'processing',
|
||||
})
|
||||
|
||||
const payload = task.payload
|
||||
|
||||
if (payload?.screenshot) {
|
||||
const asset = await executeActivity(workerQueue, getAssetActivity, task.assetId)
|
||||
const key = asset?.storageKey?.key
|
||||
if (!asset || !key) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'Asset not found or has no key',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
const screenshots = await executeActivity(workerQueue, takeScreenshotsActivity, {
|
||||
assetKey: key,
|
||||
assetId: asset.id,
|
||||
start: payload.screenshot.start,
|
||||
end: payload.screenshot.end,
|
||||
count: payload.screenshot.count,
|
||||
commentTimestamp: payload.screenshot.commentTimestamp,
|
||||
annotations: payload.screenshot.annotations,
|
||||
})
|
||||
|
||||
// Update Task Status to completed with output
|
||||
await executeActivity(workerQueue, updateTaskStatusActivity, {
|
||||
taskId: task.id,
|
||||
status: 'completed',
|
||||
output: { screenshots },
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (payload?.imageAnnotation) {
|
||||
const asset = await executeActivity(workerQueue, getAssetActivity, task.assetId)
|
||||
let key = asset?.storageKey?.key
|
||||
if (asset?.media) {
|
||||
const mediaInfo = asset.media as unknown as PrismaJson.MediaInfo
|
||||
if (mediaInfo.imageTranscodes && mediaInfo.imageTranscodes.length > 0) {
|
||||
key = mediaInfo.imageTranscodes[0].key || key
|
||||
}
|
||||
}
|
||||
|
||||
if (!asset || !key) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'Asset not found or has no key',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
const keyWithOverlay = await executeActivity(workerQueue, overlayAnnotationsActivity, {
|
||||
assetKey: key,
|
||||
assetId: asset.id,
|
||||
annotations: payload.imageAnnotation.annotations,
|
||||
})
|
||||
|
||||
// Update Task Status to completed with output
|
||||
await executeActivity(workerQueue, updateTaskStatusActivity, {
|
||||
taskId: task.id,
|
||||
status: 'completed',
|
||||
output: { key: keyWithOverlay },
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await executeActivity(workerQueue, updateAssetStatusActivity, {
|
||||
assetId: task.assetId,
|
||||
status: 'processing',
|
||||
|
||||
Reference in New Issue
Block a user