refactor(agent)!: migrate to Pi Durable and embed the agent queue (#525)

* refactor(agent)!: migrate sessions to Pi Durable

Replace patched AgentHarness storage with per-session SQLite and PostgreSQL commit mirroring. Migrate legacy history automatically and run agent queues with the main server.

BREAKING CHANGE: Remove standalone agent workers and return native Pi entry records from chat history APIs.

* fix(agent): constrain session log dialog scrolling

Keep the header visible and wrap long output while log entries and expanded records scroll within the dialog. Cover desktop and narrow viewports through the dashboard Sessions flow.

* fix(agent): hide entry IDs from session log card headers

Retain internal entry IDs in expanded raw records for debugging. Verify that card headers omit the IDs while raw JSON preserves them.

* test(e2e): handle browser wheel limits in session log checks

Verify that a normal wheel event moves the viewport before explicitly scrolling to the final record. Keep the dialog bounds, fixed header, wrapping, and expanded-record assertions.

* fix(agent): select model providers without inheriting unrelated auth

* fix(webui): prevent resize feedback when toggling agent panel

* test(agent): reproduce concurrent comment session races

* fix(agent): serialize comment sessions and deduplicate history

* docs(changelog): consolidate Pi Durable changes into one entry
This commit is contained in:
Yiling-J
2026-11-11 16:05:18 +08:00
committed by GitHub
parent 843a56304c
commit 35a0e82284
120 changed files with 7593 additions and 5972 deletions
+18 -11
View File
@@ -1,14 +1,15 @@
import { invokeTool } from '@shumai/core/src/agent/tool-test-utils'
import { vi } from 'vitest'
vi.mock('fs')
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
import { createGenerateVideoTool } from './generate-video'
import * as downloadAsset from './download-asset'
import { mediaGenerationService } from '@shumai/core/src/media-generation/media-generation'
import { EnabledMediaModel } from '@shumai/dtos'
import * as fs from 'fs'
import * as path from 'path'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import * as downloadAsset from './download-asset'
import { createGenerateVideoTool } from './generate-video'
describe('generate_video tool', () => {
const enabledModels: EnabledMediaModel[] = [
@@ -60,7 +61,6 @@ describe('generate_video tool', () => {
it('creates tool with correct metadata and provider-prefixed model schema', () => {
const tool = createGenerateVideoTool(enabledModels, providerKeys, 'user-1')
expect(tool.name).toBe('generate_video')
expect(tool.label).toBe('Generate Video')
expect(tool.description).toContain('Generate a video')
const modelDesc = (tool.parameters as { properties: { model: { description: string } } })
.properties.model.description
@@ -78,7 +78,8 @@ describe('generate_video tool', () => {
})
const writeSpy = vi.spyOn(fs, 'writeFileSync').mockImplementation(() => {})
const result = await tool.execute(
const result = await invokeTool(
tool,
'call-vid-1',
{
mode: 'text_to_video',
@@ -140,7 +141,8 @@ describe('generate_video tool', () => {
})
// Select fal:kling-v1-standard
await tool.execute(
await invokeTool(
tool,
'call-fal',
{
mode: 'text_to_video',
@@ -169,7 +171,8 @@ describe('generate_video tool', () => {
)
// Select klingai:kling-v1-standard
await tool.execute(
await invokeTool(
tool,
'call-klingai',
{
mode: 'text_to_video',
@@ -211,7 +214,8 @@ describe('generate_video tool', () => {
mimeType: 'image/png',
})
await tool.execute(
await invokeTool(
tool,
'call-vid-2',
{
mode: 'image_to_video',
@@ -257,7 +261,8 @@ describe('generate_video tool', () => {
mimeType: 'image/png',
}))
await tool.execute(
await invokeTool(
tool,
'call-vid-3',
{
mode: 'first_last_frame',
@@ -304,7 +309,8 @@ describe('generate_video tool', () => {
mimeType: 'image/png',
}))
await tool.execute(
await invokeTool(
tool,
'call-vid-4',
{
mode: 'reference_to_video',
@@ -343,7 +349,8 @@ describe('generate_video tool', () => {
const tool = createGenerateVideoTool(enabledModels, {}, 'user-1')
await expect(
tool.execute(
invokeTool(
tool,
'call-vid-5',
{
mode: 'text_to_video',