mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 15:14:10 +00:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e81550a81 | ||
|
|
46bfb86c74 | ||
|
|
01c471f292 | ||
|
|
553269012c | ||
|
|
72a7f68c92 | ||
|
|
d3899d1257 | ||
|
|
e420f03b35 | ||
|
|
17ba2631c5 | ||
|
|
2505612dd8 | ||
|
|
bfeabb8244 | ||
|
|
e3fe5792b9 |
@@ -8,10 +8,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
|
||||
### Added
|
||||
|
||||
- **sessions**: See total tokens and estimated cost in the session logs footer, with a breakdown of input, output, and cached tokens.
|
||||
- **projects**: Middle-click or Command/Ctrl-click a project to open it in a new tab. Use **Open in new tab** in a file or folder's context menu to keep your current view open.
|
||||
- **video**: Update your local embedding server to v0.1.3 to generate video transcripts. Choose a language or detect it automatically, then open the transcript in the video player to switch languages, follow playback, search the text, jump to a segment, or edit its text.
|
||||
- **integrations**: Set and test an embedding server URL under **Team Settings → Integrations**. A URL set through environment variables appears read-only. Once the server is configured, enable the Transcript Agent to generate video transcripts and receive an internal comment if a job fails. The updated embedding and full Docker Compose files create and enable the agent automatically with a distinct avatar.
|
||||
|
||||
For an existing deployment, create and enable the Transcript Agent under **Team Settings → Agents**, or add this line to the Shumai service’s `environment` block in your Compose file.
|
||||
|
||||
```yaml
|
||||
ENABLE_TRANSCRIPTION_AGENT: 'true'
|
||||
```
|
||||
|
||||
### Fixed
|
||||
|
||||
- **storage**: Download HTML, SVG, and other unsupported preview formats when opened from local storage.
|
||||
|
||||
### Changed
|
||||
|
||||
- **provider**: Open a provider card to edit its settings, or use its refresh button to choose new models to add. Use Add Provider to set up a new provider.
|
||||
|
||||
## [0.7.2] - 2026-11-27
|
||||
|
||||
### Added
|
||||
|
||||
@@ -67,12 +67,16 @@ apps/web/e2e/
|
||||
| Owner changes a team member role in the members dialog and permissions update | `tests/team/change-member-role.spec.ts` |
|
||||
| Owner manages resource quotas in settings and resets usage from the dashboard | `tests/team/quotas-settings.spec.ts` |
|
||||
| Owner creates an API token that is shown once, listed by hint, and authenticates API calls | `tests/team/api-tokens.spec.ts` |
|
||||
| Session logs stay within the dialog and scroll through long messages and expanded records on desktop and narrow screens | `tests/team/agent-session-logs.spec.ts` |
|
||||
| Session logs scroll through long messages and expanded records with the usage footer pinned and the token breakdown available on desktop and narrow screens | `tests/team/agent-session-logs.spec.ts` |
|
||||
| Provider cards open the editor by click and keyboard, keep menu actions independent, and show a scrollable model preview on desktop and mobile | `tests/team/provider-model-refresh.spec.ts` |
|
||||
|
||||
### project
|
||||
| Test | File |
|
||||
|---|---|
|
||||
| Owner creates a project with a cover image | `tests/project/create-project.spec.ts` |
|
||||
| Owner opens project cards in new tabs with middle-click and modifier-click | `tests/project/open-in-new-tab.spec.ts` |
|
||||
| Owner opens a folder card and a file row in new tabs from the context menu | `tests/project/open-in-new-tab.spec.ts` |
|
||||
| Owner sees the transcript action only when available, generates a transcript from an archived video's context menu, sees progress in card and list metadata across a refresh, and reuses the project status across folders | `tests/project/generate-transcripts.spec.ts` |
|
||||
| Owner uploads a file or an unsupported file via the "Upload File" context menu action | `tests/project/upload-file.spec.ts` |
|
||||
| Owner deletes a file, finds it in recently deleted, and restores it | `tests/project/delete-restore.spec.ts` |
|
||||
| Owner deletes a folder and still sees its contents preview and countdown in recently deleted | `tests/project/delete-restore.spec.ts` |
|
||||
@@ -117,6 +121,8 @@ apps/web/e2e/
|
||||
| Upload a txt file, wait for transcode, and create a comment with draw | `tests/file/txt-draw-comment.spec.ts` |
|
||||
| Upload an image file, wait for transcode, and create a comment with draw | `tests/file/image-draw-comment.spec.ts` |
|
||||
| Upload a video file, wait for transcode, and create a comment with draw at a non-zero timestamp | `tests/file/video-draw-comment.spec.ts` |
|
||||
| Read and search saved video transcripts, resize the desktop panel, jump to a segment, verify smooth playback following and interruption, and check mobile and version-stack behavior | `tests/file/view-transcript.spec.ts` |
|
||||
| Edit video transcript text inline, verify playback pauses and timestamps survive a blank edit, retry a failed save, and check reviewer permissions | `tests/file/view-transcript.spec.ts` |
|
||||
| Upload an audio file, wait for transcode, and create a comment at a non-zero timestamp | `tests/file/audio-timestamp-comment.spec.ts` |
|
||||
| Create internal and public comments, verify internal comments are hidden on public share links | `tests/file/internal-comment-and-edit.spec.ts` |
|
||||
| Author edits comment text, switches to internal, removes timestamp, and updates attachments | `tests/file/internal-comment-and-edit.spec.ts` |
|
||||
|
||||
@@ -23,6 +23,7 @@ async function start() {
|
||||
process.env.NODE_ENV = 'development'
|
||||
process.env.SHUMAI_E2E = 'true'
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'false'
|
||||
process.env.ENABLE_TRANSCRIPTION_AGENT = 'false'
|
||||
|
||||
// Write variables to .env.e2e file so the teardown can load them
|
||||
const envContent = [
|
||||
|
||||
@@ -0,0 +1,472 @@
|
||||
import type { Locator } from '@playwright/test'
|
||||
import { expect, test } from '../../fixtures'
|
||||
import { seedProjectMember } from '../../helpers/team'
|
||||
|
||||
test.use({ fileOptions: { mediaType: 'video' } })
|
||||
|
||||
test('reads, searches and follows a saved transcript in the video player', async ({
|
||||
file,
|
||||
prisma,
|
||||
}) => {
|
||||
const { page, projectId, fileId } = file
|
||||
await page.setViewportSize({ width: 1280, height: 720 })
|
||||
await page.emulateMedia({ colorScheme: 'dark' })
|
||||
await expect
|
||||
.poll(() =>
|
||||
prisma.asset.findUnique({
|
||||
where: { id: fileId },
|
||||
select: { status: true, media: true },
|
||||
}),
|
||||
)
|
||||
.toMatchObject({ status: 'processed', media: { proxyType: 'video' } })
|
||||
|
||||
await prisma.assetTranscript.create({
|
||||
data: {
|
||||
assetId: fileId,
|
||||
language: 'en',
|
||||
model: 'whisper-tiny',
|
||||
workflowTaskId: 'english-test',
|
||||
segments: {
|
||||
create: [
|
||||
{ position: 0, startMs: 0, endMs: 180, text: 'Signal. signal.' },
|
||||
...Array.from({ length: 28 }, (_, index) => ({
|
||||
position: index + 1,
|
||||
startMs: 300 + index * 12,
|
||||
endMs: 312 + index * 12,
|
||||
text: `Intervening segment ${index + 1}`,
|
||||
})),
|
||||
{ position: 29, startMs: 720, endMs: 980, text: 'Final signal.' },
|
||||
{ position: 30, startMs: 995, endMs: 1000, text: 'Closing word.' },
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
await prisma.assetTranscript.create({
|
||||
data: {
|
||||
assetId: fileId,
|
||||
language: 'zh',
|
||||
model: 'whisper-tiny',
|
||||
workflowTaskId: 'chinese-test',
|
||||
segments: { create: { position: 0, startMs: 0, endMs: 700, text: '你好。' } },
|
||||
},
|
||||
})
|
||||
|
||||
await page.goto(`/projects/${projectId}/files/${fileId}`)
|
||||
const toggle = page.getByRole('button', { name: 'Show transcript' })
|
||||
const navigator = page.getByRole('link', { name: 'Preview', exact: true })
|
||||
await expect(navigator).toBeVisible()
|
||||
await toggle.click()
|
||||
const panel = page.getByRole('complementary', { name: 'Transcript' })
|
||||
const divider = page.getByRole('separator', { name: 'Resize transcript' })
|
||||
const first = panel.getByRole('button', { name: /Signal\. signal\./ })
|
||||
const last = panel.getByRole('button', { name: /Final signal\./ })
|
||||
const video = page.locator('video').first()
|
||||
const sync = panel.getByRole('button', { name: 'Sync to playback' })
|
||||
await expect(navigator).toBeHidden()
|
||||
await expect(panel).toHaveCSS('width', '384px')
|
||||
await expect(toggle).toHaveAttribute('aria-expanded', 'true')
|
||||
await expect(toggle).toHaveCSS('cursor', 'pointer')
|
||||
await expect(first).toHaveAttribute('aria-current', 'true')
|
||||
await expect(first.getByText('Signal. signal.', { exact: true })).toHaveCSS('font-weight', '700')
|
||||
await expect(first).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
|
||||
await expect(first).toContainText('00:00.000 – 00:00.180')
|
||||
|
||||
const dragDivider = async (handle: Locator, delta: number) => {
|
||||
const box = await handle.boundingBox()
|
||||
if (!box) throw new Error('Expected the divider to be visible')
|
||||
const x = box.x + box.width / 2
|
||||
const y = box.y + box.height / 2
|
||||
await page.mouse.move(x, y)
|
||||
await page.mouse.down()
|
||||
await page.mouse.move(x + delta, y, { steps: 8 })
|
||||
await page.mouse.up()
|
||||
}
|
||||
await dragDivider(divider, 256)
|
||||
await expect(panel).toHaveCSS('width', '576px')
|
||||
await dragDivider(divider, -384)
|
||||
await expect(panel).toHaveCSS('width', '256px')
|
||||
await divider.press('ArrowRight')
|
||||
await expect(divider).toHaveAttribute('aria-valuenow', '21')
|
||||
await divider.press('Home')
|
||||
await expect(panel).toHaveCSS('width', '256px')
|
||||
await dragDivider(divider, 128)
|
||||
await expect(panel).toHaveCSS('width', '384px')
|
||||
|
||||
const viewport = panel.locator('[data-slot=scroll-area-viewport]')
|
||||
const nearBottomId = await viewport.evaluate((element) => {
|
||||
const view = element.getBoundingClientRect()
|
||||
const nearBottom = Array.from(element.querySelectorAll('li[data-segment-id]')).find((row) => {
|
||||
const { top, bottom } = row.getBoundingClientRect()
|
||||
return top > view.top + view.height * 0.75 && bottom < view.bottom
|
||||
})
|
||||
return nearBottom?.getAttribute('data-segment-id')
|
||||
})
|
||||
if (!nearBottomId) throw new Error('Expected a visible segment in the bottom quarter')
|
||||
const nearBottom = panel
|
||||
.locator(`[data-segment-id="${nearBottomId}"]`)
|
||||
.getByRole('button', { name: /Intervening segment/ })
|
||||
await viewport.evaluate((element) => {
|
||||
let scrollSteps = 0
|
||||
const record = () => {
|
||||
element.setAttribute('data-test-scroll-steps', String(++scrollSteps))
|
||||
if (scrollSteps === 2) element.removeEventListener('scroll', record)
|
||||
}
|
||||
element.addEventListener('scroll', record)
|
||||
})
|
||||
await nearBottom.click()
|
||||
await expect(nearBottom).toHaveAttribute('aria-current', 'true')
|
||||
await expect
|
||||
.poll(() =>
|
||||
nearBottom.evaluate((element) => {
|
||||
const view = element.closest('[data-slot=scroll-area-viewport]')!.getBoundingClientRect()
|
||||
const row = element.getBoundingClientRect()
|
||||
return (row.top + row.height / 2 - view.top) / view.height
|
||||
}),
|
||||
)
|
||||
.toBeCloseTo(0.5, 1)
|
||||
await expect(viewport).toHaveAttribute('data-test-scroll-steps', '2')
|
||||
await expect(sync).toBeHidden()
|
||||
await page.emulateMedia({ reducedMotion: 'reduce' })
|
||||
await viewport.evaluate((element) => {
|
||||
let previousTop = element.scrollTop
|
||||
const record = () => {
|
||||
const top = element.scrollTop
|
||||
if (top < previousTop) {
|
||||
element.setAttribute('data-test-first-reverse-scroll-top', String(top))
|
||||
element.removeEventListener('scroll', record)
|
||||
}
|
||||
previousTop = top
|
||||
}
|
||||
element.addEventListener('scroll', record)
|
||||
})
|
||||
await video.evaluate((element) => {
|
||||
const media = element as HTMLVideoElement
|
||||
media.currentTime = 0
|
||||
})
|
||||
await expect(first).toHaveAttribute('aria-current', 'true')
|
||||
await expect(first).toBeInViewport()
|
||||
await expect(viewport).toHaveAttribute('data-test-first-reverse-scroll-top', '0')
|
||||
await page.emulateMedia({ reducedMotion: 'no-preference' })
|
||||
|
||||
await panel.getByRole('button', { name: 'Search transcript' }).click()
|
||||
const search = panel.getByRole('searchbox', { name: 'Search transcript' })
|
||||
await expect(search).toBeFocused()
|
||||
await search.fill('SIGNAL.')
|
||||
await expect(panel.getByText('1 / 3')).toBeVisible()
|
||||
const match = panel.locator('[data-current-match]')
|
||||
await expect(match).toHaveCSS('padding-left', '1px')
|
||||
await expect(match).toHaveCSS('padding-right', '1px')
|
||||
await panel.getByRole('button', { name: 'Next match' }).click()
|
||||
await expect(panel.getByText('2 / 3')).toBeVisible()
|
||||
await search.press('Enter')
|
||||
await expect(panel.getByText('3 / 3')).toBeVisible()
|
||||
await expect(last).toBeInViewport()
|
||||
await expect(first).toHaveAttribute('aria-current', 'true')
|
||||
await last.click()
|
||||
await expect(last).toHaveAttribute('aria-current', 'true')
|
||||
await expect
|
||||
.poll(() => video.evaluate((element) => (element as HTMLVideoElement).currentTime))
|
||||
.toBeCloseTo(0.72, 1)
|
||||
await expect(video).toHaveJSProperty('paused', true)
|
||||
await panel.getByRole('button', { name: 'Next match' }).click()
|
||||
await expect(panel.getByText('1 / 3')).toBeVisible()
|
||||
await panel.getByRole('button', { name: 'Previous match' }).click()
|
||||
await expect(panel.getByText('3 / 3')).toBeVisible()
|
||||
await search.fill('unmatched')
|
||||
await expect(panel.getByText('0 / 0')).toBeVisible()
|
||||
await search.press('Escape')
|
||||
await expect(search).toBeHidden()
|
||||
await sync.click()
|
||||
await expect(sync).toBeHidden()
|
||||
|
||||
await viewport.hover()
|
||||
await page.mouse.wheel(0, -2500)
|
||||
await expect(sync).toBeVisible()
|
||||
await expect(page.locator('html')).toHaveClass('dark')
|
||||
const background = await panel.evaluate((element) => getComputedStyle(element).backgroundColor)
|
||||
await expect(sync).toHaveCSS('background-color', background)
|
||||
await expect(sync.locator('svg')).toHaveCount(0)
|
||||
expect(
|
||||
await sync.evaluate(
|
||||
(element) =>
|
||||
parseFloat(getComputedStyle(element).borderTopLeftRadius) >= element.clientHeight / 2,
|
||||
),
|
||||
).toBe(true)
|
||||
await sync.hover()
|
||||
await expect(sync).not.toHaveCSS('background-color', background)
|
||||
await expect(sync).toHaveCSS('background-color', /^oklch\([^/]+\)$/)
|
||||
await expect(last).not.toBeInViewport()
|
||||
await expect(last).toHaveAttribute('aria-current', 'true')
|
||||
await viewport.evaluate((element) => {
|
||||
element.addEventListener(
|
||||
'scroll',
|
||||
() => {
|
||||
element.dispatchEvent(new WheelEvent('wheel', { bubbles: true, deltaY: -120 }))
|
||||
element.setAttribute('data-test-follow-interrupted', 'true')
|
||||
},
|
||||
{ once: true },
|
||||
)
|
||||
})
|
||||
await sync.click()
|
||||
await expect(viewport).toHaveAttribute('data-test-follow-interrupted', 'true')
|
||||
await expect(sync).toBeVisible()
|
||||
await expect(last).not.toBeInViewport()
|
||||
await sync.click()
|
||||
await expect(last).toBeInViewport()
|
||||
await expect(sync).toBeHidden()
|
||||
|
||||
await video.evaluate((element) => {
|
||||
const media = element as HTMLVideoElement
|
||||
media.currentTime = 0.22
|
||||
})
|
||||
await expect(panel.locator('[aria-current=true]')).toHaveCount(0)
|
||||
await video.evaluate((element) => {
|
||||
const media = element as HTMLVideoElement
|
||||
media.currentTime = 0
|
||||
})
|
||||
await expect(first).toHaveAttribute('aria-current', 'true')
|
||||
await expect(first).toBeInViewport()
|
||||
await video.evaluate(async (element) => {
|
||||
const media = element as HTMLVideoElement
|
||||
media.playbackRate = 0.5
|
||||
await media.play()
|
||||
})
|
||||
await expect(last).toBeInViewport()
|
||||
await expect(sync).toBeHidden()
|
||||
await expect(video).toHaveJSProperty('ended', true)
|
||||
await last.press('Enter')
|
||||
await expect(last).toHaveAttribute('aria-current', 'true')
|
||||
await expect(video).toHaveJSProperty('paused', true)
|
||||
|
||||
const closingWord = panel.getByRole('button', { name: /Closing word\./ })
|
||||
await closingWord.click()
|
||||
await expect
|
||||
.poll(() =>
|
||||
video.evaluate((element) => {
|
||||
const media = element as HTMLVideoElement
|
||||
return { seeking: media.seeking, timeMs: Math.round(media.currentTime * 1000) }
|
||||
}),
|
||||
)
|
||||
.toEqual({ seeking: false, timeMs: 995 })
|
||||
await expect(closingWord).toHaveAttribute('aria-current', 'true')
|
||||
await expect(video).toHaveJSProperty('paused', true)
|
||||
|
||||
await panel.getByRole('combobox', { name: 'Language' }).selectOption('zh')
|
||||
await expect(panel.getByText('你好。')).toBeVisible()
|
||||
await expect(last).toHaveCount(0)
|
||||
await dragDivider(divider, 64)
|
||||
await expect(panel).toHaveCSS('width', '448px')
|
||||
await panel.getByRole('button', { name: 'Close transcript' }).click()
|
||||
await expect(panel).toBeHidden()
|
||||
await expect(navigator).toBeVisible()
|
||||
await expect(toggle).toBeFocused()
|
||||
await toggle.click()
|
||||
await expect(panel).toHaveCSS('width', '448px')
|
||||
|
||||
const commentsDivider = page.locator('main [data-slot="resize-handle"]:not([role="separator"])')
|
||||
await dragDivider(commentsDivider, -200)
|
||||
await page.setViewportSize({ width: 840, height: 720 })
|
||||
await expect
|
||||
.poll(async () => Number(await divider.getAttribute('aria-valuemax')))
|
||||
.toBeLessThan(20)
|
||||
await divider.press('End')
|
||||
await page.setViewportSize({ width: 1280, height: 720 })
|
||||
await dragDivider(commentsDivider, 200)
|
||||
await expect(panel).toHaveCSS('width', '448px')
|
||||
|
||||
await panel.getByRole('button', { name: 'Close transcript' }).click()
|
||||
|
||||
await page.setViewportSize({ width: 390, height: 844 })
|
||||
const comments = page.getByTestId('mobile-bottom-sheet')
|
||||
await expect(comments).toBeVisible()
|
||||
await toggle.click()
|
||||
await expect(panel).toBeVisible()
|
||||
await expect(video).toBeVisible()
|
||||
await expect(comments).toBeHidden()
|
||||
await panel.getByRole('button', { name: 'Close transcript' }).click()
|
||||
await expect(comments).toBeVisible()
|
||||
})
|
||||
|
||||
test('edits segment text inline while preserving timestamps and reviewer access', async ({
|
||||
file,
|
||||
browser,
|
||||
prisma,
|
||||
}) => {
|
||||
const { page, context, teamId, projectId, fileId } = file
|
||||
await expect
|
||||
.poll(async () => (await prisma.asset.findUnique({ where: { id: fileId } }))?.status)
|
||||
.toBe('processed')
|
||||
const transcript = await prisma.assetTranscript.create({
|
||||
data: {
|
||||
assetId: fileId,
|
||||
language: 'en',
|
||||
model: 'whisper-tiny',
|
||||
workflowTaskId: 'edit-transcript-test',
|
||||
segments: { create: { position: 0, startMs: 125, endMs: 950, text: 'Original text' } },
|
||||
},
|
||||
include: { segments: true },
|
||||
})
|
||||
const [segment] = transcript.segments
|
||||
const url = `/projects/${projectId}/files/${fileId}`
|
||||
const editPath = `/api/files/${fileId}/transcripts/en/segments/${segment.id}`
|
||||
const timestamps = '00:00.125 – 00:00.950'
|
||||
|
||||
await page.goto(url)
|
||||
const toggle = page.getByRole('button', { name: 'Show transcript' })
|
||||
await toggle.click()
|
||||
const panel = page.getByRole('complementary', { name: 'Transcript' })
|
||||
const row = panel.getByRole('listitem')
|
||||
const seek = row.getByRole('button', { name: /Original text/ })
|
||||
const edit = row.getByRole('button', { name: 'Edit segment text' })
|
||||
const draft = row.getByRole('textbox', { name: 'Edit segment text' })
|
||||
const video = page.locator('video').first()
|
||||
|
||||
await expect(edit).toHaveCSS('opacity', '0')
|
||||
await seek.hover()
|
||||
await expect(edit).toHaveCSS('opacity', '1')
|
||||
const highlight = await seek.evaluate((element) => getComputedStyle(element).backgroundColor)
|
||||
expect(highlight).not.toBe('rgba(0, 0, 0, 0)')
|
||||
await edit.hover()
|
||||
await expect(seek).toHaveCSS('background-color', highlight)
|
||||
await video.evaluate(async (element) => {
|
||||
const media = element as HTMLVideoElement
|
||||
media.loop = true
|
||||
await media.play()
|
||||
})
|
||||
await expect(video).toHaveJSProperty('paused', false)
|
||||
await edit.click()
|
||||
await expect(video).toHaveJSProperty('paused', true)
|
||||
await expect(draft).toBeFocused()
|
||||
await expect(draft).toHaveValue('Original text')
|
||||
await expect(row.getByText(timestamps)).toBeVisible()
|
||||
await draft.fill('Discard this draft')
|
||||
await draft.press('Escape')
|
||||
await expect(edit).toBeFocused()
|
||||
await expect(row.getByText('Original text')).toBeVisible()
|
||||
|
||||
await panel.getByRole('button', { name: 'Search transcript' }).click()
|
||||
await panel.getByRole('searchbox').fill('corrected')
|
||||
await expect(panel.getByText('0 / 0')).toBeVisible()
|
||||
|
||||
await edit.click()
|
||||
await draft.fill('Corrected text')
|
||||
await page.route(`**${editPath}`, (route) => route.fulfill({ status: 503 }), { times: 1 })
|
||||
await row.getByRole('button', { name: 'Save', exact: true }).click()
|
||||
await expect(row.getByRole('alert')).toHaveText('Could not save this segment.')
|
||||
await expect(draft).toHaveValue('Corrected text')
|
||||
await row.getByRole('button', { name: 'Save', exact: true }).click()
|
||||
await expect(row.getByRole('button', { name: /Corrected text/ })).toBeVisible()
|
||||
await expect(panel.getByText('1 / 1')).toBeVisible()
|
||||
await expect(video).toHaveJSProperty('paused', true)
|
||||
|
||||
const reviewer = await seedProjectMember(
|
||||
prisma,
|
||||
teamId,
|
||||
projectId,
|
||||
'reviewer',
|
||||
'project',
|
||||
browser,
|
||||
context,
|
||||
)
|
||||
const reviewerContext = reviewer.context!
|
||||
try {
|
||||
const reviewerPage = await reviewerContext.newPage()
|
||||
await reviewerPage.goto(url)
|
||||
await reviewerPage.getByRole('button', { name: 'Show transcript' }).click()
|
||||
const reviewerPanel = reviewerPage.getByRole('complementary', { name: 'Transcript' })
|
||||
await expect(reviewerPanel.getByText('Corrected text')).toBeVisible()
|
||||
await expect(reviewerPanel.getByRole('button', { name: 'Edit segment text' })).toHaveCount(0)
|
||||
const response = await reviewerContext.request.patch(editPath, { data: { text: 'Denied' } })
|
||||
expect(response.status()).toBe(403)
|
||||
} finally {
|
||||
await reviewerContext.close()
|
||||
}
|
||||
|
||||
await edit.click()
|
||||
await expect(draft).toHaveValue('Corrected text')
|
||||
await draft.fill('')
|
||||
await row.getByRole('button', { name: 'Save', exact: true }).click()
|
||||
await expect(panel.getByText('0 / 0')).toBeVisible()
|
||||
await page.reload()
|
||||
await toggle.click()
|
||||
await expect(row.getByRole('button', { name: timestamps })).toBeVisible()
|
||||
await edit.click()
|
||||
await expect(draft).toHaveValue('')
|
||||
await row.getByRole('button', { name: 'Cancel' }).click()
|
||||
await expect(row.getByRole('button', { name: timestamps })).toBeVisible()
|
||||
expect(await prisma.assetTranscriptSegment.findUnique({ where: { id: segment.id } })).toEqual({
|
||||
...segment,
|
||||
text: '',
|
||||
})
|
||||
})
|
||||
|
||||
test('uses the displayed video version and hides the toggle for versions without a transcript', async ({
|
||||
file,
|
||||
prisma,
|
||||
}) => {
|
||||
const { page, projectId, fileId, rootFolderId } = file
|
||||
await expect
|
||||
.poll(() =>
|
||||
prisma.asset.findUnique({
|
||||
where: { id: fileId },
|
||||
select: { status: true, media: true },
|
||||
}),
|
||||
)
|
||||
.toMatchObject({ status: 'processed', media: { proxyType: 'video' } })
|
||||
const latest = await prisma.asset.findUniqueOrThrow({ where: { id: fileId } })
|
||||
if (!latest.media) throw new Error('Expected processed video media')
|
||||
const stack = await prisma.asset.create({
|
||||
data: {
|
||||
projectId,
|
||||
parentId: rootFolderId,
|
||||
name: latest.name,
|
||||
type: 'version_stack',
|
||||
status: 'processed',
|
||||
fileCount: 2,
|
||||
},
|
||||
})
|
||||
await prisma.asset.update({
|
||||
where: { id: fileId },
|
||||
data: { parentId: stack.id, sortIndex: 'a0' },
|
||||
})
|
||||
const old = await prisma.asset.create({
|
||||
data: {
|
||||
projectId,
|
||||
parentId: stack.id,
|
||||
name: 'Earlier video.mp4',
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
mediaType: latest.mediaType,
|
||||
storageKeyId: latest.storageKeyId,
|
||||
media: latest.media,
|
||||
sizeByte: latest.sizeByte,
|
||||
sortIndex: 'a1',
|
||||
},
|
||||
})
|
||||
await prisma.assetTranscript.create({
|
||||
data: {
|
||||
assetId: fileId,
|
||||
language: 'en',
|
||||
model: 'whisper-tiny',
|
||||
workflowTaskId: 'latest-version-test',
|
||||
segments: {
|
||||
create: { position: 0, startMs: 0, endMs: 950, text: 'Latest version text' },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const stackUrl = `/projects/${projectId}/files/${stack.id}`
|
||||
await page.goto(stackUrl)
|
||||
const toggle = page.getByRole('button', { name: 'Show transcript' })
|
||||
await toggle.click()
|
||||
const panel = page.getByRole('complementary', { name: 'Transcript' })
|
||||
await expect(panel.getByText('Latest version text')).toBeVisible()
|
||||
|
||||
const [languages] = await Promise.all([
|
||||
page.waitForResponse(`**/api/files/${old.id}/transcripts`),
|
||||
page.goto(`${stackUrl}?version=${old.id}`),
|
||||
])
|
||||
expect(await languages.json()).toEqual({ languages: [] })
|
||||
await expect(panel).toBeHidden()
|
||||
await expect(toggle).toBeHidden()
|
||||
})
|
||||
@@ -0,0 +1,131 @@
|
||||
import { expect, test } from '../../fixtures'
|
||||
import { seedFolder } from '../../helpers/assets'
|
||||
import { fileCard } from '../../helpers/files'
|
||||
|
||||
test.use({ fileOptions: { mediaType: 'video' } })
|
||||
|
||||
test('starts a transcript for an archived video and tracks it in the file metadata', async ({
|
||||
file,
|
||||
prisma,
|
||||
}) => {
|
||||
const { page, projectId, rootFolderId, fileId, fileName } = file
|
||||
const projectPath = `/projects/${projectId}`
|
||||
const statusPath = `/api${projectPath}/transcription-status`
|
||||
const folder = await seedFolder(prisma, projectId, rootFolderId, 'Other folder')
|
||||
const expectedLanguages = ['zh', 'en']
|
||||
let submissions = 0
|
||||
let rejectSubmission = true
|
||||
let statusRequests = 0
|
||||
let transcriptionEnabled = false
|
||||
page.on('request', (request) => {
|
||||
if (new URL(request.url()).pathname === statusPath) {
|
||||
expect(request.method()).toBe('GET')
|
||||
expect(request.postData()).toBeNull()
|
||||
statusRequests++
|
||||
}
|
||||
})
|
||||
await page.route('**/api/signup-info', async (route) => {
|
||||
const response = await route.fetch()
|
||||
await route.fulfill({ json: { ...(await response.json()), transcriptionEnabled } })
|
||||
})
|
||||
await page.route('**/api/transcription/languages', (route) =>
|
||||
route.fulfill({
|
||||
json: {
|
||||
model: 'whisper-tiny',
|
||||
languages: [
|
||||
{ code: 'en', name: 'English' },
|
||||
{ code: 'zh', name: 'Chinese' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
)
|
||||
await page.route(`**/api/files/${fileId}/transcripts`, async (route) => {
|
||||
expect(route.request().postDataJSON()).toEqual({ language: expectedLanguages[submissions] })
|
||||
if (rejectSubmission) {
|
||||
rejectSubmission = false
|
||||
await route.fulfill({ status: 503 })
|
||||
return
|
||||
}
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: { projectId, assetId: fileId, type: 'ai_transcription', status: 'processing' },
|
||||
})
|
||||
submissions++
|
||||
await route.fulfill({ status: 202, json: { kind: 'queued', taskId: task.id } })
|
||||
})
|
||||
|
||||
await expect
|
||||
.poll(() =>
|
||||
prisma.asset.findUnique({
|
||||
where: { id: fileId },
|
||||
select: { status: true, media: true },
|
||||
}),
|
||||
)
|
||||
.toMatchObject({ status: 'processed', media: { proxyType: 'video' } })
|
||||
await prisma.asset.update({ where: { id: fileId }, data: { status: 'processing' } })
|
||||
await page.goto(projectPath)
|
||||
const action = page.getByRole('menuitem', { name: 'Generate Transcripts' })
|
||||
await fileCard(page, fileName).click({ button: 'right' })
|
||||
await expect(page.getByRole('menu')).toBeVisible()
|
||||
await expect(action).toHaveCount(0)
|
||||
transcriptionEnabled = true
|
||||
const [signupInfo] = await Promise.all([
|
||||
page.waitForResponse('**/api/signup-info'),
|
||||
page.goto(projectPath),
|
||||
])
|
||||
expect(await signupInfo.json()).toMatchObject({ transcriptionEnabled: true })
|
||||
await fileCard(page, fileName).click({ button: 'right' })
|
||||
await expect(action).toBeDisabled()
|
||||
await prisma.asset.update({ where: { id: fileId }, data: { status: 'archived' } })
|
||||
const [idleStatus] = await Promise.all([page.waitForResponse(`**${statusPath}`), page.reload()])
|
||||
expect(await idleStatus.json()).toEqual({ assetIds: [] })
|
||||
const idleRequests = statusRequests
|
||||
await fileCard(page, folder.name).dblclick()
|
||||
await expect(page).toHaveURL(`${projectPath}/folders/${folder.id}`)
|
||||
await page.goBack()
|
||||
await expect(fileCard(page, fileName)).toBeVisible()
|
||||
expect(statusRequests).toBe(idleRequests)
|
||||
const openDialog = async () => {
|
||||
await fileCard(page, fileName).click({ button: 'right' })
|
||||
await action.click()
|
||||
}
|
||||
await openDialog()
|
||||
const dialog = page.getByRole('dialog', { name: 'Generate Transcripts' })
|
||||
const language = dialog.getByRole('combobox', { name: 'Language' })
|
||||
const generate = dialog.getByRole('button', { name: 'Generate', exact: true })
|
||||
const metadata = fileCard(page, fileName).getByTestId('file-card-metadata')
|
||||
await expect(language).toHaveValue('Auto')
|
||||
await language.fill('Chi')
|
||||
await dialog.getByRole('option', { name: 'Chinese' }).click()
|
||||
await expect(language).toHaveValue('Chinese')
|
||||
await generate.click()
|
||||
await expect(dialog.getByRole('alert')).toBeVisible()
|
||||
await expect(language).toHaveValue('Chinese')
|
||||
await generate.click()
|
||||
await expect(dialog).toBeHidden()
|
||||
await expect(metadata).toHaveText('Transcribing…')
|
||||
|
||||
await page.reload()
|
||||
await expect(metadata).toHaveText('Transcribing…')
|
||||
await page.getByRole('button', { name: 'List View' }).click()
|
||||
const dateCell = fileCard(page, fileName).getByTestId('file-list-item-date')
|
||||
await expect(dateCell).toHaveText('Transcribing…')
|
||||
const activeTranscript = {
|
||||
assetId: fileId,
|
||||
type: 'ai_transcription',
|
||||
status: 'processing',
|
||||
} as const
|
||||
await prisma.workflowTask.updateMany({ where: activeTranscript, data: { status: 'completed' } })
|
||||
await expect(dateCell).toHaveText(/\d/)
|
||||
const modifiedDate = await dateCell.innerText()
|
||||
|
||||
await openDialog()
|
||||
await expect(generate).toBeEnabled()
|
||||
await language.fill('Eng')
|
||||
await dialog.getByRole('option', { name: 'English' }).click()
|
||||
await generate.click()
|
||||
await expect(dialog).toBeHidden()
|
||||
await expect(dateCell).toHaveText('Transcribing…')
|
||||
await prisma.workflowTask.updateMany({ where: activeTranscript, data: { status: 'failed' } })
|
||||
await expect(dateCell).toHaveText(modifiedDate)
|
||||
await expect(page.getByText('Transcript generation failed.', { exact: true })).toHaveCount(0)
|
||||
})
|
||||
@@ -0,0 +1,68 @@
|
||||
import { expect, test } from '../../fixtures'
|
||||
import { seedFolder } from '../../helpers/assets'
|
||||
import { fileCard } from '../../helpers/files'
|
||||
|
||||
test('project cards open in a new tab with middle-click and modifier-click', async ({
|
||||
project,
|
||||
}) => {
|
||||
const { page, context, teamId, projectId, projectName } = project
|
||||
await page.reload()
|
||||
const projectLink = page.getByRole('link', { name: projectName, exact: true })
|
||||
|
||||
const [middleClickTab] = await Promise.all([
|
||||
context.waitForEvent('page'),
|
||||
projectLink.click({ button: 'middle' }),
|
||||
])
|
||||
await expect(middleClickTab).toHaveURL(`/projects/${projectId}`)
|
||||
await expect(page).toHaveURL(`/teams/${teamId}`)
|
||||
await middleClickTab.close()
|
||||
|
||||
const [modifierClickTab] = await Promise.all([
|
||||
context.waitForEvent('page'),
|
||||
projectLink.click({ modifiers: ['ControlOrMeta'] }),
|
||||
])
|
||||
await expect(modifierClickTab).toHaveURL(`/projects/${projectId}`)
|
||||
await expect(page).toHaveURL(`/teams/${teamId}`)
|
||||
await modifierClickTab.close()
|
||||
|
||||
await page.getByRole('button', { name: 'More options' }).click()
|
||||
await expect(page.getByRole('menuitem', { name: 'Project Settings' })).toBeVisible()
|
||||
await expect(page).toHaveURL(`/teams/${teamId}`)
|
||||
await page.keyboard.press('Escape')
|
||||
|
||||
await projectLink.click()
|
||||
await expect(page).toHaveURL(`/projects/${projectId}`)
|
||||
})
|
||||
|
||||
test('the context menu opens a folder card and a file row in new tabs', async ({
|
||||
file,
|
||||
prisma,
|
||||
}) => {
|
||||
const { page, context, projectId, rootFolderId, fileId, fileName } = file
|
||||
const projectPath = `/projects/${projectId}`
|
||||
const folder = await seedFolder(prisma, projectId, rootFolderId, 'Test folder')
|
||||
await page.goto(projectPath)
|
||||
|
||||
const openInNewTab = page.getByRole('menuitem', { name: 'Open in new tab' })
|
||||
await fileCard(page, folder.name).click({ button: 'right' })
|
||||
await expect(openInNewTab).toBeVisible()
|
||||
expect(context.pages()).toHaveLength(1)
|
||||
const [folderTab] = await Promise.all([context.waitForEvent('page'), openInNewTab.click()])
|
||||
await expect(folderTab).toHaveURL(`${projectPath}/folders/${folder.id}`)
|
||||
await expect(page).toHaveURL(projectPath)
|
||||
await folderTab.close()
|
||||
|
||||
await page.getByRole('button', { name: 'List View' }).click()
|
||||
const fileRow = fileCard(page, fileName)
|
||||
const fileLabel = fileRow.getByText(fileName, { exact: true })
|
||||
const selected = fileRow.getByRole('checkbox')
|
||||
await fileLabel.click()
|
||||
await expect(selected).toBeChecked()
|
||||
await expect(page).toHaveURL(projectPath)
|
||||
|
||||
await fileLabel.click({ button: 'right' })
|
||||
const [fileTab] = await Promise.all([context.waitForEvent('page'), openInNewTab.press('Enter')])
|
||||
await expect(fileTab).toHaveURL(`${projectPath}/files/${fileId}`)
|
||||
await expect(page).toHaveURL(projectPath)
|
||||
await expect(selected).toBeChecked()
|
||||
})
|
||||
@@ -1,6 +1,6 @@
|
||||
import { expect, test } from '../../fixtures'
|
||||
|
||||
test('session logs stay within the dialog and scroll through long messages and expanded records', async ({
|
||||
test('session logs scroll with usage pinned below long messages and expanded records', async ({
|
||||
owner,
|
||||
prisma,
|
||||
}) => {
|
||||
@@ -25,6 +25,13 @@ test('session logs stay within the dialog and scroll through long messages and e
|
||||
type: 'chat',
|
||||
name: 'Scrollable Session Logs',
|
||||
cwd: '/test',
|
||||
accountedUsage: {
|
||||
inputTokens: 12800,
|
||||
outputTokens: 1580,
|
||||
cacheReadTokens: 10000,
|
||||
totalTokens: 24380,
|
||||
cost: 0.014,
|
||||
},
|
||||
},
|
||||
})
|
||||
await prisma.agentSessionCommit.create({
|
||||
@@ -64,6 +71,10 @@ test('session logs stay within the dialog and scroll through long messages and e
|
||||
await expect(dialog.getByText(/^(Entry ID|条目 ID):/)).toHaveCount(0)
|
||||
const viewport = dialog.locator('[data-slot="scroll-area-viewport"]')
|
||||
const heading = dialog.getByRole('heading')
|
||||
const footer = dialog.locator('footer')
|
||||
const breakdown = footer.getByRole('button', { name: /^(Breakdown|明细|상세 내역)$/ })
|
||||
await expect(footer).toContainText('24,380')
|
||||
await expect(footer).toContainText('$0.014')
|
||||
|
||||
for (const size of [
|
||||
{ width: 1280, height: 800 },
|
||||
@@ -97,6 +108,7 @@ test('session logs stay within the dialog and scroll through long messages and e
|
||||
)
|
||||
.toBe(true)
|
||||
const headerTop = (await heading.boundingBox())!.y
|
||||
const footerTop = (await footer.boundingBox())!.y
|
||||
await viewport.evaluate((element) => {
|
||||
element.scrollTop = 0
|
||||
})
|
||||
@@ -110,6 +122,26 @@ test('session logs stay within the dialog and scroll through long messages and e
|
||||
})
|
||||
await expect(record.locator('summary')).toBeInViewport()
|
||||
expect((await heading.boundingBox())!.y).toBeCloseTo(headerTop, 0)
|
||||
expect((await footer.boundingBox())!.y).toBeCloseTo(footerTop, 0)
|
||||
await expect(footer).toBeInViewport()
|
||||
|
||||
await breakdown.click()
|
||||
const popover = page.getByRole('dialog', {
|
||||
name: /Token breakdown|Token 用量明细|토큰 사용량 상세 내역/,
|
||||
})
|
||||
await expect(popover).toBeVisible()
|
||||
for (const count of ['12,800', '1,580', '10,000']) {
|
||||
await expect(popover.getByText(count, { exact: true })).toBeVisible()
|
||||
}
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const bounds = await popover.boundingBox()
|
||||
return bounds ? bounds.y + bounds.height : Infinity
|
||||
})
|
||||
.toBeLessThan(footerTop + 1)
|
||||
await page.keyboard.press('Escape')
|
||||
await expect(popover).toBeHidden()
|
||||
await expect(breakdown).toBeFocused()
|
||||
|
||||
await record.locator('summary').click()
|
||||
await viewport.evaluate((element) => {
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
import type { RefreshedProviderModel } from '@shumai/dtos'
|
||||
import { expect, test } from '../../fixtures'
|
||||
|
||||
test('provider cards open the edit dialog and keep their refresh and menu actions independent', async ({
|
||||
owner,
|
||||
prisma,
|
||||
}) => {
|
||||
const { page, teamId } = owner
|
||||
const provider = await prisma.provider.create({
|
||||
data: {
|
||||
teamId,
|
||||
name: 'OpenAI production',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
baseUrl: 'https://api.openai.com/v1',
|
||||
apiKey: 'saved-test-key',
|
||||
},
|
||||
},
|
||||
})
|
||||
const missing = await prisma.provider.create({
|
||||
data: {
|
||||
teamId,
|
||||
name: 'Anthropic staging',
|
||||
config: {
|
||||
api: 'anthropic-messages',
|
||||
baseUrl: 'https://api.anthropic.com',
|
||||
apiKey: 'UNSET_E2E_ANTHROPIC_KEY',
|
||||
},
|
||||
},
|
||||
})
|
||||
const models = Array.from({ length: 48 }, (_, index): RefreshedProviderModel => ({
|
||||
modelId: `test-model-${index + 1}`,
|
||||
name: `Test Model ${index + 1}`,
|
||||
config: {
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
}))
|
||||
|
||||
const releasePreview = Promise.withResolvers<void>()
|
||||
await page.route(
|
||||
`**/api/teams/${teamId}/providers/${provider.id}/models/refresh`,
|
||||
async (route) => {
|
||||
await releasePreview.promise
|
||||
await route.fulfill({
|
||||
json: { status: 'ready', providerUpdatedAt: provider.updatedAt.toISOString(), models },
|
||||
})
|
||||
},
|
||||
)
|
||||
await page.goto(`/teams/${teamId}/settings#providers`)
|
||||
|
||||
const cards = page.locator('main [data-slot="card"]')
|
||||
const openai = cards.filter({ hasText: provider.name })
|
||||
const anthropic = cards.filter({ hasText: missing.name })
|
||||
const refresh = openai.getByRole('button', { name: /Refresh models for OpenAI production/ })
|
||||
const edit = openai.getByRole('button', { name: `Edit ${provider.name}` })
|
||||
const editDialog = page.getByRole('dialog', { name: `Edit ${provider.name}` })
|
||||
const options = openai.getByRole('button', { name: `Options for ${provider.name}` })
|
||||
await expect(cards.first()).toContainText(provider.name)
|
||||
await expect(openai.getByText('Configured', { exact: true })).toBeVisible()
|
||||
await expect(anthropic.getByText('Configured', { exact: true })).toHaveCount(0)
|
||||
await expect(anthropic.getByRole('button', { name: /Refresh models/ })).toBeEnabled()
|
||||
await expect(refresh).toHaveText('')
|
||||
|
||||
await openai.click({ position: { x: 8, y: 30 } })
|
||||
await expect(editDialog).toBeVisible()
|
||||
await page.keyboard.press('Escape')
|
||||
await expect(editDialog).toBeHidden()
|
||||
await expect(edit).toBeFocused()
|
||||
|
||||
await edit.press('Enter')
|
||||
await expect(editDialog).toBeVisible()
|
||||
await page.keyboard.press('Escape')
|
||||
await expect(editDialog).toBeHidden()
|
||||
|
||||
await options.click()
|
||||
await expect(editDialog).toBeHidden()
|
||||
await page.getByRole('menuitem', { name: 'Edit', exact: true }).click()
|
||||
await expect(editDialog).toBeVisible()
|
||||
await page.keyboard.press('Escape')
|
||||
await expect(editDialog).toBeHidden()
|
||||
await expect(options).toBeFocused()
|
||||
|
||||
await options.click()
|
||||
await page.getByRole('menuitem', { name: 'Delete', exact: true }).click()
|
||||
const confirmDelete = page.getByRole('alertdialog')
|
||||
await expect(confirmDelete).toContainText(provider.name)
|
||||
await expect(editDialog).toBeHidden()
|
||||
await confirmDelete.getByRole('button', { name: 'Cancel' }).click()
|
||||
|
||||
await refresh.click()
|
||||
await expect(refresh).toHaveAttribute('aria-busy', 'true')
|
||||
await expect(editDialog).toBeHidden()
|
||||
await expect(anthropic.getByRole('button', { name: /Refresh models/ })).toHaveAttribute(
|
||||
'aria-busy',
|
||||
'false',
|
||||
)
|
||||
releasePreview.resolve()
|
||||
|
||||
const dialog = page.getByRole('dialog', { name: 'New models for OpenAI production' })
|
||||
await expect(dialog).toBeVisible()
|
||||
await expect(dialog.getByRole('checkbox', { name: 'Test Model 1 test-model-1' })).toBeVisible()
|
||||
|
||||
for (const viewport of [
|
||||
{ width: 1280, height: 800 },
|
||||
{ width: 390, height: 640 },
|
||||
]) {
|
||||
await page.setViewportSize(viewport)
|
||||
await expect
|
||||
.poll(() =>
|
||||
dialog.locator('[data-slot="scroll-area-viewport"]').evaluate((element) => {
|
||||
const scrollAreaBounds = element.getBoundingClientRect()
|
||||
const dialogBounds = element.closest('[role="dialog"]')?.getBoundingClientRect()
|
||||
return (
|
||||
dialogBounds !== undefined &&
|
||||
dialogBounds.left >= 0 &&
|
||||
dialogBounds.right <= window.innerWidth &&
|
||||
dialogBounds.top >= 0 &&
|
||||
dialogBounds.bottom <= window.innerHeight &&
|
||||
scrollAreaBounds.bottom < dialogBounds.bottom &&
|
||||
element.scrollHeight > element.clientHeight
|
||||
)
|
||||
}),
|
||||
)
|
||||
.toBe(true)
|
||||
}
|
||||
|
||||
await dialog.getByRole('button', { name: 'Cancel' }).click()
|
||||
await expect(dialog).toBeHidden()
|
||||
await expect(refresh).toBeFocused()
|
||||
})
|
||||
@@ -99,7 +99,7 @@ async function run() {
|
||||
// Start services
|
||||
await metadataService.syncSystemFields().catch(console.error)
|
||||
await migrateLegacyAgentAvatars().catch(console.error)
|
||||
await agentService.ensureSystemEmbeddingAgents().catch(console.error)
|
||||
await agentService.ensureSystemAgents().catch(console.error)
|
||||
assetService.startCleanupJob()
|
||||
notificationJobService.start()
|
||||
autoArchiveJobService.start()
|
||||
|
||||
@@ -147,9 +147,9 @@
|
||||
"name": "@shumai/agent",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@earendil-works/chord": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/chord": "1.7.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
@@ -172,7 +172,7 @@
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@better-auth/mcp": "1.7.12",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@hono/zod-validator": "0.7.6",
|
||||
"@modelcontextprotocol/server": "2.0.0",
|
||||
"@shumai/core": "workspace:*",
|
||||
@@ -214,9 +214,9 @@
|
||||
"@aws-sdk/s3-request-presigner": "3.1121.0",
|
||||
"@better-auth/mcp": "1.7.12",
|
||||
"@better-auth/oauth-provider": "1.7.12",
|
||||
"@earendil-works/chord": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/chord": "1.7.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@modelcontextprotocol/client": "2.0.0",
|
||||
"@shumai/db": "workspace:*",
|
||||
@@ -271,8 +271,8 @@
|
||||
"name": "@shumai/dtos",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"zod": "4.5.4",
|
||||
},
|
||||
},
|
||||
@@ -280,8 +280,8 @@
|
||||
"name": "@shumai/e2e",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@shumai/agent": "workspace:*",
|
||||
"@shumai/core": "workspace:*",
|
||||
@@ -323,8 +323,8 @@
|
||||
"@dnd-kit/abstract": "0.5.0",
|
||||
"@dnd-kit/dom": "0.5.0",
|
||||
"@dnd-kit/react": "0.5.0",
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@ferrucc-io/emoji-picker": "0.1.2",
|
||||
"@hookform/resolvers": "5.9.1",
|
||||
"@lexical/code": "0.49.0",
|
||||
@@ -496,21 +496,21 @@
|
||||
|
||||
"@aws-sdk/core": ["@aws-sdk/core@3.977.9", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@aws-sdk/xml-builder": "^3.972.40", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.33.3", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.17.2", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-reqPFEQrZxDZpeGj4PFMepBeR5LGYHRqq/L0motTzgFkCRBA4rFdaVXDSLYyGHhxVz7sT2PDnPN9CluGSfgyJA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.70", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-H404B7dJl2mCrBqahDEYsanB0xhdDp6tXnXcTUnXmmpy2Q3J0Ho0bUajZ2jr/RdwzCyS59Gi8xXIFwPLGBl6Uw=="],
|
||||
"@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.80", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-uO5TiSvb6j1w9RTe5z28OaOmsrOxVQUPaC5+wZl50RfOXcrYD/KgnS8I9lfyGXc7sGbkCopK6VnhNIAoLqfewQ=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.72", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-X98zYOrVOeuosCX+6ktf29FC2N2GHPLia7qv6mzPzTc+RPAuHWCDS++Z6JK7eGYqb/v6uaW7bAXaOvDBfol+0w=="],
|
||||
"@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.82", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-vQzlDHlC24Yz42p+rT4NBoP/5VdetkBoujbOLq9h6QYWC8THuZSPYnXIR9OP3XcOrdMgPBBipOrdssfxnIiWUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.973.15", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-login": "^3.972.77", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Rykg6s5ceBuynMOGWgoowO4N+27JfnqXAnVaSunZl0hOO1XodSrxGNz6sCEbnmS0lAfQZDKyb3fbr46gSuv6Sg=="],
|
||||
"@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.973.25", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/credential-provider-env": "^3.972.80", "@aws-sdk/credential-provider-http": "^3.972.82", "@aws-sdk/credential-provider-login": "^3.972.87", "@aws-sdk/credential-provider-process": "^3.972.80", "@aws-sdk/credential-provider-sso": "^3.973.24", "@aws-sdk/credential-provider-web-identity": "^3.972.86", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/credential-provider-imds": "^4.5.2", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-b5xl71uCRdWsu7P1VeGpiGuCf6zfYETsSNOv8AmYVTrsgbvTJRXdmmOPVfxkvGGVNsiKkGctClQW3jAn0SZLug=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.77", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Jb59xfEISoN5mmbnA+HYqdtrSX3CgCtJoof+V5D8/TgUI56W63GEEd5Y58WijU3Ou6+WEgaLD1feVzaRXV5IDQ=="],
|
||||
"@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.87", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-C4ZFmcwM+Zj14Z8huVUk54Gv4uzT1ZdzG9cY3Gdh8FePakq7Bss1OFsgZjAhWFOkFOGpBvFBeu0OWjWf8HNKRQ=="],
|
||||
|
||||
"@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.972.81", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-ini": "^3.973.15", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Rml+WitoFvXmv6JZ18U/xGdGDGGvB/mOin0ya0lTnTrdC0Z1lrVxTYh7iNklZBcvcRMrs4DoEf6xy1KWyrLQQw=="],
|
||||
"@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.972.82", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-ini": "^3.973.15", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-znDkEOGXB8W3kG1LJUKP3foBZY/9qLM0eil/DxWXSp37XsdsRLQHE/d/OaCGGVgKpA6znR38h/+INk8do1FjiA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.70", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2ry03fGRJr4sV3jI+ocjj5JqALnFD6ymM5KiNCDZMvq8bX2GSbE0vji4aM43TVCl2nXqqLRZaUxdq/KeWRAY4Q=="],
|
||||
"@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.80", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-xqfixO5aclje7tbQJDias+iNND5wp/3QZixCdZcVQpgWPTZ0V5DfTW9A804A5Z7ezu7sH3WRO+vzUjtiJBA8yg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.973.14", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/token-providers": "3.1116.0", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-jkhg/8ocAAoc0RFyLMhCw+/zZh7gystQgd4F4hznNa8P4Cc501PQmxd+jGLiMHodPJ+7Zv/3znM62gZojyasmA=="],
|
||||
"@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.973.24", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/token-providers": "3.1161.0", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-nlg3BKG03Cgzvv/dMnhxvDJPhAhQSpaN0RUdwgU7ziwkasoev7iI8el8Xy4Rd5sqzgaDUbV269fOXck5SargqA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.76", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-d3AGyVu759PGr35mEB2s22xxlNEA5rpdxtSPJthfPFJvoQ8dt357iVPECqWfUxXp1toJAvKmbtcIYVGigaGsCA=="],
|
||||
"@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.86", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-zKTyLJBEyfQBVlYqT6Jt+mYV4r8kGbWM7dn6v4Y4MRARizhYafjDXP/iMu76UMRhToSPNmIKX1XAb24gtpBFIA=="],
|
||||
|
||||
"@aws-sdk/eventstream-handler-node": ["@aws-sdk/eventstream-handler-node@3.972.34", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-cTeVzpu1xEAkryTZBYhGwnQ6gOGyp8ZYZvmn0Sg/nI/ABmy/CRHHxPDJDUi9PxwxUtGGaatvfRUB3FCgT/rSWw=="],
|
||||
|
||||
@@ -618,17 +618,17 @@
|
||||
|
||||
"@dnd-kit/state": ["@dnd-kit/state@0.5.0", "", { "dependencies": { "@preact/signals-core": "^1.10.0", "tslib": "^2.6.2" } }, "sha512-y7XbabQqjF58Lk8YmDQuR8l6QjN+Kh4qlGEjUvHuIeasLk1QP+9L5diXS98VMxQIivyMmUtX2//f+3N7qPJX4w=="],
|
||||
|
||||
"@earendil-works/chord": ["@earendil-works/chord@1.5.0", "", { "dependencies": { "@earendil-works/pi-schema": "1.5.0", "@earendil-works/pi-telemetry": "1.5.0" }, "peerDependencies": { "esbuild": "0.28.2", "ws": "8.21.0" }, "optionalPeers": ["esbuild", "ws"] }, "sha512-jf555zbCM21E03DVBDPD/Tuae0lz64YjaHx/athUxNZ/H7phVVb0dWfZsaYnxaXPQ1odW8iHEoVLOlE/prvUPg=="],
|
||||
"@earendil-works/chord": ["@earendil-works/chord@1.7.0", "", { "dependencies": { "@earendil-works/pi-schema": "1.7.0", "@earendil-works/pi-telemetry": "1.7.0" }, "peerDependencies": { "esbuild": "^0.28.2", "react": "^19.3.0", "ws": "^8.21.0" }, "optionalPeers": ["esbuild", "react", "ws"] }, "sha512-/zBlRrJkNbw0dJ4OrUzk08PC48mzOIFZQKTUE1qxQUWoPlf/xms95lEigzC30MllS+k5qqih7Clg0cTzYgPs1w=="],
|
||||
|
||||
"@earendil-works/pi-ai": ["@earendil-works/pi-ai@1.5.0", "", { "dependencies": { "@anthropic-ai/sdk": "0.129.0", "@aws-sdk/client-bedrock-runtime": "3.1127.0", "@earendil-works/pi-schema": "1.5.0", "@earendil-works/pi-telemetry": "1.5.0", "@google/genai": "2.21.0", "@smithy/node-http-handler": "4.12.1", "http-proxy-agent": "9.1.0", "https-proxy-agent": "9.1.0", "openai": "7.19.0", "partial-json": "0.1.7" }, "bin": { "pi-ai": "dist/cli.js" } }, "sha512-VeWxNqTHSqRCf8AcY/6kvNwh+neRL6MPxZPePVztIQy6qqK9MR/YoCSN/ZgDnIyCD3pqEXgRyQbzk4KV4uvjbg=="],
|
||||
"@earendil-works/pi-ai": ["@earendil-works/pi-ai@1.7.0", "", { "dependencies": { "@anthropic-ai/sdk": "0.129.0", "@aws-sdk/client-bedrock-runtime": "3.1127.0", "@aws-sdk/credential-provider-node": "3.972.82", "@earendil-works/pi-schema": "1.7.0", "@earendil-works/pi-telemetry": "1.7.0", "@google/genai": "3.6.1", "@smithy/node-http-handler": "4.12.1", "http-proxy-agent": "9.1.0", "https-proxy-agent": "9.1.0", "openai": "7.59.0", "partial-json": "0.1.7" }, "bin": { "pi-ai": "dist/cli.js" } }, "sha512-iKryMlUYniwWbU7YU0uS7W0+cGd9c6oJ6PzRLOn8j4+1njG4c+BQq1cNawctx/npDqGeOx8ME7Gkgl6K6arPuw=="],
|
||||
|
||||
"@earendil-works/pi-codemode": ["@earendil-works/pi-codemode@1.5.0", "", { "dependencies": { "quickjs-wasi": "3.6.2" } }, "sha512-PLBJZ17AEWGzOlAAcFuOkw3PxkOti0JlFuZQyeF2GRTqbpuYo4k9t8YqUV2uOQVzrUnKdxahwaFUqc1eNS1WAg=="],
|
||||
"@earendil-works/pi-codemode": ["@earendil-works/pi-codemode@1.7.0", "", { "dependencies": { "quickjs-wasi": "3.6.2" } }, "sha512-fhCoh8TLxhdRTOWSEplwp39Uv+JTsu9pCqtgu9gorO8zcaw92vsbVI/G89yFs92csTo2+yB7EsJq/+725Vj+eA=="],
|
||||
|
||||
"@earendil-works/pi-durable": ["@earendil-works/pi-durable@1.5.0", "", { "dependencies": { "@earendil-works/chord": "1.5.0", "@earendil-works/pi-ai": "1.5.0", "@earendil-works/pi-codemode": "1.5.0", "@earendil-works/pi-schema": "1.5.0", "@earendil-works/pi-telemetry": "1.5.0", "@silvia-odwyer/photon": "0.3.3", "diff": "8.0.4" } }, "sha512-xeBP2vIo5NvsCMQ4Y/V+Z164xQEi9JWiBWHdjn4Z15EnFqV3c0FxJAX26FqyyyintrYyk+Enre94GNcvRlBA5g=="],
|
||||
"@earendil-works/pi-durable": ["@earendil-works/pi-durable@1.7.0", "", { "dependencies": { "@earendil-works/chord": "1.7.0", "@earendil-works/pi-ai": "1.7.0", "@earendil-works/pi-codemode": "1.7.0", "@earendil-works/pi-schema": "1.7.0", "@earendil-works/pi-telemetry": "1.7.0", "@silvia-odwyer/photon": "0.3.3", "diff": "8.0.4" } }, "sha512-qL9PlFfXrirBNt7QR2bjZfviN6ZVcsGTHEqaj6U4Lxqqx9Vtth7LyIuGNlG2chDKMr3/ABamH8qZ9ggMgTGDOQ=="],
|
||||
|
||||
"@earendil-works/pi-schema": ["@earendil-works/pi-schema@1.5.0", "", {}, "sha512-RW0MbT2tR65OY6xMsgB/yVBb7m/RTNwA+9hurSN1vVXfHZRVmVnXbruBPrx/PzbrQnW5yLVlMRWxErGDQtF1Hg=="],
|
||||
"@earendil-works/pi-schema": ["@earendil-works/pi-schema@1.7.0", "", {}, "sha512-skji4McLg9jum3NFWzFa/4QRGEZhMGnSi3QL8b9VljJkc/QopH2/BFuGKI+VcEwYzKGwsd0I8RzvXGnZGfGltQ=="],
|
||||
|
||||
"@earendil-works/pi-telemetry": ["@earendil-works/pi-telemetry@1.5.0", "", {}, "sha512-VW3tcVdnNfl/Vk8wHPTzZdKkxcsCOM12ppiO4DXnd9wMxUCmOfLt/wvUnWeKWbTVlVSRg0uqKtnnhE2UCsG2Bw=="],
|
||||
"@earendil-works/pi-telemetry": ["@earendil-works/pi-telemetry@1.7.0", "", {}, "sha512-QZkngqktohuFZ2TZuJSXDuUntld4sCMW1tkUPaD4moMEX/z1lwcjycXnd9ChO9HNxm/Jfo+UTiC+N2hkAF9b0w=="],
|
||||
|
||||
"@electric-sql/pglite": ["@electric-sql/pglite@0.4.3", "", {}, "sha512-ichuWTgtd4mOM1G4SpyGJa5trT03lWbMypDV0fUXUCXg5hiHqVAz/bZyV68NqmkLB7WcYmj1RMJVSp8HV/v/ZQ=="],
|
||||
|
||||
@@ -2498,7 +2498,7 @@
|
||||
|
||||
"once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
|
||||
|
||||
"openai": ["openai@7.19.0", "", { "peerDependencies": { "@aws-sdk/credential-provider-node": ">=3.972.0 <4", "@smithy/hash-node": ">=4.3.0 <5", "@smithy/signature-v4": ">=5.4.0 <6", "undici": ">=5 <9", "ws": "^8.21.0", "zod": "^3.25 || ^4.0" }, "optionalPeers": ["@aws-sdk/credential-provider-node", "@smithy/hash-node", "@smithy/signature-v4", "undici", "ws", "zod"] }, "sha512-MX2s3u2L5racTO0CC/SWpCOasJQBCJrqLKXK+l82cAhdeF8mPMBEe/gxMm0ZFa2xpKpOFLRjxv5afYEZbBXmbQ=="],
|
||||
"openai": ["openai@7.59.0", "", { "peerDependencies": { "@aws-sdk/credential-provider-node": ">=3.972.0 <4", "@smithy/hash-node": ">=4.3.0 <5", "@smithy/signature-v4": ">=5.4.0 <6", "google-auth-library": ">=9.15.1 <12", "undici": ">=5 <9", "ws": "^8.21.0", "zod": "^3.25 || ^4.0" }, "optionalPeers": ["@aws-sdk/credential-provider-node", "@smithy/hash-node", "@smithy/signature-v4", "google-auth-library", "undici", "ws", "zod"] }, "sha512-wPYKJkLPFEdNJ2tThSg4jE1Ptsv4X3u8g8LIvu0Qz/UIhsKeCzl73rl48PtQsDVrJL/ku0liXOsbyd2TsRsPJw=="],
|
||||
|
||||
"optionator": ["optionator@0.9.4", "", { "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", "word-wrap": "^1.2.5" } }, "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g=="],
|
||||
|
||||
@@ -3046,11 +3046,85 @@
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@smithy/node-http-handler": ["@smithy/node-http-handler@4.11.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2jY1tSpERfPfWqyBV2pH+iGFaghVsIJszJNsT7hxtQYhVJpWDyc0LqOWI+nXOxOAHaEfZ4PXXtp1wW1TGpHhkA=="],
|
||||
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.972.81", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-ini": "^3.973.15", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Rml+WitoFvXmv6JZ18U/xGdGDGGvB/mOin0ya0lTnTrdC0Z1lrVxTYh7iNklZBcvcRMrs4DoEf6xy1KWyrLQQw=="],
|
||||
|
||||
"@aws-sdk/client-s3/@smithy/node-http-handler": ["@smithy/node-http-handler@4.11.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2jY1tSpERfPfWqyBV2pH+iGFaghVsIJszJNsT7hxtQYhVJpWDyc0LqOWI+nXOxOAHaEfZ4PXXtp1wW1TGpHhkA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@smithy/node-http-handler": ["@smithy/node-http-handler@4.11.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2jY1tSpERfPfWqyBV2pH+iGFaghVsIJszJNsT7hxtQYhVJpWDyc0LqOWI+nXOxOAHaEfZ4PXXtp1wW1TGpHhkA=="],
|
||||
"@aws-sdk/credential-provider-env/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1116.0", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-ygIivKqh8aHzNkucOCXHyIBgBpLPfrSI0mCqXF+vLBsPTUKqj0VSqAY0GFPe7lQl4HntjOcQ+KSyS7oUV2C54Q=="],
|
||||
"@aws-sdk/credential-provider-env/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-env/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-env/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-node/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-node/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-node/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1161.0", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-ypbXSofNcSHwf/KA40bFCXJb0MLaAKrfT7sot4dFaA+2lsuXNah4zLRJIAU7Qmvs9PFJ6rnY0bZFEC+mE7attA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.11.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2jY1tSpERfPfWqyBV2pH+iGFaghVsIJszJNsT7hxtQYhVJpWDyc0LqOWI+nXOxOAHaEfZ4PXXtp1wW1TGpHhkA=="],
|
||||
|
||||
@@ -3060,9 +3134,7 @@
|
||||
|
||||
"@dbos-inc/dbos-sdk/ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="],
|
||||
|
||||
"@earendil-works/chord/ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="],
|
||||
|
||||
"@earendil-works/pi-ai/@google/genai": ["@google/genai@2.21.0", "", { "dependencies": { "google-auth-library": "^10.3.0", "p-retry": "^4.6.2", "protobufjs": "^7.5.4", "ws": "^8.18.0" }, "peerDependencies": { "@modelcontextprotocol/sdk": "^1.25.2" }, "optionalPeers": ["@modelcontextprotocol/sdk"], "hasInstallScript": true }, "sha512-+PDtco2/Z0ONdzCGekCoCT+O1VJS9xJQNN4XzQpXG/t3El/SWWMkCWlFRO1KmivOHPa4Q0VjUYu1HBKCZ/v33Q=="],
|
||||
"@earendil-works/pi-ai/@google/genai": ["@google/genai@3.6.1", "", { "dependencies": { "google-auth-library": "^10.3.0", "p-retry": "^4.6.2", "protobufjs": "^7.6.5", "ws": "^8.21.0" }, "peerDependencies": { "@modelcontextprotocol/sdk": "^1.25.2" }, "optionalPeers": ["@modelcontextprotocol/sdk"] }, "sha512-DQIkZkl+VoZc+RUSaJ41vRuywjQDpP0t/oUf5/ddQhNW6JsPjVULW2EgHmuJ1mrr6ACtrmUdPlqtNXF1yfKySg=="],
|
||||
|
||||
"@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
|
||||
|
||||
@@ -3320,25 +3392,77 @@
|
||||
|
||||
"wrap-ansi-cjs/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.80", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-uO5TiSvb6j1w9RTe5z28OaOmsrOxVQUPaC5+wZl50RfOXcrYD/KgnS8I9lfyGXc7sGbkCopK6VnhNIAoLqfewQ=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.82", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-vQzlDHlC24Yz42p+rT4NBoP/5VdetkBoujbOLq9h6QYWC8THuZSPYnXIR9OP3XcOrdMgPBBipOrdssfxnIiWUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.973.25", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/credential-provider-env": "^3.972.80", "@aws-sdk/credential-provider-http": "^3.972.82", "@aws-sdk/credential-provider-login": "^3.972.87", "@aws-sdk/credential-provider-process": "^3.972.80", "@aws-sdk/credential-provider-sso": "^3.973.24", "@aws-sdk/credential-provider-web-identity": "^3.972.86", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/credential-provider-imds": "^4.5.2", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-b5xl71uCRdWsu7P1VeGpiGuCf6zfYETsSNOv8AmYVTrsgbvTJRXdmmOPVfxkvGGVNsiKkGctClQW3jAn0SZLug=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.80", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-xqfixO5aclje7tbQJDias+iNND5wp/3QZixCdZcVQpgWPTZ0V5DfTW9A804A5Z7ezu7sH3WRO+vzUjtiJBA8yg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.973.24", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/token-providers": "3.1161.0", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-nlg3BKG03Cgzvv/dMnhxvDJPhAhQSpaN0RUdwgU7ziwkasoev7iI8el8Xy4Rd5sqzgaDUbV269fOXck5SargqA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.86", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-zKTyLJBEyfQBVlYqT6Jt+mYV4r8kGbWM7dn6v4Y4MRARizhYafjDXP/iMu76UMRhToSPNmIKX1XAb24gtpBFIA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@earendil-works/pi-ai/@google/genai/ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="],
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.70", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-H404B7dJl2mCrBqahDEYsanB0xhdDp6tXnXcTUnXmmpy2Q3J0Ho0bUajZ2jr/RdwzCyS59Gi8xXIFwPLGBl6Uw=="],
|
||||
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.72", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-X98zYOrVOeuosCX+6ktf29FC2N2GHPLia7qv6mzPzTc+RPAuHWCDS++Z6JK7eGYqb/v6uaW7bAXaOvDBfol+0w=="],
|
||||
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.973.15", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-login": "^3.972.77", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Rykg6s5ceBuynMOGWgoowO4N+27JfnqXAnVaSunZl0hOO1XodSrxGNz6sCEbnmS0lAfQZDKyb3fbr46gSuv6Sg=="],
|
||||
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.70", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2ry03fGRJr4sV3jI+ocjj5JqALnFD6ymM5KiNCDZMvq8bX2GSbE0vji4aM43TVCl2nXqqLRZaUxdq/KeWRAY4Q=="],
|
||||
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.973.14", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/token-providers": "3.1116.0", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-jkhg/8ocAAoc0RFyLMhCw+/zZh7gystQgd4F4hznNa8P4Cc501PQmxd+jGLiMHodPJ+7Zv/3znM62gZojyasmA=="],
|
||||
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.76", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-d3AGyVu759PGr35mEB2s22xxlNEA5rpdxtSPJthfPFJvoQ8dt357iVPECqWfUxXp1toJAvKmbtcIYVGigaGsCA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-env/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-env/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@isaacs/cliui/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
|
||||
|
||||
@@ -3456,31 +3580,27 @@
|
||||
|
||||
"readdir-glob/minimatch/brace-expansion": ["brace-expansion@2.1.4", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.77", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Jb59xfEISoN5mmbnA+HYqdtrSX3CgCtJoof+V5D8/TgUI56W63GEEd5Y58WijU3Ou6+WEgaLD1feVzaRXV5IDQ=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1116.0", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-ygIivKqh8aHzNkucOCXHyIBgBpLPfrSI0mCqXF+vLBsPTUKqj0VSqAY0GFPe7lQl4HntjOcQ+KSyS7oUV2C54Q=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
"@aws-sdk/credential-provider-http/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.87", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-C4ZFmcwM+Zj14Z8huVUk54Gv4uzT1ZdzG9cY3Gdh8FePakq7Bss1OFsgZjAhWFOkFOGpBvFBeu0OWjWf8HNKRQ=="],
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1161.0", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-ypbXSofNcSHwf/KA40bFCXJb0MLaAKrfT7sot4dFaA+2lsuXNah4zLRJIAU7Qmvs9PFJ6rnY0bZFEC+mE7attA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@prisma/studio-core/@radix-ui/react-toggle/@radix-ui/react-primitive/@radix-ui/react-slot": ["@radix-ui/react-slot@1.2.3", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.2" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A=="],
|
||||
|
||||
@@ -3508,70 +3628,14 @@
|
||||
|
||||
"readdir-glob/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@prisma/studio-core/@radix-ui/react-toggle/@radix-ui/react-primitive/@radix-ui/react-slot/@radix-ui/react-compose-refs": ["@radix-ui/react-compose-refs@1.1.2", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-z4eqJvfiNnFMHIIvXP3CY57y2WJs5g2v3X0zm9mEJkrkNv4rDxu+sg9Jh8EkXyeqBkB7SOcboo9dMVqhyrACIg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ services:
|
||||
EMBEDDING_PROVIDER: gemma-embedding-2-openai
|
||||
GEMMA_EMBEDDING_OPENAI_BASE_URL: http://embedding-server:9379/v1
|
||||
ENABLE_EMBEDDING_AGENT: 'true'
|
||||
ENABLE_TRANSCRIPTION_AGENT: 'true'
|
||||
CONCURRENCY_AGENT: 1
|
||||
|
||||
depends_on:
|
||||
|
||||
@@ -60,6 +60,7 @@ services:
|
||||
EMBEDDING_PROVIDER: gemma-embedding-2-openai
|
||||
GEMMA_EMBEDDING_OPENAI_BASE_URL: http://embedding-server:9379/v1
|
||||
ENABLE_EMBEDDING_AGENT: 'true'
|
||||
ENABLE_TRANSCRIPTION_AGENT: 'true'
|
||||
CONCURRENCY_AGENT: 1
|
||||
|
||||
# 3D Turntable Renderer Configuration
|
||||
|
||||
@@ -50,6 +50,7 @@ services:
|
||||
EMBEDDING_PROVIDER: gemma-embedding-2-openai
|
||||
GEMMA_EMBEDDING_OPENAI_BASE_URL: http://embedding-server:9379/v1
|
||||
ENABLE_EMBEDDING_AGENT: 'true'
|
||||
ENABLE_TRANSCRIPTION_AGENT: 'true'
|
||||
CONCURRENCY_AGENT: 1
|
||||
|
||||
depends_on:
|
||||
|
||||
@@ -60,6 +60,7 @@ services:
|
||||
EMBEDDING_PROVIDER: gemma-embedding-2-openai
|
||||
GEMMA_EMBEDDING_OPENAI_BASE_URL: http://embedding-server:9379/v1
|
||||
ENABLE_EMBEDDING_AGENT: 'true'
|
||||
ENABLE_TRANSCRIPTION_AGENT: 'true'
|
||||
CONCURRENCY_AGENT: 1
|
||||
|
||||
# 3D Turntable Renderer Configuration
|
||||
|
||||
@@ -99,13 +99,14 @@ Configures background worker execution, concurrency limits, and worker identity
|
||||
|
||||
## Embedding Config
|
||||
|
||||
| Variable | Description | Example / Default |
|
||||
| :-------------------------------- | :------------------------------------------------------------------------------------------------------------ | :-------------------------------- |
|
||||
| `EMBEDDING_PROVIDER` | Multimodal embedding provider. Options: `gemini-embedding-2`, `gemma-embedding-2-openai`. | `gemini-embedding-2` (default) |
|
||||
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | Base URL of the OpenAI-compatible LiteRT-LM embedding server. | `http://embedding-server:9379/v1` |
|
||||
| `ENABLE_EMBEDDING_AGENT` | When set to `true`, automatically provisions and enables the system embedding agent for all teams on startup. | `false` (default) |
|
||||
| `EMBEDDING_CHUNK_DURATION` | The duration in seconds for each video chunk when generating video embeddings. | `60.0` (default) |
|
||||
| `EMBEDDING_CHUNK_OVERLAP` | The duration in seconds to overlap video chunks when generating video embeddings. | `5.0` (default) |
|
||||
| Variable | Description | Example / Default |
|
||||
| :-------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------- |
|
||||
| `EMBEDDING_PROVIDER` | Multimodal embedding provider. Options: `gemini-embedding-2`, `gemma-embedding-2-openai`. | `gemini-embedding-2` (default) |
|
||||
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | Base URL of the OpenAI-compatible LiteRT-LM embedding server. | `http://embedding-server:9379/v1` |
|
||||
| `ENABLE_EMBEDDING_AGENT` | When set to `true`, automatically provisions and enables the system embedding agent for all teams on startup. | `false` (default) |
|
||||
| `ENABLE_TRANSCRIPTION_AGENT` | Set to `true` to provision and enable the Transcript Agent, or `false` to disable it. Either value makes it read-only in team settings. | Unset. Manage the agent in team settings. |
|
||||
| `EMBEDDING_CHUNK_DURATION` | The duration in seconds for each video chunk when generating video embeddings. | `60.0` (default) |
|
||||
| `EMBEDDING_CHUNK_OVERLAP` | The duration in seconds to overlap video chunks when generating video embeddings. | `5.0` (default) |
|
||||
|
||||
## Sandbox Config
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ When creating agents for chat or metadata autofill, you must select an underlyin
|
||||
|
||||
## Built-In Providers
|
||||
|
||||
Shumai ships with pre-configured configurations for major LLM providers. Because Shumai uses [Pi](https://github.com/earendil-works/pi) as its core agent framework, the supported provider and model configurations are automatically synchronized with Pi's capabilities.
|
||||
Shumai seeds new teams with provider and model configurations bundled with [Pi](https://github.com/earendil-works/pi). In **Settings → Providers**, choose **Refresh models** on a provider card, select compatible models, then choose **Add selected**. Refresh looks up the public catalog and preserves your saved settings and models. Use **Add Provider** to set up another provider.
|
||||
|
||||
Team Owner can freely edit, delete, or add new providers. All configured provider and model settings are injected directly into the Pi framework at runtime.
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ For video assets, Shumai breaks videos into standardized segments and extracts k
|
||||
>
|
||||
> If you change your embedding provider (for example, switching from Google Gemini's 1536-dimensional embeddings to EmbeddingGemma's 768-dimensional embeddings, or vice versa), **all existing vector embeddings in your database become invalid**.
|
||||
>
|
||||
> To protect production databases from accidental corruption and search failures, **Shumai intentionally does not provide a WebUI toggle to change the embedding provider**. The provider can only be configured by an administrator via environment variables (`EMBEDDING_PROVIDER` and `GEMMA_EMBEDDING_OPENAI_BASE_URL`).
|
||||
> Saving an embedding server URL in Integrations selects EmbeddingGemma when `EMBEDDING_PROVIDER` is unset. Regenerate your embeddings after switching providers.
|
||||
|
||||
---
|
||||
|
||||
@@ -103,6 +103,7 @@ services:
|
||||
EMBEDDING_PROVIDER: gemma-embedding-2-openai
|
||||
GEMMA_EMBEDDING_OPENAI_BASE_URL: http://embedding-server:9379/v1
|
||||
ENABLE_EMBEDDING_AGENT: 'true'
|
||||
ENABLE_TRANSCRIPTION_AGENT: 'true'
|
||||
CONCURRENCY_AGENT: 1
|
||||
depends_on:
|
||||
- embedding-server
|
||||
@@ -111,14 +112,23 @@ services:
|
||||
> [!NOTE]
|
||||
> Since Shumai communicates with `embedding-server` over Docker's internal network, `embedding-server` does not need to expose any ports to the host machine.
|
||||
|
||||
### Configure in Shumai
|
||||
|
||||
Open **Team Settings → Integrations → Embedding Server**. Enter the URL as reached from Shumai, select **Test Connection**, and save. For Docker Compose, use the internal service address, such as `http://embedding-server:9379/v1`. Clear the field and save to remove the setting.
|
||||
|
||||
`EMBEDDING_PROVIDER` takes precedence over automatic provider selection. When `GEMMA_EMBEDDING_OPENAI_BASE_URL` is set, that URL takes precedence and the field is read-only. The embedding server accepts unauthenticated requests. [Embedding server source](https://github.com/shumaiOne/embedding-server/blob/main/serve.py)
|
||||
|
||||
Enable the **Embedding Agent** for semantic search. Enable the **Transcript Agent** for video transcription and internal comments on failed jobs. Both agents are available in **Team Settings → Agents**.
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Variable | Required | Description | Default |
|
||||
| :-------------------------------- | :---------- | :---------------------------------------------------------------------------------------------------------------------------- | :------------------------- |
|
||||
| `EMBEDDING_PROVIDER` | Yes | Set to `gemma-embedding-2-openai` to use the local LiteRT-LM server. | `gemini-embedding-2` |
|
||||
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | Yes | HTTP base URL of the embedding server (e.g. `http://embedding-server:9379/v1`). | `http://localhost:9379/v1` |
|
||||
| `ENABLE_EMBEDDING_AGENT` | No | Automatically provisions and enables the system embedding agent for all teams on startup. | `false` |
|
||||
| `CONCURRENCY_AGENT` | Recommended | Maximum concurrent AI tasks executed by workers. **Set to `1`** when running `embedding-server` to prevent high memory usage. | `5` |
|
||||
| Variable | Required | Description | Default |
|
||||
| :-------------------------------- | :------------ | :----------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------- |
|
||||
| `EMBEDDING_PROVIDER` | For env setup | Set to `gemma-embedding-2-openai` to use the local LiteRT-LM server. | `gemini-embedding-2` when no integration URL is saved |
|
||||
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | No | Overrides the saved embedding server URL and makes the integration read-only. | `http://localhost:9379/v1` when the local provider is selected without a URL |
|
||||
| `ENABLE_EMBEDDING_AGENT` | No | Automatically provisions and enables the system embedding agent for all teams on startup. | `false` |
|
||||
| `ENABLE_TRANSCRIPTION_AGENT` | No | Set to `true` to create or enable the Transcript Agent, or `false` to disable it. Either value makes it read-only in Settings. | Unset. Manage the agent in Settings. |
|
||||
| `CONCURRENCY_AGENT` | Recommended | Maximum concurrent AI tasks executed by workers. **Set to `1`** when running `embedding-server` to prevent high memory usage. | `5` |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -99,13 +99,14 @@ Shumai 支持配置可选的**归档存储**(冷存储)层级(`local` NAS/
|
||||
|
||||
## 向量模型配置
|
||||
|
||||
| 变量 | 说明 | 示例 / 默认值 |
|
||||
| :-------------------------------- | :------------------------------------------------------------------------------- | :-------------------------------- |
|
||||
| `EMBEDDING_PROVIDER` | 多模态向量模型服务商。可选值:`gemini-embedding-2`、`gemma-embedding-2-openai`。 | `gemini-embedding-2`(默认) |
|
||||
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | 兼容 OpenAI 协议的 LiteRT-LM 向量模型服务 Base URL。 | `http://embedding-server:9379/v1` |
|
||||
| `ENABLE_EMBEDDING_AGENT` | 设为 `true` 时,在启动时自动为所有团队置备并启用系统向量智能体。 | `false`(默认) |
|
||||
| `EMBEDDING_CHUNK_DURATION` | 生成视频向量时每个视频切片的时长(单位:秒)。 | `60.0`(默认) |
|
||||
| `EMBEDDING_CHUNK_OVERLAP` | 生成视频向量时各个视频切片的重叠时长(单位:秒)。 | `5.0`(默认) |
|
||||
| 变量 | 说明 | 示例 / 默认值 |
|
||||
| :-------------------------------- | :-------------------------------------------------------------------------------------------- | :-------------------------------- |
|
||||
| `EMBEDDING_PROVIDER` | 多模态向量模型服务商。可选值:`gemini-embedding-2`、`gemma-embedding-2-openai`。 | `gemini-embedding-2`(默认) |
|
||||
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | 兼容 OpenAI 协议的 LiteRT-LM 向量模型服务 Base URL。 | `http://embedding-server:9379/v1` |
|
||||
| `ENABLE_TRANSCRIPTION_AGENT` | 设置为 `true` 时自动创建并启用转录智能体,设置为 `false` 时停用。两种情况下团队设置均为只读。 | 未设置时可在团队设置中管理。 |
|
||||
| `ENABLE_EMBEDDING_AGENT` | 设为 `true` 时,在启动时自动为所有团队置备并启用系统向量智能体。 | `false`(默认) |
|
||||
| `EMBEDDING_CHUNK_DURATION` | 生成视频向量时每个视频切片的时长(单位:秒)。 | `60.0`(默认) |
|
||||
| `EMBEDDING_CHUNK_OVERLAP` | 生成视频向量时各个视频切片的重叠时长(单位:秒)。 | `5.0`(默认) |
|
||||
|
||||
## 沙箱配置
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ description: 将 Shumai 连接至 OpenAI、Anthropic、Gemini 或自定义 LLM
|
||||
|
||||
## 内置模型服务商
|
||||
|
||||
Shumai 预置了主流 LLM 服务商的配置。由于 Shumai 采用 [Pi](https://github.com/earendil-works/pi) 作为底层核心智能体框架,系统支持的服务商与模型配置会自动与 Pi 的功能生态保持同步。
|
||||
Shumai 使用 [Pi](https://github.com/earendil-works/pi) 随附的服务商与模型配置初始化新团队。在**设置 → 服务商**中,点击服务商卡片上的**刷新模型**,选择兼容的模型,然后点击**添加所选**。刷新会查询公开模型目录,并保留现有设置和模型。若要设置其他服务商,请点击**添加服务商**。
|
||||
|
||||
团队所有者可自由编辑、删除或添加新服务商。所有已配置的服务商与模型参数均会在运行时直接注入 Pi 框架。
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ Shumai 支持通过 [shumaiOne/embedding-server](https://github.com/shumaiOne/em
|
||||
>
|
||||
> 若更换向量服务提供商(例如从 Google Gemini 的 1536 维向量切换到 EmbeddingGemma 的 768 维向量,反之亦然),**数据库中现存的所有向量嵌入数据将全部失效**。
|
||||
>
|
||||
> 为保护生产数据库免受误操作损坏及搜索失效,**Shumai 刻意未在 Web 界面中提供切换 Embedding 提供商的开关**。该配置仅能由管理员通过环境变量(`EMBEDDING_PROVIDER` 和 `GEMMA_EMBEDDING_OPENAI_BASE_URL`)进行配置。
|
||||
> 未设置 `EMBEDDING_PROVIDER` 时,在集成页面保存向量模型服务地址会启用 EmbeddingGemma。切换向量模型服务后,请重新生成向量。
|
||||
|
||||
---
|
||||
|
||||
@@ -103,6 +103,7 @@ services:
|
||||
EMBEDDING_PROVIDER: gemma-embedding-2-openai
|
||||
GEMMA_EMBEDDING_OPENAI_BASE_URL: http://embedding-server:9379/v1
|
||||
ENABLE_EMBEDDING_AGENT: 'true'
|
||||
ENABLE_TRANSCRIPTION_AGENT: 'true'
|
||||
CONCURRENCY_AGENT: 1
|
||||
depends_on:
|
||||
- embedding-server
|
||||
@@ -111,14 +112,23 @@ services:
|
||||
> [!NOTE]
|
||||
> 由于 Shumai 与 `embedding-server` 在 Docker 内部网络中通信,`embedding-server` 无需向宿主机映射暴露端口。
|
||||
|
||||
### 在 Shumai 中配置
|
||||
|
||||
打开 **团队设置 → 集成 → 向量模型服务**。输入 Shumai 可以访问的服务地址,选择 **测试连接**,然后保存。使用 Docker Compose 时,可填写内部服务地址,例如 `http://embedding-server:9379/v1`。清空地址并保存即可移除配置。
|
||||
|
||||
已设置的 `EMBEDDING_PROVIDER` 优先于自动选择。设置 `GEMMA_EMBEDDING_OPENAI_BASE_URL` 后,环境变量中的地址优先生效,集成页面的地址字段为只读。向量模型服务接受未经身份验证的请求。[向量模型服务源码](https://github.com/shumaiOne/embedding-server/blob/main/serve.py)
|
||||
|
||||
在 **团队设置 → 智能体** 中启用 **嵌入智能体** 后可使用语义搜索。启用 **转录智能体** 后可生成视频转录,转录失败时会在视频中发布内部评论。
|
||||
|
||||
### 环境变量
|
||||
|
||||
| 变量 | 必填 | 说明 | 默认值 |
|
||||
| :-------------------------------- | :------- | :------------------------------------------------------------------------------------------------ | :------------------------- |
|
||||
| `EMBEDDING_PROVIDER` | 是 | 设置为 `gemma-embedding-2-openai` 以使用本地 LiteRT-LM 服务。 | `gemini-embedding-2` |
|
||||
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | 是 | 向量模型服务的 HTTP 基础地址(例如 `http://embedding-server:9379/v1`)。 | `http://localhost:9379/v1` |
|
||||
| `ENABLE_EMBEDDING_AGENT` | 否 | 启动时自动为所有团队初始化并启用系统级向量嵌入智能体。 | `false` |
|
||||
| `CONCURRENCY_AGENT` | 推荐配置 | Worker 执行 AI 任务的最大并发数。运行 `embedding-server` 时**务必设为 `1`**,以防止内存开销过大。 | `5` |
|
||||
| 变量 | 必填 | 说明 | 默认值 |
|
||||
| :-------------------------------- | :----------------- | :------------------------------------------------------------------------------------------------ | :---------------------------------------------------------- |
|
||||
| `EMBEDDING_PROVIDER` | 环境变量配置时需要 | 设置为 `gemma-embedding-2-openai` 以使用本地 LiteRT-LM 服务。 | 未保存服务地址时为 `gemini-embedding-2` |
|
||||
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | 否 | 覆盖集成页面保存的服务地址,并将地址字段设为只读。 | 选择本地模型服务且未配置地址时为 `http://localhost:9379/v1` |
|
||||
| `ENABLE_EMBEDDING_AGENT` | 否 | 启动时自动为所有团队初始化并启用系统级向量嵌入智能体。 | `false` |
|
||||
| `ENABLE_TRANSCRIPTION_AGENT` | 否 | `true` 会创建或启用转录智能体,`false` 会停用它。两种情况下设置页面均为只读。 | 未设置时可在设置页面管理。 |
|
||||
| `CONCURRENCY_AGENT` | 推荐配置 | Worker 执行 AI 任务的最大并发数。运行 `embedding-server` 时**务必设为 `1`**,以防止内存开销过大。 | `5` |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"dependencies": {
|
||||
"@earendil-works/chord": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/chord": "1.7.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { GoogleGenAI } from '@google/genai'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import {
|
||||
embeddingServerService,
|
||||
LOCAL_EMBEDDING_PROVIDER,
|
||||
} from '@shumai/core/src/search/embedding-server'
|
||||
import { textEmbeddingService } from '@shumai/core/src/search/text-embedding'
|
||||
import { prisma, WorkflowTaskStatus, WorkflowTaskType } from '@shumai/db'
|
||||
import {
|
||||
@@ -59,19 +63,13 @@ interface OpenAiEmbeddingItem {
|
||||
}
|
||||
}
|
||||
|
||||
async function callGemmaEmbeddingServer(input: string | OpenAiEmbeddingItem[]): Promise<{
|
||||
async function callGemmaEmbeddingServer(
|
||||
endpoint: string,
|
||||
input: OpenAiEmbeddingItem[],
|
||||
): Promise<{
|
||||
embedding: number[]
|
||||
usage: Usage
|
||||
}> {
|
||||
const rawBaseUrl = process.env.GEMMA_EMBEDDING_OPENAI_BASE_URL || 'http://localhost:9379/v1'
|
||||
|
||||
const normalized = rawBaseUrl.replace(/\/+$/, '')
|
||||
const endpoint = normalized.endsWith('/embeddings')
|
||||
? normalized
|
||||
: normalized.endsWith('/v1')
|
||||
? `${normalized}/embeddings`
|
||||
: `${normalized}/v1/embeddings`
|
||||
|
||||
const response = await fetch(endpoint, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
@@ -89,8 +87,12 @@ async function callGemmaEmbeddingServer(input: string | OpenAiEmbeddingItem[]):
|
||||
})
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- response json shape is dynamic from external endpoint
|
||||
const json: any = await response.json()
|
||||
const json = (await response.json()) as {
|
||||
model?: string
|
||||
data?: Array<{ embedding?: number[] }>
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- OpenAI response field
|
||||
usage?: { prompt_tokens?: number }
|
||||
}
|
||||
const embedding = json.data?.[0]?.embedding
|
||||
if (!embedding || !Array.isArray(embedding)) {
|
||||
throw ApplicationFailure.create({
|
||||
@@ -102,7 +104,7 @@ async function callGemmaEmbeddingServer(input: string | OpenAiEmbeddingItem[]):
|
||||
return {
|
||||
embedding,
|
||||
usage: {
|
||||
model: json.model || 'gemma-embedding-2-openai',
|
||||
model: json.model || LOCAL_EMBEDDING_PROVIDER,
|
||||
inputTokens: json.usage?.prompt_tokens ?? 0,
|
||||
outputTokens: 0,
|
||||
},
|
||||
@@ -119,8 +121,8 @@ export const generateTextEmbeddingActivity = defineStep(
|
||||
embedding: number[]
|
||||
usage: Usage
|
||||
}> {
|
||||
const provider = process.env.EMBEDDING_PROVIDER || 'gemini-embedding-2'
|
||||
if (provider !== 'gemma-embedding-2-openai' && !process.env.GEMINI_API_KEY) {
|
||||
const { provider } = await embeddingServerService.resolveRuntimeConfig(params.teamId)
|
||||
if (provider !== LOCAL_EMBEDDING_PROVIDER && !process.env.GEMINI_API_KEY) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'GEMINI_API_KEY environment variable is not configured',
|
||||
nonRetryable: true,
|
||||
@@ -129,6 +131,7 @@ export const generateTextEmbeddingActivity = defineStep(
|
||||
|
||||
try {
|
||||
const result = await textEmbeddingService.generateEmbedding(params.text, {
|
||||
provider,
|
||||
teamId: params.teamId,
|
||||
skipCache: true,
|
||||
})
|
||||
@@ -193,7 +196,9 @@ export const getEmbeddingContextActivity = defineStep(
|
||||
|
||||
const parsedOverlap = parseFloat(process.env.EMBEDDING_CHUNK_OVERLAP || '')
|
||||
const chunkOverlap = Number.isFinite(parsedOverlap) && parsedOverlap >= 0 ? parsedOverlap : 5.0
|
||||
const embeddingProvider = process.env.EMBEDDING_PROVIDER || 'gemini-embedding-2'
|
||||
const { provider: embeddingProvider } = await embeddingServerService.resolveRuntimeConfig(
|
||||
params.teamId,
|
||||
)
|
||||
|
||||
const existingEmbeddings = await prisma.$queryRaw<ExistingAssetEmbeddingInfo[]>`
|
||||
SELECT
|
||||
@@ -290,6 +295,7 @@ export const saveAssetEmbeddingsActivity = defineStep(
|
||||
|
||||
export interface GenerateImageEmbeddingParams {
|
||||
teamId: string
|
||||
provider?: string
|
||||
assetKey: string
|
||||
mediaType: string
|
||||
}
|
||||
@@ -299,20 +305,23 @@ export const generateImageEmbeddingActivity = defineStep(
|
||||
embedding: number[]
|
||||
usage: Usage
|
||||
}> {
|
||||
const provider = process.env.EMBEDDING_PROVIDER || 'gemini-embedding-2'
|
||||
const { provider, embeddingEndpoint } = await embeddingServerService.resolveRuntimeConfig(
|
||||
params.teamId,
|
||||
params.provider,
|
||||
)
|
||||
const { buffer: data } = await s3Service.getObject(
|
||||
process.env.S3_BUCKET || 'shumai',
|
||||
params.assetKey,
|
||||
)
|
||||
|
||||
if (provider === 'gemma-embedding-2-openai') {
|
||||
if (provider === LOCAL_EMBEDDING_PROVIDER) {
|
||||
let imgData = data
|
||||
let mimeType = params.mediaType || 'image/jpeg'
|
||||
if (mimeType !== 'image/jpeg' && mimeType !== 'image/png') {
|
||||
imgData = await sharp(data).jpeg().toBuffer()
|
||||
mimeType = 'image/jpeg'
|
||||
}
|
||||
return callGemmaEmbeddingServer([
|
||||
return callGemmaEmbeddingServer(embeddingEndpoint, [
|
||||
{
|
||||
type: 'image_url',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
@@ -383,6 +392,7 @@ export function getGemmaEmbeddingTargetFrameCount(width?: number, height?: numbe
|
||||
|
||||
export interface GenerateVideoChunkEmbeddingParams {
|
||||
teamId: string
|
||||
provider?: string
|
||||
chunkKey: string
|
||||
}
|
||||
|
||||
@@ -393,8 +403,11 @@ export const generateVideoChunkEmbeddingActivity = defineStep(
|
||||
embedding: number[]
|
||||
usage: Usage
|
||||
}> {
|
||||
const provider = process.env.EMBEDDING_PROVIDER || 'gemini-embedding-2'
|
||||
const isGemma = provider === 'gemma-embedding-2-openai' || params.chunkKey.endsWith('.tar')
|
||||
const { provider, embeddingEndpoint } = await embeddingServerService.resolveRuntimeConfig(
|
||||
params.teamId,
|
||||
params.provider,
|
||||
)
|
||||
const isGemma = provider === LOCAL_EMBEDDING_PROVIDER || params.chunkKey.endsWith('.tar')
|
||||
|
||||
if (isGemma) {
|
||||
const { buffer: data } = await s3Service.getObject(
|
||||
@@ -467,7 +480,7 @@ export const generateVideoChunkEmbeddingActivity = defineStep(
|
||||
}),
|
||||
)
|
||||
|
||||
return await callGemmaEmbeddingServer(input)
|
||||
return await callGemmaEmbeddingServer(embeddingEndpoint, input)
|
||||
}
|
||||
|
||||
const apiKey = process.env.GEMINI_API_KEY
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
import { execFile } from 'node:child_process'
|
||||
import { mkdtemp, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { promisify } from 'node:util'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import {
|
||||
isLocalTranscriptionEnabled,
|
||||
LocalTranscriptionError,
|
||||
transcribeLocalAudio,
|
||||
} from '@shumai/core/src/transcript/local-transcription'
|
||||
import { transcriptService } from '@shumai/core/src/transcript/transcript'
|
||||
import { selectPrimaryAudioStream } from '@shumai/core/src/transcode/transcode'
|
||||
import { prisma } from '@shumai/db'
|
||||
import {
|
||||
selectTranscriptVideoProxyKey,
|
||||
transcriptionErrors,
|
||||
transcriptVideoStatuses,
|
||||
} from '@shumai/dtos'
|
||||
import {
|
||||
ApplicationFailure,
|
||||
defineStep,
|
||||
ensureLocalMediaFile,
|
||||
getLocalTaskAbortSignal,
|
||||
} from '@shumai/workflow-core'
|
||||
import { z } from 'zod'
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
|
||||
const audioProbeSchema = z.object({
|
||||
streams: z.array(
|
||||
z.object({
|
||||
index: z.number().int().nonnegative(),
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- ffprobe field
|
||||
codec_type: z.string(),
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- ffprobe field
|
||||
bit_rate: z.string().optional(),
|
||||
disposition: z.record(z.string(), z.number()).optional(),
|
||||
}),
|
||||
),
|
||||
})
|
||||
|
||||
async function removeTempDirectory(directory: string): Promise<void> {
|
||||
try {
|
||||
await rm(directory, { recursive: true, force: true })
|
||||
} catch (error) {
|
||||
logger.warn({ err: error, directory }, 'Failed to remove local transcription files')
|
||||
}
|
||||
}
|
||||
|
||||
export const extractTranscriptAudioActivity = defineStep(
|
||||
async function extractTranscriptAudioActivity({
|
||||
assetId,
|
||||
taskId,
|
||||
audioKey,
|
||||
teamId,
|
||||
}: {
|
||||
assetId: string
|
||||
taskId: string
|
||||
audioKey: string
|
||||
teamId?: string
|
||||
}): Promise<void> {
|
||||
if (!(await isLocalTranscriptionEnabled(teamId))) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'Local transcription is disabled',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
const asset = await prisma.asset.findFirst({
|
||||
where: {
|
||||
id: assetId,
|
||||
type: 'file',
|
||||
status: { in: [...transcriptVideoStatuses] },
|
||||
isDeleted: false,
|
||||
mediaType: { startsWith: 'video/' },
|
||||
},
|
||||
select: { media: true },
|
||||
})
|
||||
const proxyKey = selectTranscriptVideoProxyKey(asset?.media)
|
||||
if (!proxyKey) {
|
||||
throw ApplicationFailure.create({ message: transcriptionErrors.noProxy, nonRetryable: true })
|
||||
}
|
||||
|
||||
const signal = getLocalTaskAbortSignal(taskId)
|
||||
const directory = await mkdtemp(join(tmpdir(), 'shumai-transcript-'))
|
||||
try {
|
||||
const video = await ensureLocalMediaFile(proxyKey, join(directory, 'video.mp4'))
|
||||
const { stdout } = await execFileAsync(
|
||||
'ffprobe',
|
||||
['-v', 'error', '-select_streams', 'a', '-show_streams', '-of', 'json', video],
|
||||
{ signal },
|
||||
)
|
||||
const stream = selectPrimaryAudioStream(audioProbeSchema.parse(JSON.parse(stdout)).streams)
|
||||
if (!stream) {
|
||||
throw ApplicationFailure.create({
|
||||
message: transcriptionErrors.noAudio,
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
const wav = join(directory, 'audio.wav')
|
||||
// Keep the container timeline and fill any leading gap before the primary audio starts.
|
||||
await execFileAsync(
|
||||
'ffmpeg',
|
||||
[
|
||||
'-nostdin',
|
||||
'-v',
|
||||
'error',
|
||||
'-copyts',
|
||||
'-start_at_zero',
|
||||
'-i',
|
||||
video,
|
||||
'-map',
|
||||
`0:${stream.index}`,
|
||||
'-af',
|
||||
'aresample=16000:async=1:first_pts=0',
|
||||
'-ac',
|
||||
'1',
|
||||
'-c:a',
|
||||
'pcm_s16le',
|
||||
wav,
|
||||
],
|
||||
{ signal },
|
||||
)
|
||||
signal?.throwIfAborted()
|
||||
await s3Service.uploadFileToKey(wav, audioKey, 'audio/wav')
|
||||
} finally {
|
||||
await removeTempDirectory(directory)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
export const transcribeAudioActivity = defineStep(async function transcribeAudioActivity({
|
||||
teamId,
|
||||
taskId,
|
||||
audioKey,
|
||||
language,
|
||||
model,
|
||||
}: {
|
||||
teamId?: string
|
||||
taskId: string
|
||||
audioKey: string
|
||||
language: string | null
|
||||
model: string
|
||||
}) {
|
||||
const directory = await mkdtemp(join(tmpdir(), 'shumai-transcript-'))
|
||||
try {
|
||||
const path = await ensureLocalMediaFile(audioKey, join(directory, 'audio.wav'))
|
||||
return await transcribeLocalAudio({
|
||||
teamId,
|
||||
audio: Bun.file(path),
|
||||
language,
|
||||
model,
|
||||
signal: getLocalTaskAbortSignal(taskId),
|
||||
})
|
||||
} catch (error) {
|
||||
if (error instanceof LocalTranscriptionError) {
|
||||
const { status } = error
|
||||
if (status >= 400 && status < 500 && status !== 408 && status !== 429) {
|
||||
throw ApplicationFailure.create({
|
||||
message: status === 413 ? transcriptionErrors.tooLarge : error.message,
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
if (error instanceof z.ZodError || error instanceof SyntaxError) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'Invalid transcription response',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
throw error
|
||||
} finally {
|
||||
await removeTempDirectory(directory)
|
||||
}
|
||||
})
|
||||
|
||||
export const saveTranscriptActivity = defineStep(async function saveTranscriptActivity(
|
||||
params: Parameters<typeof transcriptService.saveResult>[0],
|
||||
): Promise<void> {
|
||||
if (!(await transcriptService.saveResult(params))) {
|
||||
throw ApplicationFailure.create({ message: 'Video is no longer available', nonRetryable: true })
|
||||
}
|
||||
})
|
||||
|
||||
export const reportTranscriptionFailureActivity = defineStep(
|
||||
async function reportTranscriptionFailureActivity(taskId: string, reason: string | undefined) {
|
||||
if (getLocalTaskAbortSignal(taskId)?.aborted) return
|
||||
|
||||
const task = await prisma.workflowTask.findUnique({
|
||||
where: { id: taskId, type: 'ai_transcription', status: 'processing' },
|
||||
select: { assetId: true, teamId: true },
|
||||
})
|
||||
if (!task?.teamId) return
|
||||
|
||||
const asset = await prisma.asset.findFirst({
|
||||
where: { id: task.assetId, isDeleted: false, project: { teamId: task.teamId } },
|
||||
select: { id: true },
|
||||
})
|
||||
if (!asset) return
|
||||
|
||||
const agent = await transcriptService.findEnabledAgent(task.teamId)
|
||||
if (!agent || getLocalTaskAbortSignal(taskId)?.aborted) return
|
||||
|
||||
const detail = Object.values(transcriptionErrors).find((message) => message === reason)
|
||||
await prisma.assetComment.upsert({
|
||||
where: { transcriptionTaskId: taskId },
|
||||
update: {},
|
||||
create: {
|
||||
assetId: asset.id,
|
||||
creatorId: agent.id,
|
||||
transcriptionTaskId: taskId,
|
||||
isInternal: true,
|
||||
message: detail
|
||||
? `Transcription failed. ${detail}.`
|
||||
: 'Transcription failed. Try generating the transcript again.',
|
||||
},
|
||||
})
|
||||
},
|
||||
)
|
||||
@@ -3,9 +3,11 @@ import { registerWorkflow } from '@shumai/workflow-core'
|
||||
import { agentAutofillMedia } from './workflows/agent-autofill'
|
||||
import { agentChat } from './workflows/agent-chat'
|
||||
import { agentEmbeddingMedia } from './workflows/agent-embedding'
|
||||
import { transcribeVideoWorkflow } from './workflows/transcribe-video'
|
||||
|
||||
export function initAgentWorkflows() {
|
||||
registerWorkflow(WorkflowTaskType.ai_embedding, agentEmbeddingMedia)
|
||||
registerWorkflow(WorkflowTaskType.ai_transcription, transcribeVideoWorkflow)
|
||||
registerWorkflow(WorkflowTaskType.ai_metadata_autofill, agentAutofillMedia)
|
||||
registerWorkflow(WorkflowTaskType.chat, agentChat)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { LOCAL_EMBEDDING_PROVIDER } from '@shumai/core/src/search/embedding-server'
|
||||
import type { WorkflowTask } from '@shumai/db'
|
||||
import {
|
||||
ApplicationFailure,
|
||||
@@ -56,7 +57,7 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
|
||||
}
|
||||
|
||||
const { asset, chunkDuration, chunkOverlap, embeddingProvider, existingEmbeddings } = context
|
||||
const isGemmaProvider = embeddingProvider === 'gemma-embedding-2-openai'
|
||||
const isGemmaProvider = embeddingProvider === LOCAL_EMBEDDING_PROVIDER
|
||||
|
||||
const existing = existingEmbeddings || []
|
||||
|
||||
@@ -130,6 +131,7 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
|
||||
if (!alreadyEmbedded) {
|
||||
const result = await generateImageEmbeddingActivity({
|
||||
teamId: task.teamId,
|
||||
provider: embeddingProvider,
|
||||
assetKey: embeddingKey,
|
||||
mediaType: embeddingMediaType || 'image/jpeg',
|
||||
})
|
||||
@@ -195,6 +197,7 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
|
||||
// Step B: Generate embedding on agent worker
|
||||
const chunkResult = await generateVideoChunkEmbeddingActivity({
|
||||
teamId: task.teamId,
|
||||
provider: embeddingProvider,
|
||||
chunkKey: chunk.chunkKey,
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import type { WorkflowTask } from '@shumai/db'
|
||||
import { ApplicationFailure, isDbosWorkflowCancelledError } from '@shumai/workflow-core'
|
||||
import { deleteS3ObjectActivity } from '../activities/ai'
|
||||
import {
|
||||
extractTranscriptAudioActivity,
|
||||
saveTranscriptActivity,
|
||||
transcribeAudioActivity,
|
||||
reportTranscriptionFailureActivity,
|
||||
} from '../activities/transcription'
|
||||
|
||||
export async function transcribeVideoWorkflow(task: WorkflowTask): Promise<void> {
|
||||
const request = task.payload?.transcription
|
||||
if (!request) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'Missing transcription request',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
const taskId = task.id
|
||||
const assetId = task.assetId
|
||||
const teamId = task.teamId ?? undefined
|
||||
const audioKey = `temp/transcripts/${taskId}.wav`
|
||||
try {
|
||||
await extractTranscriptAudioActivity({ assetId, taskId, audioKey, teamId })
|
||||
const transcript = await transcribeAudioActivity({ taskId, audioKey, teamId, ...request })
|
||||
if (request.language && transcript.language && request.language !== transcript.language) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'Transcription returned an unexpected language',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
await saveTranscriptActivity({
|
||||
taskId,
|
||||
assetId,
|
||||
model: request.model,
|
||||
language: transcript.language,
|
||||
segments: transcript.segments.map((segment) => ({
|
||||
startMs: Math.round(segment.start * 1000),
|
||||
endMs: Math.round(segment.end * 1000),
|
||||
text: segment.text,
|
||||
})),
|
||||
})
|
||||
} catch (error) {
|
||||
if (!isDbosWorkflowCancelledError(error)) {
|
||||
try {
|
||||
await reportTranscriptionFailureActivity(
|
||||
taskId,
|
||||
error instanceof Error ? error.message : undefined,
|
||||
)
|
||||
} catch (commentError) {
|
||||
logger.error({ err: commentError, taskId }, 'Failed to post transcript failure comment')
|
||||
}
|
||||
}
|
||||
throw error
|
||||
} finally {
|
||||
try {
|
||||
await deleteS3ObjectActivity({ key: audioKey })
|
||||
} catch (error) {
|
||||
logger.error({ err: error, taskId, audioKey }, 'Failed to delete staged transcript audio')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
"types": "./src/index.ts",
|
||||
"dependencies": {
|
||||
"@better-auth/mcp": "1.7.12",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@hono/zod-validator": "0.7.6",
|
||||
"@modelcontextprotocol/server": "2.0.0",
|
||||
"@shumai/core": "workspace:*",
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import type { EntryRecord } from '@earendil-works/pi-durable'
|
||||
import type { AgentSessionLogs } from '@shumai/dtos'
|
||||
import type { TypedResponse } from 'hono'
|
||||
|
||||
/** Pi records are already JSON; retain their public types without recursively remapping SDK schemas. */
|
||||
export function agentEntriesResponse(
|
||||
entries: EntryRecord[],
|
||||
): Response & TypedResponse<EntryRecord[], 200, 'json'> {
|
||||
return new Response(JSON.stringify(entries), {
|
||||
export function agentEntriesResponse<T extends EntryRecord[] | AgentSessionLogs>(
|
||||
body: T,
|
||||
): Response & TypedResponse<T, 200, 'json'> {
|
||||
return new Response(JSON.stringify(body), {
|
||||
headers: { 'Content-Type': 'application/json; charset=UTF-8' },
|
||||
}) as Response & TypedResponse<EntryRecord[], 200, 'json'>
|
||||
}) as Response & TypedResponse<T, 200, 'json'>
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ import { ROOT_CONVERSATION_ID, type EntryId, type EntryRecord } from '@earendil-
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
import { agentSessionService } from '@shumai/core/src/agent/session-service'
|
||||
import { authzService } from '@shumai/core/src/authz/authz'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import type { AgentInfo } from '@shumai/dtos'
|
||||
import app from './agent'
|
||||
|
||||
vi.mock('@shumai/core/src/agent/agent')
|
||||
vi.mock('@shumai/core/src/agent/session-service')
|
||||
vi.mock('@shumai/core/src/authz/authz')
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
@@ -69,6 +71,36 @@ describe('Agent API', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it.each(['true', 'false'])(
|
||||
'protects the Transcript Agent when ENABLE_TRANSCRIPTION_AGENT=%s',
|
||||
async (value) => {
|
||||
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', value)
|
||||
try {
|
||||
vi.mocked(agentService.getAgent).mockResolvedValue({
|
||||
id: 'transcript1',
|
||||
teamId: 'team1',
|
||||
type: 'transcription',
|
||||
} as Awaited<ReturnType<typeof agentService.getAgent>>)
|
||||
const payload = JSON.stringify({ type: 'transcription', name: 'Transcript Agent' })
|
||||
const headers = { 'Content-Type': 'application/json' }
|
||||
for (const [path, method, body] of [
|
||||
['/teams/team1/agents', 'POST', payload],
|
||||
['/agents/transcript1', 'PUT', payload],
|
||||
['/agents/transcript1/permission', 'PATCH', JSON.stringify({ permission: 'editor' })],
|
||||
['/agents/transcript1', 'DELETE', undefined],
|
||||
] as const) {
|
||||
expect((await app.request(path, { method, headers, body })).status).toBe(403)
|
||||
}
|
||||
expect(agentService.createAgent).not.toHaveBeenCalled()
|
||||
expect(agentService.updateAgent).not.toHaveBeenCalled()
|
||||
expect(agentService.updateAgentPermission).not.toHaveBeenCalled()
|
||||
expect(agentService.deleteAgent).not.toHaveBeenCalled()
|
||||
} finally {
|
||||
vi.unstubAllEnvs()
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
describe('GET /teams/:teamId/agents', () => {
|
||||
it('returns list of agents', async () => {
|
||||
const mockAgents = [
|
||||
@@ -352,15 +384,16 @@ describe('Agent API', () => {
|
||||
})
|
||||
|
||||
describe('GET /agent-sessions/:sessionId/entries', () => {
|
||||
const mockEntries: EntryRecord[] = [
|
||||
{
|
||||
id: 7 as EntryId,
|
||||
conversationId: ROOT_CONVERSATION_ID,
|
||||
kind: 'pi.user',
|
||||
model: [{ role: 'user', content: 'Step 1', timestamp: 1 }],
|
||||
},
|
||||
]
|
||||
|
||||
it('returns entries of agent session if user is admin', async () => {
|
||||
const mockEntries: EntryRecord[] = [
|
||||
{
|
||||
id: 7 as EntryId,
|
||||
conversationId: ROOT_CONVERSATION_ID,
|
||||
kind: 'pi.user',
|
||||
model: [{ role: 'user', content: 'Step 1', timestamp: 1 }],
|
||||
},
|
||||
]
|
||||
vi.mocked(agentService.getSessionEntries).mockResolvedValue(mockEntries)
|
||||
|
||||
const res = await app.request('/agent-sessions/session1/entries', {
|
||||
@@ -373,6 +406,7 @@ describe('Agent API', () => {
|
||||
expect(data[0].id).toBe(7)
|
||||
expect(data[0].kind).toBe('pi.user')
|
||||
expect(data[0].model[0].content).toBe('Step 1')
|
||||
expect(agentSessionService.getLogs).not.toHaveBeenCalled()
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: undefined,
|
||||
permission: 'Admin',
|
||||
@@ -381,6 +415,51 @@ describe('Agent API', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it.each([
|
||||
{
|
||||
inputTokens: 12800,
|
||||
outputTokens: 1580,
|
||||
cacheReadTokens: 10000,
|
||||
totalTokens: 24380,
|
||||
cost: 0.014,
|
||||
},
|
||||
null,
|
||||
])('includes requested usage with the session entries (%j)', async (usage) => {
|
||||
vi.mocked(agentSessionService.getLogs).mockResolvedValue({ entries: mockEntries, usage })
|
||||
|
||||
const res = await app.request('/agent-sessions/session1/entries?includeUsage=true')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(await res.json()).toEqual({ entries: mockEntries, usage })
|
||||
expect(agentSessionService.getLogs).toHaveBeenCalledWith('session1')
|
||||
expect(agentService.getSessionEntries).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('checks session admin permission before loading requested usage', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockRejectedValue(
|
||||
new HTTPException(403, { message: 'Forbidden' }),
|
||||
)
|
||||
|
||||
const res = await app.request('/agent-sessions/session1/entries?includeUsage=true')
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: undefined,
|
||||
permission: 'Admin',
|
||||
type: 'agentSession',
|
||||
id: 'session1',
|
||||
})
|
||||
expect(agentSessionService.getLogs).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects invalid includeUsage values', async () => {
|
||||
const res = await app.request('/agent-sessions/session1/entries?includeUsage=invalid')
|
||||
|
||||
expect(res.status).toBe(400)
|
||||
expect(agentSessionService.getLogs).not.toHaveBeenCalled()
|
||||
expect(agentService.getSessionEntries).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('denies access if user is not admin', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockRejectedValue(new Error('Forbidden'))
|
||||
|
||||
|
||||
+37
-36
@@ -1,5 +1,7 @@
|
||||
import { zValidator } from '@hono/zod-validator'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
import { getSystemAgentSetting } from '@shumai/core/src/agent/system-agents'
|
||||
import { agentSessionService } from '@shumai/core/src/agent/session-service'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import {
|
||||
AgentInfo,
|
||||
@@ -11,6 +13,7 @@ import {
|
||||
} from '@shumai/dtos'
|
||||
import { Hono } from 'hono'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { z } from 'zod'
|
||||
import { agentEntriesResponse } from './agent-entries'
|
||||
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
@@ -18,6 +21,8 @@ import type { Prisma } from '@shumai/db'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
|
||||
const sessionEntriesQuerySchema = z.object({ includeUsage: z.enum(['true', 'false']).optional() })
|
||||
|
||||
const route = new Hono<{ Variables: { user: User } }>()
|
||||
.get('/teams/:teamId/agents', async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
@@ -64,13 +69,10 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const isEmbeddingManagedByEnv =
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'true' ||
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'false'
|
||||
|
||||
if (req.type === 'embedding' && isEmbeddingManagedByEnv) {
|
||||
const managedSetting = getSystemAgentSetting(req.type)
|
||||
if (managedSetting) {
|
||||
throw new HTTPException(403, {
|
||||
message: 'Embedding agent is managed by environment configuration and cannot be created',
|
||||
message: `${managedSetting.name} is managed by environment configuration and cannot be created`,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -104,14 +106,13 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: agentId,
|
||||
})
|
||||
|
||||
const isEmbeddingManagedByEnv =
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'true' ||
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'false'
|
||||
|
||||
const existingAgent = await agentService.getAgent({ agentId })
|
||||
if (existingAgent?.type === 'embedding' && isEmbeddingManagedByEnv) {
|
||||
const managedSetting =
|
||||
(existingAgent && getSystemAgentSetting(existingAgent.type)) ??
|
||||
getSystemAgentSetting(req.type)
|
||||
if (managedSetting) {
|
||||
throw new HTTPException(403, {
|
||||
message: 'Embedding agent is managed by environment configuration and cannot be modified',
|
||||
message: `${managedSetting.name} is managed by environment configuration and cannot be modified`,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -146,14 +147,11 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: agentId,
|
||||
})
|
||||
|
||||
const isEmbeddingManagedByEnv =
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'true' ||
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'false'
|
||||
|
||||
const existingAgent = await agentService.getAgent({ agentId })
|
||||
if (existingAgent?.type === 'embedding' && isEmbeddingManagedByEnv) {
|
||||
const managedSetting = existingAgent && getSystemAgentSetting(existingAgent.type)
|
||||
if (managedSetting) {
|
||||
throw new HTTPException(403, {
|
||||
message: 'Embedding agent is managed by environment configuration and cannot be modified',
|
||||
message: `${managedSetting.name} is managed by environment configuration and cannot be modified`,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -182,14 +180,11 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: agentId,
|
||||
})
|
||||
|
||||
const isEmbeddingManagedByEnv =
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'true' ||
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'false'
|
||||
|
||||
const existingAgent = await agentService.getAgent({ agentId })
|
||||
if (existingAgent?.type === 'embedding' && isEmbeddingManagedByEnv) {
|
||||
const managedSetting = existingAgent && getSystemAgentSetting(existingAgent.type)
|
||||
if (managedSetting) {
|
||||
throw new HTTPException(403, {
|
||||
message: 'Embedding agent is managed by environment configuration and cannot be deleted',
|
||||
message: `${managedSetting.name} is managed by environment configuration and cannot be deleted`,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -208,20 +203,26 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
|
||||
return new Response(null, { status: 204 })
|
||||
})
|
||||
.get('/agent-sessions/:sessionId/entries', async (c) => {
|
||||
const sessionId = c.req.param('sessionId')
|
||||
const userReq = c.get('user')
|
||||
.get(
|
||||
'/agent-sessions/:sessionId/entries',
|
||||
zValidator('query', sessionEntriesQuerySchema),
|
||||
async (c) => {
|
||||
const sessionId = c.req.param('sessionId')
|
||||
const userReq = c.get('user')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user: userReq,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.AgentSession,
|
||||
id: sessionId,
|
||||
})
|
||||
await authzService.hasPermission({
|
||||
user: userReq,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.AgentSession,
|
||||
id: sessionId,
|
||||
})
|
||||
|
||||
const entries = await agentService.getSessionEntries({ sessionId })
|
||||
return agentEntriesResponse(entries)
|
||||
})
|
||||
if (c.req.valid('query').includeUsage === 'true') {
|
||||
return agentEntriesResponse(await agentSessionService.getLogs(sessionId))
|
||||
}
|
||||
return agentEntriesResponse(await agentService.getSessionEntries({ sessionId }))
|
||||
},
|
||||
)
|
||||
.get('/teams/:teamId/agent-sessions', zValidator('query', paginationParamsSchema), async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
const userReq = c.get('user')
|
||||
|
||||
@@ -2,6 +2,7 @@ import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { Hono } from 'hono'
|
||||
import authnRoute from './authn'
|
||||
import { teamService } from '@shumai/core/src/team/team'
|
||||
import { transcriptService } from '@shumai/core/src/transcript/transcript'
|
||||
|
||||
describe('authn api', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
@@ -13,9 +14,11 @@ describe('authn api', () => {
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
vi.unstubAllEnvs()
|
||||
})
|
||||
|
||||
it('GET /signup-info', async () => {
|
||||
vi.spyOn(transcriptService, 'isGenerationEnabled').mockResolvedValue(false)
|
||||
mockGetSignupInfo.mockResolvedValue({
|
||||
initialized: true,
|
||||
demoMode: false,
|
||||
@@ -29,6 +32,16 @@ describe('authn api', () => {
|
||||
initialized: true,
|
||||
demoMode: false,
|
||||
archiveStorageEnabled: false,
|
||||
transcriptionEnabled: false,
|
||||
})
|
||||
})
|
||||
|
||||
it('advertises transcription when generation is enabled', async () => {
|
||||
vi.spyOn(transcriptService, 'isGenerationEnabled').mockResolvedValue(true)
|
||||
mockGetSignupInfo.mockResolvedValue({ initialized: true, demoMode: false })
|
||||
|
||||
const res = await new Hono().route('/', authnRoute).request('/signup-info')
|
||||
|
||||
expect(await res.json()).toMatchObject({ transcriptionEnabled: true })
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,6 +4,7 @@ import { userService } from '@shumai/core/src/user/user'
|
||||
import { auth } from '@shumai/core/src/auth/auth'
|
||||
import { createGuestToken } from '@shumai/core/src/auth/guest-token'
|
||||
import { isArchiveStorageEnabled } from '@shumai/core/src/s3/archive-storage'
|
||||
import { transcriptService } from '@shumai/core/src/transcript/transcript'
|
||||
import { z } from 'zod'
|
||||
import { zValidator } from '@hono/zod-validator'
|
||||
import { ulid } from 'ulid'
|
||||
@@ -24,6 +25,7 @@ const route = app
|
||||
initialized: info.initialized,
|
||||
demoMode: info.demoMode,
|
||||
archiveStorageEnabled: isArchiveStorageEnabled(),
|
||||
transcriptionEnabled: await transcriptService.isGenerationEnabled(),
|
||||
})
|
||||
})
|
||||
.get('/me', async (c) => {
|
||||
|
||||
@@ -31,6 +31,7 @@ import versionStackRoute from './versionStack'
|
||||
import kanbanRoute from './kanban'
|
||||
import mediaGenerationRoute from './media-generation'
|
||||
import runnerWsRoute, { runnerWebsocket } from './runner-ws'
|
||||
import transcriptRoute from './transcript'
|
||||
|
||||
export { runnerWebsocket }
|
||||
|
||||
@@ -72,6 +73,7 @@ const apiRoute = new Hono<{ Variables: { user: User } }>()
|
||||
.route('/', teamRoute)
|
||||
.route('/', versionStackRoute)
|
||||
.route('/', fileRoute)
|
||||
.route('/', transcriptRoute)
|
||||
.route('/', folderRoute)
|
||||
.route('/', agentRoute)
|
||||
.route('/', chatRoute)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest'
|
||||
import { Hono, type Context, type Next } from 'hono'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import providerRoute from './provider'
|
||||
import { providerService } from '@shumai/core/src/provider/provider'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
@@ -34,6 +35,7 @@ describe('provider api', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
vi.clearAllMocks()
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue(undefined)
|
||||
})
|
||||
|
||||
@@ -320,78 +322,57 @@ describe('provider api', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /teams/:teamId/providers/sync-check checks for updates', async () => {
|
||||
vi.mocked(providerService.checkUpdates).mockResolvedValue({
|
||||
providers: [
|
||||
{
|
||||
name: 'deepseek',
|
||||
isNewProvider: true,
|
||||
config: { api: 'openai-responses', apiKey: 'DEEPSEEK_API_KEY' },
|
||||
models: [],
|
||||
},
|
||||
],
|
||||
totalNewProviders: 1,
|
||||
totalNewModels: 0,
|
||||
})
|
||||
const modelsPath = '/teams/t1/providers/p1/models'
|
||||
const providerUpdatedAt = '2026-11-29T09:15:00.000Z'
|
||||
const selection = {
|
||||
providerUpdatedAt,
|
||||
modelIds: ['test-model'],
|
||||
}
|
||||
const importRequest = {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(selection),
|
||||
}
|
||||
|
||||
const res = await app.request('/teams/t1/providers/sync-check', {
|
||||
method: 'POST',
|
||||
it('previews refresh results for the requested provider as a team admin', async () => {
|
||||
vi.mocked(providerService.refreshModels).mockResolvedValue({
|
||||
status: 'ready',
|
||||
providerUpdatedAt,
|
||||
models: [],
|
||||
})
|
||||
|
||||
const res = await app.request(modelsPath + '/refresh', { method: 'POST' })
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.totalNewProviders).toBe(1)
|
||||
expect(data.providers).toHaveLength(1)
|
||||
expect(providerService.checkUpdates).toHaveBeenCalledWith('t1')
|
||||
expect(res.headers.get('Cache-Control')).toBe('no-store')
|
||||
expect(await res.json()).toEqual({ status: 'ready', providerUpdatedAt, models: [] })
|
||||
expect(providerService.refreshModels).toHaveBeenCalledWith('t1', 'p1')
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: expect.anything(),
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
})
|
||||
expect(auditLogService.logAction).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('POST /teams/:teamId/providers/sync-apply applies sync selection', async () => {
|
||||
vi.mocked(providerService.applySync).mockResolvedValue({
|
||||
addedProviders: 1,
|
||||
addedModels: 3,
|
||||
})
|
||||
|
||||
const payload = {
|
||||
providers: [
|
||||
{
|
||||
name: 'deepseek',
|
||||
isNewProvider: true,
|
||||
config: { api: 'openai-responses', apiKey: 'KEY' },
|
||||
models: [
|
||||
{
|
||||
modelId: 'deepseek-v4-flash',
|
||||
name: 'DeepSeek V4 Flash',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: true,
|
||||
input: ['text'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const res = await app.request('/teams/t1/providers/sync-apply', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload),
|
||||
it('returns the server reason for an unavailable refresh', async () => {
|
||||
vi.mocked(providerService.refreshModels).mockResolvedValue({
|
||||
status: 'unavailable',
|
||||
reason: 'catalog_unavailable',
|
||||
})
|
||||
|
||||
const res = await app.request(modelsPath + '/refresh', { method: 'POST' })
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.addedProviders).toBe(1)
|
||||
expect(data.addedModels).toBe(3)
|
||||
expect(providerService.applySync).toHaveBeenCalledWith('t1', payload)
|
||||
expect(await res.json()).toEqual({ status: 'unavailable', reason: 'catalog_unavailable' })
|
||||
})
|
||||
|
||||
it('imports the selection into the scoped provider and records its audit entry', async () => {
|
||||
vi.mocked(providerService.importModels).mockResolvedValue({ addedModels: 1 })
|
||||
|
||||
const res = await app.request(modelsPath + '/import', importRequest)
|
||||
expect(res.status).toBe(200)
|
||||
expect(await res.json()).toEqual({ addedModels: 1 })
|
||||
expect(providerService.importModels).toHaveBeenCalledWith('t1', 'p1', selection)
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: expect.anything(),
|
||||
permission: Permission.Admin,
|
||||
@@ -402,6 +383,36 @@ describe('provider api', () => {
|
||||
action: 'provider_update',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
itemId: 'p1',
|
||||
})
|
||||
})
|
||||
|
||||
it('skips the audit entry when the selected models already exist', async () => {
|
||||
vi.mocked(providerService.importModels).mockResolvedValue({ addedModels: 0 })
|
||||
const res = await app.request(modelsPath + '/import', importRequest)
|
||||
expect(res.status).toBe(200)
|
||||
expect(await res.json()).toEqual({ addedModels: 0 })
|
||||
expect(auditLogService.logAction).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects requests without team-admin permission before looking up the provider', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockRejectedValue(new HTTPException(403))
|
||||
const refresh = await app.request(modelsPath + '/refresh', { method: 'POST' })
|
||||
const apply = await app.request(modelsPath + '/import', importRequest)
|
||||
expect(refresh.status).toBe(403)
|
||||
expect(apply.status).toBe(403)
|
||||
expect(providerService.refreshModels).not.toHaveBeenCalled()
|
||||
expect(providerService.importModels).not.toHaveBeenCalled()
|
||||
expect(auditLogService.logAction).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects an empty import selection before performing a write', async () => {
|
||||
const res = await app.request(modelsPath + '/import', {
|
||||
...importRequest,
|
||||
body: JSON.stringify({ providerUpdatedAt, modelIds: [] }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(400)
|
||||
expect(providerService.importModels).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,7 +5,7 @@ import { providerService } from '@shumai/core/src/provider/provider'
|
||||
import {
|
||||
createModelRequestSchema,
|
||||
createProviderRequestSchema,
|
||||
syncApplyRequestSchema,
|
||||
importProviderModelsRequestSchema,
|
||||
updateModelRequestSchema,
|
||||
updateProviderRequestSchema,
|
||||
AuditAction,
|
||||
@@ -31,8 +31,8 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
return c.json(providers)
|
||||
})
|
||||
|
||||
.post('/teams/:teamId/providers/sync-check', async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
.post('/teams/:teamId/providers/:providerId/models/refresh', async (c) => {
|
||||
const { teamId, providerId } = c.req.param()
|
||||
const user = c.get('user')
|
||||
|
||||
await authzService.hasPermission({
|
||||
@@ -42,15 +42,16 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const result = await providerService.checkUpdates(teamId)
|
||||
const result = await providerService.refreshModels(teamId, providerId)
|
||||
c.header('Cache-Control', 'no-store')
|
||||
return c.json(result)
|
||||
})
|
||||
|
||||
.post(
|
||||
'/teams/:teamId/providers/sync-apply',
|
||||
zValidator('json', syncApplyRequestSchema),
|
||||
'/teams/:teamId/providers/:providerId/models/import',
|
||||
zValidator('json', importProviderModelsRequestSchema),
|
||||
async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
const { teamId, providerId } = c.req.param()
|
||||
const user = c.get('user')
|
||||
const body = c.req.valid('json')
|
||||
|
||||
@@ -61,12 +62,15 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const result = await providerService.applySync(teamId, body)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.provider_update,
|
||||
teamId,
|
||||
userId: user?.id,
|
||||
})
|
||||
const result = await providerService.importModels(teamId, providerId, body)
|
||||
if (result.addedModels > 0) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.provider_update,
|
||||
teamId,
|
||||
userId: user?.id,
|
||||
itemId: providerId,
|
||||
})
|
||||
}
|
||||
return c.json(result)
|
||||
},
|
||||
)
|
||||
|
||||
+119
-139
@@ -1,168 +1,148 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { basename, dirname, join } from 'node:path'
|
||||
import { Hono } from 'hono'
|
||||
|
||||
const { mockServeStatic } = vi.hoisted(() => ({
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
mockServeStatic: vi.fn<(args: any) => any>(() => (c: any) => c.text('static-file')),
|
||||
}))
|
||||
|
||||
vi.mock('hono/bun', () => ({
|
||||
serveStatic: mockServeStatic,
|
||||
}))
|
||||
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { signLocalGetUrl } from '@shumai/core/src/s3/s3'
|
||||
import route from './s3'
|
||||
|
||||
describe('S3 API', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
vi.resetModules()
|
||||
const app = new Hono().route('/files', route)
|
||||
const bucket = 'test-bucket'
|
||||
const body = 'inert file contents'
|
||||
let originalDir: string
|
||||
let storageDir: string
|
||||
|
||||
beforeAll(async () => {
|
||||
originalDir = process.cwd()
|
||||
storageDir = await mkdtemp(join(tmpdir(), 'shumai-local-file-test-'))
|
||||
process.chdir(storageDir)
|
||||
})
|
||||
|
||||
it('GET /files/* calls serveStatic with correct options when valid signature is provided', async () => {
|
||||
const { signLocalGetUrl } = await import('@shumai/core/src/s3/s3')
|
||||
const { signature, expires } = signLocalGetUrl('b1', 'test.webp')
|
||||
afterAll(async () => {
|
||||
process.chdir(originalDir)
|
||||
await rm(storageDir, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
const { default: route } = await import('./s3')
|
||||
const app = new Hono().route('/files', route)
|
||||
beforeEach(() => {
|
||||
vi.stubEnv('STORAGE_BACKEND', 'local')
|
||||
})
|
||||
|
||||
const res = await app.request(`/files/b1/test.webp?Signature=${signature}&Expires=${expires}`)
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs()
|
||||
})
|
||||
|
||||
function signedPath(key: string, query: Record<string, string> = {}, lifetime?: number) {
|
||||
const { signature, expires } = signLocalGetUrl(bucket, key, lifetime)
|
||||
const params = new URLSearchParams({ Signature: signature, Expires: String(expires), ...query })
|
||||
return `/files/${bucket}/${key}?${params}`
|
||||
}
|
||||
|
||||
async function writeStoredFile(key: string) {
|
||||
const path = join(storageDir, 'data', bucket, key)
|
||||
await mkdir(dirname(path), { recursive: true })
|
||||
await writeFile(path, body)
|
||||
}
|
||||
|
||||
it.each([
|
||||
['files/a/poster.WEBP', 'image/webp'],
|
||||
['files/a/proxy.pdf', 'application/pdf'],
|
||||
['files/a/video.mp4', 'video/mp4'],
|
||||
['files/a/stream.m3u8', 'application/vnd.apple.mpegurl'],
|
||||
['files/a/segment.m4s', 'video/iso.segment'],
|
||||
['files/a/model.glb', 'model/gltf-binary'],
|
||||
])('serves %s inline with its media type', async (key, mimeType) => {
|
||||
await writeStoredFile(key)
|
||||
const res = await app.request(signedPath(key))
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(await res.text()).toBe('static-file')
|
||||
expect(mockServeStatic).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
root: './data',
|
||||
rewriteRequestPath: expect.any(Function),
|
||||
}),
|
||||
expect(res.headers.get('Content-Type')).toBe(mimeType)
|
||||
expect(res.headers.get('Content-Disposition')).toBeNull()
|
||||
expect(res.headers.get('X-Content-Type-Options')).toBe('nosniff')
|
||||
expect(await res.text()).toBe(body)
|
||||
})
|
||||
|
||||
it.each([
|
||||
'files/a/original.html',
|
||||
'attachments/a/notes.HTML',
|
||||
'attachments/a/diagram.svg',
|
||||
'kanban/attachments/team/user/a/notes.html',
|
||||
'kanban/attachments/team/user/a/diagram.svg',
|
||||
'files/a/document.xhtml',
|
||||
'files/a/source.js',
|
||||
'files/a/unknown.ext',
|
||||
'files/a/extensionless',
|
||||
])('serves %s as a download even without a download request', async (key) => {
|
||||
await writeStoredFile(key)
|
||||
const res = await app.request(signedPath(key))
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(res.headers.get('Content-Type')).toBe('application/octet-stream')
|
||||
const filename = basename(key)
|
||||
expect(res.headers.get('Content-Disposition')).toBe(
|
||||
`attachment; filename="${filename}"; filename*=UTF-8''${filename}`,
|
||||
)
|
||||
|
||||
// Verify rewriteRequestPath logic
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const options = vi.mocked(mockServeStatic).mock.calls[0][0] as any
|
||||
if (options && options.rewriteRequestPath) {
|
||||
expect(options.rewriteRequestPath('/files/b1/test.webp')).toBe('b1/test.webp')
|
||||
}
|
||||
expect(res.headers.get('X-Content-Type-Options')).toBe('nosniff')
|
||||
expect(res.headers.get('Content-Security-Policy')).toBe('sandbox')
|
||||
expect(await res.text()).toBe(body)
|
||||
})
|
||||
|
||||
it('GET /files/* returns 403 Forbidden when signature is missing', async () => {
|
||||
const { default: route } = await import('./s3')
|
||||
const app = new Hono().route('/files', route)
|
||||
it('uses the stored file type when an explicit download has a different filename', async () => {
|
||||
const key = 'attachments/a/diagram.svg'
|
||||
await writeStoredFile(key)
|
||||
const res = await app.request(signedPath(key, { download: '1', filename: '図.png' }))
|
||||
|
||||
const res = await app.request('/files/b1/test.webp')
|
||||
expect(res.status).toBe(403)
|
||||
const json = await res.json()
|
||||
expect(json.error).toContain('Forbidden')
|
||||
})
|
||||
|
||||
it('GET /files/* returns 403 Forbidden when signature is invalid', async () => {
|
||||
const { default: route } = await import('./s3')
|
||||
const app = new Hono().route('/files', route)
|
||||
|
||||
const res = await app.request('/files/b1/test.webp?Signature=invalidsig&Expires=9999999999')
|
||||
expect(res.status).toBe(403)
|
||||
})
|
||||
|
||||
it('GET /files/* returns 403 Forbidden when signature is expired', async () => {
|
||||
const { signLocalGetUrl } = await import('@shumai/core/src/s3/s3')
|
||||
// Signed with -10 seconds (expired)
|
||||
const { signature, expires } = signLocalGetUrl('b1', 'test.webp', -10)
|
||||
|
||||
const { default: route } = await import('./s3')
|
||||
const app = new Hono().route('/files', route)
|
||||
|
||||
const res = await app.request(`/files/b1/test.webp?Signature=${signature}&Expires=${expires}`)
|
||||
expect(res.status).toBe(403)
|
||||
})
|
||||
|
||||
it('GET /files/* sets Content-Disposition with filename when download=1 & filename query params are present', async () => {
|
||||
const { signLocalGetUrl } = await import('@shumai/core/src/s3/s3')
|
||||
const { signature, expires } = signLocalGetUrl('b1', 'test.webp')
|
||||
|
||||
// We need to capture the onFound callback from serveStatic options
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let onFoundCallback: ((path: string, c: any) => void) | undefined
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
mockServeStatic.mockImplementationOnce((options: any) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
onFoundCallback = (options as any).onFound
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return (c: any) => c.text('static-file')
|
||||
})
|
||||
|
||||
const { default: route } = await import('./s3')
|
||||
const app = new Hono().route('/files', route)
|
||||
|
||||
await app.request(
|
||||
`/files/b1/test.webp?Signature=${signature}&Expires=${expires}&download=1&filename=foo.png`,
|
||||
expect(res.status).toBe(200)
|
||||
expect(res.headers.get('Content-Type')).toBe('application/octet-stream')
|
||||
expect(res.headers.get('Content-Disposition')).toBe(
|
||||
"attachment; filename*=UTF-8''%E5%9B%B3.png",
|
||||
)
|
||||
expect(res.headers.get('Content-Security-Policy')).toBe('sandbox')
|
||||
})
|
||||
|
||||
expect(onFoundCallback).toBeDefined()
|
||||
it('honors explicit downloads of inline formats with and without a filename', async () => {
|
||||
const key = 'files/a/preview.webp'
|
||||
await writeStoredFile(key)
|
||||
|
||||
// Test with download=1 and filename
|
||||
const mockContextWithDownload = {
|
||||
req: {
|
||||
query: (key: string) =>
|
||||
key === 'download' ? '1' : key === 'filename' ? 'foo.png' : undefined,
|
||||
},
|
||||
header: vi.fn(),
|
||||
}
|
||||
const withName = await app.request(signedPath(key, { download: '1', filename: 'image.webp' }))
|
||||
expect(withName.status).toBe(200)
|
||||
expect(withName.headers.get('Content-Disposition')).toBe(
|
||||
'attachment; filename="image.webp"; filename*=UTF-8\'\'image.webp',
|
||||
)
|
||||
expect(withName.headers.get('Content-Type')).toBe('image/webp')
|
||||
|
||||
if (onFoundCallback) {
|
||||
onFoundCallback('/files/b1/test.webp', mockContextWithDownload)
|
||||
expect(mockContextWithDownload.header).toHaveBeenCalledWith(
|
||||
'Content-Disposition',
|
||||
'attachment; filename="foo.png"; filename*=UTF-8\'\'foo.png',
|
||||
)
|
||||
}
|
||||
const withoutName = await app.request(signedPath(key, { download: '1' }))
|
||||
expect(withoutName.status).toBe(200)
|
||||
expect(withoutName.headers.get('Content-Disposition')).toBe('attachment')
|
||||
})
|
||||
|
||||
// Test with download=1 but no filename
|
||||
const mockContextDownloadNoFilename = {
|
||||
req: { query: (key: string) => (key === 'download' ? '1' : undefined) },
|
||||
header: vi.fn(),
|
||||
}
|
||||
it('returns 403 when a signature is missing, invalid, or expired', async () => {
|
||||
const key = 'files/a/preview.webp'
|
||||
const responses = await Promise.all([
|
||||
app.request(`/files/${bucket}/${key}`),
|
||||
app.request(signedPath(key, { Signature: 'invalid' })),
|
||||
app.request(signedPath(key, {}, -10)),
|
||||
])
|
||||
|
||||
if (onFoundCallback) {
|
||||
onFoundCallback('/files/b1/test.webp', mockContextDownloadNoFilename)
|
||||
expect(mockContextDownloadNoFilename.header).toHaveBeenCalledWith(
|
||||
'Content-Disposition',
|
||||
'attachment',
|
||||
)
|
||||
}
|
||||
|
||||
// Test without download param
|
||||
const mockContextWithout = {
|
||||
req: { query: () => undefined },
|
||||
header: vi.fn(),
|
||||
}
|
||||
|
||||
if (onFoundCallback) {
|
||||
onFoundCallback('/files/b1/test.webp', mockContextWithout)
|
||||
expect(mockContextWithout.header).not.toHaveBeenCalled()
|
||||
for (const res of responses) {
|
||||
expect(res.status).toBe(403)
|
||||
expect(await res.json()).toMatchObject({ error: expect.stringContaining('Forbidden') })
|
||||
}
|
||||
})
|
||||
|
||||
it('PUT /files/:bucket/:key returns 404', async () => {
|
||||
const { default: route } = await import('./s3')
|
||||
const app = new Hono().route('/files', route)
|
||||
const body = new TextEncoder().encode('test-data')
|
||||
|
||||
const res = await app.request('/files/b1/test.webp', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'content-length': body.byteLength.toString(),
|
||||
},
|
||||
body,
|
||||
})
|
||||
|
||||
it('returns 404 for a validly signed missing file', async () => {
|
||||
const res = await app.request(signedPath('files/a/missing.webp'))
|
||||
expect(res.status).toBe(404)
|
||||
})
|
||||
|
||||
it('GET /files/* returns 404 when STORAGE_BACKEND is not local', async () => {
|
||||
const s3Module = await import('@shumai/core/src/s3/s3')
|
||||
vi.spyOn(s3Module, 'getStorageBackend').mockReturnValue('s3')
|
||||
it('returns 404 for PUT /files/:bucket/:key', async () => {
|
||||
const res = await app.request(signedPath('files/a/preview.webp'), { method: 'PUT', body })
|
||||
expect(res.status).toBe(404)
|
||||
})
|
||||
|
||||
const { default: route } = await import('./s3')
|
||||
const app = new Hono().route('/files', route)
|
||||
|
||||
const res = await app.request('/files/b1/test.webp')
|
||||
it('returns 404 for local URLs when the storage backend is S3', async () => {
|
||||
vi.stubEnv('STORAGE_BACKEND', 's3')
|
||||
const res = await app.request(signedPath('files/a/preview.webp'))
|
||||
expect(res.status).toBe(404)
|
||||
})
|
||||
})
|
||||
|
||||
+39
-3
@@ -1,3 +1,4 @@
|
||||
import { basename, extname } from 'node:path'
|
||||
import { Hono } from 'hono'
|
||||
import {
|
||||
buildContentDisposition,
|
||||
@@ -6,6 +7,32 @@ import {
|
||||
} from '@shumai/core/src/s3/s3'
|
||||
import { serveStatic } from 'hono/bun'
|
||||
|
||||
// Only serve formats used by preview and media clients inline on the app origin.
|
||||
const inlineFileTypes = new Map([
|
||||
['.aac', 'audio/aac'],
|
||||
['.avif', 'image/avif'],
|
||||
['.bmp', 'image/bmp'],
|
||||
['.gif', 'image/gif'],
|
||||
['.glb', 'model/gltf-binary'],
|
||||
['.gltf', 'model/gltf+json'],
|
||||
['.ico', 'image/x-icon'],
|
||||
['.jpeg', 'image/jpeg'],
|
||||
['.jpg', 'image/jpeg'],
|
||||
['.m3u8', 'application/vnd.apple.mpegurl'],
|
||||
['.m4a', 'audio/mp4'],
|
||||
['.m4s', 'video/iso.segment'],
|
||||
['.mp3', 'audio/mpeg'],
|
||||
['.mp4', 'video/mp4'],
|
||||
['.ogg', 'audio/ogg'],
|
||||
['.opus', 'audio/opus'],
|
||||
['.pdf', 'application/pdf'],
|
||||
['.png', 'image/png'],
|
||||
['.ts', 'video/mp2t'],
|
||||
['.wav', 'audio/wav'],
|
||||
['.webm', 'video/webm'],
|
||||
['.webp', 'image/webp'],
|
||||
])
|
||||
|
||||
const route = new Hono()
|
||||
.use('*', async (c, next) => {
|
||||
if (getStorageBackend() !== 'local') {
|
||||
@@ -36,9 +63,18 @@ const route = new Hono()
|
||||
serveStatic({
|
||||
root: './data',
|
||||
rewriteRequestPath: (path) => path.replace(/^\/files\//, ''),
|
||||
onFound: (_path, c) => {
|
||||
if (c.req.query('download') === '1') {
|
||||
c.header('Content-Disposition', buildContentDisposition(c.req.query('filename')))
|
||||
onFound: (path, c) => {
|
||||
const inlineType = inlineFileTypes.get(extname(path).toLowerCase())
|
||||
c.header('Content-Type', inlineType ?? 'application/octet-stream')
|
||||
c.header('X-Content-Type-Options', 'nosniff')
|
||||
|
||||
if (!inlineType) {
|
||||
c.header('Content-Security-Policy', 'sandbox')
|
||||
}
|
||||
|
||||
if (!inlineType || c.req.query('download') === '1') {
|
||||
const filename = c.req.query('filename') ?? (inlineType ? undefined : basename(path))
|
||||
c.header('Content-Disposition', buildContentDisposition(filename))
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -6,6 +6,8 @@ import { authMiddleware } from './middleware/auth'
|
||||
import { teamService } from '@shumai/core/src/team/team'
|
||||
import { userMetadataService } from '@shumai/core/src/user-metadata/user-metadata'
|
||||
import { authzService, ResourceType, Permission } from '@shumai/core/src/authz/authz'
|
||||
import { embeddingServerService } from '@shumai/core/src/search/embedding-server'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
|
||||
vi.mock('@shumai/core/src/authz/authz', () => ({
|
||||
authzService: {
|
||||
@@ -112,6 +114,73 @@ describe('team api', () => {
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
it('lets team members view the effective embedding server settings', async () => {
|
||||
vi.spyOn(embeddingServerService, 'getSettings').mockResolvedValue({
|
||||
url: 'http://embedding:9379/v1',
|
||||
isEnvConfigured: true,
|
||||
})
|
||||
const response = await app.request('/teams/t1/embedding-server-settings')
|
||||
expect(await response.json()).toEqual({
|
||||
url: 'http://embedding:9379/v1',
|
||||
isEnvConfigured: true,
|
||||
})
|
||||
expect(authzService.hasPermission).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({ id: 't1', permission: Permission.Read }),
|
||||
)
|
||||
})
|
||||
|
||||
it('lets admins save and test embedding server settings', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockClear()
|
||||
const url = 'http://embedding:9379/v1'
|
||||
const settings = { url, isEnvConfigured: false }
|
||||
const save = vi.spyOn(embeddingServerService, 'updateSettings').mockResolvedValue(settings)
|
||||
const test = vi.spyOn(embeddingServerService, 'testConnection').mockResolvedValue({ ok: true })
|
||||
const body = JSON.stringify({ url })
|
||||
const headers = { 'Content-Type': 'application/json' }
|
||||
const saved = await app.request('/teams/t1/embedding-server-settings', {
|
||||
method: 'PUT',
|
||||
headers,
|
||||
body,
|
||||
})
|
||||
expect(await saved.json()).toEqual(settings)
|
||||
const tested = await app.request('/teams/t1/embedding-server-settings/test', {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body,
|
||||
})
|
||||
expect(await tested.json()).toEqual({ ok: true })
|
||||
expect(save).toHaveBeenCalledWith('t1', url)
|
||||
expect(test).toHaveBeenCalledWith('t1', url)
|
||||
expect(authzService.hasPermission).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
expect.objectContaining({ permission: Permission.Admin }),
|
||||
)
|
||||
expect(authzService.hasPermission).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
expect.objectContaining({ permission: Permission.Admin }),
|
||||
)
|
||||
})
|
||||
|
||||
it('rejects embedding settings writes and connection tests without admin permission', async () => {
|
||||
const save = vi.spyOn(embeddingServerService, 'updateSettings')
|
||||
const test = vi.spyOn(embeddingServerService, 'testConnection')
|
||||
vi.mocked(authzService.hasPermission).mockRejectedValue(new HTTPException(403))
|
||||
for (const [method, suffix] of [
|
||||
['PUT', ''],
|
||||
['POST', '/test'],
|
||||
]) {
|
||||
const denied = await app.request(`/teams/t1/embedding-server-settings${suffix}`, {
|
||||
method,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ url: 'http://embedding:9379/v1' }),
|
||||
})
|
||||
expect(denied.status).toBe(403)
|
||||
}
|
||||
expect(save).not.toHaveBeenCalled()
|
||||
expect(test).not.toHaveBeenCalled()
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue(undefined)
|
||||
})
|
||||
|
||||
it('POST /teams returns 404 without creating a team or writing an audit entry', async () => {
|
||||
const createTeam = vi.spyOn(teamService, 'createTeam').mockResolvedValue({
|
||||
id: 't1',
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
updateRunnerRequestSchema,
|
||||
updateTurntableSettingsRequestSchema,
|
||||
updateGotenbergSettingsRequestSchema,
|
||||
updateEmbeddingServerSettingsRequestSchema,
|
||||
updateMeRequestSchema,
|
||||
updateTeamMemberRoleRequestSchema,
|
||||
createApiTokenRequestSchema,
|
||||
@@ -31,6 +32,7 @@ import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import { workflowTaskService } from '@shumai/core/src/workflowTask/workflowTask'
|
||||
import { turntableService } from '@shumai/core/src/turntable/turntable'
|
||||
import { gotenbergService } from '@shumai/core/src/gotenberg/gotenberg'
|
||||
import { embeddingServerService } from '@shumai/core/src/search/embedding-server'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
@@ -405,6 +407,46 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
return c.json(res)
|
||||
},
|
||||
)
|
||||
.get('/teams/:teamId/embedding-server-settings', async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
await authzService.hasPermission({
|
||||
user: c.get('user'),
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
return c.json(await embeddingServerService.getSettings(teamId))
|
||||
})
|
||||
.put(
|
||||
'/teams/:teamId/embedding-server-settings',
|
||||
zValidator('json', updateEmbeddingServerSettingsRequestSchema),
|
||||
async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
await authzService.hasPermission({
|
||||
user: c.get('user'),
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
const { url } = c.req.valid('json')
|
||||
return c.json(await embeddingServerService.updateSettings(teamId, url))
|
||||
},
|
||||
)
|
||||
.post(
|
||||
'/teams/:teamId/embedding-server-settings/test',
|
||||
zValidator('json', updateEmbeddingServerSettingsRequestSchema.partial()),
|
||||
async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
await authzService.hasPermission({
|
||||
user: c.get('user'),
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
const { url } = c.req.valid('json')
|
||||
return c.json(await embeddingServerService.testConnection(teamId, url))
|
||||
},
|
||||
)
|
||||
.get('/teams/:teamId/user-metadata', async (c) => {
|
||||
const user = c.get('user')
|
||||
const teamId = c.req.param('teamId')
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { transcriptService } from '@shumai/core/src/transcript/transcript'
|
||||
import { Hono } from 'hono'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import transcriptRoute from './transcript'
|
||||
|
||||
describe('Transcript API', () => {
|
||||
const app = new Hono().route('/', transcriptRoute)
|
||||
const submit = (body: { language?: string }) =>
|
||||
app.request('/files/file-id/transcripts', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
const edit = (body: object, language = 'en') =>
|
||||
app.request(`/files/file-id/transcripts/${language}/segments/segment-id`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
|
||||
afterEach(() => vi.restoreAllMocks())
|
||||
|
||||
it('proxies the server language list', async () => {
|
||||
const list = { model: 'whisper-tiny', languages: [{ code: 'en', name: 'English' }] }
|
||||
vi.spyOn(transcriptService, 'listLanguages').mockResolvedValue(list)
|
||||
const response = await app.request('/transcription/languages')
|
||||
expect(await response.json()).toEqual(list)
|
||||
})
|
||||
|
||||
it('requires project edit access to list file IDs with active transcription', async () => {
|
||||
const request = () => app.request('/projects/project-id/transcription-status')
|
||||
const permission = vi
|
||||
.spyOn(authzService, 'hasPermission')
|
||||
.mockRejectedValue(new HTTPException(403))
|
||||
const list = vi.spyOn(transcriptService, 'listActiveAssetIds').mockResolvedValue(['file-id'])
|
||||
|
||||
expect((await request()).status).toBe(403)
|
||||
expect(list).not.toHaveBeenCalled()
|
||||
|
||||
permission.mockResolvedValue(undefined)
|
||||
const response = await request()
|
||||
expect(response.status).toBe(200)
|
||||
expect(await response.json()).toEqual({ assetIds: ['file-id'] })
|
||||
expect(permission).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({
|
||||
type: ResourceType.Project,
|
||||
permission: Permission.Edit,
|
||||
id: 'project-id',
|
||||
}),
|
||||
)
|
||||
expect(list).toHaveBeenCalledWith('project-id')
|
||||
})
|
||||
|
||||
it('returns saved languages and segments with asset read access', async () => {
|
||||
const permission = vi.spyOn(authzService, 'hasPermission').mockResolvedValue(undefined)
|
||||
const list = vi
|
||||
.spyOn(transcriptService, 'listSavedLanguages')
|
||||
.mockResolvedValue({ languages: ['en'] })
|
||||
const saved = {
|
||||
id: 'transcript-id',
|
||||
language: 'en',
|
||||
segments: [{ id: 'segment-id', startMs: 0, endMs: 1400, text: 'Hello' }],
|
||||
}
|
||||
const get = vi.spyOn(transcriptService, 'getSavedTranscript').mockResolvedValue(saved)
|
||||
|
||||
const languages = await app.request('/files/file-id/transcripts')
|
||||
expect(languages.status).toBe(200)
|
||||
expect(await languages.json()).toEqual({ languages: ['en'] })
|
||||
expect(list).toHaveBeenCalledWith('file-id')
|
||||
const transcript = await app.request('/files/file-id/transcripts/en')
|
||||
expect(transcript.status).toBe(200)
|
||||
expect(await transcript.json()).toEqual(saved)
|
||||
expect(get).toHaveBeenCalledWith('file-id', 'en')
|
||||
expect(permission).toHaveBeenCalledTimes(2)
|
||||
for (const [request] of permission.mock.calls) {
|
||||
expect(request).toMatchObject({
|
||||
type: ResourceType.Asset,
|
||||
permission: Permission.Read,
|
||||
id: 'file-id',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
it('validates the saved language path and authorizes before reading saved data', async () => {
|
||||
const permission = vi
|
||||
.spyOn(authzService, 'hasPermission')
|
||||
.mockRejectedValue(new HTTPException(403))
|
||||
const list = vi.spyOn(transcriptService, 'listSavedLanguages')
|
||||
const get = vi.spyOn(transcriptService, 'getSavedTranscript')
|
||||
|
||||
expect((await app.request('/files/file-id/transcripts/auto')).status).toBe(400)
|
||||
expect((await app.request('/files/file-id/transcripts')).status).toBe(403)
|
||||
expect((await app.request('/files/file-id/transcripts/en')).status).toBe(403)
|
||||
expect(list).not.toHaveBeenCalled()
|
||||
expect(get).not.toHaveBeenCalled()
|
||||
|
||||
permission.mockResolvedValue(undefined)
|
||||
get.mockRejectedValue(new HTTPException(404))
|
||||
expect((await app.request('/files/file-id/transcripts/zh')).status).toBe(404)
|
||||
})
|
||||
|
||||
it('requires asset edit permission and accepts an empty segment', async () => {
|
||||
const permission = vi.spyOn(authzService, 'hasPermission').mockResolvedValue(undefined)
|
||||
const segment = { id: 'segment-id', startMs: 0, endMs: 1400, text: '' }
|
||||
const update = vi.spyOn(transcriptService, 'updateSegmentText').mockResolvedValue(segment)
|
||||
|
||||
const response = await edit({ text: '' })
|
||||
expect(response.status).toBe(200)
|
||||
expect(await response.json()).toEqual(segment)
|
||||
expect(update).toHaveBeenCalledWith('file-id', 'en', 'segment-id', '')
|
||||
expect(permission).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
type: ResourceType.Asset,
|
||||
permission: Permission.Edit,
|
||||
id: 'file-id',
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('rejects invalid text and timing fields before handling segment edits', async () => {
|
||||
const permission = vi.spyOn(authzService, 'hasPermission')
|
||||
const update = vi.spyOn(transcriptService, 'updateSegmentText')
|
||||
for (const body of [
|
||||
{},
|
||||
{ text: null },
|
||||
{ text: 'invalid\0text' },
|
||||
{ text: 'Hello', startMs: 1 },
|
||||
{ text: 'Hello', endMs: 1 },
|
||||
]) {
|
||||
expect((await edit(body)).status).toBe(400)
|
||||
}
|
||||
expect((await edit({ text: 'Hello' }, 'auto')).status).toBe(400)
|
||||
expect(permission).not.toHaveBeenCalled()
|
||||
expect(update).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('does not edit for a read-only user and forwards missing segment errors', async () => {
|
||||
const permission = vi
|
||||
.spyOn(authzService, 'hasPermission')
|
||||
.mockRejectedValue(new HTTPException(403))
|
||||
const update = vi
|
||||
.spyOn(transcriptService, 'updateSegmentText')
|
||||
.mockRejectedValue(new HTTPException(404))
|
||||
expect((await edit({ text: 'Hello' })).status).toBe(403)
|
||||
expect(update).not.toHaveBeenCalled()
|
||||
|
||||
permission.mockResolvedValue(undefined)
|
||||
expect((await edit({ text: 'Hello' })).status).toBe(404)
|
||||
})
|
||||
|
||||
it('requires asset edit permission and returns a queued Auto job', async () => {
|
||||
const permission = vi.spyOn(authzService, 'hasPermission').mockResolvedValue(undefined)
|
||||
const generate = vi
|
||||
.spyOn(transcriptService, 'generate')
|
||||
.mockResolvedValue({ kind: 'queued', taskId: 'task-id' })
|
||||
|
||||
const response = await submit({})
|
||||
|
||||
expect(response.status).toBe(202)
|
||||
expect(await response.json()).toEqual({ kind: 'queued', taskId: 'task-id' })
|
||||
expect(generate).toHaveBeenCalledWith('file-id', null)
|
||||
expect(permission).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
type: ResourceType.Asset,
|
||||
permission: Permission.Edit,
|
||||
id: 'file-id',
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('returns a saved transcript for an explicit language', async () => {
|
||||
vi.spyOn(authzService, 'hasPermission').mockResolvedValue(undefined)
|
||||
const saved = { kind: 'existing', transcriptId: 'transcript-id', language: 'en' } as const
|
||||
vi.spyOn(transcriptService, 'generate').mockResolvedValue(saved)
|
||||
|
||||
const response = await submit({ language: 'en' })
|
||||
|
||||
expect(response.status).toBe(200)
|
||||
expect(await response.json()).toEqual(saved)
|
||||
expect(transcriptService.generate).toHaveBeenCalledWith('file-id', 'en')
|
||||
})
|
||||
|
||||
it('rejects invalid language codes and denies reads and writes without edit permission', async () => {
|
||||
vi.spyOn(authzService, 'hasPermission').mockRejectedValue(new HTTPException(403))
|
||||
const generate = vi.spyOn(transcriptService, 'generate')
|
||||
const status = vi.spyOn(transcriptService, 'getStatus')
|
||||
|
||||
expect((await submit({ language: 'auto' })).status).toBe(400)
|
||||
expect((await submit({ language: 'en' })).status).toBe(403)
|
||||
expect((await app.request('/files/file-id/transcription-status')).status).toBe(403)
|
||||
expect(generate).not.toHaveBeenCalled()
|
||||
expect(status).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,100 @@
|
||||
import { zValidator } from '@hono/zod-validator'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { transcriptService } from '@shumai/core/src/transcript/transcript'
|
||||
import type { User } from '@shumai/db'
|
||||
import {
|
||||
generateTranscriptRequestSchema,
|
||||
transcriptLanguageCodeSchema,
|
||||
updateTranscriptSegmentRequestSchema,
|
||||
} from '@shumai/dtos'
|
||||
import { Hono } from 'hono'
|
||||
import { z } from 'zod'
|
||||
|
||||
const route = new Hono<{ Variables: { user: User } }>()
|
||||
.get('/transcription/languages', async (c) => c.json(await transcriptService.listLanguages()))
|
||||
.get('/projects/:projectId/transcription-status', async (c) => {
|
||||
const projectId = c.req.param('projectId')
|
||||
await authzService.hasPermission({
|
||||
user: c.get('user'),
|
||||
permission: Permission.Edit,
|
||||
type: ResourceType.Project,
|
||||
id: projectId,
|
||||
})
|
||||
return c.json({ assetIds: await transcriptService.listActiveAssetIds(projectId) })
|
||||
})
|
||||
.get('/files/:fileId/transcripts', async (c) => {
|
||||
const assetId = c.req.param('fileId')
|
||||
await authzService.hasPermission({
|
||||
user: c.get('user'),
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Asset,
|
||||
id: assetId,
|
||||
})
|
||||
return c.json(await transcriptService.listSavedLanguages(assetId))
|
||||
})
|
||||
.get(
|
||||
'/files/:fileId/transcripts/:language',
|
||||
zValidator('param', z.object({ fileId: z.string(), language: transcriptLanguageCodeSchema })),
|
||||
async (c) => {
|
||||
const { fileId, language } = c.req.valid('param')
|
||||
await authzService.hasPermission({
|
||||
user: c.get('user'),
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Asset,
|
||||
id: fileId,
|
||||
})
|
||||
return c.json(await transcriptService.getSavedTranscript(fileId, language))
|
||||
},
|
||||
)
|
||||
.patch(
|
||||
'/files/:fileId/transcripts/:language/segments/:segmentId',
|
||||
zValidator(
|
||||
'param',
|
||||
z.object({
|
||||
fileId: z.string(),
|
||||
language: transcriptLanguageCodeSchema,
|
||||
segmentId: z.string(),
|
||||
}),
|
||||
),
|
||||
zValidator('json', updateTranscriptSegmentRequestSchema),
|
||||
async (c) => {
|
||||
const { fileId, language, segmentId } = c.req.valid('param')
|
||||
await authzService.hasPermission({
|
||||
user: c.get('user'),
|
||||
permission: Permission.Edit,
|
||||
type: ResourceType.Asset,
|
||||
id: fileId,
|
||||
})
|
||||
const { text } = c.req.valid('json')
|
||||
return c.json(await transcriptService.updateSegmentText(fileId, language, segmentId, text))
|
||||
},
|
||||
)
|
||||
.post(
|
||||
'/files/:fileId/transcripts',
|
||||
zValidator('json', generateTranscriptRequestSchema),
|
||||
async (c) => {
|
||||
const assetId = c.req.param('fileId')
|
||||
await authzService.hasPermission({
|
||||
user: c.get('user'),
|
||||
permission: Permission.Edit,
|
||||
type: ResourceType.Asset,
|
||||
id: assetId,
|
||||
})
|
||||
|
||||
const { language } = c.req.valid('json')
|
||||
const result = await transcriptService.generate(assetId, language ?? null)
|
||||
return c.json(result, result.kind === 'queued' || result.kind === 'busy' ? 202 : 200)
|
||||
},
|
||||
)
|
||||
.get('/files/:fileId/transcription-status', async (c) => {
|
||||
const assetId = c.req.param('fileId')
|
||||
await authzService.hasPermission({
|
||||
user: c.get('user'),
|
||||
permission: Permission.Edit,
|
||||
type: ResourceType.Asset,
|
||||
id: assetId,
|
||||
})
|
||||
return c.json(await transcriptService.getStatus(assetId))
|
||||
})
|
||||
|
||||
export default route
|
||||
@@ -28,9 +28,9 @@
|
||||
"@aws-sdk/s3-request-presigner": "3.1121.0",
|
||||
"@better-auth/mcp": "1.7.12",
|
||||
"@better-auth/oauth-provider": "1.7.12",
|
||||
"@earendil-works/chord": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/chord": "1.7.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@modelcontextprotocol/client": "2.0.0",
|
||||
"@shumai/db": "workspace:*",
|
||||
|
||||
@@ -1040,6 +1040,65 @@ describe('AgentService', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('Transcript Agent', () => {
|
||||
test('allows one Transcript Agent per team, including when it is disabled', async () => {
|
||||
const svc = new AgentService()
|
||||
const team = await prisma.team.create({ data: { name: 'Transcript agent team' } })
|
||||
const params = {
|
||||
teamId: team.id,
|
||||
type: 'transcription' as const,
|
||||
name: 'Transcript Agent',
|
||||
avatar: 'custom-transcript-avatar',
|
||||
enabled: false,
|
||||
thinkingLevel: 'off' as const,
|
||||
}
|
||||
|
||||
await expect(svc.createAgent(params)).resolves.toMatchObject({
|
||||
enabled: false,
|
||||
providerId: null,
|
||||
})
|
||||
await expect(svc.createAgent(params)).rejects.toThrow('already exists for this team')
|
||||
expect(await prisma.agent.count({ where: { teamId: team.id, type: 'transcription' } })).toBe(
|
||||
1,
|
||||
)
|
||||
})
|
||||
|
||||
test('provisions and toggles the same read-only agent from the environment', async () => {
|
||||
const svc = new AgentService()
|
||||
const team = await prisma.team.create({ data: { name: 'Managed transcript agent team' } })
|
||||
try {
|
||||
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', 'false')
|
||||
await svc.ensureSystemAgentsForTeam(team.id)
|
||||
expect(
|
||||
await prisma.agent.count({ where: { teamId: team.id, type: 'transcription' } }),
|
||||
).toBe(0)
|
||||
|
||||
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', 'true')
|
||||
await svc.ensureSystemAgents()
|
||||
const [agent] = await svc.listAgents({ teamId: team.id })
|
||||
expect(await svc.toAgentInfo(agent)).toMatchObject({
|
||||
enabled: true,
|
||||
readOnly: true,
|
||||
avatarPreset: 'avatar-2',
|
||||
})
|
||||
|
||||
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', 'false')
|
||||
await svc.ensureSystemAgentsForTeam(team.id)
|
||||
const [disabled] = await svc.listAgents({ teamId: team.id })
|
||||
expect(await svc.toAgentInfo(disabled)).toMatchObject({
|
||||
id: agent.id,
|
||||
enabled: false,
|
||||
readOnly: true,
|
||||
})
|
||||
|
||||
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', undefined)
|
||||
expect(await svc.toAgentInfo(disabled)).toMatchObject({ enabled: false, readOnly: false })
|
||||
} finally {
|
||||
vi.unstubAllEnvs()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('ensureEmbeddingAgent', () => {
|
||||
test('creates embedding agent when ENABLE_EMBEDDING_AGENT is true', async () => {
|
||||
const db = prisma
|
||||
@@ -1048,7 +1107,7 @@ describe('AgentService', () => {
|
||||
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'true'
|
||||
try {
|
||||
await svc.ensureEmbeddingAgentForTeam(team.id)
|
||||
await svc.ensureSystemAgentsForTeam(team.id)
|
||||
const agent = await db.agent.findFirst({
|
||||
where: { teamId: team.id, type: 'embedding' },
|
||||
include: { user: true, skills: { include: { skill: true } }, mcpServers: true },
|
||||
@@ -1063,7 +1122,7 @@ describe('AgentService', () => {
|
||||
expect(info.readOnly).toBe(true)
|
||||
|
||||
// Ensure idempotency
|
||||
await svc.ensureEmbeddingAgentForTeam(team.id)
|
||||
await svc.ensureSystemAgentsForTeam(team.id)
|
||||
const count = await db.agent.count({
|
||||
where: { teamId: team.id, type: 'embedding' },
|
||||
})
|
||||
@@ -1093,7 +1152,7 @@ describe('AgentService', () => {
|
||||
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'true'
|
||||
try {
|
||||
await svc.ensureEmbeddingAgentForTeam(team.id)
|
||||
await svc.ensureSystemAgentsForTeam(team.id)
|
||||
const agent = await db.agent.findFirst({
|
||||
where: { teamId: team.id, type: 'embedding' },
|
||||
include: { user: true, skills: { include: { skill: true } }, mcpServers: true },
|
||||
@@ -1113,7 +1172,7 @@ describe('AgentService', () => {
|
||||
const team = await db.team.create({ data: { name: 'Team No Agent' } })
|
||||
|
||||
delete process.env.ENABLE_EMBEDDING_AGENT
|
||||
await svc.ensureEmbeddingAgentForTeam(team.id)
|
||||
await svc.ensureSystemAgentsForTeam(team.id)
|
||||
const agent = await db.agent.findFirst({
|
||||
where: { teamId: team.id, type: 'embedding' },
|
||||
})
|
||||
@@ -1127,7 +1186,7 @@ describe('AgentService', () => {
|
||||
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'false'
|
||||
try {
|
||||
await svc.ensureEmbeddingAgentForTeam(team.id)
|
||||
await svc.ensureSystemAgentsForTeam(team.id)
|
||||
const agent = await db.agent.findFirst({
|
||||
where: { teamId: team.id, type: 'embedding' },
|
||||
})
|
||||
@@ -1157,7 +1216,7 @@ describe('AgentService', () => {
|
||||
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'false'
|
||||
try {
|
||||
await svc.ensureEmbeddingAgentForTeam(team.id)
|
||||
await svc.ensureSystemAgentsForTeam(team.id)
|
||||
const agent = await db.agent.findFirst({
|
||||
where: { teamId: team.id, type: 'embedding' },
|
||||
include: { user: true, skills: { include: { skill: true } }, mcpServers: true },
|
||||
@@ -1172,7 +1231,7 @@ describe('AgentService', () => {
|
||||
}
|
||||
})
|
||||
|
||||
test('ensureSystemEmbeddingAgents updates all teams when ENABLE_EMBEDDING_AGENT is false', async () => {
|
||||
test('ensureSystemAgents updates all teams when ENABLE_EMBEDDING_AGENT is false', async () => {
|
||||
const db = prisma
|
||||
const svc = new AgentService()
|
||||
const { team: team1 } = await setupTestData(db)
|
||||
@@ -1194,7 +1253,7 @@ describe('AgentService', () => {
|
||||
|
||||
process.env.ENABLE_EMBEDDING_AGENT = 'false'
|
||||
try {
|
||||
await svc.ensureSystemEmbeddingAgents()
|
||||
await svc.ensureSystemAgents()
|
||||
|
||||
const a1 = await db.agent.findFirst({ where: { teamId: team1.id, type: 'embedding' } })
|
||||
const a2 = await db.agent.findFirst({ where: { teamId: team2.id, type: 'embedding' } })
|
||||
|
||||
@@ -22,6 +22,7 @@ import AdmZip from 'adm-zip'
|
||||
import { getAllowedAgentRoles } from './permissions'
|
||||
import { getPresetAvatarBuffer, getPresetAvatarStorageKey, isPresetAvatarId } from './presets'
|
||||
import { agentSessionService } from './session-service'
|
||||
import { getSystemAgentSetting } from './system-agents'
|
||||
|
||||
const agentInclude = {
|
||||
user: true,
|
||||
@@ -58,7 +59,27 @@ function extractS3Key(urlOrKey?: string | null): string | null | undefined {
|
||||
export class AgentService {
|
||||
private skillContentCache = new Map<string, string>()
|
||||
|
||||
constructor(private readonly prismaClient: typeof prisma = prisma) {}
|
||||
constructor(private readonly prismaClient: typeof prisma | Prisma.TransactionClient = prisma) {}
|
||||
|
||||
private inTransaction<T>(work: (tx: Prisma.TransactionClient) => Promise<T>): Promise<T> {
|
||||
const db = this.prismaClient
|
||||
return '$transaction' in db ? db.$transaction(work) : work(db)
|
||||
}
|
||||
|
||||
private async requireUniqueAgentType(
|
||||
tx: Prisma.TransactionClient,
|
||||
teamId: string,
|
||||
type: AgentType,
|
||||
agentId?: string,
|
||||
): Promise<void> {
|
||||
if (type === 'chat') return
|
||||
|
||||
await tx.$queryRaw`SELECT id FROM teams WHERE id = ${teamId} FOR UPDATE`
|
||||
const existing = await tx.agent.findFirst({
|
||||
where: { type, teamId, id: agentId ? { not: agentId } : undefined },
|
||||
})
|
||||
if (existing) throw new Error(`Agent of type ${type} already exists for this team`)
|
||||
}
|
||||
|
||||
async getSkillContent(skillId: string): Promise<string> {
|
||||
const skill = await this.prismaClient.skill.findUnique({
|
||||
@@ -150,18 +171,6 @@ export class AgentService {
|
||||
deniedTools,
|
||||
} = params
|
||||
|
||||
if (type === 'embedding' || type === 'autofill') {
|
||||
const existing = await this.prismaClient.agent.findFirst({
|
||||
where: {
|
||||
type,
|
||||
teamId,
|
||||
},
|
||||
})
|
||||
if (existing) {
|
||||
throw new Error(`Agent of type ${type} already exists for this team`)
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'chat' || type === 'autofill') {
|
||||
if (!providerId || !modelId) {
|
||||
throw new Error('providerId and modelId are required for chat/autofill agents')
|
||||
@@ -192,11 +201,12 @@ export class AgentService {
|
||||
imageKey = extractS3Key(avatar)
|
||||
}
|
||||
|
||||
return this.prismaClient.$transaction(async (tx) => {
|
||||
return this.inTransaction(async (tx) => {
|
||||
const team = await tx.team.findUnique({
|
||||
where: { id: teamId },
|
||||
})
|
||||
if (!team) throw new Error('team not found')
|
||||
await this.requireUniqueAgentType(tx, teamId, type)
|
||||
|
||||
if (runnerId) {
|
||||
const runner = await tx.runner.findFirst({
|
||||
@@ -298,19 +308,6 @@ export class AgentService {
|
||||
|
||||
if (!agent) throw new Error('agent not found')
|
||||
|
||||
if (type === 'embedding' || type === 'autofill') {
|
||||
const existing = await this.prismaClient.agent.findFirst({
|
||||
where: {
|
||||
type,
|
||||
id: { not: agentId },
|
||||
teamId: agent.teamId,
|
||||
},
|
||||
})
|
||||
if (existing) {
|
||||
throw new Error(`Agent of type ${type} already exists for this team`)
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'chat' || type === 'autofill') {
|
||||
if (!providerId || !modelId) {
|
||||
throw new Error('providerId and modelId are required for chat/autofill agents')
|
||||
@@ -364,7 +361,9 @@ export class AgentService {
|
||||
avatarPreset: newAvatarPreset,
|
||||
}
|
||||
|
||||
return this.prismaClient.$transaction(async (tx) => {
|
||||
return this.inTransaction(async (tx) => {
|
||||
await this.requireUniqueAgentType(tx, agent.teamId, type, agentId)
|
||||
|
||||
await tx.user.update({
|
||||
where: { id: agentId },
|
||||
data: {
|
||||
@@ -476,10 +475,7 @@ export class AgentService {
|
||||
*/
|
||||
async toAgentInfo(agent: AgentInfoSource): Promise<AgentInfo> {
|
||||
const config = agent.config as unknown as PrismaJson.AgentConfig
|
||||
const isManagedByEnv =
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'true' ||
|
||||
process.env.ENABLE_EMBEDDING_AGENT === 'false'
|
||||
const isReadOnly = agent.type === 'embedding' && isManagedByEnv
|
||||
const isReadOnly = getSystemAgentSetting(agent.type) !== undefined
|
||||
|
||||
return {
|
||||
id: agent.id,
|
||||
@@ -652,57 +648,43 @@ export class AgentService {
|
||||
)
|
||||
}
|
||||
|
||||
async ensureSystemEmbeddingAgents(): Promise<void> {
|
||||
const envVal = process.env.ENABLE_EMBEDDING_AGENT
|
||||
if (envVal !== 'true' && envVal !== 'false') {
|
||||
return
|
||||
}
|
||||
async ensureSystemAgents(): Promise<void> {
|
||||
if (!getSystemAgentSetting('embedding') && !getSystemAgentSetting('transcription')) return
|
||||
|
||||
const teams = await this.prismaClient.team.findMany({
|
||||
orderBy: { id: 'desc' },
|
||||
select: { id: true },
|
||||
})
|
||||
|
||||
for (const team of teams) {
|
||||
await this.ensureEmbeddingAgentForTeam(team.id)
|
||||
await this.ensureSystemAgentsForTeam(team.id)
|
||||
}
|
||||
}
|
||||
|
||||
async ensureEmbeddingAgentForTeam(teamId: string): Promise<void> {
|
||||
const envVal = process.env.ENABLE_EMBEDDING_AGENT
|
||||
if (envVal !== 'true' && envVal !== 'false') {
|
||||
return
|
||||
}
|
||||
async ensureSystemAgentsForTeam(teamId: string): Promise<void> {
|
||||
for (const type of ['embedding', 'transcription'] as const) {
|
||||
const setting = getSystemAgentSetting(type)
|
||||
if (!setting) continue
|
||||
|
||||
const existing = await this.prismaClient.agent.findFirst({
|
||||
where: {
|
||||
teamId,
|
||||
type: 'embedding',
|
||||
},
|
||||
})
|
||||
await this.inTransaction(async (tx) => {
|
||||
await tx.$queryRaw`SELECT id FROM teams WHERE id = ${teamId} FOR UPDATE`
|
||||
const existing = await tx.agent.findFirst({
|
||||
where: { teamId, type },
|
||||
})
|
||||
|
||||
if (envVal === 'true') {
|
||||
if (!existing) {
|
||||
await this.createAgent({
|
||||
teamId,
|
||||
name: 'embedding-agent',
|
||||
type: 'embedding',
|
||||
avatar: 'avatar-1',
|
||||
thinkingLevel: 'off',
|
||||
enabled: true,
|
||||
})
|
||||
} else if (!existing.enabled) {
|
||||
await this.prismaClient.agent.update({
|
||||
where: { id: existing.id },
|
||||
data: { enabled: true },
|
||||
})
|
||||
}
|
||||
} else if (envVal === 'false') {
|
||||
if (existing && existing.enabled) {
|
||||
await this.prismaClient.agent.update({
|
||||
where: { id: existing.id },
|
||||
data: { enabled: false },
|
||||
})
|
||||
}
|
||||
if (existing && existing.enabled !== setting.enabled) {
|
||||
await tx.agent.update({ where: { id: existing.id }, data: { enabled: setting.enabled } })
|
||||
} else if (!existing && setting.enabled) {
|
||||
await new AgentService(tx).createAgent({
|
||||
teamId,
|
||||
name: type === 'embedding' ? 'embedding-agent' : setting.name,
|
||||
type,
|
||||
avatar: setting.avatar,
|
||||
thinkingLevel: 'off',
|
||||
enabled: true,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,8 +92,10 @@ export async function openSessionCache(sessionId: string) {
|
||||
throw new Error('Session commit sequence mismatch')
|
||||
seq = receipt.seq
|
||||
}
|
||||
if (result.stored !== commits.length)
|
||||
if (result.kind === 'refused') {
|
||||
throw result.refused ?? new Error('Session restoration refused')
|
||||
}
|
||||
if (result.stored !== commits.length) throw new Error('Session restoration was incomplete')
|
||||
}
|
||||
await save(true)
|
||||
} catch (error) {
|
||||
|
||||
@@ -60,6 +60,16 @@ describe('Native session storage and PostgreSQL synchronization', () => {
|
||||
expect(await prisma.agentSessionEntry.count({ where: { sessionId: session.id } })).toBe(0)
|
||||
})
|
||||
|
||||
it('returns logs with unavailable usage before a session has an accounting checkpoint', async () => {
|
||||
const { session } = await fixture()
|
||||
expect(await agentSessionService.getLogs(session.id)).toEqual({ entries: [], usage: null })
|
||||
|
||||
const entries = await appendSessionEntries(session.id, [
|
||||
{ kind: 'pi.user', model: [{ role: 'user', content: 'No usage yet', timestamp: 1 }] },
|
||||
])
|
||||
expect(await agentSessionService.getLogs(session.id)).toEqual({ entries, usage: null })
|
||||
})
|
||||
|
||||
it.each(['missing', 'corrupt', 'dirty'] as const)(
|
||||
'rebuilds a %s local cache from mirrored commits',
|
||||
async (failure) => {
|
||||
@@ -438,6 +448,10 @@ describe('Native session storage and PostgreSQL synchronization', () => {
|
||||
expect(Number(usage.totalTokens)).toBeGreaterThan(0)
|
||||
expect(Number(usage.totalTokens)).toBe(checkpoint.totalTokens)
|
||||
expect(Number(usage.cost)).toBe(checkpoint.cost)
|
||||
const logs = await agentSessionService.getLogs(session.id)
|
||||
expect(logs.entries).not.toHaveLength(0)
|
||||
expect(logs.entries).toEqual(await agentSessionService.getEntries(session.id))
|
||||
expect(logs.usage).toEqual(checkpoint)
|
||||
})
|
||||
|
||||
it('rolls back usage if PostgreSQL cannot persist the native commit', async () => {
|
||||
@@ -476,5 +490,6 @@ describe('Native session storage and PostgreSQL synchronization', () => {
|
||||
await prisma.agentSession.delete({ where: { id: session.id } })
|
||||
expect(await prisma.agentSessionCommit.count({ where: { sessionId: session.id } })).toBe(0)
|
||||
await expect(agentSessionService.getEntries(session.id)).rejects.toThrow('Session not found')
|
||||
await expect(agentSessionService.getLogs(session.id)).rejects.toThrow('Session not found')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
} from '@earendil-works/pi-durable'
|
||||
import { prisma, type Prisma, type TeamMemberRole } from '@shumai/db'
|
||||
import { acquireAdvisoryLock } from '@shumai/db/src/advisory-lock'
|
||||
import type { AgentSessionLogs } from '@shumai/dtos'
|
||||
import { AiUsageService } from '../ai-usage/ai-usage'
|
||||
import { quotaService } from '../quota/quota-service'
|
||||
import { openSessionCache, removeSessionCaches } from './session-cache'
|
||||
@@ -184,20 +185,22 @@ export class AgentSessionService {
|
||||
|
||||
private async read<T>(
|
||||
sessionId: string,
|
||||
use: (storage: SessionReader) => Promise<T>,
|
||||
use: (storage: SessionReader, usage: PrismaJson.AgentSessionUsage | null) => Promise<T>,
|
||||
{ includeUsage = false } = {},
|
||||
): Promise<T> {
|
||||
if (this.closing) throw new Error('Session service is closing')
|
||||
return this.withCacheAccess(sessionId, async () => {
|
||||
const session = await prisma.agentSession.findUnique({
|
||||
where: { id: sessionId },
|
||||
select: { id: true },
|
||||
select: { id: true, accountedUsage: includeUsage },
|
||||
})
|
||||
if (!session) throw new Error('Session not found')
|
||||
const usage = session.accountedUsage ?? null
|
||||
const writer = this.writers.get(sessionId)
|
||||
if (writer) return use(writer.reader)
|
||||
if (writer) return use(writer.reader, usage)
|
||||
const cache = await openSessionCache(sessionId)
|
||||
try {
|
||||
return await use(cache.storage)
|
||||
return await use(cache.storage, usage)
|
||||
} finally {
|
||||
await cache.storage.close(BACKGROUND_CONTEXT)
|
||||
}
|
||||
@@ -225,22 +228,32 @@ export class AgentSessionService {
|
||||
}
|
||||
|
||||
async getEntries(sessionId: string): Promise<EntryRecord[]> {
|
||||
return this.read(sessionId, async (storage) => {
|
||||
const entries: EntryRecord[] = []
|
||||
if (!(await storage.conversation(ROOT_CONVERSATION_ID, BACKGROUND_CONTEXT))) return entries
|
||||
let cursor: Cursor | undefined
|
||||
do {
|
||||
const page = await storage.scanEntries(
|
||||
{ conversationId: ROOT_CONVERSATION_ID, order: 'ascending' },
|
||||
100,
|
||||
cursor,
|
||||
BACKGROUND_CONTEXT,
|
||||
)
|
||||
entries.push(...page.items)
|
||||
cursor = page.next
|
||||
} while (cursor)
|
||||
return entries
|
||||
})
|
||||
return this.read(sessionId, this.readAllEntries)
|
||||
}
|
||||
|
||||
async getLogs(sessionId: string): Promise<AgentSessionLogs> {
|
||||
return this.read(
|
||||
sessionId,
|
||||
async (storage, usage) => ({ entries: await this.readAllEntries(storage), usage }),
|
||||
{ includeUsage: true },
|
||||
)
|
||||
}
|
||||
|
||||
private async readAllEntries(storage: SessionReader): Promise<EntryRecord[]> {
|
||||
const entries: EntryRecord[] = []
|
||||
if (!(await storage.conversation(ROOT_CONVERSATION_ID, BACKGROUND_CONTEXT))) return entries
|
||||
let cursor: Cursor | undefined
|
||||
do {
|
||||
const page = await storage.scanEntries(
|
||||
{ conversationId: ROOT_CONVERSATION_ID, order: 'ascending' },
|
||||
100,
|
||||
cursor,
|
||||
BACKGROUND_CONTEXT,
|
||||
)
|
||||
entries.push(...page.items)
|
||||
cursor = page.next
|
||||
} while (cursor)
|
||||
return entries
|
||||
}
|
||||
|
||||
async getEntryForRequest(sessionId: string, requestId: string) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { AgentType } from '@shumai/dtos'
|
||||
|
||||
const systemAgentSettings = {
|
||||
embedding: { envKey: 'ENABLE_EMBEDDING_AGENT', name: 'Embedding agent', avatar: 'avatar-1' },
|
||||
transcription: {
|
||||
envKey: 'ENABLE_TRANSCRIPTION_AGENT',
|
||||
name: 'Transcript Agent',
|
||||
avatar: 'avatar-2',
|
||||
},
|
||||
} as const
|
||||
|
||||
export function getSystemAgentSetting(type: AgentType) {
|
||||
if (type !== 'embedding' && type !== 'transcription') return undefined
|
||||
|
||||
const { envKey, name, avatar } = systemAgentSettings[type]
|
||||
const value = process.env[envKey]
|
||||
if (value !== 'true' && value !== 'false') return undefined
|
||||
|
||||
return { name, avatar, enabled: value === 'true' }
|
||||
}
|
||||
@@ -2938,6 +2938,7 @@ export class AssetService {
|
||||
type: a.type,
|
||||
targetType: a.type === AssetType.symlink ? a.target?.type : null,
|
||||
status: latestVersion.status,
|
||||
mediaType: latestVersion.mediaType,
|
||||
proxyType,
|
||||
latestChildren,
|
||||
preview,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import '@shumai/db/src/prisma-json-types'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
|
||||
export interface IntegrationEnvKeys {
|
||||
url: string[]
|
||||
@@ -12,6 +13,7 @@ export interface IntegrationDefinition<TKey extends keyof PrismaJson.Settings> {
|
||||
name: string
|
||||
settingsKey: TKey
|
||||
envKeys: IntegrationEnvKeys
|
||||
requireSettingsRead?: boolean
|
||||
}
|
||||
|
||||
export interface ResolvedIntegrationConfig {
|
||||
@@ -45,7 +47,7 @@ function getFirstEnvValue(keys?: string[]): string | undefined {
|
||||
|
||||
export async function resolveIntegrationConfig<TKey extends keyof PrismaJson.Settings>(
|
||||
def: IntegrationDefinition<TKey>,
|
||||
teamId?: string,
|
||||
teamId?: string | null,
|
||||
): Promise<ResolvedIntegrationConfig> {
|
||||
const envUrl = getFirstEnvValue(def.envKeys.url)
|
||||
const envUsername = getFirstEnvValue(def.envKeys.username)
|
||||
@@ -60,12 +62,13 @@ export async function resolveIntegrationConfig<TKey extends keyof PrismaJson.Set
|
||||
}
|
||||
}
|
||||
|
||||
if (teamId) {
|
||||
if (teamId || teamId === null) {
|
||||
try {
|
||||
const team = await prisma.team.findUnique({
|
||||
where: { id: teamId },
|
||||
select: { settings: true },
|
||||
})
|
||||
// Instance-wide consumers use the single team when they have no team ID.
|
||||
const team =
|
||||
teamId === null
|
||||
? await prisma.team.findFirst({ orderBy: { id: 'desc' }, select: { settings: true } })
|
||||
: await prisma.team.findUnique({ where: { id: teamId }, select: { settings: true } })
|
||||
const teamSettings = team?.settings as PrismaJson.Settings | null
|
||||
const serviceSettings = teamSettings?.[def.settingsKey] as
|
||||
{ url?: string; username?: string; password?: string } | undefined
|
||||
@@ -79,6 +82,7 @@ export async function resolveIntegrationConfig<TKey extends keyof PrismaJson.Set
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if (def.requireSettingsRead) throw err
|
||||
logger.error({ err, teamId }, `Failed to load team ${def.name} settings`)
|
||||
}
|
||||
}
|
||||
@@ -108,9 +112,9 @@ export async function updateIntegrationSettings<TKey extends keyof PrismaJson.Se
|
||||
): Promise<IntegrationSettingsResponse> {
|
||||
const currentConfig = await resolveIntegrationConfig(def, teamId)
|
||||
if (currentConfig.isEnv) {
|
||||
throw new Error(
|
||||
`${def.name} settings are configured via environment variables and cannot be edited`,
|
||||
)
|
||||
throw new HTTPException(400, {
|
||||
message: `${def.name} settings are configured via environment variables and cannot be edited`,
|
||||
})
|
||||
}
|
||||
|
||||
const team = await prisma.team.findUnique({
|
||||
|
||||
@@ -19,7 +19,7 @@ export const ENV_MAP: Record<string, string> = {
|
||||
openai: 'OPENAI_API_KEY',
|
||||
anthropic: 'ANTHROPIC_API_KEY',
|
||||
'github-copilot': 'COPILOT_GITHUB_TOKEN',
|
||||
'azure-openai-responses': 'AZURE_OPENAI_API_KEY',
|
||||
azure: 'AZURE_OPENAI_API_KEY',
|
||||
deepseek: 'DEEPSEEK_API_KEY',
|
||||
google: 'GEMINI_API_KEY',
|
||||
'google-vertex': 'GOOGLE_CLOUD_API_KEY',
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
{
|
||||
"anthropic": {
|
||||
"models": {
|
||||
"claude-3-5-sonnet-20241022": {
|
||||
"id": "claude-3-5-sonnet-20241022",
|
||||
"name": "Claude 3.5 Sonnet",
|
||||
"tool_call": true,
|
||||
"reasoning": false,
|
||||
"limit": {
|
||||
"context": 200000,
|
||||
"output": 8192
|
||||
},
|
||||
"cost": {
|
||||
"input": 3,
|
||||
"output": 15,
|
||||
"cache_read": 0.3,
|
||||
"cache_write": 3.75
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"openai": {
|
||||
"models": {
|
||||
"gpt-4o": {
|
||||
"id": "gpt-4o",
|
||||
"name": "GPT-4o",
|
||||
"tool_call": true,
|
||||
"reasoning": false,
|
||||
"limit": {
|
||||
"context": 128000,
|
||||
"output": 4096
|
||||
},
|
||||
"cost": {
|
||||
"input": 2.5,
|
||||
"output": 10
|
||||
}
|
||||
},
|
||||
"gpt-4o-extra-new": {
|
||||
"id": "gpt-4o-extra-new",
|
||||
"name": "GPT-4o Extra New",
|
||||
"tool_call": true,
|
||||
"reasoning": false,
|
||||
"limit": {
|
||||
"context": 128000,
|
||||
"output": 4096
|
||||
},
|
||||
"cost": {
|
||||
"input": 2.5,
|
||||
"output": 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "meta/llama-3.1-70b-instruct"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "meta-llama/llama-3.1-8b-instruct",
|
||||
"name": "Meta: Llama 3.1 8B Instruct",
|
||||
"context_length": 131072,
|
||||
"pricing": {
|
||||
"prompt": "0.00000005",
|
||||
"completion": "0.00000008"
|
||||
},
|
||||
"top_provider": {
|
||||
"max_completion_tokens": 8192
|
||||
},
|
||||
"supported_parameters": ["tools"]
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,42 +0,0 @@
|
||||
import type { ThinkingLevel, ThinkingLevelMap } from '@earendil-works/pi-ai'
|
||||
|
||||
export type ModelsDevReasoningOption =
|
||||
| { type: 'toggle' }
|
||||
| {
|
||||
type: 'effort'
|
||||
values: Array<
|
||||
'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'default' | null
|
||||
>
|
||||
}
|
||||
| { type: 'budget_tokens'; min?: number; max?: number }
|
||||
|
||||
const THINKING_LEVELS: readonly ThinkingLevel[] = [
|
||||
'minimal',
|
||||
'low',
|
||||
'medium',
|
||||
'high',
|
||||
'xhigh',
|
||||
'max',
|
||||
]
|
||||
|
||||
/**
|
||||
* Converts models.dev verified effort values into Pi's selectable thinking levels.
|
||||
* Values without a Pi equivalent (`default` and JSON `null`) are intentionally
|
||||
* omitted.
|
||||
*/
|
||||
export function getEffortThinkingLevelMap(
|
||||
options: readonly ModelsDevReasoningOption[],
|
||||
): ThinkingLevelMap | undefined {
|
||||
const effortValues = options.flatMap((option) => (option.type === 'effort' ? option.values : []))
|
||||
if (effortValues.length === 0) return undefined
|
||||
|
||||
const supported = new Set(effortValues)
|
||||
if (!THINKING_LEVELS.some((level) => supported.has(level)) && !supported.has('none'))
|
||||
return undefined
|
||||
|
||||
const map: ThinkingLevelMap = { off: supported.has('none') ? 'none' : null }
|
||||
for (const level of THINKING_LEVELS) {
|
||||
map[level] = supported.has(level) ? level : null
|
||||
}
|
||||
return map
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
import { PI_AI_VERSION } from '@earendil-works/pi-ai'
|
||||
import { getBuiltinModels, getBuiltinProviders } from '@earendil-works/pi-ai/providers/all'
|
||||
import { CompatSchemasByApi } from '@earendil-works/pi-ai/providers/compat-schema'
|
||||
import { ThinkingLevelMapSchema } from '@earendil-works/pi-ai/providers/model-schema'
|
||||
import {
|
||||
providerModelConfigSchema,
|
||||
type ProviderConfigSerializable,
|
||||
type ProviderRefreshUnavailableReason,
|
||||
type RefreshedProviderModel,
|
||||
} from '@shumai/dtos'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { z } from 'zod'
|
||||
import { ENV_MAP } from './builtin'
|
||||
|
||||
type RefreshConnection =
|
||||
| { unavailableReason: ProviderRefreshUnavailableReason }
|
||||
| { unavailableReason: null; piProviderId: string }
|
||||
|
||||
type CatalogResult =
|
||||
| { status: 'unavailable'; reason: 'catalog_unavailable' }
|
||||
| { status: 'ready'; models: RefreshedProviderModel[] }
|
||||
|
||||
const REFRESH_TIMEOUT_MS = 10_000
|
||||
const builtinConnections = new Map<string, Set<string>>(
|
||||
getBuiltinProviders().map((id) => [
|
||||
id,
|
||||
new Set(getBuiltinModels(id).map(({ api, baseUrl }) => connectionKey(api, baseUrl))),
|
||||
]),
|
||||
)
|
||||
const catalogSchema = z.record(
|
||||
z.string(),
|
||||
z.looseObject({
|
||||
id: z.string().min(1),
|
||||
provider: z.string(),
|
||||
api: z.string(),
|
||||
baseUrl: z.string(),
|
||||
type: z.string().optional(),
|
||||
}),
|
||||
)
|
||||
const compatSchemas = new Map(
|
||||
Object.entries(CompatSchemasByApi).map(([api, schema]) => [api, z.fromJSONSchema(schema)]),
|
||||
)
|
||||
const thinkingLevelMapSchema = z.fromJSONSchema(ThinkingLevelMapSchema)
|
||||
const catalogHeaderNames = new Set([
|
||||
'user-agent',
|
||||
'editor-version',
|
||||
'editor-plugin-version',
|
||||
'copilot-integration-id',
|
||||
'nvcf-poll-seconds',
|
||||
])
|
||||
const catalogHeadersSchema = z.record(
|
||||
z.string().refine((name) => catalogHeaderNames.has(name.toLowerCase())),
|
||||
z.string().regex(/^[\t\x20-\x7E]*$/),
|
||||
)
|
||||
|
||||
function normalizeBaseUrl(baseUrl?: string): string {
|
||||
return baseUrl?.trim().replace(/\/+$/, '') ?? ''
|
||||
}
|
||||
|
||||
function connectionKey(api: string, baseUrl?: string): string {
|
||||
return JSON.stringify([api, normalizeBaseUrl(baseUrl)])
|
||||
}
|
||||
|
||||
function piProviderName(name: string): string {
|
||||
return name === 'azure-openai-responses' ? 'azure' : name
|
||||
}
|
||||
|
||||
export function isProviderConfigured(name: string, config: ProviderConfigSerializable): boolean {
|
||||
const key = config.apiKey?.trim()
|
||||
if (key) {
|
||||
const envValue = process.env[key]
|
||||
if (envValue !== undefined) return Boolean(envValue.trim())
|
||||
// Existing forms accept literal keys and names such as OPENAI_API_KEY in the same field.
|
||||
return !/^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/.test(key)
|
||||
}
|
||||
|
||||
const envName = ENV_MAP[piProviderName(name)]
|
||||
if (envName && process.env[envName]?.trim()) return true
|
||||
if (name === 'amazon-bedrock' && config.api === 'bedrock-converse-stream') {
|
||||
return Boolean(
|
||||
process.env.AWS_BEARER_TOKEN_BEDROCK ||
|
||||
process.env.AWS_PROFILE ||
|
||||
(process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY) ||
|
||||
process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI ||
|
||||
process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI ||
|
||||
process.env.AWS_WEB_IDENTITY_TOKEN_FILE,
|
||||
)
|
||||
}
|
||||
|
||||
const url = URL.parse(config.baseUrl ?? '')
|
||||
return Boolean(
|
||||
url &&
|
||||
config.api === 'openai-completions' &&
|
||||
(config.authHeader === false ||
|
||||
/^(?:localhost|127\.\d+\.\d+\.\d+|\[::1\])$/.test(url.hostname)),
|
||||
)
|
||||
}
|
||||
|
||||
function azureDeploymentIds(): Set<string> {
|
||||
// Pi uses model-id=deployment-name mappings for Azure's deployment-specific API.
|
||||
const entries = process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP?.split(',') ?? []
|
||||
return new Set(
|
||||
entries.flatMap((entry) => {
|
||||
const [modelId, deployment] = entry.split('=', 2).map((value) => value.trim())
|
||||
return modelId && deployment ? [modelId] : []
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
export function getRefreshConnection(
|
||||
name: string,
|
||||
config: ProviderConfigSerializable,
|
||||
): RefreshConnection {
|
||||
const providerId = piProviderName(name)
|
||||
if (providerId === 'azure' && config.api === 'azure-openai-responses') {
|
||||
const endpoint =
|
||||
config.baseUrl || process.env.AZURE_OPENAI_BASE_URL || process.env.AZURE_OPENAI_RESOURCE_NAME
|
||||
return endpoint && azureDeploymentIds().size > 0
|
||||
? { unavailableReason: null, piProviderId: providerId }
|
||||
: { unavailableReason: 'azure_deployment_required' }
|
||||
}
|
||||
if (
|
||||
providerId === 'kimi-coding' &&
|
||||
config.api === 'anthropic-messages' &&
|
||||
normalizeBaseUrl(config.baseUrl) === 'https://api.kimi.com/coding'
|
||||
) {
|
||||
return { unavailableReason: 'legacy_kimi_connection' }
|
||||
}
|
||||
|
||||
const key = connectionKey(config.api, config.baseUrl)
|
||||
const namedConnections = builtinConnections.get(providerId)
|
||||
if (namedConnections?.has(key)) return { unavailableReason: null, piProviderId: providerId }
|
||||
// A renamed provider can still be resolved if its protocol and endpoint identify one catalog.
|
||||
if (!namedConnections && config.baseUrl) {
|
||||
const matches = [...builtinConnections].filter(([, connections]) => connections.has(key))
|
||||
if (matches.length === 1) return { unavailableReason: null, piProviderId: matches[0][0] }
|
||||
}
|
||||
return { unavailableReason: 'unsupported_connection' }
|
||||
}
|
||||
|
||||
export async function discoverProviderModels(
|
||||
piProviderId: string,
|
||||
config: ProviderConfigSerializable,
|
||||
): Promise<CatalogResult> {
|
||||
const url = new URL(`/api/models/providers/${encodeURIComponent(piProviderId)}`, 'https://pi.dev')
|
||||
url.searchParams.set('pi-version', PI_AI_VERSION)
|
||||
let catalog: z.infer<typeof catalogSchema>
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
headers: { Accept: 'application/json' },
|
||||
redirect: 'error',
|
||||
signal: AbortSignal.timeout(REFRESH_TIMEOUT_MS),
|
||||
})
|
||||
if (response.status === 404 || response.status === 501) {
|
||||
return { status: 'unavailable', reason: 'catalog_unavailable' }
|
||||
}
|
||||
if (!response.ok) throw new Error(`Pi catalog returned HTTP ${response.status}`)
|
||||
catalog = catalogSchema.parse(await response.json())
|
||||
} catch (cause) {
|
||||
throw new HTTPException(502, { message: 'Could not refresh provider models', cause })
|
||||
}
|
||||
|
||||
const key = connectionKey(config.api, config.baseUrl)
|
||||
const azureDeployments = piProviderId === 'azure' ? azureDeploymentIds() : undefined
|
||||
const models = Object.entries(catalog).flatMap(([id, model]) => {
|
||||
if (
|
||||
model.id !== id ||
|
||||
model.provider !== piProviderId ||
|
||||
(model.type && model.type !== 'chat')
|
||||
) {
|
||||
return []
|
||||
}
|
||||
const matches = azureDeployments
|
||||
? model.api === config.api && model.baseUrl === '' && azureDeployments.has(id)
|
||||
: connectionKey(model.api, model.baseUrl) === key
|
||||
if (!matches) return []
|
||||
if (
|
||||
model.compat !== undefined &&
|
||||
!compatSchemas.get(model.api)?.safeParse(model.compat).success
|
||||
)
|
||||
return []
|
||||
if (
|
||||
model.thinkingLevelMap !== undefined &&
|
||||
!thinkingLevelMapSchema.safeParse(model.thinkingLevelMap).success
|
||||
)
|
||||
return []
|
||||
if (model.headers !== undefined && !catalogHeadersSchema.safeParse(model.headers).success)
|
||||
return []
|
||||
|
||||
// Keep omitted flags absent so Pi can apply model- and endpoint-specific defaults.
|
||||
const modelConfig = providerModelConfigSchema.safeParse(model)
|
||||
if (!modelConfig.success) return []
|
||||
const name = typeof model.name === 'string' && model.name ? model.name : id
|
||||
return [{ modelId: id, name, config: modelConfig.data }]
|
||||
})
|
||||
return { status: 'ready', models }
|
||||
}
|
||||
@@ -3,46 +3,53 @@ import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { teamService } from '@shumai/core/src/team/team'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
import { providerService } from './provider'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import * as generateModelsModule from './generator/generate-models'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { ProviderConfigSerializable, providerModelSchema } from '@shumai/dtos'
|
||||
import { getBuiltinProvidersMap } from '@shumai/core/src/provider/builtin'
|
||||
import { z } from 'zod'
|
||||
import modelsDevFixture from './fixtures/models-dev.json'
|
||||
import openRouterFixture from './fixtures/openrouter.json'
|
||||
import nvidiaFixture from './fixtures/nvidia.json'
|
||||
|
||||
const originalFetch = globalThis.fetch
|
||||
const openaiConfig = {
|
||||
api: 'openai-responses',
|
||||
baseUrl: 'https://api.openai.com/v1',
|
||||
apiKey: 'saved-test-key',
|
||||
} satisfies ProviderConfigSerializable
|
||||
|
||||
function setupCatalogFetchMock() {
|
||||
return vi.spyOn(globalThis, 'fetch').mockImplementation(async (input: RequestInfo | URL) => {
|
||||
const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url
|
||||
if (url.includes('models.dev')) {
|
||||
return new Response(JSON.stringify(modelsDevFixture), {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
const candidateConfig = {
|
||||
api: openaiConfig.api,
|
||||
reasoning: true,
|
||||
input: ['text'],
|
||||
contextWindow: 256000,
|
||||
maxTokens: 16000,
|
||||
cost: { input: 1, output: 2, cacheRead: 0, cacheWrite: 0 },
|
||||
} satisfies ProviderModel['config']
|
||||
|
||||
function catalogModel(id: string, options?: Record<string, unknown>) {
|
||||
return {
|
||||
...candidateConfig,
|
||||
provider: 'openai',
|
||||
baseUrl: openaiConfig.baseUrl,
|
||||
id,
|
||||
name: id,
|
||||
...options,
|
||||
}
|
||||
}
|
||||
|
||||
function mockCatalog(models: ReturnType<typeof catalogModel>[]) {
|
||||
const requests: Request[] = []
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input, init) => {
|
||||
const request = new Request(input, init)
|
||||
requests.push(request)
|
||||
if (new URL(request.url).origin !== 'https://pi.dev') {
|
||||
throw new Error('Unexpected catalog host')
|
||||
}
|
||||
if (url.includes('openrouter.ai')) {
|
||||
return new Response(JSON.stringify(openRouterFixture), {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
}
|
||||
if (url.includes('nvidia')) {
|
||||
return new Response(JSON.stringify(nvidiaFixture), {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
}
|
||||
if (url.includes('ai-gateway')) {
|
||||
return new Response(JSON.stringify({ data: [] }), {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
}
|
||||
return originalFetch(input)
|
||||
return Response.json(Object.fromEntries(models.map((model) => [model.id, model])))
|
||||
})
|
||||
return requests
|
||||
}
|
||||
|
||||
function readyPreview(result: Awaited<ReturnType<typeof providerService.refreshModels>>) {
|
||||
if (result.status !== 'ready') throw new Error('Expected refreshed models')
|
||||
return result
|
||||
}
|
||||
|
||||
type ProviderModel = z.infer<typeof providerModelSchema>
|
||||
@@ -385,182 +392,270 @@ describe('ProviderService', () => {
|
||||
expect((modelsAfterUpdate[1].config as { api: string }).api).toBe('anthropic-messages')
|
||||
})
|
||||
|
||||
it('should check for updates and correctly segregate new vs existing providers', async () => {
|
||||
const fetchSpy = setupCatalogFetchMock()
|
||||
try {
|
||||
// 1. Check updates with empty team: all discovered providers are new
|
||||
const emptyTeam = await prisma.team.create({
|
||||
data: { name: 'Empty Provider Team' },
|
||||
describe('model refresh', () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
vi.unstubAllEnvs()
|
||||
})
|
||||
|
||||
it('reports resolved credentials and eligibility separately and preserves legacy Kimi', async () => {
|
||||
vi.stubEnv('CUSTOM_OPENAI_KEY', 'a-resolved-test-key')
|
||||
vi.stubEnv('UNSET_ANTHROPIC_KEY', undefined)
|
||||
const team = await prisma.team.create({ data: { name: 'Providers' } })
|
||||
const configured = await providerService.create(team.id, 'OpenAI production', {
|
||||
...openaiConfig,
|
||||
apiKey: 'CUSTOM_OPENAI_KEY',
|
||||
})
|
||||
const initialCheck = await providerService.checkUpdates(emptyTeam.id)
|
||||
expect(initialCheck.totalNewProviders).toBeGreaterThan(0)
|
||||
expect(initialCheck.totalNewModels).toBeGreaterThan(0)
|
||||
expect(initialCheck.providers.every((p) => p.isNewProvider)).toBe(true)
|
||||
const unconfigured = await providerService.create(team.id, 'anthropic', {
|
||||
api: 'anthropic-messages',
|
||||
baseUrl: 'https://api.anthropic.com',
|
||||
apiKey: 'UNSET_ANTHROPIC_KEY',
|
||||
})
|
||||
const legacyConfig = {
|
||||
api: 'anthropic-messages',
|
||||
baseUrl: 'https://api.kimi.com/coding',
|
||||
apiKey: 'literal-kimi-key',
|
||||
} satisfies ProviderConfigSerializable
|
||||
const legacy = await providerService.create(team.id, 'kimi-coding', legacyConfig)
|
||||
const local = await providerService.create(team.id, 'Local Ollama', {
|
||||
api: 'openai-completions',
|
||||
baseUrl: 'http://localhost:11434/v1',
|
||||
})
|
||||
vi.stubEnv('AWS_PROFILE', 'test-profile')
|
||||
const bedrock = await providerService.create(team.id, 'amazon-bedrock', {
|
||||
api: 'bedrock-converse-stream',
|
||||
})
|
||||
const providers = await providerService.listByTeam(team.id)
|
||||
expect(providers).toHaveLength(5)
|
||||
expect(providers).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: configured.id,
|
||||
configured: true,
|
||||
refreshUnavailableReason: null,
|
||||
config: { ...openaiConfig, apiKey: 'CUSTOM_OPENAI_KEY' },
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: unconfigured.id,
|
||||
configured: false,
|
||||
refreshUnavailableReason: null,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: legacy.id,
|
||||
configured: true,
|
||||
refreshUnavailableReason: 'legacy_kimi_connection',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: local.id,
|
||||
configured: true,
|
||||
refreshUnavailableReason: 'unsupported_connection',
|
||||
}),
|
||||
expect.objectContaining({ id: bedrock.id, configured: true }),
|
||||
]),
|
||||
)
|
||||
|
||||
// 2. With default team (which has builtin providers initialized)
|
||||
const teamWithBuiltins = await teamService.ensureDefaultTeam()
|
||||
|
||||
// 3. Check updates after init: existing providers should have isNewProvider: false
|
||||
const afterInitCheck = await providerService.checkUpdates(teamWithBuiltins.id)
|
||||
const existing = afterInitCheck.providers.find((p) => !p.isNewProvider)
|
||||
expect(existing).toBeDefined()
|
||||
if (existing) {
|
||||
expect(existing.isNewProvider).toBe(false)
|
||||
const dbModels = await providerService.listModelsByProvider(
|
||||
teamWithBuiltins.id,
|
||||
(await providerService.listByTeam(teamWithBuiltins.id)).find(
|
||||
(p) => p.name === existing.name,
|
||||
)!.id,
|
||||
)
|
||||
const dbModelIds = new Set(dbModels.map((m) => m.modelId))
|
||||
for (const m of existing.models) {
|
||||
expect(dbModelIds.has(m.modelId)).toBe(false)
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
fetchSpy.mockRestore()
|
||||
}
|
||||
})
|
||||
|
||||
it('should throw an error when upstream catalog fetch fails in checkUpdates', async () => {
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
const spy = vi
|
||||
.spyOn(generateModelsModule, 'generateModels')
|
||||
.mockRejectedValueOnce(new Error('Failed to load models.dev catalog: 502 Bad Gateway'))
|
||||
|
||||
await expect(providerService.checkUpdates(team.id)).rejects.toThrow(
|
||||
'Failed to load models.dev catalog: 502 Bad Gateway',
|
||||
)
|
||||
spy.mockRestore()
|
||||
})
|
||||
|
||||
it('should throw an error when upstream catalog is empty in checkUpdates', async () => {
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
const spy = vi.spyOn(generateModelsModule, 'generateModels').mockResolvedValueOnce({
|
||||
providers: {},
|
||||
groupedProviders: {},
|
||||
sortedProviderIds: [],
|
||||
const requests = mockCatalog([])
|
||||
await expect(providerService.refreshModels(team.id, unconfigured.id)).resolves.toMatchObject({
|
||||
status: 'ready',
|
||||
models: [],
|
||||
})
|
||||
await expect(providerService.refreshModels(team.id, legacy.id)).resolves.toEqual({
|
||||
status: 'unavailable',
|
||||
reason: 'legacy_kimi_connection',
|
||||
})
|
||||
expect(requests.map(({ url }) => new URL(url).pathname)).toEqual([
|
||||
'/api/models/providers/anthropic',
|
||||
])
|
||||
expect(await providerService.getById(legacy.id)).toMatchObject({ config: legacyConfig })
|
||||
})
|
||||
|
||||
await expect(providerService.checkUpdates(team.id)).rejects.toThrow(
|
||||
'Failed to retrieve model catalog from upstream services',
|
||||
)
|
||||
spy.mockRestore()
|
||||
})
|
||||
it('refreshes only the requested provider and filters existing and incompatible models', async () => {
|
||||
vi.stubEnv('OPENAI_API_KEY', openaiConfig.apiKey)
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
const providers = await providerService.listByTeam(team.id)
|
||||
const openai = providers.find(({ name }) => name === 'openai')!
|
||||
const existingModels = await providerService.listModelsByProvider(team.id, openai.id)
|
||||
const requests = mockCatalog([
|
||||
catalogModel(existingModels[0].modelId),
|
||||
catalogModel('new-model', {
|
||||
compat: { supportsStrictMode: true },
|
||||
thinkingLevelMap: { low: 'low' },
|
||||
}),
|
||||
catalogModel('wrong-api', { api: 'openai-completions' }),
|
||||
catalogModel('wrong-url', { baseUrl: 'https://other.example/v1' }),
|
||||
catalogModel('wrong-provider', { provider: 'anthropic' }),
|
||||
catalogModel('not-chat', { type: 'image' }),
|
||||
catalogModel('invalid-compat', { compat: { supportsStrictMode: 'yes' } }),
|
||||
])
|
||||
|
||||
it('should apply sync by adding selected providers and models without modifying existing ones', async () => {
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
|
||||
// Create an existing provider with 1 model and a custom apiKey
|
||||
const existingProvider = await providerService.create(
|
||||
team.id,
|
||||
'test-existing-provider',
|
||||
{ api: 'openai-responses', apiKey: 'custom-api-key', baseUrl: 'https://example.com' },
|
||||
[
|
||||
{
|
||||
modelId: 'existing-m1',
|
||||
name: 'Existing Model 1',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
const result = await providerService.refreshModels(team.id, openai.id)
|
||||
expect(result).toMatchObject({
|
||||
status: 'ready',
|
||||
models: [
|
||||
{
|
||||
modelId: 'new-model',
|
||||
name: 'new-model',
|
||||
config: {
|
||||
...candidateConfig,
|
||||
compat: { supportsStrictMode: true },
|
||||
thinkingLevelMap: { low: 'low' },
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
)
|
||||
|
||||
// Apply sync with 1 new provider and 1 new model on the existing provider
|
||||
const syncResult = await providerService.applySync(team.id, {
|
||||
providers: [
|
||||
{
|
||||
name: 'test-new-synced-provider',
|
||||
isNewProvider: true,
|
||||
config: {
|
||||
api: 'anthropic-messages',
|
||||
apiKey: 'ENV_SYNC_KEY',
|
||||
baseUrl: 'https://api.anthropic.com',
|
||||
},
|
||||
models: [
|
||||
{
|
||||
modelId: 'new-p-m1',
|
||||
name: 'New Provider Model 1',
|
||||
config: {
|
||||
api: 'anthropic-messages',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 200000,
|
||||
maxTokens: 8192,
|
||||
cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'test-existing-provider',
|
||||
isNewProvider: false,
|
||||
config: { api: 'openai-responses', apiKey: 'should-not-override' },
|
||||
models: [
|
||||
{
|
||||
modelId: 'existing-m2',
|
||||
name: 'Newly Added Model 2',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: true,
|
||||
input: ['text'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
},
|
||||
// Duplicate model that already exists: should be ignored
|
||||
{
|
||||
modelId: 'existing-m1',
|
||||
name: 'Existing Model 1 Overwrite Attempt',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 999999,
|
||||
maxTokens: 999999,
|
||||
cost: { input: 9, output: 9, cacheRead: 9, cacheWrite: 9 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
],
|
||||
})
|
||||
expect(requests.map(({ url }) => new URL(url).pathname)).toEqual([
|
||||
'/api/models/providers/openai',
|
||||
])
|
||||
expect(requests[0].headers.has('Authorization')).toBe(false)
|
||||
expect(JSON.stringify(result)).not.toContain(openaiConfig.apiKey)
|
||||
expect(await providerService.listModelsByProvider(team.id, openai.id)).toEqual(existingModels)
|
||||
expect(await providerService.listByTeam(team.id)).toEqual(providers)
|
||||
})
|
||||
|
||||
expect(syncResult.addedProviders).toBe(1)
|
||||
expect(syncResult.addedModels).toBe(2)
|
||||
it('uses the versioned public OpenRouter catalog without sending saved credentials', async () => {
|
||||
const openRouterKey = 'saved-openrouter-test-key'
|
||||
vi.stubEnv('SHUMAI_TEST_OPENROUTER_KEY', openRouterKey)
|
||||
const team = await prisma.team.create({ data: { name: 'OpenRouter' } })
|
||||
const baseUrl = 'https://openrouter.ai/api/v1'
|
||||
const api = 'openai-completions' as const
|
||||
const provider = await providerService.create(team.id, 'openrouter', {
|
||||
api,
|
||||
baseUrl: baseUrl + '/',
|
||||
apiKey: 'SHUMAI_TEST_OPENROUTER_KEY',
|
||||
})
|
||||
const modelId = 'org/new-openrouter-model'
|
||||
const requests: Request[] = []
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input, init) => {
|
||||
const request = new Request(input, init)
|
||||
requests.push(request)
|
||||
return Response.json({
|
||||
[modelId]: { ...catalogModel(modelId, { api, baseUrl }), provider: 'openrouter' },
|
||||
})
|
||||
})
|
||||
|
||||
// Verify existing provider config was NOT modified
|
||||
const reloadedExisting = await providerService.getById(existingProvider.id)
|
||||
expect((reloadedExisting?.config as { apiKey: string }).apiKey).toBe('custom-api-key')
|
||||
const { models } = readyPreview(await providerService.refreshModels(team.id, provider.id))
|
||||
expect(models.map(({ modelId }) => modelId)).toEqual([modelId])
|
||||
expect(requests.map(({ url }) => url)).toEqual([
|
||||
'https://pi.dev/api/models/providers/openrouter?pi-version=1.7.0',
|
||||
])
|
||||
expect(requests[0].headers.has('Authorization')).toBe(false)
|
||||
|
||||
// Verify existing model was NOT modified
|
||||
const existingModels = await providerService.listModelsByProvider(team.id, existingProvider.id)
|
||||
expect(existingModels).toHaveLength(2)
|
||||
const m1 = existingModels.find((m) => m.modelId === 'existing-m1')
|
||||
expect(m1?.name).toBe('Existing Model 1')
|
||||
expect((m1?.config as { contextWindow: number }).contextWindow).toBe(128000)
|
||||
const customProvider = await providerService.update(team.id, provider.id, {
|
||||
...provider.config,
|
||||
baseUrl: 'https://openrouter-proxy.example/api/v1',
|
||||
})
|
||||
await expect(providerService.refreshModels(team.id, customProvider.id)).resolves.toEqual({
|
||||
status: 'unavailable',
|
||||
reason: 'unsupported_connection',
|
||||
})
|
||||
expect(requests).toHaveLength(1)
|
||||
})
|
||||
|
||||
// Verify newly added model on existing provider
|
||||
const m2 = existingModels.find((m) => m.modelId === 'existing-m2')
|
||||
expect(m2).toBeDefined()
|
||||
expect(m2?.name).toBe('Newly Added Model 2')
|
||||
it('distinguishes a successful empty preview from an upstream error', async () => {
|
||||
vi.stubEnv('OPENAI_API_KEY', openaiConfig.apiKey)
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
const provider = (await providerService.listByTeam(team.id)).find(
|
||||
({ name }) => name === 'openai',
|
||||
)!
|
||||
mockCatalog([])
|
||||
await expect(providerService.refreshModels(team.id, provider.id)).resolves.toMatchObject({
|
||||
status: 'ready',
|
||||
models: [],
|
||||
})
|
||||
vi.restoreAllMocks()
|
||||
const fetchMock = vi.spyOn(globalThis, 'fetch')
|
||||
fetchMock.mockResolvedValueOnce(new Response(null, { status: 404 }))
|
||||
await expect(providerService.refreshModels(team.id, provider.id)).resolves.toEqual({
|
||||
status: 'unavailable',
|
||||
reason: 'catalog_unavailable',
|
||||
})
|
||||
fetchMock.mockResolvedValueOnce(Response.json({ error: 'malformed catalog' }))
|
||||
await expect(providerService.refreshModels(team.id, provider.id)).rejects.toMatchObject({
|
||||
status: 502,
|
||||
})
|
||||
fetchMock.mockRejectedValueOnce(new DOMException('Timed out', 'TimeoutError'))
|
||||
|
||||
// Verify newly added provider
|
||||
const providers = await providerService.listByTeam(team.id)
|
||||
const newProvider = providers.find((p) => p.name === 'test-new-synced-provider')
|
||||
expect(newProvider).toBeDefined()
|
||||
expect(newProvider?.isBuiltin).toBe(true)
|
||||
expect((newProvider?.config as { apiKey: string }).apiKey).toBe('ENV_SYNC_KEY')
|
||||
await expect(providerService.refreshModels(team.id, provider.id)).rejects.toMatchObject({
|
||||
status: 502,
|
||||
})
|
||||
})
|
||||
|
||||
const newProviderModels = await providerService.listModelsByProvider(team.id, newProvider!.id)
|
||||
expect(newProviderModels).toHaveLength(1)
|
||||
expect(newProviderModels[0].modelId).toBe('new-p-m1')
|
||||
it('imports only the selected models once and preserves existing models and settings', async () => {
|
||||
vi.stubEnv('OPENAI_API_KEY', openaiConfig.apiKey)
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
const provider = (await providerService.listByTeam(team.id)).find(
|
||||
({ name }) => name === 'openai',
|
||||
)!
|
||||
const original = await providerService.getById(provider.id)
|
||||
const existing = await providerService.listModelsByProvider(team.id, provider.id)
|
||||
mockCatalog([catalogModel('new-model'), catalogModel('unselected-model')])
|
||||
const preview = readyPreview(await providerService.refreshModels(team.id, provider.id))
|
||||
const selection = { providerUpdatedAt: preview.providerUpdatedAt, modelIds: ['new-model'] }
|
||||
|
||||
await expect(providerService.importModels(team.id, provider.id, selection)).resolves.toEqual({
|
||||
addedModels: 1,
|
||||
})
|
||||
await expect(providerService.importModels(team.id, provider.id, selection)).resolves.toEqual({
|
||||
addedModels: 0,
|
||||
})
|
||||
expect(await providerService.listModelsByProvider(team.id, provider.id)).toEqual([
|
||||
expect.objectContaining({ modelId: 'new-model', config: candidateConfig }),
|
||||
...existing,
|
||||
])
|
||||
expect(await providerService.getById(provider.id)).toEqual(original)
|
||||
})
|
||||
|
||||
it('rejects out-of-team, unknown, and stale selections without adding models', async () => {
|
||||
const team = await prisma.team.create({ data: { name: 'Refresh Team' } })
|
||||
const otherTeam = await prisma.team.create({ data: { name: 'Other Team' } })
|
||||
const provider = await providerService.create(team.id, 'openai', openaiConfig)
|
||||
const requests = mockCatalog([catalogModel('new-model')])
|
||||
await expect(providerService.refreshModels(otherTeam.id, provider.id)).rejects.toMatchObject({
|
||||
status: 404,
|
||||
})
|
||||
expect(requests).toHaveLength(0)
|
||||
|
||||
const preview = readyPreview(await providerService.refreshModels(team.id, provider.id))
|
||||
const selection = { providerUpdatedAt: preview.providerUpdatedAt, modelIds: ['new-model'] }
|
||||
await expect(
|
||||
providerService.importModels(otherTeam.id, provider.id, selection),
|
||||
).rejects.toMatchObject({ status: 404 })
|
||||
await expect(
|
||||
providerService.importModels(team.id, provider.id, {
|
||||
...selection,
|
||||
modelIds: ['new-model', 'unknown'],
|
||||
}),
|
||||
).rejects.toMatchObject({ status: 409 })
|
||||
|
||||
await providerService.update(team.id, provider.id, { ...openaiConfig, apiKey: 'changed-key' })
|
||||
await expect(
|
||||
providerService.importModels(team.id, provider.id, selection),
|
||||
).rejects.toMatchObject({ status: 409 })
|
||||
expect(await providerService.listModelsByProvider(team.id, provider.id)).toEqual([])
|
||||
})
|
||||
|
||||
it('refreshes legacy Azure connections using only configured deployment mappings', async () => {
|
||||
vi.stubEnv('AZURE_OPENAI_DEPLOYMENT_NAME_MAP', undefined)
|
||||
const team = await prisma.team.create({ data: { name: 'Azure models' } })
|
||||
const provider = await providerService.create(team.id, 'azure-openai-responses', {
|
||||
api: 'azure-openai-responses',
|
||||
baseUrl: 'https://example.openai.azure.com/openai/v1',
|
||||
})
|
||||
const azure = { provider: 'azure', api: 'azure-openai-responses', baseUrl: '' }
|
||||
const requests = mockCatalog([
|
||||
catalogModel('gpt-deployed', azure),
|
||||
catalogModel('gpt-unmapped', azure),
|
||||
])
|
||||
await expect(providerService.refreshModels(team.id, provider.id)).resolves.toEqual({
|
||||
status: 'unavailable',
|
||||
reason: 'azure_deployment_required',
|
||||
})
|
||||
vi.stubEnv('AZURE_OPENAI_DEPLOYMENT_NAME_MAP', 'gpt-deployed=team-deployment')
|
||||
const preview = readyPreview(await providerService.refreshModels(team.id, provider.id))
|
||||
expect(preview.models.map(({ modelId }) => modelId)).toEqual(['gpt-deployed'])
|
||||
expect(requests.map(({ url }) => new URL(url).pathname)).toEqual([
|
||||
'/api/models/providers/azure',
|
||||
])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,22 +1,16 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import {
|
||||
CreateModelRequest,
|
||||
ImportProviderModelsRequest,
|
||||
ProviderConfigSerializable,
|
||||
ProviderModelRefreshResponse,
|
||||
providerModelSchema,
|
||||
SyncApplyRequest,
|
||||
SyncApplyResponse,
|
||||
SyncCheckResponse,
|
||||
SyncModelItem,
|
||||
SyncProviderItem,
|
||||
UpdateModelRequest,
|
||||
} from '@shumai/dtos'
|
||||
import {
|
||||
ENV_MAP,
|
||||
getBuiltinProvidersMap,
|
||||
PRIORITY_PROVIDERS,
|
||||
} from '@shumai/core/src/provider/builtin'
|
||||
import { generateModels } from '@shumai/core/src/provider/generator/generate-models'
|
||||
import { getBuiltinProvidersMap } from '@shumai/core/src/provider/builtin'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { z } from 'zod'
|
||||
import { discoverProviderModels, getRefreshConnection, isProviderConfigured } from './model-refresh'
|
||||
|
||||
type ProviderModel = z.infer<typeof providerModelSchema>
|
||||
|
||||
@@ -70,11 +64,23 @@ export class ProviderService {
|
||||
orderBy: { id: 'desc' },
|
||||
})
|
||||
|
||||
return providers.map((p) => ({
|
||||
...p,
|
||||
modelsCount: p._count.models,
|
||||
_count: undefined,
|
||||
}))
|
||||
return providers.map(
|
||||
({ _count, id, teamId, name, config, isBuiltin, createdAt, updatedAt }) => {
|
||||
const connection = getRefreshConnection(name, config)
|
||||
return {
|
||||
id,
|
||||
teamId,
|
||||
name,
|
||||
config,
|
||||
isBuiltin,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
modelsCount: _count.models,
|
||||
configured: isProviderConfigured(name, config),
|
||||
refreshUnavailableReason: connection.unavailableReason,
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
async getById(id: string) {
|
||||
@@ -124,6 +130,11 @@ export class ProviderService {
|
||||
name?: string,
|
||||
) {
|
||||
return this.prismaClient.$transaction(async (tx) => {
|
||||
const provider = await tx.provider.update({
|
||||
where: { id, teamId },
|
||||
data: { config, ...(name ? { name } : {}) },
|
||||
})
|
||||
|
||||
if (models !== undefined) {
|
||||
const existingModels = await tx.model.findMany({
|
||||
where: { providerId: id },
|
||||
@@ -189,15 +200,7 @@ export class ProviderService {
|
||||
}
|
||||
}
|
||||
|
||||
// Update provider config and optional name
|
||||
return tx.provider.update({
|
||||
where: { id, teamId },
|
||||
data: {
|
||||
config,
|
||||
...(name ? { name } : {}),
|
||||
},
|
||||
include: { models: true },
|
||||
})
|
||||
return { ...provider, models: await tx.model.findMany({ where: { providerId: id } }) }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -305,179 +308,66 @@ export class ProviderService {
|
||||
})
|
||||
}
|
||||
|
||||
async checkUpdates(teamId: string): Promise<SyncCheckResponse> {
|
||||
const catalog = await generateModels({ strict: true, timeoutMs: 30000 })
|
||||
|
||||
if (!catalog || catalog.sortedProviderIds.length === 0) {
|
||||
throw new Error('Failed to retrieve model catalog from upstream services')
|
||||
}
|
||||
|
||||
const existingProviders = await this.prismaClient.provider.findMany({
|
||||
where: { teamId },
|
||||
include: { models: true },
|
||||
async refreshModels(teamId: string, providerId: string): Promise<ProviderModelRefreshResponse> {
|
||||
const provider = await this.prismaClient.provider.findUnique({
|
||||
where: { id: providerId, teamId },
|
||||
include: { models: { select: { modelId: true } } },
|
||||
})
|
||||
if (!provider) throw new HTTPException(404, { message: 'Provider not found' })
|
||||
|
||||
const existingProviderMap = new Map<string, (typeof existingProviders)[number]>()
|
||||
for (const p of existingProviders) {
|
||||
existingProviderMap.set(p.name, p)
|
||||
const connection = getRefreshConnection(provider.name, provider.config)
|
||||
if (connection.unavailableReason) {
|
||||
return { status: 'unavailable', reason: connection.unavailableReason }
|
||||
}
|
||||
|
||||
const items: SyncProviderItem[] = []
|
||||
let totalNewProviders = 0
|
||||
let totalNewModels = 0
|
||||
|
||||
for (const providerId of catalog.sortedProviderIds) {
|
||||
const modelsMap = catalog.providers[providerId]
|
||||
if (!modelsMap) continue
|
||||
const modelList = Object.values(modelsMap)
|
||||
if (modelList.length === 0) continue
|
||||
|
||||
const existingProvider = existingProviderMap.get(providerId)
|
||||
|
||||
if (!existingProvider) {
|
||||
const firstModel = modelList[0]
|
||||
const newModels: SyncModelItem[] = modelList.map((m) => ({
|
||||
modelId: m.id,
|
||||
name: m.name || m.id,
|
||||
config: {
|
||||
api: m.api as ProviderConfigSerializable['api'],
|
||||
reasoning: m.reasoning ?? false,
|
||||
input: (m.input ?? ['text']) as ('text' | 'image')[],
|
||||
contextWindow: m.contextWindow,
|
||||
maxTokens: m.maxTokens,
|
||||
cost: {
|
||||
input: m.cost?.input ?? 0,
|
||||
output: m.cost?.output ?? 0,
|
||||
cacheRead: m.cost?.cacheRead ?? 0,
|
||||
cacheWrite: m.cost?.cacheWrite ?? 0,
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
items.push({
|
||||
name: providerId,
|
||||
isNewProvider: true,
|
||||
config: {
|
||||
api: firstModel.api as ProviderConfigSerializable['api'],
|
||||
baseUrl: firstModel.baseUrl,
|
||||
apiKey: ENV_MAP[providerId] || '',
|
||||
},
|
||||
models: newModels,
|
||||
})
|
||||
|
||||
totalNewProviders++
|
||||
totalNewModels += newModels.length
|
||||
} else {
|
||||
const existingModelIds = new Set(existingProvider.models.map((m) => m.modelId))
|
||||
const newModels: SyncModelItem[] = []
|
||||
|
||||
for (const m of modelList) {
|
||||
if (!existingModelIds.has(m.id)) {
|
||||
newModels.push({
|
||||
modelId: m.id,
|
||||
name: m.name || m.id,
|
||||
config: {
|
||||
api: m.api as ProviderConfigSerializable['api'],
|
||||
reasoning: m.reasoning ?? false,
|
||||
input: (m.input ?? ['text']) as ('text' | 'image')[],
|
||||
contextWindow: m.contextWindow,
|
||||
maxTokens: m.maxTokens,
|
||||
cost: {
|
||||
input: m.cost?.input ?? 0,
|
||||
output: m.cost?.output ?? 0,
|
||||
cacheRead: m.cost?.cacheRead ?? 0,
|
||||
cacheWrite: m.cost?.cacheWrite ?? 0,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (newModels.length > 0) {
|
||||
items.push({
|
||||
name: providerId,
|
||||
isNewProvider: false,
|
||||
config: existingProvider.config as ProviderConfigSerializable,
|
||||
models: newModels,
|
||||
})
|
||||
totalNewModels += newModels.length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
items.sort((a, b) => {
|
||||
const indexA = PRIORITY_PROVIDERS.indexOf(a.name)
|
||||
const indexB = PRIORITY_PROVIDERS.indexOf(b.name)
|
||||
if (indexA !== -1 && indexB !== -1) return indexA - indexB
|
||||
if (indexA !== -1) return -1
|
||||
if (indexB !== -1) return 1
|
||||
return a.name.localeCompare(b.name)
|
||||
})
|
||||
|
||||
const catalog = await discoverProviderModels(connection.piProviderId, provider.config)
|
||||
if (catalog.status === 'unavailable') return catalog
|
||||
const existingIds = new Set(provider.models.map(({ modelId }) => modelId))
|
||||
return {
|
||||
providers: items,
|
||||
totalNewProviders,
|
||||
totalNewModels,
|
||||
status: 'ready',
|
||||
providerUpdatedAt: provider.updatedAt.toISOString(),
|
||||
models: catalog.models.filter(({ modelId }) => !existingIds.has(modelId)),
|
||||
}
|
||||
}
|
||||
|
||||
async applySync(teamId: string, payload: SyncApplyRequest): Promise<SyncApplyResponse> {
|
||||
let addedProviders = 0
|
||||
let addedModels = 0
|
||||
|
||||
await this.prismaClient.$transaction(async (tx) => {
|
||||
for (const providerItem of payload.providers) {
|
||||
let providerId: string
|
||||
|
||||
if (providerItem.isNewProvider) {
|
||||
const existing = await tx.provider.findFirst({
|
||||
where: { teamId, name: providerItem.name },
|
||||
})
|
||||
if (!existing) {
|
||||
const created = await tx.provider.create({
|
||||
data: {
|
||||
teamId,
|
||||
name: providerItem.name,
|
||||
isBuiltin: true,
|
||||
config: providerItem.config,
|
||||
},
|
||||
})
|
||||
providerId = created.id
|
||||
addedProviders++
|
||||
} else {
|
||||
providerId = existing.id
|
||||
}
|
||||
} else {
|
||||
const existing = await tx.provider.findFirst({
|
||||
where: { teamId, name: providerItem.name },
|
||||
})
|
||||
if (!existing) continue
|
||||
providerId = existing.id
|
||||
}
|
||||
|
||||
for (const modelItem of providerItem.models) {
|
||||
const existingModel = await tx.model.findFirst({
|
||||
where: {
|
||||
providerId,
|
||||
modelId: modelItem.modelId,
|
||||
},
|
||||
})
|
||||
if (!existingModel) {
|
||||
await tx.model.create({
|
||||
data: {
|
||||
providerId,
|
||||
modelId: modelItem.modelId,
|
||||
name: modelItem.name || modelItem.modelId,
|
||||
config: modelItem.config,
|
||||
},
|
||||
})
|
||||
addedModels++
|
||||
}
|
||||
}
|
||||
}
|
||||
async importModels(
|
||||
teamId: string,
|
||||
providerId: string,
|
||||
{ modelIds, providerUpdatedAt }: ImportProviderModelsRequest,
|
||||
) {
|
||||
const provider = await this.prismaClient.provider.findUnique({
|
||||
where: { id: providerId, teamId },
|
||||
include: { models: { where: { modelId: { in: modelIds } }, select: { modelId: true } } },
|
||||
})
|
||||
if (!provider) throw new HTTPException(404, { message: 'Provider not found' })
|
||||
const staleSelection = () =>
|
||||
new HTTPException(409, { message: 'Refresh the model list before importing' })
|
||||
if (provider.updatedAt.toISOString() !== providerUpdatedAt) throw staleSelection()
|
||||
const existingIds = new Set(provider.models.map(({ modelId }) => modelId))
|
||||
const newIds = new Set(modelIds.filter((modelId) => !existingIds.has(modelId)))
|
||||
if (newIds.size === 0) return { addedModels: 0 }
|
||||
|
||||
return { addedProviders, addedModels }
|
||||
const connection = getRefreshConnection(provider.name, provider.config)
|
||||
if (connection.unavailableReason) throw staleSelection()
|
||||
const catalog = await discoverProviderModels(connection.piProviderId, provider.config)
|
||||
if (catalog.status === 'unavailable') throw staleSelection()
|
||||
const models = catalog.models.filter(({ modelId }) => newIds.has(modelId))
|
||||
if (models.length !== newIds.size) throw staleSelection()
|
||||
|
||||
return this.prismaClient.$transaction(async (tx) => {
|
||||
// The network request finishes before we lock the connection for the insert.
|
||||
const [locked] = await tx.$queryRaw<{ updatedAt: Date }[]>`
|
||||
SELECT updated_at AS "updatedAt" FROM providers
|
||||
WHERE id = ${providerId} AND team_id = ${teamId} FOR NO KEY UPDATE
|
||||
`
|
||||
if (!locked) throw new HTTPException(404, { message: 'Provider not found' })
|
||||
if (locked.updatedAt.toISOString() !== providerUpdatedAt) throw staleSelection()
|
||||
|
||||
const { count } = await tx.model.createMany({
|
||||
data: models.map(({ modelId, name, config }) => ({ providerId, modelId, name, config })),
|
||||
skipDuplicates: true,
|
||||
})
|
||||
return { addedModels: count }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { embeddingServerService } from './embedding-server'
|
||||
|
||||
describe('Embedding server settings', () => {
|
||||
setupTestDbHooks()
|
||||
let teamId: string
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.stubEnv('EMBEDDING_PROVIDER', undefined)
|
||||
vi.stubEnv('GEMMA_EMBEDDING_OPENAI_BASE_URL', undefined)
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'Embedding integration', settings: { appearance: { hideAgent: true } } },
|
||||
})
|
||||
teamId = team.id
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs()
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
it('saves and clears the local URL, preserving other settings', async () => {
|
||||
await expect(
|
||||
embeddingServerService.updateSettings(teamId, ' http://embedding:9379/ '),
|
||||
).resolves.toEqual({
|
||||
url: 'http://embedding:9379',
|
||||
isEnvConfigured: false,
|
||||
})
|
||||
await expect(embeddingServerService.resolveRuntimeConfig(teamId)).resolves.toEqual({
|
||||
provider: 'gemma-embedding-2-openai',
|
||||
embeddingEndpoint: 'http://embedding:9379/v1/embeddings',
|
||||
transcriptionEndpoint: 'http://embedding:9379/v1/audio/transcriptions',
|
||||
})
|
||||
await expect(embeddingServerService.resolveRuntimeConfig()).resolves.toMatchObject({
|
||||
provider: 'gemma-embedding-2-openai',
|
||||
})
|
||||
await embeddingServerService.updateSettings(teamId, ' ')
|
||||
await expect(embeddingServerService.getSettings(teamId)).resolves.toMatchObject({
|
||||
url: undefined,
|
||||
isEnvConfigured: false,
|
||||
})
|
||||
await expect(embeddingServerService.resolveRuntimeConfig(teamId)).resolves.toMatchObject({
|
||||
provider: 'gemini-embedding-2',
|
||||
})
|
||||
const team = await prisma.team.findUniqueOrThrow({ where: { id: teamId } })
|
||||
expect(team.settings).toEqual({ appearance: { hideAgent: true } })
|
||||
})
|
||||
|
||||
it('keeps Compose environment configuration read-only and tests its effective URL', async () => {
|
||||
await embeddingServerService.updateSettings(teamId, 'https://saved.example/v1')
|
||||
vi.stubEnv('GEMMA_EMBEDDING_OPENAI_BASE_URL', 'http://embedding-server:9379/v1/')
|
||||
vi.stubEnv('EMBEDDING_PROVIDER', 'gemma-embedding-2-openai')
|
||||
const fetch = vi
|
||||
.spyOn(globalThis, 'fetch')
|
||||
.mockResolvedValue(Response.json({ data: [{ id: 'embeddinggemma-2' }] }))
|
||||
await expect(embeddingServerService.getSettings(teamId)).resolves.toEqual({
|
||||
url: 'http://embedding-server:9379/v1',
|
||||
isEnvConfigured: true,
|
||||
})
|
||||
await expect(embeddingServerService.resolveRuntimeConfig(teamId)).resolves.toEqual({
|
||||
provider: 'gemma-embedding-2-openai',
|
||||
embeddingEndpoint: 'http://embedding-server:9379/v1/embeddings',
|
||||
transcriptionEndpoint: 'http://embedding-server:9379/v1/audio/transcriptions',
|
||||
})
|
||||
await expect(embeddingServerService.updateSettings(teamId, '')).rejects.toMatchObject({
|
||||
status: 400,
|
||||
})
|
||||
await expect(
|
||||
embeddingServerService.testConnection(teamId, 'https://draft.example'),
|
||||
).resolves.toEqual({ ok: true })
|
||||
expect(fetch).toHaveBeenCalledExactlyOnceWith(
|
||||
'http://embedding-server:9379/v1/models',
|
||||
expect.objectContaining({ redirect: 'error' }),
|
||||
)
|
||||
vi.stubEnv('GEMMA_EMBEDDING_OPENAI_BASE_URL', undefined)
|
||||
await expect(embeddingServerService.getSettings(teamId)).resolves.toMatchObject({
|
||||
url: 'https://saved.example/v1',
|
||||
})
|
||||
})
|
||||
|
||||
it('respects explicit provider selection and accepts a full embedding endpoint', async () => {
|
||||
await embeddingServerService.updateSettings(
|
||||
teamId,
|
||||
'https://embedding.example/custom/v1/embeddings/',
|
||||
)
|
||||
vi.stubEnv('EMBEDDING_PROVIDER', 'gemini-embedding-2')
|
||||
await expect(embeddingServerService.resolveRuntimeConfig(teamId)).resolves.toEqual({
|
||||
provider: 'gemini-embedding-2',
|
||||
embeddingEndpoint: 'https://embedding.example/custom/v1/embeddings',
|
||||
transcriptionEndpoint: 'https://embedding.example/custom/v1/audio/transcriptions',
|
||||
})
|
||||
})
|
||||
|
||||
it.each([
|
||||
'file:///tmp/server',
|
||||
'https://user:pass@embedding.example',
|
||||
'https://example.test?token=x',
|
||||
'embedding:9379',
|
||||
])('rejects an invalid server URL (%s)', async (url) => {
|
||||
await expect(embeddingServerService.updateSettings(teamId, url)).rejects.toMatchObject({
|
||||
status: 400,
|
||||
})
|
||||
await expect(embeddingServerService.testConnection(teamId, url)).rejects.toMatchObject({
|
||||
status: 400,
|
||||
})
|
||||
})
|
||||
|
||||
it('tests an unsaved URL without changing settings and detects an incompatible endpoint', async () => {
|
||||
const fetch = vi
|
||||
.spyOn(globalThis, 'fetch')
|
||||
.mockResolvedValue(Response.json({ data: [{ id: 'another-model' }] }))
|
||||
await expect(
|
||||
embeddingServerService.testConnection(teamId, 'https://draft.example'),
|
||||
).resolves.toMatchObject({ ok: false })
|
||||
expect(fetch).toHaveBeenCalledWith('https://draft.example/v1/models', expect.any(Object))
|
||||
await expect(embeddingServerService.getSettings(teamId)).resolves.toMatchObject({
|
||||
url: undefined,
|
||||
})
|
||||
})
|
||||
|
||||
it('reports unreachable and HTTP failure responses', async () => {
|
||||
const fetch = vi
|
||||
.spyOn(globalThis, 'fetch')
|
||||
.mockRejectedValueOnce(new Error('socket error'))
|
||||
.mockResolvedValueOnce(new Response(null, { status: 401 }))
|
||||
await expect(embeddingServerService.testConnection(teamId)).resolves.toMatchObject({
|
||||
ok: false,
|
||||
})
|
||||
expect(fetch).not.toHaveBeenCalled()
|
||||
await expect(
|
||||
embeddingServerService.testConnection(teamId, 'https://draft.example'),
|
||||
).resolves.toMatchObject({ ok: false })
|
||||
await expect(
|
||||
embeddingServerService.testConnection(teamId, 'https://draft.example'),
|
||||
).resolves.toMatchObject({
|
||||
ok: false,
|
||||
error: expect.stringContaining('401'),
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,105 @@
|
||||
import {
|
||||
resolveIntegrationConfig,
|
||||
updateIntegrationSettings,
|
||||
type IntegrationDefinition,
|
||||
} from '@shumai/core/src/integrations/helper'
|
||||
import {
|
||||
updateEmbeddingServerSettingsRequestSchema,
|
||||
type EmbeddingServerSettingsResponse,
|
||||
} from '@shumai/dtos'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { z } from 'zod'
|
||||
|
||||
const integration: IntegrationDefinition<'embeddingServer'> = {
|
||||
name: 'Embedding server',
|
||||
settingsKey: 'embeddingServer',
|
||||
envKeys: { url: ['GEMMA_EMBEDDING_OPENAI_BASE_URL'] },
|
||||
requireSettingsRead: true,
|
||||
}
|
||||
|
||||
export const LOCAL_EMBEDDING_PROVIDER = 'gemma-embedding-2-openai'
|
||||
const defaultLocalBaseUrl = 'http://localhost:9379/v1'
|
||||
|
||||
export function resolveEmbeddingProvider(
|
||||
{ url, isEnvConfigured }: EmbeddingServerSettingsResponse,
|
||||
providerOverride?: string,
|
||||
): string {
|
||||
return (
|
||||
providerOverride ||
|
||||
process.env.EMBEDDING_PROVIDER ||
|
||||
(url && !isEnvConfigured ? LOCAL_EMBEDDING_PROVIDER : 'gemini-embedding-2')
|
||||
)
|
||||
}
|
||||
|
||||
function getOpenAiBaseUrl(url: string): string {
|
||||
const baseUrl = url.replace(/\/embeddings$/, '')
|
||||
return baseUrl.endsWith('/v1') ? baseUrl : `${baseUrl}/v1`
|
||||
}
|
||||
|
||||
function getEmbeddingEndpoint(url: string): string {
|
||||
return url.endsWith('/embeddings') ? url : `${getOpenAiBaseUrl(url)}/embeddings`
|
||||
}
|
||||
|
||||
const modelListSchema = z.object({
|
||||
data: z.array(z.object({ id: z.string() })),
|
||||
})
|
||||
|
||||
export class EmbeddingServerService {
|
||||
async resolveRuntimeConfig(teamId?: string, providerOverride?: string) {
|
||||
const { url, isEnv } = await resolveIntegrationConfig(integration, teamId ?? null)
|
||||
const provider = resolveEmbeddingProvider({ url, isEnvConfigured: isEnv }, providerOverride)
|
||||
const localUrl = url || defaultLocalBaseUrl
|
||||
return {
|
||||
provider,
|
||||
embeddingEndpoint: getEmbeddingEndpoint(localUrl),
|
||||
transcriptionEndpoint: `${getOpenAiBaseUrl(localUrl)}/audio/transcriptions`,
|
||||
}
|
||||
}
|
||||
|
||||
async getSettings(teamId: string): Promise<EmbeddingServerSettingsResponse> {
|
||||
const { url, isEnv } = await resolveIntegrationConfig(integration, teamId)
|
||||
return { url, isEnvConfigured: isEnv }
|
||||
}
|
||||
|
||||
async updateSettings(teamId: string, url: string): Promise<EmbeddingServerSettingsResponse> {
|
||||
const { url: validUrl } = this.validateUrl(url)
|
||||
const settings = await updateIntegrationSettings(integration, teamId, { url: validUrl })
|
||||
return { url: settings.url, isEnvConfigured: settings.isEnvConfigured }
|
||||
}
|
||||
|
||||
async testConnection(teamId: string, url?: string): Promise<{ ok: boolean; error?: string }> {
|
||||
const config = await resolveIntegrationConfig(integration, teamId)
|
||||
const target = config.isEnv || url === undefined ? config.url : this.validateUrl(url).url
|
||||
if (!target) return { ok: false, error: 'Server URL is required' }
|
||||
|
||||
const endpoint = getEmbeddingEndpoint(target.replace(/\/+$/, ''))
|
||||
try {
|
||||
const response = await fetch(endpoint.replace(/\/embeddings$/, '/models'), {
|
||||
redirect: 'error',
|
||||
signal: AbortSignal.timeout(5000),
|
||||
})
|
||||
if (!response.ok) {
|
||||
await response.body?.cancel()
|
||||
return { ok: false, error: `Server returned HTTP ${response.status}` }
|
||||
}
|
||||
|
||||
const models = modelListSchema.safeParse(await response.json().catch(() => undefined))
|
||||
if (!models.success || !models.data.data.some(({ id }) => id === 'embeddinggemma-2')) {
|
||||
return { ok: false, error: 'Server does not advertise the embeddinggemma-2 model' }
|
||||
}
|
||||
return { ok: true }
|
||||
} catch {
|
||||
return { ok: false, error: 'Could not reach the embedding server' }
|
||||
}
|
||||
}
|
||||
|
||||
private validateUrl(url: string) {
|
||||
const result = updateEmbeddingServerSettingsRequestSchema.safeParse({ url })
|
||||
if (!result.success) {
|
||||
throw new HTTPException(400, { message: result.error.issues[0]?.message })
|
||||
}
|
||||
return result.data
|
||||
}
|
||||
}
|
||||
|
||||
export const embeddingServerService = new EmbeddingServerService()
|
||||
@@ -1,6 +0,0 @@
|
||||
export function getGemmaEmbeddingEndpoint(): string {
|
||||
const baseUrl = process.env.GEMMA_EMBEDDING_OPENAI_BASE_URL || 'http://localhost:9379/v1'
|
||||
const url = baseUrl.replace(/\/+$/, '')
|
||||
if (url.endsWith('/embeddings')) return url
|
||||
return url.endsWith('/v1') ? `${url}/embeddings` : `${url}/v1/embeddings`
|
||||
}
|
||||
@@ -4,19 +4,26 @@ import { LruTtlCache } from '@shumai/core/src/cache/lru-ttl-cache'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import sharp from 'sharp'
|
||||
import { getGemmaEmbeddingEndpoint } from './gemma-embedding-endpoint'
|
||||
import { embeddingServerService, LOCAL_EMBEDDING_PROVIDER } from './embedding-server'
|
||||
|
||||
export function getImageEmbeddingDimensions(): 768 | 1536 {
|
||||
return process.env.EMBEDDING_PROVIDER === 'gemma-embedding-2-openai' ? 768 : 1536
|
||||
export function getImageEmbeddingDimensions(provider: string): 768 | 1536 {
|
||||
return provider === LOCAL_EMBEDDING_PROVIDER ? 768 : 1536
|
||||
}
|
||||
|
||||
export class ImageEmbeddingService {
|
||||
private readonly cache = new LruTtlCache<string, number[]>(100)
|
||||
|
||||
async generateEmbedding(image: string, teamId: string): Promise<number[]> {
|
||||
const dimensions = getImageEmbeddingDimensions()
|
||||
const { provider, embeddingEndpoint } =
|
||||
await embeddingServerService.resolveRuntimeConfig(teamId)
|
||||
const dimensions = getImageEmbeddingDimensions(provider)
|
||||
const digest = createHash('sha256').update(image).digest('hex')
|
||||
const cacheKey = `${teamId}:${dimensions}:${digest}`
|
||||
const cacheKey = JSON.stringify([
|
||||
teamId,
|
||||
dimensions,
|
||||
dimensions === 768 ? embeddingEndpoint : null,
|
||||
digest,
|
||||
])
|
||||
const cached = this.cache.get(cacheKey)
|
||||
if (cached) return cached
|
||||
|
||||
@@ -37,7 +44,7 @@ export class ImageEmbeddingService {
|
||||
const signal = AbortSignal.timeout(15000)
|
||||
embedding =
|
||||
dimensions === 768
|
||||
? await this.embedWithGemma(image, signal)
|
||||
? await this.embedWithGemma(embeddingEndpoint, image, signal)
|
||||
: await this.embedWithGemini(image, signal)
|
||||
if (
|
||||
!embedding ||
|
||||
@@ -73,8 +80,8 @@ export class ImageEmbeddingService {
|
||||
return response.embeddings?.[0]?.values
|
||||
}
|
||||
|
||||
private async embedWithGemma(image: string, signal: AbortSignal) {
|
||||
const response = await fetch(getGemmaEmbeddingEndpoint(), {
|
||||
private async embedWithGemma(endpoint: string, image: string, signal: AbortSignal) {
|
||||
const response = await fetch(endpoint, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
|
||||
@@ -9,6 +9,7 @@ import { PaginatedData, decodeCursor, encodeCursor, PageInfo } from '@shumai/cor
|
||||
import { generateSearchNgrams } from '@shumai/core/src/utils/ngram'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { getImageEmbeddingDimensions, imageEmbeddingService } from './image-embedding'
|
||||
import { embeddingServerService } from './embedding-server'
|
||||
import { SqlQueryBuilder } from './sql-query-builder'
|
||||
import { TextEmbeddingService, textEmbeddingService } from './text-embedding'
|
||||
|
||||
@@ -266,7 +267,7 @@ export class SearchService {
|
||||
if (!project) throw new HTTPException(404, { message: 'Project folder not found.' })
|
||||
|
||||
await this.requireEmbeddingAgent(project.teamId)
|
||||
const dimensions = getImageEmbeddingDimensions()
|
||||
let dimensions: 768 | 1536
|
||||
let vector: string
|
||||
let excludeAssetId: string | undefined
|
||||
if (req.sourceAssetId) {
|
||||
@@ -274,6 +275,8 @@ export class SearchService {
|
||||
throw new HTTPException(400, { message: 'Find similar requires the project root folder.' })
|
||||
}
|
||||
|
||||
const { provider } = await embeddingServerService.resolveRuntimeConfig(project.teamId)
|
||||
dimensions = getImageEmbeddingDimensions(provider)
|
||||
const column = dimensions === 768 ? Prisma.sql`embedding_768` : Prisma.sql`embedding`
|
||||
const [source] = await this.prismaClient.$queryRaw<
|
||||
{ vector: string | null; excludeAssetId: string }[]
|
||||
@@ -302,9 +305,9 @@ export class SearchService {
|
||||
vector = source.vector
|
||||
excludeAssetId = source.excludeAssetId
|
||||
} else if (req.image) {
|
||||
vector = JSON.stringify(
|
||||
await imageEmbeddingService.generateEmbedding(req.image, project.teamId),
|
||||
)
|
||||
const embedding = await imageEmbeddingService.generateEmbedding(req.image, project.teamId)
|
||||
dimensions = embedding.length === 768 ? 768 : 1536
|
||||
vector = JSON.stringify(embedding)
|
||||
} else {
|
||||
throw new HTTPException(400, { message: 'Provide a search image or source asset.' })
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GoogleGenAI } from '@google/genai'
|
||||
import { LruTtlCache } from '@shumai/core/src/cache/lru-ttl-cache'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { getGemmaEmbeddingEndpoint } from './gemma-embedding-endpoint'
|
||||
import { embeddingServerService, LOCAL_EMBEDDING_PROVIDER } from './embedding-server'
|
||||
|
||||
export interface TextEmbeddingUsage {
|
||||
model: string
|
||||
@@ -46,12 +46,19 @@ export class TextEmbeddingService {
|
||||
throw new Error('Text to embed must not be empty')
|
||||
}
|
||||
|
||||
const provider = options?.provider || process.env.EMBEDDING_PROVIDER || 'gemini-embedding-2'
|
||||
const model =
|
||||
options?.model ||
|
||||
(provider === 'gemma-embedding-2-openai' ? 'embeddinggemma-2' : 'gemini-embedding-2')
|
||||
const { provider, embeddingEndpoint } = await embeddingServerService.resolveRuntimeConfig(
|
||||
options?.teamId,
|
||||
options?.provider,
|
||||
)
|
||||
const isLocal = provider === LOCAL_EMBEDDING_PROVIDER
|
||||
const model = options?.model || (isLocal ? 'embeddinggemma-2' : 'gemini-embedding-2')
|
||||
|
||||
const cacheKey = `${provider}:${model}:${trimmedText}`
|
||||
const cacheKey = JSON.stringify([
|
||||
provider,
|
||||
isLocal ? embeddingEndpoint : null,
|
||||
model,
|
||||
trimmedText,
|
||||
])
|
||||
if (!options?.skipCache) {
|
||||
const cachedVector = this.cache.get(cacheKey)
|
||||
if (cachedVector) {
|
||||
@@ -67,8 +74,8 @@ export class TextEmbeddingService {
|
||||
const signal = options?.signal ?? AbortSignal.timeout(15000)
|
||||
|
||||
let result: TextEmbeddingResult
|
||||
if (provider === 'gemma-embedding-2-openai') {
|
||||
result = await this.callGemmaEmbeddingServer(trimmedText, model, signal)
|
||||
if (isLocal) {
|
||||
result = await this.callGemmaEmbeddingServer(embeddingEndpoint, trimmedText, model, signal)
|
||||
} else {
|
||||
result = await this.callGeminiEmbedding(trimmedText, model, signal)
|
||||
}
|
||||
@@ -140,11 +147,12 @@ export class TextEmbeddingService {
|
||||
}
|
||||
|
||||
private async callGemmaEmbeddingServer(
|
||||
endpoint: string,
|
||||
text: string,
|
||||
model: string,
|
||||
signal: AbortSignal,
|
||||
): Promise<TextEmbeddingResult> {
|
||||
const response = await fetch(getGemmaEmbeddingEndpoint(), {
|
||||
const response = await fetch(endpoint, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as path from 'path'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { teamService } from '@shumai/core/src/team/team'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import type { TeamSettingsResponse } from '@shumai/dtos'
|
||||
|
||||
describe('TeamService', () => {
|
||||
@@ -357,6 +357,48 @@ describe('TeamService', () => {
|
||||
expect(pm1View.find((m) => m.id === projectMember2.id)?.scope).toBe('project')
|
||||
})
|
||||
|
||||
it('reports whether the effective embedding provider supports the Transcript Agent', async () => {
|
||||
const team = await prisma.team.create({
|
||||
data: {
|
||||
name: 'Embedding settings',
|
||||
settings: { embeddingServer: { url: 'http://embedding:9379/v1' } },
|
||||
},
|
||||
})
|
||||
vi.stubEnv('GEMMA_EMBEDDING_OPENAI_BASE_URL', undefined)
|
||||
vi.stubEnv('EMBEDDING_PROVIDER', undefined)
|
||||
try {
|
||||
await expect(teamService.getSettings(team.id)).resolves.toMatchObject({
|
||||
localEmbeddingProviderConfigured: true,
|
||||
transcriptionAgentManagedByEnv: false,
|
||||
})
|
||||
|
||||
vi.stubEnv('EMBEDDING_PROVIDER', 'gemini-embedding-2')
|
||||
await expect(teamService.getSettings(team.id)).resolves.toMatchObject({
|
||||
localEmbeddingProviderConfigured: false,
|
||||
})
|
||||
} finally {
|
||||
vi.unstubAllEnvs()
|
||||
}
|
||||
})
|
||||
|
||||
it('requires an explicit embedding server URL to configure the Transcript Agent', async () => {
|
||||
const team = await prisma.team.create({ data: { name: 'Embedding setup' } })
|
||||
vi.stubEnv('EMBEDDING_PROVIDER', 'gemma-embedding-2-openai')
|
||||
vi.stubEnv('GEMMA_EMBEDDING_OPENAI_BASE_URL', undefined)
|
||||
try {
|
||||
await expect(teamService.getSettings(team.id)).resolves.toMatchObject({
|
||||
localEmbeddingProviderConfigured: false,
|
||||
})
|
||||
|
||||
vi.stubEnv('GEMMA_EMBEDDING_OPENAI_BASE_URL', 'http://embedding:9379/v1')
|
||||
await expect(teamService.getSettings(team.id)).resolves.toMatchObject({
|
||||
localEmbeddingProviderConfigured: true,
|
||||
})
|
||||
} finally {
|
||||
vi.unstubAllEnvs()
|
||||
}
|
||||
})
|
||||
|
||||
it('should get and update settings', async () => {
|
||||
const user = await prisma.user.create({
|
||||
data: { name: 'Test User', email: `test-${Date.now()}@example.com`, password: 'pw' },
|
||||
@@ -368,6 +410,9 @@ describe('TeamService', () => {
|
||||
const settings = await teamService.getSettings(team.id)
|
||||
expect(settings).toEqual({
|
||||
semanticSearchEnabled: false,
|
||||
localEmbeddingProviderConfigured: false,
|
||||
transcriptionAgentManagedByEnv: false,
|
||||
embeddingServer: { url: undefined, isEnvConfigured: false },
|
||||
transcode: {
|
||||
videoStrategy: 'best_match',
|
||||
videoResolutions: ['480p', '720p', '1080p', '1440p', '2160p'],
|
||||
@@ -404,6 +449,9 @@ describe('TeamService', () => {
|
||||
expect(newSettings).toEqual({
|
||||
theme: 'dark',
|
||||
semanticSearchEnabled: false,
|
||||
localEmbeddingProviderConfigured: false,
|
||||
transcriptionAgentManagedByEnv: false,
|
||||
embeddingServer: { url: undefined, isEnvConfigured: false },
|
||||
transcode: {
|
||||
videoStrategy: 'best_match',
|
||||
videoResolutions: ['480p', '720p', '1080p', '1440p', '2160p'],
|
||||
@@ -449,6 +497,9 @@ describe('TeamService', () => {
|
||||
const finalSettings = await teamService.getSettings(team.id)
|
||||
expect(finalSettings).toEqual({
|
||||
theme: 'dark',
|
||||
localEmbeddingProviderConfigured: false,
|
||||
transcriptionAgentManagedByEnv: false,
|
||||
embeddingServer: { url: undefined, isEnvConfigured: false },
|
||||
transcode: {
|
||||
videoStrategy: 'multi',
|
||||
videoResolutions: ['720p', '1080p'],
|
||||
|
||||
@@ -7,8 +7,14 @@ import { getAvatarUrl } from '@shumai/core/src/user/avatar'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { getAllowedAgentRoles } from '@shumai/core/src/agent/permissions'
|
||||
import { AgentService, agentService } from '@shumai/core/src/agent/agent'
|
||||
import { getSystemAgentSetting } from '@shumai/core/src/agent/system-agents'
|
||||
import { turntableService } from '@shumai/core/src/turntable/turntable'
|
||||
import { gotenbergService } from '@shumai/core/src/gotenberg/gotenberg'
|
||||
import {
|
||||
embeddingServerService,
|
||||
LOCAL_EMBEDDING_PROVIDER,
|
||||
resolveEmbeddingProvider,
|
||||
} from '@shumai/core/src/search/embedding-server'
|
||||
import {
|
||||
getArchiveStorageConfig,
|
||||
isArchiveStorageEnabled,
|
||||
@@ -50,7 +56,7 @@ export class TeamService {
|
||||
},
|
||||
})
|
||||
await providerService.initBuiltinProviders(team.id)
|
||||
await agentService.ensureEmbeddingAgentForTeam(team.id)
|
||||
await agentService.ensureSystemAgentsForTeam(team.id)
|
||||
}
|
||||
|
||||
return team
|
||||
@@ -94,8 +100,7 @@ export class TeamService {
|
||||
// but the TransactionClient is compatible with the methods we use.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
await new ProviderService(tx as any).initBuiltinProviders(team.id)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
await new AgentService(tx as any).ensureEmbeddingAgentForTeam(team.id)
|
||||
await new AgentService(tx).ensureSystemAgentsForTeam(team.id)
|
||||
|
||||
return this.toTeamInfo(updatedTeam)
|
||||
})
|
||||
@@ -359,6 +364,11 @@ export class TeamService {
|
||||
|
||||
settings.turntable = await turntableService.getSettings(teamId)
|
||||
settings.gotenberg = await gotenbergService.getSettings(teamId)
|
||||
settings.embeddingServer = await embeddingServerService.getSettings(teamId)
|
||||
settings.localEmbeddingProviderConfigured =
|
||||
Boolean(settings.embeddingServer.url) &&
|
||||
resolveEmbeddingProvider(settings.embeddingServer) === LOCAL_EMBEDDING_PROVIDER
|
||||
settings.transcriptionAgentManagedByEnv = getSystemAgentSetting('transcription') !== undefined
|
||||
|
||||
const archiveConfig = getArchiveStorageConfig()
|
||||
if (!archiveConfig.enabled) {
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
import {
|
||||
embeddingServerService,
|
||||
LOCAL_EMBEDDING_PROVIDER,
|
||||
} from '@shumai/core/src/search/embedding-server'
|
||||
import { transcriptLanguageCodeSchema, transcriptLanguagesSchema } from '@shumai/dtos'
|
||||
import { z } from 'zod'
|
||||
|
||||
export async function isLocalTranscriptionEnabled(teamId?: string): Promise<boolean> {
|
||||
const { provider } = await embeddingServerService.resolveRuntimeConfig(teamId)
|
||||
return provider === LOCAL_EMBEDDING_PROVIDER
|
||||
}
|
||||
|
||||
export async function listLocalTranscriptionLanguages(teamId?: string) {
|
||||
const { transcriptionEndpoint } = await embeddingServerService.resolveRuntimeConfig(teamId)
|
||||
const response = await fetch(`${transcriptionEndpoint}/languages`, {
|
||||
signal: AbortSignal.timeout(5_000),
|
||||
})
|
||||
if (!response.ok) throw new Error(`Transcription languages endpoint returned ${response.status}`)
|
||||
return transcriptLanguagesSchema.parse(await response.json())
|
||||
}
|
||||
|
||||
const transcriptResponseSchema = z
|
||||
.object({
|
||||
language: transcriptLanguageCodeSchema.nullable(),
|
||||
segments: z.array(
|
||||
z
|
||||
.object({ start: z.number().min(0), end: z.number().min(0), text: z.string().min(1) })
|
||||
.refine((segment) => segment.end >= segment.start && segment.end < 2_147_483),
|
||||
),
|
||||
})
|
||||
.refine((result) => result.language !== null || result.segments.length === 0)
|
||||
|
||||
export class LocalTranscriptionError extends Error {
|
||||
constructor(readonly status: number) {
|
||||
super(`Transcription server returned HTTP ${status}`)
|
||||
}
|
||||
}
|
||||
|
||||
export async function transcribeLocalAudio({
|
||||
teamId,
|
||||
audio,
|
||||
language,
|
||||
model,
|
||||
signal,
|
||||
}: {
|
||||
teamId?: string
|
||||
audio: Blob
|
||||
language: string | null
|
||||
model: string
|
||||
signal?: AbortSignal
|
||||
}) {
|
||||
const form = new FormData()
|
||||
form.set('file', audio, 'audio.wav')
|
||||
form.set('model', model)
|
||||
form.set('response_format', 'verbose_json')
|
||||
if (language) form.set('language', language)
|
||||
|
||||
const timeout = AbortSignal.timeout(90 * 60 * 1000)
|
||||
const { transcriptionEndpoint } = await embeddingServerService.resolveRuntimeConfig(teamId)
|
||||
const response = await fetch(transcriptionEndpoint, {
|
||||
method: 'POST',
|
||||
body: form,
|
||||
redirect: 'error',
|
||||
timeout: false,
|
||||
signal: signal ? AbortSignal.any([signal, timeout]) : timeout,
|
||||
})
|
||||
if (!response.ok) {
|
||||
await response.body?.cancel()
|
||||
throw new LocalTranscriptionError(response.status)
|
||||
}
|
||||
return transcriptResponseSchema.parse(await response.json())
|
||||
}
|
||||
@@ -0,0 +1,430 @@
|
||||
import { prisma, UserType, WorkflowTaskStatus, WorkflowTaskType } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { transcriptionErrors } from '@shumai/dtos'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { transcriptService } from './transcript'
|
||||
|
||||
describe('TranscriptService', () => {
|
||||
setupTestDbHooks()
|
||||
let assetId: string
|
||||
let projectId: string
|
||||
let agentId: string
|
||||
const model = 'whisper-tiny'
|
||||
const segments = [{ startMs: 125, endMs: 1425, text: 'Original segment' }]
|
||||
const media: PrismaJson.MediaInfo = {
|
||||
proxyType: 'video',
|
||||
duration: 2,
|
||||
filesize: 0,
|
||||
frames: 50,
|
||||
imageTranscodes: [],
|
||||
videoTranscodes: [{ key: 'files/transcript-video-480p.mp4', width: 854, height: 480 }],
|
||||
finishedAt: '2026-01-01T00:00:00Z',
|
||||
metadata: null,
|
||||
original: null,
|
||||
}
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.stubEnv('EMBEDDING_PROVIDER', 'gemma-embedding-2-openai')
|
||||
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', undefined)
|
||||
const team = await prisma.team.create({ data: { name: 'Transcript test' } })
|
||||
const agent = await prisma.agent.create({
|
||||
data: {
|
||||
type: 'transcription',
|
||||
team: { connect: { id: team.id } },
|
||||
config: { provider: '', model: '' },
|
||||
user: {
|
||||
create: {
|
||||
name: 'Transcript Agent',
|
||||
email: 'transcript-agent@example.test',
|
||||
type: UserType.agent,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
agentId = agent.id
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'Transcript test', teamId: team.id },
|
||||
})
|
||||
projectId = project.id
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Video',
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
mediaType: 'video/mp4',
|
||||
media,
|
||||
project: { connect: { id: projectId } },
|
||||
storageKey: { create: { key: 'files/transcript-video.mp4' } },
|
||||
},
|
||||
})
|
||||
assetId = asset.id
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async () =>
|
||||
Response.json({
|
||||
model,
|
||||
languages: [
|
||||
{ code: 'en', name: 'English' },
|
||||
{ code: 'zh', name: 'Chinese' },
|
||||
],
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
vi.unstubAllEnvs()
|
||||
})
|
||||
|
||||
async function generateAndStart(language: string | null) {
|
||||
const result = await transcriptService.generate(assetId, language)
|
||||
if (result.kind !== 'queued') throw new Error(`Unexpected generation result ${result.kind}`)
|
||||
await prisma.workflowTask.update({
|
||||
where: { id: result.taskId },
|
||||
data: { status: 'processing' },
|
||||
})
|
||||
return result.taskId
|
||||
}
|
||||
|
||||
it('lists only the asset’s saved languages and reads every segment in position order', async () => {
|
||||
const otherAsset = await prisma.asset.create({
|
||||
data: { name: 'Another video', type: 'file', status: 'processed', projectId },
|
||||
})
|
||||
const save = (id: string, language: string) =>
|
||||
prisma.assetTranscript.create({
|
||||
data: {
|
||||
assetId: id,
|
||||
language,
|
||||
model,
|
||||
workflowTaskId: 'test-task',
|
||||
segments: {
|
||||
create: [
|
||||
{ position: 1, startMs: 2000, endMs: 3000, text: 'Second' },
|
||||
{ position: 0, startMs: 125, endMs: 1425, text: 'First' },
|
||||
],
|
||||
},
|
||||
},
|
||||
include: { segments: true },
|
||||
})
|
||||
|
||||
await expect(transcriptService.listSavedLanguages(assetId)).resolves.toEqual({ languages: [] })
|
||||
const english = await save(assetId, 'en')
|
||||
await save(assetId, 'zh')
|
||||
await save(otherAsset.id, 'ko')
|
||||
vi.stubEnv('EMBEDDING_PROVIDER', 'gemini-embedding-2')
|
||||
|
||||
const savedLanguages = await transcriptService.listSavedLanguages(assetId)
|
||||
expect(savedLanguages.languages.sort()).toEqual(['en', 'zh'])
|
||||
const transcript = await transcriptService.getSavedTranscript(assetId, 'en')
|
||||
expect(transcript).toEqual({
|
||||
id: english.id,
|
||||
language: 'en',
|
||||
segments: [
|
||||
{
|
||||
id: english.segments.find(({ position }) => position === 0)?.id,
|
||||
startMs: 125,
|
||||
endMs: 1425,
|
||||
text: 'First',
|
||||
},
|
||||
{
|
||||
id: english.segments.find(({ position }) => position === 1)?.id,
|
||||
startMs: 2000,
|
||||
endMs: 3000,
|
||||
text: 'Second',
|
||||
},
|
||||
],
|
||||
})
|
||||
await expect(transcriptService.getSavedTranscript(assetId, 'ko')).rejects.toMatchObject({
|
||||
status: 404,
|
||||
})
|
||||
await prisma.asset.update({ where: { id: assetId }, data: { isDeleted: true } })
|
||||
await expect(transcriptService.listSavedLanguages(assetId)).resolves.toEqual({ languages: [] })
|
||||
await expect(transcriptService.getSavedTranscript(assetId, 'en')).rejects.toMatchObject({
|
||||
status: 404,
|
||||
})
|
||||
expect(fetch).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('validates provider capability, language and asset eligibility before queuing', async () => {
|
||||
await expect(transcriptService.listLanguages()).resolves.toMatchObject({ model })
|
||||
await expect(transcriptService.generate(assetId, 'xx')).rejects.toMatchObject({ status: 400 })
|
||||
await prisma.asset.update({ where: { id: assetId }, data: { mediaType: 'image/png' } })
|
||||
await expect(transcriptService.generate(assetId, 'en')).rejects.toMatchObject({ status: 400 })
|
||||
|
||||
vi.stubEnv('EMBEDDING_PROVIDER', 'gemini-embedding-2')
|
||||
await expect(transcriptService.listLanguages()).rejects.toMatchObject({ status: 503 })
|
||||
await expect(transcriptService.generate(assetId, null)).rejects.toMatchObject({ status: 503 })
|
||||
expect(await prisma.workflowTask.count({ where: { assetId } })).toBe(0)
|
||||
})
|
||||
|
||||
it('requires an enabled Transcript Agent before contacting the provider or queuing', async () => {
|
||||
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', 'false')
|
||||
await expect(transcriptService.isGenerationEnabled()).resolves.toBe(false)
|
||||
vi.stubEnv('ENABLE_TRANSCRIPTION_AGENT', undefined)
|
||||
await prisma.agent.update({ where: { id: agentId }, data: { enabled: false } })
|
||||
await expect(transcriptService.generate(assetId, null)).rejects.toMatchObject({ status: 503 })
|
||||
await prisma.agent.delete({ where: { id: agentId } })
|
||||
await expect(transcriptService.listLanguages()).rejects.toMatchObject({ status: 503 })
|
||||
expect(fetch).not.toHaveBeenCalled()
|
||||
expect(await prisma.workflowTask.count({ where: { assetId } })).toBe(0)
|
||||
})
|
||||
|
||||
it('serializes requests for an asset and uses its project and workflow type', async () => {
|
||||
const results = await Promise.all([
|
||||
transcriptService.generate(assetId, 'en'),
|
||||
transcriptService.generate(assetId, 'zh'),
|
||||
])
|
||||
|
||||
expect(results.map((result) => result.kind).sort()).toEqual(['busy', 'queued'])
|
||||
const tasks = await prisma.workflowTask.findMany({ where: { assetId } })
|
||||
expect(tasks).toHaveLength(1)
|
||||
expect(tasks[0]).toMatchObject({
|
||||
projectId,
|
||||
type: WorkflowTaskType.ai_transcription,
|
||||
status: 'pending',
|
||||
})
|
||||
expect(await transcriptService.getStatus(assetId)).toEqual({
|
||||
taskId: tasks[0].id,
|
||||
status: 'pending',
|
||||
})
|
||||
})
|
||||
|
||||
it('requires completed transcoding and a full proxy before queuing', async () => {
|
||||
await prisma.asset.update({ where: { id: assetId }, data: { status: 'processing' } })
|
||||
await expect(transcriptService.generate(assetId, null)).rejects.toMatchObject({ status: 400 })
|
||||
|
||||
const preview = { key: 'files/transcript-video-180p.mp4', width: 320, height: 180 }
|
||||
await prisma.asset.update({
|
||||
where: { id: assetId },
|
||||
data: {
|
||||
status: 'processed',
|
||||
media: { ...media, videoTranscodes: [], videoPreview: preview },
|
||||
},
|
||||
})
|
||||
await expect(transcriptService.generate(assetId, null)).rejects.toMatchObject({
|
||||
status: 400,
|
||||
message: transcriptionErrors.noProxy,
|
||||
})
|
||||
expect(await prisma.workflowTask.count({ where: { assetId } })).toBe(0)
|
||||
})
|
||||
|
||||
it.each(['archiving', 'archived', 'restoring'] as const)(
|
||||
'queues generation from a full proxy while the video is %s',
|
||||
async (status) => {
|
||||
await prisma.asset.update({ where: { id: assetId }, data: { status } })
|
||||
await expect(transcriptService.generate(assetId, 'en')).resolves.toMatchObject({
|
||||
kind: 'queued',
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
it('lists each live project file with a pending or running transcription once', async () => {
|
||||
const project = await prisma.project.findUniqueOrThrow({ where: { id: projectId } })
|
||||
const otherProject = await prisma.project.create({
|
||||
data: { name: 'Another project', teamId: project.teamId },
|
||||
})
|
||||
const [running, finished, deleted, external, transcoding] = await Promise.all(
|
||||
[
|
||||
{ projectId, name: 'Running video' },
|
||||
{ projectId, name: 'Finished video' },
|
||||
{ projectId, name: 'Deleted video', isDeleted: true },
|
||||
{ projectId: otherProject.id, name: 'External video' },
|
||||
{ projectId, name: 'Transcoding video' },
|
||||
].map((file) =>
|
||||
prisma.asset.create({ data: { ...file, type: 'file', status: 'processed' } }),
|
||||
),
|
||||
)
|
||||
await expect(transcriptService.listActiveAssetIds(projectId)).resolves.toEqual([])
|
||||
|
||||
await prisma.workflowTask.createMany({
|
||||
data: [
|
||||
{ assetId, status: WorkflowTaskStatus.pending },
|
||||
{ assetId, status: WorkflowTaskStatus.processing },
|
||||
{ assetId, status: WorkflowTaskStatus.failed },
|
||||
{ assetId: running.id, status: WorkflowTaskStatus.processing },
|
||||
{ assetId: finished.id, status: WorkflowTaskStatus.completed },
|
||||
{ assetId: finished.id, status: WorkflowTaskStatus.failed },
|
||||
{ assetId: deleted.id, status: WorkflowTaskStatus.pending },
|
||||
{ assetId: external.id, status: WorkflowTaskStatus.processing },
|
||||
{
|
||||
assetId: transcoding.id,
|
||||
status: WorkflowTaskStatus.pending,
|
||||
type: WorkflowTaskType.transcode_video,
|
||||
},
|
||||
].map((job) => ({ type: WorkflowTaskType.ai_transcription, ...job })),
|
||||
})
|
||||
await expect(transcriptService.listActiveAssetIds(projectId)).resolves.toEqual(
|
||||
[assetId, running.id].sort().reverse(),
|
||||
)
|
||||
await expect(transcriptService.listActiveAssetIds(otherProject.id)).resolves.toEqual([
|
||||
external.id,
|
||||
])
|
||||
})
|
||||
|
||||
it('rejects an archived video without a full proxy', async () => {
|
||||
await prisma.asset.update({
|
||||
where: { id: assetId },
|
||||
data: { status: 'archived', media: { ...media, videoTranscodes: [] } },
|
||||
})
|
||||
await expect(transcriptService.generate(assetId, 'en')).rejects.toMatchObject({
|
||||
status: 400,
|
||||
message: transcriptionErrors.noProxy,
|
||||
})
|
||||
expect(await prisma.workflowTask.count({ where: { assetId } })).toBe(0)
|
||||
})
|
||||
|
||||
it.each(['archiving', 'archived', 'restoring'] as const)(
|
||||
'saves a transcript when the video has become %s while the job runs',
|
||||
async (status) => {
|
||||
const taskId = await generateAndStart('en')
|
||||
await prisma.asset.update({ where: { id: assetId }, data: { status } })
|
||||
await expect(
|
||||
transcriptService.saveResult({ taskId, assetId, model, language: 'en', segments }),
|
||||
).resolves.toBe(true)
|
||||
await expect(transcriptService.getSavedTranscript(assetId, 'en')).resolves.toMatchObject({
|
||||
segments,
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
it('rejects an audio-only proxy even when the file was uploaded with a video MIME type', async () => {
|
||||
await prisma.asset.update({
|
||||
where: { id: assetId },
|
||||
data: {
|
||||
media: {
|
||||
...media,
|
||||
proxyType: 'audio',
|
||||
videoTranscodes: [{ key: 'files/transcript-video-audio-proxy.mp4', width: 0, height: 0 }],
|
||||
},
|
||||
},
|
||||
})
|
||||
await expect(transcriptService.generate(assetId, null)).rejects.toMatchObject({
|
||||
status: 400,
|
||||
message: transcriptionErrors.noProxy,
|
||||
})
|
||||
expect(await prisma.workflowTask.count({ where: { assetId } })).toBe(0)
|
||||
})
|
||||
|
||||
it('persists languages independently and preserves saved text on replay and requests for an existing language', async () => {
|
||||
const enTaskId = await generateAndStart('en')
|
||||
const first = { taskId: enTaskId, assetId, model, language: 'en', segments }
|
||||
await transcriptService.saveResult(first)
|
||||
const en = await prisma.assetTranscript.findUniqueOrThrow({
|
||||
where: { assetIdLanguage: { assetId, language: 'en' } },
|
||||
})
|
||||
const segment = await prisma.assetTranscriptSegment.findUniqueOrThrow({
|
||||
where: { transcriptIdPosition: { transcriptId: en.id, position: 0 } },
|
||||
})
|
||||
await expect(
|
||||
transcriptService.updateSegmentText(assetId, 'en', segment.id, 'Edited'),
|
||||
).resolves.toEqual({
|
||||
id: segment.id,
|
||||
startMs: 125,
|
||||
endMs: 1425,
|
||||
text: 'Edited',
|
||||
})
|
||||
await transcriptService.saveResult(first)
|
||||
expect(await transcriptService.generate(assetId, 'en')).toEqual({
|
||||
kind: 'existing',
|
||||
transcriptId: en.id,
|
||||
language: 'en',
|
||||
})
|
||||
|
||||
const autoTaskId = await generateAndStart(null)
|
||||
await transcriptService.saveResult({ ...first, taskId: autoTaskId })
|
||||
expect(await transcriptService.generate(assetId, null)).toEqual({
|
||||
kind: 'existing',
|
||||
transcriptId: en.id,
|
||||
language: 'en',
|
||||
})
|
||||
expect(
|
||||
await prisma.assetTranscriptSegment.findMany({ where: { transcriptId: en.id } }),
|
||||
).toMatchObject([
|
||||
{
|
||||
position: 0,
|
||||
startMs: 125,
|
||||
endMs: 1425,
|
||||
text: 'Edited',
|
||||
},
|
||||
])
|
||||
|
||||
const zhTaskId = await generateAndStart('zh')
|
||||
await transcriptService.saveResult({ ...first, taskId: zhTaskId, language: 'zh' })
|
||||
expect(await prisma.assetTranscript.count({ where: { assetId } })).toBe(2)
|
||||
expect(await prisma.workflowTask.count({ where: { assetId } })).toBe(3)
|
||||
expect(await transcriptService.getStatus(assetId)).toEqual({
|
||||
taskId: zhTaskId,
|
||||
status: 'completed',
|
||||
})
|
||||
|
||||
await prisma.asset.delete({ where: { id: assetId } })
|
||||
expect(await prisma.assetTranscript.count({ where: { assetId } })).toBe(0)
|
||||
expect(await prisma.assetTranscriptSegment.count({ where: { transcriptId: en.id } })).toBe(0)
|
||||
})
|
||||
|
||||
it('saves empty segment text with generation disabled and scopes writes to the asset and language', async () => {
|
||||
const taskId = await generateAndStart('en')
|
||||
await transcriptService.saveResult({ taskId, assetId, model, language: 'en', segments })
|
||||
const otherAsset = await prisma.asset.create({
|
||||
data: { name: 'Another video', type: 'file', status: 'processed', projectId },
|
||||
})
|
||||
const [segment] = (await transcriptService.getSavedTranscript(assetId, 'en')).segments
|
||||
vi.stubEnv('EMBEDDING_PROVIDER', 'gemini-embedding-2')
|
||||
|
||||
for (const [fileId, language, segmentId] of [
|
||||
[otherAsset.id, 'en', segment.id],
|
||||
[assetId, 'zh', segment.id],
|
||||
[assetId, 'en', 'missing-segment'],
|
||||
]) {
|
||||
await expect(
|
||||
transcriptService.updateSegmentText(fileId, language, segmentId, 'Unexpected edit'),
|
||||
).rejects.toMatchObject({ status: 404 })
|
||||
}
|
||||
expect(
|
||||
await prisma.assetTranscriptSegment.findUnique({ where: { id: segment.id } }),
|
||||
).toMatchObject(segment)
|
||||
|
||||
const cleared = { ...segment, text: '' }
|
||||
await expect(
|
||||
transcriptService.updateSegmentText(assetId, 'en', segment.id, ''),
|
||||
).resolves.toEqual(cleared)
|
||||
expect((await transcriptService.getSavedTranscript(assetId, 'en')).segments).toEqual([cleared])
|
||||
|
||||
await prisma.asset.update({ where: { id: assetId }, data: { isDeleted: true } })
|
||||
await expect(
|
||||
transcriptService.updateSegmentText(assetId, 'en', segment.id, 'Restored'),
|
||||
).rejects.toMatchObject({
|
||||
status: 404,
|
||||
})
|
||||
expect(
|
||||
await prisma.assetTranscriptSegment.findUnique({ where: { id: segment.id } }),
|
||||
).toMatchObject(cleared)
|
||||
})
|
||||
|
||||
it('completes silence without creating a row for an unknown language', async () => {
|
||||
const taskId = await generateAndStart(null)
|
||||
await transcriptService.saveResult({ taskId, assetId, model, language: null, segments: [] })
|
||||
expect(await transcriptService.getStatus(assetId)).toEqual({ taskId, status: 'no_speech' })
|
||||
expect(await transcriptService.generate(assetId, null)).toEqual({ kind: 'no_speech' })
|
||||
expect(await prisma.assetTranscript.count({ where: { assetId } })).toBe(0)
|
||||
})
|
||||
|
||||
it.each(['tooLarge', 'noProxy'] as const)(
|
||||
'preserves a failed job with reason %s',
|
||||
async (reason) => {
|
||||
const taskId = await generateAndStart(null)
|
||||
await prisma.workflowTask.update({
|
||||
where: { id: taskId },
|
||||
data: {
|
||||
status: 'failed',
|
||||
output: { error: transcriptionErrors[reason] },
|
||||
},
|
||||
})
|
||||
await transcriptService.saveResult({ taskId, assetId, model, language: 'en', segments })
|
||||
expect(await transcriptService.getStatus(assetId)).toEqual({
|
||||
taskId,
|
||||
status: 'failed',
|
||||
reason,
|
||||
})
|
||||
expect(await prisma.assetTranscript.count({ where: { assetId } })).toBe(0)
|
||||
},
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,322 @@
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { getSystemAgentSetting } from '@shumai/core/src/agent/system-agents'
|
||||
import {
|
||||
notifyWorkflowTaskCreated,
|
||||
prisma,
|
||||
Prisma,
|
||||
WorkflowTaskType,
|
||||
type WorkflowTask,
|
||||
} from '@shumai/db'
|
||||
import {
|
||||
selectTranscriptVideoProxyKey,
|
||||
transcriptionErrors,
|
||||
transcriptVideoStatuses,
|
||||
type GenerateTranscriptResult,
|
||||
type SavedTranscript,
|
||||
type SavedTranscriptLanguages,
|
||||
type TranscriptJobStatus,
|
||||
type TranscriptSegment,
|
||||
} from '@shumai/dtos'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { isLocalTranscriptionEnabled, listLocalTranscriptionLanguages } from './local-transcription'
|
||||
|
||||
const type = WorkflowTaskType.ai_transcription
|
||||
|
||||
const transcriptSelection = { id: true, language: true } as const
|
||||
const segmentSelection = { id: true, startMs: true, endMs: true, text: true } as const
|
||||
|
||||
type Segment = { startMs: number; endMs: number; text: string }
|
||||
|
||||
export class TranscriptService {
|
||||
async findEnabledAgent(teamId?: string): Promise<{ id: string } | null> {
|
||||
if (getSystemAgentSetting('transcription')?.enabled === false) return null
|
||||
|
||||
return prisma.agent.findFirst({
|
||||
where: { teamId, type: 'transcription', enabled: true },
|
||||
orderBy: { id: 'desc' },
|
||||
select: { id: true },
|
||||
})
|
||||
}
|
||||
|
||||
async isGenerationEnabled(teamId?: string): Promise<boolean> {
|
||||
return Boolean(
|
||||
(await this.findEnabledAgent(teamId)) && (await isLocalTranscriptionEnabled(teamId)),
|
||||
)
|
||||
}
|
||||
|
||||
async listLanguages() {
|
||||
await this.requireEnabled()
|
||||
return this.loadLanguages()
|
||||
}
|
||||
|
||||
private async loadLanguages(teamId?: string) {
|
||||
try {
|
||||
return await listLocalTranscriptionLanguages(teamId)
|
||||
} catch (error) {
|
||||
logger.warn({ err: error }, 'Failed to load local transcription languages')
|
||||
throw new HTTPException(503, { message: 'Transcription languages are unavailable' })
|
||||
}
|
||||
}
|
||||
|
||||
async listSavedLanguages(assetId: string): Promise<SavedTranscriptLanguages> {
|
||||
const transcripts = await prisma.assetTranscript.findMany({
|
||||
where: { assetId, asset: { isDeleted: false } },
|
||||
orderBy: { id: 'desc' },
|
||||
select: { language: true },
|
||||
})
|
||||
return { languages: transcripts.map(({ language }) => language) }
|
||||
}
|
||||
|
||||
async getSavedTranscript(assetId: string, language: string): Promise<SavedTranscript> {
|
||||
const transcript = await prisma.assetTranscript.findUnique({
|
||||
where: { assetIdLanguage: { assetId, language }, asset: { isDeleted: false } },
|
||||
select: {
|
||||
...transcriptSelection,
|
||||
segments: {
|
||||
orderBy: { position: 'asc' },
|
||||
select: segmentSelection,
|
||||
},
|
||||
},
|
||||
})
|
||||
if (!transcript) throw new HTTPException(404, { message: 'Transcript not found' })
|
||||
return transcript
|
||||
}
|
||||
|
||||
async updateSegmentText(
|
||||
assetId: string,
|
||||
language: string,
|
||||
segmentId: string,
|
||||
text: string,
|
||||
): Promise<TranscriptSegment> {
|
||||
const [segment] = await prisma.assetTranscriptSegment.updateManyAndReturn({
|
||||
where: { id: segmentId, transcript: { assetId, language, asset: { isDeleted: false } } },
|
||||
data: { text },
|
||||
select: segmentSelection,
|
||||
})
|
||||
if (!segment) throw new HTTPException(404, { message: 'Transcript segment not found' })
|
||||
return segment
|
||||
}
|
||||
|
||||
async generate(assetId: string, language: string | null): Promise<GenerateTranscriptResult> {
|
||||
const source = await prisma.asset.findUnique({
|
||||
where: { id: assetId },
|
||||
select: { project: { select: { teamId: true } } },
|
||||
})
|
||||
if (!source?.project) {
|
||||
throw new HTTPException(400, { message: 'Transcripts require a processed video file' })
|
||||
}
|
||||
const { teamId } = source.project
|
||||
await this.requireEnabled(teamId)
|
||||
const saved = await this.findSaved(prisma, assetId, language)
|
||||
if (saved) return saved
|
||||
|
||||
const { model, languages } = await this.loadLanguages(teamId)
|
||||
if (language && !languages.some((entry) => entry.code === language)) {
|
||||
throw new HTTPException(400, { message: 'Unsupported transcription language' })
|
||||
}
|
||||
|
||||
const { result, task } = await prisma.$transaction(
|
||||
async (tx): Promise<{ result: GenerateTranscriptResult; task?: WorkflowTask }> => {
|
||||
// Serialize submissions and result commits for a single video asset.
|
||||
await tx.$queryRaw`SELECT id FROM assets WHERE id = ${assetId} FOR UPDATE`
|
||||
const savedAfterLock = await this.findSaved(tx, assetId, language)
|
||||
if (savedAfterLock) return { result: savedAfterLock }
|
||||
|
||||
const asset = await tx.asset.findFirst({
|
||||
where: {
|
||||
id: assetId,
|
||||
type: 'file',
|
||||
status: { in: [...transcriptVideoStatuses] },
|
||||
isDeleted: false,
|
||||
mediaType: { startsWith: 'video/' },
|
||||
},
|
||||
select: { media: true, project: { select: { id: true, teamId: true } } },
|
||||
})
|
||||
if (!asset?.project) {
|
||||
throw new HTTPException(400, { message: 'Transcripts require a processed video file' })
|
||||
}
|
||||
if (!selectTranscriptVideoProxyKey(asset.media)) {
|
||||
throw new HTTPException(400, { message: transcriptionErrors.noProxy })
|
||||
}
|
||||
|
||||
const active = await tx.workflowTask.findFirst({
|
||||
where: { assetId, type, status: { in: ['pending', 'processing'] } },
|
||||
orderBy: { id: 'desc' },
|
||||
})
|
||||
if (active) return { result: { kind: 'busy', taskId: active.id }, task: active }
|
||||
|
||||
// Notify the worker after commit so it can observe the task row as soon as it starts.
|
||||
const [created] = await tx.workflowTask.createManyAndReturn({
|
||||
data: {
|
||||
assetId,
|
||||
teamId: asset.project.teamId,
|
||||
projectId: asset.project.id,
|
||||
type,
|
||||
status: 'pending',
|
||||
payload: { projectId: asset.project.id, transcription: { language, model } },
|
||||
},
|
||||
})
|
||||
return { result: { kind: 'queued', taskId: created.id }, task: created }
|
||||
},
|
||||
)
|
||||
|
||||
if (task?.status === 'pending') {
|
||||
try {
|
||||
await notifyWorkflowTaskCreated(task)
|
||||
} catch (error) {
|
||||
logger.error({ err: error, taskId: task.id }, 'Failed to queue transcript generation')
|
||||
await prisma.workflowTask.updateMany({
|
||||
where: { id: task.id, status: 'pending' },
|
||||
data: { status: 'failed', output: { error: 'Failed to queue transcript generation' } },
|
||||
})
|
||||
throw new HTTPException(503, { message: 'Could not queue transcript generation' })
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
async getStatus(assetId: string): Promise<TranscriptJobStatus | null> {
|
||||
const task = await prisma.workflowTask.findFirst({
|
||||
where: { assetId, type },
|
||||
orderBy: { id: 'desc' },
|
||||
select: { id: true, status: true, output: true },
|
||||
})
|
||||
if (!task?.status) return null
|
||||
if (task.status === 'failed') {
|
||||
const error = task.output?.error ?? ''
|
||||
const reason = error.includes(transcriptionErrors.tooLarge)
|
||||
? 'tooLarge'
|
||||
: error.includes(transcriptionErrors.noAudio)
|
||||
? 'noAudio'
|
||||
: error.includes(transcriptionErrors.noProxy)
|
||||
? 'noProxy'
|
||||
: 'unknown'
|
||||
return { status: 'failed', taskId: task.id, reason }
|
||||
}
|
||||
const transcript = task.output?.transcription
|
||||
return {
|
||||
taskId: task.id,
|
||||
status:
|
||||
task.status === 'completed' && transcript && 'noSpeech' in transcript
|
||||
? 'no_speech'
|
||||
: task.status,
|
||||
}
|
||||
}
|
||||
|
||||
async listActiveAssetIds(projectId: string): Promise<string[]> {
|
||||
const assets = await prisma.$queryRaw<{ assetId: string }[]>`
|
||||
SELECT DISTINCT task.asset_id AS "assetId"
|
||||
FROM workflow_tasks task
|
||||
JOIN assets asset ON asset.id = task.asset_id
|
||||
WHERE asset.project_id = ${projectId} AND NOT asset.is_deleted AND asset.type = 'file'
|
||||
AND task.type = ${type}::"WorkflowTaskType" AND task.status IN ('pending', 'processing')
|
||||
ORDER BY task.asset_id DESC
|
||||
`
|
||||
return assets.map(({ assetId }) => assetId)
|
||||
}
|
||||
|
||||
async saveResult(params: {
|
||||
taskId: string
|
||||
assetId: string
|
||||
model: string
|
||||
language: string | null
|
||||
segments: Segment[]
|
||||
}): Promise<boolean> {
|
||||
const { taskId, assetId, model, language, segments } = params
|
||||
return await prisma.$transaction(async (tx) => {
|
||||
const [asset] = await tx.$queryRaw<{ id: string }[]>`
|
||||
SELECT id FROM assets
|
||||
WHERE id = ${assetId} AND NOT is_deleted AND status::text IN (${Prisma.join(transcriptVideoStatuses)})
|
||||
FOR UPDATE
|
||||
`
|
||||
if (!asset) return false
|
||||
|
||||
const task = await tx.workflowTask.updateMany({
|
||||
where: { id: taskId, assetId, type, status: 'processing' },
|
||||
data: { status: 'completed', model },
|
||||
})
|
||||
if (task.count === 0) return true
|
||||
|
||||
const existing = language
|
||||
? await tx.assetTranscript.findUnique({
|
||||
where: { assetIdLanguage: { assetId, language } },
|
||||
select: transcriptSelection,
|
||||
})
|
||||
: null
|
||||
|
||||
const transcript =
|
||||
existing ??
|
||||
(language && segments.length > 0
|
||||
? await tx.assetTranscript.create({
|
||||
data: {
|
||||
assetId,
|
||||
language,
|
||||
model,
|
||||
workflowTaskId: taskId,
|
||||
segments: {
|
||||
createMany: {
|
||||
data: segments.map((segment, position) => ({ ...segment, position })),
|
||||
},
|
||||
},
|
||||
},
|
||||
select: transcriptSelection,
|
||||
})
|
||||
: null)
|
||||
|
||||
await tx.workflowTask.update({
|
||||
where: { id: taskId },
|
||||
data: {
|
||||
output: {
|
||||
transcription: transcript
|
||||
? { transcriptId: transcript.id, language: transcript.language }
|
||||
: { noSpeech: true },
|
||||
},
|
||||
},
|
||||
})
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
private async requireEnabled(teamId?: string): Promise<void> {
|
||||
if (!(await this.isGenerationEnabled(teamId))) {
|
||||
throw new HTTPException(503, { message: 'Local transcription is disabled' })
|
||||
}
|
||||
}
|
||||
|
||||
private async findSaved(
|
||||
db: Pick<Prisma.TransactionClient, 'assetTranscript' | 'workflowTask'>,
|
||||
assetId: string,
|
||||
language: string | null,
|
||||
): Promise<GenerateTranscriptResult | null> {
|
||||
if (language) {
|
||||
const transcript = await db.assetTranscript.findUnique({
|
||||
where: { assetIdLanguage: { assetId, language } },
|
||||
select: transcriptSelection,
|
||||
})
|
||||
return transcript ? { kind: 'existing', transcriptId: transcript.id, language } : null
|
||||
}
|
||||
|
||||
const auto = await db.workflowTask.findFirst({
|
||||
where: {
|
||||
assetId,
|
||||
type,
|
||||
status: 'completed',
|
||||
payload: { path: ['transcription', 'language'], equals: Prisma.JsonNull },
|
||||
},
|
||||
select: { output: true },
|
||||
orderBy: { id: 'desc' },
|
||||
})
|
||||
const result = auto?.output?.transcription
|
||||
if (!result) return null
|
||||
if ('noSpeech' in result) return { kind: 'no_speech' }
|
||||
const transcript = await db.assetTranscript.findUnique({
|
||||
where: { id: result.transcriptId },
|
||||
select: transcriptSelection,
|
||||
})
|
||||
return transcript
|
||||
? { kind: 'existing', transcriptId: transcript.id, language: transcript.language }
|
||||
: null
|
||||
}
|
||||
}
|
||||
|
||||
export const transcriptService = new TranscriptService()
|
||||
@@ -0,0 +1,39 @@
|
||||
-- AlterEnum
|
||||
ALTER TYPE "WorkflowTaskType" ADD VALUE 'ai_transcription';
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "asset_transcripts" (
|
||||
"id" TEXT NOT NULL,
|
||||
"asset_id" TEXT NOT NULL,
|
||||
"language" TEXT NOT NULL,
|
||||
"model" TEXT NOT NULL,
|
||||
"workflow_task_id" TEXT NOT NULL,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "asset_transcripts_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "asset_transcript_segments" (
|
||||
"id" TEXT NOT NULL,
|
||||
"transcript_id" TEXT NOT NULL,
|
||||
"position" INTEGER NOT NULL,
|
||||
"start_ms" INTEGER NOT NULL,
|
||||
"end_ms" INTEGER NOT NULL,
|
||||
"text" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "asset_transcript_segments_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "asset_transcripts_asset_id_language_key" ON "asset_transcripts"("asset_id", "language");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "asset_transcript_segments_transcript_id_position_key" ON "asset_transcript_segments"("transcript_id", "position");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "asset_transcripts" ADD CONSTRAINT "asset_transcripts_asset_id_fkey" FOREIGN KEY ("asset_id") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "asset_transcript_segments" ADD CONSTRAINT "asset_transcript_segments_transcript_id_fkey" FOREIGN KEY ("transcript_id") REFERENCES "asset_transcripts"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[transcription_task_id]` on the table `asset_comments` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- AlterEnum
|
||||
ALTER TYPE "AgentType" ADD VALUE 'transcription';
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "asset_comments" ADD COLUMN "transcription_task_id" TEXT;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "asset_comments_transcription_task_id_key" ON "asset_comments"("transcription_task_id");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "asset_comments" ADD CONSTRAINT "asset_comments_transcription_task_id_fkey" FOREIGN KEY ("transcription_task_id") REFERENCES "workflow_tasks"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -129,6 +129,7 @@ enum WorkflowTaskType {
|
||||
ai_metadata_autofill
|
||||
chat
|
||||
ai_embedding
|
||||
ai_transcription
|
||||
query_embedding_for_search
|
||||
agent_tool_call // @deprecated: Agent tools now execute directly in-process via Core services
|
||||
kanban_agent_run
|
||||
@@ -619,6 +620,7 @@ model Asset {
|
||||
commentAttachments AssetCommentAttachment[] @relation("AssetToCommentAttachment")
|
||||
notifications Notification[] @relation("AssetToNotification")
|
||||
embeddings AssetEmbedding[] @relation("AssetToEmbedding")
|
||||
transcripts AssetTranscript[]
|
||||
|
||||
teamRootFolder Team? @relation("TeamToRootFolder")
|
||||
projectRootFolder Project? @relation("ProjectToRootFolder")
|
||||
@@ -699,6 +701,8 @@ model AssetComment {
|
||||
second Float?
|
||||
sessionId String? @map("session_id")
|
||||
session AgentSession? @relation(fields: [sessionId], references: [id], onDelete: SetNull)
|
||||
transcriptionTaskId String? @unique @map("transcription_task_id")
|
||||
transcriptionTask WorkflowTask? @relation(fields: [transcriptionTaskId], references: [id], onDelete: SetNull)
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@ -775,6 +779,34 @@ model AssetEmbedding {
|
||||
@@map("asset_embeddings")
|
||||
}
|
||||
|
||||
model AssetTranscript {
|
||||
id String @id @default(ulid())
|
||||
assetId String @map("asset_id")
|
||||
asset Asset @relation(fields: [assetId], references: [id], onDelete: Cascade)
|
||||
language String
|
||||
model String
|
||||
workflowTaskId String @map("workflow_task_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
segments AssetTranscriptSegment[]
|
||||
|
||||
@@unique([assetId, language], name: "assetIdLanguage")
|
||||
@@map("asset_transcripts")
|
||||
}
|
||||
|
||||
model AssetTranscriptSegment {
|
||||
id String @id @default(ulid())
|
||||
transcriptId String @map("transcript_id")
|
||||
transcript AssetTranscript @relation(fields: [transcriptId], references: [id], onDelete: Cascade)
|
||||
position Int
|
||||
startMs Int @map("start_ms")
|
||||
endMs Int @map("end_ms")
|
||||
text String @db.Text
|
||||
|
||||
@@unique([transcriptId, position], name: "transcriptIdPosition")
|
||||
@@map("asset_transcript_segments")
|
||||
}
|
||||
|
||||
model Invite {
|
||||
id String @id @default(ulid())
|
||||
code String @unique
|
||||
@@ -899,6 +931,7 @@ model WorkflowTask {
|
||||
sessionId String? @map("session_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
transcriptionFailureComment AssetComment?
|
||||
|
||||
@@map("workflow_tasks")
|
||||
@@index([status, heartbeat])
|
||||
@@ -912,6 +945,7 @@ enum AgentType {
|
||||
chat
|
||||
autofill
|
||||
embedding
|
||||
transcription
|
||||
}
|
||||
|
||||
enum AgentSessionType {
|
||||
|
||||
+10
@@ -137,6 +137,16 @@ export type AssetCommentReaction = Prisma.AssetCommentReactionModel
|
||||
*
|
||||
*/
|
||||
export type AssetEmbedding = Prisma.AssetEmbeddingModel
|
||||
/**
|
||||
* Model AssetTranscript
|
||||
*
|
||||
*/
|
||||
export type AssetTranscript = Prisma.AssetTranscriptModel
|
||||
/**
|
||||
* Model AssetTranscriptSegment
|
||||
*
|
||||
*/
|
||||
export type AssetTranscriptSegment = Prisma.AssetTranscriptSegmentModel
|
||||
/**
|
||||
* Model Invite
|
||||
*
|
||||
|
||||
+10
@@ -161,6 +161,16 @@ export type AssetCommentReaction = Prisma.AssetCommentReactionModel
|
||||
*
|
||||
*/
|
||||
export type AssetEmbedding = Prisma.AssetEmbeddingModel
|
||||
/**
|
||||
* Model AssetTranscript
|
||||
*
|
||||
*/
|
||||
export type AssetTranscript = Prisma.AssetTranscriptModel
|
||||
/**
|
||||
* Model AssetTranscriptSegment
|
||||
*
|
||||
*/
|
||||
export type AssetTranscriptSegment = Prisma.AssetTranscriptSegmentModel
|
||||
/**
|
||||
* Model Invite
|
||||
*
|
||||
|
||||
+3
-1
@@ -158,6 +158,7 @@ export const WorkflowTaskType = {
|
||||
ai_metadata_autofill: 'ai_metadata_autofill',
|
||||
chat: 'chat',
|
||||
ai_embedding: 'ai_embedding',
|
||||
ai_transcription: 'ai_transcription',
|
||||
query_embedding_for_search: 'query_embedding_for_search',
|
||||
agent_tool_call: 'agent_tool_call',
|
||||
kanban_agent_run: 'kanban_agent_run',
|
||||
@@ -281,7 +282,8 @@ export type ShareActivityKind = (typeof ShareActivityKind)[keyof typeof ShareAct
|
||||
export const AgentType = {
|
||||
chat: 'chat',
|
||||
autofill: 'autofill',
|
||||
embedding: 'embedding'
|
||||
embedding: 'embedding',
|
||||
transcription: 'transcription'
|
||||
} as const
|
||||
|
||||
export type AgentType = (typeof AgentType)[keyof typeof AgentType]
|
||||
|
||||
+24
-4
File diff suppressed because one or more lines are too long
+179
-1
@@ -421,6 +421,8 @@ export const ModelName = {
|
||||
AssetCommentAttachment: 'AssetCommentAttachment',
|
||||
AssetCommentReaction: 'AssetCommentReaction',
|
||||
AssetEmbedding: 'AssetEmbedding',
|
||||
AssetTranscript: 'AssetTranscript',
|
||||
AssetTranscriptSegment: 'AssetTranscriptSegment',
|
||||
Invite: 'Invite',
|
||||
MetadataField: 'MetadataField',
|
||||
Notification: 'Notification',
|
||||
@@ -474,7 +476,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
omit: GlobalOmitOptions
|
||||
}
|
||||
meta: {
|
||||
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "runner" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "shareActivity" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetAgentMd" | "assetComment" | "assetCommentAttachment" | "assetCommentReaction" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionCommit" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog" | "quotaRule" | "quotaRecord" | "kanbanGoal" | "kanbanTask" | "kanbanTaskLink" | "kanbanTaskAsset" | "kanbanTaskComment" | "kanbanTaskEvent" | "recentFileItem" | "jwks" | "oauthClient" | "oauthResource" | "oauthClientResource" | "oauthRefreshToken" | "oauthAccessToken" | "oauthConsent" | "oauthClientAssertion"
|
||||
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "runner" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "shareActivity" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetAgentMd" | "assetComment" | "assetCommentAttachment" | "assetCommentReaction" | "assetEmbedding" | "assetTranscript" | "assetTranscriptSegment" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionCommit" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog" | "quotaRule" | "quotaRecord" | "kanbanGoal" | "kanbanTask" | "kanbanTaskLink" | "kanbanTaskAsset" | "kanbanTaskComment" | "kanbanTaskEvent" | "recentFileItem" | "jwks" | "oauthClient" | "oauthResource" | "oauthClientResource" | "oauthRefreshToken" | "oauthAccessToken" | "oauthConsent" | "oauthClientAssertion"
|
||||
txIsolationLevel: TransactionIsolationLevel
|
||||
}
|
||||
model: {
|
||||
@@ -2254,6 +2256,154 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
AssetTranscript: {
|
||||
payload: Prisma.$AssetTranscriptPayload<ExtArgs>
|
||||
fields: Prisma.AssetTranscriptFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.AssetTranscriptFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.AssetTranscriptFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.AssetTranscriptFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.AssetTranscriptFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.AssetTranscriptFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.AssetTranscriptCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.AssetTranscriptCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.AssetTranscriptCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.AssetTranscriptDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.AssetTranscriptUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.AssetTranscriptDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.AssetTranscriptUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.AssetTranscriptUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.AssetTranscriptUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.AssetTranscriptAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateAssetTranscript>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.AssetTranscriptGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AssetTranscriptGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.AssetTranscriptCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AssetTranscriptCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
AssetTranscriptSegment: {
|
||||
payload: Prisma.$AssetTranscriptSegmentPayload<ExtArgs>
|
||||
fields: Prisma.AssetTranscriptSegmentFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.AssetTranscriptSegmentFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.AssetTranscriptSegmentFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.AssetTranscriptSegmentFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.AssetTranscriptSegmentFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.AssetTranscriptSegmentFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.AssetTranscriptSegmentCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.AssetTranscriptSegmentCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.AssetTranscriptSegmentCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.AssetTranscriptSegmentDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.AssetTranscriptSegmentUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.AssetTranscriptSegmentDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.AssetTranscriptSegmentUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.AssetTranscriptSegmentUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.AssetTranscriptSegmentUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.AssetTranscriptSegmentAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateAssetTranscriptSegment>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.AssetTranscriptSegmentGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AssetTranscriptSegmentGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.AssetTranscriptSegmentCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AssetTranscriptSegmentCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
Invite: {
|
||||
payload: Prisma.$InvitePayload<ExtArgs>
|
||||
fields: Prisma.InviteFieldRefs
|
||||
@@ -5407,6 +5557,7 @@ export const AssetCommentScalarFieldEnum = {
|
||||
annotation: 'annotation',
|
||||
second: 'second',
|
||||
sessionId: 'sessionId',
|
||||
transcriptionTaskId: 'transcriptionTaskId',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
assetId: 'assetId',
|
||||
@@ -5455,6 +5606,31 @@ export const AssetEmbeddingScalarFieldEnum = {
|
||||
export type AssetEmbeddingScalarFieldEnum = (typeof AssetEmbeddingScalarFieldEnum)[keyof typeof AssetEmbeddingScalarFieldEnum]
|
||||
|
||||
|
||||
export const AssetTranscriptScalarFieldEnum = {
|
||||
id: 'id',
|
||||
assetId: 'assetId',
|
||||
language: 'language',
|
||||
model: 'model',
|
||||
workflowTaskId: 'workflowTaskId',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt'
|
||||
} as const
|
||||
|
||||
export type AssetTranscriptScalarFieldEnum = (typeof AssetTranscriptScalarFieldEnum)[keyof typeof AssetTranscriptScalarFieldEnum]
|
||||
|
||||
|
||||
export const AssetTranscriptSegmentScalarFieldEnum = {
|
||||
id: 'id',
|
||||
transcriptId: 'transcriptId',
|
||||
position: 'position',
|
||||
startMs: 'startMs',
|
||||
endMs: 'endMs',
|
||||
text: 'text'
|
||||
} as const
|
||||
|
||||
export type AssetTranscriptSegmentScalarFieldEnum = (typeof AssetTranscriptSegmentScalarFieldEnum)[keyof typeof AssetTranscriptSegmentScalarFieldEnum]
|
||||
|
||||
|
||||
export const InviteScalarFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
@@ -6747,6 +6923,8 @@ export type GlobalOmitConfig = {
|
||||
assetCommentAttachment?: Prisma.AssetCommentAttachmentOmit
|
||||
assetCommentReaction?: Prisma.AssetCommentReactionOmit
|
||||
assetEmbedding?: Prisma.AssetEmbeddingOmit
|
||||
assetTranscript?: Prisma.AssetTranscriptOmit
|
||||
assetTranscriptSegment?: Prisma.AssetTranscriptSegmentOmit
|
||||
invite?: Prisma.InviteOmit
|
||||
metadataField?: Prisma.MetadataFieldOmit
|
||||
notification?: Prisma.NotificationOmit
|
||||
|
||||
@@ -75,6 +75,8 @@ export const ModelName = {
|
||||
AssetCommentAttachment: 'AssetCommentAttachment',
|
||||
AssetCommentReaction: 'AssetCommentReaction',
|
||||
AssetEmbedding: 'AssetEmbedding',
|
||||
AssetTranscript: 'AssetTranscript',
|
||||
AssetTranscriptSegment: 'AssetTranscriptSegment',
|
||||
Invite: 'Invite',
|
||||
MetadataField: 'MetadataField',
|
||||
Notification: 'Notification',
|
||||
@@ -433,6 +435,7 @@ export const AssetCommentScalarFieldEnum = {
|
||||
annotation: 'annotation',
|
||||
second: 'second',
|
||||
sessionId: 'sessionId',
|
||||
transcriptionTaskId: 'transcriptionTaskId',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
assetId: 'assetId',
|
||||
@@ -481,6 +484,31 @@ export const AssetEmbeddingScalarFieldEnum = {
|
||||
export type AssetEmbeddingScalarFieldEnum = (typeof AssetEmbeddingScalarFieldEnum)[keyof typeof AssetEmbeddingScalarFieldEnum]
|
||||
|
||||
|
||||
export const AssetTranscriptScalarFieldEnum = {
|
||||
id: 'id',
|
||||
assetId: 'assetId',
|
||||
language: 'language',
|
||||
model: 'model',
|
||||
workflowTaskId: 'workflowTaskId',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt'
|
||||
} as const
|
||||
|
||||
export type AssetTranscriptScalarFieldEnum = (typeof AssetTranscriptScalarFieldEnum)[keyof typeof AssetTranscriptScalarFieldEnum]
|
||||
|
||||
|
||||
export const AssetTranscriptSegmentScalarFieldEnum = {
|
||||
id: 'id',
|
||||
transcriptId: 'transcriptId',
|
||||
position: 'position',
|
||||
startMs: 'startMs',
|
||||
endMs: 'endMs',
|
||||
text: 'text'
|
||||
} as const
|
||||
|
||||
export type AssetTranscriptSegmentScalarFieldEnum = (typeof AssetTranscriptSegmentScalarFieldEnum)[keyof typeof AssetTranscriptSegmentScalarFieldEnum]
|
||||
|
||||
|
||||
export const InviteScalarFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
|
||||
+2
@@ -32,6 +32,8 @@ export type * from './models/AssetComment.ts'
|
||||
export type * from './models/AssetCommentAttachment.ts'
|
||||
export type * from './models/AssetCommentReaction.ts'
|
||||
export type * from './models/AssetEmbedding.ts'
|
||||
export type * from './models/AssetTranscript.ts'
|
||||
export type * from './models/AssetTranscriptSegment.ts'
|
||||
export type * from './models/Invite.ts'
|
||||
export type * from './models/MetadataField.ts'
|
||||
export type * from './models/Notification.ts'
|
||||
|
||||
+346
File diff suppressed because it is too large
Load Diff
+226
-2
@@ -41,6 +41,7 @@ export type AssetCommentMinAggregateOutputType = {
|
||||
message: string | null
|
||||
second: number | null
|
||||
sessionId: string | null
|
||||
transcriptionTaskId: string | null
|
||||
createdAt: Date | null
|
||||
updatedAt: Date | null
|
||||
assetId: string | null
|
||||
@@ -56,6 +57,7 @@ export type AssetCommentMaxAggregateOutputType = {
|
||||
message: string | null
|
||||
second: number | null
|
||||
sessionId: string | null
|
||||
transcriptionTaskId: string | null
|
||||
createdAt: Date | null
|
||||
updatedAt: Date | null
|
||||
assetId: string | null
|
||||
@@ -72,6 +74,7 @@ export type AssetCommentCountAggregateOutputType = {
|
||||
annotation: number
|
||||
second: number
|
||||
sessionId: number
|
||||
transcriptionTaskId: number
|
||||
createdAt: number
|
||||
updatedAt: number
|
||||
assetId: number
|
||||
@@ -97,6 +100,7 @@ export type AssetCommentMinAggregateInputType = {
|
||||
message?: true
|
||||
second?: true
|
||||
sessionId?: true
|
||||
transcriptionTaskId?: true
|
||||
createdAt?: true
|
||||
updatedAt?: true
|
||||
assetId?: true
|
||||
@@ -112,6 +116,7 @@ export type AssetCommentMaxAggregateInputType = {
|
||||
message?: true
|
||||
second?: true
|
||||
sessionId?: true
|
||||
transcriptionTaskId?: true
|
||||
createdAt?: true
|
||||
updatedAt?: true
|
||||
assetId?: true
|
||||
@@ -128,6 +133,7 @@ export type AssetCommentCountAggregateInputType = {
|
||||
annotation?: true
|
||||
second?: true
|
||||
sessionId?: true
|
||||
transcriptionTaskId?: true
|
||||
createdAt?: true
|
||||
updatedAt?: true
|
||||
assetId?: true
|
||||
@@ -231,6 +237,7 @@ export type AssetCommentGroupByOutputType = {
|
||||
annotation:PrismaJson.AnnotationList | null
|
||||
second: number | null
|
||||
sessionId: string | null
|
||||
transcriptionTaskId: string | null
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
assetId: string
|
||||
@@ -270,6 +277,7 @@ export type AssetCommentWhereInput = {
|
||||
annotation?: Prisma.JsonNullableFilter<"AssetComment">
|
||||
second?: Prisma.FloatNullableFilter<"AssetComment"> | number | null
|
||||
sessionId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
transcriptionTaskId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"AssetComment"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"AssetComment"> | Date | string
|
||||
assetId?: Prisma.StringFilter<"AssetComment"> | string
|
||||
@@ -279,6 +287,7 @@ export type AssetCommentWhereInput = {
|
||||
completionLastChangedById?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
replyToId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
session?: Prisma.XOR<Prisma.AgentSessionNullableScalarRelationFilter, Prisma.AgentSessionWhereInput> | null
|
||||
transcriptionTask?: Prisma.XOR<Prisma.WorkflowTaskNullableScalarRelationFilter, Prisma.WorkflowTaskWhereInput> | null
|
||||
asset?: Prisma.XOR<Prisma.AssetScalarRelationFilter, Prisma.AssetWhereInput>
|
||||
creator?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
|
||||
completionLastChangedBy?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
|
||||
@@ -294,6 +303,7 @@ export type AssetCommentOrderByWithRelationInput = {
|
||||
annotation?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
second?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
sessionId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
transcriptionTaskId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrder
|
||||
@@ -303,6 +313,7 @@ export type AssetCommentOrderByWithRelationInput = {
|
||||
completionLastChangedById?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
replyToId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
session?: Prisma.AgentSessionOrderByWithRelationInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskOrderByWithRelationInput
|
||||
asset?: Prisma.AssetOrderByWithRelationInput
|
||||
creator?: Prisma.UserOrderByWithRelationInput
|
||||
completionLastChangedBy?: Prisma.UserOrderByWithRelationInput
|
||||
@@ -314,6 +325,7 @@ export type AssetCommentOrderByWithRelationInput = {
|
||||
|
||||
export type AssetCommentWhereUniqueInput = Prisma.AtLeast<{
|
||||
id?: string
|
||||
transcriptionTaskId?: string
|
||||
AND?: Prisma.AssetCommentWhereInput | Prisma.AssetCommentWhereInput[]
|
||||
OR?: Prisma.AssetCommentWhereInput[]
|
||||
NOT?: Prisma.AssetCommentWhereInput | Prisma.AssetCommentWhereInput[]
|
||||
@@ -330,6 +342,7 @@ export type AssetCommentWhereUniqueInput = Prisma.AtLeast<{
|
||||
completionLastChangedById?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
replyToId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
session?: Prisma.XOR<Prisma.AgentSessionNullableScalarRelationFilter, Prisma.AgentSessionWhereInput> | null
|
||||
transcriptionTask?: Prisma.XOR<Prisma.WorkflowTaskNullableScalarRelationFilter, Prisma.WorkflowTaskWhereInput> | null
|
||||
asset?: Prisma.XOR<Prisma.AssetScalarRelationFilter, Prisma.AssetWhereInput>
|
||||
creator?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
|
||||
completionLastChangedBy?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
|
||||
@@ -337,7 +350,7 @@ export type AssetCommentWhereUniqueInput = Prisma.AtLeast<{
|
||||
replies?: Prisma.AssetCommentListRelationFilter
|
||||
attachments?: Prisma.AssetCommentAttachmentListRelationFilter
|
||||
reactions?: Prisma.AssetCommentReactionListRelationFilter
|
||||
}, "id">
|
||||
}, "id" | "transcriptionTaskId">
|
||||
|
||||
export type AssetCommentOrderByWithAggregationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
@@ -345,6 +358,7 @@ export type AssetCommentOrderByWithAggregationInput = {
|
||||
annotation?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
second?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
sessionId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
transcriptionTaskId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrder
|
||||
@@ -369,6 +383,7 @@ export type AssetCommentScalarWhereWithAggregatesInput = {
|
||||
annotation?: Prisma.JsonNullableWithAggregatesFilter<"AssetComment">
|
||||
second?: Prisma.FloatNullableWithAggregatesFilter<"AssetComment"> | number | null
|
||||
sessionId?: Prisma.StringNullableWithAggregatesFilter<"AssetComment"> | string | null
|
||||
transcriptionTaskId?: Prisma.StringNullableWithAggregatesFilter<"AssetComment"> | string | null
|
||||
createdAt?: Prisma.DateTimeWithAggregatesFilter<"AssetComment"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeWithAggregatesFilter<"AssetComment"> | Date | string
|
||||
assetId?: Prisma.StringWithAggregatesFilter<"AssetComment"> | string
|
||||
@@ -389,6 +404,7 @@ export type AssetCommentCreateInput = {
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskCreateNestedOneWithoutTranscriptionFailureCommentInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
|
||||
@@ -404,6 +420,7 @@ export type AssetCommentUncheckedCreateInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
@@ -427,6 +444,7 @@ export type AssetCommentUpdateInput = {
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskUpdateOneWithoutTranscriptionFailureCommentNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
|
||||
@@ -442,6 +460,7 @@ export type AssetCommentUncheckedUpdateInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -461,6 +480,7 @@ export type AssetCommentCreateManyInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
@@ -488,6 +508,7 @@ export type AssetCommentUncheckedUpdateManyInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -519,6 +540,7 @@ export type AssetCommentCountOrderByAggregateInput = {
|
||||
annotation?: Prisma.SortOrder
|
||||
second?: Prisma.SortOrder
|
||||
sessionId?: Prisma.SortOrder
|
||||
transcriptionTaskId?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrder
|
||||
@@ -538,6 +560,7 @@ export type AssetCommentMaxOrderByAggregateInput = {
|
||||
message?: Prisma.SortOrder
|
||||
second?: Prisma.SortOrder
|
||||
sessionId?: Prisma.SortOrder
|
||||
transcriptionTaskId?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrder
|
||||
@@ -553,6 +576,7 @@ export type AssetCommentMinOrderByAggregateInput = {
|
||||
message?: Prisma.SortOrder
|
||||
second?: Prisma.SortOrder
|
||||
sessionId?: Prisma.SortOrder
|
||||
transcriptionTaskId?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
assetId?: Prisma.SortOrder
|
||||
@@ -784,6 +808,38 @@ export type AssetCommentUpdateOneRequiredWithoutReactionsNestedInput = {
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.AssetCommentUpdateToOneWithWhereWithoutReactionsInput, Prisma.AssetCommentUpdateWithoutReactionsInput>, Prisma.AssetCommentUncheckedUpdateWithoutReactionsInput>
|
||||
}
|
||||
|
||||
export type AssetCommentCreateNestedOneWithoutTranscriptionTaskInput = {
|
||||
create?: Prisma.XOR<Prisma.AssetCommentCreateWithoutTranscriptionTaskInput, Prisma.AssetCommentUncheckedCreateWithoutTranscriptionTaskInput>
|
||||
connectOrCreate?: Prisma.AssetCommentCreateOrConnectWithoutTranscriptionTaskInput
|
||||
connect?: Prisma.AssetCommentWhereUniqueInput
|
||||
}
|
||||
|
||||
export type AssetCommentUncheckedCreateNestedOneWithoutTranscriptionTaskInput = {
|
||||
create?: Prisma.XOR<Prisma.AssetCommentCreateWithoutTranscriptionTaskInput, Prisma.AssetCommentUncheckedCreateWithoutTranscriptionTaskInput>
|
||||
connectOrCreate?: Prisma.AssetCommentCreateOrConnectWithoutTranscriptionTaskInput
|
||||
connect?: Prisma.AssetCommentWhereUniqueInput
|
||||
}
|
||||
|
||||
export type AssetCommentUpdateOneWithoutTranscriptionTaskNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.AssetCommentCreateWithoutTranscriptionTaskInput, Prisma.AssetCommentUncheckedCreateWithoutTranscriptionTaskInput>
|
||||
connectOrCreate?: Prisma.AssetCommentCreateOrConnectWithoutTranscriptionTaskInput
|
||||
upsert?: Prisma.AssetCommentUpsertWithoutTranscriptionTaskInput
|
||||
disconnect?: Prisma.AssetCommentWhereInput | boolean
|
||||
delete?: Prisma.AssetCommentWhereInput | boolean
|
||||
connect?: Prisma.AssetCommentWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.AssetCommentUpdateToOneWithWhereWithoutTranscriptionTaskInput, Prisma.AssetCommentUpdateWithoutTranscriptionTaskInput>, Prisma.AssetCommentUncheckedUpdateWithoutTranscriptionTaskInput>
|
||||
}
|
||||
|
||||
export type AssetCommentUncheckedUpdateOneWithoutTranscriptionTaskNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.AssetCommentCreateWithoutTranscriptionTaskInput, Prisma.AssetCommentUncheckedCreateWithoutTranscriptionTaskInput>
|
||||
connectOrCreate?: Prisma.AssetCommentCreateOrConnectWithoutTranscriptionTaskInput
|
||||
upsert?: Prisma.AssetCommentUpsertWithoutTranscriptionTaskInput
|
||||
disconnect?: Prisma.AssetCommentWhereInput | boolean
|
||||
delete?: Prisma.AssetCommentWhereInput | boolean
|
||||
connect?: Prisma.AssetCommentWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.AssetCommentUpdateToOneWithWhereWithoutTranscriptionTaskInput, Prisma.AssetCommentUpdateWithoutTranscriptionTaskInput>, Prisma.AssetCommentUncheckedUpdateWithoutTranscriptionTaskInput>
|
||||
}
|
||||
|
||||
export type AssetCommentCreateNestedManyWithoutSessionInput = {
|
||||
create?: Prisma.XOR<Prisma.AssetCommentCreateWithoutSessionInput, Prisma.AssetCommentUncheckedCreateWithoutSessionInput> | Prisma.AssetCommentCreateWithoutSessionInput[] | Prisma.AssetCommentUncheckedCreateWithoutSessionInput[]
|
||||
connectOrCreate?: Prisma.AssetCommentCreateOrConnectWithoutSessionInput | Prisma.AssetCommentCreateOrConnectWithoutSessionInput[]
|
||||
@@ -836,6 +892,7 @@ export type AssetCommentCreateWithoutCreatorInput = {
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskCreateNestedOneWithoutTranscriptionFailureCommentInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
|
||||
replyTo?: Prisma.AssetCommentCreateNestedOneWithoutRepliesInput
|
||||
@@ -850,6 +907,7 @@ export type AssetCommentUncheckedCreateWithoutCreatorInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
@@ -882,6 +940,7 @@ export type AssetCommentCreateWithoutCompletionLastChangedByInput = {
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskCreateNestedOneWithoutTranscriptionFailureCommentInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
replyTo?: Prisma.AssetCommentCreateNestedOneWithoutRepliesInput
|
||||
@@ -896,6 +955,7 @@ export type AssetCommentUncheckedCreateWithoutCompletionLastChangedByInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
@@ -943,6 +1003,7 @@ export type AssetCommentScalarWhereInput = {
|
||||
annotation?: Prisma.JsonNullableFilter<"AssetComment">
|
||||
second?: Prisma.FloatNullableFilter<"AssetComment"> | number | null
|
||||
sessionId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
transcriptionTaskId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"AssetComment"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"AssetComment"> | Date | string
|
||||
assetId?: Prisma.StringFilter<"AssetComment"> | string
|
||||
@@ -979,6 +1040,7 @@ export type AssetCommentCreateWithoutAssetInput = {
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskCreateNestedOneWithoutTranscriptionFailureCommentInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
|
||||
replyTo?: Prisma.AssetCommentCreateNestedOneWithoutRepliesInput
|
||||
@@ -993,6 +1055,7 @@ export type AssetCommentUncheckedCreateWithoutAssetInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
creatorId?: string | null
|
||||
@@ -1041,6 +1104,7 @@ export type AssetCommentCreateWithoutRepliesInput = {
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskCreateNestedOneWithoutTranscriptionFailureCommentInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
|
||||
@@ -1055,6 +1119,7 @@ export type AssetCommentUncheckedCreateWithoutRepliesInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
@@ -1082,6 +1147,7 @@ export type AssetCommentCreateWithoutReplyToInput = {
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskCreateNestedOneWithoutTranscriptionFailureCommentInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
|
||||
@@ -1096,6 +1162,7 @@ export type AssetCommentUncheckedCreateWithoutReplyToInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
@@ -1139,6 +1206,7 @@ export type AssetCommentUpdateWithoutRepliesInput = {
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskUpdateOneWithoutTranscriptionFailureCommentNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
|
||||
@@ -1153,6 +1221,7 @@ export type AssetCommentUncheckedUpdateWithoutRepliesInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -1191,6 +1260,7 @@ export type AssetCommentCreateWithoutAttachmentsInput = {
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskCreateNestedOneWithoutTranscriptionFailureCommentInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
|
||||
@@ -1205,6 +1275,7 @@ export type AssetCommentUncheckedCreateWithoutAttachmentsInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
@@ -1243,6 +1314,7 @@ export type AssetCommentUpdateWithoutAttachmentsInput = {
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskUpdateOneWithoutTranscriptionFailureCommentNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
|
||||
@@ -1257,6 +1329,7 @@ export type AssetCommentUncheckedUpdateWithoutAttachmentsInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -1279,6 +1352,7 @@ export type AssetCommentCreateWithoutReactionsInput = {
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskCreateNestedOneWithoutTranscriptionFailureCommentInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
|
||||
@@ -1293,6 +1367,7 @@ export type AssetCommentUncheckedCreateWithoutReactionsInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
@@ -1331,6 +1406,7 @@ export type AssetCommentUpdateWithoutReactionsInput = {
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskUpdateOneWithoutTranscriptionFailureCommentNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
|
||||
@@ -1340,6 +1416,98 @@ export type AssetCommentUpdateWithoutReactionsInput = {
|
||||
}
|
||||
|
||||
export type AssetCommentUncheckedUpdateWithoutReactionsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
|
||||
attachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutCommentNestedInput
|
||||
}
|
||||
|
||||
export type AssetCommentCreateWithoutTranscriptionTaskInput = {
|
||||
id?: string
|
||||
message?: string | null
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
|
||||
replyTo?: Prisma.AssetCommentCreateNestedOneWithoutRepliesInput
|
||||
replies?: Prisma.AssetCommentCreateNestedManyWithoutReplyToInput
|
||||
attachments?: Prisma.AssetCommentAttachmentCreateNestedManyWithoutCommentInput
|
||||
reactions?: Prisma.AssetCommentReactionCreateNestedManyWithoutCommentInput
|
||||
}
|
||||
|
||||
export type AssetCommentUncheckedCreateWithoutTranscriptionTaskInput = {
|
||||
id?: string
|
||||
message?: string | null
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
replyToId?: string | null
|
||||
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
|
||||
attachments?: Prisma.AssetCommentAttachmentUncheckedCreateNestedManyWithoutCommentInput
|
||||
reactions?: Prisma.AssetCommentReactionUncheckedCreateNestedManyWithoutCommentInput
|
||||
}
|
||||
|
||||
export type AssetCommentCreateOrConnectWithoutTranscriptionTaskInput = {
|
||||
where: Prisma.AssetCommentWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.AssetCommentCreateWithoutTranscriptionTaskInput, Prisma.AssetCommentUncheckedCreateWithoutTranscriptionTaskInput>
|
||||
}
|
||||
|
||||
export type AssetCommentUpsertWithoutTranscriptionTaskInput = {
|
||||
update: Prisma.XOR<Prisma.AssetCommentUpdateWithoutTranscriptionTaskInput, Prisma.AssetCommentUncheckedUpdateWithoutTranscriptionTaskInput>
|
||||
create: Prisma.XOR<Prisma.AssetCommentCreateWithoutTranscriptionTaskInput, Prisma.AssetCommentUncheckedCreateWithoutTranscriptionTaskInput>
|
||||
where?: Prisma.AssetCommentWhereInput
|
||||
}
|
||||
|
||||
export type AssetCommentUpdateToOneWithWhereWithoutTranscriptionTaskInput = {
|
||||
where?: Prisma.AssetCommentWhereInput
|
||||
data: Prisma.XOR<Prisma.AssetCommentUpdateWithoutTranscriptionTaskInput, Prisma.AssetCommentUncheckedUpdateWithoutTranscriptionTaskInput>
|
||||
}
|
||||
|
||||
export type AssetCommentUpdateWithoutTranscriptionTaskInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
|
||||
replyTo?: Prisma.AssetCommentUpdateOneWithoutRepliesNestedInput
|
||||
replies?: Prisma.AssetCommentUpdateManyWithoutReplyToNestedInput
|
||||
attachments?: Prisma.AssetCommentAttachmentUpdateManyWithoutCommentNestedInput
|
||||
reactions?: Prisma.AssetCommentReactionUpdateManyWithoutCommentNestedInput
|
||||
}
|
||||
|
||||
export type AssetCommentUncheckedUpdateWithoutTranscriptionTaskInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
@@ -1355,6 +1523,7 @@ export type AssetCommentUncheckedUpdateWithoutReactionsInput = {
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
|
||||
attachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutCommentNestedInput
|
||||
reactions?: Prisma.AssetCommentReactionUncheckedUpdateManyWithoutCommentNestedInput
|
||||
}
|
||||
|
||||
export type AssetCommentCreateWithoutSessionInput = {
|
||||
@@ -1366,6 +1535,7 @@ export type AssetCommentCreateWithoutSessionInput = {
|
||||
updatedAt?: Date | string
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
transcriptionTask?: Prisma.WorkflowTaskCreateNestedOneWithoutTranscriptionFailureCommentInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
|
||||
@@ -1380,6 +1550,7 @@ export type AssetCommentUncheckedCreateWithoutSessionInput = {
|
||||
message?: string | null
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
@@ -1425,6 +1596,7 @@ export type AssetCommentCreateManyCreatorInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
@@ -1440,6 +1612,7 @@ export type AssetCommentCreateManyCompletionLastChangedByInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
@@ -1459,6 +1632,7 @@ export type AssetCommentUpdateWithoutCreatorInput = {
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskUpdateOneWithoutTranscriptionFailureCommentNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
|
||||
replyTo?: Prisma.AssetCommentUpdateOneWithoutRepliesNestedInput
|
||||
@@ -1473,6 +1647,7 @@ export type AssetCommentUncheckedUpdateWithoutCreatorInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -1491,6 +1666,7 @@ export type AssetCommentUncheckedUpdateManyWithoutCreatorInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -1510,6 +1686,7 @@ export type AssetCommentUpdateWithoutCompletionLastChangedByInput = {
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskUpdateOneWithoutTranscriptionFailureCommentNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
replyTo?: Prisma.AssetCommentUpdateOneWithoutRepliesNestedInput
|
||||
@@ -1524,6 +1701,7 @@ export type AssetCommentUncheckedUpdateWithoutCompletionLastChangedByInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -1542,6 +1720,7 @@ export type AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByInput =
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -1557,6 +1736,7 @@ export type AssetCommentCreateManyAssetInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
creatorId?: string | null
|
||||
@@ -1576,6 +1756,7 @@ export type AssetCommentUpdateWithoutAssetInput = {
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskUpdateOneWithoutTranscriptionFailureCommentNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
|
||||
replyTo?: Prisma.AssetCommentUpdateOneWithoutRepliesNestedInput
|
||||
@@ -1590,6 +1771,7 @@ export type AssetCommentUncheckedUpdateWithoutAssetInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -1608,6 +1790,7 @@ export type AssetCommentUncheckedUpdateManyWithoutAssetInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -1623,6 +1806,7 @@ export type AssetCommentCreateManyReplyToInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
sessionId?: string | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
@@ -1642,6 +1826,7 @@ export type AssetCommentUpdateWithoutReplyToInput = {
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
transcriptionTask?: Prisma.WorkflowTaskUpdateOneWithoutTranscriptionFailureCommentNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
|
||||
@@ -1656,6 +1841,7 @@ export type AssetCommentUncheckedUpdateWithoutReplyToInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -1674,6 +1860,7 @@ export type AssetCommentUncheckedUpdateManyWithoutReplyToInput = {
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -1688,6 +1875,7 @@ export type AssetCommentCreateManySessionInput = {
|
||||
message?: string | null
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: number | null
|
||||
transcriptionTaskId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
@@ -1707,6 +1895,7 @@ export type AssetCommentUpdateWithoutSessionInput = {
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
transcriptionTask?: Prisma.WorkflowTaskUpdateOneWithoutTranscriptionFailureCommentNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
|
||||
@@ -1721,6 +1910,7 @@ export type AssetCommentUncheckedUpdateWithoutSessionInput = {
|
||||
message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -1739,6 +1929,7 @@ export type AssetCommentUncheckedUpdateManyWithoutSessionInput = {
|
||||
message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
|
||||
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
|
||||
transcriptionTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -1804,6 +1995,7 @@ export type AssetCommentSelect<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
annotation?: boolean
|
||||
second?: boolean
|
||||
sessionId?: boolean
|
||||
transcriptionTaskId?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
assetId?: boolean
|
||||
@@ -1813,6 +2005,7 @@ export type AssetCommentSelect<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
completionLastChangedById?: boolean
|
||||
replyToId?: boolean
|
||||
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
|
||||
transcriptionTask?: boolean | Prisma.AssetComment$transcriptionTaskArgs<ExtArgs>
|
||||
asset?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
|
||||
creator?: boolean | Prisma.AssetComment$creatorArgs<ExtArgs>
|
||||
completionLastChangedBy?: boolean | Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>
|
||||
@@ -1829,6 +2022,7 @@ export type AssetCommentSelectCreateManyAndReturn<ExtArgs extends runtime.Types.
|
||||
annotation?: boolean
|
||||
second?: boolean
|
||||
sessionId?: boolean
|
||||
transcriptionTaskId?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
assetId?: boolean
|
||||
@@ -1838,6 +2032,7 @@ export type AssetCommentSelectCreateManyAndReturn<ExtArgs extends runtime.Types.
|
||||
completionLastChangedById?: boolean
|
||||
replyToId?: boolean
|
||||
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
|
||||
transcriptionTask?: boolean | Prisma.AssetComment$transcriptionTaskArgs<ExtArgs>
|
||||
asset?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
|
||||
creator?: boolean | Prisma.AssetComment$creatorArgs<ExtArgs>
|
||||
completionLastChangedBy?: boolean | Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>
|
||||
@@ -1850,6 +2045,7 @@ export type AssetCommentSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.
|
||||
annotation?: boolean
|
||||
second?: boolean
|
||||
sessionId?: boolean
|
||||
transcriptionTaskId?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
assetId?: boolean
|
||||
@@ -1859,6 +2055,7 @@ export type AssetCommentSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.
|
||||
completionLastChangedById?: boolean
|
||||
replyToId?: boolean
|
||||
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
|
||||
transcriptionTask?: boolean | Prisma.AssetComment$transcriptionTaskArgs<ExtArgs>
|
||||
asset?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
|
||||
creator?: boolean | Prisma.AssetComment$creatorArgs<ExtArgs>
|
||||
completionLastChangedBy?: boolean | Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>
|
||||
@@ -1871,6 +2068,7 @@ export type AssetCommentSelectScalar = {
|
||||
annotation?: boolean
|
||||
second?: boolean
|
||||
sessionId?: boolean
|
||||
transcriptionTaskId?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
assetId?: boolean
|
||||
@@ -1881,9 +2079,10 @@ export type AssetCommentSelectScalar = {
|
||||
replyToId?: boolean
|
||||
}
|
||||
|
||||
export type AssetCommentOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "message" | "annotation" | "second" | "sessionId" | "createdAt" | "updatedAt" | "assetId" | "creatorId" | "isCompleted" | "isInternal" | "completionLastChangedById" | "replyToId", ExtArgs["result"]["assetComment"]>
|
||||
export type AssetCommentOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "message" | "annotation" | "second" | "sessionId" | "transcriptionTaskId" | "createdAt" | "updatedAt" | "assetId" | "creatorId" | "isCompleted" | "isInternal" | "completionLastChangedById" | "replyToId", ExtArgs["result"]["assetComment"]>
|
||||
export type AssetCommentInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
|
||||
transcriptionTask?: boolean | Prisma.AssetComment$transcriptionTaskArgs<ExtArgs>
|
||||
asset?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
|
||||
creator?: boolean | Prisma.AssetComment$creatorArgs<ExtArgs>
|
||||
completionLastChangedBy?: boolean | Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>
|
||||
@@ -1895,6 +2094,7 @@ export type AssetCommentInclude<ExtArgs extends runtime.Types.Extensions.Interna
|
||||
}
|
||||
export type AssetCommentIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
|
||||
transcriptionTask?: boolean | Prisma.AssetComment$transcriptionTaskArgs<ExtArgs>
|
||||
asset?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
|
||||
creator?: boolean | Prisma.AssetComment$creatorArgs<ExtArgs>
|
||||
completionLastChangedBy?: boolean | Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>
|
||||
@@ -1902,6 +2102,7 @@ export type AssetCommentIncludeCreateManyAndReturn<ExtArgs extends runtime.Types
|
||||
}
|
||||
export type AssetCommentIncludeUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
|
||||
transcriptionTask?: boolean | Prisma.AssetComment$transcriptionTaskArgs<ExtArgs>
|
||||
asset?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
|
||||
creator?: boolean | Prisma.AssetComment$creatorArgs<ExtArgs>
|
||||
completionLastChangedBy?: boolean | Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>
|
||||
@@ -1912,6 +2113,7 @@ export type $AssetCommentPayload<ExtArgs extends runtime.Types.Extensions.Intern
|
||||
name: "AssetComment"
|
||||
objects: {
|
||||
session: Prisma.$AgentSessionPayload<ExtArgs> | null
|
||||
transcriptionTask: Prisma.$WorkflowTaskPayload<ExtArgs> | null
|
||||
asset: Prisma.$AssetPayload<ExtArgs>
|
||||
creator: Prisma.$UserPayload<ExtArgs> | null
|
||||
completionLastChangedBy: Prisma.$UserPayload<ExtArgs> | null
|
||||
@@ -1929,6 +2131,7 @@ export type $AssetCommentPayload<ExtArgs extends runtime.Types.Extensions.Intern
|
||||
annotation:PrismaJson.AnnotationList | null
|
||||
second: number | null
|
||||
sessionId: string | null
|
||||
transcriptionTaskId: string | null
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
assetId: string
|
||||
@@ -2332,6 +2535,7 @@ readonly fields: AssetCommentFieldRefs;
|
||||
export interface Prisma__AssetCommentClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
session<T extends Prisma.AssetComment$sessionArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AssetComment$sessionArgs<ExtArgs>>): Prisma.Prisma__AgentSessionClient<runtime.Types.Result.GetResult<Prisma.$AgentSessionPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
transcriptionTask<T extends Prisma.AssetComment$transcriptionTaskArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AssetComment$transcriptionTaskArgs<ExtArgs>>): Prisma.Prisma__WorkflowTaskClient<runtime.Types.Result.GetResult<Prisma.$WorkflowTaskPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
asset<T extends Prisma.AssetDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AssetDefaultArgs<ExtArgs>>): Prisma.Prisma__AssetClient<runtime.Types.Result.GetResult<Prisma.$AssetPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
|
||||
creator<T extends Prisma.AssetComment$creatorArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AssetComment$creatorArgs<ExtArgs>>): Prisma.Prisma__UserClient<runtime.Types.Result.GetResult<Prisma.$UserPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
completionLastChangedBy<T extends Prisma.AssetComment$completionLastChangedByArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>>): Prisma.Prisma__UserClient<runtime.Types.Result.GetResult<Prisma.$UserPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
@@ -2373,6 +2577,7 @@ export interface AssetCommentFieldRefs {
|
||||
readonly annotation: Prisma.FieldRef<"AssetComment", 'Json'>
|
||||
readonly second: Prisma.FieldRef<"AssetComment", 'Float'>
|
||||
readonly sessionId: Prisma.FieldRef<"AssetComment", 'String'>
|
||||
readonly transcriptionTaskId: Prisma.FieldRef<"AssetComment", 'String'>
|
||||
readonly createdAt: Prisma.FieldRef<"AssetComment", 'DateTime'>
|
||||
readonly updatedAt: Prisma.FieldRef<"AssetComment", 'DateTime'>
|
||||
readonly assetId: Prisma.FieldRef<"AssetComment", 'String'>
|
||||
@@ -2800,6 +3005,25 @@ export type AssetComment$sessionArgs<ExtArgs extends runtime.Types.Extensions.In
|
||||
where?: Prisma.AgentSessionWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* AssetComment.transcriptionTask
|
||||
*/
|
||||
export type AssetComment$transcriptionTaskArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the WorkflowTask
|
||||
*/
|
||||
select?: Prisma.WorkflowTaskSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the WorkflowTask
|
||||
*/
|
||||
omit?: Prisma.WorkflowTaskOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.WorkflowTaskInclude<ExtArgs> | null
|
||||
where?: Prisma.WorkflowTaskWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* AssetComment.creator
|
||||
*/
|
||||
|
||||
+1568
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+189
-1
@@ -302,6 +302,7 @@ export type WorkflowTaskWhereInput = {
|
||||
sessionId?: Prisma.StringNullableFilter<"WorkflowTask"> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"WorkflowTask"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"WorkflowTask"> | Date | string
|
||||
transcriptionFailureComment?: Prisma.XOR<Prisma.AssetCommentNullableScalarRelationFilter, Prisma.AssetCommentWhereInput> | null
|
||||
}
|
||||
|
||||
export type WorkflowTaskOrderByWithRelationInput = {
|
||||
@@ -321,6 +322,7 @@ export type WorkflowTaskOrderByWithRelationInput = {
|
||||
sessionId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
transcriptionFailureComment?: Prisma.AssetCommentOrderByWithRelationInput
|
||||
}
|
||||
|
||||
export type WorkflowTaskWhereUniqueInput = Prisma.AtLeast<{
|
||||
@@ -343,6 +345,7 @@ export type WorkflowTaskWhereUniqueInput = Prisma.AtLeast<{
|
||||
sessionId?: Prisma.StringNullableFilter<"WorkflowTask"> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"WorkflowTask"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"WorkflowTask"> | Date | string
|
||||
transcriptionFailureComment?: Prisma.XOR<Prisma.AssetCommentNullableScalarRelationFilter, Prisma.AssetCommentWhereInput> | null
|
||||
}, "id">
|
||||
|
||||
export type WorkflowTaskOrderByWithAggregationInput = {
|
||||
@@ -408,6 +411,7 @@ export type WorkflowTaskCreateInput = {
|
||||
sessionId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
transcriptionFailureComment?: Prisma.AssetCommentCreateNestedOneWithoutTranscriptionTaskInput
|
||||
}
|
||||
|
||||
export type WorkflowTaskUncheckedCreateInput = {
|
||||
@@ -427,6 +431,7 @@ export type WorkflowTaskUncheckedCreateInput = {
|
||||
sessionId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
transcriptionFailureComment?: Prisma.AssetCommentUncheckedCreateNestedOneWithoutTranscriptionTaskInput
|
||||
}
|
||||
|
||||
export type WorkflowTaskUpdateInput = {
|
||||
@@ -446,6 +451,7 @@ export type WorkflowTaskUpdateInput = {
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
transcriptionFailureComment?: Prisma.AssetCommentUpdateOneWithoutTranscriptionTaskNestedInput
|
||||
}
|
||||
|
||||
export type WorkflowTaskUncheckedUpdateInput = {
|
||||
@@ -465,6 +471,7 @@ export type WorkflowTaskUncheckedUpdateInput = {
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
transcriptionFailureComment?: Prisma.AssetCommentUncheckedUpdateOneWithoutTranscriptionTaskNestedInput
|
||||
}
|
||||
|
||||
export type WorkflowTaskCreateManyInput = {
|
||||
@@ -524,6 +531,11 @@ export type WorkflowTaskUncheckedUpdateManyInput = {
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
export type WorkflowTaskNullableScalarRelationFilter = {
|
||||
is?: Prisma.WorkflowTaskWhereInput | null
|
||||
isNot?: Prisma.WorkflowTaskWhereInput | null
|
||||
}
|
||||
|
||||
export type WorkflowTaskCountOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
uid?: Prisma.SortOrder
|
||||
@@ -587,6 +599,22 @@ export type WorkflowTaskSumOrderByAggregateInput = {
|
||||
outputTokens?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type WorkflowTaskCreateNestedOneWithoutTranscriptionFailureCommentInput = {
|
||||
create?: Prisma.XOR<Prisma.WorkflowTaskCreateWithoutTranscriptionFailureCommentInput, Prisma.WorkflowTaskUncheckedCreateWithoutTranscriptionFailureCommentInput>
|
||||
connectOrCreate?: Prisma.WorkflowTaskCreateOrConnectWithoutTranscriptionFailureCommentInput
|
||||
connect?: Prisma.WorkflowTaskWhereUniqueInput
|
||||
}
|
||||
|
||||
export type WorkflowTaskUpdateOneWithoutTranscriptionFailureCommentNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.WorkflowTaskCreateWithoutTranscriptionFailureCommentInput, Prisma.WorkflowTaskUncheckedCreateWithoutTranscriptionFailureCommentInput>
|
||||
connectOrCreate?: Prisma.WorkflowTaskCreateOrConnectWithoutTranscriptionFailureCommentInput
|
||||
upsert?: Prisma.WorkflowTaskUpsertWithoutTranscriptionFailureCommentInput
|
||||
disconnect?: Prisma.WorkflowTaskWhereInput | boolean
|
||||
delete?: Prisma.WorkflowTaskWhereInput | boolean
|
||||
connect?: Prisma.WorkflowTaskWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.WorkflowTaskUpdateToOneWithWhereWithoutTranscriptionFailureCommentInput, Prisma.WorkflowTaskUpdateWithoutTranscriptionFailureCommentInput>, Prisma.WorkflowTaskUncheckedUpdateWithoutTranscriptionFailureCommentInput>
|
||||
}
|
||||
|
||||
export type NullableEnumWorkflowTaskTypeFieldUpdateOperationsInput = {
|
||||
set?: $Enums.WorkflowTaskType | null
|
||||
}
|
||||
@@ -595,6 +623,98 @@ export type NullableEnumWorkflowTaskStatusFieldUpdateOperationsInput = {
|
||||
set?: $Enums.WorkflowTaskStatus | null
|
||||
}
|
||||
|
||||
export type WorkflowTaskCreateWithoutTranscriptionFailureCommentInput = {
|
||||
id?: string
|
||||
uid?: string
|
||||
teamId?: string | null
|
||||
projectId?: string | null
|
||||
assetId: string
|
||||
type?: $Enums.WorkflowTaskType | null
|
||||
status?: $Enums.WorkflowTaskStatus | null
|
||||
payload?:PrismaJson.WorkflowTaskPayload | Prisma.NullableJsonNullValueInput
|
||||
output?:PrismaJson.WorkflowTaskOutput | Prisma.NullableJsonNullValueInput
|
||||
heartbeat?: Date | string | null
|
||||
inputTokens?: number
|
||||
outputTokens?: number
|
||||
model?: string | null
|
||||
sessionId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
}
|
||||
|
||||
export type WorkflowTaskUncheckedCreateWithoutTranscriptionFailureCommentInput = {
|
||||
id?: string
|
||||
uid?: string
|
||||
teamId?: string | null
|
||||
projectId?: string | null
|
||||
assetId: string
|
||||
type?: $Enums.WorkflowTaskType | null
|
||||
status?: $Enums.WorkflowTaskStatus | null
|
||||
payload?:PrismaJson.WorkflowTaskPayload | Prisma.NullableJsonNullValueInput
|
||||
output?:PrismaJson.WorkflowTaskOutput | Prisma.NullableJsonNullValueInput
|
||||
heartbeat?: Date | string | null
|
||||
inputTokens?: number
|
||||
outputTokens?: number
|
||||
model?: string | null
|
||||
sessionId?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
}
|
||||
|
||||
export type WorkflowTaskCreateOrConnectWithoutTranscriptionFailureCommentInput = {
|
||||
where: Prisma.WorkflowTaskWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.WorkflowTaskCreateWithoutTranscriptionFailureCommentInput, Prisma.WorkflowTaskUncheckedCreateWithoutTranscriptionFailureCommentInput>
|
||||
}
|
||||
|
||||
export type WorkflowTaskUpsertWithoutTranscriptionFailureCommentInput = {
|
||||
update: Prisma.XOR<Prisma.WorkflowTaskUpdateWithoutTranscriptionFailureCommentInput, Prisma.WorkflowTaskUncheckedUpdateWithoutTranscriptionFailureCommentInput>
|
||||
create: Prisma.XOR<Prisma.WorkflowTaskCreateWithoutTranscriptionFailureCommentInput, Prisma.WorkflowTaskUncheckedCreateWithoutTranscriptionFailureCommentInput>
|
||||
where?: Prisma.WorkflowTaskWhereInput
|
||||
}
|
||||
|
||||
export type WorkflowTaskUpdateToOneWithWhereWithoutTranscriptionFailureCommentInput = {
|
||||
where?: Prisma.WorkflowTaskWhereInput
|
||||
data: Prisma.XOR<Prisma.WorkflowTaskUpdateWithoutTranscriptionFailureCommentInput, Prisma.WorkflowTaskUncheckedUpdateWithoutTranscriptionFailureCommentInput>
|
||||
}
|
||||
|
||||
export type WorkflowTaskUpdateWithoutTranscriptionFailureCommentInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
uid?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
teamId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
type?: Prisma.NullableEnumWorkflowTaskTypeFieldUpdateOperationsInput | $Enums.WorkflowTaskType | null
|
||||
status?: Prisma.NullableEnumWorkflowTaskStatusFieldUpdateOperationsInput | $Enums.WorkflowTaskStatus | null
|
||||
payload?:PrismaJson.WorkflowTaskPayload | Prisma.NullableJsonNullValueInput
|
||||
output?:PrismaJson.WorkflowTaskOutput | Prisma.NullableJsonNullValueInput
|
||||
heartbeat?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
inputTokens?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
outputTokens?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
model?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
export type WorkflowTaskUncheckedUpdateWithoutTranscriptionFailureCommentInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
uid?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
teamId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
type?: Prisma.NullableEnumWorkflowTaskTypeFieldUpdateOperationsInput | $Enums.WorkflowTaskType | null
|
||||
status?: Prisma.NullableEnumWorkflowTaskStatusFieldUpdateOperationsInput | $Enums.WorkflowTaskStatus | null
|
||||
payload?:PrismaJson.WorkflowTaskPayload | Prisma.NullableJsonNullValueInput
|
||||
output?:PrismaJson.WorkflowTaskOutput | Prisma.NullableJsonNullValueInput
|
||||
heartbeat?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
inputTokens?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
outputTokens?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
model?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
|
||||
|
||||
export type WorkflowTaskSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
@@ -614,6 +734,7 @@ export type WorkflowTaskSelect<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
sessionId?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
transcriptionFailureComment?: boolean | Prisma.WorkflowTask$transcriptionFailureCommentArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["workflowTask"]>
|
||||
|
||||
export type WorkflowTaskSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
@@ -674,10 +795,17 @@ export type WorkflowTaskSelectScalar = {
|
||||
}
|
||||
|
||||
export type WorkflowTaskOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "uid" | "teamId" | "projectId" | "assetId" | "type" | "status" | "payload" | "output" | "heartbeat" | "inputTokens" | "outputTokens" | "model" | "sessionId" | "createdAt" | "updatedAt", ExtArgs["result"]["workflowTask"]>
|
||||
export type WorkflowTaskInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
transcriptionFailureComment?: boolean | Prisma.WorkflowTask$transcriptionFailureCommentArgs<ExtArgs>
|
||||
}
|
||||
export type WorkflowTaskIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {}
|
||||
export type WorkflowTaskIncludeUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {}
|
||||
|
||||
export type $WorkflowTaskPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
name: "WorkflowTask"
|
||||
objects: {}
|
||||
objects: {
|
||||
transcriptionFailureComment: Prisma.$AssetCommentPayload<ExtArgs> | null
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
uid: string
|
||||
@@ -1095,6 +1223,7 @@ readonly fields: WorkflowTaskFieldRefs;
|
||||
*/
|
||||
export interface Prisma__WorkflowTaskClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
transcriptionFailureComment<T extends Prisma.WorkflowTask$transcriptionFailureCommentArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.WorkflowTask$transcriptionFailureCommentArgs<ExtArgs>>): Prisma.Prisma__AssetCommentClient<runtime.Types.Result.GetResult<Prisma.$AssetCommentPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
@@ -1156,6 +1285,10 @@ export type WorkflowTaskFindUniqueArgs<ExtArgs extends runtime.Types.Extensions.
|
||||
* Omit specific fields from the WorkflowTask
|
||||
*/
|
||||
omit?: Prisma.WorkflowTaskOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.WorkflowTaskInclude<ExtArgs> | null
|
||||
/**
|
||||
* Filter, which WorkflowTask to fetch.
|
||||
*/
|
||||
@@ -1174,6 +1307,10 @@ export type WorkflowTaskFindUniqueOrThrowArgs<ExtArgs extends runtime.Types.Exte
|
||||
* Omit specific fields from the WorkflowTask
|
||||
*/
|
||||
omit?: Prisma.WorkflowTaskOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.WorkflowTaskInclude<ExtArgs> | null
|
||||
/**
|
||||
* Filter, which WorkflowTask to fetch.
|
||||
*/
|
||||
@@ -1192,6 +1329,10 @@ export type WorkflowTaskFindFirstArgs<ExtArgs extends runtime.Types.Extensions.I
|
||||
* Omit specific fields from the WorkflowTask
|
||||
*/
|
||||
omit?: Prisma.WorkflowTaskOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.WorkflowTaskInclude<ExtArgs> | null
|
||||
/**
|
||||
* Filter, which WorkflowTask to fetch.
|
||||
*/
|
||||
@@ -1240,6 +1381,10 @@ export type WorkflowTaskFindFirstOrThrowArgs<ExtArgs extends runtime.Types.Exten
|
||||
* Omit specific fields from the WorkflowTask
|
||||
*/
|
||||
omit?: Prisma.WorkflowTaskOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.WorkflowTaskInclude<ExtArgs> | null
|
||||
/**
|
||||
* Filter, which WorkflowTask to fetch.
|
||||
*/
|
||||
@@ -1288,6 +1433,10 @@ export type WorkflowTaskFindManyArgs<ExtArgs extends runtime.Types.Extensions.In
|
||||
* Omit specific fields from the WorkflowTask
|
||||
*/
|
||||
omit?: Prisma.WorkflowTaskOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.WorkflowTaskInclude<ExtArgs> | null
|
||||
/**
|
||||
* Filter, which WorkflowTasks to fetch.
|
||||
*/
|
||||
@@ -1336,6 +1485,10 @@ export type WorkflowTaskCreateArgs<ExtArgs extends runtime.Types.Extensions.Inte
|
||||
* Omit specific fields from the WorkflowTask
|
||||
*/
|
||||
omit?: Prisma.WorkflowTaskOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.WorkflowTaskInclude<ExtArgs> | null
|
||||
/**
|
||||
* The data needed to create a WorkflowTask.
|
||||
*/
|
||||
@@ -1384,6 +1537,10 @@ export type WorkflowTaskUpdateArgs<ExtArgs extends runtime.Types.Extensions.Inte
|
||||
* Omit specific fields from the WorkflowTask
|
||||
*/
|
||||
omit?: Prisma.WorkflowTaskOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.WorkflowTaskInclude<ExtArgs> | null
|
||||
/**
|
||||
* The data needed to update a WorkflowTask.
|
||||
*/
|
||||
@@ -1450,6 +1607,10 @@ export type WorkflowTaskUpsertArgs<ExtArgs extends runtime.Types.Extensions.Inte
|
||||
* Omit specific fields from the WorkflowTask
|
||||
*/
|
||||
omit?: Prisma.WorkflowTaskOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.WorkflowTaskInclude<ExtArgs> | null
|
||||
/**
|
||||
* The filter to search for the WorkflowTask to update in case it exists.
|
||||
*/
|
||||
@@ -1476,6 +1637,10 @@ export type WorkflowTaskDeleteArgs<ExtArgs extends runtime.Types.Extensions.Inte
|
||||
* Omit specific fields from the WorkflowTask
|
||||
*/
|
||||
omit?: Prisma.WorkflowTaskOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.WorkflowTaskInclude<ExtArgs> | null
|
||||
/**
|
||||
* Filter which WorkflowTask to delete.
|
||||
*/
|
||||
@@ -1496,6 +1661,25 @@ export type WorkflowTaskDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.
|
||||
limit?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* WorkflowTask.transcriptionFailureComment
|
||||
*/
|
||||
export type WorkflowTask$transcriptionFailureCommentArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the AssetComment
|
||||
*/
|
||||
select?: Prisma.AssetCommentSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the AssetComment
|
||||
*/
|
||||
omit?: Prisma.AssetCommentOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.AssetCommentInclude<ExtArgs> | null
|
||||
where?: Prisma.AssetCommentWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* WorkflowTask without action
|
||||
*/
|
||||
@@ -1508,4 +1692,8 @@ export type WorkflowTaskDefaultArgs<ExtArgs extends runtime.Types.Extensions.Int
|
||||
* Omit specific fields from the WorkflowTask
|
||||
*/
|
||||
omit?: Prisma.WorkflowTaskOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.WorkflowTaskInclude<ExtArgs> | null
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@ export function registerWorkflowTrigger(cb: WorkflowTriggerCallback) {
|
||||
onWorkflowTaskCreated = cb
|
||||
}
|
||||
|
||||
export async function notifyWorkflowTaskCreated(task: WorkflowTask): Promise<void> {
|
||||
if (task.status === 'pending') await onWorkflowTaskCreated?.(task)
|
||||
}
|
||||
|
||||
// Global callback for workflow task cancellation (decouples db/core packages from workflow engine)
|
||||
type WorkflowCancelCallback = (taskId: string) => Promise<void>
|
||||
let onWorkflowTaskCancelled: WorkflowCancelCallback | null = null
|
||||
@@ -149,9 +153,7 @@ function createPrismaClient() {
|
||||
workflowTask: {
|
||||
async create({ args, query }) {
|
||||
const result = await query(args)
|
||||
if (onWorkflowTaskCreated && (result as WorkflowTask).status === 'pending') {
|
||||
onWorkflowTaskCreated(result as WorkflowTask).catch(console.error)
|
||||
}
|
||||
notifyWorkflowTaskCreated(result as WorkflowTask).catch(console.error)
|
||||
return result
|
||||
},
|
||||
},
|
||||
|
||||
@@ -8,13 +8,7 @@ declare global {
|
||||
writes: import('./generated/prisma/internal/prismaNamespace').JsonValue[]
|
||||
}
|
||||
|
||||
export interface AgentSessionUsage {
|
||||
inputTokens: number
|
||||
outputTokens: number
|
||||
cacheReadTokens: number
|
||||
totalTokens: number
|
||||
cost: number
|
||||
}
|
||||
export type AgentSessionUsage = import('@shumai/dtos').AiUsageMetrics
|
||||
|
||||
export type PiSessionEntryData = { [key: string]: unknown }
|
||||
|
||||
@@ -129,6 +123,7 @@ declare global {
|
||||
transcode?: TranscodeSettings
|
||||
turntable?: TurntableSettings
|
||||
gotenberg?: GotenbergSettings
|
||||
embeddingServer?: { url?: string }
|
||||
mediaGeneration?: MediaGenerationSettings
|
||||
appearance?: AppearanceSettings
|
||||
emailNotification?: EmailNotificationSettings
|
||||
@@ -383,6 +378,7 @@ declare global {
|
||||
imageAnnotation?: ImageAnnotationSpec
|
||||
pdfPages?: PdfPagesSpec
|
||||
videoChunks?: VideoChunksSpec
|
||||
transcription?: { language: string | null; model: string }
|
||||
/** Render that produced this result, if any (set by the read_asset pipeline). */
|
||||
assetRead?: AssetReadRequest
|
||||
watermark?: WatermarkTaskPayload
|
||||
@@ -409,6 +405,7 @@ declare global {
|
||||
|
||||
export interface WorkflowTaskOutput {
|
||||
error?: string
|
||||
transcription?: { transcriptId: string; language: string } | { noSpeech: true }
|
||||
recoveryAttempts?: number
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"zod": "4.5.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import type { EntryRecord } from '@earendil-works/pi-durable'
|
||||
import { AgentType } from '@shumai/db/enums'
|
||||
import { z } from 'zod'
|
||||
import type { AiUsageMetrics } from './ai'
|
||||
|
||||
export * from './agent-avatar'
|
||||
|
||||
@@ -143,3 +145,8 @@ export const agentSessionSchema = z.object({
|
||||
agentId: z.string().optional(),
|
||||
})
|
||||
export type AgentSessionInfo = z.infer<typeof agentSessionSchema>
|
||||
|
||||
export interface AgentSessionLogs {
|
||||
entries: EntryRecord[]
|
||||
usage: AiUsageMetrics | null
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ export const assetInfoSchema = z.object({
|
||||
type: z.string(),
|
||||
targetType: z.string().optional().nullable(),
|
||||
status: z.string(),
|
||||
mediaType: z.string().nullable().optional(),
|
||||
proxyType: z.enum(['image', 'video', 'audio', 'pdf', '3d']).nullable().optional(),
|
||||
latestChildren: z.array(childPreviewSchema).optional(),
|
||||
preview: previewInfoSchema.nullable().optional(),
|
||||
|
||||
@@ -26,6 +26,7 @@ export * from './search'
|
||||
export * from './share'
|
||||
export * from './skill'
|
||||
export * from './team'
|
||||
export * from './transcript'
|
||||
export * from './upload'
|
||||
export * from './user-metadata'
|
||||
export * from './versionStack'
|
||||
|
||||
@@ -13,6 +13,10 @@ export const KNOWN_APIS = [
|
||||
'google-vertex',
|
||||
] as const
|
||||
|
||||
const jsonObjectSchema = z
|
||||
.record(z.string(), z.unknown())
|
||||
.refine((value) => z.json().safeParse(value).success)
|
||||
|
||||
// We define a serializable version of ProviderConfig for our API and DB
|
||||
// as the original ProviderConfig interface includes non-serializable fields (functions)
|
||||
export const providerModelConfigSchema = z.object({
|
||||
@@ -21,6 +25,9 @@ export const providerModelConfigSchema = z.object({
|
||||
input: z.array(z.enum(['text', 'image'])).default(['text']),
|
||||
contextWindow: z.number().int().positive().default(128000),
|
||||
maxTokens: z.number().int().positive().default(4096),
|
||||
compat: jsonObjectSchema.optional(),
|
||||
thinkingLevelMap: jsonObjectSchema.optional(),
|
||||
headers: z.record(z.string(), z.string()).optional(),
|
||||
cost: z.object({
|
||||
input: z.number().nonnegative().default(0),
|
||||
output: z.number().nonnegative().default(0),
|
||||
@@ -78,60 +85,58 @@ export const updateModelRequestSchema = z.object({
|
||||
|
||||
export type UpdateModelRequest = z.infer<typeof updateModelRequestSchema>
|
||||
|
||||
export const providerRefreshUnavailableReasonSchema = z.enum([
|
||||
'unsupported_connection',
|
||||
'legacy_kimi_connection',
|
||||
'azure_deployment_required',
|
||||
'catalog_unavailable',
|
||||
])
|
||||
|
||||
export type ProviderRefreshUnavailableReason = z.infer<
|
||||
typeof providerRefreshUnavailableReasonSchema
|
||||
>
|
||||
|
||||
export const providerResponseSchema = z.object({
|
||||
id: z.string(),
|
||||
teamId: z.string(),
|
||||
name: z.string(),
|
||||
isBuiltin: z.boolean(),
|
||||
config: providerConfigSchema,
|
||||
models: z.array(providerModelSchema).optional(),
|
||||
modelsCount: z.number().optional(),
|
||||
configured: z.boolean(),
|
||||
refreshUnavailableReason: providerRefreshUnavailableReasonSchema.nullable(),
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
})
|
||||
|
||||
export type ProviderResponse = z.infer<typeof providerResponseSchema>
|
||||
|
||||
export const syncModelItemSchema = z.object({
|
||||
modelId: z.string().min(1),
|
||||
name: z.string().default(''),
|
||||
config: providerModelConfigSchema,
|
||||
export const refreshedProviderModelSchema = createModelRequestSchema.pick({
|
||||
modelId: true,
|
||||
name: true,
|
||||
config: true,
|
||||
})
|
||||
|
||||
export type SyncModelItem = z.infer<typeof syncModelItemSchema>
|
||||
export type RefreshedProviderModel = z.infer<typeof refreshedProviderModelSchema>
|
||||
|
||||
export const syncProviderItemSchema = z.object({
|
||||
name: z.string(),
|
||||
isNewProvider: z.boolean(),
|
||||
config: providerConfigSchema,
|
||||
models: z.array(syncModelItemSchema),
|
||||
export const providerModelRefreshResponseSchema = z.discriminatedUnion('status', [
|
||||
z.object({
|
||||
status: z.literal('ready'),
|
||||
providerUpdatedAt: z.iso.datetime(),
|
||||
models: z.array(refreshedProviderModelSchema),
|
||||
}),
|
||||
z.object({
|
||||
status: z.literal('unavailable'),
|
||||
reason: providerRefreshUnavailableReasonSchema,
|
||||
}),
|
||||
])
|
||||
|
||||
export type ProviderModelRefreshResponse = z.infer<typeof providerModelRefreshResponseSchema>
|
||||
|
||||
export const importProviderModelsRequestSchema = z.object({
|
||||
providerUpdatedAt: z.iso.datetime(),
|
||||
modelIds: z.array(z.string().min(1)).min(1),
|
||||
})
|
||||
|
||||
export type SyncProviderItem = z.infer<typeof syncProviderItemSchema>
|
||||
|
||||
export const syncCheckResponseSchema = z.object({
|
||||
providers: z.array(syncProviderItemSchema),
|
||||
totalNewProviders: z.number(),
|
||||
totalNewModels: z.number(),
|
||||
})
|
||||
|
||||
export type SyncCheckResponse = z.infer<typeof syncCheckResponseSchema>
|
||||
|
||||
export const syncApplyRequestSchema = z.object({
|
||||
providers: z.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
isNewProvider: z.boolean(),
|
||||
config: providerConfigSchema,
|
||||
models: z.array(syncModelItemSchema),
|
||||
}),
|
||||
),
|
||||
})
|
||||
|
||||
export type SyncApplyRequest = z.infer<typeof syncApplyRequestSchema>
|
||||
|
||||
export const syncApplyResponseSchema = z.object({
|
||||
addedProviders: z.number(),
|
||||
addedModels: z.number(),
|
||||
})
|
||||
|
||||
export type SyncApplyResponse = z.infer<typeof syncApplyResponseSchema>
|
||||
export type ImportProviderModelsRequest = z.infer<typeof importProviderModelsRequestSchema>
|
||||
|
||||
@@ -213,6 +213,30 @@ export const updateGotenbergSettingsRequestSchema = z.object({
|
||||
})
|
||||
export type UpdateGotenbergSettingsRequest = z.infer<typeof updateGotenbergSettingsRequestSchema>
|
||||
|
||||
export const embeddingServerSettingsResponseSchema = z.object({
|
||||
url: z.string().optional(),
|
||||
isEnvConfigured: z.boolean(),
|
||||
})
|
||||
export type EmbeddingServerSettingsResponse = z.infer<typeof embeddingServerSettingsResponseSchema>
|
||||
|
||||
export const updateEmbeddingServerSettingsRequestSchema = z.object({
|
||||
url: z
|
||||
.string()
|
||||
.trim()
|
||||
.refine((value) => {
|
||||
if (!value) return true
|
||||
const url = URL.parse(value)
|
||||
return (
|
||||
url !== null &&
|
||||
/^https?:\/\//i.test(value) &&
|
||||
!url.username &&
|
||||
!url.password &&
|
||||
!value.includes('?') &&
|
||||
!value.includes('#')
|
||||
)
|
||||
}, 'Enter an HTTP or HTTPS URL without credentials, a query string, or a fragment.'),
|
||||
})
|
||||
|
||||
export interface TeamAppearanceSettings {
|
||||
hideAgent?: boolean
|
||||
}
|
||||
@@ -228,6 +252,9 @@ export interface TeamSettingsResponse {
|
||||
}
|
||||
turntable?: TurntableSettingsResponse
|
||||
gotenberg?: GotenbergSettingsResponse
|
||||
embeddingServer?: EmbeddingServerSettingsResponse
|
||||
localEmbeddingProviderConfigured?: boolean
|
||||
transcriptionAgentManagedByEnv?: boolean
|
||||
appearance?: TeamAppearanceSettings
|
||||
semanticSearchEnabled?: boolean
|
||||
archiveStorage?: ArchiveStorageInfo
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const transcriptLanguageCodeSchema = z.string().regex(/^[a-z]{2,3}$/)
|
||||
|
||||
export type SavedTranscriptLanguages = { languages: string[] }
|
||||
|
||||
export type TranscriptSegment = {
|
||||
id: string
|
||||
startMs: number
|
||||
endMs: number
|
||||
text: string
|
||||
}
|
||||
|
||||
export type SavedTranscript = {
|
||||
id: string
|
||||
language: string
|
||||
segments: TranscriptSegment[]
|
||||
}
|
||||
|
||||
export const generateTranscriptRequestSchema = z.object({
|
||||
language: transcriptLanguageCodeSchema.optional(),
|
||||
})
|
||||
|
||||
export const updateTranscriptSegmentRequestSchema = z.strictObject({
|
||||
text: z.string().refine((text) => !text.includes('\0')),
|
||||
})
|
||||
|
||||
export const transcriptLanguagesSchema = z.object({
|
||||
model: z.string().min(1),
|
||||
languages: z.array(z.object({ code: transcriptLanguageCodeSchema, name: z.string().min(1) })),
|
||||
})
|
||||
|
||||
interface TranscriptVideoProxy {
|
||||
key?: string
|
||||
resolution?: string
|
||||
width: number
|
||||
height: number
|
||||
}
|
||||
|
||||
// Archive and restore move the original while the full video proxy stays available.
|
||||
export const transcriptVideoStatuses = ['processed', 'archiving', 'archived', 'restoring'] as const
|
||||
|
||||
export function isTranscriptVideoReady(status: string) {
|
||||
return transcriptVideoStatuses.some((readyStatus) => readyStatus === status)
|
||||
}
|
||||
|
||||
export function selectTranscriptVideoProxyKey(
|
||||
media?: { videoTranscodes?: TranscriptVideoProxy[]; videoPreview?: { key?: string } } | null,
|
||||
): string | undefined {
|
||||
let selectedKey: string | undefined
|
||||
let smallestArea = Infinity
|
||||
for (const proxy of media?.videoTranscodes ?? []) {
|
||||
if (!proxy.key || proxy.key === media?.videoPreview?.key || proxy.resolution === '180p') {
|
||||
continue
|
||||
}
|
||||
|
||||
const area = proxy.width > 0 && proxy.height > 0 ? proxy.width * proxy.height : Infinity
|
||||
if (area < smallestArea) {
|
||||
selectedKey = proxy.key
|
||||
smallestArea = area
|
||||
}
|
||||
}
|
||||
return selectedKey
|
||||
}
|
||||
|
||||
export const transcriptionErrors = {
|
||||
noAudio: 'The video does not contain an audio track',
|
||||
noProxy: 'A completed full video proxy is required to generate transcripts',
|
||||
tooLarge: 'Audio exceeds the embedding server upload limit',
|
||||
} as const
|
||||
|
||||
export type GenerateTranscriptResult =
|
||||
| { kind: 'queued' | 'busy'; taskId: string }
|
||||
| { kind: 'existing'; transcriptId: string; language: string }
|
||||
| { kind: 'no_speech' }
|
||||
|
||||
export type TranscriptJobStatus =
|
||||
| { status: 'pending' | 'processing' | 'completed' | 'no_speech'; taskId: string }
|
||||
| { status: 'failed'; taskId: string; reason: keyof typeof transcriptionErrors | 'unknown' }
|
||||
@@ -4,8 +4,8 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@shumai/agent": "workspace:*",
|
||||
"@shumai/core": "workspace:*",
|
||||
|
||||
@@ -211,10 +211,14 @@ describe('Workflow E2E - agentEmbeddingMedia', () => {
|
||||
])(
|
||||
'indexes an entire video with %s and %s',
|
||||
async (embeddingProvider, fullSpriteState) => {
|
||||
vi.stubEnv('EMBEDDING_PROVIDER', embeddingProvider)
|
||||
const useSavedUrl =
|
||||
embeddingProvider === 'gemma-embedding-2-openai' &&
|
||||
fullSpriteState === 'available full sprite'
|
||||
const endpoint = 'https://embedding.example.com/v1/embeddings'
|
||||
vi.stubEnv('EMBEDDING_PROVIDER', useSavedUrl ? undefined : embeddingProvider)
|
||||
vi.stubEnv('GEMMA_EMBEDDING_OPENAI_BASE_URL', undefined)
|
||||
if (embeddingProvider === 'gemma-embedding-2-openai') {
|
||||
const endpoint = 'https://embedding.example.com/v1/embeddings'
|
||||
vi.stubEnv('GEMMA_EMBEDDING_OPENAI_BASE_URL', endpoint)
|
||||
if (!useSavedUrl) vi.stubEnv('GEMMA_EMBEDDING_OPENAI_BASE_URL', endpoint)
|
||||
const fetch = globalThis.fetch
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation((input, init) =>
|
||||
input === endpoint
|
||||
@@ -226,7 +230,10 @@ describe('Workflow E2E - agentEmbeddingMedia', () => {
|
||||
}
|
||||
// 1. Seed Database
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'E2E Video Embedding Team' },
|
||||
data: {
|
||||
name: 'E2E Video Embedding Team',
|
||||
settings: useSavedUrl ? { embeddingServer: { url: endpoint } } : undefined,
|
||||
},
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
|
||||
@@ -0,0 +1,307 @@
|
||||
import { execFile } from 'node:child_process'
|
||||
import { mkdtemp, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { basename, join } from 'node:path'
|
||||
import { promisify } from 'node:util'
|
||||
import { initAgentWorkflows } from '@shumai/agent'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import {
|
||||
getArchiveStorageService,
|
||||
resetArchiveStorageServiceForTests,
|
||||
} from '@shumai/core/src/s3/archive-storage'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { transcriptService } from '@shumai/core/src/transcript/transcript'
|
||||
import { transcodeService } from '@shumai/core/src/transcode/transcode'
|
||||
import { prisma, UserType } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { initTranscodeWorkflows } from '@shumai/transcode'
|
||||
import { TaskQueueAgent, TaskQueueArchive, workflowService } from '@shumai/workflow-core'
|
||||
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
const bucket = 'shumai-e2e-transcript'
|
||||
const preview = { key: 'video/180p.mp4', resolution: '180p', width: 32, height: 32 }
|
||||
const largerProxy = { key: 'video/720p.mp4', resolution: '720p', width: 96, height: 96 }
|
||||
const languages = {
|
||||
model: 'whisper-tiny',
|
||||
languages: [
|
||||
{ code: 'en', name: 'English' },
|
||||
{ code: 'zh', name: 'Chinese' },
|
||||
],
|
||||
}
|
||||
|
||||
describe('Transcribe video workflow', () => {
|
||||
setupTestDbHooks()
|
||||
let directory: string
|
||||
let provider: ReturnType<typeof Bun.serve>
|
||||
let responseStatus = 200
|
||||
let firstRequestBusy = false
|
||||
let uploads: Array<{
|
||||
language: FormDataEntryValue | null
|
||||
length: string | null
|
||||
hasTransferEncoding: boolean
|
||||
model: FormDataEntryValue | null
|
||||
format: FormDataEntryValue | null
|
||||
audio: Buffer
|
||||
}> = []
|
||||
|
||||
beforeAll(async () => {
|
||||
directory = await mkdtemp(join(tmpdir(), 'shumai-e2e-transcripts-'))
|
||||
await execFileAsync('ffmpeg', [
|
||||
'-v',
|
||||
'error',
|
||||
'-f',
|
||||
'lavfi',
|
||||
'-i',
|
||||
'color=size=64x64:duration=2',
|
||||
'-itsoffset',
|
||||
'1',
|
||||
'-f',
|
||||
'lavfi',
|
||||
'-i',
|
||||
'sine=frequency=440:duration=1',
|
||||
'-c:v',
|
||||
'mpeg4',
|
||||
'-c:a',
|
||||
'pcm_s16le',
|
||||
join(directory, 'audio.mkv'),
|
||||
])
|
||||
const fullProxy = { width: 64, height: 64 }
|
||||
for (const [fileName, { width, height }, disableAudio] of [
|
||||
['audio.mp4', fullProxy, false],
|
||||
['silent.mp4', fullProxy, true],
|
||||
['720p.mp4', largerProxy, true],
|
||||
['180p.mp4', preview, true],
|
||||
] as const) {
|
||||
await transcodeService.transcodeVideo({
|
||||
inputFile: join(directory, 'audio.mkv'),
|
||||
outputFile: join(directory, fileName),
|
||||
width,
|
||||
height,
|
||||
frameRate: 25,
|
||||
disableAudio,
|
||||
hardwareAcceleration: 'off',
|
||||
})
|
||||
}
|
||||
// Replace only the inference server and inspect what the worker sends over HTTP.
|
||||
provider = Bun.serve({
|
||||
hostname: '127.0.0.1',
|
||||
port: 0,
|
||||
async fetch(request) {
|
||||
const path = new URL(request.url).pathname
|
||||
if (path === '/v1/audio/transcriptions/languages') return Response.json(languages)
|
||||
if (path !== '/v1/audio/transcriptions' || request.method !== 'POST')
|
||||
return new Response(null, { status: 404 })
|
||||
|
||||
const form = await request.formData()
|
||||
const file = form.get('file')
|
||||
if (!(file instanceof File)) return new Response(null, { status: 400 })
|
||||
uploads.push({
|
||||
language: form.get('language'),
|
||||
length: request.headers.get('content-length'),
|
||||
hasTransferEncoding: request.headers.has('transfer-encoding'),
|
||||
model: form.get('model'),
|
||||
format: form.get('response_format'),
|
||||
audio: Buffer.from(await file.arrayBuffer()),
|
||||
})
|
||||
if (firstRequestBusy && uploads.length === 1) return new Response(null, { status: 429 })
|
||||
if (responseStatus !== 200) return new Response(null, { status: responseStatus })
|
||||
return Response.json({
|
||||
language: form.get('language') ?? 'en',
|
||||
text: 'Hello',
|
||||
segments: [{ start: 1.012, end: 1.875, text: 'Hello' }],
|
||||
})
|
||||
},
|
||||
})
|
||||
vi.stubEnv('S3_BUCKET', bucket)
|
||||
vi.stubEnv('EMBEDDING_PROVIDER', 'gemma-embedding-2-openai')
|
||||
vi.stubEnv('GEMMA_EMBEDDING_OPENAI_BASE_URL', `${provider.url}v1/embeddings/`)
|
||||
vi.stubEnv('ARCHIVE_STORAGE_BACKEND', 'local')
|
||||
vi.stubEnv('ARCHIVE_LOCAL_ROOT', join(directory, 'archive'))
|
||||
resetArchiveStorageServiceForTests()
|
||||
initAgentWorkflows()
|
||||
initTranscodeWorkflows()
|
||||
await workflowService.startWorkers([TaskQueueAgent, TaskQueueArchive])
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
uploads = []
|
||||
responseStatus = 200
|
||||
firstRequestBusy = false
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await workflowService.shutdownWorkers()
|
||||
workflowService.close()
|
||||
await provider?.stop(true)
|
||||
await s3Service.deletePrefix(bucket, '')
|
||||
if (directory) await rm(directory, { recursive: true, force: true })
|
||||
resetArchiveStorageServiceForTests()
|
||||
vi.unstubAllEnvs()
|
||||
})
|
||||
|
||||
async function createVideo(name: string, originalKey = 'video/unavailable-original.mkv') {
|
||||
const team = await prisma.team.create({ data: { name: 'Transcription E2E' } })
|
||||
await prisma.agent.create({
|
||||
data: {
|
||||
type: 'transcription',
|
||||
config: { provider: '', model: '' },
|
||||
team: { connect: { id: team.id } },
|
||||
user: {
|
||||
create: {
|
||||
name: 'Transcript Agent',
|
||||
email: `${team.id}@transcripts.test`,
|
||||
type: UserType.agent,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
const project = await prisma.project.create({ data: { name: 'Videos', teamId: team.id } })
|
||||
const fullProxy = { key: `video/${name}`, resolution: '480p', width: 64, height: 64 }
|
||||
await Promise.all(
|
||||
[preview, largerProxy, fullProxy].map(({ key }) =>
|
||||
s3Service.uploadFileToKey(join(directory, basename(key)), key, 'video/mp4'),
|
||||
),
|
||||
)
|
||||
return await prisma.asset.create({
|
||||
data: {
|
||||
name,
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
project: { connect: { id: project.id } },
|
||||
mediaType: 'video/x-matroska',
|
||||
storageKey: { create: { key: originalKey } },
|
||||
media: {
|
||||
proxyType: 'video',
|
||||
videoTranscodes: [largerProxy, preview, fullProxy],
|
||||
videoPreview: preview,
|
||||
imageTranscodes: [],
|
||||
duration: 2,
|
||||
filesize: 0,
|
||||
frames: 50,
|
||||
finishedAt: new Date().toISOString(),
|
||||
metadata: null,
|
||||
original: null,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
async function startTranscript(assetId: string, language: string | null) {
|
||||
const result = await transcriptService.generate(assetId, language)
|
||||
if (result.kind !== 'queued') throw new Error(`Unexpected generation result ${result.kind}`)
|
||||
return {
|
||||
assetId,
|
||||
task: await prisma.workflowTask.findUniqueOrThrow({ where: { id: result.taskId } }),
|
||||
}
|
||||
}
|
||||
|
||||
async function submitVideo(name: string, language: string | null) {
|
||||
const asset = await createVideo(name)
|
||||
return await startTranscript(asset.id, language)
|
||||
}
|
||||
|
||||
it('generates and saves a transcript after the archive workflow moves the original', async () => {
|
||||
const originalKey = 'video/archive-original.mkv'
|
||||
await s3Service.uploadFileToKey(join(directory, 'audio.mkv'), originalKey, 'video/x-matroska')
|
||||
const asset = await createVideo('audio.mp4', originalKey)
|
||||
const { taskIds } = await assetService.archiveAssets([asset.id])
|
||||
expect(taskIds).toHaveLength(1)
|
||||
const archiveTask = await prisma.workflowTask.findUniqueOrThrow({ where: { id: taskIds[0] } })
|
||||
await workflowService.executeWait(archiveTask, 20_000)
|
||||
await expect(prisma.asset.findUnique({ where: { id: asset.id } })).resolves.toMatchObject({
|
||||
status: 'archived',
|
||||
})
|
||||
await expect(s3Service.headObject(bucket, originalKey)).rejects.toThrow('NoSuchKey')
|
||||
await expect(getArchiveStorageService().headObject(originalKey)).resolves.toMatchObject({
|
||||
size: expect.any(Number),
|
||||
})
|
||||
|
||||
const { task } = await startTranscript(asset.id, 'en')
|
||||
await workflowService.executeWait(task, 20_000)
|
||||
|
||||
expect(uploads).toHaveLength(1)
|
||||
await expect(transcriptService.getSavedTranscript(asset.id, 'en')).resolves.toMatchObject({
|
||||
segments: [{ startMs: 1012, endMs: 1875, text: 'Hello' }],
|
||||
})
|
||||
}, 45_000)
|
||||
|
||||
it('uses the smallest full proxy to send a timeline-aligned WAV and saves the detected language and segments after retrying a busy server', async () => {
|
||||
firstRequestBusy = true
|
||||
const { task, assetId } = await submitVideo('audio.mp4', null)
|
||||
await workflowService.executeWait(task, 20_000)
|
||||
|
||||
expect(uploads).toHaveLength(2)
|
||||
const upload = uploads[1]
|
||||
expect(upload).toMatchObject({
|
||||
language: null,
|
||||
hasTransferEncoding: false,
|
||||
model: 'whisper-tiny',
|
||||
format: 'verbose_json',
|
||||
})
|
||||
expect(Number(upload.length)).toBeGreaterThan(upload.audio.length)
|
||||
expect(upload.audio.toString('ascii', 0, 4)).toBe('RIFF')
|
||||
expect(upload.audio.readUInt16LE(22)).toBe(1)
|
||||
expect(upload.audio.readUInt32LE(24)).toBe(16_000)
|
||||
expect(upload.audio.readUInt16LE(34)).toBe(16)
|
||||
const pcm = upload.audio.indexOf('data', 36) + 8
|
||||
expect(upload.audio.subarray(pcm, pcm + 30_000).every((sample) => sample === 0)).toBe(true)
|
||||
expect(upload.audio.subarray(pcm + 34_000).some((sample) => sample !== 0)).toBe(true)
|
||||
|
||||
const transcript = await prisma.assetTranscript.findUniqueOrThrow({
|
||||
where: { assetIdLanguage: { assetId, language: 'en' } },
|
||||
include: { segments: true },
|
||||
})
|
||||
expect(transcript).toMatchObject({
|
||||
model: 'whisper-tiny',
|
||||
workflowTaskId: task.id,
|
||||
segments: [{ position: 0, startMs: 1012, endMs: 1875, text: 'Hello' }],
|
||||
})
|
||||
await vi.waitFor(async () =>
|
||||
expect(await s3Service.listObjects(bucket, 'temp/transcripts/')).toEqual([]),
|
||||
)
|
||||
}, 24_000)
|
||||
|
||||
it('passes an explicit language and treats an upload limit error as permanent', async () => {
|
||||
responseStatus = 413
|
||||
const { task, assetId } = await submitVideo('audio.mp4', 'zh')
|
||||
await expect(workflowService.executeWait(task, 20_000)).rejects.toThrow(
|
||||
'Audio exceeds the embedding server upload limit',
|
||||
)
|
||||
expect(uploads).toHaveLength(1)
|
||||
expect(uploads[0].language).toBe('zh')
|
||||
expect(await transcriptService.getStatus(assetId)).toEqual({
|
||||
taskId: task.id,
|
||||
status: 'failed',
|
||||
reason: 'tooLarge',
|
||||
})
|
||||
expect(await prisma.assetTranscript.count({ where: { assetId } })).toBe(0)
|
||||
const comments = await prisma.assetComment.findMany({
|
||||
where: { assetId },
|
||||
include: { creator: true },
|
||||
})
|
||||
expect(comments).toHaveLength(1)
|
||||
expect(comments[0]).toMatchObject({
|
||||
transcriptionTaskId: task.id,
|
||||
isInternal: true,
|
||||
message: 'Transcription failed. Audio exceeds the embedding server upload limit.',
|
||||
creator: { name: 'Transcript Agent' },
|
||||
})
|
||||
await vi.waitFor(async () =>
|
||||
expect(await s3Service.listObjects(bucket, 'temp/transcripts/')).toEqual([]),
|
||||
)
|
||||
}, 24_000)
|
||||
|
||||
it('fails with a clear message when the video has no audio track', async () => {
|
||||
const { task, assetId } = await submitVideo('silent.mp4', null)
|
||||
await expect(workflowService.executeWait(task, 20_000)).rejects.toThrow(
|
||||
'The video does not contain an audio track',
|
||||
)
|
||||
expect(uploads).toHaveLength(0)
|
||||
expect(await transcriptService.getStatus(assetId)).toEqual({
|
||||
taskId: task.id,
|
||||
status: 'failed',
|
||||
reason: 'noAudio',
|
||||
})
|
||||
}, 24_000)
|
||||
})
|
||||
@@ -34,7 +34,15 @@ import { execFile } from 'child_process'
|
||||
import { promisify } from 'util'
|
||||
import { ulid } from 'ulid'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { ApplicationFailure, defineStep, getLocalTaskAbortSignal } from '@shumai/workflow-core'
|
||||
import {
|
||||
ApplicationFailure,
|
||||
defineStep,
|
||||
ensureLocalMediaFile,
|
||||
getErrorDetails,
|
||||
getLocalTaskAbortSignal,
|
||||
} from '@shumai/workflow-core'
|
||||
|
||||
export { ensureLocalMediaFile } from '@shumai/workflow-core'
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
|
||||
@@ -42,59 +50,6 @@ function getActivityCancellationSignal(taskId?: string): AbortSignal | undefined
|
||||
return getLocalTaskAbortSignal(taskId)
|
||||
}
|
||||
|
||||
function getErrorDetails(err: unknown): { code?: string; message: string; name?: string } {
|
||||
if (err && typeof err === 'object') {
|
||||
const record = err as Record<string, unknown>
|
||||
return {
|
||||
code: typeof record.code === 'string' ? record.code : undefined,
|
||||
message:
|
||||
typeof record.message === 'string'
|
||||
? record.message
|
||||
: err instanceof Error
|
||||
? err.message
|
||||
: String(err),
|
||||
name: typeof record.name === 'string' ? record.name : undefined,
|
||||
}
|
||||
}
|
||||
return {
|
||||
message: String(err),
|
||||
}
|
||||
}
|
||||
|
||||
export async function ensureLocalMediaFile(assetKey: string, filePath: string): Promise<string> {
|
||||
if (fs.existsSync(filePath)) {
|
||||
return filePath
|
||||
}
|
||||
const dir = path.dirname(filePath)
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, { recursive: true })
|
||||
}
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
try {
|
||||
await s3Service.downloadToFile(bucket, assetKey, filePath)
|
||||
} catch (err) {
|
||||
const { code, message, name } = getErrorDetails(err)
|
||||
const lowerMsg = message.toLowerCase()
|
||||
const lowerCode = (code || '').toLowerCase()
|
||||
const lowerName = (name || '').toLowerCase()
|
||||
if (
|
||||
lowerCode === 'enoent' ||
|
||||
lowerCode === 'nosuchkey' ||
|
||||
lowerName === 'nosuchkey' ||
|
||||
lowerMsg.includes('enoent') ||
|
||||
lowerMsg.includes('nosuchkey')
|
||||
) {
|
||||
throw ApplicationFailure.create({
|
||||
message: `Failed to download media to local file: ${message}`,
|
||||
nonRetryable: true,
|
||||
cause: err instanceof Error ? err : undefined,
|
||||
})
|
||||
}
|
||||
throw err
|
||||
}
|
||||
return filePath
|
||||
}
|
||||
|
||||
export interface GetMediaInfoActivityParams {
|
||||
assetId: string
|
||||
assetKey: string
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { client } from '@/ui/api/client'
|
||||
import { Button } from '@/ui/components/ui/button'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -6,18 +7,21 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/ui/components/ui/dialog'
|
||||
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from '@/ui/components/ui/popover'
|
||||
import { ScrollArea } from '@/ui/components/ui/scroll-area'
|
||||
import { Skeleton } from '@/ui/components/ui/skeleton'
|
||||
import { formatTimeAgo } from '@/ui/lib/time'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import { getLocale } from '@/ui/paraglide/runtime.js'
|
||||
import type { EntryRecord } from '@earendil-works/pi-durable'
|
||||
import { getShumaiMessage, serializeContextToXml } from '@shumai/dtos'
|
||||
import { getShumaiMessage, serializeContextToXml, type AiUsageMetrics } from '@shumai/dtos'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { Terminal } from 'lucide-react'
|
||||
import Markdown from 'react-markdown'
|
||||
|
||||
interface AgentSessionLogsDialogProps {
|
||||
sessionId?: string | null
|
||||
showUsage?: boolean
|
||||
open: boolean
|
||||
onOpenChange: (open: boolean) => void
|
||||
}
|
||||
@@ -61,20 +65,85 @@ function EntryLog({ entry }: { entry: EntryRecord }) {
|
||||
)
|
||||
}
|
||||
|
||||
function SessionUsage({ usage }: { usage: AiUsageMetrics }) {
|
||||
const locale = getLocale()
|
||||
const tokens = new Intl.NumberFormat(locale)
|
||||
const currency = new Intl.NumberFormat(locale, {
|
||||
style: 'currency',
|
||||
currency: 'USD',
|
||||
currencyDisplay: 'narrowSymbol',
|
||||
maximumFractionDigits: 3,
|
||||
})
|
||||
const cost =
|
||||
usage.cost > 0 && usage.cost < 0.001
|
||||
? `<${currency.format(0.001)}`
|
||||
: currency.format(usage.cost)
|
||||
const breakdown = [
|
||||
{ label: m.input_tokens(), count: usage.inputTokens },
|
||||
{ label: m.output_tokens(), count: usage.outputTokens },
|
||||
{ label: m.cache_read_tokens(), count: usage.cacheReadTokens },
|
||||
]
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-wrap gap-x-3 gap-y-1 tabular-nums">
|
||||
<span>
|
||||
{tokens.format(usage.totalTokens)} {m.tokens()}
|
||||
</span>
|
||||
<span>
|
||||
{cost} {m.session_usage_estimated_cost()}
|
||||
</span>
|
||||
</div>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="xs"
|
||||
className="font-normal text-muted-foreground"
|
||||
>
|
||||
{m.session_usage_breakdown()}
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent
|
||||
side="top"
|
||||
align="end"
|
||||
aria-label={m.session_usage_token_breakdown()}
|
||||
className="w-60 space-y-2 p-3 text-sm"
|
||||
>
|
||||
<p className="font-semibold">{m.session_usage_token_breakdown()}</p>
|
||||
<dl className="space-y-1 tabular-nums">
|
||||
{breakdown.map(({ label, count }) => (
|
||||
<div key={label} className="flex justify-between gap-3">
|
||||
<dt className="text-muted-foreground">{label}</dt>
|
||||
<dd>{tokens.format(count)}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
<p className="border-t pt-2 text-xs text-muted-foreground">
|
||||
{m.session_usage_cost_explanation()}
|
||||
</p>
|
||||
</PopoverContent>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export function AgentSessionLogsDialog({
|
||||
sessionId,
|
||||
showUsage = false,
|
||||
open,
|
||||
onOpenChange,
|
||||
}: AgentSessionLogsDialogProps) {
|
||||
const { data: entries, isLoading } = useQuery({
|
||||
queryKey: ['agent-sessions', sessionId, 'entries'],
|
||||
const { data: logs, isLoading } = useQuery({
|
||||
queryKey: ['agent-sessions', sessionId, 'entries', showUsage],
|
||||
queryFn: async () => {
|
||||
if (!sessionId) return []
|
||||
if (!sessionId) return { entries: [], usage: null }
|
||||
const response = await client.api['agent-sessions'][':sessionId'].entries.$get({
|
||||
param: { sessionId },
|
||||
query: showUsage ? { includeUsage: 'true' } : {},
|
||||
})
|
||||
if (!response.ok) throw new Error('Failed to fetch session logs')
|
||||
return (await response.json()) as EntryRecord[]
|
||||
const data = await response.json()
|
||||
return Array.isArray(data) ? { entries: data, usage: null } : data
|
||||
},
|
||||
enabled: open && !!sessionId,
|
||||
})
|
||||
@@ -93,10 +162,29 @@ export function AgentSessionLogsDialog({
|
||||
{isLoading ? (
|
||||
<Skeleton className="h-32 w-full" />
|
||||
) : (
|
||||
entries?.map((entry) => <EntryLog key={entry.id} entry={entry} />)
|
||||
logs?.entries.map((entry) => <EntryLog key={entry.id} entry={entry} />)
|
||||
)}
|
||||
</div>
|
||||
</ScrollArea>
|
||||
{showUsage && (
|
||||
<Popover>
|
||||
<PopoverAnchor asChild>
|
||||
<footer
|
||||
aria-label={m.session_usage()}
|
||||
aria-busy={isLoading}
|
||||
className="-mx-6 -mb-6 flex min-h-8 shrink-0 flex-wrap items-center justify-between gap-x-3 border-t bg-muted/30 px-3 py-0.5 text-xs text-muted-foreground"
|
||||
>
|
||||
{isLoading ? (
|
||||
<Skeleton className="h-4 w-44" />
|
||||
) : logs?.usage ? (
|
||||
<SessionUsage usage={logs.usage} />
|
||||
) : (
|
||||
m.session_usage_unavailable()
|
||||
)}
|
||||
</footer>
|
||||
</PopoverAnchor>
|
||||
</Popover>
|
||||
)}
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
)
|
||||
|
||||
@@ -183,6 +183,7 @@ export function AgentSessionsDashboard({ teamId }: AgentSessionsDashboardProps)
|
||||
|
||||
<AgentSessionLogsDialog
|
||||
sessionId={selectedSessionId}
|
||||
showUsage
|
||||
open={!!selectedSessionId}
|
||||
onOpenChange={(open) => {
|
||||
if (!open) setSelectedSessionId(null)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user